AliPhysics  9c7580a (9c7580a)
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 ||
736  binWidthPt = 0.05;
737  nBinsPt = 351;
738  minPt = 0;
739  maxPt = 100;
740  for(Int_t i=0; i<nBinsPt+1;i++){
741  if (i < 1) arrPtBinning[i] = 0.5*i;
742  else if(i<51) arrPtBinning[i] = 0.5+0.05*(i-1);
743  else if(i<221) arrPtBinning[i] = 3.+0.1*(i-51);
744  else if(i<261) arrPtBinning[i] = 20.+0.25*(i-221);
745  else if(i<301) arrPtBinning[i] = 30.+0.5*(i-261);
746  else if(i<351) arrPtBinning[i] = 50.+1.0*(i-301);
747  else arrPtBinning[i] = maxPt;
748  }
749  nBinsQAPt = 270;
750  maxQAPt = 100;
751  for(Int_t i=0; i<nBinsQAPt+1;i++){
752  if(i<60) arrQAPtBinning[i] = 0.05*i;
753  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
754  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
755  else if(i<210) arrQAPtBinning[i] = 20.+0.5*(i-170);
756  else if(i<270) arrQAPtBinning[i] = 40.+1.0*(i-210);
757  else arrQAPtBinning[i] = maxQAPt;
758  }
759  nBinsClusterPt = 355;
760  minClusterPt = 0;
761  maxClusterPt = 100;
762  for(Int_t i=0; i<nBinsClusterPt+1;i++){
763  if (i < 1) arrClusPtBinning[i] = 0.3*i;
764  else if(i<55) arrPtBinning[i] = 0.3+0.05*(i-1);
765  else if(i<225) arrPtBinning[i] = 3.+0.1*(i-55);
766  else if(i<265) arrPtBinning[i] = 20.+0.25*(i-225);
767  else if(i<305) arrPtBinning[i] = 30.+0.5*(i-265);
768  else if(i<355) arrPtBinning[i] = 50.+1.0*(i-305);
769  else arrClusPtBinning[i] = maxClusterPt;
770  }
771  } else if ( ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kpPb8TeV ){
772  binWidthPt = 0.05;
773  nBinsPt = 261;
774  minPt = 0;
775  maxPt = 100;
776  for(Int_t i=0; i<nBinsPt+1;i++){
777  if (i < 1) arrPtBinning[i] = 0.5*i;
778  else if(i<51) arrPtBinning[i] = 0.5+0.05*(i-1);
779  else if(i<121) arrPtBinning[i] = 3.+0.1*(i-51);
780  else if(i<161) arrPtBinning[i] = 10.+0.25*(i-121);
781  else if(i<201) arrPtBinning[i] = 20.+0.5*(i-161);
782  else if(i<261) arrPtBinning[i] = 40.+1.0*(i-201);
783  else arrPtBinning[i] = maxPt;
784  }
785  nBinsQAPt = 270;
786  maxQAPt = 100;
787  for(Int_t i=0; i<nBinsQAPt+1;i++){
788  if(i<60) arrQAPtBinning[i] = 0.05*i;
789  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
790  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
791  else if(i<210) arrQAPtBinning[i] = 20.+0.5*(i-170);
792  else if(i<270) arrQAPtBinning[i] = 40.+1.0*(i-210);
793  else arrQAPtBinning[i] = maxQAPt;
794  }
795  nBinsClusterPt = 301;
796  minClusterPt = 0;
797  maxClusterPt = 100;
798  for(Int_t i=0; i<nBinsClusterPt+1;i++){
799  if (i < 1) arrClusPtBinning[i] = 0.3*i;
800  else if(i<55) arrClusPtBinning[i] = 0.3+0.05*(i-1);
801  else if(i<125) arrClusPtBinning[i] = 3.+0.1*(i-55);
802  else if(i<155) arrClusPtBinning[i] = 10.+0.2*(i-125);
803  else if(i<211) arrClusPtBinning[i] = 16.+0.25*(i-155);
804  else if(i<251) arrClusPtBinning[i] = 30.+0.5*(i-211);
805  else if(i<301) arrClusPtBinning[i] = 50.+1.0*(i-251);
806  else arrClusPtBinning[i] = maxClusterPt;
807  }
808  } else if ( ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kpPb5TeVR2 ||
810  ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k5TeV ){
811  binWidthPt = 0.05;
812  nBinsPt = 201;
813  minPt = 0;
814  maxPt = 60;
815  for(Int_t i=0; i<nBinsPt+1;i++){
816  if (i < 1) arrPtBinning[i] = 0.5*i;
817  else if(i<51) arrPtBinning[i] = 0.5+0.05*(i-1);
818  else if(i<121) arrPtBinning[i] = 3.+0.1*(i-51);
819  else if(i<161) arrPtBinning[i] = 10.+0.25*(i-121);
820  else if(i<201) arrPtBinning[i] = 20.+1.0*(i-161);
821  else arrPtBinning[i] = maxPt;
822  }
823  nBinsQAPt = 210;
824  maxQAPt = 60;
825  for(Int_t i=0; i<nBinsQAPt+1;i++){
826  if(i<60) arrQAPtBinning[i] = 0.05*i;
827  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
828  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
829  else if(i<210) arrQAPtBinning[i] = 20.+1.0*(i-170);
830  else arrQAPtBinning[i] = maxQAPt;
831  }
832  nBinsClusterPt = 301;
833  minClusterPt = 0;
834  maxClusterPt = 100;
835  for(Int_t i=0; i<nBinsClusterPt+1;i++){
836  if (i < 1) arrClusPtBinning[i] = 0.3*i;
837  else if(i<55) arrClusPtBinning[i] = 0.3+0.05*(i-1);
838  else if(i<125) arrClusPtBinning[i] = 3.+0.1*(i-55);
839  else if(i<155) arrClusPtBinning[i] = 10.+0.2*(i-125);
840  else if(i<211) arrClusPtBinning[i] = 16.+0.25*(i-155);
841  else if(i<251) arrClusPtBinning[i] = 30.+0.5*(i-211);
842  else if(i<301) arrClusPtBinning[i] = 50.+1.0*(i-251);
843  else arrClusPtBinning[i] = maxClusterPt;
844  }
845  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kXeXe5440GeV ){
846  nBinsPt = 88;
847  minPt = 0;
848  maxPt = 20;
849  for(Int_t i=0; i<nBinsPt+1;i++){
850  if (i < 1) arrPtBinning[i] = 0.5*i;
851  else if(i<56) arrPtBinning[i] = 0.5+0.1*(i-1);
852  else if(i<80) arrPtBinning[i] = 6.+0.25*(i-56);
853  else if(i<88) arrPtBinning[i] = 12.+1.0*(i-80);
854  else arrPtBinning[i] = maxPt;
855  }
856  nBinsQAPt = 92;
857  maxQAPt = 20;
858  for(Int_t i=0; i<nBinsQAPt+1;i++){
859  if(i<60) arrQAPtBinning[i] = 0.1*i;
860  else if(i<84) arrQAPtBinning[i] = 6.+0.25*(i-60);
861  else if(i<92) arrQAPtBinning[i] = 12.+1.0*(i-84);
862  else arrQAPtBinning[i] = maxQAPt;
863  }
864  nBinsClusterPt = 148;
865  minClusterPt = 0;
866  maxClusterPt = 40;
867  for(Int_t i=0; i<nBinsClusterPt+1;i++){
868  if (i < 1) arrClusPtBinning[i] = 0.3*i;
869  else if(i<98) arrClusPtBinning[i] = 0.3+0.1*(i-1);
870  else if(i<123) arrClusPtBinning[i] = 10.+0.2*(i-98);
871  else if(i<148) arrClusPtBinning[i] = 15.+1.0*(i-123);
872  else arrClusPtBinning[i] = maxClusterPt;
873  }
874  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kPbPb5TeV ){
875  nBinsPt = 88;
876  minPt = 0;
877  maxPt = 20;
878  for(Int_t i=0; i<nBinsPt+1;i++){
879  if (i < 1) arrPtBinning[i] = 0.5*i;
880  else if(i<56) arrPtBinning[i] = 0.5+0.1*(i-1);
881  else if(i<80) arrPtBinning[i] = 6.+0.25*(i-56);
882  else if(i<88) arrPtBinning[i] = 12.+1.0*(i-80);
883  else arrPtBinning[i] = maxPt;
884  }
885  nBinsQAPt = 92;
886  maxQAPt = 20;
887  for(Int_t i=0; i<nBinsQAPt+1;i++){
888  if(i<60) arrQAPtBinning[i] = 0.1*i;
889  else if(i<84) arrQAPtBinning[i] = 6.+0.25*(i-60);
890  else if(i<92) arrQAPtBinning[i] = 12.+1.0*(i-84);
891  else arrQAPtBinning[i] = maxQAPt;
892  }
893  nBinsClusterPt = 148;
894  minClusterPt = 0;
895  maxClusterPt = 40;
896  for(Int_t i=0; i<nBinsClusterPt+1;i++){
897  if (i < 1) arrClusPtBinning[i] = 0.3*i;
898  else if(i<98) arrClusPtBinning[i] = 0.3+0.1*(i-1);
899  else if(i<123) arrClusPtBinning[i] = 10.+0.2*(i-98);
900  else if(i<148) arrClusPtBinning[i] = 15.+1.0*(i-123);
901  else arrClusPtBinning[i] = maxClusterPt;
902  }
903  } else {
904  for(Int_t i=0; i<nBinsPt+1;i++){
905  arrPtBinning[i] = ((maxPt-minPt)/nBinsPt)*i;
906  }
907  for(Int_t i=0; i<nBinsClusterPt+1;i++){
908  arrClusPtBinning[i] = ((maxClusterPt-minClusterPt)/nBinsClusterPt)*i;
909  }
910  for(Int_t i=0; i<nBinsQAPt+1;i++){
911  if(i<60) arrQAPtBinning[i] = 0.05*i;
912  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
913  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
914  else if(i<175) arrQAPtBinning[i] = 20.+1.0*(i-170);
915  else arrQAPtBinning[i] = maxQAPt;
916  }
917  }
918 
919  // Create histograms
920  if(fOutputContainer != NULL){
921  delete fOutputContainer;
922  fOutputContainer = NULL;
923  }
924  if(fOutputContainer == NULL){
925  fOutputContainer = new TList();
926  fOutputContainer->SetOwner(kTRUE);
927  }
928 
929  // Array of current cut's gammas
930  fClusterCandidates = new TList();
931  fClusterCandidates->SetOwner(kTRUE);
932 
933  fCutFolder = new TList*[fnCuts];
934  fESDList = new TList*[fnCuts];
935  if(fDoTHnSparse){
936  fBackList = new TList*[fnCuts];
937  fMotherList = new TList*[fnCuts];
938  }
939  fHistoNEvents = new TH1F*[fnCuts];
940  if(fIsMC > 1){
941  fHistoNEventsWOWeight = new TH1F*[fnCuts];
942  }
943  if(fIsMC == 2){
944  fProfileJetJetXSection = new TProfile*[fnCuts];
945  fHistoJetJetNTrials = new TH1F*[fnCuts];
946  }
947 
948  fHistoNGoodESDTracks = new TH1F*[fnCuts];
949  fHistoVertexZ = new TH1F*[fnCuts];
950  fHistoNGammaCandidates = new TH1F*[fnCuts];
951  fHistoNGammaCandidatesBasic = new TH1F*[fnCuts];
952  if(!fDoLightOutput){
955  fHistoNV0Tracks = new TH1F*[fnCuts];
956  }
957  if(fIsHeavyIon==2) fProfileEtaShift = new TProfile*[fnCuts];
958 
959  if(fDoMesonAnalysis){
962  if(!fDoLightOutput){
965  }
966  if (fDoMesonQA > 0 && fDoMesonQA < 3){
975  }
976  }
977 
981  }
982 
983  fHistoClusGammaPt = new TH1F*[fnCuts];
984  fHistoClusGammaE = new TH1F*[fnCuts];
986  fHistoClusAllHeadersGammaPt = new TH1F*[fnCuts];
988  if(!fDoLightOutput && fDoClusterQA > 0)
990 
991  if (fDoMesonQA == 4 && fIsMC == 0){
992  fTreeList = new TList*[fnCuts];
995  }
996 
997  if (fProduceTreeEOverP){
998  fClusterTreeList = new TList*[fnCuts];
999  tClusterEOverP = new TTree*[fnCuts];
1000  }
1001 
1002  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1003  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
1004  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
1005  TString cutstringMeson = "NoMesonCut";
1006  if(fDoMesonAnalysis)
1007  cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
1008 
1009  fCutFolder[iCut] = new TList();
1010  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s", cutstringEvent.Data(), cutstringCalo.Data(), cutstringMeson.Data()));
1011  fCutFolder[iCut]->SetOwner(kTRUE);
1012  fOutputContainer->Add(fCutFolder[iCut]);
1013  fESDList[iCut] = new TList();
1014  fESDList[iCut]->SetName(Form("%s_%s_%s ESD histograms", cutstringEvent.Data(), cutstringCalo.Data(), cutstringMeson.Data()));
1015  fESDList[iCut]->SetOwner(kTRUE);
1016  fCutFolder[iCut]->Add(fESDList[iCut]);
1017 
1018  fHistoNEvents[iCut] = new TH1F("NEvents", "NEvents", 14, -0.5, 13.5);
1019  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
1020  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
1021  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
1022  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
1023  TString TriggerNames = "Not Trigger: ";
1024  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
1025  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
1026  } else {
1027  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
1028  }
1029  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
1030  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
1031  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"SPD Pile-Up");
1032  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
1033  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
1034  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problems");
1035  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
1036  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
1037  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
1038  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
1039  fESDList[iCut]->Add(fHistoNEvents[iCut]);
1040 
1041  if (fIsMC > 1){
1042  fHistoNEventsWOWeight[iCut] = new TH1F("NEventsWOWeight", "NEventsWOWeight", 14, -0.5, 13.5);
1043  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
1044  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
1045  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
1046  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
1047  TString TriggerNames = "Not Trigger: ";
1048  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
1049  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
1050  } else {
1051  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
1052  }
1053  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
1054  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
1055  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
1056  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
1057  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
1058  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
1059  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
1060  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
1061  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
1062  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
1063  fESDList[iCut]->Add(fHistoNEventsWOWeight[iCut]);
1064  }
1065  if (fIsMC == 2){
1066  fProfileJetJetXSection[iCut] = new TProfile("XSection", "XSection", 1, -0.5, 0.5);
1067  fESDList[iCut]->Add(fProfileJetJetXSection[iCut]);
1068  fHistoJetJetNTrials[iCut] = new TH1F("NTrials", "#sum{NTrials}", 1, 0, 1);
1069  fHistoJetJetNTrials[iCut]->GetXaxis()->SetBinLabel(1,"#sum{NTrials}");
1070  fESDList[iCut]->Add(fHistoJetJetNTrials[iCut]);
1071  }
1072 
1073  if(fIsHeavyIon == 1)
1074  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 4000, 0, 4000);
1075  else if(fIsHeavyIon == 2)
1076  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 400, 0, 400);
1077  else
1078  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 200, 0, 200);
1079  fHistoNGoodESDTracks[iCut]->GetXaxis()->SetTitle("#primary tracks");
1080  fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
1081 
1082  fHistoVertexZ[iCut] = new TH1F("VertexZ", "VertexZ", 200, -10, 10);
1083  fHistoVertexZ[iCut]->GetXaxis()->SetTitle("Z_{vtx} (cm)");
1084  fESDList[iCut]->Add(fHistoVertexZ[iCut]);
1085 
1086  if(fIsHeavyIon == 1)
1087  fHistoNGammaCandidatesBasic[iCut] = new TH1F("GammaCandidatesBasic", "GammaCandidatesBasic", 600, 0, 600);
1088  else if(fIsHeavyIon == 2)
1089  fHistoNGammaCandidatesBasic[iCut] = new TH1F("GammaCandidatesBasic", "GammaCandidatesBasic", 400, 0, 400);
1090  else
1091  fHistoNGammaCandidatesBasic[iCut] = new TH1F("GammaCandidatesBasic", "GammaCandidatesBasic", 100, 0, 100);
1092  fHistoNGammaCandidatesBasic[iCut]->GetXaxis()->SetTitle("#cluster candidates basic");
1093  fESDList[iCut]->Add(fHistoNGammaCandidatesBasic[iCut]);
1094 
1095 
1096  if(fIsHeavyIon == 1)
1097  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 200, 0, 200);
1098  else if(fIsHeavyIon == 2)
1099  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 100, 0, 100);
1100  else
1101  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 50, 0, 50);
1102  fHistoNGammaCandidates[iCut]->GetXaxis()->SetTitle("#cluster candidates with current cut");
1103  fESDList[iCut]->Add(fHistoNGammaCandidates[iCut]);
1104 
1105  if(!fDoLightOutput){
1106  if(fIsHeavyIon == 1)
1107  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 4000, 0, 4000, 200, 0, 200);
1108  else if(fIsHeavyIon == 2)
1109  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 400, 0, 400, 100, 0, 100);
1110  else
1111  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 200, 0, 200, 50, 0, 50);
1112  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetXTitle("#good tracks");
1113  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetYTitle("#cluster candidates");
1115 
1116  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters", "SPD tracklets vs SPD clusters", 100, 0, 200, 250, 0, 1000);
1117  fESDList[iCut]->Add(fHistoSPDClusterTrackletBackground[iCut]);
1118 
1119  if(fIsHeavyIon == 1)
1120  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 30000, 0, 30000);
1121  else if(fIsHeavyIon == 2)
1122  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 2500, 0, 2500);
1123  else
1124  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 1500, 0, 1500);
1125  fHistoNV0Tracks[iCut]->SetXTitle("V0 amplitude");
1126  fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
1127  }
1128 
1129  if(fIsHeavyIon==2) {
1130  fProfileEtaShift[iCut] = new TProfile("Eta Shift", "Eta Shift", 1, -0.5, 0.5);
1131  fProfileEtaShift[iCut]->SetXTitle("#eta shift");
1132  fESDList[iCut]->Add(fProfileEtaShift[iCut]);
1133  }
1134 
1135  if (fIsMC > 1){
1136  fHistoNEvents[iCut]->Sumw2();
1137  fHistoNGoodESDTracks[iCut]->Sumw2();
1138  fHistoVertexZ[iCut]->Sumw2();
1139  fHistoNGammaCandidates[iCut]->Sumw2();
1140  fHistoNGammaCandidatesBasic[iCut]->Sumw2();
1141  if(!fDoLightOutput){
1143  fHistoSPDClusterTrackletBackground[iCut]->Sumw2();
1144  fHistoNV0Tracks[iCut]->Sumw2();
1145  }
1146  if(fIsHeavyIon==2) fProfileEtaShift[iCut]->Sumw2();
1147  }
1148 
1149  fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt", "ClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1150  fHistoClusGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1151  fESDList[iCut]->Add(fHistoClusGammaPt[iCut]);
1152  fHistoClusGammaE[iCut] = new TH1F("ClusGamma_E", "ClusGamma_E", nBinsClusterPt, arrClusPtBinning);
1153  fHistoClusGammaPt[iCut]->SetXTitle("E_{clus} (GeV/c)");
1154  fESDList[iCut]->Add(fHistoClusGammaE[iCut]);
1155  fHistoClusOverlapHeadersGammaPt[iCut] = new TH1F("ClusGammaOverlapHeaders_Pt", "ClusGammaOverlapHeaders_Pt", nBinsClusterPt, arrClusPtBinning);
1156  fHistoClusOverlapHeadersGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c), selected header w/ overlap");
1157  fESDList[iCut]->Add(fHistoClusOverlapHeadersGammaPt[iCut]);
1158  fHistoClusAllHeadersGammaPt[iCut] = new TH1F("ClusGammaAllHeaders_Pt", "ClusGammaAllHeaders_Pt", nBinsClusterPt, arrClusPtBinning);
1159  fHistoClusAllHeadersGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c), all headers");
1160  fESDList[iCut]->Add(fHistoClusAllHeadersGammaPt[iCut]);
1161  fHistoClusRejectedHeadersGammaPt[iCut] = new TH1F("ClusGammaRejectedHeaders_Pt", "ClusGammaRejectedHeaders_Pt", nBinsClusterPt, arrClusPtBinning);
1162  fHistoClusRejectedHeadersGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c), rejected headers");
1163  fESDList[iCut]->Add(fHistoClusRejectedHeadersGammaPt[iCut]);
1164  if(!fDoLightOutput && fDoClusterQA > 0){
1165  fHistoClusGammaPtM02[iCut] = new TH2F("ClusGamma_Pt_M02", "ClusGamma_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1166  fHistoClusGammaPtM02[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1167  fHistoClusGammaPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1168  fESDList[iCut]->Add(fHistoClusGammaPtM02[iCut]);
1169  }
1170 
1171  if (fIsMC > 1){
1172  fHistoClusGammaPt[iCut]->Sumw2();
1173  fHistoClusGammaE[iCut]->Sumw2();
1174  fHistoClusOverlapHeadersGammaPt[iCut]->Sumw2();
1175  fHistoClusAllHeadersGammaPt[iCut]->Sumw2();
1176  fHistoClusRejectedHeadersGammaPt[iCut]->Sumw2();
1177  if(!fDoLightOutput && fDoClusterQA > 0)fHistoClusGammaPtM02[iCut]->Sumw2();
1178  }
1179 
1180  if(fDoMesonAnalysis){
1181  fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt", "ESD_Mother_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1182  fHistoMotherInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
1183  fHistoMotherInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1184  fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
1185  fHistoMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt", "ESD_Background_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1186  fHistoMotherBackInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
1187  fHistoMotherBackInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1188  fESDList[iCut]->Add(fHistoMotherBackInvMassPt[iCut]);
1189  if(!fDoLightOutput){
1190  fHistoMotherInvMassPtAlpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_Pt_Alpha", "ESD_Mother_InvMass_vs_Pt_Alpha", 800, 0, 0.8, nBinsPt, arrPtBinning);
1191  fHistoMotherInvMassPtAlpha[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
1192  fHistoMotherInvMassPtAlpha[iCut]->SetYTitle("p_{T} (GeV/c)");
1193  fESDList[iCut]->Add(fHistoMotherInvMassPtAlpha[iCut]);
1194  fHistoMotherBackInvMassPtAlpha[iCut] = new TH2F("ESD_Background_InvMass_vs_Pt_Alpha", "ESD_Background_InvMass_vs_Pt_Alpha", 800, 0, 0.8, nBinsPt, arrPtBinning);
1195  fHistoMotherBackInvMassPtAlpha[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
1196  fHistoMotherBackInvMassPtAlpha[iCut]->SetYTitle("p_{T} (GeV/c)");
1197  fESDList[iCut]->Add(fHistoMotherBackInvMassPtAlpha[iCut]);
1198  }
1199 
1200  if (fIsMC > 1){
1201  fHistoMotherInvMassPt[iCut]->Sumw2();
1202  fHistoMotherBackInvMassPt[iCut]->Sumw2();
1203  if(!fDoLightOutput){
1204  fHistoMotherInvMassPtAlpha[iCut]->Sumw2();
1205  fHistoMotherBackInvMassPtAlpha[iCut]->Sumw2();
1206  }
1207  }
1208 
1209  if (fDoMesonQA > 0 && fDoMesonQA < 3 ){
1210  fHistoMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y", "ESD_MotherPi0_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1211  fHistoMotherPi0PtY[iCut]->SetXTitle("p_{T} (GeV/c)");
1212  fHistoMotherPi0PtY[iCut]->SetYTitle("y_{#pi^{0}}");
1213  fESDList[iCut]->Add(fHistoMotherPi0PtY[iCut]);
1214  fHistoMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y", "ESD_MotherEta_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1215  fHistoMotherEtaPtY[iCut]->SetXTitle("p_{T} (GeV/c)");
1216  fHistoMotherEtaPtY[iCut]->SetYTitle("y_{#eta}");
1217  fESDList[iCut]->Add(fHistoMotherEtaPtY[iCut]);
1218  fHistoMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha", "ESD_MotherPi0_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
1219  fHistoMotherPi0PtAlpha[iCut]->SetXTitle("p_{T} (GeV/c)");
1220  fHistoMotherPi0PtAlpha[iCut]->SetYTitle("#alpha_{#pi^{0}}");
1221  fESDList[iCut]->Add(fHistoMotherPi0PtAlpha[iCut]);
1222  fHistoMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha", "ESD_MotherEta_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
1223  fHistoMotherEtaPtAlpha[iCut]->SetXTitle("p_{T} (GeV/c)");
1224  fHistoMotherEtaPtAlpha[iCut]->SetYTitle("#alpha_{#eta}");
1225  fESDList[iCut]->Add(fHistoMotherEtaPtAlpha[iCut]);
1226  fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle", "ESD_MotherPi0_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning,100,0, 0.5);
1227  fHistoMotherPi0PtOpenAngle[iCut]->SetXTitle("p_{T} (GeV/c)");
1228  fHistoMotherPi0PtOpenAngle[iCut]->SetYTitle("#theta_{#pi^{0}}");
1229  fESDList[iCut]->Add(fHistoMotherPi0PtOpenAngle[iCut]);
1230  fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle", "ESD_MotherEta_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning,180,0, 1.8);
1231  fHistoMotherEtaPtOpenAngle[iCut]->SetXTitle("p_{T} (GeV/c)");
1232  fHistoMotherEtaPtOpenAngle[iCut]->SetYTitle("#theta_{#eta}");
1233  fESDList[iCut]->Add(fHistoMotherEtaPtOpenAngle[iCut]);
1234  if(fIsHeavyIon == 1){
1235  fHistoMotherPi0NGoodESDTracksPt[iCut] = new TH2F("ESD_MotherPi0_GoodESDTracks_Pt", "ESD_MotherPi0_GoodESDTracks_Pt", 4000, 0, 4000, nBinsQAPt, arrQAPtBinning);
1236  fHistoMotherPi0NGoodESDTracksPt[iCut]->SetXTitle("# good tracks");
1237  fHistoMotherPi0NGoodESDTracksPt[iCut]->SetYTitle("p_{#pi^{0}, T} (GeV/c)");
1238  fHistoMotherEtaNGoodESDTracksPt[iCut] = new TH2F("ESD_MotherEta_GoodESDTracks_Pt", "ESD_MotherEta_GoodESDTracks_Pt", 4000, 0, 4000, nBinsQAPt, arrQAPtBinning);
1239  fHistoMotherEtaNGoodESDTracksPt[iCut]->SetXTitle("# good tracks");
1240  fHistoMotherEtaNGoodESDTracksPt[iCut]->SetYTitle("p_{#eta, T} (GeV/c)");
1241  }else if(fIsHeavyIon == 2){
1242  fHistoMotherPi0NGoodESDTracksPt[iCut] = new TH2F("ESD_MotherPi0_GoodESDTracks_Pt", "ESD_MotherPi0_GoodESDTracks_Pt", 400, 0, 400, nBinsQAPt, arrQAPtBinning);
1243  fHistoMotherPi0NGoodESDTracksPt[iCut]->SetXTitle("# good tracks");
1244  fHistoMotherPi0NGoodESDTracksPt[iCut]->SetYTitle("p_{#pi^{0}, T} (GeV/c)");
1245  fHistoMotherEtaNGoodESDTracksPt[iCut] = new TH2F("ESD_MotherEta_GoodESDTracks_Pt", "ESD_MotherEta_GoodESDTracks_Pt", 400, 0, 400, nBinsQAPt, arrQAPtBinning);
1246  fHistoMotherEtaNGoodESDTracksPt[iCut]->SetXTitle("# good tracks");
1247  fHistoMotherEtaNGoodESDTracksPt[iCut]->SetYTitle("p_{#eta, T} (GeV/c)");
1248  }else{
1249  fHistoMotherPi0NGoodESDTracksPt[iCut] = new TH2F("ESD_MotherPi0_GoodESDTracks_Pt", "ESD_MotherPi0_GoodESDTracks_Pt", 200, 0, 200, nBinsQAPt, arrQAPtBinning);
1250  fHistoMotherPi0NGoodESDTracksPt[iCut]->SetXTitle("# good tracks");
1251  fHistoMotherPi0NGoodESDTracksPt[iCut]->SetYTitle("p_{#pi^{0}, T} (GeV/c)");
1252  fHistoMotherEtaNGoodESDTracksPt[iCut] = new TH2F("ESD_MotherEta_GoodESDTracks_Pt", "ESD_MotherEta_GoodESDTracks_Pt", 200, 0, 200, nBinsQAPt, arrQAPtBinning);
1253  fHistoMotherEtaNGoodESDTracksPt[iCut]->SetXTitle("# good tracks");
1254  fHistoMotherEtaNGoodESDTracksPt[iCut]->SetYTitle("p_{#eta, T} (GeV/c)");
1255  }
1256  fESDList[iCut]->Add(fHistoMotherPi0NGoodESDTracksPt[iCut]);
1257  fESDList[iCut]->Add(fHistoMotherEtaNGoodESDTracksPt[iCut]);
1258  }
1259 
1260  if (fIsMC > 1 && fDoMesonQA > 0 && fDoMesonQA < 3){
1261  fHistoMotherPi0PtY[iCut]->Sumw2();
1262  fHistoMotherEtaPtY[iCut]->Sumw2();
1263  fHistoMotherPi0PtAlpha[iCut]->Sumw2();
1264  fHistoMotherEtaPtAlpha[iCut]->Sumw2();
1265  fHistoMotherPi0PtOpenAngle[iCut]->Sumw2();
1266  fHistoMotherEtaPtOpenAngle[iCut]->Sumw2();
1267  fHistoMotherPi0NGoodESDTracksPt[iCut]->Sumw2();
1268  fHistoMotherEtaNGoodESDTracksPt[iCut]->Sumw2();
1269  }
1270 
1271  if (fProduceCellIDPlots){
1272  Int_t nMaxCells = 12*48*24;
1273  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetClusterType() == 2) nMaxCells = 5*56*64;
1274  fHistCellIDvsClusterEnergy[iCut] = new TH2F("CellIDvsClusterEnergy", "CellIDvsClusterEnergy", 100, 0.5, 100., nMaxCells, 0, nMaxCells);
1275  fHistCellIDvsClusterEnergy[iCut]->SetXTitle("E_{clus} (GeV)");
1276  fHistCellIDvsClusterEnergy[iCut]->SetYTitle("Cell ID");
1278  fESDList[iCut]->Add(fHistCellIDvsClusterEnergy[iCut]);
1279  fHistCellIDvsClusterEnergyMax[iCut] = new TH2F("CellIDvsClusterEnergyMax", "CellIDvsClusterEnergyMax", 100, 0.5, 100., nMaxCells, 0, nMaxCells);
1280  fHistCellIDvsClusterEnergyMax[iCut]->SetXTitle("E_{clus} (GeV)");
1281  fHistCellIDvsClusterEnergyMax[iCut]->SetYTitle("Cell ID");
1283  fESDList[iCut]->Add(fHistCellIDvsClusterEnergyMax[iCut]);
1284  }
1285 
1286  if (fDoMesonQA == 4 && fIsMC == 0){
1287  fTreeList[iCut] = new TList();
1288  fTreeList[iCut]->SetName(Form("%s_%s_%s InvMass Tree", cutstringEvent.Data(), cutstringCalo.Data(), cutstringMeson.Data()));
1289  fTreeList[iCut]->SetOwner(kTRUE);
1290  fCutFolder[iCut]->Add(fTreeList[iCut]);
1291 
1292  tSigInvMassPtAlphaTheta[iCut] = new TTree("Sig_InvMass_Pt_Alpha_Theta_MixPool", "Sig_InvMass_Pt_Alpha_Theta_MixPool");
1293  tSigInvMassPtAlphaTheta[iCut]->Branch("InvMass",&fInvMassTreeInvMass,"fInvMassTreeInvMass/F");
1294  tSigInvMassPtAlphaTheta[iCut]->Branch("Pt",&fInvMassTreePt,"fInvMassTreePt/F");
1295  tSigInvMassPtAlphaTheta[iCut]->Branch("Alpha",&fInvMassTreeAlpha,"fInvMassTreeAlpha/F");
1296  tSigInvMassPtAlphaTheta[iCut]->Branch("Theta",&fInvMassTreeTheta,"fInvMassTreeTheta/F");
1297  tSigInvMassPtAlphaTheta[iCut]->Branch("MixPool",&fInvMassTreeMixPool,"fInvMassTreeMixPool/I");
1298  tSigInvMassPtAlphaTheta[iCut]->Branch("zVtx",&fInvMassTreeZVertex,"fInvMassTreeZVertex/F");
1299  tSigInvMassPtAlphaTheta[iCut]->Branch("Eta",&fInvMassTreeEta,"fInvMassTreeEta/F");
1300  fTreeList[iCut]->Add(tSigInvMassPtAlphaTheta[iCut]);
1301 
1302  tBckInvMassPtAlphaTheta[iCut] = new TTree("Bck_InvMass_Pt_Alpha_Theta_MixPool", "Bck_InvMass_Pt_Alpha_Theta_MixPool");
1303  tBckInvMassPtAlphaTheta[iCut]->Branch("InvMass",&fInvMassTreeInvMass,"fInvMassTreeInvMass/F");
1304  tBckInvMassPtAlphaTheta[iCut]->Branch("Pt",&fInvMassTreePt,"fInvMassTreePt/F");
1305  tBckInvMassPtAlphaTheta[iCut]->Branch("Alpha",&fInvMassTreeAlpha,"fInvMassTreeAlpha/F");
1306  tBckInvMassPtAlphaTheta[iCut]->Branch("Theta",&fInvMassTreeTheta,"fInvMassTreeTheta/F");
1307  tBckInvMassPtAlphaTheta[iCut]->Branch("MixPool",&fInvMassTreeMixPool,"fInvMassTreeMixPool/I");
1308  tBckInvMassPtAlphaTheta[iCut]->Branch("zVtx",&fInvMassTreeZVertex,"fInvMassTreeZVertex/F");
1309  tBckInvMassPtAlphaTheta[iCut]->Branch("Eta",&fInvMassTreeEta,"fInvMassTreeEta/F");
1310  fTreeList[iCut]->Add(tBckInvMassPtAlphaTheta[iCut]);
1311  }
1312 
1313  if (fProduceTreeEOverP ){
1314  fClusterTreeList[iCut] = new TList();
1315  fClusterTreeList[iCut]->SetName(Form("%s_%s EoverP Tree",cutstringEvent.Data(),cutstringCalo.Data()));
1316  fClusterTreeList[iCut]->SetOwner(kTRUE);
1317  fCutFolder[iCut]->Add(fClusterTreeList[iCut]);
1318 
1319  tClusterEOverP[iCut] = new TTree("EOverP_ClusE_ClusM02_ClusM20_TrackP_TrackPt", "EOverP_ClusE_ClusM02_ClusM20_TrackP_TrackPt");
1320  tClusterEOverP[iCut]->Branch("ClusE",&fClusterE,"fClusterE/F");
1321  tClusterEOverP[iCut]->Branch("ClusM02",&fClusterM02,"fClusterM02/F");
1322  tClusterEOverP[iCut]->Branch("ClusM20",&fClusterM20,"fClusterM20/F");
1323  tClusterEOverP[iCut]->Branch("ClusEP",&fClusterEP,"fClusterEP/F");
1324  tClusterEOverP[iCut]->Branch("ClusLeadCellID",&fClusterLeadCellID,"fClusterLeadCellID/I");
1325  if(fIsMC > 0) tClusterEOverP[iCut]->Branch("ClusClassification",&fClusterClassification,"fClusterClassification/I");
1326  tClusterEOverP[iCut]->Branch("ClusTrackDeltaEta",&fDeltaEta,"fDeltaEta/F");
1327  tClusterEOverP[iCut]->Branch("ClusTrackDeltaPhi",&fDeltaPhi,"fDeltaPhi/F");
1328  tClusterEOverP[iCut]->Branch("TrackPt",&fTrackPt,"fTrackPt/F");
1329  tClusterEOverP[iCut]->Branch("TrackPID_e",&fTrackPID_e,"fTrackPID_e/I");
1330  tClusterEOverP[iCut]->Branch("TrackPID_Pi",&fTrackPID_Pi,"fTrackPID_Pi/I");
1331  tClusterEOverP[iCut]->Branch("TrackPID_K",&fTrackPID_K,"fTrackPID_K/I");
1332  tClusterEOverP[iCut]->Branch("TrackPID_P",&fTrackPID_P,"fTrackPID_P/I");
1333  tClusterEOverP[iCut]->Branch("ClusIsoSumClusEt",&fClusterIsoSumClusterEt,"fClusterIsoSumClusterEt/F");
1334  tClusterEOverP[iCut]->Branch("ClusIsoSumTrackEt",&fClusterIsoSumTrackEt,"fClusterIsoSumTrackEt/F");
1335  fClusterTreeList[iCut]->Add(tClusterEOverP[iCut]);
1336  }
1337  }
1338  }
1339  if(fDoMesonAnalysis){
1340  InitBack(); // Init Background Handler
1341  }
1342 
1343  if(fIsMC> 0){
1344  // MC Histogramms
1345  fMCList = new TList*[fnCuts];
1346  // True Histogramms
1347  fTrueList = new TList*[fnCuts];
1348  // Selected Header List
1349  if (fDoMesonQA ==3){
1350  fTreeList = new TList*[fnCuts];
1352  }
1353 
1354  if(!fDoLightOutput){
1355  fHistoMCHeaders = new TH1I*[fnCuts];
1356  fHistoMCAllGammaPt = new TH1F*[fnCuts];
1358  fHistoMCDecayGammaPi0Pt = new TH1F*[fnCuts];
1359  fHistoMCDecayGammaRhoPt = new TH1F*[fnCuts];
1360  fHistoMCDecayGammaEtaPt = new TH1F*[fnCuts];
1361  fHistoMCDecayGammaOmegaPt = new TH1F*[fnCuts];
1362  fHistoMCDecayGammaEtapPt = new TH1F*[fnCuts];
1363  fHistoMCDecayGammaPhiPt = new TH1F*[fnCuts];
1364  fHistoMCDecayGammaSigmaPt = new TH1F*[fnCuts];
1367  if (fDoClusterQA > 1) {
1380  }
1381  }
1382 
1383  fHistoTrueClusGammaPt = new TH1F*[fnCuts];
1384  if(!fDoLightOutput){
1386  fHistoTruePrimaryClusGammaPt = new TH1F*[fnCuts];
1400  fHistoTrueNLabelsInClus = new TH1F*[fnCuts];
1401  }
1404 
1405 // fHistoTruePi0NonLinearity = new TH2F*[fnCuts];
1406 // fHistoTrueEtaNonLinearity = new TH2F*[fnCuts];
1407 
1408  if (fDoClusterQA > 0){
1409  fHistoTrueClusUnConvGammaPt = new TH1F*[fnCuts];
1411  if (!fDoLightOutput)
1413  fHistoTrueClusElectronPt = new TH1F*[fnCuts];
1414  fHistoTrueClusConvGammaPt = new TH1F*[fnCuts];
1415  fHistoTrueClusConvGammaMCPt = new TH1F*[fnCuts];
1417  fHistoTrueClusMergedGammaPt = new TH1F*[fnCuts];
1419  fHistoTrueClusDalitzPt = new TH1F*[fnCuts];
1420  fHistoTrueClusDalitzMergedPt = new TH1F*[fnCuts];
1422  fHistoTrueClusShowerPt = new TH1F*[fnCuts];
1423  fHistoTrueClusSubLeadingPt = new TH1F*[fnCuts];
1424  fHistoTrueClusNParticles = new TH1F*[fnCuts];
1425  fHistoTrueClusEMNonLeadingPt = new TH1F*[fnCuts];
1426  }
1427 
1428  if(fDoMesonAnalysis){
1429  fHistoMCPi0Pt = new TH1F*[fnCuts];
1430  fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
1431  fHistoMCEtaPt = new TH1F*[fnCuts];
1432  fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
1433  fHistoMCPi0InAccPt = new TH1F*[fnCuts];
1434  fHistoMCEtaInAccPt = new TH1F*[fnCuts];
1435 
1436  if (fIsMC > 1){
1437  fHistoMCPi0WOEvtWeightPt = new TH1F*[fnCuts];
1438  fHistoMCEtaWOEvtWeightPt = new TH1F*[fnCuts];
1441  }
1442 
1458  if(!fDoLightOutput){
1461  }
1465  fHistoMCSecPi0Source = new TH1F*[fnCuts];
1466  fHistoMCSecEtaPt = new TH1F*[fnCuts];
1467  fHistoMCSecEtaSource = new TH1F*[fnCuts];
1468 
1469  if (fDoMesonQA > 0 && fDoMesonQA < 3 ){
1470  fHistoMCPi0PtY = new TH2F*[fnCuts];
1471  fHistoMCEtaPtY = new TH2F*[fnCuts];
1472  fHistoMCPi0PtAlpha = new TH2F*[fnCuts];
1473  fHistoMCEtaPtAlpha = new TH2F*[fnCuts];
1474  if (fIsMC == 2){
1475  fHistoMCPi0PtJetPt = new TH2F*[fnCuts];
1476  fHistoMCEtaPtJetPt = new TH2F*[fnCuts];
1477  }
1478 
1479  if (fIsMC < 2){
1500  }
1501  fHistoTruePi0PtY = new TH2F*[fnCuts];
1502  fHistoTrueEtaPtY = new TH2F*[fnCuts];
1511  }
1512  if (fDoMesonQA==2){
1527  }
1528  }
1529 
1530 
1531 
1532  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1533  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
1534  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
1535  TString cutstringMeson = "NoMesonCut";
1536  if(fDoMesonAnalysis)
1537  cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
1538 
1539  fMCList[iCut] = new TList();
1540  fMCList[iCut]->SetName(Form("%s_%s_%s MC histograms", cutstringEvent.Data(), cutstringCalo.Data(), cutstringMeson.Data()));
1541  fMCList[iCut]->SetOwner(kTRUE);
1542  fCutFolder[iCut]->Add(fMCList[iCut]);
1543 
1544  if(!fDoLightOutput){
1545  fHistoMCHeaders[iCut] = new TH1I("MC_Headers", "MC_Headers", 20, 0, 20);
1546  fHistoMCHeaders[iCut]->SetXTitle("accepted headers");
1547  fMCList[iCut]->Add(fHistoMCHeaders[iCut]);
1548  fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt", "MC_AllGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1549  fHistoMCAllGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1550  fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
1551  fHistoMCAllSecondaryGammaPt[iCut] = new TH2F("MC_AllSecondaryGamma_Pt", "MC_AllSecondaryGamma_Pt", nBinsClusterPt, arrClusPtBinning, 5, -0.5, 4.5);
1552  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1553  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1554  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1555  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"Eta");
1556  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(5,"rest");
1557  fHistoMCAllSecondaryGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1558  fHistoMCAllSecondaryGammaPt[iCut]->SetYTitle("sec. particle");
1559  fMCList[iCut]->Add(fHistoMCAllSecondaryGammaPt[iCut]);
1560  fHistoMCDecayGammaPi0Pt[iCut] = new TH1F("MC_DecayGammaPi0_Pt", "MC_DecayGammaPi0_Pt", nBinsClusterPt, arrClusPtBinning);
1561  fHistoMCDecayGammaPi0Pt[iCut]->SetXTitle("p_{T} (GeV/c)");
1562  fMCList[iCut]->Add(fHistoMCDecayGammaPi0Pt[iCut]);
1563  fHistoMCDecayGammaRhoPt[iCut] = new TH1F("MC_DecayGammaRho_Pt", "MC_DecayGammaRho_Pt", nBinsClusterPt, arrClusPtBinning);
1564  fHistoMCDecayGammaRhoPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1565  fMCList[iCut]->Add(fHistoMCDecayGammaRhoPt[iCut]);
1566  fHistoMCDecayGammaEtaPt[iCut] = new TH1F("MC_DecayGammaEta_Pt", "MC_DecayGammaEta_Pt", nBinsClusterPt, arrClusPtBinning);
1567  fHistoMCDecayGammaEtaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1568  fMCList[iCut]->Add(fHistoMCDecayGammaEtaPt[iCut]);
1569  fHistoMCDecayGammaOmegaPt[iCut] = new TH1F("MC_DecayGammaOmega_Pt", "MC_DecayGammaOmmega_Pt", nBinsClusterPt, arrClusPtBinning);
1570  fHistoMCDecayGammaOmegaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1571  fMCList[iCut]->Add(fHistoMCDecayGammaOmegaPt[iCut]);
1572  fHistoMCDecayGammaEtapPt[iCut] = new TH1F("MC_DecayGammaEtap_Pt", "MC_DecayGammaEtap_Pt", nBinsClusterPt, arrClusPtBinning);
1573  fHistoMCDecayGammaEtapPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1574  fMCList[iCut]->Add(fHistoMCDecayGammaEtapPt[iCut]);
1575  fHistoMCDecayGammaPhiPt[iCut] = new TH1F("MC_DecayGammaPhi_Pt", "MC_DecayGammaPhi_Pt", nBinsClusterPt, arrClusPtBinning);
1576  fHistoMCDecayGammaPhiPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1577  fMCList[iCut]->Add(fHistoMCDecayGammaPhiPt[iCut]);
1578  fHistoMCDecayGammaSigmaPt[iCut] = new TH1F("MC_DecayGammaSigma_Pt", "MC_DecayGammaSigma_Pt", nBinsClusterPt, arrClusPtBinning);
1579  fHistoMCDecayGammaSigmaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1580  fMCList[iCut]->Add(fHistoMCDecayGammaSigmaPt[iCut]);
1581 
1582  if (fIsMC > 1){
1583  fHistoMCAllGammaPt[iCut]->Sumw2();
1584  fHistoMCAllSecondaryGammaPt[iCut]->Sumw2();
1585  fHistoMCDecayGammaPi0Pt[iCut]->Sumw2();
1586  fHistoMCDecayGammaRhoPt[iCut]->Sumw2();
1587  fHistoMCDecayGammaEtaPt[iCut]->Sumw2();
1588  fHistoMCDecayGammaOmegaPt[iCut]->Sumw2();
1589  fHistoMCDecayGammaEtapPt[iCut]->Sumw2();
1590  fHistoMCDecayGammaPhiPt[iCut]->Sumw2();
1591  fHistoMCDecayGammaSigmaPt[iCut]->Sumw2();
1592  }
1593  }
1594 
1595  if(fDoMesonAnalysis){
1596  fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt", "MC_Pi0_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1597  fHistoMCPi0Pt[iCut]->SetXTitle("p_{T} (GeV/c)");
1598  fHistoMCPi0Pt[iCut]->Sumw2();
1599  fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
1600  fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt", "MC_Pi0_WOWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1601  fHistoMCPi0WOWeightPt[iCut]->Sumw2();
1602  fHistoMCPi0WOWeightPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1603  fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
1604 
1605  fHistoMCEtaPt[iCut] = new TH1F("MC_Eta_Pt", "MC_Eta_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1606  fHistoMCEtaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1607  fHistoMCEtaPt[iCut]->Sumw2();
1608  fMCList[iCut]->Add(fHistoMCEtaPt[iCut]);
1609  fHistoMCEtaWOWeightPt[iCut] = new TH1F("MC_Eta_WOWeights_Pt", "MC_Eta_WOWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1610  fHistoMCEtaWOWeightPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1611  fHistoMCEtaWOWeightPt[iCut]->Sumw2();
1612  fMCList[iCut]->Add(fHistoMCEtaWOWeightPt[iCut]);
1613  fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt", "MC_Pi0InAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1614  fHistoMCPi0InAccPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1615  fHistoMCPi0InAccPt[iCut]->Sumw2();
1616  fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
1617  fHistoMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt", "MC_EtaInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1618  fHistoMCEtaInAccPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1619  fHistoMCEtaInAccPt[iCut]->Sumw2();
1620  fMCList[iCut]->Add(fHistoMCEtaInAccPt[iCut]);
1621  if (fIsMC > 1){
1622  fHistoMCPi0WOWeightPt[iCut]->Sumw2();
1623  fHistoMCEtaWOWeightPt[iCut]->Sumw2();
1624  fHistoMCPi0WOEvtWeightPt[iCut] = new TH1F("MC_Pi0_WOEventWeights_Pt", "MC_Pi0_WOEventWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1625  fHistoMCPi0WOEvtWeightPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1626  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightPt[iCut]);
1627  fHistoMCEtaWOEvtWeightPt[iCut] = new TH1F("MC_Eta_WOEventWeights_Pt", "MC_Eta_WOEventWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1628  fHistoMCEtaWOEvtWeightPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1629  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightPt[iCut]);
1630  fHistoMCPi0WOEvtWeightInAccPt[iCut] = new TH1F("MC_Pi0WOEvtWeightInAcc_Pt", "MC_Pi0WOEvtWeightInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1631  fHistoMCPi0WOEvtWeightInAccPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1632  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightInAccPt[iCut]);
1633  fHistoMCEtaWOEvtWeightInAccPt[iCut] = new TH1F("MC_EtaWOEvtWeightInAcc_Pt", "MC_EtaWOEvtWeightInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1634  fHistoMCEtaWOEvtWeightInAccPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1635  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightInAccPt[iCut]);
1636  if (fDoMesonQA > 0 && fDoMesonQA < 3 && fIsMC == 2){
1637  fHistoMCPi0PtJetPt[iCut] = new TH2F("MC_Pi0_Pt_JetPt", "MC_Pi0_Pt_JetPt", nBinsQAPt, arrQAPtBinning, 200, 0, 200);
1638  fHistoMCPi0PtJetPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1639  fHistoMCPi0PtJetPt[iCut]->SetYTitle("p_{jet, T} (GeV/c)");
1640  fHistoMCPi0PtJetPt[iCut]->Sumw2();
1641  fMCList[iCut]->Add(fHistoMCPi0PtJetPt[iCut]);
1642  fHistoMCEtaPtJetPt[iCut] = new TH2F("MC_Eta_Pt_JetPt", "MC_Eta_Pt_JetPt", nBinsQAPt, arrQAPtBinning, 200, 0, 200);
1643  fHistoMCEtaPtJetPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1644  fHistoMCEtaPtJetPt[iCut]->SetYTitle("p_{jet, T} (GeV/c)");
1645  fHistoMCEtaPtJetPt[iCut]->Sumw2();
1646  fMCList[iCut]->Add(fHistoMCEtaPtJetPt[iCut]);
1647  }
1648  }
1649 
1650  fHistoMCPrimaryPtvsSource[iCut] = new TH2F("MC_Primary_Pt_Source", "MC_Primary_Pt_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 7, -0.5, 6.5);
1651  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(1,"Pi+");
1652  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(2,"Pi-");
1653  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(3,"K+");
1654  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(4,"K-");
1655  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(5,"K0s");
1656  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(6,"K0l");
1657  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(7,"Lambda");
1658  fHistoMCPrimaryPtvsSource[iCut]->SetXTitle("p_{T} (GeV/c)");
1659  fHistoMCPrimaryPtvsSource[iCut]->SetYTitle("particle");
1660  fMCList[iCut]->Add(fHistoMCPrimaryPtvsSource[iCut]);
1661 
1662  fHistoMCSecPi0Source[iCut] = new TH1F("MC_SecPi0_Source", "MC_SecPi0_Source", 5000, 0., 5000);
1663  fHistoMCSecPi0Source[iCut]->SetYTitle("source PDG");
1664  fMCList[iCut]->Add(fHistoMCSecPi0Source[iCut]);
1665  fHistoMCSecEtaSource[iCut] = new TH1F("MC_SecEta_Source", "MC_SecEta_Source", 5000, 0, 5000);
1666  fHistoMCSecEtaSource[iCut]->SetYTitle("source PDG");
1667  fMCList[iCut]->Add(fHistoMCSecEtaSource[iCut]);
1668  fHistoMCSecPi0PtvsSource[iCut] = new TH2F("MC_SecPi0_Pt_Source", "MC_SecPi0_Pt_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1669  fHistoMCSecPi0PtvsSource[iCut]->SetXTitle("p_{T} (GeV/c)");
1670  fHistoMCSecPi0PtvsSource[iCut]->SetYTitle("source");
1671  fMCList[iCut]->Add(fHistoMCSecPi0PtvsSource[iCut]);
1672  fHistoMCSecPi0InAccPtvsSource[iCut] = new TH2F("MC_SecPi0InAcc_Pt_Source", "MC_SecPi0InAcc_Pt_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1673  fHistoMCSecPi0InAccPtvsSource[iCut]->SetXTitle("p_{T} (GeV/c)");
1674  fHistoMCSecPi0InAccPtvsSource[iCut]->SetYTitle("source");
1675  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtvsSource[iCut]);
1676  fHistoMCSecEtaPt[iCut] = new TH1F("MC_SecEta_Pt", "MC_SecEta_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1677  fHistoMCSecEtaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1678  fMCList[iCut]->Add(fHistoMCSecEtaPt[iCut]);
1679  if (fIsMC == 2) {
1680  fHistoMCPrimaryPtvsSource[iCut]->Sumw2();
1681  fHistoMCSecPi0PtvsSource[iCut]->Sumw2();
1682  fHistoMCSecPi0InAccPtvsSource[iCut]->Sumw2();
1683  fHistoMCSecEtaPt[iCut]->Sumw2();
1684  }
1685 
1686 
1687  if (fDoMesonQA > 0 && fDoMesonQA < 3){
1688  fHistoMCPi0PtY[iCut] = new TH2F("MC_Pi0_Pt_Y", "MC_Pi0_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1689  fHistoMCPi0PtY[iCut]->SetXTitle("p_{T} (GeV/c)");
1690  fHistoMCPi0PtY[iCut]->SetYTitle("y");
1691  fHistoMCPi0PtY[iCut]->Sumw2();
1692  fMCList[iCut]->Add(fHistoMCPi0PtY[iCut]);
1693  fHistoMCEtaPtY[iCut] = new TH2F("MC_Eta_Pt_Y", "MC_Eta_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1694  fHistoMCEtaPtY[iCut]->SetXTitle("p_{T} (GeV/c)");
1695  fHistoMCEtaPtY[iCut]->SetYTitle("y");
1696  fHistoMCEtaPtY[iCut]->Sumw2();
1697  fMCList[iCut]->Add(fHistoMCEtaPtY[iCut]);
1698  fHistoMCPi0PtAlpha[iCut] = new TH2F("MC_Pi0_Pt_Alpha", "MC_Pi0_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
1699  fHistoMCPi0PtAlpha[iCut]->SetXTitle("p_{T} (GeV/c)");
1700  fHistoMCPi0PtAlpha[iCut]->SetYTitle("#alpha");
1701  fMCList[iCut]->Add(fHistoMCPi0PtAlpha[iCut]);
1702  fHistoMCEtaPtAlpha[iCut] = new TH2F("MC_Eta_Pt_Alpha", "MC_Eta_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
1703  fHistoMCEtaPtAlpha[iCut]->SetXTitle("p_{T} (GeV/c)");
1704  fHistoMCEtaPtAlpha[iCut]->SetYTitle("#alpha");
1705  fMCList[iCut]->Add(fHistoMCEtaPtAlpha[iCut]);
1706 
1707  if (fIsMC == 2) {
1708  fHistoMCPi0PtAlpha[iCut]->Sumw2();
1709  fHistoMCEtaPtAlpha[iCut]->Sumw2();
1710  }
1711  }
1712  }
1713  fTrueList[iCut] = new TList();
1714  fTrueList[iCut]->SetName(Form("%s_%s_%s True histograms", cutstringEvent.Data(), cutstringCalo.Data(), cutstringMeson.Data()));
1715  fTrueList[iCut]->SetOwner(kTRUE);
1716  fCutFolder[iCut]->Add(fTrueList[iCut]);
1717 
1718  if(!fDoLightOutput){
1719  fHistoClusPhotonBGPt[iCut] = new TH2F("ESD_TrueClusPhotonBG_Pt", "ESD_TrueClusPhotonBG_Pt", nBinsClusterPt, arrClusPtBinning,10,-0.5,9.5);
1720  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec");
1721  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 2,"Pion");
1722  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 3,"Proton");
1723  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 4,"Kaon");
1724  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 5,"Neutron");
1725  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 6,"K0s");
1726  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 7,"Lambda");
1727  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 8,"Muon");
1728  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 9,"K0l");
1729  fHistoClusPhotonBGPt[iCut]->GetYaxis()->SetBinLabel( 10,"Rest");
1730  fHistoClusPhotonBGPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1731  fHistoClusPhotonBGPt[iCut]->SetYTitle("source");
1732  fTrueList[iCut]->Add(fHistoClusPhotonBGPt[iCut]);
1733  fHistoClusPhotonPlusConvBGPt[iCut] = new TH2F("ESD_TrueClusPhotonPlusConvBG_Pt", "ESD_TrueClusPhotonPlusConvBG_Pt", nBinsClusterPt, arrClusPtBinning,10,-0.5,9.5);
1734  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec");
1735  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 2,"Pion");
1736  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 3,"Proton");
1737  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 4,"Kaon");
1738  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 5,"Neutron");
1739  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 6,"K0s");
1740  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 7,"Lambda");
1741  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 8,"Muon");
1742  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel( 9,"K0l");
1743  fHistoClusPhotonPlusConvBGPt[iCut]->GetYaxis()->SetBinLabel(10,"Rest");
1744  fHistoClusPhotonPlusConvBGPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1745  fHistoClusPhotonPlusConvBGPt[iCut]->SetYTitle("source");
1746  fTrueList[iCut]->Add(fHistoClusPhotonPlusConvBGPt[iCut]);
1747 
1748  if (fDoClusterQA > 1) {
1749  fHistoClustPhotonElectronBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonElectronBG_Pt_M02", "ESD_TrueClusPhotonElectronBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1750  fHistoClustPhotonElectronBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1751  fHistoClustPhotonElectronBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1752  fTrueList[iCut]->Add(fHistoClustPhotonElectronBGPtM02[iCut]);
1753  fHistoClustPhotonPionBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonPionBG_Pt_M02", "ESD_TrueClusPhotonPionBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1754  fHistoClustPhotonPionBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1755  fHistoClustPhotonPionBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1756  fTrueList[iCut]->Add(fHistoClustPhotonPionBGPtM02[iCut]);
1757  fHistoClustPhotonKaonBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonKaonBG_Pt_M02", "ESD_TrueClusPhotonKaonBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1758  fHistoClustPhotonKaonBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1759  fHistoClustPhotonKaonBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1760  fTrueList[iCut]->Add(fHistoClustPhotonKaonBGPtM02[iCut]);
1761  fHistoClustPhotonK0lBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonK0lBG_Pt_M02", "ESD_TrueClusPhotonK0lBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1762  fHistoClustPhotonK0lBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1763  fHistoClustPhotonK0lBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1764  fTrueList[iCut]->Add(fHistoClustPhotonK0lBGPtM02[iCut]);
1765  fHistoClustPhotonNeutronBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonNeutronBG_Pt_M02", "ESD_TrueClusPhotonNeutronBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1766  fHistoClustPhotonNeutronBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1767  fHistoClustPhotonNeutronBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1768  fTrueList[iCut]->Add(fHistoClustPhotonNeutronBGPtM02[iCut]);
1769  fHistoClustPhotonRestBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonRestBG_Pt_M02", "ESD_TrueClusPhotonRestBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1770  fHistoClustPhotonRestBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1771  fHistoClustPhotonRestBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1772  fTrueList[iCut]->Add(fHistoClustPhotonRestBGPtM02[iCut]);
1773  fHistoClustPhotonPlusConvElectronBGPtM02[iCut]= new TH2F("ESD_TrueClusPhotonPlusConvElectronBG_Pt_M02", "ESD_TrueClusPhotonPlusConvElectronBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1774  fHistoClustPhotonPlusConvElectronBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1775  fHistoClustPhotonPlusConvElectronBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1777  fHistoClustPhotonPlusConvPionBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonPlusConvPionBG_Pt_M02", "ESD_TrueClusPhotonPlusConvPionBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1778  fHistoClustPhotonPlusConvPionBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1779  fHistoClustPhotonPlusConvPionBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1781  fHistoClustPhotonPlusConvKaonBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonPlusConvKaonBG_Pt_M02", "ESD_TrueClusPhotonPlusConvKaonBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1782  fHistoClustPhotonPlusConvKaonBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1783  fHistoClustPhotonPlusConvKaonBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1785  fHistoClustPhotonPlusConvK0lBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonPlusConvK0lBG_Pt_M02", "ESD_TrueClusPhotonPlusConvK0lBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1786  fHistoClustPhotonPlusConvK0lBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1787  fHistoClustPhotonPlusConvK0lBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1789  fHistoClustPhotonPlusConvNeutronBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonPlusConvNeutronBG_Pt_M02", "ESD_TrueClusPhotonPlusConvNeutronBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1790  fHistoClustPhotonPlusConvNeutronBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1791  fHistoClustPhotonPlusConvNeutronBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1793  fHistoClustPhotonPlusConvRestBGPtM02[iCut] = new TH2F("ESD_TrueClusPhotonPlusConvRestBG_Pt_M02", "ESD_TrueClusPhotonPlusConvRestBG_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1794  fHistoClustPhotonPlusConvRestBGPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1795  fHistoClustPhotonPlusConvRestBGPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1797  }
1798  }
1799 
1800  fHistoTrueClusGammaPt[iCut] = new TH1F("TrueClusGamma_Pt", "ESD_TrueClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1801  fHistoTrueClusGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1802  fTrueList[iCut]->Add(fHistoTrueClusGammaPt[iCut]);
1803  if(!fDoLightOutput){
1804  if (fDoClusterQA > 0) {
1805  fHistoTrueClusGammaPtM02[iCut] = new TH2F("TrueClusGamma_Pt_M02", "TrueClusGamma_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1806  fHistoTrueClusGammaPtM02[iCut]->SetXTitle("p_{T} (GeV/c)");
1807  fHistoTrueClusGammaPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1808  fTrueList[iCut]->Add(fHistoTrueClusGammaPtM02[iCut]);
1809  }
1810  fHistoTruePrimaryClusGammaPt[iCut] = new TH1F("TruePrimaryClusGamma_Pt", "ESD_TruePrimaryClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1811  fHistoTruePrimaryClusGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1812  fTrueList[iCut]->Add(fHistoTruePrimaryClusGammaPt[iCut]);
1813  fHistoTruePrimaryClusGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusGamma_Pt_MCPt", "ESD_TruePrimaryClusGamma_MCPt", nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1814  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1815  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->SetYTitle("p_{T, MC} (GeV/c)");
1817  fHistoTruePrimaryClusConvGammaPt[iCut] = new TH1F("TruePrimaryClusConvGamma_Pt", "ESD_TruePrimaryClusConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1818  fHistoTruePrimaryClusConvGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1819  fTrueList[iCut]->Add(fHistoTruePrimaryClusConvGammaPt[iCut]);
1820  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusConvGamma_Pt_MCPt", "ESD_TruePrimaryClusConvGamma_MCPt", nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1821  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1822  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut]->SetYTitle("p_{T, MC} (GeV/c)");
1824  fHistoTrueSecondaryClusGammaPt[iCut] = new TH2F("ESD_TrueSecondaryClusGamma_Pt", "ESD_TrueSecondaryClusGamma_Pt", nBinsClusterPt, arrClusPtBinning, 5, -0.5, 4.5);
1825  fHistoTrueSecondaryClusGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1826  fHistoTrueSecondaryClusGammaPt[iCut]->SetYTitle("source");
1827  fHistoTrueSecondaryClusGammaPt[iCut]->GetYaxis()->SetBinLabel( 1,"K0s");
1828  fHistoTrueSecondaryClusGammaPt[iCut]->GetYaxis()->SetBinLabel( 2,"K0l");
1829  fHistoTrueSecondaryClusGammaPt[iCut]->GetYaxis()->SetBinLabel( 3,"Lambda");
1830  fHistoTrueSecondaryClusGammaPt[iCut]->GetYaxis()->SetBinLabel( 4,"Eta");
1831  fHistoTrueSecondaryClusGammaPt[iCut]->GetYaxis()->SetBinLabel( 5,"rest");
1832  fTrueList[iCut]->Add(fHistoTrueSecondaryClusGammaPt[iCut]);
1833  fHistoTrueSecondaryClusConvGammaPt[iCut] = new TH2F("ESD_TrueSecondaryClusConvGamma_Pt", "ESD_TrueSecondaryClusConvGamma_Pt", nBinsClusterPt, arrClusPtBinning, 5, -0.5, 4.5);
1834  fHistoTrueSecondaryClusConvGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1835  fHistoTrueSecondaryClusConvGammaPt[iCut]->SetYTitle("source");
1836  fHistoTrueSecondaryClusConvGammaPt[iCut]->GetYaxis()->SetBinLabel( 1,"K0s");
1837  fHistoTrueSecondaryClusConvGammaPt[iCut]->GetYaxis()->SetBinLabel( 2,"K0l");
1838  fHistoTrueSecondaryClusConvGammaPt[iCut]->GetYaxis()->SetBinLabel( 3,"Lambda");
1839  fHistoTrueSecondaryClusConvGammaPt[iCut]->GetYaxis()->SetBinLabel( 4,"Eta");
1840  fHistoTrueSecondaryClusConvGammaPt[iCut]->GetYaxis()->SetBinLabel( 5,"rest");
1842  fHistoTrueSecondaryClusGammaMCPt[iCut] = new TH2F("ESD_TrueSecondaryClusGamma_MCPt", "ESD_TrueSecondaryClusGamma_MCPt", nBinsClusterPt, arrClusPtBinning, 5, -0.5, 4.5);
1843  fHistoTrueSecondaryClusGammaMCPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1844  fHistoTrueSecondaryClusGammaMCPt[iCut]->SetYTitle("source");
1845  fHistoTrueSecondaryClusGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 1,"K0s");
1846  fHistoTrueSecondaryClusGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 2,"K0l");
1847  fHistoTrueSecondaryClusGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 3,"Lambda");
1848  fHistoTrueSecondaryClusGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 4,"Eta");
1849  fHistoTrueSecondaryClusGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 5,"rest");
1850  fTrueList[iCut]->Add(fHistoTrueSecondaryClusGammaMCPt[iCut]);
1851  fHistoTrueSecondaryClusConvGammaMCPt[iCut] = new TH2F("ESD_TrueSecondaryClusConvGamma_MCPt", "ESD_TrueSecondaryClusConvGamma_MCPt", nBinsClusterPt, arrClusPtBinning, 5, -0.5, 4.5);
1852  fHistoTrueSecondaryClusConvGammaMCPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1853  fHistoTrueSecondaryClusConvGammaMCPt[iCut]->SetYTitle("source");
1854  fHistoTrueSecondaryClusConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 1,"K0s");
1855  fHistoTrueSecondaryClusConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 2,"K0l");
1856  fHistoTrueSecondaryClusConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 3,"Lambda");
1857  fHistoTrueSecondaryClusConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 4,"Eta");
1858  fHistoTrueSecondaryClusConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel( 5,"rest");
1860 
1861  fHistoTrueSecondaryClusGammaFromXFromK0sMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryClusGammaFromXFromK0s_MCPt_Pt", "ESD_TrueSecondaryClusGammaFromXFromK0s_MCPt_Pt",
1862  nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1863  fHistoTrueSecondaryClusGammaFromXFromK0sMCPtESDPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1864  fHistoTrueSecondaryClusGammaFromXFromK0sMCPtESDPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1866  fHistoTrueSecondaryClusConvGammaFromXFromK0sMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryClusConvGammaFromXFromK0s_MCPt_Pt", "ESD_TrueSecondaryClusConvGammaFromXFromK0s_MCPt_Pt",
1867  nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1868  fHistoTrueSecondaryClusConvGammaFromXFromK0sMCPtESDPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1869  fHistoTrueSecondaryClusConvGammaFromXFromK0sMCPtESDPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1871  fHistoTrueSecondaryClusGammaFromXFromK0lMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryClusGammaFromXFromK0l_MCPt_Pt", "ESD_TrueSecondaryClusGammaFromXFromK0l_MCPt_Pt",
1872  nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1873  fHistoTrueSecondaryClusGammaFromXFromK0lMCPtESDPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1874  fHistoTrueSecondaryClusGammaFromXFromK0lMCPtESDPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1876  fHistoTrueSecondaryClusConvGammaFromXFromK0lMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryClusConvGammaFromXFromK0l_MCPt_Pt", "ESD_TrueSecondaryClusConvGammaFromXFromK0l_MCPt_Pt",
1877  nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1878  fHistoTrueSecondaryClusConvGammaFromXFromK0lMCPtESDPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1879  fHistoTrueSecondaryClusConvGammaFromXFromK0lMCPtESDPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1881  fHistoTrueSecondaryClusGammaFromXFromLambdaMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryClusGammaFromXFromLambda_MCPt_Pt", "ESD_TrueSecondaryClusGammaFromXFromLambda_MCPt_Pt",
1882  nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1883  fHistoTrueSecondaryClusGammaFromXFromLambdaMCPtESDPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1884  fHistoTrueSecondaryClusGammaFromXFromLambdaMCPtESDPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1886  fHistoTrueSecondaryClusConvGammaFromXFromLambdaMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryClusConvGammaFromXFromLambda_MCPt_Pt", "ESD_TrueSecondaryClusConvGammaFromXFromLambda_MCPt_Pt",
1887  nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1888  fHistoTrueSecondaryClusConvGammaFromXFromLambdaMCPtESDPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1889  fHistoTrueSecondaryClusConvGammaFromXFromLambdaMCPtESDPt[iCut]->SetYTitle("p_{T} (GeV/c)");
1891 
1892  fHistoTrueNLabelsInClus[iCut] = new TH1F("TrueNLabelsInClus", "TrueNLabelsInClus", 100, -0.5, 99.5);
1893  fHistoTrueNLabelsInClus[iCut]->SetXTitle("# labels");
1894  fTrueList[iCut]->Add(fHistoTrueNLabelsInClus[iCut]);
1895  }
1896 
1897  fHistoDoubleCountTrueClusterGammaPt[iCut] = new TH2F("TrueDoubleCountClusterGamma_Pt", "TrueDoubleCountClusterGamma_Pt", nBinsClusterPt, arrClusPtBinning, 2, 0, 2);
1898  fHistoDoubleCountTrueClusterGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1900  fHistoMultipleCountTrueClusterGamma[iCut] = new TH1F("TrueMultipleCountClusterGamma", "TrueMultipleCountClusterGamma", 10, 1, 11);
1901  fHistoMultipleCountTrueClusterGamma[iCut]->SetXTitle("# multiple");
1903 
1904  if (fIsMC > 1){
1905  fHistoTrueClusGammaPt[iCut]->Sumw2();
1906  fHistoDoubleCountTrueClusterGammaPt[iCut]->Sumw2();
1907  fHistoMultipleCountTrueClusterGamma[iCut]->Sumw2();
1908  if(!fDoLightOutput){
1909  fHistoTrueNLabelsInClus[iCut]->Sumw2();
1910  if (fDoClusterQA > 0) fHistoTrueClusGammaPtM02[iCut]->Sumw2();
1911  fHistoTruePrimaryClusGammaPt[iCut]->Sumw2();
1912  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->Sumw2();
1913  fHistoTruePrimaryClusConvGammaPt[iCut]->Sumw2();
1915  fHistoTrueSecondaryClusGammaPt[iCut]->Sumw2();
1916  fHistoTrueSecondaryClusConvGammaPt[iCut]->Sumw2();
1917  fHistoTrueSecondaryClusGammaMCPt[iCut]->Sumw2();
1918  fHistoTrueSecondaryClusConvGammaMCPt[iCut]->Sumw2();
1925  }
1926  }
1927 
1928  if (fDoClusterQA > 0){
1929  fHistoTrueClusUnConvGammaPt[iCut] = new TH1F("TrueClusUnConvGamma_Pt", "TrueClusUnConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1930  fHistoTrueClusUnConvGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1931  fTrueList[iCut]->Add(fHistoTrueClusUnConvGammaPt[iCut]);
1932  fHistoTrueClusUnConvGammaMCPt[iCut] = new TH1F("TrueClusUnConvGamma_MCPt", "TrueClusUnConvGamma_MCPt", nBinsClusterPt, arrClusPtBinning);
1933  fHistoTrueClusUnConvGammaMCPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1934  fTrueList[iCut]->Add(fHistoTrueClusUnConvGammaMCPt[iCut]);
1935  if (!fDoLightOutput) {
1936  fHistoTrueClusUnConvGammaPtM02[iCut] = new TH2F("TrueClusUnConvGamma_Pt_M02", "TrueClusUnConvGamma_Pt_M02", nBinsClusterPt, arrClusPtBinning, 100, 0, 1);
1937  fHistoTrueClusUnConvGammaPtM02[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1938  fHistoTrueClusUnConvGammaPtM02[iCut]->SetYTitle("#sigma_{long}^{2}");
1939  fTrueList[iCut]->Add(fHistoTrueClusUnConvGammaPtM02[iCut]);
1940  }
1941  fHistoTrueClusElectronPt[iCut] = new TH1F("TrueClusElectron_Pt", "TrueElectronGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1942  fHistoTrueClusElectronPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1943  fTrueList[iCut]->Add(fHistoTrueClusElectronPt[iCut]);
1944  fHistoTrueClusConvGammaPt[iCut] = new TH1F("TrueClusConvGamma_Pt", "TrueClusConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1945  fHistoTrueClusConvGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1946  fTrueList[iCut]->Add(fHistoTrueClusConvGammaPt[iCut]);
1947  fHistoTrueClusConvGammaMCPt[iCut] = new TH1F("TrueClusConvGamma_MCPt", "TrueClusConvGamma_MCPt", nBinsClusterPt, arrClusPtBinning);
1948  fHistoTrueClusConvGammaMCPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
1949  fTrueList[iCut]->Add(fHistoTrueClusConvGammaMCPt[iCut]);
1950  fHistoTrueClusConvGammaFullyPt[iCut] = new TH1F("TrueClusConvGammaFullyContained_Pt", "TrueClusConvGammaFullyContained_Pt", nBinsClusterPt, arrClusPtBinning);
1951  fHistoTrueClusConvGammaFullyPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1952  fTrueList[iCut]->Add(fHistoTrueClusConvGammaFullyPt[iCut]);
1953  fHistoTrueClusMergedGammaPt[iCut] = new TH1F("TrueClusMergedGamma_Pt", "TrueClusMergedGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1954  fHistoTrueClusMergedGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1955  fTrueList[iCut]->Add(fHistoTrueClusMergedGammaPt[iCut]);
1956  fHistoTrueClusMergedPartConvGammaPt[iCut] = new TH1F("TrueClusMergedPartConvGamma_Pt", "TrueClusMergedPartConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1957  fHistoTrueClusMergedPartConvGammaPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1959  fHistoTrueClusDalitzPt[iCut] = new TH1F("TrueClusDalitz_Pt", "TrueClusDalitz_Pt", nBinsClusterPt, arrClusPtBinning);
1960  fHistoTrueClusDalitzPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1961  fTrueList[iCut]->Add(fHistoTrueClusDalitzPt[iCut]);
1962  fHistoTrueClusDalitzMergedPt[iCut] = new TH1F("TrueClusDalitzMerged_Pt", "TrueClusDalitzMerged_Pt", nBinsClusterPt, arrClusPtBinning);
1963  fHistoTrueClusDalitzMergedPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1964  fTrueList[iCut]->Add(fHistoTrueClusDalitzMergedPt[iCut]);
1965  fHistoTrueClusPhotonFromElecMotherPt[iCut] = new TH1F("TrueClusPhotonFromElecMother_Pt", "TrueClusPhotonFromElecMother_Pt", nBinsClusterPt, arrClusPtBinning);
1966  fHistoTrueClusPhotonFromElecMotherPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1968  fHistoTrueClusShowerPt[iCut] = new TH1F("TrueClusShower_Pt", "TrueClusShower_Pt", nBinsClusterPt, arrClusPtBinning);
1969  fHistoTrueClusShowerPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1970  fTrueList[iCut]->Add(fHistoTrueClusShowerPt[iCut]);
1971  fHistoTrueClusSubLeadingPt[iCut] = new TH1F("TrueClusSubleading_Pt", "TrueClusSubleading_Pt", nBinsClusterPt, arrClusPtBinning);
1972  fHistoTrueClusSubLeadingPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1973  fTrueList[iCut]->Add(fHistoTrueClusSubLeadingPt[iCut]);
1974  fHistoTrueClusNParticles[iCut] = new TH1F("TrueClusNParticles", "TrueClusNParticles", 20, 0, 20);
1975  fHistoTrueClusNParticles[iCut]->SetXTitle("#particles");
1976  fTrueList[iCut]->Add(fHistoTrueClusNParticles[iCut]);
1977  fHistoTrueClusEMNonLeadingPt[iCut] = new TH1F("TrueClusEMNonLeading_Pt", "TrueClusEMNonLeading_Pt", nBinsClusterPt, arrClusPtBinning);
1978  fHistoTrueClusEMNonLeadingPt[iCut]->SetXTitle("p_{T} (GeV/c)");
1979  fTrueList[iCut]->Add(fHistoTrueClusEMNonLeadingPt[iCut]);
1980 
1981  if (fIsMC > 1){
1982  fHistoTrueClusUnConvGammaPt[iCut]->Sumw2();
1983  fHistoTrueClusUnConvGammaMCPt[iCut]->Sumw2();
1984  if (!fDoLightOutput)
1985  fHistoTrueClusUnConvGammaPtM02[iCut]->Sumw2();
1986  fHistoTrueClusElectronPt[iCut]->Sumw2();
1987  fHistoTrueClusConvGammaPt[iCut]->Sumw2();
1988  fHistoTrueClusConvGammaMCPt[iCut]->Sumw2();
1989  fHistoTrueClusConvGammaFullyPt[iCut]->Sumw2();
1990  fHistoTrueClusMergedGammaPt[iCut]->Sumw2();
1991  fHistoTrueClusMergedPartConvGammaPt[iCut]->Sumw2();
1992  fHistoTrueClusDalitzPt[iCut]->Sumw2();
1993  fHistoTrueClusDalitzMergedPt[iCut]->Sumw2();
1994  fHistoTrueClusPhotonFromElecMotherPt[iCut]->Sumw2();
1995  fHistoTrueClusShowerPt[iCut]->Sumw2();
1996  fHistoTrueClusSubLeadingPt[iCut]->Sumw2();
1997  fHistoTrueClusNParticles[iCut]->Sumw2();
1998  fHistoTrueClusEMNonLeadingPt[iCut]->Sumw2();
1999  }
2000  }
2001 
2002  if(fDoMesonAnalysis){
2003  fHistoTruePi0InvMassPt[iCut] = new TH2F("ESD_TruePi0_InvMass_Pt", "ESD_TruePi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2004  fHistoTruePi0InvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2005  fHistoTruePi0InvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2006  fTrueList[iCut]->Add(fHistoTruePi0InvMassPt[iCut]);
2007  fHistoTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueEta_InvMass_Pt", "ESD_TrueEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2008  fHistoTrueEtaInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2009  fHistoTrueEtaInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2010  fTrueList[iCut]->Add(fHistoTrueEtaInvMassPt[iCut]);
2011 
2012  fHistoDoubleCountTruePi0InvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountPi0_InvMass_Pt", "ESD_TrueDoubleCountPi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2013  fHistoDoubleCountTruePi0InvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2014  fHistoDoubleCountTruePi0InvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2015  fTrueList[iCut]->Add(fHistoDoubleCountTruePi0InvMassPt[iCut]);
2016  fHistoDoubleCountTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountEta_InvMass_Pt", "ESD_TrueDoubleCountEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2017  fHistoDoubleCountTrueEtaInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2018  fHistoDoubleCountTrueEtaInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2019  fTrueList[iCut]->Add(fHistoDoubleCountTrueEtaInvMassPt[iCut]);
2020 
2021  fHistoTruePrimaryPi0InvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_Pt", "ESD_TruePrimaryPi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2022  fHistoTruePrimaryPi0InvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2023  fHistoTruePrimaryPi0InvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2024  fHistoTruePrimaryPi0InvMassPt[iCut]->Sumw2();
2025  fTrueList[iCut]->Add(fHistoTruePrimaryPi0InvMassPt[iCut]);
2026  fHistoTruePrimaryEtaInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEta_InvMass_Pt", "ESD_TruePrimaryEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2027  fHistoTruePrimaryEtaInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2028  fHistoTruePrimaryEtaInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2029  fHistoTruePrimaryEtaInvMassPt[iCut]->Sumw2();
2030  fTrueList[iCut]->Add(fHistoTruePrimaryEtaInvMassPt[iCut]);
2031 
2032  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt", "ESD_TruePrimaryPi0W0Weights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2033  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2034  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2037  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEtaW0Weights_InvMass_Pt", "ESD_TruePrimaryEtaW0Weights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2038  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2039  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2042 
2043  fProfileTruePrimaryPi0WeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryPi0Weights_InvMass_Pt", "ESD_TruePrimaryPi0Weights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2044  fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2045  fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2048  fProfileTruePrimaryEtaWeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryEtaWeights_InvMass_Pt", "ESD_TruePrimaryEtaWeights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2049  fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2050  fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2053 
2054  fHistoTrueSecondaryPi0InvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_Pt", "ESD_TrueSecondaryPi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2055  fHistoTrueSecondaryPi0InvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2056  fHistoTrueSecondaryPi0InvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2057  fHistoTrueSecondaryPi0InvMassPt[iCut]->Sumw2();
2058  fTrueList[iCut]->Add(fHistoTrueSecondaryPi0InvMassPt[iCut]);
2059 
2060  if(!fDoLightOutput){
2061  fHistoTruePi0InvMassPtAlpha[iCut] = new TH2F("ESD_TruePi0_InvMass_vs_Pt_Alpha", "ESD_TruePi0_InvMass_vs_Pt_Alpha", 800, 0, 0.8, nBinsPt, arrPtBinning);
2062  fHistoTruePi0InvMassPtAlpha[iCut]->SetYTitle("p_{T} (GeV/c)");
2063  fHistoTruePi0InvMassPtAlpha[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2064  fHistoTruePi0InvMassPtAlpha[iCut]->Sumw2();
2065  fESDList[iCut]->Add(fHistoTruePi0InvMassPtAlpha[iCut]);
2066  fHistoTruePi0PureGammaInvMassPtAlpha[iCut] = new TH2F("ESD_TruePi0PureGamma_InvMass_vs_Pt_Alpha", "ESD_TruePi0PureGamma_InvMass_vs_Pt_Alpha", 800, 0, 0.8, nBinsPt, arrPtBinning);
2067  fHistoTruePi0PureGammaInvMassPtAlpha[iCut]->SetYTitle("p_{T} (GeV/c)");
2068  fHistoTruePi0PureGammaInvMassPtAlpha[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2069  fHistoTruePi0PureGammaInvMassPtAlpha[iCut]->Sumw2();
2071  }
2072 
2073  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_Pt", "ESD_TrueSecondaryPi0FromK0s_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2074  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2075  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2078  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0l_InvMass_Pt", "ESD_TrueSecondaryPi0FromK0l_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2079  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2080  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2083  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromEta_InvMass_Pt", "ESD_TrueSecondaryPi0FromEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2084  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2085  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2087  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_Pt", "ESD_TrueSecondaryPi0FromLambda_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2088  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2089  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2091 
2092  if (fIsMC > 1){
2093  fHistoTruePi0InvMassPt[iCut]->Sumw2();
2094  fHistoTrueEtaInvMassPt[iCut]->Sumw2();
2095  fHistoDoubleCountTruePi0InvMassPt[iCut]->Sumw2();
2096  fHistoDoubleCountTrueEtaInvMassPt[iCut]->Sumw2();
2101  }
2102 
2103 
2104  if (fDoMesonQA > 0 && fDoMesonQA < 3){
2105  if (fIsMC < 2){
2106 
2107  fHistoTruePi0CaloPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloPhoton_InvMass_Pt", "ESD_TruePi0CaloPhoton_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2108  fHistoTruePi0CaloPhotonInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2109  fHistoTruePi0CaloPhotonInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2110  fTrueList[iCut]->Add(fHistoTruePi0CaloPhotonInvMassPt[iCut]);
2111  fHistoTrueEtaCaloPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloPhoton_InvMass_Pt", "ESD_TrueEtaCaloPhoton_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2112  fHistoTrueEtaCaloPhotonInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2113  fHistoTrueEtaCaloPhotonInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2114  fTrueList[iCut]->Add(fHistoTrueEtaCaloPhotonInvMassPt[iCut]);
2115 
2116  fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMixedPhotonConvertedPhoton_InvMass_Pt", "ESD_TruePi0CaloMixedPhotonConvertedPhoton_InvMass_Pt", 800, 0, 0.8,
2117  nBinsPt, arrPtBinning);
2118  fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2119  fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2121  fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMixedPhotonConvertedPhoton_InvMass_Pt", "ESD_TrueEtaCaloMixedPhotonConvertedPhoton_InvMass_Pt", 800, 0, 0.8,
2122  nBinsPt, arrPtBinning);
2123  fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2124  fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2126 
2127  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhoton_InvMass_Pt", "ESD_TruePi0CaloConvertedPhoton_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2128  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2129  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2131  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt", "ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2132  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2133  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2135 
2136  fHistoTruePi0CaloElectronInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloElectron_InvMass_Pt", "ESD_TruePi0CaloElectron_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2137  fHistoTruePi0CaloElectronInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2138  fHistoTruePi0CaloElectronInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2140  fHistoTrueEtaCaloElectronInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloElectron_InvMass_Pt", "ESD_TrueEtaCaloElectron_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2141  fHistoTrueEtaCaloElectronInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2142  fHistoTrueEtaCaloElectronInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2144 
2145  fHistoTruePi0CaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedCluster_InvMass_Pt", "ESD_TruePi0CaloMergedCluster_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2146  fHistoTruePi0CaloMergedClusterInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2147  fHistoTruePi0CaloMergedClusterInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2149  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedCluster_InvMass_Pt", "ESD_TrueEtaCaloMergedCluster_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2150  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2151  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2153 
2154  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt", "ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt", 800, 0, 0.8,
2155  nBinsPt, arrPtBinning);
2156  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2157  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2159  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt", "ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt", 800, 0, 0.8,
2160  nBinsPt, arrPtBinning);
2161  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2162  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2164 
2165  fHistoTruePi0NonMergedElectronPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0NonMergedElectronPhoton_InvMass_Pt", "ESD_TruePi0NonMergedElectronPhoton_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2166  fHistoTruePi0NonMergedElectronPhotonInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2167  fHistoTruePi0NonMergedElectronPhotonInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2169  fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0NonMergedElectronMergedPhoton_InvMass_Pt", "ESD_TruePi0NonMergedElectronMergedPhoton_InvMass_Pt", 800, 0, 0.8,
2170  nBinsPt, arrPtBinning);
2171  fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2172  fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2174 
2175  fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt", "ESD_TruePrimaryPi0_ResolPt_MCPt", 500, 0.03, 35, 1000, -1., 1.);
2176  fHistoTruePrimaryPi0MCPtResolPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
2177  fHistoTruePrimaryPi0MCPtResolPt[iCut]->SetXTitle("#delta (p_{T}) (GeV/c)");
2178  fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
2180  fTrueList[iCut]->Add(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
2181  fHistoTruePrimaryEtaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt", "ESD_TruePrimaryEta_ResolPt_MCPt", 500, 0.03, 35, 1000, -1., 1.);
2182  fHistoTruePrimaryEtaMCPtResolPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
2183  fHistoTruePrimaryEtaMCPtResolPt[iCut]->SetXTitle("#delta (p_{T}) (GeV/c)");
2184  fHistoTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
2186  fTrueList[iCut]->Add(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
2187  fHistoTrueK0sWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0sWithPi0Daughter_MCPt", "ESD_TrueK0sWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2188  fHistoTrueK0sWithPi0DaughterMCPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
2189  fTrueList[iCut]->Add(fHistoTrueK0sWithPi0DaughterMCPt[iCut]);
2190  fHistoTrueK0lWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0lWithPi0Daughter_MCPt", "ESD_TrueK0lWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2191  fHistoTrueK0lWithPi0DaughterMCPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
2192  fTrueList[iCut]->Add(fHistoTrueK0lWithPi0DaughterMCPt[iCut]);
2193  fHistoTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt", "ESD_TrueEtaWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2194  fHistoTrueEtaWithPi0DaughterMCPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
2195  fTrueList[iCut]->Add(fHistoTrueEtaWithPi0DaughterMCPt[iCut]);
2196  fHistoTrueLambdaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueLambdaWithPi0Daughter_MCPt", "ESD_TrueLambdaWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2197  fHistoTrueLambdaWithPi0DaughterMCPt[iCut]->SetXTitle("p_{T, MC} (GeV/c)");
2199  }
2200 
2201  fHistoTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y", "ESD_TruePi0_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
2202  fHistoTruePi0PtY[iCut]->SetXTitle("p_{T} (GeV/c)");
2203  fHistoTruePi0PtY[iCut]->SetYTitle("y");
2204  fTrueList[iCut]->Add(fHistoTruePi0PtY[iCut]);
2205  fHistoTrueEtaPtY[iCut] = new TH2F("ESD_TrueEta_Pt_Y", "ESD_TrueEta_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
2206  fHistoTrueEtaPtY[iCut]->SetXTitle("p_{T} (GeV/c)");
2207  fHistoTrueEtaPtY[iCut]->SetYTitle("y");
2208  fTrueList[iCut]->Add(fHistoTrueEtaPtY[iCut]);
2209  fHistoTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha", "ESD_TruePi0_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
2210  fHistoTruePi0PtAlpha[iCut]->SetXTitle("p_{T} (GeV/c)");
2211  fHistoTruePi0PtAlpha[iCut]->SetYTitle("#alpha");
2212  fTrueList[iCut]->Add(fHistoTruePi0PtAlpha[iCut]);
2213  fHistoTrueEtaPtAlpha[iCut] = new TH2F("ESD_TrueEta_Pt_Alpha", "ESD_TrueEta_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
2214  fHistoTrueEtaPtAlpha[iCut]->SetXTitle("p_{T} (GeV/c)");
2215  fHistoTrueEtaPtAlpha[iCut]->SetYTitle("#alpha");
2216  fTrueList[iCut]->Add(fHistoTrueEtaPtAlpha[iCut]);
2217 
2218  fHistoTruePi0PtOpenAngle[iCut] = new TH2F("ESD_TruePi0_Pt_OpenAngle", "ESD_TruePi0_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning, 100, 0, 0.5);
2219  fHistoTruePi0PtOpenAngle[iCut]->SetXTitle("p_{T} (GeV/c)");
2220  fHistoTruePi0PtOpenAngle[iCut]->SetYTitle("#theta");
2221  fTrueList[iCut]->Add(fHistoTruePi0PtOpenAngle[iCut]);
2222  fHistoTrueEtaPtOpenAngle[iCut] = new TH2F("ESD_TrueEta_Pt_OpenAngle", "ESD_TrueEta_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning, 180, 0, 1.8);
2223  fHistoTrueEtaPtOpenAngle[iCut]->SetXTitle("p_{T} (GeV/c)");
2224  fHistoTrueEtaPtOpenAngle[iCut]->SetYTitle("#theta");
2225  fTrueList[iCut]->Add(fHistoTrueEtaPtOpenAngle[iCut]);
2226 
2227  fHistoTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt", "ESD_TrueBckGG_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2228  fHistoTrueBckGGInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2229  fHistoTrueBckGGInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2230  fTrueList[iCut]->Add(fHistoTrueBckGGInvMassPt[iCut]);
2231  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut] = new TH2F("ESD_TrueBckFullMesonContained_InvMass_Pt", "ESD_TrueBckFullMesonContained_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2232  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2233  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2235  fHistoTrueBckAsymEClustersInvMassPt[iCut] = new TH2F("ESD_TrueBckAsymEClus_InvMass_Pt", "ESD_TrueBckAsymEClus_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2236  fHistoTrueBckAsymEClustersInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2237  fHistoTrueBckAsymEClustersInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2239  fHistoTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt", "ESD_TrueBckCont_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2240  fHistoTrueBckContInvMassPt[iCut]->SetYTitle("p_{T} (GeV/c)");
2241  fHistoTrueBckContInvMassPt[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2242  fTrueList[iCut]->Add(fHistoTrueBckContInvMassPt[iCut]);
2243 
2244  if (fIsMC > 1){
2245  fHistoTruePi0PtY[iCut]->Sumw2();
2246  fHistoTrueEtaPtY[iCut]->Sumw2();
2247  fHistoTruePi0PtAlpha[iCut]->Sumw2();
2248  fHistoTrueEtaPtAlpha[iCut]->Sumw2();
2249  fHistoTruePi0PtOpenAngle[iCut]->Sumw2();
2250  fHistoTrueEtaPtOpenAngle[iCut]->Sumw2();
2251  fHistoTrueBckGGInvMassPt[iCut]->Sumw2();
2253  fHistoTrueBckAsymEClustersInvMassPt[iCut]->Sumw2();
2254  fHistoTrueBckContInvMassPt[iCut]->Sumw2();
2255  }
2256 
2257  }
2258 
2259  if (fDoMesonQA == 2 && fIsMC < 2){
2260  fHistoTruePi0Category1[iCut] = new TH2F("ESD_TruePi0Category1_InvMass_Pt", "ESD_TruePi0Category1_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2261  fHistoTruePi0Category1[iCut]->SetYTitle("p_{T} (GeV/c)");
2262  fHistoTruePi0Category1[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2263  fTrueList[iCut]->Add(fHistoTruePi0Category1[iCut]);
2264  fHistoTrueEtaCategory1[iCut] = new TH2F("ESD_TrueEtaCategory1_InvMass_Pt", "ESD_TrueEtaCategory1_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2265  fHistoTrueEtaCategory1[iCut]->SetYTitle("p_{T} (GeV/c)");
2266  fHistoTrueEtaCategory1[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2267  fTrueList[iCut]->Add(fHistoTrueEtaCategory1[iCut]);
2268  fHistoTruePi0Category2[iCut] = new TH2F("ESD_TruePi0Category2_InvMass_Pt", "ESD_TruePi0Category2_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2269  fHistoTruePi0Category2[iCut]->SetYTitle("p_{T} (GeV/c)");
2270  fHistoTruePi0Category2[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2271  fTrueList[iCut]->Add(fHistoTruePi0Category2[iCut]);
2272  fHistoTrueEtaCategory2[iCut] = new TH2F("ESD_TrueEtaCategory2_InvMass_Pt", "ESD_TrueEtaCategory2_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2273  fHistoTrueEtaCategory2[iCut]->SetYTitle("p_{T} (GeV/c)");
2274  fHistoTrueEtaCategory2[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2275  fTrueList[iCut]->Add(fHistoTrueEtaCategory2[iCut]);
2276  fHistoTruePi0Category3[iCut] = new TH2F("ESD_TruePi0Category3_InvMass_Pt", "ESD_TruePi0Category3_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2277  fHistoTruePi0Category3[iCut]->SetYTitle("p_{T} (GeV/c)");
2278  fHistoTruePi0Category3[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2279  fTrueList[iCut]->Add(fHistoTruePi0Category3[iCut]);
2280  fHistoTrueEtaCategory3[iCut] = new TH2F("ESD_TrueEtaCategory3_InvMass_Pt", "ESD_TrueEtaCategory3_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2281  fHistoTrueEtaCategory3[iCut]->SetYTitle("p_{T} (GeV/c)");
2282  fHistoTrueEtaCategory3[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2283  fTrueList[iCut]->Add(fHistoTrueEtaCategory3[iCut]);
2284  fHistoTruePi0Category4_6[iCut] = new TH2F("ESD_TruePi0Category4_6_InvMass_Pt", "ESD_TruePi0Category4_6_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2285  fHistoTruePi0Category4_6[iCut]->SetYTitle("p_{T} (GeV/c)");
2286  fHistoTruePi0Category4_6[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2287  fTrueList[iCut]->Add(fHistoTruePi0Category4_6[iCut]);
2288  fHistoTrueEtaCategory4_6[iCut] = new TH2F("ESD_TrueEtaCategory4_6_InvMass_Pt", "ESD_TrueEtaCategory4_6_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2289  fHistoTrueEtaCategory4_6[iCut]->SetYTitle("p_{T} (GeV/c)");
2290  fHistoTrueEtaCategory4_6[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2291  fTrueList[iCut]->Add(fHistoTrueEtaCategory4_6[iCut]);
2292  fHistoTruePi0Category5[iCut] = new TH2F("ESD_TruePi0Category5_InvMass_Pt", "ESD_TruePi0Category5_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2293  fHistoTruePi0Category5[iCut]->SetYTitle("p_{T} (GeV/c)");
2294  fHistoTruePi0Category5[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2295  fTrueList[iCut]->Add(fHistoTruePi0Category5[iCut]);
2296  fHistoTrueEtaCategory5[iCut] = new TH2F("ESD_TrueEtaCategory5_InvMass_Pt", "ESD_TrueEtaCategory5_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2297  fHistoTrueEtaCategory5[iCut]->SetYTitle("p_{T} (GeV/c)");
2298  fHistoTrueEtaCategory5[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2299  fTrueList[iCut]->Add(fHistoTrueEtaCategory5[iCut]);
2300  fHistoTruePi0Category7[iCut] = new TH2F("ESD_TruePi0Category7_InvMass_Pt", "ESD_TruePi0Category7_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2301  fHistoTruePi0Category7[iCut]->SetYTitle("p_{T} (GeV/c)");
2302  fHistoTruePi0Category7[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2303  fTrueList[iCut]->Add(fHistoTruePi0Category7[iCut]);
2304  fHistoTrueEtaCategory7[iCut] = new TH2F("ESD_TrueEtaCategory7_InvMass_Pt", "ESD_TrueEtaCategory7_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2305  fHistoTrueEtaCategory7[iCut]->SetYTitle("p_{T} (GeV/c)");
2306  fHistoTrueEtaCategory7[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2307  fTrueList[iCut]->Add(fHistoTrueEtaCategory7[iCut]);
2308  fHistoTruePi0Category8[iCut] = new TH2F("ESD_TruePi0Category8_InvMass_Pt", "ESD_TruePi0Category8_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2309  fHistoTruePi0Category8[iCut]->SetYTitle("p_{T} (GeV/c)");
2310  fHistoTruePi0Category8[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2311  fTrueList[iCut]->Add(fHistoTruePi0Category8[iCut]);
2312  fHistoTrueEtaCategory8[iCut] = new TH2F("ESD_TrueEtaCategory8_InvMass_Pt", "ESD_TrueEtaCategory8_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2313  fHistoTrueEtaCategory8[iCut]->SetYTitle("p_{T} (GeV/c)");
2314  fHistoTrueEtaCategory8[iCut]->SetXTitle("M_{#gamma#gamma} (GeV/c^{2})");
2315  fTrueList[iCut]->Add(fHistoTrueEtaCategory8[iCut]);
2316  }
2317 
2318  if (fDoMesonQA == 3){
2319  fTreeList[iCut] = new TList();
2320  fTreeList[iCut]->SetName(Form("%s_%s_%s True ClusterComb tree", cutstringEvent.Data(), cutstringCalo.Data(), cutstringMeson.Data()));
2321  fTreeList[iCut]->SetOwner(kTRUE);
2322  fCutFolder[iCut]->Add(fTreeList[iCut]);
2323 
2324  tTrueInvMassROpenABPtFlag[iCut] = new TTree("True_InvMass_R_OpenA_OpenB_Pt_Flag", "True_InvMass_R_OpenA_OpenB_Pt_Flag");
2325  tTrueInvMassROpenABPtFlag[iCut]->Branch("InvMass",&fInvMass,"fInvMass/F");
2326  tTrueInvMassROpenABPtFlag[iCut]->Branch("RConv",&fRconv,"fRconv/F");
2327  tTrueInvMassROpenABPtFlag[iCut]->Branch("OpenAngleRPrimVtx",&fOpenRPrim,"fOpenRPrim/F");
2328  tTrueInvMassROpenABPtFlag[iCut]->Branch("InvMassRTOF",&fInvMassRTOF,"fInvMassRTOF/F");
2329  tTrueInvMassROpenABPtFlag[iCut]->Branch("Pt",&fPt,"fPt/F");
2330 // tTrueInvMassROpenABPtFlag[iCut]->Branch("Weight",&fWeightJetJetMC,"fWeightJetJetMC/F");
2331  tTrueInvMassROpenABPtFlag[iCut]->Branch("cat",&iFlag,"iFlag/b");
2332  fTreeList[iCut]->Add(tTrueInvMassROpenABPtFlag[iCut]);
2333  }
2334  }
2335  }
2336  }
2337 
2341 
2343 
2344  if(fV0Reader)
2346  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
2347  fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
2348  if(fV0Reader)
2350  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
2351  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
2352 
2353  for(Int_t iMatcherTask = 0; iMatcherTask < 3; iMatcherTask++){
2354  AliCaloTrackMatcher* temp = (AliCaloTrackMatcher*) (AliAnalysisManager::GetAnalysisManager()->GetTask(Form("CaloTrackMatcher_%i",iMatcherTask)));
2355  if(temp) fOutputContainer->Add(temp->GetCaloTrackMatcherHistograms());
2356  }
2357 
2358  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2359  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
2360  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
2361  fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
2362  }
2363  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
2364  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
2365  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
2366  }
2367  if(fSetPlotHistsExtQA){
2368  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
2369  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms()){
2370  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms());
2371  }
2372  }
2373  if(fDoMesonAnalysis){
2374  if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
2375  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
2376  fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
2377  }
2378  }
2379  }
2380 
2381  if (fIsMC > 0 ){
2382  tBrokenFiles = new TTree("BrokenFiles", "BrokenFiles");
2383  tBrokenFiles->Branch("fileName",&fFileNameBroken);
2385  }
2386  if (fDoClusterQA > 1){
2387  tClusterQATree = new TTree("ClusterQATree", "ClusterQATree");
2388  tClusterQATree->Branch("closeHighPtClusters",&fCloseHighPtClusters);
2390  }
2391 
2392  if(fLocalDebugFlag > 0){
2393  fstream fOutputLocalDebug;
2394  fOutputLocalDebug.open("debugOutput.txt",ios::out);
2395  fOutputLocalDebug.close();
2396  }
2397 
2398  PostData(1, fOutputContainer);
2399 }
2400 //_____________________________________________________________________________
2402 {
2403  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2404  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
2405  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
2406  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
2407  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
2408  }
2409  if(fIsHeavyIon==2) {
2410  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
2411  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2412  continue; // No Eta Shift requested, continue
2413  }
2414  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
2415  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
2416  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2417  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
2418  continue;
2419  }
2420  else{
2421  printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
2422  (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
2423  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2424  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
2425  }
2426  }
2427  }
2428 
2429  return kTRUE;
2430 }
2431 //_____________________________________________________________________________
2433 {
2434  //
2435  // Called for each event
2436  //
2437  fInputEvent = InputEvent();
2438  fCloseHighPtClusters = 0x0;
2439  if(fIsMC> 0) fMCEvent = MCEvent();
2440 
2441  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
2442  if(fInputEvent->IsIncompleteDAQ()==kTRUE) eventQuality = 2; // incomplete event
2443  if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1 or because it is incomplete
2444  // write out name of broken file for first event
2445  if (fIsMC > 0){
2446  if (fInputEvent->IsA()==AliESDEvent::Class()){
2447  if (((AliESDEvent*)fInputEvent)->GetEventNumberInFile() == 0){
2448  fFileNameBroken = new TObjString(Form("%s", ((TString)fV0Reader->GetCurrentFileName()).Data()));
2449  if (tBrokenFiles) tBrokenFiles->Fill();
2450  delete fFileNameBroken;
2451  }
2452  }
2453  }
2454 
2455  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
2456  fHistoNEvents[iCut]->Fill(eventQuality);
2457  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
2458  }
2459  return;
2460  }
2461 
2462  // ------------------- BeginEvent ----------------------------
2463 
2464  AliEventplane *EventPlane = fInputEvent->GetEventplane();
2465  if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
2466  else fEventPlaneAngle=0.0;
2467 
2468  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
2469 
2470  fiCut = iCut;
2471 
2473  Bool_t isRunningEMCALrelAna = kFALSE;
2474  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) isRunningEMCALrelAna = kTRUE;
2475 
2476  Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon, isRunningEMCALrelAna);
2477 
2478  if(fIsMC==2){
2479  Float_t xsection = -1.;
2480  Float_t ntrials = -1.;
2481  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetXSectionAndNTrials(fMCEvent,xsection,ntrials, fInputEvent );
2482  if((xsection==-1.) || (ntrials==-1.)) AliFatal(Form("ERROR: GetXSectionAndNTrials returned invalid xsection/ntrials, periodName from V0Reader: '%s'",fV0Reader->GetPeriodName().Data()));
2483  fProfileJetJetXSection[iCut]->Fill(0.,xsection);
2484  fHistoJetJetNTrials[iCut]->Fill("#sum{NTrials}", ntrials);
2485  }
2486 
2487  if (fIsMC > 0){
2488  fWeightJetJetMC = 1;
2489  Bool_t isMCJet = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsJetJetMCEventAccepted( fMCEvent, fWeightJetJetMC , fInputEvent);
2490  if (fIsMC == 3){
2491  Double_t weightMult = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetWeightForMultiplicity(fV0Reader->GetNumberOfPrimaryTracks());
2492  fWeightJetJetMC = fWeightJetJetMC*weightMult;
2493  }
2494 
2495  if (!isMCJet){
2496  fHistoNEvents[iCut]->Fill(10,fWeightJetJetMC);
2497  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(10);
2498  continue;
2499  }
2500  }
2501 
2502  Bool_t triggered = kTRUE;
2503  if(eventNotAccepted){
2504  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
2505  fHistoNEvents[iCut]->Fill(eventNotAccepted, fWeightJetJetMC); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
2506  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventNotAccepted);
2507  if (eventNotAccepted==3 && fIsMC>0){
2508  triggered = kFALSE;
2509  } else {
2510  continue;
2511  }
2512  }
2513 
2514  if(eventQuality != 0){// Event Not Accepted
2515  //cout << "event rejected due to: " <<eventQuality << endl;
2516  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC);
2517  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality); // Should be 0 here
2518  continue;
2519  }
2520  if (triggered == kTRUE) {
2521  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC); // Should be 0 here
2522  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality); // Should be 0 here
2523 
2525  fHistoVertexZ[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetZ(), fWeightJetJetMC);
2526  if(!fDoLightOutput){
2527  fHistoSPDClusterTrackletBackground[iCut]->Fill(fInputEvent->GetMultiplicity()->GetNumberOfTracklets(),(fInputEvent->GetNumberOfITSClusters(0)+fInputEvent->GetNumberOfITSClusters(1)), fWeightJetJetMC);
2528  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A(), fWeightJetJetMC);
2529  else fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C(), fWeightJetJetMC);
2530  }
2531  }
2532  if(fIsMC> 0){
2533  // Process MC Particle
2534  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
2535  if(fInputEvent->IsA()==AliESDEvent::Class()){
2536  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
2537  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
2538  fMCEvent);
2539  }
2540  else if(fInputEvent->IsA()==AliAODEvent::Class()){
2541  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
2542  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
2543  fInputEvent);
2544  }
2545 
2546  if(!fDoLightOutput){
2547  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader()){
2548  for(Int_t i = 0;i<(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
2549  TString nameBin= fHistoMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
2550  if (nameBin.CompareTo("")== 0){
2551  TString nameHeader = ((TObjString*)((TList*)((AliConvEventCuts*)fEventCutArray->At(iCut))
2552  ->GetAcceptedHeader())->At(i))->GetString();
2553  fHistoMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
2554  }
2555  }
2556  }
2557  }
2558  }
2559  }
2560  if(fIsMC> 0){
2561  if(fInputEvent->IsA()==AliESDEvent::Class())
2563  if(fInputEvent->IsA()==AliAODEvent::Class())
2565  }
2566 
2567  if (triggered==kFALSE) continue;
2568 
2569  // 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)
2570  ProcessClusters(); // process calo clusters
2571 
2573 
2574  fHistoNGammaCandidates[iCut]->Fill(fClusterCandidates->GetEntries(), fWeightJetJetMC);
2576  if(fDoMesonAnalysis){ // Meson Analysis
2577 
2578  CalculatePi0Candidates(); // Combine Gammas from conversion and from calo
2579  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
2580  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
2581 
2582  CalculateBackground(); // Combinatorial Background
2583  UpdateEventByEventData(); // Store Event for mixed Events
2584  }
2585 
2586  }
2589  }
2590 
2591  if(fIsMC> 0){
2594  }
2595 
2596  fClusterCandidates->Clear(); // delete cluster candidates
2597  }
2599 
2600  PostData(1, fOutputContainer);
2601 }
2602 
2603 //________________________________________________________________________
2605 {
2606 
2607  Int_t nclus = 0;
2608  TClonesArray * arrClustersProcess = NULL;
2610  if(!fCorrTaskSetting.CompareTo("")){
2611  nclus = fInputEvent->GetNumberOfCaloClusters();
2612  } else {
2613  arrClustersProcess = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(Form("%sClustersBranch",fCorrTaskSetting.Data())));
2614  if(!arrClustersProcess)
2615  AliFatal(Form("%sClustersBranch was not found in AliAnalysisTaskGammaCalo! Check the correction framework settings!",fCorrTaskSetting.Data()));
2616  nclus = arrClustersProcess->GetEntries();
2617  }
2618 
2619  if(nclus == 0) return;
2620  // plotting histograms on cell/tower level, only if extendedMatchAndQA > 1
2621  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FillHistogramsExtendedQA(fInputEvent,fIsMC);
2622 
2623  // match tracks to clusters
2624  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchTracksToClusters(fInputEvent,fWeightJetJetMC);
2625 
2626  // vertex
2627  Double_t vertex[3] = {0};
2628  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
2629 
2630  Double_t maxClusterEnergy = -1;
2631  Int_t maxClusterID = -1;
2632  map<Long_t,Int_t> mapIsClusterAccepted;
2633  map<Long_t,Int_t> mapIsClusterAcceptedWithoutTrackMatch;
2634  // Loop over EMCal clusters
2635  for(Long_t i = 0; i < nclus; i++){
2636  AliVCluster* clus = NULL;
2637  if(fInputEvent->IsA()==AliESDEvent::Class()){
2638  if(arrClustersProcess)
2639  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(i));
2640  else
2641  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
2642  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
2643  if(arrClustersProcess)
2644  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(i));
2645  else
2646  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
2647  }
2648 
2649  if(!clus) continue;
2650  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fMCEvent,fIsMC,fWeightJetJetMC,i)){
2651  if(fProduceTreeEOverP && ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedBeforeTrackMatch() ) mapIsClusterAcceptedWithoutTrackMatch[i] = 1;
2652  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetIsAcceptedForBasicCounting())fNCurrentClusterBasic++;
2653  delete clus;
2654  continue;
2655  }
2657 
2658  // TLorentzvector with cluster
2659  TLorentzVector clusterVector;
2660  clus->GetMomentum(clusterVector,vertex);
2661 
2662  TLorentzVector* tmpvec = new TLorentzVector();
2663  tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
2664 
2665  // convert to AODConversionPhoton
2666  AliAODConversionPhoton *PhotonCandidate=new AliAODConversionPhoton(tmpvec);
2667  if(!PhotonCandidate){ delete clus; delete tmpvec; continue;}
2668 
2669  //determine maximum cluster energy in event
2670  if(fProduceCellIDPlots && (clus->E() > maxClusterEnergy)){
2671  maxClusterEnergy = clus->E();
2672  maxClusterID = (Int_t) i;
2673  }
2675  mapIsClusterAccepted[i] = 1;
2676  mapIsClusterAcceptedWithoutTrackMatch[i] = 1;
2677  }
2678 
2679  // Flag Photon as CaloPhoton
2680  PhotonCandidate->SetIsCaloPhoton();
2681  PhotonCandidate->SetCaloClusterRef(i);
2682  PhotonCandidate->SetLeadingCellID(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FindLargestCellInCluster(clus,fInputEvent));
2683  // get MC label
2684  if(fIsMC> 0){
2685  Int_t* mclabelsCluster = clus->GetLabels();
2686  PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
2687 // cout << clus->GetNLabels() << endl;
2688  if (clus->GetNLabels()>0){
2689  for (Int_t k =0; k< (Int_t)clus->GetNLabels(); k++){
2690  if (k< 50)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
2691 // Int_t pdgCode = fMCEvent->Particle(mclabelsCluster[k])->GetPdgCode();
2692 // cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
2693  }
2694  }
2695  }
2696 
2697  fIsFromDesiredHeader = kTRUE;
2699  // test whether largest contribution to cluster orginates in added signals
2700  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() > 0){
2701  if ( ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCEvent, fInputEvent) == 0) fIsFromDesiredHeader = kFALSE;
2702  if (clus->GetNLabels()>1){
2703  Int_t* mclabelsCluster = clus->GetLabels();
2704  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;
2705  for (Int_t l = 1; l < (Int_t)clus->GetNLabels(); l++ ){
2706  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(mclabelsCluster[l], fMCEvent, fInputEvent, fLocalDebugFlag) == 0) fIsOverlappingWithOtherHeader = kTRUE;
2707  }
2708  if (fLocalDebugFlag > 1 && fIsOverlappingWithOtherHeader) cout << "found overlapping header: " << endl;
2709  }
2710  }
2711 
2712  fHistoClusAllHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(), fWeightJetJetMC);
2713  if (!fIsFromDesiredHeader) fHistoClusRejectedHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(), fWeightJetJetMC);
2715 
2716 
2718  fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt(), fWeightJetJetMC);
2719  fHistoClusGammaE[fiCut]->Fill(PhotonCandidate->E(), fWeightJetJetMC);
2720  if (!fDoLightOutput && fDoClusterQA > 0) fHistoClusGammaPtM02[fiCut]->Fill(PhotonCandidate->Pt(), clus->GetM02(), fWeightJetJetMC);
2721  if(fIsMC> 0){
2722  if(fInputEvent->IsA()==AliESDEvent::Class()){
2723  ProcessTrueClusterCandidates(PhotonCandidate,clus);
2724  } else {
2725  ProcessTrueClusterCandidatesAOD(PhotonCandidate,clus);
2726  }
2727  }
2728 
2729  fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
2730  } else{
2731  delete PhotonCandidate;
2732  }
2733 
2734  delete clus;
2735  delete tmpvec;
2736  }
2737 
2738  if(fProduceCellIDPlots){
2739  for(Long_t i = 0; i < nclus; i++){
2740  if( mapIsClusterAccepted[i] != 1 ) continue;
2741 
2742  AliVCluster* clus = NULL;
2743  if(fInputEvent->IsA()==AliESDEvent::Class()){
2744  if(arrClustersProcess)
2745  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(i));
2746  else
2747  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
2748  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
2749  if(arrClustersProcess)
2750  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(i));
2751  else
2752  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
2753  }
2754 
2755  if(!clus) continue;
2756 
2757  Int_t cellID = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FindLargestCellInCluster(clus,fInputEvent);
2758  fHistCellIDvsClusterEnergy[fiCut]->Fill(clus->E(),cellID);
2759  if (maxClusterID == i && maxClusterID > -1 ) fHistCellIDvsClusterEnergyMax[fiCut]->Fill(maxClusterEnergy,cellID);
2760  delete clus;
2761  }
2762  }
2763 
2764  if(fProduceTreeEOverP){
2765  AliESDEvent *esdev = dynamic_cast<AliESDEvent*>(fInputEvent);
2766  AliAODEvent *aodev = 0;
2767  Bool_t isESD = kTRUE;
2768  if (!esdev) {
2769  isESD = kFALSE;
2770  aodev = dynamic_cast<AliAODEvent*>(fInputEvent);
2771  if (!aodev) {
2772  AliError("Task needs AOD or ESD event...");
2773  }
2774  }
2775 
2776  AliESDtrackCuts *EsdTrackCuts = 0x0;
2777  if(esdev){
2778  // Using standard function for setting Cuts
2779  Int_t runNumber = fInputEvent->GetRunNumber();
2780  // if LHC11a or earlier or if LHC13g or if LHC12a-i -> use 2010 cuts
2781  if( (runNumber<=146860) || (runNumber>=197470 && runNumber<=197692) || (runNumber>=172440 && runNumber<=193766) ){
2782  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010();
2783  // else if run2 data use 2015 PbPb cuts
2784  }else if (runNumber>=209122){
2785  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2015PbPb();
2786  // else use 2011 version of track cuts
2787  }else{
2788  EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011();
2789  }
2790  EsdTrackCuts->SetMaxDCAToVertexZ(2);
2791  EsdTrackCuts->SetEtaRange(-0.8, 0.8);
2792  EsdTrackCuts->SetPtRange(0.15);
2793  }
2794 
2795  for(Long_t i = 0; i < nclus; i++){
2796  if( mapIsClusterAcceptedWithoutTrackMatch[i] != 1 ) continue;
2797 
2798  AliVCluster* clus = NULL;
2799  if(fInputEvent->IsA()==AliESDEvent::Class()){
2800  if(arrClustersProcess)
2801  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(i));
2802  else
2803  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
2804  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
2805  if(arrClustersProcess)
2806  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(i));
2807  else
2808  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
2809  }
2810 
2811  if(!clus) continue;
2812 
2813  fClusterE = clus->E();
2814  fClusterM02 = clus->GetM02();
2815  fClusterM20 = clus->GetM20();
2816  fClusterLeadCellID = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FindLargestCellInCluster(clus,fInputEvent);
2817 
2818  Int_t labelTrackMatch = -1;
2819  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetHighestPtMatchedTrackToCluster(fInputEvent,clus,labelTrackMatch)){
2820  delete clus;
2821  continue;
2822  }
2823 
2824  AliVTrack* currTrack = dynamic_cast<AliVTrack*>(fInputEvent->GetTrack(labelTrackMatch));
2825  if(!currTrack){
2826  delete clus;
2827  continue;
2828  }
2829  if(esdev){
2830  AliESDtrack *esdt = dynamic_cast<AliESDtrack*>(currTrack);
2831  if(!EsdTrackCuts->AcceptTrack(esdt)){
2832  delete clus;
2833  continue;
2834  }
2835  if(esdt->Pt()<1.){
2836  delete clus;
2837  continue;
2838  }
2839  fClusterEP = fClusterE/esdt->P();
2840  fTrackPt = esdt->Pt();
2841  }else if(aodev){
2842  AliAODTrack *aodt = dynamic_cast<AliAODTrack*>(currTrack);
2843  if(!aodt->IsHybridGlobalConstrainedGlobal()){
2844  delete clus;
2845  continue;
2846  }
2847  if(TMath::Abs(aodt->Eta())>0.8){
2848  delete clus;
2849  continue;
2850  }
2851  if(aodt->Pt()<1.){
2852  delete clus;
2853  continue;
2854  }
2855  fClusterEP = fClusterE/aodt->P();
2856  fTrackPt = aodt->Pt();
2857  }
2858 
2859  AliPIDResponse* pidResponse = ((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetPIDResponse();
2860  if(!pidResponse){
2861  delete clus;
2862  continue;
2863  }
2864 
2865  Float_t temp = TMath::Abs(pidResponse->NumberOfSigmasTPC(currTrack,AliPID::kElectron));
2866  if(temp<10.){
2867  fTrackPID_e = temp*10;
2868  }else fTrackPID_e = 99;
2869 
2870  temp = TMath::Abs(pidResponse->NumberOfSigmasTPC(currTrack,AliPID::kPion));
2871  if(temp<10.){
2872  fTrackPID_Pi = temp*10;
2873  }else fTrackPID_Pi = 99;
2874 
2875  temp = TMath::Abs(pidResponse->NumberOfSigmasTPC(currTrack,AliPID::kKaon));
2876  if(temp<10.){
2877  fTrackPID_K = temp*10;
2878  }else fTrackPID_K = 99;
2879 
2880  temp = TMath::Abs(pidResponse->NumberOfSigmasTPC(currTrack,AliPID::kProton));
2881  if(temp<10.){
2882  fTrackPID_P = temp*10;
2883  }else fTrackPID_P = 99;
2884 
2885  Float_t tempEta = -99999;
2886  Float_t tempPhi = -99999;
2887  ((AliCaloTrackMatcher*)((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetCaloTrackMatcherInstance())->GetTrackClusterMatchingResidual(currTrack->GetID(),clus->GetID(),tempEta,tempPhi);
2888  fDeltaEta = tempEta;
2889  fDeltaPhi = tempPhi;
2890 
2891  //determine isolation in cluster Et
2892  Float_t clsPos[3] = {0.,0.,0.};
2893  Float_t secondClsPos[3] = {0.,0.,0.};
2894  TLorentzVector clusterVector;
2895 
2896  clus->GetPosition(clsPos);
2897  TVector3 clsPosVec(clsPos);
2898 
2899  Float_t sum_Et = 0;
2900  for(Int_t j=0; j<nclus; j++){
2901  if( i == j ) continue;
2902  if( mapIsClusterAcceptedWithoutTrackMatch[j] != 1 ) continue;
2903 
2904  AliVCluster* secondClus = NULL;
2905  if(fInputEvent->IsA()==AliESDEvent::Class()){
2906  if(arrClustersProcess)
2907  secondClus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(j));
2908  else
2909  secondClus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(j));
2910  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
2911  if(arrClustersProcess)
2912  secondClus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(j));
2913  else
2914  secondClus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(j));
2915  }
2916 
2917  if(!secondClus) continue;
2918  secondClus->GetPosition(secondClsPos);
2919  TVector3 secondClsPosVec(secondClsPos);
2920 
2921  Float_t dPhi = clsPosVec.DeltaPhi(secondClsPosVec);
2922  Float_t dEta = clsPosVec.Eta()-secondClsPosVec.Eta();
2923  if(TMath::Sqrt(dEta*dEta + dPhi*dPhi) < 0.2){
2924  secondClus->GetMomentum(clusterVector,vertex);
2925  sum_Et += clusterVector.Et();
2926  }
2927  delete secondClus;
2928  }
2929  fClusterIsoSumClusterEt = sum_Et;
2930 
2931  //determine isolation in track Et
2932  fClusterIsoSumTrackEt = ((AliCaloTrackMatcher*)((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetCaloTrackMatcherInstance())->SumTrackEtAroundCluster(fInputEvent,clus->GetID(),0.2);
2933  //remove Et from matched track
2934  TLorentzVector vecTrack;
2935  vecTrack.SetPxPyPzE(currTrack->Px(),currTrack->Py(),currTrack->Pz(),currTrack->E());
2936  fClusterIsoSumTrackEt -= vecTrack.Et();
2937 
2938  //get cluster classification
2939  if(fIsMC > 0) fClusterClassification = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClassifyClusterForTMEffi(clus,fInputEvent,fMCEvent,isESD);
2940 
2941  tClusterEOverP[fiCut]->Fill();
2942  delete clus;
2943  }
2944  mapIsClusterAcceptedWithoutTrackMatch.clear();
2945  }
2946 
2947  if(fProduceCellIDPlots || fProduceTreeEOverP) mapIsClusterAccepted.clear();
2948 
2949  if(fLocalDebugFlag == 2) EventDebugMethod();
2950 
2951  return;
2952 }
2953 
2954 //________________________________________________________________________
2956 {
2957 
2958  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2959  Double_t mcProdVtxX = primVtxMC->GetX();
2960  Double_t mcProdVtxY = primVtxMC->GetY();
2961  Double_t mcProdVtxZ = primVtxMC->GetZ();
2962 
2963  TParticle *Photon = NULL;
2964  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
2966 
2967  if (TruePhotonCandidate->GetCaloPhotonMCLabel(0) < 0) return;
2968  if (TruePhotonCandidate->GetNCaloPhotonMCLabels() > 0) Photon = fMCEvent->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
2969  else return;
2970 
2971  if(Photon == NULL){
2972  // cout << "no photon" << endl;
2973  return;
2974  }
2975 
2976  Int_t pdgCodeParticle = Photon->GetPdgCode();
2977  TruePhotonCandidate->SetCaloPhotonMCFlags(fMCEvent, fEnableSortForClusMC);
2978 
2979  // True Photon
2980 
2981  if (TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())) {
2982  fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2983  if (!fDoLightOutput && fDoClusterQA > 0) fHistoTrueClusGammaPtM02[fiCut]->Fill(TruePhotonCandidate->Pt(), clus->GetM02(), fWeightJetJetMC);
2984  } else if (fDoClusterQA > 0) fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
2985  if (fDoClusterQA > 0){
2986  if (TruePhotonCandidate->IsLargestComponentPhoton()){
2987  fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2988  fHistoTrueClusUnConvGammaMCPt[fiCut]->Fill(Photon->Pt(), fWeightJetJetMC);
2989  if (!fDoLightOutput) fHistoTrueClusUnConvGammaPtM02[fiCut]->Fill(TruePhotonCandidate->Pt(), clus->GetM02(), fWeightJetJetMC);
2990  }
2991  if (TruePhotonCandidate->IsLargestComponentElectron())
2992  fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2993  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2994  fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2995  if(Photon->GetMother(0) > -1){
2996  TParticle* motherPart = (TParticle*)fMCEvent->Particle(Photon->GetMother(0));
2997  fHistoTrueClusConvGammaMCPt[fiCut]->Fill(motherPart->Pt(), fWeightJetJetMC);
2998  }
2999  }
3000  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
3001  fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3002  if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
3003  fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3004  if (TruePhotonCandidate->IsMergedPartConv())
3005  fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3006  if (TruePhotonCandidate->IsDalitz())
3007  fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3008  if (TruePhotonCandidate->IsDalitzMerged())
3009  fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3010  if (TruePhotonCandidate->IsPhotonWithElecMother())
3011  fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3012  if (TruePhotonCandidate->IsShower())
3013  fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3014  if (TruePhotonCandidate->IsSubLeadingEM())
3015  fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3016  fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels(), fWeightJetJetMC);
3017  if (!TruePhotonCandidate->IsLargestComponentPhoton()) {
3018  FillPhotonBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
3019  if (!fDoLightOutput) FillPhotonBackgroundM02Hist(TruePhotonCandidate,clus,pdgCodeParticle);
3020  }
3021  if (!(TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())) ) {
3022  FillPhotonPlusConversionBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
3023  if (!fDoLightOutput) FillPhotonPlusConversionBackgroundM02Hist(TruePhotonCandidate,clus,pdgCodeParticle);
3024  }
3025  Int_t motherLab = Photon->GetMother(0);
3026  if (motherLab > -1){
3027  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3029  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)0,fWeightJetJetMC);
3031  }
3032  }
3033  Int_t grandMotherLab = fMCEvent->Particle(motherLab)->GetMother(0);
3034  if (grandMotherLab > -1){
3035  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3037  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)1,fWeightJetJetMC);
3039  }
3040  }
3041  }
3042  }
3043  }
3044 
3045  if(!fDoLightOutput){
3046  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, TruePhotonCandidate->GetCaloPhotonMCLabel(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3047  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
3048  isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, Photon->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3049 
3050  if(isPrimary){
3051  // filling primary histograms
3052  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3053  fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3054  fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(), fWeightJetJetMC); // Allways Filled
3055  }
3056  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3057  fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3058  fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(), fWeightJetJetMC); // Allways Filled
3059  }
3060 
3061  } else {
3062  // filling secondary histograms
3063  Int_t secondaryClass = -1;
3064  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
3065  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhoton( Photon, fMCEvent, kTRUE);
3066  else
3067  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhoton( Photon, fMCEvent, kFALSE);
3068 
3069  // all secondaries
3070  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3071  if (secondaryClass == 2) {
3072  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3073  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3074  fHistoTrueSecondaryClusGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3075  } else if (secondaryClass == 5) {
3076  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3077  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),1.,fWeightJetJetMC);
3078  fHistoTrueSecondaryClusGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3079  } else if (secondaryClass == 3) {
3080  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3081  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),2.,fWeightJetJetMC);
3082  fHistoTrueSecondaryClusGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3083  } else if (secondaryClass == 4) {
3084  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3085  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3086  } else {
3087  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),4.,fWeightJetJetMC);
3088  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),4.,fWeightJetJetMC);
3089  }
3090  }
3091  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3092  if (secondaryClass == 2) {
3093  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3095  fHistoTrueSecondaryClusConvGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3096  } else if (secondaryClass == 5) {
3097  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3099  fHistoTrueSecondaryClusConvGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3100  } else if (secondaryClass == 3) {
3101  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3103  fHistoTrueSecondaryClusConvGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3104  } else if (secondaryClass == 4) {
3105  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3107  } else {
3108  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),4.,fWeightJetJetMC);
3110  }
3111  }
3112  }
3113  }
3114  return;
3115 }
3116 
3117 
3118 //________________________________________________________________________
3120 {
3121  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3122  Double_t mcProdVtxX = primVtxMC->GetX();
3123  Double_t mcProdVtxY = primVtxMC->GetY();
3124  Double_t mcProdVtxZ = primVtxMC->GetZ();
3125 
3126  AliAODMCParticle *Photon = NULL;
3127  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3129  if (AODMCTrackArray){
3130  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
3131  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
3132  else return;
3133  } else {
3134  AliInfo("AODMCTrackArray could not be loaded");
3135  return;
3136  }
3137 
3138  if(Photon == NULL){
3139  // cout << "no photon" << endl;
3140  return;
3141  }
3142  Int_t pdgCodeParticle = Photon->GetPdgCode();
3144 
3145  // True Photon
3146  if (TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())) {
3147  fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3148  if (!fDoLightOutput && fDoClusterQA > 0) fHistoTrueClusGammaPtM02[fiCut]->Fill(TruePhotonCandidate->Pt(), clus->GetM02(), fWeightJetJetMC);
3149  } else if (fDoClusterQA > 0) fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt());
3150  if (fDoClusterQA > 0){
3151  if (TruePhotonCandidate->IsLargestComponentPhoton()) {
3152  fHistoTrueClusUnConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3153  fHistoTrueClusUnConvGammaMCPt[fiCut]->Fill(Photon->Pt(), fWeightJetJetMC);
3154  if (!fDoLightOutput) fHistoTrueClusUnConvGammaPtM02[fiCut]->Fill(TruePhotonCandidate->Pt(), clus->GetM02(), fWeightJetJetMC);
3155  }
3156  if (TruePhotonCandidate->IsLargestComponentElectron())
3157  fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3158  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) {
3159  fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3160  AliAODMCParticle *motherPart = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
3161  fHistoTrueClusConvGammaMCPt[fiCut]->Fill(motherPart->Pt(), fWeightJetJetMC);
3162  }
3163  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
3164  fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3165  if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
3166  fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3167  if (TruePhotonCandidate->IsMergedPartConv())
3168  fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3169  if (TruePhotonCandidate->IsDalitz())
3170  fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3171  if (TruePhotonCandidate->IsDalitzMerged())
3172  fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3173  if (TruePhotonCandidate->IsPhotonWithElecMother())
3174  fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3175  if (TruePhotonCandidate->IsShower())
3176  fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3177  if (TruePhotonCandidate->IsSubLeadingEM())
3178  fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3179  fHistoTrueClusNParticles[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels(), fWeightJetJetMC);
3180 
3181  if (!TruePhotonCandidate->IsLargestComponentPhoton()) {
3182  FillPhotonBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
3183  if (!fDoLightOutput) FillPhotonBackgroundM02Hist(TruePhotonCandidate,clus,pdgCodeParticle);
3184  }
3185  if (!(TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())) ) {
3186  FillPhotonPlusConversionBackgroundHist(TruePhotonCandidate,pdgCodeParticle);
3187  if (!fDoLightOutput) FillPhotonPlusConversionBackgroundM02Hist(TruePhotonCandidate,clus,pdgCodeParticle);
3188  }
3189  Int_t motherLab = Photon->GetMother();
3190  if (motherLab > -1){
3191  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3193  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)0,fWeightJetJetMC);
3195  }
3196  }
3197  Int_t grandMotherLab = ((AliAODMCParticle*) AODMCTrackArray->At(motherLab))->GetMother();
3198  if (grandMotherLab > -1){
3199  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3201  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)1,fWeightJetJetMC);
3203  }
3204  }
3205  }
3206  }
3207  }
3208 
3209  if(!fDoLightOutput){
3210  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3211  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3212  if (Photon->GetMother()> -1){
3213  AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
3214  isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, Mother, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3215  }
3216  }
3217  if(isPrimary){
3218  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3219  fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3220  fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(), fWeightJetJetMC); // Allways Filled
3221  }
3222  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3223  fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3224  fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(), fWeightJetJetMC); // Allways Filled
3225  }
3226 
3227  } else {
3228  // filling secondary histograms
3229  Int_t secondaryClass = -1;
3230  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
3231  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhotonAOD( Photon, AODMCTrackArray, kTRUE);
3232  else
3233  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhotonAOD( Photon, AODMCTrackArray, kFALSE);
3234 
3235  // all secondaries
3236  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3237  if (secondaryClass == 2) {
3238  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3239  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3240  fHistoTrueSecondaryClusGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3241  } else if (secondaryClass == 5) {
3242  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3243  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),1.,fWeightJetJetMC);
3244  fHistoTrueSecondaryClusGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3245  } else if (secondaryClass == 3) {
3246  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3247  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),2.,fWeightJetJetMC);
3248  fHistoTrueSecondaryClusGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3249  } else if (secondaryClass == 4) {
3250  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3251  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3252  } else {
3253  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),4.,fWeightJetJetMC);
3254  fHistoTrueSecondaryClusGammaMCPt[fiCut]->Fill(Photon->Pt(),4.,fWeightJetJetMC);
3255  }
3256  }
3257  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3258  if (secondaryClass == 2) {
3259  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3261  fHistoTrueSecondaryClusConvGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3262  } else if (secondaryClass == 5) {
3263  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3265  fHistoTrueSecondaryClusConvGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3266  } else if (secondaryClass == 3) {
3267  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3269  fHistoTrueSecondaryClusConvGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3270  } else if (secondaryClass == 4) {
3271  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3273  } else {
3274  fHistoTrueSecondaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),4.,fWeightJetJetMC);
3276  }
3277  }
3278  }
3279  }
3280 
3281 }
3282 
3283 //________________________________________________________________________
3285 {
3286  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3287  Double_t mcProdVtxX = primVtxMC->GetX();
3288  Double_t mcProdVtxY = primVtxMC->GetY();
3289  Double_t mcProdVtxZ = primVtxMC->GetZ();
3290 
3291  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3292  if (AODMCTrackArray == NULL) return;
3293 
3294  // Loop over all primary MC particle
3295  for(Long_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
3296 
3297  AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
3298  if (!particle) continue;
3299 
3300  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, particle, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3301  if (isPrimary){
3302 
3303  Int_t isMCFromMBHeader = -1;
3304  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3305  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3306  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3307  }
3308 
3309  if(!fDoLightOutput){
3310  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(particle,AODMCTrackArray)){
3311  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC); // All MC Gamma
3312  if(particle->GetMother() >-1){ // Meson Decay Gamma
3313  switch((static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother())))->GetPdgCode()){
3314  case 111: // Pi0
3315  fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3316  break;
3317  case 113: // Rho0
3318  fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3319  break;
3320  case 221: // Eta
3321  fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3322  break;
3323  case 223: // Omega
3324  fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3325  break;
3326  case 331: // Eta'
3327  fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3328  break;
3329  case 333: // Phi
3330  fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3331  break;
3332  case 3212: // Sigma
3333  fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3334  break;
3335  }
3336  }
3337  }
3338  }
3339  // Converted MC Gamma
3340  if(fDoMesonAnalysis){
3341  Double_t mesonY = 1.e30;
3342  Double_t ratio = 0;
3343  if (particle->E() != TMath::Abs(particle->Pz())){
3344  ratio = (particle->E()+particle->Pz()) / (particle->E()-particle->Pz());
3345  }
3346  if( !(ratio <= 0) ){
3347  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3348  }
3349 
3350  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
3351  if ( particle->GetPdgCode() == 211 ){ // positve pions
3352  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., fWeightJetJetMC);
3353  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
3354  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., fWeightJetJetMC);
3355  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
3356  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., fWeightJetJetMC);
3357  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
3358  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., fWeightJetJetMC);
3359  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
3360  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., fWeightJetJetMC);
3361  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
3362  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., fWeightJetJetMC);
3363  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
3364  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., fWeightJetJetMC);
3365  }
3366  }
3367 
3369  ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3370  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
3371  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
3372  Float_t weighted= 1;
3373  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
3374  if (particle->Pt()>0.005){
3375  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, 0x0, fInputEvent);
3376  }
3377  }
3378 
3379  Double_t mesonY = 1.e30;
3380  Double_t ratio = 0;
3381  if (particle->E() != TMath::Abs(particle->Pz())){
3382  ratio = (particle->E()+particle->Pz()) / (particle->E()-particle->Pz());
3383  }
3384  if( !(ratio <= 0) ){
3385  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3386  }
3387  Double_t alpha = -1;
3388  if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
3389  alpha = TMath::Abs((daughter0->E() - daughter1->E()))/(daughter0->E() + daughter1->E());
3390  }
3391 
3392  if(particle->GetPdgCode() == 111){
3393  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted* fWeightJetJetMC); // All MC Pi0
3394  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3395  if (fIsMC > 1) fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
3396  if (fDoMesonQA > 0 && fDoMesonQA < 3){
3397  fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted* fWeightJetJetMC);
3398  fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha, fWeightJetJetMC);
3399  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3400  }
3401  } else if(particle->GetPdgCode() == 221){
3402  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted* fWeightJetJetMC); // All MC Eta
3403  fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3404  if (fIsMC > 1) fHistoMCEtaWOEvtWeightPt[fiCut]->Fill(particle->Pt());
3405  if (fDoMesonQA > 0 && fDoMesonQA < 3){
3406  fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted* fWeightJetJetMC);
3407  fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha, fWeightJetJetMC);
3408  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3409  }
3410  }
3411 
3412  // Check the acceptance for both gammas
3413  if( ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) &&
3414  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
3415 
3416  if(particle->GetPdgCode() == 111){
3417  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted* fWeightJetJetMC); // MC Pi0 with gamma in acc
3418  if(fIsMC > 1) fHistoMCPi0WOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 with gamma in acc
3419  } else if(particle->GetPdgCode() == 221){
3420  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted* fWeightJetJetMC); // MC Eta with gamma in acc
3421  if(fIsMC > 1) fHistoMCEtaWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta with gamma in acc
3422  }
3423  }
3424  }
3425  }
3426  // fill secondaries
3427  } else {
3428  Int_t isMCFromMBHeader = -1;
3429  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3430  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3431  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3432  }
3433 
3434  if(!fDoLightOutput) {
3435  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(particle,AODMCTrackArray)){
3436  if(particle->GetMother() >-1){
3437  AliAODMCParticle *tmpMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3438  if(tmpMother->GetMother() >-1){
3439  AliAODMCParticle *tmpGrandMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(tmpMother->GetMother()));
3440  if(tmpGrandMother->GetPdgCode() == 310) {
3441  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightJetJetMC);
3442  } else if (tmpGrandMother->GetPdgCode() == 130) {
3443  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightJetJetMC);
3444  } else if (tmpGrandMother->GetPdgCode() == 3122) {
3445  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightJetJetMC);
3446  } else if (tmpGrandMother->GetPdgCode() == 221) {
3447  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3448  } else {
3449  if( !(TMath::Abs(tmpMother->GetPdgCode()) == 11 && tmpGrandMother->GetPdgCode() == 22) )
3450  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),4.,fWeightJetJetMC);
3451  }
3452  } else {
3453  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),4.,fWeightJetJetMC);
3454  }
3455  } else {
3456  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),4.,fWeightJetJetMC);
3457  }
3458  }
3459  }
3460 
3461  if(fDoMesonAnalysis){
3462  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3463  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
3464  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
3465  AliAODMCParticle* mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3466  Int_t pdgCode = mother->GetPdgCode();
3467  if(particle->GetPdgCode() == 111){
3468  Int_t source = GetSourceClassification(111,pdgCode);
3469  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC); // All MC Pi0
3470  fHistoMCSecPi0Source[fiCut]->Fill(pdgCode);
3471  }else if(particle->GetPdgCode() == 221){
3472 
3473  fHistoMCSecEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Pi0
3474  fHistoMCSecEtaSource[fiCut]->Fill(pdgCode);
3475  }
3476 
3477  // check if conversion where within acceptance
3478  if( ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) &&
3479  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray)){
3480  if(particle->GetPdgCode() == 111){
3481  Int_t source = GetSourceClassification(111,pdgCode);
3482  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC); // All MC Pi0
3483  }
3484  }
3485  }
3486  }
3487  }
3488  }
3489 }
3490 //________________________________________________________________________
3492 {
3493  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3494  Double_t mcProdVtxX = primVtxMC->GetX();
3495  Double_t mcProdVtxY = primVtxMC->GetY();
3496  Double_t mcProdVtxZ = primVtxMC->GetZ();
3497 
3498  // Loop over all primary MC particle
3499  for(Long_t i = 0; i < fMCEvent->GetNumberOfTracks(); i++) {
3500  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
3501 
3502  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
3503  if (!particle) continue;
3504 
3505  Int_t isMCFromMBHeader = -1;
3506  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3507  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3508  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3509  }
3510 
3511  if(!fDoLightOutput){
3512  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(particle,fMCEvent)){
3513  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC); // All MC Gamma
3514  if(particle->GetMother(0) >-1){ // Meson Decay Gamma
3515  switch(fMCEvent->Particle(particle->GetMother(0))->GetPdgCode()){
3516  case 111: // Pi0
3517  fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3518  break;
3519  case 113: // Rho0
3520  fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3521  break;
3522  case 221: // Eta
3523  fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3524  break;
3525  case 223: // Omega
3526  fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3527  break;
3528  case 331: // Eta'
3529  fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3530  break;
3531  case 333: // Phi
3532  fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3533  break;
3534  case 3212: // Sigma
3535  fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3536  break;
3537  }
3538  }
3539  }
3540  }
3541  if(fDoMesonAnalysis){
3542 
3543  Double_t mesonY = 1.e30;
3544  Double_t ratio = 0;
3545  if (particle->Energy() != TMath::Abs(particle->Pz())){
3546  ratio = (particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz());
3547  }
3548  if( !(ratio <= 0) ){
3549  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3550  }
3551 
3552  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
3553  if ( particle->GetPdgCode() == 211 ){ // positve pions
3554  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., fWeightJetJetMC);
3555  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
3556  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., fWeightJetJetMC);
3557  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
3558  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., fWeightJetJetMC);
3559  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
3560  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., fWeightJetJetMC);
3561  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
3562  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., fWeightJetJetMC);
3563  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
3564  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., fWeightJetJetMC);
3565  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
3566  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., fWeightJetJetMC);
3567  }
3568  }
3569 
3571  ->MesonIsSelectedMC(particle,fMCEvent,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3572  TParticle* daughter0 = (TParticle*)fMCEvent->Particle(particle->GetFirstDaughter());
3573  TParticle* daughter1 = (TParticle*)fMCEvent->Particle(particle->GetLastDaughter());
3574 
3575  Float_t weighted= 1;
3576  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
3577  if (particle->Pt()>0.005){
3578  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent, fInputEvent);
3579  }
3580  }
3581  Double_t mesonY = 1.e30;
3582  Double_t ratio = 0;
3583  if (particle->Energy() != TMath::Abs(particle->Pz())){
3584  ratio = (particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz());
3585  }
3586  if( !(ratio <= 0) ){
3587  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3588  }
3589  Double_t alpha = -1;
3590  if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
3591  alpha = TMath::Abs((daughter0->Energy() - daughter1->Energy()))/(daughter0->Energy() + daughter1->Energy());
3592  }
3593 
3594  if(particle->GetPdgCode() == 111){
3595  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted* fWeightJetJetMC); // All MC Pi0
3596  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3597  if (fIsMC > 1)fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
3598  if (fDoMesonQA > 0 && fDoMesonQA < 3){
3599  fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted* fWeightJetJetMC);
3600  fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha, fWeightJetJetMC);
3601  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3602  }
3603  } else if(particle->GetPdgCode() == 221){
3604  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted* fWeightJetJetMC); // All MC Eta
3605  fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt(), fWeightJetJetMC);
3606  if (fIsMC > 1)fHistoMCEtaWOEvtWeightPt[fiCut]->Fill(particle->Pt());
3607  if (fDoMesonQA > 0 && fDoMesonQA < 3){
3608  fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted* fWeightJetJetMC);
3609  fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha, fWeightJetJetMC);
3610  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3611  }
3612  }
3613 
3614  // Check the acceptance for both gammas & whether they are counted as primaries as well
3615  Bool_t kDaughter0IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, particle->GetFirstDaughter(), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3616  Bool_t kDaughter1IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, particle->GetLastDaughter(), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3617 
3618  if( kDaughter0IsPrim && kDaughter1IsPrim &&
3619  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCEvent) &&
3620  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCEvent) ){
3621  if(particle->GetPdgCode() == 111){
3622  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted* fWeightJetJetMC); // MC Pi0 with gamma in acc
3623  if(fIsMC > 1) fHistoMCPi0WOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 with gamma in acc
3624  } else if(particle->GetPdgCode() == 221){
3625  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted* fWeightJetJetMC); // MC Eta with gamma in acc
3626  if(fIsMC > 1) fHistoMCEtaWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta with gamma in acc
3627  }
3628  }
3629  }
3630  }
3631  // fill secondary histograms
3632  } else {
3633  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
3634  if (!particle) continue;
3635 
3636  Int_t isMCFromMBHeader = -1;
3637  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3638  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3639  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3640  }
3641 
3642  if(!fDoLightOutput) {
3643  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(particle,fMCEvent)){
3644  if (particle->GetMother(0) > -1 && fMCEvent->Particle(particle->GetMother(0))->GetMother(0) > -1) {
3645  if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
3646  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightJetJetMC);
3647  } else if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 130) {
3648  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightJetJetMC);
3649  } else if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 3122) {
3650  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightJetJetMC);
3651  } else if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 221) {
3652  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3653  } else {
3654  if ( !(TMath::Abs(fMCEvent->Particle(particle->GetMother(0))->GetPdgCode()) == 11 && fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 22) )
3655  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),4.,fWeightJetJetMC);
3656  }
3657  } else {
3658  fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),4.,fWeightJetJetMC);
3659  }
3660  }
3661  }
3662 
3663  if(fDoMesonAnalysis){
3664  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedMC(particle,fMCEvent,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3665  TParticle* daughter0 = (TParticle*)fMCEvent->Particle(particle->GetFirstDaughter());
3666  TParticle* daughter1 = (TParticle*)fMCEvent->Particle(particle->GetLastDaughter());
3667  Int_t pdgCode = -1;
3668  if(particle->GetFirstMother() > -1) pdgCode = ((TParticle*)fMCEvent->Particle( particle->GetFirstMother() ))->GetPdgCode();
3669 
3670  if(particle->GetPdgCode() == 111){
3671  Int_t source = GetSourceClassification(111,pdgCode);
3672  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC);
3673  fHistoMCSecPi0Source[fiCut]->Fill(pdgCode);
3674  } else if(particle->GetPdgCode() == 221){
3675  fHistoMCSecEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3676  fHistoMCSecEtaSource[fiCut]->Fill(pdgCode);
3677  }
3678 
3679  // check if photons where within acceptance
3680  if( ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCEvent) &&
3681  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCEvent)){
3682  if(particle->GetPdgCode() == 111){
3683  Int_t source = GetSourceClassification(111,pdgCode);
3684  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC);
3685  }
3686  }
3687  }
3688  }
3689 
3690  }
3691  }
3692 }
3693 
3694 //________________________________________________________________________
3696 
3697  // Conversion Gammas
3698  if(fClusterCandidates->GetEntries()>0){
3699 
3700  for(Int_t firstGammaIndex=0;firstGammaIndex<fClusterCandidates->GetEntries();firstGammaIndex++){
3701  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(firstGammaIndex));
3702  if (gamma0==NULL) continue;
3703  if ( fDoInOutTimingCluster ){
3704  Double_t tof = fInputEvent->GetCaloCluster(gamma0->GetCaloClusterRef())->GetTOF();
3705  if ( tof < fMinTimingCluster || tof > fMaxTimingCluster ) continue;
3706  }
3707 
3708  for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
3709  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
3710  if (gamma1==NULL) continue;
3711  if ( fDoInOutTimingCluster ){
3712  Double_t tof = fInputEvent->GetCaloCluster(gamma1->GetCaloClusterRef())->GetTOF();
3713  if ( tof > fMinTimingCluster && tof < fMaxTimingCluster ) continue;
3714  }
3715 
3716  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
3717  pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
3718 
3719  if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),gamma0->GetLeadingCellID(),gamma1->GetLeadingCellID()))){
3720  if(fLocalDebugFlag == 1) DebugMethodPrint1(pi0cand,gamma0,gamma1);
3721  fHistoMotherInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(), fWeightJetJetMC);
3722  // fill new histograms
3723  if(!fDoLightOutput && TMath::Abs(pi0cand->GetAlpha())<0.1)
3724  fHistoMotherInvMassPtAlpha[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(), fWeightJetJetMC);
3725 
3726  if (fDoMesonQA > 0 && fDoMesonQA < 3){
3727  if ( pi0cand->M() > 0.05 && pi0cand->M() < 0.17){
3728  fHistoMotherPi0PtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(), fWeightJetJetMC);
3729  fHistoMotherPi0PtAlpha[fiCut]->Fill(pi0cand->Pt(),TMath::Abs(pi0cand->GetAlpha()), fWeightJetJetMC);
3730  fHistoMotherPi0PtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle(), fWeightJetJetMC);
3732  }
3733  if ( pi0cand->M() > 0.45 && pi0cand->M() < 0.65){
3734  fHistoMotherEtaPtY[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(), fWeightJetJetMC);
3735  fHistoMotherEtaPtAlpha[fiCut]->Fill(pi0cand->Pt(),TMath::Abs(pi0cand->GetAlpha()), fWeightJetJetMC);
3736  fHistoMotherEtaPtOpenAngle[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle(), fWeightJetJetMC);
3738  }
3739  }
3740  if(fDoTHnSparse && ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->DoBGCalculation()){
3741  Int_t zbin = 0;
3742  Int_t mbin = 0;
3743 
3744  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->BackgroundHandlerType() == 0){
3745  zbin = fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
3746  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
3748  } else {
3750  }
3751  }
3752  Double_t sparesFill[4] = {pi0cand->M(),pi0cand->Pt(),(Double_t)zbin,(Double_t)mbin};
3753  fSparseMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
3754  }
3755 
3756  if(fDoMesonQA == 4 && fIsMC == 0 && (pi0cand->Pt() > 13.) ){
3757  Int_t zbin = 0;
3758  Int_t mbin = 0;
3759  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->BackgroundHandlerType() == 0){
3760  zbin = fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
3761  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
3763  } else {
3765  }
3766  }
3767  fInvMassTreeInvMass = pi0cand->M();
3768  fInvMassTreePt = pi0cand->Pt();
3769  fInvMassTreeAlpha = TMath::Abs(pi0cand->GetAlpha());
3770  fInvMassTreeTheta = pi0cand->GetOpeningAngle();
3771  fInvMassTreeMixPool = zbin*100 + mbin;
3772  fInvMassTreeZVertex = fInputEvent->GetPrimaryVertex()->GetZ();
3773  fInvMassTreeEta = pi0cand->Eta();
3774  tSigInvMassPtAlphaTheta[fiCut]->Fill();
3775  }
3776 
3777  if(fIsMC> 0){
3778  if(fInputEvent->IsA()==AliESDEvent::Class())
3779  ProcessTrueMesonCandidates(pi0cand,gamma0,gamma1);
3780  if(fInputEvent->IsA()==AliAODEvent::Class())
3781  ProcessTrueMesonCandidatesAOD(pi0cand,gamma0,gamma1);
3782  }
3783 
3784  if((pi0cand->GetOpeningAngle() < 0.017) && (pi0cand->Pt() > 15.) && fDoClusterQA > 1){
3785  if (fCloseHighPtClusters == NULL){
3786  fCloseHighPtClusters = new TObjString(Form("%s", ((TString)fV0Reader->GetCurrentFileName()).Data()));
3787  if (tClusterQATree) tClusterQATree->Fill();
3788  }
3789  }
3790  }
3791  delete pi0cand;
3792  pi0cand=0x0;
3793  }
3794  }
3795  }
3796 }
3797 //______________________________________________________________________
3799 {
3800  // Process True Mesons
3801  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3802  Double_t mcProdVtxX = primVtxMC->GetX();
3803  Double_t mcProdVtxY = primVtxMC->GetY();
3804  Double_t mcProdVtxZ = primVtxMC->GetZ();
3805  fRconv = -1;
3806 
3807  Bool_t isTruePi0 = kFALSE;
3808  Bool_t isTrueEta = kFALSE;
3809  //Bool_t isTrueGamma = kFALSE;
3810  Bool_t isSameConvertedGamma = kFALSE;
3811  Int_t convertedPhotonLabel0 = -1;
3812  Int_t convertedPhotonLabel1 = -1;
3813 
3814  Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
3815  Int_t gamma0MotherLabel = -1;
3816 
3817  TParticle * gammaMC0 = 0x0;
3818  if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
3819  gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
3820  if (TrueGammaCandidate0->IsLargestComponentPhoton() || TrueGammaCandidate0->IsLargestComponentElectron()){ // largest component is electro magnetic
3821  // get mother of interest (pi0 or eta)
3822  if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons its the direct mother
3823  gamma0MotherLabel=gammaMC0->GetMother(0);
3824  } else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
3825  if (TrueGammaCandidate0->IsConversion() && (gammaMC0->GetMother(0) > -1)){
3826  convertedPhotonLabel0 = gammaMC0->GetMother(0);
3827  gamma0MotherLabel=fMCEvent->Particle(gammaMC0->GetMother(0))->GetMother(0);
3828  } else {
3829  gamma0MotherLabel=gammaMC0->GetMother(0);
3830  }
3831  }
3832  }
3833  }
3834  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3835 
3836  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
3837  Int_t gamma1MotherLabel = -1;
3838  // check if
3839 
3840  TParticle * gammaMC1 = 0x0;
3841  if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
3842  // Daughters Gamma 1
3843  gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
3844  if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
3845  // get mother of interest (pi0 or eta)
3846  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
3847  gamma1MotherLabel = gammaMC1->GetMother(0);
3848  fRconv = gammaMC1->R();
3849  } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
3850  if (TrueGammaCandidate1->IsConversion()){
3851  convertedPhotonLabel1 = gammaMC1->GetMother(0);
3852  fRconv = gammaMC1->R();
3853  if(convertedPhotonLabel1 > -1) gamma1MotherLabel = fMCEvent->Particle(convertedPhotonLabel1)->GetMother(0);
3854  } else {
3855  gamma1MotherLabel=gammaMC1->GetMother(0);
3856  fRconv = gammaMC1->R();
3857  }
3858  }
3859  }
3860  }
3861 
3862  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
3863  if(((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
3864  isTruePi0=kTRUE;
3865  }
3866  if(((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 221){
3867  isTrueEta=kTRUE;
3868  }
3869  }
3870 
3871  if (fDoMesonQA == 3){
3872  // calculate meson properties
3873  fPt = Pi0Candidate->Pt();
3874  fOpenRPrim = Pi0Candidate->GetOpeningAngle();
3875  fInvMass = Pi0Candidate->M();
3876 
3877  Double_t vertex[3] = {0};
3878  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
3879 
3880 // cout << vertex[0] << "\t" << vertex[1] << "\t" << vertex[2] << "\t" << Pi0Candidate->Px() << "\t" << Pi0Candidate->Py() << "\t" << Pi0Candidate->Pz() << "\t"
3881 // << Pi0Candidate->Phi() << endl;
3882 
3883  Double_t scaling = (375 - TMath::Sqrt(vertex[0]*vertex[0]+vertex[1]*vertex[1]))/(TMath::Sqrt(Pi0Candidate->Px()*Pi0Candidate->Px()+Pi0Candidate->Py()*Pi0Candidate->Py()));
3884  vertex[0] = vertex[0] + scaling*Pi0Candidate->Px();
3885  vertex[1] = vertex[1] + scaling*Pi0Candidate->Py();
3886  vertex[2] = vertex[2] + scaling*Pi0Candidate->Pz();
3887 
3888 // cout << vertex[0] << "\t" << vertex[1] << "\t" << vertex[2] << endl;
3889 
3890  TClonesArray * arrClustersMesonCand = NULL;
3891  if(fCorrTaskSetting.CompareTo(""))
3892  arrClustersMesonCand = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(Form("%sClustersBranch",fCorrTaskSetting.Data())));
3893 
3894  AliVCluster* clus1 = NULL;
3895  if(fInputEvent->IsA()==AliESDEvent::Class()){
3896  if(arrClustersMesonCand)
3897  clus1 = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersMesonCand->At(TrueGammaCandidate0->GetCaloClusterRef()));
3898  else
3899  clus1 = fInputEvent->GetCaloCluster(TrueGammaCandidate0->GetCaloClusterRef());
3900  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
3901  if(arrClustersMesonCand)
3902  clus1 = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersMesonCand->At(TrueGammaCandidate0->GetCaloClusterRef()));
3903  else
3904  clus1 = fInputEvent->GetCaloCluster(TrueGammaCandidate0->GetCaloClusterRef());
3905  }
3906 
3907  if (!clus1) return;
3908  TLorentzVector clusterVector1;
3909  clus1->GetMomentum(clusterVector1,vertex);
3910  if(arrClustersMesonCand) delete clus1;
3911  TLorentzVector* tmpvec1 = new TLorentzVector();
3912  tmpvec1->SetPxPyPzE(clusterVector1.Px(),clusterVector1.Py(),clusterVector1.Pz(),clusterVector1.E());
3913  // convert to AODConversionPhoton
3914  AliAODConversionPhoton *PhotonCandidate1=new AliAODConversionPhoton(tmpvec1);
3915  if(!PhotonCandidate1) return;
3916 
3917 
3918  AliVCluster* clus2 = NULL;
3919  if(fInputEvent->IsA()==AliESDEvent::Class()){
3920  if(arrClustersMesonCand)
3921  clus2 = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersMesonCand->At(TrueGammaCandidate1->GetCaloClusterRef()));
3922  else
3923  clus2 = fInputEvent->GetCaloCluster(TrueGammaCandidate1->GetCaloClusterRef());
3924  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
3925  if(arrClustersMesonCand)
3926  clus2 = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersMesonCand->At(TrueGammaCandidate1->GetCaloClusterRef()));
3927  else
3928  clus2 = fInputEvent->GetCaloCluster(TrueGammaCandidate1->GetCaloClusterRef());
3929  }
3930 
3931  if (!clus2) return;
3932  TLorentzVector clusterVector2;
3933  clus2->GetMomentum(clusterVector2,vertex);
3934  if(arrClustersMesonCand) delete clus2;
3935  TLorentzVector* tmpvec2 = new TLorentzVector();
3936  tmpvec2->SetPxPyPzE(clusterVector2.Px(),clusterVector2.Py(),clusterVector2.Pz(),clusterVector2.E());
3937  // convert to AODConversionPhoton
3938  AliAODConversionPhoton *PhotonCandidate2=new AliAODConversionPhoton(tmpvec2);
3939  if(!PhotonCandidate2) return;
3940 
3941  AliAODConversionMother *pi0cand2 = new AliAODConversionMother(PhotonCandidate1,PhotonCandidate2);
3942  fInvMassRTOF = pi0cand2->M();
3943 
3944  delete tmpvec1;
3945  delete tmpvec2;
3946  delete PhotonCandidate1;
3947  delete PhotonCandidate2;
3948  delete pi0cand2;
3949 
3950 // cout << fOpenRPrim << "\t" << fInvMassRTOF << endl;
3951 
3952  }
3953 
3954  if (convertedPhotonLabel0 > -1 && convertedPhotonLabel1 > -1){
3955  if (convertedPhotonLabel0==convertedPhotonLabel1){
3956  isSameConvertedGamma = kTRUE;
3957  if (fDoMesonQA == 3 ){
3958  iFlag = 0;
3960  }
3961  }
3962  }
3963 
3964  if(isTruePi0 || isTrueEta){// True Pion or Eta
3965  if (isTruePi0){
3966  fHistoTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3967 // fHistoTruePi0NonLinearity[fiCut]->Fill(TrueGammaCandidate0->E(),gammaMC0->Energy()/TrueGammaCandidate0->E());
3968 // fHistoTruePi0NonLinearity[fiCut]->Fill(TrueGammaCandidate1->E(),gammaMC1->Energy()/TrueGammaCandidate1->E());
3969  if (!fDoLightOutput && TMath::Abs(Pi0Candidate->GetAlpha())< 0.1){
3970  fHistoTruePi0InvMassPtAlpha[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3971  if (TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate0->IsLargestComponentPhoton())
3972  fHistoTruePi0PureGammaInvMassPtAlpha[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3973  }
3974  }
3975  if (isTrueEta){
3976  fHistoTrueEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3977 // fHistoTrueEtaNonLinearity[fiCut]->Fill(TrueGammaCandidate0->E(),gammaMC0->Energy()/TrueGammaCandidate0->E());
3978 // fHistoTrueEtaNonLinearity[fiCut]->Fill(TrueGammaCandidate1->E(),gammaMC1->Energy()/TrueGammaCandidate1->E());
3979  }
3980  if (fDoMesonQA > 0 && fDoMesonQA < 3 && fIsMC < 2){
3981 // if(isTruePi0) {
3982 // fHistoPi0OpenAngleInvMassPt[fiCut]->Fill(Pi0Candidate->GetOpeningAngle(),Pi0Candidate->M(),Pi0Candidate->Pt(),1);
3983 // }
3984 // if(isTrueEta) {
3985 // fHistoEtaOpenAngleInvMassPt[fiCut]->Fill(Pi0Candidate->GetOpeningAngle(),Pi0Candidate->M(),Pi0Candidate->Pt(),1);
3986 // }
3987  // both gammas are real gammas
3988  if (TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate1->IsLargestComponentPhoton()) {
3989  if (isTruePi0) fHistoTruePi0CaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3990  if (isTrueEta) fHistoTrueEtaCaloPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3991  }
3992  // both particles are electrons
3993  if (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate1->IsLargestComponentElectron() ) {
3994  if (isTruePi0) fHistoTruePi0CaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3995  if (isTrueEta) fHistoTrueEtaCaloElectronInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
3996  }
3997  // both particles are converted electrons
3998  if ((TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion()) && (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ){
3999  if (isTruePi0 )fHistoTruePi0CaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
4000  if (isTrueEta )fHistoTrueEtaCaloConvertedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
4001  }
4002  // 1 gamma is converted the other one is normals
4003  if ( (TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion()) ||
4004  (TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion())
4005  ) {
4006  if (isTruePi0) fHistoTruePi0CaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
4007  if (isTrueEta) fHistoTrueEtaCaloMixedPhotonConvPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
4008  }
4009 
4010  if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion() && TrueGammaCandidate1->IsLargestComponentPhoton() && !TrueGammaCandidate1->IsMerged()) ||
4011  (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() && TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged())
4012  ) {
4013  if (isTruePi0) fHistoTruePi0NonMergedElectronPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
4014  }
4015 
4016  if ( (TrueGammaCandidate0->IsLargestComponentElectron() && TrueGammaCandidate0->IsConversion() && TrueGammaCandidate1->IsLargestComponentPhoton() && TrueGammaCandidate1->IsMerged()) ||
4017  (TrueGammaCandidate1->IsLargestComponentElectron() && TrueGammaCandidate1->IsConversion() && TrueGammaCandidate0->IsLargestComponentPhoton() && TrueGammaCandidate0->IsMerged())
4018  ) {
4019  if (isTruePi0) fHistoTruePi0NonMergedElectronMergedPhotonInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
4020  }
4021 
4022  // at least one of the photon is merged
4023  if (TrueGammaCandidate0->IsMerged() || TrueGammaCandidate0->IsMergedPartConv() || TrueGammaCandidate0->IsDalitzMerged() || TrueGammaCandidate1->IsMerged() || TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate1->IsDalitzMerged() ){
4024  if (isTruePi0) fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
4025  if (isTrueEta) fHistoTruePi0CaloMergedClusterInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
4026  }
4027  // at least one of the photon is merged and part conv
4028  if (TrueGammaCandidate1->IsMergedPartConv() || TrueGammaCandidate0->IsMergedPartConv()) {
4029  if (isTruePi0) fHistoTruePi0CaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
4030  if (isTrueEta) fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
4031  }
4032  }
4033 
4034  if (fDoMesonQA == 2 && fIsMC < 2){
4035  // category 1: 2 real photons unmerged
4036  if (TrueGammaCandidate0->IsLargestComponentPhoton() && !TrueGammaCandidate0->IsMerged() && TrueGammaCandidate1->IsLarge