]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGHF/hfe/AliAnalysisTaskEMCalHFEpA.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGHF / hfe / AliAnalysisTaskEMCalHFEpA.cxx
CommitLineData
8e2d649d 1
c852fdae 2/**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16
9a1f999b 17 ////////////////////////////////////////////////////////////////////////
18 // //
19 // Task for Heavy-flavour electron analysis in pPb collisions //
20 // (+ Electron-Hadron Jetlike Azimuthal Correlation) //
21 // //
eae1842e 22 // version: August 13, 2014. //
9a1f999b 23 // //
24 // Authors //
25 // Elienos Pereira de Oliveira Filho (epereira@cern.ch) //
26 // Cristiane Jahnke (cristiane.jahnke@cern.ch) //
27 // //
28 ////////////////////////////////////////////////////////////////////////
c852fdae 29
30#include "TChain.h"
31#include "TTree.h"
32#include "TNtuple.h"
33#include "TH1F.h"
34#include "TH2F.h"
35#include "TCanvas.h"
36#include "AliAnalysisTask.h"
37#include "AliAnalysisManager.h"
38#include "AliESDEvent.h"
39#include "AliAODEvent.h"
40#include "AliVEvent.h"
41#include "AliESDInputHandler.h"
42#include "AliESDtrackCuts.h"
43#include "AliESDCaloCluster.h"
44#include "AliESDCaloCells.h"
45#include "AliEMCALTrack.h"
46#include "AliExternalTrackParam.h"
47#include "AliPhysicsSelection.h"
48#include "TGeoGlobalMagField.h"
49#include "AliMagF.h"
50#include "AliLog.h"
51#include "AliStack.h"
52#include "AliCentrality.h"
53#include "AliAODMCParticle.h"
54#include "AliAODMCHeader.h"
55#include "AliPID.h"
56#include "AliPIDResponse.h"
57#include "AliHFEcontainer.h"
58#include "AliHFEcuts.h"
59#include "AliHFEpid.h"
60#include "AliHFEpidBase.h"
61#include "AliHFEpidQAmanager.h"
62#include "AliHFEtools.h"
63#include "AliCFContainer.h"
64#include "AliCFManager.h"
65#include "AliSelectNonHFE.h"
66#include "AliHFEpidTPC.h"
67#include "AliAnalysisTaskEMCalHFEpA.h"
68#include "TMath.h"
69#include "THnSparse.h"
70#include "TLorentzVector.h"
71#include "TString.h"
72#include "TFile.h"
73#include "AliESDHandler.h"
74#include "AliMCEventHandler.h"
75#include "AliMCEvent.h"
76#include "AliStack.h"
77#include "TParticle.h"
78#include "AliLog.h"
79#include "AliAnalysisTaskSE.h"
80#include "TRefArray.h"
81#include "TVector.h"
82#include "stdio.h"
83#include "TGeoManager.h"
84#include "iostream"
85#include "fstream"
86#include "AliKFParticle.h"
87#include "AliKFVertex.h"
88#include "AliVParticle.h"
89#include "AliVTrack.h"
90#include "AliEventPoolManager.h"
91#include "TObjArray.h"
8e2d649d 92 //include to use reader as Lucile does
93#include "AliCaloTrackAODReader.h"
94#include "AliCaloTrackReader.h"
1dd85087 95#include "AliEMCALRecoUtils.h" //to remove exotics
96#include "AliAODHeader.h"
97#include "AliEMCALGeometry.h"
98
99
100
101 // --- ANALYSIS system ---
102#include "AliCalorimeterUtils.h"
103#include "AliESDEvent.h"
104#include "AliMCEvent.h"
105#include "AliStack.h"
106#include "AliAODPWG4Particle.h"
107#include "AliVCluster.h"
108#include "AliVCaloCells.h"
109#include "AliMixedEvent.h"
110#include "AliAODCaloCluster.h"
111#include "AliOADBContainer.h"
112#include "AliAnalysisManager.h"
113
114 // --- Detector ---
115#include "AliEMCALGeometry.h"
116#include "AliPHOSGeoUtils.h"
8e2d649d 117
9a1f999b 118 //______________________________________________________________________
c852fdae 119
9a1f999b 120 //______________________________________________________________________
c852fdae 121ClassImp(AliAnalysisTaskEMCalHFEpA)
122
9a1f999b 123 //______________________________________________________________________
c852fdae 124AliAnalysisTaskEMCalHFEpA::AliAnalysisTaskEMCalHFEpA(const char *name)
9a1f999b 125: AliAnalysisTaskSE(name)
126,fCorrelationFlag(0)
127,fIsMC(0)
128,fUseEMCal(kFALSE)
1dd85087 129
8e2d649d 130,fUseTrigger(kFALSE)
9a1f999b 131,fUseShowerShapeCut(kFALSE)
132,fFillBackground(kFALSE)
2c8e1f6c 133,fAssocWithSPD(kFALSE)
9a1f999b 134
135,fEMCEG1(kFALSE)
136,fEMCEG2(kFALSE)
137,fIsHFE1(kFALSE)
138,fIsHFE2(kFALSE)
139,fIsNonHFE(kFALSE)
140,fIsFromD(kFALSE)
141,fIsFromB(kFALSE)
142,fIsFromPi0(kFALSE)
143,fIsFromEta(kFALSE)
144,fIsFromGamma(kFALSE)
145,fESD(0)
146,fAOD(0)
147,fVevent(0)
148,fPartnerCuts(new AliESDtrackCuts())
149,fOutputList(0)
150,fPidResponse(0)
151,fNonHFE(new AliSelectNonHFE())
152,fIsAOD(kFALSE)
153,fCentrality(0)
154,fCentralityMin(0)
155,fCentralityMax(100)
156,fHasCentralitySelection(kFALSE)
157,fCentralityHist(0)
158,fCentralityHistPass(0)
159,fZvtx(0)
160,fEstimator(0)
161,fClus(0)
1dd85087 162//,fClusESD(0)
9a1f999b 163,fNevent(0)
1dd85087 164,fNevent2(0)
9a1f999b 165,fPtElec_Inc(0)
8e2d649d 166,fPtPrim(0)
167,fPtSec(0)
168,fPtPrim2(0)
169,fPtSec2(0)
9a1f999b 170,fCharge_n(0)
171,fCharge_p(0)
9a1f999b 172,fTime(0)
173,fTime2(0)
174,ftimingEle(0)
175,ftimingEle2(0)
9a1f999b 176,fPtElec_ULS(0)
177,fPtElec_LS(0)
8e2d649d 178,fPtElec_ULS_NoPid(0)
179,fPtElec_LS_NoPid(0)
180,fPtElec_ULS_MC(0)
181,fPtElec_ULS_MC_weight(0)
9a1f999b 182,fPtElec_ULS2(0)
183,fPtElec_LS2(0)
2c8e1f6c 184,fPtElec_ULS_weight(0)
185,fPtElec_LS_weight(0)
186,fPtElec_ULS2_weight(0)
187,fPtElec_LS2_weight(0)
2c8e1f6c 188,fTOF01(0)
189,fTOF02(0)
190,fTOF03(0)
9a1f999b 191,fpid(0)
192,fEoverP_pt(0)
193,fEoverP_tpc(0)
628d0da7 194,fEoverP_tpc_p_trigger(0)
195,fEoverP_tpc_pt_trigger(0)
9a1f999b 196,fTPC_pt(0)
197,fTPC_p(0)
198,fTPCnsigma_pt(0)
199,fTPCnsigma_p(0)
93c64cd2 200,fTPCnsigma_p_TPC(0)
201,fTPCnsigma_p_TPC_on_EMCal_acc(0)
202,fTPCnsigma_p_TPC_EoverP_cut(0)
9a1f999b 203,fTPCnsigma_pt_2D(0)
204,fShowerShapeCut(0)
9a4682da 205,fShowerShapeM02_EoverP(0)
206,fShowerShapeM20_EoverP(0)
9a1f999b 207,fShowerShape_ha(0)
208,fShowerShape_ele(0)
9a1f999b 209,fTPCnsigma_eta(0)
210,fTPCnsigma_phi(0)
211,fECluster(0)
8e2d649d 212,fECluster_pure(0)
1dd85087 213,fECluster_not_exotic(0)
214,fECluster_not_exotic1(0)
215,fECluster_not_exotic2(0)
216,fECluster_exotic(0)
217,fNCluster_pure(0)
218,fNCluster_pure_aod(0)
219,fNCluster_ECluster(0)
220,fNcells_energy(0)
221,fNcells_energy_elec_selected(0)
222,fNcells_energy_not_exotic(0)
223
9a1f999b 224,fEtaPhi(0)
0131ce6c 225,fEtaPhi_num(0)
226,fEtaPhi_den(0)
1dd85087 227,fEtaPhi_data(0)
8e2d649d 228,fpt_reco_pt_MC_num(0)
229,fpt_reco_pt_MC_den(0)
9a1f999b 230,fVtxZ(0)
0131ce6c 231
8e2d649d 232,fVtxZ_new1(0)
233,fVtxZ_new2(0)
234,fVtxZ_new3(0)
235,fVtxZ_new4(0)
236
1dd85087 237,fzRes1(0)
238,fzRes2(0)
239,fSPD_track_vtx1(0)
240,fSPD_track_vtx2(0)
241
242
8e2d649d 243,fEtad(0)
9a1f999b 244,fNTracks(0)
1dd85087 245,fTrack_Multi(0)
8e2d649d 246,fNTracks_pt(0)
247,fNTracks_eta(0)
248,fNTracks_phi(0)
9a1f999b 249,fNClusters(0)
250,fTPCNcls_EoverP(0)
31185d97 251,fTPCNcls_pid(0)
9a1f999b 252,fEta(0)
253,fPhi(0)
254,fR(0)
255,fR_EoverP(0)
256,fNcells(0)
257,fNcells_EoverP(0)
258,fNcells_electrons(0)
259,fNcells_hadrons(0)
260,fECluster_ptbins(0)
261,fEoverP_ptbins(0)
262,fEoverP_wSSCut(0)
263,fM02_EoverP(0)
264,fM20_EoverP(0)
265,fTPCnsigma_eta_electrons(0)
266,fTPCnsigma_eta_hadrons(0)
267,fEoverP_pt_pions(0)
268,ftpc_p_EoverPcut(0)
269,fnsigma_p_EoverPcut(0)
270,fEoverP_pt_pions2(0)
271,fNcells_pt(0)
272,fEoverP_pt_hadrons(0)
273,fCEtaPhi_Inc(0)
274,fCEtaPhi_ULS(0)
275,fCEtaPhi_LS(0)
276,fCEtaPhi_ULS_NoP(0)
277,fCEtaPhi_LS_NoP(0)
278,fCEtaPhi_ULS_Weight(0)
279,fCEtaPhi_LS_Weight(0)
280,fCEtaPhi_ULS_NoP_Weight(0)
281,fCEtaPhi_LS_NoP_Weight(0)
9a1f999b 282,fInvMass(0)
283,fInvMassBack(0)
284,fDCA(0)
285,fDCABack(0)
286,fOpAngle(0)
287,fOpAngleBack(0)
9a1f999b 288,fInvMass2(0)
289,fInvMassBack2(0)
290,fDCA2(0)
291,fDCABack2(0)
292,fOpAngle2(0)
293,fOpAngleBack2(0)
9a1f999b 294,fMassCut(0.1)
295,fEtaCutMin(-0.9)
296,fEtaCutMax(0.9)
9a1f999b 297,fdPhiCut(0.05)
298,fdEtaCut(0.05)
9a1f999b 299,fEoverPCutMin(0.8)
300,fEoverPCutMax(1.2)
9a1f999b 301,fM20CutMin(0.0)
302,fM20CutMax(10)
303,fM02CutMin(0.0)
304,fM02CutMax(10)
9a1f999b 305,fAngleCut(999)
306,fChi2Cut(3.5)
a4e971f7 307,fDCAcut(999)//dca between two tracks
308,fDCAcutr(999)//dca to vertex
309,fDCAcutz(999)//dca to vertex
9a1f999b 310,fMassCutFlag(kTRUE)
311,fAngleCutFlag(kFALSE)
312,fChi2CutFlag(kFALSE)
313,fDCAcutFlag(kFALSE)
0131ce6c 314,fAssHadronPtMin(0.5)
315,fAssHadronPtMax(2.0)
9a1f999b 316,fPtBackgroundBeforeReco(0)
317,fPtBackgroundBeforeReco2(0)
2c8e1f6c 318,fPtBackgroundBeforeReco_weight(0)
319,fPtBackgroundBeforeReco2_weight(0)
2235208e 320,fpT_m_electron(0)
321,fpT_gm_electron(0)
9a1f999b 322,fPtBackgroundAfterReco(0)
9a1f999b 323,fPtMinAsso(0.3)
324,fTpcNclsAsso(80)
9a1f999b 325,fPtMCparticleAll(0)
326,fPtMCparticleAll_nonPrimary(0)
327,fPtMCparticleAlle_nonPrimary(0)
2c8e1f6c 328,fPtMCparticleAlle_Primary(0)
9a1f999b 329,fPtMCparticleReco(0)
330,fPtMCparticleReco_nonPrimary(0)
331,fPtMCparticleAllHfe1(0)
332,fPtMCparticleRecoHfe1(0)
333,fPtMCparticleAllHfe2(0)
334,fPtMCparticleRecoHfe2(0)
335,fPtMCelectronAfterAll(0)
8e2d649d 336,fPtMCelectronAfterAll_unfolding(0)
9a1f999b 337,fPtMCelectronAfterAll_nonPrimary(0)
2c8e1f6c 338,fPtMCelectronAfterAll_Primary(0)
9a1f999b 339,fPtMCpi0(0)
340,fPtMCeta(0)
8e2d649d 341,fPtMCpi02(0)
342,fPtMCeta2(0)
1dd85087 343,fPtMCpi03(0)
344,fPtMCeta3(0)
9a1f999b 345,fPtMC_EMCal_All(0)
346,fPtMC_EMCal_Selected(0)
347,fPtMC_TPC_All(0)
348,fPtMC_TPC_Selected(0)
8e2d649d 349,fPt_track_match_den(0)
350,fPt_track_match_num(0)
9a1f999b 351,fPtMCWithLabel(0)
352,fPtMCWithoutLabel(0)
353,fPtIsPhysicaPrimary(0)
354,fCuts(0)
8e2d649d 355 //,reader(0)
9a1f999b 356,fCFM(0)
357,fPID(new AliHFEpid("hfePid"))
8e2d649d 358 //Lucile
9a1f999b 359,fPIDqa(0)
360,fMCstack(0)
361,fRejectKinkMother(kFALSE)
362,fMCtrack(0)
363,fMCtrackMother(0)
364,fMCtrackGMother(0)
365,fMCtrackGGMother(0)
366,fMCtrackGGGMother(0)
367,fMCarray(0)
368,fMCheader(0)
369,fMCparticle(0)
8e2d649d 370,fMCparticle2(0)
9a1f999b 371,fMCparticleMother(0)
372,fMCparticleGMother(0)
373,fMCparticleGGMother(0)
374,fMCparticleGGGMother(0)
375,fEventHandler(0)
376,fMCevent(0)
377,fPoolMgr(0)
378,fPool(0)
379,fTracksClone(0)
380,fTracks(0)
381,fCEtaPhi_Inc_EM(0)
382,fCEtaPhi_ULS_EM(0)
383,fCEtaPhi_LS_EM(0)
384,fCEtaPhi_ULS_Weight_EM(0)
385,fCEtaPhi_LS_Weight_EM(0)
386,fPoolNevents(0)
387,fEventMixingFlag(0)
388,fCEtaPhi_Inc_DiHadron(0)
389,fPtTrigger_Inc(0)
1dd85087 390 //,fEMCALRecoUtils(new AliEMCALRecoUtils)
391 //,fEMCALGeo(0x0)
392 //,fCaloUtils(0x0)
393
394,fBitEGA(0)
395//,fEMCALRecoUtils(0)//exotic
396
c852fdae 397{
9a1f999b 398 //Named constructor
399 // Define input and output slots here
400 // Input slot #0 works with a TChain
1dd85087 401
402 //exotic
403 //fEMCALRecoUtils = new AliEMCALRecoUtils();
404
9a1f999b 405 DefineInput(0, TChain::Class());
406 // Output slot #0 id reserved by the base class for AOD
407 // Output slot #1 writes into a TH1 container
408 // DefineOutput(1, TH1I::Class());
409 DefineOutput(1, TList::Class());
410 // DefineOutput(3, TTree::Class());
c852fdae 411}
412
9a1f999b 413 //________________________________________________________________________
c852fdae 414AliAnalysisTaskEMCalHFEpA::AliAnalysisTaskEMCalHFEpA()
9a1f999b 415: AliAnalysisTaskSE("DefaultAnalysis_AliAnalysisTaskEMCalHFEpA")
416,fCorrelationFlag(0)
417,fIsMC(0)
418,fUseEMCal(kFALSE)
8e2d649d 419,fUseTrigger(kFALSE)
9a1f999b 420,fUseShowerShapeCut(kFALSE)
421,fFillBackground(kFALSE)
2c8e1f6c 422,fAssocWithSPD(kFALSE)
9a1f999b 423,fEMCEG1(kFALSE)
424,fEMCEG2(kFALSE)
425,fIsHFE1(kFALSE)
426,fIsHFE2(kFALSE)
427,fIsNonHFE(kFALSE)
428,fIsFromD(kFALSE)
429,fIsFromB(kFALSE)
430,fIsFromPi0(kFALSE)
431,fIsFromEta(kFALSE)
432,fIsFromGamma(kFALSE)
433,fESD(0)
434,fAOD(0)
435,fVevent(0)
436,fPartnerCuts(new AliESDtrackCuts())
437,fOutputList(0)
438,fPidResponse(0)
439,fNonHFE(new AliSelectNonHFE())
440,fIsAOD(kFALSE)
441,fCentrality(0)
442,fCentralityMin(0)
443,fCentralityMax(100)
444,fHasCentralitySelection(kFALSE)
445,fCentralityHist(0)
446,fCentralityHistPass(0)
447,fZvtx(0)
448,fEstimator(0)
449,fClus(0)
a89620c8 450 //,fClusESD(0)
9a1f999b 451,fNevent(0)
1dd85087 452,fNevent2(0)
9a1f999b 453,fPtElec_Inc(0)
8e2d649d 454,fPtPrim(0)
455,fPtSec(0)
456,fPtPrim2(0)
457,fPtSec2(0)
9a1f999b 458,fCharge_n(0)
459,fCharge_p(0)
9a1f999b 460,fTime(0)
461,fTime2(0)
462,ftimingEle(0)
463,ftimingEle2(0)
9a1f999b 464,fPtElec_ULS(0)
465,fPtElec_LS(0)
8e2d649d 466,fPtElec_ULS_NoPid(0)
467,fPtElec_LS_NoPid(0)
468,fPtElec_ULS_MC(0)
469,fPtElec_ULS_MC_weight(0)
9a1f999b 470,fPtElec_ULS2(0)
471,fPtElec_LS2(0)
2c8e1f6c 472,fPtElec_ULS_weight(0)
473,fPtElec_LS_weight(0)
474,fPtElec_ULS2_weight(0)
475,fPtElec_LS2_weight(0)
2c8e1f6c 476,fTOF01(0)
477,fTOF02(0)
478,fTOF03(0)
9a1f999b 479,fpid(0)
480,fEoverP_pt(0)
481,fEoverP_tpc(0)
628d0da7 482,fEoverP_tpc_p_trigger(0)
483,fEoverP_tpc_pt_trigger(0)
9a1f999b 484,fTPC_pt(0)
485,fTPC_p(0)
486,fTPCnsigma_pt(0)
487,fTPCnsigma_p(0)
93c64cd2 488,fTPCnsigma_p_TPC(0)
489,fTPCnsigma_p_TPC_on_EMCal_acc(0)
490,fTPCnsigma_p_TPC_EoverP_cut(0)
9a1f999b 491,fTPCnsigma_pt_2D(0)
492,fShowerShapeCut(0)
9a4682da 493,fShowerShapeM02_EoverP(0)
494,fShowerShapeM20_EoverP(0)
9a4682da 495,fShowerShape_ha(0)
496,fShowerShape_ele(0)
9a1f999b 497,fTPCnsigma_eta(0)
498,fTPCnsigma_phi(0)
499,fECluster(0)
8e2d649d 500,fECluster_pure(0)
1dd85087 501,fECluster_not_exotic(0)
502,fECluster_not_exotic1(0)
503,fECluster_not_exotic2(0)
504,fECluster_exotic(0)
505,fNCluster_pure(0)
506,fNCluster_pure_aod(0)
507,fNCluster_ECluster(0)
508,fNcells_energy(0)
509,fNcells_energy_elec_selected(0)
510,fNcells_energy_not_exotic(0)
9a1f999b 511,fEtaPhi(0)
0131ce6c 512,fEtaPhi_num(0)
513,fEtaPhi_den(0)
1dd85087 514,fEtaPhi_data(0)
8e2d649d 515,fpt_reco_pt_MC_num(0)
516,fpt_reco_pt_MC_den(0)
9a1f999b 517,fVtxZ(0)
0131ce6c 518
8e2d649d 519,fVtxZ_new1(0)
520,fVtxZ_new2(0)
521,fVtxZ_new3(0)
522,fVtxZ_new4(0)
523
1dd85087 524,fzRes1(0)
525,fzRes2(0)
526,fSPD_track_vtx1(0)
527,fSPD_track_vtx2(0)
528
529
530
8e2d649d 531,fEtad(0)
9a1f999b 532,fNTracks(0)
1dd85087 533,fTrack_Multi(0)
8e2d649d 534,fNTracks_pt(0)
535,fNTracks_eta(0)
536,fNTracks_phi(0)
9a1f999b 537,fNClusters(0)
538,fTPCNcls_EoverP(0)
31185d97 539,fTPCNcls_pid(0)
9a1f999b 540,fEta(0)
541,fPhi(0)
542,fR(0)
543,fR_EoverP(0)
544,fNcells(0)
545,fNcells_EoverP(0)
546,fNcells_electrons(0)
547,fNcells_hadrons(0)
548,fECluster_ptbins(0)
549,fEoverP_ptbins(0)
550,fEoverP_wSSCut(0)
551,fM02_EoverP(0)
552,fM20_EoverP(0)
553,fTPCnsigma_eta_electrons(0)
554,fTPCnsigma_eta_hadrons(0)
555,fEoverP_pt_pions(0)
556,ftpc_p_EoverPcut(0)
557,fnsigma_p_EoverPcut(0)
558,fEoverP_pt_pions2(0)
559,fNcells_pt(0)
560,fEoverP_pt_hadrons(0)
561,fCEtaPhi_Inc(0)
562,fCEtaPhi_ULS(0)
563,fCEtaPhi_LS(0)
564,fCEtaPhi_ULS_NoP(0)
565,fCEtaPhi_LS_NoP(0)
566,fCEtaPhi_ULS_Weight(0)
567,fCEtaPhi_LS_Weight(0)
568,fCEtaPhi_ULS_NoP_Weight(0)
569,fCEtaPhi_LS_NoP_Weight(0)
9a1f999b 570,fInvMass(0)
571,fInvMassBack(0)
572,fDCA(0)
573,fDCABack(0)
574,fOpAngle(0)
575,fOpAngleBack(0)
9a1f999b 576,fInvMass2(0)
577,fInvMassBack2(0)
578,fDCA2(0)
579,fDCABack2(0)
580,fOpAngle2(0)
581,fOpAngleBack2(0)
9a1f999b 582,fMassCut(0.1)
583,fEtaCutMin(-0.9)
584,fEtaCutMax(0.9)
9a1f999b 585,fdPhiCut(0.05)
586,fdEtaCut(0.05)
9a1f999b 587,fEoverPCutMin(0.8)
588,fEoverPCutMax(1.2)
9a1f999b 589,fM20CutMin(0)
590,fM20CutMax(10)
591,fM02CutMin(0)
592,fM02CutMax(10)
9a1f999b 593,fAngleCut(999)
594,fChi2Cut(3.5)
a4e971f7 595,fDCAcut(999)//dca between two tracks
596,fDCAcutr(999)//dca to vertex
597,fDCAcutz(999)//dca to vertex
9a1f999b 598,fMassCutFlag(kTRUE)
599,fAngleCutFlag(kFALSE)
600,fChi2CutFlag(kFALSE)
601,fDCAcutFlag(kFALSE)
0131ce6c 602,fAssHadronPtMin(0.5)
603,fAssHadronPtMax(2.0)
9a1f999b 604,fPtBackgroundBeforeReco(0)
605,fPtBackgroundBeforeReco2(0)
2c8e1f6c 606,fPtBackgroundBeforeReco_weight(0)
607,fPtBackgroundBeforeReco2_weight(0)
2235208e 608,fpT_m_electron(0)
609,fpT_gm_electron(0)
9a1f999b 610,fPtBackgroundAfterReco(0)
9a1f999b 611,fPtMinAsso(0.3)
612,fTpcNclsAsso(80)
9a1f999b 613,fPtMCparticleAll(0)
614,fPtMCparticleAll_nonPrimary(0)
615,fPtMCparticleAlle_nonPrimary(0)
2c8e1f6c 616,fPtMCparticleAlle_Primary(0)
9a1f999b 617,fPtMCparticleReco(0)
618,fPtMCparticleReco_nonPrimary(0)
9a1f999b 619,fPtMCparticleAllHfe1(0)
620,fPtMCparticleRecoHfe1(0)
621,fPtMCparticleAllHfe2(0)
622,fPtMCparticleRecoHfe2(0)
623,fPtMCelectronAfterAll(0)
8e2d649d 624,fPtMCelectronAfterAll_unfolding(0)
9a1f999b 625,fPtMCelectronAfterAll_nonPrimary(0)
2c8e1f6c 626,fPtMCelectronAfterAll_Primary(0)
9a1f999b 627,fPtMCpi0(0)
628,fPtMCeta(0)
8e2d649d 629,fPtMCpi02(0)
630,fPtMCeta2(0)
1dd85087 631,fPtMCpi03(0)
632,fPtMCeta3(0)
9a1f999b 633,fPtMC_EMCal_All(0)
634,fPtMC_EMCal_Selected(0)
635,fPtMC_TPC_All(0)
636,fPtMC_TPC_Selected(0)
8e2d649d 637,fPt_track_match_den(0)
638,fPt_track_match_num(0)
9a1f999b 639,fPtMCWithLabel(0)
640,fPtMCWithoutLabel(0)
641,fPtIsPhysicaPrimary(0)
642,fCuts(0)
8e2d649d 643 //Lucile
644 //,reader(0)
9a1f999b 645,fCFM(0)
646,fPID(new AliHFEpid("hfePid"))
647,fPIDqa(0)
648,fMCstack(0)
649,fRejectKinkMother(kFALSE)
650,fMCtrack(0)
651,fMCtrackMother(0)
652,fMCtrackGMother(0)
653,fMCtrackGGMother(0)
654,fMCtrackGGGMother(0)
655,fMCarray(0)
656,fMCheader(0)
657,fMCparticle(0)
8e2d649d 658,fMCparticle2(0)
9a1f999b 659,fMCparticleMother(0)
660,fMCparticleGMother(0)
661,fMCparticleGGMother(0)
662,fMCparticleGGGMother(0)
663,fEventHandler(0)
664,fMCevent(0)
665,fPoolMgr(0)
666,fPool(0)
667,fTracksClone(0)
668,fTracks(0)
669,fCEtaPhi_Inc_EM(0)
670,fCEtaPhi_ULS_EM(0)
671,fCEtaPhi_LS_EM(0)
672,fCEtaPhi_ULS_Weight_EM(0)
673,fCEtaPhi_LS_Weight_EM(0)
674,fPoolNevents(0)
675,fEventMixingFlag(0)
676,fCEtaPhi_Inc_DiHadron(0)
677,fPtTrigger_Inc(0)
1dd85087 678 //,fEMCALRecoUtils(new AliEMCALRecoUtils)
679 //,fEMCALGeo(0x0)
680 //,fCaloUtils(0x0)
681,fBitEGA(0)
682 //,fEMCALRecoUtils(0)//exotic
c852fdae 683{
9a1f999b 684 // Constructor
685 // Define input and output slots here
686 // Input slot #0 works with a TChain
1dd85087 687
688 //exotic
689 // fEMCALRecoUtils = new AliEMCALRecoUtils();
690
c852fdae 691 DefineInput(0, TChain::Class());
9a1f999b 692 // Output slot #0 id reserved by the base class for AOD
693 // Output slot #1 writes into a TH1 container
694 // DefineOutput(1, TH1I::Class());
c852fdae 695 DefineOutput(1, TList::Class());
9a1f999b 696 //DefineOutput(3, TTree::Class());
c852fdae 697}
698
9a1f999b 699 //______________________________________________________________________
c852fdae 700AliAnalysisTaskEMCalHFEpA::~AliAnalysisTaskEMCalHFEpA()
701{
8e2d649d 702 //Destructor
c852fdae 703 delete fOutputList;
704 delete fPID;
705 delete fCFM;
706 delete fPIDqa;
8e2d649d 707 //Lucile
708 //delete reader;
1dd85087 709 //if(fEMCALRecoUtils) delete fEMCALRecoUtils ;
c852fdae 710}
711
9a1f999b 712 //______________________________________________________________________
713 //Create Output Objects
714 //Here we can define the histograms and others output files
715 //Called once
c852fdae 716void AliAnalysisTaskEMCalHFEpA::UserCreateOutputObjects()
717{
9a1f999b 718 //______________________________________________________________________
719 //Initialize PID
c852fdae 720 if(!fPID->GetNumberOfPIDdetectors())
721 {
722 fPID->AddDetector("TPC", 0);
723 }
9a1f999b 724
c852fdae 725 fPID->SortDetectors();
726
727 fPIDqa = new AliHFEpidQAmanager();
728 fPIDqa->Initialize(fPID);
9a1f999b 729 //______________________________________________________________________
730
731 //______________________________________________________________________
732 //Initialize correction Framework and Cuts
c852fdae 733 fCFM = new AliCFManager;
734 const Int_t kNcutSteps = AliHFEcuts::kNcutStepsMCTrack + AliHFEcuts::kNcutStepsRecTrack + AliHFEcuts::kNcutStepsDETrack;
735 fCFM->SetNStepParticle(kNcutSteps);
736 for(Int_t istep = 0; istep < kNcutSteps; istep++) fCFM->SetParticleCutsList(istep, NULL);
9a1f999b 737
c852fdae 738 if(!fCuts)
739 {
740 AliWarning("Cuts not available. Default cuts will be used");
741 fCuts = new AliHFEcuts;
742 fCuts->CreateStandardCuts();
743 }
744
745 fCuts->Initialize(fCFM);
9a1f999b 746 //______________________________________________________________________
747
8e2d649d 748 ///___________________//Lucile
749
750 //if(fIsAOD) {
751 // reader = new AliCaloTrackAODReader();
752 //}
753 //___________________________________________________
9a1f999b 754 ///Output Tlist
755 //Create TList
c852fdae 756 fOutputList = new TList();
757 fOutputList->SetOwner();
9a1f999b 758
759 //PIDqa
c852fdae 760 fOutputList->Add(fPIDqa->MakeList("PIDQA"));
9a1f999b 761
762 //Store the number of events
763 //Define the histo
1dd85087 764 fNevent = new TH1F("fNevent","Number of Events",30,0,30);
765 fNevent2 = new TH1F("fNevent2","Number of Events 2",30,0,30);
9a1f999b 766 //And then, add to the output list
c852fdae 767 fOutputList->Add(fNevent);
1dd85087 768 fOutputList->Add(fNevent2);
c852fdae 769
770 fpid = new TH1F("fpid","PID flag",5,0,5);
771 fOutputList->Add(fpid);
772
8e2d649d 773 //pt Distribution
774 fPtElec_Inc = new TH1F("fPtElec_Inc","Inclusive Electrons; p_{T} (GeV/c); Count",300,0,30);
775
776 fPtPrim = new TH1F("fPtPrim","Primary Electrons aod track; p_{T} (GeV/c); Count",300,0,30);
777 fPtSec = new TH1F("fPtSec","Secundary Electrons aod track; p_{T} (GeV/c); Count",300,0,30);
778 fPtPrim2 = new TH1F("fPtPrim2","Primary Electrons vtrack; p_{T} (GeV/c); Count",300,0,30);
779 fPtSec2 = new TH1F("fPtSec2","Secundary Electrons vtrack; p_{T} (GeV/c); Count",300,0,30);
780
781
782 fPtElec_ULS = new TH1F("fPtElec_ULS","ULS; p_{T} (GeV/c); Count",300,0,30);
783 fPtElec_LS = new TH1F("fPtElec_LS","LS; p_{T} (GeV/c); Count",300,0,30);
784
785 fPtElec_ULS_NoPid = new TH1F("fPtElec_ULS_NoPid","ULS; p_{T} (GeV/c); Count",300,0,30);
786 fPtElec_LS_NoPid = new TH1F("fPtElec_LS_NoPid","LS; p_{T} (GeV/c); Count",300,0,30);
9a4682da 787
8e2d649d 788 fPtElec_ULS_MC = new TH1F("fPtElec_ULS_MC","ULS; p_{T} (GeV/c); Count",300,0,30);
789 fPtElec_ULS_MC_weight = new TH1F("fPtElec_ULS_MC_weight","ULS; p_{T} (GeV/c); Count",300,0,30);
9a4682da 790
8e2d649d 791 fPtElec_ULS_weight = new TH1F("fPtElec_ULS_weight","ULS; p_{T} (GeV/c); Count",300,0,30);
792 fPtElec_LS_weight = new TH1F("fPtElec_LS_weight","LS; p_{T} (GeV/c); Count",300,0,30);
2c8e1f6c 793
794 fTOF01 = new TH2F("fTOF01","",200,-20,20,200,-20,20);
795 fTOF02 = new TH2F("fTOF02","",200,-20,20,200,-20,20);
67eb14b9 796 fTOF03 = new TH2F("fTOF03","",200,-20,20,200,-20,20);
2c8e1f6c 797
9a4682da 798 if(fFillBackground){
8e2d649d 799 fPtElec_ULS2 = new TH1F("fPtElec_ULS2","ULS; p_{T} (GeV/c); Count",300,0,30);
800 fPtElec_LS2 = new TH1F("fPtElec_LS2","LS; p_{T} (GeV/c); Count",300,0,30);
2c8e1f6c 801
8e2d649d 802 fPtElec_ULS2_weight = new TH1F("fPtElec_ULS2_weight","ULS; p_{T} (GeV/c); Count",300,0,30);
803 fPtElec_LS2_weight = new TH1F("fPtElec_LS2_weight","LS; p_{T} (GeV/c); Count",300,0,30);
2c8e1f6c 804
9a4682da 805 }
806
807 fPtTrigger_Inc = new TH1F("fPtTrigger_Inc","pT dist for Hadron Contamination; p_{t} (GeV/c); Count",300,0,30);
c852fdae 808 fTPCnsigma_pt_2D = new TH2F("fTPCnsigma_pt_2D",";pt (GeV/c);TPC Electron N#sigma",1000,0.3,30,1000,-15,10);
93c64cd2 809
810 //new histos for TPC signal -> Can be used for any p range
811 fTPCnsigma_p_TPC = new TH2F("fTPCnsigma_p_TPC",";p (GeV/c);TPC Electron N#sigma",3000,0,30,1000,-15,10);
812 fTPCnsigma_p_TPC_on_EMCal_acc = new TH2F("fTPCnsigma_p_TPC_on_EMCal_acc",";p (GeV/c);TPC Electron N#sigma",3000,0,30,1000,-15,10);
813 fTPCnsigma_p_TPC_EoverP_cut = new TH2F("fTPCnsigma_p_TPC_EoverP_cut",";p (GeV/c);TPC Electron N#sigma",3000,0,30,1000,-15,10);
814
815
9a4682da 816 fShowerShapeCut = new TH2F("fShowerShapeCut","Shower Shape;M02;M20",500,0,1.8,500,0,1.8);
0131ce6c 817 fEtaPhi_num=new TH2F("fEtaPhi_num","#eta x #phi track;#phi;#eta",200,0.,5,50,-1.,1.);
818 fEtaPhi_den=new TH2F("fEtaPhi_den","#eta x #phi track;#phi;#eta",200,0.,5,50,-1.,1.);
1dd85087 819 fEtaPhi_data=new TH2F("fEtaPhi_data","#eta x #phi track;#phi;#eta",200,0.,5,50,-1.,1.);
8e2d649d 820
821 fpt_reco_pt_MC_num=new TH2F("fpt_reco_pt_MC_num","pt reco x pt MC;pt reco; pt MC",300,0.,30,300,0.,30);
822 fpt_reco_pt_MC_den=new TH2F("fpt_reco_pt_MC_den","pt reco x pt MC;pt reco; pt MC",300,0.,30,300,0.,30);
9a4682da 823
a6f21076 824
825 fCharge_n = new TH1F("fCharge_n","Inclusive Electrons (Negative Charge); p_{t} (GeV/c); Count",200,0,30);
826 fCharge_p = new TH1F("fCharge_p","Inclusive Positrons (Positive Charge); p_{t} (GeV/c); Count",200,0,30);
a89620c8 827
8e2d649d 828 fECluster_pure= new TH1F("fECluster_pure", ";ECluster pure",2000,0,100);
1dd85087 829 fECluster_not_exotic= new TH1F("fECluster_not_exotic", ";ECluster not exotic - function ",2000,0,100);
830
831 fECluster_not_exotic1= new TH1F("fECluster_not_exotic1", ";ECluster not exotic Ncells > E/3+1",2000,0,100);
832
833 fECluster_not_exotic2= new TH1F("fECluster_not_exotic2", ";ECluster not exotic 2",2000,0,100);
834 fECluster_exotic= new TH1F("fECluster_exotic", ";ECluster exotic",2000,0,100);
835
836 //not associated with tracks
837 fNCluster_pure= new TH1F("fNCluster_pure", ";Number of clusters - pure",2000,-1,1999);
838 fNCluster_pure_aod= new TH1F("fNCluster_pure_aod", ";Number of clusters - pure -aod",2000,-1,1999);
839 fNCluster_ECluster= new TH2F("fNCluster_ECluster", ";Number of clusters vs. Energy of Cluster",2000,-1,1999, 4000, -1, 1999);
840
841 fNcells_energy= new TH2F("fNcells_energy", "all clusters;Number of cells;Energy of Cluster",100,0,100, 2000, 0, 100);
842 fNcells_energy_elec_selected= new TH2F("fNcells_energy_elec_selected", "clusters for electrons on TPC;Number of cells;Energy of Cluster",100,0,100, 2000, 0, 100);
843 fNcells_energy_not_exotic= new TH2F("fNcells_energy_not_exotic", "not exotic cluster;Number of cells;Energy of Cluster ",100,0,100, 2000, 0, 100);
8e2d649d 844
a89620c8 845 if(fUseEMCal){
9a4682da 846
9a1f999b 847 if(!fIsAOD){
9a4682da 848 fTime = new TH2D("fTime","Cells Cluster Time; p_{T} (GeV/c); Time (s)",300,0,30,1000,1e-8,1e-5);
849 fTime2 = new TH2D("fTime2","Cells Cluster Time; p_{T} (GeV/c); Time (s)",300,0,30,1000,1e-8,1e-5);
9a1f999b 850 }
9a4682da 851
a89620c8 852 ftimingEle = new TH2D("ftimingEle","Cluster Time; p_{T} (GeV/c); Time (s)",300,0,30,1000,1e-8,1e-5);
853 ftimingEle2 = new TH2D("ftimingEle2","Cluster Time; p_{T} (GeV/c); Time (s)",300,0,30,1000,1e-8,1e-5);
854
9a4682da 855 fShowerShape_ha = new TH2F("fShowerShape_ha","Shower Shape hadrons;M02;M20",500,0,1.8,500,0,1.8);
856 fShowerShape_ele = new TH2F("fShowerShape_ele","Shower Shape electrons;M02;M20",500,0,1.8,500,0,1.8);
a89620c8 857
9a4682da 858 fShowerShapeM02_EoverP = new TH2F("fShowerShapeM02_EoverP","Shower Shape;M02;E/p",500,0,1.8,500,0,1.8);
859 fShowerShapeM20_EoverP = new TH2F("fShowerShapeM20_EoverP","Shower Shape;M20;E/p",500,0,1.8,500,0,1.8);
9a1f999b 860
a89620c8 861 }
c852fdae 862
2c8e1f6c 863 fOutputList->Add(fTOF01);
864 fOutputList->Add(fTOF02);
865 fOutputList->Add(fTOF03);
866
0131ce6c 867 fOutputList->Add(fEtaPhi_num);
868 fOutputList->Add(fEtaPhi_den);
1dd85087 869 fOutputList->Add(fEtaPhi_data);
0131ce6c 870
8e2d649d 871 fOutputList->Add(fpt_reco_pt_MC_num);
872 fOutputList->Add(fpt_reco_pt_MC_den);
873
874
c852fdae 875 fOutputList->Add(fPtElec_Inc);
876 fOutputList->Add(fPtElec_ULS);
877 fOutputList->Add(fPtElec_LS);
8e2d649d 878 fOutputList->Add(fPtElec_ULS_NoPid);
879 fOutputList->Add(fPtElec_LS_NoPid);
880 fOutputList->Add(fPtElec_ULS_MC);
881 fOutputList->Add(fPtElec_ULS_MC_weight);
882
883 fOutputList->Add(fPtPrim);
884 fOutputList->Add(fPtSec);
885 fOutputList->Add(fPtPrim2);
886 fOutputList->Add(fPtSec2);
887
888
889
2c8e1f6c 890 fOutputList->Add(fPtElec_ULS_weight);
891 fOutputList->Add(fPtElec_LS_weight);
9a4682da 892
893 if(fFillBackground){
894 fOutputList->Add(fPtElec_ULS2);
895 fOutputList->Add(fPtElec_LS2);
2c8e1f6c 896 fOutputList->Add(fPtElec_ULS2_weight);
897 fOutputList->Add(fPtElec_LS2_weight);
9a4682da 898 }
899
900
c852fdae 901 fOutputList->Add(fPtTrigger_Inc);
902 fOutputList->Add(fTPCnsigma_pt_2D);
93c64cd2 903
904 fOutputList->Add(fTPCnsigma_p_TPC);
905 fOutputList->Add(fTPCnsigma_p_TPC_on_EMCal_acc);
906 fOutputList->Add(fTPCnsigma_p_TPC_EoverP_cut);
907
908
909
a89620c8 910 fOutputList->Add(fShowerShapeCut);
c852fdae 911
a6f21076 912 fOutputList->Add(fCharge_n);
913 fOutputList->Add(fCharge_p);
914
8e2d649d 915 fOutputList->Add(fECluster_pure);
1dd85087 916 fOutputList->Add(fECluster_not_exotic);
917 fOutputList->Add(fECluster_not_exotic1);
918 fOutputList->Add(fECluster_not_exotic2);
919 fOutputList->Add(fECluster_exotic);
920
921 fOutputList->Add(fNCluster_pure);
922 fOutputList->Add(fNCluster_pure_aod);
923
924 fOutputList->Add(fNCluster_ECluster);
925 fOutputList->Add(fNcells_energy);
926 fOutputList->Add(fNcells_energy_elec_selected);
927 fOutputList->Add(fNcells_energy_not_exotic);
928
8e2d649d 929
a89620c8 930 if(fUseEMCal){
9a4682da 931
9a1f999b 932 if(!fIsAOD){
9a4682da 933 fOutputList->Add(fTime);
934 fOutputList->Add(fTime2);
935
9a1f999b 936 }
9a4682da 937
a89620c8 938 fOutputList->Add(ftimingEle);
939 fOutputList->Add(ftimingEle2);
9a4682da 940
941 fOutputList->Add(fShowerShape_ha);
942 fOutputList->Add(fShowerShape_ele);
943
944 fOutputList->Add(fShowerShapeM02_EoverP);
945 fOutputList->Add(fShowerShapeM20_EoverP);
9a4682da 946
9a1f999b 947
948
a89620c8 949 }
950
1dd85087 951 fVtxZ_new1= new TH1F("fVtxZ_new1","fVtxZ_new1",4000, -50,50);
952 fVtxZ_new2= new TH1F("fVtxZ_new2","fVtxZ_new2",4000, -50,50);
953 fVtxZ_new3= new TH1F("fVtxZ_new3","fVtxZ_new3",4000, -50,50);
954 fVtxZ_new4= new TH1F("fVtxZ_new4","fVtxZ_new4",4000, -50,50);
955
956 fzRes1= new TH1F("fzRes1","fzRes1",4000, 0,1);
957 fzRes2= new TH1F("fzRes2","fzRes2",4000, 0,1);
958 fSPD_track_vtx1= new TH1F("fSPD_track_vtx1","fSPD_track_vtx1",4000, -5,5);
959 fSPD_track_vtx2= new TH1F("fSPD_track_vtx2","fSPD_track_vtx2",4000, -5,5);
8e2d649d 960
1dd85087 961
9a1f999b 962 //General Histograms
c852fdae 963
9a1f999b 964 //Steps
965 //Step 1: Before Track cuts
966 //Step 2: Before PID
967 //Step 3: After PID
c852fdae 968
969 fEoverP_pt = new TH2F *[3];
970 fTPC_p = new TH2F *[3];
971 fTPCnsigma_p = new TH2F *[3];
972
973 fECluster= new TH1F *[3];
974 fEtaPhi= new TH2F *[3];
975 fVtxZ= new TH1F *[3];
0131ce6c 976 fEtad= new TH1F *[3];
c852fdae 977 fNTracks= new TH1F *[3];
8e2d649d 978
979 fNTracks_pt= new TH2F *[3];
980 fNTracks_eta= new TH2F *[3];
981 fNTracks_phi= new TH2F *[3];
982
c852fdae 983 fNClusters= new TH1F *[3];
984 fTPCNcls_EoverP= new TH2F *[3];
aaec953d 985 fTPCNcls_pid=new TH2F *[4];
c852fdae 986
8e2d649d 987
988
c852fdae 989 for(Int_t i = 0; i < 3; i++)
990 {
a4e971f7 991 fEoverP_pt[i] = new TH2F(Form("fEoverP_pt%d",i),";p_{t} (GeV/c);E / p ",1000,0,30,2000,0,2);
9a1f999b 992 fTPC_p[i] = new TH2F(Form("fTPC_p%d",i),";pt (GeV/c);TPC dE/dx (a. u.)",1000,0.3,15,1000,-20,200);
993 fTPCnsigma_p[i] = new TH2F(Form("fTPCnsigma_p%d",i),";p (GeV/c);TPC Electron N#sigma",1000,0.3,15,1000,-15,10);
994
995
996 fECluster[i]= new TH1F(Form("fECluster%d",i), ";ECluster",2000, 0,100);
997 fEtaPhi[i]= new TH2F(Form("fEtaPhi%d",i),"#eta x #phi Clusters;#phi;#eta",200,0.,5,50,-1.,1.);
998 fVtxZ[i]= new TH1F(Form("fVtxZ%d",i),"VtxZ",1000, -50,50);
0131ce6c 999 fEtad[i]= new TH1F(Form("fEtad%d",i),"Eta distribution",200, -1.2,1.2);
1000 fNTracks[i]= new TH1F(Form("fNTracks%d",i),"NTracks",1000, 0,5000);
8e2d649d 1001
1002 fNTracks_pt[i]= new TH2F(Form("fNTracks_pt%d",i),"NTracks vs. pt",1000, 0,5000, 1000, 0, 100);
1003 fNTracks_eta[i]= new TH2F(Form("fNTracks_eta%d",i),"NTracks vs. pt",1000, 0,5000, 500, -1.0, 1.0);
1004 fNTracks_phi[i]= new TH2F(Form("fNTracks_phi%d",i),"NTracks vs. pt",1000, 0,5000, 500, 0, 5.0);
1005
1006
1007
9a1f999b 1008 fNClusters[i]= new TH1F(Form("fNClusters%d",i),"fNClusters0",200, 0,100);
1009 fTPCNcls_EoverP[i]= new TH2F(Form("fTPCNcls_EoverP%d",i),"TPCNcls_EoverP",1000,0,200,200,0,2);
aaec953d 1010
9a1f999b 1011
1012
1013 fOutputList->Add(fEoverP_pt[i]);
1014 fOutputList->Add(fTPC_p[i]);
1015 fOutputList->Add(fTPCnsigma_p[i]);
1016
1017
1018 fOutputList->Add(fECluster[i]);
1019 fOutputList->Add(fEtaPhi[i]);
1020 fOutputList->Add(fVtxZ[i]);
0131ce6c 1021 fOutputList->Add(fEtad[i]);
9a1f999b 1022 fOutputList->Add(fNTracks[i]);
8e2d649d 1023
1024 fOutputList->Add(fNTracks_pt[i]);
1025 fOutputList->Add(fNTracks_eta[i]);
1026 fOutputList->Add(fNTracks_phi[i]);
1027
9a1f999b 1028 fOutputList->Add(fNClusters[i]);
1029 fOutputList->Add(fTPCNcls_EoverP[i]);
c852fdae 1030 }
1031
1dd85087 1032 fTrack_Multi= new TH1F("fTrack_Multi","fTrack_Multi",1000, 0,1000);
1033
aaec953d 1034 for(Int_t i = 0; i < 4; i++)
1035 {
1036 fTPCNcls_pid[i]= new TH2F(Form("fTPCNcls_pid%d",i),"fTPCNcls_pid;NCls;NCls for PID",200,0,200,200,0,200);
1037 fOutputList->Add(fTPCNcls_pid[i]);
1038 }
1039
9a1f999b 1040 //pt bin
2c8e1f6c 1041 Int_t fPtBin[7] = {1,2,4,6,8,10,15};
1042
628d0da7 1043
1044 Int_t fPtBin_trigger[11] = {1,2,4,6,8,10,12,14,16,18,20};
1045 fEoverP_tpc_p_trigger = new TH2F *[10];
1046 fEoverP_tpc_pt_trigger = new TH2F *[10];
1047
1048
2c8e1f6c 1049 fEoverP_tpc = new TH2F *[6];
1050 fTPC_pt = new TH1F *[6];
1051 fTPCnsigma_pt = new TH1F *[6];
1052
1053 fEta=new TH1F *[6];
1054 fPhi=new TH1F *[6];
1055 fR=new TH1F *[6];
1056 fR_EoverP=new TH2F *[6];
1057 fNcells=new TH1F *[6];
1058 fNcells_EoverP=new TH2F *[6];
1059 fM02_EoverP= new TH2F *[6];
1060 fM20_EoverP= new TH2F *[6];
1061 fEoverP_ptbins=new TH1F *[6];
1062 fECluster_ptbins=new TH1F *[6];
1063 fEoverP_wSSCut=new TH1F *[6];
1064 fNcells_electrons=new TH1F *[6];
1065 fNcells_hadrons=new TH1F *[6];
1066 fTPCnsigma_eta_electrons=new TH2F *[6];
1067 fTPCnsigma_eta_hadrons=new TH2F *[6];
c852fdae 1068
1069 if(fCorrelationFlag)
1070 {
2c8e1f6c 1071 fCEtaPhi_Inc = new TH2F *[6];
1072 fCEtaPhi_Inc_DiHadron = new TH2F *[6];
c852fdae 1073
2c8e1f6c 1074 fCEtaPhi_ULS = new TH2F *[6];
1075 fCEtaPhi_LS = new TH2F *[6];
1076 fCEtaPhi_ULS_NoP = new TH2F *[6];
1077 fCEtaPhi_LS_NoP = new TH2F *[6];
c852fdae 1078
2c8e1f6c 1079 fCEtaPhi_ULS_Weight = new TH2F *[6];
1080 fCEtaPhi_LS_Weight = new TH2F *[6];
1081 fCEtaPhi_ULS_NoP_Weight = new TH2F *[6];
1082 fCEtaPhi_LS_NoP_Weight = new TH2F *[6];
c852fdae 1083
2c8e1f6c 1084 fCEtaPhi_Inc_EM = new TH2F *[6];
c852fdae 1085
2c8e1f6c 1086 fCEtaPhi_ULS_EM = new TH2F *[6];
1087 fCEtaPhi_LS_EM = new TH2F *[6];
c852fdae 1088
2c8e1f6c 1089 fCEtaPhi_ULS_Weight_EM = new TH2F *[6];
1090 fCEtaPhi_LS_Weight_EM = new TH2F *[6];
c852fdae 1091
1092 fInvMass = new TH1F("fInvMass","",200,0,0.3);
1093 fInvMassBack = new TH1F("fInvMassBack","",200,0,0.3);
1094 fDCA = new TH1F("fDCA","",200,0,1);
1095 fDCABack = new TH1F("fDCABack","",200,0,1);
1096 fOpAngle = new TH1F("fOpAngle","",200,0,0.5);
1097 fOpAngleBack = new TH1F("fOpAngleBack","",200,0,0.5);
1098
1099 fOutputList->Add(fInvMass);
1100 fOutputList->Add(fInvMassBack);
1101 fOutputList->Add(fDCA);
1102 fOutputList->Add(fDCABack);
1103 fOutputList->Add(fOpAngle);
1104 fOutputList->Add(fOpAngleBack);
1105 }
1106
9a4682da 1107 if(fFillBackground){
1108
1109 fInvMass = new TH1F("fInvMass","",200,0,0.3);
1110 fInvMassBack = new TH1F("fInvMassBack","",200,0,0.3);
1111 fDCA = new TH1F("fDCA","",200,0,1);
1112 fDCABack = new TH1F("fDCABack","",200,0,1);
1113 fOpAngle = new TH1F("fOpAngle","",200,0,0.5);
1114 fOpAngleBack = new TH1F("fOpAngleBack","",200,0,0.5);
9a1f999b 1115
9a4682da 1116 fOutputList->Add(fInvMass);
1117 fOutputList->Add(fInvMassBack);
1118 fOutputList->Add(fDCA);
1119 fOutputList->Add(fDCABack);
1120 fOutputList->Add(fOpAngle);
1121 fOutputList->Add(fOpAngleBack);
1122
9a1f999b 1123 //histos for TPC-only
9a4682da 1124 fInvMass2 = new TH1F("fInvMass2","",200,0,0.3);
1125 fInvMassBack2 = new TH1F("fInvMassBack2","",200,0,0.3);
1126 fDCA2 = new TH1F("fDCA2","",200,0,1);
1127 fDCABack2 = new TH1F("fDCABack2","",200,0,1);
1128 fOpAngle2 = new TH1F("fOpAngle2","",200,0,0.5);
1129 fOpAngleBack2 = new TH1F("fOpAngleBack2","",200,0,0.5);
1130
1131 fOutputList->Add(fInvMass2);
1132 fOutputList->Add(fInvMassBack2);
1133 fOutputList->Add(fDCA2);
1134 fOutputList->Add(fDCABack2);
1135 fOutputList->Add(fOpAngle2);
1136 fOutputList->Add(fOpAngleBack2);
1137
1138 }
1139
628d0da7 1140 //new histo for trigger data
1141
1142 for(Int_t i = 0; i < 10; i++)
1143 {
1144 fEoverP_tpc_pt_trigger[i] = new TH2F(Form("fEoverP_tpc_pt_trigger%d",i),Form("%d < p_{t} < %d GeV/c;TPC Electron N#sigma; E/p ",fPtBin_trigger[i],fPtBin_trigger[i+1]),1000,-15,15,100,0,2);
1145 fEoverP_tpc_p_trigger[i] = new TH2F(Form("fEoverP_tpc_p_trigger%d",i),Form("%d < p < %d GeV/c;TPC Electron N#sigma; E/p ",fPtBin_trigger[i],fPtBin_trigger[i+1]),1000,-15,15,100,0,2);
1146 fOutputList->Add(fEoverP_tpc_pt_trigger[i]);
1147 fOutputList->Add(fEoverP_tpc_p_trigger[i]);
1148
1149 }
1150
1151
2c8e1f6c 1152 for(Int_t i = 0; i < 6; i++)
c852fdae 1153 {
9a1f999b 1154 fEoverP_tpc[i] = new TH2F(Form("fEoverP_tpc%d",i),Form("%d < p_{t} < %d GeV/c;TPC Electron N#sigma;E / p ",fPtBin[i],fPtBin[i+1]),1000,-15,15,100,0,2);
1155 fTPC_pt[i] = new TH1F(Form("fTPC_pt%d",i),Form("%d < p_{t} < %d GeV/c;TPC Electron N#sigma;Count",fPtBin[i],fPtBin[i+1]),200,20,200);
1156 fTPCnsigma_pt[i] = new TH1F(Form("fTPCnsigma_pt%d",i),Form("%d < p_{t} < %d GeV/c;TPC Electron N#sigma;Count",fPtBin[i],fPtBin[i+1]),200,-15,10);
1157
1158 fEta[i]=new TH1F(Form("fEta%d",i), Form("%d < p_{t} < %d GeV/c;#eta; counts",fPtBin[i],fPtBin[i+1]),100, -0.1,0.1);
1159 fPhi[i]=new TH1F(Form("fPhi%d",i),Form("%d < p_{t} < %d GeV/c;#phi; counts )",fPtBin[i],fPtBin[i+1]), 100, -0.1,0.1);
1160 fR[i]=new TH1F(Form("fR%d",i),Form("%d < p_{t} < %d GeV/c;R;counts )",fPtBin[i],fPtBin[i+1]), 100, -0.1,0.1);
1161 fR_EoverP[i]=new TH2F(Form("fR_EoverP%d",i),Form("%d < p_{t} < %d GeV/c;R;E / p ",fPtBin[i],fPtBin[i+1]),100, 0,0.1,1000,0,10);
1162 fNcells[i]=new TH1F(Form("fNcells%d",i), Form("%d < p_{t} < %d GeV/c;ncells;counts ",fPtBin[i],fPtBin[i+1]),100, 0, 30);
1163 fNcells_electrons[i]=new TH1F(Form("fNcells_electrons%d",i), Form("%d < p_{t} < %d GeV/c;ncells;counts ",fPtBin[i],fPtBin[i+1]),100, 0, 30);
1164 fNcells_hadrons[i]=new TH1F(Form("fNcells_hadrons%d",i), Form("%d < p_{t} < %d GeV/c;ncells;counts ",fPtBin[i],fPtBin[i+1]),100, 0, 30);
1165 fNcells_EoverP[i]=new TH2F(Form("fNcells_EoverP%d",i),Form("%d < p_{t} < %d GeV/c; Ncells; E / p ",fPtBin[i],fPtBin[i+1]),1000, 0,20,100,0,30);
1166 fM02_EoverP[i]= new TH2F(Form("fM02_EoverP%d",i),Form("%d < p_{t} < %d GeV/c; M02; E / p ",fPtBin[i],fPtBin[i+1]),1000,0,100,100,0,2);
1167 fM20_EoverP[i]= new TH2F(Form("fM20_EoverP%d",i),Form("%d < p_{t} < %d GeV/c; M20; E / p ",fPtBin[i],fPtBin[i+1]),1000,0,100,100,0,2);
1168 fEoverP_ptbins[i] = new TH1F(Form("fEoverP_ptbins%d",i),Form("%d < p_{t} < %d GeV/c;E / p ",fPtBin[i],fPtBin[i+1]),500,0,2);
1169 fECluster_ptbins[i]= new TH1F(Form("fECluster_ptbins%d",i), Form("%d < p_{t} < %d GeV/c;ECluster; Counts ",fPtBin[i],fPtBin[i+1]),2000, 0,100);
1170 fEoverP_wSSCut[i]=new TH1F(Form("fEoverP_wSSCut%d",i),Form("%d < p_{t} < %d GeV/c;E / p ; Counts",fPtBin[i],fPtBin[i+1]),500,0,2);
1171 fTPCnsigma_eta_electrons[i]=new TH2F(Form("fTPCnsigma_eta_electrons%d",i),Form("%d < p_{t} < %d GeV/c;TPC Electron N#sigma;Eta ",fPtBin[i],fPtBin[i+1]),1000,-15,15,100,-1,1);
1172 fTPCnsigma_eta_hadrons[i]=new TH2F(Form("fTPCnsigma_eta_hadrons%d",i),Form("%d < p_{t} < %d GeV/c;TPC Electron N#sigma;Eta ",fPtBin[i],fPtBin[i+1]),1000,-15,15,100,-1,1);
1173
1174 fOutputList->Add(fEoverP_tpc[i]);
1175 fOutputList->Add(fTPC_pt[i]);
1176 fOutputList->Add(fTPCnsigma_pt[i]);
1177
1178 fOutputList->Add(fEta[i]);
1179 fOutputList->Add(fPhi[i]);
1180 fOutputList->Add(fR[i]);
1181 fOutputList->Add(fR_EoverP[i]);
1182 fOutputList->Add(fNcells[i]);
1183 fOutputList->Add(fNcells_electrons[i]);
1184 fOutputList->Add(fNcells_hadrons[i]);
1185 fOutputList->Add(fNcells_EoverP[i]);
1186 fOutputList->Add(fECluster_ptbins[i]);
1187 fOutputList->Add(fEoverP_ptbins[i]);
1188 fOutputList->Add(fEoverP_wSSCut[i]);
1189 fOutputList->Add(fM02_EoverP[i]);
1190 fOutputList->Add(fM20_EoverP[i]);
1191 fOutputList->Add(fTPCnsigma_eta_electrons[i]);
1192 fOutputList->Add(fTPCnsigma_eta_hadrons[i]);
1193
1194
c852fdae 1195 if(fCorrelationFlag)
1196 {
1197 fCEtaPhi_Inc[i] = new TH2F(Form("fCEtaPhi_Inc%d",i),Form("%d < p_{t} < %d GeV/c;#DeltaPhi (rad);#Delta#eta",fPtBin[i],fPtBin[i+1]),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-2,2);
1198 fCEtaPhi_Inc_DiHadron[i] = new TH2F(Form("fCEtaPhi_Inc_DiHadron%d",i),Form("%d < p_{t} < %d GeV/c;#DeltaPhi (rad);#Delta#eta",fPtBin[i],fPtBin[i+1]),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-2,2);
1199
1200 fCEtaPhi_ULS[i] = new TH2F(Form("fCEtaPhi_ULS%d",i),Form("%d < p_{t} < %d GeV/c;#DeltaPhi (rad);#Delta#eta",fPtBin[i],fPtBin[i+1]),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-2,2);
1201 fCEtaPhi_LS[i] = new TH2F(Form("fCEtaPhi_LS%d",i),Form("%d < p_{t} < %d GeV/c;#DeltaPhi (rad);#Delta#eta",fPtBin[i],fPtBin[i+1]),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-2,2);
1202 fCEtaPhi_ULS_NoP[i] = new TH2F(Form("fCEtaPhi_ULS_NoP%d",i),Form("%d < p_{t} < %d GeV/c;#DeltaPhi (rad);#Delta#eta",fPtBin[i],fPtBin[i+1]),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-2,2);
1203 fCEtaPhi_LS_NoP[i] = new TH2F(Form("fCEtaPhi_LS_NoP%d",i),Form("%d < p_{t} < %d GeV/c;#DeltaPhi (rad);#Delta#eta",fPtBin[i],fPtBin[i+1]),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-2,2);
1204
1205 fCEtaPhi_ULS_Weight[i] = new TH2F(Form("fCEtaPhi_ULS_Weight%d",i),Form("%d < p_{t} < %d GeV/c;#DeltaPhi (rad);#Delta#eta",fPtBin[i],fPtBin[i+1]),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-2,2);
1206 fCEtaPhi_LS_Weight[i] = new TH2F(Form("fCEtaPhi_LS_Weight%d",i),Form("%d < p_{t} < %d GeV/c;#DeltaPhi (rad);#Delta#eta",fPtBin[i],fPtBin[i+1]),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-2,2);
1207 fCEtaPhi_ULS_NoP_Weight[i] = new TH2F(Form("fCEtaPhi_ULS_NoP_Weight%d",i),Form("%d < p_{t} < %d GeV/c;#DeltaPhi (rad);#Delta#eta",fPtBin[i],fPtBin[i+1]),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-2,2);
1208 fCEtaPhi_LS_NoP_Weight[i] = new TH2F(Form("fCEtaPhi_LS_NoP_Weight%d",i),Form("%d < p_{t} < %d GeV/c;#DeltaPhi (rad);#Delta#eta",fPtBin[i],fPtBin[i+1]),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-2,2);
1209
1210 fOutputList->Add(fCEtaPhi_Inc[i]);
1211 fOutputList->Add(fCEtaPhi_Inc_DiHadron[i]);
1212
1213 fOutputList->Add(fCEtaPhi_ULS[i]);
1214 fOutputList->Add(fCEtaPhi_LS[i]);
1215 fOutputList->Add(fCEtaPhi_ULS_NoP[i]);
1216 fOutputList->Add(fCEtaPhi_LS_NoP[i]);
1217
1218 fOutputList->Add(fCEtaPhi_ULS_Weight[i]);
1219 fOutputList->Add(fCEtaPhi_LS_Weight[i]);
1220 fOutputList->Add(fCEtaPhi_ULS_NoP_Weight[i]);
1221 fOutputList->Add(fCEtaPhi_LS_NoP_Weight[i]);
1222
1223 if(fEventMixingFlag)
1224 {
1225 fCEtaPhi_Inc_EM[i] = new TH2F(Form("fCEtaPhi_Inc_EM%d",i),Form("%d < p_{t} < %d GeV/c;#DeltaPhi (rad);#Delta#eta",fPtBin[i],fPtBin[i+1]),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-2,2);
1226
1227 fCEtaPhi_ULS_EM[i] = new TH2F(Form("fCEtaPhi_ULS_EM%d",i),Form("%d < p_{t} < %d GeV/c;#DeltaPhi (rad);#Delta#eta",fPtBin[i],fPtBin[i+1]),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-2,2);
1228 fCEtaPhi_LS_EM[i] = new TH2F(Form("fCEtaPhi_LS_EM%d",i),Form("%d < p_{t} < %d GeV/c;#DeltaPhi (rad);#Delta#eta",fPtBin[i],fPtBin[i+1]),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-2,2);
1229
1230 fCEtaPhi_ULS_Weight_EM[i] = new TH2F(Form("fCEtaPhi_ULS_Weight_EM%d",i),Form("%d < p_{t} < %d GeV/c;#DeltaPhi (rad);#Delta#eta",fPtBin[i],fPtBin[i+1]),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-2,2);
1231 fCEtaPhi_LS_Weight_EM[i] = new TH2F(Form("fCEtaPhi_LS_Weight_EM%d",i),Form("%d < p_{t} < %d GeV/c;#DeltaPhi (rad);#Delta#eta",fPtBin[i],fPtBin[i+1]),200,-0.5*TMath::Pi(),1.5*TMath::Pi(),200,-2,2);
1232
1233 fOutputList->Add(fCEtaPhi_Inc_EM[i]);
1234
1235 fOutputList->Add(fCEtaPhi_ULS_EM[i]);
1236 fOutputList->Add(fCEtaPhi_LS_EM[i]);
1237
1238 fOutputList->Add(fCEtaPhi_ULS_Weight_EM[i]);
1239 fOutputList->Add(fCEtaPhi_LS_Weight_EM[i]);
1240 }
1241 }
1242 }
1243
9a1f999b 1244 //pt integrated
c852fdae 1245 fTPCnsigma_eta = new TH2F("fTPCnsigma_eta",";Pseudorapidity #eta; TPC signal - <TPC signal>_{elec} (#sigma)",200,-0.9,0.9,200,-15,15);
1246 fTPCnsigma_phi = new TH2F("fTPCnsigma_phi",";Azimuthal Angle #phi; TPC signal - <TPC signal>_{elec} (#sigma)",200,0,2*TMath::Pi(),200,-15,15);
1247
aaec953d 1248
c852fdae 1249
1250 fNcells_pt=new TH2F("fNcells_pt","fNcells_pt",1000, 0,20,100,0,30);
a4e971f7 1251 fEoverP_pt_pions= new TH2F("fEoverP_pt_pions","fEoverP_pt_pions",1000,0,30,2000,0,2);
c852fdae 1252
1253 ftpc_p_EoverPcut= new TH2F("ftpc_p_EoverPcut","ftpc_p_EoverPcut",1000,0,30,200,20,200);
1254 fnsigma_p_EoverPcut= new TH2F("fnsigma_p_EoverPcut","fnsigma_p_EoverPcut",1000,0,30,500,-15,15);
1255
a4e971f7 1256 fEoverP_pt_pions2= new TH2F("fEoverP_pt_pions2","fEoverP_pt_pions2",1000,0,30,2000,0,2);
1257 fEoverP_pt_hadrons= new TH2F("fEoverP_pt_hadrons","fEoverP_pt_hadrons",1000,0,30,2000,0,2);
c852fdae 1258
1259
1260 fOutputList->Add(fTPCnsigma_eta);
1261 fOutputList->Add(fTPCnsigma_phi);
1262
1263 fOutputList->Add(fNcells_pt);
1264 fOutputList->Add(fEoverP_pt_pions);
1265
1266 fOutputList->Add(ftpc_p_EoverPcut);
1267 fOutputList->Add(fnsigma_p_EoverPcut);
1268
1269 fOutputList->Add(fEoverP_pt_pions2);
1270 fOutputList->Add(fEoverP_pt_hadrons);
1271
8e2d649d 1272 fOutputList->Add(fVtxZ_new1);
1273 fOutputList->Add(fVtxZ_new2);
1274 fOutputList->Add(fVtxZ_new3);
1275 fOutputList->Add(fVtxZ_new4);
1276
1dd85087 1277 fOutputList->Add(fzRes1);
1278 fOutputList->Add(fzRes2);
1279 fOutputList->Add(fSPD_track_vtx1);
1280 fOutputList->Add(fSPD_track_vtx2);
aaec953d 1281
31185d97 1282
1283
9a1f999b 1284 //__________________________________________________________________
1285 //Efficiency studies
c852fdae 1286 if(fIsMC)
1287 {
9a4682da 1288 fPtBackgroundBeforeReco = new TH1F("fPtBackgroundBeforeReco",";p_{T} (GeV/c);Count",300,0,30);
2c8e1f6c 1289 fPtBackgroundBeforeReco_weight = new TH1F("fPtBackgroundBeforeReco_weight",";p_{T} (GeV/c);Count",300,0,30);
9a4682da 1290 if(fFillBackground)fPtBackgroundBeforeReco2 = new TH1F("fPtBackgroundBeforeReco2",";p_{T} (GeV/c);Count",300,0,30);
2c8e1f6c 1291 if(fFillBackground)fPtBackgroundBeforeReco2_weight = new TH1F("fPtBackgroundBeforeReco2_weight",";p_{T} (GeV/c);Count",300,0,30);
2235208e 1292 fpT_m_electron= new TH2F("fpT_m_electron","fpT_m_electron",300,0,30,300,0,30);
1293 fpT_gm_electron= new TH2F("fpT_gm_electron","fpT_gm_electron",300,0,30,300,0,30);
2c8e1f6c 1294
9a4682da 1295 fPtBackgroundAfterReco = new TH1F("fPtBackgroundAfterReco",";p_{T} (GeV/c);Count",300,0,30);
9a1f999b 1296 fPtMCparticleAll = new TH1F("fPtMCparticleAll",";p_{T} (GeV/c);Count",200,0,40);
1297 fPtMCparticleReco = new TH1F("fPtMCparticleReco",";p_{T} (GeV/c);Count",200,0,40);
1298
1299 fPtMCparticleAll_nonPrimary = new TH1F("fPtMCparticleAll_nonPrimary",";p_{T} (GeV/c);Count",200,0,40);
2c8e1f6c 1300 fPtMCparticleAlle_nonPrimary = new TH1F("fPtMCparticleAlle_nonPrimary",";p_{T} (GeV/c);Count",200,0,40);
1301 fPtMCparticleAlle_Primary = new TH1F("fPtMCparticleAlle_Primary",";p_{T} (GeV/c);Count",200,0,40);
1302
9a1f999b 1303 fPtMCparticleReco_nonPrimary = new TH1F("fPtMCparticleReco_nonPrimary",";p_{T} (GeV/c);Count",200,0,40);
1304
c852fdae 1305 fPtMCparticleAllHfe1 = new TH1F("fPtMCparticleAllHfe1",";p_{t} (GeV/c);Count",200,0,40);
1306 fPtMCparticleRecoHfe1 = new TH1F("fPtMCparticleRecoHfe1",";p_{t} (GeV/c);Count",200,0,40);
1307 fPtMCparticleAllHfe2 = new TH1F("fPtMCparticleAllHfe2",";p_{t} (GeV/c);Count",200,0,40);
1308 fPtMCparticleRecoHfe2 = new TH1F("fPtMCparticleRecoHfe2",";p_{t} (GeV/c);Count",200,0,40);
9a1f999b 1309
1310 fPtMCelectronAfterAll = new TH1F("fPtMCelectronAfterAll",";p_{T} (GeV/c);Count",200,0,40);
8e2d649d 1311 fPtMCelectronAfterAll_unfolding = new TH1F("fPtMCelectronAfterAll_unfolding",";p_{T} (GeV/c);Count",200,0,40);
9a1f999b 1312 fPtMCelectronAfterAll_nonPrimary = new TH1F("fPtMCelectronAfterAll_nonPrimary",";p_{T} (GeV/c);Count",200,0,40);
2c8e1f6c 1313 fPtMCelectronAfterAll_Primary = new TH1F("fPtMCelectronAfterAll_Primary",";p_{T} (GeV/c);Count",200,0,40);
1314
9a1f999b 1315
1316
1317 fPtMCpi0 = new TH1F("fPtMCpi0",";p_{t} (GeV/c);Count",200,0,30);
1318 fPtMCeta = new TH1F("fPtMCeta",";p_{T} (GeV/c);Count",200,0,30);
8e2d649d 1319 fPtMCpi02 = new TH1F("fPtMCpi02",";p_{t} (GeV/c);Count",200,0,30);
1320 fPtMCeta2 = new TH1F("fPtMCeta2",";p_{T} (GeV/c);Count",200,0,30);
1dd85087 1321 fPtMCpi03 = new TH1F("fPtMCpi03",";p_{t} (GeV/c);Count",200,0,30);
1322 fPtMCeta3 = new TH1F("fPtMCeta3",";p_{T} (GeV/c);Count",200,0,30);
1323
c852fdae 1324 fPtMC_EMCal_All= new TH1F("fPtMC_EMCal_All",";p_{t} (GeV/c);Count",200,0,40);
1325 fPtMC_EMCal_Selected= new TH1F("fPtMC_EMCal_Selected",";p_{t} (GeV/c);Count",200,0,40);
8e2d649d 1326 fPtMC_TPC_All= new TH1F("fPtMC_TPC_All",";p_{T} (GeV/c);Count",200,0,40);
1327 fPtMC_TPC_Selected = new TH1F("fPtMC_TPC_Selected",";p_{T} (GeV/c);Count",200,0,40);
1328
1329 fPt_track_match_den = new TH1F("fPt_track_match_den",";p_{T} (GeV/c);Count",200,0,40);
1330 fPt_track_match_num = new TH1F("fPt_track_match_num",";p_{T} (GeV/c);Count",200,0,40);
1331
c852fdae 1332 fPtMCWithLabel = new TH1F("fPtMCWithLabel",";p_{t} (GeV/c);Count",200,0,40);
1333 fPtMCWithoutLabel = new TH1F("fPtMCWithoutLabel",";p_{t} (GeV/c);Count",200,0,40);
1334 fPtIsPhysicaPrimary = new TH1F("fPtIsPhysicaPrimary",";p_{t} (GeV/c);Count",200,0,40);
1335
1336 fOutputList->Add(fPtBackgroundBeforeReco);
2c8e1f6c 1337 fOutputList->Add(fPtBackgroundBeforeReco_weight);
1338
9a4682da 1339 if(fFillBackground) fOutputList->Add(fPtBackgroundBeforeReco2);
2c8e1f6c 1340 if(fFillBackground) fOutputList->Add(fPtBackgroundBeforeReco2_weight);
2235208e 1341
1342 fOutputList->Add(fpT_m_electron);
1343 fOutputList->Add(fpT_gm_electron);
1344
c852fdae 1345 fOutputList->Add(fPtBackgroundAfterReco);
1346 fOutputList->Add(fPtMCparticleAll);
1347 fOutputList->Add(fPtMCparticleReco);
9a1f999b 1348
1349 fOutputList->Add(fPtMCparticleAll_nonPrimary);
1350 fOutputList->Add(fPtMCparticleAlle_nonPrimary);
2c8e1f6c 1351
1352 fOutputList->Add(fPtMCparticleAlle_Primary);
9a1f999b 1353 fOutputList->Add(fPtMCparticleReco_nonPrimary);
1354
c852fdae 1355 fOutputList->Add(fPtMCparticleAllHfe1);
1356 fOutputList->Add(fPtMCparticleRecoHfe1);
1357 fOutputList->Add(fPtMCparticleAllHfe2);
1358 fOutputList->Add(fPtMCparticleRecoHfe2);
1359 fOutputList->Add(fPtMCelectronAfterAll);
8e2d649d 1360 fOutputList->Add(fPtMCelectronAfterAll_unfolding);
9a1f999b 1361
1362 fOutputList->Add(fPtMCelectronAfterAll_nonPrimary);
2c8e1f6c 1363 fOutputList->Add(fPtMCelectronAfterAll_Primary);
1364
9a1f999b 1365
1366
c852fdae 1367 fOutputList->Add(fPtMCpi0);
9a1f999b 1368 fOutputList->Add(fPtMCeta);
8e2d649d 1369 fOutputList->Add(fPtMCpi02);
1370 fOutputList->Add(fPtMCeta2);
1dd85087 1371 fOutputList->Add(fPtMCpi03);
1372 fOutputList->Add(fPtMCeta3);
c852fdae 1373 fOutputList->Add(fPtMC_EMCal_All);
1374 fOutputList->Add(fPtMC_EMCal_Selected);
1375 fOutputList->Add(fPtMC_TPC_All);
1376 fOutputList->Add(fPtMC_TPC_Selected);
8e2d649d 1377
1378 fOutputList->Add(fPt_track_match_den);
1379 fOutputList->Add(fPt_track_match_num);
1380
c852fdae 1381 fOutputList->Add(fPtMCWithLabel);
1382 fOutputList->Add(fPtMCWithoutLabel);
1383 fOutputList->Add(fPtIsPhysicaPrimary);
1384 }
1385
1386 fCentralityHist = new TH1F("fCentralityHist",";Centrality (%); Count",1000000,0,100);
1387 fCentralityHistPass = new TH1F("fCentralityHistPass",";Centrality (%); Count",1000000,0,100);
1388 fOutputList->Add(fCentralityHist);
1389 fOutputList->Add(fCentralityHistPass);
1390
1dd85087 1391 //______________________________________________________________________
1392 //Mixed event analysis
c852fdae 1393 if(fEventMixingFlag)
1394 {
1395 fPoolNevents = new TH1F("fPoolNevents","Event Mixing Statistics; Number of events; Count",1000,0,1000);
1396 fOutputList->Add(fPoolNevents);
1397
1398 Int_t trackDepth = 2000; // number of objects (tracks) kept per event buffer bin. Once the number of stored objects (tracks) is above that limit, the oldest ones are removed.
1399 Int_t poolsize = 1000; // Maximum number of events, ignored in the present implemented of AliEventPoolManager
1400
1401 Int_t nCentralityBins = 15;
1402 Double_t centralityBins[] = { 0, 1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100.1 };
1403
1404 Int_t nZvtxBins = 9;
1405 Double_t vertexBins[] = {-10, -7, -5, -3, -1, 1, 3, 5, 7, 10};
1406
1407 fPoolMgr = new AliEventPoolManager(poolsize, trackDepth, nCentralityBins, (Double_t*) centralityBins, nZvtxBins, (Double_t*) vertexBins);
1408 }
9a1f999b 1409 //______________________________________________________________________
c852fdae 1410
1411 PostData(1, fOutputList);
1412
9a1f999b 1413 ///______________________________________________________________________
c852fdae 1414}
1415
8e2d649d 1416//______________________________________________________________________
1417//Main loop
1418//Called for each event
c852fdae 1419void AliAnalysisTaskEMCalHFEpA::UserExec(Option_t *)
1420{
9a1f999b 1421 //Check Event
c852fdae 1422 fESD = dynamic_cast<AliESDEvent*>(InputEvent());
1423 fAOD = dynamic_cast<AliAODEvent*>(InputEvent());
1424
1425 if(!(fESD || fAOD))
1426 {
1427 printf("ERROR: fESD & fAOD not available\n");
1428 return;
1429 }
1430
1431 fVevent = dynamic_cast<AliVEvent*>(InputEvent());
1432
1433 if(!fVevent)
1434 {
1435 printf("ERROR: fVEvent not available\n");
1436 return;
1437 }
9a1f999b 1438
1439 //Check Cuts
c852fdae 1440 if(!fCuts)
1441 {
1442 AliError("HFE cuts not available");
1443 return;
1444 }
9a1f999b 1445 //Check PID
c852fdae 1446 if(!fPID->IsInitialized())
1447 {
9a1f999b 1448 // Initialize PID with the given run number
c852fdae 1449 AliWarning("PID not initialised, get from Run no");
1450
1451 if(fIsAOD)
1452 {
1453 fPID->InitializePID(fAOD->GetRunNumber());
1454 }
1455 else
1456 {
1457 fPID->InitializePID(fESD->GetRunNumber());
1458 }
1459 }
1460
9a1f999b 1461 //PID response
c852fdae 1462 fPidResponse = fInputHandler->GetPIDResponse();
1463
9a1f999b 1464
1465 //Check PID response
c852fdae 1466 if(!fPidResponse)
1467 {
1468 AliDebug(1, "Using default PID Response");
1469 fPidResponse = AliHFEtools::GetDefaultPID(kFALSE, fInputEvent->IsA() == AliAODEvent::Class());
1470 }
9a1f999b 1471
c852fdae 1472 fPID->SetPIDResponse(fPidResponse);
9a1f999b 1473
c852fdae 1474 fCFM->SetRecEventInfo(fVevent);
9a1f999b 1475
c852fdae 1476 Double_t *fListOfmotherkink = 0;
1477 Int_t fNumberOfVertices = 0;
1478 Int_t fNumberOfMotherkink = 0;
9a1f999b 1479
1dd85087 1480
1481 //total event before event selection
1482 fNevent->Fill(1);
1483
1484 //______________________________________________________________________
1485 //Vertex Selection
c852fdae 1486 if(fIsAOD)
1487 {
1488 const AliAODVertex* trkVtx = fAOD->GetPrimaryVertex();
1489 if(!trkVtx || trkVtx->GetNContributors()<=0) return;
1490 TString vtxTtl = trkVtx->GetTitle();
1491 if(!vtxTtl.Contains("VertexerTracks")) return;
1dd85087 1492 //Float_t zvtx = trkVtx->GetZ();
1493 Float_t zvtx = -100;
1494 zvtx=trkVtx->GetZ();
c852fdae 1495 fZvtx = zvtx;
8e2d649d 1496
1497 fVtxZ_new1->Fill(fZvtx);
1498
c852fdae 1499 const AliAODVertex* spdVtx = fAOD->GetPrimaryVertexSPD();
1500 if(spdVtx->GetNContributors()<=0) return;
1501 TString vtxTyp = spdVtx->GetTitle();
1502 Double_t cov[6]={0};
1503 spdVtx->GetCovarianceMatrix(cov);
1504 Double_t zRes = TMath::Sqrt(cov[5]);
1dd85087 1505
1506 fzRes1->Fill(zRes);
c852fdae 1507 if(vtxTyp.Contains("vertexer:Z") && (zRes>0.25)) return;
1dd85087 1508 fzRes2->Fill(zRes);
1509
1510 fSPD_track_vtx1->Fill(spdVtx->GetZ() - trkVtx->GetZ());
c852fdae 1511 if(TMath::Abs(spdVtx->GetZ() - trkVtx->GetZ())>0.5) return;
1dd85087 1512 fSPD_track_vtx2->Fill(spdVtx->GetZ() - trkVtx->GetZ());
1513
c852fdae 1514
1dd85087 1515 if(TMath::Abs(zvtx) > 10) return;
8e2d649d 1516 fVtxZ_new2->Fill(fZvtx);
1517
1dd85087 1518 if(fabs(zvtx>10.0))return;
1519 fVtxZ_new3->Fill(fZvtx);
1520
1521
1522 //Look for kink mother for AOD
c852fdae 1523
1524 fNumberOfVertices = 0;
1525 fNumberOfMotherkink = 0;
1526
1527 if(fIsAOD)
1528 {
1529 fNumberOfVertices = fAOD->GetNumberOfVertices();
1530
1531 fListOfmotherkink = new Double_t[fNumberOfVertices];
1532
1533 for(Int_t ivertex=0; ivertex < fNumberOfVertices; ivertex++)
1534 {
1535 AliAODVertex *aodvertex = fAOD->GetVertex(ivertex);
1536 if(!aodvertex) continue;
1537 if(aodvertex->GetType()==AliAODVertex::kKink)
1538 {
1539 AliAODTrack *mother1 = (AliAODTrack *) aodvertex->GetParent();
1540 if(!mother1) continue;
1541 Int_t idmother = mother1->GetID();
1542 fListOfmotherkink[fNumberOfMotherkink] = idmother;
1543 fNumberOfMotherkink++;
1544 }
1545 }
1546 }
1547 }
1548 else
1549 {
c852fdae 1550
c852fdae 1551
9a1f999b 1552
0131ce6c 1553 /// ESD
8079a103 1554 const AliESDVertex* trkVtx = fESD->GetPrimaryVertex();
c852fdae 1555 if(!trkVtx || trkVtx->GetNContributors()<=0) return;
1556 TString vtxTtl = trkVtx->GetTitle();
1557 if(!vtxTtl.Contains("VertexerTracks")) return;
1dd85087 1558 Float_t zvtx = -100;
1559 zvtx=trkVtx->GetZ();
1560
8079a103 1561
1562 const AliESDVertex* spdVtx = fESD->GetPrimaryVertexSPD();
c852fdae 1563 if(spdVtx->GetNContributors()<=0) return;
1564 TString vtxTyp = spdVtx->GetTitle();
1565 Double_t cov[6]={0};
1566 spdVtx->GetCovarianceMatrix(cov);
1567 Double_t zRes = TMath::Sqrt(cov[5]);
1568 if(vtxTyp.Contains("vertexer:Z") && (zRes>0.25)) return;
1569 if(TMath::Abs(spdVtx->GetZ() - trkVtx->GetZ())>0.5) return;
8079a103 1570 if(TMath::Abs(zvtx) > 10) return;
c852fdae 1571 }
c852fdae 1572
1dd85087 1573 //______________________________________________________________________
1574 //after vertex selection
1575 fNevent->Fill(10);
1576
1577 //______________________________________________________________________
1578 //EMCal Trigger Selection (Threshold selection)
1579
1580 TString firedTrigger;
1581 TString TriggerEG1("EG1"); //takes trigger with name with EG1, ex: CEMC7EG1-B-NOPF-CENTNOTRD
1582 TString TriggerEG2("EG2");
1583 //Jan 17, 2014
1584 //TString TriggerEJE("EJE");
8e2d649d 1585
1dd85087 1586 if(fAOD) firedTrigger = fAOD->GetFiredTriggerClasses();
1587 else if(fESD) firedTrigger = fESD->GetFiredTriggerClasses();
1588
1589 //Bool_t IsEventEMCALL0=kTRUE;
1590 Bool_t IsEventEMCALL1=kFALSE;
1591
1592 if(firedTrigger.Contains(TriggerEG1)){
1593 fNevent->Fill(2);
1594 IsEventEMCALL1=kTRUE;
1595 }
1596 if(firedTrigger.Contains(TriggerEG2)){
1597 fNevent->Fill(3);
1598 IsEventEMCALL1=kTRUE;
1599 }
1600
1601 //if the flag is for a given threshold and it was not fired, return.
1602
1603 if(fEMCEG1){
1604 if(!firedTrigger.Contains(TriggerEG1))return;
1605 if(firedTrigger.Contains(TriggerEG2)){
1606 fNevent->Fill(4);
1607
1608 }
1609
1610 }
1611
1612
1613 if(fEMCEG2){
1614 if(!firedTrigger.Contains(TriggerEG2))return;
1615 if(firedTrigger.Contains(TriggerEG1)){
1616 fNevent->Fill(5);
1617 }
1618
1619 }
1620
9a1f999b 1621
8e2d649d 1622
1dd85087 1623 //______________________________________________________________________
1624 //Testing if there is an overlap EGA and EJE
1625 //none
1626 /*
1627 if(!(firedTrigger.Contains(TriggerEG1) && firedTrigger.Contains(TriggerEG2) ) && !firedTrigger.Contains(TriggerEJE))
1628 {
1629 fNevent->Fill(6);
1630 }
1631 //only GA
1632 if((firedTrigger.Contains(TriggerEG1) || firedTrigger.Contains(TriggerEG2)) && !firedTrigger.Contains(TriggerEJE))
1633 {
1634 fNevent->Fill(7);
1635 }
1636 //only JE
1637 if(!(firedTrigger.Contains(TriggerEG1) && firedTrigger.Contains(TriggerEG2)) && firedTrigger.Contains(TriggerEJE))
1638 {
1639 fNevent->Fill(8);
1640 }
1641 //both
1642 if((firedTrigger.Contains(TriggerEG1) || firedTrigger.Contains(TriggerEG2)) && firedTrigger.Contains(TriggerEJE))
1643 {
1644 fNevent->Fill(9);
1645 }
1646 */
0131ce6c 1647
8e2d649d 1648
1dd85087 1649
1650
1651 //Only events with at least 2 tracks are accepted
1652 Int_t fNOtrks = fVevent->GetNumberOfTracks();
c852fdae 1653 if(fNOtrks<2) return;
8e2d649d 1654
1dd85087 1655 fNevent->Fill(11);
1656
1657 if(fIsAOD){
1658 Int_t fNOtrks2 = fAOD->GetNumberOfTracks();
1659 if(fNOtrks2<2) return;
1660 }
1661 fNevent->Fill(12);
8e2d649d 1662
1dd85087 1663 //______________________________________________________________________
1664 //new track loop to select events
1665 //track pt cut (at least 2)
628d0da7 1666
8e2d649d 1667 if(fUseTrigger){
1668 if(fIsAOD){
1669 double fTrackMulti=0;
1670 for(Int_t iTracks = 0; iTracks < fVevent->GetNumberOfTracks(); iTracks++)
1671 {
1672 AliVParticle* Vtrack = fVevent->GetTrack(iTracks);
1dd85087 1673 if (!Vtrack) continue;
1674
8e2d649d 1675 AliVTrack *track = dynamic_cast<AliVTrack*>(Vtrack);
1dd85087 1676 //AliAODTrack *atrack = dynamic_cast<AliAODTrack*>(Vtrack);
8e2d649d 1677
1678 if((track->Pt())<0.2 || (track->Pt())>1000.0) continue;
1dd85087 1679 else fTrackMulti=fTrackMulti+1;
8e2d649d 1680
1681 }
1682 //Only take event if track multiplicity is bigger than 2.
1683 if(fTrackMulti<2) return;
1684 }
1685 }
1dd85087 1686 fNevent->Fill(13);
1687 //______________________________________________________________________
1688 //Using more cuts than I have beeing using
1689 //eta cut and primary (at least 2)
1690 if(fUseTrigger){
1691 if(fIsAOD){
1692 double fTrackMulti2=0;
1693 for(Int_t i = 0; i < fVevent->GetNumberOfTracks(); i++)
1694 {
1695 AliVParticle* Vtrack2 = fVevent->GetTrack(i);
1696 if (!Vtrack2) continue;
1697
1698
1699 AliVTrack *track_new = dynamic_cast<AliVTrack*>(Vtrack2);
1700 AliAODTrack *aodtrack = dynamic_cast<AliAODTrack*>(Vtrack2);
1701
1702
1703 if(aodtrack)
1704 {
1705
1706
1707 if(TMath::Abs(track_new->Eta())> 0.9) continue;
1708 if (aodtrack->GetType()!= AliAODTrack::kPrimary) continue ;
1709 else fTrackMulti2=fTrackMulti2+1;
1710 }
1711 }
1712 //Only take event if track multiplicity is bigger than 2.
1713 if(fTrackMulti2<2) return;
1714
1715
1716 }
1717 }
1718 fNevent->Fill(14);
1719//______________________________________________________________________
1720//Using more cuts than I have beeing using
1721//hybrid (at least2)
1722 if(fUseTrigger){
1723 if(fIsAOD){
1724 double fTrackMulti3=0;
1725 for(Int_t i = 0; i < fVevent->GetNumberOfTracks(); i++)
1726 {
1727 AliVParticle* Vtrack3 = fVevent->GetTrack(i);
1728 if (!Vtrack3) continue;
1729
1730 //AliVTrack *track_new = dynamic_cast<AliVTrack*>(Vtrack3);
1731 AliAODTrack *aodtrack = dynamic_cast<AliAODTrack*>(Vtrack3);
1732
1733
1734 if(aodtrack)
1735 {
1736
1737 if (!aodtrack->IsHybridGlobalConstrainedGlobal()) continue ;
1738 //another option if I don't want to use hybrid
1739 //if ( aodtrack->TestFilterBit(128)==kFALSE) continue ;
1740 else fTrackMulti3=fTrackMulti3+1;
1741 }
1742 }
1743 //Only take event if track multiplicity is bigger than 2.
1744 if(fTrackMulti3<2) return;
1745
1746 }
1747 }
1748 fNevent->Fill(15);
1749//______________________________________________________________________
8e2d649d 1750
8e2d649d 1751
1dd85087 1752 if(fUseTrigger){
1753 if(fIsAOD){
1754 double fTrackMulti4=0;
1755 for(Int_t iTracks = 0; iTracks < fVevent->GetNumberOfTracks(); iTracks++)
1756 {
1757 AliVParticle* Vtrack4 = fVevent->GetTrack(iTracks);
1758 if (!Vtrack4) continue;
1759
1760
1761 //AliVTrack *track = dynamic_cast<AliVTrack*>(Vtrack4);
1762 AliAODTrack *atrack = dynamic_cast<AliAODTrack*>(Vtrack4);
1763
1764 if(!atrack->TestFilterBit(768)) continue;
1765 if(!atrack->IsHybridGlobalConstrainedGlobal()) continue ;
1766
1767
1768 else fTrackMulti4=fTrackMulti4+1;
1769
1770 }
1771 //Only take event if track multiplicity is bigger than 2.
1772 if(fTrackMulti4<2) return;
1773 fTrack_Multi->Fill(fTrackMulti4);
1774 }
1775 }
1776 fNevent->Fill(16);
1777//______________________________________________________________________
628d0da7 1778
c852fdae 1779
1dd85087 1780//______________________________________________________________________
1781//Centrality Selection
c852fdae 1782 if(fHasCentralitySelection)
1783 {
1784 Float_t centrality = -1;
1785
1786 if(fIsAOD)
1787 {
1788 fCentrality = fAOD->GetHeader()->GetCentralityP();
1789 }
1790 else
1791 {
1792 fCentrality = fESD->GetCentrality();
1793 }
1794
1795 if(fEstimator==1) centrality = fCentrality->GetCentralityPercentile("ZDC");
1796 else centrality = fCentrality->GetCentralityPercentile("V0A");
1797
9a1f999b 1798 //cout << "Centrality = " << centrality << " %" << endl;
c852fdae 1799
1800 fCentralityHist->Fill(centrality);
1801
1802 if(centrality<fCentralityMin || centrality>fCentralityMax) return;
1803
1804 fCentralityHistPass->Fill(centrality);
1805 }
1dd85087 1806 //______________________________________________________________________
c852fdae 1807
1dd85087 1808
1809 fNevent->Fill(17);
1810
1811 //______________________________________________________________________
c852fdae 1812
1813 if(fIsMC)
1814 {
1815 if(fIsAOD)
1816 {
1817 fMCarray = dynamic_cast<TClonesArray*>(fAOD->FindListObject(AliAODMCParticle::StdBranchName()));
1818
1819 if(!fMCarray)
1820 {
1821 AliError("Array of MC particles not found");
1822 return;
1823 }
1824
1825 fMCheader = dynamic_cast<AliAODMCHeader*>(fAOD->GetList()->FindObject(AliAODMCHeader::StdBranchName()));
1826
1827 if(!fMCheader)
1828 {
1829 AliError("Could not find MC Header in AOD");
1830 return;
1831 }
1832
1833 for(Int_t iMC = 0; iMC < fMCarray->GetEntries(); iMC++)
1834 {
1835 fMCparticle = (AliAODMCParticle*) fMCarray->At(iMC);
89f41a30 1836 if(fMCparticle->GetMother()>0) fMCparticleMother = (AliAODMCParticle*) fMCarray->At(fMCparticle->GetMother());
67eb14b9 1837
c852fdae 1838 Int_t pdg = fMCparticle->GetPdgCode();
67eb14b9 1839
29881f7b 1840 //====================================================================
1841 //trying take pions spectra 27/May/2014
1842 //IsPrimary only take events from pythia
1843 //IsPhysicalPrimariee: (all prompt particles, including strong decay products plus weak decay product from heavy-flavor).
1844 //eta cut same as MinJung
1845
1846 if(fMCparticle->Eta()>=-0.8 && fMCparticle->Eta()<=0.8)
1847 {
1848 if(fMCparticle->IsPrimary()){
1849
1850 if(TMath::Abs(pdg)==111) fPtMCpi0->Fill(fMCparticle->Pt());
1851 if(TMath::Abs(pdg)==221) fPtMCeta->Fill(fMCparticle->Pt());
1852 //eta cut same as MinJung
1853 }
1854
1855 if(fMCparticle->IsPhysicalPrimary()){
1856 if(TMath::Abs(pdg)==111) fPtMCpi02->Fill(fMCparticle->Pt());
1857 if(TMath::Abs(pdg)==221) fPtMCeta2->Fill(fMCparticle->Pt());
1858
1859 }
1860
1861 if(TMath::Abs(pdg)==111) fPtMCpi03->Fill(fMCparticle->Pt());
1862 if(TMath::Abs(pdg)==221) fPtMCeta3->Fill(fMCparticle->Pt());
1863 }
1864 //====================================================================
89f41a30 1865
67eb14b9 1866 double proX = fMCparticle->Xv();
1867 double proY = fMCparticle->Yv();
1868 double proR = sqrt(pow(proX,2)+pow(proY,2));
1869
1870
c852fdae 1871 if(fMCparticle->Eta()>=fEtaCutMin && fMCparticle->Eta()<=fEtaCutMax && fMCparticle->Charge()!=0)
1872 {
67eb14b9 1873 //to correct background
89f41a30 1874 if (TMath::Abs(pdg) == 11 && fMCparticle->GetMother()>0){
1875 Int_t mpdg = fMCparticleMother->GetPdgCode();
1876
67eb14b9 1877 if(TMath::Abs(mpdg) == 221 || TMath::Abs(mpdg) == 22 || TMath::Abs(mpdg) == 111){
1878
1879 if(proR<7){
1880 fPtMCparticleAlle_nonPrimary->Fill(fMCparticle->Pt()); //denominator for total efficiency for all electrons, and not primary
1881
1882 }
1883 }
1884 }
1885
29881f7b 1886 if (TMath::Abs(pdg) == 11 && fMCparticle->IsPhysicalPrimary()){
1887 fPtMCparticleAlle_Primary->Fill(fMCparticle->Pt()); //denominator for total efficiency for all electrons primary
1888 }
9a1f999b 1889
c852fdae 1890 if( TMath::Abs(pdg) == 211 || TMath::Abs(pdg) == 2212 || TMath::Abs(pdg) == 321 || TMath::Abs(pdg) == 11 || TMath::Abs(pdg) == 13 )
1891 {
9a1f999b 1892
1893 fPtMCparticleAll_nonPrimary->Fill(fMCparticle->Pt()); //denominator for total efficiency for all particles, and not primary
c852fdae 1894 if(fMCparticle->IsPhysicalPrimary())
1895 {
1896 fPtMCparticleAll->Fill(fMCparticle->Pt());
1897
1898 Bool_t MotherFound = FindMother(iMC);
0131ce6c 1899 //Bool_t MotherFound = FindMother(track->GetLabel());
c852fdae 1900 if(MotherFound)
1901 {
0131ce6c 1902 if(fIsHFE1){
8e2d649d 1903 //denominator for total efficiency and tracking
1904 //unfolding: denominator is pt_MC and numerator is pt_reco
0131ce6c 1905 fPtMCparticleAllHfe1->Fill(fMCparticle->Pt());
1906 fEtaPhi_den->Fill(fMCparticle->Phi(),fMCparticle->Eta());
8e2d649d 1907
0131ce6c 1908
1909 } //denominator for total efficiency and tracking
29881f7b 1910 if(fIsHFE2){
1911 fPtMCparticleAllHfe2->Fill(fMCparticle->Pt());
1912 }
c852fdae 1913 }
1914 }
1915 }
67eb14b9 1916 }//eta cut
1917
8e2d649d 1918
1dd85087 1919
67eb14b9 1920 }//loop tracks
1dd85087 1921
29881f7b 1922
1923
1dd85087 1924 //second loop over track, but only the primaries ones
1925 //only primary pions --> how to take the primaries ones in AOD?
1926 /*
1927 for(Int_t iMC = 0; iMC < fMCarray->GetNPrimary(); iMC++){
1928 fMCparticle = (AliAODMCParticle*) fMCarray->At(iMC);
1929 pdg = fMCparticle->GetPdgCode();
1930
1931 if(TMath::Abs(pdg)==111) fPtMCpi0->Fill(fMCparticle->Pt());
1932 if(TMath::Abs(pdg)==221) fPtMCeta->Fill(fMCparticle->Pt());
1933
1934 if(fMCparticle->Eta()>=fEtaCutMin && fMCparticle->Eta()<=fEtaCutMax)
1935 {
1936
1937 if(TMath::Abs(pdg)==111) fPtMCpi02->Fill(fMCparticle->Pt());
1938 if(TMath::Abs(pdg)==221) fPtMCeta2->Fill(fMCparticle->Pt());
1939
1940 }
1941 }
1942 */
1943
1944
67eb14b9 1945 }//AOD
c852fdae 1946 else
1947 {
1948 fEventHandler = dynamic_cast<AliMCEventHandler*> (AliAnalysisManager::GetAnalysisManager()->GetMCtruthEventHandler());
1949 if (!fEventHandler) {
9a1f999b 1950 Printf("ERROR: Could not retrieve MC event handler");
1951 return;
c852fdae 1952 }
9a1f999b 1953
c852fdae 1954 fMCevent = fEventHandler->MCEvent();
1955 if (!fMCevent) {
9a1f999b 1956 Printf("ERROR: Could not retrieve MC event");
1957 return;
c852fdae 1958 }
9a1f999b 1959
c852fdae 1960 fMCstack = fMCevent->Stack();
1961
1dd85087 1962 //pion and eta spectrum
1963 //MinJung code
1964
1965 //----------------------------------------------------------------------------------------------------
1966 AliVParticle *mctrack2 = NULL;
1967 AliMCParticle *mctrack0 = NULL;
1968
1969
1970 for(Int_t imc = 0; imc <fMCEvent->GetNumberOfPrimaries(); imc++){
1971 if(!(mctrack2 = fMCEvent->GetTrack(imc))) continue;
1972 TParticle* mcpart0 = fMCEvent->Stack()->Particle(imc);
1973 if(!mcpart0) continue;
1974 mctrack0 = dynamic_cast<AliMCParticle *>(mctrack2);
1975 if(!mctrack0) continue;
1976
1977 if(TMath::Abs(AliHFEtools::GetRapidity(mcpart0))<0.8){
1978
1979 if(TMath::Abs(mctrack0->PdgCode()) == 111) // pi0
1980 {
1981 fPtMCpi0->Fill(mctrack0->Pt());
1982 }
1983
1984 if(TMath::Abs(mctrack0->PdgCode()) == 221) // eta
1985 {
1986 fPtMCeta->Fill(mctrack0->Pt());
1987 }
1988
1989 }
1990
1991 }
1992 // end of MinJung
1993 //----------------------------------------------------------------------------------------------------
1994
1995
c852fdae 1996 for(Int_t iMC = 0; iMC < fMCstack->GetNtrack(); iMC++)
1997 {
1998
1999 fMCtrack = fMCstack->Particle(iMC);
89f41a30 2000 if(fMCtrack->GetFirstMother()>0) fMCtrackMother = fMCstack->Particle(fMCtrack->GetFirstMother());
67eb14b9 2001 TParticle *particle=fMCstack->Particle(iMC);
2002
c852fdae 2003 Int_t pdg = fMCtrack->GetPdgCode();
89f41a30 2004
c852fdae 2005
9a1f999b 2006 if(TMath::Abs(pdg)==111) fPtMCpi0->Fill(fMCtrack->Pt());
2c8e1f6c 2007 if(TMath::Abs(pdg)==221) fPtMCeta->Fill(fMCtrack->Pt());
67eb14b9 2008
c852fdae 2009
2010 if(fMCtrack->Eta()>=fEtaCutMin && fMCtrack->Eta()<=fEtaCutMax)
2011 {
9a1f999b 2012
67eb14b9 2013 //to correct background
89f41a30 2014 if (TMath::Abs(pdg) == 11 && fMCtrack->GetFirstMother()>0){
2015 Int_t mpdg = fMCtrackMother->GetPdgCode();
67eb14b9 2016 if(TMath::Abs(mpdg) == 221 || TMath::Abs(mpdg) == 22 || TMath::Abs(mpdg) == 111){
2235208e 2017 Double_t proR=particle->R();
2018 if(proR<7){
0131ce6c 2019 fPtMCparticleAlle_nonPrimary->Fill(fMCtrack->Pt()); //denominator for total efficiency for all electrons, and not primary
2235208e 2020 }
67eb14b9 2021 }
2022 }
2023
0131ce6c 2024 if(TMath::Abs(pdg) == 11 && fMCstack->IsPhysicalPrimary(iMC)){
2025
2026 fPtMCparticleAlle_Primary->Fill(fMCtrack->Pt());
2027 }
9a1f999b 2028
c852fdae 2029 if( TMath::Abs(pdg) == 211 || TMath::Abs(pdg) == 2212 || TMath::Abs(pdg) == 321 || TMath::Abs(pdg) == 11 || TMath::Abs(pdg) == 13 )
2030 {
9a1f999b 2031 fPtMCparticleAll_nonPrimary->Fill(fMCtrack->Pt());//denominator for total efficiency for all particle, non Primary track
2032
0131ce6c 2033 if(fMCstack->IsPhysicalPrimary(iMC))
c852fdae 2034 {
0131ce6c 2035 fPtMCparticleAll->Fill(fMCtrack->Pt());
2036
2037 Bool_t MotherFound = FindMother(iMC);
2038 //Bool_t MotherFound = FindMother(track->GetLabel());
2039 if(MotherFound)
2040 {
2041 if(fIsHFE1){
2042 fPtMCparticleAllHfe1->Fill(fMCtrack->Pt());//denominator for total efficiency and tracking
2043 fEtaPhi_den->Fill(fMCtrack->Phi(),fMCtrack->Eta());
2044 }
29881f7b 2045 if(fIsHFE2){
2046 fPtMCparticleAllHfe2->Fill(fMCtrack->Pt());
2047 }
0131ce6c 2048 }
2049 }//Is Physical primary
c852fdae 2050 }
0131ce6c 2051 }//eta cut
67eb14b9 2052 }//loop tracks
2053 }//ESD
2054 }//Is MC
9a1f999b 2055
1dd85087 2056//______________________________________________________________________
2057//threshold selection was here
2058//______________________________________________________________________
2059//all events selected
c852fdae 2060
2061 fNevent->Fill(0);
c852fdae 2062
1dd85087 2063
2064//______________________________________________________________________
2065//events in the threshold
2066
c852fdae 2067 if(firedTrigger.Contains(TriggerEG1))
2068 {
1dd85087 2069 if(fEMCEG1){
2070 fNevent->Fill(18);
2071 if(!firedTrigger.Contains(TriggerEG2)) fNevent->Fill(19);
2072 //if(firedTrigger.Contains(TriggerEG2)) return;
2073 }
c852fdae 2074 }
2075
1dd85087 2076
0131ce6c 2077 //EG2
c852fdae 2078 if(firedTrigger.Contains(TriggerEG2))
2079 {
1dd85087 2080 if(fEMCEG2){
2081 fNevent->Fill(20);
2082 if(!firedTrigger.Contains(TriggerEG1)) fNevent->Fill(21);
2083 //if(firedTrigger.Contains(TriggerEG1)) return;
2084 }
c852fdae 2085 }
2086
0131ce6c 2087
1dd85087 2088
8e2d649d 2089 //New cluster information
2090 //after trigger threshold selection
1dd85087 2091 Int_t ClsNo2 = -999;
2092 ClsNo2 = fVevent->GetNumberOfCaloClusters();
2093 fNCluster_pure->Fill(ClsNo2);
2094
2095
0131ce6c 2096
8e2d649d 2097 if(ClsNo2<=0){
1dd85087 2098 fNevent->Fill(22); //events with no cluster
8e2d649d 2099 return;
2100 }
1dd85087 2101
2102 //in order to include time cut
2103 //fEMCALCells = fAOD->GetEMCALCells();
2104 //Double_t tof = clus->GetTOF();
2105 //clus->GetNCells()
2106 //if ( clus->E() < minE ) continue ;
2107
8e2d649d 2108
29881f7b 2109
93c64cd2 2110 if(fIsAOD){
1dd85087 2111
628d0da7 2112 //AliAODHeader * aodh = fAOD->GetHeader();
2113 //Int_t bc= aodh->GetBunchCrossNumber();
1dd85087 2114
2115
2116 Int_t ClsNo_aod = -999;
2117 ClsNo_aod = fAOD->GetNumberOfCaloClusters();
2118 fNCluster_pure_aod->Fill(ClsNo_aod);
29881f7b 2119 //Bool_t exotic=kTRUE;
1dd85087 2120
2121 for (Int_t i=0; i< ClsNo_aod; i++ ){
2122
2123 //fClus = fVevent->GetCaloCluster(i);
2124 //to be compatible with Shingo
2125 AliVCluster *clust = 0x0;
2126 clust = (AliVCluster*) fAOD->GetCaloCluster(i);
2127
2128 if(clust && clust->IsEMCAL())
2129 {
29881f7b 2130 //pure cluster information
1dd85087 2131 fECluster_pure->Fill(clust->E());
2132
2133 fNcells_energy->Fill(clust->GetNCells(),clust->E());
2134 fNCluster_ECluster->Fill(ClsNo_aod,clust->E());
2135
2136 if(clust->E()>1000) fNevent->Fill(23);
2137
2138 //exotic
29881f7b 2139 /*
1dd85087 2140 exotic = fEMCALRecoUtils->IsExoticCluster(clust, (AliVCaloCells*)fAOD->GetEMCALCells(), bc);
2141 if(exotic == kFALSE){
2142 fECluster_not_exotic->Fill(clust->E());
2143 fNcells_energy_not_exotic->Fill(clust->GetNCells(),clust->E());
2144 }
29881f7b 2145 */
1dd85087 2146
29881f7b 2147 //approximation to remove exotics
1dd85087 2148 if(clust->GetNCells()<5 && clust->E()>15.0){
2149 fECluster_exotic->Fill(clust->E());
2150 }
93c64cd2 2151 //Marcel cut (another approximation to remove exotics)
1dd85087 2152 else if((clust->GetNCells())> ((clust->E())/3+1)){
2153 fECluster_not_exotic1->Fill(clust->E());
2154 }
2155 else{
2156 fECluster_not_exotic2->Fill(clust->E());
2157 }
2158
2159
2160 }
29881f7b 2161 /*
1dd85087 2162 //______________________________________________________________________
2163 //Trying to remove events with bad cells and find patches
2164 //First, I will try to count them
2165 //______________________________________________________________________
2166
2167 if(clust && clust->IsEMCAL())
2168 {
2169 Bool_t badchannel = ContainsBadChannel("EMCAL", clust->GetCellsAbsId(),clust->GetNCells() );
2170 printf("Contém bad channel? %d ", badchannel);
2171 if(badchannel)fNevent2->Fill(0);
2172
2173 //trying to find patches
2174 TArrayI patches_found=GetTriggerPatches(IsEventEMCALL0, IsEventEMCALL1);
2175 printf("N patches %d, first %d, last %d\n",patches_found.GetSize(), patches_found.At(0), patches_found.At(patches_found.GetSize()-1));
2176
2177 }
2178
2179 //end of bad cells
2180 //______________________________________________________________________
93c64cd2 2181 */
1dd85087 2182
8e2d649d 2183 }
2184 }
29881f7b 2185
0131ce6c 2186
1dd85087 2187 fNevent->Fill(24); //events with cluster
2188
0131ce6c 2189
8e2d649d 2190 fVtxZ_new4->Fill(fZvtx);
2191
1dd85087 2192
c852fdae 2193 Int_t ClsNo = -999;
2194 if(!fIsAOD) ClsNo = fESD->GetNumberOfCaloClusters();
2195 else ClsNo = fAOD->GetNumberOfCaloClusters();
2196
0131ce6c 2197 //______________________________________________________________________
9a1f999b 2198
0131ce6c 2199 ///_____________________________________________________________________
2200 ///Track loop
c852fdae 2201 for(Int_t iTracks = 0; iTracks < fVevent->GetNumberOfTracks(); iTracks++)
2202 {
2203 AliVParticle* Vtrack = fVevent->GetTrack(iTracks);
2204 if (!Vtrack)
2205 {
2206 printf("ERROR: Could not receive track %d\n", iTracks);
2207 continue;
2208 }
9a1f999b 2209
c852fdae 2210 AliVTrack *track = dynamic_cast<AliVTrack*>(Vtrack);
2211 AliESDtrack *etrack = dynamic_cast<AliESDtrack*>(Vtrack);
2212 AliAODTrack *atrack = dynamic_cast<AliAODTrack*>(Vtrack);
2213
1dd85087 2214
c852fdae 2215 Double_t fTPCnSigma = -999;
2c8e1f6c 2216 Double_t fTOFnSigma = -999;
c852fdae 2217 Double_t fTPCnSigma_pion = -999;
2218 Double_t fTPCnSigma_proton = -999;
2219 Double_t fTPCnSigma_kaon = -999;
2220 Double_t fTPCsignal = -999;
2221 Double_t fPt = -999;
2222 Double_t fP = -999;
2223
0131ce6c 2224 //December 9th 2013
2225 //Etacut test on the begging
2226 fEtad[0]->Fill(track->Eta());
2227 //if(track->Eta()<fEtaCutMin || track->Eta()>fEtaCutMax) continue;
2228 fEtad[1]->Fill(track->Eta());
8e2d649d 2229
2230
2231
2232
0131ce6c 2233 ///_____________________________________________________________________________
2234 ///Fill QA plots without track selection
c852fdae 2235 fPt = track->Pt();
2236 fP = TMath::Sqrt((track->Pt())*(track->Pt()) + (track->Pz())*(track->Pz()));
2237
2238 fTPCsignal = track->GetTPCsignal();
2239 fTPCnSigma = fPidResponse->NumberOfSigmasTPC(track, AliPID::kElectron);
2c8e1f6c 2240 fTOFnSigma = fPidResponse->NumberOfSigmasTOF(track, AliPID::kElectron);
c852fdae 2241 fTPCnSigma_pion = fPidResponse->NumberOfSigmasTPC(track, AliPID::kPion);
2242 fTPCnSigma_proton = fPidResponse->NumberOfSigmasTPC(track, AliPID::kProton);
2243 fTPCnSigma_kaon = fPidResponse->NumberOfSigmasTPC(track, AliPID::kKaon);
9a1f999b 2244
c852fdae 2245 fTPC_p[0]->Fill(fPt,fTPCsignal);
2246 fTPCnsigma_p[0]->Fill(fP,fTPCnSigma);
2247
9a1f999b 2248
c852fdae 2249 Float_t TPCNcls = track->GetTPCNcls();
31185d97 2250 //TPC Ncls for pid
2251 Float_t TPCNcls_pid = track->GetTPCsignalN();
aaec953d 2252
31185d97 2253
2254
c852fdae 2255 Float_t pos[3]={0,0,0};
9a1f999b 2256
c852fdae 2257 Double_t fEMCflag = kFALSE;
2258 if(track->GetEMCALcluster()>0)
2259 {
2260 fClus = fVevent->GetCaloCluster(track->GetEMCALcluster());
2261 if(fClus->IsEMCAL())
2262 {
8e2d649d 2263
2264 //only for charged tracks
2265 fECluster[0]->Fill(fClus->E());
2266
2267
9a1f999b 2268 if(TMath::Abs(fClus->GetTrackDx())<=fdPhiCut && TMath::Abs(fClus->GetTrackDz())<=fdEtaCut)
2269 {
2270 fEMCflag = kTRUE;
2271 fEoverP_pt[0]->Fill(fPt,(fClus->E() / fP));
2272
2273
2274 Float_t Energy = fClus->E();
2275 Float_t EoverP = Energy/track->P();
2276 //Float_t M02 = fClus->GetM02();
2277 //Float_t M20 = fClus->GetM20();
2278
2279 /////////////// for Eta Phi distribution
2280 fClus->GetPosition(pos);
2281 TVector3 vpos(pos[0],pos[1],pos[2]);
2282 Double_t cphi = vpos.Phi();
2283 Double_t ceta = vpos.Eta();
2284 fEtaPhi[0]->Fill(cphi,ceta);
2285
8e2d649d 2286
9a1f999b 2287 fTPCNcls_EoverP[0]->Fill(TPCNcls, EoverP);
2288 }
c852fdae 2289 }
2290 }
2291
9a1f999b 2292 //______________________________________________________________
2293 // Vertex
c852fdae 2294
2295 fVtxZ[0]->Fill(fZvtx);
8e2d649d 2296 if(iTracks == 0)fNTracks[0]->Fill(fNOtrks);
2297 fNTracks_pt[0]->Fill(fNOtrks, fPt);
2298 fNTracks_eta[0]->Fill(fNOtrks, track->Eta());
2299 fNTracks_phi[0]->Fill(fNOtrks, track->Phi());
2300
2301
c852fdae 2302 fNClusters[0]->Fill(ClsNo);
aaec953d 2303 fTPCNcls_pid[0]->Fill(TPCNcls, TPCNcls_pid);
9a1f999b 2304 //______________________________________________________________
c852fdae 2305
8e2d649d 2306///Fill QA plots without track selection
2307///_____________________________________________________________________________
2308//______________________________________________________________________________________
2309//Track Selection Cuts
9a1f999b 2310
8e2d649d 2311//AOD (Test Filter Bit)
c852fdae 2312 if(fIsAOD)
2313 {
9a1f999b 2314 // standard cuts with very loose DCA - BIT(4)
2315 // Description:
c852fdae 2316 /*
9a1f999b 2317 GetStandardITSTPCTrackCuts2011(kFALSE)
2318 SetMaxChi2PerClusterTPC(4);
2319 SetAcceptKinkDaughters(kFALSE);
2320 SetRequireTPCRefit(kTRUE);
2321 SetRequireITSRefit(kTRUE);
2322 SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
2323 SetMaxDCAToVertexZ(2);
2324 SetMaxDCAToVertex2D(kFALSE);
2325 SetRequireSigmaToVertex(kFALSE);
2326 SetMaxChi2PerClusterITS(36);
2327 SetMaxDCAToVertexXY(2.4)
2328 SetMaxDCAToVertexZ(3.2)
2329 SetDCaToVertex2D(kTRUE)
2330 */
c852fdae 2331
2332 if(!atrack->TestFilterMask(AliAODTrack::kTrkGlobalNoDCA)) continue;
2333 }
2334
8e2d649d 2335//RecKine: ITSTPC cuts
c852fdae 2336 if(!ProcessCutStep(AliHFEcuts::kStepRecKineITSTPC, track)) continue;
8e2d649d 2337//RecKink
c852fdae 2338 if(fRejectKinkMother)
2339 {
2340 if(fIsAOD)
2341 {
2342 Bool_t kinkmotherpass = kTRUE;
2343 for(Int_t kinkmother = 0; kinkmother < fNumberOfMotherkink; kinkmother++)
2344 {
2345 if(track->GetID() == fListOfmotherkink[kinkmother])
2346 {
2347 kinkmotherpass = kFALSE;
2348 continue;
2349 }
2350 }
2351 if(!kinkmotherpass) continue;
2352 }
2353 else
2354 {
2355 if(etrack->GetKinkIndex(0) != 0) continue;
2356 }
2357 }
9a1f999b 2358
8e2d649d 2359//RecPrim
a4e971f7 2360
2361 //it was not working on aod... testing again
2362 //July 29th, 2014: aparently working again
2363
2364///if(!fIsAOD)
2365//{
2366
2367 if(!ProcessCutStep(AliHFEcuts::kStepRecPrim, track)) continue;
2368//}
9a1f999b 2369
8e2d649d 2370//HFEcuts: ITS layers cuts
c852fdae 2371 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsITS, track)) continue;
9a1f999b 2372
8e2d649d 2373//HFE cuts: TPC PID cleanup
c852fdae 2374 if(!ProcessCutStep(AliHFEcuts::kStepHFEcutsTPC, track)) continue;
a4e971f7 2375
2376//DCA cut done by hand -- July 29th, 2014
2377 if(fIsAOD){
2378 Double_t d0z0[2], cov[3];
2379 AliAODVertex *prim_vtx = fAOD->GetPrimaryVertex();
2380 track->PropagateToDCA(prim_vtx, fAOD->GetMagneticField(), 20., d0z0, cov);
2381 Double_t DCAxy = d0z0[0];
2382 Double_t DCAz = d0z0[1];
2383
2384 if(DCAxy >= fDCAcutr || DCAz>=fDCAcutz) continue;
2385 }
2386
2387
2388
2389
2390
8e2d649d 2391//______________________________________________________________________________________
c852fdae 2392
8e2d649d 2393 if(fIsAOD){
a4e971f7 2394 //AOD test -- Francesco suggestion
1dd85087 2395 //aod test -- Francesco suggestion
2396 AliAODTrack *aod_track=fAOD->GetTrack(iTracks);
2397
8e2d649d 2398 Int_t type=aod_track->GetType();
2399 if(type==AliAODTrack::kPrimary) fPtPrim->Fill(aod_track->Pt());
2400 if(type==AliAODTrack::kSecondary) fPtSec->Fill(aod_track->Pt());
2401
2402 //Int_t type2=track->GetType();
2403 if(type==AliAODTrack::kPrimary) fPtPrim2->Fill(track->Pt());
2404 if(type==AliAODTrack::kSecondary) fPtSec2->Fill(track->Pt());
2405 }
2406
2407
2408///_____________________________________________________________
2409///QA plots after track selection
c852fdae 2410 if(fIsMC)
2411 {
2412 if(track->GetLabel()>=0) fPtMCWithLabel->Fill(fPt);
2413 else fPtMCWithoutLabel->Fill(fPt);
2414 }
2415
0131ce6c 2416 if(fIsMC && track->GetLabel()>=0)
c852fdae 2417 {
29881f7b 2418 if(fIsAOD)
2419 {
0131ce6c 2420 fMCparticle = (AliAODMCParticle*) fMCarray->At(track->GetLabel());
c852fdae 2421
8e2d649d 2422
29881f7b 2423 if(fMCparticle->IsPhysicalPrimary())
2424 {
2425 fPtIsPhysicaPrimary->Fill(fPt);
2426 }
0131ce6c 2427
2428 Int_t pdg = fMCparticle->GetPdgCode();
2429 if(fMCparticle->Eta()>=fEtaCutMin && fMCparticle->Eta()<=fEtaCutMax && fMCparticle->Charge()!=0)
2430 {
9a1f999b 2431
2c8e1f6c 2432
0131ce6c 2433 if( TMath::Abs(pdg) == 211 || TMath::Abs(pdg) == 2212 || TMath::Abs(pdg) == 321 || TMath::Abs(pdg) == 11 || TMath::Abs(pdg) == 13 )
2434 {
2435 fPtMCparticleReco_nonPrimary->Fill(fMCparticle->Pt()); //not Primary track
9a1f999b 2436
0131ce6c 2437 if(fMCparticle->IsPhysicalPrimary())
c852fdae 2438 {
0131ce6c 2439 fPtMCparticleReco->Fill(fMCparticle->Pt());
2440
2441 Bool_t MotherFound = FindMother(track->GetLabel());
2442 if(MotherFound)
2443 {
29881f7b 2444 if(fIsHFE1)
2445 {
8e2d649d 2446 fPtMCparticleRecoHfe1->Fill(fMCparticle->Pt());//numerator tracking
2447 //unfolding
2448 fpt_reco_pt_MC_den->Fill(track->Pt(),fMCparticle->Pt());
2449
2450 }
29881f7b 2451 if(fIsHFE2){
2452 fPtMCparticleRecoHfe2->Fill(fMCparticle->Pt());
2453 }
0131ce6c 2454 }
c852fdae 2455 }
2456 }
2457 }
8e2d649d 2458
2459
2460
0131ce6c 2461 }//close AOD
2462 //ESD
2463 else
2464 {
2465
2466
2467 if(fMCtrack->Eta()>=fEtaCutMin && fMCtrack->Eta()<=fEtaCutMax)
2468 {
9a1f999b 2469
0131ce6c 2470 fMCtrack = fMCstack->Particle(track->GetLabel());
2471 Int_t pdg = fMCtrack->GetPdgCode();
9a1f999b 2472
0131ce6c 2473 if( TMath::Abs(pdg) == 211 || TMath::Abs(pdg) == 2212 || TMath::Abs(pdg) == 321 || TMath::Abs(pdg) == 11 || TMath::Abs(pdg) == 13 )
2474 {
2475 fPtMCparticleReco_nonPrimary->Fill(fMCtrack->Pt());//not Primary track
2476 }
9a1f999b 2477
2478
0131ce6c 2479 if(fMCstack->IsPhysicalPrimary(track->GetLabel()))
2480 {
9a1f999b 2481 fPtIsPhysicaPrimary->Fill(fPt);
2482
2483
9a1f999b 2484 if( TMath::Abs(pdg) == 211 || TMath::Abs(pdg) == 2212 || TMath::Abs(pdg) == 321 || TMath::Abs(pdg) == 11 || TMath::Abs(pdg) == 13 )
c852fdae 2485 {
9a1f999b 2486 fPtMCparticleReco->Fill(fMCtrack->Pt());
2487
2488 Bool_t MotherFound = FindMother(track->GetLabel());
2489 if(MotherFound)
2490 {
0131ce6c 2491 if(fIsHFE1) fPtMCparticleRecoHfe1->Fill(fMCtrack->Pt());//numerator tracking
9a1f999b 2492 if(fIsHFE2) fPtMCparticleRecoHfe2->Fill(fMCtrack->Pt());
2493 }
c852fdae 2494 }
0131ce6c 2495 }
c852fdae 2496 }
0131ce6c 2497 }//close ESD
2498 }//close IsMC
c852fdae 2499
2500 fTPC_p[1]->Fill(fPt,fTPCsignal);
2501 fTPCnsigma_p[1]->Fill(fP,fTPCnSigma);
2c8e1f6c 2502 Double_t fPtBin[7] = {1,2,4,6,8,10,15};
628d0da7 2503 Double_t fPtBin_trigger[11] = {1,2,4,6,8,10,12,14,16,18,20};
9a1f999b 2504
c852fdae 2505 TPCNcls = track->GetTPCNcls();
2506 Float_t pos2[3]={0,0,0};
2507
2508 if(track->GetEMCALcluster()>0)
2509 {
2510 fClus = fVevent->GetCaloCluster(track->GetEMCALcluster());
2511 if(fClus->IsEMCAL())
2512 {
9a1f999b 2513 if(TMath::Abs(fClus->GetTrackDx())<=fdPhiCut && TMath::Abs(fClus->GetTrackDz())<=fdEtaCut)
2514 {
2515 fEoverP_pt[1]->Fill(fPt,(fClus->E() / fP));
2516
2517 Float_t Energy = fClus->E();
2518 Float_t EoverP = Energy/track->P();
2519 Float_t M02 = fClus->GetM02();
2520 Float_t M20 = fClus->GetM20();
2521 Float_t ncells = fClus->GetNCells();
2522
2523 /////////////// for Eta Phi distribution
2524 fClus->GetPosition(pos2);
2525 TVector3 vpos(pos2[0],pos2[1],pos2[2]);
2526 Double_t cphi = vpos.Phi();
2527 Double_t ceta = vpos.Eta();
2528 fEtaPhi[1]->Fill(cphi,ceta);
2529
2530 fECluster[1]->Fill(Energy);
2531 fTPCNcls_EoverP[1]->Fill(TPCNcls, EoverP);
2532
2533
0131ce6c 2534 //for EMCal trigger performance
9a1f999b 2535 if(EoverP > 0.9){
2536 ftpc_p_EoverPcut->Fill(track->P(), fTPCsignal);
2537 fnsigma_p_EoverPcut->Fill(track->P(), fTPCnSigma);
2538
2539 }
2540
2541
8e2d649d 2542 //for hadron contamination calculations
9a1f999b 2543
2544
8e2d649d 2545 // EtaCut -> dados
9a1f999b 2546 if(track->Eta()>=fEtaCutMin && track->Eta()<=fEtaCutMax ){
2547 //main
2548 if(TMath::Abs(fTPCnSigma_pion)<3 || TMath::Abs(fTPCnSigma_proton)<3 || TMath::Abs(fTPCnSigma_kaon)<3 ){
2549
2550 if(fTPCnSigma<-3.5){
2551 fEoverP_pt_hadrons->Fill(fPt,EoverP);
2552 if(fUseEMCal) fShowerShape_ha->Fill(M02,M20);
2553 }
2554 }
eae1842e 2555 //for systematic studies of hadron contamination
2556 if(fTPCnSigma < -3){
9a1f999b 2557 fEoverP_pt_pions->Fill(fPt, EoverP);
2558
2559 }
2560
eae1842e 2561 if(fTPCnSigma < -3.5){
9a1f999b 2562 fEoverP_pt_pions2->Fill(fPt, EoverP);
2563
2564 }
2565
2566
2567 }
2568
2569
2570
2571
2c8e1f6c 2572 for(Int_t i = 0; i < 6; i++)
9a1f999b 2573 {
2574 if(fPt>=fPtBin[i] && fPt<fPtBin[i+1])
2575 {
2576
2577 if(fTPCnSigma < -5 && fTPCnSigma > -10){
2578 fNcells_hadrons[i]->Fill(ncells);
2579 }
2580 //hadrons selection using E/p
2581 if((fClus->E() / fP) >= 0.2 && (fClus->E() / fP) <= 0.7){
2582 fTPCnsigma_eta_hadrons[i]->Fill(fTPCnSigma, ceta);
2583 }
2584 //electrons selection using E/p
2585 if((fClus->E() / fP) >= fEoverPCutMin && (fClus->E() / fP) <= fEoverPCutMax) {
2586 fTPCnsigma_eta_electrons[i]->Fill(fTPCnSigma, ceta);
2587 }
2588 }
2589 }
2590
2591 if((fClus->E() / fP) >= fEoverPCutMin && (fClus->E() / fP) <= fEoverPCutMax)
2592 {
c852fdae 2593 fTPCnsigma_eta->Fill(track->Eta(),fTPCnSigma);
2594 fTPCnsigma_phi->Fill(track->Phi(),fTPCnSigma);
2595
2596 if(fUseEMCal)
2597 {
2598 if(fTPCnSigma < 3.5 && fCorrelationFlag)
2599 {
2600 fPtTrigger_Inc->Fill(fPt);
2601 DiHadronCorrelation(track, iTracks);
2602 }
2603 }
9a1f999b 2604 }
2605
2606 }
c852fdae 2607 }
2608 }
2609
0131ce6c 2610 //______________________________________________________________
2611 // Vertex
c852fdae 2612
2613 fVtxZ[1]->Fill(fZvtx);
8e2d649d 2614 if(iTracks == 0)fNTracks[1]->Fill(fNOtrks);
2615 fNTracks_pt[1]->Fill(fNOtrks, fPt);
2616 fNTracks_eta[1]->Fill(fNOtrks, track->Eta());
2617 fNTracks_phi[1]->Fill(fNOtrks, track->Phi());
c852fdae 2618 fNClusters[1]->Fill(ClsNo);
aaec953d 2619 fTPCNcls_pid[1]->Fill(TPCNcls, TPCNcls_pid);
c852fdae 2620
0131ce6c 2621 //______________________________________________________________
2622
2623 ///______________________________________________________________________
2624 ///Histograms for PID Studies
2625 //Double_t fPtBin[6] = {2,4,6,8,10,15};
c852fdae 2626
2c8e1f6c 2627 for(Int_t i = 0; i < 6; i++)
c852fdae 2628 {
9a1f999b 2629 if(fPt>=fPtBin[i] && fPt<fPtBin[i+1])
2630 {
2631 if(fEMCflag) fEoverP_tpc[i]->Fill(fTPCnSigma,(fClus->E() / fP));
9a1f999b 2632 fTPC_pt[i]->Fill(fTPCsignal);
2633 fTPCnsigma_pt[i]->Fill(fTPCnSigma);
2634
2635 }
c852fdae 2636 }
2637
93c64cd2 2638 if(track->Eta()>=fEtaCutMin && track->Eta()<=fEtaCutMax ){
2639
628d0da7 2640 //new pt bins for trigger data
2641
2642 for(Int_t i = 0; i < 10; i++)
2643 {
2644 if(fP>=fPtBin_trigger[i] && fP<fPtBin_trigger[i+1])
2645 {
2646 if(fEMCflag)fEoverP_tpc_p_trigger[i]->Fill(fTPCnSigma,(fClus->E() / fP));
2647
2648 }
2649
2650 if(fPt>=fPtBin_trigger[i] && fPt<fPtBin_trigger[i+1])
2651 {
2652 if(fEMCflag)fEoverP_tpc_pt_trigger[i]->Fill(fTPCnSigma,(fClus->E() / fP));
2653
2654 }
2655 }
2656
93c64cd2 2657
2658 //new way to calculate TPCnsigma distribution: TPCnsigma in function of p, with/without E/p cut
2659 fTPCnsigma_p_TPC->Fill(fP, fTPCnSigma);
2660 if(fEMCflag){
2661
2662 fTPCnsigma_p_TPC_on_EMCal_acc->Fill(fP, fTPCnSigma);
2663
2664 if((fClus->E() / fP) >= fEoverPCutMin && (fClus->E() / fP) <= fEoverPCutMax){
2665 fTPCnsigma_p_TPC_EoverP_cut->Fill(fP, fTPCnSigma);
2666 }
2667
2668 }//close EMCflag
628d0da7 2669
93c64cd2 2670 }//close eta cut
2671
2672 ///QA plots after track selection
2673 ///_____________________________________________________________
c852fdae 2674
93c64cd2 2675 //_______________________________________________________
2676 //Correlation Analysis - DiHadron
c852fdae 2677 if(!fUseEMCal)
2678 {
2679 if(fTPCnSigma < 3.5 && fCorrelationFlag)
2680 {
2681 fPtTrigger_Inc->Fill(fPt);
2682 DiHadronCorrelation(track, iTracks);
2683 }
2684 }
9a1f999b 2685 //_______________________________________________________
c852fdae 2686
2687
9a1f999b 2688 ///////////////////////////////////////////////////////////////////
2689 ///TPC - efficiency calculation //
c852fdae 2690
9a1f999b 2691 /// changing start here
c852fdae 2692 if(fIsMC && fIsAOD && track->GetLabel()>=0)
2693 {
2694 fMCparticle = (AliAODMCParticle*) fMCarray->At(track->GetLabel());
2695 Int_t pdg = fMCparticle->GetPdgCode();
2696
9a1f999b 2697 //
c852fdae 2698 if(fMCparticle->IsPhysicalPrimary()){
c852fdae 2699
9a1f999b 2700
2701 if(fMCparticle->Eta()>=fEtaCutMin && fMCparticle->Eta()<=fEtaCutMax ){
2702
c852fdae 2703 Bool_t MotherFound = FindMother(track->GetLabel());
2704 if(MotherFound){
2705 fMCparticleMother = (AliAODMCParticle*) fMCarray->At(fMCparticle->GetMother());
2706 if( TMath::Abs(pdg) == 11 && fMCparticleMother->GetPdgCode()!=22 ){
9a1f999b 2707 if(fIsHFE1) fPtMC_TPC_All->Fill(fMCparticle->Pt());
c852fdae 2708 }
2709 }
9a1f999b 2710 }
c852fdae 2711 }
2712 }///until here
2713
2714 else if(fIsMC && track->GetLabel()>=0)//ESD
2715 {
2716
2717 if(fMCstack->IsPhysicalPrimary(track->GetLabel())){
2718 fMCtrack = fMCstack->Particle(track->GetLabel());
2719
2720 Int_t pdg = fMCtrack->GetPdgCode();
2721 if(fMCtrack->Eta()>=fEtaCutMin && fMCtrack->Eta()<=fEtaCutMax ){
2722
2723 if(fMCtrack->GetFirstMother()>0){
2724 fMCtrackMother = fMCstack->Particle(fMCtrack->GetFirstMother());
0131ce6c 2725 Bool_t MotherFound = FindMother(track->GetLabel());
2726 if(MotherFound){
2727 if( TMath::Abs(pdg) == 11 && fMCtrackMother->GetPdgCode()!=22 ){
2728 if(fIsHFE1) fPtMC_TPC_All->Fill(fMCtrack->Pt());
2729 }
2730 }
c852fdae 2731 }
2732 }
2733 }
2734 }
2735
2736
2c8e1f6c 2737 if(fPt>1 && fPt<2) fTOF01->Fill(fTOFnSigma,fTPCnSigma);
2738 if(fPt>2 && fPt<4) fTOF02->Fill(fTOFnSigma,fTPCnSigma);
2739 if(fPt>4 && fPt<6) fTOF03->Fill(fTOFnSigma,fTPCnSigma);
2740
8e2d649d 2741///________________________________________________________________________
2742///PID
2743///Here the PID cuts defined in the file "ConfigEMCalHFEpA.C" is applied
c852fdae 2744 Int_t pidpassed = 1;
2745 AliHFEpidObject hfetrack;
9a4682da 2746 hfetrack.SetAnalysisType(AliHFEpidObject::kESDanalysis);
c852fdae 2747 hfetrack.SetRecTrack(track);
a89620c8 2748 hfetrack.SetPP(); //proton-proton analysis
c852fdae 2749 if(!fPID->IsSelected(&hfetrack, NULL, "", fPIDqa)) pidpassed = 0;
2750 fpid->Fill(pidpassed);
2751
2752 if(pidpassed==0) continue;
8e2d649d 2753///________________________________________________________________________
c852fdae 2754
c852fdae 2755
8e2d649d 2756////////////////////////////////////////////////////////////////////
2757///TPC efficiency calculations
9a1f999b 2758
0131ce6c 2759
c852fdae 2760 if(fIsMC && fIsAOD && track->GetLabel()>=0)
2761 {
2762 fMCparticle = (AliAODMCParticle*) fMCarray->At(track->GetLabel());
2763 Int_t pdg = fMCparticle->GetPdgCode();
2764
9a1f999b 2765 //
c852fdae 2766 if(fMCparticle->IsPhysicalPrimary()){
2767
2768
2769 if(fMCparticle->Eta()>=fEtaCutMin && fMCparticle->Eta()<=fEtaCutMax ){
2770
2771 Bool_t MotherFound = FindMother(track->GetLabel());
2772 if(MotherFound){
2773 fMCparticleMother = (AliAODMCParticle*) fMCarray->At(fMCparticle->GetMother());
2774 if( TMath::Abs(pdg) == 11 && fMCparticleMother->GetPdgCode()!=22 ){
2775 if(fIsHFE1) fPtMC_TPC_Selected->Fill(fMCparticle->Pt());
2776 }
2777 }
2778 }
2779 }
2780 }///until here
2781
2782 else if(fIsMC && track->GetLabel()>=0)//ESD
2783 {
2784
2785 if(fMCstack->IsPhysicalPrimary(track->GetLabel())){
2786 fMCtrack = fMCstack->Particle(track->GetLabel());
2787
2788 Int_t pdg = fMCtrack->GetPdgCode();
2789 if(fMCtrack->Eta()>=fEtaCutMin && fMCtrack->Eta()<=fEtaCutMax ){
2790
2791 if(fMCtrack->GetFirstMother()>0){
2792 fMCtrackMother = fMCstack->Particle(fMCtrack->GetFirstMother());
0131ce6c 2793 Bool_t MotherFound = FindMother(track->GetLabel());
2794 if(MotherFound){
2795 if( TMath::Abs(pdg) == 11 && fMCtrackMother->GetPdgCode()!=22 ){
2796 if(fIsHFE1) fPtMC_TPC_Selected->Fill(fMCtrack->Pt());
2797 }
2798 }
c852fdae 2799 }
2800 }
2801 }
2802 }
2803
8e2d649d 2804 //Eta Cut for TPC only
c852fdae 2805 if(track->Eta()>=fEtaCutMin && track->Eta()<=fEtaCutMax ){
2806 fTPCnsigma_pt_2D->Fill(fPt,fTPCnSigma);
2807 }
2808
8e2d649d 2809 //Background for TPC only
9a4682da 2810 if(fFillBackground){
0131ce6c 2811
2812 //efficiency without SS cut for TPC only
2813 if(track->Eta()>=fEtaCutMin && track->Eta()<=fEtaCutMax){
2814 Background(track, iTracks, Vtrack, kTRUE); //IsTPConly=kTRUE
2815 } //Eta cut to be consistent with other efficiency
9a4682da 2816 }
2817
2818
c852fdae 2819 fTPCnsigma_p[2]->Fill(fP,fTPCnSigma);
2820 fTPC_p[2]->Fill(fP,fTPCsignal);
2821 TPCNcls = track->GetTPCNcls();
2822 Float_t pos3[3]={0,0,0};
2823
8e2d649d 2824
2825 //here denominator for track-matching efficiency
2826 if(fIsMC && fIsAOD && track->GetLabel()>=0)
2827 {
2828 fMCparticle = (AliAODMCParticle*) fMCarray->At(track->GetLabel());
2829 Int_t pdg = fMCparticle->GetPdgCode();
2830
2831 //
2832 if(fMCparticle->IsPhysicalPrimary()){
2833
2834
2835 if(fMCparticle->Eta()>=fEtaCutMin && fMCparticle->Eta()<=fEtaCutMax ){
2836
2837 Bool_t MotherFound = FindMother(track->GetLabel());
2838 if(MotherFound){
2839 fMCparticleMother = (AliAODMCParticle*) fMCarray->At(fMCparticle->GetMother());
2840 if( TMath::Abs(pdg) == 11 && fMCparticleMother->GetPdgCode()!=22 ){
2841 if(fIsHFE1) fPt_track_match_den->Fill(fMCparticle->Pt());
2842 }
2843 }
2844 }
2845 }
2846 }///until here
2847
2848
c852fdae 2849 if(track->GetEMCALcluster()>0)
2850 {
2851 fClus = fVevent->GetCaloCluster(track->GetEMCALcluster());
2852 if(fClus->IsEMCAL())
2853 {
2854
0131ce6c 2855 //________________________________________________________________________
a89620c8 2856
2857
0131ce6c 2858 //Cluster timing distribution -- for ESD
2859 if(fUseEMCal && !fIsAOD){
2860
2861 AliESDCaloCells &cells_esd=*(fESD->GetEMCALCells());
2862 TRefArray* caloClusters_esd = new TRefArray();
2863 fESD->GetEMCALClusters(caloClusters_esd);
2864 Int_t nclus_esd = caloClusters_esd->GetEntries();
2865
2866
2867 for (Int_t icl = 0; icl < nclus_esd; icl++) {
2868
2869 AliESDCaloCluster* clus_esd = (AliESDCaloCluster*)caloClusters_esd->At(icl);
2870
2871 if(clus_esd->IsEMCAL()){
2872 Float_t ncells_esd = fClus->GetNCells();
2873 UShort_t * index_esd = clus_esd->GetCellsAbsId() ;
2874 UShort_t * index2_esd = fClus->GetCellsAbsId() ;
2875
2876
2877 for(Int_t i = 0; i < ncells_esd ; i++){
2878
2879 Int_t absId_esd = index_esd[i];
2880 fTime->Fill(fPt,cells_esd.GetCellTime(absId_esd));
2881
2882 Int_t absId2_esd = index2_esd[i];
2883 fTime2->Fill(fPt,cells_esd.GetCellTime(absId2_esd));
2884 }
2885
2886 }
2887 }
2888
2889 }
2890 /* not working!
2891 //Cluster timing distribution -- for AOD
2892 if(fUseEMCal && fIsAOD){
a89620c8 2893
0131ce6c 2894 AliAODCaloCells &cells_aod=*(fAOD->GetEMCALCells());
a89620c8 2895
0131ce6c 2896 TRefArray* caloClusters_aod = new TRefArray();
2897 fAOD->GetEMCALClusters(caloClusters_aod);
a89620c8 2898
0131ce6c 2899 Int_t nclus_aod = caloClusters_aod->GetEntries();
a89620c8 2900
0131ce6c 2901 for (Int_t icl = 0; icl < nclus_aod; icl++) {
2902
2903 AliAODCaloCluster* clus_aod = (AliAODCaloCluster*)caloClusters_aod->At(icl);
a89620c8 2904
a89620c8 2905
0131ce6c 2906 if(clus_aod->IsEMCAL()){
2907 Float_t ncells_aod = fClus->GetNCells();
2908 UShort_t * index_aod = clus_aod->GetCellsAbsId() ;
2909 UShort_t * index2_aod = fClus->GetCellsAbsId() ;
a89620c8 2910
2911
0131ce6c 2912 for(Int_t i = 0; i < ncells_aod ; i++){
a89620c8 2913
0131ce6c 2914 Int_t absId_aod = index_aod[i];
2915 fTime->Fill(fPt,cells_aod.GetCellTime(absId_aod));
a89620c8 2916
0131ce6c 2917 Int_t absId2_aod = index2_aod[i];
2918 fTime2->Fill(fPt,cells_aod.GetCellTime(absId2_aod));
a89620c8 2919 }
2920
2921 }
2922 }
2923
9a4682da 2924 }
0131ce6c 2925 */
2926
2927
9a4682da 2928 if(fUseEMCal){
2929 double emctof = fClus->GetTOF();
2930 ftimingEle->Fill(fPt,emctof);
a89620c8 2931 }
9a1f999b 2932 //________________________________________________________________________
a89620c8 2933
2934
2935
9a1f999b 2936
0131ce6c 2937 // Residuals
9a1f999b 2938 Double_t Dx = fClus->GetTrackDx();
2939 Double_t Dz = fClus->GetTrackDz();
2940 Double_t R=TMath::Sqrt(Dx*Dx+Dz*Dz);
0131ce6c 2941
2c8e1f6c 2942 for(Int_t i = 0; i < 6; i++)
c852fdae 2943 {
2944 if(fPt>=fPtBin[i] && fPt<fPtBin[i+1])
2945 {
2946
2947 fEta[i]->Fill(Dz);
2948 fPhi[i]->Fill(Dx);
2949 fR[i]->Fill(R);
2950 }
9a1f999b 2951 }
c852fdae 2952
9a1f999b 2953 if(TMath::Abs(fClus->GetTrackDx())<=fdPhiCut && TMath::Abs(fClus->GetTrackDz())<=fdEtaCut)
2954 {
2955 Float_t Energy = fClus->E();
2956 Float_t EoverP = Energy/track->P();
2957 Float_t M02 = fClus->GetM02();
2958 Float_t M20 = fClus->GetM20();
2959 Float_t ncells = fClus->GetNCells();
8e2d649d 2960
2961 //here numerator for track-matching efficiency
2962 if(fIsMC && fIsAOD && track->GetLabel()>=0)
2963 {
2964 fMCparticle = (AliAODMCParticle*) fMCarray->At(track->GetLabel());
2965 Int_t pdg = fMCparticle->GetPdgCode();
2966
2967 //
2968 if(fMCparticle->IsPhysicalPrimary()){
2969
2970
2971 if(fMCparticle->Eta()>=fEtaCutMin && fMCparticle->Eta()<=fEtaCutMax ){
2972
2973 Bool_t MotherFound = FindMother(track->GetLabel());
2974 if(MotherFound){
2975 fMCparticleMother = (AliAODMCParticle*) fMCarray->At(fMCparticle->GetMother());
2976 if( TMath::Abs(pdg) == 11 && fMCparticleMother->GetPdgCode()!=22 ){
2977 if(fIsHFE1) fPt_track_match_num->Fill(fMCparticle->Pt());
2978 }
2979 }
2980 }
2981 }
2982 }///until here
2983
2984
2985
0131ce6c 2986 //----------------------------------------------------------------------------------------
1dd85087 2987 //
2988 //EtaCut electrons histogram
0131ce6c 2989 //Shower Shape Cut
9a1f999b 2990 if(track->Eta()>=fEtaCutMin && track->Eta()<=fEtaCutMax ){
2991
2992 if(fUseShowerShapeCut){
2993 if(M02 >= fM02CutMin && M02<=fM02CutMax && M20>=fM20CutMin && M20<=fM20CutMax){
2994 fEoverP_pt[2]->Fill(fPt,(fClus->E() / fP));
2995 fShowerShapeCut->Fill(M02,M20);
1dd85087 2996 //in order to check if there are exotic cluster in this selected cluster (27 may 2014)
2997 fNcells_energy_elec_selected->Fill(ncells,Energy);
9a1f999b 2998
2999 }
3000
3001 }
3002 if(!fUseShowerShapeCut){
3003 fEoverP_pt[2]->Fill(fPt,(fClus->E() / fP));
3004 fShowerShapeCut->Fill(M02,M20);
1dd85087 3005 fNcells_energy_elec_selected->Fill(ncells,Energy);
3006
9a1f999b 3007
3008 }
3009 if(fUseEMCal) fShowerShape_ele->Fill(M02,M20);
3010
8e2d649d 3011 //for shower shape cut studies - now with TPC PID Cut
9a1f999b 3012 if(fUseEMCal){
3013 fShowerShapeM02_EoverP->Fill(M02,EoverP);
3014 fShowerShapeM20_EoverP->Fill(M20,EoverP);
3015 }
3016
3017 }
3018
0131ce6c 3019 //----------------------------------------------------------------------------------------
9a1f999b 3020
3021
3022
0131ce6c 3023 // for Eta Phi distribution
9a1f999b 3024 fClus->GetPosition(pos3);
3025 TVector3 vpos(pos3[0],pos3[1],pos3[2]);
3026 Double_t cphi = vpos.Phi();
3027 Double_t ceta = vpos.Eta();
3028 fEtaPhi[2]->Fill(cphi,ceta);
3029
3030
3031
3032 fTPCNcls_EoverP[2]->Fill(TPCNcls, EoverP);
3033
2c8e1f6c 3034 for(Int_t i = 0; i < 6; i++)
9a1f999b 3035 {
3036 if(fPt>=fPtBin[i] && fPt<fPtBin[i+1])
3037 {
3038
3039 fR_EoverP[i]->Fill(R, EoverP);
3040 fNcells[i]->Fill(ncells);
3041 fNcells_EoverP[i]->Fill(EoverP, ncells);
3042 fM02_EoverP[i]->Fill(M02,EoverP);
3043 fM20_EoverP[i]->Fill(M20,EoverP);
3044 fECluster_ptbins[i]->Fill(Energy);
3045 fEoverP_ptbins[i]->Fill(EoverP);
3046
3047 if((fClus->E() / fP) >= fEoverPCutMin && (fClus->E() / fP) <= fEoverPCutMax) {
3048 fNcells_electrons[i]->Fill(ncells);
3049 }
3050
3051 if(M02<0.5 && M20<0.3) {
3052 fEoverP_wSSCut[i]->Fill(EoverP);
3053 }
3054 }
3055 }
3056
3057 fNcells_pt->Fill(fPt, ncells);
3058
3059
0131ce6c 3060 ////////////////////////////////////////////////////////////////////
3061 ///EMCal - Efficiency calculations
9a1f999b 3062
0131ce6c 3063
9a1f999b 3064 if(fIsMC && fIsAOD && track->GetLabel()>=0)
3065 {
3066 fMCparticle = (AliAODMCParticle*) fMCarray->At(track->GetLabel());
3067 Int_t pdg = fMCparticle->GetPdgCode();
3068
0131ce6c 3069 //
9a1f999b 3070 if(fMCparticle->IsPhysicalPrimary()){
3071
0131ce6c 3072 //Phi cut && fMCparticle->Phi()>=(TMath::Pi()*80/180) && fMCparticle->Phi()<=TMath::Pi()
3073 if(fMCparticle->Eta()>=fEtaCutMin && fMCparticle->Eta()<=fEtaCutMax ){
9a1f999b 3074
3075 Bool_t MotherFound = FindMother(track->GetLabel());
3076 if(MotherFound){
3077 fMCparticleMother = (AliAODMCParticle*) fMCarray->At(fMCparticle->GetMother());
3078 if( TMath::Abs(pdg) == 11 && fMCparticleMother->GetPdgCode()!=22 ){
0131ce6c 3079 if(fIsHFE1)fPtMC_EMCal_All->Fill(fMCparticle->Pt());
9a1f999b 3080 }
3081 }
3082 }
3083 }
0131ce6c 3084 }
9a1f999b 3085
3086 else if(fIsMC && track->GetLabel()>=0)//ESD
3087 {
3088
3089 if(fMCstack->IsPhysicalPrimary(track->GetLabel()))
3090 {
3091
3092 fMCtrack = fMCstack->Particle(track->GetLabel());
3093
3094 Int_t pdg = fMCtrack->GetPdgCode();
0131ce6c 3095 //Phi cut && fMCtrack->Phi()>=(TMath::Pi()*80/180) && fMCtrack->Phi()<=TMath::Pi()
3096 if(fMCtrack->Eta()>=fEtaCutMin && fMCtrack->Eta()<=fEtaCutMax )
9a1f999b 3097 {
0131ce6c 3098 Bool_t MotherFound = FindMother(track->GetLabel());
3099 //MotherFound included
3100 if(MotherFound){
3101 if(fMCtrack->GetFirstMother()>0){
3102 fMCtrackMother = fMCstack->Particle(fMCtrack->GetFirstMother());
3103 if( TMath::Abs(pdg) == 11 && fMCtrackMother->GetPdgCode()!=22 ){
3104 if(fIsHFE1)fPtMC_EMCal_All->Fill(fMCtrack->Pt());
3105 }
9a1f999b 3106 }
3107 }
3108 }
3109 }
3110 }
3111
aaec953d 3112 //_______________________________________________________
3113 //PID using EMCal
9a1f999b 3114 if((fClus->E() / fP) >= fEoverPCutMin && (fClus->E() / fP) <= fEoverPCutMax)
3115 {
3116
1dd85087 3117
3118 fECluster[2]->Fill(Energy);
3119 fTPCNcls_pid[3]->Fill(TPCNcls, TPCNcls_pid);
3120
0131ce6c 3121
c852fdae 3122 if(fUseEMCal)
3123 {
1dd85087 3124 if(track->Eta()>=fEtaCutMin && track->Eta()<=fEtaCutMax ){
3125 fPtElec_Inc->Fill(fPt);
3126 //eta phi distribution for data
3127 fEtaPhi_data->Fill(track->Phi(),track->Eta());
3128 }
3129
aaec953d 3130 //Eta cut for background
a89620c8 3131 if(fFillBackground){
0131ce6c 3132 fEtad[2]->Fill(track->Eta());
3133
3134 //background for triggered data: trigger electron must have same cuts on shower shape 06/Jan/2014
3135 if(fUseShowerShapeCut){
3136 if(M02 >= fM02CutMin && M02<=fM02CutMax && M20>=fM20CutMin && M20<=fM20CutMax){
3137 if(track->Eta()>=fEtaCutMin && track->Eta()<=fEtaCutMax){
3138 Background(track, iTracks, Vtrack, kFALSE);
3139 }
3140 }
3141 }
3142 else{
3143 if(track->Eta()>=fEtaCutMin && track->Eta()<=fEtaCutMax){
3144 Background(track, iTracks, Vtrack, kFALSE);
3145 }
aaec953d 3146 }
0131ce6c 3147
a89620c8 3148 }
3149
3150 double emctof2 = fClus->GetTOF();
3151 ftimingEle2->Fill(fPt,emctof2);
0131ce6c 3152 //Correlation Analysis
c852fdae 3153 if(fCorrelationFlag)
3154 {
3155 ElectronHadronCorrelation(track, iTracks, Vtrack);
3156 }
3157 }
aaec953d 3158 //_______________________________________________________
9a1f999b 3159
aaec953d 3160 ////////////////////////////////////////////////////////////////////
3161 ///EMCal - efficiency calculations
9a1f999b 3162
3163 if(track->Charge()<0) fCharge_n->Fill(fPt);
3164 if(track->Charge()>0) fCharge_p->Fill(fPt);
3165
3166
aaec953d 3167
3168 if(fIsMC && fIsAOD && track->GetLabel()>=0)//AOD
9a1f999b 3169 {
3170 if(track->Charge()<0) fCharge_n->Fill(fPt);
3171 if(track->Charge()>0) fCharge_p->Fill(fPt);
3172
3173 fMCparticle = (AliAODMCParticle*) fMCarray->At(track->GetLabel());
89f41a30 3174 if(fMCparticle->GetMother()>0) fMCparticleMother = (AliAODMCParticle*) fMCarray->At(fMCparticle->GetMother());
9a1f999b 3175 Int_t pdg = fMCparticle->GetPdgCode();
89f41a30 3176
2235208e 3177 double proX = fMCparticle->Xv();
3178 double proY = fMCparticle->Yv();
3179 double proR = sqrt(pow(proX,2)+pow(proY,2));
3180
9a1f999b 3181
0131ce6c 3182 if(fMCparticle->Eta()>=fEtaCutMin && fMCparticle->Eta()<=fEtaCutMax && fMCparticle->Phi()>=(TMath::Pi()*80/180) && fMCparticle->Phi()<=TMath::Pi() ){
9a1f999b 3183
89f41a30 3184 if( TMath::Abs(pdg) == 11 && fMCparticle->GetMother()>0 ){
3185 Int_t mpdg = fMCparticleMother->GetPdgCode();
67eb14b9 3186 if(TMath::Abs(mpdg) == 221 || TMath::Abs(mpdg) == 22 || TMath::Abs(mpdg) == 111){
2235208e 3187 if(proR<7)fPtMCelectronAfterAll_nonPrimary->Fill(fMCparticle->Pt()); //numerator for the total efficiency, non Primary track
67eb14b9 3188 }
3189 }
2c8e1f6c 3190 if( TMath::Abs(pdg) == 11 && fMCparticle->IsPhysicalPrimary()) fPtMCelectronAfterAll_Primary->Fill(fMCparticle->Pt());
9a1f999b 3191 }
3192
3193
3194 //
3195 if(fMCparticle->IsPhysicalPrimary()){
3196
3197
3198 if(fMCparticle->Eta()>=fEtaCutMin && fMCparticle->Eta()<=fEtaCutMax ){
31185d97 3199
9a1f999b 3200 Bool_t MotherFound = FindMother(track->GetLabel());
3201 if(MotherFound){
0131ce6c 3202
3203 if(!fUseShowerShapeCut){
3204 if(fIsHFE1){
8e2d649d 3205 //Unfolding pt_reco/pt_MC in the efficiency
0131ce6c 3206 fPtMCelectronAfterAll->Fill(fMCparticle->Pt());
8e2d649d 3207 fPtMCelectronAfterAll_unfolding->Fill(track->Pt());
0131ce6c 3208 fEtaPhi_num->Fill(fMCparticle->Phi(),fMCparticle->Eta());
8e2d649d 3209
3210 //new histo to estimate how different is pt reco from pt MC
3211 fpt_reco_pt_MC_num->Fill(track->Pt(),fMCparticle->Pt());
0131ce6c 3212 }//numerator for the total efficiency AOD
9a1f999b 3213 }
0131ce6c 3214 //November 11 for efficiency of triggered data
3215 if(fUseShowerShapeCut){
3216 if(M02 >= fM02CutMin && M02<=fM02CutMax && M20>=fM20CutMin && M20<=fM20CutMax){
3217 if(fIsHFE1){
8e2d649d 3218 //Unfolding pt_reco/pt_MC in the efficiency
0131ce6c 3219 fPtMCelectronAfterAll->Fill(fMCparticle->Pt());
8e2d649d 3220 fPtMCelectronAfterAll_unfolding->Fill(track->Pt());
0131ce6c 3221 fEtaPhi_num->Fill(fMCparticle->Phi(),fMCparticle->Eta());
8e2d649d 3222
3223 //new histo to estimate how different is pt reco from pt MC
3224 fpt_reco_pt_MC_num->Fill(track->Pt(),fMCparticle->Pt());
0131ce6c 3225 }//numerator for the total efficiency AOD
3226 }
3227 }
3228
3229
3230
3231 fMCparticleMother = (AliAODMCParticle*) fMCarray->At(fMCparticle->GetMother());
3232 if( TMath::Abs(pdg) == 11 && fMCparticleMother->GetPdgCode()!=22 ){
3233 if(fIsHFE1)fPtMC_EMCal_Selected->Fill(fMCparticle->Pt());
3234 }
3235 }//if MotherFound
3236 }//eta cut
9a1f999b 3237 }
0131ce6c 3238 }///close AOD
9a1f999b 3239
3240 else if(fIsMC && track->GetLabel()>=0)//ESD
3241 {
3242 if(track->Charge()<0) fCharge_n->Fill(fPt);
3243 if(track->Charge()>0) fCharge_p->Fill(fPt);
3244
3245 fMCtrack = fMCstack->Particle(track->GetLabel());
29881f7b 3246 if(fMCtrack->GetFirstMother()>0)
3247 {
3248 fMCtrackMother = fMCstack->Particle(fMCtrack->GetFirstMother());
3249 }
2235208e 3250 TParticle *particle=fMCstack->Particle(track->GetLabel());
89f41a30 3251
9a1f999b 3252 Int_t pdg = fMCtrack->GetPdgCode();
3253
89f41a30 3254
29881f7b 3255 if(fMCtrack->Eta()>=fEtaCutMin && fMCtrack->Eta()<=fEtaCutMax)
3256 {
3257 if( TMath::Abs(pdg) == 11 && fMCtrack->GetFirstMother()>0 )
3258 {
89f41a30 3259 Int_t mpdg = fMCtrackMother->GetPdgCode();
29881f7b 3260 if(TMath::Abs(mpdg) == 221 || TMath::Abs(mpdg) == 22 || TMath::Abs(mpdg) == 111)
3261 {
2235208e 3262 Double_t proR=particle->R();
29881f7b 3263 if(proR<7)
3264 {
89f41a30 3265 fPtMCelectronAfterAll_nonPrimary->Fill(fMCtrack->Pt()); //numerator for the total efficiency, non Primary track
2235208e 3266 }
89f41a30 3267 }
3268 }
29881f7b 3269 if( TMath::Abs(pdg) == 11 && fMCstack->IsPhysicalPrimary(track->GetLabel()))
3270 {
3271 fPtMCelectronAfterAll_Primary->Fill(fMCtrack->Pt());
3272 }
9a1f999b 3273 }
3274
3275 if(fMCstack->IsPhysicalPrimary(track->GetLabel()))
3276 {
c852fdae 3277 Bool_t MotherFound = FindMother(track->GetLabel());
9a1f999b 3278
c852fdae 3279 if(MotherFound)
3280 {
29881f7b 3281 if(fMCtrack->Eta()>=fEtaCutMin && fMCtrack->Eta()<=fEtaCutMax)
3282 {
31185d97 3283 if(!fUseShowerShapeCut){
0131ce6c 3284 if(fIsHFE1){
3285 fPtMCelectronAfterAll->Fill(fMCtrack->Pt()); //numerator for the total efficiency ESD
3286 fEtaPhi_num->Fill(fMCtrack->Phi(),fMCtrack->Eta());
3287 }
31185d97 3288 }
3289 //November 11 for efficiency of triggered data
3290 if(fUseShowerShapeCut){
3291 if(M02 >= fM02CutMin && M02<=fM02CutMax && M20>=fM20CutMin && M20<=fM20CutMax){
0131ce6c 3292 if(fIsHFE1){
3293 fPtMCelectronAfterAll->Fill(fMCtrack->Pt()); //numerator for the total efficiency ESD
3294 fEtaPhi_num->Fill(fMCtrack->Phi(),fMCtrack->Eta());
3295 }
31185d97 3296 }
3297 }
3298
3299
3300
c852fdae 3301 }
3302 }
9a1f999b 3303
3304
3305
0131ce6c 3306 // Phi cut && fMCtrack->Phi()>=(TMath::Pi()*80/180) && fMCtrack->Phi()<=TMath::Pi()
3307 if(fMCtrack->Eta()>=fEtaCutMin && fMCtrack->Eta()<=fEtaCutMax)
9a1f999b 3308 {
0131ce6c 3309 //included MotherFound
3310
3311 if(MotherFound)
3312 {
3313 if(fMCtrack->GetFirstMother()>0){
3314 fMCtrackMother = fMCstack->Particle(fMCtrack->GetFirstMother());
3315 if( TMath::Abs(pdg) == 11 && fMCtrackMother->GetPdgCode()!=22 ){
9a1f999b 3316
29881f7b 3317 if(fIsHFE1){fPtMC_EMCal_Selected->Fill(fMCtrack->Pt());}
0131ce6c 3318 }
9a1f999b 3319 }
3320 }
3321 }
3322 }
0131ce6c 3323 }//close ESD
3324 ///////////////////////////////////////////////////////////////////
9a1f999b 3325
3326
3327 }
3328 }
c852fdae 3329 }
3330 }
3331
9a1f999b 3332 //______________________________________________________________
3333 // Vertex
c852fdae 3334
3335 fVtxZ[2]->Fill(fZvtx);
8e2d649d 3336 if(iTracks == 0)fNTracks[2]->Fill(fNOtrks);
3337 fNTracks_pt[2]->Fill(fNOtrks, fPt);
3338 fNTracks_eta[2]->Fill(fNOtrks, track->Eta());
3339 fNTracks_phi[2]->Fill(fNOtrks, track->Phi());
c852fdae 3340 fNClusters[2]->Fill(ClsNo);
aaec953d 3341 fTPCNcls_pid[2]->Fill(TPCNcls, TPCNcls_pid);
c852fdae 3342
9a1f999b 3343 //______________________________________________________________
c852fdae 3344
9a1f999b 3345 //_______________________________________________________
3346 //Correlation Analysis
c852fdae 3347 if(!fUseEMCal)
3348 {
3349 fPtElec_Inc->Fill(fPt);
9a1f999b 3350
c852fdae 3351 if(fCorrelationFlag)
3352 {
3353 ElectronHadronCorrelation(track, iTracks, Vtrack);
3354 }
3355 }
9a1f999b 3356 //_______________________________________________________
3357
3358 ///________________________________________________________________________
c852fdae 3359 }
3360
9a1f999b 3361 //__________________________________________________________________
3362 //Event Mixing Analysis
3363 //Filling pool
c852fdae 3364 if(fEventMixingFlag)
3365 {
3366 fPool = fPoolMgr->GetEventPool(fCentrality->GetCentralityPercentile("V0A"), fZvtx); // Get the buffer associated with the current centrality and z-vtx
3367
3368 if(!fPool) AliFatal(Form("No pool found for centrality = %f, zVtx = %f", fCentrality->GetCentralityPercentile("V0A"), fZvtx));
9a1f999b 3369
c852fdae 3370 fPool->UpdatePool(SelectedHadrons()); // fill the tracks in the event buffer. The ownership is handed over to the event mixing class. We are not allowed to delete tracksClone anymore!
9a1f999b 3371
c852fdae 3372
3373 }
3374
9a1f999b 3375 //__________________________________________________________________
c852fdae 3376
3377 delete fListOfmotherkink;
3378 PostData(1, fOutputList);
3379}
3380
9a1f999b 3381 //______________________________________________________________________
c852fdae 3382void AliAnalysisTaskEMCalHFEpA::Terminate(Option_t *)
3383{
9a1f999b 3384 //Draw result to the screen
3385 //Called once at the end of the query
3386
c852fdae 3387 fOutputList = dynamic_cast<TList*> (GetOutputData(1));
3388
3389 if(!fOutputList)
3390 {
3391 printf("ERROR: Output list not available\n");
3392 return;
3393 }
3394}
3395
9a1f999b 3396 //______________________________________________________________________
c852fdae 3397Bool_t AliAnalysisTaskEMCalHFEpA::ProcessCutStep(Int_t cutStep, AliVParticle *track)
3398{
9a1f999b 3399 //Check single track cuts for a given cut step
3400 //Note this function is called inside the UserExec function
c852fdae 3401 const Int_t kMCOffset = AliHFEcuts::kNcutStepsMCTrack;
3402 if(!fCFM->CheckParticleCuts(cutStep + kMCOffset, track)) return kFALSE;
3403 return kTRUE;
3404}
3405
a89620c8 3406
9a1f999b 3407 //______________________________________________________________________
a89620c8 3408
9a4682da 3409
3410void AliAnalysisTaskEMCalHFEpA::Background(AliVTrack *track, Int_t trackIndex, AliVParticle *vtrack, Bool_t IsTPConly)
a89620c8 3411{
8e2d649d 3412 ///_________________________________________________________________
3413 ///MC analysis
1dd85087 3414 //Bool_t IsMCefix=kFALSE; //to make correction on efix, use kTRUE (do not change the efficiency, so I will keep the correction only for d3)
a89620c8 3415
8e2d649d 3416 if(fIsMC)
a89620c8 3417 {
8e2d649d 3418 if(track->GetLabel() < 0)
3419 {
3420 AliWarning(Form("The track %d does not have a valid MC label",trackIndex));
3421 return;
3422 }
a89620c8 3423
8e2d649d 3424 if(fIsAOD)
3425 {
3426 fMCparticle = (AliAODMCParticle*) fMCarray->At(track->GetLabel());
2c8e1f6c 3427
8e2d649d 3428 if(fMCparticle->GetMother()<0) return;
67eb14b9 3429
8e2d649d 3430 fMCparticleMother = (AliAODMCParticle*) fMCarray->At(fMCparticle->GetMother());
3431 if(fMCparticleMother->GetMother()>0)fMCparticleGMother = (AliAODMCParticle*) fMCarray->At(fMCparticleMother->GetMother());
67eb14b9 3432
8e2d649d 3433 if(TMath::Abs(fMCparticle->GetPdgCode())==11 && (TMath::Abs(fMCparticleMother->GetPdgCode())==22 || TMath::Abs(fMCparticleMother->GetPdgCode())==111 || TMath::Abs(fMCparticleMother->GetPdgCode())==221))
3434 {
3435 //Is Background
3436 if(!IsTPConly)fPtBackgroundBeforeReco->Fill(track->Pt());
3437 if(IsTPConly)fPtBackgroundBeforeReco2->Fill(track->Pt());
67eb14b9 3438
3439
8e2d649d 3440 //October 08th weighted histos
3441 if(TMath::Abs(fMCparticleMother->GetPdgCode())==111 || TMath::Abs(fMCparticleMother->GetPdgCode())==221 ){
3442
2c8e1f6c 3443 Double_t mPt=fMCparticleMother->Pt();
8e2d649d 3444 Double_t mweight=1;
3445
8e2d649d 3446
1dd85087 3447 //________________________________________________________________
628d0da7 3448 //correction for d3 based on data
67eb14b9 3449
8e2d649d 3450 if(TMath::Abs(fMCparticleMother->GetPdgCode())==111){
3451 Double_t x=mPt;
1dd85087 3452 mweight=CalculateWeight(111, x);
3453
8e2d649d 3454 }
628d0da7 3455 if(TMath::Abs(fMCparticleMother->GetPdgCode())==221){
3456 Double_t x=mPt;
3457 mweight=CalculateWeight(221, x);
3458
3459 }
2c8e1f6c 3460
1dd85087 3461 //________________________________________________________________
3462
3463 //Histo pT mother versus pT electron
8e2d649d 3464 fpT_m_electron->Fill(mPt, track->Pt());
2c8e1f6c 3465
8e2d649d 3466 if(!IsTPConly)fPtBackgroundBeforeReco_weight->Fill(track->Pt(), 1./mweight);
3467 if(IsTPConly)fPtBackgroundBeforeReco2_weight->Fill(track->Pt(), 1./mweight);
2c8e1f6c 3468 }
2235208e 3469 else if(fMCparticleMother->GetMother()>0 && (TMath::Abs(fMCparticleGMother->GetPdgCode())==111 || TMath::Abs(fMCparticleGMother->GetPdgCode())==221 )){
8e2d649d 3470
2c8e1f6c 3471 Double_t gmPt=fMCparticleGMother->Pt();
8e2d649d 3472 Double_t gmweight=1;
67eb14b9 3473
1dd85087 3474 //________________________________________________________________
3475 //correction for d3 based on data
2235208e 3476
8e2d649d 3477 if(TMath::Abs(fMCparticleGMother->GetPdgCode())==111){
3478 Double_t x=gmPt;
1dd85087 3479 gmweight=CalculateWeight(111, x);
8e2d649d 3480 }
628d0da7 3481 if(TMath::Abs(fMCparticleGMother->GetPdgCode())==221){
3482 Double_t x=gmPt;
3483 gmweight=CalculateWeight(221, x);
3484 }
2c8e1f6c 3485
8e2d649d 3486
1dd85087 3487 //________________________________________________________________
3488 //Histo pT gmother versus pT electron
8e2d649d 3489
8e2d649d 3490 fpT_gm_electron->Fill(gmPt, track->Pt());
2235208e 3491
8e2d649d 3492 if(!IsTPConly)fPtBackgroundBeforeReco_weight->Fill(track->Pt(), 1./gmweight);
3493 if(IsTPConly)fPtBackgroundBeforeReco2_weight->Fill(track->Pt(), 1./gmweight);
2c8e1f6c 3494 }
3495 else{
8e2d649d 3496 if(!IsTPConly)fPtBackgroundBeforeReco_weight->Fill(track->Pt());
3497 if(IsTPConly)fPtBackgroundBeforeReco2_weight->Fill(track->Pt());
2c8e1f6c 3498 }
8e2d649d 3499 }//particle kind
3500 }//IsAOD
3501 //ESD
3502 else
3503 {
3504 fMCtrack = fMCstack->Particle(track->GetLabel());
9a4682da 3505
8e2d649d 3506 if(fMCtrack->GetFirstMother()<0) return;
3507
3508 fMCtrackMother = fMCstack->Particle(fMCtrack->GetFirstMother());
3509
3510 if(TMath::Abs(fMCtrack->GetPdgCode())==11 && (TMath::Abs(fMCtrackMother->GetPdgCode())==22 || TMath::Abs(fMCtrackMother->GetPdgCode())==111 || TMath::Abs(fMCtrackMother->GetPdgCode())==221))
3511 {
3512 //Is Background
3513 if(!IsTPConly)fPtBackgroundBeforeReco->Fill(track->Pt());
3514 if(IsTPConly)fPtBackgroundBeforeReco2->Fill(track->Pt());
3515 }
3516 }
3517 }//IsMC
3518
1dd85087 3519 ///_________________________________________________________________
8e2d649d 3520
1dd85087 3521 //________________________________________________
3522 //Associated particle cut
8e2d649d 3523 fPartnerCuts->SetAcceptKinkDaughters(kFALSE);
3524 fPartnerCuts->SetRequireITSRefit(kTRUE);
3525 fPartnerCuts->SetRequireTPCRefit(kTRUE);
3526 fPartnerCuts->SetEtaRange(-0.9,0.9);
3527 fPartnerCuts->SetMaxChi2PerClusterTPC(4.0);
3528 fPartnerCuts->SetMinNClustersTPC(80);
1dd85087 3529 fPartnerCuts->SetPtRange(0,1e10);
3530 //fPartnerCuts->SetRequireSigmaToVertex(kTRUE);
3531 //fPartnerCuts->SetMaxDCAToVertexXY(1);
3532 //fPartnerCuts->SetMaxDCAToVertexZ(3);
3533 //_________________________________________________
3534
3535 ///#################################################################
3536 //Non-HFE reconstruction
8e2d649d 3537 fNonHFE = new AliSelectNonHFE();
3538 fNonHFE->SetAODanalysis(fIsAOD);
3539 if(fMassCutFlag) fNonHFE->SetInvariantMassCut(fMassCut);
3540 if(fAngleCutFlag) fNonHFE->SetOpeningAngleCut(fAngleCut);
3541 if(fChi2CutFlag) fNonHFE->SetChi2OverNDFCut(fChi2Cut);
3542 if(fDCAcutFlag) fNonHFE->SetDCACut(fDCAcut);
3543 fNonHFE->SetAlgorithm("DCA"); //KF
3544 fNonHFE->SetPIDresponse(fPidResponse);
3545 fNonHFE->SetTrackCuts(-3.5,3.5,fPartnerCuts);
3546 fNonHFE->SetAdditionalCuts(fPtMinAsso,fTpcNclsAsso);
3547
3548 if(!IsTPConly){
3549 fNonHFE->SetHistAngleBack(fOpAngleBack);
3550 fNonHFE->SetHistAngle(fOpAngle);
3551 fNonHFE->SetHistDCABack(fDCABack);
3552 fNonHFE->SetHistDCA(fDCA);
3553 fNonHFE->SetHistMassBack(fInvMassBack);
3554 fNonHFE->SetHistMass(fInvMass);
3555 }
3556 if(IsTPConly){
3557 fNonHFE->SetHistAngleBack(fOpAngleBack2);
3558 fNonHFE->SetHistAngle(fOpAngle2);
3559 fNonHFE->SetHistDCABack(fDCABack2);
3560 fNonHFE->SetHistDCA(fDCA2);
3561 fNonHFE->SetHistMassBack(fInvMassBack2);
3562 fNonHFE->SetHistMass(fInvMass2);
3563 }
3564
3565 fNonHFE->FindNonHFE(trackIndex,vtrack,fVevent);
3566
3567 //index of track selected as partner
3568 Int_t *fUlsPartner = fNonHFE->GetPartnersULS();
3569
3570 //Electron Information
3571 Double_t fPhiE = -999;
3572 Double_t fEtaE = -999;
3573 Double_t fPtE = -999;
3574 fPhiE = track->Phi();
3575 fEtaE = track->Eta();
3576 fPtE = track->Pt();
3577
3578 ///_________________________________________________________________
3579 ///MC analysis
3580 if(fIsMC)
3581 {
3582 if(fIsAOD)
3583 {
3584 if(TMath::Abs(fMCparticle->GetPdgCode())==11 && (TMath::Abs(fMCparticleMother->GetPdgCode())==22 || TMath::Abs(fMCparticleMother->GetPdgCode())==111 || TMath::Abs(fMCparticleMother->GetPdgCode())==221))
3585 {
67eb14b9 3586
8e2d649d 3587 Double_t weight=1;
67eb14b9 3588
8e2d649d 3589 if(!IsTPConly){
3590 if(fNonHFE->IsULS()) fPtElec_ULS->Fill(fPtE,fNonHFE->GetNULS());
3591 if(fNonHFE->IsLS()) fPtElec_LS->Fill(fPtE,fNonHFE->GetNLS());
3592
2c8e1f6c 3593
67eb14b9 3594
8e2d649d 3595
3596 if(TMath::Abs(fMCparticleMother->GetPdgCode())==111 || TMath::Abs(fMCparticleMother->GetPdgCode())==221){
3597 Double_t mPt=fMCparticleMother->Pt();
1dd85087 3598 Double_t mweight1=1;
3599 Double_t mweight2=1;
8e2d649d 3600 //Double_t weight=1;
3601
8e2d649d 3602
8e2d649d 3603 //----------------------------------------------------------------------------
628d0da7 3604 //correction based on data only
8e2d649d 3605 if(TMath::Abs(fMCparticleMother->GetPdgCode())==111){
3606 Double_t x=mPt;
1dd85087 3607 weight=CalculateWeight(111, x);
8e2d649d 3608 }
628d0da7 3609 if(TMath::Abs(fMCparticleMother->GetPdgCode())==221){
3610 Double_t x=mPt;
3611 weight=CalculateWeight(221, x);
3612 }
8e2d649d 3613
1dd85087 3614
8e2d649d 3615 //----------------------------------------------------------------------------
3616
3617 //check this
3618 if(fNonHFE->IsULS()) mweight1=(fNonHFE->GetNULS())/weight;
3619 if(fNonHFE->IsLS()) mweight2=(fNonHFE->GetNLS())/weight;
3620
3621 //fill histos
3622 if(fNonHFE->IsULS())fPtElec_ULS_weight->Fill(fPtE, mweight1);
3623 if(fNonHFE->IsLS())fPtElec_LS_weight->Fill(fPtE, mweight2);
3624 }
3625 else if(fMCparticleMother->GetMother()>0 && (TMath::Abs(fMCparticleGMother->GetPdgCode())==111 || TMath::Abs(fMCparticleGMother->GetPdgCode())==221 )){
3626 Double_t gmPt=fMCparticleGMother->Pt();
1dd85087 3627 Double_t gmweight1=1;
3628 Double_t gmweight2=1;
8e2d649d 3629 //Double_t weight=1;
3630
1dd85087 3631 //----------------------------------------------------------------------------
3632
3633 //----------------------------------------------------------------------------
3634
3635 //correction based on data only for pi0
8e2d649d 3636
8e2d649d 3637 if(TMath::Abs(fMCparticleGMother->GetPdgCode())==111){
3638 Double_t x=gmPt;
1dd85087 3639 weight=CalculateWeight(111, x);
8e2d649d 3640 }
628d0da7 3641 if(TMath::Abs(fMCparticleGMother->GetPdgCode())==221){
3642 Double_t x=gmPt;
3643 weight=CalculateWeight(221, x);
3644 }
1dd85087 3645
8e2d649d 3646
3647
3648
3649
3650 //check this
3651 if(fNonHFE->IsULS()) gmweight1=(fNonHFE->GetNULS())/weight;
3652 if(fNonHFE->IsLS()) gmweight2=(fNonHFE->GetNLS())/weight;
3653
3654 //fill histos
3655 if(fNonHFE->IsULS())fPtElec_ULS_weight->Fill(fPtE, gmweight1);
3656 if(fNonHFE->IsLS())fPtElec_LS_weight->Fill(fPtE, gmweight2);
3657 }
3658 else{
3659 if(fNonHFE->IsULS()) fPtElec_ULS_weight->Fill(fPtE,fNonHFE->GetNULS());
3660 if(fNonHFE->IsLS()) fPtElec_LS_weight->Fill(fPtE,fNonHFE->GetNLS());
67eb14b9 3661 }
2235208e 3662
67eb14b9 3663
8e2d649d 3664 }//!IsTPConly
3665
3666 if(IsTPConly){
3667 if(fNonHFE->IsULS()) fPtElec_ULS2->Fill(fPtE,fNonHFE->GetNULS());
3668 if(fNonHFE->IsLS()) fPtElec_LS2->Fill(fPtE,fNonHFE->GetNLS());
67eb14b9 3669
8e2d649d 3670 //new 08 October //weighted histograms
3671 if(TMath::Abs(fMCparticleMother->GetPdgCode())==111 || TMath::Abs(fMCparticleMother->GetPdgCode())==221){
3672 Double_t mPt=fMCparticleMother->Pt();
3673
1dd85087 3674 Double_t mweight1=1;
3675 Double_t mweight2=1;
8e2d649d 3676 //Double_t weight=1;
3677
8e2d649d 3678
8e2d649d 3679 //----------------------------------------------------------------------------
3680
628d0da7 3681 //correction based on data for d3
1dd85087 3682
8e2d649d 3683 if(TMath::Abs(fMCparticleMother->GetPdgCode())==111){
3684 Double_t x=mPt;
1dd85087 3685 weight=CalculateWeight(111, x);
3686
8e2d649d 3687 }
628d0da7 3688 if(TMath::Abs(fMCparticleMother->GetPdgCode())==221){
3689 Double_t x=mPt;
3690 weight=CalculateWeight(221, x);
3691
3692 }
1dd85087 3693
8e2d649d 3694
3695 //check this
3696 if(fNonHFE->IsULS()) mweight1=(fNonHFE->GetNULS())/weight;
3697 if(fNonHFE->IsLS()) mweight2=(fNonHFE->GetNLS())/weight;
3698
3699 //fill histos
3700 if(fNonHFE->IsULS())fPtElec_ULS2_weight->Fill(fPtE, mweight1);
3701 if(fNonHFE->IsLS())fPtElec_LS2_weight->Fill(fPtE, mweight2);
3702 }
3703 else if(fMCparticleMother->GetMother()>0 && (TMath::Abs(fMCparticleGMother->GetPdgCode())==111 || TMath::Abs(fMCparticleGMother->GetPdgCode())==221 )){
3704 Double_t gmPt=fMCparticleGMother->Pt();
3705 Double_t gmweight1=1;
3706 Double_t gmweight2=1;
3707 //Double_t weight=1;
3708
3709
1dd85087 3710 //----------------------------------------------------------------------------
8e2d649d 3711 //correction based on data only for pi0
1dd85087 3712
8e2d649d 3713 if(TMath::Abs(fMCparticleGMother->GetPdgCode())==111){
3714 Double_t x=gmPt;
1dd85087 3715 weight=CalculateWeight(111, x);
628d0da7 3716 }
3717
3718
3719 if(TMath::Abs(fMCparticleGMother->GetPdgCode())==221){
3720 Double_t x=gmPt;
3721 weight=CalculateWeight(221, x);
8e2d649d 3722 }
1dd85087 3723
8e2d649d 3724 //----------------------------------------------------------------------------
3725
3726
3727
3728 //check this
3729 if(fNonHFE->IsULS()) gmweight1=(fNonHFE->GetNULS())/weight;
3730 if(fNonHFE->IsLS()) gmweight2=(fNonHFE->GetNLS())/weight;
3731
3732 //fill histos
3733 if(fNonHFE->IsULS())fPtElec_ULS2_weight->Fill(fPtE, gmweight1);
3734 if(fNonHFE->IsLS())fPtElec_LS2_weight->Fill(fPtE, gmweight2);
3735 }
3736 else{
3737 if(fNonHFE->IsULS()) fPtElec_ULS2_weight->Fill(fPtE,fNonHFE->GetNULS());
3738 if(fNonHFE->IsLS()) fPtElec_LS2_weight->Fill(fPtE,fNonHFE->GetNLS());
67eb14b9 3739 }
67eb14b9 3740
1dd85087 3741
3742 //----------------------------------------------------------------------------
3743 //to check other way to calculate efficiency
3744 //ULS with no weight from ULS-LS original
3745 //we have to know if track2 comes from same mother!!!
3746 //----------------------------------------------------------------------------
8e2d649d 3747 if(fNonHFE->IsULS()){
3748
3749 for(Int_t iTracks = 0; iTracks < fVevent->GetNumberOfTracks(); iTracks++)
3750 {
3751
3752 AliVParticle* Vtrack2 = fVevent->GetTrack(iTracks);
3753 if (!Vtrack2)
3754 {
3755 printf("ERROR: Could not receive track %d\n", iTracks);
3756 continue;
3757 }
3758 AliVTrack *track2 = dynamic_cast<AliVTrack*>(Vtrack2);
3759 if(track2->GetLabel()<0) continue;
3760 fMCparticle2 = (AliAODMCParticle*) fMCarray->At(track2->GetLabel());
3761 if(fMCparticle2->GetMother()<0) continue;
3762
3763 for(Int_t i = 0; i < fNonHFE->GetNULS(); i++)
3764 {
3765 if(fUlsPartner[i]==iTracks){
3766 //only fill if it has same mother
1dd85087 3767 //with weight to take into account the number of partners
3768 if(fMCparticle2->GetMother()==fMCparticle->GetMother()) fPtElec_ULS_MC->Fill(fPtE, fNonHFE->GetNULS());
8e2d649d 3769
3770 //-----------------------------------------------------------------------------------------------------------
3771 //weight for mother
1dd85087 3772 //Double_t weight2=1;
8e2d649d 3773 Double_t mPt=fMCparticleMother->Pt();
3774
3775
3776 if(TMath::Abs(fMCparticleMother->GetPdgCode())==111){
3777 Double_t x=mPt;
1dd85087 3778 weight=CalculateWeight(111, x);
3779
8e2d649d 3780
628d0da7 3781 }
3782 if(TMath::Abs(fMCparticleMother->GetPdgCode())==221){
3783 Double_t x=mPt;
3784 weight=CalculateWeight(221, x);
3785
3786
8e2d649d 3787 }
1dd85087 3788
3789 //weight for grandmother
628d0da7 3790
3791 if((fMCparticleMother->GetMother()>0) && TMath::Abs(((fMCparticleGMother->GetPdgCode())==111))){
3792 Double_t gmPt=fMCparticleGMother->Pt();
8e2d649d 3793 Double_t x=gmPt;
1dd85087 3794 weight=CalculateWeight(111, x);
3795
8e2d649d 3796 }
628d0da7 3797 if((fMCparticleMother->GetMother()>0) && TMath::Abs(((fMCparticleGMother->GetPdgCode())==221))){
3798 Double_t gmPt=fMCparticleGMother->Pt();
3799 Double_t x=gmPt;
3800 weight=CalculateWeight(221, x);
3801
3802 }
8e2d649d 3803
8e2d649d 3804
1dd85087 3805 if(fMCparticle2->GetMother()==fMCparticle->GetMother()) fPtElec_ULS_MC_weight->Fill(fPtE, (fNonHFE->GetNULS())*1./weight);
3806
3807 //-----------------------------------------------------------------------------------------------------------
3808 //end of weight
8e2d649d 3809
3810 }//partner found same as track
3811 }//loop in all partner
3812
3813 }//track
3814 }//is ULS
1dd85087 3815 //----------------------------------------------------------------------------
3816 //end of part to check other way to calculate efficiency
3817 //----------------------------------------------------------------------------
2c8e1f6c 3818
8e2d649d 3819 }//IsTPConly
2c8e1f6c 3820
8e2d649d 3821 }//particle kind
2235208e 3822
8e2d649d 3823 if(IsTPConly){
3824 //ULS-LS with no pid AOD
3825 if(fNonHFE->IsULS()) fPtElec_ULS_NoPid->Fill(fPtE,fNonHFE->GetNULS());
3826 if(fNonHFE->IsLS()) fPtElec_LS_NoPid->Fill(fPtE,fNonHFE->GetNLS());
9a4682da 3827 }
3828
8e2d649d 3829 }//close IsAOD
3830 //It is ESD
3831 else
3832 {
3833 if(TMath::Abs(fMCtrack->GetPdgCode())==11 && (TMath::Abs(fMCtrackMother->GetPdgCode())==22 || TMath::Abs(fMCtrackMother->GetPdgCode())==111 || TMath::Abs(fMCtrackMother->GetPdgCode())==221))
3834 {
3835 if(!IsTPConly){
3836 if(fNonHFE->IsULS()) fPtElec_ULS->Fill(fPtE,fNonHFE->GetNULS());
3837 if(fNonHFE->IsLS()) fPtElec_LS->Fill(fPtE,fNonHFE->GetNLS());
3838 }
3839
3840 if(IsTPConly){
3841 if(fNonHFE->IsULS()) fPtElec_ULS2->Fill(fPtE,fNonHFE->GetNULS());
3842 if(fNonHFE->IsLS()) fPtElec_LS2->Fill(fPtE,fNonHFE->GetNLS());
3843 }
9a4682da 3844 }
8e2d649d 3845
3846
3847 }
3848 }//close IsMC
3849 ///_________________________________________________________________
3850 //not MC
3851 else
3852 {
3853 if(!IsTPConly){
3854 if(fNonHFE->IsULS()) fPtElec_ULS->Fill(fPtE,fNonHFE->GetNULS());
3855 if(fNonHFE->IsLS()) fPtElec_LS->Fill(fPtE,fNonHFE->GetNLS());
3856 }
3857
3858 if(IsTPConly){
3859 if(fNonHFE->IsULS()) fPtElec_ULS2->Fill(fPtE,fNonHFE->GetNULS());
3860 if(fNonHFE->IsLS()) fPtElec_LS2->Fill(fPtE,fNonHFE->GetNLS());
a89620c8 3861 }
9a4682da 3862 }
3863
8e2d649d 3864
3865
3866}//end of Background function
a89620c8 3867
9a1f999b 3868 //______________________________________________________________________
c852fdae 3869void AliAnalysisTaskEMCalHFEpA::ElectronHadronCorrelation(AliVTrack *track, Int_t trackIndex, AliVParticle *vtrack)
3870{
a89620c8 3871
8e2d649d 3872 ///_________________________________________________________________
3873 ///MC analysis
c852fdae 3874 if(fIsMC)
3875 {
9a1f999b 3876 if(track->GetLabel() < 0)
c852fdae 3877 {
9a1f999b 3878 AliWarning(Form("The track %d does not have a valid MC label",trackIndex));
3879 return;
c852fdae 3880 }
9a1f999b 3881
c852fdae 3882 if(fIsAOD)
3883 {
3884 fMCparticle = (AliAODMCParticle*) fMCarray->At(track->GetLabel());
3885
3886 if(fMCparticle->GetMother()<0) return;
3887
3888 fMCparticleMother = (AliAODMCParticle*) fMCarray->At(fMCparticle->GetMother());
3889
3890 if(TMath::Abs(fMCparticle->GetPdgCode())==11 && (TMath::Abs(fMCparticleMother->GetPdgCode())==22 || TMath::Abs(fMCparticleMother->GetPdgCode())==111 || TMath::Abs(fMCparticleMother->GetPdgCode())==221))
3891 {
9a1f999b 3892 //Is Background
c852fdae 3893 fPtBackgroundBeforeReco->Fill(track->Pt());
3894 }
3895 }
3896 else
3897 {
3898 fMCtrack = fMCstack->Particle(track->GetLabel());
3899
3900 if(fMCtrack->GetFirstMother()<0) return;
3901
3902 fMCtrackMother = fMCstack->Particle(fMCtrack->GetFirstMother());
3903
3904 if(TMath::Abs(fMCtrack->GetPdgCode())==11 && (TMath::Abs(fMCtrackMother->GetPdgCode())==22 || TMath::Abs(fMCtrackMother->GetPdgCode())==111 || TMath::Abs(fMCtrackMother->GetPdgCode())==221))
3905 {
9a1f999b 3906 //Is Background
c852fdae 3907 fPtBackgroundBeforeReco->Fill(track->Pt());
3908 }
3909 }
3910 }
9a1f999b 3911 ///_________________________________________________________________
c852fdae 3912
9a1f999b 3913 //________________________________________________
3914 //Associated particle cut
c852fdae 3915 fPartnerCuts->SetAcceptKinkDaughters(kFALSE);
3916 fPartnerCuts->SetRequireITSRefit(kTRUE);
3917 fPartnerCuts->SetRequireTPCRefit(kTRUE);
3918 fPartnerCuts->SetEtaRange(-0.9,0.9);
3919 fPartnerCuts->SetMaxChi2PerClusterTPC(4.0);
3920 fPartnerCuts->SetMinNClustersTPC(80);
3921 fPartnerCuts->SetPtRange(0.3,1e10);
9a1f999b 3922 //fPartnerCuts->SetRequireSigmaToVertex(kTRUE);
3923 //fPartnerCuts->SetMaxDCAToVertexXY(1);
3924 //fPartnerCuts->SetMaxDCAToVertexZ(3);
3925 //_________________________________________________
c852fdae 3926
9a1f999b 3927 ///#################################################################
3928 //Non-HFE reconstruction
c852fdae 3929 fNonHFE = new AliSelectNonHFE();
3930 fNonHFE->SetAODanalysis(fIsAOD);
3931 if(fMassCutFlag) fNonHFE->SetInvariantMassCut(fMassCut);
3932 if(fAngleCutFlag) fNonHFE->SetOpeningAngleCut(fAngleCut);
3933 if(fChi2CutFlag) fNonHFE->SetChi2OverNDFCut(fChi2Cut);
3934 if(fDCAcutFlag) fNonHFE->SetDCACut(fDCAcut);
3935 fNonHFE->SetAlgorithm("DCA"); //KF
3936 fNonHFE->SetPIDresponse(fPidResponse);
3937 fNonHFE->SetTrackCuts(-3.5,3.5,fPartnerCuts);
9a1f999b 3938 fNonHFE->SetAdditionalCuts(fPtMinAsso,fTpcNclsAsso);
9a4682da 3939
c852fdae 3940
3941 fNonHFE->SetHistAngleBack(fOpAngleBack);
3942 fNonHFE->SetHistAngle(fOpAngle);
3943 fNonHFE->SetHistDCABack(fDCABack);
3944 fNonHFE->SetHistDCA(fDCA);
3945 fNonHFE->SetHistMassBack(fInvMassBack);
3946 fNonHFE->SetHistMass(fInvMass);
3947
3948 fNonHFE->FindNonHFE(trackIndex,vtrack,fVevent);
3949
3950 Int_t *fUlsPartner = fNonHFE->GetPartnersULS();
3951 Int_t *fLsPartner = fNonHFE->GetPartnersLS();
3952 Bool_t fUlsIsPartner = kFALSE;
3953 Bool_t fLsIsPartner = kFALSE;
9a1f999b 3954 ///#################################################################
c852fdae 3955
a89620c8 3956
9a1f999b 3957 //Electron Information
c852fdae 3958 Double_t fPhiE = -999;
3959 Double_t fEtaE = -999;
3960 Double_t fPhiH = -999;
3961 Double_t fEtaH = -999;
3962 Double_t fDphi = -999;
3963 Double_t fDeta = -999;
3964 Double_t fPtE = -999;
3965 Double_t fPtH = -999;
3966
3967 Double_t pi = TMath::Pi();
3968
3969 fPhiE = track->Phi();
3970 fEtaE = track->Eta();
3971 fPtE = track->Pt();
3972
a89620c8 3973
9a1f999b 3974 ///_________________________________________________________________
3975 ///MC analysis
c852fdae 3976 if(fIsMC)
3977 {
3978 if(fIsAOD)
3979 {
3980 if(TMath::Abs(fMCparticle->GetPdgCode())==11 && (TMath::Abs(fMCparticleMother->GetPdgCode())==22 || TMath::Abs(fMCparticleMother->GetPdgCode())==111 || TMath::Abs(fMCparticleMother->GetPdgCode())==221))
3981 {
3982 if(fNonHFE->IsULS()) fPtElec_ULS->Fill(fPtE,fNonHFE->GetNULS());
3983 if(fNonHFE->IsLS()) fPtElec_LS->Fill(fPtE,fNonHFE->GetNLS());
8e2d649d 3984
3985
c852fdae 3986 }
8e2d649d 3987
3988 if(fNonHFE->IsULS()) fPtElec_ULS_NoPid->Fill(fPtE,fNonHFE->GetNULS());
3989 if(fNonHFE->IsLS()) fPtElec_LS_NoPid->Fill(fPtE,fNonHFE->GetNLS());
c852fdae 3990 }
3991 else
3992 {
3993 if(TMath::Abs(fMCtrack->GetPdgCode())==11 && (TMath::Abs(fMCtrackMother->GetPdgCode())==22 || TMath::Abs(fMCtrackMother->GetPdgCode())==111 || TMath::Abs(fMCtrackMother->GetPdgCode())==221))
3994 {
3995 if(fNonHFE->IsULS()) fPtElec_ULS->Fill(fPtE,fNonHFE->GetNULS());
3996 if(fNonHFE->IsLS()) fPtElec_LS->Fill(fPtE,fNonHFE->GetNLS());
8e2d649d 3997
c852fdae 3998 }
8e2d649d 3999
4000
c852fdae 4001 }
4002 }
9a1f999b 4003 ///_________________________________________________________________
c852fdae 4004 else
4005 {
4006 if(fNonHFE->IsULS()) fPtElec_ULS->Fill(fPtE,fNonHFE->GetNULS());
4007 if(fNonHFE->IsLS()) fPtElec_LS->Fill(fPtE,fNonHFE->GetNLS());
4008 }
a89620c8 4009
4010
4011
9a1f999b 4012
4013 //__________________________________________________________________
4014 //Event Mixing Analysis - Hadron Loop
4015 //Retrieve
c852fdae 4016 if(fEventMixingFlag)
4017 {
4018 fPool = fPoolMgr->GetEventPool(fCentrality->GetCentralityPercentile("V0A"), fZvtx); // Get the buffer associated with the current centrality and z-vtx
4019
4020 if(!fPool) AliFatal(Form("No pool found for centrality = %f, zVtx = %f",fCentrality->GetCentralityPercentile("V0A"), fZvtx));
4021
4022 if(fPool->GetCurrentNEvents() >= 5) // start mixing when 5 events are in the buffer
4023 {
4024 fPoolNevents->Fill(fPool->GetCurrentNEvents());
4025
4026 for (Int_t jMix = 0; jMix < fPool->GetCurrentNEvents(); jMix++) // mix with each event in the buffer
4027 {
4028 TObjArray* bgTracks = fPool->GetEvent(jMix);
4029
4030 for (Int_t kMix = 0; kMix < bgTracks->GetEntriesFast(); kMix++) // mix with each track in the event
4031 {
4032 const AliEHCParticle* MixedTrack(dynamic_cast<AliEHCParticle*>(bgTracks->At(kMix)));
4033 if (NULL == MixedTrack) continue;
4034
4035 fPhiH = MixedTrack->Phi();
4036 fEtaH = MixedTrack->Eta();
4037 fPtH = MixedTrack->Pt();
4038
0131ce6c 4039 if(fPtH<fAssHadronPtMin || fPtH>fAssHadronPtMax) continue;
9a1f999b 4040
c852fdae 4041 fDphi = fPhiE - fPhiH;
9a1f999b 4042
c852fdae 4043 if (fDphi > 3*pi/2) fDphi = fDphi - 2*pi;
4044 if (fDphi < -pi/2) fDphi = fDphi + 2*pi;
9a1f999b 4045
c852fdae 4046 fDeta = fEtaE - fEtaH;
9a1f999b 4047
2c8e1f6c 4048 Double_t fPtBin[7] = {1,2,4,6,8,10,15};
c852fdae 4049
2c8e1f6c 4050 for(Int_t i = 0; i < 6; i++)
c852fdae 4051 {
4052 if(fPtE>=fPtBin[i] && fPtE<fPtBin[i+1])
4053 {
4054 fCEtaPhi_Inc_EM[i]->Fill(fDphi,fDeta);
4055
4056 if(fNonHFE->IsULS()) fCEtaPhi_ULS_EM[i]->Fill(fDphi,fDeta);
4057 if(fNonHFE->IsLS()) fCEtaPhi_LS_EM[i]->Fill(fDphi,fDeta);
4058
4059 if(fNonHFE->IsULS()) fCEtaPhi_ULS_Weight_EM[i]->Fill(fDphi,fDeta,fNonHFE->GetNULS());
4060 if(fNonHFE->IsLS()) fCEtaPhi_LS_Weight_EM[i]->Fill(fDphi,fDeta,fNonHFE->GetNLS());
4061 }
4062 }
4063
9a1f999b 4064 // TODO your code: do event mixing with current event and bgTracks
4065 // note that usually the content filled now is weighted by 1 / pool->GetCurrentNEvents()
c852fdae 4066 }
4067 }
4068 }
4069 }
9a1f999b 4070 //__________________________________________________________________
c852fdae 4071
9a1f999b 4072 //__________________________________________________________________
4073 //Same Event Analysis - Hadron Loop
c852fdae 4074 for(Int_t iTracks = 0; iTracks < fVevent->GetNumberOfTracks(); iTracks++)
4075 {
4076 if(trackIndex==iTracks) continue;
4077
4078 AliVParticle* Vtrack2 = fVevent->GetTrack(iTracks);
4079 if (!Vtrack2)
4080 {
4081 printf("ERROR: Could not receive track %d\n", iTracks);
4082 continue;
4083 }
9a1f999b 4084
c852fdae 4085 AliVTrack *track2 = dynamic_cast<AliVTrack*>(Vtrack2);
4086
0131ce6c 4087 if(track2->Eta()<fEtaCutMin || track2->Eta()>fEtaCutMax ) continue;
4088
9a1f999b 4089 if(fIsAOD)
4090 {
c852fdae 4091 AliAODTrack *atrack2 = dynamic_cast<AliAODTrack*>(Vtrack2);
4092 if(!atrack2->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
4093 if((!(atrack2->GetStatus()&AliESDtrack::kITSrefit)|| (!(atrack2->GetStatus()&AliESDtrack::kTPCrefit)))) continue;
4094 if(atrack2->GetTPCNcls() < 80) continue;
2c8e1f6c 4095 if(fAssocWithSPD && ((!(atrack2->HasPointOnITSLayer(0))) && (!(atrack2->HasPointOnITSLayer(1))))) continue;
c852fdae 4096 }
4097 else
4098 {
4099 AliESDtrack *etrack2 = dynamic_cast<AliESDtrack*>(Vtrack2);
4100 if(!fPartnerCuts->AcceptTrack(etrack2)) continue;
4101 }
4102
4103 fPhiH = track2->Phi();
4104 fEtaH = track2->Eta();
4105 fPtH = track2->Pt();
4106
0131ce6c 4107 if(fPtH<fAssHadronPtMin || fPtH>fAssHadronPtMax) continue;
c852fdae 4108
4109 fDphi = fPhiE - fPhiH;
9a1f999b 4110
c852fdae 4111 if (fDphi > 3*pi/2) fDphi = fDphi - 2*pi;
4112 if (fDphi < -pi/2) fDphi = fDphi + 2*pi;
9a1f999b 4113
c852fdae 4114 fDeta = fEtaE - fEtaH;
9a1f999b 4115
2c8e1f6c 4116 Double_t fPtBin[7] = {1,2,4,6,8,10,15};
c852fdae 4117
8e2d649d 4118 //______________________________________________________________
4119 //Check if this track is a Non-HFE partner
9a1f999b 4120 for(Int_t i = 0; i < fNonHFE->GetNULS(); i++)
4121 {
4122 if(fUlsPartner[i]==iTracks) fUlsIsPartner=kTRUE;
4123 }
4124 for(Int_t i = 0; i < fNonHFE->GetNLS(); i++)
4125 {
4126 if(fLsPartner[i]==iTracks) fLsIsPartner=kTRUE;
4127 }
8e2d649d 4128 //______________________________________________________________
c852fdae 4129
2c8e1f6c 4130 for(Int_t i = 0; i < 6; i++)
9a1f999b 4131 {
c852fdae 4132 if(fPtE>=fPtBin[i] && fPtE<fPtBin[i+1])
4133 {
4134 fCEtaPhi_Inc[i]->Fill(fDphi,fDeta);
4135
4136 if(fNonHFE->IsULS()) fCEtaPhi_ULS[i]->Fill(fDphi,fDeta);
4137 if(fNonHFE->IsLS()) fCEtaPhi_LS[i]->Fill(fDphi,fDeta);
4138 if(fNonHFE->IsULS() && !fUlsIsPartner) fCEtaPhi_ULS_NoP[i]->Fill(fDphi,fDeta);
4139 if(fNonHFE->IsLS() && !fLsIsPartner) fCEtaPhi_LS_NoP[i]->Fill(fDphi,fDeta);
4140
4141 if(fNonHFE->IsULS()) fCEtaPhi_ULS_Weight[i]->Fill(fDphi,fDeta,fNonHFE->GetNULS());
4142 if(fNonHFE->IsLS()) fCEtaPhi_LS_Weight[i]->Fill(fDphi,fDeta,fNonHFE->GetNLS());
4143 if(fNonHFE->IsULS() && !fUlsIsPartner) fCEtaPhi_ULS_NoP_Weight[i]->Fill(fDphi,fDeta,fNonHFE->GetNULS());
4144 if(fNonHFE->IsLS() && !fLsIsPartner) fCEtaPhi_LS_NoP_Weight[i]->Fill(fDphi,fDeta,fNonHFE->GetNLS());
4145 }
9a1f999b 4146 }
c852fdae 4147 }
4148}
4149
9a1f999b 4150 //____________________________________________________________________________________________________________
4151 //Create a TObjArray with selected hadrons, for the mixed event analysis
c852fdae 4152TObjArray* AliAnalysisTaskEMCalHFEpA::SelectedHadrons()
4153{
4154 fTracksClone = new TObjArray;
4155 fTracksClone->SetOwner(kTRUE);
4156
4157 for(Int_t iTracks = 0; iTracks < fVevent->GetNumberOfTracks(); iTracks++)
4158 {
4159 AliVParticle* Vtrack2 = fVevent->GetTrack(iTracks);
4160 if (!Vtrack2)
4161 {
4162 printf("ERROR: Could not receive track %d\n", iTracks);
4163 continue;
4164 }
9a1f999b 4165
c852fdae 4166 AliVTrack *track2 = dynamic_cast<AliVTrack*>(Vtrack2);
4167
0131ce6c 4168 if(track2->Eta()<fEtaCutMin || track2->Eta()>fEtaCutMax ) continue;
4169
9a1f999b 4170 if(fIsAOD)
4171 {
c852fdae 4172 AliAODTrack *atrack2 = dynamic_cast<AliAODTrack*>(Vtrack2);
4173 if(!atrack2->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
4174 if((!(atrack2->GetStatus()&AliESDtrack::kITSrefit)|| (!(atrack2->GetStatus()&AliESDtrack::kTPCrefit)))) continue;
4175 if(atrack2->GetTPCNcls() < 80) continue;
2c8e1f6c 4176 if(fAssocWithSPD && ((!(atrack2->HasPointOnITSLayer(0))) && (!(atrack2->HasPointOnITSLayer(1))))) continue;
c852fdae 4177 }
4178 else
4179 {
4180 AliESDtrack *etrack2 = dynamic_cast<AliESDtrack*>(Vtrack2);
4181 if(!fPartnerCuts->AcceptTrack(etrack2)) continue;
4182 }
9a1f999b 4183
c852fdae 4184 fTracksClone->Add(new AliEHCParticle(track2->Eta(), track2->Phi(), track2->Pt()));
4185 }
4186 return fTracksClone;
4187}
9a1f999b 4188 //____________________________________________________________________________________________________________
c852fdae 4189
9a1f999b 4190 //______________________________________________________________________
c852fdae 4191void AliAnalysisTaskEMCalHFEpA::DiHadronCorrelation(AliVTrack *track, Int_t trackIndex)
4192{
9a1f999b 4193 //________________________________________________
4194 //Associated particle cut
c852fdae 4195 fPartnerCuts->SetAcceptKinkDaughters(kFALSE);
4196 fPartnerCuts->SetRequireITSRefit(kTRUE);
4197 fPartnerCuts->SetRequireTPCRefit(kTRUE);
4198 fPartnerCuts->SetEtaRange(-0.9,0.9);
4199 fPartnerCuts->SetMaxChi2PerClusterTPC(4.0);
4200 fPartnerCuts->SetMinNClustersTPC(80);
4201 fPartnerCuts->SetPtRange(0.3,1e10);
9a1f999b 4202 //fPartnerCuts->SetRequireSigmaToVertex(kTRUE);
4203 //fPartnerCuts->SetMaxDCAToVertexXY(1);
4204 //fPartnerCuts->SetMaxDCAToVertexZ(3);
4205 //_________________________________________________
c852fdae 4206
9a1f999b 4207 //Electron Information
c852fdae 4208 Double_t fPhiE = -999;
4209 Double_t fEtaE = -999;
4210 Double_t fPhiH = -999;
4211 Double_t fEtaH = -999;
4212 Double_t fDphi = -999;
4213 Double_t fDeta = -999;
4214 Double_t fPtE = -999;
4215 Double_t fPtH = -999;
4216
4217 Double_t pi = TMath::Pi();
4218
4219 fPhiE = track->Phi();
4220 fEtaE = track->Eta();
4221 fPtE = track->Pt();
4222
9a1f999b 4223 //__________________________________________________________________
4224 //Same Event Analysis - Hadron Loop
c852fdae 4225 for(Int_t iTracks = 0; iTracks < fVevent->GetNumberOfTracks(); iTracks++)
4226 {
4227 if(trackIndex==iTracks) continue;
4228
4229 AliVParticle* Vtrack2 = fVevent->GetTrack(iTracks);
4230 if (!Vtrack2)
4231 {
4232 printf("ERROR: Could not receive track %d\n", iTracks);
4233 continue;
4234 }
9a1f999b 4235
c852fdae 4236 AliVTrack *track2 = dynamic_cast<AliVTrack*>(Vtrack2);
0131ce6c 4237 if(track2->Eta()<fEtaCutMin || track2->Eta()>fEtaCutMax ) continue;
c852fdae 4238
9a1f999b 4239 if(fIsAOD)
4240 {
c852fdae 4241 AliAODTrack *atrack2 = dynamic_cast<AliAODTrack*>(Vtrack2);
4242 if(!atrack2->TestFilterMask(AliAODTrack::kTrkTPCOnly)) continue;
4243 if((!(atrack2->GetStatus()&AliESDtrack::kITSrefit)|| (!(atrack2->GetStatus()&AliESDtrack::kTPCrefit)))) continue;
4244 if(atrack2->GetTPCNcls() < 80) continue;
2c8e1f6c 4245 if(fAssocWithSPD && ((!(atrack2->HasPointOnITSLayer(0))) && (!(atrack2->HasPointOnITSLayer(1))))) continue;
c852fdae 4246 }
4247 else
4248 {
4249 AliESDtrack *etrack2 = dynamic_cast<AliESDtrack*>(Vtrack2);
4250 if(!fPartnerCuts->AcceptTrack(etrack2)) continue;
4251 }
4252
4253 fPhiH = track2->Phi();
4254 fEtaH = track2->Eta();
4255 fPtH = track2->Pt();
4256
0131ce6c 4257 if(fPtH<fAssHadronPtMin || fPtH>fAssHadronPtMax) continue;
c852fdae 4258
4259 fDphi = fPhiE - fPhiH;
9a1f999b 4260
c852fdae 4261 if (fDphi > 3*pi/2) fDphi = fDphi - 2*pi;
4262 if (fDphi < -pi/2) fDphi = fDphi + 2*pi;
9a1f999b 4263
c852fdae 4264 fDeta = fEtaE - fEtaH;
9a1f999b 4265
2c8e1f6c 4266 Double_t fPtBin[7] = {1,2,4,6,8,10,15};
c852fdae 4267
2c8e1f6c 4268 for(Int_t i = 0; i < 6; i++)
9a1f999b 4269 {
c852fdae 4270 if(fPtE>=fPtBin[i] && fPtE<fPtBin[i+1])
4271 {
4272 fCEtaPhi_Inc_DiHadron[i]->Fill(fDphi,fDeta);
4273 }
9a1f999b 4274 }
c852fdae 4275 }
4276}
9a1f999b 4277 //____________________________________________________________________________________________________________
c852fdae 4278
9a1f999b 4279 //______________________________________________________________________
c852fdae 4280Bool_t AliAnalysisTaskEMCalHFEpA::FindMother(Int_t mcIndex)
4281{
4282 fIsHFE1 = kFALSE;
4283 fIsHFE2 = kFALSE;
4284 fIsNonHFE = kFALSE;
4285 fIsFromD = kFALSE;
4286 fIsFromB = kFALSE;
4287 fIsFromPi0 = kFALSE;
4288 fIsFromEta = kFALSE;
4289 fIsFromGamma = kFALSE;
4290
4291 if(mcIndex < 0 || !fIsMC)
4292 {
4293 return kFALSE;
4294 }
4295
4296 Int_t pdg = -99999;
4297 Int_t mpdg = -99999;
4298 Int_t gmpdg = -99999;
4299 Int_t ggmpdg = -99999;
4300 Int_t gggmpdg = -99999;
4301
4302 if(fIsAOD)
4303 {
4304 fMCparticle = (AliAODMCParticle*) fMCarray->At(mcIndex);
9a1f999b 4305
c852fdae 4306 pdg = TMath::Abs(fMCparticle->GetPdgCode());
4307
4308
4309 if(pdg!=11)
4310 {
4311 fIsHFE1 = kFALSE;
4312 fIsHFE2 = kFALSE;
4313 fIsNonHFE = kFALSE;
4314 fIsFromD = kFALSE;
4315 fIsFromB = kFALSE;
4316 fIsFromPi0 = kFALSE;
4317 fIsFromEta = kFALSE;
4318 fIsFromGamma = kFALSE;
4319 return kFALSE;
4320 }
4321
4322 if(fMCparticle->GetMother()<0)
4323 {
4324 fIsHFE1 = kFALSE;
4325 fIsHFE2 = kFALSE;
4326 fIsNonHFE = kFALSE;
4327 fIsFromD = kFALSE;
4328 fIsFromB = kFALSE;
4329 fIsFromPi0 = kFALSE;
4330 fIsFromEta = kFALSE;
4331 fIsFromGamma = kFALSE;
4332 return kFALSE;
4333 }
4334
4335 fMCparticleMother = (AliAODMCParticle*) fMCarray->At(fMCparticle->GetMother());
4336 mpdg = TMath::Abs(fMCparticleMother->GetPdgCode());
4337
4338 if(fMCparticleMother->GetMother()<0)
4339 {
4340 gmpdg = 0;
4341 ggmpdg = 0;
4342 gggmpdg = 0;
4343 }
4344 else
4345 {
4346 fMCparticleGMother = (AliAODMCParticle*) fMCarray->At(fMCparticleMother->GetMother());
4347 gmpdg = TMath::Abs(fMCparticleGMother->GetPdgCode());
4348 if(fMCparticleGMother->GetMother()<0)
4349 {
4350 ggmpdg = 0;
4351 gggmpdg = 0;
4352 }
4353 else
4354 {
4355 fMCparticleGGMother = (AliAODMCParticle*) fMCarray->At(fMCparticleGMother->GetMother());
4356 ggmpdg = TMath::Abs(fMCparticleGGMother->GetPdgCode());
4357 if(fMCparticleGGMother->GetMother()<0)
4358 {
4359 gggmpdg = 0;
4360 }
4361 else
4362 {
4363 fMCparticleGGGMother = (AliAODMCParticle*) fMCarray->At(fMCparticleGGMother->GetMother());
4364 gggmpdg = TMath::Abs(fMCparticleGGGMother->GetPdgCode());
4365 }
4366 }
4367 }
4368 }
4369 else
4370 {
4371 fMCtrack = fMCstack->Particle(mcIndex);
9a1f999b 4372
c852fdae 4373 pdg = TMath::Abs(fMCtrack->GetPdgCode());
4374
4375 if(pdg!=11)
4376 {
4377 fIsHFE1 = kFALSE;
4378 fIsHFE2 = kFALSE;
4379 fIsNonHFE = kFALSE;
4380 fIsFromD = kFALSE;
4381 fIsFromB = kFALSE;
4382 fIsFromPi0 = kFALSE;
4383 fIsFromEta = kFALSE;
4384 fIsFromGamma = kFALSE;
4385 return kFALSE;
4386 }
4387
4388 if(fMCtrack->GetFirstMother()<0)
4389 {
4390 fIsHFE1 = kFALSE;
4391 fIsHFE2 = kFALSE;
4392 fIsNonHFE = kFALSE;
4393 fIsFromD = kFALSE;
4394 fIsFromB = kFALSE;
4395 fIsFromPi0 = kFALSE;
4396 fIsFromEta = kFALSE;
4397 fIsFromGamma = kFALSE;
4398 return kFALSE;
4399 }
4400
4401 fMCtrackMother = fMCstack->Particle(fMCtrack->GetFirstMother());
4402 mpdg = TMath::Abs(fMCtrackMother->GetPdgCode());
4403
4404 if(fMCtrackMother->GetFirstMother()<0)
4405 {
4406 gmpdg = 0;
4407 ggmpdg = 0;
4408 gggmpdg = 0;
4409 }
4410 else
4411 {
4412 fMCtrackGMother = fMCstack->Particle(fMCtrackMother->GetFirstMother());
4413 gmpdg = TMath::Abs(fMCtrackGMother->GetPdgCode());
4414
4415 if(fMCtrackGMother->GetFirstMother()<0)
4416 {
4417 ggmpdg = 0;
4418 gggmpdg = 0;
4419 }
4420 else
4421 {
4422 fMCtrackGGMother = fMCstack->Particle(fMCtrackGMother->GetFirstMother());
4423 ggmpdg = TMath::Abs(fMCtrackGGMother->GetPdgCode());
9a1f999b 4424
c852fdae 4425 if(fMCtrackGGMother->GetFirstMother()<0)
4426 {
4427 gggmpdg = 0;
4428 }
4429 else
4430 {
4431 fMCtrackGGGMother = fMCstack->Particle(fMCtrackGGMother->GetFirstMother());
4432 gggmpdg = TMath::Abs(fMCtrackGGGMother->GetPdgCode());
4433 }
4434 }
4435 }
4436 }
4437
4438 //Tag Electron Source
4439 if(mpdg==111 || mpdg==221 || mpdg==22)
4440 {
4441 fIsHFE1 = kFALSE;
4442 fIsHFE2 = kFALSE;
4443 fIsNonHFE = kTRUE;
4444 fIsFromD = kFALSE;
4445 fIsFromB = kFALSE;
4446
4447 fIsFromPi0 = kFALSE;
4448 fIsFromEta = kFALSE;
4449 fIsFromGamma = kFALSE;
4450
4451 if(mpdg==111) fIsFromPi0 = kFALSE;
4452 if(mpdg==221)fIsFromEta = kFALSE;
4453 if(mpdg==22) fIsFromGamma = kFALSE;
4454
4455 return kTRUE;
4456 }
4457 else
4458 {
4459 fIsHFE1 = kFALSE;
4460 fIsHFE2 = kTRUE;
4461
4462 fIsFromPi0 = kFALSE;
4463 fIsFromEta = kFALSE;
4464 fIsFromGamma = kFALSE;
4465
4466 fIsNonHFE = kFALSE;
4467
4468 fIsFromD = kFALSE;
4469 fIsFromB = kFALSE;
4470
4471 if(mpdg>400 && mpdg<500)
4472 {
4473 if((gmpdg>500 && gmpdg<600) || (ggmpdg>500 && ggmpdg<600) || (gggmpdg>500 && gggmpdg<600))
4474 {
4475 fIsHFE1 = kTRUE;
4476 fIsFromD = kFALSE;
4477 fIsFromB = kTRUE;
4478 return kTRUE;
4479 }
4480 else
4481 {
4482 fIsHFE1 = kTRUE;
4483 fIsFromD = kTRUE;
4484 fIsFromB = kFALSE;
4485 return kTRUE;
4486 }
4487 }
4488 else if(mpdg>500 && mpdg<600)
4489 {
4490 fIsHFE1 = kTRUE;
4491 fIsFromD = kFALSE;
4492 fIsFromB = kTRUE;
4493 return kTRUE;
4494 }
4495 else
4496 {
4497 fIsHFE1 = kFALSE;
4498 fIsFromD = kFALSE;
4499 fIsFromB = kFALSE;
4500 return kFALSE;
4501 }
4502 }
4503}
1dd85087 4504/*
4505Bool_t AliAnalysisTaskEMCalHFEpA::ContainsBadChannel(TString calorimeter,UShort_t* cellList, Int_t nCells)
4506{
4507 // Check that in the cluster cells, there is no bad channel of those stored
4508 // in fEMCALBadChannelMap
4509 // adapted from AliCalorimeterUtils
4510
4511 //if (!fRemoveBadChannels) return kFALSE;
4512 //printf("fEMCALBadChannelMap %p, fPHOSBadChannelMap %p \n",fEMCALBadChannelMap,fPHOSBadChannelMap);
4513 if( !fEMCALRecoUtils->GetEMCALChannelStatusMap(0)) return kFALSE;
4514
4515 //Int_t icol = -1;
4516 //Int_t irow = -1;
4517 //Int_t imod = -1;
4518 for(Int_t iCell = 0; iCell<nCells; iCell++){
4519
4520 //Get the column and row
4521 if(calorimeter == "EMCAL"){
4522 return fEMCALRecoUtils->ClusterContainsBadChannel((AliEMCALGeometry*)fEMCALGeo,cellList,nCells);
4523 }
4524 else return kFALSE;
4525
4526 }// cell cluster loop
4527
4528 return kFALSE;
4529
4530}
4531*/
4532/*
4533
4534//________________________________________________________________________________
4535TArrayI AliAnalysisTaskEMCalHFEpA::GetTriggerPatches(Bool_t IsEventEMCALL0, Bool_t IsEventEMCALL1)
4536{
4537 // Select the patches that triggered
4538 // Depend on L0 or L1
4539
4540 // some variables
4541 //Int_t trigtimes[30], globCol, globRow,ntimes, i;
4542 Int_t globCol, globRow;
4543
4544 Int_t absId = -1; //[100];
4545 Int_t nPatch = 0;
4546
4547 TArrayI patches(0);
4548
4549 // get object pointer
4550 AliVCaloTrigger *caloTrigger = InputEvent()->GetCaloTrigger( "EMCAL" );
4551
4552 // class is not empty
4553 if( caloTrigger->GetEntries() > 0 )
4554 {
4555 // must reset before usage, or the class will fail
4556 caloTrigger->Reset();
4557
4558 // go throuth the trigger channels
4559 while( caloTrigger->Next() )
4560 {
4561 // get position in global 2x2 tower coordinates
4562 caloTrigger->GetPosition( globCol, globRow );
4563
4564 //L0
4565 if(IsEventEMCALL0)
4566 {
4567 //not implemented
4568 }
4569
4570
4571 else if(IsEventEMCALL1) // L1
4572 {
4573 Int_t bit = 0;
4574 caloTrigger->GetTriggerBits(bit);
4575
4576 Bool_t isEGA = ((bit >> fBitEGA) & 0x1);
4577 //Bool_t isEJE = ((bit >> fBitEJE) & 0x1) && IsEventEMCALL1Jet () ;
4578
4579 if(!isEGA) continue;
4580
4581 Int_t patchsize = -1;
4582 if(isEGA) patchsize = 2;
4583 //else if (isEJE) patchsize = 16;
4584
4585 // add 2x2 (EGA) or 16x16 (EJE) patches
4586 for(Int_t irow=0; irow < patchsize; irow++)
4587 {
4588 for(Int_t icol=0; icol < patchsize; icol++)
4589 {
4590 GetCaloUtils()->GetEMCALGeometry()->GetAbsFastORIndexFromPositionInEMCAL(globCol+icol,globRow+irow, absId);
4591 //printf("pass the time cut globCol %d, globRow %d absId %d\n",globCol,globRow, absIDTrig[nTrig]);
4592 patches.Set(nPatch+1); // Set size of this array to nPatch+1 ints.
4593 patches.AddAt(absId,nPatch++); //Add Int_t absId at position nPatch++
4594 }
4595 }
4596
4597 } // L1
4598
4599 } // trigger iterator
4600 } // go thorough triggers
4601
4602 printf("N patches %d, test %d,first %d, last %d\n",patches.GetSize(), nPatch, patches.At(0), patches.At(patches.GetSize()-1));
4603
4604 return patches;
4605}
4606 */
4607Double_t AliAnalysisTaskEMCalHFEpA::CalculateWeight(Int_t pdg_particle, Double_t x)
4608{
4609 //weight for d3 based on MinJung parametrization //sent by Jan
4610 Double_t weight=1;
4611 if(pdg_particle==111){
29881f7b 4612 if(x>= 0.100000 && x < 0.112797 ) weight=1.262120;
4613 if(x>= 0.112797 && x < 0.127231 ) weight=1.277765;
4614 if(x>= 0.127231 && x < 0.143512 ) weight=1.295605;
4615 if(x>= 0.143512 && x < 0.161877 ) weight=1.318155;
4616 if(x>= 0.161877 && x < 0.182592 ) weight=1.348693;
4617 if(x>= 0.182592 && x < 0.205957 ) weight=1.388636;
4618 if(x>= 0.205957 && x < 0.232313 ) weight=1.439122;
4619 if(x>= 0.232313 && x < 0.262041 ) weight=1.497452;
4620 if(x>= 0.262041 && x < 0.295573 ) weight=1.559409;
4621 if(x>= 0.295573 && x < 0.333397 ) weight=1.615169;
4622 if(x>= 0.333397 && x < 0.376060 ) weight=1.654954;
4623 if(x>= 0.376060 && x < 0.424183 ) weight=1.668753;
4624 if(x>= 0.424183 && x < 0.478465 ) weight=1.652225;
4625 if(x>= 0.478465 && x < 0.539692 ) weight=1.603119;
4626 if(x>= 0.539692 && x < 0.608754 ) weight=1.526049;
4627 if(x>= 0.608754 && x < 0.686654 ) weight=1.426724;
4628 if(x>= 0.686654 && x < 0.774523 ) weight=1.312684;
4629 if(x>= 0.774523 && x < 0.873636 ) weight=1.195395;
4630 if(x>= 0.873636 && x < 0.985432 ) weight=1.086264;
4631 if(x>= 0.985432 && x < 1.111534 ) weight=0.993666;
4632 if(x>= 1.111534 && x < 1.253773 ) weight=0.922587;
4633 if(x>= 1.253773 && x < 1.414214 ) weight=0.875739;
4634 if(x>= 1.414214 && x < 1.595185 ) weight=0.852181;
4635 if(x>= 1.595185 && x < 1.799315 ) weight=0.847828;
4636 if(x>= 1.799315 && x < 2.029567 ) weight=0.863875;
4637 if(x>= 2.029567 && x < 2.289283 ) weight=0.899112;
4638 if(x>= 2.289283 && x < 2.582235 ) weight=0.955194;
4639 if(x>= 2.582235 && x < 2.912674 ) weight=1.033824;
4640 if(x>= 2.912674 && x < 3.285398 ) weight=1.133714;
4641 if(x>= 3.285398 && x < 3.705818 ) weight=1.259471;
4642 if(x>= 3.705818 && x < 4.180038 ) weight=1.406883;
4643 if(x>= 4.180038 && x < 4.714942 ) weight=1.578923;
4644 if(x>= 4.714942 && x < 5.318296 ) weight=1.778513;
4645 if(x>= 5.318296 && x < 5.998859 ) weight=2.001171;
4646 if(x>= 5.998859 && x < 6.766511 ) weight=2.223161;
4647 if(x>= 6.766511 && x < 7.632396 ) weight=2.449445;
4648 if(x>= 7.632396 && x < 8.609086 ) weight=2.661734;
4649 if(x>= 8.609086 && x < 9.710759 ) weight=2.851935;
4650 if(x>= 9.710759 && x < 10.953409 ) weight=2.974319;
4651 if(x>= 10.953409 && x < 12.355077 ) weight=3.106314;
4652 if(x>= 12.355077 && x < 13.936111 ) weight=3.126815;
4653 if(x>= 13.936111 && x < 15.719464 ) weight=3.150053;
4654 if(x>= 15.719464 && x < 17.731026 ) weight=3.218509;
4655 if(x>= 17.731026 && x < 20.000000 ) weight=3.252141;
1dd85087 4656
4657 }
4658 else if(pdg_particle==221){
628d0da7 4659 if(x>= 0.100000 && x < 0.112797 ) weight=2.159358;
4660 if(x>= 0.112797 && x < 0.127231 ) weight=2.145546;
4661 if(x>= 0.127231 && x < 0.143512 ) weight=2.132390;
4662 if(x>= 0.143512 && x < 0.161877 ) weight=2.109918;
4663 if(x>= 0.161877 && x < 0.182592 ) weight=2.084920;
4664 if(x>= 0.182592 && x < 0.205957 ) weight=2.054302;
4665 if(x>= 0.205957 && x < 0.232313 ) weight=2.015202;
4666 if(x>= 0.232313 && x < 0.262041 ) weight=1.966068;
4667 if(x>= 0.262041 && x < 0.295573 ) weight=1.912255;
4668 if(x>= 0.295573 && x < 0.333397 ) weight=1.844087;
4669 if(x>= 0.333397 && x < 0.376060 ) weight=1.767913;
4670 if(x>= 0.376060 && x < 0.424183 ) weight=1.680366;
4671 if(x>= 0.424183 && x < 0.478465 ) weight=1.583468;
4672 if(x>= 0.478465 && x < 0.539692 ) weight=1.475131;
4673 if(x>= 0.539692 && x < 0.608754 ) weight=1.361436;
4674 if(x>= 0.608754 && x < 0.686654 ) weight=1.244388;
4675 if(x>= 0.686654 && x < 0.774523 ) weight=1.125973;
4676 if(x>= 0.774523 && x < 0.873636 ) weight=1.015769;
4677 if(x>= 0.873636 && x < 0.985432 ) weight=0.914579;
4678 if(x>= 0.985432 && x < 1.111534 ) weight=0.830529;
4679 if(x>= 1.111534 && x < 1.253773 ) weight=0.766397;
4680 if(x>= 1.253773 && x < 1.414214 ) weight=0.723663;
4681 if(x>= 1.414214 && x < 1.595185 ) weight=0.701236;
4682 if(x>= 1.595185 && x < 1.799315 ) weight=0.695605;
4683 if(x>= 1.799315 && x < 2.029567 ) weight=0.707578;
4684 if(x>= 2.029567 && x < 2.289283 ) weight=0.735194;
4685 if(x>= 2.289283 && x < 2.582235 ) weight=0.781052;
4686 if(x>= 2.582235 && x < 2.912674 ) weight=0.842350;
4687 if(x>= 2.912674 && x < 3.285398 ) weight=0.923676;
4688 if(x>= 3.285398 && x < 3.705818 ) weight=1.028317;
4689 if(x>= 3.705818 && x < 4.180038 ) weight=1.154029;
4690 if(x>= 4.180038 && x < 4.714942 ) weight=1.296915;
4691 if(x>= 4.714942 && x < 5.318296 ) weight=1.463674;
4692 if(x>= 5.318296 && x < 5.998859 ) weight=1.651985;
4693 if(x>= 5.998859 && x < 6.766511 ) weight=1.847912;
4694 if(x>= 6.766511 && x < 7.632396 ) weight=2.066284;
4695 if(x>= 7.632396 && x < 8.609086 ) weight=2.202231;
4696 if(x>= 8.609086 && x < 9.710759 ) weight=2.399942;
4697 if(x>= 9.710759 && x < 10.953409 ) weight=2.555106;
4698 if(x>= 10.953409 && x < 12.355077 ) weight=2.632377;
4699 if(x>= 12.355077 && x < 13.936111 ) weight=2.609660;
4700 if(x>= 13.936111 && x < 15.719464 ) weight=2.656343;
4701 if(x>= 15.719464 && x < 17.731026 ) weight=2.615438;
4702 if(x>= 17.731026 && x < 20.000000 ) weight=2.576269;
4703
1dd85087 4704 }
4705 else weight=1;
4706
4707 return weight;
4708
4709}
4710
4711
4712
4713