Binning schemes for use with the unfolding algorithm TUnfoldDensity.
Binning schemes are used to map analysis bins on a single histogram axis and back. The analysis bins may include unconnected bins (e.g nuisances for background normalisation) or various multidimensional histograms (signal bins, differential background normalisation bins, etc).
If you use this software, please consider the following citation
S.Schmitt, JINST 7 (2012) T10003 [arXiv:1205.6201]
Detailed documentation and updates are available on http://www.desy.de/~sschmitt
The TUnfoldBinning objects are connected by a tree-like structure. The structure does not hold any data, but is only responsible for arranging the analysis bins in the proper order. Each node of the tree is responsible for a group of bins. That group may consist of
Each bin has a "global" bin number, which can be found using the GetGlobalBinNumber() methods. The global bin number 0 is reserved and corresponds to the case where no bin is found in the TUnfoldBinning tree.
Booking histograms:
The histograms which are booked have all analysis bins arranged on one axis (global bin number). TUnfoldBinning provides methods to locate the global bin number:
Unfolding: Specify the response matrix and the binning schemes when constructing a TUnfoldDensity object. Tell TUnfoldDensity about the data, background, systematic error histograms using the corresponding methods of class TUnfoldDensity. Then run the unfolding. Use the GetXXX() methods to retrieve the unfolding results into properly binned multidimensional histograms.
This file is part of TUnfold.
TUnfold is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
TUnfold is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with TUnfold. If not, see http://www.gnu.org/licenses/.
Version 17.6, bug fix to avoid possible crash in method CreateHistogramOfMigrations(). Possible bug fix with NaN in GetGlobalBinNUmber()
Definition at line 53 of file TUnfoldBinning.h.
Public Types | |
enum | { MAXDIM =32 } |
Public Types inherited from TObject | |
enum | { kIsOnHeap = 0x01000000 , kNotDeleted = 0x02000000 , kZombie = 0x04000000 , kInconsistent = 0x08000000 , kBitMask = 0x00ffffff } |
enum | { kSingleKey = BIT(0) , kOverwrite = BIT(1) , kWriteDelete = BIT(2) } |
enum | EDeprecatedStatusBits { kObjInCanvas = BIT(3) } |
enum | EStatusBits { kCanDelete = BIT(0) , kMustCleanup = BIT(3) , kIsReferenced = BIT(4) , kHasUUID = BIT(5) , kCannotPick = BIT(6) , kNoContextMenu = BIT(8) , kInvalidObject = BIT(13) } |
Public Member Functions | |
TUnfoldBinning (const char *name=0, Int_t nBins=0, const char *binNames=0) | |
Create a new node without axis. More... | |
TUnfoldBinning (const TAxis &axis, Int_t includeUnderflow, Int_t includeOverflow) | |
Create a new node containing a distribution with one axis. More... | |
virtual | ~TUnfoldBinning (void) |
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. More... | |
Bool_t | AddAxis (const char *name, Int_t nBins, Double_t xMin, Double_t xMax, Bool_t hasUnderflow, Bool_t hasOverflow) |
Add an axis with equidistant bins. More... | |
Bool_t | AddAxis (const TAxis &axis, Bool_t includeUnderflow, Bool_t includeOverflow) |
Add an axis to the distribution, using the TAxis as blueprint. More... | |
TUnfoldBinning * | AddBinning (const char *name, Int_t nBins=0, const char *binNames=0) |
Add a new binning node as last last child of this node. More... | |
TUnfoldBinning * | AddBinning (TUnfoldBinning *binning) |
Add a TUnfoldBinning as the last child of this node. More... | |
Int_t * | CreateEmptyBinMap (void) const |
Create an empty bin map, useful together with the getter methods of class TUnfold and TUnfoldSys. More... | |
TH2D * | CreateErrorMatrixHistogram (const char *histogramName, Bool_t originalAxisBinning, Int_t **binMap=0, const char *histogramTitle=0, const char *axisSteering=0) const |
Create a TH2D histogram capable to hold a covariance matrix. More... | |
TH1 * | CreateHistogram (const char *histogramName, Bool_t originalAxisBinning=kFALSE, Int_t **binMap=0, const char *histogramTitle=0, const char *axisSteering=0) const |
Create a THxx histogram capable to hold the bins of this binning node and its children. More... | |
void | DecodeAxisSteering (const char *axisSteering, const char *options, Int_t *isOptionGiven) const |
Decode axis steering. More... | |
TH1 * | ExtractHistogram (const char *histogramName, const TH1 *globalBins, const TH2 *globalBinsEmatrix=0, Bool_t originalAxisBinning=kTRUE, const char *axisSteering=0) const |
Extract a distribution from the given set of global bins. More... | |
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, starting with bin firstBinX. More... | |
TUnfoldBinning const * | FindNode (char const *name) const |
Traverse the tree and return the first node which matches the given name. More... | |
virtual Double_t | GetBinFactor (Int_t iBin) const |
Return scaling factor for the given global bin number. More... | |
TString | GetBinName (Int_t iBin) const |
Get the name of a bin. More... | |
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. More... | |
Double_t | GetBinSize (Int_t iBin) const |
Get N-dimensional bin size. More... | |
void | GetBinUnderflowOverflowStatus (Int_t iBin, Int_t *uStatus, Int_t *oStatus) const |
Return bit maps indicating underflow and overflow status. More... | |
TUnfoldBinning const * | GetChildNode (void) const |
first daughter node More... | |
virtual Double_t | GetDistributionAverageBinSize (Int_t axis, Bool_t includeUnderflow, Bool_t includeOverflow) const |
Get average bin size on the specified axis. More... | |
TString | GetDistributionAxisLabel (Int_t axis) const |
get name of an axis More... | |
virtual Double_t | GetDistributionBinCenter (Int_t axis, Int_t bin) const |
return bin center for a given axis and bin number More... | |
TVectorD const * | GetDistributionBinning (Int_t axis) const |
get vector of bin borders for one axis More... | |
Int_t | GetDistributionDimension (void) const |
query dimension of this node's distribution More... | |
Int_t | GetDistributionNumberOfBins (void) const |
number of bins in the distribution possibly including under/overflow More... | |
virtual Double_t | GetDistributionOverflowBinWidth (Int_t axis) const |
Return bin width assigned to the overflow bin. More... | |
virtual Double_t | GetDistributionUnderflowBinWidth (Int_t axis) const |
Return bin width assigned to the underflow bin. More... | |
Int_t | GetEndBin (void) const |
last+1 bin of this node (includes children) More... | |
Int_t | GetGlobalBinNumber (const Double_t *x, Int_t *isBelow=0, Int_t *isAbove=0) const |
locate a bin in an N-dimensional distribution More... | |
Int_t | GetGlobalBinNumber (Double_t x) const |
Locate a bin in a one-dimensional distribution. More... | |
Int_t | GetGlobalBinNumber (Double_t x, Double_t y) const |
Locate a bin in a two-dimensional distribution. More... | |
Int_t | GetGlobalBinNumber (Double_t x, Double_t y, Double_t z) const |
Locate a bin in a three-dimensional distribution. More... | |
Int_t | GetGlobalBinNumber (Double_t x0, Double_t x1, Double_t x2, Double_t x3) const |
Locate a bin in a four-dimensional distribution. More... | |
Int_t | GetGlobalBinNumber (Double_t x0, Double_t x1, Double_t x2, Double_t x3, Double_t x4) const |
Locate a bin in a five-dimensional distribution. More... | |
Int_t | GetGlobalBinNumber (Double_t x0, Double_t x1, Double_t x2, Double_t x3, Double_t x4, Double_t x5) const |
Locate a bin in a six-dimensional distribution. More... | |
Double_t | GetGlobalFactor (void) const |
Return global scaling factor for this node. More... | |
TUnfoldBinning const * | GetNextNode (void) const |
next sister node More... | |
TUnfoldBinning const * | GetParentNode (void) const |
mother node More... | |
TUnfoldBinning const * | GetPrevNode (void) const |
previous sister node More... | |
TUnfoldBinning const * | GetRootNode (void) const |
return root node of the binnig scheme More... | |
Int_t | GetStartBin (void) const |
first bin of this node More... | |
Int_t | GetTH1xNumberOfBins (Bool_t originalAxisBinning=kTRUE, const char *axisSteering=0) const |
Return the number of histogram bins required when storing this binning in a one-dimensional histogram. More... | |
const TObjString * | GetUnconnectedBinName (Int_t bin) const |
Return the bin names of unconnected bins. More... | |
Bool_t | HasOverflow (int axis) const |
check whether the axis has an overflow bin More... | |
Bool_t | HasUnconnectedBins (void) const |
Check whether there are bins but no axis. More... | |
Bool_t | HasUnderflow (int axis) const |
check whether an axis has an underflow bin More... | |
virtual Bool_t | IsBinFactorGlobal (void) const |
Check whether there is only a global scaling factor for this node. More... | |
void | PrintStream (std::ostream &out, Int_t indent=0, int debug=0) const |
Print some information about this binning tree. More... | |
void | SetBinFactorFunction (Double_t normalisation, TF1 *userFunc=0) |
Set normalisation factor and function which are used in calls to GetBinFactor(). More... | |
void | SetBinMapEntry (Int_t *binMap, Int_t globalBin, Int_t destBin) const |
Set one entry in a bin map. More... | |
Public Member Functions inherited from TNamed | |
TNamed () | |
TNamed (const char *name, const char *title) | |
TNamed (const TNamed &named) | |
TNamed copy ctor. More... | |
TNamed (const TString &name, const TString &title) | |
virtual | ~TNamed () |
TNamed destructor. More... | |
virtual void | Clear (Option_t *option="") |
Set name and title to empty strings (""). More... | |
virtual TObject * | Clone (const char *newname="") const |
Make a clone of an object using the Streamer facility. More... | |
virtual Int_t | Compare (const TObject *obj) const |
Compare two TNamed objects. More... | |
virtual void | Copy (TObject &named) const |
Copy this to obj. More... | |
virtual void | FillBuffer (char *&buffer) |
Encode TNamed into output buffer. More... | |
virtual const char * | GetName () const |
Returns name of object. More... | |
virtual const char * | GetTitle () const |
Returns title of object. More... | |
virtual ULong_t | Hash () const |
Return hash value for this object. More... | |
virtual Bool_t | IsSortable () const |
virtual void | ls (Option_t *option="") const |
List TNamed name and title. More... | |
TNamed & | operator= (const TNamed &rhs) |
TNamed assignment operator. More... | |
virtual void | Print (Option_t *option="") const |
Print TNamed name and title. More... | |
virtual void | SetName (const char *name) |
Set the name of the TNamed. More... | |
virtual void | SetNameTitle (const char *name, const char *title) |
Set all the TNamed parameters (name and title). More... | |
virtual void | SetTitle (const char *title="") |
Set the title of the TNamed. More... | |
virtual Int_t | Sizeof () const |
Return size of the TNamed part of the TObject. More... | |
Public Member Functions inherited from TObject | |
TObject () | |
TObject constructor. More... | |
TObject (const TObject &object) | |
TObject copy ctor. More... | |
virtual | ~TObject () |
TObject destructor. More... | |
void | AbstractMethod (const char *method) const |
Use this method to implement an "abstract" method that you don't want to leave purely abstract. More... | |
virtual void | AppendPad (Option_t *option="") |
Append graphics object to current pad. More... | |
virtual void | Browse (TBrowser *b) |
Browse object. May be overridden for another default action. More... | |
ULong_t | CheckedHash () |
Check and record whether this class has a consistent Hash/RecursiveRemove setup (*) and then return the regular Hash value for this object. More... | |
virtual const char * | ClassName () const |
Returns name of class to which the object belongs. More... | |
virtual void | Clear (Option_t *="") |
virtual TObject * | Clone (const char *newname="") const |
Make a clone of an object using the Streamer facility. More... | |
virtual Int_t | Compare (const TObject *obj) const |
Compare abstract method. More... | |
virtual void | Copy (TObject &object) const |
Copy this to obj. More... | |
virtual void | Delete (Option_t *option="") |
Delete this object. More... | |
virtual Int_t | DistancetoPrimitive (Int_t px, Int_t py) |
Computes distance from point (px,py) to the object. More... | |
virtual void | Draw (Option_t *option="") |
Default Draw method for all objects. More... | |
virtual void | DrawClass () const |
Draw class inheritance tree of the class to which this object belongs. More... | |
virtual TObject * | DrawClone (Option_t *option="") const |
Draw a clone of this object in the current selected pad for instance with: gROOT->SetSelectedPad(gPad) . More... | |
virtual void | Dump () const |
Dump contents of object on stdout. More... | |
virtual void | Error (const char *method, const char *msgfmt,...) const |
Issue error message. More... | |
virtual void | Execute (const char *method, const char *params, Int_t *error=0) |
Execute method on this object with the given parameter string, e.g. More... | |
virtual void | Execute (TMethod *method, TObjArray *params, Int_t *error=0) |
Execute method on this object with parameters stored in the TObjArray. More... | |
virtual void | ExecuteEvent (Int_t event, Int_t px, Int_t py) |
Execute action corresponding to an event at (px,py). More... | |
virtual void | Fatal (const char *method, const char *msgfmt,...) const |
Issue fatal error message. More... | |
virtual TObject * | FindObject (const char *name) const |
Must be redefined in derived classes. More... | |
virtual TObject * | FindObject (const TObject *obj) const |
Must be redefined in derived classes. More... | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. More... | |
virtual const char * | GetIconName () const |
Returns mime type name of object. More... | |
virtual const char * | GetName () const |
Returns name of object. More... | |
virtual char * | GetObjectInfo (Int_t px, Int_t py) const |
Returns string containing info about the object at position (px,py). More... | |
virtual Option_t * | GetOption () const |
virtual const char * | GetTitle () const |
Returns title of object. More... | |
virtual UInt_t | GetUniqueID () const |
Return the unique object id. More... | |
virtual Bool_t | HandleTimer (TTimer *timer) |
Execute action in response of a timer timing out. More... | |
virtual ULong_t | Hash () const |
Return hash value for this object. More... | |
Bool_t | HasInconsistentHash () const |
Return true is the type of this object is known to have an inconsistent setup for Hash and RecursiveRemove (i.e. More... | |
virtual void | Info (const char *method, const char *msgfmt,...) const |
Issue info message. More... | |
virtual Bool_t | InheritsFrom (const char *classname) const |
Returns kTRUE if object inherits from class "classname". More... | |
virtual Bool_t | InheritsFrom (const TClass *cl) const |
Returns kTRUE if object inherits from TClass cl. More... | |
virtual void | Inspect () const |
Dump contents of this object in a graphics canvas. More... | |
void | InvertBit (UInt_t f) |
virtual Bool_t | IsEqual (const TObject *obj) const |
Default equal comparison (objects are equal if they have the same address in memory). More... | |
virtual Bool_t | IsFolder () const |
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects). More... | |
R__ALWAYS_INLINE Bool_t | IsOnHeap () const |
virtual Bool_t | IsSortable () const |
R__ALWAYS_INLINE Bool_t | IsZombie () const |
virtual void | ls (Option_t *option="") const |
The ls function lists the contents of a class on stdout. More... | |
void | MayNotUse (const char *method) const |
Use this method to signal that a method (defined in a base class) may not be called in a derived class (in principle against good design since a child class should not provide less functionality than its parent, however, sometimes it is necessary). More... | |
virtual Bool_t | Notify () |
This method must be overridden to handle object notification. More... | |
void | Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const |
Use this method to declare a method obsolete. More... | |
void | operator delete (void *ptr) |
Operator delete. More... | |
void | operator delete[] (void *ptr) |
Operator delete []. More... | |
void * | operator new (size_t sz) |
void * | operator new (size_t sz, void *vp) |
void * | operator new[] (size_t sz) |
void * | operator new[] (size_t sz, void *vp) |
TObject & | operator= (const TObject &rhs) |
TObject assignment operator. More... | |
virtual void | Paint (Option_t *option="") |
This method must be overridden if a class wants to paint itself. More... | |
virtual void | Pop () |
Pop on object drawn in a pad to the top of the display list. More... | |
virtual void | Print (Option_t *option="") const |
This method must be overridden when a class wants to print itself. More... | |
virtual Int_t | Read (const char *name) |
Read contents of object with specified name from the current directory. More... | |
virtual void | RecursiveRemove (TObject *obj) |
Recursively remove this object from a list. More... | |
void | ResetBit (UInt_t f) |
virtual void | SaveAs (const char *filename="", Option_t *option="") const |
Save this object in the file specified by filename. More... | |
virtual void | SavePrimitive (std::ostream &out, Option_t *option="") |
Save a primitive as a C++ statement(s) on output stream "out". More... | |
void | SetBit (UInt_t f) |
void | SetBit (UInt_t f, Bool_t set) |
Set or unset the user status bits as specified in f. More... | |
virtual void | SetDrawOption (Option_t *option="") |
Set drawing option for object. More... | |
virtual void | SetUniqueID (UInt_t uid) |
Set the unique object id. More... | |
virtual void | SysError (const char *method, const char *msgfmt,...) const |
Issue system error message. More... | |
R__ALWAYS_INLINE Bool_t | TestBit (UInt_t f) const |
Int_t | TestBits (UInt_t f) const |
virtual void | UseCurrentStyle () |
Set current style settings in this object This function is called when either TCanvas::UseCurrentStyle or TROOT::ForceStyle have been invoked. More... | |
virtual void | Warning (const char *method, const char *msgfmt,...) const |
Issue warning message. More... | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) |
Write this object to the current directory. More... | |
virtual Int_t | Write (const char *name=0, Int_t option=0, Int_t bufsize=0) const |
Write this object to the current directory. More... | |
Static Public Member Functions | |
static TH2D * | CreateHistogramOfMigrations (TUnfoldBinning const *xAxis, TUnfoldBinning const *yAxis, char const *histogramName, Bool_t originalXAxisBinning=kFALSE, Bool_t originalYAxisBinning=kFALSE, char const *histogramTitle=0) |
Create a TH2D histogram capable to hold the bins of the two input binning schemes on the x and y axes, respectively. More... | |
Static Public Member Functions inherited from TObject | |
static Long_t | GetDtorOnly () |
Return destructor only flag. More... | |
static Bool_t | GetObjectStat () |
Get status of object stat flag. More... | |
static void | SetDtorOnly (void *obj) |
Set destructor only flag. More... | |
static void | SetObjectStat (Bool_t stat) |
Turn on/off tracking of objects in the TObjectTable. More... | |
Protected Member Functions | |
TString | BuildHistogramTitle (const char *histogramName, const char *histogramTitle, Int_t const *axisList) const |
Construct a title. More... | |
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. More... | |
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. More... | |
Int_t | FillBinMapRecursive (Int_t startBin, const char *axisSteering, Int_t *binMap) const |
Recursively fill bin map. More... | |
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. More... | |
const TUnfoldBinning * | GetNonemptyNode (void) const |
Find a node which has non-empty distributions if there is none or if there are many, return zero. More... | |
TUnfoldBinning * | GetRootNode (void) |
return root node More... | |
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. More... | |
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. More... | |
Int_t | GetTHxxBinsRecursive (const char *axisSteering) const |
Calculate number of bins required to store this binning with the given axisSteering. More... | |
void | Initialize (Int_t nBins) |
Initialize variables for a given number of bins. More... | |
void | SetBinFactor (Double_t normalisation, TObject *factors) |
Set normalisation factors which are used in calls to GetBinFactor(). More... | |
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. More... | |
Int_t | ToGlobalBin (Int_t const *axisBins, Int_t *isBelow=0, Int_t *isAbove=0) const |
Get global bin number, given axis bin numbers. More... | |
Int_t | UpdateFirstLastBin (Bool_t startWithRootNode=kTRUE) |
Update fFirstBin and fLastBin members of this node and its children. More... | |
Protected Member Functions inherited from TObject | |
virtual void | DoError (int level, const char *location, const char *fmt, va_list va) const |
Interface to ErrorHandler (protected). More... | |
void | MakeZombie () |
Protected Attributes | |
TUnfoldBinning * | childNode |
first daughter node More... | |
TObjArray * | fAxisLabelList |
for each axis its name (TObjString), or names of unconnected bins More... | |
TObjArray * | fAxisList |
for each axis the bin borders (TVectorD) More... | |
Double_t | fBinFactorConstant |
common scale factor for all bins of this node More... | |
TObject * | fBinFactorFunction |
function to calculate a scale factor from bin centres (may be a TF1 or a TVectorD More... | |
Int_t | fDistributionSize |
number of bins in this node's distribution More... | |
Int_t | fFirstBin |
global bin number of the first bin More... | |
Int_t | fHasOverflow |
bit fields indicating whether there are overflow bins on the axes More... | |
Int_t | fHasUnderflow |
bit fields indicating whether there are underflow bins on the axes More... | |
Int_t | fLastBin |
global bin number of the last(+1) bin, including daughters More... | |
TUnfoldBinning * | nextNode |
next sister More... | |
TUnfoldBinning * | parentNode |
mother node More... | |
TUnfoldBinning * | prevNode |
previous sister More... | |
Protected Attributes inherited from TNamed | |
TString | fName |
TString | fTitle |
#include <TUnfoldBinning.h>
anonymous enum |
Enumerator | |
---|---|
MAXDIM | maximum numner of axes per distribution |
Definition at line 83 of file TUnfoldBinning.h.
TUnfoldBinning::TUnfoldBinning | ( | const char * | name = 0 , |
Int_t | nBins = 0 , |
||
const char * | binNames = 0 |
||
) |
Create a new node without axis.
[in] | name | identifier of the node |
[in] | nBin | number of unconnected bins (could be zero) |
[in] | binNames | (optional) names of the bins separated by ';' |
Definition at line 211 of file TUnfoldBinning.cxx.
TUnfoldBinning::TUnfoldBinning | ( | const TAxis & | axis, |
Int_t | includeUnderflow, | ||
Int_t | includeOverflow | ||
) |
Create a new node containing a distribution with one axis.
[in] | axis | the axis to represent |
[in] | includeUnderflow | true if underflow bin should be included |
[in] | includeOverflow | true if overflow bin should be included |
Definition at line 231 of file TUnfoldBinning.cxx.
|
virtual |
Definition at line 125 of file TUnfoldBinning.cxx.
Bool_t TUnfoldBinning::AddAxis | ( | const char * | name, |
Int_t | nBin, | ||
const Double_t * | binBorders, | ||
Bool_t | hasUnderflow, | ||
Bool_t | hasOverflow | ||
) |
Add an axis with the specified bin borders.
[in] | name | name of the axis |
[in] | nBin | number of bins |
[in] | binBorders | array of bin borders, with nBin+1 elements |
[in] | hasUnderflow | decide whether the axis has an underflow bin |
[in] | hasOverflow | decide whether the axis has an overflow bin |
returns true if the axis has been added
Definition at line 378 of file TUnfoldBinning.cxx.
Bool_t TUnfoldBinning::AddAxis | ( | const char * | name, |
Int_t | nBin, | ||
Double_t | xMin, | ||
Double_t | xMax, | ||
Bool_t | hasUnderflow, | ||
Bool_t | hasOverflow | ||
) |
Add an axis with equidistant bins.
[in] | name | name of the axis |
[in] | nBin | number of bins |
[in] | xMin | lower edge of the first bin |
[in] | xMax | upper edge of the last bin |
[in] | hasUnderflow | decide whether the axis has an underflow bin |
[in] | hasOverflow | decide whether the axis has an overflow bin |
returns true if the axis has been added
Definition at line 317 of file TUnfoldBinning.cxx.
Add an axis to the distribution, using the TAxis as blueprint.
[in] | axis | blueprint of the axis |
[in] | hasUnderflow | decide whether the underflow bin should be included |
[in] | hasOverflow | decide whether the overflow bin should be included |
returns true if the axis has been added
Note: axis labels are not imported
Definition at line 353 of file TUnfoldBinning.cxx.
TUnfoldBinning * TUnfoldBinning::AddBinning | ( | const char * | name, |
Int_t | nBins = 0 , |
||
const char * | binNames = 0 |
||
) |
Add a new binning node as last last child of this node.
[in] | name | name of the node |
[in] | nBin | number of extra bins |
[in] | binNames | (optional) names of the bins separated by ';' |
this is a shortcut for AddBinning(new TUnfoldBinning(name,nBins,binNames))
Definition at line 249 of file TUnfoldBinning.cxx.
TUnfoldBinning * TUnfoldBinning::AddBinning | ( | TUnfoldBinning * | binning | ) |
Add a TUnfoldBinning as the last child of this node.
[in] | binning | the new binning to be added |
return value: if succeeded, return "binning" otherwise return 0
Definition at line 263 of file TUnfoldBinning.cxx.
|
protected |
Construct a title.
[in] | histogramName | distribution name |
[in] | histogramTitle | default title |
[in] | axisList | array indicating which axis of this node is mapped to which histogram axis |
if histogramTitle!=0 this title is used. Otherwise, the title is composed as: histogramName;axisname[axisList[0]];axisname[axisList[1]];...
Definition at line 589 of file TUnfoldBinning.cxx.
|
protected |
Construct a histogram title for a 2D histogram with different binning schemes on x and y axis.
[in] | histogramName | distribution name |
[in] | histogramTitle | default title |
[in] | xAxis | indicates which x-axis name to use |
[in] | yAxisBinning | binning scheme for y-axis |
[in] | yAxis | indicates which y-axis name to use |
build a title
Definition at line 633 of file TUnfoldBinning.cxx.
|
protected |
Create mapping from global bin number to a histogram for this node.
[in] | hist | destination histogram |
[in] | nDim | target dimension |
[in] | axisList | map axes in the binning scheme to histogram axes |
[in] | axisSteering | steering for underflow/overflow/projections |
The axisSteering is explained with the method CreateHistogram() create mapping from global bin number to a histogram for this node global bins are the bins of the root node binning scheme when projecting them on a TH1 histogram "hRootNode" without special axis steering and without attempting to preserve the axis binning
The bin map is an array of size hRootNode->GetNbinsX()+2 For each bin of the "hRootNode" histogram it holds the target bin in "hist" or the number -1 if the corresponding "hRootNode" bin is not represented in "hist"
input
Definition at line 1143 of file TUnfoldBinning.cxx.
Create an empty bin map, useful together with the getter methods of class TUnfold and TUnfoldSys.
returns: a new Int array of the proper size, all elements set to -1
Definition at line 1041 of file TUnfoldBinning.cxx.
TH2D * TUnfoldBinning::CreateErrorMatrixHistogram | ( | const char * | histogramName, |
Bool_t | originalAxisBinning, | ||
Int_t ** | binMap = 0 , |
||
const char * | histogramTitle = 0 , |
||
const char * | axisSteering = 0 |
||
) | const |
Create a TH2D histogram capable to hold a covariance matrix.
[in] | histogramName | name of the histogram which is created |
[in] | originalAxisBinning | if true, try to preserve the axis binning |
[out] | (default=0) | binMap mapping of global bins to histogram bins. if(binMap==0), no binMap is created |
[in] | (default=0) | histogramTitle title of the histogram. If zero, a title is selected automatically |
[in] | (default=0) | axisSteering steer the handling of underflow/overflow and projections |
returns a new TH2D. The options are described in greater detail with the CreateHistogram() method.
Definition at line 802 of file TUnfoldBinning.cxx.
TH1 * TUnfoldBinning::CreateHistogram | ( | const char * | histogramName, |
Bool_t | originalAxisBinning = kFALSE , |
||
Int_t ** | binMap = 0 , |
||
const char * | histogramTitle = 0 , |
||
const char * | axisSteering = 0 |
||
) | const |
Create a THxx histogram capable to hold the bins of this binning node and its children.
[in] | histogramName | name of the histogram which is created |
[in] | originalAxisBinning | if true, try to preserve the axis binning |
[out] | (default=0) | binMap mapping of global bins to histogram bins. if(binMap==0), no binMap is created |
[in] | (default=0) | histogramTitle title of the histogram. If zero, a title is selected automatically |
[in] | (default=0) | axisSteering steer the handling of underflow/overflow and projections |
returns a new histogram (TH1D, TH2D or TH3D)
if the parameter originalAxisBinning parameter is true, the resulting histogram has bin widths and histogram dimension (TH1D, TH2D, TH3D) in parallel to this binning node, if possible.
The binMap is an array which translates global bin numbers to bin numbers in the histogram returned by this method. The global bin numbers correspond to the bin numbers in a histogram created by calling GetRootNode()->CreateHistogram(name,false,0,0,0)
The axisSteering is a string to steer whether underflow and overflow bins are included in the bin map. Furthermore, it is possible to "collapse" axes, such that their content is summed and the axis does not show up in the created histogram.
The string looks like this: "axis[options];axis[options];..." where
Definition at line 741 of file TUnfoldBinning.cxx.
|
static |
Create a TH2D histogram capable to hold the bins of the two input binning schemes on the x and y axes, respectively.
\paran[in] xAxis binning scheme for the x axis
[in] | yAxis | binning scheme for the y axis |
[in] | histogramName | name of the histogram which is created |
[in] | originalXAxisBinning | preserve x-axis bin widths if possible |
[in] | originalXAxisBinning | preserve y-axis bin widths if possible |
[in] | histogramTitle | if is non-zero, it is taken as histogram title otherwise, the title is created automatically |
returns a new TH2D.
Definition at line 845 of file TUnfoldBinning.cxx.
void TUnfoldBinning::DecodeAxisSteering | ( | const char * | axisSteering, |
const char * | options, | ||
Int_t * | isOptionGiven | ||
) | const |
Decode axis steering.
[in] | axisSteering | the steering to decode |
[in] | options | the allowed options to extract |
[out] | isOptionGiven | array of decoded steering options, the dimension equal to the number of characters in options |
the axis steering is given in the form "axis[option];axis[option];..." axis : the name of the axis for which the optionlist is relevant the character * matches all axes option : a list of characters taken from options for each match the corresponding bit number corresponding to the axis number is set in isOptionGiven[i], where i is the position of the matching option character in options
Definition at line 2135 of file TUnfoldBinning.cxx.
TH1 * TUnfoldBinning::ExtractHistogram | ( | const char * | histogramName, |
const TH1 * | globalBins, | ||
const TH2 * | globalBinsEmatrix = 0 , |
||
Bool_t | originalAxisBinning = kTRUE , |
||
const char * | axisSteering = 0 |
||
) | const |
Extract a distribution from the given set of global bins.
input:
Definition at line 1374 of file TUnfoldBinning.cxx.
Int_t TUnfoldBinning::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, starting with bin firstBinX.
[out] | binMap | to be used with TUnfoldSys::GetOutput() etc |
[in] | axisSteering | steering for underflow/overflow/projections |
[in] | firstBinX | first bin of destination histogram to be filled |
returns: highest bin number in destination histogram plus 1 The parameter axisSteering is explained with the method CreateHistogram()
Definition at line 1082 of file TUnfoldBinning.cxx.
|
protected |
Recursively fill bin map.
[in] | startBin | first histogram bin |
[in] | axisSteering | see CreateHistogram() method |
[out] | binMap | the bin mapping which is to be filled |
the positions
Definition at line 1175 of file TUnfoldBinning.cxx.
|
protected |
Fill bin map for a single node.
[in] | hist | the histogram representing this node (used if nDim>0) |
[in] | startBin | start bin in the bin map |
[in] | nDim | number of dimensions to resolve |
[in] | axisList[3] | TUnfoldBinning axis numbers corresponding to the axes of hist |
[in] | axisSteering | see documentation of CreateHistogram() |
[out] | binMap | the bin map to fill |
returns the number of bins mapped.
The result depends on the parameter nDim as follows
Definition at line 1213 of file TUnfoldBinning.cxx.
TUnfoldBinning const * TUnfoldBinning::FindNode | ( | char const * | name | ) | const |
Traverse the tree and return the first node which matches the given name.
[in] | name | the identifier of the node to find (zero matches the first node) |
returns the node found or zero
Definition at line 542 of file TUnfoldBinning.cxx.
Return scaling factor for the given global bin number.
[in] | iBin | global bin number |
returns the scaling factor for this bin. The scaling factors can be set using the method SetBinFactorFunction()
return user factor for a bin iBin : global bin number
Definition at line 1771 of file TUnfoldBinning.cxx.
Get the name of a bin.
[in] | iBin | global bin number |
returns a string describing the bin
Get the name of a bin in the given tree iBin: bin number
Definition at line 1677 of file TUnfoldBinning.cxx.
Int_t TUnfoldBinning::GetBinNeighbours | ( | Int_t | bin, |
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.
[in] | bin | global bin number |
[in] | axis | axis number of interest |
[out] | prev | bin number of previous bin or -1 if not existing |
[out] | distPrev | distance between bin centres |
[out] | next | bin number of next bin or -1 if not existing |
[out] | distNext | distance between bin centres |
[in] | isPeriodic | (default=false) if true, the first bin is counted as neighbour of the last bin |
return code
Definition at line 1825 of file TUnfoldBinning.cxx.
Get N-dimensional bin size.
[in] | iBin | global bin number |
includeUO : include underflow/overflow bins or not
Definition at line 1723 of file TUnfoldBinning.cxx.
void TUnfoldBinning::GetBinUnderflowOverflowStatus | ( | Int_t | iBin, |
Int_t * | uStatus, | ||
Int_t * | oStatus | ||
) | const |
Return bit maps indicating underflow and overflow status.
[in] | iBin | global bin number |
[out] | uStatus | bit map indicating whether the bin is underflow |
[out] | oStatus | bit map indicating whether the bin is overflow |
Definition at line 1879 of file TUnfoldBinning.cxx.
|
inline |
first daughter node
Definition at line 103 of file TUnfoldBinning.h.
|
virtual |
Get average bin size on the specified axis.
[in] | axis | axis number |
[in] | includeUnderflow | whether to include the underflow bin |
[in] | includeOverflow | whether to include the overflow bin |
Definition at line 1926 of file TUnfoldBinning.cxx.
get name of an axis
Definition at line 164 of file TUnfoldBinning.h.
return bin center for a given axis and bin number
[in] | axis | axis number |
[in] | bin | local bin number on the specified axis |
returns the geometrical bin center. for underflow and overflow, the calculation is using the GetDistributionUnderflowBinWidth() and GetDistributionOverflowBinWidth() methods.
position of the bin center
Definition at line 2007 of file TUnfoldBinning.cxx.
get vector of bin borders for one axis
Definition at line 161 of file TUnfoldBinning.h.
query dimension of this node's distribution
Definition at line 158 of file TUnfoldBinning.h.
number of bins in the distribution possibly including under/overflow
Definition at line 156 of file TUnfoldBinning.h.
Return bin width assigned to the overflow bin.
[in] | axis | axis number |
the bin width of the last bin is returned. The method is virtual, so this behaviour can be adjusted.
return width of the underflow bin axis: axis number
Definition at line 1985 of file TUnfoldBinning.cxx.
Return bin width assigned to the underflow bin.
[in] | axis | axis number |
the bin width of the first bin is returned. The method is virtual, so this behaviour can be adjusted.
return width of the underflow bin axis: axis number
Definition at line 1968 of file TUnfoldBinning.cxx.
last+1 bin of this node (includes children)
Definition at line 141 of file TUnfoldBinning.h.
Int_t TUnfoldBinning::GetGlobalBinNumber | ( | const Double_t * | x, |
Int_t * | isBelow = 0 , |
||
Int_t * | isAbove = 0 |
||
) | const |
locate a bin in an N-dimensional distribution
[in] | x | array of coordinates |
[out] | isBelow | pointer to an integer (bit vector) to indicate coordinates which do not fit in the binning scheme |
[out] | isAbove | pointer to an integer (bit vector) to indicate coordinates which do not fit in the binning scheme |
returns the global bin number within the distribution attached to this node. The global bin number is valid for the root node of the binning scheme. If some coordinates do not fit, zero is returned. The integers pointed to by isBelow and isAbove are set to zero. However, if coordinate i is below the lowest bin border and there is no underflow bin, the bin i is set in (*isBelow). Overflows are handled in a similar manner with (*isAbove).
If a coordinate is NaN, the result is undefined for TUnfold Version<17.6. As of version 17.6, NaN is expected to end up in the underflow or by setting the corresponding bit in (*isBelow).
locate bin on a n-dimensional distribution
Definition at line 1627 of file TUnfoldBinning.cxx.
Locate a bin in a one-dimensional distribution.
[in] | x | coordinate |
returns the global bin number within the distribution attached to this node. The global bin number is valid for the root node of the binning scheme
Definition at line 1433 of file TUnfoldBinning.cxx.
Locate a bin in a two-dimensional distribution.
[in] | x | coordinate on first axis |
[in] | y | coordinate on second axis |
returns the global bin number within the distribution attached to this node. The global bin number is valid for the root node of the binning scheme
Definition at line 1453 of file TUnfoldBinning.cxx.
Locate a bin in a three-dimensional distribution.
[in] | x | coordinate on first axis |
[in] | y | coordinate on second axis |
[in] | z | coordinate on third axis |
returns the global bin number within the distribution attached to this node. The global bin number is valid for the root node of the binning scheme
locate bin on a three-dimensional distribution
Definition at line 1481 of file TUnfoldBinning.cxx.
Int_t TUnfoldBinning::GetGlobalBinNumber | ( | Double_t | x0, |
Double_t | x1, | ||
Double_t | x2, | ||
Double_t | x3 | ||
) | const |
Locate a bin in a four-dimensional distribution.
[in] | x0 | coordinate on first axis |
[in] | x1 | coordinate on second axis |
[in] | x2 | coordinate on third axis |
[in] | x3 | coordinate on fourth axis |
returns the global bin number within the distribution attached to this node. The global bin number is valid for the root node of the binning scheme
locate bin on a four-dimensional distribution
Definition at line 1512 of file TUnfoldBinning.cxx.
Int_t TUnfoldBinning::GetGlobalBinNumber | ( | Double_t | x0, |
Double_t | x1, | ||
Double_t | x2, | ||
Double_t | x3, | ||
Double_t | x4 | ||
) | const |
Locate a bin in a five-dimensional distribution.
[in] | x0 | coordinate on first axis |
[in] | x1 | coordinate on second axis |
[in] | x2 | coordinate on third axis |
[in] | x3 | coordinate on fourth axis |
[in] | x4 | coordinate on fifth axis |
returns the global bin number within the distribution attached to this node. The global bin number is valid for the root node of the binning scheme
locate bin on a five-dimensional distribution
Definition at line 1545 of file TUnfoldBinning.cxx.
Int_t TUnfoldBinning::GetGlobalBinNumber | ( | Double_t | x0, |
Double_t | x1, | ||
Double_t | x2, | ||
Double_t | x3, | ||
Double_t | x4, | ||
Double_t | x5 | ||
) | const |
Locate a bin in a six-dimensional distribution.
[in] | x0 | coordinate on first axis |
[in] | x1 | coordinate on second axis |
[in] | x2 | coordinate on third axis |
[in] | x3 | coordinate on fourth axis |
[in] | x4 | coordinate on fifth axis |
[in] | x5 | coordinate on sixth axis |
returns the global bin number within the distribution attached to this node. The global bin number is valid for the root node of the binning scheme
locate bin on a five-dimensional distribution
Definition at line 1580 of file TUnfoldBinning.cxx.
Return global scaling factor for this node.
Definition at line 1756 of file TUnfoldBinning.cxx.
|
inline |
next sister node
Definition at line 107 of file TUnfoldBinning.h.
|
protected |
Find a node which has non-empty distributions if there is none or if there are many, return zero.
Definition at line 926 of file TUnfoldBinning.cxx.
|
inline |
mother node
Definition at line 109 of file TUnfoldBinning.h.
|
inline |
previous sister node
Definition at line 105 of file TUnfoldBinning.h.
|
protected |
TUnfoldBinning const * TUnfoldBinning::GetRootNode | ( | void | ) | const |
return root node of the binnig scheme
Return root node.
Definition at line 568 of file TUnfoldBinning.cxx.
first bin of this node
Definition at line 139 of file TUnfoldBinning.h.
Int_t TUnfoldBinning::GetTH1xNumberOfBins | ( | Bool_t | originalAxisBinning = kTRUE , |
const char * | axisSteering = 0 |
||
) | const |
Return the number of histogram bins required when storing this binning in a one-dimensional histogram.
[in] | originalAxisBinning | if true, try to have the histogram axis reflect precisely the relevant axis of the binning scheme |
[in] | axisSteering | steering to integrate over axis and/or skip underflow and overflow bins |
returns the number of bins of the TH1, where the underflow/overflow are not used, unless the distribution has only one axis and originalAxisBinning=true)
axisSteering is a string as follows: "axis[options];axis[options];..." where: axis = name or * is an identifier of an axis (* matches all) and: options is any combination of the letters C,U,O (other letters are ignored).
The letter C means that the corresponding axis is collapsed into one bin, i.e. one dimension is removed from the counting. The letters U,O remove for the matching axis the underflow.overflow bins from the counting
Definition at line 683 of file TUnfoldBinning.cxx.
|
protected |
Calculate properties of a THxx histogram to store this binning.
[in] | maxDim | maximum dimension of the THxx (0 or 1..3) maxDim==0 is used to indicate that the histogram should be dimensional with all bins mapped on one axis, bin centers equal to bin numbers |
[in] | axisSteering | see method CreateHistogram() |
[out] | axisBins[3] | number of bins on the THxx axes |
[out] | axisList[3] | TUnfoldBinning axis number corresponding to the THxx axis |
returns 1-3 dimension of THxx or 0 for 1-dim THxx with equidistant bins
Definition at line 903 of file TUnfoldBinning.cxx.
|
protected |
Get the properties of a histogram capable to hold the distribution attached to this node.
[in] | maxDim | maximum dimension of the THxx (0 or 1..3) maxDim==0 is used to indicate that the histogram should 1-dimensional with all bins mapped on one axis |
[out] | axisBins[3] | number of bins on the THxx axes |
[out] | axisList[3] | TUnfoldBinning axis numbers corresponding to the THxx axis |
[in] | axisSteering | see method CreateHistogram() and projection |
returns 1-3 dimension of THxx or use 1-dim THxx, binning structure is not preserved
Definition at line 962 of file TUnfoldBinning.cxx.
|
protected |
Calculate number of bins required to store this binning with the given axisSteering.
[in] | axisSteering | see method CreateHistogram() |
returns the number of bins
Definition at line 1020 of file TUnfoldBinning.cxx.
const TObjString * TUnfoldBinning::GetUnconnectedBinName | ( | Int_t | bin | ) | const |
Return the bin names of unconnected bins.
[in] | bin | local bin number |
Definition at line 1908 of file TUnfoldBinning.cxx.
|
inline |
check whether the axis has an overflow bin
Definition at line 175 of file TUnfoldBinning.h.
Check whether there are bins but no axis.
Definition at line 1898 of file TUnfoldBinning.cxx.
|
inline |
check whether an axis has an underflow bin
Definition at line 173 of file TUnfoldBinning.h.
Initialize variables for a given number of bins.
Definition at line 148 of file TUnfoldBinning.cxx.
Check whether there is only a global scaling factor for this node.
Definition at line 1749 of file TUnfoldBinning.cxx.
Print some information about this binning tree.
[out] | out | stream to write to |
[in] | indent | initial indentation (sub-trees have indent+1) |
[in] | debug | if debug>0 print more information |
Definition at line 436 of file TUnfoldBinning.cxx.
Set normalisation factors which are used in calls to GetBinFactor().
[in] | normalisation | normalisation factor |
[in] | binfactor | object which defines a factor for each bin |
In the present implementation, binfactor can be a TF1 or a TVectorD. The TF1 is evaluated a the bin centers of the relevant axes. The TVectorD is indexed by the global bin number minus the start bin number of this node.
Definition at line 510 of file TUnfoldBinning.cxx.
Set normalisation factor and function which are used in calls to GetBinFactor().
[in] | normalisation | normalisation factor |
[in] | userFunc | function evaluated at the (multi-dimensional) bin centres |
Definition at line 527 of file TUnfoldBinning.cxx.
Set one entry in a bin map.
[out] | binMap | to be used with TUnfoldSys::GetOutput() etc |
[in] | source | bin, global bin number in this binning scheme |
[in] | destination | bin in the output histogram |
Definition at line 1059 of file TUnfoldBinning.cxx.
|
protected |
Return distribution in which the bin is located and bin numbers on the corresponding axes.
[in] | globalBin | global bin number |
[out] | local | bin numbers of the distribution's axes |
returns the distribution in which the globalBin is located or 0 if the globalBin is outside this node and its children
Definition at line 2083 of file TUnfoldBinning.cxx.
|
protected |
Get global bin number, given axis bin numbers.
[in] | axisBins[] | bin numbers on each axis |
[out] | isBelow | indicates bins are in underflow but there is no undeflow bin |
[out] | isAbove | indicates bins are in overflow but there is no overflow bin |
return: global bin number or -1 if not matched.
Definition at line 2035 of file TUnfoldBinning.cxx.
Update fFirstBin and fLastBin members of this node and its children.
[in] | startWithRootNode | if true, start the update with the root node |
Definition at line 170 of file TUnfoldBinning.cxx.
|
protected |
first daughter node
Definition at line 58 of file TUnfoldBinning.h.
|
protected |
for each axis its name (TObjString), or names of unconnected bins
Definition at line 66 of file TUnfoldBinning.h.
|
protected |
for each axis the bin borders (TVectorD)
Definition at line 64 of file TUnfoldBinning.h.
|
protected |
common scale factor for all bins of this node
Definition at line 80 of file TUnfoldBinning.h.
|
protected |
function to calculate a scale factor from bin centres (may be a TF1 or a TVectorD
Definition at line 78 of file TUnfoldBinning.h.
|
protected |
number of bins in this node's distribution
Definition at line 72 of file TUnfoldBinning.h.
|
protected |
global bin number of the first bin
Definition at line 74 of file TUnfoldBinning.h.
|
protected |
bit fields indicating whether there are overflow bins on the axes
Definition at line 70 of file TUnfoldBinning.h.
|
protected |
bit fields indicating whether there are underflow bins on the axes
Definition at line 68 of file TUnfoldBinning.h.
|
protected |
global bin number of the last(+1) bin, including daughters
Definition at line 76 of file TUnfoldBinning.h.
|
protected |
next sister
Definition at line 60 of file TUnfoldBinning.h.
|
protected |
mother node
Definition at line 56 of file TUnfoldBinning.h.
|
protected |
previous sister
Definition at line 62 of file TUnfoldBinning.h.