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