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