AliPhysics  5e2c166 (5e2c166)
AliAnalysisTaskGammaCaloDalitzV1.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, Baldo Sahlmueller, Friederike Bock *
5  * Version 1.0 *
6  * *
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 
18 //----------------------------------------------------------------
19 // Class used to do analysis on conversion photons + calo photons
20 //----------------------------------------------------------------
22 #include "TChain.h"
23 #include "TTree.h"
24 #include "TBranch.h"
25 #include "TFile.h"
26 #include "TH1F.h"
27 #include "TH2F.h"
28 #include "TH3F.h"
29 #include "THnSparse.h"
30 #include "TCanvas.h"
31 #include "TNtuple.h"
32 #include "TDatabasePDG.h"
33 #include "AliAnalysisTask.h"
34 #include "AliAnalysisManager.h"
35 #include "AliESDEvent.h"
36 #include "AliESDInputHandler.h"
37 #include "AliMCEventHandler.h"
38 #include "AliMCEvent.h"
39 #include "AliMCParticle.h"
40 #include "AliCentrality.h"
41 #include "AliESDVZERO.h"
42 #include "AliESDpid.h"
44 #include "AliVParticle.h"
45 #include "AliESDtrack.h"
46 #include "AliESDtrackCuts.h"
47 #include "AliKFVertex.h"
48 #include "AliV0ReaderV1.h"
49 #include "AliGenCocktailEventHeader.h"
51 #include "AliAODMCParticle.h"
52 #include "AliAODMCHeader.h"
53 #include "AliEventplane.h"
55 #include "AliAODEvent.h"
56 #include "AliAODInputHandler.h"
57 #include "AliESDEvent.h"
58 #include "AliESDInputHandler.h"
59 #include "AliInputEventHandler.h"
60 #include "AliCaloTrackMatcher.h"
61 #include <vector>
62 
64 
65 //________________________________________________________________________
67  fV0Reader(NULL),
68  fV0ReaderName("V0ReaderV1"),
69  fElecSelector(NULL),
70  fBGClusHandler(NULL),
71  fInputEvent(NULL),
72  fMCEvent(NULL),
73  fCutFolder(NULL),
74  fESDList(NULL),
75  fBackList(NULL),
76  fMotherList(NULL),
77  fPhotonDCAList(NULL),
78  fTrueList(NULL),
79  fMCList(NULL),
80  fHeaderNameList(NULL),
81  fClusterOutputList(NULL),
82  fOutputContainer(NULL),
83  fReaderGammas(NULL),
84  fSelectorElectronIndex(0),
85  fSelectorPositronIndex(0),
86  fGammaCandidates(NULL),
87  fClusterCandidates(NULL),
88  fVirtualGammaCandidates(NULL),
89  fEventCutArray(NULL),
90  fEventCuts(NULL),
91  fGammaCutArray(NULL),
92  fElectronCutArray(NULL),
93  fConversionCuts(NULL),
94  fClusterCutArray(NULL),
95  fCaloPhotonCuts(NULL),
96  fMesonCutArray(NULL),
97  fMesonCuts(NULL),
98  fHistoConvGammaPt(NULL),
99  fHistoConvGammaR(NULL),
100  fHistoConvGammaEta(NULL),
101  fHistoDalitzElectronPt(NULL),
102  fHistoDalitzPositronPt(NULL),
103  fHistoDalitzElectronPhi(NULL),
104  fHistoDalitzPositronPhi(NULL),
105  fPtGamma(0),
106  fDCAzPhoton(0),
107  fRConvPhoton(0),
108  fEtaPhoton(0),
109  fCharCatPhoton(0),
110  fCharPhotonMCInfo(0),
111  fHistoMotherInvMassPt(NULL),
112  fHistoMotherInvMassOpeningAngleGammaElectron(NULL),
113  fHistoMotherMatchedInvMassPt(NULL),
114  fSparseMotherInvMassPtZM(NULL),
115  fHistoMotherBackInvMassPt(NULL),
116  fSparseMotherBackInvMassPtZM(NULL),
117  fHistoMotherInvMassEalpha(NULL),
118  fHistoMotherPi0PtY(NULL),
119  fHistoMotherEtaPtY(NULL),
120  fHistoMotherPi0PtAlpha(NULL),
121  fHistoMotherEtaPtAlpha(NULL),
122  fHistoMotherPi0PtOpenAngle(NULL),
123  fHistoMotherEtaPtOpenAngle(NULL),
124  fHistoMotherPi0ConvPhotonEtaPhi(NULL),
125  fHistoMotherEtaConvPhotonEtaPhi(NULL),
126  fHistoMotherInvMassECalib(NULL),
127  fHistoMotherInvMassECalibalpha(NULL),
128  fHistoClusGammaPt(NULL),
129  fHistoClusOverlapHeadersGammaPt(NULL),
130  fHistoMCHeaders(NULL),
131  fHistoMCAllGammaPt(NULL),
132  fHistoMCAllGammaPi0Pt(NULL),
133  fHistoMCAllGammaEMCALAccPt(NULL),
134  fHistoMCDecayGammaPi0Pt(NULL),
135  fHistoMCDecayGammaRhoPt(NULL),
136  fHistoMCDecayGammaEtaPt(NULL),
137  fHistoMCDecayGammaOmegaPt(NULL),
138  fHistoMCDecayGammaEtapPt(NULL),
139  fHistoMCDecayGammaPhiPt(NULL),
140  fHistoMCDecayGammaSigmaPt(NULL),
141  fHistoMCConvGammaPt(NULL),
142  fHistoMCConvGammaR(NULL),
143  fHistoMCConvGammaEta(NULL),
144  fHistoMCAllPositronsPt(NULL),
145  fHistoMCDecayPositronPi0Pt(NULL),
146  fHistoMCAllElectronsPt(NULL),
147  fHistoMCDecayElectronPi0Pt(NULL),
148  fHistoMCDecayNoPrimElectronPi0DalitzR(NULL),
149  fHistoMCDecayNoPrimPositronPi0DalitzR(NULL),
150  fHistoMCDecayNoPrimElectronPi0DalitzID(NULL),
151  fHistoMCDecayNoPrimPositronPi0DalitzID(NULL),
152  fHistoMCPi0GGPt(NULL),
153  fHistoMCPi0GGWOWeightPt(NULL),
154  fHistoMCPi0Pt(NULL),
155  fHistoMCPi0WOWeightPt(NULL),
156  fHistoMCEtaGGPt(NULL),
157  fHistoMCEtaGGWOWeightPt(NULL),
158  fHistoMCEtaPt(NULL),
159  fHistoMCEtaWOWeightPt(NULL),
160  fHistoMCPi0InAccPt(NULL),
161  fHistoMCPi0InAccOpeningAngleGammaElectron(NULL),
162  fHistoMCEtaInAccPt(NULL),
163  fHistoMCPi0PtY(NULL),
164  fHistoMCEtaPtY(NULL),
165  fHistoMCPi0PtAlpha(NULL),
166  fHistoMCEtaPtAlpha(NULL),
167  fHistoMCK0sPt(NULL),
168  fHistoMCK0sWOWeightPt(NULL),
169  fHistoMCK0sPtY(NULL),
170  fHistoTruePi0InvMassPt(NULL),
171  fHistoTrueEtaInvMassPt(NULL),
172  fHistoTruePi0ShowerInvMassPt(NULL),
173  fHistoTrueEtaShowerInvMassPt(NULL),
174  fHistoTruePi0NoShowerInvMassPt(NULL),
175  fHistoTrueEtaNoShowerInvMassPt(NULL),
176  fHistoTruePi0OpeningAngleGammaElectron(NULL),
177  fHistoTruePi0GGInvMassPt(NULL),
178  fHistoTrueEtaGGInvMassPt(NULL),
179  fHistoTruePi0CaloPhotonInvMassPt(NULL),
180  fHistoTrueEtaCaloPhotonInvMassPt(NULL),
181  fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
182  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt(NULL),
183  fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
184  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt(NULL),
185  fHistoTruePi0CaloElectronInvMassPt(NULL),
186  fHistoTrueEtaCaloElectronInvMassPt(NULL),
187  fHistoTruePi0CaloMergedClusterInvMassPt(NULL),
188  fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
189  fHistoTrueMotherCaloEMNonLeadingInvMassPt(NULL),
190  fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
191  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
192  fHistoTruePrimaryPi0InvMassPt(NULL),
193  fHistoTruePrimaryPi0GGInvMassPt(NULL),
194  fHistoTruePrimaryEtaInvMassPt(NULL),
195  fHistoTruePrimaryEtaGGInvMassPt(NULL),
196  fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
197  fHistoTruePrimaryEtaW0WeightingInvMassPt(NULL),
198  fProfileTruePrimaryPi0WeightsInvMassPt(NULL),
199  fProfileTruePrimaryEtaWeightsInvMassPt(NULL),
200  fHistoTruePrimaryPi0MCPtResolPt(NULL),
201  fHistoTruePrimaryEtaMCPtResolPt(NULL),
202  fHistoTrueMotherPi0ConvPhotonEtaPhi(NULL),
203  fHistoTrueMotherEtaConvPhotonEtaPhi(NULL),
204  fHistoTrueSecondaryPi0InvMassPt(NULL),
205  fHistoTrueSecondaryPi0GGInvMassPt(NULL),
206  fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
207  fHistoTrueK0sWithPi0DaughterMCPt(NULL),
208  fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
209  fHistoTrueEtaWithPi0DaughterMCPt(NULL),
210  fHistoTrueSecondaryPi0FromLambdaInvMassPt(NULL),
211  fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
212  fHistoTrueBckGGInvMassPt(NULL),
213  fHistoTrueBckContInvMassPt(NULL),
214  fHistoTruePi0PtY(NULL),
215  fHistoTrueEtaPtY(NULL),
216  fHistoTruePi0PtAlpha(NULL),
217  fHistoTrueEtaPtAlpha(NULL),
218  fHistoTruePi0PtOpenAngle(NULL),
219  fHistoTrueEtaPtOpenAngle(NULL),
220  fHistoTrueConvGammaPt(NULL),
221  fHistoTrueConvPi0GammaPt(NULL),
222  fHistoTrueConvGammaEta(NULL),
223  fHistoTruePositronPt(NULL),
224  fHistoTrueElectronPt(NULL),
225  fHistoTrueSecPositronPt(NULL),
226  fHistoTrueSecElectronPt(NULL),
227  fHistoTruePi0DalitzPositronPt(NULL),
228  fHistoTruePi0DalitzElectronPt(NULL),
229  fHistoTruePi0DalitzSecPositronPt(NULL),
230  fHistoTruePi0DalitzSecElectronPt(NULL),
231  fHistoTruePrimaryConvGammaPt(NULL),
232  fHistoTruePrimaryConvGammaESDPtMCPt(NULL),
233  fHistoTrueSecondaryConvGammaPt(NULL),
234  fHistoTrueSecondaryConvGammaFromXFromK0sPt(NULL),
235  fHistoTrueSecondaryConvGammaFromXFromLambdaPt(NULL),
236  fHistoTrueClusGammaPt(NULL),
237  fHistoTrueClusUnConvGammaPt(NULL),
238  fHistoTrueClusUnConvGammaMCPt(NULL),
239  fHistoTrueClusElectronPt(NULL),
240  fHistoTrueClusConvGammaPt(NULL),
241  fHistoTrueClusConvGammaMCPt(NULL),
242  fHistoTrueClusConvGammaFullyPt(NULL),
243  fHistoTrueClusMergedGammaPt(NULL),
244  fHistoTrueClusMergedPartConvGammaPt(NULL),
245  fHistoTrueClusDalitzPt(NULL),
246  fHistoTrueClusDalitzMergedPt(NULL),
247  fHistoTrueClusPhotonFromElecMotherPt(NULL),
248  fHistoTrueClusShowerPt(NULL),
249  fHistoTrueClusSubLeadingPt(NULL),
250  fHistoTrueClusNParticles(NULL),
251  fHistoTrueClusEMNonLeadingPt(NULL),
252  fHistoTrueNLabelsInClus(NULL),
253  fHistoTruePrimaryClusGammaPt(NULL),
254  fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
255  fHistoTruePi0DalitzClusGammaPt(NULL),
256  fHistoTruePi0DalitzAllClusGammaPt(NULL),
257  fHistoTruePi0DalitzClusGammaMCPt(NULL),
258  fHistoTruePrimaryPi0PhotonPairPtconv(NULL),
259  fHistoTruePrimaryPi0DCPtconv(NULL),
260  fHistoTruePrimaryPi0MissingPtconv(NULL),
261  fHistoTruePrimaryEtaPhotonPairPtconv(NULL),
262  fHistoTruePrimaryEtaDCPtconv(NULL),
263  fHistoTruePrimaryEtaMissingPtconv(NULL),
264  fHistoTrueSecondaryPi0PhotonPairPtconv(NULL),
265  fHistoTrueSecondaryPi0DCPtconv(NULL),
266  fHistoTrueSecondaryPi0MissingPtconv(NULL),
267  fStringRecTruePi0s(NULL),
268  fStringRecTrueEtas(NULL),
269  fHistoDoubleCountTruePi0InvMassPt(NULL),
270  fHistoDoubleCountTrueEtaInvMassPt(NULL),
271  fHistoDoubleCountTrueConvGammaRPt(NULL),
272  fVectorDoubleCountTruePi0s(0),
273  fVectorDoubleCountTrueEtas(0),
274  fVectorDoubleCountTrueConvGammas(0),
275  fHistoNEvents(NULL),
276  fHistoNGoodESDTracks(NULL),
277  fHistoNGammaCandidates(NULL),
278  fHistoNGoodESDTracksVsNGammaCanditates(NULL),
279  fHistoSPDClusterTrackletBackground(NULL),
280  fHistoNV0Tracks(NULL),
281  fProfileEtaShift(NULL),
282  fEventPlaneAngle(-100),
283  fRandom(0),
284  fNGammaCandidates(0),
285  fUnsmearedPx(NULL),
286  fUnsmearedPy(NULL),
287  fUnsmearedPz(NULL),
288  fUnsmearedE(NULL),
289  fMCEventPos(NULL),
290  fMCEventNeg(NULL),
291  fESDArrayPos(NULL),
292  fESDArrayNeg(NULL),
293  fnCuts(0),
294  fiCut(0),
295  fMoveParticleAccordingToVertex(kTRUE),
296  fIsHeavyIon(0),
297  fDoMesonAnalysis(kTRUE),
298  fDoMesonQA(0),
299  fDoPhotonQA(0),
300  fDoClusterQA(0),
301  fIsFromMBHeader(kTRUE),
302  fIsOverlappingWithOtherHeader(kFALSE),
303  fIsMC(kFALSE),
304  fDoTHnSparse(kTRUE),
305  fTrackMatcherRunningMode(0)
306 {
307 
308 }
309 
310 //________________________________________________________________________
312  AliAnalysisTaskSE(name),
313  fV0Reader(NULL),
314  fV0ReaderName("V0ReaderV1"),
315  fElecSelector(NULL),
316  fBGClusHandler(NULL),
317  fInputEvent(NULL),
318  fMCEvent(NULL),
319  fCutFolder(NULL),
320  fESDList(NULL),
321  fBackList(NULL),
322  fMotherList(NULL),
323  fPhotonDCAList(NULL),
324  fTrueList(NULL),
325  fMCList(NULL),
326  fHeaderNameList(NULL),
327  fClusterOutputList(NULL),
328  fOutputContainer(0),
329  fReaderGammas(NULL),
330  fSelectorElectronIndex(0),
331  fSelectorPositronIndex(0),
332  fGammaCandidates(NULL),
333  fClusterCandidates(NULL),
334  fVirtualGammaCandidates(NULL),
335  fEventCutArray(NULL),
336  fEventCuts(NULL),
337  fGammaCutArray(NULL),
338  fElectronCutArray(NULL),
339  fConversionCuts(NULL),
340  fClusterCutArray(NULL),
341  fCaloPhotonCuts(NULL),
342  fMesonCutArray(NULL),
343  fMesonCuts(NULL),
344  fHistoConvGammaPt(NULL),
345  fHistoConvGammaR(NULL),
346  fHistoConvGammaEta(NULL),
347  fHistoDalitzElectronPt(NULL),
348  fHistoDalitzPositronPt(NULL),
349  fHistoDalitzElectronPhi(NULL),
350  fHistoDalitzPositronPhi(NULL),
351  fPtGamma(0),
352  fDCAzPhoton(0),
353  fRConvPhoton(0),
354  fEtaPhoton(0),
355  fCharCatPhoton(0),
356  fCharPhotonMCInfo(0),
357  fHistoMotherInvMassPt(NULL),
358  fHistoMotherInvMassOpeningAngleGammaElectron(NULL),
359  fHistoMotherMatchedInvMassPt(NULL),
360  fSparseMotherInvMassPtZM(NULL),
361  fHistoMotherBackInvMassPt(NULL),
362  fSparseMotherBackInvMassPtZM(NULL),
363  fHistoMotherInvMassEalpha(NULL),
364  fHistoMotherPi0PtY(NULL),
365  fHistoMotherEtaPtY(NULL),
366  fHistoMotherPi0PtAlpha(NULL),
367  fHistoMotherEtaPtAlpha(NULL),
368  fHistoMotherPi0PtOpenAngle(NULL),
369  fHistoMotherEtaPtOpenAngle(NULL),
370  fHistoMotherPi0ConvPhotonEtaPhi(NULL),
371  fHistoMotherEtaConvPhotonEtaPhi(NULL),
372  fHistoMotherInvMassECalib(NULL),
373  fHistoMotherInvMassECalibalpha(NULL),
374  fHistoClusGammaPt(NULL),
375  fHistoClusOverlapHeadersGammaPt(NULL),
376  fHistoMCHeaders(NULL),
377  fHistoMCAllGammaPt(NULL),
378  fHistoMCAllGammaPi0Pt(NULL),
379  fHistoMCAllGammaEMCALAccPt(NULL),
380  fHistoMCDecayGammaPi0Pt(NULL),
381  fHistoMCDecayGammaRhoPt(NULL),
382  fHistoMCDecayGammaEtaPt(NULL),
383  fHistoMCDecayGammaOmegaPt(NULL),
384  fHistoMCDecayGammaEtapPt(NULL),
385  fHistoMCDecayGammaPhiPt(NULL),
386  fHistoMCDecayGammaSigmaPt(NULL),
387  fHistoMCConvGammaPt(NULL),
388  fHistoMCConvGammaR(NULL),
389  fHistoMCConvGammaEta(NULL),
390  fHistoMCAllPositronsPt(NULL),
391  fHistoMCDecayPositronPi0Pt(NULL),
392  fHistoMCAllElectronsPt(NULL),
393  fHistoMCDecayElectronPi0Pt(NULL),
394  fHistoMCDecayNoPrimElectronPi0DalitzR(NULL),
395  fHistoMCDecayNoPrimPositronPi0DalitzR(NULL),
396  fHistoMCDecayNoPrimElectronPi0DalitzID(NULL),
397  fHistoMCDecayNoPrimPositronPi0DalitzID(NULL),
398  fHistoMCPi0GGPt(NULL),
399  fHistoMCPi0GGWOWeightPt(NULL),
400  fHistoMCPi0Pt(NULL),
401  fHistoMCPi0WOWeightPt(NULL),
402  fHistoMCEtaGGPt(NULL),
403  fHistoMCEtaGGWOWeightPt(NULL),
404  fHistoMCEtaPt(NULL),
405  fHistoMCEtaWOWeightPt(NULL),
406  fHistoMCPi0InAccPt(NULL),
407  fHistoMCPi0InAccOpeningAngleGammaElectron(NULL),
408  fHistoMCEtaInAccPt(NULL),
409  fHistoMCPi0PtY(NULL),
410  fHistoMCEtaPtY(NULL),
411  fHistoMCPi0PtAlpha(NULL),
412  fHistoMCEtaPtAlpha(NULL),
413  fHistoMCK0sPt(NULL),
414  fHistoMCK0sWOWeightPt(NULL),
415  fHistoMCK0sPtY(NULL),
416  fHistoTruePi0InvMassPt(NULL),
417  fHistoTrueEtaInvMassPt(NULL),
418  fHistoTruePi0ShowerInvMassPt(NULL),
419  fHistoTrueEtaShowerInvMassPt(NULL),
420  fHistoTruePi0NoShowerInvMassPt(NULL),
421  fHistoTrueEtaNoShowerInvMassPt(NULL),
422  fHistoTruePi0OpeningAngleGammaElectron(NULL),
423  fHistoTruePi0GGInvMassPt(NULL),
424  fHistoTrueEtaGGInvMassPt(NULL),
425  fHistoTruePi0CaloPhotonInvMassPt(NULL),
426  fHistoTrueEtaCaloPhotonInvMassPt(NULL),
427  fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
428  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt(NULL),
429  fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
430  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt(NULL),
431  fHistoTruePi0CaloElectronInvMassPt(NULL),
432  fHistoTrueEtaCaloElectronInvMassPt(NULL),
433  fHistoTruePi0CaloMergedClusterInvMassPt(NULL),
434  fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
435  fHistoTrueMotherCaloEMNonLeadingInvMassPt(NULL),
436  fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
437  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
438  fHistoTruePrimaryPi0InvMassPt(NULL),
439  fHistoTruePrimaryPi0GGInvMassPt(NULL),
440  fHistoTruePrimaryEtaInvMassPt(NULL),
441  fHistoTruePrimaryEtaGGInvMassPt(NULL),
442  fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
443  fHistoTruePrimaryEtaW0WeightingInvMassPt(NULL),
444  fProfileTruePrimaryPi0WeightsInvMassPt(NULL),
445  fProfileTruePrimaryEtaWeightsInvMassPt(NULL),
446  fHistoTruePrimaryPi0MCPtResolPt(NULL),
447  fHistoTruePrimaryEtaMCPtResolPt(NULL),
448  fHistoTrueMotherPi0ConvPhotonEtaPhi(NULL),
449  fHistoTrueMotherEtaConvPhotonEtaPhi(NULL),
450  fHistoTrueSecondaryPi0InvMassPt(NULL),
451  fHistoTrueSecondaryPi0GGInvMassPt(NULL),
452  fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
453  fHistoTrueK0sWithPi0DaughterMCPt(NULL),
454  fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
455  fHistoTrueEtaWithPi0DaughterMCPt(NULL),
456  fHistoTrueSecondaryPi0FromLambdaInvMassPt(NULL),
457  fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
458  fHistoTrueBckGGInvMassPt(NULL),
459  fHistoTrueBckContInvMassPt(NULL),
460  fHistoTruePi0PtY(NULL),
461  fHistoTrueEtaPtY(NULL),
462  fHistoTruePi0PtAlpha(NULL),
463  fHistoTrueEtaPtAlpha(NULL),
464  fHistoTruePi0PtOpenAngle(NULL),
465  fHistoTrueEtaPtOpenAngle(NULL),
466  fHistoTrueConvGammaPt(NULL),
467  fHistoTrueConvPi0GammaPt(NULL),
468  fHistoTrueConvGammaEta(NULL),
469  fHistoTruePositronPt(NULL),
470  fHistoTrueElectronPt(NULL),
471  fHistoTrueSecPositronPt(NULL),
472  fHistoTrueSecElectronPt(NULL),
473  fHistoTruePi0DalitzPositronPt(NULL),
474  fHistoTruePi0DalitzElectronPt(NULL),
475  fHistoTruePi0DalitzSecPositronPt(NULL),
476  fHistoTruePi0DalitzSecElectronPt(NULL),
477  fHistoTruePrimaryConvGammaPt(NULL),
478  fHistoTruePrimaryConvGammaESDPtMCPt(NULL),
479  fHistoTrueSecondaryConvGammaPt(NULL),
480  fHistoTrueSecondaryConvGammaFromXFromK0sPt(NULL),
481  fHistoTrueSecondaryConvGammaFromXFromLambdaPt(NULL),
482  fHistoTrueClusGammaPt(NULL),
483  fHistoTrueClusUnConvGammaPt(NULL),
484  fHistoTrueClusUnConvGammaMCPt(NULL),
485  fHistoTrueClusElectronPt(NULL),
486  fHistoTrueClusConvGammaPt(NULL),
487  fHistoTrueClusConvGammaMCPt(NULL),
488  fHistoTrueClusConvGammaFullyPt(NULL),
489  fHistoTrueClusMergedGammaPt(NULL),
490  fHistoTrueClusMergedPartConvGammaPt(NULL),
491  fHistoTrueClusDalitzPt(NULL),
492  fHistoTrueClusDalitzMergedPt(NULL),
493  fHistoTrueClusPhotonFromElecMotherPt(NULL),
494  fHistoTrueClusShowerPt(NULL),
495  fHistoTrueClusSubLeadingPt(NULL),
496  fHistoTrueClusNParticles(NULL),
497  fHistoTrueClusEMNonLeadingPt(NULL),
498  fHistoTrueNLabelsInClus(NULL),
499  fHistoTruePrimaryClusGammaPt(NULL),
500  fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
501  fHistoTruePi0DalitzClusGammaPt(NULL),
502  fHistoTruePi0DalitzAllClusGammaPt(NULL),
503  fHistoTruePi0DalitzClusGammaMCPt(NULL),
504  fHistoTruePrimaryPi0PhotonPairPtconv(NULL),
505  fHistoTruePrimaryPi0DCPtconv(NULL),
506  fHistoTruePrimaryPi0MissingPtconv(NULL),
507  fHistoTruePrimaryEtaPhotonPairPtconv(NULL),
508  fHistoTruePrimaryEtaDCPtconv(NULL),
509  fHistoTruePrimaryEtaMissingPtconv(NULL),
510  fHistoTrueSecondaryPi0PhotonPairPtconv(NULL),
511  fHistoTrueSecondaryPi0DCPtconv(NULL),
512  fHistoTrueSecondaryPi0MissingPtconv(NULL),
513  fStringRecTruePi0s(NULL),
514  fStringRecTrueEtas(NULL),
515  fHistoDoubleCountTruePi0InvMassPt(NULL),
516  fHistoDoubleCountTrueEtaInvMassPt(NULL),
517  fHistoDoubleCountTrueConvGammaRPt(NULL),
518  fVectorDoubleCountTruePi0s(0),
519  fVectorDoubleCountTrueEtas(0),
520  fVectorDoubleCountTrueConvGammas(0),
521  fHistoNEvents(NULL),
522  fHistoNGoodESDTracks(NULL),
523  fHistoNGammaCandidates(NULL),
524  fHistoNGoodESDTracksVsNGammaCanditates(NULL),
525  fHistoSPDClusterTrackletBackground(NULL),
526  fHistoNV0Tracks(NULL),
527  fProfileEtaShift(NULL),
528  fEventPlaneAngle(-100),
529  fRandom(0),
530  fNGammaCandidates(0),
531  fUnsmearedPx(NULL),
532  fUnsmearedPy(NULL),
533  fUnsmearedPz(NULL),
534  fUnsmearedE(NULL),
535  fMCEventPos(NULL),
536  fMCEventNeg(NULL),
537  fESDArrayPos(NULL),
538  fESDArrayNeg(NULL),
539  fnCuts(0),
540  fiCut(0),
541  fMoveParticleAccordingToVertex(kTRUE),
542  fIsHeavyIon(0),
543  fDoMesonAnalysis(kTRUE),
544  fDoMesonQA(0),
545  fDoPhotonQA(0),
546  fDoClusterQA(0),
547  fIsFromMBHeader(kTRUE),
548  fIsOverlappingWithOtherHeader(kFALSE),
549  fIsMC(kFALSE),
550  fDoTHnSparse(kTRUE),
551  fTrackMatcherRunningMode(0)
552 {
553  // Define output slots here
554  DefineOutput(1, TList::Class());
555 }
556 
558 {
559  if(fGammaCandidates){
560  delete fGammaCandidates;
561  fGammaCandidates = 0x0;
562  }
563  if(fClusterCandidates){
564  delete fClusterCandidates;
565  fClusterCandidates = 0x0;
566  }
570  }
571 
572  if(fBGClusHandler){
573  delete[] fBGClusHandler;
574  fBGClusHandler = 0x0;
575  }
576 
577 }
578 //___________________________________________________________
580 
581  const Int_t nDim = 4;
582  Int_t nBins[nDim] = {800,250,7,4};
583  Double_t xMin[nDim] = {0,0, 0,0};
584  Double_t xMax[nDim] = {0.8,25,7,4};
585 
586  if( fDoTHnSparse ) {
587 
588  fSparseMotherInvMassPtZM = new THnSparseF*[fnCuts];
589  fSparseMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
590 
591  }
592 
593 
595 
596  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
597 
598  if (((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
599  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
600  TString cutstringPhoton = ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutNumber();
601  TString cutstringElectron = ((AliDalitzElectronCuts*)fElectronCutArray->At(iCut))->GetCutNumber();
602  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
603  TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
604 
605  Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(0,1));
606  Int_t centMin = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(1,1));
607  Int_t centMax = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(2,1));
608 
609  if(collisionSystem == 1 || collisionSystem == 2 ||
610  collisionSystem == 5 || collisionSystem == 8 ||
611  collisionSystem == 9){
612  centMin = centMin*10;
613  centMax = centMax*10;
614  if(centMax ==0 && centMax!=centMin) centMax=100;
615  } else if(collisionSystem == 3 || collisionSystem == 6){
616  centMin = centMin*5;
617  centMax = centMax*5;
618  } else if(collisionSystem == 4 || collisionSystem == 7){
619  centMin = ((centMin*5)+45);
620  centMax = ((centMax*5)+45);
621  }
622 
623  if( fDoTHnSparse ) {
624 
625  fBackList[iCut] = new TList();
626  fBackList[iCut]->SetName(Form("%s_%s_%s_%s_%s Back histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringElectron.Data(),cutstringCalo.Data(), cutstringMeson.Data()));
627  fBackList[iCut]->SetOwner(kTRUE);
628  fCutFolder[iCut]->Add(fBackList[iCut]);
629 
630  fSparseMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m","Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
631  fBackList[iCut]->Add(fSparseMotherBackInvMassPtZM[iCut]);
632 
633  fMotherList[iCut] = new TList();
634  fMotherList[iCut]->SetName(Form("%s_%s_%s_%s_%s Mother histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringElectron.Data(),cutstringCalo.Data(), cutstringMeson.Data()));
635  fMotherList[iCut]->SetOwner(kTRUE);
636  fCutFolder[iCut]->Add(fMotherList[iCut]);
637 
638  fSparseMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
639  fMotherList[iCut]->Add(fSparseMotherInvMassPtZM[iCut]);
640 
641  }
642 
643  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
644 
645 
647  collisionSystem,centMin,centMax,
648  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
649  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity(),
650  2,8,7);
651 
652  }
653  }
654  }
655 }
656 //________________________________________________________________________
658 
659  // Create histograms
660  if(fOutputContainer != NULL){
661  delete fOutputContainer;
662  fOutputContainer = NULL;
663  }
664  if(fOutputContainer == NULL){
665  fOutputContainer = new TList();
666  fOutputContainer->SetOwner(kTRUE);
667  }
668 
669  // Array of current cut's gammas
670  fGammaCandidates = new TList();
671  fClusterCandidates = new TList();
672  fClusterCandidates->SetOwner(kTRUE);
674  fVirtualGammaCandidates->SetOwner(kTRUE);
675 
676  fCutFolder = new TList*[fnCuts];
677  fESDList = new TList*[fnCuts];
678  fBackList = new TList*[fnCuts];
679  fMotherList = new TList*[fnCuts];
680  fHistoNEvents = new TH1I*[fnCuts];
685  fHistoNV0Tracks = new TH1I*[fnCuts];
686  fProfileEtaShift = new TProfile*[fnCuts];
687  fHistoConvGammaPt = new TH1F*[fnCuts];
688 
689  if (fDoPhotonQA == 2){
690  fPhotonDCAList = new TList*[fnCuts];
691 
692  }
693  if (fDoPhotonQA > 0){
694  fHistoConvGammaR = new TH1F*[fnCuts];
695  fHistoConvGammaEta = new TH1F*[fnCuts];
696  }
697 
698  fHistoDalitzElectronPt = new TH1F*[fnCuts];
699  fHistoDalitzPositronPt = new TH1F*[fnCuts];
700  fHistoDalitzElectronPhi = new TH1F*[fnCuts];
701  fHistoDalitzPositronPhi = new TH1F*[fnCuts];
702 
703 
704  if(fDoMesonAnalysis){
709  if (fDoMesonQA > 0){
719  }
720  if(fDoMesonQA == 1){
723  }
724  }
725 
727  fHistoClusGammaPt = new TH1F*[fnCuts];
729 
730  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
731  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
732  TString cutstringPhoton = ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutNumber();
733  TString cutstringElectron = ((AliDalitzElectronCuts*)fElectronCutArray->At(iCut))->GetCutNumber();
734  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
735  TString cutstringMeson = "NoMesonCut";
736  if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
737 
738  fCutFolder[iCut] = new TList();
739  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s_%s_%s",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringElectron.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
740  fCutFolder[iCut]->SetOwner(kTRUE);
741  fOutputContainer->Add(fCutFolder[iCut]);
742  fESDList[iCut] = new TList();
743  fESDList[iCut]->SetName(Form("%s_%s_%s_%s_%s ESD histograms", cutstringEvent.Data(),cutstringPhoton.Data(),cutstringElectron.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
744  fESDList[iCut]->SetOwner(kTRUE);
745  fCutFolder[iCut]->Add(fESDList[iCut]);
746 
747  fHistoNEvents[iCut] = new TH1I("NEvents","NEvents",14,-0.5,13.5);
748  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
749  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
750  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
751  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
752  TString TriggerNames = "Not Trigger: ";
753  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
754  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
755  } else {
756  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
757  }
758  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
759  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
760  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
761  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
762  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
763  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
764  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
765  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
766  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
767  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
768  fESDList[iCut]->Add(fHistoNEvents[iCut]);
769 
770  if(fIsHeavyIon == 1) fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
771  else if(fIsHeavyIon == 2) fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",400,0,400);
772  else fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
773  fHistoNGoodESDTracks[iCut]->SetXTitle("# TPC tracks");
774  fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
775 
776  if(fIsHeavyIon == 1) fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",100,0,100);
777  else if(fIsHeavyIon == 2) fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
778  else fHistoNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
779  fHistoNGammaCandidates[iCut]->SetXTitle("# accepted $#gamma_{conv}");
780  fESDList[iCut]->Add(fHistoNGammaCandidates[iCut]);
781 
782  if(fIsHeavyIon == 1) fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",4000,0,4000,100,0,100);
783  else if(fIsHeavyIon == 2) fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",400,0,400,50,0,50);
784  else fHistoNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",200,0,200,50,0,50);
785  fHistoNGoodESDTracksVsNGammaCanditates[iCut]->SetXTitle("# TPC tracks");
786  fHistoNGoodESDTracksVsNGammaCanditates[iCut]->SetYTitle("# accepted $#gamma_{calo}");
788 
789  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters","SPD tracklets vs SPD clusters",100,0,200,250,0,1000);
791 
792  if(fIsHeavyIon == 1) fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
793  else if(fIsHeavyIon == 2) fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
794  else fHistoNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
795  fHistoNV0Tracks[iCut]->SetXTitle("VZERO amp [arb. units]");
796  fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
797  fProfileEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
798  fESDList[iCut]->Add(fProfileEtaShift[iCut]);
799  fHistoConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",250,0,25);
800  fHistoConvGammaPt[iCut]->SetXTitle("p_{T,conv} (GeV/c)");
801  fESDList[iCut]->Add(fHistoConvGammaPt[iCut]);
802 
803  if (fDoPhotonQA == 2){
804  fPhotonDCAList[iCut] = new TList();
805  fPhotonDCAList[iCut]->SetName(Form("%s_%s_%s_%s Photon DCA tree",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
806  fPhotonDCAList[iCut]->SetOwner(kTRUE);
807  fCutFolder[iCut]->Add(fPhotonDCAList[iCut]);
808 
809 
810  }
811 
812  if (fDoPhotonQA > 0){
813  fHistoConvGammaR[iCut] = new TH1F("ESD_ConvGamma_R","ESD_ConvGamma_R",800,0,200);
814  fHistoConvGammaR[iCut]->SetXTitle("R_{conv} (cm)");
815  fESDList[iCut]->Add(fHistoConvGammaR[iCut]);
816  fHistoConvGammaEta[iCut] = new TH1F("ESD_ConvGamma_Eta","ESD_ConvGamma_Eta",2000,-2,2);
817  fHistoConvGammaEta[iCut]->SetXTitle("#eta_{conv}");
818  fESDList[iCut]->Add(fHistoConvGammaEta[iCut]);
819  }
820 
821 
822 
823 
824 
825  fHistoDalitzElectronPt[iCut] = new TH1F("ESD_DalitzElectron_Pt","ESD_DalitzElectron_Pt",1000,0,25);
826  fESDList[iCut]->Add(fHistoDalitzElectronPt[iCut]);
827 
828  fHistoDalitzPositronPt[iCut] = new TH1F("ESD_DalitzPositron_Pt","ESD_DalitzPositron_Pt",1000,0,25);
829  fESDList[iCut]->Add(fHistoDalitzPositronPt[iCut]);
830 
831  fHistoDalitzElectronPhi[iCut] = new TH1F("ESD_DalitzElectron_Phi","ESD_DalitzElectron_Phi",360,0,2*TMath::Pi());
832  fESDList[iCut]->Add(fHistoDalitzElectronPhi[iCut]);
833 
834  fHistoDalitzPositronPhi[iCut] = new TH1F("ESD_DalitzPositron_Phi","ESD_DalitzPositron_Phi",360,0,2*TMath::Pi());
835  fESDList[iCut]->Add(fHistoDalitzPositronPhi[iCut]);
836 
837 
838 
839 
840 
841 
842 
843  fClusterOutputList[iCut] = new TList();
844  fClusterOutputList[iCut]->SetName(Form("%s_%s_%s_%s_%s Cluster Output",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringElectron.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
845  fClusterOutputList[iCut]->SetOwner(1);
846  fCutFolder[iCut]->Add(fClusterOutputList[iCut]);
847 
848  fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt","ClusGamma_Pt",250,0,25);
849  fHistoClusGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
850  fClusterOutputList[iCut]->Add(fHistoClusGammaPt[iCut]);
851  fHistoClusOverlapHeadersGammaPt[iCut] = new TH1F("ClusGammaOverlapHeaders_Pt","ClusGammaOverlapHeaders_Pt",250,0,25);
852  fHistoClusOverlapHeadersGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c), selected header w/ overlap");
854 
855  if(fDoMesonAnalysis){
856 
857  fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",800,0,0.8,250,0,25);
858  fHistoMotherInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
859  fHistoMotherInvMassPt[iCut]->SetYTitle("p_{T,pair} (GeV/c)");
860  fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
861 
862  fHistoMotherMatchedInvMassPt[iCut] = new TH2F("ESD_MotherMatched_InvMass_Pt","ESD_MotherMatched_InvMass_Pt",800,0,0.8,250,0,25);
863  fHistoMotherMatchedInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) matched conv e^{+/-} to cluster");
864  fHistoMotherMatchedInvMassPt[iCut]->SetYTitle("p_{T,pair} (GeV/c)");
865  fESDList[iCut]->Add(fHistoMotherMatchedInvMassPt[iCut]);
866 
867  fHistoMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt","ESD_Background_InvMass_Pt",800,0,0.8,250,0,25);
868  fHistoMotherBackInvMassPt[iCut]->SetXTitle("M_{inv, mxed} (GeV/c^{2})");
869  fHistoMotherBackInvMassPt[iCut]->SetYTitle("p_{T,BG pair} (GeV/c)");
870  fESDList[iCut]->Add(fHistoMotherBackInvMassPt[iCut]);
871 
872  fHistoMotherInvMassEalpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_E_alpha","ESD_Mother_InvMass_vs_E_alpha",800,0,0.8,250,0,25);
873  fHistoMotherInvMassEalpha[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
874  fHistoMotherInvMassEalpha[iCut]->SetYTitle("p_{T,pair} (GeV/c)");
875  fESDList[iCut]->Add(fHistoMotherInvMassEalpha[iCut]);
876 
877  if( fDoMesonQA > 0 ) {
878  fHistoMotherInvMassOpeningAngleGammaElectron[iCut] = new TH1F("ESD_MotherInvMass_OpeningAngle_GammaElectron", "ESD_MotherInvMass_OpeningAngle_GammaElectron",100,0.,TMath::Pi());
880  }
881 
882  }
883  }
884 
885  if(fDoMesonAnalysis){
886  InitBack(); // Init Background Handler
887  }
888 
889  if(fIsMC){
890  // MC Histogramms
891  fMCList = new TList*[fnCuts];
892  // True Histogramms
893  fTrueList = new TList*[fnCuts];
894  // Selected Header List
895  fHeaderNameList = new TList*[fnCuts];
896  fHistoMCHeaders = new TH1I*[fnCuts];
897  fHistoMCAllGammaPt = new TH1F*[fnCuts];
898  fHistoMCAllGammaPi0Pt = new TH1F*[fnCuts];
899  fHistoMCAllGammaEMCALAccPt = new TH1F*[fnCuts];
900  fHistoMCDecayGammaPi0Pt = new TH1F*[fnCuts];
901  fHistoMCDecayGammaRhoPt = new TH1F*[fnCuts];
902  fHistoMCDecayGammaEtaPt = new TH1F*[fnCuts];
903  fHistoMCDecayGammaOmegaPt = new TH1F*[fnCuts];
904  fHistoMCDecayGammaEtapPt = new TH1F*[fnCuts];
905  fHistoMCDecayGammaPhiPt = new TH1F*[fnCuts];
906  fHistoMCDecayGammaSigmaPt = new TH1F*[fnCuts];
907  fHistoMCConvGammaPt = new TH1F*[fnCuts];
908  fHistoMCAllPositronsPt = new TH1F*[fnCuts];
909  fHistoMCDecayPositronPi0Pt = new TH1F*[fnCuts];
910  fHistoMCAllElectronsPt = new TH1F*[fnCuts];
911  fHistoMCDecayElectronPi0Pt = new TH1F*[fnCuts];
916 
917 
918  fHistoTrueConvGammaPt = new TH1F*[fnCuts];
920  fHistoTrueConvPi0GammaPt = new TH1F*[fnCuts];
921  fHistoTruePositronPt = new TH1F*[fnCuts];
922  fHistoTrueElectronPt = new TH1F*[fnCuts];
923  fHistoTrueSecPositronPt = new TH1F*[fnCuts];
924  fHistoTrueSecElectronPt = new TH1F*[fnCuts];
929 
930 
931 
932 
938 
939  fHistoTrueClusGammaPt = new TH1F*[fnCuts];
942 
946 
947  if (fDoPhotonQA > 0){
948 
949  fHistoMCConvGammaR = new TH1F*[fnCuts];
950  fHistoMCConvGammaEta = new TH1F*[fnCuts];
951  fHistoTrueConvGammaEta = new TH1F*[fnCuts];
952 
953  }
954 
955 
956  if (fDoClusterQA > 0){
957 
958  fHistoTrueClusUnConvGammaPt = new TH1F*[fnCuts];
960  fHistoTrueClusElectronPt = new TH1F*[fnCuts];
961  fHistoTrueClusConvGammaPt = new TH1F*[fnCuts];
962  fHistoTrueClusConvGammaMCPt = new TH1F*[fnCuts];
964  fHistoTrueClusMergedGammaPt = new TH1F*[fnCuts];
966  fHistoTrueClusDalitzPt = new TH1F*[fnCuts];
969  fHistoTrueClusShowerPt = new TH1F*[fnCuts];
970  fHistoTrueClusSubLeadingPt = new TH1F*[fnCuts];
973  fHistoTrueNLabelsInClus = new TH1F*[fnCuts];
974  }
975 
976 
977  if(fDoMesonAnalysis){
978 
979  fHistoMCPi0GGPt = new TH1F*[fnCuts];
980  fHistoMCPi0GGWOWeightPt = new TH1F*[fnCuts];
981  fHistoMCPi0Pt = new TH1F*[fnCuts];
982  fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
983 
984  fHistoMCEtaGGPt = new TH1F*[fnCuts];
985  fHistoMCEtaGGWOWeightPt = new TH1F*[fnCuts];
986  fHistoMCEtaPt = new TH1F*[fnCuts];
987  fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
988 
989  fHistoMCPi0InAccPt = new TH1F*[fnCuts];
990 
991  fHistoMCEtaInAccPt = new TH1F*[fnCuts];
992 
1015  fHistoTruePrimaryPi0DCPtconv = new TH1F*[fnCuts];
1017  fHistoTruePrimaryEtaDCPtconv = new TH1F*[fnCuts];
1023 
1024 
1025  if (fDoMesonQA > 0){
1026 
1027  fHistoMCPi0PtY = new TH2F*[fnCuts];
1028  fHistoMCEtaPtY = new TH2F*[fnCuts];
1029  fHistoMCPi0PtAlpha = new TH2F*[fnCuts];
1030  fHistoMCEtaPtAlpha = new TH2F*[fnCuts];
1031  fHistoMCK0sPt = new TH1F*[fnCuts];
1032  fHistoMCK0sWOWeightPt = new TH1F*[fnCuts];
1033  fHistoMCK0sPtY = new TH2F*[fnCuts];
1054  fHistoTruePi0PtY = new TH2F*[fnCuts];
1055  fHistoTrueEtaPtY = new TH2F*[fnCuts];
1068 
1069  }
1070  }
1071 
1072  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1073 
1074  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
1075  TString cutstringPhoton = ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutNumber();
1076  TString cutstringElectron = ((AliDalitzElectronCuts*)fElectronCutArray->At(iCut))->GetCutNumber();
1077  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
1078  TString cutstringMeson = "NoMesonCut";
1079  if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
1080 
1081  fMCList[iCut] = new TList();
1082  fMCList[iCut]->SetName(Form("%s_%s_%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringElectron.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1083  fMCList[iCut]->SetOwner(kTRUE);
1084  fCutFolder[iCut]->Add(fMCList[iCut]);
1085  fHistoMCHeaders[iCut] = new TH1I("MC_Headers","MC_Headers",20,0,20);
1086  fMCList[iCut]->Add(fHistoMCHeaders[iCut]);
1087  fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",250,0,25);
1088  fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
1089 
1090  fHistoMCAllGammaPi0Pt[iCut] = new TH1F("MC_AllGammaPi0_Pt","MC_AllGammaPi0_Pt",250,0,25);
1091  fMCList[iCut]->Add(fHistoMCAllGammaPi0Pt[iCut]);
1092 
1093  fHistoMCAllGammaEMCALAccPt[iCut] = new TH1F("MC_AllGammaEMCALAcc_Pt","MC_AllGammaEMCALAcc_Pt",250,0,25);
1094  fMCList[iCut]->Add(fHistoMCAllGammaEMCALAccPt[iCut]);
1095  fHistoMCDecayGammaPi0Pt[iCut] = new TH1F("MC_DecayGammaPi0_Pt","MC_DecayGammaPi0_Pt",250,0,25);
1096  fMCList[iCut]->Add(fHistoMCDecayGammaPi0Pt[iCut]);
1097  fHistoMCDecayGammaRhoPt[iCut] = new TH1F("MC_DecayGammaRho_Pt","MC_DecayGammaRho_Pt",250,0,25);
1098  fMCList[iCut]->Add(fHistoMCDecayGammaRhoPt[iCut]);
1099  fHistoMCDecayGammaEtaPt[iCut] = new TH1F("MC_DecayGammaEta_Pt","MC_DecayGammaEta_Pt",250,0,25);
1100  fMCList[iCut]->Add(fHistoMCDecayGammaEtaPt[iCut]);
1101  fHistoMCDecayGammaOmegaPt[iCut] = new TH1F("MC_DecayGammaOmega_Pt","MC_DecayGammaOmmega_Pt",250,0,25);
1102  fMCList[iCut]->Add(fHistoMCDecayGammaOmegaPt[iCut]);
1103  fHistoMCDecayGammaEtapPt[iCut] = new TH1F("MC_DecayGammaEtap_Pt","MC_DecayGammaEtap_Pt",250,0,25);
1104  fMCList[iCut]->Add(fHistoMCDecayGammaEtapPt[iCut]);
1105  fHistoMCDecayGammaPhiPt[iCut] = new TH1F("MC_DecayGammaPhi_Pt","MC_DecayGammaPhi_Pt",250,0,25);
1106  fMCList[iCut]->Add(fHistoMCDecayGammaPhiPt[iCut]);
1107  fHistoMCDecayGammaSigmaPt[iCut] = new TH1F("MC_DecayGammaSigma_Pt","MC_DecayGammaSigma_Pt",250,0,25);
1108  fMCList[iCut]->Add(fHistoMCDecayGammaSigmaPt[iCut]);
1109  fHistoMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt","MC_ConvGamma_Pt",250,0,25);
1110  fMCList[iCut]->Add(fHistoMCConvGammaPt[iCut]);
1111 
1112  fHistoMCAllPositronsPt[iCut] = new TH1F("MC_AllPositrons_Pt","MC_AllPositrons_Pt",1000,0,25);
1113  fMCList[iCut]->Add(fHistoMCAllPositronsPt[iCut]);
1114 
1115 
1116  fHistoMCDecayPositronPi0Pt[iCut] = new TH1F("MC_DecayPositronPi0_Pt","MC_DecayPositronPi0_Pt",1000,0,25);
1117  fMCList[iCut]->Add(fHistoMCDecayPositronPi0Pt[iCut]);
1118 
1119  fHistoMCAllElectronsPt[iCut] = new TH1F("MC_AllElectrons_Pt","MC_AllElectrons_Pt",1000,0,25);
1120  fMCList[iCut]->Add(fHistoMCAllElectronsPt[iCut]);
1121 
1122  fHistoMCDecayElectronPi0Pt[iCut] = new TH1F("MC_DecayElectronPi0_Pt","MC_DecayElectronPi0_Pt",1000,0,25);
1123  fMCList[iCut]->Add(fHistoMCDecayElectronPi0Pt[iCut]);
1124 
1125  fHistoMCDecayNoPrimElectronPi0DalitzR[iCut] = new TH1F("MC_DecayNoPrimElectronPi0Dalitz_R","MC_DecayNoPrimElectronPi0Dalitz_R",200,0,200);
1127 
1128  fHistoMCDecayNoPrimPositronPi0DalitzR[iCut] = new TH1F("MC_DecayNoPrimPositronPi0Dalitz_R","MC_DecayNoPrimPositronPi0Dalitz_R",200,0,200);
1130 
1131  fHistoMCDecayNoPrimElectronPi0DalitzID[iCut] = new TH1F("MC_DecayNoPrimElectronPi0Dalitz_ID","MC_DecayNoPrimElectronPi0Dalitz_ID",51,-1,50);
1133 
1134  fHistoMCDecayNoPrimPositronPi0DalitzID[iCut] = new TH1F("MC_DecayNoPrimPositronPi0Dalitz_ID","MC_DecayNoPrimPositronPi0Dalitz_ID",51,-1,50);
1136 
1137 
1138 
1139  if (fDoPhotonQA > 0){
1140 
1141  fHistoMCConvGammaR[iCut] = new TH1F("MC_ConvGamma_R","MC_ConvGamma_R",800,0,200);
1142  fMCList[iCut]->Add(fHistoMCConvGammaR[iCut]);
1143  fHistoMCConvGammaEta[iCut] = new TH1F("MC_ConvGamma_Eta","MC_ConvGamma_Eta",2000,-2,2);
1144  fMCList[iCut]->Add(fHistoMCConvGammaEta[iCut]);
1145 
1146  }
1147 
1148  if(fDoMesonAnalysis){
1149 
1150  fHistoMCPi0GGPt[iCut] = new TH1F("MC_Pi0_GG_Pt","MC_Pi0_GG_Pt",250,0,25);
1151  fHistoMCPi0GGPt[iCut]->Sumw2();
1152  fMCList[iCut]->Add(fHistoMCPi0GGPt[iCut]);
1153  fHistoMCPi0GGWOWeightPt[iCut] = new TH1F("MC_Pi0_GG_WOWeights_Pt","MC_Pi0_GG_WOWeights_Pt",250,0,25);
1154  fHistoMCPi0GGWOWeightPt[iCut]->Sumw2();
1155  fMCList[iCut]->Add(fHistoMCPi0GGWOWeightPt[iCut]);
1156 
1157  fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt","MC_Pi0_Pt",250,0,25);
1158  fHistoMCPi0Pt[iCut]->Sumw2();
1159 
1160  fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
1161  fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt","MC_Pi0_WOWeights_Pt",250,0,25);
1162  fHistoMCPi0WOWeightPt[iCut]->Sumw2();
1163  fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
1164 
1165 
1166  fHistoMCEtaGGPt[iCut] = new TH1F("MC_Eta_GG_Pt","MC_Eta_GG_Pt",250,0,25);
1167  fHistoMCEtaGGPt[iCut]->Sumw2();
1168  fMCList[iCut]->Add(fHistoMCEtaGGPt[iCut]);
1169  fHistoMCEtaGGWOWeightPt[iCut] = new TH1F("MC_Eta_GG_WOWeights_Pt","MC_Eta_GG_WOWeights_Pt",250,0,25);
1170  fHistoMCEtaGGWOWeightPt[iCut]->Sumw2();
1171  fMCList[iCut]->Add(fHistoMCEtaGGWOWeightPt[iCut]);
1172 
1173  fHistoMCEtaPt[iCut] = new TH1F("MC_Eta_Pt","MC_Eta_Pt",250,0,25);
1174  fHistoMCEtaPt[iCut]->Sumw2();
1175  fMCList[iCut]->Add(fHistoMCEtaPt[iCut]);
1176  fHistoMCEtaWOWeightPt[iCut] = new TH1F("MC_Eta_WOWeights_Pt","MC_Eta_WOWeights_Pt",250,0,25);
1177  fHistoMCEtaWOWeightPt[iCut]->Sumw2();
1178  fMCList[iCut]->Add(fHistoMCEtaWOWeightPt[iCut]);
1179 
1180 
1181 
1182  fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt","MC_Pi0InAcc_Pt",250,0,25);
1183  fHistoMCPi0InAccPt[iCut]->Sumw2();
1184  fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
1185  fHistoMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt","MC_EtaInAcc_Pt",250,0,25);
1186  fHistoMCEtaInAccPt[iCut]->Sumw2();
1187  fMCList[iCut]->Add(fHistoMCEtaInAccPt[iCut]);
1188 
1189 
1190 
1191  if (fDoMesonQA > 0){
1192 
1193  fHistoMCPi0PtY[iCut] = new TH2F("MC_Pi0_Pt_Y","MC_Pi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1194  fHistoMCPi0PtY[iCut]->Sumw2();
1196  fMCList[iCut]->Add(fHistoMCPi0PtY[iCut]);
1197  fHistoMCEtaPtY[iCut] = new TH2F("MC_Eta_Pt_Y","MC_Eta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1198  fHistoMCEtaPtY[iCut]->Sumw2();
1200  fMCList[iCut]->Add(fHistoMCEtaPtY[iCut]);
1201  fHistoMCPi0PtAlpha[iCut] = new TH2F("MC_Pi0_Pt_Alpha","MC_Pi0_Pt_Alpha",150,0.03,15.,100,0,1);
1203  fMCList[iCut]->Add(fHistoMCPi0PtAlpha[iCut]);
1204  fHistoMCEtaPtAlpha[iCut] = new TH2F("MC_Eta_Pt_Alpha","MC_Eta_Pt_Alpha",150,0.03,15.,100,0,1);
1206  fMCList[iCut]->Add(fHistoMCEtaPtAlpha[iCut]);
1207 
1208  fHistoMCK0sPt[iCut] = new TH1F("MC_K0s_Pt","MC_K0s_Pt",150,0,15);
1209  fHistoMCK0sPt[iCut]->Sumw2();
1210  fMCList[iCut]->Add(fHistoMCK0sPt[iCut]);
1211  fHistoMCK0sWOWeightPt[iCut] = new TH1F("MC_K0s_WOWeights_Pt","MC_K0s_WOWeights_Pt",150,0,15);
1212  fHistoMCK0sWOWeightPt[iCut]->Sumw2();
1213  fMCList[iCut]->Add(fHistoMCK0sWOWeightPt[iCut]);
1214  fHistoMCK0sPtY[iCut] = new TH2F("MC_K0s_Pt_Y","MC_K0s_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1215  fHistoMCK0sPtY[iCut]->Sumw2();
1217  fMCList[iCut]->Add(fHistoMCK0sPtY[iCut]);
1218 
1219  fHistoMCPi0InAccOpeningAngleGammaElectron[iCut] = new TH1F("MC_Pi0InAcc_OpeningAngle_GammaElectron","MC_Pi0InAcc_OpeningAngle_GammaElectron",100,0,TMath::Pi());
1221 
1222 
1223  }
1224 
1225  }
1226  fTrueList[iCut] = new TList();
1227  fTrueList[iCut]->SetName(Form("%s_%s_%s_%s_%s True histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringElectron.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1228  fTrueList[iCut]->SetOwner(kTRUE);
1229  fCutFolder[iCut]->Add(fTrueList[iCut]);
1230 
1231  fHistoTrueConvGammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt","ESD_TrueConvGamma_Pt",250,0,25);
1232  fTrueList[iCut]->Add(fHistoTrueConvGammaPt[iCut]);
1233 
1234  fHistoDoubleCountTrueConvGammaRPt[iCut] = new TH2F("ESD_TrueDoubleCountConvGamma_R_Pt","ESD_TrueDoubleCountConvGamma_R_Pt",800,0,200,300,0,30);
1235  fTrueList[iCut]->Add(fHistoDoubleCountTrueConvGammaRPt[iCut]);
1236 
1237  fHistoTrueConvPi0GammaPt[iCut] = new TH1F("ESD_TrueConvPi0Gamma_Pt","ESD_TrueConvPi0Gamma_Pt",250,0,25);
1238  fTrueList[iCut]->Add(fHistoTrueConvPi0GammaPt[iCut]);
1239 
1240 
1241  fHistoTruePositronPt[iCut] = new TH1F("ESD_TruePositron_Pt","ESD_TruePositron_Pt",1000,0,25);
1242  fTrueList[iCut]->Add(fHistoTruePositronPt[iCut]);
1243 
1244  fHistoTrueElectronPt[iCut] = new TH1F("ESD_TrueElectron_Pt","ESD_TrueElectron_Pt",1000,0,25);
1245  fTrueList[iCut]->Add(fHistoTrueElectronPt[iCut]);
1246 
1247  fHistoTrueSecPositronPt[iCut] = new TH1F("ESD_TrueSecPositron_Pt","ESD_TrueSecPositron_Pt",1000,0,25);
1248  fTrueList[iCut]->Add(fHistoTrueSecPositronPt[iCut]);
1249 
1250  fHistoTrueSecElectronPt[iCut] = new TH1F("ESD_TrueSecElectron_Pt","ESD_TrueSecElectron_Pt",1000,0,25);
1251  fTrueList[iCut]->Add(fHistoTrueSecElectronPt[iCut]);
1252 
1253  fHistoTruePi0DalitzElectronPt[iCut] = new TH1F("ESD_TruePi0DalitzElectron_Pt","ESD_TruePi0DalitzElectron_Pt",1000,0,25);
1254  fTrueList[iCut]->Add(fHistoTruePi0DalitzElectronPt[iCut]);
1255 
1256  fHistoTruePi0DalitzPositronPt[iCut] = new TH1F("ESD_TruePi0DalitzPositron_Pt","ESD_TruePi0DalitzPositron_Pt",1000,0,25);
1257  fTrueList[iCut]->Add(fHistoTruePi0DalitzPositronPt[iCut]);
1258 
1259  fHistoTruePi0DalitzSecElectronPt[iCut] = new TH1F("ESD_TruePi0DalitzSecElectron_Pt","ESD_TruePi0DalitzSecElectron_Pt",1000,0,25);
1260  fTrueList[iCut]->Add(fHistoTruePi0DalitzSecElectronPt[iCut]);
1261 
1262  fHistoTruePi0DalitzSecPositronPt[iCut] = new TH1F("ESD_TruePi0DalitzSecPositron_Pt","ESD_TruePi0DalitzSecPositron_Pt",1000,0,25);
1263  fTrueList[iCut]->Add(fHistoTruePi0DalitzSecPositronPt[iCut]);
1264 
1265 
1266 
1267  fHistoTruePrimaryConvGammaPt[iCut] = new TH1F("ESD_TruePrimaryConvGamma_Pt","ESD_TruePrimaryConvGamma_Pt",250,0,25);
1268  fTrueList[iCut]->Add(fHistoTruePrimaryConvGammaPt[iCut]);
1269  fHistoTrueSecondaryConvGammaPt[iCut] = new TH1F("ESD_TrueSecondaryConvGamma_Pt","ESD_TrueSecondaryConvGamma_Pt",250,0,25);
1270  fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaPt[iCut]);
1271 
1272  fHistoTrueSecondaryConvGammaFromXFromK0sPt[iCut] = new TH1F("ESD_TrueSecondaryConvGammaFromXFromK0s_Pt", "ESD_TrueSecondaryConvGammaFromXFromK0s_Pt",250,0,25);
1274  fHistoTrueSecondaryConvGammaFromXFromLambdaPt[iCut] = new TH1F("ESD_TrueSecondaryConvGammaFromXFromLambda_Pt", "ESD_TrueSecondaryConvGammaFromXFromLambda_Pt",250,0,25);
1276 
1277  fHistoTruePrimaryConvGammaESDPtMCPt[iCut] = new TH2F("ESD_TruePrimaryConvGammaESD_PtMCPt", "ESD_TruePrimaryConvGammaESD_PtMCPt",250,0,25,250,0,25);
1279 
1280  fHistoTrueClusGammaPt[iCut] = new TH1F("TrueClusGamma_Pt","ESD_TrueClusGamma_Pt",250,0,25);
1281  fClusterOutputList[iCut]->Add(fHistoTrueClusGammaPt[iCut]);
1282  fHistoTruePrimaryClusGammaPt[iCut] = new TH1F("TruePrimaryClusGamma_Pt","ESD_TruePrimaryClusGamma_Pt",250,0,25);
1284  fHistoTruePrimaryClusGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusGamma_Pt_MCPt","ESD_TruePrimaryClusGamma_MCPt",250,0,25,250,0,25);
1286 
1287  fHistoTruePi0DalitzClusGammaPt[iCut] = new TH1F("TruePi0DalitzClusGamma_Pt","fHistoTruePi0DalitzClusGamma_Pt",250,0,25);
1289 
1290  fHistoTruePi0DalitzClusGammaMCPt[iCut]= new TH1F("TruePi0DalitzClusGamma_MCPt","fHistoTruePi0DalitzClusGamma_MCPt",250,0,25);
1292 
1293 
1294  fHistoTruePi0DalitzAllClusGammaPt[iCut] = new TH1F("TruePi0DalitzAllClusGamma_Pt","TruePi0DalitzAllClusGamma_Pt",250,0,25);
1296 
1297 
1298 
1299 
1300  if (fDoPhotonQA > 0){
1301  fHistoTrueConvGammaEta[iCut] = new TH1F("ESD_TrueConvGamma_Eta","ESD_TrueConvGamma_Eta",2000,-2,2);
1302  fTrueList[iCut]->Add(fHistoTrueConvGammaEta[iCut]);
1303  }
1304  if (fDoClusterQA > 0){
1305  fHistoTrueClusUnConvGammaPt[iCut] = new TH1F("TrueClusUnConvGamma_Pt","TrueClusUnConvGamma_Pt",250,0,25);
1307  fHistoTrueClusUnConvGammaMCPt[iCut] = new TH1F("TrueClusUnConvGamma_MCPt","TrueClusUnConvGamma_MCPt",250,0,25);
1309  fHistoTrueClusElectronPt[iCut] = new TH1F("TrueClusElectron_Pt","TrueElectronGamma_Pt",250,0,25);
1310  fClusterOutputList[iCut]->Add(fHistoTrueClusElectronPt[iCut]);
1311  fHistoTrueClusConvGammaPt[iCut] = new TH1F("TrueClusConvGamma_Pt","TrueClusConvGamma_Pt",250,0,25);
1313  fHistoTrueClusConvGammaMCPt[iCut] = new TH1F("TrueClusConvGamma_MCPt","TrueClusConvGamma_MCPt",250,0,25);
1315  fHistoTrueClusConvGammaFullyPt[iCut] = new TH1F("TrueClusConvGammaFullyContained_Pt","TrueClusConvGammaFullyContained_Pt",250,0,25);
1317  fHistoTrueClusMergedGammaPt[iCut] = new TH1F("TrueClusMergedGamma_Pt","TrueClusMergedGamma_Pt",250,0,25);
1319  fHistoTrueClusMergedPartConvGammaPt[iCut] = new TH1F("TrueClusMergedPartConvGamma_Pt","TrueClusMergedPartConvGamma_Pt",250,0,25);
1321  fHistoTrueClusDalitzPt[iCut] = new TH1F("TrueClusDalitz_Pt","TrueClusDalitz_Pt",250,0,25);
1322  fClusterOutputList[iCut]->Add(fHistoTrueClusDalitzPt[iCut]);
1323  fHistoTrueClusDalitzMergedPt[iCut] = new TH1F("TrueClusDalitzMerged_Pt","TrueClusDalitzMerged_Pt",250,0,25);
1325  fHistoTrueClusPhotonFromElecMotherPt[iCut] = new TH1F("TrueClusPhotonFromElecMother_Pt","TrueClusPhotonFromElecMother_Pt",250,0,25);
1327  fHistoTrueClusShowerPt[iCut] = new TH1F("TrueClusShower_Pt","TrueClusShower_Pt",250,0,25);
1328  fClusterOutputList[iCut]->Add(fHistoTrueClusShowerPt[iCut]);
1329  fHistoTrueClusSubLeadingPt[iCut] = new TH1F("TrueClusSubleading_Pt","TrueClusSubleading_Pt",250,0,25);
1331  fHistoTrueClusNParticles[iCut] = new TH1I("TrueClusNParticles","TrueClusNParticles",20,0,20);
1332  fClusterOutputList[iCut]->Add(fHistoTrueClusNParticles[iCut]);
1333  fHistoTrueClusEMNonLeadingPt[iCut] = new TH1F("TrueClusEMNonLeading_Pt","TrueClusEMNonLeading_Pt",250,0,25);
1335  fHistoTrueNLabelsInClus[iCut] = new TH1F("TrueNLabelsInClus","TrueNLabelsInClus",100,-0.5,99.5);
1336  fClusterOutputList[iCut]->Add(fHistoTrueNLabelsInClus[iCut]);
1337  }
1338 
1339  if(fDoMesonAnalysis){
1340  fHistoTruePi0InvMassPt[iCut] = new TH2F("ESD_TruePi0_InvMass_Pt","ESD_TruePi0_InvMass_Pt",800,0,0.8,250,0,25);
1341  fHistoTruePi0InvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}} (GeV/c^{2})");
1342  fHistoTruePi0InvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1343  fTrueList[iCut]->Add(fHistoTruePi0InvMassPt[iCut]);
1344 
1345  fHistoTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueEta_InvMass_Pt","ESD_TrueEta_InvMass_Pt",800,0,0.8,250,0,25);
1346  fHistoTrueEtaInvMassPt[iCut]->SetXTitle("M_{inv,#eta} (GeV/c^{2})");
1347  fHistoTrueEtaInvMassPt[iCut]->SetYTitle("#eta p_{T} (GeV/c)");
1348  fTrueList[iCut]->Add(fHistoTrueEtaInvMassPt[iCut]);
1349 
1350  fHistoDoubleCountTruePi0InvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountPi0_InvMass_Pt","ESD_TrueDoubleCountPi0_InvMass_Pt",800,0,0.8,300,0,30);
1351  fTrueList[iCut]->Add(fHistoDoubleCountTruePi0InvMassPt[iCut]);
1352  fHistoDoubleCountTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountEta_InvMass_Pt","ESD_TrueDoubleCountEta_InvMass_Pt",800,0,0.8,300,0,30);
1353  fTrueList[iCut]->Add(fHistoDoubleCountTrueEtaInvMassPt[iCut]);
1354 
1355  fHistoTruePi0GGInvMassPt[iCut] = new TH2F("ESD_TruePi0GG_InvMass_Pt","ESD_TruePi0GG_InvMass_Pt",800,0,0.8,250,0,25);
1356  fHistoTruePi0GGInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}} (GeV/c^{2})");
1357  fHistoTruePi0GGInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1358  fTrueList[iCut]->Add(fHistoTruePi0GGInvMassPt[iCut]);
1359 
1360  fHistoTrueEtaGGInvMassPt[iCut] = new TH2F("ESD_TrueEtaGG_InvMass_Pt","ESD_TrueEtaGG_InvMass_Pt",800,0,0.8,250,0,25);
1361  fHistoTrueEtaGGInvMassPt[iCut]->SetXTitle("M_{inv,#eta} (GeV/c^{2})");
1362  fHistoTrueEtaGGInvMassPt[iCut]->SetYTitle("#eta p_{T} (GeV/c)");
1363  fTrueList[iCut]->Add(fHistoTrueEtaGGInvMassPt[iCut]);
1364 
1365 
1366 
1367  fHistoTruePrimaryPi0InvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_Pt", "ESD_TruePrimaryPi0_InvMass_Pt", 800,0,0.8,250,0,25);
1368  fHistoTruePrimaryPi0InvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}} (GeV/c^{2})");
1369  fHistoTruePrimaryPi0InvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1370  fHistoTruePrimaryPi0InvMassPt[iCut]->Sumw2();
1371  fTrueList[iCut]->Add(fHistoTruePrimaryPi0InvMassPt[iCut]);
1372 
1373 
1374  fHistoTruePrimaryPi0GGInvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0GG_InvMass_Pt", "ESD_TruePrimaryPi0GG_InvMass_Pt", 800,0,0.8,250,0,25);
1375  fHistoTruePrimaryPi0GGInvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}} (GeV/c^{2})");
1376  fHistoTruePrimaryPi0GGInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1377  fHistoTruePrimaryPi0GGInvMassPt[iCut]->Sumw2();
1378  fTrueList[iCut]->Add(fHistoTruePrimaryPi0GGInvMassPt[iCut]);
1379 
1380 
1381  fHistoTruePrimaryEtaInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEta_InvMass_Pt", "ESD_TruePrimaryEta_InvMass_Pt", 800,0,0.8,250,0,25);
1382  fHistoTruePrimaryEtaInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta} (GeV/c^{2})");
1383  fHistoTruePrimaryEtaInvMassPt[iCut]->SetYTitle("#eta p_{T} (GeV/c)");
1384  fHistoTruePrimaryEtaInvMassPt[iCut]->Sumw2();
1385  fTrueList[iCut]->Add(fHistoTruePrimaryEtaInvMassPt[iCut]);
1386 
1387  fHistoTruePrimaryEtaGGInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEtaGG_InvMass_Pt", "ESD_TruePrimaryEtaGG_InvMass_Pt", 800,0,0.8,250,0,25);
1388  fHistoTruePrimaryEtaGGInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta} (GeV/c^{2})");
1389  fHistoTruePrimaryEtaGGInvMassPt[iCut]->SetYTitle("#eta p_{T} (GeV/c)");
1390  fHistoTruePrimaryEtaGGInvMassPt[iCut]->Sumw2();
1391  fTrueList[iCut]->Add(fHistoTruePrimaryEtaGGInvMassPt[iCut]);
1392 
1393 
1394  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt", "ESD_TruePrimaryPi0W0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
1395  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}} (GeV/c^{2})");
1396  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1398 
1399  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEtaW0Weights_InvMass_Pt", "ESD_TruePrimaryEtaW0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
1400  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta} (GeV/c^{2})");
1401  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->SetYTitle("#eta p_{T} (GeV/c)");
1403 
1404  fProfileTruePrimaryPi0WeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryPi0Weights_InvMass_Pt", "ESD_TruePrimaryPi0Weights_InvMass_Pt", 800,0,0.8,250,0,25);
1405  fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}} (GeV/c^{2})");
1406  fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1409  fProfileTruePrimaryEtaWeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryEtaWeights_InvMass_Pt", "ESD_TruePrimaryEtaWeights_InvMass_Pt", 800,0,0.8,250,0,25);
1410  fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta} (GeV/c^{2})");
1411  fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->SetYTitle("#eta p_{T} (GeV/c)");
1414 
1415  fHistoTrueSecondaryPi0InvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_Pt", "ESD_TrueSecondaryPi0_InvMass_Pt", 800,0,0.8,250,0,25);
1416  fHistoTrueSecondaryPi0InvMassPt[iCut]->SetXTitle("M_{inv,sec #pi^{0}} (GeV/c^{2})");
1417  fHistoTrueSecondaryPi0InvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1418  fHistoTrueSecondaryPi0InvMassPt[iCut]->Sumw2();
1419  fTrueList[iCut]->Add(fHistoTrueSecondaryPi0InvMassPt[iCut]);
1420 
1421 
1422  fHistoTrueSecondaryPi0GGInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0GG_InvMass_Pt", "ESD_TrueSecondaryPi0GG_InvMass_Pt", 800,0,0.8,250,0,25);
1423  fHistoTrueSecondaryPi0GGInvMassPt[iCut]->SetXTitle("M_{inv,sec #pi^{0}} (GeV/c^{2})");
1424  fHistoTrueSecondaryPi0GGInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1425  fHistoTrueSecondaryPi0GGInvMassPt[iCut]->Sumw2();
1426  fTrueList[iCut]->Add(fHistoTrueSecondaryPi0GGInvMassPt[iCut]);
1427 
1428 
1429 
1430 
1431  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_Pt","ESD_TrueSecondaryPi0FromK0s_InvMass_Pt",800,0,0.8,250,0,25);
1432  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0} from K^{0}_{S}} (GeV/c^{2})");
1433  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1436  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromEta_InvMass_Pt","ESD_TrueSecondaryPi0FromEta_InvMass_Pt",800,0,0.8,250,0,25);
1437  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0} from #eta} (GeV/c^{2})");
1438  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1440  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_Pt","ESD_TrueSecondaryPi0FromLambda_InvMass_Pt",800,0,0.8,250,0,25);
1441  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0} from #Lambda} (GeV/c^{2})");
1442  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1444 
1445  fHistoTruePrimaryPi0PhotonPairPtconv[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_PtConv","",800,0,0.8,250,0,25);
1446  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}} (GeV/c^{2})");
1447  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
1448  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->Sumw2();
1450 
1451  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_PtConv","",800,0,0.8,250,0,25);
1452  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}} (GeV/c^{2})");
1453  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
1456 
1457  fHistoTruePrimaryEtaPhotonPairPtconv[iCut] = new TH2F("ESD_TruePrimaryEta_InvMass_PtConv","",800,0,0.8,250,0,25);
1458  fHistoTruePrimaryEtaPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#eta} (GeV/c^{2})");
1459  fHistoTruePrimaryEtaPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
1460  fHistoTruePrimaryEtaPhotonPairPtconv[iCut]->Sumw2();
1462 
1463  fHistoTruePrimaryPi0DCPtconv[iCut] = new TH1F("ESD_TruePrimaryPi0DC_PtConv","",250,0,25);
1464  fHistoTruePrimaryPi0DCPtconv[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
1465  fHistoTruePrimaryPi0DCPtconv[iCut]->Sumw2();
1466  fTrueList[iCut]->Add(fHistoTruePrimaryPi0DCPtconv[iCut]);
1467 
1468  fHistoTrueSecondaryPi0DCPtconv[iCut] = new TH1F("ESD_TrueSecondaryPi0DC_PtConv","",250,0,25);
1469  fHistoTrueSecondaryPi0DCPtconv[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
1470  fHistoTrueSecondaryPi0DCPtconv[iCut]->Sumw2();
1471  fTrueList[iCut]->Add(fHistoTrueSecondaryPi0DCPtconv[iCut]);
1472 
1473  fHistoTruePrimaryEtaDCPtconv[iCut] = new TH1F("ESD_TruePrimaryEtaDC_PtConv","",250,0,25);
1474  fHistoTruePrimaryEtaDCPtconv[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
1475  fHistoTruePrimaryEtaDCPtconv[iCut]->Sumw2();
1476  fTrueList[iCut]->Add(fHistoTruePrimaryEtaDCPtconv[iCut]);
1477 
1478  fHistoTruePrimaryPi0MissingPtconv[iCut] = new TH1F("ESD_TruePrimaryPi0Missing_PtConv","",250,0,25);
1479  fHistoTruePrimaryPi0MissingPtconv[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
1480  fHistoTruePrimaryPi0MissingPtconv[iCut]->Sumw2();
1481  fTrueList[iCut]->Add(fHistoTruePrimaryPi0MissingPtconv[iCut]);
1482 
1483  fHistoTrueSecondaryPi0MissingPtconv[iCut] = new TH1F("ESD_TrueSecondaryPi0Missing_PtConv","",250,0,25);
1484  fHistoTrueSecondaryPi0MissingPtconv[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
1485  fHistoTrueSecondaryPi0MissingPtconv[iCut]->Sumw2();
1487 
1488  fHistoTruePrimaryEtaMissingPtconv[iCut] = new TH1F("ESD_TruePrimaryEtaMissing_PtConv","",250,0,25);
1489  fHistoTruePrimaryEtaMissingPtconv[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
1490  fHistoTruePrimaryEtaMissingPtconv[iCut]->Sumw2();
1491  fTrueList[iCut]->Add(fHistoTruePrimaryEtaMissingPtconv[iCut]);
1492 
1493 
1494  if (fDoMesonQA > 0){
1495  fHistoTruePi0CaloPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloPhoton_InvMass_Pt","ESD_TruePi0CaloPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1496  fHistoTruePi0CaloPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}} (GeV/c^{2}) #gamma #gamma");
1497  fHistoTruePi0CaloPhotonInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1498  fTrueList[iCut]->Add(fHistoTruePi0CaloPhotonInvMassPt[iCut]);
1499 
1500  fHistoTrueEtaCaloPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloPhoton_InvMass_Pt","ESD_TrueEtaCaloPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1501  fHistoTrueEtaCaloPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#eta} (GeV/c^{2}) #gamma #gamma");
1502  fHistoTrueEtaCaloPhotonInvMassPt[iCut]->SetYTitle("#eta p_{T} (GeV/c)");
1503  fTrueList[iCut]->Add(fHistoTrueEtaCaloPhotonInvMassPt[iCut]);
1504 
1505  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhoton_InvMass_Pt","ESD_TruePi0CaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1506  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}} (GeV/c^{2}) #gamma #gamma_{conv}");
1507  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1509 
1510  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt","ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt",800,0,0.8,250,0,25);
1511  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}} (GeV/c^{2}) #gamma #gamma_{conv,matched}");
1512  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1514 
1515  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt","ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt",800,0,0.8,250,0,25);
1516  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#eta} (GeV/c^{2}) #gamma #gamma_{conv}");
1517  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]->SetYTitle("#eta p_{T} (GeV/c)");
1519 
1520  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt","ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt",800,0,0.8,250,0,25);
1521  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#eta} (GeV/c^{2}) #gamma #gamma_{conv,matched}");
1522  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut]->SetYTitle("#eta p_{T} (GeV/c)");
1524 
1525  fHistoTruePi0CaloElectronInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloElectron_InvMass_Pt","ESD_TruePi0CaloElectron_InvMass_Pt",800,0,0.8,250,0,25);
1526  fHistoTruePi0CaloElectronInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}} (GeV/c^{2}) #gamma e^{#pm}");
1527  fHistoTruePi0CaloElectronInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1529  fHistoTrueEtaCaloElectronInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloElectron_InvMass_Pt","ESD_TrueEtaCaloElectron_InvMass_Pt",800,0,0.8,250,0,25);
1530  fHistoTrueEtaCaloElectronInvMassPt[iCut]->SetXTitle("M_{inv,#eta} (GeV/c^{2}) #gamma e^{#pm}");
1531  fHistoTrueEtaCaloElectronInvMassPt[iCut]->SetYTitle("#eta p_{T} (GeV/c)");
1533 
1534  fHistoTruePi0CaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedCluster_InvMass_Pt","ESD_TruePi0CaloMergedCluster_InvMass_Pt",800,0,0.8,250,0,25);
1535  fHistoTruePi0CaloMergedClusterInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}} (GeV/c^{2}) #gamma merged cluster");
1536  fHistoTruePi0CaloMergedClusterInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1538  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedCluster_InvMass_Pt","ESD_TrueEtaCaloMergedCluster_InvMass_Pt",800,0,0.8,250,0,25);
1539  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]->SetXTitle("M_{inv,#eta} (GeV/c^{2}) #gamma merged cluster");
1540  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]->SetYTitle("#eta p_{T} (GeV/c)");
1542 
1543  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloEMNonLeading_InvMass_Pt","ESD_TrueMotherCaloEMNonLeading_InvMass_Pt",800,0,0.8,250,0,25);
1544  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) #gamma cluster no leading EM");
1545  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut]->SetYTitle("#pair p_{T} (GeV/c)");
1547  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt","ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,250,0,25);
1548  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}} (GeV/c^{2}) #gamma merged cluster, part conv");
1549  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1551  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt","ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,250,0,25);
1552  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]->SetXTitle("M_{inv,#eta} (GeV/c^{2}) #gamma merged cluster, part conv");
1553  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]->SetYTitle("#eta p_{T} (GeV/c)");
1555 
1556  fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt","ESD_TruePrimaryPi0_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
1557  fHistoTruePrimaryPi0MCPtResolPt[iCut]->SetXTitle("#pi^{0} p_{T,MC} (GeV/c)");
1558  fHistoTruePrimaryPi0MCPtResolPt[iCut]->SetYTitle("#pi^{0} (p_{T,rec}-p_{T,MC})/p_{T,MC} ()");
1559  fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
1561  fTrueList[iCut]->Add(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
1562 
1563  fHistoTruePrimaryEtaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt","ESD_TruePrimaryEta_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
1564  fHistoTruePrimaryEtaMCPtResolPt[iCut]->SetXTitle("#eta p_{T,MC} (GeV/c)");
1565  fHistoTruePrimaryEtaMCPtResolPt[iCut]->SetYTitle("#eta (p_{T,rec}-p_{T,MC})/p_{T,MC} ()");
1566  fHistoTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
1568  fTrueList[iCut]->Add(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
1569 
1570  fHistoTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt","ESD_TrueBckGG_InvMass_Pt",800,0,0.8,250,0,25);
1571  fHistoTrueBckGGInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) #gamma #gamma no signal");
1572  fHistoTrueBckGGInvMassPt[iCut]->SetYTitle("#pair p_{T} (GeV/c)");
1573  fTrueList[iCut]->Add(fHistoTrueBckGGInvMassPt[iCut]);
1574  fHistoTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt","ESD_TrueBckCont_InvMass_Pt",800,0,0.8,250,0,25);
1575  fHistoTrueBckContInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) contamination");
1576  fHistoTrueBckContInvMassPt[iCut]->SetYTitle("#pair p_{T} (GeV/c)");
1577  fTrueList[iCut]->Add(fHistoTrueBckContInvMassPt[iCut]);
1578  fHistoTrueK0sWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0sWithPi0Daughter_MCPt","ESD_TrueK0sWithPi0Daughter_MCPt",250,0,25);
1579  fHistoTrueK0sWithPi0DaughterMCPt[iCut]->SetXTitle("K^{0}_{s} p_{MC,T} (GeV/c) for K^{0}_{s} where #pi^{0} rec ");
1580  fTrueList[iCut]->Add(fHistoTrueK0sWithPi0DaughterMCPt[iCut]);
1581  fHistoTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt","ESD_TrueEtaWithPi0Daughter_MCPt",250,0,25);
1582  fHistoTrueEtaWithPi0DaughterMCPt[iCut]->SetXTitle("#eta p_{MC,T} (GeV/c) for #eta where #pi^{0} rec ");
1583  fTrueList[iCut]->Add(fHistoTrueEtaWithPi0DaughterMCPt[iCut]);
1584  fHistoTrueLambdaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueLambdaWithPi0Daughter_MCPt","ESD_TrueLambdaWithPi0Daughter_MCPt",250,0,25);
1585  fHistoTrueLambdaWithPi0DaughterMCPt[iCut]->SetXTitle("#Lambda p_{MC,T} (GeV/c) for #Lambda where #pi^{0} rec ");
1587 
1588  fHistoTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y","ESD_TruePi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1589  fHistoTruePi0PtY[iCut]->SetYTitle("Y_{#pi^{0}}");
1590  fHistoTruePi0PtY[iCut]->SetXTitle("#pi^{0} p_{T} (GeV/c)");
1592  fTrueList[iCut]->Add(fHistoTruePi0PtY[iCut]);
1593  fHistoTrueEtaPtY[iCut] = new TH2F("ESD_TrueEta_Pt_Y","ESD_TrueEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
1594  fHistoTrueEtaPtY[iCut]->SetYTitle("Y_{#eta}");
1595  fHistoTrueEtaPtY[iCut]->SetXTitle("#eta p_{T} (GeV/c)");
1597  fTrueList[iCut]->Add(fHistoTrueEtaPtY[iCut]);
1598  fHistoTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha","ESD_TruePi0_Pt_Alpha",150,0.03,15.,100,0,1);
1599  fHistoTruePi0PtAlpha[iCut]->SetYTitle("#alpha_{#pi^{0}}");
1600  fHistoTruePi0PtAlpha[iCut]->SetXTitle("#pi^{0} p_{T} (GeV/c)");
1602  fTrueList[iCut]->Add(fHistoTruePi0PtAlpha[iCut]);
1603  fHistoTrueEtaPtAlpha[iCut] = new TH2F("ESD_TrueEta_Pt_Alpha","ESD_TrueEta_Pt_Alpha",150,0.03,15.,100,0,1);
1604  fHistoTrueEtaPtAlpha[iCut]->SetYTitle("#alpha_{#eta}");
1605  fHistoTrueEtaPtAlpha[iCut]->SetXTitle("#eta p_{T} (GeV/c)");
1607  fTrueList[iCut]->Add(fHistoTrueEtaPtAlpha[iCut]);
1608 
1609  fHistoTruePi0PtOpenAngle[iCut] = new TH2F("ESD_TruePi0_Pt_OpenAngle","ESD_TruePi0_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
1610  fHistoTruePi0PtOpenAngle[iCut]->SetYTitle("#theta_{#pi^{0}}");
1611  fHistoTruePi0PtOpenAngle[iCut]->SetXTitle("#pi^{0} p_{T} (GeV/c)");
1613  fTrueList[iCut]->Add(fHistoTruePi0PtOpenAngle[iCut]);
1614  fHistoTrueEtaPtOpenAngle[iCut] = new TH2F("ESD_TrueEta_Pt_OpenAngle","ESD_TrueEta_Pt_OpenAngle",150,0.03,15.,200,0,2*TMath::Pi());
1615  fHistoTrueEtaPtOpenAngle[iCut]->SetYTitle("#theta_{#eta}");
1616  fHistoTrueEtaPtOpenAngle[iCut]->SetXTitle("#eta p_{T} (GeV/c)");
1618  fTrueList[iCut]->Add(fHistoTrueEtaPtOpenAngle[iCut]);
1619 
1620  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut] = new TH2F("ESD_TrueMotherPi0ConvPhoton_Eta_Phi","conv photons for true #pi^{0}",600,0,2*TMath::Pi(),200,-1,1);
1621  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}} (rad)");
1622  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
1624  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut] = new TH2F("ESD_TrueMotherEtaConvPhoton_Eta_Phi","conv photons for true #eta",600,0,2*TMath::Pi(),200,-1,1);
1625  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}} (rad)");
1626  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
1628 
1629 
1630  fHistoTruePi0ShowerInvMassPt[iCut] = new TH2F("ESD_TruePi0Shower_InvMass_Pt","ESD_TruePi0Shower_InvMass_Pt",800,0,0.8,250,0,25);
1631  fHistoTruePi0ShowerInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}} (GeV/c^{2})");
1632  fHistoTruePi0ShowerInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1633  fTrueList[iCut]->Add(fHistoTruePi0ShowerInvMassPt[iCut]);
1634 
1635  fHistoTrueEtaShowerInvMassPt[iCut] = new TH2F("ESD_TrueEtaShower_InvMass_Pt","ESD_TrueEtaShower_InvMass_Pt",800,0,0.8,250,0,25);
1636  fHistoTrueEtaShowerInvMassPt[iCut]->SetXTitle("M_{inv,#eta} (GeV/c^{2})");
1637  fHistoTrueEtaShowerInvMassPt[iCut]->SetYTitle("#eta p_{T} (GeV/c)");
1638  fTrueList[iCut]->Add(fHistoTrueEtaShowerInvMassPt[iCut]);
1639 
1640  fHistoTruePi0NoShowerInvMassPt[iCut] = new TH2F("ESD_TruePi0NoShower_InvMass_Pt","ESD_TruePi0NoShower_InvMass_Pt",800,0,0.8,250,0,25);
1641  fHistoTruePi0NoShowerInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}} (GeV/c^{2})");
1642  fHistoTruePi0NoShowerInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T} (GeV/c)");
1643  fTrueList[iCut]->Add(fHistoTruePi0NoShowerInvMassPt[iCut]);
1644 
1645  fHistoTrueEtaNoShowerInvMassPt[iCut] = new TH2F("ESD_TrueEtaNoShower_InvMass_Pt","ESD_TrueEtaNoShower_InvMass_Pt",800,0,0.8,250,0,25);
1646  fHistoTrueEtaNoShowerInvMassPt[iCut]->SetXTitle("M_{inv,#eta} (GeV/c^{2})");
1647  fHistoTrueEtaNoShowerInvMassPt[iCut]->SetYTitle("#eta p_{T} (GeV/c)");
1648  fTrueList[iCut]->Add(fHistoTrueEtaNoShowerInvMassPt[iCut]);
1649 
1650  fHistoTruePi0OpeningAngleGammaElectron[iCut] = new TH1F("ESD_TruePi0_OpeningAngle_GammaElectron", "ESD_TruePi0_OpeningAngle_GammaElectron",100,0.,TMath::Pi());
1652 
1653 
1654 
1655  }
1656  }
1657  }
1658  }
1659 
1663 
1664  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
1665  if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
1666 
1667  if(fV0Reader)
1669  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
1670  fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
1671  if(fV0Reader)
1673  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
1674  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
1675 
1676  for(Int_t iMatcherTask = 0; iMatcherTask < 3; iMatcherTask++){
1677  AliCaloTrackMatcher* temp = (AliCaloTrackMatcher*) (AliAnalysisManager::GetAnalysisManager()->GetTask(Form("CaloTrackMatcher_%i_%i",iMatcherTask,fTrackMatcherRunningMode)));
1678  if(temp) fOutputContainer->Add(temp->GetCaloTrackMatcherHistograms());
1679  }
1680 
1681  fElecSelector=(AliDalitzElectronSelector*)AliAnalysisManager::GetAnalysisManager()->GetTask("ElectronSelector");
1682  if(!fElecSelector){printf("Error: No ElectronSelector");return;} // GetV0Reader
1683 
1684  if( fElecSelector ){
1685  if ( ((AliDalitzElectronCuts*)fElecSelector->GetDalitzElectronCuts())->GetCutHistograms() ){
1687  }
1688  }
1689 
1690 
1691  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1692 
1693  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
1694  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
1695  fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
1696  }
1697  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))) continue;
1698  if(((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutHistograms()){
1699  fCutFolder[iCut]->Add(((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutHistograms());
1700  }
1701  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
1702  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
1703  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
1704  }
1705  if(!((AliDalitzElectronCuts*)fElectronCutArray->At(iCut))) continue;
1706  if( ((AliDalitzElectronCuts*)fElectronCutArray->At(iCut))->GetCutHistograms() ) {
1707  fCutFolder[iCut]->Add( ((AliDalitzElectronCuts*)fElectronCutArray->At(iCut))->GetCutHistograms() );
1708  }
1709 
1710  if(fDoMesonAnalysis){
1711  if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
1712  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
1713  fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
1714  }
1715  }
1716 
1717  }
1718  PostData(1, fOutputContainer);
1719 }
1720 //_____________________________________________________________________________
1722 {
1723  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1724  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
1725  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
1726  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
1727  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
1728  }
1729 
1730  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
1731  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1732  continue; // No Eta Shift requested, continue
1733  }
1734  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
1735  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
1736  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1737  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
1738  continue;
1739  }
1740  else{
1741  printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
1742  (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
1743  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1744  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
1745  }
1746  }
1747 
1748  return kTRUE;
1749 }
1750 //_____________________________________________________________________________
1752 {
1753  //
1754  // Called for each event
1755  //
1756 
1757  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
1758  if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1
1759 
1760  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1761  fHistoNEvents[iCut]->Fill(eventQuality);
1762  }
1763  return;
1764  }
1765 
1766  if(fIsMC) fMCEvent = MCEvent();
1767 
1768  fInputEvent = InputEvent();
1769 
1770  if(fInputEvent->IsA()==AliAODEvent::Class()){
1771  fInputEvent->InitMagneticField();
1772  }
1773 
1774  fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
1775  fSelectorElectronIndex = fElecSelector->GetReconstructedElectronsIndex(); // Electrons from default Cut
1776  fSelectorPositronIndex = fElecSelector->GetReconstructedPositronsIndex(); // Positrons from default Cut
1777 
1778 
1779 
1780  // ------------------- BeginEvent ----------------------------
1781 
1782  AliEventplane *EventPlane = fInputEvent->GetEventplane();
1783  if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
1784  else fEventPlaneAngle=0.0;
1785 
1786  if(fIsMC && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
1787  RelabelAODPhotonCandidates(kTRUE); // In case of AODMC relabeling MC
1788  fV0Reader->RelabelAODs(kTRUE);
1789  }
1790 
1791 
1792  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1793 
1794  fiCut = iCut;
1795 
1796  Bool_t isRunningEMCALrelAna = kFALSE;
1797 
1798  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) isRunningEMCALrelAna = kTRUE;
1799 
1800  Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,isRunningEMCALrelAna);
1801 
1802  if(eventNotAccepted){
1803  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
1804  fHistoNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
1805  continue;
1806  }
1807 
1808  if(eventQuality != 0){// Event Not Accepted
1809  //cout << "event rejected due to: " <<eventQuality << endl;
1810  fHistoNEvents[iCut]->Fill(eventQuality);
1811  continue;
1812  }
1813 
1814  fHistoNEvents[iCut]->Fill(eventQuality); // Should be 0 here
1816  fHistoSPDClusterTrackletBackground[iCut]->Fill(fInputEvent->GetMultiplicity()->GetNumberOfTracklets(),(fInputEvent->GetNumberOfITSClusters(0)+fInputEvent->GetNumberOfITSClusters(1)));
1817 
1818  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A());
1819  else fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
1820 
1821  if(fIsMC){
1822 
1823 
1824  // Process MC Particle
1825  fStringRecTruePi0s[iCut] = "";
1826  fStringRecTrueEtas[iCut] = "";
1827 
1828  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
1829  if(fInputEvent->IsA()==AliESDEvent::Class()){
1830 
1831  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1832  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
1833  fMCEvent);
1834  }
1835  else if(fInputEvent->IsA()==AliAODEvent::Class()){
1836  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1837  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
1838  fInputEvent);
1839  }
1840 
1841  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader()){
1842  for(Int_t i = 0;i<(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
1843  TString nameBin= fHistoMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
1844  if (nameBin.CompareTo("")== 0){
1845  TString nameHeader = ((TObjString*)((TList*)((AliConvEventCuts*)fEventCutArray->At(iCut))
1846  ->GetAcceptedHeader())->At(i))->GetString();
1847  fHistoMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
1848  }
1849  }
1850  }
1851  }
1852 
1853  if(fInputEvent->IsA()==AliESDEvent::Class())
1855  if(fInputEvent->IsA()==AliAODEvent::Class())
1857 
1858  }
1859 
1860 
1861  // it is in the loop to have the same conversion cut string (used also for MC stuff that should be same for V0 and Cluster)
1862  ProcessClusters(); // process calo clusters
1863  ProcessPhotonCandidates(); // Process this cuts gammas
1865 
1866  fHistoNGammaCandidates[iCut]->Fill(fClusterCandidates->GetEntries());
1868 
1869  if(fDoMesonAnalysis){ // Meson Analysis
1870  CalculatePi0DalitzCandidates(); //Combine gamma candidates
1871 
1872  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
1873 
1874  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
1875  CalculateBackground(); // Combinatorial Background
1876  UpdateEventByEventData(); // Store Event for mixed Events
1877  }
1878 
1879  }
1880 
1881  if(fIsMC && fInputEvent->IsA()==AliAODEvent::Class()){
1882  ProcessConversionPhotonsForMissingTagsAOD(); //Count missing tags
1883  } else if (fIsMC && fInputEvent->IsA()==AliESDEvent::Class()){
1884  ProcessConversionPhotonsForMissingTags(); //Count missing tags
1885  }
1888  }
1889 
1891 
1892  fGammaCandidates->Clear(); // delete this cuts good gammas
1893  fClusterCandidates->Clear(); // delete cluster candidates
1894  fVirtualGammaCandidates->Clear(); // delete this cuts good virtual gammas
1895  }
1896 
1897  if(fIsMC && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
1898  RelabelAODPhotonCandidates(kFALSE); // Back to ESDMC Label
1899  fV0Reader->RelabelAODs(kFALSE);
1900  }
1901 
1902  fSelectorElectronIndex.clear();
1903  fSelectorPositronIndex.clear();
1904 
1905  PostData(1, fOutputContainer);
1906 }
1907 
1908 //________________________________________________________________________
1910 {
1911 
1912  Int_t nclus = 0;
1913  nclus = fInputEvent->GetNumberOfCaloClusters();
1914 
1915 
1916  if(nclus == 0) return;
1917 
1918 
1919  // vertex
1920  Double_t vertex[3] = {0};
1921  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1922 
1923 
1924  // Loop over EMCal clusters
1925  for(Long_t i = 0; i < nclus; i++){
1926 
1927  AliVCluster* clus = NULL;
1928  if(fInputEvent->IsA()==AliESDEvent::Class()) clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
1929  else if(fInputEvent->IsA()==AliAODEvent::Class()) clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
1930 
1931  if ( !clus ) continue;
1932  if ( !((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fMCEvent,fIsMC,1.,i) ){ delete clus; continue;}
1933 
1934  // TLorentzvector with cluster
1935  TLorentzVector clusterVector;
1936  clus->GetMomentum(clusterVector,vertex);
1937 
1938  TLorentzVector* tmpvec = new TLorentzVector();
1939  tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
1940 
1941  // convert to AODConversionPhoton
1942  AliAODConversionPhoton *PhotonCandidate=new AliAODConversionPhoton(tmpvec);
1943  if(!PhotonCandidate){ delete clus; delete tmpvec; continue;}
1944 
1945  // Flag Photon as CaloPhoton
1946  PhotonCandidate->SetIsCaloPhoton();
1947  PhotonCandidate->SetCaloClusterRef(i);
1948  // get MC label
1949  if(fIsMC){
1950  Int_t* mclabelsCluster = clus->GetLabels();
1951  PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
1952 // cout << clus->GetNLabels() << endl;
1953  if (clus->GetNLabels()>0){
1954  for (Int_t k =0; k< (Int_t)clus->GetNLabels(); k++){
1955  if (k< 50)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
1956 // Int_t pdgCode = fMCEvent->Particle(mclabelsCluster[k])->GetPdgCode();
1957 // cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
1958  }
1959  }
1960  }
1961 
1962  fIsFromMBHeader = kTRUE;
1964  // test whether largest contribution to cluster orginates in added signals
1965 
1966  if ( fIsMC && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() > 0 ){
1967 
1968  if ( ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCEvent, fInputEvent) == 0 ) fIsFromMBHeader = kFALSE;
1969 
1970 
1971  if (clus->GetNLabels()>1){
1972  Int_t* mclabelsCluster = clus->GetLabels();
1973  for (Int_t l = 1; l < (Int_t)clus->GetNLabels(); l++ ){
1974  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(mclabelsCluster[l], fMCEvent, fInputEvent) == 0) fIsOverlappingWithOtherHeader = kTRUE;
1975  }
1976  }
1977  }
1978 
1979  if(fIsMC){
1980  if(fInputEvent->IsA()==AliESDEvent::Class()){
1981  ProcessTrueClusterCandidates(PhotonCandidate);
1982  } else {
1983  ProcessTrueClusterCandidatesAOD(PhotonCandidate);
1984  }
1985  }
1986 
1989  fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1990  fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
1991  } else{
1992  delete PhotonCandidate;
1993  }
1994 
1995  delete clus;
1996  delete tmpvec;
1997  }
1998 
1999 }
2000 
2001 //________________________________________________________________________
2003 {
2004 
2005  TParticle *Photon = NULL;
2006  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
2007  fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
2008 
2009  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = fMCEvent->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
2010  else return;
2011 
2012  if(Photon == NULL){
2013  // cout << "no photon" << endl;
2014  return;
2015  }
2016 
2017  TruePhotonCandidate->SetCaloPhotonMCFlags(fMCEvent,kFALSE);
2018 
2019  // True Photon
2021 
2022  if (TruePhotonCandidate->IsLargestComponentPhoton() || TruePhotonCandidate->IsLargestComponentElectron() ) {
2023 
2024  fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2025 
2026 
2027 
2028  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2029  Double_t mcProdVtxX = primVtxMC->GetX();
2030  Double_t mcProdVtxY = primVtxMC->GetY();
2031  Double_t mcProdVtxZ = primVtxMC->GetZ();
2032  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, TruePhotonCandidate->GetCaloPhotonMCLabel(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2033 
2034 
2035 
2036  if(isPrimary){
2037 
2038  // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
2039 
2040  fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2041  fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
2042 
2043 
2044  Int_t gammaMotherLabel = -1;
2045 
2046  if (TruePhotonCandidate->IsLargestComponentPhoton()){ // for photons its the direct mother
2047 
2048  gammaMotherLabel=Photon->GetMother(0);
2049 
2050 
2051  } else if ( TruePhotonCandidate->IsLargestComponentElectron() ){ // for electrons its either the direct mother or for conversions the grandmother
2052 
2053  if (TruePhotonCandidate->IsConversion()) gammaMotherLabel=fMCEvent->Particle(Photon->GetMother(0))->GetMother(0);
2054  else gammaMotherLabel=Photon->GetMother(0);
2055 
2056  }
2057 
2058  if( gammaMotherLabel > -1 ){
2059 
2060  Int_t motherFromShower = -1;
2061 
2062 
2063  TParticle* motherGamma = fMCEvent->Particle( gammaMotherLabel );
2064 
2065  //if( IsDalitz ( motherGamma ) == kTRUE ){
2066  if( motherGamma->GetPdgCode() == 111 ) {
2067 
2068  if( IsDalitz( motherGamma ) == kTRUE ){
2069 
2070  fHistoTruePi0DalitzClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2071  fHistoTruePi0DalitzClusGammaMCPt[fiCut]->Fill(Photon->Pt());
2072  }
2073 
2074 
2075  } else if ( ( motherFromShower = FindMotherOfPhoton( gammaMotherLabel ) ) > -1 ){
2076 
2077 
2078 
2079 
2080  TParticle* motherGammaShower = fMCEvent->Particle( motherFromShower );
2081 
2082 
2083 
2084 
2085  if( motherGammaShower->GetPdgCode() == 111 ) {
2086  if( IsDalitz ( motherGammaShower ) ) {
2087 
2088  fHistoTruePi0DalitzClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2089  fHistoTruePi0DalitzAllClusGammaPt[fiCut]->Fill( TruePhotonCandidate->Pt() );
2090  fHistoTruePi0DalitzClusGammaMCPt[fiCut]->Fill(Photon->Pt());
2091 
2092 
2093  }
2094 
2095  }
2096  }
2097  }
2098 
2099  }
2100 
2101  }
2102  else fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2103 
2104 
2105  if (fDoClusterQA > 0){
2106  if (TruePhotonCandidate->IsLargestComponentPhoton()){
2107  fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2108  fHistoTrueClusUnConvGammaMCPt[fiCut]->Fill(Photon->Pt());
2109  }
2110  if (TruePhotonCandidate->IsLargestComponentElectron())
2111  fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2112  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2113  fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2114  fHistoTrueClusConvGammaMCPt[fiCut]->Fill(((TParticle*)fMCEvent->Particle(Photon->GetMother(0)))->Pt());
2115  }
2116  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
2117  fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2118  if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
2119  fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2120  if (TruePhotonCandidate->IsMergedPartConv())
2121  fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2122  if (TruePhotonCandidate->IsDalitz())
2123  fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2124  if (TruePhotonCandidate->IsDalitzMerged())
2125  fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2126  if (TruePhotonCandidate->IsPhotonWithElecMother())
2127  fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2128  if (TruePhotonCandidate->IsShower())
2129  fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2130  if (TruePhotonCandidate->IsSubLeadingEM())
2131  fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2132  fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
2133  }
2134  }
2135 
2136 
2137  return;
2138 }
2139 
2140 
2141 //________________________________________________________________________
2143 {
2144  AliAODMCParticle *Photon = NULL;
2145  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2146  if (AODMCTrackArray){
2147  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
2148  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
2149  else return;
2150  } else {
2151  AliInfo("AODMCTrackArray could not be loaded");
2152  return;
2153  }
2154 
2155  if(Photon == NULL){
2156  // cout << "no photon" << endl;
2157  return;
2158  }
2159  TruePhotonCandidate->SetCaloPhotonMCFlagsAOD(fInputEvent, kFALSE);
2160  fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
2161  // True Photon
2163  if (TruePhotonCandidate->IsLargestComponentPhoton() || TruePhotonCandidate->IsLargestComponentElectron() )fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2164  else fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2165  if (fDoClusterQA > 0){
2166  if (TruePhotonCandidate->IsLargestComponentPhoton()) {
2167  fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2168  fHistoTrueClusUnConvGammaMCPt[fiCut]->Fill(Photon->Pt());
2169  }
2170  if (TruePhotonCandidate->IsLargestComponentElectron())
2171  fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2172  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) {
2173  fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2174  AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
2175  fHistoTrueClusConvGammaMCPt[fiCut]->Fill(Mother->Pt());
2176  }
2177  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
2178  fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2179  if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
2180  fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2181  if (TruePhotonCandidate->IsMergedPartConv())
2182  fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2183  if (TruePhotonCandidate->IsDalitz())
2184  fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2185  if (TruePhotonCandidate->IsDalitzMerged())
2186  fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2187  if (TruePhotonCandidate->IsPhotonWithElecMother())
2188  fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2189  if (TruePhotonCandidate->IsShower())
2190  fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2191  if (TruePhotonCandidate->IsSubLeadingEM())
2192  fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2193  fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
2194  }
2195  }
2196 
2197  // True Photon
2198  if(fIsFromMBHeader){
2199  fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2200  if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
2201  }
2202 
2203  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2204  Double_t mcProdVtxX = primVtxMC->GetX();
2205  Double_t mcProdVtxY = primVtxMC->GetY();
2206  Double_t mcProdVtxZ = primVtxMC->GetZ();
2207  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2208 
2209  if(isPrimary){
2210  // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
2211  if(fIsFromMBHeader){
2212  fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2213  fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
2214  }
2215  }
2216 }
2217 
2218 //________________________________________________________________________
2220 {
2221  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2222  Double_t mcProdVtxX = primVtxMC->GetX();
2223  Double_t mcProdVtxY = primVtxMC->GetY();
2224  Double_t mcProdVtxZ = primVtxMC->GetZ();
2225 
2226  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2227 
2228  // Loop over all primary MC particle
2229  for(Int_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
2230 
2231  AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
2232  if (!particle) continue;
2233 
2234  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, particle, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2235  if (!isPrimary) continue;
2236 
2237  Int_t isMCFromMBHeader = -1;
2238  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2239  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
2240  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
2241  }
2242 
2243  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
2244  if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kFALSE)){
2245  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
2246  if (TMath::Abs(particle->Eta()) < 0.66 ){
2247  if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt());
2248  }
2249  if(particle->GetMother() >-1){ // Meson Decay Gamma
2250  switch((static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother())))->GetPdgCode()){
2251  case 111: // Pi0
2252  fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt());
2253  break;
2254  case 113: // Rho0
2255  fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt());
2256  break;
2257  case 221: // Eta
2258  fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt());
2259  break;
2260  case 223: // Omega
2261  fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt());
2262  break;
2263  case 331: // Eta'
2264  fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt());
2265  break;
2266  case 333: // Phi
2267  fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt());
2268  break;
2269  case 3212: // Sigma
2270  fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt());
2271  break;
2272  }
2273  }
2274  }
2275  if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kTRUE)){
2276  Double_t rConv = 0;
2277  for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){
2278  AliAODMCParticle *tmpDaughter = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(daughterIndex));
2279  if(!tmpDaughter) continue;
2280  if(TMath::Abs(tmpDaughter->GetPdgCode()) == 11){
2281  rConv = sqrt( (tmpDaughter->Xv()*tmpDaughter->Xv()) + (tmpDaughter->Yv()*tmpDaughter->Yv()) );
2282  }
2283  }
2284  fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt());
2285  if (fDoPhotonQA > 0){
2286  fHistoMCConvGammaR[fiCut]->Fill(rConv);
2287  fHistoMCConvGammaEta[fiCut]->Fill(particle->Eta());
2288  }
2289  }
2290  // Converted MC Gamma
2291  if(fDoMesonAnalysis){
2292  if(particle->GetPdgCode() == 310 && fDoMesonQA > 0){
2293  Double_t mesonY = 1.e30;
2294  Double_t ratio = 0;
2295  if (particle->E() != TMath::Abs(particle->Pz())){
2296  ratio = (particle->E()+particle->Pz()) / (particle->E()-particle->Pz());
2297  }
2298  if( !(ratio <= 0) ){
2299  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2300  }
2301  Float_t weightedK0s= 1;
2302  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
2303  if (particle->Pt()>0.005){
2304  weightedK0s= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, 0x0, fInputEvent);
2305  //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2306  }
2307  }
2308  fHistoMCK0sPt[fiCut]->Fill(particle->Pt(),weightedK0s);
2309  fHistoMCK0sWOWeightPt[fiCut]->Fill(particle->Pt());
2310  fHistoMCK0sPtY[fiCut]->Fill(particle->Pt(),mesonY,weightedK0s);
2311  }
2313  ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2314  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
2315  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
2316  Float_t weighted= 1;
2317  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
2318  if (particle->Pt()>0.005){
2319  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, 0x0, fInputEvent);
2320  // if(particle->GetPdgCode() == 221){
2321  // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2322  // }
2323  }
2324  }
2325  Double_t mesonY = 1.e30;
2326  Double_t ratio = 0;
2327  if (particle->E() != TMath::Abs(particle->Pz())){
2328  ratio = (particle->E()+particle->Pz()) / (particle->E()-particle->Pz());
2329  }
2330  if( !(ratio <= 0) ){
2331  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2332  }
2333 
2334  Double_t alpha = -1;
2335  if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
2336  alpha = TMath::Abs((daughter0->E() - daughter1->E()))/(daughter0->E() + daughter1->E());
2337  }
2338 
2339 
2340  if(particle->GetPdgCode() == 111){
2341  fHistoMCPi0GGPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
2342  fHistoMCPi0GGWOWeightPt[fiCut]->Fill(particle->Pt());
2343  if (fDoMesonQA > 0){
2344  fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
2345  fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha); // All MC Pi0
2346  }
2347  } else if(particle->GetPdgCode() == 221){
2348  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
2349  fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt());
2350  if (fDoMesonQA > 0){
2351  fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted); // All MC Pi0
2352  fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha); // All MC Pi0
2353  }
2354  }
2355 
2356  // Check the acceptance for both gammas
2357  if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter0,AODMCTrackArray,kFALSE) &&
2358  ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter1,AODMCTrackArray,kFALSE) &&
2359  ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
2360  ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
2361 
2362  if(particle->GetPdgCode() == 111){
2363  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Pi0 with gamma in acc
2364  } else if(particle->GetPdgCode() == 221){
2365  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted); // MC Eta with gamma in acc
2366  }
2367  }
2368  }
2369  }
2370  }
2371 
2372 }
2373 //________________________________________________________________________
2375 {
2376 
2377  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2378  Double_t mcProdVtxX = primVtxMC->GetX();
2379  Double_t mcProdVtxY = primVtxMC->GetY();
2380  Double_t mcProdVtxZ = primVtxMC->GetZ();
2381 
2382 
2383 
2384  // Loop over all primary MC particle
2385  for(Int_t i = 0; i < fMCEvent->GetNumberOfTracks(); i++) {
2386 
2387 
2388 
2389  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
2390 
2391  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
2392  if (!particle) continue;
2393 
2394 
2395 
2396  Int_t isMCFromMBHeader = -1;
2397  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2398 
2399  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
2400  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
2401 
2402  }
2403 
2404 
2405 
2406 
2407  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
2408 
2409 
2410  if ( ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(particle,fMCEvent) == kTRUE ){
2411 
2412  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
2413 
2414 
2415  if( IsPi0DalitzDaughter ( i ) == kTRUE ) {
2416 
2417  fHistoMCAllGammaPi0Pt[fiCut]->Fill(particle->Pt());
2418  }
2419 
2420  }
2421 
2422 
2423  if(((AliDalitzElectronCuts*)fElectronCutArray->At(fiCut))->ElectronIsSelectedMC(i,fMCEvent) == kTRUE){
2424 
2425  Double_t deltaX = particle->Vx() - mcProdVtxX;
2426  Double_t deltaY = particle->Vy() - mcProdVtxY;
2427  Double_t deltaZ = particle->Vz() - mcProdVtxZ;
2428 
2429  Double_t realRadius3D = TMath::Sqrt(deltaX*deltaX+deltaY*deltaY+deltaZ*deltaZ);
2430 
2431 
2432  if( particle->GetPdgCode() == -11) {
2433  fHistoMCAllPositronsPt[fiCut]->Fill(particle->Pt()); // All positrons
2434 
2435 
2436 
2437  if ( particle->GetMother(0) > -1 ) {
2438 
2439  if( IsPi0DalitzDaughter( i ) == kTRUE ){
2440  fHistoMCDecayPositronPi0Pt[fiCut]->Fill(particle->Pt()); //Positrons from Pi0->Dalitz
2441 
2442  if( i >= fMCEvent->GetNumberOfPrimaries() ){
2443 
2444  fHistoMCDecayNoPrimPositronPi0DalitzR[fiCut]->Fill(realRadius3D);
2445  fHistoMCDecayNoPrimPositronPi0DalitzID[fiCut]->Fill( particle->GetUniqueID());
2446 
2447  }
2448 
2449  }
2450 
2451  }
2452  }
2453  if( particle->GetPdgCode() == 11){
2454 
2455  fHistoMCAllElectronsPt[fiCut]->Fill(particle->Pt()); // All electrons
2456 
2457  if ( particle->GetMother(0) > -1 ) {
2458 
2459  if( IsPi0DalitzDaughter( i ) == kTRUE ){
2460  fHistoMCDecayElectronPi0Pt[fiCut]->Fill(particle->Pt()); //Electrons from Pi0->Dalitz
2461  }
2462 
2463  if( i >= fMCEvent->GetNumberOfPrimaries() ){
2464 
2465  fHistoMCDecayNoPrimElectronPi0DalitzR[fiCut]->Fill(realRadius3D);
2466  fHistoMCDecayNoPrimElectronPi0DalitzID[fiCut]->Fill( particle->GetUniqueID());
2467 
2468  }
2469 
2470  }
2471 
2472  }
2473  }
2474 
2475 
2476  if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kFALSE)){
2477 
2478 
2479 
2480  if ( TMath::Abs(particle->Eta()) < 0.66 ){
2481  if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt());
2482  }
2483 
2484  if(particle->GetMother(0) >-1){ // Meson Decay Gamma
2485  switch(fMCEvent->Particle(particle->GetMother(0))->GetPdgCode()){
2486  case 111: // Pi0
2487  fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt());
2488  break;
2489  case 113: // Rho0
2490  fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt());
2491  break;
2492  case 221: // Eta
2493  fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt());
2494  break;
2495  case 223: // Omega
2496  fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt());
2497  break;
2498  case 331: // Eta'
2499  fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt());
2500  break;
2501  case 333: // Phi
2502  fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt());
2503  break;
2504  case 3212: // Sigma
2505  fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt());
2506  break;
2507  }
2508  }
2509  }
2510  if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kTRUE)){
2511  fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt());
2512  if (fDoPhotonQA > 0){
2513  fHistoMCConvGammaR[fiCut]->Fill(((TParticle*)fMCEvent->Particle(particle->GetFirstDaughter()))->R());
2514  fHistoMCConvGammaEta[fiCut]->Fill(particle->Eta());
2515  }
2516  } // Converted MC Gamma
2517 
2518  if(fDoMesonAnalysis){
2519 
2520 
2522  ->MesonIsSelectedMC(particle,fMCEvent,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2523 
2524  Float_t weighted= 1;
2525 
2526  if( ((AliDalitzElectronCuts*) fElectronCutArray->At(fiCut))->DoWeights() ) {
2527 
2528  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
2529 
2530  if (particle->Pt()>0.005){
2531  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent, fInputEvent);
2532 
2533  }
2534  }
2535  }
2536 
2537  if(particle->GetPdgCode() == 111){
2538 
2539  fHistoMCPi0GGPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Pi0
2540  fHistoMCPi0GGWOWeightPt[fiCut]->Fill(particle->Pt());
2541 
2542 
2543  } else if(particle->GetPdgCode() == 221){
2544 
2545  fHistoMCEtaGGPt[fiCut]->Fill(particle->Pt(),weighted); // All MC Eta
2546  fHistoMCEtaGGWOWeightPt[fiCut]->Fill(particle->Pt());
2547 
2548  }
2549 
2550 
2551  }
2552 
2553 
2554  Int_t labelgamma = -1;
2555  Int_t labelelectron = -1;
2556  Int_t labelpositron = -1;
2557 
2558 
2559  if( ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedMCDalitz(particle,fMCEvent,labelelectron,labelpositron,labelgamma,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2560 
2561  Float_t weighted= 1;
2562 
2563  if( ((AliDalitzElectronCuts*) fElectronCutArray->At(fiCut))->DoWeights() ) {
2564  if( ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent,fInputEvent) ) {
2565  if (particle->Pt()>0.005){
2566  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent,fInputEvent);
2567  }
2568  }
2569  }
2570 
2571  if(particle->GetPdgCode() == 111){
2572  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(), weighted); // All MC Pi0 Dalitz
2573  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt() ); //All MC Pi0 Dalitz without weights
2574  }
2575  if(particle->GetPdgCode() == 221){
2576  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(), weighted); // All MC Eta
2577  fHistoMCEtaWOWeightPt[fiCut]->Fill( particle->Pt() ); //All MC Eta Dalitz without weights
2578  }
2579 
2580  // Check the acceptance for gamma and electrons
2581 
2582  TParticle *gamma = fMCEvent->Particle(labelgamma);
2583  TParticle *electron = fMCEvent->Particle(labelelectron);
2584  TParticle *positron = fMCEvent->Particle(labelpositron);
2585 
2586 
2587 
2588 
2589 
2590  Bool_t kDaughGammaIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, labelgamma, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2591  Bool_t kDaughElectIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, labelelectron, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2592  Bool_t kDaughPositIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, labelpositron, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2593 
2594 
2595 
2596  if( kDaughElectIsPrim && kDaughPositIsPrim && kDaughGammaIsPrim &&
2597  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma,fMCEvent) &&
2598  ((AliDalitzElectronCuts*)fElectronCutArray->At(fiCut))->ElectronIsSelectedMC(labelelectron,fMCEvent) &&
2599  ((AliDalitzElectronCuts*)fElectronCutArray->At(fiCut))->ElectronIsSelectedMC(labelpositron,fMCEvent) ) {
2600 
2601 
2602  TLorentzVector TLVEpos,TLVEneg,TLVDalitz;
2603 
2604  Double_t electronMass = TDatabasePDG::Instance()->GetParticle( ::kElectron )->Mass();
2605 
2606  TLVEpos.SetXYZM(positron->Px(),positron->Py(),positron->Pz(),electronMass);
2607  TLVEneg.SetXYZM(electron->Px(),electron->Py(),electron->Pz(),electronMass);
2608  TVector3 V3gamma(gamma->Px(),gamma->Py(),gamma->Pz());
2609  Double_t angleGammaEpos = V3gamma.Angle(TLVEpos.Vect());
2610  Double_t angleGammaEneg = V3gamma.Angle(TLVEneg.Vect());
2611 
2612 
2613 
2614 
2615 
2616 
2617  if( particle->GetPdgCode() == 111 ){
2618 
2619 
2620  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt() , weighted); // MC Pi0Dalitz with gamma and e+e- in acc
2621 
2622  if( fDoMesonQA > 0 ) {
2623 
2624  fHistoMCPi0InAccOpeningAngleGammaElectron[fiCut]->Fill(angleGammaEpos);
2625  fHistoMCPi0InAccOpeningAngleGammaElectron[fiCut]->Fill(angleGammaEneg);
2626 
2627  }
2628 
2629 
2630  }
2631  if( particle->GetPdgCode() == 221 ){
2632 
2633  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(), weighted); // MC EtaDalitz with gamma and e+e- in acc
2634 
2635  }
2636  }
2637  }
2638  }
2639  }
2640  }
2641 }
2642 
2643 
2644 //________________________________________________________________________
2646 
2647  // Conversion Gammas
2648 
2649  if( fClusterCandidates->GetEntries() > 0 && fVirtualGammaCandidates->GetEntries() > 0 ){
2650 
2651  vector<Bool_t> lGoodVirtualGamma(fVirtualGammaCandidates->GetEntries(), kFALSE);
2652 
2653  for(Int_t GammaIndex=0; GammaIndex<fClusterCandidates->GetEntries(); GammaIndex++){
2654 
2655  AliAODConversionPhoton *gamma=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(GammaIndex));
2656 
2657  if (gamma==NULL) continue;
2658 
2659 
2660  for(Int_t virtualGammaIndex=0;virtualGammaIndex<fVirtualGammaCandidates->GetEntries();virtualGammaIndex++){
2661 
2662  Bool_t matched = kFALSE;
2663 
2664  AliAODConversionPhoton *Vgamma=dynamic_cast<AliAODConversionPhoton*>(fVirtualGammaCandidates->At(virtualGammaIndex));
2665  if (Vgamma==NULL) continue;
2666 
2667  //Check for same Electron ID
2668  if ( gamma->GetIsCaloPhoton() ){
2669 
2670  AliVCluster* cluster = fInputEvent->GetCaloCluster(gamma->GetCaloClusterRef());
2671  matched = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(Vgamma,cluster,fInputEvent );
2672 
2673  }
2674 
2675 
2676  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma,Vgamma);
2677  pi0cand->SetLabels(GammaIndex,virtualGammaIndex);
2678 
2679 
2680 
2681 
2682  if( (((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())) ){
2683 
2684  Int_t zbin = 0;
2685  Int_t mbin = 0;
2686 
2687  Double_t angleGammaPositron = -999;
2688  Double_t angleGammaElectron = -999;
2689 
2690 
2691  if ( fDoMesonQA > 0 ) {
2692 
2693  AliESDtrack* positronVgamma = (AliESDtrack*)fInputEvent->GetTrack( Vgamma->GetTrackLabelPositive() );
2694  Double_t momPositron[3];
2695  positronVgamma->GetConstrainedPxPyPz(momPositron);
2696 
2697 
2698  AliESDtrack* electronVgamma = (AliESDtrack*)fInputEvent->GetTrack( Vgamma->GetTrackLabelNegative() );
2699  Double_t momElectron[3];
2700  electronVgamma->GetConstrainedPxPyPz(momElectron);
2701 
2702 
2703  TVector3 vGamma(gamma->GetPx(),gamma->GetPy(),gamma->GetPz());;
2704  TVector3 vPositron(momPositron[0],momPositron[1],momPositron[2]);
2705  TVector3 vElectron(momElectron[0],momElectron[1],momElectron[2]);
2706 
2707  angleGammaPositron = vGamma.Angle(vPositron);
2708  angleGammaElectron = vGamma.Angle(vElectron);
2709 
2710  }
2711 
2712 
2713 
2714  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->DoBGCalculation()){
2715 
2716  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->BackgroundHandlerType() == 0){
2717 
2718  zbin = fBGClusHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
2719 
2720  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2722  } else {
2724  }
2725  }
2726  }
2727 
2728  if( ((AliDalitzElectronCuts*)fElectronCutArray->At(fiCut))->DoMassCut() == kTRUE ) {
2729  if( ((AliDalitzElectronCuts*) fElectronCutArray->At(fiCut))->MassCut( pi0cand->Pt() , Vgamma->M() ) == kTRUE ){
2730 
2731  if (matched){
2732 
2733  fHistoMotherMatchedInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2734 
2735  } else {
2736 
2737  fHistoMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2738 
2739  if(TMath::Abs(pi0cand->GetAlpha())<0.1)
2740  fHistoMotherInvMassEalpha[fiCut]->Fill(pi0cand->M(),pi0cand->E());
2741 
2742 
2743  if( fDoMesonQA > 0 ) {
2744 
2745  fHistoMotherInvMassOpeningAngleGammaElectron[fiCut]->Fill( angleGammaPositron );
2746  fHistoMotherInvMassOpeningAngleGammaElectron[fiCut]->Fill( angleGammaElectron );
2747 
2748 
2749  }
2750 
2751 
2752  if( fDoTHnSparse ) {
2753  Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
2754  fSparseMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
2755  }
2756 
2757  if(fMCEvent){
2758  ProcessTrueMesonCandidates(pi0cand,Vgamma,gamma,matched);
2759  }
2760 
2761  }
2762  }
2763  } else {
2764 
2765  if (matched){
2766  fHistoMotherMatchedInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2767  } else {
2768 
2769  fHistoMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2770 
2771  if(TMath::Abs( pi0cand->GetAlpha()) < 0.1 )
2772  fHistoMotherInvMassEalpha[fiCut]->Fill(pi0cand->M(),pi0cand->E());
2773 
2774  if ( fDoTHnSparse ) {
2775  Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
2776  fSparseMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
2777  }
2778 
2779  if( fDoMesonQA > 0 ) {
2780 
2781  fHistoMotherInvMassOpeningAngleGammaElectron[fiCut]->Fill( angleGammaPositron );
2782  fHistoMotherInvMassOpeningAngleGammaElectron[fiCut]->Fill( angleGammaElectron );
2783 
2784  }
2785 
2786 
2787  if(fMCEvent){
2788  ProcessTrueMesonCandidates(pi0cand,Vgamma,gamma,matched);
2789  }
2790  }
2791 
2792  }
2793  }
2794  delete pi0cand;
2795  pi0cand=0x0;
2796  }
2797  }
2798  }
2799 }
2800 
2801 //______________________________________________________________________
2803 {
2804  // Process True Mesons
2805 
2806  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2807  Double_t mcProdVtxX = primVtxMC->GetX();
2808  Double_t mcProdVtxY = primVtxMC->GetY();
2809  Double_t mcProdVtxZ = primVtxMC->GetZ();
2810 
2811 
2812  Bool_t isTruePi0 = kFALSE;
2813  Bool_t isTrueEta = kFALSE;
2814 
2815 
2816  Int_t virtualGammaMCLabel = TrueVirtualGammaCandidate->GetMCParticleLabel(fMCEvent);
2817  Int_t virtualGammaMotherLabel = -1;
2818  Int_t virtualGamma = -1;
2819 
2820  Bool_t motherFromShower = kFALSE;
2821 
2822  Double_t angleGammaPositron = -999;
2823  Double_t angleGammaElectron = -999;
2824 
2825 
2826  if( fDoMesonQA > 0 ) {
2827 
2828  AliESDtrack* positronVgamma = (AliESDtrack*)fInputEvent->GetTrack( TrueVirtualGammaCandidate->GetTrackLabelPositive() );
2829  Double_t momPositron[3];
2830  positronVgamma->GetConstrainedPxPyPz(momPositron);
2831 
2832 
2833  AliESDtrack* electronVgamma = (AliESDtrack*)fInputEvent->GetTrack( TrueVirtualGammaCandidate->GetTrackLabelNegative() );
2834  Double_t momElectron[3];
2835  electronVgamma->GetConstrainedPxPyPz(momElectron);
2836 
2837 
2838  TVector3 vGamma(TrueGammaCandidate1->GetPx(),TrueGammaCandidate1->GetPy(),TrueGammaCandidate1->GetPz());;
2839  TVector3 vPositron(momPositron[0],momPositron[1],momPositron[2]);
2840  TVector3 vElectron(momElectron[0],momElectron[1],momElectron[2]);
2841 
2842  angleGammaPositron = vGamma.Angle(vPositron);
2843  angleGammaElectron = vGamma.Angle(vElectron);
2844 
2845  }
2846 
2847 
2848 
2849  if( virtualGammaMCLabel != -1 ){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2850  // Daughters Gamma 1
2851  TParticle * negativeMC = (TParticle*)TrueVirtualGammaCandidate->GetNegativeMCDaughter(fMCEvent);
2852  TParticle * positiveMC = (TParticle*)TrueVirtualGammaCandidate->GetPositiveMCDaughter(fMCEvent);
2853  TParticle * virtualGammaMotherMC = (TParticle*)fMCEvent->Particle(virtualGammaMCLabel);
2854 
2855  if( TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11) { // Electrons ...
2856 
2857  if( virtualGammaMotherMC->GetPdgCode() != 22 ){
2858  virtualGammaMotherLabel=virtualGammaMCLabel;
2859  virtualGamma = 1;
2860 
2861  } else if (negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
2862  virtualGammaMotherLabel=virtualGammaMotherMC->GetMother(0);
2863  virtualGamma = 0; //no virtual gamma
2864  }
2865  }
2866  }
2867 
2868  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2869 
2870  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
2871  Int_t gamma1MotherLabel = -1;
2872  // check if
2873 
2874  if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2875 
2876  // Daughters Gamma 1
2877  TParticle * gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
2878 
2879  if ( TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron() ){ // largest component is electro magnetic
2880  // get mother of interest (pi0 or eta)
2881  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
2882  gamma1MotherLabel=gammaMC1->GetMother(0);
2883  } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
2884  if (TrueGammaCandidate1->IsConversion()) gamma1MotherLabel=fMCEvent->Particle(gammaMC1->GetMother(0))->GetMother(0);
2885  else gamma1MotherLabel=gammaMC1->GetMother(0);
2886  }
2887 
2888 
2889  if( gamma1MotherLabel > -1 ){
2890 
2891  Int_t pdgCodeMother = ((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode();
2892 
2893  if( pdgCodeMother != 111 && pdgCodeMother != 221 ){ //The mother is not and eta and MC
2894 
2895  gamma1MotherLabel = FindMotherOfPhoton( gamma1MotherLabel );
2896  motherFromShower = kTRUE;
2897 
2898  }
2899  }
2900 
2901 
2902 
2903  } else {
2904  if (fDoMesonQA > 0) fHistoTrueMotherCaloEMNonLeadingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2905  }
2906  }
2907 
2908  if(virtualGammaMotherLabel >= 0 && virtualGammaMotherLabel==gamma1MotherLabel){
2909 
2910  if(((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
2911  isTruePi0=kTRUE;
2912  if (CheckVectorForDoubleCount(fVectorDoubleCountTruePi0s,gamma1MotherLabel)) fHistoDoubleCountTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2913  }
2914 
2915  if(((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 221){
2916  isTrueEta=kTRUE;
2917  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueEtas,gamma1MotherLabel)) fHistoDoubleCountTrueEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2918  }
2919 
2920  }
2921 
2922  if(isTruePi0 || isTrueEta){// True Pion or Eta
2923 
2924 
2925  if( virtualGamma == 1 ){
2926 
2927  if( !matched ) {
2928 
2929  if( isTruePi0 ) {
2930 
2931  fHistoTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2932  if( fDoMesonQA > 0 ) {
2933  fHistoTruePi0OpeningAngleGammaElectron[fiCut]->Fill(angleGammaPositron);
2934  fHistoTruePi0OpeningAngleGammaElectron[fiCut]->Fill(angleGammaElectron);
2935  }
2936  }
2937  if (isTrueEta)fHistoTrueEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2938 
2939  }
2940 
2941 
2942  if (fDoMesonQA > 0){
2943 
2944 
2945  if( motherFromShower == kTRUE && !matched ){
2946 
2947  if (isTruePi0)fHistoTruePi0ShowerInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2948  if (isTrueEta)fHistoTrueEtaShowerInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2949 
2950  } else if ( motherFromShower == kFALSE && !matched ){
2951 
2952  if (isTruePi0)fHistoTruePi0NoShowerInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2953  if (isTrueEta)fHistoTrueEtaNoShowerInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2954 
2955  }
2956 
2957  if (TrueGammaCandidate1->IsLargestComponentPhoton() && !matched){
2958  if(isTruePi0) fHistoTruePi0CaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2959  if(isTrueEta) fHistoTrueEtaCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2960  }
2961  if (TrueGammaCandidate1->IsLargestComponentElectron() && !matched){
2962  if(isTruePi0) fHistoTruePi0CaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2963  if(isTrueEta) fHistoTrueEtaCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2964  }
2965  if (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() ){
2966  if (isTruePi0 && !matched)fHistoTruePi0CaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2967  if (isTrueEta && !matched)fHistoTrueEtaCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2968  if ((TrueVirtualGammaCandidate->GetMCLabelPositive() == gamma1MCLabel || TrueVirtualGammaCandidate->GetMCLabelNegative() == gamma1MCLabel) && isTruePi0){
2969  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2970  }
2971  if ((TrueVirtualGammaCandidate->GetMCLabelPositive() == gamma1MCLabel || TrueVirtualGammaCandidate->GetMCLabelNegative() == gamma1MCLabel) && isTrueEta){
2972  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2973  }
2974  }
2975  if ((TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged()) && !matched ){
2976  if (isTruePi0 )fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2977  if (isTrueEta )fHistoTrueEtaCaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2978  }
2979  if (TrueGammaCandidate1->IsMergedPartConv() && !matched){
2980  if (isTruePi0) fHistoTruePi0CaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2981  if (isTrueEta) fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2982  }
2983  }
2984 
2985  if ( !matched ) {
2986 
2987  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, gamma1MotherLabel, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2988 
2989 
2990  if(!isPrimary){ // Secondary Meson
2991 
2992  Int_t secMotherLabel = ((TParticle*)fMCEvent->Particle(virtualGammaMotherLabel))->GetMother(0);
2993  Float_t weightedSec = 1;
2994 
2995  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, fMCEvent, fInputEvent) && fMCEvent->Particle(secMotherLabel)->GetPdgCode()==310){
2996  weightedSec= ((AliConvEventCuts*)fEventCutArray->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
2997 
2998  }
2999 
3000  if (isTruePi0){
3001  fHistoTrueSecondaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
3002  fHistoTrueSecondaryPi0PhotonPairPtconv[fiCut]->Fill(Pi0Candidate->M(),TrueGammaCandidate1->Pt(),weightedSec);
3003  if(CheckIfContainedInString(fStringRecTruePi0s[fiCut],virtualGammaMotherLabel)){
3004  fHistoTrueSecondaryPi0DCPtconv[fiCut]->Fill(TrueGammaCandidate1->Pt(),weightedSec);
3005  }
3006  }
3007 
3008  if (secMotherLabel >-1){
3009  if(fMCEvent->Particle(secMotherLabel)->GetPdgCode()==310 && isTruePi0 ){
3010  fHistoTrueSecondaryPi0FromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
3011  if (fDoMesonQA > 0)fHistoTrueK0sWithPi0DaughterMCPt[fiCut]->Fill(fMCEvent->Particle(secMotherLabel)->Pt());
3012  }
3013  if(fMCEvent->Particle(secMotherLabel)->GetPdgCode()==221 && isTruePi0){
3014  fHistoTrueSecondaryPi0FromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
3015  if (fDoMesonQA > 0)fHistoTrueEtaWithPi0DaughterMCPt[fiCut]->Fill(fMCEvent->Particle(secMotherLabel)->Pt());
3016  }
3017  if(fMCEvent->Particle(secMotherLabel)->GetPdgCode()==3122 && isTruePi0){
3018  fHistoTrueSecondaryPi0FromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
3019  if (fDoMesonQA > 0)fHistoTrueLambdaWithPi0DaughterMCPt[fiCut]->Fill(fMCEvent->Particle(secMotherLabel)->Pt());
3020  }
3021  }
3022  } else { // Only primary pi0 for efficiency calculation
3023  Float_t weighted= 1;
3024  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, fMCEvent, fInputEvent)){
3025  if (((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->Pt()>0.005){
3026  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(gamma1MotherLabel, fMCEvent, fInputEvent);
3027  // cout << "rec \t " <<gamma1MotherLabel << "\t" << weighted << endl;
3028  }
3029  }
3030  if (isTruePi0){
3031  fHistoTruePrimaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
3032  fHistoTruePrimaryPi0PhotonPairPtconv[fiCut]->Fill(Pi0Candidate->M(),TrueGammaCandidate1->Pt(),weighted);
3033  fHistoTruePrimaryPi0W0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3034  fProfileTruePrimaryPi0WeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
3035  if(CheckIfContainedInString(fStringRecTruePi0s[fiCut],virtualGammaMotherLabel)){
3036  fHistoTruePrimaryPi0DCPtconv[fiCut]->Fill(TrueGammaCandidate1->Pt(),weighted);
3037  }
3038 
3039  } else if (isTrueEta) {
3040  fHistoTruePrimaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
3041  fHistoTruePrimaryEtaPhotonPairPtconv[fiCut]->Fill(Pi0Candidate->M(),TrueGammaCandidate1->Pt(),weighted);
3042  fHistoTruePrimaryEtaW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3043  fProfileTruePrimaryEtaWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
3044  if(CheckIfContainedInString(fStringRecTrueEtas[fiCut],virtualGammaMotherLabel)){
3045  fHistoTruePrimaryEtaDCPtconv[fiCut]->Fill(TrueGammaCandidate1->Pt(),weighted);
3046  }
3047  }
3048 
3049  if (fDoMesonQA > 0){
3050  if(isTruePi0){ // Only primary pi0 for resolution
3051  fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->Pt())/((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->Pt(),weighted);
3052  }
3053  if (isTrueEta){ // Only primary eta for resolution
3054  fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->Pt(),(Pi0Candidate->Pt()-((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->Pt())/((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->Pt(),weighted);
3055  }
3056  }
3057  }
3058  }
3059  } else if ( virtualGamma == 0 ) {
3060 
3061  if( !matched ) {
3062 
3063  if (isTruePi0)fHistoTruePi0GGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3064  if (isTrueEta)fHistoTrueEtaGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3065 
3066  if(virtualGammaMotherLabel >= fMCEvent->GetNumberOfPrimaries()){ // Secondary Meson
3067 
3068  Int_t secMotherLabel = ((TParticle*)fMCEvent->Particle(virtualGammaMotherLabel))->GetMother(0);
3069  Float_t weightedSec= 1;
3070 
3071  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, fMCEvent, fInputEvent) && fMCEvent->Particle(secMotherLabel)->GetPdgCode()==310){
3072  weightedSec= ((AliConvEventCuts*)fEventCutArray->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
3073  //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
3074  }
3075  if (isTruePi0){
3076  fHistoTrueSecondaryPi0GGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
3077  }
3078 
3079  } else { // Only primary pi0 for efficiency calculation
3080  Float_t weighted= 1;
3081  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, fMCEvent, fInputEvent)){
3082  if (((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->Pt()>0.005){
3083  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(gamma1MotherLabel, fMCEvent, fInputEvent);
3084  // cout << "rec \t " <<gamma1MotherLabel << "\t" << weighted << endl;
3085  }
3086  }
3087  if (isTruePi0){
3088  fHistoTruePrimaryPi0GGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
3089 
3090  } else if (isTrueEta) {
3091  fHistoTruePrimaryEtaGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
3092  }
3093 
3094  }
3095  }
3096 
3097  }
3098 
3099  } else if( !isTruePi0 && !isTrueEta ){ // Background
3100 
3101  if (fDoMesonQA > 0){
3102  if(virtualGammaMotherLabel>-1 && gamma1MotherLabel>-1 && virtualGamma == 0){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
3103  fHistoTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3104  } else { // No photon or without mother
3105  fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3106  }
3107  }
3108  }
3109 
3110 
3111  if (isTrueEta && !matched){
3112  fStringRecTrueEtas[fiCut].Append(Form("%i,",virtualGammaMotherLabel));
3113  }
3114  if (isTruePi0 && !matched){
3115  fStringRecTruePi0s[fiCut].Append(Form("%i,",virtualGammaMotherLabel));
3116  }
3117 
3118 }
3119 //______________________________________________________________________
3121 {
3122  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3123  Double_t mcProdVtxX = primVtxMC->GetX();
3124  Double_t mcProdVtxY = primVtxMC->GetY();
3125  Double_t mcProdVtxZ = primVtxMC->GetZ();
3126 
3127  // Process True Mesons
3128  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3129  Bool_t isTruePi0 = kFALSE;
3130  Bool_t isTrueEta = kFALSE;
3131 
3132  AliAODMCParticle *positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
3133  AliAODMCParticle *negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
3134 
3135  Int_t gamma0MCLabel = -1;
3136  Int_t gamma0MotherLabel = -1;
3137  if(!positiveMC||!negativeMC)
3138  return;
3139 
3140  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
3141  gamma0MCLabel = positiveMC->GetMother();
3142  AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3143  gamma0MotherLabel=gammaMC0->GetMother();
3144  }
3145 
3146  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3147  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
3148  Int_t gamma1MotherLabel = -1;
3149  // check if
3150 
3151  if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
3152  // Daughters Gamma 1
3153  AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
3154  if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
3155  // get mother of interest (pi0 or eta)
3156  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
3157  gamma1MotherLabel=gammaMC1->GetMother();
3158  } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
3159  if (TrueGammaCandidate1->IsConversion()){
3160  AliAODMCParticle * gammaGrandMotherMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
3161  gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
3162  } else gamma1MotherLabel=gammaMC1->GetMother();
3163  }
3164  } else {
3165  if (fDoMesonQA > 0) fHistoTrueMotherCaloEMNonLeadingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3166  }
3167  }
3168 
3169  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
3170  if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
3171  isTruePi0=kTRUE;
3172  if (CheckVectorForDoubleCount(fVectorDoubleCountTruePi0s,gamma1MotherLabel)) fHistoDoubleCountTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3173  }
3174  if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 221){
3175  isTrueEta=kTRUE;
3176  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueEtas,gamma1MotherLabel)) fHistoDoubleCountTrueEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3177  }
3178  }
3179 
3180  if(isTruePi0 || isTrueEta){// True Pion or Eta
3181  if (!matched){
3182  if (isTruePi0)fHistoTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3183  if (isTrueEta)fHistoTrueEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3184  }
3185  if (fDoMesonQA > 0){
3186  if (TrueGammaCandidate1->IsLargestComponentPhoton() && !matched){
3187  if (isTruePi0) fHistoTruePi0CaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3188  if (isTrueEta) fHistoTrueEtaCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3189  }
3190  if (TrueGammaCandidate1->IsLargestComponentElectron() && !matched) {
3191  if (isTruePi0) fHistoTruePi0CaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3192  if (isTrueEta) fHistoTrueEtaCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3193  }
3194  if (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()){
3195 
3196  if (isTruePi0 && !matched)fHistoTruePi0CaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3197  if (isTrueEta && !matched)fHistoTrueEtaCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3198  if ((TrueGammaCandidate0->GetMCLabelPositive() == gamma1MCLabel || TrueGammaCandidate0->GetMCLabelNegative() == gamma1MCLabel) && isTruePi0)
3199  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3200  if ((TrueGammaCandidate0->GetMCLabelPositive() == gamma1MCLabel || TrueGammaCandidate0->GetMCLabelNegative() == gamma1MCLabel) && isTrueEta)
3201  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3202  }
3203  if ((TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged()) && !matched ){
3204  if (isTruePi0) fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3205  if (isTrueEta) fHistoTrueEtaCaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3206  }
3207  if (TrueGammaCandidate1->IsMergedPartConv() && !matched) {
3208  if (isTruePi0) fHistoTruePi0CaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3209  if (isTrueEta) fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3210  }
3211  }
3212 
3213  if ( !matched){
3214  if (fDoMesonQA > 0){
3215  if (isTruePi0){
3216  if ( Pi0Candidate->M() > 0.05 && Pi0Candidate->M() < 0.17){
3217  fHistoTruePi0PtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
3218  fHistoTruePi0PtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),TMath::Abs(Pi0Candidate->GetAlpha()));
3219  fHistoTruePi0PtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
3220  fHistoTrueMotherPi0ConvPhotonEtaPhi[fiCut]->Fill(TrueGammaCandidate0->GetPhotonPhi(), TrueGammaCandidate0->GetPhotonEta());
3221  }
3222  } else if (isTrueEta){
3223  if ( Pi0Candidate->M() > 0.45 && Pi0Candidate->M() < 0.65){
3224  fHistoTrueEtaPtY[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift());
3225  fHistoTrueEtaPtAlpha[fiCut]->Fill(Pi0Candidate->Pt(),TMath::Abs(Pi0Candidate->GetAlpha()));
3226  fHistoTrueEtaPtOpenAngle[fiCut]->Fill(Pi0Candidate->Pt(),Pi0Candidate->GetOpeningAngle());
3227  fHistoTrueMotherEtaConvPhotonEtaPhi[fiCut]->Fill(TrueGammaCandidate0->GetPhotonPhi(), TrueGammaCandidate0->GetPhotonEta());
3228  }
3229  }
3230  }
3231  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel)), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3232  if(isPrimary){ // Secondary Meson
3233  Int_t secMotherLabel = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->GetMother();
3234  Float_t weightedSec= 1;
3235  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, 0x0, fInputEvent) && static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310){
3236  weightedSec= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(secMotherLabel, 0x0, 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
3237  //cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
3238  }
3239  if (isTruePi0){
3240  fHistoTrueSecondaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
3241  fHistoTrueSecondaryPi0PhotonPairPtconv[fiCut]->Fill(Pi0Candidate->M(),TrueGammaCandidate0->Pt(),weightedSec);
3242  if(CheckIfContainedInString(fStringRecTruePi0s[fiCut],gamma0MotherLabel)){
3243  fHistoTrueSecondaryPi0DCPtconv[fiCut]->Fill(TrueGammaCandidate0->Pt(),weightedSec);
3244  }
3245  }
3246  if (secMotherLabel >-1){
3247  if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310 && isTruePi0){
3248  fHistoTrueSecondaryPi0FromK0sInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
3249  if (fDoMesonQA > 0)fHistoTrueK0sWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
3250  }
3251  if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==221 && isTruePi0){
3252  fHistoTrueSecondaryPi0FromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
3253  if (fDoMesonQA > 0)fHistoTrueEtaWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
3254  }
3255  if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==3122 && isTruePi0){
3256  fHistoTrueSecondaryPi0FromLambdaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weightedSec);
3257  if (fDoMesonQA > 0)fHistoTrueLambdaWithPi0DaughterMCPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->Pt());
3258  }
3259  }
3260  } else{ // Only primary pi0 for efficiency calculation
3261  Float_t weighted= 1;
3262  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma1MotherLabel, 0x0, fInputEvent)){
3263  if (static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt()>0.005){
3264  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(gamma1MotherLabel, 0x0, fInputEvent);
3265  // cout << "rec \t " <<gamma1MotherLabel << "\t" << weighted << endl;
3266  }
3267  }
3268  if (isTruePi0){
3269  fHistoTruePrimaryPi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
3270  fHistoTruePrimaryPi0W0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3271  fHistoTruePrimaryPi0PhotonPairPtconv[fiCut]->Fill(Pi0Candidate->M(),TrueGammaCandidate0->Pt(),weighted);
3272  fProfileTruePrimaryPi0WeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
3273  if(CheckIfContainedInString(fStringRecTruePi0s[fiCut],gamma0MotherLabel)){
3274  fHistoTruePrimaryPi0DCPtconv[fiCut]->Fill(TrueGammaCandidate0->Pt(),weighted);
3275  }
3276  } else if (isTrueEta){
3277  fHistoTruePrimaryEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
3278  fHistoTruePrimaryEtaW0WeightingInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3279  fHistoTruePrimaryEtaPhotonPairPtconv[fiCut]->Fill(Pi0Candidate->M(),TrueGammaCandidate0->Pt(),weighted);
3280  fProfileTruePrimaryEtaWeightsInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(),weighted);
3281  if(CheckIfContainedInString(fStringRecTrueEtas[fiCut],gamma0MotherLabel)){
3282  fHistoTruePrimaryEtaDCPtconv[fiCut]->Fill(TrueGammaCandidate0->Pt(),weighted);
3283  }
3284  }
3285  if (fDoMesonQA > 0){
3286  if(isTruePi0){ // Only primary pi0 for resolution
3287  fHistoTruePrimaryPi0MCPtResolPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),
3288  (Pi0Candidate->Pt()-static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt())/static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),weighted);
3289 
3290  }
3291  if (isTrueEta){ // Only primary eta for resolution
3292  fHistoTruePrimaryEtaMCPtResolPt[fiCut]->Fill(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),
3293  (Pi0Candidate->Pt()-static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt())/static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->Pt(),weighted);
3294  }
3295  }
3296  }
3297  }
3298  } else if(!isTruePi0 && !isTrueEta) { // Background
3299  if (fDoMesonQA > 0){
3300  if(gamma0MotherLabel>-1 && gamma1MotherLabel>-1){ // Both Tracks are Photons and have a mother but not Pi0 or Eta
3301  fHistoTrueBckGGInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3302  } else { // No photon or without mother
3303  fHistoTrueBckContInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3304  }
3305  }
3306  }
3307 
3308  if (isTrueEta && !matched){
3309  fStringRecTrueEtas[fiCut].Append(Form("%i,",gamma0MotherLabel));
3310  }
3311  if (isTruePi0 && !matched){
3312  fStringRecTruePi0s[fiCut].Append(Form("%i,",gamma0MotherLabel));
3313  }
3314 
3315 
3316 
3317 }
3318 
3319 //________________________________________________________________________
3321 {
3322  Int_t nV0 = 0;
3323  TList *GammaCandidatesStepOne = new TList();
3324  TList *GammaCandidatesStepTwo = new TList();
3325  // Loop over Photon Candidates allocated by ReaderV1
3326  for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
3327  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
3328  if(!PhotonCandidate) continue;
3329  fIsFromMBHeader = kTRUE;
3330 
3331  if(fIsMC && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3332 
3333  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
3334  if(isPosFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3335  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
3336  if(isNegFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3337  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
3338  }
3339 
3340  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fInputEvent)) continue;
3341  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->InPlaneOutOfPlaneCut(PhotonCandidate->GetPhotonPhi(),fEventPlaneAngle)) continue;
3342  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseElecSharingCut() &&
3343  !((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseToCloseV0sCut()){
3344  fGammaCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
3345 
3346  if(fIsFromMBHeader){
3347  fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
3348  if (fDoPhotonQA > 0){
3349  fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
3350  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
3351  }
3352  }
3353  if(fIsMC){
3354  if(fInputEvent->IsA()==AliESDEvent::Class())
3355  ProcessTruePhotonCandidates(PhotonCandidate);
3356  if(fInputEvent->IsA()==AliAODEvent::Class())
3357  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3358  }
3359 
3360  } else if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
3361  ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
3362  nV0++;
3363  GammaCandidatesStepOne->Add(PhotonCandidate);
3364  } else if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseElecSharingCut() &&
3365  ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
3366  GammaCandidatesStepTwo->Add(PhotonCandidate);
3367  }
3368  }
3369 
3370  if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseElecSharingCut()){
3371  for(Int_t i = 0;i<GammaCandidatesStepOne->GetEntries();i++){
3372  AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GammaCandidatesStepOne->At(i);
3373  if(!PhotonCandidate) continue;
3374  fIsFromMBHeader = kTRUE;
3375  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3376  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
3377  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
3378  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
3379  }
3380  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GammaCandidatesStepOne->GetEntries())) continue;
3381  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
3382  fGammaCandidates->Add(PhotonCandidate);
3383  if(fIsFromMBHeader){
3384  fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
3385  if (fDoPhotonQA > 0){
3386  fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
3387  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
3388  }
3389  }
3390 
3391  if(fIsMC){
3392  if(fInputEvent->IsA()==AliESDEvent::Class())
3393  ProcessTruePhotonCandidates(PhotonCandidate);
3394  if(fInputEvent->IsA()==AliAODEvent::Class())
3395  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3396  }
3397 
3398  }
3399  else GammaCandidatesStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
3400 
3401 
3402  }
3403  }
3404  if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseToCloseV0sCut()){
3405  for(Int_t i = 0;i<GammaCandidatesStepTwo->GetEntries();i++){
3406  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GammaCandidatesStepTwo->At(i);
3407  if(!PhotonCandidate) continue;
3408  fIsFromMBHeader = kTRUE;
3409  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3410  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
3411  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
3412  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
3413  }
3414  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GammaCandidatesStepTwo,i)) continue;
3415  fGammaCandidates->Add(PhotonCandidate); // Add gamma to current cut TList
3416  if(fIsFromMBHeader){
3417  fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
3418  if (fDoPhotonQA > 0){
3419  fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
3420  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
3421  }
3422  }
3423  if(fIsMC){
3424  if(fInputEvent->IsA()==AliESDEvent::Class())
3425  ProcessTruePhotonCandidates(PhotonCandidate);
3426  if(fInputEvent->IsA()==AliAODEvent::Class())
3427  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3428  }
3429 
3430  }
3431  }
3432 
3433  delete GammaCandidatesStepOne;
3434  GammaCandidatesStepOne = 0x0;
3435  delete GammaCandidatesStepTwo;
3436  GammaCandidatesStepTwo = 0x0;
3437 
3438 }
3439 //________________________________________________________________________
3441 {
3442 
3443  Double_t magField = fInputEvent->GetMagneticField();
3444  if( magField < 0.0 ){
3445  magField = 1.0;
3446  }
3447  else {
3448  magField = -1.0;
3449  }
3450 
3451  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3452  if (AODMCTrackArray == NULL) return;
3453  AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
3454  AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
3455  fCharPhotonMCInfo = 0;
3456 
3457  if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
3458  Int_t pdgCode[2] = {TMath::Abs(posDaughter->GetPdgCode()),TMath::Abs(negDaughter->GetPdgCode())};
3459 
3460  if(posDaughter->GetMother() != negDaughter->GetMother()){
3461 
3462  fCharPhotonMCInfo = 1;
3463  return;
3464  }
3465  else if(posDaughter->GetMother() == -1){
3466 
3467  fCharPhotonMCInfo = 1;
3468  return;
3469  }
3470 
3471  if(pdgCode[0]!=11 || pdgCode[1]!=11){
3472  fCharPhotonMCInfo = 1;
3473  return; //One Particle is not a electron
3474  }
3475 
3476  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()){
3477  fCharPhotonMCInfo = 1;
3478  return; // Same Charge
3479  }
3480 
3481  AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
3482  if(Photon->GetPdgCode() != 22){
3483  fCharPhotonMCInfo = 1;
3484  return; // Mother is no Photon
3485  }
3486 
3487  if(((posDaughter->GetMCProcessCode())) != 5 || ((negDaughter->GetMCProcessCode())) != 5){
3488  fCharPhotonMCInfo = 1;
3489  return;// check if the daughters come from a conversion
3490  }
3491  // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
3492 
3493 
3494 
3495  // True Photon
3496  if(fIsFromMBHeader){
3497  fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
3498  if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
3499  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueConvGammas,posDaughter->GetMother())) fHistoDoubleCountTrueConvGammaRPt[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius(),TruePhotonCandidate->Pt());
3500  }
3501 
3502  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3503  Double_t mcProdVtxX = primVtxMC->GetX();
3504  Double_t mcProdVtxY = primVtxMC->GetY();
3505  Double_t mcProdVtxZ = primVtxMC->GetZ();
3506  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3507 
3508  if(isPrimary){
3509  // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
3510  if(fIsFromMBHeader){
3511  fCharPhotonMCInfo = 6;
3512  fHistoTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
3513  fHistoTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
3514  }
3515  // (Not Filled for i6, Extra Signal Gamma (parambox) are secondary)
3516  } else {
3517  if(fIsFromMBHeader){
3518  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
3519  fCharPhotonMCInfo = 2;
3520  if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3521  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 3122){
3522  fCharPhotonMCInfo = 5;
3523  fHistoTrueSecondaryConvGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
3524  }
3525  if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3526  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 310){
3527  fCharPhotonMCInfo = 4;
3528  fHistoTrueSecondaryConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
3529  }
3530  if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3531  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 221){
3532  fCharPhotonMCInfo = 3;
3533  }
3534  }
3535  }
3536  TruePhotonCandidate->SetIsTrueConvertedPhoton();
3537 }
3538 
3539 //________________________________________________________________________
3541 {
3542  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3543  Double_t mcProdVtxX = primVtxMC->GetX();
3544  Double_t mcProdVtxY = primVtxMC->GetY();
3545  Double_t mcProdVtxZ = primVtxMC->GetZ();
3546 
3547  Double_t magField = fInputEvent->GetMagneticField();
3548  if( magField < 0.0 ){
3549  magField = 1.0;
3550  }
3551  else {
3552  magField = -1.0;
3553  }
3554 
3555  // Process True Photons
3556  TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCEvent);
3557  TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCEvent);
3558  fCharPhotonMCInfo = 0;
3559 
3560  if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
3561  Int_t pdgCode[2] = {TMath::Abs(posDaughter->GetPdgCode()),TMath::Abs(negDaughter->GetPdgCode())};
3562  fCharPhotonMCInfo = 1;
3563  if(posDaughter->GetMother(0) != negDaughter->GetMother(0)){
3564 
3565  return;
3566  }
3567  else if(posDaughter->GetMother(0) == -1){
3568 
3569  return;
3570  }
3571 
3572  if(pdgCode[0]!=11 || pdgCode[1]!=11) return; //One Particle is not a electron
3573 
3574  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge
3575 
3576  TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCEvent);
3577 
3578  if(Photon->GetPdgCode() != 22){
3579  return; // Mother is no Photon
3580  }
3581 
3582  if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() !=5) return;// check if the daughters come from a conversion
3583 
3584  // True Photon
3585  if(fIsFromMBHeader){
3586  fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
3587  if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
3588  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueConvGammas,posDaughter->GetMother(0))) fHistoDoubleCountTrueConvGammaRPt[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius(),TruePhotonCandidate->Pt());
3589  }
3590  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, posDaughter->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3591  if(isPrimary){
3592  // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
3593  if(fIsFromMBHeader){
3594  fCharPhotonMCInfo = 6;
3595  fHistoTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
3596  fHistoTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt()); // Allways Filled
3597  }
3598  // (Not Filled for i6, Extra Signal Gamma (parambox) are secondary)
3599  } else {
3600  // fill secondary histograms
3601  if(fIsFromMBHeader){
3602  fCharPhotonMCInfo = 2;
3603  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
3604  if(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
3605  fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 3122){
3606  fHistoTrueSecondaryConvGammaFromXFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
3607  fCharPhotonMCInfo = 5;
3608  }
3609  if(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
3610  fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
3611  fHistoTrueSecondaryConvGammaFromXFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt());
3612  fCharPhotonMCInfo = 4;
3613  }
3614  if(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0) > -1 &&
3615  fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 221){
3616  fCharPhotonMCInfo = 3;
3617  }
3618  }
3619  }
3620  TruePhotonCandidate->SetIsTrueConvertedPhoton();
3621  return;
3622 }
3623 //________________________________________________________________________
3625 
3626  Int_t zbin= fBGClusHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
3627  Int_t mbin = 0;
3628 
3629 
3630  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
3632  } else {
3634  }
3635 
3636 
3638 
3639  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
3640 
3641  for(Int_t nEventsInBG=0;nEventsInBG<fBGClusHandler[fiCut]->GetNBGEvents();nEventsInBG++){
3642 
3643  AliGammaConversionAODVector *previousEventV0s = fBGClusHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
3644  if(fMoveParticleAccordingToVertex == kTRUE || ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
3645  bgEventVertex = fBGClusHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
3646  }
3647 
3648  for(Int_t iCurrent=0;iCurrent<fVirtualGammaCandidates->GetEntries();iCurrent++){
3649 
3650  AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fVirtualGammaCandidates->At(iCurrent));
3651 
3652  for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
3653  AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
3654 
3655  if(fMoveParticleAccordingToVertex == kTRUE){
3656  if (bgEventVertex){
3657  MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
3658  }
3659  }
3660  if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
3661  if (bgEventVertex){
3662  RotateParticleAccordingToEP(&previousGoodV0,bgEventVertex->fEP,fEventPlaneAngle);
3663  }
3664  }
3665 
3666  AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
3667  backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
3669  ->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
3670 
3671 
3672  if( ((AliDalitzElectronCuts*)fElectronCutArray->At(fiCut))->DoMassCut() == kTRUE ) {
3673 
3674  if( ((AliDalitzElectronCuts*) fElectronCutArray->At(fiCut))->MassCut( backgroundCandidate->Pt() , currentEventGoodV0.M() ) == kTRUE ){
3675 
3676 
3677  fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
3678 
3679  if(fDoTHnSparse){
3680  Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
3681  fSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
3682  }
3683  }
3684  }
3685  }
3686  delete backgroundCandidate;
3687  backgroundCandidate = 0x0;
3688  }
3689  }
3690  }
3691  } else {
3692  for(Int_t nEventsInBG=0;nEventsInBG <fBGClusHandler[fiCut]->GetNBGEvents();nEventsInBG++){
3693  AliGammaConversionAODVector *previousEventV0s = fBGClusHandler[fiCut]->GetBGGoodV0s(zbin,mbin,nEventsInBG);
3694  if(previousEventV0s){
3695  if(fMoveParticleAccordingToVertex == kTRUE || ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0 ){
3696  bgEventVertex = fBGClusHandler[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBG);
3697  }
3698  for(Int_t iCurrent=0;iCurrent<fVirtualGammaCandidates->GetEntries();iCurrent++){
3699  AliAODConversionPhoton currentEventGoodV0 = *(AliAODConversionPhoton*)(fVirtualGammaCandidates->At(iCurrent));
3700  for(UInt_t iPrevious=0;iPrevious<previousEventV0s->size();iPrevious++){
3701 
3702  AliAODConversionPhoton previousGoodV0 = (AliAODConversionPhoton)(*(previousEventV0s->at(iPrevious)));
3703 
3704  if(fMoveParticleAccordingToVertex == kTRUE){
3705  if (bgEventVertex){
3706  MoveParticleAccordingToVertex(&previousGoodV0,bgEventVertex);
3707  }
3708  }
3709  if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
3710  if (bgEventVertex){
3711  RotateParticleAccordingToEP(&previousGoodV0,bgEventVertex->fEP,fEventPlaneAngle);
3712  }
3713  }
3714 
3715  AliAODConversionMother *backgroundCandidate = new AliAODConversionMother(&currentEventGoodV0,&previousGoodV0);
3716  backgroundCandidate->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
3717  if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(backgroundCandidate,kFALSE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
3718 
3719  if( ((AliDalitzElectronCuts*)fElectronCutArray->At(fiCut))->DoMassCut() == kTRUE ) {
3720 
3721  if( ((AliDalitzElectronCuts*) fElectronCutArray->At(fiCut))->MassCut( backgroundCandidate->Pt() , currentEventGoodV0.M() ) == kTRUE ){
3722 
3723 
3724  fHistoMotherBackInvMassPt[fiCut]->Fill(backgroundCandidate->M(),backgroundCandidate->Pt());
3725 
3726  if(fDoTHnSparse){
3727  Double_t sparesFill[4] = {backgroundCandidate->M(),backgroundCandidate->Pt(),(Double_t)zbin,(Double_t)mbin};
3728  fSparseMotherBackInvMassPtZM[fiCut]->Fill(sparesFill,1);
3729  }
3730  }
3731  }
3732  }
3733  delete backgroundCandidate;
3734  backgroundCandidate = 0x0;
3735  }
3736  }
3737  }
3738  }
3739  }
3740 }
3741 
3742 //________________________________________________________________________
3744  Int_t fNDegreesPMBackground= ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->NDegreesRotation();
3745  Double_t nRadiansPM = fNDegreesPMBackground*TMath::Pi()/180;
3746  Double_t rotationValue = fRandom.Rndm()*2*nRadiansPM + TMath::Pi()-nRadiansPM;
3747  gamma->RotateZ(rotationValue);
3748 }
3749 
3750 //________________________________________________________________________
3752 
3753  previousEventEP=previousEventEP+TMath::Pi();
3754  thisEventEP=thisEventEP+TMath::Pi();
3755  Double_t rotationValue= thisEventEP-previousEventEP;
3756  gamma->RotateZ(rotationValue);
3757 }
3758 
3759 //________________________________________________________________________
3761  //see header file for documentation
3762 
3763  Double_t dx = vertex->fX - fInputEvent->GetPrimaryVertex()->GetX();
3764  Double_t dy = vertex->fY - fInputEvent->GetPrimaryVertex()->GetY();
3765  Double_t dz = vertex->fZ - fInputEvent->GetPrimaryVertex()->GetZ();
3766 
3767  Double_t movedPlace[3] = {particle->GetConversionX() - dx,particle->GetConversionY() - dy,particle->GetConversionZ() - dz};
3768  particle->SetConversionPoint(movedPlace);
3769 }
3770 //________________________________________________________________________
3772  //see header file for documentation
3773  if( fClusterCandidates->GetEntries() > 0 ){
3774  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
3775  fBGClusHandler[fiCut]->AddEvent(fClusterCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),fEventPlaneAngle);
3776  } else { // means we use #V0s for multiplicity
3777  fBGClusHandler[fiCut]->AddEvent(fClusterCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fClusterCandidates->GetEntries(),fEventPlaneAngle);
3778  }
3779  }
3780 }
3781 
3782 //________________________________________________________________________
3784 
3785  // Relabeling For AOD Event
3786  // ESDiD -> AODiD
3787  // MCLabel -> AODMCLabel
3788 
3789  if(mode){
3790  fMCEventPos = new Int_t[fReaderGammas->GetEntries()];
3791  fMCEventNeg = new Int_t[fReaderGammas->GetEntries()];
3792  fESDArrayPos = new Int_t[fReaderGammas->GetEntries()];
3793  fESDArrayNeg = new Int_t[fReaderGammas->GetEntries()];
3794  }
3795 
3796  for(Int_t iGamma = 0;iGamma<fReaderGammas->GetEntries();iGamma++){
3797  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(iGamma);
3798  if(!PhotonCandidate) continue;
3799  if(!mode){// Back to ESD Labels
3800  PhotonCandidate->SetMCLabelPositive(fMCEventPos[iGamma]);
3801  PhotonCandidate->SetMCLabelNegative(fMCEventNeg[iGamma]);
3802  PhotonCandidate->SetLabelPositive(fESDArrayPos[iGamma]);
3803  PhotonCandidate->SetLabelNegative(fESDArrayNeg[iGamma]);
3804  continue;
3805  }
3806  fMCEventPos[iGamma] = PhotonCandidate->GetMCLabelPositive();
3807  fMCEventNeg[iGamma] = PhotonCandidate->GetMCLabelNegative();
3808  fESDArrayPos[iGamma] = PhotonCandidate->GetTrackLabelPositive();
3809  fESDArrayNeg[iGamma] = PhotonCandidate->GetTrackLabelNegative();
3810 
3811  Bool_t AODLabelPos = kFALSE;
3812  Bool_t AODLabelNeg = kFALSE;
3813 
3814  for(Int_t i = 0; i<fInputEvent->GetNumberOfTracks();i++){
3815  AliAODTrack *tempDaughter = static_cast<AliAODTrack*>(fInputEvent->GetTrack(i));
3816  if(!AODLabelPos){
3817  if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelPositive() ){
3818  PhotonCandidate->SetMCLabelPositive(TMath::Abs(tempDaughter->GetLabel()));
3819  PhotonCandidate->SetLabelPositive(i);
3820  AODLabelPos = kTRUE;
3821  }
3822  }
3823  if(!AODLabelNeg){
3824  if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelNegative()){
3825  PhotonCandidate->SetMCLabelNegative(TMath::Abs(tempDaughter->GetLabel()));
3826  PhotonCandidate->SetLabelNegative(i);
3827  AODLabelNeg = kTRUE;
3828  }
3829  }
3830  if(AODLabelNeg && AODLabelPos){
3831  break;
3832  }
3833  }
3834  if(!AODLabelPos || !AODLabelNeg){
3835  cout<<"WARNING!!! AOD TRACKS NOT FOUND FOR"<<endl;
3836  }
3837  }
3838 
3839 
3840  if(!mode){
3841  delete[] fMCEventPos;
3842  delete[] fMCEventNeg;
3843  delete[] fESDArrayPos;
3844  delete[] fESDArrayNeg;
3845  }
3846 }
3847 
3849  TAxis *axisafter = histoRebin->GetXaxis();
3850  Int_t bins = axisafter->GetNbins();
3851  Double_t from = axisafter->GetXmin();
3852  Double_t to = axisafter->GetXmax();
3853  Double_t *newbins = new Double_t[bins+1];
3854  newbins[0] = from;
3855  Double_t factor = TMath::Power(to/from, 1./bins);
3856  for(Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
3857  axisafter->Set(bins, newbins);
3858  delete [] newbins;
3859 }
3860 
3861 //________________________________________________________________________
3863 {
3864 
3865  //fOutputContainer->Print(); // Will crash on GRID
3866 }
3867 
3868 //________________________________________________________________________
3870 
3871  if (daughter == 111) {
3872  if (TMath::Abs(pdgCode) == 310) return 1; // k0s
3873  else if (TMath::Abs(pdgCode) == 3122) return 2; // Lambda
3874  else if (TMath::Abs(pdgCode) == 130) return 3; // K0L
3875  else if (TMath::Abs(pdgCode) == 2212) return 4; // proton
3876  else if (TMath::Abs(pdgCode) == 2112) return 5; // neutron
3877  else if (TMath::Abs(pdgCode) == 211) return 6; // pion
3878  else if (TMath::Abs(pdgCode) == 321) return 7; // kaon
3879  else if (TMath::Abs(pdgCode) == 113 || TMath::Abs(pdgCode) == 213 ) return 8; // rho 0,+,-
3880  else if (TMath::Abs(pdgCode) == 3222 || TMath::Abs(pdgCode) == 3212 || TMath::Abs(pdgCode) == 3112 ) return 9; // Sigma
3881  else if (TMath::Abs(pdgCode) == 2224 || TMath::Abs(pdgCode) == 2214 || TMath::Abs(pdgCode) == 2114 || TMath::Abs(pdgCode) == 1114 ) return 10; // Delta
3882  else if (TMath::Abs(pdgCode) == 313 || TMath::Abs(pdgCode) == 323 ) return 11; // K*
3883  else return 15;
3884  }
3885  return 15;
3886 
3887 }
3888 
3889 //_________________________________________________________________________________
3891  TObjArray *arr = input.Tokenize(",");
3892  for (Int_t i = 0; i < arr->GetEntriesFast();i++){
3893  TString tempStr = ((TObjString*)arr->At(i))->GetString();
3894  if (tempStr.Atoi() == tobechecked) return kTRUE;
3895  }
3896  return kFALSE;
3897 }
3898 
3899 //_________________________________________________________________________________
3901  TObjArray *arr = input.Tokenize(",");
3902  Bool_t isContained = kFALSE;
3903  for (Int_t i = 0; i < arr->GetEntriesFast();i++){
3904  TString tempStr = ((TObjString*)arr->At(i))->GetString();
3905  if (tempStr.Atoi() == tobechecked) isContained= kTRUE;
3906  }
3907  if (!isContained)input.Append(Form("%i,",tobechecked));
3908  return isContained;
3909 }
3910 
3911 //_________________________________________________________________________________
3913 
3914  if (!fMCEvent) return;
3915 
3916  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3917  Double_t mcProdVtxX = primVtxMC->GetX();
3918  Double_t mcProdVtxY = primVtxMC->GetY();
3919  Double_t mcProdVtxZ = primVtxMC->GetZ();
3920 
3921  for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
3922 
3923  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
3924 
3925  if (gamma0->IsTrueConvertedPhoton()){
3926  Int_t gamma0MotherLabel = -1;
3927  Int_t gamma0MCLabel = gamma0->GetMCParticleLabel(fMCEvent);
3928  if(gamma0MCLabel != -1){
3929  TParticle * gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
3930  gamma0MotherLabel=gammaMC0->GetFirstMother();
3931  if (gamma0MotherLabel>-1){
3932  if(((TParticle*)fMCEvent->Particle(gamma0MotherLabel))->GetPdgCode() == 111){
3934 
3935  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, gamma0MotherLabel, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3936 
3937  if (!isPrimary){
3938  Int_t secMotherLabel = ((TParticle*)fMCEvent->Particle(gamma0MotherLabel))->GetMother(0);
3939  Float_t weightedSec= 1;
3940  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, fMCEvent, fInputEvent) && fMCEvent->Particle(secMotherLabel)->GetPdgCode()==310){
3941  weightedSec= ((AliConvEventCuts*)fEventCutArray->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
3942  }
3943  fHistoTrueSecondaryPi0MissingPtconv[fiCut]->Fill(gamma0->Pt(),weightedSec);
3944  } else {
3945  Float_t weighted= 1;
3946  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma0MotherLabel, fMCEvent, fInputEvent)){
3947  if (((TParticle*)fMCEvent->Particle(gamma0MotherLabel))->Pt()>0.005){
3948  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(gamma0MotherLabel, fMCEvent, fInputEvent);
3949  }
3950  }
3951  fHistoTruePrimaryPi0MissingPtconv[fiCut]->Fill(gamma0->Pt(),weighted);
3952  }
3953  }
3954  } else if(((TParticle*)fMCEvent->Particle(gamma0MotherLabel))->GetPdgCode() == 221){
3956  Float_t weighted= 1;
3957  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma0MotherLabel, fMCEvent, fInputEvent)){
3958  if (((TParticle*)fMCEvent->Particle(gamma0MotherLabel))->Pt()>0.005){
3959  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(gamma0MotherLabel, fMCEvent, fInputEvent);
3960  }
3961  }
3962  fHistoTruePrimaryEtaMissingPtconv[fiCut]->Fill(gamma0->Pt(),weighted);
3963  }
3964  }
3965  }
3966  }
3967  }
3968  }
3969 
3970 }
3971 
3972 //_________________________________________________________________________________
3974 
3975  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3976  Double_t mcProdVtxX = primVtxMC->GetX();
3977  Double_t mcProdVtxY = primVtxMC->GetY();
3978  Double_t mcProdVtxZ = primVtxMC->GetZ();
3979 
3980  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3981 
3982  for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
3983  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
3984 
3985  if (gamma0->IsTrueConvertedPhoton()){
3986  AliAODMCParticle *positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0->GetMCLabelPositive()));
3987  AliAODMCParticle *negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0->GetMCLabelNegative()));
3988 
3989  Int_t gamma0MCLabel = -1;
3990  Int_t gamma0MotherLabel = -1;
3991  if(!positiveMC||!negativeMC)
3992  return;
3993 
3994  if (gamma0->IsTrueConvertedPhoton()){
3995  gamma0MCLabel = positiveMC->GetMother();
3996  AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3997  gamma0MotherLabel=gammaMC0->GetMother();
3998 
3999  if (gamma0MotherLabel>-1){
4000  if(((AliAODMCParticle*)AODMCTrackArray->At(gamma0MotherLabel))->GetPdgCode() == 111){
4002  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel)), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
4003  if (isPrimary){
4004  Int_t secMotherLabel = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel))->GetMother();
4005  Float_t weightedSec= 1;
4006  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(secMotherLabel, 0x0, fInputEvent) && static_cast<AliAODMCParticle*>(AODMCTrackArray->At(secMotherLabel))->GetPdgCode()==310){
4007  weightedSec= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(secMotherLabel, 0x0, 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
4008  }
4009  fHistoTrueSecondaryPi0MissingPtconv[fiCut]->Fill(gamma0->Pt(),weightedSec);
4010  } else {
4011  Float_t weighted= 1;
4012  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma0MotherLabel, 0x0, fInputEvent)){
4013  if (static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel))->Pt()>0.005){
4014  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(gamma0MotherLabel, 0x0, fInputEvent);
4015  }
4016  }
4017  fHistoTruePrimaryPi0MissingPtconv[fiCut]->Fill(gamma0->Pt(),weighted);
4018  }
4019  }
4020  } else if(((AliAODMCParticle*)AODMCTrackArray->At(gamma0MotherLabel))->GetPdgCode() == 221){
4022  Float_t weighted= 1;
4023  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(gamma0MotherLabel, 0x0, fInputEvent)){
4024  if (static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel))->Pt()>0.005){
4025  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(gamma0MotherLabel, 0x0, fInputEvent);
4026  }
4027  }
4028  fHistoTruePrimaryEtaMissingPtconv[fiCut]->Fill(gamma0->Pt(),weighted);
4029  }
4030  }
4031  }
4032  }
4033  }
4034  }
4035 
4036  return;
4037 }
4038 
4039 //________________________________________________________________________
4041 
4042  const AliVVertex* primVtxMC = 0;
4043  Double_t mcProdVtxX = 0;
4044  Double_t mcProdVtxY = 0;
4045  Double_t mcProdVtxZ = 0;
4046 
4047 
4048 
4049 
4050  if ( fMCEvent ) {
4051 
4052  primVtxMC = fMCEvent->GetPrimaryVertex();
4053  mcProdVtxX = primVtxMC->GetX();
4054  mcProdVtxY = primVtxMC->GetY();
4055  mcProdVtxZ = primVtxMC->GetZ();
4056 
4057  }
4058 
4059 
4060 
4061  Double_t magField = fInputEvent->GetMagneticField();
4062 
4063 
4064  if( magField < 0.0 ){
4065 
4066  magField = 1.0;
4067 
4068  } else {
4069 
4070  magField = -1.0;
4071  }
4072 
4073 
4074  vector<Int_t> lGoodElectronIndexPrev(0);
4075  vector<Int_t> lGoodPositronIndexPrev(0);
4076 
4077 
4078 
4079  for(UInt_t i = 0; i < fSelectorElectronIndex.size(); i++){
4080 
4081  AliESDtrack* electronCandidate = (AliESDtrack*)fInputEvent->GetTrack(fSelectorElectronIndex[i]);
4082 
4083  if( fMCEvent ) {
4084 
4085  Int_t labelelectron = TMath::Abs( electronCandidate->GetLabel() );
4086  Int_t isMCFromMBHeader = -1;
4087 
4088  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0) {
4089  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(labelelectron,fMCEvent,fInputEvent);
4090  if( isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut) )->GetSignalRejection() != 3) continue;
4091  }
4092 
4093  }
4094 
4095 
4096  if(! ((AliDalitzElectronCuts*)fElectronCutArray->At(fiCut))->ElectronIsSelected(electronCandidate) ) continue;
4097 
4098  lGoodElectronIndexPrev.push_back( fSelectorElectronIndex[i] );
4099  fHistoDalitzElectronPt[fiCut]->Fill(electronCandidate->Pt());
4100  fHistoDalitzElectronPhi[fiCut]->Fill(electronCandidate->Phi());
4101 
4102 
4103  if( fMCEvent ) {
4104 
4105  Int_t labelelectron = TMath::Abs( electronCandidate->GetLabel() );
4106 
4107  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, labelelectron, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
4108 
4109 
4110  if( labelelectron >=0 && labelelectron < fMCEvent->GetNumberOfTracks() ){
4111  TParticle* electron = fMCEvent->Particle(labelelectron);
4112  if( electron->GetPdgCode() == 11 ){
4113  if( isPrimary ){
4114  fHistoTrueElectronPt[fiCut]->Fill(electronCandidate->Pt()); //primary electron
4115  } else {
4116  fHistoTrueSecElectronPt[fiCut]->Fill(electronCandidate->Pt()); //secondary electron
4117  }
4118  if( IsPi0DalitzDaughter(labelelectron) == kTRUE ) {
4119  if( isPrimary ) {
4120  fHistoTruePi0DalitzElectronPt[fiCut]->Fill(electronCandidate->Pt());
4121  } else {
4122  fHistoTruePi0DalitzSecElectronPt[fiCut]->Fill(electronCandidate->Pt());
4123  }
4124  }
4125  }
4126  }
4127  }
4128 
4129  }
4130 
4131 
4132 
4133  for(UInt_t i = 0; i < fSelectorPositronIndex.size(); i++){
4134 
4135 
4136  AliESDtrack* positronCandidate = (AliESDtrack*)fInputEvent->GetTrack( fSelectorPositronIndex[i] );
4137 
4138  if( fMCEvent ) {
4139 
4140  Int_t labelpositron = TMath::Abs( positronCandidate->GetLabel() );
4141  Int_t isMCFromMBHeader = -1;
4142 
4143  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0) {
4144  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(labelpositron,fMCEvent,fInputEvent);
4145  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
4146  }
4147  }
4148 
4149 
4150  if(! ((AliDalitzElectronCuts*)fElectronCutArray->At(fiCut))->ElectronIsSelected(positronCandidate) ) continue;
4151 
4152  lGoodPositronIndexPrev.push_back( fSelectorPositronIndex[i] );
4153  fHistoDalitzPositronPt[fiCut]->Fill( positronCandidate->Pt() );
4154  fHistoDalitzPositronPhi[fiCut]->Fill( positronCandidate->Phi() );
4155 
4156  if( fMCEvent ) {
4157  Int_t labelpositron = TMath::Abs( positronCandidate->GetLabel() );
4158  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, labelpositron, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
4159 
4160 
4161  if( labelpositron >=0 && labelpositron < fMCEvent->GetNumberOfTracks() ) {
4162  TParticle* positron = fMCEvent->Particle(labelpositron);
4163  if( positron->GetPdgCode() == -11 ){
4164  if( isPrimary ){
4165  fHistoTruePositronPt[fiCut]->Fill(positronCandidate->Pt());
4166  } else {
4167  fHistoTrueSecPositronPt[fiCut]->Fill(positronCandidate->Pt());
4168  }
4169  if( IsPi0DalitzDaughter(labelpositron) == kTRUE ) {
4170  if( isPrimary ){
4171  fHistoTruePi0DalitzPositronPt[fiCut]->Fill(positronCandidate->Pt());
4172  } else {
4173  fHistoTruePi0DalitzSecPositronPt[fiCut]->Fill(positronCandidate->Pt());
4174  }
4175  }
4176  }
4177  }
4178  }
4179  }
4180 
4181  vector<Bool_t> lElectronPsiIndex(lGoodElectronIndexPrev.size(), kTRUE);
4182  vector<Bool_t> lPositronPsiIndex(lGoodPositronIndexPrev.size(), kTRUE);
4183 
4184  if( ((AliDalitzElectronCuts*)fElectronCutArray->At(fiCut))->DoPsiPairCut() == kTRUE ){
4185  for( UInt_t i = 0; i < lGoodElectronIndexPrev.size(); i++ ) {
4186  AliESDtrack *electronCandidate = (AliESDtrack*) fInputEvent->GetTrack(lGoodElectronIndexPrev[i]);
4187  for(UInt_t j = 0; j < lGoodPositronIndexPrev.size(); j++){
4188 
4189  AliESDtrack *positronCandidate = (AliESDtrack*) fInputEvent->GetTrack(lGoodPositronIndexPrev[j]);
4190  Double_t psiPair = GetPsiPair(positronCandidate,electronCandidate);
4191  Double_t deltaPhi = magField * TVector2::Phi_mpi_pi( electronCandidate->GetConstrainedParam()->Phi()-positronCandidate->GetConstrainedParam()->Phi());
4192 
4193  if( ((AliDalitzElectronCuts*)fElectronCutArray->At(fiCut))->IsFromGammaConversion(psiPair,deltaPhi ) ){
4194  lElectronPsiIndex[i] = kFALSE;
4195  lPositronPsiIndex[j] = kFALSE;
4196  }
4197  }
4198  }
4199  }
4200 
4201  vector<Int_t> lGoodElectronIndex(0);
4202  vector<Int_t> lGoodPositronIndex(0);
4203 
4204  for( UInt_t i = 0; i < lGoodElectronIndexPrev.size(); i++ ) {
4205  if( lElectronPsiIndex[i] == kTRUE )
4206  lGoodElectronIndex.push_back( lGoodElectronIndexPrev[i] );
4207  }
4208 
4209  for( UInt_t i = 0; i < lGoodPositronIndexPrev.size(); i++ ) {
4210  if( lPositronPsiIndex[i] == kTRUE )
4211  lGoodPositronIndex.push_back( lGoodPositronIndexPrev[i] );
4212  }
4213 
4214 
4215  for(UInt_t i = 0; i < lGoodElectronIndex.size(); i++){
4216 
4217  AliESDtrack *electronCandidate = (AliESDtrack*)fInputEvent->GetTrack(lGoodElectronIndex[i]);
4218  AliKFParticle electronCandidateKF( *electronCandidate->GetConstrainedParam(), ::kElectron );
4219 
4220  TLorentzVector electronCandidateTLV;
4221 
4222  electronCandidateTLV.SetXYZM(electronCandidate->GetConstrainedParam()->Px(),electronCandidate->GetConstrainedParam()->Py(),electronCandidate->GetConstrainedParam()->Pz(),TDatabasePDG::Instance()->GetParticle( ::kElectron )->Mass());
4223 
4224 
4225  for(UInt_t j = 0; j < lGoodPositronIndex.size(); j++){
4226 
4227  AliESDtrack *positronCandidate = (AliESDtrack*) fInputEvent->GetTrack(lGoodPositronIndex[j]);
4228  AliKFParticle positronCandidateKF( *positronCandidate->GetConstrainedParam(), ::kPositron );
4229  TLorentzVector positronCandidateTLV;
4230 
4231  positronCandidateTLV.SetXYZM(positronCandidate->GetConstrainedParam()->Px(),positronCandidate->GetConstrainedParam()->Py(),positronCandidate->GetConstrainedParam()->Pz(),TDatabasePDG::Instance()->GetParticle( ::kPositron )->Mass());
4232 
4233  TLorentzVector *virtualPhotonTLV = 0;
4234  AliKFConversionPhoton* virtualPhoton = NULL;
4235  AliAODConversionPhoton *vphoton;
4236 
4237  if( ((AliDalitzElectronCuts*)fElectronCutArray->At(fiCut))->GetUseElectronMCSmearing() && ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseMCPSmearing() && fMCEvent){
4238  TLorentzVector smearelectronCandidateTLV = ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->SmearElectron(electronCandidateTLV);
4239  TLorentzVector smearpositronCandidateTLV = ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->SmearElectron(positronCandidateTLV);
4240  virtualPhotonTLV = new TLorentzVector( smearelectronCandidateTLV + smearpositronCandidateTLV );
4241  vphoton= new AliAODConversionPhoton(virtualPhotonTLV);
4242  vphoton->SetMass(virtualPhotonTLV->M());
4243  } else {
4244  virtualPhoton = new AliKFConversionPhoton(electronCandidateKF,positronCandidateKF);
4245 
4246  AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
4247  primaryVertexImproved+=*virtualPhoton;
4248  virtualPhoton->SetProductionVertex(primaryVertexImproved);
4249 
4250  vphoton= new AliAODConversionPhoton(virtualPhoton);
4251  }
4252  vphoton->SetTrackLabels( lGoodPositronIndex[j], lGoodElectronIndex[i]);
4253 
4254  if( fMCEvent ) {
4255  Int_t labeln=TMath::Abs(electronCandidate->GetLabel());
4256  Int_t labelp=TMath::Abs(positronCandidate->GetLabel());
4257  TParticle *fNegativeMCParticle = fMCEvent->Particle(labeln);
4258  TParticle *fPositiveMCParticle = fMCEvent->Particle(labelp);
4259 
4260  if( fPositiveMCParticle && fNegativeMCParticle) {
4261  vphoton->SetMCLabelPositive(labelp);
4262  vphoton->SetMCLabelNegative(labeln);
4263 
4264  }
4265  }
4266 
4267 
4268  fVirtualGammaCandidates->Add( vphoton );
4269 
4270  if( virtualPhoton ){
4271  delete virtualPhoton;
4272  virtualPhoton=NULL;
4273  }
4274  if ( virtualPhotonTLV ){
4275  delete virtualPhotonTLV;
4276  virtualPhotonTLV=NULL;
4277  }
4278 
4279  }
4280  }
4281 
4282 }
4283 
4284 //_____________________________________________________________________________________
4286 {
4287 //
4288 // Returns true if the particle comes from Pi0 -> e+ e- gamma
4289 //
4290  Int_t motherLabel = fMCEvent->Particle( label )->GetMother(0);
4291 
4292  if( motherLabel < 0 || motherLabel >= fMCEvent->GetNumberOfTracks() ) return kFALSE;
4293 
4294  TParticle* mother = fMCEvent->Particle( motherLabel );
4295 
4296  if( mother->GetPdgCode() != 111 ) return kFALSE;
4297 
4298  if( IsDalitz( mother ) ) return kTRUE;
4299 
4300  return kFALSE;
4301 
4302 }
4303 //_____________________________________________________________________________
4304 Double_t AliAnalysisTaskGammaCaloDalitzV1::GetPsiPair( const AliESDtrack *trackPos, const AliESDtrack *trackNeg ) const
4305 {
4306  //
4307  // This angle is a measure for the contribution of the opening in polar
4308  // direction ?0 to the opening angle ? Pair
4309  //
4310  // Ref. Measurement of photons via conversion pairs with the PHENIX experiment at RHIC
4311  // Master Thesis. Thorsten Dahms. 2005
4312  // https://twiki.cern.ch/twiki/pub/ALICE/GammaPhysicsPublications/tdahms_thesis.pdf
4313  //
4314  Double_t momPos[3];
4315  Double_t momNeg[3];
4316  if( trackPos->GetConstrainedPxPyPz(momPos) == 0 ) trackPos->GetPxPyPz( momPos );
4317  if( trackNeg->GetConstrainedPxPyPz(momNeg) == 0 ) trackNeg->GetPxPyPz( momNeg );
4318 
4319  TVector3 posDaughter;
4320  TVector3 negDaughter;
4321 
4322  posDaughter.SetXYZ( momPos[0], momPos[1], momPos[2] );
4323  negDaughter.SetXYZ( momNeg[0], momNeg[1], momNeg[2] );
4324 
4325  Double_t deltaTheta = negDaughter.Theta() - posDaughter.Theta();
4326  Double_t openingAngle = posDaughter.Angle( negDaughter ); //TMath::ACos( posDaughter.Dot(negDaughter)/(negDaughter.Mag()*posDaughter.Mag()) );
4327 
4328  if( openingAngle < 1e-20 ) return 0.;
4329 
4330  Double_t psiAngle = TMath::ASin( deltaTheta/openingAngle );
4331 
4332  return psiAngle;
4333 }
4334 //_____________________________________________________________________________
4336 {
4337 
4338  if( fMCMother->GetNDaughters() != 3 ) return kFALSE;
4339  if( fMCMother->GetPdgCode() != 111 && fMCMother->GetPdgCode() != 221 ) return kFALSE;
4340 
4341 
4342  TParticle *positron = 0x0;
4343  TParticle *electron = 0x0;
4344  TParticle *gamma = 0x0;
4345 
4346  for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
4347  TParticle* temp = (TParticle*)fMCEvent->Particle( index );
4348  switch( temp->GetPdgCode() ) {
4349  case ::kPositron:
4350  positron = temp;
4351  break;
4352  case ::kElectron:
4353  electron = temp;
4354  break;
4355  case ::kGamma:
4356  gamma = temp;
4357  break;
4358  }
4359  }
4360 
4361  if( positron && electron && gamma) return kTRUE;
4362 
4363  return kFALSE;
4364 }
4365 
4366 //_________________________________________________________________
4368 
4369 
4370 
4371  if( particleLabel < 0 ) return -1;
4372 
4373  TParticle* particle = (TParticle*)fMCEvent->Particle( particleLabel );
4374 
4375  if( particle->GetMother(0) < 0 ) return -1;
4376 
4377  else if ( ((TParticle*)fMCEvent->Particle( particle->GetMother(0) ) )->GetPdgCode() == 111 ||
4378  ((TParticle*)fMCEvent->Particle( particle->GetMother(0) ) )->GetPdgCode() == 221 ) {
4379 
4380  return particle->GetMother(0);
4381  }
4382 
4383  else return FindMotherOfPhoton( particle->GetMother(0) );
4384 
4385 
4386 }
4387 
4388 //_________________________________________________________________________________
4390 {
4391  if(tobechecked > -1)
4392  {
4393  vector<Int_t>::iterator it;
4394  it = find (vec.begin(), vec.end(), tobechecked);
4395  if (it !