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