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