AliPhysics  b752f14 (b752f14)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskGammaConvCalo.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2020, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: Daniel Muehlheim, 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 "AliAnalysisTask.h"
33 #include "AliAnalysisManager.h"
34 #include "AliESDEvent.h"
35 #include "AliESDInputHandler.h"
36 #include "AliMCEventHandler.h"
37 #include "AliMCEvent.h"
38 #include "AliMCParticle.h"
39 #include "AliCentrality.h"
40 #include "AliESDVZERO.h"
41 #include "AliESDpid.h"
43 #include "AliVParticle.h"
44 #include "AliESDtrack.h"
45 #include "AliESDtrackCuts.h"
46 #include "AliKFVertex.h"
47 #include "AliGenCocktailEventHeader.h"
49 #include "AliAODMCParticle.h"
50 #include "AliAODMCHeader.h"
51 #include "AliEventplane.h"
53 #include "AliAODEvent.h"
54 #include "AliAODInputHandler.h"
55 #include "AliESDEvent.h"
56 #include "AliESDInputHandler.h"
57 #include "AliInputEventHandler.h"
58 #include "AliCaloTrackMatcher.h"
59 #include <vector>
60 #include <map>
61 
63 
64 //________________________________________________________________________
66  fV0Reader(NULL),
67  fV0ReaderName("V0ReaderV1"),
68  fBGHandler(NULL),
69  fBGHandlerRP(NULL),
70  fBGClusHandler(NULL),
71  fBGClusHandlerRP(NULL),
72  fInputEvent(NULL),
73  fMCEvent(NULL),
74  fMCStack(NULL),
75  fCutFolder(NULL),
76  fESDList(NULL),
77  fBackList(NULL),
78  fMotherList(NULL),
79  fPhotonDCAList(NULL),
80  fGammaERM02(NULL),
81  fInvMassShowerShape(NULL),
82  fTrueList(NULL),
83  fMCList(NULL),
84  fClusterOutputList(NULL),
85  fOutputContainer(NULL),
86  fReaderGammas(NULL),
87  fGammaCandidates(NULL),
88  fClusterCandidates(NULL),
89  fEventCutArray(NULL),
90  fEventCuts(NULL),
91  fCutArray(NULL),
92  fConversionCuts(NULL),
93  fClusterCutArray(NULL),
94  fCaloPhotonCuts(NULL),
95  fMesonCutArray(NULL),
96  fMesonCuts(NULL),
97  fHistoConvGammaPt(NULL),
98  fHistoConvGammaR(NULL),
99  fHistoConvGammaEta(NULL),
100  fTreeConvGammaPtDcazCat(NULL),
101  fPtGamma(0),
102  fDCAzPhoton(0),
103  fRConvPhoton(0),
104  fEtaPhoton(0),
105  fCharCatPhoton(0),
106  fCharPhotonMCInfo(0),
107  tESDGammaERM02(NULL),
108  tESDClusE(0),
109  tESDGammaConvR(0),
110  tESDClusterM02(0),
111  tESDClusterM20(0),
112  tESDClusterEta(0),
113  tESDClusterPhi(0),
114  tESDClusterNCells(0),
115  tESDClusterMaxECell(0),
116  tESDClusterNLM(0),
117  tESDInvMassShowerShape(0),
118  tESDIMMesonInvMass(0),
119  tESDIMMesonPt(0),
120  tESDIMClusE(0),
121  tESDIMClusterM02(0),
122  tESDIMClusterM20(0),
123  tESDIMClusterLeadCellID(0),
124  tESDIMClusterClassification(0),
125  tESDIMClusMatchedTrackPt(0),
126  tESDIMClusTrackDeltaEta(0),
127  tESDIMClusTrackDeltaPhi(0),
128  tESDIMClusterIsoSumClusterEt(0),
129  tESDIMClusterIsoSumTrackEt(0),
130  tESDmapIsClusterAcceptedWithoutTrackMatch(),
131  fHistoMotherInvMassPt(NULL),
132  fHistoMotherMatchedInvMassPt(NULL),
133  fSparseMotherInvMassPtZM(NULL),
134  fHistoMotherBackInvMassPt(NULL),
135  fSparseMotherBackInvMassPtZM(NULL),
136  fHistoMotherInvMassPtAlpha(NULL),
137  fHistoMotherPi0PtY(NULL),
138  fHistoMotherEtaPtY(NULL),
139  fHistoMotherPi0PtAlpha(NULL),
140  fHistoMotherEtaPtAlpha(NULL),
141  fHistoMotherPi0PtOpenAngle(NULL),
142  fHistoMotherEtaPtOpenAngle(NULL),
143  fHistoMotherPi0ConvPhotonEtaPhi(NULL),
144  fHistoMotherEtaConvPhotonEtaPhi(NULL),
145  fHistoMotherInvMassECalib(NULL),
146  fHistoMotherBackInvMassECalib(NULL),
147  fHistoPhotonPairPtconv(NULL),
148  fHistoPhotonPairMixedEventPtconv(NULL),
149  fHistoClusGammaPt(NULL),
150  fHistoClusGammaE(NULL),
151  fHistoClusOverlapHeadersGammaPt(NULL),
152  fHistoMCHeaders(NULL),
153  fHistoMCAllGammaPt(NULL),
154  fHistoMCAllGammaEMCALAccPt(NULL),
155  fHistoMCAllSecondaryGammaPt(NULL),
156  fHistoMCDecayGammaPi0Pt(NULL),
157  fHistoMCDecayGammaRhoPt(NULL),
158  fHistoMCDecayGammaEtaPt(NULL),
159  fHistoMCDecayGammaOmegaPt(NULL),
160  fHistoMCDecayGammaEtapPt(NULL),
161  fHistoMCDecayGammaPhiPt(NULL),
162  fHistoMCDecayGammaSigmaPt(NULL),
163  fHistoMCConvGammaPt(NULL),
164  fHistoMCSecondaryConvGammaPt(NULL),
165  fHistoMCConvGammaR(NULL),
166  fHistoMCConvGammaEta(NULL),
167  fHistoMCPi0Pt(NULL),
168  fHistoMCPi0WOWeightPt(NULL),
169  fHistoMCPi0WOEvtWeightPt(NULL),
170  fHistoMCEtaPt(NULL),
171  fHistoMCEtaWOWeightPt(NULL),
172  fHistoMCEtaWOEvtWeightPt(NULL),
173  fHistoMCPi0InAccPt(NULL),
174  fHistoMCPi0WOWeightInAccPt(NULL),
175  fHistoMCPi0WOEvtWeightInAccPt(NULL),
176  fHistoMCEtaInAccPt(NULL),
177  fHistoMCEtaWOWeightInAccPt(NULL),
178  fHistoMCEtaWOEvtWeightInAccPt(NULL),
179  fHistoMCPi0PtY(NULL),
180  fHistoMCEtaPtY(NULL),
181  fHistoMCPi0PtAlpha(NULL),
182  fHistoMCEtaPtAlpha(NULL),
183  fHistoMCPrimaryPtvsSource(NULL),
184  fHistoMCSecPi0PtvsSource(NULL),
185  fHistoMCSecPi0Source(NULL),
186  fHistoMCSecPi0InAccPtvsSource(NULL),
187  fHistoMCSecEtaPt(NULL),
188  fHistoMCSecEtaSource(NULL),
189  fHistoMCPi0PtJetPt(NULL),
190  fHistoMCEtaPtJetPt(NULL),
191  fHistoMCPi0PtGammaLeg(NULL),
192  fHistoMCPi0WOWeightPtGammaLeg(NULL),
193  fHistoMCPi0InAccPtGammaLeg(NULL),
194  fHistoMCPi0WOWeightInAccPtGammaLeg(NULL),
195  fHistoMCSecPi0PtGamma1vsSource(NULL),
196  fHistoMCSecPi0InAccPtGamma1vsSource(NULL),
197  fHistoMCSecPi0PtGamma2vsSource(NULL),
198  fHistoMCSecPi0InAccPtGamma2vsSource(NULL),
199  fHistoTruePi0InvMassPt(NULL),
200  fHistoTrueEtaInvMassPt(NULL),
201  fHistoTruePi0MatchedInvMassPt(NULL),
202  fHistoTrueEtaMatchedInvMassPt(NULL),
203  fHistoTruePi0CaloPhotonInvMassPt(NULL),
204  fHistoTrueEtaCaloPhotonInvMassPt(NULL),
205  fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
206  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt(NULL),
207  fHistoTruePi0CaloConvPhotonConvRPt(NULL),
208  fHistoTruePi0CaloConvPhotonConvRAlpha(NULL),
209  fHistoTruePi0CaloConvPhotonPtAlpha(NULL),
210  fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
211  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt(NULL),
212  fHistoTrueEtaCaloConvPhotonConvRPt(NULL),
213  fHistoTrueEtaCaloConvPhotonConvRAlpha(NULL),
214  fHistoTrueEtaCaloConvPhotonPtAlpha(NULL),
215  fHistoTruePi0CaloElectronInvMassPt(NULL),
216  fHistoTrueEtaCaloElectronInvMassPt(NULL),
217  fHistoTruePi0CaloMergedClusterInvMassPt(NULL),
218  fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
219  fHistoTrueMotherCaloEMNonLeadingInvMassPt(NULL),
220  fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
221  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
222  fHistoTruePrimaryPi0InvMassPt(NULL),
223  fHistoTruePrimaryEtaInvMassPt(NULL),
224  fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
225  fHistoTruePrimaryEtaW0WeightingInvMassPt(NULL),
226  fProfileTruePrimaryPi0WeightsInvMassPt(NULL),
227  fProfileTruePrimaryEtaWeightsInvMassPt(NULL),
228  fHistoTruePrimaryPi0MCPtResolPt(NULL),
229  fHistoTruePrimaryEtaMCPtResolPt(NULL),
230  fHistoTrueMotherPi0ConvPhotonEtaPhi(NULL),
231  fHistoTrueMotherEtaConvPhotonEtaPhi(NULL),
232  fHistoTrueSecondaryPi0InvMassPt(NULL),
233  fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
234  fHistoTrueK0sWithPi0DaughterMCPt(NULL),
235  fHistoTrueSecondaryPi0FromK0lInvMassPt(NULL),
236  fHistoTrueK0lWithPi0DaughterMCPt(NULL),
237  fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
238  fHistoTrueEtaWithPi0DaughterMCPt(NULL),
239  fHistoTrueSecondaryPi0FromLambdaInvMassPt(NULL),
240  fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
241  fHistoTrueBckGGInvMassPt(NULL),
242  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt(NULL),
243  fHistoTrueBckAsymEClustersInvMassPt(NULL),
244  fHistoTrueBckContInvMassPt(NULL),
245  fHistoTruePi0PtY(NULL),
246  fHistoTrueEtaPtY(NULL),
247  fHistoTruePi0PtAlpha(NULL),
248  fHistoTrueEtaPtAlpha(NULL),
249  fHistoTruePi0PtOpenAngle(NULL),
250  fHistoTrueEtaPtOpenAngle(NULL),
251  fHistoTrueConvGammaPt(NULL),
252  fHistoTrueConvGammaEta(NULL),
253  fHistoCombinatorialPt(NULL),
254  fHistoTruePrimaryConvGammaPt(NULL),
255  fHistoTruePrimaryConvGammaESDPtMCPt(NULL),
256  fHistoTrueSecondaryConvGammaPt(NULL),
257  fHistoTrueSecondaryConvGammaMCPt(NULL),
258  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt(NULL),
259  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt(NULL),
260  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt(NULL),
261  fHistoTrueClusGammaPt(NULL),
262  fHistoTrueClusElectronPt(NULL),
263  fHistoTrueClusConvGammaPt(NULL),
264  fHistoTrueClusConvGammaFullyPt(NULL),
265  fHistoTrueClusMergedGammaPt(NULL),
266  fHistoTrueClusMergedPartConvGammaPt(NULL),
267  fHistoTrueClusDalitzPt(NULL),
268  fHistoTrueClusDalitzMergedPt(NULL),
269  fHistoTrueClusPhotonFromElecMotherPt(NULL),
270  fHistoTrueClusShowerPt(NULL),
271  fHistoTrueClusSubLeadingPt(NULL),
272  fHistoTrueClusNMothers(NULL),
273  fHistoTrueClusEMNonLeadingPt(NULL),
274  fHistoTrueNLabelsInClusPt(NULL),
275  fHistoTruePrimaryClusGammaPt(NULL),
276  fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
277  fHistoTruePrimaryClusConvGammaPt(NULL),
278  fHistoTruePrimaryClusConvGammaESDPtMCPt(NULL),
279  fHistoTrueSecondaryClusGammaPt(NULL),
280  fHistoTrueSecondaryClusGammaFromK0sPt(NULL),
281  fHistoTrueSecondaryClusGammaFromK0lPt(NULL),
282  fHistoTrueSecondaryClusGammaFromLambdaPt(NULL),
283  fHistoTruePrimaryPi0PhotonPairPtconv(NULL),
284  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv(NULL),
285  fHistoTruePrimaryPi0DCPtconv(NULL),
286  fHistoTruePrimaryPi0MissingPtconv(NULL),
287  fHistoTrueSecondaryPi0PhotonPairPtconv(NULL),
288  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv(NULL),
289  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv(NULL),
290  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv(NULL),
291  fHistoTrueSecondaryPi0DCPtconvSource(NULL),
292  fHistoTrueSecondaryPi0MissingPtconvSource(NULL),
293  fVectorRecTruePi0s(0),
294  fVectorRecTrueEtas(0),
295  fHistoDoubleCountTruePi0InvMassPt(NULL),
296  fHistoDoubleCountTrueEtaInvMassPt(NULL),
297  fHistoDoubleCountTrueConvGammaRPt(NULL),
298  fHistoDoubleCountTrueClusterGammaPt(NULL),
299  fVectorDoubleCountTruePi0s(0),
300  fVectorDoubleCountTrueEtas(0),
301  fVectorDoubleCountTrueConvGammas(0),
302  fVectorDoubleCountTrueClusterGammas(0),
303  fHistoMultipleCountTruePi0(NULL),
304  fHistoMultipleCountTrueEta(NULL),
305  fHistoMultipleCountTrueConvGamma(NULL),
306  fHistoMultipleCountTrueClusterGamma(NULL),
307  fMapMultipleCountTruePi0s(),
308  fMapMultipleCountTrueEtas(),
309  fMapMultipleCountTrueConvGammas(),
310  fMapMultipleCountTrueClusterGammas(),
311  fHistoTrueClusGammaEM02(NULL),
312  fHistoTrueClusPi0EM02(NULL),
313  fHistoTruePi0InvMassECalib(NULL),
314  fHistoTruePi0PureGammaInvMassECalib(NULL),
315  fHistoNEvents(NULL),
316  fHistoNEventsWOWeight(NULL),
317  fHistoNGoodESDTracks(NULL),
318  fHistoVertexZ(NULL),
319  fHistoVertexX(NULL),
320  fHistoVertexY(NULL),
321  fHistoNGammaCandidates(NULL),
322  fHistoNGoodESDTracksVsNGammaCandidates(NULL),
323  fHistoSPDClusterTrackletBackground(NULL),
324  fHistoNV0Tracks(NULL),
325  fProfileEtaShift(NULL),
326  fProfileJetJetXSection(NULL),
327  fHistoJetJetNTrials(NULL),
328 // fHistoTruePi0NonLinearity(NULL),
329 // fHistoTrueEtaNonLinearity(NULL),
330  fEventPlaneAngle(-100),
331  fRandom(0),
332  fNGammaCandidates(0),
333  fUnsmearedPx(NULL),
334  fUnsmearedPy(NULL),
335  fUnsmearedPz(NULL),
336  fUnsmearedE(NULL),
337  fMCStackPos(NULL),
338  fMCStackNeg(NULL),
339  fESDArrayPos(NULL),
340  fESDArrayNeg(NULL),
341  fnCuts(0),
342  fiCut(0),
343  fMoveParticleAccordingToVertex(kTRUE),
344  fIsHeavyIon(0),
345  fDoLightOutput(kFALSE),
346  fDoMesonAnalysis(kTRUE),
347  fDoMesonQA(0),
348  fDoPhotonQA(0),
349  fDoClusterQA(0),
350  fIsFromMBHeader(kTRUE),
351  fIsOverlappingWithOtherHeader(kFALSE),
352  fIsMC(0),
353  fDoTHnSparse(kTRUE),
354  fSetPlotHistsExtQA(kFALSE),
355  fWeightJetJetMC(1),
356  fDoConvGammaShowerShapeTree(kFALSE),
357  fEnableSortForClusMC(kFALSE),
358  fDoPrimaryTrackMatching(kFALSE),
359  fDoInvMassShowerShapeTree(kFALSE),
360  tBrokenFiles(NULL),
361  fFileNameBroken(NULL)
362 {
363 
364 }
365 
366 //________________________________________________________________________
368  AliAnalysisTaskSE(name),
369  fV0Reader(NULL),
370  fV0ReaderName("V0ReaderV1"),
371  fBGHandler(NULL),
372  fBGHandlerRP(NULL),
373  fBGClusHandler(NULL),
374  fBGClusHandlerRP(NULL),
375  fInputEvent(NULL),
376  fMCEvent(NULL),
377  fMCStack(NULL),
378  fCutFolder(NULL),
379  fESDList(NULL),
380  fBackList(NULL),
381  fMotherList(NULL),
382  fPhotonDCAList(NULL),
383  fGammaERM02(NULL),
384  fInvMassShowerShape(NULL),
385  fTrueList(NULL),
386  fMCList(NULL),
387  fClusterOutputList(NULL),
388  fOutputContainer(0),
389  fReaderGammas(NULL),
390  fGammaCandidates(NULL),
391  fClusterCandidates(NULL),
392  fEventCutArray(NULL),
393  fEventCuts(NULL),
394  fCutArray(NULL),
395  fConversionCuts(NULL),
396  fClusterCutArray(NULL),
397  fCaloPhotonCuts(NULL),
398  fMesonCutArray(NULL),
399  fMesonCuts(NULL),
400  fHistoConvGammaPt(NULL),
401  fHistoConvGammaR(NULL),
402  fHistoConvGammaEta(NULL),
403  fTreeConvGammaPtDcazCat(NULL),
404  fPtGamma(0),
405  fDCAzPhoton(0),
406  fRConvPhoton(0),
407  fEtaPhoton(0),
408  fCharCatPhoton(0),
409  fCharPhotonMCInfo(0),
410  tESDGammaERM02(NULL),
411  tESDClusE(0),
412  tESDGammaConvR(0),
413  tESDClusterM02(0),
414  tESDClusterM20(0),
415  tESDClusterEta(0),
416  tESDClusterPhi(0),
417  tESDClusterNCells(0),
418  tESDClusterMaxECell(0),
419  tESDClusterNLM(0),
420  tESDInvMassShowerShape(0),
421  tESDIMMesonInvMass(0),
422  tESDIMMesonPt(0),
423  tESDIMClusE(0),
424  tESDIMClusterM02(0),
425  tESDIMClusterM20(0),
426  tESDIMClusterLeadCellID(0),
427  tESDIMClusterClassification(0),
428  tESDIMClusMatchedTrackPt(0),
429  tESDIMClusTrackDeltaEta(0),
430  tESDIMClusTrackDeltaPhi(0),
431  tESDIMClusterIsoSumClusterEt(0),
432  tESDIMClusterIsoSumTrackEt(0),
433  tESDmapIsClusterAcceptedWithoutTrackMatch(),
434  fHistoMotherInvMassPt(NULL),
435  fHistoMotherMatchedInvMassPt(NULL),
436  fSparseMotherInvMassPtZM(NULL),
437  fHistoMotherBackInvMassPt(NULL),
438  fSparseMotherBackInvMassPtZM(NULL),
439  fHistoMotherInvMassPtAlpha(NULL),
440  fHistoMotherPi0PtY(NULL),
441  fHistoMotherEtaPtY(NULL),
442  fHistoMotherPi0PtAlpha(NULL),
443  fHistoMotherEtaPtAlpha(NULL),
444  fHistoMotherPi0PtOpenAngle(NULL),
445  fHistoMotherEtaPtOpenAngle(NULL),
446  fHistoMotherPi0ConvPhotonEtaPhi(NULL),
447  fHistoMotherEtaConvPhotonEtaPhi(NULL),
448  fHistoMotherInvMassECalib(NULL),
449  fHistoMotherBackInvMassECalib(NULL),
450  fHistoPhotonPairPtconv(NULL),
451  fHistoPhotonPairMixedEventPtconv(NULL),
452  fHistoClusGammaPt(NULL),
453  fHistoClusGammaE(NULL),
454  fHistoClusOverlapHeadersGammaPt(NULL),
455  fHistoMCHeaders(NULL),
456  fHistoMCAllGammaPt(NULL),
457  fHistoMCAllGammaEMCALAccPt(NULL),
458  fHistoMCAllSecondaryGammaPt(NULL),
459  fHistoMCDecayGammaPi0Pt(NULL),
460  fHistoMCDecayGammaRhoPt(NULL),
461  fHistoMCDecayGammaEtaPt(NULL),
462  fHistoMCDecayGammaOmegaPt(NULL),
463  fHistoMCDecayGammaEtapPt(NULL),
464  fHistoMCDecayGammaPhiPt(NULL),
465  fHistoMCDecayGammaSigmaPt(NULL),
466  fHistoMCConvGammaPt(NULL),
467  fHistoMCSecondaryConvGammaPt(NULL),
468  fHistoMCConvGammaR(NULL),
469  fHistoMCConvGammaEta(NULL),
470  fHistoMCPi0Pt(NULL),
471  fHistoMCPi0WOWeightPt(NULL),
472  fHistoMCPi0WOEvtWeightPt(NULL),
473  fHistoMCEtaPt(NULL),
474  fHistoMCEtaWOWeightPt(NULL),
475  fHistoMCEtaWOEvtWeightPt(NULL),
476  fHistoMCPi0InAccPt(NULL),
477  fHistoMCPi0WOWeightInAccPt(NULL),
478  fHistoMCPi0WOEvtWeightInAccPt(NULL),
479  fHistoMCEtaInAccPt(NULL),
480  fHistoMCEtaWOWeightInAccPt(NULL),
481  fHistoMCEtaWOEvtWeightInAccPt(NULL),
482  fHistoMCPi0PtY(NULL),
483  fHistoMCEtaPtY(NULL),
484  fHistoMCPi0PtAlpha(NULL),
485  fHistoMCEtaPtAlpha(NULL),
486  fHistoMCPrimaryPtvsSource(NULL),
487  fHistoMCSecPi0PtvsSource(NULL),
488  fHistoMCSecPi0Source(NULL),
489  fHistoMCSecPi0InAccPtvsSource(NULL),
490  fHistoMCSecEtaPt(NULL),
491  fHistoMCSecEtaSource(NULL),
492  fHistoMCPi0PtJetPt(NULL),
493  fHistoMCEtaPtJetPt(NULL),
494  fHistoMCPi0PtGammaLeg(NULL),
495  fHistoMCPi0WOWeightPtGammaLeg(NULL),
496  fHistoMCPi0InAccPtGammaLeg(NULL),
497  fHistoMCPi0WOWeightInAccPtGammaLeg(NULL),
498  fHistoMCSecPi0PtGamma1vsSource(NULL),
499  fHistoMCSecPi0InAccPtGamma1vsSource(NULL),
500  fHistoMCSecPi0PtGamma2vsSource(NULL),
501  fHistoMCSecPi0InAccPtGamma2vsSource(NULL),
502  fHistoTruePi0InvMassPt(NULL),
503  fHistoTrueEtaInvMassPt(NULL),
504  fHistoTruePi0MatchedInvMassPt(NULL),
505  fHistoTrueEtaMatchedInvMassPt(NULL),
506  fHistoTruePi0CaloPhotonInvMassPt(NULL),
507  fHistoTrueEtaCaloPhotonInvMassPt(NULL),
508  fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
509  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt(NULL),
510  fHistoTruePi0CaloConvPhotonConvRPt(NULL),
511  fHistoTruePi0CaloConvPhotonConvRAlpha(NULL),
512  fHistoTruePi0CaloConvPhotonPtAlpha(NULL),
513  fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
514  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt(NULL),
515  fHistoTrueEtaCaloConvPhotonConvRPt(NULL),
516  fHistoTrueEtaCaloConvPhotonConvRAlpha(NULL),
517  fHistoTrueEtaCaloConvPhotonPtAlpha(NULL),
518  fHistoTruePi0CaloElectronInvMassPt(NULL),
519  fHistoTrueEtaCaloElectronInvMassPt(NULL),
520  fHistoTruePi0CaloMergedClusterInvMassPt(NULL),
521  fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
522  fHistoTrueMotherCaloEMNonLeadingInvMassPt(NULL),
523  fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
524  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
525  fHistoTruePrimaryPi0InvMassPt(NULL),
526  fHistoTruePrimaryEtaInvMassPt(NULL),
527  fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
528  fHistoTruePrimaryEtaW0WeightingInvMassPt(NULL),
529  fProfileTruePrimaryPi0WeightsInvMassPt(NULL),
530  fProfileTruePrimaryEtaWeightsInvMassPt(NULL),
531  fHistoTruePrimaryPi0MCPtResolPt(NULL),
532  fHistoTruePrimaryEtaMCPtResolPt(NULL),
533  fHistoTrueMotherPi0ConvPhotonEtaPhi(NULL),
534  fHistoTrueMotherEtaConvPhotonEtaPhi(NULL),
535  fHistoTrueSecondaryPi0InvMassPt(NULL),
536  fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
537  fHistoTrueK0sWithPi0DaughterMCPt(NULL),
538  fHistoTrueSecondaryPi0FromK0lInvMassPt(NULL),
539  fHistoTrueK0lWithPi0DaughterMCPt(NULL),
540  fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
541  fHistoTrueEtaWithPi0DaughterMCPt(NULL),
542  fHistoTrueSecondaryPi0FromLambdaInvMassPt(NULL),
543  fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
544  fHistoTrueBckGGInvMassPt(NULL),
545  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt(NULL),
546  fHistoTrueBckAsymEClustersInvMassPt(NULL),
547  fHistoTrueBckContInvMassPt(NULL),
548  fHistoTruePi0PtY(NULL),
549  fHistoTrueEtaPtY(NULL),
550  fHistoTruePi0PtAlpha(NULL),
551  fHistoTrueEtaPtAlpha(NULL),
552  fHistoTruePi0PtOpenAngle(NULL),
553  fHistoTrueEtaPtOpenAngle(NULL),
554  fHistoTrueConvGammaPt(NULL),
555  fHistoTrueConvGammaEta(NULL),
556  fHistoCombinatorialPt(NULL),
557  fHistoTruePrimaryConvGammaPt(NULL),
558  fHistoTruePrimaryConvGammaESDPtMCPt(NULL),
559  fHistoTrueSecondaryConvGammaPt(NULL),
560  fHistoTrueSecondaryConvGammaMCPt(NULL),
561  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt(NULL),
562  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt(NULL),
563  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt(NULL),
564  fHistoTrueClusGammaPt(NULL),
565  fHistoTrueClusElectronPt(NULL),
566  fHistoTrueClusConvGammaPt(NULL),
567  fHistoTrueClusConvGammaFullyPt(NULL),
568  fHistoTrueClusMergedGammaPt(NULL),
569  fHistoTrueClusMergedPartConvGammaPt(NULL),
570  fHistoTrueClusDalitzPt(NULL),
571  fHistoTrueClusDalitzMergedPt(NULL),
572  fHistoTrueClusPhotonFromElecMotherPt(NULL),
573  fHistoTrueClusShowerPt(NULL),
574  fHistoTrueClusSubLeadingPt(NULL),
575  fHistoTrueClusNMothers(NULL),
576  fHistoTrueClusEMNonLeadingPt(NULL),
577  fHistoTrueNLabelsInClusPt(NULL),
578  fHistoTruePrimaryClusGammaPt(NULL),
579  fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
580  fHistoTruePrimaryClusConvGammaPt(NULL),
581  fHistoTruePrimaryClusConvGammaESDPtMCPt(NULL),
582  fHistoTrueSecondaryClusGammaPt(NULL),
583  fHistoTrueSecondaryClusGammaFromK0sPt(NULL),
584  fHistoTrueSecondaryClusGammaFromK0lPt(NULL),
585  fHistoTrueSecondaryClusGammaFromLambdaPt(NULL),
586  fHistoTruePrimaryPi0PhotonPairPtconv(NULL),
587  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv(NULL),
588  fHistoTruePrimaryPi0DCPtconv(NULL),
589  fHistoTruePrimaryPi0MissingPtconv(NULL),
590  fHistoTrueSecondaryPi0PhotonPairPtconv(NULL),
591  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv(NULL),
592  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv(NULL),
593  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv(NULL),
594  fHistoTrueSecondaryPi0DCPtconvSource(NULL),
595  fHistoTrueSecondaryPi0MissingPtconvSource(NULL),
596  fVectorRecTruePi0s(0),
597  fVectorRecTrueEtas(0),
598  fHistoDoubleCountTruePi0InvMassPt(NULL),
599  fHistoDoubleCountTrueEtaInvMassPt(NULL),
600  fHistoDoubleCountTrueConvGammaRPt(NULL),
601  fHistoDoubleCountTrueClusterGammaPt(NULL),
602  fVectorDoubleCountTruePi0s(0),
603  fVectorDoubleCountTrueEtas(0),
604  fVectorDoubleCountTrueConvGammas(0),
605  fVectorDoubleCountTrueClusterGammas(0),
606  fHistoMultipleCountTruePi0(NULL),
607  fHistoMultipleCountTrueEta(NULL),
608  fHistoMultipleCountTrueConvGamma(NULL),
609  fHistoMultipleCountTrueClusterGamma(NULL),
610  fMapMultipleCountTruePi0s(),
611  fMapMultipleCountTrueEtas(),
612  fMapMultipleCountTrueConvGammas(),
613  fMapMultipleCountTrueClusterGammas(),
614  fHistoTrueClusGammaEM02(NULL),
615  fHistoTrueClusPi0EM02(NULL),
616  fHistoTruePi0InvMassECalib(NULL),
617  fHistoTruePi0PureGammaInvMassECalib(NULL),
618  fHistoNEvents(NULL),
619  fHistoNEventsWOWeight(NULL),
620  fHistoNGoodESDTracks(NULL),
621  fHistoVertexZ(NULL),
622  fHistoVertexX(NULL),
623  fHistoVertexY(NULL),
624  fHistoNGammaCandidates(NULL),
625  fHistoNGoodESDTracksVsNGammaCandidates(NULL),
626  fHistoSPDClusterTrackletBackground(NULL),
627  fHistoNV0Tracks(NULL),
628  fProfileEtaShift(NULL),
629  fProfileJetJetXSection(NULL),
630  fHistoJetJetNTrials(NULL),
631 // fHistoTruePi0NonLinearity(NULL),
632 // fHistoTrueEtaNonLinearity(NULL),
633  fEventPlaneAngle(-100),
634  fRandom(0),
635  fNGammaCandidates(0),
636  fUnsmearedPx(NULL),
637  fUnsmearedPy(NULL),
638  fUnsmearedPz(NULL),
639  fUnsmearedE(NULL),
640  fMCStackPos(NULL),
641  fMCStackNeg(NULL),
642  fESDArrayPos(NULL),
643  fESDArrayNeg(NULL),
644  fnCuts(0),
645  fiCut(0),
646  fMoveParticleAccordingToVertex(kTRUE),
647  fIsHeavyIon(0),
648  fDoLightOutput(kFALSE),
649  fDoMesonAnalysis(kTRUE),
650  fDoMesonQA(0),
651  fDoPhotonQA(0),
652  fDoClusterQA(0),
653  fIsFromMBHeader(kTRUE),
654  fIsOverlappingWithOtherHeader(kFALSE),
655  fIsMC(0),
656  fDoTHnSparse(kTRUE),
657  fSetPlotHistsExtQA(kFALSE),
658  fWeightJetJetMC(1),
659  fDoConvGammaShowerShapeTree(kFALSE),
660  fEnableSortForClusMC(kFALSE),
661  fDoPrimaryTrackMatching(kFALSE),
662  fDoInvMassShowerShapeTree(kFALSE),
663  tBrokenFiles(NULL),
664  fFileNameBroken(NULL)
665 {
666  // Define output slots here
667  DefineOutput(1, TList::Class());
668 }
669 
671 {
672  if(fGammaCandidates){
673  delete fGammaCandidates;
674  fGammaCandidates = 0x0;
675  }
676  if(fClusterCandidates){
677  delete fClusterCandidates;
678  fClusterCandidates = 0x0;
679  }
680  if(fBGHandler){
681  delete[] fBGHandler;
682  fBGHandler = 0x0;
683  }
684  if(fBGHandlerRP){
685  delete[] fBGHandlerRP;
686  fBGHandlerRP = 0x0;
687  }
688  if(fBGClusHandler){
689  delete[] fBGClusHandler;
690  fBGClusHandler = 0x0;
691  }
692  if(fBGClusHandlerRP){
693  delete[] fBGClusHandlerRP;
694  fBGClusHandlerRP = 0x0;
695  }
696 }
697 //___________________________________________________________
699 
700  const Int_t nDim = 4;
701  Int_t nBins[nDim] = {800,300,7,4};
702  Double_t xMin[nDim] = {0,0, 0,0};
703  Double_t xMax[nDim] = {0.8,30,7,4};
704 
705  if(fDoTHnSparse){
706  fSparseMotherInvMassPtZM = new THnSparseF*[fnCuts];
707  fSparseMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
708  }
709 
712 
715 
716  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
717  if (((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
718  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
719  TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
720  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
721  TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
722 
723  Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(0,1));
724  Int_t centMin = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(1,1));
725  Int_t centMax = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(2,1));
726 
727  if(collisionSystem == 1 || collisionSystem == 2 ||
728  collisionSystem == 5 || collisionSystem == 8 ||
729  collisionSystem == 9){
730  centMin = centMin*10;
731  centMax = centMax*10;
732  if(centMax ==0 && centMax!=centMin) centMax=100;
733  }else if(collisionSystem == 3 || collisionSystem == 6){
734  centMin = centMin*5;
735  centMax = centMax*5;
736  }else if(collisionSystem == 4 || collisionSystem == 7){
737  centMin = ((centMin*5)+45);
738  centMax = ((centMax*5)+45);
739  }
740 
741  if(fDoTHnSparse){
742  fBackList[iCut] = new TList();
743  fBackList[iCut]->SetName(Form("%s_%s_%s_%s Back histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(), cutstringMeson.Data()));
744  fBackList[iCut]->SetOwner(kTRUE);
745  fCutFolder[iCut]->Add(fBackList[iCut]);
746 
747  fSparseMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m","Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
748  fBackList[iCut]->Add(fSparseMotherBackInvMassPtZM[iCut]);
749 
750  fMotherList[iCut] = new TList();
751  fMotherList[iCut]->SetName(Form("%s_%s_%s_%s Mother histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
752  fMotherList[iCut]->SetOwner(kTRUE);
753  fCutFolder[iCut]->Add(fMotherList[iCut]);
754 
755  fSparseMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m","Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
756  fMotherList[iCut]->Add(fSparseMotherInvMassPtZM[iCut]);
757  }
758 
759  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
761  collisionSystem,centMin,centMax,
762  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
763  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity(),
764  2,8,5);
766  collisionSystem,centMin,centMax,
767  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
768  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity(),
769  2,8,5);
770  fBGHandlerRP[iCut] = NULL;
771  }else{
773  ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsHeavyIon(),
774  ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity(),
775  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents());
777  ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsHeavyIon(),
778  ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity(),
779  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents());
780  fBGHandler[iCut] = NULL;
781  }
782  }
783  }
784 }
785 //________________________________________________________________________
787 
788  fV0Reader = (AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
789  if(!fV0Reader){printf("Error: No V0 Reader");return;}// GetV0Reader
790 
791 
792  if (fIsMC == 2){
793  fDoClusterQA = 0;
794  fDoTHnSparse = kFALSE;
795  } else if (fIsMC == 3){
796  fDoTHnSparse = kFALSE;
797  }
798  // Create histograms
799  if(fOutputContainer != NULL){
800  delete fOutputContainer;
801  fOutputContainer = NULL;
802  }
803  if(fOutputContainer == NULL){
804  fOutputContainer = new TList();
805  fOutputContainer->SetOwner(kTRUE);
806  }
807 
808  // Array of current cut's gammas
809  fGammaCandidates = new TList();
810  fClusterCandidates = new TList();
811  fClusterCandidates->SetOwner(kTRUE);
812 
813  fCutFolder = new TList*[fnCuts];
814  fESDList = new TList*[fnCuts];
815 
816  if(fDoTHnSparse){
817  fBackList = new TList*[fnCuts];
818  fMotherList = new TList*[fnCuts];
819  }
820 
821  fHistoNEvents = new TH1F*[fnCuts];
822  if (fIsMC > 1){
823  fHistoNEventsWOWeight = new TH1F*[fnCuts];
824  }
825  if (fIsMC == 2){
826  fProfileJetJetXSection = new TProfile*[fnCuts];
827  fHistoJetJetNTrials = new TH1F*[fnCuts];
828  }
829  fHistoNGoodESDTracks = new TH1F*[fnCuts];
830  fHistoVertexZ = new TH1F*[fnCuts];
831  if(!fDoLightOutput){
832  fHistoVertexX = new TH1F*[fnCuts];
833  fHistoVertexY = new TH1F*[fnCuts];
834  }
835  fHistoNGammaCandidates = new TH1F*[fnCuts];
836  if(fIsHeavyIon==2) fProfileEtaShift = new TProfile*[fnCuts];
837  if(!fDoLightOutput){
840  fHistoNV0Tracks = new TH1F*[fnCuts];
841  fHistoConvGammaPt = new TH1F*[fnCuts];
842  }
843 
844  if (fDoPhotonQA == 2){
845  fPhotonDCAList = new TList*[fnCuts];
847  }
848  if (fDoPhotonQA > 0){
849  fHistoConvGammaR = new TH1F*[fnCuts];
850  fHistoConvGammaEta = new TH1F*[fnCuts];
851  }
852 
853  if(fDoMesonAnalysis){
856  if(!fDoLightOutput){
863  }
864  if (fDoMesonQA > 0){
873  }
874  }
875 
877  fHistoClusGammaPt = new TH1F*[fnCuts];
878  fHistoClusGammaE = new TH1F*[fnCuts];
880 
882  fGammaERM02 = new TList*[fnCuts];
883  tESDGammaERM02 = new TTree*[fnCuts];
884  }
885 
889  }
890 
891  // set common binning in pT for mesons and photons
892  Int_t nBinsPt = 200;
893  Float_t minPt = 0;
894  Float_t maxPt = 20;
895  Int_t nBinsQAPt = 200;
896  Float_t minQAPt = 0.4;
897  Float_t maxQAPt = 20;
898  Int_t nBinsClusterPt = 500;
899  Float_t minClusterPt = 0;
900  Float_t maxClusterPt = 50;
901  if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k8TeV ){
902  nBinsPt = 400;
903  minPt = 0;
904  maxPt = 40;
905  nBinsQAPt = 300;
906  minQAPt = 0.4;
907  maxQAPt = 40;
908  nBinsClusterPt = 800;
909  minClusterPt = 0;
910  maxClusterPt = 80;
911  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kpPb5TeV ){
912  nBinsPt = 400;
913  minPt = 0;
914  maxPt = 40;
915  nBinsQAPt = 300;
916  minQAPt = 0.4;
917  maxQAPt = 40;
918  nBinsClusterPt = 800;
919  minClusterPt = 0;
920  maxClusterPt = 80;
921  }
922 
923  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
924  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
925  TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
926  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
927  TString cutstringMeson = "NoMesonCut";
928  if(fDoMesonAnalysis)
929  cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
930 
931  fCutFolder[iCut] = new TList();
932  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s_%s",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
933  fCutFolder[iCut]->SetOwner(kTRUE);
934  fOutputContainer->Add(fCutFolder[iCut]);
935  fESDList[iCut] = new TList();
936  fESDList[iCut]->SetName(Form("%s_%s_%s_%s ESD histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
937  fESDList[iCut]->SetOwner(kTRUE);
938  fCutFolder[iCut]->Add(fESDList[iCut]);
939 
940  fHistoNEvents[iCut] = new TH1F("NEvents","NEvents",14,-0.5,13.5);
941  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
942  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
943  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
944  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
945  TString TriggerNames = "Not Trigger: ";
946  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
947  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
948  }else {
949  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
950  }
951  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
952  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
953  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
954  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
955  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
956  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
957  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
958  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
959  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
960  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
961  fESDList[iCut]->Add(fHistoNEvents[iCut]);
962 
963  if (fIsMC > 1){
964  fHistoNEventsWOWeight[iCut] = new TH1F("NEventsWOWeight","NEventsWOWeight",14,-0.5,13.5);
965  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
966  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
967  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
968  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
969  TString TriggerNames = "Not Trigger: ";
970  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
971  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
972  }else {
973  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
974  }
975  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
976  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
977  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
978  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
979  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
980  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
981  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
982  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
983  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
984  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
985  fESDList[iCut]->Add(fHistoNEventsWOWeight[iCut]);
986  }
987 
988  if (fIsMC == 2){
989  fProfileJetJetXSection[iCut] = new TProfile("XSection","XSection",1,-0.5,0.5);
990  fESDList[iCut]->Add(fProfileJetJetXSection[iCut]);
991  fHistoJetJetNTrials[iCut] = new TH1F("NTrials","#sum{NTrials}",1,0,1);
992  fHistoJetJetNTrials[iCut]->GetXaxis()->SetBinLabel(1,"#sum{NTrials}");
993  fESDList[iCut]->Add(fHistoJetJetNTrials[iCut]);
994  }
995 
996  if(fIsHeavyIon == 1)
997  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks","GoodESDTracks",4000,0,4000);
998  else if(fIsHeavyIon == 2)
999  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks","GoodESDTracks",400,0,400);
1000  else
1001  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks","GoodESDTracks",200,0,200);
1002  fHistoNGoodESDTracks[iCut]->SetXTitle("# TPC tracks");
1003  fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
1004 
1005  fHistoVertexZ[iCut] = new TH1F("VertexZ","VertexZ",1000,-50,50);
1006  fESDList[iCut]->Add(fHistoVertexZ[iCut]);
1007  if(!fDoLightOutput){
1008  fHistoVertexX[iCut] = new TH1F("VertexX","VertexX",200,-5,5);
1009  fESDList[iCut]->Add(fHistoVertexX[iCut]);
1010  fHistoVertexY[iCut] = new TH1F("VertexY","VertexY",200,-5,5);
1011  fESDList[iCut]->Add(fHistoVertexY[iCut]);
1012  }
1013 
1014  if(fIsHeavyIon == 1)
1015  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates","GammaCandidates",100,0,100);
1016  else if(fIsHeavyIon == 2)
1017  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates","GammaCandidates",50,0,50);
1018  else
1019  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates","GammaCandidates",50,0,50);
1020  fHistoNGammaCandidates[iCut]->SetXTitle("# accepted #gamma_{conv}");
1021  fESDList[iCut]->Add(fHistoNGammaCandidates[iCut]);
1022 
1023  if(!fDoLightOutput){
1024  if(fIsHeavyIon == 1)
1025  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",4000,0,4000,100,0,100);
1026  else if(fIsHeavyIon == 2)
1027  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",400,0,400,50,0,50);
1028  else
1029  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",200,0,200,50,0,50);
1030  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetXTitle("# TPC tracks");
1031  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetYTitle("# accepted #gamma_{conv}");
1033 
1034  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters","SPD tracklets vs SPD clusters",100,0,200,250,0,1000);
1035  fESDList[iCut]->Add(fHistoSPDClusterTrackletBackground[iCut]);
1036 
1037  if(fIsHeavyIon == 1)
1038  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
1039  else if(fIsHeavyIon == 2)
1040  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
1041  else
1042  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
1043  fHistoNV0Tracks[iCut]->SetXTitle("VZERO amp [arb. units]");
1044  fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
1045 
1046  fHistoConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",nBinsPt, minPt, maxPt);
1047  fHistoConvGammaPt[iCut]->SetXTitle("p_{T,conv}(GeV/c)");
1048  fESDList[iCut]->Add(fHistoConvGammaPt[iCut]);
1049  }
1050 
1051  if(fIsHeavyIon == 2){
1052  fProfileEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
1053  fESDList[iCut]->Add(fProfileEtaShift[iCut]);
1054  }
1055 
1056  if (fIsMC > 1){
1057  fHistoNEvents[iCut]->Sumw2();
1058  fHistoNGoodESDTracks[iCut]->Sumw2();
1059  fHistoVertexZ[iCut]->Sumw2();
1060  fHistoNGammaCandidates[iCut]->Sumw2();
1061  if(!fDoLightOutput){
1062  fHistoVertexX[iCut]->Sumw2();
1063  fHistoVertexY[iCut]->Sumw2();
1065  fHistoSPDClusterTrackletBackground[iCut]->Sumw2();
1066  fHistoNV0Tracks[iCut]->Sumw2();
1067  fHistoConvGammaPt[iCut]->Sumw2();
1068  }
1069  }
1070 
1071  if (fDoPhotonQA == 2 ){
1072  fPhotonDCAList[iCut] = new TList();
1073  fPhotonDCAList[iCut]->SetName(Form("%s_%s_%s_%s Photon DCA tree",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1074  fPhotonDCAList[iCut]->SetOwner(kTRUE);
1075  fCutFolder[iCut]->Add(fPhotonDCAList[iCut]);
1076 
1077  fTreeConvGammaPtDcazCat[iCut] = new TTree("ESD_ConvGamma_Pt_Dcaz_R_Eta","ESD_ConvGamma_Pt_Dcaz_R_Eta_Cat");
1078  fTreeConvGammaPtDcazCat[iCut]->Branch("Pt",&fPtGamma,"fPtGamma/F");
1079  fTreeConvGammaPtDcazCat[iCut]->Branch("DcaZPhoton",&fDCAzPhoton,"fDCAzPhoton/F");
1080  fTreeConvGammaPtDcazCat[iCut]->Branch("cat",&fCharCatPhoton,"fCharCatPhoton/b");
1081  if(fIsMC > 0){
1082  fTreeConvGammaPtDcazCat[iCut]->Branch("photonMCInfo",&fCharPhotonMCInfo,"fCharPhotonMCInfo/b");
1083  }
1084  if (fIsMC > 1){
1085  fTreeConvGammaPtDcazCat[iCut]->Branch("weightEvent",&fWeightJetJetMC,"fWeightJetJetMC/b");
1086  }
1087  fPhotonDCAList[iCut]->Add(fTreeConvGammaPtDcazCat[iCut]);
1088  }
1089 
1090  if (fDoPhotonQA > 0){
1091  fHistoConvGammaR[iCut] = new TH1F("ESD_ConvGamma_R","ESD_ConvGamma_R",800,0,200);
1092  fHistoConvGammaR[iCut]->SetXTitle("R_{conv}(cm)");
1093  fESDList[iCut]->Add(fHistoConvGammaR[iCut]);
1094  fHistoConvGammaEta[iCut] = new TH1F("ESD_ConvGamma_Eta","ESD_ConvGamma_Eta",2000,-2,2);
1095  fHistoConvGammaEta[iCut]->SetXTitle("#eta_{conv}");
1096  fESDList[iCut]->Add(fHistoConvGammaEta[iCut]);
1097  }
1098 
1099  fClusterOutputList[iCut] = new TList();
1100  fClusterOutputList[iCut]->SetName(Form("%s_%s_%s_%s Cluster Output",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1101  fClusterOutputList[iCut]->SetOwner(1);
1102  fCutFolder[iCut]->Add(fClusterOutputList[iCut]);
1103 
1104  fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt","ClusGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1105  fHistoClusGammaPt[iCut]->SetXTitle("p_{T,clus}(GeV/c)");
1106  fClusterOutputList[iCut]->Add(fHistoClusGammaPt[iCut]);
1107  fHistoClusGammaE[iCut] = new TH1F("ClusGamma_E","ClusGamma_E",nBinsClusterPt, minClusterPt, maxClusterPt);
1108  fHistoClusGammaE[iCut]->SetXTitle("E_{clus}(GeV)");
1109  fClusterOutputList[iCut]->Add(fHistoClusGammaE[iCut]);
1110  fHistoClusOverlapHeadersGammaPt[iCut] = new TH1F("ClusGammaOverlapHeaders_Pt","ClusGammaOverlapHeaders_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1111  fHistoClusOverlapHeadersGammaPt[iCut]->SetXTitle("p_{T,clus}(GeV/c), selected header w/ overlap");
1113 
1115  fGammaERM02[iCut] = new TList();
1116  fGammaERM02[iCut]->SetName(Form("%s_%s_%s_%s ConvGamma-Cluster Matched",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1117  fGammaERM02[iCut]->SetOwner(kTRUE);
1118  fCutFolder[iCut]->Add(fGammaERM02[iCut]);
1119 
1120  tESDGammaERM02[iCut] = new TTree("ESD_ConvGamma_E_ConvR_M02_M20","ESD_ConvGamma_E_ConvR_M02_M20");
1121  tESDGammaERM02[iCut]->Branch("ClusterE",&tESDClusE,"tESDClusE/F");
1122  tESDGammaERM02[iCut]->Branch("ConvR",&tESDGammaConvR,"tESDGammaConvR/F");
1123  tESDGammaERM02[iCut]->Branch("M02",&tESDClusterM02,"tESDClusterM02/F");
1124  tESDGammaERM02[iCut]->Branch("M20",&tESDClusterM20,"tESDClusterM20/F");
1125  tESDGammaERM02[iCut]->Branch("Eta",&tESDClusterEta,"tESDClusterEta/F");
1126  tESDGammaERM02[iCut]->Branch("Phi",&tESDClusterPhi,"tESDClusterPhi/F");
1127  tESDGammaERM02[iCut]->Branch("NCells",&tESDClusterNCells,"tESDClusterNCells/F");
1128  tESDGammaERM02[iCut]->Branch("MaxECell",&tESDClusterMaxECell,"tESDClusterMaxECell/F");
1129  tESDGammaERM02[iCut]->Branch("NLM",&tESDClusterNLM,"tESDClusterNLM/F");
1130  fGammaERM02[iCut]->Add(tESDGammaERM02[iCut]);
1131  }
1132 
1134  fInvMassShowerShape[iCut] = new TList();
1135  fInvMassShowerShape[iCut]->SetName(Form("%s_%s_%s_%s InvMass_ShowerShape",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1136  fInvMassShowerShape[iCut]->SetOwner(kTRUE);
1137  fCutFolder[iCut]->Add(fInvMassShowerShape[iCut]);
1138  tESDInvMassShowerShape[iCut] = new TTree("ESD_Meson_InvMass_Pt_ClusE_ClusM02_ClusM20","ESD_Meson_InvMass_Pt_ClusE_ClusM02_ClusM20");
1139  tESDInvMassShowerShape[iCut]->Branch("MesonInvMass",&tESDIMMesonInvMass,"tESDIMMesonInvMass/F");
1140  tESDInvMassShowerShape[iCut]->Branch("MesonPt",&tESDIMMesonPt,"tESDIMMesonPt/F");
1141  tESDInvMassShowerShape[iCut]->Branch("ClusE",&tESDIMClusE,"tESDIMClusE/F");
1142  tESDInvMassShowerShape[iCut]->Branch("ClusM02",&tESDIMClusterM02,"tESDIMClusterM02/F");
1143  tESDInvMassShowerShape[iCut]->Branch("ClusM20",&tESDIMClusterM20,"tESDIMClusterM20/F");
1144  tESDInvMassShowerShape[iCut]->Branch("ClusLeadCellID",&tESDIMClusterLeadCellID,"tESDIMClusterLeadCellID/I");
1145  if(fIsMC>0) tESDInvMassShowerShape[iCut]->Branch("ClusClassification",&tESDIMClusterClassification,"tESDIMClusterClassification/I");
1146  tESDInvMassShowerShape[iCut]->Branch("ClusMatchedTrackPt",&tESDIMClusMatchedTrackPt,"tESDIMClusMatchedTrackPt/F");
1147  tESDInvMassShowerShape[iCut]->Branch("ClusTrackDeltaEta",&tESDIMClusTrackDeltaEta,"tESDIMClusTrackDeltaEta/F");
1148  tESDInvMassShowerShape[iCut]->Branch("ClusTrackDeltaPhi",&tESDIMClusTrackDeltaPhi,"tESDIMClusTrackDeltaPhi/F");
1149  tESDInvMassShowerShape[iCut]->Branch("ClusIsoSumClusterEt",&tESDIMClusterIsoSumClusterEt,"tESDIMClusterIsoSumClusterEt/F");
1150  tESDInvMassShowerShape[iCut]->Branch("ClusIsoSumTrackEt",&tESDIMClusterIsoSumTrackEt,"tESDIMClusterIsoSumTrackEt/F");
1151  fInvMassShowerShape[iCut]->Add(tESDInvMassShowerShape[iCut]);
1152  }
1153 
1154  if (fIsMC > 1){
1155  fHistoClusGammaPt[iCut]->Sumw2();
1156  fHistoClusGammaE[iCut]->Sumw2();
1157  fHistoClusOverlapHeadersGammaPt[iCut]->Sumw2();
1158  }
1159 
1160  if(fDoMesonAnalysis){
1161  fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1162  fHistoMotherInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2})");
1163  fHistoMotherInvMassPt[iCut]->SetYTitle("p_{T,pair}(GeV/c)");
1164  fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
1165 
1166  if(!fDoLightOutput){
1167  fHistoMotherMatchedInvMassPt[iCut] = new TH2F("ESD_MotherMatched_InvMass_Pt","ESD_MotherMatched_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1168  fHistoMotherMatchedInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2}) matched conv e^{+/-}to cluster");
1169  fHistoMotherMatchedInvMassPt[iCut]->SetYTitle("p_{T,pair}(GeV/c)");
1170  fESDList[iCut]->Add(fHistoMotherMatchedInvMassPt[iCut]);
1171  }
1172 
1173  fHistoMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt","ESD_Background_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1174  fHistoMotherBackInvMassPt[iCut]->SetXTitle("M_{inv, mxed}(GeV/c^{2})");
1175  fHistoMotherBackInvMassPt[iCut]->SetYTitle("p_{T,BG pair}(GeV/c)");
1176  fESDList[iCut]->Add(fHistoMotherBackInvMassPt[iCut]);
1177 
1178  if(!fDoLightOutput){
1179  fHistoMotherInvMassPtAlpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_Pt_Alpha","ESD_Mother_InvMass_vs_Pt_Alpha",800,0,0.8,nBinsPt, minPt, maxPt);
1180  fHistoMotherInvMassPtAlpha[iCut]->SetXTitle("M_{inv}(GeV/c^{2})");
1181  fHistoMotherInvMassPtAlpha[iCut]->SetYTitle("p_{T,pair}(GeV/c)");
1182  fESDList[iCut]->Add(fHistoMotherInvMassPtAlpha[iCut]);
1183 
1184  fHistoPhotonPairPtconv[iCut] = new TH2F("ESD_Mother_InvMass_PtConv","",800,0,0.8,nBinsPt, minPt, maxPt);
1185  fHistoPhotonPairPtconv[iCut]->SetXTitle("M_{inv}(GeV/c^{2})");
1186  fHistoPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv}p_{T}(GeV/c)");
1187  fESDList[iCut]->Add(fHistoPhotonPairPtconv[iCut]);
1188 
1189  fHistoPhotonPairMixedEventPtconv[iCut] = new TH2F("ESD_Background_InvMass_PtConv","",800,0,0.8,nBinsPt, minPt, maxPt);
1190  fHistoPhotonPairMixedEventPtconv[iCut]->SetXTitle("M_{inv,mixed}(GeV/c^{2})");
1191  fHistoPhotonPairMixedEventPtconv[iCut]->SetYTitle("#gamma^{conv}p_{T}(GeV/c)");
1192  fESDList[iCut]->Add(fHistoPhotonPairMixedEventPtconv[iCut]);
1193  }
1194 
1195  if (fIsMC > 1){
1196  fHistoMotherInvMassPt[iCut]->Sumw2();
1197  fHistoMotherBackInvMassPt[iCut]->Sumw2();
1198  if(!fDoLightOutput){
1199  fHistoMotherMatchedInvMassPt[iCut]->Sumw2();
1200  fHistoMotherInvMassPtAlpha[iCut]->Sumw2();
1201  fHistoPhotonPairPtconv[iCut]->Sumw2();
1202  fHistoPhotonPairMixedEventPtconv[iCut]->Sumw2();
1203  }
1204  }
1205 
1206  if(!fDoLightOutput){
1207  fHistoMotherInvMassECalib[iCut] = new TH2F("ESD_Mother_InvMass_E_Calib","ESD_Mother_InvMass_E_Calib",800,0,0.8,nBinsPt, minPt, maxPt);
1208  fHistoMotherInvMassECalib[iCut]->SetXTitle("M_{inv}(GeV/c^{2})");
1209  fHistoMotherInvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
1210  fESDList[iCut]->Add(fHistoMotherInvMassECalib[iCut]);
1211 
1212  fHistoMotherBackInvMassECalib[iCut] = new TH2F("ESD_Background_InvMass_E_Calib","ESD_Background_InvMass_E_Calib",800,0,0.8,nBinsPt, minPt, maxPt);
1213  fHistoMotherBackInvMassECalib[iCut]->SetXTitle("M_{inv}(GeV/c^{2})");
1214  fHistoMotherBackInvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
1215  fESDList[iCut]->Add(fHistoMotherBackInvMassECalib[iCut]);
1216 
1217  if (fIsMC > 1){
1218  fHistoMotherInvMassECalib[iCut]->Sumw2();
1219  fHistoMotherBackInvMassECalib[iCut]->Sumw2();
1220  }
1221  }
1222 
1223  if (fDoMesonQA > 0 ){
1224  fHistoMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y","ESD_MotherPi0_Pt_Y",nBinsQAPt, minQAPt, maxQAPt,150,-1.5,1.5);
1225  fHistoMotherPi0PtY[iCut]->SetXTitle("p_{T, #pi^{0}cand}(GeV/c)");
1226  fHistoMotherPi0PtY[iCut]->SetYTitle("y_{#pi^{0}cand}");
1228  fESDList[iCut]->Add(fHistoMotherPi0PtY[iCut]);
1229  fHistoMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y","ESD_MotherEta_Pt_Y",nBinsQAPt, minQAPt, maxQAPt,150,-1.5,1.5);
1230  fHistoMotherEtaPtY[iCut]->SetXTitle("p_{T, #eta cand}(GeV/c)");
1231  fHistoMotherEtaPtY[iCut]->SetYTitle("y_{ #eta cand}");
1233  fESDList[iCut]->Add(fHistoMotherEtaPtY[iCut]);
1234  fHistoMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha","ESD_MotherPi0_Pt_Alpha",nBinsQAPt, minQAPt, maxQAPt,200,-1,1);
1235  fHistoMotherPi0PtAlpha[iCut]->SetXTitle("p_{T, #pi^{0}cand}(GeV/c)");
1236  fHistoMotherPi0PtAlpha[iCut]->SetYTitle("#alpha_{#pi^{0}cand}");
1238  fESDList[iCut]->Add(fHistoMotherPi0PtAlpha[iCut]);
1239  fHistoMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha","ESD_MotherEta_Pt_Alpha",nBinsQAPt, minQAPt, maxQAPt,200,-1,1);
1240  fHistoMotherEtaPtAlpha[iCut]->SetXTitle("p_{T, #eta cand}(GeV/c)");
1241  fHistoMotherEtaPtAlpha[iCut]->SetYTitle("#alpha_{#eta cand}");
1243  fESDList[iCut]->Add(fHistoMotherEtaPtAlpha[iCut]);
1244  fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",nBinsQAPt, minQAPt, maxQAPt,100,0,1);
1245  fHistoMotherPi0PtOpenAngle[iCut]->SetXTitle("p_{T, #pi^{0}cand}(GeV/c)");
1246  fHistoMotherPi0PtOpenAngle[iCut]->SetYTitle("#theta_{#pi^{0}cand}");
1248  fESDList[iCut]->Add(fHistoMotherPi0PtOpenAngle[iCut]);
1249  fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",nBinsQAPt, minQAPt, maxQAPt,200,0,TMath::Pi());
1250  fHistoMotherEtaPtOpenAngle[iCut]->SetXTitle("p_{T, #eta cand}(GeV/c)");
1251  fHistoMotherEtaPtOpenAngle[iCut]->SetYTitle("#theta_{#eta cand}");
1253  fESDList[iCut]->Add(fHistoMotherEtaPtOpenAngle[iCut]);
1254  fHistoMotherPi0ConvPhotonEtaPhi[iCut] = new TH2F("ESD_MotherPi0ConvPhoton_Eta_Phi","ConvPhoton under #pi^{0}peak",600,0,2*TMath::Pi(),200,-1,1);
1255  fHistoMotherPi0ConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
1256  fHistoMotherPi0ConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
1257  fESDList[iCut]->Add(fHistoMotherPi0ConvPhotonEtaPhi[iCut]);
1258  fHistoMotherEtaConvPhotonEtaPhi[iCut] = new TH2F("ESD_MotherEtaConvPhoton_Eta_Phi","ConvPhoton under #eta peak",600,0,2*TMath::Pi(),200,-1,1);
1259  fHistoMotherEtaConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
1260  fHistoMotherEtaConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
1261  fESDList[iCut]->Add(fHistoMotherEtaConvPhotonEtaPhi[iCut]);
1262  if (fIsMC > 1){
1263  fHistoMotherPi0PtY[iCut]->Sumw2();
1264  fHistoMotherEtaPtY[iCut]->Sumw2();
1265  fHistoMotherPi0PtAlpha[iCut]->Sumw2();
1266  fHistoMotherEtaPtAlpha[iCut]->Sumw2();
1267  fHistoMotherPi0PtOpenAngle[iCut]->Sumw2();
1268  fHistoMotherEtaPtOpenAngle[iCut]->Sumw2();
1269  fHistoMotherPi0ConvPhotonEtaPhi[iCut]->Sumw2();
1270  fHistoMotherEtaConvPhotonEtaPhi[iCut]->Sumw2();
1271  }
1272  }
1273  }
1274  }
1275  if(fDoMesonAnalysis){
1276  InitBack(); // Init Background Handler
1277  }
1278 
1279  if(fIsMC>0){
1280  // MC Histogramms
1281  fMCList = new TList*[fnCuts];
1282  // True Histogramms
1283  fTrueList = new TList*[fnCuts];
1284 
1285  if(!fDoLightOutput){
1286  fHistoMCHeaders = new TH1I*[fnCuts];
1287  fHistoMCAllGammaPt = new TH1F*[fnCuts];
1288  fHistoMCAllGammaEMCALAccPt = new TH1F*[fnCuts];
1290  fHistoMCDecayGammaPi0Pt = new TH1F*[fnCuts];
1291  fHistoMCDecayGammaRhoPt = new TH1F*[fnCuts];
1292  fHistoMCDecayGammaEtaPt = new TH1F*[fnCuts];
1293  fHistoMCDecayGammaOmegaPt = new TH1F*[fnCuts];
1294  fHistoMCDecayGammaEtapPt = new TH1F*[fnCuts];
1295  fHistoMCDecayGammaPhiPt = new TH1F*[fnCuts];
1296  fHistoMCDecayGammaSigmaPt = new TH1F*[fnCuts];
1297  fHistoMCConvGammaPt = new TH1F*[fnCuts];
1299  fHistoTrueConvGammaPt = new TH1F*[fnCuts];
1302 
1304  fHistoTruePrimaryConvGammaPt = new TH1F*[fnCuts];
1311  }
1312 
1313  fHistoTrueClusGammaPt = new TH1F*[fnCuts];
1314  if(!fDoLightOutput){
1315  fHistoTrueClusConvGammaPt = new TH1F*[fnCuts];
1316  fHistoTruePrimaryClusGammaPt = new TH1F*[fnCuts];
1324  fHistoTrueClusElectronPt = new TH1F*[fnCuts];
1325  }
1328 
1329  if(!fDoLightOutput){
1333  fHistoTrueClusEMNonLeadingPt = new TH1F*[fnCuts];
1334  }
1335 
1336  if (fDoPhotonQA > 0){
1337  fHistoMCConvGammaR = new TH1F*[fnCuts];
1338  fHistoMCConvGammaEta = new TH1F*[fnCuts];
1339  fHistoTrueConvGammaEta = new TH1F*[fnCuts];
1340  }
1341 
1342 // fHistoTruePi0NonLinearity = new TH2F*[fnCuts];
1343 // fHistoTrueEtaNonLinearity = new TH2F*[fnCuts];
1344  if(!fDoLightOutput){
1347  }
1348 
1349  if (fDoClusterQA > 0){
1351  fHistoTrueClusMergedGammaPt = new TH1F*[fnCuts];
1353  fHistoTrueClusDalitzPt = new TH1F*[fnCuts];
1354  fHistoTrueClusDalitzMergedPt = new TH1F*[fnCuts];
1356  fHistoTrueClusShowerPt = new TH1F*[fnCuts];
1357  fHistoTrueClusSubLeadingPt = new TH1F*[fnCuts];
1358  fHistoTrueClusNMothers = new TH1F*[fnCuts];
1359  }
1360 
1361  if(fDoMesonAnalysis){
1362  fHistoMCPi0Pt = new TH1F*[fnCuts];
1363  fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
1364  fHistoMCEtaPt = new TH1F*[fnCuts];
1365  fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
1366  fHistoMCPi0InAccPt = new TH1F*[fnCuts];
1367  fHistoMCPi0WOWeightInAccPt = new TH1F*[fnCuts];
1368  fHistoMCEtaInAccPt = new TH1F*[fnCuts];
1369  fHistoMCEtaWOWeightInAccPt = new TH1F*[fnCuts];
1370  if (fIsMC > 1){
1371  fHistoMCPi0WOEvtWeightPt = new TH1F*[fnCuts];
1372  fHistoMCEtaWOEvtWeightPt = new TH1F*[fnCuts];
1375  }
1376 
1380  fHistoMCSecPi0Source = new TH1F*[fnCuts];
1381  fHistoMCSecEtaPt = new TH1F*[fnCuts];
1382  fHistoMCSecEtaSource = new TH1F*[fnCuts];
1383  if (!fDoLightOutput){
1392  }
1393 
1399  fHistoMultipleCountTruePi0 = new TH1F*[fnCuts];
1401  fHistoMultipleCountTrueEta = new TH1F*[fnCuts];
1413  if(!fDoLightOutput) {
1420  fHistoTruePrimaryPi0DCPtconv = new TH1F*[fnCuts];
1424  }
1425 
1426 
1427  if (fDoMesonQA > 0){
1428  fHistoMCPi0PtY = new TH2F*[fnCuts];
1429  fHistoMCEtaPtY = new TH2F*[fnCuts];
1430  fHistoMCPi0PtAlpha = new TH2F*[fnCuts];
1431  fHistoMCEtaPtAlpha = new TH2F*[fnCuts];
1432  if (fIsMC == 2){
1433  fHistoMCPi0PtJetPt = new TH2F*[fnCuts];
1434  fHistoMCEtaPtJetPt = new TH2F*[fnCuts];
1435  }
1436 
1437  if (fIsMC < 2){
1463  }
1464  if(fDoMesonQA > 1){
1469  }
1470  fHistoTruePi0PtY = new TH2F*[fnCuts];
1471  fHistoTrueEtaPtY = new TH2F*[fnCuts];
1478  }
1479  }
1480 
1481  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1482  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
1483  TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
1484  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
1485  TString cutstringMeson = "NoMesonCut";
1486  if(fDoMesonAnalysis)
1487  cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
1488 
1489  fMCList[iCut] = new TList();
1490  fMCList[iCut]->SetName(Form("%s_%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1491  fMCList[iCut]->SetOwner(kTRUE);
1492  fCutFolder[iCut]->Add(fMCList[iCut]);
1493  if(!fDoLightOutput){
1494  fHistoMCHeaders[iCut] = new TH1I("MC_Headers","MC_Headers",20,0,20);
1495  fMCList[iCut]->Add(fHistoMCHeaders[iCut]);
1496  fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",nBinsPt, minPt, maxPt);
1497  fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
1498  fHistoMCAllGammaEMCALAccPt[iCut] = new TH1F("MC_AllGammaEMCALAcc_Pt","MC_AllGammaEMCALAcc_Pt",nBinsPt, minPt, maxPt);
1499  fMCList[iCut]->Add(fHistoMCAllGammaEMCALAccPt[iCut]);
1500  fHistoMCAllSecondaryGammaPt[iCut] = new TH2F("MC_AllSecondaryGamma_Pt","MC_AllSecondaryGamma_Pt",nBinsPt, minPt, maxPt,4,-0.5,3.5);
1501  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1502  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1503  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1504  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1505  fMCList[iCut]->Add(fHistoMCAllSecondaryGammaPt[iCut]);
1506 
1507  fHistoMCDecayGammaPi0Pt[iCut] = new TH1F("MC_DecayGammaPi0_Pt","MC_DecayGammaPi0_Pt",nBinsPt, minPt, maxPt);
1508  fMCList[iCut]->Add(fHistoMCDecayGammaPi0Pt[iCut]);
1509  fHistoMCDecayGammaRhoPt[iCut] = new TH1F("MC_DecayGammaRho_Pt","MC_DecayGammaRho_Pt",nBinsPt, minPt, maxPt);
1510  fMCList[iCut]->Add(fHistoMCDecayGammaRhoPt[iCut]);
1511  fHistoMCDecayGammaEtaPt[iCut] = new TH1F("MC_DecayGammaEta_Pt","MC_DecayGammaEta_Pt",nBinsPt, minPt, maxPt);
1512  fMCList[iCut]->Add(fHistoMCDecayGammaEtaPt[iCut]);
1513  fHistoMCDecayGammaOmegaPt[iCut] = new TH1F("MC_DecayGammaOmega_Pt","MC_DecayGammaOmmega_Pt",nBinsPt, minPt, maxPt);
1514  fMCList[iCut]->Add(fHistoMCDecayGammaOmegaPt[iCut]);
1515  fHistoMCDecayGammaEtapPt[iCut] = new TH1F("MC_DecayGammaEtap_Pt","MC_DecayGammaEtap_Pt",nBinsPt, minPt, maxPt);
1516  fMCList[iCut]->Add(fHistoMCDecayGammaEtapPt[iCut]);
1517  fHistoMCDecayGammaPhiPt[iCut] = new TH1F("MC_DecayGammaPhi_Pt","MC_DecayGammaPhi_Pt",nBinsPt, minPt, maxPt);
1518  fMCList[iCut]->Add(fHistoMCDecayGammaPhiPt[iCut]);
1519  fHistoMCDecayGammaSigmaPt[iCut] = new TH1F("MC_DecayGammaSigma_Pt","MC_DecayGammaSigma_Pt",nBinsPt, minPt, maxPt);
1520  fMCList[iCut]->Add(fHistoMCDecayGammaSigmaPt[iCut]);
1521  fHistoMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt","MC_ConvGamma_Pt",nBinsPt, minPt, maxPt);
1522  fMCList[iCut]->Add(fHistoMCConvGammaPt[iCut]);
1523  fHistoMCSecondaryConvGammaPt[iCut] = new TH2F("MC_SecondaryConvGamma_Pt","MC_SecondaryConvGamma_Pt",nBinsPt, minPt, maxPt,4,-0.5,3.5);
1524  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1525  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1526  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1527  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1528  fMCList[iCut]->Add(fHistoMCSecondaryConvGammaPt[iCut]);
1529 
1530  if (fIsMC > 1){
1531  fHistoMCAllGammaPt[iCut]->Sumw2();
1532  fHistoMCAllGammaEMCALAccPt[iCut]->Sumw2();
1533  fHistoMCAllSecondaryGammaPt[iCut]->Sumw2();
1534  fHistoMCDecayGammaPi0Pt[iCut]->Sumw2();
1535  fHistoMCDecayGammaRhoPt[iCut]->Sumw2();
1536  fHistoMCDecayGammaEtaPt[iCut]->Sumw2();
1537  fHistoMCDecayGammaOmegaPt[iCut]->Sumw2();
1538  fHistoMCDecayGammaEtapPt[iCut]->Sumw2();
1539  fHistoMCDecayGammaPhiPt[iCut]->Sumw2();
1540  fHistoMCDecayGammaSigmaPt[iCut]->Sumw2();
1541  fHistoMCConvGammaPt[iCut]->Sumw2();
1542  fHistoMCSecondaryConvGammaPt[iCut]->Sumw2();
1543  }
1544  }
1545 
1546  if (fDoPhotonQA > 0){
1547  fHistoMCConvGammaR[iCut] = new TH1F("MC_ConvGamma_R","MC_ConvGamma_R",800,0,200);
1548  fMCList[iCut]->Add(fHistoMCConvGammaR[iCut]);
1549  fHistoMCConvGammaEta[iCut] = new TH1F("MC_ConvGamma_Eta","MC_ConvGamma_Eta",2000,-2,2);
1550  fMCList[iCut]->Add(fHistoMCConvGammaEta[iCut]);
1551  }
1552 
1553  if(fDoMesonAnalysis){
1554  fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt","MC_Pi0_Pt",nBinsPt, minPt, maxPt);
1555  fHistoMCPi0Pt[iCut]->Sumw2();
1556  fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
1557  fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt","MC_Pi0_WOWeights_Pt",nBinsPt, minPt, maxPt);
1558  fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
1559 
1560  fHistoMCEtaPt[iCut] = new TH1F("MC_Eta_Pt","MC_Eta_Pt",nBinsPt, minPt, maxPt);
1561  fHistoMCEtaPt[iCut]->Sumw2();
1562  fMCList[iCut]->Add(fHistoMCEtaPt[iCut]);
1563  fHistoMCEtaWOWeightPt[iCut] = new TH1F("MC_Eta_WOWeights_Pt","MC_Eta_WOWeights_Pt",nBinsPt, minPt, maxPt);
1564  fMCList[iCut]->Add(fHistoMCEtaWOWeightPt[iCut]);
1565 
1566  fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt","MC_Pi0InAcc_Pt",nBinsPt, minPt, maxPt);
1567  fHistoMCPi0InAccPt[iCut]->Sumw2();
1568  fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
1569  fHistoMCPi0WOWeightInAccPt[iCut] = new TH1F("MC_Pi0WOWeightInAcc_Pt","MC_Pi0WOWeightInAcc_Pt",nBinsPt, minPt, maxPt);
1570  fMCList[iCut]->Add(fHistoMCPi0WOWeightInAccPt[iCut]);
1571  fHistoMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt","MC_EtaInAcc_Pt",nBinsPt, minPt, maxPt);
1572  fHistoMCEtaInAccPt[iCut]->Sumw2();
1573  fMCList[iCut]->Add(fHistoMCEtaInAccPt[iCut]);
1574  fHistoMCEtaWOWeightInAccPt[iCut] = new TH1F("MC_EtaWOWeightInAcc_Pt","MC_EtaWOWeightInAcc_Pt",nBinsPt, minPt, maxPt);
1575  fMCList[iCut]->Add(fHistoMCEtaWOWeightInAccPt[iCut]);
1576 
1577  if (fIsMC > 1){
1578  fHistoMCPi0WOWeightPt[iCut]->Sumw2();
1579  fHistoMCEtaWOWeightPt[iCut]->Sumw2();
1580  fHistoMCPi0WOWeightInAccPt[iCut]->Sumw2();
1581  fHistoMCEtaWOWeightInAccPt[iCut]->Sumw2();
1582  fHistoMCPi0WOEvtWeightPt[iCut] = new TH1F("MC_Pi0_WOEventWeights_Pt","MC_Pi0_WOEventWeights_Pt",nBinsPt, minPt, maxPt);
1583  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightPt[iCut]);
1584  fHistoMCEtaWOEvtWeightPt[iCut] = new TH1F("MC_Eta_WOEventWeights_Pt","MC_Eta_WOEventWeights_Pt",nBinsPt, minPt, maxPt);
1585  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightPt[iCut]);
1586  fHistoMCPi0WOEvtWeightInAccPt[iCut] = new TH1F("MC_Pi0_WOEventWeightsInAcc_Pt","MC_Pi0_WOEventWeightsInAcc_Pt",nBinsPt, minPt, maxPt);
1587  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightInAccPt[iCut]);
1588  fHistoMCEtaWOEvtWeightInAccPt[iCut] = new TH1F("MC_Eta_WOEventWeightsInAcc_Pt","MC_Eta_WOEventWeightsInAcc_Pt",nBinsPt, minPt, maxPt);
1589  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightInAccPt[iCut]);
1590 
1591  if (fDoMesonQA > 0 && fIsMC == 2){
1592  fHistoMCPi0PtJetPt[iCut] = new TH2F("MC_Pi0_Pt_JetPt","MC_Pi0_Pt_JetPt",nBinsQAPt, minQAPt, maxQAPt,200,0,200);
1593  fHistoMCPi0PtJetPt[iCut]->Sumw2();
1595  fMCList[iCut]->Add(fHistoMCPi0PtJetPt[iCut]);
1596  fHistoMCEtaPtJetPt[iCut] = new TH2F("MC_Eta_Pt_JetPt","MC_Eta_Pt_JetPt",nBinsQAPt, minQAPt, maxQAPt,200,0,200);
1597  fHistoMCEtaPtJetPt[iCut]->Sumw2();
1599  fMCList[iCut]->Add(fHistoMCEtaPtJetPt[iCut]);
1600  }
1601  }
1602  fHistoMCPrimaryPtvsSource[iCut] = new TH2F("MC_Primary_Pt_Source","MC_Primary_Pt_Source",nBinsPt, minPt, maxPt, 7, -0.5, 6.5);
1603  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(1,"Pi+");
1604  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(2,"Pi-");
1605  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(3,"K+");
1606  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(4,"K-");
1607  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(5,"K0s");
1608  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(6,"K0l");
1609  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(7,"Lambda");
1610  fMCList[iCut]->Add(fHistoMCPrimaryPtvsSource[iCut]);
1611 
1612  fHistoMCSecPi0Source[iCut] = new TH1F("MC_SecPi0_Source","MC_SecPi0_Source",5000,0.,5000);
1613  fMCList[iCut]->Add(fHistoMCSecPi0Source[iCut]);
1614  fHistoMCSecEtaSource[iCut] = new TH1F("MC_SecEta_Source","MC_SecEta_Source",5000,0,5000);
1615  fMCList[iCut]->Add(fHistoMCSecEtaSource[iCut]);
1616  fHistoMCSecPi0PtvsSource[iCut] = new TH2F("MC_SecPi0_Pt_Source","MC_SecPi0_Pt_Source",nBinsPt, minPt, maxPt,16,-0.5,15.5);
1617  fMCList[iCut]->Add(fHistoMCSecPi0PtvsSource[iCut]);
1618  fHistoMCSecPi0InAccPtvsSource[iCut] = new TH2F("MC_SecPi0InAcc_Pt_Source","MC_SecPi0InAcc_Pt_Source",nBinsPt, minPt, maxPt,16,-0.5,15.5);
1619  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtvsSource[iCut]);
1620  fHistoMCSecEtaPt[iCut] = new TH1F("MC_SecEta_Pt","MC_SecEta_Pt",nBinsPt, minPt, maxPt);
1621  fMCList[iCut]->Add(fHistoMCSecEtaPt[iCut]);
1622 
1623  if (fIsMC == 2){
1624  fHistoMCPrimaryPtvsSource[iCut]->Sumw2();
1625  fHistoMCSecPi0PtvsSource[iCut]->Sumw2();
1626  fHistoMCSecPi0InAccPtvsSource[iCut]->Sumw2();
1627  fHistoMCSecEtaPt[iCut]->Sumw2();
1628  }
1629 
1630  // book histograms for pure MC handling of PCM-Calo dir gamma reco
1631  if (!fDoLightOutput){
1632  fHistoMCPi0PtGammaLeg[iCut] = new TH2F("MC_Pi0_PtGamma_Leg","MC_Pi0_PtGamma_Leg",nBinsPt, minPt, maxPt, 3, -0.5, 2.5);
1633  fHistoMCPi0PtGammaLeg[iCut]->Sumw2();
1634  fMCList[iCut]->Add(fHistoMCPi0PtGammaLeg[iCut]);
1635  fHistoMCPi0WOWeightPtGammaLeg[iCut] = new TH2F("MC_Pi0_WOWeights_PtGamma_Leg","MC_Pi0_WOWeights_PtGamma_Leg",nBinsPt, minPt, maxPt, 3, -0.5, 2.5);
1636  fMCList[iCut]->Add(fHistoMCPi0WOWeightPtGammaLeg[iCut]);
1637 
1638  fHistoMCPi0InAccPtGammaLeg[iCut] = new TH2F("MC_Pi0InAcc_PtGamma_Leg","MC_Pi0InAcc_PtGamma_Leg",nBinsPt, minPt, maxPt, 3, -0.5, 2.5);
1639  fHistoMCPi0InAccPtGammaLeg[iCut]->Sumw2();
1640  fMCList[iCut]->Add(fHistoMCPi0InAccPtGammaLeg[iCut]);
1641  fHistoMCPi0WOWeightInAccPtGammaLeg[iCut] = new TH2F("MC_Pi0WOWeightInAcc_PtGamma_Leg","MC_Pi0WOWeightInAcc_PtGamma_Leg",nBinsPt, minPt, maxPt, 3, -0.5, 2.5);
1642  fMCList[iCut]->Add(fHistoMCPi0WOWeightInAccPtGammaLeg[iCut]);
1643 
1644  fHistoMCSecPi0PtGamma1vsSource[iCut] = new TH2F("MC_SecPi0_PtGamma1_Source","MC_SecPi0_PtGamma1_Source",nBinsPt, minPt, maxPt,16,-0.5,15.5);
1645  fMCList[iCut]->Add(fHistoMCSecPi0PtGamma1vsSource[iCut]);
1646  fHistoMCSecPi0PtGamma2vsSource[iCut] = new TH2F("MC_SecPi0_PtGamma2_Source","MC_SecPi0_PtGamma2_Source",nBinsPt, minPt, maxPt,16,-0.5,15.5);
1647  fMCList[iCut]->Add(fHistoMCSecPi0PtGamma2vsSource[iCut]);
1648  fHistoMCSecPi0InAccPtGamma1vsSource[iCut] = new TH2F("MC_SecPi0InAcc_PtGamma1_Source","MC_SecPi0InAcc_PtGamma1_Source",nBinsPt, minPt, maxPt,16,-0.5,15.5);
1649  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtGamma1vsSource[iCut]);
1650  fHistoMCSecPi0InAccPtGamma2vsSource[iCut] = new TH2F("MC_SecPi0InAcc_PtGamma2_Source","MC_SecPi0InAcc_PtGamma2_Source",nBinsPt, minPt, maxPt,16,-0.5,15.5);
1651  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtGamma2vsSource[iCut]);
1652 
1653  if (fIsMC > 1){
1654  fHistoMCPi0WOWeightPtGammaLeg[iCut]->Sumw2();
1655  fHistoMCPi0WOWeightInAccPtGammaLeg[iCut]->Sumw2();
1656  fHistoMCSecPi0PtGamma1vsSource[iCut]->Sumw2();
1657  fHistoMCSecPi0PtGamma2vsSource[iCut]->Sumw2();
1658  fHistoMCSecPi0InAccPtGamma1vsSource[iCut]->Sumw2();
1659  fHistoMCSecPi0InAccPtGamma2vsSource[iCut]->Sumw2();
1660  }
1661  }
1662 
1663  // book additional MC QA histograms
1664  if (fDoMesonQA > 0){
1665  fHistoMCPi0PtY[iCut] = new TH2F("MC_Pi0_Pt_Y","MC_Pi0_Pt_Y",nBinsQAPt, minQAPt, maxQAPt,150,-1.5,1.5);
1666  fHistoMCPi0PtY[iCut]->Sumw2();
1668  fMCList[iCut]->Add(fHistoMCPi0PtY[iCut]);
1669  fHistoMCEtaPtY[iCut] = new TH2F("MC_Eta_Pt_Y","MC_Eta_Pt_Y",nBinsQAPt, minQAPt, maxQAPt,150,-1.5,1.5);
1670  fHistoMCEtaPtY[iCut]->Sumw2();
1672  fMCList[iCut]->Add(fHistoMCEtaPtY[iCut]);
1673  fHistoMCPi0PtAlpha[iCut] = new TH2F("MC_Pi0_Pt_Alpha","MC_Pi0_Pt_Alpha",nBinsQAPt, minQAPt, maxQAPt,200,-1,1);
1675  fMCList[iCut]->Add(fHistoMCPi0PtAlpha[iCut]);
1676  fHistoMCEtaPtAlpha[iCut] = new TH2F("MC_Eta_Pt_Alpha","MC_Eta_Pt_Alpha",nBinsQAPt, minQAPt, maxQAPt,200,-1,1);
1678  fMCList[iCut]->Add(fHistoMCEtaPtAlpha[iCut]);
1679 
1680  if (fIsMC == 2){
1681  fHistoMCPi0PtAlpha[iCut]->Sumw2();
1682  fHistoMCEtaPtAlpha[iCut]->Sumw2();
1683  }
1684  }
1685  }
1686 
1687  fTrueList[iCut] = new TList();
1688  fTrueList[iCut]->SetName(Form("%s_%s_%s_%s True histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1689  fTrueList[iCut]->SetOwner(kTRUE);
1690  fCutFolder[iCut]->Add(fTrueList[iCut]);
1691 
1692  if(!fDoLightOutput){
1693  fHistoTrueConvGammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt","ESD_TrueConvGamma_Pt",nBinsPt, minPt, maxPt);
1694  fTrueList[iCut]->Add(fHistoTrueConvGammaPt[iCut]);
1695 
1696  fHistoDoubleCountTrueConvGammaRPt[iCut] = new TH2F("ESD_TrueDoubleCountConvGamma_R_Pt","ESD_TrueDoubleCountConvGamma_R_Pt",800,0,200,nBinsPt, minPt, maxPt);
1697  fTrueList[iCut]->Add(fHistoDoubleCountTrueConvGammaRPt[iCut]);
1698  fHistoMultipleCountTrueConvGamma[iCut] = new TH1F("ESD_TrueMultipleCountConvGamma","ESD_TrueMultipleCountConvGamma",10,1,11);
1699  fTrueList[iCut]->Add(fHistoMultipleCountTrueConvGamma[iCut]);
1700 
1701  fHistoCombinatorialPt[iCut] = new TH2F("ESD_TrueCombinatorial_Pt","ESD_TrueCombinatorial_Pt",nBinsPt, minPt, maxPt,16,-0.5,15.5);
1702  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec+Elec");
1703  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 2,"Elec+Pion");
1704  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 3,"Elec+Kaon");
1705  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 4,"Elec+Proton");
1706  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 5,"Elec+Muon");
1707  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 6,"Pion+Pion");
1708  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 7,"Pion+Kaon");
1709  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 8,"Pion+Proton");
1710  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 9,"Pion+Muon");
1711  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(10,"Kaon+Kaon");
1712  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(11,"Kaon+Proton");
1713  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(12,"Kaon+Muon");
1714  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(13,"Proton+Proton");
1715  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(14,"Proton+Muon");
1716  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(15,"Muon+Muon");
1717  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(16,"Rest");
1718  fTrueList[iCut]->Add(fHistoCombinatorialPt[iCut]);
1719 
1720  fHistoTruePrimaryConvGammaPt[iCut] = new TH1F("ESD_TruePrimaryConvGamma_Pt","ESD_TruePrimaryConvGamma_Pt",nBinsPt, minPt, maxPt);
1721  fTrueList[iCut]->Add(fHistoTruePrimaryConvGammaPt[iCut]);
1722  fHistoTrueSecondaryConvGammaPt[iCut] = new TH2F("ESD_TrueSecondaryConvGamma_Pt","ESD_TrueSecondaryConvGamma_Pt",nBinsPt, minPt, maxPt,4,-0.5,3.5);
1723  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1724  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1725  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1726  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1727  fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaPt[iCut]);
1728  fHistoTrueSecondaryConvGammaMCPt[iCut] = new TH2F("ESD_TrueSecondaryConvGamma_MCPt","ESD_TrueSecondaryConvGamma_MCPt",nBinsPt, minPt, maxPt,4,-0.5,3.5);
1729  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1730  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1731  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1732  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1733  fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaMCPt[iCut]);
1734 
1735  fHistoTruePrimaryConvGammaESDPtMCPt[iCut] = new TH2F("ESD_TruePrimaryConvGammaESD_PtMCPt", "ESD_TruePrimaryConvGammaESD_PtMCPt",nBinsPt, minPt, maxPt,nBinsPt, minPt, maxPt);
1737 
1738  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryConvGammaFromXFromK0sESD_MCPtPt","ESD_TrueSecondaryConvGammaFromXFromK0sESD_MCPtPt",nBinsPt, minPt, maxPt,nBinsPt, minPt, maxPt);
1740  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryConvGammaFromXFromK0lESD_MCPtPt","ESD_TrueSecondaryConvGammaFromXFromK0lESD_MCPtPt",nBinsPt, minPt, maxPt,nBinsPt, minPt, maxPt);
1742  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryConvGammaFromXFromLambdaESD_MCPtPt","ESD_TrueSecondaryConvGammaFromXFromLambdaESD_MCPtPt",nBinsPt, minPt, maxPt,nBinsPt, minPt, maxPt);
1744  }
1745 
1746  fHistoTrueClusGammaPt[iCut] = new TH1F("TrueClusGamma_Pt","ESD_TrueClusGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1747  fClusterOutputList[iCut]->Add(fHistoTrueClusGammaPt[iCut]);
1748  if(!fDoLightOutput){
1749  fHistoTruePrimaryClusGammaPt[iCut] = new TH1F("TruePrimaryClusGamma_Pt","ESD_TruePrimaryClusGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1751  fHistoTruePrimaryClusGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusGamma_Pt_MCPt","ESD_TruePrimaryClusGamma_Pt_MCPt",nBinsClusterPt, minClusterPt, maxClusterPt, nBinsClusterPt, minClusterPt, maxClusterPt);
1753  fHistoTrueClusElectronPt[iCut] = new TH1F("TrueClusElectron_Pt","TrueElectronGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1754  fClusterOutputList[iCut]->Add(fHistoTrueClusElectronPt[iCut]);
1755  fHistoTrueClusConvGammaPt[iCut] = new TH1F("TrueClusConvGamma_Pt","TrueClusConvGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1757  fHistoTruePrimaryClusConvGammaPt[iCut] = new TH1F("TruePrimaryClusConvGamma_Pt","ESD_TruePrimaryClusConvGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1759  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusConvGamma_Pt_MCPt","ESD_TruePrimaryClusConvGamma_Pt_MCPt",nBinsClusterPt, minClusterPt, maxClusterPt, nBinsClusterPt, minClusterPt, maxClusterPt);
1761 
1762  fHistoTrueSecondaryClusGammaPt[iCut] = new TH1F("TrueSecondaryClusGamma_Pt","ESD_TrueSecondaryClusGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1764  fHistoTrueSecondaryClusGammaFromK0sPt[iCut] = new TH1F("TrueSecondaryClusGammaFromK0s_Pt","ESD_TrueSecondaryClusGammaFromK0s_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1766  fHistoTrueSecondaryClusGammaFromK0lPt[iCut] = new TH1F("TrueSecondaryClusGammaFromK0l_Pt","ESD_TrueSecondaryClusGammaFromK0l_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1768  fHistoTrueSecondaryClusGammaFromLambdaPt[iCut] = new TH1F("TrueSecondaryClusGammaFromLambda_Pt","ESD_TrueSecondaryClusGammaFromLambda_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1770  }
1771 
1772  fHistoDoubleCountTrueClusterGammaPt[iCut] = new TH2F("TrueDoubleCountClusterGamma_Pt","TrueDoubleCountClusterGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt,2,0,2);
1774  fHistoMultipleCountTrueClusterGamma[iCut] = new TH1F("TrueMultipleCountClusterGamma","TrueMultipleCountClusterGamma",10,1,11);
1776  if(!fDoLightOutput) {
1777  fHistoTrueNLabelsInClusPt[iCut] = new TH2F("TrueNLabelsInClus_Pt","TrueNLabelsInClus_Pt",100,-0.5,99.5,nBinsClusterPt, minClusterPt, maxClusterPt);
1779  fHistoTrueClusGammaEM02[iCut] = new TH2F("TrueClusGammaEM02","TrueClusGammaEM02",nBinsClusterPt, minClusterPt, maxClusterPt,400,0,5);
1780  fClusterOutputList[iCut]->Add(fHistoTrueClusGammaEM02[iCut]);
1781  fHistoTrueClusPi0EM02[iCut] = new TH2F("TrueClusPi0EM02","TrueClusPi0EM02",nBinsClusterPt, minClusterPt, maxClusterPt,400,0,5);
1782  fClusterOutputList[iCut]->Add(fHistoTrueClusPi0EM02[iCut]);
1783  fHistoTrueClusEMNonLeadingPt[iCut] = new TH1F("TrueClusEMNonLeading_Pt","TrueClusEMNonLeading_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1785  }
1786 
1787 
1788  if (fIsMC > 1){
1789  if(!fDoLightOutput){
1790  fHistoTrueConvGammaPt[iCut]->Sumw2();
1791  fHistoDoubleCountTrueConvGammaRPt[iCut]->Sumw2();
1792  fHistoMultipleCountTrueConvGamma[iCut]->Sumw2();
1793  fHistoCombinatorialPt[iCut]->Sumw2();
1794  fHistoTruePrimaryConvGammaPt[iCut]->Sumw2();
1795  fHistoTrueSecondaryConvGammaPt[iCut]->Sumw2();
1796  fHistoTrueSecondaryConvGammaMCPt[iCut]->Sumw2();
1797  fHistoTruePrimaryConvGammaESDPtMCPt[iCut]->Sumw2();
1801  }
1802  fHistoTrueClusGammaPt[iCut]->Sumw2();
1803  fHistoDoubleCountTrueClusterGammaPt[iCut]->Sumw2();
1804  fHistoMultipleCountTrueClusterGamma[iCut]->Sumw2();
1805  if(!fDoLightOutput) {
1806  fHistoTruePrimaryClusGammaPt[iCut]->Sumw2();
1807  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->Sumw2();
1808  fHistoTrueNLabelsInClusPt[iCut]->Sumw2();
1809  fHistoTrueClusGammaEM02[iCut]->Sumw2();
1810  fHistoTrueClusPi0EM02[iCut]->Sumw2();
1811  fHistoTrueClusElectronPt[iCut]->Sumw2();
1812  fHistoTrueClusConvGammaPt[iCut]->Sumw2();
1813  fHistoTruePrimaryClusConvGammaPt[iCut]->Sumw2();
1815  fHistoTrueClusEMNonLeadingPt[iCut]->Sumw2();
1816  fHistoTrueSecondaryClusGammaPt[iCut]->Sumw2();
1820  }
1821  }
1822 
1823  if (fDoPhotonQA > 0){
1824  fHistoTrueConvGammaEta[iCut] = new TH1F("ESD_TrueConvGamma_Eta","ESD_TrueConvGamma_Eta",2000,-2,2);
1825  fTrueList[iCut]->Add(fHistoTrueConvGammaEta[iCut]);
1826  }
1827 
1828 // fHistoTruePi0NonLinearity[iCut] = new TH2F("TruePi0: E_truth / E_rec Vs E_rec","TruePi0: E_truth / E_rec Vs E_rec",700,0,35,200,0,2);
1829 // fClusterOutputList[iCut]->Add(fHistoTruePi0NonLinearity[iCut]);
1830 // fHistoTrueEtaNonLinearity[iCut] = new TH2F("TrueEta: E_truth / E_rec Vs E_rec","TrueEta: E_truth / E_rec Vs E_rec",700,0,35,200,0,2);
1831 // fClusterOutputList[iCut]->Add(fHistoTrueEtaNonLinearity[iCut]);
1832 
1833  if(!fDoLightOutput){
1834  fHistoTruePi0InvMassECalib[iCut] = new TH2F("True_Pi0_InvMass_E_Calib","True_Pi0_InvMass_E_Calib",800,0,0.8,nBinsPt, minPt, maxPt);
1835  fHistoTruePi0InvMassECalib[iCut]->SetXTitle("M_{inv}(GeV/c^{2})");
1836  fHistoTruePi0InvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
1837  fESDList[iCut]->Add(fHistoTruePi0InvMassECalib[iCut]);
1838  fHistoTruePi0PureGammaInvMassECalib[iCut] = new TH2F("True_Pi0PureGamma_InvMass_E_Calib","True_Pi0PureGamma_InvMass_E_Calib",800,0,0.8,nBinsPt, minPt, maxPt);
1839  fHistoTruePi0PureGammaInvMassECalib[iCut]->SetXTitle("M_{inv}(GeV/c^{2})");
1840  fHistoTruePi0PureGammaInvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
1842  }
1843 
1844  if (fDoClusterQA > 0){
1845  fHistoTrueClusConvGammaFullyPt[iCut] = new TH1F("TrueClusConvGammaFullyContained_Pt","TrueClusConvGammaFullyContained_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1847  fHistoTrueClusMergedGammaPt[iCut] = new TH1F("TrueClusMergedGamma_Pt","TrueClusMergedGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1849  fHistoTrueClusMergedPartConvGammaPt[iCut] = new TH1F("TrueClusMergedPartConvGamma_Pt","TrueClusMergedPartConvGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1851  fHistoTrueClusDalitzPt[iCut] = new TH1F("TrueClusDalitz_Pt","TrueClusDalitz_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1852  fClusterOutputList[iCut]->Add(fHistoTrueClusDalitzPt[iCut]);
1853  fHistoTrueClusDalitzMergedPt[iCut] = new TH1F("TrueClusDalitzMerged_Pt","TrueClusDalitzMerged_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1855  fHistoTrueClusPhotonFromElecMotherPt[iCut] = new TH1F("TrueClusPhotonFromElecMother_Pt","TrueClusPhotonFromElecMother_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1857  fHistoTrueClusShowerPt[iCut] = new TH1F("TrueClusShower_Pt","TrueClusShower_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1858  fClusterOutputList[iCut]->Add(fHistoTrueClusShowerPt[iCut]);
1859  fHistoTrueClusSubLeadingPt[iCut] = new TH1F("TrueClusSubleading_Pt","TrueClusSubleading_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1861  fHistoTrueClusNMothers[iCut] = new TH1F("TrueClusNParticles","TrueClusNParticles",20,0,20);
1862  fClusterOutputList[iCut]->Add(fHistoTrueClusNMothers[iCut]);
1863  if (fIsMC > 1){
1864  fHistoTrueClusConvGammaFullyPt[iCut]->Sumw2();
1865  fHistoTrueClusMergedGammaPt[iCut]->Sumw2();
1866  fHistoTrueClusMergedPartConvGammaPt[iCut]->Sumw2();
1867  fHistoTrueClusDalitzPt[iCut]->Sumw2();
1868  fHistoTrueClusDalitzMergedPt[iCut]->Sumw2();
1869  fHistoTrueClusPhotonFromElecMotherPt[iCut]->Sumw2();
1870  fHistoTrueClusShowerPt[iCut]->Sumw2();
1871  fHistoTrueClusSubLeadingPt[iCut]->Sumw2();
1872  fHistoTrueClusNMothers[iCut]->Sumw2();
1873  }
1874  }
1875 
1876  if(fDoMesonAnalysis){
1877  fHistoTruePi0InvMassPt[iCut] = new TH2F("ESD_TruePi0_InvMass_Pt","ESD_TruePi0_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1878  fHistoTruePi0InvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1879  fHistoTruePi0InvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1880  fTrueList[iCut]->Add(fHistoTruePi0InvMassPt[iCut]);
1881  fHistoTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueEta_InvMass_Pt","ESD_TrueEta_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1882  fHistoTrueEtaInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2})");
1883  fHistoTrueEtaInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
1884  fTrueList[iCut]->Add(fHistoTrueEtaInvMassPt[iCut]);
1885  fHistoTruePi0MatchedInvMassPt[iCut] = new TH2F("ESD_TruePi0_Matched_InvMass_Pt","ESD_TruePi0_Matched_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1886  fHistoTruePi0MatchedInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1887  fHistoTruePi0MatchedInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1888  fTrueList[iCut]->Add(fHistoTruePi0MatchedInvMassPt[iCut]);
1889  fHistoTrueEtaMatchedInvMassPt[iCut] = new TH2F("ESD_TrueEta_Matched_InvMass_Pt","ESD_TrueEta_Matched_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1890  fHistoTrueEtaMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2})");
1891  fHistoTrueEtaMatchedInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
1892  fTrueList[iCut]->Add(fHistoTrueEtaMatchedInvMassPt[iCut]);
1893 
1894  fHistoDoubleCountTruePi0InvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountPi0_InvMass_Pt","ESD_TrueDoubleCountPi0_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1895  fTrueList[iCut]->Add(fHistoDoubleCountTruePi0InvMassPt[iCut]);
1896  fHistoMultipleCountTruePi0[iCut] = new TH1F("ESD_TrueMultipleCountPi0","ESD_TrueMultipleCountPi0",10,1,11);
1897  fTrueList[iCut]->Add(fHistoMultipleCountTruePi0[iCut]);
1898  fHistoDoubleCountTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountEta_InvMass_Pt","ESD_TrueDoubleCountEta_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1899  fTrueList[iCut]->Add(fHistoDoubleCountTrueEtaInvMassPt[iCut]);
1900  fHistoMultipleCountTrueEta[iCut] = new TH1F("ESD_TrueMultipleCountEta","ESD_TrueMultipleCountEta",10,1,11);
1901  fTrueList[iCut]->Add(fHistoMultipleCountTrueEta[iCut]);
1902 
1903  fHistoTruePrimaryPi0InvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_Pt", "ESD_TruePrimaryPi0_InvMass_Pt", 800,0,0.8,nBinsPt, minPt, maxPt);
1904  fHistoTruePrimaryPi0InvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}}(GeV/c^{2})");
1905  fHistoTruePrimaryPi0InvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1906  fHistoTruePrimaryPi0InvMassPt[iCut]->Sumw2();
1907  fTrueList[iCut]->Add(fHistoTruePrimaryPi0InvMassPt[iCut]);
1908 
1909  fHistoTruePrimaryEtaInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEta_InvMass_Pt", "ESD_TruePrimaryEta_InvMass_Pt", 800,0,0.8,nBinsPt, minPt, maxPt);
1910  fHistoTruePrimaryEtaInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta}(GeV/c^{2})");
1911  fHistoTruePrimaryEtaInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
1912  fHistoTruePrimaryEtaInvMassPt[iCut]->Sumw2();
1913  fTrueList[iCut]->Add(fHistoTruePrimaryEtaInvMassPt[iCut]);
1914 
1915  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt", "ESD_TruePrimaryPi0W0Weights_InvMass_Pt", 800,0,0.8,nBinsPt, minPt, maxPt);
1916  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}}(GeV/c^{2})");
1917  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1919 
1920  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEtaW0Weights_InvMass_Pt", "ESD_TruePrimaryEtaW0Weights_InvMass_Pt", 800,0,0.8,nBinsPt, minPt, maxPt);
1921  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta}(GeV/c^{2})");
1922  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
1924 
1925  fProfileTruePrimaryPi0WeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryPi0Weights_InvMass_Pt", "ESD_TruePrimaryPi0Weights_InvMass_Pt", 800,0,0.8,nBinsPt, minPt, maxPt);
1926  fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}}(GeV/c^{2})");
1927  fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1930  fProfileTruePrimaryEtaWeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryEtaWeights_InvMass_Pt", "ESD_TruePrimaryEtaWeights_InvMass_Pt", 800,0,0.8,nBinsPt, minPt, maxPt);
1931  fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta}(GeV/c^{2})");
1932  fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
1935 
1936  fHistoTrueSecondaryPi0InvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_Pt", "ESD_TrueSecondaryPi0_InvMass_Pt", 800,0,0.8,nBinsPt, minPt, maxPt);
1937  fHistoTrueSecondaryPi0InvMassPt[iCut]->SetXTitle("M_{inv,sec #pi^{0}}(GeV/c^{2})");
1938  fHistoTrueSecondaryPi0InvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1939  fHistoTrueSecondaryPi0InvMassPt[iCut]->Sumw2();
1940  fTrueList[iCut]->Add(fHistoTrueSecondaryPi0InvMassPt[iCut]);
1941 
1942  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_Pt","ESD_TrueSecondaryPi0FromK0s_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1943  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from K^{0}_{S}}(GeV/c^{2})");
1944  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1947  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0l_InvMass_Pt","ESD_TrueSecondaryPi0FromK0l_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1948  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from K^{0}_{L}}(GeV/c^{2})");
1949  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1952  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromEta_InvMass_Pt","ESD_TrueSecondaryPi0FromEta_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1953  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from #eta}(GeV/c^{2})");
1954  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1956  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_Pt","ESD_TrueSecondaryPi0FromLambda_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1957  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from #Lambda}(GeV/c^{2})");
1958  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1960 
1961  if(!fDoLightOutput) {
1962  fHistoTruePrimaryPi0PhotonPairPtconv[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_PtConv","",400,0,0.4,nBinsPt, minPt, maxPt);
1963  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1964  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv}p_{T}(GeV/c)");
1965  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->Sumw2();
1967 
1968  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt","",400,0,0.4,nBinsPt, minPt, maxPt);
1969  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1970  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv}p_{T}(GeV/c)");
1972 
1973  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_PtConv","",400,0,0.4,nBinsPt, minPt, maxPt);
1974  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1975  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv}p_{T}(GeV/c)");
1978 
1979  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_PtConv","",400,0,0.4,nBinsPt, minPt, maxPt);
1980  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1981  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv}p_{T}(GeV/c)");
1984 
1985  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0l_InvMass_PtConv","",400,0,0.4,nBinsPt, minPt, maxPt);
1986  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1987  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv}p_{T}(GeV/c)");
1990 
1991  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv[iCut]= new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_PtConv","",400,0,0.4,nBinsPt, minPt, maxPt);
1992  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1993  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv}p_{T}(GeV/c)");
1996 
1997  fHistoTruePrimaryPi0DCPtconv[iCut] = new TH1F("ESD_TruePrimaryPi0DC_PtConv","",nBinsPt, minPt, maxPt);
1998  fHistoTruePrimaryPi0DCPtconv[iCut]->SetXTitle("#gamma^{conv}p_{T}(GeV/c)");
1999  fHistoTruePrimaryPi0DCPtconv[iCut]->Sumw2();
2000  fTrueList[iCut]->Add(fHistoTruePrimaryPi0DCPtconv[iCut]);
2001 
2002  fHistoTrueSecondaryPi0DCPtconvSource[iCut] = new TH2F("ESD_TrueSecondaryPi0DC_PtConv_Source","",nBinsPt, minPt, maxPt, 4, -0.5,3.5);
2003  fHistoTrueSecondaryPi0DCPtconvSource[iCut]->SetXTitle("#gamma^{conv}p_{T}(GeV/c)");
2004  fHistoTrueSecondaryPi0DCPtconvSource[iCut]->SetYTitle("sec. source");
2005  fHistoTrueSecondaryPi0DCPtconvSource[iCut]->Sumw2();
2007 
2008  fHistoTruePrimaryPi0MissingPtconv[iCut] = new TH1F("ESD_TruePrimaryPi0Missing_PtConv","",nBinsPt, minPt, maxPt);
2009  fHistoTruePrimaryPi0MissingPtconv[iCut]->SetXTitle("#gamma^{conv}p_{T}(GeV/c)");
2010  fHistoTruePrimaryPi0MissingPtconv[iCut]->Sumw2();
2011  fTrueList[iCut]->Add(fHistoTruePrimaryPi0MissingPtconv[iCut]);
2012 
2013  fHistoTrueSecondaryPi0MissingPtconvSource[iCut] = new TH2F("ESD_TrueSecondaryPi0Missing_PtConv_Source","",nBinsPt, minPt, maxPt, 4, -0.5,3.5);
2014  fHistoTrueSecondaryPi0MissingPtconvSource[iCut]->SetXTitle("#gamma^{conv}p_{T}(GeV/c)");
2015  fHistoTrueSecondaryPi0MissingPtconvSource[iCut]->SetYTitle("sec. source");
2018 
2019  // put proper summing for JJ weights
2020  if (fIsMC > 1){
2022  }
2023  }
2024 
2025  if (fIsMC > 1){
2026  fHistoTruePi0InvMassPt[iCut]->Sumw2();
2027  fHistoTrueEtaInvMassPt[iCut]->Sumw2();
2028  fHistoTruePi0MatchedInvMassPt[iCut]->Sumw2();
2029  fHistoTrueEtaMatchedInvMassPt[iCut]->Sumw2();
2030  fHistoDoubleCountTruePi0InvMassPt[iCut]->Sumw2();
2031  fHistoMultipleCountTruePi0[iCut]->Sumw2();
2032  fHistoDoubleCountTrueEtaInvMassPt[iCut]->Sumw2();
2033  fHistoMultipleCountTrueEta[iCut]->Sumw2();
2038  }
2039 
2040  if (fDoMesonQA > 0){
2041  if (fIsMC < 2){
2042  fHistoTruePi0CaloPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloPhoton_InvMass_Pt","ESD_TruePi0CaloPhoton_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2043  fHistoTruePi0CaloPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma #gamma");
2044  fHistoTruePi0CaloPhotonInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2045  fTrueList[iCut]->Add(fHistoTruePi0CaloPhotonInvMassPt[iCut]);
2046 
2047  fHistoTrueEtaCaloPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloPhoton_InvMass_Pt","ESD_TrueEtaCaloPhoton_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2048  fHistoTrueEtaCaloPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma #gamma");
2049  fHistoTrueEtaCaloPhotonInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2050  fTrueList[iCut]->Add(fHistoTrueEtaCaloPhotonInvMassPt[iCut]);
2051 
2052  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhoton_InvMass_Pt","ESD_TruePi0CaloConvertedPhoton_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2053  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma #gamma_{conv}");
2054  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2056 
2057  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt","ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2058  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma #gamma_{conv,matched}");
2059  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2061 
2062  fHistoTruePi0CaloConvPhotonConvRPt[iCut] = new TH2F("ESD_TruePi0CaloConvPhoton_ConvR_PtE","ESD_TruePi0CaloConvPhoton_ConvR_PtE",920,0,460,nBinsPt, minPt, maxPt);
2063  fHistoTruePi0CaloConvPhotonConvRPt[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2064  fHistoTruePi0CaloConvPhotonConvRPt[iCut]->SetYTitle("e^{#pm}p_{T}(GeV/c)");
2066 
2067  fHistoTruePi0CaloConvPhotonConvRAlpha[iCut] = new TH2F("ESD_TruePi0CaloConvPhoton_ConvR_AlphaE","ESD_TruePi0CaloConvPhoton_ConvR_AlphaE",920,0,460,200,-1,1);
2068  fHistoTruePi0CaloConvPhotonConvRAlpha[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2069  fHistoTruePi0CaloConvPhotonConvRAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2071 
2072  fHistoTruePi0CaloConvPhotonPtAlpha[iCut] = new TH2F("ESD_TruePi0CaloConvPhoton_PtE_AlphaE","ESD_TruePi0CaloConvPhoton_PtE_AlphaE",nBinsPt, minPt, maxPt,200,-1,1);
2073  fHistoTruePi0CaloConvPhotonPtAlpha[iCut]->SetXTitle("e^{#pm}p_{T}(GeV/c)");
2074  fHistoTruePi0CaloConvPhotonPtAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2076 
2077  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt","ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2078  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma #gamma_{conv}");
2079  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2081 
2082  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt","ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2083  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma #gamma_{conv,matched}");
2084  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2086 
2087  fHistoTrueEtaCaloConvPhotonConvRPt[iCut] = new TH2F("ESD_TrueEtaCaloConvPhoton_ConvR_PtE","ESD_TrueEtaCaloConvPhoton_ConvR_PtE",920,0,460,nBinsPt, minPt, maxPt);
2088  fHistoTrueEtaCaloConvPhotonConvRPt[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2089  fHistoTrueEtaCaloConvPhotonConvRPt[iCut]->SetYTitle("e^{#pm}p_{T}(GeV/c)");
2091 
2092  fHistoTrueEtaCaloConvPhotonConvRAlpha[iCut] = new TH2F("ESD_TrueEtaCaloConvPhoton_ConvR_AlphaE","ESD_TrueEtaCaloConvPhoton_ConvR_AlphaE",920,0,460,200,-1,1);
2093  fHistoTrueEtaCaloConvPhotonConvRAlpha[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2094  fHistoTrueEtaCaloConvPhotonConvRAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2096 
2097  fHistoTrueEtaCaloConvPhotonPtAlpha[iCut] = new TH2F("ESD_TrueEtaCaloConvPhoton_PtE_AlphaE","ESD_TrueEtaCaloConvPhoton_PtE_AlphaE",nBinsPt, minPt, maxPt,200,-1,1);
2098  fHistoTrueEtaCaloConvPhotonPtAlpha[iCut]->SetXTitle("e^{#pm}p_{T}(GeV/c)");
2099  fHistoTrueEtaCaloConvPhotonPtAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2101 
2102 
2103  fHistoTruePi0CaloElectronInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloElectron_InvMass_Pt","ESD_TruePi0CaloElectron_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2104  fHistoTruePi0CaloElectronInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma e^{#pm}");
2105  fHistoTruePi0CaloElectronInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2107  fHistoTrueEtaCaloElectronInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloElectron_InvMass_Pt","ESD_TrueEtaCaloElectron_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2108  fHistoTrueEtaCaloElectronInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma e^{#pm}");
2109  fHistoTrueEtaCaloElectronInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2111 
2112  fHistoTruePi0CaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedCluster_InvMass_Pt","ESD_TruePi0CaloMergedCluster_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2113  fHistoTruePi0CaloMergedClusterInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma merged cluster");
2114  fHistoTruePi0CaloMergedClusterInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2116  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedCluster_InvMass_Pt","ESD_TrueEtaCaloMergedCluster_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2117  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma merged cluster");
2118  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2120 
2121  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloEMNonLeading_InvMass_Pt","ESD_TrueMotherCaloEMNonLeading_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2122  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2}) #gamma cluster no leading EM");
2123  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2125  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt","ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2126  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma merged cluster, part conv");
2127  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2129  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt","ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2130  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma merged cluster, part conv");
2131  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2133 
2134  fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt","ESD_TruePrimaryPi0_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
2135  fHistoTruePrimaryPi0MCPtResolPt[iCut]->SetXTitle("#pi^{0}p_{T,MC}(GeV/c)");
2136  fHistoTruePrimaryPi0MCPtResolPt[iCut]->SetYTitle("#pi^{0}(p_{T,rec}-p_{T,MC})/p_{T,MC}()");
2137  fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
2139  fTrueList[iCut]->Add(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
2140 
2141  fHistoTruePrimaryEtaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt","ESD_TruePrimaryEta_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
2142  fHistoTruePrimaryEtaMCPtResolPt[iCut]->SetXTitle("#eta p_{T,MC}(GeV/c)");
2143  fHistoTruePrimaryEtaMCPtResolPt[iCut]->SetYTitle("#eta (p_{T,rec}-p_{T,MC})/p_{T,MC}()");
2144  fHistoTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
2146  fTrueList[iCut]->Add(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
2147 
2148  fHistoTrueK0sWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0sWithPi0Daughter_MCPt","ESD_TrueK0sWithPi0Daughter_MCPt",nBinsPt, minPt, maxPt);
2149  fHistoTrueK0sWithPi0DaughterMCPt[iCut]->SetXTitle("K^{0}_{s}p_{MC,T}(GeV/c) for K^{0}_{s}where #pi^{0}rec ");
2150  fTrueList[iCut]->Add(fHistoTrueK0sWithPi0DaughterMCPt[iCut]);
2151  fHistoTrueK0lWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0lWithPi0Daughter_MCPt","ESD_TrueK0lWithPi0Daughter_MCPt",nBinsPt, minPt, maxPt);
2152  fHistoTrueK0lWithPi0DaughterMCPt[iCut]->SetXTitle("K^{0}_{s}p_{MC,T}(GeV/c) for K^{0}_{l}where #pi^{0}rec ");
2153  fTrueList[iCut]->Add(fHistoTrueK0lWithPi0DaughterMCPt[iCut]);
2154  fHistoTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt","ESD_TrueEtaWithPi0Daughter_MCPt",nBinsPt, minPt, maxPt);
2155  fHistoTrueEtaWithPi0DaughterMCPt[iCut]->SetXTitle("#eta p_{MC,T}(GeV/c) for #eta where #pi^{0}rec ");
2156  fTrueList[iCut]->Add(fHistoTrueEtaWithPi0DaughterMCPt[iCut]);
2157  fHistoTrueLambdaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueLambdaWithPi0Daughter_MCPt","ESD_TrueLambdaWithPi0Daughter_MCPt",nBinsPt, minPt, maxPt);
2158  fHistoTrueLambdaWithPi0DaughterMCPt[iCut]->SetXTitle("#Lambda p_{MC,T}(GeV/c) for #Lambda where #pi^{0}rec ");
2160  }
2161  if(fDoMesonQA>1){
2162  fHistoTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt","ESD_TrueBckGG_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2163  fHistoTrueBckGGInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2}) #gamma #gamma no signal");
2164  fHistoTrueBckGGInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2165  fTrueList[iCut]->Add(fHistoTrueBckGGInvMassPt[iCut]);
2166  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut] = new TH2F("ESD_TrueBckFullMesonContained_InvMass_Pt","ESD_TrueBckFullMesonContained_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2167  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2}) #gamma #gamma, calo gamma with full pi0");
2168  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2170  fHistoTrueBckAsymEClustersInvMassPt[iCut] = new TH2F("ESD_TrueBckAsymEClus_InvMass_Pt","ESD_TrueBckAsymEClus_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2171  fHistoTrueBckAsymEClustersInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2}) #gamma #gamma, calo gamma >70% of pi0 energy");
2172  fHistoTrueBckAsymEClustersInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2174  fHistoTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt","ESD_TrueBckCont_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2175  fHistoTrueBckContInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2}) contamination");
2176  fHistoTrueBckContInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2177  fTrueList[iCut]->Add(fHistoTrueBckContInvMassPt[iCut]);
2178  }
2179  fHistoTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y","ESD_TruePi0_Pt_Y",nBinsQAPt, minQAPt, maxQAPt,150,-1.5,1.5);
2180  fHistoTruePi0PtY[iCut]->SetYTitle("Y_{#pi^{0}}");
2181  fHistoTruePi0PtY[iCut]->SetXTitle("#pi^{0}p_{T}(GeV/c)");
2183  fTrueList[iCut]->Add(fHistoTruePi0PtY[iCut]);
2184  fHistoTrueEtaPtY[iCut] = new TH2F("ESD_TrueEta_Pt_Y","ESD_TrueEta_Pt_Y",nBinsQAPt, minQAPt, maxQAPt,150,-1.5,1.5);
2185  fHistoTrueEtaPtY[iCut]->SetYTitle("Y_{#eta}");
2186  fHistoTrueEtaPtY[iCut]->SetXTitle("#eta p_{T}(GeV/c)");
2188  fTrueList[iCut]->Add(fHistoTrueEtaPtY[iCut]);
2189  fHistoTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha","ESD_TruePi0_Pt_Alpha",nBinsQAPt, minQAPt, maxQAPt,200,-1,1);
2190  fHistoTruePi0PtAlpha[iCut]->SetYTitle("#alpha_{#pi^{0}}");
2191  fHistoTruePi0PtAlpha[iCut]->SetXTitle("#pi^{0}p_{T}(GeV/c)");
2193  fTrueList[iCut]->Add(fHistoTruePi0PtAlpha[iCut]);
2194  fHistoTrueEtaPtAlpha[iCut] = new TH2F("ESD_TrueEta_Pt_Alpha","ESD_TrueEta_Pt_Alpha",nBinsQAPt, minQAPt, maxQAPt,200,-1,1);
2195  fHistoTrueEtaPtAlpha[iCut]->SetYTitle("#alpha_{#eta}");
2196  fHistoTrueEtaPtAlpha[iCut]->SetXTitle("#eta p_{T}(GeV/c)");
2198  fTrueList[iCut]->Add(fHistoTrueEtaPtAlpha[iCut]);
2199 
2200  fHistoTruePi0PtOpenAngle[iCut] = new TH2F("ESD_TruePi0_Pt_OpenAngle","ESD_TruePi0_Pt_OpenAngle",nBinsQAPt, minQAPt, maxQAPt,100,0,1);
2201  fHistoTruePi0PtOpenAngle[iCut]->SetYTitle("#theta_{#pi^{0}}");
2202  fHistoTruePi0PtOpenAngle[iCut]->SetXTitle("#pi^{0}p_{T}(GeV/c)");
2204  fTrueList[iCut]->Add(fHistoTruePi0PtOpenAngle[iCut]);
2205  fHistoTrueEtaPtOpenAngle[iCut] = new TH2F("ESD_TrueEta_Pt_OpenAngle","ESD_TrueEta_Pt_OpenAngle",nBinsQAPt, minQAPt, maxQAPt,200,0,TMath::Pi());
2206  fHistoTrueEtaPtOpenAngle[iCut]->SetYTitle("#theta_{#eta}");
2207  fHistoTrueEtaPtOpenAngle[iCut]->SetXTitle("#eta p_{T}(GeV/c)");
2209  fTrueList[iCut]->Add(fHistoTrueEtaPtOpenAngle[iCut]);
2210 
2211  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut] = new TH2F("ESD_TrueMotherPi0ConvPhoton_Eta_Phi","conv photons for true #pi^{0}",600,0,2*TMath::Pi(),200,-1,1);
2212  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
2213  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
2215  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut] = new TH2F("ESD_TrueMotherEtaConvPhoton_Eta_Phi","conv photons for true #eta",600,0,2*TMath::Pi(),200,-1,1);
2216  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
2217  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
2219 
2220  if (fIsMC > 1){
2221  if(fDoMesonQA>1){
2222  fHistoTrueBckGGInvMassPt[iCut]->Sumw2();
2224  fHistoTrueBckAsymEClustersInvMassPt[iCut]->Sumw2();
2225  fHistoTrueBckContInvMassPt[iCut]->Sumw2();
2226  }
2227  fHistoTruePi0PtY[iCut]->Sumw2();
2228  fHistoTrueEtaPtY[iCut]->Sumw2();
2229  fHistoTruePi0PtAlpha[iCut]->Sumw2();
2230  fHistoTrueEtaPtAlpha[iCut]->Sumw2();
2231  fHistoTruePi0PtOpenAngle[iCut]->Sumw2();
2232  fHistoTrueEtaPtOpenAngle[iCut]->Sumw2();
2233  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->Sumw2();
2234  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->Sumw2();
2235  }
2236  }
2237  }
2238  }
2239  }
2240 
2245 
2246  fMapMultipleCountTruePi0s.clear();
2247  fMapMultipleCountTrueEtas.clear();
2250 
2251  fVectorRecTruePi0s.clear();
2252  fVectorRecTrueEtas.clear();
2253 
2254  if(fV0Reader)
2256  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
2257  fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
2258  if(fV0Reader)
2260  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
2261  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
2262 
2266 
2267  for(Int_t iMatcherTask = 0; iMatcherTask < 3; iMatcherTask++){
2268  AliCaloTrackMatcher* temp = (AliCaloTrackMatcher*) (AliAnalysisManager::GetAnalysisManager()->GetTask(Form("CaloTrackMatcher_%i",iMatcherTask)));
2269  if(temp) fOutputContainer->Add(temp->GetCaloTrackMatcherHistograms());
2270  }
2271 
2272 
2273 
2274  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2275  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
2276  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
2277  fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
2278  }
2279  if(!((AliConversionPhotonCuts*)fCutArray->At(iCut))) continue;
2280  if(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms()){
2281  fCutFolder[iCut]->Add(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms());
2282  }
2283  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
2284  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
2285  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
2286  }
2287  if(fSetPlotHistsExtQA){
2288  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
2289  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms()){
2290  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms());
2291  }
2292  }
2293  if(fDoMesonAnalysis){
2294  if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
2295  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
2296  fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
2297  }
2298  }
2299  }
2300 
2301  if (fIsMC > 0){
2302  tBrokenFiles = new TTree("BrokenFiles","BrokenFiles");
2303  tBrokenFiles->Branch("fileName",&fFileNameBroken);
2305  }
2306 
2307 
2308  PostData(1, fOutputContainer);
2309 }
2310 //_____________________________________________________________________________
2312 {
2313  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2314  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
2315  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
2316  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
2317  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
2318  }
2319 
2320  if(fIsHeavyIon == 2){
2321  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
2322  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2323  continue; // No Eta Shift requested, continue
2324  }
2325  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
2326  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
2327  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2328  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
2329  continue;
2330  } else{
2331  printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
2332  (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
2333  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2334  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
2335  }
2336  }
2337  }
2338 
2339  return kTRUE;
2340 }
2341 //_____________________________________________________________________________
2343 {
2344  //
2345  // Called for each event
2346  //
2347  fInputEvent = InputEvent();
2348 
2349  if(fIsMC > 0) fMCEvent = MCEvent();
2350  if(fIsMC>0 && fInputEvent->IsA()==AliESDEvent::Class() && fMCEvent){
2351  fMCStack = fMCEvent->Stack();
2352  }
2353 
2354  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
2355  if(fInputEvent->IsIncompleteDAQ()==kTRUE) eventQuality = 2;// incomplete event
2356  // Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1 or because it is incomplete => abort processing of this event/file
2357  if(eventQuality == 2 || eventQuality == 3){
2358  // write out name of broken file for first event
2359  if (fIsMC > 0){
2360  if (fInputEvent->IsA()==AliESDEvent::Class()){
2361  if (((AliESDEvent*)fInputEvent)->GetEventNumberInFile() == 0){
2362  fFileNameBroken = new TObjString(Form("%s",((TString)fV0Reader->GetCurrentFileName()).Data()));
2363  if (tBrokenFiles) tBrokenFiles->Fill();
2364  delete fFileNameBroken;
2365  }
2366  }
2367  }
2368 
2369  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
2370  fHistoNEvents[iCut]->Fill(eventQuality);
2371  if (fIsMC > 1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
2372  }
2373  return;
2374  }
2375 
2376 
2377  if(fInputEvent->IsA()==AliAODEvent::Class()){
2378  fInputEvent->InitMagneticField();
2379  }
2380 
2381  fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
2382 
2383  // ------------------- BeginEvent ----------------------------
2384  AliEventplane *EventPlane = fInputEvent->GetEventplane();
2385  if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
2386  else fEventPlaneAngle=0.0;
2387 
2388  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
2389  RelabelAODPhotonCandidates(kTRUE);// In case of AODMC relabeling MC
2390  fV0Reader->RelabelAODs(kTRUE);
2391  }
2392 
2393  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
2394 
2395  fiCut = iCut;
2396 // cout << ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber() << "_" << ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber() <<
2397 // "_" << ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber() <<endl;
2398 
2399  Bool_t isRunningEMCALrelAna = kFALSE;
2400  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) isRunningEMCALrelAna = kTRUE;
2401 
2402  Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,isRunningEMCALrelAna);
2403 
2404  if(fIsMC==2){
2405  Float_t xsection = -1.;
2406  Float_t ntrials = -1.;
2407  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetXSectionAndNTrials(fMCEvent,xsection,ntrials);
2408  if((xsection==-1.) || (ntrials==-1.)) AliFatal(Form("ERROR: GetXSectionAndNTrials returned invalid xsection/ntrials, periodName from V0Reader: '%s'",fV0Reader->GetPeriodName().Data()));
2409  fProfileJetJetXSection[iCut]->Fill(0.,xsection);
2410  fHistoJetJetNTrials[iCut]->Fill("#sum{NTrials}",ntrials);
2411  }
2412 
2413  if(fIsMC>0){
2414  fWeightJetJetMC = 1;
2415  // cout << fMCEvent << endl;
2416  Bool_t isMCJet = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsJetJetMCEventAccepted( fMCEvent, fWeightJetJetMC );
2417  if (fIsMC == 3){
2418  Double_t weightMult = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetWeightForMultiplicity(fV0Reader->GetNumberOfPrimaryTracks());
2419  fWeightJetJetMC = fWeightJetJetMC*weightMult;
2420  }
2421  if(fIsMC==1) fWeightJetJetMC = 1;
2422  if (!isMCJet){
2423  fHistoNEvents[iCut]->Fill(10,fWeightJetJetMC);
2424  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(10);
2425  continue;
2426  }
2427  }
2428 
2429  Bool_t triggered = kTRUE;
2430 
2431  if(eventNotAccepted!= 0){
2432  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
2433  fHistoNEvents[iCut]->Fill(eventNotAccepted, fWeightJetJetMC); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
2434  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventNotAccepted);
2435  if (eventNotAccepted==3 && fIsMC > 0){
2436  triggered = kFALSE;
2437  }else {
2438  continue;
2439  }
2440  }
2441 
2442  if(eventQuality != 0){// Event Not Accepted
2443  //cout << "event rejected due to: " <<eventQuality << endl;
2444  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC);
2445  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
2446  continue;
2447  }
2448 
2449  if (triggered==kTRUE){
2450  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC); // Should be 0 here
2451  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality); // Should be 0 here
2452 
2454  fHistoVertexZ[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetZ(), fWeightJetJetMC);
2455  if(!fDoLightOutput){
2456  fHistoVertexX[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetX(), fWeightJetJetMC);
2457  fHistoVertexY[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetY(), fWeightJetJetMC);
2458  fHistoSPDClusterTrackletBackground[iCut]->Fill(fInputEvent->GetMultiplicity()->GetNumberOfTracklets(),(fInputEvent->GetNumberOfITSClusters(0)+fInputEvent->GetNumberOfITSClusters(1)),fWeightJetJetMC);
2459  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A(), fWeightJetJetMC);
2460  else fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C(), fWeightJetJetMC);
2461  }
2462  }
2463 
2464  if(fIsMC>0){
2465  // Process MC Particle
2466  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
2467  if(fInputEvent->IsA()==AliESDEvent::Class()){
2468  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
2469  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
2470  fMCEvent);
2471  }
2472  else if(fInputEvent->IsA()==AliAODEvent::Class()){
2473  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
2474  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
2475  fInputEvent);
2476  }
2477 
2478  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader()){
2479  for(Int_t i = 0;i<(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
2480  TString nameBin= fHistoMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
2481  if (nameBin.CompareTo("")== 0){
2482  TString nameHeader = ((TObjString*)((TList*)((AliConvEventCuts*)fEventCutArray->At(iCut))
2483  ->GetAcceptedHeader())->At(i))->GetString();
2484  fHistoMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
2485  }
2486  }
2487  }
2488  }
2489  }
2490  if(fIsMC>0){
2491  if(fInputEvent->IsA()==AliESDEvent::Class())
2493  if(fInputEvent->IsA()==AliAODEvent::Class())
2495  }
2496 
2497  if (triggered==kFALSE) continue;
2498 
2499  // 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)
2500  ProcessClusters();// process calo clusters
2501  ProcessPhotonCandidates(); // Process this cuts gammas
2502 
2503  fHistoNGammaCandidates[iCut]->Fill(fGammaCandidates->GetEntries(),fWeightJetJetMC);
2505  if(fDoMesonAnalysis){ // Meson Analysis
2506  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC>0){
2507  fUnsmearedPx = new Double_t[fGammaCandidates->GetEntries()]; // Store unsmeared Momenta
2508  fUnsmearedPy = new Double_t[fGammaCandidates->GetEntries()];
2509  fUnsmearedPz = new Double_t[fGammaCandidates->GetEntries()];
2510  fUnsmearedE = new Double_t[fGammaCandidates->GetEntries()];
2511 
2512  for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
2513  fUnsmearedPx[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Px();
2514  fUnsmearedPy[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Py();
2515  fUnsmearedPz[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Pz();
2516  fUnsmearedE[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->E();
2517  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->SmearParticle(dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(gamma)));
2518  }
2519  }
2520 
2521  CalculatePi0Candidates(); // Combine Gammas from conversion and from calo
2522 
2523  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
2524  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
2525  CalculateBackground(); // Combinatorial Background
2526  UpdateEventByEventData(); // Store Event for mixed Events
2527  }
2528  else{
2529  CalculateBackgroundRP(); // Combinatorial Background
2530  fBGHandlerRP[iCut]->AddEvent(fGammaCandidates,fInputEvent); // Store Event for mixed Events
2531  fBGClusHandlerRP[iCut]->AddEvent(fClusterCandidates,fInputEvent); // Store Event for mixed Events
2532  }
2533  }
2534 
2535  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class()){
2536  ProcessConversionPhotonsForMissingTagsAOD(); //Count missing tags
2537  }else if (fIsMC>0 && fInputEvent->IsA()==AliESDEvent::Class()){
2538  ProcessConversionPhotonsForMissingTags(); //Count missing tags
2539  }
2540 
2541  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC>0){
2542  for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
2543  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPx(fUnsmearedPx[gamma]); // Reset Unsmeared Momenta
2544  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPy(fUnsmearedPy[gamma]);
2545  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPz(fUnsmearedPz[gamma]);
2546  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetE(fUnsmearedE[gamma]);
2547  }
2548  delete[] fUnsmearedPx; fUnsmearedPx = 0x0;
2549  delete[] fUnsmearedPy; fUnsmearedPy = 0x0;
2550  delete[] fUnsmearedPz; fUnsmearedPz = 0x0;
2551  delete[] fUnsmearedE;fUnsmearedE = 0x0;
2552  }
2553 
2554  if(fIsMC>0){
2555  fVectorRecTruePi0s.clear();
2556  fVectorRecTrueEtas.clear();
2561  }
2562  }
2563 
2564  if(fIsMC>0){
2569  }
2570 
2572 
2573  fGammaCandidates->Clear(); // delete this cuts good gammas
2574  fClusterCandidates->Clear(); // delete cluster candidates
2575  }
2576 
2577  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
2578  RelabelAODPhotonCandidates(kFALSE); // Back to ESDMC Label
2579  fV0Reader->RelabelAODs(kFALSE);
2580  }
2581 
2582  PostData(1, fOutputContainer);
2583 }
2584 
2585 //________________________________________________________________________
2587 
2588  Int_t nclus = 0;
2589  nclus = fInputEvent->GetNumberOfCaloClusters();
2590 
2591 // cout << nclus << endl;
2592 
2593  if(nclus == 0) return;
2594 
2595  // plotting histograms on cell/tower level, only if extendedMatchAndQA > 1
2596  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FillHistogramsExtendedQA(fInputEvent,fIsMC);
2597 
2598  // match tracks to clusters
2599  if(fDoPrimaryTrackMatching) ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchTracksToClusters(fInputEvent,fWeightJetJetMC,kFALSE);
2600 
2601  // vertex
2602  Double_t vertex[3] = {0,0,0};
2603  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
2604 
2605  // Loop over EMCal clusters
2606  for(Int_t i = 0; i < nclus; i++){
2607  AliVCluster* clus = NULL;
2608  if(fInputEvent->IsA()==AliESDEvent::Class()) clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
2609  else if(fInputEvent->IsA()==AliAODEvent::Class()) clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
2610 
2611  if (!clus) continue;
2612  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fMCEvent,fIsMC,fWeightJetJetMC,i)){
2613  if(fDoInvMassShowerShapeTree && ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedBeforeTrackMatch() ) tESDmapIsClusterAcceptedWithoutTrackMatch[i] = 1;
2614  delete clus;
2615  continue;
2616  }
2617 
2618  // TLorentzvector with cluster
2619  TLorentzVector clusterVector;
2620  clus->GetMomentum(clusterVector,vertex);
2621 
2622  TLorentzVector* tmpvec = new TLorentzVector();
2623  tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
2624 
2625  // convert to AODConversionPhoton
2626  AliAODConversionPhoton *PhotonCandidate = new AliAODConversionPhoton(tmpvec);
2627  if(!PhotonCandidate){ delete clus; delete tmpvec; continue;}
2628 
2630 
2631  // Flag Photon as CaloPhoton
2632  PhotonCandidate->SetIsCaloPhoton();
2633  PhotonCandidate->SetCaloClusterRef((Long_t)i);
2634  // get MC label
2635  if(fIsMC>0){
2636  Int_t* mclabelsCluster = clus->GetLabels();
2637  PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
2638 // cout << clus->GetNLabels() << endl;
2639  if (clus->GetNLabels()>0){
2640  for (Int_t k =0; k<(Int_t)clus->GetNLabels(); k++){
2641  if (k<50)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
2642 // Int_t pdgCode = fMCStack->Particle(mclabelsCluster[k])->GetPdgCode();
2643 // cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
2644  }
2645  }
2646  }
2647 
2648  fIsFromMBHeader = kTRUE;
2650  //TString periodName = fV0Reader->GetPeriodName();
2651  // test whether largest contribution to cluster orginates in added signals
2652  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() > 0){
2653  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCStack, fInputEvent) == 0){
2654  fIsFromMBHeader = kFALSE;
2655  }
2656  if (clus->GetNLabels()>1){
2657  Int_t* mclabelsCluster = clus->GetLabels();
2658  for (Int_t l = 1; l < (Int_t)clus->GetNLabels(); l++ ){
2659  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(mclabelsCluster[l], fMCStack, fInputEvent) == 0){
2661  }
2662  }
2663  }
2664  }
2665 
2667  fHistoClusOverlapHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2668 
2670  fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2671  fHistoClusGammaE[fiCut]->Fill(PhotonCandidate->E(),fWeightJetJetMC);
2672  if(fIsMC>0){
2673  if(fInputEvent->IsA()==AliESDEvent::Class()){
2674  ProcessTrueClusterCandidates(PhotonCandidate,clus->GetM02());
2675  }else {
2676  ProcessTrueClusterCandidatesAOD(PhotonCandidate,clus->GetM02());
2677  }
2678  }
2679  fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
2680  }else{
2681  delete PhotonCandidate;
2682  }
2683 
2684  delete clus;
2685  delete tmpvec;
2686  }
2687 
2688 }
2689 
2690 //________________________________________________________________________
2692 {
2693 
2694  TParticle *Photon = NULL;
2695  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
2696  if (TruePhotonCandidate->GetCaloPhotonMCLabel(0) < 0) return;
2697  if(!fDoLightOutput) fHistoTrueNLabelsInClusPt[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
2698 
2699  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = fMCStack->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
2700  else return;
2701 
2702  if(Photon == NULL){
2703  // cout << "no photon" << endl;
2704  return;
2705  }
2706 
2707  TruePhotonCandidate->SetCaloPhotonMCFlags(fMCStack, fEnableSortForClusMC);
2708 
2709  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2710  Double_t mcProdVtxX = primVtxMC->GetX();
2711  Double_t mcProdVtxY = primVtxMC->GetY();
2712  Double_t mcProdVtxZ = primVtxMC->GetZ();
2713  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCStack, TruePhotonCandidate->GetCaloPhotonMCLabel(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2714 
2715  // to get primary distrinction right put mother of conversion electron as particle to check
2716  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
2717  isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCStack, Photon->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2718 
2720  // Fill histograms for inclusive gamma corrections
2721  // --> a) all clusters with leading real or converted photons
2722  if (TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) ){
2723  fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2724  if(!fDoLightOutput){
2725  // how many of those clusters are from converted photons
2726  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2727  fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2728  }
2729  // --> b) which of these are primary
2730  if(isPrimary){
2731  fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2732  fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC);
2733  // --> c) which are from conversions? Just additonal information
2734  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && (Photon->GetMother(0)>-1)){
2735  fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2736  fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),((TParticle*)fMCStack->Particle(Photon->GetMother(0)))->Pt(),fWeightJetJetMC);
2737  }
2738  // --> d) how do the secondaries look like
2739  }else {
2740  Int_t secondaryClass = -1;
2741  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
2742  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhoton( Photon, fMCStack, kTRUE);
2743  else
2744  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhoton( Photon, fMCStack, kFALSE);
2745  // all secondaries
2746  if (secondaryClass > 0 ){
2747  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2748  }
2749  // secondaries from K0s
2750  if (secondaryClass == 2)
2751  fHistoTrueSecondaryClusGammaFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2752  // secondaries from Lambda
2753  else if (secondaryClass == 3)
2754  fHistoTrueSecondaryClusGammaFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2755  else if (secondaryClass == 5)
2756  fHistoTrueSecondaryClusGammaFromK0lPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2757  }
2758  }
2759 
2760  // How many clusters are from electrons besides conversions
2761  }else if (TruePhotonCandidate->IsLargestComponentElectron()) {
2762  if(!fDoLightOutput) fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2763  // How many clusters don't have an electromagnetic particle as leading particle
2764  }else {
2765  if(!fDoLightOutput) fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2766  }
2767 
2768  // Filling histogram for true photons: E vs M02 for paper
2769  if(!fDoLightOutput) {
2770  if ( TruePhotonCandidate->IsLargestComponentPhoton() && !TruePhotonCandidate->IsPhotonWithElecMother() &&
2771  !TruePhotonCandidate->IsMerged() && !TruePhotonCandidate->IsMergedPartConv() && !TruePhotonCandidate->IsDalitzMerged() )
2772  fHistoTrueClusGammaEM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02, fWeightJetJetMC);
2773  }
2774 
2775  // Some additional QA
2776  if (fDoClusterQA > 0){
2777  // how many of the converted photons are fully contained in the cluster
2778  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
2779  fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2780  // how often do we have merged pi0/eta...
2781  if ( (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsDalitzMerged()) || TruePhotonCandidate->IsMergedPartConv() )
2782  fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2783  // how often do we have a merged cluster with at least one conversion
2784  if (TruePhotonCandidate->IsMergedPartConv())
2785  fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2786  // how often do we reconstruct Dalitz electrons
2787  if (TruePhotonCandidate->IsDalitz())
2788  fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2789  // how often merge Dalitz decays
2790  if (TruePhotonCandidate->IsDalitzMerged())
2791  fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2792  // how often do we see Bremstrahlung
2793  if (TruePhotonCandidate->IsPhotonWithElecMother())
2794  fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2795  // how often do we see a shower in the clusters
2796  if (TruePhotonCandidate->IsShower())
2797  fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2798  // how often is the EM a subleading contributor
2799  if (TruePhotonCandidate->IsSubLeadingEM())
2800  fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2801  // how many mother particles point to the cluster
2803  }
2804 
2805  // Check if we are double counting photons
2806  Int_t motherLab = Photon->GetMother(0);
2807  if (motherLab > -1){
2808  if (TruePhotonCandidate->IsLargestComponentPhoton()){
2810  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)0,fWeightJetJetMC);
2812  }
2813  }
2814  if ( TMath::Abs(fMCStack->Particle(motherLab)->GetPdgCode()) == 111 &&
2815  TruePhotonCandidate->IsLargestComponentPhoton() &&
2816  TruePhotonCandidate->IsMerged() &&
2817  !TruePhotonCandidate->IsDalitzMerged() &&
2818  !TruePhotonCandidate->IsMergedPartConv()
2819  ){
2820  if(!fDoLightOutput) fHistoTrueClusPi0EM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02,fWeightJetJetMC);
2821  }
2822  Int_t grandMotherLab = fMCStack->Particle(motherLab)->GetMother(0);
2823  if (grandMotherLab > -1){
2824  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2826  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)1,fWeightJetJetMC);
2828  }
2829  }
2830  }
2831  }
2832  }
2833  return;
2834 }
2835 
2836 
2837 //________________________________________________________________________
2839 {
2840  AliAODMCParticle *Photon = NULL;
2841  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2842  if (AODMCTrackArray){
2843  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
2844  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
2845  else return;
2846  }else {
2847  AliInfo("AODMCTrackArray could not be loaded");
2848  return;
2849  }
2850 
2851  if(Photon == NULL){
2852  // cout << "no photon" << endl;
2853  return;
2854  }
2855 
2857  if(!fDoLightOutput) fHistoTrueNLabelsInClusPt[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
2858 
2859  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2860  Double_t mcProdVtxX = primVtxMC->GetX();
2861  Double_t mcProdVtxY = primVtxMC->GetY();
2862  Double_t mcProdVtxZ = primVtxMC->GetZ();
2863  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2864 
2865  // to get primary distrinction right put mother of conversion electron as particle to check
2866  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2867  if (Photon->GetMother()> -1){
2868  AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
2869  isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, Mother, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2870  }
2871  }
2872 
2873  // True Photon
2875  if (TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) ){
2876  fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2877  if(!fDoLightOutput){
2878  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2879  fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2880  }
2881  if(isPrimary){
2882  fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2883  fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC);
2884  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2885  fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2886  AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
2887  fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Mother->Pt(),fWeightJetJetMC);
2888  }
2889  }else {
2890  Int_t secondaryClass = -1;
2891  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
2892  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhotonAOD( Photon, AODMCTrackArray, kTRUE);
2893  else
2894  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhotonAOD( Photon, AODMCTrackArray, kFALSE);
2895  // all secondaries
2896  if (secondaryClass > 0 ){
2897  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2898  }
2899  // secondaries from K0s
2900  if (secondaryClass == 2)
2901  fHistoTrueSecondaryClusGammaFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2902  // secondaries from Lambda
2903  else if (secondaryClass == 3)
2904  fHistoTrueSecondaryClusGammaFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2905  else if (secondaryClass == 5)
2906  fHistoTrueSecondaryClusGammaFromK0lPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2907  }
2908  }
2909 
2910  }else if (TruePhotonCandidate->IsLargestComponentElectron()) {
2911  if(!fDoLightOutput) fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2912  }else {
2913  if(!fDoLightOutput) fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2914  }
2915 
2916  if(!fDoLightOutput) {
2917  if ( TruePhotonCandidate->IsLargestComponentPhoton() && !TruePhotonCandidate->IsPhotonWithElecMother() &&
2918  !TruePhotonCandidate->IsMerged() && !TruePhotonCandidate->IsMergedPartConv() && !TruePhotonCandidate->IsDalitzMerged() )
2919  fHistoTrueClusGammaEM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02, fWeightJetJetMC);
2920  }
2921  if (fDoClusterQA > 0){
2922  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
2923  fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2924  if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
2925  fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2926  if (TruePhotonCandidate->IsMergedPartConv())
2927  fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2928  if (TruePhotonCandidate->IsDalitz())
2929  fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2930  if (TruePhotonCandidate->IsDalitzMerged())
2931  fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2932  if (TruePhotonCandidate->IsPhotonWithElecMother())
2933  fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2934  if (TruePhotonCandidate->IsShower())
2935  fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2936  if (TruePhotonCandidate->IsSubLeadingEM())
2937  fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2939 
2940  }
2941  Int_t motherLab = Photon->GetMother();
2942  if (motherLab > -1){
2943  if (TruePhotonCandidate->IsLargestComponentPhoton()){
2945  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)0,fWeightJetJetMC);
2947  }
2948  }
2949  if(!fDoLightOutput) {
2950  if ( TMath::Abs(((AliAODMCParticle*) AODMCTrackArray->At(motherLab))->GetPdgCode()) == 111 && TruePhotonCandidate->IsLargestComponentPhoton() && TruePhotonCandidate->IsMerged() && !TruePhotonCandidate->IsDalitzMerged() && !TruePhotonCandidate->IsMergedPartConv())
2951  fHistoTrueClusPi0EM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02, fWeightJetJetMC);
2952  }
2953  Int_t grandMotherLab = ((AliAODMCParticle*) AODMCTrackArray->At(motherLab))->GetMother();
2954  if (grandMotherLab > -1){
2955  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2957  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)1,fWeightJetJetMC);
2959  }
2960  }
2961  }
2962  }
2963 
2964  }
2965 
2966  return;
2967 }
2968 
2969 //________________________________________________________________________
2971 {
2972  Int_t nV0 = 0;
2973  TList *GammaCandidatesStepOne = new TList();
2974  TList *GammaCandidatesStepTwo = new TList();
2975  // Loop over Photon Candidates allocated by ReaderV1
2976  for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
2977  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
2978  if(!PhotonCandidate) continue;
2979  fIsFromMBHeader = kTRUE;
2980  if(fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2981  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack, fInputEvent);
2982  if(isPosFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
2983  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCStack, fInputEvent);
2984  if(isNegFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
2985  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
2986  }
2987 
2988  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fInputEvent)) continue;
2989  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(PhotonCandidate->GetPhotonPhi(),fEventPlaneAngle)) continue;
2990  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
2991  !((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
2992  fGammaCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
2993 
2994  if(fIsFromMBHeader){
2995  if(!fDoLightOutput) fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2996  if (fDoPhotonQA > 0){
2997  fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
2998  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
2999  }
3000  }
3001  if(fIsMC>0){
3002  if(fInputEvent->IsA()==AliESDEvent::Class())
3003  ProcessTruePhotonCandidates(PhotonCandidate);
3004  if(fInputEvent->IsA()==AliAODEvent::Class())
3005  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3006  }
3007  if (fIsFromMBHeader && fDoPhotonQA == 2){
3008  if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
3009  fPtGamma = PhotonCandidate->Pt();
3010  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
3011  fRConvPhoton = PhotonCandidate->GetConversionRadius();
3012  fEtaPhoton = PhotonCandidate->GetPhotonEta();
3013  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3014  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3015  }else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
3016  fPtGamma = PhotonCandidate->Pt();
3017  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
3018  fRConvPhoton = PhotonCandidate->GetConversionRadius();
3019  fEtaPhoton = PhotonCandidate->GetPhotonEta();
3020  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3021  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3022  }
3023  }
3024  }else if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
3025  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
3026  nV0++;
3027  GammaCandidatesStepOne->Add(PhotonCandidate);
3028  }else if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
3029  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
3030  GammaCandidatesStepTwo->Add(PhotonCandidate);
3031  }
3032  }
3033  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){
3034  for(Int_t i = 0;i<GammaCandidatesStepOne->GetEntries();i++){
3035  AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GammaCandidatesStepOne->At(i);
3036  if(!PhotonCandidate) continue;
3037  fIsFromMBHeader = kTRUE;
3038  if(fMCStack && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3039  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack, fInputEvent);
3040  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCStack, fInputEvent);
3041  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
3042  }
3043  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GammaCandidatesStepOne->GetEntries())) continue;
3044  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
3045  fGammaCandidates->Add(PhotonCandidate);
3046  if(fIsFromMBHeader){
3047  if(!fDoLightOutput) fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
3048  if (fDoPhotonQA > 0){
3049  fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
3050  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
3051  }
3052  }
3053  if(fIsMC>0){
3054  if(fInputEvent->IsA()==AliESDEvent::Class())
3055  ProcessTruePhotonCandidates(PhotonCandidate);
3056  if(fInputEvent->IsA()==AliAODEvent::Class())
3057  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3058  }
3059  if (fIsFromMBHeader && fDoPhotonQA == 2){
3060  if (fIsHeavyIon ==1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
3061  fPtGamma = PhotonCandidate->Pt();
3062  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
3063  fRConvPhoton = PhotonCandidate->GetConversionRadius();
3064  fEtaPhoton = PhotonCandidate->GetPhotonEta();
3065  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3066  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3067  }else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
3068  fPtGamma = PhotonCandidate->Pt();
3069  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
3070  fRConvPhoton = PhotonCandidate->GetConversionRadius();
3071  fEtaPhoton = PhotonCandidate->GetPhotonEta();
3072  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3073  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3074  }
3075  }
3076  } else GammaCandidatesStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
3077  }
3078  }
3079  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
3080  for(Int_t i = 0;i<GammaCandidatesStepTwo->GetEntries();i++){
3081  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GammaCandidatesStepTwo->At(i);
3082  if(!PhotonCandidate) continue;
3083  fIsFromMBHeader = kTRUE;
3084  if(fMCStack && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3085  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCStack, fInputEvent);
3086  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCStack, fInputEvent);
3087  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
3088  }
3089  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GammaCandidatesStepTwo,i)) continue;
3090  fGammaCandidates->Add(PhotonCandidate); // Add gamma to current cut TList
3091  if(fIsFromMBHeader){
3092  if(!fDoLightOutput) fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
3093  if (fDoPhotonQA > 0){
3094  fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
3095  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
3096  }
3097  }
3098  if(fIsMC>0){
3099  if(fInputEvent->IsA()==AliESDEvent::Class())
3100  ProcessTruePhotonCandidates(PhotonCandidate);
3101  if(fInputEvent->IsA()==AliAODEvent::Class())
3102  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3103  }
3104  if (fIsFromMBHeader && fDoPhotonQA == 2){
3105  if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
3106  fPtGamma = PhotonCandidate->Pt();
3107  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
3108  fRConvPhoton = PhotonCandidate->GetConversionRadius();
3109  fEtaPhoton = PhotonCandidate->GetPhotonEta();
3110  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3111  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3112  }else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
3113  fPtGamma = PhotonCandidate->Pt();
3114  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
3115  fRConvPhoton = PhotonCandidate->GetConversionRadius();
3116  fEtaPhoton = PhotonCandidate->GetPhotonEta();
3117  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3118  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3119  }
3120  }
3121  }
3122  }
3123 
3124  delete GammaCandidatesStepOne;
3125  GammaCandidatesStepOne = 0x0;
3126  delete GammaCandidatesStepTwo;
3127  GammaCandidatesStepTwo = 0x0;
3128 
3129 }
3130 
3131 //________________________________________________________________________
3133 {
3134  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3135  Double_t mcProdVtxX = primVtxMC->GetX();
3136  Double_t mcProdVtxY = primVtxMC->GetY();
3137  Double_t mcProdVtxZ = primVtxMC->GetZ();
3138 
3139  Double_t magField = fInputEvent->GetMagneticField();
3140  if( magField < 0.0 ){
3141  magField = 1.0;
3142  }
3143  else {
3144  magField = -1.0;
3145  }
3146 
3147  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3148  if (AODMCTrackArray == NULL) return;
3149  AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
3150  AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
3151  fCharPhotonMCInfo = 0;
3152 
3153  if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
3154  Int_t pdgCode[2] = {TMath::Abs(posDaughter->GetPdgCode()),TMath::Abs(negDaughter->GetPdgCode())};
3155 
3156  if(posDaughter->GetMother() != negDaughter->GetMother()){
3157  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3158  fCharPhotonMCInfo = 1;
3159  return;
3160  }
3161  else if(posDaughter->GetMother() == -1){
3162  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3163  fCharPhotonMCInfo = 1;
3164  return;
3165  }
3166 
3167  if(pdgCode[0]!=11 || pdgCode[1]!=11){
3168  fCharPhotonMCInfo = 1;
3169  return; //One Particle is not a electron
3170  }
3171 
3172  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()){
3173  fCharPhotonMCInfo = 1;
3174  return; // Same Charge
3175  }
3176 
3177  AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
3178  if(Photon->GetPdgCode() != 22){
3179  fCharPhotonMCInfo = 1;
3180  return; // Mother is no Photon
3181  }
3182 
3183  if(((posDaughter->GetMCProcessCode())) != 5 || ((negDaughter->GetMCProcessCode())) != 5){
3184  fCharPhotonMCInfo = 1;
3185  return;// check if the daughters come from a conversion
3186  }
3187  // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
3188 
3189 
3190 
3191  // True Photon
3192  if(fIsFromMBHeader){
3193  if(!fDoLightOutput) fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3194  if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
3195  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueConvGammas,posDaughter->GetMother())){
3196  if(!fDoLightOutput) fHistoDoubleCountTrueConvGammaRPt[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3197  FillMultipleCountMap(fMapMultipleCountTrueConvGammas,posDaughter->GetMother());
3198  }
3199  }
3200 
3201  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3202  if(isPrimary){
3203  // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
3204  if(fIsFromMBHeader){
3205  fCharPhotonMCInfo = 6;
3206  if(!fDoLightOutput){
3207  fHistoTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3208  fHistoTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC); // Allways Filled
3209  }
3210  }
3211  // (Not Filled for i6, Extra Signal Gamma (parambox) are secondary)
3212  }else {
3213  if(fIsFromMBHeader){
3214 
3215  fCharPhotonMCInfo = 2;
3216  // check for secondaries from K0s
3217  if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3218  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 310){
3219  fCharPhotonMCInfo = 4;
3220  if(!fDoLightOutput){
3221  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3222  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3223  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3224  }
3225  // check for secondaries from K0l
3226  } else if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3227  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 130) {
3228  fCharPhotonMCInfo = 7;
3229  if(!fDoLightOutput){
3230  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3231  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),1.,fWeightJetJetMC);
3232  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3233  }
3234  // check for secondaries from Lambda
3235  } else if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3236  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 3122){
3237  fCharPhotonMCInfo = 5;
3238  if(!fDoLightOutput){
3239  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3240  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3241  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3242  }
3243  } else if (((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3244  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 221) {
3245  fCharPhotonMCInfo = 3;
3246  if(!fDoLightOutput){
3247  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3248  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3249  }
3250  } else {
3251  if(!fDoLightOutput){
3252  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3253  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3254  }
3255  }
3256  }
3257  }
3258  TruePhotonCandidate->SetIsTrueConvertedPhoton();
3259 }
3260 
3261 //________________________________________________________________________
3263 {
3264  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3265  Double_t mcProdVtxX = primVtxMC->GetX();
3266  Double_t mcProdVtxY = primVtxMC->GetY();
3267  Double_t mcProdVtxZ = primVtxMC->GetZ();
3268 
3269  Double_t magField = fInputEvent->GetMagneticField();
3270  if( magField < 0.0 ){
3271  magField = 1.0;
3272  }
3273  else {
3274  magField = -1.0;
3275  }
3276 
3277  // Process True Photons
3278  TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCStack);
3279  TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCStack);
3280  fCharPhotonMCInfo = 0;
3281 
3282  if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
3283  Int_t pdgCode[2] = {TMath::Abs(posDaughter->GetPdgCode()),TMath::Abs(negDaughter->GetPdgCode())};
3284  fCharPhotonMCInfo = 1;
3285  if(posDaughter->GetMother(0) != negDaughter->GetMother(0)){
3286  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3287  return;
3288  }
3289  else if(posDaughter->GetMother(0) == -1){
3290  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3291  return;
3292  }
3293 
3294  if(pdgCode[0]!=11 || pdgCode[1]!=11) return; //One Particle is not a electron
3295 
3296  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge
3297 
3298  TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCStack);
3299 
3300  if(Photon->GetPdgCode() != 22){
3301  return; // Mother is no Photon
3302  }
3303 
3304  if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() !=5) return;// check if the daughters come from a conversion
3305 
3306  // True Photon
3307  if(fIsFromMBHeader){
3308  if(!fDoLightOutput) fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3309  if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
3310  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueConvGammas,posDaughter->GetMother(0))){
3311  if(!fDoLightOutput) fHistoDoubleCountTrueConvGammaRPt[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3312  FillMultipleCountMap(fMapMultipleCountTrueConvGammas,posDaughter->GetMother(0));
3313  }
3314  }
3315  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCStack, posDaughter->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3316  if(isPrimary){
3317  // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
3318  if(fIsFromMBHeader){
3319  fCharPhotonMCInfo = 6;
3320  if(!fDoLightOutput){
3321  fHistoTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3322  fHistoTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC); // Allways Filled
3323  }
3324  }
3325  // (Not Filled for i6, Extra Signal Gamma (parambox) are secondary)
3326  }else {
3327  // fill secondary histograms
3328  if(fIsFromMBHeader){
3329  fCharPhotonMCInfo = 2;
3330  if( Photon->GetMother(0) > -1 && fMCStack->Particle(Photon->GetMother(0))->GetMother(0) > -1){
3331  if (fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
3332  fCharPhotonMCInfo = 4;
3333  if (!fDoLightOutput){
3334  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3335  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3336  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3337  }
3338  } else if (fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 130) {
3339  fCharPhotonMCInfo = 7;
3340  if (!fDoLightOutput){
3341  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3342  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),1.,fWeightJetJetMC);
3343  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3344  }
3345  } else if (fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 3122) {
3346  fCharPhotonMCInfo = 5;
3347  if (!fDoLightOutput){
3348  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3349  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),2.,fWeightJetJetMC);
3350  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3351  }
3352  } else if (fMCStack->Particle(fMCStack->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 221) {
3353  fCharPhotonMCInfo = 3;
3354  if (!fDoLightOutput){
3355  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3356  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3357  }
3358  } else {
3359  if (!fDoLightOutput){
3360  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3361  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3362  }
3363  }
3364  } else {
3365  if (!fDoLightOutput){
3366  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3367  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3368  }
3369  }
3370  }
3371  }
3372  TruePhotonCandidate->SetIsTrueConvertedPhoton();
3373  return;
3374 }
3375 //________________________________________________________________________
3377 {
3378  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3379  Double_t mcProdVtxX = primVtxMC->GetX();
3380  Double_t mcProdVtxY = primVtxMC->GetY();
3381  Double_t mcProdVtxZ = primVtxMC->GetZ();
3382 
3383  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3384  if (AODMCTrackArray == NULL) return;
3385 
3386  // Loop over all primary MC particle
3387  for(Long_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
3388 
3389  AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
3390  if (!particle) continue;
3391 
3392  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, particle, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3393  if (isPrimary) {
3394 
3395  Int_t isMCFromMBHeader = -1;
3396  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3397  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
3398  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3399  }
3400 
3401  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
3402  if(!fDoLightOutput){
3403  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kFALSE)){
3404  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Gamma
3405  if (TMath::Abs(particle->Eta()) < 0.66 ){
3406  if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3407  }
3408  if(particle->GetMother() >-1){ // Meson Decay Gamma
3409  switch((static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother())))->GetPdgCode()){
3410  case 111: // Pi0
3411  fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3412  break;
3413  case 113: // Rho0
3414  fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3415  break;
3416  case 221: // Eta
3417  fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3418  break;
3419  case 223: // Omega
3420  fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3421  break;
3422  case 331: // Eta'
3423  fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3424  break;
3425  case 333: // Phi
3426  fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3427  break;
3428  case 3212: // Sigma
3429  fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3430  break;
3431  }
3432  }
3433  }
3434  }
3435  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kTRUE)){
3436  Double_t rConv = 0;
3437  for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){
3438  AliAODMCParticle *tmpDaughter = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(daughterIndex));
3439  if(!tmpDaughter) continue;
3440  if(TMath::Abs(tmpDaughter->GetPdgCode()) == 11){
3441  rConv = sqrt( (tmpDaughter->Xv()*tmpDaughter->Xv()) + (tmpDaughter->Yv()*tmpDaughter->Yv()) );
3442  }
3443  }
3444  if(!fDoLightOutput) fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3445  if (fDoPhotonQA > 0){
3446  fHistoMCConvGammaR[fiCut]->Fill(rConv);
3447  fHistoMCConvGammaEta[fiCut]->Fill(particle->Eta());
3448  }
3449  }
3450  // Converted MC Gamma
3451  if(fDoMesonAnalysis){
3452 
3453  Double_t mesonY = 10.;
3454  if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
3455  mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3456  }else {
3457  mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3458  }
3459 
3460  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
3461  if ( particle->GetPdgCode() == 211 ){ // positve pions
3462  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., fWeightJetJetMC);
3463  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
3464  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., fWeightJetJetMC);
3465  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
3466  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., fWeightJetJetMC);
3467  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
3468  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., fWeightJetJetMC);
3469  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
3470  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., fWeightJetJetMC);
3471  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
3472  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., fWeightJetJetMC);
3473  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
3474  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., fWeightJetJetMC);
3475  }
3476  }
3477 
3478  // check neutral mesons
3480  ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3481  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
3482  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
3483  Float_t weighted= 1;
3484  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
3485  if (particle->Pt()>0.005){
3486  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, 0x0, fInputEvent);
3487  // if(particle->GetPdgCode() == 221){
3488  // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
3489  // }
3490  }
3491  }
3492  Double_t mesonY = 10.;
3493  if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
3494  mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3495  }else{
3496  mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3497  }
3498 
3499  Double_t alpha = -10;
3500  if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
3501  alpha = (daughter0->E() - daughter1->E())/(daughter0->E() + daughter1->E());
3502  }
3503 
3504 
3505  if(particle->GetPdgCode() == 111){
3506  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Pi0
3507  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3508  if (!fDoLightOutput){
3509  // fill pi0 hists against gamma pt of first leg
3510  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,weighted*fWeightJetJetMC);
3511  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,fWeightJetJetMC);
3512  // fill pi0 hists against gamma pt of second leg
3513  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,weighted*fWeightJetJetMC);
3514  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,fWeightJetJetMC);
3515  // fill pi0 hists against gamma pt of both legs
3516  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,weighted*fWeightJetJetMC);
3517  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,fWeightJetJetMC);
3518  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,weighted*fWeightJetJetMC);
3519  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,fWeightJetJetMC);
3520  }
3521 
3522  if (fIsMC > 1) fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
3523  if (fDoMesonQA > 0){
3524  fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC);
3525  fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC);
3526  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3527  }
3528  }else if(particle->GetPdgCode() == 221){
3529  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Eta
3530  fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3531  if (fIsMC > 1) fHistoMCEtaWOEvtWeightPt[fiCut]->Fill(particle->Pt());
3532  if (fDoMesonQA > 0){
3533  fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC);
3534  fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC);
3535  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3536  }
3537  }
3538 
3539  // Check the acceptance for both gammas
3540  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter0,AODMCTrackArray,kFALSE) &&
3541  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter1,AODMCTrackArray,kFALSE) &&
3542  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
3543  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
3544  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
3545  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) ||
3546  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
3547  if(particle->GetPdgCode() == 111){
3548  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Pi0 with gamma in acc
3549  fHistoMCPi0WOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Pi0 with gamma in acc wo weight
3550  if(fIsMC > 1) fHistoMCPi0WOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 with gamma in acc wo any weight
3551  if (!fDoLightOutput){
3552  // fill pi0 hists against gamma pt of first leg
3553  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,weighted*fWeightJetJetMC);
3554  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,fWeightJetJetMC);
3555  // fill pi0 hists against gamma pt of second leg
3556  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,weighted*fWeightJetJetMC);
3557  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,fWeightJetJetMC);
3558  // fill pi0 hists against gamma pt of both legs
3559  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,weighted*fWeightJetJetMC);
3560  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,fWeightJetJetMC);
3561  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,weighted*fWeightJetJetMC);
3562  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,fWeightJetJetMC);
3563  }
3564  }else if(particle->GetPdgCode() == 221){
3565  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Eta with gamma in acc
3566  fHistoMCEtaWOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Eta with gamma in acc wo weight
3567  if(fIsMC > 1) fHistoMCEtaWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta with gamma in acc wo any weight
3568  }
3569  }
3570  }
3571  }
3572  }
3573  } else {
3574  // fill secondary histograms
3575  Int_t isMCFromMBHeader = -1;
3576  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3577  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
3578  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3579  }
3580  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) {
3581  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kFALSE)){
3582  if (particle->GetMother() > -1) {
3583  AliAODMCParticle *tmpMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3584  if (tmpMother->GetMother() > -1) {
3585  AliAODMCParticle *tmpGrandMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(tmpMother->GetMother()));
3586  if(tmpGrandMother->GetPdgCode() == 310) {
3587  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightJetJetMC);
3588  } else if (tmpGrandMother->GetPdgCode() == 130) {
3589  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightJetJetMC);
3590  } else if (tmpGrandMother->GetPdgCode() == 3122) {
3591  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightJetJetMC);
3592  } else {
3593  if ( !(TMath::Abs(tmpMother->GetPdgCode()) == 11 && tmpGrandMother->GetPdgCode() == 22) )
3594  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3595  }
3596  } else {
3597  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3598  }
3599  } else {
3600  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3601  }
3602  }
3603 
3604  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kTRUE)){
3605  if (particle->GetMother() > -1) {
3606  AliAODMCParticle *tmpMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3607  if (tmpMother->GetMother() > -1) {
3608  AliAODMCParticle *tmpGrandMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(tmpMother->GetMother()));
3609  if(tmpGrandMother->GetPdgCode() == 310) {
3610  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightJetJetMC);
3611  } else if (tmpGrandMother->GetPdgCode() == 130) {
3612  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightJetJetMC);
3613  } else if (tmpGrandMother->GetPdgCode() == 3122) {
3614  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightJetJetMC);
3615  } else {
3616  if ( !(TMath::Abs(tmpMother->GetPdgCode()) == 11 && tmpGrandMother->GetPdgCode() == 22) )
3617  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3618  }
3619  } else {
3620  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3621  }
3622  } else {
3623  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3624  }
3625  }
3626  }
3627 
3628  if(fDoMesonAnalysis){
3629  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3630  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
3631  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
3632  AliAODMCParticle* mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3633  Int_t pdgCode = mother->GetPdgCode();
3634  if(particle->GetPdgCode() == 111){
3635  Int_t source = GetSourceClassification(111,pdgCode);
3636  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC); // All MC Pi0
3637  if (!fDoLightOutput){
3638  fHistoMCSecPi0PtGamma1vsSource[fiCut]->Fill(daughter0->Pt(),source,fWeightJetJetMC); // All MC Pi0
3639  fHistoMCSecPi0PtGamma2vsSource[fiCut]->Fill(daughter1->Pt(),source,fWeightJetJetMC); // All MC Pi0
3640  }
3641  fHistoMCSecPi0Source[fiCut]->Fill(pdgCode);
3642  }else if(particle->GetPdgCode() == 221){
3643 
3644  fHistoMCSecEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Pi0
3645  fHistoMCSecEtaSource[fiCut]->Fill(pdgCode);
3646  }
3647 
3648  // check if conversion where within acceptance
3649  if( ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter0,AODMCTrackArray,kFALSE) &&
3650  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter1,AODMCTrackArray,kFALSE) &&
3651  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
3652  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
3653  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
3654  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) ||
3655  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
3656  if (particle->GetPdgCode() == 111){
3657  Int_t source = GetSourceClassification(111,pdgCode);
3658  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC); // All MC Pi0
3659  if (!fDoLightOutput){
3660  fHistoMCSecPi0InAccPtGamma1vsSource[fiCut]->Fill(daughter0->Pt(),source,fWeightJetJetMC); // All MC Pi0
3661  fHistoMCSecPi0InAccPtGamma2vsSource[fiCut]->Fill(daughter1->Pt(),source,fWeightJetJetMC); // All MC Pi0
3662  }
3663  }
3664  }
3665  }
3666  }
3667  }
3668  }
3669  }
3670 }
3671 
3672 //________________________________________________________________________
3674 {
3675  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3676  Double_t mcProdVtxX = primVtxMC->GetX();
3677  Double_t mcProdVtxY = primVtxMC->GetY();
3678  Double_t mcProdVtxZ = primVtxMC->GetZ();
3679 // cout << mcProdVtxX <<"\t" << mcProdVtxY << "\t" << mcProdVtxZ << endl;
3680 
3681  // Loop over all primary MC particle
3682  for(Long_t i = 0; i < fMCStack->GetNtrack(); i++) {
3683  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCStack, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
3684  // fill primary histograms
3685  TParticle* particle = (TParticle *)fMCStack->Particle(i);
3686  if (!particle) continue;
3687 
3688  Int_t isMCFromMBHeader = -1;
3689  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3690  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
3691  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3692  }
3693 
3694  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
3695  if(!fDoLightOutput){
3696  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kFALSE)){
3697  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Gamma
3698  if (TMath::Abs(particle->Eta()) < 0.66 ){
3699  if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3700  }
3701 
3702  if(particle->GetMother(0) >-1){ // Meson Decay Gamma
3703  switch(fMCStack->Particle(particle->GetMother(0))->GetPdgCode()){
3704  case 111: // Pi0
3705  fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3706  break;
3707  case 113: // Rho0
3708  fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3709  break;
3710  case 221: // Eta
3711  fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3712  break;
3713  case 223: // Omega
3714  fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3715  break;
3716  case 331: // Eta'
3717  fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3718  break;
3719  case 333: // Phi
3720  fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3721  break;
3722  case 3212: // Sigma
3723  fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3724  break;
3725  }
3726  }
3727  }
3728  }
3729  // Converted MC Gamma
3730  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kTRUE)){
3731  if(!fDoLightOutput) fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3732  if (fDoPhotonQA > 0){
3733  if(particle->GetFirstDaughter()>-1) fHistoMCConvGammaR[fiCut]->Fill(((TParticle*)fMCStack->Particle(particle->GetFirstDaughter()))->R());
3734  fHistoMCConvGammaEta[fiCut]->Fill(particle->Eta());
3735  }
3736  }
3737 
3738 
3739  if(fDoMesonAnalysis ){
3740 
3741  // Fill histograms for other particles
3742  Double_t mesonY = 10.;
3743  if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
3744  mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3745  }else{
3746  mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3747  }
3748 
3749  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
3750  if ( particle->GetPdgCode() == 211 ){ // positve pions
3751  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., fWeightJetJetMC);
3752  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
3753  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., fWeightJetJetMC);
3754  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
3755  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., fWeightJetJetMC);
3756  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
3757  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., fWeightJetJetMC);
3758  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
3759  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., fWeightJetJetMC);
3760  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
3761  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., fWeightJetJetMC);
3762  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
3763  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., fWeightJetJetMC);
3764  }
3765  }
3766 
3767  // check neutral mesons
3769  ->MesonIsSelectedMC(particle,fMCStack,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3770  TParticle* daughter0 = (TParticle*)fMCStack->Particle(particle->GetFirstDaughter());
3771  TParticle* daughter1 = (TParticle*)fMCStack->Particle(particle->GetLastDaughter());
3772 
3773  Float_t weighted= 1;
3774  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent)){
3775  if (particle->Pt()>0.005){
3776  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCStack, fInputEvent);
3777  }
3778  }
3779  Double_t mesonY = 10.;
3780  if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
3781  mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3782  }else{
3783  mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3784  }
3785 
3786  Double_t alpha = -10;
3787  if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
3788  alpha = (daughter0->Energy() - daughter1->Energy())/(daughter0->Energy() + daughter1->Energy());
3789  }
3790 
3791  if(particle->GetPdgCode() == 111){
3792  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Pi0
3793  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3794  if (!fDoLightOutput){
3795  // fill pi0 hists against gamma pt of first leg
3796  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,weighted*fWeightJetJetMC);
3797  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,fWeightJetJetMC);
3798  // fill pi0 hists against gamma pt of second leg
3799  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,weighted*fWeightJetJetMC);
3800  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,fWeightJetJetMC);
3801  // fill pi0 hists against gamma pt of both legs
3802  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,weighted*fWeightJetJetMC);
3803  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,fWeightJetJetMC);
3804  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,weighted*fWeightJetJetMC);
3805  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,fWeightJetJetMC);
3806  }
3807 
3808  if (fIsMC > 1) fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
3809  if (fDoMesonQA > 0){
3810  fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC); // All MC Pi0
3811  fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC); // All MC Pi0
3812  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3813  }
3814  }else if(particle->GetPdgCode() == 221){
3815  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Eta
3816  fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3817  if (fIsMC > 1) fHistoMCEtaWOEvtWeightPt[fiCut]->Fill(particle->Pt());
3818  if (fDoMesonQA > 0){
3819  fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC); // All MC Pi0
3820  fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC); // All MC Pi0
3821  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3822  }
3823  }
3824 
3825  // Check the acceptance for both gammas & whether they are counted as primaries as well
3826  Bool_t kDaughter0IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCStack, particle->GetFirstDaughter(), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3827  Bool_t kDaughter1IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCStack, particle->GetLastDaughter(), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3828 
3829  if( kDaughter0IsPrim && kDaughter1IsPrim &&
3830  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter0,fMCStack,kFALSE) &&
3831  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter1,fMCStack,kFALSE) &&
3832  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
3833  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
3834  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
3835  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCStack) ||
3836  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCStack) ){
3837  if(particle->GetPdgCode() == 111){
3838  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Pi0 with gamma in acc
3839  fHistoMCPi0WOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Pi0 with gamma in acc wo weighting
3840  if(fIsMC > 1) fHistoMCPi0WOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 with gamma in acc wo any weight
3841  if (!fDoLightOutput){
3842  // fill pi0 hists against gamma pt of first leg
3843  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,weighted*fWeightJetJetMC);
3844  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,fWeightJetJetMC);
3845  // fill pi0 hists against gamma pt of second leg
3846  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,weighted*fWeightJetJetMC);
3847  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,fWeightJetJetMC);
3848  // fill pi0 hists against gamma pt of both legs
3849  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,weighted*fWeightJetJetMC);
3850  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,fWeightJetJetMC);
3851  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,weighted*fWeightJetJetMC);
3852  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,fWeightJetJetMC);
3853  }
3854  }else if(particle->GetPdgCode() == 221){
3855  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Eta with gamma in acc
3856  fHistoMCEtaWOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Eta with gamma in acc wo weighting
3857  if(fIsMC > 1) fHistoMCEtaWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta with gamma in acc wo any weight
3858  }
3859  }
3860  }
3861  }
3862  }
3863  // fill secondary histograms
3864  } else {
3865  TParticle* particle = (TParticle *)fMCStack->Particle(i);
3866  if (!particle) continue;
3867  Int_t isMCFromMBHeader = -1;
3868  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3869  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCStack, fInputEvent);
3870  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3871  }
3872 
3873  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)){
3874  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCStack,kFALSE)){
3875  if (particle->GetMother(0) > -1 && fMCStack->Particle(particle->GetMother(0))->GetMother(0) > -1) {
3876  if (fMCStack->Particle(fMCStack->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
3877  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightJetJetMC);
3878  } else if (fMCStack->Particle(fMCStack->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 130) {
3879  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightJetJetMC);
3880  } else if (fMCStack->Particle(fMCStack->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 3122) {
3881  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightJetJetMC);
3882  } else {
3883  if ( !(TMath::Abs(fMCStack->Particle(particle->GetMother(0))->GetPdgCode()) == 11 && fMCStack->Particle(fMCStack->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 22) )
3884  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,