struct Gambit::DarkBit::SimpleHist

Histogram class for cascade decays.

#include <SimpleHist.hpp>

Public Functions

Name
SimpleHist()
SimpleHist(int nBins, double Emin, double Emax, bool logscale)
SimpleHist(std::vector< double > binLower)
voidaddEvent(double E, double weight =1.0)
Add an entry to histogram.
voidaddToBin(int bin, double weight =1.0)
Add an entry to a specified bin.
voidaddBox(double Emin, double Emax, double weight =1.0)
Add a box spectrum to the histogram.
voidaddHistAsWeights_sameBin(SimpleHist & in)
doublegetError(int bin) const
Get error for a specified bin.
doublegetRelError(int bin) const
Get relative error for a specified bin.
voiddivideByBinSize()
Divide all histogram bins by the respective bin size.
voidmultiply(double x)
Multiply all bin contents by x.
intfindIndex(double val) const
Find bin index for given value.
doublebinSize(int bin) const
Retrieve size of given bins.
doublebinCenter(int bin) const
Get central value of bin.
std::vector< double >getBinCenters() const
Double get central values of all bins.
const std::vector< double > &getBinValues() const
voidgetEdges(double & lower, double & upper) const

Public Attributes

Name
std::vector< double >binLower
std::vector< double >binVals
std::vector< double >wtSq
Sum of the squares of all weights.
intnBins

Public Functions Documentation

function SimpleHist

inline SimpleHist()

function SimpleHist

SimpleHist(
    int nBins,
    double Emin,
    double Emax,
    bool logscale
)

function SimpleHist

SimpleHist(
    std::vector< double > binLower
)

Constructor taking lower bins edges as input. Last element will be used as upper bin edge for upper bin (Vector with N elements will give N-1 bins).

function addEvent

void addEvent(
    double E,
    double weight =1.0
)

Add an entry to histogram.

function addToBin

void addToBin(
    int bin,
    double weight =1.0
)

Add an entry to a specified bin.

function addBox

void addBox(
    double Emin,
    double Emax,
    double weight =1.0
)

Add a box spectrum to the histogram.

function addHistAsWeights_sameBin

void addHistAsWeights_sameBin(
    SimpleHist & in
)

Add content of input histogram as weights. Important: Input histogram MUST have identical binning for this to give correct results.

function getError

double getError(
    int bin
) const

Get error for a specified bin.

function getRelError

double getRelError(
    int bin
) const

Get relative error for a specified bin.

function divideByBinSize

void divideByBinSize()

Divide all histogram bins by the respective bin size.

function multiply

void multiply(
    double x
)

Multiply all bin contents by x.

function findIndex

int findIndex(
    double val
) const

Find bin index for given value.

function binSize

double binSize(
    int bin
) const

Retrieve size of given bins.

function binCenter

double binCenter(
    int bin
) const

Get central value of bin.

function getBinCenters

std::vector< double > getBinCenters() const

Double get central values of all bins.

function getBinValues

const std::vector< double > & getBinValues() const

function getEdges

void getEdges(
    double & lower,
    double & upper
) const

Public Attributes Documentation

variable binLower

std::vector< double > binLower;

variable binVals

std::vector< double > binVals;

variable wtSq

std::vector< double > wtSq;

Sum of the squares of all weights.

variable nBins

int nBins;

Updated on 2023-06-26 at 21:36:52 +0000