1 #ifndef ALIJETSPECTRUMUNFOLDING_H
2 #define ALIJETSPECTRUMUNFOLDING_H
4 // class that contains the correction matrix and the functions for
5 // correction the jet spectrum
6 // implements 2-dim bayesian method
23 #include <THnSparse.h>
25 class AliJetSpectrumUnfolding : public TNamed {
27 AliJetSpectrumUnfolding();
28 AliJetSpectrumUnfolding(const Char_t* name, const Char_t* title);
29 virtual ~AliJetSpectrumUnfolding();
31 virtual Long64_t Merge(TCollection* list);
33 Bool_t LoadHistograms(const Char_t* dir = 0);
34 void SaveHistograms();
35 void DrawHistograms();
36 void DrawComparison(const char* name, TH2* const genSpec);
38 void SetBayesianParameters(Float_t smoothing, Int_t nIterations);
39 void ApplyBayesianMethod(Float_t regPar = 1, Int_t nIterations = 100, TH2* initialConditions = 0, Bool_t determineError = kTRUE);
41 TH2F* GetRecSpectrum() const { return fRecSpectrum; }
42 TH2F* GetGenSpectrum() const { return fGenSpectrum; }
43 TH2F* GetUnfSpectrum() const { return fUnfSpectrum; }
44 THnSparseF* GetCorrelation() const { return fCorrelation; }
46 void SetRecSpectrum(TH2F* const hist) { if(fRecSpectrum) delete fRecSpectrum;
47 fRecSpectrum = hist; }
48 void SetGenSpectrum(TH2F* const hist) { if(fGenSpectrum)delete fGenSpectrum;
49 fGenSpectrum = hist; }
50 void SetUnfSpectrum(TH2F* const hist) { if(fUnfSpectrum)delete fUnfSpectrum;
51 fUnfSpectrum = hist; }
52 void SetCorrelation(THnSparseF* const hist){ if(fCorrelation)delete fCorrelation;
53 fCorrelation = hist; }
55 void SetGenRecFromFunc(TF2* inputGen);
56 TH2F* CalculateRecSpectrum(TH2* inputGen);
58 static void NormalizeToBinWidth(TH2* const hist);
60 void GetComparisonResults(Float_t* const gen = 0, Int_t* const genLimit = 0, Float_t* const residuals = 0, Float_t* const ratioAverage = 0) const;
63 void SetupCurrentHists(Bool_t createBigBin);
65 static Double_t BayesCov(THnSparseF* const M, THnSparseF* const correlation, Int_t* const binTM, Int_t* const binTM1);
66 static Double_t BayesUncertaintyTerms(THnSparseF* const M, THnSparseF *const C, Int_t* const binTM, Int_t* const binTM1, Double_t nt);
67 static Int_t UnfoldWithBayesian(THnSparseF* const correlation, TH2* const measured, TH2* const initialConditions, TH2* const aResult, Float_t regPar, Int_t nIterations, Bool_t calculateErrors = kFALSE);
69 static Float_t fgBayesianSmoothing; //! smoothing parameter (0 = no smoothing)
70 static Int_t fgBayesianIterations; //! number of iterations in Bayesian method
73 THnSparseF* fCurrentCorrelation;
78 THnSparseF* fCorrelation;
80 Float_t fLastChi2MC; //! last Chi2 between MC and unfolded ESD (calculated in DrawComparison)
81 Int_t fLastChi2MCLimit; //! bin where the last chi2 breached a certain threshold
82 Float_t fLastChi2Residuals; //! last Chi2 of the ESD and the folded unfolded ESD (calculated in DrawComparison)
83 Float_t fRatioAverage; //! last average of |ratio-1| where ratio = unfolded / mc (bin 2..150)
87 static const Int_t fgkNBINSE;
88 static const Int_t fgkNBINSZ;
89 static const Int_t fgkNEVENTS;
90 static const Double_t fgkaxisLowerLimitE;
91 static const Double_t fgkaxisLowerLimitZ;
92 static const Double_t fgkaxisUpperLimitE;
93 static const Double_t fgkaxisUpperLimitZ;
97 AliJetSpectrumUnfolding(const AliJetSpectrumUnfolding&);
98 AliJetSpectrumUnfolding& operator=(const AliJetSpectrumUnfolding&);
100 ClassDef(AliJetSpectrumUnfolding, 2);