AliPhysics  a6017e1 (a6017e1)
AliAnalysisTaskGammaConvCalo.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2020, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: Daniel Muehlheim, 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 "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 
63 
64 //________________________________________________________________________
66  fV0Reader(NULL),
67  fV0ReaderName("V0ReaderV1"),
68  fCorrTaskSetting(""),
69  fBGHandler(NULL),
70  fBGHandlerRP(NULL),
71  fBGClusHandler(NULL),
72  fBGClusHandlerRP(NULL),
73  fInputEvent(NULL),
74  fMCEvent(NULL),
75  fCutFolder(NULL),
76  fESDList(NULL),
77  fBackList(NULL),
78  fMotherList(NULL),
79  fGammaERM02(NULL),
80  fInvMassShowerShape(NULL),
81  fTrueList(NULL),
82  fMCList(NULL),
83  fClusterOutputList(NULL),
84  fOutputContainer(NULL),
85  fReaderGammas(NULL),
86  fGammaCandidates(NULL),
87  fClusterCandidates(NULL),
88  fEventCutArray(NULL),
89  fEventCuts(NULL),
90  fCutArray(NULL),
91  fConversionCuts(NULL),
92  fClusterCutArray(NULL),
93  fCaloPhotonCuts(NULL),
94  fMesonCutArray(NULL),
95  fMesonCuts(NULL),
96  fHistoConvGammaPt(NULL),
97  fTreeConvGammaPtDcazCat(NULL),
98  fPtGamma(0),
99  fDCAzPhoton(0),
100  fCharCatPhoton(0),
101  fCharPhotonMCInfo(0),
102  tESDGammaERM02(NULL),
103  tESDClusE(0),
104  tESDGammaConvR(0),
105  tESDClusterM02(0),
106  tESDClusterM20(0),
107  tESDClusterEta(0),
108  tESDClusterPhi(0),
109  tESDClusterNCells(0),
110  tESDClusterMaxECell(0),
111  tESDClusterNLM(0),
112  tESDInvMassShowerShape(0),
113  tESDIMMesonInvMass(0),
114  tESDIMMesonPt(0),
115  tESDIMClusE(0),
116  tESDIMClusterM02(0),
117  tESDIMClusterM20(0),
118  tESDIMClusterLeadCellID(0),
119  tESDIMClusterClassification(0),
120  tESDIMClusMatchedTrackPt(0),
121  tESDIMClusTrackDeltaEta(0),
122  tESDIMClusTrackDeltaPhi(0),
123  tESDIMClusterIsoSumClusterEt(0),
124  tESDIMClusterIsoSumTrackEt(0),
125  tESDmapIsClusterAcceptedWithoutTrackMatch(),
126  fHistoMotherInvMassPt(NULL),
127  fHistoMotherMatchedInvMassPt(NULL),
128  fSparseMotherInvMassPtZM(NULL),
129  fHistoMotherBackInvMassPt(NULL),
130  fSparseMotherBackInvMassPtZM(NULL),
131  fHistoMotherInvMassPtAlpha(NULL),
132  fHistoMotherPi0PtY(NULL),
133  fHistoMotherEtaPtY(NULL),
134  fHistoMotherPi0PtAlpha(NULL),
135  fHistoMotherEtaPtAlpha(NULL),
136  fHistoMotherPi0PtOpenAngle(NULL),
137  fHistoMotherEtaPtOpenAngle(NULL),
138  fHistoMotherPi0ConvPhotonEtaPhi(NULL),
139  fHistoMotherEtaConvPhotonEtaPhi(NULL),
140  fHistoMotherInvMassECalib(NULL),
141  fHistoMotherBackInvMassECalib(NULL),
142  fHistoPhotonPairPtconv(NULL),
143  fHistoPhotonPairMixedEventPtconv(NULL),
144  fHistoClusGammaPt(NULL),
145  fHistoClusGammaE(NULL),
146  fHistoClusOverlapHeadersGammaPt(NULL),
147  fHistoClusAllHeadersGammaPt(NULL),
148  fHistoClusRejectedHeadersGammaPt(NULL),
149  fHistoMCHeaders(NULL),
150  fHistoMCAllGammaPt(NULL),
151  fHistoMCAllGammaEMCALAccPt(NULL),
152  fHistoMCAllSecondaryGammaPt(NULL),
153  fHistoMCDecayGammaPi0Pt(NULL),
154  fHistoMCDecayGammaRhoPt(NULL),
155  fHistoMCDecayGammaEtaPt(NULL),
156  fHistoMCDecayGammaOmegaPt(NULL),
157  fHistoMCDecayGammaEtapPt(NULL),
158  fHistoMCDecayGammaPhiPt(NULL),
159  fHistoMCDecayGammaSigmaPt(NULL),
160  fHistoMCConvGammaPt(NULL),
161  fHistoMCSecondaryConvGammaPt(NULL),
162  fHistoMCPi0Pt(NULL),
163  fHistoMCPi0WOWeightPt(NULL),
164  fHistoMCPi0WOEvtWeightPt(NULL),
165  fHistoMCEtaPt(NULL),
166  fHistoMCEtaWOWeightPt(NULL),
167  fHistoMCEtaWOEvtWeightPt(NULL),
168  fHistoMCPi0InAccPt(NULL),
169  fHistoMCPi0WOWeightInAccPt(NULL),
170  fHistoMCPi0WOEvtWeightInAccPt(NULL),
171  fHistoMCEtaInAccPt(NULL),
172  fHistoMCEtaWOWeightInAccPt(NULL),
173  fHistoMCEtaWOEvtWeightInAccPt(NULL),
174  fHistoMCPi0PtY(NULL),
175  fHistoMCEtaPtY(NULL),
176  fHistoMCPi0PtAlpha(NULL),
177  fHistoMCEtaPtAlpha(NULL),
178  fHistoMCPrimaryPtvsSource(NULL),
179  fHistoMCSecPi0PtvsSource(NULL),
180  fHistoMCSecPi0Source(NULL),
181  fHistoMCSecPi0InAccPtvsSource(NULL),
182  fHistoMCSecEtaPt(NULL),
183  fHistoMCSecEtaSource(NULL),
184  fHistoMCPi0PtJetPt(NULL),
185  fHistoMCEtaPtJetPt(NULL),
186  fHistoMCPi0PtGammaLeg(NULL),
187  fHistoMCPi0WOWeightPtGammaLeg(NULL),
188  fHistoMCPi0InAccPtGammaLeg(NULL),
189  fHistoMCPi0WOWeightInAccPtGammaLeg(NULL),
190  fHistoMCSecPi0PtGamma1vsSource(NULL),
191  fHistoMCSecPi0InAccPtGamma1vsSource(NULL),
192  fHistoMCSecPi0PtGamma2vsSource(NULL),
193  fHistoMCSecPi0InAccPtGamma2vsSource(NULL),
194  fHistoTruePi0InvMassPt(NULL),
195  fHistoTrueEtaInvMassPt(NULL),
196  fHistoTruePi0MatchedInvMassPt(NULL),
197  fHistoTrueEtaMatchedInvMassPt(NULL),
198  fHistoTruePi0CaloPhotonInvMassPt(NULL),
199  fHistoTrueEtaCaloPhotonInvMassPt(NULL),
200  fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
201  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt(NULL),
202  fHistoTruePi0CaloConvPhotonConvRPt(NULL),
203  fHistoTruePi0CaloConvPhotonConvRAlpha(NULL),
204  fHistoTruePi0CaloConvPhotonPtAlpha(NULL),
205  fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
206  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt(NULL),
207  fHistoTrueEtaCaloConvPhotonConvRPt(NULL),
208  fHistoTrueEtaCaloConvPhotonConvRAlpha(NULL),
209  fHistoTrueEtaCaloConvPhotonPtAlpha(NULL),
210  fHistoTruePi0CaloElectronInvMassPt(NULL),
211  fHistoTrueEtaCaloElectronInvMassPt(NULL),
212  fHistoTruePi0CaloMergedClusterInvMassPt(NULL),
213  fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
214  fHistoTrueMotherCaloEMNonLeadingInvMassPt(NULL),
215  fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
216  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
217  fHistoTruePrimaryPi0InvMassPt(NULL),
218  fHistoTruePrimaryEtaInvMassPt(NULL),
219  fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
220  fHistoTruePrimaryEtaW0WeightingInvMassPt(NULL),
221  fProfileTruePrimaryPi0WeightsInvMassPt(NULL),
222  fProfileTruePrimaryEtaWeightsInvMassPt(NULL),
223  fHistoTruePrimaryPi0MCPtResolPt(NULL),
224  fHistoTruePrimaryEtaMCPtResolPt(NULL),
225  fHistoTrueMotherPi0ConvPhotonEtaPhi(NULL),
226  fHistoTrueMotherEtaConvPhotonEtaPhi(NULL),
227  fHistoTrueSecondaryPi0InvMassPt(NULL),
228  fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
229  fHistoTrueK0sWithPi0DaughterMCPt(NULL),
230  fHistoTrueSecondaryPi0FromK0lInvMassPt(NULL),
231  fHistoTrueK0lWithPi0DaughterMCPt(NULL),
232  fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
233  fHistoTrueEtaWithPi0DaughterMCPt(NULL),
234  fHistoTrueSecondaryPi0FromLambdaInvMassPt(NULL),
235  fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
236  fHistoTrueBckGGInvMassPt(NULL),
237  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt(NULL),
238  fHistoTrueBckAsymEClustersInvMassPt(NULL),
239  fHistoTrueBckContInvMassPt(NULL),
240  fHistoTruePi0PtY(NULL),
241  fHistoTrueEtaPtY(NULL),
242  fHistoTruePi0PtAlpha(NULL),
243  fHistoTrueEtaPtAlpha(NULL),
244  fHistoTruePi0PtOpenAngle(NULL),
245  fHistoTrueEtaPtOpenAngle(NULL),
246  fHistoTrueConvGammaPt(NULL),
247  fHistoCombinatorialPt(NULL),
248  fHistoTruePrimaryConvGammaPt(NULL),
249  fHistoTruePrimaryConvGammaESDPtMCPt(NULL),
250  fHistoTrueSecondaryConvGammaPt(NULL),
251  fHistoTrueSecondaryConvGammaMCPt(NULL),
252  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt(NULL),
253  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt(NULL),
254  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt(NULL),
255  fHistoTrueClusGammaPt(NULL),
256  fHistoTrueClusElectronPt(NULL),
257  fHistoTrueClusConvGammaPt(NULL),
258  fHistoTrueClusConvGammaFullyPt(NULL),
259  fHistoTrueClusMergedGammaPt(NULL),
260  fHistoTrueClusMergedPartConvGammaPt(NULL),
261  fHistoTrueClusDalitzPt(NULL),
262  fHistoTrueClusDalitzMergedPt(NULL),
263  fHistoTrueClusPhotonFromElecMotherPt(NULL),
264  fHistoTrueClusShowerPt(NULL),
265  fHistoTrueClusSubLeadingPt(NULL),
266  fHistoTrueClusNMothers(NULL),
267  fHistoTrueClusEMNonLeadingPt(NULL),
268  fHistoTrueNLabelsInClusPt(NULL),
269  fHistoTruePrimaryClusGammaPt(NULL),
270  fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
271  fHistoTruePrimaryClusConvGammaPt(NULL),
272  fHistoTruePrimaryClusConvGammaESDPtMCPt(NULL),
273  fHistoTrueSecondaryClusGammaPt(NULL),
274  fHistoTrueSecondaryClusGammaFromK0sPt(NULL),
275  fHistoTrueSecondaryClusGammaFromK0lPt(NULL),
276  fHistoTrueSecondaryClusGammaFromLambdaPt(NULL),
277  fHistoTruePrimaryPi0PhotonPairPtconv(NULL),
278  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv(NULL),
279  fHistoTruePrimaryPi0DCPtconv(NULL),
280  fHistoTruePrimaryPi0MissingPtconv(NULL),
281  fHistoTrueSecondaryPi0PhotonPairPtconv(NULL),
282  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv(NULL),
283  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv(NULL),
284  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv(NULL),
285  fHistoTrueSecondaryPi0DCPtconvSource(NULL),
286  fHistoTrueSecondaryPi0MissingPtconvSource(NULL),
287  fVectorRecTruePi0s(0),
288  fVectorRecTrueEtas(0),
289  fHistoDoubleCountTruePi0InvMassPt(NULL),
290  fHistoDoubleCountTrueEtaInvMassPt(NULL),
291  fHistoDoubleCountTrueConvGammaRPt(NULL),
292  fHistoDoubleCountTrueClusterGammaPt(NULL),
293  fVectorDoubleCountTruePi0s(0),
294  fVectorDoubleCountTrueEtas(0),
295  fVectorDoubleCountTrueConvGammas(0),
296  fVectorDoubleCountTrueClusterGammas(0),
297  fHistoMultipleCountTruePi0(NULL),
298  fHistoMultipleCountTrueEta(NULL),
299  fHistoMultipleCountTrueConvGamma(NULL),
300  fHistoMultipleCountTrueClusterGamma(NULL),
301  fMapMultipleCountTruePi0s(),
302  fMapMultipleCountTrueEtas(),
303  fMapMultipleCountTrueConvGammas(),
304  fMapMultipleCountTrueClusterGammas(),
305  fHistoTrueClusGammaEM02(NULL),
306  fHistoTrueClusPi0EM02(NULL),
307  fHistoTruePi0InvMassECalib(NULL),
308  fHistoTruePi0PureGammaInvMassECalib(NULL),
309  fHistoNEvents(NULL),
310  fHistoNEventsWOWeight(NULL),
311  fHistoNGoodESDTracks(NULL),
312  fHistoVertexZ(NULL),
313  fHistoVertexX(NULL),
314  fHistoVertexY(NULL),
315  fHistoNGammaCandidates(NULL),
316  fHistoNGoodESDTracksVsNGammaCandidates(NULL),
317  fHistoSPDClusterTrackletBackground(NULL),
318  fHistoNV0Tracks(NULL),
319  fProfileEtaShift(NULL),
320  fProfileJetJetXSection(NULL),
321  fHistoJetJetNTrials(NULL),
322 // fHistoTruePi0NonLinearity(NULL),
323 // fHistoTrueEtaNonLinearity(NULL),
324  fEventPlaneAngle(-100),
325  fRandom(0),
326  fNGammaCandidates(0),
327  fUnsmearedPx(NULL),
328  fUnsmearedPy(NULL),
329  fUnsmearedPz(NULL),
330  fUnsmearedE(NULL),
331  fMCEventPos(NULL),
332  fMCEventNeg(NULL),
333  fESDArrayPos(NULL),
334  fESDArrayNeg(NULL),
335  fnCuts(0),
336  fiCut(0),
337  fMoveParticleAccordingToVertex(kTRUE),
338  fIsHeavyIon(0),
339  fDoLightOutput(kFALSE),
340  fDoMesonAnalysis(kTRUE),
341  fDoMesonQA(0),
342  fDoPhotonQA(0),
343  fDoClusterQA(0),
344  fIsFromDesiredHeader(kTRUE),
345  fIsOverlappingWithOtherHeader(kFALSE),
346  fIsMC(0),
347  fDoTHnSparse(kTRUE),
348  fSetPlotHistsExtQA(kFALSE),
349  fWeightJetJetMC(1),
350  fDoConvGammaShowerShapeTree(kFALSE),
351  fEnableSortForClusMC(kFALSE),
352  fDoPrimaryTrackMatching(kFALSE),
353  fDoInvMassShowerShapeTree(kFALSE),
354  tBrokenFiles(NULL),
355  fFileNameBroken(NULL),
356  fAllowOverlapHeaders(kTRUE),
357  fTrackMatcherRunningMode(0)
358 {
359 
360 }
361 
362 //________________________________________________________________________
364  AliAnalysisTaskSE(name),
365  fV0Reader(NULL),
366  fV0ReaderName("V0ReaderV1"),
367  fCorrTaskSetting(""),
368  fBGHandler(NULL),
369  fBGHandlerRP(NULL),
370  fBGClusHandler(NULL),
371  fBGClusHandlerRP(NULL),
372  fInputEvent(NULL),
373  fMCEvent(NULL),
374  fCutFolder(NULL),
375  fESDList(NULL),
376  fBackList(NULL),
377  fMotherList(NULL),
378  fGammaERM02(NULL),
379  fInvMassShowerShape(NULL),
380  fTrueList(NULL),
381  fMCList(NULL),
382  fClusterOutputList(NULL),
383  fOutputContainer(0),
384  fReaderGammas(NULL),
385  fGammaCandidates(NULL),
386  fClusterCandidates(NULL),
387  fEventCutArray(NULL),
388  fEventCuts(NULL),
389  fCutArray(NULL),
390  fConversionCuts(NULL),
391  fClusterCutArray(NULL),
392  fCaloPhotonCuts(NULL),
393  fMesonCutArray(NULL),
394  fMesonCuts(NULL),
395  fHistoConvGammaPt(NULL),
396  fTreeConvGammaPtDcazCat(NULL),
397  fPtGamma(0),
398  fDCAzPhoton(0),
399  fCharCatPhoton(0),
400  fCharPhotonMCInfo(0),
401  tESDGammaERM02(NULL),
402  tESDClusE(0),
403  tESDGammaConvR(0),
404  tESDClusterM02(0),
405  tESDClusterM20(0),
406  tESDClusterEta(0),
407  tESDClusterPhi(0),
408  tESDClusterNCells(0),
409  tESDClusterMaxECell(0),
410  tESDClusterNLM(0),
411  tESDInvMassShowerShape(0),
412  tESDIMMesonInvMass(0),
413  tESDIMMesonPt(0),
414  tESDIMClusE(0),
415  tESDIMClusterM02(0),
416  tESDIMClusterM20(0),
417  tESDIMClusterLeadCellID(0),
418  tESDIMClusterClassification(0),
419  tESDIMClusMatchedTrackPt(0),
420  tESDIMClusTrackDeltaEta(0),
421  tESDIMClusTrackDeltaPhi(0),
422  tESDIMClusterIsoSumClusterEt(0),
423  tESDIMClusterIsoSumTrackEt(0),
424  tESDmapIsClusterAcceptedWithoutTrackMatch(),
425  fHistoMotherInvMassPt(NULL),
426  fHistoMotherMatchedInvMassPt(NULL),
427  fSparseMotherInvMassPtZM(NULL),
428  fHistoMotherBackInvMassPt(NULL),
429  fSparseMotherBackInvMassPtZM(NULL),
430  fHistoMotherInvMassPtAlpha(NULL),
431  fHistoMotherPi0PtY(NULL),
432  fHistoMotherEtaPtY(NULL),
433  fHistoMotherPi0PtAlpha(NULL),
434  fHistoMotherEtaPtAlpha(NULL),
435  fHistoMotherPi0PtOpenAngle(NULL),
436  fHistoMotherEtaPtOpenAngle(NULL),
437  fHistoMotherPi0ConvPhotonEtaPhi(NULL),
438  fHistoMotherEtaConvPhotonEtaPhi(NULL),
439  fHistoMotherInvMassECalib(NULL),
440  fHistoMotherBackInvMassECalib(NULL),
441  fHistoPhotonPairPtconv(NULL),
442  fHistoPhotonPairMixedEventPtconv(NULL),
443  fHistoClusGammaPt(NULL),
444  fHistoClusGammaE(NULL),
445  fHistoClusOverlapHeadersGammaPt(NULL),
446  fHistoClusAllHeadersGammaPt(NULL),
447  fHistoClusRejectedHeadersGammaPt(NULL),
448  fHistoMCHeaders(NULL),
449  fHistoMCAllGammaPt(NULL),
450  fHistoMCAllGammaEMCALAccPt(NULL),
451  fHistoMCAllSecondaryGammaPt(NULL),
452  fHistoMCDecayGammaPi0Pt(NULL),
453  fHistoMCDecayGammaRhoPt(NULL),
454  fHistoMCDecayGammaEtaPt(NULL),
455  fHistoMCDecayGammaOmegaPt(NULL),
456  fHistoMCDecayGammaEtapPt(NULL),
457  fHistoMCDecayGammaPhiPt(NULL),
458  fHistoMCDecayGammaSigmaPt(NULL),
459  fHistoMCConvGammaPt(NULL),
460  fHistoMCSecondaryConvGammaPt(NULL),
461  fHistoMCPi0Pt(NULL),
462  fHistoMCPi0WOWeightPt(NULL),
463  fHistoMCPi0WOEvtWeightPt(NULL),
464  fHistoMCEtaPt(NULL),
465  fHistoMCEtaWOWeightPt(NULL),
466  fHistoMCEtaWOEvtWeightPt(NULL),
467  fHistoMCPi0InAccPt(NULL),
468  fHistoMCPi0WOWeightInAccPt(NULL),
469  fHistoMCPi0WOEvtWeightInAccPt(NULL),
470  fHistoMCEtaInAccPt(NULL),
471  fHistoMCEtaWOWeightInAccPt(NULL),
472  fHistoMCEtaWOEvtWeightInAccPt(NULL),
473  fHistoMCPi0PtY(NULL),
474  fHistoMCEtaPtY(NULL),
475  fHistoMCPi0PtAlpha(NULL),
476  fHistoMCEtaPtAlpha(NULL),
477  fHistoMCPrimaryPtvsSource(NULL),
478  fHistoMCSecPi0PtvsSource(NULL),
479  fHistoMCSecPi0Source(NULL),
480  fHistoMCSecPi0InAccPtvsSource(NULL),
481  fHistoMCSecEtaPt(NULL),
482  fHistoMCSecEtaSource(NULL),
483  fHistoMCPi0PtJetPt(NULL),
484  fHistoMCEtaPtJetPt(NULL),
485  fHistoMCPi0PtGammaLeg(NULL),
486  fHistoMCPi0WOWeightPtGammaLeg(NULL),
487  fHistoMCPi0InAccPtGammaLeg(NULL),
488  fHistoMCPi0WOWeightInAccPtGammaLeg(NULL),
489  fHistoMCSecPi0PtGamma1vsSource(NULL),
490  fHistoMCSecPi0InAccPtGamma1vsSource(NULL),
491  fHistoMCSecPi0PtGamma2vsSource(NULL),
492  fHistoMCSecPi0InAccPtGamma2vsSource(NULL),
493  fHistoTruePi0InvMassPt(NULL),
494  fHistoTrueEtaInvMassPt(NULL),
495  fHistoTruePi0MatchedInvMassPt(NULL),
496  fHistoTrueEtaMatchedInvMassPt(NULL),
497  fHistoTruePi0CaloPhotonInvMassPt(NULL),
498  fHistoTrueEtaCaloPhotonInvMassPt(NULL),
499  fHistoTruePi0CaloConvertedPhotonInvMassPt(NULL),
500  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt(NULL),
501  fHistoTruePi0CaloConvPhotonConvRPt(NULL),
502  fHistoTruePi0CaloConvPhotonConvRAlpha(NULL),
503  fHistoTruePi0CaloConvPhotonPtAlpha(NULL),
504  fHistoTrueEtaCaloConvertedPhotonInvMassPt(NULL),
505  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt(NULL),
506  fHistoTrueEtaCaloConvPhotonConvRPt(NULL),
507  fHistoTrueEtaCaloConvPhotonConvRAlpha(NULL),
508  fHistoTrueEtaCaloConvPhotonPtAlpha(NULL),
509  fHistoTruePi0CaloElectronInvMassPt(NULL),
510  fHistoTrueEtaCaloElectronInvMassPt(NULL),
511  fHistoTruePi0CaloMergedClusterInvMassPt(NULL),
512  fHistoTrueEtaCaloMergedClusterInvMassPt(NULL),
513  fHistoTrueMotherCaloEMNonLeadingInvMassPt(NULL),
514  fHistoTruePi0CaloMergedClusterPartConvInvMassPt(NULL),
515  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt(NULL),
516  fHistoTruePrimaryPi0InvMassPt(NULL),
517  fHistoTruePrimaryEtaInvMassPt(NULL),
518  fHistoTruePrimaryPi0W0WeightingInvMassPt(NULL),
519  fHistoTruePrimaryEtaW0WeightingInvMassPt(NULL),
520  fProfileTruePrimaryPi0WeightsInvMassPt(NULL),
521  fProfileTruePrimaryEtaWeightsInvMassPt(NULL),
522  fHistoTruePrimaryPi0MCPtResolPt(NULL),
523  fHistoTruePrimaryEtaMCPtResolPt(NULL),
524  fHistoTrueMotherPi0ConvPhotonEtaPhi(NULL),
525  fHistoTrueMotherEtaConvPhotonEtaPhi(NULL),
526  fHistoTrueSecondaryPi0InvMassPt(NULL),
527  fHistoTrueSecondaryPi0FromK0sInvMassPt(NULL),
528  fHistoTrueK0sWithPi0DaughterMCPt(NULL),
529  fHistoTrueSecondaryPi0FromK0lInvMassPt(NULL),
530  fHistoTrueK0lWithPi0DaughterMCPt(NULL),
531  fHistoTrueSecondaryPi0FromEtaInvMassPt(NULL),
532  fHistoTrueEtaWithPi0DaughterMCPt(NULL),
533  fHistoTrueSecondaryPi0FromLambdaInvMassPt(NULL),
534  fHistoTrueLambdaWithPi0DaughterMCPt(NULL),
535  fHistoTrueBckGGInvMassPt(NULL),
536  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt(NULL),
537  fHistoTrueBckAsymEClustersInvMassPt(NULL),
538  fHistoTrueBckContInvMassPt(NULL),
539  fHistoTruePi0PtY(NULL),
540  fHistoTrueEtaPtY(NULL),
541  fHistoTruePi0PtAlpha(NULL),
542  fHistoTrueEtaPtAlpha(NULL),
543  fHistoTruePi0PtOpenAngle(NULL),
544  fHistoTrueEtaPtOpenAngle(NULL),
545  fHistoTrueConvGammaPt(NULL),
546  fHistoCombinatorialPt(NULL),
547  fHistoTruePrimaryConvGammaPt(NULL),
548  fHistoTruePrimaryConvGammaESDPtMCPt(NULL),
549  fHistoTrueSecondaryConvGammaPt(NULL),
550  fHistoTrueSecondaryConvGammaMCPt(NULL),
551  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt(NULL),
552  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt(NULL),
553  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt(NULL),
554  fHistoTrueClusGammaPt(NULL),
555  fHistoTrueClusElectronPt(NULL),
556  fHistoTrueClusConvGammaPt(NULL),
557  fHistoTrueClusConvGammaFullyPt(NULL),
558  fHistoTrueClusMergedGammaPt(NULL),
559  fHistoTrueClusMergedPartConvGammaPt(NULL),
560  fHistoTrueClusDalitzPt(NULL),
561  fHistoTrueClusDalitzMergedPt(NULL),
562  fHistoTrueClusPhotonFromElecMotherPt(NULL),
563  fHistoTrueClusShowerPt(NULL),
564  fHistoTrueClusSubLeadingPt(NULL),
565  fHistoTrueClusNMothers(NULL),
566  fHistoTrueClusEMNonLeadingPt(NULL),
567  fHistoTrueNLabelsInClusPt(NULL),
568  fHistoTruePrimaryClusGammaPt(NULL),
569  fHistoTruePrimaryClusGammaESDPtMCPt(NULL),
570  fHistoTruePrimaryClusConvGammaPt(NULL),
571  fHistoTruePrimaryClusConvGammaESDPtMCPt(NULL),
572  fHistoTrueSecondaryClusGammaPt(NULL),
573  fHistoTrueSecondaryClusGammaFromK0sPt(NULL),
574  fHistoTrueSecondaryClusGammaFromK0lPt(NULL),
575  fHistoTrueSecondaryClusGammaFromLambdaPt(NULL),
576  fHistoTruePrimaryPi0PhotonPairPtconv(NULL),
577  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv(NULL),
578  fHistoTruePrimaryPi0DCPtconv(NULL),
579  fHistoTruePrimaryPi0MissingPtconv(NULL),
580  fHistoTrueSecondaryPi0PhotonPairPtconv(NULL),
581  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv(NULL),
582  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv(NULL),
583  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv(NULL),
584  fHistoTrueSecondaryPi0DCPtconvSource(NULL),
585  fHistoTrueSecondaryPi0MissingPtconvSource(NULL),
586  fVectorRecTruePi0s(0),
587  fVectorRecTrueEtas(0),
588  fHistoDoubleCountTruePi0InvMassPt(NULL),
589  fHistoDoubleCountTrueEtaInvMassPt(NULL),
590  fHistoDoubleCountTrueConvGammaRPt(NULL),
591  fHistoDoubleCountTrueClusterGammaPt(NULL),
592  fVectorDoubleCountTruePi0s(0),
593  fVectorDoubleCountTrueEtas(0),
594  fVectorDoubleCountTrueConvGammas(0),
595  fVectorDoubleCountTrueClusterGammas(0),
596  fHistoMultipleCountTruePi0(NULL),
597  fHistoMultipleCountTrueEta(NULL),
598  fHistoMultipleCountTrueConvGamma(NULL),
599  fHistoMultipleCountTrueClusterGamma(NULL),
600  fMapMultipleCountTruePi0s(),
601  fMapMultipleCountTrueEtas(),
602  fMapMultipleCountTrueConvGammas(),
603  fMapMultipleCountTrueClusterGammas(),
604  fHistoTrueClusGammaEM02(NULL),
605  fHistoTrueClusPi0EM02(NULL),
606  fHistoTruePi0InvMassECalib(NULL),
607  fHistoTruePi0PureGammaInvMassECalib(NULL),
608  fHistoNEvents(NULL),
609  fHistoNEventsWOWeight(NULL),
610  fHistoNGoodESDTracks(NULL),
611  fHistoVertexZ(NULL),
612  fHistoVertexX(NULL),
613  fHistoVertexY(NULL),
614  fHistoNGammaCandidates(NULL),
615  fHistoNGoodESDTracksVsNGammaCandidates(NULL),
616  fHistoSPDClusterTrackletBackground(NULL),
617  fHistoNV0Tracks(NULL),
618  fProfileEtaShift(NULL),
619  fProfileJetJetXSection(NULL),
620  fHistoJetJetNTrials(NULL),
621 // fHistoTruePi0NonLinearity(NULL),
622 // fHistoTrueEtaNonLinearity(NULL),
623  fEventPlaneAngle(-100),
624  fRandom(0),
625  fNGammaCandidates(0),
626  fUnsmearedPx(NULL),
627  fUnsmearedPy(NULL),
628  fUnsmearedPz(NULL),
629  fUnsmearedE(NULL),
630  fMCEventPos(NULL),
631  fMCEventNeg(NULL),
632  fESDArrayPos(NULL),
633  fESDArrayNeg(NULL),
634  fnCuts(0),
635  fiCut(0),
636  fMoveParticleAccordingToVertex(kTRUE),
637  fIsHeavyIon(0),
638  fDoLightOutput(kFALSE),
639  fDoMesonAnalysis(kTRUE),
640  fDoMesonQA(0),
641  fDoPhotonQA(0),
642  fDoClusterQA(0),
643  fIsFromDesiredHeader(kTRUE),
644  fIsOverlappingWithOtherHeader(kFALSE),
645  fIsMC(0),
646  fDoTHnSparse(kTRUE),
647  fSetPlotHistsExtQA(kFALSE),
648  fWeightJetJetMC(1),
649  fDoConvGammaShowerShapeTree(kFALSE),
650  fEnableSortForClusMC(kFALSE),
651  fDoPrimaryTrackMatching(kFALSE),
652  fDoInvMassShowerShapeTree(kFALSE),
653  tBrokenFiles(NULL),
654  fFileNameBroken(NULL),
655  fAllowOverlapHeaders(kTRUE),
656  fTrackMatcherRunningMode(0)
657 {
658  // Define output slots here
659  DefineOutput(1, TList::Class());
660  DefineOutput(2, TTree::Class());
661  DefineOutput(3, TTree::Class());
662  DefineOutput(4, TTree::Class());
663  DefineOutput(5, TTree::Class());
664  DefineOutput(6, TTree::Class());
665  DefineOutput(7, TTree::Class());
666 }
667 
669 {
670  if(fGammaCandidates){
671  delete fGammaCandidates;
672  fGammaCandidates = 0x0;
673  }
674  if(fClusterCandidates){
675  delete fClusterCandidates;
676  fClusterCandidates = 0x0;
677  }
678  if(fBGHandler){
679  delete[] fBGHandler;
680  fBGHandler = 0x0;
681  }
682  if(fBGHandlerRP){
683  delete[] fBGHandlerRP;
684  fBGHandlerRP = 0x0;
685  }
686  if(fBGClusHandler){
687  delete[] fBGClusHandler;
688  fBGClusHandler = 0x0;
689  }
690  if(fBGClusHandlerRP){
691  delete[] fBGClusHandlerRP;
692  fBGClusHandlerRP = 0x0;
693  }
694 }
695 //___________________________________________________________
697 
698  const Int_t nDim = 4;
699  Int_t nBins[nDim] = {800,300,7,4};
700  Double_t xMin[nDim] = {0,0, 0,0};
701  Double_t xMax[nDim] = {0.8,30,7,4};
702 
703  if(fDoTHnSparse){
704  fSparseMotherInvMassPtZM = new THnSparseF*[fnCuts];
705  fSparseMotherBackInvMassPtZM = new THnSparseF*[fnCuts];
706  }
707 
710 
713 
714  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
715  if (((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
716  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
717  TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
718  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
719  TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
720 
721  Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(0,1));
722  Int_t centMin = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(1,1));
723  Int_t centMax = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(2,1));
724 
725  if(collisionSystem == 1 || collisionSystem == 2 ||
726  collisionSystem == 5 || collisionSystem == 8 ||
727  collisionSystem == 9){
728  centMin = centMin*10;
729  centMax = centMax*10;
730  if(centMax ==0 && centMax!=centMin) centMax=100;
731  }else if(collisionSystem == 3 || collisionSystem == 6){
732  centMin = centMin*5;
733  centMax = centMax*5;
734  }else if(collisionSystem == 4 || collisionSystem == 7){
735  centMin = ((centMin*5)+45);
736  centMax = ((centMax*5)+45);
737  }
738 
739  if(fDoTHnSparse){
740  fBackList[iCut] = new TList();
741  fBackList[iCut]->SetName(Form("%s_%s_%s_%s Back histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(), cutstringMeson.Data()));
742  fBackList[iCut]->SetOwner(kTRUE);
743  fCutFolder[iCut]->Add(fBackList[iCut]);
744 
745  fSparseMotherBackInvMassPtZM[iCut] = new THnSparseF("Back_Back_InvMass_Pt_z_m", "Back_Back_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
746  fBackList[iCut]->Add(fSparseMotherBackInvMassPtZM[iCut]);
747 
748  fMotherList[iCut] = new TList();
749  fMotherList[iCut]->SetName(Form("%s_%s_%s_%s Mother histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
750  fMotherList[iCut]->SetOwner(kTRUE);
751  fCutFolder[iCut]->Add(fMotherList[iCut]);
752 
753  fSparseMotherInvMassPtZM[iCut] = new THnSparseF("Back_Mother_InvMass_Pt_z_m", "Back_Mother_InvMass_Pt_z_m",nDim,nBins,xMin,xMax);
754  fMotherList[iCut]->Add(fSparseMotherInvMassPtZM[iCut]);
755  }
756 
757  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
759  collisionSystem,centMin,centMax,
760  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
761  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity(),
762  2,8,5);
764  collisionSystem,centMin,centMax,
765  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
766  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity(),
767  2,8,5);
768  fBGHandlerRP[iCut] = NULL;
769  }else{
771  ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsHeavyIon(),
772  ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity(),
773  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents());
775  ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsHeavyIon(),
776  ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity(),
777  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents());
778  fBGHandler[iCut] = NULL;
779  }
780  }
781  }
782 }
783 //________________________________________________________________________
785 
786  fV0Reader = (AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
787  if(!fV0Reader){printf("Error: No V0 Reader");return;}// GetV0Reader
788 
789 
790  if (fIsMC == 2){
791  fDoClusterQA = 0;
792  fDoTHnSparse = kFALSE;
793  } else if (fIsMC == 3){
794  fDoTHnSparse = kFALSE;
795  }
796  // Create histograms
797  if(fOutputContainer != NULL){
798  delete fOutputContainer;
799  fOutputContainer = NULL;
800  }
801  if(fOutputContainer == NULL){
802  fOutputContainer = new TList();
803  fOutputContainer->SetOwner(kTRUE);
804  }
805 
806  // Array of current cut's gammas
807  fGammaCandidates = new TList();
808  fClusterCandidates = new TList();
809  fClusterCandidates->SetOwner(kTRUE);
810 
811  fCutFolder = new TList*[fnCuts];
812  fESDList = new TList*[fnCuts];
813 
814  if(fDoTHnSparse){
815  fBackList = new TList*[fnCuts];
816  fMotherList = new TList*[fnCuts];
817  }
818 
819  fHistoNEvents = new TH1F*[fnCuts];
820  if (fIsMC > 1){
821  fHistoNEventsWOWeight = new TH1F*[fnCuts];
822  }
823  if (fIsMC == 2){
824  fProfileJetJetXSection = new TProfile*[fnCuts];
825  fHistoJetJetNTrials = new TH1F*[fnCuts];
826  }
827  fHistoNGoodESDTracks = new TH1F*[fnCuts];
828  fHistoVertexZ = new TH1F*[fnCuts];
829  if(!fDoLightOutput){
830  fHistoVertexX = new TH1F*[fnCuts];
831  fHistoVertexY = new TH1F*[fnCuts];
832  }
833  fHistoNGammaCandidates = new TH1F*[fnCuts];
834  if(fIsHeavyIon==2) fProfileEtaShift = new TProfile*[fnCuts];
835  if(!fDoLightOutput){
838  fHistoNV0Tracks = new TH1F*[fnCuts];
839  fHistoConvGammaPt = new TH1F*[fnCuts];
840  }
841 
842  if (fDoPhotonQA == 2){
844  }
845 
846  if(fDoMesonAnalysis){
849  if(!fDoLightOutput){
856  }
857  if (fDoMesonQA > 0){
866  }
867  }
868 
870  fHistoClusGammaPt = new TH1F*[fnCuts];
871  fHistoClusGammaE = new TH1F*[fnCuts];
873  fHistoClusAllHeadersGammaPt = new TH1F*[fnCuts];
875 
877  fGammaERM02 = new TList*[fnCuts];
878  tESDGammaERM02 = new TTree*[fnCuts];
879  }
880 
884  }
885 
886  // set common binning in pT for mesons and photons
887  Int_t nBinsPt = 200;
888  Float_t binWidthPt = 0.1;
889  Float_t minPt = 0;
890  Float_t maxPt = 20;
891  Int_t nBinsQAPt = 170;
892  Float_t maxQAPt = 20;
893  Int_t nBinsClusterPt = 500;
894  Float_t minClusterPt = 0;
895  Float_t maxClusterPt = 50;
896  Double_t *arrPtBinning = new Double_t[1200];
897  Double_t *arrQAPtBinning = new Double_t[1200];
898  Double_t *arrClusPtBinning = new Double_t[1200];
899  // Set special pt binning for pp 8TeV
900  if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k8TeV ){
901  nBinsQAPt = 190;
902  maxQAPt = 40;
903  for(Int_t i=0; i<nBinsQAPt+1;i++){
904  if(i<60) arrQAPtBinning[i] = 0.05*i;
905  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
906  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
907  else if(i<190) arrQAPtBinning[i] = 20.+1.0*(i-170);
908  else arrQAPtBinning[i] = maxQAPt;
909  }
910  nBinsPt = 400;
911  minPt = 0;
912  maxPt = 40;
913  for(Int_t i=0; i<nBinsPt+1;i++){
914  arrPtBinning[i] = ((maxPt-minPt)/nBinsPt)*i;
915  }
916  nBinsClusterPt = 800;
917  minClusterPt = 0;
918  maxClusterPt = 80;
919  for(Int_t i=0; i<nBinsClusterPt+1;i++){
920  arrClusPtBinning[i] = ((maxClusterPt-minClusterPt)/nBinsClusterPt)*i;
921  }
922  // Set special pt binning for pPb 5TeV
923  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kpPb5TeV ||
925  ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k5TeV ){
926  binWidthPt = 0.05;
927  nBinsPt = 205;
928  minPt = 0;
929  maxPt = 60;
930  for(Int_t i=0; i<nBinsPt+1;i++){
931  if (i < 1) arrPtBinning[i] = 0.3*i;
932  else if(i<55) arrPtBinning[i] = 0.3+0.05*(i-1);
933  else if(i<125) arrPtBinning[i] = 3.+0.1*(i-55);
934  else if(i<165) arrPtBinning[i] = 10.+0.25*(i-125);
935  else if(i<205) arrPtBinning[i] = 20.+1.0*(i-165);
936  else arrPtBinning[i] = maxPt;
937  }
938  nBinsQAPt = 210;
939  maxQAPt = 60;
940  for(Int_t i=0; i<nBinsQAPt+1;i++){
941  if(i<60) arrQAPtBinning[i] = 0.05*i;
942  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
943  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
944  else if(i<210) arrQAPtBinning[i] = 20.+1.0*(i-170);
945  else arrQAPtBinning[i] = maxQAPt;
946  }
947  nBinsClusterPt = 301;
948  minClusterPt = 0;
949  maxClusterPt = 100;
950  for(Int_t i=0; i<nBinsClusterPt+1;i++){
951  if (i < 1) arrClusPtBinning[i] = 0.3*i;
952  else if(i<55) arrClusPtBinning[i] = 0.3+0.05*(i-1);
953  else if(i<125) arrClusPtBinning[i] = 3.+0.1*(i-55);
954  else if(i<155) arrClusPtBinning[i] = 10.+0.2*(i-125);
955  else if(i<211) arrClusPtBinning[i] = 16.+0.25*(i-155);
956  else if(i<251) arrClusPtBinning[i] = 30.+0.5*(i-211);
957  else if(i<301) arrClusPtBinning[i] = 50.+1.0*(i-251);
958  else arrClusPtBinning[i] = maxClusterPt;
959  }
960  // Set special pt binning for pp 13TeV, pPb 8TeV
961  } else if ( ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::k13TeV ||
963  nBinsPt = 335;
964  minPt = 0;
965  maxPt = 100;
966  binWidthPt = 0.05;
967  for(Int_t i=0; i<nBinsPt+1;i++){
968  if (i < 1) arrPtBinning[i] = 0.3*i;
969  else if(i<55) arrPtBinning[i] = 0.3+0.05*(i-1);
970  else if(i<225) arrPtBinning[i] = 3.+0.1*(i-55);
971  else if(i<265) arrPtBinning[i] = 20.+0.25*(i-225);
972  else if(i<305) arrPtBinning[i] = 30.+0.5*(i-265);
973  else if(i<325) arrPtBinning[i] = 50.+1.0*(i-305);
974  else if(i<335) arrPtBinning[i] = 70.+2.5*(i-325);
975  else arrPtBinning[i] = maxPt;
976  }
977  nBinsQAPt = 270;
978  maxQAPt = 100;
979  for(Int_t i=0; i<nBinsQAPt+1;i++){
980  if(i<60) arrQAPtBinning[i] = 0.05*i;
981  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
982  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
983  else if(i<210) arrQAPtBinning[i] = 20.+0.5*(i-170);
984  else if(i<270) arrQAPtBinning[i] = 40.+1.0*(i-210);
985  else arrQAPtBinning[i] = maxQAPt;
986  }
987  nBinsClusterPt = 335;
988  minClusterPt = 0;
989  maxClusterPt = 100;
990  for(Int_t i=0; i<nBinsClusterPt+1;i++){
991  if (i < 1) arrClusPtBinning[i] = 0.3*i;
992  else if(i<55) arrClusPtBinning[i] = 0.3+0.05*(i-1);
993  else if(i<225) arrClusPtBinning[i] = 3.+0.1*(i-55);
994  else if(i<265) arrClusPtBinning[i] = 20.+0.25*(i-225);
995  else if(i<305) arrClusPtBinning[i] = 30.+0.5*(i-265);
996  else if(i<325) arrClusPtBinning[i] = 50.+1.0*(i-305);
997  else if(i<335) arrClusPtBinning[i] = 70.+2.5*(i-325);
998  else arrClusPtBinning[i] = maxClusterPt;
999  }
1000  // Set special pt binning for pp 13TeV, pPb 8TeV
1001  } else if ( ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kpPb8TeV ){
1002  nBinsPt = 285;
1003  minPt = 0;
1004  maxPt = 100;
1005  binWidthPt = 0.05;
1006  for(Int_t i=0; i<nBinsPt+1;i++){
1007  if (i < 1) arrPtBinning[i] = 0.3*i;
1008  else if(i<55) arrPtBinning[i] = 0.3+0.05*(i-1);
1009  else if(i<125) arrPtBinning[i] = 3.+0.1*(i-55);
1010  else if(i<185) arrPtBinning[i] = 10.+0.25*(i-125);
1011  else if(i<235) arrPtBinning[i] = 25.+0.5*(i-185);
1012  else if(i<285) arrPtBinning[i] = 50.+1.0*(i-235);
1013  else arrPtBinning[i] = maxPt;
1014  }
1015  nBinsQAPt = 270;
1016  maxQAPt = 100;
1017  for(Int_t i=0; i<nBinsQAPt+1;i++){
1018  if(i<60) arrQAPtBinning[i] = 0.05*i;
1019  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
1020  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
1021  else if(i<210) arrQAPtBinning[i] = 20.+0.5*(i-170);
1022  else if(i<270) arrQAPtBinning[i] = 40.+1.0*(i-210);
1023  else arrQAPtBinning[i] = maxQAPt;
1024  }
1025  nBinsClusterPt = 301;
1026  minClusterPt = 0;
1027  maxClusterPt = 100;
1028  for(Int_t i=0; i<nBinsClusterPt+1;i++){
1029  if (i < 1) arrClusPtBinning[i] = 0.3*i;
1030  else if(i<55) arrClusPtBinning[i] = 0.3+0.05*(i-1);
1031  else if(i<125) arrClusPtBinning[i] = 3.+0.1*(i-55);
1032  else if(i<155) arrClusPtBinning[i] = 10.+0.2*(i-125);
1033  else if(i<211) arrClusPtBinning[i] = 16.+0.25*(i-155);
1034  else if(i<251) arrClusPtBinning[i] = 30.+0.5*(i-211);
1035  else if(i<301) arrClusPtBinning[i] = 50.+1.0*(i-251);
1036  else arrClusPtBinning[i] = maxClusterPt;
1037  }
1038  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kXeXe5440GeV ){
1039  nBinsPt = 90;
1040  minPt = 0;
1041  maxPt = 20;
1042  for(Int_t i=0; i<nBinsPt+1;i++){
1043  if (i < 1) arrPtBinning[i] = 0.3*i;
1044  else if(i<58) arrPtBinning[i] = 0.3+0.1*(i-1);
1045  else if(i<82) arrPtBinning[i] = 6.+0.25*(i-58);
1046  else if(i<90) arrPtBinning[i] = 12.+1.0*(i-82);
1047  else arrPtBinning[i] = maxPt;
1048  }
1049  nBinsQAPt = 92;
1050  maxQAPt = 20;
1051  for(Int_t i=0; i<nBinsQAPt+1;i++){
1052  if(i<60) arrQAPtBinning[i] = 0.1*i;
1053  else if(i<84) arrQAPtBinning[i] = 6.+0.25*(i-60);
1054  else if(i<92) arrQAPtBinning[i] = 12.+1.0*(i-84);
1055  else arrQAPtBinning[i] = maxQAPt;
1056  }
1057  nBinsClusterPt = 148;
1058  minClusterPt = 0;
1059  maxClusterPt = 40;
1060  for(Int_t i=0; i<nBinsClusterPt+1;i++){
1061  if (i < 1) arrClusPtBinning[i] = 0.3*i;
1062  else if(i<98) arrClusPtBinning[i] = 0.3+0.1*(i-1);
1063  else if(i<123) arrClusPtBinning[i] = 10.+0.2*(i-98);
1064  else if(i<148) arrClusPtBinning[i] = 15.+1.0*(i-123);
1065  else arrClusPtBinning[i] = maxClusterPt;
1066  }
1067  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kPbPb5TeV ){
1068  nBinsPt = 90;
1069  minPt = 0;
1070  maxPt = 20;
1071  for(Int_t i=0; i<nBinsPt+1;i++){
1072  if (i < 1) arrPtBinning[i] = 0.3*i;
1073  else if(i<58) arrPtBinning[i] = 0.3+0.1*(i-1);
1074  else if(i<82) arrPtBinning[i] = 6.+0.25*(i-58);
1075  else if(i<90) arrPtBinning[i] = 12.+1.0*(i-82);
1076  else arrPtBinning[i] = maxPt;
1077  }
1078  nBinsQAPt = 92;
1079  maxQAPt = 20;
1080  for(Int_t i=0; i<nBinsQAPt+1;i++){
1081  if(i<60) arrQAPtBinning[i] = 0.1*i;
1082  else if(i<84) arrQAPtBinning[i] = 6.+0.25*(i-60);
1083  else if(i<92) arrQAPtBinning[i] = 12.+1.0*(i-84);
1084  else arrQAPtBinning[i] = maxQAPt;
1085  }
1086  nBinsClusterPt = 148;
1087  minClusterPt = 0;
1088  maxClusterPt = 40;
1089  for(Int_t i=0; i<nBinsClusterPt+1;i++){
1090  if (i < 1) arrClusPtBinning[i] = 0.3*i;
1091  else if(i<98) arrClusPtBinning[i] = 0.3+0.1*(i-1);
1092  else if(i<123) arrClusPtBinning[i] = 10.+0.2*(i-98);
1093  else if(i<148) arrClusPtBinning[i] = 15.+1.0*(i-123);
1094  else arrClusPtBinning[i] = maxClusterPt;
1095  }
1096  // default binning
1097  } else {
1098  for(Int_t i=0; i<nBinsPt+1;i++){
1099  arrPtBinning[i] = ((maxPt-minPt)/nBinsPt)*i;
1100  }
1101  for(Int_t i=0; i<nBinsClusterPt+1;i++){
1102  arrClusPtBinning[i] = ((maxClusterPt-minClusterPt)/nBinsClusterPt)*i;
1103  }
1104  for(Int_t i=0; i<nBinsQAPt+1;i++){
1105  if(i<60) arrQAPtBinning[i] = 0.05*i;
1106  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
1107  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
1108  else arrQAPtBinning[i] = maxQAPt;
1109  }
1110  }
1111 
1112  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1113  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
1114  TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
1115  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
1116  TString cutstringMeson = "NoMesonCut";
1117  if(fDoMesonAnalysis)
1118  cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
1119 
1120  fCutFolder[iCut] = new TList();
1121  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s_%s",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1122  fCutFolder[iCut]->SetOwner(kTRUE);
1123  fOutputContainer->Add(fCutFolder[iCut]);
1124  fESDList[iCut] = new TList();
1125  fESDList[iCut]->SetName(Form("%s_%s_%s_%s ESD histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1126  fESDList[iCut]->SetOwner(kTRUE);
1127  fCutFolder[iCut]->Add(fESDList[iCut]);
1128 
1129  fHistoNEvents[iCut] = new TH1F("NEvents", "NEvents", 14, -0.5, 13.5);
1130  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
1131  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
1132  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
1133  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
1134  TString TriggerNames = "Not Trigger: ";
1135  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
1136  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
1137  }else {
1138  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
1139  }
1140  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
1141  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
1142  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
1143  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
1144  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
1145  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
1146  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
1147  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
1148  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
1149  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
1150  fESDList[iCut]->Add(fHistoNEvents[iCut]);
1151 
1152  if (fIsMC > 1){
1153  fHistoNEventsWOWeight[iCut] = new TH1F("NEventsWOWeight", "NEventsWOWeight", 14, -0.5, 13.5);
1154  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
1155  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
1156  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
1157  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
1158  TString TriggerNames = "Not Trigger: ";
1159  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
1160  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
1161  }else {
1162  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
1163  }
1164  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
1165  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
1166  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
1167  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
1168  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
1169  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
1170  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
1171  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
1172  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
1173  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
1174  fESDList[iCut]->Add(fHistoNEventsWOWeight[iCut]);
1175  }
1176 
1177  if (fIsMC == 2){
1178  fProfileJetJetXSection[iCut] = new TProfile("XSection", "XSection", 1, -0.5, 0.5);
1179  fESDList[iCut]->Add(fProfileJetJetXSection[iCut]);
1180  fHistoJetJetNTrials[iCut] = new TH1F("NTrials", "#sum{NTrials}", 1, 0, 1);
1181  fHistoJetJetNTrials[iCut]->GetXaxis()->SetBinLabel(1,"#sum{NTrials}");
1182  fESDList[iCut]->Add(fHistoJetJetNTrials[iCut]);
1183  }
1184 
1185  if(fIsHeavyIon == 1)
1186  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 4000, 0, 4000);
1187  else if(fIsHeavyIon == 2)
1188  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 400, 0, 400);
1189  else
1190  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 200, 0, 200);
1191  fHistoNGoodESDTracks[iCut]->SetXTitle("# TPC tracks");
1192  fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
1193 
1194  fHistoVertexZ[iCut] = new TH1F("VertexZ", "VertexZ", 200, -10, 10);
1195  fESDList[iCut]->Add(fHistoVertexZ[iCut]);
1196  if(!fDoLightOutput){
1197  fHistoVertexX[iCut] = new TH1F("VertexX", "VertexX", 100, -0.5, 0.5);
1198  fESDList[iCut]->Add(fHistoVertexX[iCut]);
1199  fHistoVertexY[iCut] = new TH1F("VertexY", "VertexY", 100, -0.1, 0.9);
1200  fESDList[iCut]->Add(fHistoVertexY[iCut]);
1201  }
1202 
1203  if(fIsHeavyIon == 1)
1204  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 150, 0, 150);
1205  else if(fIsHeavyIon == 2)
1206  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 50, 0, 50);
1207  else
1208  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 50, 0, 50);
1209  fHistoNGammaCandidates[iCut]->SetXTitle("# accepted #gamma_{conv}");
1210  fESDList[iCut]->Add(fHistoNGammaCandidates[iCut]);
1211 
1212  if(!fDoLightOutput){
1213  if(fIsHeavyIon == 1)
1214  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 4000, 0, 4000, 100, 0, 100);
1215  else if(fIsHeavyIon == 2)
1216  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 400, 0, 400, 50, 0, 50);
1217  else
1218  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 200, 0, 200, 50, 0, 50);
1219  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetXTitle("# TPC tracks");
1220  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetYTitle("# accepted #gamma_{conv}");
1222 
1223  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters", "SPD tracklets vs SPD clusters", 100, 0, 200, 250, 0, 1000);
1224  fESDList[iCut]->Add(fHistoSPDClusterTrackletBackground[iCut]);
1225 
1226  if(fIsHeavyIon == 1)
1227  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 30000, 0, 30000);
1228  else if(fIsHeavyIon == 2)
1229  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 2500, 0, 2500);
1230  else
1231  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 1500, 0, 1500);
1232  fHistoNV0Tracks[iCut]->SetXTitle("VZERO amp [arb. units]");
1233  fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
1234 
1235  fHistoConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt", "ESD_ConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1236  fHistoConvGammaPt[iCut]->SetXTitle("p_{T,conv}(GeV/c)");
1237  fESDList[iCut]->Add(fHistoConvGammaPt[iCut]);
1238  }
1239 
1240  if(fIsHeavyIon == 2){
1241  fProfileEtaShift[iCut] = new TProfile("Eta Shift", "Eta Shift", 1, -0.5, 0.5);
1242  fESDList[iCut]->Add(fProfileEtaShift[iCut]);
1243  }
1244 
1245  if (fIsMC > 1){
1246  fHistoNEvents[iCut]->Sumw2();
1247  fHistoNGoodESDTracks[iCut]->Sumw2();
1248  fHistoVertexZ[iCut]->Sumw2();
1249  fHistoNGammaCandidates[iCut]->Sumw2();
1250  if(!fDoLightOutput){
1251  fHistoVertexX[iCut]->Sumw2();
1252  fHistoVertexY[iCut]->Sumw2();
1254  fHistoSPDClusterTrackletBackground[iCut]->Sumw2();
1255  fHistoNV0Tracks[iCut]->Sumw2();
1256  fHistoConvGammaPt[iCut]->Sumw2();
1257  }
1258  }
1259 
1260  if (fDoPhotonQA == 2 ){
1261  fTreeConvGammaPtDcazCat[iCut] = new TTree(Form("%s_%s_%s_%s Photon DCA tree",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()), "ESD_ConvGamma_Pt_Dcaz_Cat");
1262  fTreeConvGammaPtDcazCat[iCut]->Branch("Pt",&fPtGamma,"fPtGamma/s");
1263  fTreeConvGammaPtDcazCat[iCut]->Branch("DcaZPhoton",&fDCAzPhoton,"fDCAzPhoton/S");
1264  fTreeConvGammaPtDcazCat[iCut]->Branch("cat",&fCharCatPhoton,"fCharCatPhoton/b");
1265  if (fIsMC > 1){
1266  fTreeConvGammaPtDcazCat[iCut]->Branch("weightEvent",&fWeightJetJetMC,"fWeightJetJetMC/f");
1267  }
1268  }
1269 
1270  fClusterOutputList[iCut] = new TList();
1271  fClusterOutputList[iCut]->SetName(Form("%s_%s_%s_%s Cluster Output",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1272  fClusterOutputList[iCut]->SetOwner(1);
1273  fCutFolder[iCut]->Add(fClusterOutputList[iCut]);
1274 
1275  fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt", "ClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1276  fHistoClusGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1277  fClusterOutputList[iCut]->Add(fHistoClusGammaPt[iCut]);
1278  fHistoClusGammaE[iCut] = new TH1F("ClusGamma_E", "ClusGamma_E", nBinsClusterPt, arrClusPtBinning);
1279  fHistoClusGammaE[iCut]->SetXTitle("E_{clus} (GeV)");
1280  fClusterOutputList[iCut]->Add(fHistoClusGammaE[iCut]);
1281  fHistoClusOverlapHeadersGammaPt[iCut] = new TH1F("ClusGammaOverlapHeaders_Pt", "ClusGammaOverlapHeaders_Pt", nBinsClusterPt, arrClusPtBinning);
1282  fHistoClusOverlapHeadersGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c), selected header w/ overlap");
1284  fHistoClusAllHeadersGammaPt[iCut] = new TH1F("ClusGammaAllHeaders_Pt", "ClusGammaAllHeaders_Pt", nBinsClusterPt, arrClusPtBinning);
1285  fHistoClusAllHeadersGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c), all headers");
1287  fHistoClusRejectedHeadersGammaPt[iCut] = new TH1F("ClusGammaRejectedHeaders_Pt", "ClusGammaRejectedHeaders_Pt", nBinsClusterPt, arrClusPtBinning);
1288  fHistoClusRejectedHeadersGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c), rejected headers");
1290 
1292  fGammaERM02[iCut] = new TList();
1293  fGammaERM02[iCut]->SetName(Form("%s_%s_%s_%s ConvGamma-Cluster Matched",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1294  fGammaERM02[iCut]->SetOwner(kTRUE);
1295  fCutFolder[iCut]->Add(fGammaERM02[iCut]);
1296 
1297  tESDGammaERM02[iCut] = new TTree("ESD_ConvGamma_E_ConvR_M02_M20", "ESD_ConvGamma_E_ConvR_M02_M20");
1298  tESDGammaERM02[iCut]->Branch("ClusterE",&tESDClusE,"tESDClusE/F");
1299  tESDGammaERM02[iCut]->Branch("ConvR",&tESDGammaConvR,"tESDGammaConvR/F");
1300  tESDGammaERM02[iCut]->Branch("M02",&tESDClusterM02,"tESDClusterM02/F");
1301  tESDGammaERM02[iCut]->Branch("M20",&tESDClusterM20,"tESDClusterM20/F");
1302  tESDGammaERM02[iCut]->Branch("Eta",&tESDClusterEta,"tESDClusterEta/F");
1303  tESDGammaERM02[iCut]->Branch("Phi",&tESDClusterPhi,"tESDClusterPhi/F");
1304  tESDGammaERM02[iCut]->Branch("NCells",&tESDClusterNCells,"tESDClusterNCells/F");
1305  tESDGammaERM02[iCut]->Branch("MaxECell",&tESDClusterMaxECell,"tESDClusterMaxECell/F");
1306  tESDGammaERM02[iCut]->Branch("NLM",&tESDClusterNLM,"tESDClusterNLM/F");
1307  fGammaERM02[iCut]->Add(tESDGammaERM02[iCut]);
1308  }
1309 
1311  fInvMassShowerShape[iCut] = new TList();
1312  fInvMassShowerShape[iCut]->SetName(Form("%s_%s_%s_%s InvMass_ShowerShape",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1313  fInvMassShowerShape[iCut]->SetOwner(kTRUE);
1314  fCutFolder[iCut]->Add(fInvMassShowerShape[iCut]);
1315  tESDInvMassShowerShape[iCut] = new TTree("ESD_Meson_InvMass_Pt_ClusE_ClusM02_ClusM20", "ESD_Meson_InvMass_Pt_ClusE_ClusM02_ClusM20");
1316  tESDInvMassShowerShape[iCut]->Branch("MesonInvMass",&tESDIMMesonInvMass,"tESDIMMesonInvMass/F");
1317  tESDInvMassShowerShape[iCut]->Branch("MesonPt",&tESDIMMesonPt,"tESDIMMesonPt/F");
1318  tESDInvMassShowerShape[iCut]->Branch("ClusE",&tESDIMClusE,"tESDIMClusE/F");
1319  tESDInvMassShowerShape[iCut]->Branch("ClusM02",&tESDIMClusterM02,"tESDIMClusterM02/F");
1320  tESDInvMassShowerShape[iCut]->Branch("ClusM20",&tESDIMClusterM20,"tESDIMClusterM20/F");
1321  tESDInvMassShowerShape[iCut]->Branch("ClusLeadCellID",&tESDIMClusterLeadCellID,"tESDIMClusterLeadCellID/I");
1322  if(fIsMC>0) tESDInvMassShowerShape[iCut]->Branch("ClusClassification",&tESDIMClusterClassification,"tESDIMClusterClassification/I");
1323  tESDInvMassShowerShape[iCut]->Branch("ClusMatchedTrackPt",&tESDIMClusMatchedTrackPt,"tESDIMClusMatchedTrackPt/F");
1324  tESDInvMassShowerShape[iCut]->Branch("ClusTrackDeltaEta",&tESDIMClusTrackDeltaEta,"tESDIMClusTrackDeltaEta/F");
1325  tESDInvMassShowerShape[iCut]->Branch("ClusTrackDeltaPhi",&tESDIMClusTrackDeltaPhi,"tESDIMClusTrackDeltaPhi/F");
1326  tESDInvMassShowerShape[iCut]->Branch("ClusIsoSumClusterEt",&tESDIMClusterIsoSumClusterEt,"tESDIMClusterIsoSumClusterEt/F");
1327  tESDInvMassShowerShape[iCut]->Branch("ClusIsoSumTrackEt",&tESDIMClusterIsoSumTrackEt,"tESDIMClusterIsoSumTrackEt/F");
1328  fInvMassShowerShape[iCut]->Add(tESDInvMassShowerShape[iCut]);
1329  }
1330 
1331  if (fIsMC > 1){
1332  fHistoClusGammaPt[iCut]->Sumw2();
1333  fHistoClusGammaE[iCut]->Sumw2();
1334  fHistoClusOverlapHeadersGammaPt[iCut]->Sumw2();
1335  fHistoClusAllHeadersGammaPt[iCut]->Sumw2();
1336  fHistoClusRejectedHeadersGammaPt[iCut]->Sumw2();
1337  }
1338 
1339  if(fDoMesonAnalysis){
1340  fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt", "ESD_Mother_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1341  fHistoMotherInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
1342  fHistoMotherInvMassPt[iCut]->SetYTitle("p_{T,pair} (GeV/c)");
1343  fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
1344 
1345  if(!fDoLightOutput){
1346  fHistoMotherMatchedInvMassPt[iCut] = new TH2F("ESD_MotherMatched_InvMass_Pt", "ESD_MotherMatched_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1347  fHistoMotherMatchedInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) matched conv e^{+/-}to cluster");
1348  fHistoMotherMatchedInvMassPt[iCut]->SetYTitle("p_{T,pair} (GeV/c)");
1349  fESDList[iCut]->Add(fHistoMotherMatchedInvMassPt[iCut]);
1350  }
1351 
1352  fHistoMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt", "ESD_Background_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1353  fHistoMotherBackInvMassPt[iCut]->SetXTitle("M_{inv, mxed}(GeV/c^{2})");
1354  fHistoMotherBackInvMassPt[iCut]->SetYTitle("p_{T,BG pair} (GeV/c)");
1355  fESDList[iCut]->Add(fHistoMotherBackInvMassPt[iCut]);
1356 
1357  if(!fDoLightOutput){
1358  fHistoMotherInvMassPtAlpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_Pt_Alpha", "ESD_Mother_InvMass_vs_Pt_Alpha", 800, 0, 0.8, nBinsPt, arrPtBinning);
1359  fHistoMotherInvMassPtAlpha[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
1360  fHistoMotherInvMassPtAlpha[iCut]->SetYTitle("p_{T,pair} (GeV/c)");
1361  fESDList[iCut]->Add(fHistoMotherInvMassPtAlpha[iCut]);
1362 
1363  fHistoPhotonPairPtconv[iCut] = new TH2F("ESD_Mother_InvMass_PtConv", "", 800, 0, 0.8, nBinsPt, arrPtBinning);
1364  fHistoPhotonPairPtconv[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
1365  fHistoPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
1366  fESDList[iCut]->Add(fHistoPhotonPairPtconv[iCut]);
1367 
1368  fHistoPhotonPairMixedEventPtconv[iCut] = new TH2F("ESD_Background_InvMass_PtConv", "", 800, 0, 0.8, nBinsPt, arrPtBinning);
1369  fHistoPhotonPairMixedEventPtconv[iCut]->SetXTitle("M_{inv,mixed}(GeV/c^{2})");
1370  fHistoPhotonPairMixedEventPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
1371  fESDList[iCut]->Add(fHistoPhotonPairMixedEventPtconv[iCut]);
1372  }
1373 
1374  if (fIsMC > 1){
1375  fHistoMotherInvMassPt[iCut]->Sumw2();
1376  fHistoMotherBackInvMassPt[iCut]->Sumw2();
1377  if(!fDoLightOutput){
1378  fHistoMotherMatchedInvMassPt[iCut]->Sumw2();
1379  fHistoMotherInvMassPtAlpha[iCut]->Sumw2();
1380  fHistoPhotonPairPtconv[iCut]->Sumw2();
1381  fHistoPhotonPairMixedEventPtconv[iCut]->Sumw2();
1382  }
1383  }
1384 
1385  if(!fDoLightOutput){
1386  fHistoMotherInvMassECalib[iCut] = new TH2F("ESD_Mother_InvMass_E_Calib", "ESD_Mother_InvMass_E_Calib", 800, 0, 0.8, nBinsPt, arrPtBinning);
1387  fHistoMotherInvMassECalib[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
1388  fHistoMotherInvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
1389  fESDList[iCut]->Add(fHistoMotherInvMassECalib[iCut]);
1390 
1391  fHistoMotherBackInvMassECalib[iCut] = new TH2F("ESD_Background_InvMass_E_Calib", "ESD_Background_InvMass_E_Calib", 800, 0, 0.8, nBinsPt, arrPtBinning);
1392  fHistoMotherBackInvMassECalib[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
1393  fHistoMotherBackInvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
1394  fESDList[iCut]->Add(fHistoMotherBackInvMassECalib[iCut]);
1395 
1396  if (fIsMC > 1){
1397  fHistoMotherInvMassECalib[iCut]->Sumw2();
1398  fHistoMotherBackInvMassECalib[iCut]->Sumw2();
1399  }
1400  }
1401 
1402  if (fDoMesonQA > 0 ){
1403  fHistoMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y", "ESD_MotherPi0_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1404  fHistoMotherPi0PtY[iCut]->SetXTitle("p_{T, #pi^{0} cand} (GeV/c)");
1405  fHistoMotherPi0PtY[iCut]->SetYTitle("y_{#pi^{0} cand}");
1406  fESDList[iCut]->Add(fHistoMotherPi0PtY[iCut]);
1407  fHistoMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y", "ESD_MotherEta_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1408  fHistoMotherEtaPtY[iCut]->SetXTitle("p_{T, #eta cand} (GeV/c)");
1409  fHistoMotherEtaPtY[iCut]->SetYTitle("y_{ #eta cand}");
1410  fESDList[iCut]->Add(fHistoMotherEtaPtY[iCut]);
1411  fHistoMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha", "ESD_MotherPi0_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
1412  fHistoMotherPi0PtAlpha[iCut]->SetXTitle("p_{T, #pi^{0} cand} (GeV/c)");
1413  fHistoMotherPi0PtAlpha[iCut]->SetYTitle("#alpha_{#pi^{0} cand}");
1414  fESDList[iCut]->Add(fHistoMotherPi0PtAlpha[iCut]);
1415  fHistoMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha", "ESD_MotherEta_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
1416  fHistoMotherEtaPtAlpha[iCut]->SetXTitle("p_{T, #eta cand} (GeV/c)");
1417  fHistoMotherEtaPtAlpha[iCut]->SetYTitle("#alpha_{#eta cand}");
1418  fESDList[iCut]->Add(fHistoMotherEtaPtAlpha[iCut]);
1419  fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle", "ESD_MotherPi0_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
1420  fHistoMotherPi0PtOpenAngle[iCut]->SetXTitle("p_{T, #pi^{0} cand} (GeV/c)");
1421  fHistoMotherPi0PtOpenAngle[iCut]->SetYTitle("#theta_{#pi^{0} cand}");
1422  fESDList[iCut]->Add(fHistoMotherPi0PtOpenAngle[iCut]);
1423  fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle", "ESD_MotherEta_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning, 200, 0, TMath::Pi());
1424  fHistoMotherEtaPtOpenAngle[iCut]->SetXTitle("p_{T, #eta cand} (GeV/c)");
1425  fHistoMotherEtaPtOpenAngle[iCut]->SetYTitle("#theta_{#eta cand}");
1426  fESDList[iCut]->Add(fHistoMotherEtaPtOpenAngle[iCut]);
1427  fHistoMotherPi0ConvPhotonEtaPhi[iCut] = new TH2F("ESD_MotherPi0ConvPhoton_Eta_Phi", "ConvPhoton under #pi^{0}peak", 600, 0, 2*TMath::Pi(), 200, -1, 1);
1428  fHistoMotherPi0ConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
1429  fHistoMotherPi0ConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
1430  fESDList[iCut]->Add(fHistoMotherPi0ConvPhotonEtaPhi[iCut]);
1431  fHistoMotherEtaConvPhotonEtaPhi[iCut] = new TH2F("ESD_MotherEtaConvPhoton_Eta_Phi", "ConvPhoton under #eta peak", 600, 0, 2*TMath::Pi(), 200, -1, 1);
1432  fHistoMotherEtaConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
1433  fHistoMotherEtaConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
1434  fESDList[iCut]->Add(fHistoMotherEtaConvPhotonEtaPhi[iCut]);
1435  if (fIsMC > 1){
1436  fHistoMotherPi0PtY[iCut]->Sumw2();
1437  fHistoMotherEtaPtY[iCut]->Sumw2();
1438  fHistoMotherPi0PtAlpha[iCut]->Sumw2();
1439  fHistoMotherEtaPtAlpha[iCut]->Sumw2();
1440  fHistoMotherPi0PtOpenAngle[iCut]->Sumw2();
1441  fHistoMotherEtaPtOpenAngle[iCut]->Sumw2();
1442  fHistoMotherPi0ConvPhotonEtaPhi[iCut]->Sumw2();
1443  fHistoMotherEtaConvPhotonEtaPhi[iCut]->Sumw2();
1444  }
1445  }
1446  }
1447  }
1448  if(fDoMesonAnalysis){
1449  InitBack(); // Init Background Handler
1450  }
1451 
1452  if(fIsMC>0){
1453  // MC Histogramms
1454  fMCList = new TList*[fnCuts];
1455  // True Histogramms
1456  fTrueList = new TList*[fnCuts];
1457 
1458  if(!fDoLightOutput){
1459  fHistoMCHeaders = new TH1I*[fnCuts];
1460  fHistoMCAllGammaPt = new TH1F*[fnCuts];
1461  fHistoMCAllGammaEMCALAccPt = new TH1F*[fnCuts];
1463  fHistoMCDecayGammaPi0Pt = new TH1F*[fnCuts];
1464  fHistoMCDecayGammaRhoPt = new TH1F*[fnCuts];
1465  fHistoMCDecayGammaEtaPt = new TH1F*[fnCuts];
1466  fHistoMCDecayGammaOmegaPt = new TH1F*[fnCuts];
1467  fHistoMCDecayGammaEtapPt = new TH1F*[fnCuts];
1468  fHistoMCDecayGammaPhiPt = new TH1F*[fnCuts];
1469  fHistoMCDecayGammaSigmaPt = new TH1F*[fnCuts];
1470  fHistoMCConvGammaPt = new TH1F*[fnCuts];
1472  fHistoTrueConvGammaPt = new TH1F*[fnCuts];
1475 
1477  fHistoTruePrimaryConvGammaPt = new TH1F*[fnCuts];
1484  }
1485 
1486  fHistoTrueClusGammaPt = new TH1F*[fnCuts];
1487  if(!fDoLightOutput){
1488  fHistoTrueClusConvGammaPt = new TH1F*[fnCuts];
1489  fHistoTruePrimaryClusGammaPt = new TH1F*[fnCuts];
1497  fHistoTrueClusElectronPt = new TH1F*[fnCuts];
1498  }
1501 
1502  if(!fDoLightOutput){
1506  fHistoTrueClusEMNonLeadingPt = new TH1F*[fnCuts];
1507  }
1508 
1509  if(!fDoLightOutput){
1512  }
1513 
1514  if (fDoClusterQA > 0){
1516  fHistoTrueClusMergedGammaPt = new TH1F*[fnCuts];
1518  fHistoTrueClusDalitzPt = new TH1F*[fnCuts];
1519  fHistoTrueClusDalitzMergedPt = new TH1F*[fnCuts];
1521  fHistoTrueClusShowerPt = new TH1F*[fnCuts];
1522  fHistoTrueClusSubLeadingPt = new TH1F*[fnCuts];
1523  fHistoTrueClusNMothers = new TH1F*[fnCuts];
1524  }
1525 
1526  if(fDoMesonAnalysis){
1527  fHistoMCPi0Pt = new TH1F*[fnCuts];
1528  fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
1529  fHistoMCEtaPt = new TH1F*[fnCuts];
1530  fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
1531  fHistoMCPi0InAccPt = new TH1F*[fnCuts];
1532  fHistoMCPi0WOWeightInAccPt = new TH1F*[fnCuts];
1533  fHistoMCEtaInAccPt = new TH1F*[fnCuts];
1534  fHistoMCEtaWOWeightInAccPt = new TH1F*[fnCuts];
1535  if (fIsMC > 1){
1536  fHistoMCPi0WOEvtWeightPt = new TH1F*[fnCuts];
1537  fHistoMCEtaWOEvtWeightPt = new TH1F*[fnCuts];
1540  }
1541 
1545  fHistoMCSecPi0Source = new TH1F*[fnCuts];
1546  fHistoMCSecEtaPt = new TH1F*[fnCuts];
1547  fHistoMCSecEtaSource = new TH1F*[fnCuts];
1548  if (!fDoLightOutput){
1557  }
1558 
1564  fHistoMultipleCountTruePi0 = new TH1F*[fnCuts];
1566  fHistoMultipleCountTrueEta = new TH1F*[fnCuts];
1578  if(!fDoLightOutput) {
1585  fHistoTruePrimaryPi0DCPtconv = new TH1F*[fnCuts];
1589  }
1590 
1591 
1592  if (fDoMesonQA > 0){
1593  fHistoMCPi0PtY = new TH2F*[fnCuts];
1594  fHistoMCEtaPtY = new TH2F*[fnCuts];
1595  fHistoMCPi0PtAlpha = new TH2F*[fnCuts];
1596  fHistoMCEtaPtAlpha = new TH2F*[fnCuts];
1597  if (fIsMC == 2){
1598  fHistoMCPi0PtJetPt = new TH2F*[fnCuts];
1599  fHistoMCEtaPtJetPt = new TH2F*[fnCuts];
1600  }
1601 
1602  if (fIsMC < 2){
1628  }
1629  if(fDoMesonQA > 1){
1634  }
1635  fHistoTruePi0PtY = new TH2F*[fnCuts];
1636  fHistoTrueEtaPtY = new TH2F*[fnCuts];
1643  }
1644  }
1645 
1646  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1647  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
1648  TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
1649  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
1650  TString cutstringMeson = "NoMesonCut";
1651  if(fDoMesonAnalysis)
1652  cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
1653 
1654  fMCList[iCut] = new TList();
1655  fMCList[iCut]->SetName(Form("%s_%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1656  fMCList[iCut]->SetOwner(kTRUE);
1657  fCutFolder[iCut]->Add(fMCList[iCut]);
1658  if(!fDoLightOutput){
1659  fHistoMCHeaders[iCut] = new TH1I("MC_Headers", "MC_Headers", 20, 0, 20);
1660  fMCList[iCut]->Add(fHistoMCHeaders[iCut]);
1661  fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt", "MC_AllGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1662  fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
1663  fHistoMCAllGammaEMCALAccPt[iCut] = new TH1F("MC_AllGammaEMCALAcc_Pt", "MC_AllGammaEMCALAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1664  fMCList[iCut]->Add(fHistoMCAllGammaEMCALAccPt[iCut]);
1665  fHistoMCAllSecondaryGammaPt[iCut] = new TH2F("MC_AllSecondaryGamma_Pt", "MC_AllSecondaryGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 4, -0.5, 3.5);
1666  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1667  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1668  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1669  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1670  fMCList[iCut]->Add(fHistoMCAllSecondaryGammaPt[iCut]);
1671 
1672  fHistoMCDecayGammaPi0Pt[iCut] = new TH1F("MC_DecayGammaPi0_Pt", "MC_DecayGammaPi0_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1673  fMCList[iCut]->Add(fHistoMCDecayGammaPi0Pt[iCut]);
1674  fHistoMCDecayGammaRhoPt[iCut] = new TH1F("MC_DecayGammaRho_Pt", "MC_DecayGammaRho_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1675  fMCList[iCut]->Add(fHistoMCDecayGammaRhoPt[iCut]);
1676  fHistoMCDecayGammaEtaPt[iCut] = new TH1F("MC_DecayGammaEta_Pt", "MC_DecayGammaEta_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1677  fMCList[iCut]->Add(fHistoMCDecayGammaEtaPt[iCut]);
1678  fHistoMCDecayGammaOmegaPt[iCut] = new TH1F("MC_DecayGammaOmega_Pt", "MC_DecayGammaOmmega_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1679  fMCList[iCut]->Add(fHistoMCDecayGammaOmegaPt[iCut]);
1680  fHistoMCDecayGammaEtapPt[iCut] = new TH1F("MC_DecayGammaEtap_Pt", "MC_DecayGammaEtap_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1681  fMCList[iCut]->Add(fHistoMCDecayGammaEtapPt[iCut]);
1682  fHistoMCDecayGammaPhiPt[iCut] = new TH1F("MC_DecayGammaPhi_Pt", "MC_DecayGammaPhi_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1683  fMCList[iCut]->Add(fHistoMCDecayGammaPhiPt[iCut]);
1684  fHistoMCDecayGammaSigmaPt[iCut] = new TH1F("MC_DecayGammaSigma_Pt", "MC_DecayGammaSigma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1685  fMCList[iCut]->Add(fHistoMCDecayGammaSigmaPt[iCut]);
1686  fHistoMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt", "MC_ConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1687  fMCList[iCut]->Add(fHistoMCConvGammaPt[iCut]);
1688  fHistoMCSecondaryConvGammaPt[iCut] = new TH2F("MC_SecondaryConvGamma_Pt", "MC_SecondaryConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 4, -0.5, 3.5);
1689  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1690  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1691  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1692  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1693  fMCList[iCut]->Add(fHistoMCSecondaryConvGammaPt[iCut]);
1694 
1695  if (fIsMC > 1){
1696  fHistoMCAllGammaPt[iCut]->Sumw2();
1697  fHistoMCAllGammaEMCALAccPt[iCut]->Sumw2();
1698  fHistoMCAllSecondaryGammaPt[iCut]->Sumw2();
1699  fHistoMCDecayGammaPi0Pt[iCut]->Sumw2();
1700  fHistoMCDecayGammaRhoPt[iCut]->Sumw2();
1701  fHistoMCDecayGammaEtaPt[iCut]->Sumw2();
1702  fHistoMCDecayGammaOmegaPt[iCut]->Sumw2();
1703  fHistoMCDecayGammaEtapPt[iCut]->Sumw2();
1704  fHistoMCDecayGammaPhiPt[iCut]->Sumw2();
1705  fHistoMCDecayGammaSigmaPt[iCut]->Sumw2();
1706  fHistoMCConvGammaPt[iCut]->Sumw2();
1707  fHistoMCSecondaryConvGammaPt[iCut]->Sumw2();
1708  }
1709  }
1710 
1711  if(fDoMesonAnalysis){
1712  fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt", "MC_Pi0_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1713  fHistoMCPi0Pt[iCut]->Sumw2();
1714  fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
1715  fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt", "MC_Pi0_WOWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1716  fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
1717 
1718  fHistoMCEtaPt[iCut] = new TH1F("MC_Eta_Pt", "MC_Eta_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1719  fHistoMCEtaPt[iCut]->Sumw2();
1720  fMCList[iCut]->Add(fHistoMCEtaPt[iCut]);
1721  fHistoMCEtaWOWeightPt[iCut] = new TH1F("MC_Eta_WOWeights_Pt", "MC_Eta_WOWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1722  fMCList[iCut]->Add(fHistoMCEtaWOWeightPt[iCut]);
1723 
1724  fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt", "MC_Pi0InAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1725  fHistoMCPi0InAccPt[iCut]->Sumw2();
1726  fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
1727  fHistoMCPi0WOWeightInAccPt[iCut] = new TH1F("MC_Pi0WOWeightInAcc_Pt", "MC_Pi0WOWeightInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1728  fMCList[iCut]->Add(fHistoMCPi0WOWeightInAccPt[iCut]);
1729  fHistoMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt", "MC_EtaInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1730  fHistoMCEtaInAccPt[iCut]->Sumw2();
1731  fMCList[iCut]->Add(fHistoMCEtaInAccPt[iCut]);
1732  fHistoMCEtaWOWeightInAccPt[iCut] = new TH1F("MC_EtaWOWeightInAcc_Pt", "MC_EtaWOWeightInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1733  fMCList[iCut]->Add(fHistoMCEtaWOWeightInAccPt[iCut]);
1734 
1735  if (fIsMC > 1){
1736  fHistoMCPi0WOWeightPt[iCut]->Sumw2();
1737  fHistoMCEtaWOWeightPt[iCut]->Sumw2();
1738  fHistoMCPi0WOWeightInAccPt[iCut]->Sumw2();
1739  fHistoMCEtaWOWeightInAccPt[iCut]->Sumw2();
1740  fHistoMCPi0WOEvtWeightPt[iCut] = new TH1F("MC_Pi0_WOEventWeights_Pt", "MC_Pi0_WOEventWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1741  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightPt[iCut]);
1742  fHistoMCEtaWOEvtWeightPt[iCut] = new TH1F("MC_Eta_WOEventWeights_Pt", "MC_Eta_WOEventWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1743  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightPt[iCut]);
1744  fHistoMCPi0WOEvtWeightInAccPt[iCut] = new TH1F("MC_Pi0_WOEventWeightsInAcc_Pt", "MC_Pi0_WOEventWeightsInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1745  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightInAccPt[iCut]);
1746  fHistoMCEtaWOEvtWeightInAccPt[iCut] = new TH1F("MC_Eta_WOEventWeightsInAcc_Pt", "MC_Eta_WOEventWeightsInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1747  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightInAccPt[iCut]);
1748 
1749  if (fDoMesonQA > 0 && fIsMC == 2){
1750  fHistoMCPi0PtJetPt[iCut] = new TH2F("MC_Pi0_Pt_JetPt", "MC_Pi0_Pt_JetPt", nBinsQAPt, arrQAPtBinning, 200, 0, 200);
1751  fHistoMCPi0PtJetPt[iCut]->Sumw2();
1752  fMCList[iCut]->Add(fHistoMCPi0PtJetPt[iCut]);
1753  fHistoMCEtaPtJetPt[iCut] = new TH2F("MC_Eta_Pt_JetPt", "MC_Eta_Pt_JetPt", nBinsQAPt, arrQAPtBinning, 200, 0, 200);
1754  fHistoMCEtaPtJetPt[iCut]->Sumw2();
1755  fMCList[iCut]->Add(fHistoMCEtaPtJetPt[iCut]);
1756  }
1757  }
1758  fHistoMCPrimaryPtvsSource[iCut] = new TH2F("MC_Primary_Pt_Source", "MC_Primary_Pt_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 7, -0.5, 6.5);
1759  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(1,"Pi+");
1760  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(2,"Pi-");
1761  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(3,"K+");
1762  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(4,"K-");
1763  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(5,"K0s");
1764  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(6,"K0l");
1765  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(7,"Lambda");
1766  fMCList[iCut]->Add(fHistoMCPrimaryPtvsSource[iCut]);
1767 
1768  fHistoMCSecPi0Source[iCut] = new TH1F("MC_SecPi0_Source", "MC_SecPi0_Source", 5000, 0., 5000);
1769  fMCList[iCut]->Add(fHistoMCSecPi0Source[iCut]);
1770  fHistoMCSecEtaSource[iCut] = new TH1F("MC_SecEta_Source", "MC_SecEta_Source", 5000, 0, 5000);
1771  fMCList[iCut]->Add(fHistoMCSecEtaSource[iCut]);
1772  fHistoMCSecPi0PtvsSource[iCut] = new TH2F("MC_SecPi0_Pt_Source", "MC_SecPi0_Pt_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1773  fMCList[iCut]->Add(fHistoMCSecPi0PtvsSource[iCut]);
1774  fHistoMCSecPi0InAccPtvsSource[iCut] = new TH2F("MC_SecPi0InAcc_Pt_Source", "MC_SecPi0InAcc_Pt_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1775  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtvsSource[iCut]);
1776  fHistoMCSecEtaPt[iCut] = new TH1F("MC_SecEta_Pt", "MC_SecEta_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1777  fMCList[iCut]->Add(fHistoMCSecEtaPt[iCut]);
1778 
1779  if (fIsMC == 2){
1780  fHistoMCPrimaryPtvsSource[iCut]->Sumw2();
1781  fHistoMCSecPi0PtvsSource[iCut]->Sumw2();
1782  fHistoMCSecPi0InAccPtvsSource[iCut]->Sumw2();
1783  fHistoMCSecEtaPt[iCut]->Sumw2();
1784  }
1785 
1786  // book histograms for pure MC handling of PCM-Calo dir gamma reco
1787  if (!fDoLightOutput){
1788  fHistoMCPi0PtGammaLeg[iCut] = new TH2F("MC_Pi0_PtGamma_Leg", "MC_Pi0_PtGamma_Leg", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 3, -0.5, 2.5);
1789  fHistoMCPi0PtGammaLeg[iCut]->Sumw2();
1790  fMCList[iCut]->Add(fHistoMCPi0PtGammaLeg[iCut]);
1791  fHistoMCPi0WOWeightPtGammaLeg[iCut] = new TH2F("MC_Pi0_WOWeights_PtGamma_Leg", "MC_Pi0_WOWeights_PtGamma_Leg", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 3, -0.5, 2.5);
1792  fMCList[iCut]->Add(fHistoMCPi0WOWeightPtGammaLeg[iCut]);
1793 
1794  fHistoMCPi0InAccPtGammaLeg[iCut] = new TH2F("MC_Pi0InAcc_PtGamma_Leg", "MC_Pi0InAcc_PtGamma_Leg", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 3, -0.5, 2.5);
1795  fHistoMCPi0InAccPtGammaLeg[iCut]->Sumw2();
1796  fMCList[iCut]->Add(fHistoMCPi0InAccPtGammaLeg[iCut]);
1797  fHistoMCPi0WOWeightInAccPtGammaLeg[iCut] = new TH2F("MC_Pi0WOWeightInAcc_PtGamma_Leg", "MC_Pi0WOWeightInAcc_PtGamma_Leg", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 3, -0.5, 2.5);
1798  fMCList[iCut]->Add(fHistoMCPi0WOWeightInAccPtGammaLeg[iCut]);
1799 
1800  fHistoMCSecPi0PtGamma1vsSource[iCut] = new TH2F("MC_SecPi0_PtGamma1_Source", "MC_SecPi0_PtGamma1_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1801  fMCList[iCut]->Add(fHistoMCSecPi0PtGamma1vsSource[iCut]);
1802  fHistoMCSecPi0PtGamma2vsSource[iCut] = new TH2F("MC_SecPi0_PtGamma2_Source", "MC_SecPi0_PtGamma2_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1803  fMCList[iCut]->Add(fHistoMCSecPi0PtGamma2vsSource[iCut]);
1804  fHistoMCSecPi0InAccPtGamma1vsSource[iCut] = new TH2F("MC_SecPi0InAcc_PtGamma1_Source", "MC_SecPi0InAcc_PtGamma1_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1805  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtGamma1vsSource[iCut]);
1806  fHistoMCSecPi0InAccPtGamma2vsSource[iCut] = new TH2F("MC_SecPi0InAcc_PtGamma2_Source", "MC_SecPi0InAcc_PtGamma2_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1807  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtGamma2vsSource[iCut]);
1808 
1809  if (fIsMC > 1){
1810  fHistoMCPi0WOWeightPtGammaLeg[iCut]->Sumw2();
1811  fHistoMCPi0WOWeightInAccPtGammaLeg[iCut]->Sumw2();
1812  fHistoMCSecPi0PtGamma1vsSource[iCut]->Sumw2();
1813  fHistoMCSecPi0PtGamma2vsSource[iCut]->Sumw2();
1814  fHistoMCSecPi0InAccPtGamma1vsSource[iCut]->Sumw2();
1815  fHistoMCSecPi0InAccPtGamma2vsSource[iCut]->Sumw2();
1816  }
1817  }
1818 
1819  // book additional MC QA histograms
1820  if (fDoMesonQA > 0){
1821  fHistoMCPi0PtY[iCut] = new TH2F("MC_Pi0_Pt_Y", "MC_Pi0_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1822  fHistoMCPi0PtY[iCut]->Sumw2();
1823  fMCList[iCut]->Add(fHistoMCPi0PtY[iCut]);
1824  fHistoMCEtaPtY[iCut] = new TH2F("MC_Eta_Pt_Y", "MC_Eta_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1825  fHistoMCEtaPtY[iCut]->Sumw2();
1826  fMCList[iCut]->Add(fHistoMCEtaPtY[iCut]);
1827  fHistoMCPi0PtAlpha[iCut] = new TH2F("MC_Pi0_Pt_Alpha", "MC_Pi0_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
1828  fMCList[iCut]->Add(fHistoMCPi0PtAlpha[iCut]);
1829  fHistoMCEtaPtAlpha[iCut] = new TH2F("MC_Eta_Pt_Alpha", "MC_Eta_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
1830  fMCList[iCut]->Add(fHistoMCEtaPtAlpha[iCut]);
1831 
1832  if (fIsMC == 2){
1833  fHistoMCPi0PtAlpha[iCut]->Sumw2();
1834  fHistoMCEtaPtAlpha[iCut]->Sumw2();
1835  }
1836  }
1837  }
1838 
1839  fTrueList[iCut] = new TList();
1840  fTrueList[iCut]->SetName(Form("%s_%s_%s_%s True histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1841  fTrueList[iCut]->SetOwner(kTRUE);
1842  fCutFolder[iCut]->Add(fTrueList[iCut]);
1843 
1844  if(!fDoLightOutput){
1845  fHistoTrueConvGammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt", "ESD_TrueConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1846  fHistoTrueConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1847  fTrueList[iCut]->Add(fHistoTrueConvGammaPt[iCut]);
1848 
1849  fHistoDoubleCountTrueConvGammaRPt[iCut] = new TH2F("ESD_TrueDoubleCountConvGamma_R_Pt", "ESD_TrueDoubleCountConvGamma_R_Pt", 800, 0, 200, (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1850  fHistoDoubleCountTrueConvGammaRPt[iCut]->SetXTitle("R (cm)");
1851  fHistoDoubleCountTrueConvGammaRPt[iCut]->SetYTitle("p_{T,clus} (GeV/c)");
1852  fTrueList[iCut]->Add(fHistoDoubleCountTrueConvGammaRPt[iCut]);
1853  fHistoMultipleCountTrueConvGamma[iCut] = new TH1F("ESD_TrueMultipleCountConvGamma", "ESD_TrueMultipleCountConvGamma", 10, 1, 11);
1854  fTrueList[iCut]->Add(fHistoMultipleCountTrueConvGamma[iCut]);
1855 
1856  fHistoCombinatorialPt[iCut] = new TH2F("ESD_TrueCombinatorial_Pt", "ESD_TrueCombinatorial_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1857  fHistoCombinatorialPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1858  fHistoCombinatorialPt[iCut]->SetYTitle("origin");
1859  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec+Elec");
1860  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 2,"Elec+Pion");
1861  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 3,"Elec+Kaon");
1862  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 4,"Elec+Proton");
1863  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 5,"Elec+Muon");
1864  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 6,"Pion+Pion");
1865  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 7,"Pion+Kaon");
1866  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 8,"Pion+Proton");
1867  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 9,"Pion+Muon");
1868  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(10,"Kaon+Kaon");
1869  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(11,"Kaon+Proton");
1870  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(12,"Kaon+Muon");
1871  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(13,"Proton+Proton");
1872  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(14,"Proton+Muon");
1873  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(15,"Muon+Muon");
1874  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(16,"Rest");
1875  fTrueList[iCut]->Add(fHistoCombinatorialPt[iCut]);
1876 
1877  fHistoTruePrimaryConvGammaPt[iCut] = new TH1F("ESD_TruePrimaryConvGamma_Pt", "ESD_TruePrimaryConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1878  fHistoTruePrimaryConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1879  fTrueList[iCut]->Add(fHistoTruePrimaryConvGammaPt[iCut]);
1880  fHistoTrueSecondaryConvGammaPt[iCut] = new TH2F("ESD_TrueSecondaryConvGamma_Pt", "ESD_TrueSecondaryConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 4, -0.5, 3.5);
1881  fHistoTrueSecondaryConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1882  fHistoTrueSecondaryConvGammaPt[iCut]->SetYTitle("source");
1883  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1884  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1885  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1886  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1887  fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaPt[iCut]);
1888  fHistoTrueSecondaryConvGammaMCPt[iCut] = new TH2F("ESD_TrueSecondaryConvGamma_MCPt", "ESD_TrueSecondaryConvGamma_MCPt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 4, -0.5, 3.5);
1889  fHistoTrueSecondaryConvGammaMCPt[iCut]->SetXTitle("p_{T, MC, clus} (GeV/c)");
1890  fHistoTrueSecondaryConvGammaMCPt[iCut]->SetYTitle("source");
1891  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1892  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1893  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1894  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1895  fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaMCPt[iCut]);
1896 
1897  fHistoTruePrimaryConvGammaESDPtMCPt[iCut] = new TH2F("ESD_TruePrimaryConvGammaESD_PtMCPt", "ESD_TruePrimaryConvGammaESD_PtMCPt",
1898  (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1899  fHistoTruePrimaryConvGammaESDPtMCPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1900  fHistoTruePrimaryConvGammaESDPtMCPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1902 
1903  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryConvGammaFromXFromK0sESD_MCPtPt", "ESD_TrueSecondaryConvGammaFromXFromK0sESD_MCPtPt",
1904  (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1905  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1906  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1908  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryConvGammaFromXFromK0lESD_MCPtPt", "ESD_TrueSecondaryConvGammaFromXFromK0lESD_MCPtPt",
1909  (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1910  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1911  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1913  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryConvGammaFromXFromLambdaESD_MCPtPt", "ESD_TrueSecondaryConvGammaFromXFromLambdaESD_MCPtPt",
1914  (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1915  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1916  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1918  }
1919 
1920  fHistoTrueClusGammaPt[iCut] = new TH1F("TrueClusGamma_Pt", "ESD_TrueClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1921  fHistoTrueClusGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1922  fClusterOutputList[iCut]->Add(fHistoTrueClusGammaPt[iCut]);
1923  if(!fDoLightOutput){
1924  fHistoTruePrimaryClusGammaPt[iCut] = new TH1F("TruePrimaryClusGamma_Pt", "ESD_TruePrimaryClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1925  fHistoTruePrimaryClusGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1927  fHistoTruePrimaryClusGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusGamma_Pt_MCPt", "ESD_TruePrimaryClusGamma_Pt_MCPt", nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1928  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1929  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1931  fHistoTrueClusElectronPt[iCut] = new TH1F("TrueClusElectron_Pt", "TrueElectronGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1932  fHistoTrueClusElectronPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1933  fClusterOutputList[iCut]->Add(fHistoTrueClusElectronPt[iCut]);
1934  fHistoTrueClusConvGammaPt[iCut] = new TH1F("TrueClusConvGamma_Pt", "TrueClusConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1935  fHistoTrueClusConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1937  fHistoTruePrimaryClusConvGammaPt[iCut] = new TH1F("TruePrimaryClusConvGamma_Pt", "ESD_TruePrimaryClusConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1938  fHistoTruePrimaryClusConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1940  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusConvGamma_Pt_MCPt", "ESD_TruePrimaryClusConvGamma_Pt_MCPt", nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1941  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1942  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1944 
1945  fHistoTrueSecondaryClusGammaPt[iCut] = new TH1F("TrueSecondaryClusGamma_Pt", "ESD_TrueSecondaryClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1946  fHistoTrueSecondaryClusGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1948  fHistoTrueSecondaryClusGammaFromK0sPt[iCut] = new TH1F("TrueSecondaryClusGammaFromK0s_Pt", "ESD_TrueSecondaryClusGammaFromK0s_Pt", nBinsClusterPt, arrClusPtBinning);
1949  fHistoTrueSecondaryClusGammaFromK0sPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1951  fHistoTrueSecondaryClusGammaFromK0lPt[iCut] = new TH1F("TrueSecondaryClusGammaFromK0l_Pt", "ESD_TrueSecondaryClusGammaFromK0l_Pt", nBinsClusterPt, arrClusPtBinning);
1952  fHistoTrueSecondaryClusGammaFromK0lPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1954  fHistoTrueSecondaryClusGammaFromLambdaPt[iCut] = new TH1F("TrueSecondaryClusGammaFromLambda_Pt", "ESD_TrueSecondaryClusGammaFromLambda_Pt", nBinsClusterPt, arrClusPtBinning);
1955  fHistoTrueSecondaryClusGammaFromLambdaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1957  }
1958 
1959  fHistoDoubleCountTrueClusterGammaPt[iCut] = new TH2F("TrueDoubleCountClusterGamma_Pt", "TrueDoubleCountClusterGamma_Pt", nBinsClusterPt, arrClusPtBinning, 2, 0, 2);
1960  fHistoDoubleCountTrueClusterGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1962  fHistoMultipleCountTrueClusterGamma[iCut] = new TH1F("TrueMultipleCountClusterGamma", "TrueMultipleCountClusterGamma", 10, 1, 11);
1964  if(!fDoLightOutput) {
1965  fHistoTrueNLabelsInClusPt[iCut] = new TH2F("TrueNLabelsInClus_Pt", "TrueNLabelsInClus_Pt", 100, -0.5, 99.5, nBinsClusterPt, arrClusPtBinning);
1966  fHistoTrueNLabelsInClusPt[iCut]->SetYTitle("p_{T,clus} (GeV/c)");
1968  fHistoTrueClusGammaEM02[iCut] = new TH2F("TrueClusGammaEM02", "TrueClusGammaEM02", nBinsClusterPt, arrClusPtBinning, 400, 0, 5);
1969  fClusterOutputList[iCut]->Add(fHistoTrueClusGammaEM02[iCut]);
1970  fHistoTrueClusPi0EM02[iCut] = new TH2F("TrueClusPi0EM02", "TrueClusPi0EM02", nBinsClusterPt, arrClusPtBinning, 400, 0, 5);
1971  fClusterOutputList[iCut]->Add(fHistoTrueClusPi0EM02[iCut]);
1972  fHistoTrueClusEMNonLeadingPt[iCut] = new TH1F("TrueClusEMNonLeading_Pt", "TrueClusEMNonLeading_Pt", nBinsClusterPt, arrClusPtBinning);
1973  fHistoTrueClusEMNonLeadingPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1975  }
1976 
1977 
1978  if (fIsMC > 1){
1979  if(!fDoLightOutput){
1980  fHistoTrueConvGammaPt[iCut]->Sumw2();
1981  fHistoDoubleCountTrueConvGammaRPt[iCut]->Sumw2();
1982  fHistoMultipleCountTrueConvGamma[iCut]->Sumw2();
1983  fHistoCombinatorialPt[iCut]->Sumw2();
1984  fHistoTruePrimaryConvGammaPt[iCut]->Sumw2();
1985  fHistoTrueSecondaryConvGammaPt[iCut]->Sumw2();
1986  fHistoTrueSecondaryConvGammaMCPt[iCut]->Sumw2();
1987  fHistoTruePrimaryConvGammaESDPtMCPt[iCut]->Sumw2();
1991  }
1992  fHistoTrueClusGammaPt[iCut]->Sumw2();
1993  fHistoDoubleCountTrueClusterGammaPt[iCut]->Sumw2();
1994  fHistoMultipleCountTrueClusterGamma[iCut]->Sumw2();
1995  if(!fDoLightOutput) {
1996  fHistoTruePrimaryClusGammaPt[iCut]->Sumw2();
1997  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->Sumw2();
1998  fHistoTrueNLabelsInClusPt[iCut]->Sumw2();
1999  fHistoTrueClusGammaEM02[iCut]->Sumw2();
2000  fHistoTrueClusPi0EM02[iCut]->Sumw2();
2001  fHistoTrueClusElectronPt[iCut]->Sumw2();
2002  fHistoTrueClusConvGammaPt[iCut]->Sumw2();
2003  fHistoTruePrimaryClusConvGammaPt[iCut]->Sumw2();
2005  fHistoTrueClusEMNonLeadingPt[iCut]->Sumw2();
2006  fHistoTrueSecondaryClusGammaPt[iCut]->Sumw2();
2010  }
2011  }
2012 
2013  if(!fDoLightOutput){
2014  fHistoTruePi0InvMassECalib[iCut] = new TH2F("True_Pi0_InvMass_E_Calib", "True_Pi0_InvMass_E_Calib", 800, 0, 0.8, nBinsPt, arrPtBinning);
2015  fHistoTruePi0InvMassECalib[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
2016  fHistoTruePi0InvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
2017  fESDList[iCut]->Add(fHistoTruePi0InvMassECalib[iCut]);
2018  fHistoTruePi0PureGammaInvMassECalib[iCut] = new TH2F("True_Pi0PureGamma_InvMass_E_Calib", "True_Pi0PureGamma_InvMass_E_Calib", 800, 0, 0.8, nBinsPt, arrPtBinning);
2019  fHistoTruePi0PureGammaInvMassECalib[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
2020  fHistoTruePi0PureGammaInvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
2022  }
2023 
2024  if (fDoClusterQA > 0){
2025  fHistoTrueClusConvGammaFullyPt[iCut] = new TH1F("TrueClusConvGammaFullyContained_Pt", "TrueClusConvGammaFullyContained_Pt", nBinsClusterPt, arrClusPtBinning);
2026  fHistoTrueClusConvGammaFullyPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2028  fHistoTrueClusMergedGammaPt[iCut] = new TH1F("TrueClusMergedGamma_Pt", "TrueClusMergedGamma_Pt", nBinsClusterPt, arrClusPtBinning);
2029  fHistoTrueClusMergedGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2031  fHistoTrueClusMergedPartConvGammaPt[iCut] = new TH1F("TrueClusMergedPartConvGamma_Pt", "TrueClusMergedPartConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
2032  fHistoTrueClusMergedPartConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2034  fHistoTrueClusDalitzPt[iCut] = new TH1F("TrueClusDalitz_Pt", "TrueClusDalitz_Pt", nBinsClusterPt, arrClusPtBinning);
2035  fHistoTrueClusDalitzPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2036  fClusterOutputList[iCut]->Add(fHistoTrueClusDalitzPt[iCut]);
2037  fHistoTrueClusDalitzMergedPt[iCut] = new TH1F("TrueClusDalitzMerged_Pt", "TrueClusDalitzMerged_Pt", nBinsClusterPt, arrClusPtBinning);
2038  fHistoTrueClusDalitzMergedPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2040  fHistoTrueClusPhotonFromElecMotherPt[iCut] = new TH1F("TrueClusPhotonFromElecMother_Pt", "TrueClusPhotonFromElecMother_Pt", nBinsClusterPt, arrClusPtBinning);
2041  fHistoTrueClusPhotonFromElecMotherPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2043  fHistoTrueClusShowerPt[iCut] = new TH1F("TrueClusShower_Pt", "TrueClusShower_Pt", nBinsClusterPt, arrClusPtBinning);
2044  fHistoTrueClusShowerPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2045  fClusterOutputList[iCut]->Add(fHistoTrueClusShowerPt[iCut]);
2046  fHistoTrueClusSubLeadingPt[iCut] = new TH1F("TrueClusSubleading_Pt", "TrueClusSubleading_Pt", nBinsClusterPt, arrClusPtBinning);
2047  fHistoTrueClusSubLeadingPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2049  fHistoTrueClusNMothers[iCut] = new TH1F("TrueClusNParticles", "TrueClusNParticles", 20, 0, 20);
2050  fHistoTrueClusNMothers[iCut]->SetXTitle("# particles in cluster");
2051  fClusterOutputList[iCut]->Add(fHistoTrueClusNMothers[iCut]);
2052  if (fIsMC > 1){
2053  fHistoTrueClusConvGammaFullyPt[iCut]->Sumw2();
2054  fHistoTrueClusMergedGammaPt[iCut]->Sumw2();
2055  fHistoTrueClusMergedPartConvGammaPt[iCut]->Sumw2();
2056  fHistoTrueClusDalitzPt[iCut]->Sumw2();
2057  fHistoTrueClusDalitzMergedPt[iCut]->Sumw2();
2058  fHistoTrueClusPhotonFromElecMotherPt[iCut]->Sumw2();
2059  fHistoTrueClusShowerPt[iCut]->Sumw2();
2060  fHistoTrueClusSubLeadingPt[iCut]->Sumw2();
2061  fHistoTrueClusNMothers[iCut]->Sumw2();
2062  }
2063  }
2064 
2065  if(fDoMesonAnalysis){
2066  fHistoTruePi0InvMassPt[iCut] = new TH2F("ESD_TruePi0_InvMass_Pt", "ESD_TruePi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2067  fHistoTruePi0InvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2068  fHistoTruePi0InvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2069  fTrueList[iCut]->Add(fHistoTruePi0InvMassPt[iCut]);
2070  fHistoTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueEta_InvMass_Pt", "ESD_TrueEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2071  fHistoTrueEtaInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2})");
2072  fHistoTrueEtaInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2073  fTrueList[iCut]->Add(fHistoTrueEtaInvMassPt[iCut]);
2074  fHistoTruePi0MatchedInvMassPt[iCut] = new TH2F("ESD_TruePi0_Matched_InvMass_Pt", "ESD_TruePi0_Matched_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2075  fHistoTruePi0MatchedInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2076  fHistoTruePi0MatchedInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2077  fTrueList[iCut]->Add(fHistoTruePi0MatchedInvMassPt[iCut]);
2078  fHistoTrueEtaMatchedInvMassPt[iCut] = new TH2F("ESD_TrueEta_Matched_InvMass_Pt", "ESD_TrueEta_Matched_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2079  fHistoTrueEtaMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2})");
2080  fHistoTrueEtaMatchedInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2081  fTrueList[iCut]->Add(fHistoTrueEtaMatchedInvMassPt[iCut]);
2082 
2083  fHistoDoubleCountTruePi0InvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountPi0_InvMass_Pt", "ESD_TrueDoubleCountPi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2084  fHistoDoubleCountTruePi0InvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2085  fHistoDoubleCountTruePi0InvMassPt[iCut]->SetYTitle("#pi^{0} p_{T}(GeV/c)");
2086  fTrueList[iCut]->Add(fHistoDoubleCountTruePi0InvMassPt[iCut]);
2087  fHistoMultipleCountTruePi0[iCut] = new TH1F("ESD_TrueMultipleCountPi0", "ESD_TrueMultipleCountPi0", 10, 1, 11);
2088  fHistoMultipleCountTruePi0[iCut]->SetXTitle("# number of multiple counts");
2089  fTrueList[iCut]->Add(fHistoMultipleCountTruePi0[iCut]);
2090  fHistoDoubleCountTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountEta_InvMass_Pt", "ESD_TrueDoubleCountEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2091  fHistoDoubleCountTrueEtaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2092  fHistoDoubleCountTrueEtaInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2093  fTrueList[iCut]->Add(fHistoDoubleCountTrueEtaInvMassPt[iCut]);
2094  fHistoMultipleCountTrueEta[iCut] = new TH1F("ESD_TrueMultipleCountEta", "ESD_TrueMultipleCountEta", 10, 1, 11);
2095  fHistoMultipleCountTrueEta[iCut]->SetXTitle("# number of multiple counts");
2096  fTrueList[iCut]->Add(fHistoMultipleCountTrueEta[iCut]);
2097 
2098  fHistoTruePrimaryPi0InvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_Pt", "ESD_TruePrimaryPi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2099  fHistoTruePrimaryPi0InvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}}(GeV/c^{2})");
2100  fHistoTruePrimaryPi0InvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2101  fHistoTruePrimaryPi0InvMassPt[iCut]->Sumw2();
2102  fTrueList[iCut]->Add(fHistoTruePrimaryPi0InvMassPt[iCut]);
2103 
2104  fHistoTruePrimaryEtaInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEta_InvMass_Pt", "ESD_TruePrimaryEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2105  fHistoTruePrimaryEtaInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta}(GeV/c^{2})");
2106  fHistoTruePrimaryEtaInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2107  fHistoTruePrimaryEtaInvMassPt[iCut]->Sumw2();
2108  fTrueList[iCut]->Add(fHistoTruePrimaryEtaInvMassPt[iCut]);
2109 
2110  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt", "ESD_TruePrimaryPi0W0Weights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2111  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}}(GeV/c^{2})");
2112  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2114 
2115  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEtaW0Weights_InvMass_Pt", "ESD_TruePrimaryEtaW0Weights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2116  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta}(GeV/c^{2})");
2117  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2119 
2120  fProfileTruePrimaryPi0WeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryPi0Weights_InvMass_Pt", "ESD_TruePrimaryPi0Weights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2121  fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}}(GeV/c^{2})");
2122  fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2125  fProfileTruePrimaryEtaWeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryEtaWeights_InvMass_Pt", "ESD_TruePrimaryEtaWeights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2126  fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta}(GeV/c^{2})");
2127  fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2130 
2131  fHistoTrueSecondaryPi0InvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_Pt", "ESD_TrueSecondaryPi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2132  fHistoTrueSecondaryPi0InvMassPt[iCut]->SetXTitle("M_{inv,sec #pi^{0}}(GeV/c^{2})");
2133  fHistoTrueSecondaryPi0InvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2134  fHistoTrueSecondaryPi0InvMassPt[iCut]->Sumw2();
2135  fTrueList[iCut]->Add(fHistoTrueSecondaryPi0InvMassPt[iCut]);
2136 
2137  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_Pt", "ESD_TrueSecondaryPi0FromK0s_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2138  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from K^{0}_{S}}(GeV/c^{2})");
2139  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2142  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0l_InvMass_Pt", "ESD_TrueSecondaryPi0FromK0l_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2143  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from K^{0}_{L}}(GeV/c^{2})");
2144  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2147  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromEta_InvMass_Pt", "ESD_TrueSecondaryPi0FromEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2148  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from #eta}(GeV/c^{2})");
2149  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2151  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_Pt", "ESD_TrueSecondaryPi0FromLambda_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2152  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from #Lambda}(GeV/c^{2})");
2153  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2155 
2156  if(!fDoLightOutput) {
2157  fHistoTruePrimaryPi0PhotonPairPtconv[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_PtConv", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2158  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2159  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2160  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->Sumw2();
2162 
2163  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2164  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2165  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2167 
2168  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_PtConv", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2169  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2170  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2173 
2174  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_PtConv", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2175  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2176  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2179 
2180  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0l_InvMass_PtConv", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2181  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2182  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2185 
2186  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv[iCut]= new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_PtConv", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2187  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2188  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2191 
2192  fHistoTruePrimaryPi0DCPtconv[iCut] = new TH1F("ESD_TruePrimaryPi0DC_PtConv", "", nBinsPt, arrPtBinning);
2193  fHistoTruePrimaryPi0DCPtconv[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
2194  fHistoTruePrimaryPi0DCPtconv[iCut]->Sumw2();
2195  fTrueList[iCut]->Add(fHistoTruePrimaryPi0DCPtconv[iCut]);
2196 
2197  fHistoTrueSecondaryPi0DCPtconvSource[iCut] = new TH2F("ESD_TrueSecondaryPi0DC_PtConv_Source", "", nBinsPt, arrPtBinning, 4, -0.5, 3.5);
2198  fHistoTrueSecondaryPi0DCPtconvSource[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
2199  fHistoTrueSecondaryPi0DCPtconvSource[iCut]->SetYTitle("sec. source");
2200  fHistoTrueSecondaryPi0DCPtconvSource[iCut]->Sumw2();
2202 
2203  fHistoTruePrimaryPi0MissingPtconv[iCut] = new TH1F("ESD_TruePrimaryPi0Missing_PtConv", "", nBinsPt, arrPtBinning);
2204  fHistoTruePrimaryPi0MissingPtconv[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
2205  fHistoTruePrimaryPi0MissingPtconv[iCut]->Sumw2();
2206  fTrueList[iCut]->Add(fHistoTruePrimaryPi0MissingPtconv[iCut]);
2207 
2208  fHistoTrueSecondaryPi0MissingPtconvSource[iCut] = new TH2F("ESD_TrueSecondaryPi0Missing_PtConv_Source", "", nBinsPt, arrPtBinning, 4, -0.5, 3.5);
2209  fHistoTrueSecondaryPi0MissingPtconvSource[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
2210  fHistoTrueSecondaryPi0MissingPtconvSource[iCut]->SetYTitle("sec. source");
2213 
2214  // put proper summing for JJ weights
2215  if (fIsMC > 1){
2217  }
2218  }
2219 
2220  if (fIsMC > 1){
2221  fHistoTruePi0InvMassPt[iCut]->Sumw2();
2222  fHistoTrueEtaInvMassPt[iCut]->Sumw2();
2223  fHistoTruePi0MatchedInvMassPt[iCut]->Sumw2();
2224  fHistoTrueEtaMatchedInvMassPt[iCut]->Sumw2();
2225  fHistoDoubleCountTruePi0InvMassPt[iCut]->Sumw2();
2226  fHistoMultipleCountTruePi0[iCut]->Sumw2();
2227  fHistoDoubleCountTrueEtaInvMassPt[iCut]->Sumw2();
2228  fHistoMultipleCountTrueEta[iCut]->Sumw2();
2233  }
2234 
2235  if (fDoMesonQA > 0){
2236  if (fIsMC < 2){
2237  fHistoTruePi0CaloPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloPhoton_InvMass_Pt", "ESD_TruePi0CaloPhoton_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2238  fHistoTruePi0CaloPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma #gamma");
2239  fHistoTruePi0CaloPhotonInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2240  fTrueList[iCut]->Add(fHistoTruePi0CaloPhotonInvMassPt[iCut]);
2241 
2242  fHistoTrueEtaCaloPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloPhoton_InvMass_Pt", "ESD_TrueEtaCaloPhoton_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2243  fHistoTrueEtaCaloPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma #gamma");
2244  fHistoTrueEtaCaloPhotonInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2245  fTrueList[iCut]->Add(fHistoTrueEtaCaloPhotonInvMassPt[iCut]);
2246 
2247  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhoton_InvMass_Pt", "ESD_TruePi0CaloConvertedPhoton_InvMass_Pt",
2248  800, 0, 0.8, nBinsPt, arrPtBinning);
2249  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma #gamma_{conv}");
2250  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2252 
2253  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt", "ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt",
2254  800, 0, 0.8, nBinsPt, arrPtBinning);
2255  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma #gamma_{conv,matched}");
2256  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2258 
2259  fHistoTruePi0CaloConvPhotonConvRPt[iCut] = new TH2F("ESD_TruePi0CaloConvPhoton_ConvR_PtE", "ESD_TruePi0CaloConvPhoton_ConvR_PtE", 920, 0, 460, nBinsPt, arrPtBinning);
2260  fHistoTruePi0CaloConvPhotonConvRPt[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2261  fHistoTruePi0CaloConvPhotonConvRPt[iCut]->SetYTitle("e^{#pm}p_{T}(GeV/c)");
2263 
2264  fHistoTruePi0CaloConvPhotonConvRAlpha[iCut] = new TH2F("ESD_TruePi0CaloConvPhoton_ConvR_AlphaE", "ESD_TruePi0CaloConvPhoton_ConvR_AlphaE", 920, 0, 460, 200, -1, 1);
2265  fHistoTruePi0CaloConvPhotonConvRAlpha[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2266  fHistoTruePi0CaloConvPhotonConvRAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2268 
2269  fHistoTruePi0CaloConvPhotonPtAlpha[iCut] = new TH2F("ESD_TruePi0CaloConvPhoton_PtE_AlphaE", "ESD_TruePi0CaloConvPhoton_PtE_AlphaE", nBinsPt, arrPtBinning, 200, -1, 1);
2270  fHistoTruePi0CaloConvPhotonPtAlpha[iCut]->SetXTitle("e^{#pm}p_{T}(GeV/c)");
2271  fHistoTruePi0CaloConvPhotonPtAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2273 
2274  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt", "ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt",
2275  800, 0, 0.8, nBinsPt, arrPtBinning);
2276  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma #gamma_{conv}");
2277  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2279 
2280  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt", "ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt",
2281  800, 0, 0.8, nBinsPt, arrPtBinning);
2282  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma #gamma_{conv,matched}");
2283  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2285 
2286  fHistoTrueEtaCaloConvPhotonConvRPt[iCut] = new TH2F("ESD_TrueEtaCaloConvPhoton_ConvR_PtE", "ESD_TrueEtaCaloConvPhoton_ConvR_PtE", 920, 0, 460, nBinsPt, arrPtBinning);
2287  fHistoTrueEtaCaloConvPhotonConvRPt[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2288  fHistoTrueEtaCaloConvPhotonConvRPt[iCut]->SetYTitle("e^{#pm}p_{T}(GeV/c)");
2290 
2291  fHistoTrueEtaCaloConvPhotonConvRAlpha[iCut] = new TH2F("ESD_TrueEtaCaloConvPhoton_ConvR_AlphaE", "ESD_TrueEtaCaloConvPhoton_ConvR_AlphaE", 920, 0, 460, 200, -1, 1);
2292  fHistoTrueEtaCaloConvPhotonConvRAlpha[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2293  fHistoTrueEtaCaloConvPhotonConvRAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2295 
2296  fHistoTrueEtaCaloConvPhotonPtAlpha[iCut] = new TH2F("ESD_TrueEtaCaloConvPhoton_PtE_AlphaE", "ESD_TrueEtaCaloConvPhoton_PtE_AlphaE", nBinsPt, arrPtBinning, 200, -1, 1);
2297  fHistoTrueEtaCaloConvPhotonPtAlpha[iCut]->SetXTitle("e^{#pm}p_{T}(GeV/c)");
2298  fHistoTrueEtaCaloConvPhotonPtAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2300 
2301 
2302  fHistoTruePi0CaloElectronInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloElectron_InvMass_Pt", "ESD_TruePi0CaloElectron_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2303  fHistoTruePi0CaloElectronInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma e^{#pm}");
2304  fHistoTruePi0CaloElectronInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2306  fHistoTrueEtaCaloElectronInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloElectron_InvMass_Pt", "ESD_TrueEtaCaloElectron_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2307  fHistoTrueEtaCaloElectronInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma e^{#pm}");
2308  fHistoTrueEtaCaloElectronInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2310 
2311  fHistoTruePi0CaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedCluster_InvMass_Pt", "ESD_TruePi0CaloMergedCluster_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2312  fHistoTruePi0CaloMergedClusterInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma merged cluster");
2313  fHistoTruePi0CaloMergedClusterInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2315  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedCluster_InvMass_Pt", "ESD_TrueEtaCaloMergedCluster_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2316  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma merged cluster");
2317  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2319 
2320  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloEMNonLeading_InvMass_Pt", "ESD_TrueMotherCaloEMNonLeading_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2321  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) #gamma cluster no leading EM");
2322  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2324  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt", "ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt",
2325  800, 0, 0.8, nBinsPt, arrPtBinning);
2326  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma merged cluster, part conv");
2327  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2329  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt", "ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt",
2330  800, 0, 0.8, nBinsPt, arrPtBinning);
2331  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma merged cluster, part conv");
2332  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2334 
2335  fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt", "ESD_TruePrimaryPi0_ResolPt_MCPt", 500, 0.03, 25, 1000, -1., 1.);
2336  fHistoTruePrimaryPi0MCPtResolPt[iCut]->SetXTitle("#pi^{0}p_{T,MC}(GeV/c)");
2337  fHistoTruePrimaryPi0MCPtResolPt[iCut]->SetYTitle("#pi^{0}(p_{T,rec}-p_{T,MC})/p_{T,MC}()");
2338  fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
2340  fTrueList[iCut]->Add(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
2341 
2342  fHistoTruePrimaryEtaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt", "ESD_TruePrimaryEta_ResolPt_MCPt", 500, 0.03, 25, 1000, -1., 1.);
2343  fHistoTruePrimaryEtaMCPtResolPt[iCut]->SetXTitle("#eta p_{T,MC}(GeV/c)");
2344  fHistoTruePrimaryEtaMCPtResolPt[iCut]->SetYTitle("#eta (p_{T,rec}-p_{T,MC})/p_{T,MC}()");
2345  fHistoTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
2347  fTrueList[iCut]->Add(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
2348 
2349  fHistoTrueK0sWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0sWithPi0Daughter_MCPt", "ESD_TrueK0sWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2350  fHistoTrueK0sWithPi0DaughterMCPt[iCut]->SetXTitle("K^{0}_{s}p_{MC,T}(GeV/c) for K^{0}_{s}where #pi^{0}rec ");
2351  fTrueList[iCut]->Add(fHistoTrueK0sWithPi0DaughterMCPt[iCut]);
2352  fHistoTrueK0lWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0lWithPi0Daughter_MCPt", "ESD_TrueK0lWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2353  fHistoTrueK0lWithPi0DaughterMCPt[iCut]->SetXTitle("K^{0}_{s}p_{MC,T}(GeV/c) for K^{0}_{l}where #pi^{0}rec ");
2354  fTrueList[iCut]->Add(fHistoTrueK0lWithPi0DaughterMCPt[iCut]);
2355  fHistoTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt", "ESD_TrueEtaWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2356  fHistoTrueEtaWithPi0DaughterMCPt[iCut]->SetXTitle("#eta p_{MC,T}(GeV/c) for #eta where #pi^{0}rec ");
2357  fTrueList[iCut]->Add(fHistoTrueEtaWithPi0DaughterMCPt[iCut]);
2358  fHistoTrueLambdaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueLambdaWithPi0Daughter_MCPt", "ESD_TrueLambdaWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2359  fHistoTrueLambdaWithPi0DaughterMCPt[iCut]->SetXTitle("#Lambda p_{MC,T}(GeV/c) for #Lambda where #pi^{0}rec ");
2361  }
2362  if(fDoMesonQA>1){
2363  fHistoTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt", "ESD_TrueBckGG_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2364  fHistoTrueBckGGInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) #gamma #gamma no signal");
2365  fHistoTrueBckGGInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2366  fTrueList[iCut]->Add(fHistoTrueBckGGInvMassPt[iCut]);
2367  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut] = new TH2F("ESD_TrueBckFullMesonContained_InvMass_Pt", "ESD_TrueBckFullMesonContained_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2368  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) #gamma #gamma, calo gamma with full pi0");
2369  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2371  fHistoTrueBckAsymEClustersInvMassPt[iCut] = new TH2F("ESD_TrueBckAsymEClus_InvMass_Pt", "ESD_TrueBckAsymEClus_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2372  fHistoTrueBckAsymEClustersInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) #gamma #gamma, calo gamma >70% of pi0 energy");
2373  fHistoTrueBckAsymEClustersInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2375  fHistoTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt", "ESD_TrueBckCont_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2376  fHistoTrueBckContInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) contamination");
2377  fHistoTrueBckContInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2378  fTrueList[iCut]->Add(fHistoTrueBckContInvMassPt[iCut]);
2379  }
2380  fHistoTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y", "ESD_TruePi0_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
2381  fHistoTruePi0PtY[iCut]->SetYTitle("Y_{#pi^{0}}");
2382  fHistoTruePi0PtY[iCut]->SetXTitle("#pi^{0}p_{T}(GeV/c)");
2383  fTrueList[iCut]->Add(fHistoTruePi0PtY[iCut]);
2384  fHistoTrueEtaPtY[iCut] = new TH2F("ESD_TrueEta_Pt_Y", "ESD_TrueEta_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
2385  fHistoTrueEtaPtY[iCut]->SetYTitle("Y_{#eta}");
2386  fHistoTrueEtaPtY[iCut]->SetXTitle("#eta p_{T}(GeV/c)");
2387  fTrueList[iCut]->Add(fHistoTrueEtaPtY[iCut]);
2388  fHistoTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha", "ESD_TruePi0_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
2389  fHistoTruePi0PtAlpha[iCut]->SetYTitle("#alpha_{#pi^{0}}");
2390  fHistoTruePi0PtAlpha[iCut]->SetXTitle("#pi^{0}p_{T}(GeV/c)");
2391  fTrueList[iCut]->Add(fHistoTruePi0PtAlpha[iCut]);
2392  fHistoTrueEtaPtAlpha[iCut] = new TH2F("ESD_TrueEta_Pt_Alpha", "ESD_TrueEta_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
2393  fHistoTrueEtaPtAlpha[iCut]->SetYTitle("#alpha_{#eta}");
2394  fHistoTrueEtaPtAlpha[iCut]->SetXTitle("#eta p_{T}(GeV/c)");
2395  fTrueList[iCut]->Add(fHistoTrueEtaPtAlpha[iCut]);
2396 
2397  fHistoTruePi0PtOpenAngle[iCut] = new TH2F("ESD_TruePi0_Pt_OpenAngle", "ESD_TruePi0_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
2398  fHistoTruePi0PtOpenAngle[iCut]->SetYTitle("#theta_{#pi^{0}}");
2399  fHistoTruePi0PtOpenAngle[iCut]->SetXTitle("#pi^{0}p_{T}(GeV/c)");
2400  fTrueList[iCut]->Add(fHistoTruePi0PtOpenAngle[iCut]);
2401  fHistoTrueEtaPtOpenAngle[iCut] = new TH2F("ESD_TrueEta_Pt_OpenAngle", "ESD_TrueEta_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning, 200, 0, TMath::Pi());
2402  fHistoTrueEtaPtOpenAngle[iCut]->SetYTitle("#theta_{#eta}");
2403  fHistoTrueEtaPtOpenAngle[iCut]->SetXTitle("#eta p_{T}(GeV/c)");
2404  fTrueList[iCut]->Add(fHistoTrueEtaPtOpenAngle[iCut]);
2405 
2406  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut] = new TH2F("ESD_TrueMotherPi0ConvPhoton_Eta_Phi", "conv photons for true #pi^{0}", 600, 0, 2*TMath::Pi(), 200, -1, 1);
2407  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
2408  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
2410  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut] = new TH2F("ESD_TrueMotherEtaConvPhoton_Eta_Phi", "conv photons for true #eta", 600, 0, 2*TMath::Pi(), 200, -1, 1);
2411  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
2412  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
2414 
2415  if (fIsMC > 1){
2416  if(fDoMesonQA>1){
2417  fHistoTrueBckGGInvMassPt[iCut]->Sumw2();
2419  fHistoTrueBckAsymEClustersInvMassPt[iCut]->Sumw2();
2420  fHistoTrueBckContInvMassPt[iCut]->Sumw2();
2421  }
2422  fHistoTruePi0PtY[iCut]->Sumw2();
2423  fHistoTrueEtaPtY[iCut]->Sumw2();
2424  fHistoTruePi0PtAlpha[iCut]->Sumw2();
2425  fHistoTrueEtaPtAlpha[iCut]->Sumw2();
2426  fHistoTruePi0PtOpenAngle[iCut]->Sumw2();
2427  fHistoTrueEtaPtOpenAngle[iCut]->Sumw2();
2428  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->Sumw2();
2429  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->Sumw2();
2430  }
2431  }
2432  }
2433  }
2434  }
2435 
2440 
2441  fMapMultipleCountTruePi0s.clear();
2442  fMapMultipleCountTrueEtas.clear();
2445 
2446  fVectorRecTruePi0s.clear();
2447  fVectorRecTrueEtas.clear();
2448 
2449  if(fV0Reader)
2451  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
2452  fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
2453  if(fV0Reader)
2455  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
2456  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
2457 
2461 
2462  for(Int_t iMatcherTask = 0; iMatcherTask < 3; iMatcherTask++){
2463  AliCaloTrackMatcher* temp = (AliCaloTrackMatcher*) (AliAnalysisManager::GetAnalysisManager()->GetTask(Form("CaloTrackMatcher_%i_%i",iMatcherTask,fTrackMatcherRunningMode)));
2464  if(temp) fOutputContainer->Add(temp->GetCaloTrackMatcherHistograms());
2465  }
2466 
2467  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2468  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
2469  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
2470  fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
2471  }
2472  if(!((AliConversionPhotonCuts*)fCutArray->At(iCut))) continue;
2473  if(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms()){
2474  fCutFolder[iCut]->Add(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms());
2475  }
2476  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
2477  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
2478  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
2479  }
2480  if(fSetPlotHistsExtQA){
2481  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
2482  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms()){
2483  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms());
2484  }
2485  }
2486  if(fDoMesonAnalysis){
2487  if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
2488  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
2489  fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
2490  }
2491  }
2492  }
2493 
2494  if (fIsMC > 0){
2495  tBrokenFiles = new TTree("BrokenFiles", "BrokenFiles");
2496  tBrokenFiles->Branch("fileName",&fFileNameBroken);
2498  }
2499 
2500 
2501  PostData(1, fOutputContainer);
2502  if(fDoPhotonQA == 2){
2503  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2504  OpenFile(iCut+2);
2505  PostData(iCut+2, fTreeConvGammaPtDcazCat[iCut]);
2506  }
2507  }
2508 }
2509 //_____________________________________________________________________________
2511 {
2512  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2513  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
2514  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
2515  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
2516  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
2517  }
2518 
2519  if(fIsHeavyIon == 2){
2520  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
2521  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2522  continue; // No Eta Shift requested, continue
2523  }
2524  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
2525  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
2526  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2527  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
2528  continue;
2529  } else{
2530  printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
2531  (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
2532  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2533  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
2534  }
2535  }
2536  }
2537 
2538  return kTRUE;
2539 }
2540 //_____________________________________________________________________________
2542 {
2543  //
2544  // Called for each event
2545  //
2546  fInputEvent = InputEvent();
2547 
2548  if(fIsMC > 0) fMCEvent = MCEvent();
2549 
2550  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
2551  if(fInputEvent->IsIncompleteDAQ()==kTRUE) eventQuality = 2;// incomplete event
2552  // Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1 or because it is incomplete => abort processing of this event/file
2553  if(eventQuality == 2 || eventQuality == 3){
2554  // write out name of broken file for first event
2555  if (fIsMC > 0){
2556  if (fInputEvent->IsA()==AliESDEvent::Class()){
2557  if (((AliESDEvent*)fInputEvent)->GetEventNumberInFile() == 0){
2558  fFileNameBroken = new TObjString(Form("%s",((TString)fV0Reader->GetCurrentFileName()).Data()));
2559  if (tBrokenFiles) tBrokenFiles->Fill();
2560  delete fFileNameBroken;
2561  }
2562  }
2563  }
2564 
2565  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
2566  fHistoNEvents[iCut]->Fill(eventQuality);
2567  if (fIsMC > 1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
2568  }
2569  return;
2570  }
2571 
2572 
2573  if(fInputEvent->IsA()==AliAODEvent::Class()){
2574  fInputEvent->InitMagneticField();
2575  }
2576 
2577  fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
2578 
2579  // ------------------- BeginEvent ----------------------------
2580  AliEventplane *EventPlane = fInputEvent->GetEventplane();
2581  if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
2582  else fEventPlaneAngle=0.0;
2583 
2584  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
2585  RelabelAODPhotonCandidates(kTRUE);// In case of AODMC relabeling MC
2586  fV0Reader->RelabelAODs(kTRUE);
2587  }
2588 
2589  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
2590 
2591  fiCut = iCut;
2592 // cout << ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber() << "_" << ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber() <<
2593 // "_" << ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber() <<endl;
2594 
2595  Bool_t isRunningEMCALrelAna = kFALSE;
2596  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) isRunningEMCALrelAna = kTRUE;
2597 
2598  Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,isRunningEMCALrelAna);
2599 
2600  if(fIsMC==2){
2601  Float_t xsection = -1.;
2602  Float_t ntrials = -1.;
2603  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetXSectionAndNTrials(fMCEvent,xsection,ntrials,fInputEvent);
2604  if((xsection==-1.) || (ntrials==-1.)) AliFatal(Form("ERROR: GetXSectionAndNTrials returned invalid xsection/ntrials, periodName from V0Reader: '%s'",fV0Reader->GetPeriodName().Data()));
2605  fProfileJetJetXSection[iCut]->Fill(0.,xsection);
2606  fHistoJetJetNTrials[iCut]->Fill("#sum{NTrials}",ntrials);
2607  }
2608 
2609  if(fIsMC>0){
2610  fWeightJetJetMC = 1;
2611  // cout << fMCEvent << endl;
2612  Bool_t isMCJet = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsJetJetMCEventAccepted( fMCEvent, fWeightJetJetMC, fInputEvent );
2613  if (fIsMC == 3){
2614  Double_t weightMult = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetWeightForMultiplicity(fV0Reader->GetNumberOfPrimaryTracks());
2615  fWeightJetJetMC = fWeightJetJetMC*weightMult;
2616  }
2617  if(fIsMC==1) fWeightJetJetMC = 1;
2618  if (!isMCJet){
2619  fHistoNEvents[iCut]->Fill(10,fWeightJetJetMC);
2620  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(10);
2621  continue;
2622  }
2623  }
2624 
2625  Bool_t triggered = kTRUE;
2626 
2627  if(eventNotAccepted!= 0){
2628  fHistoNEvents[iCut]->Fill(eventNotAccepted, fWeightJetJetMC); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
2629  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventNotAccepted);
2630  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
2631  if (eventNotAccepted==3 && fIsMC > 0){
2632  triggered = kFALSE;
2633  }else {
2634  continue;
2635  }
2636  }
2637 
2638  if(eventQuality != 0 && triggered== kTRUE){// Event Not Accepted
2639  //cout << "event rejected due to: " <<eventQuality << endl;
2640  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC);
2641  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
2642  continue;
2643  }
2644 
2645  if (triggered==kTRUE){
2646  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC); // Should be 0 here
2647  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality); // Should be 0 here
2648 
2650  fHistoVertexZ[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetZ(), fWeightJetJetMC);
2651  if(!fDoLightOutput){
2652  fHistoVertexX[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetX(), fWeightJetJetMC);
2653  fHistoVertexY[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetY(), fWeightJetJetMC);
2654  fHistoSPDClusterTrackletBackground[iCut]->Fill(fInputEvent->GetMultiplicity()->GetNumberOfTracklets(),(fInputEvent->GetNumberOfITSClusters(0)+fInputEvent->GetNumberOfITSClusters(1)),fWeightJetJetMC);
2655  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A(), fWeightJetJetMC);
2656  else fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C(), fWeightJetJetMC);
2657  }
2658  }
2659 
2660  if(fIsMC>0){
2661  // Process MC Particle
2662  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
2663  if(fInputEvent->IsA()==AliESDEvent::Class()){
2664  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
2665  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
2666  fMCEvent);
2667  }
2668  else if(fInputEvent->IsA()==AliAODEvent::Class()){
2669  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
2670  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
2671  fInputEvent);
2672  }
2673 
2674  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader()){
2675  for(Int_t i = 0;i<(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
2676  TString nameBin= fHistoMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
2677  if (nameBin.CompareTo("")== 0){
2678  TString nameHeader = ((TObjString*)((TList*)((AliConvEventCuts*)fEventCutArray->At(iCut))
2679  ->GetAcceptedHeader())->At(i))->GetString();
2680  fHistoMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
2681  }
2682  }
2683  }
2684  }
2685  }
2686  if(fIsMC>0){
2687  if(fInputEvent->IsA()==AliESDEvent::Class())
2689  if(fInputEvent->IsA()==AliAODEvent::Class())
2691  }
2692 
2693  if (triggered==kFALSE) continue;
2694 
2695  // 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)
2696  ProcessClusters();// process calo clusters
2697  ProcessPhotonCandidates(); // Process this cuts gammas
2698 
2699  fHistoNGammaCandidates[iCut]->Fill(fGammaCandidates->GetEntries(),fWeightJetJetMC);
2701  if(fDoMesonAnalysis){ // Meson Analysis
2702  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC>0){
2703  fUnsmearedPx = new Double_t[fGammaCandidates->GetEntries()]; // Store unsmeared Momenta
2704  fUnsmearedPy = new Double_t[fGammaCandidates->GetEntries()];
2705  fUnsmearedPz = new Double_t[fGammaCandidates->GetEntries()];
2706  fUnsmearedE = new Double_t[fGammaCandidates->GetEntries()];
2707 
2708  for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
2709  fUnsmearedPx[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Px();
2710  fUnsmearedPy[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Py();
2711  fUnsmearedPz[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Pz();
2712  fUnsmearedE[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->E();
2713  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->SmearParticle(dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(gamma)));
2714  }
2715  }
2716 
2717  CalculatePi0Candidates(); // Combine Gammas from conversion and from calo
2718 
2719  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
2720  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
2721  CalculateBackground(); // Combinatorial Background
2722  UpdateEventByEventData(); // Store Event for mixed Events
2723  }
2724  else{
2725  CalculateBackgroundRP(); // Combinatorial Background
2726  fBGHandlerRP[iCut]->AddEvent(fGammaCandidates,fInputEvent); // Store Event for mixed Events
2727  fBGClusHandlerRP[iCut]->AddEvent(fClusterCandidates,fInputEvent); // Store Event for mixed Events
2728  }
2729  }
2730 
2731  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class()){
2732  ProcessConversionPhotonsForMissingTagsAOD(); //Count missing tags
2733  }else if (fIsMC>0 && fInputEvent->IsA()==AliESDEvent::Class()){
2734  ProcessConversionPhotonsForMissingTags(); //Count missing tags
2735  }
2736 
2737  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC>0){
2738  for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
2739  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPx(fUnsmearedPx[gamma]); // Reset Unsmeared Momenta
2740  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPy(fUnsmearedPy[gamma]);
2741  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPz(fUnsmearedPz[gamma]);
2742  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetE(fUnsmearedE[gamma]);
2743  }
2744  delete[] fUnsmearedPx; fUnsmearedPx = 0x0;
2745  delete[] fUnsmearedPy; fUnsmearedPy = 0x0;
2746  delete[] fUnsmearedPz; fUnsmearedPz = 0x0;
2747  delete[] fUnsmearedE;fUnsmearedE = 0x0;
2748  }
2749 
2750  if(fIsMC>0){
2751  fVectorRecTruePi0s.clear();
2752  fVectorRecTrueEtas.clear();
2757  }
2758  }
2759 
2760  if(fIsMC>0){
2765  }
2766 
2768 
2769  fGammaCandidates->Clear(); // delete this cuts good gammas
2770  fClusterCandidates->Clear(); // delete cluster candidates
2771  }
2772 
2773  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
2774  RelabelAODPhotonCandidates(kFALSE); // Back to ESDMC Label
2775  fV0Reader->RelabelAODs(kFALSE);
2776  }
2777 
2778  PostData(1, fOutputContainer);
2779 }
2780 
2781 //________________________________________________________________________
2783  Int_t nclus = 0;
2784  TClonesArray * arrClustersProcess = NULL;
2785  if(!fCorrTaskSetting.CompareTo("")){
2786  nclus = fInputEvent->GetNumberOfCaloClusters();
2787  } else {
2788  arrClustersProcess = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(Form("%sClustersBranch",fCorrTaskSetting.Data())));
2789  if(!arrClustersProcess)
2790  AliFatal(Form("%sClustersBranch was not found in AliAnalysisTaskGammaConvCalo! Check the correction framework settings!",fCorrTaskSetting.Data()));
2791  nclus = arrClustersProcess->GetEntries();
2792  }
2793 
2794 // cout << nclus << endl;
2795 
2796  if(nclus == 0) return;
2797 
2798  // plotting histograms on cell/tower level, only if extendedMatchAndQA > 1
2799  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FillHistogramsExtendedQA(fInputEvent,fIsMC);
2800 
2801  // match tracks to clusters
2803 
2804  // vertex
2805  Double_t vertex[3] = {0,0,0};
2806  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
2807 
2808  // Loop over EMCal clusters
2809  for(Int_t i = 0; i < nclus; i++){
2810  AliVCluster* clus = NULL;
2811  if(fInputEvent->IsA()==AliESDEvent::Class()){
2812  if(arrClustersProcess)
2813  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(i));
2814  else
2815  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
2816  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
2817  if(arrClustersProcess)
2818  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(i));
2819  else
2820  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
2821  }
2822 
2823  if (!clus) continue;
2824  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fMCEvent,fIsMC,fWeightJetJetMC,i)){
2825  if(fDoInvMassShowerShapeTree && ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedBeforeTrackMatch() ) tESDmapIsClusterAcceptedWithoutTrackMatch[i] = 1;
2826  delete clus;
2827  continue;
2828  }
2829 
2830  // TLorentzvector with cluster
2831  TLorentzVector clusterVector;
2832  clus->GetMomentum(clusterVector,vertex);
2833 
2834  TLorentzVector* tmpvec = new TLorentzVector();
2835  tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
2836 
2837  // convert to AODConversionPhoton
2838  AliAODConversionPhoton *PhotonCandidate = new AliAODConversionPhoton(tmpvec);
2839  if(!PhotonCandidate){ delete clus; delete tmpvec; continue;}
2840 
2842 
2843  // Flag Photon as CaloPhoton
2844  PhotonCandidate->SetIsCaloPhoton();
2845  PhotonCandidate->SetCaloClusterRef((Long_t)i);
2846  // get MC label
2847  if(fIsMC>0){
2848  Int_t* mclabelsCluster = clus->GetLabels();
2849  PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
2850 // cout << clus->GetNLabels() << endl;
2851  if (clus->GetNLabels()>0){
2852  for (Int_t k =0; k<(Int_t)clus->GetNLabels(); k++){
2853  if (k<50)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
2854 // Int_t pdgCode = fMCEvent->Particle(mclabelsCluster[k])->GetPdgCode();
2855 // cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
2856  }
2857  }
2858  }
2859 
2860  fIsFromDesiredHeader = kTRUE;
2862  //TString periodName = fV0Reader->GetPeriodName();
2863  // test whether largest contribution to cluster orginates in added signals
2864  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() > 0){
2865  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCEvent, fInputEvent) == 0){
2866  fIsFromDesiredHeader = kFALSE;
2867  }
2868  if (clus->GetNLabels()>1){
2869  Int_t* mclabelsCluster = clus->GetLabels();
2870  for (Int_t l = 1; l < (Int_t)clus->GetNLabels(); l++ ){
2871  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(mclabelsCluster[l], fMCEvent, fInputEvent) == 0){
2873  }
2874  }
2875  }
2876  }
2877  fHistoClusAllHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2878  if (!fIsFromDesiredHeader)
2879  fHistoClusRejectedHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2881  fHistoClusOverlapHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2882 
2884  fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2885  fHistoClusGammaE[fiCut]->Fill(PhotonCandidate->E(),fWeightJetJetMC);
2886  if(fIsMC>0){
2887  if(fInputEvent->IsA()==AliESDEvent::Class()){
2888  ProcessTrueClusterCandidates(PhotonCandidate,clus->GetM02());
2889  }else {
2890  ProcessTrueClusterCandidatesAOD(PhotonCandidate,clus->GetM02());
2891  }
2892  }
2893  fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
2894  }else{
2895  delete PhotonCandidate;
2896  }
2897 
2898  delete clus;
2899  delete tmpvec;
2900  }
2901 
2902 }
2903 
2904 //________________________________________________________________________
2906 {
2907 
2908  TParticle *Photon = NULL;
2909  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
2910  if (TruePhotonCandidate->GetCaloPhotonMCLabel(0) < 0) return;
2911  if(!fDoLightOutput) fHistoTrueNLabelsInClusPt[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
2912 
2913  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = fMCEvent->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
2914  else return;
2915 
2916  if(Photon == NULL){
2917  // cout << "no photon" << endl;
2918  return;
2919  }
2920 
2921  TruePhotonCandidate->SetCaloPhotonMCFlags(fMCEvent, fEnableSortForClusMC);
2922 
2923  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2924  Double_t mcProdVtxX = primVtxMC->GetX();
2925  Double_t mcProdVtxY = primVtxMC->GetY();
2926  Double_t mcProdVtxZ = primVtxMC->GetZ();
2927  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, TruePhotonCandidate->GetCaloPhotonMCLabel(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2928 
2929  // to get primary distrinction right put mother of conversion electron as particle to check
2930  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
2931  isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, Photon->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2932 
2933 
2934  // Fill histograms for inclusive gamma corrections
2935  // --> a) all clusters with leading real or converted photons
2936  if (TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) ){
2937  fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2938  if(!fDoLightOutput){
2939  // how many of those clusters are from converted photons
2940  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2941  fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2942  }
2943  // --> b) which of these are primary
2944  if(isPrimary){
2945  fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2946  fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC);
2947  // --> c) which are from conversions? Just additonal information
2948  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && (Photon->GetMother(0)>-1)){
2949  fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2950  fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),((TParticle*)fMCEvent->Particle(Photon->GetMother(0)))->Pt(),fWeightJetJetMC);
2951  }
2952  // --> d) how do the secondaries look like
2953  }else {
2954  Int_t secondaryClass = -1;
2955  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
2956  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhoton( Photon, fMCEvent, kTRUE);
2957  else
2958  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhoton( Photon, fMCEvent, kFALSE);
2959  // all secondaries
2960  if (secondaryClass > 0 ){
2961  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2962  }
2963  // secondaries from K0s
2964  if (secondaryClass == 2)
2965  fHistoTrueSecondaryClusGammaFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2966  // secondaries from Lambda
2967  else if (secondaryClass == 3)
2968  fHistoTrueSecondaryClusGammaFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2969  else if (secondaryClass == 5)
2970  fHistoTrueSecondaryClusGammaFromK0lPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2971  }
2972  }
2973 
2974  // How many clusters are from electrons besides conversions
2975  }else if (TruePhotonCandidate->IsLargestComponentElectron()) {
2976  if(!fDoLightOutput) fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2977  // How many clusters don't have an electromagnetic particle as leading particle
2978  }else {
2979  if(!fDoLightOutput) fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2980  }
2981 
2982  // Filling histogram for true photons: E vs M02 for paper
2983  if(!fDoLightOutput) {
2984  if ( TruePhotonCandidate->IsLargestComponentPhoton() && !TruePhotonCandidate->IsPhotonWithElecMother() &&
2985  !TruePhotonCandidate->IsMerged() && !TruePhotonCandidate->IsMergedPartConv() && !TruePhotonCandidate->IsDalitzMerged() )
2986  fHistoTrueClusGammaEM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02, fWeightJetJetMC);
2987  }
2988 
2989  // Some additional QA
2990  if (fDoClusterQA > 0){
2991  // how many of the converted photons are fully contained in the cluster
2992  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
2993  fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2994  // how often do we have merged pi0/eta...
2995  if ( (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsDalitzMerged()) || TruePhotonCandidate->IsMergedPartConv() )
2996  fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2997  // how often do we have a merged cluster with at least one conversion
2998  if (TruePhotonCandidate->IsMergedPartConv())
2999  fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3000  // how often do we reconstruct Dalitz electrons
3001  if (TruePhotonCandidate->IsDalitz())
3002  fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3003  // how often merge Dalitz decays
3004  if (TruePhotonCandidate->IsDalitzMerged())
3005  fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3006  // how often do we see Bremstrahlung
3007  if (TruePhotonCandidate->IsPhotonWithElecMother())
3008  fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3009  // how often do we see a shower in the clusters
3010  if (TruePhotonCandidate->IsShower())
3011  fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3012  // how often is the EM a subleading contributor
3013  if (TruePhotonCandidate->IsSubLeadingEM())
3014  fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3015  // how many mother particles point to the cluster
3017  }
3018 
3019  // Check if we are double counting photons
3020  Int_t motherLab = Photon->GetMother(0);
3021  if (motherLab > -1){
3022  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3024  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)0,fWeightJetJetMC);
3026  }
3027  }
3028  if ( TMath::Abs(fMCEvent->Particle(motherLab)->GetPdgCode()) == 111 &&
3029  TruePhotonCandidate->IsLargestComponentPhoton() &&
3030  TruePhotonCandidate->IsMerged() &&
3031  !TruePhotonCandidate->IsDalitzMerged() &&
3032  !TruePhotonCandidate->IsMergedPartConv()
3033  ){
3034  if(!fDoLightOutput) fHistoTrueClusPi0EM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02,fWeightJetJetMC);
3035  }
3036  Int_t grandMotherLab = fMCEvent->Particle(motherLab)->GetMother(0);
3037  if (grandMotherLab > -1){
3038  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3040  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)1,fWeightJetJetMC);
3042  }
3043  }
3044  }
3045  }
3046 
3047  return;
3048 }
3049 
3050 
3051 //________________________________________________________________________
3053 {
3054  AliAODMCParticle *Photon = NULL;
3055  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3056  if (AODMCTrackArray){
3057  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
3058  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
3059  else return;
3060  }else {
3061  AliInfo("AODMCTrackArray could not be loaded");
3062  return;
3063  }
3064 
3065  if(Photon == NULL){
3066  // cout << "no photon" << endl;
3067  return;
3068  }
3069 
3071  if(!fDoLightOutput) fHistoTrueNLabelsInClusPt[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3072 
3073  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3074  Double_t mcProdVtxX = primVtxMC->GetX();
3075  Double_t mcProdVtxY = primVtxMC->GetY();
3076  Double_t mcProdVtxZ = primVtxMC->GetZ();
3077  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3078 
3079  // to get primary distrinction right put mother of conversion electron as particle to check
3080  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3081  if (Photon->GetMother()> -1){
3082  AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
3083  isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, Mother, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3084  }
3085  }
3086 
3087  // True Photon
3088  if (TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) ){
3089  fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3090  if(!fDoLightOutput){
3091  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3092  fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3093  }
3094  if(isPrimary){
3095  fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3096  fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC);
3097  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3098  fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3099  AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
3100  fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Mother->Pt(),fWeightJetJetMC);
3101  }
3102  }else {
3103  Int_t secondaryClass = -1;
3104  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
3105  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhotonAOD( Photon, AODMCTrackArray, kTRUE);
3106  else
3107  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhotonAOD( Photon, AODMCTrackArray, kFALSE);
3108  // all secondaries
3109  if (secondaryClass > 0 ){
3110  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3111  }
3112  // secondaries from K0s
3113  if (secondaryClass == 2)
3114  fHistoTrueSecondaryClusGammaFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3115  // secondaries from Lambda
3116  else if (secondaryClass == 3)
3117  fHistoTrueSecondaryClusGammaFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3118  else if (secondaryClass == 5)
3119  fHistoTrueSecondaryClusGammaFromK0lPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3120  }
3121  }
3122 
3123  }else if (TruePhotonCandidate->IsLargestComponentElectron()) {
3124  if(!fDoLightOutput) fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3125  }else {
3126  if(!fDoLightOutput) fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3127  }
3128 
3129  if(!fDoLightOutput) {
3130  if ( TruePhotonCandidate->IsLargestComponentPhoton() && !TruePhotonCandidate->IsPhotonWithElecMother() &&
3131  !TruePhotonCandidate->IsMerged() && !TruePhotonCandidate->IsMergedPartConv() && !TruePhotonCandidate->IsDalitzMerged() )
3132  fHistoTrueClusGammaEM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02, fWeightJetJetMC);
3133  }
3134  if (fDoClusterQA > 0){
3135  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
3136  fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3137  if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
3138  fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3139  if (TruePhotonCandidate->IsMergedPartConv())
3140  fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3141  if (TruePhotonCandidate->IsDalitz())
3142  fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3143  if (TruePhotonCandidate->IsDalitzMerged())
3144  fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3145  if (TruePhotonCandidate->IsPhotonWithElecMother())
3146  fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3147  if (TruePhotonCandidate->IsShower())
3148  fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3149  if (TruePhotonCandidate->IsSubLeadingEM())
3150  fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3152 
3153  }
3154  Int_t motherLab = Photon->GetMother();
3155  if (motherLab > -1){
3156  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3158  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)0,fWeightJetJetMC);
3160  }
3161  }
3162  if(!fDoLightOutput) {
3163  if ( TMath::Abs(((AliAODMCParticle*) AODMCTrackArray->At(motherLab))->GetPdgCode()) == 111 && TruePhotonCandidate->IsLargestComponentPhoton() && TruePhotonCandidate->IsMerged() && !TruePhotonCandidate->IsDalitzMerged() && !TruePhotonCandidate->IsMergedPartConv())
3164  fHistoTrueClusPi0EM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02, fWeightJetJetMC);
3165  }
3166  Int_t grandMotherLab = ((AliAODMCParticle*) AODMCTrackArray->At(motherLab))->GetMother();
3167  if (grandMotherLab > -1){
3168  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3170  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)1,fWeightJetJetMC);
3172  }
3173  }
3174  }
3175  }
3176 
3177  return;
3178 }
3179 
3180 //________________________________________________________________________
3182 {
3183  Int_t nV0 = 0;
3184  TList *GammaCandidatesStepOne = new TList();
3185  TList *GammaCandidatesStepTwo = new TList();
3186  // Loop over Photon Candidates allocated by ReaderV1
3187  for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
3188  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
3189  if(!PhotonCandidate) continue;
3190  fIsFromDesiredHeader = kTRUE;
3191  if(fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3192  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
3193  if(isPosFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3194  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
3195  if(isNegFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3196  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromDesiredHeader = kFALSE;
3197  }
3198 
3199  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fInputEvent)) continue;
3200  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(PhotonCandidate->GetPhotonPhi(),fEventPlaneAngle)) continue;
3201  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
3202  !((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
3203  fGammaCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
3204 
3206  if(!fDoLightOutput) fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
3207  }
3208  if(fIsMC>0){
3209  if(fInputEvent->IsA()==AliESDEvent::Class())
3210  ProcessTruePhotonCandidates(PhotonCandidate);
3211  if(fInputEvent->IsA()==AliAODEvent::Class())
3212  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3213  }
3214  if (fIsFromDesiredHeader && fDoPhotonQA == 2){
3215  if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 30.){
3216  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3217  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3218  if (fIsMC > 0){
3219  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3220  } else {
3221  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3222  }
3223  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3224  }else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 30.){
3225  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3226  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3227  if (fIsMC > 0){
3228  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3229  } else {
3230  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3231  }
3232  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3233  }
3234  }
3235  }else if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
3236  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
3237  nV0++;
3238  GammaCandidatesStepOne->Add(PhotonCandidate);
3239  }else if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
3240  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
3241  GammaCandidatesStepTwo->Add(PhotonCandidate);
3242  }
3243  }
3244  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){
3245  for(Int_t i = 0;i<GammaCandidatesStepOne->GetEntries();i++){
3246  AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GammaCandidatesStepOne->At(i);
3247  if(!PhotonCandidate) continue;
3248  fIsFromDesiredHeader = kTRUE;
3249  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3250  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
3251  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
3252  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromDesiredHeader = kFALSE;
3253  }
3254  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GammaCandidatesStepOne->GetEntries())) continue;
3255  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
3256  fGammaCandidates->Add(PhotonCandidate);
3258  if(!fDoLightOutput) fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
3259  }
3260  if(fIsMC>0){
3261  if(fInputEvent->IsA()==AliESDEvent::Class())
3262  ProcessTruePhotonCandidates(PhotonCandidate);
3263  if(fInputEvent->IsA()==AliAODEvent::Class())
3264  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3265  }
3266  if (fIsFromDesiredHeader && fDoPhotonQA == 2){
3267  if (fIsHeavyIon ==1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 30.){
3268  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3269  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3270  if (fIsMC > 0){
3271  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3272  } else {
3273  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3274  }
3275  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3276  }else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 30.){
3277  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3278  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3279  if (fIsMC > 0){
3280  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3281  } else {
3282  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3283  }
3284  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3285  }
3286  }
3287  } else GammaCandidatesStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
3288  }
3289  }
3290  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
3291  for(Int_t i = 0;i<GammaCandidatesStepTwo->GetEntries();i++){
3292  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GammaCandidatesStepTwo->At(i);
3293  if(!PhotonCandidate) continue;
3294  fIsFromDesiredHeader = kTRUE;
3295  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3296  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
3297  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
3298  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromDesiredHeader = kFALSE;
3299  }
3300  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GammaCandidatesStepTwo,i)) continue;
3301  fGammaCandidates->Add(PhotonCandidate); // Add gamma to current cut TList
3303  if(!fDoLightOutput) fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
3304  }
3305  if(fIsMC>0){
3306  if(fInputEvent->IsA()==AliESDEvent::Class())
3307  ProcessTruePhotonCandidates(PhotonCandidate);
3308  if(fInputEvent->IsA()==AliAODEvent::Class())
3309  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3310  }
3311  if (fIsFromDesiredHeader && fDoPhotonQA == 2){
3312  if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 65.){
3313  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3314  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3315  if (fIsMC > 0){
3316  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3317  } else {
3318  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3319  }
3320  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3321  }else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 65.){
3322  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3323  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3324  if (fIsMC > 0){
3325  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3326  } else {
3327  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3328  }
3329  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3330  }
3331  }
3332  }
3333  }
3334 
3335  delete GammaCandidatesStepOne;
3336  GammaCandidatesStepOne = 0x0;
3337  delete GammaCandidatesStepTwo;
3338  GammaCandidatesStepTwo = 0x0;
3339 
3340 }
3341 
3342 //________________________________________________________________________
3344 {
3345  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3346  Double_t mcProdVtxX = primVtxMC->GetX();
3347  Double_t mcProdVtxY = primVtxMC->GetY();
3348  Double_t mcProdVtxZ = primVtxMC->GetZ();
3349 
3350  Double_t magField = fInputEvent->GetMagneticField();
3351  if( magField < 0.0 ){
3352  magField = 1.0;
3353  }
3354  else {
3355  magField = -1.0;
3356  }
3357 
3358  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3359  if (AODMCTrackArray == NULL) return;
3360  AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
3361  AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
3362  fCharPhotonMCInfo = 0;
3363 
3364  if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
3365  Int_t pdgCode[2] = {TMath::Abs(posDaughter->GetPdgCode()),TMath::Abs(negDaughter->GetPdgCode())};
3366 
3367  if(posDaughter->GetMother() != negDaughter->GetMother()){
3368  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3369  fCharPhotonMCInfo = 1;
3370  return;
3371  }
3372  else if(posDaughter->GetMother() == -1){
3373  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3374  fCharPhotonMCInfo = 1;
3375  return;
3376  }
3377 
3378  if(pdgCode[0]!=11 || pdgCode[1]!=11){
3379  fCharPhotonMCInfo = 1;
3380  return; //One Particle is not a electron
3381  }
3382 
3383  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()){
3384  fCharPhotonMCInfo = 1;
3385  return; // Same Charge
3386  }
3387 
3388  AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
3389  if(Photon->GetPdgCode() != 22){
3390  fCharPhotonMCInfo = 1;
3391  return; // Mother is no Photon
3392  }
3393 
3394  if(((posDaughter->GetMCProcessCode())) != 5 || ((negDaughter->GetMCProcessCode())) != 5){
3395  fCharPhotonMCInfo = 1;
3396  return;// check if the daughters come from a conversion
3397  }
3398  // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
3399 
3400 
3401 
3402  // True Photon
3404  if(!fDoLightOutput) fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3405  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueConvGammas,posDaughter->GetMother())){
3406  if(!fDoLightOutput) fHistoDoubleCountTrueConvGammaRPt[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3407  FillMultipleCountMap(fMapMultipleCountTrueConvGammas,posDaughter->GetMother());
3408  }
3409  }
3410 
3411  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3412  if(isPrimary){
3413  // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
3415  fCharPhotonMCInfo = 6;
3416  if(!fDoLightOutput){
3417  fHistoTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3418  fHistoTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC); // Allways Filled
3419  }
3420  }
3421  // (Not Filled for i6, Extra Signal Gamma (parambox) are secondary)
3422  }else {
3424 
3425  fCharPhotonMCInfo = 2;
3426  // check for secondaries from K0s
3427  if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3428  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 310){
3429  fCharPhotonMCInfo = 4;
3430  if(!fDoLightOutput){
3431  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3432  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3433  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3434  }
3435  // check for secondaries from K0l
3436  } else if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3437  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 130) {
3438  fCharPhotonMCInfo = 7;
3439  if(!fDoLightOutput){
3440  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3441  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),1.,fWeightJetJetMC);
3442  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3443  }
3444  // check for secondaries from Lambda
3445  } else if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3446  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 3122){
3447  fCharPhotonMCInfo = 5;
3448  if(!fDoLightOutput){
3449  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3450  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3451  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3452  }
3453  } else if (((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3454  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 221) {
3455  fCharPhotonMCInfo = 3;
3456  if(!fDoLightOutput){
3457  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3458  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3459  }
3460  } else {
3461  if(!fDoLightOutput){
3462  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3463  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3464  }
3465  }
3466  }
3467  }
3468  TruePhotonCandidate->SetIsTrueConvertedPhoton();
3469 }
3470 
3471 //________________________________________________________________________
3473 {
3474  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3475  Double_t mcProdVtxX = primVtxMC->GetX();
3476  Double_t mcProdVtxY = primVtxMC->GetY();
3477  Double_t mcProdVtxZ = primVtxMC->GetZ();
3478 
3479  Double_t magField = fInputEvent->GetMagneticField();
3480  if( magField < 0.0 ){
3481  magField = 1.0;
3482  }
3483  else {
3484  magField = -1.0;
3485  }
3486 
3487  // Process True Photons
3488  TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCEvent);
3489  TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCEvent);
3490  fCharPhotonMCInfo = 0;
3491 
3492  if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
3493  Int_t pdgCode[2] = {TMath::Abs(posDaughter->GetPdgCode()),TMath::Abs(negDaughter->GetPdgCode())};
3494  fCharPhotonMCInfo = 1;
3495  if(posDaughter->GetMother(0) != negDaughter->GetMother(0)){
3496  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3497  return;
3498  }
3499  else if(posDaughter->GetMother(0) == -1){
3500  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3501  return;
3502  }
3503 
3504  if(pdgCode[0]!=11 || pdgCode[1]!=11) return; //One Particle is not a electron
3505 
3506  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge
3507 
3508  TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCEvent);
3509 
3510  if(Photon->GetPdgCode() != 22){
3511  return; // Mother is no Photon
3512  }
3513 
3514  if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() !=5) return;// check if the daughters come from a conversion
3515 
3516  // True Photon
3518  if(!fDoLightOutput) fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3519  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueConvGammas,posDaughter->GetMother(0))){
3520  if(!fDoLightOutput) fHistoDoubleCountTrueConvGammaRPt[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3521  FillMultipleCountMap(fMapMultipleCountTrueConvGammas,posDaughter->GetMother(0));
3522  }
3523  }
3524  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, posDaughter->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3525  if(isPrimary){
3526  // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
3528  fCharPhotonMCInfo = 6;
3529  if(!fDoLightOutput){
3530  fHistoTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3531  fHistoTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC); // Allways Filled
3532  }
3533  }
3534  // (Not Filled for i6, Extra Signal Gamma (parambox) are secondary)
3535  }else {
3536  // fill secondary histograms
3538  fCharPhotonMCInfo = 2;
3539  if( Photon->GetMother(0) > -1 && fMCEvent->Particle(Photon->GetMother(0))->GetMother(0) > -1){
3540  if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
3541  fCharPhotonMCInfo = 4;
3542  if (!fDoLightOutput){
3543  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3544  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3545  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3546  }
3547  } else if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 130) {
3548  fCharPhotonMCInfo = 7;
3549  if (!fDoLightOutput){
3550  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3551  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),1.,fWeightJetJetMC);
3552  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3553  }
3554  } else if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 3122) {
3555  fCharPhotonMCInfo = 5;
3556  if (!fDoLightOutput){
3557  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3558  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),2.,fWeightJetJetMC);
3559  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3560  }
3561  } else if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 221) {
3562  fCharPhotonMCInfo = 3;
3563  if (!fDoLightOutput){
3564  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3565  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3566  }
3567  } else {
3568  if (!fDoLightOutput){
3569  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3570  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3571  }
3572  }
3573  } else {
3574  if (!fDoLightOutput){
3575  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3576  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3577  }
3578  }
3579  }
3580  }
3581  TruePhotonCandidate->SetIsTrueConvertedPhoton();
3582  return;
3583 }
3584 //________________________________________________________________________
3586 {
3587  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3588  Double_t mcProdVtxX = primVtxMC->GetX();
3589  Double_t mcProdVtxY = primVtxMC->GetY();
3590  Double_t mcProdVtxZ = primVtxMC->GetZ();
3591 
3592  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3593  if (AODMCTrackArray == NULL) return;
3594 
3595  // Loop over all primary MC particle
3596  for(Long_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
3597 
3598  AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
3599  if (!particle) continue;
3600 
3601  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, particle, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3602  if (isPrimary) {
3603 
3604  Int_t isMCFromMBHeader = -1;
3605  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3606  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3607  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3608  }
3609 
3610  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
3611  if(!fDoLightOutput){
3612  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kFALSE)){
3613  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Gamma
3614  if (TMath::Abs(particle->Eta()) < 0.66 ){
3615  if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3616  }
3617  if(particle->GetMother() >-1){ // Meson Decay Gamma
3618  switch((static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother())))->GetPdgCode()){
3619  case 111: // Pi0
3620  fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3621  break;
3622  case 113: // Rho0
3623  fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3624  break;
3625  case 221: // Eta
3626  fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3627  break;
3628  case 223: // Omega
3629  fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3630  break;
3631  case 331: // Eta'
3632  fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3633  break;
3634  case 333: // Phi
3635  fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3636  break;
3637  case 3212: // Sigma
3638  fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3639  break;
3640  }
3641  }
3642  }
3643  }
3644  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kTRUE)){
3645  for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){
3646  AliAODMCParticle *tmpDaughter = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(daughterIndex));
3647  if(!tmpDaughter) continue;
3648  }
3649  if(!fDoLightOutput) fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3650  }
3651  // Converted MC Gamma
3652  if(fDoMesonAnalysis){
3653 
3654  Double_t mesonY = 1.e30;
3655  Double_t ratio = 0;
3656  if (particle->E() != TMath::Abs(particle->Pz())){
3657  ratio = (particle->E()+particle->Pz()) / (particle->E()-particle->Pz());
3658  }
3659  if( !(ratio <= 0) ){
3660  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3661  }
3662 
3663  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
3664  if ( particle->GetPdgCode() == 211 ){ // positve pions
3665  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., fWeightJetJetMC);
3666  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
3667  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., fWeightJetJetMC);
3668  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
3669  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., fWeightJetJetMC);
3670  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
3671  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., fWeightJetJetMC);
3672  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
3673  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., fWeightJetJetMC);
3674  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
3675  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., fWeightJetJetMC);
3676  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
3677  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., fWeightJetJetMC);
3678  }
3679  }
3680 
3681  // check neutral mesons
3683  ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3684  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
3685  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
3686  Float_t weighted= 1;
3687  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
3688  if (particle->Pt()>0.005){
3689  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, 0x0, fInputEvent);
3690  // if(particle->GetPdgCode() == 221){
3691  // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
3692  // }
3693  }
3694  }
3695  Double_t mesonY = 1.e30;
3696  Double_t ratio = 0;
3697  if (particle->E() != TMath::Abs(particle->Pz())){
3698  ratio = (particle->E()+particle->Pz()) / (particle->E()-particle->Pz());
3699  }
3700  if( !(ratio <= 0) ){
3701  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3702  }
3703  Double_t alpha = -10;
3704  if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
3705  alpha = (daughter0->E() - daughter1->E())/(daughter0->E() + daughter1->E());
3706  }
3707 
3708 
3709  if(particle->GetPdgCode() == 111){
3710  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Pi0
3711  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3712  if (!fDoLightOutput){
3713  // fill pi0 hists against gamma pt of first leg
3714  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,weighted*fWeightJetJetMC);
3715  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,fWeightJetJetMC);
3716  // fill pi0 hists against gamma pt of second leg
3717  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,weighted*fWeightJetJetMC);
3718  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,fWeightJetJetMC);
3719  // fill pi0 hists against gamma pt of both legs
3720  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,weighted*fWeightJetJetMC);
3721  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,fWeightJetJetMC);
3722  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,weighted*fWeightJetJetMC);
3723  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,fWeightJetJetMC);
3724  }
3725 
3726  if (fIsMC > 1) fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
3727  if (fDoMesonQA > 0){
3728  fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC);
3729  fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC);
3730  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3731  }
3732  }else if(particle->GetPdgCode() == 221){
3733  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Eta
3734  fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3735  if (fIsMC > 1) fHistoMCEtaWOEvtWeightPt[fiCut]->Fill(particle->Pt());
3736  if (fDoMesonQA > 0){
3737  fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC);
3738  fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC);
3739  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3740  }
3741  }
3742 
3743  // Check the acceptance for both gammas
3744  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter0,AODMCTrackArray,kFALSE) &&
3745  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter1,AODMCTrackArray,kFALSE) &&
3746  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
3747  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
3748  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
3749  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) ||
3750  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
3751  if(particle->GetPdgCode() == 111){
3752  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Pi0 with gamma in acc
3753  fHistoMCPi0WOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Pi0 with gamma in acc wo weight
3754  if(fIsMC > 1) fHistoMCPi0WOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 with gamma in acc wo any weight
3755  if (!fDoLightOutput){
3756  // fill pi0 hists against gamma pt of first leg
3757  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,weighted*fWeightJetJetMC);
3758  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,fWeightJetJetMC);
3759  // fill pi0 hists against gamma pt of second leg
3760  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,weighted*fWeightJetJetMC);
3761  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,fWeightJetJetMC);
3762  // fill pi0 hists against gamma pt of both legs
3763  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,weighted*fWeightJetJetMC);
3764  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,fWeightJetJetMC);
3765  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,weighted*fWeightJetJetMC);
3766  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,fWeightJetJetMC);
3767  }
3768  }else if(particle->GetPdgCode() == 221){
3769  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Eta with gamma in acc
3770  fHistoMCEtaWOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Eta with gamma in acc wo weight
3771  if(fIsMC > 1) fHistoMCEtaWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta with gamma in acc wo any weight
3772  }
3773  }
3774  }
3775  }
3776  }
3777  } else {
3778  // fill secondary histograms
3779  Int_t isMCFromMBHeader = -1;
3780  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3781  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3782  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3783  }
3784  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) {
3785  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kFALSE)){
3786  if (particle->GetMother() > -1) {
3787  AliAODMCParticle *tmpMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3788  if (tmpMother->GetMother() > -1) {
3789  AliAODMCParticle *tmpGrandMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(tmpMother->GetMother()));
3790  if(tmpGrandMother->GetPdgCode() == 310) {
3791  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightJetJetMC);
3792  } else if (tmpGrandMother->GetPdgCode() == 130) {
3793  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightJetJetMC);
3794  } else if (tmpGrandMother->GetPdgCode() == 3122) {
3795  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightJetJetMC);
3796  } else {
3797  if ( !(TMath::Abs(tmpMother->GetPdgCode()) == 11 && tmpGrandMother->GetPdgCode() == 22) )
3798  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3799  }
3800  } else {
3801  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3802  }
3803  } else {
3804  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3805  }
3806  }
3807 
3808  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kTRUE)){
3809  if (particle->GetMother() > -1) {
3810  AliAODMCParticle *tmpMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3811  if (tmpMother->GetMother() > -1) {
3812  AliAODMCParticle *tmpGrandMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(tmpMother->GetMother()));
3813  if(tmpGrandMother->GetPdgCode() == 310) {
3814  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightJetJetMC);
3815  } else if (tmpGrandMother->GetPdgCode() == 130) {
3816  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightJetJetMC);
3817  } else if (tmpGrandMother->GetPdgCode() == 3122) {
3818  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightJetJetMC);
3819  } else {
3820  if ( !(TMath::Abs(tmpMother->GetPdgCode()) == 11 && tmpGrandMother->GetPdgCode() == 22) )
3821  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3822  }
3823  } else {
3824  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3825  }
3826  } else {
3827  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3828  }
3829  }
3830  }
3831 
3832  if(fDoMesonAnalysis){
3833  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3834  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
3835  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
3836  AliAODMCParticle* mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3837  Int_t pdgCode = mother->GetPdgCode();
3838  if(particle->GetPdgCode() == 111){
3839  Int_t source = GetSourceClassification(111,pdgCode);
3840  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC); // All MC Pi0
3841  if (!fDoLightOutput){
3842  fHistoMCSecPi0PtGamma1vsSource[fiCut]->Fill(daughter0->Pt(),source,fWeightJetJetMC); // All MC Pi0
3843  fHistoMCSecPi0PtGamma2vsSource[fiCut]->Fill(daughter1->Pt(),source,fWeightJetJetMC); // All MC Pi0
3844  }
3845  fHistoMCSecPi0Source[fiCut]->Fill(pdgCode);
3846  }else if(particle->GetPdgCode() == 221){
3847 
3848  fHistoMCSecEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Pi0
3849  fHistoMCSecEtaSource[fiCut]->Fill(pdgCode);
3850  }
3851 
3852  // check if conversion where within acceptance
3853  if( ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter0,AODMCTrackArray,kFALSE) &&
3854  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter1,AODMCTrackArray,kFALSE) &&
3855  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
3856  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
3857  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
3858  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) ||
3859  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
3860  if (particle->GetPdgCode() == 111){
3861  Int_t source = GetSourceClassification(111,pdgCode);
3862  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC); // All MC Pi0
3863  if (!fDoLightOutput){
3864  fHistoMCSecPi0InAccPtGamma1vsSource[fiCut]->Fill(daughter0->Pt(),source,fWeightJetJetMC); // All MC Pi0
3865  fHistoMCSecPi0InAccPtGamma2vsSource[fiCut]->Fill(daughter1->Pt(),source,fWeightJetJetMC); // All MC Pi0
3866  }
3867  }
3868  }
3869  }
3870  }
3871  }
3872  }
3873  }
3874 }
3875 
3876 //________________________________________________________________________
3878 {
3879  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3880  Double_t mcProdVtxX = primVtxMC->GetX();
3881  Double_t mcProdVtxY = primVtxMC->GetY();
3882  Double_t mcProdVtxZ = primVtxMC->GetZ();
3883 // cout << mcProdVtxX <<"\t" << mcProdVtxY << "\t" << mcProdVtxZ << endl;
3884 
3885  // Loop over all primary MC particle
3886  for(Long_t i = 0; i < fMCEvent->GetNumberOfTracks(); i++) {
3887  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
3888  // fill primary histograms
3889  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
3890  if (!particle) continue;
3891 
3892  Int_t isMCFromMBHeader = -1;
3893  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3894  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3895  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3896  }
3897 
3898  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
3899  if(!fDoLightOutput){
3900  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kFALSE)){
3901  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Gamma
3902  if (TMath::Abs(particle->Eta()) < 0.66 ){
3903  if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3904  }
3905 
3906  if(particle->GetMother(0) >-1){ // Meson Decay Gamma
3907  switch(fMCEvent->Particle(particle->GetMother(0))->GetPdgCode()){
3908  case 111: // Pi0
3909  fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3910  break;
3911  case 113: // Rho0
3912  fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3913  break;
3914  case 221: // Eta
3915  fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3916  break;
3917  case 223: // Omega
3918  fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3919  break;
3920  case 331: // Eta'
3921  fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3922  break;
3923  case 333: // Phi
3924  fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3925  break;
3926  case 3212: // Sigma
3927  fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3928  break;
3929  }
3930  }
3931  }
3932  }
3933  // Converted MC Gamma
3934  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kTRUE)){
3935  if(!fDoLightOutput) fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3936  }
3937 
3938 
3939  if(fDoMesonAnalysis ){
3940 
3941  // Fill histograms for other particles
3942  Double_t mesonY = 1.e30;
3943  Double_t ratio = 0;
3944  if (particle->Energy() != TMath::Abs(particle->Pz())){
3945  ratio = (particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz());
3946  }
3947  if( !(ratio <= 0) ){
3948  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3949  }
3950 
3951  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
3952  if ( particle->GetPdgCode() == 211 ){ // positve pions
3953  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., fWeightJetJetMC);
3954  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
3955  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., fWeightJetJetMC);
3956  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
3957  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., fWeightJetJetMC);
3958  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
3959  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., fWeightJetJetMC);
3960  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
3961  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., fWeightJetJetMC);
3962  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
3963  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., fWeightJetJetMC);
3964  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
3965  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., fWeightJetJetMC);
3966  }
3967  }
3968 
3969  // check neutral mesons
3971  ->MesonIsSelectedMC(particle,fMCEvent,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3972  TParticle* daughter0 = (TParticle*)fMCEvent->Particle(particle->GetFirstDaughter());
3973  TParticle* daughter1 = (TParticle*)fMCEvent->Particle(particle->GetLastDaughter());
3974 
3975  Float_t weighted= 1;
3976  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
3977  if (particle->Pt()>0.005){
3978  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent, fInputEvent);
3979  }
3980  }
3981  Double_t mesonY = 1.e30;
3982  Double_t ratio = 0;
3983  if (particle->Energy() != TMath::Abs(particle->Pz())){
3984  ratio = (particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz());
3985  }
3986  if( !(ratio <= 0) ){
3987  me