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