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, kUser, kFourierSeries }; // fit type
27 enum runModeType { kLocal, kGrid }; // run mode type
28 enum dataType { kESD, kAOD, kESDMC, kAODMC }; // data type
29 enum detectorType { kTPC, kTPCSUB, 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::TwoPi() - x;
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 SetNameJetClones(const char* name) {fNameJetClones = name; }
75 void SetNamePicoTrackClones(const char* name) {fNamePicoTrackClones = name; }
76 void SetNameRho(const char* name) {fNameRho = name; }
77 void SetRandomSeed(TRandom3* r) {if (fRandom) delete fRandom; fRandom = r; }
78 void SetModulationFit(TF1* fit) {if (fFitModulation) delete fFitModulation;
79 fFitModulation = fit; }
80 void SetModulationFitMinMaxP(Float_t m, Float_t n) {fMinPvalue = m; fMaxPvalue = n; }
81 void SetModulationFitType(fitModulationType type) {fFitModulationType = type; }
82 void SetModulationFitOptions(TString opt) {fFitModulationOptions = opt; }
83 void SetReferenceDetector(detectorType type) {fDetectorType = type; }
84 void SetUsePtWeight(Bool_t w) {fUsePtWeight = w; }
85 void SetRunModeType(runModeType type) {fRunModeType = type; }
86 void SetAbsVertexZ(Float_t v) {fAbsVertexZ = v; }
87 void SetMinDistanceRctoLJ(Float_t m) {fMinDisanceRCtoLJ = m; }
88 void SetRandomConeRadius(Float_t r) {fRandomConeRadius = r; }
89 void SetForceAbsVnHarmonics(Bool_t f) {fAbsVnHarmonics = f; }
90 void SetExcludeLeadingJetsFromFit(Float_t n) {fExcludeLeadingJetsFromFit = n; }
91 void SetRebinSwapHistoOnTheFly(Bool_t r) {fRebinSwapHistoOnTheFly = r; }
92 void SetSaveThisPercentageOfFits(Float_t p) {fPercentageOfFits = p; }
93 void SetUseV0EventPlaneFromHeader(Bool_t h) {fUseV0EventPlaneFromHeader = h;}
94 void SetSetPtSub(Bool_t s) {fSetPtSub = s; }
95 // 'trivial' helper calculations
96 void CalculateEventPlaneVZERO(Double_t vzero[2][2]) const;
97 void CalculateEventPlaneTPC(Double_t* tpc);
98 void CalculateEventPlaneResolution(Double_t vzero[2][2], Double_t* tpc) const;
99 void CalculateRandomCone(Float_t &pt, Float_t &eta, Float_t &phi, AliEmcalJet* jet = 0x0, Bool_t randomize = 0) const;
101 Bool_t CorrectRho(Double_t* params, Double_t psi2, Double_t psi3, Double_t psi2b, Double_t psi3b);
102 // event and track selection
103 /* inline */ Bool_t PassesCuts(const AliVTrack* track) const {
104 if(!track) return kFALSE;
105 return (track->Pt() < fTrackPtCut || track->Eta() < fTrackMinEta || track->Eta() > fTrackMaxEta || track->Phi() < fTrackMinPhi || track->Phi() > fTrackMaxPhi) ? kFALSE : kTRUE; }
106 /* inline */ Bool_t PassesCuts(const AliEmcalJet* jet) const {
107 if(!jet || fJetRadius <= 0) return kFALSE;
108 return (jet->Pt() < fJetPtCut || jet->Area()/(fJetRadius*fJetRadius*TMath::Pi()) < fPercAreaCut || jet->Eta() < fJetMinEta || jet->Eta() > fJetMaxEta || jet->Phi() < fJetMinPhi || jet->Phi() > fJetMaxPhi) ? kFALSE : kTRUE; }
109 Bool_t PassesCuts(AliVEvent* event);
110 Bool_t PassesCuts(const AliVCluster* track) const;
111 // filling histograms
112 void FillHistogramsAfterSubtraction(Double_t vzero[2][2], Double_t* tpc) const;
113 void FillTrackHistograms() const;
114 void FillClusterHistograms() const;
115 void FillCorrectedClusterHistograms() const;
116 void FillEventPlaneHistograms(Double_t vzero[2][2], Double_t* tpc) const;
117 void FillRhoHistograms() const;
118 void FillDeltaPtHistograms(Double_t psi2, Double_t psi3) const;
119 void FillJetHistograms(Double_t vzero[2][2], Double_t* psi) const;
120 void FillDeltaPhiHistograms(Double_t vzero[2][2], Double_t* tpc) const;
121 void FillQAHistograms(AliVTrack* vtrack) const;
122 void FillQAHistograms(AliVEvent* vevent);
123 virtual void Terminate(Option_t* option);
125 // analysis flags and settings
126 Int_t fDebug; // debug level (0 none, 1 fcn calls, 2 verbose)
127 Bool_t fInitialized; //! is the analysis initialized?
128 Bool_t fFillQAHistograms; // fill qa histograms
129 TArrayI* fCentralityClasses; //-> centrality classes (maximum 10)
131 Int_t fNAcceptedTracks; //! number of accepted tracks
132 fitModulationType fFitModulationType; // fit modulation type
133 Bool_t fUsePtWeight; // use dptdphi instead of dndphi
134 detectorType fDetectorType; // type of detector used for modulation fit
135 TString fFitModulationOptions; // fit options for modulation fit
136 runModeType fRunModeType; // run mode type
137 dataType fDataType; // datatype
138 TRandom3* fRandom; //-> dont use gRandom to not interfere with other tasks
139 Int_t fMappedRunNumber; //! mapped runnumer (for QA)
140 Int_t fInCentralitySelection; //! centrality bin
141 TF1* fFitModulation; //-> modulation fit for rho
142 Float_t fMinPvalue; // minimum value of p
143 Float_t fMaxPvalue; // maximum value of p
144 const char* fNameJetClones; //! collection of tclones array with jets
145 const char* fNamePicoTrackClones; //! collection of tclones with pico tracks
146 const char* fNameRho; //! name of rho
148 Float_t fAbsVertexZ; // cut on zvertex
149 // general qa histograms
150 TH1F* fHistCentrality; //! accepted centrality
151 TH1F* fHistVertexz; //! accepted verte
152 TH2F* fHistRunnumbersPhi; //! run numbers averaged phi
153 TH2F* fHistRunnumbersEta; //! run numbers averaged eta
154 TH1F* fHistPvaluePDF; //! pdf value of chisquare p
155 TH1F* fHistPvalueCDF; //! cdf value of chisquare p
157 Float_t fMinDisanceRCtoLJ; // min distance between rc and leading jet
158 Float_t fRandomConeRadius; // radius of random cone
159 Bool_t fAbsVnHarmonics; // force postive local rho
160 Float_t fExcludeLeadingJetsFromFit; // exclude n leading jets from fit
161 Bool_t fRebinSwapHistoOnTheFly; // rebin swap histo on the fly
162 Float_t fPercentageOfFits; // save this percentage of fits
163 Bool_t fUseV0EventPlaneFromHeader; // use the vzero event plane from the header
164 Bool_t fSetPtSub; // store the subtracted pt in the jet
165 // transient object pointers
166 TList* fOutputList; //! output list
167 TList* fOutputListGood; //! output list for local analysis
168 TList* fOutputListBad; //! output list for local analysis
169 TH1F* fHistAnalysisSummary; //! analysis summary
170 TH1F* fHistSwap; //! swap histogram
171 TProfile* fProfV2; //! extracted v2
172 TProfile* fProfV2Resolution[10]; //! resolution parameters for v2
173 TProfile* fProfV3; //! extracted v3
174 TProfile* fProfV3Resolution[10]; //! resolution parameters for v3
175 // qa histograms for accepted pico tracks
176 TH1F* fHistPicoTrackPt[10]; //! pt of all charged tracks
177 TH2F* fHistPicoCat1[10]; //! pico tracks spd hit and refit
178 TH2F* fHistPicoCat2[10]; //! pico tracks wo spd hit w refit, constrained
179 TH2F* fHistPicoCat3[10]; //! pico tracks wo spd hit wo refit, constrained
180 // qa histograms for accepted emcal clusters
181 /* TH1F* fHistClusterPt[10]; //! pt uncorrected emcal clusters */
182 /* TH1F* fHistClusterPhi[10]; //! phi uncorrected emcal clusters */
183 /* TH1F* fHistClusterEta[10]; //! eta uncorrected emcal clusters */
184 // qa histograms for accepted emcal clusters aftehadronic correction
185 /* TH1F* fHistClusterCorrPt[10]; //! pt corrected emcal clusters */
186 /* TH1F* fHistClusterCorrPhi[10]; //! phi corrected emcal clusters */
187 /* TH1F* fHistClusterCorrEta[10]; //! eta corrected emcal clusters */
189 TProfile* fHistPsiControl; //! event plane control histogram
190 TProfile* fHistPsiSpread; //! event plane spread histogram
191 TH1F* fHistPsiVZEROA; //! psi 2 from vzero a
192 TH1F* fHistPsiVZEROC; //! psi 2 from vzero c
193 TH1F* fHistPsiTPC; //! psi 2 from tpc
194 TH1F* fHistPsiTPCSUBA; //! psi 2 from tpc subevent a
195 TH1F* fHistPsiTPCSUBB; //! psi 2 from tpc subevent b
197 TH1F* fHistRhoPackage[10]; //! rho as estimated by emcal jet package
198 TH1F* fHistRho[10]; //! background
199 TH2F* fHistRhoVsMult; //! rho versus multiplicity
200 TH2F* fHistRhoVsCent; //! rho veruss centrality
201 TH2F* fHistRhoAVsMult; //! rho * A vs multiplicity for all jets
202 TH2F* fHistRhoAVsCent; //! rho * A vs centrality for all jets
203 // delta pt distributions
204 TH2F* fHistRCPhiEta[10]; //! random cone eta and phi
205 TH2F* fHistRhoVsRCPt[10]; //! rho * A vs rcpt
206 TH1F* fHistRCPt[10]; //! rcpt
207 TH2F* fHistDeltaPtDeltaPhi2[10]; //! dpt vs dphi
208 TH2F* fHistDeltaPtDeltaPhi3[10]; //! dpt vs dphi
209 TH2F* fHistRCPhiEtaExLJ[10]; //! random cone eta and phi, excl leading jet
210 TH2F* fHistRhoVsRCPtExLJ[10]; //! rho * A vs rcpt, excl leading jet
211 TH1F* fHistRCPtExLJ[10]; //! rcpt, excl leading jet
212 TH2F* fHistDeltaPtDeltaPhi2ExLJ[10]; //! dpt vs dphi, excl leading jet
213 TH2F* fHistDeltaPtDeltaPhi3ExLJ[10]; //! dpt vs dphi, excl leading jet
214 /* TH2F* fHistRCPhiEtaRand[10]; //! random cone eta and phi, randomized */
215 /* TH2F* fHistRhoVsRCPtRand[10]; //! rho * A vs rcpt, randomized */
216 /* TH1F* fHistRCPtRand[10]; //! rcpt, randomized */
217 /* TH2F* fHistDeltaPtDeltaPhi2Rand[10]; //! dpt vs dphi, randomized */
218 /* TH2F* fHistDeltaPtDeltaPhi3Rand[10]; //! dpt vs dphi, randomized */
219 // jet histograms (after kinematic cuts)
220 TH1F* fHistJetPtRaw[10]; //! jet pt - no background subtraction
221 TH1F* fHistJetPt[10]; //! pt of found jets (background subtracted)
222 TH2F* fHistJetEtaPhi[10]; //! eta and phi correlation
223 TH2F* fHistJetPtArea[10]; //! jet pt versus area
224 TH2F* fHistJetPtConstituents[10]; //! jet pt versus number of constituents
225 TH2F* fHistJetEtaRho[10]; //! jet eta versus jet rho
226 // in plane, out of plane jet spectra
227 TH2F* fHistJetPsiTPCPt[10]; //! psi tpc versus pt
228 TH2F* fHistJetPsiVZEROAPt[10]; //! psi vzeroa versus pt
229 TH2F* fHistJetPsiVZEROCPt[10]; //! psi vzeroc versus pt
231 TH1F* fHistDeltaPhi2VZEROA[10]; //! phi minus psi_A
232 TH1F* fHistDeltaPhi2VZEROC[10]; //! phi minus psi_C
233 TH1F* fHistDeltaPhi2TPC[10]; //! phi minus psi_TPC
234 TH1F* fHistDeltaPhi3VZEROA[10]; //! phi minus psi_A
235 TH1F* fHistDeltaPhi3VZEROC[10]; //! phi minus psi_C
236 TH1F* fHistDeltaPhi3TPC[10]; //! phi minus psi_TPC
238 AliAnalysisTaskRhoVnModulation(const AliAnalysisTaskRhoVnModulation&); // not implemented
239 AliAnalysisTaskRhoVnModulation& operator=(const AliAnalysisTaskRhoVnModulation&); // not implemented
241 ClassDef(AliAnalysisTaskRhoVnModulation, 7);