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