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>
22 class AliAnalysisTaskRhoVnModulation : public AliAnalysisTaskEmcalJet
26 enum fitModulationType { kNoFit, kV2, kV3, kCombined, kFourierSeries, kIntegratedFlow, kQC2, kQC4 }; // fit type
27 enum runModeType { kLocal, kGrid }; // run mode type
28 enum dataType { kESD, kAOD, kESDMC, kAODMC }; // data type
29 enum detectorType { kTPC, kVZEROA, kVZEROC}; // detector that was used
30 // constructors, destructor
31 AliAnalysisTaskRhoVnModulation();
32 AliAnalysisTaskRhoVnModulation(const char *name, runModeType type);
33 virtual ~AliAnalysisTaskRhoVnModulation();
35 // setting up the task and technical aspects
36 Bool_t InitializeAnalysis();
37 virtual void UserCreateOutputObjects();
39 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);
40 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);
41 /* inline */ Double_t PhaseShift(Double_t x) const {
42 while (x>=TMath::TwoPi())x-=TMath::TwoPi();
43 while (x<0.)x+=TMath::TwoPi();
45 /* inline */ Double_t PhaseShift(Double_t x, Double_t n) const {
47 if(TMath::Nint(n)==2) while (x>TMath::Pi()) x-=TMath::Pi();
48 if(TMath::Nint(n)==3) {
49 if(x>2.*TMath::TwoPi()/n) x = TMath::TwoPi() - x;
50 if(x>TMath::TwoPi()/n) x = TMath::TwoPi()-(x+TMath::TwoPi()/n);
53 /* inline */ Double_t ChiSquarePDF(Int_t ndf, Double_t x) const {
54 Double_t n(ndf/2.), denom(TMath::Power(2, n)*TMath::Gamma(n));
55 if (denom!=0) return ((1./denom)*TMath::Power(x, n-1)*TMath::Exp(-x/2.));
57 // note that the cdf of the chisquare distribution is the normalized lower incomplete gamma function
58 /* inline */ Double_t ChiSquareCDF(Int_t ndf, Double_t x) const { return TMath::Gamma(ndf/2., x/2.); }
59 /* inline */ Double_t RhoVal() const { return (fRho) ? fRho->GetVal(): -999.;}
60 /* inline */ Double_t RhoVal(Double_t phi, Double_t r, Double_t n) const {
61 if(!fFitModulation) return RhoVal(); // coverity
62 switch (fFitModulationType) {
63 case kNoFit : return RhoVal();
65 Double_t denom(2*r*fFitModulation->GetParameter(0));
66 return (denom <= 0.) ? RhoVal() : n*(fFitModulation->Integral(phi-r, phi+r)/denom);
70 // setters - analysis setup
71 void SetDebugMode(Int_t d) {fDebug = d;}
72 void SetFillQAHistograms(Bool_t qa) {fFillQAHistograms = qa;}
73 void SetCentralityClasses(TArrayI* c) {fCentralityClasses = c;}
74 void SetIntegratedFlow(TH1F* i, TH1F* j) {fUserSuppliedV2 = i;
75 fUserSuppliedV3 = j; }
76 void SetOnTheFlyResCorrection(TH1F* r2, TH1F* r3) {fUserSuppliedR2 = r2;
77 fUserSuppliedR3 = r3; }
78 void SetNameJetClones(const char* name) {fNameJetClones = name; }
79 void SetNamePicoTrackClones(const char* name) {fNamePicoTrackClones = name; }
80 void SetNameRho(const char* name) {fNameRho = name; }
81 void SetRandomSeed(TRandom3* r) {if (fRandom) delete fRandom; fRandom = r; }
82 void SetModulationFit(TF1* fit) {if (fFitModulation) delete fFitModulation;
83 fFitModulation = fit; }
84 void SetModulationFitMinMaxP(Float_t m, Float_t n) {fMinPvalue = m; fMaxPvalue = n; }
85 void SetModulationFitType(fitModulationType type) {fFitModulationType = 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 SetForceAbsVnHarmonics(Bool_t f) {fAbsVnHarmonics = f; }
95 void SetExcludeLeadingJetsFromFit(Float_t n) {fExcludeLeadingJetsFromFit = n; }
96 void SetRebinSwapHistoOnTheFly(Bool_t r) {fRebinSwapHistoOnTheFly = r; }
97 void SetSaveThisPercentageOfFits(Float_t p) {fPercentageOfFits = p; }
98 void SetUseV0EventPlaneFromHeader(Bool_t h) {fUseV0EventPlaneFromHeader = h;}
99 void SetSetPtSub(Bool_t s) {fSetPtSub = s; }
100 void SetExplicitOutlierCutForYear(Int_t y) {fExplicitOutlierCut = y;}
102 void SetLocalJetMinMaxEta(Float_t min, Float_t max) {fLocalJetMinEta = min; fLocalJetMaxEta = max;}
103 void SetLocalJetMinMaxEta(Float_t R) {fLocalJetMinEta = - 0.9 + R; fLocalJetMaxEta = 0.9 - R; }
104 void SetLocalJetMinMaxPhi(Float_t min, Float_t max) {fLocalJetMinPhi = min; fLocalJetMaxEta = max;}
105 void SetSoftTrackMinMaxPt(Float_t min, Float_t max) {fSoftTrackMinPt = min; fSoftTrackMaxPt = max;}
106 // numerical evaluations
107 void CalculateEventPlaneVZERO(Double_t vzero[2][2]) const;
108 void CalculateEventPlaneTPC(Double_t* tpc);
109 void CalculateEventPlaneResolution(Double_t vzero[2][2], Double_t* tpc) const;
110 void CalculateRandomCone(Float_t &pt, Float_t &eta, Float_t &phi, AliEmcalJet* jet = 0x0, Bool_t randomize = 0) const;
111 Double_t CalculateQC2(Int_t harm);
112 Double_t CalculateQC4(Int_t harm);
113 // helper calculations for the q-cumulant analysis
114 void QCnQnk(Int_t n, Int_t k, Double_t &reQ, Double_t &imQ);
115 Double_t QCnS(Int_t i, Int_t j);
120 Bool_t CorrectRho(Double_t psi2, Double_t psi3);
121 // event and track selection
122 /* inline */ Bool_t PassesCuts(const AliVTrack* track) const {
123 if(!track) return kFALSE;
124 return (track->Pt() < fTrackPtCut || track->Eta() < fTrackMinEta || track->Eta() > fTrackMaxEta || track->Phi() < fTrackMinPhi || track->Phi() > fTrackMaxPhi) ? kFALSE : kTRUE; }
125 /* inline */ Bool_t PassesCuts(AliEmcalJet* jet) const {
126 if(!jet || fJetRadius <= 0) return kFALSE;
127 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; }
128 Bool_t PassesCuts(AliVEvent* event);
129 Bool_t PassesCuts(Int_t year);
130 Bool_t PassesCuts(const AliVCluster* track) const;
131 // filling histograms
132 void FillHistogramsAfterSubtraction(Double_t vzero[2][2], Double_t* tpc) const;
133 void FillTrackHistograms() const;
134 void FillClusterHistograms() const;
135 void FillCorrectedClusterHistograms() const;
136 void FillEventPlaneHistograms(Double_t vzero[2][2], Double_t* tpc) const;
137 void FillRhoHistograms() const;
138 void FillDeltaPtHistograms(Double_t psi2, Double_t psi3) const;
139 void FillJetHistograms(Double_t vzero[2][2], Double_t* psi) const;
140 void FillDeltaPhiHistograms(Double_t vzero[2][2], Double_t* tpc) const;
141 void FillQAHistograms(AliVTrack* vtrack) const;
142 void FillQAHistograms(AliVEvent* vevent);
143 void FillAnalysisSummaryHistogram() const;
144 virtual void Terminate(Option_t* option);
145 // interface methods for the output file
146 void SetOutputList(TList* l) {fOutputList = l;}
147 TH1F* GetResolutionFromOuptutFile(detectorType detector, Int_t h = 2, TArrayD* c = 0x0);
148 TH1F* CorrectForResolutionDiff(TH1F* v, detectorType detector, TArrayD* cen, Int_t c, Int_t h = 2);
149 TH1F* CorrectForResolutionInt(TH1F* v, detectorType detector, TArrayD* cen, Int_t h = 2);
151 // analysis flags and settings
152 Int_t fDebug; // debug level (0 none, 1 fcn calls, 2 verbose)
153 Bool_t fInitialized; //! is the analysis initialized?
154 Bool_t fFillQAHistograms; // fill qa histograms
155 TArrayI* fCentralityClasses; //-> centrality classes (maximum 10)
156 TH1F* fUserSuppliedV2; // histo with integrated v2
157 TH1F* fUserSuppliedV3; // histo with integrated v3
158 TH1F* fUserSuppliedR2; // correct the extracted v2 with this r
159 TH1F* fUserSuppliedR3; // correct the extracted v3 with this r
161 Int_t fNAcceptedTracks; //! number of accepted tracks
162 Int_t fNAcceptedTracksQCn; //! accepted tracks for QCn
163 fitModulationType fFitModulationType; // fit modulation type
164 Bool_t fUsePtWeight; // use dptdphi instead of dndphi
165 detectorType fDetectorType; // type of detector used for modulation fit
166 TString fFitModulationOptions; // fit options for modulation fit
167 runModeType fRunModeType; // run mode type
168 dataType fDataType; // datatype
169 TRandom3* fRandom; //-> dont use gRandom to not interfere with other tasks
170 Int_t fMappedRunNumber; //! mapped runnumer (for QA)
171 Int_t fInCentralitySelection; //! centrality bin
172 TF1* fFitModulation; //-> modulation fit for rho
173 Float_t fMinPvalue; // minimum value of p
174 Float_t fMaxPvalue; // maximum value of p
175 const char* fNameJetClones; //! collection of tclones array with jets
176 const char* fNamePicoTrackClones; //! collection of tclones with pico tracks
177 const char* fNameRho; //! name of rho
178 // additional jet cuts (most are inherited)
179 Float_t fLocalJetMinEta; // local eta cut for jets
180 Float_t fLocalJetMaxEta; // local eta cut for jets
181 Float_t fLocalJetMinPhi; // local phi cut for jets
182 Float_t fLocalJetMaxPhi; // local phi cut for jets
183 Float_t fSoftTrackMinPt; // min pt for soft tracks
184 Float_t fSoftTrackMaxPt; // max pt for soft tracks
186 Float_t fAbsVertexZ; // cut on zvertex
187 // general qa histograms
188 TH1F* fHistCentrality; //! accepted centrality
189 TH1F* fHistVertexz; //! accepted verte
190 TH2F* fHistRunnumbersPhi; //! run numbers averaged phi
191 TH2F* fHistRunnumbersEta; //! run numbers averaged eta
192 TH1F* fHistPvaluePDF; //! pdf value of chisquare p
193 TH1F* fHistPvalueCDF; //! cdf value of chisquare p
195 Float_t fMinDisanceRCtoLJ; // min distance between rc and leading jet
196 Float_t fRandomConeRadius; // radius of random cone
197 Bool_t fAbsVnHarmonics; // force postive local rho
198 Float_t fExcludeLeadingJetsFromFit; // exclude n leading jets from fit
199 Bool_t fRebinSwapHistoOnTheFly; // rebin swap histo on the fly
200 Float_t fPercentageOfFits; // save this percentage of fits
201 Bool_t fUseV0EventPlaneFromHeader; // use the vzero event plane from the header
202 Bool_t fSetPtSub; // store the subtracted pt in the jet
203 Int_t fExplicitOutlierCut; // cut on correlation of tpc and global multiplicity
204 Double_t fMinLeadingHadronPt; // minimum pt for leading hadron
205 // transient object pointers
206 TList* fOutputList; //! output list
207 TList* fOutputListGood; //! output list for local analysis
208 TList* fOutputListBad; //! output list for local analysis
209 TH1F* fHistAnalysisSummary; //! analysis summary
210 TH1F* fHistSwap; //! swap histogram
211 TProfile* fProfV2; //! extracted v2
212 TProfile* fProfV2Cumulant; //! v2 cumulant
213 TProfile* fProfV2Resolution[10]; //! resolution parameters for v2
214 TProfile* fProfV3; //! extracted v3
215 TProfile* fProfV3Cumulant; //! v3 cumulant
216 TProfile* fProfV3Resolution[10]; //! resolution parameters for v3
217 // qa histograms for accepted pico tracks
218 TH1F* fHistPicoTrackPt[10]; //! pt of all charged tracks
219 TH2F* fHistPicoCat1[10]; //! pico tracks spd hit and refit
220 TH2F* fHistPicoCat2[10]; //! pico tracks wo spd hit w refit, constrained
221 TH2F* fHistPicoCat3[10]; //! pico tracks wo spd hit wo refit, constrained
222 // qa histograms for accepted emcal clusters
223 /* TH1F* fHistClusterPt[10]; //! pt uncorrected emcal clusters */
224 /* TH1F* fHistClusterPhi[10]; //! phi uncorrected emcal clusters */
225 /* TH1F* fHistClusterEta[10]; //! eta uncorrected emcal clusters */
226 // qa histograms for accepted emcal clusters aftehadronic correction
227 /* TH1F* fHistClusterCorrPt[10]; //! pt corrected emcal clusters */
228 /* TH1F* fHistClusterCorrPhi[10]; //! phi corrected emcal clusters */
229 /* TH1F* fHistClusterCorrEta[10]; //! eta corrected emcal clusters */
231 TProfile* fHistPsiControl; //! event plane control histogram
232 TProfile* fHistPsiSpread; //! event plane spread histogram
233 TH1F* fHistPsiVZEROA; //! psi 2 from vzero a
234 TH1F* fHistPsiVZEROC; //! psi 2 from vzero c
235 TH1F* fHistPsiTPC; //! psi 2 from tpc
237 TH1F* fHistRhoPackage[10]; //! rho as estimated by emcal jet package
238 TH1F* fHistRho[10]; //! background
239 TH2F* fHistRhoVsMult; //! rho versus multiplicity
240 TH2F* fHistRhoVsCent; //! rho veruss centrality
241 TH2F* fHistRhoAVsMult; //! rho * A vs multiplicity for all jets
242 TH2F* fHistRhoAVsCent; //! rho * A vs centrality for all jets
243 // delta pt distributions
244 TH2F* fHistRCPhiEta[10]; //! random cone eta and phi
245 TH2F* fHistRhoVsRCPt[10]; //! rho * A vs rcpt
246 TH1F* fHistRCPt[10]; //! rcpt
247 TH2F* fHistDeltaPtDeltaPhi2[10]; //! dpt vs dphi
248 TH2F* fHistDeltaPtDeltaPhi3[10]; //! dpt vs dphi
249 TH2F* fHistRCPhiEtaExLJ[10]; //! random cone eta and phi, excl leading jet
250 TH2F* fHistRhoVsRCPtExLJ[10]; //! rho * A vs rcpt, excl leading jet
251 TH1F* fHistRCPtExLJ[10]; //! rcpt, excl leading jet
252 TH2F* fHistDeltaPtDeltaPhi2ExLJ[10]; //! dpt vs dphi, excl leading jet
253 TH2F* fHistDeltaPtDeltaPhi3ExLJ[10]; //! dpt vs dphi, excl leading jet
254 /* TH2F* fHistRCPhiEtaRand[10]; //! random cone eta and phi, randomized */
255 /* TH2F* fHistRhoVsRCPtRand[10]; //! rho * A vs rcpt, randomized */
256 /* TH1F* fHistRCPtRand[10]; //! rcpt, randomized */
257 /* TH2F* fHistDeltaPtDeltaPhi2Rand[10]; //! dpt vs dphi, randomized */
258 /* TH2F* fHistDeltaPtDeltaPhi3Rand[10]; //! dpt vs dphi, randomized */
259 // jet histograms (after kinematic cuts)
260 TH1F* fHistJetPtRaw[10]; //! jet pt - no background subtraction
261 TH1F* fHistJetPt[10]; //! pt of found jets (background subtracted)
262 TH2F* fHistJetEtaPhi[10]; //! eta and phi correlation
263 TH2F* fHistJetPtArea[10]; //! jet pt versus area
264 TH2F* fHistJetPtConstituents[10]; //! jet pt versus number of constituents
265 TH2F* fHistJetEtaRho[10]; //! jet eta versus jet rho
266 // in plane, out of plane jet spectra
267 TH2F* fHistJetPsiTPCPt[10]; //! psi tpc versus pt
268 TH2F* fHistJetPsiVZEROAPt[10]; //! psi vzeroa versus pt
269 TH2F* fHistJetPsiVZEROCPt[10]; //! psi vzeroc versus pt
271 TH1F* fHistDeltaPhi2VZEROA[10]; //! phi minus psi_A
272 TH1F* fHistDeltaPhi2VZEROC[10]; //! phi minus psi_C
273 TH1F* fHistDeltaPhi2TPC[10]; //! phi minus psi_TPC
274 TH1F* fHistDeltaPhi3VZEROA[10]; //! phi minus psi_A
275 TH1F* fHistDeltaPhi3VZEROC[10]; //! phi minus psi_C
276 TH1F* fHistDeltaPhi3TPC[10]; //! phi minus psi_TPC
278 AliAnalysisTaskRhoVnModulation(const AliAnalysisTaskRhoVnModulation&); // not implemented
279 AliAnalysisTaskRhoVnModulation& operator=(const AliAnalysisTaskRhoVnModulation&); // not implemented
281 ClassDef(AliAnalysisTaskRhoVnModulation, 12);