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