MINT2
|
#include <HistogramBase.h>
Public Member Functions | |
HistogramBase (int nBins) | |
virtual | ~HistogramBase () |
int | checkBinNumber (int bin) const |
void | resetBinContents (int nBins) |
void | clear () |
void | fillBase (int binNum, double weight) |
void | setBinContent (int bin, double val) |
void | setBinError (int bin, double val) |
virtual void | merge (const HistogramBase &other) |
double | getBinContent (int bin) const |
double | getBinError (int bin) const |
int | getNBins () const |
void | divide (const HistogramBase &other) |
void | multiply (const HistogramBase &other) |
void | add (const HistogramBase &other) |
void | minus (const HistogramBase &other) |
void | pulls (const HistogramBase &other) |
void | pulls (const HistogramBase &other1, const HistogramBase &other2) |
void | asymmetry (const HistogramBase &other) |
void | asymmetry (const HistogramBase &other1, const HistogramBase &other2) |
void | drawPullHistogram (const HistogramBase &other, TString name, int nBins=50, double pmLimits=3.5) const |
double | chi2 (const HistogramBase &other) const |
double | pvalue (const HistogramBase &other, int ndof=-1) const |
double | chi2sig (const HistogramBase &other, int ndof=-1) const |
double | integral () const |
double | integralError () const |
void | randomiseWithinErrors (int seed) |
double | getMin () const |
double | getMax () const |
void | setMin (double min) |
void | setMax (double max) |
double | getMinDensity () const |
double | getMaxDensity () const |
void | setMinDensity (double min) |
void | setMaxDensity (double max) |
void | saveBase () |
void | saveBase (TString filename) |
void | loadBase (TString filename) |
void | normalise (double area=1.0) |
virtual double | getBinVolume (int bin) const |
double | getFrequencyDensity (int bin) const |
void | reserveCapacity (int nElements) |
void | makeFrequencyDensity () |
void | print () |
Protected Attributes | |
int | _nBins |
std::vector< double > | _binContents |
std::vector< double > | _sumW2 |
double | _min |
double | _max |
double | _minDensity |
double | _maxDensity |
HyperPlot, Author: Sam Harnew, sam.h , Date: Dec 2015 arne w@gma il.c om
The base class for any histogram object (my version of a TH1)
Definition at line 30 of file HistogramBase.h.
HistogramBase::HistogramBase | ( | int | nBins | ) |
Construct a histogram base with a specified number of bins
Definition at line 8 of file HistogramBase.cpp.
|
virtual |
void HistogramBase::add | ( | const HistogramBase & | other | ) |
Add this hitogram to another. Histograms must have the same number of bins
Definition at line 286 of file HistogramBase.cpp.
void HistogramBase::asymmetry | ( | const HistogramBase & | other | ) |
Definition at line 404 of file HistogramBase.cpp.
void HistogramBase::asymmetry | ( | const HistogramBase & | other1, |
const HistogramBase & | other2 | ||
) |
Definition at line 435 of file HistogramBase.cpp.
int HistogramBase::checkBinNumber | ( | int | bin | ) | const |
Check if it's a valid bin number, if not return the overflow/underflow bin
Definition at line 163 of file HistogramBase.cpp.
double HistogramBase::chi2 | ( | const HistogramBase & | other | ) | const |
Calculate the chi2 between this histogram and another. Histograms must have the same number of bins
Definition at line 515 of file HistogramBase.cpp.
double HistogramBase::chi2sig | ( | const HistogramBase & | other, |
int | ndof = -1 |
||
) | const |
Calculate the significance of the chi2 value obtained (in #sigma) given that it follows a chi2 distribution for ndof degrees of freedom. If ndof is not given it is assumed that ndof == nbins
Definition at line 504 of file HistogramBase.cpp.
void HistogramBase::clear | ( | ) |
Definition at line 28 of file HistogramBase.cpp.
void HistogramBase::divide | ( | const HistogramBase & | other | ) |
Divide this hitogram by another. Histograms must have the same number of bins
Definition at line 221 of file HistogramBase.cpp.
void HistogramBase::drawPullHistogram | ( | const HistogramBase & | other, |
TString | name, | ||
int | nBins = 50 , |
||
double | pmLimits = 3.5 |
||
) | const |
Draw the distribution of pulls between two histograms. They are only drawn between +- pmLimits sigma, using nBins. The plot is saved with the name 'name'.
Definition at line 542 of file HistogramBase.cpp.
void HistogramBase::fillBase | ( | int | binNum, |
double | weight | ||
) |
Fill the specifed bin with a specifed weight. Note that the bin numbers run from 0 to nBins-1 inclusive so that nBins is overflow/underflow
Definition at line 155 of file HistogramBase.cpp.
double HistogramBase::getBinContent | ( | int | bin | ) | const |
double HistogramBase::getBinError | ( | int | bin | ) | const |
|
virtual |
Get the bin volume. This is a virual function, as the bin volume depends on the binning used (which isn't defined here).
Reimplemented in HyperHistogram.
Definition at line 632 of file HistogramBase.cpp.
double HistogramBase::getFrequencyDensity | ( | int | bin | ) | const |
Get the frequency density in a bin - this is just the bin content divided by the bin volume
Definition at line 639 of file HistogramBase.cpp.
double HistogramBase::getMax | ( | ) | const |
If the user hasn't specified a minimum using setMax, then loop over the bins and find the maximum
Definition at line 188 of file HistogramBase.cpp.
double HistogramBase::getMaxDensity | ( | ) | const |
If the user hasn't specified a maximum using setMaxDensity, then loop over the bins and find the maximum density
Definition at line 210 of file HistogramBase.cpp.
double HistogramBase::getMin | ( | ) | const |
If the user hasn't specified a minimum using setMin, then loop over the bins and find the minimum
Definition at line 177 of file HistogramBase.cpp.
double HistogramBase::getMinDensity | ( | ) | const |
If the user hasn't specified a minimum using setMinDensity, then loop over the bins and find the minimum density
Definition at line 199 of file HistogramBase.cpp.
|
inline |
Get the number of bins in the histogram
Definition at line 63 of file HistogramBase.h.
double HistogramBase::integral | ( | ) | const |
Calcualte the integral (sum of bin contents, excluding the undeflow/overflow)
Definition at line 569 of file HistogramBase.cpp.
double HistogramBase::integralError | ( | ) | const |
Calcualte the error on the integral (excluding the undeflow/overflow)
Definition at line 579 of file HistogramBase.cpp.
void HistogramBase::loadBase | ( | TString | filename | ) |
Load the contents, sumw2, and bin numbers from a TTree in the ROOT file specified (opened using READ)
Definition at line 115 of file HistogramBase.cpp.
void HistogramBase::makeFrequencyDensity | ( | ) |
Replace all the bin contents with frequency density.
Definition at line 647 of file HistogramBase.cpp.
|
virtual |
Merge one HistogramBase with another
Reimplemented in HyperHistogram.
Definition at line 46 of file HistogramBase.cpp.
void HistogramBase::minus | ( | const HistogramBase & | other | ) |
Subtract other histogram from this one. Histograms must have the same number of bins
Definition at line 316 of file HistogramBase.cpp.
void HistogramBase::multiply | ( | const HistogramBase & | other | ) |
Multiply this hitogram by another. Histograms must have the same number of bins
Definition at line 254 of file HistogramBase.cpp.
void HistogramBase::normalise | ( | double | area = 1.0 | ) |
Normalise sum of bin contents to specified area. Errors are also scaled.
Definition at line 589 of file HistogramBase.cpp.
void HistogramBase::print | ( | ) |
Print the contents and errors of all the bins to the screen.
Definition at line 659 of file HistogramBase.cpp.
void HistogramBase::pulls | ( | const HistogramBase & | other | ) |
Find pulls between this histogram and another. Histograms must have the same number of bins
Definition at line 346 of file HistogramBase.cpp.
void HistogramBase::pulls | ( | const HistogramBase & | other1, |
const HistogramBase & | other2 | ||
) |
Find pulls between two histograms. Histograms must have the same number of bins
Definition at line 376 of file HistogramBase.cpp.
double HistogramBase::pvalue | ( | const HistogramBase & | other, |
int | ndof = -1 |
||
) | const |
Calculate the chi2 between this histogram and another, and use this to find a p-value using the specified degrees of freedom. If ndof isn't specified, nBins is used. Histograms must have the same number of bins
Definition at line 492 of file HistogramBase.cpp.
void HistogramBase::randomiseWithinErrors | ( | int | seed | ) |
Randomise the histogram within it's Gaussian errors using the given seed. If value is < 0.0 then content is set to 0.0. errors remain the same before and after randomisation.
Definition at line 472 of file HistogramBase.cpp.
void HistogramBase::reserveCapacity | ( | int | nElements | ) |
Definition at line 38 of file HistogramBase.cpp.
void HistogramBase::resetBinContents | ( | int | nBins | ) |
Update the number of bins and set all contents to zero
Definition at line 22 of file HistogramBase.cpp.
void HistogramBase::saveBase | ( | ) |
Save the contents, sumw2, and bin numbers in a TTree to an open TFile
Definition at line 77 of file HistogramBase.cpp.
void HistogramBase::saveBase | ( | TString | filename | ) |
Save the contents, sumw2, and bin numbers in a TTree into the ROOT file specified (opened using RECREATE)
Definition at line 102 of file HistogramBase.cpp.
void HistogramBase::setBinContent | ( | int | bin, |
double | val | ||
) |
void HistogramBase::setBinError | ( | int | bin, |
double | val | ||
) |
|
inline |
Set the maximum bin content for plotting
Definition at line 91 of file HistogramBase.h.
|
inline |
Set the maximum frequency density for plotting
Definition at line 96 of file HistogramBase.h.
|
inline |
Set the minimum bin content for plotting
Definition at line 90 of file HistogramBase.h.
|
inline |
Set the minimum frequency density for plotting
Definition at line 95 of file HistogramBase.h.
|
protected |
Bin contents (note that bin nBins is underflow/overflow)
Definition at line 35 of file HistogramBase.h.
|
protected |
Maximum bin content (for plotting)
Definition at line 39 of file HistogramBase.h.
|
protected |
Maximum bin density (bin content / bin volume) (for plotting)
Definition at line 41 of file HistogramBase.h.
|
protected |
Minimum bin content (for plotting)
Definition at line 38 of file HistogramBase.h.
|
protected |
Minimum bin density (bin content / bin volume) (for plotting)
Definition at line 40 of file HistogramBase.h.
|
protected |
Number of bins in the histogram
Definition at line 34 of file HistogramBase.h.
|
protected |
Sum of weights^2 for each bin (note that bin nBins is underflow/overflow)
Definition at line 36 of file HistogramBase.h.