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 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) {
85 fkCentralityMethodA = a;
86 fkCentralityMethodB = b; }
87 void SetPOICuts(AliFlowTrackCuts *cutsPOI) { fPOICuts = cutsPOI; }
88 void SetRPCuts(AliFlowTrackCuts *cutsRP) { fCutsRP = cutsRP; }
89 void SetPIDConfiguration(Float_t prob[7]) { for(Int_t i = 0; i < 7; i++) fPIDConfig[i] = prob[i]; }
90 Bool_t SetQA(Bool_t qa) {fQA = qa; return fQA;}
91 void SetAddTaskMacroSummary(Float_t m[12]) {for(Int_t i(0); i < 12; i++) fAddTaskMacroSummary[i] = m[i];}
92 void SetPOIDCAXYZ(Float_t dca[5]) { for(Int_t i = 0; i < 5; i++) fDCAConfig[i] = dca[i]; }
93 void SetMixingParameters(Int_t p[3]) { for(Int_t i = 0; i < 3; i++) fMixingParameters[i] = p[i]; }
94 void SetPermissiveMixing(Bool_t p) { fPermissiveMixing = p; }
95 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;}
96 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;}
97 void SetCandidateEtaAndPt(Float_t mineta, Float_t maxeta, Float_t minpt, Float_t maxpt) { fCandidateMinEta = mineta;
98 fCandidateMaxEta = maxeta;
99 fCandidateMinPt = minpt;
100 fCandidateMaxPt = maxpt;
101 fCandidateEtaPtCut = kTRUE;}
102 void SetCommonConstants(Int_t massBins, Float_t minMass, Float_t maxMass) { fMassBins = massBins;
104 fMaxMass = maxMass; }
105 void SetVertexZ(Float_t z) { fVertexRange = z; }
106 void SetMaxDeltaDipAngleAndPt(Float_t a, Float_t pt) { fDeltaDipAngle = a;
108 fApplyDeltaDipCut = kTRUE; };
109 void SetMixingBins(Int_t c[20], Int_t v[20]) {for(Int_t i = 0; i < 20; i++) { fCentralityMixingBins[i] = c[i];
110 fVertexMixingBins[i] = v[i]; } }
112 void GetMixingParameters(Int_t p[3]) const { for(Int_t i = 0; i < 3; i++) p[i] = fMixingParameters[i]; }
113 Float_t GetCenMin() const {return fCentralityMin; }
114 Float_t GetCenMax() const {return fCentralityMax; }
115 const char* GetCentralityMethod() const {return fkCentralityMethodA; }
116 Float_t GetVertexZ() const { return fVertexRange; }
117 Float_t GetDeltaDipAngle() const {return fDeltaDipAngle; }
118 Float_t GetDeltaDipPt() const {return fDeltaDipPt; }
119 void GetPIDConfiguration(Float_t prob[7]) const {for(Int_t i = 0; i < 7; i++) prob[i] = fPIDConfig[i]; }
120 void GetPOIDCZXYZ(Float_t dca[5]) const { for(Int_t i = 0; i < 5; i++) dca[i] = fDCAConfig[i]; }
121 void GetCandidateEtaAndPt(Float_t etapt[4]) const { etapt[0] = fCandidateMinEta;
122 etapt[1] = fCandidateMaxEta;
123 etapt[2] = fCandidateMinPt;
124 etapt[3] = fCandidateMaxPt; }
125 AliFlowEvent* GetFlowEvent() const {return fFlowEvent;}
126 // the analysis itself
127 AliEventPoolManager* InitializeEventMixing();
128 template <typename T> Float_t InvariantMass(const T* track1, const T* track2) const;
129 template <typename T> Float_t DeltaDipAngle(const T* track1, const T* track2) const;
130 template <typename T> Bool_t CheckDeltaDipAngle(const T* track1, const T* track2) const;
131 template <typename T> Bool_t CheckCandidateEtaPtCut(const T* track1, const T* track2) const;
132 template <typename T> Bool_t EventCut(T* event);
133 template <typename T> void PlotMultiplcities(const T* event) const;
134 template <typename T> Bool_t CheckVertex(const T* event);
135 template <typename T> Bool_t CheckCentrality(T* event);
136 void InitializeBayesianPID(AliAODEvent* event);
137 template <typename T> Bool_t PassesTPCbayesianCut(T* track, Int_t species) const;
138 Bool_t PassesDCACut(AliAODTrack* track) const;
139 Bool_t DoOwnPID(AliAODTrack* track, Int_t species) const;
140 Bool_t AcceptTrack(AliAODTrack* track, Int_t species) const;
141 template <typename T> Float_t PairPt(const T* track_1, const T* track_2, Bool_t phi = kFALSE) const;
142 template <typename T> Float_t PtSelector(Int_t _track_type, const T* track_1, const T* track_2, Float_t mass) const;
143 template <typename T> Bool_t QualityCheck(T* track) const;
144 void TrackQA(AliAODTrack* track, Int_t species, Bool_t allChargedParticles) const;
145 template <typename T> void SetNullCuts(T* esd);
146 void PrepareFlowEvent(Int_t iMulti);
147 void PhiMinusPsiMethod(TObjArray* MixingCandidates);
148 void PhiMinusPsiMethodWriteData(Bool_t signal, TObjArray* SpeciesA, TObjArray* SpeciesB, Float_t* abcPsi2);
149 void VZEROSubEventAnalysis();
150 void DoAnalysisOnTheFly(AliFlowEventSimple* event);
151 void DoAnalysisOnTheFly(TObjArray* MixingCandidates, TObjArray* SpeciesA, TObjArray* ocSpeciesA, TObjArray* SpeciesB, TObjArray* ocSpeciesB);
152 void DoAnalysisOnTheFly(TDirectoryFile* outputFile);
153 virtual void UserExec(Option_t *option);
154 void ResonanceSignal(TObjArray* SpeciesA, TObjArray* SpeciesB) const;
155 void ResonanceBackground(TObjArray* SpeciesA, TObjArray* SpeciesB, Bool_t checkAutoCorrelations = kTRUE) const;
156 void ReconstructionWithEventMixing(TObjArray* MixingCandidates) const;
157 virtual void Terminate(Option_t *);
161 Int_t fSpeciesA; // particle species a
162 Int_t fSpeciesB; // species b
163 Int_t fChargeA; // charge for species a
164 Int_t fChargeB; // charge for species b
165 Float_t fMassA; // mass for species a
166 Float_t fMassB; // mass for species b
167 Float_t fMinPtA; // min pt for species a
168 Float_t fMaxPtA; // max pt for species a
169 Float_t fMinPtB; // min pt for species b
170 Float_t fMaxPtB; // max pt for species b
171 Bool_t fIsMC; // use mc mode
172 Bool_t fEventMixing; // use event mixing
173 Bool_t fPhiMinusPsiMethod; // use phi minus psi method (default is invariant mass fit method)
174 Bool_t fQA; // make qa plots
175 Bool_t fV0; // use three subevents including vzero
176 Int_t fMassBins; // mass bins
177 Float_t fMinMass; // mass range
178 Float_t fMaxMass; // mass range
179 AliFlowTrackCuts *fCutsRP; // track cuts for reference particles
180 AliFlowTrackCuts *fNullCuts; // dummy cuts for flow event tracks
181 AliPIDResponse *fPIDResponse; //! pid response object
182 AliFlowEvent *fFlowEvent; //! flow events (one for each inv mass band)
183 AliFlowBayesianPID *fBayesianResponse; //!PID response object
184 TObjArray *fCandidates; // candidate array
185 Bool_t fCandidateEtaPtCut; // set eta and pt cut for candidate tracks and combinatorial background
186 Float_t fCandidateMinEta; // minimum eta for candidates
187 Float_t fCandidateMaxEta; // maximum eta for candidates
188 Float_t fCandidateMinPt; // minimum pt for candidates
189 Float_t fCandidateMaxPt; // maximum pt for candidates
190 Float_t fPIDConfig[7]; // configure pid routine
191 Float_t fDCAConfig[5]; // configure dca routine
192 Int_t fMixingParameters[3]; // mixing: poolsize, mixing tracks, pool buffer
193 Bool_t fPermissiveMixing; // skip event when pool manager fails - use with caution
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 Float_t fCentralityMin; // lower bound of cenrality bin
219 Float_t fCentralityMax; // upper bound of centrality bin
220 const char *fkCentralityMethodA; // centrality determiantion (primary method)
221 const char *fkCentralityMethodB; // centrality determination fallback
222 AliFlowTrackCuts *fPOICuts; // cuts for particles of interest (flow package)
223 Float_t fVertexRange; // absolute value of maximum distance of vertex along the z-axis
224 TH1F *fPhi; //! QA plot of azimuthal distribution of POI daughters
225 TH1F *fEta; //! QA plot of eta distribution of POI daughters
226 TH1F *fVZEROA; //! QA plot vzeroa multiplicity (all tracks in event)
227 TH1F *fVZEROC; //! QA plot vzeroc multiplicity (all tracks in event)
228 TH1F *fTPCM; //! QA plot TPC multiplicity (tracks used for event plane estimation)
229 Float_t fDeltaDipAngle; // absolute value of delta dip angle to be excluded
230 Float_t fDeltaDipPt; // upper value of pt range in which delta dip angle must be applied
231 Bool_t fApplyDeltaDipCut; // enforce delta dip cut
232 TH2F *fDCAAll;//! qa dca of all charged particles
233 TH1F *fDCAXYQA; //! qa plot of dca xz
234 TH1F *fDCAZQA; //!qa plot of dca z
235 TH2F *fDCAPrim; //!dca of primaries (mc) or kaons (data)
236 TH2F *fDCASecondaryWeak; //! dca of weak (mc)
237 TH2F *fDCAMaterial; //!dca material (mc) all (data)
238 TProfile *fSubEventDPhiv2; //! subevent resolution info for v2
239 TProfile *fV0Data[18][2]; //! profiles for vzero vn(minv)
240 TH1F *fPhiMinusPsiDataContainer[18][18][2]; //! histograms for phi minus psi results
241 TH1F *fPhiMinusPsiBackgroundContainer[18][18][2]; //! histograms for phi minus psi background
242 TH1F *fAnalysisSummary; //! plot analysis flags
243 Float_t fAddTaskMacroSummary[12]; // add task macro summary
245 AliAnalysisTwoParticleResonanceFlowTask(const AliAnalysisTwoParticleResonanceFlowTask&); // Not implemented
246 AliAnalysisTwoParticleResonanceFlowTask& operator=(const AliAnalysisTwoParticleResonanceFlowTask&); // Not implemented
247 void MakeTrack(Float_t, Float_t, Float_t, Float_t, Int_t , Int_t[]) const;
249 ClassDef(AliAnalysisTwoParticleResonanceFlowTask, 3);