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