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