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