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