]>
Commit | Line | Data |
---|---|---|
3602328d | 1 | /* $Id$ */ |
2 | ||
0a173978 | 3 | #ifndef ALIMULTIPLICITYCORRECTION_H |
4 | #define ALIMULTIPLICITYCORRECTION_H | |
5 | ||
3602328d | 6 | #include "TNamed.h" |
0a173978 | 7 | |
8 | // | |
9 | // class that contains the correction matrix and the functions for | |
10 | // correction the multiplicity spectrum | |
6d81c2de | 11 | // implements a several unfolding methods: e.g. chi2 minimization and bayesian unfolding |
0a173978 | 12 | // |
13 | ||
14 | class TH1; | |
15 | class TH2; | |
16 | class TH1F; | |
17 | class TH2F; | |
18 | class TH3F; | |
3602328d | 19 | class TF1; |
20 | class TCollection; | |
0a173978 | 21 | |
6d81c2de | 22 | // defined here, because it does not seem possible to predeclare these (or i do not know how) |
23 | // --> | |
24 | // $ROOTSYS/include/TVectorDfwd.h:21: conflicting types for `typedef struct TVectorT<Double_t> TVectorD' | |
25 | // PWG0/dNdEta/AliMultiplicityCorrection.h:21: previous declaration as `struct TVectorD' | |
26 | ||
447c325d | 27 | #include <TMatrixD.h> |
28 | #include <TVectorD.h> | |
cfc19dd5 | 29 | |
0a173978 | 30 | class AliMultiplicityCorrection : public TNamed { |
31 | public: | |
cfc19dd5 | 32 | enum EventType { kTrVtx = 0, kMB, kINEL }; |
0b4bfd98 | 33 | enum RegularizationType { kNone = 0, kPol0, kPol1, kLog, kEntropy, kCurvature }; |
6d81c2de | 34 | enum MethodType { kChi2Minimization = 0, kBayesian = 1 }; |
0b4bfd98 | 35 | enum { kESDHists = 4, kMCHists = 5, kCorrHists = 8, kQualityRegions = 3 }; |
cfc19dd5 | 36 | |
0a173978 | 37 | AliMultiplicityCorrection(); |
38 | AliMultiplicityCorrection(const Char_t* name, const Char_t* title); | |
39 | virtual ~AliMultiplicityCorrection(); | |
40 | ||
41 | virtual Long64_t Merge(TCollection* list); | |
42 | ||
43 | void FillMeasured(Float_t vtx, Int_t measured05, Int_t measured10, Int_t measured15, Int_t measured20); | |
cfc19dd5 | 44 | void FillGenerated(Float_t vtx, Bool_t triggered, Bool_t vertex, Int_t generated05, Int_t generated10, Int_t generated15, Int_t generated20, Int_t generatedAll); |
0a173978 | 45 | |
46 | void FillCorrection(Float_t vtx, Int_t generated05, Int_t generated10, Int_t generated15, Int_t generated20, Int_t generatedAll, Int_t measured05, Int_t measured10, Int_t measured15, Int_t measured20); | |
47 | ||
0b4bfd98 | 48 | Bool_t LoadHistograms(const Char_t* dir = 0); |
0a173978 | 49 | void SaveHistograms(); |
50 | void DrawHistograms(); | |
447c325d | 51 | void DrawComparison(const char* name, Int_t inputRange, Bool_t fullPhaseSpace, Bool_t normalizeESD, TH1* mcHist, Bool_t simple = kFALSE); |
0a173978 | 52 | |
6d81c2de | 53 | Int_t ApplyMinuitFit(Int_t inputRange, Bool_t fullPhaseSpace, EventType eventType, Bool_t check = kFALSE, TH1* initialConditions = 0); |
447c325d | 54 | void SetRegularizationParameters(RegularizationType type, Float_t weight); |
6d81c2de | 55 | void SetBayesianParameters(Float_t smoothing, Int_t nIterations); |
0a173978 | 56 | |
dd701109 | 57 | void ApplyNBDFit(Int_t inputRange, Bool_t fullPhaseSpace); |
58 | ||
6d81c2de | 59 | void ApplyBayesianMethod(Int_t inputRange, Bool_t fullPhaseSpace, EventType eventType, Float_t regPar = 1, Int_t nIterations = 100, TH1* initialConditions = 0, Bool_t determineError = kTRUE); |
60 | ||
61 | TH1* StatisticalUncertainty(MethodType methodType, Int_t inputRange, Bool_t fullPhaseSpace, EventType eventType, Bool_t randomizeMeasured, Bool_t randomizeResponse, TH1* compareTo = 0); | |
0a173978 | 62 | |
9ca6be09 | 63 | void ApplyGaussianMethod(Int_t inputRange, Bool_t fullPhaseSpace); |
64 | ||
cfc19dd5 | 65 | void ApplyLaszloMethod(Int_t inputRange, Bool_t fullPhaseSpace, EventType eventType); |
66 | ||
0a173978 | 67 | TH2F* GetMultiplicityESD(Int_t i) { return fMultiplicityESD[i]; } |
cfc19dd5 | 68 | TH2F* GetMultiplicityVtx(Int_t i) { return fMultiplicityVtx[i]; } |
69 | TH2F* GetMultiplicityMB(Int_t i) { return fMultiplicityMB[i]; } | |
70 | TH2F* GetMultiplicityINEL(Int_t i) { return fMultiplicityINEL[i]; } | |
71 | TH2F* GetMultiplicityMC(Int_t i, EventType eventType); | |
0a173978 | 72 | TH3F* GetCorrelation(Int_t i) { return fCorrelation[i]; } |
dd701109 | 73 | TH1F* GetMultiplicityESDCorrected(Int_t i) { return fMultiplicityESDCorrected[i]; } |
0a173978 | 74 | |
0b4bfd98 | 75 | void SetMultiplicityESD(Int_t i, TH2F* hist) { fMultiplicityESD[i] = hist; } |
76 | void SetMultiplicityVtx(Int_t i, TH2F* hist) { fMultiplicityVtx[i] = hist; } | |
77 | void SetMultiplicityMB(Int_t i, TH2F* hist) { fMultiplicityMB[i] = hist; } | |
cfc19dd5 | 78 | void SetMultiplicityINEL(Int_t i, TH2F* hist) { fMultiplicityINEL[i] = hist; } |
9ca6be09 | 79 | void SetCorrelation(Int_t i, TH3F* hist) { fCorrelation[i] = hist; } |
dd701109 | 80 | void SetMultiplicityESDCorrected(Int_t i, TH1F* hist) { fMultiplicityESDCorrected[i] = hist; } |
9ca6be09 | 81 | |
3602328d | 82 | void SetGenMeasFromFunc(TF1* inputMC, Int_t id); |
447c325d | 83 | TH2F* CalculateMultiplicityESD(TH1* inputMC, Int_t correlationMap); |
3602328d | 84 | |
0a173978 | 85 | static void NormalizeToBinWidth(TH1* hist); |
86 | static void NormalizeToBinWidth(TH2* hist); | |
87 | ||
6d81c2de | 88 | void GetComparisonResults(Float_t* mc = 0, Int_t* mcLimit = 0, Float_t* residuals = 0, Float_t* ratioAverage = 0) const; |
cfc19dd5 | 89 | |
0b4bfd98 | 90 | TH1* GetEfficiency(Int_t inputRange, EventType eventType); |
91 | ||
92 | static void SetQualityRegions(Bool_t SPDStudy); | |
6d81c2de | 93 | Float_t GetQuality(Int_t region) const { return fQuality[region]; } |
0b4bfd98 | 94 | |
95 | void FFT(Int_t dir, Int_t m, Double_t *x, Double_t *y); | |
0a173978 | 96 | |
0b4bfd98 | 97 | protected: |
6d81c2de | 98 | static const Int_t fgkMaxParams; //! bins in unfolded histogram = number of fit params |
99 | static const Int_t fgkMaxInput; //! bins in measured histogram | |
0a173978 | 100 | |
447c325d | 101 | static Double_t RegularizationPol0(TVectorD& params); |
102 | static Double_t RegularizationPol1(TVectorD& params); | |
103 | static Double_t RegularizationTotalCurvature(TVectorD& params); | |
104 | static Double_t RegularizationEntropy(TVectorD& params); | |
0b4bfd98 | 105 | static Double_t RegularizationLog(TVectorD& params); |
9ca6be09 | 106 | |
0a173978 | 107 | static void MinuitFitFunction(Int_t&, Double_t*, Double_t& chi2, Double_t *params, Int_t); |
dd701109 | 108 | static void MinuitNBD(Int_t& unused1, Double_t* unused2, Double_t& chi2, Double_t *params, Int_t unused3); |
0a173978 | 109 | |
447c325d | 110 | void SetupCurrentHists(Int_t inputRange, Bool_t fullPhaseSpace, EventType eventType, Bool_t createBigBin); |
cfc19dd5 | 111 | |
0b4bfd98 | 112 | Float_t BayesCovarianceDerivate(Float_t matrixM[251][251], TH2* hResponse, Int_t k, Int_t i, Int_t r, Int_t u); |
6d81c2de | 113 | static Int_t UnfoldWithBayesian(TH1* correlation, TH1* aEfficiency, TH1* measured, TH1* initialConditions, TH1* aResult, Float_t regPar, Int_t nIterations); |
114 | static Int_t UnfoldWithMinuit(TH1* correlation, TH1* aEfficiency, TH1* measured, TH1* initialConditions, TH1* result, Bool_t check); | |
115 | ||
116 | TH1* fCurrentESD; //! static variable to be accessed by MINUIT | |
117 | TH1* fCurrentCorrelation; //! static variable to be accessed by MINUIT | |
118 | TH1* fCurrentEfficiency; //! static variable to be accessed by MINUIT | |
9ca6be09 | 119 | |
6d81c2de | 120 | // static variable to be accessed by MINUIT |
121 | static TMatrixD* fgCorrelationMatrix; //! contains fCurrentCorrelation in matrix form | |
122 | static TMatrixD* fgCorrelationCovarianceMatrix; //! contains the errors of fCurrentESD | |
123 | static TVectorD* fgCurrentESDVector; //! contains fCurrentESD | |
124 | static TVectorD* fgEntropyAPriori; //! a-priori distribution for entropy regularization | |
cfc19dd5 | 125 | |
6d81c2de | 126 | static TF1* fgNBD; //! negative binomial distribution |
cfc19dd5 | 127 | |
6d81c2de | 128 | static RegularizationType fgRegularizationType; //! regularization that is used during Chi2 method |
129 | static Float_t fgRegularizationWeight; //! factor for regularization term | |
dd701109 | 130 | |
6d81c2de | 131 | static Float_t fgBayesianSmoothing; //! smoothing parameter (0 = no smoothing) |
132 | static Int_t fgBayesianIterations; //! number of iterations in Bayesian method | |
0a173978 | 133 | |
6d81c2de | 134 | TH2F* fMultiplicityESD[kESDHists]; // multiplicity histogram: vtx vs multiplicity; array: |eta| < 0.5, 0.9, 1.5, 2 (0..3) |
135 | ||
136 | TH2F* fMultiplicityVtx[kMCHists]; // multiplicity histogram of events that have a reconstructed vertex : vtx vs multiplicity; array: |eta| < 0.5, 0.9, 1.5, 2, inf (0..4) | |
137 | TH2F* fMultiplicityMB[kMCHists]; // multiplicity histogram of triggered events : vtx vs multiplicity; array: |eta| < 0.5, 0.9, 1.5, 2, inf (0..4) | |
138 | TH2F* fMultiplicityINEL[kMCHists]; // multiplicity histogram of all (inelastic) events : vtx vs multiplicity; array: |eta| < 0.5, 0.9, 1.5, 2, inf (0..4) | |
0a173978 | 139 | |
cfc19dd5 | 140 | TH3F* fCorrelation[kCorrHists]; // vtx vs. (gene multiplicity (trig+vtx)) vs. (meas multiplicity); array: |eta| < 0.5, 1, 1.5, 2 (0..3 and 4..7), the first corrects to the eta range itself, the second to full phase space |
6d81c2de | 141 | |
0a173978 | 142 | TH1F* fMultiplicityESDCorrected[kCorrHists]; // corrected histograms |
143 | ||
6d81c2de | 144 | Float_t fLastChi2MC; //! last Chi2 between MC and unfolded ESD (calculated in DrawComparison) |
145 | Int_t fLastChi2MCLimit; //! bin where the last chi2 breached a certain threshold, used to evaluate the multiplicity reach (calc. in DrawComparison) | |
146 | Float_t fLastChi2Residuals; //! last Chi2 of the ESD and the folded unfolded ESD (calculated in DrawComparison) | |
147 | Float_t fRatioAverage; //! last average of |ratio-1| where ratio = unfolded / mc (bin 2..150) | |
0b4bfd98 | 148 | |
6d81c2de | 149 | static Int_t fgQualityRegionsB[kQualityRegions]; //! begin, given in multiplicity units |
150 | static Int_t fgQualityRegionsE[kQualityRegions]; //! end | |
151 | Float_t fQuality[kQualityRegions]; //! stores the quality of the last comparison (calculated in DrawComparison). Contains 3 values that are averages of (MC - unfolded) / e(MC) in 3 regions, these are defined in fQualityRegionB,E | |
cfc19dd5 | 152 | |
0a173978 | 153 | private: |
154 | AliMultiplicityCorrection(const AliMultiplicityCorrection&); | |
155 | AliMultiplicityCorrection& operator=(const AliMultiplicityCorrection&); | |
156 | ||
6d81c2de | 157 | ClassDef(AliMultiplicityCorrection, 2); |
0a173978 | 158 | }; |
159 | ||
160 | #endif | |
0f81f352 | 161 |