AliPhysics  aaf9c62 (aaf9c62)
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 ||
958  nBinsPt = 335;
959  minPt = 0;
960  maxPt = 100;
961  binWidthPt = 0.05;
962  for(Int_t i=0; i<nBinsPt+1;i++){
963  if (i < 1) arrPtBinning[i] = 0.3*i;
964  else if(i<55) arrPtBinning[i] = 0.3+0.05*(i-1);
965  else if(i<225) arrPtBinning[i] = 3.+0.1*(i-55);
966  else if(i<265) arrPtBinning[i] = 20.+0.25*(i-225);
967  else if(i<305) arrPtBinning[i] = 30.+0.5*(i-265);
968  else if(i<325) arrPtBinning[i] = 50.+1.0*(i-305);
969  else if(i<335) arrPtBinning[i] = 70.+2.5*(i-325);
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 = 335;
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<225) arrClusPtBinning[i] = 3.+0.1*(i-55);
989  else if(i<265) arrClusPtBinning[i] = 20.+0.25*(i-225);
990  else if(i<305) arrClusPtBinning[i] = 30.+0.5*(i-265);
991  else if(i<325) arrClusPtBinning[i] = 50.+1.0*(i-305);
992  else if(i<335) arrClusPtBinning[i] = 70.+2.5*(i-325);
993  else arrClusPtBinning[i] = maxClusterPt;
994  }
995  // Set special pt binning for pp 13TeV, pPb 8TeV
996  } else if ( ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kpPb8TeV ){
997  nBinsPt = 285;
998  minPt = 0;
999  maxPt = 100;
1000  binWidthPt = 0.05;
1001  for(Int_t i=0; i<nBinsPt+1;i++){
1002  if (i < 1) arrPtBinning[i] = 0.3*i;
1003  else if(i<55) arrPtBinning[i] = 0.3+0.05*(i-1);
1004  else if(i<125) arrPtBinning[i] = 3.+0.1*(i-55);
1005  else if(i<185) arrPtBinning[i] = 10.+0.25*(i-125);
1006  else if(i<235) arrPtBinning[i] = 25.+0.5*(i-185);
1007  else if(i<285) arrPtBinning[i] = 50.+1.0*(i-235);
1008  else arrPtBinning[i] = maxPt;
1009  }
1010  nBinsQAPt = 270;
1011  maxQAPt = 100;
1012  for(Int_t i=0; i<nBinsQAPt+1;i++){
1013  if(i<60) arrQAPtBinning[i] = 0.05*i;
1014  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
1015  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
1016  else if(i<210) arrQAPtBinning[i] = 20.+0.5*(i-170);
1017  else if(i<270) arrQAPtBinning[i] = 40.+1.0*(i-210);
1018  else arrQAPtBinning[i] = maxQAPt;
1019  }
1020  nBinsClusterPt = 301;
1021  minClusterPt = 0;
1022  maxClusterPt = 100;
1023  for(Int_t i=0; i<nBinsClusterPt+1;i++){
1024  if (i < 1) arrClusPtBinning[i] = 0.3*i;
1025  else if(i<55) arrClusPtBinning[i] = 0.3+0.05*(i-1);
1026  else if(i<125) arrClusPtBinning[i] = 3.+0.1*(i-55);
1027  else if(i<155) arrClusPtBinning[i] = 10.+0.2*(i-125);
1028  else if(i<211) arrClusPtBinning[i] = 16.+0.25*(i-155);
1029  else if(i<251) arrClusPtBinning[i] = 30.+0.5*(i-211);
1030  else if(i<301) arrClusPtBinning[i] = 50.+1.0*(i-251);
1031  else arrClusPtBinning[i] = maxClusterPt;
1032  }
1033  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kXeXe5440GeV ){
1034  nBinsPt = 90;
1035  minPt = 0;
1036  maxPt = 20;
1037  for(Int_t i=0; i<nBinsPt+1;i++){
1038  if (i < 1) arrPtBinning[i] = 0.3*i;
1039  else if(i<58) arrPtBinning[i] = 0.3+0.1*(i-1);
1040  else if(i<82) arrPtBinning[i] = 6.+0.25*(i-58);
1041  else if(i<90) arrPtBinning[i] = 12.+1.0*(i-82);
1042  else arrPtBinning[i] = maxPt;
1043  }
1044  nBinsQAPt = 92;
1045  maxQAPt = 20;
1046  for(Int_t i=0; i<nBinsQAPt+1;i++){
1047  if(i<60) arrQAPtBinning[i] = 0.1*i;
1048  else if(i<84) arrQAPtBinning[i] = 6.+0.25*(i-60);
1049  else if(i<92) arrQAPtBinning[i] = 12.+1.0*(i-84);
1050  else arrQAPtBinning[i] = maxQAPt;
1051  }
1052  nBinsClusterPt = 148;
1053  minClusterPt = 0;
1054  maxClusterPt = 40;
1055  for(Int_t i=0; i<nBinsClusterPt+1;i++){
1056  if (i < 1) arrClusPtBinning[i] = 0.3*i;
1057  else if(i<98) arrClusPtBinning[i] = 0.3+0.1*(i-1);
1058  else if(i<123) arrClusPtBinning[i] = 10.+0.2*(i-98);
1059  else if(i<148) arrClusPtBinning[i] = 15.+1.0*(i-123);
1060  else arrClusPtBinning[i] = maxClusterPt;
1061  }
1062  } else if (((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEnergyEnum() == AliConvEventCuts::kPbPb5TeV ){
1063  nBinsPt = 90;
1064  minPt = 0;
1065  maxPt = 20;
1066  for(Int_t i=0; i<nBinsPt+1;i++){
1067  if (i < 1) arrPtBinning[i] = 0.3*i;
1068  else if(i<58) arrPtBinning[i] = 0.3+0.1*(i-1);
1069  else if(i<82) arrPtBinning[i] = 6.+0.25*(i-58);
1070  else if(i<90) arrPtBinning[i] = 12.+1.0*(i-82);
1071  else arrPtBinning[i] = maxPt;
1072  }
1073  nBinsQAPt = 92;
1074  maxQAPt = 20;
1075  for(Int_t i=0; i<nBinsQAPt+1;i++){
1076  if(i<60) arrQAPtBinning[i] = 0.1*i;
1077  else if(i<84) arrQAPtBinning[i] = 6.+0.25*(i-60);
1078  else if(i<92) arrQAPtBinning[i] = 12.+1.0*(i-84);
1079  else arrQAPtBinning[i] = maxQAPt;
1080  }
1081  nBinsClusterPt = 148;
1082  minClusterPt = 0;
1083  maxClusterPt = 40;
1084  for(Int_t i=0; i<nBinsClusterPt+1;i++){
1085  if (i < 1) arrClusPtBinning[i] = 0.3*i;
1086  else if(i<98) arrClusPtBinning[i] = 0.3+0.1*(i-1);
1087  else if(i<123) arrClusPtBinning[i] = 10.+0.2*(i-98);
1088  else if(i<148) arrClusPtBinning[i] = 15.+1.0*(i-123);
1089  else arrClusPtBinning[i] = maxClusterPt;
1090  }
1091  // default binning
1092  } else {
1093  for(Int_t i=0; i<nBinsPt+1;i++){
1094  arrPtBinning[i] = ((maxPt-minPt)/nBinsPt)*i;
1095  }
1096  for(Int_t i=0; i<nBinsClusterPt+1;i++){
1097  arrClusPtBinning[i] = ((maxClusterPt-minClusterPt)/nBinsClusterPt)*i;
1098  }
1099  for(Int_t i=0; i<nBinsQAPt+1;i++){
1100  if(i<60) arrQAPtBinning[i] = 0.05*i;
1101  else if(i<130) arrQAPtBinning[i] = 3.+0.1*(i-60);
1102  else if(i<170) arrQAPtBinning[i] = 10.+0.25*(i-130);
1103  else arrQAPtBinning[i] = maxQAPt;
1104  }
1105  }
1106 
1107  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1108  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
1109  TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
1110  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
1111  TString cutstringMeson = "NoMesonCut";
1112  if(fDoMesonAnalysis)
1113  cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
1114 
1115  fCutFolder[iCut] = new TList();
1116  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s_%s",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1117  fCutFolder[iCut]->SetOwner(kTRUE);
1118  fOutputContainer->Add(fCutFolder[iCut]);
1119  fESDList[iCut] = new TList();
1120  fESDList[iCut]->SetName(Form("%s_%s_%s_%s ESD histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1121  fESDList[iCut]->SetOwner(kTRUE);
1122  fCutFolder[iCut]->Add(fESDList[iCut]);
1123 
1124  fHistoNEvents[iCut] = new TH1F("NEvents", "NEvents", 14, -0.5, 13.5);
1125  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
1126  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
1127  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
1128  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
1129  TString TriggerNames = "Not Trigger: ";
1130  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
1131  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
1132  }else {
1133  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
1134  }
1135  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
1136  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
1137  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
1138  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
1139  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
1140  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
1141  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
1142  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
1143  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
1144  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
1145  fESDList[iCut]->Add(fHistoNEvents[iCut]);
1146 
1147  if (fIsMC > 1){
1148  fHistoNEventsWOWeight[iCut] = new TH1F("NEventsWOWeight", "NEventsWOWeight", 14, -0.5, 13.5);
1149  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
1150  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
1151  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
1152  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
1153  TString TriggerNames = "Not Trigger: ";
1154  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
1155  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
1156  }else {
1157  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
1158  }
1159  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
1160  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
1161  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
1162  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
1163  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
1164  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
1165  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
1166  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
1167  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
1168  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
1169  fESDList[iCut]->Add(fHistoNEventsWOWeight[iCut]);
1170  }
1171 
1172  if (fIsMC == 2){
1173  fProfileJetJetXSection[iCut] = new TProfile("XSection", "XSection", 1, -0.5, 0.5);
1174  fESDList[iCut]->Add(fProfileJetJetXSection[iCut]);
1175  fHistoJetJetNTrials[iCut] = new TH1F("NTrials", "#sum{NTrials}", 1, 0, 1);
1176  fHistoJetJetNTrials[iCut]->GetXaxis()->SetBinLabel(1,"#sum{NTrials}");
1177  fESDList[iCut]->Add(fHistoJetJetNTrials[iCut]);
1178  }
1179 
1180  if(fIsHeavyIon == 1)
1181  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 4000, 0, 4000);
1182  else if(fIsHeavyIon == 2)
1183  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 400, 0, 400);
1184  else
1185  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks", "GoodESDTracks", 200, 0, 200);
1186  fHistoNGoodESDTracks[iCut]->SetXTitle("# TPC tracks");
1187  fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
1188 
1189  fHistoVertexZ[iCut] = new TH1F("VertexZ", "VertexZ", 200, -10, 10);
1190  fESDList[iCut]->Add(fHistoVertexZ[iCut]);
1191  if(!fDoLightOutput){
1192  fHistoVertexX[iCut] = new TH1F("VertexX", "VertexX", 100, -0.5, 0.5);
1193  fESDList[iCut]->Add(fHistoVertexX[iCut]);
1194  fHistoVertexY[iCut] = new TH1F("VertexY", "VertexY", 100, -0.1, 0.9);
1195  fESDList[iCut]->Add(fHistoVertexY[iCut]);
1196  }
1197 
1198  if(fIsHeavyIon == 1)
1199  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 100, 0, 100);
1200  else if(fIsHeavyIon == 2)
1201  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 50, 0, 50);
1202  else
1203  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates", "GammaCandidates", 50, 0, 50);
1204  fHistoNGammaCandidates[iCut]->SetXTitle("# accepted #gamma_{conv}");
1205  fESDList[iCut]->Add(fHistoNGammaCandidates[iCut]);
1206 
1207  if(!fDoLightOutput){
1208  if(fIsHeavyIon == 1)
1209  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 4000, 0, 4000, 100, 0, 100);
1210  else if(fIsHeavyIon == 2)
1211  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 400, 0, 400, 50, 0, 50);
1212  else
1213  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates", "GoodESDTracksVsGammaCandidates", 200, 0, 200, 50, 0, 50);
1214  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetXTitle("# TPC tracks");
1215  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetYTitle("# accepted #gamma_{conv}");
1217 
1218  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters", "SPD tracklets vs SPD clusters", 100, 0, 200, 250, 0, 1000);
1219  fESDList[iCut]->Add(fHistoSPDClusterTrackletBackground[iCut]);
1220 
1221  if(fIsHeavyIon == 1)
1222  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 30000, 0, 30000);
1223  else if(fIsHeavyIon == 2)
1224  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 2500, 0, 2500);
1225  else
1226  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity", "V0 Multiplicity", 1500, 0, 1500);
1227  fHistoNV0Tracks[iCut]->SetXTitle("VZERO amp [arb. units]");
1228  fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
1229 
1230  fHistoConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt", "ESD_ConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1231  fHistoConvGammaPt[iCut]->SetXTitle("p_{T,conv}(GeV/c)");
1232  fESDList[iCut]->Add(fHistoConvGammaPt[iCut]);
1233  }
1234 
1235  if(fIsHeavyIon == 2){
1236  fProfileEtaShift[iCut] = new TProfile("Eta Shift", "Eta Shift", 1, -0.5, 0.5);
1237  fESDList[iCut]->Add(fProfileEtaShift[iCut]);
1238  }
1239 
1240  if (fIsMC > 1){
1241  fHistoNEvents[iCut]->Sumw2();
1242  fHistoNGoodESDTracks[iCut]->Sumw2();
1243  fHistoVertexZ[iCut]->Sumw2();
1244  fHistoNGammaCandidates[iCut]->Sumw2();
1245  if(!fDoLightOutput){
1246  fHistoVertexX[iCut]->Sumw2();
1247  fHistoVertexY[iCut]->Sumw2();
1249  fHistoSPDClusterTrackletBackground[iCut]->Sumw2();
1250  fHistoNV0Tracks[iCut]->Sumw2();
1251  fHistoConvGammaPt[iCut]->Sumw2();
1252  }
1253  }
1254 
1255  if (fDoPhotonQA == 2 ){
1256  fPhotonDCAList[iCut] = new TList();
1257  fPhotonDCAList[iCut]->SetName(Form("%s_%s_%s_%s Photon DCA tree",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1258  fPhotonDCAList[iCut]->SetOwner(kTRUE);
1259  fCutFolder[iCut]->Add(fPhotonDCAList[iCut]);
1260 
1261  fTreeConvGammaPtDcazCat[iCut] = new TTree("ESD_ConvGamma_Pt_Dcaz", "ESD_ConvGamma_Pt_Dcaz_Cat");
1262  fTreeConvGammaPtDcazCat[iCut]->Branch("Pt",&fPtGamma,"fPtGamma/s");
1263  fTreeConvGammaPtDcazCat[iCut]->Branch("DcaZPhoton",&fDCAzPhoton,"fDCAzPhoton/S");
1264  fTreeConvGammaPtDcazCat[iCut]->Branch("cat",&fCharCatPhoton,"fCharCatPhoton/b");
1265  if (fIsMC > 1){
1266  fTreeConvGammaPtDcazCat[iCut]->Branch("weightEvent",&fWeightJetJetMC,"fWeightJetJetMC/f");
1267  }
1268  fPhotonDCAList[iCut]->Add(fTreeConvGammaPtDcazCat[iCut]);
1269  }
1270 
1271  fClusterOutputList[iCut] = new TList();
1272  fClusterOutputList[iCut]->SetName(Form("%s_%s_%s_%s Cluster Output",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1273  fClusterOutputList[iCut]->SetOwner(1);
1274  fCutFolder[iCut]->Add(fClusterOutputList[iCut]);
1275 
1276  fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt", "ClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1277  fHistoClusGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1278  fClusterOutputList[iCut]->Add(fHistoClusGammaPt[iCut]);
1279  fHistoClusGammaE[iCut] = new TH1F("ClusGamma_E", "ClusGamma_E", nBinsClusterPt, arrClusPtBinning);
1280  fHistoClusGammaE[iCut]->SetXTitle("E_{clus} (GeV)");
1281  fClusterOutputList[iCut]->Add(fHistoClusGammaE[iCut]);
1282  fHistoClusOverlapHeadersGammaPt[iCut] = new TH1F("ClusGammaOverlapHeaders_Pt", "ClusGammaOverlapHeaders_Pt", nBinsClusterPt, arrClusPtBinning);
1283  fHistoClusOverlapHeadersGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c), selected header w/ overlap");
1285  fHistoClusAllHeadersGammaPt[iCut] = new TH1F("ClusGammaAllHeaders_Pt", "ClusGammaAllHeaders_Pt", nBinsClusterPt, arrClusPtBinning);
1286  fHistoClusAllHeadersGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c), all headers");
1288  fHistoClusRejectedHeadersGammaPt[iCut] = new TH1F("ClusGammaRejectedHeaders_Pt", "ClusGammaRejectedHeaders_Pt", nBinsClusterPt, arrClusPtBinning);
1289  fHistoClusRejectedHeadersGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c), rejected headers");
1291 
1293  fGammaERM02[iCut] = new TList();
1294  fGammaERM02[iCut]->SetName(Form("%s_%s_%s_%s ConvGamma-Cluster Matched",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1295  fGammaERM02[iCut]->SetOwner(kTRUE);
1296  fCutFolder[iCut]->Add(fGammaERM02[iCut]);
1297 
1298  tESDGammaERM02[iCut] = new TTree("ESD_ConvGamma_E_ConvR_M02_M20", "ESD_ConvGamma_E_ConvR_M02_M20");
1299  tESDGammaERM02[iCut]->Branch("ClusterE",&tESDClusE,"tESDClusE/F");
1300  tESDGammaERM02[iCut]->Branch("ConvR",&tESDGammaConvR,"tESDGammaConvR/F");
1301  tESDGammaERM02[iCut]->Branch("M02",&tESDClusterM02,"tESDClusterM02/F");
1302  tESDGammaERM02[iCut]->Branch("M20",&tESDClusterM20,"tESDClusterM20/F");
1303  tESDGammaERM02[iCut]->Branch("Eta",&tESDClusterEta,"tESDClusterEta/F");
1304  tESDGammaERM02[iCut]->Branch("Phi",&tESDClusterPhi,"tESDClusterPhi/F");
1305  tESDGammaERM02[iCut]->Branch("NCells",&tESDClusterNCells,"tESDClusterNCells/F");
1306  tESDGammaERM02[iCut]->Branch("MaxECell",&tESDClusterMaxECell,"tESDClusterMaxECell/F");
1307  tESDGammaERM02[iCut]->Branch("NLM",&tESDClusterNLM,"tESDClusterNLM/F");
1308  fGammaERM02[iCut]->Add(tESDGammaERM02[iCut]);
1309  }
1310 
1312  fInvMassShowerShape[iCut] = new TList();
1313  fInvMassShowerShape[iCut]->SetName(Form("%s_%s_%s_%s InvMass_ShowerShape",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1314  fInvMassShowerShape[iCut]->SetOwner(kTRUE);
1315  fCutFolder[iCut]->Add(fInvMassShowerShape[iCut]);
1316  tESDInvMassShowerShape[iCut] = new TTree("ESD_Meson_InvMass_Pt_ClusE_ClusM02_ClusM20", "ESD_Meson_InvMass_Pt_ClusE_ClusM02_ClusM20");
1317  tESDInvMassShowerShape[iCut]->Branch("MesonInvMass",&tESDIMMesonInvMass,"tESDIMMesonInvMass/F");
1318  tESDInvMassShowerShape[iCut]->Branch("MesonPt",&tESDIMMesonPt,"tESDIMMesonPt/F");
1319  tESDInvMassShowerShape[iCut]->Branch("ClusE",&tESDIMClusE,"tESDIMClusE/F");
1320  tESDInvMassShowerShape[iCut]->Branch("ClusM02",&tESDIMClusterM02,"tESDIMClusterM02/F");
1321  tESDInvMassShowerShape[iCut]->Branch("ClusM20",&tESDIMClusterM20,"tESDIMClusterM20/F");
1322  tESDInvMassShowerShape[iCut]->Branch("ClusLeadCellID",&tESDIMClusterLeadCellID,"tESDIMClusterLeadCellID/I");
1323  if(fIsMC>0) tESDInvMassShowerShape[iCut]->Branch("ClusClassification",&tESDIMClusterClassification,"tESDIMClusterClassification/I");
1324  tESDInvMassShowerShape[iCut]->Branch("ClusMatchedTrackPt",&tESDIMClusMatchedTrackPt,"tESDIMClusMatchedTrackPt/F");
1325  tESDInvMassShowerShape[iCut]->Branch("ClusTrackDeltaEta",&tESDIMClusTrackDeltaEta,"tESDIMClusTrackDeltaEta/F");
1326  tESDInvMassShowerShape[iCut]->Branch("ClusTrackDeltaPhi",&tESDIMClusTrackDeltaPhi,"tESDIMClusTrackDeltaPhi/F");
1327  tESDInvMassShowerShape[iCut]->Branch("ClusIsoSumClusterEt",&tESDIMClusterIsoSumClusterEt,"tESDIMClusterIsoSumClusterEt/F");
1328  tESDInvMassShowerShape[iCut]->Branch("ClusIsoSumTrackEt",&tESDIMClusterIsoSumTrackEt,"tESDIMClusterIsoSumTrackEt/F");
1329  fInvMassShowerShape[iCut]->Add(tESDInvMassShowerShape[iCut]);
1330  }
1331 
1332  if (fIsMC > 1){
1333  fHistoClusGammaPt[iCut]->Sumw2();
1334  fHistoClusGammaE[iCut]->Sumw2();
1335  fHistoClusOverlapHeadersGammaPt[iCut]->Sumw2();
1336  fHistoClusAllHeadersGammaPt[iCut]->Sumw2();
1337  fHistoClusRejectedHeadersGammaPt[iCut]->Sumw2();
1338  }
1339 
1340  if(fDoMesonAnalysis){
1341  fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt", "ESD_Mother_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1342  fHistoMotherInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
1343  fHistoMotherInvMassPt[iCut]->SetYTitle("p_{T,pair} (GeV/c)");
1344  fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
1345 
1346  if(!fDoLightOutput){
1347  fHistoMotherMatchedInvMassPt[iCut] = new TH2F("ESD_MotherMatched_InvMass_Pt", "ESD_MotherMatched_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1348  fHistoMotherMatchedInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) matched conv e^{+/-}to cluster");
1349  fHistoMotherMatchedInvMassPt[iCut]->SetYTitle("p_{T,pair} (GeV/c)");
1350  fESDList[iCut]->Add(fHistoMotherMatchedInvMassPt[iCut]);
1351  }
1352 
1353  fHistoMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt", "ESD_Background_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
1354  fHistoMotherBackInvMassPt[iCut]->SetXTitle("M_{inv, mxed}(GeV/c^{2})");
1355  fHistoMotherBackInvMassPt[iCut]->SetYTitle("p_{T,BG pair} (GeV/c)");
1356  fESDList[iCut]->Add(fHistoMotherBackInvMassPt[iCut]);
1357 
1358  if(!fDoLightOutput){
1359  fHistoMotherInvMassPtAlpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_Pt_Alpha", "ESD_Mother_InvMass_vs_Pt_Alpha", 800, 0, 0.8, nBinsPt, arrPtBinning);
1360  fHistoMotherInvMassPtAlpha[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
1361  fHistoMotherInvMassPtAlpha[iCut]->SetYTitle("p_{T,pair} (GeV/c)");
1362  fESDList[iCut]->Add(fHistoMotherInvMassPtAlpha[iCut]);
1363 
1364  fHistoPhotonPairPtconv[iCut] = new TH2F("ESD_Mother_InvMass_PtConv", "", 800, 0, 0.8, nBinsPt, arrPtBinning);
1365  fHistoPhotonPairPtconv[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
1366  fHistoPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
1367  fESDList[iCut]->Add(fHistoPhotonPairPtconv[iCut]);
1368 
1369  fHistoPhotonPairMixedEventPtconv[iCut] = new TH2F("ESD_Background_InvMass_PtConv", "", 800, 0, 0.8, nBinsPt, arrPtBinning);
1370  fHistoPhotonPairMixedEventPtconv[iCut]->SetXTitle("M_{inv,mixed}(GeV/c^{2})");
1371  fHistoPhotonPairMixedEventPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
1372  fESDList[iCut]->Add(fHistoPhotonPairMixedEventPtconv[iCut]);
1373  }
1374 
1375  if (fIsMC > 1){
1376  fHistoMotherInvMassPt[iCut]->Sumw2();
1377  fHistoMotherBackInvMassPt[iCut]->Sumw2();
1378  if(!fDoLightOutput){
1379  fHistoMotherMatchedInvMassPt[iCut]->Sumw2();
1380  fHistoMotherInvMassPtAlpha[iCut]->Sumw2();
1381  fHistoPhotonPairPtconv[iCut]->Sumw2();
1382  fHistoPhotonPairMixedEventPtconv[iCut]->Sumw2();
1383  }
1384  }
1385 
1386  if(!fDoLightOutput){
1387  fHistoMotherInvMassECalib[iCut] = new TH2F("ESD_Mother_InvMass_E_Calib", "ESD_Mother_InvMass_E_Calib", 800, 0, 0.8, nBinsPt, arrPtBinning);
1388  fHistoMotherInvMassECalib[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
1389  fHistoMotherInvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
1390  fESDList[iCut]->Add(fHistoMotherInvMassECalib[iCut]);
1391 
1392  fHistoMotherBackInvMassECalib[iCut] = new TH2F("ESD_Background_InvMass_E_Calib", "ESD_Background_InvMass_E_Calib", 800, 0, 0.8, nBinsPt, arrPtBinning);
1393  fHistoMotherBackInvMassECalib[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
1394  fHistoMotherBackInvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
1395  fESDList[iCut]->Add(fHistoMotherBackInvMassECalib[iCut]);
1396 
1397  if (fIsMC > 1){
1398  fHistoMotherInvMassECalib[iCut]->Sumw2();
1399  fHistoMotherBackInvMassECalib[iCut]->Sumw2();
1400  }
1401  }
1402 
1403  if (fDoMesonQA > 0 ){
1404  fHistoMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y", "ESD_MotherPi0_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1405  fHistoMotherPi0PtY[iCut]->SetXTitle("p_{T, #pi^{0} cand} (GeV/c)");
1406  fHistoMotherPi0PtY[iCut]->SetYTitle("y_{#pi^{0} cand}");
1407  fESDList[iCut]->Add(fHistoMotherPi0PtY[iCut]);
1408  fHistoMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y", "ESD_MotherEta_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1409  fHistoMotherEtaPtY[iCut]->SetXTitle("p_{T, #eta cand} (GeV/c)");
1410  fHistoMotherEtaPtY[iCut]->SetYTitle("y_{ #eta cand}");
1411  fESDList[iCut]->Add(fHistoMotherEtaPtY[iCut]);
1412  fHistoMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha", "ESD_MotherPi0_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
1413  fHistoMotherPi0PtAlpha[iCut]->SetXTitle("p_{T, #pi^{0} cand} (GeV/c)");
1414  fHistoMotherPi0PtAlpha[iCut]->SetYTitle("#alpha_{#pi^{0} cand}");
1415  fESDList[iCut]->Add(fHistoMotherPi0PtAlpha[iCut]);
1416  fHistoMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha", "ESD_MotherEta_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
1417  fHistoMotherEtaPtAlpha[iCut]->SetXTitle("p_{T, #eta cand} (GeV/c)");
1418  fHistoMotherEtaPtAlpha[iCut]->SetYTitle("#alpha_{#eta cand}");
1419  fESDList[iCut]->Add(fHistoMotherEtaPtAlpha[iCut]);
1420  fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle", "ESD_MotherPi0_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
1421  fHistoMotherPi0PtOpenAngle[iCut]->SetXTitle("p_{T, #pi^{0} cand} (GeV/c)");
1422  fHistoMotherPi0PtOpenAngle[iCut]->SetYTitle("#theta_{#pi^{0} cand}");
1423  fESDList[iCut]->Add(fHistoMotherPi0PtOpenAngle[iCut]);
1424  fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle", "ESD_MotherEta_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning, 200, 0, TMath::Pi());
1425  fHistoMotherEtaPtOpenAngle[iCut]->SetXTitle("p_{T, #eta cand} (GeV/c)");
1426  fHistoMotherEtaPtOpenAngle[iCut]->SetYTitle("#theta_{#eta cand}");
1427  fESDList[iCut]->Add(fHistoMotherEtaPtOpenAngle[iCut]);
1428  fHistoMotherPi0ConvPhotonEtaPhi[iCut] = new TH2F("ESD_MotherPi0ConvPhoton_Eta_Phi", "ConvPhoton under #pi^{0}peak", 600, 0, 2*TMath::Pi(), 200, -1, 1);
1429  fHistoMotherPi0ConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
1430  fHistoMotherPi0ConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
1431  fESDList[iCut]->Add(fHistoMotherPi0ConvPhotonEtaPhi[iCut]);
1432  fHistoMotherEtaConvPhotonEtaPhi[iCut] = new TH2F("ESD_MotherEtaConvPhoton_Eta_Phi", "ConvPhoton under #eta peak", 600, 0, 2*TMath::Pi(), 200, -1, 1);
1433  fHistoMotherEtaConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
1434  fHistoMotherEtaConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
1435  fESDList[iCut]->Add(fHistoMotherEtaConvPhotonEtaPhi[iCut]);
1436  if (fIsMC > 1){
1437  fHistoMotherPi0PtY[iCut]->Sumw2();
1438  fHistoMotherEtaPtY[iCut]->Sumw2();
1439  fHistoMotherPi0PtAlpha[iCut]->Sumw2();
1440  fHistoMotherEtaPtAlpha[iCut]->Sumw2();
1441  fHistoMotherPi0PtOpenAngle[iCut]->Sumw2();
1442  fHistoMotherEtaPtOpenAngle[iCut]->Sumw2();
1443  fHistoMotherPi0ConvPhotonEtaPhi[iCut]->Sumw2();
1444  fHistoMotherEtaConvPhotonEtaPhi[iCut]->Sumw2();
1445  }
1446  }
1447  }
1448  }
1449  if(fDoMesonAnalysis){
1450  InitBack(); // Init Background Handler
1451  }
1452 
1453  if(fIsMC>0){
1454  // MC Histogramms
1455  fMCList = new TList*[fnCuts];
1456  // True Histogramms
1457  fTrueList = new TList*[fnCuts];
1458 
1459  if(!fDoLightOutput){
1460  fHistoMCHeaders = new TH1I*[fnCuts];
1461  fHistoMCAllGammaPt = new TH1F*[fnCuts];
1462  fHistoMCAllGammaEMCALAccPt = new TH1F*[fnCuts];
1464  fHistoMCDecayGammaPi0Pt = new TH1F*[fnCuts];
1465  fHistoMCDecayGammaRhoPt = new TH1F*[fnCuts];
1466  fHistoMCDecayGammaEtaPt = new TH1F*[fnCuts];
1467  fHistoMCDecayGammaOmegaPt = new TH1F*[fnCuts];
1468  fHistoMCDecayGammaEtapPt = new TH1F*[fnCuts];
1469  fHistoMCDecayGammaPhiPt = new TH1F*[fnCuts];
1470  fHistoMCDecayGammaSigmaPt = new TH1F*[fnCuts];
1471  fHistoMCConvGammaPt = new TH1F*[fnCuts];
1473  fHistoTrueConvGammaPt = new TH1F*[fnCuts];
1476 
1478  fHistoTruePrimaryConvGammaPt = new TH1F*[fnCuts];
1485  }
1486 
1487  fHistoTrueClusGammaPt = new TH1F*[fnCuts];
1488  if(!fDoLightOutput){
1489  fHistoTrueClusConvGammaPt = new TH1F*[fnCuts];
1490  fHistoTruePrimaryClusGammaPt = new TH1F*[fnCuts];
1498  fHistoTrueClusElectronPt = new TH1F*[fnCuts];
1499  }
1502 
1503  if(!fDoLightOutput){
1507  fHistoTrueClusEMNonLeadingPt = new TH1F*[fnCuts];
1508  }
1509 
1510  if(!fDoLightOutput){
1513  }
1514 
1515  if (fDoClusterQA > 0){
1517  fHistoTrueClusMergedGammaPt = new TH1F*[fnCuts];
1519  fHistoTrueClusDalitzPt = new TH1F*[fnCuts];
1520  fHistoTrueClusDalitzMergedPt = new TH1F*[fnCuts];
1522  fHistoTrueClusShowerPt = new TH1F*[fnCuts];
1523  fHistoTrueClusSubLeadingPt = new TH1F*[fnCuts];
1524  fHistoTrueClusNMothers = new TH1F*[fnCuts];
1525  }
1526 
1527  if(fDoMesonAnalysis){
1528  fHistoMCPi0Pt = new TH1F*[fnCuts];
1529  fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
1530  fHistoMCEtaPt = new TH1F*[fnCuts];
1531  fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
1532  fHistoMCPi0InAccPt = new TH1F*[fnCuts];
1533  fHistoMCPi0WOWeightInAccPt = new TH1F*[fnCuts];
1534  fHistoMCEtaInAccPt = new TH1F*[fnCuts];
1535  fHistoMCEtaWOWeightInAccPt = new TH1F*[fnCuts];
1536  if (fIsMC > 1){
1537  fHistoMCPi0WOEvtWeightPt = new TH1F*[fnCuts];
1538  fHistoMCEtaWOEvtWeightPt = new TH1F*[fnCuts];
1541  }
1542 
1546  fHistoMCSecPi0Source = new TH1F*[fnCuts];
1547  fHistoMCSecEtaPt = new TH1F*[fnCuts];
1548  fHistoMCSecEtaSource = new TH1F*[fnCuts];
1549  if (!fDoLightOutput){
1558  }
1559 
1565  fHistoMultipleCountTruePi0 = new TH1F*[fnCuts];
1567  fHistoMultipleCountTrueEta = new TH1F*[fnCuts];
1579  if(!fDoLightOutput) {
1586  fHistoTruePrimaryPi0DCPtconv = new TH1F*[fnCuts];
1590  }
1591 
1592 
1593  if (fDoMesonQA > 0){
1594  fHistoMCPi0PtY = new TH2F*[fnCuts];
1595  fHistoMCEtaPtY = new TH2F*[fnCuts];
1596  fHistoMCPi0PtAlpha = new TH2F*[fnCuts];
1597  fHistoMCEtaPtAlpha = new TH2F*[fnCuts];
1598  if (fIsMC == 2){
1599  fHistoMCPi0PtJetPt = new TH2F*[fnCuts];
1600  fHistoMCEtaPtJetPt = new TH2F*[fnCuts];
1601  }
1602 
1603  if (fIsMC < 2){
1629  }
1630  if(fDoMesonQA > 1){
1635  }
1636  fHistoTruePi0PtY = new TH2F*[fnCuts];
1637  fHistoTrueEtaPtY = new TH2F*[fnCuts];
1644  }
1645  }
1646 
1647  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1648  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
1649  TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
1650  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
1651  TString cutstringMeson = "NoMesonCut";
1652  if(fDoMesonAnalysis)
1653  cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
1654 
1655  fMCList[iCut] = new TList();
1656  fMCList[iCut]->SetName(Form("%s_%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1657  fMCList[iCut]->SetOwner(kTRUE);
1658  fCutFolder[iCut]->Add(fMCList[iCut]);
1659  if(!fDoLightOutput){
1660  fHistoMCHeaders[iCut] = new TH1I("MC_Headers", "MC_Headers", 20, 0, 20);
1661  fMCList[iCut]->Add(fHistoMCHeaders[iCut]);
1662  fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt", "MC_AllGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1663  fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
1664  fHistoMCAllGammaEMCALAccPt[iCut] = new TH1F("MC_AllGammaEMCALAcc_Pt", "MC_AllGammaEMCALAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1665  fMCList[iCut]->Add(fHistoMCAllGammaEMCALAccPt[iCut]);
1666  fHistoMCAllSecondaryGammaPt[iCut] = new TH2F("MC_AllSecondaryGamma_Pt", "MC_AllSecondaryGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 4, -0.5, 3.5);
1667  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1668  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1669  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1670  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1671  fMCList[iCut]->Add(fHistoMCAllSecondaryGammaPt[iCut]);
1672 
1673  fHistoMCDecayGammaPi0Pt[iCut] = new TH1F("MC_DecayGammaPi0_Pt", "MC_DecayGammaPi0_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1674  fMCList[iCut]->Add(fHistoMCDecayGammaPi0Pt[iCut]);
1675  fHistoMCDecayGammaRhoPt[iCut] = new TH1F("MC_DecayGammaRho_Pt", "MC_DecayGammaRho_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1676  fMCList[iCut]->Add(fHistoMCDecayGammaRhoPt[iCut]);
1677  fHistoMCDecayGammaEtaPt[iCut] = new TH1F("MC_DecayGammaEta_Pt", "MC_DecayGammaEta_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1678  fMCList[iCut]->Add(fHistoMCDecayGammaEtaPt[iCut]);
1679  fHistoMCDecayGammaOmegaPt[iCut] = new TH1F("MC_DecayGammaOmega_Pt", "MC_DecayGammaOmmega_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1680  fMCList[iCut]->Add(fHistoMCDecayGammaOmegaPt[iCut]);
1681  fHistoMCDecayGammaEtapPt[iCut] = new TH1F("MC_DecayGammaEtap_Pt", "MC_DecayGammaEtap_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1682  fMCList[iCut]->Add(fHistoMCDecayGammaEtapPt[iCut]);
1683  fHistoMCDecayGammaPhiPt[iCut] = new TH1F("MC_DecayGammaPhi_Pt", "MC_DecayGammaPhi_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1684  fMCList[iCut]->Add(fHistoMCDecayGammaPhiPt[iCut]);
1685  fHistoMCDecayGammaSigmaPt[iCut] = new TH1F("MC_DecayGammaSigma_Pt", "MC_DecayGammaSigma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1686  fMCList[iCut]->Add(fHistoMCDecayGammaSigmaPt[iCut]);
1687  fHistoMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt", "MC_ConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1688  fMCList[iCut]->Add(fHistoMCConvGammaPt[iCut]);
1689  fHistoMCSecondaryConvGammaPt[iCut] = new TH2F("MC_SecondaryConvGamma_Pt", "MC_SecondaryConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 4, -0.5, 3.5);
1690  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1691  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1692  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1693  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1694  fMCList[iCut]->Add(fHistoMCSecondaryConvGammaPt[iCut]);
1695 
1696  if (fIsMC > 1){
1697  fHistoMCAllGammaPt[iCut]->Sumw2();
1698  fHistoMCAllGammaEMCALAccPt[iCut]->Sumw2();
1699  fHistoMCAllSecondaryGammaPt[iCut]->Sumw2();
1700  fHistoMCDecayGammaPi0Pt[iCut]->Sumw2();
1701  fHistoMCDecayGammaRhoPt[iCut]->Sumw2();
1702  fHistoMCDecayGammaEtaPt[iCut]->Sumw2();
1703  fHistoMCDecayGammaOmegaPt[iCut]->Sumw2();
1704  fHistoMCDecayGammaEtapPt[iCut]->Sumw2();
1705  fHistoMCDecayGammaPhiPt[iCut]->Sumw2();
1706  fHistoMCDecayGammaSigmaPt[iCut]->Sumw2();
1707  fHistoMCConvGammaPt[iCut]->Sumw2();
1708  fHistoMCSecondaryConvGammaPt[iCut]->Sumw2();
1709  }
1710  }
1711 
1712  if(fDoMesonAnalysis){
1713  fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt", "MC_Pi0_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1714  fHistoMCPi0Pt[iCut]->Sumw2();
1715  fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
1716  fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt", "MC_Pi0_WOWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1717  fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
1718 
1719  fHistoMCEtaPt[iCut] = new TH1F("MC_Eta_Pt", "MC_Eta_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1720  fHistoMCEtaPt[iCut]->Sumw2();
1721  fMCList[iCut]->Add(fHistoMCEtaPt[iCut]);
1722  fHistoMCEtaWOWeightPt[iCut] = new TH1F("MC_Eta_WOWeights_Pt", "MC_Eta_WOWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1723  fMCList[iCut]->Add(fHistoMCEtaWOWeightPt[iCut]);
1724 
1725  fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt", "MC_Pi0InAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1726  fHistoMCPi0InAccPt[iCut]->Sumw2();
1727  fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
1728  fHistoMCPi0WOWeightInAccPt[iCut] = new TH1F("MC_Pi0WOWeightInAcc_Pt", "MC_Pi0WOWeightInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1729  fMCList[iCut]->Add(fHistoMCPi0WOWeightInAccPt[iCut]);
1730  fHistoMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt", "MC_EtaInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1731  fHistoMCEtaInAccPt[iCut]->Sumw2();
1732  fMCList[iCut]->Add(fHistoMCEtaInAccPt[iCut]);
1733  fHistoMCEtaWOWeightInAccPt[iCut] = new TH1F("MC_EtaWOWeightInAcc_Pt", "MC_EtaWOWeightInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1734  fMCList[iCut]->Add(fHistoMCEtaWOWeightInAccPt[iCut]);
1735 
1736  if (fIsMC > 1){
1737  fHistoMCPi0WOWeightPt[iCut]->Sumw2();
1738  fHistoMCEtaWOWeightPt[iCut]->Sumw2();
1739  fHistoMCPi0WOWeightInAccPt[iCut]->Sumw2();
1740  fHistoMCEtaWOWeightInAccPt[iCut]->Sumw2();
1741  fHistoMCPi0WOEvtWeightPt[iCut] = new TH1F("MC_Pi0_WOEventWeights_Pt", "MC_Pi0_WOEventWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1742  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightPt[iCut]);
1743  fHistoMCEtaWOEvtWeightPt[iCut] = new TH1F("MC_Eta_WOEventWeights_Pt", "MC_Eta_WOEventWeights_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1744  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightPt[iCut]);
1745  fHistoMCPi0WOEvtWeightInAccPt[iCut] = new TH1F("MC_Pi0_WOEventWeightsInAcc_Pt", "MC_Pi0_WOEventWeightsInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1746  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightInAccPt[iCut]);
1747  fHistoMCEtaWOEvtWeightInAccPt[iCut] = new TH1F("MC_Eta_WOEventWeightsInAcc_Pt", "MC_Eta_WOEventWeightsInAcc_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1748  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightInAccPt[iCut]);
1749 
1750  if (fDoMesonQA > 0 && fIsMC == 2){
1751  fHistoMCPi0PtJetPt[iCut] = new TH2F("MC_Pi0_Pt_JetPt", "MC_Pi0_Pt_JetPt", nBinsQAPt, arrQAPtBinning, 200, 0, 200);
1752  fHistoMCPi0PtJetPt[iCut]->Sumw2();
1753  fMCList[iCut]->Add(fHistoMCPi0PtJetPt[iCut]);
1754  fHistoMCEtaPtJetPt[iCut] = new TH2F("MC_Eta_Pt_JetPt", "MC_Eta_Pt_JetPt", nBinsQAPt, arrQAPtBinning, 200, 0, 200);
1755  fHistoMCEtaPtJetPt[iCut]->Sumw2();
1756  fMCList[iCut]->Add(fHistoMCEtaPtJetPt[iCut]);
1757  }
1758  }
1759  fHistoMCPrimaryPtvsSource[iCut] = new TH2F("MC_Primary_Pt_Source", "MC_Primary_Pt_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 7, -0.5, 6.5);
1760  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(1,"Pi+");
1761  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(2,"Pi-");
1762  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(3,"K+");
1763  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(4,"K-");
1764  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(5,"K0s");
1765  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(6,"K0l");
1766  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(7,"Lambda");
1767  fMCList[iCut]->Add(fHistoMCPrimaryPtvsSource[iCut]);
1768 
1769  fHistoMCSecPi0Source[iCut] = new TH1F("MC_SecPi0_Source", "MC_SecPi0_Source", 5000, 0., 5000);
1770  fMCList[iCut]->Add(fHistoMCSecPi0Source[iCut]);
1771  fHistoMCSecEtaSource[iCut] = new TH1F("MC_SecEta_Source", "MC_SecEta_Source", 5000, 0, 5000);
1772  fMCList[iCut]->Add(fHistoMCSecEtaSource[iCut]);
1773  fHistoMCSecPi0PtvsSource[iCut] = new TH2F("MC_SecPi0_Pt_Source", "MC_SecPi0_Pt_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1774  fMCList[iCut]->Add(fHistoMCSecPi0PtvsSource[iCut]);
1775  fHistoMCSecPi0InAccPtvsSource[iCut] = new TH2F("MC_SecPi0InAcc_Pt_Source", "MC_SecPi0InAcc_Pt_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1776  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtvsSource[iCut]);
1777  fHistoMCSecEtaPt[iCut] = new TH1F("MC_SecEta_Pt", "MC_SecEta_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1778  fMCList[iCut]->Add(fHistoMCSecEtaPt[iCut]);
1779 
1780  if (fIsMC == 2){
1781  fHistoMCPrimaryPtvsSource[iCut]->Sumw2();
1782  fHistoMCSecPi0PtvsSource[iCut]->Sumw2();
1783  fHistoMCSecPi0InAccPtvsSource[iCut]->Sumw2();
1784  fHistoMCSecEtaPt[iCut]->Sumw2();
1785  }
1786 
1787  // book histograms for pure MC handling of PCM-Calo dir gamma reco
1788  if (!fDoLightOutput){
1789  fHistoMCPi0PtGammaLeg[iCut] = new TH2F("MC_Pi0_PtGamma_Leg", "MC_Pi0_PtGamma_Leg", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 3, -0.5, 2.5);
1790  fHistoMCPi0PtGammaLeg[iCut]->Sumw2();
1791  fMCList[iCut]->Add(fHistoMCPi0PtGammaLeg[iCut]);
1792  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);
1793  fMCList[iCut]->Add(fHistoMCPi0WOWeightPtGammaLeg[iCut]);
1794 
1795  fHistoMCPi0InAccPtGammaLeg[iCut] = new TH2F("MC_Pi0InAcc_PtGamma_Leg", "MC_Pi0InAcc_PtGamma_Leg", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 3, -0.5, 2.5);
1796  fHistoMCPi0InAccPtGammaLeg[iCut]->Sumw2();
1797  fMCList[iCut]->Add(fHistoMCPi0InAccPtGammaLeg[iCut]);
1798  fHistoMCPi0WOWeightInAccPtGammaLeg[iCut] = new TH2F("MC_Pi0WOWeightInAcc_PtGamma_Leg", "MC_Pi0WOWeightInAcc_PtGamma_Leg", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 3, -0.5, 2.5);
1799  fMCList[iCut]->Add(fHistoMCPi0WOWeightInAccPtGammaLeg[iCut]);
1800 
1801  fHistoMCSecPi0PtGamma1vsSource[iCut] = new TH2F("MC_SecPi0_PtGamma1_Source", "MC_SecPi0_PtGamma1_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1802  fMCList[iCut]->Add(fHistoMCSecPi0PtGamma1vsSource[iCut]);
1803  fHistoMCSecPi0PtGamma2vsSource[iCut] = new TH2F("MC_SecPi0_PtGamma2_Source", "MC_SecPi0_PtGamma2_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1804  fMCList[iCut]->Add(fHistoMCSecPi0PtGamma2vsSource[iCut]);
1805  fHistoMCSecPi0InAccPtGamma1vsSource[iCut] = new TH2F("MC_SecPi0InAcc_PtGamma1_Source", "MC_SecPi0InAcc_PtGamma1_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1806  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtGamma1vsSource[iCut]);
1807  fHistoMCSecPi0InAccPtGamma2vsSource[iCut] = new TH2F("MC_SecPi0InAcc_PtGamma2_Source", "MC_SecPi0InAcc_PtGamma2_Source", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1808  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtGamma2vsSource[iCut]);
1809 
1810  if (fIsMC > 1){
1811  fHistoMCPi0WOWeightPtGammaLeg[iCut]->Sumw2();
1812  fHistoMCPi0WOWeightInAccPtGammaLeg[iCut]->Sumw2();
1813  fHistoMCSecPi0PtGamma1vsSource[iCut]->Sumw2();
1814  fHistoMCSecPi0PtGamma2vsSource[iCut]->Sumw2();
1815  fHistoMCSecPi0InAccPtGamma1vsSource[iCut]->Sumw2();
1816  fHistoMCSecPi0InAccPtGamma2vsSource[iCut]->Sumw2();
1817  }
1818  }
1819 
1820  // book additional MC QA histograms
1821  if (fDoMesonQA > 0){
1822  fHistoMCPi0PtY[iCut] = new TH2F("MC_Pi0_Pt_Y", "MC_Pi0_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1823  fHistoMCPi0PtY[iCut]->Sumw2();
1824  fMCList[iCut]->Add(fHistoMCPi0PtY[iCut]);
1825  fHistoMCEtaPtY[iCut] = new TH2F("MC_Eta_Pt_Y", "MC_Eta_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
1826  fHistoMCEtaPtY[iCut]->Sumw2();
1827  fMCList[iCut]->Add(fHistoMCEtaPtY[iCut]);
1828  fHistoMCPi0PtAlpha[iCut] = new TH2F("MC_Pi0_Pt_Alpha", "MC_Pi0_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
1829  fMCList[iCut]->Add(fHistoMCPi0PtAlpha[iCut]);
1830  fHistoMCEtaPtAlpha[iCut] = new TH2F("MC_Eta_Pt_Alpha", "MC_Eta_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
1831  fMCList[iCut]->Add(fHistoMCEtaPtAlpha[iCut]);
1832 
1833  if (fIsMC == 2){
1834  fHistoMCPi0PtAlpha[iCut]->Sumw2();
1835  fHistoMCEtaPtAlpha[iCut]->Sumw2();
1836  }
1837  }
1838  }
1839 
1840  fTrueList[iCut] = new TList();
1841  fTrueList[iCut]->SetName(Form("%s_%s_%s_%s True histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1842  fTrueList[iCut]->SetOwner(kTRUE);
1843  fCutFolder[iCut]->Add(fTrueList[iCut]);
1844 
1845  if(!fDoLightOutput){
1846  fHistoTrueConvGammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt", "ESD_TrueConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1847  fHistoTrueConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1848  fTrueList[iCut]->Add(fHistoTrueConvGammaPt[iCut]);
1849 
1850  fHistoDoubleCountTrueConvGammaRPt[iCut] = new TH2F("ESD_TrueDoubleCountConvGamma_R_Pt", "ESD_TrueDoubleCountConvGamma_R_Pt", 800, 0, 200, (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1851  fHistoDoubleCountTrueConvGammaRPt[iCut]->SetXTitle("R (cm)");
1852  fHistoDoubleCountTrueConvGammaRPt[iCut]->SetYTitle("p_{T,clus} (GeV/c)");
1853  fTrueList[iCut]->Add(fHistoDoubleCountTrueConvGammaRPt[iCut]);
1854  fHistoMultipleCountTrueConvGamma[iCut] = new TH1F("ESD_TrueMultipleCountConvGamma", "ESD_TrueMultipleCountConvGamma", 10, 1, 11);
1855  fTrueList[iCut]->Add(fHistoMultipleCountTrueConvGamma[iCut]);
1856 
1857  fHistoCombinatorialPt[iCut] = new TH2F("ESD_TrueCombinatorial_Pt", "ESD_TrueCombinatorial_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 16, -0.5, 15.5);
1858  fHistoCombinatorialPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1859  fHistoCombinatorialPt[iCut]->SetYTitle("origin");
1860  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec+Elec");
1861  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 2,"Elec+Pion");
1862  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 3,"Elec+Kaon");
1863  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 4,"Elec+Proton");
1864  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 5,"Elec+Muon");
1865  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 6,"Pion+Pion");
1866  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 7,"Pion+Kaon");
1867  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 8,"Pion+Proton");
1868  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 9,"Pion+Muon");
1869  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(10,"Kaon+Kaon");
1870  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(11,"Kaon+Proton");
1871  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(12,"Kaon+Muon");
1872  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(13,"Proton+Proton");
1873  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(14,"Proton+Muon");
1874  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(15,"Muon+Muon");
1875  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(16,"Rest");
1876  fTrueList[iCut]->Add(fHistoCombinatorialPt[iCut]);
1877 
1878  fHistoTruePrimaryConvGammaPt[iCut] = new TH1F("ESD_TruePrimaryConvGamma_Pt", "ESD_TruePrimaryConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1879  fHistoTruePrimaryConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1880  fTrueList[iCut]->Add(fHistoTruePrimaryConvGammaPt[iCut]);
1881  fHistoTrueSecondaryConvGammaPt[iCut] = new TH2F("ESD_TrueSecondaryConvGamma_Pt", "ESD_TrueSecondaryConvGamma_Pt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 4, -0.5, 3.5);
1882  fHistoTrueSecondaryConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1883  fHistoTrueSecondaryConvGammaPt[iCut]->SetYTitle("source");
1884  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1885  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1886  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1887  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1888  fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaPt[iCut]);
1889  fHistoTrueSecondaryConvGammaMCPt[iCut] = new TH2F("ESD_TrueSecondaryConvGamma_MCPt", "ESD_TrueSecondaryConvGamma_MCPt", (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, 4, -0.5, 3.5);
1890  fHistoTrueSecondaryConvGammaMCPt[iCut]->SetXTitle("p_{T, MC, clus} (GeV/c)");
1891  fHistoTrueSecondaryConvGammaMCPt[iCut]->SetYTitle("source");
1892  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1893  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1894  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1895  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1896  fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaMCPt[iCut]);
1897 
1898  fHistoTruePrimaryConvGammaESDPtMCPt[iCut] = new TH2F("ESD_TruePrimaryConvGammaESD_PtMCPt", "ESD_TruePrimaryConvGammaESD_PtMCPt",
1899  (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1900  fHistoTruePrimaryConvGammaESDPtMCPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1901  fHistoTruePrimaryConvGammaESDPtMCPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1903 
1904  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryConvGammaFromXFromK0sESD_MCPtPt", "ESD_TrueSecondaryConvGammaFromXFromK0sESD_MCPtPt",
1905  (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1906  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1907  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1909  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryConvGammaFromXFromK0lESD_MCPtPt", "ESD_TrueSecondaryConvGammaFromXFromK0lESD_MCPtPt",
1910  (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1911  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1912  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1914  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryConvGammaFromXFromLambdaESD_MCPtPt", "ESD_TrueSecondaryConvGammaFromXFromLambdaESD_MCPtPt",
1915  (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt, (Int_t)((maxPt-minPt)/binWidthPt), minPt, maxPt);
1916  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1917  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1919  }
1920 
1921  fHistoTrueClusGammaPt[iCut] = new TH1F("TrueClusGamma_Pt", "ESD_TrueClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1922  fHistoTrueClusGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1923  fClusterOutputList[iCut]->Add(fHistoTrueClusGammaPt[iCut]);
1924  if(!fDoLightOutput){
1925  fHistoTruePrimaryClusGammaPt[iCut] = new TH1F("TruePrimaryClusGamma_Pt", "ESD_TruePrimaryClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1926  fHistoTruePrimaryClusGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1928  fHistoTruePrimaryClusGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusGamma_Pt_MCPt", "ESD_TruePrimaryClusGamma_Pt_MCPt", nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1929  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1930  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1932  fHistoTrueClusElectronPt[iCut] = new TH1F("TrueClusElectron_Pt", "TrueElectronGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1933  fHistoTrueClusElectronPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1934  fClusterOutputList[iCut]->Add(fHistoTrueClusElectronPt[iCut]);
1935  fHistoTrueClusConvGammaPt[iCut] = new TH1F("TrueClusConvGamma_Pt", "TrueClusConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1936  fHistoTrueClusConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1938  fHistoTruePrimaryClusConvGammaPt[iCut] = new TH1F("TruePrimaryClusConvGamma_Pt", "ESD_TruePrimaryClusConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1939  fHistoTruePrimaryClusConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1941  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusConvGamma_Pt_MCPt", "ESD_TruePrimaryClusConvGamma_Pt_MCPt", nBinsClusterPt, arrClusPtBinning, nBinsClusterPt, arrClusPtBinning);
1942  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1943  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut]->SetYTitle("p_{T, MC, clus} (GeV/c)");
1945 
1946  fHistoTrueSecondaryClusGammaPt[iCut] = new TH1F("TrueSecondaryClusGamma_Pt", "ESD_TrueSecondaryClusGamma_Pt", nBinsClusterPt, arrClusPtBinning);
1947  fHistoTrueSecondaryClusGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1949  fHistoTrueSecondaryClusGammaFromK0sPt[iCut] = new TH1F("TrueSecondaryClusGammaFromK0s_Pt", "ESD_TrueSecondaryClusGammaFromK0s_Pt", nBinsClusterPt, arrClusPtBinning);
1950  fHistoTrueSecondaryClusGammaFromK0sPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1952  fHistoTrueSecondaryClusGammaFromK0lPt[iCut] = new TH1F("TrueSecondaryClusGammaFromK0l_Pt", "ESD_TrueSecondaryClusGammaFromK0l_Pt", nBinsClusterPt, arrClusPtBinning);
1953  fHistoTrueSecondaryClusGammaFromK0lPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1955  fHistoTrueSecondaryClusGammaFromLambdaPt[iCut] = new TH1F("TrueSecondaryClusGammaFromLambda_Pt", "ESD_TrueSecondaryClusGammaFromLambda_Pt", nBinsClusterPt, arrClusPtBinning);
1956  fHistoTrueSecondaryClusGammaFromLambdaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1958  }
1959 
1960  fHistoDoubleCountTrueClusterGammaPt[iCut] = new TH2F("TrueDoubleCountClusterGamma_Pt", "TrueDoubleCountClusterGamma_Pt", nBinsClusterPt, arrClusPtBinning, 2, 0, 2);
1961  fHistoDoubleCountTrueClusterGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1963  fHistoMultipleCountTrueClusterGamma[iCut] = new TH1F("TrueMultipleCountClusterGamma", "TrueMultipleCountClusterGamma", 10, 1, 11);
1965  if(!fDoLightOutput) {
1966  fHistoTrueNLabelsInClusPt[iCut] = new TH2F("TrueNLabelsInClus_Pt", "TrueNLabelsInClus_Pt", 100, -0.5, 99.5, nBinsClusterPt, arrClusPtBinning);
1967  fHistoTrueNLabelsInClusPt[iCut]->SetYTitle("p_{T,clus} (GeV/c)");
1969  fHistoTrueClusGammaEM02[iCut] = new TH2F("TrueClusGammaEM02", "TrueClusGammaEM02", nBinsClusterPt, arrClusPtBinning, 400, 0, 5);
1970  fClusterOutputList[iCut]->Add(fHistoTrueClusGammaEM02[iCut]);
1971  fHistoTrueClusPi0EM02[iCut] = new TH2F("TrueClusPi0EM02", "TrueClusPi0EM02", nBinsClusterPt, arrClusPtBinning, 400, 0, 5);
1972  fClusterOutputList[iCut]->Add(fHistoTrueClusPi0EM02[iCut]);
1973  fHistoTrueClusEMNonLeadingPt[iCut] = new TH1F("TrueClusEMNonLeading_Pt", "TrueClusEMNonLeading_Pt", nBinsClusterPt, arrClusPtBinning);
1974  fHistoTrueClusEMNonLeadingPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
1976  }
1977 
1978 
1979  if (fIsMC > 1){
1980  if(!fDoLightOutput){
1981  fHistoTrueConvGammaPt[iCut]->Sumw2();
1982  fHistoDoubleCountTrueConvGammaRPt[iCut]->Sumw2();
1983  fHistoMultipleCountTrueConvGamma[iCut]->Sumw2();
1984  fHistoCombinatorialPt[iCut]->Sumw2();
1985  fHistoTruePrimaryConvGammaPt[iCut]->Sumw2();
1986  fHistoTrueSecondaryConvGammaPt[iCut]->Sumw2();
1987  fHistoTrueSecondaryConvGammaMCPt[iCut]->Sumw2();
1988  fHistoTruePrimaryConvGammaESDPtMCPt[iCut]->Sumw2();
1992  }
1993  fHistoTrueClusGammaPt[iCut]->Sumw2();
1994  fHistoDoubleCountTrueClusterGammaPt[iCut]->Sumw2();
1995  fHistoMultipleCountTrueClusterGamma[iCut]->Sumw2();
1996  if(!fDoLightOutput) {
1997  fHistoTruePrimaryClusGammaPt[iCut]->Sumw2();
1998  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->Sumw2();
1999  fHistoTrueNLabelsInClusPt[iCut]->Sumw2();
2000  fHistoTrueClusGammaEM02[iCut]->Sumw2();
2001  fHistoTrueClusPi0EM02[iCut]->Sumw2();
2002  fHistoTrueClusElectronPt[iCut]->Sumw2();
2003  fHistoTrueClusConvGammaPt[iCut]->Sumw2();
2004  fHistoTruePrimaryClusConvGammaPt[iCut]->Sumw2();
2006  fHistoTrueClusEMNonLeadingPt[iCut]->Sumw2();
2007  fHistoTrueSecondaryClusGammaPt[iCut]->Sumw2();
2011  }
2012  }
2013 
2014  if(!fDoLightOutput){
2015  fHistoTruePi0InvMassECalib[iCut] = new TH2F("True_Pi0_InvMass_E_Calib", "True_Pi0_InvMass_E_Calib", 800, 0, 0.8, nBinsPt, arrPtBinning);
2016  fHistoTruePi0InvMassECalib[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
2017  fHistoTruePi0InvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
2018  fESDList[iCut]->Add(fHistoTruePi0InvMassECalib[iCut]);
2019  fHistoTruePi0PureGammaInvMassECalib[iCut] = new TH2F("True_Pi0PureGamma_InvMass_E_Calib", "True_Pi0PureGamma_InvMass_E_Calib", 800, 0, 0.8, nBinsPt, arrPtBinning);
2020  fHistoTruePi0PureGammaInvMassECalib[iCut]->SetXTitle("M_{inv} (GeV/c^{2})");
2021  fHistoTruePi0PureGammaInvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
2023  }
2024 
2025  if (fDoClusterQA > 0){
2026  fHistoTrueClusConvGammaFullyPt[iCut] = new TH1F("TrueClusConvGammaFullyContained_Pt", "TrueClusConvGammaFullyContained_Pt", nBinsClusterPt, arrClusPtBinning);
2027  fHistoTrueClusConvGammaFullyPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2029  fHistoTrueClusMergedGammaPt[iCut] = new TH1F("TrueClusMergedGamma_Pt", "TrueClusMergedGamma_Pt", nBinsClusterPt, arrClusPtBinning);
2030  fHistoTrueClusMergedGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2032  fHistoTrueClusMergedPartConvGammaPt[iCut] = new TH1F("TrueClusMergedPartConvGamma_Pt", "TrueClusMergedPartConvGamma_Pt", nBinsClusterPt, arrClusPtBinning);
2033  fHistoTrueClusMergedPartConvGammaPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2035  fHistoTrueClusDalitzPt[iCut] = new TH1F("TrueClusDalitz_Pt", "TrueClusDalitz_Pt", nBinsClusterPt, arrClusPtBinning);
2036  fHistoTrueClusDalitzPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2037  fClusterOutputList[iCut]->Add(fHistoTrueClusDalitzPt[iCut]);
2038  fHistoTrueClusDalitzMergedPt[iCut] = new TH1F("TrueClusDalitzMerged_Pt", "TrueClusDalitzMerged_Pt", nBinsClusterPt, arrClusPtBinning);
2039  fHistoTrueClusDalitzMergedPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2041  fHistoTrueClusPhotonFromElecMotherPt[iCut] = new TH1F("TrueClusPhotonFromElecMother_Pt", "TrueClusPhotonFromElecMother_Pt", nBinsClusterPt, arrClusPtBinning);
2042  fHistoTrueClusPhotonFromElecMotherPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2044  fHistoTrueClusShowerPt[iCut] = new TH1F("TrueClusShower_Pt", "TrueClusShower_Pt", nBinsClusterPt, arrClusPtBinning);
2045  fHistoTrueClusShowerPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2046  fClusterOutputList[iCut]->Add(fHistoTrueClusShowerPt[iCut]);
2047  fHistoTrueClusSubLeadingPt[iCut] = new TH1F("TrueClusSubleading_Pt", "TrueClusSubleading_Pt", nBinsClusterPt, arrClusPtBinning);
2048  fHistoTrueClusSubLeadingPt[iCut]->SetXTitle("p_{T,clus} (GeV/c)");
2050  fHistoTrueClusNMothers[iCut] = new TH1F("TrueClusNParticles", "TrueClusNParticles", 20, 0, 20);
2051  fHistoTrueClusNMothers[iCut]->SetXTitle("# particles in cluster");
2052  fClusterOutputList[iCut]->Add(fHistoTrueClusNMothers[iCut]);
2053  if (fIsMC > 1){
2054  fHistoTrueClusConvGammaFullyPt[iCut]->Sumw2();
2055  fHistoTrueClusMergedGammaPt[iCut]->Sumw2();
2056  fHistoTrueClusMergedPartConvGammaPt[iCut]->Sumw2();
2057  fHistoTrueClusDalitzPt[iCut]->Sumw2();
2058  fHistoTrueClusDalitzMergedPt[iCut]->Sumw2();
2059  fHistoTrueClusPhotonFromElecMotherPt[iCut]->Sumw2();
2060  fHistoTrueClusShowerPt[iCut]->Sumw2();
2061  fHistoTrueClusSubLeadingPt[iCut]->Sumw2();
2062  fHistoTrueClusNMothers[iCut]->Sumw2();
2063  }
2064  }
2065 
2066  if(fDoMesonAnalysis){
2067  fHistoTruePi0InvMassPt[iCut] = new TH2F("ESD_TruePi0_InvMass_Pt", "ESD_TruePi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2068  fHistoTruePi0InvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2069  fHistoTruePi0InvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2070  fTrueList[iCut]->Add(fHistoTruePi0InvMassPt[iCut]);
2071  fHistoTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueEta_InvMass_Pt", "ESD_TrueEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2072  fHistoTrueEtaInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2})");
2073  fHistoTrueEtaInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2074  fTrueList[iCut]->Add(fHistoTrueEtaInvMassPt[iCut]);
2075  fHistoTruePi0MatchedInvMassPt[iCut] = new TH2F("ESD_TruePi0_Matched_InvMass_Pt", "ESD_TruePi0_Matched_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2076  fHistoTruePi0MatchedInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2077  fHistoTruePi0MatchedInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2078  fTrueList[iCut]->Add(fHistoTruePi0MatchedInvMassPt[iCut]);
2079  fHistoTrueEtaMatchedInvMassPt[iCut] = new TH2F("ESD_TrueEta_Matched_InvMass_Pt", "ESD_TrueEta_Matched_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2080  fHistoTrueEtaMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2})");
2081  fHistoTrueEtaMatchedInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2082  fTrueList[iCut]->Add(fHistoTrueEtaMatchedInvMassPt[iCut]);
2083 
2084  fHistoDoubleCountTruePi0InvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountPi0_InvMass_Pt", "ESD_TrueDoubleCountPi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2085  fHistoDoubleCountTruePi0InvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2086  fHistoDoubleCountTruePi0InvMassPt[iCut]->SetYTitle("#pi^{0} p_{T}(GeV/c)");
2087  fTrueList[iCut]->Add(fHistoDoubleCountTruePi0InvMassPt[iCut]);
2088  fHistoMultipleCountTruePi0[iCut] = new TH1F("ESD_TrueMultipleCountPi0", "ESD_TrueMultipleCountPi0", 10, 1, 11);
2089  fHistoMultipleCountTruePi0[iCut]->SetXTitle("# number of multiple counts");
2090  fTrueList[iCut]->Add(fHistoMultipleCountTruePi0[iCut]);
2091  fHistoDoubleCountTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountEta_InvMass_Pt", "ESD_TrueDoubleCountEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2092  fHistoDoubleCountTrueEtaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2093  fHistoDoubleCountTrueEtaInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2094  fTrueList[iCut]->Add(fHistoDoubleCountTrueEtaInvMassPt[iCut]);
2095  fHistoMultipleCountTrueEta[iCut] = new TH1F("ESD_TrueMultipleCountEta", "ESD_TrueMultipleCountEta", 10, 1, 11);
2096  fHistoMultipleCountTrueEta[iCut]->SetXTitle("# number of multiple counts");
2097  fTrueList[iCut]->Add(fHistoMultipleCountTrueEta[iCut]);
2098 
2099  fHistoTruePrimaryPi0InvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_Pt", "ESD_TruePrimaryPi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2100  fHistoTruePrimaryPi0InvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}}(GeV/c^{2})");
2101  fHistoTruePrimaryPi0InvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2102  fHistoTruePrimaryPi0InvMassPt[iCut]->Sumw2();
2103  fTrueList[iCut]->Add(fHistoTruePrimaryPi0InvMassPt[iCut]);
2104 
2105  fHistoTruePrimaryEtaInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEta_InvMass_Pt", "ESD_TruePrimaryEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2106  fHistoTruePrimaryEtaInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta}(GeV/c^{2})");
2107  fHistoTruePrimaryEtaInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2108  fHistoTruePrimaryEtaInvMassPt[iCut]->Sumw2();
2109  fTrueList[iCut]->Add(fHistoTruePrimaryEtaInvMassPt[iCut]);
2110 
2111  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt", "ESD_TruePrimaryPi0W0Weights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2112  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}}(GeV/c^{2})");
2113  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2115 
2116  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEtaW0Weights_InvMass_Pt", "ESD_TruePrimaryEtaW0Weights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2117  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta}(GeV/c^{2})");
2118  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2120 
2121  fProfileTruePrimaryPi0WeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryPi0Weights_InvMass_Pt", "ESD_TruePrimaryPi0Weights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2122  fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}}(GeV/c^{2})");
2123  fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2126  fProfileTruePrimaryEtaWeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryEtaWeights_InvMass_Pt", "ESD_TruePrimaryEtaWeights_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2127  fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta}(GeV/c^{2})");
2128  fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2131 
2132  fHistoTrueSecondaryPi0InvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_Pt", "ESD_TrueSecondaryPi0_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2133  fHistoTrueSecondaryPi0InvMassPt[iCut]->SetXTitle("M_{inv,sec #pi^{0}}(GeV/c^{2})");
2134  fHistoTrueSecondaryPi0InvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2135  fHistoTrueSecondaryPi0InvMassPt[iCut]->Sumw2();
2136  fTrueList[iCut]->Add(fHistoTrueSecondaryPi0InvMassPt[iCut]);
2137 
2138  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_Pt", "ESD_TrueSecondaryPi0FromK0s_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2139  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from K^{0}_{S}}(GeV/c^{2})");
2140  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2143  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0l_InvMass_Pt", "ESD_TrueSecondaryPi0FromK0l_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2144  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from K^{0}_{L}}(GeV/c^{2})");
2145  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2148  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromEta_InvMass_Pt", "ESD_TrueSecondaryPi0FromEta_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2149  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from #eta}(GeV/c^{2})");
2150  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2152  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_Pt", "ESD_TrueSecondaryPi0FromLambda_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2153  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from #Lambda}(GeV/c^{2})");
2154  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2156 
2157  if(!fDoLightOutput) {
2158  fHistoTruePrimaryPi0PhotonPairPtconv[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_PtConv", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2159  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2160  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2161  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->Sumw2();
2163 
2164  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2165  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2166  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2168 
2169  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_PtConv", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2170  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2171  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2174 
2175  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_PtConv", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2176  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2177  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2180 
2181  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0l_InvMass_PtConv", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2182  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2183  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2186 
2187  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv[iCut]= new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_PtConv", "", 400, 0, 0.4, nBinsPt, arrPtBinning);
2188  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2189  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv} p_{T} (GeV/c)");
2192 
2193  fHistoTruePrimaryPi0DCPtconv[iCut] = new TH1F("ESD_TruePrimaryPi0DC_PtConv", "", nBinsPt, arrPtBinning);
2194  fHistoTruePrimaryPi0DCPtconv[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
2195  fHistoTruePrimaryPi0DCPtconv[iCut]->Sumw2();
2196  fTrueList[iCut]->Add(fHistoTruePrimaryPi0DCPtconv[iCut]);
2197 
2198  fHistoTrueSecondaryPi0DCPtconvSource[iCut] = new TH2F("ESD_TrueSecondaryPi0DC_PtConv_Source", "", nBinsPt, arrPtBinning, 4, -0.5, 3.5);
2199  fHistoTrueSecondaryPi0DCPtconvSource[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
2200  fHistoTrueSecondaryPi0DCPtconvSource[iCut]->SetYTitle("sec. source");
2201  fHistoTrueSecondaryPi0DCPtconvSource[iCut]->Sumw2();
2203 
2204  fHistoTruePrimaryPi0MissingPtconv[iCut] = new TH1F("ESD_TruePrimaryPi0Missing_PtConv", "", nBinsPt, arrPtBinning);
2205  fHistoTruePrimaryPi0MissingPtconv[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
2206  fHistoTruePrimaryPi0MissingPtconv[iCut]->Sumw2();
2207  fTrueList[iCut]->Add(fHistoTruePrimaryPi0MissingPtconv[iCut]);
2208 
2209  fHistoTrueSecondaryPi0MissingPtconvSource[iCut] = new TH2F("ESD_TrueSecondaryPi0Missing_PtConv_Source", "", nBinsPt, arrPtBinning, 4, -0.5, 3.5);
2210  fHistoTrueSecondaryPi0MissingPtconvSource[iCut]->SetXTitle("#gamma^{conv} p_{T} (GeV/c)");
2211  fHistoTrueSecondaryPi0MissingPtconvSource[iCut]->SetYTitle("sec. source");
2214 
2215  // put proper summing for JJ weights
2216  if (fIsMC > 1){
2218  }
2219  }
2220 
2221  if (fIsMC > 1){
2222  fHistoTruePi0InvMassPt[iCut]->Sumw2();
2223  fHistoTrueEtaInvMassPt[iCut]->Sumw2();
2224  fHistoTruePi0MatchedInvMassPt[iCut]->Sumw2();
2225  fHistoTrueEtaMatchedInvMassPt[iCut]->Sumw2();
2226  fHistoDoubleCountTruePi0InvMassPt[iCut]->Sumw2();
2227  fHistoMultipleCountTruePi0[iCut]->Sumw2();
2228  fHistoDoubleCountTrueEtaInvMassPt[iCut]->Sumw2();
2229  fHistoMultipleCountTrueEta[iCut]->Sumw2();
2234  }
2235 
2236  if (fDoMesonQA > 0){
2237  if (fIsMC < 2){
2238  fHistoTruePi0CaloPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloPhoton_InvMass_Pt", "ESD_TruePi0CaloPhoton_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2239  fHistoTruePi0CaloPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma #gamma");
2240  fHistoTruePi0CaloPhotonInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2241  fTrueList[iCut]->Add(fHistoTruePi0CaloPhotonInvMassPt[iCut]);
2242 
2243  fHistoTrueEtaCaloPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloPhoton_InvMass_Pt", "ESD_TrueEtaCaloPhoton_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2244  fHistoTrueEtaCaloPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma #gamma");
2245  fHistoTrueEtaCaloPhotonInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2246  fTrueList[iCut]->Add(fHistoTrueEtaCaloPhotonInvMassPt[iCut]);
2247 
2248  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhoton_InvMass_Pt", "ESD_TruePi0CaloConvertedPhoton_InvMass_Pt",
2249  800, 0, 0.8, nBinsPt, arrPtBinning);
2250  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma #gamma_{conv}");
2251  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2253 
2254  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt", "ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt",
2255  800, 0, 0.8, nBinsPt, arrPtBinning);
2256  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma #gamma_{conv,matched}");
2257  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2259 
2260  fHistoTruePi0CaloConvPhotonConvRPt[iCut] = new TH2F("ESD_TruePi0CaloConvPhoton_ConvR_PtE", "ESD_TruePi0CaloConvPhoton_ConvR_PtE", 920, 0, 460, nBinsPt, arrPtBinning);
2261  fHistoTruePi0CaloConvPhotonConvRPt[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2262  fHistoTruePi0CaloConvPhotonConvRPt[iCut]->SetYTitle("e^{#pm}p_{T}(GeV/c)");
2264 
2265  fHistoTruePi0CaloConvPhotonConvRAlpha[iCut] = new TH2F("ESD_TruePi0CaloConvPhoton_ConvR_AlphaE", "ESD_TruePi0CaloConvPhoton_ConvR_AlphaE", 920, 0, 460, 200, -1, 1);
2266  fHistoTruePi0CaloConvPhotonConvRAlpha[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2267  fHistoTruePi0CaloConvPhotonConvRAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2269 
2270  fHistoTruePi0CaloConvPhotonPtAlpha[iCut] = new TH2F("ESD_TruePi0CaloConvPhoton_PtE_AlphaE", "ESD_TruePi0CaloConvPhoton_PtE_AlphaE", nBinsPt, arrPtBinning, 200, -1, 1);
2271  fHistoTruePi0CaloConvPhotonPtAlpha[iCut]->SetXTitle("e^{#pm}p_{T}(GeV/c)");
2272  fHistoTruePi0CaloConvPhotonPtAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2274 
2275  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt", "ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt",
2276  800, 0, 0.8, nBinsPt, arrPtBinning);
2277  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma #gamma_{conv}");
2278  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2280 
2281  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt", "ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt",
2282  800, 0, 0.8, nBinsPt, arrPtBinning);
2283  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma #gamma_{conv,matched}");
2284  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2286 
2287  fHistoTrueEtaCaloConvPhotonConvRPt[iCut] = new TH2F("ESD_TrueEtaCaloConvPhoton_ConvR_PtE", "ESD_TrueEtaCaloConvPhoton_ConvR_PtE", 920, 0, 460, nBinsPt, arrPtBinning);
2288  fHistoTrueEtaCaloConvPhotonConvRPt[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2289  fHistoTrueEtaCaloConvPhotonConvRPt[iCut]->SetYTitle("e^{#pm}p_{T}(GeV/c)");
2291 
2292  fHistoTrueEtaCaloConvPhotonConvRAlpha[iCut] = new TH2F("ESD_TrueEtaCaloConvPhoton_ConvR_AlphaE", "ESD_TrueEtaCaloConvPhoton_ConvR_AlphaE", 920, 0, 460, 200, -1, 1);
2293  fHistoTrueEtaCaloConvPhotonConvRAlpha[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2294  fHistoTrueEtaCaloConvPhotonConvRAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2296 
2297  fHistoTrueEtaCaloConvPhotonPtAlpha[iCut] = new TH2F("ESD_TrueEtaCaloConvPhoton_PtE_AlphaE", "ESD_TrueEtaCaloConvPhoton_PtE_AlphaE", nBinsPt, arrPtBinning, 200, -1, 1);
2298  fHistoTrueEtaCaloConvPhotonPtAlpha[iCut]->SetXTitle("e^{#pm}p_{T}(GeV/c)");
2299  fHistoTrueEtaCaloConvPhotonPtAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2301 
2302 
2303  fHistoTruePi0CaloElectronInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloElectron_InvMass_Pt", "ESD_TruePi0CaloElectron_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2304  fHistoTruePi0CaloElectronInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma e^{#pm}");
2305  fHistoTruePi0CaloElectronInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2307  fHistoTrueEtaCaloElectronInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloElectron_InvMass_Pt", "ESD_TrueEtaCaloElectron_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2308  fHistoTrueEtaCaloElectronInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma e^{#pm}");
2309  fHistoTrueEtaCaloElectronInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2311 
2312  fHistoTruePi0CaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedCluster_InvMass_Pt", "ESD_TruePi0CaloMergedCluster_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2313  fHistoTruePi0CaloMergedClusterInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma merged cluster");
2314  fHistoTruePi0CaloMergedClusterInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2316  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedCluster_InvMass_Pt", "ESD_TrueEtaCaloMergedCluster_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2317  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma merged cluster");
2318  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2320 
2321  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloEMNonLeading_InvMass_Pt", "ESD_TrueMotherCaloEMNonLeading_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2322  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) #gamma cluster no leading EM");
2323  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2325  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt", "ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt",
2326  800, 0, 0.8, nBinsPt, arrPtBinning);
2327  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma merged cluster, part conv");
2328  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2330  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt", "ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt",
2331  800, 0, 0.8, nBinsPt, arrPtBinning);
2332  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma merged cluster, part conv");
2333  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2335 
2336  fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt", "ESD_TruePrimaryPi0_ResolPt_MCPt", 500, 0.03, 25, 1000, -1., 1.);
2337  fHistoTruePrimaryPi0MCPtResolPt[iCut]->SetXTitle("#pi^{0}p_{T,MC}(GeV/c)");
2338  fHistoTruePrimaryPi0MCPtResolPt[iCut]->SetYTitle("#pi^{0}(p_{T,rec}-p_{T,MC})/p_{T,MC}()");
2339  fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
2341  fTrueList[iCut]->Add(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
2342 
2343  fHistoTruePrimaryEtaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt", "ESD_TruePrimaryEta_ResolPt_MCPt", 500, 0.03, 25, 1000, -1., 1.);
2344  fHistoTruePrimaryEtaMCPtResolPt[iCut]->SetXTitle("#eta p_{T,MC}(GeV/c)");
2345  fHistoTruePrimaryEtaMCPtResolPt[iCut]->SetYTitle("#eta (p_{T,rec}-p_{T,MC})/p_{T,MC}()");
2346  fHistoTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
2348  fTrueList[iCut]->Add(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
2349 
2350  fHistoTrueK0sWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0sWithPi0Daughter_MCPt", "ESD_TrueK0sWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2351  fHistoTrueK0sWithPi0DaughterMCPt[iCut]->SetXTitle("K^{0}_{s}p_{MC,T}(GeV/c) for K^{0}_{s}where #pi^{0}rec ");
2352  fTrueList[iCut]->Add(fHistoTrueK0sWithPi0DaughterMCPt[iCut]);
2353  fHistoTrueK0lWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0lWithPi0Daughter_MCPt", "ESD_TrueK0lWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2354  fHistoTrueK0lWithPi0DaughterMCPt[iCut]->SetXTitle("K^{0}_{s}p_{MC,T}(GeV/c) for K^{0}_{l}where #pi^{0}rec ");
2355  fTrueList[iCut]->Add(fHistoTrueK0lWithPi0DaughterMCPt[iCut]);
2356  fHistoTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt", "ESD_TrueEtaWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2357  fHistoTrueEtaWithPi0DaughterMCPt[iCut]->SetXTitle("#eta p_{MC,T}(GeV/c) for #eta where #pi^{0}rec ");
2358  fTrueList[iCut]->Add(fHistoTrueEtaWithPi0DaughterMCPt[iCut]);
2359  fHistoTrueLambdaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueLambdaWithPi0Daughter_MCPt", "ESD_TrueLambdaWithPi0Daughter_MCPt", nBinsPt, arrPtBinning);
2360  fHistoTrueLambdaWithPi0DaughterMCPt[iCut]->SetXTitle("#Lambda p_{MC,T}(GeV/c) for #Lambda where #pi^{0}rec ");
2362  }
2363  if(fDoMesonQA>1){
2364  fHistoTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt", "ESD_TrueBckGG_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2365  fHistoTrueBckGGInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) #gamma #gamma no signal");
2366  fHistoTrueBckGGInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2367  fTrueList[iCut]->Add(fHistoTrueBckGGInvMassPt[iCut]);
2368  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut] = new TH2F("ESD_TrueBckFullMesonContained_InvMass_Pt", "ESD_TrueBckFullMesonContained_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2369  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) #gamma #gamma, calo gamma with full pi0");
2370  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2372  fHistoTrueBckAsymEClustersInvMassPt[iCut] = new TH2F("ESD_TrueBckAsymEClus_InvMass_Pt", "ESD_TrueBckAsymEClus_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2373  fHistoTrueBckAsymEClustersInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) #gamma #gamma, calo gamma >70% of pi0 energy");
2374  fHistoTrueBckAsymEClustersInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2376  fHistoTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt", "ESD_TrueBckCont_InvMass_Pt", 800, 0, 0.8, nBinsPt, arrPtBinning);
2377  fHistoTrueBckContInvMassPt[iCut]->SetXTitle("M_{inv} (GeV/c^{2}) contamination");
2378  fHistoTrueBckContInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2379  fTrueList[iCut]->Add(fHistoTrueBckContInvMassPt[iCut]);
2380  }
2381  fHistoTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y", "ESD_TruePi0_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
2382  fHistoTruePi0PtY[iCut]->SetYTitle("Y_{#pi^{0}}");
2383  fHistoTruePi0PtY[iCut]->SetXTitle("#pi^{0}p_{T}(GeV/c)");
2384  fTrueList[iCut]->Add(fHistoTruePi0PtY[iCut]);
2385  fHistoTrueEtaPtY[iCut] = new TH2F("ESD_TrueEta_Pt_Y", "ESD_TrueEta_Pt_Y", nBinsQAPt, arrQAPtBinning, 150, -1.5, 1.5);
2386  fHistoTrueEtaPtY[iCut]->SetYTitle("Y_{#eta}");
2387  fHistoTrueEtaPtY[iCut]->SetXTitle("#eta p_{T}(GeV/c)");
2388  fTrueList[iCut]->Add(fHistoTrueEtaPtY[iCut]);
2389  fHistoTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha", "ESD_TruePi0_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
2390  fHistoTruePi0PtAlpha[iCut]->SetYTitle("#alpha_{#pi^{0}}");
2391  fHistoTruePi0PtAlpha[iCut]->SetXTitle("#pi^{0}p_{T}(GeV/c)");
2392  fTrueList[iCut]->Add(fHistoTruePi0PtAlpha[iCut]);
2393  fHistoTrueEtaPtAlpha[iCut] = new TH2F("ESD_TrueEta_Pt_Alpha", "ESD_TrueEta_Pt_Alpha", nBinsQAPt, arrQAPtBinning, 200, -1, 1);
2394  fHistoTrueEtaPtAlpha[iCut]->SetYTitle("#alpha_{#eta}");
2395  fHistoTrueEtaPtAlpha[iCut]->SetXTitle("#eta p_{T}(GeV/c)");
2396  fTrueList[iCut]->Add(fHistoTrueEtaPtAlpha[iCut]);
2397 
2398  fHistoTruePi0PtOpenAngle[iCut] = new TH2F("ESD_TruePi0_Pt_OpenAngle", "ESD_TruePi0_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning, 100, 0, 1);
2399  fHistoTruePi0PtOpenAngle[iCut]->SetYTitle("#theta_{#pi^{0}}");
2400  fHistoTruePi0PtOpenAngle[iCut]->SetXTitle("#pi^{0}p_{T}(GeV/c)");
2401  fTrueList[iCut]->Add(fHistoTruePi0PtOpenAngle[iCut]);
2402  fHistoTrueEtaPtOpenAngle[iCut] = new TH2F("ESD_TrueEta_Pt_OpenAngle", "ESD_TrueEta_Pt_OpenAngle", nBinsQAPt, arrQAPtBinning, 200, 0, TMath::Pi());
2403  fHistoTrueEtaPtOpenAngle[iCut]->SetYTitle("#theta_{#eta}");
2404  fHistoTrueEtaPtOpenAngle[iCut]->SetXTitle("#eta p_{T}(GeV/c)");
2405  fTrueList[iCut]->Add(fHistoTrueEtaPtOpenAngle[iCut]);
2406 
2407  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut] = new TH2F("ESD_TrueMotherPi0ConvPhoton_Eta_Phi", "conv photons for true #pi^{0}", 600, 0, 2*TMath::Pi(), 200, -1, 1);
2408  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
2409  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
2411  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut] = new TH2F("ESD_TrueMotherEtaConvPhoton_Eta_Phi", "conv photons for true #eta", 600, 0, 2*TMath::Pi(), 200, -1, 1);
2412  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
2413  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
2415 
2416  if (fIsMC > 1){
2417  if(fDoMesonQA>1){
2418  fHistoTrueBckGGInvMassPt[iCut]->Sumw2();
2420  fHistoTrueBckAsymEClustersInvMassPt[iCut]->Sumw2();
2421  fHistoTrueBckContInvMassPt[iCut]->Sumw2();
2422  }
2423  fHistoTruePi0PtY[iCut]->Sumw2();
2424  fHistoTrueEtaPtY[iCut]->Sumw2();
2425  fHistoTruePi0PtAlpha[iCut]->Sumw2();
2426  fHistoTrueEtaPtAlpha[iCut]->Sumw2();
2427  fHistoTruePi0PtOpenAngle[iCut]->Sumw2();
2428  fHistoTrueEtaPtOpenAngle[iCut]->Sumw2();
2429  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->Sumw2();
2430  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->Sumw2();
2431  }
2432  }
2433  }
2434  }
2435  }
2436 
2441 
2442  fMapMultipleCountTruePi0s.clear();
2443  fMapMultipleCountTrueEtas.clear();
2446 
2447  fVectorRecTruePi0s.clear();
2448  fVectorRecTrueEtas.clear();
2449 
2450  if(fV0Reader)
2452  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
2453  fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
2454  if(fV0Reader)
2456  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
2457  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
2458 
2462 
2463  for(Int_t iMatcherTask = 0; iMatcherTask < 3; iMatcherTask++){
2464  AliCaloTrackMatcher* temp = (AliCaloTrackMatcher*) (AliAnalysisManager::GetAnalysisManager()->GetTask(Form("CaloTrackMatcher_%i",iMatcherTask)));
2465  if(temp) fOutputContainer->Add(temp->GetCaloTrackMatcherHistograms());
2466  }
2467 
2468 
2469 
2470  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2471  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
2472  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
2473  fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
2474  }
2475  if(!((AliConversionPhotonCuts*)fCutArray->At(iCut))) continue;
2476  if(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms()){
2477  fCutFolder[iCut]->Add(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms());
2478  }
2479  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
2480  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
2481  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
2482  }
2483  if(fSetPlotHistsExtQA){
2484  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
2485  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms()){
2486  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms());
2487  }
2488  }
2489  if(fDoMesonAnalysis){
2490  if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
2491  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
2492  fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
2493  }
2494  }
2495  }
2496 
2497  if (fIsMC > 0){
2498  tBrokenFiles = new TTree("BrokenFiles", "BrokenFiles");
2499  tBrokenFiles->Branch("fileName",&fFileNameBroken);
2501  }
2502 
2503 
2504  PostData(1, fOutputContainer);
2505 }
2506 //_____________________________________________________________________________
2508 {
2509  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2510  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
2511  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
2512  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
2513  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
2514  }
2515 
2516  if(fIsHeavyIon == 2){
2517  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
2518  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2519  continue; // No Eta Shift requested, continue
2520  }
2521  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
2522  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
2523  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2524  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
2525  continue;
2526  } else{
2527  printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
2528  (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
2529  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2530  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
2531  }
2532  }
2533  }
2534 
2535  return kTRUE;
2536 }
2537 //_____________________________________________________________________________
2539 {
2540  //
2541  // Called for each event
2542  //
2543  fInputEvent = InputEvent();
2544 
2545  if(fIsMC > 0) fMCEvent = MCEvent();
2546 
2547  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
2548  if(fInputEvent->IsIncompleteDAQ()==kTRUE) eventQuality = 2;// incomplete event
2549  // Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1 or because it is incomplete => abort processing of this event/file
2550  if(eventQuality == 2 || eventQuality == 3){
2551  // write out name of broken file for first event
2552  if (fIsMC > 0){
2553  if (fInputEvent->IsA()==AliESDEvent::Class()){
2554  if (((AliESDEvent*)fInputEvent)->GetEventNumberInFile() == 0){
2555  fFileNameBroken = new TObjString(Form("%s",((TString)fV0Reader->GetCurrentFileName()).Data()));
2556  if (tBrokenFiles) tBrokenFiles->Fill();
2557  delete fFileNameBroken;
2558  }
2559  }
2560  }
2561 
2562  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
2563  fHistoNEvents[iCut]->Fill(eventQuality);
2564  if (fIsMC > 1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
2565  }
2566  return;
2567  }
2568 
2569 
2570  if(fInputEvent->IsA()==AliAODEvent::Class()){
2571  fInputEvent->InitMagneticField();
2572  }
2573 
2574  fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
2575 
2576  // ------------------- BeginEvent ----------------------------
2577  AliEventplane *EventPlane = fInputEvent->GetEventplane();
2578  if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
2579  else fEventPlaneAngle=0.0;
2580 
2581  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
2582  RelabelAODPhotonCandidates(kTRUE);// In case of AODMC relabeling MC
2583  fV0Reader->RelabelAODs(kTRUE);
2584  }
2585 
2586  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
2587 
2588  fiCut = iCut;
2589 // cout << ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber() << "_" << ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber() <<
2590 // "_" << ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber() <<endl;
2591 
2592  Bool_t isRunningEMCALrelAna = kFALSE;
2593  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) isRunningEMCALrelAna = kTRUE;
2594 
2595  Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,isRunningEMCALrelAna);
2596 
2597  if(fIsMC==2){
2598  Float_t xsection = -1.;
2599  Float_t ntrials = -1.;
2600  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetXSectionAndNTrials(fMCEvent,xsection,ntrials,fInputEvent);
2601  if((xsection==-1.) || (ntrials==-1.)) AliFatal(Form("ERROR: GetXSectionAndNTrials returned invalid xsection/ntrials, periodName from V0Reader: '%s'",fV0Reader->GetPeriodName().Data()));
2602  fProfileJetJetXSection[iCut]->Fill(0.,xsection);
2603  fHistoJetJetNTrials[iCut]->Fill("#sum{NTrials}",ntrials);
2604  }
2605 
2606  if(fIsMC>0){
2607  fWeightJetJetMC = 1;
2608  // cout << fMCEvent << endl;
2609  Bool_t isMCJet = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsJetJetMCEventAccepted( fMCEvent, fWeightJetJetMC, fInputEvent );
2610  if (fIsMC == 3){
2611  Double_t weightMult = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetWeightForMultiplicity(fV0Reader->GetNumberOfPrimaryTracks());
2612  fWeightJetJetMC = fWeightJetJetMC*weightMult;
2613  }
2614  if(fIsMC==1) fWeightJetJetMC = 1;
2615  if (!isMCJet){
2616  fHistoNEvents[iCut]->Fill(10,fWeightJetJetMC);
2617  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(10);
2618  continue;
2619  }
2620  }
2621 
2622  Bool_t triggered = kTRUE;
2623 
2624  if(eventNotAccepted!= 0){
2625  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
2626  fHistoNEvents[iCut]->Fill(eventNotAccepted, fWeightJetJetMC); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
2627  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventNotAccepted);
2628  if (eventNotAccepted==3 && fIsMC > 0){
2629  triggered = kFALSE;
2630  }else {
2631  continue;
2632  }
2633  }
2634 
2635  if(eventQuality != 0){// Event Not Accepted
2636  //cout << "event rejected due to: " <<eventQuality << endl;
2637  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC);
2638  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
2639  continue;
2640  }
2641 
2642  if (triggered==kTRUE){
2643  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC); // Should be 0 here
2644  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality); // Should be 0 here
2645 
2647  fHistoVertexZ[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetZ(), fWeightJetJetMC);
2648  if(!fDoLightOutput){
2649  fHistoVertexX[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetX(), fWeightJetJetMC);
2650  fHistoVertexY[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetY(), fWeightJetJetMC);
2651  fHistoSPDClusterTrackletBackground[iCut]->Fill(fInputEvent->GetMultiplicity()->GetNumberOfTracklets(),(fInputEvent->GetNumberOfITSClusters(0)+fInputEvent->GetNumberOfITSClusters(1)),fWeightJetJetMC);
2652  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A(), fWeightJetJetMC);
2653  else fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C(), fWeightJetJetMC);
2654  }
2655  }
2656 
2657  if(fIsMC>0){
2658  // Process MC Particle
2659  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
2660  if(fInputEvent->IsA()==AliESDEvent::Class()){
2661  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
2662  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
2663  fMCEvent);
2664  }
2665  else if(fInputEvent->IsA()==AliAODEvent::Class()){
2666  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
2667  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
2668  fInputEvent);
2669  }
2670 
2671  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader()){
2672  for(Int_t i = 0;i<(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
2673  TString nameBin= fHistoMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
2674  if (nameBin.CompareTo("")== 0){
2675  TString nameHeader = ((TObjString*)((TList*)((AliConvEventCuts*)fEventCutArray->At(iCut))
2676  ->GetAcceptedHeader())->At(i))->GetString();
2677  fHistoMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
2678  }
2679  }
2680  }
2681  }
2682  }
2683  if(fIsMC>0){
2684  if(fInputEvent->IsA()==AliESDEvent::Class())
2686  if(fInputEvent->IsA()==AliAODEvent::Class())
2688  }
2689 
2690  if (triggered==kFALSE) continue;
2691 
2692  // 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)
2693  ProcessClusters();// process calo clusters
2694  ProcessPhotonCandidates(); // Process this cuts gammas
2695 
2696  fHistoNGammaCandidates[iCut]->Fill(fGammaCandidates->GetEntries(),fWeightJetJetMC);
2698  if(fDoMesonAnalysis){ // Meson Analysis
2699  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC>0){
2700  fUnsmearedPx = new Double_t[fGammaCandidates->GetEntries()]; // Store unsmeared Momenta
2701  fUnsmearedPy = new Double_t[fGammaCandidates->GetEntries()];
2702  fUnsmearedPz = new Double_t[fGammaCandidates->GetEntries()];
2703  fUnsmearedE = new Double_t[fGammaCandidates->GetEntries()];
2704 
2705  for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
2706  fUnsmearedPx[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Px();
2707  fUnsmearedPy[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Py();
2708  fUnsmearedPz[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Pz();
2709  fUnsmearedE[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->E();
2710  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->SmearParticle(dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(gamma)));
2711  }
2712  }
2713 
2714  CalculatePi0Candidates(); // Combine Gammas from conversion and from calo
2715 
2716  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
2717  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
2718  CalculateBackground(); // Combinatorial Background
2719  UpdateEventByEventData(); // Store Event for mixed Events
2720  }
2721  else{
2722  CalculateBackgroundRP(); // Combinatorial Background
2723  fBGHandlerRP[iCut]->AddEvent(fGammaCandidates,fInputEvent); // Store Event for mixed Events
2724  fBGClusHandlerRP[iCut]->AddEvent(fClusterCandidates,fInputEvent); // Store Event for mixed Events
2725  }
2726  }
2727 
2728  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class()){
2729  ProcessConversionPhotonsForMissingTagsAOD(); //Count missing tags
2730  }else if (fIsMC>0 && fInputEvent->IsA()==AliESDEvent::Class()){
2731  ProcessConversionPhotonsForMissingTags(); //Count missing tags
2732  }
2733 
2734  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC>0){
2735  for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
2736  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPx(fUnsmearedPx[gamma]); // Reset Unsmeared Momenta
2737  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPy(fUnsmearedPy[gamma]);
2738  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPz(fUnsmearedPz[gamma]);
2739  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetE(fUnsmearedE[gamma]);
2740  }
2741  delete[] fUnsmearedPx; fUnsmearedPx = 0x0;
2742  delete[] fUnsmearedPy; fUnsmearedPy = 0x0;
2743  delete[] fUnsmearedPz; fUnsmearedPz = 0x0;
2744  delete[] fUnsmearedE;fUnsmearedE = 0x0;
2745  }
2746 
2747  if(fIsMC>0){
2748  fVectorRecTruePi0s.clear();
2749  fVectorRecTrueEtas.clear();
2754  }
2755  }
2756 
2757  if(fIsMC>0){
2762  }
2763 
2765 
2766  fGammaCandidates->Clear(); // delete this cuts good gammas
2767  fClusterCandidates->Clear(); // delete cluster candidates
2768  }
2769 
2770  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
2771  RelabelAODPhotonCandidates(kFALSE); // Back to ESDMC Label
2772  fV0Reader->RelabelAODs(kFALSE);
2773  }
2774 
2775  PostData(1, fOutputContainer);
2776 }
2777 
2778 //________________________________________________________________________
2780  Int_t nclus = 0;
2781  TClonesArray * arrClustersProcess = NULL;
2782  if(!fCorrTaskSetting.CompareTo("")){
2783  nclus = fInputEvent->GetNumberOfCaloClusters();
2784  } else {
2785  arrClustersProcess = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(Form("%sClustersBranch",fCorrTaskSetting.Data())));
2786  if(!arrClustersProcess)
2787  AliFatal(Form("%sClustersBranch was not found in AliAnalysisTaskGammaConvCalo! Check the correction framework settings!",fCorrTaskSetting.Data()));
2788  nclus = arrClustersProcess->GetEntries();
2789  }
2790 
2791 // cout << nclus << endl;
2792 
2793  if(nclus == 0) return;
2794 
2795  // plotting histograms on cell/tower level, only if extendedMatchAndQA > 1
2796  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FillHistogramsExtendedQA(fInputEvent,fIsMC);
2797 
2798  // match tracks to clusters
2800 
2801  // vertex
2802  Double_t vertex[3] = {0,0,0};
2803  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
2804 
2805  // Loop over EMCal clusters
2806  for(Int_t i = 0; i < nclus; i++){
2807  AliVCluster* clus = NULL;
2808  if(fInputEvent->IsA()==AliESDEvent::Class()){
2809  if(arrClustersProcess)
2810  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)arrClustersProcess->At(i));
2811  else
2812  clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
2813  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
2814  if(arrClustersProcess)
2815  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)arrClustersProcess->At(i));
2816  else
2817  clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
2818  }
2819 
2820  if (!clus) continue;
2821  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fMCEvent,fIsMC,fWeightJetJetMC,i)){
2822  if(fDoInvMassShowerShapeTree && ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedBeforeTrackMatch() ) tESDmapIsClusterAcceptedWithoutTrackMatch[i] = 1;
2823  delete clus;
2824  continue;
2825  }
2826 
2827  // TLorentzvector with cluster
2828  TLorentzVector clusterVector;
2829  clus->GetMomentum(clusterVector,vertex);
2830 
2831  TLorentzVector* tmpvec = new TLorentzVector();
2832  tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
2833 
2834  // convert to AODConversionPhoton
2835  AliAODConversionPhoton *PhotonCandidate = new AliAODConversionPhoton(tmpvec);
2836  if(!PhotonCandidate){ delete clus; delete tmpvec; continue;}
2837 
2839 
2840  // Flag Photon as CaloPhoton
2841  PhotonCandidate->SetIsCaloPhoton();
2842  PhotonCandidate->SetCaloClusterRef((Long_t)i);
2843  // get MC label
2844  if(fIsMC>0){
2845  Int_t* mclabelsCluster = clus->GetLabels();
2846  PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
2847 // cout << clus->GetNLabels() << endl;
2848  if (clus->GetNLabels()>0){
2849  for (Int_t k =0; k<(Int_t)clus->GetNLabels(); k++){
2850  if (k<50)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
2851 // Int_t pdgCode = fMCEvent->Particle(mclabelsCluster[k])->GetPdgCode();
2852 // cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
2853  }
2854  }
2855  }
2856 
2857  fIsFromDesiredHeader = kTRUE;
2859  //TString periodName = fV0Reader->GetPeriodName();
2860  // test whether largest contribution to cluster orginates in added signals
2861  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() > 0){
2862  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCEvent, fInputEvent) == 0){
2863  fIsFromDesiredHeader = kFALSE;
2864  }
2865  if (clus->GetNLabels()>1){
2866  Int_t* mclabelsCluster = clus->GetLabels();
2867  for (Int_t l = 1; l < (Int_t)clus->GetNLabels(); l++ ){
2868  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(mclabelsCluster[l], fMCEvent, fInputEvent) == 0){
2870  }
2871  }
2872  }
2873  }
2874  fHistoClusAllHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2875  if (!fIsFromDesiredHeader)
2876  fHistoClusRejectedHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2878  fHistoClusOverlapHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2879 
2881  fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2882  fHistoClusGammaE[fiCut]->Fill(PhotonCandidate->E(),fWeightJetJetMC);
2883  if(fIsMC>0){
2884  if(fInputEvent->IsA()==AliESDEvent::Class()){
2885  ProcessTrueClusterCandidates(PhotonCandidate,clus->GetM02());
2886  }else {
2887  ProcessTrueClusterCandidatesAOD(PhotonCandidate,clus->GetM02());
2888  }
2889  }
2890  fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
2891  }else{
2892  delete PhotonCandidate;
2893  }
2894 
2895  delete clus;
2896  delete tmpvec;
2897  }
2898 
2899 }
2900 
2901 //________________________________________________________________________
2903 {
2904 
2905  TParticle *Photon = NULL;
2906  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
2907  if (TruePhotonCandidate->GetCaloPhotonMCLabel(0) < 0) return;
2908  if(!fDoLightOutput) fHistoTrueNLabelsInClusPt[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
2909 
2910  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = fMCEvent->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
2911  else return;
2912 
2913  if(Photon == NULL){
2914  // cout << "no photon" << endl;
2915  return;
2916  }
2917 
2918  TruePhotonCandidate->SetCaloPhotonMCFlags(fMCEvent, fEnableSortForClusMC);
2919 
2920  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2921  Double_t mcProdVtxX = primVtxMC->GetX();
2922  Double_t mcProdVtxY = primVtxMC->GetY();
2923  Double_t mcProdVtxZ = primVtxMC->GetZ();
2924  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, TruePhotonCandidate->GetCaloPhotonMCLabel(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2925 
2926  // to get primary distrinction right put mother of conversion electron as particle to check
2927  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
2928  isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, Photon->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2929 
2930 
2931  // Fill histograms for inclusive gamma corrections
2932  // --> a) all clusters with leading real or converted photons
2933  if (TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) ){
2934  fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2935  if(!fDoLightOutput){
2936  // how many of those clusters are from converted photons
2937  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2938  fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2939  }
2940  // --> b) which of these are primary
2941  if(isPrimary){
2942  fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2943  fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC);
2944  // --> c) which are from conversions? Just additonal information
2945  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && (Photon->GetMother(0)>-1)){
2946  fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2947  fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),((TParticle*)fMCEvent->Particle(Photon->GetMother(0)))->Pt(),fWeightJetJetMC);
2948  }
2949  // --> d) how do the secondaries look like
2950  }else {
2951  Int_t secondaryClass = -1;
2952  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
2953  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhoton( Photon, fMCEvent, kTRUE);
2954  else
2955  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhoton( Photon, fMCEvent, kFALSE);
2956  // all secondaries
2957  if (secondaryClass > 0 ){
2958  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2959  }
2960  // secondaries from K0s
2961  if (secondaryClass == 2)
2962  fHistoTrueSecondaryClusGammaFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2963  // secondaries from Lambda
2964  else if (secondaryClass == 3)
2965  fHistoTrueSecondaryClusGammaFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2966  else if (secondaryClass == 5)
2967  fHistoTrueSecondaryClusGammaFromK0lPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2968  }
2969  }
2970 
2971  // How many clusters are from electrons besides conversions
2972  }else if (TruePhotonCandidate->IsLargestComponentElectron()) {
2973  if(!fDoLightOutput) fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2974  // How many clusters don't have an electromagnetic particle as leading particle
2975  }else {
2976  if(!fDoLightOutput) fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2977  }
2978 
2979  // Filling histogram for true photons: E vs M02 for paper
2980  if(!fDoLightOutput) {
2981  if ( TruePhotonCandidate->IsLargestComponentPhoton() && !TruePhotonCandidate->IsPhotonWithElecMother() &&
2982  !TruePhotonCandidate->IsMerged() && !TruePhotonCandidate->IsMergedPartConv() && !TruePhotonCandidate->IsDalitzMerged() )
2983  fHistoTrueClusGammaEM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02, fWeightJetJetMC);
2984  }
2985 
2986  // Some additional QA
2987  if (fDoClusterQA > 0){
2988  // how many of the converted photons are fully contained in the cluster
2989  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
2990  fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2991  // how often do we have merged pi0/eta...
2992  if ( (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsDalitzMerged()) || TruePhotonCandidate->IsMergedPartConv() )
2993  fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2994  // how often do we have a merged cluster with at least one conversion
2995  if (TruePhotonCandidate->IsMergedPartConv())
2996  fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2997  // how often do we reconstruct Dalitz electrons
2998  if (TruePhotonCandidate->IsDalitz())
2999  fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3000  // how often merge Dalitz decays
3001  if (TruePhotonCandidate->IsDalitzMerged())
3002  fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3003  // how often do we see Bremstrahlung
3004  if (TruePhotonCandidate->IsPhotonWithElecMother())
3005  fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3006  // how often do we see a shower in the clusters
3007  if (TruePhotonCandidate->IsShower())
3008  fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3009  // how often is the EM a subleading contributor
3010  if (TruePhotonCandidate->IsSubLeadingEM())
3011  fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3012  // how many mother particles point to the cluster
3014  }
3015 
3016  // Check if we are double counting photons
3017  Int_t motherLab = Photon->GetMother(0);
3018  if (motherLab > -1){
3019  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3021  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)0,fWeightJetJetMC);
3023  }
3024  }
3025  if ( TMath::Abs(fMCEvent->Particle(motherLab)->GetPdgCode()) == 111 &&
3026  TruePhotonCandidate->IsLargestComponentPhoton() &&
3027  TruePhotonCandidate->IsMerged() &&
3028  !TruePhotonCandidate->IsDalitzMerged() &&
3029  !TruePhotonCandidate->IsMergedPartConv()
3030  ){
3031  if(!fDoLightOutput) fHistoTrueClusPi0EM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02,fWeightJetJetMC);
3032  }
3033  Int_t grandMotherLab = fMCEvent->Particle(motherLab)->GetMother(0);
3034  if (grandMotherLab > -1){
3035  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3037  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)1,fWeightJetJetMC);
3039  }
3040  }
3041  }
3042  }
3043 
3044  return;
3045 }
3046 
3047 
3048 //________________________________________________________________________
3050 {
3051  AliAODMCParticle *Photon = NULL;
3052  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3053  if (AODMCTrackArray){
3054  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
3055  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
3056  else return;
3057  }else {
3058  AliInfo("AODMCTrackArray could not be loaded");
3059  return;
3060  }
3061 
3062  if(Photon == NULL){
3063  // cout << "no photon" << endl;
3064  return;
3065  }
3066 
3068  if(!fDoLightOutput) fHistoTrueNLabelsInClusPt[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3069 
3070  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3071  Double_t mcProdVtxX = primVtxMC->GetX();
3072  Double_t mcProdVtxY = primVtxMC->GetY();
3073  Double_t mcProdVtxZ = primVtxMC->GetZ();
3074  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3075 
3076  // to get primary distrinction right put mother of conversion electron as particle to check
3077  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3078  if (Photon->GetMother()> -1){
3079  AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
3080  isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, Mother, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3081  }
3082  }
3083 
3084  // True Photon
3085  if (TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) ){
3086  fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3087  if(!fDoLightOutput){
3088  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3089  fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3090  }
3091  if(isPrimary){
3092  fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3093  fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC);
3094  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3095  fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3096  AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
3097  fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Mother->Pt(),fWeightJetJetMC);
3098  }
3099  }else {
3100  Int_t secondaryClass = -1;
3101  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
3102  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhotonAOD( Photon, AODMCTrackArray, kTRUE);
3103  else
3104  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhotonAOD( Photon, AODMCTrackArray, kFALSE);
3105  // all secondaries
3106  if (secondaryClass > 0 ){
3107  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3108  }
3109  // secondaries from K0s
3110  if (secondaryClass == 2)
3111  fHistoTrueSecondaryClusGammaFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3112  // secondaries from Lambda
3113  else if (secondaryClass == 3)
3114  fHistoTrueSecondaryClusGammaFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3115  else if (secondaryClass == 5)
3116  fHistoTrueSecondaryClusGammaFromK0lPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3117  }
3118  }
3119 
3120  }else if (TruePhotonCandidate->IsLargestComponentElectron()) {
3121  if(!fDoLightOutput) fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3122  }else {
3123  if(!fDoLightOutput) fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3124  }
3125 
3126  if(!fDoLightOutput) {
3127  if ( TruePhotonCandidate->IsLargestComponentPhoton() && !TruePhotonCandidate->IsPhotonWithElecMother() &&
3128  !TruePhotonCandidate->IsMerged() && !TruePhotonCandidate->IsMergedPartConv() && !TruePhotonCandidate->IsDalitzMerged() )
3129  fHistoTrueClusGammaEM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02, fWeightJetJetMC);
3130  }
3131  if (fDoClusterQA > 0){
3132  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
3133  fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3134  if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
3135  fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3136  if (TruePhotonCandidate->IsMergedPartConv())
3137  fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3138  if (TruePhotonCandidate->IsDalitz())
3139  fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3140  if (TruePhotonCandidate->IsDalitzMerged())
3141  fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3142  if (TruePhotonCandidate->IsPhotonWithElecMother())
3143  fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3144  if (TruePhotonCandidate->IsShower())
3145  fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3146  if (TruePhotonCandidate->IsSubLeadingEM())
3147  fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
3149 
3150  }
3151  Int_t motherLab = Photon->GetMother();
3152  if (motherLab > -1){
3153  if (TruePhotonCandidate->IsLargestComponentPhoton()){
3155  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)0,fWeightJetJetMC);
3157  }
3158  }
3159  if(!fDoLightOutput) {
3160  if ( TMath::Abs(((AliAODMCParticle*) AODMCTrackArray->At(motherLab))->GetPdgCode()) == 111 && TruePhotonCandidate->IsLargestComponentPhoton() && TruePhotonCandidate->IsMerged() && !TruePhotonCandidate->IsDalitzMerged() && !TruePhotonCandidate->IsMergedPartConv())
3161  fHistoTrueClusPi0EM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02, fWeightJetJetMC);
3162  }
3163  Int_t grandMotherLab = ((AliAODMCParticle*) AODMCTrackArray->At(motherLab))->GetMother();
3164  if (grandMotherLab > -1){
3165  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
3167  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)1,fWeightJetJetMC);
3169  }
3170  }
3171  }
3172  }
3173 
3174  return;
3175 }
3176 
3177 //________________________________________________________________________
3179 {
3180  Int_t nV0 = 0;
3181  TList *GammaCandidatesStepOne = new TList();
3182  TList *GammaCandidatesStepTwo = new TList();
3183  // Loop over Photon Candidates allocated by ReaderV1
3184  for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
3185  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
3186  if(!PhotonCandidate) continue;
3187  fIsFromDesiredHeader = kTRUE;
3188  if(fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3189  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
3190  if(isPosFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3191  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
3192  if(isNegFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3193  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromDesiredHeader = kFALSE;
3194  }
3195 
3196  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fInputEvent)) continue;
3197  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(PhotonCandidate->GetPhotonPhi(),fEventPlaneAngle)) continue;
3198  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
3199  !((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
3200  fGammaCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
3201 
3203  if(!fDoLightOutput) fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
3204  }
3205  if(fIsMC>0){
3206  if(fInputEvent->IsA()==AliESDEvent::Class())
3207  ProcessTruePhotonCandidates(PhotonCandidate);
3208  if(fInputEvent->IsA()==AliAODEvent::Class())
3209  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3210  }
3211  if (fIsFromDesiredHeader && fDoPhotonQA == 2){
3212  if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 30.){
3213  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3214  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3215  if (fIsMC > 0){
3216  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3217  } else {
3218  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3219  }
3220  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3221  }else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 30.){
3222  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3223  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3224  if (fIsMC > 0){
3225  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3226  } else {
3227  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3228  }
3229  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3230  }
3231  }
3232  }else if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
3233  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
3234  nV0++;
3235  GammaCandidatesStepOne->Add(PhotonCandidate);
3236  }else if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
3237  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
3238  GammaCandidatesStepTwo->Add(PhotonCandidate);
3239  }
3240  }
3241  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){
3242  for(Int_t i = 0;i<GammaCandidatesStepOne->GetEntries();i++){
3243  AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GammaCandidatesStepOne->At(i);
3244  if(!PhotonCandidate) continue;
3245  fIsFromDesiredHeader = kTRUE;
3246  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3247  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
3248  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
3249  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromDesiredHeader = kFALSE;
3250  }
3251  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GammaCandidatesStepOne->GetEntries())) continue;
3252  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
3253  fGammaCandidates->Add(PhotonCandidate);
3255  if(!fDoLightOutput) fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
3256  }
3257  if(fIsMC>0){
3258  if(fInputEvent->IsA()==AliESDEvent::Class())
3259  ProcessTruePhotonCandidates(PhotonCandidate);
3260  if(fInputEvent->IsA()==AliAODEvent::Class())
3261  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3262  }
3263  if (fIsFromDesiredHeader && fDoPhotonQA == 2){
3264  if (fIsHeavyIon ==1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 30.){
3265  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3266  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3267  if (fIsMC > 0){
3268  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3269  } else {
3270  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3271  }
3272  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3273  }else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 30.){
3274  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3275  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3276  if (fIsMC > 0){
3277  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3278  } else {
3279  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3280  }
3281  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3282  }
3283  }
3284  } else GammaCandidatesStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
3285  }
3286  }
3287  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
3288  for(Int_t i = 0;i<GammaCandidatesStepTwo->GetEntries();i++){
3289  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GammaCandidatesStepTwo->At(i);
3290  if(!PhotonCandidate) continue;
3291  fIsFromDesiredHeader = kTRUE;
3292  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3293  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
3294  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
3295  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromDesiredHeader = kFALSE;
3296  }
3297  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GammaCandidatesStepTwo,i)) continue;
3298  fGammaCandidates->Add(PhotonCandidate); // Add gamma to current cut TList
3300  if(!fDoLightOutput) fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
3301  }
3302  if(fIsMC>0){
3303  if(fInputEvent->IsA()==AliESDEvent::Class())
3304  ProcessTruePhotonCandidates(PhotonCandidate);
3305  if(fInputEvent->IsA()==AliAODEvent::Class())
3306  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3307  }
3308  if (fIsFromDesiredHeader && fDoPhotonQA == 2){
3309  if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 65.){
3310  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3311  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3312  if (fIsMC > 0){
3313  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3314  } else {
3315  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3316  }
3317  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3318  }else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 65.){
3319  fPtGamma = (UShort_t)(PhotonCandidate->Pt()*1000);
3320  fDCAzPhoton = (Short_t)(PhotonCandidate->GetDCAzToPrimVtx()*1000);
3321  if (fIsMC > 0){
3322  fCharCatPhoton = fCharPhotonMCInfo*10+PhotonCandidate->GetPhotonQuality();
3323  } else {
3324  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3325  }
3326  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3327  }
3328  }
3329  }
3330  }
3331 
3332  delete GammaCandidatesStepOne;
3333  GammaCandidatesStepOne = 0x0;
3334  delete GammaCandidatesStepTwo;
3335  GammaCandidatesStepTwo = 0x0;
3336 
3337 }
3338 
3339 //________________________________________________________________________
3341 {
3342  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3343  Double_t mcProdVtxX = primVtxMC->GetX();
3344  Double_t mcProdVtxY = primVtxMC->GetY();
3345  Double_t mcProdVtxZ = primVtxMC->GetZ();
3346 
3347  Double_t magField = fInputEvent->GetMagneticField();
3348  if( magField < 0.0 ){
3349  magField = 1.0;
3350  }
3351  else {
3352  magField = -1.0;
3353  }
3354 
3355  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3356  if (AODMCTrackArray == NULL) return;
3357  AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
3358  AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
3359  fCharPhotonMCInfo = 0;
3360 
3361  if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
3362  Int_t pdgCode[2] = {TMath::Abs(posDaughter->GetPdgCode()),TMath::Abs(negDaughter->GetPdgCode())};
3363 
3364  if(posDaughter->GetMother() != negDaughter->GetMother()){
3365  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3366  fCharPhotonMCInfo = 1;
3367  return;
3368  }
3369  else if(posDaughter->GetMother() == -1){
3370  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3371  fCharPhotonMCInfo = 1;
3372  return;
3373  }
3374 
3375  if(pdgCode[0]!=11 || pdgCode[1]!=11){
3376  fCharPhotonMCInfo = 1;
3377  return; //One Particle is not a electron
3378  }
3379 
3380  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()){
3381  fCharPhotonMCInfo = 1;
3382  return; // Same Charge
3383  }
3384 
3385  AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
3386  if(Photon->GetPdgCode() != 22){
3387  fCharPhotonMCInfo = 1;
3388  return; // Mother is no Photon
3389  }
3390 
3391  if(((posDaughter->GetMCProcessCode())) != 5 || ((negDaughter->GetMCProcessCode())) != 5){
3392  fCharPhotonMCInfo = 1;
3393  return;// check if the daughters come from a conversion
3394  }
3395  // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
3396 
3397 
3398 
3399  // True Photon
3401  if(!fDoLightOutput) fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3402  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueConvGammas,posDaughter->GetMother())){
3403  if(!fDoLightOutput) fHistoDoubleCountTrueConvGammaRPt[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3404  FillMultipleCountMap(fMapMultipleCountTrueConvGammas,posDaughter->GetMother());
3405  }
3406  }
3407 
3408  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3409  if(isPrimary){
3410  // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
3412  fCharPhotonMCInfo = 6;
3413  if(!fDoLightOutput){
3414  fHistoTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3415  fHistoTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC); // Allways Filled
3416  }
3417  }
3418  // (Not Filled for i6, Extra Signal Gamma (parambox) are secondary)
3419  }else {
3421 
3422  fCharPhotonMCInfo = 2;
3423  // check for secondaries from K0s
3424  if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3425  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 310){
3426  fCharPhotonMCInfo = 4;
3427  if(!fDoLightOutput){
3428  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3429  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3430  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3431  }
3432  // check for secondaries from K0l
3433  } else if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3434  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 130) {
3435  fCharPhotonMCInfo = 7;
3436  if(!fDoLightOutput){
3437  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3438  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),1.,fWeightJetJetMC);
3439  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3440  }
3441  // check for secondaries from Lambda
3442  } else if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3443  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 3122){
3444  fCharPhotonMCInfo = 5;
3445  if(!fDoLightOutput){
3446  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3447  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3448  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3449  }
3450  } else if (((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3451  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 221) {
3452  fCharPhotonMCInfo = 3;
3453  if(!fDoLightOutput){
3454  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3455  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3456  }
3457  } else {
3458  if(!fDoLightOutput){
3459  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3460  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3461  }
3462  }
3463  }
3464  }
3465  TruePhotonCandidate->SetIsTrueConvertedPhoton();
3466 }
3467 
3468 //________________________________________________________________________
3470 {
3471  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3472  Double_t mcProdVtxX = primVtxMC->GetX();
3473  Double_t mcProdVtxY = primVtxMC->GetY();
3474  Double_t mcProdVtxZ = primVtxMC->GetZ();
3475 
3476  Double_t magField = fInputEvent->GetMagneticField();
3477  if( magField < 0.0 ){
3478  magField = 1.0;
3479  }
3480  else {
3481  magField = -1.0;
3482  }
3483 
3484  // Process True Photons
3485  TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCEvent);
3486  TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCEvent);
3487  fCharPhotonMCInfo = 0;
3488 
3489  if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
3490  Int_t pdgCode[2] = {TMath::Abs(posDaughter->GetPdgCode()),TMath::Abs(negDaughter->GetPdgCode())};
3491  fCharPhotonMCInfo = 1;
3492  if(posDaughter->GetMother(0) != negDaughter->GetMother(0)){
3493  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3494  return;
3495  }
3496  else if(posDaughter->GetMother(0) == -1){
3497  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3498  return;
3499  }
3500 
3501  if(pdgCode[0]!=11 || pdgCode[1]!=11) return; //One Particle is not a electron
3502 
3503  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge
3504 
3505  TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCEvent);
3506 
3507  if(Photon->GetPdgCode() != 22){
3508  return; // Mother is no Photon
3509  }
3510 
3511  if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() !=5) return;// check if the daughters come from a conversion
3512 
3513  // True Photon
3515  if(!fDoLightOutput) fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3516  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueConvGammas,posDaughter->GetMother(0))){
3517  if(!fDoLightOutput) fHistoDoubleCountTrueConvGammaRPt[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3518  FillMultipleCountMap(fMapMultipleCountTrueConvGammas,posDaughter->GetMother(0));
3519  }
3520  }
3521  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, posDaughter->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3522  if(isPrimary){
3523  // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
3525  fCharPhotonMCInfo = 6;
3526  if(!fDoLightOutput){
3527  fHistoTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3528  fHistoTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC); // Allways Filled
3529  }
3530  }
3531  // (Not Filled for i6, Extra Signal Gamma (parambox) are secondary)
3532  }else {
3533  // fill secondary histograms
3535  fCharPhotonMCInfo = 2;
3536  if( Photon->GetMother(0) > -1 && fMCEvent->Particle(Photon->GetMother(0))->GetMother(0) > -1){
3537  if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
3538  fCharPhotonMCInfo = 4;
3539  if (!fDoLightOutput){
3540  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3541  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3542  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3543  }
3544  } else if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 130) {
3545  fCharPhotonMCInfo = 7;
3546  if (!fDoLightOutput){
3547  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3548  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),1.,fWeightJetJetMC);
3549  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3550  }
3551  } else if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 3122) {
3552  fCharPhotonMCInfo = 5;
3553  if (!fDoLightOutput){
3554  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3555  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),2.,fWeightJetJetMC);
3556  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3557  }
3558  } else if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 221) {
3559  fCharPhotonMCInfo = 3;
3560  if (!fDoLightOutput){
3561  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3562  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3563  }
3564  } else {
3565  if (!fDoLightOutput){
3566  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3567  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3568  }
3569  }
3570  } else {
3571  if (!fDoLightOutput){
3572  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3573  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3574  }
3575  }
3576  }
3577  }
3578  TruePhotonCandidate->SetIsTrueConvertedPhoton();
3579  return;
3580 }
3581 //________________________________________________________________________
3583 {
3584  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3585  Double_t mcProdVtxX = primVtxMC->GetX();
3586  Double_t mcProdVtxY = primVtxMC->GetY();
3587  Double_t mcProdVtxZ = primVtxMC->GetZ();
3588 
3589  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3590  if (AODMCTrackArray == NULL) return;
3591 
3592  // Loop over all primary MC particle
3593  for(Long_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
3594 
3595  AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
3596  if (!particle) continue;
3597 
3598  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, particle, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3599  if (isPrimary) {
3600 
3601  Int_t isMCFromMBHeader = -1;
3602  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3603  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3604  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3605  }
3606 
3607  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
3608  if(!fDoLightOutput){
3609  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kFALSE)){
3610  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Gamma
3611  if (TMath::Abs(particle->Eta()) < 0.66 ){
3612  if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3613  }
3614  if(particle->GetMother() >-1){ // Meson Decay Gamma
3615  switch((static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother())))->GetPdgCode()){
3616  case 111: // Pi0
3617  fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3618  break;
3619  case 113: // Rho0
3620  fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3621  break;
3622  case 221: // Eta
3623  fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3624  break;
3625  case 223: // Omega
3626  fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3627  break;
3628  case 331: // Eta'
3629  fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3630  break;
3631  case 333: // Phi
3632  fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3633  break;
3634  case 3212: // Sigma
3635  fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3636  break;
3637  }
3638  }
3639  }
3640  }
3641  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kTRUE)){
3642  for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){
3643  AliAODMCParticle *tmpDaughter = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(daughterIndex));
3644  if(!tmpDaughter) continue;
3645  }
3646  if(!fDoLightOutput) fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3647  }
3648  // Converted MC Gamma
3649  if(fDoMesonAnalysis){
3650 
3651  Double_t mesonY = 1.e30;
3652  Double_t ratio = 0;
3653  if (particle->E() != TMath::Abs(particle->Pz())){
3654  ratio = (particle->E()+particle->Pz()) / (particle->E()-particle->Pz());
3655  }
3656  if( !(ratio <= 0) ){
3657  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3658  }
3659 
3660  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
3661  if ( particle->GetPdgCode() == 211 ){ // positve pions
3662  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., fWeightJetJetMC);
3663  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
3664  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., fWeightJetJetMC);
3665  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
3666  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., fWeightJetJetMC);
3667  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
3668  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., fWeightJetJetMC);
3669  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
3670  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., fWeightJetJetMC);
3671  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
3672  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., fWeightJetJetMC);
3673  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
3674  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., fWeightJetJetMC);
3675  }
3676  }
3677 
3678  // check neutral mesons
3680  ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3681  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
3682  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
3683  Float_t weighted= 1;
3684  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
3685  if (particle->Pt()>0.005){
3686  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, 0x0, fInputEvent);
3687  // if(particle->GetPdgCode() == 221){
3688  // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
3689  // }
3690  }
3691  }
3692  Double_t mesonY = 1.e30;
3693  Double_t ratio = 0;
3694  if (particle->E() != TMath::Abs(particle->Pz())){
3695  ratio = (particle->E()+particle->Pz()) / (particle->E()-particle->Pz());
3696  }
3697  if( !(ratio <= 0) ){
3698  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3699  }
3700  Double_t alpha = -10;
3701  if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
3702  alpha = (daughter0->E() - daughter1->E())/(daughter0->E() + daughter1->E());
3703  }
3704 
3705 
3706  if(particle->GetPdgCode() == 111){
3707  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Pi0
3708  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3709  if (!fDoLightOutput){
3710  // fill pi0 hists against gamma pt of first leg
3711  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,weighted*fWeightJetJetMC);
3712  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,fWeightJetJetMC);
3713  // fill pi0 hists against gamma pt of second leg
3714  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,weighted*fWeightJetJetMC);
3715  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,fWeightJetJetMC);
3716  // fill pi0 hists against gamma pt of both legs
3717  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,weighted*fWeightJetJetMC);
3718  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,fWeightJetJetMC);
3719  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,weighted*fWeightJetJetMC);
3720  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,fWeightJetJetMC);
3721  }
3722 
3723  if (fIsMC > 1) fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
3724  if (fDoMesonQA > 0){
3725  fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC);
3726  fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC);
3727  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3728  }
3729  }else if(particle->GetPdgCode() == 221){
3730  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Eta
3731  fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3732  if (fIsMC > 1) fHistoMCEtaWOEvtWeightPt[fiCut]->Fill(particle->Pt());
3733  if (fDoMesonQA > 0){
3734  fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC);
3735  fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC);
3736  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3737  }
3738  }
3739 
3740  // Check the acceptance for both gammas
3741  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter0,AODMCTrackArray,kFALSE) &&
3742  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter1,AODMCTrackArray,kFALSE) &&
3743  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
3744  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
3745  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
3746  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) ||
3747  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
3748  if(particle->GetPdgCode() == 111){
3749  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Pi0 with gamma in acc
3750  fHistoMCPi0WOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Pi0 with gamma in acc wo weight
3751  if(fIsMC > 1) fHistoMCPi0WOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 with gamma in acc wo any weight
3752  if (!fDoLightOutput){
3753  // fill pi0 hists against gamma pt of first leg
3754  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,weighted*fWeightJetJetMC);
3755  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,fWeightJetJetMC);
3756  // fill pi0 hists against gamma pt of second leg
3757  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,weighted*fWeightJetJetMC);
3758  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,fWeightJetJetMC);
3759  // fill pi0 hists against gamma pt of both legs
3760  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,weighted*fWeightJetJetMC);
3761  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,fWeightJetJetMC);
3762  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,weighted*fWeightJetJetMC);
3763  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,fWeightJetJetMC);
3764  }
3765  }else if(particle->GetPdgCode() == 221){
3766  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Eta with gamma in acc
3767  fHistoMCEtaWOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Eta with gamma in acc wo weight
3768  if(fIsMC > 1) fHistoMCEtaWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta with gamma in acc wo any weight
3769  }
3770  }
3771  }
3772  }
3773  }
3774  } else {
3775  // fill secondary histograms
3776  Int_t isMCFromMBHeader = -1;
3777  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3778  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3779  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3780  }
3781  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) {
3782  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kFALSE)){
3783  if (particle->GetMother() > -1) {
3784  AliAODMCParticle *tmpMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3785  if (tmpMother->GetMother() > -1) {
3786  AliAODMCParticle *tmpGrandMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(tmpMother->GetMother()));
3787  if(tmpGrandMother->GetPdgCode() == 310) {
3788  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightJetJetMC);
3789  } else if (tmpGrandMother->GetPdgCode() == 130) {
3790  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightJetJetMC);
3791  } else if (tmpGrandMother->GetPdgCode() == 3122) {
3792  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightJetJetMC);
3793  } else {
3794  if ( !(TMath::Abs(tmpMother->GetPdgCode()) == 11 && tmpGrandMother->GetPdgCode() == 22) )
3795  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3796  }
3797  } else {
3798  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3799  }
3800  } else {
3801  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3802  }
3803  }
3804 
3805  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kTRUE)){
3806  if (particle->GetMother() > -1) {
3807  AliAODMCParticle *tmpMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3808  if (tmpMother->GetMother() > -1) {
3809  AliAODMCParticle *tmpGrandMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(tmpMother->GetMother()));
3810  if(tmpGrandMother->GetPdgCode() == 310) {
3811  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightJetJetMC);
3812  } else if (tmpGrandMother->GetPdgCode() == 130) {
3813  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightJetJetMC);
3814  } else if (tmpGrandMother->GetPdgCode() == 3122) {
3815  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightJetJetMC);
3816  } else {
3817  if ( !(TMath::Abs(tmpMother->GetPdgCode()) == 11 && tmpGrandMother->GetPdgCode() == 22) )
3818  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3819  }
3820  } else {
3821  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3822  }
3823  } else {
3824  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3825  }
3826  }
3827  }
3828 
3829  if(fDoMesonAnalysis){
3830  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3831  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
3832  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
3833  AliAODMCParticle* mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3834  Int_t pdgCode = mother->GetPdgCode();
3835  if(particle->GetPdgCode() == 111){
3836  Int_t source = GetSourceClassification(111,pdgCode);
3837  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC); // All MC Pi0
3838  if (!fDoLightOutput){
3839  fHistoMCSecPi0PtGamma1vsSource[fiCut]->Fill(daughter0->Pt(),source,fWeightJetJetMC); // All MC Pi0
3840  fHistoMCSecPi0PtGamma2vsSource[fiCut]->Fill(daughter1->Pt(),source,fWeightJetJetMC); // All MC Pi0
3841  }
3842  fHistoMCSecPi0Source[fiCut]->Fill(pdgCode);
3843  }else if(particle->GetPdgCode() == 221){
3844 
3845  fHistoMCSecEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Pi0
3846  fHistoMCSecEtaSource[fiCut]->Fill(pdgCode);
3847  }
3848 
3849  // check if conversion where within acceptance
3850  if( ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter0,AODMCTrackArray,kFALSE) &&
3851  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter1,AODMCTrackArray,kFALSE) &&
3852  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
3853  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
3854  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
3855  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) ||
3856  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
3857  if (particle->GetPdgCode() == 111){
3858  Int_t source = GetSourceClassification(111,pdgCode);
3859  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC); // All MC Pi0
3860  if (!fDoLightOutput){
3861  fHistoMCSecPi0InAccPtGamma1vsSource[fiCut]->Fill(daughter0->Pt(),source,fWeightJetJetMC); // All MC Pi0
3862  fHistoMCSecPi0InAccPtGamma2vsSource[fiCut]->Fill(daughter1->Pt(),source,fWeightJetJetMC); // All MC Pi0
3863  }
3864  }
3865  }
3866  }
3867  }
3868  }
3869  }
3870  }
3871 }
3872 
3873 //________________________________________________________________________
3875 {
3876  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3877  Double_t mcProdVtxX = primVtxMC->GetX();
3878  Double_t mcProdVtxY = primVtxMC->GetY();
3879  Double_t mcProdVtxZ = primVtxMC->GetZ();
3880 // cout << mcProdVtxX <<"\t" << mcProdVtxY << "\t" << mcProdVtxZ << endl;
3881 
3882  // Loop over all primary MC particle
3883  for(Long_t i = 0; i < fMCEvent->GetNumberOfTracks(); i++) {
3884  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
3885  // fill primary histograms
3886  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
3887  if (!particle) continue;
3888 
3889  Int_t isMCFromMBHeader = -1;
3890  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3891  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3892  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3893  }
3894 
3895  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
3896  if(!fDoLightOutput){
3897  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kFALSE)){
3898  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Gamma
3899  if (TMath::Abs(particle->Eta()) < 0.66 ){
3900  if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3901  }
3902 
3903  if(particle->GetMother(0) >-1){ // Meson Decay Gamma
3904  switch(fMCEvent->Particle(particle->GetMother(0))->GetPdgCode()){
3905  case 111: // Pi0
3906  fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3907  break;
3908  case 113: // Rho0
3909  fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3910  break;
3911  case 221: // Eta
3912  fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3913  break;
3914  case 223: // Omega
3915  fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3916  break;
3917  case 331: // Eta'
3918  fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3919  break;
3920  case 333: // Phi
3921  fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3922  break;
3923  case 3212: // Sigma
3924  fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3925  break;
3926  }
3927  }
3928  }
3929  }
3930  // Converted MC Gamma
3931  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kTRUE)){
3932  if(!fDoLightOutput) fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3933  }
3934 
3935 
3936  if(fDoMesonAnalysis ){
3937 
3938  // Fill histograms for other particles
3939  Double_t mesonY = 1.e30;
3940  Double_t ratio = 0;
3941  if (particle->Energy() != TMath::Abs(particle->Pz())){
3942  ratio = (particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz());
3943  }
3944  if( !(ratio <= 0) ){
3945  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3946  }
3947 
3948  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
3949  if ( particle->GetPdgCode() == 211 ){ // positve pions
3950  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., fWeightJetJetMC);
3951  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
3952  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., fWeightJetJetMC);
3953  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
3954  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., fWeightJetJetMC);
3955  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
3956  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., fWeightJetJetMC);
3957  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
3958  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., fWeightJetJetMC);
3959  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
3960  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., fWeightJetJetMC);
3961  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
3962  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., fWeightJetJetMC);
3963  }
3964  }
3965 
3966  // check neutral mesons
3968  ->MesonIsSelectedMC(particle,fMCEvent,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3969  TParticle* daughter0 = (TParticle*)fMCEvent->Particle(particle->GetFirstDaughter());
3970  TParticle* daughter1 = (TParticle*)fMCEvent->Particle(particle->GetLastDaughter());
3971 
3972  Float_t weighted= 1;
3973  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
3974  if (particle->Pt()>0.005){
3975  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent, fInputEvent);
3976  }
3977  }
3978  Double_t mesonY = 1.e30;
3979  Double_t ratio = 0;
3980  if (particle->Energy() != TMath::Abs(particle->Pz())){
3981  ratio = (particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz());
3982  }
3983  if( !(ratio <= 0) ){<