ROOT logo
AliRoot » CORRFW » AliCFUnfolding

class AliCFUnfolding: public TNamed

Function Members (Methods)

public:
AliCFUnfolding()
AliCFUnfolding(const Char_t* name, const Char_t* title, const Int_t nVar, const THnSparse* response, const THnSparse* efficiency, const THnSparse* measured, const THnSparse* prior = 0x0, Double_t maxConvergencePerDOF = 1.e-06, UInt_t randomSeed = 0, Int_t maxNumIterations = 10)
virtual~AliCFUnfolding()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")MENU
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
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 voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
THnSparse*GetConditional() const
THnSparse*GetDeltaUnfoldedProfile() const
Int_tGetDOF()
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
const THnSparse*GetEfficiency() const
THnSparse*GetEstMeasured() const
virtual const char*TObject::GetIconName() const
THnSparse*GetInverseResponse() const
const THnSparse*GetMeasured() const
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
const THnSparse*GetOriginalPrior() const
THnSparse*GetPrior() const
const THnSparse*GetResponse() const
TF1*GetSmoothFunction() const
virtual const char*TNamed::GetTitle() const
THnSparse*GetUnfolded() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::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_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
voidTObject::Obsolete(const char* method, const char* asOfVers, const char* removedFromVers) const
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)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
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 = "")
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
voidSetMaxNumberOfIterations(Int_t n = 10)
virtual voidTNamed::SetName(const char* name)MENU
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
voidSetNRandomIterations(Int_t n = 100)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidTNamed::SetTitle(const char* title = "")MENU
virtual voidTObject::SetUniqueID(UInt_t uid)
voidSetUseCorrelatedErrors()
virtual voidShowMembers(TMemberInspector&)
virtual Int_tTNamed::Sizeof() const
static Short_tSmoothUsingNeighbours(THnSparse*)
virtual voidStreamer(TBuffer&)
voidStreamerNVirtual(TBuffer& ClassDef_StreamerNVirtual_b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
voidUnfold()
voidUnsetCorrelatedErrors()
virtual voidTObject::UseCurrentStyle()
voidUseSmoothing(TF1* fcn = 0x0, Option_t* opt = "iremn")
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:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
voidTObject::MakeZombie()

Data Members

protected:
TStringTNamed::fNameobject identifier
TStringTNamed::fTitleobject title
private:
THnSparse*fConditionalMatrix holding the conditional probabilities P(M|T)
Int_t*fCoordinates2NCoordinates in 2N (measured,true) space
Int_t*fCoordinatesN_MCoordinates in measured space
Int_t*fCoordinatesN_TCoordinates in true space
THnSparse*fDeltaUnfoldedNEntries of the delta-unfolded distribution (count for each bin)
THnSparse*fDeltaUnfoldedPProfile of the delta-unfolded distribution
THnSparse*fEfficiencyCopy of original efficiency (modified)
const THnSparse*fEfficiencyOrigEfficiency map : dimensions must be N = number of variables (modified)
THnSparse*fInverseResponseInverse response matrix
Double_tfMaxConvergenceConvergence criterion in case of correlated error calculation
Int_tfMaxNumIterationsMaximum number of iterations to be performed
THnSparse*fMeasuredCopy of the original measureed spectrum (modified)
THnSparse*fMeasuredEstimateEstimation of the measured (M) spectrum given the a priori (T) distribution
const THnSparse*fMeasuredOrigMeasured spectrum to be unfolded : dimensions must be N = number of variables (modified)
Short_tfNCalcCorrErrorsBook-keeping to prevend infinite loop
Int_tfNRandomIterationsNumber of random distributed measured spectra
Int_tfNVariablesNumber of variables used in analysis spectra (pt, y, ...)
THnSparse*fPriorCopy of the original prior spectrum (modified)
const THnSparse*fPriorOrigThis is the assumed generated distribution : dimensions must be N = number of variables
TRandom3*fRandom3Object to get random number following Poisson distribution
THnSparse*fRandomEfficiencyRandomized distribution for each bin of the efficiency spectrum to calculate correlated errors
THnSparse*fRandomMeasuredRandomized distribution for each bin of the measured spectrum to calculate correlated errors
THnSparse*fRandomResponseRandomized distribution for each bin of the response matrix to calculate correlated errors
UInt_tfRandomSeedRandom seed
THnSparse*fResponseCopy of the original response matrix (modified)
const THnSparse*fResponseOrigResponse matrix : dimensions must be 2N = 2 x (number of variables)
TF1*fSmoothFunctionFunction used to smooth the unfolded spectrum
Option_t*fSmoothOptionOption to use during the fit (with fSmoothFunction) ; default is "iremn"
THnSparse*fUnfoldedUnfolded spectrum (modified before and during error calculation)
THnSparse*fUnfoldedFinalFinal unfolded spectrum
Bool_tfUseSmoothingSmooth the unfolded sectrum at each iteration; default is kFALSE

Class Charts

Inheritance Chart:
TNamed
AliCFUnfolding

Function documentation

AliCFUnfolding()
 default constructor

AliCFUnfolding(const Char_t* name, const Char_t* title, const Int_t nVar, const THnSparse* response, const THnSparse* efficiency, const THnSparse* measured, const THnSparse* prior = 0x0, Double_t maxConvergencePerDOF = 1.e-06, UInt_t randomSeed = 0, Int_t maxNumIterations = 10)
 named constructor

~AliCFUnfolding()
 destructor

void Init()
 initialisation function : creates internal settings

void CreateEstMeasured()
 This function creates a estimate (M) of the reconstructed spectrum
 given the a priori distribution (T), the efficiency (E) and the conditional matrix (COND)

 --> P(M) = SUM   { P(M|T)    * P(T) }
 --> M(i) = SUM_k { COND(i,k) * T(k) * E (k)}

 This is needed to calculate the inverse response matrix

void CreateInvResponse()
 Creates the inverse response matrix (INV) with Bayesian method
  : uses the conditional matrix (COND), the prior probabilities (T) and the efficiency map (E)

 --> P(T|M)   = P(M|T)    * P(T) * eff(T) / SUM   { P(M|T)    * P(T) }
 --> INV(i,j) = COND(i,j) * T(j) * E(j)   / SUM_k { COND(i,k) * T(k) }

void Unfold()
 Main routine called by the user :
 it calculates the unfolded spectrum from the response matrix, measured spectrum and efficiency
 several iterations are performed until a reasonable chi2 or convergence criterion is reached

void CreateUnfolded()
 Creates the unfolded (T) spectrum from the measured spectrum (M) and the inverse response matrix (INV)
 We have P(T) = SUM   { P(T|M)   * P(M) }
   -->   T(i) = SUM_k { INV(i,k) * M(k) }

void CalculateCorrelatedErrors()
void CreateRandomizedDist()
 Create randomized dist from original measured distribution
 This distribution is created several times, each time with a different random number

void FillDeltaUnfoldedProfile()
 Store difference of unfolded spectrum from measured distribution and unfolded spectrum from randomized distribution
 The delta profile has been set to a THnSparse to handle N dimension
 The THnSparse contains in each bin the mean value and spread of the difference
 This function updates the profile wrt to its previous mean and error
 The relation between iterations (n+1) and n is as follows :
  mean_{n+1} = (n*mean_n + value_{n+1}) / (n+1)
 sigma_{n+1} = sqrt { 1/(n+1) * [ n*sigma_n^2 + (n^2+n)*(mean_{n+1}-mean_n)^2 ] }    (can this be optimized?)
void GetCoordinates()
 assign coordinates in Measured and True spaces (dim=N) from coordinates in global space (dim=2N)

void CreateConditional()
 creates the conditional probability matrix (R*) holding the P(M|T), given the reponse matrix R

  --> R*(i,j) = R(i,j) / SUM_k{ R(k,j) }

Int_t GetDOF()
 number of dof = number of bins

Double_t GetChi2()
 Returns the chi2 between unfolded and a priori spectrum
 This function became absolute with the correlated error calculation.
 Errors on the unfolded distribution are not known until the end
 Use the convergence criterion instead

Double_t GetConvergence()
 Returns convergence criterion = \sum_t ((U_t^{n-1}-U_t^n)/U_t^{n-1})^2
 U is unfolded spectrum, t is the bin, n = current, n-1 = previous

void SetMaxConvergencePerDOF(Double_t val)
 Max. convergence criterion per degree of freedom : user setting
 convergence criterion = DOF*val; DOF = number of bins
 In Jan-Fiete's multiplicity note: Convergence criterion = DOF*0.001^2

Short_t Smooth()
 Smoothes the unfolded spectrum

 By default each cell content is replaced by the average with the neighbouring bins (but not diagonally-neighbouring bins)
 However, if a specific function fcn has been defined in UseSmoothing(fcn), the unfolded will be fit and updated using fcn

Short_t SmoothUsingNeighbours(THnSparse* )
 Smoothes the unfolded spectrum using neighouring bins

Short_t SmoothUsingFunction()
 Fits the unfolded spectrum using the function fSmoothFunction

void CreateFlatPrior()
 Creates a flat prior distribution

AliCFUnfolding()
void UnsetCorrelatedErrors()
{AliError("===================> DEPRECATED <=====================");}
void SetUseCorrelatedErrors()
{AliError("===================> DEPRECATED <=====================");}
void SetMaxNumberOfIterations(Int_t n = 10)
void SetNRandomIterations(Int_t n = 100)
void UseSmoothing(TF1* fcn = 0x0, Option_t* opt = "iremn")
const THnSparse* GetResponse() const
{return fResponseOrig;}
const THnSparse* GetEfficiency() const
{return fEfficiencyOrig;}
const THnSparse* GetMeasured() const
{return fMeasuredOrig;}
const THnSparse* GetOriginalPrior() const
{return fPriorOrig;}
THnSparse* GetInverseResponse() const
THnSparse* GetPrior() const
{return fPrior;}
THnSparse* GetUnfolded() const
{return fUnfoldedFinal;}
THnSparse* GetEstMeasured() const
THnSparse* GetConditional() const
{return fConditional;}
TF1* GetSmoothFunction() const
{return fSmoothFunction;}
THnSparse* GetDeltaUnfoldedProfile() const
{return fDeltaUnfoldedP;}
AliCFUnfolding& operator=(const AliCFUnfolding& c)