]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/AliAnalysisTaskEMCalHFEpA.h
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[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: June 04, 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         //Lucile
40 class AliCaloTrackAODReader;
41 class AliCaloTrackReader;
42         //exotic
43 class AliEMCALRecoUtils;
44 class AliAODReader;
45 class AliCalorimeterUtils;
46
47         // --- ROOT system ---
48 #include <TObject.h> 
49 #include <TString.h>
50 #include <TObjArray.h>
51 class TArrayF;  
52 #include <TH2I.h>
53 #include <TGeoMatrix.h>
54
55         //--- ANALYSIS system ---
56 class AliVEvent;
57 class AliVTrack;
58 class AliAODPWG4Particle;
59 class AliAODCaloCluster;
60 class AliVCaloCells;
61 class AliPHOSGeoUtils;
62 class AliEMCALGeometry;
63 #include "AliEMCALRecoUtils.h"
64
65
66         //______________________________________________________________________
67         //Library
68 #include "AliAnalysisTaskSE.h"
69 #include "AliHFEpid.h"
70 #include "AliLog.h"
71         //______________________________________________________________________
72
73         //______________________________________________________________________
74 class AliAnalysisTaskEMCalHFEpA : public AliAnalysisTaskSE 
75 {
76                 //______________________________________________________________________
77 public:
78         AliAnalysisTaskEMCalHFEpA();
79         AliAnalysisTaskEMCalHFEpA(const char *name);
80         virtual ~AliAnalysisTaskEMCalHFEpA();
81         
82         virtual void   UserCreateOutputObjects();
83         virtual void   UserExec(Option_t *option);
84         virtual void   Terminate(Option_t *);
85         
86                 //Setters
87         void SetAssHadronPtRange(Double_t AssHadronPtMin, Double_t AssHadronPtMax) {fAssHadronPtMin = AssHadronPtMin; fAssHadronPtMax = AssHadronPtMax; };
88         void SetHFECuts(AliHFEcuts * const cuts) {fCuts = cuts;};
89         void SetRejectKinkMother(Bool_t rejectKinkMother = kFALSE) {fRejectKinkMother = rejectKinkMother;};
90         void SetCorrelationAnalysis(Bool_t CorrelationFlag=kTRUE) {fCorrelationFlag = CorrelationFlag;};
91         void SetMCanalysis() {fIsMC = kTRUE;};
92         void SetCentrality(Double_t CentralityMin, Double_t CentralityMax) { fCentralityMin = CentralityMin; fCentralityMax = CentralityMax; fHasCentralitySelection = kTRUE; };
93         void SetAODanalysis(Bool_t IsAOD) {fIsAOD = IsAOD;};
94         void SetEventMixing(Bool_t EventMixingFlag) { fEventMixingFlag = EventMixingFlag;};
95         void SetNonHFEmassCut(Double_t MassCut) { fMassCut = MassCut; fMassCutFlag = kTRUE;};
96         void SetEtaCut(Double_t EtaCutMin,Double_t EtaCutMax ) { fEtaCutMin = EtaCutMin; fEtaCutMax = EtaCutMax; };
97         
98         void SetdPhidEtaCut(Double_t dPhiCut, Double_t dEtaCut ) { fdPhiCut = dPhiCut;fdEtaCut = dEtaCut ;};
99         
100         void SetEoverPCut(Double_t EoverPCutMin,Double_t EoverPCutMax ) { fEoverPCutMin = EoverPCutMin; fEoverPCutMax = EoverPCutMax; };
101         
102         void SetM02Cut(Double_t M02CutMin,Double_t M02CutMax ) { fM02CutMin = M02CutMin; fM02CutMax = M02CutMax; };
103         void SetM20Cut(Double_t M20CutMin,Double_t M20CutMax ) { fM20CutMin = M20CutMin; fM20CutMax = M20CutMax; };
104         
105         
106         void SetNonHFEangleCut(Double_t AngleCut) { fAngleCut = AngleCut; fAngleCutFlag = kTRUE;};
107         void SetNonHFEchi2Cut(Double_t Chi2Cut) { fChi2Cut = Chi2Cut; fChi2CutFlag = kTRUE;};
108         void SetNonHFEdcaCut(Double_t DCAcut) { fDCAcut = DCAcut; fDCAcutFlag = kTRUE;};
109         void SetUseEMCal() { fUseEMCal=kTRUE;};
110         void SetUseTrigger() { fUseTrigger=kTRUE;};
111         void SetUseShowerShapeCut(Bool_t UseShowerShapeCut=kFALSE) { fUseShowerShapeCut=UseShowerShapeCut;};
112         void SetBackground(Bool_t FillBackground=kFALSE) { fFillBackground=FillBackground;};
113         void SetEMCalTriggerEG1() { fEMCEG1=kTRUE; };
114         void SetEMCalTriggerEG2() { fEMCEG2=kTRUE; };
115         void SetCentralityEstimator(Int_t Estimator) { fEstimator=Estimator; }; //0 = V0A, 1 = Other
116         void SetAdditionalCuts(Double_t PtMinAsso, Int_t TpcNclsAsso) {fPtMinAsso = PtMinAsso; fTpcNclsAsso = TpcNclsAsso;};
117         void SetSPDCutForHadrons() {fAssocWithSPD = kTRUE;};
118         
119                 //Getters
120         AliHFEpid *GetPID() const {return fPID;};
121                 //bad channel
122                 //AliEMCALGeometry * GetEMCALGeometry()              const { return fEMCALGeo; }
123                 //AliCalorimeterUtils * GetCaloUtils()               const { return fCaloUtils; }
124         /*AliCalorimeterUtils * GetCaloUtils()                                { if(!fCaloUtils) fCaloUtils = new AliCalorimeterUtils(); 
125                 return fCaloUtils      ; }*/
126
127                 //______________________________________________________________________
128         
129                 //______________________________________________________________________
130 private:
131         
132                 //Function to process track cuts
133         Bool_t ProcessCutStep(Int_t cutStep, AliVParticle *track);
134                 //Function to process eh analysis
135         void ElectronHadronCorrelation(AliVTrack *track, Int_t trackIndex, AliVParticle *vtrack);
136                 //Function to find non-HFE and fill histos
137         void Background(AliVTrack *track, Int_t trackIndex, AliVParticle *vtrack, Bool_t IsTPConly);
138                 //Selected Hadrons, for mixed event analysis
139         TObjArray* SelectedHadrons();
140                 //DiHadron Correlation Background
141         void DiHadronCorrelation(AliVTrack *track, Int_t trackIndex);
142                 //Find Mothers (Finde HFE and NonHFE from MC information)
143         Bool_t FindMother(Int_t mcIndex);
144         Bool_t ContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells);
145         TArrayI GetTriggerPatches(Bool_t IsEventEMCALL0, Bool_t IsEventEMCALL1);
146         Double_t CalculateWeight(Int_t pdg_particle, Double_t x);
147         
148                 //Flags for specifics analysis
149         Bool_t                          fCorrelationFlag;
150         Bool_t                          fIsMC;
151         Bool_t                          fUseEMCal;
152         Bool_t                          fUseTrigger;
153         Bool_t                          fUseShowerShapeCut;
154         Bool_t                          fFillBackground;
155         Bool_t                          fAssocWithSPD;
156         
157         
158         Bool_t                          fEMCEG1;
159         Bool_t                          fEMCEG2;
160         
161                 //Used in the function FindMother
162         Bool_t                          fIsHFE1;
163         Bool_t                          fIsHFE2;
164         Bool_t                          fIsNonHFE;
165         Bool_t                          fIsFromD;
166         Bool_t                          fIsFromB;
167         Bool_t                          fIsFromPi0;
168         Bool_t                          fIsFromEta;
169         Bool_t                          fIsFromGamma;
170         
171                 //General variables
172         AliESDEvent                     *fESD;
173         AliAODEvent                     *fAOD;                          /// new
174         AliVEvent                       *fVevent;                       /// new
175         AliESDtrackCuts         *fPartnerCuts;
176         TList                           *fOutputList;
177         AliPIDResponse                  *fPidResponse;
178         AliSelectNonHFE                 *fNonHFE;
179         
180                 //For the case of AOD analysis
181         Bool_t                                  fIsAOD;                                 //flag for AOD analysis
182         
183                 //For Centrality Selection
184         AliCentrality                   *fCentrality;
185         Double_t                                fCentralityMin;
186         Double_t                                fCentralityMax;
187         Bool_t                                  fHasCentralitySelection;
188         TH1F                                    *fCentralityHist;
189         TH1F                                    *fCentralityHistPass;
190         Float_t                                 fZvtx;  
191         Int_t                                   fEstimator;
192         
193                 //EMCal
194         
195         AliVCluster                             *fClus;
196                 //AliESDCaloCluster             *fClusESD;
197         
198                 //Histograms
199         TH1F                            *fNevent;
200         TH1F                            *fNevent2;
201         TH1F                            *fPtElec_Inc;
202         
203         TH1F                            *fPtPrim;
204         TH1F                            *fPtSec;
205         TH1F                            *fPtPrim2;
206         TH1F                            *fPtSec2;
207         
208         
209         TH1F                            *fCharge_n;
210         TH1F                            *fCharge_p;
211         
212         TH2D                            *fTime;
213         TH2D                            *fTime2;
214         TH2D                            *ftimingEle;
215         TH2D                            *ftimingEle2;   
216         
217         TH1F                            *fPtElec_ULS;
218         TH1F                            *fPtElec_LS;
219         
220         TH1F                            *fPtElec_ULS_NoPid;
221         TH1F                            *fPtElec_LS_NoPid;
222         
223         TH1F                            *fPtElec_ULS_MC;
224         TH1F                            *fPtElec_ULS_MC_weight;
225         
226         TH1F                            *fPtElec_ULS2;
227         TH1F                            *fPtElec_LS2;
228         
229         TH1F                            *fPtElec_ULS_weight;
230         TH1F                            *fPtElec_LS_weight;
231         TH1F                            *fPtElec_ULS2_weight;
232         TH1F                            *fPtElec_LS2_weight;
233         
234                 //PID Histograms
235         
236         TH2F                            *fTOF01;
237         TH2F                            *fTOF02;
238         TH2F                            *fTOF03;
239         TH1F                            *fpid;          
240         TH2F                            **fEoverP_pt;
241         TH2F                            **fEoverP_tpc;
242         TH2F                            **fEoverP_tpc_p_trigger;
243         TH2F                            **fEoverP_tpc_pt_trigger;
244         TH1F                            **fTPC_pt;
245         TH2F                            **fTPC_p;
246         TH1F                            **fTPCnsigma_pt;
247         TH2F                            **fTPCnsigma_p;
248         TH2F                            *fTPCnsigma_pt_2D;
249         TH2F                            *fShowerShapeCut;
250         TH2F                            *fShowerShapeM02_EoverP;
251         TH2F                            *fShowerShapeM20_EoverP;
252         TH2F                            *fShowerShape_ha;
253         TH2F                            *fShowerShape_ele;
254         TH2F                            *fTPCnsigma_eta;
255         TH2F                            *fTPCnsigma_phi;
256         TH1F                            **fECluster;
257         TH1F                            *fECluster_pure;
258         TH1F                            *fECluster_not_exotic;
259         TH1F                            *fECluster_not_exotic1;
260         TH1F                            *fECluster_not_exotic2;
261         TH1F                            *fECluster_exotic;
262         TH1F                            *fNCluster_pure;
263         TH1F                            *fNCluster_pure_aod;
264         TH2F                            *fNCluster_ECluster;
265         TH2F                            *fNcells_energy;
266         TH2F                            *fNcells_energy_elec_selected;
267         TH2F                            *fNcells_energy_not_exotic;
268         TH2F                            **fEtaPhi;
269         TH2F                            *fEtaPhi_num;
270         TH2F                            *fEtaPhi_den;
271         TH2F                            *fEtaPhi_data;
272         TH2F                            *fpt_reco_pt_MC_num;
273         TH2F                            *fpt_reco_pt_MC_den;
274         TH1F                            **fVtxZ;
275         TH1F                            *fVtxZ_new1;
276         TH1F                            *fVtxZ_new2;
277         TH1F                            *fVtxZ_new3;
278         TH1F                            *fVtxZ_new4;
279         
280         TH1F                    *fzRes1;
281         TH1F                    *fzRes2;
282         TH1F                    *fSPD_track_vtx1;
283         TH1F                        *fSPD_track_vtx2;
284         
285         TH1F                            **fEtad;
286         TH1F                            **fNTracks;
287         TH1F                            *fTrack_Multi;
288         TH2F                            **fNTracks_pt;
289         TH2F                            **fNTracks_eta;
290         TH2F                            **fNTracks_phi;
291         TH1F                            **fNClusters;
292         TH2F                            **fTPCNcls_EoverP;
293         TH2F                            **fTPCNcls_pid;
294         TH1F                            **fEta;
295         TH1F                            **fPhi;
296         TH1F                            **fR;
297         TH2F                            **fR_EoverP;
298         TH1F                            **fNcells;
299         TH2F                            **fNcells_EoverP;
300         TH1F                            **fNcells_electrons;
301         TH1F                            **fNcells_hadrons;
302         TH1F                            **fECluster_ptbins;
303         TH1F                            **fEoverP_ptbins;
304         TH1F                            **fEoverP_wSSCut;
305         TH2F                            **fM02_EoverP;
306         TH2F                            **fM20_EoverP;
307         TH2F                            **fTPCnsigma_eta_electrons;
308         TH2F                            **fTPCnsigma_eta_hadrons;
309         TH2F                            *fEoverP_pt_pions;
310         TH2F                            *ftpc_p_EoverPcut;
311         TH2F                            *fnsigma_p_EoverPcut;
312         TH2F                            *fEoverP_pt_pions2;
313         TH2F                            *fNcells_pt;
314         TH2F                            *fEoverP_pt_hadrons;
315                 //Electron-Hadron Correlation Histograms
316         TH2F                            **fCEtaPhi_Inc;
317         TH2F                            **fCEtaPhi_ULS;
318         TH2F                            **fCEtaPhi_LS;
319         TH2F                            **fCEtaPhi_ULS_NoP;
320         TH2F                            **fCEtaPhi_LS_NoP;
321         TH2F                            **fCEtaPhi_ULS_Weight;
322         TH2F                            **fCEtaPhi_LS_Weight;
323         TH2F                            **fCEtaPhi_ULS_NoP_Weight;
324         TH2F                            **fCEtaPhi_LS_NoP_Weight;
325         TH1F                            *fInvMass;
326         TH1F                            *fInvMassBack;
327         TH1F                            *fDCA;
328         TH1F                            *fDCABack;
329         TH1F                            *fOpAngle;
330         TH1F                            *fOpAngleBack;
331         TH1F                            *fInvMass2;
332         TH1F                            *fInvMassBack2;
333         TH1F                            *fDCA2;
334         TH1F                            *fDCABack2;
335         TH1F                            *fOpAngle2;
336         TH1F                            *fOpAngleBack2;
337         Double_t                        fMassCut;
338         Double_t                        fEtaCutMin;
339         Double_t                        fEtaCutMax;
340         Double_t                        fdPhiCut;
341         Double_t                        fdEtaCut;
342         Double_t                        fEoverPCutMin;
343         Double_t                        fEoverPCutMax;
344         Double_t                        fM20CutMin;
345         Double_t                        fM20CutMax;
346         Double_t                        fM02CutMin;
347         Double_t                        fM02CutMax;
348         Double_t                        fAngleCut;
349         Double_t                        fChi2Cut;
350         Double_t                        fDCAcut;
351         Bool_t                          fMassCutFlag;
352         Bool_t                          fAngleCutFlag;
353         Bool_t                          fChi2CutFlag;
354         Bool_t                          fDCAcutFlag;
355         //Correlation Function
356         Double_t                        fAssHadronPtMin;
357         Double_t                        fAssHadronPtMax;
358         //Non-HFE reconstruction efficiency
359         TH1F                            *fPtBackgroundBeforeReco;
360         TH1F                            *fPtBackgroundBeforeReco2;
361         TH1F                            *fPtBackgroundBeforeReco_weight;
362         TH1F                            *fPtBackgroundBeforeReco2_weight;
363         TH2F                            *fpT_m_electron;
364         TH2F                            *fpT_gm_electron;
365         TH1F                            *fPtBackgroundAfterReco;
366         Double_t                        fPtMinAsso;
367         Int_t                   fTpcNclsAsso;
368                 //Tracking Efficiency
369         TH1F                            *fPtMCparticleAll;
370         TH1F                            *fPtMCparticleAll_nonPrimary;
371         TH1F                            *fPtMCparticleAlle_nonPrimary;
372         TH1F                            *fPtMCparticleAlle_Primary;
373         TH1F                            *fPtMCparticleReco;
374         TH1F                            *fPtMCparticleReco_nonPrimary;
375         TH1F                            *fPtMCparticleAllHfe1;
376         TH1F                            *fPtMCparticleRecoHfe1;
377         TH1F                            *fPtMCparticleAllHfe2;
378         TH1F                            *fPtMCparticleRecoHfe2;
379         TH1F                            *fPtMCelectronAfterAll;
380         TH1F                            *fPtMCelectronAfterAll_unfolding;
381         TH1F                            *fPtMCelectronAfterAll_nonPrimary;
382         TH1F                            *fPtMCelectronAfterAll_Primary;
383         
384         TH1F                            *fPtMCpi0;
385         TH1F                            *fPtMCeta;
386         TH1F                            *fPtMCpi02;
387         TH1F                            *fPtMCeta2;
388         TH1F                            *fPtMCpi03;
389         TH1F                            *fPtMCeta3;
390         
391         TH1F                            *fPtMC_EMCal_All;
392         TH1F                            *fPtMC_EMCal_Selected;
393         TH1F                            *fPtMC_TPC_All;
394         TH1F                            *fPtMC_TPC_Selected;
395         TH1F                            *fPt_track_match_den;
396         TH1F                            *fPt_track_match_num;
397         
398                 
399         TH1F                            *fPtMCWithLabel;
400         TH1F                            *fPtMCWithoutLabel;
401         TH1F                            *fPtIsPhysicaPrimary;
402         
403                 //For the HFE package
404         AliHFEcuts                      *fCuts;                                 // Cut Collection for HFE
405                                                                                                                 //Lucile
406                                                                                                                 //AliCaloTrackAODReader                         *reader; 
407         AliCFManager            *fCFM;                                  // Correction Framework Manager
408         AliHFEpid                       *fPID;                                  // PID
409         AliHFEpidQAmanager      *fPIDqa;                                                // PID QA manager
410         
411                 //Others
412         AliStack                        *fMCstack;                                              //
413         Bool_t              fRejectKinkMother;                          //
414         TParticle                       *fMCtrack;
415         TParticle                       *fMCtrackMother;
416         TParticle                       *fMCtrackGMother;
417         TParticle                       *fMCtrackGGMother;
418         TParticle                       *fMCtrackGGGMother;
419         TClonesArray            *fMCarray;
420         AliAODMCHeader          *fMCheader;
421         AliAODMCParticle        *fMCparticle;
422         AliAODMCParticle        *fMCparticle2;
423         AliAODMCParticle        *fMCparticleMother;
424         AliAODMCParticle        *fMCparticleGMother;
425         AliAODMCParticle        *fMCparticleGGMother;
426         AliAODMCParticle        *fMCparticleGGGMother;
427         AliMCEventHandler       *fEventHandler;
428         AliMCEvent                      *fMCevent;
429         
430                 //______________________________________________________________________
431                 //Mixed event analysis
432         AliEventPoolManager *fPoolMgr;
433         AliEventPool            *fPool;
434         TObjArray                       *fTracksClone;
435         TObjArray                       *fTracks;
436         
437         TH2F                            **fCEtaPhi_Inc_EM;
438         
439         TH2F                            **fCEtaPhi_ULS_EM;
440         TH2F                            **fCEtaPhi_LS_EM;
441         
442         TH2F                            **fCEtaPhi_ULS_Weight_EM;
443         TH2F                            **fCEtaPhi_LS_Weight_EM;
444         
445         TH1F                            *fPoolNevents;
446         
447         Bool_t                          fEventMixingFlag;
448                 //______________________________________________________________________
449         
450                 //______________________________________________________________________
451                 //Di-hadron correlation
452         TH2F                            **fCEtaPhi_Inc_DiHadron;
453         TH1F                            *fPtTrigger_Inc;
454         
455                 //AliEMCALRecoUtils             *fEMCALRecoUtils;   // EMCAL Reco Utils //exotic
456                                                                                                 //AliEMCALGeometry *fEMCALGeo ;             //! EMCAL geometry pointer
457                                                                                                 //AliCalorimeterUtils *fCaloUtils;
458         
459         Int_t            fBitEGA;                    // Trigger bit on VCaloTrigger for EGA
460
461          
462                 //______________________________________________________________________
463         
464         AliAnalysisTaskEMCalHFEpA(const AliAnalysisTaskEMCalHFEpA&);                    // not implemented
465         AliAnalysisTaskEMCalHFEpA& operator=(const AliAnalysisTaskEMCalHFEpA&);                 // not implemented
466         
467         ClassDef(AliAnalysisTaskEMCalHFEpA, 1);                                                                 // example of analysis
468                                                                                                                                                         //______________________________________________________________________
469 };
470
471         ///_________________________________________________________________________________________________
472         ///Class copied from : $ALICE_ROOT/PWGCF/Correlations/DPhi/AliAnalysisTaskLongRangeCorrelations.h
473         ///Author: Christoph Mayer
474 class AliEHCParticle : public TObject {
475 public:
476         AliEHCParticle(Double_t eta=0, Double_t phi=0, Double_t pt=0)
477     : fEta(eta), fPhi(phi), fPt(pt) {}
478         virtual ~AliEHCParticle() {}
479         
480         Double_t Eta() const { return fEta; }
481         Double_t Phi() const { return fPhi; }
482         Double_t Pt() const { return fPt; }
483         
484 protected:
485 private:
486         AliEHCParticle(const AliEHCParticle&);
487         AliEHCParticle& operator=(const AliEHCParticle&);
488         
489         Double_t fEta;
490         Double_t fPhi;
491         Double_t fPt;
492         
493         ClassDef(AliEHCParticle, 1);
494 } ;
495         ///_________________________________________________________________________________________________
496
497 #endif