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