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