AliPhysics  2b88e80 (2b88e80)
AliAnalysisTaskGammaConvDalitzV1.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: Pedro Gonzalez, Pedro Ladron de Guevara, Ernesto Lopez Torres, *
5  * Eulogio Serradilla, Ana Marin, Friederike Bock *
6  * Version 2 *
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 
17 // Analysis task for pi0->e+e-gamma (Dalitz decay)
18 // Analysis task for chic->JPsi+gamma
19 
20 #include <vector>
21 
22 #include "TParticle.h"
23 #include "TPDGCode.h"
24 #include "TMCProcess.h"
25 #include "TDatabasePDG.h"
26 #include "TList.h"
27 #include "TChain.h"
28 #include "TDirectory.h"
29 #include "TTree.h"
30 #include "TH1.h"
31 #include "TH1F.h"
32 #include "THnSparse.h"
33 #include "TH2F.h"
34 #include "AliAnalysisManager.h"
35 #include "AliESDInputHandler.h"
36 #include "AliESDtrack.h"
37 #include "AliMCEvent.h"
38 #include "AliMCEventHandler.h"
39 #include "AliPID.h"
40 #include "AliLog.h"
41 #include "AliESDtrackCuts.h"
42 #include "AliESDpidCuts.h"
43 #include "AliMCEvent.h"
44 #include "AliESDv0.h"
45 #include "AliESDEvent.h"
46 #include "AliESDpid.h"
47 #include "AliKFParticle.h"
48 #include "AliMCEventHandler.h"
49 #include "AliKFVertex.h"
50 #include "AliTriggerAnalysis.h"
51 #include "AliCentrality.h"
52 #include "AliMultiplicity.h"
54 #include "AliEventplane.h"
55 #include <vector>
56 
57 
59 
60 //-----------------------------------------------------------------------------------------------
62  fV0Reader(NULL),
63  fV0ReaderName("V0ReaderV1"),
64  fElecSelector(NULL),
65  fBGHandler(NULL),
66  fESDEvent(NULL),
67  fMCEvent(NULL),
68  fCutFolder(NULL),
69  fESDList(NULL),
70  fBackList(NULL),
71  fMotherList(NULL),
72  fTrueList(NULL),
73  fMCList(NULL),
74  fQAFolder(NULL),
75  fOutputContainer(0),
76  fReaderGammas(NULL),
77  fSelectorElectronIndex(0),
78  fSelectorPositronIndex(0),
79  fGoodGammas(NULL),
80  fGoodVirtualGammas(NULL),
81  fGoodElectrons(NULL),
82  fGoodPositrons(NULL),
83  fCutEventArray(NULL),
84  fCutGammaArray(NULL),
85  fCutElectronArray(NULL),
86  fCutMesonArray(NULL),
87  fEventCuts(NULL),
88  fConversionCuts(NULL),
89  hESDConvGammaPt(NULL),
90  hESDConvGammaEta(NULL),
91  //hESDConvGammaZR(NULL),
92  sESDConvGammaZR(NULL),
93  sESDConvGammaXY(NULL),
94  hESDDalitzElectronPt(NULL),
95  hESDDalitzPositronPt(NULL),
96  hESDDalitzElectronPhi(NULL),
97  hESDDalitzPositronPhi(NULL),
98  hESDDalitzElectronAfterPt(NULL),
99  hESDDalitzPositronAfterPt(NULL),
100  hESDDalitzElectronAfterEta(NULL),
101  hESDDalitzElectronAfterEtaPCut(NULL),
102  hESDDalitzPositronAfterEta(NULL),
103  hESDDalitzPositronAfterEtaPCut(NULL),
104  hESDDalitzElectronAfterPhi(NULL),
105  hESDDalitzPositronAfterPhi(NULL),
106  hESDDalitzElectronAfterNClsITS(NULL),
107  hESDDalitzElectronAfterNClsITSPCut(NULL),
108  hESDDalitzPositronAfterNClsITS(NULL),
109  hESDDalitzPositronAfterNClsITSPCut(NULL),
110  hESDDalitzElectronAfterNFindClsTPC(NULL),
111  hESDDalitzElectronAfterNFindClsTPCPCut(NULL),
112  hESDDalitzPositronAfterNFindClsTPC(NULL),
113  hESDDalitzPositronAfterNFindClsTPCPCut(NULL),
114  hESDDalitzElectronAfterNClsTPC(NULL),
115  hESDDalitzElectronAfterNClsTPCPCut(NULL),
116  hESDDalitzPositronAfterNClsTPC(NULL),
117  hESDDalitzPositronAfterNClsTPCPCut(NULL),
118  hESDDalitzElectronAfterNCrossedRowsTPC(NULL),
119  hESDDalitzElectronAfterNCrossedRowsTPCPCut(NULL),
120  hESDDalitzPositronAfterNCrossedRowsTPC(NULL),
121  hESDDalitzPositronAfterNCrossedRowsTPCPCut(NULL),
122  hESDDalitzPosEleAfterDCAxy(NULL),
123  hESDDalitzPosEleAfterDCAz(NULL),
124  hESDDalitzElectronAfterTPCdEdxVsP(NULL),
125  hESDDalitzPositronAfterTPCdEdxVsP(NULL),
126  hESDDalitzElectronAfterTPCdEdxSignalVsP(NULL),
127  hESDDalitzPositronAfterTPCdEdxSignalVsP(NULL),
128  hESDDalitzElectronAfterTPCdEdxVsEta(NULL),
129  hESDDalitzPositronAfterTPCdEdxVsEta(NULL),
130  hESDDalitzElectronAfterTPCdEdxVsPhi(NULL),
131  hESDDalitzPositronAfterTPCdEdxVsPhi(NULL),
132  hESDEposEnegPsiPairDPhi(NULL),
133  hESDEposEnegPsiPairEta(NULL),
134  hESDEposEnegDPhiEta(NULL),
135  hESDEposEnegInvMassPt(NULL),
136  hESDTruePi0EposEnegInvMassPi0Pt(NULL),
137  hESDEposEnegLikeSignBackInvMassPt(NULL),
138  hESDMotherInvMassPt(NULL),
139  hESDPi0MotherInvMassPt(NULL),
140  hESDPi0MotherDiffInvMassPt(NULL),
141  hESDPi0MotherDiffLimInvMassPt(NULL),
142  hESDEposEnegInvMassPi0MotherPt(NULL),
143  hESDMotherInvMassOpeningAngleGammaElectron(NULL),
144  sESDMotherInvMassPtZM(NULL),
145  hESDMotherBackInvMassPt(NULL),
146  sESDMotherBackInvMassPtZM(NULL),
147  hESDMotherPi0PtY(NULL),
148  hESDMotherPi0PtAlpha(NULL),
149  hESDMotherPi0PtOpenAngle(NULL),
150  sESDMotherDalitzPlot(NULL),
151  hMCAllGammaPt(NULL),
152  hMCAllGammaPi0Pt(NULL),
153  hMCConvGammaPt(NULL),
154  hMCConvGammaPtR(NULL),
155  hMCConvGammaRSPt(NULL),
156  hMCConvGammaPi0Pt(NULL),
157  hMCAllPositronsPt(NULL),
158  hMCDecayPositronPi0Pt(NULL),
159  hMCAllElectronsPt(NULL),
160  hMCDecayElectronPi0Pt(NULL),
161  hMCConvGammaEta(NULL),
162  hMCConvGammaR(NULL),
163  hMCAllPositronsEta(NULL),
164  hMCAllElectronsEta(NULL),
165  hMCPi0DalitzGammaPt(NULL),
166  hMCPi0DalitzElectronPt(NULL),
167  hMCPi0DalitzPositronPt(NULL),
168  hMCPi0Pt(NULL),
169  hMCPi0WOWeightPt(NULL),
170  hMCPi0GGPt(NULL),
171  hMCEtaPt(NULL),
172  hMCEtaGGPt(NULL),
173  hMCPi0InAccPt(NULL),
174  hMCPi0WOWeightInAccPt(NULL),
175  hMCPi0InAccOpeningAngleGammaElectron(NULL),
176  sMCPi0DalitzPlot(NULL),
177  hMCEtaInAccPt(NULL),
178  hMCChiCPt(NULL),
179  hMCChiCInAccPt(NULL),
180  hMCPi0EposEnegInvMassPt(NULL),
181  hMCEtaEposEnegInvMassPt(NULL),
182  hESDEposEnegTruePi0DalitzInvMassPt(NULL),
183  hESDEposEnegTruePrimPi0DalitzInvMass(NULL),
184  hESDEposEnegTruePi0DalitzPsiPairDPhi(NULL),
185  hESDEposEnegTruePi0DalitzPsiPairMC(NULL),
186  hESDEposEnegTruePi0DalitzPsiPairEta(NULL),
187  hESDEposEnegTruePi0DalitzDPhiEta(NULL),
188  hESDEposEnegTrueEtaDalitzInvMassPt(NULL),
189  hESDEposEnegTruePrimEtaDalitzInvMass(NULL),
190  hESDEposEnegTrueEtaDalitzPsiPairDPhi(NULL),
191  hESDEposEnegTruePhotonInvMassPt(NULL),
192  hESDEposEnegTrueInvMassPt(NULL),
193  hESDEposEnegTrueMotherInvMassPt(NULL),
194  hESDEposEnegTruePhotonPsiPairDPhi(NULL),
195  hESDEposEnegTruePhotonPsiPairDPhiPtCut(NULL),
196  hESDEposEnegTrueJPsiInvMassPt(NULL),
197  hESDTrueMotherChiCInvMassPt(NULL),
198  hESDTrueMotherChiCDiffInvMassPt(NULL),
199  hESDTrueMotherInvMassPt(NULL),
200  hESDTrueMotherW0WeightsInvMassPt(NULL),
201  hESDTrueMotherDalitzInvMassPt(NULL),
202  hESDTrueMotherPi0GGInvMassPt(NULL),
203  hESDTrueMotherPi0GGW0WeightsInvMassPt(NULL),
204  hESDTruePi0PtY(NULL),
205  hESDTruePi0PtAlpha(NULL),
206  hESDTruePi0PtOpenAngle(NULL),
207  sESDTruePi0DalitzPlot(NULL),
208  hESDTruePrimaryMotherPi0GGInvMassPt(NULL),
209  hESDTrueSecondaryMotherPi0GGInvMassPt(NULL),
210  hESDTruePrimaryMotherInvMassMCPt(NULL),
211  hESDTruePrimaryMotherInvMassPt(NULL),
212  hESDTruePrimaryMotherW0WeightingInvMassPt(NULL),
213  hESDTruePrimaryPi0DalitzESDPtMCPt(NULL),
214  hESDTrueSecondaryMotherInvMassPt(NULL),
215  hESDTrueSecondaryMotherFromK0sInvMassPt(NULL),
216  hESDTrueBckGGInvMassPt(NULL),
217  hESDTrueBckContInvMassPt(NULL),
218  hESDTrueMotherGGInvMassPt(NULL),
219  hESDTrueConvGammaPt(NULL),
220  hESDTrueConvGammaPtMC(NULL),
221  hESDTrueConvGammaR(NULL),
222  hESDTrueConvGammaRMC(NULL),
223  hESDTruePositronPt(NULL),
224  hESDTrueElectronPt(NULL),
225  hESDTrueSecConvGammaPt(NULL),
226  hESDTrueSecPositronPt(NULL),
227  hESDTrueSecElectronPt(NULL),
228  hESDTruePi0DalitzConvGammaPt(NULL),
229  hESDTruePi0DalitzConvGammaR(NULL),
230  hESDTruePi0DalitzPositronPt(NULL),
231  hESDTruePi0DalitzPositronPtMB(NULL),
232  hESDTruePi0DalitzElectronPt(NULL),
233  hESDTruePi0DalitzElectronPtMB(NULL),
234  hESDTruePi0DalitzSecConvGammaPt(NULL),
235  hESDTruePi0DalitzSecPositronPt(NULL),
236  hESDTruePi0DalitzSecElectronPt(NULL),
237  hNEvents(NULL),
238  hNGoodESDTracks(NULL),
239  hNGoodESDTracksVsNGoodGammas(NULL),
240  hNGoodESDTracksVsNGoodVGammas(NULL),
241  fHistoSPDClusterTrackletBackground(NULL),
242  hNV0Tracks(NULL),
243  hEtaShift(NULL),
244  fHistoDoubleCountTruePi0InvMassPt(NULL),
245  fHistoDoubleCountTrueEtaInvMassPt(NULL),
246  fHistoDoubleCountTrueConvGammaRPt(NULL),
247  fVectorDoubleCountTruePi0s(0),
248  fVectorDoubleCountTrueEtas(0),
249  fVectorDoubleCountTrueConvGammas(0),
250  fRandom(0),
251  fEventPlaneAngle(-100),
252  fUnsmearedPx(NULL),
253  fUnsmearedPy(NULL),
254  fUnsmearedPz(NULL),
255  fUnsmearedE(NULL),
256  fUnsmearedVPx(NULL),
257  fUnsmearedVPy(NULL),
258  fUnsmearedVPz(NULL),
259  fUnsmearedVE(NULL),
260  fnCuts(0),
261  fiCut(0),
262  fNumberOfESDTracks(0),
263  fNumberOfESDTrackskBoth(0),
264  fNVirtualGammas(0),
265  fMoveParticleAccordingToVertex(kFALSE),
266  fIsHeavyIon(0),
267  fDoMesonAnalysis(kTRUE),
268  fDoChicAnalysis(kFALSE),
269  fDoMesonQA(0),
270  fSetProductionVertextoVGamma(kTRUE),
271  fIsFromMBHeader(kTRUE),
272  fIsMC(kFALSE),
273  fDoTHnSparse(kTRUE),
274  fDoHistoDalitzMassLog(kFALSE),
275  fDoMaterialBudgetWeightingOfGammasForTrueMesons(kFALSE)
276 {
277 
278 }
279 
280 //-----------------------------------------------------------------------------------------------
282  AliAnalysisTaskSE(name),
283  fV0Reader(NULL),
284  fV0ReaderName("V0ReaderV1"),
285  fElecSelector(NULL),
286  fBGHandler(NULL),
287  fESDEvent(NULL),
288  fMCEvent(NULL),
289  fCutFolder(NULL),
290  fESDList(NULL),
291  fBackList(NULL),
292  fMotherList(NULL),
293  fTrueList(NULL),
294  fMCList(NULL),
295  fQAFolder(NULL),
296  fOutputContainer(0),
297  fReaderGammas(NULL),
298  fSelectorElectronIndex(0),
299  fSelectorPositronIndex(0),
300  fGoodGammas(NULL),
301  fGoodVirtualGammas(NULL),
302  fGoodElectrons(NULL),
303  fGoodPositrons(NULL),
304  fCutEventArray(NULL),
305  fCutGammaArray(NULL),
306  fCutElectronArray(NULL),
307  fCutMesonArray(NULL),
308  fEventCuts(NULL),
309  fConversionCuts(NULL),
310  hESDConvGammaPt(NULL),
311  hESDConvGammaEta(NULL),
312  //hESDConvGammaZR(NULL),
313  sESDConvGammaZR(NULL),
314  sESDConvGammaXY(NULL),
315  hESDDalitzElectronPt(NULL),
316  hESDDalitzPositronPt(NULL),
317  hESDDalitzElectronPhi(NULL),
318  hESDDalitzPositronPhi(NULL),
319  hESDDalitzElectronAfterPt(NULL),
320  hESDDalitzPositronAfterPt(NULL),
321  hESDDalitzElectronAfterEta(NULL),
322  hESDDalitzElectronAfterEtaPCut(NULL),
323  hESDDalitzPositronAfterEta(NULL),
324  hESDDalitzPositronAfterEtaPCut(NULL),
325  hESDDalitzElectronAfterPhi(NULL),
326  hESDDalitzPositronAfterPhi(NULL),
327  hESDDalitzElectronAfterNClsITS(NULL),
328  hESDDalitzElectronAfterNClsITSPCut(NULL),
329  hESDDalitzPositronAfterNClsITS(NULL),
330  hESDDalitzPositronAfterNClsITSPCut(NULL),
331  hESDDalitzElectronAfterNFindClsTPC(NULL),
332  hESDDalitzElectronAfterNFindClsTPCPCut(NULL),
333  hESDDalitzPositronAfterNFindClsTPC(NULL),
334  hESDDalitzPositronAfterNFindClsTPCPCut(NULL),
335  hESDDalitzElectronAfterNClsTPC(NULL),
336  hESDDalitzElectronAfterNClsTPCPCut(NULL),
337  hESDDalitzPositronAfterNClsTPC(NULL),
338  hESDDalitzPositronAfterNClsTPCPCut(NULL),
339  hESDDalitzElectronAfterNCrossedRowsTPC(NULL),
340  hESDDalitzElectronAfterNCrossedRowsTPCPCut(NULL),
341  hESDDalitzPositronAfterNCrossedRowsTPC(NULL),
342  hESDDalitzPositronAfterNCrossedRowsTPCPCut(NULL),
343  hESDDalitzPosEleAfterDCAxy(NULL),
344  hESDDalitzPosEleAfterDCAz(NULL),
345  hESDDalitzElectronAfterTPCdEdxVsP(NULL),
346  hESDDalitzPositronAfterTPCdEdxVsP(NULL),
347  hESDDalitzElectronAfterTPCdEdxSignalVsP(NULL),
348  hESDDalitzPositronAfterTPCdEdxSignalVsP(NULL),
349  hESDDalitzElectronAfterTPCdEdxVsEta(NULL),
350  hESDDalitzPositronAfterTPCdEdxVsEta(NULL),
351  hESDDalitzElectronAfterTPCdEdxVsPhi(NULL),
352  hESDDalitzPositronAfterTPCdEdxVsPhi(NULL),
353  hESDEposEnegPsiPairDPhi(NULL),
354  hESDEposEnegPsiPairEta(NULL),
355  hESDEposEnegDPhiEta(NULL),
356  hESDEposEnegInvMassPt(NULL),
357  hESDTruePi0EposEnegInvMassPi0Pt(NULL),
358  hESDEposEnegLikeSignBackInvMassPt(NULL),
359  hESDMotherInvMassPt(NULL),
360  hESDPi0MotherInvMassPt(NULL),
361  hESDPi0MotherDiffInvMassPt(NULL),
362  hESDPi0MotherDiffLimInvMassPt(NULL),
363  hESDEposEnegInvMassPi0MotherPt(NULL),
364  hESDMotherInvMassOpeningAngleGammaElectron(NULL),
365  sESDMotherInvMassPtZM(NULL),
366  hESDMotherBackInvMassPt(NULL),
367  sESDMotherBackInvMassPtZM(NULL),
368  hESDMotherPi0PtY(NULL),
369  hESDMotherPi0PtAlpha(NULL),
370  hESDMotherPi0PtOpenAngle(NULL),
371  sESDMotherDalitzPlot(NULL),
372  hMCAllGammaPt(NULL),
373  hMCAllGammaPi0Pt(NULL),
374  hMCConvGammaPt(NULL),
375  hMCConvGammaPtR(NULL),
376  hMCConvGammaRSPt(NULL),
377  hMCConvGammaPi0Pt(NULL),
378  hMCAllPositronsPt(NULL),
379  hMCDecayPositronPi0Pt(NULL),
380  hMCAllElectronsPt(NULL),
381  hMCDecayElectronPi0Pt(NULL),
382  hMCConvGammaEta(NULL),
383  hMCConvGammaR(NULL),
384  hMCAllPositronsEta(NULL),
385  hMCAllElectronsEta(NULL),
386  hMCPi0DalitzGammaPt(NULL),
387  hMCPi0DalitzElectronPt(NULL),
388  hMCPi0DalitzPositronPt(NULL),
389  hMCPi0Pt(NULL),
390  hMCPi0WOWeightPt(NULL),
391  hMCPi0GGPt(NULL),
392  hMCEtaPt(NULL),
393  hMCEtaGGPt(NULL),
394  hMCPi0InAccPt(NULL),
395  hMCPi0WOWeightInAccPt(NULL),
396  hMCPi0InAccOpeningAngleGammaElectron(NULL),
397  sMCPi0DalitzPlot(NULL),
398  hMCEtaInAccPt(NULL),
399  hMCChiCPt(NULL),
400  hMCChiCInAccPt(NULL),
401  hMCPi0EposEnegInvMassPt(NULL),
402  hMCEtaEposEnegInvMassPt(NULL),
403  hESDEposEnegTruePi0DalitzInvMassPt(NULL),
404  hESDEposEnegTruePrimPi0DalitzInvMass(NULL),
405  hESDEposEnegTruePi0DalitzPsiPairDPhi(NULL),
406  hESDEposEnegTruePi0DalitzPsiPairMC(NULL),
407  hESDEposEnegTruePi0DalitzPsiPairEta(NULL),
408  hESDEposEnegTruePi0DalitzDPhiEta(NULL),
409  hESDEposEnegTrueEtaDalitzInvMassPt(NULL),
410  hESDEposEnegTruePrimEtaDalitzInvMass(NULL),
411  hESDEposEnegTrueEtaDalitzPsiPairDPhi(NULL),
412  hESDEposEnegTruePhotonInvMassPt(NULL),
413  hESDEposEnegTrueInvMassPt(NULL),
414  hESDEposEnegTrueMotherInvMassPt(NULL),
415  hESDEposEnegTruePhotonPsiPairDPhi(NULL),
416  hESDEposEnegTruePhotonPsiPairDPhiPtCut(NULL),
417  hESDEposEnegTrueJPsiInvMassPt(NULL),
418  hESDTrueMotherChiCInvMassPt(NULL),
419  hESDTrueMotherChiCDiffInvMassPt(NULL),
420  hESDTrueMotherInvMassPt(NULL),
421  hESDTrueMotherW0WeightsInvMassPt(NULL),
422  hESDTrueMotherDalitzInvMassPt(NULL),
423  hESDTrueMotherPi0GGInvMassPt(NULL),
424  hESDTrueMotherPi0GGW0WeightsInvMassPt(NULL),
425  hESDTruePi0PtY(NULL),
426  hESDTruePi0PtAlpha(NULL),
427  hESDTruePi0PtOpenAngle(NULL),
428  sESDTruePi0DalitzPlot(NULL),
429  hESDTruePrimaryMotherPi0GGInvMassPt(NULL),
430  hESDTrueSecondaryMotherPi0GGInvMassPt(NULL),
431  hESDTruePrimaryMotherInvMassMCPt(NULL),
432  hESDTruePrimaryMotherInvMassPt(NULL),
433  hESDTruePrimaryMotherW0WeightingInvMassPt(NULL),
434  hESDTruePrimaryPi0DalitzESDPtMCPt(NULL),
435  hESDTrueSecondaryMotherInvMassPt(NULL),
436  hESDTrueSecondaryMotherFromK0sInvMassPt(NULL),
437  hESDTrueBckGGInvMassPt(NULL),
438  hESDTrueBckContInvMassPt(NULL),
439  hESDTrueMotherGGInvMassPt(NULL),
440  hESDTrueConvGammaPt(NULL),
441  hESDTrueConvGammaPtMC(NULL),
442  hESDTrueConvGammaR(NULL),
443  hESDTrueConvGammaRMC(NULL),
444  hESDTruePositronPt(NULL),
445  hESDTrueElectronPt(NULL),
446  hESDTrueSecConvGammaPt(NULL),
447  hESDTrueSecPositronPt(NULL),
448  hESDTrueSecElectronPt(NULL),
449  hESDTruePi0DalitzConvGammaPt(NULL),
450  hESDTruePi0DalitzConvGammaR(NULL),
451  hESDTruePi0DalitzPositronPt(NULL),
452  hESDTruePi0DalitzPositronPtMB(NULL),
453  hESDTruePi0DalitzElectronPt(NULL),
454  hESDTruePi0DalitzElectronPtMB(NULL),
455  hESDTruePi0DalitzSecConvGammaPt(NULL),
456  hESDTruePi0DalitzSecPositronPt(NULL),
457  hESDTruePi0DalitzSecElectronPt(NULL),
458  hNEvents(NULL),
459  hNGoodESDTracks(NULL),
460  hNGoodESDTracksVsNGoodGammas(NULL),
461  hNGoodESDTracksVsNGoodVGammas(NULL),
462  fHistoSPDClusterTrackletBackground(NULL),
463  hNV0Tracks(NULL),
464  hEtaShift(NULL),
465  fHistoDoubleCountTruePi0InvMassPt(NULL),
466  fHistoDoubleCountTrueEtaInvMassPt(NULL),
467  fHistoDoubleCountTrueConvGammaRPt(NULL),
468  fVectorDoubleCountTruePi0s(0),
469  fVectorDoubleCountTrueEtas(0),
470  fVectorDoubleCountTrueConvGammas(0),
471  fRandom(0),
472  fEventPlaneAngle(-100),
473  fUnsmearedPx(NULL),
474  fUnsmearedPy(NULL),
475  fUnsmearedPz(NULL),
476  fUnsmearedE(NULL),
477  fUnsmearedVPx(NULL),
478  fUnsmearedVPy(NULL),
479  fUnsmearedVPz(NULL),
480  fUnsmearedVE(NULL),
481  fnCuts(0),
482  fiCut(0),
483  fNumberOfESDTracks(0),
484  fNumberOfESDTrackskBoth(0),
485  fNVirtualGammas(0),
486  fMoveParticleAccordingToVertex(kFALSE),
487  fIsHeavyIon(0),
488  fDoMesonAnalysis(kTRUE),
489  fDoChicAnalysis(kFALSE),
490  fDoMesonQA(0),
491  fSetProductionVertextoVGamma(kTRUE),
492  fIsFromMBHeader(kTRUE),
493  fIsMC(kFALSE),
494  fDoTHnSparse(kTRUE),
495  fDoHistoDalitzMassLog(kFALSE),
496  fDoMaterialBudgetWeightingOfGammasForTrueMesons(kFALSE)
497 {
498  DefineOutput(1, TList::Class());
499 }
500 
501 //-----------------------------------------------------------------------------------------------
503 {
504  //
505  // virtual destructor
506  //
507 
508  cout<<"Destructor"<<endl;
509 
510  if(fGoodGammas){
511  delete fGoodGammas;
512  fGoodGammas = 0x0;
513  }
514  if(fGoodVirtualGammas){
515  delete fGoodVirtualGammas;
516  fGoodVirtualGammas = 0x0;
517  }
518  if(fGoodElectrons){
519  delete fGoodElectrons;
520  fGoodElectrons = 0x0;
521  }
522  if(fGoodPositrons){
523  delete fGoodPositrons;
524  fGoodPositrons = 0x0;
525  }
526  if(fBGHandler){
527  delete[] fBGHandler;
528  fBGHandler = 0x0;
529  }
530 
531 }
532 
533 //___________________________________________________________
535 
536  const Int_t nDim = 4;
537  Int_t nBins[nDim] = {800,250,7,4};
538  Double_t xMin[nDim] = {0,0, 0,0};
539  Double_t xMax[nDim] = {0.8,25,7,4};
540 
541  if( fDoTHnSparse ) {
542  sESDMotherInvMassPtZM = new THnSparseF*[fnCuts];
543  sESDMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
544  }
545 
547 
548  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
549 
550  TString cutstringEvent = ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutNumber();
551  TString cutstringElectron = ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetCutNumber();
552  TString cutstringMeson = ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->GetCutNumber();
553  TString cutstringGamma = ((AliConversionPhotonCuts*)fCutGammaArray->At(iCut))->GetCutNumber();
554 
555  Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutNumber())(0,1));
556  Int_t centMin = atoi((TString)(((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutNumber())(1,1));
557  Int_t centMax = atoi((TString)(((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutNumber())(2,1));
558 
559  if(collisionSystem == 1 || collisionSystem == 2 ||
560  collisionSystem == 5 || collisionSystem == 8 ||
561  collisionSystem == 9){
562  centMin = centMin*10;
563  centMax = centMax*10;
564  if(centMax ==0 && centMax!=centMin) centMax=100;
565  }
566  else if(collisionSystem == 3 || collisionSystem == 6){
567  centMin = centMin*5;
568  centMax = centMax*5;
569  }
570  else if(collisionSystem == 4 || collisionSystem == 7){
571  centMin = ((centMin*5)+45);
572  centMax = ((centMax*5)+45);
573  }
574 
575  if( fDoTHnSparse ) {
576  fBackList[iCut] = new TList();
577  fBackList[iCut]->SetName(Form("%s_%s_%s_%s Back histograms",cutstringEvent.Data(),cutstringGamma.Data(),cutstringElectron.Data(),cutstringMeson.Data()));
578  fBackList[iCut]->SetOwner(kTRUE);
579  fCutFolder[iCut]->Add(fBackList[iCut]);
580 
581  sESDMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m","Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
582  fBackList[iCut]->Add(sESDMotherBackInvMassPtZM[iCut]);
583 
584  fMotherList[iCut] = new TList();
585  fMotherList[iCut]->SetName(Form("%s_%s_%s_%s Mother histograms",cutstringEvent.Data(),cutstringGamma.Data(),cutstringElectron.Data(),cutstringMeson.Data()));
586  fMotherList[iCut]->SetOwner(kTRUE);
587  fCutFolder[iCut]->Add(fMotherList[iCut]);
588 
589  sESDMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
590  fMotherList[iCut]->Add(sESDMotherInvMassPtZM[iCut]);
591  }
592 
593  if(((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->BackgroundHandlerType() == 0){
594 
595 
597  collisionSystem,centMin,centMax,
598  ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->GetNumberOfBGEvents(),
599  ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->UseTrackMultiplicity(),
600  1,8,5);
601  }
602 
603 
604 
605  }
606 }
607 
608 //______________________________________________________________________
610 {
611  //
612  // Create ouput objects
613  //
614 
615  // Create the output container
616  if(fOutputContainer != NULL){
617  delete fOutputContainer;
618  fOutputContainer = NULL;
619  }
620  if(fOutputContainer == NULL){
621  fOutputContainer = new TList();
622  fOutputContainer->SetOwner(kTRUE);
623  }
624 
625  fGoodGammas = new TList();
626 
627  fGoodVirtualGammas = new TList();
628  fGoodVirtualGammas->SetOwner(kTRUE);
629 
630 
631  fCutFolder = new TList*[fnCuts];
632  fESDList = new TList*[fnCuts];
633 
634  if( fDoTHnSparse ){
635  fBackList = new TList*[fnCuts];
636  fMotherList = new TList*[fnCuts];
637  }
638  hNEvents = new TH1I*[fnCuts];
639  hNGoodESDTracks = new TH1I*[fnCuts];
640  hNV0Tracks = new TH1I*[fnCuts];
641  hEtaShift = new TProfile*[fnCuts];
642  hESDConvGammaPt = new TH1F*[fnCuts];
643  hESDConvGammaEta = new TH1F*[fnCuts];
644 
645  hESDDalitzElectronPt = new TH1F*[fnCuts];
646  hESDDalitzPositronPt = new TH1F*[fnCuts];
647  hESDDalitzElectronPhi = new TH1F*[fnCuts];
648  hESDDalitzPositronPhi = new TH1F*[fnCuts];
649 
650  const Int_t nBinsMassPair = 800;
651  Double_t xMinMassPair = 0.0;
652  Double_t xMaxMassPair = 0.8;
653 
654  if( fDoMesonQA > 0) {
655  fQAFolder = new TList*[fnCuts];
659  hESDDalitzElectronAfterPt = new TH1F*[fnCuts];
660  hESDDalitzPositronAfterPt = new TH1F*[fnCuts];
661  hESDDalitzElectronAfterEta = new TH1F*[fnCuts];
663  hESDDalitzPositronAfterEta = new TH1F*[fnCuts];
665  hESDDalitzElectronAfterPhi = new TH1F*[fnCuts];
666  hESDDalitzPositronAfterPhi = new TH1F*[fnCuts];
701  hESDMotherPi0PtY = new TH2F*[fnCuts];
704 
705 
706  if ( fDoMesonQA > 1 ){
707  sESDConvGammaZR = new THnSparseF*[fnCuts];
708  sESDConvGammaXY = new THnSparseF*[fnCuts];
709  sESDMotherDalitzPlot = new THnSparseF*[fnCuts];
710  }
711 
712  if( fDoHistoDalitzMassLog ){
713 
714  xMinMassPair = 0.001;
715  xMaxMassPair = 0.801;
716 
717  }
718 
719 
720  }
721 
722 
723 
725 
726  if(fDoChicAnalysis) {
731  }
733 
734 
735  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
736 
737  TString cutstringEvent = ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutNumber();
738  TString cutstringElectron = ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetCutNumber();
739  TString cutstringMeson = ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->GetCutNumber();
740  TString cutstringGamma = ((AliConversionPhotonCuts*)fCutGammaArray->At(iCut))->GetCutNumber();
741 
742  fCutFolder[iCut] = new TList();
743  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s_%s",cutstringEvent.Data(),cutstringGamma.Data(),cutstringElectron.Data(),cutstringMeson.Data()));
744  fCutFolder[iCut]->SetOwner(kTRUE);
745  fOutputContainer->Add(fCutFolder[iCut]);
746 
747  fESDList[iCut] = new TList();
748  fESDList[iCut]->SetName(Form("%s_%s_%s_%s ESD histograms",cutstringEvent.Data(),cutstringGamma.Data(),cutstringElectron.Data(),cutstringMeson.Data()));
749  fESDList[iCut]->SetOwner(kTRUE);
750 
751  hNEvents[iCut] = new TH1I("NEvents","NEvents",13,-0.5,12.5);
752  hNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
753  hNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
754  hNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
755  hNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
756  hNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
757  hNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
758  hNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
759  hNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
760  hNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
761  hNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
762  hNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
763  hNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
764  fESDList[iCut]->Add(hNEvents[iCut]);
765 
766  if(fIsHeavyIon == 1 || fIsHeavyIon == 2) hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",3000,0,3000);
767  else hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
768  fESDList[iCut]->Add(hNGoodESDTracks[iCut]);
769 
770 
771  if(fIsHeavyIon == 1) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
772  else if(fIsHeavyIon == 2) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
773  else hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
774  fESDList[iCut]->Add(hNV0Tracks[iCut]);
775 
776  hEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
777  fESDList[iCut]->Add(hEtaShift[iCut]);
778 
779  hESDConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",250,0,25);
780  fESDList[iCut]->Add(hESDConvGammaPt[iCut]);
781 
782  hESDConvGammaEta[iCut] = new TH1F("ESD_ConvGamma_Eta","ESD_ConvGamma_Eta",600,-1.5,1.5);
783  fESDList[iCut]->Add(hESDConvGammaEta[iCut]);
784 
785  hESDDalitzElectronPt[iCut] = new TH1F("ESD_DalitzElectron_Pt","ESD_DalitzElectron_Pt",1000,0,25);
786  fESDList[iCut]->Add(hESDDalitzElectronPt[iCut]);
787 
788  hESDDalitzPositronPt[iCut] = new TH1F("ESD_DalitzPositron_Pt","ESD_DalitzPositron_Pt",1000,0,25);
789  fESDList[iCut]->Add(hESDDalitzPositronPt[iCut]);
790 
791 
792  hESDDalitzElectronPhi[iCut] = new TH1F("ESD_DalitzElectron_Phi","ESD_DalitzElectron_Phi",360,0,2*TMath::Pi());
793  fESDList[iCut]->Add(hESDDalitzElectronPhi[iCut]);
794 
795  hESDDalitzPositronPhi[iCut] = new TH1F("ESD_DalitzPositron_Phi","ESD_DalitzPositron_Phi",360,0,2*TMath::Pi());
796  fESDList[iCut]->Add(hESDDalitzPositronPhi[iCut]);
797 
798 
799 
800  if ( fDoMesonQA > 0 ) {
801 
802  fQAFolder[iCut] = new TList();
803  fQAFolder[iCut]->SetName(Form("%s_%s_%s_%s QA histograms",cutstringEvent.Data(),cutstringGamma.Data(),cutstringElectron.Data(),cutstringMeson.Data()));
804  fQAFolder[iCut]->SetOwner(kTRUE);
805 
806  const Int_t kPtBins=110;
807  Double_t binsPtDummy[kPtBins+1];
808  const Int_t kPBins = 109;
809  Double_t binsPDummy[kPBins+1];
810  binsPtDummy[0]=0.0;
811  binsPDummy[0]=0.05;
812 
813 
814 
815 
816 
817  for(Int_t i=1;i<kPtBins+1;i++){
818  if(binsPtDummy[i-1]+0.05<1.01)
819  binsPtDummy[i]=binsPtDummy[i-1]+0.05;
820  else
821  binsPtDummy[i]=binsPtDummy[i-1]+0.1;
822  }
823  for(Int_t i=1; i<kPBins+1;i++){
824  if( binsPDummy[i-1]+0.05<1.01)
825  binsPDummy[i] = binsPDummy[i-1]+0.05;
826  else
827  binsPDummy[i] = binsPDummy[i-1]+0.1;
828  }
829 
830  hNGoodESDTracksVsNGoodGammas[iCut] = new TH2F("hNGoodESDTracksVsNGoodGammas","hNGoodESDTracksVsNGoodGammas",200,-0.5,199.5,100,-0.5,99.5);
831  fQAFolder[iCut]->Add(hNGoodESDTracksVsNGoodGammas[iCut]);
832 
833  hNGoodESDTracksVsNGoodVGammas[iCut] = new TH2F("hNGoodESDTracksVsNVGoodVGammas","hNGoodESDTracksVsNGoodVGammas",200,-0.5,199.5,100,-0.5,99.5);
834  fQAFolder[iCut]->Add(hNGoodESDTracksVsNGoodVGammas[iCut]);
835 
836  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters","SPD tracklets vs SPD clusters",100,0,200,250,0,1000);
838 
839 
840  hESDDalitzElectronAfterPt[iCut] = new TH1F("ESD_DalitzElectron_After_Pt","ESD_DalitzElectron_After_Pt",1000,0,25);
841  fQAFolder[iCut]->Add(hESDDalitzElectronAfterPt[iCut]);
842 
843  hESDDalitzPositronAfterPt[iCut] = new TH1F("ESD_DalitzPositron_After_Pt","ESD_DalitzPositron_After_Pt",1000,0,25);
844  fQAFolder[iCut]->Add(hESDDalitzPositronAfterPt[iCut]);
845 
846  hESDDalitzElectronAfterEta[iCut] = new TH1F("ESD_DalitzElectron_After_Eta","ESD_DalitzElectron_After_Eta",600,-1.5,1.5);
847  fQAFolder[iCut]->Add(hESDDalitzElectronAfterEta[iCut]);
848 
849  hESDDalitzElectronAfterEtaPCut[iCut] = new TH1F("ESD_DalitzElectron_After_Eta_PCut","ESD_DalitzElectron_After_Eta_PCut",600,-1.5,1.5);
850  fQAFolder[iCut]->Add(hESDDalitzElectronAfterEtaPCut[iCut]);
851 
852  hESDDalitzPositronAfterEta[iCut] = new TH1F("ESD_DalitzPositron_After_Eta","ESD_DalitzElectron_After_Eta",600,-1.5,1.5);
853  fQAFolder[iCut]->Add(hESDDalitzPositronAfterEta[iCut]);
854 
855  hESDDalitzPositronAfterEtaPCut[iCut] = new TH1F("ESD_DalitzPositron_After_Eta_PCut","ESD_DalitzElectron_After_Eta_PCut",600,-1.5,1.5);
856  fQAFolder[iCut]->Add(hESDDalitzPositronAfterEtaPCut[iCut]);
857 
858  hESDDalitzElectronAfterPhi[iCut] = new TH1F("ESD_DalitzElectron_After_Phi","ESD_DalitzElectron_After_Phi",360,0,2*TMath::Pi());
859  fQAFolder[iCut]->Add(hESDDalitzElectronAfterPhi[iCut]);
860 
861  hESDDalitzPositronAfterPhi[iCut] = new TH1F("ESD_DalitzPositron_After_Phi","ESD_DalitzPositron_After_Phi",360,0,2*TMath::Pi());
862  fQAFolder[iCut]->Add(hESDDalitzPositronAfterPhi[iCut]);
863 
864  hESDDalitzElectronAfterNClsITS[iCut] = new TH1F("ESD_DalitzElectron_After_NClsITS","ESD_DalitzElectron_After_NClsITS",7,-0.5,6.5);
865  fQAFolder[iCut]->Add(hESDDalitzElectronAfterNClsITS[iCut]);
866 
867  hESDDalitzElectronAfterNClsITSPCut[iCut] = new TH1F("ESD_DalitzElectron_After_NClsITS_PCut","ESD_DalitzElectron_After_NClsITS_PCut",7,-0.5,6.5);
869 
870  hESDDalitzPositronAfterNClsITS[iCut] = new TH1F("ESD_DalitzPositron_After_NClsITS","ESD_DalitzPositron_After_NClsITS",7,-0.5,6.5);
871  fQAFolder[iCut]->Add(hESDDalitzPositronAfterNClsITS[iCut]);
872 
873  hESDDalitzPositronAfterNClsITSPCut[iCut] = new TH1F("ESD_DalitzPositron_After_NClsITS_PCut","ESD_DalitzPositron_After_NClsITS_PCut",7,-0.5,6.5);
875 
876  hESDDalitzElectronAfterNFindClsTPC[iCut] = new TH2F("ESD_DalitzElectron_After_NFindClsTPC","ESD_DalitzElectron_After_NFindClsTPC",60,0,1.5,kPtBins,binsPtDummy);
878 
879  hESDDalitzElectronAfterNFindClsTPCPCut[iCut] = new TH1F("ESD_DalitzElectron_After_NFindClsTPC_PCut","ESD_DalitzElectron_After_NFindClsTPC_PCut",60,0,1.5);
881 
882 
883  hESDDalitzPositronAfterNFindClsTPC[iCut] = new TH2F("ESD_DalitzPositron_After_NFindClsTPC","ESD_DalitzPositron_After_NFindClsTPC",60,0,1.5,kPtBins,binsPtDummy);
885 
886  hESDDalitzPositronAfterNFindClsTPCPCut[iCut] = new TH1F("ESD_DalitzPositron_After_NFindClsTPC_PCut","ESD_DalitzPositron_After_NFindClsTPC_PCut",60,0,1.5);
888 
889 
890  hESDDalitzElectronAfterNClsTPC[iCut] = new TH2F("ESD_DalitzElectron_After_NClsTPC","ESD_DalitzElectron_After_NClsTPC",200,-0.5,199.5,kPtBins,binsPtDummy);
891  fQAFolder[iCut]->Add(hESDDalitzElectronAfterNClsTPC[iCut]);
892 
893  hESDDalitzElectronAfterNClsTPCPCut[iCut] = new TH1F("ESD_DalitzElectron_After_NClsTPC_PCut","ESD_DalitzElectron_After_NClsTPC_PCut",200,-0.5,199.5);
895 
896  hESDDalitzPositronAfterNClsTPC[iCut] = new TH2F("ESD_DalitzPositron_After_NClsTPC","ESD_DalitzPositron_After_NClsTPC",200,-0.5,199.5,kPtBins,binsPtDummy);
897  fQAFolder[iCut]->Add(hESDDalitzPositronAfterNClsTPC[iCut]);
898 
899  hESDDalitzPositronAfterNClsTPCPCut[iCut] = new TH1F("ESD_DalitzPositron_After_NClsTPC_PCut","ESD_DalitzPositron_After_NClsTPC_PCut",200,-0.5,199.5);
901 
902  hESDDalitzPositronAfterNCrossedRowsTPC[iCut] = new TH2F("ESD_DalitzPositron_After_NCrossedRowsTPC","ESD_DalitzPositron_After_NCrossedRowsTPC",165,-0.5,164.5,kPtBins,binsPtDummy);
904 
905  hESDDalitzPositronAfterNCrossedRowsTPCPCut[iCut] = new TH1F("ESD_DalitzPositron_After_NCrossedRowsTPC_PCut","ESD_DalitzPositron_After_NCrossedRowsTPC_PCut",165,-0.5,164.5);
907 
908  hESDDalitzElectronAfterNCrossedRowsTPC[iCut] = new TH2F("ESD_DalitzElectron_After_NCrossedRowsTPC","ESD_DalitzElectron_After_NCrossedRowsTPC",165,-0.5,164.5,kPtBins,binsPtDummy);
910 
911  hESDDalitzElectronAfterNCrossedRowsTPCPCut[iCut] = new TH1F("ESD_DalitzElectron_After_NCrossedRowsTPC_PCut","ESD_DalitzElectron_After_NCrossedRowsTPC_PCut",165,-0.5,164.5);
913 
914  hESDDalitzPosEleAfterDCAxy[iCut] = new TH2F("ESD_DalitzPosEle_After_DCAxy","ESD_DalitzPosEle_After_DCAxy",124,-0.62,0.62,kPtBins,binsPtDummy);
915  fQAFolder[iCut]->Add(hESDDalitzPosEleAfterDCAxy[iCut]);
916 
917  hESDDalitzPosEleAfterDCAz[iCut] = new TH2F("ESD_DalitzPosEle_After_DCAz","ESD_DalitzPosEle_After_DCAz",200,-1.0,1.0,kPtBins,binsPtDummy);
918  fQAFolder[iCut]->Add(hESDDalitzPosEleAfterDCAz[iCut]);
919 
920  hESDDalitzElectronAfterTPCdEdxVsP[iCut] = new TH2F("ESD_DalitzElectron_After_TPCdEdxVsP","ESD_DalitzElectron_After_TPCdEdxVsP_After_TPCdEdx",kPBins,binsPDummy,200,-10,10);
923 
924  hESDDalitzPositronAfterTPCdEdxVsP[iCut] = new TH2F("ESD_DalitzPositron_After_TPCdEdxVsP","ESD_DalitzPositron_After_TPCdEdxVsP",kPBins,binsPDummy,200,-10,10);
927 
928  hESDDalitzElectronAfterTPCdEdxSignalVsP[iCut] =new TH2F("ESD_DalitzElectron_After_TPCdEdxSignalVsP","ESD_DalitzElectron_After_TPCdEdxSignalVsP" ,kPBins,binsPDummy,200,0.0,200);
931 
932  hESDDalitzPositronAfterTPCdEdxSignalVsP[iCut] =new TH2F("ESD_DalitzPositron_After_TPCdEdxSignalVsP","ESD_DalitzPositron_After_TPCdEdxSignalVsP" ,kPBins,binsPDummy,200,0.0,200);
935 
936  hESDDalitzElectronAfterTPCdEdxVsEta[iCut] = new TH2F("ESD_DalitzElectron_After_TPCdEdxVsEta","ESD_DalitzElectron_After_TPCdEdxVsEta",140,-1.4,1.4,200,-10,10);
938 
939  hESDDalitzPositronAfterTPCdEdxVsEta[iCut] = new TH2F("ESD_DalitzPositron_After_TPCdEdxVsEta","ESD_DalitzPositron_After_TPCdEdxVsEta",140,-1.4,1.4,200,-10,10);
941 
942  hESDDalitzElectronAfterTPCdEdxVsPhi[iCut] = new TH2F("ESD_DalitzElectron_After_TPCdEdxVsPhi","ESD_DalitzElectron_After_TPCdEdxVsPhi",180,0,2*TMath::Pi(),200,-10,10);
944 
945  hESDDalitzPositronAfterTPCdEdxVsPhi[iCut] = new TH2F("ESD_DalitzPositron_After_TPCdEdxVsPhi","ESD_DalitzPositron_After_TPCdEdxVsPhi",180,0,2*TMath::Pi(),200,-10,10);
947 
948  hESDEposEnegPsiPairDPhi[iCut] = new TH2F("ESD_EposEneg_PsiPair_DPhi","ESD_EposEneg_PsiPair_DPhi",100,-1.0,1.0,100,-1.0,1.0 );
949  fQAFolder[iCut]->Add(hESDEposEnegPsiPairDPhi[iCut]);
950 
951  hESDEposEnegPsiPairEta[iCut] = new TH2F("ESD_EposEneg_PsiPair_Eta","ESD_EposEneg_PsiPair_Eta",100,-1.0,1.0,600,-1.5,1.5);
952  fQAFolder[iCut]->Add(hESDEposEnegPsiPairEta[iCut]);
953 
954  hESDEposEnegDPhiEta[iCut] = new TH2F("ESD_EposEneg_DPhi_Eta","ESD_EposEneg_DPhi_Eta",100,-1.0,1.0,600,-1.5,1.5);
955  fQAFolder[iCut]->Add(hESDEposEnegDPhiEta[iCut]);
956 
957 
958  hESDEposEnegInvMassPt[iCut] = new TH2F("ESD_EposEneg_InvMassPt","ESD_EposEneg_InvMassPt",nBinsMassPair,xMinMassPair,xMaxMassPair,100,0.,10.);
960  fQAFolder[iCut]->Add(hESDEposEnegInvMassPt[iCut]);
961 
962 
963  hESDEposEnegLikeSignBackInvMassPt[iCut] = new TH2F("ESD_EposEneg_LikeSignBack_InvMassPt","ESD_EposEneg_LikeSignBack_InvMassPt",4000,0.0,2.,100,0.,10.);
965 
966 
967  if( fDoMesonQA > 1 ) {
968 
969  const Int_t nDimRZ = 2;
970  Int_t nBinsRZ[nDimRZ] = { 1200, 800};
971  Double_t xMinRZ[nDimRZ] = { -150, 0};
972  Double_t xMaxRZ[nDimRZ] = { 150, 200};
973 
974  const Int_t nDimXY = 2;
975  Int_t nBinsXY[nDimXY] = { 1200, 1200};
976  Double_t xMinXY[nDimXY] = { -150, -150};
977  Double_t xMaxXY[nDimXY] = { 150, 150};
978 
979  sESDConvGammaZR[iCut] = new THnSparseF("ESD_ConvGamma_ZR","ESD_ConvGamma_ZR",nDimRZ,nBinsRZ,xMinRZ,xMaxRZ);
980  fQAFolder[iCut]->Add(sESDConvGammaZR[iCut]);
981 
982  sESDConvGammaXY[iCut] = new THnSparseF("ESD_ConvGamma_XY","ESD_ConvGamma_XY",nDimXY,nBinsXY,xMinXY,xMaxXY);
983  fQAFolder[iCut]->Add(sESDConvGammaXY[iCut]);
984 
985 
986  const Int_t nDimDalPlot = 2;
987  Int_t nBinsDalPlot[nDimDalPlot] = { 4000, 4000};
988  Double_t xMinDalPlot[nDimDalPlot] = { 0, 0};
989  Double_t xMaxDalPlot[nDimDalPlot] = { 4.0, 4.0};
990 
991 
992  sESDMotherDalitzPlot[iCut] = new THnSparseF("ESD_Mother_DalitzPlot","ESD_Mother_DalitzPlot",nDimDalPlot,nBinsDalPlot,xMinDalPlot,xMaxDalPlot);
993  fQAFolder[iCut]->Add(sESDMotherDalitzPlot[iCut]);
994 
995  }
996  fCutFolder[iCut]->Add(fQAFolder[iCut]);
997  }
998 
999  hESDMotherInvMassPt[iCut] = new TH2F("ESD_DalitzMother_InvMass_Pt","ESD_DalitzMother_InvMass_Pt",800,0,0.8,250,0,25);
1000  fESDList[iCut]->Add(hESDMotherInvMassPt[iCut]);
1001 
1002  if( fDoMesonQA > 0 ) {
1003 
1004  hESDMotherInvMassOpeningAngleGammaElectron[iCut] = new TH1F("ESD_MotherInvMass_OpeningAngle_GammaElectron", "ESD_MotherInvMass_OpeningAngle_GammaElectron",100,0.,TMath::Pi());
1006 
1007  hESDMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y","ESD_MotherPi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1009  fESDList[iCut]->Add(hESDMotherPi0PtY[iCut]);
1010  hESDMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha","ESD_MotherPi0_Pt_Alpha",150,0.03,15.,100,0,1);
1012  fESDList[iCut]->Add(hESDMotherPi0PtAlpha[iCut]);
1013  hESDMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
1015  fESDList[iCut]->Add(hESDMotherPi0PtOpenAngle[iCut]);
1016  }
1017 
1018 
1019  if( fDoChicAnalysis) {
1020  hESDPi0MotherInvMassPt[iCut] = new TH2F("ESD_Pi0Mother_InvMass_Pt","ESD_Pi0Mother_InvMass_Pt",4000,0,4,200,0,20);
1021  fESDList[iCut]->Add(hESDPi0MotherInvMassPt[iCut]);
1022  hESDPi0MotherDiffInvMassPt[iCut] = new TH2F("ESD_Pi0Mother_DiffInvMass_Pt","ESD_Pi0Mother_DiffInvMass_Pt",2000,0,2,200,0,20);
1023  fESDList[iCut]->Add(hESDPi0MotherDiffInvMassPt[iCut]);
1024  hESDPi0MotherDiffLimInvMassPt[iCut] = new TH2F("ESD_Pi0Mother_DiffLimInvMass_Pt","ESD_Pi0Mother_DiffLimInvMass_Pt",2000,0,2,200,0,20);
1025  fESDList[iCut]->Add(hESDPi0MotherDiffLimInvMassPt[iCut]);
1026  hESDEposEnegInvMassPi0MotherPt[iCut] = new TH2F("ESD_EposEnegInvMass_Pi0MotherPt","ESD_EposEnegInvMass_Pi0MotherPt",4000,0,4,200,0,20);
1027  fESDList[iCut]->Add(hESDEposEnegInvMassPi0MotherPt[iCut]);
1028  }
1029 
1030  hESDMotherBackInvMassPt[iCut] = new TH2F("ESD_DalitzBackground_InvMass_Pt","ESD_DalitzBackground_InvMass_Pt",800,0,0.8,250,0,25);
1031  fESDList[iCut]->Add(hESDMotherBackInvMassPt[iCut]);
1032 
1033  fCutFolder[iCut]->Add(fESDList[iCut]);
1034  }
1035 
1036 
1037  InitBack(); // Init Background Handler
1038 
1039 
1040  if( fIsMC ){
1041  // MC Histogramms
1042  fMCList = new TList*[fnCuts];
1043  // True Histogramms
1044  fTrueList = new TList*[fnCuts];
1045  hESDTrueConvGammaPt = new TH1F*[fnCuts];
1047  hESDTruePositronPt = new TH1F*[fnCuts];
1048  hESDTrueElectronPt = new TH1F*[fnCuts];
1049  hESDTrueSecConvGammaPt = new TH1F*[fnCuts];
1050  hESDTrueSecPositronPt = new TH1F*[fnCuts];
1051  hESDTrueSecElectronPt = new TH1F*[fnCuts];
1052  hESDTruePi0DalitzConvGammaPt = new TH1F*[fnCuts];
1053 
1056  hESDTruePi0DalitzPositronPt = new TH1F*[fnCuts];
1058  hESDTruePi0DalitzElectronPt = new TH1F*[fnCuts];
1063 
1064  hMCAllGammaPt = new TH1F*[fnCuts];
1065  hMCAllGammaPi0Pt = new TH1F*[fnCuts];
1066  hMCConvGammaPt = new TH1F*[fnCuts];
1067  hMCConvGammaRSPt = new TH1F*[fnCuts];
1068  hMCConvGammaPi0Pt = new TH1F*[fnCuts];
1069  hMCAllPositronsPt = new TH1F*[fnCuts];
1070  hMCDecayPositronPi0Pt = new TH1F*[fnCuts];
1071  hMCAllElectronsPt = new TH1F*[fnCuts];
1072  hMCDecayElectronPi0Pt = new TH1F*[fnCuts];
1073 
1074  if( fDoMesonQA > 0 ) {
1075 
1076  hMCConvGammaEta = new TH1F*[fnCuts];
1077  hMCConvGammaR = new TH1F*[fnCuts];
1078  hMCAllPositronsEta = new TH1F*[fnCuts];
1079  hMCAllElectronsEta = new TH1F*[fnCuts];
1080  hMCConvGammaPtR = new TH2F*[fnCuts];
1081 
1082 
1083  }
1084  hMCPi0DalitzGammaPt = new TH1F*[fnCuts];
1085  hMCPi0DalitzElectronPt = new TH1F*[fnCuts];
1086  hMCPi0DalitzPositronPt = new TH1F*[fnCuts];
1087 
1088  hMCPi0Pt = new TH1F*[fnCuts];
1089  hMCPi0WOWeightPt = new TH1F*[fnCuts];
1090  hMCPi0GGPt = new TH1F*[fnCuts];
1091  hMCEtaPt = new TH1F*[fnCuts];
1092  hMCEtaGGPt = new TH1F*[fnCuts];
1093  hMCPi0InAccPt = new TH1F*[fnCuts];
1094  hMCPi0WOWeightInAccPt = new TH1F*[fnCuts];
1096  hMCEtaInAccPt = new TH1F*[fnCuts];
1097  hMCChiCPt = new TH1F*[fnCuts];
1098  hMCChiCInAccPt = new TH1F*[fnCuts];
1099 
1100 
1101  if ( fDoMesonQA > 0 ) {
1102 
1120  hESDTrueConvGammaR = new TH1F*[fnCuts];
1121  hESDTrueConvGammaRMC = new TH1F*[fnCuts];
1122  hESDTrueConvGammaPtMC = new TH1F*[fnCuts];
1123  hESDTruePi0PtY = new TH2F*[fnCuts];
1124  hESDTruePi0PtAlpha = new TH2F*[fnCuts];
1126 
1127  if ( fDoMesonQA > 1 ) {
1128  hESDTruePi0DalitzConvGammaR = new TH1F*[fnCuts];
1129  sESDTruePi0DalitzPlot = new THnSparseF*[fnCuts];
1130  sMCPi0DalitzPlot = new THnSparseF*[fnCuts];
1131  }
1132 
1133 
1134  }
1135 
1136 
1137  if( fDoChicAnalysis ){
1140  }
1141 
1142 
1159  //}
1160 
1161  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1162  TString cutstringEvent = ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutNumber();
1163  TString cutstringElectron = ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetCutNumber();
1164  TString cutstringMeson = ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->GetCutNumber();
1165  TString cutstringGamma = ((AliConversionPhotonCuts*)fCutGammaArray->At(iCut))->GetCutNumber();
1166 
1167  fMCList[iCut] = new TList();
1168  fMCList[iCut]->SetName(Form("%s_%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringGamma.Data(),cutstringElectron.Data(),cutstringMeson.Data()));
1169  fMCList[iCut]->SetOwner(kTRUE);
1170  fCutFolder[iCut]->Add(fMCList[iCut]);
1171 
1172  hMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",250,0,25);
1173  fMCList[iCut]->Add(hMCAllGammaPt[iCut]);
1174 
1175  hMCAllGammaPi0Pt[iCut] = new TH1F("MC_AllGammaPi0_Pt","MC_AllGammaPi0_Pt",250,0,25);
1176  fMCList[iCut]->Add(hMCAllGammaPi0Pt[iCut]);
1177 
1178  hMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt","MC_ConvGamma_Pt",250,0,25);
1179  fMCList[iCut]->Add(hMCConvGammaPt[iCut]);
1180 
1181  hMCConvGammaRSPt[iCut] = new TH1F("MC_ConvGamma_RS_Pt","MC_ConvGamma_RS_Pt",250,0,25);
1182  fMCList[iCut]->Add(hMCConvGammaRSPt[iCut]);
1183 
1184  hMCConvGammaPi0Pt[iCut] = new TH1F("MC_ConvGammaPi0_Pt","MC_ConvGammaPi0_Pt",250,0,25);
1185  fMCList[iCut]->Add(hMCConvGammaPi0Pt[iCut]);
1186 
1187  hMCAllPositronsPt[iCut] = new TH1F("MC_AllPositrons_Pt","MC_AllPositrons_Pt",1000,0,25);
1188  fMCList[iCut]->Add(hMCAllPositronsPt[iCut]);
1189 
1190  hMCDecayPositronPi0Pt[iCut] = new TH1F("MC_DecayPositronPi0_Pt","MC_DecayPositronPi0_Pt",1000,0,25);
1191  fMCList[iCut]->Add(hMCDecayPositronPi0Pt[iCut]);
1192 
1193  hMCAllElectronsPt[iCut] = new TH1F("MC_AllElectrons_Pt","MC_AllElectrons_Pt",1000,0,25);
1194  fMCList[iCut]->Add(hMCAllElectronsPt[iCut]);
1195 
1196  hMCDecayElectronPi0Pt[iCut] = new TH1F("MC_DecayElectronPi0_Pt","MC_DecayElectronPi0_Pt",1000,0,25);
1197  fMCList[iCut]->Add(hMCDecayElectronPi0Pt[iCut]);
1198 
1199  hMCPi0DalitzGammaPt[iCut] = new TH1F("MC_Pi0DalitzGamma_Pt","MC_Pi0DalitzGamma_Pt",250,0,25);
1200  hMCPi0DalitzGammaPt[iCut]->Sumw2();
1201  fMCList[iCut]->Add(hMCPi0DalitzGammaPt[iCut]);
1202 
1203  if ( fDoMesonQA > 0 ){
1204  hMCConvGammaEta[iCut] = new TH1F("MC_ConvGamma_Eta","MC_ConvGamma_Eta",600,-1.5,1.5);
1205  fMCList[iCut]->Add(hMCConvGammaEta[iCut]);
1206  hMCConvGammaR[iCut] = new TH1F("MC_ConvGamma_R","MC_ConvGamma_R",800,0,200);
1207  fMCList[iCut]->Add(hMCConvGammaR[iCut]);
1208  hMCAllPositronsEta[iCut] = new TH1F("MC_AllPositrons_Eta","MC_AllPositrons_Eta",600,-1.5,1.5);
1209  fMCList[iCut]->Add(hMCAllPositronsEta[iCut]);
1210  hMCAllElectronsEta[iCut] = new TH1F("MC_AllElectrons_Eta","MC_AllElectrons_Eta",600,-1.5,1.5);
1211  fMCList[iCut]->Add(hMCAllElectronsEta[iCut]);
1212  hMCConvGammaPtR[iCut] = new TH2F("MC_ConvGamma_Pt_R","MC_ConvGamma_Pt_R",250,0,25,180,0.,180.0);
1213  fMCList[iCut]->Add(hMCConvGammaPtR[iCut]);
1214 
1215  }
1216 
1217  hMCPi0DalitzPositronPt[iCut] = new TH1F("MC_Pi0DalitzPositron_Pt","MC_Pi0DalitzPositron_Pt",1000,0,25);
1218  hMCPi0DalitzPositronPt[iCut]->Sumw2();
1219  fMCList[iCut]->Add(hMCPi0DalitzPositronPt[iCut]);
1220 
1221  hMCPi0DalitzElectronPt[iCut] = new TH1F("MC_Pi0DalitzElectron_Pt","MC_Pi0DalitzElectron_Pt",1000,0,25);
1222  hMCPi0DalitzElectronPt[iCut]->Sumw2();
1223  fMCList[iCut]->Add(hMCPi0DalitzElectronPt[iCut]);
1224 
1225  hMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt","MC_Pi0_Pt",250,0,25);
1226  hMCPi0Pt[iCut]->Sumw2();
1227  fMCList[iCut]->Add(hMCPi0Pt[iCut]);
1228 
1229  hMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt","MC_Pi0_WOWeights_Pt",250,0,25);
1230  hMCPi0WOWeightPt[iCut]->Sumw2();
1231  fMCList[iCut]->Add(hMCPi0WOWeightPt[iCut]);
1232 
1233  hMCPi0GGPt[iCut] = new TH1F("MC_Pi0_GG_Pt","MC_Pi0_GG_Pt",250,0,25);
1234  hMCPi0GGPt[iCut]->Sumw2();
1235  fMCList[iCut]->Add(hMCPi0GGPt[iCut]);
1236 
1237  hMCEtaPt[iCut] = new TH1F("MC_Eta_Pt","MC_Eta_Pt",250,0,25);
1238  hMCEtaPt[iCut]->Sumw2();
1239  fMCList[iCut]->Add(hMCEtaPt[iCut]);
1240 
1241  hMCEtaGGPt[iCut] = new TH1F("MC_Eta_GG_Pt","MC_Eta_GG_Pt",250,0,25);
1242  hMCEtaGGPt[iCut]->Sumw2();
1243  fMCList[iCut]->Add(hMCEtaGGPt[iCut]);
1244 
1245  hMCPi0InAccPt[iCut] = new TH1F("MC_Pi0DalitzInAcc_Pt","MC_Pi0DalitzInAcc_Pt",250,0,25);
1246  hMCPi0InAccPt[iCut]->Sumw2();
1247  fMCList[iCut]->Add(hMCPi0InAccPt[iCut]);
1248 
1249  hMCPi0WOWeightInAccPt[iCut] = new TH1F("MC_Pi0WOWeightInAcc_Pt","MC_Pi0WOWeightInAcc_Pt",250,0,25);
1250  hMCPi0WOWeightInAccPt[iCut]->Sumw2();
1251  fMCList[iCut]->Add(hMCPi0WOWeightInAccPt[iCut]);
1252 
1253  hMCPi0InAccOpeningAngleGammaElectron[iCut] = new TH1F("MC_Pi0InAcc_OpeningAngle_GammaElectron","MC_Pi0InAcc_OpeningAngle_GammaElectron",100,0,TMath::Pi());
1255 
1256 
1257 
1258  hMCEtaInAccPt[iCut] = new TH1F("MC_EtaDalitzInAcc_Pt","MC_EtaDalitzInAcc_Pt",250,0,25);
1259  hMCEtaInAccPt[iCut]->Sumw2();
1260  fMCList[iCut]->Add(hMCEtaInAccPt[iCut]);
1261 
1262  hMCChiCPt[iCut] = new TH1F("MC_ChiC_Pt","MC_ChiC_Pt",250,0,25);
1263  fMCList[iCut]->Add(hMCChiCPt[iCut]);
1264 
1265  hMCChiCInAccPt[iCut] = new TH1F("MC_ChiCInAcc_Pt","MC_ChiCInAcc_Pt",250,0,25);
1266  fMCList[iCut]->Add(hMCChiCInAccPt[iCut]);
1267 
1268  if ( fDoMesonQA > 0 ) {
1269  hMCPi0EposEnegInvMassPt[iCut] = new TH2F("MC_Pi0EposEneg_InvMassPt","MC_Pi0EposEneg_InvMassPt",100,0.0,0.5,100,0.,10.);
1270  fMCList[iCut]->Add(hMCPi0EposEnegInvMassPt[iCut]);
1271  hMCEtaEposEnegInvMassPt[iCut] = new TH2F("MC_EtaEposEneg_InvMassPt","MC_EtaEposEneg_InvMassPt",140,0.,0.7,100,0.,10.);
1272  fMCList[iCut]->Add(hMCEtaEposEnegInvMassPt[iCut]);
1273  }
1274 
1275  fTrueList[iCut] = new TList();
1276  fTrueList[iCut]->SetName(Form("%s_%s_%s_%s True histograms",cutstringEvent.Data(),cutstringGamma.Data(),cutstringElectron.Data(),cutstringMeson.Data()));
1277  fTrueList[iCut]->SetOwner(kTRUE);
1278  fCutFolder[iCut]->Add(fTrueList[iCut]);
1279 
1280  if ( fDoMesonQA > 0 ) {
1281 
1282  hESDEposEnegTruePi0DalitzInvMassPt[iCut] = new TH2F("ESD_EposEneg_TruePi0Dalitz_InvMassPt","ESD_EposEneg_TruePi0Dalitz_InvMassPt",nBinsMassPair,xMinMassPair,xMaxMassPair,100,0.,10.);
1285 
1286  hESDEposEnegTruePrimPi0DalitzInvMass[iCut] = new TH1F("ESD_EposEneg_TruePrimPi0Dalitz_InvMass","ESD_EposEneg_TruePrimPi0Dalitz_InvMass",nBinsMassPair,xMinMassPair,xMaxMassPair);
1288 
1289  hESDEposEnegTrueInvMassPt[iCut] = new TH2F("ESD_EposEneg_True_InvMassPt","ESD_EposEneg_True_InvMassPt",nBinsMassPair,xMinMassPair,xMaxMassPair,100,0.,10.);
1291  fTrueList[iCut]->Add(hESDEposEnegTrueInvMassPt[iCut]);
1292 
1293  hESDEposEnegTrueMotherInvMassPt[iCut] = new TH2F("ESD_EposEneg_TrueMother_InvMassPt","ESD_EposEneg_TrueMother_InvMassPt",nBinsMassPair,xMinMassPair,xMaxMassPair,100,0.,10.);
1295  fTrueList[iCut]->Add(hESDEposEnegTrueMotherInvMassPt[iCut]);
1296 
1297  hESDEposEnegTrueEtaDalitzInvMassPt[iCut] = new TH2F("ESD_EposEneg_TrueEtaDalitz_InvMassPt","ESD_EposEneg_TrueEtaDalitz_InvMassPt",nBinsMassPair,xMinMassPair,xMaxMassPair,100,0.,10.);
1300 
1301  hESDEposEnegTruePrimEtaDalitzInvMass[iCut] = new TH1F("ESD_EposEneg_TruePrimEtaDalitz_InvMass","ESD_EposEneg_TruePrimEtaDalitz_InvMass",nBinsMassPair,xMinMassPair,xMaxMassPair);
1302  //if(fDoHistoDalitzMassLog)SetLogBinningXTH2(hESDEposEnegTruePrimEtaDalitzInvMass[iCut]);
1304 
1305  hESDEposEnegTruePhotonInvMassPt[iCut] = new TH2F("ESD_EposEneg_TruePhoton_InvMassPt","ESD_EposEneg_TruePhoton_InvMassPt",nBinsMassPair,xMinMassPair,xMaxMassPair,100,0.,10.);
1307  fTrueList[iCut]->Add(hESDEposEnegTruePhotonInvMassPt[iCut]);
1308 
1309  hESDEposEnegTrueJPsiInvMassPt[iCut] = new TH2F("ESD_EposEneg_TrueJPsi_InvMassPt","ESD_EposEneg_TrueJPsi_InvMassPt",1000,0.,5.,100,0.,10.);
1310  fTrueList[iCut]->Add(hESDEposEnegTrueJPsiInvMassPt[iCut]);
1311 
1312 
1313  hESDEposEnegTruePi0DalitzPsiPairDPhi[iCut] = new TH2F("ESD_EposEneg_TruePi0Dalitz_PsiPair_DPhi","ESD_EposEneg_TruePi0Dalitz_PsiPair_DPhi", 100, -1.0,1.0,100,-1.0,1.0 );
1315 
1316  hESDEposEnegTruePi0DalitzPsiPairMC[iCut] = new TH1F("ESD_EposEneg_TruePi0Dalitz_PsiPairMC","ESD_EposEneg_TruePi0Dalitz_PsiPairMC", 100, -1.0,1.0);
1317  fTrueList[iCut]->Add(hESDEposEnegTruePi0DalitzPsiPairMC[iCut]);
1318 
1319  hESDEposEnegTruePi0DalitzPsiPairEta[iCut] = new TH2F("ESD_EposEneg_TruePi0Dalitz_PsiPair_Eta","ESD_EposEneg_TruePi0Dalitz_PsiPair_Eta", 100, -1.0,1.0,600,-1.5,1.5 );
1321 
1322  hESDEposEnegTruePi0DalitzDPhiEta[iCut] = new TH2F("ESD_EposEneg_TruePi0Dalitz_DPhi_Eta","ESD_EposEneg_TruePi0Dalitz_DPhi_Eta", 100, -1.0,1.0,600,-1.5,1.5 );
1323  fTrueList[iCut]->Add(hESDEposEnegTruePi0DalitzDPhiEta[iCut]);
1324 
1325 
1326  hESDEposEnegTrueEtaDalitzPsiPairDPhi[iCut] = new TH2F("ESD_EposEneg_TrueEtaDalitz_PsiPair_DPhi","ESD_EposEneg_TrueEtaDalitz_PsiPair_DPhi", 100, -1.0,1.0,100,-1.0,1.0 );
1328 
1329 
1330  hESDEposEnegTruePhotonPsiPairDPhi[iCut] = new TH2F("ESD_EposEneg_TruePhoton_PsiPair_DPhi","ESD_EposEneg_TruePhoton_PsiPair_DPhi", 100, -1.0,1.0,100,-1.0,1.0 );
1331  fTrueList[iCut]->Add(hESDEposEnegTruePhotonPsiPairDPhi[iCut]);
1332 
1333  hESDEposEnegTruePhotonPsiPairDPhiPtCut[iCut] = new TH2F("ESD_EposEneg_TruePhoton_PsiPair_DPhi_PtCut","ESD_EposEneg_TruePhoton_PsiPair_DPhi_PtCut", 100, -1.0,1.0,100,-1.0,1.0 );
1335 
1336 
1337  hESDTrueConvGammaR[iCut] = new TH1F("ESD_TrueConvGamma_R","ESD_TrueConvGamma_R",800,0,200);
1338  fTrueList[iCut]->Add(hESDTrueConvGammaR[iCut]);
1339 
1340  hESDTrueConvGammaRMC[iCut] = new TH1F("ESD_TrueConvGamma_R_MC","ESD_TrueConvGamma_R_MC",800,0,200);
1341  fTrueList[iCut]->Add(hESDTrueConvGammaRMC[iCut]);
1342 
1343  hESDTrueConvGammaPtMC[iCut] = new TH1F("ESD_TrueConvGamma_Pt_MC","ESD_TrueConvGamma_Pt_MC",250,0,25);
1344  fTrueList[iCut]->Add(hESDTrueConvGammaPtMC[iCut]);
1345 
1346  hESDTruePi0EposEnegInvMassPi0Pt[iCut] = new TH2F("ESD_TruePi0EposEnegInvMass_Pi0Pt","ESD_TruePi0EposEnegInvMass_Pi0Pt",100,0.0,0.5,100,0.,10.);
1347  fTrueList[iCut]->Add(hESDTruePi0EposEnegInvMassPi0Pt[iCut]);
1348 
1349 
1350  hESDTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y","ESD_TruePi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1352  fTrueList[iCut]->Add(hESDTruePi0PtY[iCut]);
1353 
1354  hESDTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha","ESD_TruePi0_Pt_Alpha",150,0.03,15.,100,0,1);
1356  fTrueList[iCut]->Add(hESDTruePi0PtAlpha[iCut]);
1357 
1358  hESDTruePi0PtOpenAngle[iCut] = new TH2F("ESD_TruePi0_Pt_OpenAngle","ESD_TruePi0_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
1360  fTrueList[iCut]->Add(hESDTruePi0PtOpenAngle[iCut]);
1361 
1362  if(fDoMesonQA > 1 ) {
1363  hESDTruePi0DalitzConvGammaR[iCut] = new TH1F("ESD_TruePi0DalitzConvGamma_R","hESDTruePi0DalitzConvGammaR",800,0,200);
1364  fTrueList[iCut]->Add(hESDTruePi0DalitzConvGammaR[iCut]);
1365 
1366 
1367  const Int_t nDimDalPlot = 2;
1368  Int_t nBinsDalPlot[nDimDalPlot] = { 4000, 4000};
1369  Double_t xMinDalPlot[nDimDalPlot] = { 0, 0};
1370  Double_t xMaxDalPlot[nDimDalPlot] = { 4.0, 4.0};
1371 
1372 
1373  sESDTruePi0DalitzPlot[iCut] = new THnSparseF("ESD_TruePi0Dalitz_DalitzPlot","ESD_TruePi0Dalitz_DalitzPlot",nDimDalPlot,nBinsDalPlot,xMinDalPlot,xMaxDalPlot);
1374  fQAFolder[iCut]->Add(sESDTruePi0DalitzPlot[iCut]);
1375 
1376  sMCPi0DalitzPlot[iCut] = new THnSparseF("MC_Pi0Dalitz_DalitzPlot","MC_Pi0Dalitz_DalitzPlot",nDimDalPlot,nBinsDalPlot,xMinDalPlot,xMaxDalPlot);
1377  fQAFolder[iCut]->Add(sMCPi0DalitzPlot[iCut]);
1378 
1379  }
1380 
1381  }
1382 
1383  hESDTruePositronPt[iCut] = new TH1F("ESD_TruePositron_Pt","ESD_TruePositron_Pt",1000,0,25);
1384  fTrueList[iCut]->Add(hESDTruePositronPt[iCut]);
1385 
1386  hESDTrueElectronPt[iCut] = new TH1F("ESD_TrueElectron_Pt","ESD_TrueElectron_Pt",1000,0,25);
1387  fTrueList[iCut]->Add(hESDTrueElectronPt[iCut]);
1388 
1389  hESDTrueSecPositronPt[iCut] = new TH1F("ESD_TrueSecPositron_Pt","ESD_TrueSecPositron_Pt",1000,0,25);
1390  fTrueList[iCut]->Add(hESDTrueSecPositronPt[iCut]);
1391 
1392  hESDTrueSecElectronPt[iCut] = new TH1F("ESD_TrueSecElectron_Pt","ESD_TrueSecElectron_Pt",1000,0,25);
1393  fTrueList[iCut]->Add(hESDTrueSecElectronPt[iCut]);
1394 
1395  hESDTrueConvGammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt","ESD_TrueConvGamma_Pt",250,0,25);
1396  fTrueList[iCut]->Add(hESDTrueConvGammaPt[iCut]);
1397 
1398  fHistoDoubleCountTrueConvGammaRPt[iCut] = new TH2F("ESD_TrueDoubleCountConvGamma_R_Pt","ESD_TrueDoubleCountConvGamma_R_Pt",800,0,200,300,0,30);
1399  fTrueList[iCut]->Add(fHistoDoubleCountTrueConvGammaRPt[iCut]);
1400 
1401  hESDTrueSecConvGammaPt[iCut] = new TH1F("ESD_TrueSecConvGamma_Pt","ESD_TrueSecConvGamma_Pt",250,0,25);
1402  fTrueList[iCut]->Add(hESDTrueSecConvGammaPt[iCut]);
1403 
1404  hESDTruePi0DalitzConvGammaPt[iCut] = new TH1F("ESD_TruePi0DalitzConvGamma_Pt","ESD_TruePi0DalitzConvGamma_Pt",250,0,25);
1405  fTrueList[iCut]->Add(hESDTruePi0DalitzConvGammaPt[iCut]);
1406 
1407 
1408 
1409  fHistoDoubleCountTruePi0InvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountPi0_InvMass_Pt","ESD_TrueDoubleCountPi0_InvMass_Pt",800,0,0.8,300,0,30);
1410  fTrueList[iCut]->Add(fHistoDoubleCountTruePi0InvMassPt[iCut]);
1411  fHistoDoubleCountTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountEta_InvMass_Pt","ESD_TrueDoubleCountEta_InvMass_Pt",800,0,0.8,300,0,30);
1412  fTrueList[iCut]->Add(fHistoDoubleCountTrueEtaInvMassPt[iCut]);
1413 
1414  hESDTruePi0DalitzElectronPt[iCut] = new TH1F("ESD_TruePi0DalitzElectron_Pt","ESD_TruePi0DalitzElectron_Pt",1000,0,25);
1415  fTrueList[iCut]->Add(hESDTruePi0DalitzElectronPt[iCut]);
1416 
1417  hESDTruePi0DalitzElectronPtMB[iCut] = new TH1F("ESD_TruePi0DalitzElectron_Pt_MB","ESD_TruePi0DalitzElectron_Pt_MB",1000,0,25);
1418  fTrueList[iCut]->Add(hESDTruePi0DalitzElectronPtMB[iCut]);
1419 
1420  hESDTruePi0DalitzPositronPt[iCut] = new TH1F("ESD_TruePi0DalitzPositron_Pt","ESD_TruePi0DalitzPositron_Pt",1000,0,25);
1421  fTrueList[iCut]->Add(hESDTruePi0DalitzPositronPt[iCut]);
1422 
1423  hESDTruePi0DalitzPositronPtMB[iCut] = new TH1F("ESD_TruePi0DalitzPositron_Pt_MB","ESD_TruePi0DalitzPositron_Pt_MB",1000,0,25);
1424  fTrueList[iCut]->Add(hESDTruePi0DalitzPositronPtMB[iCut]);
1425 
1426 
1427  hESDTruePi0DalitzSecConvGammaPt[iCut] = new TH1F("ESD_TruePi0DalitzSecConvGamma_Pt","ESD_TruePi0DalitzSecConvGamma_Pt",250,0,25);
1428  fTrueList[iCut]->Add(hESDTruePi0DalitzSecConvGammaPt[iCut]);
1429 
1430  hESDTruePi0DalitzSecElectronPt[iCut] = new TH1F("ESD_TruePi0DalitzSecElectron_Pt","ESD_TruePi0DalitzSecElectron_Pt",1000,0,25);
1431  fTrueList[iCut]->Add(hESDTruePi0DalitzSecElectronPt[iCut]);
1432 
1433  hESDTruePi0DalitzSecPositronPt[iCut] = new TH1F("ESD_TruePi0DalitzSecPositron_Pt","ESD_TruePi0DalitzSecPositron_Pt",1000,0,25);
1434  fTrueList[iCut]->Add(hESDTruePi0DalitzSecPositronPt[iCut]);
1435 
1436  if( fDoChicAnalysis) {
1437  hESDTrueMotherChiCInvMassPt[iCut] = new TH2F("ESD_TrueMotherChiC_InvMass_Pt","ESD_TrueMotherChiC_InvMass_Pt",4000,0,4,250,0,25);
1438  fTrueList[iCut]->Add(hESDTrueMotherChiCInvMassPt[iCut]);
1439  hESDTrueMotherChiCDiffInvMassPt[iCut] = new TH2F("ESD_TrueMotherChiCDiff_InvMass_Pt","ESD_TrueMotherChiCDiff_InvMass_Pt",2000,0,2,250,0,25);
1440  fTrueList[iCut]->Add(hESDTrueMotherChiCDiffInvMassPt[iCut]);
1441  }
1442 
1443  hESDTrueMotherInvMassPt[iCut] = new TH2F("ESD_TrueMother_InvMass_Pt","ESD_TrueMother_InvMass_Pt",800,0,0.8,250,0,25);
1444  hESDTrueMotherInvMassPt[iCut]->Sumw2();
1445  fTrueList[iCut]->Add(hESDTrueMotherInvMassPt[iCut]);
1446 
1447  hESDTrueMotherW0WeightsInvMassPt[iCut] = new TH2F("ESD_TrueMotherW0Weights_InvMass_Pt","ESD_TrueMotherW0Weights_InvMass_Pt",800,0,0.8,250,0,25);
1448  hESDTrueMotherW0WeightsInvMassPt[iCut]->Sumw2();
1449  fTrueList[iCut]->Add(hESDTrueMotherW0WeightsInvMassPt[iCut]);
1450 
1451 
1452 
1453  hESDTrueMotherDalitzInvMassPt[iCut] = new TH2F("ESD_TrueMother_Dalitz_InvMass_Pt","ESD_TrueMother_Dalitz_InvMass_Pt",800,0,0.8,250,0,25);
1454  hESDTrueMotherDalitzInvMassPt[iCut]->Sumw2();
1455  fTrueList[iCut]->Add(hESDTrueMotherDalitzInvMassPt[iCut]);
1456 
1457 
1458 
1459 
1460 
1461  hESDTrueMotherPi0GGInvMassPt[iCut] = new TH2F("ESD_TrueMotherPi0GG_InvMass_Pt","ESD_TrueMotherPi0GG_InvMass_Pt",800,0,0.8,250,0,25);
1462  hESDTrueMotherPi0GGInvMassPt[iCut]->Sumw2();
1463  fTrueList[iCut]->Add(hESDTrueMotherPi0GGInvMassPt[iCut]);
1464 
1465  hESDTrueMotherPi0GGW0WeightsInvMassPt[iCut] = new TH2F("ESD_TrueMotherPi0GGW0Weights_InvMass_Pt","ESD_TrueMotherPi0GGW0Weights_InvMass_Pt",800,0,0.8,250,0,25);
1468 
1469  hESDTruePrimaryMotherPi0GGInvMassPt[iCut] = new TH2F("ESD_TruePrimaryMotherPi0GG_InvMass_Pt","ESD_TruePrimaryMotherPi0GG_InvMass_Pt",800,0,0.8,250,0,25);
1470  hESDTruePrimaryMotherPi0GGInvMassPt[iCut]->Sumw2();
1472 
1473  hESDTrueSecondaryMotherPi0GGInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryMotherPi0GG_InvMass_Pt","ESD_TrueSecondaryMotherPi0GG_InvMass_Pt",800,0,0.8,250,0,25);
1476 
1477  hESDTruePrimaryPi0DalitzESDPtMCPt[iCut] = new TH2F("ESD_TruePrimaryPi0Dalitz_ESDPt_MCPt","ESD_TruePrimaryPi0Dalitz_ESDPt_MCPt",250,0,25,250,0,25);
1478  hESDTruePrimaryPi0DalitzESDPtMCPt[iCut]->Sumw2();
1479  fTrueList[iCut]->Add(hESDTruePrimaryPi0DalitzESDPtMCPt[iCut]);
1480  hESDTruePrimaryMotherInvMassMCPt[iCut] = new TH2F("ESD_TruePrimaryMother_InvMass_MCPt","ESD_TrueDalitzPrimaryMother_InvMass_MCPt",800,0,0.8,250,0,25);
1481  hESDTruePrimaryMotherInvMassMCPt[iCut]->Sumw2();
1482  fTrueList[iCut]->Add(hESDTruePrimaryMotherInvMassMCPt[iCut]);
1483  hESDTruePrimaryMotherInvMassPt[iCut] = new TH2F("ESD_TruePrimaryMother_InvMass_Pt","ESD_TruePrimaryMother_InvMass_Pt",800,0,0.8,250,0,25);
1484  hESDTruePrimaryMotherInvMassPt[iCut]->Sumw2();
1485  fTrueList[iCut]->Add(hESDTruePrimaryMotherInvMassPt[iCut]);
1486  hESDTruePrimaryMotherW0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryMotherW0Weighting_InvMass_Pt","ESD_TruePrimaryMotherW0Weighting_InvMass_Pt",800,0,0.8,250,0,25);
1489 
1490  hESDTrueSecondaryMotherInvMassPt[iCut] = new TH2F("ESD_TrueDalitzSecondaryMother_InvMass_Pt","ESD_TrueDalitzSecondaryMother_InvMass_Pt",800,0,0.8,250,0,25);
1491  hESDTrueSecondaryMotherInvMassPt[iCut]->Sumw2();
1492  fTrueList[iCut]->Add(hESDTrueSecondaryMotherInvMassPt[iCut]);
1493  // hESDTrueSecondaryMotherFromK0sInvMassPt[iCut] = new TH2F("ESD_TrueDalitzSecondaryMotherFromK0s_InvMass_Pt","ESD_TrueDalitzSecondaryMotherFromK0s_InvMass_Pt",1000,0,1,250,0,25);
1494  // fTrueList[iCut]->Add(hESDTrueSecondaryMotherFromK0sInvMassPt[iCut]);
1495  hESDTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueDalitzBckGG_InvMass_Pt","ESD_TrueDalitzBckGG_InvMass_Pt",800,0,0.8,250,0,25);
1496  fTrueList[iCut]->Add(hESDTrueBckGGInvMassPt[iCut]);
1497  hESDTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueDalitzBckCont_InvMass_Pt","ESD_TrueDalitzBckCont_InvMass_Pt",800,0,0.8,250,0,25);
1498  fTrueList[iCut]->Add(hESDTrueBckContInvMassPt[iCut]);
1499  // hESDTrueMotherGGInvMassPt[iCut] = new TH2F("ESD_TrueGammaGamma_InvMass_Pt","ESD_TrueGammaGamma_InvMass_Pt",1000,0,1,250,0,25);
1500  // fTrueList[iCut]->Add(hESDTrueMotherGGInvMassPt[iCut]);
1501 
1502  }
1503  }
1504 
1508 
1509  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
1510  if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
1511 
1512 
1513  if(fV0Reader)
1515  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
1516  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
1517 
1518  if(fV0Reader)
1520  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
1521  fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
1522 
1526 
1527 
1528 
1529 
1530 
1531  fElecSelector=(AliDalitzElectronSelector*)AliAnalysisManager::GetAnalysisManager()->GetTask("ElectronSelector");
1532  if(!fElecSelector){printf("Error: No ElectronSelector");return;} // GetV0Reader
1533 
1534  if( fElecSelector ){
1535  if ( ((AliDalitzElectronCuts*)fElecSelector->GetDalitzElectronCuts())->GetCutHistograms() ){
1537  }
1538  }
1539 
1540  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1541 
1542  if( fCutElectronArray ){
1543  if( ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetCutHistograms() ) {
1544  fCutFolder[iCut]->Add( ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetCutHistograms() );
1545  }
1546  }
1547 
1548  if( fCutMesonArray ) {
1549  if( ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->GetCutHistograms() ) {
1550  fCutFolder[iCut]->Add( ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->GetCutHistograms());
1551  }
1552  }
1553 
1554  if( fCutGammaArray ) {
1555  if( ((AliConversionPhotonCuts*)fCutGammaArray->At(iCut))->GetCutHistograms() ) {
1556  fCutFolder[iCut]->Add( ((AliConversionPhotonCuts*)fCutGammaArray->At(iCut))->GetCutHistograms() );
1557  }
1558  }
1559 
1560  if( fCutEventArray )
1561  if( ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutHistograms()){
1562  fCutFolder[iCut]->Add(((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutHistograms());
1563  }
1564  }
1565 
1566  PostData(1, fOutputContainer);
1567 
1568 }
1569 
1570 //______________________________________________________________________
1572 {
1573 
1574  //
1575  // Execute analysis for current event
1576  //
1577 
1578  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
1579  if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
1580 
1581 
1582  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
1583 
1584  // Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1
1585  if(eventQuality == 2 || eventQuality == 3){
1586  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1587  hNEvents[iCut]->Fill(eventQuality);
1588  }
1589  return;
1590  }
1591 
1592  fElecSelector=(AliDalitzElectronSelector*)AliAnalysisManager::GetAnalysisManager()->GetTask("ElectronSelector");
1593  if(!fElecSelector){printf("Error: No ElectronSelector");return;} // GetV0Reader
1594 
1595 
1596  if(fIsMC) fMCEvent = MCEvent();
1597  fESDEvent = (AliESDEvent*)InputEvent();
1598  fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
1599 
1600  AliEventplane *EventPlane = fInputEvent->GetEventplane();
1601  if(fIsHeavyIon == 1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
1602  else fEventPlaneAngle=0.0;
1603 
1604 
1605  fSelectorElectronIndex = fElecSelector->GetReconstructedElectronsIndex(); // Electrons from default Cut
1606  fSelectorPositronIndex = fElecSelector->GetReconstructedPositronsIndex(); // Positrons from default Cut
1607 
1608  CountESDTracks(); // Estimate Event Multiplicity
1610  //AddTaskContainers(); //Add conatiner
1611 
1612  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1613  fiCut = iCut;
1614  fNVirtualGammas = 0;
1615 
1616  Int_t eventNotAccepted =
1617  ((AliConvEventCuts*)fCutEventArray->At(iCut))
1618  ->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,kFALSE);
1619 
1620 
1621  //Int_t eventNotAccepted = ((AliConvEventCuts*)fCutGammaArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,kFALSE);
1622 
1623  if(eventNotAccepted){
1624  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
1625  hNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
1626  continue;
1627  }
1628 
1629  if(eventQuality != 0){// Event Not Accepted
1630  // cout << "event rejected due to: " <<eventQuality << endl;
1631  hNEvents[iCut]->Fill(eventQuality);
1632  continue;
1633  }
1634 
1635  hNEvents[iCut]->Fill(eventQuality);
1636  hNGoodESDTracks[iCut]->Fill(fNumberOfESDTracks);
1637 
1638  if(((AliConvEventCuts*)fCutEventArray->At(iCut))->IsHeavyIon() == 2) hNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A());
1639  else hNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
1640 
1641  if(fMCEvent){ // Process MC Particle
1642  if(((AliConvEventCuts*)fCutEventArray->At(iCut))->GetSignalRejection() != 0){
1643  ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetNotRejectedParticles( ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetSignalRejection(),
1644  ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetAcceptedHeader(),
1645  fMCEvent);
1646  }
1648  }
1649 
1650  ProcessPhotonCandidates(); // Process this cuts gammas
1651  ProcessElectronCandidates(); // Process this cuts gammas
1652 
1653  if(((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->UseMCPSmearing() && fMCEvent){
1654 
1655  fUnsmearedPx = new Double_t[fGoodGammas->GetEntries()]; // Store unsmeared Momenta
1656  fUnsmearedPy = new Double_t[fGoodGammas->GetEntries()];
1657  fUnsmearedPz = new Double_t[fGoodGammas->GetEntries()];
1658  fUnsmearedE = new Double_t[fGoodGammas->GetEntries()];
1659 
1660  for(Int_t gamma=0;gamma<fGoodGammas->GetEntries();gamma++){ // Smear the AODPhotons in MC
1661  fUnsmearedPx[gamma] = ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->Px();
1662  fUnsmearedPy[gamma] = ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->Py();
1663  fUnsmearedPz[gamma] = ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->Pz();
1664  fUnsmearedE[gamma] = ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->E();
1665  ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->SmearParticle(dynamic_cast<AliAODConversionPhoton*>(fGoodGammas->At(gamma)));
1666  }
1667  }
1668 
1669  if( ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetUseVPhotonMCPmearing() && ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->UseMCPSmearing() && fMCEvent){
1670  // cout<<"Entro virtual photon smearing"<<endl;
1671  fUnsmearedVPx = new Double_t[fGoodVirtualGammas->GetEntries()]; // Store unsmeared Momenta
1672  fUnsmearedVPy = new Double_t[fGoodVirtualGammas->GetEntries()];
1673  fUnsmearedVPz = new Double_t[fGoodVirtualGammas->GetEntries()];
1674  fUnsmearedVE = new Double_t[fGoodVirtualGammas->GetEntries()];
1675 
1676  for(Int_t Vgamma=0;Vgamma<fGoodVirtualGammas->GetEntries();Vgamma++){ // Smear the AODPhotons in MC
1677  fUnsmearedVPx[Vgamma] = ((AliAODConversionPhoton*)fGoodVirtualGammas->At(Vgamma))->Px();
1678  fUnsmearedVPy[Vgamma] = ((AliAODConversionPhoton*)fGoodVirtualGammas->At(Vgamma))->Py();
1679  fUnsmearedVPz[Vgamma] = ((AliAODConversionPhoton*)fGoodVirtualGammas->At(Vgamma))->Pz();
1680  fUnsmearedVE[Vgamma] = ((AliAODConversionPhoton*)fGoodVirtualGammas->At(Vgamma))->E();
1681  ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->SmearVirtualPhoton(dynamic_cast<AliAODConversionPhoton*>(fGoodVirtualGammas->At(Vgamma)));
1682  }
1683  }
1684 
1687 
1688  if(((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->DoBGCalculation()){
1689  if(((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->BackgroundHandlerType() == 0){
1690 
1691 
1694 
1695  }
1696  }
1697 
1698 
1699  if ( fDoMesonQA > 0) {
1702  fHistoSPDClusterTrackletBackground[iCut]->Fill(fInputEvent->GetMultiplicity()->GetNumberOfTracklets(),(fInputEvent->GetNumberOfITSClusters(0)+fInputEvent->GetNumberOfITSClusters(1)));
1703  }
1704 
1705 
1706  if(((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->UseMCPSmearing() && fMCEvent){
1707 
1708  for(Int_t gamma=0;gamma<fGoodGammas->GetEntries();gamma++){ // Smear the AODPhotons in MC
1709  ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->SetPx(fUnsmearedPx[gamma]); // Reset Unsmeared Momenta
1710  ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->SetPy(fUnsmearedPy[gamma]);
1711  ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->SetPz(fUnsmearedPz[gamma]);
1712  ((AliAODConversionPhoton*)fGoodGammas->At(gamma))->SetE(fUnsmearedE[gamma]);
1713  }
1714  delete[] fUnsmearedPx; fUnsmearedPx = 0x0;
1715  delete[] fUnsmearedPy; fUnsmearedPy = 0x0;
1716  delete[] fUnsmearedPz; fUnsmearedPz = 0x0;
1717  delete[] fUnsmearedE; fUnsmearedE = 0x0;
1718  }
1719 
1720  if( ((AliDalitzElectronCuts*)fCutElectronArray->At(iCut))->GetUseVPhotonMCPmearing() && ((AliConversionMesonCuts*)fCutMesonArray->At(iCut))->UseMCPSmearing() && fMCEvent){
1721 
1722  for(Int_t Vgamma=0;Vgamma<fGoodVirtualGammas->GetEntries();Vgamma++){ // Smear the AODPhotons in MC
1723  ((AliAODConversionPhoton*)fGoodVirtualGammas->At(Vgamma))->SetPx(fUnsmearedVPx[Vgamma]); // Reset Unsmeared Momenta
1724  ((AliAODConversionPhoton*)fGoodVirtualGammas->At(Vgamma))->SetPy(fUnsmearedVPy[Vgamma]);
1725  ((AliAODConversionPhoton*)fGoodVirtualGammas->At(Vgamma))->SetPz(fUnsmearedVPz[Vgamma]);
1726  ((AliAODConversionPhoton*)fGoodVirtualGammas->At(Vgamma))->SetE(fUnsmearedVE[Vgamma]);
1727  }
1728  delete[] fUnsmearedVPx; fUnsmearedVPx = 0x0;
1729  delete[] fUnsmearedVPy; fUnsmearedVPy = 0x0;
1730  delete[] fUnsmearedVPz; fUnsmearedVPz = 0x0;
1731  delete[] fUnsmearedVE; fUnsmearedVE = 0x0;
1732  }
1736  fGoodGammas->Clear(); // delete this cuts good gammas
1737  fGoodVirtualGammas->Clear(); // delete this cuts good gammas
1738  }
1739 
1740  fSelectorElectronIndex.clear();
1741  fSelectorPositronIndex.clear();
1742 
1743  PostData( 1, fOutputContainer );
1744 }
1745 
1747 {
1748  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1749  if (((AliConvEventCuts*)fCutEventArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
1750  ((AliConvEventCuts*)fCutEventArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
1751  } else if (((AliConvEventCuts*)fCutEventArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
1752  ((AliConvEventCuts*)fCutEventArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
1753  }
1754 
1755 
1756  if( !((AliConvEventCuts*)fCutEventArray->At(iCut))->GetDoEtaShift() ){
1757 
1758  hEtaShift[iCut]->Fill(0.,0.);
1759  continue; // No Eta Shift requested, continue
1760  }
1761 
1762 
1763  if( ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
1764  ((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
1765  ((AliConvEventCuts*)fCutEventArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
1766  hEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fCutEventArray->At(iCut))->GetEtaShift()));
1767  continue;
1768  } else {
1769  printf(" Gamma Conversion Dalitz Task %s :: Eta Shift Manually Set to %f \n\n",
1770  (((AliConvEventCuts*)fCutEventArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fCutEventArray->At(iCut))->GetEtaShift());
1771  ((AliConvEventCuts*)fCutEventArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
1772  hEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fCutEventArray->At(iCut))->GetEtaShift()));
1773  }
1774  }
1775 
1776  return kTRUE;
1777 }
1778 
1779 //________________________________________________________________________
1781 {
1783 }
1784 
1785 //________________________________________________________________________
1787 {
1788  Int_t nV0 = 0;
1789  TList *GoodGammasStepOne = new TList();
1790  TList *GoodGammasStepTwo = new TList();
1791  // Loop over Photon Candidates allocated by ReaderV1
1792 
1793  for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
1794  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
1795  if(!PhotonCandidate) continue;
1796  fIsFromMBHeader = kTRUE;
1797  if( fMCEvent && ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 0 ){
1798  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
1799  if(isPosFromMBHeader == 0 && ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 3) continue;
1800  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent,fInputEvent);
1801  if(isNegFromMBHeader == 0 && ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 3) continue;
1802  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1803  }
1804 
1805  if(!((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fESDEvent)) continue;
1806 
1807  if(!((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->UseElecSharingCut() &&
1808  !((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->UseToCloseV0sCut()){ // if no post reader loop is required add to events good gammas
1809 
1810  fGoodGammas->Add(PhotonCandidate);
1811  if(fIsFromMBHeader){
1812  hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1813  hESDConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1814  if( fDoMesonQA > 1 ) {
1815 
1816  Double_t sparesFillZR[2] = {PhotonCandidate->GetConversionZ(),PhotonCandidate->GetConversionRadius()};
1817  sESDConvGammaZR[fiCut]->Fill(sparesFillZR);
1818  Double_t sparesFillXY[2] = {PhotonCandidate->GetConversionX(),PhotonCandidate->GetConversionY()};
1819  sESDConvGammaXY[fiCut]->Fill(sparesFillXY);
1820 
1821 
1822 
1823  }
1824  }
1825  if(fMCEvent){
1826  ProcessTruePhotonCandidates(PhotonCandidate);
1827  }
1828  } else if(((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
1829  ((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
1830  nV0++;
1831  GoodGammasStepOne->Add(PhotonCandidate);
1832  } else if(!((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->UseElecSharingCut() &&
1833  ((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
1834  GoodGammasStepTwo->Add(PhotonCandidate);
1835  }
1836  }
1837 
1838 
1839  if(((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->UseElecSharingCut()){
1840  for(Int_t i = 0;i<GoodGammasStepOne->GetEntries();i++){
1841  AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GoodGammasStepOne->At(i);
1842  if(!PhotonCandidate) continue;
1843  fIsFromMBHeader = kTRUE;
1844  if(fMCEvent && ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 0){
1845  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent,fInputEvent);
1846  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent,fInputEvent);
1847  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1848  }
1849 
1850  if(!((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GoodGammasStepOne->GetEntries())) continue;
1851  if(!((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
1852  fGoodGammas->Add(PhotonCandidate);
1853 
1854  if(fIsFromMBHeader){
1855  hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1856  hESDConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1857  if( fDoMesonQA > 1 ){
1858  Double_t sparesFillZR[2] = {PhotonCandidate->GetConversionZ(),PhotonCandidate->GetConversionRadius()};
1859  sESDConvGammaZR[fiCut]->Fill(sparesFillZR);
1860  Double_t sparesFillXY[2] = {PhotonCandidate->GetConversionX(),PhotonCandidate->GetConversionY()};
1861  sESDConvGammaXY[fiCut]->Fill(sparesFillXY);
1862  }
1863  }
1864 
1865  if(fMCEvent){
1866  ProcessTruePhotonCandidates(PhotonCandidate);
1867  }
1868  } else GoodGammasStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
1869  }
1870  }
1871  if(((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->UseToCloseV0sCut()){
1872  for(Int_t i = 0;i<GoodGammasStepTwo->GetEntries();i++){
1873  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GoodGammasStepTwo->At(i);
1874  if(!PhotonCandidate) continue;
1875  if(fMCEvent && ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 0){
1876  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent,fInputEvent);
1877  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent,fInputEvent);
1878  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1879  }
1880  if(!((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GoodGammasStepTwo,i)) continue;
1881  fGoodGammas->Add(PhotonCandidate); // Add gamma to current cut TList
1882 
1883  if(fIsFromMBHeader){
1884  hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt()); // Differences to old V0Reader in p_t due to conversion KF->TLorentzVector
1885  hESDConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1886  if(fDoMesonQA > 1 ){
1887  Double_t sparesFillZR[2] = {PhotonCandidate->GetConversionZ(),PhotonCandidate->GetConversionRadius()};
1888  sESDConvGammaZR[fiCut]->Fill(sparesFillZR);
1889  Double_t sparesFillXY[2] = {PhotonCandidate->GetConversionX(),PhotonCandidate->GetConversionY()};
1890  sESDConvGammaXY[fiCut]->Fill(sparesFillXY);
1891  }
1892  }
1893 
1894  if(fMCEvent){
1895  ProcessTruePhotonCandidates(PhotonCandidate);
1896  }
1897  }
1898  }
1899 
1900  delete GoodGammasStepOne;
1901  GoodGammasStepOne = 0x0;
1902  delete GoodGammasStepTwo;
1903  GoodGammasStepTwo = 0x0;
1904 }
1905 
1906 //________________________________________________________________________
1908 {
1909  // Process True Photons
1910  TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCEvent);
1911  TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCEvent);
1912 
1913  if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
1914  if(posDaughter->GetMother(0) != negDaughter->GetMother(0)){ // Not Same Mother == Combinatorial Bck
1915  return;
1916  } else if (posDaughter->GetMother(0) == -1){
1917  return;
1918  }
1919 
1920  if(TMath::Abs(posDaughter->GetPdgCode())!=11 || TMath::Abs(negDaughter->GetPdgCode())!=11) return; //One Particle is not electron
1921  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge
1922  if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() !=5) return;// check if the daughters come from a conversion
1923 
1924  TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCEvent);
1925  if(Photon->GetPdgCode() != 22) return; // Mother is no Photon
1926 
1927  // True Photon
1928 
1929  Int_t labelGamma = TruePhotonCandidate->GetMCParticleLabel(fMCEvent);
1930 
1931  if( labelGamma < fMCEvent->GetNumberOfPrimaries() ){
1932  if( fIsFromMBHeader ){
1933  hESDTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1934  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueConvGammas,posDaughter->GetMother(0))) fHistoDoubleCountTrueConvGammaRPt[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius(),TruePhotonCandidate->Pt());
1935  if( fDoMesonQA > 0 ){
1936  hESDTrueConvGammaR[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius());
1937  hESDTrueConvGammaRMC[fiCut]->Fill( posDaughter->R() );
1938  hESDTrueConvGammaPtMC[fiCut]->Fill( Photon->Pt());
1939  }
1940  }
1941  } else {
1942  if( fIsFromMBHeader){
1943  hESDTrueSecConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1944  }
1945  }
1946 
1947  if( IsPi0DalitzDaughter(labelGamma) == kTRUE ) {
1948  if( labelGamma < fMCEvent->GetNumberOfPrimaries() ) {
1949  if( fIsFromMBHeader ){
1950  hESDTruePi0DalitzConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1951  if( fDoMesonQA > 1 ){
1952  hESDTruePi0DalitzConvGammaR[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius());
1953  }
1954  }
1955  } else {
1956  if( fIsFromMBHeader ) {
1957  hESDTruePi0DalitzSecConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1958  }
1959  }
1960  }
1961 
1962 
1963 }
1964 //________________________________________________________________________
1966 
1967  Double_t magField = fInputEvent->GetMagneticField();
1968 
1969 
1970  if( magField < 0.0 ){
1971  magField = 1.0;
1972  }
1973  else {
1974  magField = -1.0;
1975  }
1976 
1977 
1978  for(Int_t virtualGammaIndex=0; virtualGammaIndex < fGoodVirtualGammas->GetEntries(); virtualGammaIndex++ ){
1979  AliAODConversionPhoton *Vgamma=dynamic_cast<AliAODConversionPhoton*>(fGoodVirtualGammas->At(virtualGammaIndex));
1980 
1981  AliESDtrack* positronVgamma = fESDEvent->GetTrack( Vgamma->GetTrackLabelPositive() );
1982  AliESDtrack* electronVgamma = fESDEvent->GetTrack( Vgamma->GetTrackLabelNegative() );
1983 
1984  Bool_t isPhoton = kFALSE;
1985  Bool_t isPi0Dalitz = kFALSE;
1986  Bool_t isEtaDalitz = kFALSE;
1987  Bool_t isJPsi = kFALSE;
1988  Bool_t isTrueEposENeg = kFALSE;
1989  Bool_t isMotherPrimary = kFALSE;
1990 
1991 
1992  if ( fDoMesonQA > 0 ) {
1993 
1994  Double_t psiPair = GetPsiPair(positronVgamma,electronVgamma);
1995  Double_t deltaPhi = magField * TVector2::Phi_mpi_pi( electronVgamma->GetConstrainedParam()->Phi()-positronVgamma->GetConstrainedParam()->Phi());
1996 
1997 
1998  hESDEposEnegPsiPairDPhi[fiCut]->Fill(deltaPhi,psiPair);
1999  hESDEposEnegPsiPairEta[fiCut]->Fill(psiPair,Vgamma->Eta());
2000  hESDEposEnegDPhiEta[fiCut]->Fill(deltaPhi,Vgamma->Eta());
2001 
2002  hESDEposEnegInvMassPt[fiCut]->Fill(Vgamma->M(),Vgamma->Pt());
2003 
2004  if( fMCEvent ) {
2005 
2006  Int_t virtualGammaMCLabel = Vgamma->GetMCParticleLabel(fMCEvent);
2007 
2008  TParticle * negativeMC = 0x0;
2009  TParticle * positiveMC = 0x0;
2010  TParticle * mcVgamma = 0x0;
2011 
2012  if( virtualGammaMCLabel != -1 ){
2013  mcVgamma = (TParticle*)fMCEvent->Particle(virtualGammaMCLabel);
2014  }
2015 
2016  negativeMC = (TParticle*)Vgamma->GetNegativeMCDaughter(fMCEvent);
2017  positiveMC = (TParticle*)Vgamma->GetPositiveMCDaughter(fMCEvent);
2018 
2019 
2020  if( negativeMC && positiveMC ) {
2021  if( positiveMC->GetPdgCode() == ::kPositron && negativeMC->GetPdgCode() == ::kElectron )
2022  isTrueEposENeg = kTRUE;
2023  if( positiveMC->GetMother(0) > -1 && positiveMC->GetMother(0) < fMCEvent->GetNumberOfPrimaries() )
2024  isMotherPrimary = kTRUE;
2025  }
2026  if(mcVgamma){
2027  // Check if it is a true photon
2028  if(mcVgamma->GetPdgCode() == 22){
2029  isPhoton = kTRUE;
2030  } else if(mcVgamma->GetPdgCode() == 443){
2031  isJPsi = kTRUE;
2032  } else if( IsDalitz( mcVgamma ) ){
2033  if ( mcVgamma->GetPdgCode() == 111 ) isPi0Dalitz = kTRUE;
2034  else if( mcVgamma->GetPdgCode() == 221 ) isEtaDalitz = kTRUE;
2035  }
2036  }
2037 
2038  if(isPhoton){
2039  hESDEposEnegTruePhotonInvMassPt[fiCut]->Fill(Vgamma->M(),Vgamma->Pt());
2040  hESDEposEnegTruePhotonPsiPairDPhi[fiCut]->Fill(deltaPhi,psiPair);
2041  if( Vgamma->Pt() > 1.5 ){
2042  hESDEposEnegTruePhotonPsiPairDPhiPtCut[fiCut]->Fill(deltaPhi,psiPair);
2043  }
2044  } else if(isJPsi){
2045  hESDEposEnegTrueJPsiInvMassPt[fiCut]->Fill(Vgamma->M(),Vgamma->Pt());
2046  } else if(isPi0Dalitz){
2047 
2048  Double_t psiPairMC = GetPsiPairMC(positiveMC, negativeMC);
2049  hESDEposEnegTruePi0DalitzPsiPairMC[fiCut]->Fill(psiPairMC);
2050  hESDEposEnegTruePi0DalitzInvMassPt[fiCut]->Fill(Vgamma->M(),Vgamma->Pt());
2051  hESDEposEnegTruePi0DalitzPsiPairDPhi[fiCut]->Fill(deltaPhi,psiPair);
2052  hESDEposEnegTruePi0DalitzPsiPairEta[fiCut]->Fill(psiPair,Vgamma->Eta());
2053  hESDEposEnegTruePi0DalitzDPhiEta[fiCut]->Fill(deltaPhi,Vgamma->Eta());
2054 
2055  if( isMotherPrimary ) hESDEposEnegTruePrimPi0DalitzInvMass[fiCut]->Fill( Vgamma->M() );
2056  } else if(isEtaDalitz){
2057  hESDEposEnegTrueEtaDalitzInvMassPt[fiCut]->Fill(Vgamma->M(),Vgamma->Pt());
2058  hESDEposEnegTrueEtaDalitzPsiPairDPhi[fiCut]->Fill(deltaPhi,psiPair);
2059  if( isMotherPrimary ) hESDEposEnegTruePrimEtaDalitzInvMass[fiCut]->Fill( Vgamma->M() );
2060  } else if ( isTrueEposENeg && mcVgamma ){
2061 
2062  hESDEposEnegTrueMotherInvMassPt[fiCut]->Fill(Vgamma->M(), Vgamma->Pt());
2063  }
2064 
2065  if ( isTrueEposENeg ) hESDEposEnegTrueInvMassPt[fiCut]->Fill(Vgamma->M(), Vgamma->Pt());
2066 
2067  }
2068  }
2069  }
2070 }
2071 
2072 //________________________________________________________________________
2074 
2075  Double_t magField = fInputEvent->GetMagneticField();
2076 
2077  if( magField < 0.0 ){
2078  magField = 1.0;
2079  } else {
2080  magField = -1.0;
2081  }
2082 
2083  vector<Int_t> lGoodElectronIndexPrev(0);
2084  vector<Int_t> lGoodPositronIndexPrev(0);
2085 
2086  for(UInt_t i = 0; i < fSelectorElectronIndex.size(); i++){
2087 
2088  AliESDtrack* electronCandidate = fESDEvent->GetTrack(fSelectorElectronIndex[i]);
2089 
2090  Bool_t IsMCFromMBHeader = kTRUE;
2091 
2092  if( fMCEvent ) {
2093 
2094  Int_t isMCFromMBHeader = -1;
2095  Int_t labelelectron = TMath::Abs( electronCandidate->GetLabel() );
2096 
2097  if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 0) {
2098  isMCFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(labelelectron,fMCEvent,fInputEvent);
2099  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 3) continue;
2100  }
2101 
2102  if( isMCFromMBHeader != 2 ) IsMCFromMBHeader = kFALSE;
2103  }
2104 
2105  if(! ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->ElectronIsSelected(electronCandidate) ) continue;
2106 
2107  lGoodElectronIndexPrev.push_back( fSelectorElectronIndex[i] );
2108  hESDDalitzElectronPt[fiCut]->Fill(electronCandidate->Pt());
2109  hESDDalitzElectronPhi[fiCut]->Fill(electronCandidate->Phi());
2110 
2111 
2112  if( fMCEvent ) {
2113 
2114  Int_t labelelectron = TMath::Abs( electronCandidate->GetLabel() );
2115  if( labelelectron < fMCEvent->GetNumberOfTracks() ){
2116  TParticle* electron = fMCEvent->Particle(labelelectron);
2117  if( electron->GetPdgCode() == 11 ){
2118  if( labelelectron < fMCEvent->GetNumberOfPrimaries() ){
2119  hESDTrueElectronPt[fiCut]->Fill(electronCandidate->Pt()); //primary electron
2120  } else {
2121  hESDTrueSecElectronPt[fiCut]->Fill(electronCandidate->Pt()); //secondary electron
2122  }
2123  if( IsPi0DalitzDaughter(labelelectron) == kTRUE && labelelectron < fMCEvent->GetNumberOfPrimaries() ) {
2124  if( electron->GetMother(0) < fMCEvent->GetNumberOfPrimaries() ) {
2125  hESDTruePi0DalitzElectronPt[fiCut]->Fill(electronCandidate->Pt());
2126  if( IsMCFromMBHeader == kTRUE ) hESDTruePi0DalitzElectronPtMB[fiCut]->Fill(electronCandidate->Pt());
2127  } else {
2128  hESDTruePi0DalitzSecElectronPt[fiCut]->Fill(electronCandidate->Pt());
2129  }
2130  }
2131  }
2132  }
2133  }
2134  }
2135 
2136  for(UInt_t i = 0; i < fSelectorPositronIndex.size(); i++){
2137 
2138  AliESDtrack* positronCandidate = fESDEvent->GetTrack( fSelectorPositronIndex[i] );
2139 
2140  Bool_t IsMCFromMBHeader = kTRUE;
2141 
2142  if( fMCEvent ) {
2143 
2144  Int_t isMCFromMBHeader = -1;
2145  Int_t labelpositron = TMath::Abs( positronCandidate->GetLabel() );
2146 
2147 
2148  if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 0) {
2149  isMCFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(labelpositron,fMCEvent,fInputEvent);
2150  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 3) continue;
2151  }
2152 
2153  if( isMCFromMBHeader != 2 ) IsMCFromMBHeader = kFALSE;
2154  }
2155 
2156  if(! ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->ElectronIsSelected(positronCandidate) ) continue;
2157 
2158  lGoodPositronIndexPrev.push_back( fSelectorPositronIndex[i] );
2159  hESDDalitzPositronPt[fiCut]->Fill( positronCandidate->Pt() );
2160  hESDDalitzPositronPhi[fiCut]->Fill( positronCandidate->Phi() );
2161 
2162  if( fMCEvent ) {
2163  Int_t labelpositron = TMath::Abs( positronCandidate->GetLabel() );
2164 
2165  if( labelpositron < fMCEvent->GetNumberOfTracks() ) {
2166  TParticle* positron = fMCEvent->Particle(labelpositron);
2167  if( positron->GetPdgCode() == -11 ){
2168  if( labelpositron < fMCEvent->GetNumberOfPrimaries() ){
2169  hESDTruePositronPt[fiCut]->Fill(positronCandidate->Pt());
2170  } else {
2171  hESDTrueSecPositronPt[fiCut]->Fill(positronCandidate->Pt());
2172  }
2173  if( IsPi0DalitzDaughter(labelpositron) == kTRUE && labelpositron < fMCEvent->GetNumberOfPrimaries() ) {
2174  if( positron->GetMother(0) < fMCEvent->GetNumberOfPrimaries() ){
2175  hESDTruePi0DalitzPositronPt[fiCut]->Fill(positronCandidate->Pt());
2176  if ( IsMCFromMBHeader == kTRUE )hESDTruePi0DalitzPositronPtMB[fiCut]->Fill(positronCandidate->Pt());
2177  } else {
2178  hESDTruePi0DalitzSecPositronPt[fiCut]->Fill(positronCandidate->Pt());
2179  }
2180  }
2181  }
2182  }
2183  }
2184  }
2185 
2186  vector<Bool_t> lElectronPsiIndex(lGoodElectronIndexPrev.size(), kTRUE);
2187  vector<Bool_t> lPositronPsiIndex(lGoodPositronIndexPrev.size(), kTRUE);
2188 
2189  if( ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->DoPsiPairCut() == kTRUE ){
2190  for( UInt_t i = 0; i < lGoodElectronIndexPrev.size(); i++ ) {
2191  AliESDtrack *electronCandidate = fESDEvent->GetTrack(lGoodElectronIndexPrev[i]);
2192  for(UInt_t j = 0; j < lGoodPositronIndexPrev.size(); j++){
2193  AliESDtrack *positronCandidate = fESDEvent->GetTrack(lGoodPositronIndexPrev[j]);
2194  Double_t psiPair = GetPsiPair(positronCandidate,electronCandidate);
2195  Double_t deltaPhi = magField * TVector2::Phi_mpi_pi( electronCandidate->GetConstrainedParam()->Phi()-positronCandidate->GetConstrainedParam()->Phi());
2196 
2197  if( ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->IsFromGammaConversion(psiPair,deltaPhi ) ){
2198  lElectronPsiIndex[i] = kFALSE;
2199  lPositronPsiIndex[j] = kFALSE;
2200  }
2201  }
2202  }
2203  }
2204 
2205  vector<Int_t> lGoodElectronIndex(0);
2206  vector<Int_t> lGoodPositronIndex(0);
2207 
2208  for( UInt_t i = 0; i < lGoodElectronIndexPrev.size(); i++ ) {
2209  if( lElectronPsiIndex[i] == kTRUE )
2210  lGoodElectronIndex.push_back( lGoodElectronIndexPrev[i] );
2211  }
2212 
2213  for( UInt_t i = 0; i < lGoodPositronIndexPrev.size(); i++ ) {
2214  if( lPositronPsiIndex[i] == kTRUE )
2215  lGoodPositronIndex.push_back( lGoodPositronIndexPrev[i] );
2216  }
2217 
2218  for(UInt_t i = 0; i < lGoodElectronIndex.size(); i++){
2219  AliESDtrack *electronCandidate = fESDEvent->GetTrack(lGoodElectronIndex[i]);
2220  AliKFParticle electronCandidateKF( *electronCandidate->GetConstrainedParam(), ::kElectron );
2221  TLorentzVector electronCandidateTLV;
2222  electronCandidateTLV.SetXYZM(electronCandidate->GetConstrainedParam()->Px(),electronCandidate->GetConstrainedParam()->Py(),electronCandidate->GetConstrainedParam()->Pz(),TDatabasePDG::Instance()->GetParticle( ::kElectron )->Mass());
2223 
2224 
2225  for(UInt_t j = 0; j < lGoodPositronIndex.size(); j++){
2226 
2227  AliESDtrack *positronCandidate = fESDEvent->GetTrack(lGoodPositronIndex[j]);
2228  AliKFParticle positronCandidateKF( *positronCandidate->GetConstrainedParam(), ::kPositron );
2229  TLorentzVector positronCandidateTLV;
2230 
2231  positronCandidateTLV.SetXYZM(positronCandidate->GetConstrainedParam()->Px(),positronCandidate->GetConstrainedParam()->Py(),positronCandidate->GetConstrainedParam()->Pz(),TDatabasePDG::Instance()->GetParticle( ::kPositron )->Mass());
2232  TLorentzVector *virtualPhotonTLV = 0;
2233  AliKFConversionPhoton* virtualPhoton = NULL;
2234  AliAODConversionPhoton *vphoton;
2235 
2236  if( ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetUseElectronMCSmearing() && ((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->UseMCPSmearing() && fMCEvent){
2237  TLorentzVector smearelectronCandidateTLV = ((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->SmearElectron(electronCandidateTLV);
2238  TLorentzVector smearpositronCandidateTLV = ((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->SmearElectron(positronCandidateTLV);
2239  virtualPhotonTLV = new TLorentzVector( smearelectronCandidateTLV + smearpositronCandidateTLV );
2240  //TLorentzVector temp = electronCandidateTLV + positronCandidateTLV;
2241  //cout<<"Mass: "<<"NoSmearElectrons "<<temp.M() <<" SmearElectrons "<<virtualPhotonTLV->M()<<endl;
2242  vphoton= new AliAODConversionPhoton(virtualPhotonTLV);
2243  vphoton->SetMass(virtualPhotonTLV->M());
2244  } else {
2245  virtualPhoton = new AliKFConversionPhoton(electronCandidateKF,positronCandidateKF);
2246  if( fSetProductionVertextoVGamma == kTRUE ){
2247  AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
2248  primaryVertexImproved+=*virtualPhoton;
2249  virtualPhoton->SetProductionVertex(primaryVertexImproved);
2250  }
2251 
2252  vphoton= new AliAODConversionPhoton(virtualPhoton);
2253  }
2254  //virtualPhoton->SetTrackLabels( lGoodPositronIndex[j], lGoodElectronIndex[i]);
2255  vphoton->SetTrackLabels( lGoodPositronIndex[j], lGoodElectronIndex[i]);
2256 
2257  if( fMCEvent ) {
2258  Int_t labeln=TMath::Abs(electronCandidate->GetLabel());
2259  Int_t labelp=TMath::Abs(positronCandidate->GetLabel());
2260  TParticle *fNegativeMCParticle = fMCEvent->Particle(labeln);
2261  TParticle *fPositiveMCParticle = fMCEvent->Particle(labelp);
2262  if( fPositiveMCParticle && fNegativeMCParticle) {
2263  //virtualPhoton->SetMCLabelPositive(labelp);
2264  //virtualPhoton->SetMCLabelNegative(labeln);
2265  vphoton->SetMCLabelPositive(labelp);
2266  vphoton->SetMCLabelNegative(labeln);
2267 
2268  }
2269  }
2270 
2271 
2272  fGoodVirtualGammas->Add( vphoton );
2273 
2274  if( virtualPhoton ){
2275  delete virtualPhoton;
2276  virtualPhoton=NULL;
2277  }
2278  if ( virtualPhotonTLV ){
2279  delete virtualPhotonTLV;
2280  virtualPhotonTLV=NULL;
2281  }
2282 
2283  }
2284  }
2285 
2286  //Computing mixing event
2287  if( fDoMesonQA > 0 ) {
2288  for(UInt_t i = 0; i < lGoodElectronIndex.size(); i++){
2289  AliESDtrack *electronCandidate1 = fESDEvent->GetTrack(lGoodElectronIndex[i]);
2290  AliKFParticle electronCandidate1KF( *electronCandidate1->GetConstrainedParam(), ::kElectron );
2291 
2292  for(UInt_t j = i+1; j < lGoodElectronIndex.size(); j++){
2293 
2294  AliESDtrack *electronCandidate2 = fESDEvent->GetTrack(lGoodElectronIndex[j]);
2295  AliKFParticle electronCandidate2KF( *electronCandidate2->GetConstrainedParam(), ::kElectron );
2296  AliKFConversionPhoton* virtualPhoton = new AliKFConversionPhoton(electronCandidate1KF,electronCandidate2KF);
2297 
2298  //AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
2299  //primaryVertexImproved+=*virtualPhoton;
2300  //virtualPhoton->SetProductionVertex(primaryVertexImproved);
2301 
2302  AliAODConversionPhoton *vphoton = new AliAODConversionPhoton(virtualPhoton);
2303  hESDEposEnegLikeSignBackInvMassPt[fiCut]->Fill(vphoton->M(),vphoton->Pt());
2304  delete vphoton;
2305  delete virtualPhoton;
2306  vphoton = 0x0;
2307  virtualPhoton = 0x0;
2308  }
2309  }
2310 
2311 
2312  for(UInt_t i = 0; i < lGoodPositronIndex.size(); i++){
2313  AliESDtrack *positronCandidate1 = fESDEvent->GetTrack(lGoodPositronIndex[i]);
2314  AliKFParticle positronCandidate1KF( *positronCandidate1->GetConstrainedParam(), ::kPositron );
2315 
2316  for(UInt_t j = i+1; j < lGoodPositronIndex.size(); j++){
2317 
2318  AliESDtrack *positronCandidate2 = fESDEvent->GetTrack(lGoodPositronIndex[j]);
2319  AliKFParticle positronCandidate2KF( *positronCandidate2->GetConstrainedParam(), ::kPositron );
2320  AliKFConversionPhoton* virtualPhoton = new AliKFConversionPhoton(positronCandidate1KF,positronCandidate2KF);
2321  //AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
2322  //primaryVertexImproved+=*virtualPhoton;
2323  //virtualPhoton->SetProductionVertex(primaryVertexImproved);
2324 
2325  AliAODConversionPhoton *vphoton = new AliAODConversionPhoton(virtualPhoton);
2326  hESDEposEnegLikeSignBackInvMassPt[fiCut]->Fill(vphoton->M(),vphoton->Pt());
2327  delete vphoton;
2328  delete virtualPhoton;
2329  vphoton = 0x0;
2330  virtualPhoton = 0x0;
2331 
2332  }
2333  }
2334  }
2335 }
2336 
2337 //________________________________________________________________________
2339 
2340  // Conversion Gammas
2341  if( fGoodGammas->GetEntries() > 0 && fGoodVirtualGammas->GetEntries() > 0 ){
2342  vector<Bool_t> lGoodVirtualGamma(fGoodVirtualGammas->GetEntries(), kFALSE);
2343 
2344  for(Int_t GammaIndex=0; GammaIndex<fGoodGammas->GetEntries(); GammaIndex++){
2345  AliAODConversionPhoton *gamma=dynamic_cast<AliAODConversionPhoton*>(fGoodGammas->At(GammaIndex));
2346  if (gamma==NULL) continue;
2347  for(Int_t virtualGammaIndex=0;virtualGammaIndex<fGoodVirtualGammas->GetEntries();virtualGammaIndex++){
2348  AliAODConversionPhoton *Vgamma=dynamic_cast<AliAODConversionPhoton*>(fGoodVirtualGammas->At(virtualGammaIndex));
2349  if (Vgamma==NULL) continue;
2350  //Check for same Electron ID
2351  if(gamma->GetTrackLabelPositive() == Vgamma->GetTrackLabelPositive() ||
2352  gamma->GetTrackLabelNegative() == Vgamma->GetTrackLabelNegative() ||
2353  gamma->GetTrackLabelNegative() == Vgamma->GetTrackLabelPositive() ||
2354  gamma->GetTrackLabelPositive() == Vgamma->GetTrackLabelNegative() ) continue;
2355 
2356  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma,Vgamma);
2357  pi0cand->SetLabels(GammaIndex,virtualGammaIndex);
2358 
2359 
2360  if( ( ((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetEtaShift())) ){
2361 
2362  //cout<< "Meson Accepted "<<endl;
2363  Int_t zbin = 0;
2364  Int_t mbin = 0;
2365  if(fDoTHnSparse && ((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->DoBGCalculation()){
2366  if(((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->BackgroundHandlerType() == 0){
2367 
2368  zbin= fBGHandler[fiCut]->GetZBinIndex(fESDEvent->GetPrimaryVertex()->GetZ());
2369  if( ((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->UseTrackMultiplicity() ){
2371  } else {
2372  mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGoodGammas->GetEntries());
2373  }
2374  }
2375  }
2376  if ( fDoMesonQA > 0 ) {
2377 
2378 
2379 
2380 
2381  if( fMCEvent ) {
2382 
2383  Int_t virtualGammaMCLabel = Vgamma->GetMCParticleLabel(fMCEvent);
2384 
2385  if( virtualGammaMCLabel > -1 ) {
2386 
2387  TParticle * negativeMC = (TParticle*)Vgamma->GetNegativeMCDaughter(fMCEvent);
2388  TParticle * positiveMC = (TParticle*)Vgamma->GetPositiveMCDaughter(fMCEvent);
2389  // TParticle * virtualGammaMotherMC = (TParticle*)fMCEvent->Particle(virtualGammaMCLabel);
2390 
2391  if( negativeMC->GetPdgCode() == 11 && positiveMC->GetPdgCode() == -11) { // Electrons ...
2392 
2393 
2394  if( IsPi0DalitzDaughter( Vgamma->GetMCLabelPositive() ) ){
2395 
2396  hESDTruePi0EposEnegInvMassPi0Pt[fiCut]->Fill( Vgamma->M(), pi0cand->Pt() );
2397 
2398 
2399  }
2400 
2401  }
2402 
2403  }
2404  }
2405 
2406  }
2407 
2408  if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoMassCut() == kTRUE ) {
2409  if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->MassCut( pi0cand->Pt() , Vgamma->M() ) == kTRUE ){
2410 
2411  hESDMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2412 
2413  if( fDoTHnSparse ){
2414  Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
2415  sESDMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
2416  }
2417 
2418 
2419  if(fMCEvent){
2420  ProcessTrueMesonCandidates(pi0cand,gamma,Vgamma);
2421  }
2422 
2423  if ( fDoMesonQA > 0 ) {
2424 
2425 
2426 
2427 
2428 
2429  AliESDtrack* positronVgamma = fESDEvent->GetTrack( Vgamma->GetTrackLabelPositive() );
2430  Double_t momPositron[3];
2431  positronVgamma->GetConstrainedPxPyPz(momPositron);
2432 
2433  AliESDtrack* electronVgamma = fESDEvent->GetTrack( Vgamma->GetTrackLabelNegative() );
2434  Double_t momElectron[3];
2435  electronVgamma->GetConstrainedPxPyPz(momElectron);
2436 
2437  TVector3 vGamma(gamma->GetPx(),gamma->GetPy(),gamma->GetPz());;
2438  TVector3 vPositron(momPositron[0],momPositron[1],momPositron[2]);
2439  TVector3 vElectron(momElectron[0],momElectron[1],momElectron[2]);
2440 
2441 
2442  hESDMotherInvMassOpeningAngleGammaElectron[fiCut]->Fill( vGamma.Angle(vPositron) );
2443  hESDMotherInvMassOpeningAngleGammaElectron[fiCut]->Fill( vGamma.Angle(vElectron) );
2444 
2445 
2446 
2447  if ( pi0cand->M() > 0.05 && pi0cand->M() < 0.17){
2448 
2449  if( fDoMesonQA > 1 ){
2450  TLorentzVector electronCandidateTLV(vElectron,TDatabasePDG::Instance()->GetParticle( ::kElectron )->Mass());
2451  TLorentzVector positronCandidateTLV(vPositron,TDatabasePDG::Instance()->GetParticle( ::kPositron )->Mass());
2452  TLorentzVector gammaTLV(vGamma,0);
2453  TLorentzVector GammaElectronCandidateTLV = gammaTLV + electronCandidateTLV;
2454  TLorentzVector GammaPositronCandidateTLV = gammaTLV + positronCandidateTLV;
2455  Double_t sparesDalitzPlot[2] = {GammaElectronCandidateTLV.M()*GammaElectronCandidateTLV.M(),GammaPositronCandidateTLV.M()*GammaPositronCandidateTLV.M()};
2456  sESDMotherDalitzPlot[fiCut]->Fill(sparesDalitzPlot);
2457 
2458 
2459  }
2460 
2461 
2462  hESDMotherPi0PtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetEtaShift());
2463  hESDMotherPi0PtAlpha[fiCut]->Fill(pi0cand->Pt(),TMath::Abs(pi0cand->GetAlpha()));
2464  hESDMotherPi0PtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());
2465 
2466  }
2467 
2468 
2469  if( lGoodVirtualGamma[virtualGammaIndex] == kFALSE ) {
2470 
2471 
2472  if( pi0cand->M() > 0.1 && pi0cand->M() < 0.145 ){
2473  FillElectronQAHistos(Vgamma);
2474 
2475  lGoodVirtualGamma[virtualGammaIndex] = kTRUE;
2476  fNVirtualGammas++;
2477  }
2478  }
2479  }
2480  }
2481  } else {
2482  hESDMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2483  if( fDoTHnSparse ){
2484  Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
2485  sESDMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
2486  }
2487 
2488  if(fMCEvent){
2489  ProcessTrueMesonCandidates(pi0cand,gamma,Vgamma);
2490  }
2491 
2492  if ( fDoMesonQA > 0 ) {
2493 
2494 
2495  if ( pi0cand->M() > 0.05 && pi0cand->M() < 0.17){
2496 
2497  hESDMotherPi0PtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetEtaShift());
2498  hESDMotherPi0PtAlpha[fiCut]->Fill(pi0cand->Pt(),TMath::Abs(pi0cand->GetAlpha()));
2499  hESDMotherPi0PtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle());
2500 
2501 
2502  }
2503 
2504  if( lGoodVirtualGamma[virtualGammaIndex] == kFALSE ) {
2505 
2506  if( pi0cand->M() > 0.1 && pi0cand->M() < 0.145 ){
2507 
2508  FillElectronQAHistos(Vgamma);
2509  lGoodVirtualGamma[virtualGammaIndex] = kTRUE;
2510  fNVirtualGammas++;
2511 
2512  }
2513  }
2514  }
2515  }
2516 
2517  if( fDoChicAnalysis) {
2518 
2519  hESDPi0MotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2520  hESDEposEnegInvMassPi0MotherPt[fiCut]->Fill(Vgamma->M(),pi0cand->Pt());
2521 
2522  Double_t diffMass = pi0cand->M() - Vgamma->M();
2523  hESDPi0MotherDiffInvMassPt[fiCut]->Fill( diffMass , pi0cand->Pt() );
2524 
2525  if( Vgamma->M() > 2.5 && Vgamma->M() < 3.4){
2526  hESDPi0MotherDiffLimInvMassPt[fiCut]->Fill( diffMass , pi0cand->Pt() );
2527  }
2528 
2529  if(fMCEvent){
2530  ProcessTrueChicCandidates(pi0cand,gamma,Vgamma);
2531  }
2532 
2533 
2534  }
2535 
2536 
2537  }
2538  delete pi0cand;
2539  pi0cand=0x0;
2540  }
2541  }
2542  }
2543 }
2544 
2545 //________________________________________________________________________
2547 
2548  Int_t zbin= fBGHandler[fiCut]->GetZBinIndex(fESDEvent->GetPrimaryVertex()->GetZ());
2549  Int_t mbin = 0;
2550 
2551 
2552  if(((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->UseTrackMultiplicity()){
2554  } else {
2555  mbin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGoodGammas->GetEntries());
2556  }
2557 
2558 
2560 
2561  if(((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->UseTrackMultiplicity()){
2562  for(Int_t nEventsInBG=0;nEventsInBG<fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
2563 
2564  AliGammaConversionAODVector *previousEventV0s = fBGHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
2565  if(fMoveParticleAccordingToVertex == kTRUE || ((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0 ){
2566  bgEventVertex = fBGHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
2567  }
2568 
2569  for(Int_t iCurrent=0;iCurrent<fGoodVirtualGammas->GetEntries();iCurrent++){
2570  AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fGoodVirtualGammas->At(iCurrent));
2571 
2572  for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
2573  AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
2574 
2575  if(fMoveParticleAccordingToVertex == kTRUE ){
2576  MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
2577  }
2578 
2579  if(((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
2580  RotateParticleAccordingToEP(&previousGoodV0,bgEventVertex->fEP,fEventPlaneAngle);
2581  }
2582 
2583  AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
2584  backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
2585 
2586  if( ( ((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE, ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetEtaShift()))){
2587  if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoMassCut() == kTRUE ) {
2588 
2589  if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->MassCut( backgroundCandidate->Pt() , currentEventGoodV0.M() ) == kTRUE ){
2590 
2591  hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2592  if(fDoTHnSparse){
2593  Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2594  sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2595  }
2596  }
2597  } else {
2598  hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2599  if(fDoTHnSparse){
2600  Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2601  sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2602  }
2603  }
2604  }
2605  delete backgroundCandidate;
2606  backgroundCandidate = 0x0;
2607  }
2608  }
2609  }
2610  } else {
2611  for(Int_t nEventsInBG=0;nEventsInBG <fBGHandler[fiCut]->GetNBGEvents();nEventsInBG++){
2612  AliGammaConversionAODVector *previousEventV0s = fBGHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
2613  if(previousEventV0s){
2614  if(fMoveParticleAccordingToVertex == kTRUE || ((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0 ){
2615  bgEventVertex = fBGHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
2616  }
2617  for(Int_t iCurrent=0;iCurrent<fGoodVirtualGammas->GetEntries();iCurrent++){
2618  AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fGoodVirtualGammas->At(iCurrent));
2619  for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
2620  AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
2621  if(fMoveParticleAccordingToVertex == kTRUE ){
2622  MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
2623  }
2624 
2625  if(((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
2626  RotateParticleAccordingToEP(&previousGoodV0,bgEventVertex->fEP,fEventPlaneAngle);
2627  }
2628 
2629  AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
2630  backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
2631 
2632  if((((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetEtaShift()))){
2633  if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoMassCut() == kTRUE ) {
2634  if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->MassCut( backgroundCandidate->Pt() , currentEventGoodV0.M() ) == kTRUE ){
2635  hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2636  if(fDoTHnSparse){
2637  Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2638  sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2639  }
2640  }
2641  } else {
2642  hESDMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
2643  if(fDoTHnSparse){
2644  Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
2645  sESDMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
2646  }
2647  }
2648  }
2649  delete backgroundCandidate;
2650  backgroundCandidate = 0x0;
2651  }
2652  }
2653  }
2654  }
2655  }
2656 
2657 }
2658 
2659 
2660 //________________________________________________________________________
2662  //see header file for documentation
2663 
2664  if(fGoodGammas->GetEntries() > 0 ){
2665  if( ((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->UseTrackMultiplicity() ){
2666  fBGHandler[fiCut]->AddEvent(fGoodGammas,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),fNumberOfESDTracks,fEventPlaneAngle);
2667  } else { // means we use #V0s for multiplicity
2668  fBGHandler[fiCut]->AddEvent(fGoodGammas,fESDEvent->GetPrimaryVertex()->GetX(),fESDEvent->GetPrimaryVertex()->GetY(),fESDEvent->GetPrimaryVertex()->GetZ(),fGoodGammas->GetEntries(),fEventPlaneAngle);
2669  }
2670  }
2671 
2672 }
2673 
2674 //______________________________________________________________________
2676 {
2677  // Process True Mesons
2678 
2679  if( TrueGammaCandidate->GetV0Index() < fESDEvent->GetNumberOfV0s() ){
2680 
2681 
2682 
2683  Bool_t isTruePi0 = kFALSE;
2684  Bool_t isTrueEta = kFALSE;
2685 
2686  Int_t gammaMCLabel = TrueGammaCandidate->GetMCParticleLabel(fMCEvent);
2687  Int_t gammaMotherLabel = -1;
2688 
2689 
2690 
2691 
2692 
2693  //Checking if the gamma candidate is a real gamma
2694 
2695 
2696  if(gammaMCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2697  // Daughters Gamma 0
2698  TParticle * negativeMC = (TParticle*)TrueGammaCandidate->GetNegativeMCDaughter(fMCEvent);
2699  TParticle * positiveMC = (TParticle*)TrueGammaCandidate->GetPositiveMCDaughter(fMCEvent);
2700  TParticle * gammaMC = (TParticle*)fMCEvent->Particle(gammaMCLabel);
2701 
2702  if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2703  if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
2704  if(gammaMC->GetPdgCode() == 22){ // ... with Gamma Mother
2705  gammaMotherLabel=gammaMC->GetFirstMother();
2706  }
2707  }
2708  }
2709  }
2710 
2711 
2712 
2713  //Checking if the virtual gamma is a real virtual gamma
2714 
2715  Int_t virtualGammaMCLabel = TrueVirtualGammaCandidate->GetMCParticleLabel(fMCEvent);
2716  Int_t virtualGammaMotherLabel = -1;
2717  Int_t virtualGamma = -1;
2718 
2719 
2720 
2721  if( virtualGammaMCLabel != -1 ){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2722  // Daughters Gamma 1
2723  TParticle * negativeMC = (TParticle*)TrueVirtualGammaCandidate->GetNegativeMCDaughter(fMCEvent);
2724  TParticle * positiveMC = (TParticle*)TrueVirtualGammaCandidate->GetPositiveMCDaughter(fMCEvent);
2725  TParticle * virtualGammaMotherMC = (TParticle*)fMCEvent->Particle(virtualGammaMCLabel);
2726 
2727  if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2728 
2729  if( virtualGammaMotherMC->GetPdgCode() != 22 ){
2730  virtualGammaMotherLabel=virtualGammaMCLabel;
2731  virtualGamma = 1;
2732 
2733  } else if (negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
2734  virtualGammaMotherLabel=virtualGammaMotherMC->GetFirstMother();
2735  virtualGamma = 0; //no virtual gamma
2736  }
2737  }
2738  }
2739 
2740 
2741  //Checking if both gamma and virtual gamma comming from Pi0 or Eta
2742 
2743 
2744  if( gammaMotherLabel >= 0 && ( gammaMotherLabel == virtualGammaMotherLabel) ){
2745  if(((TParticle*)fMCEvent->Particle(virtualGammaMotherLabel))->GetPdgCode() == 111){
2746  isTruePi0=kTRUE;
2747  if (CheckVectorForDoubleCount(fVectorDoubleCountTruePi0s,gammaMotherLabel)) fHistoDoubleCountTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2748  }
2749  if(((TParticle*)fMCEvent->Particle(virtualGammaMotherLabel))->GetPdgCode() == 221){
2750  isTrueEta=kTRUE;
2751  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueEtas,gammaMotherLabel)) fHistoDoubleCountTrueEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2752  }
2753  }
2754 
2755 
2756 
2757  if( isTruePi0 || isTrueEta ){ // True Pion or Eta
2758 
2759 
2760  if ( virtualGamma == 1 ) { //True Dalitz
2761  Float_t weighted= 1;
2762 
2763  Float_t weightMatBudget = 1.;
2764  if (fDoMaterialBudgetWeightingOfGammasForTrueMesons && ((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->GetMaterialBudgetWeightsInitialized ()) {
2765  weightMatBudget = ((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->GetMaterialBudgetCorrectingWeightForTrueGamma(TrueGammaCandidate);
2766  }
2767 
2768 
2769  if ( isTruePi0 && fDoMesonQA > 0 ) {
2770 
2771  if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
2772 
2773 
2774 
2775  hESDTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetEtaShift());
2776  hESDTruePi0PtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),TMath::Abs(Pi0Candidate->GetAlpha()));
2777  hESDTruePi0PtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
2778 
2779  if( fDoMesonQA > 1 ) {
2780  AliESDtrack* positronVgamma = fESDEvent->GetTrack( TrueVirtualGammaCandidate->GetTrackLabelPositive() );
2781  Double_t momPositron[3];
2782  positronVgamma->GetConstrainedPxPyPz(momPositron);
2783 
2784  AliESDtrack* electronVgamma = fESDEvent->GetTrack( TrueVirtualGammaCandidate->GetTrackLabelNegative() );
2785  Double_t momElectron[3];
2786  electronVgamma->GetConstrainedPxPyPz(momElectron);
2787 
2788  TVector3 vGamma(TrueGammaCandidate->GetPx(),TrueGammaCandidate->GetPy(),TrueGammaCandidate->GetPz());;
2789  TVector3 vPositron(momPositron[0],momPositron[1],momPositron[2]);
2790  TVector3 vElectron(momElectron[0],momElectron[1],momElectron[2]);
2791 
2792  TLorentzVector electronCandidateTLV(vElectron,TDatabasePDG::Instance()->GetParticle( ::kElectron )->Mass());
2793  TLorentzVector positronCandidateTLV(vPositron,TDatabasePDG::Instance()->GetParticle( ::kPositron )->Mass());
2794  TLorentzVector gammaTLV(vGamma,0);
2795  TLorentzVector GammaElectronCandidateTLV = gammaTLV + electronCandidateTLV;
2796  TLorentzVector GammaPositronCandidateTLV = gammaTLV + positronCandidateTLV;
2797  Double_t sparesDalitzPlot[2] = {GammaElectronCandidateTLV.M()*GammaElectronCandidateTLV.M(),GammaPositronCandidateTLV.M()*GammaPositronCandidateTLV.M()};
2798  sESDTruePi0DalitzPlot[fiCut]->Fill(sparesDalitzPlot);
2799  }
2800 
2801  }
2802  }
2803 
2804 
2805 
2806  if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoWeights() ) {
2807  if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(gammaMotherLabel, fMCEvent,fInputEvent)){
2808  if (((TParticle*)fMCEvent->Particle(gammaMotherLabel))->Pt()>0.005){
2809  weighted= ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetWeightForMeson(gammaMotherLabel,fMCEvent,fInputEvent);
2810  }
2811  }
2812  }
2813 
2814  hESDTrueMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted*weightMatBudget);
2815  hESDTrueMotherW0WeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2816  hESDTrueMotherDalitzInvMassPt[fiCut]->Fill( TrueVirtualGammaCandidate->M(),Pi0Candidate->Pt(),weighted*weightMatBudget);
2817 
2818  if(gammaMotherLabel < fMCEvent->GetNumberOfPrimaries()){ // Only primary pi0 for efficiency calculation
2819  hESDTruePrimaryMotherInvMassPt[fiCut]->Fill( Pi0Candidate->M(),Pi0Candidate->Pt(),weighted*weightMatBudget);
2820  hESDTruePrimaryMotherW0WeightingInvMassPt[fiCut]->Fill( Pi0Candidate->M(), Pi0Candidate->Pt() );
2821 
2822  hESDTruePrimaryMotherInvMassMCPt[fiCut]->Fill(Pi0Candidate->M(),((TParticle*)fMCEvent->Particle(virtualGammaMotherLabel))->Pt(),weighted*weightMatBudget);
2823  if(isTruePi0){ // Only primaries for unfolding
2824  hESDTruePrimaryPi0DalitzESDPtMCPt[fiCut]->Fill(Pi0Candidate->Pt(),((TParticle*)fMCEvent->Particle(virtualGammaMotherLabel))->Pt(),weighted*weightMatBudget);
2825  }
2826  } else { // Secondary Meson
2827  Float_t weightedSec= 1;
2828  if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoWeights() ) {
2829  Int_t secMotherLabel = ((TParticle*)fMCEvent->Particle(gammaMotherLabel))->GetMother(0);
2830  if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(gammaMotherLabel, fMCEvent, fInputEvent) && fMCEvent->Particle(gammaMotherLabel)->GetPdgCode()==310){
2831  weightedSec= ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetWeightForMeson(secMotherLabel, fMCEvent, fInputEvent)/2.; //invariant mass is additive thus the weight for the daughters has to be devide by two for the K0s at a certain pt
2832  }
2833  }
2834  hESDTrueSecondaryMotherInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec*weightMatBudget);
2835  }
2836  } else if ( virtualGamma == 0 ){
2837 
2838  Float_t weightMatBudget = 1.;
2839  if (fDoMaterialBudgetWeightingOfGammasForTrueMesons && ((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->GetMaterialBudgetWeightsInitialized ()) {
2840  weightMatBudget = ((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->GetMaterialBudgetCorrectingWeightForTrueGamma(TrueGammaCandidate) * ((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->GetMaterialBudgetCorrectingWeightForTrueGamma(TrueVirtualGammaCandidate);
2841  }
2842 
2843  Float_t weighted= 1;
2844  if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoWeights() ) {
2845  if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(gammaMotherLabel, fMCEvent,fInputEvent)){
2846  if (((TParticle*)fMCEvent->Particle(gammaMotherLabel))->Pt()>0.005){
2847  weighted= ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetWeightForMeson(gammaMotherLabel,fMCEvent,fInputEvent);
2848  }
2849  }
2850  }
2851  hESDTrueMotherPi0GGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted*weightMatBudget); // Pi0 from GG
2852  hESDTrueMotherPi0GGW0WeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2853 
2854  if( gammaMotherLabel < fMCEvent->GetNumberOfPrimaries() ){
2855  hESDTruePrimaryMotherPi0GGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted*weightMatBudget);
2856  } else {
2857  Float_t weightedSec= 1;
2858  if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoWeights() ) {
2859  Int_t secMotherLabel = ((TParticle*)fMCEvent->Particle(gammaMotherLabel))->GetMother(0);
2860  if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(gammaMotherLabel, fMCEvent, fInputEvent) && fMCEvent->Particle(gammaMotherLabel)->GetPdgCode()==310){
2861  weightedSec= ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetWeightForMeson(secMotherLabel, fMCEvent, fInputEvent)/2.; //invariant mass is additive thus the weight for the daughters has to be devide by two for the K0s at a certain pt
2862  }
2863  }
2864  hESDTrueSecondaryMotherPi0GGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec*weightMatBudget);
2865  }
2866  }
2867  }
2868 
2869  if( !isTruePi0 && !isTrueEta ){ // Background
2870  if( gammaMotherLabel > -1 && virtualGammaMotherLabel > -1 && virtualGamma == 0 ){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
2871  hESDTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2872  } else { // No photon or without mother
2873  hESDTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2874  }
2875  }
2876  }
2877 }
2878 
2879 //______________________________________________________________________
2881 {
2882 
2883 
2884 
2885  if( TrueGammaCandidate->GetV0Index() < fESDEvent->GetNumberOfV0s() ){
2886 
2887 
2888 
2889  //Checking gamma
2890 
2891  Int_t gammaMCLabel = TrueGammaCandidate->GetMCParticleLabel(fMCEvent);
2892  Int_t gammaMotherLabel = -1;
2893 
2894 
2895 
2896  if( gammaMCLabel != -1){// Gamma is Combinatorial; MC Particles don't belong to the same Mother
2897  // Daughters Gamma 0
2898 
2899  TParticle * negativeMC = (TParticle*)TrueGammaCandidate->GetNegativeMCDaughter(fMCEvent);
2900  TParticle * positiveMC = (TParticle*)TrueGammaCandidate->GetPositiveMCDaughter(fMCEvent);
2901  TParticle * gammaMC = (TParticle*)fMCEvent->Particle(gammaMCLabel);
2902 
2903  if( TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11 ){ // Electrons ...
2904  if( negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() == 5 ){ // ... From Conversion ...
2905  if(gammaMC->GetPdgCode() == 22){ // ... with Gamma Mother
2906  gammaMotherLabel=gammaMC->GetFirstMother();
2907  }
2908  }
2909  }
2910  }
2911 
2912 
2913 
2914  //Checking jpsi
2915 
2916  Int_t jpsiMCLabel = TruejpsiCandidate->GetMCParticleLabel(fMCEvent);
2917  Int_t jpsiMotherLabel = -1;
2918 
2919 
2920 
2921  if( jpsiMCLabel != -1 ){
2922 
2923  TParticle * negativeMC = (TParticle*)TruejpsiCandidate->GetNegativeMCDaughter(fMCEvent);
2924  TParticle * positiveMC = (TParticle*)TruejpsiCandidate->GetPositiveMCDaughter(fMCEvent);
2925  TParticle * jpsiMC = (TParticle*)fMCEvent->Particle(jpsiMCLabel);
2926 
2927  if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2928 
2929 
2930  if(jpsiMC->GetPdgCode() == 443){
2931 
2932  jpsiMotherLabel=jpsiMC->GetFirstMother();
2933 
2934  }
2935 
2936 
2937  }
2938  }
2939 
2940 
2941  if( gammaMotherLabel>=0 && ( gammaMotherLabel == jpsiMotherLabel) ){
2942  if( ((TParticle*)fMCEvent->Particle(jpsiMotherLabel))->GetPdgCode() == 445 ||
2943  ((TParticle*)fMCEvent->Particle(jpsiMotherLabel))->GetPdgCode() == 10443 ||
2944  ((TParticle*)fMCEvent->Particle(jpsiMotherLabel))->GetPdgCode() == 20443 ){
2945 
2946  hESDTrueMotherChiCInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2947  hESDTrueMotherChiCDiffInvMassPt[fiCut]->Fill(Pi0Candidate->M()-TruejpsiCandidate->M(),Pi0Candidate->Pt());
2948  }
2949  }
2950 
2951  }
2952 }
2953 
2954 
2955 
2956 //________________________________________________________________________
2958 
2959  previousEventEP=previousEventEP+TMath::Pi();
2960  thisEventEP=thisEventEP+TMath::Pi();
2961  Double_t rotationValue= thisEventEP-previousEventEP;
2962  gamma->RotateZ(rotationValue);
2963 }
2964 
2965 
2966 //________________________________________________________________________
2968  //see header file for documentation
2969 
2970  Double_t dx = vertex->fX - fESDEvent->GetPrimaryVertex()->GetX();
2971  Double_t dy = vertex->fY - fESDEvent->GetPrimaryVertex()->GetY();
2972  Double_t dz = vertex->fZ - fESDEvent->GetPrimaryVertex()->GetZ();
2973 
2974  Double_t movedPlace[3] = {particle->GetConversionX() - dx,particle->GetConversionY() - dy,particle->GetConversionZ() - dz};
2975  particle->SetConversionPoint(movedPlace);
2976 }
2977 
2978 
2979 //________________________________________________________________________
2981 
2982  // Using standard function for setting Cuts
2983  Bool_t selectPrimaries=kTRUE;
2984  AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
2985  EsdTrackCuts->SetMaxDCAToVertexZ(2);
2986  EsdTrackCuts->SetEtaRange(-0.8, 0.8);
2987  EsdTrackCuts->SetPtRange(0.15);
2988  EsdTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kBoth);
2989 
2991  for(Int_t iTracks = 0; iTracks < fESDEvent->GetNumberOfTracks(); iTracks++){
2992  AliESDtrack* curTrack = fESDEvent->GetTrack(iTracks);
2993  if(!curTrack) continue;
2994  if(EsdTrackCuts->AcceptTrack(curTrack) ) fNumberOfESDTrackskBoth++;
2995  }
2996  delete EsdTrackCuts;
2997  EsdTrackCuts=0x0;
2998 
2999  return;
3000 }
3001 
3002 //_____________________________________________________________________________
3004 {
3005 
3006 // Loop over all primary MC particle
3007 
3008  for(Int_t i = 0; i < fMCEvent->GetNumberOfPrimaries(); i++) {
3009 
3010  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
3011  if (!particle) continue;
3012 
3013  Bool_t mcIsFromMB = kTRUE;
3014  Int_t isMCFromMBHeader = -1;
3015 
3016  if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 0) {
3017  isMCFromMBHeader = ((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(i,fMCEvent,fInputEvent);
3018  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetSignalRejection() != 3) continue;
3019  if(isMCFromMBHeader != 2) mcIsFromMB = kFALSE;
3020  }
3021 
3022  if(((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kFALSE)){
3023  hMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
3024 
3025  if( IsPi0DalitzDaughter( i ) == kTRUE ){
3026 
3027  hMCAllGammaPi0Pt[fiCut]->Fill(particle->Pt());
3028 
3029  }
3030 
3031 
3032 
3033  }
3034 
3035  if(((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kTRUE)){
3036 
3037  hMCConvGammaPt[fiCut]->Fill(particle->Pt());
3038 
3039  if(fDoMesonQA > 0 ) {
3040  hMCConvGammaEta[fiCut]->Fill( particle->Eta());
3041  if(mcIsFromMB) {
3042  hMCConvGammaR[fiCut]->Fill( ((TParticle*)fMCEvent->Particle(particle->GetFirstDaughter()))->R() );
3043  hMCConvGammaPtR[fiCut]->Fill( particle->Pt(), ((TParticle*)fMCEvent->Particle(particle->GetFirstDaughter()))->R() );
3044  }
3045  }
3046 
3047  if(mcIsFromMB){
3048 
3049  hMCConvGammaRSPt[fiCut]->Fill(particle->Pt());
3050 
3051  }
3052 
3053  if( IsPi0DalitzDaughter( i ) == kTRUE ){
3054 
3055  hMCConvGammaPi0Pt[fiCut]->Fill(particle->Pt());
3056 
3057  }
3058 
3059  } // Converted MC Gamma
3060 
3061  if(((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->ElectronIsSelectedMC(i,fMCEvent)){
3062  if( particle->GetPdgCode() == -11) {
3063  hMCAllPositronsPt[fiCut]->Fill(particle->Pt()); // All positrons
3064  if(fDoMesonQA > 0 ) hMCAllPositronsEta[fiCut]->Fill( particle->Eta() );
3065 
3066  if ( particle->GetMother(0) > -1 && particle->GetMother(0) < fMCEvent->GetNumberOfPrimaries() ) {
3067 
3068  if( IsPi0DalitzDaughter( i ) == kTRUE ){
3069  hMCDecayPositronPi0Pt[fiCut]->Fill(particle->Pt()); //Positrons from Pi0->Dalitz
3070  }
3071 
3072  }
3073  }
3074  if( particle->GetPdgCode() == 11){
3075  hMCAllElectronsPt[fiCut]->Fill(particle->Pt()); // All electrons
3076  if (fDoMesonQA > 0 ) hMCAllElectronsEta[fiCut]->Fill(particle->Eta()); // All electrons
3077 
3078  if ( particle->GetMother(0) > -1 && particle->GetMother(0) < fMCEvent->GetNumberOfPrimaries() ) {
3079 
3080  if( IsPi0DalitzDaughter( i ) == kTRUE ){
3081  hMCDecayElectronPi0Pt[fiCut]->Fill(particle->Pt()); //Electrons from Pi0->Dalitz
3082  }
3083 
3084  }
3085 
3086  }
3087  }
3088 
3089  if(((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->MesonIsSelectedMC( particle,fMCEvent,((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetEtaShift() ) ){
3090  Float_t weighted= 1;
3091  if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoWeights() ) {
3092  if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
3093  if (particle->Pt()>0.005){
3094  weighted= ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetWeightForMeson(i, fMCEvent,fInputEvent);
3095  }
3096  }
3097  }
3098  if(particle->GetPdgCode() == 111)hMCPi0GGPt[fiCut]->Fill( particle->Pt() , weighted); // All MC Pi0 GG decay
3099  if(particle->GetPdgCode() == 221)hMCEtaGGPt[fiCut]->Fill( particle->Pt() , weighted); // All MC Eta GG decay
3100  }
3101 
3102 
3103  Int_t labelgamma = -1;
3104  Int_t labelelectron = -1;
3105  Int_t labelpositron = -1;
3106 
3107 
3108  if( ((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->MesonIsSelectedMCDalitz(particle,fMCEvent,labelelectron,labelpositron,labelgamma,((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetEtaShift())){
3109  Float_t weighted= 1;
3110  if( ((AliDalitzElectronCuts*) fCutElectronArray->At(fiCut))->DoWeights() ) {
3111  if(((AliConvEventCuts*)fCutEventArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent,fInputEvent)){
3112  if (particle->Pt()>0.005){
3113  weighted= ((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetWeightForMeson(i, fMCEvent,fInputEvent);
3114  }
3115  }
3116  }
3117  if(particle->GetPdgCode() == 111){
3118  hMCPi0Pt[fiCut]->Fill(particle->Pt(), weighted); // All MC Pi0
3119  hMCPi0WOWeightPt[fiCut]->Fill(particle->Pt());
3120 
3121  }
3122  if(particle->GetPdgCode() == 221)hMCEtaPt[fiCut]->Fill(particle->Pt(), weighted); // All MC Eta
3123 
3124  // Check the acceptance for gamma and electrons
3125 
3126  TParticle *gamma = fMCEvent->Particle(labelgamma);
3127  TParticle *electron = fMCEvent->Particle(labelelectron);
3128  TParticle *positron = fMCEvent->Particle(labelpositron);
3129 
3130 
3131  if(((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->PhotonIsSelectedMC(gamma,fMCEvent,kFALSE) &&
3132  ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->ElectronIsSelectedMC(labelelectron,fMCEvent) &&
3133  ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->ElectronIsSelectedMC(labelpositron,fMCEvent) ) {
3134 
3135  Double_t massDalitz = -1;
3136  Double_t angleGammaEpos = -1;
3137  Double_t angleGammaEneg = -1;
3138  Double_t massGammaEpos = -1;
3139  Double_t massGammaEneg = -1;
3140 
3141  if( fDoMesonQA > 0 ){
3142 
3143  TLorentzVector TLVEpos,TLVEneg,TLVgamma,TLVDalitz,TLVGammaEpos,TLVGammaEneg;
3144  Double_t electronMass = TDatabasePDG::Instance()->GetParticle( ::kElectron )->Mass();
3145  TLVEpos.SetXYZM(positron->Px(),positron->Py(),positron->Pz(),electronMass);
3146  TLVEneg.SetXYZM(electron->Px(),electron->Py(),electron->Pz(),electronMass);
3147  TLVgamma.SetXYZM(gamma->Px(),gamma->Py(),gamma->Pz(),0);
3148 
3149  TVector3 V3gamma(gamma->Px(),gamma->Py(),gamma->Pz());
3150  angleGammaEpos = V3gamma.Angle(TLVEpos.Vect());
3151  angleGammaEneg = V3gamma.Angle(TLVEneg.Vect());
3152 
3153  TLVDalitz = TLVEpos + TLVEneg ;
3154  massDalitz = TLVDalitz.M();
3155  TLVGammaEpos = TLVEpos + TLVgamma;
3156  TLVGammaEneg = TLVEneg + TLVgamma;
3157 
3158  massGammaEpos = TLVGammaEpos.M();
3159  massGammaEneg = TLVGammaEneg.M();
3160 
3161 
3162 
3163  }
3164 
3165  if(particle->GetPdgCode() == 111){
3166 
3167  hMCPi0InAccPt[fiCut]->Fill(particle->Pt() , weighted); // MC Pi0Dalitz with gamma and e+e- in acc
3168  hMCPi0WOWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 with gamma in acc NOT weighted
3169  hMCPi0DalitzGammaPt[fiCut]->Fill( gamma->Pt() );
3170  hMCPi0DalitzPositronPt[fiCut]->Fill( positron->Pt() );
3171  hMCPi0DalitzElectronPt[fiCut]->Fill( electron->Pt() );
3172 
3173 
3174 
3175  if ( fDoMesonQA > 0 ){
3176 
3177  hMCPi0EposEnegInvMassPt[fiCut]->Fill(massDalitz,particle->Pt());
3178  hMCPi0InAccOpeningAngleGammaElectron[fiCut]->Fill(angleGammaEpos);
3179  hMCPi0InAccOpeningAngleGammaElectron[fiCut]->Fill(angleGammaEneg);
3180 
3181  if ( fDoMesonQA > 1 ) {
3182 
3183  Double_t sMCDalitzPlot[2] = {massGammaEneg*massGammaEneg,massGammaEpos*massGammaEpos};
3184 
3185  sMCPi0DalitzPlot[fiCut]->Fill(sMCDalitzPlot);
3186 
3187  }
3188 
3189  }
3190  }
3191  if(particle->GetPdgCode() == 221){
3192  hMCEtaInAccPt[fiCut]->Fill(particle->Pt(), weighted ); // MC EtaDalitz with gamma and e+e- in acc
3193  if( fDoMesonQA > 0 ) hMCEtaEposEnegInvMassPt[fiCut]->Fill( massDalitz, particle->Pt());
3194  }
3195  }
3196  }
3197 
3198  Int_t labelgammaChiC=-1;
3199  Int_t labelpositronChiC=-1;
3200  Int_t labelelectronChiC=-1;
3201 
3202  if(((AliConversionMesonCuts*)fCutMesonArray->At(fiCut))->MesonIsSelectedMCChiC(particle,fMCEvent,labelelectronChiC,labelpositronChiC,labelgammaChiC,((AliConvEventCuts*)fCutEventArray->At(fiCut))->GetEtaShift())){
3203 
3204  hMCChiCPt[fiCut]->Fill(particle->Pt()); // All MC ChiC
3205  TParticle * gammaChiC =fMCEvent->Particle(labelgammaChiC);
3206 
3207  if( ((AliConversionPhotonCuts*)fCutGammaArray->At(fiCut))->PhotonIsSelectedMC( gammaChiC,fMCEvent,kFALSE) &&
3208  ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->ElectronIsSelectedMC(labelelectronChiC,fMCEvent) &&
3209  ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->ElectronIsSelectedMC(labelpositronChiC,fMCEvent) ){
3210  hMCChiCInAccPt[fiCut]->Fill(particle->Pt()); // All MC ChiC
3211  }
3212  }
3213  }
3214 }
3215 
3216 //_____________________________________________________________________________
3218 {
3219 
3220  if( fMCMother->GetNDaughters() != 3 ) return kFALSE;
3221  if( fMCMother->GetPdgCode() != 111 && fMCMother->GetPdgCode() != 221 ) return kFALSE;
3222 
3223 
3224  TParticle *positron = 0x0;
3225  TParticle *electron = 0x0;
3226  TParticle *gamma = 0x0;
3227 
3228  for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
3229  TParticle* temp = (TParticle*)fMCEvent->Particle( index );
3230  switch( temp->GetPdgCode() ) {
3231  case ::kPositron:
3232  positron = temp;
3233  break;
3234  case ::kElectron:
3235  electron = temp;
3236  break;
3237  case ::kGamma:
3238  gamma = temp;
3239  break;
3240  }
3241  }
3242 
3243  if( positron && electron && gamma) return kTRUE;
3244 
3245  return kFALSE;
3246 }
3247 
3248 //_____________________________________________________________________________________
3250 {
3251 //
3252 // Returns true if the particle comes from Pi0 -> e+ e- gamma
3253 //
3254  Int_t motherLabel = fMCEvent->Particle( label )->GetMother(0);
3255 
3256  if( motherLabel < 0 || motherLabel >= fMCEvent->GetNumberOfTracks() ) return kFALSE;
3257 
3258  TParticle* mother = fMCEvent->Particle( motherLabel );
3259 
3260  if( mother->GetPdgCode() != 111 ) return kFALSE;
3261 
3262  if( IsDalitz( mother ) ) return kTRUE;
3263 
3264  return kFALSE;
3265 
3266 }
3267 
3269 {
3270 
3271  AliESDtrack *positronVgamma = 0;
3272  AliESDtrack *electronVgamma = 0;
3273 
3274  Double_t clsToFPos = -1.0;
3275  Double_t clsToFNeg = -1.0;
3276 
3277  Double_t NumClsITSPos = -1.0;
3278  Double_t NumClsITSNeg = -1.0;
3279  Double_t NumClsTPCPos = -1.0;
3280  Double_t NumClsTPCNeg = -1.0;
3281  Double_t nCrossedRowsTPCPos = -1.0;
3282  Double_t nCrossedRowsTPCNeg = -1.0;
3283 
3284  Float_t dcaToVertexXYPos = -1.0;
3285  Float_t dcaToVertexZPos = -1.0;
3286  Float_t dcaToVertexXYNeg = -1.0;
3287  Float_t dcaToVertexZNeg = -1.0;
3288 
3289  Double_t nSigmaPosTPC = -999.;
3290  Double_t nSigmaNegTPC = -999.;
3291 
3292  positronVgamma = fESDEvent->GetTrack( Vgamma->GetTrackLabelPositive() );
3293  electronVgamma = fESDEvent->GetTrack( Vgamma->GetTrackLabelNegative() );
3294  clsToFPos = ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetNFindableClustersTPC(positronVgamma);
3295  clsToFNeg = ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetNFindableClustersTPC(electronVgamma);
3296 
3297  nSigmaPosTPC = ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetPIDResponse()->NumberOfSigmasTPC(positronVgamma, AliPID::kElectron) ;
3298  nSigmaNegTPC = ((AliDalitzElectronCuts*)fCutElectronArray->At(fiCut))->GetPIDResponse()->NumberOfSigmasTPC(electronVgamma, AliPID::kElectron) ;
3299 
3300  NumClsITSPos = positronVgamma->GetNcls(0); //Get number of ITS clusters
3301  NumClsITSNeg = electronVgamma->GetNcls(0);
3302  NumClsTPCPos = positronVgamma->GetNcls(1); //Get number of TPC clusters
3303  NumClsTPCNeg = electronVgamma->GetNcls(1);
3304 
3305  nCrossedRowsTPCPos = positronVgamma->GetTPCCrossedRows();
3306  nCrossedRowsTPCNeg = electronVgamma->GetTPCCrossedRows();
3307 
3308  Float_t bPos[2];
3309  Float_t bCovPos[3];
3310  positronVgamma->GetImpactParameters(bPos,bCovPos);
3311 
3312  if (bCovPos[0]<=0 || bCovPos[2]<=0) {
3313  AliDebug(1, "Estimated b resolution lower or equal zero!");
3314  bCovPos[0]=0; bCovPos[2]=0;
3315  }
3316 
3317  Float_t bNeg[2];
3318  Float_t bCovNeg[3];
3319  positronVgamma->GetImpactParameters(bNeg,bCovNeg);
3320 
3321  if (bCovNeg[0]<=0 || bCovNeg[2]<=0) {
3322  AliDebug(1, "Estimated b resolution lower or equal zero!");
3323  bCovNeg[0]=0; bCovNeg[2]=0;
3324  }
3325 
3326  dcaToVertexXYPos = bPos[0];
3327  dcaToVertexZPos = bPos[1];
3328  dcaToVertexXYNeg = bNeg[0];
3329  dcaToVertexZNeg = bNeg[1];
3330 
3331  if( electronVgamma->P() > 0.3 && electronVgamma->P() < 0.45 ){
3332 
3333  hESDDalitzElectronAfterEtaPCut[fiCut]->Fill( electronVgamma->Eta() );
3334  hESDDalitzElectronAfterNClsITSPCut[fiCut]->Fill( NumClsITSNeg );
3336  hESDDalitzElectronAfterNClsTPCPCut[fiCut]->Fill( NumClsTPCNeg );
3337  hESDDalitzElectronAfterNCrossedRowsTPCPCut[fiCut]->Fill( nCrossedRowsTPCNeg );
3338  }
3339  if( positronVgamma->P() > 0.3 && positronVgamma->P() < 0.45 ){
3340 
3341  hESDDalitzPositronAfterEtaPCut[fiCut]->Fill( positronVgamma->Eta() );
3342  hESDDalitzPositronAfterNClsITSPCut[fiCut]->Fill( NumClsITSPos );
3344  hESDDalitzPositronAfterNClsTPCPCut[fiCut]->Fill( NumClsTPCPos );
3345  hESDDalitzPositronAfterNCrossedRowsTPCPCut[fiCut]->Fill( nCrossedRowsTPCPos );
3346  }
3347 
3348  hESDDalitzElectronAfterPt[fiCut]->Fill( electronVgamma->Pt() );
3349  hESDDalitzPositronAfterPt[fiCut]->Fill( positronVgamma->Pt() );
3350 
3351  hESDDalitzElectronAfterEta[fiCut]->Fill( electronVgamma->Eta() );
3352  hESDDalitzPositronAfterEta[fiCut]->Fill( positronVgamma->Eta() );
3353 
3354  hESDDalitzElectronAfterPhi[fiCut]->Fill( electronVgamma->Phi() );
3355  hESDDalitzPositronAfterPhi[fiCut]->Fill( positronVgamma->Phi() );
3356 
3357  hESDDalitzElectronAfterNFindClsTPC[fiCut]->Fill(clsToFNeg,electronVgamma->Pt());
3358  hESDDalitzPositronAfterNFindClsTPC[fiCut]->Fill(clsToFPos,positronVgamma->Pt());
3359 
3360  hESDDalitzElectronAfterNClsTPC[fiCut]->Fill( NumClsTPCNeg,electronVgamma->Pt());
3361  hESDDalitzPositronAfterNClsTPC[fiCut]->Fill( NumClsTPCPos,positronVgamma->Pt());
3362 
3363  hESDDalitzElectronAfterNCrossedRowsTPC[fiCut]->Fill( nCrossedRowsTPCNeg, electronVgamma->Pt() );
3364  hESDDalitzPositronAfterNCrossedRowsTPC[fiCut]->Fill( nCrossedRowsTPCPos, positronVgamma->Pt() );
3365 
3366  hESDDalitzElectronAfterNClsITS[fiCut]->Fill( NumClsITSNeg);
3367  hESDDalitzPositronAfterNClsITS[fiCut]->Fill( NumClsITSPos);
3368 
3369  hESDDalitzPosEleAfterDCAxy[fiCut]->Fill( dcaToVertexXYNeg, electronVgamma->Pt() );
3370  hESDDalitzPosEleAfterDCAz[fiCut]->Fill( dcaToVertexZNeg, electronVgamma->Pt() );
3371  hESDDalitzPosEleAfterDCAxy[fiCut]->Fill( dcaToVertexXYPos, positronVgamma->Pt() );
3372  hESDDalitzPosEleAfterDCAz[fiCut]->Fill( dcaToVertexZPos, positronVgamma->Pt() );
3373 
3374  hESDDalitzElectronAfterTPCdEdxVsP[fiCut]->Fill( electronVgamma->P(),nSigmaNegTPC);
3375  hESDDalitzPositronAfterTPCdEdxVsP[fiCut]->Fill( positronVgamma->P(), nSigmaPosTPC);
3376 
3377  hESDDalitzElectronAfterTPCdEdxVsEta[fiCut]->Fill( electronVgamma->Eta(),nSigmaNegTPC);
3378  hESDDalitzPositronAfterTPCdEdxVsEta[fiCut]->Fill( positronVgamma->Eta(),nSigmaPosTPC);
3379 
3380  hESDDalitzElectronAfterTPCdEdxVsPhi[fiCut]->Fill( electronVgamma->Phi(),nSigmaNegTPC);
3381  hESDDalitzPositronAfterTPCdEdxVsPhi[fiCut]->Fill( positronVgamma->Phi(),nSigmaPosTPC);
3382 
3383  hESDDalitzElectronAfterTPCdEdxSignalVsP[fiCut]->Fill( electronVgamma->P(), TMath::Abs(electronVgamma->GetTPCsignal()));
3384  hESDDalitzPositronAfterTPCdEdxSignalVsP[fiCut]->Fill( positronVgamma->P(), TMath::Abs(positronVgamma->GetTPCsignal()));
3385 
3386 }
3387 
3388 //_____________________________________________________________________________
3389 Double_t AliAnalysisTaskGammaConvDalitzV1::GetPsiPairMC(const TParticle *fMCPosParticle, const TParticle *fMCNegParticle) const
3390 {
3391 
3392 
3393 
3394  TVector3 posDaughter;
3395  TVector3 negDaughter;
3396 
3397  posDaughter.SetXYZ( fMCPosParticle->Px(), fMCPosParticle->Py(), fMCPosParticle->Pz() );
3398  negDaughter.SetXYZ( fMCNegParticle->Px(), fMCNegParticle->Py(), fMCNegParticle->Pz() );
3399 
3400  Double_t deltaTheta = negDaughter.Theta() - posDaughter.Theta();
3401  Double_t openingAngle = posDaughter.Angle( negDaughter ); //TMath::ACos( posDaughter.Dot(negDaughter)/(negDaughter.Mag()*posDaughter.Mag()) );
3402 
3403  if( openingAngle < 1e-20 ) return 0.;
3404 
3405  Double_t psiAngle = TMath::ASin( deltaTheta/openingAngle );
3406 
3407  return psiAngle;
3408 
3409 
3410 }
3411 
3412 
3413 
3414 //_____________________________________________________________________________
3415 Double_t AliAnalysisTaskGammaConvDalitzV1::GetPsiPair( const AliESDtrack *trackPos, const AliESDtrack *trackNeg ) const
3416 {
3417  //
3418  // This angle is a measure for the contribution of the opening in polar
3419  // direction ?0 to the opening angle ? Pair
3420  //
3421  // Ref. Measurement of photons via conversion pairs with the PHENIX experiment at RHIC
3422  // Mas ter Thesis. Thorsten Dahms. 2005
3423  // https://twiki.cern.ch/twiki/pub/ALICE/GammaPhysicsPublications/tdahms_thesis.pdf
3424  //
3425  Double_t momPos[3];
3426  Double_t momNeg[3];
3427  if( trackPos->GetConstrainedPxPyPz(momPos) == 0 ) trackPos->GetPxPyPz( momPos );
3428  if( trackNeg->GetConstrainedPxPyPz(momNeg) == 0 ) trackNeg->GetPxPyPz( momNeg );
3429 
3430  TVector3 posDaughter;
3431  TVector3 negDaughter;
3432 
3433  posDaughter.SetXYZ( momPos[0], momPos[1], momPos[2] );
3434  negDaughter.SetXYZ( momNeg[0], momNeg[1], momNeg[2] );
3435 
3436  Double_t deltaTheta = negDaughter.Theta() - posDaughter.Theta();
3437  Double_t openingAngle = posDaughter.Angle( negDaughter ); //TMath::ACos( posDaughter.Dot(negDaughter)/(negDaughter.Mag()*posDaughter.Mag()) );
3438 
3439  if( openingAngle < 1e-20 ) return 0.;
3440 
3441  Double_t psiAngle = TMath::ASin( deltaTheta/openingAngle );
3442 
3443  return psiAngle;
3444 }
3445 
3446 //________________________________________________________________________
3448  TAxis *axisafter = histoRebin->GetXaxis();
3449  Int_t bins = axisafter->GetNbins();
3450  Double_t from = axisafter->GetXmin();
3451  Double_t to = axisafter->GetXmax();
3452  Double_t *newbins = new Double_t[bins+1];
3453  newbins[0] = from;
3454  Double_t factor = TMath::Power(to/from, 1./bins);
3455  for(Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
3456  axisafter->Set(bins, newbins);
3457  delete [] newbins;
3458 }
3459 
3460 
3461 //_________________________________________________________________________________
3463 {
3464  if(tobechecked > -1)
3465  {
3466  vector<Int_t>::iterator it;
3467  it = find (vec.begin(), vec.end(), tobechecked);
3468  if (it != vec.end()) return true;
3469  else{
3470  vec.push_back(tobechecked);
3471  return false;
3472  }
3473  }
3474  return false;
3475 }
TParticle * GetMCParticle(AliMCEvent *mcEvent)
virtual Double_t GetPy() const
void ProcessTruePhotonCandidates(AliAODConversionPhoton *)
vector< Int_t > fVectorDoubleCountTruePi0s
array of histos with double counted photons, R, pT
void SetLabels(Int_t label1, Int_t label2, Int_t label3=0)
double Double_t
Definition: External.C:58
GammaConversionVertex * GetBGEventVertex(Int_t zbin, Int_t mbin, Int_t event)
Definition: External.C:236
Double_t GetPsiPair(const AliESDtrack *trackPos, const AliESDtrack *trackNeg) const
void SetConversionPoint(Double_t convpoint[3])
vector< Int_t > GetReconstructedPositronsIndex()
virtual Double_t GetPz() const
void SetMCLabelNegative(Int_t label)
void MoveParticleAccordingToVertex(AliAODConversionPhoton *particle, const AliGammaConversionAODBGHandler::GammaConversionVertex *vertex)
Int_t GetNumberOfPrimaryTracks()
TH2F ** fHistoDoubleCountTrueEtaInvMassPt
array of histos with double counted pi0s, invMass, pT
void RotateParticleAccordingToEP(AliAODConversionPhoton *gamma, Double_t previousEventEP, Double_t thisEventEP)
TString GetPeriodName()
TParticle * GetPositiveMCDaughter(AliMCEvent *mcEvent)
void FillElectronQAHistos(AliAODConversionPhoton *Vgamma) const
Bool_t GetProduceV0FindingEfficiency()
TParticle * GetNegativeMCDaughter(AliMCEvent *mcEvent)
std::vector< AliAODConversionPhoton * > AliGammaConversionAODVector
vector< Int_t > fVectorDoubleCountTrueEtas
vector containing labels of validated pi0
int Int_t
Definition: External.C:63
Definition: External.C:204
unsigned int UInt_t
Definition: External.C:33
vector< Int_t > GetReconstructedElectronsIndex()
float Float_t
Definition: External.C:68
void SetMCLabelPositive(Int_t label)
void AddEvent(TList *const eventGammas, Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue=-100)
TH2F ** fHistoDoubleCountTrueConvGammaRPt
array of histos with double counted etas, invMass, pT
TH1I ** hNV0Tracks
array of histos with SPD tracklets vs SPD clusters for background rejection
AliConversionPhotonCuts * GetConversionCuts()
Definition: AliV0ReaderV1.h:89
vector< Int_t > fVectorDoubleCountTrueConvGammas
vector containing labels of validated eta
Class handling all kinds of selection cuts for Gamma Conversion analysis.
Int_t GetMCParticleLabel(AliMCEvent *mcEvent)
Double_t GetOpeningAngle() const
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
AliDalitzElectronCuts * GetDalitzElectronCuts()
Double_t centMax
void SetTrackLabels(Int_t label1, Int_t label2)
AliGammaConversionAODVector * GetBGGoodV0s(Int_t zbin, Int_t mbin, Int_t event)
virtual Double_t GetPx() const
Definition: External.C:220
Class handling all kinds of selection cuts for Gamma Conversion analysis.
TClonesArray * GetReconstructedGammas() const
Definition: AliV0ReaderV1.h:85
Class handling all kinds of selection cuts for Gamma Conversion analysis.
Bool_t IsDalitz(TParticle *fMCMother) const
AliConvEventCuts * GetEventCuts()
Definition: AliV0ReaderV1.h:90
const char Option_t
Definition: External.C:48
void ProcessTrueChicCandidates(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate, AliAODConversionPhoton *TruejpsiCandidate)
bool Bool_t
Definition: External.C:53
Bool_t CheckVectorForDoubleCount(vector< Int_t > &vec, Int_t tobechecked)
void ProcessTrueMesonCandidates(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate, AliAODConversionPhoton *TrueVirtualGammaCandidate)
Double_t GetPsiPairMC(const TParticle *fMCPosParticle, const TParticle *fMCNegParticle) const
void CalculateDistanceOfClossetApproachToPrimVtx(const AliVVertex *primVertex)
AliGammaConversionAODBGHandler ** fBGHandler
Double_t GetConversionRadius() const
TList * GetV0FindingEfficiencyHistograms()
Double_t centMin