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