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