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