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