AliPhysics  master (3d17d9d)
AliAnalysisTaskNeutralMesonToPiPlPiMiNeutralMeson.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: Friederike Bock *
5  * Version 1 *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 //
17 
18 #include <memory>
19 #include <vector>
20 #include "TParticle.h"
21 #include "TPDGCode.h"
22 #include "TMCProcess.h"
23 #include "TDatabasePDG.h"
24 #include "TList.h"
25 #include "TChain.h"
26 #include "TDirectory.h"
27 #include "TTree.h"
28 #include "TH1.h"
29 #include "TH1F.h"
30 #include "THnSparse.h"
31 #include "TH2F.h"
32 #include "AliAnalysisManager.h"
33 #include "AliESDInputHandler.h"
34 #include "AliESDtrack.h"
35 #include "AliMCEvent.h"
36 #include "AliMCEventHandler.h"
37 #include "AliPID.h"
38 #include "AliLog.h"
39 #include "AliESDtrackCuts.h"
40 #include "AliESDpidCuts.h"
41 #include "AliMCEvent.h"
42 #include "AliESDv0.h"
43 #include "AliESDEvent.h"
44 #include "AliESDpid.h"
45 #include "AliKFParticle.h"
46 #include "AliMCEventHandler.h"
47 #include "AliKFVertex.h"
48 #include "AliTriggerAnalysis.h"
49 #include "AliCentrality.h"
50 #include "AliMultiplicity.h"
51 #include "AliAODEvent.h"
53 #include "AliCaloTrackMatcher.h"
54 #include <vector>
55 
57 
58 //-----------------------------------------------------------------------------------------------
60  fV0Reader(nullptr),
61  fV0ReaderName("V0ReaderV1"),
62  fPionSelector(NULL),
63  fBGHandlerPiPl(NULL),
64  fBGHandlerPiMi(NULL),
65  fInputEvent(NULL),
66  fMCEvent(NULL),
67  fCutFolder(NULL),
68  fESDList(NULL),
69  fTrueList(NULL),
70  fTrueTreeList(NULL),
71  fMCList(NULL),
72  fOutputContainer(0),
73  fReaderGammas(nullptr),
74  fSelectorNegPionIndex(0),
75  fSelectorPosPionIndex(0),
76  fGoodConvGammas(nullptr),
77  fClusterCandidates(nullptr),
78  fNeutralDecayParticleCandidates(nullptr),
79  fNeutralDecayParticleSidebandCandidates(nullptr),
80  fPosPionCandidates(nullptr),
81  fNegPionCandidates(nullptr),
82  fEventCutArray(nullptr),
83  fGammaCutArray(nullptr),
84  fClusterCutArray(nullptr),
85  fPionCutArray(nullptr),
86  fNeutralDecayMesonCutArray(nullptr),
87  fMesonCutArray(nullptr),
88  fEventCuts(nullptr),
89  fConversionCuts(nullptr),
90  fClusterCuts(nullptr),
91  fOutlierJetReader(nullptr),
92  fTreePiPiSameMother(nullptr),
93  fTreePiPiPiSameMother(nullptr),
94  fTreeEventInfoHNM(nullptr),
95  fCasePiPi(-1),
96  fSamePiPiMotherID(-1),
97  fSamePiPiMotherInvMass(-1),
98  fSamePiPiMotherPt(-1),
99  fSamePiPiPiMotherID(-1),
100  fSamePiPiPiMotherInvMass(-1),
101  fSamePiPiPiMotherPt(-1),
102  fV0MultiplicityHNMEvent(-1),
103  fTrackMultiplicityHNMEvent(-1),
104  fZVertexHNMEvent(-1),
105  fPtHNM(-1),
106  fPDGMassNDM(-1),
107  fNDMMinPtPossible(0.),
108  fPDGMassChargedPion(-1),
109  fPDGCodeNDM(-1),
110  fPDGCodeAnalyzedMeson(-1),
111  fHistoConvGammaPt(nullptr),
112  fHistoConvGammaEta(nullptr),
113  fHistoClusterGammaPt(nullptr),
114  fHistoClusterGammaEta(nullptr),
115  fHistoClusterGammaE(nullptr),
116  fHistoNegPionPt(nullptr),
117  fHistoPosPionPt(nullptr),
118  fHistoNegPionPhi(nullptr),
119  fHistoPosPionPhi(nullptr),
120  fHistoNegPionEta(nullptr),
121  fHistoPosPionEta(nullptr),
122  fHistoNegPionClsTPC(nullptr),
123  fHistoPosPionClsTPC(nullptr),
124  fHistoPionDCAxy(nullptr),
125  fHistoPionDCAz(nullptr),
126  fHistoPionTPCdEdxNSigma(nullptr),
127  fHistoPionTPCdEdx(nullptr),
128  fHistoPionPionInvMassPt(nullptr),
129  fHistoGammaGammaInvMassPt(nullptr),
130  fHistoGammaGammaInvMassPtBeforeCuts(nullptr),
131  fHistoMotherInvMassPt(nullptr),
132  fHistoMotherInvMassPtRejectedKinematic(nullptr),
133  fHistoDalitzPlotPosFixedPzNDM(nullptr),
134  fHistoDalitzPlotNegFixedPzNDM(nullptr),
135  fHistoDalitzPlotPosSubNDM(nullptr),
136  fHistoDalitzPlotNegSubNDM(nullptr),
137  fHistoBackInvMassPt(nullptr),
138  fHistoMotherLikeSignBackInvMassPt(nullptr),
139  fHistoAngleHNMesonPiPlPiMi(nullptr),
140  fHistoAngleHNMesonNDM(nullptr),
141  fHistoAngleHNMesonPiPl(nullptr),
142  fHistoAngleHNMesonPiMi(nullptr),
143  fHistoAnglePiPlPiMi(nullptr),
144  fHistoAngleNDMPiMi(nullptr),
145  fHistoAnglePiPlNDM(nullptr),
146  fHistoAngleSum(nullptr),
147  fHistoTrueAngleSum(nullptr),
148  fHistoTrueHNMesonPtvsNDMPt(nullptr),
149  fHistoMotherInvMassSubNDM(nullptr),
150  fHistoBackInvMassPtSubNDM(nullptr),
151  fHistoMotherLikeSignBackInvMassSubNDMPt(nullptr),
152  fHistoMotherInvMassFixedPzNDM(nullptr),
153  fHistoBackInvMassPtFixedPzNDM(nullptr),
154  fHistoMotherLikeSignBackInvMassFixedPzNDMPt(nullptr),
155  fHistoMCAllGammaPt(nullptr),
156  fHistoMCConvGammaPt(nullptr),
157  fHistoMCAllMesonPt(nullptr),
158  fHistoMCAllMesonEta(nullptr),
159  fHistoMCAllMesonPhi(nullptr),
160  fHistoMCMesonFromNeutralMesonPt(nullptr),
161  fHistoMCMesonFromNeutralMesonEta(nullptr),
162  fHistoMCMesonFromNeutralMesonPhi(nullptr),
163  fHistoMCAllPosPionsPt(nullptr),
164  fHistoMCAllPosPionsEta(nullptr),
165  fHistoMCAllPosPionsPhi(nullptr),
166  fHistoMCAllNegPionsPt(nullptr),
167  fHistoMCAllNegPionsEta(nullptr),
168  fHistoMCAllNegPionsPhi(nullptr),
169  fHistoMCGammaFromNeutralMesonPt(nullptr),
170  fHistoMCPosPionsFromNeutralMesonPt(nullptr),
171  fHistoMCPosPionsFromNeutralMesonEta(nullptr),
172  fHistoMCPosPionsFromNeutralMesonPhi(nullptr),
173  fHistoMCNegPionsFromNeutralMesonPt(nullptr),
174  fHistoMCNegPionsFromNeutralMesonEta(nullptr),
175  fHistoMCNegPionsFromNeutralMesonPhi(nullptr),
176  fHistoMCHNMPiPlPiMiNDMPt(nullptr),
177  fHistoMCHNMPiPlPiMiNDMEta(nullptr),
178  fHistoMCHNMPiPlPiMiNDMPhi(nullptr),
179  fHistoMCHNMPiPlPiMiNDMInAccPt(nullptr),
180  fHistoMCHNMInAccVsNDMPt(nullptr),
181  fHistoMCHeavyAllPt(nullptr),
182  fHistoMCHeavyAllEta(nullptr),
183  fHistoMCHeavyAllPhi(nullptr),
184  fHistoMCHeavyChannelPt(nullptr),
185  fHistoMCHeavyChannelEta(nullptr),
186  fHistoMCHeavyChannelPhi(nullptr),
187  fHistMCChannelNDMFromHeavyPt(nullptr),
188  fHistMCChannelNDMFromHeavyEta(nullptr),
189  fHistMCChannelNDMFromHeavyPhi(nullptr),
190  fHistMCChannelPiPlusFromHeavyPt(nullptr),
191  fHistMCChannelPiPlusFromHeavyEta(nullptr),
192  fHistMCChannelPiPlusFromHeavyPhi(nullptr),
193  fHistMCChannelPiMinusFromHeavyPt(nullptr),
194  fHistMCChannelPiMinusFromHeavyEta(nullptr),
195  fHistMCChannelPiPMinusFromHeavyPhi(nullptr),
196  fHistMCChannelNDMPtHeavyPt(nullptr),
197  fHistMCChannelPiPlusPtHeavyPt(nullptr),
198  fHistMCChannelPiMinusPtHeavyPt(nullptr),
199  fHistoMCHeavyReconstructiblePt(nullptr),
200  fHistoMCHeavyReconstructibleEta(nullptr),
201  fHistoMCHeavyReconstructiblePhi(nullptr),
202  fHistMCReconstructibleNDMFromHeavyPt(nullptr),
203  fHistMCReconstructibleNDMFromHeavyEta(nullptr),
204  fHistMCReconstructibleNDMFromHeavyPhi(nullptr),
205  fHistMCReconstructiblePiPlusFromHeavyPt(nullptr),
206  fHistMCReconstructiblePiPlusFromHeavyEta(nullptr),
207  fHistMCReconstructiblePiPlusFromHeavyPhi(nullptr),
208  fHistMCReconstructiblePiMinusFromHeavyPt(nullptr),
209  fHistMCReconstructiblePiMinusFromHeavyEta(nullptr),
210  fHistMCReconstructiblePiPMinusFromHeavyPhi(nullptr),
211  fHistMCReconstructibleNDMPtHeavyPt(nullptr),
212  fHistMCReconstructiblePiPlusPtHeavyPt(nullptr),
213  fHistMCReconstructiblePiMinusPtHeavyPt(nullptr),
214  fHistoTrueMotherPiPlPiMiNDMInvMassPt(nullptr),
215  fHistoTrueMotherPiPlPiMiNDMInvMassPtSubNDM(nullptr),
216  fHistoTrueMotherPiPlPiMiNDMInvMassPtFixedPzNDM(nullptr),
217  fHistoTrueMotherPiPlPiMiNDMDalitzPlotPosFixedPzNDM(nullptr),
218  fHistoTrueMotherPiPlPiMiNDMDalitzPlotNegFixedPzNDM(nullptr),
219  fHistoTrueMotherPiPlPiMiNDMDalitzPlotPosSubNDM(nullptr),
220  fHistoTrueMotherPiPlPiMiNDMDalitzPlotNegSubNDM(nullptr),
221  fHistoTrueMotherGammaGammaInvMassPt(nullptr),
222  fHistoTrueMotherGammaGammaFromHNMInvMassPt(nullptr),
223  fHistoTrueConvGammaPt(nullptr),
224  fHistoTrueConvGammaFromNeutralMesonPt(nullptr),
225  fHistoTrueClusterGammaPt(nullptr),
226  fHistoTrueClusterGammaFromNeutralMesonPt(nullptr),
227  fHistoTruePosPionPt(nullptr),
228  fHistoTruePosPionFromNeutralMesonPt(nullptr),
229  fHistoTrueNegPionPt(nullptr),
230  fHistoTrueNegPionFromNeutralMesonPt(nullptr),
231  fHistoTruePionPionInvMassPt(nullptr),
232  fHistoTruePionPionFromSameMotherInvMassPt(nullptr),
233  fHistoTruePionPionFromHNMInvMassPt(nullptr),
234  fHistoTruePiPlPiMiSameMotherFromEtaInvMassPt(nullptr),
235  fHistoTruePiPlPiMiSameMotherFromOmegaInvMassPt(nullptr),
236  fHistoTruePiPlPiMiSameMotherFromRhoInvMassPt(nullptr),
237  fHistoTruePiPlPiMiSameMotherFromEtaPrimeInvMassPt(nullptr),
238  fHistoTruePiPlPiMiSameMotherFromK0sInvMassPt(nullptr),
239  fHistoTruePiPlPiMiSameMotherFromK0lInvMassPt(nullptr),
240  fHistoTruePiMiPiZeroSameMotherFromEtaInvMassPt(nullptr),
241  fHistoTruePiMiPiZeroSameMotherFromOmegaInvMassPt(nullptr),
242  fHistoTruePiMiPiZeroSameMotherFromRhoInvMassPt(nullptr),
243  fHistoTruePiMiPiZeroSameMotherFromK0lInvMassPt(nullptr),
244  fHistoTruePiPlPiZeroSameMotherFromEtaInvMassPt(nullptr),
245  fHistoTruePiPlPiZeroSameMotherFromOmegaInvMassPt(nullptr),
246  fHistoTruePiPlPiZeroSameMotherFromRhoInvMassPt(nullptr),
247  fHistoTruePiPlPiZeroSameMotherFromK0lInvMassPt(nullptr),
248  fHistoTruePiPlPiMiNDMPureCombinatoricalInvMassPt(nullptr),
249  fHistoTruePiPlPiMiNDMContaminationInvMassPt(nullptr),
250  fHistoDoubleCountTruePi0InvMassPt(nullptr),
251  fHistoDoubleCountTrueHNMInvMassPt(nullptr),
252  fHistoDoubleCountTrueConvGammaRPt(nullptr),
253  fVectorDoubleCountTruePi0s(0),
254  fVectorDoubleCountTrueHNMs(0),
255  fVectorDoubleCountTrueConvGammas(0),
256  fHistoNEvents(nullptr),
257  fHistoNEventsWOWeight(nullptr),
258  fProfileJetJetXSection(nullptr),
259  fHistoJetJetNTrials(nullptr),
260  fHistoNGoodESDTracks(nullptr),
261  fProfileEtaShift(nullptr),
262  fHistoSPDClusterTrackletBackground(nullptr),
263  fHistovParticleChi2PerNDF(nullptr),
264  fHistovParticleChi2PerNDFBothConstrained(nullptr),
265  fHistovParticleChi2PerNDFOneConstrained(nullptr),
266  fHistovParticledS(nullptr),
267  fHistovParticledSBothConstrained(nullptr),
268  fHistovParticledSOneConstrained(nullptr),
269  fHistoTruevParticleChi2PerNDF(nullptr),
270  fHistoTruevParticleFromSameMotherChi2PerNDF(nullptr),
271  fHistoTruevParticleFromHNMChi2PerNDF(nullptr),
272  fHistoTruevParticledS(nullptr),
273  fHistoTruevParticleFromSameMotherdS(nullptr),
274  fHistoTruevParticleFromHNMdS(nullptr),
275  fRandom(0),
276  fnCuts(0),
277  fiCut(0),
278  fNumberOfESDTracks(0),
279  fMoveParticleAccordingToVertex(kFALSE),
280  fIsHeavyIon(0),
281  fDoMesonAnalysis(kTRUE),
282  fDoMesonQA(0),
283  fIsFromMBHeader(kTRUE),
284  fIsFromDesiredHeader(kTRUE),
285  fIsOverlappingWithOtherHeader(kFALSE),
286  fAllowOverlapHeaders(kTRUE),
287  fIsMC(kFALSE),
288  fSelectedHeavyNeutralMeson(kFALSE),
289  fDoLightOutput(kFALSE),
290  fNDMRecoMode(0),
291  fTolerance(-1),
292  fWeightJetJetMC(1.),
293  fTrackMatcherRunningMode(0),
294  fMCEventPos(),
295  fMCEventNeg(),
296  fESDArrayPos(),
297  fESDArrayNeg()
298 {
299 
300 }
301 
302 //-----------------------------------------------------------------------------------------------
304  AliAnalysisTaskSE(name),
305  fV0Reader(nullptr),
306  fV0ReaderName("V0ReaderV1"),
307  fPionSelector(NULL),
308  fBGHandlerPiPl(NULL),
309  fBGHandlerPiMi(NULL),
310  fInputEvent(NULL),
311  fMCEvent(NULL),
312  fCutFolder(NULL),
313  fESDList(NULL),
314  fTrueList(NULL),
315  fTrueTreeList(NULL),
316  fMCList(NULL),
317  fOutputContainer(0),
318  fReaderGammas(nullptr),
319  fSelectorNegPionIndex(0),
320  fSelectorPosPionIndex(0),
321  fGoodConvGammas(nullptr),
322  fClusterCandidates(nullptr),
323  fNeutralDecayParticleCandidates(nullptr),
324  fNeutralDecayParticleSidebandCandidates(nullptr),
325  fPosPionCandidates(nullptr),
326  fNegPionCandidates(nullptr),
327  fEventCutArray(nullptr),
328  fGammaCutArray(nullptr),
329  fClusterCutArray(nullptr),
330  fPionCutArray(nullptr),
331  fNeutralDecayMesonCutArray(nullptr),
332  fMesonCutArray(nullptr),
333  fEventCuts(nullptr),
334  fConversionCuts(nullptr),
335  fClusterCuts(nullptr),
336  fOutlierJetReader(nullptr),
337  fTreePiPiSameMother(nullptr),
338  fTreePiPiPiSameMother(nullptr),
339  fTreeEventInfoHNM(nullptr),
340  fCasePiPi(-1),
341  fSamePiPiMotherID(-1),
342  fSamePiPiMotherInvMass(-1),
343  fSamePiPiMotherPt(-1),
344  fSamePiPiPiMotherID(-1),
345  fSamePiPiPiMotherInvMass(-1),
346  fSamePiPiPiMotherPt(-1),
347  fV0MultiplicityHNMEvent(-1),
348  fTrackMultiplicityHNMEvent(-1),
349  fZVertexHNMEvent(-1),
350  fPtHNM(-1),
351  fPDGMassNDM(-1),
352  fNDMMinPtPossible(0.),
353  fPDGMassChargedPion(-1),
354  fPDGCodeNDM(-1),
355  fPDGCodeAnalyzedMeson(-1),
356  fHistoConvGammaPt(nullptr),
357  fHistoConvGammaEta(nullptr),
358  fHistoClusterGammaPt(nullptr),
359  fHistoClusterGammaEta(nullptr),
360  fHistoClusterGammaE(nullptr),
361  fHistoNegPionPt(nullptr),
362  fHistoPosPionPt(nullptr),
363  fHistoNegPionPhi(nullptr),
364  fHistoPosPionPhi(nullptr),
365  fHistoNegPionEta(nullptr),
366  fHistoPosPionEta(nullptr),
367  fHistoNegPionClsTPC(nullptr),
368  fHistoPosPionClsTPC(nullptr),
369  fHistoPionDCAxy(nullptr),
370  fHistoPionDCAz(nullptr),
371  fHistoPionTPCdEdxNSigma(nullptr),
372  fHistoPionTPCdEdx(nullptr),
373  fHistoPionPionInvMassPt(nullptr),
374  fHistoGammaGammaInvMassPt(nullptr),
375  fHistoGammaGammaInvMassPtBeforeCuts(nullptr),
376  fHistoMotherInvMassPt(nullptr),
377  fHistoMotherInvMassPtRejectedKinematic(nullptr),
378  fHistoDalitzPlotPosFixedPzNDM(nullptr),
379  fHistoDalitzPlotNegFixedPzNDM(nullptr),
380  fHistoDalitzPlotPosSubNDM(nullptr),
381  fHistoDalitzPlotNegSubNDM(nullptr),
382  fHistoBackInvMassPt(nullptr),
383  fHistoMotherLikeSignBackInvMassPt(nullptr),
384  fHistoAngleHNMesonPiPlPiMi(nullptr),
385  fHistoAngleHNMesonNDM(nullptr),
386  fHistoAngleHNMesonPiPl(nullptr),
387  fHistoAngleHNMesonPiMi(nullptr),
388  fHistoAnglePiPlPiMi(nullptr),
389  fHistoAngleNDMPiMi(nullptr),
390  fHistoAnglePiPlNDM(nullptr),
391  fHistoAngleSum(nullptr),
392  fHistoTrueAngleSum(nullptr),
393  fHistoTrueHNMesonPtvsNDMPt(nullptr),
394  fHistoMotherInvMassSubNDM(nullptr),
395  fHistoBackInvMassPtSubNDM(nullptr),
396  fHistoMotherLikeSignBackInvMassSubNDMPt(nullptr),
397  fHistoMotherInvMassFixedPzNDM(nullptr),
398  fHistoBackInvMassPtFixedPzNDM(nullptr),
399  fHistoMotherLikeSignBackInvMassFixedPzNDMPt(nullptr),
400  fHistoMCAllGammaPt(nullptr),
401  fHistoMCConvGammaPt(nullptr),
402  fHistoMCAllMesonPt(nullptr),
403  fHistoMCAllMesonEta(nullptr),
404  fHistoMCAllMesonPhi(nullptr),
405  fHistoMCMesonFromNeutralMesonPt(nullptr),
406  fHistoMCMesonFromNeutralMesonEta(nullptr),
407  fHistoMCMesonFromNeutralMesonPhi(nullptr),
408  fHistoMCAllPosPionsPt(nullptr),
409  fHistoMCAllPosPionsEta(nullptr),
410  fHistoMCAllPosPionsPhi(nullptr),
411  fHistoMCAllNegPionsPt(nullptr),
412  fHistoMCAllNegPionsEta(nullptr),
413  fHistoMCAllNegPionsPhi(nullptr),
414  fHistoMCGammaFromNeutralMesonPt(nullptr),
415  fHistoMCPosPionsFromNeutralMesonPt(nullptr),
416  fHistoMCPosPionsFromNeutralMesonEta(nullptr),
417  fHistoMCPosPionsFromNeutralMesonPhi(nullptr),
418  fHistoMCNegPionsFromNeutralMesonPt(nullptr),
419  fHistoMCNegPionsFromNeutralMesonEta(nullptr),
420  fHistoMCNegPionsFromNeutralMesonPhi(nullptr),
421  fHistoMCHNMPiPlPiMiNDMPt(nullptr),
422  fHistoMCHNMPiPlPiMiNDMEta(nullptr),
423  fHistoMCHNMPiPlPiMiNDMPhi(nullptr),
424  fHistoMCHNMPiPlPiMiNDMInAccPt(nullptr),
425  fHistoMCHNMInAccVsNDMPt(nullptr),
426  fHistoMCHeavyAllPt(nullptr),
427  fHistoMCHeavyAllEta(nullptr),
428  fHistoMCHeavyAllPhi(nullptr),
429  fHistoMCHeavyChannelPt(nullptr),
430  fHistoMCHeavyChannelEta(nullptr),
431  fHistoMCHeavyChannelPhi(nullptr),
432  fHistMCChannelNDMFromHeavyPt(nullptr),
433  fHistMCChannelNDMFromHeavyEta(nullptr),
434  fHistMCChannelNDMFromHeavyPhi(nullptr),
435  fHistMCChannelPiPlusFromHeavyPt(nullptr),
436  fHistMCChannelPiPlusFromHeavyEta(nullptr),
437  fHistMCChannelPiPlusFromHeavyPhi(nullptr),
438  fHistMCChannelPiMinusFromHeavyPt(nullptr),
439  fHistMCChannelPiMinusFromHeavyEta(nullptr),
440  fHistMCChannelPiPMinusFromHeavyPhi(nullptr),
441  fHistMCChannelNDMPtHeavyPt(nullptr),
442  fHistMCChannelPiPlusPtHeavyPt(nullptr),
443  fHistMCChannelPiMinusPtHeavyPt(nullptr),
444  fHistoMCHeavyReconstructiblePt(nullptr),
445  fHistoMCHeavyReconstructibleEta(nullptr),
446  fHistoMCHeavyReconstructiblePhi(nullptr),
447  fHistMCReconstructibleNDMFromHeavyPt(nullptr),
448  fHistMCReconstructibleNDMFromHeavyEta(nullptr),
449  fHistMCReconstructibleNDMFromHeavyPhi(nullptr),
450  fHistMCReconstructiblePiPlusFromHeavyPt(nullptr),
451  fHistMCReconstructiblePiPlusFromHeavyEta(nullptr),
452  fHistMCReconstructiblePiPlusFromHeavyPhi(nullptr),
453  fHistMCReconstructiblePiMinusFromHeavyPt(nullptr),
454  fHistMCReconstructiblePiMinusFromHeavyEta(nullptr),
455  fHistMCReconstructiblePiPMinusFromHeavyPhi(nullptr),
456  fHistMCReconstructibleNDMPtHeavyPt(nullptr),
457  fHistMCReconstructiblePiPlusPtHeavyPt(nullptr),
458  fHistMCReconstructiblePiMinusPtHeavyPt(nullptr),
459  fHistoTrueMotherPiPlPiMiNDMInvMassPt(nullptr),
460  fHistoTrueMotherPiPlPiMiNDMInvMassPtSubNDM(nullptr),
461  fHistoTrueMotherPiPlPiMiNDMInvMassPtFixedPzNDM(nullptr),
462  fHistoTrueMotherPiPlPiMiNDMDalitzPlotPosFixedPzNDM(nullptr),
463  fHistoTrueMotherPiPlPiMiNDMDalitzPlotNegFixedPzNDM(nullptr),
464  fHistoTrueMotherPiPlPiMiNDMDalitzPlotPosSubNDM(nullptr),
465  fHistoTrueMotherPiPlPiMiNDMDalitzPlotNegSubNDM(nullptr),
466  fHistoTrueMotherGammaGammaInvMassPt(nullptr),
467  fHistoTrueMotherGammaGammaFromHNMInvMassPt(nullptr),
468  fHistoTrueConvGammaPt(nullptr),
469  fHistoTrueConvGammaFromNeutralMesonPt(nullptr),
470  fHistoTrueClusterGammaPt(nullptr),
471  fHistoTrueClusterGammaFromNeutralMesonPt(nullptr),
472  fHistoTruePosPionPt(nullptr),
473  fHistoTruePosPionFromNeutralMesonPt(nullptr),
474  fHistoTrueNegPionPt(nullptr),
475  fHistoTrueNegPionFromNeutralMesonPt(nullptr),
476  fHistoTruePionPionInvMassPt(nullptr),
477  fHistoTruePionPionFromSameMotherInvMassPt(nullptr),
478  fHistoTruePionPionFromHNMInvMassPt(nullptr),
479  fHistoTruePiPlPiMiSameMotherFromEtaInvMassPt(nullptr),
480  fHistoTruePiPlPiMiSameMotherFromOmegaInvMassPt(nullptr),
481  fHistoTruePiPlPiMiSameMotherFromRhoInvMassPt(nullptr),
482  fHistoTruePiPlPiMiSameMotherFromEtaPrimeInvMassPt(nullptr),
483  fHistoTruePiPlPiMiSameMotherFromK0sInvMassPt(nullptr),
484  fHistoTruePiPlPiMiSameMotherFromK0lInvMassPt(nullptr),
485  fHistoTruePiMiPiZeroSameMotherFromEtaInvMassPt(nullptr),
486  fHistoTruePiMiPiZeroSameMotherFromOmegaInvMassPt(nullptr),
487  fHistoTruePiMiPiZeroSameMotherFromRhoInvMassPt(nullptr),
488  fHistoTruePiMiPiZeroSameMotherFromK0lInvMassPt(nullptr),
489  fHistoTruePiPlPiZeroSameMotherFromEtaInvMassPt(nullptr),
490  fHistoTruePiPlPiZeroSameMotherFromOmegaInvMassPt(nullptr),
491  fHistoTruePiPlPiZeroSameMotherFromRhoInvMassPt(nullptr),
492  fHistoTruePiPlPiZeroSameMotherFromK0lInvMassPt(nullptr),
493  fHistoTruePiPlPiMiNDMPureCombinatoricalInvMassPt(nullptr),
494  fHistoTruePiPlPiMiNDMContaminationInvMassPt(nullptr),
495  fHistoDoubleCountTruePi0InvMassPt(nullptr),
496  fHistoDoubleCountTrueHNMInvMassPt(nullptr),
497  fHistoDoubleCountTrueConvGammaRPt(nullptr),
498  fVectorDoubleCountTruePi0s(0),
499  fVectorDoubleCountTrueHNMs(0),
500  fVectorDoubleCountTrueConvGammas(0),
501  fHistoNEvents(nullptr),
502  fHistoNEventsWOWeight(nullptr),
503  fProfileJetJetXSection(nullptr),
504  fHistoJetJetNTrials(nullptr),
505  fHistoNGoodESDTracks(nullptr),
506  fProfileEtaShift(nullptr),
507  fHistoSPDClusterTrackletBackground(nullptr),
508  fHistovParticleChi2PerNDF(nullptr),
509  fHistovParticleChi2PerNDFBothConstrained(nullptr),
510  fHistovParticleChi2PerNDFOneConstrained(nullptr),
511  fHistovParticledS(nullptr),
512  fHistovParticledSBothConstrained(nullptr),
513  fHistovParticledSOneConstrained(nullptr),
514  fHistoTruevParticleChi2PerNDF(nullptr),
515  fHistoTruevParticleFromSameMotherChi2PerNDF(nullptr),
516  fHistoTruevParticleFromHNMChi2PerNDF(nullptr),
517  fHistoTruevParticledS(nullptr),
518  fHistoTruevParticleFromSameMotherdS(nullptr),
519  fHistoTruevParticleFromHNMdS(nullptr),
520  fRandom(0),
521  fnCuts(0),
522  fiCut(0),
523  fNumberOfESDTracks(0),
524  fMoveParticleAccordingToVertex(kFALSE),
525  fIsHeavyIon(0),
526  fDoMesonAnalysis(kTRUE),
527  fDoMesonQA(0),
528  fIsFromMBHeader(kTRUE),
529  fIsFromDesiredHeader(kTRUE),
530  fIsOverlappingWithOtherHeader(kFALSE),
531  fAllowOverlapHeaders(kTRUE),
532  fIsMC(kFALSE),
533  fSelectedHeavyNeutralMeson(kFALSE),
534  fDoLightOutput(kFALSE),
535  fNDMRecoMode(0),
536  fTolerance(-1),
537  fWeightJetJetMC(1.),
538  fTrackMatcherRunningMode(0),
539  fMCEventPos(),
540  fMCEventNeg(),
541  fESDArrayPos(),
542  fESDArrayNeg()
543 {
544  DefineOutput(1, TList::Class());
545 }
546 
547 //-----------------------------------------------------------------------------------------------
549 {
550  //
551  // virtual destructor
552  //
553  cout<<"Destructor"<<endl;
554  if(fGoodConvGammas){
555  delete fGoodConvGammas;
556  }
557  if(fClusterCandidates){
558  delete fClusterCandidates;
559  }
560 
563  }
564 
567  }
568 
569  if(fPosPionCandidates){
570  delete fPosPionCandidates;
571  }
572 
573  if(fNegPionCandidates){
574  delete fNegPionCandidates;
575  }
576 
577  if(fBGHandlerPiPl){
578  for(int icut = 0; icut < fnCuts; icut++)
579  delete fBGHandlerPiPl[icut];
580  delete[] fBGHandlerPiPl;
581  }
582 
583  if(fBGHandlerPiMi){
584  for(int icut = 0; icut < fnCuts; icut++)
585  delete fBGHandlerPiMi[icut];
586  delete[] fBGHandlerPiMi;
587  }
588 }
589 //___________________________________________________________
591 
594 
595  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
596 
597  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
598  TString cutstringPion = ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->GetCutNumber();
599  TString cutstringConvGamma = "";
600  if (fNDMRecoMode < 2) cutstringConvGamma = ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutNumber();
601  TString cutstringCaloGamma = "";
602  if (fNDMRecoMode > 0) cutstringCaloGamma = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
603  TString cutstringNeutralPion= ((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(iCut))->GetCutNumber();
604  TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
605 
606  TString fullCutString = "";
607  if (fNDMRecoMode == 0) fullCutString = Form("%i_%s_%s_%s_%s_%s",fNDMRecoMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
608  else if (fNDMRecoMode == 1) fullCutString = Form("%i_%s_%s_%s_%s_%s_%s",fNDMRecoMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringCaloGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
609  else if (fNDMRecoMode == 2) fullCutString = Form("%i_%s_%s_%s_%s_%s",fNDMRecoMode,cutstringEvent.Data(),cutstringCaloGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
610 
611  Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(0,1));
612  Int_t centMin = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(1,1));
613  Int_t centMax = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(2,1));
614 
615  if(collisionSystem == 1 || collisionSystem == 2 ||
616  collisionSystem == 5 || collisionSystem == 8 ||
617  collisionSystem == 9){
618  centMin = centMin*10;
619  centMax = centMax*10;
620  }
621  else if(collisionSystem == 3 || collisionSystem == 6){
622  centMin = centMin*5;
623  centMax = centMax*5;
624  }
625  else if(collisionSystem == 4 || collisionSystem == 7){
626  centMin = ((centMin*5)+45);
627  centMax = ((centMax*5)+45);
628  }
629 
630  fBGHandlerPiPl[iCut] = new AliGammaConversionAODBGHandler( collisionSystem,centMin,centMax,
631  ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetNumberOfBGEvents(),
632  ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity(),
633  4,8,5);
634 
635  fBGHandlerPiMi[iCut] = new AliGammaConversionAODBGHandler( collisionSystem,centMin,centMax,
636  ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetNumberOfBGEvents(),
637  ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity(),
638  4,8,5);
639  }
640 }
641 
642 //______________________________________________________________________
644 {
645  //
646  // Create ouput objects
647  //
648 
649  if(((AliConvEventCuts*)fEventCutArray->At(0))->GetUseJetFinderForOutliers()){
650  fOutlierJetReader=(AliAnalysisTaskJetOutlierRemoval*)AliAnalysisManager::GetAnalysisManager()->GetTask("AliAnalysisTaskJetOutlierRemoval");
651  if(!fOutlierJetReader){AliFatal("Error: No AliAnalysisTaskJetOutlierRemoval");} // GetV0Reader
652  else{printf("Found AliAnalysisTaskJetOutlierRemoval used for outlier removal!\n");}
653  }
654 
655  // Set pT and mass ranges
656  Double_t HistoNMassBins = 600;
657  Double_t HistoMassRange[2] = {0.4,1.0};
658  Double_t HistoNMassBinsSub = 600;
659  Double_t HistoMassRangeSub[2] = {0.4,1.0};
660  Double_t HistoNPtBins = 800;
661  Double_t HistoPtRange[2] = {0.,80.};
662  Double_t HistoNMassBinsDecayMeson = 450;
663  Double_t HistoMassRangeNDM[2] = {0.0,0.45};
664  Double_t HistoNMassBinsPiPlusPiMinus = 250;
665  Double_t HistoMassRangePiPlusPiMinus[2] = {0.0,2.0};
666  TString NameNeutralMesonAnalyzed = "not set";
667  TString NameNeutralMesonAnalyzedLatex = "not set";
668  TString NameNDM = "not set";
669  TString NameNDMLatex = "not set";
670  Double_t HistoMassRangeDalitz = 3.0;
671 
672  switch( fSelectedHeavyNeutralMeson ) {
673  case 0: // ETA MESON
674  HistoNMassBins = 400;
675  HistoMassRange[0] = 0.3;
676  HistoMassRange[1] = 0.7;
677  HistoNMassBinsSub = 400;
678  HistoMassRangeSub[0] = 0.3;
679  HistoMassRangeSub[1] = 0.7;
680  HistoNMassBinsDecayMeson = 450;
681  HistoMassRangeNDM[0] = 0.0;
682  HistoMassRangeNDM[1] = 0.45;
683  NameNeutralMesonAnalyzed = "Eta";
684  NameNeutralMesonAnalyzedLatex = "#eta";
685  NameNDM = "NeutralPion";
686  NameNDMLatex = "#pi^{0}";
687  fPDGMassNDM = 0.1349766; // hard coded PDG value to keep results reproducable later
688  fPDGCodeNDM = 111; // PDG pi0
689  fPDGMassChargedPion = 0.1395706; // hard coded PDG 2018 value to keep results reproducable later
690  fPDGCodeAnalyzedMeson = 221; // PDG omega
691  break;
692  case 1: // OMEGA MESON
693  HistoNMassBins = 500;
694  HistoMassRange[0] = 0.5;
695  HistoMassRange[1] = 1.0;
696  HistoNMassBinsSub = 500;
697  HistoMassRangeSub[0] = 0.5;
698  HistoMassRangeSub[1] = 1.0;
699  HistoNMassBinsDecayMeson = 450;
700  HistoMassRangeNDM[0] = 0.0;
701  HistoMassRangeNDM[1] = 0.45;
702  NameNeutralMesonAnalyzed = "Omega";
703  NameNeutralMesonAnalyzedLatex = "#omega";
704  NameNDM = "NeutralPion";
705  NameNDMLatex = "#pi^{0}";
706  fPDGMassNDM = 0.1349766; // hard coded PDG value to keep results reproducable later
707  fPDGCodeNDM = 111; // PDG pi0
708  fPDGMassChargedPion = 0.1395706; // hard coded PDG 2018 value to keep results reproducable later
709  fPDGCodeAnalyzedMeson = 223; // PDG omega
710  break;
711  case 2: // ETA PRIME MESON
712  HistoNMassBins = 600;
713  HistoMassRange[0] = 0.6;
714  HistoMassRange[1] = 1.2;
715  HistoNMassBinsSub = 600;
716  HistoMassRangeSub[0] = 0.6;
717  HistoMassRangeSub[1] = 1.2;
718  HistoNMassBinsDecayMeson = 450;
719  HistoMassRangeNDM[0] = 0.4;
720  HistoMassRangeNDM[1] = 0.85;
721  NameNeutralMesonAnalyzed = "EtaPrime";
722  NameNeutralMesonAnalyzedLatex = "#eta'";
723  NameNDM = "EtaMeson";
724  NameNDMLatex = "#eta";
725  fPDGMassNDM = 0.547862; // hard coded PDG value to keep results reproducable later
726  fPDGCodeNDM = 221; // PDG value eta
727  fPDGMassChargedPion = 0.1395706; // hard coded PDG 2018 value to keep results reproducable later
728  fPDGCodeAnalyzedMeson = 331; // PDG value eta prime
729  HistoMassRangeDalitz = 3.0;
730  break;
731  case 3: // D0 MESON
732  HistoNMassBins = 600;
733  HistoMassRange[0] = 1.4;
734  HistoMassRange[1] = 2.0;
735  HistoNMassBinsSub = 400; // MF: Background subtraction?
736  HistoMassRangeSub[0] = 1.6;
737  HistoMassRangeSub[1] = 2.0;
738  HistoNMassBinsDecayMeson = 450;
739  HistoMassRangeNDM[0] = 0.0;
740  HistoMassRangeNDM[1] = 0.45;
741  HistoNPtBins = 500;
742  HistoPtRange[1] = 50.;
743  NameNeutralMesonAnalyzed = "D0";
744  NameNeutralMesonAnalyzedLatex = "D^{0}";
745  NameNDM = "NeutralPion";
746  NameNDMLatex = "#pi^{0}";
747  fPDGMassNDM = 0.1349766; // hard coded PDG value to keep results reproducable later
748  fPDGCodeNDM = 111; // PDG value pi0
749  fPDGMassChargedPion = 0.1395706; // hard coded PDG 2018 value to keep results reproducable later
750  fPDGCodeAnalyzedMeson = 421; // PDG value D0
751  break;
752  default:
753  AliError(Form("Heavy neutral meson not correctly selected (only 0,1,2,3 valid)... selected: %d",fSelectedHeavyNeutralMeson));
754  }
755 
756  // Create the output container
757  if(fOutputContainer != nullptr){
758  delete fOutputContainer;
759  fOutputContainer = nullptr;
760  }
761  if(fOutputContainer == nullptr){
762  fOutputContainer = new TList();
763  fOutputContainer->SetOwner(kTRUE);
764  }
765 
766  fGoodConvGammas = new TList();
767  fClusterCandidates = new TList();
768  fClusterCandidates->SetOwner(kTRUE);
769 
771  fNeutralDecayParticleCandidates->SetOwner(kTRUE);
772 
775 
776 
777  fPosPionCandidates = new TList();
778  fPosPionCandidates->SetOwner(kTRUE);
779  fNegPionCandidates = new TList();
780  fNegPionCandidates->SetOwner(kTRUE);
781 
782  fCutFolder = new TList*[fnCuts];
783  fESDList = new TList*[fnCuts];
784  fHistoNEvents = new TH1F*[fnCuts];
785  if(fIsMC > 1){
786  fHistoNEventsWOWeight = new TH1F*[fnCuts];
787  }
789  if(fIsMC == 2) {
790  fProfileJetJetXSection = new TProfile*[fnCuts];
791  fHistoJetJetNTrials = new TH1F*[fnCuts];
792  }
793  if (fNDMRecoMode > 0){
794  fHistoClusterGammaPt = new TH1F*[fnCuts];
795  fHistoClusterGammaEta = new TH1F*[fnCuts];
796  fHistoClusterGammaE = new TH1F*[fnCuts];
797  }
798  if(!fDoLightOutput){
799  fProfileEtaShift = new TProfile*[fnCuts];
801 
802  fHistovParticleChi2PerNDF = new TH1F*[fnCuts];
805  fHistovParticledS = new TH1F*[fnCuts];
808  if (fNDMRecoMode < 2){
809  fHistoConvGammaPt = new TH1F*[fnCuts];
810  fHistoConvGammaEta = new TH1F*[fnCuts];
811  }
812  fHistoNegPionPt = new TH1F*[fnCuts];
813  fHistoPosPionPt = new TH1F*[fnCuts];
814  fHistoNegPionPhi = new TH1F*[fnCuts];
815  fHistoPosPionPhi = new TH1F*[fnCuts];
817 
818  if( fDoMesonQA>0 ) {
819  fHistoNegPionEta = new TH1F*[fnCuts];
820  fHistoPosPionEta = new TH1F*[fnCuts];
823  fHistoPionDCAxy = new TH2F*[fnCuts];
824  fHistoPionDCAz = new TH2F*[fnCuts];
826  fHistoPionTPCdEdx = new TH2F*[fnCuts];
831  }
832 
833 
841  fHistoAngleSum = new TH2F*[fnCuts];
842  }
843 
849 
851 
854 
856 
860 
861  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
862  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
863  TString cutstringPion = ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->GetCutNumber();
864  TString cutstringConvGamma = "";
865  if (fNDMRecoMode < 2)
866  cutstringConvGamma = ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutNumber();
867  TString cutstringCaloGamma = "";
868  if (fNDMRecoMode > 0)
869  cutstringCaloGamma = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
870  TString cutstringNeutralPion = ((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(iCut))->GetCutNumber();
871  TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
872 
873  TString fullCutString = "";
874  if (fNDMRecoMode == 0)
875  fullCutString = Form("%i_%s_%s_%s_%s_%s",fNDMRecoMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
876  else if (fNDMRecoMode == 1)
877  fullCutString = Form("%i_%s_%s_%s_%s_%s_%s",fNDMRecoMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringCaloGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
878  else if (fNDMRecoMode == 2)
879  fullCutString = Form("%i_%s_%s_%s_%s_%s",fNDMRecoMode,cutstringEvent.Data(),cutstringCaloGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
880  TString nameCutFolder = Form("Cut Number %s", fullCutString.Data());
881  TString nameESDList = Form("%s ESD histograms", fullCutString.Data());
882 
883  // Set min pt of pi0 that each method is able to reconstruct -> will be used for MC studies
884  if(fSelectedHeavyNeutralMeson == 1){ // omega
885  if(fNDMRecoMode==0){ // PCM
886  fNDMMinPtPossible = 0.3;
887  } else if (fNDMRecoMode==1){ // mixed
888  if(cutstringCaloGamma(0,1).String().EqualTo("1") || cutstringCaloGamma(0,1).String().EqualTo("4")){
889  fNDMMinPtPossible = 0.8; //PCM-EMC
890  } else{
891  fNDMMinPtPossible = 0.4; //PCM-PHOS
892  }
893  } else if (fNDMRecoMode==2){ // pure
894  if(cutstringCaloGamma(0,1).String().EqualTo("1") || cutstringCaloGamma(0,1).String().EqualTo("4")){
895  fNDMMinPtPossible = 1.4; //EMC
896  } else{
897  fNDMMinPtPossible = 1.6; //PHOS
898  }
899  } else{
900  fNDMMinPtPossible = 0.;
901  }
902  }
903 
904  fCutFolder[iCut] = new TList();
905  fCutFolder[iCut]->SetName(nameCutFolder.Data());
906  fCutFolder[iCut]->SetOwner(kTRUE);
907  fOutputContainer->Add(fCutFolder[iCut]);
908 
909  fESDList[iCut] = new TList();
910  fESDList[iCut]->SetName(nameESDList.Data());
911  fESDList[iCut]->SetOwner(kTRUE);
912 
913  fHistoNEvents[iCut] = new TH1F("NEvents","NEvents",14,-0.5,13.5);
914  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
915  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
916  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
917  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
918  TString TriggerNames = "Not Trigger: ";
919  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
920  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
921  } else {
922  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
923  }
924  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
925  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
926  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
927  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
928  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
929  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
930  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
931  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
932  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
933  fHistoNEvents[iCut]->GetYaxis()->SetTitle("N_{events}");
934  fESDList[iCut]->Add(fHistoNEvents[iCut]);
935 
936  if(fIsMC > 1){
937  fHistoNEventsWOWeight[iCut] = new TH1F("NEventsWOWeight","NEventsWOWeight",14,-0.5,13.5);
938  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
939  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
940  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
941  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
942  TString TriggerNames = "Not Trigger: ";
943  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
944  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
945  } else {
946  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
947  }
948  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
949  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
950  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
951  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
952  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
953  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
954  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
955  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
956  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
957  fHistoNEventsWOWeight[iCut]->GetYaxis()->SetTitle("N_{events}");
958  fESDList[iCut]->Add(fHistoNEventsWOWeight[iCut]);
959  }
960 
961  if (fIsMC == 2){
962  fProfileJetJetXSection[iCut] = new TProfile("XSection", "XSection", 1, -0.5, 0.5);
963  fESDList[iCut]->Add(fProfileJetJetXSection[iCut]);
964  fHistoJetJetNTrials[iCut] = new TH1F("NTrials", "#sum{NTrials}", 1, 0, 1);
965  fHistoJetJetNTrials[iCut]->GetXaxis()->SetBinLabel(1,"#sum{NTrials}");
966  fESDList[iCut]->Add(fHistoJetJetNTrials[iCut]);
967  }
968 
969  if(fIsHeavyIon>0)
970  fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",3000,0,3000);
971  else
972  fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
973  fHistoNGoodESDTracks[iCut]->GetXaxis()->SetTitle("N_{good ESD tracks}");
974  fHistoNGoodESDTracks[iCut]->GetYaxis()->SetTitle("N_{events}");
975  fHistoNGoodESDTracks[iCut]->Sumw2();
976  fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
977 
978  if (fNDMRecoMode > 0){
979  fHistoClusterGammaPt[iCut] = new TH1F("ESD_ClusterGamma_Pt","ESD_ClusterGamma_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
980  fHistoClusterGammaPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
981  fHistoClusterGammaPt[iCut]->GetYaxis()->SetTitle("N_{#gamma,cluster}");
982  fHistoClusterGammaPt[iCut]->Sumw2();
983  fESDList[iCut]->Add(fHistoClusterGammaPt[iCut]);
984  fHistoClusterGammaEta[iCut] = new TH1F("ESD_ClusterGamma_Eta","ESD_ClusterGamma_Eta",600,-1.5,1.5);
985  fHistoClusterGammaEta[iCut]->GetXaxis()->SetTitle("#eta");
986  fHistoClusterGammaEta[iCut]->GetYaxis()->SetTitle("N_{#gamma,cluster}");
987  fHistoClusterGammaEta[iCut]->Sumw2();
988  fESDList[iCut]->Add(fHistoClusterGammaEta[iCut]);
989  fHistoClusterGammaE[iCut] = new TH1F("ESD_ClusterGamma_E","ESD_ClusterGamma_E",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
990  fHistoClusterGammaE[iCut]->GetXaxis()->SetTitle("E (GeV)");
991  fHistoClusterGammaE[iCut]->GetYaxis()->SetTitle("N_{#gamma,cluster}");
992  fHistoClusterGammaE[iCut]->Sumw2();
993  fESDList[iCut]->Add(fHistoClusterGammaE[iCut]);
994  }
995  if(!fDoLightOutput){
996  fProfileEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
997  fESDList[iCut]->Add(fProfileEtaShift[iCut]);
998  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters","SPD tracklets vs SPD clusters",100,0,200,250,0,1000);
999  fHistoSPDClusterTrackletBackground[iCut]->GetXaxis()->SetTitle("N_{SPD tracklets}");
1000  fHistoSPDClusterTrackletBackground[iCut]->GetYaxis()->SetTitle("N_{SPD clusters}");
1001  fHistoSPDClusterTrackletBackground[iCut]->Sumw2();
1002  fESDList[iCut]->Add(fHistoSPDClusterTrackletBackground[iCut]);
1003 
1004  fHistovParticleChi2PerNDF[iCut] = new TH1F("fHistovParticleChi2PerNDF","fHistovParticleChi2PerNDF",300,0,300);
1005  fHistovParticleChi2PerNDF[iCut]->GetXaxis()->SetTitle("#chi^{2}/ndf");
1006  fHistovParticleChi2PerNDF[iCut]->Sumw2();
1007  fESDList[iCut]->Add(fHistovParticleChi2PerNDF[iCut]);
1008 
1009  fHistovParticleChi2PerNDFBothConstrained[iCut] = new TH1F("fHistovParticleChi2PerNDFBothConstrained","fHistovParticleChi2PerNDFBothConstrained",300,0,300);
1010  fHistovParticleChi2PerNDFBothConstrained[iCut]->GetXaxis()->SetTitle("#chi^{2}/ndf");
1013 
1014  fHistovParticleChi2PerNDFOneConstrained[iCut] = new TH1F("fHistovParticleChi2PerNDFOneConstrained","fHistovParticleChi2PerNDFOneConstrained",300,0,300);
1015  fHistovParticleChi2PerNDFOneConstrained[iCut]->GetXaxis()->SetTitle("#chi^{2}/ndf");
1018 
1019  fHistovParticledS[iCut] = new TH1F("fHistovParticledS","fHistovParticledS",400,-4,4);
1020  fHistovParticledS[iCut]->GetXaxis()->SetTitle("dS");
1021  fHistovParticledS[iCut]->Sumw2();
1022  fESDList[iCut]->Add(fHistovParticledS[iCut]);
1023 
1024  fHistovParticledSBothConstrained[iCut] = new TH1F("fHistovParticledSBothConstrained","fHistovParticledSBothConstrained",400,-4,4);
1025  fHistovParticledSBothConstrained[iCut]->GetXaxis()->SetTitle("dS");
1026  fHistovParticledSBothConstrained[iCut]->Sumw2();
1027  fESDList[iCut]->Add(fHistovParticledSBothConstrained[iCut]);
1028 
1029  fHistovParticledSOneConstrained[iCut] = new TH1F("fHistovParticledSOneConstrained","fHistovParticledSOneConstrained",400,-4,4);
1030  fHistovParticledSOneConstrained[iCut]->GetXaxis()->SetTitle("dS");
1031  fHistovParticledSOneConstrained[iCut]->Sumw2();
1032  fESDList[iCut]->Add(fHistovParticledSOneConstrained[iCut]);
1033 
1034  if (fNDMRecoMode < 2){
1035  fHistoConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1036  fHistoConvGammaPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1037  fHistoConvGammaPt[iCut]->GetYaxis()->SetTitle("N_{#gamma,conv}");
1038  fHistoConvGammaPt[iCut]->Sumw2();
1039  fESDList[iCut]->Add(fHistoConvGammaPt[iCut]);
1040  fHistoConvGammaEta[iCut] = new TH1F("ESD_ConvGamma_Eta","ESD_ConvGamma_Eta",600,-1.5,1.5);
1041  fHistoConvGammaEta[iCut]->GetXaxis()->SetTitle("#eta");
1042  fHistoConvGammaEta[iCut]->GetYaxis()->SetTitle("N_{#gamma,conv}");
1043  fHistoConvGammaEta[iCut]->Sumw2();
1044  fESDList[iCut]->Add(fHistoConvGammaEta[iCut]);
1045  }
1046 
1047  fHistoNegPionPt[iCut] = new TH1F("ESD_PrimaryNegPions_Pt","ESD_PrimaryNegPions_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1048  fHistoNegPionPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1049  fHistoNegPionPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
1050  fHistoNegPionPt[iCut]->Sumw2();
1051  fESDList[iCut]->Add(fHistoNegPionPt[iCut]);
1052  fHistoPosPionPt[iCut] = new TH1F("ESD_PrimaryPosPions_Pt","ESD_PrimaryPosPions_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1053  fHistoPosPionPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1054  fHistoPosPionPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
1055  fHistoPosPionPt[iCut]->Sumw2();
1056  fESDList[iCut]->Add(fHistoPosPionPt[iCut]);
1057  fHistoNegPionPhi[iCut] = new TH1F("ESD_PrimaryNegPions_Phi","ESD_PrimaryNegPions_Phi",360,0,2*TMath::Pi());
1058  fHistoNegPionPhi[iCut]->GetXaxis()->SetTitle("#phi");
1059  fHistoNegPionPhi[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
1060  fHistoNegPionPhi[iCut]->Sumw2();
1061  fESDList[iCut]->Add(fHistoNegPionPhi[iCut]);
1062  fHistoPosPionPhi[iCut] = new TH1F("ESD_PrimaryPosPions_Phi","ESD_PrimaryPosPions_Phi",360,0,2*TMath::Pi());
1063  fHistoPosPionPhi[iCut]->GetXaxis()->SetTitle("#phi");
1064  fHistoPosPionPhi[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
1065  fHistoPosPionPhi[iCut]->Sumw2();
1066  fESDList[iCut]->Add(fHistoPosPionPhi[iCut]);
1067  fHistoPionPionInvMassPt[iCut] = new TH2F("ESD_PiPlusPiNeg_InvMassPt","ESD_PiPlusPiNeg_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1068  fHistoPionPionInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1069  fHistoPionPionInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1070  fHistoPionPionInvMassPt[iCut]->Sumw2();
1071  fESDList[iCut]->Add(fHistoPionPionInvMassPt[iCut]);
1072 
1073  if ( fDoMesonQA>0 ) {
1074  fHistoNegPionEta[iCut] = new TH1F("ESD_PrimaryNegPions_Eta","ESD_PrimaryNegPions_Eta",600,-1.5,1.5);
1075  fHistoNegPionEta[iCut]->GetXaxis()->SetTitle("#eta");
1076  fHistoNegPionEta[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
1077  fHistoNegPionEta[iCut]->Sumw2();
1078  fESDList[iCut]->Add(fHistoNegPionEta[iCut]);
1079  fHistoPosPionEta[iCut] = new TH1F("ESD_PrimaryPosPions_Eta","ESD_PrimaryPosPions_Eta",600,-1.5,1.5);
1080  fHistoPosPionEta[iCut]->GetXaxis()->SetTitle("#eta");
1081  fHistoPosPionEta[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
1082  fHistoPosPionEta[iCut]->Sumw2();
1083  fESDList[iCut]->Add(fHistoPosPionEta[iCut]);
1084  fHistoNegPionClsTPC[iCut] = new TH2F("ESD_PrimaryNegPions_ClsTPC","ESD_PrimaryNegPions_ClsTPC",100,0,1,400,0.,10.);
1085  fHistoNegPionClsTPC[iCut]->GetXaxis()->SetTitle("N_{findable cls. TPC #pi^{-}}");
1086  fHistoNegPionClsTPC[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1087  fHistoNegPionClsTPC[iCut]->Sumw2();
1088  fESDList[iCut]->Add(fHistoNegPionClsTPC[iCut]);
1089  fHistoPosPionClsTPC[iCut] = new TH2F("ESD_PrimaryPosPions_ClsTPC","ESD_PrimaryPosPions_ClsTPC",100,0,1,400,0.,10.);
1090  fHistoPosPionClsTPC[iCut]->GetXaxis()->SetTitle("N_{findable cls. TPC #pi^{+}}");
1091  fHistoPosPionClsTPC[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1092  fHistoPosPionClsTPC[iCut]->Sumw2();
1093  fESDList[iCut]->Add(fHistoPosPionClsTPC[iCut]);
1094  fHistoPionDCAxy[iCut] = new TH2F("ESD_PrimaryPions_DCAxy","ESD_PrimaryPions_DCAxy",800,-4.0,4.0,400,0.,10.);
1095  fHistoPionDCAxy[iCut]->GetXaxis()->SetTitle("DCA_{xy}");
1096  fHistoPionDCAxy[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1097  fHistoPionDCAxy[iCut]->Sumw2();
1098  fESDList[iCut]->Add(fHistoPionDCAxy[iCut]);
1099  fHistoPionDCAz[iCut] = new TH2F("ESD_PrimaryPions_DCAz","ESD_PrimaryPions_DCAz",800,-4.0,4.0,400,0.,10.);
1100  fHistoPionDCAz[iCut]->GetXaxis()->SetTitle("DCA_{z}");
1101  fHistoPionDCAz[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1102  fHistoPionDCAz[iCut]->Sumw2();
1103  fESDList[iCut]->Add(fHistoPionDCAz[iCut]);
1104  fHistoPionTPCdEdxNSigma[iCut] = new TH2F("ESD_PrimaryPions_TPCdEdx","ESD_PrimaryPions_TPCdEdx",150,0.05,20,400,-10,10);
1105  fHistoPionTPCdEdxNSigma[iCut]->GetXaxis()->SetTitle("p (GeV/c)");
1106  fHistoPionTPCdEdxNSigma[iCut]->GetYaxis()->SetTitle("#sigma_{PID,TPC}");
1107  fHistoPionTPCdEdxNSigma[iCut]->Sumw2();
1108  fESDList[iCut]->Add(fHistoPionTPCdEdxNSigma[iCut]);
1109  fHistoPionTPCdEdx[iCut] = new TH2F("ESD_PrimaryPions_TPCdEdxSignal","ESD_PrimaryPions_TPCdEdxSignal" ,150,0.05,20.0,800,0.0,200);
1110  fHistoPionTPCdEdx[iCut]->GetXaxis()->SetTitle("p (GeV/c)");
1111  fHistoPionTPCdEdx[iCut]->GetYaxis()->SetTitle("dE/dx signal (au)");
1112  fHistoPionTPCdEdx[iCut]->Sumw2();
1113  fESDList[iCut]->Add(fHistoPionTPCdEdx[iCut]);
1114 
1115  fHistoDalitzPlotPosFixedPzNDM[iCut] = new TH2F("ESD_DalitzPlotPos_FixedPz","ESD_DalitzPlotPos_FixedPz",HistoNMassBins,HistoMassRange[0],HistoMassRangeDalitz,HistoNMassBins,HistoMassRange[0],HistoMassRangeDalitz);
1116  fHistoDalitzPlotPosFixedPzNDM[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-}} (GeV/c^{2})");
1117  fHistoDalitzPlotPosFixedPzNDM[iCut]->GetYaxis()->SetTitle(Form("M_{#pi^{+}} %s (GeV/c^{2}",NameNDMLatex.Data()));
1118  fHistoDalitzPlotPosFixedPzNDM[iCut]->Sumw2();
1119  fESDList[iCut]->Add(fHistoDalitzPlotPosFixedPzNDM[iCut]);
1120  fHistoDalitzPlotNegFixedPzNDM[iCut] = new TH2F("ESD_DalitzPlotNeg_FixedPz","ESD_DalitzPlotNeg_FixedPz",HistoNMassBins,HistoMassRange[0],HistoMassRangeDalitz,HistoNMassBins,HistoMassRange[0],HistoMassRangeDalitz);
1121  fHistoDalitzPlotNegFixedPzNDM[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-}} (GeV/c^{2})");
1122  fHistoDalitzPlotNegFixedPzNDM[iCut]->GetYaxis()->SetTitle(Form("M_{#pi^{-}} %s (GeV/c^{2}",NameNDMLatex.Data()));
1123  fHistoDalitzPlotNegFixedPzNDM[iCut]->Sumw2();
1124  fESDList[iCut]->Add(fHistoDalitzPlotNegFixedPzNDM[iCut]);
1125  fHistoDalitzPlotPosSubNDM[iCut] = new TH2F("ESD_DalitzPlotPos_Sub","ESD_DalitzPlotPos_Sub",HistoNMassBins,HistoMassRange[0],HistoMassRangeDalitz,HistoNMassBins,HistoMassRange[0],HistoMassRangeDalitz);
1126  fHistoDalitzPlotPosSubNDM[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-}} (GeV/c^{2})");
1127  fHistoDalitzPlotPosSubNDM[iCut]->GetYaxis()->SetTitle(Form("M_{#pi^{+}} %s (GeV/c^{2}",NameNDMLatex.Data()));
1128  fHistoDalitzPlotPosSubNDM[iCut]->Sumw2();
1129  fESDList[iCut]->Add(fHistoDalitzPlotPosSubNDM[iCut]);
1130  fHistoDalitzPlotNegSubNDM[iCut] = new TH2F("ESD_DalitzPlotNeg_Sub","ESD_DalitzPlotNeg_Sub",HistoNMassBins,HistoMassRange[0],HistoMassRangeDalitz,HistoNMassBins,HistoMassRange[0],HistoMassRangeDalitz);
1131  fHistoDalitzPlotNegSubNDM[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-}} (GeV/c^{2})");
1132  fHistoDalitzPlotNegSubNDM[iCut]->GetYaxis()->SetTitle(Form("M_{#pi^{-}} %s (GeV/c^{2}",NameNDMLatex.Data()));
1133  fHistoDalitzPlotNegSubNDM[iCut]->Sumw2();
1134  fESDList[iCut]->Add(fHistoDalitzPlotNegSubNDM[iCut]);
1135  }
1136  fHistoGammaGammaInvMassPt[iCut] = new TH2F("ESD_GammaGamma_InvMass_Pt","ESD_GammaGamma_InvMass_Pt",HistoNMassBinsDecayMeson,HistoMassRangeNDM[0],HistoMassRangeNDM[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1137  fHistoGammaGammaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#gamma #gamma} (GeV/c^{2})");
1138  fHistoGammaGammaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1139  fHistoGammaGammaInvMassPt[iCut]->Sumw2();
1140  fESDList[iCut]->Add(fHistoGammaGammaInvMassPt[iCut]);
1141 
1142  fHistoGammaGammaInvMassPtBeforeCuts[iCut] = new TH2F("ESD_GammaGamma_InvMass_Pt_Before_Cuts","ESD_GammaGamma_InvMass_Pt_Before_Cuts",HistoNMassBinsDecayMeson,HistoMassRangeNDM[0],HistoMassRangeNDM[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1143  fHistoGammaGammaInvMassPtBeforeCuts[iCut]->GetXaxis()->SetTitle("M_{#gamma #gamma} (GeV/c^{2})");
1144  fHistoGammaGammaInvMassPtBeforeCuts[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1145  fHistoGammaGammaInvMassPtBeforeCuts[iCut]->Sumw2();
1147  }
1148  fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1149  fHistoMotherInvMassPt[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{+} #pi^{-} %s} (GeV/c^{2})",NameNDMLatex.Data()));
1150  fHistoMotherInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1151  fHistoMotherInvMassPt[iCut]->Sumw2();
1152  fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
1153  fHistoMotherInvMassPtRejectedKinematic[iCut] = new TH2F("ESD_Mother_InvMass_Pt_KinematicRejected","ESD_Mother_InvMass_Pt_KinematicRejected",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1154  fHistoMotherInvMassPtRejectedKinematic[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{+} #pi^{-} %s} (GeV/c^{2})",NameNDMLatex.Data()));
1155  fHistoMotherInvMassPtRejectedKinematic[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1158 
1159  fHistoBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt","ESD_Background_InvMass_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1160  fHistoBackInvMassPt[iCut]->Sumw2();
1161  fHistoBackInvMassPt[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{+} #pi^{-} %s} (GeV/c^{2})",NameNDMLatex.Data()));
1162  fHistoBackInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1163  if(!(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseLikeSignMixing())&&(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation())){
1164  fESDList[iCut]->Add(fHistoBackInvMassPt[iCut]);
1165  }
1166 
1167  fHistoMotherLikeSignBackInvMassPt[iCut] = new TH2F("ESD_Background_LikeSign_InvMass_Pt","ESD_Background_LikeSign_InvMass_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1168  fHistoMotherLikeSignBackInvMassPt[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{#pm} #pi^{#pm} %s} (GeV/c^{2})",NameNDMLatex.Data()));
1169  fHistoMotherLikeSignBackInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1170  fHistoMotherLikeSignBackInvMassPt[iCut]->Sumw2();
1171  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseLikeSignMixing()){
1172  fESDList[iCut]->Add(fHistoMotherLikeSignBackInvMassPt[iCut]);
1173  }
1174  fHistoMotherInvMassSubNDM[iCut] = new TH2F("ESD_InvMass_Mother_Sub_InvMass_Neutral_Pt","ESD_InvMass_Mother_Sub_InvMass_Neutral_Pt",HistoNMassBinsSub,HistoMassRangeSub[0],HistoMassRangeSub[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1175  fHistoMotherInvMassSubNDM[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{+} #pi^{-} %s} - (M_{%s}-M_{%s},PDG}) (GeV/c^{2})",NameNDMLatex.Data(),NameNDMLatex.Data(),NameNDMLatex.Data()));
1176  fHistoMotherInvMassSubNDM[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1177  fHistoMotherInvMassSubNDM[iCut]->Sumw2();
1178  fESDList[iCut]->Add(fHistoMotherInvMassSubNDM[iCut]);
1179 
1180  fHistoBackInvMassPtSubNDM[iCut] = new TH2F("ESD_Background_InvMass_Sub_InvMass_Neutral_Pt","ESD_Background_InvMass_Sub_InvMass_Neutral_Pt",
1181  HistoNMassBinsSub,HistoMassRangeSub[0],HistoMassRangeSub[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1182  fHistoBackInvMassPtSubNDM[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{+} #pi^{-} %s} - (M_{%s}-M_{%s},PDG}) (GeV/c^{2})",NameNDMLatex.Data(),NameNDMLatex.Data(),NameNDMLatex.Data()));
1183  fHistoBackInvMassPtSubNDM[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1184  fHistoBackInvMassPtSubNDM[iCut]->Sumw2();
1185  if(!(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseLikeSignMixing())&&(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation())){
1186  fESDList[iCut]->Add(fHistoBackInvMassPtSubNDM[iCut]);
1187  }
1188  fHistoMotherLikeSignBackInvMassSubNDMPt[iCut] = new TH2F("ESD_Background_LikeSign_InvMass_Sub_InvMass_Neutral_Pt","ESD_Background_LikeSign_InvMass_Sub_InvMass_Neutral_Pt",
1189  HistoNMassBinsSub,HistoMassRangeSub[0],HistoMassRangeSub[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1190  fHistoMotherLikeSignBackInvMassSubNDMPt[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{#pm} #pi^{#pm} %s} - M_{%s} (GeV/c^{2})",NameNDMLatex.Data(),NameNDMLatex.Data()));
1191  fHistoMotherLikeSignBackInvMassSubNDMPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1193  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseLikeSignMixing()){
1195  }
1196  fHistoMotherInvMassFixedPzNDM[iCut] = new TH2F("ESD_InvMass_Mother_FixedPz_Neutral_Pt","ESD_Mother_InvMass_FixedPz_Neutral_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1197  fHistoMotherInvMassFixedPzNDM[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{+} #pi^{-} %s} (GeV/c^{2})",NameNDMLatex.Data()));
1198  fHistoMotherInvMassFixedPzNDM[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1199  fHistoMotherInvMassFixedPzNDM[iCut]->Sumw2();
1200  fESDList[iCut]->Add(fHistoMotherInvMassFixedPzNDM[iCut]);
1201 
1202  fHistoBackInvMassPtFixedPzNDM[iCut] = new TH2F("ESD_Background_InvMass_FixedPz_Neutral_Pt","ESD_Background_InvMass_FixedPz_Neutral_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1203  fHistoBackInvMassPtFixedPzNDM[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{+} #pi^{-} %s} (GeV/c^{2})",NameNDMLatex.Data()));
1204  fHistoBackInvMassPtFixedPzNDM[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1205  fHistoBackInvMassPtFixedPzNDM[iCut]->Sumw2();
1206  if(!(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseLikeSignMixing()) && (((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation())){
1207  fESDList[iCut]->Add(fHistoBackInvMassPtFixedPzNDM[iCut]);
1208  }
1209  fHistoMotherLikeSignBackInvMassFixedPzNDMPt[iCut] = new TH2F("ESD_Background_LikeSign_InvMass_FixedPz_Neutral_Pt","ESD_Background_LikeSign_InvMass_FixedPz_Neutral_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1210  fHistoMotherLikeSignBackInvMassFixedPzNDMPt[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{#pm} #pi^{#pm} %s} (GeV/c^{2})",NameNDMLatex.Data()));
1211  fHistoMotherLikeSignBackInvMassFixedPzNDMPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1213  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseLikeSignMixing()){
1215  }
1216  if(!fDoLightOutput){
1217  fHistoAngleHNMesonPiPlPiMi[iCut] = new TH2F(Form("ESD_Mother_Angle%sNegPionsPosPions_Pt",NameNeutralMesonAnalyzed.Data()),Form("ESD_Mother_Angle%sNegPionsPosPions_Pt",NameNeutralMesonAnalyzed.Data()),HistoNPtBins,HistoPtRange[0],HistoPtRange[1],360,0,TMath::Pi());
1218  fHistoAngleHNMesonPiPlPiMi[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1219  fHistoAngleHNMesonPiPlPiMi[iCut]->GetYaxis()->SetTitle("#angle (meson,#pi^{+}#pi^{-})");
1220  fHistoAngleHNMesonPiPlPiMi[iCut]->Sumw2();
1221  fESDList[iCut]->Add(fHistoAngleHNMesonPiPlPiMi[iCut]);
1222  fHistoAngleHNMesonPiMi[iCut] = new TH2F(Form("ESD_Mother_Angle%sNegPions_Pt",NameNeutralMesonAnalyzed.Data()),Form("ESD_Mother_Angle%sNegPions_Pt",NameNeutralMesonAnalyzed.Data()),HistoNPtBins,HistoPtRange[0],HistoPtRange[1],360,0,TMath::Pi());
1223  fHistoAngleHNMesonPiMi[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1224  fHistoAngleHNMesonPiMi[iCut]->GetYaxis()->SetTitle("#angle (meson,#pi^{-})");
1225  fHistoAngleHNMesonPiMi[iCut]->Sumw2();
1226  fESDList[iCut]->Add(fHistoAngleHNMesonPiMi[iCut]);
1227  fHistoAngleHNMesonPiPl[iCut] = new TH2F(Form("ESD_Mother_Angle%sPosPions_Pt",NameNeutralMesonAnalyzed.Data()),Form("ESD_Mother_Angle%sPosPions_Pt",NameNeutralMesonAnalyzed.Data()),HistoNPtBins,HistoPtRange[0],HistoPtRange[1],360,0,TMath::Pi());
1228  fHistoAngleHNMesonPiPl[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1229  fHistoAngleHNMesonPiPl[iCut]->GetYaxis()->SetTitle("#angle (meson,#pi^{+})");
1230  fHistoAngleHNMesonPiPl[iCut]->Sumw2();
1231  fESDList[iCut]->Add(fHistoAngleHNMesonPiPl[iCut]);
1232  fHistoAngleHNMesonNDM[iCut] = new TH2F(Form("ESD_Mother_Angle%s%s_Pt",NameNeutralMesonAnalyzed.Data(),NameNDM.Data()),Form("ESD_Mother_Angle%s%s_Pt",NameNeutralMesonAnalyzed.Data(),NameNDM.Data()),HistoNPtBins,HistoPtRange[0],HistoPtRange[1],360,0,TMath::Pi());
1233  fHistoAngleHNMesonNDM[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1234  fHistoAngleHNMesonNDM[iCut]->GetYaxis()->SetTitle(Form("#angle (meson,%s)",NameNDMLatex.Data()));
1235  fHistoAngleHNMesonNDM[iCut]->Sumw2();
1236  fESDList[iCut]->Add(fHistoAngleHNMesonNDM[iCut]);
1237  fHistoAnglePiPlNDM[iCut] = new TH2F(Form("ESD_Mother_AnglePosPions%s_Pt",NameNDM.Data()),Form("ESD_Mother_AnglePosPions%s_Pt",NameNDM.Data()),HistoNPtBins,HistoPtRange[0],HistoPtRange[1],360,0,TMath::Pi());
1238  fHistoAnglePiPlNDM[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1239  fHistoAnglePiPlNDM[iCut]->GetYaxis()->SetTitle(Form("#angle (#pi^{+},%s)",NameNDMLatex.Data()));
1240  fHistoAnglePiPlNDM[iCut]->Sumw2();
1241  fESDList[iCut]->Add(fHistoAnglePiPlNDM[iCut]);
1242  fHistoAnglePiPlPiMi[iCut] = new TH2F("ESD_Mother_AnglePosPionsNegPions_Pt","ESD_Mother_AnglePosPionsNegPions_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1],360,0,TMath::Pi());
1243  fHistoAnglePiPlPiMi[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1244  fHistoAnglePiPlPiMi[iCut]->GetYaxis()->SetTitle("#angle (#pi^{+},#pi^{-})");
1245  fHistoAnglePiPlPiMi[iCut]->Sumw2();
1246  fESDList[iCut]->Add(fHistoAnglePiPlPiMi[iCut]);
1247  fHistoAngleNDMPiMi[iCut] = new TH2F(Form("ESD_Mother_Angle%sNegPions_Pt",NameNDM.Data()),Form("ESD_Mother_Angle%sNegPions_Pt",NameNDM.Data()),HistoNPtBins,HistoPtRange[0],HistoPtRange[1],360,0,TMath::Pi());
1248  fHistoAngleNDMPiMi[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1249  fHistoAngleNDMPiMi[iCut]->GetYaxis()->SetTitle(Form("#angle (%s,#pi^{-})",NameNDMLatex.Data()));
1250  fHistoAngleNDMPiMi[iCut]->Sumw2();
1251  fESDList[iCut]->Add(fHistoAngleNDMPiMi[iCut]);
1252  fHistoAngleSum[iCut] = new TH2F("ESD_Mother_AngleSum_Pt","ESD_Mother_AngleSum_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1],720,0,2*TMath::Pi());
1253  fHistoAngleSum[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1254  fHistoAngleSum[iCut]->GetYaxis()->SetTitle("#sum #angle");
1255  fHistoAngleSum[iCut]->Sumw2();
1256  fESDList[iCut]->Add(fHistoAngleSum[iCut]);
1257  }
1258  if ( fDoMesonQA>0 && (!fDoLightOutput) ) {
1259  TAxis *AxisAfter = fHistoPionTPCdEdxNSigma[iCut]->GetXaxis();
1260  Int_t bins = AxisAfter->GetNbins();
1261  Double_t from = AxisAfter->GetXmin();
1262  Double_t to = AxisAfter->GetXmax();
1263  Double_t *newBins = new Double_t[bins+1];
1264  newBins[0] = from;
1265  Double_t factor = TMath::Power(to/from, 1./bins);
1266  for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
1267 
1268  AxisAfter->Set(bins, newBins);
1269  AxisAfter = fHistoPionTPCdEdx[iCut]->GetXaxis();
1270  AxisAfter->Set(bins, newBins);
1271  delete [] newBins;
1272  }
1273 
1274  fCutFolder[iCut]->Add(fESDList[iCut]);
1275 
1276  }
1277 
1278  if( fIsMC ){
1279  // MC Histogramms
1280  fMCList = new TList*[fnCuts];
1281  // True Histogramms
1282  fTrueList = new TList*[fnCuts];
1283  if(!fDoLightOutput){
1284  if (fNDMRecoMode < 2){
1285  fHistoTrueConvGammaPt = new TH1F*[fnCuts];
1288  }
1289  if (fNDMRecoMode > 0){
1290  fHistoTrueClusterGammaPt = new TH1F*[fnCuts];
1292  }
1293  fHistoTruePosPionPt = new TH1F*[fnCuts];
1294  fHistoTrueNegPionPt = new TH1F*[fnCuts];
1297 
1298 
1299  fHistoMCAllGammaPt = new TH1F*[fnCuts];
1300  if (fNDMRecoMode < 2){
1301  fHistoMCConvGammaPt = new TH1F*[fnCuts];
1302  }
1303  fHistoMCAllPosPionsPt = new TH1F*[fnCuts];
1304  fHistoMCAllNegPionsPt = new TH1F*[fnCuts];
1308 
1309  if(fDoMesonQA > 0){
1310  fHistoMCAllMesonPt = new TH1F*[fnCuts];
1311  fHistoMCAllMesonEta = new TH1F*[fnCuts];
1312  fHistoMCAllMesonPhi = new TH1F*[fnCuts];
1316  fHistoMCAllPosPionsEta = new TH1F*[fnCuts];
1317  fHistoMCAllPosPionsPhi = new TH1F*[fnCuts];
1318  fHistoMCAllNegPionsEta = new TH1F*[fnCuts];
1319  fHistoMCAllNegPionsPhi = new TH1F*[fnCuts];
1324  fHistoMCHeavyAllPt = new TH1F*[fnCuts];
1325  fHistoMCHeavyAllEta = new TH1F*[fnCuts];
1326  fHistoMCHeavyAllPhi = new TH1F*[fnCuts];
1327  fHistoMCHeavyChannelPt = new TH1F*[fnCuts];
1328  fHistoMCHeavyChannelEta = new TH1F*[fnCuts];
1329  fHistoMCHeavyChannelPhi = new TH1F*[fnCuts];
1330  fHistMCChannelNDMFromHeavyPt = new TH1F*[fnCuts];
1357  }
1358  }
1359  fHistoMCHNMPiPlPiMiNDMPt = new TH1F*[fnCuts];
1361  if(!fDoLightOutput){
1363  fHistoMCHNMPiPlPiMiNDMEta = new TH1F*[fnCuts];
1364  fHistoMCHNMPiPlPiMiNDMPhi = new TH1F*[fnCuts];
1367  }
1371  if(!fDoLightOutput){
1374  fHistoTrueAngleSum = new TH2F*[fnCuts];
1376  }
1377  if(!fDoLightOutput){
1378  if (fDoMesonQA>0){
1382 
1399 
1404 
1408  fHistoTruevParticledS = new TH1F*[fnCuts];
1410  fHistoTruevParticleFromHNMdS = new TH1F*[fnCuts];
1411 
1412 
1413  if (fDoMesonQA>1){
1414  fTrueTreeList = new TList*[fnCuts];
1417  fTreeEventInfoHNM = new TTree*[fnCuts];
1418  }
1419  }
1420  }
1421 
1422  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1423  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
1424  TString cutstringPion = ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->GetCutNumber();
1425  TString cutstringConvGamma = "";
1426  if (fNDMRecoMode < 2)
1427  cutstringConvGamma = ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutNumber();
1428  TString cutstringCaloGamma = "";
1429  if (fNDMRecoMode > 0)
1430  cutstringCaloGamma = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
1431  TString cutstringNeutralPion = ((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(iCut))->GetCutNumber();
1432  TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
1433 
1434  TString fullCutString = "";
1435  if (fNDMRecoMode == 0)
1436  fullCutString = Form("%i_%s_%s_%s_%s_%s",fNDMRecoMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),
1437  cutstringMeson.Data());
1438  else if (fNDMRecoMode == 1)
1439  fullCutString = Form("%i_%s_%s_%s_%s_%s_%s",fNDMRecoMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringCaloGamma.Data(), cutstringNeutralPion.Data(),
1440  cutstringPion.Data(), cutstringMeson.Data());
1441  else if (fNDMRecoMode == 2)
1442  fullCutString = Form("%i_%s_%s_%s_%s_%s",fNDMRecoMode,cutstringEvent.Data(), cutstringCaloGamma.Data(), cutstringNeutralPion.Data(), cutstringPion.Data(),
1443  cutstringMeson.Data());
1444  TString nameMCList = Form("%s MC histograms", fullCutString.Data());
1445  TString nameTrueRecList = Form("%s True histograms", fullCutString.Data());
1446  TString nameTrueRecTTreeList = Form("%s True TTrees", fullCutString.Data());
1447 
1448  fMCList[iCut] = new TList();
1449  fMCList[iCut]->SetName(nameMCList.Data());
1450  fMCList[iCut]->SetOwner(kTRUE);
1451  fCutFolder[iCut]->Add(fMCList[iCut]);
1452 
1453  if(!fDoLightOutput){
1454  fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1455  fHistoMCAllGammaPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1456  fHistoMCAllGammaPt[iCut]->GetYaxis()->SetTitle("N_{#gamma}");
1457  fHistoMCAllGammaPt[iCut]->Sumw2();
1458  fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
1459  if (fNDMRecoMode < 2){
1460  fHistoMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt","MC_ConvGamma_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1461  fHistoMCConvGammaPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1462  fHistoMCConvGammaPt[iCut]->GetYaxis()->SetTitle("N_{#gamma,conv}");
1463  fHistoMCConvGammaPt[iCut]->Sumw2();
1464  fMCList[iCut]->Add(fHistoMCConvGammaPt[iCut]);
1465  }
1466  fHistoMCGammaFromNeutralMesonPt[iCut] = new TH1F("MC_GammaFromNeutralMeson_Pt","MC_GammaFromNeutralMeson_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1467  fHistoMCGammaFromNeutralMesonPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1468  fHistoMCGammaFromNeutralMesonPt[iCut]->GetYaxis()->SetTitle("N_{#gamma}");
1469  fHistoMCGammaFromNeutralMesonPt[iCut]->Sumw2();
1470  fMCList[iCut]->Add(fHistoMCGammaFromNeutralMesonPt[iCut]);
1471  fHistoMCAllPosPionsPt[iCut] = new TH1F("MC_AllPosPions_Pt","MC_AllPosPions_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1472  fHistoMCAllPosPionsPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1473  fHistoMCAllPosPionsPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
1474  fHistoMCAllPosPionsPt[iCut]->Sumw2();
1475  fMCList[iCut]->Add(fHistoMCAllPosPionsPt[iCut]);
1476  fHistoMCAllNegPionsPt[iCut] = new TH1F("MC_AllNegPions_Pt","MC_AllNegPions_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1477  fHistoMCAllNegPionsPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1478  fHistoMCAllNegPionsPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
1479  fHistoMCAllNegPionsPt[iCut]->Sumw2();
1480  fMCList[iCut]->Add(fHistoMCAllNegPionsPt[iCut]);
1481  fHistoMCNegPionsFromNeutralMesonPt[iCut] = new TH1F("MC_NegPionsFromNeutralMeson_Pt","MC_NegPionsFromNeutralMeson_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1482  fHistoMCNegPionsFromNeutralMesonPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1483  fHistoMCNegPionsFromNeutralMesonPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
1484  fHistoMCNegPionsFromNeutralMesonPt[iCut]->Sumw2();
1485  fMCList[iCut]->Add(fHistoMCNegPionsFromNeutralMesonPt[iCut]);
1486  fHistoMCPosPionsFromNeutralMesonPt[iCut] = new TH1F("MC_PosPionsFromNeutralMeson_Pt","MC_PosPionsFromNeutralMeson_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1487  fHistoMCPosPionsFromNeutralMesonPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1488  fHistoMCPosPionsFromNeutralMesonPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
1489  fHistoMCPosPionsFromNeutralMesonPt[iCut]->Sumw2();
1490  fMCList[iCut]->Add(fHistoMCPosPionsFromNeutralMesonPt[iCut]);
1491  if (fDoMesonQA>0){
1492  fHistoMCAllMesonPt[iCut] = new TH1F("MC_AllNDM_Pt", "MC_AllNDM_Pt", HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1493  fHistoMCAllMesonPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1494  fHistoMCAllMesonPt[iCut]->GetYaxis()->SetTitle(Form("N_{%s}}", NameNDMLatex.Data()));
1495  fHistoMCAllMesonPt[iCut]->Sumw2();
1496  fMCList[iCut]->Add(fHistoMCAllMesonPt[iCut]);
1497  fHistoMCAllMesonEta[iCut] = new TH1F("MC_AllNDM_Eta", "MC_AllNDM_Eta", 200, -2, 2);
1498  fHistoMCAllMesonEta[iCut]->GetXaxis()->SetTitle("#eta");
1499  fHistoMCAllMesonEta[iCut]->GetYaxis()->SetTitle(Form("N_{%s}}", NameNDMLatex.Data()));
1500  fHistoMCAllMesonEta[iCut]->Sumw2();
1501  fMCList[iCut]->Add(fHistoMCAllMesonEta[iCut]);
1502  fHistoMCAllMesonPhi[iCut] = new TH1F("MC_AllNDM_Phi", "MC_AllNDM_Phi", 200, 0, TMath::TwoPi());
1503  fHistoMCAllMesonPhi[iCut]->GetXaxis()->SetTitle("#varphi");
1504  fHistoMCAllMesonPhi[iCut]->GetYaxis()->SetTitle(Form("N_{%s}}", NameNDMLatex.Data()));
1505  fHistoMCAllMesonPhi[iCut]->Sumw2();
1506  fMCList[iCut]->Add(fHistoMCAllMesonPhi[iCut]);
1507  fHistoMCMesonFromNeutralMesonPt[iCut] = new TH1F("MC_NDMFromNeutralMeson_Pt", "MC_NDMFormNeutralMeson_Pt", HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1508  fHistoMCMesonFromNeutralMesonPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1509  fHistoMCMesonFromNeutralMesonPt[iCut]->GetYaxis()->SetTitle(Form("N_{%s}}", NameNDMLatex.Data()));
1510  fHistoMCMesonFromNeutralMesonPt[iCut]->Sumw2();
1511  fMCList[iCut]->Add(fHistoMCMesonFromNeutralMesonPt[iCut]);
1512  fHistoMCMesonFromNeutralMesonEta[iCut] = new TH1F("MC_NDMFromNeutralMeson_Eta", "MC_NDMFromNeutralMeson_Eta", 200, -2, 2);
1513  fHistoMCMesonFromNeutralMesonEta[iCut]->GetXaxis()->SetTitle("#eta");
1514  fHistoMCMesonFromNeutralMesonEta[iCut]->GetYaxis()->SetTitle(Form("N_{%s}}", NameNDMLatex.Data()));
1515  fHistoMCMesonFromNeutralMesonEta[iCut]->Sumw2();
1516  fMCList[iCut]->Add(fHistoMCMesonFromNeutralMesonEta[iCut]);
1517  fHistoMCMesonFromNeutralMesonPhi[iCut] = new TH1F("MC_NDMFromNeutralMeson_Phi", "MC_NDMFromNeutralMeson_Phi", 200, 0, TMath::TwoPi());
1518  fHistoMCMesonFromNeutralMesonPhi[iCut]->GetXaxis()->SetTitle("#varphi");
1519  fHistoMCMesonFromNeutralMesonPhi[iCut]->GetYaxis()->SetTitle(Form("N_{%s}}", NameNDMLatex.Data()));
1520  fHistoMCMesonFromNeutralMesonPhi[iCut]->Sumw2();
1521  fMCList[iCut]->Add(fHistoMCMesonFromNeutralMesonPhi[iCut]);
1522  fHistoMCAllPosPionsEta[iCut] = new TH1F("MC_AllPosPions_Eta","MC_AllPosPions_Eta", 200, -2., 2.);
1523  fHistoMCAllPosPionsEta[iCut]->GetXaxis()->SetTitle("#eta");
1524  fHistoMCAllPosPionsEta[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
1525  fHistoMCAllPosPionsEta[iCut]->Sumw2();
1526  fMCList[iCut]->Add(fHistoMCAllPosPionsEta[iCut]);
1527  fHistoMCAllPosPionsPhi[iCut] = new TH1F("MC_AllPosPions_Phi","MC_AllPosPions_Phi", 200, 0., TMath::TwoPi());
1528  fHistoMCAllPosPionsPhi[iCut]->GetXaxis()->SetTitle("#phi");
1529  fHistoMCAllPosPionsPhi[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
1530  fHistoMCAllPosPionsPhi[iCut]->Sumw2();
1531  fMCList[iCut]->Add(fHistoMCAllPosPionsPhi[iCut]);
1532  fHistoMCAllNegPionsEta[iCut] = new TH1F("MC_AllNegPions_Eta","MC_AllNegPions_Eta", 200, -2., 2.);
1533  fHistoMCAllNegPionsEta[iCut]->GetXaxis()->SetTitle("#eta");
1534  fHistoMCAllNegPionsEta[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
1535  fHistoMCAllNegPionsEta[iCut]->Sumw2();
1536  fMCList[iCut]->Add(fHistoMCAllNegPionsEta[iCut]);
1537  fHistoMCAllNegPionsPhi[iCut] = new TH1F("MC_AllNegPions_Phi","MC_AllNegPions_Phi", 200, 0., TMath::TwoPi());
1538  fHistoMCAllNegPionsPhi[iCut]->GetXaxis()->SetTitle("#phi");
1539  fHistoMCAllNegPionsPhi[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
1540  fHistoMCAllNegPionsPhi[iCut]->Sumw2();
1541  fMCList[iCut]->Add(fHistoMCAllNegPionsPhi[iCut]);
1542  fHistoMCPosPionsFromNeutralMesonEta[iCut] = new TH1F("MC_PosPionsFromNeutralMeson_Eta","MC_PosPionsFromNeutralMeson_Eta", 200, -2., 2.);
1543  fHistoMCPosPionsFromNeutralMesonEta[iCut]->GetXaxis()->SetTitle("#eta");
1544  fHistoMCPosPionsFromNeutralMesonEta[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
1545  fHistoMCPosPionsFromNeutralMesonEta[iCut]->Sumw2();
1546  fMCList[iCut]->Add(fHistoMCPosPionsFromNeutralMesonEta[iCut]);
1547  fHistoMCPosPionsFromNeutralMesonPhi[iCut] = new TH1F("MC_PosPionsFromNeutralMeson_Phi","MC_PosPionsFromNeutralMeson_Phi", 200, 0., TMath::TwoPi());
1548  fHistoMCPosPionsFromNeutralMesonPhi[iCut]->GetXaxis()->SetTitle("#phi");
1549  fHistoMCPosPionsFromNeutralMesonPhi[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
1550  fHistoMCPosPionsFromNeutralMesonPhi[iCut]->Sumw2();
1551  fMCList[iCut]->Add(fHistoMCPosPionsFromNeutralMesonPhi[iCut]);
1552  fHistoMCNegPionsFromNeutralMesonEta[iCut] = new TH1F("MC_NegPionsFromNeutralMeson_Eta","MC_NegPionsFromNeutralMeson_Eta", 200, -2., 2.);
1553  fHistoMCNegPionsFromNeutralMesonEta[iCut]->GetXaxis()->SetTitle("#eta");
1554  fHistoMCNegPionsFromNeutralMesonEta[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
1555  fHistoMCNegPionsFromNeutralMesonEta[iCut]->Sumw2();
1556  fMCList[iCut]->Add(fHistoMCNegPionsFromNeutralMesonEta[iCut]);
1557  fHistoMCNegPionsFromNeutralMesonPhi[iCut] = new TH1F("MC_NegPionsFromNeutralMeson_Phi","MC_NegPionsFromNeutralMeson_Phi", 200, 0., TMath::TwoPi());
1558  fHistoMCNegPionsFromNeutralMesonPhi[iCut]->GetXaxis()->SetTitle("#phi");
1559  fHistoMCNegPionsFromNeutralMesonPhi[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
1560  fHistoMCNegPionsFromNeutralMesonPhi[iCut]->Sumw2();
1561 
1562  fMCList[iCut]->Add(fHistoMCNegPionsFromNeutralMesonPhi[iCut]);
1563  fHistoMCHeavyAllPt[iCut] = new TH1F("MC_HeavyAll_Pt", "MC_HeavyAll_Pt", HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1564  fHistoMCHeavyAllPt[iCut]->SetXTitle("p_{t} (GeV/c)");
1565  fHistoMCHeavyAllPt[iCut]->SetYTitle(Form("N_{%s}", NameNeutralMesonAnalyzedLatex.Data()));
1566  fHistoMCHeavyAllPt[iCut]->Sumw2();
1567  fMCList[iCut]->Add(fHistoMCHeavyAllPt[iCut]);
1568  fHistoMCHeavyAllEta[iCut] = new TH1F("MC_HeavyAll_Eta", "MC_HeavyAll_Eta", 200, -2., 2.);
1569  fHistoMCHeavyAllEta[iCut]->SetXTitle("#eta");
1570  fHistoMCHeavyAllEta[iCut]->SetYTitle(Form("N_{%s}", NameNeutralMesonAnalyzedLatex.Data()));
1571  fHistoMCHeavyAllEta[iCut]->Sumw2();
1572  fMCList[iCut]->Add(fHistoMCHeavyAllEta[iCut]);
1573  fHistoMCHeavyAllPhi[iCut] = new TH1F("MC_HeavyAll_Phi", "MC_HeavyAll_Phi", 200, 0., TMath::TwoPi());
1574  fHistoMCHeavyAllPhi[iCut]->SetXTitle("#phi{t} (GeV/c");
1575  fHistoMCHeavyAllPhi[iCut]->SetYTitle(Form("N_{%s}", NameNeutralMesonAnalyzedLatex.Data()));
1576  fHistoMCHeavyAllPhi[iCut]->Sumw2();
1577  fMCList[iCut]->Add(fHistoMCHeavyAllPhi[iCut]);
1578  fHistoMCHeavyChannelPt[iCut] = new TH1F("MC_HeavyChannel_Pt", "MC_HeavyChannel_Pt", HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1579  fHistoMCHeavyChannelPt[iCut]->SetXTitle("p_{t} (GeV/c)");
1580  fHistoMCHeavyChannelPt[iCut]->SetYTitle(Form("N_{%s}", NameNeutralMesonAnalyzedLatex.Data()));
1581  fHistoMCHeavyChannelPt[iCut]->Sumw2();
1582  fMCList[iCut]->Add(fHistoMCHeavyChannelPt[iCut]);
1583  fHistoMCHeavyChannelEta[iCut] = new TH1F("MC_HeavyChannel_Eta", "MC_HeavyChannel_Eta", 200, -2., 2.);
1584  fHistoMCHeavyAllEta[iCut]->SetXTitle("#eta");
1585  fHistoMCHeavyAllEta[iCut]->SetYTitle(Form("N_{%s}", NameNeutralMesonAnalyzedLatex.Data()));
1586  fHistoMCHeavyAllEta[iCut]->Sumw2();
1587  fMCList[iCut]->Add(fHistoMCHeavyChannelEta[iCut]);
1588  fHistoMCHeavyChannelPhi[iCut] = new TH1F("MC_HeavyChannel_Phi", "MC_HeavyChannel_Phi", 200, 0., TMath::TwoPi());
1589  fHistoMCHeavyChannelPhi[iCut]->SetXTitle("#phi{t} (GeV/c");
1590  fHistoMCHeavyChannelPhi[iCut]->SetYTitle(Form("N_{%s}", NameNeutralMesonAnalyzedLatex.Data()));
1591  fHistoMCHeavyChannelPhi[iCut]->Sumw2();
1592  fMCList[iCut]->Add(fHistoMCHeavyChannelPhi[iCut]);
1593  fHistMCChannelNDMFromHeavyPt[iCut] = new TH1F("MC_NDMFromHeavyChannel_Pt", "MC_NDMFromHeavyChannel_Pt", HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1594  fHistMCChannelNDMFromHeavyPt[iCut]->SetXTitle("p_{t} (GeV/c)");
1595  fHistMCChannelNDMFromHeavyPt[iCut]->SetYTitle(Form("N_{%s}", NameNDMLatex.Data()));
1596  fHistMCChannelNDMFromHeavyPt[iCut]->Sumw2();
1597  fMCList[iCut]->Add(fHistMCChannelNDMFromHeavyPt[iCut]);
1598  fHistMCChannelNDMFromHeavyEta[iCut] = new TH1F("MC_NDMFromHeavyChannel_Eta", "MC_NDMFromHeavyChannel_Eta", 200, -2., 2.);
1599  fHistMCChannelNDMFromHeavyEta[iCut]->SetXTitle("#eta");
1600  fHistMCChannelNDMFromHeavyEta[iCut]->SetYTitle(Form("N_{%s}", NameNDMLatex.Data()));
1601  fHistMCChannelNDMFromHeavyEta[iCut]->Sumw2();
1602  fMCList[iCut]->Add(fHistMCChannelNDMFromHeavyEta[iCut]);
1603  fHistMCChannelNDMFromHeavyPhi[iCut] = new TH1F("MC_NDMFromHeavyChannel_Phi", "MC_NDMFromHeavyChannel_Phi", 200, 0., TMath::TwoPi());
1604  fHistMCChannelNDMFromHeavyPhi[iCut]->SetXTitle("#phi");
1605  fHistMCChannelNDMFromHeavyPhi[iCut]->SetYTitle(Form("N_{%s}", NameNDMLatex.Data()));
1606  fHistMCChannelNDMFromHeavyPhi[iCut]->Sumw2();
1607  fMCList[iCut]->Add(fHistMCChannelNDMFromHeavyPhi[iCut]);
1608  fHistMCChannelPiPlusFromHeavyPt[iCut] = new TH1F("MC_PiPlusFromHeavyChannel_Pt", "MC_PiPlusFromHeavyChannel_Pt", HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1609  fHistMCChannelPiPlusFromHeavyPt[iCut]->SetXTitle("p_{t} (GeV/c)");
1610  fHistMCChannelPiPlusFromHeavyPt[iCut]->SetYTitle("N_{#pi^{+}}");
1611  fHistMCChannelPiPlusFromHeavyPt[iCut]->Sumw2();
1612  fMCList[iCut]->Add(fHistMCChannelPiPlusFromHeavyPt[iCut]);
1613  fHistMCChannelPiPlusFromHeavyEta[iCut] = new TH1F("MC_PiPlusFromHeavyChannel_Eta", "MC_PiPlusFromHeavyChannel_Eta", 200, -2., 2.);
1614  fHistMCChannelPiPlusFromHeavyEta[iCut]->SetXTitle("#eta");
1615  fHistMCChannelPiPlusFromHeavyEta[iCut]->SetYTitle("N_{#pi^{+}}");
1616  fHistMCChannelPiPlusFromHeavyEta[iCut]->Sumw2();
1617  fMCList[iCut]->Add(fHistMCChannelPiPlusFromHeavyEta[iCut]);
1618  fHistMCChannelPiPlusFromHeavyPhi[iCut] = new TH1F("MC_PiPlusFromHeavyChannel_Phi", "MC_PiPlusFromHeavyChannel_Phi", 200, 0., TMath::TwoPi());
1619  fHistMCChannelPiPlusFromHeavyPhi[iCut]->SetXTitle("#phi");
1620  fHistMCChannelPiPlusFromHeavyPhi[iCut]->SetYTitle("N_{#pi^{+}}");
1621  fHistMCChannelPiPlusFromHeavyPhi[iCut]->Sumw2();
1622  fMCList[iCut]->Add(fHistMCChannelPiPlusFromHeavyPhi[iCut]);
1623  fHistMCChannelPiMinusFromHeavyPt[iCut] = new TH1F("MC_PiMinusFromHeavyChannel_Pt", "MC_PiMinusFromHeavyChannel_Pt", HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1624  fHistMCChannelPiMinusFromHeavyPt[iCut]->SetXTitle("p_{t} (GeV/c)");
1625  fHistMCChannelPiMinusFromHeavyPt[iCut]->SetYTitle("N_{#pi^{-}}");
1626  fHistMCChannelPiMinusFromHeavyPt[iCut]->Sumw2();
1627  fMCList[iCut]->Add(fHistMCChannelPiMinusFromHeavyPt[iCut]);
1628  fHistMCChannelPiMinusFromHeavyEta[iCut] = new TH1F("MC_PiMinusFromHeavyChannel_Eta", "MC_PiMinusFromHeavyChannel_Eta", 200, -2., 2.);
1629  fHistMCChannelPiMinusFromHeavyEta[iCut]->SetXTitle("#eta");
1630  fHistMCChannelPiMinusFromHeavyEta[iCut]->SetYTitle("N_{#pi^{-}}");
1631  fHistMCChannelPiMinusFromHeavyEta[iCut]->Sumw2();
1632  fMCList[iCut]->Add(fHistMCChannelPiMinusFromHeavyEta[iCut]);
1633  fHistMCChannelPiPMinusFromHeavyPhi[iCut] = new TH1F("MC_PiMinusFromHeavyChannel_Phi", "MC_PiMinusFromHeavyChannel_Phi", 200, 0., TMath::TwoPi());
1634  fHistMCChannelPiPMinusFromHeavyPhi[iCut]->SetXTitle("#phi");
1635  fHistMCChannelPiPMinusFromHeavyPhi[iCut]->SetYTitle("N_{#pi^{-}}");
1636  fHistMCChannelPiPMinusFromHeavyPhi[iCut]->Sumw2();
1637  fMCList[iCut]->Add(fHistMCChannelPiPMinusFromHeavyPhi[iCut]);
1638 
1639  fHistMCChannelNDMPtHeavyPt[iCut] = new TH2F("MC_CorrPtNDMHeavyChannel", "MC_CorrPtNDMHeavyChannel", HistoNPtBins, HistoPtRange[0], HistoPtRange[1], HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1640  fHistMCChannelNDMPtHeavyPt[iCut]->SetXTitle(Form("p_{t, %s} (GeV/c)", NameNeutralMesonAnalyzedLatex.Data()));
1641  fHistMCChannelNDMPtHeavyPt[iCut]->SetYTitle(Form("p_{t, %s} (GeV/c)", NameNDMLatex.Data()));
1642  fHistMCChannelNDMPtHeavyPt[iCut]->SetZTitle(Form("N_{%s}", NameNeutralMesonAnalyzedLatex.Data()));
1643  fHistMCChannelNDMPtHeavyPt[iCut]->Sumw2();
1644  fMCList[iCut]->Add(fHistMCChannelNDMPtHeavyPt[iCut]);
1645  fHistMCChannelPiPlusPtHeavyPt[iCut] = new TH2F("MC_CorrPtPiPlusHeavyChannel", "MC_CorrPtPiPlusHeavyChannel", HistoNPtBins, HistoPtRange[0], HistoPtRange[1], HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1646  fHistMCChannelPiPlusPtHeavyPt[iCut]->SetXTitle(Form("p_{t, %s} (GeV/c)", NameNeutralMesonAnalyzedLatex.Data()));
1647  fHistMCChannelPiPlusPtHeavyPt[iCut]->SetYTitle("p_{t, #pi^{-}%s} (GeV/c)");
1648  fHistMCChannelPiPlusPtHeavyPt[iCut]->SetZTitle(Form("N_{%s}", NameNeutralMesonAnalyzedLatex.Data()));
1649  fHistMCChannelPiPlusPtHeavyPt[iCut]->Sumw2();
1650  fMCList[iCut]->Add(fHistMCChannelPiPlusPtHeavyPt[iCut]);
1651  fHistMCChannelPiMinusPtHeavyPt[iCut] = new TH2F("MC_CorrPtPiMinusHeavyChannel", "MC_CorrPtPiMinusHeavyChannel", HistoNPtBins, HistoPtRange[0], HistoPtRange[1], HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1652  fHistMCChannelPiMinusPtHeavyPt[iCut]->SetXTitle(Form("p_{t, %s} (GeV/c)", NameNeutralMesonAnalyzedLatex.Data()));
1653  fHistMCChannelPiMinusPtHeavyPt[iCut]->SetYTitle("p_{t, #pi^{-}%s} (GeV/c)");
1654  fHistMCChannelPiMinusPtHeavyPt[iCut]->SetZTitle(Form("N_{%s}", NameNeutralMesonAnalyzedLatex.Data()));
1655  fHistMCChannelPiMinusPtHeavyPt[iCut]->Sumw2();
1656  fMCList[iCut]->Add(fHistMCChannelPiMinusPtHeavyPt[iCut]);
1657 
1658  fHistoMCHeavyReconstructiblePt[iCut] = new TH1F("MC_HeavyReconstructible_Pt", "MC_HeavyReconstructible_Pt", HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1659  fHistoMCHeavyReconstructiblePt[iCut]->SetXTitle("p_{t} (GeV/c)");
1660  fHistoMCHeavyReconstructiblePt[iCut]->SetYTitle(Form("N_{%s}", NameNeutralMesonAnalyzedLatex.Data()));
1661  fHistoMCHeavyReconstructiblePt[iCut]->Sumw2();
1662  fMCList[iCut]->Add(fHistoMCHeavyReconstructiblePt[iCut]);
1663  fHistoMCHeavyReconstructibleEta[iCut] = new TH1F("MC_HeavyReconstructible_Eta", "MC_HeavyReconstructible_Eta", 200, -2., 2.);
1664  fHistoMCHeavyAllEta[iCut]->SetXTitle("#eta");
1665  fHistoMCHeavyAllEta[iCut]->SetYTitle(Form("N_{%s}", NameNeutralMesonAnalyzedLatex.Data()));
1666  fHistoMCHeavyAllEta[iCut]->Sumw2();
1667  fMCList[iCut]->Add(fHistoMCHeavyReconstructibleEta[iCut]);
1668  fHistoMCHeavyReconstructiblePhi[iCut] = new TH1F("MC_HeavyReconstructible_Phi", "MC_HeavyReconstructible_Phi", 200, 0., TMath::TwoPi());
1669  fHistoMCHeavyReconstructiblePhi[iCut]->SetXTitle("#phi{t} (GeV/c");
1670  fHistoMCHeavyReconstructiblePhi[iCut]->SetYTitle(Form("N_{%s}", NameNeutralMesonAnalyzedLatex.Data()));
1671  fHistoMCHeavyReconstructiblePhi[iCut]->Sumw2();
1672  fMCList[iCut]->Add(fHistoMCHeavyReconstructiblePhi[iCut]);
1673  fHistMCReconstructibleNDMFromHeavyPt[iCut] = new TH1F("MC_NDMFromHeavyReconstructible_Pt", "MC_NDMFromHeavyReconstructible_Pt", HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1674  fHistMCReconstructibleNDMFromHeavyPt[iCut]->SetXTitle("p_{t} (GeV/c)");
1675  fHistMCReconstructibleNDMFromHeavyPt[iCut]->SetYTitle(Form("N_{%s}", NameNDMLatex.Data()));
1676  fHistMCReconstructibleNDMFromHeavyPt[iCut]->Sumw2();
1677  fMCList[iCut]->Add(fHistMCReconstructibleNDMFromHeavyPt[iCut]);
1678  fHistMCReconstructibleNDMFromHeavyEta[iCut] = new TH1F("MC_NDMFromHeavyReconstructible_Eta", "MC_NDMFromHeavyReconstructible_Eta", 200, -2., 2.);
1679  fHistMCReconstructibleNDMFromHeavyEta[iCut]->SetXTitle("#eta");
1680  fHistMCReconstructibleNDMFromHeavyEta[iCut]->SetYTitle(Form("N_{%s}", NameNDMLatex.Data()));
1682  fMCList[iCut]->Add(fHistMCReconstructibleNDMFromHeavyEta[iCut]);
1683  fHistMCReconstructibleNDMFromHeavyPhi[iCut] = new TH1F("MC_NDMFromHeavyReconstructible_Phi", "MC_NDMFromHeavyReconstructible_Phi", 200, 0., TMath::TwoPi());
1684  fHistMCReconstructibleNDMFromHeavyPhi[iCut]->SetXTitle("#phi");
1685  fHistMCReconstructibleNDMFromHeavyPhi[iCut]->SetYTitle(Form("N_{%s}", NameNDMLatex.Data()));
1687  fMCList[iCut]->Add(fHistMCReconstructibleNDMFromHeavyPhi[iCut]);
1688  fHistMCReconstructiblePiPlusFromHeavyPt[iCut] = new TH1F("MC_PiPlusFromHeavyReconstructible_Pt", "MC_PiPlusFromHeavyReconstructible_Pt", HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1689  fHistMCReconstructiblePiPlusFromHeavyPt[iCut]->SetXTitle("p_{t} (GeV/c)");
1690  fHistMCReconstructiblePiPlusFromHeavyPt[iCut]->SetYTitle("N_{#pi^{+}}");
1692  fMCList[iCut]->Add(fHistMCReconstructiblePiPlusFromHeavyPt[iCut]);
1693  fHistMCReconstructiblePiPlusFromHeavyEta[iCut] = new TH1F("MC_PiPlusFromHeavyReconstructible_Eta", "MC_PiPlusFromHeavyReconstructible_Eta", 200, -2., 2.);
1694  fHistMCReconstructiblePiPlusFromHeavyEta[iCut]->SetXTitle("#eta");
1695  fHistMCReconstructiblePiPlusFromHeavyEta[iCut]->SetYTitle("N_{#pi^{+}}");
1697  fMCList[iCut]->Add(fHistMCReconstructiblePiPlusFromHeavyEta[iCut]);
1698  fHistMCReconstructiblePiPlusFromHeavyPhi[iCut] = new TH1F("MC_PiPlusFromHeavyReconstructible_Phi", "MC_PiPlusFromHeavyReconstructible_Phi", 200, 0., TMath::TwoPi());
1699  fHistMCReconstructiblePiPlusFromHeavyPhi[iCut]->SetXTitle("#phi");
1700  fHistMCReconstructiblePiPlusFromHeavyPhi[iCut]->SetYTitle("N_{#pi^{+}}");
1702  fMCList[iCut]->Add(fHistMCReconstructiblePiPlusFromHeavyPhi[iCut]);
1703  fHistMCReconstructiblePiMinusFromHeavyPt[iCut] = new TH1F("MC_PiMinusFromHeavyReconstructible_Pt", "MC_PiMinusFromHeavyReconstructible_Pt", HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1704  fHistMCReconstructiblePiMinusFromHeavyPt[iCut]->SetXTitle("p_{t} (GeV/c)");
1705  fHistMCReconstructiblePiMinusFromHeavyPt[iCut]->SetYTitle("N_{#pi^{-}}");
1707  fMCList[iCut]->Add(fHistMCReconstructiblePiMinusFromHeavyPt[iCut]);
1708  fHistMCReconstructiblePiMinusFromHeavyEta[iCut] = new TH1F("MC_PiMinusFromHeavyReconstructible_Eta", "MC_PiMinusFromHeavyReconstructible_Eta", 200, -2., 2.);
1709  fHistMCReconstructiblePiMinusFromHeavyEta[iCut]->SetXTitle("#eta");
1710  fHistMCReconstructiblePiMinusFromHeavyEta[iCut]->SetYTitle("N_{#pi^{-}}");
1712  fMCList[iCut]->Add(fHistMCReconstructiblePiMinusFromHeavyEta[iCut]);
1713  fHistMCReconstructiblePiPMinusFromHeavyPhi[iCut] = new TH1F("MC_PiMinusFromHeavyReconstructible_Phi", "MC_PiMinusFromHeavyReconstructible_Phi", 200, 0., TMath::TwoPi());
1714  fHistMCReconstructiblePiPMinusFromHeavyPhi[iCut]->SetXTitle("#phi");
1715  fHistMCReconstructiblePiPMinusFromHeavyPhi[iCut]->SetYTitle("N_{#pi^{-}}");
1717  fMCList[iCut]->Add(fHistMCReconstructiblePiPMinusFromHeavyPhi[iCut]);
1718 
1719  fHistMCReconstructibleNDMPtHeavyPt[iCut] = new TH2F("MC_CorrPtNDMHeavyReconstructible", "MC_CorrPtNDMHeavyReconstructible", HistoNPtBins, HistoPtRange[0], HistoPtRange[1], HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1720  fHistMCReconstructibleNDMPtHeavyPt[iCut]->SetXTitle(Form("p_{t, %s} (GeV/c)", NameNeutralMesonAnalyzedLatex.Data()));
1721  fHistMCReconstructibleNDMPtHeavyPt[iCut]->SetYTitle(Form("p_{t, %s} (GeV/c)", NameNDMLatex.Data()));
1722  fHistMCReconstructibleNDMPtHeavyPt[iCut]->SetZTitle(Form("N_{%s}", NameNeutralMesonAnalyzedLatex.Data()));
1723  fHistMCReconstructibleNDMPtHeavyPt[iCut]->Sumw2();
1724  fMCList[iCut]->Add(fHistMCReconstructibleNDMPtHeavyPt[iCut]);
1725  fHistMCReconstructiblePiPlusPtHeavyPt[iCut] = new TH2F("MC_CorrPtPiPlusHeavyReconstructible", "MC_CorrPtPiPlusHeavyReconstructible", HistoNPtBins, HistoPtRange[0], HistoPtRange[1], HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1726  fHistMCReconstructiblePiPlusPtHeavyPt[iCut]->SetXTitle(Form("p_{t, %s} (GeV/c)", NameNeutralMesonAnalyzedLatex.Data()));
1727  fHistMCReconstructiblePiPlusPtHeavyPt[iCut]->SetYTitle("p_{t, #pi^{-}%s} (GeV/c)");
1728  fHistMCReconstructiblePiPlusPtHeavyPt[iCut]->SetZTitle(Form("N_{%s}", NameNeutralMesonAnalyzedLatex.Data()));
1730  fMCList[iCut]->Add(fHistMCReconstructiblePiPlusPtHeavyPt[iCut]);
1731  fHistMCReconstructiblePiMinusPtHeavyPt[iCut] = new TH2F("MC_CorrPtPiMinusHeavyReconstructible", "MC_CorrPtPiMinusHeavyReconstructible", HistoNPtBins, HistoPtRange[0], HistoPtRange[1], HistoNPtBins, HistoPtRange[0], HistoPtRange[1]);
1732  fHistMCReconstructiblePiMinusPtHeavyPt[iCut]->SetXTitle(Form("p_{t, %s} (GeV/c)", NameNeutralMesonAnalyzedLatex.Data()));
1733  fHistMCReconstructiblePiMinusPtHeavyPt[iCut]->SetYTitle("p_{t, #pi^{-}%s} (GeV/c)");
1734  fHistMCReconstructiblePiMinusPtHeavyPt[iCut]->SetZTitle(Form("N_{%s}", NameNeutralMesonAnalyzedLatex.Data()));
1736  fMCList[iCut]->Add(fHistMCReconstructiblePiMinusPtHeavyPt[iCut]);
1737  }
1738  }
1739  fHistoMCHNMPiPlPiMiNDMPt[iCut] = new TH1F("MC_HNM_Pt","MC_HNM_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1740  fHistoMCHNMPiPlPiMiNDMPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1741  fHistoMCHNMPiPlPiMiNDMPt[iCut]->GetYaxis()->SetTitle("N_{HNM}");
1742  fHistoMCHNMPiPlPiMiNDMPt[iCut]->Sumw2();
1743  fMCList[iCut]->Add(fHistoMCHNMPiPlPiMiNDMPt[iCut]);
1744 
1745  fHistoMCHNMPiPlPiMiNDMInAccPt[iCut] = new TH1F("MC_HNMInAcc_Pt","MC_HNMInAcc_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1746  fHistoMCHNMPiPlPiMiNDMInAccPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1747  fHistoMCHNMPiPlPiMiNDMInAccPt[iCut]->GetYaxis()->SetTitle("A #times N_{HNM}");
1748  fHistoMCHNMPiPlPiMiNDMInAccPt[iCut]->Sumw2();
1749  fMCList[iCut]->Add(fHistoMCHNMPiPlPiMiNDMInAccPt[iCut]);
1750 
1751  if(!fDoLightOutput){
1752 
1753  fHistoMCHNMInAccVsNDMPt[iCut] = new TH2F("MC_HNMInAccVsNDMPt","MC_HNMInAccVsNDMPt",200,HistoPtRange[0],HistoPtRange[1],200,HistoPtRange[0],HistoPtRange[1]);
1754  fHistoMCHNMInAccVsNDMPt[iCut]->GetXaxis()->SetTitle("p_{T} of HNM (GeV/c)");
1755  fHistoMCHNMInAccVsNDMPt[iCut]->GetYaxis()->SetTitle("p_{T} of NDM (GeV/c)");
1756  fHistoMCHNMInAccVsNDMPt[iCut]->Sumw2();
1757  fMCList[iCut]->Add(fHistoMCHNMInAccVsNDMPt[iCut]);
1758  fHistoMCHNMPiPlPiMiNDMEta[iCut] = new TH1F("MC_HNM_Eta","MC_HNM_Eta",200,-2,2);
1759  fHistoMCHNMPiPlPiMiNDMEta[iCut]->GetXaxis()->SetTitle("#eta");
1760  fHistoMCHNMPiPlPiMiNDMEta[iCut]->GetYaxis()->SetTitle("N_{HNM}");
1761  fHistoMCHNMPiPlPiMiNDMEta[iCut]->Sumw2();
1762  fMCList[iCut]->Add(fHistoMCHNMPiPlPiMiNDMEta[iCut]);
1763 
1764  fHistoMCHNMPiPlPiMiNDMPhi[iCut] = new TH1F("MC_HNM_Phi","MC_HNM_Phi",200,0,2 * TMath::Pi());
1765  fHistoMCHNMPiPlPiMiNDMPhi[iCut]->GetXaxis()->SetTitle("#phi");
1766  fHistoMCHNMPiPlPiMiNDMPhi[iCut]->GetYaxis()->SetTitle("N_{HNM}");
1767  fHistoMCHNMPiPlPiMiNDMPhi[iCut]->Sumw2();
1768  fMCList[iCut]->Add(fHistoMCHNMPiPlPiMiNDMPhi[iCut]);
1769  }
1770 
1771  fTrueList[iCut] = new TList();
1772  fTrueList[iCut]->SetName(nameTrueRecList.Data());
1773  fTrueList[iCut]->SetOwner(kTRUE);
1774  fCutFolder[iCut]->Add(fTrueList[iCut]);
1775 
1776  if(!fDoLightOutput){
1777  if (fNDMRecoMode < 2){
1778  fHistoTrueConvGammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt","ESD_TrueConvGamma_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1779  fHistoTrueConvGammaPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1780  fHistoTrueConvGammaPt[iCut]->GetYaxis()->SetTitle("N_{#gamma,conv}");
1781  fHistoTrueConvGammaPt[iCut]->Sumw2();
1782  fTrueList[iCut]->Add(fHistoTrueConvGammaPt[iCut]);
1783  fHistoDoubleCountTrueConvGammaRPt[iCut] = new TH2F("ESD_TrueDoubleCountConvGamma_R_Pt","ESD_TrueDoubleCountConvGamma_R_Pt",800,0,200,HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1784  fHistoDoubleCountTrueConvGammaRPt[iCut]->GetXaxis()->SetTitle("R_{conv} (cm)");
1785  fHistoDoubleCountTrueConvGammaRPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1786  fHistoDoubleCountTrueConvGammaRPt[iCut]->Sumw2();
1787  fTrueList[iCut]->Add(fHistoDoubleCountTrueConvGammaRPt[iCut]);
1788  fHistoTrueConvGammaFromNeutralMesonPt[iCut] = new TH1F("ESD_TrueConvGammaFromNeutralMeson_Pt","ESD_TrueConvGammaFromNeutralMeson_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1789  fHistoTrueConvGammaFromNeutralMesonPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1790  fHistoTrueConvGammaFromNeutralMesonPt[iCut]->GetYaxis()->SetTitle("N_{#gamma,conv}");
1793  }
1794  if (fNDMRecoMode > 0){
1795  fHistoTrueClusterGammaPt[iCut] = new TH1F("ESD_TrueClusterGamma_Pt","ESD_TrueClusterGamma_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1796  fHistoTrueClusterGammaPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1797  fHistoTrueClusterGammaPt[iCut]->GetYaxis()->SetTitle("N_{#gamma,cluster}");
1798  fHistoTrueClusterGammaPt[iCut]->Sumw2();
1799  fTrueList[iCut]->Add(fHistoTrueClusterGammaPt[iCut]);
1800  fHistoTrueClusterGammaFromNeutralMesonPt[iCut] = new TH1F("ESD_TrueClusterGammaFromNeutralMeson_Pt","ESD_TrueClusterGammaFromNeutralMeson_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1801  fHistoTrueClusterGammaFromNeutralMesonPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1802  fHistoTrueClusterGammaFromNeutralMesonPt[iCut]->GetYaxis()->SetTitle("N_{#gamma,cluster}");
1805  }
1806  fHistoTruePosPionPt[iCut] = new TH1F("ESD_TruePosPion_Pt","ESD_TruePosPion_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1807  fHistoTruePosPionPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1808  fHistoTruePosPionPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
1809  fHistoTruePosPionPt[iCut]->Sumw2();
1810  fTrueList[iCut]->Add(fHistoTruePosPionPt[iCut]);
1811  fHistoTrueNegPionPt[iCut] = new TH1F("ESD_TrueNegPion_Pt","ESD_TrueNegPion_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1812  fHistoTrueNegPionPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1813  fHistoTrueNegPionPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
1814  fHistoTrueNegPionPt[iCut]->Sumw2();
1815  fTrueList[iCut]->Add(fHistoTrueNegPionPt[iCut]);
1816 
1817  fHistoTrueNegPionFromNeutralMesonPt[iCut] = new TH1F("ESD_TrueNegPionFromNeutralMeson_Pt","ESD_TrueNegPionFromNeutralMeson_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1818  fHistoTrueNegPionFromNeutralMesonPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1819  fHistoTrueNegPionFromNeutralMesonPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
1820  fHistoTrueNegPionFromNeutralMesonPt[iCut]->Sumw2();
1822  fHistoTruePosPionFromNeutralMesonPt[iCut] = new TH1F("ESD_TruePosPionFromNeutralMeson_Pt","ESD_TruePosPionFromNeutralMeson_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1823  fHistoTruePosPionFromNeutralMesonPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1824  fHistoTruePosPionFromNeutralMesonPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
1825  fHistoTruePosPionFromNeutralMesonPt[iCut]->Sumw2();
1827 
1828  fHistoDoubleCountTruePi0InvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountPi0_InvMass_Pt","ESD_TrueDoubleCountPi0_InvMass_Pt",800,0,0.8,HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1829  fHistoDoubleCountTruePi0InvMassPt[iCut]->GetXaxis()->SetTitle("M_{#gamma #gamma} (GeV/c^{2})");
1830  fHistoDoubleCountTruePi0InvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1831  fHistoDoubleCountTruePi0InvMassPt[iCut]->Sumw2();
1832  fTrueList[iCut]->Add(fHistoDoubleCountTruePi0InvMassPt[iCut]);
1833  fHistoDoubleCountTrueHNMInvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountHNM_InvMass_Pt","ESD_TrueDoubleCountHNM_InvMass_Pt",800,0,0.8,HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1834  fHistoDoubleCountTrueHNMInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#eta} (GeV/c^{2})");
1835  fHistoDoubleCountTrueHNMInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1836  fHistoDoubleCountTrueHNMInvMassPt[iCut]->Sumw2();
1837  fTrueList[iCut]->Add(fHistoDoubleCountTrueHNMInvMassPt[iCut]);
1838  }
1839  fHistoTrueMotherPiPlPiMiNDMInvMassPt[iCut] = new TH2F("ESD_TrueMotherPiPlPiMiNDM_InvMass_Pt","ESD_TrueMotherPiPlPiMiNDM_InvMass_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1840  fHistoTrueMotherPiPlPiMiNDMInvMassPt[iCut]->Sumw2();
1841  fHistoTrueMotherPiPlPiMiNDMInvMassPt[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{+} #pi^{-} %s} (GeV/c^{2})",NameNDMLatex.Data()));
1842  fHistoTrueMotherPiPlPiMiNDMInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1844 
1845  fHistoTrueMotherPiPlPiMiNDMInvMassPtSubNDM[iCut] = new TH2F("ESD_TrueMotherPiPlPiMiNDM_InvMass_SubNDM_Pt","ESD_TrueMotherPiPlPiMiNDM_InvMass_SubNDM_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1847  fHistoTrueMotherPiPlPiMiNDMInvMassPtSubNDM[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{+} #pi^{-} %s} (GeV/c^{2})",NameNDMLatex.Data()));
1848  fHistoTrueMotherPiPlPiMiNDMInvMassPtSubNDM[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1850 
1851  fHistoTrueMotherPiPlPiMiNDMInvMassPtFixedPzNDM[iCut] = new TH2F("ESD_TrueMotherPiPlPiMiNDM_InvMass_FixedPzNDM_Pt","ESD_TrueMotherPiPlPiMiNDM_InvMass_FixedPzNDM_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1853  fHistoTrueMotherPiPlPiMiNDMInvMassPtFixedPzNDM[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{+} #pi^{-} %s} (GeV/c^{2})",NameNDMLatex.Data()));
1854  fHistoTrueMotherPiPlPiMiNDMInvMassPtFixedPzNDM[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1856 
1857 
1858 
1859  if(!fDoLightOutput){
1860  fHistoTrueMotherGammaGammaInvMassPt[iCut] = new TH2F("ESD_TrueMotherGG_InvMass_Pt","ESD_TrueMotherGG_InvMass_Pt",HistoNMassBinsDecayMeson,HistoMassRangeNDM[0],HistoMassRangeNDM[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1861  fHistoTrueMotherGammaGammaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#gamma #gamma} (GeV/c^{2})");
1862  fHistoTrueMotherGammaGammaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1863  fHistoTrueMotherGammaGammaInvMassPt[iCut]->Sumw2();
1865  fHistoTrueMotherGammaGammaFromHNMInvMassPt[iCut] = new TH2F("ESD_TrueMotherGGFromHNM_InvMass_Pt","ESD_TrueMotherGGFromHNM_InvMass_Pt",HistoNMassBinsDecayMeson,HistoMassRangeNDM[0],HistoMassRangeNDM[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1866  fHistoTrueMotherGammaGammaFromHNMInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#gamma #gamma} (GeV/c^{2})");
1867  fHistoTrueMotherGammaGammaFromHNMInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1870  fHistoTrueAngleSum[iCut] = new TH2F("ESD_TrueMother_AngleSum_Pt","ESD_TrueMother_AngleSum_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1],720,0,2*TMath::Pi());
1871  fHistoTrueAngleSum[iCut]->GetXaxis()->SetTitle("#sum #angle");
1872  fHistoTrueAngleSum[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1873  fHistoTrueAngleSum[iCut]->Sumw2();
1874  fTrueList[iCut]->Add(fHistoTrueAngleSum[iCut]);
1875 
1876  fHistoTrueHNMesonPtvsNDMPt[iCut] = new TH2F("ESD_TrueMother_HNMesonPtvsNDMPt","ESD_TrueMother_HNMesonPtvsNDMPt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1877  fHistoTrueHNMesonPtvsNDMPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c) of HNM");
1878  fHistoTrueHNMesonPtvsNDMPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c) of NDM");
1879  fHistoTrueHNMesonPtvsNDMPt[iCut]->Sumw2();
1880  fTrueList[iCut]->Add(fHistoTrueHNMesonPtvsNDMPt[iCut]);
1881 
1882  if (fDoMesonQA>0){
1883  fHistoTruePionPionInvMassPt[iCut] = new TH2F("ESD_TruePiPlusPiNeg_InvMassPt","ESD_TruePiPlusPiNeg_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1884  fHistoTruePionPionInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1885  fHistoTruePionPionInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1886  fHistoTruePionPionInvMassPt[iCut]->Sumw2();
1887  fTrueList[iCut]->Add(fHistoTruePionPionInvMassPt[iCut]);
1888  fHistoTruePionPionFromSameMotherInvMassPt[iCut] = new TH2F("ESD_TruePiPlusPiNegFromSameMother_InvMassPt","ESD_TruePiPlusPiNegFromSameMother_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1889  fHistoTruePionPionFromSameMotherInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1890  fHistoTruePionPionFromSameMotherInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1893  fHistoTruePionPionFromHNMInvMassPt[iCut] = new TH2F("ESD_TruePiPlusPiNegFromHNM_InvMassPt","ESD_TruePiPlusPiNegFromHNM_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1894  fHistoTruePionPionFromHNMInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1895  fHistoTruePionPionFromHNMInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1896  fHistoTruePionPionFromHNMInvMassPt[iCut]->Sumw2();
1898 
1899  fHistoTruevParticleChi2PerNDF[iCut] = new TH1F("fHistoTruevParticleChi2PerNDF","fHistoTruevParticleChi2PerNDF",300,0,300);
1900  fHistoTruevParticleChi2PerNDF[iCut]->GetXaxis()->SetTitle("#chi^{2}/ndf");
1901  fHistoTruevParticleChi2PerNDF[iCut]->Sumw2();
1902  fTrueList[iCut]->Add(fHistoTruevParticleChi2PerNDF[iCut]);
1903 
1904  fHistoTruevParticleFromSameMotherChi2PerNDF[iCut] = new TH1F("fHistoTruevParticleFromSameMotherChi2PerNDF","fHistoTruevParticleFromSameMotherChi2PerNDF",300,0,300);
1905  fHistoTruevParticleFromSameMotherChi2PerNDF[iCut]->GetXaxis()->SetTitle("#chi^{2}/ndf");
1908 
1909  fHistoTruevParticleFromHNMChi2PerNDF[iCut] = new TH1F("fHistoTruevParticleFromHNMChi2PerNDF","fHistoTruevParticleFromHNMChi2PerNDF",300,0,300);
1910  fHistoTruevParticleFromHNMChi2PerNDF[iCut]->GetXaxis()->SetTitle("#chi^{2}/ndf");
1911  fHistoTruevParticleFromHNMChi2PerNDF[iCut]->Sumw2();
1913 
1914  fHistoTruevParticledS[iCut] = new TH1F("fHistoTruevParticledS","fHistoTruevParticledS",500,-4,4);
1915  fHistoTruevParticledS[iCut]->GetXaxis()->SetTitle("dS");
1916  fHistoTruevParticledS[iCut]->Sumw2();
1917  fTrueList[iCut]->Add(fHistoTruevParticledS[iCut]);
1918 
1919  fHistoTruevParticleFromSameMotherdS[iCut] = new TH1F("fHistoTruevParticleFromSameMotherdS","fHistoTruevParticleFromSameMotherdS",400,-4,4);
1920  fHistoTruevParticleFromSameMotherdS[iCut]->GetXaxis()->SetTitle("dS");
1921  fHistoTruevParticleFromSameMotherdS[iCut]->Sumw2();
1923 
1924  fHistoTruevParticleFromHNMdS[iCut] = new TH1F("fHistoTruevParticleFromHNMdS","fHistoTruevParticleFromHNMdS",400,-4,4);
1925  fHistoTruevParticleFromHNMdS[iCut]->GetXaxis()->SetTitle("dS");
1926  fHistoTruevParticleFromHNMdS[iCut]->Sumw2();
1927  fTrueList[iCut]->Add(fHistoTruevParticleFromHNMdS[iCut]);
1928 
1929  fHistoTruePiPlPiMiSameMotherFromEtaInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiMiSameMotherFromEta_InvMassPt","ESD_TruePiPlPiMiSameMotherFromEta_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1930  fHistoTruePiPlPiMiSameMotherFromEtaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1931  fHistoTruePiPlPiMiSameMotherFromEtaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1934  fHistoTruePiPlPiMiSameMotherFromOmegaInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiMiSameMotherFromOmega_InvMassPt","ESD_TruePiPlPiMiSameMotherFromOmega_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1935  fHistoTruePiPlPiMiSameMotherFromOmegaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1936  fHistoTruePiPlPiMiSameMotherFromOmegaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1939  fHistoTruePiPlPiMiSameMotherFromRhoInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiMiSameMotherFromRho_InvMassPt","ESD_TruePiPlPiMiSameMotherFromRho_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1940  fHistoTruePiPlPiMiSameMotherFromRhoInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1941  fHistoTruePiPlPiMiSameMotherFromRhoInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1944  fHistoTruePiPlPiMiSameMotherFromEtaPrimeInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiMiSameMotherFromEtaPrime_InvMassPt","ESD_TruePiPlPiMiSameMotherFromEtaPrime_InvMassPt",
1945  HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1946  fHistoTruePiPlPiMiSameMotherFromEtaPrimeInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1947  fHistoTruePiPlPiMiSameMotherFromEtaPrimeInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1950  fHistoTruePiPlPiMiSameMotherFromK0sInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiMiSameMotherFromK0s_InvMassPt","ESD_TruePiPlPiMiSameMotherFromK0s_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1951  fHistoTruePiPlPiMiSameMotherFromK0sInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1952  fHistoTruePiPlPiMiSameMotherFromK0sInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1955  fHistoTruePiPlPiMiSameMotherFromK0lInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiMiSameMotherFromK0l_InvMassPt","ESD_TruePiPlPiMiSameMotherFromK0l_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1956  fHistoTruePiPlPiMiSameMotherFromK0lInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1957  fHistoTruePiPlPiMiSameMotherFromK0lInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1960 
1961  fHistoTruePiMiPiZeroSameMotherFromEtaInvMassPt[iCut] = new TH2F("ESD_TruePiMiPiZeroSameMotherFromEta_InvMassPt","ESD_TruePiMiPiZeroSameMotherFromEta_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1962  fHistoTruePiMiPiZeroSameMotherFromEtaInvMassPt[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{-}%s} (GeV/c^{2})",NameNDMLatex.Data()));
1963  fHistoTruePiMiPiZeroSameMotherFromEtaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1966  fHistoTruePiMiPiZeroSameMotherFromOmegaInvMassPt[iCut] = new TH2F("ESD_TruePiMiPiZeroSameMotherFromOmega_InvMassPt","ESD_TruePiMiPiZeroSameMotherFromOmega_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1967  fHistoTruePiMiPiZeroSameMotherFromOmegaInvMassPt[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{-}%s} (GeV/c^{2})",NameNDMLatex.Data()));
1968  fHistoTruePiMiPiZeroSameMotherFromOmegaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1971  fHistoTruePiMiPiZeroSameMotherFromRhoInvMassPt[iCut] = new TH2F("ESD_TruePiMiPiZeroSameMotherFromRho_InvMassPt","ESD_TruePiMiPiZeroSameMotherFromRho_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1972  fHistoTruePiMiPiZeroSameMotherFromRhoInvMassPt[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{-}%s} (GeV/c^{2})",NameNDMLatex.Data()));
1973  fHistoTruePiMiPiZeroSameMotherFromRhoInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1976  fHistoTruePiMiPiZeroSameMotherFromK0lInvMassPt[iCut] = new TH2F("ESD_TruePiMiPiZeroSameMotherFromK0l_InvMassPt","ESD_TruePiMiPiZeroSameMotherFromK0l_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1977  fHistoTruePiMiPiZeroSameMotherFromK0lInvMassPt[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{-}%s} (GeV/c^{2})",NameNDMLatex.Data()));
1978  fHistoTruePiMiPiZeroSameMotherFromK0lInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1981 
1982  fHistoTruePiPlPiZeroSameMotherFromEtaInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiZeroSameMotherFromEta_InvMassPt","ESD_TruePiPlPiZeroSameMotherFromEta_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1983  fHistoTruePiPlPiZeroSameMotherFromEtaInvMassPt[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{+}%s} (GeV/c^{2})",NameNDMLatex.Data()));
1984  fHistoTruePiPlPiZeroSameMotherFromEtaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1987  fHistoTruePiPlPiZeroSameMotherFromOmegaInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiZeroSameMotherFromOmega_InvMassPt","ESD_TruePiPlPiZeroSameMotherFromOmega_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1988  fHistoTruePiPlPiZeroSameMotherFromOmegaInvMassPt[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{+}%s} (GeV/c^{2})",NameNDMLatex.Data()));
1989  fHistoTruePiPlPiZeroSameMotherFromOmegaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1992  fHistoTruePiPlPiZeroSameMotherFromRhoInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiZeroSameMotherFromRho_InvMassPt","ESD_TruePiPlPiZeroSameMotherFromRho_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1993  fHistoTruePiPlPiZeroSameMotherFromRhoInvMassPt[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{+}%s} (GeV/c^{2})",NameNDMLatex.Data()));
1994  fHistoTruePiMiPiZeroSameMotherFromRhoInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1997  fHistoTruePiPlPiZeroSameMotherFromK0lInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiZeroSameMotherFromK0l_InvMassPt","ESD_TruePiPlPiZeroSameMotherFromK0l_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1998  fHistoTruePiPlPiZeroSameMotherFromK0lInvMassPt[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{+}%s} (GeV/c^{2})",NameNDMLatex.Data()));
1999  fHistoTruePiPlPiZeroSameMotherFromK0lInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
2002  fHistoTruePiPlPiMiNDMPureCombinatoricalInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiMiNDMPureCombinatorical_InvMassPt","ESD_TruePiPlPiMiNDMPureCombinatorical_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
2003  fHistoTruePiPlPiMiNDMPureCombinatoricalInvMassPt[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{+}#pi^{-}%s} (GeV/c^{2})",NameNDMLatex.Data()));
2004  fHistoTruePiPlPiMiNDMPureCombinatoricalInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
2007  fHistoTruePiPlPiMiNDMContaminationInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiMiNDMContamination_InvMassPt","ESD_TruePiPlPiMiNDMContamination_InvMassPt",HistoNMassBinsPiPlusPiMinus,HistoMassRangePiPlusPiMinus[0],HistoMassRangePiPlusPiMinus[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
2008  fHistoTruePiPlPiMiNDMContaminationInvMassPt[iCut]->GetXaxis()->SetTitle(Form("M_{#pi^{+}#pi^{-}%s} (GeV/c^{2})",NameNDMLatex.Data()));
2009  fHistoTruePiPlPiMiNDMContaminationInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
2012 
2013  fHistoTrueMotherPiPlPiMiNDMDalitzPlotPosFixedPzNDM[iCut] = new TH2F("ESD_TrueMotherPiPlPiMiNDM_DalitzPlot_FixedPzNDM_Pos","ESD_TrueMotherPiPlPiMiNDM_DalitzPlot_FixedPzNDM_Pos",HistoNMassBins,HistoMassRange[0],HistoMassRangeDalitz,HistoNMassBins,HistoMassRange[0],HistoMassRangeDalitz);
2015  fHistoTrueMotherPiPlPiMiNDMDalitzPlotPosFixedPzNDM[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-}} (GeV/c^{2})");
2016  fHistoTrueMotherPiPlPiMiNDMDalitzPlotPosFixedPzNDM[iCut]->GetYaxis()->SetTitle(Form("M_{#pi^{+} %s} (GeV/c^{2})", NameNDMLatex.Data()));
2018 
2019  fHistoTrueMotherPiPlPiMiNDMDalitzPlotNegFixedPzNDM[iCut] = new TH2F("ESD_TrueMotherPiPlPiMiNDM_DalitzPlot_FixedPzNDM_Neg","ESD_TrueMotherPiPlPiMiNDM_DalitzPlot_FixedPzNDM_Neg",HistoNMassBins,HistoMassRange[0],HistoMassRangeDalitz,HistoNMassBins,HistoMassRange[0],HistoMassRangeDalitz);
2021  fHistoTrueMotherPiPlPiMiNDMDalitzPlotNegFixedPzNDM[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-}} (GeV/c^{2})");
2022  fHistoTrueMotherPiPlPiMiNDMDalitzPlotNegFixedPzNDM[iCut]->GetYaxis()->SetTitle(Form("M_{#pi^{-} %s} (GeV/c^{2})", NameNDMLatex.Data()));
2024 
2025  fHistoTrueMotherPiPlPiMiNDMDalitzPlotPosSubNDM[iCut] = new TH2F("ESD_TrueMotherPiPlPiMiNDM_DalitzPlot_SubNDM_Pos","ESD_TrueMotherPiPlPiMiNDM_DalitzPlot_SubNDM_Pos",HistoNMassBins,HistoMassRange[0],HistoMassRangeDalitz,HistoNMassBins,HistoMassRange[0],HistoMassRangeDalitz);
2027  fHistoTrueMotherPiPlPiMiNDMDalitzPlotPosSubNDM[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-}} (GeV/c^{2})");
2028  fHistoTrueMotherPiPlPiMiNDMDalitzPlotPosSubNDM[iCut]->GetYaxis()->SetTitle(Form("M_{#pi^{+} %s} (GeV/c^{2})", NameNDMLatex.Data()));
2030 
2031  fHistoTrueMotherPiPlPiMiNDMDalitzPlotNegSubNDM[iCut] = new TH2F("ESD_TrueMotherPiPlPiMiNDM_DalitzPlot_SubNDM_Neg","ESD_TrueMotherPiPlPiMiNDM_DalitzPlot_SubNDM_Neg",HistoNMassBins,HistoMassRange[0],HistoMassRangeDalitz,HistoNMassBins,HistoMassRange[0],HistoMassRangeDalitz);
2033  fHistoTrueMotherPiPlPiMiNDMDalitzPlotNegSubNDM[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-}} (GeV/c^{2})");
2034  fHistoTrueMotherPiPlPiMiNDMDalitzPlotNegSubNDM[iCut]->GetYaxis()->SetTitle(Form("M_{#pi^{-} %s} (GeV/c^{2})", NameNDMLatex.Data()));
2036  if(fDoMesonQA>1){
2037  fTrueTreeList[iCut] = new TList();
2038  fTrueTreeList[iCut]->SetName(nameTrueRecTTreeList.Data());
2039  fTrueTreeList[iCut]->SetOwner(kTRUE);
2040  fCutFolder[iCut]->Add(fTrueTreeList[iCut]);
2041 
2042  fTreePiPiSameMother[iCut] = new TTree("TreePiPiSameMother","TreePiPiSameMother");
2043  fTreePiPiSameMother[iCut]->Branch("fCasePiPi", &fCasePiPi, "fCasePiPi/S");
2044  fTreePiPiSameMother[iCut]->Branch("fSamePiPiMotherID", &fSamePiPiMotherID, "fSamePiPiMotherID/F");
2045  fTreePiPiSameMother[iCut]->Branch("fSamePiPiMotherInvMass", &fSamePiPiMotherInvMass, "fSamePiPiMotherInvMass/F");
2046  fTreePiPiSameMother[iCut]->Branch("fSamePiPiMotherPt", &fSamePiPiMotherPt, "fSamePiPiMotherPt/F");
2047  fTrueTreeList[iCut]->Add(fTreePiPiSameMother[iCut]);
2048 
2049  fTreePiPiPiSameMother[iCut] = new TTree("TreePiPiPiSameMother","TreePiPiPiSameMother");
2050  fTreePiPiPiSameMother[iCut]->Branch("fSamePiPiPiMotherID", &fSamePiPiPiMotherID, "fSamePiPiPiMotherID/F");
2051  fTreePiPiPiSameMother[iCut]->Branch("fSamePiPiPiMotherInvMass", &fSamePiPiPiMotherInvMass, "fSamePiPiPiMotherInvMass/F");
2052  fTreePiPiPiSameMother[iCut]->Branch("fSamePiPiPiMotherPt", &fSamePiPiPiMotherPt, "fSamePiPiPiMotherPt/F");
2053  fTrueTreeList[iCut]->Add(fTreePiPiPiSameMother[iCut]);
2054 
2055  fTreeEventInfoHNM[iCut] = new TTree("TreeEventInfoHNM","TreeEventInfoHNM");
2056  fTreeEventInfoHNM[iCut]->Branch("fV0MultiplicityHNMEvent", &fV0MultiplicityHNMEvent, "fV0MultiplicityHNMEvent/F");
2057  fTreeEventInfoHNM[iCut]->Branch("fTrackMultiplicityHNMEvent", &fTrackMultiplicityHNMEvent, "fTrackMultiplicityHNMEvent/F");
2058  fTreeEventInfoHNM[iCut]->Branch("fZVertexHNMEvent", &fZVertexHNMEvent, "fZVertexHNMEvent/F");
2059  fTreeEventInfoHNM[iCut]->Branch("fPtHNM", &fPtHNM, "fPtHNM/F");
2060  fTrueTreeList[iCut]->Add(fTreeEventInfoHNM[iCut]);
2061  }
2062  }
2063  }
2064  }
2065  }
2066 
2070 
2071  InitBack(); // Init Background Handler
2072 
2073  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
2074  if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
2075 
2076  if(fV0Reader){
2077  if((AliConvEventCuts*)fV0Reader->GetEventCuts()){
2078  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms()){
2079  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
2080  }
2081  }
2082 
2083  if((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts()){
2084  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms()){
2085  fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
2086  }
2087  }
2088 
2089  }
2090 
2091  for(Int_t iMatcherTask = 0; iMatcherTask < 3; iMatcherTask++){
2092  AliCaloTrackMatcher* temp = (AliCaloTrackMatcher*) (AliAnalysisManager::GetAnalysisManager()->GetTask(Form("CaloTrackMatcher_%i_%i",iMatcherTask,fTrackMatcherRunningMode)));
2093  if(temp && (!fDoLightOutput)) fOutputContainer->Add(temp->GetCaloTrackMatcherHistograms());
2094  }
2095 
2096  fPionSelector=(AliPrimaryPionSelector*)AliAnalysisManager::GetAnalysisManager()->GetTask("PionSelector");
2097  if(!fPionSelector){printf("Error: No PionSelector");return;} // GetV0Reader
2098 
2099  if( fPionSelector && (!fDoLightOutput)){
2100  if ( ((AliPrimaryPionCuts*)fPionSelector->GetPrimaryPionCuts())->GetCutHistograms() ){
2101  fOutputContainer->Add( ((AliPrimaryPionCuts*)fPionSelector->GetPrimaryPionCuts())->GetCutHistograms() );
2102  }
2103  }
2104 
2105  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2106  if( fEventCutArray) {
2107  if( ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms() ) {
2108  fCutFolder[iCut]->Add( ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
2109  }
2110  }
2111 
2112  if( fPionCutArray){
2113  if( ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->GetCutHistograms() ) {
2114  fCutFolder[iCut]->Add( ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->GetCutHistograms() );
2115  }
2116  }
2117  if (fNDMRecoMode < 2){
2118  if( fGammaCutArray ) {
2119  if( ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutHistograms() ) {
2120  fCutFolder[iCut]->Add( ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutHistograms() );
2121  }
2122  }
2123  }
2124  if (fNDMRecoMode > 0){
2125  if( fClusterCutArray ) {
2126  if( ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms() ) {
2127  fCutFolder[iCut]->Add( ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms() );
2128  }
2129  }
2130  }
2132  if( ((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(iCut))->GetCutHistograms() ) {
2133  fCutFolder[iCut]->Add( ((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(iCut))->GetCutHistograms());
2134  }
2135  }
2136  if( fMesonCutArray ) {
2137  if( ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms() ) {
2138  fCutFolder[iCut]->Add( ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
2139  }
2140  }
2141  }
2142 
2143  PostData(1, fOutputContainer);
2144 
2145 }
2146 
2147 //______________________________________________________________________
2149 
2150  //
2151  // Execute analysis for current event
2152  //
2153  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
2154  if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
2155 
2156  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
2157  if(InputEvent()->IsIncompleteDAQ()==kTRUE) eventQuality = 2; // incomplete event
2158  if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1 or because it is incomplete
2159  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
2160  fHistoNEvents[iCut]->Fill(eventQuality);
2161  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
2162  }
2163  return;
2164  }
2165 
2166  fPionSelector=(AliPrimaryPionSelector*)AliAnalysisManager::GetAnalysisManager()->GetTask("PionSelector");
2167  if(!fPionSelector){printf("Error: No PionSelector");return;} // GetV0Reader
2168 
2169  if(fIsMC) fMCEvent = MCEvent();
2170  fInputEvent = InputEvent();
2171  fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
2172  fSelectorNegPionIndex = fPionSelector->GetReconstructedNegPionIndex(); // Electrons from default Cut
2173  fSelectorPosPionIndex = fPionSelector->GetReconstructedPosPionIndex(); // Positrons from default Cut
2174 
2175  fNumberOfESDTracks = fV0Reader->GetNumberOfPrimaryTracks();
2176  //AddTaskContainers(); //Add conatiner
2177  if(fIsMC && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
2178  RelabelAODPhotonCandidates(kTRUE); // In case of AODMC relabeling MC
2179  fV0Reader->RelabelAODs(kTRUE);
2180  }
2181  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
2182  fiCut = iCut;
2183 
2184  Bool_t isRunningEMCALrelAna = kFALSE;
2185  if (fNDMRecoMode > 0){
2186  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) isRunningEMCALrelAna = kTRUE;
2187  }
2188 
2189  Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon, isRunningEMCALrelAna);
2190 
2191  if(fIsMC==2){
2192  Float_t xsection = -1.;
2193  Float_t ntrials = -1.;
2194  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetXSectionAndNTrials(fMCEvent,xsection,ntrials, fInputEvent );
2195  if((xsection==-1.) || (ntrials==-1.)) AliFatal(Form("ERROR: GetXSectionAndNTrials returned invalid xsection/ntrials, periodName from V0Reader: '%s'",fV0Reader->GetPeriodName().Data()));
2196  fProfileJetJetXSection[iCut]->Fill(0.,xsection);
2197  fHistoJetJetNTrials[iCut]->Fill("#sum{NTrials}", ntrials);
2198  }
2199 
2200  if (fIsMC > 1){
2201  fWeightJetJetMC = 1;
2202  Float_t maxjetpt = -1.;
2203  Float_t pthard = -1;
2204  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetUseJetFinderForOutliers()) maxjetpt = fOutlierJetReader->GetMaxJetPt();
2205  Bool_t isMCJet = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsJetJetMCEventAccepted( fMCEvent, fWeightJetJetMC ,pthard, fInputEvent, maxjetpt);
2206  if (fIsMC == 3){
2207  Double_t weightMult = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetWeightForMultiplicity(fV0Reader->GetNumberOfPrimaryTracks());
2208  fWeightJetJetMC = fWeightJetJetMC*weightMult;
2209  }
2210 
2211  if (!isMCJet){
2212  fHistoNEvents[iCut]->Fill(10,fWeightJetJetMC);
2213  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(10);
2214  continue;
2215  }
2216  }
2217 
2218  Bool_t triggered = kTRUE;
2219  if(eventNotAccepted!=0){
2220  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
2221  fHistoNEvents[iCut]->Fill(eventNotAccepted,fWeightJetJetMC); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
2222  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventNotAccepted);
2223  if (eventNotAccepted==3 && fIsMC > 0){
2224  triggered = kFALSE;
2225  }else {
2226  continue;
2227  }
2228  }
2229 
2230  if(eventQuality != 0 && triggered== kTRUE){// Event Not Accepted
2231  //cout << "event rejected due to: " <<eventQuality << endl;
2232  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC);
2233  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality); // Should be 0 here
2234  continue;
2235  }
2236 
2237  if (triggered == kTRUE) {
2238  fHistoNEvents[iCut]->Fill(eventQuality,fWeightJetJetMC);
2239  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality); // Should be 0 here
2241  if(!fDoLightOutput){
2242  fHistoSPDClusterTrackletBackground[iCut]->Fill(fInputEvent->GetMultiplicity()->GetNumberOfTracklets(),(fInputEvent->GetNumberOfITSClusters(0)+fInputEvent->GetNumberOfITSClusters(1)),fWeightJetJetMC);
2243  }
2244  }
2245  if(fIsMC> 0){ // Process MC Particle
2246  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
2247 
2248  if(fInputEvent->IsA()==AliESDEvent::Class()){
2249  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
2250  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
2251  fMCEvent);
2252  } else if(fInputEvent->IsA()==AliAODEvent::Class()){
2253  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
2254  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
2255  fInputEvent);
2256  }
2257 
2258  }
2259  if(fInputEvent->IsA()==AliESDEvent::Class()) ProcessMCParticles();
2260  if(fInputEvent->IsA()==AliAODEvent::Class()) ProcessAODMCParticles();
2261  }
2262  // continue is called after processing of MC particle to get correct acceptance
2263  // and include trigger efficiency in efficiency (relevant when mimicking)
2264  if (triggered==kFALSE) continue;
2265 
2266  if (fNDMRecoMode < 2){
2267  ProcessConversionPhotonCandidates(); // Process this cuts conversion gammas
2268  }
2269  if (fNDMRecoMode > 0){
2270  ProcessCaloPhotonCandidates(); // Process this cuts calo gammas
2271  }
2272 
2273  if (fNDMRecoMode == 0 ){
2274  ProcessNeutralDecayMesonCandidatesPureConversions(); // Process neutral pion candidates purely from conversions
2275  }
2276  if (fNDMRecoMode == 1){
2277  ProcessNeutralPionCandidatesMixedConvCalo(); // Process neutral pion candidates mixed conv and calo
2278  }
2279  if (fNDMRecoMode == 2){
2280  ProcessNeutralPionCandidatesPureCalo(); // Process neutral pion candidates purely from calo
2281  }
2282 
2283  if(fInputEvent->IsA()==AliESDEvent::Class()) ProcessPionCandidates(); // Process this cuts gammas
2284  if(fInputEvent->IsA()==AliAODEvent::Class()) ProcessPionCandidatesAOD();
2285 
2286  //CalculateMesonCandidates();
2287 
2288  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->DoBGCalculation()){
2289  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseLikeSignMixing()){
2291  } else{
2292  CalculateBackground(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetBackgroundMode());
2293  }
2294  }
2296 
2300 
2301  fGoodConvGammas->Clear();
2302  fClusterCandidates->Clear();
2305  fPosPionCandidates->Clear();
2306  fNegPionCandidates->Clear();
2307  }
2308 
2309  fSelectorNegPionIndex.clear();
2310  fSelectorPosPionIndex.clear();
2311 
2312  if( fIsMC && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
2313  RelabelAODPhotonCandidates(kFALSE); // Back to ESDMC Label
2314  fV0Reader->RelabelAODs(kFALSE);
2315  }
2316 
2317  PostData( 1, fOutputContainer );
2318 }
2319 //________________________________________________________________________
2321  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
2322  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
2323  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
2324  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
2325  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
2326  }
2327 
2328  if( !((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift() ){
2329  if(!fDoLightOutput){
2330  fProfileEtaShift[iCut]->Fill(0.,0.);
2331  }
2332  continue; // No Eta Shift requested, continue
2333  }
2334  if( ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
2335  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
2336  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
2337  ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->SetEtaShift( ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() );
2338  if(!fDoLightOutput){
2339  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2340  }
2341  continue;
2342  } else {
2343  printf(" Eta t PiPlusPiMinus Gamma Task %s :: Eta Shift Manually Set to %f \n\n",
2344  (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
2345  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
2346  ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->SetEtaShift( ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() );
2347  if(!fDoLightOutput){
2348  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
2349  }
2350  }
2351  }
2352  return kTRUE;
2353 }
2354 
2355 
2358 }
2359 
2360 
2361 //________________________________________________________________________
2363 {
2364 
2365  Int_t nclus = 0;
2366  nclus = fInputEvent->GetNumberOfCaloClusters();
2367 
2368  // cout << nclus << endl;
2369 
2370  if(nclus == 0) return;
2371  // plotting histograms on cell/tower level, only if extendedMatchAndQA > 1
2372  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FillHistogramsExtendedQA(fInputEvent,fIsMC);
2373 
2374  // match tracks to clusters
2375  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchTracksToClusters(fInputEvent,fWeightJetJetMC,kTRUE, fMCEvent);
2376 
2377 
2378  // vertex
2379  Double_t vertex[3] = {0};
2380  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
2381 
2382  // Loop over EMCal clusters
2383  for(Long_t i = 0; i < nclus; i++){
2384  Double_t tempClusterWeight = fWeightJetJetMC;
2385  Double_t tempPhotonWeight = fWeightJetJetMC;
2386 
2387  std::unique_ptr<AliVCluster> clus;
2388  if(fInputEvent->IsA()==AliESDEvent::Class()) clus = std::unique_ptr<AliVCluster>(new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i)));
2389  else if(fInputEvent->IsA()==AliAODEvent::Class()) clus = std::unique_ptr<AliVCluster>(new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i)));
2390 
2391  if (!clus) continue;
2392  // Set the jetjet weight to 1 in case the cluster orignated from the minimum bias header
2393  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() == 4){
2394  if( ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(clus->GetLabelAt(0), fMCEvent, fInputEvent) == 2)
2395  tempClusterWeight = 1;
2396  }
2397 
2398  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus.get(),fInputEvent,fMCEvent,fIsMC, tempClusterWeight,i)){
2399  continue;
2400  }
2401  // TLorentzvector with cluster
2402  TLorentzVector clusterVector;
2403  clus->GetMomentum(clusterVector,vertex);
2404 
2405  TLorentzVector tmpvec;
2406  tmpvec.SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
2407 
2408  // convert to AODConversionPhoton
2409  AliAODConversionPhoton *PhotonCandidate=new AliAODConversionPhoton(&tmpvec);
2410  if(!PhotonCandidate){ continue;}
2411 
2412  // Flag Photon as CaloPhoton
2413  PhotonCandidate->SetIsCaloPhoton(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType());
2414  PhotonCandidate->SetCaloClusterRef(i);
2415  // get MC label
2416  if(fIsMC>0){
2417  Int_t* mclabelsCluster = clus->GetLabels();
2418  PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
2419  // cout << clus->GetNLabels() << endl;
2420  if (clus->GetNLabels()>0){
2421  for (Int_t k =0; k< (Int_t)clus->GetNLabels(); k++){
2422  if (k< 50)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
2423  // Int_t pdgCode = fMCEvent->Particle(mclabelsCluster[k])->GetPdgCode();
2424  // cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
2425  }
2426  }
2427  }
2428 
2429  fIsFromDesiredHeader = kTRUE;
2431  //TString periodName = fV0Reader->GetPeriodName();
2432  // test whether largest contribution to cluster orginates in added signals
2433  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() > 0){
2434  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCEvent, fInputEvent) == 0){
2435  fIsFromDesiredHeader = kFALSE;
2436  }
2437  if (clus->GetNLabels()>1){
2438  Int_t* mclabelsCluster = clus->GetLabels();
2439  for (Int_t l = 1; l < (Int_t)clus->GetNLabels(); l++ ){
2440  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(mclabelsCluster[l], fMCEvent, fInputEvent) == 0){
2442  }
2443  }
2444  }
2445  }
2446 
2448  fHistoClusterGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),tempPhotonWeight);
2449  fHistoClusterGammaEta[fiCut]->Fill(PhotonCandidate->Eta(),tempPhotonWeight);
2450  fHistoClusterGammaE[fiCut]->Fill(PhotonCandidate->E(),tempPhotonWeight);
2451  if(fIsMC>0){
2452  if(fInputEvent->IsA()==AliESDEvent::Class()){
2453  ProcessTrueCaloPhotonCandidates(PhotonCandidate);
2454  }else {
2455  ProcessTrueCaloPhotonCandidatesAOD(PhotonCandidate);
2456  }
2457  }
2458  fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
2459  } else{
2460  delete PhotonCandidate;
2461  }
2462  }
2463 }
2464 
2465 //________________________________________________________________________
2467 {
2468  TParticle *Photon = nullptr;
2469  if (TruePhotonCandidate->GetIsCaloPhoton() == 0) AliFatal("CaloPhotonFlag has not been set task will abort");
2470  // fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
2471 
2472  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2473  Double_t mcProdVtxX = primVtxMC->GetX();
2474  Double_t mcProdVtxY = primVtxMC->GetY();
2475  Double_t mcProdVtxZ = primVtxMC->GetZ();
2476 
2477  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = fMCEvent->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
2478  else return;
2479 
2480  if(Photon == nullptr){
2481  // cout << "no photon" << endl;
2482  return;
2483  }
2484 
2485  // Int_t pdgCodeParticle = Photon->GetPdgCode();
2486  TruePhotonCandidate->SetCaloPhotonMCFlags(fMCEvent, kFALSE);
2487 
2488  // True Photon
2489  if(!fDoLightOutput){
2490  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, TruePhotonCandidate->GetCaloPhotonMCLabel(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2491  if(isPrimary){
2492  if (TruePhotonCandidate->IsLargestComponentPhoton()){
2493  fHistoTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2494  if (GammaIsNeutralMesonPiPlPiMiNDMDaughter(TruePhotonCandidate->GetCaloPhotonMCLabel(0))){
2495  fHistoTrueClusterGammaFromNeutralMesonPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2496  }
2497  }
2498  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2499  fHistoTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2500  if (GammaIsNeutralMesonPiPlPiMiNDMDaughter(TruePhotonCandidate->GetCaloPhotonMCLabel(0))){
2501  fHistoTrueClusterGammaFromNeutralMesonPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2502  }
2503  }
2504  }
2505  }
2506  return;
2507 }
2508 
2509 //________________________________________________________________________
2511 {
2512  AliAODMCParticle *Photon = NULL;
2513  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2514 
2515  if (AODMCTrackArray){
2516  if (TruePhotonCandidate->GetIsCaloPhoton() == 0) AliFatal("CaloPhotonFlag has not been set task will abort");
2517  }else{
2518  AliInfo("AODMCTrackArray could not be loaded");
2519  return;
2520  }
2521  // fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
2522 
2523  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2524  Double_t mcProdVtxX = primVtxMC->GetX();
2525  Double_t mcProdVtxY = primVtxMC->GetY();
2526  Double_t mcProdVtxZ = primVtxMC->GetZ();
2527 
2528  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
2529  else return;
2530 
2531  if(Photon == NULL){
2532  return;
2533  }
2534 
2535  // Int_t pdgCodeParticle = Photon->GetPdgCode();
2536  TruePhotonCandidate->SetCaloPhotonMCFlagsAOD(fInputEvent, kFALSE);
2537 
2538  // True Photon
2539  if(!fDoLightOutput){
2540  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2541  if(isPrimary){
2542  if (TruePhotonCandidate->IsLargestComponentPhoton()){
2543  fHistoTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2544  if (GammaIsNeutralMesonPiPlPiMiNDMDaughterAOD(AODMCTrackArray,TruePhotonCandidate->GetCaloPhotonMCLabel(0))){
2545  fHistoTrueClusterGammaFromNeutralMesonPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2546  }
2547  }
2548  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
2549  fHistoTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2550  if (GammaIsNeutralMesonPiPlPiMiNDMDaughterAOD(AODMCTrackArray,TruePhotonCandidate->GetCaloPhotonMCLabel(0))){
2551  fHistoTrueClusterGammaFromNeutralMesonPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2552  }
2553  }
2554  }
2555  }
2556  return;
2557 }
2558 
2559 
2560 //________________________________________________________________________
2562  Int_t nV0 = 0;
2563  TList GoodGammasStepOne;
2564  TList GoodGammasStepTwo;
2565  // Loop over Photon Candidates allocated by ReaderV1
2566 
2567  for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
2568  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
2569  if(!PhotonCandidate) continue;
2570 
2571  fIsFromMBHeader = kTRUE;
2572 
2573  if( fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0 ){
2574  Int_t isPosFromMBHeader
2575  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
2576  if(isPosFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
2577  Int_t isNegFromMBHeader
2578  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent,fInputEvent);
2579  if(isNegFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
2580  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
2581  }
2582 
2583  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fInputEvent)) continue;
2584 
2585  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseElecSharingCut() &&
2586  !((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseToCloseV0sCut()){ // if no post reader loop is required add to events good gammas
2587 
2588  fGoodConvGammas->Add(PhotonCandidate);
2589 
2590  if(fIsFromMBHeader && (!fDoLightOutput)){
2591  fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(), fWeightJetJetMC);
2592  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta(), fWeightJetJetMC);
2593  }
2594 
2595  if(fMCEvent){
2596  if(fInputEvent->IsA()==AliESDEvent::Class())
2597  ProcessTrueConversionPhotonCandidates(PhotonCandidate);
2598  if(fInputEvent->IsA()==AliAODEvent::Class())
2600  }
2601  } else if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
2602  ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
2603  nV0++;
2604  GoodGammasStepOne.Add(PhotonCandidate);
2605  } else if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseElecSharingCut() &&
2606  ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
2607  GoodGammasStepTwo.Add(PhotonCandidate);
2608  }
2609  }
2610 
2611 
2612  if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseElecSharingCut()){
2613  for(Int_t i = 0;i<GoodGammasStepOne.GetEntries();i++){
2614  AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GoodGammasStepOne.At(i);
2615  if(!PhotonCandidate) continue;
2616  fIsFromMBHeader = kTRUE;
2617  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2618  Int_t isPosFromMBHeader
2619  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent,fInputEvent);
2620  Int_t isNegFromMBHeader
2621  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent,fInputEvent);
2622  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
2623  }
2624  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GoodGammasStepOne.GetEntries())) continue;
2625  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
2626  fGoodConvGammas->Add(PhotonCandidate);
2627  if(fIsFromMBHeader && (!fDoLightOutput)){
2628  fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(), fWeightJetJetMC);
2629  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta(), fWeightJetJetMC);
2630  }
2631  if(fMCEvent){
2632  if(fInputEvent->IsA()==AliESDEvent::Class())
2633  ProcessTrueConversionPhotonCandidates(PhotonCandidate);
2634  if(fInputEvent->IsA()==AliAODEvent::Class())
2636  }
2637  }
2638  else GoodGammasStepTwo.Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
2639  }
2640  }
2641  if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseToCloseV0sCut()){
2642  for(Int_t i = 0;i<GoodGammasStepTwo.GetEntries();i++){
2643  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GoodGammasStepTwo.At(i);
2644  if(!PhotonCandidate) continue;
2645 
2646  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2647  Int_t isPosFromMBHeader
2648  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent,fInputEvent);
2649  Int_t isNegFromMBHeader
2650  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent,fInputEvent);
2651  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
2652  }
2653 
2654  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,&GoodGammasStepTwo,i)) continue;
2655  fGoodConvGammas->Add(PhotonCandidate); // Add gamma to current cut TList
2656 
2657  if(fIsFromMBHeader && (!fDoLightOutput)){
2658  fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(), fWeightJetJetMC); // Differences to old V0Reader in p_t due to conversion KF->TLorentzVector
2659  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta(), fWeightJetJetMC);
2660  }
2661 
2662  if(fMCEvent){
2663  if(fInputEvent->IsA()==AliESDEvent::Class())
2664  ProcessTrueConversionPhotonCandidates(PhotonCandidate);
2665  if(fInputEvent->IsA()==AliAODEvent::Class())
2667  }
2668  }
2669  }
2670 }
2671 
2672 //________________________________________________________________________
2674 {
2675  // Process True Photons
2676  TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCEvent);
2677  TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCEvent);
2678 
2679  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2680  Double_t mcProdVtxX = primVtxMC->GetX();
2681  Double_t mcProdVtxY = primVtxMC->GetY();
2682  Double_t mcProdVtxZ = primVtxMC->GetZ();
2683 
2684 
2685  if(posDaughter == NULL || negDaughter == NULL){
2686  return; // One particle does not exist
2687  }
2688  if(posDaughter->GetMother(0) != negDaughter->GetMother(0)){ // Not Same Mother == Combinatorial Bck
2689  return;
2690  }
2691 
2692  else if (posDaughter->GetMother(0) == -1){
2693  return;
2694  }
2695 
2696  if(TMath::Abs(posDaughter->GetPdgCode())!=11 || TMath::Abs(negDaughter->GetPdgCode())!=11){
2697  return; //One Particle is not electron
2698  }
2699  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()){
2700  return; // Same Charge
2701  }
2702  if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() !=5){
2703  return;// check if the daughters come from a conversion
2704  }
2705  TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCEvent);
2706  if(Photon->GetPdgCode() != 22){
2707  return; // Mother is no Photon
2708  }
2709  // True Photon
2710 
2711  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueConvGammas,posDaughter->GetMother(0)) && (!fDoLightOutput)) fHistoDoubleCountTrueConvGammaRPt[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius(),TruePhotonCandidate->Pt());
2712 
2713  Int_t labelGamma = TruePhotonCandidate->GetMCParticleLabel(fMCEvent);
2714  Bool_t gammaIsPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, labelGamma, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2715  if( gammaIsPrimary ){
2716  if( fIsFromMBHeader && (!fDoLightOutput) ){
2717  fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(),fWeightJetJetMC);
2718  if (GammaIsNeutralMesonPiPlPiMiNDMDaughter(labelGamma)){
2719  fHistoTrueConvGammaFromNeutralMesonPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2720  }
2721  }
2722  }
2723 }
2724 
2725 //________________________________________________________________________
2727 {
2728  // Process True Photons
2729  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2730  if (AODMCTrackArray == NULL || TruePhotonCandidate == NULL){
2731  return;
2732  }
2733  AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
2734  AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
2735 
2736  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2737  Double_t mcProdVtxX = primVtxMC->GetX();
2738  Double_t mcProdVtxY = primVtxMC->GetY();
2739  Double_t mcProdVtxZ = primVtxMC->GetZ();
2740 
2741 
2742  if(posDaughter == NULL || negDaughter == NULL) {
2743  return; // One particle does not exist
2744  }
2745  if(posDaughter->GetMother() != negDaughter->GetMother()){ // Not Same Mother == Combinatorial Bck
2746  return;
2747  }
2748  else if (posDaughter->GetMother() == -1){
2749  return;
2750  }
2751 
2752  if(TMath::Abs(posDaughter->GetPdgCode())!=11 || TMath::Abs(negDaughter->GetPdgCode())!=11){
2753  return; //One Particle is not electron
2754  }
2755  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()){
2756  return; // Same Charge
2757  }
2758  if(posDaughter->GetMCProcessCode() != 5 || negDaughter->GetMCProcessCode() !=5){
2759  return;// check if the daughters come from a conversion
2760  }
2761  AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
2762  if(Photon->GetPdgCode() != 22){
2763  return; // Mother is no Photon
2764 }
2765  // True Photon
2766 
2767  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueConvGammas,posDaughter->GetMother()) && (!fDoLightOutput)) fHistoDoubleCountTrueConvGammaRPt[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius(),TruePhotonCandidate->Pt());
2768 
2769  // for AOD you have to ask electron for mother to get label
2770  Int_t labelGamma = posDaughter->GetMother();
2771  Bool_t gammaIsPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD( fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2772  if( gammaIsPrimary ){
2773  if( fIsFromMBHeader && (!fDoLightOutput) ){
2774  fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2775  if (GammaIsNeutralMesonPiPlPiMiNDMDaughterAOD(AODMCTrackArray, labelGamma)){
2776  fHistoTrueConvGammaFromNeutralMesonPt[fiCut]->Fill(TruePhotonCandidate->Pt(), fWeightJetJetMC);
2777  }
2778  }
2779  }
2780 }
2781 
2782 //________________________________________________________________________
2784  // Conversion Gammas
2785  if(fGoodConvGammas->GetEntries()>1){
2786  for(Int_t firstGammaIndex=0;firstGammaIndex<fGoodConvGammas->GetEntries()-1;firstGammaIndex++){
2787  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGoodConvGammas->At(firstGammaIndex));
2788  if (gamma0==nullptr) continue;
2789  for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fGoodConvGammas->GetEntries();secondGammaIndex++){
2790  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fGoodConvGammas->At(secondGammaIndex));
2791  //Check for same Electron ID
2792  if (gamma1==nullptr) continue;
2793  if(gamma0->GetTrackLabelPositive() == gamma1->GetTrackLabelPositive() ||
2794  gamma0->GetTrackLabelNegative() == gamma1->GetTrackLabelNegative() ||
2795  gamma0->GetTrackLabelNegative() == gamma1->GetTrackLabelPositive() ||
2796  gamma0->GetTrackLabelPositive() == gamma1->GetTrackLabelNegative() ) continue;
2797 
2798  AliAODConversionMother *NDMcand = new AliAODConversionMother(gamma0,gamma1);
2799  NDMcand->SetLabels(firstGammaIndex,secondGammaIndex);
2800 
2801  NDMcand->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
2802 
2803  if(!fDoLightOutput){
2804  fHistoGammaGammaInvMassPtBeforeCuts[fiCut]->Fill(NDMcand->M(),NDMcand->Pt(), fWeightJetJetMC);
2805  }
2806 
2807  if( ((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->DoGammaMinEnergyCut() ){
2808  Int_t minDaughters = ((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->GetNDaughterEnergyCut();
2809  Float_t minDaughterEnergy = ((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->GetSingleDaughterMinE();
2810  if(minDaughters==1){ // at least one over threshold
2811  if( (gamma0->E() < minDaughterEnergy) && (gamma1->E() < minDaughterEnergy)) continue;
2812  } else if (minDaughters==2){ // both over threshold
2813  if( (gamma0->E() < minDaughterEnergy) || (gamma1->E() < minDaughterEnergy)) continue;
2814  }
2815  }
2816 
2817  if((((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->MesonIsSelected(NDMcand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
2818  if(fIsMC){
2819  if(fInputEvent->IsA()==AliESDEvent::Class())
2820  ProcessTrueNeutralPionCandidatesPureConversions(NDMcand,gamma0,gamma1);
2821  if(fInputEvent->IsA()==AliAODEvent::Class())
2823  }
2824  if (((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(NDMcand, 0)){
2825  fNeutralDecayParticleCandidates->Add(NDMcand);
2826 
2827  if(!fDoLightOutput){
2828  fHistoGammaGammaInvMassPt[fiCut]->Fill(NDMcand->M(),NDMcand->Pt(), fWeightJetJetMC);
2829  }
2830  } else if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseSidebandMixing()) &&
2831  (((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(NDMcand, 1))){
2833 
2834  if(!fDoLightOutput){
2835  fHistoGammaGammaInvMassPt[fiCut]->Fill(NDMcand->M(),NDMcand->Pt(), fWeightJetJetMC);
2836  }
2837  } else if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseSidebandMixingBothSides()) &&
2838  ((((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(NDMcand, 2)) ||
2839  ((((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(NDMcand, 3))))){
2841 
2842  if(!fDoLightOutput){
2843  fHistoGammaGammaInvMassPt[fiCut]->Fill(NDMcand->M(),NDMcand->Pt(), fWeightJetJetMC);
2844  }
2845  } else{
2846  delete NDMcand;
2847  }
2848  } else{
2849  delete NDMcand;
2850  }
2851  }
2852  }
2853  }
2854 }
2855 
2856 
2857 //________________________________________________________________________
2859 
2860  // Conversion Gammas
2861  if(fClusterCandidates->GetEntries()>0){
2862 
2863  // vertex
2864  Double_t vertex[3] = {0};
2865  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
2866 
2867  for(Int_t firstGammaIndex=0;firstGammaIndex<fClusterCandidates->GetEntries();firstGammaIndex++){
2868  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(firstGammaIndex));
2869  if (gamma0==nullptr) continue;
2870 
2871  for(Int_t secondGammaIndex=0;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
2872  if (firstGammaIndex == secondGammaIndex) continue;
2873  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
2874  if (gamma1==nullptr) continue;
2875 
2876  AliAODConversionMother *NDMcand = new AliAODConversionMother(gamma0,gamma1);
2877  NDMcand->SetLabels(firstGammaIndex,secondGammaIndex);
2878 
2879  if(!fDoLightOutput){
2880  fHistoGammaGammaInvMassPtBeforeCuts[fiCut]->Fill(NDMcand->M(),NDMcand->Pt(), fWeightJetJetMC);
2881  }
2882 
2883  if( ((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->DoGammaMinEnergyCut() ){
2884  Int_t minDaughters = ((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->GetNDaughterEnergyCut();
2885  Float_t minDaughterEnergy = ((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->GetSingleDaughterMinE();
2886  if(minDaughters==1){ // at least one over threshold
2887  if( (gamma0->E() < minDaughterEnergy) && (gamma1->E() < minDaughterEnergy)) continue;
2888  } else if (minDaughters==2){ // both over threshold
2889  if( (gamma0->E() < minDaughterEnergy) || (gamma1->E() < minDaughterEnergy)) continue;
2890  }
2891  }
2892 
2893  if((((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->MesonIsSelected(NDMcand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
2894  if(fIsMC){
2895  if(fInputEvent->IsA()==AliESDEvent::Class())
2896  ProcessTrueNeutralPionCandidatesPureCalo(NDMcand,gamma0,gamma1);
2897  if(fInputEvent->IsA()==AliAODEvent::Class())
2898  ProcessTrueNeutralPionCandidatesPureCaloAOD(NDMcand,gamma0,gamma1);
2899  }
2900 
2901  if (((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(NDMcand, 0)){
2902  fNeutralDecayParticleCandidates->Add(NDMcand);
2903 
2904  if(!fDoLightOutput){
2905  fHistoGammaGammaInvMassPt[fiCut]->Fill(NDMcand->M(),NDMcand->Pt(), fWeightJetJetMC);
2906  }
2907  } else if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseSidebandMixing()) &&
2908  (((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(NDMcand, 1))){
2910 
2911  if(!fDoLightOutput){
2912  fHistoGammaGammaInvMassPt[fiCut]->Fill(NDMcand->M(),NDMcand->Pt(), fWeightJetJetMC);
2913  }
2914  } else if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseSidebandMixingBothSides()) &&
2915  ((((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(NDMcand, 2)) ||
2916  ((((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(NDMcand, 3))))){
2918 
2919  if(!fDoLightOutput){
2920  fHistoGammaGammaInvMassPt[fiCut]->Fill(NDMcand->M(),NDMcand->Pt(), fWeightJetJetMC);
2921  }
2922  }else {
2923  delete NDMcand;
2924  }
2925  } else{
2926  delete NDMcand;
2927  }
2928  }
2929  }
2930  }
2931 }
2932 
2933 //______________________________________________________________________
2934 void AliAnalysisTaskNeutralMesonToPiPlPiMiNeutralMeson::ProcessTrueNeutralPionCandidatesPureCalo( AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
2935 {
2936  // Process True Mesons
2937 
2938  Bool_t isTrueNDM = kFALSE;
2939  Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
2940  Int_t gamma0MotherLabel = -1;
2941 
2942  if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2943  TParticle * gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
2944  if (TrueGammaCandidate0->IsLargestComponentPhoton() || TrueGammaCandidate0->IsLargestComponentElectron()){ // largest component is electro magnetic
2945  // get mother of interest (pi0 or eta)
2946  if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons its the direct mother
2947  gamma0MotherLabel=gammaMC0->GetMother(0);
2948  } else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
2949  if (TrueGammaCandidate0->IsConversion() && gammaMC0->GetMother(0)>-1){
2950  gamma0MotherLabel=fMCEvent->Particle(gammaMC0->GetMother(0))->GetMother(0);
2951  } else {
2952  gamma0MotherLabel=gammaMC0->GetMother(0);
2953  }
2954  }
2955  }
2956  }
2957 
2958  if (TrueGammaCandidate1->GetIsCaloPhoton() == 0) AliFatal("CaloPhotonFlag has not been set. Aborting");
2959 
2960  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
2961  Int_t gamma1MotherLabel = -1;
2962  // check if
2963  if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2964  // Daughters Gamma 1
2965  TParticle * gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
2966  if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
2967  // get mother of interest (pi0 or eta)
2968  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
2969  gamma1MotherLabel=gammaMC1->GetMother(0);
2970  } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
2971  if (TrueGammaCandidate1->IsConversion() && gammaMC1->GetMother(0)>-1) gamma1MotherLabel=fMCEvent->Particle(gammaMC1->GetMother(0))->GetMother(0);
2972  else gamma1MotherLabel=gammaMC1->GetMother(0);
2973  }
2974  }
2975  }
2976 
2977  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
2978  if(((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == fPDGCodeNDM){
2979  isTrueNDM=kTRUE;
2980  if (CheckVectorForDoubleCount(fVectorDoubleCountTruePi0s,gamma0MotherLabel) && (!fDoLightOutput)) fHistoDoubleCountTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2981  }
2982  }
2983 
2984  if(isTrueNDM){// True Pion
2985  Pi0Candidate->SetTrueMesonValue(1);
2986  Pi0Candidate->SetMCLabel(gamma0MotherLabel);
2987  if(!fDoLightOutput){
2988  fHistoTrueMotherGammaGammaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
2989  switch( fSelectedHeavyNeutralMeson ) {
2990  case 0: // ETA MESON
2991  if( IsEtaPiPlPiMiPiZeroDaughter(gamma0MotherLabel) )
2992  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
2993  break;
2994  case 1: // OMEGA MESON
2995  if( IsOmegaPiPlPiMiPiZeroDaughter(gamma0MotherLabel) )
2996  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
2997  break;
2998  case 2: // ETA PRIME MESON
2999  if( IsEtaPrimePiPlPiMiEtaDaughter(gamma0MotherLabel) )
3000  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3001  break;
3002  case 3: // D0 MESON
3003  if( IsD0PiPlPiMiPiZeroDaughter(gamma0MotherLabel) )
3004  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3005  break;
3006  default:
3007  AliError(Form("Heavy neutral meson not correctly selected (only 0,1,2,3 valid)... selected: %d",fSelectedHeavyNeutralMeson));
3008  }
3009  }
3010  }
3011 }
3012 
3013 //______________________________________________________________________
3014 void AliAnalysisTaskNeutralMesonToPiPlPiMiNeutralMeson::ProcessTrueNeutralPionCandidatesPureCaloAOD( AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
3015 {
3016  // Process True Mesons
3017  // Process True Mesons
3018  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3019  if (AODMCTrackArray == NULL) return;
3020 
3021  Bool_t isTrueNDM = kFALSE;
3022  Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
3023  Int_t gamma0MotherLabel = -1;
3024 
3025  if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
3026  AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3027  if (TrueGammaCandidate0->IsLargestComponentPhoton() || TrueGammaCandidate0->IsLargestComponentElectron()){ // largest component is electro magnetic
3028  // get mother of interest (pi0 or eta)
3029  if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons its the direct mother
3030  gamma0MotherLabel=gammaMC0->GetMother();
3031  } else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
3032  if (TrueGammaCandidate0->IsConversion() && gammaMC0->GetMother()>-1){
3033  AliAODMCParticle * gammaGrandMotherMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC0->GetMother()));
3034  gamma0MotherLabel=gammaGrandMotherMC0->GetMother();
3035  } else {
3036  gamma0MotherLabel=gammaMC0->GetMother();
3037  }
3038  }
3039  }
3040  }
3041 
3042  if (TrueGammaCandidate1->GetIsCaloPhoton() == 0) AliFatal("CaloPhotonFlag has not been set. Aborting");
3043 
3044  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
3045  Int_t gamma1MotherLabel = -1;
3046  // check if
3047  if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
3048  // Daughters Gamma 1
3049  AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
3050  if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
3051  // get mother of interest (pi0 or eta)
3052  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
3053  gamma1MotherLabel=gammaMC1->GetMother();
3054  } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
3055  if (TrueGammaCandidate1->IsConversion() && gammaMC1->GetMother()>-1){
3056  AliAODMCParticle * gammaGrandMotherMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
3057  gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
3058  }else gamma1MotherLabel=gammaMC1->GetMother();
3059  }
3060  }
3061  }
3062 
3063  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
3064  if(((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == fPDGCodeNDM){
3065  isTrueNDM=kTRUE;
3066  if (CheckVectorForDoubleCount(fVectorDoubleCountTruePi0s,gamma0MotherLabel) && (!fDoLightOutput)) fHistoDoubleCountTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3067  }
3068  }
3069 
3070  if(isTrueNDM){// True Pion
3071  Pi0Candidate->SetTrueMesonValue(1);
3072  Pi0Candidate->SetMCLabel(gamma0MotherLabel);
3073  if(!fDoLightOutput){
3074  fHistoTrueMotherGammaGammaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3075  switch( fSelectedHeavyNeutralMeson ) {
3076  case 0: // ETA MESON
3077  if( IsEtaPiPlPiMiPiZeroDaughterAOD(AODMCTrackArray,gamma0MotherLabel) )
3078  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3079  break;
3080  case 1: // OMEGA MESON
3081  if( IsOmegaPiPlPiMiPiZeroDaughterAOD(AODMCTrackArray,gamma0MotherLabel) )
3082  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3083  break;
3084  case 2: // ETA PRIME MESON
3085  if( IsEtaPrimePiPlPiMiEtaDaughterAOD(AODMCTrackArray,gamma0MotherLabel) )
3086  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3087  break;
3088  case 3: // D0 MESON
3089  if( IsD0PiPlPiMiPiZeroDaughterAOD(AODMCTrackArray,gamma0MotherLabel) )
3090  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3091  break;
3092  default:
3093  AliError(Form("Heavy neutral meson not correctly selected (only 0,1,2,3 valid)... selected: %d",fSelectedHeavyNeutralMeson));
3094  }
3095  }
3096  }
3097 }
3098 
3099 
3100 
3101 //______________________________________________________________________
3102 void AliAnalysisTaskNeutralMesonToPiPlPiMiNeutralMeson::ProcessTrueNeutralPionCandidatesPureConversions(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
3103 {
3104  // Process True Mesons
3105  if(TrueGammaCandidate0->GetV0Index()<fInputEvent->GetNumberOfV0s()){
3106  Bool_t isTrueNDM = kFALSE;
3107  Bool_t isTruePi0Dalitz = kFALSE;
3108  Bool_t gamma0DalitzCand = kFALSE;
3109  Bool_t gamma1DalitzCand = kFALSE;
3110  Int_t gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(fMCEvent);
3111  Int_t gamma0MotherLabel = -1;
3112  Int_t motherRealLabel = -1;
3113  if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
3114  // Daughters Gamma 0
3115  TParticle * negativeMC = (TParticle*)TrueGammaCandidate0->GetNegativeMCDaughter(fMCEvent);
3116  TParticle * positiveMC = (TParticle*)TrueGammaCandidate0->GetPositiveMCDaughter(fMCEvent);
3117  TParticle * gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
3118  if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
3119  if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
3120  if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
3121  gamma0MotherLabel=gammaMC0->GetFirstMother();
3122  motherRealLabel=gammaMC0->GetFirstMother();
3123  }
3124  }
3125  if(gammaMC0->GetPdgCode() ==111){ // Dalitz candidate
3126  gamma0DalitzCand = kTRUE;
3127  gamma0MotherLabel=-111;
3128  motherRealLabel=gamma0MCLabel;
3129  }
3130  }
3131  }
3132  if(TrueGammaCandidate1->GetV0Index()<fInputEvent->GetNumberOfV0s()){
3133  Int_t gamma1MCLabel = TrueGammaCandidate1->GetMCParticleLabel(fMCEvent);
3134  Int_t gamma1MotherLabel = -1;
3135  if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
3136  // Daughters Gamma 1
3137  TParticle * negativeMC = (TParticle*)TrueGammaCandidate1->GetNegativeMCDaughter(fMCEvent);
3138  TParticle * positiveMC = (TParticle*)TrueGammaCandidate1->GetPositiveMCDaughter(fMCEvent);
3139  TParticle * gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
3140  if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
3141  if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
3142  if(gammaMC1->GetPdgCode() == 22){ // ... with Gamma Mother
3143  gamma1MotherLabel=gammaMC1->GetFirstMother();
3144  }
3145  }
3146  if(gammaMC1->GetPdgCode() ==111 ){ // Dalitz candidate
3147  gamma1DalitzCand = kTRUE;
3148  gamma1MotherLabel=-111;
3149  }
3150  }
3151  }
3152  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
3153  if(((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == fPDGCodeNDM){
3154  isTrueNDM=kTRUE;
3155  if (CheckVectorForDoubleCount(fVectorDoubleCountTruePi0s,gamma0MotherLabel) && (!fDoLightOutput)) fHistoDoubleCountTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3156  }
3157  }
3158 
3159  //Identify Dalitz candidate
3160  if (gamma1DalitzCand || gamma0DalitzCand){
3161  if (gamma0DalitzCand && gamma0MCLabel >=0 && gamma0MCLabel==gamma1MotherLabel){
3162  if (gamma0MotherLabel == -111) isTruePi0Dalitz = kTRUE;
3163  }
3164  if (gamma1DalitzCand && gamma1MCLabel >=0 && gamma1MCLabel==gamma0MotherLabel){
3165  if (gamma1MotherLabel == -111) isTruePi0Dalitz = kTRUE;
3166  }
3167  }
3168 
3169 
3170  if(isTrueNDM || isTruePi0Dalitz){// True Pion
3171  Pi0Candidate->SetTrueMesonValue(1);
3172  Pi0Candidate->SetMCLabel(motherRealLabel);
3173  if(!fDoLightOutput){
3174  fHistoTrueMotherGammaGammaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3175  switch( fSelectedHeavyNeutralMeson ) {
3176  case 0: // ETA MESON
3177  if( IsEtaPiPlPiMiPiZeroDaughter(motherRealLabel) )
3178  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3179  break;
3180  case 1: // OMEGA MESON
3181  if( IsOmegaPiPlPiMiPiZeroDaughter(motherRealLabel) )
3182  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3183  break;
3184  case 2: // ETA PRIME MESON
3185  if( IsEtaPrimePiPlPiMiEtaDaughter(motherRealLabel) )
3186  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3187  break;
3188  case 3: // D0 MESON
3189  if( IsD0PiPlPiMiPiZeroDaughter(motherRealLabel) )
3190  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3191  break;
3192  default:
3193  AliError(Form("Heavy neutral meson not correctly selected (only 0,1,2,3 valid)... selected: %d",fSelectedHeavyNeutralMeson));
3194  }
3195  }
3196  }
3197  }
3198  }
3199 }
3200 
3201 //______________________________________________________________________
3202 void AliAnalysisTaskNeutralMesonToPiPlPiMiNeutralMeson::ProcessTrueNeutralPionCandidatesPureConversionsAOD(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
3203 {
3204 
3205  // Process True Mesons
3206  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3207  Bool_t isTruePi0 = kFALSE;
3208  Bool_t isTruePi0Dalitz = kFALSE;
3209  Bool_t gamma0DalitzCand = kFALSE;
3210  Bool_t gamma1DalitzCand = kFALSE;
3211  Int_t motherRealLabel = -1;
3212 
3213  if (AODMCTrackArray!=nullptr && TrueGammaCandidate0 != nullptr){
3214  AliAODMCParticle *positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
3215  AliAODMCParticle *negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
3216 
3217  Int_t gamma0MCLabel = -1;
3218  Int_t gamma0MotherLabel = -1;
3219  if(!positiveMC||!negativeMC)
3220  return;
3221 
3222  if(positiveMC->GetMother()>-1&&(negativeMC->GetMother() == positiveMC->GetMother())){
3223  gamma0MCLabel = positiveMC->GetMother();
3224  }
3225 
3226  if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
3227  // Daughters Gamma 0
3228  AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3229  if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
3230  if(((positiveMC->GetMCProcessCode())) == 5 && ((negativeMC->GetMCProcessCode())) == 5){ // ... From Conversion ...
3231  if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
3232  gamma0MotherLabel=gammaMC0->GetMother();
3233  motherRealLabel=gammaMC0->GetMother();
3234  }
3235  }
3236  if(gammaMC0->GetPdgCode() ==111){ // Dalitz candidate
3237  gamma0DalitzCand = kTRUE;
3238  gamma0MotherLabel=-111;
3239  motherRealLabel=gamma0MCLabel;
3240  }
3241  }
3242  }
3243  positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate1->GetMCLabelPositive()));
3244  negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate1->GetMCLabelNegative()));
3245 
3246  Int_t gamma1MCLabel = -1;
3247  Int_t gamma1MotherLabel = -1;
3248  if(!positiveMC||!negativeMC)
3249  return;
3250 
3251  if(positiveMC->GetMother()>-1&&(negativeMC->GetMother() == positiveMC->GetMother())){
3252  gamma1MCLabel = positiveMC->GetMother();
3253  }
3254  if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
3255  // Daughters Gamma 1
3256  AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
3257  if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
3258  if(((positiveMC->GetMCProcessCode())) == 5 && ((negativeMC->GetMCProcessCode())) == 5){ // ... From Conversion ...
3259  if(gammaMC1->GetPdgCode() == 22){ // ... with Gamma Mother
3260  gamma1MotherLabel=gammaMC1->GetMother();
3261  }
3262  }
3263  if(gammaMC1->GetPdgCode() ==111 ){ // Dalitz candidate
3264  gamma1DalitzCand = kTRUE;
3265  gamma1MotherLabel=-111;
3266  }
3267  }
3268  }
3269  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
3270  if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == fPDGCodeNDM){
3271  isTruePi0=kTRUE;
3272  if (CheckVectorForDoubleCount(fVectorDoubleCountTruePi0s,gamma0MotherLabel) &&(!fDoLightOutput)) fHistoDoubleCountTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3273  }
3274  }
3275 
3276  //Identify Dalitz candidate
3277  if (gamma1DalitzCand || gamma0DalitzCand){
3278  if (gamma0DalitzCand && gamma0MCLabel >=0 && gamma0MCLabel==gamma1MotherLabel){
3279  if (gamma0MotherLabel == -111) isTruePi0Dalitz = kTRUE;
3280  }
3281  if (gamma1DalitzCand && gamma1MCLabel >=0 && gamma1MCLabel==gamma0MotherLabel){
3282  if (gamma1MotherLabel == -111) isTruePi0Dalitz = kTRUE;
3283  }
3284  }
3285 
3286  if(isTruePi0 || isTruePi0Dalitz){// True Pion
3287  Pi0Candidate->SetTrueMesonValue(1);
3288  Pi0Candidate->SetMCLabel(motherRealLabel);
3289  if(!fDoLightOutput){
3290  fHistoTrueMotherGammaGammaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3291  switch( fSelectedHeavyNeutralMeson ) {
3292  case 0: // ETA MESON
3293  if( IsEtaPiPlPiMiPiZeroDaughterAOD(AODMCTrackArray,motherRealLabel) )
3294  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3295  break;
3296  case 1: // OMEGA MESON
3297  if( IsOmegaPiPlPiMiPiZeroDaughterAOD(AODMCTrackArray,motherRealLabel) )
3298  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3299  break;
3300  case 2: // ETA PRIME MESON
3301  if( IsEtaPrimePiPlPiMiEtaDaughterAOD(AODMCTrackArray, motherRealLabel) )
3302  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3303  break;
3304  case 3: // D0 MESON
3305  if( IsD0PiPlPiMiPiZeroDaughterAOD(AODMCTrackArray, motherRealLabel) )
3306  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3307  break;
3308  default:
3309  AliError(Form("Heavy neutral meson not correctly selected (only 0,1,2,3 valid)... selected: %d",fSelectedHeavyNeutralMeson));
3310  }
3311  }
3312  }
3313  }
3314  return;
3315 }
3316 
3317 
3318 //________________________________________________________________________
3320 
3321  // Conversion Gammas
3322  if(fGoodConvGammas->GetEntries()>0){
3323  // vertex
3324  Double_t vertex[3] = {0};
3325  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
3326 
3327  for(Int_t firstGammaIndex=0;firstGammaIndex<fGoodConvGammas->GetEntries();firstGammaIndex++){
3328  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGoodConvGammas->At(firstGammaIndex));
3329  if (gamma0==nullptr) continue;
3330 
3331  for(Int_t secondGammaIndex=0;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
3332  Bool_t matched = kFALSE;
3333  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
3334  if (gamma1==nullptr) continue;
3335 
3336  if (gamma1->GetIsCaloPhoton() > 0){
3337  AliVCluster* cluster = fInputEvent->GetCaloCluster(gamma1->GetCaloClusterRef());
3338  matched = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma0,cluster, fInputEvent );
3339  }
3340 
3341  AliAODConversionMother *NDMcand = new AliAODConversionMother(gamma0,gamma1);
3342  NDMcand->SetLabels(firstGammaIndex,secondGammaIndex);
3343 
3344  if(!fDoLightOutput){
3345  fHistoGammaGammaInvMassPtBeforeCuts[fiCut]->Fill(NDMcand->M(),NDMcand->Pt(), fWeightJetJetMC);
3346  }
3347 
3348  if( ((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->DoGammaMinEnergyCut() ){
3349  Int_t minDaughters = ((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->GetNDaughterEnergyCut();
3350  Float_t minDaughterEnergy = ((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->GetSingleDaughterMinE();
3351  if(minDaughters==1){ // at least one over threshold
3352  if( (gamma0->E() < minDaughterEnergy) && (gamma1->E() < minDaughterEnergy)) continue;
3353  } else if (minDaughters==2){ // both over threshold
3354  if( (gamma0->E() < minDaughterEnergy) || (gamma1->E() < minDaughterEnergy)) continue;
3355  }
3356  }
3357 
3358  if((((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->MesonIsSelected(NDMcand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
3359  if (!matched){
3360  if(fIsMC){
3361  if(fInputEvent->IsA()==AliESDEvent::Class())
3362  ProcessTrueNeutralPionCandidatesMixedConvCalo(NDMcand,gamma0,gamma1);
3363  if(fInputEvent->IsA()==AliAODEvent::Class())
3364  ProcessTrueNeutralPionCandidatesMixedConvCaloAOD(NDMcand,gamma0,gamma1);
3365  }
3366  if (((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(NDMcand, 0)){
3367  fNeutralDecayParticleCandidates->Add(NDMcand);
3368 
3369  if(!fDoLightOutput){
3370  fHistoGammaGammaInvMassPt[fiCut]->Fill(NDMcand->M(),NDMcand->Pt(), fWeightJetJetMC);
3371  }
3372  } else if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseSidebandMixing()) &&
3373  (((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(NDMcand, 1))){
3375 
3376  if(!fDoLightOutput){
3377  fHistoGammaGammaInvMassPt[fiCut]->Fill(NDMcand->M(),NDMcand->Pt(), fWeightJetJetMC);
3378  }
3379  } else if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseSidebandMixingBothSides()) &&
3380  ((((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(NDMcand, 2)) ||
3381  ((((AliConversionMesonCuts*)fNeutralDecayMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(NDMcand, 3))))){
3383 
3384  if(!fDoLightOutput){
3385  fHistoGammaGammaInvMassPt[fiCut]->Fill(NDMcand->M(),NDMcand->Pt(), fWeightJetJetMC);
3386  }
3387  } else{
3388  delete NDMcand;
3389  NDMcand=0x0;
3390  }
3391  }else{
3392  delete NDMcand;
3393  NDMcand=0x0;
3394  }
3395  }else{
3396  delete NDMcand;
3397  NDMcand=0x0;
3398  }
3399  }
3400  }
3401  }
3402 }
3403 
3404 //______________________________________________________________________
3405 void AliAnalysisTaskNeutralMesonToPiPlPiMiNeutralMeson::ProcessTrueNeutralPionCandidatesMixedConvCalo( AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
3406 {
3407  // Process True Mesons
3408  if(TrueGammaCandidate0->GetV0Index()<fInputEvent->GetNumberOfV0s()){
3409  Bool_t isTruePi0 = kFALSE;
3410  Bool_t isTruePi0Dalitz = kFALSE;
3411  Bool_t gamma0DalitzCand = kFALSE;
3412 
3413  Int_t gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(fMCEvent);
3414  Int_t gamma0MotherLabel = -1;
3415  Int_t motherRealLabel = -1;
3416  if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
3417  // Daughters Gamma 0
3418  TParticle * negativeMC = (TParticle*)TrueGammaCandidate0->GetNegativeMCDaughter(fMCEvent);
3419  TParticle * positiveMC = (TParticle*)TrueGammaCandidate0->GetPositiveMCDaughter(fMCEvent);
3420  TParticle * gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
3421  if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
3422  if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
3423  if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
3424  gamma0MotherLabel=gammaMC0->GetFirstMother();
3425  motherRealLabel=gammaMC0->GetFirstMother();
3426  }
3427  }
3428  if(gammaMC0->GetPdgCode() ==111){ // Dalitz candidate
3429  gamma0DalitzCand = kTRUE;
3430  gamma0MotherLabel=-111;
3431  motherRealLabel=gamma0MCLabel;
3432  }
3433 
3434  }
3435  }
3436 
3437  if (TrueGammaCandidate1->GetIsCaloPhoton() == 0) AliFatal("CaloPhotonFlag has not been set. Aborting");
3438 
3439  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
3440  Int_t gamma1MotherLabel = -1;
3441  // check if
3442 
3443  if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
3444  // Daughters Gamma 1
3445  TParticle * gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
3446  if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
3447  // get mother of interest (pi0 or eta)
3448  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
3449  gamma1MotherLabel=gammaMC1->GetMother(0);
3450  } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
3451  if (TrueGammaCandidate1->IsConversion() && gammaMC1->GetMother(0)>-1) gamma1MotherLabel=fMCEvent->Particle(gammaMC1->GetMother(0))->GetMother(0);
3452  else gamma1MotherLabel=gammaMC1->GetMother(0);
3453  }
3454  }
3455  }
3456 
3457  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
3458  if(((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == fPDGCodeNDM){
3459  isTruePi0=kTRUE;
3460  if (CheckVectorForDoubleCount(fVectorDoubleCountTruePi0s,gamma0MotherLabel) && (!fDoLightOutput)) fHistoDoubleCountTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3461  }
3462  }
3463 
3464  if (gamma0DalitzCand ){
3465  if (gamma0DalitzCand && gamma0MCLabel >=0 && gamma0MCLabel==gamma1MotherLabel){
3466  if (gamma0MotherLabel == -111) isTruePi0Dalitz = kTRUE;
3467  }
3468  }
3469 
3470  if(isTruePi0 || isTruePi0Dalitz ){
3471  Pi0Candidate->SetTrueMesonValue(1);
3472  Pi0Candidate->SetMCLabel(motherRealLabel);
3473  if(!fDoLightOutput){
3474  fHistoTrueMotherGammaGammaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3475  switch( fSelectedHeavyNeutralMeson ) {
3476  case 0: // ETA MESON
3477  if( IsEtaPiPlPiMiPiZeroDaughter(motherRealLabel) )
3478  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3479  break;
3480  case 1: // OMEGA MESON
3481  if( IsOmegaPiPlPiMiPiZeroDaughter(motherRealLabel) )
3482  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3483  break;
3484  case 2: // ETA PRIME MESON
3485  if( IsEtaPrimePiPlPiMiEtaDaughter(motherRealLabel) )
3486  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3487  break;
3488  case 3: // D0 MESON
3489  if( IsD0PiPlPiMiPiZeroDaughter(motherRealLabel) )
3490  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3491  break;
3492  default:
3493  AliError(Form("Heavy neutral meson not correctly selected (only 0,1,2,3 valid)... selected: %d",fSelectedHeavyNeutralMeson));
3494  }
3495  }
3496  }
3497  }
3498 }
3499 
3500 //______________________________________________________________________
3501 void AliAnalysisTaskNeutralMesonToPiPlPiMiNeutralMeson::ProcessTrueNeutralPionCandidatesMixedConvCaloAOD( AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
3502 {
3503  // Process True Mesons
3504  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3505  if (AODMCTrackArray == NULL) return;
3506 
3507  AliAODMCParticle * negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
3508  AliAODMCParticle * positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
3509  if(TrueGammaCandidate0->GetV0Index()<fInputEvent->GetNumberOfV0s()){
3510  Bool_t isTruePi0 = kFALSE;
3511  Bool_t isTruePi0Dalitz = kFALSE;
3512  Bool_t gamma0DalitzCand = kFALSE;
3513 
3514  Int_t gamma0MCLabel = positiveMC->GetMother();// check that this always works
3515  Int_t gamma0MotherLabel = -1;
3516 
3517  Int_t motherRealLabel = -1;
3518  if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
3519  // Daughters Gamma 0
3520  AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3521  if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
3522  if(negativeMC->GetMCProcessCode() == 5 && positiveMC->GetMCProcessCode() ==5){ // ... From Conversion ...
3523  if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
3524  gamma0MotherLabel=gammaMC0->GetMother();
3525  motherRealLabel=gammaMC0->GetMother();
3526  }
3527  }
3528  if(gammaMC0->GetPdgCode() ==111){ // Dalitz candidate
3529  gamma0DalitzCand = kTRUE;
3530  gamma0MotherLabel=-111;
3531  motherRealLabel=gamma0MCLabel;
3532  }
3533 
3534  }
3535  }
3536 
3537  if (TrueGammaCandidate1->GetIsCaloPhoton() == 0) AliFatal("CaloPhotonFlag has not been set. Aborting");
3538 
3539  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
3540  Int_t gamma1MotherLabel = -1;
3541  // check if
3542 
3543  if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
3544  // Daughters Gamma 1
3545  AliAODMCParticle *gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
3546  if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
3547  // get mother of interest (pi0 or eta)
3548  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
3549  gamma1MotherLabel=gammaMC1->GetMother();
3550  } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
3551  if (TrueGammaCandidate1->IsConversion() && gammaMC1->GetMother()>-1) gamma1MotherLabel= (static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother())))->GetMother();
3552  else gamma1MotherLabel=gammaMC1->GetMother();
3553  }
3554  }
3555  }
3556 
3557  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
3558  if((static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel)))->GetPdgCode() == fPDGCodeNDM){
3559  isTruePi0=kTRUE;
3560  if (CheckVectorForDoubleCount(fVectorDoubleCountTruePi0s,gamma0MotherLabel) && (!fDoLightOutput)) fHistoDoubleCountTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3561  }
3562  }
3563 
3564  if (gamma0DalitzCand ){
3565  if (gamma0DalitzCand && gamma0MCLabel >=0 && gamma0MCLabel==gamma1MotherLabel){
3566  if (gamma0MotherLabel == -111) isTruePi0Dalitz = kTRUE;
3567  }
3568  }
3569 
3570  if(isTruePi0 || isTruePi0Dalitz ){
3571  Pi0Candidate->SetTrueMesonValue(1);
3572  Pi0Candidate->SetMCLabel(motherRealLabel);
3573  if(!fDoLightOutput){
3574  fHistoTrueMotherGammaGammaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3575  switch( fSelectedHeavyNeutralMeson ) {
3576  case 0: // ETA MESON
3577  if( IsEtaPiPlPiMiPiZeroDaughterAOD(AODMCTrackArray,motherRealLabel) )
3578  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3579  break;
3580  case 1: // OMEGA MESON
3581  if( IsOmegaPiPlPiMiPiZeroDaughterAOD(AODMCTrackArray, motherRealLabel) )
3582  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3583  break;
3584  case 2: // ETA PRIME MESON
3585  if( IsEtaPrimePiPlPiMiEtaDaughterAOD(AODMCTrackArray, motherRealLabel) )
3586  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3587  break;
3588  case 3: // D0 MESON
3589  if( IsD0PiPlPiMiPiZeroDaughterAOD(AODMCTrackArray, motherRealLabel) )
3590  fHistoTrueMotherGammaGammaFromHNMInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt(), fWeightJetJetMC);
3591  break;
3592  default:
3593  AliError(Form("Heavy neutral meson not correctly selected (only 0,1,2,3 valid)... selected: %d",fSelectedHeavyNeutralMeson));
3594  }
3595  }
3596  }
3597  }
3598 }
3599 
3600 
3601 //________________________________________________________________________
3603 
3604  Bool_t use4vecformass = ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->Use4VecForMass();
3605 
3606  Double_t magField = fInputEvent->GetMagneticField();
3607  if( magField < 0.0 ){
3608  magField = 1.0;
3609  } else {
3610  magField = -1.0;
3611  }
3612 
3613  vector<Int_t> lGoodNegPionIndexPrev(0);
3614  vector<Int_t> lGoodPosPionIndexPrev(0);
3615  for(UInt_t i = 0; i < fSelectorNegPionIndex.size(); i++){
3616 
3617  AliESDtrack* negPionCandidate =dynamic_cast<AliESDtrack*>(fInputEvent->GetTrack(fSelectorNegPionIndex[i]));
3618  if(! ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->PionIsSelected(negPionCandidate) ) continue;
3619  lGoodNegPionIndexPrev.push_back( fSelectorNegPionIndex[i] );
3620 
3621  TLorentzVector* negPionforHandler = new TLorentzVector();
3622  negPionforHandler->SetPxPyPzE(negPionCandidate->Px(), negPionCandidate->Py(), negPionCandidate->Pz(), negPionCandidate->E());
3623  FixPzVecToMatchPDGInvMass(negPionforHandler);
3624  AliAODConversionPhoton *negPionHandler = new AliAODConversionPhoton(negPionforHandler);
3625  delete negPionforHandler;
3626 
3627  fNegPionCandidates->Add(negPionHandler);
3628  if(!fDoLightOutput){
3629  fHistoNegPionPt[fiCut]->Fill(negPionCandidate->Pt(), fWeightJetJetMC);
3630  fHistoNegPionPhi[fiCut]->Fill(negPionCandidate->Phi(), fWeightJetJetMC);
3631  }
3632 
3633  if( fMCEvent ) {
3634  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3635  Double_t mcProdVtxX = primVtxMC->GetX();
3636  Double_t mcProdVtxY = primVtxMC->GetY();
3637  Double_t mcProdVtxZ = primVtxMC->GetZ();
3638 
3639  Int_t labelNegPion = TMath::Abs( negPionCandidate->GetLabel() );
3640  Bool_t negPionIsPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, labelNegPion, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3641  if( labelNegPion>-1 && labelNegPion < fMCEvent->GetNumberOfTracks() ){
3642  TParticle* negPion = fMCEvent->Particle(labelNegPion);
3643  if( negPion->GetPdgCode() == -211 ){
3644  if(!fDoLightOutput){
3645  if( negPionIsPrimary ){
3646  fHistoTrueNegPionPt[fiCut]->Fill(negPionCandidate->Pt(), fWeightJetJetMC); //primary negPion
3647  }
3648  switch( fSelectedHeavyNeutralMeson ) {
3649  case 0: // ETA MESON
3650  if( IsEtaPiPlPiMiPiZeroDaughter(labelNegPion) && negPionIsPrimary )
3651  fHistoTrueNegPionFromNeutralMesonPt[fiCut]->Fill(negPionCandidate->Pt(), fWeightJetJetMC);
3652  break;
3653  case 1: // OMEGA MESON
3654  if( IsOmegaPiPlPiMiPiZeroDaughter(labelNegPion) && negPionIsPrimary)
3655  fHistoTrueNegPionFromNeutralMesonPt[fiCut]->Fill(negPionCandidate->Pt(), fWeightJetJetMC);
3656  break;
3657  case 2: // ETA PRIME MESON
3658  if( IsEtaPrimePiPlPiMiEtaDaughter(labelNegPion) && negPionIsPrimary)
3659  fHistoTrueNegPionFromNeutralMesonPt[fiCut]->Fill(negPionCandidate->Pt(), fWeightJetJetMC);
3660  break;
3661  case 3: // D0 MESON
3662  if( IsD0PiPlPiMiPiZeroDaughter(labelNegPion)& negPionIsPrimary)
3663  fHistoTrueNegPionFromNeutralMesonPt[fiCut]->Fill(negPionCandidate->Pt(), fWeightJetJetMC);
3664  break;
3665  default:
3666  AliError(Form("Heavy neutral meson not correctly selected (only 0,1,2,3 valid)... selected: %d",fSelectedHeavyNeutralMeson));
3667  }
3668  }
3669  }
3670  }
3671  }
3672  }
3673  for(UInt_t i = 0; i < fSelectorPosPionIndex.size(); i++){
3674  AliESDtrack* posPionCandidate = dynamic_cast<AliESDtrack*>(fInputEvent->GetTrack(fSelectorPosPionIndex[i]));
3675  if(! ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->PionIsSelected(posPionCandidate) ) continue;
3676  lGoodPosPionIndexPrev.push_back( fSelectorPosPionIndex[i] );
3677 
3678  TLorentzVector* posPionforHandler = new TLorentzVector();
3679  posPionforHandler->SetPxPyPzE(posPionCandidate->Px(), posPionCandidate->Py(), posPionCandidate->Pz(), posPionCandidate->E());
3680  FixPzVecToMatchPDGInvMass(posPionforHandler);
3681  AliAODConversionPhoton *posPionHandler = new AliAODConversionPhoton(posPionforHandler);
3682  delete posPionforHandler;
3683 
3684  fPosPionCandidates->Add(posPionHandler);
3685  if(!fDoLightOutput){
3686  fHistoPosPionPt[fiCut]->Fill(posPionCandidate->Pt(), fWeightJetJetMC);
3687  fHistoPosPionPhi[fiCut]->Fill(posPionCandidate->Phi(), fWeightJetJetMC);
3688  }
3689  if( fMCEvent ) {
3690  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
3691  Double_t mcProdVtxX = primVtxMC->GetX();
3692  Double_t mcProdVtxY = primVtxMC->GetY();
3693  Double_t mcProdVtxZ = primVtxMC->GetZ();
3694 
3695  Int_t labelPosPion = TMath::Abs( posPionCandidate->GetLabel() );
3696  Bool_t posPionIsPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, labelPosPion, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
3697  if( labelPosPion>-1 && labelPosPion < fMCEvent->GetNumberOfTracks() ) {
3698  TParticle* posPion = fMCEvent->Particle(labelPosPion);
3699  if( posPion->GetPdgCode() == 211 ){
3700  if(!fDoLightOutput){
3701  if( posPionIsPrimary ){
3702  fHistoTruePosPionPt[fiCut]->Fill(posPionCandidate->Pt(), fWeightJetJetMC);
3703  }
3704  switch( fSelectedHeavyNeutralMeson ) {
3705  case 0: // ETA MESON
3706  if( IsEtaPiPlPiMiPiZeroDaughter(labelPosPion) && posPionIsPrimary )
3707  fHistoTruePosPionFromNeutralMesonPt[fiCut]->Fill(posPionCandidate->Pt(), fWeightJetJetMC);
3708  break;
3709  case 1: // OMEGA MESON
3710  if( IsOmegaPiPlPiMiPiZeroDaughter(labelPosPion) && posPionIsPrimary)
3711  fHistoTruePosPionFromNeutralMesonPt[fiCut]->Fill(posPionCandidate->Pt(), fWeightJetJetMC);
3712  break;
3713  case 2: // ETA PRIME MESON
3714  if( IsEtaPrimePiPlPiMiEtaDaughter(labelPosPion) && posPionIsPrimary)
3715  fHistoTruePosPionFromNeutralMesonPt[fiCut]->Fill(posPionCandidate->Pt(), fWeightJetJetMC);
3716  break;
3717  case 3: // D0 MESON
3718  if( IsD0PiPlPiMiPiZeroDaughter(labelPosPion) && posPionIsPrimary )
3719  fHistoTruePosPionFromNeutralMesonPt[fiCut]->Fill(posPionCandidate->Pt(), fWeightJetJetMC);
3720  break;
3721  default:
3722  AliError(Form("Heavy neutral meson not correctly selected (only 0,1,2,3 valid)... selected: %d",fSelectedHeavyNeutralMeson));
3723  }
3724  }
3725  }
3726  }
3727  }
3728  }
3729  // AliInfo(Form("Number of good neg pions: %i \t pos pions = %i", lGoodNegPionIndexPrev.size(), lGoodPosPionIndexPrev.size()));
3730 
3731  for(UInt_t i = 0; i < lGoodNegPionIndexPrev.size(); i++){
3732  AliVTrack* negPionCandidate = dynamic_cast<AliVTrack*>(fInputEvent->GetTrack(lGoodNegPionIndexPrev[i]));
3733 
3734  //AliKFParticle negPionCandidateKF( *negPionCandidate->GetConstrainedParam(), 211 );
3735  AliKFParticle negPionCandidateKF( *negPionCandidate, 211 );
3736  for(UInt_t j = 0; j < lGoodPosPionIndexPrev.size(); j++){
3737  AliVTrack *posPionCandidate = dynamic_cast<AliVTrack*>(fInputEvent->GetTrack(lGoodPosPionIndexPrev[j]));
3738  //AliKFParticle posPionCandidateKF( *posPionCandidate->GetConstrainedParam(), 211 );
3739  AliKFParticle posPionCandidateKF( *posPionCandidate, 211 );
3740  // AliInfo(Form("virtualPhoton distance before pi+ pi- = %f", negPionCandidateKF.GetDistanceFromParticle(posPionCandidateKF)));
3741 
3742  AliKFConversionPhoton virtualPhoton(negPionCandidateKF,posPionCandidateKF);
3743 
3744  // AliInfo(Form(" GetPrimaryVertex() x=%f y=%f z=%f",primx,primy,primz));
3745  // virtualPhoton->SetProductionVertex(primaryVertex);
3746  virtualPhoton.SetTrackLabels( lGoodPosPionIndexPrev[j], lGoodNegPionIndexPrev[i]);
3747 
3748  TLorentzVector posPionVec4;
3749  TLorentzVector negPionVec4;
3750  TLorentzVector virtPionVec4;
3751  TLorentzVector posKFPionVec4;
3752  TLorentzVector negKFPionVec4;
3753  TLorentzVector virtKFPionVec4;
3754 
3755  if(use4vecformass){
3756  posKFPionVec4.SetPxPyPzE(posPionCandidateKF.Px(),posPionCandidateKF.Py(),posPionCandidateKF.Pz(),posPionCandidateKF.E());
3757  negKFPionVec4.SetPxPyPzE(negPionCandidateKF.Px(),negPionCandidateKF.Py(),negPionCandidateKF.Pz(),negPionCandidateKF.E());
3758  virtKFPionVec4 = posKFPionVec4 + negKFPionVec4;
3759  }
3760 
3761  Int_t labeln=0;
3762  Int_t labelp=0;
3763  Int_t motherlabelp = 0;
3764  Int_t motherlabeln = 0;
3765  TParticle *fNegativeMCParticle =nullptr;
3766  TParticle *fPositiveMCParticle =nullptr;
3767  if( fMCEvent ) {
3768  labeln=TMath::Abs(negPionCandidate->GetLabel());
3769  labelp=TMath::Abs(posPionCandidate->GetLabel());
3770  if(labeln>-1) fNegativeMCParticle = fMCEvent->Particle(labeln);
3771  if(labelp>-1) fPositiveMCParticle = fMCEvent->Particle(labelp);
3772  // check whether MC particles exist, else abort
3773  if (fNegativeMCParticle == nullptr || fPositiveMCParticle == nullptr) return;
3774 
3775  motherlabeln = fNegativeMCParticle->GetMother(0);
3776  motherlabelp = fPositiveMCParticle->GetMother(0);
3777  virtualPhoton.SetMCLabelPositive(labelp);
3778  virtualPhoton.SetMCLabelNegative(labeln);
3779 
3780  }
3781  AliAODConversionPhoton *vParticle = new AliAODConversionPhoton(&virtualPhoton); //To apply mass 2 pion mass cut
3782  if(use4vecformass){
3783  vParticle->SetPxPyPzE(virtKFPionVec4.Px(),virtKFPionVec4.Py(),virtKFPionVec4.Pz(),virtKFPionVec4.E());
3784  // set mass to one calculated from four vector, not from parameters
3785  vParticle->SetMass(vParticle->M());
3786  }
3787  if(!fDoLightOutput){
3788  Double_t ds,dsp;
3789  posPionCandidateKF.GetDStoParticle(negPionCandidateKF,ds,dsp);
3790  Float_t chi2 = virtualPhoton.GetChi2perNDF();
3791  if(chi2>299) chi2 = 299; // to illustrate overflow bin
3794  if (fMCEvent &&(fDoMesonQA>0)){
3795  if (fPositiveMCParticle && fNegativeMCParticle ) {
3796  if (((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->DoMassCut()){
3797  if (vParticle->GetMass() < ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetMassCut()){
3798  if(TMath::Abs(fNegativeMCParticle->GetPdgCode())==211 && TMath::Abs(fPositiveMCParticle->GetPdgCode())==211){ // Pions ...
3799  fHistoTruePionPionInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt(), fWeightJetJetMC);
3802  if (motherlabeln == motherlabelp){
3803  fHistoTruePionPionFromSameMotherInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt(), fWeightJetJetMC);
3806  switch( fSelectedHeavyNeutralMeson ) {
3807  case 0: // ETA MESON
3808  if( IsEtaPiPlPiMiPiZeroDaughter(labeln) ){
3809  fHistoTruePionPionFromHNMInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt(), fWeightJetJetMC);
3812  }
3813  break;
3814  case 1: // OMEGA MESON
3815  if( IsOmegaPiPlPiMiPiZeroDaughter(labeln) ){
3816  fHistoTruePionPionFromHNMInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt(), fWeightJetJetMC);
3819  }
3820  break;
3821  case 2: // ETA PRIME MESON
3822  if( IsEtaPrimePiPlPiMiEtaDaughter(labeln) ){
3823  fHistoTruePionPionFromHNMInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt(), fWeightJetJetMC);
3826  }
3827  break;
3828  case 3: // D0 MESON
3829  if( IsD0PiPlPiMiPiZeroDaughter(labeln) ){
3830  fHistoTruePionPionFromHNMInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt(), fWeightJetJetMC);
3833  }
3834  break;
3835  default:
3836  AliError(Form("Heavy neutral meson not correctly selected (only 0,1,2,3 valid)... selected: %d",fSelectedHeavyNeutralMeson));
3837  }
3838  }
3839  }
3840  }
3841  } else {
3842  if(TMath::Abs(fNegativeMCParticle->GetPdgCode())==211 && TMath::Abs(fPositiveMCParticle->GetPdgCode())==211){ // Pions ...
3843  fHistoTruePionPionInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt(), fWeightJetJetMC);
3846  if (motherlabeln == motherlabelp){
3847  fHistoTruePionPionFromSameMotherInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt(), fWeightJetJetMC);
3850  switch( fSelectedHeavyNeutralMeson ) {
3851  case 0: // ETA MESON
3852  if( IsEtaPiPlPiMiPiZeroDaughter(labeln) ){
3853  fHistoTruePionPionFromHNMInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt(), fWeightJetJetMC);
3856  }
3857  break;
3858  case 1: // OMEGA MESON
3859  if( IsOmegaPiPlPiMiPiZeroDaughter(labeln) ){
3860  fHistoTruePionPionFromHNMInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt(), fWeightJetJetMC);
3863  }
3864  break;
3865  case 2: // ETA PRIME MESON
3866  if( IsEtaPrimePiPlPiMiEtaDaughter(labeln) ){
3867  fHistoTruePionPionFromHNMInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt(), fWeightJetJetMC);
3870  }
3871  break;
3872  case 3: // D0 MESON
3873  if( IsD0PiPlPiMiPiZeroDaughter(labeln) ){
3874  fHistoTruePionPionFromHNMInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt(), fWeightJetJetMC);
3877  }
3878  break;
3879  default:
3880  AliError(Form("Heavy neutral meson not correctly selected (only 0,1,2,3 valid)... selected: %d",