129 while(childNode)
delete childNode;
131 if(GetParentNode() && (GetParentNode()->GetChildNode()==
this)) {
134 if(GetPrevNode()) prevNode->
nextNode=nextNode;
135 if(GetNextNode()) nextNode->
prevNode=prevNode;
137 delete fAxisLabelList;
138 if(fBinFactorFunction) {
139 if(!
dynamic_cast<TF1 *
>(fBinFactorFunction))
140 delete fBinFactorFunction;
230 :
TNamed(axis.GetName(),axis.GetTitle())
263 "binning \"%s\" already has parent \"%s\", can not be added to %s",
269 "binning \"%s\" has previous node \"%s\", can not be added to %s",
275 "binning \"%s\" has next node \"%s\", can not be added to %s",
285 while(
child->nextNode) {
317 Fatal(
"AddAxis",
"number of bins %d is not positive",
321 Fatal(
"AddAxis",
"xmin=%f required to be smaller than xmax=%f",
377 Fatal(
"AddAxis",
"node already has %d bins without axis",
380 Fatal(
"AddAxis",
"number of bins %d is not positive",
388 Fatal(
"AddAxis",
"bin border %d is not finite",i);
390 }
else if((i>0)&&((*bins)(i)<=(*bins)(i-1))) {
391 Fatal(
"AddAxis",
"bins not in order x[%d]=%f <= %f=x[%d]",
392 i,(*bins)(i),(*bins)(i-1),i-1);
432 out<<
"TUnfoldBinning \""<<
GetName()<<
"\" has ";
630 }
else if(
xAxis>=0) {
636 }
else if(
yAxis>=0) {
761 "Original binning can not be represented as THxx");
804 Info(
"CreateErrorMatrixHistogram",
805 "Original binning can not be represented on one axis");
892 for(
Int_t i=0;i<3;i++) {
920 if(count!=1)
r=
nullptr;
1055 Error(
"SetBinMapEntry",
"global bin number %d outside range (max=%d)",
1081 Error(
"FillBinMap1D",
"distribution %s with steering=%s is not 1D",
1145 Fatal(
"CreateBinMap",
"called with nDim=%d but GetNonemptyNode()=nullptr",
1213 for(
Int_t i=3;i<3+10;i++) {
1220 for(
Int_t i=0;i<dimension;i++) {
1229 Fatal(
"FillBinMapSingleNode",
1230 "bin %d outside binning scheme",
1233 Fatal(
"FillBinMapSingleNode",
1234 "bin %d located in %s %d-%d rather than %s %d=%d",
1235 i,(
const char *)
dest->GetName(),
1236 dest->GetStartBin(),
dest->GetEndBin(),
1242 for(
Int_t axis=0;axis<dimension;axis++) {
1270 }
else if(
nDim==1) {
1278 Error(
"FillBinMapSingleNode",
"inconsistent dimensions %d %d",
nDim,
1288 Fatal(
"FillBinMapSingleNode",
"inconsistent dimensions %d %d",
nDim,
1298 for(
Int_t axis=dimension-1;axis>=0;axis--) {
1324 for(
Int_t axis=dimension-1;axis>=0;axis--) {
1371 if(!
r)
return nullptr;
1424 Fatal(
"GetBinNumber",
1425 "called with 1 argument for %d dimensional distribution",
1443 Fatal(
"GetBinNumber",
1444 "called with 2 arguments for %d dimensional distribution",
1470 Fatal(
"GetBinNumber",
1471 "called with 3 arguments for %d dimensional distribution",
1499 Fatal(
"GetBinNumber",
1500 "called with 4 arguments for %d dimensional distribution",
1530 Fatal(
"GetBinNumber",
1531 "called with 5 arguments for %d dimensional distribution",
1563 Fatal(
"GetBinNumber",
1564 "called with 6 arguments for %d dimensional distribution",
1609 Fatal(
"GetBinNumber",
1610 "no axes are defined for node %s",
1619 if(!(
x[dim]>=(*bins)[
i0])) {
1622 }
else if(!(
x[dim]<(*bins)[
i1])) {
1628 if(
x[dim]<(*bins)[
i2]) {
1664 for(
Int_t axis=0;axis<dimension;axis++) {
1709 }
else if(pos>=bins->
GetNrows()-1) {
1712 r *= (*bins)(pos+1)-(*bins)(pos);
1752 for(
Int_t axis=0;axis<dimension;axis++) {
1756 r *= function->EvalPar(
x,function->GetParameters());
1759 r *= function->Eval(
x[0]);
1767 Error(
"GetBinFactor",
1768 "internal error: user function is neiter TF1 or TVectorD");
1810 if((axis>=0)&&(axis<dimension)) {
1859 for(
Int_t axis=0;axis<dimension;axis++) {
1899 if((axis>=0)&&(axis<GetDistributionDimension())) {
1900 TVectorD const *bins=GetDistributionBinning(axis);
1904 Double_t w=GetDistributionUnderflowBinWidth(axis);
1911 Double_t w=GetDistributionOverflowBinWidth(axis);
1921 Error(
"GetDistributionAverageBinSize",
"axis %d does not exist",axis);
1938 return (*bins)[1]-(*bins)[0];
1978 }
else if(bin>=bins->
GetNrows()-1) {
1982 r=0.5*((*bins)[bin+1]+(*bins)[bin]);
2005 for(
Int_t axis=dimension-1;axis>=0;axis--) {
2013 if((i>=0)&&(i<
nMax)) {
2028 Fatal(
"ToGlobalBin",
"bad input %d for dimensionless binning %s %d",
2058 for(
int axis=0;axis<dimension;axis++) {
2129 Error(
"DecodeAxisSteering",
2130 "steering \"%s\" does not end with [options]",
2131 (
const char *)pattern);
static void indent(ostringstream &buf, int indent_level)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t mask
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t dest
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t child
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char x2
Option_t Option_t TPoint TPoint const char x1
TVectorT< Double_t > TVectorD
Class to manage histogram axis.
const char * GetTitle() const override
Returns title of object.
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
1-D histogram with a double per channel (see TH1 documentation)
TH1 is the base class of all histogram classes in ROOT.
virtual Int_t GetDimension() const
virtual Int_t GetBin(Int_t binx, Int_t biny=0, Int_t binz=0) const
Return Global bin number corresponding to binx,y,z.
2-D histogram with a double per channel (see TH1 documentation)
Service class for 2-D histogram classes.
3-D histogram with a double per channel (see TH1 documentation)
The TNamed class is the base class for all named ROOT classes.
const char * GetName() const override
Returns name of object.
Int_t GetEntriesFast() const
Int_t GetEntries() const override
Return the number of objects in array (i.e.
TObject * At(Int_t idx) const override
void AddLast(TObject *obj) override
Add object in the next empty slot in the array.
Collectable string class.
Mother of all ROOT objects.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Ssiz_t Last(char c) const
Find last occurrence of a character c.
TObjArray * Tokenize(const TString &delim) const
This function is used to isolate sequential tokens in a TString.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Binning schemes for use with the unfolding algorithm TUnfoldDensity.
void PrintStream(std::ostream &out, Int_t indent=0, int debug=0) const
print some information about this binning tree
Int_t ToGlobalBin(Int_t const *axisBins, Int_t *isBelow=nullptr, Int_t *isAbove=nullptr) const
get global bin number, given axis bin numbers
Bool_t HasOverflow(int axis) const
check whether the axis has an overflow bin
TH1 * CreateHistogram(const char *histogramName, Bool_t originalAxisBinning=kFALSE, Int_t **binMap=nullptr, const char *histogramTitle=nullptr, const char *axisSteering=nullptr) const
create a THxx histogram capable to hold the bins of this binning node and its children
Int_t FillBinMapSingleNode(const TH1 *hist, Int_t startBin, Int_t nDim, const Int_t *axisList, const char *axisSteering, Int_t *binMap) const
fill bin map for a single node
virtual Double_t GetDistributionOverflowBinWidth(Int_t axis) const
return bin width assigned to the overflow bin
Int_t fFirstBin
global bin number of the first bin
void SetBinFactorFunction(Double_t normalisation, TF1 *userFunc=nullptr)
set normalisation factor and function which are used in calls to GetBinFactor()
TH1 * ExtractHistogram(const char *histogramName, const TH1 *globalBins, const TH2 *globalBinsEmatrix=nullptr, Bool_t originalAxisBinning=kTRUE, const char *axisSteering=nullptr) const
Int_t UpdateFirstLastBin(Bool_t startWithRootNode=kTRUE)
update fFirstBin and fLastBin members of this node and its children
TString BuildHistogramTitle(const char *histogramName, const char *histogramTitle, Int_t const *axisList) const
construct a title
Int_t FillBinMapRecursive(Int_t startBin, const char *axisSteering, Int_t *binMap) const
recursively fill bin map
Int_t FillBinMap1D(Int_t *binMap, const char *axisSteering, Int_t firstBinX) const
map all global bins referenced by this node to the one-dimensional histogram destHist,...
TUnfoldBinning * parentNode
mother node
Int_t GetDistributionDimension(void) const
query dimension of this node's distribution
TUnfoldBinning const * GetPrevNode(void) const
previous sister node
void SetBinFactor(Double_t normalisation, TObject *factors)
set normalisation factors which are used in calls to GetBinFactor()
TUnfoldBinning * childNode
first daughter node
TString GetBinName(Int_t iBin) const
get the name of a bin
Int_t GetTH1xNumberOfBins(Bool_t originalAxisBinning=kTRUE, const char *axisSteering=nullptr) const
return the number of histogram bins required when storing this binning in a one-dimensional histogram
virtual Double_t GetDistributionUnderflowBinWidth(Int_t axis) const
return bin width assigned to the underflow bin
Double_t GetBinSize(Int_t iBin) const
get N-dimensional bin size
Int_t GetDistributionNumberOfBins(void) const
number of bins in the distribution possibly including under/overflow
Double_t GetGlobalFactor(void) const
return global scaling factor for this node
Int_t GetGlobalBinNumber(Double_t x) const
locate a bin in a one-dimensional distribution
Bool_t HasUnconnectedBins(void) const
check whether there are bins but no axis
virtual Double_t GetBinFactor(Int_t iBin) const
return scaling factor for the given global bin number
TUnfoldBinning * nextNode
next sister
TObject * fBinFactorFunction
function to calculate a scale factor from bin centres (may be a TF1 or a TVectorD
Int_t GetTHxxBinning(Int_t maxDim, Int_t *axisBins, Int_t *axisList, const char *axisSteering) const
calculate properties of a THxx histogram to store this binning
const TUnfoldBinning * GetNonemptyNode_r(int &count) const
Int_t fHasUnderflow
bit fields indicating whether there are underflow bins on the axes
Int_t GetEndBin(void) const
last+1 bin of this node (includes children)
TObjArray * fAxisLabelList
for each axis its name (TObjString), or names of unconnected bins
Double_t fBinFactorConstant
common scale factor for all bins of this node
TUnfoldBinning const * GetNextNode(void) const
next sister node
Bool_t HasUnderflow(int axis) const
check whether an axis has an underflow bin
Int_t * CreateEmptyBinMap(void) const
create an empty bin map, useful together with the getter methods of class TUnfold and TUnfoldSys
TUnfoldBinning const * GetParentNode(void) const
mother node
@ MAXDIM
maximum numner of axes per distribution
static TH2D * CreateHistogramOfMigrations(TUnfoldBinning const *xAxis, TUnfoldBinning const *yAxis, char const *histogramName, Bool_t originalXAxisBinning=kFALSE, Bool_t originalYAxisBinning=kFALSE, char const *histogramTitle=nullptr)
create a TH2D histogram capable to hold the bins of the two input binning schemes on the x and y axes...
TObjArray * fAxisList
for each axis the bin borders (TVectorD)
Int_t fLastBin
global bin number of the last(+1) bin, including daughters
void GetBinUnderflowOverflowStatus(Int_t iBin, Int_t *uStatus, Int_t *oStatus) const
return bit maps indicating underflow and overflow status
virtual Double_t GetDistributionBinCenter(Int_t axis, Int_t bin) const
return bin center for a given axis and bin number
Int_t fDistributionSize
number of bins in this node's distribution
Int_t fHasOverflow
bit fields indicating whether there are overflow bins on the axes
const TUnfoldBinning * GetNonemptyNode(void) const
find a node which has non-empty distributions if there is none or if there are many,...
void Initialize(Int_t nBins)
initialize variables for a given number of bins
void SetBinMapEntry(Int_t *binMap, Int_t globalBin, Int_t destBin) const
set one entry in a bin map
virtual Double_t GetDistributionAverageBinSize(Int_t axis, Bool_t includeUnderflow, Bool_t includeOverflow) const
get average bin size on the specified axis
void DecodeAxisSteering(const char *axisSteering, const char *options, Int_t *isOptionGiven) const
decode axis steering
virtual Bool_t IsBinFactorGlobal(void) const
check whether there is only a global scaling factor for this node
TString GetDistributionAxisLabel(Int_t axis) const
get name of an axis
TUnfoldBinning * AddBinning(TUnfoldBinning *binning)
add a TUnfoldBinning as the last child of this node
const TObjString * GetUnconnectedBinName(Int_t bin) const
return the bin names of unconnected bins
Int_t GetBinNeighbours(Int_t globalBin, Int_t axis, Int_t *prev, Double_t *distPrev, Int_t *next, Double_t *distNext, Bool_t isPeriodic=kFALSE) const
get neighbour bins along the specified axis
TVectorD const * GetDistributionBinning(Int_t axis) const
get vector of bin borders for one axis
Int_t * CreateBinMap(const TH1 *hist, Int_t nDim, const Int_t *axisList, const char *axisSteering) const
create mapping from global bin number to a histogram for this node
TH2D * CreateErrorMatrixHistogram(const char *histogramName, Bool_t originalAxisBinning, Int_t **binMap=nullptr, const char *histogramTitle=nullptr, const char *axisSteering=nullptr) const
create a TH2D histogram capable to hold a covariance matrix
Bool_t AddAxis(const char *name, Int_t nBins, const Double_t *binBorders, Bool_t hasUnderflow, Bool_t hasOverflow)
add an axis with the specified bin borders
TUnfoldBinning * prevNode
previous sister
TUnfoldBinning const * GetRootNode(void) const
return root node of the binnig scheme
Int_t GetStartBin(void) const
first bin of this node
TUnfoldBinning const * ToAxisBins(Int_t globalBin, Int_t *axisBins) const
return distribution in which the bin is located and bin numbers on the corresponding axes
TUnfoldBinning const * FindNode(char const *name) const
traverse the tree and return the first node which matches the given name
TUnfoldBinning(const char *name=nullptr, Int_t nBins=0, const char *binNames=nullptr)
create a new node without axis
Int_t GetTHxxBinsRecursive(const char *axisSteering) const
calculate number of bins required to store this binning with teh given axisSteering
TUnfoldBinning const * GetChildNode(void) const
first daughter node
Int_t GetTHxxBinningSingleNode(Int_t maxDim, Int_t *axisBins, Int_t *axisList, const char *axisSteering) const
get the properties of a histogram capable to hold the distribution attached to this node
TString BuildHistogramTitle2D(const char *histogramName, const char *histogramTitle, Int_t xAxis, const TUnfoldBinning *yAxisBinning, Int_t yAxis) const
construct a histogram title for a 2D histogram with different binning schemes on x and y axis
Int_t Finite(Double_t x)
Check if it is finite with a mask in order to be consistent in presence of fast math.
Double_t Sqrt(Double_t x)
Returns the square root of x.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.