]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGHF/hfe/AliAnalysisTaskEMCalHFEpA.h
updated
[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: March 18, 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         TH1F                            **fTPC_pt;
243         TH2F                            **fTPC_p;
244         TH1F                            **fTPCnsigma_pt;
245         TH2F                            **fTPCnsigma_p;
246         TH2F                            *fTPCnsigma_pt_2D;
247         TH2F                            *fShowerShapeCut;
248         TH2F                            *fShowerShapeM02_EoverP;
249         TH2F                            *fShowerShapeM20_EoverP;
250         TH2F                            *fShowerShape_ha;
251         TH2F                            *fShowerShape_ele;
252         TH2F                            *fTPCnsigma_eta;
253         TH2F                            *fTPCnsigma_phi;
254         TH1F                            **fECluster;
255         TH1F                            *fECluster_pure;
256         TH1F                            *fECluster_not_exotic;
257         TH1F                            *fECluster_not_exotic1;
258         TH1F                            *fECluster_not_exotic2;
259         TH1F                            *fECluster_exotic;
260         TH1F                            *fNCluster_pure;
261         TH1F                            *fNCluster_pure_aod;
262         TH2F                            *fNCluster_ECluster;
263         TH2F                            *fNcells_energy;
264         TH2F                            *fNcells_energy_elec_selected;
265         TH2F                            *fNcells_energy_not_exotic;
266         TH2F                            **fEtaPhi;
267         TH2F                            *fEtaPhi_num;
268         TH2F                            *fEtaPhi_den;
269         TH2F                            *fEtaPhi_data;
270         TH2F                            *fpt_reco_pt_MC_num;
271         TH2F                            *fpt_reco_pt_MC_den;
272         TH1F                            **fVtxZ;
273         TH1F                            *fVtxZ_new1;
274         TH1F                            *fVtxZ_new2;
275         TH1F                            *fVtxZ_new3;
276         TH1F                            *fVtxZ_new4;
277         
278         TH1F                    *fzRes1;
279         TH1F                    *fzRes2;
280         TH1F                    *fSPD_track_vtx1;
281         TH1F                        *fSPD_track_vtx2;
282         
283         TH1F                            **fEtad;
284         TH1F                            **fNTracks;
285         TH1F                            *fTrack_Multi;
286         TH2F                            **fNTracks_pt;
287         TH2F                            **fNTracks_eta;
288         TH2F                            **fNTracks_phi;
289         TH1F                            **fNClusters;
290         TH2F                            **fTPCNcls_EoverP;
291         TH2F                            **fTPCNcls_pid;
292         TH1F                            **fEta;
293         TH1F                            **fPhi;
294         TH1F                            **fR;
295         TH2F                            **fR_EoverP;
296         TH1F                            **fNcells;
297         TH2F                            **fNcells_EoverP;
298         TH1F                            **fNcells_electrons;
299         TH1F                            **fNcells_hadrons;
300         TH1F                            **fECluster_ptbins;
301         TH1F                            **fEoverP_ptbins;
302         TH1F                            **fEoverP_wSSCut;
303         TH2F                            **fM02_EoverP;
304         TH2F                            **fM20_EoverP;
305         TH2F                            **fTPCnsigma_eta_electrons;
306         TH2F                            **fTPCnsigma_eta_hadrons;
307         TH2F                            *fEoverP_pt_pions;
308         TH2F                            *ftpc_p_EoverPcut;
309         TH2F                            *fnsigma_p_EoverPcut;
310         TH2F                            *fEoverP_pt_pions2;
311         TH2F                            *fNcells_pt;
312         TH2F                            *fEoverP_pt_hadrons;
313                 //Electron-Hadron Correlation Histograms
314         TH2F                            **fCEtaPhi_Inc;
315         TH2F                            **fCEtaPhi_ULS;
316         TH2F                            **fCEtaPhi_LS;
317         TH2F                            **fCEtaPhi_ULS_NoP;
318         TH2F                            **fCEtaPhi_LS_NoP;
319         TH2F                            **fCEtaPhi_ULS_Weight;
320         TH2F                            **fCEtaPhi_LS_Weight;
321         TH2F                            **fCEtaPhi_ULS_NoP_Weight;
322         TH2F                            **fCEtaPhi_LS_NoP_Weight;
323         TH1F                            *fInvMass;
324         TH1F                            *fInvMassBack;
325         TH1F                            *fDCA;
326         TH1F                            *fDCABack;
327         TH1F                            *fOpAngle;
328         TH1F                            *fOpAngleBack;
329         TH1F                            *fInvMass2;
330         TH1F                            *fInvMassBack2;
331         TH1F                            *fDCA2;
332         TH1F                            *fDCABack2;
333         TH1F                            *fOpAngle2;
334         TH1F                            *fOpAngleBack2;
335         Double_t                        fMassCut;
336         Double_t                        fEtaCutMin;
337         Double_t                        fEtaCutMax;
338         Double_t                        fdPhiCut;
339         Double_t                        fdEtaCut;
340         Double_t                        fEoverPCutMin;
341         Double_t                        fEoverPCutMax;
342         Double_t                        fM20CutMin;
343         Double_t                        fM20CutMax;
344         Double_t                        fM02CutMin;
345         Double_t                        fM02CutMax;
346         Double_t                        fAngleCut;
347         Double_t                        fChi2Cut;
348         Double_t                        fDCAcut;
349         Bool_t                          fMassCutFlag;
350         Bool_t                          fAngleCutFlag;
351         Bool_t                          fChi2CutFlag;
352         Bool_t                          fDCAcutFlag;
353         //Correlation Function
354         Double_t                        fAssHadronPtMin;
355         Double_t                        fAssHadronPtMax;
356         //Non-HFE reconstruction efficiency
357         TH1F                            *fPtBackgroundBeforeReco;
358         TH1F                            *fPtBackgroundBeforeReco2;
359         TH1F                            *fPtBackgroundBeforeReco_weight;
360         TH1F                            *fPtBackgroundBeforeReco2_weight;
361         TH2F                            *fpT_m_electron;
362         TH2F                            *fpT_gm_electron;
363         TH1F                            *fPtBackgroundAfterReco;
364         Double_t                        fPtMinAsso;
365         Int_t                   fTpcNclsAsso;
366                 //Tracking Efficiency
367         TH1F                            *fPtMCparticleAll;
368         TH1F                            *fPtMCparticleAll_nonPrimary;
369         TH1F                            *fPtMCparticleAlle_nonPrimary;
370         TH1F                            *fPtMCparticleAlle_Primary;
371         TH1F                            *fPtMCparticleReco;
372         TH1F                            *fPtMCparticleReco_nonPrimary;
373         TH1F                            *fPtMCparticleAllHfe1;
374         TH1F                            *fPtMCparticleRecoHfe1;
375         TH1F                            *fPtMCparticleAllHfe2;
376         TH1F                            *fPtMCparticleRecoHfe2;
377         TH1F                            *fPtMCelectronAfterAll;
378         TH1F                            *fPtMCelectronAfterAll_unfolding;
379         TH1F                            *fPtMCelectronAfterAll_nonPrimary;
380         TH1F                            *fPtMCelectronAfterAll_Primary;
381         
382         TH1F                            *fPtMCpi0;
383         TH1F                            *fPtMCeta;
384         TH1F                            *fPtMCpi02;
385         TH1F                            *fPtMCeta2;
386         TH1F                            *fPtMCpi03;
387         TH1F                            *fPtMCeta3;
388         
389         TH1F                            *fPtMC_EMCal_All;
390         TH1F                            *fPtMC_EMCal_Selected;
391         TH1F                            *fPtMC_TPC_All;
392         TH1F                            *fPtMC_TPC_Selected;
393         TH1F                            *fPt_track_match_den;
394         TH1F                            *fPt_track_match_num;
395         
396                 
397         TH1F                            *fPtMCWithLabel;
398         TH1F                            *fPtMCWithoutLabel;
399         TH1F                            *fPtIsPhysicaPrimary;
400         
401                 //For the HFE package
402         AliHFEcuts                      *fCuts;                                 // Cut Collection for HFE
403                                                                                                                 //Lucile
404                                                                                                                 //AliCaloTrackAODReader                         *reader; 
405         AliCFManager            *fCFM;                                  // Correction Framework Manager
406         AliHFEpid                       *fPID;                                  // PID
407         AliHFEpidQAmanager      *fPIDqa;                                                // PID QA manager
408         
409                 //Others
410         AliStack                        *fMCstack;                                              //
411         Bool_t              fRejectKinkMother;                          //
412         TParticle                       *fMCtrack;
413         TParticle                       *fMCtrackMother;
414         TParticle                       *fMCtrackGMother;
415         TParticle                       *fMCtrackGGMother;
416         TParticle                       *fMCtrackGGGMother;
417         TClonesArray            *fMCarray;
418         AliAODMCHeader          *fMCheader;
419         AliAODMCParticle        *fMCparticle;
420         AliAODMCParticle        *fMCparticle2;
421         AliAODMCParticle        *fMCparticleMother;
422         AliAODMCParticle        *fMCparticleGMother;
423         AliAODMCParticle        *fMCparticleGGMother;
424         AliAODMCParticle        *fMCparticleGGGMother;
425         AliMCEventHandler       *fEventHandler;
426         AliMCEvent                      *fMCevent;
427         
428                 //______________________________________________________________________
429                 //Mixed event analysis
430         AliEventPoolManager *fPoolMgr;
431         AliEventPool            *fPool;
432         TObjArray                       *fTracksClone;
433         TObjArray                       *fTracks;
434         
435         TH2F                            **fCEtaPhi_Inc_EM;
436         
437         TH2F                            **fCEtaPhi_ULS_EM;
438         TH2F                            **fCEtaPhi_LS_EM;
439         
440         TH2F                            **fCEtaPhi_ULS_Weight_EM;
441         TH2F                            **fCEtaPhi_LS_Weight_EM;
442         
443         TH1F                            *fPoolNevents;
444         
445         Bool_t                          fEventMixingFlag;
446                 //______________________________________________________________________
447         
448                 //______________________________________________________________________
449                 //Di-hadron correlation
450         TH2F                            **fCEtaPhi_Inc_DiHadron;
451         TH1F                            *fPtTrigger_Inc;
452         
453                 //AliEMCALRecoUtils             *fEMCALRecoUtils;   // EMCAL Reco Utils //exotic
454                                                                                                 //AliEMCALGeometry *fEMCALGeo ;             //! EMCAL geometry pointer
455                                                                                                 //AliCalorimeterUtils *fCaloUtils;
456         
457         Int_t            fBitEGA;                    // Trigger bit on VCaloTrigger for EGA
458
459          
460                 //______________________________________________________________________
461         
462         AliAnalysisTaskEMCalHFEpA(const AliAnalysisTaskEMCalHFEpA&);                    // not implemented
463         AliAnalysisTaskEMCalHFEpA& operator=(const AliAnalysisTaskEMCalHFEpA&);                 // not implemented
464         
465         ClassDef(AliAnalysisTaskEMCalHFEpA, 1);                                                                 // example of analysis
466                                                                                                                                                         //______________________________________________________________________
467 };
468
469         ///_________________________________________________________________________________________________
470         ///Class copied from : $ALICE_ROOT/PWGCF/Correlations/DPhi/AliAnalysisTaskLongRangeCorrelations.h
471         ///Author: Christoph Mayer
472 class AliEHCParticle : public TObject {
473 public:
474         AliEHCParticle(Double_t eta=0, Double_t phi=0, Double_t pt=0)
475     : fEta(eta), fPhi(phi), fPt(pt) {}
476         virtual ~AliEHCParticle() {}
477         
478         Double_t Eta() const { return fEta; }
479         Double_t Phi() const { return fPhi; }
480         Double_t Pt() const { return fPt; }
481         
482 protected:
483 private:
484         AliEHCParticle(const AliEHCParticle&);
485         AliEHCParticle& operator=(const AliEHCParticle&);
486         
487         Double_t fEta;
488         Double_t fPhi;
489         Double_t fPt;
490         
491         ClassDef(AliEHCParticle, 1);
492 } ;
493         ///_________________________________________________________________________________________________
494
495 #endif