AliPhysics  3337bb0 (3337bb0)
 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 ||
921  nBinsPt = 600;
922  minPt = 0;
923  maxPt = 60;
924  nBinsQAPt = 400;
925  minQAPt = 0.4;
926  maxQAPt = 60;
927  nBinsClusterPt = 1000;
928  minClusterPt = 0;
929  maxClusterPt = 100;
930  }
931 
932  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
933  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
934  TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
935  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
936  TString cutstringMeson = "NoMesonCut";
937  if(fDoMesonAnalysis)
938  cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
939 
940  fCutFolder[iCut] = new TList();
941  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s_%s",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
942  fCutFolder[iCut]->SetOwner(kTRUE);
943  fOutputContainer->Add(fCutFolder[iCut]);
944  fESDList[iCut] = new TList();
945  fESDList[iCut]->SetName(Form("%s_%s_%s_%s ESD histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
946  fESDList[iCut]->SetOwner(kTRUE);
947  fCutFolder[iCut]->Add(fESDList[iCut]);
948 
949  fHistoNEvents[iCut] = new TH1F("NEvents","NEvents",14,-0.5,13.5);
950  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
951  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
952  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
953  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
954  TString TriggerNames = "Not Trigger: ";
955  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
956  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
957  }else {
958  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
959  }
960  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
961  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
962  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
963  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
964  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
965  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
966  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
967  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
968  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
969  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
970  fESDList[iCut]->Add(fHistoNEvents[iCut]);
971 
972  if (fIsMC > 1){
973  fHistoNEventsWOWeight[iCut] = new TH1F("NEventsWOWeight","NEventsWOWeight",14,-0.5,13.5);
974  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
975  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
976  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
977  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
978  TString TriggerNames = "Not Trigger: ";
979  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
980  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
981  }else {
982  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
983  }
984  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
985  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
986  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
987  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
988  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
989  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
990  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
991  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
992  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
993  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
994  fESDList[iCut]->Add(fHistoNEventsWOWeight[iCut]);
995  }
996 
997  if (fIsMC == 2){
998  fProfileJetJetXSection[iCut] = new TProfile("XSection","XSection",1,-0.5,0.5);
999  fESDList[iCut]->Add(fProfileJetJetXSection[iCut]);
1000  fHistoJetJetNTrials[iCut] = new TH1F("NTrials","#sum{NTrials}",1,0,1);
1001  fHistoJetJetNTrials[iCut]->GetXaxis()->SetBinLabel(1,"#sum{NTrials}");
1002  fESDList[iCut]->Add(fHistoJetJetNTrials[iCut]);
1003  }
1004 
1005  if(fIsHeavyIon == 1)
1006  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks","GoodESDTracks",4000,0,4000);
1007  else if(fIsHeavyIon == 2)
1008  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks","GoodESDTracks",400,0,400);
1009  else
1010  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks","GoodESDTracks",200,0,200);
1011  fHistoNGoodESDTracks[iCut]->SetXTitle("# TPC tracks");
1012  fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
1013 
1014  fHistoVertexZ[iCut] = new TH1F("VertexZ","VertexZ",1000,-50,50);
1015  fESDList[iCut]->Add(fHistoVertexZ[iCut]);
1016  if(!fDoLightOutput){
1017  fHistoVertexX[iCut] = new TH1F("VertexX","VertexX",200,-5,5);
1018  fESDList[iCut]->Add(fHistoVertexX[iCut]);
1019  fHistoVertexY[iCut] = new TH1F("VertexY","VertexY",200,-5,5);
1020  fESDList[iCut]->Add(fHistoVertexY[iCut]);
1021  }
1022 
1023  if(fIsHeavyIon == 1)
1024  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates","GammaCandidates",100,0,100);
1025  else if(fIsHeavyIon == 2)
1026  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates","GammaCandidates",50,0,50);
1027  else
1028  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates","GammaCandidates",50,0,50);
1029  fHistoNGammaCandidates[iCut]->SetXTitle("# accepted #gamma_{conv}");
1030  fESDList[iCut]->Add(fHistoNGammaCandidates[iCut]);
1031 
1032  if(!fDoLightOutput){
1033  if(fIsHeavyIon == 1)
1034  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",4000,0,4000,100,0,100);
1035  else if(fIsHeavyIon == 2)
1036  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",400,0,400,50,0,50);
1037  else
1038  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",200,0,200,50,0,50);
1039  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetXTitle("# TPC tracks");
1040  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetYTitle("# accepted #gamma_{conv}");
1042 
1043  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters","SPD tracklets vs SPD clusters",100,0,200,250,0,1000);
1044  fESDList[iCut]->Add(fHistoSPDClusterTrackletBackground[iCut]);
1045 
1046  if(fIsHeavyIon == 1)
1047  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
1048  else if(fIsHeavyIon == 2)
1049  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
1050  else
1051  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
1052  fHistoNV0Tracks[iCut]->SetXTitle("VZERO amp [arb. units]");
1053  fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
1054 
1055  fHistoConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",nBinsPt, minPt, maxPt);
1056  fHistoConvGammaPt[iCut]->SetXTitle("p_{T,conv}(GeV/c)");
1057  fESDList[iCut]->Add(fHistoConvGammaPt[iCut]);
1058  }
1059 
1060  if(fIsHeavyIon == 2){
1061  fProfileEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
1062  fESDList[iCut]->Add(fProfileEtaShift[iCut]);
1063  }
1064 
1065  if (fIsMC > 1){
1066  fHistoNEvents[iCut]->Sumw2();
1067  fHistoNGoodESDTracks[iCut]->Sumw2();
1068  fHistoVertexZ[iCut]->Sumw2();
1069  fHistoNGammaCandidates[iCut]->Sumw2();
1070  if(!fDoLightOutput){
1071  fHistoVertexX[iCut]->Sumw2();
1072  fHistoVertexY[iCut]->Sumw2();
1074  fHistoSPDClusterTrackletBackground[iCut]->Sumw2();
1075  fHistoNV0Tracks[iCut]->Sumw2();
1076  fHistoConvGammaPt[iCut]->Sumw2();
1077  }
1078  }
1079 
1080  if (fDoPhotonQA == 2 ){
1081  fPhotonDCAList[iCut] = new TList();
1082  fPhotonDCAList[iCut]->SetName(Form("%s_%s_%s_%s Photon DCA tree",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1083  fPhotonDCAList[iCut]->SetOwner(kTRUE);
1084  fCutFolder[iCut]->Add(fPhotonDCAList[iCut]);
1085 
1086  fTreeConvGammaPtDcazCat[iCut] = new TTree("ESD_ConvGamma_Pt_Dcaz_R_Eta","ESD_ConvGamma_Pt_Dcaz_R_Eta_Cat");
1087  fTreeConvGammaPtDcazCat[iCut]->Branch("Pt",&fPtGamma,"fPtGamma/F");
1088  fTreeConvGammaPtDcazCat[iCut]->Branch("DcaZPhoton",&fDCAzPhoton,"fDCAzPhoton/F");
1089  fTreeConvGammaPtDcazCat[iCut]->Branch("cat",&fCharCatPhoton,"fCharCatPhoton/b");
1090  if(fIsMC > 0){
1091  fTreeConvGammaPtDcazCat[iCut]->Branch("photonMCInfo",&fCharPhotonMCInfo,"fCharPhotonMCInfo/b");
1092  }
1093  if (fIsMC > 1){
1094  fTreeConvGammaPtDcazCat[iCut]->Branch("weightEvent",&fWeightJetJetMC,"fWeightJetJetMC/b");
1095  }
1096  fPhotonDCAList[iCut]->Add(fTreeConvGammaPtDcazCat[iCut]);
1097  }
1098 
1099  if (fDoPhotonQA > 0){
1100  fHistoConvGammaR[iCut] = new TH1F("ESD_ConvGamma_R","ESD_ConvGamma_R",800,0,200);
1101  fHistoConvGammaR[iCut]->SetXTitle("R_{conv}(cm)");
1102  fESDList[iCut]->Add(fHistoConvGammaR[iCut]);
1103  fHistoConvGammaEta[iCut] = new TH1F("ESD_ConvGamma_Eta","ESD_ConvGamma_Eta",2000,-2,2);
1104  fHistoConvGammaEta[iCut]->SetXTitle("#eta_{conv}");
1105  fESDList[iCut]->Add(fHistoConvGammaEta[iCut]);
1106  }
1107 
1108  fClusterOutputList[iCut] = new TList();
1109  fClusterOutputList[iCut]->SetName(Form("%s_%s_%s_%s Cluster Output",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1110  fClusterOutputList[iCut]->SetOwner(1);
1111  fCutFolder[iCut]->Add(fClusterOutputList[iCut]);
1112 
1113  fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt","ClusGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1114  fHistoClusGammaPt[iCut]->SetXTitle("p_{T,clus}(GeV/c)");
1115  fClusterOutputList[iCut]->Add(fHistoClusGammaPt[iCut]);
1116  fHistoClusGammaE[iCut] = new TH1F("ClusGamma_E","ClusGamma_E",nBinsClusterPt, minClusterPt, maxClusterPt);
1117  fHistoClusGammaE[iCut]->SetXTitle("E_{clus}(GeV)");
1118  fClusterOutputList[iCut]->Add(fHistoClusGammaE[iCut]);
1119  fHistoClusOverlapHeadersGammaPt[iCut] = new TH1F("ClusGammaOverlapHeaders_Pt","ClusGammaOverlapHeaders_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1120  fHistoClusOverlapHeadersGammaPt[iCut]->SetXTitle("p_{T,clus}(GeV/c), selected header w/ overlap");
1122 
1124  fGammaERM02[iCut] = new TList();
1125  fGammaERM02[iCut]->SetName(Form("%s_%s_%s_%s ConvGamma-Cluster Matched",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1126  fGammaERM02[iCut]->SetOwner(kTRUE);
1127  fCutFolder[iCut]->Add(fGammaERM02[iCut]);
1128 
1129  tESDGammaERM02[iCut] = new TTree("ESD_ConvGamma_E_ConvR_M02_M20","ESD_ConvGamma_E_ConvR_M02_M20");
1130  tESDGammaERM02[iCut]->Branch("ClusterE",&tESDClusE,"tESDClusE/F");
1131  tESDGammaERM02[iCut]->Branch("ConvR",&tESDGammaConvR,"tESDGammaConvR/F");
1132  tESDGammaERM02[iCut]->Branch("M02",&tESDClusterM02,"tESDClusterM02/F");
1133  tESDGammaERM02[iCut]->Branch("M20",&tESDClusterM20,"tESDClusterM20/F");
1134  tESDGammaERM02[iCut]->Branch("Eta",&tESDClusterEta,"tESDClusterEta/F");
1135  tESDGammaERM02[iCut]->Branch("Phi",&tESDClusterPhi,"tESDClusterPhi/F");
1136  tESDGammaERM02[iCut]->Branch("NCells",&tESDClusterNCells,"tESDClusterNCells/F");
1137  tESDGammaERM02[iCut]->Branch("MaxECell",&tESDClusterMaxECell,"tESDClusterMaxECell/F");
1138  tESDGammaERM02[iCut]->Branch("NLM",&tESDClusterNLM,"tESDClusterNLM/F");
1139  fGammaERM02[iCut]->Add(tESDGammaERM02[iCut]);
1140  }
1141 
1143  fInvMassShowerShape[iCut] = new TList();
1144  fInvMassShowerShape[iCut]->SetName(Form("%s_%s_%s_%s InvMass_ShowerShape",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1145  fInvMassShowerShape[iCut]->SetOwner(kTRUE);
1146  fCutFolder[iCut]->Add(fInvMassShowerShape[iCut]);
1147  tESDInvMassShowerShape[iCut] = new TTree("ESD_Meson_InvMass_Pt_ClusE_ClusM02_ClusM20","ESD_Meson_InvMass_Pt_ClusE_ClusM02_ClusM20");
1148  tESDInvMassShowerShape[iCut]->Branch("MesonInvMass",&tESDIMMesonInvMass,"tESDIMMesonInvMass/F");
1149  tESDInvMassShowerShape[iCut]->Branch("MesonPt",&tESDIMMesonPt,"tESDIMMesonPt/F");
1150  tESDInvMassShowerShape[iCut]->Branch("ClusE",&tESDIMClusE,"tESDIMClusE/F");
1151  tESDInvMassShowerShape[iCut]->Branch("ClusM02",&tESDIMClusterM02,"tESDIMClusterM02/F");
1152  tESDInvMassShowerShape[iCut]->Branch("ClusM20",&tESDIMClusterM20,"tESDIMClusterM20/F");
1153  tESDInvMassShowerShape[iCut]->Branch("ClusLeadCellID",&tESDIMClusterLeadCellID,"tESDIMClusterLeadCellID/I");
1154  if(fIsMC>0) tESDInvMassShowerShape[iCut]->Branch("ClusClassification",&tESDIMClusterClassification,"tESDIMClusterClassification/I");
1155  tESDInvMassShowerShape[iCut]->Branch("ClusMatchedTrackPt",&tESDIMClusMatchedTrackPt,"tESDIMClusMatchedTrackPt/F");
1156  tESDInvMassShowerShape[iCut]->Branch("ClusTrackDeltaEta",&tESDIMClusTrackDeltaEta,"tESDIMClusTrackDeltaEta/F");
1157  tESDInvMassShowerShape[iCut]->Branch("ClusTrackDeltaPhi",&tESDIMClusTrackDeltaPhi,"tESDIMClusTrackDeltaPhi/F");
1158  tESDInvMassShowerShape[iCut]->Branch("ClusIsoSumClusterEt",&tESDIMClusterIsoSumClusterEt,"tESDIMClusterIsoSumClusterEt/F");
1159  tESDInvMassShowerShape[iCut]->Branch("ClusIsoSumTrackEt",&tESDIMClusterIsoSumTrackEt,"tESDIMClusterIsoSumTrackEt/F");
1160  fInvMassShowerShape[iCut]->Add(tESDInvMassShowerShape[iCut]);
1161  }
1162 
1163  if (fIsMC > 1){
1164  fHistoClusGammaPt[iCut]->Sumw2();
1165  fHistoClusGammaE[iCut]->Sumw2();
1166  fHistoClusOverlapHeadersGammaPt[iCut]->Sumw2();
1167  }
1168 
1169  if(fDoMesonAnalysis){
1170  fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1171  fHistoMotherInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2})");
1172  fHistoMotherInvMassPt[iCut]->SetYTitle("p_{T,pair}(GeV/c)");
1173  fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
1174 
1175  if(!fDoLightOutput){
1176  fHistoMotherMatchedInvMassPt[iCut] = new TH2F("ESD_MotherMatched_InvMass_Pt","ESD_MotherMatched_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1177  fHistoMotherMatchedInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2}) matched conv e^{+/-}to cluster");
1178  fHistoMotherMatchedInvMassPt[iCut]->SetYTitle("p_{T,pair}(GeV/c)");
1179  fESDList[iCut]->Add(fHistoMotherMatchedInvMassPt[iCut]);
1180  }
1181 
1182  fHistoMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt","ESD_Background_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1183  fHistoMotherBackInvMassPt[iCut]->SetXTitle("M_{inv, mxed}(GeV/c^{2})");
1184  fHistoMotherBackInvMassPt[iCut]->SetYTitle("p_{T,BG pair}(GeV/c)");
1185  fESDList[iCut]->Add(fHistoMotherBackInvMassPt[iCut]);
1186 
1187  if(!fDoLightOutput){
1188  fHistoMotherInvMassPtAlpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_Pt_Alpha","ESD_Mother_InvMass_vs_Pt_Alpha",800,0,0.8,nBinsPt, minPt, maxPt);
1189  fHistoMotherInvMassPtAlpha[iCut]->SetXTitle("M_{inv}(GeV/c^{2})");
1190  fHistoMotherInvMassPtAlpha[iCut]->SetYTitle("p_{T,pair}(GeV/c)");
1191  fESDList[iCut]->Add(fHistoMotherInvMassPtAlpha[iCut]);
1192 
1193  fHistoPhotonPairPtconv[iCut] = new TH2F("ESD_Mother_InvMass_PtConv","",800,0,0.8,nBinsPt, minPt, maxPt);
1194  fHistoPhotonPairPtconv[iCut]->SetXTitle("M_{inv}(GeV/c^{2})");
1195  fHistoPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv}p_{T}(GeV/c)");
1196  fESDList[iCut]->Add(fHistoPhotonPairPtconv[iCut]);
1197 
1198  fHistoPhotonPairMixedEventPtconv[iCut] = new TH2F("ESD_Background_InvMass_PtConv","",800,0,0.8,nBinsPt, minPt, maxPt);
1199  fHistoPhotonPairMixedEventPtconv[iCut]->SetXTitle("M_{inv,mixed}(GeV/c^{2})");
1200  fHistoPhotonPairMixedEventPtconv[iCut]->SetYTitle("#gamma^{conv}p_{T}(GeV/c)");
1201  fESDList[iCut]->Add(fHistoPhotonPairMixedEventPtconv[iCut]);
1202  }
1203 
1204  if (fIsMC > 1){
1205  fHistoMotherInvMassPt[iCut]->Sumw2();
1206  fHistoMotherBackInvMassPt[iCut]->Sumw2();
1207  if(!fDoLightOutput){
1208  fHistoMotherMatchedInvMassPt[iCut]->Sumw2();
1209  fHistoMotherInvMassPtAlpha[iCut]->Sumw2();
1210  fHistoPhotonPairPtconv[iCut]->Sumw2();
1211  fHistoPhotonPairMixedEventPtconv[iCut]->Sumw2();
1212  }
1213  }
1214 
1215  if(!fDoLightOutput){
1216  fHistoMotherInvMassECalib[iCut] = new TH2F("ESD_Mother_InvMass_E_Calib","ESD_Mother_InvMass_E_Calib",800,0,0.8,nBinsPt, minPt, maxPt);
1217  fHistoMotherInvMassECalib[iCut]->SetXTitle("M_{inv}(GeV/c^{2})");
1218  fHistoMotherInvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
1219  fESDList[iCut]->Add(fHistoMotherInvMassECalib[iCut]);
1220 
1221  fHistoMotherBackInvMassECalib[iCut] = new TH2F("ESD_Background_InvMass_E_Calib","ESD_Background_InvMass_E_Calib",800,0,0.8,nBinsPt, minPt, maxPt);
1222  fHistoMotherBackInvMassECalib[iCut]->SetXTitle("M_{inv}(GeV/c^{2})");
1223  fHistoMotherBackInvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
1224  fESDList[iCut]->Add(fHistoMotherBackInvMassECalib[iCut]);
1225 
1226  if (fIsMC > 1){
1227  fHistoMotherInvMassECalib[iCut]->Sumw2();
1228  fHistoMotherBackInvMassECalib[iCut]->Sumw2();
1229  }
1230  }
1231 
1232  if (fDoMesonQA > 0 ){
1233  fHistoMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y","ESD_MotherPi0_Pt_Y",nBinsQAPt, minQAPt, maxQAPt,150,-1.5,1.5);
1234  fHistoMotherPi0PtY[iCut]->SetXTitle("p_{T, #pi^{0}cand}(GeV/c)");
1235  fHistoMotherPi0PtY[iCut]->SetYTitle("y_{#pi^{0}cand}");
1237  fESDList[iCut]->Add(fHistoMotherPi0PtY[iCut]);
1238  fHistoMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y","ESD_MotherEta_Pt_Y",nBinsQAPt, minQAPt, maxQAPt,150,-1.5,1.5);
1239  fHistoMotherEtaPtY[iCut]->SetXTitle("p_{T, #eta cand}(GeV/c)");
1240  fHistoMotherEtaPtY[iCut]->SetYTitle("y_{ #eta cand}");
1242  fESDList[iCut]->Add(fHistoMotherEtaPtY[iCut]);
1243  fHistoMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha","ESD_MotherPi0_Pt_Alpha",nBinsQAPt, minQAPt, maxQAPt,200,-1,1);
1244  fHistoMotherPi0PtAlpha[iCut]->SetXTitle("p_{T, #pi^{0}cand}(GeV/c)");
1245  fHistoMotherPi0PtAlpha[iCut]->SetYTitle("#alpha_{#pi^{0}cand}");
1247  fESDList[iCut]->Add(fHistoMotherPi0PtAlpha[iCut]);
1248  fHistoMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha","ESD_MotherEta_Pt_Alpha",nBinsQAPt, minQAPt, maxQAPt,200,-1,1);
1249  fHistoMotherEtaPtAlpha[iCut]->SetXTitle("p_{T, #eta cand}(GeV/c)");
1250  fHistoMotherEtaPtAlpha[iCut]->SetYTitle("#alpha_{#eta cand}");
1252  fESDList[iCut]->Add(fHistoMotherEtaPtAlpha[iCut]);
1253  fHistoMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",nBinsQAPt, minQAPt, maxQAPt,100,0,1);
1254  fHistoMotherPi0PtOpenAngle[iCut]->SetXTitle("p_{T, #pi^{0}cand}(GeV/c)");
1255  fHistoMotherPi0PtOpenAngle[iCut]->SetYTitle("#theta_{#pi^{0}cand}");
1257  fESDList[iCut]->Add(fHistoMotherPi0PtOpenAngle[iCut]);
1258  fHistoMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",nBinsQAPt, minQAPt, maxQAPt,200,0,TMath::Pi());
1259  fHistoMotherEtaPtOpenAngle[iCut]->SetXTitle("p_{T, #eta cand}(GeV/c)");
1260  fHistoMotherEtaPtOpenAngle[iCut]->SetYTitle("#theta_{#eta cand}");
1262  fESDList[iCut]->Add(fHistoMotherEtaPtOpenAngle[iCut]);
1263  fHistoMotherPi0ConvPhotonEtaPhi[iCut] = new TH2F("ESD_MotherPi0ConvPhoton_Eta_Phi","ConvPhoton under #pi^{0}peak",600,0,2*TMath::Pi(),200,-1,1);
1264  fHistoMotherPi0ConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
1265  fHistoMotherPi0ConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
1266  fESDList[iCut]->Add(fHistoMotherPi0ConvPhotonEtaPhi[iCut]);
1267  fHistoMotherEtaConvPhotonEtaPhi[iCut] = new TH2F("ESD_MotherEtaConvPhoton_Eta_Phi","ConvPhoton under #eta peak",600,0,2*TMath::Pi(),200,-1,1);
1268  fHistoMotherEtaConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
1269  fHistoMotherEtaConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
1270  fESDList[iCut]->Add(fHistoMotherEtaConvPhotonEtaPhi[iCut]);
1271  if (fIsMC > 1){
1272  fHistoMotherPi0PtY[iCut]->Sumw2();
1273  fHistoMotherEtaPtY[iCut]->Sumw2();
1274  fHistoMotherPi0PtAlpha[iCut]->Sumw2();
1275  fHistoMotherEtaPtAlpha[iCut]->Sumw2();
1276  fHistoMotherPi0PtOpenAngle[iCut]->Sumw2();
1277  fHistoMotherEtaPtOpenAngle[iCut]->Sumw2();
1278  fHistoMotherPi0ConvPhotonEtaPhi[iCut]->Sumw2();
1279  fHistoMotherEtaConvPhotonEtaPhi[iCut]->Sumw2();
1280  }
1281  }
1282  }
1283  }
1284  if(fDoMesonAnalysis){
1285  InitBack(); // Init Background Handler
1286  }
1287 
1288  if(fIsMC>0){
1289  // MC Histogramms
1290  fMCList = new TList*[fnCuts];
1291  // True Histogramms
1292  fTrueList = new TList*[fnCuts];
1293 
1294  if(!fDoLightOutput){
1295  fHistoMCHeaders = new TH1I*[fnCuts];
1296  fHistoMCAllGammaPt = new TH1F*[fnCuts];
1297  fHistoMCAllGammaEMCALAccPt = new TH1F*[fnCuts];
1299  fHistoMCDecayGammaPi0Pt = new TH1F*[fnCuts];
1300  fHistoMCDecayGammaRhoPt = new TH1F*[fnCuts];
1301  fHistoMCDecayGammaEtaPt = new TH1F*[fnCuts];
1302  fHistoMCDecayGammaOmegaPt = new TH1F*[fnCuts];
1303  fHistoMCDecayGammaEtapPt = new TH1F*[fnCuts];
1304  fHistoMCDecayGammaPhiPt = new TH1F*[fnCuts];
1305  fHistoMCDecayGammaSigmaPt = new TH1F*[fnCuts];
1306  fHistoMCConvGammaPt = new TH1F*[fnCuts];
1308  fHistoTrueConvGammaPt = new TH1F*[fnCuts];
1311 
1313  fHistoTruePrimaryConvGammaPt = new TH1F*[fnCuts];
1320  }
1321 
1322  fHistoTrueClusGammaPt = new TH1F*[fnCuts];
1323  if(!fDoLightOutput){
1324  fHistoTrueClusConvGammaPt = new TH1F*[fnCuts];
1325  fHistoTruePrimaryClusGammaPt = new TH1F*[fnCuts];
1333  fHistoTrueClusElectronPt = new TH1F*[fnCuts];
1334  }
1337 
1338  if(!fDoLightOutput){
1342  fHistoTrueClusEMNonLeadingPt = new TH1F*[fnCuts];
1343  }
1344 
1345  if (fDoPhotonQA > 0){
1346  fHistoMCConvGammaR = new TH1F*[fnCuts];
1347  fHistoMCConvGammaEta = new TH1F*[fnCuts];
1348  fHistoTrueConvGammaEta = new TH1F*[fnCuts];
1349  }
1350 
1351 // fHistoTruePi0NonLinearity = new TH2F*[fnCuts];
1352 // fHistoTrueEtaNonLinearity = new TH2F*[fnCuts];
1353  if(!fDoLightOutput){
1356  }
1357 
1358  if (fDoClusterQA > 0){
1360  fHistoTrueClusMergedGammaPt = new TH1F*[fnCuts];
1362  fHistoTrueClusDalitzPt = new TH1F*[fnCuts];
1363  fHistoTrueClusDalitzMergedPt = new TH1F*[fnCuts];
1365  fHistoTrueClusShowerPt = new TH1F*[fnCuts];
1366  fHistoTrueClusSubLeadingPt = new TH1F*[fnCuts];
1367  fHistoTrueClusNMothers = new TH1F*[fnCuts];
1368  }
1369 
1370  if(fDoMesonAnalysis){
1371  fHistoMCPi0Pt = new TH1F*[fnCuts];
1372  fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
1373  fHistoMCEtaPt = new TH1F*[fnCuts];
1374  fHistoMCEtaWOWeightPt = new TH1F*[fnCuts];
1375  fHistoMCPi0InAccPt = new TH1F*[fnCuts];
1376  fHistoMCPi0WOWeightInAccPt = new TH1F*[fnCuts];
1377  fHistoMCEtaInAccPt = new TH1F*[fnCuts];
1378  fHistoMCEtaWOWeightInAccPt = new TH1F*[fnCuts];
1379  if (fIsMC > 1){
1380  fHistoMCPi0WOEvtWeightPt = new TH1F*[fnCuts];
1381  fHistoMCEtaWOEvtWeightPt = new TH1F*[fnCuts];
1384  }
1385 
1389  fHistoMCSecPi0Source = new TH1F*[fnCuts];
1390  fHistoMCSecEtaPt = new TH1F*[fnCuts];
1391  fHistoMCSecEtaSource = new TH1F*[fnCuts];
1392  if (!fDoLightOutput){
1401  }
1402 
1408  fHistoMultipleCountTruePi0 = new TH1F*[fnCuts];
1410  fHistoMultipleCountTrueEta = new TH1F*[fnCuts];
1422  if(!fDoLightOutput) {
1429  fHistoTruePrimaryPi0DCPtconv = new TH1F*[fnCuts];
1433  }
1434 
1435 
1436  if (fDoMesonQA > 0){
1437  fHistoMCPi0PtY = new TH2F*[fnCuts];
1438  fHistoMCEtaPtY = new TH2F*[fnCuts];
1439  fHistoMCPi0PtAlpha = new TH2F*[fnCuts];
1440  fHistoMCEtaPtAlpha = new TH2F*[fnCuts];
1441  if (fIsMC == 2){
1442  fHistoMCPi0PtJetPt = new TH2F*[fnCuts];
1443  fHistoMCEtaPtJetPt = new TH2F*[fnCuts];
1444  }
1445 
1446  if (fIsMC < 2){
1472  }
1473  if(fDoMesonQA > 1){
1478  }
1479  fHistoTruePi0PtY = new TH2F*[fnCuts];
1480  fHistoTrueEtaPtY = new TH2F*[fnCuts];
1487  }
1488  }
1489 
1490  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1491  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
1492  TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
1493  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
1494  TString cutstringMeson = "NoMesonCut";
1495  if(fDoMesonAnalysis)
1496  cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
1497 
1498  fMCList[iCut] = new TList();
1499  fMCList[iCut]->SetName(Form("%s_%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1500  fMCList[iCut]->SetOwner(kTRUE);
1501  fCutFolder[iCut]->Add(fMCList[iCut]);
1502  if(!fDoLightOutput){
1503  fHistoMCHeaders[iCut] = new TH1I("MC_Headers","MC_Headers",20,0,20);
1504  fMCList[iCut]->Add(fHistoMCHeaders[iCut]);
1505  fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",nBinsPt, minPt, maxPt);
1506  fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
1507  fHistoMCAllGammaEMCALAccPt[iCut] = new TH1F("MC_AllGammaEMCALAcc_Pt","MC_AllGammaEMCALAcc_Pt",nBinsPt, minPt, maxPt);
1508  fMCList[iCut]->Add(fHistoMCAllGammaEMCALAccPt[iCut]);
1509  fHistoMCAllSecondaryGammaPt[iCut] = new TH2F("MC_AllSecondaryGamma_Pt","MC_AllSecondaryGamma_Pt",nBinsPt, minPt, maxPt,4,-0.5,3.5);
1510  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1511  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1512  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1513  fHistoMCAllSecondaryGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1514  fMCList[iCut]->Add(fHistoMCAllSecondaryGammaPt[iCut]);
1515 
1516  fHistoMCDecayGammaPi0Pt[iCut] = new TH1F("MC_DecayGammaPi0_Pt","MC_DecayGammaPi0_Pt",nBinsPt, minPt, maxPt);
1517  fMCList[iCut]->Add(fHistoMCDecayGammaPi0Pt[iCut]);
1518  fHistoMCDecayGammaRhoPt[iCut] = new TH1F("MC_DecayGammaRho_Pt","MC_DecayGammaRho_Pt",nBinsPt, minPt, maxPt);
1519  fMCList[iCut]->Add(fHistoMCDecayGammaRhoPt[iCut]);
1520  fHistoMCDecayGammaEtaPt[iCut] = new TH1F("MC_DecayGammaEta_Pt","MC_DecayGammaEta_Pt",nBinsPt, minPt, maxPt);
1521  fMCList[iCut]->Add(fHistoMCDecayGammaEtaPt[iCut]);
1522  fHistoMCDecayGammaOmegaPt[iCut] = new TH1F("MC_DecayGammaOmega_Pt","MC_DecayGammaOmmega_Pt",nBinsPt, minPt, maxPt);
1523  fMCList[iCut]->Add(fHistoMCDecayGammaOmegaPt[iCut]);
1524  fHistoMCDecayGammaEtapPt[iCut] = new TH1F("MC_DecayGammaEtap_Pt","MC_DecayGammaEtap_Pt",nBinsPt, minPt, maxPt);
1525  fMCList[iCut]->Add(fHistoMCDecayGammaEtapPt[iCut]);
1526  fHistoMCDecayGammaPhiPt[iCut] = new TH1F("MC_DecayGammaPhi_Pt","MC_DecayGammaPhi_Pt",nBinsPt, minPt, maxPt);
1527  fMCList[iCut]->Add(fHistoMCDecayGammaPhiPt[iCut]);
1528  fHistoMCDecayGammaSigmaPt[iCut] = new TH1F("MC_DecayGammaSigma_Pt","MC_DecayGammaSigma_Pt",nBinsPt, minPt, maxPt);
1529  fMCList[iCut]->Add(fHistoMCDecayGammaSigmaPt[iCut]);
1530  fHistoMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt","MC_ConvGamma_Pt",nBinsPt, minPt, maxPt);
1531  fMCList[iCut]->Add(fHistoMCConvGammaPt[iCut]);
1532  fHistoMCSecondaryConvGammaPt[iCut] = new TH2F("MC_SecondaryConvGamma_Pt","MC_SecondaryConvGamma_Pt",nBinsPt, minPt, maxPt,4,-0.5,3.5);
1533  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1534  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1535  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1536  fHistoMCSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1537  fMCList[iCut]->Add(fHistoMCSecondaryConvGammaPt[iCut]);
1538 
1539  if (fIsMC > 1){
1540  fHistoMCAllGammaPt[iCut]->Sumw2();
1541  fHistoMCAllGammaEMCALAccPt[iCut]->Sumw2();
1542  fHistoMCAllSecondaryGammaPt[iCut]->Sumw2();
1543  fHistoMCDecayGammaPi0Pt[iCut]->Sumw2();
1544  fHistoMCDecayGammaRhoPt[iCut]->Sumw2();
1545  fHistoMCDecayGammaEtaPt[iCut]->Sumw2();
1546  fHistoMCDecayGammaOmegaPt[iCut]->Sumw2();
1547  fHistoMCDecayGammaEtapPt[iCut]->Sumw2();
1548  fHistoMCDecayGammaPhiPt[iCut]->Sumw2();
1549  fHistoMCDecayGammaSigmaPt[iCut]->Sumw2();
1550  fHistoMCConvGammaPt[iCut]->Sumw2();
1551  fHistoMCSecondaryConvGammaPt[iCut]->Sumw2();
1552  }
1553  }
1554 
1555  if (fDoPhotonQA > 0){
1556  fHistoMCConvGammaR[iCut] = new TH1F("MC_ConvGamma_R","MC_ConvGamma_R",800,0,200);
1557  fMCList[iCut]->Add(fHistoMCConvGammaR[iCut]);
1558  fHistoMCConvGammaEta[iCut] = new TH1F("MC_ConvGamma_Eta","MC_ConvGamma_Eta",2000,-2,2);
1559  fMCList[iCut]->Add(fHistoMCConvGammaEta[iCut]);
1560  }
1561 
1562  if(fDoMesonAnalysis){
1563  fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt","MC_Pi0_Pt",nBinsPt, minPt, maxPt);
1564  fHistoMCPi0Pt[iCut]->Sumw2();
1565  fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
1566  fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt","MC_Pi0_WOWeights_Pt",nBinsPt, minPt, maxPt);
1567  fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
1568 
1569  fHistoMCEtaPt[iCut] = new TH1F("MC_Eta_Pt","MC_Eta_Pt",nBinsPt, minPt, maxPt);
1570  fHistoMCEtaPt[iCut]->Sumw2();
1571  fMCList[iCut]->Add(fHistoMCEtaPt[iCut]);
1572  fHistoMCEtaWOWeightPt[iCut] = new TH1F("MC_Eta_WOWeights_Pt","MC_Eta_WOWeights_Pt",nBinsPt, minPt, maxPt);
1573  fMCList[iCut]->Add(fHistoMCEtaWOWeightPt[iCut]);
1574 
1575  fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt","MC_Pi0InAcc_Pt",nBinsPt, minPt, maxPt);
1576  fHistoMCPi0InAccPt[iCut]->Sumw2();
1577  fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
1578  fHistoMCPi0WOWeightInAccPt[iCut] = new TH1F("MC_Pi0WOWeightInAcc_Pt","MC_Pi0WOWeightInAcc_Pt",nBinsPt, minPt, maxPt);
1579  fMCList[iCut]->Add(fHistoMCPi0WOWeightInAccPt[iCut]);
1580  fHistoMCEtaInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt","MC_EtaInAcc_Pt",nBinsPt, minPt, maxPt);
1581  fHistoMCEtaInAccPt[iCut]->Sumw2();
1582  fMCList[iCut]->Add(fHistoMCEtaInAccPt[iCut]);
1583  fHistoMCEtaWOWeightInAccPt[iCut] = new TH1F("MC_EtaWOWeightInAcc_Pt","MC_EtaWOWeightInAcc_Pt",nBinsPt, minPt, maxPt);
1584  fMCList[iCut]->Add(fHistoMCEtaWOWeightInAccPt[iCut]);
1585 
1586  if (fIsMC > 1){
1587  fHistoMCPi0WOWeightPt[iCut]->Sumw2();
1588  fHistoMCEtaWOWeightPt[iCut]->Sumw2();
1589  fHistoMCPi0WOWeightInAccPt[iCut]->Sumw2();
1590  fHistoMCEtaWOWeightInAccPt[iCut]->Sumw2();
1591  fHistoMCPi0WOEvtWeightPt[iCut] = new TH1F("MC_Pi0_WOEventWeights_Pt","MC_Pi0_WOEventWeights_Pt",nBinsPt, minPt, maxPt);
1592  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightPt[iCut]);
1593  fHistoMCEtaWOEvtWeightPt[iCut] = new TH1F("MC_Eta_WOEventWeights_Pt","MC_Eta_WOEventWeights_Pt",nBinsPt, minPt, maxPt);
1594  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightPt[iCut]);
1595  fHistoMCPi0WOEvtWeightInAccPt[iCut] = new TH1F("MC_Pi0_WOEventWeightsInAcc_Pt","MC_Pi0_WOEventWeightsInAcc_Pt",nBinsPt, minPt, maxPt);
1596  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightInAccPt[iCut]);
1597  fHistoMCEtaWOEvtWeightInAccPt[iCut] = new TH1F("MC_Eta_WOEventWeightsInAcc_Pt","MC_Eta_WOEventWeightsInAcc_Pt",nBinsPt, minPt, maxPt);
1598  fMCList[iCut]->Add(fHistoMCEtaWOEvtWeightInAccPt[iCut]);
1599 
1600  if (fDoMesonQA > 0 && fIsMC == 2){
1601  fHistoMCPi0PtJetPt[iCut] = new TH2F("MC_Pi0_Pt_JetPt","MC_Pi0_Pt_JetPt",nBinsQAPt, minQAPt, maxQAPt,200,0,200);
1602  fHistoMCPi0PtJetPt[iCut]->Sumw2();
1604  fMCList[iCut]->Add(fHistoMCPi0PtJetPt[iCut]);
1605  fHistoMCEtaPtJetPt[iCut] = new TH2F("MC_Eta_Pt_JetPt","MC_Eta_Pt_JetPt",nBinsQAPt, minQAPt, maxQAPt,200,0,200);
1606  fHistoMCEtaPtJetPt[iCut]->Sumw2();
1608  fMCList[iCut]->Add(fHistoMCEtaPtJetPt[iCut]);
1609  }
1610  }
1611  fHistoMCPrimaryPtvsSource[iCut] = new TH2F("MC_Primary_Pt_Source","MC_Primary_Pt_Source",nBinsPt, minPt, maxPt, 7, -0.5, 6.5);
1612  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(1,"Pi+");
1613  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(2,"Pi-");
1614  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(3,"K+");
1615  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(4,"K-");
1616  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(5,"K0s");
1617  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(6,"K0l");
1618  fHistoMCPrimaryPtvsSource[iCut]->GetYaxis()->SetBinLabel(7,"Lambda");
1619  fMCList[iCut]->Add(fHistoMCPrimaryPtvsSource[iCut]);
1620 
1621  fHistoMCSecPi0Source[iCut] = new TH1F("MC_SecPi0_Source","MC_SecPi0_Source",5000,0.,5000);
1622  fMCList[iCut]->Add(fHistoMCSecPi0Source[iCut]);
1623  fHistoMCSecEtaSource[iCut] = new TH1F("MC_SecEta_Source","MC_SecEta_Source",5000,0,5000);
1624  fMCList[iCut]->Add(fHistoMCSecEtaSource[iCut]);
1625  fHistoMCSecPi0PtvsSource[iCut] = new TH2F("MC_SecPi0_Pt_Source","MC_SecPi0_Pt_Source",nBinsPt, minPt, maxPt,16,-0.5,15.5);
1626  fMCList[iCut]->Add(fHistoMCSecPi0PtvsSource[iCut]);
1627  fHistoMCSecPi0InAccPtvsSource[iCut] = new TH2F("MC_SecPi0InAcc_Pt_Source","MC_SecPi0InAcc_Pt_Source",nBinsPt, minPt, maxPt,16,-0.5,15.5);
1628  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtvsSource[iCut]);
1629  fHistoMCSecEtaPt[iCut] = new TH1F("MC_SecEta_Pt","MC_SecEta_Pt",nBinsPt, minPt, maxPt);
1630  fMCList[iCut]->Add(fHistoMCSecEtaPt[iCut]);
1631 
1632  if (fIsMC == 2){
1633  fHistoMCPrimaryPtvsSource[iCut]->Sumw2();
1634  fHistoMCSecPi0PtvsSource[iCut]->Sumw2();
1635  fHistoMCSecPi0InAccPtvsSource[iCut]->Sumw2();
1636  fHistoMCSecEtaPt[iCut]->Sumw2();
1637  }
1638 
1639  // book histograms for pure MC handling of PCM-Calo dir gamma reco
1640  if (!fDoLightOutput){
1641  fHistoMCPi0PtGammaLeg[iCut] = new TH2F("MC_Pi0_PtGamma_Leg","MC_Pi0_PtGamma_Leg",nBinsPt, minPt, maxPt, 3, -0.5, 2.5);
1642  fHistoMCPi0PtGammaLeg[iCut]->Sumw2();
1643  fMCList[iCut]->Add(fHistoMCPi0PtGammaLeg[iCut]);
1644  fHistoMCPi0WOWeightPtGammaLeg[iCut] = new TH2F("MC_Pi0_WOWeights_PtGamma_Leg","MC_Pi0_WOWeights_PtGamma_Leg",nBinsPt, minPt, maxPt, 3, -0.5, 2.5);
1645  fMCList[iCut]->Add(fHistoMCPi0WOWeightPtGammaLeg[iCut]);
1646 
1647  fHistoMCPi0InAccPtGammaLeg[iCut] = new TH2F("MC_Pi0InAcc_PtGamma_Leg","MC_Pi0InAcc_PtGamma_Leg",nBinsPt, minPt, maxPt, 3, -0.5, 2.5);
1648  fHistoMCPi0InAccPtGammaLeg[iCut]->Sumw2();
1649  fMCList[iCut]->Add(fHistoMCPi0InAccPtGammaLeg[iCut]);
1650  fHistoMCPi0WOWeightInAccPtGammaLeg[iCut] = new TH2F("MC_Pi0WOWeightInAcc_PtGamma_Leg","MC_Pi0WOWeightInAcc_PtGamma_Leg",nBinsPt, minPt, maxPt, 3, -0.5, 2.5);
1651  fMCList[iCut]->Add(fHistoMCPi0WOWeightInAccPtGammaLeg[iCut]);
1652 
1653  fHistoMCSecPi0PtGamma1vsSource[iCut] = new TH2F("MC_SecPi0_PtGamma1_Source","MC_SecPi0_PtGamma1_Source",nBinsPt, minPt, maxPt,16,-0.5,15.5);
1654  fMCList[iCut]->Add(fHistoMCSecPi0PtGamma1vsSource[iCut]);
1655  fHistoMCSecPi0PtGamma2vsSource[iCut] = new TH2F("MC_SecPi0_PtGamma2_Source","MC_SecPi0_PtGamma2_Source",nBinsPt, minPt, maxPt,16,-0.5,15.5);
1656  fMCList[iCut]->Add(fHistoMCSecPi0PtGamma2vsSource[iCut]);
1657  fHistoMCSecPi0InAccPtGamma1vsSource[iCut] = new TH2F("MC_SecPi0InAcc_PtGamma1_Source","MC_SecPi0InAcc_PtGamma1_Source",nBinsPt, minPt, maxPt,16,-0.5,15.5);
1658  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtGamma1vsSource[iCut]);
1659  fHistoMCSecPi0InAccPtGamma2vsSource[iCut] = new TH2F("MC_SecPi0InAcc_PtGamma2_Source","MC_SecPi0InAcc_PtGamma2_Source",nBinsPt, minPt, maxPt,16,-0.5,15.5);
1660  fMCList[iCut]->Add(fHistoMCSecPi0InAccPtGamma2vsSource[iCut]);
1661 
1662  if (fIsMC > 1){
1663  fHistoMCPi0WOWeightPtGammaLeg[iCut]->Sumw2();
1664  fHistoMCPi0WOWeightInAccPtGammaLeg[iCut]->Sumw2();
1665  fHistoMCSecPi0PtGamma1vsSource[iCut]->Sumw2();
1666  fHistoMCSecPi0PtGamma2vsSource[iCut]->Sumw2();
1667  fHistoMCSecPi0InAccPtGamma1vsSource[iCut]->Sumw2();
1668  fHistoMCSecPi0InAccPtGamma2vsSource[iCut]->Sumw2();
1669  }
1670  }
1671 
1672  // book additional MC QA histograms
1673  if (fDoMesonQA > 0){
1674  fHistoMCPi0PtY[iCut] = new TH2F("MC_Pi0_Pt_Y","MC_Pi0_Pt_Y",nBinsQAPt, minQAPt, maxQAPt,150,-1.5,1.5);
1675  fHistoMCPi0PtY[iCut]->Sumw2();
1677  fMCList[iCut]->Add(fHistoMCPi0PtY[iCut]);
1678  fHistoMCEtaPtY[iCut] = new TH2F("MC_Eta_Pt_Y","MC_Eta_Pt_Y",nBinsQAPt, minQAPt, maxQAPt,150,-1.5,1.5);
1679  fHistoMCEtaPtY[iCut]->Sumw2();
1681  fMCList[iCut]->Add(fHistoMCEtaPtY[iCut]);
1682  fHistoMCPi0PtAlpha[iCut] = new TH2F("MC_Pi0_Pt_Alpha","MC_Pi0_Pt_Alpha",nBinsQAPt, minQAPt, maxQAPt,200,-1,1);
1684  fMCList[iCut]->Add(fHistoMCPi0PtAlpha[iCut]);
1685  fHistoMCEtaPtAlpha[iCut] = new TH2F("MC_Eta_Pt_Alpha","MC_Eta_Pt_Alpha",nBinsQAPt, minQAPt, maxQAPt,200,-1,1);
1687  fMCList[iCut]->Add(fHistoMCEtaPtAlpha[iCut]);
1688 
1689  if (fIsMC == 2){
1690  fHistoMCPi0PtAlpha[iCut]->Sumw2();
1691  fHistoMCEtaPtAlpha[iCut]->Sumw2();
1692  }
1693  }
1694  }
1695 
1696  fTrueList[iCut] = new TList();
1697  fTrueList[iCut]->SetName(Form("%s_%s_%s_%s True histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringMeson.Data()));
1698  fTrueList[iCut]->SetOwner(kTRUE);
1699  fCutFolder[iCut]->Add(fTrueList[iCut]);
1700 
1701  if(!fDoLightOutput){
1702  fHistoTrueConvGammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt","ESD_TrueConvGamma_Pt",nBinsPt, minPt, maxPt);
1703  fTrueList[iCut]->Add(fHistoTrueConvGammaPt[iCut]);
1704 
1705  fHistoDoubleCountTrueConvGammaRPt[iCut] = new TH2F("ESD_TrueDoubleCountConvGamma_R_Pt","ESD_TrueDoubleCountConvGamma_R_Pt",800,0,200,nBinsPt, minPt, maxPt);
1706  fTrueList[iCut]->Add(fHistoDoubleCountTrueConvGammaRPt[iCut]);
1707  fHistoMultipleCountTrueConvGamma[iCut] = new TH1F("ESD_TrueMultipleCountConvGamma","ESD_TrueMultipleCountConvGamma",10,1,11);
1708  fTrueList[iCut]->Add(fHistoMultipleCountTrueConvGamma[iCut]);
1709 
1710  fHistoCombinatorialPt[iCut] = new TH2F("ESD_TrueCombinatorial_Pt","ESD_TrueCombinatorial_Pt",nBinsPt, minPt, maxPt,16,-0.5,15.5);
1711  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 1,"Elec+Elec");
1712  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 2,"Elec+Pion");
1713  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 3,"Elec+Kaon");
1714  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 4,"Elec+Proton");
1715  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 5,"Elec+Muon");
1716  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 6,"Pion+Pion");
1717  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 7,"Pion+Kaon");
1718  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 8,"Pion+Proton");
1719  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel( 9,"Pion+Muon");
1720  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(10,"Kaon+Kaon");
1721  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(11,"Kaon+Proton");
1722  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(12,"Kaon+Muon");
1723  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(13,"Proton+Proton");
1724  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(14,"Proton+Muon");
1725  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(15,"Muon+Muon");
1726  fHistoCombinatorialPt[iCut]->GetYaxis()->SetBinLabel(16,"Rest");
1727  fTrueList[iCut]->Add(fHistoCombinatorialPt[iCut]);
1728 
1729  fHistoTruePrimaryConvGammaPt[iCut] = new TH1F("ESD_TruePrimaryConvGamma_Pt","ESD_TruePrimaryConvGamma_Pt",nBinsPt, minPt, maxPt);
1730  fTrueList[iCut]->Add(fHistoTruePrimaryConvGammaPt[iCut]);
1731  fHistoTrueSecondaryConvGammaPt[iCut] = new TH2F("ESD_TrueSecondaryConvGamma_Pt","ESD_TrueSecondaryConvGamma_Pt",nBinsPt, minPt, maxPt,4,-0.5,3.5);
1732  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1733  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1734  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1735  fHistoTrueSecondaryConvGammaPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1736  fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaPt[iCut]);
1737  fHistoTrueSecondaryConvGammaMCPt[iCut] = new TH2F("ESD_TrueSecondaryConvGamma_MCPt","ESD_TrueSecondaryConvGamma_MCPt",nBinsPt, minPt, maxPt,4,-0.5,3.5);
1738  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(1,"K0s");
1739  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(2,"K0l");
1740  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(3,"Lambda");
1741  fHistoTrueSecondaryConvGammaMCPt[iCut]->GetYaxis()->SetBinLabel(4,"rest");
1742  fTrueList[iCut]->Add(fHistoTrueSecondaryConvGammaMCPt[iCut]);
1743 
1744  fHistoTruePrimaryConvGammaESDPtMCPt[iCut] = new TH2F("ESD_TruePrimaryConvGammaESD_PtMCPt", "ESD_TruePrimaryConvGammaESD_PtMCPt",nBinsPt, minPt, maxPt,nBinsPt, minPt, maxPt);
1746 
1747  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryConvGammaFromXFromK0sESD_MCPtPt","ESD_TrueSecondaryConvGammaFromXFromK0sESD_MCPtPt",nBinsPt, minPt, maxPt,nBinsPt, minPt, maxPt);
1749  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryConvGammaFromXFromK0lESD_MCPtPt","ESD_TrueSecondaryConvGammaFromXFromK0lESD_MCPtPt",nBinsPt, minPt, maxPt,nBinsPt, minPt, maxPt);
1751  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[iCut] = new TH2F("ESD_TrueSecondaryConvGammaFromXFromLambdaESD_MCPtPt","ESD_TrueSecondaryConvGammaFromXFromLambdaESD_MCPtPt",nBinsPt, minPt, maxPt,nBinsPt, minPt, maxPt);
1753  }
1754 
1755  fHistoTrueClusGammaPt[iCut] = new TH1F("TrueClusGamma_Pt","ESD_TrueClusGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1756  fClusterOutputList[iCut]->Add(fHistoTrueClusGammaPt[iCut]);
1757  if(!fDoLightOutput){
1758  fHistoTruePrimaryClusGammaPt[iCut] = new TH1F("TruePrimaryClusGamma_Pt","ESD_TruePrimaryClusGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1760  fHistoTruePrimaryClusGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusGamma_Pt_MCPt","ESD_TruePrimaryClusGamma_Pt_MCPt",nBinsClusterPt, minClusterPt, maxClusterPt, nBinsClusterPt, minClusterPt, maxClusterPt);
1762  fHistoTrueClusElectronPt[iCut] = new TH1F("TrueClusElectron_Pt","TrueElectronGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1763  fClusterOutputList[iCut]->Add(fHistoTrueClusElectronPt[iCut]);
1764  fHistoTrueClusConvGammaPt[iCut] = new TH1F("TrueClusConvGamma_Pt","TrueClusConvGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1766  fHistoTruePrimaryClusConvGammaPt[iCut] = new TH1F("TruePrimaryClusConvGamma_Pt","ESD_TruePrimaryClusConvGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1768  fHistoTruePrimaryClusConvGammaESDPtMCPt[iCut] = new TH2F("TruePrimaryClusConvGamma_Pt_MCPt","ESD_TruePrimaryClusConvGamma_Pt_MCPt",nBinsClusterPt, minClusterPt, maxClusterPt, nBinsClusterPt, minClusterPt, maxClusterPt);
1770 
1771  fHistoTrueSecondaryClusGammaPt[iCut] = new TH1F("TrueSecondaryClusGamma_Pt","ESD_TrueSecondaryClusGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1773  fHistoTrueSecondaryClusGammaFromK0sPt[iCut] = new TH1F("TrueSecondaryClusGammaFromK0s_Pt","ESD_TrueSecondaryClusGammaFromK0s_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1775  fHistoTrueSecondaryClusGammaFromK0lPt[iCut] = new TH1F("TrueSecondaryClusGammaFromK0l_Pt","ESD_TrueSecondaryClusGammaFromK0l_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1777  fHistoTrueSecondaryClusGammaFromLambdaPt[iCut] = new TH1F("TrueSecondaryClusGammaFromLambda_Pt","ESD_TrueSecondaryClusGammaFromLambda_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1779  }
1780 
1781  fHistoDoubleCountTrueClusterGammaPt[iCut] = new TH2F("TrueDoubleCountClusterGamma_Pt","TrueDoubleCountClusterGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt,2,0,2);
1783  fHistoMultipleCountTrueClusterGamma[iCut] = new TH1F("TrueMultipleCountClusterGamma","TrueMultipleCountClusterGamma",10,1,11);
1785  if(!fDoLightOutput) {
1786  fHistoTrueNLabelsInClusPt[iCut] = new TH2F("TrueNLabelsInClus_Pt","TrueNLabelsInClus_Pt",100,-0.5,99.5,nBinsClusterPt, minClusterPt, maxClusterPt);
1788  fHistoTrueClusGammaEM02[iCut] = new TH2F("TrueClusGammaEM02","TrueClusGammaEM02",nBinsClusterPt, minClusterPt, maxClusterPt,400,0,5);
1789  fClusterOutputList[iCut]->Add(fHistoTrueClusGammaEM02[iCut]);
1790  fHistoTrueClusPi0EM02[iCut] = new TH2F("TrueClusPi0EM02","TrueClusPi0EM02",nBinsClusterPt, minClusterPt, maxClusterPt,400,0,5);
1791  fClusterOutputList[iCut]->Add(fHistoTrueClusPi0EM02[iCut]);
1792  fHistoTrueClusEMNonLeadingPt[iCut] = new TH1F("TrueClusEMNonLeading_Pt","TrueClusEMNonLeading_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1794  }
1795 
1796 
1797  if (fIsMC > 1){
1798  if(!fDoLightOutput){
1799  fHistoTrueConvGammaPt[iCut]->Sumw2();
1800  fHistoDoubleCountTrueConvGammaRPt[iCut]->Sumw2();
1801  fHistoMultipleCountTrueConvGamma[iCut]->Sumw2();
1802  fHistoCombinatorialPt[iCut]->Sumw2();
1803  fHistoTruePrimaryConvGammaPt[iCut]->Sumw2();
1804  fHistoTrueSecondaryConvGammaPt[iCut]->Sumw2();
1805  fHistoTrueSecondaryConvGammaMCPt[iCut]->Sumw2();
1806  fHistoTruePrimaryConvGammaESDPtMCPt[iCut]->Sumw2();
1810  }
1811  fHistoTrueClusGammaPt[iCut]->Sumw2();
1812  fHistoDoubleCountTrueClusterGammaPt[iCut]->Sumw2();
1813  fHistoMultipleCountTrueClusterGamma[iCut]->Sumw2();
1814  if(!fDoLightOutput) {
1815  fHistoTruePrimaryClusGammaPt[iCut]->Sumw2();
1816  fHistoTruePrimaryClusGammaESDPtMCPt[iCut]->Sumw2();
1817  fHistoTrueNLabelsInClusPt[iCut]->Sumw2();
1818  fHistoTrueClusGammaEM02[iCut]->Sumw2();
1819  fHistoTrueClusPi0EM02[iCut]->Sumw2();
1820  fHistoTrueClusElectronPt[iCut]->Sumw2();
1821  fHistoTrueClusConvGammaPt[iCut]->Sumw2();
1822  fHistoTruePrimaryClusConvGammaPt[iCut]->Sumw2();
1824  fHistoTrueClusEMNonLeadingPt[iCut]->Sumw2();
1825  fHistoTrueSecondaryClusGammaPt[iCut]->Sumw2();
1829  }
1830  }
1831 
1832  if (fDoPhotonQA > 0){
1833  fHistoTrueConvGammaEta[iCut] = new TH1F("ESD_TrueConvGamma_Eta","ESD_TrueConvGamma_Eta",2000,-2,2);
1834  fTrueList[iCut]->Add(fHistoTrueConvGammaEta[iCut]);
1835  }
1836 
1837 // 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);
1838 // fClusterOutputList[iCut]->Add(fHistoTruePi0NonLinearity[iCut]);
1839 // 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);
1840 // fClusterOutputList[iCut]->Add(fHistoTrueEtaNonLinearity[iCut]);
1841 
1842  if(!fDoLightOutput){
1843  fHistoTruePi0InvMassECalib[iCut] = new TH2F("True_Pi0_InvMass_E_Calib","True_Pi0_InvMass_E_Calib",800,0,0.8,nBinsPt, minPt, maxPt);
1844  fHistoTruePi0InvMassECalib[iCut]->SetXTitle("M_{inv}(GeV/c^{2})");
1845  fHistoTruePi0InvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
1846  fESDList[iCut]->Add(fHistoTruePi0InvMassECalib[iCut]);
1847  fHistoTruePi0PureGammaInvMassECalib[iCut] = new TH2F("True_Pi0PureGamma_InvMass_E_Calib","True_Pi0PureGamma_InvMass_E_Calib",800,0,0.8,nBinsPt, minPt, maxPt);
1848  fHistoTruePi0PureGammaInvMassECalib[iCut]->SetXTitle("M_{inv}(GeV/c^{2})");
1849  fHistoTruePi0PureGammaInvMassECalib[iCut]->SetYTitle("E_{cluster}(GeV)");
1851  }
1852 
1853  if (fDoClusterQA > 0){
1854  fHistoTrueClusConvGammaFullyPt[iCut] = new TH1F("TrueClusConvGammaFullyContained_Pt","TrueClusConvGammaFullyContained_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1856  fHistoTrueClusMergedGammaPt[iCut] = new TH1F("TrueClusMergedGamma_Pt","TrueClusMergedGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1858  fHistoTrueClusMergedPartConvGammaPt[iCut] = new TH1F("TrueClusMergedPartConvGamma_Pt","TrueClusMergedPartConvGamma_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1860  fHistoTrueClusDalitzPt[iCut] = new TH1F("TrueClusDalitz_Pt","TrueClusDalitz_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1861  fClusterOutputList[iCut]->Add(fHistoTrueClusDalitzPt[iCut]);
1862  fHistoTrueClusDalitzMergedPt[iCut] = new TH1F("TrueClusDalitzMerged_Pt","TrueClusDalitzMerged_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1864  fHistoTrueClusPhotonFromElecMotherPt[iCut] = new TH1F("TrueClusPhotonFromElecMother_Pt","TrueClusPhotonFromElecMother_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1866  fHistoTrueClusShowerPt[iCut] = new TH1F("TrueClusShower_Pt","TrueClusShower_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1867  fClusterOutputList[iCut]->Add(fHistoTrueClusShowerPt[iCut]);
1868  fHistoTrueClusSubLeadingPt[iCut] = new TH1F("TrueClusSubleading_Pt","TrueClusSubleading_Pt",nBinsClusterPt, minClusterPt, maxClusterPt);
1870  fHistoTrueClusNMothers[iCut] = new TH1F("TrueClusNParticles","TrueClusNParticles",20,0,20);
1871  fClusterOutputList[iCut]->Add(fHistoTrueClusNMothers[iCut]);
1872  if (fIsMC > 1){
1873  fHistoTrueClusConvGammaFullyPt[iCut]->Sumw2();
1874  fHistoTrueClusMergedGammaPt[iCut]->Sumw2();
1875  fHistoTrueClusMergedPartConvGammaPt[iCut]->Sumw2();
1876  fHistoTrueClusDalitzPt[iCut]->Sumw2();
1877  fHistoTrueClusDalitzMergedPt[iCut]->Sumw2();
1878  fHistoTrueClusPhotonFromElecMotherPt[iCut]->Sumw2();
1879  fHistoTrueClusShowerPt[iCut]->Sumw2();
1880  fHistoTrueClusSubLeadingPt[iCut]->Sumw2();
1881  fHistoTrueClusNMothers[iCut]->Sumw2();
1882  }
1883  }
1884 
1885  if(fDoMesonAnalysis){
1886  fHistoTruePi0InvMassPt[iCut] = new TH2F("ESD_TruePi0_InvMass_Pt","ESD_TruePi0_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1887  fHistoTruePi0InvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1888  fHistoTruePi0InvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1889  fTrueList[iCut]->Add(fHistoTruePi0InvMassPt[iCut]);
1890  fHistoTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueEta_InvMass_Pt","ESD_TrueEta_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1891  fHistoTrueEtaInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2})");
1892  fHistoTrueEtaInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
1893  fTrueList[iCut]->Add(fHistoTrueEtaInvMassPt[iCut]);
1894  fHistoTruePi0MatchedInvMassPt[iCut] = new TH2F("ESD_TruePi0_Matched_InvMass_Pt","ESD_TruePi0_Matched_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1895  fHistoTruePi0MatchedInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1896  fHistoTruePi0MatchedInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1897  fTrueList[iCut]->Add(fHistoTruePi0MatchedInvMassPt[iCut]);
1898  fHistoTrueEtaMatchedInvMassPt[iCut] = new TH2F("ESD_TrueEta_Matched_InvMass_Pt","ESD_TrueEta_Matched_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1899  fHistoTrueEtaMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2})");
1900  fHistoTrueEtaMatchedInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
1901  fTrueList[iCut]->Add(fHistoTrueEtaMatchedInvMassPt[iCut]);
1902 
1903  fHistoDoubleCountTruePi0InvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountPi0_InvMass_Pt","ESD_TrueDoubleCountPi0_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1904  fTrueList[iCut]->Add(fHistoDoubleCountTruePi0InvMassPt[iCut]);
1905  fHistoMultipleCountTruePi0[iCut] = new TH1F("ESD_TrueMultipleCountPi0","ESD_TrueMultipleCountPi0",10,1,11);
1906  fTrueList[iCut]->Add(fHistoMultipleCountTruePi0[iCut]);
1907  fHistoDoubleCountTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountEta_InvMass_Pt","ESD_TrueDoubleCountEta_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1908  fTrueList[iCut]->Add(fHistoDoubleCountTrueEtaInvMassPt[iCut]);
1909  fHistoMultipleCountTrueEta[iCut] = new TH1F("ESD_TrueMultipleCountEta","ESD_TrueMultipleCountEta",10,1,11);
1910  fTrueList[iCut]->Add(fHistoMultipleCountTrueEta[iCut]);
1911 
1912  fHistoTruePrimaryPi0InvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_Pt", "ESD_TruePrimaryPi0_InvMass_Pt", 800,0,0.8,nBinsPt, minPt, maxPt);
1913  fHistoTruePrimaryPi0InvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}}(GeV/c^{2})");
1914  fHistoTruePrimaryPi0InvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1915  fHistoTruePrimaryPi0InvMassPt[iCut]->Sumw2();
1916  fTrueList[iCut]->Add(fHistoTruePrimaryPi0InvMassPt[iCut]);
1917 
1918  fHistoTruePrimaryEtaInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEta_InvMass_Pt", "ESD_TruePrimaryEta_InvMass_Pt", 800,0,0.8,nBinsPt, minPt, maxPt);
1919  fHistoTruePrimaryEtaInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta}(GeV/c^{2})");
1920  fHistoTruePrimaryEtaInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
1921  fHistoTruePrimaryEtaInvMassPt[iCut]->Sumw2();
1922  fTrueList[iCut]->Add(fHistoTruePrimaryEtaInvMassPt[iCut]);
1923 
1924  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt", "ESD_TruePrimaryPi0W0Weights_InvMass_Pt", 800,0,0.8,nBinsPt, minPt, maxPt);
1925  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}}(GeV/c^{2})");
1926  fHistoTruePrimaryPi0W0WeightingInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1928 
1929  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut] = new TH2F("ESD_TruePrimaryEtaW0Weights_InvMass_Pt", "ESD_TruePrimaryEtaW0Weights_InvMass_Pt", 800,0,0.8,nBinsPt, minPt, maxPt);
1930  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta}(GeV/c^{2})");
1931  fHistoTruePrimaryEtaW0WeightingInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
1933 
1934  fProfileTruePrimaryPi0WeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryPi0Weights_InvMass_Pt", "ESD_TruePrimaryPi0Weights_InvMass_Pt", 800,0,0.8,nBinsPt, minPt, maxPt);
1935  fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->SetXTitle("M_{inv,prim #pi^{0}}(GeV/c^{2})");
1936  fProfileTruePrimaryPi0WeightsInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1939  fProfileTruePrimaryEtaWeightsInvMassPt[iCut] = new TProfile2D("ESD_TruePrimaryEtaWeights_InvMass_Pt", "ESD_TruePrimaryEtaWeights_InvMass_Pt", 800,0,0.8,nBinsPt, minPt, maxPt);
1940  fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->SetXTitle("M_{inv,prim #eta}(GeV/c^{2})");
1941  fProfileTruePrimaryEtaWeightsInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
1944 
1945  fHistoTrueSecondaryPi0InvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_Pt", "ESD_TrueSecondaryPi0_InvMass_Pt", 800,0,0.8,nBinsPt, minPt, maxPt);
1946  fHistoTrueSecondaryPi0InvMassPt[iCut]->SetXTitle("M_{inv,sec #pi^{0}}(GeV/c^{2})");
1947  fHistoTrueSecondaryPi0InvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1948  fHistoTrueSecondaryPi0InvMassPt[iCut]->Sumw2();
1949  fTrueList[iCut]->Add(fHistoTrueSecondaryPi0InvMassPt[iCut]);
1950 
1951  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_Pt","ESD_TrueSecondaryPi0FromK0s_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1952  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from K^{0}_{S}}(GeV/c^{2})");
1953  fHistoTrueSecondaryPi0FromK0sInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1956  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0l_InvMass_Pt","ESD_TrueSecondaryPi0FromK0l_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1957  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from K^{0}_{L}}(GeV/c^{2})");
1958  fHistoTrueSecondaryPi0FromK0lInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1961  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromEta_InvMass_Pt","ESD_TrueSecondaryPi0FromEta_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1962  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from #eta}(GeV/c^{2})");
1963  fHistoTrueSecondaryPi0FromEtaInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1965  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut] = new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_Pt","ESD_TrueSecondaryPi0FromLambda_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
1966  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}from #Lambda}(GeV/c^{2})");
1967  fHistoTrueSecondaryPi0FromLambdaInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
1969 
1970  if(!fDoLightOutput) {
1971  fHistoTruePrimaryPi0PhotonPairPtconv[iCut] = new TH2F("ESD_TruePrimaryPi0_InvMass_PtConv","",400,0,0.4,nBinsPt, minPt, maxPt);
1972  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1973  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv}p_{T}(GeV/c)");
1974  fHistoTruePrimaryPi0PhotonPairPtconv[iCut]->Sumw2();
1976 
1977  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv[iCut] = new TH2F("ESD_TruePrimaryPi0W0Weights_InvMass_Pt","",400,0,0.4,nBinsPt, minPt, maxPt);
1978  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1979  fHistoTruePrimaryPi0W0WeightsPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv}p_{T}(GeV/c)");
1981 
1982  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut] = new TH2F("ESD_TrueSecondaryPi0_InvMass_PtConv","",400,0,0.4,nBinsPt, minPt, maxPt);
1983  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1984  fHistoTrueSecondaryPi0PhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv}p_{T}(GeV/c)");
1987 
1988  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0s_InvMass_PtConv","",400,0,0.4,nBinsPt, minPt, maxPt);
1989  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1990  fHistoTrueSecondaryPi0FromK0sPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv}p_{T}(GeV/c)");
1993 
1994  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv[iCut] = new TH2F("ESD_TrueSecondaryPi0FromK0l_InvMass_PtConv","",400,0,0.4,nBinsPt, minPt, maxPt);
1995  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1996  fHistoTrueSecondaryPi0FromK0lPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv}p_{T}(GeV/c)");
1999 
2000  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv[iCut]= new TH2F("ESD_TrueSecondaryPi0FromLambda_InvMass_PtConv","",400,0,0.4,nBinsPt, minPt, maxPt);
2001  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
2002  fHistoTrueSecondaryPi0FromLambdaPhotonPairPtconv[iCut]->SetYTitle("#gamma^{conv}p_{T}(GeV/c)");
2005 
2006  fHistoTruePrimaryPi0DCPtconv[iCut] = new TH1F("ESD_TruePrimaryPi0DC_PtConv","",nBinsPt, minPt, maxPt);
2007  fHistoTruePrimaryPi0DCPtconv[iCut]->SetXTitle("#gamma^{conv}p_{T}(GeV/c)");
2008  fHistoTruePrimaryPi0DCPtconv[iCut]->Sumw2();
2009  fTrueList[iCut]->Add(fHistoTruePrimaryPi0DCPtconv[iCut]);
2010 
2011  fHistoTrueSecondaryPi0DCPtconvSource[iCut] = new TH2F("ESD_TrueSecondaryPi0DC_PtConv_Source","",nBinsPt, minPt, maxPt, 4, -0.5,3.5);
2012  fHistoTrueSecondaryPi0DCPtconvSource[iCut]->SetXTitle("#gamma^{conv}p_{T}(GeV/c)");
2013  fHistoTrueSecondaryPi0DCPtconvSource[iCut]->SetYTitle("sec. source");
2014  fHistoTrueSecondaryPi0DCPtconvSource[iCut]->Sumw2();
2016 
2017  fHistoTruePrimaryPi0MissingPtconv[iCut] = new TH1F("ESD_TruePrimaryPi0Missing_PtConv","",nBinsPt, minPt, maxPt);
2018  fHistoTruePrimaryPi0MissingPtconv[iCut]->SetXTitle("#gamma^{conv}p_{T}(GeV/c)");
2019  fHistoTruePrimaryPi0MissingPtconv[iCut]->Sumw2();
2020  fTrueList[iCut]->Add(fHistoTruePrimaryPi0MissingPtconv[iCut]);
2021 
2022  fHistoTrueSecondaryPi0MissingPtconvSource[iCut] = new TH2F("ESD_TrueSecondaryPi0Missing_PtConv_Source","",nBinsPt, minPt, maxPt, 4, -0.5,3.5);
2023  fHistoTrueSecondaryPi0MissingPtconvSource[iCut]->SetXTitle("#gamma^{conv}p_{T}(GeV/c)");
2024  fHistoTrueSecondaryPi0MissingPtconvSource[iCut]->SetYTitle("sec. source");
2027 
2028  // put proper summing for JJ weights
2029  if (fIsMC > 1){
2031  }
2032  }
2033 
2034  if (fIsMC > 1){
2035  fHistoTruePi0InvMassPt[iCut]->Sumw2();
2036  fHistoTrueEtaInvMassPt[iCut]->Sumw2();
2037  fHistoTruePi0MatchedInvMassPt[iCut]->Sumw2();
2038  fHistoTrueEtaMatchedInvMassPt[iCut]->Sumw2();
2039  fHistoDoubleCountTruePi0InvMassPt[iCut]->Sumw2();
2040  fHistoMultipleCountTruePi0[iCut]->Sumw2();
2041  fHistoDoubleCountTrueEtaInvMassPt[iCut]->Sumw2();
2042  fHistoMultipleCountTrueEta[iCut]->Sumw2();
2047  }
2048 
2049  if (fDoMesonQA > 0){
2050  if (fIsMC < 2){
2051  fHistoTruePi0CaloPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloPhoton_InvMass_Pt","ESD_TruePi0CaloPhoton_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2052  fHistoTruePi0CaloPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma #gamma");
2053  fHistoTruePi0CaloPhotonInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2054  fTrueList[iCut]->Add(fHistoTruePi0CaloPhotonInvMassPt[iCut]);
2055 
2056  fHistoTrueEtaCaloPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloPhoton_InvMass_Pt","ESD_TrueEtaCaloPhoton_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2057  fHistoTrueEtaCaloPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma #gamma");
2058  fHistoTrueEtaCaloPhotonInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2059  fTrueList[iCut]->Add(fHistoTrueEtaCaloPhotonInvMassPt[iCut]);
2060 
2061  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhoton_InvMass_Pt","ESD_TruePi0CaloConvertedPhoton_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2062  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma #gamma_{conv}");
2063  fHistoTruePi0CaloConvertedPhotonInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2065 
2066  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt","ESD_TruePi0CaloConvertedPhotonMatched_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2067  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma #gamma_{conv,matched}");
2068  fHistoTruePi0CaloConvertedPhotonMatchedInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2070 
2071  fHistoTruePi0CaloConvPhotonConvRPt[iCut] = new TH2F("ESD_TruePi0CaloConvPhoton_ConvR_PtE","ESD_TruePi0CaloConvPhoton_ConvR_PtE",920,0,460,nBinsPt, minPt, maxPt);
2072  fHistoTruePi0CaloConvPhotonConvRPt[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2073  fHistoTruePi0CaloConvPhotonConvRPt[iCut]->SetYTitle("e^{#pm}p_{T}(GeV/c)");
2075 
2076  fHistoTruePi0CaloConvPhotonConvRAlpha[iCut] = new TH2F("ESD_TruePi0CaloConvPhoton_ConvR_AlphaE","ESD_TruePi0CaloConvPhoton_ConvR_AlphaE",920,0,460,200,-1,1);
2077  fHistoTruePi0CaloConvPhotonConvRAlpha[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2078  fHistoTruePi0CaloConvPhotonConvRAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2080 
2081  fHistoTruePi0CaloConvPhotonPtAlpha[iCut] = new TH2F("ESD_TruePi0CaloConvPhoton_PtE_AlphaE","ESD_TruePi0CaloConvPhoton_PtE_AlphaE",nBinsPt, minPt, maxPt,200,-1,1);
2082  fHistoTruePi0CaloConvPhotonPtAlpha[iCut]->SetXTitle("e^{#pm}p_{T}(GeV/c)");
2083  fHistoTruePi0CaloConvPhotonPtAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2085 
2086  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt","ESD_TrueEtaCaloConvertedPhoton_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2087  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma #gamma_{conv}");
2088  fHistoTrueEtaCaloConvertedPhotonInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2090 
2091  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt","ESD_TrueEtaCaloConvertedPhotonMatched_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2092  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma #gamma_{conv,matched}");
2093  fHistoTrueEtaCaloConvertedPhotonMatchedInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2095 
2096  fHistoTrueEtaCaloConvPhotonConvRPt[iCut] = new TH2F("ESD_TrueEtaCaloConvPhoton_ConvR_PtE","ESD_TrueEtaCaloConvPhoton_ConvR_PtE",920,0,460,nBinsPt, minPt, maxPt);
2097  fHistoTrueEtaCaloConvPhotonConvRPt[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2098  fHistoTrueEtaCaloConvPhotonConvRPt[iCut]->SetYTitle("e^{#pm}p_{T}(GeV/c)");
2100 
2101  fHistoTrueEtaCaloConvPhotonConvRAlpha[iCut] = new TH2F("ESD_TrueEtaCaloConvPhoton_ConvR_AlphaE","ESD_TrueEtaCaloConvPhoton_ConvR_AlphaE",920,0,460,200,-1,1);
2102  fHistoTrueEtaCaloConvPhotonConvRAlpha[iCut]->SetXTitle("R_{conv,e_{calo}}(cm)");
2103  fHistoTrueEtaCaloConvPhotonConvRAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2105 
2106  fHistoTrueEtaCaloConvPhotonPtAlpha[iCut] = new TH2F("ESD_TrueEtaCaloConvPhoton_PtE_AlphaE","ESD_TrueEtaCaloConvPhoton_PtE_AlphaE",nBinsPt, minPt, maxPt,200,-1,1);
2107  fHistoTrueEtaCaloConvPhotonPtAlpha[iCut]->SetXTitle("e^{#pm}p_{T}(GeV/c)");
2108  fHistoTrueEtaCaloConvPhotonPtAlpha[iCut]->SetYTitle("#alpha converted e-pair");
2110 
2111 
2112  fHistoTruePi0CaloElectronInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloElectron_InvMass_Pt","ESD_TruePi0CaloElectron_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2113  fHistoTruePi0CaloElectronInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma e^{#pm}");
2114  fHistoTruePi0CaloElectronInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2116  fHistoTrueEtaCaloElectronInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloElectron_InvMass_Pt","ESD_TrueEtaCaloElectron_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2117  fHistoTrueEtaCaloElectronInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma e^{#pm}");
2118  fHistoTrueEtaCaloElectronInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2120 
2121  fHistoTruePi0CaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedCluster_InvMass_Pt","ESD_TruePi0CaloMergedCluster_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2122  fHistoTruePi0CaloMergedClusterInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma merged cluster");
2123  fHistoTruePi0CaloMergedClusterInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2125  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedCluster_InvMass_Pt","ESD_TrueEtaCaloMergedCluster_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2126  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma merged cluster");
2127  fHistoTrueEtaCaloMergedClusterInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2129 
2130  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut] = new TH2F("ESD_TrueMotherCaloEMNonLeading_InvMass_Pt","ESD_TrueMotherCaloEMNonLeading_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2131  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2}) #gamma cluster no leading EM");
2132  fHistoTrueMotherCaloEMNonLeadingInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2134  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt","ESD_TruePi0CaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2135  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2}) #gamma merged cluster, part conv");
2136  fHistoTruePi0CaloMergedClusterPartConvInvMassPt[iCut]->SetYTitle("#pi^{0}p_{T}(GeV/c)");
2138  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut] = new TH2F("ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt","ESD_TrueEtaCaloMergedClusterPartConv_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2139  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]->SetXTitle("M_{inv,#eta}(GeV/c^{2}) #gamma merged cluster, part conv");
2140  fHistoTrueEtaCaloMergedClusterPartConvInvMassPt[iCut]->SetYTitle("#eta p_{T}(GeV/c)");
2142 
2143  fHistoTruePrimaryPi0MCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryPi0_MCPt_ResolPt","ESD_TruePrimaryPi0_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
2144  fHistoTruePrimaryPi0MCPtResolPt[iCut]->SetXTitle("#pi^{0}p_{T,MC}(GeV/c)");
2145  fHistoTruePrimaryPi0MCPtResolPt[iCut]->SetYTitle("#pi^{0}(p_{T,rec}-p_{T,MC})/p_{T,MC}()");
2146  fHistoTruePrimaryPi0MCPtResolPt[iCut]->Sumw2();
2148  fTrueList[iCut]->Add(fHistoTruePrimaryPi0MCPtResolPt[iCut]);
2149 
2150  fHistoTruePrimaryEtaMCPtResolPt[iCut] = new TH2F("ESD_TruePrimaryEta_MCPt_ResolPt","ESD_TruePrimaryEta_ResolPt_MCPt",500,0.03,25,1000,-1.,1.);
2151  fHistoTruePrimaryEtaMCPtResolPt[iCut]->SetXTitle("#eta p_{T,MC}(GeV/c)");
2152  fHistoTruePrimaryEtaMCPtResolPt[iCut]->SetYTitle("#eta (p_{T,rec}-p_{T,MC})/p_{T,MC}()");
2153  fHistoTruePrimaryEtaMCPtResolPt[iCut]->Sumw2();
2155  fTrueList[iCut]->Add(fHistoTruePrimaryEtaMCPtResolPt[iCut]);
2156 
2157  fHistoTrueK0sWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0sWithPi0Daughter_MCPt","ESD_TrueK0sWithPi0Daughter_MCPt",nBinsPt, minPt, maxPt);
2158  fHistoTrueK0sWithPi0DaughterMCPt[iCut]->SetXTitle("K^{0}_{s}p_{MC,T}(GeV/c) for K^{0}_{s}where #pi^{0}rec ");
2159  fTrueList[iCut]->Add(fHistoTrueK0sWithPi0DaughterMCPt[iCut]);
2160  fHistoTrueK0lWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueK0lWithPi0Daughter_MCPt","ESD_TrueK0lWithPi0Daughter_MCPt",nBinsPt, minPt, maxPt);
2161  fHistoTrueK0lWithPi0DaughterMCPt[iCut]->SetXTitle("K^{0}_{s}p_{MC,T}(GeV/c) for K^{0}_{l}where #pi^{0}rec ");
2162  fTrueList[iCut]->Add(fHistoTrueK0lWithPi0DaughterMCPt[iCut]);
2163  fHistoTrueEtaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueEtaWithPi0Daughter_MCPt","ESD_TrueEtaWithPi0Daughter_MCPt",nBinsPt, minPt, maxPt);
2164  fHistoTrueEtaWithPi0DaughterMCPt[iCut]->SetXTitle("#eta p_{MC,T}(GeV/c) for #eta where #pi^{0}rec ");
2165  fTrueList[iCut]->Add(fHistoTrueEtaWithPi0DaughterMCPt[iCut]);
2166  fHistoTrueLambdaWithPi0DaughterMCPt[iCut] = new TH1F("ESD_TrueLambdaWithPi0Daughter_MCPt","ESD_TrueLambdaWithPi0Daughter_MCPt",nBinsPt, minPt, maxPt);
2167  fHistoTrueLambdaWithPi0DaughterMCPt[iCut]->SetXTitle("#Lambda p_{MC,T}(GeV/c) for #Lambda where #pi^{0}rec ");
2169  }
2170  if(fDoMesonQA>1){
2171  fHistoTrueBckGGInvMassPt[iCut] = new TH2F("ESD_TrueBckGG_InvMass_Pt","ESD_TrueBckGG_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2172  fHistoTrueBckGGInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2}) #gamma #gamma no signal");
2173  fHistoTrueBckGGInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2174  fTrueList[iCut]->Add(fHistoTrueBckGGInvMassPt[iCut]);
2175  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut] = new TH2F("ESD_TrueBckFullMesonContained_InvMass_Pt","ESD_TrueBckFullMesonContained_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2176  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2}) #gamma #gamma, calo gamma with full pi0");
2177  fHistoTrueBckFullMesonContainedInOneClusterInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2179  fHistoTrueBckAsymEClustersInvMassPt[iCut] = new TH2F("ESD_TrueBckAsymEClus_InvMass_Pt","ESD_TrueBckAsymEClus_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2180  fHistoTrueBckAsymEClustersInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2}) #gamma #gamma, calo gamma >70% of pi0 energy");
2181  fHistoTrueBckAsymEClustersInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2183  fHistoTrueBckContInvMassPt[iCut] = new TH2F("ESD_TrueBckCont_InvMass_Pt","ESD_TrueBckCont_InvMass_Pt",800,0,0.8,nBinsPt, minPt, maxPt);
2184  fHistoTrueBckContInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2}) contamination");
2185  fHistoTrueBckContInvMassPt[iCut]->SetYTitle("#pair p_{T}(GeV/c)");
2186  fTrueList[iCut]->Add(fHistoTrueBckContInvMassPt[iCut]);
2187  }
2188  fHistoTruePi0PtY[iCut] = new TH2F("ESD_TruePi0_Pt_Y","ESD_TruePi0_Pt_Y",nBinsQAPt, minQAPt, maxQAPt,150,-1.5,1.5);
2189  fHistoTruePi0PtY[iCut]->SetYTitle("Y_{#pi^{0}}");
2190  fHistoTruePi0PtY[iCut]->SetXTitle("#pi^{0}p_{T}(GeV/c)");
2192  fTrueList[iCut]->Add(fHistoTruePi0PtY[iCut]);
2193  fHistoTrueEtaPtY[iCut] = new TH2F("ESD_TrueEta_Pt_Y","ESD_TrueEta_Pt_Y",nBinsQAPt, minQAPt, maxQAPt,150,-1.5,1.5);
2194  fHistoTrueEtaPtY[iCut]->SetYTitle("Y_{#eta}");
2195  fHistoTrueEtaPtY[iCut]->SetXTitle("#eta p_{T}(GeV/c)");
2197  fTrueList[iCut]->Add(fHistoTrueEtaPtY[iCut]);
2198  fHistoTruePi0PtAlpha[iCut] = new TH2F("ESD_TruePi0_Pt_Alpha","ESD_TruePi0_Pt_Alpha",nBinsQAPt, minQAPt, maxQAPt,200,-1,1);
2199  fHistoTruePi0PtAlpha[iCut]->SetYTitle("#alpha_{#pi^{0}}");
2200  fHistoTruePi0PtAlpha[iCut]->SetXTitle("#pi^{0}p_{T}(GeV/c)");
2202  fTrueList[iCut]->Add(fHistoTruePi0PtAlpha[iCut]);
2203  fHistoTrueEtaPtAlpha[iCut] = new TH2F("ESD_TrueEta_Pt_Alpha","ESD_TrueEta_Pt_Alpha",nBinsQAPt, minQAPt, maxQAPt,200,-1,1);
2204  fHistoTrueEtaPtAlpha[iCut]->SetYTitle("#alpha_{#eta}");
2205  fHistoTrueEtaPtAlpha[iCut]->SetXTitle("#eta p_{T}(GeV/c)");
2207  fTrueList[iCut]->Add(fHistoTrueEtaPtAlpha[iCut]);
2208 
2209  fHistoTruePi0PtOpenAngle[iCut] = new TH2F("ESD_TruePi0_Pt_OpenAngle","ESD_TruePi0_Pt_OpenAngle",nBinsQAPt, minQAPt, maxQAPt,100,0,1);
2210  fHistoTruePi0PtOpenAngle[iCut]->SetYTitle("#theta_{#pi^{0}}");
2211  fHistoTruePi0PtOpenAngle[iCut]->SetXTitle("#pi^{0}p_{T}(GeV/c)");
2213  fTrueList[iCut]->Add(fHistoTruePi0PtOpenAngle[iCut]);
2214  fHistoTrueEtaPtOpenAngle[iCut] = new TH2F("ESD_TrueEta_Pt_OpenAngle","ESD_TrueEta_Pt_OpenAngle",nBinsQAPt, minQAPt, maxQAPt,200,0,TMath::Pi());
2215  fHistoTrueEtaPtOpenAngle[iCut]->SetYTitle("#theta_{#eta}");
2216  fHistoTrueEtaPtOpenAngle[iCut]->SetXTitle("#eta p_{T}(GeV/c)");
2218  fTrueList[iCut]->Add(fHistoTrueEtaPtOpenAngle[iCut]);
2219 
2220  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut] = new TH2F("ESD_TrueMotherPi0ConvPhoton_Eta_Phi","conv photons for true #pi^{0}",600,0,2*TMath::Pi(),200,-1,1);
2221  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
2222  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
2224  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut] = new TH2F("ESD_TrueMotherEtaConvPhoton_Eta_Phi","conv photons for true #eta",600,0,2*TMath::Pi(),200,-1,1);
2225  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
2226  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
2228 
2229  if (fIsMC > 1){
2230  if(fDoMesonQA>1){
2231  fHistoTrueBckGGInvMassPt[iCut]->Sumw2();
2233  fHistoTrueBckAsymEClustersInvMassPt[iCut]->Sumw2();
2234  fHistoTrueBckContInvMassPt[iCut]->Sumw2();
2235  }
2236  fHistoTruePi0PtY[iCut]->Sumw2();
2237  fHistoTrueEtaPtY[iCut]->Sumw2();
2238  fHistoTruePi0PtAlpha[iCut]->Sumw2();
2239  fHistoTrueEtaPtAlpha[iCut]->Sumw2();
2240  fHistoTruePi0PtOpenAngle[iCut]->Sumw2();
2241  fHistoTrueEtaPtOpenAngle[iCut]->Sumw2();
2242  fHistoTrueMotherPi0ConvPhotonEtaPhi[iCut]->Sumw2();
2243  fHistoTrueMotherEtaConvPhotonEtaPhi[iCut]->Sumw2();
2244  }
2245  }
2246  }
2247  }
2248  }
2249 
2254 
2255  fMapMultipleCountTruePi0s.clear();
2256  fMapMultipleCountTrueEtas.clear();
2259 
2260  fVectorRecTruePi0s.clear();
2261  fVectorRecTrueEtas.clear();
2262 
2263  if(fV0Reader)
2265  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
2266  fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
2267  if(fV0Reader)
2269  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
2270  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
2271 
2275 
2276  for(Int_t iMatcherTask = 0; iMatcherTask < 3; iMatcherTask++){
2277  AliCaloTrackMatcher* temp = (AliCaloTrackMatcher*) (AliAnalysisManager::GetAnalysisManager()->GetTask(Form("CaloTrackMatcher_%i",iMatcherTask)));
2278  if(temp) fOutputContainer->Add(temp->GetCaloTrackMatcherHistograms());
2279  }
2280 
2281 
2282 
2283  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2284  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
2285  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
2286  fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
2287  }
2288  if(!((AliConversionPhotonCuts*)fCutArray->At(iCut))) continue;
2289  if(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms()){
2290  fCutFolder[iCut]->Add(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms());
2291  }
2292  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
2293  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
2294  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
2295  }
2296  if(fSetPlotHistsExtQA){
2297  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
2298  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms()){
2299  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms());
2300  }
2301  }
2302  if(fDoMesonAnalysis){
2303  if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
2304  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
2305  fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
2306  }
2307  }
2308  }
2309 
2310  if (fIsMC > 0){
2311  tBrokenFiles = new TTree("BrokenFiles","BrokenFiles");
2312  tBrokenFiles->Branch("fileName",&fFileNameBroken);
2314  }
2315 
2316 
2317  PostData(1, fOutputContainer);
2318 }
2319 //_____________________________________________________________________________
2321 {
2322  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2323  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
2324  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
2325  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
2326  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
2327  }
2328 
2329  if(fIsHeavyIon == 2){
2330  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
2331  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2332  continue; // No Eta Shift requested, continue
2333  }
2334  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
2335  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
2336  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2337  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
2338  continue;
2339  } else{
2340  printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
2341  (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
2342  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2343  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
2344  }
2345  }
2346  }
2347 
2348  return kTRUE;
2349 }
2350 //_____________________________________________________________________________
2352 {
2353  //
2354  // Called for each event
2355  //
2356  fInputEvent = InputEvent();
2357 
2358  if(fIsMC > 0) fMCEvent = MCEvent();
2359 
2360  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
2361  if(fInputEvent->IsIncompleteDAQ()==kTRUE) eventQuality = 2;// incomplete event
2362  // Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1 or because it is incomplete => abort processing of this event/file
2363  if(eventQuality == 2 || eventQuality == 3){
2364  // write out name of broken file for first event
2365  if (fIsMC > 0){
2366  if (fInputEvent->IsA()==AliESDEvent::Class()){
2367  if (((AliESDEvent*)fInputEvent)->GetEventNumberInFile() == 0){
2368  fFileNameBroken = new TObjString(Form("%s",((TString)fV0Reader->GetCurrentFileName()).Data()));
2369  if (tBrokenFiles) tBrokenFiles->Fill();
2370  delete fFileNameBroken;
2371  }
2372  }
2373  }
2374 
2375  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
2376  fHistoNEvents[iCut]->Fill(eventQuality);
2377  if (fIsMC > 1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
2378  }
2379  return;
2380  }
2381 
2382 
2383  if(fInputEvent->IsA()==AliAODEvent::Class()){
2384  fInputEvent->InitMagneticField();
2385  }
2386 
2387  fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
2388 
2389  // ------------------- BeginEvent ----------------------------
2390  AliEventplane *EventPlane = fInputEvent->GetEventplane();
2391  if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
2392  else fEventPlaneAngle=0.0;
2393 
2394  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
2395  RelabelAODPhotonCandidates(kTRUE);// In case of AODMC relabeling MC
2396  fV0Reader->RelabelAODs(kTRUE);
2397  }
2398 
2399  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
2400 
2401  fiCut = iCut;
2402 // cout << ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber() << "_" << ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber() <<
2403 // "_" << ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber() <<endl;
2404 
2405  Bool_t isRunningEMCALrelAna = kFALSE;
2406  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) isRunningEMCALrelAna = kTRUE;
2407 
2408  Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,isRunningEMCALrelAna);
2409 
2410  if(fIsMC==2){
2411  Float_t xsection = -1.;
2412  Float_t ntrials = -1.;
2413  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetXSectionAndNTrials(fMCEvent,xsection,ntrials);
2414  if((xsection==-1.) || (ntrials==-1.)) AliFatal(Form("ERROR: GetXSectionAndNTrials returned invalid xsection/ntrials, periodName from V0Reader: '%s'",fV0Reader->GetPeriodName().Data()));
2415  fProfileJetJetXSection[iCut]->Fill(0.,xsection);
2416  fHistoJetJetNTrials[iCut]->Fill("#sum{NTrials}",ntrials);
2417  }
2418 
2419  if(fIsMC>0){
2420  fWeightJetJetMC = 1;
2421  // cout << fMCEvent << endl;
2422  Bool_t isMCJet = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsJetJetMCEventAccepted( fMCEvent, fWeightJetJetMC );
2423  if (fIsMC == 3){
2424  Double_t weightMult = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetWeightForMultiplicity(fV0Reader->GetNumberOfPrimaryTracks());
2425  fWeightJetJetMC = fWeightJetJetMC*weightMult;
2426  }
2427  if(fIsMC==1) fWeightJetJetMC = 1;
2428  if (!isMCJet){
2429  fHistoNEvents[iCut]->Fill(10,fWeightJetJetMC);
2430  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(10);
2431  continue;
2432  }
2433  }
2434 
2435  Bool_t triggered = kTRUE;
2436 
2437  if(eventNotAccepted!= 0){
2438  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
2439  fHistoNEvents[iCut]->Fill(eventNotAccepted, fWeightJetJetMC); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
2440  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventNotAccepted);
2441  if (eventNotAccepted==3 && fIsMC > 0){
2442  triggered = kFALSE;
2443  }else {
2444  continue;
2445  }
2446  }
2447 
2448  if(eventQuality != 0){// Event Not Accepted
2449  //cout << "event rejected due to: " <<eventQuality << endl;
2450  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC);
2451  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
2452  continue;
2453  }
2454 
2455  if (triggered==kTRUE){
2456  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC); // Should be 0 here
2457  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality); // Should be 0 here
2458 
2460  fHistoVertexZ[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetZ(), fWeightJetJetMC);
2461  if(!fDoLightOutput){
2462  fHistoVertexX[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetX(), fWeightJetJetMC);
2463  fHistoVertexY[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetY(), fWeightJetJetMC);
2464  fHistoSPDClusterTrackletBackground[iCut]->Fill(fInputEvent->GetMultiplicity()->GetNumberOfTracklets(),(fInputEvent->GetNumberOfITSClusters(0)+fInputEvent->GetNumberOfITSClusters(1)),fWeightJetJetMC);
2465  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A(), fWeightJetJetMC);
2466  else fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C(), fWeightJetJetMC);
2467  }
2468  }
2469 
2470  if(fIsMC>0){
2471  // Process MC Particle
2472  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
2473  if(fInputEvent->IsA()==AliESDEvent::Class()){
2474  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
2475  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
2476  fMCEvent);
2477  }
2478  else if(fInputEvent->IsA()==AliAODEvent::Class()){
2479  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
2480  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
2481  fInputEvent);
2482  }
2483 
2484  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader()){
2485  for(Int_t i = 0;i<(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader())->GetEntries();i++){
2486  TString nameBin= fHistoMCHeaders[iCut]->GetXaxis()->GetBinLabel(i+1);
2487  if (nameBin.CompareTo("")== 0){
2488  TString nameHeader = ((TObjString*)((TList*)((AliConvEventCuts*)fEventCutArray->At(iCut))
2489  ->GetAcceptedHeader())->At(i))->GetString();
2490  fHistoMCHeaders[iCut]->GetXaxis()->SetBinLabel(i+1,nameHeader.Data());
2491  }
2492  }
2493  }
2494  }
2495  }
2496  if(fIsMC>0){
2497  if(fInputEvent->IsA()==AliESDEvent::Class())
2499  if(fInputEvent->IsA()==AliAODEvent::Class())
2501  }
2502 
2503  if (triggered==kFALSE) continue;
2504 
2505  // 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)
2506  ProcessClusters();// process calo clusters
2507  ProcessPhotonCandidates(); // Process this cuts gammas
2508 
2509  fHistoNGammaCandidates[iCut]->Fill(fGammaCandidates->GetEntries(),fWeightJetJetMC);
2511  if(fDoMesonAnalysis){ // Meson Analysis
2512  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC>0){
2513  fUnsmearedPx = new Double_t[fGammaCandidates->GetEntries()]; // Store unsmeared Momenta
2514  fUnsmearedPy = new Double_t[fGammaCandidates->GetEntries()];
2515  fUnsmearedPz = new Double_t[fGammaCandidates->GetEntries()];
2516  fUnsmearedE = new Double_t[fGammaCandidates->GetEntries()];
2517 
2518  for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
2519  fUnsmearedPx[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Px();
2520  fUnsmearedPy[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Py();
2521  fUnsmearedPz[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Pz();
2522  fUnsmearedE[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->E();
2523  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->SmearParticle(dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(gamma)));
2524  }
2525  }
2526 
2527  CalculatePi0Candidates(); // Combine Gammas from conversion and from calo
2528 
2529  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
2530  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->BackgroundHandlerType() == 0){
2531  CalculateBackground(); // Combinatorial Background
2532  UpdateEventByEventData(); // Store Event for mixed Events
2533  }
2534  else{
2535  CalculateBackgroundRP(); // Combinatorial Background
2536  fBGHandlerRP[iCut]->AddEvent(fGammaCandidates,fInputEvent); // Store Event for mixed Events
2537  fBGClusHandlerRP[iCut]->AddEvent(fClusterCandidates,fInputEvent); // Store Event for mixed Events
2538  }
2539  }
2540 
2541  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class()){
2542  ProcessConversionPhotonsForMissingTagsAOD(); //Count missing tags
2543  }else if (fIsMC>0 && fInputEvent->IsA()==AliESDEvent::Class()){
2544  ProcessConversionPhotonsForMissingTags(); //Count missing tags
2545  }
2546 
2547  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseMCPSmearing() && fIsMC>0){
2548  for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
2549  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPx(fUnsmearedPx[gamma]); // Reset Unsmeared Momenta
2550  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPy(fUnsmearedPy[gamma]);
2551  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPz(fUnsmearedPz[gamma]);
2552  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetE(fUnsmearedE[gamma]);
2553  }
2554  delete[] fUnsmearedPx; fUnsmearedPx = 0x0;
2555  delete[] fUnsmearedPy; fUnsmearedPy = 0x0;
2556  delete[] fUnsmearedPz; fUnsmearedPz = 0x0;
2557  delete[] fUnsmearedE;fUnsmearedE = 0x0;
2558  }
2559 
2560  if(fIsMC>0){
2561  fVectorRecTruePi0s.clear();
2562  fVectorRecTrueEtas.clear();
2567  }
2568  }
2569 
2570  if(fIsMC>0){
2575  }
2576 
2578 
2579  fGammaCandidates->Clear(); // delete this cuts good gammas
2580  fClusterCandidates->Clear(); // delete cluster candidates
2581  }
2582 
2583  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
2584  RelabelAODPhotonCandidates(kFALSE); // Back to ESDMC Label
2585  fV0Reader->RelabelAODs(kFALSE);
2586  }
2587 
2588  PostData(1, fOutputContainer);
2589 }
2590 
2591 //________________________________________________________________________
2593 
2594  Int_t nclus = 0;
2595  nclus = fInputEvent->GetNumberOfCaloClusters();
2596 
2597 // cout << nclus << endl;
2598 
2599  if(nclus == 0) return;
2600 
2601  // plotting histograms on cell/tower level, only if extendedMatchAndQA > 1
2602  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FillHistogramsExtendedQA(fInputEvent,fIsMC);
2603 
2604  // match tracks to clusters
2605  if(fDoPrimaryTrackMatching) ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchTracksToClusters(fInputEvent,fWeightJetJetMC,kFALSE);
2606 
2607  // vertex
2608  Double_t vertex[3] = {0,0,0};
2609  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
2610 
2611  // Loop over EMCal clusters
2612  for(Int_t i = 0; i < nclus; i++){
2613  AliVCluster* clus = NULL;
2614  if(fInputEvent->IsA()==AliESDEvent::Class()) clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
2615  else if(fInputEvent->IsA()==AliAODEvent::Class()) clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
2616 
2617  if (!clus) continue;
2618  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fMCEvent,fIsMC,fWeightJetJetMC,i)){
2619  if(fDoInvMassShowerShapeTree && ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedBeforeTrackMatch() ) tESDmapIsClusterAcceptedWithoutTrackMatch[i] = 1;
2620  delete clus;
2621  continue;
2622  }
2623 
2624  // TLorentzvector with cluster
2625  TLorentzVector clusterVector;
2626  clus->GetMomentum(clusterVector,vertex);
2627 
2628  TLorentzVector* tmpvec = new TLorentzVector();
2629  tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
2630 
2631  // convert to AODConversionPhoton
2632  AliAODConversionPhoton *PhotonCandidate = new AliAODConversionPhoton(tmpvec);
2633  if(!PhotonCandidate){ delete clus; delete tmpvec; continue;}
2634 
2636 
2637  // Flag Photon as CaloPhoton
2638  PhotonCandidate->SetIsCaloPhoton();
2639  PhotonCandidate->SetCaloClusterRef((Long_t)i);
2640  // get MC label
2641  if(fIsMC>0){
2642  Int_t* mclabelsCluster = clus->GetLabels();
2643  PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
2644 // cout << clus->GetNLabels() << endl;
2645  if (clus->GetNLabels()>0){
2646  for (Int_t k =0; k<(Int_t)clus->GetNLabels(); k++){
2647  if (k<50)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
2648 // Int_t pdgCode = fMCEvent->Particle(mclabelsCluster[k])->GetPdgCode();
2649 // cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
2650  }
2651  }
2652  }
2653 
2654  fIsFromMBHeader = kTRUE;
2656  //TString periodName = fV0Reader->GetPeriodName();
2657  // test whether largest contribution to cluster orginates in added signals
2658  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() > 0){
2659  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCEvent, fInputEvent) == 0){
2660  fIsFromMBHeader = kFALSE;
2661  }
2662  if (clus->GetNLabels()>1){
2663  Int_t* mclabelsCluster = clus->GetLabels();
2664  for (Int_t l = 1; l < (Int_t)clus->GetNLabels(); l++ ){
2665  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(mclabelsCluster[l], fMCEvent, fInputEvent) == 0){
2667  }
2668  }
2669  }
2670  }
2671 
2673  fHistoClusOverlapHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2674 
2676  fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
2677  fHistoClusGammaE[fiCut]->Fill(PhotonCandidate->E(),fWeightJetJetMC);
2678  if(fIsMC>0){
2679  if(fInputEvent->IsA()==AliESDEvent::Class()){
2680  ProcessTrueClusterCandidates(PhotonCandidate,clus->GetM02());
2681  }else {
2682  ProcessTrueClusterCandidatesAOD(PhotonCandidate,clus->GetM02());
2683  }
2684  }
2685  fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
2686  }else{
2687  delete PhotonCandidate;
2688  }
2689 
2690  delete clus;
2691  delete tmpvec;
2692  }
2693 
2694 }
2695 
2696 //________________________________________________________________________
2698 {
2699 
2700  TParticle *Photon = NULL;
2701  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
2702  if (TruePhotonCandidate->GetCaloPhotonMCLabel(0) < 0) return;
2703  if(!fDoLightOutput) fHistoTrueNLabelsInClusPt[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
2704 
2705  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = fMCEvent->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
2706  else return;
2707 
2708  if(Photon == NULL){
2709  // cout << "no photon" << endl;
2710  return;
2711  }
2712 
2713  TruePhotonCandidate->SetCaloPhotonMCFlags(fMCEvent, fEnableSortForClusMC);
2714 
2715  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2716  Double_t mcProdVtxX = primVtxMC->GetX();
2717  Double_t mcProdVtxY = primVtxMC->GetY();
2718  Double_t mcProdVtxZ = primVtxMC->GetZ();
2719  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, TruePhotonCandidate->GetCaloPhotonMCLabel(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2720 
2721  // to get primary distrinction right put mother of conversion electron as particle to check
2722  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
2723  isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, Photon->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2724 
2726  // Fill histograms for inclusive gamma corrections
2727  // --> a) all clusters with leading real or converted photons
2728  if (TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) ){
2729  fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2730  if(!fDoLightOutput){
2731  // how many of those clusters are from converted photons
2732  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2733  fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2734  }
2735  // --> b) which of these are primary
2736  if(isPrimary){
2737  fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2738  fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC);
2739  // --> c) which are from conversions? Just additonal information
2740  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && (Photon->GetMother(0)>-1)){
2741  fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2742  fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),((TParticle*)fMCEvent->Particle(Photon->GetMother(0)))->Pt(),fWeightJetJetMC);
2743  }
2744  // --> d) how do the secondaries look like
2745  }else {
2746  Int_t secondaryClass = -1;
2747  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
2748  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhoton( Photon, fMCEvent, kTRUE);
2749  else
2750  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhoton( Photon, fMCEvent, kFALSE);
2751  // all secondaries
2752  if (secondaryClass > 0 ){
2753  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2754  }
2755  // secondaries from K0s
2756  if (secondaryClass == 2)
2757  fHistoTrueSecondaryClusGammaFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2758  // secondaries from Lambda
2759  else if (secondaryClass == 3)
2760  fHistoTrueSecondaryClusGammaFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2761  else if (secondaryClass == 5)
2762  fHistoTrueSecondaryClusGammaFromK0lPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2763  }
2764  }
2765 
2766  // How many clusters are from electrons besides conversions
2767  }else if (TruePhotonCandidate->IsLargestComponentElectron()) {
2768  if(!fDoLightOutput) fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2769  // How many clusters don't have an electromagnetic particle as leading particle
2770  }else {
2771  if(!fDoLightOutput) fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2772  }
2773 
2774  // Filling histogram for true photons: E vs M02 for paper
2775  if(!fDoLightOutput) {
2776  if ( TruePhotonCandidate->IsLargestComponentPhoton() && !TruePhotonCandidate->IsPhotonWithElecMother() &&
2777  !TruePhotonCandidate->IsMerged() && !TruePhotonCandidate->IsMergedPartConv() && !TruePhotonCandidate->IsDalitzMerged() )
2778  fHistoTrueClusGammaEM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02, fWeightJetJetMC);
2779  }
2780 
2781  // Some additional QA
2782  if (fDoClusterQA > 0){
2783  // how many of the converted photons are fully contained in the cluster
2784  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
2785  fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2786  // how often do we have merged pi0/eta...
2787  if ( (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsDalitzMerged()) || TruePhotonCandidate->IsMergedPartConv() )
2788  fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2789  // how often do we have a merged cluster with at least one conversion
2790  if (TruePhotonCandidate->IsMergedPartConv())
2791  fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2792  // how often do we reconstruct Dalitz electrons
2793  if (TruePhotonCandidate->IsDalitz())
2794  fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2795  // how often merge Dalitz decays
2796  if (TruePhotonCandidate->IsDalitzMerged())
2797  fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2798  // how often do we see Bremstrahlung
2799  if (TruePhotonCandidate->IsPhotonWithElecMother())
2800  fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2801  // how often do we see a shower in the clusters
2802  if (TruePhotonCandidate->IsShower())
2803  fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2804  // how often is the EM a subleading contributor
2805  if (TruePhotonCandidate->IsSubLeadingEM())
2806  fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2807  // how many mother particles point to the cluster
2809  }
2810 
2811  // Check if we are double counting photons
2812  Int_t motherLab = Photon->GetMother(0);
2813  if (motherLab > -1){
2814  if (TruePhotonCandidate->IsLargestComponentPhoton()){
2816  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)0,fWeightJetJetMC);
2818  }
2819  }
2820  if ( TMath::Abs(fMCEvent->Particle(motherLab)->GetPdgCode()) == 111 &&
2821  TruePhotonCandidate->IsLargestComponentPhoton() &&
2822  TruePhotonCandidate->IsMerged() &&
2823  !TruePhotonCandidate->IsDalitzMerged() &&
2824  !TruePhotonCandidate->IsMergedPartConv()
2825  ){
2826  if(!fDoLightOutput) fHistoTrueClusPi0EM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02,fWeightJetJetMC);
2827  }
2828  Int_t grandMotherLab = fMCEvent->Particle(motherLab)->GetMother(0);
2829  if (grandMotherLab > -1){
2830  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2832  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)1,fWeightJetJetMC);
2834  }
2835  }
2836  }
2837  }
2838  }
2839  return;
2840 }
2841 
2842 
2843 //________________________________________________________________________
2845 {
2846  AliAODMCParticle *Photon = NULL;
2847  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2848  if (AODMCTrackArray){
2849  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
2850  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
2851  else return;
2852  }else {
2853  AliInfo("AODMCTrackArray could not be loaded");
2854  return;
2855  }
2856 
2857  if(Photon == NULL){
2858  // cout << "no photon" << endl;
2859  return;
2860  }
2861 
2863  if(!fDoLightOutput) fHistoTrueNLabelsInClusPt[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
2864 
2865  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2866  Double_t mcProdVtxX = primVtxMC->GetX();
2867  Double_t mcProdVtxY = primVtxMC->GetY();
2868  Double_t mcProdVtxZ = primVtxMC->GetZ();
2869  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2870 
2871  // to get primary distrinction right put mother of conversion electron as particle to check
2872  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2873  if (Photon->GetMother()> -1){
2874  AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
2875  isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, Mother, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2876  }
2877  }
2878 
2879  // True Photon
2881  if (TruePhotonCandidate->IsLargestComponentPhoton() || (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()) ){
2882  fHistoTrueClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2883  if(!fDoLightOutput){
2884  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2885  fHistoTrueClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2886  }
2887  if(isPrimary){
2888  fHistoTruePrimaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2889  fHistoTruePrimaryClusGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC);
2890  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2891  fHistoTruePrimaryClusConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2892  AliAODMCParticle *Mother = (AliAODMCParticle*) AODMCTrackArray->At(Photon->GetMother());
2893  fHistoTruePrimaryClusConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Mother->Pt(),fWeightJetJetMC);
2894  }
2895  }else {
2896  Int_t secondaryClass = -1;
2897  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion())
2898  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhotonAOD( Photon, AODMCTrackArray, kTRUE);
2899  else
2900  secondaryClass = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->SecondaryClassificationPhotonAOD( Photon, AODMCTrackArray, kFALSE);
2901  // all secondaries
2902  if (secondaryClass > 0 ){
2903  fHistoTrueSecondaryClusGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2904  }
2905  // secondaries from K0s
2906  if (secondaryClass == 2)
2907  fHistoTrueSecondaryClusGammaFromK0sPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2908  // secondaries from Lambda
2909  else if (secondaryClass == 3)
2910  fHistoTrueSecondaryClusGammaFromLambdaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2911  else if (secondaryClass == 5)
2912  fHistoTrueSecondaryClusGammaFromK0lPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2913  }
2914  }
2915 
2916  }else if (TruePhotonCandidate->IsLargestComponentElectron()) {
2917  if(!fDoLightOutput) fHistoTrueClusElectronPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2918  }else {
2919  if(!fDoLightOutput) fHistoTrueClusEMNonLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2920  }
2921 
2922  if(!fDoLightOutput) {
2923  if ( TruePhotonCandidate->IsLargestComponentPhoton() && !TruePhotonCandidate->IsPhotonWithElecMother() &&
2924  !TruePhotonCandidate->IsMerged() && !TruePhotonCandidate->IsMergedPartConv() && !TruePhotonCandidate->IsDalitzMerged() )
2925  fHistoTrueClusGammaEM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02, fWeightJetJetMC);
2926  }
2927  if (fDoClusterQA > 0){
2928  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion() && TruePhotonCandidate->IsConversionFullyContained())
2929  fHistoTrueClusConvGammaFullyPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2930  if (TruePhotonCandidate->IsMerged() || TruePhotonCandidate->IsMergedPartConv() || TruePhotonCandidate->IsDalitzMerged())
2931  fHistoTrueClusMergedGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2932  if (TruePhotonCandidate->IsMergedPartConv())
2933  fHistoTrueClusMergedPartConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2934  if (TruePhotonCandidate->IsDalitz())
2935  fHistoTrueClusDalitzPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2936  if (TruePhotonCandidate->IsDalitzMerged())
2937  fHistoTrueClusDalitzMergedPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2938  if (TruePhotonCandidate->IsPhotonWithElecMother())
2939  fHistoTrueClusPhotonFromElecMotherPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2940  if (TruePhotonCandidate->IsShower())
2941  fHistoTrueClusShowerPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2942  if (TruePhotonCandidate->IsSubLeadingEM())
2943  fHistoTrueClusSubLeadingPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2945 
2946  }
2947  Int_t motherLab = Photon->GetMother();
2948  if (motherLab > -1){
2949  if (TruePhotonCandidate->IsLargestComponentPhoton()){
2951  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)0,fWeightJetJetMC);
2953  }
2954  }
2955  if(!fDoLightOutput) {
2956  if ( TMath::Abs(((AliAODMCParticle*) AODMCTrackArray->At(motherLab))->GetPdgCode()) == 111 && TruePhotonCandidate->IsLargestComponentPhoton() && TruePhotonCandidate->IsMerged() && !TruePhotonCandidate->IsDalitzMerged() && !TruePhotonCandidate->IsMergedPartConv())
2957  fHistoTrueClusPi0EM02[fiCut]->Fill(TruePhotonCandidate->E(),clusM02, fWeightJetJetMC);
2958  }
2959  Int_t grandMotherLab = ((AliAODMCParticle*) AODMCTrackArray->At(motherLab))->GetMother();
2960  if (grandMotherLab > -1){
2961  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2963  fHistoDoubleCountTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),(Double_t)1,fWeightJetJetMC);
2965  }
2966  }
2967  }
2968  }
2969 
2970  }
2971 
2972  return;
2973 }
2974 
2975 //________________________________________________________________________
2977 {
2978  Int_t nV0 = 0;
2979  TList *GammaCandidatesStepOne = new TList();
2980  TList *GammaCandidatesStepTwo = new TList();
2981  // Loop over Photon Candidates allocated by ReaderV1
2982  for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
2983  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
2984  if(!PhotonCandidate) continue;
2985  fIsFromMBHeader = kTRUE;
2986  if(fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2987  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
2988  if(isPosFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
2989  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
2990  if(isNegFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
2991  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
2992  }
2993 
2994  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fInputEvent)) continue;
2995  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(PhotonCandidate->GetPhotonPhi(),fEventPlaneAngle)) continue;
2996  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
2997  !((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
2998  fGammaCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
2999 
3000  if(fIsFromMBHeader){
3001  if(!fDoLightOutput) fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
3002  if (fDoPhotonQA > 0){
3003  fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
3004  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
3005  }
3006  }
3007  if(fIsMC>0){
3008  if(fInputEvent->IsA()==AliESDEvent::Class())
3009  ProcessTruePhotonCandidates(PhotonCandidate);
3010  if(fInputEvent->IsA()==AliAODEvent::Class())
3011  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3012  }
3013  if (fIsFromMBHeader && fDoPhotonQA == 2){
3014  if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
3015  fPtGamma = PhotonCandidate->Pt();
3016  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
3017  fRConvPhoton = PhotonCandidate->GetConversionRadius();
3018  fEtaPhoton = PhotonCandidate->GetPhotonEta();
3019  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3020  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3021  }else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
3022  fPtGamma = PhotonCandidate->Pt();
3023  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
3024  fRConvPhoton = PhotonCandidate->GetConversionRadius();
3025  fEtaPhoton = PhotonCandidate->GetPhotonEta();
3026  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3027  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3028  }
3029  }
3030  }else if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
3031  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
3032  nV0++;
3033  GammaCandidatesStepOne->Add(PhotonCandidate);
3034  }else if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
3035  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
3036  GammaCandidatesStepTwo->Add(PhotonCandidate);
3037  }
3038  }
3039  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){
3040  for(Int_t i = 0;i<GammaCandidatesStepOne->GetEntries();i++){
3041  AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GammaCandidatesStepOne->At(i);
3042  if(!PhotonCandidate) continue;
3043  fIsFromMBHeader = kTRUE;
3044  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3045  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
3046  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
3047  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
3048  }
3049  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GammaCandidatesStepOne->GetEntries())) continue;
3050  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
3051  fGammaCandidates->Add(PhotonCandidate);
3052  if(fIsFromMBHeader){
3053  if(!fDoLightOutput) fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
3054  if (fDoPhotonQA > 0){
3055  fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
3056  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
3057  }
3058  }
3059  if(fIsMC>0){
3060  if(fInputEvent->IsA()==AliESDEvent::Class())
3061  ProcessTruePhotonCandidates(PhotonCandidate);
3062  if(fInputEvent->IsA()==AliAODEvent::Class())
3063  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3064  }
3065  if (fIsFromMBHeader && fDoPhotonQA == 2){
3066  if (fIsHeavyIon ==1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
3067  fPtGamma = PhotonCandidate->Pt();
3068  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
3069  fRConvPhoton = PhotonCandidate->GetConversionRadius();
3070  fEtaPhoton = PhotonCandidate->GetPhotonEta();
3071  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3072  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3073  }else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
3074  fPtGamma = PhotonCandidate->Pt();
3075  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
3076  fRConvPhoton = PhotonCandidate->GetConversionRadius();
3077  fEtaPhoton = PhotonCandidate->GetPhotonEta();
3078  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3079  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3080  }
3081  }
3082  } else GammaCandidatesStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
3083  }
3084  }
3085  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
3086  for(Int_t i = 0;i<GammaCandidatesStepTwo->GetEntries();i++){
3087  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GammaCandidatesStepTwo->At(i);
3088  if(!PhotonCandidate) continue;
3089  fIsFromMBHeader = kTRUE;
3090  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3091  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
3092  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
3093  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
3094  }
3095  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GammaCandidatesStepTwo,i)) continue;
3096  fGammaCandidates->Add(PhotonCandidate); // Add gamma to current cut TList
3097  if(fIsFromMBHeader){
3098  if(!fDoLightOutput) fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
3099  if (fDoPhotonQA > 0){
3100  fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
3101  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
3102  }
3103  }
3104  if(fIsMC>0){
3105  if(fInputEvent->IsA()==AliESDEvent::Class())
3106  ProcessTruePhotonCandidates(PhotonCandidate);
3107  if(fInputEvent->IsA()==AliAODEvent::Class())
3108  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
3109  }
3110  if (fIsFromMBHeader && fDoPhotonQA == 2){
3111  if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
3112  fPtGamma = PhotonCandidate->Pt();
3113  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
3114  fRConvPhoton = PhotonCandidate->GetConversionRadius();
3115  fEtaPhoton = PhotonCandidate->GetPhotonEta();
3116  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3117  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3118  }else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
3119  fPtGamma = PhotonCandidate->Pt();
3120  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
3121  fRConvPhoton = PhotonCandidate->GetConversionRadius();
3122  fEtaPhoton = PhotonCandidate->GetPhotonEta();
3123  fCharCatPhoton = PhotonCandidate->GetPhotonQuality();
3124  fTreeConvGammaPtDcazCat[fiCut]->Fill();
3125  }
3126  }
3127  }
3128  }
3129 
3130  delete GammaCandidatesStepOne;
3131  GammaCandidatesStepOne = 0x0;
3132  delete GammaCandidatesStepTwo;
3133  GammaCandidatesStepTwo = 0x0;
3134 
3135 }
3136 
3137 //________________________________________________________________________
3139 {
3140  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3141  Double_t mcProdVtxX = primVtxMC->GetX();
3142  Double_t mcProdVtxY = primVtxMC->GetY();
3143  Double_t mcProdVtxZ = primVtxMC->GetZ();
3144 
3145  Double_t magField = fInputEvent->GetMagneticField();
3146  if( magField < 0.0 ){
3147  magField = 1.0;
3148  }
3149  else {
3150  magField = -1.0;
3151  }
3152 
3153  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3154  if (AODMCTrackArray == NULL) return;
3155  AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
3156  AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
3157  fCharPhotonMCInfo = 0;
3158 
3159  if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
3160  Int_t pdgCode[2] = {TMath::Abs(posDaughter->GetPdgCode()),TMath::Abs(negDaughter->GetPdgCode())};
3161 
3162  if(posDaughter->GetMother() != negDaughter->GetMother()){
3163  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3164  fCharPhotonMCInfo = 1;
3165  return;
3166  }
3167  else if(posDaughter->GetMother() == -1){
3168  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3169  fCharPhotonMCInfo = 1;
3170  return;
3171  }
3172 
3173  if(pdgCode[0]!=11 || pdgCode[1]!=11){
3174  fCharPhotonMCInfo = 1;
3175  return; //One Particle is not a electron
3176  }
3177 
3178  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()){
3179  fCharPhotonMCInfo = 1;
3180  return; // Same Charge
3181  }
3182 
3183  AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
3184  if(Photon->GetPdgCode() != 22){
3185  fCharPhotonMCInfo = 1;
3186  return; // Mother is no Photon
3187  }
3188 
3189  if(((posDaughter->GetMCProcessCode())) != 5 || ((negDaughter->GetMCProcessCode())) != 5){
3190  fCharPhotonMCInfo = 1;
3191  return;// check if the daughters come from a conversion
3192  }
3193  // STILL A BUG IN ALIROOT >>8 HAS TPO BE REMOVED AFTER FIX
3194 
3195 
3196 
3197  // True Photon
3198  if(fIsFromMBHeader){
3199  if(!fDoLightOutput) fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3200  if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
3201  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueConvGammas,posDaughter->GetMother())){
3202  if(!fDoLightOutput) fHistoDoubleCountTrueConvGammaRPt[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3203  FillMultipleCountMap(fMapMultipleCountTrueConvGammas,posDaughter->GetMother());
3204  }
3205  }
3206 
3207  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3208  if(isPrimary){
3209  // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
3210  if(fIsFromMBHeader){
3211  fCharPhotonMCInfo = 6;
3212  if(!fDoLightOutput){
3213  fHistoTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3214  fHistoTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC); // Allways Filled
3215  }
3216  }
3217  // (Not Filled for i6, Extra Signal Gamma (parambox) are secondary)
3218  }else {
3219  if(fIsFromMBHeader){
3220 
3221  fCharPhotonMCInfo = 2;
3222  // check for secondaries from K0s
3223  if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3224  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 310){
3225  fCharPhotonMCInfo = 4;
3226  if(!fDoLightOutput){
3227  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3228  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3229  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3230  }
3231  // check for secondaries from K0l
3232  } else if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3233  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 130) {
3234  fCharPhotonMCInfo = 7;
3235  if(!fDoLightOutput){
3236  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3237  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),1.,fWeightJetJetMC);
3238  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3239  }
3240  // check for secondaries from Lambda
3241  } else if(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3242  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 3122){
3243  fCharPhotonMCInfo = 5;
3244  if(!fDoLightOutput){
3245  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3246  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3247  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3248  }
3249  } else if (((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother() > -1 &&
3250  ((AliAODMCParticle*)AODMCTrackArray->At(((AliAODMCParticle*)AODMCTrackArray->At(Photon->GetMother()))->GetMother()))->GetPdgCode() == 221) {
3251  fCharPhotonMCInfo = 3;
3252  if(!fDoLightOutput){
3253  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3254  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3255  }
3256  } else {
3257  if(!fDoLightOutput){
3258  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3259  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3260  }
3261  }
3262  }
3263  }
3264  TruePhotonCandidate->SetIsTrueConvertedPhoton();
3265 }
3266 
3267 //________________________________________________________________________
3269 {
3270  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3271  Double_t mcProdVtxX = primVtxMC->GetX();
3272  Double_t mcProdVtxY = primVtxMC->GetY();
3273  Double_t mcProdVtxZ = primVtxMC->GetZ();
3274 
3275  Double_t magField = fInputEvent->GetMagneticField();
3276  if( magField < 0.0 ){
3277  magField = 1.0;
3278  }
3279  else {
3280  magField = -1.0;
3281  }
3282 
3283  // Process True Photons
3284  TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCEvent);
3285  TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCEvent);
3286  fCharPhotonMCInfo = 0;
3287 
3288  if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
3289  Int_t pdgCode[2] = {TMath::Abs(posDaughter->GetPdgCode()),TMath::Abs(negDaughter->GetPdgCode())};
3290  fCharPhotonMCInfo = 1;
3291  if(posDaughter->GetMother(0) != negDaughter->GetMother(0)){
3292  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3293  return;
3294  }
3295  else if(posDaughter->GetMother(0) == -1){
3296  FillPhotonCombinatorialBackgroundHist(TruePhotonCandidate, pdgCode);
3297  return;
3298  }
3299 
3300  if(pdgCode[0]!=11 || pdgCode[1]!=11) return; //One Particle is not a electron
3301 
3302  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge
3303 
3304  TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCEvent);
3305 
3306  if(Photon->GetPdgCode() != 22){
3307  return; // Mother is no Photon
3308  }
3309 
3310  if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() !=5) return;// check if the daughters come from a conversion
3311 
3312  // True Photon
3313  if(fIsFromMBHeader){
3314  if(!fDoLightOutput) fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3315  if (fDoPhotonQA > 0) fHistoTrueConvGammaEta[fiCut]->Fill(TruePhotonCandidate->Eta());
3316  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueConvGammas,posDaughter->GetMother(0))){
3317  if(!fDoLightOutput) fHistoDoubleCountTrueConvGammaRPt[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3318  FillMultipleCountMap(fMapMultipleCountTrueConvGammas,posDaughter->GetMother(0));
3319  }
3320  }
3321  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, posDaughter->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3322  if(isPrimary){
3323  // Count just primary MC Gammas as true --> For Ratio esdtruegamma / mcconvgamma
3324  if(fIsFromMBHeader){
3325  fCharPhotonMCInfo = 6;
3326  if(!fDoLightOutput){
3327  fHistoTruePrimaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
3328  fHistoTruePrimaryConvGammaESDPtMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),Photon->Pt(),fWeightJetJetMC); // Allways Filled
3329  }
3330  }
3331  // (Not Filled for i6, Extra Signal Gamma (parambox) are secondary)
3332  }else {
3333  // fill secondary histograms
3334  if(fIsFromMBHeader){
3335  fCharPhotonMCInfo = 2;
3336  if( Photon->GetMother(0) > -1 && fMCEvent->Particle(Photon->GetMother(0))->GetMother(0) > -1){
3337  if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
3338  fCharPhotonMCInfo = 4;
3339  if (!fDoLightOutput){
3340  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),0.,fWeightJetJetMC);
3341  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),0.,fWeightJetJetMC);
3342  fHistoTrueSecondaryConvGammaFromXFromK0sMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3343  }
3344  } else if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 130) {
3345  fCharPhotonMCInfo = 7;
3346  if (!fDoLightOutput){
3347  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),1.,fWeightJetJetMC);
3348  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),1.,fWeightJetJetMC);
3349  fHistoTrueSecondaryConvGammaFromXFromK0lMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3350  }
3351  } else if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 3122) {
3352  fCharPhotonMCInfo = 5;
3353  if (!fDoLightOutput){
3354  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),2.,fWeightJetJetMC);
3355  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),2.,fWeightJetJetMC);
3356  fHistoTrueSecondaryConvGammaFromXFromLambdaMCPtESDPt[fiCut]->Fill(Photon->Pt(),TruePhotonCandidate->Pt(),fWeightJetJetMC);
3357  }
3358  } else if (fMCEvent->Particle(fMCEvent->Particle(Photon->GetMother(0))->GetMother(0))->GetPdgCode() == 221) {
3359  fCharPhotonMCInfo = 3;
3360  if (!fDoLightOutput){
3361  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3362  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3363  }
3364  } else {
3365  if (!fDoLightOutput){
3366  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3367  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3368  }
3369  }
3370  } else {
3371  if (!fDoLightOutput){
3372  fHistoTrueSecondaryConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),3.,fWeightJetJetMC);
3373  fHistoTrueSecondaryConvGammaMCPt[fiCut]->Fill(Photon->Pt(),3.,fWeightJetJetMC);
3374  }
3375  }
3376  }
3377  }
3378  TruePhotonCandidate->SetIsTrueConvertedPhoton();
3379  return;
3380 }
3381 //________________________________________________________________________
3383 {
3384  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3385  Double_t mcProdVtxX = primVtxMC->GetX();
3386  Double_t mcProdVtxY = primVtxMC->GetY();
3387  Double_t mcProdVtxZ = primVtxMC->GetZ();
3388 
3389  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3390  if (AODMCTrackArray == NULL) return;
3391 
3392  // Loop over all primary MC particle
3393  for(Long_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
3394 
3395  AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
3396  if (!particle) continue;
3397 
3398  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, particle, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3399  if (isPrimary) {
3400 
3401  Int_t isMCFromMBHeader = -1;
3402  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3403  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3404  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3405  }
3406 
3407  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
3408  if(!fDoLightOutput){
3409  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kFALSE)){
3410  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Gamma
3411  if (TMath::Abs(particle->Eta()) < 0.66 ){
3412  if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3413  }
3414  if(particle->GetMother() >-1){ // Meson Decay Gamma
3415  switch((static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother())))->GetPdgCode()){
3416  case 111: // Pi0
3417  fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3418  break;
3419  case 113: // Rho0
3420  fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3421  break;
3422  case 221: // Eta
3423  fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3424  break;
3425  case 223: // Omega
3426  fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3427  break;
3428  case 331: // Eta'
3429  fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3430  break;
3431  case 333: // Phi
3432  fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3433  break;
3434  case 3212: // Sigma
3435  fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3436  break;
3437  }
3438  }
3439  }
3440  }
3441  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kTRUE)){
3442  Double_t rConv = 0;
3443  for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){
3444  AliAODMCParticle *tmpDaughter = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(daughterIndex));
3445  if(!tmpDaughter) continue;
3446  if(TMath::Abs(tmpDaughter->GetPdgCode()) == 11){
3447  rConv = sqrt( (tmpDaughter->Xv()*tmpDaughter->Xv()) + (tmpDaughter->Yv()*tmpDaughter->Yv()) );
3448  }
3449  }
3450  if(!fDoLightOutput) fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3451  if (fDoPhotonQA > 0){
3452  fHistoMCConvGammaR[fiCut]->Fill(rConv);
3453  fHistoMCConvGammaEta[fiCut]->Fill(particle->Eta());
3454  }
3455  }
3456  // Converted MC Gamma
3457  if(fDoMesonAnalysis){
3458 
3459  Double_t mesonY = 10.;
3460  if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
3461  mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3462  }else {
3463  mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3464  }
3465 
3466  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
3467  if ( particle->GetPdgCode() == 211 ){ // positve pions
3468  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., fWeightJetJetMC);
3469  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
3470  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., fWeightJetJetMC);
3471  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
3472  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., fWeightJetJetMC);
3473  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
3474  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., fWeightJetJetMC);
3475  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
3476  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., fWeightJetJetMC);
3477  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
3478  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., fWeightJetJetMC);
3479  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
3480  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., fWeightJetJetMC);
3481  }
3482  }
3483 
3484  // check neutral mesons
3486  ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3487  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
3488  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
3489  Float_t weighted= 1;
3490  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
3491  if (particle->Pt()>0.005){
3492  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, 0x0, fInputEvent);
3493  // if(particle->GetPdgCode() == 221){
3494  // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
3495  // }
3496  }
3497  }
3498  Double_t mesonY = 10.;
3499  if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
3500  mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3501  }else{
3502  mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3503  }
3504 
3505  Double_t alpha = -10;
3506  if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
3507  alpha = (daughter0->E() - daughter1->E())/(daughter0->E() + daughter1->E());
3508  }
3509 
3510 
3511  if(particle->GetPdgCode() == 111){
3512  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Pi0
3513  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3514  if (!fDoLightOutput){
3515  // fill pi0 hists against gamma pt of first leg
3516  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,weighted*fWeightJetJetMC);
3517  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,fWeightJetJetMC);
3518  // fill pi0 hists against gamma pt of second leg
3519  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,weighted*fWeightJetJetMC);
3520  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,fWeightJetJetMC);
3521  // fill pi0 hists against gamma pt of both legs
3522  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,weighted*fWeightJetJetMC);
3523  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,fWeightJetJetMC);
3524  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,weighted*fWeightJetJetMC);
3525  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,fWeightJetJetMC);
3526  }
3527 
3528  if (fIsMC > 1) fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
3529  if (fDoMesonQA > 0){
3530  fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC);
3531  fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC);
3532  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3533  }
3534  }else if(particle->GetPdgCode() == 221){
3535  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Eta
3536  fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3537  if (fIsMC > 1) fHistoMCEtaWOEvtWeightPt[fiCut]->Fill(particle->Pt());
3538  if (fDoMesonQA > 0){
3539  fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC);
3540  fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC);
3541  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3542  }
3543  }
3544 
3545  // Check the acceptance for both gammas
3546  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter0,AODMCTrackArray,kFALSE) &&
3547  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter1,AODMCTrackArray,kFALSE) &&
3548  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
3549  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
3550  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
3551  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) ||
3552  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
3553  if(particle->GetPdgCode() == 111){
3554  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Pi0 with gamma in acc
3555  fHistoMCPi0WOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Pi0 with gamma in acc wo weight
3556  if(fIsMC > 1) fHistoMCPi0WOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 with gamma in acc wo any weight
3557  if (!fDoLightOutput){
3558  // fill pi0 hists against gamma pt of first leg
3559  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,weighted*fWeightJetJetMC);
3560  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,fWeightJetJetMC);
3561  // fill pi0 hists against gamma pt of second leg
3562  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,weighted*fWeightJetJetMC);
3563  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,fWeightJetJetMC);
3564  // fill pi0 hists against gamma pt of both legs
3565  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,weighted*fWeightJetJetMC);
3566  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,fWeightJetJetMC);
3567  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,weighted*fWeightJetJetMC);
3568  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,fWeightJetJetMC);
3569  }
3570  }else if(particle->GetPdgCode() == 221){
3571  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Eta with gamma in acc
3572  fHistoMCEtaWOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Eta with gamma in acc wo weight
3573  if(fIsMC > 1) fHistoMCEtaWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta with gamma in acc wo any weight
3574  }
3575  }
3576  }
3577  }
3578  }
3579  } else {
3580  // fill secondary histograms
3581  Int_t isMCFromMBHeader = -1;
3582  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3583  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3584  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3585  }
3586  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) {
3587  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kFALSE)){
3588  if (particle->GetMother() > -1) {
3589  AliAODMCParticle *tmpMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3590  if (tmpMother->GetMother() > -1) {
3591  AliAODMCParticle *tmpGrandMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(tmpMother->GetMother()));
3592  if(tmpGrandMother->GetPdgCode() == 310) {
3593  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightJetJetMC);
3594  } else if (tmpGrandMother->GetPdgCode() == 130) {
3595  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightJetJetMC);
3596  } else if (tmpGrandMother->GetPdgCode() == 3122) {
3597  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightJetJetMC);
3598  } else {
3599  if ( !(TMath::Abs(tmpMother->GetPdgCode()) == 11 && tmpGrandMother->GetPdgCode() == 22) )
3600  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3601  }
3602  } else {
3603  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3604  }
3605  } else {
3606  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3607  }
3608  }
3609 
3610  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kTRUE)){
3611  if (particle->GetMother() > -1) {
3612  AliAODMCParticle *tmpMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3613  if (tmpMother->GetMother() > -1) {
3614  AliAODMCParticle *tmpGrandMother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(tmpMother->GetMother()));
3615  if(tmpGrandMother->GetPdgCode() == 310) {
3616  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightJetJetMC);
3617  } else if (tmpGrandMother->GetPdgCode() == 130) {
3618  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightJetJetMC);
3619  } else if (tmpGrandMother->GetPdgCode() == 3122) {
3620  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightJetJetMC);
3621  } else {
3622  if ( !(TMath::Abs(tmpMother->GetPdgCode()) == 11 && tmpGrandMother->GetPdgCode() == 22) )
3623  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3624  }
3625  } else {
3626  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3627  }
3628  } else {
3629  if (!fDoLightOutput) fHistoMCSecondaryConvGammaPt[fiCut]->Fill(particle->Pt(),3.,fWeightJetJetMC);
3630  }
3631  }
3632  }
3633 
3634  if(fDoMesonAnalysis){
3635  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3636  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
3637  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
3638  AliAODMCParticle* mother = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetMother()));
3639  Int_t pdgCode = mother->GetPdgCode();
3640  if(particle->GetPdgCode() == 111){
3641  Int_t source = GetSourceClassification(111,pdgCode);
3642  fHistoMCSecPi0PtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC); // All MC Pi0
3643  if (!fDoLightOutput){
3644  fHistoMCSecPi0PtGamma1vsSource[fiCut]->Fill(daughter0->Pt(),source,fWeightJetJetMC); // All MC Pi0
3645  fHistoMCSecPi0PtGamma2vsSource[fiCut]->Fill(daughter1->Pt(),source,fWeightJetJetMC); // All MC Pi0
3646  }
3647  fHistoMCSecPi0Source[fiCut]->Fill(pdgCode);
3648  }else if(particle->GetPdgCode() == 221){
3649 
3650  fHistoMCSecEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Pi0
3651  fHistoMCSecEtaSource[fiCut]->Fill(pdgCode);
3652  }
3653 
3654  // check if conversion where within acceptance
3655  if( ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter0,AODMCTrackArray,kFALSE) &&
3656  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter1,AODMCTrackArray,kFALSE) &&
3657  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
3658  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
3659  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
3660  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) ||
3661  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
3662  if (particle->GetPdgCode() == 111){
3663  Int_t source = GetSourceClassification(111,pdgCode);
3664  fHistoMCSecPi0InAccPtvsSource[fiCut]->Fill(particle->Pt(),source,fWeightJetJetMC); // All MC Pi0
3665  if (!fDoLightOutput){
3666  fHistoMCSecPi0InAccPtGamma1vsSource[fiCut]->Fill(daughter0->Pt(),source,fWeightJetJetMC); // All MC Pi0
3667  fHistoMCSecPi0InAccPtGamma2vsSource[fiCut]->Fill(daughter1->Pt(),source,fWeightJetJetMC); // All MC Pi0
3668  }
3669  }
3670  }
3671  }
3672  }
3673  }
3674  }
3675  }
3676 }
3677 
3678 //________________________________________________________________________
3680 {
3681  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3682  Double_t mcProdVtxX = primVtxMC->GetX();
3683  Double_t mcProdVtxY = primVtxMC->GetY();
3684  Double_t mcProdVtxZ = primVtxMC->GetZ();
3685 // cout << mcProdVtxX <<"\t" << mcProdVtxY << "\t" << mcProdVtxZ << endl;
3686 
3687  // Loop over all primary MC particle
3688  for(Long_t i = 0; i < fMCEvent->GetNumberOfTracks(); i++) {
3689  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
3690  // fill primary histograms
3691  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
3692  if (!particle) continue;
3693 
3694  Int_t isMCFromMBHeader = -1;
3695  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3696  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3697  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3698  }
3699 
3700  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
3701  if(!fDoLightOutput){
3702  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kFALSE)){
3703  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Gamma
3704  if (TMath::Abs(particle->Eta()) < 0.66 ){
3705  if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3706  }
3707 
3708  if(particle->GetMother(0) >-1){ // Meson Decay Gamma
3709  switch(fMCEvent->Particle(particle->GetMother(0))->GetPdgCode()){
3710  case 111: // Pi0
3711  fHistoMCDecayGammaPi0Pt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3712  break;
3713  case 113: // Rho0
3714  fHistoMCDecayGammaRhoPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3715  break;
3716  case 221: // Eta
3717  fHistoMCDecayGammaEtaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3718  break;
3719  case 223: // Omega
3720  fHistoMCDecayGammaOmegaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3721  break;
3722  case 331: // Eta'
3723  fHistoMCDecayGammaEtapPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3724  break;
3725  case 333: // Phi
3726  fHistoMCDecayGammaPhiPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3727  break;
3728  case 3212: // Sigma
3729  fHistoMCDecayGammaSigmaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3730  break;
3731  }
3732  }
3733  }
3734  }
3735  // Converted MC Gamma
3736  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kTRUE)){
3737  if(!fDoLightOutput) fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3738  if (fDoPhotonQA > 0){
3739  if(particle->GetFirstDaughter()>-1) fHistoMCConvGammaR[fiCut]->Fill(((TParticle*)fMCEvent->Particle(particle->GetFirstDaughter()))->R());
3740  fHistoMCConvGammaEta[fiCut]->Fill(particle->Eta());
3741  }
3742  }
3743 
3744 
3745  if(fDoMesonAnalysis ){
3746 
3747  // Fill histograms for other particles
3748  Double_t mesonY = 10.;
3749  if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
3750  mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3751  }else{
3752  mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3753  }
3754 
3755  if (TMath::Abs(mesonY) < ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetRapidityCutValue()){
3756  if ( particle->GetPdgCode() == 211 ){ // positve pions
3757  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 0., fWeightJetJetMC);
3758  } else if ( particle->GetPdgCode() == -211 ){ // negative pions
3759  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 1., fWeightJetJetMC);
3760  } else if ( particle->GetPdgCode() == 321 ){ // positve kaons
3761  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 2., fWeightJetJetMC);
3762  } else if ( particle->GetPdgCode() == -321 ){ // negative kaons
3763  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 3., fWeightJetJetMC);
3764  } else if ( TMath::Abs(particle->GetPdgCode()) == 310 ){ // K0s
3765  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 4., fWeightJetJetMC);
3766  } else if ( TMath::Abs(particle->GetPdgCode()) == 130 ){ // K0l
3767  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 5., fWeightJetJetMC);
3768  } else if ( TMath::Abs(particle->GetPdgCode()) == 3122 ){ // Lambda/ AntiLambda
3769  fHistoMCPrimaryPtvsSource[fiCut]->Fill(particle->Pt(), 6., fWeightJetJetMC);
3770  }
3771  }
3772 
3773  // check neutral mesons
3775  ->MesonIsSelectedMC(particle,fMCEvent,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3776  TParticle* daughter0 = (TParticle*)fMCEvent->Particle(particle->GetFirstDaughter());
3777  TParticle* daughter1 = (TParticle*)fMCEvent->Particle(particle->GetLastDaughter());
3778 
3779  Float_t weighted= 1;
3780  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
3781  if (particle->Pt()>0.005){
3782  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent, fInputEvent);
3783  }
3784  }
3785  Double_t mesonY = 10.;
3786  if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
3787  mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3788  }else{
3789  mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
3790  }
3791 
3792  Double_t alpha = -10;
3793  if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
3794  alpha = (daughter0->Energy() - daughter1->Energy())/(daughter0->Energy() + daughter1->Energy());
3795  }
3796 
3797  if(particle->GetPdgCode() == 111){
3798  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Pi0
3799  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3800  if (!fDoLightOutput){
3801  // fill pi0 hists against gamma pt of first leg
3802  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,weighted*fWeightJetJetMC);
3803  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,fWeightJetJetMC);
3804  // fill pi0 hists against gamma pt of second leg
3805  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,weighted*fWeightJetJetMC);
3806  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,fWeightJetJetMC);
3807  // fill pi0 hists against gamma pt of both legs
3808  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,weighted*fWeightJetJetMC);
3809  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,fWeightJetJetMC);
3810  fHistoMCPi0PtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,weighted*fWeightJetJetMC);
3811  fHistoMCPi0WOWeightPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,fWeightJetJetMC);
3812  }
3813 
3814  if (fIsMC > 1) fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
3815  if (fDoMesonQA > 0){
3816  fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC); // All MC Pi0
3817  fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC); // All MC Pi0
3818  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3819  }
3820  }else if(particle->GetPdgCode() == 221){
3821  fHistoMCEtaPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Eta
3822  fHistoMCEtaWOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
3823  if (fIsMC > 1) fHistoMCEtaWOEvtWeightPt[fiCut]->Fill(particle->Pt());
3824  if (fDoMesonQA > 0){
3825  fHistoMCEtaPtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC); // All MC Pi0
3826  fHistoMCEtaPtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC); // All MC Pi0
3827  if (fIsMC == 2) fHistoMCEtaPtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
3828  }
3829  }
3830 
3831  // Check the acceptance for both gammas & whether they are counted as primaries as well
3832  Bool_t kDaughter0IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, particle->GetFirstDaughter(), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3833  Bool_t kDaughter1IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, particle->GetLastDaughter(), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3834 
3835  if( kDaughter0IsPrim && kDaughter1IsPrim &&
3836  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter0,fMCEvent,kFALSE) &&
3837  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter1,fMCEvent,kFALSE) &&
3838  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
3839  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
3840  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
3841  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCEvent) ||
3842  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCEvent) ){
3843  if(particle->GetPdgCode() == 111){
3844  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Pi0 with gamma in acc
3845  fHistoMCPi0WOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Pi0 with gamma in acc wo weighting
3846  if(fIsMC > 1) fHistoMCPi0WOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Pi0 with gamma in acc wo any weight
3847  if (!fDoLightOutput){
3848  // fill pi0 hists against gamma pt of first leg
3849  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,weighted*fWeightJetJetMC);
3850  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),0.,fWeightJetJetMC);
3851  // fill pi0 hists against gamma pt of second leg
3852  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,weighted*fWeightJetJetMC);
3853  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),1.,fWeightJetJetMC);
3854  // fill pi0 hists against gamma pt of both legs
3855  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,weighted*fWeightJetJetMC);
3856  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter0->Pt(),2.,fWeightJetJetMC);
3857  fHistoMCPi0InAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,weighted*fWeightJetJetMC);
3858  fHistoMCPi0WOWeightInAccPtGammaLeg[fiCut]->Fill(daughter1->Pt(),2.,fWeightJetJetMC);
3859  }
3860  }else if(particle->GetPdgCode() == 221){
3861  fHistoMCEtaInAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Eta with gamma in acc
3862  fHistoMCEtaWOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Eta with gamma in acc wo weighting
3863  if(fIsMC > 1) fHistoMCEtaWOEvtWeightInAccPt[fiCut]->Fill(particle->Pt()); // MC Eta with gamma in acc wo any weight
3864  }
3865  }
3866  }
3867  }
3868  }
3869  // fill secondary histograms
3870  } else {
3871  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
3872  if (!particle) continue;
3873  Int_t isMCFromMBHeader = -1;
3874  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
3875  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
3876  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
3877  }
3878 
3879  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)){
3880  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kFALSE)){
3881  if (particle->GetMother(0) > -1 && fMCEvent->Particle(particle->GetMother(0))->GetMother(0) > -1) {
3882  if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 310){
3883  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),0.,fWeightJetJetMC);
3884  } else if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 130) {
3885  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),1.,fWeightJetJetMC);
3886  } else if (fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 3122) {
3887  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),2.,fWeightJetJetMC);
3888  } else {
3889  if ( !(TMath::Abs(fMCEvent->Particle(particle->GetMother(0))->GetPdgCode()) == 11 && fMCEvent->Particle(fMCEvent->Particle(particle->GetMother(0))->GetMother(0))->GetPdgCode() == 22) )
3890  if (!fDoLightOutput) fHistoMCAllSecondaryGammaPt[fiCut]->Fill(particle->Pt(),3.,