]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG0/dNdEta/AliMultiplicityCorrection.h
Modifications to take into account new muon esd structure (P. Cortese)
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / AliMultiplicityCorrection.h
CommitLineData
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
11//
12
13class TH1;
14class TH2;
15class TH1F;
16class TH2F;
17class TH3F;
3602328d 18class TF1;
19class TCollection;
0a173978 20
cfc19dd5 21#include <TMatrixF.h>
22#include <TVectorF.h>
23
0a173978 24class AliMultiplicityCorrection : public TNamed {
25 public:
cfc19dd5 26 enum EventType { kTrVtx = 0, kMB, kINEL };
dd701109 27 enum RegularizationType { kNone = 0, kPol0, kPol1, kCurvature, kEntropy, kTest };
cfc19dd5 28
0a173978 29 AliMultiplicityCorrection();
30 AliMultiplicityCorrection(const Char_t* name, const Char_t* title);
31 virtual ~AliMultiplicityCorrection();
32
33 virtual Long64_t Merge(TCollection* list);
34
35 void FillMeasured(Float_t vtx, Int_t measured05, Int_t measured10, Int_t measured15, Int_t measured20);
cfc19dd5 36 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 37
38 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);
39
40 Bool_t LoadHistograms(const Char_t* dir);
41 void SaveHistograms();
42 void DrawHistograms();
cfc19dd5 43 void DrawComparison(const char* name, Int_t inputRange, Bool_t fullPhaseSpace, Bool_t normalizeESD, TH1* mcHist);
0a173978 44
dd701109 45 void ApplyMinuitFit(Int_t inputRange, Bool_t fullPhaseSpace, EventType eventType, Bool_t check = kFALSE, TH1* inputDist = 0);
cfc19dd5 46 void SetRegularizationParameters(RegularizationType type, Float_t weight) { fRegularizationType = type; fRegularizationWeight = weight; };
0a173978 47
dd701109 48 void ApplyNBDFit(Int_t inputRange, Bool_t fullPhaseSpace);
49
50 void ApplyBayesianMethod(Int_t inputRange, Bool_t fullPhaseSpace, EventType eventType, Float_t regPar = 0.07, Int_t nIterations = 30, TH1* inputDist = 0);
0a173978 51
9ca6be09 52 void ApplyGaussianMethod(Int_t inputRange, Bool_t fullPhaseSpace);
53
cfc19dd5 54 void ApplyLaszloMethod(Int_t inputRange, Bool_t fullPhaseSpace, EventType eventType);
55
0a173978 56 TH2F* GetMultiplicityESD(Int_t i) { return fMultiplicityESD[i]; }
cfc19dd5 57 TH2F* GetMultiplicityVtx(Int_t i) { return fMultiplicityVtx[i]; }
58 TH2F* GetMultiplicityMB(Int_t i) { return fMultiplicityMB[i]; }
59 TH2F* GetMultiplicityINEL(Int_t i) { return fMultiplicityINEL[i]; }
60 TH2F* GetMultiplicityMC(Int_t i, EventType eventType);
0a173978 61 TH3F* GetCorrelation(Int_t i) { return fCorrelation[i]; }
dd701109 62 TH1F* GetMultiplicityESDCorrected(Int_t i) { return fMultiplicityESDCorrected[i]; }
0a173978 63
cfc19dd5 64 void SetMultiplicityESD(Int_t i, TH2F* hist) { fMultiplicityESD[i] = hist; }
65 void SetMultiplicityVtx(Int_t i, TH2F* hist) { fMultiplicityVtx[i] = hist; }
66 void SetMultiplicityMB(Int_t i, TH2F* hist) { fMultiplicityMB[i] = hist; }
67 void SetMultiplicityINEL(Int_t i, TH2F* hist) { fMultiplicityINEL[i] = hist; }
9ca6be09 68 void SetCorrelation(Int_t i, TH3F* hist) { fCorrelation[i] = hist; }
dd701109 69 void SetMultiplicityESDCorrected(Int_t i, TH1F* hist) { fMultiplicityESDCorrected[i] = hist; }
9ca6be09 70
3602328d 71 void SetGenMeasFromFunc(TF1* inputMC, Int_t id);
b477f4f2 72 TH2F* CalculateMultiplicityESD(TH1* inputMC, Int_t correlationMap, Bool_t normalized = kFALSE);
3602328d 73
0a173978 74 static void NormalizeToBinWidth(TH1* hist);
75 static void NormalizeToBinWidth(TH2* hist);
76
dd701109 77 void GetComparisonResults(Float_t* mc, Int_t* mcLimit, Float_t* residuals);
cfc19dd5 78
0a173978 79 protected:
80 enum { kESDHists = 4, kMCHists = 5, kCorrHists = 8 };
81
82 static const Int_t fgMaxParams; // number of fit params
83
9ca6be09 84 static Double_t RegularizationPol0(Double_t *params);
85 static Double_t RegularizationPol1(Double_t *params);
86 static Double_t RegularizationTotalCurvature(Double_t *params);
3602328d 87 static Double_t RegularizationEntropy(Double_t *params);
dd701109 88 static Double_t RegularizationTest(Double_t *params);
9ca6be09 89
0a173978 90 static void MinuitFitFunction(Int_t&, Double_t*, Double_t& chi2, Double_t *params, Int_t);
dd701109 91 static void MinuitNBD(Int_t& unused1, Double_t* unused2, Double_t& chi2, Double_t *params, Int_t unused3);
0a173978 92
cfc19dd5 93 void SetupCurrentHists(Int_t inputRange, Bool_t fullPhaseSpace, EventType eventType);
94
95 Float_t BayesCovarianceDerivate(Float_t matrixM[251][251], TH2* hResponse, TH1* fCurrentEfficiency, Int_t k, Int_t i, Int_t r, Int_t u);
9ca6be09 96
97 static TH1* fCurrentESD; // static variable to be accessed by MINUIT
98 static TH1* fCurrentCorrelation; // static variable to be accessed by MINUIT
cfc19dd5 99 static TH1* fCurrentEfficiency; // static variable to be accessed by MINUIT
100
101 static TMatrixF* fCorrelationMatrix; // contains fCurrentCorrelation in matrix form
102 static TMatrixF* fCorrelationCovarianceMatrix; // contains the errors of fCurrentESD
103 static TVectorF* fCurrentESDVector; // contains fCurrentESD
104
dd701109 105 static TF1* fNBD; // negative binomial distribution
106
cfc19dd5 107 static RegularizationType fRegularizationType; // regularization that is used during Chi2 method
108 static Float_t fRegularizationWeight; // factor for regularization term
0a173978 109
110 TH2F* fMultiplicityESD[kESDHists]; // multiplicity histogram: vtx vs multiplicity; array: |eta| < 0.5, 1, 1.5, 2 (0..3)
cfc19dd5 111 TH2F* fMultiplicityVtx[kMCHists]; // multiplicity histogram of events that have a reconstructed vertex : vtx vs multiplicity; array: |eta| < 0.5, 1, 1.5, 2, inf (0..4)
112 TH2F* fMultiplicityMB[kMCHists]; // multiplicity histogram of triggered events : vtx vs multiplicity; array: |eta| < 0.5, 1, 1.5, 2, inf (0..4)
113 TH2F* fMultiplicityINEL[kMCHists]; // multiplicity histogram of all (inelastic) events : vtx vs multiplicity; array: |eta| < 0.5, 1, 1.5, 2, inf (0..4)
0a173978 114
cfc19dd5 115 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
0a173978 116 TH1F* fMultiplicityESDCorrected[kCorrHists]; // corrected histograms
117
cfc19dd5 118 Float_t fLastChi2MC; // last Chi2 between MC and unfolded ESD (calculated in DrawComparison)
dd701109 119 Int_t fLastChi2MCLimit; // bin where the last chi2 breached a certain threshold, used to evaluate the multiplicity reach (calc. in DrawComparison)
cfc19dd5 120 Float_t fLastChi2Residuals; // last Chi2 of the ESD and the folded unfolded ESD (calculated in DrawComparison)
121
0a173978 122 private:
123 AliMultiplicityCorrection(const AliMultiplicityCorrection&);
124 AliMultiplicityCorrection& operator=(const AliMultiplicityCorrection&);
125
126 ClassDef(AliMultiplicityCorrection, 1);
127};
128
129#endif
0f81f352 130