]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskRhoVnModulation.h
From Marta and Redmer:
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / UserTasks / AliAnalysisTaskRhoVnModulation.h
CommitLineData
38d2189d 1/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. */
2/* See cxx source for full Copyright notice */
3/* $Id$ */
4
5#ifndef ALIANALYSISTASKRHOVNMODULATION_H
6#define ALIANALYSISTASKRHOVNMODULATION_H
7
9e5eee5d 8#include <AliAnalysisTaskEmcalJetDev.h>
38d2189d 9#include <AliEmcalJet.h>
10#include <AliVEvent.h>
11#include <AliVTrack.h>
12#include <AliVCluster.h>
13#include <TClonesArray.h>
14#include <TMath.h>
847e45e0 15#include <TRandom3.h>
9e5eee5d 16#include <AliJetContainer.h>
38d2189d 17
18class TF1;
19class THF1;
20class THF2;
21class TProfile;
51e48ddc 22class AliLocalRhoParameter;
38d2189d 23
9e5eee5d 24class AliAnalysisTaskRhoVnModulation : public AliAnalysisTaskEmcalJetDev {
38d2189d 25 public:
26 // enumerators
e2fde0c9 27 enum fitModulationType { kNoFit, kV2, kV3, kCombined, kFourierSeries, kIntegratedFlow, kQC2, kQC4 }; // fit type
532186b5 28 enum qcRecovery { kFixedRho, kNegativeVn, kTryFit }; // how to deal with negative cn value for qcn value
38d2189d 29 enum runModeType { kLocal, kGrid }; // run mode type
30 enum dataType { kESD, kAOD, kESDMC, kAODMC }; // data type
51e48ddc 31 enum detectorType { kTPC, kVZEROA, kVZEROC, kVZEROComb}; // detector that was used
38d2189d 32 // constructors, destructor
33 AliAnalysisTaskRhoVnModulation();
34 AliAnalysisTaskRhoVnModulation(const char *name, runModeType type);
35 virtual ~AliAnalysisTaskRhoVnModulation();
38d2189d 36 // setting up the task and technical aspects
7dd1eeea 37 void ExecOnce();
38d2189d 38 Bool_t InitializeAnalysis();
39 virtual void UserCreateOutputObjects();
40 virtual Bool_t Run();
847e45e0 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);
38d2189d 43 /* inline */ Double_t PhaseShift(Double_t x) const {
44 while (x>=TMath::TwoPi())x-=TMath::TwoPi();
45 while (x<0.)x+=TMath::TwoPi();
46 return x; }
406b7c22 47 /* inline */ Double_t PhaseShift(Double_t x, Double_t n) const {
48 x = PhaseShift(x);
1460d7da 49 if(TMath::Nint(n)==2) while (x>TMath::Pi()) x-=TMath::Pi();
406b7c22 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);
53 }
54 return x; }
847e45e0 55 /* inline */ Double_t ChiSquarePDF(Int_t ndf, Double_t x) const {
38d2189d 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.));
58 return -999; }
847e45e0 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.); }
38d2189d 61 // setters - analysis setup
3531e13d 62 void SetDebugMode(Int_t d) {fDebug = d;}
eb18d0bf 63 void SetAttachToEvent(Bool_t b) {fAttachToEvent = b;}
64 void SetFillHistograms(Bool_t b) {fFillHistograms = b;}
3531e13d 65 void SetFillQAHistograms(Bool_t qa) {fFillQAHistograms = qa;}
9d202ae1 66 void SetReduceBinsXYByFactor(Float_t x, Float_t y) {fReduceBinsXByFactor = x;
258033f5 67 fReduceBinsYByFactor = y;}
532186b5 68 void SetNoEventWeightsForQC(Bool_t e) {fNoEventWeightsForQC = e;}
3531e13d 69 void SetCentralityClasses(TArrayI* c) {fCentralityClasses = c;}
258033f5 70 void SetPtBinsHybrids(TArrayD* p) {fPtBinsHybrids = p;}
71 void SetPtBinsJets(TArrayD* p) {fPtBinsJets = p;}
9ad3a4e7 72 void SetIntegratedFlow(TH1F* i, TH1F* j) {fUserSuppliedV2 = i;
73 fUserSuppliedV3 = j; }
60ad809f 74 void SetOnTheFlyResCorrection(TH1F* r2, TH1F* r3) {fUserSuppliedR2 = r2;
75 fUserSuppliedR3 = r3; }
38d2189d 76 void SetNameJetClones(const char* name) {fNameJetClones = name; }
77 void SetNamePicoTrackClones(const char* name) {fNamePicoTrackClones = name; }
78 void SetNameRho(const char* name) {fNameRho = name; }
20ace3c2 79 void SetUseScaledRho(Bool_t s) {fUseScaledRho = s; }
38d2189d 80 void SetRandomSeed(TRandom3* r) {if (fRandom) delete fRandom; fRandom = r; }
eda4f655 81 void SetModulationFit(TF1* fit);
847e45e0 82 void SetModulationFitMinMaxP(Float_t m, Float_t n) {fMinPvalue = m; fMaxPvalue = n; }
38d2189d 83 void SetModulationFitType(fitModulationType type) {fFitModulationType = type; }
532186b5 84 void SetQCnRecoveryType(qcRecovery type) {fQCRecovery = type; }
38d2189d 85 void SetModulationFitOptions(TString opt) {fFitModulationOptions = opt; }
fe4a8ccf 86 void SetReferenceDetector(detectorType type) {fDetectorType = type; }
b43cf414 87 void SetUsePtWeight(Bool_t w) {fUsePtWeight = w; }
38d2189d 88 void SetRunModeType(runModeType type) {fRunModeType = type; }
89 void SetAbsVertexZ(Float_t v) {fAbsVertexZ = v; }
90 void SetMinDistanceRctoLJ(Float_t m) {fMinDisanceRCtoLJ = m; }
91 void SetRandomConeRadius(Float_t r) {fRandomConeRadius = r; }
af733b78 92 void SetMaxNoRandomCones(Int_t m) {fMaxCones = m; }
b7453b38 93 void SetMinLeadingHadronPt(Double_t m) {fMinLeadingHadronPt = m; }
51e48ddc 94 void SetSetPtSub(Bool_t s) {fSubtractJetPt = s;}
fe4a8ccf 95 void SetForceAbsVnHarmonics(Bool_t f) {fAbsVnHarmonics = f; }
847e45e0 96 void SetExcludeLeadingJetsFromFit(Float_t n) {fExcludeLeadingJetsFromFit = n; }
97 void SetRebinSwapHistoOnTheFly(Bool_t r) {fRebinSwapHistoOnTheFly = r; }
98 void SetSaveThisPercentageOfFits(Float_t p) {fPercentageOfFits = p; }
5d33e40a 99 void SetUseV0EventPlaneFromHeader(Bool_t h) {fUseV0EventPlaneFromHeader = h;}
b7453b38 100 void SetExplicitOutlierCutForYear(Int_t y) {fExplicitOutlierCut = y;}
fb10bebd 101 // getters - these are used as well by AliAnalyisTaskJetFlow, so be careful when changing them
9e5eee5d 102 TString GetJetsName() const {return GetJetContainer()->GetArrayName(); }
103 TString GetTracksName() const {return fTracks->GetName(); }
eb18d0bf 104 TString GetLocalRhoName() const {return fLocalRhoName; }
fb10bebd 105 TArrayI* GetCentralityClasses() const {return fCentralityClasses;}
258033f5 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;}
51e48ddc 110 AliLocalRhoParameter* GetLocalRhoParameter() const {return fLocalRho;}
9e5eee5d 111 Double_t GetJetRadius() const {return GetJetContainer()->GetJetRadius();}
fb10bebd 112 void ExecMe() {ExecOnce();}
532186b5 113 AliAnalysisTaskRhoVnModulation* ReturnMe() {return this;}
5bd4db5f 114 // local cuts
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;}
e2fde0c9 118 void SetSoftTrackMinMaxPt(Float_t min, Float_t max) {fSoftTrackMinPt = min; fSoftTrackMaxPt = max;}
119 // numerical evaluations
38d2189d 120 void CalculateEventPlaneVZERO(Double_t vzero[2][2]) const;
847e45e0 121 void CalculateEventPlaneTPC(Double_t* tpc);
51e48ddc 122 void CalculateEventPlaneCombinedVZERO(Double_t* comb) const;
a3e16fac 123 void CalculateEventPlaneResolution(Double_t vzero[2][2], Double_t* vzeroComb, Double_t* tpc);
51e48ddc 124 Double_t CalculateEventPlaneChi(Double_t resEP) const;
9e5eee5d 125 void CalculateRandomCone(Float_t &pt, Float_t &eta, Float_t &phi, AliEmcalJet* jet = 0x0) const;
e2fde0c9 126 Double_t CalculateQC2(Int_t harm);
127 Double_t CalculateQC4(Int_t harm);
258033f5 128 // helper calculations for the q-cumulant analysis, also used by AliAnalyisTaskJetFlow
e2fde0c9 129 void QCnQnk(Int_t n, Int_t k, Double_t &reQ, Double_t &imQ);
258033f5 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);
e2fde0c9 133 Double_t QCnS(Int_t i, Int_t j);
134 Double_t QCnM();
135 Double_t QCnM11();
136 Double_t QCnM1111();
532186b5 137 Bool_t QCnRecovery(Double_t psi2, Double_t psi3);
38d2189d 138 // analysis details
1460d7da 139 Bool_t CorrectRho(Double_t psi2, Double_t psi3);
258033f5 140 // event and track selection, also used by AliAnalyisTaskJetFlow
9e5eee5d 141 /* inline */ Bool_t PassesCuts(AliVTrack* track) const { return AcceptTrack(track, 0); }
142 /* inline */ Bool_t PassesCuts(AliEmcalJet* jet) { return AcceptJet(jet, 0); }
38d2189d 143 Bool_t PassesCuts(AliVEvent* event);
b7453b38 144 Bool_t PassesCuts(Int_t year);
38d2189d 145 Bool_t PassesCuts(const AliVCluster* track) const;
38d2189d 146 // filling histograms
9e5eee5d 147 void FillHistogramsAfterSubtraction(Double_t psi2, Double_t psi3, Double_t vzero[2][2], Double_t* vzeroComb, Double_t* tpc);
38d2189d 148 void FillTrackHistograms() const;
149 void FillClusterHistograms() const;
150 void FillCorrectedClusterHistograms() const;
9d202ae1 151 void FillEventPlaneHistograms(Double_t vzero[2][2], Double_t* vzeroComb, Double_t* tpc) const;
9e5eee5d 152 void FillRhoHistograms();
9d202ae1 153 void FillDeltaPtHistograms(Double_t psi2, Double_t psi3) const;
9e5eee5d 154 void FillJetHistograms(Double_t psi2, Double_t psi3);
38d2189d 155 void FillQAHistograms(AliVTrack* vtrack) const;
156 void FillQAHistograms(AliVEvent* vevent);
5bd4db5f 157 void FillAnalysisSummaryHistogram() const;
38d2189d 158 virtual void Terminate(Option_t* option);
1460d7da 159 // interface methods for the output file
160 void SetOutputList(TList* l) {fOutputList = l;}
161 TH1F* GetResolutionFromOuptutFile(detectorType detector, Int_t h = 2, TArrayD* c = 0x0);
162 TH1F* CorrectForResolutionDiff(TH1F* v, detectorType detector, TArrayD* cen, Int_t c, Int_t h = 2);
163 TH1F* CorrectForResolutionInt(TH1F* v, detectorType detector, TArrayD* cen, Int_t h = 2);
532186b5 164 TH1F* GetDifferentialQC(TProfile* refCumulants, TProfile* diffCumlants, TArrayD* ptBins, Int_t h);
38d2189d 165 private:
3531e13d 166 // analysis flags and settings
38d2189d 167 Int_t fDebug; // debug level (0 none, 1 fcn calls, 2 verbose)
a3e16fac 168 Bool_t fLocalInit; //! is the analysis initialized?
eb18d0bf 169 Bool_t fAttachToEvent; // attach local rho to the event
170 Bool_t fFillHistograms; // fill histograms
38d2189d 171 Bool_t fFillQAHistograms; // fill qa histograms
9d202ae1 172 Float_t fReduceBinsXByFactor; // reduce the bins on x-axis of histo's by this much
173 Float_t fReduceBinsYByFactor; // reduce the bins on y-axis of histo's by this much
532186b5 174 Bool_t fNoEventWeightsForQC; // don't store event weights for qc analysis
3531e13d 175 TArrayI* fCentralityClasses; //-> centrality classes (maximum 10)
258033f5 176 TArrayD* fPtBinsHybrids; //-> pt bins for hybrid track vn anaysis
177 TArrayD* fPtBinsJets; //-> pt bins for jet vn analysis
9ad3a4e7 178 TH1F* fUserSuppliedV2; // histo with integrated v2
179 TH1F* fUserSuppliedV3; // histo with integrated v3
60ad809f 180 TH1F* fUserSuppliedR2; // correct the extracted v2 with this r
181 TH1F* fUserSuppliedR3; // correct the extracted v3 with this r
38d2189d 182 // members
20ace3c2 183 Bool_t fUseScaledRho; // use scaled rho
847e45e0 184 Int_t fNAcceptedTracks; //! number of accepted tracks
e2fde0c9 185 Int_t fNAcceptedTracksQCn; //! accepted tracks for QCn
38d2189d 186 fitModulationType fFitModulationType; // fit modulation type
532186b5 187 qcRecovery fQCRecovery; // recovery type for e-by-e qc method
b43cf414 188 Bool_t fUsePtWeight; // use dptdphi instead of dndphi
38d2189d 189 detectorType fDetectorType; // type of detector used for modulation fit
190 TString fFitModulationOptions; // fit options for modulation fit
191 runModeType fRunModeType; // run mode type
192 dataType fDataType; // datatype
193 TRandom3* fRandom; //-> dont use gRandom to not interfere with other tasks
194 Int_t fMappedRunNumber; //! mapped runnumer (for QA)
195 Int_t fInCentralitySelection; //! centrality bin
196 TF1* fFitModulation; //-> modulation fit for rho
3531e13d 197 Float_t fMinPvalue; // minimum value of p
847e45e0 198 Float_t fMaxPvalue; // maximum value of p
38d2189d 199 const char* fNameJetClones; //! collection of tclones array with jets
200 const char* fNamePicoTrackClones; //! collection of tclones with pico tracks
201 const char* fNameRho; //! name of rho
5bd4db5f 202 // additional jet cuts (most are inherited)
203 Float_t fLocalJetMinEta; // local eta cut for jets
204 Float_t fLocalJetMaxEta; // local eta cut for jets
205 Float_t fLocalJetMinPhi; // local phi cut for jets
206 Float_t fLocalJetMaxPhi; // local phi cut for jets
e2fde0c9 207 Float_t fSoftTrackMinPt; // min pt for soft tracks
208 Float_t fSoftTrackMaxPt; // max pt for soft tracks
38d2189d 209 // event cuts
210 Float_t fAbsVertexZ; // cut on zvertex
211 // general qa histograms
212 TH1F* fHistCentrality; //! accepted centrality
213 TH1F* fHistVertexz; //! accepted verte
214 TH2F* fHistRunnumbersPhi; //! run numbers averaged phi
215 TH2F* fHistRunnumbersEta; //! run numbers averaged eta
847e45e0 216 TH1F* fHistPvaluePDF; //! pdf value of chisquare p
217 TH1F* fHistPvalueCDF; //! cdf value of chisquare p
38d2189d 218 // general settings
847e45e0 219 Float_t fMinDisanceRCtoLJ; // min distance between rc and leading jet
220 Float_t fRandomConeRadius; // radius of random cone
af733b78 221 Int_t fMaxCones; // max number of random cones
847e45e0 222 Bool_t fAbsVnHarmonics; // force postive local rho
223 Float_t fExcludeLeadingJetsFromFit; // exclude n leading jets from fit
224 Bool_t fRebinSwapHistoOnTheFly; // rebin swap histo on the fly
225 Float_t fPercentageOfFits; // save this percentage of fits
51e48ddc 226 Bool_t fUseV0EventPlaneFromHeader; // use the vzero event plane from the header
b7453b38 227 Int_t fExplicitOutlierCut; // cut on correlation of tpc and global multiplicity
228 Double_t fMinLeadingHadronPt; // minimum pt for leading hadron
51e48ddc 229 Bool_t fSubtractJetPt; // save subtracted jet pt by calling SetPtSub
38d2189d 230 // transient object pointers
231 TList* fOutputList; //! output list
232 TList* fOutputListGood; //! output list for local analysis
233 TList* fOutputListBad; //! output list for local analysis
234 TH1F* fHistAnalysisSummary; //! analysis summary
235 TH1F* fHistSwap; //! swap histogram
847e45e0 236 TProfile* fProfV2; //! extracted v2
e2fde0c9 237 TProfile* fProfV2Cumulant; //! v2 cumulant
847e45e0 238 TProfile* fProfV2Resolution[10]; //! resolution parameters for v2
239 TProfile* fProfV3; //! extracted v3
e2fde0c9 240 TProfile* fProfV3Cumulant; //! v3 cumulant
847e45e0 241 TProfile* fProfV3Resolution[10]; //! resolution parameters for v3
38d2189d 242 // qa histograms for accepted pico tracks
243 TH1F* fHistPicoTrackPt[10]; //! pt of all charged tracks
532186b5 244 TH1F* fHistPicoTrackMult[10]; //! multiplicity of accepted pico tracks
38d2189d 245 TH2F* fHistPicoCat1[10]; //! pico tracks spd hit and refit
246 TH2F* fHistPicoCat2[10]; //! pico tracks wo spd hit w refit, constrained
247 TH2F* fHistPicoCat3[10]; //! pico tracks wo spd hit wo refit, constrained
248 // qa histograms for accepted emcal clusters
249 /* TH1F* fHistClusterPt[10]; //! pt uncorrected emcal clusters */
250 /* TH1F* fHistClusterPhi[10]; //! phi uncorrected emcal clusters */
251 /* TH1F* fHistClusterEta[10]; //! eta uncorrected emcal clusters */
b43cf414 252 // qa histograms for accepted emcal clusters aftehadronic correction
38d2189d 253 /* TH1F* fHistClusterCorrPt[10]; //! pt corrected emcal clusters */
254 /* TH1F* fHistClusterCorrPhi[10]; //! phi corrected emcal clusters */
255 /* TH1F* fHistClusterCorrEta[10]; //! eta corrected emcal clusters */
256 // qa event planes
847e45e0 257 TProfile* fHistPsiControl; //! event plane control histogram
258 TProfile* fHistPsiSpread; //! event plane spread histogram
38d2189d 259 TH1F* fHistPsiVZEROA; //! psi 2 from vzero a
260 TH1F* fHistPsiVZEROC; //! psi 2 from vzero c
9d202ae1 261 TH1F* fHistPsiVZERO; //! psi 2 from combined vzero
38d2189d 262 TH1F* fHistPsiTPC; //! psi 2 from tpc
263 // background
264 TH1F* fHistRhoPackage[10]; //! rho as estimated by emcal jet package
265 TH1F* fHistRho[10]; //! background
266 TH2F* fHistRhoVsMult; //! rho versus multiplicity
267 TH2F* fHistRhoVsCent; //! rho veruss centrality
268 TH2F* fHistRhoAVsMult; //! rho * A vs multiplicity for all jets
269 TH2F* fHistRhoAVsCent; //! rho * A vs centrality for all jets
270 // delta pt distributions
3531e13d 271 TH2F* fHistRCPhiEta[10]; //! random cone eta and phi
272 TH2F* fHistRhoVsRCPt[10]; //! rho * A vs rcpt
273 TH1F* fHistRCPt[10]; //! rcpt
9d202ae1 274 TH2F* fHistDeltaPtDeltaPhi2[10]; //! dpt vs dphi (psi2 - phi)
275 TH2F* fHistDeltaPtDeltaPhi3[10]; //! dpt vs dphi (psi3 - phi)
3531e13d 276 TH2F* fHistRCPhiEtaExLJ[10]; //! random cone eta and phi, excl leading jet
277 TH2F* fHistRhoVsRCPtExLJ[10]; //! rho * A vs rcpt, excl leading jet
278 TH1F* fHistRCPtExLJ[10]; //! rcpt, excl leading jet
9d202ae1 279 TH2F* fHistDeltaPtDeltaPhi2ExLJ[10]; //! dpt vs dphi, excl leading jet
280 TH2F* fHistDeltaPtDeltaPhi3ExLJ[10]; //! dpt vs dphi, excl leading jet
406b7c22 281 /* TH2F* fHistRCPhiEtaRand[10]; //! random cone eta and phi, randomized */
282 /* TH2F* fHistRhoVsRCPtRand[10]; //! rho * A vs rcpt, randomized */
283 /* TH1F* fHistRCPtRand[10]; //! rcpt, randomized */
284 /* TH2F* fHistDeltaPtDeltaPhi2Rand[10]; //! dpt vs dphi, randomized */
285 /* TH2F* fHistDeltaPtDeltaPhi3Rand[10]; //! dpt vs dphi, randomized */
38d2189d 286 // jet histograms (after kinematic cuts)
287 TH1F* fHistJetPtRaw[10]; //! jet pt - no background subtraction
288 TH1F* fHistJetPt[10]; //! pt of found jets (background subtracted)
289 TH2F* fHistJetEtaPhi[10]; //! eta and phi correlation
290 TH2F* fHistJetPtArea[10]; //! jet pt versus area
291 TH2F* fHistJetPtConstituents[10]; //! jet pt versus number of constituents
b43cf414 292 TH2F* fHistJetEtaRho[10]; //! jet eta versus jet rho
38d2189d 293 // in plane, out of plane jet spectra
9d202ae1 294 TH2F* fHistJetPsi2Pt[10]; //! psi tpc versus pt
295 TH2F* fHistJetPsi3Pt[10]; //! psi vzeroc versus pt
38d2189d 296
38d2189d 297 AliAnalysisTaskRhoVnModulation(const AliAnalysisTaskRhoVnModulation&); // not implemented
298 AliAnalysisTaskRhoVnModulation& operator=(const AliAnalysisTaskRhoVnModulation&); // not implemented
299
9e5eee5d 300 ClassDef(AliAnalysisTaskRhoVnModulation, 16);
38d2189d 301};
302
303#endif