An algorithm to unfold distributions from detector to truth level, with background subtraction and propagation of systematic uncertainties.
TUnfoldSys is used to decompose a measurement y into several sources x, given the measurement uncertainties, background b and a matrix of migrations A. The method can be applied to a large number of problems, where the measured distribution y is a linear superposition of several Monte Carlo shapes. Beyond such a simple template fit, TUnfoldSys has an adjustable regularisation term and also supports an optional constraint on the total number of events. Background sources can be specified, with a normalisation constant and normalisation uncertainty. In addition, variants of the response matrix may be specified, these are taken to determine systematic uncertainties.
For most applications, it is better to use the derived class TUnfoldDensity instead of TUnfoldSys. TUnfoldDensity adds features to TUnfoldSys, related to possible complex multidimensional arrangements of bins. For innocent users, the most notable improvement of TUnfoldDensity over TUnfoldSys are the getter functions. For TUnfoldSys, histograms have to be booked by the user and the getter functions fill the histogram bins. TUnfoldDensity simply returns a new, already filled histogram.
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
Brief recipy to use TUnfoldSys:
Description of (systematic) uncertainties available in TUnfoldSys. There are covariance matrix contributions and there are systematic shifts. Systematic shifts correspond to the variation of a (buicance) parameter, for example a background normalisation or a one-sigma variation of a correlated systematic error.
Set by | Access covariance matrix | Access vector of shifts | Description | |
---|---|---|---|---|
(a) | TUnfoldSys constructor | GetEmatrixSysUncorr() | n.a. | uncorrelated errors on the input matrix histA, taken as the errors provided with the histogram. These are typically statistical errors from finite Monte Carlo samples. |
(b) | AddSysError() | GetEmatrixSysSource() | GetDeltaSysSource() | correlated shifts of the input matrix histA. These shifts are taken as one-sigma effects when switchig on a given error soure. Several such error sources may be defined |
(c) | SetTauError() | GetEmatrixSysTau() | GetDeltaSysTau() | A systematic error on the regularisation parameter tau |
(d) | SubtractBackground() | GetEmatrixSysBackgroundUncorr() | n.a. | uncorrelated errors on background sources, originating from the errors provided with the background histograms |
(e) | SubtractBackground | GetEmatrixSysBackgroundScale() | GetDeltaSysBackgroundScale() | scale errors on background sources |
(i) | SetInput() | GetEmatrixInput() | n.a. | statistical uncertainty of the input (the measurement) |
(i)+(d)+(e) | see above | GetEmatrix() | n.a. | Partial sun of uncertainties: all sources which are propagated to the covariance before unfolding |
(i)+(a)+(b)+(c)+(d)+(e) | see above | GetEmatrixTotal() | n.a. | All known error sources summed up |
Note: (a), (b), (c) are propagated to the result AFTER unfolding, whereas the background errors (d) and (e) are added to the data errors BEFORE unfolding. For this reason the errors of type (d) and (e) are INCLUDED in the standard error matrix and other methods provided by the base class TUnfold, whereas errors of type (a), (b), (c) are NOT INCLUDED in the methods provided by the base class TUnfold.
Definition at line 59 of file TUnfoldSys.h.
Public Types | |
enum | ESysErrMode { kSysErrModeMatrix =0 , kSysErrModeShift =1 , kSysErrModeRelative =2 } |
type of matrix specified with AddSysError() More... | |
Public Types inherited from TUnfold | |
enum | EConstraint { kEConstraintNone =0 , kEConstraintArea =1 } |
type of extra constraint More... | |
enum | EHistMap { kHistMapOutputHoriz = 0 , kHistMapOutputVert = 1 } |
arrangement of axes for the response matrix (TH2 histogram) More... | |
enum | ERegMode { kRegModeNone = 0 , kRegModeSize = 1 , kRegModeDerivative = 2 , kRegModeCurvature = 3 , kRegModeMixed = 4 } |
choice of regularisation scheme More... | |
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 | |
TUnfoldSys (const TH2 *hist_A, EHistMap histmap, ERegMode regmode=kRegModeSize, EConstraint constraint=kEConstraintArea) | |
set up response matrix A, uncorrelated uncertainties of A and regularisation scheme | |
TUnfoldSys (void) | |
only for use by root streamer or derived classes | |
~TUnfoldSys (void) override | |
void | AddSysError (const TH2 *sysError, const char *name, EHistMap histmap, ESysErrMode mode) |
Specify a correlated systematic uncertainty. | |
void | GetBackground (TH1 *bgr, const char *bgrSource=nullptr, const Int_t *binMap=nullptr, Int_t includeError=3, Bool_t clearHist=kTRUE) const |
get background into a histogram | |
TSortedList * | GetBgrSources (void) const |
Get a new list of all background sources. | |
Double_t | GetChi2Sys (void) |
calculate total chi**2 including all systematic errors | |
Bool_t | GetDeltaSysBackgroundScale (TH1 *delta, const char *source, const Int_t *binMap=nullptr) |
correlated one-sigma shifts from background normalisation uncertainty | |
Bool_t | GetDeltaSysSource (TH1 *hist_delta, const char *source, const Int_t *binMap=nullptr) |
correlated one-sigma shifts correspinding to a given systematic uncertainty | |
Bool_t | GetDeltaSysTau (TH1 *delta, const Int_t *binMap=nullptr) |
correlated one-sigma shifts from shifting tau | |
void | GetEmatrixInput (TH2 *ematrix, const Int_t *binMap=nullptr, Bool_t clearEmat=kTRUE) |
covariance matrix contribution from input measurement uncertainties | |
void | GetEmatrixSysBackgroundScale (TH2 *ematrix, const char *source, const Int_t *binMap=nullptr, Bool_t clearEmat=kTRUE) |
covariance contribution from background normalisation uncertainty | |
void | GetEmatrixSysBackgroundUncorr (TH2 *ematrix, const char *source, const Int_t *binMap=nullptr, Bool_t clearEmat=kTRUE) |
covariance contribution from background uncorrelated uncertainty | |
void | GetEmatrixSysSource (TH2 *ematrix, const char *source, const Int_t *binMap=nullptr, Bool_t clearEmat=kTRUE) |
covariance contribution from a systematic variation of the response matrix | |
void | GetEmatrixSysTau (TH2 *ematrix, const Int_t *binMap=nullptr, Bool_t clearEmat=kTRUE) |
covariance matrix contribution from error on regularisation parameter | |
void | GetEmatrixSysUncorr (TH2 *ematrix, const Int_t *binMap=nullptr, Bool_t clearEmat=kTRUE) |
Covariance contribution from uncorrelated uncertainties of the response matrix. | |
void | GetEmatrixTotal (TH2 *ematrix, const Int_t *binMap=nullptr) |
Get total error matrix, summing up all contributions. | |
void | GetRhoItotal (TH1 *rhoi, const Int_t *binMap=nullptr, TH2 *invEmat=nullptr) |
Get global correlatiocn coefficients, summing up all contributions. | |
TSortedList * | GetSysSources (void) const |
Get a new list of all systematic uuncertainty sources. | |
TClass * | IsA () const override |
Int_t | SetInput (const TH1 *hist_y, Double_t scaleBias=0.0, Double_t oneOverZeroError=0.0, const TH2 *hist_vyy=nullptr, const TH2 *hist_vyy_inv=nullptr) override |
Define input data for subsequent calls to DoUnfold(tau) | |
void | SetTauError (Double_t delta_tau) |
Specify an uncertainty on tau. | |
void | Streamer (TBuffer &) override |
Stream an object of class TObject. | |
void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
void | SubtractBackground (const TH1 *hist_bgr, const char *name, Double_t scale=1.0, Double_t scale_error=0.0) |
Specify a source of background. | |
Public Member Functions inherited from TUnfold | |
TUnfold (const TH2 *hist_A, EHistMap histmap, ERegMode regmode=kRegModeSize, EConstraint constraint=kEConstraintArea) | |
Set up response matrix and regularisation scheme. | |
TUnfold (void) | |
only for use by root streamer or derived classes | |
~TUnfold (void) override | |
virtual Double_t | DoUnfold (Double_t tau) |
perform the unfolding for a given regularisation parameter tau | |
Double_t | DoUnfold (Double_t tau, const TH1 *hist_y, Double_t scaleBias=0.0) |
perform the unfolding for a given input and regularisation | |
void | GetBias (TH1 *bias, const Int_t *binMap=nullptr) const |
get bias vector including bias scale | |
Double_t | GetChi2A (void) const |
get χ2A contribution determined in recent unfolding | |
Double_t | GetChi2L (void) const |
get χ2L contribution determined in recent unfolding | |
double | GetDF (void) const |
return the effecive number of degrees of freedom See e.g. | |
void | GetDXDY (TH2 *dxdy) const |
get matrix connecting input and output changes | |
void | GetEmatrix (TH2 *ematrix, const Int_t *binMap=nullptr) const |
get output covariance matrix, possibly cumulated over several bins | |
Double_t | GetEpsMatrix (void) const |
get numerical accuracy for Eigenvalue analysis when inverting matrices with rank problems | |
void | GetFoldedOutput (TH1 *folded, const Int_t *binMap=nullptr) const |
get unfolding result on detector level | |
void | GetInput (TH1 *inputData, const Int_t *binMap=nullptr) const |
Input vector of measurements. | |
void | GetInputInverseEmatrix (TH2 *ematrix) |
get inverse of the measurement's covariance matrix | |
void | GetL (TH2 *l) const |
get matrix of regularisation conditions | |
virtual Double_t | GetLcurveX (void) const |
get value on x-axis of L-curve determined in recent unfolding | |
virtual Double_t | GetLcurveY (void) const |
get value on y-axis of L-curve determined in recent unfolding | |
void | GetLsquared (TH2 *lsquared) const |
get matrix of regularisation conditions squared | |
Int_t | GetNdf (void) const |
get number of degrees of freedom determined in recent unfolding | |
void | GetNormalisationVector (TH1 *s, const Int_t *binMap=nullptr) const |
histogram of truth bins, determined from suming over the response matrix | |
Int_t | GetNpar (void) const |
get number of truth parameters determined in recent unfolding | |
Int_t | GetNr (void) const |
get number of regularisation conditions | |
void | GetOutput (TH1 *output, const Int_t *binMap=nullptr) const |
get output distribution, possibly cumulated over several bins | |
void | GetProbabilityMatrix (TH2 *A, EHistMap histmap) const |
get matrix of probabilities | |
Double_t | GetRhoAvg (void) const |
get average global correlation determined in recent unfolding | |
Double_t | GetRhoI (TH1 *rhoi, const Int_t *binMap=nullptr, TH2 *invEmat=nullptr) const |
get global correlation coefficiencts, possibly cumulated over several bins | |
void | GetRhoIJ (TH2 *rhoij, const Int_t *binMap=nullptr) const |
get correlation coefficiencts, possibly cumulated over several bins | |
Double_t | GetRhoMax (void) const |
get maximum global correlation determined in recent unfolding | |
TVectorD | GetSqrtEvEmatrix (void) const |
double | GetSURE (void) const |
return Stein's unbiased risk estimator See e.g. | |
Double_t | GetTau (void) const |
return regularisation parameter | |
Int_t | RegularizeBins (int start, int step, int nbin, ERegMode regmode) |
add regularisation conditions for a group of bins | |
Int_t | RegularizeBins2D (int start_bin, int step1, int nbin1, int step2, int nbin2, ERegMode regmode) |
add regularisation conditions for 2d unfolding | |
Int_t | RegularizeCurvature (int left_bin, int center_bin, int right_bin, Double_t scale_left=1.0, Double_t scale_right=1.0) |
add a regularisation condition on the curvature of three truth bin | |
Int_t | RegularizeDerivative (int left_bin, int right_bin, Double_t scale=1.0) |
add a regularisation condition on the difference of two truth bin | |
Int_t | RegularizeSize (int bin, Double_t scale=1.0) |
add a regularisation condition on the magnitude of a truth bin | |
virtual Int_t | ScanLcurve (Int_t nPoint, Double_t tauMin, Double_t tauMax, TGraph **lCurve, TSpline **logTauX=nullptr, TSpline **logTauY=nullptr, TSpline **logTauCurvature=nullptr) |
scan the L curve, determine tau and unfold at the final value of tau | |
virtual Int_t | ScanSURE (Int_t nPoint, Double_t tauMin, Double_t tauMax, TGraph **logTauSURE=nullptr, TGraph **df_chi2A=nullptr, TGraph **lCurve=nullptr) |
minimize Stein's unbiased risk estimator "SURE" using successive calls to DoUnfold at various tau. | |
void | SetBias (const TH1 *bias) |
set bias vector | |
void | SetConstraint (EConstraint constraint) |
set type of area constraint | |
void | SetEpsMatrix (Double_t eps) |
set numerical accuracy for Eigenvalue analysis when inverting matrices with rank problems | |
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 | Clear (Option_t *="") |
virtual TObject * | Clone (const char *newname="") const |
Make a clone of an object using the Streamer facility. | |
virtual Int_t | Compare (const TObject *obj) const |
Compare abstract method. | |
virtual void | Copy (TObject &object) const |
Copy this to obj. | |
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 TObject * | DrawClone (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 TObject * | FindObject (const char *name) const |
Must be redefined in derived classes. | |
virtual TObject * | FindObject (const TObject *obj) const |
Must be redefined in derived classes. | |
virtual Option_t * | GetDrawOption () const |
Get option used by the graphics system to draw this object. | |
virtual const char * | GetIconName () const |
Returns mime type name of object. | |
virtual const char * | GetName () const |
Returns 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_t * | GetOption () const |
virtual const char * | GetTitle () const |
Returns title of object. | |
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. | |
virtual ULong_t | Hash () const |
Return hash value for this object. | |
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 |
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. | |
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) |
TObject & | operator= (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 void | Print (Option_t *option="") const |
This method must be overridden when a class wants to print itself. | |
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 TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
Static Public Member Functions inherited from TUnfold | |
static TClass * | Class () |
static const char * | Class_Name () |
static constexpr Version_t | Class_Version () |
static const char * | DeclFileName () |
static const char * | GetTUnfoldVersion (void) |
return a string describing the TUnfold version | |
Static Public Member Functions inherited from TObject | |
static TClass * | Class () |
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 | |
void | ClearResults (void) override |
Clear all data members which depend on the unfolding results. | |
void | DoBackgroundSubtraction (void) |
perform background subtraction | |
void | GetEmatrixFromVyy (const TMatrixDSparse *vyy, TH2 *ematrix, const Int_t *binMap, Bool_t clearEmat) |
propagate an error matrix on the input vector to the unfolding result | |
TMatrixDSparse * | GetSummedErrorMatrixXX (void) |
determine total error matrix on the vector x | |
TMatrixDSparse * | GetSummedErrorMatrixYY (void) |
determine total error matrix on the vector Ax | |
virtual TMatrixDSparse * | PrepareCorrEmat (const TMatrixDSparse *m1, const TMatrixDSparse *m2, const TMatrixDSparse *dsys) |
propagate correlated systematic shift to an output vector | |
virtual void | PrepareSysError (void) |
Matrix calculations required to propagate systematic errors. | |
virtual TMatrixDSparse * | PrepareUncorrEmat (const TMatrixDSparse *m1, const TMatrixDSparse *m2) |
propagate uncorrelated systematic errors to a covariance matrix | |
void | ScaleColumnsByVector (TMatrixDSparse *m, const TMatrixTBase< Double_t > *v) const |
scale columns of a matrix by the corresponding rows of a vector | |
void | VectorMapToHist (TH1 *hist_delta, const TMatrixDSparse *delta, const Int_t *binMap) |
map delta to hist_delta, possibly summing up bins | |
Protected Member Functions inherited from TUnfold | |
void | AddMSparse (TMatrixDSparse *dest, Double_t f, const TMatrixDSparse *src) const |
add a sparse matrix, scaled by a factor, to another scaled matrix | |
Bool_t | AddRegularisationCondition (Int_t i0, Double_t f0, Int_t i1=-1, Double_t f1=0., Int_t i2=-1, Double_t f2=0.) |
add a row of regularisation conditions to the matrix L | |
Bool_t | AddRegularisationCondition (Int_t nEle, const Int_t *indices, const Double_t *rowData) |
add a row of regularisation conditions to the matrix L | |
void | ClearHistogram (TH1 *h, Double_t x=0.) const |
Initialize bin contents and bin errors for a given histogram. | |
TMatrixDSparse * | CreateSparseMatrix (Int_t nrow, Int_t ncol, Int_t nele, Int_t *row, Int_t *col, Double_t *data) const |
create a sparse matrix, given the nonzero elements | |
virtual Double_t | DoUnfold (void) |
core unfolding algorithm | |
void | ErrorMatrixToHist (TH2 *ematrix, const TMatrixDSparse *emat, const Int_t *binMap, Bool_t doClear) const |
add up an error matrix, also respecting the bin mapping | |
const TMatrixDSparse * | GetAx (void) const |
vector of folded-back result | |
Int_t | GetBinFromRow (int ix) const |
converts matrix row to truth histogram bin number | |
const TMatrixDSparse * | GetDXDAM (int i) const |
matrix contributions of the derivative dx/dA | |
const TMatrixDSparse * | GetDXDAZ (int i) const |
vector contributions of the derivative dx/dA | |
const TMatrixDSparse * | GetDXDtauSquared (void) const |
vector of derivative dx/dtauSquared, using internal bin counting | |
const TMatrixDSparse * | GetDXDY (void) const |
matrix of derivatives dx/dy | |
const TMatrixDSparse * | GetE (void) const |
matrix E, using internal bin counting | |
const TMatrixDSparse * | GetEinv (void) const |
matrix E-1, using internal bin counting | |
Int_t | GetNx (void) const |
returns internal number of output (truth) matrix rows | |
Int_t | GetNy (void) const |
returns the number of measurement bins | |
virtual TString | GetOutputBinName (Int_t iBinX) const |
Get bin name of an outpt bin. | |
Double_t | GetRhoIFromMatrix (TH1 *rhoi, const TMatrixDSparse *eOrig, const Int_t *binMap, TH2 *invEmat) const |
Int_t | GetRowFromBin (int ix) const |
converts truth histogram bin number to matrix row | |
const TMatrixDSparse * | GetVxx (void) const |
covariance matrix of the result | |
const TMatrixDSparse * | GetVxxInv (void) const |
inverse of covariance matrix of the result | |
const TMatrixDSparse * | GetVyyInv (void) const |
inverse of covariance matrix of the data y | |
const TMatrixD * | GetX (void) const |
vector of the unfolding result | |
TMatrixDSparse * | InvertMSparseSymmPos (const TMatrixDSparse *A, Int_t *rank) const |
get the inverse or pseudo-inverse of a positive, sparse matrix | |
TMatrixDSparse * | MultiplyMSparseM (const TMatrixDSparse *a, const TMatrixD *b) const |
multiply sparse matrix and a non-sparse matrix | |
TMatrixDSparse * | MultiplyMSparseMSparse (const TMatrixDSparse *a, const TMatrixDSparse *b) const |
multiply two sparse matrices | |
TMatrixDSparse * | MultiplyMSparseMSparseTranspVector (const TMatrixDSparse *m1, const TMatrixDSparse *m2, const TMatrixTBase< Double_t > *v) const |
calculate a sparse matrix product M1*V*M2T where the diagonal matrix V is given by a vector | |
TMatrixDSparse * | MultiplyMSparseTranspMSparse (const TMatrixDSparse *a, const TMatrixDSparse *b) const |
multiply a transposed Sparse matrix with another Sparse matrix | |
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 | |
TMatrixD * | fAoutside |
Input: underflow/overflow bins. | |
TMap * | fBgrErrScaleIn |
Input: background sources correlated error. | |
TMap * | fBgrErrUncorrInSq |
Input: uncorr error squared from bgr sources. | |
TMap * | fBgrIn |
Input: size of background sources. | |
TMatrixD * | fDAinColRelSq |
Input: normalized column err.sq. (inp.matr.) | |
TMatrixDSparse * | fDAinRelSq |
Input: normalized errors from input matrix. | |
TMap * | fDeltaCorrAx |
Result: syst.shift from fSysIn on fAx. | |
TMap * | fDeltaCorrX |
Result: syst.shift from fSysIn on fX. | |
TMatrixDSparse * | fDeltaSysTau |
Result: systematic shift from tau. | |
Double_t | fDtau |
Input: error on tau. | |
TMatrixDSparse * | fEmatUncorrAx |
Result: syst.error from fDA2 on fAx. | |
TMatrixDSparse * | fEmatUncorrX |
Result: syst.error from fDA2 on fX. | |
TMap * | fSysIn |
Input: correlated errors. | |
TMatrixDSparse * | fVyyData |
Input: error on fY prior to bgr subtraction. | |
TMatrixD * | fYData |
Input: fY prior to bgr subtraction. | |
Protected Attributes inherited from TUnfold | |
TMatrixDSparse * | fA |
response matrix A | |
Double_t | fBiasScale |
scale factor for the bias | |
EConstraint | fConstraint |
type of constraint to use for the unfolding | |
TArrayI | fHistToX |
mapping of histogram bins to matrix indices | |
TMatrixDSparse * | fL |
regularisation conditions L | |
ERegMode | fRegMode |
type of regularisation | |
TArrayD | fSumOverY |
truth vector calculated from the non-normalized response matrix | |
Double_t | fTauSquared |
regularisation parameter tau squared | |
TMatrixDSparse * | fVyy |
covariance matrix Vyy corresponding to y | |
TMatrixD * | fX0 |
bias vector x0 | |
TArrayI | fXToHist |
mapping of matrix indices to histogram bins | |
TMatrixD * | fY |
input (measured) data y | |
Private Member Functions | |
void | InitTUnfoldSys (void) |
Additional Inherited Members | |
Protected Types inherited from TObject | |
enum | { kOnlyPrepStep = (1ULL << ( 3 )) } |
Static Protected Member Functions inherited from TUnfold | |
static void | DeleteMatrix (TMatrixD **m) |
delete matrix and invalidate pointer | |
static void | DeleteMatrix (TMatrixDSparse **m) |
delete sparse matrix and invalidate pointer | |
#include <TUnfoldSys.h>
type of matrix specified with AddSysError()
Definition at line 106 of file TUnfoldSys.h.
TUnfoldSys::TUnfoldSys | ( | const TH2 * | hist_A, |
EHistMap | histmap, | ||
ERegMode | regmode = kRegModeSize , |
||
EConstraint | constraint = kEConstraintArea |
||
) |
set up response matrix A, uncorrelated uncertainties of A and regularisation scheme
[in] | hist_A | matrix that describes the migrations |
[in] | histmap | mapping of the histogram axes to the unfolding output |
[in] | regmode | (default=kRegModeSize) global regularisation mode |
[in] | constraint | (default=kEConstraintArea) type of constraint |
For further details, consult the constructir of the class TUnfold. The uncertainties of hist_A are taken to be uncorrelated and aper propagated to the unfolding result, method GetEmatrixSysUncorr().
Definition at line 203 of file TUnfoldSys.cxx.
TUnfoldSys::TUnfoldSys | ( | void | ) |
only for use by root streamer or derived classes
Definition at line 185 of file TUnfoldSys.cxx.
|
override |
Definition at line 166 of file TUnfoldSys.cxx.
void TUnfoldSys::AddSysError | ( | const TH2 * | sysError, |
const char * | name, | ||
EHistMap | histmap, | ||
ESysErrMode | mode | ||
) |
Specify a correlated systematic uncertainty.
[in] | sysError | alternative matrix or matrix of absolute/relative shifts |
[in] | name | identifier of the error source |
[in] | histmap | mapping of the histogram axes |
[in] | mode | format of the error source |
sysError corresponds to a one-sigma variation. If may be given in various forms, specified by mode
Internally, all three cases are transformed to the case mode=kSysErrModeMatrix.
Definition at line 292 of file TUnfoldSys.cxx.
|
static |
|
inlinestaticconstexpr |
Definition at line 146 of file TUnfoldSys.h.
|
overrideprotectedvirtual |
Clear all data members which depend on the unfolding results.
Reimplemented from TUnfold.
Definition at line 650 of file TUnfoldSys.cxx.
|
inlinestatic |
Definition at line 146 of file TUnfoldSys.h.
|
protected |
perform background subtraction
This prepares the data members for the base class TUnfold, such that the background is properly taken into account.
Definition at line 377 of file TUnfoldSys.cxx.
void TUnfoldSys::GetBackground | ( | TH1 * | bgrHist, |
const char * | bgrSource = nullptr , |
||
const Int_t * | binMap = nullptr , |
||
Int_t | includeError = 3 , |
||
Bool_t | clearHist = kTRUE |
||
) | const |
get background into a histogram
[in,out] | bgrHist | target histogram, content and errors will be altered |
[in] | bgrSource | (default=nullptr) name of backgrond source or zero to add all sources of background |
[in] | binMap | (default=nullptr) remap histogram bins |
[in] | includeError | (default=3) include uncorrelated(1), correlated (2) or both (3) sources of uncertainty in the histogram errors |
[in] | clearHist | (default=true) reset histogram before adding up the specified background sources |
the array binMap is explained with the method GetOutput(). The flag clearHist may be used to add background from several sources in successive calls to GetBackground().
Definition at line 565 of file TUnfoldSys.cxx.
TSortedList * TUnfoldSys::GetBgrSources | ( | void | ) | const |
Get a new list of all background sources.
The user is responsible for deleting the list get list of name of background sources
Definition at line 1528 of file TUnfoldSys.cxx.
Double_t TUnfoldSys::GetChi2Sys | ( | void | ) |
calculate total chi**2 including all systematic errors
Definition at line 1366 of file TUnfoldSys.cxx.
Bool_t TUnfoldSys::GetDeltaSysBackgroundScale | ( | TH1 * | hist_delta, |
const char * | source, | ||
const Int_t * | binMap = nullptr |
||
) |
correlated one-sigma shifts from background normalisation uncertainty
[out] | hist_delta | histogram to store shifts |
[in] | source | identifier of the background source |
[in] | binMap | (default=nullptr) remapping of histogram bins |
returns true if the background source was found.
This method returns the shifts of the unfolding result induced by varying the normalisation of the identified background by one sigma.
the array binMap is explained with the method GetOutput().
Definition at line 1054 of file TUnfoldSys.cxx.
Bool_t TUnfoldSys::GetDeltaSysSource | ( | TH1 * | hist_delta, |
const char * | name, | ||
const Int_t * | binMap = nullptr |
||
) |
correlated one-sigma shifts correspinding to a given systematic uncertainty
[out] | hist_delta | histogram to store shifts |
[in] | name | identifier of the background source |
[in] | binMap | (default=nullptr) remapping of histogram bins |
returns true if the error source was found.
This method returns the shifts of the unfolding result induced by varying the identified systematic source by one sigma.
the array binMap is explained with the method GetOutput().
Definition at line 1027 of file TUnfoldSys.cxx.
correlated one-sigma shifts from shifting tau
[out] | hist_delta | histogram to store shifts |
[in] | source | identifier of the background source |
[in] | binMap | (default=nullptr) remapping of histogram bins |
returns true if the background source was found.
This method returns the shifts of the unfolding result induced by varying the normalisation of the identified background by one sigma.
the array binMap is explained with the method GetOutput().
Definition at line 1086 of file TUnfoldSys.cxx.
|
protected |
propagate an error matrix on the input vector to the unfolding result
[in] | vyy | input error matrix |
[in,out] | ematrix | histogram to be updated |
[in] | binMap | mapping of histogram bins |
[in] | clearEmat | if set, clear histogram before adding this covariance contribution |
Definition at line 1250 of file TUnfoldSys.cxx.
void TUnfoldSys::GetEmatrixInput | ( | TH2 * | ematrix, |
const Int_t * | binMap = nullptr , |
||
Bool_t | clearEmat = kTRUE |
||
) |
covariance matrix contribution from input measurement uncertainties
[in,out] | ematrix | output histogram |
[in] | binMap | (default=nullptr) remapping of histogram bins |
[in] | clearEmat | (default=true) if true, clear the histogram |
this method returns the covariance contributions to the unfolding result from the uncertainties or covariance of the input data. In many cases, these are the "statistical uncertainties".
The array binMap is explained with the method GetOutput(). The flag clearEmat may be used to add covariance matrices from several uncertainty sources.
Definition at line 1207 of file TUnfoldSys.cxx.
void TUnfoldSys::GetEmatrixSysBackgroundScale | ( | TH2 * | ematrix, |
const char * | name, | ||
const Int_t * | binMap = nullptr , |
||
Bool_t | clearEmat = kTRUE |
||
) |
covariance contribution from background normalisation uncertainty
[in,out] | ematrix | output histogram |
[in] | source | identifier of the background source |
[in] | binMap | (default=nullptr) remapping of histogram bins |
[in] | clearEmat | (default=true) if true, clear the histogram prior to adding the covariance matrix contribution |
this method returns the uncertainties on the unfolding result arising from the background source source and its normalisation uncertainty. See method SubtractBackground() how to set the normalisation uncertainty
the array binMap is explained with the method GetOutput(). The flag clearEmat may be used to add covariance matrices from several uncertainty sources.
Definition at line 1144 of file TUnfoldSys.cxx.
void TUnfoldSys::GetEmatrixSysBackgroundUncorr | ( | TH2 * | ematrix, |
const char * | source, | ||
const Int_t * | binMap = nullptr , |
||
Bool_t | clearEmat = kTRUE |
||
) |
covariance contribution from background uncorrelated uncertainty
[in] | ematrix | output histogram |
[in] | source | identifier of the background source |
[in] | binMap | (default=nullptr) remapping of histogram bins |
[in] | clearEmat | (default=true) if true, clear the histogram |
this method returns the covariance contributions to the unfolding result arising from the background source source and the uncorrelated (background histogram uncertainties). Also see method SubtractBackground()
the array binMap is explained with the method GetOutput(). The flag clearEmat may be used to add covariance matrices from several uncertainty sources.
Definition at line 1229 of file TUnfoldSys.cxx.
void TUnfoldSys::GetEmatrixSysSource | ( | TH2 * | ematrix, |
const char * | name, | ||
const Int_t * | binMap = nullptr , |
||
Bool_t | clearEmat = kTRUE |
||
) |
covariance contribution from a systematic variation of the response matrix
[in,out] | ematrix | covariance matrix histogram |
[in] | name | identifier of the systematic variation |
[in] | binMap | (default=nullptr) remapping of histogram bins |
[in] | clearEmat | (default=true) if true, clear the histogram prior to adding the covariance matrix contribution |
Returns the covariance matrix contribution from shifting the given uncertainty source within one sigma
the array binMap is explained with the method GetOutput(). The flag clearEmat may be used to add covariance matrices from several uncertainty sources.
Definition at line 1113 of file TUnfoldSys.cxx.
void TUnfoldSys::GetEmatrixSysTau | ( | TH2 * | ematrix, |
const Int_t * | binMap = nullptr , |
||
Bool_t | clearEmat = kTRUE |
||
) |
covariance matrix contribution from error on regularisation parameter
[in,out] | ematrix | output histogram |
[in] | binMap | (default=nullptr) remapping of histogram bins |
[in] | clearEmat | (default=true) if true, clear the histogram |
this method returns the covariance contributions to the unfolding result from the assigned uncertainty on the parameter tau, see method SetTauError().
the array binMap is explained with the method GetOutput(). The flag clearEmat may be used to add covariance matrices from several uncertainty sources.
Definition at line 1176 of file TUnfoldSys.cxx.
void TUnfoldSys::GetEmatrixSysUncorr | ( | TH2 * | ematrix, |
const Int_t * | binMap = nullptr , |
||
Bool_t | clearEmat = kTRUE |
||
) |
Covariance contribution from uncorrelated uncertainties of the response matrix.
[in,out] | ematrix | covariance matrix histogram |
[in] | binMap | mapping of histogram bins |
[in] | clearEmat | if true, ematrix is cleared prior to adding this covariance matrix contribution |
This method propagates the uncertainties of the response matrix histogram, specified with the constructor, to the unfolding result. It is assumed that the entries of that histogram are bin-to-bin uncorrelated. In many cases this corresponds to the "Monte Carlo statistical uncertainties".
The array binMap is explained with the method GetOutput(). The flag clearEmat may be used to add covariance matrices from several uncertainty sources.
Definition at line 760 of file TUnfoldSys.cxx.
Get total error matrix, summing up all contributions.
[out] | ematrix | histogram which will be filled |
[in] | binMap | (default=nullptr) remapping of histogram bins |
the array binMap is explained with the method GetOutput().
Definition at line 1276 of file TUnfoldSys.cxx.
void TUnfoldSys::GetRhoItotal | ( | TH1 * | rhoi, |
const Int_t * | binMap = nullptr , |
||
TH2 * | invEmat = nullptr |
||
) |
Get global correlatiocn coefficients, summing up all contributions.
[out] | rhoi | histogram which will be filled |
[in] | binMap | (default=nullptr) remapping of histogram bins |
[out] | invEmat | (default=nullptr) inverse of error matrix |
return the global correlation coefficients, including all error sources. If invEmat is nonzero, the inverse of the error matrix is returned in that histogram
the array binMap is explained with the method GetOutput().
Definition at line 1401 of file TUnfoldSys.cxx.
|
protected |
determine total error matrix on the vector x
Definition at line 1331 of file TUnfoldSys.cxx.
|
protected |
determine total error matrix on the vector Ax
Definition at line 1296 of file TUnfoldSys.cxx.
TSortedList * TUnfoldSys::GetSysSources | ( | void | ) | const |
Get a new list of all systematic uuncertainty sources.
The user is responsible for deleting the list
Definition at line 1512 of file TUnfoldSys.cxx.
|
private |
Definition at line 618 of file TUnfoldSys.cxx.
|
inlineoverridevirtual |
Reimplemented from TUnfold.
Definition at line 146 of file TUnfoldSys.h.
|
protectedvirtual |
propagate correlated systematic shift to an output vector
[in] | m1 | coefficients |
[in] | m2 | coeffiicients |
[in] | dsys | matrix of correlated shifts from this source |
Definition at line 977 of file TUnfoldSys.cxx.
|
protectedvirtual |
Matrix calculations required to propagate systematic errors.
Definition at line 663 of file TUnfoldSys.cxx.
|
protectedvirtual |
propagate uncorrelated systematic errors to a covariance matrix
[in] | m_0 | coefficients for error propagation |
[in] | m_1 | coefficients for error propagation |
returns the covariance matrix
Definition at line 777 of file TUnfoldSys.cxx.
|
protected |
scale columns of a matrix by the corresponding rows of a vector
the entries mij are multiplied by vj.
Definition at line 1423 of file TUnfoldSys.cxx.
|
overridevirtual |
Define input data for subsequent calls to DoUnfold(tau)
[in] | input | input distribution with uncertainties |
[in] | scaleBias | (default=nullptr) scale factor applied to the bias |
[in] | oneOverZeroError | (default=nullptr) for bins with zero error, this number defines 1/error. |
[in] | hist_vyy | (default=nullptr) if non-zero, this defines the data covariance matrix |
[in] | hist_vyy_inv | (default=nullptr) if non-zero and hist_vyy is set, defines the inverse of the data covariance matrix. This feature can be useful for repeated unfoldings in cases where the inversion of the input covariance matrix is lengthy |
Return value: nError1+10000*nError2
Reimplemented from TUnfold.
Definition at line 466 of file TUnfoldSys.cxx.
void TUnfoldSys::SetTauError | ( | Double_t | delta_tau | ) |
Specify an uncertainty on tau.
[in] | delta_tau | new uncertainty on tau |
The default is to have no uncertyainty on tau.
Definition at line 1007 of file TUnfoldSys.cxx.
|
overridevirtual |
|
inline |
Definition at line 146 of file TUnfoldSys.h.
void TUnfoldSys::SubtractBackground | ( | const TH1 * | bgr, |
const char * | name, | ||
Double_t | scale = 1.0 , |
||
Double_t | scale_error = 0.0 |
||
) |
Specify a source of background.
[in] | bgr | background distribution with uncorrelated errors |
[in] | name | identifier for this background source |
[in] | scale | normalisation factor applied to the background |
[in] | scaleError | normalisation uncertainty |
The contribution scale*bgr is subtracted from the measurement prior to unfolding. The following contributions are added to the input covarianc ematrix
Definition at line 515 of file TUnfoldSys.cxx.
|
protected |
map delta to hist_delta, possibly summing up bins
[out] | hist_delta | result histogram |
[in] | delta | vector to be mapped to the histogram |
[in] | binMap | mapping of histogram bins |
grooups of bins of delta are mapped to bins of hist_delta. The histogram contents are set to the sum over the group of bins. The histogram errors are reset to zero.
The array binMap is explained with the method GetOutput()
Definition at line 1475 of file TUnfoldSys.cxx.
|
protected |
Input: underflow/overflow bins.
Definition at line 68 of file TUnfoldSys.h.
|
protected |
Input: background sources correlated error.
Definition at line 76 of file TUnfoldSys.h.
|
protected |
Input: uncorr error squared from bgr sources.
Definition at line 74 of file TUnfoldSys.h.
|
protected |
Input: size of background sources.
Definition at line 72 of file TUnfoldSys.h.
|
protected |
Input: normalized column err.sq. (inp.matr.)
Definition at line 66 of file TUnfoldSys.h.
|
protected |
Input: normalized errors from input matrix.
Definition at line 64 of file TUnfoldSys.h.
|
protected |
Result: syst.shift from fSysIn on fAx.
Definition at line 90 of file TUnfoldSys.h.
|
protected |
Result: syst.shift from fSysIn on fX.
Definition at line 88 of file TUnfoldSys.h.
|
protected |
Result: systematic shift from tau.
Definition at line 92 of file TUnfoldSys.h.
|
protected |
Input: error on tau.
Definition at line 78 of file TUnfoldSys.h.
|
protected |
Result: syst.error from fDA2 on fAx.
Definition at line 86 of file TUnfoldSys.h.
|
protected |
Result: syst.error from fDA2 on fX.
Definition at line 84 of file TUnfoldSys.h.
|
protected |
Input: correlated errors.
Definition at line 70 of file TUnfoldSys.h.
|
protected |
Input: error on fY prior to bgr subtraction.
Definition at line 82 of file TUnfoldSys.h.
|
protected |
Input: fY prior to bgr subtraction.
Definition at line 80 of file TUnfoldSys.h.