1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. */
2 /* See cxx source for full Copyright notice */
5 // AliAnalysisTwoParticleResonanceFlowTask:
6 // origin: Redmer Alexander Bertens (rbertens@nikhef.nl)
7 // analyis task for Resonance-meson reconstruction and estimation of v_n
9 #ifndef ALIANALYSISTWOPARTICLERESONANCEFLOWTASK_H
10 #define ALIANALYSISTWOPARTICLERESONANCEFLOWTASK_H
15 class AliFlowTrackCuts;
17 class AliFlowTrackSimple;
18 class AliFlowEventSimple;
20 class AliFlowCandidateTrack;
21 class AliFlowBayesianPID;
22 class AliEventPoolManager;
23 class AliResonanceFlowHelperTrack;
25 #include "AliAnalysisTaskSE.h"
26 class AliResonanceFlowHelperTrack : public TObject
29 AliResonanceFlowHelperTrack(Double_t eta, Double_t phi, Double_t p, Double_t px, Double_t py, Double_t pz, Double_t pt, Int_t charge, Double_t mass, Int_t id, Int_t species) : fEta(eta), fPhi(phi), fp(p), fpX(px), fpY(py), fpZ(pz), fpT(pt), fCharge(charge), fMass(mass), fID(id), fSpecies(species) { }
30 ~AliResonanceFlowHelperTrack() {}
31 virtual Double_t P() const { return fp; }
32 virtual Double_t Px() const { return fpX; }
33 virtual Double_t Py() const { return fpY; }
34 virtual Double_t Pz() const { return fpZ; }
35 virtual Double_t Pt() const { return fpT; }
36 virtual Double_t Phi() const { return fPhi; }
37 virtual Double_t Eta() const { return fEta; }
38 virtual Int_t Charge() const { return fCharge; }
39 virtual Double_t Mass() const { return fMass; }
40 virtual Short_t ID() const { return fID; }
41 virtual Int_t Species() const { return fSpecies; }
42 void InitializeHelperTrack(Double_t eta, Double_t phi, Double_t p, Double_t px, Double_t py, Double_t pz, Double_t pt, Int_t charge, Double_t mass, Int_t id, Int_t species) { fEta = eta; fPhi = phi; fp = p; fpX = px; fpY = py; fpZ = pz; fpT = pt; fCharge = charge; fMass = mass; fID = id; fSpecies = species; }
51 Int_t fCharge; // charge
52 Double_t fMass; // mass
54 Int_t fSpecies; // species
55 ClassDef(AliResonanceFlowHelperTrack, 1); // lightweight helper track for phi reconstruction
58 class AliAnalysisTwoParticleResonanceFlowTask : public AliAnalysisTaskSE
61 AliAnalysisTwoParticleResonanceFlowTask();
62 AliAnalysisTwoParticleResonanceFlowTask(const char *name);
63 virtual ~AliAnalysisTwoParticleResonanceFlowTask();
64 // technical aspects of the analysis
65 void ForceExit(Int_t type, const char* message);
66 Bool_t SetIsMC(Bool_t ismc) {fIsMC = ismc; return fIsMC; }
68 Bool_t UseEventMixing(Bool_t mix) { fEventMixing = mix; return mix; }
69 Bool_t UsePhiMinusPsiMethod(Bool_t p) {fPhiMinusPsiMethod = p; return p;}
70 Bool_t SetVZEROSubEvents(Bool_t v0) { fV0 = v0; return v0; }
71 // configure the output of the analysis
72 TH1F* BookHistogram(const char * name);
73 TH2F* BookPIDHistogram(const char * name, Bool_t TPC);
74 TH1F* InitPtSpectraHistograms(Float_t nmin, Float_t nmax);
75 TH1F* BookPtHistogram(const char* name);
76 Bool_t InitializeAnalysis();
77 //PK void AddResonanceIdentificationOutputObjects();
78 virtual void UserCreateOutputObjects();
80 void SetPtBins(Float_t bin[19], Int_t n) { for(Int_t i = 0; i < n+1; i++) fPtBins[i] = bin[i]; fNPtBins = n; }
81 void SetdPhiBins(Float_t bin[19], Int_t n) { for(Int_t i = 0; i < n+1; i++) fdPhiBins[i] = bin[i]; fNdPhiBins = n;}
82 void SetCentralityParameters(Double_t min, Double_t max, const char* a, const char* b, Bool_t c, Bool_t d) {
85 fkCentralityMethodA = a;
86 fkCentralityMethodB = b;
87 fCentralityCut2010 = c;
88 fCentralityCut2011 = d; }
89 void SetPOICuts(AliFlowTrackCuts *cutsPOI) { fPOICuts = cutsPOI; }
90 void SetRPCuts(AliFlowTrackCuts *cutsRP) { fCutsRP = cutsRP; }
91 void SetPIDConfiguration(Float_t prob[7]) { for(Int_t i = 0; i < 7; i++) fPIDConfig[i] = prob[i]; }
92 Bool_t SetQA(Bool_t qa) {fQA = qa; return fQA;}
93 void SetAddTaskMacroSummary(Float_t m[12]) {for(Int_t i(0); i < 12; i++) fAddTaskMacroSummary[i] = m[i];}
94 void SetPOIDCAXYZ(Float_t dca[5]) { for(Int_t i = 0; i < 5; i++) fDCAConfig[i] = dca[i]; }
95 void SetMixingBins(Int_t c[20], Int_t v[20]) {for(Int_t i = 0; i < 20; i++) { fCentralityMixingBins[i] = c[i];
96 fVertexMixingBins[i] = v[i]; } }
97 void SetMixingParameters(Int_t p[3]) { for(Int_t i = 0; i < 3; i++) fMixingParameters[i] = p[i]; }
98 void SetupSpeciesA(Int_t species, Int_t charge, Float_t mass, Float_t minPtA, Float_t maxPtA) {fSpeciesA = species; fChargeA = charge; fMassA = mass; fMinPtA = minPtA; fMaxPtA = maxPtA;}
99 void SetupSpeciesB(Int_t species, Int_t charge, Float_t mass, Float_t minPtB, Float_t maxPtB) {fSpeciesB = species; fChargeB = charge; fMassB = mass; fMinPtB = minPtB; fMaxPtB = maxPtB;}
100 void SetCandidateEtaAndPt(Float_t mineta, Float_t maxeta, Float_t minpt, Float_t maxpt) { fCandidateMinEta = mineta;
101 fCandidateMaxEta = maxeta;
102 fCandidateMinPt = minpt;
103 fCandidateMaxPt = maxpt;
104 fCandidateEtaPtCut = kTRUE;}
105 void SetCommonConstants(Int_t massBins, Float_t minMass, Float_t maxMass) { fMassBins = massBins;
107 fMaxMass = maxMass; }
108 void SetVertexZ(Float_t z) { fVertexRange = z; }
109 void SetMaxDeltaDipAngleAndPt(Float_t a, Float_t pt) { fDeltaDipAngle = a;
111 fApplyDeltaDipCut = kTRUE; };
113 void GetMixingParameters(Int_t p[3]) const { for(Int_t i = 0; i < 3; i++) p[i] = fMixingParameters[i]; }
114 Float_t GetCenMin() const {return fCentralityMin; }
115 Float_t GetCenMax() const {return fCentralityMax; }
116 const char* GetCentralityMethod() const {return fkCentralityMethodA; }
117 Float_t GetVertexZ() const { return fVertexRange; }
118 Float_t GetDeltaDipAngle() const {return fDeltaDipAngle; }
119 Float_t GetDeltaDipPt() const {return fDeltaDipPt; }
120 void GetPIDConfiguration(Float_t prob[7]) const {for(Int_t i = 0; i < 7; i++) prob[i] = fPIDConfig[i]; }
121 void GetPOIDCZXYZ(Float_t dca[5]) const { for(Int_t i = 0; i < 5; i++) dca[i] = fDCAConfig[i]; }
122 void GetCandidateEtaAndPt(Float_t etapt[4]) const { etapt[0] = fCandidateMinEta;
123 etapt[1] = fCandidateMaxEta;
124 etapt[2] = fCandidateMinPt;
125 etapt[3] = fCandidateMaxPt; }
126 AliFlowEvent* GetFlowEvent() const {return fFlowEvent;}
127 // the analysis itself
128 AliEventPoolManager* InitializeEventMixing();
129 template <typename T> Float_t InvariantMass(const T* track1, const T* track2) const;
130 template <typename T> Float_t DeltaDipAngle(const T* track1, const T* track2) const;
131 template <typename T> Bool_t CheckDeltaDipAngle(const T* track1, const T* track2) const;
132 template <typename T> Bool_t CheckCandidateEtaPtCut(const T* track1, const T* track2) const;
133 template <typename T> Bool_t EventCut(T* event);
134 template <typename T> void PlotMultiplcities(const T* event) const;
135 template <typename T> Bool_t CheckVertex(const T* event);
136 template <typename T> Bool_t CheckCentrality(T* event);
137 void InitializeBayesianPID(AliAODEvent* event);
138 template <typename T> Bool_t PassesTPCbayesianCut(T* track, Int_t species) const;
139 Bool_t PassesDCACut(AliAODTrack* track) const;
140 Bool_t DoOwnPID(AliAODTrack* track, Int_t species) const;
141 Bool_t AcceptTrack(AliAODTrack* track, Int_t species) const;
142 template <typename T> Float_t PairPt(const T* track_1, const T* track_2, Bool_t phi = kFALSE) const;
143 template <typename T> Float_t PtSelector(Int_t _track_type, const T* track_1, const T* track_2, Float_t mass) const;
144 template <typename T> Bool_t QualityCheck(T* track) const;
145 void TrackQA(AliAODTrack* track, Int_t species, Bool_t allChargedParticles) const;
146 template <typename T> void SetNullCuts(T* esd);
147 void PrepareFlowEvent(Int_t iMulti);
148 void PhiMinusPsiMethod(TObjArray* MixingCandidates);
149 void PhiMinusPsiMethodWriteData(Bool_t signal, TObjArray* SpeciesA, TObjArray* SpeciesB, Float_t* abcPsi2);
150 void VZEROSubEventAnalysis();
151 void DoAnalysisOnTheFly(AliFlowEventSimple* event);
152 void DoAnalysisOnTheFly(TObjArray* MixingCandidates, TObjArray* SpeciesA, TObjArray* ocSpeciesA, TObjArray* SpeciesB, TObjArray* ocSpeciesB);
153 void DoAnalysisOnTheFly(TDirectoryFile* outputFile);
154 virtual void UserExec(Option_t *option);
155 void ResonanceSignal(TObjArray* SpeciesA, TObjArray* SpeciesB) const;
156 void ResonanceBackground(TObjArray* SpeciesA, TObjArray* SpeciesB, Bool_t checkAutoCorrelations = kTRUE) const;
157 void ReconstructionWithEventMixing(TObjArray* MixingCandidates) const;
158 virtual void Terminate(Option_t *);
162 Int_t fSpeciesA; // particle species a
163 Int_t fSpeciesB; // species b
164 Int_t fChargeA; // charge for species a
165 Int_t fChargeB; // charge for species b
166 Float_t fMassA; // mass for species a
167 Float_t fMassB; // mass for species b
168 Float_t fMinPtA; // min pt for species a
169 Float_t fMaxPtA; // max pt for species a
170 Float_t fMinPtB; // min pt for species b
171 Float_t fMaxPtB; // max pt for species b
172 Bool_t fIsMC; // use mc mode
173 Bool_t fEventMixing; // use event mixing
174 Bool_t fPhiMinusPsiMethod; // use phi minus psi method (default is invariant mass fit method)
175 Bool_t fQA; // make qa plots
176 Bool_t fV0; // use three subevents including vzero
177 Int_t fMassBins; // mass bins
178 Float_t fMinMass; // mass range
179 Float_t fMaxMass; // mass range
180 AliFlowTrackCuts *fCutsRP; // track cuts for reference particles
181 AliFlowTrackCuts *fNullCuts; // dummy cuts for flow event tracks
182 AliPIDResponse *fPIDResponse; //! pid response object
183 AliFlowEvent *fFlowEvent; //! flow events (one for each inv mass band)
184 AliFlowBayesianPID *fBayesianResponse; //!PID response object
185 TObjArray *fCandidates; // candidate array
186 Bool_t fCandidateEtaPtCut; // set eta and pt cut for candidate tracks and combinatorial background
187 Float_t fCandidateMinEta; // minimum eta for candidates
188 Float_t fCandidateMaxEta; // maximum eta for candidates
189 Float_t fCandidateMinPt; // minimum pt for candidates
190 Float_t fCandidateMaxPt; // maximum pt for candidates
191 Float_t fPIDConfig[7]; // configure pid routine
192 Float_t fDCAConfig[5]; // configure dca routine
193 Int_t fMixingParameters[3]; // mixing: poolsize, mixing tracks, pool buffer
194 Int_t fCentralityMixingBins[20]; // configure centrality bins for event mixing
195 Int_t fVertexMixingBins[20]; // configure vertex bins for event mixing
196 Float_t fPtBins[19]; // pt bin borders
197 Float_t fdPhiBins[19]; // dPhi bin borders
198 Int_t fNPtBins; // no of pt bins + 1
199 Int_t fNdPhiBins; // no of dphi bins + 1
200 Float_t fCentrality; // event centrality
201 Float_t fVertex; // event vertex z
202 AliAODEvent *fAOD; //! AOD oject
203 AliEventPoolManager *fPoolManager; //! event pool manager
204 TList *fOutputList; // ! Output list
205 TH1F *fEventStats; // ! Histogram for event statistics
206 TH1F *fCentralityPass; // ! QA histogram of events that pass centrality cut
207 TH1F *fCentralityNoPass; //! QA histogram of events that do not pass centrality cut
208 TH2F *fNOPID;//! QA histogram of TPC response of all charged particles
209 TH2F *fPIDk;//! QA histogram of TPC response of kaons
210 TH2F *fPIDp; //! QA histogram of TPC response of pions
211 TH1F *fResonanceSignal[18]; //! signal histograms
212 TH1F *fResonanceBackground[18]; //! like-sign kaon pairs
213 TH1F *fPtSpectra[18]; //! pt spectra
214 TH1F *fPtP; //! QA histogram of p_t distribution of positive particles
215 TH1F *fPtN; //! QA histogram of p_t distribution of negative particles
216 TH1F *fPtSpeciesA; //! QA histogram of p_t distribution of species A
217 TH1F *fPtSpeciesB; //! QA histogram of p_t distribution of species B
218 TH2F *fMultCorAfterCuts; //! QA profile global and tpc multiplicity after outlier cut
219 TH2F *fMultvsCentr; //! QA profile of centralty vs multiplicity
220 Float_t fCentralityMin; // lower bound of cenrality bin
221 Float_t fCentralityMax; // upper bound of centrality bin
222 const char *fkCentralityMethodA; // centrality determiantion (primary method)
223 const char *fkCentralityMethodB; // centrality determination fallback
224 Bool_t fCentralityCut2010; // 3 sigma cut for multiplicity outliers
225 Bool_t fCentralityCut2011; // 3 sigma cut for multiplicity outliers
226 AliFlowTrackCuts *fPOICuts; // cuts for particles of interest (flow package)
227 Float_t fVertexRange; // absolute value of maximum distance of vertex along the z-axis
228 TH1F *fPhi; //! QA plot of azimuthal distribution of POI daughters
229 TH1F *fEta; //! QA plot of eta distribution of POI daughters
230 TH1F *fVZEROA; //! QA plot vzeroa multiplicity (all tracks in event)
231 TH1F *fVZEROC; //! QA plot vzeroc multiplicity (all tracks in event)
232 TH1F *fTPCM; //! QA plot TPC multiplicity (tracks used for event plane estimation)
233 Float_t fDeltaDipAngle; // absolute value of delta dip angle to be excluded
234 Float_t fDeltaDipPt; // upper value of pt range in which delta dip angle must be applied
235 Bool_t fApplyDeltaDipCut; // enforce delta dip cut
236 TH2F *fDCAAll;//! qa dca of all charged particles
237 TH1F *fDCAXYQA; //! qa plot of dca xz
238 TH1F *fDCAZQA; //!qa plot of dca z
239 TH2F *fDCAPrim; //!dca of primaries (mc) or kaons (data)
240 TH2F *fDCASecondaryWeak; //! dca of weak (mc)
241 TH2F *fDCAMaterial; //!dca material (mc) all (data)
242 TProfile *fSubEventDPhiv2; //! subevent resolution info for v2
243 TProfile *fV0Data[18][2]; //! profiles for vzero vn(minv)
244 TH1F *fPhiMinusPsiDataContainer[18][18][2]; //! histograms for phi minus psi results
245 TH1F *fPhiMinusPsiBackgroundContainer[18][18][2]; //! histograms for phi minus psi background
246 TH1F *fAnalysisSummary; //! plot analysis flags
247 Float_t fAddTaskMacroSummary[12]; // add task macro summary
249 AliAnalysisTwoParticleResonanceFlowTask(const AliAnalysisTwoParticleResonanceFlowTask&); // Not implemented
250 AliAnalysisTwoParticleResonanceFlowTask& operator=(const AliAnalysisTwoParticleResonanceFlowTask&); // Not implemented
251 void MakeTrack(Float_t, Float_t, Float_t, Float_t, Int_t , Int_t[]) const;
253 ClassDef(AliAnalysisTwoParticleResonanceFlowTask, 4);