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