AliPhysics  05c4c93 (05c4c93)
AliAnalysisTaskGammaCalo.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: Baldo Sahlmueller, Friederike Bock *
5  * Version 1.0 *
6  * *
7  * *
8  * Permission to use, copy, modify and distribute this software and its *
9  * documentation strictly for non-commercial purposes is hereby granted *
10  * without fee, provided that the above copyright notice appears in all *
11  * copies and that both the copyright notice and this permission notice *
12  * appear in the supporting documentation. The authors make no claims *
13  * about the suitability of this software for any purpose. It is *
14  * provided "as is" without express or implied warranty. *
15  **************************************************************************/
16 
18 //----------------------------------------------------------------
19 // Class used to do analysis on conversion photons + calo photons
20 //----------------------------------------------------------------
22 #include "TChain.h"
23 #include "TTree.h"
24 #include "TBranch.h"
25 #include "TFile.h"
26 #include "TH1F.h"
27 #include "TH2F.h"
28 #include "TH3F.h"
29 #include "THnSparse.h"
30 #include "TCanvas.h"
31 #include "TNtuple.h"
32 #include "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 "AliV0ReaderV1.h"
48 #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 #include <fstream>
62 
64 
65 //________________________________________________________________________
67  fV0Reader(NULL),
68  fV0ReaderName("V0ReaderV1"),
69  fCorrTaskSetting(""),
70  fBGHandler(NULL),
71  fInputEvent(NULL),
72  fMCEvent(NULL),
73  fCutFolder(NULL),
74  fESDList(NULL),
75  fBackList(NULL),
76  fMotherList(NULL),
77  fTrueList(NULL),
78  fMCList(NULL),
79  fTreeList(NULL),
80  fClusterTreeList(NULL),
81  fOutputContainer(NULL),
82  fClusterCandidates(NULL),
83  fEventCutArray(NULL),
84  fEventCuts(NULL),
85  fClusterCutArray(NULL),
86  fCaloPhotonCuts(NULL),
87  fMesonCutArray(NULL),
88  fMesonCuts(NULL),
89  fHistoMotherInvMassPt(NULL),
90  fSparseMotherInvMassPtZM(NULL),
91  fHistoMotherBackInvMassPt(NULL),
92  fSparseMotherBackInvMassPtZM(NULL),
93  fHistoMotherInvMassPtAlpha(NULL),
94  fHistoMotherBackInvMassPtAlpha(NULL),
95  fHistoMotherPi0PtY(NULL),
96  fHistoMotherEtaPtY(NULL),
97  fHistoMotherPi0PtAlpha(NULL),
98  fHistoMotherEtaPtAlpha(NULL),
99  fHistoMotherPi0PtOpenAngle(NULL),
100  fHistoMotherEtaPtOpenAngle(NULL),
101  fHistoMotherPi0NGoodESDTracksPt(NULL),
102  fHistoMotherEtaNGoodESDTracksPt(NULL),
103  fHistoClusGammaPt(NULL),
104  fHistoClusGammaE(NULL),
105  fHistoClusOverlapHeadersGammaPt(NULL),
106  fHistoClusAllHeadersGammaPt(NULL),
107  fHistoClusRejectedHeadersGammaPt(NULL),
108  fHistoClusGammaPtM02(NULL),
109  fHistoMCHeaders(NULL),
110  fHistoMCAllGammaPt(NULL),
111  fHistoMCAllSecondaryGammaPt(NULL),
112  fHistoMCDecayGammaPi0Pt(NULL),
113  fHistoMCDecayGammaRhoPt(NULL),
114  fHistoMCDecayGammaEtaPt(NULL),
115  fHistoMCDecayGammaOmegaPt(NULL),
116  fHistoMCDecayGammaEtapPt(NULL),
117  fHistoMCDecayGammaPhiPt(NULL),
118  fHistoMCDecayGammaSigmaPt(NULL),
119  fHistoMCPi0Pt(NULL),
120  fHistoMCPi0WOWeightPt(NULL),
121  fHistoMCPi0WOEvtWeightPt(NULL),
122  fHistoMCEtaPt(NULL),
123  fHistoMCEtaWOWeightPt(NULL),
124  fHistoMCEtaWOEvtWeightPt(NULL),
125  fHistoMCPi0InAccPt(NULL),
126  fHistoMCEtaInAccPt(NULL),
127  fHistoMCPi0WOEvtWeightInAccPt(NULL),
128  fHistoMCEtaWOEvtWeightInAccPt(NULL),
129  fHistoMCPi0PtY(NULL),
130  fHistoMCEtaPtY(NULL),
131  fHistoMCPi0PtAlpha(NULL),
132  fHistoMCEtaPtAlpha(NULL),
133  fHistoMCPrimaryPtvsSource(NULL),
134  fHistoMCSecPi0PtvsSource(NULL),
135  fHistoMCSecPi0Source(NULL),
136  fHistoMCSecPi0InAccPtvsSource(NULL),
137  fHistoMCSecEtaPt(NULL),
138  fHistoMCSecEtaSource(NULL),
139  fHistoMCPi0PtJetPt(NULL),
140  fHistoMCEtaPtJetPt(NULL),
141  fHistoTruePi0InvMassPt(NULL),
142  fHistoTrueEtaInvMassPt(NULL),
143  fHistoTruePi0CaloPhotonInvMassPt(NULL),
144  fHistoTrueEtaCaloPhotonInvMassPt(NULL),
145  fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
146  fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
147  fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt(NULL),
148  fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt(NULL),
149  fHistoTruePi0CaloElectronInvMassPt(NULL),
150  fHistoTrueEtaCaloElectronInvMassPt(NULL),
151  fHistoTruePi0CaloMergedClusterInvMassPt(NULL),
152  fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
153  fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
154  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
155  fHistoTruePi0NonMergedElectronPhotonInvMassPt(NULL),
156  fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt(NULL),
157  fHistoTruePi0Category1(NULL),
158  fHistoTrueEtaCategory1(NULL),
159  fHistoTruePi0Category2(NULL),
160  fHistoTrueEtaCategory2(NULL),
161  fHistoTruePi0Category3(NULL),
162  fHistoTrueEtaCategory3(NULL),
163  fHistoTruePi0Category4_6(NULL),
164  fHistoTrueEtaCategory4_6(NULL),
165  fHistoTruePi0Category5(NULL),
166  fHistoTrueEtaCategory5(NULL),
167  fHistoTruePi0Category7(NULL),
168  fHistoTrueEtaCategory7(NULL),
169  fHistoTruePi0Category8(NULL),
170  fHistoTrueEtaCategory8(NULL),
171  fHistoTruePrimaryPi0InvMassPt(NULL),
172  fHistoTruePrimaryEtaInvMassPt(NULL),
173  fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
174  fHistoTruePrimaryEtaW0WeightingInvMassPt(NULL),
175  fProfileTruePrimaryPi0WeightsInvMassPt(NULL),
176  fProfileTruePrimaryEtaWeightsInvMassPt(NULL),
177  fHistoTruePrimaryPi0MCPtResolPt(NULL),
178  fHistoTruePrimaryEtaMCPtResolPt(NULL),
179  fHistoTrueSecondaryPi0InvMassPt(NULL),
180  fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
181  fHistoTrueK0sWithPi0DaughterMCPt(NULL),
182  fHistoTrueSecondaryPi0FromK0lInvMassPt(NULL),
183  fHistoTrueK0lWithPi0DaughterMCPt(NULL),
184  fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
185  fHistoTrueEtaWithPi0DaughterMCPt(NULL),
186  fHistoTrueSecondaryPi0FromLambdaInvMassPt(NULL),
187  fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
188  fHistoTrueBckGGInvMassPt(NULL),
189  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt(NULL),
190  fHistoTrueBckAsymEClustersInvMassPt(NULL),
191  fHistoTrueBckContInvMassPt(NULL),
192  fHistoTruePi0PtY(NULL),
193  fHistoTrueEtaPtY(NULL),
194  fHistoTruePi0PtAlpha(NULL),
195  fHistoTrueEtaPtAlpha(NULL),
196  fHistoTruePi0PtOpenAngle(NULL),
197  fHistoTrueEtaPtOpenAngle(NULL),
198  fHistoClusPhotonBGPt(NULL),
199  fHistoClusPhotonPlusConvBGPt(NULL),
200  fHistoClustPhotonElectronBGPtM02(NULL),
201  fHistoClustPhotonPionBGPtM02(NULL),
202  fHistoClustPhotonKaonBGPtM02(NULL),
203  fHistoClustPhotonK0lBGPtM02(NULL),
204  fHistoClustPhotonNeutronBGPtM02(NULL),
205  fHistoClustPhotonRestBGPtM02(NULL),
206  fHistoClustPhotonPlusConvElectronBGPtM02(NULL),
207  fHistoClustPhotonPlusConvPionBGPtM02(NULL),
208  fHistoClustPhotonPlusConvKaonBGPtM02(NULL),
209  fHistoClustPhotonPlusConvK0lBGPtM02(NULL),
210  fHistoClustPhotonPlusConvNeutronBGPtM02(NULL),
211  fHistoClustPhotonPlusConvRestBGPtM02(NULL),
212  fHistoTrueClusGammaPt(NULL),
213  fHistoTrueClusUnConvGammaPt(NULL),
214  fHistoTrueClusUnConvGammaMCPt(NULL),
215  fHistoTrueClusGammaPtM02(NULL),
216  fHistoTrueClusUnConvGammaPtM02(NULL),
217  fHistoTrueClusElectronPt(NULL),
218  fHistoTrueClusConvGammaPt(NULL),
219  fHistoTrueClusConvGammaMCPt(NULL),
220  fHistoTrueClusConvGammaFullyPt(NULL),
221  fHistoTrueClusMergedGammaPt(NULL),
222  fHistoTrueClusMergedPartConvGammaPt(NULL),
223  fHistoTrueClusDalitzPt(NULL),
224  fHistoTrueClusDalitzMergedPt(NULL),
225  fHistoTrueClusPhotonFromElecMotherPt(NULL),
226  fHistoTrueClusShowerPt(NULL),
227  fHistoTrueClusSubLeadingPt(NULL),
228  fHistoTrueClusNParticles(NULL),
229  fHistoTrueClusEMNonLeadingPt(NULL),
230  fHistoTrueNLabelsInClus(NULL),
231  fHistoTruePrimaryClusGammaPt(NULL),
232  fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
233  fHistoTruePrimaryClusConvGammaPt(NULL),
234  fHistoTruePrimaryClusConvGammaESDPtMCPt(NULL),
235  fHistoTrueSecondaryClusGammaPt(NULL),
236  fHistoTrueSecondaryClusConvGammaPt(NULL),
237  fHistoTrueSecondaryClusGammaMCPt(NULL),
238  fHistoTrueSecondaryClusConvGammaMCPt(NULL),
239  fHistoTrueSecondaryClusGammaFromXFromK0sMCPtESDPt(NULL),
240  fHistoTrueSecondaryClusConvGammaFromXFromK0sMCPtESDPt(NULL),
241  fHistoTrueSecondaryClusGammaFromXFromK0lMCPtESDPt(NULL),
242  fHistoTrueSecondaryClusConvGammaFromXFromK0lMCPtESDPt(NULL),
243  fHistoTrueSecondaryClusGammaFromXFromLambdaMCPtESDPt(NULL),
244  fHistoTrueSecondaryClusConvGammaFromXFromLambdaMCPtESDPt(NULL),
245  fHistoDoubleCountTruePi0InvMassPt(NULL),
246  fHistoDoubleCountTrueEtaInvMassPt(NULL),
247  fHistoDoubleCountTrueClusterGammaPt(NULL),
248  fVectorDoubleCountTruePi0s(0),
249  fVectorDoubleCountTrueEtas(0),
250  fVectorDoubleCountTrueClusterGammas(0),
251  fHistoMultipleCountTrueClusterGamma(NULL),
252  fMapMultipleCountTrueClusterGammas(),
253  fHistoTruePi0InvMassPtAlpha(NULL),
254  fHistoTruePi0PureGammaInvMassPtAlpha(NULL),
255  fHistCellIDvsClusterEnergy(NULL),
256  fHistCellIDvsClusterEnergyMax(NULL),
257  fHistoNEvents(NULL),
258  fHistoNEventsWOWeight(NULL),
259  fHistoNGoodESDTracks(NULL),
260  fHistoVertexZ(NULL),
261  fHistoNGammaCandidates(NULL),
262  fHistoNGammaCandidatesBasic(NULL),
263  fHistoNGoodESDTracksVsNGammaCandidates(NULL),
264  fHistoSPDClusterTrackletBackground(NULL),
265  fHistoNV0Tracks(NULL),
266  fProfileEtaShift(NULL),
267  fProfileJetJetXSection(NULL),
268  fHistoJetJetNTrials(NULL),
269  tTrueInvMassROpenABPtFlag(NULL),
270  fInvMass(-1),
271  fRconv(-1),
272  fOpenRPrim(-1),
273  fInvMassRTOF(-1),
274  fPt(-1),
275  iFlag(3),
276  tSigInvMassPtAlphaTheta(NULL),
277  tBckInvMassPtAlphaTheta(NULL),
278  fInvMassTreeInvMass(0),
279  fInvMassTreePt(0),
280  fInvMassTreeAlpha(0),
281  fInvMassTreeTheta(0),
282  fInvMassTreeMixPool(0),
283  fInvMassTreeZVertex(0),
284  fInvMassTreeEta(0),
285  tClusterEOverP(NULL),
286  fClusterE(0),
287  fClusterM02(0),
288  fClusterM20(0),
289  fClusterEP(0),
290  fClusterLeadCellID(0),
291  fClusterClassification(0),
292  fDeltaEta(0),
293  fDeltaPhi(0),
294  fTrackPt(0),
295  fTrackPID_e(0),
296  fTrackPID_Pi(0),
297  fTrackPID_K(0),
298  fTrackPID_P(0),
299  fClusterIsoSumClusterEt(0),
300  fClusterIsoSumTrackEt(0),
301 // fHistoTruePi0NonLinearity(NULL),
302 // fHistoTrueEtaNonLinearity(NULL),
303  fEventPlaneAngle(-100),
304  fRandom(0),
305  fnCuts(0),
306  fiCut(0),
307  fIsHeavyIon(0),
308  fDoLightOutput(kFALSE),
309  fDoMesonAnalysis(kTRUE),
310  fDoMesonQA(0),
311  fDoClusterQA(0),
312  fIsFromDesiredHeader(kTRUE),
313  fIsOverlappingWithOtherHeader(kFALSE),
314  fIsMC(0),
315  fDoTHnSparse(kTRUE),
316  fSetPlotHistsExtQA(kFALSE),
317  fWeightJetJetMC(1),
318  fDoInOutTimingCluster(kFALSE),
319  fMinTimingCluster(0),
320  fMaxTimingCluster(0),
321  fEnableSortForClusMC(kFALSE),
322  fProduceCellIDPlots(kFALSE),
323  fProduceTreeEOverP(kFALSE),
324  tBrokenFiles(NULL),
325  fFileNameBroken(NULL),
326  tClusterQATree(NULL),
327  fCloseHighPtClusters(NULL),
328  fLocalDebugFlag(0),
329  fAllowOverlapHeaders(kTRUE),
330  fNCurrentClusterBasic(0)
331 {
332 
333 }
334 
335 //________________________________________________________________________
337  AliAnalysisTaskSE(name),
338  fV0Reader(NULL),
339  fV0ReaderName("V0ReaderV1"),
340  fCorrTaskSetting(""),
341  fBGHandler(NULL),
342  fInputEvent(NULL),
343  fMCEvent(NULL),
344  fCutFolder(NULL),
345  fESDList(NULL),
346  fBackList(NULL),
347  fMotherList(NULL),
348  fTrueList(NULL),
349  fMCList(NULL),
350  fTreeList(NULL),
351  fClusterTreeList(NULL),
352  fOutputContainer(0),
353  fClusterCandidates(NULL),
354  fEventCutArray(NULL),
355  fEventCuts(NULL),
356  fClusterCutArray(NULL),
357  fCaloPhotonCuts(NULL),
358  fMesonCutArray(NULL),
359  fMesonCuts(NULL),
360  fHistoMotherInvMassPt(NULL),
361  fSparseMotherInvMassPtZM(NULL),
362  fHistoMotherBackInvMassPt(NULL),
363  fSparseMotherBackInvMassPtZM(NULL),
364  fHistoMotherInvMassPtAlpha(NULL),
365  fHistoMotherBackInvMassPtAlpha(NULL),
366  fHistoMotherPi0PtY(NULL),
367  fHistoMotherEtaPtY(NULL),
368  fHistoMotherPi0PtAlpha(NULL),
369  fHistoMotherEtaPtAlpha(NULL),
370  fHistoMotherPi0PtOpenAngle(NULL),
371  fHistoMotherEtaPtOpenAngle(NULL),
372  fHistoMotherPi0NGoodESDTracksPt(NULL),
373  fHistoMotherEtaNGoodESDTracksPt(NULL),
374  fHistoClusGammaPt(NULL),
375  fHistoClusGammaE(NULL),
376  fHistoClusOverlapHeadersGammaPt(NULL),
377  fHistoClusAllHeadersGammaPt(NULL),
378  fHistoClusRejectedHeadersGammaPt(NULL),
379  fHistoClusGammaPtM02(NULL),
380  fHistoMCHeaders(NULL),
381  fHistoMCAllGammaPt(NULL),
382  fHistoMCAllSecondaryGammaPt(NULL),
383  fHistoMCDecayGammaPi0Pt(NULL),
384  fHistoMCDecayGammaRhoPt(NULL),
385  fHistoMCDecayGammaEtaPt(NULL),
386  fHistoMCDecayGammaOmegaPt(NULL),
387  fHistoMCDecayGammaEtapPt(NULL),
388  fHistoMCDecayGammaPhiPt(NULL),
389  fHistoMCDecayGammaSigmaPt(NULL),
390  fHistoMCPi0Pt(NULL),
391  fHistoMCPi0WOWeightPt(NULL),
392  fHistoMCPi0WOEvtWeightPt(NULL),
393  fHistoMCEtaPt(NULL),
394  fHistoMCEtaWOWeightPt(NULL),
395  fHistoMCEtaWOEvtWeightPt(NULL),
396  fHistoMCPi0InAccPt(NULL),
397  fHistoMCEtaInAccPt(NULL),
398  fHistoMCPi0WOEvtWeightInAccPt(NULL),
399  fHistoMCEtaWOEvtWeightInAccPt(NULL),
400  fHistoMCPi0PtY(NULL),
401  fHistoMCEtaPtY(NULL),
402  fHistoMCPi0PtAlpha(NULL),
403  fHistoMCEtaPtAlpha(NULL),
404  fHistoMCPrimaryPtvsSource(NULL),
405  fHistoMCSecPi0PtvsSource(NULL),
406  fHistoMCSecPi0Source(NULL),
407  fHistoMCSecPi0InAccPtvsSource(NULL),
408  fHistoMCSecEtaPt(NULL),
409  fHistoMCSecEtaSource(NULL),
410  fHistoMCPi0PtJetPt(NULL),
411  fHistoMCEtaPtJetPt(NULL),
412  fHistoTruePi0InvMassPt(NULL),
413  fHistoTrueEtaInvMassPt(NULL),
414  fHistoTruePi0CaloPhotonInvMassPt(NULL),
415  fHistoTrueEtaCaloPhotonInvMassPt(NULL),
416  fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
417  fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
418  fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt(NULL),
419  fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt(NULL),
420  fHistoTruePi0CaloElectronInvMassPt(NULL),
421  fHistoTrueEtaCaloElectronInvMassPt(NULL),
422  fHistoTruePi0CaloMergedClusterInvMassPt(NULL),
423  fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
424  fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
425  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
426  fHistoTruePi0NonMergedElectronPhotonInvMassPt(NULL),
427  fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt(NULL),
428  fHistoTruePi0Category1(NULL),
429  fHistoTrueEtaCategory1(NULL),
430  fHistoTruePi0Category2(NULL),
431  fHistoTrueEtaCategory2(NULL),
432  fHistoTruePi0Category3(NULL),
433  fHistoTrueEtaCategory3(NULL),
434  fHistoTruePi0Category4_6(NULL),
435  fHistoTrueEtaCategory4_6(NULL),
436  fHistoTruePi0Category5(NULL),
437  fHistoTrueEtaCategory5(NULL),
438  fHistoTruePi0Category7(NULL),
439  fHistoTrueEtaCategory7(NULL),
440  fHistoTruePi0Category8(NULL),
441  fHistoTrueEtaCategory8(NULL),
442  fHistoTruePrimaryPi0InvMassPt(NULL),
443  fHistoTruePrimaryEtaInvMassPt(NULL),
444  fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
445  fHistoTruePrimaryEtaW0WeightingInvMassPt(NULL),
446  fProfileTruePrimaryPi0WeightsInvMassPt(NULL),
447  fProfileTruePrimaryEtaWeightsInvMassPt(NULL),
448  fHistoTruePrimaryPi0MCPtResolPt(NULL),
449  fHistoTruePrimaryEtaMCPtResolPt(NULL),
450  fHistoTrueSecondaryPi0InvMassPt(NULL),
451  fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
452  fHistoTrueK0sWithPi0DaughterMCPt(NULL),
453  fHistoTrueSecondaryPi0FromK0lInvMassPt(NULL),
454  fHistoTrueK0lWithPi0DaughterMCPt(NULL),
455  fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
456  fHistoTrueEtaWithPi0DaughterMCPt(NULL),
457  fHistoTrueSecondaryPi0FromLambdaInvMassPt(NULL),
458  fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
459  fHistoTrueBckGGInvMassPt(NULL),
460  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt(NULL),
461  fHistoTrueBckAsymEClustersInvMassPt(NULL),
462  fHistoTrueBckContInvMassPt(NULL),
463  fHistoTruePi0PtY(NULL),
464  fHistoTrueEtaPtY(NULL),
465  fHistoTruePi0PtAlpha(NULL),
466  fHistoTrueEtaPtAlpha(NULL),
467  fHistoTruePi0PtOpenAngle(NULL),
468  fHistoTrueEtaPtOpenAngle(NULL),
469  fHistoClusPhotonBGPt(NULL),
470  fHistoClusPhotonPlusConvBGPt(NULL),
471  fHistoClustPhotonElectronBGPtM02(NULL),
472  fHistoClustPhotonPionBGPtM02(NULL),
473  fHistoClustPhotonKaonBGPtM02(NULL),
474  fHistoClustPhotonK0lBGPtM02(NULL),
475  fHistoClustPhotonNeutronBGPtM02(NULL),
476  fHistoClustPhotonRestBGPtM02(NULL),
477  fHistoClustPhotonPlusConvElectronBGPtM02(NULL),
478  fHistoClustPhotonPlusConvPionBGPtM02(NULL),
479  fHistoClustPhotonPlusConvKaonBGPtM02(NULL),
480  fHistoClustPhotonPlusConvK0lBGPtM02(NULL),
481  fHistoClustPhotonPlusConvNeutronBGPtM02(NULL),
482  fHistoClustPhotonPlusConvRestBGPtM02(NULL),
483  fHistoTrueClusGammaPt(NULL),
484  fHistoTrueClusUnConvGammaPt(NULL),
485  fHistoTrueClusUnConvGammaMCPt(NULL),
486  fHistoTrueClusGammaPtM02(NULL),
487  fHistoTrueClusUnConvGammaPtM02(NULL),
488  fHistoTrueClusElectronPt(NULL),
489  fHistoTrueClusConvGammaPt(NULL),
490  fHistoTrueClusConvGammaMCPt(NULL),
491  fHistoTrueClusConvGammaFullyPt(NULL),
492  fHistoTrueClusMergedGammaPt(NULL),
493  fHistoTrueClusMergedPartConvGammaPt(NULL),
494  fHistoTrueClusDalitzPt(NULL),
495  fHistoTrueClusDalitzMergedPt(NULL),
496  fHistoTrueClusPhotonFromElecMotherPt(NULL),
497  fHistoTrueClusShowerPt(NULL),
498  fHistoTrueClusSubLeadingPt(NULL),
499  fHistoTrueClusNParticles(NULL),
500  fHistoTrueClusEMNonLeadingPt(NULL),
501  fHistoTrueNLabelsInClus(NULL),
502  fHistoTruePrimaryClusGammaPt(NULL),
503  fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
504  fHistoTruePrimaryClusConvGammaPt(NULL),
505  fHistoTruePrimaryClusConvGammaESDPtMCPt(NULL),
506  fHistoTrueSecondaryClusGammaPt(NULL),
507  fHistoTrueSecondaryClusConvGammaPt(NULL),
508  fHistoTrueSecondaryClusGammaMCPt(NULL),
509  fHistoTrueSecondaryClusConvGammaMCPt(NULL),
510  fHistoTrueSecondaryClusGammaFromXFromK0sMCPtESDPt(NULL),
511  fHistoTrueSecondaryClusConvGammaFromXFromK0sMCPtESDPt(NULL),
512  fHistoTrueSecondaryClusGammaFromXFromK0lMCPtESDPt(NULL),
513  fHistoTrueSecondaryClusConvGammaFromXFromK0lMCPtESDPt(NULL),
514  fHistoTrueSecondaryClusGammaFromXFromLambdaMCPtESDPt(NULL),
515  fHistoTrueSecondaryClusConvGammaFromXFromLambdaMCPtESDPt(NULL),
516  fHistoDoubleCountTruePi0InvMassPt(NULL),
517  fHistoDoubleCountTrueEtaInvMassPt(NULL),
518  fHistoDoubleCountTrueClusterGammaPt(NULL),
519  fVectorDoubleCountTruePi0s(0),
520  fVectorDoubleCountTrueEtas(0),
521  fVectorDoubleCountTrueClusterGammas(0),
522  fHistoMultipleCountTrueClusterGamma(NULL),
523  fMapMultipleCountTrueClusterGammas(),
524  fHistoTruePi0InvMassPtAlpha(NULL),
525  fHistoTruePi0PureGammaInvMassPtAlpha(NULL),
526  fHistCellIDvsClusterEnergy(NULL),
527  fHistCellIDvsClusterEnergyMax(NULL),
528  fHistoNEvents(NULL),
529  fHistoNEventsWOWeight(NULL),
530  fHistoNGoodESDTracks(NULL),
531  fHistoVertexZ(NULL),
532  fHistoNGammaCandidates(NULL),
533  fHistoNGammaCandidatesBasic(NULL),
534  fHistoNGoodESDTracksVsNGammaCandidates(NULL),
535  fHistoSPDClusterTrackletBackground(NULL),
536  fHistoNV0Tracks(NULL),
537  fProfileEtaShift(NULL),
538  fProfileJetJetXSection(NULL),
539  fHistoJetJetNTrials(NULL),
540  tTrueInvMassROpenABPtFlag(NULL),
541  fInvMass(-1),
542  fRconv(-1),
543  fOpenRPrim(-1),
544  fInvMassRTOF(-1),
545  fPt(-1),
546  iFlag(3),
547  tSigInvMassPtAlphaTheta(NULL),
548  tBckInvMassPtAlphaTheta(NULL),
549  fInvMassTreeInvMass(0),
550  fInvMassTreePt(0),
551  fInvMassTreeAlpha(0),
552  fInvMassTreeTheta(0),
553  fInvMassTreeMixPool(0),
554  fInvMassTreeZVertex(0),
555  fInvMassTreeEta(0),
556  tClusterEOverP(NULL),
557  fClusterE(0),
558  fClusterM02(0),
559  fClusterM20(0),
560  fClusterEP(0),
561  fClusterLeadCellID(0),
562  fClusterClassification(0),
563  fDeltaEta(0),
564  fDeltaPhi(0),
565  fTrackPt(0),
566  fTrackPID_e(0),
567  fTrackPID_Pi(0),
568  fTrackPID_K(0),
569  fTrackPID_P(0),
570  fClusterIsoSumClusterEt(0),
571  fClusterIsoSumTrackEt(0),
572 // fHistoTruePi0NonLinearity(NULL),
573 // fHistoTrueEtaNonLinearity(NULL),
574  fEventPlaneAngle(-100),
575  fRandom(0),
576  fnCuts(0),
577  fiCut(0),
578  fIsHeavyIon(0),
579  fDoLightOutput(kFALSE),
580  fDoMesonAnalysis(kTRUE),
581  fDoMesonQA(0),
582  fDoClusterQA(0),
583  fIsFromDesiredHeader(kTRUE),
584  fIsOverlappingWithOtherHeader(kFALSE),
585  fIsMC(0),
586  fDoTHnSparse(kTRUE),
587  fSetPlotHistsExtQA(kFALSE),
588  fWeightJetJetMC(1),
589  fDoInOutTimingCluster(kFALSE),
590  fMinTimingCluster(0),
591  fMaxTimingCluster(0),
592  fEnableSortForClusMC(kFALSE),
593  fProduceCellIDPlots(kFALSE),
594  fProduceTreeEOverP(kFALSE),
595  tBrokenFiles(NULL),
596  fFileNameBroken(NULL),
597  tClusterQATree(NULL),
598  fCloseHighPtClusters(NULL),
599  fLocalDebugFlag(0),
600  fAllowOverlapHeaders(kTRUE),
601  fNCurrentClusterBasic(0)
602 {
603  // Define output slots here
604  DefineOutput(1, TList::Class());
605 }
606 
608 {
609  if(fClusterCandidates){
610  delete fClusterCandidates;
611  fClusterCandidates = 0x0;
612  }
613  if(fBGHandler){
614  delete[] fBGHandler;
615  fBGHandler = 0x0;
616  }
617 }
618 //___________________________________________________________
620 
621  const Int_t nDim = 4;
622  Int_t nBins[nDim] = {800,350,7,6};
623  Double_t xMin[nDim] = {0,0, 0,0};
624  Double_t xMax[nDim] = {0.8,35,7,6};
625 
626  if(fDoTHnSparse){
627  fSparseMotherInvMassPtZM = new THnSparseF*[fnCuts];
628  fSparseMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
629  }
630 
632 
633 
634  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
635  if (((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
636  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
637  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
638  TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
639 
640  Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(0,1));
641  Int_t centMin = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(1,1));
642  Int_t centMax = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(2,1));
643 
644  if(collisionSystem == 1 || collisionSystem == 2 ||
645  collisionSystem == 5 || collisionSystem == 8 ||
646  collisionSystem == 9){
647  centMin = centMin*10;
648  centMax = centMax*10;
649  if(centMax ==0 && centMax!=centMin) centMax=100;
650  } else if(collisionSystem == 3 || collisionSystem == 6){
651  centMin = centMin*5;
652  centMax = centMax*5;
653  } else if(collisionSystem == 4 || collisionSystem == 7){
654  centMin = ((centMin*5)+45);
655  centMax = ((centMax*5)+45);
656  }
657 
658  if(fDoTHnSparse){
659  fBackList[iCut] = new TList();
660  fBackList[iCut]->SetName(Form("%s_%s_%s Back histograms",cutstringEvent.Data(),cutstringCalo.Data(), cutstringMeson.Data()));
661  fBackList[iCut]->SetOwner(kTRUE);
662  fCutFolder[iCut]->Add(fBackList[iCut]);
663 
664  fSparseMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m", "Back_Back_InvMass_Pt_z_m", nDim,nBins,xMin,xMax);
665  fBackList[iCut]->Add(fSparseMotherBackInvMassPtZM[iCut]);
666 
667  fMotherList[iCut] = new TList();
668  fMotherList[iCut]->SetName(Form("%s_%s_%s Mother histograms", cutstringEvent.Data(), cutstringCalo.Data(), cutstringMeson.Data()));
669  fMotherList[iCut]->SetOwner(kTRUE);
670  fCutFolder[iCut]->Add(fMotherList[iCut]);
671 
672  fSparseMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m", "Back_Mother_InvMass_Pt_z_m", nDim,nBins,xMin,xMax);
673  fMotherList[iCut]->Add(fSparseMotherInvMassPtZM[iCut]);
674  }
675 
676  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
678  collisionSystem,centMin,centMax,
679  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
680  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity(),
681  4,8,7);
682  }
683  }
684  }
685 }
686 //________________________________________________________________________
688 
689  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
690  if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
691 
692  if (fDoClusterQA == 2) fProduceCellIDPlots = kTRUE;
693  if (fIsMC == 2){
694  fDoTHnSparse = kFALSE;
695  } else if (fIsMC == 3){
696  fDoTHnSparse = kFALSE;
697  }
698 
699  // set common binning in pT for mesons and photons
700  Float_t binWidthPt = 0.1;
701  Int_t nBinsPt = 250;
702  Float_t minPt = 0;
703  Float_t maxPt = 25;
704  Int_t nBinsQAPt = 175;
705  Float_t maxQAPt = 25;
706  Int_t nBinsClusterPt = 500;
707  Float_t minClusterPt = 0;
708  Float_t maxClusterPt = 50;
709  Double_t *arrPtBinning = new Double_t[1200];
710  Double_t *arrQAPtBinning = new Double_t[1200];
711  Double_t *arrClusPtBinning = new Double_t[1200];
712  if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k8TeV ){
713  nBinsPt = 400;
714  minPt = 0;
715  maxPt = 40;
716  for(Int_t i=0; i<nBinsPt+1;i++){
717  arrPtBinning[i] = ((maxPt-minPt)/nBinsPt)*i;
718  }
719  nBinsQAPt = 190;
720  maxQAPt = 40;
721  for(Int_t i=0; i<nBinsQAPt+1;i++){
722  if(i<60) arrQAPtBinning[i] = 0.05*i;
723  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
724  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
725  else if(i<190) arrQAPtBinning[i] = 20.+1.0*(i-170);
726  else arrQAPtBinning[i] = maxQAPt;
727  }
728  nBinsClusterPt = 800;
729  minClusterPt = 0;
730  maxClusterPt = 80;
731  for(Int_t i=0; i<nBinsClusterPt+1;i++){
732  arrClusPtBinning[i] = ((maxClusterPt-minClusterPt)/nBinsClusterPt)*i;
733  }
734  } else if ( ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k13TeV ||
737  binWidthPt = 0.05;
738  nBinsPt = 261;
739  minPt = 0;
740  maxPt = 100;
741  for(Int_t i=0; i<nBinsPt+1;i++){
742  if (i < 1) arrPtBinning[i] = 0.5*i;
743  else if(i<51) arrPtBinning[i] = 0.5+0.05*(i-1);
744  else if(i<121) arrPtBinning[i] = 3.+0.1*(i-51);
745  else if(i<161) arrPtBinning[i] = 10.+0.25*(i-121);
746  else if(i<201) arrPtBinning[i] = 20.+0.5*(i-161);
747  else if(i<261) arrPtBinning[i] = 40.+1.0*(i-201);
748  else arrPtBinning[i] = maxPt;
749  }
750  nBinsQAPt = 270;
751  maxQAPt = 100;
752  for(Int_t i=0; i<nBinsQAPt+1;i++){
753  if(i<60) arrQAPtBinning[i] = 0.05*i;
754  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
755  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
756  else if(i<210) arrQAPtBinning[i] = 20.+0.5*(i-170);
757  else if(i<270) arrQAPtBinning[i] = 40.+1.0*(i-210);
758  else arrQAPtBinning[i] = maxQAPt;
759  }
760  nBinsClusterPt = 301;
761  minClusterPt = 0;
762  maxClusterPt = 100;
763  for(Int_t i=0; i<nBinsClusterPt+1;i++){
764  if (i < 1) arrClusPtBinning[i] = 0.3*i;
765  else if(i<55) arrClusPtBinning[i] = 0.3+0.05*(i-1);
766  else if(i<125) arrClusPtBinning[i] = 3.+0.1*(i-55);
767  else if(i<155) arrClusPtBinning[i] = 10.+0.2*(i-125);
768  else if(i<211) arrClusPtBinning[i] = 16.+0.25*(i-155);
769  else if(i<251) arrClusPtBinning[i] = 30.+0.5*(i-211);
770  else if(i<301) arrClusPtBinning[i] = 50.+1.0*(i-251);
771  else arrClusPtBinning[i] = maxClusterPt;
772  }
773  } else if ( ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kpPb5TeVR2 ||
775  ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k5TeV ){
776  binWidthPt = 0.05;
777  nBinsPt = 201;
778  minPt = 0;
779  maxPt = 60;
780  for(Int_t i=0; i<nBinsPt+1;i++){
781  if (i < 1) arrPtBinning[i] = 0.5*i;
782  else if(i<51) arrPtBinning[i] = 0.5+0.05*(i-1);
783  else if(i<121) arrPtBinning[i] = 3.+0.1*(i-51);
784  else if(i<161) arrPtBinning[i] = 10.+0.25*(i-121);
785  else if(i<201) arrPtBinning[i] = 20.+1.0*(i-161);
786  else arrPtBinning[i] = maxPt;
787  }
788  nBinsQAPt = 210;
789  maxQAPt = 60;
790  for(Int_t i=0; i<nBinsQAPt+1;i++){
791  if(i<60) arrQAPtBinning[i] = 0.05*i;
792  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
793  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
794  else if(i<210) arrQAPtBinning[i] = 20.+1.0*(i-170);
795  else arrQAPtBinning[i] = maxQAPt;
796  }
797  nBinsClusterPt = 301;
798  minClusterPt = 0;
799  maxClusterPt = 100;
800  for(Int_t i=0; i<nBinsClusterPt+1;i++){
801  if (i < 1) arrClusPtBinning[i] = 0.3*i;
802  else if(i<55) arrClusPtBinning[i] = 0.3+0.05*(i-1);
803  else if(i<125) arrClusPtBinning[i] = 3.+0.1*(i-55);
804  else if(i<155) arrClusPtBinning[i] = 10.+0.2*(i-125);
805  else if(i<211) arrClusPtBinning[i] = 16.+0.25*(i-155);
806  else if(i<251) arrClusPtBinning[i] = 30.+0.5*(i-211);
807  else if(i<301) arrClusPtBinning[i] = 50.+1.0*(i-251);
808  else arrClusPtBinning[i] = maxClusterPt;
809  }
810  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kXeXe5440GeV ){
811  nBinsPt = 88;
812  minPt = 0;
813  maxPt = 20;
814  for(Int_t i=0; i<nBinsPt+1;i++){
815  if (i < 1) arrPtBinning[i] = 0.5*i;
816  else if(i<56) arrPtBinning[i] = 0.5+0.1*(i-1);
817  else if(i<80) arrPtBinning[i] = 6.+0.25*(i-56);
818  else if(i<88) arrPtBinning[i] = 12.+1.0*(i-80);
819  else arrPtBinning[i] = maxPt;
820  }
821  nBinsQAPt = 92;
822  maxQAPt = 20;
823  for(Int_t i=0; i<nBinsQAPt+1;i++){
824  if(i<60) arrQAPtBinning[i] = 0.1*i;
825  else if(i<84) arrQAPtBinning[i] = 6.+0.25*(i-60);
826  else if(i<92) arrQAPtBinning[i] = 12.+1.0*(i-84);
827  else arrQAPtBinning[i] = maxQAPt;
828  }
829  nBinsClusterPt = 148;
830  minClusterPt = 0;
831  maxClusterPt = 40;
832  for(Int_t i=0; i<nBinsClusterPt+1;i++){
833  if (i < 1) arrClusPtBinning[i] = 0.3*i;
834  else if(i<98) arrClusPtBinning[i] = 0.3+0.1*(i-1);
835  else if(i<123) arrClusPtBinning[i] = 10.+0.2*(i-98);
836  else if(i<148) arrClusPtBinning[i] = 15.+1.0*(i-123);
837  else arrClusPtBinning[i] = maxClusterPt;
838  }
839  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kPbPb5TeV ){
840  nBinsPt = 88;
841  minPt = 0;
842  maxPt = 20;
843  for(Int_t i=0; i<nBinsPt+1;i++){
844  if (i < 1) arrPtBinning[i] = 0.5*i;
845  else if(i<56) arrPtBinning[i] = 0.5+0.1*(i-1);
846  else if(i<80) arrPtBinning[i] = 6.+0.25*(i-56);
847  else if(i<88) arrPtBinning[i] = 12.+1.0*(i-80);
848  else arrPtBinning[i] = maxPt;
849  }
850  nBinsQAPt = 92;
851  maxQAPt = 20;
852  for(Int_t i=0; i<nBinsQAPt+1;i++){
853  if(i<60) arrQAPtBinning[i] = 0.1*i;
854  else if(i<84) arrQAPtBinning[i] = 6.+0.25*(i-60);
855  else if(i<92) arrQAPtBinning[i] = 12.+1.0*(i-84);
856  else arrQAPtBinning[i] = maxQAPt;
857  }
858  nBinsClusterPt = 148;
859  minClusterPt = 0;
860  maxClusterPt = 40;
861  for(Int_t i=0; i<nBinsClusterPt+1;i++){
862  if (i < 1) arrClusPtBinning[i] = 0.3*i;
863  else if(i<98) arrClusPtBinning[i] = 0.3+0.1*(i-1);
864  else if(i<123) arrClusPtBinning[i] = 10.+0.2*(i-98);
865  else if(i<148) arrClusPtBinning[i] = 15.+1.0*(i-123);
866  else arrClusPtBinning[i] = maxClusterPt;
867  }
868  } else {
869  for(Int_t i=0; i<nBinsPt+1;i++){
870  arrPtBinning[i] = ((maxPt-minPt)/nBinsPt)*i;
871  }
872  for(Int_t i=0; i<nBinsClusterPt+1;i++){
873  arrClusPtBinning[i] = ((maxClusterPt-minClusterPt)/nBinsClusterPt)*i;
874  }
875  for(Int_t i=0; i<nBinsQAPt+1;i++){
876  if(i<60) arrQAPtBinning[i] = 0.05*i;
877  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
878  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
879  else if(i<175) arrQAPtBinning[i] = 20.+1.0*(i-170);
880  else arrQAPtBinning[i] = maxQAPt;
881  }
882  }
883 
884  // Create histograms
885  if(fOutputContainer != NULL){
886  delete fOutputContainer;
887  fOutputContainer = NULL;
888  }
889  if(fOutputContainer == NULL){
890  fOutputContainer = new TList();
891  fOutputContainer->SetOwner(kTRUE);
892  }
893 
894  // Array of current cut's gammas
895  fClusterCandidates = new TList();
896  fClusterCandidates->SetOwner(kTRUE);
897 
898  fCutFolder = new TList*[fnCuts];
899  fESDList = new TList*[fnCuts];
900  if(fDoTHnSparse){
901  fBackList = new TList*[fnCuts];
902  fMotherList = new TList*[fnCuts];
903  }
904  fHistoNEvents = new TH1F*[fnCuts];
905  if(fIsMC > 1){
906  fHistoNEventsWOWeight = new TH1F*[fnCuts];
907  }
908  if(fIsMC == 2){
909  fProfileJetJetXSection = new TProfile*[fnCuts];
910  fHistoJetJetNTrials = new TH1F*[fnCuts];
911  }
912 
913  fHistoNGoodESDTracks = new TH1F*[fnCuts];
914  fHistoVertexZ = new TH1F*[fnCuts];
915  fHistoNGammaCandidates = new TH1F*[fnCuts];
916  fHistoNGammaCandidatesBasic = new TH1F*[fnCuts];
917  if(!fDoLightOutput){
920  fHistoNV0Tracks = new TH1F*[fnCuts];
921  }
922  if(fIsHeavyIon==2) fProfileEtaShift = new TProfile*[fnCuts];
923 
924  if(fDoMesonAnalysis){
927  if(!fDoLightOutput){
930  }
931  if (fDoMesonQA > 0 && fDoMesonQA < 3){
940  }
941  }
942 
946  }
947 
948  fHistoClusGammaPt = new TH1F*[fnCuts];
949  fHistoClusGammaE = new TH1F*[fnCuts];
951  fHistoClusAllHeadersGammaPt = new TH1F*[fnCuts];
953  if(!fDoLightOutput && fDoClusterQA > 0)
955 
956  if (fDoMesonQA == 4 && fIsMC == 0){
957  fTreeList = new TList*[fnCuts];
960  }
961 
962  if (fProduceTreeEOverP){
963  fClusterTreeList = new TList*[fnCuts];
964  tClusterEOverP = new TTree*[fnCuts];
965  }
966 
967  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
968  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
969  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
970  TString cutstringMeson = "NoMesonCut";
971  if(fDoMesonAnalysis)
972  cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
973 
974  fCutFolder[iCut] = new TList();
975  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s", cutstringEvent.Data(), cutstringCalo.Data(), cutstringMeson.Data()));
976  fCutFolder[iCut]->SetOwner(kTRUE);
977  fOutputContainer->Add(fCutFolder[iCut]);
978  fESDList[iCut] = new TList();
979  fESDList[iCut]->SetName(Form("%s_%s_%s ESD histograms", cutstringEvent.Data(), cutstringCalo.Data(), cutstringMeson.Data()));
980  fESDList[iCut]->SetOwner(kTRUE);
981  fCutFolder[iCut]->Add(fESDList[iCut]);
982 
983  fHistoNEvents[iCut] = new TH1F("NEvents", "NEvents", 14, -0.5, 13.5);
984  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
985  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
986  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
987  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
988  TString TriggerNames = "Not Trigger: ";
989  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
990  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
991  } else {
992  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
993  }
994  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
995  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
996  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"SPD Pile-Up");
997  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
998  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
999  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problems");
1000  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
1001  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
1002  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
1003  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
1004  fESDList[iCut]->Add(fHistoNEvents[iCut]);
1005 
1006  if (fIsMC > 1){
1007  fHistoNEventsWOWeight[iCut] = new TH1F("NEventsWOWeight", "NEventsWOWeight", 14, -0.5, 13.5);
1008  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
1009  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
1010  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
1011  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
1012  TString TriggerNames = "Not Trigger: ";
1013  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
1014  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
1015  } else {
1016  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
1017  }
1018  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
1019  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
1020  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
1021  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
1022  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
1023  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
1024  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
1025  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
1026  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
1027  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
1028  fESDList[iCut]->Add(fHistoNEventsWOWeight[iCut]);
1029  }
1030  if (fIsMC == 2){
1031  fProfileJetJetXSection[iCut] = new TProfile("XSection", "XSection", 1, -0.5, 0.5);
1032  fESDList[iCut]->Add(fProfileJetJetXSection[iCut]);
1033  fHistoJetJetNTrials[iCut] = new TH1F("NTrials", "#sum{NTrials}", 1, 0, 1);
1034  fHistoJetJetNTrials[iCut]->GetXaxis()->SetBinLabel(1,"#sum{NTrials}");
1035  fESDList[iCut]->Add(fHistoJetJetNTrials[iCut]);
1036  }
1037 
1038  if(fIsHeavyIon == 1)
1039  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 4000, 0, 4000);
1040  else if(fIsHeavyIon == 2)
1041  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 400, 0, 400);
1042  else
1043  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 200, 0, 200);
1044  fHistoNGoodESDTracks[iCut]->GetXaxis()->SetTitle("#primary tracks");
1045  fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
1046 
1047  fHistoVertexZ[iCut] = new TH1F("VertexZ", "VertexZ", 200, -10, 10);
1048  fHistoVertexZ[iCut]->GetXaxis()->SetTitle("Z_{vtx} (cm)");
1049  fESDList[iCut]->Add(fHistoVertexZ[iCut]);
1050 
1051  if(fIsHeavyIon == 1)
1052  fHistoNGammaCandidatesBasic[iCut] = new TH1F("GammaCandidatesBasic", "GammaCandidatesBasic", 600, 0, 600);
1053  else if(fIsHeavyIon == 2)
1054  fHistoNGammaCandidatesBasic[iCut] = new TH1F("GammaCandidatesBasic", "GammaCandidatesBasic", 400, 0, 400);
1055  else
1056  fHistoNGammaCandidatesBasic[iCut] = new TH1F("GammaCandidatesBasic", "GammaCandidatesBasic", 100, 0, 100);
1057  fHistoNGammaCandidatesBasic[iCut]->GetXaxis()->SetTitle("#cluster candidates basic");
1058  fESDList[iCut]->Add(fHistoNGammaCandidatesBasic[iCut]);
1059 
1060 
1061  if(fIsHeavyIon == 1)
1062  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 200, 0, 200);
1063  else if(fIsHeavyIon == 2)
1064  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 100, 0, 100);
1065  else
1066  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 50, 0, 50);
1067  fHistoNGammaCandidates[iCut]->GetXaxis()->SetTitle("#cluster candidates with current cut");
1068  fESDList[iCut]->Add(fHistoNGammaCandidates[iCut]);
1069 
1070  if(!fDoLightOutput){
1071  if(fIsHeavyIon == 1)
1072  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 4000, 0, 4000, 200, 0, 200);
1073  else if(fIsHeavyIon == 2)
1074  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 400, 0, 400, 100, 0, 100);
1075  else
1076  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 200, 0, 200, 50, 0, 50);
1077  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetXTitle("#good tracks");
1078  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetYTitle("#cluster candidates");
1080 
1081  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters", "SPD tracklets vs SPD clusters", 100, 0, 200, 250, 0, 1000);
1082  fESDList[iCut]->Add(fHistoSPDClusterTrackletBackground[iCut]);
1083 
1084  if(fIsHeavyIon == 1)
1085  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 30000, 0, 30000);
1086  else if(fIsHeavyIon == 2)
1087  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 2500, 0, 2500);
1088  else
1089  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 1500, 0, 1500);
1090  fHistoNV0Tracks[iCut]->SetXTitle("V0 amplitude");
1091  fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
1092  }
1093 
1094  if(fIsHeavyIon==2) {
1095  fProfileEtaShift[iCut] = new TProfile("Eta Shift", "Eta Shift", 1, -0.5, 0.5);
1096  fProfileEtaShift[iCut]->SetXTitle("#eta shift");
1097  fESDList[iCut]->Add(fProfileEtaShift[iCut]);
1098  }
1099 
1100  if (fIsMC > 1){
1101  fHistoNEvents[iCut]->Sumw2();
1102  fHistoNGoodESDTracks[iCut]->Sumw2();
1103  fHistoVertexZ[iCut]->Sumw2();
1104  fHistoNGammaCandidates[iCut]->Sumw2();
1105  fHistoNGammaCandidatesBasic[iCut]->Sumw2();
1106  if(!fDoLightOutput){
1108  fHistoSPDClusterTrackletBackground[iCut]->Sumw2();
1109  fHistoNV0Tracks[iCut]->Sumw2();
1110  }
1111  if(fIsHeavyIon==2) fProfileEtaShift[iCut]->Sumw2();
1112  }
1113 
1114  fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt", "ClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1115  fHistoClusGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1116  fESDList[iCut]->Add(fHistoClusGammaPt[iCut]);
1117  fHistoClusGammaE[iCut] = new TH1F("ClusGamma_E", "ClusGamma_E", nBinsClusterPt, arrClusPtBinning);
1118  fHistoClusGammaPt[iCut]->SetXTitle("E_{clus} (GeV/c)");
1119  fESDList[iCut]->Add(fHistoClusGammaE[iCut]);
1120  fHistoClusOverlapHeadersGammaPt[iCut] = new TH1F("ClusGammaOverlapHeaders_Pt", "ClusGammaOverlapHeaders_Pt", nBinsClusterPt, arrClusPtBinning);
1121  fHistoClusOverlapHeadersGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c), selected header w/ overlap");
1122  fESDList[iCut]->Add(fHistoClusOverlapHeadersGammaPt[iCut]);
1123  fHistoClusAllHeadersGammaPt[iCut] = new TH1F("ClusGammaAllHeaders_Pt", "ClusGammaAllHeaders_Pt", nBinsClusterPt, arrClusPtBinning);
1124  fHistoClusAllHeadersGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c), all headers");
1125  fESDList[iCut]->Add(fHistoClusAllHeadersGammaPt[iCut]);
1126  fHistoClusRejectedHeadersGammaPt[iCut] = new TH1F("ClusGammaRejectedHeaders_Pt", "ClusGammaRejectedHeaders_Pt", nBinsClusterPt, arrClusPtBinning);
1127  fHistoClusRejectedHeadersGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c), rejected headers");
1128  fESDList[iCut]->Add(fHistoClusRejectedHeadersGammaPt[iCut]);
1129  if(!fDoLightOutput && fDoClusterQA > 0){
1130  fHistoClusGammaPtM02[iCut] = new TH2F("ClusGamma_Pt_M02", "ClusGamma_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1131  fHistoClusGammaPtM02[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1132  fHistoClusGammaPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1133  fESDList[iCut]->Add(fHistoClusGammaPtM02[iCut]);
1134  }
1135 
1136  if (fIsMC > 1){
1137  fHistoClusGammaPt[iCut]->Sumw2();
1138  fHistoClusGammaE[iCut]->Sumw2();
1139  fHistoClusOverlapHeadersGammaPt[iCut]->Sumw2();
1140  fHistoClusAllHeadersGammaPt[iCut]->Sumw2();
1141  fHistoClusRejectedHeadersGammaPt[iCut]->Sumw2();
1142  if(!fDoLightOutput && fDoClusterQA > 0)fHistoClusGammaPtM02[iCut]->Sumw2();
1143  }
1144 
1145  if(fDoMesonAnalysis){
1146  fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt", "ESD_Mother_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1147  fHistoMotherInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
1148  fHistoMotherInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1149  fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
1150  fHistoMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt", "ESD_Background_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1151  fHistoMotherBackInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
1152  fHistoMotherBackInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1153  fESDList[iCut]->Add(fHistoMotherBackInvMassPt[iCut]);
1154  if(!fDoLightOutput){
1155  fHistoMotherInvMassPtAlpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_Pt_Alpha", "ESD_Mother_InvMass_vs_Pt_Alpha", 800, 0, 0.8, nBinsPt, arrPtBinning);
1156  fHistoMotherInvMassPtAlpha[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
1157  fHistoMotherInvMassPtAlpha[iCut]->SetYTitle("p_{T} (GeV/c)");
1158  fESDList[iCut]->Add(fHistoMotherInvMassPtAlpha[iCut]);
1159  fHistoMotherBackInvMassPtAlpha[iCut] = new TH2F("ESD_Background_InvMass_vs_Pt_Alpha", "ESD_Background_InvMass_vs_Pt_Alpha", 800, 0, 0.8, nBinsPt, arrPtBinning);
1160  fHistoMotherBackInvMassPtAlpha[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
1161  fHistoMotherBackInvMassPtAlpha[iCut]->SetYTitle("p_{T} (GeV/c)");
1162  fESDList[iCut]->Add(fHistoMotherBackInvMassPtAlpha[iCut]);
1163  }
1164 
1165  if (fIsMC > 1){
1166  fHistoMotherInvMassPt[iCut]->Sumw2();
1167  fHistoMotherBackInvMassPt[iCut]->Sumw2();
1168  if(!fDoLightOutput){
1169  fHistoMotherInvMassPtAlpha[iCut]->Sumw2();
1170  fHistoMotherBackInvMassPtAlpha[iCut]->Sumw2();
1171  }
1172  }
1173 
1174  if (fDoMesonQA > 0 && fDoMesonQA < 3 ){
1175  fHistoMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y", "ESD_MotherPi0_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1176  fHistoMotherPi0PtY[iCut]->SetXTitle("p_{T} (GeV/c)");
1177  fHistoMotherPi0PtY[iCut]->SetYTitle("y_{#pi^{0}}");
1178  fESDList[iCut]->Add(fHistoMotherPi0PtY[iCut]);
1179  fHistoMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y", "ESD_MotherEta_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1180  fHistoMotherEtaPtY[iCut]->SetXTitle("p_{T} (GeV/c)");
1181  fHistoMotherEtaPtY[iCut]->SetYTitle("y_{#eta}");
1182  fESDList[iCut]->Add(fHistoMotherEtaPtY[iCut]);
1183  fHistoMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha", "ESD_MotherPi0_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
1184  fHistoMotherPi0PtAlpha[iCut]->SetXTitle("p_{T} (GeV/c)");
1185  fHistoMotherPi0PtAlpha[iCut]->SetYTitle("#alpha_{#pi^{0}}");
1186  fESDList[iCut]->Add(fHistoMotherPi0PtAlpha[iCut]);
1187  fHistoMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha", "ESD_MotherEta_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
1188  fHistoMotherEtaPtAlpha[iCut]->SetXTitle("p_{T} (GeV/c)");
1189  fHistoMotherEtaPtAlpha[iCut]->SetYTitle("#alpha_{#eta}");
1190  fESDList[iCut]->Add(fHistoMotherEtaPtAlpha[iCut]);
1191  fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle", "ESD_MotherPi0_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning,100,0, 0.5);
1192  fHistoMotherPi0PtOpenAngle[iCut]->SetXTitle("p_{T} (GeV/c)");
1193  fHistoMotherPi0PtOpenAngle[iCut]->SetYTitle("#theta_{#pi^{0}}");
1194  fESDList[iCut]->Add(fHistoMotherPi0PtOpenAngle[iCut]);
1195  fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle", "ESD_MotherEta_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning,180,0, 1.8);
1196  fHistoMotherEtaPtOpenAngle[iCut]->SetXTitle("p_{T} (GeV/c)");
1197  fHistoMotherEtaPtOpenAngle[iCut]->SetYTitle("#theta_{#eta}");
1198  fESDList[iCut]->Add(fHistoMotherEtaPtOpenAngle[iCut]);
1199  if(fIsHeavyIon == 1){
1200  fHistoMotherPi0NGoodESDTracksPt[iCut] = new TH2F("ESD_MotherPi0_GoodESDTracks_Pt", "ESD_MotherPi0_GoodESDTracks_Pt", 4000, 0, 4000, nBinsQAPt, arrQAPtBinning);
1201  fHistoMotherPi0NGoodESDTracksPt[iCut]->SetXTitle("# good tracks");
1202  fHistoMotherPi0NGoodESDTracksPt[iCut]->SetYTitle("p_{#pi^{0}, T} (GeV/c)");
1203  fHistoMotherEtaNGoodESDTracksPt[iCut] = new TH2F("ESD_MotherEta_GoodESDTracks_Pt", "ESD_MotherEta_GoodESDTracks_Pt", 4000, 0, 4000, nBinsQAPt, arrQAPtBinning);
1204  fHistoMotherEtaNGoodESDTracksPt[iCut]->SetXTitle("# good tracks");
1205  fHistoMotherEtaNGoodESDTracksPt[iCut]->SetYTitle("p_{#eta, T} (GeV/c)");
1206  }else if(fIsHeavyIon == 2){
1207  fHistoMotherPi0NGoodESDTracksPt[iCut] = new TH2F("ESD_MotherPi0_GoodESDTracks_Pt", "ESD_MotherPi0_GoodESDTracks_Pt", 400, 0, 400, nBinsQAPt, arrQAPtBinning);
1208  fHistoMotherPi0NGoodESDTracksPt[iCut]->SetXTitle("# good tracks");
1209  fHistoMotherPi0NGoodESDTracksPt[iCut]->SetYTitle("p_{#pi^{0}, T} (GeV/c)");
1210  fHistoMotherEtaNGoodESDTracksPt[iCut] = new TH2F("ESD_MotherEta_GoodESDTracks_Pt", "ESD_MotherEta_GoodESDTracks_Pt", 400, 0, 400, nBinsQAPt, arrQAPtBinning);
1211  fHistoMotherEtaNGoodESDTracksPt[iCut]->SetXTitle("# good tracks");
1212  fHistoMotherEtaNGoodESDTracksPt[iCut]->SetYTitle("p_{#eta, T} (GeV/c)");
1213  }else{
1214  fHistoMotherPi0NGoodESDTracksPt[iCut] = new TH2F("ESD_MotherPi0_GoodESDTracks_Pt", "ESD_MotherPi0_GoodESDTracks_Pt", 200, 0, 200, nBinsQAPt, arrQAPtBinning);
1215  fHistoMotherPi0NGoodESDTracksPt[iCut]->SetXTitle("# good tracks");
1216  fHistoMotherPi0NGoodESDTracksPt[iCut]->SetYTitle("p_{#pi^{0}, T} (GeV/c)");
1217  fHistoMotherEtaNGoodESDTracksPt[iCut] = new TH2F("ESD_MotherEta_GoodESDTracks_Pt", "ESD_MotherEta_GoodESDTracks_Pt", 200, 0, 200, nBinsQAPt, arrQAPtBinning);
1218  fHistoMotherEtaNGoodESDTracksPt[iCut]->SetXTitle("# good tracks");
1219  fHistoMotherEtaNGoodESDTracksPt[iCut]->SetYTitle("p_{#eta, T} (GeV/c)");
1220  }
1221  fESDList[iCut]->Add(fHistoMotherPi0NGoodESDTracksPt[iCut]);
1222  fESDList[iCut]->Add(fHistoMotherEtaNGoodESDTracksPt[iCut]);
1223  }
1224 
1225  if (fIsMC > 1 && fDoMesonQA > 0 && fDoMesonQA < 3){
1226  fHistoMotherPi0PtY[iCut]->Sumw2();
1227  fHistoMotherEtaPtY[iCut]->Sumw2();
1228  fHistoMotherPi0PtAlpha[iCut]->Sumw2();
1229  fHistoMotherEtaPtAlpha[iCut]->Sumw2();
1230  fHistoMotherPi0PtOpenAngle[iCut]->Sumw2();
1231  fHistoMotherEtaPtOpenAngle[iCut]->Sumw2();
1232  fHistoMotherPi0NGoodESDTracksPt[iCut]->Sumw2();
1233  fHistoMotherEtaNGoodESDTracksPt[iCut]->Sumw2();
1234  }
1235 
1236  if (fProduceCellIDPlots){
1237  Int_t nMaxCells = 12*48*24;
1238  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetClusterType() == 2) nMaxCells = 5*56*64;
1239  fHistCellIDvsClusterEnergy[iCut] = new TH2F("CellIDvsClusterEnergy", "CellIDvsClusterEnergy", 100, 0.5, 100., nMaxCells, 0, nMaxCells);
1240  fHistCellIDvsClusterEnergy[iCut]->SetXTitle("E_{clus} (GeV)");
1241  fHistCellIDvsClusterEnergy[iCut]->SetYTitle("Cell ID");
1243  fESDList[iCut]->Add(fHistCellIDvsClusterEnergy[iCut]);
1244  fHistCellIDvsClusterEnergyMax[iCut] = new TH2F("CellIDvsClusterEnergyMax", "CellIDvsClusterEnergyMax", 100, 0.5, 100., nMaxCells, 0, nMaxCells);
1245  fHistCellIDvsClusterEnergyMax[iCut]->SetXTitle("E_{clus} (GeV)");
1246  fHistCellIDvsClusterEnergyMax[iCut]->SetYTitle("Cell ID");
1248  fESDList[iCut]->Add(fHistCellIDvsClusterEnergyMax[iCut]);
1249  }
1250 
1251  if (fDoMesonQA == 4 && fIsMC == 0){
1252  fTreeList[iCut] = new TList();
1253  fTreeList[iCut]->SetName(Form("%s_%s_%s InvMass Tree", cutstringEvent.Data(), cutstringCalo.Data(), cutstringMeson.Data()));
1254  fTreeList[iCut]->SetOwner(kTRUE);
1255  fCutFolder[iCut]->Add(fTreeList[iCut]);
1256 
1257  tSigInvMassPtAlphaTheta[iCut] = new TTree("Sig_InvMass_Pt_Alpha_Theta_MixPool", "Sig_InvMass_Pt_Alpha_Theta_MixPool");
1258  tSigInvMassPtAlphaTheta[iCut]->Branch("InvMass",&fInvMassTreeInvMass,"fInvMassTreeInvMass/F");
1259  tSigInvMassPtAlphaTheta[iCut]->Branch("Pt",&fInvMassTreePt,"fInvMassTreePt/F");
1260  tSigInvMassPtAlphaTheta[iCut]->Branch("Alpha",&fInvMassTreeAlpha,"fInvMassTreeAlpha/F");
1261  tSigInvMassPtAlphaTheta[iCut]->Branch("Theta",&fInvMassTreeTheta,"fInvMassTreeTheta/F");
1262  tSigInvMassPtAlphaTheta[iCut]->Branch("MixPool",&fInvMassTreeMixPool,"fInvMassTreeMixPool/I");
1263  tSigInvMassPtAlphaTheta[iCut]->Branch("zVtx",&fInvMassTreeZVertex,"fInvMassTreeZVertex/F");
1264  tSigInvMassPtAlphaTheta[iCut]->Branch("Eta",&fInvMassTreeEta,"fInvMassTreeEta/F");
1265  fTreeList[iCut]->Add(tSigInvMassPtAlphaTheta[iCut]);
1266 
1267  tBckInvMassPtAlphaTheta[iCut] = new TTree("Bck_InvMass_Pt_Alpha_Theta_MixPool", "Bck_InvMass_Pt_Alpha_Theta_MixPool");
1268  tBckInvMassPtAlphaTheta[iCut]->Branch("InvMass",&fInvMassTreeInvMass,"fInvMassTreeInvMass/F");
1269  tBckInvMassPtAlphaTheta[iCut]->Branch("Pt",&fInvMassTreePt,"fInvMassTreePt/F");
1270  tBckInvMassPtAlphaTheta[iCut]->Branch("Alpha",&fInvMassTreeAlpha,"fInvMassTreeAlpha/F");
1271  tBckInvMassPtAlphaTheta[iCut]->Branch("Theta",&fInvMassTreeTheta,"fInvMassTreeTheta/F");
1272  tBckInvMassPtAlphaTheta[iCut]->Branch("MixPool",&fInvMassTreeMixPool,"fInvMassTreeMixPool/I");
1273  tBckInvMassPtAlphaTheta[iCut]->Branch("zVtx",&fInvMassTreeZVertex,"fInvMassTreeZVertex/F");
1274  tBckInvMassPtAlphaTheta[iCut]->Branch("Eta",&fInvMassTreeEta,"fInvMassTreeEta/F");
1275  fTreeList[iCut]->Add(tBckInvMassPtAlphaTheta[iCut]);
1276  }
1277 
1278  if (fProduceTreeEOverP ){
1279  fClusterTreeList[iCut] = new TList();
1280  fClusterTreeList[iCut]->SetName(Form("%s_%s EoverP Tree",cutstringEvent.Data(),cutstringCalo.Data()));
1281  fClusterTreeList[iCut]->SetOwner(kTRUE);
1282  fCutFolder[iCut]->Add(fClusterTreeList[iCut]);
1283 
1284  tClusterEOverP[iCut] = new TTree("EOverP_ClusE_ClusM02_ClusM20_TrackP_TrackPt", "EOverP_ClusE_ClusM02_ClusM20_TrackP_TrackPt");
1285  tClusterEOverP[iCut]->Branch("ClusE",&fClusterE,"fClusterE/F");
1286  tClusterEOverP[iCut]->Branch("ClusM02",&fClusterM02,"fClusterM02/F");
1287  tClusterEOverP[iCut]->Branch("ClusM20",&fClusterM20,"fClusterM20/F");
1288  tClusterEOverP[iCut]->Branch("ClusEP",&fClusterEP,"fClusterEP/F");
1289  tClusterEOverP[iCut]->Branch("ClusLeadCellID",&fClusterLeadCellID,"fClusterLeadCellID/I");
1290  if(fIsMC > 0) tClusterEOverP[iCut]->Branch("ClusClassification",&fClusterClassification,"fClusterClassification/I");
1291  tClusterEOverP[iCut]->Branch("ClusTrackDeltaEta",&fDeltaEta,"fDeltaEta/F");
1292  tClusterEOverP[iCut]->Branch("ClusTrackDeltaPhi",&fDeltaPhi,"fDeltaPhi/F");
1293  tClusterEOverP[iCut]->Branch("TrackPt",&fTrackPt,"fTrackPt/F");
1294  tClusterEOverP[iCut]->Branch("TrackPID_e",&fTrackPID_e,"fTrackPID_e/I");
1295  tClusterEOverP[iCut]->Branch("TrackPID_Pi",&fTrackPID_Pi,"fTrackPID_Pi/I");
1296  tClusterEOverP[iCut]->Branch("TrackPID_K",&fTrackPID_K,"fTrackPID_K/I");
1297  tClusterEOverP[iCut]->Branch("TrackPID_P",&fTrackPID_P,"fTrackPID_P/I");
1298  tClusterEOverP[iCut]->Branch("ClusIsoSumClusEt",&fClusterIsoSumClusterEt,"fClusterIsoSumClusterEt/F");
1299  tClusterEOverP[iCut]->Branch("ClusIsoSumTrackEt",&fClusterIsoSumTrackEt,"fClusterIsoSumTrackEt/F");
1300  fClusterTreeList[iCut]->Add(tClusterEOverP[iCut]);
1301  }
1302  }
1303  }
1304  if(fDoMesonAnalysis){
1305  InitBack(); // Init Background Handler
1306  }
1307 
1308  if(fIsMC> 0){
1309  // MC Histogramms
1310  fMCList = new TList*[fnCuts];
1311  // True Histogramms
1312  fTrueList = new TList*[fnCuts];
1313  // Selected Header List
1314  if (fDoMesonQA ==3){
1315  fTreeList = new TList*[fnCuts];
1317  }
1318 
1319  if(!fDoLightOutput){
1320  fHistoMCHeaders = new TH1I*[fnCuts];
1321  fHistoMCAllGammaPt = new TH1F*[fnCuts];
1323  fHistoMCDecayGammaPi0Pt = new TH1F*[fnCuts];
1324  fHistoMCDecayGammaRhoPt = new TH1F*[fnCuts];
1325  fHistoMCDecayGammaEtaPt = new TH1F*[fnCuts];
1326  fHistoMCDecayGammaOmegaPt = new TH1F*[fnCuts];
1327  fHistoMCDecayGammaEtapPt = new TH1F*[fnCuts];
1328  fHistoMCDecayGammaPhiPt = new TH1F*[fnCuts];
1329  fHistoMCDecayGammaSigmaPt = new TH1F*[fnCuts];
1332  if (fDoClusterQA > 1) {
1345  }
1346  }
1347 
1348  fHistoTrueClusGammaPt = new TH1F*[fnCuts];
1349  if(!fDoLightOutput){
1351  fHistoTruePrimaryClusGammaPt = new TH1F*[fnCuts];
1365  fHistoTrueNLabelsInClus = new TH1F*[fnCuts];
1366  }
1369 
1370 // fHistoTruePi0NonLinearity = new TH2F*[fnCuts];
1371 // fHistoTrueEtaNonLinearity = new TH2F*[fnCuts];
1372 
1373  if (fDoClusterQA > 0){
1374  fHistoTrueClusUnConvGammaPt = new TH1F*[fnCuts];
1376  if (!fDoLightOutput)
1378  fHistoTrueClusElectronPt = new TH1F*[fnCuts];
1379  fHistoTrueClusConvGammaPt = new TH1F*[fnCuts];
1380  fHistoTrueClusConvGammaMCPt = new TH1F*[fnCuts];
1382  fHistoTrueClusMergedGammaPt = new TH1F*[fnCuts];
1384  fHistoTrueClusDalitzPt = new TH1F*[fnCuts];
1385  fHistoTrueClusDalitzMergedPt = new TH1F*[fnCuts];
1387  fHistoTrueClusShowerPt = new TH1F*[fnCuts];
1388  fHistoTrueClusSubLeadingPt = new TH1F*[fnCuts];
1389  fHistoTrueClusNParticles = new TH1F*[fnCuts];
1390  fHistoTrueClusEMNonLeadingPt = new TH1F*[fnCuts];
1391  }
1392 
1393  if(fDoMesonAnalysis){
1394  fHistoMCPi0Pt = new TH1F*[fnCuts];
1395  fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
1396  fHistoMCEtaPt = new TH1F*[fnCuts];
1397  fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
1398  fHistoMCPi0InAccPt = new TH1F*[fnCuts];
1399  fHistoMCEtaInAccPt = new TH1F*[fnCuts];
1400 
1401  if (fIsMC > 1){
1402  fHistoMCPi0WOEvtWeightPt = new TH1F*[fnCuts];
1403  fHistoMCEtaWOEvtWeightPt = new TH1F*[fnCuts];
1406  }
1407 
1423  if(!fDoLightOutput){
1426  }
1430  fHistoMCSecPi0Source = new TH1F*[fnCuts];
1431  fHistoMCSecEtaPt = new TH1F*[fnCuts];
1432  fHistoMCSecEtaSource = new TH1F*[fnCuts];
1433 
1434  if (fDoMesonQA > 0 && fDoMesonQA < 3 ){
1435  fHistoMCPi0PtY = new TH2F*[fnCuts];
1436  fHistoMCEtaPtY = new TH2F*[fnCuts];
1437  fHistoMCPi0PtAlpha = new TH2F*[fnCuts];
1438  fHistoMCEtaPtAlpha = new TH2F*[fnCuts];
1439  if (fIsMC == 2){
1440  fHistoMCPi0PtJetPt = new TH2F*[fnCuts];
1441  fHistoMCEtaPtJetPt = new TH2F*[fnCuts];
1442  }
1443 
1444  if (fIsMC < 2){
1465  }
1466  fHistoTruePi0PtY = new TH2F*[fnCuts];
1467  fHistoTrueEtaPtY = new TH2F*[fnCuts];
1476  }
1477  if (fDoMesonQA==2){
1492  }
1493  }
1494 
1495 
1496 
1497  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1498  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
1499  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
1500  TString cutstringMeson = "NoMesonCut";
1501  if(fDoMesonAnalysis)
1502  cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
1503 
1504  fMCList[iCut] = new TList();
1505  fMCList[iCut]->SetName(Form("%s_%s_%s MC histograms", cutstringEvent.Data(), cutstringCalo.Data(), cutstringMeson.Data()));
1506  fMCList[iCut]->SetOwner(kTRUE);
1507  fCutFolder[iCut]->Add(fMCList[iCut]);
1508 
1509  if(!fDoLightOutput){
1510  fHistoMCHeaders[iCut] = new TH1I("MC_Headers", "MC_Headers", 20, 0, 20);
1511  fHistoMCHeaders[iCut]->SetXTitle("accepted headers");
1512  fMCList[iCut]->Add(fHistoMCHeaders[iCut]);
1513  fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt", "MC_AllGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1514  fHistoMCAllGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1515  fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
1516  fHistoMCAllSecondaryGammaPt[iCut] = new TH2F("MC_AllSecondaryGamma_Pt", "MC_AllSecondaryGamma_Pt", nBinsClusterPt, arrClusPtBinning, 5, -0.5, 4.5);
1517  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1518  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1519  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1520  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"Eta");
1521  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(5,"rest");
1522  fHistoMCAllSecondaryGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1523  fHistoMCAllSecondaryGammaPt[iCut]->SetYTitle("sec. particle");
1524  fMCList[iCut]->Add(fHistoMCAllSecondaryGammaPt[iCut]);
1525  fHistoMCDecayGammaPi0Pt[iCut] = new TH1F("MC_DecayGammaPi0_Pt", "MC_DecayGammaPi0_Pt", nBinsClusterPt, arrClusPtBinning);
1526  fHistoMCDecayGammaPi0Pt[iCut]->SetXTitle("p_{T} (GeV/c)");
1527  fMCList[iCut]->Add(fHistoMCDecayGammaPi0Pt[iCut]);
1528  fHistoMCDecayGammaRhoPt[iCut] = new TH1F("MC_DecayGammaRho_Pt", "MC_DecayGammaRho_Pt", nBinsClusterPt, arrClusPtBinning);
1529  fHistoMCDecayGammaRhoPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1530  fMCList[iCut]->Add(fHistoMCDecayGammaRhoPt[iCut]);
1531  fHistoMCDecayGammaEtaPt[iCut] = new TH1F("MC_DecayGammaEta_Pt", "MC_DecayGammaEta_Pt", nBinsClusterPt, arrClusPtBinning);
1532  fHistoMCDecayGammaEtaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1533  fMCList[iCut]->Add(fHistoMCDecayGammaEtaPt[iCut]);
1534  fHistoMCDecayGammaOmegaPt[iCut] = new TH1F("MC_DecayGammaOmega_Pt", "MC_DecayGammaOmmega_Pt", nBinsClusterPt, arrClusPtBinning);
1535  fHistoMCDecayGammaOmegaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1536  fMCList[iCut]->Add(fHistoMCDecayGammaOmegaPt[iCut]);
1537  fHistoMCDecayGammaEtapPt[iCut] = new TH1F("MC_DecayGammaEtap_Pt", "MC_DecayGammaEtap_Pt", nBinsClusterPt, arrClusPtBinning);
1538  fHistoMCDecayGammaEtapPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1539  fMCList[iCut]->Add(fHistoMCDecayGammaEtapPt[iCut]);
1540  fHistoMCDecayGammaPhiPt[iCut] = new TH1F("MC_DecayGammaPhi_Pt", "MC_DecayGammaPhi_Pt", nBinsClusterPt, arrClusPtBinning);
1541  fHistoMCDecayGammaPhiPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1542  fMCList[iCut]->Add(fHistoMCDecayGammaPhiPt[iCut]);
1543  fHistoMCDecayGammaSigmaPt[iCut] = new TH1F("MC_DecayGammaSigma_Pt", "MC_DecayGammaSigma_Pt", nBinsClusterPt, arrClusPtBinning);
1544  fHistoMCDecayGammaSigmaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1545  fMCList[iCut]->Add(fHistoMCDecayGammaSigmaPt[iCut]);
1546 
1547  if (fIsMC > 1){
1548  fHistoMCAllGammaPt[iCut]->Sumw2();
1549  fHistoMCAllSecondaryGammaPt[iCut]->Sumw2();
1550  fHistoMCDecayGammaPi0Pt[iCut]->Sumw2();
1551  fHistoMCDecayGammaRhoPt[iCut]->Sumw2();
1552  fHistoMCDecayGammaEtaPt[iCut]->Sumw2();
1553  fHistoMCDecayGammaOmegaPt[iCut]->Sumw2();
1554  fHistoMCDecayGammaEtapPt[iCut]->Sumw2();
1555  fHistoMCDecayGammaPhiPt[iCut]->Sumw2();
1556  fHistoMCDecayGammaSigmaPt[iCut]->Sumw2();
1557  }
1558  }
1559 
1560  if(fDoMesonAnalysis){
1561  fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt", "MC_Pi0_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1562  fHistoMCPi0Pt[iCut]->SetXTitle("p_{T} (GeV/c)");
1563  fHistoMCPi0Pt[iCut]->Sumw2();
1564  fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
1565  fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt", "MC_Pi0_WOWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1566  fHistoMCPi0WOWeightPt[iCut]->Sumw2();
1567  fHistoMCPi0WOWeightPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1568  fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
1569 
1570  fHistoMCEtaPt[iCut] = new TH1F("MC_Eta_Pt", "MC_Eta_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1571  fHistoMCEtaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1572  fHistoMCEtaPt[iCut]->Sumw2();
1573  fMCList[iCut]->Add(fHistoMCEtaPt[iCut]);
1574  fHistoMCEtaWOWeightPt[iCut] = new TH1F("MC_Eta_WOWeights_Pt", "MC_Eta_WOWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1575  fHistoMCEtaWOWeightPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1576  fHistoMCEtaWOWeightPt[iCut]->Sumw2();
1577  fMCList[iCut]->Add(fHistoMCEtaWOWeightPt[iCut]);
1578  fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt", "MC_Pi0InAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1579  fHistoMCPi0InAccPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1580  fHistoMCPi0InAccPt[iCut]->Sumw2();
1581  fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
1582  fHistoMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt", "MC_EtaInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1583  fHistoMCEtaInAccPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1584  fHistoMCEtaInAccPt[iCut]->Sumw2();
1585  fMCList[iCut]->Add(fHistoMCEtaInAccPt[iCut]);
1586  if (fIsMC > 1){
1587  fHistoMCPi0WOWeightPt[iCut]->Sumw2();
1588  fHistoMCEtaWOWeightPt[iCut]->Sumw2();
1589  fHistoMCPi0WOEvtWeightPt[iCut] = new TH1F("MC_Pi0_WOEventWeights_Pt", "MC_Pi0_WOEventWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1590  fHistoMCPi0WOEvtWeightPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1591  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightPt[iCut]);
1592  fHistoMCEtaWOEvtWeightPt[iCut] = new TH1F("MC_Eta_WOEventWeights_Pt", "MC_Eta_WOEventWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1593  fHistoMCEtaWOEvtWeightPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1594  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightPt[iCut]);
1595  fHistoMCPi0WOEvtWeightInAccPt[iCut] = new TH1F("MC_Pi0WOEvtWeightInAcc_Pt", "MC_Pi0WOEvtWeightInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1596  fHistoMCPi0WOEvtWeightInAccPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1597  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightInAccPt[iCut]);
1598  fHistoMCEtaWOEvtWeightInAccPt[iCut] = new TH1F("MC_EtaWOEvtWeightInAcc_Pt", "MC_EtaWOEvtWeightInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1599  fHistoMCEtaWOEvtWeightInAccPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1600  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightInAccPt[iCut]);
1601  if (fDoMesonQA > 0 && fDoMesonQA < 3 && fIsMC == 2){
1602  fHistoMCPi0PtJetPt[iCut] = new TH2F("MC_Pi0_Pt_JetPt", "MC_Pi0_Pt_JetPt", nBinsQAPt, arrQAPtBinning, 200, 0, 200);
1603  fHistoMCPi0PtJetPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1604  fHistoMCPi0PtJetPt[iCut]->SetYTitle("p_{jet, T} (GeV/c)");
1605  fHistoMCPi0PtJetPt[iCut]->Sumw2();
1606  fMCList[iCut]->Add(fHistoMCPi0PtJetPt[iCut]);
1607  fHistoMCEtaPtJetPt[iCut] = new TH2F("MC_Eta_Pt_JetPt", "MC_Eta_Pt_JetPt", nBinsQAPt, arrQAPtBinning, 200, 0, 200);
1608  fHistoMCEtaPtJetPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1609  fHistoMCEtaPtJetPt[iCut]->SetYTitle("p_{jet, T} (GeV/c)");
1610  fHistoMCEtaPtJetPt[iCut]->Sumw2();
1611  fMCList[iCut]->Add(fHistoMCEtaPtJetPt[iCut]);
1612  }
1613  }
1614 
1615  fHistoMCPrimaryPtvsSource[iCut] = new TH2F("MC_Primary_Pt_Source", "MC_Primary_Pt_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 7, -0.5, 6.5);
1616  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(1,"Pi+");
1617  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(2,"Pi-");
1618  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(3,"K+");
1619  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(4,"K-");
1620  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(5,"K0s");
1621  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(6,"K0l");
1622  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(7,"Lambda");
1623  fHistoMCPrimaryPtvsSource[iCut]->SetXTitle("p_{T} (GeV/c)");
1624  fHistoMCPrimaryPtvsSource[iCut]->SetYTitle("particle");
1625  fMCList[iCut]->Add(fHistoMCPrimaryPtvsSource[iCut]);
1626 
1627  fHistoMCSecPi0Source[iCut] = new TH1F("MC_SecPi0_Source", "MC_SecPi0_Source", 5000, 0., 5000);
1628  fHistoMCSecPi0Source[iCut]->SetYTitle("source PDG");
1629  fMCList[iCut]->Add(fHistoMCSecPi0Source[iCut]);
1630  fHistoMCSecEtaSource[iCut] = new TH1F("MC_SecEta_Source", "MC_SecEta_Source", 5000, 0, 5000);
1631  fHistoMCSecEtaSource[iCut]->SetYTitle("source PDG");
1632  fMCList[iCut]->Add(fHistoMCSecEtaSource[iCut]);
1633  fHistoMCSecPi0PtvsSource[iCut] = new TH2F("MC_SecPi0_Pt_Source", "MC_SecPi0_Pt_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1634  fHistoMCSecPi0PtvsSource[iCut]->SetXTitle("p_{T} (GeV/c)");
1635  fHistoMCSecPi0PtvsSource[iCut]->SetYTitle("source");
1636  fMCList[iCut]->Add(fHistoMCSecPi0PtvsSource[iCut]);
1637  fHistoMCSecPi0InAccPtvsSource[iCut] = new TH2F("MC_SecPi0InAcc_Pt_Source", "MC_SecPi0InAcc_Pt_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1638  fHistoMCSecPi0InAccPtvsSource[iCut]->SetXTitle("p_{T} (GeV/c)");
1639  fHistoMCSecPi0InAccPtvsSource[iCut]->SetYTitle("source");
1640  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtvsSource[iCut]);
1641  fHistoMCSecEtaPt[iCut] = new TH1F("MC_SecEta_Pt", "MC_SecEta_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1642  fHistoMCSecEtaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1643  fMCList[iCut]->Add(fHistoMCSecEtaPt[iCut]);
1644  if (fIsMC == 2) {
1645  fHistoMCPrimaryPtvsSource[iCut]->Sumw2();
1646  fHistoMCSecPi0PtvsSource[iCut]->Sumw2();
1647  fHistoMCSecPi0InAccPtvsSource[iCut]->Sumw2();
1648  fHistoMCSecEtaPt[iCut]->Sumw2();
1649  }
1650 
1651 
1652  if (fDoMesonQA > 0 && fDoMesonQA < 3){
1653  fHistoMCPi0PtY[iCut] = new TH2F("MC_Pi0_Pt_Y", "MC_Pi0_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1654  fHistoMCPi0PtY[iCut]->SetXTitle("p_{T} (GeV/c)");
1655  fHistoMCPi0PtY[iCut]->SetYTitle("y");
1656  fHistoMCPi0PtY[iCut]->Sumw2();
1657  fMCList[iCut]->Add(fHistoMCPi0PtY[iCut]);
1658  fHistoMCEtaPtY[iCut] = new TH2F("MC_Eta_Pt_Y", "MC_Eta_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1659  fHistoMCEtaPtY[iCut]->SetXTitle("p_{T} (GeV/c)");
1660  fHistoMCEtaPtY[iCut]->SetYTitle("y");
1661  fHistoMCEtaPtY[iCut]->Sumw2();
1662  fMCList[iCut]->Add(fHistoMCEtaPtY[iCut]);
1663  fHistoMCPi0PtAlpha[iCut] = new TH2F("MC_Pi0_Pt_Alpha", "MC_Pi0_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
1664  fHistoMCPi0PtAlpha[iCut]->SetXTitle("p_{T} (GeV/c)");
1665  fHistoMCPi0PtAlpha[iCut]->SetYTitle("#alpha");
1666  fMCList[iCut]->Add(fHistoMCPi0PtAlpha[iCut]);
1667  fHistoMCEtaPtAlpha[iCut] = new TH2F("MC_Eta_Pt_Alpha", "MC_Eta_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
1668  fHistoMCEtaPtAlpha[iCut]->SetXTitle("p_{T} (GeV/c)");
1669  fHistoMCEtaPtAlpha[iCut]->SetYTitle("#alpha");
1670  fMCList[iCut]->Add(fHistoMCEtaPtAlpha[iCut]);
1671 
1672  if (fIsMC == 2) {
1673  fHistoMCPi0PtAlpha[iCut]->Sumw2();
1674  fHistoMCEtaPtAlpha[iCut]->Sumw2();
1675  }
1676  }
1677  }
1678  fTrueList[iCut] = new TList();
1679  fTrueList[iCut]->SetName(Form("%s_%s_%s True histograms", cutstringEvent.Data(), cutstringCalo.Data(), cutstringMeson.Data()));
1680  fTrueList[iCut]->SetOwner(kTRUE);
1681  fCutFolder[iCut]->Add(fTrueList[iCut]);
1682 
1683  if(!fDoLightOutput){
1684  fHistoClusPhotonBGPt[iCut] = new TH2F("ESD_TrueClusPhotonBG_Pt", "ESD_TrueClusPhotonBG_Pt", nBinsClusterPt, arrClusPtBinning,10,-0.5,9.5);
1685  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec");
1686  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 2,"Pion");
1687  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 3,"Proton");
1688  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 4,"Kaon");
1689  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 5,"Neutron");
1690  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 6,"K0s");
1691  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 7,"Lambda");
1692  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 8,"Muon");
1693  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 9,"K0l");
1694  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 10,"Rest");
1695  fHistoClusPhotonBGPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1696  fHistoClusPhotonBGPt[iCut]->SetYTitle("source");
1697  fTrueList[iCut]->Add(fHistoClusPhotonBGPt[iCut]);
1698  fHistoClusPhotonPlusConvBGPt[iCut] = new TH2F("ESD_TrueClusPhotonPlusConvBG_Pt", "ESD_TrueClusPhotonPlusConvBG_Pt", nBinsClusterPt, arrClusPtBinning,10,-0.5,9.5);
1699  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec");
1700  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 2,"Pion");
1701  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 3,"Proton");
1702  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 4,"Kaon");
1703  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 5,"Neutron");
1704  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 6,"K0s");
1705  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 7,"Lambda");
1706  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 8,"Muon");
1707  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 9,"K0l");
1708  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel(10,"Rest");
1709  fHistoClusPhotonPlusConvBGPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1710  fHistoClusPhotonPlusConvBGPt[iCut]->SetYTitle("source");
1711  fTrueList[iCut]->Add(fHistoClusPhotonPlusConvBGPt[iCut]);
1712 
1713  if (fDoClusterQA > 1) {
1714  fHistoClustPhotonElectronBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonElectronBG_Pt_M02", "ESD_TrueClusPhotonElectronBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1715  fHistoClustPhotonElectronBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1716  fHistoClustPhotonElectronBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1717  fTrueList[iCut]->Add(fHistoClustPhotonElectronBGPtM02[iCut]);
1718  fHistoClustPhotonPionBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonPionBG_Pt_M02", "ESD_TrueClusPhotonPionBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1719  fHistoClustPhotonPionBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1720  fHistoClustPhotonPionBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1721  fTrueList[iCut]->Add(fHistoClustPhotonPionBGPtM02[iCut]);
1722  fHistoClustPhotonKaonBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonKaonBG_Pt_M02", "ESD_TrueClusPhotonKaonBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1723  fHistoClustPhotonKaonBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1724  fHistoClustPhotonKaonBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1725  fTrueList[iCut]->Add(fHistoClustPhotonKaonBGPtM02[iCut]);
1726  fHistoClustPhotonK0lBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonK0lBG_Pt_M02", "ESD_TrueClusPhotonK0lBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1727  fHistoClustPhotonK0lBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1728  fHistoClustPhotonK0lBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1729  fTrueList[iCut]->Add(fHistoClustPhotonK0lBGPtM02[iCut]);
1730  fHistoClustPhotonNeutronBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonNeutronBG_Pt_M02", "ESD_TrueClusPhotonNeutronBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1731  fHistoClustPhotonNeutronBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1732  fHistoClustPhotonNeutronBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1733  fTrueList[iCut]->Add(fHistoClustPhotonNeutronBGPtM02[iCut]);
1734  fHistoClustPhotonRestBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonRestBG_Pt_M02", "ESD_TrueClusPhotonRestBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1735  fHistoClustPhotonRestBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1736  fHistoClustPhotonRestBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1737  fTrueList[iCut]->Add(fHistoClustPhotonRestBGPtM02[iCut]);
1738  fHistoClustPhotonPlusConvElectronBGPtM02[iCut]= new TH2F("ESD_TrueClusPhotonPlusConvElectronBG_Pt_M02", "ESD_TrueClusPhotonPlusConvElectronBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1739  fHistoClustPhotonPlusConvElectronBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1740  fHistoClustPhotonPlusConvElectronBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1742  fHistoClustPhotonPlusConvPionBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonPlusConvPionBG_Pt_M02", "ESD_TrueClusPhotonPlusConvPionBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1743  fHistoClustPhotonPlusConvPionBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1744  fHistoClustPhotonPlusConvPionBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1746  fHistoClustPhotonPlusConvKaonBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonPlusConvKaonBG_Pt_M02", "ESD_TrueClusPhotonPlusConvKaonBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1747  fHistoClustPhotonPlusConvKaonBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1748  fHistoClustPhotonPlusConvKaonBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1750  fHistoClustPhotonPlusConvK0lBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonPlusConvK0lBG_Pt_M02", "ESD_TrueClusPhotonPlusConvK0lBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1751  fHistoClustPhotonPlusConvK0lBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1752  fHistoClustPhotonPlusConvK0lBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1754  fHistoClustPhotonPlusConvNeutronBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonPlusConvNeutronBG_Pt_M02", "ESD_TrueClusPhotonPlusConvNeutronBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1755  fHistoClustPhotonPlusConvNeutronBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1756  fHistoClustPhotonPlusConvNeutronBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1758  fHistoClustPhotonPlusConvRestBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonPlusConvRestBG_Pt_M02", "ESD_TrueClusPhotonPlusConvRestBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1759  fHistoClustPhotonPlusConvRestBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1760  fHistoClustPhotonPlusConvRestBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1762  }
1763  }
1764 
1765  fHistoTrueClusGammaPt[iCut] = new TH1F("TrueClusGamma_Pt", "ESD_TrueClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1766  fHistoTrueClusGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1767  fTrueList[iCut]->Add(fHistoTrueClusGammaPt[iCut]);
1768  if(!fDoLightOutput){
1769  if (fDoClusterQA > 0) {
1770  fHistoTrueClusGammaPtM02[iCut] = new TH2F("TrueClusGamma_Pt_M02", "TrueClusGamma_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1771  fHistoTrueClusGammaPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1772  fHistoTrueClusGammaPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1773  fTrueList[iCut]->Add(fHistoTrueClusGammaPtM02[iCut]);
1774  }
1775  fHistoTruePrimaryClusGammaPt[iCut] = new TH1F("TruePrimaryClusGamma_Pt", "ESD_TruePrimaryClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1776  fHistoTruePrimaryClusGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1777  fTrueList[iCut]->Add(fHistoTruePrimaryClusGammaPt[iCut]);
1778  fHistoTruePrimaryClusGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusGamma_Pt_MCPt", "ESD_TruePrimaryClusGamma_MCPt", nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1779  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1780  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->SetYTitle("p_{T, MC} (GeV/c)");
1782  fHistoTruePrimaryClusConvGammaPt[iCut] = new TH1F("TruePrimaryClusConvGamma_Pt", "ESD_TruePrimaryClusConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1783  fHistoTruePrimaryClusConvGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1784  fTrueList[iCut]->Add(fHistoTruePrimaryClusConvGammaPt[iCut]);
1785  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusConvGamma_Pt_MCPt", "ESD_TruePrimaryClusConvGamma_MCPt", nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1786  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1787  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut]->SetYTitle("p_{T, MC} (GeV/c)");
1789  fHistoTrueSecondaryClusGammaPt[iCut] = new TH2F("ESD_TrueSecondaryClusGamma_Pt", "ESD_TrueSecondaryClusGamma_Pt", nBinsClusterPt, arrClusPtBinning, 5, -0.5, 4.5);
1790  fHistoTrueSecondaryClusGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1791  fHistoTrueSecondaryClusGammaPt[iCut]->SetYTitle("source");
1792  fHistoTrueSecondaryClusGammaPt[iCut]->GetYaxis()->SetBinLabel( 1,"K0s");
1793  fHistoTrueSecondaryClusGammaPt[iCut]->GetYaxis()->SetBinLabel( 2,"K0l");
1794  fHistoTrueSecondaryClusGammaPt[iCut]->GetYaxis()->SetBinLabel( 3,"Lambda");
1795  fHistoTrueSecondaryClusGammaPt[iCut]->GetYaxis()->SetBinLabel( 4,"Eta");
1796  fHistoTrueSecondaryClusGammaPt[iCut]->GetYaxis()->SetBinLabel( 5,"rest");
1797  fTrueList[iCut]->Add(fHistoTrueSecondaryClusGammaPt[iCut]);
1798  fHistoTrueSecondaryClusConvGammaPt[iCut] = new TH2F("ESD_TrueSecondaryClusConvGamma_Pt", "ESD_TrueSecondaryClusConvGamma_Pt", nBinsClusterPt, arrClusPtBinning, 5, -0.5, 4.5);
1799  fHistoTrueSecondaryClusConvGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1800  fHistoTrueSecondaryClusConvGammaPt[iCut]->SetYTitle("source");
1801  fHistoTrueSecondaryClusConvGammaPt[iCut]->GetYaxis()->SetBinLabel( 1,"K0s");
1802  fHistoTrueSecondaryClusConvGammaPt[iCut]->GetYaxis()->SetBinLabel( 2,"K0l");
1803  fHistoTrueSecondaryClusConvGammaPt[iCut]->GetYaxis()->SetBinLabel( 3,"Lambda");
1804  fHistoTrueSecondaryClusConvGammaPt[iCut]->GetYaxis()->SetBinLabel( 4,"Eta");
1805  fHistoTrueSecondaryClusConvGammaPt[iCut]->GetYaxis()->SetBinLabel( 5,"rest");
1807  fHistoTrueSecondaryClusGammaMCPt[iCut] = new TH2F("ESD_TrueSecondaryClusGamma_MCPt", "ESD_TrueSecondaryClusGamma_MCPt", nBinsClusterPt, arrClusPtBinning, 5, -0.5, 4.5);
1808  fHistoTrueSecondaryClusGammaMCPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1809  fHistoTrueSecondaryClusGammaMCPt[iCut]->SetYTitle("source");
1810  fHistoTrueSecondaryClusGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 1,"K0s");
1811  fHistoTrueSecondaryClusGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 2,"K0l");
1812  fHistoTrueSecondaryClusGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 3,"Lambda");
1813  fHistoTrueSecondaryClusGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 4,"Eta");
1814  fHistoTrueSecondaryClusGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 5,"rest");
1815  fTrueList[iCut]->Add(fHistoTrueSecondaryClusGammaMCPt[iCut]);
1816  fHistoTrueSecondaryClusConvGammaMCPt[iCut] = new TH2F("ESD_TrueSecondaryClusConvGamma_MCPt", "ESD_TrueSecondaryClusConvGamma_MCPt", nBinsClusterPt, arrClusPtBinning, 5, -0.5, 4.5);
1817  fHistoTrueSecondaryClusConvGammaMCPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1818  fHistoTrueSecondaryClusConvGammaMCPt[iCut]->SetYTitle("source");
1819  fHistoTrueSecondaryClusConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 1,"K0s");
1820  fHistoTrueSecondaryClusConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 2,"K0l");
1821  fHistoTrueSecondaryClusConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 3,"Lambda");
1822  fHistoTrueSecondaryClusConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 4,"Eta");
1823  fHistoTrueSecondaryClusConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 5,"rest");
1825 
1826  fHistoTrueSecondaryClusGammaFromXFromK0sMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryClusGammaFromXFromK0s_MCPt_Pt", "ESD_TrueSecondaryClusGammaFromXFromK0s_MCPt_Pt",
1827  nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1828  fHistoTrueSecondaryClusGammaFromXFromK0sMCPtESDPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1829  fHistoTrueSecondaryClusGammaFromXFromK0sMCPtESDPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1831  fHistoTrueSecondaryClusConvGammaFromXFromK0sMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryClusConvGammaFromXFromK0s_MCPt_Pt", "ESD_TrueSecondaryClusConvGammaFromXFromK0s_MCPt_Pt",
1832  nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1833  fHistoTrueSecondaryClusConvGammaFromXFromK0sMCPtESDPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1834  fHistoTrueSecondaryClusConvGammaFromXFromK0sMCPtESDPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1836  fHistoTrueSecondaryClusGammaFromXFromK0lMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryClusGammaFromXFromK0l_MCPt_Pt", "ESD_TrueSecondaryClusGammaFromXFromK0l_MCPt_Pt",
1837  nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1838  fHistoTrueSecondaryClusGammaFromXFromK0lMCPtESDPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1839  fHistoTrueSecondaryClusGammaFromXFromK0lMCPtESDPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1841  fHistoTrueSecondaryClusConvGammaFromXFromK0lMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryClusConvGammaFromXFromK0l_MCPt_Pt", "ESD_TrueSecondaryClusConvGammaFromXFromK0l_MCPt_Pt",
1842  nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1843  fHistoTrueSecondaryClusConvGammaFromXFromK0lMCPtESDPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1844  fHistoTrueSecondaryClusConvGammaFromXFromK0lMCPtESDPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1846  fHistoTrueSecondaryClusGammaFromXFromLambdaMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryClusGammaFromXFromLambda_MCPt_Pt", "ESD_TrueSecondaryClusGammaFromXFromLambda_MCPt_Pt",
1847  nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1848  fHistoTrueSecondaryClusGammaFromXFromLambdaMCPtESDPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1849  fHistoTrueSecondaryClusGammaFromXFromLambdaMCPtESDPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1851  fHistoTrueSecondaryClusConvGammaFromXFromLambdaMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryClusConvGammaFromXFromLambda_MCPt_Pt", "ESD_TrueSecondaryClusConvGammaFromXFromLambda_MCPt_Pt",
1852  nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1853  fHistoTrueSecondaryClusConvGammaFromXFromLambdaMCPtESDPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1854  fHistoTrueSecondaryClusConvGammaFromXFromLambdaMCPtESDPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1856 
1857  fHistoTrueNLabelsInClus[iCut] = new TH1F("TrueNLabelsInClus", "TrueNLabelsInClus", 100, -0.5, 99.5);
1858  fHistoTrueNLabelsInClus[iCut]->SetXTitle("# labels");
1859  fTrueList[iCut]->Add(fHistoTrueNLabelsInClus[iCut]);
1860  }
1861 
1862  fHistoDoubleCountTrueClusterGammaPt[iCut] = new TH2F("TrueDoubleCountClusterGamma_Pt", "TrueDoubleCountClusterGamma_Pt", nBinsClusterPt, arrClusPtBinning, 2, 0, 2);
1863  fHistoDoubleCountTrueClusterGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1865  fHistoMultipleCountTrueClusterGamma[iCut] = new TH1F("TrueMultipleCountClusterGamma", "TrueMultipleCountClusterGamma", 10, 1, 11);
1866  fHistoMultipleCountTrueClusterGamma[iCut]->SetXTitle("# multiple");
1868 
1869  if (fIsMC > 1){
1870  fHistoTrueClusGammaPt[iCut]->Sumw2();
1871  fHistoDoubleCountTrueClusterGammaPt[iCut]->Sumw2();
1872  fHistoMultipleCountTrueClusterGamma[iCut]->Sumw2();
1873  if(!fDoLightOutput){
1874  fHistoTrueNLabelsInClus[iCut]->Sumw2();
1875  if (fDoClusterQA > 0) fHistoTrueClusGammaPtM02[iCut]->Sumw2();
1876  fHistoTruePrimaryClusGammaPt[iCut]->Sumw2();
1877  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->Sumw2();
1878  fHistoTruePrimaryClusConvGammaPt[iCut]->Sumw2();
1880  fHistoTrueSecondaryClusGammaPt[iCut]->Sumw2();
1881  fHistoTrueSecondaryClusConvGammaPt[iCut]->Sumw2();
1882  fHistoTrueSecondaryClusGammaMCPt[iCut]->Sumw2();
1883  fHistoTrueSecondaryClusConvGammaMCPt[iCut]->Sumw2();
1890  }
1891  }
1892 
1893  if (fDoClusterQA > 0){
1894  fHistoTrueClusUnConvGammaPt[iCut] = new TH1F("TrueClusUnConvGamma_Pt", "TrueClusUnConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1895  fHistoTrueClusUnConvGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1896  fTrueList[iCut]->Add(fHistoTrueClusUnConvGammaPt[iCut]);
1897  fHistoTrueClusUnConvGammaMCPt[iCut] = new TH1F("TrueClusUnConvGamma_MCPt", "TrueClusUnConvGamma_MCPt", nBinsClusterPt, arrClusPtBinning);
1898  fHistoTrueClusUnConvGammaMCPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1899  fTrueList[iCut]->Add(fHistoTrueClusUnConvGammaMCPt[iCut]);
1900  if (!fDoLightOutput) {
1901  fHistoTrueClusUnConvGammaPtM02[iCut] = new TH2F("TrueClusUnConvGamma_Pt_M02", "TrueClusUnConvGamma_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1902  fHistoTrueClusUnConvGammaPtM02[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1903  fHistoTrueClusUnConvGammaPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1904  fTrueList[iCut]->Add(fHistoTrueClusUnConvGammaPtM02[iCut]);
1905  }
1906  fHistoTrueClusElectronPt[iCut] = new TH1F("TrueClusElectron_Pt", "TrueElectronGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1907  fHistoTrueClusElectronPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1908  fTrueList[iCut]->Add(fHistoTrueClusElectronPt[iCut]);
1909  fHistoTrueClusConvGammaPt[iCut] = new TH1F("TrueClusConvGamma_Pt", "TrueClusConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1910  fHistoTrueClusConvGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1911  fTrueList[iCut]->Add(fHistoTrueClusConvGammaPt[iCut]);
1912  fHistoTrueClusConvGammaMCPt[iCut] = new TH1F("TrueClusConvGamma_MCPt", "TrueClusConvGamma_MCPt", nBinsClusterPt, arrClusPtBinning);
1913  fHistoTrueClusConvGammaMCPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1914  fTrueList[iCut]->Add(fHistoTrueClusConvGammaMCPt[iCut]);
1915  fHistoTrueClusConvGammaFullyPt[iCut] = new TH1F("TrueClusConvGammaFullyContained_Pt", "TrueClusConvGammaFullyContained_Pt", nBinsClusterPt, arrClusPtBinning);
1916  fHistoTrueClusConvGammaFullyPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1917  fTrueList[iCut]->Add(fHistoTrueClusConvGammaFullyPt[iCut]);
1918  fHistoTrueClusMergedGammaPt[iCut] = new TH1F("TrueClusMergedGamma_Pt", "TrueClusMergedGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1919  fHistoTrueClusMergedGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1920  fTrueList[iCut]->Add(fHistoTrueClusMergedGammaPt[iCut]);
1921  fHistoTrueClusMergedPartConvGammaPt[iCut] = new TH1F("TrueClusMergedPartConvGamma_Pt", "TrueClusMergedPartConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1922  fHistoTrueClusMergedPartConvGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1924  fHistoTrueClusDalitzPt[iCut] = new TH1F("TrueClusDalitz_Pt", "TrueClusDalitz_Pt", nBinsClusterPt, arrClusPtBinning);
1925  fHistoTrueClusDalitzPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1926  fTrueList[iCut]->Add(fHistoTrueClusDalitzPt[iCut]);
1927  fHistoTrueClusDalitzMergedPt[iCut] = new TH1F("TrueClusDalitzMerged_Pt", "TrueClusDalitzMerged_Pt", nBinsClusterPt, arrClusPtBinning);
1928  fHistoTrueClusDalitzMergedPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1929  fTrueList[iCut]->Add(fHistoTrueClusDalitzMergedPt[iCut]);
1930  fHistoTrueClusPhotonFromElecMotherPt[iCut] = new TH1F("TrueClusPhotonFromElecMother_Pt", "TrueClusPhotonFromElecMother_Pt", nBinsClusterPt, arrClusPtBinning);
1931  fHistoTrueClusPhotonFromElecMotherPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1933  fHistoTrueClusShowerPt[iCut] = new TH1F("TrueClusShower_Pt", "TrueClusShower_Pt", nBinsClusterPt, arrClusPtBinning);
1934  fHistoTrueClusShowerPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1935  fTrueList[iCut]->Add(fHistoTrueClusShowerPt[iCut]);
1936  fHistoTrueClusSubLeadingPt[iCut] = new TH1F("TrueClusSubleading_Pt", "TrueClusSubleading_Pt", nBinsClusterPt, arrClusPtBinning);
1937  fHistoTrueClusSubLeadingPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1938  fTrueList[iCut]->Add(fHistoTrueClusSubLeadingPt[iCut]);
1939  fHistoTrueClusNParticles[iCut] = new TH1F("TrueClusNParticles", "TrueClusNParticles", 20, 0, 20);
1940  fHistoTrueClusNParticles[iCut]->SetXTitle("#particles");
1941  fTrueList[iCut]->Add(fHistoTrueClusNParticles[iCut]);
1942  fHistoTrueClusEMNonLeadingPt[iCut] = new TH1F("TrueClusEMNonLeading_Pt", "TrueClusEMNonLeading_Pt", nBinsClusterPt, arrClusPtBinning);
1943  fHistoTrueClusEMNonLeadingPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1944  fTrueList[iCut]->Add(fHistoTrueClusEMNonLeadingPt[iCut]);
1945 
1946  if (fIsMC > 1){
1947  fHistoTrueClusUnConvGammaPt[iCut]->Sumw2();
1948  fHistoTrueClusUnConvGammaMCPt[iCut]->Sumw2();
1949  if (!fDoLightOutput)
1950  fHistoTrueClusUnConvGammaPtM02[iCut]->Sumw2();
1951  fHistoTrueClusElectronPt[iCut]->Sumw2();
1952  fHistoTrueClusConvGammaPt[iCut]->Sumw2();
1953  fHistoTrueClusConvGammaMCPt[iCut]->Sumw2();
1954  fHistoTrueClusConvGammaFullyPt[iCut]->Sumw2();
1955  fHistoTrueClusMergedGammaPt[iCut]->Sumw2();
1956  fHistoTrueClusMergedPartConvGammaPt[iCut]->Sumw2();
1957  fHistoTrueClusDalitzPt[iCut]->Sumw2();
1958  fHistoTrueClusDalitzMergedPt[iCut]->Sumw2();
1959  fHistoTrueClusPhotonFromElecMotherPt[iCut]->Sumw2();
1960  fHistoTrueClusShowerPt[iCut]->Sumw2();
1961  fHistoTrueClusSubLeadingPt[iCut]->Sumw2();
1962  fHistoTrueClusNParticles[iCut]->Sumw2();
1963  fHistoTrueClusEMNonLeadingPt[iCut]->Sumw2();
1964  }
1965  }
1966 
1967  if(fDoMesonAnalysis){
1968  fHistoTruePi0InvMassPt[iCut] = new TH2F("ESD_TruePi0_InvMass_Pt", "ESD_TruePi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1969  fHistoTruePi0InvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1970  fHistoTruePi0InvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
1971  fTrueList[iCut]->Add(fHistoTruePi0InvMassPt[iCut]);
1972  fHistoTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueEta_InvMass_Pt", "ESD_TrueEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1973  fHistoTrueEtaInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1974  fHistoTrueEtaInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
1975  fTrueList[iCut]->Add(fHistoTrueEtaInvMassPt[iCut]);
1976 
1977  fHistoDoubleCountTruePi0InvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountPi0_InvMass_Pt", "ESD_TrueDoubleCountPi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1978  fHistoDoubleCountTruePi0InvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1979  fHistoDoubleCountTruePi0InvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
1980  fTrueList[iCut]->Add(fHistoDoubleCountTruePi0InvMassPt[iCut]);
1981  fHistoDoubleCountTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountEta_InvMass_Pt", "ESD_TrueDoubleCountEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1982  fHistoDoubleCountTrueEtaInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1983  fHistoDoubleCountTrueEtaInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
1984  fTrueList[iCut]->Add(fHistoDoubleCountTrueEtaInvMassPt[iCut]);
1985 
1986  fHistoTruePrimaryPi0InvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_Pt", "ESD_TruePrimaryPi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1987  fHistoTruePrimaryPi0InvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1988  fHistoTruePrimaryPi0InvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
1989  fHistoTruePrimaryPi0InvMassPt[iCut]->Sumw2();
1990  fTrueList[iCut]->Add(fHistoTruePrimaryPi0InvMassPt[iCut]);
1991  fHistoTruePrimaryEtaInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEta_InvMass_Pt", "ESD_TruePrimaryEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1992  fHistoTruePrimaryEtaInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1993  fHistoTruePrimaryEtaInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
1994  fHistoTruePrimaryEtaInvMassPt[iCut]->Sumw2();
1995  fTrueList[iCut]->Add(fHistoTruePrimaryEtaInvMassPt[iCut]);
1996 
1997  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt", "ESD_TruePrimaryPi0W0Weights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1998  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1999  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2002  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEtaW0Weights_InvMass_Pt", "ESD_TruePrimaryEtaW0Weights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2003  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2004  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2007 
2008  fProfileTruePrimaryPi0WeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryPi0Weights_InvMass_Pt", "ESD_TruePrimaryPi0Weights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2009  fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2010  fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2013  fProfileTruePrimaryEtaWeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryEtaWeights_InvMass_Pt", "ESD_TruePrimaryEtaWeights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2014  fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2015  fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2018 
2019  fHistoTrueSecondaryPi0InvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_Pt", "ESD_TrueSecondaryPi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2020  fHistoTrueSecondaryPi0InvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2021  fHistoTrueSecondaryPi0InvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2022  fHistoTrueSecondaryPi0InvMassPt[iCut]->Sumw2();
2023  fTrueList[iCut]->Add(fHistoTrueSecondaryPi0InvMassPt[iCut]);
2024 
2025  if(!fDoLightOutput){
2026  fHistoTruePi0InvMassPtAlpha[iCut] = new TH2F("ESD_TruePi0_InvMass_vs_Pt_Alpha", "ESD_TruePi0_InvMass_vs_Pt_Alpha", 800, 0, 0.8, nBinsPt, arrPtBinning);
2027  fHistoTruePi0InvMassPtAlpha[iCut]->SetYTitle("p_{T} (GeV/c)");
2028  fHistoTruePi0InvMassPtAlpha[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2029  fHistoTruePi0InvMassPtAlpha[iCut]->Sumw2();
2030  fESDList[iCut]->Add(fHistoTruePi0InvMassPtAlpha[iCut]);
2031  fHistoTruePi0PureGammaInvMassPtAlpha[iCut] = new TH2F("ESD_TruePi0PureGamma_InvMass_vs_Pt_Alpha", "ESD_TruePi0PureGamma_InvMass_vs_Pt_Alpha", 800, 0, 0.8, nBinsPt, arrPtBinning);
2032  fHistoTruePi0PureGammaInvMassPtAlpha[iCut]->SetYTitle("p_{T} (GeV/c)");
2033  fHistoTruePi0PureGammaInvMassPtAlpha[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2034  fHistoTruePi0PureGammaInvMassPtAlpha[iCut]->Sumw2();
2036  }
2037 
2038  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_Pt", "ESD_TrueSecondaryPi0FromK0s_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2039  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2040  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2043  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0l_InvMass_Pt", "ESD_TrueSecondaryPi0FromK0l_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2044  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2045  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2048  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromEta_InvMass_Pt", "ESD_TrueSecondaryPi0FromEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2049  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2050  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2052  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_Pt", "ESD_TrueSecondaryPi0FromLambda_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2053  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2054  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2056 
2057  if (fIsMC > 1){
2058  fHistoTruePi0InvMassPt[iCut]->Sumw2();
2059  fHistoTrueEtaInvMassPt[iCut]->Sumw2();
2060  fHistoDoubleCountTruePi0InvMassPt[iCut]->Sumw2();
2061  fHistoDoubleCountTrueEtaInvMassPt[iCut]->Sumw2();
2066  }
2067 
2068 
2069  if (fDoMesonQA > 0 && fDoMesonQA < 3){
2070  if (fIsMC < 2){
2071 
2072  fHistoTruePi0CaloPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloPhoton_InvMass_Pt", "ESD_TruePi0CaloPhoton_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2073  fHistoTruePi0CaloPhotonInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2074  fHistoTruePi0CaloPhotonInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2075  fTrueList[iCut]->Add(fHistoTruePi0CaloPhotonInvMassPt[iCut]);
2076  fHistoTrueEtaCaloPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloPhoton_InvMass_Pt", "ESD_TrueEtaCaloPhoton_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2077  fHistoTrueEtaCaloPhotonInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2078  fHistoTrueEtaCaloPhotonInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2079  fTrueList[iCut]->Add(fHistoTrueEtaCaloPhotonInvMassPt[iCut]);
2080 
2081  fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMixedPhotonConvertedPhoton_InvMass_Pt", "ESD_TruePi0CaloMixedPhotonConvertedPhoton_InvMass_Pt", 800, 0, 0.8,
2082  nBinsPt, arrPtBinning);
2083  fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2084  fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2086  fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMixedPhotonConvertedPhoton_InvMass_Pt", "ESD_TrueEtaCaloMixedPhotonConvertedPhoton_InvMass_Pt", 800, 0, 0.8,
2087  nBinsPt, arrPtBinning);
2088  fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2089  fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2091 
2092  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhoton_InvMass_Pt", "ESD_TruePi0CaloConvertedPhoton_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2093  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2094  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2096  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt", "ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2097  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2098  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2100 
2101  fHistoTruePi0CaloElectronInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloElectron_InvMass_Pt", "ESD_TruePi0CaloElectron_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2102  fHistoTruePi0CaloElectronInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2103  fHistoTruePi0CaloElectronInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2105  fHistoTrueEtaCaloElectronInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloElectron_InvMass_Pt", "ESD_TrueEtaCaloElectron_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2106  fHistoTrueEtaCaloElectronInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2107  fHistoTrueEtaCaloElectronInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2109 
2110  fHistoTruePi0CaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedCluster_InvMass_Pt", "ESD_TruePi0CaloMergedCluster_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2111  fHistoTruePi0CaloMergedClusterInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2112  fHistoTruePi0CaloMergedClusterInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2114  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedCluster_InvMass_Pt", "ESD_TrueEtaCaloMergedCluster_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2115  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2116  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2118 
2119  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt", "ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt", 800, 0, 0.8,
2120  nBinsPt, arrPtBinning);
2121  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2122  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2124  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt", "ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt", 800, 0, 0.8,
2125  nBinsPt, arrPtBinning);
2126  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2127  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2129 
2130  fHistoTruePi0NonMergedElectronPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0NonMergedElectronPhoton_InvMass_Pt", "ESD_TruePi0NonMergedElectronPhoton_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2131  fHistoTruePi0NonMergedElectronPhotonInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2132  fHistoTruePi0NonMergedElectronPhotonInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2134  fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0NonMergedElectronMergedPhoton_InvMass_Pt", "ESD_TruePi0NonMergedElectronMergedPhoton_InvMass_Pt", 800, 0, 0.8,
2135  nBinsPt, arrPtBinning);
2136  fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2137  fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2139 
2140  fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt", "ESD_TruePrimaryPi0_ResolPt_MCPt", 500, 0.03, 35, 1000, -1., 1.);
2141  fHistoTruePrimaryPi0MCPtResolPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
2142  fHistoTruePrimaryPi0MCPtResolPt[iCut]->SetXTitle("#delta (p_{T}) (GeV/c)");
2143  fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
2145  fTrueList[iCut]->Add(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
2146  fHistoTruePrimaryEtaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt", "ESD_TruePrimaryEta_ResolPt_MCPt", 500, 0.03, 35, 1000, -1., 1.);
2147  fHistoTruePrimaryEtaMCPtResolPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
2148  fHistoTruePrimaryEtaMCPtResolPt[iCut]->SetXTitle("#delta (p_{T}) (GeV/c)");
2149  fHistoTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
2151  fTrueList[iCut]->Add(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
2152  fHistoTrueK0sWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0sWithPi0Daughter_MCPt", "ESD_TrueK0sWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2153  fHistoTrueK0sWithPi0DaughterMCPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
2154  fTrueList[iCut]->Add(fHistoTrueK0sWithPi0DaughterMCPt[iCut]);
2155  fHistoTrueK0lWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0lWithPi0Daughter_MCPt", "ESD_TrueK0lWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2156  fHistoTrueK0lWithPi0DaughterMCPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
2157  fTrueList[iCut]->Add(fHistoTrueK0lWithPi0DaughterMCPt[iCut]);
2158  fHistoTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt", "ESD_TrueEtaWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2159  fHistoTrueEtaWithPi0DaughterMCPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
2160  fTrueList[iCut]->Add(fHistoTrueEtaWithPi0DaughterMCPt[iCut]);
2161  fHistoTrueLambdaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueLambdaWithPi0Daughter_MCPt", "ESD_TrueLambdaWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2162  fHistoTrueLambdaWithPi0DaughterMCPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
2164  }
2165 
2166  fHistoTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y", "ESD_TruePi0_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
2167  fHistoTruePi0PtY[iCut]->SetXTitle("p_{T} (GeV/c)");
2168  fHistoTruePi0PtY[iCut]->SetYTitle("y");
2169  fTrueList[iCut]->Add(fHistoTruePi0PtY[iCut]);
2170  fHistoTrueEtaPtY[iCut] = new TH2F("ESD_TrueEta_Pt_Y", "ESD_TrueEta_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
2171  fHistoTrueEtaPtY[iCut]->SetXTitle("p_{T} (GeV/c)");
2172  fHistoTrueEtaPtY[iCut]->SetYTitle("y");
2173  fTrueList[iCut]->Add(fHistoTrueEtaPtY[iCut]);
2174  fHistoTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha", "ESD_TruePi0_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
2175  fHistoTruePi0PtAlpha[iCut]->SetXTitle("p_{T} (GeV/c)");
2176  fHistoTruePi0PtAlpha[iCut]->SetYTitle("#alpha");
2177  fTrueList[iCut]->Add(fHistoTruePi0PtAlpha[iCut]);
2178  fHistoTrueEtaPtAlpha[iCut] = new TH2F("ESD_TrueEta_Pt_Alpha", "ESD_TrueEta_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
2179  fHistoTrueEtaPtAlpha[iCut]->SetXTitle("p_{T} (GeV/c)");
2180  fHistoTrueEtaPtAlpha[iCut]->SetYTitle("#alpha");
2181  fTrueList[iCut]->Add(fHistoTrueEtaPtAlpha[iCut]);
2182 
2183  fHistoTruePi0PtOpenAngle[iCut] = new TH2F("ESD_TruePi0_Pt_OpenAngle", "ESD_TruePi0_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning, 100, 0, 0.5);
2184  fHistoTruePi0PtOpenAngle[iCut]->SetXTitle("p_{T} (GeV/c)");
2185  fHistoTruePi0PtOpenAngle[iCut]->SetYTitle("#theta");
2186  fTrueList[iCut]->Add(fHistoTruePi0PtOpenAngle[iCut]);
2187  fHistoTrueEtaPtOpenAngle[iCut] = new TH2F("ESD_TrueEta_Pt_OpenAngle", "ESD_TrueEta_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning, 180, 0, 1.8);
2188  fHistoTrueEtaPtOpenAngle[iCut]->SetXTitle("p_{T} (GeV/c)");
2189  fHistoTrueEtaPtOpenAngle[iCut]->SetYTitle("#theta");
2190  fTrueList[iCut]->Add(fHistoTrueEtaPtOpenAngle[iCut]);
2191 
2192  fHistoTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt", "ESD_TrueBckGG_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2193  fHistoTrueBckGGInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2194  fHistoTrueBckGGInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2195  fTrueList[iCut]->Add(fHistoTrueBckGGInvMassPt[iCut]);
2196  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut] = new TH2F("ESD_TrueBckFullMesonContained_InvMass_Pt", "ESD_TrueBckFullMesonContained_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2197  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2198  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2200  fHistoTrueBckAsymEClustersInvMassPt[iCut] = new TH2F("ESD_TrueBckAsymEClus_InvMass_Pt", "ESD_TrueBckAsymEClus_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2201  fHistoTrueBckAsymEClustersInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2202  fHistoTrueBckAsymEClustersInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2204  fHistoTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt", "ESD_TrueBckCont_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2205  fHistoTrueBckContInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2206  fHistoTrueBckContInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2207  fTrueList[iCut]->Add(fHistoTrueBckContInvMassPt[iCut]);
2208 
2209  if (fIsMC > 1){
2210  fHistoTruePi0PtY[iCut]->Sumw2();
2211  fHistoTrueEtaPtY[iCut]->Sumw2();
2212  fHistoTruePi0PtAlpha[iCut]->Sumw2();
2213  fHistoTrueEtaPtAlpha[iCut]->Sumw2();
2214  fHistoTruePi0PtOpenAngle[iCut]->Sumw2();
2215  fHistoTrueEtaPtOpenAngle[iCut]->Sumw2();
2216  fHistoTrueBckGGInvMassPt[iCut]->Sumw2();
2218  fHistoTrueBckAsymEClustersInvMassPt[iCut]->Sumw2();
2219  fHistoTrueBckContInvMassPt[iCut]->Sumw2();
2220  }
2221 
2222  }
2223 
2224  if (fDoMesonQA == 2 && fIsMC < 2){
2225  fHistoTruePi0Category1[iCut] = new TH2F("ESD_TruePi0Category1_InvMass_Pt", "ESD_TruePi0Category1_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2226  fHistoTruePi0Category1[iCut]->SetYTitle("p_{T} (GeV/c)");
2227  fHistoTruePi0Category1[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2228  fTrueList[iCut]->Add(fHistoTruePi0Category1[iCut]);
2229  fHistoTrueEtaCategory1[iCut] = new TH2F("ESD_TrueEtaCategory1_InvMass_Pt", "ESD_TrueEtaCategory1_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2230  fHistoTrueEtaCategory1[iCut]->SetYTitle("p_{T} (GeV/c)");
2231  fHistoTrueEtaCategory1[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2232  fTrueList[iCut]->Add(fHistoTrueEtaCategory1[iCut]);
2233  fHistoTruePi0Category2[iCut] = new TH2F("ESD_TruePi0Category2_InvMass_Pt", "ESD_TruePi0Category2_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2234  fHistoTruePi0Category2[iCut]->SetYTitle("p_{T} (GeV/c)");
2235  fHistoTruePi0Category2[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2236  fTrueList[iCut]->Add(fHistoTruePi0Category2[iCut]);
2237  fHistoTrueEtaCategory2[iCut] = new TH2F("ESD_TrueEtaCategory2_InvMass_Pt", "ESD_TrueEtaCategory2_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2238  fHistoTrueEtaCategory2[iCut]->SetYTitle("p_{T} (GeV/c)");
2239  fHistoTrueEtaCategory2[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2240  fTrueList[iCut]->Add(fHistoTrueEtaCategory2[iCut]);
2241  fHistoTruePi0Category3[iCut] = new TH2F("ESD_TruePi0Category3_InvMass_Pt", "ESD_TruePi0Category3_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2242  fHistoTruePi0Category3[iCut]->SetYTitle("p_{T} (GeV/c)");
2243  fHistoTruePi0Category3[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2244  fTrueList[iCut]->Add(fHistoTruePi0Category3[iCut]);
2245  fHistoTrueEtaCategory3[iCut] = new TH2F("ESD_TrueEtaCategory3_InvMass_Pt", "ESD_TrueEtaCategory3_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2246  fHistoTrueEtaCategory3[iCut]->SetYTitle("p_{T} (GeV/c)");
2247  fHistoTrueEtaCategory3[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2248  fTrueList[iCut]->Add(fHistoTrueEtaCategory3[iCut]);
2249  fHistoTruePi0Category4_6[iCut] = new TH2F("ESD_TruePi0Category4_6_InvMass_Pt", "ESD_TruePi0Category4_6_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2250  fHistoTruePi0Category4_6[iCut]->SetYTitle("p_{T} (GeV/c)");
2251  fHistoTruePi0Category4_6[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2252  fTrueList[iCut]->Add(fHistoTruePi0Category4_6[iCut]);
2253  fHistoTrueEtaCategory4_6[iCut] = new TH2F("ESD_TrueEtaCategory4_6_InvMass_Pt", "ESD_TrueEtaCategory4_6_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2254  fHistoTrueEtaCategory4_6[iCut]->SetYTitle("p_{T} (GeV/c)");
2255  fHistoTrueEtaCategory4_6[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2256  fTrueList[iCut]->Add(fHistoTrueEtaCategory4_6[iCut]);
2257  fHistoTruePi0Category5[iCut] = new TH2F("ESD_TruePi0Category5_InvMass_Pt", "ESD_TruePi0Category5_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2258  fHistoTruePi0Category5[iCut]->SetYTitle("p_{T} (GeV/c)");
2259  fHistoTruePi0Category5[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2260  fTrueList[iCut]->Add(fHistoTruePi0Category5[iCut]);
2261  fHistoTrueEtaCategory5[iCut] = new TH2F("ESD_TrueEtaCategory5_InvMass_Pt", "ESD_TrueEtaCategory5_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2262  fHistoTrueEtaCategory5[iCut]->SetYTitle("p_{T} (GeV/c)");
2263  fHistoTrueEtaCategory5[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2264  fTrueList[iCut]->Add(fHistoTrueEtaCategory5[iCut]);
2265  fHistoTruePi0Category7[iCut] = new TH2F("ESD_TruePi0Category7_InvMass_Pt", "ESD_TruePi0Category7_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2266  fHistoTruePi0Category7[iCut]->SetYTitle("p_{T} (GeV/c)");
2267  fHistoTruePi0Category7[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2268  fTrueList[iCut]->Add(fHistoTruePi0Category7[iCut]);
2269  fHistoTrueEtaCategory7[iCut] = new TH2F("ESD_TrueEtaCategory7_InvMass_Pt", "ESD_TrueEtaCategory7_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2270  fHistoTrueEtaCategory7[iCut]->SetYTitle("p_{T} (GeV/c)");
2271  fHistoTrueEtaCategory7[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2272  fTrueList[iCut]->Add(fHistoTrueEtaCategory7[iCut]);
2273  fHistoTruePi0Category8[iCut] = new TH2F("ESD_TruePi0Category8_InvMass_Pt", "ESD_TruePi0Category8_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2274  fHistoTruePi0Category8[iCut]->SetYTitle("p_{T} (GeV/c)");
2275  fHistoTruePi0Category8[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2276  fTrueList[iCut]->Add(fHistoTruePi0Category8[iCut]);
2277  fHistoTrueEtaCategory8[iCut] = new TH2F("ESD_TrueEtaCategory8_InvMass_Pt", "ESD_TrueEtaCategory8_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2278  fHistoTrueEtaCategory8[iCut]->SetYTitle("p_{T} (GeV/c)");
2279  fHistoTrueEtaCategory8[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2280  fTrueList[iCut]->Add(fHistoTrueEtaCategory8[iCut]);
2281  }
2282 
2283  if (fDoMesonQA == 3){
2284  fTreeList[iCut] = new TList();
2285  fTreeList[iCut]->SetName(Form("%s_%s_%s True ClusterComb tree", cutstringEvent.Data(), cutstringCalo.Data(), cutstringMeson.Data()));
2286  fTreeList[iCut]->SetOwner(kTRUE);
2287  fCutFolder[iCut]->Add(fTreeList[iCut]);
2288 
2289  tTrueInvMassROpenABPtFlag[iCut] = new TTree("True_InvMass_R_OpenA_OpenB_Pt_Flag", "True_InvMass_R_OpenA_OpenB_Pt_Flag");
2290  tTrueInvMassROpenABPtFlag[iCut]->Branch("InvMass",&fInvMass,"fInvMass/F");
2291  tTrueInvMassROpenABPtFlag[iCut]->Branch("RConv",&fRconv,"fRconv/F");
2292  tTrueInvMassROpenABPtFlag[iCut]->Branch("OpenAngleRPrimVtx",&fOpenRPrim,"fOpenRPrim/F");
2293  tTrueInvMassROpenABPtFlag[iCut]->Branch("InvMassRTOF",&fInvMassRTOF,"fInvMassRTOF/F");
2294  tTrueInvMassROpenABPtFlag[iCut]->Branch("Pt",&fPt,"fPt/F");
2295 // tTrueInvMassROpenABPtFlag[iCut]->Branch("Weight",&fWeightJetJetMC,"fWeightJetJetMC/F");
2296  tTrueInvMassROpenABPtFlag[iCut]->Branch("cat",&iFlag,"iFlag/b");
2297  fTreeList[iCut]->Add(tTrueInvMassROpenABPtFlag[iCut]);
2298  }
2299  }
2300  }
2301  }
2302 
2306 
2308 
2309  if(fV0Reader)
2311  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
2312  fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
2313  if(fV0Reader)
2315  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
2316  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
2317 
2318  for(Int_t iMatcherTask = 0; iMatcherTask < 3; iMatcherTask++){
2319  AliCaloTrackMatcher* temp = (AliCaloTrackMatcher*) (AliAnalysisManager::GetAnalysisManager()->GetTask(Form("CaloTrackMatcher_%i",iMatcherTask)));
2320  if(temp) fOutputContainer->Add(temp->GetCaloTrackMatcherHistograms());
2321  }
2322 
2323  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2324  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
2325  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
2326  fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
2327  }
2328  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
2329  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
2330  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
2331  }
2332  if(fSetPlotHistsExtQA){
2333  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
2334  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms()){
2335  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms());
2336  }
2337  }
2338  if(fDoMesonAnalysis){
2339  if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
2340  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
2341  fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
2342  }
2343  }
2344  }
2345 
2346  if (fIsMC > 0 ){
2347  tBrokenFiles = new TTree("BrokenFiles", "BrokenFiles");
2348  tBrokenFiles->Branch("fileName",&fFileNameBroken);
2350  }
2351  if (fDoClusterQA > 1){
2352  tClusterQATree = new TTree("ClusterQATree", "ClusterQATree");
2353  tClusterQATree->Branch("closeHighPtClusters",&fCloseHighPtClusters);
2355  }
2356 
2357  if(fLocalDebugFlag > 0){
2358  fstream fOutputLocalDebug;
2359  fOutputLocalDebug.open("debugOutput.txt",ios::out);
2360  fOutputLocalDebug.close();
2361  }
2362 
2363  PostData(1, fOutputContainer);
2364 }
2365 //_____________________________________________________________________________
2367 {
2368  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2369  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
2370  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
2371  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
2372  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
2373  }
2374  if(fIsHeavyIon==2) {
2375  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
2376  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2377  continue; // No Eta Shift requested, continue
2378  }
2379  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
2380  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
2381  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2382  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
2383  continue;
2384  }
2385  else{
2386  printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
2387  (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
2388  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2389  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
2390  }
2391  }
2392  }
2393 
2394  return kTRUE;
2395 }
2396 //_____________________________________________________________________________
2398 {
2399  //
2400  // Called for each event
2401  //
2402  fInputEvent = InputEvent();
2403  fCloseHighPtClusters = 0x0;
2404  if(fIsMC> 0) fMCEvent = MCEvent();
2405 
2406  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
2407  if(fInputEvent->IsIncompleteDAQ()==kTRUE) eventQuality = 2; // incomplete event
2408  if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1 or because it is incomplete
2409  // write out name of broken file for first event
2410  if (fIsMC > 0){
2411  if (fInputEvent->IsA()==AliESDEvent::Class()){
2412  if (((AliESDEvent*)fInputEvent)->GetEventNumberInFile() == 0){
2413  fFileNameBroken = new TObjString(Form("%s", ((TString)fV0Reader->GetCurrentFileName()).Data()));
2414  if (tBrokenFiles) tBrokenFiles->Fill();
2415  delete fFileNameBroken;
2416  }
2417  }
2418  }
2419 
2420  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
2421  fHistoNEvents[iCut]->Fill(eventQuality);
2422  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
2423  }
2424  return;
2425  }
2426 
2427  // ------------------- BeginEvent ----------------------------
2428 
2429  AliEventplane *EventPlane = fInputEvent->GetEventplane();
2430  if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
2431  else fEventPlaneAngle=0.0;
2432 
2433  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
2434 
2435  fiCut = iCut;
2436 
2438  Bool_t isRunningEMCALrelAna = kFALSE;
2439  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) isRunningEMCALrelAna = kTRUE;
2440 
2441  Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon, isRunningEMCALrelAna);
2442 
2443  if(fIsMC==2){
2444  Float_t xsection = -1.;
2445  Float_t ntrials = -1.;
2446  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetXSectionAndNTrials(fMCEvent,xsection,ntrials);
2447  if((xsection==-1.) || (ntrials==-1.)) AliFatal(Form("ERROR: GetXSectionAndNTrials returned invalid xsection/ntrials, periodName from V0Reader: '%s'",fV0Reader->GetPeriodName().Data()));
2448  fProfileJetJetXSection[iCut]->Fill(0.,xsection);
2449  fHistoJetJetNTrials[iCut]->Fill("#sum{NTrials}", ntrials);
2450  }
2451 
2452  if (fIsMC > 0){
2453  fWeightJetJetMC = 1;
2454  Bool_t isMCJet = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsJetJetMCEventAccepted( fMCEvent, fWeightJetJetMC );
2455  if (fIsMC == 3){
2456  Double_t weightMult = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetWeightForMultiplicity(fV0Reader->GetNumberOfPrimaryTracks());
2457  fWeightJetJetMC = fWeightJetJetMC*weightMult;
2458  }
2459 
2460  if (!isMCJet){
2461  fHistoNEvents[iCut]->Fill(10,fWeightJetJetMC);
2462  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(10);
2463  continue;
2464  }
2465  }
2466 
2467  Bool_t triggered = kTRUE;
2468  if(eventNotAccepted){
2469  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
2470  fHistoNEvents[iCut]->Fill(eventNotAccepted, fWeightJetJetMC); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
2471  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventNotAccepted);
2472  if (eventNotAccepted==3 && fIsMC>0){
2473  triggered = kFALSE;
2474  } else {
2475  continue;
2476  }
2477  }
2478 
2479  if(eventQuality != 0){// Event Not Accepted
2480  //cout << "event rejected due to: " <<eventQuality << endl;
2481  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC);
2482  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality); // Should be 0 here
2483  continue;
2484  }
2485  if (triggered == kTRUE) {
2486  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC); // Should be 0 here
2487  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality); // Should be 0 here
2488 
2490  fHistoVertexZ[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetZ(), fWeightJetJetMC);
2491  if(!fDoLightOutput){
2492  fHistoSPDClusterTrackletBackground[iCut]->Fill(fInputEvent->GetMultiplicity()->GetNumberOfTracklets(),(fInputEvent->GetNumberOfITSClusters(0)+fInputEvent->GetNumberOfITSClusters(1)), fWeightJetJetMC);
2493  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A(), fWeightJetJetMC);
2494  else fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C(), fWeightJetJetMC);
2495  }
2496  }
2497  if(fIsMC> 0){
2498  // Process MC Particle
2499  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
2500  if(fInputEvent->IsA()==AliESDEvent::Class()){
2501  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
2502  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
2503  fMCEvent);
2504  }
2505  else if(fInputEvent->IsA()==AliAODEvent::Class()){
2506  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
2507  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
2508  fInputEvent);
2509  }
2510 
2511  if(!fDoLightOutput){
2512  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader()){
2513  for(Int_t i = 0;i<(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
2514  TString nameBin= fHistoMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
2515  if (nameBin.CompareTo("")== 0){
2516  TString nameHeader = ((TObjString*)((TList*)((AliConvEventCuts*)fEventCutArray->At(iCut))
2517  ->GetAcceptedHeader())->At(i))->GetString();
2518  fHistoMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
2519  }
2520  }
2521  }
2522  }
2523  }
2524  }
2525  if(fIsMC> 0){
2526  if(fInputEvent->IsA()==AliESDEvent::Class())
2528  if(fInputEvent->IsA()==AliAODEvent::Class())
2530  }
2531 
2532  if (triggered==kFALSE) continue;
2533 
2534  // 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)
2535  ProcessClusters(); // process calo clusters
2536 
2538 
2539  fHistoNGammaCandidates[iCut]->Fill(fClusterCandidates->GetEntries(), fWeightJetJetMC);
2541  if(fDoMesonAnalysis){ // Meson Analysis
2542 
2543  CalculatePi0Candidates(); // Combine Gammas from conversion and from calo
2544  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
2545  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
2546 
2547  CalculateBackground(); // Combinatorial Background
2548  UpdateEventByEventData(); // Store Event for mixed Events
2549  }
2550 
2551  }
2554  }
2555 
2556  if(fIsMC> 0){
2559  }
2560 
2561  fClusterCandidates->Clear(); // delete cluster candidates
2562  }
2564 
2565  PostData(1, fOutputContainer);
2566 }
2567 
2568 //________________________________________________________________________
2570 {
2571 
2572  Int_t nclus = 0;
2573  TClonesArray * arrClustersProcess = NULL;
2575  if(!fCorrTaskSetting.CompareTo("")){
2576  nclus = fInputEvent->GetNumberOfCaloClusters();
2577  } else {
2578  arrClustersProcess = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(Form("%sClustersBranch",fCorrTaskSetting.Data())));
2579  if(!arrClustersProcess)
2580  AliFatal(Form("%sClustersBranch was not found in AliAnalysisTaskGammaCalo! Check the correction framework settings!",fCorrTaskSetting.Data()));
2581  nclus = arrClustersProcess->GetEntries();
2582  }
2583 
2584  if(nclus == 0) return;
2585  // plotting histograms on cell/tower level, only if extendedMatchAndQA > 1
2586  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FillHistogramsExtendedQA(fInputEvent,fIsMC);
2587 
2588  // match tracks to clusters
2589  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchTracksToClusters(fInputEvent,fWeightJetJetMC);
2590 
2591  // vertex
2592  Double_t vertex[3] = {0};
2593  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
2594 
2595  Double_t maxClusterEnergy = -1;
2596  Int_t maxClusterID = -1;
2597  map<Long_t,Int_t> mapIsClusterAccepted;
2598  map<Long_t,Int_t> mapIsClusterAcceptedWithoutTrackMatch;
2599  // Loop over EMCal clusters
2600  for(Long_t i = 0; i < nclus; i++){
2601  AliVCluster* clus = NULL;
2602  if(fInputEvent->IsA()==AliESDEvent::Class()){
2603  if(arrClustersProcess)
2604  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(i));
2605  else
2606  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
2607  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
2608  if(arrClustersProcess)
2609  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(i));
2610  else
2611  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
2612  }
2613 
2614  if(!clus) continue;
2615  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fMCEvent,fIsMC,fWeightJetJetMC,i)){
2616  if(fProduceTreeEOverP && ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedBeforeTrackMatch() ) mapIsClusterAcceptedWithoutTrackMatch[i] = 1;
2617  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetIsAcceptedForBasicCounting())fNCurrentClusterBasic++;
2618  delete clus;
2619  continue;
2620  }
2622 
2623  // TLorentzvector with cluster
2624  TLorentzVector clusterVector;
2625  clus->GetMomentum(clusterVector,vertex);
2626 
2627  TLorentzVector* tmpvec = new TLorentzVector();
2628  tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
2629 
2630  // convert to AODConversionPhoton
2631  AliAODConversionPhoton *PhotonCandidate=new AliAODConversionPhoton(tmpvec);
2632  if(!PhotonCandidate){ delete clus; delete tmpvec; continue;}
2633 
2634  //determine maximum cluster energy in event
2635  if(fProduceCellIDPlots && (clus->E() > maxClusterEnergy)){
2636  maxClusterEnergy = clus->E();
2637  maxClusterID = (Int_t) i;
2638  }
2640  mapIsClusterAccepted[i] = 1;
2641  mapIsClusterAcceptedWithoutTrackMatch[i] = 1;
2642  }
2643 
2644  // Flag Photon as CaloPhoton
2645  PhotonCandidate->SetIsCaloPhoton();
2646  PhotonCandidate->SetCaloClusterRef(i);
2647  PhotonCandidate->SetLeadingCellID(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FindLargestCellInCluster(clus,fInputEvent));
2648  // get MC label
2649  if(fIsMC> 0){
2650  Int_t* mclabelsCluster = clus->GetLabels();
2651  PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
2652 // cout << clus->GetNLabels() << endl;
2653  if (clus->GetNLabels()>0){
2654  for (Int_t k =0; k< (Int_t)clus->GetNLabels(); k++){
2655  if (k< 50)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
2656 // Int_t pdgCode = fMCEvent->Particle(mclabelsCluster[k])->GetPdgCode();
2657 // cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
2658  }
2659  }
2660  }
2661 
2662  fIsFromDesiredHeader = kTRUE;
2664  // test whether largest contribution to cluster orginates in added signals
2665  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() > 0){
2666  if ( ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCEvent, fInputEvent) == 0) fIsFromDesiredHeader = kFALSE;
2667  if (clus->GetNLabels()>1){
2668  Int_t* mclabelsCluster = clus->GetLabels();
2669  if (fLocalDebugFlag > 1) cout << "testing if other labels in cluster belong to different header, need to test " << (Int_t)clus->GetNLabels()-1 << " additional labels" << endl;
2670  for (Int_t l = 1; l < (Int_t)clus->GetNLabels(); l++ ){
2671  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(mclabelsCluster[l], fMCEvent, fInputEvent, fLocalDebugFlag) == 0) fIsOverlappingWithOtherHeader = kTRUE;
2672  }
2673  if (fLocalDebugFlag > 1 && fIsOverlappingWithOtherHeader) cout << "found overlapping header: " << endl;
2674  }
2675  }
2676 
2677  fHistoClusAllHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(), fWeightJetJetMC);
2678  if (!fIsFromDesiredHeader) fHistoClusRejectedHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(), fWeightJetJetMC);
2680 
2681 
2683  fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt(), fWeightJetJetMC);
2684  fHistoClusGammaE[fiCut]->Fill(PhotonCandidate->E(), fWeightJetJetMC);
2685  if (!fDoLightOutput && fDoClusterQA > 0) fHistoClusGammaPtM02[fiCut]->Fill(PhotonCandidate->Pt(), clus->GetM02(), fWeightJetJetMC);
2686  if(fIsMC> 0){
2687  if(fInputEvent->IsA()==AliESDEvent::Class()){
2688  ProcessTrueClusterCandidates(PhotonCandidate,clus);
2689  } else {
2690  ProcessTrueClusterCandidatesAOD(PhotonCandidate,clus);
2691  }
2692  }
2693 
2694  fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
2695  } else{
2696  delete PhotonCandidate;
2697  }
2698 
2699  delete clus;
2700  delete tmpvec;
2701  }
2702 
2703  if(fProduceCellIDPlots){
2704  for(Long_t i = 0; i < nclus; i++){
2705  if( mapIsClusterAccepted[i] != 1 ) continue;
2706 
2707  AliVCluster* clus = NULL;
2708  if(fInputEvent->IsA()==AliESDEvent::Class()){
2709  if(arrClustersProcess)
2710  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(i));
2711  else
2712  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
2713  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
2714  if(arrClustersProcess)
2715  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(i));
2716  else
2717  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
2718  }
2719 
2720  if(!clus) continue;
2721 
2722  Int_t cellID = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FindLargestCellInCluster(clus,fInputEvent);
2723  fHistCellIDvsClusterEnergy[fiCut]->Fill(clus->E(),cellID);
2724  if (maxClusterID == i && maxClusterID > -1 ) fHistCellIDvsClusterEnergyMax[fiCut]->Fill(maxClusterEnergy,cellID);
2725  delete clus;
2726  }
2727  }
2728 
2729  if(fProduceTreeEOverP){
2730  AliESDEvent *esdev = dynamic_cast<AliESDEvent*>(fInputEvent);
2731  AliAODEvent *aodev = 0;
2732  Bool_t isESD = kTRUE;
2733  if (!esdev) {
2734  isESD = kFALSE;
2735  aodev = dynamic_cast<AliAODEvent*>(fInputEvent);
2736  if (!aodev) {
2737  AliError("Task needs AOD or ESD event...");
2738  }
2739  }
2740 
2741  AliESDtrackCuts *EsdTrackCuts = 0x0;
2742  if(esdev){
2743  // Using standard function for setting Cuts
2744  Int_t runNumber = fInputEvent->GetRunNumber();
2745  // if LHC11a or earlier or if LHC13g or if LHC12a-i -> use 2010 cuts
2746  if( (runNumber<=146860) || (runNumber>=197470 && runNumber<=197692) || (runNumber>=172440 && runNumber<=193766) ){
2747  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
2748  // else if run2 data use 2015 PbPb cuts
2749  }else if (runNumber>=209122){
2750  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb();
2751  // else use 2011 version of track cuts
2752  }else{
2753  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();
2754  }
2755  EsdTrackCuts->SetMaxDCAToVertexZ(2);
2756  EsdTrackCuts->SetEtaRange(-0.8, 0.8);
2757  EsdTrackCuts->SetPtRange(0.15);
2758  }
2759 
2760  for(Long_t i = 0; i < nclus; i++){
2761  if( mapIsClusterAcceptedWithoutTrackMatch[i] != 1 ) continue;
2762 
2763  AliVCluster* clus = NULL;
2764  if(fInputEvent->IsA()==AliESDEvent::Class()){
2765  if(arrClustersProcess)
2766  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(i));
2767  else
2768  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
2769  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
2770  if(arrClustersProcess)
2771  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(i));
2772  else
2773  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
2774  }
2775 
2776  if(!clus) continue;
2777 
2778  fClusterE = clus->E();
2779  fClusterM02 = clus->GetM02();
2780  fClusterM20 = clus->GetM20();
2781  fClusterLeadCellID = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FindLargestCellInCluster(clus,fInputEvent);
2782 
2783  Int_t labelTrackMatch = -1;
2784  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetHighestPtMatchedTrackToCluster(fInputEvent,clus,labelTrackMatch)){
2785  delete clus;
2786  continue;
2787  }
2788 
2789  AliVTrack* currTrack = dynamic_cast<AliVTrack*>(fInputEvent->GetTrack(labelTrackMatch));
2790  if(!currTrack){
2791  delete clus;
2792  continue;
2793  }
2794  if(esdev){
2795  AliESDtrack *esdt = dynamic_cast<AliESDtrack*>(currTrack);
2796  if(!EsdTrackCuts->AcceptTrack(esdt)){
2797  delete clus;
2798  continue;
2799  }
2800  if(esdt->Pt()<1.){
2801  delete clus;
2802  continue;
2803  }
2804  fClusterEP = fClusterE/esdt->P();
2805  fTrackPt = esdt->Pt();
2806  }else if(aodev){
2807  AliAODTrack *aodt = dynamic_cast<AliAODTrack*>(currTrack);
2808  if(!aodt->IsHybridGlobalConstrainedGlobal()){
2809  delete clus;
2810  continue;
2811  }
2812  if(TMath::Abs(aodt->Eta())>0.8){
2813  delete clus;
2814  continue;
2815  }
2816  if(aodt->Pt()<1.){
2817  delete clus;
2818  continue;
2819  }
2820  fClusterEP = fClusterE/aodt->P();
2821  fTrackPt = aodt->Pt();
2822  }
2823 
2824  AliPIDResponse* pidResponse = ((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetPIDResponse();
2825  if(!pidResponse){
2826  delete clus;
2827  continue;
2828  }
2829 
2830  Float_t temp = TMath::Abs(pidResponse->NumberOfSigmasTPC(currTrack,AliPID::kElectron));
2831  if(temp<10.){
2832  fTrackPID_e = temp*10;
2833  }else fTrackPID_e = 99;
2834 
2835  temp = TMath::Abs(pidResponse->NumberOfSigmasTPC(currTrack,AliPID::kPion));
2836  if(temp<10.){
2837  fTrackPID_Pi = temp*10;
2838  }else fTrackPID_Pi = 99;
2839 
2840  temp = TMath::Abs(pidResponse->NumberOfSigmasTPC(currTrack,AliPID::kKaon));
2841  if(temp<10.){
2842  fTrackPID_K = temp*10;
2843  }else fTrackPID_K = 99;
2844 
2845  temp = TMath::Abs(pidResponse->NumberOfSigmasTPC(currTrack,AliPID::kProton));
2846  if(temp<10.){
2847  fTrackPID_P = temp*10;
2848  }else fTrackPID_P = 99;
2849 
2850  Float_t tempEta = -99999;
2851  Float_t tempPhi = -99999;
2852  ((AliCaloTrackMatcher*)((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetCaloTrackMatcherInstance())->GetTrackClusterMatchingResidual(currTrack->GetID(),clus->GetID(),tempEta,tempPhi);
2853  fDeltaEta = tempEta;
2854  fDeltaPhi = tempPhi;
2855 
2856  //determine isolation in cluster Et
2857  Float_t clsPos[3] = {0.,0.,0.};
2858  Float_t secondClsPos[3] = {0.,0.,0.};
2859  TLorentzVector clusterVector;
2860 
2861  clus->GetPosition(clsPos);
2862  TVector3 clsPosVec(clsPos);
2863 
2864  Float_t sum_Et = 0;
2865  for(Int_t j=0; j<nclus; j++){
2866  if( i == j ) continue;
2867  if( mapIsClusterAcceptedWithoutTrackMatch[j] != 1 ) continue;
2868 
2869  AliVCluster* secondClus = NULL;
2870  if(fInputEvent->IsA()==AliESDEvent::Class()){
2871  if(arrClustersProcess)
2872  secondClus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(j));
2873  else
2874  secondClus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(j));
2875  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
2876  if(arrClustersProcess)
2877  secondClus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(j));
2878  else
2879  secondClus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(j));
2880  }
2881 
2882  if(!secondClus) continue;
2883  secondClus->GetPosition(secondClsPos);
2884  TVector3 secondClsPosVec(secondClsPos);
2885 
2886  Float_t dPhi = clsPosVec.DeltaPhi(secondClsPosVec);
2887  Float_t dEta = clsPosVec.Eta()-secondClsPosVec.Eta();
2888  if(TMath::Sqrt(dEta*dEta + dPhi*dPhi) < 0.2){
2889  secondClus->GetMomentum(clusterVector,vertex);
2890  sum_Et += clusterVector.Et();
2891  }
2892  delete secondClus;
2893  }
2894  fClusterIsoSumClusterEt = sum_Et;
2895 
2896  //determine isolation in track Et
2897  fClusterIsoSumTrackEt = ((AliCaloTrackMatcher*)((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetCaloTrackMatcherInstance())->SumTrackEtAroundCluster(fInputEvent,clus->GetID(),0.2);
2898  //remove Et from matched track
2899  TLorentzVector vecTrack;
2900  vecTrack.SetPxPyPzE(currTrack->Px(),currTrack->Py(),currTrack->Pz(),currTrack->E());
2901  fClusterIsoSumTrackEt -= vecTrack.Et();
2902 
2903  //get cluster classification
2904  if(fIsMC > 0) fClusterClassification = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClassifyClusterForTMEffi(clus,fInputEvent,fMCEvent,isESD);
2905 
2906  tClusterEOverP[fiCut]->Fill();
2907  delete clus;
2908  }
2909  mapIsClusterAcceptedWithoutTrackMatch.clear();
2910  }
2911 
2912  if(fProduceCellIDPlots || fProduceTreeEOverP) mapIsClusterAccepted.clear();
2913 
2914  if(fLocalDebugFlag == 2) EventDebugMethod();
2915 
2916  return;
2917 }
2918 
2919 //________________________________________________________________________
2921 {
2922 
2923  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2924  Double_t mcProdVtxX = primVtxMC->GetX();
2925  Double_t mcProdVtxY = primVtxMC->GetY();
2926  Double_t mcProdVtxZ = primVtxMC->GetZ();
2927 
2928  TParticle *Photon = NULL;
2929  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
2931 
2932  if (TruePhotonCandidate->GetCaloPhotonMCLabel(0) < 0) return;
2933  if (TruePhotonCandidate->GetNCaloPhotonMCLabels() > 0) Photon = fMCEvent->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
2934  else return;
2935 
2936  if(Photon == NULL){
2937  // cout << "no photon" << endl;
2938  return;
2939  }
2940 
2941  Int_t pdgCodeParticle = Photon->GetPdgCode();
2942  TruePhotonCandidate->SetCaloPhotonMCFlags(fMCEvent, fEnableSortForClusMC);
2943 
2944  // True Photon
2945 
2946  if (TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())) {
2947  fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2948  if (!fDoLightOutput && fDoClusterQA > 0) fHistoTrueClusGammaPtM02[fiCut]->Fill(TruePhotonCandidate->Pt(), clus->GetM02(), fWeightJetJetMC);
2949  } else if (fDoClusterQA > 0) fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2950  if (fDoClusterQA > 0){
2951  if (TruePhotonCandidate->IsLargestComponentPhoton()){
2952  fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2953  fHistoTrueClusUnConvGammaMCPt[fiCut]->Fill(Photon->Pt(), fWeightJetJetMC);
2954  if (!fDoLightOutput) fHistoTrueClusUnConvGammaPtM02[fiCut]->Fill(TruePhotonCandidate->Pt(), clus->GetM02(), fWeightJetJetMC);
2955  }
2956  if (TruePhotonCandidate->IsLargestComponentElectron())
2957  fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2958  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2959  fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2960  if(Photon->GetMother(0) > -1){
2961  TParticle* motherPart = (TParticle*)fMCEvent->Particle(Photon->GetMother(0));
2962  fHistoTrueClusConvGammaMCPt[fiCut]->Fill(motherPart->Pt(), fWeightJetJetMC);
2963  }
2964  }
2965  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
2966  fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2967  if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
2968  fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2969  if (TruePhotonCandidate->IsMergedPartConv())
2970  fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2971  if (TruePhotonCandidate->IsDalitz())
2972  fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2973  if (TruePhotonCandidate->IsDalitzMerged())
2974  fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2975  if (TruePhotonCandidate->IsPhotonWithElecMother())
2976  fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2977  if (TruePhotonCandidate->IsShower())
2978  fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2979  if (TruePhotonCandidate->IsSubLeadingEM())
2980  fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2981  fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels(), fWeightJetJetMC);
2982  if (!TruePhotonCandidate->IsLargestComponentPhoton()) {
2983  FillPhotonBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
2984  if (!fDoLightOutput) FillPhotonBackgroundM02Hist(TruePhotonCandidate,clus,pdgCodeParticle);
2985  }
2986  if (!(TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())) ) {
2987  FillPhotonPlusConversionBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
2988  if (!fDoLightOutput) FillPhotonPlusConversionBackgroundM02Hist(TruePhotonCandidate,clus,pdgCodeParticle);
2989  }
2990  Int_t motherLab = Photon->GetMother(0);
2991  if (motherLab > -1){
2992  if (TruePhotonCandidate->IsLargestComponentPhoton()){
2994  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)0,fWeightJetJetMC);
2996  }
2997  }
2998  Int_t grandMotherLab = fMCEvent->Particle(motherLab)->GetMother(0);
2999  if (grandMotherLab > -1){
3000  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3002  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)1,fWeightJetJetMC);
3004  }
3005  }
3006  }
3007  }
3008  }
3009 
3010  if(!fDoLightOutput){
3011  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, TruePhotonCandidate->GetCaloPhotonMCLabel(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3012  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
3013  isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, Photon->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3014 
3015  if(isPrimary){
3016  // filling primary histograms
3017  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3018  fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3019  fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(), fWeightJetJetMC); // Allways Filled
3020  }
3021  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3022  fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3023  fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(), fWeightJetJetMC); // Allways Filled
3024  }
3025 
3026  } else {
3027  // filling secondary histograms
3028  Int_t secondaryClass = -1;
3029  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
3030  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhoton( Photon, fMCEvent, kTRUE);
3031  else
3032  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhoton( Photon, fMCEvent, kFALSE);
3033 
3034  // all secondaries
3035  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3036  if (secondaryClass == 2) {
3037  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3038  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3039  fHistoTrueSecondaryClusGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3040  } else if (secondaryClass == 5) {
3041  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3042  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),1.,fWeightJetJetMC);
3043  fHistoTrueSecondaryClusGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3044  } else if (secondaryClass == 3) {
3045  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3046  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),2.,fWeightJetJetMC);
3047  fHistoTrueSecondaryClusGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3048  } else if (secondaryClass == 4) {
3049  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3050  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3051  } else {
3052  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),4.,fWeightJetJetMC);
3053  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),4.,fWeightJetJetMC);
3054  }
3055  }
3056  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3057  if (secondaryClass == 2) {
3058  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3060  fHistoTrueSecondaryClusConvGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3061  } else if (secondaryClass == 5) {
3062  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3064  fHistoTrueSecondaryClusConvGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3065  } else if (secondaryClass == 3) {
3066  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3068  fHistoTrueSecondaryClusConvGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3069  } else if (secondaryClass == 4) {
3070  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3072  } else {
3073  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),4.,fWeightJetJetMC);
3075  }
3076  }
3077  }
3078  }
3079  return;
3080 }
3081 
3082 
3083 //________________________________________________________________________
3085 {
3086  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3087  Double_t mcProdVtxX = primVtxMC->GetX();
3088  Double_t mcProdVtxY = primVtxMC->GetY();
3089  Double_t mcProdVtxZ = primVtxMC->GetZ();
3090 
3091  AliAODMCParticle *Photon = NULL;
3092  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3094  if (AODMCTrackArray){
3095  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
3096  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
3097  else return;
3098  } else {
3099  AliInfo("AODMCTrackArray could not be loaded");
3100  return;
3101  }
3102 
3103  if(Photon == NULL){
3104  // cout << "no photon" << endl;
3105  return;
3106  }
3107  Int_t pdgCodeParticle = Photon->GetPdgCode();
3109 
3110  // True Photon
3111  if (TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())) {
3112  fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3113  if (!fDoLightOutput && fDoClusterQA > 0) fHistoTrueClusGammaPtM02[fiCut]->Fill(TruePhotonCandidate->Pt(), clus->GetM02(), fWeightJetJetMC);
3114  } else if (fDoClusterQA > 0) fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
3115  if (fDoClusterQA > 0){
3116  if (TruePhotonCandidate->IsLargestComponentPhoton()) {
3117  fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3118  fHistoTrueClusUnConvGammaMCPt[fiCut]->Fill(Photon->Pt(), fWeightJetJetMC);
3119  if (!fDoLightOutput) fHistoTrueClusUnConvGammaPtM02[fiCut]->Fill(TruePhotonCandidate->Pt(), clus->GetM02(), fWeightJetJetMC);
3120  }
3121  if (TruePhotonCandidate->IsLargestComponentElectron())
3122  fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3123  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) {
3124  fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3125  AliAODMCParticle *motherPart = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
3126  fHistoTrueClusConvGammaMCPt[fiCut]->Fill(motherPart->Pt(), fWeightJetJetMC);
3127  }
3128  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
3129  fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3130  if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
3131  fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3132  if (TruePhotonCandidate->IsMergedPartConv())
3133  fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3134  if (TruePhotonCandidate->IsDalitz())
3135  fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3136  if (TruePhotonCandidate->IsDalitzMerged())
3137  fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3138  if (TruePhotonCandidate->IsPhotonWithElecMother())
3139  fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3140  if (TruePhotonCandidate->IsShower())
3141  fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3142  if (TruePhotonCandidate->IsSubLeadingEM())
3143  fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3144  fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels(), fWeightJetJetMC);
3145 
3146  if (!TruePhotonCandidate->IsLargestComponentPhoton()) {
3147  FillPhotonBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
3148  if (!fDoLightOutput) FillPhotonBackgroundM02Hist(TruePhotonCandidate,clus,pdgCodeParticle);
3149  }
3150  if (!(TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())) ) {
3151  FillPhotonPlusConversionBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
3152  if (!fDoLightOutput) FillPhotonPlusConversionBackgroundM02Hist(TruePhotonCandidate,clus,pdgCodeParticle);
3153  }
3154  Int_t motherLab = Photon->GetMother();
3155  if (motherLab > -1){
3156  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3158  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)0,fWeightJetJetMC);
3160  }
3161  }
3162  Int_t grandMotherLab = ((AliAODMCParticle*) AODMCTrackArray->At(motherLab))->GetMother();
3163  if (grandMotherLab > -1){
3164  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3166  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)1,fWeightJetJetMC);
3168  }
3169  }
3170  }
3171  }
3172  }
3173 
3174  if(!fDoLightOutput){
3175  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3176  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3177  if (Photon->GetMother()> -1){
3178  AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
3179  isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, Mother, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3180  }
3181  }
3182  if(isPrimary){
3183  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3184  fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3185  fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(), fWeightJetJetMC); // Allways Filled
3186  }
3187  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3188  fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3189  fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(), fWeightJetJetMC); // Allways Filled
3190  }
3191 
3192  } else {
3193  // filling secondary histograms
3194  Int_t secondaryClass = -1;
3195  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
3196  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhotonAOD( Photon, AODMCTrackArray, kTRUE);
3197  else
3198  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhotonAOD( Photon, AODMCTrackArray, kFALSE);
3199 
3200  // all secondaries
3201  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3202  if (secondaryClass == 2) {
3203  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3204  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3205  fHistoTrueSecondaryClusGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3206  } else if (secondaryClass == 5) {
3207  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3208  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),1.,fWeightJetJetMC);
3209  fHistoTrueSecondaryClusGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3210  } else if (secondaryClass == 3) {
3211  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3212  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),2.,fWeightJetJetMC);
3213  fHistoTrueSecondaryClusGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3214  } else if (secondaryClass == 4) {
3215  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3216  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3217  } else {
3218  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),4.,fWeightJetJetMC);
3219  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),4.,fWeightJetJetMC);
3220  }
3221  }
3222  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3223  if (secondaryClass == 2) {
3224  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3226  fHistoTrueSecondaryClusConvGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3227  } else if (secondaryClass == 5) {
3228  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3230  fHistoTrueSecondaryClusConvGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3231  } else if (secondaryClass == 3) {
3232  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3234  fHistoTrueSecondaryClusConvGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3235  } else if (secondaryClass == 4) {
3236  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3238  } else {
3239  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),4.,fWeightJetJetMC);
3241  }
3242  }
3243  }
3244  }
3245 
3246 }
3247 
3248 //________________________________________________________________________
3250 {
3251  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3252  Double_t mcProdVtxX = primVtxMC->GetX();
3253  Double_t mcProdVtxY = primVtxMC->GetY();
3254  Double_t mcProdVtxZ = primVtxMC->GetZ();
3255 
3256  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3257  if (AODMCTrackArray == NULL) return;
3258 
3259  // Loop over all primary MC particle
3260  for(Long_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
3261 
3262  AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
3263  if (!particle) continue;
3264 
3265  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, particle, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3266  if (isPrimary){
3267 
3268  Int_t isMCFromMBHeader = -1;
3269  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3270  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3271  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3272  }
3273 
3274  if(!fDoLightOutput){
3275  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(particle,AODMCTrackArray)){
3276  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC); // All MC Gamma
3277  if(particle->GetMother() >-1){ // Meson Decay Gamma
3278  switch((static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother())))->GetPdgCode()){
3279  case 111: // Pi0
3280  fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3281  break;
3282  case 113: // Rho0
3283  fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3284  break;
3285  case 221: // Eta
3286  fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3287  break;
3288  case 223: // Omega
3289  fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3290  break;
3291  case 331: // Eta'
3292  fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3293  break;
3294  case 333: // Phi
3295  fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3296  break;
3297  case 3212: // Sigma
3298  fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3299  break;
3300  }
3301  }
3302  }
3303  }
3304  // Converted MC Gamma
3305  if(fDoMesonAnalysis){
3306  Double_t mesonY = 1.e30;
3307  Double_t ratio = 0;
3308  if (particle->E() != TMath::Abs(particle->Pz())){
3309  ratio = (particle->E()+particle->Pz()) / (particle->E()-particle->Pz());
3310  }
3311  if( !(ratio <= 0) ){
3312  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3313  }
3314 
3315  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
3316  if ( particle->GetPdgCode() == 211 ){ // positve pions
3317  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., fWeightJetJetMC);
3318  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
3319  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., fWeightJetJetMC);
3320  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
3321  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., fWeightJetJetMC);
3322  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
3323  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., fWeightJetJetMC);
3324  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
3325  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., fWeightJetJetMC);
3326  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
3327  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., fWeightJetJetMC);
3328  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
3329  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., fWeightJetJetMC);
3330  }
3331  }
3332 
3334  ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3335  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
3336  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
3337  Float_t weighted= 1;
3338  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
3339  if (particle->Pt()>0.005){
3340  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, 0x0, fInputEvent);
3341  }
3342  }
3343 
3344  Double_t mesonY = 1.e30;
3345  Double_t ratio = 0;
3346  if (particle->E() != TMath::Abs(particle->Pz())){
3347  ratio = (particle->E()+particle->Pz()) / (particle->E()-particle->Pz());
3348  }
3349  if( !(ratio <= 0) ){
3350  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3351  }
3352  Double_t alpha = -1;
3353  if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
3354  alpha = TMath::Abs((daughter0->E() - daughter1->E()))/(daughter0->E() + daughter1->E());
3355  }
3356 
3357  if(particle->GetPdgCode() == 111){
3358  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted* fWeightJetJetMC); // All MC Pi0
3359  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3360  if (fIsMC > 1) fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
3361  if (fDoMesonQA > 0 && fDoMesonQA < 3){
3362  fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted* fWeightJetJetMC);
3363  fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha, fWeightJetJetMC);
3364  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3365  }
3366  } else if(particle->GetPdgCode() == 221){
3367  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted* fWeightJetJetMC); // All MC Eta
3368  fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3369  if (fIsMC > 1) fHistoMCEtaWOEvtWeightPt[fiCut]->Fill(particle->Pt());
3370  if (fDoMesonQA > 0 && fDoMesonQA < 3){
3371  fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted* fWeightJetJetMC);
3372  fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha, fWeightJetJetMC);
3373  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3374  }
3375  }
3376 
3377  // Check the acceptance for both gammas
3378  if( ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) &&
3379  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
3380 
3381  if(particle->GetPdgCode() == 111){
3382  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted* fWeightJetJetMC); // MC Pi0 with gamma in acc
3383  if(fIsMC > 1) fHistoMCPi0WOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 with gamma in acc
3384  } else if(particle->GetPdgCode() == 221){
3385  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted* fWeightJetJetMC); // MC Eta with gamma in acc
3386  if(fIsMC > 1) fHistoMCEtaWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta with gamma in acc
3387  }
3388  }
3389  }
3390  }
3391  // fill secondaries
3392  } else {
3393  Int_t isMCFromMBHeader = -1;
3394  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3395  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3396  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3397  }
3398 
3399  if(!fDoLightOutput) {
3400  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(particle,AODMCTrackArray)){
3401  if(particle->GetMother() >-1){
3402  AliAODMCParticle *tmpMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3403  if(tmpMother->GetMother() >-1){
3404  AliAODMCParticle *tmpGrandMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(tmpMother->GetMother()));
3405  if(tmpGrandMother->GetPdgCode() == 310) {
3406  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightJetJetMC);
3407  } else if (tmpGrandMother->GetPdgCode() == 130) {
3408  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightJetJetMC);
3409  } else if (tmpGrandMother->GetPdgCode() == 3122) {
3410  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightJetJetMC);
3411  } else if (tmpGrandMother->GetPdgCode() == 221) {
3412  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3413  } else {
3414  if( !(TMath::Abs(tmpMother->GetPdgCode()) == 11 && tmpGrandMother->GetPdgCode() == 22) )
3415  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),4.,fWeightJetJetMC);
3416  }
3417  } else {
3418  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),4.,fWeightJetJetMC);
3419  }
3420  } else {
3421  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),4.,fWeightJetJetMC);
3422  }
3423  }
3424  }
3425 
3426  if(fDoMesonAnalysis){
3427  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3428  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
3429  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
3430  AliAODMCParticle* mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3431  Int_t pdgCode = mother->GetPdgCode();
3432  if(particle->GetPdgCode() == 111){
3433  Int_t source = GetSourceClassification(111,pdgCode);
3434  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC); // All MC Pi0
3435  fHistoMCSecPi0Source[fiCut]->Fill(pdgCode);
3436  }else if(particle->GetPdgCode() == 221){
3437 
3438  fHistoMCSecEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Pi0
3439  fHistoMCSecEtaSource[fiCut]->Fill(pdgCode);
3440  }
3441 
3442  // check if conversion where within acceptance
3443  if( ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) &&
3444  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray)){
3445  if(particle->GetPdgCode() == 111){
3446  Int_t source = GetSourceClassification(111,pdgCode);
3447  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC); // All MC Pi0
3448  }
3449  }
3450  }
3451  }
3452  }
3453  }
3454 }
3455 //________________________________________________________________________
3457 {
3458  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3459  Double_t mcProdVtxX = primVtxMC->GetX();
3460  Double_t mcProdVtxY = primVtxMC->GetY();
3461  Double_t mcProdVtxZ = primVtxMC->GetZ();
3462 
3463  // Loop over all primary MC particle
3464  for(Long_t i = 0; i < fMCEvent->GetNumberOfTracks(); i++) {
3465  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
3466 
3467  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
3468  if (!particle) continue;
3469 
3470  Int_t isMCFromMBHeader = -1;
3471  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3472  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3473  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3474  }
3475 
3476  if(!fDoLightOutput){
3477  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(particle,fMCEvent)){
3478  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC); // All MC Gamma
3479  if(particle->GetMother(0) >-1){ // Meson Decay Gamma
3480  switch(fMCEvent->Particle(particle->GetMother(0))->GetPdgCode()){
3481  case 111: // Pi0
3482  fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3483  break;
3484  case 113: // Rho0
3485  fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3486  break;
3487  case 221: // Eta
3488  fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3489  break;
3490  case 223: // Omega
3491  fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3492  break;
3493  case 331: // Eta'
3494  fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3495  break;
3496  case 333: // Phi
3497  fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3498  break;
3499  case 3212: // Sigma
3500  fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3501  break;
3502  }
3503  }
3504  }
3505  }
3506  if(fDoMesonAnalysis){
3507 
3508  Double_t mesonY = 1.e30;
3509  Double_t ratio = 0;
3510  if (particle->Energy() != TMath::Abs(particle->Pz())){
3511  ratio = (particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz());
3512  }
3513  if( !(ratio <= 0) ){
3514  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3515  }
3516 
3517  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
3518  if ( particle->GetPdgCode() == 211 ){ // positve pions
3519  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., fWeightJetJetMC);
3520  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
3521  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., fWeightJetJetMC);
3522  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
3523  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., fWeightJetJetMC);
3524  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
3525  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., fWeightJetJetMC);
3526  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
3527  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., fWeightJetJetMC);
3528  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
3529  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., fWeightJetJetMC);
3530  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
3531  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., fWeightJetJetMC);
3532  }
3533  }
3534 
3536  ->MesonIsSelectedMC(particle,fMCEvent,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3537  TParticle* daughter0 = (TParticle*)fMCEvent->Particle(particle->GetFirstDaughter());
3538  TParticle* daughter1 = (TParticle*)fMCEvent->Particle(particle->GetLastDaughter());
3539 
3540  Float_t weighted= 1;
3541  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
3542  if (particle->Pt()>0.005){
3543  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent, fInputEvent);
3544  }
3545  }
3546  Double_t mesonY = 1.e30;
3547  Double_t ratio = 0;
3548  if (particle->Energy() != TMath::Abs(particle->Pz())){
3549  ratio = (particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz());
3550  }
3551  if( !(ratio <= 0) ){
3552  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3553  }
3554  Double_t alpha = -1;
3555  if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
3556  alpha = TMath::Abs((daughter0->Energy() - daughter1->Energy()))/(daughter0->Energy() + daughter1->Energy());
3557  }
3558 
3559  if(particle->GetPdgCode() == 111){
3560  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted* fWeightJetJetMC); // All MC Pi0
3561  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3562  if (fIsMC > 1)fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
3563  if (fDoMesonQA > 0 && fDoMesonQA < 3){
3564  fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted* fWeightJetJetMC);
3565  fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha, fWeightJetJetMC);
3566  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3567  }
3568  } else if(particle->GetPdgCode() == 221){
3569  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted* fWeightJetJetMC); // All MC Eta
3570  fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3571  if (fIsMC > 1)fHistoMCEtaWOEvtWeightPt[fiCut]->Fill(particle->Pt());
3572  if (fDoMesonQA > 0 && fDoMesonQA < 3){
3573  fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted* fWeightJetJetMC);
3574  fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha, fWeightJetJetMC);
3575  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3576  }
3577  }
3578 
3579  // Check the acceptance for both gammas & whether they are counted as primaries as well
3580  Bool_t kDaughter0IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, particle->GetFirstDaughter(), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3581  Bool_t kDaughter1IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, particle->GetLastDaughter(), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3582 
3583  if( kDaughter0IsPrim && kDaughter1IsPrim &&
3584  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCEvent) &&
3585  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCEvent) ){
3586  if(particle->GetPdgCode() == 111){
3587  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted* fWeightJetJetMC); // MC Pi0 with gamma in acc
3588  if(fIsMC > 1) fHistoMCPi0WOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 with gamma in acc
3589  } else if(particle->GetPdgCode() == 221){
3590  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted* fWeightJetJetMC); // MC Eta with gamma in acc
3591  if(fIsMC > 1) fHistoMCEtaWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta with gamma in acc
3592  }
3593  }
3594  }
3595  }
3596  // fill secondary histograms
3597  } else {
3598  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
3599  if (!particle) continue;
3600 
3601  Int_t isMCFromMBHeader = -1;
3602  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3603  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3604  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3605  }
3606 
3607  if(!fDoLightOutput) {
3608  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(particle,fMCEvent)){
3609  if (particle->GetMother(0) > -1 && fMCEvent->Particle(particle->GetMother(0))->GetMother(0) > -1) {
3610  if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
3611  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightJetJetMC);
3612  } else if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 130) {
3613  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightJetJetMC);
3614  } else if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 3122) {
3615  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightJetJetMC);
3616  } else if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 221) {
3617  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3618  } else {
3619  if ( !(TMath::Abs(fMCEvent->Particle(particle->GetMother(0))->GetPdgCode()) == 11 && fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 22) )
3620  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),4.,fWeightJetJetMC);
3621  }
3622  } else {
3623  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),4.,fWeightJetJetMC);
3624  }
3625  }
3626  }
3627 
3628  if(fDoMesonAnalysis){
3629  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedMC(particle,fMCEvent,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3630  TParticle* daughter0 = (TParticle*)fMCEvent->Particle(particle->GetFirstDaughter());
3631  TParticle* daughter1 = (TParticle*)fMCEvent->Particle(particle->GetLastDaughter());
3632  Int_t pdgCode = -1;
3633  if(particle->GetFirstMother() > -1) pdgCode = ((TParticle*)fMCEvent->Particle( particle->GetFirstMother() ))->GetPdgCode();
3634 
3635  if(particle->GetPdgCode() == 111){
3636  Int_t source = GetSourceClassification(111,pdgCode);
3637  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC);
3638  fHistoMCSecPi0Source[fiCut]->Fill(pdgCode);
3639  } else if(particle->GetPdgCode() == 221){
3640  fHistoMCSecEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3641  fHistoMCSecEtaSource[fiCut]->Fill(pdgCode);
3642  }
3643 
3644  // check if photons where within acceptance
3645  if( ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCEvent) &&
3646  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCEvent)){
3647  if(particle->GetPdgCode() == 111){
3648  Int_t source = GetSourceClassification(111,pdgCode);
3649  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC);
3650  }
3651  }
3652  }
3653  }
3654 
3655  }
3656  }
3657 }
3658 
3659 //________________________________________________________________________
3661 
3662  // Conversion Gammas
3663  if(fClusterCandidates->GetEntries()>0){
3664 
3665  for(Int_t firstGammaIndex=0;firstGammaIndex<fClusterCandidates->GetEntries();firstGammaIndex++){
3666  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(firstGammaIndex));
3667  if (gamma0==NULL) continue;
3668  if ( fDoInOutTimingCluster ){
3669  Double_t tof = fInputEvent->GetCaloCluster(gamma0->GetCaloClusterRef())->GetTOF();
3670  if ( tof < fMinTimingCluster || tof > fMaxTimingCluster ) continue;
3671  }
3672 
3673  for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
3674  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
3675  if (gamma1==NULL) continue;
3676  if ( fDoInOutTimingCluster ){
3677  Double_t tof = fInputEvent->GetCaloCluster(gamma1->GetCaloClusterRef())->GetTOF();
3678  if ( tof > fMinTimingCluster && tof < fMaxTimingCluster ) continue;
3679  }
3680 
3681  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
3682  pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
3683 
3684  if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),gamma0->GetLeadingCellID(),gamma1->GetLeadingCellID()))){
3685  if(fLocalDebugFlag == 1) DebugMethodPrint1(pi0cand,gamma0,gamma1);
3686  fHistoMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(), fWeightJetJetMC);
3687  // fill new histograms
3688  if(!fDoLightOutput && TMath::Abs(pi0cand->GetAlpha())<0.1)
3689  fHistoMotherInvMassPtAlpha[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(), fWeightJetJetMC);
3690 
3691  if (fDoMesonQA > 0 && fDoMesonQA < 3){
3692  if ( pi0cand->M() > 0.05 && pi0cand->M() < 0.17){
3693  fHistoMotherPi0PtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(), fWeightJetJetMC);
3694  fHistoMotherPi0PtAlpha[fiCut]->Fill(pi0cand->Pt(),TMath::Abs(pi0cand->GetAlpha()), fWeightJetJetMC);
3695  fHistoMotherPi0PtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle(), fWeightJetJetMC);
3697  }
3698  if ( pi0cand->M() > 0.45 && pi0cand->M() < 0.65){
3699  fHistoMotherEtaPtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(), fWeightJetJetMC);
3700  fHistoMotherEtaPtAlpha[fiCut]->Fill(pi0cand->Pt(),TMath::Abs(pi0cand->GetAlpha()), fWeightJetJetMC);
3701  fHistoMotherEtaPtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle(), fWeightJetJetMC);
3703  }
3704  }
3705  if(fDoTHnSparse && ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->DoBGCalculation()){
3706  Int_t zbin = 0;
3707  Int_t mbin = 0;
3708 
3709  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->BackgroundHandlerType() == 0){
3710  zbin = fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
3711  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
3713  } else {
3715  }
3716  }
3717  Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
3718  fSparseMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
3719  }
3720 
3721  if(fDoMesonQA == 4 && fIsMC == 0 && (pi0cand->Pt() > 13.) ){
3722  Int_t zbin = 0;
3723  Int_t mbin = 0;
3724  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->BackgroundHandlerType() == 0){
3725  zbin = fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
3726  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
3728  } else {
3730  }
3731  }
3732  fInvMassTreeInvMass = pi0cand->M();
3733  fInvMassTreePt = pi0cand->Pt();
3734  fInvMassTreeAlpha = TMath::Abs(pi0cand->GetAlpha());
3735  fInvMassTreeTheta = pi0cand->GetOpeningAngle();
3736  fInvMassTreeMixPool = zbin*100 + mbin;
3737  fInvMassTreeZVertex = fInputEvent->GetPrimaryVertex()->GetZ();
3738  fInvMassTreeEta = pi0cand->Eta();
3739  tSigInvMassPtAlphaTheta[fiCut]->Fill();
3740  }
3741 
3742  if(fIsMC> 0){
3743  if(fInputEvent->IsA()==AliESDEvent::Class())
3744  ProcessTrueMesonCandidates(pi0cand,gamma0,gamma1);
3745  if(fInputEvent->IsA()==AliAODEvent::Class())
3746  ProcessTrueMesonCandidatesAOD(pi0cand,gamma0,gamma1);
3747  }
3748 
3749  if((pi0cand->GetOpeningAngle() < 0.017) && (pi0cand->Pt() > 15.) && fDoClusterQA > 1){
3750  if (fCloseHighPtClusters == NULL){
3751  fCloseHighPtClusters = new TObjString(Form("%s", ((TString)fV0Reader->GetCurrentFileName()).Data()));
3752  if (tClusterQATree) tClusterQATree->Fill();
3753  }
3754  }
3755  }
3756  delete pi0cand;
3757  pi0cand=0x0;
3758  }
3759  }
3760  }
3761 }
3762 //______________________________________________________________________
3764 {
3765  // Process True Mesons
3766  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3767  Double_t mcProdVtxX = primVtxMC->GetX();
3768  Double_t mcProdVtxY = primVtxMC->GetY();
3769  Double_t mcProdVtxZ = primVtxMC->GetZ();
3770  fRconv = -1;
3771 
3772  Bool_t isTruePi0 = kFALSE;
3773  Bool_t isTrueEta = kFALSE;
3774  //Bool_t isTrueGamma = kFALSE;
3775  Bool_t isSameConvertedGamma = kFALSE;
3776  Int_t convertedPhotonLabel0 = -1;
3777  Int_t convertedPhotonLabel1 = -1;
3778 
3779  Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
3780  Int_t gamma0MotherLabel = -1;
3781 
3782  TParticle * gammaMC0 = 0x0;
3783  if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
3784  gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
3785  if (TrueGammaCandidate0->IsLargestComponentPhoton() || TrueGammaCandidate0->IsLargestComponentElectron()){ // largest component is electro magnetic
3786  // get mother of interest (pi0 or eta)
3787  if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons its the direct mother
3788  gamma0MotherLabel=gammaMC0->GetMother(0);
3789  } else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
3790  if (TrueGammaCandidate0->IsConversion() && (gammaMC0->GetMother(0) > -1)){
3791  convertedPhotonLabel0 = gammaMC0->GetMother(0);
3792  gamma0MotherLabel=fMCEvent->Particle(gammaMC0->GetMother(0))->GetMother(0);
3793  } else {
3794  gamma0MotherLabel=gammaMC0->GetMother(0);
3795  }
3796  }
3797  }
3798  }
3799  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3800 
3801  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
3802  Int_t gamma1MotherLabel = -1;
3803  // check if
3804 
3805  TParticle * gammaMC1 = 0x0;
3806  if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
3807  // Daughters Gamma 1
3808  gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
3809  if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
3810  // get mother of interest (pi0 or eta)
3811  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
3812  gamma1MotherLabel = gammaMC1->GetMother(0);
3813  fRconv = gammaMC1->R();
3814  } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
3815  if (TrueGammaCandidate1->IsConversion()){
3816  convertedPhotonLabel1 = gammaMC1->GetMother(0);
3817  fRconv = gammaMC1->R();
3818  if(convertedPhotonLabel1 > -1) gamma1MotherLabel = fMCEvent->Particle(convertedPhotonLabel1)->GetMother(0);
3819  } else {
3820  gamma1MotherLabel=gammaMC1->GetMother(0);
3821  fRconv = gammaMC1->R();
3822  }
3823  }
3824  }
3825  }
3826 
3827  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
3828  if(((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
3829  isTruePi0=kTRUE;
3830  }
3831  if(((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 221){
3832  isTrueEta=kTRUE;
3833  }
3834  }
3835 
3836  if (fDoMesonQA == 3){
3837  // calculate meson properties
3838  fPt = Pi0Candidate->Pt();
3839  fOpenRPrim = Pi0Candidate->GetOpeningAngle();
3840  fInvMass = Pi0Candidate->M();
3841 
3842  Double_t vertex[3] = {0};
3843  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
3844 
3845 // cout << vertex[0] << "\t" << vertex[1] << "\t" << vertex[2] << "\t" << Pi0Candidate->Px() << "\t" << Pi0Candidate->Py() << "\t" << Pi0Candidate->Pz() << "\t"
3846 // << Pi0Candidate->Phi() << endl;
3847 
3848  Double_t scaling = (375 - TMath::Sqrt(vertex[0]*vertex[0]+vertex[1]*vertex[1]))/(TMath::Sqrt(Pi0Candidate->Px()*Pi0Candidate->Px()+Pi0Candidate->Py()*Pi0Candidate->Py()));
3849  vertex[0] = vertex[0] + scaling*Pi0Candidate->Px();
3850  vertex[1] = vertex[1] + scaling*Pi0Candidate->Py();
3851  vertex[2] = vertex[2] + scaling*Pi0Candidate->Pz();
3852 
3853 // cout << vertex[0] << "\t" << vertex[1] << "\t" << vertex[2] << endl;
3854 
3855  TClonesArray * arrClustersMesonCand = NULL;
3856  if(fCorrTaskSetting.CompareTo(""))
3857  arrClustersMesonCand = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(Form("%sClustersBranch",fCorrTaskSetting.Data())));
3858 
3859  AliVCluster* clus1 = NULL;
3860  if(fInputEvent->IsA()==AliESDEvent::Class()){
3861  if(arrClustersMesonCand)
3862  clus1 = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersMesonCand->At(TrueGammaCandidate0->GetCaloClusterRef()));
3863  else
3864  clus1 = fInputEvent->GetCaloCluster(TrueGammaCandidate0->GetCaloClusterRef());
3865  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
3866  if(arrClustersMesonCand)
3867  clus1 = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersMesonCand->At(TrueGammaCandidate0->GetCaloClusterRef()));
3868  else
3869  clus1 = fInputEvent->GetCaloCluster(TrueGammaCandidate0->GetCaloClusterRef());
3870  }
3871 
3872  if (!clus1) return;
3873  TLorentzVector clusterVector1;
3874  clus1->GetMomentum(clusterVector1,vertex);
3875  if(arrClustersMesonCand) delete clus1;
3876  TLorentzVector* tmpvec1 = new TLorentzVector();
3877  tmpvec1->SetPxPyPzE(clusterVector1.Px(),clusterVector1.Py(),clusterVector1.Pz(),clusterVector1.E());
3878  // convert to AODConversionPhoton
3879  AliAODConversionPhoton *PhotonCandidate1=new AliAODConversionPhoton(tmpvec1);
3880  if(!PhotonCandidate1) return;
3881 
3882 
3883  AliVCluster* clus2 = NULL;
3884  if(fInputEvent->IsA()==AliESDEvent::Class()){
3885  if(arrClustersMesonCand)
3886  clus2 = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersMesonCand->At(TrueGammaCandidate1->GetCaloClusterRef()));
3887  else
3888  clus2 = fInputEvent->GetCaloCluster(TrueGammaCandidate1->GetCaloClusterRef());
3889  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
3890  if(arrClustersMesonCand)
3891  clus2 = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersMesonCand->At(TrueGammaCandidate1->GetCaloClusterRef()));
3892  else
3893  clus2 = fInputEvent->GetCaloCluster(TrueGammaCandidate1->GetCaloClusterRef());
3894  }
3895 
3896  if (!clus2) return;
3897  TLorentzVector clusterVector2;
3898  clus2->GetMomentum(clusterVector2,vertex);
3899  if(arrClustersMesonCand) delete clus2;
3900  TLorentzVector* tmpvec2 = new TLorentzVector();
3901  tmpvec2->SetPxPyPzE(clusterVector2.Px(),clusterVector2.Py(),clusterVector2.Pz(),clusterVector2.E());
3902  // convert to AODConversionPhoton
3903  AliAODConversionPhoton *PhotonCandidate2=new AliAODConversionPhoton(tmpvec2);
3904  if(!PhotonCandidate2) return;
3905 
3906  AliAODConversionMother *pi0cand2 = new AliAODConversionMother(PhotonCandidate1,PhotonCandidate2);
3907  fInvMassRTOF = pi0cand2->M();
3908 
3909  delete tmpvec1;
3910  delete tmpvec2;
3911  delete PhotonCandidate1;
3912  delete PhotonCandidate2;
3913  delete pi0cand2;
3914 
3915 // cout << fOpenRPrim << "\t" << fInvMassRTOF << endl;
3916 
3917  }
3918 
3919  if (convertedPhotonLabel0 > -1 && convertedPhotonLabel1 > -1){
3920  if (convertedPhotonLabel0==convertedPhotonLabel1){
3921  isSameConvertedGamma = kTRUE;
3922  if (fDoMesonQA == 3 ){
3923  iFlag = 0;
3925  }
3926  }
3927  }
3928 
3929  if(isTruePi0 || isTrueEta){// True Pion or Eta
3930  if (isTruePi0){
3931  fHistoTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3932 // fHistoTruePi0NonLinearity[fiCut]->Fill(TrueGammaCandidate0->E(),gammaMC0->Energy()/TrueGammaCandidate0->E());
3933 // fHistoTruePi0NonLinearity[fiCut]->Fill(TrueGammaCandidate1->E(),gammaMC1->Energy()/TrueGammaCandidate1->E());
3934  if (!fDoLightOutput && TMath::Abs(Pi0Candidate->GetAlpha())< 0.1){
3935  fHistoTruePi0InvMassPtAlpha[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3936  if (TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate0->IsLargestComponentPhoton())
3937  fHistoTruePi0PureGammaInvMassPtAlpha[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3938  }
3939  }
3940  if (isTrueEta){
3941  fHistoTrueEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3942 // fHistoTrueEtaNonLinearity[fiCut]->Fill(TrueGammaCandidate0->E(),gammaMC0->Energy()/TrueGammaCandidate0->E());
3943 // fHistoTrueEtaNonLinearity[fiCut]->Fill(TrueGammaCandidate1->E(),gammaMC1->Energy()/TrueGammaCandidate1->E());
3944  }
3945  if (fDoMesonQA > 0 && fDoMesonQA < 3 && fIsMC < 2){
3946 // if(isTruePi0) {
3947 // fHistoPi0OpenAngleInvMassPt[fiCut]->Fill(Pi0Candidate->GetOpeningAngle(),Pi0Candidate->M(),Pi0Candidate->Pt(),1);
3948 // }
3949 // if(isTrueEta) {
3950 // fHistoEtaOpenAngleInvMassPt[fiCut]->Fill(Pi0Candidate->GetOpeningAngle(),Pi0Candidate->M(),Pi0Candidate->Pt(),1);
3951 // }
3952  // both gammas are real gammas
3953  if (TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate1->IsLargestComponentPhoton()) {
3954  if (isTruePi0) fHistoTruePi0CaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3955  if (isTrueEta) fHistoTrueEtaCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3956  }
3957  // both particles are electrons
3958  if (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate1->IsLargestComponentElectron() ) {
3959  if (isTruePi0) fHistoTruePi0CaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3960  if (isTrueEta) fHistoTrueEtaCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3961  }
3962  // both particles are converted electrons
3963  if ((TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ){
3964  if (isTruePi0 )fHistoTruePi0CaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3965  if (isTrueEta )fHistoTrueEtaCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3966  }
3967  // 1 gamma is converted the other one is normals
3968  if ( (TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ||
3969  (TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion())
3970  ) {
3971  if (isTruePi0) fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3972  if (isTrueEta) fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3973  }
3974 
3975  if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion() && TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) ||
3976  (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() && TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged())
3977  ) {
3978  if (isTruePi0) fHistoTruePi0NonMergedElectronPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3979  }
3980 
3981  if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion() && TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate1->IsMerged()) ||
3982  (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() && TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate0->IsMerged())
3983  ) {
3984  if (isTruePi0) fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3985  }
3986 
3987  // at least one of the photon is merged
3988  if (TrueGammaCandidate0->IsMerged() || TrueGammaCandidate0->IsMergedPartConv() || TrueGammaCandidate0->IsDalitzMerged() || TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged() ){
3989  if (isTruePi0) fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3990  if (isTrueEta) fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3991  }
3992  // at least one of the photon is merged and part conv
3993  if (TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate0->IsMergedPartConv()) {
3994  if (isTruePi0) fHistoTruePi0CaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3995  if (isTrueEta) fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3996  }
3997  }
3998 
3999  if (fDoMesonQA == 2 && fIsMC < 2){
4000  // category 1: 2 real photons unmerged
4001  if (TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged() && TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) {
4002  if (isTruePi0) fHistoTruePi0Category1[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
4003  if (isTrueEta) fHistoTrueEtaCategory1[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
4004  }
4005  // category 2, 3: 1 real photons unmerged, 1 electron (category 2 merged, category 3 unmerged )
4006  // -> photon 0 is unconverted
4007  if ( (TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion())) {
4008  if (isTruePi0){
4009  if (TrueGammaCandidate1->IsMergedPartConv()) fHistoTruePi0Category2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
4010  if (!TrueGammaCandidate1->IsMergedPartConv()){
4011  fHistoTruePi0Category3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
4012  }
4013  }
4014  if (isTrueEta){
4015  if (TrueGammaCandidate1->IsMergedPartConv()) fHistoTrueEtaCategory2[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
4016  if (!TrueGammaCandidate1->IsMergedPartConv()) fHistoTrueEtaCategory3[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
4017  }
4018  }
4019  // -> photon 1 is unconverted
4020  if ( ( TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) && (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion())) {
4021  if (isTruePi0){
4022  if (TrueGammaCandidate0->