ROOT logo
ROOT » HIST » HIST » TUnfoldSys

class TUnfoldSys: public TUnfold


 TUnfoldSys adds error propagation of systematic errors to TUnfold
 Also, background sources (with errors) can be subtracted.

 The following sources of systematic error are considered:
  (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) 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) a systematic error on the regularisation parameter tau

  (d) uncorrelated errors on background sources, taken as the errors
      provided with the background histograms

  (e) scale errors on background sources


 Source (a) is providede with the original histogram histA
     TUnfoldSys(histA,...)

 Sources (b) are added by calls to
     AddSysError()

 The systematic uncertainty on tau (c) is set by
     SetTauError()

 Backgound sources causing errors of type (d) and (e) are added by
     SubtractBackground()


 NOTE:

    Systematic errors (a), (b), (c) are propagated to the result
       AFTER unfolding

    Background errors (d) and (e) are added to the data errors
       BEFORE unfolding

 For this reason:
  errors of type (d) and (e) are INCLUDED in the standard error matrix
  and other methods provided by the base class TUnfold:
      GetOutput()
      GetEmatrix()

  whereas errors of type (a), (b), (c) are NOT INCLUDED in the methods
  provided by the base class TUnfold.

 Accessing error matrices:

  The error sources (b),(c) and (e) propagate to shifts of the result.
  These shifts may be accessed as histograms using the methods
     GetDeltaSysSource()            corresponds to (b)
     GetDeltaSysTau()               corresponds to (c)
     GetDeltaSysBackgroundScale()   corresponds to (e)
  The error sources (a) and (d) originate from many uncorrelated errors,
  which in general ar NOT uncorrelated on the result vector.
  Thus, there is no corresponding shift of the output vector, only error
  matrices are available

  Method to get error matrix       corresponds to error sources

   GetEmatrixSysUncorr()             (a)
   GetEmatrixSysSource()             (b)
   GetEmatrixSysTau()                (c)
   GetEmatrixSysBackgroundUncorr()   (d)
   GetEmatrixSysBackgroundScale()    (e)
   GetEmatrixInput()                 (0)
   GetEmatrix()                      (0)+(d)+(e)
   GetEmatrixTotal()                 (0)+(a)+(b)+(c)+(d)+(e)

 Example:

    TH2D *histA,*histAsys1,*histAsys2,*histBgr1,*histBgr2;
    TH1D *data;
  assume the above histograms are filled:
      histA: migration matrix from generator (x-axis) to detector (y-axis)
           the errors of histA are the uncorrelated systematic errors
      histAsys1: alternative migration matrix, when systematic #1 is applied
      histAsys1: alternative migration matrix, when systematic #2 is applied
      histBgr: known background to the data, with errors

  set up the unfolding:

    TUnfoldSys unfold(histA,TUnfold::kHistMapOutputVert);
    unfold.SetInput(input);
     // this background has 5% scale uncertainty
    unfold.SubtractBackground(histBgr1,"bgr1",1.0,0.05);
     // this background is scaled by 0.8 and has 10% scale uncertainty
    unfold.SubtractBackground(histBgr2,"bgr2",0.8,0.1);
    unfold.AddSysError(histAsys1,"syserror1",TUnfold::kHistMapOutputVert,
                       TUnfoldSys::kSysErrModeMatrix);
    unfold.AddSysError(histAsys2,"syserror2",TUnfold::kHistMapOutputVert,
                       TUnfoldSys::kSysErrModeMatrix);


  run the unfolding: see description of class TUnfold
    unfold.ScanLcurve( ...)

  retrieve the output
  the errors include errors from input, from histBgr1 and from histBgr2
    unfold.GetOutput(output);

  retreive systematic shifts corresponding to correlated error sources
  In the example, there are 4 correlated sources:
     * 5% scale error on bgr1
     * 10% scale error on bgr2
     * the systematic error  "syserror1"
     * the systematic error  "syserror2"
  These error s are returned as vectors
  (corresponding to one-sigma shifts of each source)

   unfold.GetDeltaSysBackgroundScale(bgr1shifts,"bgr1");
   unfold.GetDeltaSysBackgroundScale(bgr2shifts,"bgr2");
   unfold.GetDeltaSysSource(sys1shifts,"syserror1");
   unfold.GetDeltaSysSource(sys2shifts,"syserror2");

  retreive errors from uncorrelated sources
  In the example, there are four sources of uncorrelated error
     * the input vector (statistical errors of the data)
     * the input matrix histA (Monte Carlo statistical errors)
     * the errors on bgr1 (Monte Carlo statistical errors)
     * the errors on bgr2 (Monte Carlo statistical errors)
  These errors are returned as error matrices

    unfold.GetEmatrixInput(stat_error);
    unfold.GetEmatrixSysUncorr(uncorr_sys);
    unfold.GetEmatrixSysBackgroundUncorr(bgr1uncorr,"bgr1");
    unfold.GetEmatrixSysBackgroundUncorr(bgr2uncorr,"bgr2");

  Error matrices can be added to existing histograms.
  This is useful to retreive the sum of several error matrices.
  If the last argument of the .GetEmatrixXXX methods is set to kFALSE, the
  histogram is not cleared, but the error matrix is simply added.
  Example: add all errors from background subtraction

     unfold.GetEmatrixSysBackgroundUncorr(bgrerror,"bgr1",0,kTRUE);
     unfold.GetEmatrixSysBackgroundCorr(bgrerror,"bgr1",0,kFALSE);
     unfold.GetEmatrixSysBackgroundUncorr(bgrerror,"bgr2",0,kFALSE);
     unfold.GetEmatrixSysBackgroundCorr(bgrerror,"bgr2",0,kFALSE);

  There is a special function to get the total error:
    unfold.GetEmatrixTotal(err_total);


Function Members (Methods)

public:
TUnfoldSys(const TUnfoldSys&)
TUnfoldSys(const TH2* hist_A, TUnfold::EHistMap histmap, TUnfold::ERegMode regmode = kRegModeSize, TUnfold::EConstraint constraint = kEConstraintNone)
virtual~TUnfoldSys()
voidTObject::AbstractMethod(const char* method) const
voidAddSysError(const TH2* sysError, const char* name, TUnfold::EHistMap histmap, TUnfoldSys::ESysErrMode mode)
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual Double_tTUnfold::DoUnfold(Double_t tau)
Double_tTUnfold::DoUnfold(Double_t tau, const TH1* hist_y, Double_t scaleBias = 0.0)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
TH1D*TUnfold::GetBias(const char* name, const char* title, Double_t x0 = 0.0, Double_t x1 = 0.0) const
Double_tTUnfold::GetChi2A() const
Double_tTUnfold::GetChi2L() const
Double_tGetChi2Sys()
voidGetDeltaSysBackgroundScale(TH1* delta, const char* source, const Int_t* binMap = 0)
voidGetDeltaSysSource(TH1* hist_delta, const char* source, const Int_t* binMap = 0)
voidGetDeltaSysTau(TH1* delta, const Int_t* binMap = 0)
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
voidTUnfold::GetEmatrix(TH2* ematrix, const Int_t* binMap = 0) const
TH2D*TUnfold::GetEmatrix(const char* name, const char* title, Double_t x0 = 0.0, Double_t x1 = 0.0) const
voidGetEmatrixInput(TH2* ematrix, const Int_t* binMap = 0, Bool_t clearEmat = kTRUE)
voidGetEmatrixSysBackgroundScale(TH2* ematrix, const char* source, const Int_t* binMap = 0, Bool_t clearEmat = kTRUE)
voidGetEmatrixSysBackgroundUncorr(TH2* ematrix, const char* source, const Int_t* binMap = 0, Bool_t clearEmat = kTRUE)
voidGetEmatrixSysSource(TH2* ematrix, const char* source, const Int_t* binMap = 0, Bool_t clearEmat = kTRUE)
voidGetEmatrixSysTau(TH2* ematrix, const Int_t* binMap = 0, Bool_t clearEmat = kTRUE)
voidGetEmatrixSysUncorr(TH2* ematrix, const Int_t* binMap = 0, Bool_t clearEmat = kTRUE)
voidGetEmatrixTotal(TH2* ematrix, const Int_t* binMap = 0)
TH1D*TUnfold::GetFoldedOutput(const char* name, const char* title, Double_t y0 = 0.0, Double_t y1 = 0.0) const
virtual const char*TObject::GetIconName() const
TH1D*TUnfold::GetInput(const char* name, const char* title, Double_t y0 = 0.0, Double_t y1 = 0.0) const
virtual Double_tTUnfold::GetLcurveX() const
virtual Double_tTUnfold::GetLcurveY() const
TH2D*TUnfold::GetLsquared(const char* name, const char* title, Double_t x0 = 0.0, Double_t x1 = 0.0) const
virtual const char*TObject::GetName() const
Int_tTUnfold::GetNdf() const
Int_tTUnfold::GetNpar() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
voidTUnfold::GetOutput(TH1* output, const Int_t* binMap = 0) const
TH1D*TUnfold::GetOutput(const char* name, const char* title, Double_t x0 = 0.0, Double_t x1 = 0.0) const
Double_tTUnfold::GetRhoAvg() const
Double_tTUnfold::GetRhoI(TH1* rhoi, TH2* ematrixinv = 0, const Int_t* binMap = 0) const
TH1D*TUnfold::GetRhoI(const char* name, const char* title, Double_t x0 = 0.0, Double_t x1 = 0.0) const
voidTUnfold::GetRhoIJ(TH2* rhoij, const Int_t* binMap = 0) const
TH2D*TUnfold::GetRhoIJ(const char* name, const char* title, Double_t x0 = 0.0, Double_t x1 = 0.0) const
Double_tTUnfold::GetRhoMax() const
Double_tTUnfold::GetTau() const
virtual const char*TObject::GetTitle() const
static const char*TUnfold::GetTUnfoldVersion()
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTObject::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TUnfoldSys&operator=(const TUnfoldSys&)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
Int_tTUnfold::RegularizeBins(int start, int step, int nbin, TUnfold::ERegMode regmode)
Int_tTUnfold::RegularizeBins2D(int start_bin, int step1, int nbin1, int step2, int nbin2, TUnfold::ERegMode regmode)
Int_tTUnfold::RegularizeCurvature(int left_bin, int center_bin, int right_bin, Double_t scale_left = 1.0, Double_t scale_right = 1.0)
Int_tTUnfold::RegularizeDerivative(int left_bin, int right_bin, Double_t scale = 1.0)
Int_tTUnfold::RegularizeSize(int bin, Double_t scale = 1.0)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
virtual Int_tTUnfold::ScanLcurve(Int_t nPoint, Double_t tauMin, Double_t tauMax, TGraph** lCurve, TSpline** logTauX = 0, TSpline** logTauY = 0)
voidTUnfold::SetBias(const TH1* bias)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidTUnfold::SetConstraint(TUnfold::EConstraint constraint)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual Int_tSetInput(const TH1* hist_y, Double_t scaleBias = 0.0, Double_t oneOverZeroError = 0.0)
static voidTObject::SetObjectStat(Bool_t stat)
voidSetTauError(Double_t delta_tau)
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
voidSubtractBackground(const TH1* hist_bgr, const char* name, Double_t scale = 1.0, Double_t scale_error = 0.0)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
TUnfoldSys()
voidTUnfold::AddMSparse(TMatrixDSparse* dest, Double_t f, const TMatrixDSparse* src)
virtual voidClearResults()
TMatrixDSparse*TUnfold::CreateSparseMatrix(Int_t nrow, Int_t ncol, Int_t nele, Int_t* row, Int_t* col, Double_t* data) const
static voidTUnfold::DeleteMatrix(TMatrixD** m)
static voidTUnfold::DeleteMatrix(TMatrixDSparse** m)
voidDoBackgroundSubtraction()
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
virtual Double_tTUnfold::DoUnfold()
voidTUnfold::ErrorMatrixToHist(TH2* ematrix, const TMatrixDSparse* emat, const Int_t* binMap, Bool_t doClear) const
const TMatrixDSparse*TUnfold::GetAx() const
const TMatrixDSparse*TUnfold::GetDXDAM(int i) const
const TMatrixDSparse*TUnfold::GetDXDAZ(int i) const
const TMatrixDSparse*TUnfold::GetDXDtauSquared() const
const TMatrixDSparse*TUnfold::GetDXDY() const
const TMatrixDSparse*TUnfold::GetE() const
const TMatrixDSparse*TUnfold::GetEinv() const
voidGetEmatrixFromVyy(const TMatrixDSparse* vyy, TH2* ematrix, const Int_t* binMap, Bool_t clearEmat)
Int_tTUnfold::GetNx() const
Int_tTUnfold::GetNy() const
const TMatrixDSparse*TUnfold::GetVxx() const
const TMatrixDSparse*TUnfold::GetVxxInv() const
const TMatrixD*TUnfold::GetX() const
static Bool_tTUnfold::InvertMConditioned(TMatrixD* A)
TMatrixD*TUnfold::InvertMSparse(const TMatrixDSparse* A) const
voidTObject::MakeZombie()
TMatrixDSparse*TUnfold::MultiplyMSparseM(const TMatrixDSparse* a, const TMatrixD* b) const
TMatrixDSparse*TUnfold::MultiplyMSparseMSparse(const TMatrixDSparse* a, const TMatrixDSparse* b) const
TMatrixDSparse*TUnfold::MultiplyMSparseMSparseTranspVector(const TMatrixDSparse* m1, const TMatrixDSparse* m2, const TMatrixTBase<Double_t>* v) const
TMatrixDSparse*TUnfold::MultiplyMSparseTranspMSparse(const TMatrixDSparse* a, const TMatrixDSparse* b) const
virtual TMatrixDSparse*PrepareCorrEmat(const TMatrixDSparse* m1, const TMatrixDSparse* m2, const TMatrixDSparse* dsys)
virtual voidPrepareSysError()
virtual TMatrixDSparse*PrepareUncorrEmat(const TMatrixDSparse* m1, const TMatrixDSparse* m2)
voidScaleColumnsByVector(TMatrixDSparse* m, const TMatrixTBase<Double_t>* v) const
voidVectorMapToHist(TH1* hist_delta, const TMatrixDSparse* delta, const Int_t* binMap)
private:
voidInitTUnfoldSys()

Data Members

public:
enum ESysErrMode { kSysErrModeMatrix
kSysErrModeShift
kSysErrModeRelative
};
enum TUnfold::EConstraint { kEConstraintNone
kEConstraintArea
};
enum TUnfold::ERegMode { kRegModeNone
kRegModeSize
kRegModeDerivative
kRegModeCurvature
kRegModeMixed
};
enum TUnfold::EHistMap { kHistMapOutputHoriz
kHistMapOutputVert
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
TMatrixDSparse*TUnfold::fAInput: matrix
TMatrixD*fAoutsideInput: underflow/overflow bins
TMap*fBgrErrCorrInInput: background sources correlated error
TMap*fBgrErrUncorrInInput: uncorrelated error from bgr sources
TMap*fBgrInInput: size of background sources
Double_tTUnfold::fBiasScaleInput: scale factor for the bias
TUnfold::EConstraintTUnfold::fConstraintInput: type of constraint to use
TMatrixD*fDAinColRelSqInput: normalized column err.sq. (inp.matr.)
TMatrixDSparse*fDAinRelSqInput: normalized errors from input matrix
TMap*fDeltaCorrAxResult: syst.shift from fSysIn on fAx
TMap*fDeltaCorrXResult: syst.shift from fSysIn on fX
TMatrixDSparse*fDeltaSysTauResult: systematic shift from tau
Double_tfDtauInput: error on tau
TMatrixDSparse*fEmatUncorrAxResult: syst.error from fDA2 on fAx
TMatrixDSparse*fEmatUncorrXResult: syst.error from fDA2 on fX
TArrayITUnfold::fHistToXInput: histogram bins -> matrix indices
TMatrixDSparse*TUnfold::fLsquaredInput: regularisation conditions squared
TUnfold::ERegModeTUnfold::fRegModeInput: type of regularisation
TArrayDTUnfold::fSumOverYInput: sum of all columns
TMap*fSysInInput: correlated errors
Double_tTUnfold::fTauSquaredInput: regularisation parameter
TMatrixDSparse*TUnfold::fVyyInput: covariance matrix for y
TMatrixDSparse*fVyyDataInput: error on fY prior to bgr subtraction
TMatrixD*TUnfold::fX0Input: x0
TArrayITUnfold::fXToHistInput: matrix indices -> histogram bins
TMatrixD*TUnfold::fYInput: y
TMatrixD*fYDataInput: fY prior to bgr subtraction

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

TUnfoldSys(const TUnfoldSys& )
 set all pointers to zero
TUnfoldSys(const TH2* hist_A, TUnfold::EHistMap histmap, TUnfold::ERegMode regmode = kRegModeSize, TUnfold::EConstraint constraint = kEConstraintNone)
 arguments:
    hist_A:  matrix that describes the migrations
    histmap: mapping of the histogram axes to the unfolding output
    regmode: global regularisation mode
 data members initialized to something different from zero:
    fDA2, fDAcol
 initialize TUnfold
void AddSysError(const TH2* sysError, const char* name, TUnfold::EHistMap histmap, TUnfoldSys::ESysErrMode mode)
 add a correlated error source
    sysError: alternative matrix or matrix of absolute/relative shifts
    name: name of the error source
    histmap: mapping of the histogram axes to the unfolding output
    mode: format of the error source
void DoBackgroundSubtraction(void)
 performs background subtraction
 fY = fYData - fBgrIn
 fVyy = fVyyData + fBgrErrUncorr^2 + fBgrErrCorr * fBgrErrCorr#
 fVyyinv = fVyy^(-1)
Int_t SetInput(const TH1* hist_y, Double_t scaleBias = 0.0, Double_t oneOverZeroError = 0.0)
 Define the input data for subsequent calls to DoUnfold(Double_t)
  input:   input distribution with errors
  scaleBias:  scale factor applied to the bias
  oneOverZeroError: for bins with zero error, this number defines 1/error.
 Return value: number of bins with bad error
                 +10000*number of unconstrained output bins
         Note: return values>=10000 are fatal errors,
               for the given input, the unfolding can not be done!
 Calls the SetInput metghod of the base class, then renames the input
 vectors fY and fVyy, then performs the background subtraction
 Data members modified:
   fYData,fY,fVyyData,fVyy,fVyyinvData,fVyyinv
 and those modified by TUnfold::SetInput()
 and those modified by DoBackgroundSubtraction()
LM: WARNING: Coverity detects here a false USE_AFTER_FREE for fY and fVyy
 the objects are deleted but then re-created immediatly afterwards in
  TUnfold::SetInput
void SubtractBackground(const TH1* hist_bgr, const char* name, Double_t scale = 1.0, Double_t scale_error = 0.0)
 Store background source
   bgr:    background distribution with uncorrelated errors
   name:   name of this background source
   scale:  scale factor applied to the background
   scaleError: error on scale factor (correlated error)

 Data members modified:
   fBgrIn,fBgrErrUncorrIn,fBgrErrCorrIn
 and those modified by DoBackgroundSubtraction()
 save background source
void InitTUnfoldSys(void)
 initialize pointers and TMaps
~TUnfoldSys(void)
 delete all data members
void ClearResults(void)
 clear all data members which depend on the unfolding results
void PrepareSysError(void)
 calculations required for syst.error
 data members modified
    fEmatUncorrX, fEmatUncorrAx, fDeltaCorrX, fDeltaCorrAx
void GetEmatrixSysUncorr(TH2* ematrix, const Int_t* binMap = 0, Bool_t clearEmat = kTRUE)
 get output error contribution from statistical fluctuations in A
   ematrix: output error matrix histogram
   binMap: see method GetEmatrix()
   clearEmat: set kTRUE to clear the histogram prior to adding the errors
 data members modified:
   fVYAx, fESparse, fEAtV, fErrorAStat
TMatrixDSparse * PrepareUncorrEmat(const TMatrixDSparse* m1, const TMatrixDSparse* m2)
 propagate uncorrelated systematic errors to a covariance matrix
   m0,m1 : coefficients (matrices) for propagating the errors

 the error matrix is calculated by standard error propagation, where the
 derivative of the result vector X wrt the matrix A is given by

  dX_k / dA_ij  =  M0_kj * Z0_i  - M1_ki * Z1_j

 where:
   the matrices M0 and M1 are arguments to this function
   the vectors Z0, Z1 : GetDXDAZ()

 The matrix A is calculated from a matrix B as

    A_ij = B_ij / sum_k B_kj

 where k runs over additional indices of B, not present in A.
 (underflow and overflow bins, used for efficiency corrections)

 define:   Norm_j = sum_k B_kj   (data member fSumOverY)

 the derivative of A wrt this input matrix B is given by:

   dA_ij / dB_kj = (  delta_ik - A_ij ) * 1/Norm_j

 The covariance matrix Vxx is:

   Vxx_mn  = sum_ijlk [   (dX_m / dA_ij) * (dA_ij / dB_kj) * DB_kj
                        * (dX_n / dA_lj) * (dA_lj / dB_kj)  ]

 where DB_kj is the error on B_kj squared
 Simplify the sum over k:

   sum_k [ (dA_ij / dB_kj) * DB_kj * (dA_lj / dB_kj) ]
      =  sum_k [  ( delta_ik - A_ij ) * 1/Norm_j * DB_kj *
                * ( delta_lk - A_lj ) * 1/Norm_j ]
      =  sum_k [ ( delta_ik*delta_lk - delta_ik*A_lj - delta_lk*A_ij
                  + A_ij * A_lj ) * DB_kj / Norm_j^2 ]

 introduce normalized errors:  Rsq_kj = DB_kj / Norm_j^2
 after summing over k:
   delta_ik*delta_lk*Rsq_kj  ->    delta_il*Rsq_ij
   delta_ik*A_lj*Rsq_kj      ->    A_lj*Rsq_ij
   delta_lk*A_ij*Rsq_kj      ->    A_ij*Rsq_lj
   A_ij*A_lj*Rsq_kj          ->    A_ij*A_lj*sum_k(Rsq_kj)

 introduce sum of normalized errors squared:   SRsq_j = sum_k(Rsq_kj)

 Note: Rsq_ij is stored as  fDAinRelSq     (excludes extra indices of B)
   and SRsq_j is stored as  fDAinColRelSq  (sum includes all indices of B)

  Vxx_nm = sum_ijl [ (dX_m / dA_ij) * (dX_n / dA_lj)
     (delta_il*Rsq_ij - A_lj*Rsq_ij - A_ij*Rsq_lj + A_ij*A_lj *SRsq_j) ]

  Vxx_nm =    sum_j [ F_mj * F_nj * SRsq_j
            - sum_j [ G_mj * F_nj ]
            - sum_j [ F_mj * G_nj ]
            + sum_ij [  (dX_m / dA_ij) * (dX_n / dA_lj) * Rsq_ij ]

 where:
    F_mj = sum_i [ (dX_m / dA_ij) * A_ij ]
    G_mj = sum_i [ (dX_m / dA_ij) * Rsq_ij ]

 In order to avoid explicitly calculating the 3-dimensional tensor
 (dX_m/dA_ij) the sums are evaluated further, using
    dX_k / dA_ij  =  M0_kj * Z0_i  - M1_ki * Z1_j

   F_mj = M0_mj * (A# Z0)_j - (M1 A)_mj Z1_j
   G_mj = M0_mj * (Rsq# Z0)_j - (M1 Rsq)_mj Z1_j

 and

   sum_ij [ (dX_m/dA_ij) * (dX_n/dA_ij) * Rsq_ij ] =
      sum_j [ M0_mj * M0_nj *  [ sum_i (Z0_i)^2 * Rsq_ij ] ]
    + sum_i [ M1_mi * M1_ni *  [ sum_j (Z1_j)^2 * Rsq_ij ] ]
    - sum_i [ M1_mi * H_ni + M1_ni * H_mi]
 where:
   H_mi = Z0_i * sum_j [ M0_mj * Z1_j * Rsq_ij ]

 collect all contributions:
   Vxx_nm = r0 -r1 -r2 +r3 +r4 -r5 -r6
      r0 = sum_j [ F_mj * F_nj * SRsq_j ]
      r1 = sum_j [ G_mj * F_nj ]
      r2 = sum_j [ F_mj * G_nj ]
      r3 = sum_j [ M0_mj * M0_nj *  [ sum_i (Z0_i)^2 * Rsq_ij ] ]
      r4 = sum_i [ M1_mi * M1_ni *  [ sum_j (Z1_j)^2 * Rsq_ij ] ]
      r5 = sum_i [ M1_mi * H_ni ]
      r6 = sum_i [ M1_ni * H_mi ]

 calculate contributions containing matrices F and G
 r0,r1,r2
void SetTauError(Double_t delta_tau)
 set uncertainty on tau
void GetDeltaSysSource(TH1* hist_delta, const char* source, const Int_t* binMap = 0)
 calculate systematic shift from a given source
    ematrix: output
    source: name of the error source
    binMap: see method GetEmatrix()
void GetDeltaSysBackgroundScale(TH1* delta, const char* source, const Int_t* binMap = 0)
 get correlated shift induced by a background source
   delta: output shift vector histogram
   source: name of background source
   binMap: see method GetEmatrix()
   see PrepareSysError()
void GetDeltaSysTau(TH1* delta, const Int_t* binMap = 0)
 calculate systematic shift from tau variation
    ematrix: output
    binMap: see method GetEmatrix()
void GetEmatrixSysSource(TH2* ematrix, const char* source, const Int_t* binMap = 0, Bool_t clearEmat = kTRUE)
 calculate systematic shift from a given source
    ematrix: output
    source: name of the error source
    binMap: see method GetEmatrix()
    clearEmat: set kTRUE to clear the histogram prior to adding the errors
void GetEmatrixSysBackgroundScale(TH2* ematrix, const char* source, const Int_t* binMap = 0, Bool_t clearEmat = kTRUE)
 calculate systematic shift from a given background scale error
    ematrix: output
    source: name of the error source
    binMap: see method GetEmatrix()
    clearEmat: set kTRUE to clear the histogram prior to adding the errors
void GetEmatrixSysTau(TH2* ematrix, const Int_t* binMap = 0, Bool_t clearEmat = kTRUE)
 calculate error matrix from error in regularisation parameter
    ematrix: output
    binMap: see method GetEmatrix()
    clearEmat: set kTRUE to clear the histogram prior to adding the errors
void GetEmatrixInput(TH2* ematrix, const Int_t* binMap = 0, Bool_t clearEmat = kTRUE)
 calculate error matrix from error in input vector alone
    ematrix: output
    binMap: see method GetEmatrix()
    clearEmat: set kTRUE to clear the histogram prior to adding the errors
void GetEmatrixFromVyy(const TMatrixDSparse* vyy, TH2* ematrix, const Int_t* binMap, Bool_t clearEmat)
 propagate error matrix vyy to the result
    vyy: error matrix on input data fY
    ematrix: output
    binMap: see method GetEmatrix()
    clearEmat: set kTRUE to clear the histogram prior to adding the errors
void GetEmatrixTotal(TH2* ematrix, const Int_t* binMap = 0)
 get total error including statistical error
    ematrix: output
    binMap: see method GetEmatrix()
Double_t GetChi2Sys(void)
 calculate total chi**2 including systematic errors
void VectorMapToHist(TH1* hist_delta, const TMatrixDSparse* delta, const Int_t* binMap)
 sum over bins of *delta, as defined in binMap,fXToHist
   hist_delta: histogram to return summed vector
   delta: vector to sum and remap
TUnfoldSys(const TUnfoldSys& )
TMatrixDSparse * PrepareCorrEmat(const TMatrixDSparse* m1, const TMatrixDSparse* m2, const TMatrixDSparse* dsys)
void ScaleColumnsByVector(TMatrixDSparse* m, const TMatrixTBase<Double_t>* v) const
void GetEmatrixSysBackgroundUncorr(TH2* ematrix, const char* source, const Int_t* binMap = 0, Bool_t clearEmat = kTRUE)