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