]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG0/multiplicity/AliMultiplicityCorrection.h
Macro to run over all centrality bins
[u/mrichter/AliRoot.git] / PWG0 / multiplicity / 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
6d81c2de 11// implements a several unfolding methods: e.g. chi2 minimization and bayesian unfolding
0a173978 12//
13
14class TH1;
15class TH2;
16class TH1F;
17class TH2F;
18class TH3F;
3602328d 19class TF1;
20class 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>
69b09e3b 29#include <AliPWG0Helper.h>
19442b86 30#include <AliUnfolding.h>
cfc19dd5 31
0a173978 32class AliMultiplicityCorrection : public TNamed {
33 public:
69b09e3b 34 enum EventType { kTrVtx = 0, kMB, kINEL, kNSD };
b3b260d1 35 enum { kESDHists = 3, kMCHists = 4, kCorrHists = 6, kQualityRegions = 3 };
cfc19dd5 36
0a173978 37 AliMultiplicityCorrection();
38 AliMultiplicityCorrection(const Char_t* name, const Char_t* title);
39 virtual ~AliMultiplicityCorrection();
69b09e3b 40
41 static AliMultiplicityCorrection* Open(const char* fileName, const char* folderName = "Multiplicity");
0a173978 42
0427591c 43 virtual Long64_t Merge(const TCollection* list);
0a173978 44
b3b260d1 45 void FillMeasured(Float_t vtx, Int_t measured05, Int_t measured10, Int_t measured14);
eb9356d5 46 void FillTriggeredEvent(Int_t measured05, Int_t measured10, Int_t measured14);
b3b260d1 47 void FillGenerated(Float_t vtx, Bool_t triggered, Bool_t vertex, AliPWG0Helper::MCProcessType processType, Int_t generated05, Int_t generated10, Int_t generated14, Int_t generatedAll);
0a173978 48
b3b260d1 49 void FillCorrection(Float_t vtx, Int_t generated05, Int_t generated10, Int_t generated14, Int_t generatedAll, Int_t measured05, Int_t measured10, Int_t measured14);
eb9356d5 50 void FillNoVertexEvent(Float_t vtx, Bool_t vertexReconstructed, Int_t generated05, Int_t generated10, Int_t generated14, Int_t measured05, Int_t measured10, Int_t measured14);
0a173978 51
0b4bfd98 52 Bool_t LoadHistograms(const Char_t* dir = 0);
144ff489 53 void SaveHistograms(const char* dir = 0);
0a173978 54 void DrawHistograms();
eb9356d5 55 void Rebin2DY(TH2F*& hist, Int_t nBins, Double_t* newBins) const;
56 void Rebin3DY(TH3F*& hist, Int_t nBins, Double_t* newBins) const;
57 void RebinGenerated(Int_t nBins05, Double_t* newBins05, Int_t nBins10, Double_t* newBins10, Int_t nBins13, Double_t* newBins13);
7dcf959e 58 void DrawComparison(const char* name, Int_t inputRange, Bool_t fullPhaseSpace, Bool_t normalizeESD, TH1* mcHist, Bool_t simple = kFALSE, EventType eventType = kTrVtx);
0a173978 59
eb9356d5 60 Int_t ApplyMinuitFit(Int_t inputRange, Bool_t fullPhaseSpace, EventType eventType, Int_t zeroBinEvents, Bool_t check = kFALSE, TH1* initialConditions = 0, Bool_t errorAsBias = kFALSE);
44466df2 61
eb9356d5 62 void ApplyBayesianMethod(Int_t inputRange, Bool_t fullPhaseSpace, EventType eventType, Float_t regPar = 1, Int_t nIterations = 100, TH1* initialConditions = 0, Int_t determineError = 1);
6d81c2de 63
0f67a57c 64 static TH1* CalculateStdDev(TH1** results, Int_t max);
eb9356d5 65 TH1* StatisticalUncertainty(AliUnfolding::MethodType methodType, Int_t inputRange, Bool_t fullPhaseSpace, EventType eventType, Int_t zeroBinEvents, Bool_t randomizeMeasured, Bool_t randomizeResponse, const TH1* compareTo = 0);
0a173978 66
19442b86 67 Int_t ApplyNBDFit(Int_t inputRange, Bool_t fullPhaseSpace, EventType eventType);
9ca6be09 68 void ApplyGaussianMethod(Int_t inputRange, Bool_t fullPhaseSpace);
69
cfc19dd5 70 void ApplyLaszloMethod(Int_t inputRange, Bool_t fullPhaseSpace, EventType eventType);
71
eb9356d5 72 void Calculate0Bin(Int_t inputRange, EventType eventType, Int_t zeroBinEvents);
73 Float_t GetFraction0Generated(Int_t inputRange);
74
0427591c 75 TH2F* GetMultiplicityESD(Int_t i) const { return fMultiplicityESD[i]; }
eb9356d5 76 TH1F* GetTriggeredEvents(Int_t i) const { return fTriggeredEvents[i]; }
0427591c 77 TH2F* GetMultiplicityVtx(Int_t i) const { return fMultiplicityVtx[i]; }
78 TH2F* GetMultiplicityMB(Int_t i) const { return fMultiplicityMB[i]; }
79 TH2F* GetMultiplicityINEL(Int_t i) const { return fMultiplicityINEL[i]; }
80 TH2F* GetMultiplicityNSD(Int_t i) const { return fMultiplicityNSD[i]; }
81 TH2F* GetMultiplicityMC(Int_t i, EventType eventType) const;
82 TH3F* GetCorrelation(Int_t i) const { return fCorrelation[i]; }
eb9356d5 83 TH1F* GetNoVertexEvents(Int_t i) const { return fNoVertexEvents[i]; }
0427591c 84 TH1F* GetMultiplicityESDCorrected(Int_t i) const { return fMultiplicityESDCorrected[i]; }
0a173978 85
9e190068 86 void SetMultiplicityESD(Int_t i, TH2F* const hist) { fMultiplicityESD[i] = hist; }
eb9356d5 87 void SetTriggeredEvents(Int_t i, TH1F* hist) { fTriggeredEvents[i] = hist; }
9e190068 88 void SetMultiplicityVtx(Int_t i, TH2F* const hist) { fMultiplicityVtx[i] = hist; }
89 void SetMultiplicityMB(Int_t i, TH2F* const hist) { fMultiplicityMB[i] = hist; }
90 void SetMultiplicityINEL(Int_t i, TH2F* const hist) { fMultiplicityINEL[i] = hist; }
91 void SetMultiplicityNSD(Int_t i, TH2F* const hist) { fMultiplicityNSD[i] = hist; }
92 void SetMultiplicityMC(Int_t i, EventType eventType, TH2F* const hist);
93 void SetCorrelation(Int_t i, TH3F* const hist) { fCorrelation[i] = hist; }
eb9356d5 94 void SetNoVertexEvents(Int_t i, TH1F* hist) { fNoVertexEvents[i] = hist; }
9e190068 95 void SetMultiplicityESDCorrected(Int_t i, TH1F* const hist) { fMultiplicityESDCorrected[i] = hist; }
9ca6be09 96
0427591c 97 void SetGenMeasFromFunc(const TF1* inputMC, Int_t id);
447c325d 98 TH2F* CalculateMultiplicityESD(TH1* inputMC, Int_t correlationMap);
eb9356d5 99
100 void FixTriggerEfficiencies(Int_t start);
101
102 TH1* GetConvoluted(Int_t i, EventType eventType);
103 TH1* GetResiduals(Int_t i, EventType eventType, Float_t& residualSum);
3602328d 104
9e190068 105 void GetComparisonResults(Float_t* const mc = 0, Int_t* const mcLimit = 0, Float_t* const residuals = 0, Float_t* const ratioAverage = 0) const;
cfc19dd5 106
0b4bfd98 107 TH1* GetEfficiency(Int_t inputRange, EventType eventType);
eb9356d5 108 TH1* GetTriggerEfficiency(Int_t inputRange, EventType eventType);
0b4bfd98 109
110 static void SetQualityRegions(Bool_t SPDStudy);
6d81c2de 111 Float_t GetQuality(Int_t region) const { return fQuality[region]; }
0b4bfd98 112
0427591c 113 void FFT(Int_t dir, Int_t m, Double_t *x, Double_t *y) const;
eb9356d5 114
115 Float_t GetVertexBegin(Int_t i) { return fgVtxRangeBegin[i]; }
116 Float_t GetVertexEnd(Int_t i) { return fgVtxRangeEnd[i]; }
117
118 void SetVertexRange(Int_t begin, Int_t end) { fVtxBegin = begin; fVtxEnd = end; }
0a173978 119
0b4bfd98 120 protected:
19442b86 121 void SetupCurrentHists(Int_t inputRange, Bool_t fullPhaseSpace, EventType eventType);
cfc19dd5 122
0427591c 123 Float_t BayesCovarianceDerivate(Float_t matrixM[251][251], const TH2* hResponse, Int_t k, Int_t i, Int_t r, Int_t u);
19442b86 124
7307d52c 125 TH1* fCurrentESD; //! current input esd
19442b86 126 TH2* fCurrentCorrelation; //! current correlation
7307d52c 127 TH1* fCurrentEfficiency; //! current efficiency
9ca6be09 128
b3b260d1 129 TH2F* fMultiplicityESD[kESDHists]; // multiplicity histogram: vtx vs multiplicity; array: |eta| < 0.5, 1.0, 1.4 (0..2)
eb9356d5 130 TH1F* fTriggeredEvents[kESDHists]; // (raw) multiplicity distribution of triggered events; array: |eta| < 0.5, 1.0, 1.4 (0..2)
131 TH1F* fNoVertexEvents[kESDHists]; // distribution of true multiplicity just of triggered events without vertex or with 0 tracklets; array: |eta| < 0.5, 1.0, 1.4 (0..2)
6d81c2de 132
b3b260d1 133 TH2F* fMultiplicityVtx[kMCHists]; // multiplicity histogram of events that have a reconstructed vertex : vtx vs multiplicity; array: |eta| < 0.5, 1.0, 1.4, inf (0..3)
134 TH2F* fMultiplicityMB[kMCHists]; // multiplicity histogram of triggered events : vtx vs multiplicity; array: |eta| < 0.5, 1.0, 1.4, inf (0..3)
135 TH2F* fMultiplicityINEL[kMCHists]; // multiplicity histogram of all (inelastic) events : vtx vs multiplicity; array: |eta| < 0.5, 1.0, 1.4, inf (0..3)
136 TH2F* fMultiplicityNSD[kMCHists]; // multiplicity histogram of NSD events : vtx vs multiplicity; array: |eta| < 0.5, 1.0, 1.4, inf (0..3)
0a173978 137
b3b260d1 138 TH3F* fCorrelation[kCorrHists]; // vtx vs. (gene multiplicity (trig+vtx)) vs. (meas multiplicity); array: |eta| < 0.5, 1, 1.4, (0..2 and 3..5), the first corrects to the eta range itself, the second to full phase space
6d81c2de 139
0a173978 140 TH1F* fMultiplicityESDCorrected[kCorrHists]; // corrected histograms
eb9356d5 141
0f67a57c 142 Int_t fLastBinLimit; //! last bin limit, determined in SetupCurrentHists()
6d81c2de 143 Float_t fLastChi2MC; //! last Chi2 between MC and unfolded ESD (calculated in DrawComparison)
144 Int_t fLastChi2MCLimit; //! bin where the last chi2 breached a certain threshold, used to evaluate the multiplicity reach (calc. in DrawComparison)
145 Float_t fLastChi2Residuals; //! last Chi2 of the ESD and the folded unfolded ESD (calculated in DrawComparison)
146 Float_t fRatioAverage; //! last average of |ratio-1| where ratio = unfolded / mc (bin 2..150)
eb9356d5 147
148 Int_t fVtxBegin; //! vertex range for analysis
149 Int_t fVtxEnd; //! vertex range for analysis
150
151 static Double_t fgVtxRangeBegin[kESDHists]; //! begin of allowed vertex range for this eta bin
152 static Double_t fgVtxRangeEnd[kESDHists]; //! end of allowed vertex range for this eta bin
0b4bfd98 153
6d81c2de 154 static Int_t fgQualityRegionsB[kQualityRegions]; //! begin, given in multiplicity units
155 static Int_t fgQualityRegionsE[kQualityRegions]; //! end
156 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 157
0a173978 158 private:
159 AliMultiplicityCorrection(const AliMultiplicityCorrection&);
160 AliMultiplicityCorrection& operator=(const AliMultiplicityCorrection&);
161
eb9356d5 162 ClassDef(AliMultiplicityCorrection, 7);
0a173978 163};
164
165#endif
0f81f352 166