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