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