Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TUnfoldBinning Class Reference

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

Functionality

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

  • several unconnected bins, each with a dedicated name.
  • bins organized in a multidimensional distribution, defined by a set of axes. The axes are defined by a number of bins N and by (N+1) bin borders. In addition to the N bins inside there may be an underflow and an overflow bin

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.

Use in the analysis

Booking histograms:

  • Define binning schemes on detector level and on truth level. This can be done using the XML language, use the class TUnfoldBinningXML to read the binning scheme. The TUnfoldBinning objects can be written to a root file, preferentially together with the corresponding histograms.
  • For Monte Carlo, book histograms for the response matrix (detector vs truth level) using the method CreateHistogramOfMigrations()
  • For data and background, book histograms using the "detector level" binning scheme and the method CreateHistogram()
  • (if required) for the data covarianve matrix, book a histogram using the "detector level" binning scheme and the method CreateErrorMatrixHistogram()
  • For truth histograms, book histograms using the "truth level" binning scheme and the method CreateHistogram()

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:

  • Use the method FindNode() to locate a group of bins (e.g. signal, control distribution, etc) by their name, then:
  • Use the method GetGlobalBinNumber() to locate a bin in a distribution, then:
  • Use the TH1::Fill() method and the bin number to fill the appropriate bin in one of the histograms booked above.

Unfolding: Specify the response matrix and the binning schemes when constructing a TUnfoldDensity object. Tell TUnfoldDensity about the data, bakcground, systematic error histograms using the corresponding methods of class TUnfoldDensity. Then run the unfolding. Use the GetXXX() methods to retreive the unfolding results into properly binned multidimensional histograms.

Definition at line 58 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 = (1ULL << ( 0 )) , kOverwrite = (1ULL << ( 1 )) , kWriteDelete = (1ULL << ( 2 )) }
 
enum  EDeprecatedStatusBits { kObjInCanvas = (1ULL << ( 3 )) }
 
enum  EStatusBits {
  kCanDelete = (1ULL << ( 0 )) , kMustCleanup = (1ULL << ( 3 )) , kIsReferenced = (1ULL << ( 4 )) , kHasUUID = (1ULL << ( 5 )) ,
  kCannotPick = (1ULL << ( 6 )) , kNoContextMenu = (1ULL << ( 8 )) , kInvalidObject = (1ULL << ( 13 ))
}
 

Public Member Functions

 TUnfoldBinning (const char *name=nullptr, Int_t nBins=0, const char *binNames=nullptr)
 create a new node without axis
 
 TUnfoldBinning (const TAxis &axis, Int_t includeUnderflow, Int_t includeOverflow)
 create a new node containing a distribution with one axis
 
 ~TUnfoldBinning (void) override
 
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
 
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
 
Bool_t AddAxis (const TAxis &axis, Bool_t includeUnderflow, Bool_t includeOverflow)
 add an axis to the distribution, using the TAxis as blueprint
 
TUnfoldBinningAddBinning (const char *name, Int_t nBins=0, const char *binNames=nullptr)
 add a new binning node as last last child of this node
 
TUnfoldBinningAddBinning (TUnfoldBinning *binning)
 add a TUnfoldBinning as the last child of this node
 
Int_tCreateEmptyBinMap (void) const
 create an empty bin map, useful together with the getter methods of class TUnfold and TUnfoldSys
 
TH2DCreateErrorMatrixHistogram (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
 
TH1CreateHistogram (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
 
void DecodeAxisSteering (const char *axisSteering, const char *options, Int_t *isOptionGiven) const
 decode axis steering
 
TH1ExtractHistogram (const char *histogramName, const TH1 *globalBins, const TH2 *globalBinsEmatrix=nullptr, Bool_t originalAxisBinning=kTRUE, const char *axisSteering=nullptr) const
 
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
 
TUnfoldBinning const * FindNode (char const *name) const
 traverse the tree and return the first node which matches the given name
 
virtual Double_t GetBinFactor (Int_t iBin) const
 return scaling factor for the given global bin number
 
TString GetBinName (Int_t iBin) const
 get the name of a bin
 
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
 
Double_t GetBinSize (Int_t iBin) const
 get N-dimensional bin size
 
void GetBinUnderflowOverflowStatus (Int_t iBin, Int_t *uStatus, Int_t *oStatus) const
 return bit maps indicating underflow and overflow status
 
TUnfoldBinningGetChildNode (void)
 
TUnfoldBinning const * GetChildNode (void) const
 first daughter node
 
virtual Double_t GetDistributionAverageBinSize (Int_t axis, Bool_t includeUnderflow, Bool_t includeOverflow) const
 get average bin size on the specified axis
 
TString GetDistributionAxisLabel (Int_t axis) const
 get name of an axis
 
virtual Double_t GetDistributionBinCenter (Int_t axis, Int_t bin) const
 return bin center for a given axis and bin number
 
TVectorD const * GetDistributionBinning (Int_t axis) const
 get vector of bin borders for one axis
 
Int_t GetDistributionDimension (void) const
 query dimension of this node's distribution
 
Int_t GetDistributionNumberOfBins (void) const
 number of bins in the distribution possibly including under/overflow
 
virtual Double_t GetDistributionOverflowBinWidth (Int_t axis) const
 return bin width assigned to the overflow bin
 
virtual Double_t GetDistributionUnderflowBinWidth (Int_t axis) const
 return bin width assigned to the underflow bin
 
Int_t GetEndBin (void) const
 last+1 bin of this node (includes children)
 
Int_t GetGlobalBinNumber (const Double_t *x, Int_t *isBelow=nullptr, Int_t *isAbove=nullptr) const
 locate a bin in an N-dimensional distribution
 
Int_t GetGlobalBinNumber (Double_t x) const
 locate a bin in a one-dimensional distribution
 
Int_t GetGlobalBinNumber (Double_t x, Double_t y) const
 locate a bin in a two-dimensional distribution
 
Int_t GetGlobalBinNumber (Double_t x, Double_t y, Double_t z) const
 locate a bin in a three-dimensional distribution
 
Int_t GetGlobalBinNumber (Double_t x0, Double_t x1, Double_t x2, Double_t x3) const
 locate a bin in a four-dimensional distribution
 
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
 
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
 
Double_t GetGlobalFactor (void) const
 return global scaling factor for this node
 
TUnfoldBinningGetNextNode (void)
 
TUnfoldBinning const * GetNextNode (void) const
 next sister node
 
TUnfoldBinningGetParentNode (void)
 
TUnfoldBinning const * GetParentNode (void) const
 mother node
 
TUnfoldBinning const * GetPrevNode (void) const
 previous sister node
 
TUnfoldBinning const * GetRootNode (void) const
 return root node of the binnig scheme
 
Int_t GetStartBin (void) const
 first bin of this node
 
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
 
const TObjStringGetUnconnectedBinName (Int_t bin) const
 return the bin names of unconnected bins
 
Bool_t HasOverflow (int axis) const
 check whether the axis has an overflow bin
 
Bool_t HasUnconnectedBins (void) const
 check whether there are bins but no axis
 
Bool_t HasUnderflow (int axis) const
 check whether an axis has an underflow bin
 
TClassIsA () const override
 
virtual Bool_t IsBinFactorGlobal (void) const
 check whether there is only a global scaling factor for this node
 
void PrintStream (std::ostream &out, Int_t indent=0, int debug=0) const
 print some information about this binning tree
 
void SetBinFactorFunction (Double_t normalisation, TF1 *userFunc=nullptr)
 set normalisation factor and function which are used in calls to GetBinFactor()
 
void SetBinMapEntry (Int_t *binMap, Int_t globalBin, Int_t destBin) const
 set one entry in a bin map
 
void Streamer (TBuffer &) override
 Stream an object of class TObject.
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
- Public Member Functions inherited from TNamed
 TNamed ()
 
 TNamed (const char *name, const char *title)
 
 TNamed (const TNamed &named)
 TNamed copy ctor.
 
 TNamed (const TString &name, const TString &title)
 
virtual ~TNamed ()
 TNamed destructor.
 
void Clear (Option_t *option="") override
 Set name and title to empty strings ("").
 
TObjectClone (const char *newname="") const override
 Make a clone of an object using the Streamer facility.
 
Int_t Compare (const TObject *obj) const override
 Compare two TNamed objects.
 
void Copy (TObject &named) const override
 Copy this to obj.
 
virtual void FillBuffer (char *&buffer)
 Encode TNamed into output buffer.
 
const char * GetName () const override
 Returns name of object.
 
const char * GetTitle () const override
 Returns title of object.
 
ULong_t Hash () const override
 Return hash value for this object.
 
Bool_t IsSortable () const override
 
void ls (Option_t *option="") const override
 List TNamed name and title.
 
TNamedoperator= (const TNamed &rhs)
 TNamed assignment operator.
 
void Print (Option_t *option="") const override
 Print TNamed name and title.
 
virtual void SetName (const char *name)
 Set the name of the TNamed.
 
virtual void SetNameTitle (const char *name, const char *title)
 Set all the TNamed parameters (name and title).
 
virtual void SetTitle (const char *title="")
 Set the title of the TNamed.
 
virtual Int_t Sizeof () const
 Return size of the TNamed part of the TObject.
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
- Public Member Functions inherited from TObject
 TObject ()
 TObject constructor.
 
 TObject (const TObject &object)
 TObject copy ctor.
 
virtual ~TObject ()
 TObject destructor.
 
void AbstractMethod (const char *method) const
 Use this method to implement an "abstract" method that you don't want to leave purely abstract.
 
virtual void AppendPad (Option_t *option="")
 Append graphics object to current pad.
 
virtual void Browse (TBrowser *b)
 Browse object. May be overridden for another default action.
 
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.
 
virtual const char * ClassName () const
 Returns name of class to which the object belongs.
 
virtual void Delete (Option_t *option="")
 Delete this object.
 
virtual Int_t DistancetoPrimitive (Int_t px, Int_t py)
 Computes distance from point (px,py) to the object.
 
virtual void Draw (Option_t *option="")
 Default Draw method for all objects.
 
virtual void DrawClass () const
 Draw class inheritance tree of the class to which this object belongs.
 
virtual TObjectDrawClone (Option_t *option="") const
 Draw a clone of this object in the current selected pad with: gROOT->SetSelectedPad(c1).
 
virtual void Dump () const
 Dump contents of object on stdout.
 
virtual void Error (const char *method, const char *msgfmt,...) const
 Issue error message.
 
virtual void Execute (const char *method, const char *params, Int_t *error=nullptr)
 Execute method on this object with the given parameter string, e.g.
 
virtual void Execute (TMethod *method, TObjArray *params, Int_t *error=nullptr)
 Execute method on this object with parameters stored in the TObjArray.
 
virtual void ExecuteEvent (Int_t event, Int_t px, Int_t py)
 Execute action corresponding to an event at (px,py).
 
virtual void Fatal (const char *method, const char *msgfmt,...) const
 Issue fatal error message.
 
virtual TObjectFindObject (const char *name) const
 Must be redefined in derived classes.
 
virtual TObjectFindObject (const TObject *obj) const
 Must be redefined in derived classes.
 
virtual Option_tGetDrawOption () const
 Get option used by the graphics system to draw this object.
 
virtual const char * GetIconName () const
 Returns mime type name of object.
 
virtual char * GetObjectInfo (Int_t px, Int_t py) const
 Returns string containing info about the object at position (px,py).
 
virtual Option_tGetOption () const
 
virtual UInt_t GetUniqueID () const
 Return the unique object id.
 
virtual Bool_t HandleTimer (TTimer *timer)
 Execute action in response of a timer timing out.
 
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.
 
virtual void Info (const char *method, const char *msgfmt,...) const
 Issue info message.
 
virtual Bool_t InheritsFrom (const char *classname) const
 Returns kTRUE if object inherits from class "classname".
 
virtual Bool_t InheritsFrom (const TClass *cl) const
 Returns kTRUE if object inherits from TClass cl.
 
virtual void Inspect () const
 Dump contents of this object in a graphics canvas.
 
void InvertBit (UInt_t f)
 
Bool_t IsDestructed () const
 IsDestructed.
 
virtual Bool_t IsEqual (const TObject *obj) const
 Default equal comparison (objects are equal if they have the same address in memory).
 
virtual Bool_t IsFolder () const
 Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
 
R__ALWAYS_INLINE Bool_t IsOnHeap () const
 
R__ALWAYS_INLINE Bool_t IsZombie () const
 
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).
 
virtual Bool_t Notify ()
 This method must be overridden to handle object notification (the base implementation is no-op).
 
void Obsolete (const char *method, const char *asOfVers, const char *removedFromVers) const
 Use this method to declare a method obsolete.
 
void operator delete (void *ptr)
 Operator delete.
 
void operator delete (void *ptr, void *vp)
 Only called by placement new when throwing an exception.
 
void operator delete[] (void *ptr)
 Operator delete [].
 
void operator delete[] (void *ptr, void *vp)
 Only called by placement new[] when throwing an exception.
 
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)
 
TObjectoperator= (const TObject &rhs)
 TObject assignment operator.
 
virtual void Paint (Option_t *option="")
 This method must be overridden if a class wants to paint itself.
 
virtual void Pop ()
 Pop on object drawn in a pad to the top of the display list.
 
virtual Int_t Read (const char *name)
 Read contents of object with specified name from the current directory.
 
virtual void RecursiveRemove (TObject *obj)
 Recursively remove this object from a list.
 
void ResetBit (UInt_t f)
 
virtual void SaveAs (const char *filename="", Option_t *option="") const
 Save this object in the file specified by filename.
 
virtual void SavePrimitive (std::ostream &out, Option_t *option="")
 Save a primitive as a C++ statement(s) on output stream "out".
 
void SetBit (UInt_t f)
 
void SetBit (UInt_t f, Bool_t set)
 Set or unset the user status bits as specified in f.
 
virtual void SetDrawOption (Option_t *option="")
 Set drawing option for object.
 
virtual void SetUniqueID (UInt_t uid)
 Set the unique object id.
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 
virtual void SysError (const char *method, const char *msgfmt,...) const
 Issue system error message.
 
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.
 
virtual void Warning (const char *method, const char *msgfmt,...) const
 Issue warning message.
 
virtual Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0)
 Write this object to the current directory.
 
virtual Int_t Write (const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const
 Write this object to the current directory.
 

Static Public Member Functions

static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static TH2DCreateHistogramOfMigrations (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, respectively
 
static const char * DeclFileName ()
 
- Static Public Member Functions inherited from TNamed
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
- Static Public Member Functions inherited from TObject
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
static Longptr_t GetDtorOnly ()
 Return destructor only flag.
 
static Bool_t GetObjectStat ()
 Get status of object stat flag.
 
static void SetDtorOnly (void *obj)
 Set destructor only flag.
 
static void SetObjectStat (Bool_t stat)
 Turn on/off tracking of objects in the TObjectTable.
 

Protected Member Functions

TString BuildHistogramTitle (const char *histogramName, const char *histogramTitle, Int_t const *axisList) const
 construct a title
 
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_tCreateBinMap (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
 
Int_t FillBinMapRecursive (Int_t startBin, const char *axisSteering, Int_t *binMap) const
 recursively fill bin map
 
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
 
const TUnfoldBinningGetNonemptyNode (void) const
 find a node which has non-empty distributions if there is none or if there are many, return zero
 
const TUnfoldBinningGetNonemptyNode_r (int &count) const
 
TUnfoldBinningGetRootNode (void)
 return root node
 
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
 
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
 
Int_t GetTHxxBinsRecursive (const char *axisSteering) const
 calculate number of bins required to store this binning with teh given axisSteering
 
void Initialize (Int_t nBins)
 initialize variables for a given number of bins
 
void SetBinFactor (Double_t normalisation, TObject *factors)
 set normalisation factors which are used in calls to GetBinFactor()
 
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
 
Int_t ToGlobalBin (Int_t const *axisBins, Int_t *isBelow=nullptr, Int_t *isAbove=nullptr) const
 get global bin number, given axis bin numbers
 
Int_t UpdateFirstLastBin (Bool_t startWithRootNode=kTRUE)
 update fFirstBin and fLastBin members of this node and its children
 
- 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).
 
void MakeZombie ()
 

Protected Attributes

TUnfoldBinningchildNode
 first daughter node
 
TObjArrayfAxisLabelList
 for each axis its name (TObjString), or names of unconnected bins
 
TObjArrayfAxisList
 for each axis the bin borders (TVectorD)
 
Double_t fBinFactorConstant
 common scale factor for all bins of this node
 
TObjectfBinFactorFunction
 function to calculate a scale factor from bin centres (may be a TF1 or a TVectorD
 
Int_t fDistributionSize
 number of bins in this node's distribution
 
Int_t fFirstBin
 global bin number of the first bin
 
Int_t fHasOverflow
 bit fields indicating whether there are overflow bins on the axes
 
Int_t fHasUnderflow
 bit fields indicating whether there are underflow bins on the axes
 
Int_t fLastBin
 global bin number of the last(+1) bin, including daughters
 
TUnfoldBinningnextNode
 next sister
 
TUnfoldBinningparentNode
 mother node
 
TUnfoldBinningprevNode
 previous sister
 
- Protected Attributes inherited from TNamed
TString fName
 
TString fTitle
 

Additional Inherited Members

- Protected Types inherited from TObject
enum  { kOnlyPrepStep = (1ULL << ( 3 )) }
 

#include <TUnfoldBinning.h>

Inheritance diagram for TUnfoldBinning:
[legend]

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
MAXDIM 

maximum numner of axes per distribution

Definition at line 88 of file TUnfoldBinning.h.

Constructor & Destructor Documentation

◆ TUnfoldBinning() [1/2]

TUnfoldBinning::TUnfoldBinning ( const char *  name = nullptr,
Int_t  nBins = 0,
const char *  binNames = nullptr 
)

create a new node without axis

Parameters
[in]nameidentifier of the node
[in]nBinnumber of unconnected bins (could be zero)
[in]binNames(optional) names of the bins separated by ';'

Definition at line 209 of file TUnfoldBinning.cxx.

◆ TUnfoldBinning() [2/2]

TUnfoldBinning::TUnfoldBinning ( const TAxis axis,
Int_t  includeUnderflow,
Int_t  includeOverflow 
)

create a new node containing a distribution with one axis

Parameters
[in]axisthe axis to represent
[in]includeUnderflowtrue if underflow bin should be included
[in]includeOverflowtrue if overflow bin should be included

Definition at line 228 of file TUnfoldBinning.cxx.

◆ ~TUnfoldBinning()

TUnfoldBinning::~TUnfoldBinning ( void  )
override

Definition at line 126 of file TUnfoldBinning.cxx.

Member Function Documentation

◆ AddAxis() [1/3]

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

Parameters
[in]namename of the axis
[in]nBinnumber of bins
[in]binBordersarray of bin borders, with nBin+1 elements
[in]hasUnderflowdecide whether the axis has an underflow bin
[in]hasOverflowdecide whether the axis has an overflow bin

returns true if the axis has been added

Definition at line 371 of file TUnfoldBinning.cxx.

◆ AddAxis() [2/3]

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

Parameters
[in]namename of the axis
[in]nBinnumber of bins
[in]xMinlower edge of the first bin
[in]xMaxupper edge of the last bin
[in]hasUnderflowdecide whether the axis has an underflow bin
[in]hasOverflowdecide whether the axis has an overflow bin

returns true if the axis has been added

Definition at line 311 of file TUnfoldBinning.cxx.

◆ AddAxis() [3/3]

Bool_t TUnfoldBinning::AddAxis ( const TAxis axis,
Bool_t  hasUnderflow,
Bool_t  hasOverflow 
)

add an axis to the distribution, using the TAxis as blueprint

Parameters
[in]axisblueprint of the axis
[in]hasUnderflowdecide whether the underflow bin should be included
[in]hasOverflowdecide whether the overflow bin should be included

returns true if the axis has been added Note: axis labels are not imported

Definition at line 346 of file TUnfoldBinning.cxx.

◆ AddBinning() [1/2]

TUnfoldBinning * TUnfoldBinning::AddBinning ( const char *  name,
Int_t  nBins = 0,
const char *  binNames = nullptr 
)

add a new binning node as last last child of this node

Parameters
[in]namename of the node
[in]nBinnumber of extra bins
[in]binNames(optional) names of the bins sepatared by ';'

this is a shortcut for AddBinning(new TUnfoldBinning(name,nBins,binNames))

Definition at line 245 of file TUnfoldBinning.cxx.

◆ AddBinning() [2/2]

TUnfoldBinning * TUnfoldBinning::AddBinning ( TUnfoldBinning binning)

add a TUnfoldBinning as the last child of this node

Parameters
[in]binningthe new binning to be added

return value: if succeeded, return "binning" otherwise return 0

Definition at line 258 of file TUnfoldBinning.cxx.

◆ BuildHistogramTitle()

TString TUnfoldBinning::BuildHistogramTitle ( const char *  histogramName,
const char *  histogramTitle,
Int_t const *  axisList 
) const
protected

construct a title

Parameters
[in]histogramNamedistribution name
[in]histogramTitledefault title
[in]axisListarray indicating wqhich axis of this node is mapped to which histogram axis

if histogramTitle!=nullptr thsi title is used. Otherwise, the title is composed as: histogramName;axisname[axisList[0]];axisname[axisList[1]];...

Definition at line 576 of file TUnfoldBinning.cxx.

◆ BuildHistogramTitle2D()

TString TUnfoldBinning::BuildHistogramTitle2D ( const char *  histogramName,
const char *  histogramTitle,
Int_t  xAxis,
const TUnfoldBinning yAxisBinning,
Int_t  yAxis 
) const
protected

construct a histogram title for a 2D histogram with different binning schemes on x and y axis

Parameters
[in]histogramNamedistribution name
[in]histogramTitledefault title
[in]xAxisindicates which x-axis name to use
[in]yAxisBinningbinning scheme for y-axis
[in]yAxisindicates which y-axis name to use

Definition at line 611 of file TUnfoldBinning.cxx.

◆ Class()

static TClass * TUnfoldBinning::Class ( )
static
Returns
TClass describing this class

◆ Class_Name()

static const char * TUnfoldBinning::Class_Name ( )
static
Returns
Name of this class

◆ Class_Version()

static constexpr Version_t TUnfoldBinning::Class_Version ( )
inlinestaticconstexpr
Returns
Version of this class

Definition at line 208 of file TUnfoldBinning.h.

◆ CreateBinMap()

Int_t * TUnfoldBinning::CreateBinMap ( const TH1 hist,
Int_t  nDim,
const Int_t axisList,
const char *  axisSteering 
) const
protected

create mapping from global bin number to a histogram for this node

Parameters
[in]histdestination histogram
[in]nDimtarget dimension
[in]axisListmap axes in the binning scheme to histogram axes
[in]axisSteeringsteering for underflow/overflow/projections

The axisSteering is explained with the method CreateHistogram()

Definition at line 1100 of file TUnfoldBinning.cxx.

◆ CreateEmptyBinMap()

Int_t * TUnfoldBinning::CreateEmptyBinMap ( void  ) const

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 eleemnts set to -1

Definition at line 1032 of file TUnfoldBinning.cxx.

◆ CreateErrorMatrixHistogram()

TH2D * TUnfoldBinning::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

Parameters
[in]histogramNamename of the histogram which is created
[in]originalAxisBinningif true, try to preserve the axis binning
[out](default=nullptr)binMap mapping of global bins to histogram bins. if(binMap==nullptr), no binMap is created
[in](default=nullptr)histogramTitle title o fthe histogram. If zero, a title is selected automatically
[in](default=nullptr)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 788 of file TUnfoldBinning.cxx.

◆ CreateHistogram()

TH1 * TUnfoldBinning::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

Parameters
[in]histogramNamename of the histogram which is created
[in]originalAxisBinningif true, try to preserve the axis binning
[out](default=nullptr)binMap mapping of global bins to histogram bins. if(binMap==nullptr), no binMap is created
[in](default=nullptr)histogramTitle title o fthe histogram. If zero, a title is selected automatically
[in](default=nullptr)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

  • axis is the name of an axis or equal to *, the latter matches all axes
  • options is a combination of characters chosen from OUC0123456789
    • if O is included, the overflow bin of that axis is discarded
    • if U is included, the underflow bin of that axis is discarded
    • if C is included, the bins on that axes are collapsed, i.e. the corresponding histogram axis is not present in the output. The corrsponding bin contents are added up (projected onto the remaining axes). Using the characters O and U one can decide to exclude underflow or overflow from the projection. Using a selection of the characters 0123456789 one can restrict the sum further to only include the corresponding bins. In this counting, the first non-underflow bin corresponds to the character 0. This obviously only works for up to ten bins.

Definition at line 727 of file TUnfoldBinning.cxx.

◆ CreateHistogramOfMigrations()

TH2D * TUnfoldBinning::CreateHistogramOfMigrations ( TUnfoldBinning const *  xAxis,
TUnfoldBinning const *  yAxis,
char const *  histogramName,
Bool_t  originalXAxisBinning = kFALSE,
Bool_t  originalYAxisBinning = kFALSE,
char const *  histogramTitle = nullptr 
)
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

Parameters
[in]yAxisbinning scheme for the y axis
[in]histogramNamename of the histogram which is created
[in]originalXAxisBinningpreserve x-axis bin widths if possible
[in]originalXAxisBinningpreserve y-axis bin widths if possible
[in]histogramTitleif is non-zero, it is taken as histogram title otherwise, the title is created automatically

returns a new TH2D.

Definition at line 831 of file TUnfoldBinning.cxx.

◆ DeclFileName()

static const char * TUnfoldBinning::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 208 of file TUnfoldBinning.h.

◆ DecodeAxisSteering()

void TUnfoldBinning::DecodeAxisSteering ( const char *  axisSteering,
const char *  options,
Int_t isOptionGiven 
) const

decode axis steering

Parameters
[in]axisSteeringthe steering to decode
[in]optionsthe allowed options to extract
[out]isOptionGivenarray 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 2095 of file TUnfoldBinning.cxx.

◆ ExtractHistogram()

TH1 * TUnfoldBinning::ExtractHistogram ( const char *  histogramName,
const TH1 globalBins,
const TH2 globalBinsEmatrix = nullptr,
Bool_t  originalAxisBinning = kTRUE,
const char *  axisSteering = nullptr 
) const

Definition at line 1346 of file TUnfoldBinning.cxx.

◆ FillBinMap1D()

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

Parameters
[out]binMapto be used with TUnfoldSys::GetOutput() etc
[in]axisSteeringsteering for underflow/overflow/projections
[in]firstBinXfirst bin of destination histogram to be filled

returns: highest bin number in destibation histogram plus 1
The parameter axisSteering is explained with the method CreateHistogram()

Definition at line 1073 of file TUnfoldBinning.cxx.

◆ FillBinMapRecursive()

Int_t TUnfoldBinning::FillBinMapRecursive ( Int_t  startBin,
const char *  axisSteering,
Int_t binMap 
) const
protected

recursively fill bin map

Parameters
[in]startBinfirst histogram bin
[in]axisSteeringsee CreateHistogram() method
[out]binMapthe bin mapping which is to be filled

the positions binMap[GetStartBin()]...binMap[GetEndBin()-1] are filled

Definition at line 1164 of file TUnfoldBinning.cxx.

◆ FillBinMapSingleNode()

Int_t TUnfoldBinning::FillBinMapSingleNode ( const TH1 hist,
Int_t  startBin,
Int_t  nDim,
const Int_t axisList,
const char *  axisSteering,
Int_t binMap 
) const
protected

fill bin map for a single node

Parameters
[in]histthe histogram representing this node (used if nDim>0)
[in]startBinstart bin in the bin map
[in]nDimnumber of dimensions to resolve
[in]axisList[3]TUnfoldBinning axis numbers corresponding to the axes of hist
[in]axisSteeringsee documentation of CreateHistogram()
[out]binMapthe bin map to fill

returns the number of bins mapped.
The result depends on the parameter nDim as follows

  • nDim==nullptr: bins are mapped in linear order, ignore hist and axisList
  • nDim==hist->GetDimension(): bins are mapped to "hist" bin numbers the corresponding TUnfoldBinning axes are taken from axisList[]
  • nDim=1 and hist->GetDimension()>1: bins are mapped to the x-axis of "hist" the corresponding TUnfoldBinning axis is taken from axisList[0]

Definition at line 1202 of file TUnfoldBinning.cxx.

◆ FindNode()

TUnfoldBinning const * TUnfoldBinning::FindNode ( char const *  name) const

traverse the tree and return the first node which matches the given name

Parameters
[in]namethe identifier of the node to find (zero matches the first node)

returns the node found or zero

Definition at line 532 of file TUnfoldBinning.cxx.

◆ GetBinFactor()

Double_t TUnfoldBinning::GetBinFactor ( Int_t  iBin) const
virtual

return scaling factor for the given global bin number

Parameters
[in]iBinglobal bin number

returns the scaling factor for this bin. The scaling factors can be set using the method SetBinFactorFunction()

Definition at line 1739 of file TUnfoldBinning.cxx.

◆ GetBinName()

TString TUnfoldBinning::GetBinName ( Int_t  iBin) const

get the name of a bin

Parameters
[in]iBinglobal bin number

returns a string describing the bin

Definition at line 1651 of file TUnfoldBinning.cxx.

◆ GetBinNeighbours()

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

Parameters
[in]binglobal bin number
[in]axisaxis number of interest
[out]prevbin number of previous bin or -1 if not existing
[out]distPrevdistance between bin centres
[out]nextbin number of next bin or -1 if not existing
[out]distNextdistance between bin centres
[in]isPeriodic(default=false) if true, the first bin is counted as neighbour of the last bin

return code

  • 0 everything is fine
  • 1,2,3 isPeriodic option was reset to false, because underflow/overflow bins are present
    • +1 invalid isPeriodic option was specified with underflow bin
    • +2 invalid isPeriodic option was specified with overflow bin

Definition at line 1798 of file TUnfoldBinning.cxx.

◆ GetBinSize()

Double_t TUnfoldBinning::GetBinSize ( Int_t  iBin) const

get N-dimensional bin size

Parameters
[in]iBinglobal bin number

Definition at line 1696 of file TUnfoldBinning.cxx.

◆ GetBinUnderflowOverflowStatus()

void TUnfoldBinning::GetBinUnderflowOverflowStatus ( Int_t  iBin,
Int_t uStatus,
Int_t oStatus 
) const

return bit maps indicating underflow and overflow status

Parameters
[in]iBinglobal bin number
[out]uStatusbit map indicating whether the bin is underflow
[out]oStatusbit map indicating whether the bin is overflow

Definition at line 1851 of file TUnfoldBinning.cxx.

◆ GetChildNode() [1/2]

TUnfoldBinning * TUnfoldBinning::GetChildNode ( void  )
inline

Definition at line 109 of file TUnfoldBinning.h.

◆ GetChildNode() [2/2]

TUnfoldBinning const * TUnfoldBinning::GetChildNode ( void  ) const
inline

first daughter node

Definition at line 108 of file TUnfoldBinning.h.

◆ GetDistributionAverageBinSize()

Double_t TUnfoldBinning::GetDistributionAverageBinSize ( Int_t  axis,
Bool_t  includeUnderflow,
Bool_t  includeOverflow 
) const
virtual

get average bin size on the specified axis

Parameters
[in]axisaxis number
[in]includeUnderflowwhether to include the underflow bin
[in]includeOverflowwhether to include the overflow bin

Definition at line 1890 of file TUnfoldBinning.cxx.

◆ GetDistributionAxisLabel()

TString TUnfoldBinning::GetDistributionAxisLabel ( Int_t  axis) const
inline

get name of an axis

Definition at line 172 of file TUnfoldBinning.h.

◆ GetDistributionBinCenter()

Double_t TUnfoldBinning::GetDistributionBinCenter ( Int_t  axis,
Int_t  bin 
) const
virtual

return bin center for a given axis and bin number

Parameters
[in]axisaxis number
[in]binlocal bin number on the specified axis

returns the geometrical bin center. for underflow and overflow, the calculation is using the GetDistributionUnderflowBinWidth() and GetDistributionOverflowBinWidth() methods.

Definition at line 1966 of file TUnfoldBinning.cxx.

◆ GetDistributionBinning()

TVectorD const * TUnfoldBinning::GetDistributionBinning ( Int_t  axis) const
inline

get vector of bin borders for one axis

Definition at line 169 of file TUnfoldBinning.h.

◆ GetDistributionDimension()

Int_t TUnfoldBinning::GetDistributionDimension ( void  ) const
inline

query dimension of this node's distribution

Definition at line 166 of file TUnfoldBinning.h.

◆ GetDistributionNumberOfBins()

Int_t TUnfoldBinning::GetDistributionNumberOfBins ( void  ) const
inline

number of bins in the distribution possibly including under/overflow

Definition at line 164 of file TUnfoldBinning.h.

◆ GetDistributionOverflowBinWidth()

Double_t TUnfoldBinning::GetDistributionOverflowBinWidth ( Int_t  axis) const
virtual

return bin width assigned to the overflow bin

Parameters
[in]axisaxis number

the bin width of the last bin is returned. The method is virtual, so this behaviour can be adjusted.

Definition at line 1948 of file TUnfoldBinning.cxx.

◆ GetDistributionUnderflowBinWidth()

Double_t TUnfoldBinning::GetDistributionUnderflowBinWidth ( Int_t  axis) const
virtual

return bin width assigned to the underflow bin

Parameters
[in]axisaxis number

the bin width of the first bin is returned. The method is virtual, so this behaviour can be adjusted.

Definition at line 1933 of file TUnfoldBinning.cxx.

◆ GetEndBin()

Int_t TUnfoldBinning::GetEndBin ( void  ) const
inline

last+1 bin of this node (includes children)

Definition at line 149 of file TUnfoldBinning.h.

◆ GetGlobalBinNumber() [1/7]

Int_t TUnfoldBinning::GetGlobalBinNumber ( const Double_t x,
Int_t isBelow = nullptr,
Int_t isAbove = nullptr 
) const

locate a bin in an N-dimensional distribution

Parameters
[in]xarray of coordinates
[out]isBelowpointer to an integer (bit vector) to indicate coordinates which do not fit in the binning scheme
[out]isAbovepointer 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).

Definition at line 1599 of file TUnfoldBinning.cxx.

◆ GetGlobalBinNumber() [2/7]

Int_t TUnfoldBinning::GetGlobalBinNumber ( Double_t  x) const

locate a bin in a one-dimensional distribution

Parameters
[in]xcoordinate

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 1421 of file TUnfoldBinning.cxx.

◆ GetGlobalBinNumber() [3/7]

Int_t TUnfoldBinning::GetGlobalBinNumber ( Double_t  x,
Double_t  y 
) const

locate a bin in a two-dimensional distribution

Parameters
[in]xcoordinate on first axis
[in]ycoordinate 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 1440 of file TUnfoldBinning.cxx.

◆ GetGlobalBinNumber() [4/7]

Int_t TUnfoldBinning::GetGlobalBinNumber ( Double_t  x,
Double_t  y,
Double_t  z 
) const

locate a bin in a three-dimensional distribution

Parameters
[in]xcoordinate on first axis
[in]ycoordinate on second axis
[in]zcoordinate 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

Definition at line 1463 of file TUnfoldBinning.cxx.

◆ GetGlobalBinNumber() [5/7]

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

Parameters
[in]x0coordinate on first axis
[in]x1coordinate on second axis
[in]x2coordinate on third axis
[in]x3coordinate 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

Definition at line 1492 of file TUnfoldBinning.cxx.

◆ GetGlobalBinNumber() [6/7]

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

Parameters
[in]x0coordinate on first axis
[in]x1coordinate on second axis
[in]x2coordinate on third axis
[in]x3coordinate on fourth axis
[in]x4coordinate 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

Definition at line 1523 of file TUnfoldBinning.cxx.

◆ GetGlobalBinNumber() [7/7]

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

Parameters
[in]x0coordinate on first axis
[in]x1coordinate on second axis
[in]x2coordinate on third axis
[in]x3coordinate on fourth axis
[in]x4coordinate on fifth axis
[in]x5coordinate 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

Definition at line 1556 of file TUnfoldBinning.cxx.

◆ GetGlobalFactor()

Double_t TUnfoldBinning::GetGlobalFactor ( void  ) const

return global scaling factor for this node

Definition at line 1728 of file TUnfoldBinning.cxx.

◆ GetNextNode() [1/2]

TUnfoldBinning * TUnfoldBinning::GetNextNode ( void  )
inline

Definition at line 114 of file TUnfoldBinning.h.

◆ GetNextNode() [2/2]

TUnfoldBinning const * TUnfoldBinning::GetNextNode ( void  ) const
inline

next sister node

Definition at line 113 of file TUnfoldBinning.h.

◆ GetNonemptyNode()

const TUnfoldBinning * TUnfoldBinning::GetNonemptyNode ( void  ) const
protected

find a node which has non-empty distributions if there is none or if there are many, return zero

Definition at line 916 of file TUnfoldBinning.cxx.

◆ GetNonemptyNode_r()

const TUnfoldBinning * TUnfoldBinning::GetNonemptyNode_r ( int count) const
protected

Definition at line 924 of file TUnfoldBinning.cxx.

◆ GetParentNode() [1/2]

TUnfoldBinning * TUnfoldBinning::GetParentNode ( void  )
inline

Definition at line 117 of file TUnfoldBinning.h.

◆ GetParentNode() [2/2]

TUnfoldBinning const * TUnfoldBinning::GetParentNode ( void  ) const
inline

mother node

Definition at line 116 of file TUnfoldBinning.h.

◆ GetPrevNode()

TUnfoldBinning const * TUnfoldBinning::GetPrevNode ( void  ) const
inline

previous sister node

Definition at line 111 of file TUnfoldBinning.h.

◆ GetRootNode() [1/2]

TUnfoldBinning * TUnfoldBinning::GetRootNode ( void  )
protected

return root node

Definition at line 546 of file TUnfoldBinning.cxx.

◆ GetRootNode() [2/2]

TUnfoldBinning const * TUnfoldBinning::GetRootNode ( void  ) const

return root node of the binnig scheme

Definition at line 555 of file TUnfoldBinning.cxx.

◆ GetStartBin()

Int_t TUnfoldBinning::GetStartBin ( void  ) const
inline

first bin of this node

Definition at line 147 of file TUnfoldBinning.h.

◆ GetTH1xNumberOfBins()

Int_t TUnfoldBinning::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

Parameters
[in]originalAxisBinningif true, try to have the histogram axis reflect precisely the relevant axis of the binnnig scheme
[in]axisSteeringsteering 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 667 of file TUnfoldBinning.cxx.

◆ GetTHxxBinning()

Int_t TUnfoldBinning::GetTHxxBinning ( Int_t  maxDim,
Int_t axisBins,
Int_t axisList,
const char *  axisSteering 
) const
protected

calculate properties of a THxx histogram to store this binning

Parameters
[in]maxDimmaximum dimension of the THxx (0 or 1..3) maxDim==nullptr is used to indicate that the histogram should be dimensional with all bins mapped on one axis, bin centers equal to bin numbers
[in]axisSteeringsee 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 888 of file TUnfoldBinning.cxx.

◆ GetTHxxBinningSingleNode()

Int_t TUnfoldBinning::GetTHxxBinningSingleNode ( Int_t  maxDim,
Int_t axisBins,
Int_t axisList,
const char *  axisSteering 
) const
protected

get the properties of a histogram capable to hold the distribution attached to this node

Parameters
[in]maxDimmaximum dimension of the THxx (0 or 1..3) maxDim==nullptr 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]axisSteeringsee method CreateHistogram() and projection

returns 1-3 dimension of THxx or use 1-dim THxx, binning structure is not preserved

Definition at line 954 of file TUnfoldBinning.cxx.

◆ GetTHxxBinsRecursive()

Int_t TUnfoldBinning::GetTHxxBinsRecursive ( const char *  axisSteering) const
protected

calculate number of bins required to store this binning with teh given axisSteering

Parameters
[in]axisSteeringsee method CreateHistogram()

returns the number of bins

Definition at line 1011 of file TUnfoldBinning.cxx.

◆ GetUnconnectedBinName()

const TObjString * TUnfoldBinning::GetUnconnectedBinName ( Int_t  bin) const

return the bin names of unconnected bins

Parameters
[in]binlocal bin number

Definition at line 1878 of file TUnfoldBinning.cxx.

◆ HasOverflow()

Bool_t TUnfoldBinning::HasOverflow ( int  axis) const
inline

check whether the axis has an overflow bin

Definition at line 183 of file TUnfoldBinning.h.

◆ HasUnconnectedBins()

Bool_t TUnfoldBinning::HasUnconnectedBins ( void  ) const

check whether there are bins but no axis

Definition at line 1869 of file TUnfoldBinning.cxx.

◆ HasUnderflow()

Bool_t TUnfoldBinning::HasUnderflow ( int  axis) const
inline

check whether an axis has an underflow bin

Definition at line 181 of file TUnfoldBinning.h.

◆ Initialize()

void TUnfoldBinning::Initialize ( Int_t  nBins)
protected

initialize variables for a given number of bins

Definition at line 148 of file TUnfoldBinning.cxx.

◆ IsA()

TClass * TUnfoldBinning::IsA ( ) const
inlineoverridevirtual
Returns
TClass describing current object

Reimplemented from TNamed.

Reimplemented in TUnfoldBinningXML.

Definition at line 208 of file TUnfoldBinning.h.

◆ IsBinFactorGlobal()

Bool_t TUnfoldBinning::IsBinFactorGlobal ( void  ) const
virtual

check whether there is only a global scaling factor for this node

Definition at line 1722 of file TUnfoldBinning.cxx.

◆ PrintStream()

void TUnfoldBinning::PrintStream ( std::ostream &  out,
Int_t  indent = 0,
int  debug = 0 
) const

print some information about this binning tree

Parameters
[out]outstream to write to
[in]indentinitial indentation (sub-trees have indent+1)
[in]debugif debug>0 print more information

Definition at line 429 of file TUnfoldBinning.cxx.

◆ SetBinFactor()

void TUnfoldBinning::SetBinFactor ( Double_t  normalisation,
TObject binfactor 
)
protected

set normalisation factors which are used in calls to GetBinFactor()

Parameters
[in]normalisationnormalisation factor
[in]binfactorobject which defines a factor for each bin

IN the presnet implementation, binfactor can be a TF1 or a TVectorD. The TF1 is evaluated a the bin centes of the relevant axes. The TVectorD is indexed by the global bin number minus the start bin number of this node.

Definition at line 502 of file TUnfoldBinning.cxx.

◆ SetBinFactorFunction()

void TUnfoldBinning::SetBinFactorFunction ( Double_t  normalisation,
TF1 userFunc = nullptr 
)

set normalisation factor and function which are used in calls to GetBinFactor()

Parameters
[in]normalisationnormalisation factor
[in]userFuncfunction evaluated at the (multi-dimensional) bin centres

Definition at line 518 of file TUnfoldBinning.cxx.

◆ SetBinMapEntry()

void TUnfoldBinning::SetBinMapEntry ( Int_t binMap,
Int_t  globalBin,
Int_t  destBin 
) const

set one entry in a bin map

Parameters
[out]binMapto be used with TUnfoldSys::GetOutput() etc
[in]sourcebin, global bin number in this binning scheme
[in]destinationbin in the output histogram

Definition at line 1051 of file TUnfoldBinning.cxx.

◆ Streamer()

void TUnfoldBinning::Streamer ( TBuffer R__b)
overridevirtual

Stream an object of class TObject.

Reimplemented from TNamed.

Reimplemented in TUnfoldBinningXML.

◆ StreamerNVirtual()

void TUnfoldBinning::StreamerNVirtual ( TBuffer ClassDef_StreamerNVirtual_b)
inline

Definition at line 208 of file TUnfoldBinning.h.

◆ ToAxisBins()

TUnfoldBinning const * TUnfoldBinning::ToAxisBins ( Int_t  globalBin,
Int_t axisBins 
) const
protected

return distribution in which the bin is located and bin numbers on the corresponding axes

Parameters
[in]globalBinglobal bin number
[out]localbin 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 2044 of file TUnfoldBinning.cxx.

◆ ToGlobalBin()

Int_t TUnfoldBinning::ToGlobalBin ( Int_t const *  axisBins,
Int_t isBelow = nullptr,
Int_t isAbove = nullptr 
) const
protected

get global bin number, given axis bin numbers

Parameters
[in]axisBins[]bin numbers on each axis
[out]isBelowindicates bins are in underflow but there is no undeflow bin
[out]isAboveindicates bins are in overflow but there is no overflow bin

return: global bin nuber or -1 if not matched.

Definition at line 1997 of file TUnfoldBinning.cxx.

◆ UpdateFirstLastBin()

Int_t TUnfoldBinning::UpdateFirstLastBin ( Bool_t  startWithRootNode = kTRUE)
protected

update fFirstBin and fLastBin members of this node and its children

Parameters
[in]startWithRootNodeif true, start the update with the root node

Definition at line 169 of file TUnfoldBinning.cxx.

Member Data Documentation

◆ childNode

TUnfoldBinning* TUnfoldBinning::childNode
protected

first daughter node

Definition at line 63 of file TUnfoldBinning.h.

◆ fAxisLabelList

TObjArray* TUnfoldBinning::fAxisLabelList
protected

for each axis its name (TObjString), or names of unconnected bins

Definition at line 71 of file TUnfoldBinning.h.

◆ fAxisList

TObjArray* TUnfoldBinning::fAxisList
protected

for each axis the bin borders (TVectorD)

Definition at line 69 of file TUnfoldBinning.h.

◆ fBinFactorConstant

Double_t TUnfoldBinning::fBinFactorConstant
protected

common scale factor for all bins of this node

Definition at line 85 of file TUnfoldBinning.h.

◆ fBinFactorFunction

TObject* TUnfoldBinning::fBinFactorFunction
protected

function to calculate a scale factor from bin centres (may be a TF1 or a TVectorD

Definition at line 83 of file TUnfoldBinning.h.

◆ fDistributionSize

Int_t TUnfoldBinning::fDistributionSize
protected

number of bins in this node's distribution

Definition at line 77 of file TUnfoldBinning.h.

◆ fFirstBin

Int_t TUnfoldBinning::fFirstBin
protected

global bin number of the first bin

Definition at line 79 of file TUnfoldBinning.h.

◆ fHasOverflow

Int_t TUnfoldBinning::fHasOverflow
protected

bit fields indicating whether there are overflow bins on the axes

Definition at line 75 of file TUnfoldBinning.h.

◆ fHasUnderflow

Int_t TUnfoldBinning::fHasUnderflow
protected

bit fields indicating whether there are underflow bins on the axes

Definition at line 73 of file TUnfoldBinning.h.

◆ fLastBin

Int_t TUnfoldBinning::fLastBin
protected

global bin number of the last(+1) bin, including daughters

Definition at line 81 of file TUnfoldBinning.h.

◆ nextNode

TUnfoldBinning* TUnfoldBinning::nextNode
protected

next sister

Definition at line 65 of file TUnfoldBinning.h.

◆ parentNode

TUnfoldBinning* TUnfoldBinning::parentNode
protected

mother node

Definition at line 61 of file TUnfoldBinning.h.

◆ prevNode

TUnfoldBinning* TUnfoldBinning::prevNode
protected

previous sister

Definition at line 67 of file TUnfoldBinning.h.

  • hist/unfold/inc/TUnfoldBinning.h
  • hist/unfold/src/TUnfoldBinning.cxx