]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FLOW/Attic/AliAnalysisTwoParticleResonanceFlowTask.h
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGCF / FLOW / Attic / AliAnalysisTwoParticleResonanceFlowTask.h
1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. */
2 /* See cxx source for full Copyright notice */
3 /* $Id$ */
4
5 // AliAnalysisTwoParticleResonanceFlowTask:
6 // origin: Redmer Alexander Bertens (rbertens@nikhef.nl)
7 // analyis task for Resonance-meson reconstruction and estimation of v_n
8
9 #ifndef ALIANALYSISTWOPARTICLERESONANCEFLOWTASK_H
10 #define ALIANALYSISTWOPARTICLERESONANCEFLOWTASK_H
11
12 class TH1F;
13 class TH2F;
14 class TProfile;
15 class AliFlowTrackCuts;
16 class AliFlowEvent;
17 class AliFlowTrackSimple;
18 class AliFlowEventSimple;
19 class TDirectoryFile;
20 class AliFlowCandidateTrack;
21 class AliFlowBayesianPID;
22 class AliEventPoolManager;
23 class AliResonanceFlowHelperTrack;
24
25 #include "AliAnalysisTaskSE.h"
26 class AliResonanceFlowHelperTrack : public TObject
27 {
28 public:
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; }
43 private:
44     Double_t                             fEta;      // eta
45     Double_t                             fPhi;      // phi
46     Double_t                             fp;        // p
47     Double_t                             fpX;       // pX
48     Double_t                             fpY;       // pY
49     Double_t                             fpZ;       // pZ
50     Double_t                             fpT;       // pT
51     Int_t                                fCharge;   // charge
52     Double_t                             fMass;     // mass
53     Short_t                              fID;       // id
54     Int_t                                fSpecies;  // species
55     ClassDef(AliResonanceFlowHelperTrack, 1); // lightweight helper track for phi reconstruction
56 };
57
58 class AliAnalysisTwoParticleResonanceFlowTask : public AliAnalysisTaskSE
59 {
60 public:
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; }
67    void                                 IsMC();
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();
79    // setters
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                                 SetPOICuts(AliFlowTrackCuts *cutsPOI) { fPOICuts = cutsPOI; }
83    void                                 SetRPCuts(AliFlowTrackCuts *cutsRP) { fCutsRP = cutsRP; }
84    void                                 SetEventCuts(AliFlowEventCuts *cutsEvent) {fCutsEvent = cutsEvent; }
85    void                                 SetPIDConfiguration(Float_t prob[7]) { for(Int_t i = 0; i < 7; i++) fPIDConfig[i] = prob[i]; }
86    Bool_t                               SetQA(Bool_t qa) {
87        fQA = qa; 
88        if(fCutsEvent) fCutsEvent->SetQA(kTRUE);
89        if(fPOICuts)   fPOICuts->SetQA(kTRUE);
90        if(fCutsRP)    fCutsRP->SetQA(kTRUE);
91        return fQA;}
92    void                                 SetAddTaskMacroSummary(Float_t m[12]) {for(Int_t i(0); i < 12; i++) fAddTaskMacroSummary[i] = m[i];}
93    void                                 SetPOIDCAXYZ(Float_t dca[5]) { for(Int_t i = 0; i < 5; i++) fDCAConfig[i] = dca[i]; }
94    void                                 SetMixingBins(Int_t c[20], Int_t v[20]) {for(Int_t i = 0; i < 20; i++) { fCentralityMixingBins[i] = c[i];
95                                                                                                                  fVertexMixingBins[i] = v[i]; } }
96    void                                 SetMixingParameters(Int_t p[3]) { for(Int_t i = 0; i < 3; i++) fMixingParameters[i] = p[i]; }
97    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;}
98    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;}   
99    void                                 SetCandidateEtaAndPt(Float_t mineta, Float_t maxeta, Float_t minpt, Float_t maxpt) { fCandidateMinEta = mineta;
100                                                                                                                                  fCandidateMaxEta = maxeta;
101                                                                                                                                  fCandidateMinPt = minpt;
102                                                                                                                                  fCandidateMaxPt = maxpt;
103                                                                                                                                  fCandidateEtaPtCut = kTRUE;}
104    void                                 SetCommonConstants(Int_t massBins, Float_t minMass, Float_t maxMass) { fMassBins = massBins;
105                                                                                                                  fMinMass = minMass;
106                                                                                                                  fMaxMass = maxMass; }
107    void                                 SetVertexZ(Float_t z) { fVertexRange = z; }
108    void                                 SetMaxDeltaDipAngleAndPt(Float_t a, Float_t pt) { fDeltaDipAngle = a;
109                                                                                           fDeltaDipPt = pt;
110                                                                                           fApplyDeltaDipCut = kTRUE; };
111    //getters
112    void                                 GetMixingParameters(Int_t p[3]) const { for(Int_t i = 0; i < 3; i++) p[i] = fMixingParameters[i]; } 
113    Float_t                              GetDeltaDipAngle() const {return fDeltaDipAngle; }
114    Float_t                              GetDeltaDipPt() const {return fDeltaDipPt; }
115    void                                 GetPIDConfiguration(Float_t prob[7]) const {for(Int_t i = 0; i < 7; i++) prob[i] = fPIDConfig[i]; }
116    void                                 GetPOIDCZXYZ(Float_t dca[5]) const { for(Int_t i = 0; i < 5; i++) dca[i] = fDCAConfig[i]; }
117    void                                 GetCandidateEtaAndPt(Float_t etapt[4]) const { etapt[0] = fCandidateMinEta;
118                                                                                         etapt[1] = fCandidateMaxEta;
119                                                                                         etapt[2] = fCandidateMinPt;
120                                                                                         etapt[3] = fCandidateMaxPt; }
121    AliFlowEvent*                        GetFlowEvent() const {return fFlowEvent;}
122    // the analysis itself
123    AliEventPoolManager*                 InitializeEventMixing();
124    template <typename T> Float_t        InvariantMass(const T* track1, const T* track2) const;
125    template <typename T> Float_t        DeltaDipAngle(const T* track1, const T* track2) const;
126    template <typename T> Bool_t         CheckDeltaDipAngle(const T* track1, const T* track2) const;
127    template <typename T> Bool_t         CheckCandidateEtaPtCut(const T* track1, const T* track2) const;
128    template <typename T> void           PlotMultiplcities(const T* event) const;
129    void                                 InitializeBayesianPID(AliAODEvent* event);
130    template <typename T> Bool_t         PassesTPCbayesianCut(T* track, Int_t species) const;
131    Bool_t                               PassesDCACut(AliAODTrack* track) const;
132    Bool_t                               DoOwnPID(AliAODTrack* track, Int_t species) const;
133    Bool_t                               AcceptTrack(AliAODTrack* track, Int_t species) const;
134    template <typename T> Float_t        PairPt(const T* track_1, const T* track_2, Bool_t phi = kFALSE) const;
135    template <typename T> Float_t        PtSelector(Int_t _track_type, const T* track_1, const T* track_2, Float_t mass) const;
136    template <typename T> Bool_t         QualityCheck(T* track) const;
137    void                                 TrackQA(AliAODTrack* track, Int_t species, Bool_t allChargedParticles) const;
138    template <typename T> void           SetNullCuts(T* esd);
139    void                                 PrepareFlowEvent(Int_t iMulti);
140    void                                 PhiMinusPsiMethod(TObjArray* MixingCandidates);
141    void                                 PhiMinusPsiMethodWriteData(Bool_t signal, TObjArray* SpeciesA, TObjArray* SpeciesB, Float_t* abcPsi2);
142    void                                 VZEROSubEventAnalysis();
143    void                                 DoAnalysisOnTheFly(AliFlowEventSimple* event);
144    void                                 DoAnalysisOnTheFly(TObjArray* MixingCandidates, TObjArray* SpeciesA, TObjArray* ocSpeciesA, TObjArray* SpeciesB, TObjArray* ocSpeciesB); 
145    void                                 DoAnalysisOnTheFly(TDirectoryFile* outputFile);
146    virtual void                         UserExec(Option_t *option);
147    void                                 ResonanceSignal(TObjArray* SpeciesA, TObjArray* SpeciesB) const;
148    void                                 ResonanceBackground(TObjArray* SpeciesA, TObjArray* SpeciesB, Bool_t checkAutoCorrelations = kTRUE) const;
149    void                                 ReconstructionWithEventMixing(TObjArray* MixingCandidates) const;
150    virtual void                         Terminate(Option_t *);
151
152 private:
153
154    Int_t                fSpeciesA; // particle species a
155    Int_t                fSpeciesB; // species b
156    Int_t                fChargeA; // charge for species a
157    Int_t                fChargeB; // charge for species b
158    Float_t              fMassA; // mass for species a
159    Float_t              fMassB; // mass  for species b
160    Float_t              fMinPtA; // min pt for species a
161    Float_t              fMaxPtA; // max pt for species a
162    Float_t              fMinPtB; // min pt for species b
163    Float_t              fMaxPtB; // max pt for species b
164    Bool_t               fIsMC; // use mc mode
165    Bool_t               fEventMixing; // use event mixing
166    Bool_t               fPhiMinusPsiMethod; //  use phi minus psi method (default is invariant mass fit method)
167    Bool_t               fQA; // make qa plots
168    Bool_t               fV0; // use three subevents including vzero
169    Int_t                fMassBins; // mass bins
170    Float_t              fMinMass; // mass range
171    Float_t              fMaxMass; // mass range
172    AliFlowTrackCuts     *fCutsRP; // track cuts for reference particles
173    AliFlowEventCuts     *fCutsEvent; // event cuts
174    AliFlowTrackCuts     *fNullCuts; // dummy cuts for flow event tracks
175    AliPIDResponse       *fPIDResponse; //! pid response object
176    AliFlowEvent         *fFlowEvent; //! flow events (one for each inv mass band)
177    AliFlowBayesianPID   *fBayesianResponse; //!PID response object
178    TObjArray            *fCandidates; // candidate array
179    Bool_t               fCandidateEtaPtCut; // set eta and pt cut for candidate tracks and combinatorial background
180    Float_t              fCandidateMinEta; // minimum eta for candidates
181    Float_t              fCandidateMaxEta; // maximum eta for candidates
182    Float_t              fCandidateMinPt; // minimum pt for candidates
183    Float_t              fCandidateMaxPt; // maximum pt for candidates
184    Float_t              fPIDConfig[7]; // configure pid routine
185    Float_t              fDCAConfig[5]; // configure dca routine
186    Int_t                fMixingParameters[3]; // mixing: poolsize, mixing tracks, pool buffer
187    Int_t                fCentralityMixingBins[20]; // configure centrality bins for event mixing
188    Int_t                fVertexMixingBins[20]; // configure vertex bins for event mixing
189    Float_t              fPtBins[19]; // pt bin borders
190    Float_t              fdPhiBins[19]; // dPhi bin borders
191    Int_t                fNPtBins; // no of pt bins + 1
192    Int_t                fNdPhiBins; // no of dphi bins + 1
193    Float_t              fCentrality; // event centrality
194    Float_t              fVertex; // event vertex z 
195    AliAODEvent          *fAOD;    //! AOD oject
196    AliEventPoolManager  *fPoolManager; //! event pool manager
197    TList                *fOutputList; // ! Output list
198    TH1F                 *fEventStats; // ! Histogram for event statistics
199    TH1F                 *fCentralityPass; // ! QA histogram of events that pass centrality cut
200    TH1F                 *fCentralityNoPass; //! QA histogram of events that do not pass centrality cut
201    TH2F                 *fNOPID;//! QA histogram of TPC response of all charged particles
202    TH2F                 *fPIDk;//! QA histogram of TPC response of kaons
203    TH2F                 *fPIDp; //! QA histogram of TPC response of pions
204    TH1F                 *fResonanceSignal[18]; //! signal histograms
205    TH1F                 *fResonanceBackground[18]; //! like-sign kaon pairs
206    TH1F                 *fPtSpectra[18]; //! pt spectra
207    TH1F                 *fPtP; //! QA histogram of p_t distribution of positive particles
208    TH1F                 *fPtN; //! QA histogram of p_t distribution of negative particles
209    TH1F                 *fPtSpeciesA; //! QA histogram of p_t distribution of species A
210    TH1F                 *fPtSpeciesB; //! QA histogram of p_t distribution of species B
211    TH2F                 *fMultCorAfterCuts; //! QA profile global and tpc multiplicity after outlier cut
212    TH2F                 *fMultvsCentr; //! QA profile of centralty vs multiplicity
213    Float_t              fCentralityMin; // lower bound of cenrality bin
214    Float_t              fCentralityMax; // upper bound of centrality bin
215    const char           *fkCentralityMethodA; // centrality determiantion (primary method)
216    const char           *fkCentralityMethodB; // centrality determination fallback
217    Bool_t               fCentralityCut2010; // 3 sigma cut for multiplicity outliers 
218    Bool_t               fCentralityCut2011; // 3 sigma cut for multiplicity outliers 
219    AliFlowTrackCuts     *fPOICuts; // cuts for particles of interest (flow package)
220    Float_t              fVertexRange; // absolute value of maximum distance of vertex along the z-axis
221    TH1F                 *fPhi; //! QA plot of azimuthal distribution of POI daughters
222    TH1F                 *fEta; //! QA plot of eta distribution of POI daughters
223    TH1F                 *fVZEROA; //! QA plot vzeroa multiplicity (all tracks in event)
224    TH1F                 *fVZEROC; //! QA plot vzeroc multiplicity (all tracks in event)
225    TH1F                 *fTPCM; //! QA plot TPC multiplicity (tracks used for event plane estimation)
226    Float_t              fDeltaDipAngle; // absolute value of delta dip angle to be excluded
227    Float_t              fDeltaDipPt; // upper value of pt range in which delta dip angle must be applied
228    Bool_t               fApplyDeltaDipCut; // enforce delta dip cut
229    TH2F                 *fDCAAll;//! qa dca of all charged particles
230    TH1F                 *fDCAXYQA; //! qa plot of dca xz
231    TH1F                 *fDCAZQA; //!qa plot of dca z
232    TH2F                 *fDCAPrim; //!dca of primaries (mc) or kaons (data)
233    TH2F                 *fDCASecondaryWeak; //! dca of weak (mc)
234    TH2F                 *fDCAMaterial; //!dca material (mc) all (data)
235    TProfile             *fSubEventDPhiv2; //! subevent resolution info for v2
236    TProfile             *fV0Data[18][2]; //! profiles for vzero vn(minv)
237    TH1F                 *fPhiMinusPsiDataContainer[18][18][2]; //! histograms for phi minus psi results
238    TH1F                 *fPhiMinusPsiBackgroundContainer[18][18][2]; //! histograms for phi minus psi background
239    TH1F                 *fAnalysisSummary; //! plot analysis flags
240    Float_t              fAddTaskMacroSummary[12]; // add task macro summary
241
242    AliAnalysisTwoParticleResonanceFlowTask(const AliAnalysisTwoParticleResonanceFlowTask&); // Not implemented
243    AliAnalysisTwoParticleResonanceFlowTask& operator=(const AliAnalysisTwoParticleResonanceFlowTask&); // Not implemented
244    void                 MakeTrack(Float_t, Float_t, Float_t, Float_t, Int_t , Int_t[]) const;
245
246    ClassDef(AliAnalysisTwoParticleResonanceFlowTask, 4);
247 };
248
249 #endif
250
251
252