updated for pPb analysis
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliAnalysisTaskEMCalHFEpA.h
1 #ifndef AliAnalysisTaskEMCalHFEpA_cxx
2 #define AliAnalysisTaskEMCalHFEpA_cxx
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7         ////////////////////////////////////////////////////////////////////////
8         //                                                                    //
9         //      Task for Heavy-flavour electron analysis in pPb collisions    //
10         //      (+ Electron-Hadron Jetlike Azimuthal Correlation)             //
11         //                                                                                                                                        //
12         //              version: January 13, 2014.                                                                    //
13         //                                                                    //
14         //          Authors                                                                               //
15         //              Elienos Pereira de Oliveira Filho (epereira@cern.ch)          //
16         //              Cristiane Jahnke                (cristiane.jahnke@cern.ch)                    //
17         //                                                                    //
18         ////////////////////////////////////////////////////////////////////////
19
20 class TH1F;
21 class TH2F;
22 class AliESDEvent;
23 class AliESDtrackCuts;
24 class AliESDtrack;
25 class AliHFEcontainer;
26 class AliHFEcuts;
27 class AliHFEpid;
28 class AliHFEpidQAmanager;
29 class AliCFManager;
30 class AliPIDResponse;
31 class AliCentrality;
32 class AliAODEvent;
33 class AliVEvent;
34 class AliAODMCHeader;
35 class AliSelectNonHFE;
36 class AliEventPoolManager;
37 class AliEventPool;
38 class TObjArray;
39
40         //______________________________________________________________________
41         //Library
42 #include "AliAnalysisTaskSE.h"
43 #include "AliHFEpid.h"
44 #include "AliLog.h"
45         //______________________________________________________________________
46
47         //______________________________________________________________________
48 class AliAnalysisTaskEMCalHFEpA : public AliAnalysisTaskSE 
49 {
50                 //______________________________________________________________________
51 public:
52         AliAnalysisTaskEMCalHFEpA();
53         AliAnalysisTaskEMCalHFEpA(const char *name);
54         virtual ~AliAnalysisTaskEMCalHFEpA();
55         
56         virtual void   UserCreateOutputObjects();
57         virtual void   UserExec(Option_t *option);
58         virtual void   Terminate(Option_t *);
59         
60                 //Setters
61         void SetAssHadronPtRange(Double_t AssHadronPtMin, Double_t AssHadronPtMax) {fAssHadronPtMin = AssHadronPtMin; fAssHadronPtMax = AssHadronPtMax; };
62         void SetHFECuts(AliHFEcuts * const cuts) {fCuts = cuts;};
63         void SetRejectKinkMother(Bool_t rejectKinkMother = kFALSE) {fRejectKinkMother = rejectKinkMother;};
64         void SetCorrelationAnalysis(Bool_t CorrelationFlag=kTRUE) {fCorrelationFlag = CorrelationFlag;};
65         void SetMCanalysis() {fIsMC = kTRUE;};
66         void SetCentrality(Double_t CentralityMin, Double_t CentralityMax) { fCentralityMin = CentralityMin; fCentralityMax = CentralityMax; fHasCentralitySelection = kTRUE; };
67         void SetAODanalysis(Bool_t IsAOD) {fIsAOD = IsAOD;};
68         void SetEventMixing(Bool_t EventMixingFlag) { fEventMixingFlag = EventMixingFlag;};
69         void SetNonHFEmassCut(Double_t MassCut) { fMassCut = MassCut; fMassCutFlag = kTRUE;};
70         void SetEtaCut(Double_t EtaCutMin,Double_t EtaCutMax ) { fEtaCutMin = EtaCutMin; fEtaCutMax = EtaCutMax; };
71         
72         void SetdPhidEtaCut(Double_t dPhiCut, Double_t dEtaCut ) { fdPhiCut = dPhiCut;fdEtaCut = dEtaCut ;};
73         
74         void SetEoverPCut(Double_t EoverPCutMin,Double_t EoverPCutMax ) { fEoverPCutMin = EoverPCutMin; fEoverPCutMax = EoverPCutMax; };
75         
76         void SetM02Cut(Double_t M02CutMin,Double_t M02CutMax ) { fM02CutMin = M02CutMin; fM02CutMax = M02CutMax; };
77         void SetM20Cut(Double_t M20CutMin,Double_t M20CutMax ) { fM20CutMin = M20CutMin; fM20CutMax = M20CutMax; };
78         
79         
80         void SetNonHFEangleCut(Double_t AngleCut) { fAngleCut = AngleCut; fAngleCutFlag = kTRUE;};
81         void SetNonHFEchi2Cut(Double_t Chi2Cut) { fChi2Cut = Chi2Cut; fChi2CutFlag = kTRUE;};
82         void SetNonHFEdcaCut(Double_t DCAcut) { fDCAcut = DCAcut; fDCAcutFlag = kTRUE;};
83         void SetUseEMCal() { fUseEMCal=kTRUE;};
84         void SetUseShowerShapeCut(Bool_t UseShowerShapeCut=kFALSE) { fUseShowerShapeCut=UseShowerShapeCut;};
85         void SetBackground(Bool_t FillBackground=kFALSE) { fFillBackground=FillBackground;};
86         void SetEMCalTriggerEG1() { fEMCEG1=kTRUE; };
87         void SetEMCalTriggerEG2() { fEMCEG2=kTRUE; };
88         void SetCentralityEstimator(Int_t Estimator) { fEstimator=Estimator; }; //0 = V0A, 1 = Other
89         void SetAdditionalCuts(Double_t PtMinAsso, Int_t TpcNclsAsso) {fPtMinAsso = PtMinAsso; fTpcNclsAsso = TpcNclsAsso;};
90         void SetSPDCutForHadrons() {fAssocWithSPD = kTRUE;};
91         
92                 //Getters
93         AliHFEpid *GetPID() const {return fPID;};
94                 //______________________________________________________________________
95         
96                 //______________________________________________________________________
97 private:
98         
99                 //Function to process track cuts
100         Bool_t ProcessCutStep(Int_t cutStep, AliVParticle *track);
101                 //Function to process eh analysis
102         void ElectronHadronCorrelation(AliVTrack *track, Int_t trackIndex, AliVParticle *vtrack);
103                 //Function to find non-HFE and fill histos
104         void Background(AliVTrack *track, Int_t trackIndex, AliVParticle *vtrack, Bool_t IsTPConly);
105                 //Selected Hadrons, for mixed event analysis
106         TObjArray* SelectedHadrons();
107                 //DiHadron Correlation Background
108         void DiHadronCorrelation(AliVTrack *track, Int_t trackIndex);
109                 //Find Mothers (Finde HFE and NonHFE from MC information)
110         Bool_t FindMother(Int_t mcIndex);
111         
112                 //Flags for specifics analysis
113         Bool_t                          fCorrelationFlag;
114         Bool_t                          fIsMC;
115         Bool_t                          fUseEMCal;
116         Bool_t                          fUseShowerShapeCut;
117         Bool_t                          fFillBackground;
118         Bool_t                          fAssocWithSPD;
119         
120         
121         Bool_t                          fEMCEG1;
122         Bool_t                          fEMCEG2;
123         
124                 //Used in the function FindMother
125         Bool_t                          fIsHFE1;
126         Bool_t                          fIsHFE2;
127         Bool_t                          fIsNonHFE;
128         Bool_t                          fIsFromD;
129         Bool_t                          fIsFromB;
130         Bool_t                          fIsFromPi0;
131         Bool_t                          fIsFromEta;
132         Bool_t                          fIsFromGamma;
133         
134                 //General variables
135         AliESDEvent                     *fESD;
136         AliAODEvent                     *fAOD;                          /// new
137         AliVEvent                       *fVevent;                       /// new
138         AliESDtrackCuts         *fPartnerCuts;
139         TList                           *fOutputList;
140         AliPIDResponse                  *fPidResponse;
141         AliSelectNonHFE                 *fNonHFE;
142         
143                 //For the case of AOD analysis
144         Bool_t                                  fIsAOD;                                 //flag for AOD analysis
145         
146                 //For Centrality Selection
147         AliCentrality                   *fCentrality;
148         Double_t                                fCentralityMin;
149         Double_t                                fCentralityMax;
150         Bool_t                                  fHasCentralitySelection;
151         TH1F                                    *fCentralityHist;
152         TH1F                                    *fCentralityHistPass;
153         Float_t                                 fZvtx;  
154         Int_t                                   fEstimator;
155         
156                 //EMCal
157         
158         AliVCluster                             *fClus;
159                 //AliESDCaloCluster             *fClusESD;
160         
161                 //Histograms
162         TH1F                            *fNevent;
163         TH1F                            *fPtElec_Inc;
164         
165         
166         TH1F                            *fCharge_n;
167         TH1F                            *fCharge_p;
168         
169         TH2D                            *fTime;
170         TH2D                            *fTime2;
171         TH2D                            *ftimingEle;
172         TH2D                            *ftimingEle2;   
173         
174         TH1F                            *fPtElec_ULS;
175         TH1F                            *fPtElec_LS;
176         TH1F                            *fPtElec_ULS2;
177         TH1F                            *fPtElec_LS2;
178         
179         TH1F                            *fPtElec_ULS_weight;
180         TH1F                            *fPtElec_LS_weight;
181         TH1F                            *fPtElec_ULS2_weight;
182         TH1F                            *fPtElec_LS2_weight;
183         
184                 //PID Histograms
185         
186         TH2F                            *fTOF01;
187         TH2F                            *fTOF02;
188         TH2F                            *fTOF03;
189
190         TH1F                            *fpid;          
191         
192         TH2F                            **fEoverP_pt;
193         TH2F                            **fEoverP_tpc;
194         
195         TH1F                            **fTPC_pt;
196         TH2F                            **fTPC_p;
197         
198         TH1F                            **fTPCnsigma_pt;
199         TH2F                            **fTPCnsigma_p;
200         TH2F                            *fTPCnsigma_pt_2D;
201         TH2F                            *fShowerShapeCut;
202         TH2F                            *fShowerShapeM02_EoverP;
203         TH2F                            *fShowerShapeM20_EoverP;
204         TH2F                            *fShowerShape_ha;
205         TH2F                            *fShowerShape_ele;
206         
207         TH2F                            *fTPCnsigma_eta;
208         TH2F                            *fTPCnsigma_phi;
209         
210         
211         TH1F                            **fECluster;
212         TH2F                            **fEtaPhi;
213         TH2F                            *fEtaPhi_num;
214         TH2F                            *fEtaPhi_den;
215         TH1F                            **fVtxZ;
216         TH1F                            **fEtad;
217         TH1F                            **fNTracks;
218         TH1F                            **fNClusters;
219         TH2F                            **fTPCNcls_EoverP;
220         TH2F                            **fTPCNcls_pid;
221         
222         TH1F                            **fEta;
223         TH1F                            **fPhi;
224         TH1F                            **fR;
225         TH2F                            **fR_EoverP;
226         TH1F                            **fNcells;
227         TH2F                            **fNcells_EoverP;
228         TH1F                            **fNcells_electrons;
229         TH1F                            **fNcells_hadrons;
230         TH1F                            **fECluster_ptbins;
231         TH1F                            **fEoverP_ptbins;
232         TH1F                            **fEoverP_wSSCut;
233         TH2F                            **fM02_EoverP;
234         TH2F                            **fM20_EoverP;
235         TH2F                            **fTPCnsigma_eta_electrons;
236         TH2F                            **fTPCnsigma_eta_hadrons;
237         
238         TH2F                            *fEoverP_pt_pions;
239         
240         TH2F                            *ftpc_p_EoverPcut;
241         TH2F                            *fnsigma_p_EoverPcut;
242         
243         TH2F                            *fEoverP_pt_pions2;
244         TH2F                            *fNcells_pt;
245         TH2F                            *fEoverP_pt_hadrons;
246         
247                 //Electron-Hadron Correlation Histograms
248         TH2F                            **fCEtaPhi_Inc;
249         
250         TH2F                            **fCEtaPhi_ULS;
251         TH2F                            **fCEtaPhi_LS;
252         TH2F                            **fCEtaPhi_ULS_NoP;
253         TH2F                            **fCEtaPhi_LS_NoP;
254         
255         TH2F                            **fCEtaPhi_ULS_Weight;
256         TH2F                            **fCEtaPhi_LS_Weight;
257         TH2F                            **fCEtaPhi_ULS_NoP_Weight;
258         TH2F                            **fCEtaPhi_LS_NoP_Weight;
259         
260         TH1F                            *fInvMass;
261         TH1F                            *fInvMassBack;
262         TH1F                            *fDCA;
263         TH1F                            *fDCABack;
264         TH1F                            *fOpAngle;
265         TH1F                            *fOpAngleBack;
266         
267         TH1F                            *fInvMass2;
268         TH1F                            *fInvMassBack2;
269         TH1F                            *fDCA2;
270         TH1F                            *fDCABack2;
271         TH1F                            *fOpAngle2;
272         TH1F                            *fOpAngleBack2;
273         
274         Double_t                        fMassCut;
275         Double_t                        fEtaCutMin;
276         Double_t                        fEtaCutMax;
277         
278         Double_t                        fdPhiCut;
279         Double_t                        fdEtaCut;
280         
281         Double_t                        fEoverPCutMin;
282         Double_t                        fEoverPCutMax;
283         Double_t                        fM20CutMin;
284         Double_t                        fM20CutMax;
285         Double_t                        fM02CutMin;
286         Double_t                        fM02CutMax;
287         
288         Double_t                        fAngleCut;
289         Double_t                        fChi2Cut;
290         Double_t                        fDCAcut;
291         Bool_t                          fMassCutFlag;
292         Bool_t                          fAngleCutFlag;
293         Bool_t                          fChi2CutFlag;
294         Bool_t                          fDCAcutFlag;
295         
296         //Correlation Function
297         Double_t                        fAssHadronPtMin;
298         Double_t                        fAssHadronPtMax;
299         
300                 //Non-HFE reconstruction efficiency
301         TH1F                            *fPtBackgroundBeforeReco;
302         TH1F                            *fPtBackgroundBeforeReco2;
303         TH1F                            *fPtBackgroundBeforeReco_weight;
304         TH1F                            *fPtBackgroundBeforeReco2_weight;
305         
306         TH2F                            *fpT_m_electron;
307         TH2F                            *fpT_gm_electron;
308         
309         TH1F                            *fPtBackgroundAfterReco;
310         
311         Double_t                        fPtMinAsso;
312         Int_t                   fTpcNclsAsso;
313         
314                 //Tracking Efficiency
315         TH1F                            *fPtMCparticleAll;
316         TH1F                            *fPtMCparticleAll_nonPrimary;
317         TH1F                            *fPtMCparticleAlle_nonPrimary;
318         TH1F                            *fPtMCparticleAlle_Primary;
319
320         TH1F                            *fPtMCparticleReco;
321         TH1F                            *fPtMCparticleReco_nonPrimary;
322         TH1F                            *fPtMCparticleAllHfe1;
323         TH1F                            *fPtMCparticleRecoHfe1;
324         TH1F                            *fPtMCparticleAllHfe2;
325         TH1F                            *fPtMCparticleRecoHfe2;
326         TH1F                            *fPtMCelectronAfterAll;
327         TH1F                            *fPtMCelectronAfterAll_nonPrimary;
328         TH1F                            *fPtMCelectronAfterAll_Primary;
329         
330         TH1F                            *fPtMCpi0;
331         TH1F                            *fPtMCeta;
332         
333         TH1F                            *fPtMC_EMCal_All;
334         TH1F                            *fPtMC_EMCal_Selected;
335         TH1F                            *fPtMC_TPC_All;
336         TH1F                            *fPtMC_TPC_Selected;
337         
338         TH1F                            *fPtMCWithLabel;
339         TH1F                            *fPtMCWithoutLabel;
340         TH1F                            *fPtIsPhysicaPrimary;
341         
342                 //For the HFE package
343         AliHFEcuts                      *fCuts;                                 // Cut Collection for HFE
344         AliCFManager            *fCFM;                                  // Correction Framework Manager
345         AliHFEpid                       *fPID;                                  // PID
346         AliHFEpidQAmanager      *fPIDqa;                                                // PID QA manager
347         
348                 //Others
349         AliStack                        *fMCstack;                                              //
350         Bool_t              fRejectKinkMother;                          //
351         TParticle                       *fMCtrack;
352         TParticle                       *fMCtrackMother;
353         TParticle                       *fMCtrackGMother;
354         TParticle                       *fMCtrackGGMother;
355         TParticle                       *fMCtrackGGGMother;
356         TClonesArray            *fMCarray;
357         AliAODMCHeader          *fMCheader;
358         AliAODMCParticle        *fMCparticle;
359         AliAODMCParticle        *fMCparticleMother;
360         AliAODMCParticle        *fMCparticleGMother;
361         AliAODMCParticle        *fMCparticleGGMother;
362         AliAODMCParticle        *fMCparticleGGGMother;
363         AliMCEventHandler       *fEventHandler;
364         AliMCEvent                      *fMCevent;
365         
366                 //______________________________________________________________________
367                 //Mixed event analysis
368         AliEventPoolManager *fPoolMgr;
369         AliEventPool            *fPool;
370         TObjArray                       *fTracksClone;
371         TObjArray                       *fTracks;
372         
373         TH2F                            **fCEtaPhi_Inc_EM;
374         
375         TH2F                            **fCEtaPhi_ULS_EM;
376         TH2F                            **fCEtaPhi_LS_EM;
377         
378         TH2F                            **fCEtaPhi_ULS_Weight_EM;
379         TH2F                            **fCEtaPhi_LS_Weight_EM;
380         
381         TH1F                            *fPoolNevents;
382         
383         Bool_t                          fEventMixingFlag;
384                 //______________________________________________________________________
385         
386                 //______________________________________________________________________
387                 //Di-hadron correlation
388         TH2F                            **fCEtaPhi_Inc_DiHadron;
389         TH1F                            *fPtTrigger_Inc;
390                 //______________________________________________________________________
391         
392         AliAnalysisTaskEMCalHFEpA(const AliAnalysisTaskEMCalHFEpA&);                    // not implemented
393         AliAnalysisTaskEMCalHFEpA& operator=(const AliAnalysisTaskEMCalHFEpA&);                 // not implemented
394         
395         ClassDef(AliAnalysisTaskEMCalHFEpA, 1);                                                                 // example of analysis
396                                                                                                                                                         //______________________________________________________________________
397 };
398
399         ///_________________________________________________________________________________________________
400         ///Class copied from : $ALICE_ROOT/PWGCF/Correlations/DPhi/AliAnalysisTaskLongRangeCorrelations.h
401         ///Author: Christoph Mayer
402 class AliEHCParticle : public TObject {
403 public:
404         AliEHCParticle(Double_t eta=0, Double_t phi=0, Double_t pt=0)
405     : fEta(eta), fPhi(phi), fPt(pt) {}
406         virtual ~AliEHCParticle() {}
407         
408         Double_t Eta() const { return fEta; }
409         Double_t Phi() const { return fPhi; }
410         Double_t Pt() const { return fPt; }
411         
412 protected:
413 private:
414         AliEHCParticle(const AliEHCParticle&);
415         AliEHCParticle& operator=(const AliEHCParticle&);
416         
417         Double_t fEta;
418         Double_t fPhi;
419         Double_t fPt;
420         
421         ClassDef(AliEHCParticle, 1);
422 } ;
423         ///_________________________________________________________________________________________________
424
425 #endif