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