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