![]() |
Project
|
templated 1D-histogram class. More...
#include <FastHisto.h>
Public Member Functions | |
FastHisto (const unsigned int nBins=20, const float xmin=0.f, const float xmax=2.f, const bool useUnderflow=true, const bool useOverflow=true) | |
~FastHisto ()=default | |
default destructor | |
void | fill (const float val, T weight=1) |
int | findBin (const float val) const |
void | reset () |
this function resets the bin content in the histogram | |
void | fillBin (int index, T weight) |
void | print (const int prec=2) const |
math_utils::StatisticsData | getStatisticsData (const float low=0.05f, const float high=0.6f) const |
T | getBinContent (unsigned int index) const |
float | getBinCenter (int bin) const |
float | getBinWidth () const |
unsigned int | getNBins () const |
float | getXmin () const |
float | getXmax () const |
unsigned int | getEntries () const |
bool | isUnderflowSet () const |
bool | isOverflowSet () const |
bool | checkBin (int bin) const |
const FastHisto & | operator+= (const FastHisto &other) |
overload of operator + | |
templated 1D-histogram class.
This is a templated histogram class without any ROOT includes.
How to use: e.g.: create an array with 7 bins + underflow bin + overflow bins bin range is from xmin=0.4f to xmax=34.6f the values which will be filled are of the type float #define FMT_HEADER_ONLY; // to avoid undefined reference when using root shel o2::tpc::FastHisto<float> histo(7,0.4f,34.6f,true,true); histo.fill(4.5); histo.fill(20.2,3); histo.fill(35); histo.print() float mean = histo.getStatisticsData(0,1).mCOG; float TruncatedMean = histo.getStatisticsData(0.05,.6).mCOG;
Definition at line 51 of file FastHisto.h.
|
inline |
constructor this function is called when initializing the histogram object
nBins | number of bins used in the histogram |
xmin | minimum x value |
xmax | maximum x value (value is not included in the histogram. same as TH1 in ROOT) |
useUnderflow | use underflow bin in the histogram |
useOverflow | use overflow bin in the histogram |
Definition at line 62 of file FastHisto.h.
|
default |
default destructor
|
inline |
Definition at line 147 of file FastHisto.h.
|
inline |
this function fills the histogram with given value and weight
val | value which will be filled in the histogram |
weight | the weight of the filled value |
Definition at line 175 of file FastHisto.h.
|
inline |
this function increase the bin content for given index with given weight
index | the index (bin) for which the bin content is increased |
weight | weight of the filled content |
Definition at line 88 of file FastHisto.h.
|
inline |
this function returns the index (bin) for the input value
val | the value for which the bin index will be returned |
Definition at line 320 of file FastHisto.h.
|
inline |
|
inline |
index | the index (bin) for which the content is returned |
Definition at line 107 of file FastHisto.h.
|
inline |
Definition at line 126 of file FastHisto.h.
|
inline |
Definition at line 138 of file FastHisto.h.
|
inline |
Definition at line 129 of file FastHisto.h.
|
inline |
low | lower truncation range |
high | upper truncation range |
Definition at line 244 of file FastHisto.h.
|
inline |
Definition at line 135 of file FastHisto.h.
|
inline |
Definition at line 132 of file FastHisto.h.
|
inline |
Definition at line 144 of file FastHisto.h.
|
inline |
Definition at line 141 of file FastHisto.h.
|
inline |
overload of operator +
Definition at line 346 of file FastHisto.h.
|
inline |
this function prints out the histogram
type | printing type e.g 'vertical printing: type=0', 'horizontal printing: type=1' |
prec | sets the precision of the x axis label |
Definition at line 185 of file FastHisto.h.
|
inline |
this function resets the bin content in the histogram
Definition at line 79 of file FastHisto.h.