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