AliPhysics  c7b8e89 (c7b8e89)
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::k8TeV ){
901  nBinsQAPt = 190;
902  maxQAPt = 40;
903  for(Int_t i=0; i<nBinsQAPt+1;i++){
904  if(i<60) arrQAPtBinning[i] = 0.05*i;
905  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
906  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
907  else if(i<190) arrQAPtBinning[i] = 20.+1.0*(i-170);
908  else arrQAPtBinning[i] = maxQAPt;
909  }
910  nBinsPt = 400;
911  minPt = 0;
912  maxPt = 40;
913  for(Int_t i=0; i<nBinsPt+1;i++){
914  arrPtBinning[i] = ((maxPt-minPt)/nBinsPt)*i;
915  }
916  nBinsClusterPt = 800;
917  minClusterPt = 0;
918  maxClusterPt = 80;
919  for(Int_t i=0; i<nBinsClusterPt+1;i++){
920  arrClusPtBinning[i] = ((maxClusterPt-minClusterPt)/nBinsClusterPt)*i;
921  }
922  // Set special pt binning for pPb 5TeV
923  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kpPb5TeV ||
925  ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k5TeV ){
926  binWidthPt = 0.05;
927  nBinsPt = 205;
928  minPt = 0;
929  maxPt = 60;
930  for(Int_t i=0; i<nBinsPt+1;i++){
931  if (i < 1) arrPtBinning[i] = 0.3*i;
932  else if(i<55) arrPtBinning[i] = 0.3+0.05*(i-1);
933  else if(i<125) arrPtBinning[i] = 3.+0.1*(i-55);
934  else if(i<165) arrPtBinning[i] = 10.+0.25*(i-125);
935  else if(i<205) arrPtBinning[i] = 20.+1.0*(i-165);
936  else arrPtBinning[i] = maxPt;
937  }
938  nBinsQAPt = 210;
939  maxQAPt = 60;
940  for(Int_t i=0; i<nBinsQAPt+1;i++){
941  if(i<60) arrQAPtBinning[i] = 0.05*i;
942  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
943  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
944  else if(i<210) arrQAPtBinning[i] = 20.+1.0*(i-170);
945  else arrQAPtBinning[i] = maxQAPt;
946  }
947  nBinsClusterPt = 301;
948  minClusterPt = 0;
949  maxClusterPt = 100;
950  for(Int_t i=0; i<nBinsClusterPt+1;i++){
951  if (i < 1) arrClusPtBinning[i] = 0.3*i;
952  else if(i<55) arrClusPtBinning[i] = 0.3+0.05*(i-1);
953  else if(i<125) arrClusPtBinning[i] = 3.+0.1*(i-55);
954  else if(i<155) arrClusPtBinning[i] = 10.+0.2*(i-125);
955  else if(i<211) arrClusPtBinning[i] = 16.+0.25*(i-155);
956  else if(i<251) arrClusPtBinning[i] = 30.+0.5*(i-211);
957  else if(i<301) arrClusPtBinning[i] = 50.+1.0*(i-251);
958  else arrClusPtBinning[i] = maxClusterPt;
959  }
960  // Set special pt binning for pp 13TeV, pPb 8TeV
961  } else if ( ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k13TeV ||
963  nBinsPt = 335;
964  minPt = 0;
965  maxPt = 100;
966  binWidthPt = 0.05;
967  for(Int_t i=0; i<nBinsPt+1;i++){
968  if (i < 1) arrPtBinning[i] = 0.3*i;
969  else if(i<55) arrPtBinning[i] = 0.3+0.05*(i-1);
970  else if(i<225) arrPtBinning[i] = 3.+0.1*(i-55);
971  else if(i<265) arrPtBinning[i] = 20.+0.25*(i-225);
972  else if(i<305) arrPtBinning[i] = 30.+0.5*(i-265);
973  else if(i<325) arrPtBinning[i] = 50.+1.0*(i-305);
974  else if(i<335) arrPtBinning[i] = 70.+2.5*(i-325);
975  else arrPtBinning[i] = maxPt;
976  }
977  nBinsQAPt = 270;
978  maxQAPt = 100;
979  for(Int_t i=0; i<nBinsQAPt+1;i++){
980  if(i<60) arrQAPtBinning[i] = 0.05*i;
981  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
982  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
983  else if(i<210) arrQAPtBinning[i] = 20.+0.5*(i-170);
984  else if(i<270) arrQAPtBinning[i] = 40.+1.0*(i-210);
985  else arrQAPtBinning[i] = maxQAPt;
986  }
987  nBinsClusterPt = 335;
988  minClusterPt = 0;
989  maxClusterPt = 100;
990  for(Int_t i=0; i<nBinsClusterPt+1;i++){
991  if (i < 1) arrClusPtBinning[i] = 0.3*i;
992  else if(i<55) arrClusPtBinning[i] = 0.3+0.05*(i-1);
993  else if(i<225) arrClusPtBinning[i] = 3.+0.1*(i-55);
994  else if(i<265) arrClusPtBinning[i] = 20.+0.25*(i-225);
995  else if(i<305) arrClusPtBinning[i] = 30.+0.5*(i-265);
996  else if(i<325) arrClusPtBinning[i] = 50.+1.0*(i-305);
997  else if(i<335) arrClusPtBinning[i] = 70.+2.5*(i-325);
998  else arrClusPtBinning[i] = maxClusterPt;
999  }
1000  // Set special pt binning for pp 13TeV, pPb 8TeV
1001  } else if ( ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kpPb8TeV ){
1002  binWidthPt = 0.05;
1003  nBinsPt = 205;
1004  minPt = 0;
1005  maxPt = 60;
1006  for(Int_t i=0; i<nBinsPt+1;i++){
1007  if (i < 1) arrPtBinning[i] = 0.3*i;
1008  else if(i<55) arrPtBinning[i] = 0.3+0.05*(i-1);
1009  else if(i<125) arrPtBinning[i] = 3.+0.1*(i-55);
1010  else if(i<165) arrPtBinning[i] = 10.+0.25*(i-125);
1011  else if(i<205) arrPtBinning[i] = 20.+1.0*(i-165);
1012  else arrPtBinning[i] = maxPt;
1013  }
1014  nBinsQAPt = 210;
1015  maxQAPt = 60;
1016  for(Int_t i=0; i<nBinsQAPt+1;i++){
1017  if(i<60) arrQAPtBinning[i] = 0.05*i;
1018  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
1019  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
1020  else if(i<210) arrQAPtBinning[i] = 20.+1.0*(i-170);
1021  else arrQAPtBinning[i] = maxQAPt;
1022  }
1023  nBinsClusterPt = 301;
1024  minClusterPt = 0;
1025  maxClusterPt = 100;
1026  for(Int_t i=0; i<nBinsClusterPt+1;i++){
1027  if (i < 1) arrClusPtBinning[i] = 0.3*i;
1028  else if(i<55) arrClusPtBinning[i] = 0.3+0.05*(i-1);
1029  else if(i<125) arrClusPtBinning[i] = 3.+0.1*(i-55);
1030  else if(i<155) arrClusPtBinning[i] = 10.+0.2*(i-125);
1031  else if(i<211) arrClusPtBinning[i] = 16.+0.25*(i-155);
1032  else if(i<251) arrClusPtBinning[i] = 30.+0.5*(i-211);
1033  else if(i<301) arrClusPtBinning[i] = 50.+1.0*(i-251);
1034  else arrClusPtBinning[i] = maxClusterPt;
1035  }
1036  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kXeXe5440GeV ){
1037  nBinsPt = 90;
1038  minPt = 0;
1039  maxPt = 20;
1040  for(Int_t i=0; i<nBinsPt+1;i++){
1041  if (i < 1) arrPtBinning[i] = 0.3*i;
1042  else if(i<58) arrPtBinning[i] = 0.3+0.1*(i-1);
1043  else if(i<82) arrPtBinning[i] = 6.+0.25*(i-58);
1044  else if(i<90) arrPtBinning[i] = 12.+1.0*(i-82);
1045  else arrPtBinning[i] = maxPt;
1046  }
1047  nBinsQAPt = 92;
1048  maxQAPt = 20;
1049  for(Int_t i=0; i<nBinsQAPt+1;i++){
1050  if(i<60) arrQAPtBinning[i] = 0.1*i;
1051  else if(i<84) arrQAPtBinning[i] = 6.+0.25*(i-60);
1052  else if(i<92) arrQAPtBinning[i] = 12.+1.0*(i-84);
1053  else arrQAPtBinning[i] = maxQAPt;
1054  }
1055  nBinsClusterPt = 148;
1056  minClusterPt = 0;
1057  maxClusterPt = 40;
1058  for(Int_t i=0; i<nBinsClusterPt+1;i++){
1059  if (i < 1) arrClusPtBinning[i] = 0.3*i;
1060  else if(i<98) arrClusPtBinning[i] = 0.3+0.1*(i-1);
1061  else if(i<123) arrClusPtBinning[i] = 10.+0.2*(i-98);
1062  else if(i<148) arrClusPtBinning[i] = 15.+1.0*(i-123);
1063  else arrClusPtBinning[i] = maxClusterPt;
1064  }
1065  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kPbPb5TeV ){
1066  nBinsPt = 90;
1067  minPt = 0;
1068  maxPt = 20;
1069  for(Int_t i=0; i<nBinsPt+1;i++){
1070  if (i < 1) arrPtBinning[i] = 0.3*i;
1071  else if(i<58) arrPtBinning[i] = 0.3+0.1*(i-1);
1072  else if(i<82) arrPtBinning[i] = 6.+0.25*(i-58);
1073  else if(i<90) arrPtBinning[i] = 12.+1.0*(i-82);
1074  else arrPtBinning[i] = maxPt;
1075  }
1076  nBinsQAPt = 92;
1077  maxQAPt = 20;
1078  for(Int_t i=0; i<nBinsQAPt+1;i++){
1079  if(i<60) arrQAPtBinning[i] = 0.1*i;
1080  else if(i<84) arrQAPtBinning[i] = 6.+0.25*(i-60);
1081  else if(i<92) arrQAPtBinning[i] = 12.+1.0*(i-84);
1082  else arrQAPtBinning[i] = maxQAPt;
1083  }
1084  nBinsClusterPt = 148;
1085  minClusterPt = 0;
1086  maxClusterPt = 40;
1087  for(Int_t i=0; i<nBinsClusterPt+1;i++){
1088  if (i < 1) arrClusPtBinning[i] = 0.3*i;
1089  else if(i<98) arrClusPtBinning[i] = 0.3+0.1*(i-1);
1090  else if(i<123) arrClusPtBinning[i] = 10.+0.2*(i-98);
1091  else if(i<148) arrClusPtBinning[i] = 15.+1.0*(i-123);
1092  else arrClusPtBinning[i] = maxClusterPt;
1093  }
1094  // default binning
1095  } else {
1096  for(Int_t i=0; i<nBinsPt+1;i++){
1097  arrPtBinning[i] = ((maxPt-minPt)/nBinsPt)*i;
1098  }
1099  for(Int_t i=0; i<nBinsClusterPt+1;i++){
1100  arrClusPtBinning[i] = ((maxClusterPt-minClusterPt)/nBinsClusterPt)*i;
1101  }
1102  for(Int_t i=0; i<nBinsQAPt+1;i++){
1103  if(i<60) arrQAPtBinning[i] = 0.05*i;
1104  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
1105  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
1106  else arrQAPtBinning[i] = maxQAPt;
1107  }
1108  }
1109 
1110  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1111  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
1112  TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
1113  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
1114  TString cutstringMeson = "NoMesonCut";
1115  if(fDoMesonAnalysis)
1116  cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
1117 
1118  fCutFolder[iCut] = new TList();
1119  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s_%s",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1120  fCutFolder[iCut]->SetOwner(kTRUE);
1121  fOutputContainer->Add(fCutFolder[iCut]);
1122  fESDList[iCut] = new TList();
1123  fESDList[iCut]->SetName(Form("%s_%s_%s_%s ESD histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1124  fESDList[iCut]->SetOwner(kTRUE);
1125  fCutFolder[iCut]->Add(fESDList[iCut]);
1126 
1127  fHistoNEvents[iCut] = new TH1F("NEvents", "NEvents", 14, -0.5, 13.5);
1128  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
1129  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
1130  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
1131  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
1132  TString TriggerNames = "Not Trigger: ";
1133  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
1134  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
1135  }else {
1136  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
1137  }
1138  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
1139  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
1140  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
1141  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
1142  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
1143  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
1144  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
1145  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
1146  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
1147  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
1148  fESDList[iCut]->Add(fHistoNEvents[iCut]);
1149 
1150  if (fIsMC > 1){
1151  fHistoNEventsWOWeight[iCut] = new TH1F("NEventsWOWeight", "NEventsWOWeight", 14, -0.5, 13.5);
1152  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
1153  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
1154  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
1155  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
1156  TString TriggerNames = "Not Trigger: ";
1157  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
1158  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
1159  }else {
1160  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
1161  }
1162  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
1163  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
1164  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
1165  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
1166  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
1167  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
1168  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
1169  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
1170  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
1171  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
1172  fESDList[iCut]->Add(fHistoNEventsWOWeight[iCut]);
1173  }
1174 
1175  if (fIsMC == 2){
1176  fProfileJetJetXSection[iCut] = new TProfile("XSection", "XSection", 1, -0.5, 0.5);
1177  fESDList[iCut]->Add(fProfileJetJetXSection[iCut]);
1178  fHistoJetJetNTrials[iCut] = new TH1F("NTrials", "#sum{NTrials}", 1, 0, 1);
1179  fHistoJetJetNTrials[iCut]->GetXaxis()->SetBinLabel(1,"#sum{NTrials}");
1180  fESDList[iCut]->Add(fHistoJetJetNTrials[iCut]);
1181  }
1182 
1183  if(fIsHeavyIon == 1)
1184  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 4000, 0, 4000);
1185  else if(fIsHeavyIon == 2)
1186  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 400, 0, 400);
1187  else
1188  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 200, 0, 200);
1189  fHistoNGoodESDTracks[iCut]->SetXTitle("# TPC tracks");
1190  fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
1191 
1192  fHistoVertexZ[iCut] = new TH1F("VertexZ", "VertexZ", 200, -10, 10);
1193  fESDList[iCut]->Add(fHistoVertexZ[iCut]);
1194  if(!fDoLightOutput){
1195  fHistoVertexX[iCut] = new TH1F("VertexX", "VertexX", 100, -0.5, 0.5);
1196  fESDList[iCut]->Add(fHistoVertexX[iCut]);
1197  fHistoVertexY[iCut] = new TH1F("VertexY", "VertexY", 100, -0.1, 0.9);
1198  fESDList[iCut]->Add(fHistoVertexY[iCut]);
1199  }
1200 
1201  if(fIsHeavyIon == 1)
1202  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 150, 0, 150);
1203  else if(fIsHeavyIon == 2)
1204  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 50, 0, 50);
1205  else
1206  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 50, 0, 50);
1207  fHistoNGammaCandidates[iCut]->SetXTitle("# accepted #gamma_{conv}");
1208  fESDList[iCut]->Add(fHistoNGammaCandidates[iCut]);
1209 
1210  if(!fDoLightOutput){
1211  if(fIsHeavyIon == 1)
1212  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 4000, 0, 4000, 100, 0, 100);
1213  else if(fIsHeavyIon == 2)
1214  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 400, 0, 400, 50, 0, 50);
1215  else
1216  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 200, 0, 200, 50, 0, 50);
1217  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetXTitle("# TPC tracks");
1218  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetYTitle("# accepted #gamma_{conv}");
1220 
1221  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters", "SPD tracklets vs SPD clusters", 100, 0, 200, 250, 0, 1000);
1222  fESDList[iCut]->Add(fHistoSPDClusterTrackletBackground[iCut]);
1223 
1224  if(fIsHeavyIon == 1)
1225  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 30000, 0, 30000);
1226  else if(fIsHeavyIon == 2)
1227  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 2500, 0, 2500);
1228  else
1229  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 1500, 0, 1500);
1230  fHistoNV0Tracks[iCut]->SetXTitle("VZERO amp [arb. units]");
1231  fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
1232 
1233  fHistoConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt", "ESD_ConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1234  fHistoConvGammaPt[iCut]->SetXTitle("p_{T,conv}(GeV/c)");
1235  fESDList[iCut]->Add(fHistoConvGammaPt[iCut]);
1236  }
1237 
1238  if(fIsHeavyIon == 2){
1239  fProfileEtaShift[iCut] = new TProfile("Eta Shift", "Eta Shift", 1, -0.5, 0.5);
1240  fESDList[iCut]->Add(fProfileEtaShift[iCut]);
1241  }
1242 
1243  if (fIsMC > 1){
1244  fHistoNEvents[iCut]->Sumw2();
1245  fHistoNGoodESDTracks[iCut]->Sumw2();
1246  fHistoVertexZ[iCut]->Sumw2();
1247  fHistoNGammaCandidates[iCut]->Sumw2();
1248  if(!fDoLightOutput){
1249  fHistoVertexX[iCut]->Sumw2();
1250  fHistoVertexY[iCut]->Sumw2();
1252  fHistoSPDClusterTrackletBackground[iCut]->Sumw2();
1253  fHistoNV0Tracks[iCut]->Sumw2();
1254  fHistoConvGammaPt[iCut]->Sumw2();
1255  }
1256  }
1257 
1258  if (fDoPhotonQA == 2 ){
1259  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");
1260  fTreeConvGammaPtDcazCat[iCut]->Branch("Pt",&fPtGamma,"fPtGamma/s");
1261  fTreeConvGammaPtDcazCat[iCut]->Branch("DcaZPhoton",&fDCAzPhoton,"fDCAzPhoton/S");
1262  fTreeConvGammaPtDcazCat[iCut]->Branch("cat",&fCharCatPhoton,"fCharCatPhoton/b");
1263  if (fIsMC > 1){
1264  fTreeConvGammaPtDcazCat[iCut]->Branch("weightEvent",&fWeightJetJetMC,"fWeightJetJetMC/f");
1265  }
1266  }
1267 
1268  fClusterOutputList[iCut] = new TList();
1269  fClusterOutputList[iCut]->SetName(Form("%s_%s_%s_%s Cluster Output",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1270  fClusterOutputList[iCut]->SetOwner(1);
1271  fCutFolder[iCut]->Add(fClusterOutputList[iCut]);
1272 
1273  fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt", "ClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1274  fHistoClusGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1275  fClusterOutputList[iCut]->Add(fHistoClusGammaPt[iCut]);
1276  fHistoClusGammaE[iCut] = new TH1F("ClusGamma_E", "ClusGamma_E", nBinsClusterPt, arrClusPtBinning);
1277  fHistoClusGammaE[iCut]->SetXTitle("E_{clus} (GeV)");
1278  fClusterOutputList[iCut]->Add(fHistoClusGammaE[iCut]);
1279  fHistoClusOverlapHeadersGammaPt[iCut] = new TH1F("ClusGammaOverlapHeaders_Pt", "ClusGammaOverlapHeaders_Pt", nBinsClusterPt, arrClusPtBinning);
1280  fHistoClusOverlapHeadersGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c), selected header w/ overlap");
1282  fHistoClusAllHeadersGammaPt[iCut] = new TH1F("ClusGammaAllHeaders_Pt", "ClusGammaAllHeaders_Pt", nBinsClusterPt, arrClusPtBinning);
1283  fHistoClusAllHeadersGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c), all headers");
1285  fHistoClusRejectedHeadersGammaPt[iCut] = new TH1F("ClusGammaRejectedHeaders_Pt", "ClusGammaRejectedHeaders_Pt", nBinsClusterPt, arrClusPtBinning);
1286  fHistoClusRejectedHeadersGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c), rejected headers");
1288 
1290  fGammaERM02[iCut] = new TList();
1291  fGammaERM02[iCut]->SetName(Form("%s_%s_%s_%s ConvGamma-Cluster Matched",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1292  fGammaERM02[iCut]->SetOwner(kTRUE);
1293  fCutFolder[iCut]->Add(fGammaERM02[iCut]);
1294 
1295  tESDGammaERM02[iCut] = new TTree("ESD_ConvGamma_E_ConvR_M02_M20", "ESD_ConvGamma_E_ConvR_M02_M20");
1296  tESDGammaERM02[iCut]->Branch("ClusterE",&tESDClusE,"tESDClusE/F");
1297  tESDGammaERM02[iCut]->Branch("ConvR",&tESDGammaConvR,"tESDGammaConvR/F");
1298  tESDGammaERM02[iCut]->Branch("M02",&tESDClusterM02,"tESDClusterM02/F");
1299  tESDGammaERM02[iCut]->Branch("M20",&tESDClusterM20,"tESDClusterM20/F");
1300  tESDGammaERM02[iCut]->Branch("Eta",&tESDClusterEta,"tESDClusterEta/F");
1301  tESDGammaERM02[iCut]->Branch("Phi",&tESDClusterPhi,"tESDClusterPhi/F");
1302  tESDGammaERM02[iCut]->Branch("NCells",&tESDClusterNCells,"tESDClusterNCells/F");
1303  tESDGammaERM02[iCut]->Branch("MaxECell",&tESDClusterMaxECell,"tESDClusterMaxECell/F");
1304  tESDGammaERM02[iCut]->Branch("NLM",&tESDClusterNLM,"tESDClusterNLM/F");
1305  fGammaERM02[iCut]->Add(tESDGammaERM02[iCut]);
1306  }
1307 
1309  fInvMassShowerShape[iCut] = new TList();
1310  fInvMassShowerShape[iCut]->SetName(Form("%s_%s_%s_%s InvMass_ShowerShape",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1311  fInvMassShowerShape[iCut]->SetOwner(kTRUE);
1312  fCutFolder[iCut]->Add(fInvMassShowerShape[iCut]);
1313  tESDInvMassShowerShape[iCut] = new TTree("ESD_Meson_InvMass_Pt_ClusE_ClusM02_ClusM20", "ESD_Meson_InvMass_Pt_ClusE_ClusM02_ClusM20");
1314  tESDInvMassShowerShape[iCut]->Branch("MesonInvMass",&tESDIMMesonInvMass,"tESDIMMesonInvMass/F");
1315  tESDInvMassShowerShape[iCut]->Branch("MesonPt",&tESDIMMesonPt,"tESDIMMesonPt/F");
1316  tESDInvMassShowerShape[iCut]->Branch("ClusE",&tESDIMClusE,"tESDIMClusE/F");
1317  tESDInvMassShowerShape[iCut]->Branch("ClusM02",&tESDIMClusterM02,"tESDIMClusterM02/F");
1318  tESDInvMassShowerShape[iCut]->Branch("ClusM20",&tESDIMClusterM20,"tESDIMClusterM20/F");
1319  tESDInvMassShowerShape[iCut]->Branch("ClusLeadCellID",&tESDIMClusterLeadCellID,"tESDIMClusterLeadCellID/I");
1320  if(fIsMC>0) tESDInvMassShowerShape[iCut]->Branch("ClusClassification",&tESDIMClusterClassification,"tESDIMClusterClassification/I");
1321  tESDInvMassShowerShape[iCut]->Branch("ClusMatchedTrackPt",&tESDIMClusMatchedTrackPt,"tESDIMClusMatchedTrackPt/F");
1322  tESDInvMassShowerShape[iCut]->Branch("ClusTrackDeltaEta",&tESDIMClusTrackDeltaEta,"tESDIMClusTrackDeltaEta/F");
1323  tESDInvMassShowerShape[iCut]->Branch("ClusTrackDeltaPhi",&tESDIMClusTrackDeltaPhi,"tESDIMClusTrackDeltaPhi/F");
1324  tESDInvMassShowerShape[iCut]->Branch("ClusIsoSumClusterEt",&tESDIMClusterIsoSumClusterEt,"tESDIMClusterIsoSumClusterEt/F");
1325  tESDInvMassShowerShape[iCut]->Branch("ClusIsoSumTrackEt",&tESDIMClusterIsoSumTrackEt,"tESDIMClusterIsoSumTrackEt/F");
1326  fInvMassShowerShape[iCut]->Add(tESDInvMassShowerShape[iCut]);
1327  }
1328 
1329  if (fIsMC > 1){
1330  fHistoClusGammaPt[iCut]->Sumw2();
1331  fHistoClusGammaE[iCut]->Sumw2();
1332  fHistoClusOverlapHeadersGammaPt[iCut]->Sumw2();
1333  fHistoClusAllHeadersGammaPt[iCut]->Sumw2();
1334  fHistoClusRejectedHeadersGammaPt[iCut]->Sumw2();
1335  }
1336 
1337  if(fDoMesonAnalysis){
1338  fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt", "ESD_Mother_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1339  fHistoMotherInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
1340  fHistoMotherInvMassPt[iCut]->SetYTitle("p_{T,pair} (GeV/c)");
1341  fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
1342 
1343  if(!fDoLightOutput){
1344  fHistoMotherMatchedInvMassPt[iCut] = new TH2F("ESD_MotherMatched_InvMass_Pt", "ESD_MotherMatched_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1345  fHistoMotherMatchedInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) matched conv e^{+/-}to cluster");
1346  fHistoMotherMatchedInvMassPt[iCut]->SetYTitle("p_{T,pair} (GeV/c)");
1347  fESDList[iCut]->Add(fHistoMotherMatchedInvMassPt[iCut]);
1348  }
1349 
1350  fHistoMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt", "ESD_Background_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1351  fHistoMotherBackInvMassPt[iCut]->SetXTitle("M_{inv, mxed}(GeV/c^{2})");
1352  fHistoMotherBackInvMassPt[iCut]->SetYTitle("p_{T,BG pair} (GeV/c)");
1353  fESDList[iCut]->Add(fHistoMotherBackInvMassPt[iCut]);
1354 
1355  if(!fDoLightOutput){
1356  fHistoMotherInvMassPtAlpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_Pt_Alpha", "ESD_Mother_InvMass_vs_Pt_Alpha", 800, 0, 0.8, nBinsPt, arrPtBinning);
1357  fHistoMotherInvMassPtAlpha[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
1358  fHistoMotherInvMassPtAlpha[iCut]->SetYTitle("p_{T,pair} (GeV/c)");
1359  fESDList[iCut]->Add(fHistoMotherInvMassPtAlpha[iCut]);
1360 
1361  fHistoPhotonPairPtconv[iCut] = new TH2F("ESD_Mother_InvMass_PtConv", "", 800, 0, 0.8, nBinsPt, arrPtBinning);
1362  fHistoPhotonPairPtconv[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
1363  fHistoPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
1364  fESDList[iCut]->Add(fHistoPhotonPairPtconv[iCut]);
1365 
1366  fHistoPhotonPairMixedEventPtconv[iCut] = new TH2F("ESD_Background_InvMass_PtConv", "", 800, 0, 0.8, nBinsPt, arrPtBinning);
1367  fHistoPhotonPairMixedEventPtconv[iCut]->SetXTitle("M_{inv,mixed}(GeV/c^{2})");
1368  fHistoPhotonPairMixedEventPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
1369  fESDList[iCut]->Add(fHistoPhotonPairMixedEventPtconv[iCut]);
1370  }
1371 
1372  if (fIsMC > 1){
1373  fHistoMotherInvMassPt[iCut]->Sumw2();
1374  fHistoMotherBackInvMassPt[iCut]->Sumw2();
1375  if(!fDoLightOutput){
1376  fHistoMotherMatchedInvMassPt[iCut]->Sumw2();
1377  fHistoMotherInvMassPtAlpha[iCut]->Sumw2();
1378  fHistoPhotonPairPtconv[iCut]->Sumw2();
1379  fHistoPhotonPairMixedEventPtconv[iCut]->Sumw2();
1380  }
1381  }
1382 
1383  if(!fDoLightOutput){
1384  fHistoMotherInvMassECalib[iCut] = new TH2F("ESD_Mother_InvMass_E_Calib", "ESD_Mother_InvMass_E_Calib", 800, 0, 0.8, nBinsPt, arrPtBinning);
1385  fHistoMotherInvMassECalib[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
1386  fHistoMotherInvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
1387  fESDList[iCut]->Add(fHistoMotherInvMassECalib[iCut]);
1388 
1389  fHistoMotherBackInvMassECalib[iCut] = new TH2F("ESD_Background_InvMass_E_Calib", "ESD_Background_InvMass_E_Calib", 800, 0, 0.8, nBinsPt, arrPtBinning);
1390  fHistoMotherBackInvMassECalib[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
1391  fHistoMotherBackInvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
1392  fESDList[iCut]->Add(fHistoMotherBackInvMassECalib[iCut]);
1393 
1394  if (fIsMC > 1){
1395  fHistoMotherInvMassECalib[iCut]->Sumw2();
1396  fHistoMotherBackInvMassECalib[iCut]->Sumw2();
1397  }
1398  }
1399 
1400  if (fDoMesonQA > 0 ){
1401  fHistoMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y", "ESD_MotherPi0_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1402  fHistoMotherPi0PtY[iCut]->SetXTitle("p_{T, #pi^{0} cand} (GeV/c)");
1403  fHistoMotherPi0PtY[iCut]->SetYTitle("y_{#pi^{0} cand}");
1404  fESDList[iCut]->Add(fHistoMotherPi0PtY[iCut]);
1405  fHistoMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y", "ESD_MotherEta_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1406  fHistoMotherEtaPtY[iCut]->SetXTitle("p_{T, #eta cand} (GeV/c)");
1407  fHistoMotherEtaPtY[iCut]->SetYTitle("y_{ #eta cand}");
1408  fESDList[iCut]->Add(fHistoMotherEtaPtY[iCut]);
1409  fHistoMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha", "ESD_MotherPi0_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
1410  fHistoMotherPi0PtAlpha[iCut]->SetXTitle("p_{T, #pi^{0} cand} (GeV/c)");
1411  fHistoMotherPi0PtAlpha[iCut]->SetYTitle("#alpha_{#pi^{0} cand}");
1412  fESDList[iCut]->Add(fHistoMotherPi0PtAlpha[iCut]);
1413  fHistoMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha", "ESD_MotherEta_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
1414  fHistoMotherEtaPtAlpha[iCut]->SetXTitle("p_{T, #eta cand} (GeV/c)");
1415  fHistoMotherEtaPtAlpha[iCut]->SetYTitle("#alpha_{#eta cand}");
1416  fESDList[iCut]->Add(fHistoMotherEtaPtAlpha[iCut]);
1417  fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle", "ESD_MotherPi0_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
1418  fHistoMotherPi0PtOpenAngle[iCut]->SetXTitle("p_{T, #pi^{0} cand} (GeV/c)");
1419  fHistoMotherPi0PtOpenAngle[iCut]->SetYTitle("#theta_{#pi^{0} cand}");
1420  fESDList[iCut]->Add(fHistoMotherPi0PtOpenAngle[iCut]);
1421  fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle", "ESD_MotherEta_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning, 200, 0, TMath::Pi());
1422  fHistoMotherEtaPtOpenAngle[iCut]->SetXTitle("p_{T, #eta cand} (GeV/c)");
1423  fHistoMotherEtaPtOpenAngle[iCut]->SetYTitle("#theta_{#eta cand}");
1424  fESDList[iCut]->Add(fHistoMotherEtaPtOpenAngle[iCut]);
1425  fHistoMotherPi0ConvPhotonEtaPhi[iCut] = new TH2F("ESD_MotherPi0ConvPhoton_Eta_Phi", "ConvPhoton under #pi^{0}peak", 600, 0, 2*TMath::Pi(), 200, -1, 1);
1426  fHistoMotherPi0ConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
1427  fHistoMotherPi0ConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
1428  fESDList[iCut]->Add(fHistoMotherPi0ConvPhotonEtaPhi[iCut]);
1429  fHistoMotherEtaConvPhotonEtaPhi[iCut] = new TH2F("ESD_MotherEtaConvPhoton_Eta_Phi", "ConvPhoton under #eta peak", 600, 0, 2*TMath::Pi(), 200, -1, 1);
1430  fHistoMotherEtaConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
1431  fHistoMotherEtaConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
1432  fESDList[iCut]->Add(fHistoMotherEtaConvPhotonEtaPhi[iCut]);
1433  if (fIsMC > 1){
1434  fHistoMotherPi0PtY[iCut]->Sumw2();
1435  fHistoMotherEtaPtY[iCut]->Sumw2();
1436  fHistoMotherPi0PtAlpha[iCut]->Sumw2();
1437  fHistoMotherEtaPtAlpha[iCut]->Sumw2();
1438  fHistoMotherPi0PtOpenAngle[iCut]->Sumw2();
1439  fHistoMotherEtaPtOpenAngle[iCut]->Sumw2();
1440  fHistoMotherPi0ConvPhotonEtaPhi[iCut]->Sumw2();
1441  fHistoMotherEtaConvPhotonEtaPhi[iCut]->Sumw2();
1442  }
1443  }
1444  }
1445  }
1446  if(fDoMesonAnalysis){
1447  InitBack(); // Init Background Handler
1448  }
1449 
1450  if(fIsMC>0){
1451  // MC Histogramms
1452  fMCList = new TList*[fnCuts];
1453  // True Histogramms
1454  fTrueList = new TList*[fnCuts];
1455 
1456  if(!fDoLightOutput){
1457  fHistoMCHeaders = new TH1I*[fnCuts];
1458  fHistoMCAllGammaPt = new TH1F*[fnCuts];
1459  fHistoMCAllGammaEMCALAccPt = new TH1F*[fnCuts];
1461  fHistoMCDecayGammaPi0Pt = new TH1F*[fnCuts];
1462  fHistoMCDecayGammaRhoPt = new TH1F*[fnCuts];
1463  fHistoMCDecayGammaEtaPt = new TH1F*[fnCuts];
1464  fHistoMCDecayGammaOmegaPt = new TH1F*[fnCuts];
1465  fHistoMCDecayGammaEtapPt = new TH1F*[fnCuts];
1466  fHistoMCDecayGammaPhiPt = new TH1F*[fnCuts];
1467  fHistoMCDecayGammaSigmaPt = new TH1F*[fnCuts];
1468  fHistoMCConvGammaPt = new TH1F*[fnCuts];
1470  fHistoTrueConvGammaPt = new TH1F*[fnCuts];
1473 
1475  fHistoTruePrimaryConvGammaPt = new TH1F*[fnCuts];
1482  }
1483 
1484  fHistoTrueClusGammaPt = new TH1F*[fnCuts];
1485  if(!fDoLightOutput){
1486  fHistoTrueClusConvGammaPt = new TH1F*[fnCuts];
1487  fHistoTruePrimaryClusGammaPt = new TH1F*[fnCuts];
1495  fHistoTrueClusElectronPt = new TH1F*[fnCuts];
1496  }
1499 
1500  if(!fDoLightOutput){
1504  fHistoTrueClusEMNonLeadingPt = new TH1F*[fnCuts];
1505  }
1506 
1507  if(!fDoLightOutput){
1510  }
1511 
1512  if (fDoClusterQA > 0){
1514  fHistoTrueClusMergedGammaPt = new TH1F*[fnCuts];
1516  fHistoTrueClusDalitzPt = new TH1F*[fnCuts];
1517  fHistoTrueClusDalitzMergedPt = new TH1F*[fnCuts];
1519  fHistoTrueClusShowerPt = new TH1F*[fnCuts];
1520  fHistoTrueClusSubLeadingPt = new TH1F*[fnCuts];
1521  fHistoTrueClusNMothers = new TH1F*[fnCuts];
1522  }
1523 
1524  if(fDoMesonAnalysis){
1525  fHistoMCPi0Pt = new TH1F*[fnCuts];
1526  fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
1527  fHistoMCEtaPt = new TH1F*[fnCuts];
1528  fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
1529  fHistoMCPi0InAccPt = new TH1F*[fnCuts];
1530  fHistoMCPi0WOWeightInAccPt = new TH1F*[fnCuts];
1531  fHistoMCEtaInAccPt = new TH1F*[fnCuts];
1532  fHistoMCEtaWOWeightInAccPt = new TH1F*[fnCuts];
1533  if (fIsMC > 1){
1534  fHistoMCPi0WOEvtWeightPt = new TH1F*[fnCuts];
1535  fHistoMCEtaWOEvtWeightPt = new TH1F*[fnCuts];
1538  }
1539 
1543  fHistoMCSecPi0Source = new TH1F*[fnCuts];
1544  fHistoMCSecEtaPt = new TH1F*[fnCuts];
1545  fHistoMCSecEtaSource = new TH1F*[fnCuts];
1546  if (!fDoLightOutput){
1555  }
1556 
1562  fHistoMultipleCountTruePi0 = new TH1F*[fnCuts];
1564  fHistoMultipleCountTrueEta = new TH1F*[fnCuts];
1576  if(!fDoLightOutput) {
1583  fHistoTruePrimaryPi0DCPtconv = new TH1F*[fnCuts];
1587  }
1588 
1589 
1590  if (fDoMesonQA > 0){
1591  fHistoMCPi0PtY = new TH2F*[fnCuts];
1592  fHistoMCEtaPtY = new TH2F*[fnCuts];
1593  fHistoMCPi0PtAlpha = new TH2F*[fnCuts];
1594  fHistoMCEtaPtAlpha = new TH2F*[fnCuts];
1595  if (fIsMC == 2){
1596  fHistoMCPi0PtJetPt = new TH2F*[fnCuts];
1597  fHistoMCEtaPtJetPt = new TH2F*[fnCuts];
1598  }
1599 
1600  if (fIsMC < 2){
1626  }
1627  if(fDoMesonQA > 1){
1632  }
1633  fHistoTruePi0PtY = new TH2F*[fnCuts];
1634  fHistoTrueEtaPtY = new TH2F*[fnCuts];
1641  }
1642  }
1643 
1644  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1645  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
1646  TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
1647  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
1648  TString cutstringMeson = "NoMesonCut";
1649  if(fDoMesonAnalysis)
1650  cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
1651 
1652  fMCList[iCut] = new TList();
1653  fMCList[iCut]->SetName(Form("%s_%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1654  fMCList[iCut]->SetOwner(kTRUE);
1655  fCutFolder[iCut]->Add(fMCList[iCut]);
1656  if(!fDoLightOutput){
1657  fHistoMCHeaders[iCut] = new TH1I("MC_Headers", "MC_Headers", 20, 0, 20);
1658  fMCList[iCut]->Add(fHistoMCHeaders[iCut]);
1659  fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt", "MC_AllGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1660  fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
1661  fHistoMCAllGammaEMCALAccPt[iCut] = new TH1F("MC_AllGammaEMCALAcc_Pt", "MC_AllGammaEMCALAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1662  fMCList[iCut]->Add(fHistoMCAllGammaEMCALAccPt[iCut]);
1663  fHistoMCAllSecondaryGammaPt[iCut] = new TH2F("MC_AllSecondaryGamma_Pt", "MC_AllSecondaryGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 4, -0.5, 3.5);
1664  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1665  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1666  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1667  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1668  fMCList[iCut]->Add(fHistoMCAllSecondaryGammaPt[iCut]);
1669 
1670  fHistoMCDecayGammaPi0Pt[iCut] = new TH1F("MC_DecayGammaPi0_Pt", "MC_DecayGammaPi0_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1671  fMCList[iCut]->Add(fHistoMCDecayGammaPi0Pt[iCut]);
1672  fHistoMCDecayGammaRhoPt[iCut] = new TH1F("MC_DecayGammaRho_Pt", "MC_DecayGammaRho_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1673  fMCList[iCut]->Add(fHistoMCDecayGammaRhoPt[iCut]);
1674  fHistoMCDecayGammaEtaPt[iCut] = new TH1F("MC_DecayGammaEta_Pt", "MC_DecayGammaEta_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1675  fMCList[iCut]->Add(fHistoMCDecayGammaEtaPt[iCut]);
1676  fHistoMCDecayGammaOmegaPt[iCut] = new TH1F("MC_DecayGammaOmega_Pt", "MC_DecayGammaOmmega_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1677  fMCList[iCut]->Add(fHistoMCDecayGammaOmegaPt[iCut]);
1678  fHistoMCDecayGammaEtapPt[iCut] = new TH1F("MC_DecayGammaEtap_Pt", "MC_DecayGammaEtap_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1679  fMCList[iCut]->Add(fHistoMCDecayGammaEtapPt[iCut]);
1680  fHistoMCDecayGammaPhiPt[iCut] = new TH1F("MC_DecayGammaPhi_Pt", "MC_DecayGammaPhi_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1681  fMCList[iCut]->Add(fHistoMCDecayGammaPhiPt[iCut]);
1682  fHistoMCDecayGammaSigmaPt[iCut] = new TH1F("MC_DecayGammaSigma_Pt", "MC_DecayGammaSigma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1683  fMCList[iCut]->Add(fHistoMCDecayGammaSigmaPt[iCut]);
1684  fHistoMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt", "MC_ConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1685  fMCList[iCut]->Add(fHistoMCConvGammaPt[iCut]);
1686  fHistoMCSecondaryConvGammaPt[iCut] = new TH2F("MC_SecondaryConvGamma_Pt", "MC_SecondaryConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 4, -0.5, 3.5);
1687  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1688  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1689  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1690  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1691  fMCList[iCut]->Add(fHistoMCSecondaryConvGammaPt[iCut]);
1692 
1693  if (fIsMC > 1){
1694  fHistoMCAllGammaPt[iCut]->Sumw2();
1695  fHistoMCAllGammaEMCALAccPt[iCut]->Sumw2();
1696  fHistoMCAllSecondaryGammaPt[iCut]->Sumw2();
1697  fHistoMCDecayGammaPi0Pt[iCut]->Sumw2();
1698  fHistoMCDecayGammaRhoPt[iCut]->Sumw2();
1699  fHistoMCDecayGammaEtaPt[iCut]->Sumw2();
1700  fHistoMCDecayGammaOmegaPt[iCut]->Sumw2();
1701  fHistoMCDecayGammaEtapPt[iCut]->Sumw2();
1702  fHistoMCDecayGammaPhiPt[iCut]->Sumw2();
1703  fHistoMCDecayGammaSigmaPt[iCut]->Sumw2();
1704  fHistoMCConvGammaPt[iCut]->Sumw2();
1705  fHistoMCSecondaryConvGammaPt[iCut]->Sumw2();
1706  }
1707  }
1708 
1709  if(fDoMesonAnalysis){
1710  fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt", "MC_Pi0_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1711  fHistoMCPi0Pt[iCut]->Sumw2();
1712  fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
1713  fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt", "MC_Pi0_WOWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1714  fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
1715 
1716  fHistoMCEtaPt[iCut] = new TH1F("MC_Eta_Pt", "MC_Eta_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1717  fHistoMCEtaPt[iCut]->Sumw2();
1718  fMCList[iCut]->Add(fHistoMCEtaPt[iCut]);
1719  fHistoMCEtaWOWeightPt[iCut] = new TH1F("MC_Eta_WOWeights_Pt", "MC_Eta_WOWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1720  fMCList[iCut]->Add(fHistoMCEtaWOWeightPt[iCut]);
1721 
1722  fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt", "MC_Pi0InAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1723  fHistoMCPi0InAccPt[iCut]->Sumw2();
1724  fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
1725  fHistoMCPi0WOWeightInAccPt[iCut] = new TH1F("MC_Pi0WOWeightInAcc_Pt", "MC_Pi0WOWeightInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1726  fMCList[iCut]->Add(fHistoMCPi0WOWeightInAccPt[iCut]);
1727  fHistoMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt", "MC_EtaInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1728  fHistoMCEtaInAccPt[iCut]->Sumw2();
1729  fMCList[iCut]->Add(fHistoMCEtaInAccPt[iCut]);
1730  fHistoMCEtaWOWeightInAccPt[iCut] = new TH1F("MC_EtaWOWeightInAcc_Pt", "MC_EtaWOWeightInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1731  fMCList[iCut]->Add(fHistoMCEtaWOWeightInAccPt[iCut]);
1732 
1733  if (fIsMC > 1){
1734  fHistoMCPi0WOWeightPt[iCut]->Sumw2();
1735  fHistoMCEtaWOWeightPt[iCut]->Sumw2();
1736  fHistoMCPi0WOWeightInAccPt[iCut]->Sumw2();
1737  fHistoMCEtaWOWeightInAccPt[iCut]->Sumw2();
1738  fHistoMCPi0WOEvtWeightPt[iCut] = new TH1F("MC_Pi0_WOEventWeights_Pt", "MC_Pi0_WOEventWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1739  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightPt[iCut]);
1740  fHistoMCEtaWOEvtWeightPt[iCut] = new TH1F("MC_Eta_WOEventWeights_Pt", "MC_Eta_WOEventWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1741  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightPt[iCut]);
1742  fHistoMCPi0WOEvtWeightInAccPt[iCut] = new TH1F("MC_Pi0_WOEventWeightsInAcc_Pt", "MC_Pi0_WOEventWeightsInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1743  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightInAccPt[iCut]);
1744  fHistoMCEtaWOEvtWeightInAccPt[iCut] = new TH1F("MC_Eta_WOEventWeightsInAcc_Pt", "MC_Eta_WOEventWeightsInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1745  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightInAccPt[iCut]);
1746 
1747  if (fDoMesonQA > 0 && fIsMC == 2){
1748  fHistoMCPi0PtJetPt[iCut] = new TH2F("MC_Pi0_Pt_JetPt", "MC_Pi0_Pt_JetPt", nBinsQAPt, arrQAPtBinning, 200, 0, 200);
1749  fHistoMCPi0PtJetPt[iCut]->Sumw2();
1750  fMCList[iCut]->Add(fHistoMCPi0PtJetPt[iCut]);
1751  fHistoMCEtaPtJetPt[iCut] = new TH2F("MC_Eta_Pt_JetPt", "MC_Eta_Pt_JetPt", nBinsQAPt, arrQAPtBinning, 200, 0, 200);
1752  fHistoMCEtaPtJetPt[iCut]->Sumw2();
1753  fMCList[iCut]->Add(fHistoMCEtaPtJetPt[iCut]);
1754  }
1755  }
1756  fHistoMCPrimaryPtvsSource[iCut] = new TH2F("MC_Primary_Pt_Source", "MC_Primary_Pt_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 7, -0.5, 6.5);
1757  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(1,"Pi+");
1758  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(2,"Pi-");
1759  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(3,"K+");
1760  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(4,"K-");
1761  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(5,"K0s");
1762  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(6,"K0l");
1763  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(7,"Lambda");
1764  fMCList[iCut]->Add(fHistoMCPrimaryPtvsSource[iCut]);
1765 
1766  fHistoMCSecPi0Source[iCut] = new TH1F("MC_SecPi0_Source", "MC_SecPi0_Source", 5000, 0., 5000);
1767  fMCList[iCut]->Add(fHistoMCSecPi0Source[iCut]);
1768  fHistoMCSecEtaSource[iCut] = new TH1F("MC_SecEta_Source", "MC_SecEta_Source", 5000, 0, 5000);
1769  fMCList[iCut]->Add(fHistoMCSecEtaSource[iCut]);
1770  fHistoMCSecPi0PtvsSource[iCut] = new TH2F("MC_SecPi0_Pt_Source", "MC_SecPi0_Pt_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1771  fMCList[iCut]->Add(fHistoMCSecPi0PtvsSource[iCut]);
1772  fHistoMCSecPi0InAccPtvsSource[iCut] = new TH2F("MC_SecPi0InAcc_Pt_Source", "MC_SecPi0InAcc_Pt_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1773  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtvsSource[iCut]);
1774  fHistoMCSecEtaPt[iCut] = new TH1F("MC_SecEta_Pt", "MC_SecEta_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1775  fMCList[iCut]->Add(fHistoMCSecEtaPt[iCut]);
1776 
1777  if (fIsMC == 2){
1778  fHistoMCPrimaryPtvsSource[iCut]->Sumw2();
1779  fHistoMCSecPi0PtvsSource[iCut]->Sumw2();
1780  fHistoMCSecPi0InAccPtvsSource[iCut]->Sumw2();
1781  fHistoMCSecEtaPt[iCut]->Sumw2();
1782  }
1783 
1784  // book histograms for pure MC handling of PCM-Calo dir gamma reco
1785  if (!fDoLightOutput){
1786  fHistoMCPi0PtGammaLeg[iCut] = new TH2F("MC_Pi0_PtGamma_Leg", "MC_Pi0_PtGamma_Leg", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 3, -0.5, 2.5);
1787  fHistoMCPi0PtGammaLeg[iCut]->Sumw2();
1788  fMCList[iCut]->Add(fHistoMCPi0PtGammaLeg[iCut]);
1789  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);
1790  fMCList[iCut]->Add(fHistoMCPi0WOWeightPtGammaLeg[iCut]);
1791 
1792  fHistoMCPi0InAccPtGammaLeg[iCut] = new TH2F("MC_Pi0InAcc_PtGamma_Leg", "MC_Pi0InAcc_PtGamma_Leg", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 3, -0.5, 2.5);
1793  fHistoMCPi0InAccPtGammaLeg[iCut]->Sumw2();
1794  fMCList[iCut]->Add(fHistoMCPi0InAccPtGammaLeg[iCut]);
1795  fHistoMCPi0WOWeightInAccPtGammaLeg[iCut] = new TH2F("MC_Pi0WOWeightInAcc_PtGamma_Leg", "MC_Pi0WOWeightInAcc_PtGamma_Leg", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 3, -0.5, 2.5);
1796  fMCList[iCut]->Add(fHistoMCPi0WOWeightInAccPtGammaLeg[iCut]);
1797 
1798  fHistoMCSecPi0PtGamma1vsSource[iCut] = new TH2F("MC_SecPi0_PtGamma1_Source", "MC_SecPi0_PtGamma1_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1799  fMCList[iCut]->Add(fHistoMCSecPi0PtGamma1vsSource[iCut]);
1800  fHistoMCSecPi0PtGamma2vsSource[iCut] = new TH2F("MC_SecPi0_PtGamma2_Source", "MC_SecPi0_PtGamma2_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1801  fMCList[iCut]->Add(fHistoMCSecPi0PtGamma2vsSource[iCut]);
1802  fHistoMCSecPi0InAccPtGamma1vsSource[iCut] = new TH2F("MC_SecPi0InAcc_PtGamma1_Source", "MC_SecPi0InAcc_PtGamma1_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1803  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtGamma1vsSource[iCut]);
1804  fHistoMCSecPi0InAccPtGamma2vsSource[iCut] = new TH2F("MC_SecPi0InAcc_PtGamma2_Source", "MC_SecPi0InAcc_PtGamma2_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1805  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtGamma2vsSource[iCut]);
1806 
1807  if (fIsMC > 1){
1808  fHistoMCPi0WOWeightPtGammaLeg[iCut]->Sumw2();
1809  fHistoMCPi0WOWeightInAccPtGammaLeg[iCut]->Sumw2();
1810  fHistoMCSecPi0PtGamma1vsSource[iCut]->Sumw2();
1811  fHistoMCSecPi0PtGamma2vsSource[iCut]->Sumw2();
1812  fHistoMCSecPi0InAccPtGamma1vsSource[iCut]->Sumw2();
1813  fHistoMCSecPi0InAccPtGamma2vsSource[iCut]->Sumw2();
1814  }
1815  }
1816 
1817  // book additional MC QA histograms
1818  if (fDoMesonQA > 0){
1819  fHistoMCPi0PtY[iCut] = new TH2F("MC_Pi0_Pt_Y", "MC_Pi0_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1820  fHistoMCPi0PtY[iCut]->Sumw2();
1821  fMCList[iCut]->Add(fHistoMCPi0PtY[iCut]);
1822  fHistoMCEtaPtY[iCut] = new TH2F("MC_Eta_Pt_Y", "MC_Eta_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1823  fHistoMCEtaPtY[iCut]->Sumw2();
1824  fMCList[iCut]->Add(fHistoMCEtaPtY[iCut]);
1825  fHistoMCPi0PtAlpha[iCut] = new TH2F("MC_Pi0_Pt_Alpha", "MC_Pi0_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
1826  fMCList[iCut]->Add(fHistoMCPi0PtAlpha[iCut]);
1827  fHistoMCEtaPtAlpha[iCut] = new TH2F("MC_Eta_Pt_Alpha", "MC_Eta_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
1828  fMCList[iCut]->Add(fHistoMCEtaPtAlpha[iCut]);
1829 
1830  if (fIsMC == 2){
1831  fHistoMCPi0PtAlpha[iCut]->Sumw2();
1832  fHistoMCEtaPtAlpha[iCut]->Sumw2();
1833  }
1834  }
1835  }
1836 
1837  fTrueList[iCut] = new TList();
1838  fTrueList[iCut]->SetName(Form("%s_%s_%s_%s True histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1839  fTrueList[iCut]->SetOwner(kTRUE);
1840  fCutFolder[iCut]->Add(fTrueList[iCut]);
1841 
1842  if(!fDoLightOutput){
1843  fHistoTrueConvGammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt", "ESD_TrueConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1844  fHistoTrueConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1845  fTrueList[iCut]->Add(fHistoTrueConvGammaPt[iCut]);
1846 
1847  fHistoDoubleCountTrueConvGammaRPt[iCut] = new TH2F("ESD_TrueDoubleCountConvGamma_R_Pt", "ESD_TrueDoubleCountConvGamma_R_Pt", 800, 0, 200, (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1848  fHistoDoubleCountTrueConvGammaRPt[iCut]->SetXTitle("R (cm)");
1849  fHistoDoubleCountTrueConvGammaRPt[iCut]->SetYTitle("p_{T,clus} (GeV/c)");
1850  fTrueList[iCut]->Add(fHistoDoubleCountTrueConvGammaRPt[iCut]);
1851  fHistoMultipleCountTrueConvGamma[iCut] = new TH1F("ESD_TrueMultipleCountConvGamma", "ESD_TrueMultipleCountConvGamma", 10, 1, 11);
1852  fTrueList[iCut]->Add(fHistoMultipleCountTrueConvGamma[iCut]);
1853 
1854  fHistoCombinatorialPt[iCut] = new TH2F("ESD_TrueCombinatorial_Pt", "ESD_TrueCombinatorial_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1855  fHistoCombinatorialPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1856  fHistoCombinatorialPt[iCut]->SetYTitle("origin");
1857  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec+Elec");
1858  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 2,"Elec+Pion");
1859  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 3,"Elec+Kaon");
1860  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 4,"Elec+Proton");
1861  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 5,"Elec+Muon");
1862  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 6,"Pion+Pion");
1863  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 7,"Pion+Kaon");
1864  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 8,"Pion+Proton");
1865  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 9,"Pion+Muon");
1866  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(10,"Kaon+Kaon");
1867  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(11,"Kaon+Proton");
1868  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(12,"Kaon+Muon");
1869  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(13,"Proton+Proton");
1870  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(14,"Proton+Muon");
1871  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(15,"Muon+Muon");
1872  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(16,"Rest");
1873  fTrueList[iCut]->Add(fHistoCombinatorialPt[iCut]);
1874 
1875  fHistoTruePrimaryConvGammaPt[iCut] = new TH1F("ESD_TruePrimaryConvGamma_Pt", "ESD_TruePrimaryConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1876  fHistoTruePrimaryConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1877  fTrueList[iCut]->Add(fHistoTruePrimaryConvGammaPt[iCut]);
1878  fHistoTrueSecondaryConvGammaPt[iCut] = new TH2F("ESD_TrueSecondaryConvGamma_Pt", "ESD_TrueSecondaryConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 4, -0.5, 3.5);
1879  fHistoTrueSecondaryConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1880  fHistoTrueSecondaryConvGammaPt[iCut]->SetYTitle("source");
1881  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1882  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1883  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1884  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1885  fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaPt[iCut]);
1886  fHistoTrueSecondaryConvGammaMCPt[iCut] = new TH2F("ESD_TrueSecondaryConvGamma_MCPt", "ESD_TrueSecondaryConvGamma_MCPt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 4, -0.5, 3.5);
1887  fHistoTrueSecondaryConvGammaMCPt[iCut]->SetXTitle("p_{T, MC, clus} (GeV/c)");
1888  fHistoTrueSecondaryConvGammaMCPt[iCut]->SetYTitle("source");
1889  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1890  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1891  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1892  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1893  fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaMCPt[iCut]);
1894 
1895  fHistoTruePrimaryConvGammaESDPtMCPt[iCut] = new TH2F("ESD_TruePrimaryConvGammaESD_PtMCPt", "ESD_TruePrimaryConvGammaESD_PtMCPt",
1896  (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1897  fHistoTruePrimaryConvGammaESDPtMCPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1898  fHistoTruePrimaryConvGammaESDPtMCPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1900 
1901  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryConvGammaFromXFromK0sESD_MCPtPt", "ESD_TrueSecondaryConvGammaFromXFromK0sESD_MCPtPt",
1902  (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1903  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1904  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1906  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryConvGammaFromXFromK0lESD_MCPtPt", "ESD_TrueSecondaryConvGammaFromXFromK0lESD_MCPtPt",
1907  (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1908  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1909  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1911  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryConvGammaFromXFromLambdaESD_MCPtPt", "ESD_TrueSecondaryConvGammaFromXFromLambdaESD_MCPtPt",
1912  (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1913  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1914  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1916  }
1917 
1918  fHistoTrueClusGammaPt[iCut] = new TH1F("TrueClusGamma_Pt", "ESD_TrueClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1919  fHistoTrueClusGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1920  fClusterOutputList[iCut]->Add(fHistoTrueClusGammaPt[iCut]);
1921  if(!fDoLightOutput){
1922  fHistoTruePrimaryClusGammaPt[iCut] = new TH1F("TruePrimaryClusGamma_Pt", "ESD_TruePrimaryClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1923  fHistoTruePrimaryClusGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1925  fHistoTruePrimaryClusGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusGamma_Pt_MCPt", "ESD_TruePrimaryClusGamma_Pt_MCPt", nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1926  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1927  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1929  fHistoTrueClusElectronPt[iCut] = new TH1F("TrueClusElectron_Pt", "TrueElectronGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1930  fHistoTrueClusElectronPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1931  fClusterOutputList[iCut]->Add(fHistoTrueClusElectronPt[iCut]);
1932  fHistoTrueClusConvGammaPt[iCut] = new TH1F("TrueClusConvGamma_Pt", "TrueClusConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1933  fHistoTrueClusConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1935  fHistoTruePrimaryClusConvGammaPt[iCut] = new TH1F("TruePrimaryClusConvGamma_Pt", "ESD_TruePrimaryClusConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1936  fHistoTruePrimaryClusConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1938  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusConvGamma_Pt_MCPt", "ESD_TruePrimaryClusConvGamma_Pt_MCPt", nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1939  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1940  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1942 
1943  fHistoTrueSecondaryClusGammaPt[iCut] = new TH1F("TrueSecondaryClusGamma_Pt", "ESD_TrueSecondaryClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1944  fHistoTrueSecondaryClusGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1946  fHistoTrueSecondaryClusGammaFromK0sPt[iCut] = new TH1F("TrueSecondaryClusGammaFromK0s_Pt", "ESD_TrueSecondaryClusGammaFromK0s_Pt", nBinsClusterPt, arrClusPtBinning);
1947  fHistoTrueSecondaryClusGammaFromK0sPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1949  fHistoTrueSecondaryClusGammaFromK0lPt[iCut] = new TH1F("TrueSecondaryClusGammaFromK0l_Pt", "ESD_TrueSecondaryClusGammaFromK0l_Pt", nBinsClusterPt, arrClusPtBinning);
1950  fHistoTrueSecondaryClusGammaFromK0lPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1952  fHistoTrueSecondaryClusGammaFromLambdaPt[iCut] = new TH1F("TrueSecondaryClusGammaFromLambda_Pt", "ESD_TrueSecondaryClusGammaFromLambda_Pt", nBinsClusterPt, arrClusPtBinning);
1953  fHistoTrueSecondaryClusGammaFromLambdaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1955  }
1956 
1957  fHistoDoubleCountTrueClusterGammaPt[iCut] = new TH2F("TrueDoubleCountClusterGamma_Pt", "TrueDoubleCountClusterGamma_Pt", nBinsClusterPt, arrClusPtBinning, 2, 0, 2);
1958  fHistoDoubleCountTrueClusterGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1960  fHistoMultipleCountTrueClusterGamma[iCut] = new TH1F("TrueMultipleCountClusterGamma", "TrueMultipleCountClusterGamma", 10, 1, 11);
1962  if(!fDoLightOutput) {
1963  fHistoTrueNLabelsInClusPt[iCut] = new TH2F("TrueNLabelsInClus_Pt", "TrueNLabelsInClus_Pt", 100, -0.5, 99.5, nBinsClusterPt, arrClusPtBinning);
1964  fHistoTrueNLabelsInClusPt[iCut]->SetYTitle("p_{T,clus} (GeV/c)");
1966  fHistoTrueClusGammaEM02[iCut] = new TH2F("TrueClusGammaEM02", "TrueClusGammaEM02", nBinsClusterPt, arrClusPtBinning, 400, 0, 5);
1967  fClusterOutputList[iCut]->Add(fHistoTrueClusGammaEM02[iCut]);
1968  fHistoTrueClusPi0EM02[iCut] = new TH2F("TrueClusPi0EM02", "TrueClusPi0EM02", nBinsClusterPt, arrClusPtBinning, 400, 0, 5);
1969  fClusterOutputList[iCut]->Add(fHistoTrueClusPi0EM02[iCut]);
1970  fHistoTrueClusEMNonLeadingPt[iCut] = new TH1F("TrueClusEMNonLeading_Pt", "TrueClusEMNonLeading_Pt", nBinsClusterPt, arrClusPtBinning);
1971  fHistoTrueClusEMNonLeadingPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1973  }
1974 
1975 
1976  if (fIsMC > 1){
1977  if(!fDoLightOutput){
1978  fHistoTrueConvGammaPt[iCut]->Sumw2();
1979  fHistoDoubleCountTrueConvGammaRPt[iCut]->Sumw2();
1980  fHistoMultipleCountTrueConvGamma[iCut]->Sumw2();
1981  fHistoCombinatorialPt[iCut]->Sumw2();
1982  fHistoTruePrimaryConvGammaPt[iCut]->Sumw2();
1983  fHistoTrueSecondaryConvGammaPt[iCut]->Sumw2();
1984  fHistoTrueSecondaryConvGammaMCPt[iCut]->Sumw2();
1985  fHistoTruePrimaryConvGammaESDPtMCPt[iCut]->Sumw2();
1989  }
1990  fHistoTrueClusGammaPt[iCut]->Sumw2();
1991  fHistoDoubleCountTrueClusterGammaPt[iCut]->Sumw2();
1992  fHistoMultipleCountTrueClusterGamma[iCut]->Sumw2();
1993  if(!fDoLightOutput) {
1994  fHistoTruePrimaryClusGammaPt[iCut]->Sumw2();
1995  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->Sumw2();
1996  fHistoTrueNLabelsInClusPt[iCut]->Sumw2();
1997  fHistoTrueClusGammaEM02[iCut]->Sumw2();
1998  fHistoTrueClusPi0EM02[iCut]->Sumw2();
1999  fHistoTrueClusElectronPt[iCut]->Sumw2();
2000  fHistoTrueClusConvGammaPt[iCut]->Sumw2();
2001  fHistoTruePrimaryClusConvGammaPt[iCut]->Sumw2();
2003  fHistoTrueClusEMNonLeadingPt[iCut]->Sumw2();
2004  fHistoTrueSecondaryClusGammaPt[iCut]->Sumw2();
2008  }
2009  }
2010 
2011  if(!fDoLightOutput){
2012  fHistoTruePi0InvMassECalib[iCut] = new TH2F("True_Pi0_InvMass_E_Calib", "True_Pi0_InvMass_E_Calib", 800, 0, 0.8, nBinsPt, arrPtBinning);
2013  fHistoTruePi0InvMassECalib[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
2014  fHistoTruePi0InvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
2015  fESDList[iCut]->Add(fHistoTruePi0InvMassECalib[iCut]);
2016  fHistoTruePi0PureGammaInvMassECalib[iCut] = new TH2F("True_Pi0PureGamma_InvMass_E_Calib", "True_Pi0PureGamma_InvMass_E_Calib", 800, 0, 0.8, nBinsPt, arrPtBinning);
2017  fHistoTruePi0PureGammaInvMassECalib[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
2018  fHistoTruePi0PureGammaInvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
2020  }
2021 
2022  if (fDoClusterQA > 0){
2023  fHistoTrueClusConvGammaFullyPt[iCut] = new TH1F("TrueClusConvGammaFullyContained_Pt", "TrueClusConvGammaFullyContained_Pt", nBinsClusterPt, arrClusPtBinning);
2024  fHistoTrueClusConvGammaFullyPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2026  fHistoTrueClusMergedGammaPt[iCut] = new TH1F("TrueClusMergedGamma_Pt", "TrueClusMergedGamma_Pt", nBinsClusterPt, arrClusPtBinning);
2027  fHistoTrueClusMergedGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2029  fHistoTrueClusMergedPartConvGammaPt[iCut] = new TH1F("TrueClusMergedPartConvGamma_Pt", "TrueClusMergedPartConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
2030  fHistoTrueClusMergedPartConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2032  fHistoTrueClusDalitzPt[iCut] = new TH1F("TrueClusDalitz_Pt", "TrueClusDalitz_Pt", nBinsClusterPt, arrClusPtBinning);
2033  fHistoTrueClusDalitzPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2034  fClusterOutputList[iCut]->Add(fHistoTrueClusDalitzPt[iCut]);
2035  fHistoTrueClusDalitzMergedPt[iCut] = new TH1F("TrueClusDalitzMerged_Pt", "TrueClusDalitzMerged_Pt", nBinsClusterPt, arrClusPtBinning);
2036  fHistoTrueClusDalitzMergedPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2038  fHistoTrueClusPhotonFromElecMotherPt[iCut] = new TH1F("TrueClusPhotonFromElecMother_Pt", "TrueClusPhotonFromElecMother_Pt", nBinsClusterPt, arrClusPtBinning);
2039  fHistoTrueClusPhotonFromElecMotherPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2041  fHistoTrueClusShowerPt[iCut] = new TH1F("TrueClusShower_Pt", "TrueClusShower_Pt", nBinsClusterPt, arrClusPtBinning);
2042  fHistoTrueClusShowerPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2043  fClusterOutputList[iCut]->Add(fHistoTrueClusShowerPt[iCut]);
2044  fHistoTrueClusSubLeadingPt[iCut] = new TH1F("TrueClusSubleading_Pt", "TrueClusSubleading_Pt", nBinsClusterPt, arrClusPtBinning);
2045  fHistoTrueClusSubLeadingPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2047  fHistoTrueClusNMothers[iCut] = new TH1F("TrueClusNParticles", "TrueClusNParticles", 20, 0, 20);
2048  fHistoTrueClusNMothers[iCut]->SetXTitle("# particles in cluster");
2049  fClusterOutputList[iCut]->Add(fHistoTrueClusNMothers[iCut]);
2050  if (fIsMC > 1){
2051  fHistoTrueClusConvGammaFullyPt[iCut]->Sumw2();
2052  fHistoTrueClusMergedGammaPt[iCut]->Sumw2();
2053  fHistoTrueClusMergedPartConvGammaPt[iCut]->Sumw2();
2054  fHistoTrueClusDalitzPt[iCut]->Sumw2();
2055  fHistoTrueClusDalitzMergedPt[iCut]->Sumw2();
2056  fHistoTrueClusPhotonFromElecMotherPt[iCut]->Sumw2();
2057  fHistoTrueClusShowerPt[iCut]->Sumw2();
2058  fHistoTrueClusSubLeadingPt[iCut]->Sumw2();
2059  fHistoTrueClusNMothers[iCut]->Sumw2();
2060  }
2061  }
2062 
2063  if(fDoMesonAnalysis){
2064  fHistoTruePi0InvMassPt[iCut] = new TH2F("ESD_TruePi0_InvMass_Pt", "ESD_TruePi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2065  fHistoTruePi0InvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2066  fHistoTruePi0InvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2067  fTrueList[iCut]->Add(fHistoTruePi0InvMassPt[iCut]);
2068  fHistoTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueEta_InvMass_Pt", "ESD_TrueEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2069  fHistoTrueEtaInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2})");
2070  fHistoTrueEtaInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2071  fTrueList[iCut]->Add(fHistoTrueEtaInvMassPt[iCut]);
2072  fHistoTruePi0MatchedInvMassPt[iCut] = new TH2F("ESD_TruePi0_Matched_InvMass_Pt", "ESD_TruePi0_Matched_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2073  fHistoTruePi0MatchedInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2074  fHistoTruePi0MatchedInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2075  fTrueList[iCut]->Add(fHistoTruePi0MatchedInvMassPt[iCut]);
2076  fHistoTrueEtaMatchedInvMassPt[iCut] = new TH2F("ESD_TrueEta_Matched_InvMass_Pt", "ESD_TrueEta_Matched_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2077  fHistoTrueEtaMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2})");
2078  fHistoTrueEtaMatchedInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2079  fTrueList[iCut]->Add(fHistoTrueEtaMatchedInvMassPt[iCut]);
2080 
2081  fHistoDoubleCountTruePi0InvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountPi0_InvMass_Pt", "ESD_TrueDoubleCountPi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2082  fHistoDoubleCountTruePi0InvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2083  fHistoDoubleCountTruePi0InvMassPt[iCut]->SetYTitle("#pi^{0} p_{T}(GeV/c)");
2084  fTrueList[iCut]->Add(fHistoDoubleCountTruePi0InvMassPt[iCut]);
2085  fHistoMultipleCountTruePi0[iCut] = new TH1F("ESD_TrueMultipleCountPi0", "ESD_TrueMultipleCountPi0", 10, 1, 11);
2086  fHistoMultipleCountTruePi0[iCut]->SetXTitle("# number of multiple counts");
2087  fTrueList[iCut]->Add(fHistoMultipleCountTruePi0[iCut]);
2088  fHistoDoubleCountTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountEta_InvMass_Pt", "ESD_TrueDoubleCountEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2089  fHistoDoubleCountTrueEtaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2090  fHistoDoubleCountTrueEtaInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2091  fTrueList[iCut]->Add(fHistoDoubleCountTrueEtaInvMassPt[iCut]);
2092  fHistoMultipleCountTrueEta[iCut] = new TH1F("ESD_TrueMultipleCountEta", "ESD_TrueMultipleCountEta", 10, 1, 11);
2093  fHistoMultipleCountTrueEta[iCut]->SetXTitle("# number of multiple counts");
2094  fTrueList[iCut]->Add(fHistoMultipleCountTrueEta[iCut]);
2095 
2096  fHistoTruePrimaryPi0InvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_Pt", "ESD_TruePrimaryPi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2097  fHistoTruePrimaryPi0InvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}}(GeV/c^{2})");
2098  fHistoTruePrimaryPi0InvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2099  fHistoTruePrimaryPi0InvMassPt[iCut]->Sumw2();
2100  fTrueList[iCut]->Add(fHistoTruePrimaryPi0InvMassPt[iCut]);
2101 
2102  fHistoTruePrimaryEtaInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEta_InvMass_Pt", "ESD_TruePrimaryEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2103  fHistoTruePrimaryEtaInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta}(GeV/c^{2})");
2104  fHistoTruePrimaryEtaInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2105  fHistoTruePrimaryEtaInvMassPt[iCut]->Sumw2();
2106  fTrueList[iCut]->Add(fHistoTruePrimaryEtaInvMassPt[iCut]);
2107 
2108  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt", "ESD_TruePrimaryPi0W0Weights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2109  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}}(GeV/c^{2})");
2110  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2112 
2113  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEtaW0Weights_InvMass_Pt", "ESD_TruePrimaryEtaW0Weights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2114  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta}(GeV/c^{2})");
2115  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2117 
2118  fProfileTruePrimaryPi0WeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryPi0Weights_InvMass_Pt", "ESD_TruePrimaryPi0Weights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2119  fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}}(GeV/c^{2})");
2120  fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2123  fProfileTruePrimaryEtaWeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryEtaWeights_InvMass_Pt", "ESD_TruePrimaryEtaWeights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2124  fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta}(GeV/c^{2})");
2125  fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2128 
2129  fHistoTrueSecondaryPi0InvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_Pt", "ESD_TrueSecondaryPi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2130  fHistoTrueSecondaryPi0InvMassPt[iCut]->SetXTitle("M_{inv,sec #pi^{0}}(GeV/c^{2})");
2131  fHistoTrueSecondaryPi0InvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2132  fHistoTrueSecondaryPi0InvMassPt[iCut]->Sumw2();
2133  fTrueList[iCut]->Add(fHistoTrueSecondaryPi0InvMassPt[iCut]);
2134 
2135  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_Pt", "ESD_TrueSecondaryPi0FromK0s_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2136  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from K^{0}_{S}}(GeV/c^{2})");
2137  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2140  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0l_InvMass_Pt", "ESD_TrueSecondaryPi0FromK0l_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2141  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from K^{0}_{L}}(GeV/c^{2})");
2142  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2145  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromEta_InvMass_Pt", "ESD_TrueSecondaryPi0FromEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2146  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from #eta}(GeV/c^{2})");
2147  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2149  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_Pt", "ESD_TrueSecondaryPi0FromLambda_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2150  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from #Lambda}(GeV/c^{2})");
2151  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2153 
2154  if(!fDoLightOutput) {
2155  fHistoTruePrimaryPi0PhotonPairPtconv[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_PtConv", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2156  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2157  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2158  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->Sumw2();
2160 
2161  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2162  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2163  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2165 
2166  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_PtConv", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2167  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2168  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2171 
2172  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_PtConv", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2173  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2174  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2177 
2178  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0l_InvMass_PtConv", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2179  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2180  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2183 
2184  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv[iCut]= new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_PtConv", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2185  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2186  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2189 
2190  fHistoTruePrimaryPi0DCPtconv[iCut] = new TH1F("ESD_TruePrimaryPi0DC_PtConv", "", nBinsPt, arrPtBinning);
2191  fHistoTruePrimaryPi0DCPtconv[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
2192  fHistoTruePrimaryPi0DCPtconv[iCut]->Sumw2();
2193  fTrueList[iCut]->Add(fHistoTruePrimaryPi0DCPtconv[iCut]);
2194 
2195  fHistoTrueSecondaryPi0DCPtconvSource[iCut] = new TH2F("ESD_TrueSecondaryPi0DC_PtConv_Source", "", nBinsPt, arrPtBinning, 4, -0.5, 3.5);
2196  fHistoTrueSecondaryPi0DCPtconvSource[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
2197  fHistoTrueSecondaryPi0DCPtconvSource[iCut]->SetYTitle("sec. source");
2198  fHistoTrueSecondaryPi0DCPtconvSource[iCut]->Sumw2();
2200 
2201  fHistoTruePrimaryPi0MissingPtconv[iCut] = new TH1F("ESD_TruePrimaryPi0Missing_PtConv", "", nBinsPt, arrPtBinning);
2202  fHistoTruePrimaryPi0MissingPtconv[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
2203  fHistoTruePrimaryPi0MissingPtconv[iCut]->Sumw2();
2204  fTrueList[iCut]->Add(fHistoTruePrimaryPi0MissingPtconv[iCut]);
2205 
2206  fHistoTrueSecondaryPi0MissingPtconvSource[iCut] = new TH2F("ESD_TrueSecondaryPi0Missing_PtConv_Source", "", nBinsPt, arrPtBinning, 4, -0.5, 3.5);
2207  fHistoTrueSecondaryPi0MissingPtconvSource[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
2208  fHistoTrueSecondaryPi0MissingPtconvSource[iCut]->SetYTitle("sec. source");
2211 
2212  // put proper summing for JJ weights
2213  if (fIsMC > 1){
2215  }
2216  }
2217 
2218  if (fIsMC > 1){
2219  fHistoTruePi0InvMassPt[iCut]->Sumw2();
2220  fHistoTrueEtaInvMassPt[iCut]->Sumw2();
2221  fHistoTruePi0MatchedInvMassPt[iCut]->Sumw2();
2222  fHistoTrueEtaMatchedInvMassPt[iCut]->Sumw2();
2223  fHistoDoubleCountTruePi0InvMassPt[iCut]->Sumw2();
2224  fHistoMultipleCountTruePi0[iCut]->Sumw2();
2225  fHistoDoubleCountTrueEtaInvMassPt[iCut]->Sumw2();
2226  fHistoMultipleCountTrueEta[iCut]->Sumw2();
2231  }
2232 
2233  if (fDoMesonQA > 0){
2234  if (fIsMC < 2){
2235  fHistoTruePi0CaloPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloPhoton_InvMass_Pt", "ESD_TruePi0CaloPhoton_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2236  fHistoTruePi0CaloPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma #gamma");
2237  fHistoTruePi0CaloPhotonInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2238  fTrueList[iCut]->Add(fHistoTruePi0CaloPhotonInvMassPt[iCut]);
2239 
2240  fHistoTrueEtaCaloPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloPhoton_InvMass_Pt", "ESD_TrueEtaCaloPhoton_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2241  fHistoTrueEtaCaloPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma #gamma");
2242  fHistoTrueEtaCaloPhotonInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2243  fTrueList[iCut]->Add(fHistoTrueEtaCaloPhotonInvMassPt[iCut]);
2244 
2245  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhoton_InvMass_Pt", "ESD_TruePi0CaloConvertedPhoton_InvMass_Pt",
2246  800, 0, 0.8, nBinsPt, arrPtBinning);
2247  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma #gamma_{conv}");
2248  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2250 
2251  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt", "ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt",
2252  800, 0, 0.8, nBinsPt, arrPtBinning);
2253  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma #gamma_{conv,matched}");
2254  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2256 
2257  fHistoTruePi0CaloConvPhotonConvRPt[iCut] = new TH2F("ESD_TruePi0CaloConvPhoton_ConvR_PtE", "ESD_TruePi0CaloConvPhoton_ConvR_PtE", 920, 0, 460, nBinsPt, arrPtBinning);
2258  fHistoTruePi0CaloConvPhotonConvRPt[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2259  fHistoTruePi0CaloConvPhotonConvRPt[iCut]->SetYTitle("e^{#pm}p_{T}(GeV/c)");
2261 
2262  fHistoTruePi0CaloConvPhotonConvRAlpha[iCut] = new TH2F("ESD_TruePi0CaloConvPhoton_ConvR_AlphaE", "ESD_TruePi0CaloConvPhoton_ConvR_AlphaE", 920, 0, 460, 200, -1, 1);
2263  fHistoTruePi0CaloConvPhotonConvRAlpha[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2264  fHistoTruePi0CaloConvPhotonConvRAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2266 
2267  fHistoTruePi0CaloConvPhotonPtAlpha[iCut] = new TH2F("ESD_TruePi0CaloConvPhoton_PtE_AlphaE", "ESD_TruePi0CaloConvPhoton_PtE_AlphaE", nBinsPt, arrPtBinning, 200, -1, 1);
2268  fHistoTruePi0CaloConvPhotonPtAlpha[iCut]->SetXTitle("e^{#pm}p_{T}(GeV/c)");
2269  fHistoTruePi0CaloConvPhotonPtAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2271 
2272  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt", "ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt",
2273  800, 0, 0.8, nBinsPt, arrPtBinning);
2274  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma #gamma_{conv}");
2275  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2277 
2278  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt", "ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt",
2279  800, 0, 0.8, nBinsPt, arrPtBinning);
2280  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma #gamma_{conv,matched}");
2281  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2283 
2284  fHistoTrueEtaCaloConvPhotonConvRPt[iCut] = new TH2F("ESD_TrueEtaCaloConvPhoton_ConvR_PtE", "ESD_TrueEtaCaloConvPhoton_ConvR_PtE", 920, 0, 460, nBinsPt, arrPtBinning);
2285  fHistoTrueEtaCaloConvPhotonConvRPt[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2286  fHistoTrueEtaCaloConvPhotonConvRPt[iCut]->SetYTitle("e^{#pm}p_{T}(GeV/c)");
2288 
2289  fHistoTrueEtaCaloConvPhotonConvRAlpha[iCut] = new TH2F("ESD_TrueEtaCaloConvPhoton_ConvR_AlphaE", "ESD_TrueEtaCaloConvPhoton_ConvR_AlphaE", 920, 0, 460, 200, -1, 1);
2290  fHistoTrueEtaCaloConvPhotonConvRAlpha[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2291  fHistoTrueEtaCaloConvPhotonConvRAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2293 
2294  fHistoTrueEtaCaloConvPhotonPtAlpha[iCut] = new TH2F("ESD_TrueEtaCaloConvPhoton_PtE_AlphaE", "ESD_TrueEtaCaloConvPhoton_PtE_AlphaE", nBinsPt, arrPtBinning, 200, -1, 1);
2295  fHistoTrueEtaCaloConvPhotonPtAlpha[iCut]->SetXTitle("e^{#pm}p_{T}(GeV/c)");
2296  fHistoTrueEtaCaloConvPhotonPtAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2298 
2299 
2300  fHistoTruePi0CaloElectronInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloElectron_InvMass_Pt", "ESD_TruePi0CaloElectron_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2301  fHistoTruePi0CaloElectronInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma e^{#pm}");
2302  fHistoTruePi0CaloElectronInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2304  fHistoTrueEtaCaloElectronInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloElectron_InvMass_Pt", "ESD_TrueEtaCaloElectron_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2305  fHistoTrueEtaCaloElectronInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma e^{#pm}");
2306  fHistoTrueEtaCaloElectronInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2308 
2309  fHistoTruePi0CaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedCluster_InvMass_Pt", "ESD_TruePi0CaloMergedCluster_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2310  fHistoTruePi0CaloMergedClusterInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma merged cluster");
2311  fHistoTruePi0CaloMergedClusterInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2313  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedCluster_InvMass_Pt", "ESD_TrueEtaCaloMergedCluster_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2314  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma merged cluster");
2315  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2317 
2318  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloEMNonLeading_InvMass_Pt", "ESD_TrueMotherCaloEMNonLeading_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2319  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) #gamma cluster no leading EM");
2320  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2322  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt", "ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt",
2323  800, 0, 0.8, nBinsPt, arrPtBinning);
2324  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma merged cluster, part conv");
2325  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2327  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt", "ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt",
2328  800, 0, 0.8, nBinsPt, arrPtBinning);
2329  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma merged cluster, part conv");
2330  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2332 
2333  fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt", "ESD_TruePrimaryPi0_ResolPt_MCPt", 500, 0.03, 25, 1000, -1., 1.);
2334  fHistoTruePrimaryPi0MCPtResolPt[iCut]->SetXTitle("#pi^{0}p_{T,MC}(GeV/c)");
2335  fHistoTruePrimaryPi0MCPtResolPt[iCut]->SetYTitle("#pi^{0}(p_{T,rec}-p_{T,MC})/p_{T,MC}()");
2336  fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
2338  fTrueList[iCut]->Add(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
2339 
2340  fHistoTruePrimaryEtaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt", "ESD_TruePrimaryEta_ResolPt_MCPt", 500, 0.03, 25, 1000, -1., 1.);
2341  fHistoTruePrimaryEtaMCPtResolPt[iCut]->SetXTitle("#eta p_{T,MC}(GeV/c)");
2342  fHistoTruePrimaryEtaMCPtResolPt[iCut]->SetYTitle("#eta (p_{T,rec}-p_{T,MC})/p_{T,MC}()");
2343  fHistoTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
2345  fTrueList[iCut]->Add(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
2346 
2347  fHistoTrueK0sWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0sWithPi0Daughter_MCPt", "ESD_TrueK0sWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2348  fHistoTrueK0sWithPi0DaughterMCPt[iCut]->SetXTitle("K^{0}_{s}p_{MC,T}(GeV/c) for K^{0}_{s}where #pi^{0}rec ");
2349  fTrueList[iCut]->Add(fHistoTrueK0sWithPi0DaughterMCPt[iCut]);
2350  fHistoTrueK0lWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0lWithPi0Daughter_MCPt", "ESD_TrueK0lWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2351  fHistoTrueK0lWithPi0DaughterMCPt[iCut]->SetXTitle("K^{0}_{s}p_{MC,T}(GeV/c) for K^{0}_{l}where #pi^{0}rec ");
2352  fTrueList[iCut]->Add(fHistoTrueK0lWithPi0DaughterMCPt[iCut]);
2353  fHistoTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt", "ESD_TrueEtaWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2354  fHistoTrueEtaWithPi0DaughterMCPt[iCut]->SetXTitle("#eta p_{MC,T}(GeV/c) for #eta where #pi^{0}rec ");
2355  fTrueList[iCut]->Add(fHistoTrueEtaWithPi0DaughterMCPt[iCut]);
2356  fHistoTrueLambdaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueLambdaWithPi0Daughter_MCPt", "ESD_TrueLambdaWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2357  fHistoTrueLambdaWithPi0DaughterMCPt[iCut]->SetXTitle("#Lambda p_{MC,T}(GeV/c) for #Lambda where #pi^{0}rec ");
2359  }
2360  if(fDoMesonQA>1){
2361  fHistoTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt", "ESD_TrueBckGG_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2362  fHistoTrueBckGGInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) #gamma #gamma no signal");
2363  fHistoTrueBckGGInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2364  fTrueList[iCut]->Add(fHistoTrueBckGGInvMassPt[iCut]);
2365  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut] = new TH2F("ESD_TrueBckFullMesonContained_InvMass_Pt", "ESD_TrueBckFullMesonContained_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2366  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) #gamma #gamma, calo gamma with full pi0");
2367  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2369  fHistoTrueBckAsymEClustersInvMassPt[iCut] = new TH2F("ESD_TrueBckAsymEClus_InvMass_Pt", "ESD_TrueBckAsymEClus_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2370  fHistoTrueBckAsymEClustersInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) #gamma #gamma, calo gamma >70% of pi0 energy");
2371  fHistoTrueBckAsymEClustersInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2373  fHistoTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt", "ESD_TrueBckCont_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2374  fHistoTrueBckContInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) contamination");
2375  fHistoTrueBckContInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2376  fTrueList[iCut]->Add(fHistoTrueBckContInvMassPt[iCut]);
2377  }
2378  fHistoTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y", "ESD_TruePi0_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
2379  fHistoTruePi0PtY[iCut]->SetYTitle("Y_{#pi^{0}}");
2380  fHistoTruePi0PtY[iCut]->SetXTitle("#pi^{0}p_{T}(GeV/c)");
2381  fTrueList[iCut]->Add(fHistoTruePi0PtY[iCut]);
2382  fHistoTrueEtaPtY[iCut] = new TH2F("ESD_TrueEta_Pt_Y", "ESD_TrueEta_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
2383  fHistoTrueEtaPtY[iCut]->SetYTitle("Y_{#eta}");
2384  fHistoTrueEtaPtY[iCut]->SetXTitle("#eta p_{T}(GeV/c)");
2385  fTrueList[iCut]->Add(fHistoTrueEtaPtY[iCut]);
2386  fHistoTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha", "ESD_TruePi0_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
2387  fHistoTruePi0PtAlpha[iCut]->SetYTitle("#alpha_{#pi^{0}}");
2388  fHistoTruePi0PtAlpha[iCut]->SetXTitle("#pi^{0}p_{T}(GeV/c)");
2389  fTrueList[iCut]->Add(fHistoTruePi0PtAlpha[iCut]);
2390  fHistoTrueEtaPtAlpha[iCut] = new TH2F("ESD_TrueEta_Pt_Alpha", "ESD_TrueEta_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
2391  fHistoTrueEtaPtAlpha[iCut]->SetYTitle("#alpha_{#eta}");
2392  fHistoTrueEtaPtAlpha[iCut]->SetXTitle("#eta p_{T}(GeV/c)");
2393  fTrueList[iCut]->Add(fHistoTrueEtaPtAlpha[iCut]);
2394 
2395  fHistoTruePi0PtOpenAngle[iCut] = new TH2F("ESD_TruePi0_Pt_OpenAngle", "ESD_TruePi0_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
2396  fHistoTruePi0PtOpenAngle[iCut]->SetYTitle("#theta_{#pi^{0}}");
2397  fHistoTruePi0PtOpenAngle[iCut]->SetXTitle("#pi^{0}p_{T}(GeV/c)");
2398  fTrueList[iCut]->Add(fHistoTruePi0PtOpenAngle[iCut]);
2399  fHistoTrueEtaPtOpenAngle[iCut] = new TH2F("ESD_TrueEta_Pt_OpenAngle", "ESD_TrueEta_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning, 200, 0, TMath::Pi());
2400  fHistoTrueEtaPtOpenAngle[iCut]->SetYTitle("#theta_{#eta}");
2401  fHistoTrueEtaPtOpenAngle[iCut]->SetXTitle("#eta p_{T}(GeV/c)");
2402  fTrueList[iCut]->Add(fHistoTrueEtaPtOpenAngle[iCut]);
2403 
2404  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut] = new TH2F("ESD_TrueMotherPi0ConvPhoton_Eta_Phi", "conv photons for true #pi^{0}", 600, 0, 2*TMath::Pi(), 200, -1, 1);
2405  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
2406  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
2408  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut] = new TH2F("ESD_TrueMotherEtaConvPhoton_Eta_Phi", "conv photons for true #eta", 600, 0, 2*TMath::Pi(), 200, -1, 1);
2409  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
2410  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
2412 
2413  if (fIsMC > 1){
2414  if(fDoMesonQA>1){
2415  fHistoTrueBckGGInvMassPt[iCut]->Sumw2();
2417  fHistoTrueBckAsymEClustersInvMassPt[iCut]->Sumw2();
2418  fHistoTrueBckContInvMassPt[iCut]->Sumw2();
2419  }
2420  fHistoTruePi0PtY[iCut]->Sumw2();
2421  fHistoTrueEtaPtY[iCut]->Sumw2();
2422  fHistoTruePi0PtAlpha[iCut]->Sumw2();
2423  fHistoTrueEtaPtAlpha[iCut]->Sumw2();
2424  fHistoTruePi0PtOpenAngle[iCut]->Sumw2();
2425  fHistoTrueEtaPtOpenAngle[iCut]->Sumw2();
2426  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->Sumw2();
2427  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->Sumw2();
2428  }
2429  }
2430  }
2431  }
2432  }
2433 
2438 
2439  fMapMultipleCountTruePi0s.clear();
2440  fMapMultipleCountTrueEtas.clear();
2443 
2444  fVectorRecTruePi0s.clear();
2445  fVectorRecTrueEtas.clear();
2446 
2447  if(fV0Reader)
2449  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
2450  fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
2451  if(fV0Reader)
2453  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
2454  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
2455 
2459 
2460  for(Int_t iMatcherTask = 0; iMatcherTask < 3; iMatcherTask++){
2461  AliCaloTrackMatcher* temp = (AliCaloTrackMatcher*) (AliAnalysisManager::GetAnalysisManager()->GetTask(Form("CaloTrackMatcher_%i_%i",iMatcherTask,fTrackMatcherRunningMode)));
2462  if(temp) fOutputContainer->Add(temp->GetCaloTrackMatcherHistograms());
2463  }
2464 
2465  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2466  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
2467  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
2468  fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
2469  }
2470  if(!((AliConversionPhotonCuts*)fCutArray->At(iCut))) continue;
2471  if(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms()){
2472  fCutFolder[iCut]->Add(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms());
2473  }
2474  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
2475  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
2476  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
2477  }
2478  if(fSetPlotHistsExtQA){
2479  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
2480  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms()){
2481  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms());
2482  }
2483  }
2484  if(fDoMesonAnalysis){
2485  if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
2486  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
2487  fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
2488  }
2489  }
2490  }
2491 
2492  if (fIsMC > 0){
2493  tBrokenFiles = new TTree("BrokenFiles", "BrokenFiles");
2494  tBrokenFiles->Branch("fileName",&fFileNameBroken);
2496  }
2497 
2498 
2499  PostData(1, fOutputContainer);
2500  if(fDoPhotonQA == 2){
2501  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2502  OpenFile(iCut+2);
2503  PostData(iCut+2, fTreeConvGammaPtDcazCat[iCut]);
2504  }
2505  }
2506 }
2507 //_____________________________________________________________________________
2509 {
2510  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2511  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
2512  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
2513  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
2514  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
2515  }
2516 
2517  if(fIsHeavyIon == 2){
2518  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
2519  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2520  continue; // No Eta Shift requested, continue
2521  }
2522  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
2523  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
2524  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2525  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
2526  continue;
2527  } else{
2528  printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
2529  (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
2530  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2531  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
2532  }
2533  }
2534  }
2535 
2536  return kTRUE;
2537 }
2538 //_____________________________________________________________________________
2540 {
2541  //
2542  // Called for each event
2543  //
2544  fInputEvent = InputEvent();
2545 
2546  if(fIsMC > 0) fMCEvent = MCEvent();
2547 
2548  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
2549  if(fInputEvent->IsIncompleteDAQ()==kTRUE) eventQuality = 2;// incomplete event
2550  // Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1 or because it is incomplete => abort processing of this event/file
2551  if(eventQuality == 2 || eventQuality == 3){
2552  // write out name of broken file for first event
2553  if (fIsMC > 0){
2554  if (fInputEvent->IsA()==AliESDEvent::Class()){
2555  if (((AliESDEvent*)fInputEvent)->GetEventNumberInFile() == 0){
2556  fFileNameBroken = new TObjString(Form("%s",((TString)fV0Reader->GetCurrentFileName()).Data()));
2557  if (tBrokenFiles) tBrokenFiles->Fill();
2558  delete fFileNameBroken;
2559  }
2560  }
2561  }
2562 
2563  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
2564  fHistoNEvents[iCut]->Fill(eventQuality);
2565  if (fIsMC > 1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
2566  }
2567  return;
2568  }
2569 
2570 
2571 // if(fInputEvent->IsA()==AliAODEvent::Class()){
2572 // fInputEvent->InitMagneticField();
2573 // }
2574 
2575  fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
2576 
2577  // ------------------- BeginEvent ----------------------------
2578  AliEventplane *EventPlane = fInputEvent->GetEventplane();
2579  if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
2580  else fEventPlaneAngle=0.0;
2581 
2582  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
2583  RelabelAODPhotonCandidates(kTRUE);// In case of AODMC relabeling MC
2584  fV0Reader->RelabelAODs(kTRUE);
2585  }
2586 
2587  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
2588 
2589  fiCut = iCut;
2590 // cout << ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber() << "_" << ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber() <<
2591 // "_" << ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber() <<endl;
2592 
2593  Bool_t isRunningEMCALrelAna = kFALSE;
2594  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) isRunningEMCALrelAna = kTRUE;
2595 
2596  Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,isRunningEMCALrelAna);
2597 
2598  if(fIsMC==2){
2599  Float_t xsection = -1.;
2600  Float_t ntrials = -1.;
2601  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetXSectionAndNTrials(fMCEvent,xsection,ntrials,fInputEvent);
2602  if((xsection==-1.) || (ntrials==-1.)) AliFatal(Form("ERROR: GetXSectionAndNTrials returned invalid xsection/ntrials, periodName from V0Reader: '%s'",fV0Reader->GetPeriodName().Data()));
2603  fProfileJetJetXSection[iCut]->Fill(0.,xsection);
2604  fHistoJetJetNTrials[iCut]->Fill("#sum{NTrials}",ntrials);
2605  }
2606 
2607  if(fIsMC>0){
2608  fWeightJetJetMC = 1;
2609  // cout << fMCEvent << endl;
2610  Bool_t isMCJet = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsJetJetMCEventAccepted( fMCEvent, fWeightJetJetMC, fInputEvent );
2611  if (fIsMC == 3){
2612  Double_t weightMult = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetWeightForMultiplicity(fV0Reader->GetNumberOfPrimaryTracks());
2613  fWeightJetJetMC = fWeightJetJetMC*weightMult;
2614  }
2615  if(fIsMC==1) fWeightJetJetMC = 1;
2616  if (!isMCJet){
2617  fHistoNEvents[iCut]->Fill(10,fWeightJetJetMC);
2618  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(10);
2619  continue;
2620  }
2621  }
2622 
2623  Bool_t triggered = kTRUE;
2624 
2625  if(eventNotAccepted!= 0){
2626  fHistoNEvents[iCut]->Fill(eventNotAccepted, fWeightJetJetMC); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
2627  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventNotAccepted);
2628  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
2629  if (eventNotAccepted==3 && fIsMC > 0){
2630  triggered = kFALSE;
2631  }else {
2632  continue;
2633  }
2634  }
2635 
2636  if(eventQuality != 0 && triggered== kTRUE){// Event Not Accepted
2637  //cout << "event rejected due to: " <<eventQuality << endl;
2638  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC);
2639  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
2640  continue;
2641  }
2642 
2643  if (triggered==kTRUE){
2644  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC); // Should be 0 here
2645  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality); // Should be 0 here
2646 
2648  fHistoVertexZ[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetZ(), fWeightJetJetMC);
2649  if(!fDoLightOutput){
2650  fHistoVertexX[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetX(), fWeightJetJetMC);
2651  fHistoVertexY[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetY(), fWeightJetJetMC);
2652  fHistoSPDClusterTrackletBackground[iCut]->Fill(fInputEvent->GetMultiplicity()->GetNumberOfTracklets(),(fInputEvent->GetNumberOfITSClusters(0)+fInputEvent->GetNumberOfITSClusters(1)),fWeightJetJetMC);
2653  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A(), fWeightJetJetMC);
2654  else fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C(), fWeightJetJetMC);
2655  }
2656  }
2657 
2658  if(fIsMC>0){
2659  // Process MC Particle
2660  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
2661  if(fInputEvent->IsA()==AliESDEvent::Class()){
2662  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
2663  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
2664  fMCEvent);
2665  }
2666  else if(fInputEvent->IsA()==AliAODEvent::Class()){
2667  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
2668  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
2669  fInputEvent);
2670  }
2671 
2672  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader()){
2673  for(Int_t i = 0;i<(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
2674  TString nameBin= fHistoMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
2675  if (nameBin.CompareTo("")== 0){
2676  TString nameHeader = ((TObjString*)((TList*)((AliConvEventCuts*)fEventCutArray->At(iCut))
2677  ->GetAcceptedHeader())->At(i))->GetString();
2678  fHistoMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
2679  }
2680  }
2681  }
2682  }
2683  }
2684  if(fIsMC>0){
2685  if(fInputEvent->IsA()==AliESDEvent::Class())
2687  if(fInputEvent->IsA()==AliAODEvent::Class())
2689  }
2690 
2691  if (triggered==kFALSE) continue;
2692 
2693  // 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)
2694  ProcessClusters();// process calo clusters
2695  ProcessPhotonCandidates(); // Process this cuts gammas
2696 
2697  fHistoNGammaCandidates[iCut]->Fill(fGammaCandidates->GetEntries(),fWeightJetJetMC);
2699  if(fDoMesonAnalysis){ // Meson Analysis
2700  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC>0){
2701  fUnsmearedPx = new Double_t[fGammaCandidates->GetEntries()]; // Store unsmeared Momenta
2702  fUnsmearedPy = new Double_t[fGammaCandidates->GetEntries()];
2703  fUnsmearedPz = new Double_t[fGammaCandidates->GetEntries()];
2704  fUnsmearedE = new Double_t[fGammaCandidates->GetEntries()];
2705 
2706  for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
2707  fUnsmearedPx[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Px();
2708  fUnsmearedPy[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Py();
2709  fUnsmearedPz[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Pz();
2710  fUnsmearedE[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->E();
2711  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->SmearParticle(dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(gamma)));
2712  }
2713  }
2714 
2715  CalculatePi0Candidates(); // Combine Gammas from conversion and from calo
2716 
2717  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
2718  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
2719  CalculateBackground(); // Combinatorial Background
2720  UpdateEventByEventData(); // Store Event for mixed Events
2721  }
2722  else{
2723  CalculateBackgroundRP(); // Combinatorial Background
2724  fBGHandlerRP[iCut]->AddEvent(fGammaCandidates,fInputEvent); // Store Event for mixed Events
2725  fBGClusHandlerRP[iCut]->AddEvent(fClusterCandidates,fInputEvent); // Store Event for mixed Events
2726  }
2727  }
2728 
2729  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class()){
2730  ProcessConversionPhotonsForMissingTagsAOD(); //Count missing tags
2731  }else if (fIsMC>0 && fInputEvent->IsA()==AliESDEvent::Class()){
2732  ProcessConversionPhotonsForMissingTags(); //Count missing tags
2733  }
2734 
2735  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC>0){
2736  for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
2737  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPx(fUnsmearedPx[gamma]); // Reset Unsmeared Momenta
2738  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPy(fUnsmearedPy[gamma]);
2739  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPz(fUnsmearedPz[gamma]);
2740  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetE(fUnsmearedE[gamma]);
2741  }
2742  delete[] fUnsmearedPx; fUnsmearedPx = 0x0;
2743  delete[] fUnsmearedPy; fUnsmearedPy = 0x0;
2744  delete[] fUnsmearedPz; fUnsmearedPz = 0x0;
2745  delete[] fUnsmearedE;fUnsmearedE = 0x0;
2746  }
2747 
2748  if(fIsMC>0){
2749  fVectorRecTruePi0s.clear();
2750  fVectorRecTrueEtas.clear();
2755  }
2756  }
2757 
2758  if(fIsMC>0){
2763  }
2764 
2766 
2767  fGammaCandidates->Clear(); // delete this cuts good gammas
2768  fClusterCandidates->Clear(); // delete cluster candidates
2769  }
2770 
2771  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
2772  RelabelAODPhotonCandidates(kFALSE); // Back to ESDMC Label
2773  fV0Reader->RelabelAODs(kFALSE);
2774  }
2775 
2776  PostData(1, fOutputContainer);
2777 }
2778 
2779 //________________________________________________________________________
2781  Int_t nclus = 0;
2782  TClonesArray * arrClustersProcess = NULL;
2783  if(!fCorrTaskSetting.CompareTo("")){
2784  nclus = fInputEvent->GetNumberOfCaloClusters();
2785  } else {
2786  arrClustersProcess = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(Form("%sClustersBranch",fCorrTaskSetting.Data())));
2787  if(!arrClustersProcess)
2788  AliFatal(Form("%sClustersBranch was not found in AliAnalysisTaskGammaConvCalo! Check the correction framework settings!",fCorrTaskSetting.Data()));
2789  nclus = arrClustersProcess->GetEntries();
2790  }
2791 
2792 // cout << nclus << endl;
2793 
2794  if(nclus == 0) return;
2795 
2796  // plotting histograms on cell/tower level, only if extendedMatchAndQA > 1
2797  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FillHistogramsExtendedQA(fInputEvent,fIsMC);
2798 
2799  // match tracks to clusters
2801 
2802  // vertex
2803  Double_t vertex[3] = {0,0,0};
2804  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
2805 
2806  // Loop over EMCal clusters
2807  for(Int_t i = 0; i < nclus; i++){
2808  AliVCluster* clus = NULL;
2809  if(fInputEvent->IsA()==AliESDEvent::Class()){
2810  if(arrClustersProcess)
2811  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(i));
2812  else
2813  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
2814  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
2815  if(arrClustersProcess)
2816  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(i));
2817  else
2818  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
2819  }
2820 
2821  if (!clus) continue;
2822  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fMCEvent,fIsMC,fWeightJetJetMC,i)){
2823  if(fDoInvMassShowerShapeTree && ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedBeforeTrackMatch() ) tESDmapIsClusterAcceptedWithoutTrackMatch[i] = 1;
2824  delete clus;
2825  continue;
2826  }
2827 
2828  // TLorentzvector with cluster
2829  TLorentzVector clusterVector;
2830  clus->GetMomentum(clusterVector,vertex);
2831 
2832  TLorentzVector* tmpvec = new TLorentzVector();
2833  tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
2834 
2835  // convert to AODConversionPhoton
2836  AliAODConversionPhoton *PhotonCandidate = new AliAODConversionPhoton(tmpvec);
2837  if(!PhotonCandidate){ delete clus; delete tmpvec; continue;}
2838 
2840 
2841  // Flag Photon as CaloPhoton
2842  PhotonCandidate->SetIsCaloPhoton();
2843  PhotonCandidate->SetCaloClusterRef((Long_t)i);
2844  // get MC label
2845  if(fIsMC>0){
2846  Int_t* mclabelsCluster = clus->GetLabels();
2847  PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
2848 // cout << clus->GetNLabels() << endl;
2849  if (clus->GetNLabels()>0){
2850  for (Int_t k =0; k<(Int_t)clus->GetNLabels(); k++){
2851  if (k<50)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
2852 // Int_t pdgCode = fMCEvent->Particle(mclabelsCluster[k])->GetPdgCode();
2853 // cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
2854  }
2855  }
2856  }
2857 
2858  fIsFromDesiredHeader = kTRUE;
2860  //TString periodName = fV0Reader->GetPeriodName();
2861  // test whether largest contribution to cluster orginates in added signals
2862  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() > 0){
2863  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCEvent, fInputEvent) == 0){
2864  fIsFromDesiredHeader = kFALSE;
2865  }
2866  if (clus->GetNLabels()>1){
2867  Int_t* mclabelsCluster = clus->GetLabels();
2868  for (Int_t l = 1; l < (Int_t)clus->GetNLabels(); l++ ){
2869  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(mclabelsCluster[l], fMCEvent, fInputEvent) == 0){
2871  }
2872  }
2873  }
2874  }
2875  fHistoClusAllHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2876  if (!fIsFromDesiredHeader)
2877  fHistoClusRejectedHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2879  fHistoClusOverlapHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2880 
2882  fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2883  fHistoClusGammaE[fiCut]->Fill(PhotonCandidate->E(),fWeightJetJetMC);
2884  if(fIsMC>0){
2885  if(fInputEvent->IsA()==AliESDEvent::Class()){
2886  ProcessTrueClusterCandidates(PhotonCandidate,clus->GetM02());
2887  }else {
2888  ProcessTrueClusterCandidatesAOD(PhotonCandidate,clus->GetM02());
2889  }
2890  }
2891  fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
2892  }else{
2893  delete PhotonCandidate;
2894  }
2895 
2896  delete clus;
2897  delete tmpvec;
2898  }
2899 
2900 }
2901 
2902 //________________________________________________________________________
2904 {
2905 
2906  TParticle *Photon = NULL;
2907  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
2908  if (TruePhotonCandidate->GetCaloPhotonMCLabel(0) < 0) return;
2909  if(!fDoLightOutput) fHistoTrueNLabelsInClusPt[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
2910 
2911  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = fMCEvent->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
2912  else return;
2913 
2914  if(Photon == NULL){
2915  // cout << "no photon" << endl;
2916  return;
2917  }
2918 
2919  TruePhotonCandidate->SetCaloPhotonMCFlags(fMCEvent, fEnableSortForClusMC);
2920 
2921  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2922  Double_t mcProdVtxX = primVtxMC->GetX();
2923  Double_t mcProdVtxY = primVtxMC->GetY();
2924  Double_t mcProdVtxZ = primVtxMC->GetZ();
2925  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, TruePhotonCandidate->GetCaloPhotonMCLabel(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2926 
2927  // to get primary distrinction right put mother of conversion electron as particle to check
2928  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
2929  isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, Photon->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2930 
2931 
2932  // Fill histograms for inclusive gamma corrections
2933  // --> a) all clusters with leading real or converted photons
2934  if (TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) ){
2935  fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2936  if(!fDoLightOutput){
2937  // how many of those clusters are from converted photons
2938  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2939  fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2940  }
2941  // --> b) which of these are primary
2942  if(isPrimary){
2943  fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2944  fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC);
2945  // --> c) which are from conversions? Just additonal information
2946  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && (Photon->GetMother(0)>-1)){
2947  fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2948  fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),((TParticle*)fMCEvent->Particle(Photon->GetMother(0)))->Pt(),fWeightJetJetMC);
2949  }
2950  // --> d) how do the secondaries look like
2951  }else {
2952  Int_t secondaryClass = -1;
2953  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
2954  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhoton( Photon, fMCEvent, kTRUE);
2955  else
2956  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhoton( Photon, fMCEvent, kFALSE);
2957  // all secondaries
2958  if (secondaryClass > 0 ){
2959  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2960  }
2961  // secondaries from K0s
2962  if (secondaryClass == 2)
2963  fHistoTrueSecondaryClusGammaFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2964  // secondaries from Lambda
2965  else if (secondaryClass == 3)
2966  fHistoTrueSecondaryClusGammaFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2967  else if (secondaryClass == 5)
2968  fHistoTrueSecondaryClusGammaFromK0lPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2969  }
2970  }
2971 
2972  // How many clusters are from electrons besides conversions
2973  }else if (TruePhotonCandidate->IsLargestComponentElectron()) {
2974  if(!fDoLightOutput) fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2975  // How many clusters don't have an electromagnetic particle as leading particle
2976  }else {
2977  if(!fDoLightOutput) fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2978  }
2979 
2980  // Filling histogram for true photons: E vs M02 for paper
2981  if(!fDoLightOutput) {
2982  if ( TruePhotonCandidate->IsLargestComponentPhoton() && !TruePhotonCandidate->IsPhotonWithElecMother() &&
2983  !TruePhotonCandidate->IsMerged() && !TruePhotonCandidate->IsMergedPartConv() && !TruePhotonCandidate->IsDalitzMerged() )
2984  fHistoTrueClusGammaEM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02, fWeightJetJetMC);
2985  }
2986 
2987  // Some additional QA
2988  if (fDoClusterQA > 0){
2989  // how many of the converted photons are fully contained in the cluster
2990  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
2991  fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2992  // how often do we have merged pi0/eta...
2993  if ( (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsDalitzMerged()) || TruePhotonCandidate->IsMergedPartConv() )
2994  fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2995  // how often do we have a merged cluster with at least one conversion
2996  if (TruePhotonCandidate->IsMergedPartConv())
2997  fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2998  // how often do we reconstruct Dalitz electrons
2999  if (TruePhotonCandidate->IsDalitz())
3000  fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3001  // how often merge Dalitz decays
3002  if (TruePhotonCandidate->IsDalitzMerged())
3003  fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3004  // how often do we see Bremstrahlung
3005  if (TruePhotonCandidate->IsPhotonWithElecMother())
3006  fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3007  // how often do we see a shower in the clusters
3008  if (TruePhotonCandidate->IsShower())
3009  fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3010  // how often is the EM a subleading contributor
3011  if (TruePhotonCandidate->IsSubLeadingEM())
3012  fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3013  // how many mother particles point to the cluster
3015  }
3016 
3017  // Check if we are double counting photons
3018  Int_t motherLab = Photon->GetMother(0);
3019  if (motherLab > -1){
3020  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3022  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)0,fWeightJetJetMC);
3024  }
3025  }
3026  if ( TMath::Abs(fMCEvent->Particle(motherLab)->GetPdgCode()) == 111 &&
3027  TruePhotonCandidate->IsLargestComponentPhoton() &&
3028  TruePhotonCandidate->IsMerged() &&
3029  !TruePhotonCandidate->IsDalitzMerged() &&
3030  !TruePhotonCandidate->IsMergedPartConv()
3031  ){
3032  if(!fDoLightOutput) fHistoTrueClusPi0EM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02,fWeightJetJetMC);
3033  }
3034  Int_t grandMotherLab = fMCEvent->Particle(motherLab)->GetMother(0);
3035  if (grandMotherLab > -1){
3036  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3038  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)1,fWeightJetJetMC);
3040  }
3041  }
3042  }
3043  }
3044 
3045  return;
3046 }
3047 
3048 
3049 //________________________________________________________________________
3051 {
3052  AliAODMCParticle *Photon = NULL;
3053  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3054  if (AODMCTrackArray){
3055  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
3056  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
3057  else return;
3058  }else {
3059  AliInfo("AODMCTrackArray could not be loaded");
3060  return;
3061  }
3062 
3063  if(Photon == NULL){
3064  // cout << "no photon" << endl;
3065  return;
3066  }
3067 
3069  if(!fDoLightOutput) fHistoTrueNLabelsInClusPt[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3070 
3071  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3072  Double_t mcProdVtxX = primVtxMC->GetX();
3073  Double_t mcProdVtxY = primVtxMC->GetY();
3074  Double_t mcProdVtxZ = primVtxMC->GetZ();
3075  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3076 
3077  // to get primary distrinction right put mother of conversion electron as particle to check
3078  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3079  if (Photon->GetMother()> -1){
3080  AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
3081  isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, Mother, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3082  }
3083  }
3084 
3085  // True Photon
3086  if (TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) ){
3087  fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3088  if(!fDoLightOutput){
3089  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3090  fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3091  }
3092  if(isPrimary){
3093  fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3094  fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC);
3095  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3096  fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3097  AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
3098  fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Mother->Pt(),fWeightJetJetMC);
3099  }
3100  }else {
3101  Int_t secondaryClass = -1;
3102  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
3103  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhotonAOD( Photon, AODMCTrackArray, kTRUE);
3104  else
3105  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhotonAOD( Photon, AODMCTrackArray, kFALSE);
3106  // all secondaries
3107  if (secondaryClass > 0 ){
3108  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3109  }
3110  // secondaries from K0s
3111  if (secondaryClass == 2)
3112  fHistoTrueSecondaryClusGammaFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3113  // secondaries from Lambda
3114  else if (secondaryClass == 3)
3115  fHistoTrueSecondaryClusGammaFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3116  else if (secondaryClass == 5)
3117  fHistoTrueSecondaryClusGammaFromK0lPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3118  }
3119  }
3120 
3121  }else if (TruePhotonCandidate->IsLargestComponentElectron()) {
3122  if(!fDoLightOutput) fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3123  }else {
3124  if(!fDoLightOutput) fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3125  }
3126 
3127  if(!fDoLightOutput) {
3128  if ( TruePhotonCandidate->IsLargestComponentPhoton() && !TruePhotonCandidate->IsPhotonWithElecMother() &&
3129  !TruePhotonCandidate->IsMerged() && !TruePhotonCandidate->IsMergedPartConv() && !TruePhotonCandidate->IsDalitzMerged() )
3130  fHistoTrueClusGammaEM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02, fWeightJetJetMC);
3131  }
3132  if (fDoClusterQA > 0){
3133  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
3134  fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3135  if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
3136  fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3137  if (TruePhotonCandidate->IsMergedPartConv())
3138  fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3139  if (TruePhotonCandidate->IsDalitz())
3140  fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3141  if (TruePhotonCandidate->IsDalitzMerged())
3142  fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3143  if (TruePhotonCandidate->IsPhotonWithElecMother())
3144  fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3145  if (TruePhotonCandidate->IsShower())
3146  fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3147  if (TruePhotonCandidate->IsSubLeadingEM())
3148  fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3150 
3151  }
3152  Int_t motherLab = Photon->GetMother();
3153  if (motherLab > -1){
3154  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3156  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)0,fWeightJetJetMC);
3158  }
3159  }
3160  if(!fDoLightOutput) {
3161  if ( TMath::Abs(((AliAODMCParticle*) AODMCTrackArray->At(motherLab))->GetPdgCode()) == 111 && TruePhotonCandidate->IsLargestComponentPhoton() && TruePhotonCandidate->IsMerged() && !TruePhotonCandidate->IsDalitzMerged() && !TruePhotonCandidate->IsMergedPartConv())
3162  fHistoTrueClusPi0EM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02, fWeightJetJetMC);
3163  }
3164  Int_t grandMotherLab = ((AliAODMCParticle*) AODMCTrackArray->At(motherLab))->GetMother();
3165  if (grandMotherLab > -1){
3166  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3168  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)1,fWeightJetJetMC);
3170  }
3171  }
3172  }
3173  }
3174 
3175  return;
3176 }
3177 
3178 //________________________________________________________________________
3180 {
3181  Int_t nV0 = 0;
3182  TList *GammaCandidatesStepOne = new TList();
3183  TList *GammaCandidatesStepTwo = new TList();
3184  // Loop over Photon Candidates allocated by ReaderV1
3185  for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
3186  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
3187  if(!PhotonCandidate) continue;
3188  fIsFromDesiredHeader = kTRUE;
3189  if(fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3190  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
3191  if(isPosFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3192  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
3193  if(isNegFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3194  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromDesiredHeader = kFALSE;
3195  }
3196 
3197  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fInputEvent)) continue;
3198  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(PhotonCandidate->GetPhotonPhi(),fEventPlaneAngle)) continue;
3199  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
3200  !((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
3201  fGammaCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
3202 
3204  if(!fDoLightOutput) fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
3205  }
3206  if(fIsMC>0){
3207  if(fInputEvent->IsA()==AliESDEvent::Class())
3208  ProcessTruePhotonCandidates(PhotonCandidate);
3209  if(fInputEvent->IsA()==AliAODEvent::Class())
3210  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3211  }
3212  if (fIsFromDesiredHeader && fDoPhotonQA == 2){
3213  if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 30.){
3214  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3215  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3216  if (fIsMC > 0){
3217  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3218  } else {
3219  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3220  }
3221  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3222  }else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 30.){
3223  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3224  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3225  if (fIsMC > 0){
3226  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3227  } else {
3228  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3229  }
3230  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3231  }
3232  }
3233  }else if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
3234  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
3235  nV0++;
3236  GammaCandidatesStepOne->Add(PhotonCandidate);
3237  }else if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
3238  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
3239  GammaCandidatesStepTwo->Add(PhotonCandidate);
3240  }
3241  }
3242  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){
3243  for(Int_t i = 0;i<GammaCandidatesStepOne->GetEntries();i++){
3244  AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GammaCandidatesStepOne->At(i);
3245  if(!PhotonCandidate) continue;
3246  fIsFromDesiredHeader = kTRUE;
3247  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3248  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
3249  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
3250  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromDesiredHeader = kFALSE;
3251  }
3252  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GammaCandidatesStepOne->GetEntries())) continue;
3253  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
3254  fGammaCandidates->Add(PhotonCandidate);
3256  if(!fDoLightOutput) fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
3257  }
3258  if(fIsMC>0){
3259  if(fInputEvent->IsA()==AliESDEvent::Class())
3260  ProcessTruePhotonCandidates(PhotonCandidate);
3261  if(fInputEvent->IsA()==AliAODEvent::Class())
3262  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3263  }
3264  if (fIsFromDesiredHeader && fDoPhotonQA == 2){
3265  if (fIsHeavyIon ==1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 30.){
3266  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3267  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3268  if (fIsMC > 0){
3269  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3270  } else {
3271  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3272  }
3273  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3274  }else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 30.){
3275  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3276  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3277  if (fIsMC > 0){
3278  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3279  } else {
3280  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3281  }
3282  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3283  }
3284  }
3285  } else GammaCandidatesStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
3286  }
3287  }
3288  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
3289  for(Int_t i = 0;i<GammaCandidatesStepTwo->GetEntries();i++){
3290  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GammaCandidatesStepTwo->At(i);
3291  if(!PhotonCandidate) continue;
3292  fIsFromDesiredHeader = kTRUE;
3293  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3294  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
3295  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
3296  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromDesiredHeader = kFALSE;
3297  }
3298  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GammaCandidatesStepTwo,i)) continue;
3299  fGammaCandidates->Add(PhotonCandidate); // Add gamma to current cut TList
3301  if(!fDoLightOutput) fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
3302  }
3303  if(fIsMC>0){
3304  if(fInputEvent->IsA()==AliESDEvent::Class())
3305  ProcessTruePhotonCandidates(PhotonCandidate);
3306  if(fInputEvent->IsA()==AliAODEvent::Class())
3307  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3308  }
3309  if (fIsFromDesiredHeader && fDoPhotonQA == 2){
3310  if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 65.){
3311  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3312  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3313  if (fIsMC > 0){
3314  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3315  } else {
3316  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3317  }
3318  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3319  }else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 65.){
3320  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3321  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3322  if (fIsMC > 0){
3323  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3324  } else {
3325  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3326  }
3327  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3328  }
3329  }
3330  }
3331  }
3332 
3333  delete GammaCandidatesStepOne;
3334  GammaCandidatesStepOne = 0x0;
3335  delete GammaCandidatesStepTwo;
3336  GammaCandidatesStepTwo = 0x0;
3337 
3338 }
3339 
3340 //________________________________________________________________________
3342 {
3343  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3344  Double_t mcProdVtxX = primVtxMC->GetX();
3345  Double_t mcProdVtxY = primVtxMC->GetY();
3346  Double_t mcProdVtxZ = primVtxMC->GetZ();
3347 
3348  Double_t magField = fInputEvent->GetMagneticField();
3349  if( magField < 0.0 ){
3350  magField = 1.0;
3351  }
3352  else {
3353  magField = -1.0;
3354  }
3355 
3356  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3357  if (AODMCTrackArray == NULL) return;
3358  AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
3359  AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
3360  fCharPhotonMCInfo = 0;
3361 
3362  if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
3363  Int_t pdgCode[2] = {TMath::Abs(posDaughter->GetPdgCode()),TMath::Abs(negDaughter->GetPdgCode())};
3364 
3365  if(posDaughter->GetMother() != negDaughter->GetMother()){
3366  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3367  fCharPhotonMCInfo = 1;
3368  return;
3369  }
3370  else if(posDaughter->GetMother() == -1){
3371  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3372  fCharPhotonMCInfo = 1;
3373  return;
3374  }
3375 
3376  if(pdgCode[0]!=11 || pdgCode[1]!=11){
3377  fCharPhotonMCInfo = 1;
3378  return; //One Particle is not a electron
3379  }
3380 
3381  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()){
3382  fCharPhotonMCInfo = 1;
3383  return; // Same Charge
3384  }
3385 
3386  AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
3387  if(Photon->GetPdgCode() != 22){
3388  fCharPhotonMCInfo = 1;
3389  return; // Mother is no Photon
3390  }
3391 
3392  if(((posDaughter->GetMCProcessCode())) != 5 || ((negDaughter->GetMCProcessCode())) != 5){
3393  fCharPhotonMCInfo = 1;
3394  return;// check if the daughters come from a conversion
3395  }
3396  // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
3397 
3398 
3399 
3400  // True Photon
3402  if(!fDoLightOutput) fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3403  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueConvGammas,posDaughter->GetMother())){
3404  if(!fDoLightOutput) fHistoDoubleCountTrueConvGammaRPt[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3405  FillMultipleCountMap(fMapMultipleCountTrueConvGammas,posDaughter->GetMother());
3406  }
3407  }
3408 
3409  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3410  if(isPrimary){
3411  // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
3413  fCharPhotonMCInfo = 6;
3414  if(!fDoLightOutput){
3415  fHistoTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3416  fHistoTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC); // Allways Filled
3417  }
3418  }
3419  // (Not Filled for i6, Extra Signal Gamma (parambox) are secondary)
3420  }else {
3422 
3423  fCharPhotonMCInfo = 2;
3424  // check for secondaries from K0s
3425  if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3426  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 310){
3427  fCharPhotonMCInfo = 4;
3428  if(!fDoLightOutput){
3429  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3430  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3431  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3432  }
3433  // check for secondaries from K0l
3434  } else if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3435  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 130) {
3436  fCharPhotonMCInfo = 7;
3437  if(!fDoLightOutput){
3438  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3439  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),1.,fWeightJetJetMC);
3440  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3441  }
3442  // check for secondaries from Lambda
3443  } else if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3444  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 3122){
3445  fCharPhotonMCInfo = 5;
3446  if(!fDoLightOutput){
3447  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3448  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3449  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3450  }
3451  } else if (((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3452  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 221) {
3453  fCharPhotonMCInfo = 3;
3454  if(!fDoLightOutput){
3455  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3456  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3457  }
3458  } else {
3459  if(!fDoLightOutput){
3460  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3461  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3462  }
3463  }
3464  }
3465  }
3466  TruePhotonCandidate->SetIsTrueConvertedPhoton();
3467 }
3468 
3469 //________________________________________________________________________
3471 {
3472  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3473  Double_t mcProdVtxX = primVtxMC->GetX();
3474  Double_t mcProdVtxY = primVtxMC->GetY();
3475  Double_t mcProdVtxZ = primVtxMC->GetZ();
3476 
3477  Double_t magField = fInputEvent->GetMagneticField();
3478  if( magField < 0.0 ){
3479  magField = 1.0;
3480  }
3481  else {
3482  magField = -1.0;
3483  }
3484 
3485  // Process True Photons
3486  TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCEvent);
3487  TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCEvent);
3488  fCharPhotonMCInfo = 0;
3489 
3490  if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
3491  Int_t pdgCode[2] = {TMath::Abs(posDaughter->GetPdgCode()),TMath::Abs(negDaughter->GetPdgCode())};
3492  fCharPhotonMCInfo = 1;
3493  if(posDaughter->GetMother(0) != negDaughter->GetMother(0)){
3494  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3495  return;
3496  }
3497  else if(posDaughter->GetMother(0) == -1){
3498  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3499  return;
3500  }
3501 
3502  if(pdgCode[0]!=11 || pdgCode[1]!=11) return; //One Particle is not a electron
3503 
3504  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge
3505 
3506  TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCEvent);
3507 
3508  if(Photon->GetPdgCode() != 22){
3509  return; // Mother is no Photon
3510  }
3511 
3512  if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() !=5) return;// check if the daughters come from a conversion
3513 
3514  // True Photon
3516  if(!fDoLightOutput) fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3517  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueConvGammas,posDaughter->GetMother(0))){
3518  if(!fDoLightOutput) fHistoDoubleCountTrueConvGammaRPt[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3519  FillMultipleCountMap(fMapMultipleCountTrueConvGammas,posDaughter->GetMother(0));
3520  }
3521  }
3522  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, posDaughter->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3523  if(isPrimary){
3524  // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
3526  fCharPhotonMCInfo = 6;
3527  if(!fDoLightOutput){
3528  fHistoTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3529  fHistoTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC); // Allways Filled
3530  }
3531  }
3532  // (Not Filled for i6, Extra Signal Gamma (parambox) are secondary)
3533  }else {
3534  // fill secondary histograms
3536  fCharPhotonMCInfo = 2;
3537  if( Photon->GetMother(0) > -1 && fMCEvent->Particle(Photon->GetMother(0))->GetMother(0) > -1){
3538  if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
3539  fCharPhotonMCInfo = 4;
3540  if (!fDoLightOutput){
3541  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3542  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3543  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3544  }
3545  } else if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 130) {
3546  fCharPhotonMCInfo = 7;
3547  if (!fDoLightOutput){
3548  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3549  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),1.,fWeightJetJetMC);
3550  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3551  }
3552  } else if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 3122) {
3553  fCharPhotonMCInfo = 5;
3554  if (!fDoLightOutput){
3555  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3556  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),2.,fWeightJetJetMC);
3557  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3558  }
3559  } else if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 221) {
3560  fCharPhotonMCInfo = 3;
3561  if (!fDoLightOutput){
3562  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3563  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3564  }
3565  } else {
3566  if (!fDoLightOutput){
3567  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3568  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3569  }
3570  }
3571  } else {
3572  if (!fDoLightOutput){
3573  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3574  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3575  }
3576  }
3577  }
3578  }
3579  TruePhotonCandidate->SetIsTrueConvertedPhoton();
3580  return;
3581 }
3582 //________________________________________________________________________
3584 {
3585  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3586  Double_t mcProdVtxX = primVtxMC->GetX();
3587  Double_t mcProdVtxY = primVtxMC->GetY();
3588  Double_t mcProdVtxZ = primVtxMC->GetZ();
3589 
3590  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3591  if (AODMCTrackArray == NULL) return;
3592 
3593  // Loop over all primary MC particle
3594  for(Long_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
3595 
3596  AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
3597  if (!particle) continue;
3598 
3599  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, particle, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3600  if (isPrimary) {
3601 
3602  Int_t isMCFromMBHeader = -1;
3603  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3604  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3605  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3606  }
3607 
3608  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
3609  if(!fDoLightOutput){
3610  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kFALSE)){
3611  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Gamma
3612  if (TMath::Abs(particle->Eta()) < 0.66 ){
3613  if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3614  }
3615  if(particle->GetMother() >-1){ // Meson Decay Gamma
3616  switch((static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother())))->GetPdgCode()){
3617  case 111: // Pi0
3618  fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3619  break;
3620  case 113: // Rho0
3621  fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3622  break;
3623  case 221: // Eta
3624  fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3625  break;
3626  case 223: // Omega
3627  fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3628  break;
3629  case 331: // Eta'
3630  fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3631  break;
3632  case 333: // Phi
3633  fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3634  break;
3635  case 3212: // Sigma
3636  fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3637  break;
3638  }
3639  }
3640  }
3641  }
3642  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kTRUE)){
3643  for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){
3644  AliAODMCParticle *tmpDaughter = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(daughterIndex));
3645  if(!tmpDaughter) continue;
3646  }
3647  if(!fDoLightOutput) fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3648  }
3649  // Converted MC Gamma
3650  if(fDoMesonAnalysis){
3651 
3652  Double_t mesonY = 1.e30;
3653  Double_t ratio = 0;
3654  if (particle->E() != TMath::Abs(particle->Pz())){
3655  ratio = (particle->E()+particle->Pz()) / (particle->E()-particle->Pz());
3656  }
3657  if( !(ratio <= 0) ){
3658  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3659  }
3660 
3661  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
3662  if ( particle->GetPdgCode() == 211 ){ // positve pions
3663  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., fWeightJetJetMC);
3664  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
3665  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., fWeightJetJetMC);
3666  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
3667  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., fWeightJetJetMC);
3668  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
3669  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., fWeightJetJetMC);
3670  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
3671  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., fWeightJetJetMC);
3672  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
3673  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., fWeightJetJetMC);
3674  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
3675  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., fWeightJetJetMC);
3676  }
3677  }
3678 
3679  // check neutral mesons
3681  ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3682  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
3683  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
3684  Float_t weighted= 1;
3685  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
3686  if (particle->Pt()>0.005){
3687  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, 0x0, fInputEvent);
3688  // if(particle->GetPdgCode() == 221){
3689  // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
3690  // }
3691  }
3692  }
3693  Double_t mesonY = 1.e30;
3694  Double_t ratio = 0;
3695  if (particle->E() != TMath::Abs(particle->Pz())){
3696  ratio = (particle->E()+particle->Pz()) / (particle->E()-particle->Pz());
3697  }
3698  if( !(ratio <= 0) ){
3699  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3700  }
3701  Double_t alpha = -10;
3702  if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
3703  alpha = (daughter0->E() - daughter1->E())/(daughter0->E() + daughter1->E());
3704  }
3705 
3706 
3707  if(particle->GetPdgCode() == 111){
3708  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Pi0
3709  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3710  if (!fDoLightOutput){
3711  // fill pi0 hists against gamma pt of first leg
3712  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,weighted*fWeightJetJetMC);
3713  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,fWeightJetJetMC);
3714  // fill pi0 hists against gamma pt of second leg
3715  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,weighted*fWeightJetJetMC);
3716  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,fWeightJetJetMC);
3717  // fill pi0 hists against gamma pt of both legs
3718  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,weighted*fWeightJetJetMC);
3719  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,fWeightJetJetMC);
3720  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,weighted*fWeightJetJetMC);
3721  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,fWeightJetJetMC);
3722  }
3723 
3724  if (fIsMC > 1) fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
3725  if (fDoMesonQA > 0){
3726  fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC);
3727  fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC);
3728  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3729  }
3730  }else if(particle->GetPdgCode() == 221){
3731  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Eta
3732  fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3733  if (fIsMC > 1) fHistoMCEtaWOEvtWeightPt[fiCut]->Fill(particle->Pt());
3734  if (fDoMesonQA > 0){
3735  fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC);
3736  fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC);
3737  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3738  }
3739  }
3740 
3741  // Check the acceptance for both gammas
3742  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter0,AODMCTrackArray,kFALSE) &&
3743  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter1,AODMCTrackArray,kFALSE) &&
3744  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
3745  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
3746  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
3747  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) ||
3748  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
3749  if(particle->GetPdgCode() == 111){
3750  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Pi0 with gamma in acc
3751  fHistoMCPi0WOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Pi0 with gamma in acc wo weight
3752  if(fIsMC > 1) fHistoMCPi0WOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 with gamma in acc wo any weight
3753  if (!fDoLightOutput){
3754  // fill pi0 hists against gamma pt of first leg
3755  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,weighted*fWeightJetJetMC);
3756  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,fWeightJetJetMC);
3757  // fill pi0 hists against gamma pt of second leg
3758  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,weighted*fWeightJetJetMC);
3759  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,fWeightJetJetMC);
3760  // fill pi0 hists against gamma pt of both legs
3761  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,weighted*fWeightJetJetMC);
3762  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,fWeightJetJetMC);
3763  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,weighted*fWeightJetJetMC);
3764  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,fWeightJetJetMC);
3765  }
3766  }else if(particle->GetPdgCode() == 221){
3767  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Eta with gamma in acc
3768  fHistoMCEtaWOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Eta with gamma in acc wo weight
3769  if(fIsMC > 1) fHistoMCEtaWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta with gamma in acc wo any weight
3770  }
3771  }
3772  }
3773  }
3774  }
3775  } else {
3776  // fill secondary histograms
3777  Int_t isMCFromMBHeader = -1;
3778  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3779  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3780  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3781  }
3782  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) {
3783  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kFALSE)){
3784  if (particle->GetMother() > -1) {
3785  AliAODMCParticle *tmpMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3786  if (tmpMother->GetMother() > -1) {
3787  AliAODMCParticle *tmpGrandMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(tmpMother->GetMother()));
3788  if(tmpGrandMother->GetPdgCode() == 310) {
3789  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightJetJetMC);
3790  } else if (tmpGrandMother->GetPdgCode() == 130) {
3791  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightJetJetMC);
3792  } else if (tmpGrandMother->GetPdgCode() == 3122) {
3793  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightJetJetMC);
3794  } else {
3795  if ( !(TMath::Abs(tmpMother->GetPdgCode()) == 11 && tmpGrandMother->GetPdgCode() == 22) )
3796  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3797  }
3798  } else {
3799  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3800  }
3801  } else {
3802  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3803  }
3804  }
3805 
3806  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kTRUE)){
3807  if (particle->GetMother() > -1) {
3808  AliAODMCParticle *tmpMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3809  if (tmpMother->GetMother() > -1) {
3810  AliAODMCParticle *tmpGrandMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(tmpMother->GetMother()));
3811  if(tmpGrandMother->GetPdgCode() == 310) {
3812  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightJetJetMC);
3813  } else if (tmpGrandMother->GetPdgCode() == 130) {
3814  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightJetJetMC);
3815  } else if (tmpGrandMother->GetPdgCode() == 3122) {
3816  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightJetJetMC);
3817  } else {
3818  if ( !(TMath::Abs(tmpMother->GetPdgCode()) == 11 && tmpGrandMother->GetPdgCode() == 22) )
3819  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3820  }
3821  } else {
3822  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3823  }
3824  } else {
3825  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3826  }
3827  }
3828  }
3829 
3830  if(fDoMesonAnalysis){
3831  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3832  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
3833  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
3834  AliAODMCParticle* mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3835  Int_t pdgCode = mother->GetPdgCode();
3836  if(particle->GetPdgCode() == 111){
3837  Int_t source = GetSourceClassification(111,pdgCode);
3838  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC); // All MC Pi0
3839  if (!fDoLightOutput){
3840  fHistoMCSecPi0PtGamma1vsSource[fiCut]->Fill(daughter0->Pt(),source,fWeightJetJetMC); // All MC Pi0
3841  fHistoMCSecPi0PtGamma2vsSource[fiCut]->Fill(daughter1->Pt(),source,fWeightJetJetMC); // All MC Pi0
3842  }
3843  fHistoMCSecPi0Source[fiCut]->Fill(pdgCode);
3844  }else if(particle->GetPdgCode() == 221){
3845 
3846  fHistoMCSecEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Pi0
3847  fHistoMCSecEtaSource[fiCut]->Fill(pdgCode);
3848  }
3849 
3850  // check if conversion where within acceptance
3851  if( ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter0,AODMCTrackArray,kFALSE) &&
3852  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter1,AODMCTrackArray,kFALSE) &&
3853  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
3854  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
3855  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
3856  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) ||
3857  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
3858  if (particle->GetPdgCode() == 111){
3859  Int_t source = GetSourceClassification(111,pdgCode);
3860  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC); // All MC Pi0
3861  if (!fDoLightOutput){
3862  fHistoMCSecPi0InAccPtGamma1vsSource[fiCut]->Fill(daughter0->Pt(),source,fWeightJetJetMC); // All MC Pi0
3863  fHistoMCSecPi0InAccPtGamma2vsSource[fiCut]->Fill(daughter1->Pt(),source,fWeightJetJetMC); // All MC Pi0
3864  }
3865  }
3866  }
3867  }
3868  }
3869  }
3870  }
3871  }
3872 }
3873 
3874 //________________________________________________________________________
3876 {
3877  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3878  Double_t mcProdVtxX = primVtxMC->GetX();
3879  Double_t mcProdVtxY = primVtxMC->GetY();
3880  Double_t mcProdVtxZ = primVtxMC->GetZ();
3881 // cout << mcProdVtxX <<"\t" << mcProdVtxY << "\t" << mcProdVtxZ << endl;
3882 
3883  // Loop over all primary MC particle
3884  for(Long_t i = 0; i < fMCEvent->GetNumberOfTracks(); i++) {
3885  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
3886  // fill primary histograms
3887  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
3888  if (!particle) continue;
3889 
3890  Int_t isMCFromMBHeader = -1;
3891  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3892  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3893  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3894  }
3895 
3896  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
3897  if(!fDoLightOutput){
3898  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kFALSE)){
3899  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Gamma
3900  if (TMath::Abs(particle->Eta()) < 0.66 ){
3901  if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3902  }
3903 
3904  if(particle->GetMother(0) >-1){ // Meson Decay Gamma
3905  switch(fMCEvent->Particle(particle->GetMother(0))->GetPdgCode()){
3906  case 111: // Pi0
3907  fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3908  break;
3909  case 113: // Rho0
3910  fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3911  break;
3912  case 221: // Eta
3913  fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3914  break;
3915  case 223: // Omega
3916  fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3917  break;
3918  case 331: // Eta'
3919  fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3920  break;
3921  case 333: // Phi
3922  fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3923  break;
3924  case 3212: // Sigma
3925  fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3926  break;
3927  }
3928  }
3929  }
3930  }
3931  // Converted MC Gamma
3932  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kTRUE)){
3933  if(!fDoLightOutput) fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3934  }
3935 
3936 
3937  if(fDoMesonAnalysis ){
3938 
3939  // Fill histograms for other particles
3940  Double_t mesonY = 1.e30;
3941  Double_t ratio = 0;
3942  if (particle->Energy() != TMath::Abs(particle->Pz())){
3943  ratio = (particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz());
3944  }
3945  if( !(ratio <= 0) ){
3946  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3947  }
3948 
3949  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
3950  if ( particle->GetPdgCode() == 211 ){ // positve pions
3951  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., fWeightJetJetMC);
3952  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
3953  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., fWeightJetJetMC);
3954  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
3955  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., fWeightJetJetMC);
3956  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
3957  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., fWeightJetJetMC);
3958  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
3959  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., fWeightJetJetMC);
3960  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
3961  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., fWeightJetJetMC);
3962  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
3963  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., fWeightJetJetMC);
3964  }
3965  }
3966 
3967  // check neutral mesons
3969  ->MesonIsSelectedMC(particle,fMCEvent,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3970  TParticle* daughter0 = (TParticle*)fMCEvent->Particle(particle->GetFirstDaughter());
3971  TParticle* daughter1 = (TParticle*)fMCEvent->Particle(particle->GetLastDaughter());
3972 
3973  Float_t weighted= 1;
3974  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
3975  if (particle->Pt()>0.005){
3976  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent, fInputEvent);
3977  }
3978  }
3979  Double_t mesonY = 1.e30;
3980  Double_t ratio = 0;
3981  if (particle->Energy() != TMath::Abs(particle->Pz())){
3982  ratio = (particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz());
3983  }
3984  if( !(ratio <= 0) ){
3985  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3986  }
3987