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