1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. */
2 /* See cxx source for full Copyright notice */
5 #ifndef ALIANALYSISTASKRHOVNMODULATION_H
6 #define ALIANALYSISTASKRHOVNMODULATION_H
8 #include <AliAnalysisTaskEmcalJet.h>
9 #include <AliEmcalJet.h>
10 #include <AliVEvent.h>
11 #include <AliVTrack.h>
12 #include <AliVCluster.h>
13 #include <TClonesArray.h>
21 class AliLocalRhoParameter;
23 class AliAnalysisTaskRhoVnModulation : public AliAnalysisTaskEmcalJet
27 enum fitModulationType { kNoFit, kV2, kV3, kCombined, kFourierSeries, kIntegratedFlow, kQC2, kQC4 }; // fit type
28 enum qcRecovery { kFixedRho, kNegativeVn, kTryFit }; // how to deal with negative cn value for qcn value
29 enum runModeType { kLocal, kGrid }; // run mode type
30 enum dataType { kESD, kAOD, kESDMC, kAODMC }; // data type
31 enum detectorType { kTPC, kVZEROA, kVZEROC, kVZEROComb}; // detector that was used
32 // constructors, destructor
33 AliAnalysisTaskRhoVnModulation();
34 AliAnalysisTaskRhoVnModulation(const char *name, runModeType type);
35 virtual ~AliAnalysisTaskRhoVnModulation();
37 // setting up the task and technical aspects
38 Bool_t InitializeAnalysis();
39 virtual void UserCreateOutputObjects();
41 TH1F* BookTH1F(const char* name, const char* x, Int_t bins, Double_t min, Double_t max, Int_t c = -1, Bool_t append = kTRUE);
42 TH2F* BookTH2F(const char* name, const char* x, const char* y, Int_t binsx, Double_t minx, Double_t maxx, Int_t binsy, Double_t miny, Double_t maxy, Int_t c = -1, Bool_t append = kTRUE);
43 /* inline */ Double_t PhaseShift(Double_t x) const {
44 while (x>=TMath::TwoPi())x-=TMath::TwoPi();
45 while (x<0.)x+=TMath::TwoPi();
47 /* inline */ Double_t PhaseShift(Double_t x, Double_t n) const {
49 if(TMath::Nint(n)==2) while (x>TMath::Pi()) x-=TMath::Pi();
50 if(TMath::Nint(n)==3) {
51 if(x>2.*TMath::TwoPi()/n) x = TMath::TwoPi() - x;
52 if(x>TMath::TwoPi()/n) x = TMath::TwoPi()-(x+TMath::TwoPi()/n);
55 /* inline */ Double_t ChiSquarePDF(Int_t ndf, Double_t x) const {
56 Double_t n(ndf/2.), denom(TMath::Power(2, n)*TMath::Gamma(n));
57 if (denom!=0) return ((1./denom)*TMath::Power(x, n-1)*TMath::Exp(-x/2.));
59 // note that the cdf of the chisquare distribution is the normalized lower incomplete gamma function
60 /* inline */ Double_t ChiSquareCDF(Int_t ndf, Double_t x) const { return TMath::Gamma(ndf/2., x/2.); }
61 // setters - analysis setup
62 void SetDebugMode(Int_t d) {fDebug = d;}
63 void SetAttachToEvent(Bool_t b) {fAttachToEvent = b;}
64 void SetFillHistograms(Bool_t b) {fFillHistograms = b;}
65 void SetFillQAHistograms(Bool_t qa) {fFillQAHistograms = qa;}
66 void SetReduceBinsXYByFactor(Int_t x, Int_t y) {fReduceBinsXByFactor = x;
67 fReduceBinsYByFactor = y;}
68 void SetNoEventWeightsForQC(Bool_t e) {fNoEventWeightsForQC = e;}
69 void SetCentralityClasses(TArrayI* c) {fCentralityClasses = c;}
70 void SetPtBinsHybrids(TArrayD* p) {fPtBinsHybrids = p;}
71 void SetPtBinsJets(TArrayD* p) {fPtBinsJets = p;}
72 void SetIntegratedFlow(TH1F* i, TH1F* j) {fUserSuppliedV2 = i;
73 fUserSuppliedV3 = j; }
74 void SetOnTheFlyResCorrection(TH1F* r2, TH1F* r3) {fUserSuppliedR2 = r2;
75 fUserSuppliedR3 = r3; }
76 void SetNameJetClones(const char* name) {fNameJetClones = name; }
77 void SetNamePicoTrackClones(const char* name) {fNamePicoTrackClones = name; }
78 void SetNameRho(const char* name) {fNameRho = name; }
79 void SetLocalRhoName(TString name) {fLocalRhoName = name; }
80 void SetRandomSeed(TRandom3* r) {if (fRandom) delete fRandom; fRandom = r; }
81 void SetModulationFit(TF1* fit) {if (fFitModulation) delete fFitModulation;
82 fFitModulation = fit; }
83 void SetModulationFitMinMaxP(Float_t m, Float_t n) {fMinPvalue = m; fMaxPvalue = n; }
84 void SetModulationFitType(fitModulationType type) {fFitModulationType = type; }
85 void SetQCnRecoveryType(qcRecovery type) {fQCRecovery = type; }
86 void SetModulationFitOptions(TString opt) {fFitModulationOptions = opt; }
87 void SetReferenceDetector(detectorType type) {fDetectorType = type; }
88 void SetUsePtWeight(Bool_t w) {fUsePtWeight = w; }
89 void SetRunModeType(runModeType type) {fRunModeType = type; }
90 void SetAbsVertexZ(Float_t v) {fAbsVertexZ = v; }
91 void SetMinDistanceRctoLJ(Float_t m) {fMinDisanceRCtoLJ = m; }
92 void SetRandomConeRadius(Float_t r) {fRandomConeRadius = r; }
93 void SetMinLeadingHadronPt(Double_t m) {fMinLeadingHadronPt = m; }
94 void SetSetPtSub(Bool_t s) {fSubtractJetPt = s;}
95 void SetForceAbsVnHarmonics(Bool_t f) {fAbsVnHarmonics = f; }
96 void SetExcludeLeadingJetsFromFit(Float_t n) {fExcludeLeadingJetsFromFit = n; }
97 void SetRebinSwapHistoOnTheFly(Bool_t r) {fRebinSwapHistoOnTheFly = r; }
98 void SetSaveThisPercentageOfFits(Float_t p) {fPercentageOfFits = p; }
99 void SetUseV0EventPlaneFromHeader(Bool_t h) {fUseV0EventPlaneFromHeader = h;}
100 void SetExplicitOutlierCutForYear(Int_t y) {fExplicitOutlierCut = y;}
101 // getters - these are used as well by AliAnalyisTaskJetFlow, so be careful when changing them
102 TString GetJetsName() const {return fJetsName; }
103 TString GetTracksName() const {return fTracksName; }
104 TString GetLocalRhoName() const {return fLocalRhoName; }
105 TArrayI* GetCentralityClasses() const {return fCentralityClasses;}
106 TArrayD* GetPtBinsHybrids() const {return fPtBinsHybrids; }
107 TArrayD* GetPtBinsJets() const {return fPtBinsJets; }
108 TProfile* GetResolutionParameters(Int_t h, Int_t c) const {return (h==2) ? fProfV2Resolution[c] : fProfV3Resolution[c];}
109 TList* GetOutputList() const {return fOutputList;}
110 AliLocalRhoParameter* GetLocalRhoParameter() const {return fLocalRho;}
111 Double_t GetJetRadius() const {return fJetRadius;}
112 void ExecMe() {ExecOnce();}
113 AliAnalysisTaskRhoVnModulation* ReturnMe() {return this;}
115 void SetLocalJetMinMaxEta(Float_t min, Float_t max) {fLocalJetMinEta = min; fLocalJetMaxEta = max;}
116 void SetLocalJetMinMaxEta(Float_t R) {fLocalJetMinEta = - 0.9 + R; fLocalJetMaxEta = 0.9 - R; }
117 void SetLocalJetMinMaxPhi(Float_t min, Float_t max) {fLocalJetMinPhi = min; fLocalJetMaxEta = max;}
118 void SetSoftTrackMinMaxPt(Float_t min, Float_t max) {fSoftTrackMinPt = min; fSoftTrackMaxPt = max;}
119 // numerical evaluations
120 void CalculateEventPlaneVZERO(Double_t vzero[2][2]) const;
121 void CalculateEventPlaneTPC(Double_t* tpc);
122 void CalculateEventPlaneCombinedVZERO(Double_t* comb) const;
123 void CalculateEventPlaneResolution(Double_t vzero[2][2], Double_t* tpc) const;
124 Double_t CalculateEventPlaneChi(Double_t resEP) const;
125 void CalculateRandomCone(Float_t &pt, Float_t &eta, Float_t &phi, AliEmcalJet* jet = 0x0, Bool_t randomize = 0) const;
126 Double_t CalculateQC2(Int_t harm);
127 Double_t CalculateQC4(Int_t harm);
128 // helper calculations for the q-cumulant analysis, also used by AliAnalyisTaskJetFlow
129 void QCnQnk(Int_t n, Int_t k, Double_t &reQ, Double_t &imQ);
130 void QCnDiffentialFlowVectors(
131 TClonesArray* pois, TArrayD* ptBins, Bool_t vpart, Double_t* repn, Double_t* impn,
132 Double_t *mp, Double_t *reqn, Double_t *imqn, Double_t* mq, Int_t n);
133 Double_t QCnS(Int_t i, Int_t j);
137 Bool_t QCnRecovery(Double_t psi2, Double_t psi3);
139 Bool_t CorrectRho(Double_t psi2, Double_t psi3);
140 // event and track selection, also used by AliAnalyisTaskJetFlow
141 /* inline */ Bool_t PassesCuts(const AliVTrack* track) const {
142 if(!track) return kFALSE;
143 return (track->Pt() < fTrackPtCut || track->Eta() < fTrackMinEta || track->Eta() > fTrackMaxEta || track->Phi() < fTrackMinPhi || track->Phi() > fTrackMaxPhi) ? kFALSE : kTRUE; }
144 /* inline */ Bool_t PassesCuts(AliEmcalJet* jet) const {
145 if(!jet || fJetRadius <= 0) return kFALSE;
146 return (GetLeadingHadronPt(jet) < fMinLeadingHadronPt || jet->Pt() < fJetPtCut || jet->Area()/(fJetRadius*fJetRadius*TMath::Pi()) < fPercAreaCut || jet->Eta() < fJetMinEta || jet->Eta() > fJetMaxEta || jet->Phi() < fJetMinPhi || jet->Phi() > fJetMaxPhi) ? kFALSE : kTRUE; }
147 Bool_t PassesCuts(AliVEvent* event);
148 Bool_t PassesCuts(Int_t year);
149 Bool_t PassesCuts(const AliVCluster* track) const;
150 // filling histograms
151 void FillHistogramsAfterSubtraction(Double_t vzero[2][2], Double_t* tpc) const;
152 void FillTrackHistograms() const;
153 void FillClusterHistograms() const;
154 void FillCorrectedClusterHistograms() const;
155 void FillEventPlaneHistograms(Double_t vzero[2][2], Double_t* tpc) const;
156 void FillRhoHistograms() const;
157 void FillDeltaPtHistograms(Double_t vzero[2][2], Double_t* tpc) const;
158 void FillJetHistograms(Double_t vzero[2][2], Double_t* psi) const;
159 void FillDeltaPhiHistograms(Double_t vzero[2][2], Double_t* tpc) const;
160 void FillQAHistograms(AliVTrack* vtrack) const;
161 void FillQAHistograms(AliVEvent* vevent);
162 void FillAnalysisSummaryHistogram() const;
163 virtual void Terminate(Option_t* option);
164 // interface methods for the output file
165 void SetOutputList(TList* l) {fOutputList = l;}
166 TH1F* GetResolutionFromOuptutFile(detectorType detector, Int_t h = 2, TArrayD* c = 0x0);
167 TH1F* CorrectForResolutionDiff(TH1F* v, detectorType detector, TArrayD* cen, Int_t c, Int_t h = 2);
168 TH1F* CorrectForResolutionInt(TH1F* v, detectorType detector, TArrayD* cen, Int_t h = 2);
169 TH1F* GetDifferentialQC(TProfile* refCumulants, TProfile* diffCumlants, TArrayD* ptBins, Int_t h);
171 // analysis flags and settings
172 Int_t fDebug; // debug level (0 none, 1 fcn calls, 2 verbose)
173 Bool_t fLocalInit; //! is the analysis initialized?
174 Bool_t fAttachToEvent; // attach local rho to the event
175 Bool_t fFillHistograms; // fill histograms
176 Bool_t fFillQAHistograms; // fill qa histograms
177 Int_t fReduceBinsXByFactor; // reduce the bins on x-axis of histo's by this integer
178 Int_t fReduceBinsYByFactor; // reduce the bins on y-axis of histo's by this integer
179 Bool_t fNoEventWeightsForQC; // don't store event weights for qc analysis
180 TArrayI* fCentralityClasses; //-> centrality classes (maximum 10)
181 TArrayD* fPtBinsHybrids; //-> pt bins for hybrid track vn anaysis
182 TArrayD* fPtBinsJets; //-> pt bins for jet vn analysis
183 TH1F* fUserSuppliedV2; // histo with integrated v2
184 TH1F* fUserSuppliedV3; // histo with integrated v3
185 TH1F* fUserSuppliedR2; // correct the extracted v2 with this r
186 TH1F* fUserSuppliedR3; // correct the extracted v3 with this r
188 TString fLocalRhoName; // local rho name
189 Int_t fNAcceptedTracks; //! number of accepted tracks
190 Int_t fNAcceptedTracksQCn; //! accepted tracks for QCn
191 fitModulationType fFitModulationType; // fit modulation type
192 qcRecovery fQCRecovery; // recovery type for e-by-e qc method
193 Bool_t fUsePtWeight; // use dptdphi instead of dndphi
194 detectorType fDetectorType; // type of detector used for modulation fit
195 TString fFitModulationOptions; // fit options for modulation fit
196 runModeType fRunModeType; // run mode type
197 dataType fDataType; // datatype
198 TRandom3* fRandom; //-> dont use gRandom to not interfere with other tasks
199 Int_t fMappedRunNumber; //! mapped runnumer (for QA)
200 Int_t fInCentralitySelection; //! centrality bin
201 TF1* fFitModulation; //-> modulation fit for rho
202 Float_t fMinPvalue; // minimum value of p
203 Float_t fMaxPvalue; // maximum value of p
204 const char* fNameJetClones; //! collection of tclones array with jets
205 const char* fNamePicoTrackClones; //! collection of tclones with pico tracks
206 const char* fNameRho; //! name of rho
207 AliLocalRhoParameter* fLocalRho; //! local rho
208 // additional jet cuts (most are inherited)
209 Float_t fLocalJetMinEta; // local eta cut for jets
210 Float_t fLocalJetMaxEta; // local eta cut for jets
211 Float_t fLocalJetMinPhi; // local phi cut for jets
212 Float_t fLocalJetMaxPhi; // local phi cut for jets
213 Float_t fSoftTrackMinPt; // min pt for soft tracks
214 Float_t fSoftTrackMaxPt; // max pt for soft tracks
216 Float_t fAbsVertexZ; // cut on zvertex
217 // general qa histograms
218 TH1F* fHistCentrality; //! accepted centrality
219 TH1F* fHistVertexz; //! accepted verte
220 TH2F* fHistRunnumbersPhi; //! run numbers averaged phi
221 TH2F* fHistRunnumbersEta; //! run numbers averaged eta
222 TH1F* fHistPvaluePDF; //! pdf value of chisquare p
223 TH1F* fHistPvalueCDF; //! cdf value of chisquare p
225 Float_t fMinDisanceRCtoLJ; // min distance between rc and leading jet
226 Float_t fRandomConeRadius; // radius of random cone
227 Bool_t fAbsVnHarmonics; // force postive local rho
228 Float_t fExcludeLeadingJetsFromFit; // exclude n leading jets from fit
229 Bool_t fRebinSwapHistoOnTheFly; // rebin swap histo on the fly
230 Float_t fPercentageOfFits; // save this percentage of fits
231 Bool_t fUseV0EventPlaneFromHeader; // use the vzero event plane from the header
232 Int_t fExplicitOutlierCut; // cut on correlation of tpc and global multiplicity
233 Double_t fMinLeadingHadronPt; // minimum pt for leading hadron
234 Bool_t fSubtractJetPt; // save subtracted jet pt by calling SetPtSub
235 // transient object pointers
236 TList* fOutputList; //! output list
237 TList* fOutputListGood; //! output list for local analysis
238 TList* fOutputListBad; //! output list for local analysis
239 TH1F* fHistAnalysisSummary; //! analysis summary
240 TH1F* fHistSwap; //! swap histogram
241 TProfile* fProfV2; //! extracted v2
242 TProfile* fProfV2Cumulant; //! v2 cumulant
243 TProfile* fProfV2Resolution[10]; //! resolution parameters for v2
244 TProfile* fProfV3; //! extracted v3
245 TProfile* fProfV3Cumulant; //! v3 cumulant
246 TProfile* fProfV3Resolution[10]; //! resolution parameters for v3
247 // qa histograms for accepted pico tracks
248 TH1F* fHistPicoTrackPt[10]; //! pt of all charged tracks
249 TH1F* fHistPicoTrackMult[10]; //! multiplicity of accepted pico tracks
250 TH2F* fHistPicoCat1[10]; //! pico tracks spd hit and refit
251 TH2F* fHistPicoCat2[10]; //! pico tracks wo spd hit w refit, constrained
252 TH2F* fHistPicoCat3[10]; //! pico tracks wo spd hit wo refit, constrained
253 // qa histograms for accepted emcal clusters
254 /* TH1F* fHistClusterPt[10]; //! pt uncorrected emcal clusters */
255 /* TH1F* fHistClusterPhi[10]; //! phi uncorrected emcal clusters */
256 /* TH1F* fHistClusterEta[10]; //! eta uncorrected emcal clusters */
257 // qa histograms for accepted emcal clusters aftehadronic correction
258 /* TH1F* fHistClusterCorrPt[10]; //! pt corrected emcal clusters */
259 /* TH1F* fHistClusterCorrPhi[10]; //! phi corrected emcal clusters */
260 /* TH1F* fHistClusterCorrEta[10]; //! eta corrected emcal clusters */
262 TProfile* fHistPsiControl; //! event plane control histogram
263 TProfile* fHistPsiSpread; //! event plane spread histogram
264 TH1F* fHistPsiVZEROA; //! psi 2 from vzero a
265 TH1F* fHistPsiVZEROC; //! psi 2 from vzero c
266 TH1F* fHistPsiTPC; //! psi 2 from tpc
268 TH1F* fHistRhoPackage[10]; //! rho as estimated by emcal jet package
269 TH1F* fHistRho[10]; //! background
270 TH2F* fHistRhoVsMult; //! rho versus multiplicity
271 TH2F* fHistRhoVsCent; //! rho veruss centrality
272 TH2F* fHistRhoAVsMult; //! rho * A vs multiplicity for all jets
273 TH2F* fHistRhoAVsCent; //! rho * A vs centrality for all jets
274 // delta pt distributions
275 TH2F* fHistRCPhiEta[10]; //! random cone eta and phi
276 TH2F* fHistRhoVsRCPt[10]; //! rho * A vs rcpt
277 TH1F* fHistRCPt[10]; //! rcpt
278 TH2F* fHistDeltaPtDeltaPhi2TPC[10]; //! dpt vs dphi tpc
279 TH2F* fHistDeltaPtDeltaPhi2V0A[10]; //! dpt vs dphi vzeroa
280 TH2F* fHistDeltaPtDeltaPhi2V0C[10]; //! dpt vs dphi vzeroc
281 TH2F* fHistDeltaPtDeltaPhi3TPC[10]; //! dpt vs dphi tpc
282 TH2F* fHistDeltaPtDeltaPhi3V0A[10]; //! dpt vs dphi vzeroa
283 TH2F* fHistDeltaPtDeltaPhi3V0C[10]; //! dpt vs dphi vzeroc
284 TH2F* fHistRCPhiEtaExLJ[10]; //! random cone eta and phi, excl leading jet
285 TH2F* fHistRhoVsRCPtExLJ[10]; //! rho * A vs rcpt, excl leading jet
286 TH1F* fHistRCPtExLJ[10]; //! rcpt, excl leading jet
287 TH2F* fHistDeltaPtDeltaPhi2ExLJTPC[10]; //! dpt vs dphi, excl leading jet
288 TH2F* fHistDeltaPtDeltaPhi2ExLJV0A[10]; //! dpt vs dphi, excl leading jet
289 TH2F* fHistDeltaPtDeltaPhi2ExLJV0C[10]; //! dpt vs dphi, excl leading jet
290 TH2F* fHistDeltaPtDeltaPhi3ExLJTPC[10]; //! dpt vs dphi, excl leading jet
291 TH2F* fHistDeltaPtDeltaPhi3ExLJV0A[10]; //! dpt vs dphi, excl leading jet
292 TH2F* fHistDeltaPtDeltaPhi3ExLJV0C[10]; //! dpt vs dphi, excl leading jet
293 /* TH2F* fHistRCPhiEtaRand[10]; //! random cone eta and phi, randomized */
294 /* TH2F* fHistRhoVsRCPtRand[10]; //! rho * A vs rcpt, randomized */
295 /* TH1F* fHistRCPtRand[10]; //! rcpt, randomized */
296 /* TH2F* fHistDeltaPtDeltaPhi2Rand[10]; //! dpt vs dphi, randomized */
297 /* TH2F* fHistDeltaPtDeltaPhi3Rand[10]; //! dpt vs dphi, randomized */
298 // jet histograms (after kinematic cuts)
299 TH1F* fHistJetPtRaw[10]; //! jet pt - no background subtraction
300 TH1F* fHistJetPt[10]; //! pt of found jets (background subtracted)
301 TH2F* fHistJetEtaPhi[10]; //! eta and phi correlation
302 TH2F* fHistJetPtArea[10]; //! jet pt versus area
303 TH2F* fHistJetPtConstituents[10]; //! jet pt versus number of constituents
304 TH2F* fHistJetEtaRho[10]; //! jet eta versus jet rho
305 // in plane, out of plane jet spectra
306 TH2F* fHistJetPsiTPCPt[10]; //! psi tpc versus pt
307 TH2F* fHistJetPsiVZEROAPt[10]; //! psi vzeroa versus pt
308 TH2F* fHistJetPsiVZEROCPt[10]; //! psi vzeroc versus pt
310 TH1F* fHistDeltaPhi2VZEROA[10]; //! phi minus psi_A
311 TH1F* fHistDeltaPhi2VZEROC[10]; //! phi minus psi_C
312 TH1F* fHistDeltaPhi2TPC[10]; //! phi minus psi_TPC
313 TH1F* fHistDeltaPhi3VZEROA[10]; //! phi minus psi_A
314 TH1F* fHistDeltaPhi3VZEROC[10]; //! phi minus psi_C
315 TH1F* fHistDeltaPhi3TPC[10]; //! phi minus psi_TPC
317 AliAnalysisTaskRhoVnModulation(const AliAnalysisTaskRhoVnModulation&); // not implemented
318 AliAnalysisTaskRhoVnModulation& operator=(const AliAnalysisTaskRhoVnModulation&); // not implemented
320 ClassDef(AliAnalysisTaskRhoVnModulation, 14);