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