Common Analysis Framework » QFRAMEWORK » TQTHnBaseUtils

namespace TQTHnBaseUtils


 TQTHnBaseUtils:

 TQTHnBaseUtils is a namespace providing a set of static utility
 methods for multidimensional histograms with its base class
 THnBase.  It is highly derived from the TQHistogramUtils class,
 where more information can be found.


Function Members (Methods)

public:
booladdHistogram(THnBase* histo1, THnBase* histo2, TQCounter* scale, double corr12 = 0., bool includeScaleUncertainty = false)
booladdHistogram(THnBase* histo1, THnBase* histo2, double scale = 1., double scaleUncertainty = 0., double corr12 = 0., bool includeScaleUncertainty = true)
boolcheckConsistency(THnBase* histo1, THnBase* histo2, bool verbose = false)
boolcopyAxisNames(THnBase* histo, THnBase* copy)
THnBase*copyHistogram(THnBase* histo, const TString& newName = "")
THnBase*createHistogram(TString definition, bool printErrMsg = false)
THnBase*createHistogram(TString definition, TString& errMsg)
boolextractBinning(TQTaggable* p, int& dimension, vector<int>& nBins, vector<double>& min, vector<double>& max, TString& errMsg)
TAxis*getAxis(THnBase* h, const TString& axis_name)
boolgetAxisIndex(THnBase* h, const TString& axis_name, int& index)
intgetDimension(THnBase* histo)
TStringgetHistogramDefinition(THnBase* histo)
THnBase*projectionND(THnBase* hist, vector<TString> axesNamesToUse, const TString& option = "E")
boolscaleHistogram(THnBase* histo1, TQCounter* scale, bool includeScaleUncertainty = false)
boolscaleHistogram(THnBase* histo1, double scale = 1., double scaleUncertainty = 0., bool includeScaleUncertainty = true)

Class Charts

Function documentation

TString getHistogramDefinition(THnBase* histo)
 Returns a string representing the definition of the histogram following a syntax
 compatible with TQTHnBaseUtils::createHistogram(...) and being similar to the
 constructor of the corresponding histogram class.
 e.g. for a 3-dim histogram:
 "THnSparseF('histo', 'title', 3, {34, 28, 24}, {0., 10., 0.}, {170., 290., 3.14})"
 An empty string is returned in case an invalid histogram is passed.
THnBase * createHistogram(TString definition, bool printErrMsg = false)
THnBase * createHistogram(TString definition, TString& errMsg)
 Creates a new instance of a THnBase histogram from a definition string
 that uses a similar syntax as the constructor of the corresponding histogram
 class. Currently only THnSparseF and THnSparseD is supported

 Examples:

 - a THnSparse with 3 dimensions:

 createTHnBase("THnSparseF('histo', 'title', 3, {34, 28, 24}, {0., 10., 0.}, {170., 290., 3.14})")

bool extractBinning(TQTaggable* p, int& dimension, vector<int>& nBins, vector<double>& min, vector<double>& max, TString& errMsg)
 extract the binning definition of the THnBase object. This must
 exactly fit the syntax of the histogram definition file.
THnBase * copyHistogram(THnBase* histo, const TString& newName = "")
 Creates an independent copy of the input histogram <histo> which is a THnBase
 and returns a pointer to the copy or a NULL pointer in case of failure.
bool copyAxisNames(THnBase* histo, THnBase* copy)
 simply copy the axis names
bool addHistogram(THnBase* histo1, THnBase* histo2, TQCounter* scale, double corr12 = 0., bool includeScaleUncertainty = false)
 adds two THnBase histograms with built-in Root function THnBase::Add()
 Remark: This means there is no support for scale uncertainties!
bool addHistogram(THnBase* histo1, THnBase* histo2, double scale = 1., double scaleUncertainty = 0., double corr12 = 0., bool includeScaleUncertainty = true)
 adds two THnBase histograms with built-in Root function THnBase::Add()
 Remark: This means there is no support for scale uncertainties!
 check validity of input histograms
bool scaleHistogram(THnBase* histo1, TQCounter* scale, bool includeScaleUncertainty = false)
 use built in Root function for scaling
 Remark: This means there is no support for scale uncertainties!
bool scaleHistogram(THnBase* histo1, double scale = 1., double scaleUncertainty = 0., bool includeScaleUncertainty = true)
 use built in Root function for scaling
 Remark: This means there is no support for scale uncertainties!
int getDimension(THnBase* histo)
bool checkConsistency(THnBase* histo1, THnBase* histo2, bool verbose = false)
 Check if two histograms have consistent binning
 Remark: This is code from built-in Root function THnBase::CheckConsistency()
THnBase* projectionND(THnBase* hist, vector<TString> axesNamesToUse, const TString& option = "E")
 return multidimensional histogram with only the
 dimensions specified with axes names
 in the axesNamesToUse vector.
 Note that the order of axes in the new histogram
 is taken from this vector!
bool getAxisIndex(THnBase* h, const TString& axis_name, int& index)
 returns axis index of dimension with name 'name'
TAxis* getAxis(THnBase* h, const TString& axis_name)
 returns axis of dimension with name 'name'