AliPhysics  aaf9c62 (aaf9c62)
AliAnalysisTaskNeutralMesonToPiPlPiMiPiZero.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 <vector>
19 #include "TParticle.h"
20 #include "TPDGCode.h"
21 #include "TMCProcess.h"
22 #include "TDatabasePDG.h"
23 #include "TList.h"
24 #include "TChain.h"
25 #include "TDirectory.h"
26 #include "TTree.h"
27 #include "TH1.h"
28 #include "TH1F.h"
29 #include "THnSparse.h"
30 #include "TH2F.h"
31 #include "AliAnalysisManager.h"
32 #include "AliESDInputHandler.h"
33 #include "AliESDtrack.h"
34 #include "AliMCEvent.h"
35 #include "AliMCEventHandler.h"
36 #include "AliPID.h"
37 #include "AliLog.h"
38 #include "AliESDtrackCuts.h"
39 #include "AliESDpidCuts.h"
40 #include "AliMCEvent.h"
41 #include "AliESDv0.h"
42 #include "AliESDEvent.h"
43 #include "AliESDpid.h"
44 #include "AliKFParticle.h"
45 #include "AliMCEventHandler.h"
46 #include "AliKFVertex.h"
47 #include "AliTriggerAnalysis.h"
48 #include "AliCentrality.h"
49 #include "AliMultiplicity.h"
50 #include "AliAODEvent.h"
52 #include "AliCaloTrackMatcher.h"
53 #include <vector>
54 
56 
57 //-----------------------------------------------------------------------------------------------
59  fV0Reader(NULL),
60  fV0ReaderName("V0ReaderV1"),
61  fPionSelector(NULL),
62  fBGHandlerPiPl(NULL),
63  fBGHandlerPiMi(NULL),
64  fESDEvent(NULL),
65  fMCEvent(NULL),
66  fCutFolder(NULL),
67  fESDList(NULL),
68  fTrueList(NULL),
69  fTrueTreeList(NULL),
70  fMCList(NULL),
71  fOutputContainer(0),
72  fReaderGammas(NULL),
73  fSelectorNegPionIndex(0),
74  fSelectorPosPionIndex(0),
75  fGoodConvGammas(NULL),
76  fClusterCandidates(NULL),
77  fNeutralPionCandidates(NULL),
78  fNeutralPionSidebandCandidates(NULL),
79  fPosPionCandidates(NULL),
80  fNegPionCandidates(NULL),
81  fGoodVirtualParticles(NULL),
82  fEventCutArray(NULL),
83  fGammaCutArray(NULL),
84  fClusterCutArray(NULL),
85  fPionCutArray(NULL),
86  fNeutralPionMesonCutArray(NULL),
87  fMesonCutArray(NULL),
88  fEventCuts(NULL),
89  fConversionCuts(NULL),
90  fClusterCuts(NULL),
91  fTreePiPiSameMother(NULL),
92  fTreePiPiPiSameMother(NULL),
93  fTreeEventInfoOmega(NULL),
94  fTreeEventInfoEta(NULL),
95  fCasePiPi(-1),
96  fSamePiPiMotherID(-1),
97  fSamePiPiMotherInvMass(-1),
98  fSamePiPiMotherPt(-1),
99  fSamePiPiPiMotherID(-1),
100  fSamePiPiPiMotherInvMass(-1),
101  fSamePiPiPiMotherPt(-1),
102  fV0MultiplicityOmegaEvent(-1),
103  fTrackMultiplicityOmegaEvent(-1),
104  fZVertexOmegaEvent(-1),
105  fPtOmega(-1),
106  fV0MultiplicityEtaEvent(-1),
107  fTrackMultiplicityEtaEvent(-1),
108  fZVertexEtaEvent(-1),
109  fPtEta(-1),
110  fPDGMassPi0(-1),
111  fHistoConvGammaPt(NULL),
112  fHistoConvGammaEta(NULL),
113  fHistoClusterGammaPt(NULL),
114  fHistoClusterGammaEta(NULL),
115  fHistoNegPionPt(NULL),
116  fHistoPosPionPt(NULL),
117  fHistoNegPionPhi(NULL),
118  fHistoPosPionPhi(NULL),
119  fHistoNegPionEta(NULL),
120  fHistoPosPionEta(NULL),
121  fHistoNegPionClsTPC(NULL),
122  fHistoPosPionClsTPC(NULL),
123  fHistoPionDCAxy(NULL),
124  fHistoPionDCAz(NULL),
125  fHistoPionTPCdEdxNSigma(NULL),
126  fHistoPionTPCdEdx(NULL),
127  fHistoPionPionInvMassPt(NULL),
128  fHistoGammaGammaInvMassPt(NULL),
129  fHistoMotherInvMassPt(NULL),
130  fHistoMotherInvMassPtRejectedKinematic(NULL),
131  fHistoBackInvMassPtGroup1(NULL),
132  fHistoBackInvMassPtGroup2(NULL),
133  fHistoBackInvMassPtGroup3(NULL),
134  fHistoBackInvMassPtGroup4(NULL),
135  fHistoMotherLikeSignBackInvMassPt(NULL),
136  fHistoAngleOmegaPiPlPiMi(NULL),
137  fHistoAngleOmegaPiZero(NULL),
138  fHistoAngleOmegaPiPl(NULL),
139  fHistoAngleOmegaPiMi(NULL),
140  fHistoAnglePiPlPiMi(NULL),
141  fHistoAnglePiZeroPiMi(NULL),
142  fHistoAnglePiPlPiZero(NULL),
143  fHistoAngleSum(NULL),
144  fHistoTrueAngleSum(NULL),
145  fHistoMotherInvMassSubPi0(NULL),
146  fHistoBackInvMassPtGroup1SubPi0(NULL),
147  fHistoBackInvMassPtGroup2SubPi0(NULL),
148  fHistoBackInvMassPtGroup3SubPi0(NULL),
149  fHistoBackInvMassPtGroup4SubPi0(NULL),
150  fHistoMotherLikeSignBackInvMassSubPi0Pt(NULL),
151  fHistoMotherInvMassFixedPzPi0(NULL),
152  fHistoBackInvMassPtGroup1FixedPzPi0(NULL),
153  fHistoBackInvMassPtGroup2FixedPzPi0(NULL),
154  fHistoBackInvMassPtGroup3FixedPzPi0(NULL),
155  fHistoBackInvMassPtGroup4FixedPzPi0(NULL),
156  fHistoMotherLikeSignBackInvMassFixedPzPi0Pt(NULL),
157  fHistoMCAllGammaPt(NULL),
158  fHistoMCConvGammaPt(NULL),
159  fHistoMCAllPosPionsPt(NULL),
160  fHistoMCAllNegPionsPt(NULL),
161  fHistoMCGammaFromNeutralMesonPt(NULL),
162  fHistoMCPosPionsFromNeutralMesonPt(NULL),
163  fHistoMCNegPionsFromNeutralMesonPt(NULL),
164  fHistoMCEtaPiPlPiMiPiZeroPt(NULL),
165  fHistoMCEtaPiPlPiMiPiZeroInAccPt(NULL),
166  fHistoMCOmegaPiPlPiMiPiZeroPt(NULL),
167  fHistoMCOmegaPiPlPiMiPiZeroInAccPt(NULL),
168  fHistoTrueMotherPiPlPiMiPiZeroInvMassPt(NULL),
169  fHistoTrueMotherOmegaPiPlPiMiPiZeroInvMassPt(NULL),
170  fHistoTrueMotherEtaPiPlPiMiPiZeroInvMassPt(NULL),
171  fHistoTrueMotherGammaGammaInvMassPt(NULL),
172  fHistoTrueMotherGammaGammaFromEtaInvMassPt(NULL),
173  fHistoTrueMotherGammaGammaFromOmegaInvMassPt(NULL),
174  fHistoTrueConvGammaPt(NULL),
175  fHistoTrueConvGammaFromNeutralMesonPt(NULL),
176  fHistoTrueClusterGammaPt(NULL),
177  fHistoTrueClusterGammaFromNeutralMesonPt(NULL),
178  fHistoTruePosPionPt(NULL),
179  fHistoTruePosPionFromNeutralMesonPt(NULL),
180  fHistoTrueNegPionPt(NULL),
181  fHistoTrueNegPionFromNeutralMesonPt(NULL),
182  fHistoTruePionPionInvMassPt(NULL),
183  fHistoTruePionPionFromSameMotherInvMassPt(NULL),
184  fHistoTruePionPionFromEtaInvMassPt(NULL),
185  fHistoTruePionPionFromOmegaInvMassPt(NULL),
186  fHistoTruePiPlPiMiSameMotherFromEtaInvMassPt(NULL),
187  fHistoTruePiPlPiMiSameMotherFromOmegaInvMassPt(NULL),
188  fHistoTruePiPlPiMiSameMotherFromRhoInvMassPt(NULL),
189  fHistoTruePiPlPiMiSameMotherFromEtaPrimeInvMassPt(NULL),
190  fHistoTruePiPlPiMiSameMotherFromK0sInvMassPt(NULL),
191  fHistoTruePiPlPiMiSameMotherFromK0lInvMassPt(NULL),
192  fHistoTruePiMiPiZeroSameMotherFromEtaInvMassPt(NULL),
193  fHistoTruePiMiPiZeroSameMotherFromOmegaInvMassPt(NULL),
194  fHistoTruePiMiPiZeroSameMotherFromRhoInvMassPt(NULL),
195  fHistoTruePiMiPiZeroSameMotherFromK0lInvMassPt(NULL),
196  fHistoTruePiPlPiZeroSameMotherFromEtaInvMassPt(NULL),
197  fHistoTruePiPlPiZeroSameMotherFromOmegaInvMassPt(NULL),
198  fHistoTruePiPlPiZeroSameMotherFromRhoInvMassPt(NULL),
199  fHistoTruePiPlPiZeroSameMotherFromK0lInvMassPt(NULL),
200  fHistoTruePiPlPiMiPiZeroPureCombinatoricalInvMassPt(NULL),
201  fHistoTruePiPlPiMiPiZeroContaminationInvMassPt(NULL),
202  fHistoDoubleCountTruePi0InvMassPt(NULL),
203  fHistoDoubleCountTrueEtaInvMassPt(NULL),
204  fHistoDoubleCountTrueOmegaInvMassPt(NULL),
205  fHistoDoubleCountTrueConvGammaRPt(NULL),
206  fVectorDoubleCountTruePi0s(0),
207  fVectorDoubleCountTrueEtas(0),
208  fVectorDoubleCountTrueOmegas(0),
209  fVectorDoubleCountTrueConvGammas(0),
210  fHistoNEvents(NULL),
211  fHistoNGoodESDTracks(NULL),
212  fProfileEtaShift(NULL),
213  fHistoSPDClusterTrackletBackground(NULL),
214  fRandom(0),
215  fnCuts(0),
216  fiCut(0),
217  fNumberOfESDTracks(0),
218  fMoveParticleAccordingToVertex(kFALSE),
219  fIsHeavyIon(0),
220  fDoMesonAnalysis(kTRUE),
221  fDoMesonQA(0),
222  fIsFromMBHeader(kTRUE),
223  fIsMC(kFALSE),
224  fDoLightOutput(kFALSE),
225  fNeutralPionMode(0),
226  fTolerance(-1)
227 {
228 
229 }
230 
231 //-----------------------------------------------------------------------------------------------
233  AliAnalysisTaskSE(name),
234  fV0Reader(NULL),
235  fV0ReaderName("V0ReaderV1"),
236  fPionSelector(NULL),
237  fBGHandlerPiPl(NULL),
238  fBGHandlerPiMi(NULL),
239  fESDEvent(NULL),
240  fMCEvent(NULL),
241  fCutFolder(NULL),
242  fESDList(NULL),
243  fTrueList(NULL),
244  fTrueTreeList(NULL),
245  fMCList(NULL),
246  fOutputContainer(0),
247  fReaderGammas(NULL),
248  fSelectorNegPionIndex(0),
249  fSelectorPosPionIndex(0),
250  fGoodConvGammas(NULL),
251  fClusterCandidates(NULL),
252  fNeutralPionCandidates(NULL),
253  fNeutralPionSidebandCandidates(NULL),
254  fPosPionCandidates(NULL),
255  fNegPionCandidates(NULL),
256  fGoodVirtualParticles(NULL),
257  fEventCutArray(NULL),
258  fGammaCutArray(NULL),
259  fClusterCutArray(NULL),
260  fPionCutArray(NULL),
261  fNeutralPionMesonCutArray(NULL),
262  fMesonCutArray(NULL),
263  fEventCuts(NULL),
264  fConversionCuts(NULL),
265  fClusterCuts(NULL),
266  fTreePiPiSameMother(NULL),
267  fTreePiPiPiSameMother(NULL),
268  fTreeEventInfoOmega(NULL),
269  fTreeEventInfoEta(NULL),
270  fCasePiPi(-1),
271  fSamePiPiMotherID(-1),
272  fSamePiPiMotherInvMass(-1),
273  fSamePiPiMotherPt(-1),
274  fSamePiPiPiMotherID(-1),
275  fSamePiPiPiMotherInvMass(-1),
276  fSamePiPiPiMotherPt(-1),
277  fV0MultiplicityOmegaEvent(-1),
278  fTrackMultiplicityOmegaEvent(-1),
279  fZVertexOmegaEvent(-1),
280  fPtOmega(-1),
281  fV0MultiplicityEtaEvent(-1),
282  fTrackMultiplicityEtaEvent(-1),
283  fZVertexEtaEvent(-1),
284  fPtEta(-1),
285  fPDGMassPi0(-1),
286  fHistoConvGammaPt(NULL),
287  fHistoConvGammaEta(NULL),
288  fHistoClusterGammaPt(NULL),
289  fHistoClusterGammaEta(NULL),
290  fHistoNegPionPt(NULL),
291  fHistoPosPionPt(NULL),
292  fHistoNegPionPhi(NULL),
293  fHistoPosPionPhi(NULL),
294  fHistoNegPionEta(NULL),
295  fHistoPosPionEta(NULL),
296  fHistoNegPionClsTPC(NULL),
297  fHistoPosPionClsTPC(NULL),
298  fHistoPionDCAxy(NULL),
299  fHistoPionDCAz(NULL),
300  fHistoPionTPCdEdxNSigma(NULL),
301  fHistoPionTPCdEdx(NULL),
302  fHistoPionPionInvMassPt(NULL),
303  fHistoGammaGammaInvMassPt(NULL),
304  fHistoMotherInvMassPt(NULL),
305  fHistoMotherInvMassPtRejectedKinematic(NULL),
306  fHistoBackInvMassPtGroup1(NULL),
307  fHistoBackInvMassPtGroup2(NULL),
308  fHistoBackInvMassPtGroup3(NULL),
309  fHistoBackInvMassPtGroup4(NULL),
310  fHistoMotherLikeSignBackInvMassPt(NULL),
311  fHistoAngleOmegaPiPlPiMi(NULL),
312  fHistoAngleOmegaPiZero(NULL),
313  fHistoAngleOmegaPiPl(NULL),
314  fHistoAngleOmegaPiMi(NULL),
315  fHistoAnglePiPlPiMi(NULL),
316  fHistoAnglePiZeroPiMi(NULL),
317  fHistoAnglePiPlPiZero(NULL),
318  fHistoAngleSum(NULL),
319  fHistoTrueAngleSum(NULL),
320  fHistoMotherInvMassSubPi0(NULL),
321  fHistoBackInvMassPtGroup1SubPi0(NULL),
322  fHistoBackInvMassPtGroup2SubPi0(NULL),
323  fHistoBackInvMassPtGroup3SubPi0(NULL),
324  fHistoBackInvMassPtGroup4SubPi0(NULL),
325  fHistoMotherLikeSignBackInvMassSubPi0Pt(NULL),
326  fHistoMotherInvMassFixedPzPi0(NULL),
327  fHistoBackInvMassPtGroup1FixedPzPi0(NULL),
328  fHistoBackInvMassPtGroup2FixedPzPi0(NULL),
329  fHistoBackInvMassPtGroup3FixedPzPi0(NULL),
330  fHistoBackInvMassPtGroup4FixedPzPi0(NULL),
331  fHistoMotherLikeSignBackInvMassFixedPzPi0Pt(NULL),
332  fHistoMCAllGammaPt(NULL),
333  fHistoMCConvGammaPt(NULL),
334  fHistoMCAllPosPionsPt(NULL),
335  fHistoMCAllNegPionsPt(NULL),
336  fHistoMCGammaFromNeutralMesonPt(NULL),
337  fHistoMCPosPionsFromNeutralMesonPt(NULL),
338  fHistoMCNegPionsFromNeutralMesonPt(NULL),
339  fHistoMCEtaPiPlPiMiPiZeroPt(NULL),
340  fHistoMCEtaPiPlPiMiPiZeroInAccPt(NULL),
341  fHistoMCOmegaPiPlPiMiPiZeroPt(NULL),
342  fHistoMCOmegaPiPlPiMiPiZeroInAccPt(NULL),
343  fHistoTrueMotherPiPlPiMiPiZeroInvMassPt(NULL),
344  fHistoTrueMotherOmegaPiPlPiMiPiZeroInvMassPt(NULL),
345  fHistoTrueMotherEtaPiPlPiMiPiZeroInvMassPt(NULL),
346  fHistoTrueMotherGammaGammaInvMassPt(NULL),
347  fHistoTrueMotherGammaGammaFromEtaInvMassPt(NULL),
348  fHistoTrueMotherGammaGammaFromOmegaInvMassPt(NULL),
349  fHistoTrueConvGammaPt(NULL),
350  fHistoTrueConvGammaFromNeutralMesonPt(NULL),
351  fHistoTrueClusterGammaPt(NULL),
352  fHistoTrueClusterGammaFromNeutralMesonPt(NULL),
353  fHistoTruePosPionPt(NULL),
354  fHistoTruePosPionFromNeutralMesonPt(NULL),
355  fHistoTrueNegPionPt(NULL),
356  fHistoTrueNegPionFromNeutralMesonPt(NULL),
357  fHistoTruePionPionInvMassPt(NULL),
358  fHistoTruePionPionFromSameMotherInvMassPt(NULL),
359  fHistoTruePionPionFromEtaInvMassPt(NULL),
360  fHistoTruePionPionFromOmegaInvMassPt(NULL),
361  fHistoTruePiPlPiMiSameMotherFromEtaInvMassPt(NULL),
362  fHistoTruePiPlPiMiSameMotherFromOmegaInvMassPt(NULL),
363  fHistoTruePiPlPiMiSameMotherFromRhoInvMassPt(NULL),
364  fHistoTruePiPlPiMiSameMotherFromEtaPrimeInvMassPt(NULL),
365  fHistoTruePiPlPiMiSameMotherFromK0sInvMassPt(NULL),
366  fHistoTruePiPlPiMiSameMotherFromK0lInvMassPt(NULL),
367  fHistoTruePiMiPiZeroSameMotherFromEtaInvMassPt(NULL),
368  fHistoTruePiMiPiZeroSameMotherFromOmegaInvMassPt(NULL),
369  fHistoTruePiMiPiZeroSameMotherFromRhoInvMassPt(NULL),
370  fHistoTruePiMiPiZeroSameMotherFromK0lInvMassPt(NULL),
371  fHistoTruePiPlPiZeroSameMotherFromEtaInvMassPt(NULL),
372  fHistoTruePiPlPiZeroSameMotherFromOmegaInvMassPt(NULL),
373  fHistoTruePiPlPiZeroSameMotherFromRhoInvMassPt(NULL),
374  fHistoTruePiPlPiZeroSameMotherFromK0lInvMassPt(NULL),
375  fHistoTruePiPlPiMiPiZeroPureCombinatoricalInvMassPt(NULL),
376  fHistoTruePiPlPiMiPiZeroContaminationInvMassPt(NULL),
377  fHistoDoubleCountTruePi0InvMassPt(NULL),
378  fHistoDoubleCountTrueEtaInvMassPt(NULL),
379  fHistoDoubleCountTrueOmegaInvMassPt(NULL),
380  fHistoDoubleCountTrueConvGammaRPt(NULL),
381  fVectorDoubleCountTruePi0s(0),
382  fVectorDoubleCountTrueEtas(0),
383  fVectorDoubleCountTrueOmegas(0),
384  fVectorDoubleCountTrueConvGammas(0),
385  fHistoNEvents(NULL),
386  fHistoNGoodESDTracks(NULL),
387  fProfileEtaShift(NULL),
388  fHistoSPDClusterTrackletBackground(NULL),
389  fRandom(0),
390  fnCuts(0),
391  fiCut(0),
392  fNumberOfESDTracks(0),
393  fMoveParticleAccordingToVertex(kFALSE),
394  fIsHeavyIon(0),
395  fDoMesonAnalysis(kTRUE),
396  fDoMesonQA(0),
397  fIsFromMBHeader(kTRUE),
398  fIsMC(kFALSE),
399  fDoLightOutput(kFALSE),
400  fNeutralPionMode(0),
401  fTolerance(-1)
402 {
403  DefineOutput(1, TList::Class());
404 }
405 
406 //-----------------------------------------------------------------------------------------------
408 {
409  //
410  // virtual destructor
411  //
412  cout<<"Destructor"<<endl;
413  if(fGoodConvGammas){
414  delete fGoodConvGammas;
415  fGoodConvGammas = 0x0;
416  }
417  if(fClusterCandidates){
418  delete fClusterCandidates;
419  fClusterCandidates = 0x0;
420  }
421 
423  delete fNeutralPionCandidates;
425  }
426 
430  }
431 
432  if(fPosPionCandidates){
433  delete fPosPionCandidates;
434  fPosPionCandidates = 0x0;
435  }
436 
437  if(fNegPionCandidates){
438  delete fNegPionCandidates;
439  fNegPionCandidates = 0x0;
440  }
441 
443  delete fGoodVirtualParticles;
444  fGoodVirtualParticles = 0x0;
445  }
446 
447  if(fBGHandlerPiPl){
448  delete[] fBGHandlerPiPl;
449  fBGHandlerPiPl = 0x0;
450  }
451 
452  if(fBGHandlerPiMi){
453  delete[] fBGHandlerPiMi;
454  fBGHandlerPiMi = 0x0;
455  }
456 }
457 //___________________________________________________________
459 
462 
463  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
464 
465  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
466  TString cutstringPion = ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->GetCutNumber();
467  TString cutstringConvGamma = "";
468  if (fNeutralPionMode < 2) cutstringConvGamma = ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutNumber();
469  TString cutstringCaloGamma = "";
470  if (fNeutralPionMode > 0) cutstringCaloGamma = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
471  TString cutstringNeutralPion= ((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(iCut))->GetCutNumber();
472  TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
473 
474  TString fullCutString = "";
475  if (fNeutralPionMode == 0) fullCutString = Form("%i_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
476  else if (fNeutralPionMode == 1) fullCutString = Form("%i_%s_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringCaloGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
477  else if (fNeutralPionMode == 2) fullCutString = Form("%i_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringCaloGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
478 
479  Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(0,1));
480  Int_t centMin = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(1,1));
481  Int_t centMax = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(2,1));
482 
483  if(collisionSystem == 1 || collisionSystem == 2 ||
484  collisionSystem == 5 || collisionSystem == 8 ||
485  collisionSystem == 9){
486  centMin = centMin*10;
487  centMax = centMax*10;
488  }
489  else if(collisionSystem == 3 || collisionSystem == 6){
490  centMin = centMin*5;
491  centMax = centMax*5;
492  }
493  else if(collisionSystem == 4 || collisionSystem == 7){
494  centMin = ((centMin*5)+45);
495  centMax = ((centMax*5)+45);
496  }
497 
498  fBGHandlerPiPl[iCut] = new AliGammaConversionAODBGHandler( collisionSystem,centMin,centMax,
499  ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetNumberOfBGEvents(),
500  ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity(),
501  4,8,5);
502 
503  fBGHandlerPiMi[iCut] = new AliGammaConversionAODBGHandler( collisionSystem,centMin,centMax,
504  ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->GetNumberOfBGEvents(),
505  ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity(),
506  4,8,5);
507  }
508 }
509 
510 //______________________________________________________________________
512 {
513  //
514  // Create ouput objects
515  //
516 
517  // Set pT and mass ranges
518  Double_t HistoMassRange[2] = {0.4,1.0};
519  Double_t HistoMassRangeSub[2] = {0.4,1.0};
520  Double_t HistoPtRange[2] = {0.,25.};
521  Double_t HistoNMassBins = 600;
522  Double_t HistoNMassBinsSub = 600;
523  Double_t HistoNPtBins = 250;
524  fPDGMassPi0 = 0.1349766; // hard coded PDG value to keep results reproducable later
525 
526  // Create the output container
527  if(fOutputContainer != NULL){
528  delete fOutputContainer;
529  fOutputContainer = NULL;
530  }
531  if(fOutputContainer == NULL){
532  fOutputContainer = new TList();
533  fOutputContainer->SetOwner(kTRUE);
534  }
535 
536  fGoodConvGammas = new TList();
537  fClusterCandidates = new TList();
538  fClusterCandidates->SetOwner(kTRUE);
539 
541  fNeutralPionCandidates->SetOwner(kTRUE);
542 
544  fNeutralPionSidebandCandidates->SetOwner(kTRUE);
545 
546 
547  fPosPionCandidates = new TList();
548  fPosPionCandidates->SetOwner(kTRUE);
549  fNegPionCandidates = new TList();
550  fNegPionCandidates->SetOwner(kTRUE);
552  fGoodVirtualParticles->SetOwner(kTRUE);
553 
554  fCutFolder = new TList*[fnCuts];
555  fESDList = new TList*[fnCuts];
556  fHistoNEvents = new TH1I*[fnCuts];
558  if(!fDoLightOutput){
559  fProfileEtaShift = new TProfile*[fnCuts];
561 
562  if (fNeutralPionMode < 2){
563  fHistoConvGammaPt = new TH1F*[fnCuts];
564  fHistoConvGammaEta = new TH1F*[fnCuts];
565  }
566  if (fNeutralPionMode > 0){
567  fHistoClusterGammaPt = new TH1F*[fnCuts];
568  fHistoClusterGammaEta = new TH1F*[fnCuts];
569  }
570  fHistoNegPionPt = new TH1F*[fnCuts];
571  fHistoPosPionPt = new TH1F*[fnCuts];
572  fHistoNegPionPhi = new TH1F*[fnCuts];
573  fHistoPosPionPhi = new TH1F*[fnCuts];
575 
576  if( fDoMesonQA>0 ) {
577  fHistoNegPionEta = new TH1F*[fnCuts];
578  fHistoPosPionEta = new TH1F*[fnCuts];
581  fHistoPionDCAxy = new TH2F*[fnCuts];
582  fHistoPionDCAz = new TH2F*[fnCuts];
584  fHistoPionTPCdEdx = new TH2F*[fnCuts];
585  }
586 
587 
595  fHistoAngleSum = new TH2F*[fnCuts];
596  }
597 
605 
607 
613 
615 
621 
623 
624  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
625  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
626  TString cutstringPion = ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->GetCutNumber();
627  TString cutstringConvGamma = "";
628  if (fNeutralPionMode < 2)
629  cutstringConvGamma = ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutNumber();
630  TString cutstringCaloGamma = "";
631  if (fNeutralPionMode > 0)
632  cutstringCaloGamma = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
633  TString cutstringNeutralPion = ((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(iCut))->GetCutNumber();
634  TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
635 
636  TString fullCutString = "";
637  if (fNeutralPionMode == 0)
638  fullCutString = Form("%i_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
639  else if (fNeutralPionMode == 1)
640  fullCutString = Form("%i_%s_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringCaloGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
641  else if (fNeutralPionMode == 2)
642  fullCutString = Form("%i_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringCaloGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),cutstringMeson.Data());
643  TString nameCutFolder = Form("Cut Number %s", fullCutString.Data());
644  TString nameESDList = Form("%s ESD histograms", fullCutString.Data());
645 
646  fCutFolder[iCut] = new TList();
647  fCutFolder[iCut]->SetName(nameCutFolder.Data());
648  fCutFolder[iCut]->SetOwner(kTRUE);
649  fOutputContainer->Add(fCutFolder[iCut]);
650 
651  fESDList[iCut] = new TList();
652  fESDList[iCut]->SetName(nameESDList.Data());
653  fESDList[iCut]->SetOwner(kTRUE);
654 
655  fHistoNEvents[iCut] = new TH1I("NEvents","NEvents",14,-0.5,13.5);
656  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
657  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
658  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
659  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
660  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
661  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
662  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
663  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
664  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
665  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
666  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
667  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
668  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
669  fHistoNEvents[iCut]->GetYaxis()->SetTitle("N_{events}");
670  fESDList[iCut]->Add(fHistoNEvents[iCut]);
671 
672  if(fIsHeavyIon>0)
673  fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",3000,0,3000);
674  else
675  fHistoNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
676  fHistoNGoodESDTracks[iCut]->GetXaxis()->SetTitle("N_{good ESD tracks}");
677  fHistoNGoodESDTracks[iCut]->GetYaxis()->SetTitle("N_{events}");
678  fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
679  if(!fDoLightOutput){
680  fProfileEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
681  fESDList[iCut]->Add(fProfileEtaShift[iCut]);
682  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters","SPD tracklets vs SPD clusters",100,0,200,250,0,1000);
683  fHistoSPDClusterTrackletBackground[iCut]->GetXaxis()->SetTitle("N_{SPD tracklets}");
684  fHistoSPDClusterTrackletBackground[iCut]->GetYaxis()->SetTitle("N_{SPD clusters}");
686  if (fNeutralPionMode < 2){
687  fHistoConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",250,0,25);
688  fHistoConvGammaPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
689  fHistoConvGammaPt[iCut]->GetYaxis()->SetTitle("N_{#gamma,conv}");
690  fESDList[iCut]->Add(fHistoConvGammaPt[iCut]);
691  fHistoConvGammaEta[iCut] = new TH1F("ESD_ConvGamma_Eta","ESD_ConvGamma_Eta",600,-1.5,1.5);
692  fHistoConvGammaEta[iCut]->GetXaxis()->SetTitle("#eta");
693  fHistoConvGammaEta[iCut]->GetYaxis()->SetTitle("N_{#gamma,conv}");
694  fESDList[iCut]->Add(fHistoConvGammaEta[iCut]);
695  }
696  if (fNeutralPionMode > 0){
697  fHistoClusterGammaPt[iCut] = new TH1F("ESD_ClusterGamma_Pt","ESD_ClusterGamma_Pt",250,0,25);
698  fHistoClusterGammaPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
699  fHistoClusterGammaPt[iCut]->GetYaxis()->SetTitle("N_{#gamma,cluster}");
700  fESDList[iCut]->Add(fHistoClusterGammaPt[iCut]);
701  fHistoClusterGammaEta[iCut] = new TH1F("ESD_ClusterGamma_Eta","ESD_ClusterGamma_Eta",600,-1.5,1.5);
702  fHistoClusterGammaEta[iCut]->GetXaxis()->SetTitle("#eta");
703  fHistoClusterGammaEta[iCut]->GetYaxis()->SetTitle("N_{#gamma,cluster}");
704  fESDList[iCut]->Add(fHistoClusterGammaEta[iCut]);
705  }
706  fHistoNegPionPt[iCut] = new TH1F("ESD_PrimaryNegPions_Pt","ESD_PrimaryNegPions_Pt",1000,0,25);
707  fHistoNegPionPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
708  fHistoNegPionPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
709  fESDList[iCut]->Add(fHistoNegPionPt[iCut]);
710  fHistoPosPionPt[iCut] = new TH1F("ESD_PrimaryPosPions_Pt","ESD_PrimaryPosPions_Pt",1000,0,25);
711  fHistoPosPionPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
712  fHistoPosPionPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
713  fESDList[iCut]->Add(fHistoPosPionPt[iCut]);
714  fHistoNegPionPhi[iCut] = new TH1F("ESD_PrimaryNegPions_Phi","ESD_PrimaryNegPions_Phi",360,0,2*TMath::Pi());
715  fHistoNegPionPhi[iCut]->GetXaxis()->SetTitle("#phi");
716  fHistoNegPionPhi[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
717  fESDList[iCut]->Add(fHistoNegPionPhi[iCut]);
718  fHistoPosPionPhi[iCut] = new TH1F("ESD_PrimaryPosPions_Phi","ESD_PrimaryPosPions_Phi",360,0,2*TMath::Pi());
719  fHistoPosPionPhi[iCut]->GetXaxis()->SetTitle("#phi");
720  fHistoPosPionPhi[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
721  fESDList[iCut]->Add(fHistoPosPionPhi[iCut]);
722  fHistoPionPionInvMassPt[iCut] = new TH2F("ESD_PiPlusPiNeg_InvMassPt","ESD_PiPlusPiNeg_InvMassPt",2000,0.,2.,200,0.,20.);
723  fHistoPionPionInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
724  fHistoPionPionInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
725  fESDList[iCut]->Add(fHistoPionPionInvMassPt[iCut]);
726 
727  if ( fDoMesonQA>0 ) {
728  fHistoNegPionEta[iCut] = new TH1F("ESD_PrimaryNegPions_Eta","ESD_PrimaryNegPions_Eta",600,-1.5,1.5);
729  fHistoNegPionEta[iCut]->GetXaxis()->SetTitle("#eta");
730  fHistoNegPionEta[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
731  fESDList[iCut]->Add(fHistoNegPionEta[iCut]);
732  fHistoPosPionEta[iCut] = new TH1F("ESD_PrimaryPosPions_Eta","ESD_PrimaryPosPions_Eta",600,-1.5,1.5);
733  fHistoPosPionEta[iCut]->GetXaxis()->SetTitle("#eta");
734  fHistoPosPionEta[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
735  fESDList[iCut]->Add(fHistoPosPionEta[iCut]);
736  fHistoNegPionClsTPC[iCut] = new TH2F("ESD_PrimaryNegPions_ClsTPC","ESD_PrimaryNegPions_ClsTPC",100,0,1,400,0.,10.);
737  fHistoNegPionClsTPC[iCut]->GetXaxis()->SetTitle("N_{findable cls. TPC #pi^{-}}");
738  fHistoNegPionClsTPC[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
739  fESDList[iCut]->Add(fHistoNegPionClsTPC[iCut]);
740  fHistoPosPionClsTPC[iCut] = new TH2F("ESD_PrimaryPosPions_ClsTPC","ESD_PrimaryPosPions_ClsTPC",100,0,1,400,0.,10.);
741  fHistoPosPionClsTPC[iCut]->GetXaxis()->SetTitle("N_{findable cls. TPC #pi^{+}}");
742  fHistoPosPionClsTPC[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
743  fESDList[iCut]->Add(fHistoPosPionClsTPC[iCut]);
744  fHistoPionDCAxy[iCut] = new TH2F("ESD_PrimaryPions_DCAxy","ESD_PrimaryPions_DCAxy",800,-4.0,4.0,400,0.,10.);
745  fHistoPionDCAxy[iCut]->GetXaxis()->SetTitle("DCA_{xy}");
746  fHistoPionDCAxy[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
747  fESDList[iCut]->Add(fHistoPionDCAxy[iCut]);
748  fHistoPionDCAz[iCut] = new TH2F("ESD_PrimaryPions_DCAz","ESD_PrimaryPions_DCAz",800,-4.0,4.0,400,0.,10.);
749  fHistoPionDCAz[iCut]->GetXaxis()->SetTitle("DCA_{z}");
750  fHistoPionDCAz[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
751  fESDList[iCut]->Add(fHistoPionDCAz[iCut]);
752  fHistoPionTPCdEdxNSigma[iCut] = new TH2F("ESD_PrimaryPions_TPCdEdx","ESD_PrimaryPions_TPCdEdx",150,0.05,20,400,-10,10);
753  fHistoPionTPCdEdxNSigma[iCut]->GetXaxis()->SetTitle("p (GeV/c)");
754  fHistoPionTPCdEdxNSigma[iCut]->GetYaxis()->SetTitle("#sigma_{PID,TPC}");
755  fESDList[iCut]->Add(fHistoPionTPCdEdxNSigma[iCut]);
756  fHistoPionTPCdEdx[iCut] = new TH2F("ESD_PrimaryPions_TPCdEdxSignal","ESD_PrimaryPions_TPCdEdxSignal" ,150,0.05,20.0,800,0.0,200);
757  fHistoPionTPCdEdx[iCut]->GetXaxis()->SetTitle("p (GeV/c)");
758  fHistoPionTPCdEdx[iCut]->GetYaxis()->SetTitle("dE/dx signal (au)");
759  fESDList[iCut]->Add(fHistoPionTPCdEdx[iCut]);
760  }
761  fHistoGammaGammaInvMassPt[iCut] = new TH2F("ESD_GammaGamma_InvMass_Pt","ESD_GammaGamma_InvMass_Pt",450,0.,0.45,250,0,25);
762  fHistoGammaGammaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#gamma #gamma} (GeV/c^{2})");
763  fHistoGammaGammaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
764  fESDList[iCut]->Add(fHistoGammaGammaInvMassPt[iCut]);
765  }
766  fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
767  fHistoMotherInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} (GeV/c^{2})");
768  fHistoMotherInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
769  fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
770  fHistoMotherInvMassPtRejectedKinematic[iCut] = new TH2F("ESD_Mother_InvMass_Pt_KinematicRejected","ESD_Mother_InvMass_Pt_KinematicRejected",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
771  fHistoMotherInvMassPtRejectedKinematic[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} (GeV/c^{2})");
772  fHistoMotherInvMassPtRejectedKinematic[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
774 
775  fHistoBackInvMassPtGroup1[iCut] = new TH2F("ESD_Background_1_InvMass_Pt","ESD_Background_1_InvMass_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
776  fHistoBackInvMassPtGroup2[iCut] = new TH2F("ESD_Background_2_InvMass_Pt","ESD_Background_2_InvMass_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
777  fHistoBackInvMassPtGroup3[iCut] = new TH2F("ESD_Background_3_InvMass_Pt","ESD_Background_3_InvMass_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
778  fHistoBackInvMassPtGroup4[iCut] = new TH2F("ESD_Background_4_InvMass_Pt","ESD_Background_4_InvMass_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
779  fHistoBackInvMassPtGroup1[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} (GeV/c^{2})");
780  fHistoBackInvMassPtGroup1[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
781  fHistoBackInvMassPtGroup2[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} (GeV/c^{2})");
782  fHistoBackInvMassPtGroup2[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
783  fHistoBackInvMassPtGroup3[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} (GeV/c^{2})");
784  fHistoBackInvMassPtGroup3[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
785  fHistoBackInvMassPtGroup4[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} (GeV/c^{2})");
786  fHistoBackInvMassPtGroup4[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
787  if(!(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseLikeSignMixing())){
788  fESDList[iCut]->Add(fHistoBackInvMassPtGroup1[iCut]);
789  fESDList[iCut]->Add(fHistoBackInvMassPtGroup2[iCut]);
790  fESDList[iCut]->Add(fHistoBackInvMassPtGroup3[iCut]);
791  fESDList[iCut]->Add(fHistoBackInvMassPtGroup4[iCut]);
792  }
793 
794  fHistoMotherLikeSignBackInvMassPt[iCut] = new TH2F("ESD_Background_LikeSign_InvMass_Pt","ESD_Background_LikeSign_InvMass_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
795  fHistoMotherLikeSignBackInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{#pm} #pi^{#pm} #pi^{0}} (GeV/c^{2})");
796  fHistoMotherLikeSignBackInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
797  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseLikeSignMixing()){
799  }
800  fHistoMotherInvMassSubPi0[iCut] = new TH2F("ESD_InvMass_Mother_Sub_InvMass(NeutralPion)_Pt","ESD_Mother_InvMass_Sub_InvMass(NeutralPion)_Pt",HistoNMassBinsSub,HistoMassRangeSub[0],HistoMassRangeSub[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
801  fHistoMotherInvMassSubPi0[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} - (M_{#pi^{0}}-M_{#pi^{0},PDG}) (GeV/c^{2})");
802  fHistoMotherInvMassSubPi0[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
803  fESDList[iCut]->Add(fHistoMotherInvMassSubPi0[iCut]);
804 
805  fHistoBackInvMassPtGroup1SubPi0[iCut] = new TH2F("ESD_Background_1_InvMass_Sub_InvMass(NeutralPion)_Pt","ESD_Background_1_InvMass_Sub_InvMass(NeutralPion)_Pt",
806  HistoNMassBinsSub,HistoMassRangeSub[0],HistoMassRangeSub[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
807  fHistoBackInvMassPtGroup2SubPi0[iCut] = new TH2F("ESD_Background_2_InvMass_Sub_InvMass(NeutralPion)_Pt","ESD_Background_2_InvMass_Sub_InvMass(NeutralPion)_Pt",
808  HistoNMassBinsSub,HistoMassRangeSub[0],HistoMassRangeSub[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
809  fHistoBackInvMassPtGroup3SubPi0[iCut] = new TH2F("ESD_Background_3_InvMass_Sub_InvMass(NeutralPion)_Pt","ESD_Background_3_InvMass_Sub_InvMass(NeutralPion)_Pt",
810  HistoNMassBinsSub,HistoMassRangeSub[0],HistoMassRangeSub[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
811  fHistoBackInvMassPtGroup4SubPi0[iCut] = new TH2F("ESD_Background_4_InvMass_Sub_InvMass(NeutralPion)_Pt","ESD_Background_4_InvMass_Sub_InvMass(NeutralPion)_Pt",
812  HistoNMassBinsSub,HistoMassRangeSub[0],HistoMassRangeSub[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
813 
814  fHistoBackInvMassPtGroup1SubPi0[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} - (M_{#pi^{0}}-M_{#pi^{0},PDG}) (GeV/c^{2})");
815  fHistoBackInvMassPtGroup1SubPi0[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
816  fHistoBackInvMassPtGroup2SubPi0[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} - (M_{#pi^{0}}-M_{#pi^{0},PDG}) (GeV/c^{2})");
817  fHistoBackInvMassPtGroup2SubPi0[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
818  fHistoBackInvMassPtGroup3SubPi0[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} - (M_{#pi^{0}}-M_{#pi^{0},PDG}) (GeV/c^{2})");
819  fHistoBackInvMassPtGroup3SubPi0[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
820  fHistoBackInvMassPtGroup4SubPi0[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} - (M_{#pi^{0}}-M_{#pi^{0},PDG}) (GeV/c^{2})");
821  fHistoBackInvMassPtGroup4SubPi0[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
822  if(!(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseLikeSignMixing())){
823  fESDList[iCut]->Add(fHistoBackInvMassPtGroup4SubPi0[iCut]);
824  fESDList[iCut]->Add(fHistoBackInvMassPtGroup1SubPi0[iCut]);
825  fESDList[iCut]->Add(fHistoBackInvMassPtGroup2SubPi0[iCut]);
826  fESDList[iCut]->Add(fHistoBackInvMassPtGroup3SubPi0[iCut]);
827  }
828  fHistoMotherLikeSignBackInvMassSubPi0Pt[iCut] = new TH2F("ESD_Background_LikeSign_InvMass_Sub_InvMass(NeutralPion)_Pt","ESD_Background_LikeSign_InvMass_Sub_InvMass(NeutralPion)_Pt",
829  HistoNMassBinsSub,HistoMassRangeSub[0],HistoMassRangeSub[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
830  fHistoMotherLikeSignBackInvMassSubPi0Pt[iCut]->GetXaxis()->SetTitle("M_{#pi^{#pm} #pi^{#pm} #pi^{0}} - M_{#pi^{0}} (GeV/c^{2})");
831  fHistoMotherLikeSignBackInvMassSubPi0Pt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
832  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseLikeSignMixing()){
834  }
835  fHistoMotherInvMassFixedPzPi0[iCut] = new TH2F("ESD_InvMass_Mother_FixedPz(NeutralPion)_Pt","ESD_Mother_InvMass_FixedPz(NeutralPion)_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
836  fHistoMotherInvMassFixedPzPi0[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} (GeV/c^{2})");
837  fHistoMotherInvMassFixedPzPi0[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
838  fESDList[iCut]->Add(fHistoMotherInvMassFixedPzPi0[iCut]);
839 
840  fHistoBackInvMassPtGroup1FixedPzPi0[iCut] = new TH2F("ESD_Background_1_InvMass_FixedPz(NeutralPion)_Pt","ESD_Background_1_InvMass_FixedPz(NeutralPion)_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
841  fHistoBackInvMassPtGroup2FixedPzPi0[iCut] = new TH2F("ESD_Background_2_InvMass_FixedPz(NeutralPion)_Pt","ESD_Background_2_InvMass_FixedPz(NeutralPion)_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
842  fHistoBackInvMassPtGroup3FixedPzPi0[iCut] = new TH2F("ESD_Background_3_InvMass_FixedPz(NeutralPion)_Pt","ESD_Background_3_InvMass_FixedPz(NeutralPion)_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
843  fHistoBackInvMassPtGroup4FixedPzPi0[iCut] = new TH2F("ESD_Background_4_InvMass_FixedPz(NeutralPion)_Pt","ESD_Background_4_InvMass_FixedPz(NeutralPion)_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
844  fHistoBackInvMassPtGroup1FixedPzPi0[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} (GeV/c^{2})");
845  fHistoBackInvMassPtGroup1FixedPzPi0[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
846  fHistoBackInvMassPtGroup2FixedPzPi0[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} (GeV/c^{2})");
847  fHistoBackInvMassPtGroup2FixedPzPi0[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
848  fHistoBackInvMassPtGroup3FixedPzPi0[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} (GeV/c^{2})");
849  fHistoBackInvMassPtGroup3FixedPzPi0[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
850  fHistoBackInvMassPtGroup4FixedPzPi0[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} (GeV/c^{2})");
851  fHistoBackInvMassPtGroup4FixedPzPi0[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
852  if(!(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseLikeSignMixing())){
857  }
858  fHistoMotherLikeSignBackInvMassFixedPzPi0Pt[iCut] = new TH2F("ESD_Background_LikeSign_InvMass_FixedPz(NeutralPion)_Pt","ESD_Background_LikeSign_InvMass_FixedPz(NeutralPion)_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
859  fHistoMotherLikeSignBackInvMassFixedPzPi0Pt[iCut]->GetXaxis()->SetTitle("M_{#pi^{#pm} #pi^{#pm} #pi^{0}} (GeV/c^{2})");
860  fHistoMotherLikeSignBackInvMassFixedPzPi0Pt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
861  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseLikeSignMixing()){
863  }
864  if(!fDoLightOutput){
865  fHistoAngleOmegaPiPlPiMi[iCut] = new TH2F("ESD_Mother_AngleOmegaNegPionsPosPions_Pt","ESD_Mother_AngleOmegaNegPionsPosPions_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1],360,0,TMath::Pi());
866  fHistoAngleOmegaPiPlPiMi[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
867  fHistoAngleOmegaPiPlPiMi[iCut]->GetYaxis()->SetTitle("#angle (meson,#pi^{+}#pi^{-})");
868  fESDList[iCut]->Add(fHistoAngleOmegaPiPlPiMi[iCut]);
869  fHistoAngleOmegaPiMi[iCut] = new TH2F("ESD_Mother_AngleOmegaNegPions_Pt","ESD_Mother_AngleOmegaNegPions_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1],360,0,TMath::Pi());
870  fHistoAngleOmegaPiMi[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
871  fHistoAngleOmegaPiMi[iCut]->GetYaxis()->SetTitle("#angle (meson,#pi^{-})");
872  fESDList[iCut]->Add(fHistoAngleOmegaPiMi[iCut]);
873  fHistoAngleOmegaPiPl[iCut] = new TH2F("ESD_Mother_AngleOmegaPosPions_Pt","ESD_Mother_AngleOmegaPosPions_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1],360,0,TMath::Pi());
874  fHistoAngleOmegaPiPl[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
875  fHistoAngleOmegaPiPl[iCut]->GetYaxis()->SetTitle("#angle (meson,#pi^{+})");
876  fESDList[iCut]->Add(fHistoAngleOmegaPiPl[iCut]);
877  fHistoAngleOmegaPiZero[iCut] = new TH2F("ESD_Mother_AngleOmegaNeutralPion_Pt","ESD_Mother_AngleOmegaNeutralPion_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1],360,0,TMath::Pi());
878  fHistoAngleOmegaPiZero[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
879  fHistoAngleOmegaPiZero[iCut]->GetYaxis()->SetTitle("#angle (meson,#pi^{0})");
880  fESDList[iCut]->Add(fHistoAngleOmegaPiZero[iCut]);
881  fHistoAnglePiPlPiZero[iCut] = new TH2F("ESD_Mother_AnglePosPionsNeutralPion_Pt","ESD_Mother_AnglePosPionsNeutralPion_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1],360,0,TMath::Pi());
882  fHistoAnglePiPlPiZero[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
883  fHistoAnglePiPlPiZero[iCut]->GetYaxis()->SetTitle("#angle (#pi^{+},#pi^{0})");
884  fESDList[iCut]->Add(fHistoAnglePiPlPiZero[iCut]);
885  fHistoAnglePiPlPiMi[iCut] = new TH2F("ESD_Mother_AnglePosPionsNegPions_Pt","ESD_Mother_AnglePosPionsNegPions_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1],360,0,TMath::Pi());
886  fHistoAnglePiPlPiMi[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
887  fHistoAnglePiPlPiMi[iCut]->GetYaxis()->SetTitle("#angle (#pi^{+},#pi^{-})");
888  fESDList[iCut]->Add(fHistoAnglePiPlPiMi[iCut]);
889  fHistoAnglePiZeroPiMi[iCut] = new TH2F("ESD_Mother_AngleNeutralPionNegPions_Pt","ESD_Mother_AngleNeutralPionNegPions_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1],360,0,TMath::Pi());
890  fHistoAnglePiZeroPiMi[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
891  fHistoAnglePiZeroPiMi[iCut]->GetYaxis()->SetTitle("#angle (#pi^{0},#pi^{-})");
892  fESDList[iCut]->Add(fHistoAnglePiZeroPiMi[iCut]);
893  fHistoAngleSum[iCut] = new TH2F("ESD_Mother_AngleSum_Pt","ESD_Mother_AngleSum_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1],720,0,2*TMath::Pi());
894  fHistoAngleSum[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
895  fHistoAngleSum[iCut]->GetYaxis()->SetTitle("#sum #angle");
896  fESDList[iCut]->Add(fHistoAngleSum[iCut]);
897  }
898  if ( fDoMesonQA>0 && (!fDoLightOutput) ) {
899  TAxis *AxisAfter = fHistoPionTPCdEdxNSigma[iCut]->GetXaxis();
900  Int_t bins = AxisAfter->GetNbins();
901  Double_t from = AxisAfter->GetXmin();
902  Double_t to = AxisAfter->GetXmax();
903  Double_t *newBins = new Double_t[bins+1];
904  newBins[0] = from;
905  Double_t factor = TMath::Power(to/from, 1./bins);
906  for(Int_t i=1; i<=bins; ++i) newBins[i] = factor * newBins[i-1];
907 
908  AxisAfter->Set(bins, newBins);
909  AxisAfter = fHistoPionTPCdEdx[iCut]->GetXaxis();
910  AxisAfter->Set(bins, newBins);
911  delete [] newBins;
912  }
913 
914  fCutFolder[iCut]->Add(fESDList[iCut]);
915 
916  }
917 
918  if( fIsMC ){
919  // MC Histogramms
920  fMCList = new TList*[fnCuts];
921  // True Histogramms
922  fTrueList = new TList*[fnCuts];
923  if(!fDoLightOutput){
924  if (fNeutralPionMode < 2){
925  fHistoTrueConvGammaPt = new TH1F*[fnCuts];
928  }
929  if (fNeutralPionMode > 0){
930  fHistoTrueClusterGammaPt = new TH1F*[fnCuts];
932  }
933  fHistoTruePosPionPt = new TH1F*[fnCuts];
934  fHistoTrueNegPionPt = new TH1F*[fnCuts];
937 
938 
939  fHistoMCAllGammaPt = new TH1F*[fnCuts];
940  if (fNeutralPionMode < 2){
941  fHistoMCConvGammaPt = new TH1F*[fnCuts];
942  }
943  fHistoMCAllPosPionsPt = new TH1F*[fnCuts];
944  fHistoMCAllNegPionsPt = new TH1F*[fnCuts];
948  }
949  fHistoMCEtaPiPlPiMiPiZeroPt = new TH1F*[fnCuts];
953  if(!fDoLightOutput){
957  }
961  if(!fDoLightOutput){
966  }
967  if(!fDoLightOutput){
968  if (fDoMesonQA>0){
973 
990  if (fDoMesonQA>1){
991  fTrueTreeList = new TList*[fnCuts];
996  }
997  }
998  }
999 
1000  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1001  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
1002  TString cutstringPion = ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->GetCutNumber();
1003  TString cutstringConvGamma = "";
1004  if (fNeutralPionMode < 2)
1005  cutstringConvGamma = ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutNumber();
1006  TString cutstringCaloGamma = "";
1007  if (fNeutralPionMode > 0)
1008  cutstringCaloGamma = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
1009  TString cutstringNeutralPion = ((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(iCut))->GetCutNumber();
1010  TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
1011 
1012  TString fullCutString = "";
1013  if (fNeutralPionMode == 0)
1014  fullCutString = Form("%i_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringNeutralPion.Data(), cutstringPion.Data(),
1015  cutstringMeson.Data());
1016  else if (fNeutralPionMode == 1)
1017  fullCutString = Form("%i_%s_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(),cutstringConvGamma.Data(),cutstringCaloGamma.Data(), cutstringNeutralPion.Data(),
1018  cutstringPion.Data(), cutstringMeson.Data());
1019  else if (fNeutralPionMode == 2)
1020  fullCutString = Form("%i_%s_%s_%s_%s_%s",fNeutralPionMode,cutstringEvent.Data(), cutstringCaloGamma.Data(), cutstringNeutralPion.Data(), cutstringPion.Data(),
1021  cutstringMeson.Data());
1022  TString nameMCList = Form("%s MC histograms", fullCutString.Data());
1023  TString nameTrueRecList = Form("%s True histograms", fullCutString.Data());
1024  TString nameTrueRecTTreeList = Form("%s True TTrees", fullCutString.Data());
1025 
1026  fMCList[iCut] = new TList();
1027  fMCList[iCut]->SetName(nameMCList.Data());
1028  fMCList[iCut]->SetOwner(kTRUE);
1029  fCutFolder[iCut]->Add(fMCList[iCut]);
1030 
1031  if(!fDoLightOutput){
1032  fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1033  fHistoMCAllGammaPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1034  fHistoMCAllGammaPt[iCut]->GetYaxis()->SetTitle("N_{#gamma}");
1035  fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
1036  if (fNeutralPionMode < 2){
1037  fHistoMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt","MC_ConvGamma_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1038  fHistoMCConvGammaPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1039  fHistoMCConvGammaPt[iCut]->GetYaxis()->SetTitle("N_{#gamma,conv}");
1040  fMCList[iCut]->Add(fHistoMCConvGammaPt[iCut]);
1041  }
1042 
1043  fHistoMCAllPosPionsPt[iCut] = new TH1F("MC_AllPosPions_Pt","MC_AllPosPions_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1044  fHistoMCAllPosPionsPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1045  fHistoMCAllPosPionsPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
1046  fMCList[iCut]->Add(fHistoMCAllPosPionsPt[iCut]);
1047  fHistoMCAllNegPionsPt[iCut] = new TH1F("MC_AllNegPions_Pt","MC_AllNegPions_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1048  fHistoMCAllNegPionsPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1049  fHistoMCAllNegPionsPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
1050  fMCList[iCut]->Add(fHistoMCAllNegPionsPt[iCut]);
1051  fHistoMCGammaFromNeutralMesonPt[iCut] = new TH1F("MC_GammaFromNeutralMeson_Pt","MC_GammaFromNeutralMeson_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1052  fHistoMCGammaFromNeutralMesonPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1053  fHistoMCGammaFromNeutralMesonPt[iCut]->GetYaxis()->SetTitle("N_{#gamma}");
1054  fMCList[iCut]->Add(fHistoMCGammaFromNeutralMesonPt[iCut]);
1055  fHistoMCPosPionsFromNeutralMesonPt[iCut] = new TH1F("MC_PosPionsFromNeutralMeson_Pt","MC_PosPionsFromNeutralMeson_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1056  fHistoMCPosPionsFromNeutralMesonPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1057  fHistoMCPosPionsFromNeutralMesonPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
1058  fMCList[iCut]->Add(fHistoMCPosPionsFromNeutralMesonPt[iCut]);
1059  fHistoMCNegPionsFromNeutralMesonPt[iCut] = new TH1F("MC_NegPionsFromNeutralMeson_Pt","MC_NegPionsFromNeutralMeson_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1060  fHistoMCNegPionsFromNeutralMesonPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1061  fHistoMCNegPionsFromNeutralMesonPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
1062  fMCList[iCut]->Add(fHistoMCNegPionsFromNeutralMesonPt[iCut]);
1063  }
1064  fHistoMCEtaPiPlPiMiPiZeroPt[iCut] = new TH1F("MC_Eta_Pt","MC_Eta_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1065  fHistoMCEtaPiPlPiMiPiZeroPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1066  fHistoMCEtaPiPlPiMiPiZeroPt[iCut]->GetYaxis()->SetTitle("N_{#eta}");
1067  fHistoMCEtaPiPlPiMiPiZeroPt[iCut]->Sumw2();
1068  fMCList[iCut]->Add(fHistoMCEtaPiPlPiMiPiZeroPt[iCut]);
1069 
1070  fHistoMCEtaPiPlPiMiPiZeroInAccPt[iCut] = new TH1F("MC_EtaInAcc_Pt","MC_EtaInAcc_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1071  fHistoMCEtaPiPlPiMiPiZeroInAccPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1072  fHistoMCEtaPiPlPiMiPiZeroInAccPt[iCut]->GetYaxis()->SetTitle("A #times N_{#eta}");
1073  fHistoMCEtaPiPlPiMiPiZeroInAccPt[iCut]->Sumw2();
1074  fMCList[iCut]->Add(fHistoMCEtaPiPlPiMiPiZeroInAccPt[iCut]);
1075 
1076  fHistoMCOmegaPiPlPiMiPiZeroPt[iCut] = new TH1F("MC_Omega_Pt","MC_Omega_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1077  fHistoMCOmegaPiPlPiMiPiZeroPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1078  fHistoMCOmegaPiPlPiMiPiZeroPt[iCut]->GetYaxis()->SetTitle("N_{#omega}");
1079  fHistoMCOmegaPiPlPiMiPiZeroPt[iCut]->Sumw2();
1080  fMCList[iCut]->Add(fHistoMCOmegaPiPlPiMiPiZeroPt[iCut]);
1081 
1082  fHistoMCOmegaPiPlPiMiPiZeroInAccPt[iCut] = new TH1F("MC_OmegaInAcc_Pt","MC_OmegaInAcc_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1083  fHistoMCOmegaPiPlPiMiPiZeroInAccPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1084  fHistoMCOmegaPiPlPiMiPiZeroInAccPt[iCut]->GetYaxis()->SetTitle("A #times N_{#omega}");
1085  fHistoMCOmegaPiPlPiMiPiZeroInAccPt[iCut]->Sumw2();
1086  fMCList[iCut]->Add(fHistoMCOmegaPiPlPiMiPiZeroInAccPt[iCut]);
1087 
1088  fTrueList[iCut] = new TList();
1089  fTrueList[iCut]->SetName(nameTrueRecList.Data());
1090  fTrueList[iCut]->SetOwner(kTRUE);
1091  fCutFolder[iCut]->Add(fTrueList[iCut]);
1092 
1093  if(!fDoLightOutput){
1094  if (fNeutralPionMode < 2){
1095  fHistoTrueConvGammaPt[iCut] = new TH1F("ESD_TrueConvGamma_Pt","ESD_TrueConvGamma_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1096  fHistoTrueConvGammaPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1097  fHistoTrueConvGammaPt[iCut]->GetYaxis()->SetTitle("N_{#gamma,conv}");
1098  fTrueList[iCut]->Add(fHistoTrueConvGammaPt[iCut]);
1099  fHistoDoubleCountTrueConvGammaRPt[iCut] = new TH2F("ESD_TrueDoubleCountConvGamma_R_Pt","ESD_TrueDoubleCountConvGamma_R_Pt",800,0,200,300,0,30);
1100  fHistoDoubleCountTrueConvGammaRPt[iCut]->GetXaxis()->SetTitle("R_{conv} (cm)");
1101  fHistoDoubleCountTrueConvGammaRPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1102  fTrueList[iCut]->Add(fHistoDoubleCountTrueConvGammaRPt[iCut]);
1103  fHistoTrueConvGammaFromNeutralMesonPt[iCut] = new TH1F("ESD_TrueConvGammaFromNeutralMeson_Pt","ESD_TrueConvGammaFromNeutralMeson_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1104  fHistoTrueConvGammaFromNeutralMesonPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1105  fHistoTrueConvGammaFromNeutralMesonPt[iCut]->GetYaxis()->SetTitle("N_{#gamma,conv}");
1107  }
1108  if (fNeutralPionMode > 0){
1109  fHistoTrueClusterGammaPt[iCut] = new TH1F("ESD_TrueClusterGamma_Pt","ESD_TrueClusterGamma_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1110  fHistoTrueClusterGammaPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1111  fHistoTrueClusterGammaPt[iCut]->GetYaxis()->SetTitle("N_{#gamma,cluster}");
1112  fTrueList[iCut]->Add(fHistoTrueClusterGammaPt[iCut]);
1113  fHistoTrueClusterGammaFromNeutralMesonPt[iCut] = new TH1F("ESD_TrueClusterGammaFromNeutralMeson_Pt","ESD_TrueClusterGammaFromNeutralMeson_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1114  fHistoTrueClusterGammaFromNeutralMesonPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1115  fHistoTrueClusterGammaFromNeutralMesonPt[iCut]->GetYaxis()->SetTitle("N_{#gamma,cluster}");
1117  }
1118  fHistoTruePosPionPt[iCut] = new TH1F("ESD_TruePosPion_Pt","ESD_TruePosPion_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1119  fHistoTruePosPionPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1120  fHistoTruePosPionPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
1121  fTrueList[iCut]->Add(fHistoTruePosPionPt[iCut]);
1122  fHistoTrueNegPionPt[iCut] = new TH1F("ESD_TrueNegPion_Pt","ESD_TrueNegPion_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1123  fHistoTrueNegPionPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1124  fHistoTrueNegPionPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
1125  fTrueList[iCut]->Add(fHistoTrueNegPionPt[iCut]);
1126 
1127  fHistoTrueNegPionFromNeutralMesonPt[iCut] = new TH1F("ESD_TrueNegPionFromNeutralMeson_Pt","ESD_TrueNegPionFromNeutralMeson_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1128  fHistoTrueNegPionFromNeutralMesonPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1129  fHistoTrueNegPionFromNeutralMesonPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{-}}");
1131  fHistoTruePosPionFromNeutralMesonPt[iCut] = new TH1F("ESD_TruePosPionFromNeutralMeson_Pt","ESD_TruePosPionFromNeutralMeson_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1132  fHistoTruePosPionFromNeutralMesonPt[iCut]->GetXaxis()->SetTitle("p_{T} (GeV/c)");
1133  fHistoTruePosPionFromNeutralMesonPt[iCut]->GetYaxis()->SetTitle("N_{#pi^{+}}");
1135 
1136  fHistoDoubleCountTruePi0InvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountPi0_InvMass_Pt","ESD_TrueDoubleCountPi0_InvMass_Pt",800,0,0.8,300,0,30);
1137  fHistoDoubleCountTruePi0InvMassPt[iCut]->GetXaxis()->SetTitle("M_{#gamma #gamma} (GeV/c^{2})");
1138  fHistoDoubleCountTruePi0InvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1139  fTrueList[iCut]->Add(fHistoDoubleCountTruePi0InvMassPt[iCut]);
1140  fHistoDoubleCountTrueEtaInvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountEta_InvMass_Pt","ESD_TrueDoubleCountEta_InvMass_Pt",800,0,0.8,300,0,30);
1141  fHistoDoubleCountTrueEtaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#eta} (GeV/c^{2})");
1142  fHistoDoubleCountTrueEtaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1143  fTrueList[iCut]->Add(fHistoDoubleCountTrueEtaInvMassPt[iCut]);
1144  fHistoDoubleCountTrueOmegaInvMassPt[iCut] = new TH2F("ESD_TrueDoubleCountOmega_InvMass_Pt","ESD_TrueDoubleCountOmega_InvMass_Pt",800,0,0.8,300,0,30);
1145  fHistoDoubleCountTrueOmegaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#omega} (GeV/c^{2})");
1146  fHistoDoubleCountTrueOmegaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1148  }
1149  fHistoTrueMotherPiPlPiMiPiZeroInvMassPt[iCut] = new TH2F("ESD_TrueMotherPiPlPiMiPiZero_InvMass_Pt","ESD_TrueMotherPiPlPiMiPiZero_InvMass_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1151  fHistoTrueMotherPiPlPiMiPiZeroInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} (GeV/c^{2})");
1152  fHistoTrueMotherPiPlPiMiPiZeroInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1154 
1155  fHistoTrueMotherOmegaPiPlPiMiPiZeroInvMassPt[iCut] = new TH2F("ESD_TrueMotherOmegaPiPlPiMiPiZero_InvMass_Pt","ESD_TrueMotherOmegaPiPlPiMiPiZero_InvMass_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1156  fHistoTrueMotherEtaPiPlPiMiPiZeroInvMassPt[iCut] = new TH2F("ESD_TrueMotherEtaPiPlPiMiPiZero_InvMass_Pt","ESD_TrueMotherEtaPiPlPiMiPiZero_InvMass_Pt",HistoNMassBins,HistoMassRange[0],HistoMassRange[1],HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1159  fHistoTrueMotherOmegaPiPlPiMiPiZeroInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} (GeV/c^{2})");
1160  fHistoTrueMotherOmegaPiPlPiMiPiZeroInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1161  fHistoTrueMotherEtaPiPlPiMiPiZeroInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+} #pi^{-} #pi^{0}} (GeV/c^{2})");
1162  fHistoTrueMotherEtaPiPlPiMiPiZeroInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1165 
1166  if(!fDoLightOutput){
1167  fHistoTrueMotherGammaGammaInvMassPt[iCut] = new TH2F("ESD_TrueMotherGG_InvMass_Pt","ESD_TrueMotherGG_InvMass_Pt",450,0.,0.45,HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1168  fHistoTrueMotherGammaGammaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#gamma #gamma} (GeV/c^{2})");
1169  fHistoTrueMotherGammaGammaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1171  fHistoTrueMotherGammaGammaFromEtaInvMassPt[iCut] = new TH2F("ESD_TrueMotherGGFromEta_InvMass_Pt","ESD_TrueMotherGGFromEta_InvMass_Pt",450,0.,0.45,HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1172  fHistoTrueMotherGammaGammaFromEtaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#gamma #gamma} (GeV/c^{2})");
1173  fHistoTrueMotherGammaGammaFromEtaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1175  fHistoTrueMotherGammaGammaFromOmegaInvMassPt[iCut] = new TH2F("ESD_TrueMotherGGFromOmega_InvMass_Pt","ESD_TrueMotherGGFromOmega_InvMass_Pt",450,0.,0.45,HistoNPtBins,HistoPtRange[0],HistoPtRange[1]);
1176  fHistoTrueMotherGammaGammaFromOmegaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#gamma #gamma} (GeV/c^{2})");
1177  fHistoTrueMotherGammaGammaFromOmegaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1179  fHistoTrueAngleSum[iCut] = new TH2F("ESD_TrueMother_AngleSum_Pt","ESD_TrueMother_AngleSum_Pt",HistoNPtBins,HistoPtRange[0],HistoPtRange[1],720,0,2*TMath::Pi());
1180  fHistoTrueAngleSum[iCut]->GetXaxis()->SetTitle("#sum #angle");
1181  fHistoTrueAngleSum[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1182  fTrueList[iCut]->Add(fHistoTrueAngleSum[iCut]);
1183 
1184  if (fDoMesonQA>0){
1185  fHistoTruePionPionInvMassPt[iCut] = new TH2F("ESD_TruePiPlusPiNeg_InvMassPt","ESD_TruePiPlusPiNeg_InvMassPt",2000,0.,2.,200,0.,20.);
1186  fHistoTruePionPionInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1187  fHistoTruePionPionInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1188  fTrueList[iCut]->Add(fHistoTruePionPionInvMassPt[iCut]);
1189  fHistoTruePionPionFromSameMotherInvMassPt[iCut] = new TH2F("ESD_TruePiPlusPiNegFromSameMother_InvMassPt","ESD_TruePiPlusPiNegFromSameMother_InvMassPt",2000,0.,2.,200,0.,20.);
1190  fHistoTruePionPionFromSameMotherInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1191  fHistoTruePionPionFromSameMotherInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1193  fHistoTruePionPionFromEtaInvMassPt[iCut] = new TH2F("ESD_TruePiPlusPiNegFromEta_InvMassPt","ESD_TruePiPlusPiNegFromEta_InvMassPt",2000,0.,2.,200,0.,20.);
1194  fHistoTruePionPionFromEtaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1195  fHistoTruePionPionFromEtaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1197  fHistoTruePionPionFromOmegaInvMassPt[iCut] = new TH2F("ESD_TruePiPlusPiNegFromOmega_InvMassPt","ESD_TruePiPlusPiNegFromOmega_InvMassPt",2000,0.,2.,200,0.,20.);
1198  fHistoTruePionPionFromOmegaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1199  fHistoTruePionPionFromOmegaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1201 
1202  fHistoTruePiPlPiMiSameMotherFromEtaInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiMiSameMotherFromEta_InvMassPt","ESD_TruePiPlPiMiSameMotherFromEta_InvMassPt",2000,0.,2.,200,0.,20.);
1203  fHistoTruePiPlPiMiSameMotherFromEtaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1204  fHistoTruePiPlPiMiSameMotherFromEtaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1206  fHistoTruePiPlPiMiSameMotherFromOmegaInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiMiSameMotherFromOmega_InvMassPt","ESD_TruePiPlPiMiSameMotherFromOmega_InvMassPt",2000,0.,2.,200,0.,20.);
1207  fHistoTruePiPlPiMiSameMotherFromOmegaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1208  fHistoTruePiPlPiMiSameMotherFromOmegaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1210  fHistoTruePiPlPiMiSameMotherFromRhoInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiMiSameMotherFromRho_InvMassPt","ESD_TruePiPlPiMiSameMotherFromRho_InvMassPt",2000,0.,2.,200,0.,20.);
1211  fHistoTruePiPlPiMiSameMotherFromRhoInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1212  fHistoTruePiPlPiMiSameMotherFromRhoInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1214  fHistoTruePiPlPiMiSameMotherFromEtaPrimeInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiMiSameMotherFromEtaPrime_InvMassPt","ESD_TruePiPlPiMiSameMotherFromEtaPrime_InvMassPt",
1215  2000,0.,2.,200,0.,20.);
1216  fHistoTruePiPlPiMiSameMotherFromEtaPrimeInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1217  fHistoTruePiPlPiMiSameMotherFromEtaPrimeInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1219  fHistoTruePiPlPiMiSameMotherFromK0sInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiMiSameMotherFromK0s_InvMassPt","ESD_TruePiPlPiMiSameMotherFromK0s_InvMassPt",2000,0.,2.,200,0.,20.);
1220  fHistoTruePiPlPiMiSameMotherFromK0sInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1221  fHistoTruePiPlPiMiSameMotherFromK0sInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1223  fHistoTruePiPlPiMiSameMotherFromK0lInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiMiSameMotherFromK0l_InvMassPt","ESD_TruePiPlPiMiSameMotherFromK0l_InvMassPt",2000,0.,2.,200,0.,20.);
1224  fHistoTruePiPlPiMiSameMotherFromK0lInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}} (GeV/c^{2})");
1225  fHistoTruePiPlPiMiSameMotherFromK0lInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1227 
1228  fHistoTruePiMiPiZeroSameMotherFromEtaInvMassPt[iCut] = new TH2F("ESD_TruePiMiPiZeroSameMotherFromEta_InvMassPt","ESD_TruePiMiPiZeroSameMotherFromEta_InvMassPt",2000,0.,2.,200,0.,20.);
1229  fHistoTruePiMiPiZeroSameMotherFromEtaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{-}#pi^{0}} (GeV/c^{2})");
1230  fHistoTruePiMiPiZeroSameMotherFromEtaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1232  fHistoTruePiMiPiZeroSameMotherFromOmegaInvMassPt[iCut] = new TH2F("ESD_TruePiMiPiZeroSameMotherFromOmega_InvMassPt","ESD_TruePiMiPiZeroSameMotherFromOmega_InvMassPt",2000,0.,2.,200,0.,20.);
1233  fHistoTruePiMiPiZeroSameMotherFromOmegaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{-}#pi^{0}} (GeV/c^{2})");
1234  fHistoTruePiMiPiZeroSameMotherFromOmegaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1236  fHistoTruePiMiPiZeroSameMotherFromRhoInvMassPt[iCut] = new TH2F("ESD_TruePiMiPiZeroSameMotherFromRho_InvMassPt","ESD_TruePiMiPiZeroSameMotherFromRho_InvMassPt",2000,0.,2.,200,0.,20.);
1237  fHistoTruePiMiPiZeroSameMotherFromRhoInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{-}#pi^{0}} (GeV/c^{2})");
1238  fHistoTruePiMiPiZeroSameMotherFromRhoInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1240  fHistoTruePiMiPiZeroSameMotherFromK0lInvMassPt[iCut] = new TH2F("ESD_TruePiMiPiZeroSameMotherFromK0l_InvMassPt","ESD_TruePiMiPiZeroSameMotherFromK0l_InvMassPt",2000,0.,2.,200,0.,20.);
1241  fHistoTruePiMiPiZeroSameMotherFromK0lInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{-}#pi^{0}} (GeV/c^{2})");
1242  fHistoTruePiMiPiZeroSameMotherFromK0lInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1244 
1245  fHistoTruePiPlPiZeroSameMotherFromEtaInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiZeroSameMotherFromEta_InvMassPt","ESD_TruePiPlPiZeroSameMotherFromEta_InvMassPt",2000,0.,2.,200,0.,20.);
1246  fHistoTruePiPlPiZeroSameMotherFromEtaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{0}} (GeV/c^{2})");
1247  fHistoTruePiPlPiZeroSameMotherFromEtaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1249  fHistoTruePiPlPiZeroSameMotherFromOmegaInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiZeroSameMotherFromOmega_InvMassPt","ESD_TruePiPlPiZeroSameMotherFromOmega_InvMassPt",2000,0.,2.,200,0.,20.);
1250  fHistoTruePiPlPiZeroSameMotherFromOmegaInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{0}} (GeV/c^{2})");
1251  fHistoTruePiPlPiZeroSameMotherFromOmegaInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1253  fHistoTruePiPlPiZeroSameMotherFromRhoInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiZeroSameMotherFromRho_InvMassPt","ESD_TruePiPlPiZeroSameMotherFromRho_InvMassPt",2000,0.,2.,200,0.,20.);
1254  fHistoTruePiPlPiZeroSameMotherFromRhoInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{0}} (GeV/c^{2})");
1255  fHistoTruePiMiPiZeroSameMotherFromRhoInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1257  fHistoTruePiPlPiZeroSameMotherFromK0lInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiZeroSameMotherFromK0l_InvMassPt","ESD_TruePiPlPiZeroSameMotherFromK0l_InvMassPt",2000,0.,2.,200,0.,20.);
1258  fHistoTruePiPlPiZeroSameMotherFromK0lInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{0}} (GeV/c^{2})");
1259  fHistoTruePiPlPiZeroSameMotherFromK0lInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1261  fHistoTruePiPlPiMiPiZeroPureCombinatoricalInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiMiPiZeroPureCombinatorical_InvMassPt","ESD_TruePiPlPiMiPiZeroPureCombinatorical_InvMassPt",2000,0.,2.,200,0.,20.);
1262  fHistoTruePiPlPiMiPiZeroPureCombinatoricalInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}#pi^{0}} (GeV/c^{2})");
1263  fHistoTruePiPlPiMiPiZeroPureCombinatoricalInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1265  fHistoTruePiPlPiMiPiZeroContaminationInvMassPt[iCut] = new TH2F("ESD_TruePiPlPiMiPiZeroContamination_InvMassPt","ESD_TruePiPlPiMiPiZeroContamination_InvMassPt",2000,0.,2.,200,0.,20.);
1266  fHistoTruePiPlPiMiPiZeroContaminationInvMassPt[iCut]->GetXaxis()->SetTitle("M_{#pi^{+}#pi^{-}#pi^{0}} (GeV/c^{2})");
1267  fHistoTruePiPlPiMiPiZeroContaminationInvMassPt[iCut]->GetYaxis()->SetTitle("p_{T} (GeV/c)");
1269  if(fDoMesonQA>1){
1270  fTrueTreeList[iCut] = new TList();
1271  fTrueTreeList[iCut]->SetName(nameTrueRecTTreeList.Data());
1272  fTrueTreeList[iCut]->SetOwner(kTRUE);
1273  fCutFolder[iCut]->Add(fTrueTreeList[iCut]);
1274 
1275  fTreePiPiSameMother[iCut] = new TTree("TreePiPiSameMother","TreePiPiSameMother");
1276  fTreePiPiSameMother[iCut]->Branch("fCasePiPi", &fCasePiPi, "fCasePiPi/S");
1277  fTreePiPiSameMother[iCut]->Branch("fSamePiPiMotherID", &fSamePiPiMotherID, "fSamePiPiMotherID/F");
1278  fTreePiPiSameMother[iCut]->Branch("fSamePiPiMotherInvMass", &fSamePiPiMotherInvMass, "fSamePiPiMotherInvMass/F");
1279  fTreePiPiSameMother[iCut]->Branch("fSamePiPiMotherPt", &fSamePiPiMotherPt, "fSamePiPiMotherPt/F");
1280  fTrueTreeList[iCut]->Add(fTreePiPiSameMother[iCut]);
1281 
1282  fTreePiPiPiSameMother[iCut] = new TTree("TreePiPiPiSameMother","TreePiPiPiSameMother");
1283  fTreePiPiPiSameMother[iCut]->Branch("fSamePiPiPiMotherID", &fSamePiPiPiMotherID, "fSamePiPiPiMotherID/F");
1284  fTreePiPiPiSameMother[iCut]->Branch("fSamePiPiPiMotherInvMass", &fSamePiPiPiMotherInvMass, "fSamePiPiPiMotherInvMass/F");
1285  fTreePiPiPiSameMother[iCut]->Branch("fSamePiPiPiMotherPt", &fSamePiPiPiMotherPt, "fSamePiPiPiMotherPt/F");
1286  fTrueTreeList[iCut]->Add(fTreePiPiPiSameMother[iCut]);
1287 
1288  fTreeEventInfoOmega[iCut] = new TTree("TreeEventInfoOmega","TreeEventInfoOmega");
1289  fTreeEventInfoOmega[iCut]->Branch("fV0MultiplicityOmegaEvent", &fV0MultiplicityOmegaEvent, "fV0MultiplicityOmegaEvent/F");
1290  fTreeEventInfoOmega[iCut]->Branch("fTrackMultiplicityOmegaEvent", &fTrackMultiplicityOmegaEvent, "fTrackMultiplicityOmegaEvent/F");
1291  fTreeEventInfoOmega[iCut]->Branch("fZVertexOmegaEvent", &fZVertexOmegaEvent, "fZVertexOmegaEvent/F");
1292  fTreeEventInfoOmega[iCut]->Branch("fPtOmega", &fPtOmega, "fPtOmega/F");
1293  fTrueTreeList[iCut]->Add(fTreeEventInfoOmega[iCut]);
1294 
1295  fTreeEventInfoEta[iCut] = new TTree("TreeEventInfoEta","TreeEventInfoEta");
1296  fTreeEventInfoEta[iCut]->Branch("fV0MultiplicityEtaEvent", &fV0MultiplicityEtaEvent, "fV0MultiplicityEtaEvent/F");
1297  fTreeEventInfoEta[iCut]->Branch("fTrackMultiplicityEtaEvent", &fTrackMultiplicityEtaEvent, "fTrackMultiplicityEtaEvent/F");
1298  fTreeEventInfoEta[iCut]->Branch("fZVertexEtaEvent", &fZVertexEtaEvent, "fZVertexEtaEvent/F");
1299  fTreeEventInfoEta[iCut]->Branch("fPtEta", &fPtEta, "fPtEta/F");
1300  fTrueTreeList[iCut]->Add(fTreeEventInfoEta[iCut]);
1301  }
1302  }
1303  }
1304  }
1305  }
1306 
1311 
1312  InitBack(); // Init Background Handler
1313 
1314  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
1315  if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
1316 
1317  if(fV0Reader){
1319  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms()){
1320  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
1321  }
1322  }
1323 
1325  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms()){
1326  fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
1327  }
1328  }
1329 
1330  }
1331 
1332  for(Int_t iMatcherTask = 0; iMatcherTask < 3; iMatcherTask++){
1333  AliCaloTrackMatcher* temp = (AliCaloTrackMatcher*) (AliAnalysisManager::GetAnalysisManager()->GetTask(Form("CaloTrackMatcher_%i",iMatcherTask)));
1334  if(temp) fOutputContainer->Add(temp->GetCaloTrackMatcherHistograms());
1335  }
1336 
1337  fPionSelector=(AliPrimaryPionSelector*)AliAnalysisManager::GetAnalysisManager()->GetTask("PionSelector");
1338  if(!fPionSelector){printf("Error: No PionSelector");return;} // GetV0Reader
1339 
1340  if( fPionSelector && (!fDoLightOutput)){
1341  if ( ((AliPrimaryPionCuts*)fPionSelector->GetPrimaryPionCuts())->GetCutHistograms() ){
1342  fOutputContainer->Add( ((AliPrimaryPionCuts*)fPionSelector->GetPrimaryPionCuts())->GetCutHistograms() );
1343  }
1344  }
1345 
1346  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1347  if( fEventCutArray) {
1348  if( ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms() ) {
1349  fCutFolder[iCut]->Add( ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
1350  }
1351  }
1352 
1353  if( fPionCutArray){
1354  if( ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->GetCutHistograms() ) {
1355  fCutFolder[iCut]->Add( ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->GetCutHistograms() );
1356  }
1357  }
1358  if (fNeutralPionMode < 2){
1359  if( fGammaCutArray ) {
1360  if( ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutHistograms() ) {
1361  fCutFolder[iCut]->Add( ((AliConversionPhotonCuts*)fGammaCutArray->At(iCut))->GetCutHistograms() );
1362  }
1363  }
1364  }
1365  if (fNeutralPionMode > 0){
1366  if( fClusterCutArray ) {
1367  if( ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms() ) {
1368  fCutFolder[iCut]->Add( ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms() );
1369  }
1370  }
1371  }
1373  if( ((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(iCut))->GetCutHistograms() ) {
1374  fCutFolder[iCut]->Add( ((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(iCut))->GetCutHistograms());
1375  }
1376  }
1377  if( fMesonCutArray ) {
1378  if( ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms() ) {
1379  fCutFolder[iCut]->Add( ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
1380  }
1381  }
1382  }
1383 
1384  PostData(1, fOutputContainer);
1385 
1386 }
1387 
1388 //______________________________________________________________________
1390 
1391  //
1392  // Execute analysis for current event
1393  //
1394 
1395  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
1396  if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
1397 
1398  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
1399  if(InputEvent()->IsIncompleteDAQ()==kTRUE) eventQuality = 2; // incomplete event
1400  if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1 or because it is incomplete
1401  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1402  fHistoNEvents[iCut]->Fill(eventQuality);
1403  }
1404  return;
1405  }
1406 
1407  fPionSelector=(AliPrimaryPionSelector*)AliAnalysisManager::GetAnalysisManager()->GetTask("PionSelector");
1408  if(!fPionSelector){printf("Error: No PionSelector");return;} // GetV0Reader
1409 
1410  if(fIsMC) fMCEvent = MCEvent();
1411  fESDEvent = (AliESDEvent*)InputEvent();
1412  fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
1413  fSelectorNegPionIndex = fPionSelector->GetReconstructedNegPionIndex(); // Electrons from default Cut
1414  fSelectorPosPionIndex = fPionSelector->GetReconstructedPosPionIndex(); // Positrons from default Cut
1415 
1417  //AddTaskContainers(); //Add conatiner
1418 
1419  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1420  fiCut = iCut;
1421 
1422  Bool_t isRunningEMCALrelAna = kFALSE;
1423  if (fNeutralPionMode > 0){
1424  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) isRunningEMCALrelAna = kTRUE;
1425  }
1426 
1427  Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon, isRunningEMCALrelAna);
1428 
1429  if(eventNotAccepted){
1430  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
1431  fHistoNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
1432  continue;
1433  }
1434 
1435  if(eventQuality != 0){// Event Not Accepted
1436  // cout << "event rejected due to: " <<eventQuality << endl;
1437  fHistoNEvents[iCut]->Fill(eventQuality);
1438  continue;
1439  }
1440 
1441  fHistoNEvents[iCut]->Fill(eventQuality);
1443  if(!fDoLightOutput){
1444  fHistoSPDClusterTrackletBackground[iCut]->Fill(fInputEvent->GetMultiplicity()->GetNumberOfTracklets(),(fInputEvent->GetNumberOfITSClusters(0)+fInputEvent->GetNumberOfITSClusters(1)));
1445  }
1446  if(fMCEvent){ // Process MC Particle
1447  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
1448  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1449  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
1450  fMCEvent);
1451  }
1453  }
1454 
1455  if (fNeutralPionMode < 2){
1456  ProcessConversionPhotonCandidates(); // Process this cuts conversion gammas
1457  }
1458  if (fNeutralPionMode > 0){
1459  ProcessCaloPhotonCandidates(); // Process this cuts calo gammas
1460  }
1461 
1462  if (fNeutralPionMode == 0 ){
1463  ProcessNeutralPionCandidatesPureConversions(); // Process neutral pion candidates purely from conversions
1464  }
1465  if (fNeutralPionMode == 1){
1466  ProcessNeutralPionCandidatesMixedConvCalo(); // Process neutral pion candidates mixed conv and calo
1467  }
1468  if (fNeutralPionMode == 2){
1469  ProcessNeutralPionCandidatesPureCalo(); // Process neutral pion candidates purely from calo
1470  }
1471 
1472  ProcessPionCandidates(); // Process this cuts gammas
1473 
1477 
1482 
1483  fGoodConvGammas->Clear();
1484  fClusterCandidates->Clear();
1485  fNeutralPionCandidates->Clear();
1487  fPosPionCandidates->Clear();
1488  fNegPionCandidates->Clear();
1489  fGoodVirtualParticles->Clear(); // delete this cuts good gammas
1490  }
1491 
1492  fSelectorNegPionIndex.clear();
1493  fSelectorPosPionIndex.clear();
1494 
1495  PostData( 1, fOutputContainer );
1496 }
1497 //________________________________________________________________________
1499  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1500  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
1501  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
1502  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
1503  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
1504  }
1505 
1506  if( !((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift() ){
1507  if(!fDoLightOutput){
1508  fProfileEtaShift[iCut]->Fill(0.,0.);
1509  }
1510  continue; // No Eta Shift requested, continue
1511  }
1512  if( ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
1513  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
1514  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
1515  ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->SetEtaShift( ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() );
1516  if(!fDoLightOutput){
1517  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1518  }
1519  continue;
1520  } else {
1521  printf(" Eta t PiPlusPiMinus Gamma Task %s :: Eta Shift Manually Set to %f \n\n",
1522  (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
1523  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
1524  ((AliPrimaryPionCuts*)fPionCutArray->At(iCut))->SetEtaShift( ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() );
1525  if(!fDoLightOutput){
1526  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1527  }
1528  }
1529  }
1530  return kTRUE;
1531 }
1532 
1533 
1536 }
1537 
1538 
1539 //________________________________________________________________________
1541 {
1542 
1543  Int_t nclus = 0;
1544  nclus = fInputEvent->GetNumberOfCaloClusters();
1545 
1546 // cout << nclus << endl;
1547 
1548  if(nclus == 0) return;
1549 
1550  // vertex
1551  Double_t vertex[3] = {0};
1552  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1553 
1554  // Loop over EMCal clusters
1555  for(Long_t i = 0; i < nclus; i++){
1556 
1557  AliVCluster* clus = NULL;
1558  if(fInputEvent->IsA()==AliESDEvent::Class()) clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
1559  else if(fInputEvent->IsA()==AliAODEvent::Class()) clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
1560 
1561  if (!clus) continue;
1562  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fMCEvent,fIsMC,1.,i)){ delete clus; continue;}
1563  // TLorentzvector with cluster
1564  TLorentzVector clusterVector;
1565  clus->GetMomentum(clusterVector,vertex);
1566 
1567  TLorentzVector* tmpvec = new TLorentzVector();
1568  tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
1569 
1570  // convert to AODConversionPhoton
1571  AliAODConversionPhoton *PhotonCandidate=new AliAODConversionPhoton(tmpvec);
1572  if(!PhotonCandidate){ delete clus; delete tmpvec; continue;}
1573 
1574  // Flag Photon as CaloPhoton
1575  PhotonCandidate->SetIsCaloPhoton();
1576  PhotonCandidate->SetCaloClusterRef(i);
1577  // get MC label
1578  if(fIsMC){
1579  Int_t* mclabelsCluster = clus->GetLabels();
1580  PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
1581 // cout << clus->GetNLabels() << endl;
1582  if (clus->GetNLabels()>0){
1583  for (Int_t k =0; k< (Int_t)clus->GetNLabels(); k++){
1584  if (k< 50)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
1585 // Int_t pdgCode = fMCEvent->Particle(mclabelsCluster[k])->GetPdgCode();
1586 // cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
1587  }
1588  }
1589  }
1590 
1591  fIsFromMBHeader = kTRUE;
1592  // test whether largest contribution to cluster orginates in added signals
1593  if (fIsMC && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCEvent, fInputEvent) == 0) fIsFromMBHeader = kFALSE;
1594 
1595  if (fIsFromMBHeader && (!fDoLightOutput)){
1596  fHistoClusterGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1597  fHistoClusterGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1598  }
1599  fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
1600 
1601  if(fIsMC){
1602 // if(fInputEvent->IsA()==AliESDEvent::Class()){
1603  ProcessTrueCaloPhotonCandidates(PhotonCandidate);
1604 // } else {
1605 // ProcessTrueClusterCandidatesAOD(PhotonCandidate);
1606 // }
1607  }
1608 
1609  delete clus;
1610  delete tmpvec;
1611  }
1612 
1613 }
1614 
1615 //________________________________________________________________________
1617 {
1618  TParticle *Photon = NULL;
1619  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
1620  if (TruePhotonCandidate->GetCaloPhotonMCLabel(0)<0) return;
1621 // fHistoTrueNLabelsInClus[fiCut]->Fill(TruePhotonCandidate->GetNCaloPhotonMCLabels());
1622 
1623  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
1624  Double_t mcProdVtxX = primVtxMC->GetX();
1625  Double_t mcProdVtxY = primVtxMC->GetY();
1626  Double_t mcProdVtxZ = primVtxMC->GetZ();
1627 
1628  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0)Photon = fMCEvent->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
1629  else return;
1630 
1631  if(Photon == NULL){
1632  // cout << "no photon" << endl;
1633  return;
1634  }
1635 
1636 // Int_t pdgCodeParticle = Photon->GetPdgCode();
1637  TruePhotonCandidate->SetCaloPhotonMCFlags(fMCEvent, kFALSE);
1638 
1639  // True Photon
1640  if(fIsFromMBHeader && (!fDoLightOutput)){
1641  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, TruePhotonCandidate->GetCaloPhotonMCLabel(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
1642  if(isPrimary){
1643  if (TruePhotonCandidate->IsLargestComponentPhoton()){
1644  fHistoTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1646  fHistoTrueClusterGammaFromNeutralMesonPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1647  }
1648  }
1649  if (TruePhotonCandidate->IsLargestComponentElectron() && TruePhotonCandidate->IsConversion()){
1650  fHistoTrueClusterGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1652  fHistoTrueClusterGammaFromNeutralMesonPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1653  }
1654  }
1655  }
1656  }
1657  return;
1658 }
1659 
1660 
1661 
1662 //________________________________________________________________________
1664  Int_t nV0 = 0;
1665  TList *GoodGammasStepOne = new TList();
1666  TList *GoodGammasStepTwo = new TList();
1667  // Loop over Photon Candidates allocated by ReaderV1
1668 
1669  for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
1670  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
1671  if(!PhotonCandidate) continue;
1672 
1673  fIsFromMBHeader = kTRUE;
1674 
1675  if( fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0 ){
1676  Int_t isPosFromMBHeader
1677  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
1678  if(isPosFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1679  Int_t isNegFromMBHeader
1680  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent,fInputEvent);
1681  if(isNegFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1682  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1683  }
1684 
1685  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fESDEvent)) continue;
1686 
1687  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseElecSharingCut() &&
1688  !((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseToCloseV0sCut()){ // if no post reader loop is required add to events good gammas
1689 
1690  fGoodConvGammas->Add(PhotonCandidate);
1691 
1692  if(fIsFromMBHeader && (!fDoLightOutput)){
1693  fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1694  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1695  }
1696 
1697  if(fMCEvent){
1698  ProcessTrueConversionPhotonCandidates(PhotonCandidate);
1699  }
1700  } else if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
1701  ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
1702  nV0++;
1703  GoodGammasStepOne->Add(PhotonCandidate);
1704  } else if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseElecSharingCut() &&
1705  ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
1706  GoodGammasStepTwo->Add(PhotonCandidate);
1707  }
1708  }
1709 
1710 
1711  if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseElecSharingCut()){
1712  for(Int_t i = 0;i<GoodGammasStepOne->GetEntries();i++){
1713  AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GoodGammasStepOne->At(i);
1714  if(!PhotonCandidate) continue;
1715  fIsFromMBHeader = kTRUE;
1716  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1717  Int_t isPosFromMBHeader
1718  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent,fInputEvent);
1719  Int_t isNegFromMBHeader
1720  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent,fInputEvent);
1721  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1722  }
1723  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GoodGammasStepOne->GetEntries())) continue;
1724  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
1725  fGoodConvGammas->Add(PhotonCandidate);
1726  if(fIsFromMBHeader && (!fDoLightOutput)){
1727  fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1728  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1729  }
1730  if(fMCEvent){
1731  ProcessTrueConversionPhotonCandidates(PhotonCandidate);
1732  }
1733  }
1734  else GoodGammasStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
1735  }
1736  }
1737  if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->UseToCloseV0sCut()){
1738  for(Int_t i = 0;i<GoodGammasStepTwo->GetEntries();i++){
1739  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GoodGammasStepTwo->At(i);
1740  if(!PhotonCandidate) continue;
1741 
1742  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1743  Int_t isPosFromMBHeader
1744  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent,fInputEvent);
1745  Int_t isNegFromMBHeader
1746  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent,fInputEvent);
1747  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1748  }
1749 
1750  if(!((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GoodGammasStepTwo,i)) continue;
1751  fGoodConvGammas->Add(PhotonCandidate); // Add gamma to current cut TList
1752 
1753  if(fIsFromMBHeader && (!fDoLightOutput)){
1754  fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt()); // Differences to old V0Reader in p_t due to conversion KF->TLorentzVector
1755  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1756  }
1757 
1758  if(fMCEvent){
1759  ProcessTrueConversionPhotonCandidates(PhotonCandidate);
1760  }
1761  }
1762  }
1763 
1764  delete GoodGammasStepOne;
1765  GoodGammasStepOne = 0x0;
1766  delete GoodGammasStepTwo;
1767  GoodGammasStepTwo = 0x0;
1768 }
1769 
1770 //________________________________________________________________________
1772 {
1773  // Process True Photons
1774  TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCEvent);
1775  TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCEvent);
1776 
1777  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
1778  Double_t mcProdVtxX = primVtxMC->GetX();
1779  Double_t mcProdVtxY = primVtxMC->GetY();
1780  Double_t mcProdVtxZ = primVtxMC->GetZ();
1781 
1782 
1783  if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
1784  if(posDaughter->GetMother(0) != negDaughter->GetMother(0)){ // Not Same Mother == Combinatorial Bck
1785  return;
1786  }
1787 
1788  else if (posDaughter->GetMother(0) == -1){
1789  return;
1790  }
1791 
1792  if(TMath::Abs(posDaughter->GetPdgCode())!=11 || TMath::Abs(negDaughter->GetPdgCode())!=11) return; //One Particle is not electron
1793  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge
1794  if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() !=5) return;// check if the daughters come from a conversion
1795 
1796  TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCEvent);
1797  if(Photon->GetPdgCode() != 22) return; // Mother is no Photon
1798 
1799  // True Photon
1800 
1801  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueConvGammas,posDaughter->GetMother(0)) && (!fDoLightOutput)) fHistoDoubleCountTrueConvGammaRPt[fiCut]->Fill(TruePhotonCandidate->GetConversionRadius(),TruePhotonCandidate->Pt());
1802 
1803  Int_t labelGamma = TruePhotonCandidate->GetMCParticleLabel(fMCEvent);
1804  Bool_t gammaIsPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, labelGamma, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
1805  if( gammaIsPrimary ){
1806  if( fIsFromMBHeader && (!fDoLightOutput) ){
1807  fHistoTrueConvGammaPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1809  fHistoTrueConvGammaFromNeutralMesonPt[fiCut]->Fill(TruePhotonCandidate->Pt());
1810  }
1811  }
1812  }
1813 }
1814 
1815 //________________________________________________________________________
1817  // Conversion Gammas
1818  if(fGoodConvGammas->GetEntries()>1){
1819  for(Int_t firstGammaIndex=0;firstGammaIndex<fGoodConvGammas->GetEntries()-1;firstGammaIndex++){
1820  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGoodConvGammas->At(firstGammaIndex));
1821  if (gamma0==NULL) continue;
1822  for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fGoodConvGammas->GetEntries();secondGammaIndex++){
1823  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fGoodConvGammas->At(secondGammaIndex));
1824  //Check for same Electron ID
1825  if (gamma1==NULL) continue;
1826  if(gamma0->GetTrackLabelPositive() == gamma1->GetTrackLabelPositive() ||
1827  gamma0->GetTrackLabelNegative() == gamma1->GetTrackLabelNegative() ||
1828  gamma0->GetTrackLabelNegative() == gamma1->GetTrackLabelPositive() ||
1829  gamma0->GetTrackLabelPositive() == gamma1->GetTrackLabelNegative() ) continue;
1830 
1831  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
1832  pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
1833 
1834  pi0cand->CalculateDistanceOfClossetApproachToPrimVtx(fInputEvent->GetPrimaryVertex());
1835  if((((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
1836  if(!fDoLightOutput){
1837  fHistoGammaGammaInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
1838  }
1839  if(fIsMC){
1840  if(fInputEvent->IsA()==AliESDEvent::Class())
1841  ProcessTrueNeutralPionCandidatesPureConversions(pi0cand,gamma0,gamma1);
1842  if(fInputEvent->IsA()==AliAODEvent::Class())
1844  }
1845  if (((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(pi0cand, 0)){
1846  fNeutralPionCandidates->Add(pi0cand);
1847  } else if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseSidebandMixing()) &&
1848  (((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(pi0cand, 1))){
1849  fNeutralPionSidebandCandidates->Add(pi0cand);
1850  } else if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseSidebandMixingBothSides()) &&
1851  ((((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(pi0cand, 2)) ||
1852  ((((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(pi0cand, 3))))){
1853  fNeutralPionSidebandCandidates->Add(pi0cand);
1854  } else{
1855  delete pi0cand;
1856  pi0cand=0x0;
1857  }
1858  }else{
1859  delete pi0cand;
1860  pi0cand=0x0;
1861  }
1862  }
1863  }
1864  }
1865 }
1866 
1867 
1868 //________________________________________________________________________
1870 
1871  // Conversion Gammas
1872  if(fClusterCandidates->GetEntries()>0){
1873 
1874  // vertex
1875  Double_t vertex[3] = {0};
1876  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1877 
1878  for(Int_t firstGammaIndex=0;firstGammaIndex<fClusterCandidates->GetEntries();firstGammaIndex++){
1879  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(firstGammaIndex));
1880  if (gamma0==NULL) continue;
1881 
1882  for(Int_t secondGammaIndex=0;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
1883  if (firstGammaIndex == secondGammaIndex) continue;
1884  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
1885  if (gamma1==NULL) continue;
1886 
1887  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
1888  pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
1889 
1890  if((((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
1891  if(!fDoLightOutput){
1892  fHistoGammaGammaInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
1893  }
1894  if(fIsMC){
1895  ProcessTrueNeutralPionCandidatesPureCalo(pi0cand,gamma0,gamma1);
1896  }
1897 
1898  if (((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(pi0cand, 0)){
1899  fNeutralPionCandidates->Add(pi0cand);
1900  } else if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseSidebandMixing()) &&
1901  (((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(pi0cand, 1))){
1902  fNeutralPionSidebandCandidates->Add(pi0cand);
1903  } else if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseSidebandMixingBothSides()) &&
1904  ((((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(pi0cand, 2)) ||
1905  ((((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(pi0cand, 3))))){
1906  fNeutralPionSidebandCandidates->Add(pi0cand);
1907  }else {
1908  delete pi0cand;
1909  pi0cand=0x0;
1910  }
1911  } else{
1912  delete pi0cand;
1913  pi0cand=0x0;
1914  }
1915  }
1916  }
1917  }
1918 }
1919 
1920 //______________________________________________________________________
1922 {
1923  // Process True Mesons
1924 
1925  Bool_t isTruePi0 = kFALSE;
1926  Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
1927  Int_t gamma0MotherLabel = -1;
1928  Int_t motherRealLabel = -1;
1929 
1930  if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1931  TParticle * gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
1932  if (TrueGammaCandidate0->IsLargestComponentPhoton() || TrueGammaCandidate0->IsLargestComponentElectron()){ // largest component is electro magnetic
1933  // get mother of interest (pi0 or eta)
1934  if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons its the direct mother
1935  gamma0MotherLabel=gammaMC0->GetMother(0);
1936  motherRealLabel=gammaMC0->GetFirstMother();
1937  } else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
1938  if (TrueGammaCandidate0->IsConversion() && gammaMC0->GetMother(0)>-1){
1939  gamma0MotherLabel=fMCEvent->Particle(gammaMC0->GetMother(0))->GetMother(0);
1940  motherRealLabel=fMCEvent->Particle(gammaMC0->GetMother(0))->GetMother(0);
1941  } else {
1942  gamma0MotherLabel=gammaMC0->GetMother(0);
1943  motherRealLabel=gammaMC0->GetMother(0);
1944  }
1945  }
1946  }
1947  }
1948 
1949  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
1950 
1951  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
1952  Int_t gamma1MotherLabel = -1;
1953  // check if
1954  if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
1955  // Daughters Gamma 1
1956  TParticle * gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
1957  if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
1958  // get mother of interest (pi0 or eta)
1959  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
1960  gamma1MotherLabel=gammaMC1->GetMother(0);
1961  } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
1962  if (TrueGammaCandidate1->IsConversion() && gammaMC1->GetMother(0)>-1) gamma1MotherLabel=fMCEvent->Particle(gammaMC1->GetMother(0))->GetMother(0);
1963  else gamma1MotherLabel=gammaMC1->GetMother(0);
1964  }
1965  }
1966  }
1967 
1968  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
1969  if(((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
1970  isTruePi0=kTRUE;
1971  if (CheckVectorForDoubleCount(fVectorDoubleCountTruePi0s,gamma0MotherLabel) && (!fDoLightOutput)) fHistoDoubleCountTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1972  }
1973  }
1974 
1975  if(isTruePi0){// True Pion
1976  Pi0Candidate->SetTrueMesonValue(1);
1977  Pi0Candidate->SetMCLabel(motherRealLabel);
1978  if(!fDoLightOutput){
1979  fHistoTrueMotherGammaGammaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1980  if( IsEtaPiPlPiMiPiZeroDaughter(motherRealLabel) ) {
1981  fHistoTrueMotherGammaGammaFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1982  }
1983  if( IsOmegaPiPlPiMiPiZeroDaughter(motherRealLabel) ) {
1984  fHistoTrueMotherGammaGammaFromOmegaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
1985  }
1986  }
1987  }
1988 }
1989 
1990 
1991 
1992 //______________________________________________________________________
1994 {
1995  // Process True Mesons
1996  if(TrueGammaCandidate0->GetV0Index()<fInputEvent->GetNumberOfV0s()){
1997  Bool_t isTruePi0 = kFALSE;
1998  Bool_t isTruePi0Dalitz = kFALSE;
1999  Bool_t gamma0DalitzCand = kFALSE;
2000  Bool_t gamma1DalitzCand = kFALSE;
2001  Int_t gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(fMCEvent);
2002  Int_t gamma0MotherLabel = -1;
2003  Int_t motherRealLabel = -1;
2004  if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2005  // Daughters Gamma 0
2006  TParticle * negativeMC = (TParticle*)TrueGammaCandidate0->GetNegativeMCDaughter(fMCEvent);
2007  TParticle * positiveMC = (TParticle*)TrueGammaCandidate0->GetPositiveMCDaughter(fMCEvent);
2008  TParticle * gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
2009  if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2010  if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
2011  if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
2012  gamma0MotherLabel=gammaMC0->GetFirstMother();
2013  motherRealLabel=gammaMC0->GetFirstMother();
2014  }
2015  }
2016  if(gammaMC0->GetPdgCode() ==111){ // Dalitz candidate
2017  gamma0DalitzCand = kTRUE;
2018  gamma0MotherLabel=-111;
2019  motherRealLabel=gamma0MCLabel;
2020  }
2021  }
2022  }
2023  if(TrueGammaCandidate1->GetV0Index()<fInputEvent->GetNumberOfV0s()){
2024  Int_t gamma1MCLabel = TrueGammaCandidate1->GetMCParticleLabel(fMCEvent);
2025  Int_t gamma1MotherLabel = -1;
2026  if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2027  // Daughters Gamma 1
2028  TParticle * negativeMC = (TParticle*)TrueGammaCandidate1->GetNegativeMCDaughter(fMCEvent);
2029  TParticle * positiveMC = (TParticle*)TrueGammaCandidate1->GetPositiveMCDaughter(fMCEvent);
2030  TParticle * gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
2031  if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2032  if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
2033  if(gammaMC1->GetPdgCode() == 22){ // ... with Gamma Mother
2034  gamma1MotherLabel=gammaMC1->GetFirstMother();
2035  }
2036  }
2037  if(gammaMC1->GetPdgCode() ==111 ){ // Dalitz candidate
2038  gamma1DalitzCand = kTRUE;
2039  gamma1MotherLabel=-111;
2040  }
2041  }
2042  }
2043  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
2044  if(((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
2045  isTruePi0=kTRUE;
2046  if (CheckVectorForDoubleCount(fVectorDoubleCountTruePi0s,gamma0MotherLabel) && (!fDoLightOutput)) fHistoDoubleCountTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2047  }
2048  }
2049 
2050  //Identify Dalitz candidate
2051  if (gamma1DalitzCand || gamma0DalitzCand){
2052  if (gamma0DalitzCand && gamma0MCLabel >=0 && gamma0MCLabel==gamma1MotherLabel){
2053  if (gamma0MotherLabel == -111) isTruePi0Dalitz = kTRUE;
2054  }
2055  if (gamma1DalitzCand && gamma1MCLabel >=0 && gamma1MCLabel==gamma0MotherLabel){
2056  if (gamma1MotherLabel == -111) isTruePi0Dalitz = kTRUE;
2057  }
2058  }
2059 
2060 
2061  if(isTruePi0 || isTruePi0Dalitz){// True Pion
2062  Pi0Candidate->SetTrueMesonValue(1);
2063  Pi0Candidate->SetMCLabel(motherRealLabel);
2064  if(!fDoLightOutput){
2065  fHistoTrueMotherGammaGammaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2066  if( IsEtaPiPlPiMiPiZeroDaughter(motherRealLabel) ) {
2067  fHistoTrueMotherGammaGammaFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2068  }
2069  if( IsOmegaPiPlPiMiPiZeroDaughter(motherRealLabel) ) {
2070  fHistoTrueMotherGammaGammaFromOmegaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2071  }
2072  }
2073  }
2074  }
2075  }
2076 }
2077 
2078 //______________________________________________________________________
2080 {
2081 
2082  // Process True Mesons
2083  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
2084  Bool_t isTruePi0 = kFALSE;
2085  Bool_t isTruePi0Dalitz = kFALSE;
2086  Bool_t gamma0DalitzCand = kFALSE;
2087  Bool_t gamma1DalitzCand = kFALSE;
2088  Int_t motherRealLabel = -1;
2089 
2090  if (AODMCTrackArray!=NULL && TrueGammaCandidate0 != NULL){
2091  AliAODMCParticle *positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
2092  AliAODMCParticle *negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
2093 
2094  Int_t gamma0MCLabel = -1;
2095  Int_t gamma0MotherLabel = -1;
2096  if(!positiveMC||!negativeMC)
2097  return;
2098 
2099  if(positiveMC->GetMother()>-1&&(negativeMC->GetMother() == positiveMC->GetMother())){
2100  gamma0MCLabel = positiveMC->GetMother();
2101  }
2102 
2103  if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2104  // Daughters Gamma 0
2105  AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
2106  if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2107  if(((positiveMC->GetMCProcessCode())) == 5 && ((negativeMC->GetMCProcessCode())) == 5){ // ... From Conversion ...
2108  if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
2109  gamma0MotherLabel=gammaMC0->GetMother();
2110  motherRealLabel=gammaMC0->GetMother();
2111  }
2112  }
2113  if(gammaMC0->GetPdgCode() ==111){ // Dalitz candidate
2114  gamma0DalitzCand = kTRUE;
2115  gamma0MotherLabel=-111;
2116  motherRealLabel=gamma0MCLabel;
2117  }
2118  }
2119  }
2120  positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate1->GetMCLabelPositive()));
2121  negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate1->GetMCLabelNegative()));
2122 
2123  Int_t gamma1MCLabel = -1;
2124  Int_t gamma1MotherLabel = -1;
2125  if(!positiveMC||!negativeMC)
2126  return;
2127 
2128  if(positiveMC->GetMother()>-1&&(negativeMC->GetMother() == positiveMC->GetMother())){
2129  gamma1MCLabel = positiveMC->GetMother();
2130  }
2131  if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2132  // Daughters Gamma 1
2133  AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
2134  if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2135  if(((positiveMC->GetMCProcessCode())) == 5 && ((negativeMC->GetMCProcessCode())) == 5){ // ... From Conversion ...
2136  if(gammaMC1->GetPdgCode() == 22){ // ... with Gamma Mother
2137  gamma1MotherLabel=gammaMC1->GetMother();
2138  }
2139  }
2140  if(gammaMC1->GetPdgCode() ==111 ){ // Dalitz candidate
2141  gamma1DalitzCand = kTRUE;
2142  gamma1MotherLabel=-111;
2143  }
2144  }
2145  }
2146  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
2147  if(static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
2148  isTruePi0=kTRUE;
2149  if (CheckVectorForDoubleCount(fVectorDoubleCountTruePi0s,gamma0MotherLabel) &&(!fDoLightOutput)) fHistoDoubleCountTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2150  }
2151  }
2152 
2153  //Identify Dalitz candidate
2154  if (gamma1DalitzCand || gamma0DalitzCand){
2155  if (gamma0DalitzCand && gamma0MCLabel >=0 && gamma0MCLabel==gamma1MotherLabel){
2156  if (gamma0MotherLabel == -111) isTruePi0Dalitz = kTRUE;
2157  }
2158  if (gamma1DalitzCand && gamma1MCLabel >=0 && gamma1MCLabel==gamma0MotherLabel){
2159  if (gamma1MotherLabel == -111) isTruePi0Dalitz = kTRUE;
2160  }
2161  }
2162 
2163  if(isTruePi0 || isTruePi0Dalitz){// True Pion
2164  Pi0Candidate->SetTrueMesonValue(1);
2165  Pi0Candidate->SetMCLabel(motherRealLabel);
2166  if(!fDoLightOutput){
2167  fHistoTrueMotherGammaGammaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2168  if( IsEtaPiPlPiMiPiZeroDaughter(motherRealLabel) ) {
2169  fHistoTrueMotherGammaGammaFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2170  }
2171  if( IsOmegaPiPlPiMiPiZeroDaughter(motherRealLabel) ) {
2172  fHistoTrueMotherGammaGammaFromOmegaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2173  }
2174  }
2175  }
2176  }
2177  return;
2178 }
2179 
2180 
2181 //________________________________________________________________________
2183 
2184  // Conversion Gammas
2185  if(fGoodConvGammas->GetEntries()>0){
2186  // vertex
2187  Double_t vertex[3] = {0};
2188  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
2189 
2190  for(Int_t firstGammaIndex=0;firstGammaIndex<fGoodConvGammas->GetEntries();firstGammaIndex++){
2191  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGoodConvGammas->At(firstGammaIndex));
2192  if (gamma0==NULL) continue;
2193 
2194  for(Int_t secondGammaIndex=0;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
2195  Bool_t matched = kFALSE;
2196  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
2197  if (gamma1==NULL) continue;
2198 
2199  if (gamma1->GetIsCaloPhoton()){
2200  AliVCluster* cluster = fInputEvent->GetCaloCluster(gamma1->GetCaloClusterRef());
2201  matched = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma0,cluster, fInputEvent );
2202  }
2203 
2204  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
2205  pi0cand->SetLabels(firstGammaIndex,secondGammaIndex);
2206 
2207  if((((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))){
2208  if (!matched){
2209  if(!fDoLightOutput){
2210  fHistoGammaGammaInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt());
2211  }
2212  if(fIsMC){
2213  ProcessTrueNeutralPionCandidatesMixedConvCalo(pi0cand,gamma0,gamma1);
2214  }
2215  if (((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(pi0cand, 0)){
2216  fNeutralPionCandidates->Add(pi0cand);
2217  } else if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseSidebandMixing()) &&
2218  (((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(pi0cand, 1))){
2219  fNeutralPionSidebandCandidates->Add(pi0cand);
2220  } else if((((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseSidebandMixingBothSides()) &&
2221  ((((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(pi0cand, 2)) ||
2222  ((((AliConversionMesonCuts*)fNeutralPionMesonCutArray->At(fiCut))->MesonIsSelectedByMassCut(pi0cand, 3))))){
2223  fNeutralPionSidebandCandidates->Add(pi0cand);
2224  } else{
2225  delete pi0cand;
2226  pi0cand=0x0;
2227  }
2228  }else{
2229  delete pi0cand;
2230  pi0cand=0x0;
2231  }
2232  }else{
2233  delete pi0cand;
2234  pi0cand=0x0;
2235  }
2236  }
2237  }
2238  }
2239 }
2240 
2241 //______________________________________________________________________
2243 {
2244  // Process True Mesons
2245  if(TrueGammaCandidate0->GetV0Index()<fInputEvent->GetNumberOfV0s()){
2246  Bool_t isTruePi0 = kFALSE;
2247  Bool_t isTruePi0Dalitz = kFALSE;
2248  Bool_t gamma0DalitzCand = kFALSE;
2249 
2250  Int_t gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(fMCEvent);
2251  Int_t gamma0MotherLabel = -1;
2252  Int_t motherRealLabel = -1;
2253  if(gamma0MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2254  // Daughters Gamma 0
2255  TParticle * negativeMC = (TParticle*)TrueGammaCandidate0->GetNegativeMCDaughter(fMCEvent);
2256  TParticle * positiveMC = (TParticle*)TrueGammaCandidate0->GetPositiveMCDaughter(fMCEvent);
2257  TParticle * gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
2258  if(TMath::Abs(negativeMC->GetPdgCode())==11 && TMath::Abs(positiveMC->GetPdgCode())==11){ // Electrons ...
2259  if(negativeMC->GetUniqueID() == 5 && positiveMC->GetUniqueID() ==5){ // ... From Conversion ...
2260  if(gammaMC0->GetPdgCode() == 22){ // ... with Gamma Mother
2261  gamma0MotherLabel=gammaMC0->GetFirstMother();
2262  motherRealLabel=gammaMC0->GetFirstMother();
2263  }
2264  }
2265  if(gammaMC0->GetPdgCode() ==111){ // Dalitz candidate
2266  gamma0DalitzCand = kTRUE;
2267  gamma0MotherLabel=-111;
2268  motherRealLabel=gamma0MCLabel;
2269  }
2270 
2271  }
2272  }
2273 
2274  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2275 
2276  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
2277  Int_t gamma1MotherLabel = -1;
2278  // check if
2279 
2280  if(gamma1MCLabel != -1){ // Gamma is Combinatorial; MC Particles don't belong to the same Mother
2281  // Daughters Gamma 1
2282  TParticle * gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
2283  if (TrueGammaCandidate1->IsLargestComponentPhoton() || TrueGammaCandidate1->IsLargestComponentElectron()){ // largest component is electro magnetic
2284  // get mother of interest (pi0 or eta)
2285  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons its the direct mother
2286  gamma1MotherLabel=gammaMC1->GetMother(0);
2287  } else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons its either the direct mother or for conversions the grandmother
2288  if (TrueGammaCandidate1->IsConversion() && gammaMC1->GetMother(0)>-1) gamma1MotherLabel=fMCEvent->Particle(gammaMC1->GetMother(0))->GetMother(0);
2289  else gamma1MotherLabel=gammaMC1->GetMother(0);
2290  }
2291  }
2292  }
2293 
2294  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel){
2295  if(((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
2296  isTruePi0=kTRUE;
2297  if (CheckVectorForDoubleCount(fVectorDoubleCountTruePi0s,gamma0MotherLabel) && (!fDoLightOutput)) fHistoDoubleCountTruePi0InvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2298  }
2299  }
2300 
2301  if (gamma0DalitzCand ){
2302  if (gamma0DalitzCand && gamma0MCLabel >=0 && gamma0MCLabel==gamma1MotherLabel){
2303  if (gamma0MotherLabel == -111) isTruePi0Dalitz = kTRUE;
2304  }
2305  }
2306 
2307  if(isTruePi0 || isTruePi0Dalitz ){
2308  Pi0Candidate->SetTrueMesonValue(1);
2309  Pi0Candidate->SetMCLabel(motherRealLabel);
2310  if(!fDoLightOutput){
2311  fHistoTrueMotherGammaGammaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2312  if( IsEtaPiPlPiMiPiZeroDaughter(motherRealLabel) ) {
2313  fHistoTrueMotherGammaGammaFromEtaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2314  }
2315  if( IsOmegaPiPlPiMiPiZeroDaughter(motherRealLabel) ) {
2316  fHistoTrueMotherGammaGammaFromOmegaInvMassPt[fiCut]->Fill(Pi0Candidate->M(),Pi0Candidate->Pt());
2317  }
2318  }
2319  }
2320  }
2321 }
2322 
2323 
2324 
2325 //________________________________________________________________________
2327 
2328  Double_t magField = fInputEvent->GetMagneticField();
2329  if( magField < 0.0 ){
2330  magField = 1.0;
2331  } else {
2332  magField = -1.0;
2333  }
2334 
2335  vector<Int_t> lGoodNegPionIndexPrev(0);
2336  vector<Int_t> lGoodPosPionIndexPrev(0);
2337 
2338  for(UInt_t i = 0; i < fSelectorNegPionIndex.size(); i++){
2339  AliESDtrack* negPionCandidate = fESDEvent->GetTrack(fSelectorNegPionIndex[i]);
2340  if(! ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->PionIsSelected(negPionCandidate) ) continue;
2341  lGoodNegPionIndexPrev.push_back( fSelectorNegPionIndex[i] );
2342 
2343  TLorentzVector *negPionforHandler = new TLorentzVector();
2344  negPionforHandler->SetPxPyPzE(negPionCandidate->Px(), negPionCandidate->Py(), negPionCandidate->Pz(), negPionCandidate->E());
2345 
2346  AliAODConversionPhoton *negPionHandler = new AliAODConversionPhoton(negPionforHandler);
2347  delete negPionforHandler;
2348 
2349  fNegPionCandidates->Add(negPionHandler);
2350  if(!fDoLightOutput){
2351  fHistoNegPionPt[fiCut]->Fill(negPionCandidate->Pt());
2352  fHistoNegPionPhi[fiCut]->Fill(negPionCandidate->Phi());
2353  }
2354 
2355  if( fMCEvent ) {
2356  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2357  Double_t mcProdVtxX = primVtxMC->GetX();
2358  Double_t mcProdVtxY = primVtxMC->GetY();
2359  Double_t mcProdVtxZ = primVtxMC->GetZ();
2360 
2361  Int_t labelNegPion = TMath::Abs( negPionCandidate->GetLabel() );
2362  Bool_t negPionIsPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, labelNegPion, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2363  if( labelNegPion>-1 && labelNegPion < fMCEvent->GetNumberOfTracks() ){
2364  TParticle* negPion = fMCEvent->Particle(labelNegPion);
2365  if( negPion->GetPdgCode() == -211 ){
2366  if(!fDoLightOutput){
2367 
2368  if( negPionIsPrimary ){
2369  fHistoTrueNegPionPt[fiCut]->Fill(negPionCandidate->Pt()); //primary negPion
2370  }
2371  if( IsEtaPiPlPiMiPiZeroDaughter(labelNegPion) || IsOmegaPiPlPiMiPiZeroDaughter(labelNegPion) ) {
2372  if( negPionIsPrimary ) {
2373  fHistoTrueNegPionFromNeutralMesonPt[fiCut]->Fill(negPionCandidate->Pt());
2374  }
2375  }
2376  }
2377  }
2378  }
2379  }
2380  }
2381 
2382  for(UInt_t i = 0; i < fSelectorPosPionIndex.size(); i++){
2383  AliESDtrack* posPionCandidate = fESDEvent->GetTrack( fSelectorPosPionIndex[i] );
2384  if(! ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->PionIsSelected(posPionCandidate) ) continue;
2385  lGoodPosPionIndexPrev.push_back( fSelectorPosPionIndex[i] );
2386 
2387  TLorentzVector *posPionforHandler = new TLorentzVector();
2388  posPionforHandler->SetPxPyPzE(posPionCandidate->Px(), posPionCandidate->Py(), posPionCandidate->Pz(), posPionCandidate->E());
2389 
2390  AliAODConversionPhoton *posPionHandler = new AliAODConversionPhoton(posPionforHandler);
2391  delete posPionforHandler;
2392 
2393  fPosPionCandidates->Add(posPionHandler);
2394  if(!fDoLightOutput){
2395  fHistoPosPionPt[fiCut]->Fill( posPionCandidate->Pt() );
2396  fHistoPosPionPhi[fiCut]->Fill( posPionCandidate->Phi() );
2397  }
2398  if( fMCEvent ) {
2399  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2400  Double_t mcProdVtxX = primVtxMC->GetX();
2401  Double_t mcProdVtxY = primVtxMC->GetY();
2402  Double_t mcProdVtxZ = primVtxMC->GetZ();
2403 
2404  Int_t labelPosPion = TMath::Abs( posPionCandidate->GetLabel() );
2405  Bool_t posPionIsPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, labelPosPion, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2406  if( labelPosPion>-1 && labelPosPion < fMCEvent->GetNumberOfTracks() ) {
2407  TParticle* posPion = fMCEvent->Particle(labelPosPion);
2408  if( posPion->GetPdgCode() == 211 ){
2409  if(!fDoLightOutput){
2410  if( posPionIsPrimary ){
2411  fHistoTruePosPionPt[fiCut]->Fill(posPionCandidate->Pt());
2412  }
2413  if( IsEtaPiPlPiMiPiZeroDaughter(labelPosPion) || IsOmegaPiPlPiMiPiZeroDaughter(labelPosPion) ) {
2414  if(posPionIsPrimary){
2415  fHistoTruePosPionFromNeutralMesonPt[fiCut]->Fill(posPionCandidate->Pt());
2416  }
2417  }
2418  }
2419  }
2420  }
2421  }
2422  }
2423 
2424 
2425  for(UInt_t i = 0; i < lGoodNegPionIndexPrev.size(); i++){
2426  AliESDtrack *negPionCandidate = fESDEvent->GetTrack(lGoodNegPionIndexPrev[i]);
2427  AliKFParticle negPionCandidateKF( *negPionCandidate->GetConstrainedParam(), 211 );
2428 
2429  for(UInt_t j = 0; j < lGoodPosPionIndexPrev.size(); j++){
2430  AliESDtrack *posPionCandidate = fESDEvent->GetTrack(lGoodPosPionIndexPrev[j]);
2431  AliKFParticle posPionCandidateKF( *posPionCandidate->GetConstrainedParam(), 211 );
2432 
2433  AliKFConversionPhoton* virtualPhoton = NULL;
2434  virtualPhoton = new AliKFConversionPhoton(negPionCandidateKF,posPionCandidateKF);
2435  AliKFVertex primaryVertexImproved(*fInputEvent->GetPrimaryVertex());
2436 // primaryVertexImproved+=*virtualPhoton;
2437  virtualPhoton->SetProductionVertex(primaryVertexImproved);
2438  virtualPhoton->SetTrackLabels( lGoodPosPionIndexPrev[j], lGoodNegPionIndexPrev[i]);
2439 
2440  Int_t labeln=0;
2441  Int_t labelp=0;
2442  Int_t motherlabelp = 0;
2443  Int_t motherlabeln = 0;
2444  TParticle *fNegativeMCParticle =NULL;
2445  TParticle *fPositiveMCParticle =NULL;
2446  if( fMCEvent ) {
2447  labeln=TMath::Abs(negPionCandidate->GetLabel());
2448  labelp=TMath::Abs(posPionCandidate->GetLabel());
2449  if(labeln>-1) fNegativeMCParticle = fMCEvent->Particle(labeln);
2450  if(labelp>-1) fPositiveMCParticle = fMCEvent->Particle(labelp);
2451  // check whether MC particles exist, else abort
2452  if (fNegativeMCParticle == NULL || fPositiveMCParticle == NULL) return;
2453 
2454  motherlabeln = fNegativeMCParticle->GetMother(0);
2455  motherlabelp = fPositiveMCParticle->GetMother(0);
2456  virtualPhoton->SetMCLabelPositive(labelp);
2457  virtualPhoton->SetMCLabelNegative(labeln);
2458 
2459  }
2460 
2461  AliAODConversionPhoton *vParticle = new AliAODConversionPhoton(virtualPhoton); //To apply mass 2 pion mass cut
2462  if(!fDoLightOutput){
2463  if (fMCEvent &&(fDoMesonQA>0)){
2464  if (fPositiveMCParticle && fNegativeMCParticle ) {
2465  if (((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->DoMassCut()){
2466  if (vParticle->GetMass() < ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetMassCut()){
2467  if(TMath::Abs(fNegativeMCParticle->GetPdgCode())==211 && TMath::Abs(fPositiveMCParticle->GetPdgCode())==211){ // Pions ...
2468  fHistoTruePionPionInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt());
2469  if (motherlabeln == motherlabelp){
2470  fHistoTruePionPionFromSameMotherInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt());
2471  if( IsEtaPiPlPiMiPiZeroDaughter(labeln) ) { //|| IsOmegaPiPlPiMiPiZeroDaughter(labeln)
2472  fHistoTruePionPionFromEtaInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt());
2473  }
2474  if( IsOmegaPiPlPiMiPiZeroDaughter(labeln) ) { //||
2475  fHistoTruePionPionFromOmegaInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt());
2476  }
2477  }
2478  }
2479  }
2480  } else {
2481  if(TMath::Abs(fNegativeMCParticle->GetPdgCode())==211 && TMath::Abs(fPositiveMCParticle->GetPdgCode())==211){ // Pions ...
2482  fHistoTruePionPionInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt());
2483  if (motherlabeln == motherlabelp){
2484  fHistoTruePionPionFromSameMotherInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt());
2485  if( IsEtaPiPlPiMiPiZeroDaughter(labeln) ) { //|| IsOmegaPiPlPiMiPiZeroDaughter(labeln)
2486  fHistoTruePionPionFromEtaInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt());
2487  }
2488  if( IsOmegaPiPlPiMiPiZeroDaughter(labeln) ) { //||
2489  fHistoTruePionPionFromOmegaInvMassPt[fiCut]->Fill(vParticle->GetMass(),vParticle->Pt());
2490  }
2491  }
2492  }
2493  }
2494  }
2495  }
2496  }
2497 
2498  if (((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->DoMassCut()){
2499  if (vParticle->GetMass() < ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetMassCut()){
2500  fGoodVirtualParticles->Add( vParticle );
2501  if(!fDoLightOutput){
2502  fHistoPionPionInvMassPt[fiCut]->Fill( vParticle->GetMass(),vParticle->Pt());
2503  }
2504  }else{
2505  delete vParticle;
2506  vParticle=0x0;
2507  }
2508  } else {
2509  fGoodVirtualParticles->Add( vParticle );
2510  if(!fDoLightOutput){
2511  fHistoPionPionInvMassPt[fiCut]->Fill( vParticle->GetMass(),vParticle->Pt());
2512  }
2513  }
2514 
2515  Double_t clsToFPos = -1.0;
2516  Double_t clsToFNeg = -1.0;
2517 
2518  Float_t dcaToVertexXYPos = -1.0;
2519  Float_t dcaToVertexZPos = -1.0;
2520  Float_t dcaToVertexXYNeg = -1.0;
2521  Float_t dcaToVertexZNeg = -1.0;
2522 
2523  if ( fDoMesonQA>0 ) {
2524  clsToFPos = ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetNFindableClustersTPC(posPionCandidate);
2525  clsToFNeg = ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetNFindableClustersTPC(negPionCandidate);
2526 
2527  Float_t bPos[2];
2528  Float_t bCovPos[3];
2529  posPionCandidate->GetImpactParameters(bPos,bCovPos);
2530  if (bCovPos[0]<=0 || bCovPos[2]<=0) {
2531  AliDebug(1, "Estimated b resolution lower or equal zero!");
2532  bCovPos[0]=0; bCovPos[2]=0;
2533  }
2534 
2535  Float_t bNeg[2];
2536  Float_t bCovNeg[3];
2537  posPionCandidate->GetImpactParameters(bNeg,bCovNeg);
2538  if (bCovNeg[0]<=0 || bCovNeg[2]<=0) {
2539  AliDebug(1, "Estimated b resolution lower or equal zero!");
2540  bCovNeg[0]=0; bCovNeg[2]=0;
2541  }
2542 
2543  dcaToVertexXYPos = bPos[0];
2544  dcaToVertexZPos = bPos[1];
2545  dcaToVertexXYNeg = bNeg[0];
2546  dcaToVertexZNeg = bNeg[1];
2547 
2548  if(!fDoLightOutput){
2549  fHistoNegPionEta[fiCut]->Fill( negPionCandidate->Eta() );
2550  fHistoPosPionEta[fiCut]->Fill( posPionCandidate->Eta() );
2551 
2552  fHistoNegPionClsTPC[fiCut]->Fill(clsToFNeg,negPionCandidate->Pt());
2553  fHistoPosPionClsTPC[fiCut]->Fill(clsToFPos,posPionCandidate->Pt());
2554 
2555  fHistoPionDCAxy[fiCut]->Fill( dcaToVertexXYNeg, negPionCandidate->Pt() );
2556  fHistoPionDCAz[fiCut]->Fill( dcaToVertexZNeg, negPionCandidate->Pt() );
2557  fHistoPionDCAxy[fiCut]->Fill( dcaToVertexXYPos, posPionCandidate->Pt() );
2558  fHistoPionDCAz[fiCut]->Fill( dcaToVertexZPos, posPionCandidate->Pt() );
2559 
2560  fHistoPionTPCdEdxNSigma[fiCut]->Fill( posPionCandidate->P(),((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetPIDResponse()->NumberOfSigmasTPC(posPionCandidate, AliPID::kPion) );
2561  fHistoPionTPCdEdxNSigma[fiCut]->Fill( negPionCandidate->P(),((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetPIDResponse()->NumberOfSigmasTPC(negPionCandidate, AliPID::kPion) );
2562 
2563  fHistoPionTPCdEdx[fiCut]->Fill( posPionCandidate->P(), TMath::Abs(posPionCandidate->GetTPCsignal()));
2564  fHistoPionTPCdEdx[fiCut]->Fill( negPionCandidate->P(), TMath::Abs(negPionCandidate->GetTPCsignal()));
2565  }
2566  }
2567 
2568  delete virtualPhoton;
2569  virtualPhoton=NULL;
2570  }
2571  }
2572 }
2573 
2574 //_____________________________________________________________________________
2576 
2577  // Loop over all primary MC particle
2578  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2579  Double_t mcProdVtxX = primVtxMC->GetX();
2580  Double_t mcProdVtxY = primVtxMC->GetY();
2581  Double_t mcProdVtxZ = primVtxMC->GetZ();
2582 
2583  for(Int_t i = 0; i < fMCEvent->GetNumberOfTracks(); i++) {
2584  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
2585 
2586  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
2587  if (!particle) continue;
2588 
2589  Int_t isMCFromMBHeader = -1;
2590  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
2591  isMCFromMBHeader
2592  = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
2593  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
2594  }
2595 
2596  if(!fDoLightOutput){
2597  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent,fInputEvent)){
2598  // find MC photons
2599  if (fNeutralPionMode < 2){
2600  if(((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kFALSE)){
2601  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
2602  if(particle->GetMother(0) >-1){
2603  if (fMCEvent->Particle(particle->GetMother(0))->GetPdgCode() ==111){
2604  if (fMCEvent->Particle(particle->GetMother(0))->GetMother(0) > -1){
2605  if ( fMCEvent->Particle((fMCEvent->Particle(particle->GetMother(0)))->GetMother(0))->GetPdgCode() == 221 ||
2606  fMCEvent->Particle((fMCEvent->Particle(particle->GetMother(0)))->GetMother(0))->GetPdgCode() == 223 ){
2607  if ( fMCEvent->Particle(particle->GetMother(0))->GetNDaughters()==3 )
2608  fHistoMCGammaFromNeutralMesonPt[fiCut]->Fill(particle->Pt()); // All photons from eta or omega via pi0
2609  }
2610  }
2611  }
2612  }
2613  }
2614  } else if (fNeutralPionMode == 2){
2615  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(particle,fMCEvent)){
2616  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt()); // All MC Gamma
2617  if(particle->GetMother(0) >-1){
2618  if (fMCEvent->Particle(particle->GetMother(0))->GetPdgCode() ==111){
2619  if (fMCEvent->Particle(particle->GetMother(0))->GetMother(0) > -1){
2620  if ( fMCEvent->Particle((fMCEvent->Particle(particle->GetMother(0)))->GetMother(0))->GetPdgCode() == 221 ||
2621  fMCEvent->Particle((fMCEvent->Particle(particle->GetMother(0)))->GetMother(0))->GetPdgCode() == 223 ){
2622  if ( fMCEvent->Particle(particle->GetMother(0))->GetNDaughters()==3 )
2623  fHistoMCGammaFromNeutralMesonPt[fiCut]->Fill(particle->Pt()); // All photons from eta or omega via pi0
2624  }
2625  }
2626  }
2627  }
2628  }
2629  }
2630  if (fNeutralPionMode < 2){
2631  if (((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kTRUE)){
2632  fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt());
2633  } // Converted MC Gamma
2634  }
2635  if(((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->PionIsSelectedMC(i,fMCEvent)){
2636  if( particle->GetPdgCode() == 211){
2637  fHistoMCAllPosPionsPt[fiCut]->Fill(particle->Pt()); // All pos pions
2638  if(particle->GetMother(0) >-1){
2639  if (fMCEvent->Particle(particle->GetMother(0))->GetPdgCode() ==221 || fMCEvent->Particle(particle->GetMother(0))->GetPdgCode() ==223)
2640  fHistoMCPosPionsFromNeutralMesonPt[fiCut]->Fill(particle->Pt()); // All pos from eta or omega
2641  }
2642  }
2643  if( particle->GetPdgCode() == -211){
2644  fHistoMCAllNegPionsPt[fiCut]->Fill(particle->Pt()); // All neg pions
2645  if(particle->GetMother(0) >-1){
2646  if (fMCEvent->Particle(particle->GetMother(0))->GetPdgCode() ==221 || fMCEvent->Particle(particle->GetMother(0))->GetPdgCode() ==223 )
2647  fHistoMCNegPionsFromNeutralMesonPt[fiCut]->Fill(particle->Pt()); // All pos from eta or omega
2648  }
2649  }
2650  }
2651  }
2652  }
2653 
2654  // \eta -> pi+ pi- \gamma
2655  Int_t labelNeutPion = -1;
2656  Int_t labelNegPion = -1;
2657  Int_t labelPosPion = -1;
2658 
2659  if( ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedMCPiPlPiMiPiZero(particle,fMCEvent,labelNegPion,labelPosPion,labelNeutPion,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2660  Float_t weighted= 1;
2661  if( ((AliPrimaryPionCuts*) fPionCutArray->At(fiCut))->DoWeights() ) {
2662  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent,fInputEvent)){
2663  if (particle->Pt()>0.005){
2664  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent,fInputEvent);
2665  }
2666  }
2667  }
2668  if(particle->GetPdgCode() == 221)fHistoMCEtaPiPlPiMiPiZeroPt[fiCut]->Fill(particle->Pt(), weighted); // All MC Eta in respective decay channel
2669  if(particle->GetPdgCode() == 223)fHistoMCOmegaPiPlPiMiPiZeroPt[fiCut]->Fill(particle->Pt(), weighted); // All MC Omega in respective decay channel
2670 
2671  if(labelNeutPion>-1){
2672  TParticle *neutPion = fMCEvent->Particle(labelNeutPion);
2673  if(neutPion->GetDaughter(0)>-1 && neutPion->GetDaughter(1)>-1){
2674  TParticle *gamma1 = fMCEvent->Particle(neutPion->GetDaughter(0));
2675  TParticle *gamma2 = fMCEvent->Particle(neutPion->GetDaughter(1));
2676  Bool_t kDaughter0IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, neutPion->GetDaughter(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2677  Bool_t kDaughter1IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, neutPion->GetDaughter(1), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2678  Bool_t kNegPionIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, labelNegPion, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2679  Bool_t kPosPionIsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, labelPosPion, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2680 
2681  if (fNeutralPionMode < 2){
2682  if( kDaughter0IsPrim && kDaughter1IsPrim && kNegPionIsPrim && kPosPionIsPrim &&
2683  ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelectedMC(gamma1,fMCEvent,kFALSE) && // test first daugther of pi0
2684  ((AliConversionPhotonCuts*)fGammaCutArray->At(fiCut))->PhotonIsSelectedMC(gamma2,fMCEvent,kFALSE) && // test second daughter of pi0
2685  ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->PionIsSelectedMC(labelNegPion,fMCEvent) && // test negative pion
2686  ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->PionIsSelectedMC(labelPosPion,fMCEvent) // test positive pion
2687  ) {
2688  if(particle->GetPdgCode() == 221) fHistoMCEtaPiPlPiMiPiZeroInAccPt[fiCut]->Fill(particle->Pt(), weighted ); // MC Eta pi+ pi- pi0 with gamma's and e+e- in acc
2689  if(particle->GetPdgCode() == 223) fHistoMCOmegaPiPlPiMiPiZeroInAccPt[fiCut]->Fill(particle->Pt(), weighted ); // MC Omega pi+ pi- pi0 with gamma's and e+e- in acc
2690  }
2691  } else if (fNeutralPionMode == 2){
2692  if( kDaughter0IsPrim && kDaughter1IsPrim && kNegPionIsPrim && kPosPionIsPrim &&
2693  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma1,fMCEvent) && // test first daugther of pi0
2694  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma2,fMCEvent) && // test second daughter of pi0
2695  ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->PionIsSelectedMC(labelNegPion,fMCEvent) && // test negative pion
2696  ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->PionIsSelectedMC(labelPosPion,fMCEvent) // test positive pion
2697  ) {
2698  if(particle->GetPdgCode() == 221) fHistoMCEtaPiPlPiMiPiZeroInAccPt[fiCut]->Fill(particle->Pt(), weighted ); // MC Eta pi+ pi- pi0 with gamma's and e+e- in acc
2699  if(particle->GetPdgCode() == 223) fHistoMCOmegaPiPlPiMiPiZeroInAccPt[fiCut]->Fill(particle->Pt(), weighted ); // MC Omega pi+ pi- pi0 with gamma's and e+e- in acc
2700  }
2701  }
2702  }
2703  }
2704  }
2705  }
2706  }
2707 }
2708 
2709 
2710 //________________________________________________________________________
2712 
2713  // Conversion Gammas
2714  if( fNeutralPionCandidates->GetEntries() > 0 && fGoodVirtualParticles->GetEntries() > 0 ){
2715  for(Int_t mesonIndex=0; mesonIndex<fNeutralPionCandidates->GetEntries(); mesonIndex++){
2716  AliAODConversionMother *neutralPion=dynamic_cast<AliAODConversionMother*>(fNeutralPionCandidates->At(mesonIndex));
2717  if (neutralPion==NULL) continue;
2718 
2719  for(Int_t virtualParticleIndex=0;virtualParticleIndex<fGoodVirtualParticles->GetEntries();virtualParticleIndex++){
2720 
2721  AliAODConversionPhoton *vParticle=dynamic_cast<AliAODConversionPhoton*>(fGoodVirtualParticles->At(virtualParticleIndex));
2722  if (vParticle==NULL) continue;
2723  //Check for same Electron ID
2724 
2725  AliAODConversionMother *mesoncand = new AliAODConversionMother(neutralPion,vParticle);
2726  mesoncand->SetLabels(mesonIndex,virtualParticleIndex);
2727  if( ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(mesoncand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2728 
2729  AliESDtrack *negPionCandidatetmp = (AliESDtrack*) fESDEvent->GetTrack(vParticle->GetTrackLabel(1));
2730  if(negPionCandidatetmp==NULL){ delete mesoncand; continue;}
2731  AliAODConversionMother *NegPiontmp = new AliAODConversionMother();
2732  NegPiontmp->SetPxPyPzE(negPionCandidatetmp->Px(), negPionCandidatetmp->Py(), negPionCandidatetmp->Pz(), negPionCandidatetmp->E());
2733 
2734  AliESDtrack *posPionCandidatetmp = (AliESDtrack*) fESDEvent->GetTrack(vParticle->GetTrackLabel(0));
2735  if(posPionCandidatetmp==NULL){ delete NegPiontmp; delete mesoncand; continue;}
2736  AliAODConversionMother *PosPiontmp = new AliAODConversionMother();
2737  PosPiontmp->SetPxPyPzE(posPionCandidatetmp->Px(), posPionCandidatetmp->Py(), posPionCandidatetmp->Pz(), posPionCandidatetmp->E());
2738 
2739  if(KinematicCut(NegPiontmp, PosPiontmp, neutralPion, mesoncand)){
2740  if(!fDoLightOutput){
2741  fHistoAngleOmegaPiZero[fiCut]->Fill(mesoncand->Pt(),neutralPion->Angle(mesoncand->Vect()));
2742  fHistoAngleOmegaPiPl[fiCut]->Fill(mesoncand->Pt(),PosPiontmp->Angle(mesoncand->Vect()));
2743  fHistoAngleOmegaPiMi[fiCut]->Fill(mesoncand->Pt(),NegPiontmp->Angle(mesoncand->Vect()));
2744  fHistoAnglePiZeroPiMi[fiCut]->Fill(mesoncand->Pt(),NegPiontmp->Angle(neutralPion->Vect()));
2745  fHistoAnglePiPlPiMi[fiCut]->Fill(mesoncand->Pt(),NegPiontmp->Angle(PosPiontmp->Vect()));
2746  fHistoAnglePiPlPiZero[fiCut]->Fill(mesoncand->Pt(),PosPiontmp->Angle(neutralPion->Vect()));
2747  fHistoAngleOmegaPiPlPiMi[fiCut]->Fill(mesoncand->Pt(),vParticle->Angle(mesoncand->Vect()));
2748  fHistoAngleSum[fiCut]->Fill(mesoncand->Pt(),((PosPiontmp->Angle(mesoncand->Vect()))+(NegPiontmp->Angle(PosPiontmp->Vect()))+(PosPiontmp->Angle(neutralPion->Vect()))));
2749 
2750  //Double_t sparesFill[4] = {mesoncand->M(),mesoncand->Pt(),(Double_t)zbin,(Double_t)mbin};
2751  //fTHnSparseMotherInvMassPtZM[fiCut]->Fill(sparesFill,1);
2752  }
2753 
2754  // Subtract mass of used pi0 candidate and then add PDG mass to get to right range again
2755  fHistoMotherInvMassSubPi0[fiCut]->Fill(mesoncand->M()-(neutralPion->M()-fPDGMassPi0),mesoncand->Pt());
2756 
2757  // Fix Pz of pi0 candidate to match pi0 PDG mass
2759  Pi0tmp->SetPxPyPzE(neutralPion->Px(), neutralPion->Py(), neutralPion->Pz(), neutralPion->Energy());
2760  FixPzToMatchPDGInvMassPi0(Pi0tmp);
2761  AliAODConversionMother *mesontmp = new AliAODConversionMother(Pi0tmp,vParticle);
2762  fHistoMotherInvMassFixedPzPi0[fiCut]->Fill(mesontmp->M(),mesontmp->Pt());
2763  delete Pi0tmp;
2764  delete mesontmp;
2765  fHistoMotherInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt());
2766  if(fMCEvent){
2767  ProcessTrueMesonCandidates(mesoncand,neutralPion,vParticle);
2768  }
2769  }else{
2770  if(!fDoLightOutput){
2771  fHistoMotherInvMassPtRejectedKinematic[fiCut]->Fill(mesoncand->M(),mesoncand->Pt());
2772  }
2773  }
2774  if(!fDoLightOutput){
2775  delete NegPiontmp;
2776  delete PosPiontmp;
2777  }
2778  }
2779  delete mesoncand;
2780  mesoncand=0x0;
2781  }
2782  }
2783  }
2784 }
2785 //________________________________________________________________________
2787 
2788  /* Event mixing histo explanation
2789  *
2790  * fHistoBackInvMassPtGroup1 => pi+ and pi- from same event
2791  * fHistoBackInvMassPtGroup2 => pi+ and pi0 from same event
2792  * fHistoBackInvMassPtGroup3 => pi- and pi0 from same event
2793  * fHistoBackInvMassPtGroup4 => no pions from same event
2794  */
2795 
2796  // Get multiplicity and zbin from fBGHandler
2797  Int_t zbin= fBGHandlerPiMi[fiCut]->GetZBinIndex(fESDEvent->GetPrimaryVertex()->GetZ());
2798  Int_t mbin = 0;
2799 
2800  // Multiplicity can be determined either by number of cluster candidates or track mulitiplicity
2801  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
2803  } else {
2805  else mbin = fBGHandlerPiMi[fiCut]->GetMultiplicityBinIndex(fClusterCandidates->GetEntries());
2806  }
2807 
2810 
2811  // Get N of Pi0 according to chosen mix mode
2812  Int_t NPi0Candidates = 0;
2813  if( (((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseSidebandMixing()) || (((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseSidebandMixingBothSides())){
2814  NPi0Candidates = fNeutralPionSidebandCandidates->GetEntries();
2815  }else{
2816  NPi0Candidates = fNeutralPionCandidates->GetEntries();
2817  }
2818  // Begin loop over all Pi0 candidates
2819  for(Int_t iCurrentPi0=0; iCurrentPi0<NPi0Candidates; iCurrentPi0++){
2820  AliAODConversionMother* EventPiZeroGoodMeson;
2821  if( (((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseSidebandMixing()) || (((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseSidebandMixingBothSides())){
2822  EventPiZeroGoodMeson = (AliAODConversionMother*)(fNeutralPionSidebandCandidates->At(iCurrentPi0));
2823  }else{
2824  EventPiZeroGoodMeson = (AliAODConversionMother*)(fNeutralPionCandidates->At(iCurrentPi0));
2825  }
2826 
2827 if(!(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseLikeSignMixing())){
2828  // Begin loop over BG events for Pi+
2829  for(Int_t nEventsInBGPl=0;nEventsInBGPl<fBGHandlerPiPl[fiCut]->GetNBGEvents();nEventsInBGPl++){
2830 
2831  // Store all Pi+ of current event in right binning in vector
2832  AliGammaConversionMotherAODVector *EventPiPlMeson = fBGHandlerPiPl[fiCut]->GetBGGoodMesons(zbin,mbin,nEventsInBGPl);
2833 
2834  // Begin loop over BG events for Pi-
2835  for(Int_t nEventsInBGMi=0;nEventsInBGMi<fBGHandlerPiMi[fiCut]->GetNBGEvents();nEventsInBGMi++){
2836  AliGammaConversionMotherAODVector *EventPiMiMeson = fBGHandlerPiMi[fiCut]->GetBGGoodMesons(zbin,mbin,nEventsInBGMi);
2837 
2838  // If one of the events isn't found skip to next one
2839  if((EventPiMiMeson && EventPiPlMeson) == kFALSE) continue;
2840 
2841  // Determine Background event vertex
2842  if(fMoveParticleAccordingToVertex == kTRUE){
2843  bgEventVertexPl = fBGHandlerPiPl[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBGPl);
2844  bgEventVertexMi = fBGHandlerPiMi[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBGMi);
2845  }
2846  // Loop over all Pi+
2847  for(UInt_t iCurrentPiPl = 0; iCurrentPiPl<EventPiPlMeson->size();iCurrentPiPl++){
2848  AliAODConversionMother EventPiPlGoodMeson= (AliAODConversionMother)(*(EventPiPlMeson->at(iCurrentPiPl)));
2849 
2850  // Move Vertex
2851  if(fMoveParticleAccordingToVertex == kTRUE){
2852  MoveParticleAccordingToVertex(&EventPiPlGoodMeson, bgEventVertexPl);
2853  }
2854 
2855  // Combine Pi+ and Pi0
2856  AliAODConversionMother *PiPlPiZeroBackgroundCandidate = new AliAODConversionMother(EventPiZeroGoodMeson, &EventPiPlGoodMeson);
2857 
2858  for(UInt_t iCurrentPiMi = 0; iCurrentPiMi<EventPiMiMeson->size();iCurrentPiMi++){
2859  AliAODConversionMother EventPiMiGoodMeson = (AliAODConversionMother)(*(EventPiMiMeson->at(iCurrentPiMi)));
2860 
2861  // Move Vertex
2862  if(fMoveParticleAccordingToVertex == kTRUE){
2863  MoveParticleAccordingToVertex(&EventPiMiGoodMeson, bgEventVertexMi);
2864  }
2865 
2866  // Mass cut (pi+pi-)
2867  if (((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->DoMassCut()){
2868  AliAODConversionMother *backPiPlPiMiCandidate = new AliAODConversionMother(&EventPiPlGoodMeson,&EventPiMiGoodMeson);
2869  if (backPiPlPiMiCandidate->M() >= ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetMassCut()){
2870  delete backPiPlPiMiCandidate;
2871  backPiPlPiMiCandidate = 0x0;
2872  continue;
2873  }
2874  delete backPiPlPiMiCandidate;
2875  backPiPlPiMiCandidate = 0x0;
2876  }
2877 
2878  // Create (final) Candidate
2879  AliAODConversionMother *PiPlPiMiPiZeroBackgroundCandidate = new AliAODConversionMother(PiPlPiZeroBackgroundCandidate,&EventPiMiGoodMeson);
2880 
2881  // Check if candidate survives meson cut
2882  if( ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(PiPlPiMiPiZeroBackgroundCandidate,kFALSE, ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2883 
2884  // Check if candidate survives kinematic cut
2885  if(KinematicCut(&EventPiMiGoodMeson, &EventPiPlGoodMeson,EventPiZeroGoodMeson,PiPlPiMiPiZeroBackgroundCandidate)){
2886  // Create temporary mesons to be able to fix pz
2888  Pi0tmp->SetPxPyPzE(EventPiZeroGoodMeson->Px(), EventPiZeroGoodMeson->Py(), EventPiZeroGoodMeson->Pz(), EventPiZeroGoodMeson->Energy());
2889  FixPzToMatchPDGInvMassPi0(Pi0tmp);
2890  AliAODConversionMother *PiMiPiZerotmp = new AliAODConversionMother(&EventPiMiGoodMeson,Pi0tmp);
2891  AliAODConversionMother *PiPlPiMiPiZerotmp = new AliAODConversionMother(&EventPiPlGoodMeson,PiMiPiZerotmp);
2892 
2893  if (nEventsInBGMi != nEventsInBGPl){
2894  // Pi+ and Pi- don't come from the same event (but different than pi0 event)
2895  // Fill histograms
2896  fHistoBackInvMassPtGroup4[fiCut]->Fill(PiPlPiMiPiZeroBackgroundCandidate->M(),PiPlPiMiPiZeroBackgroundCandidate->Pt());
2897  fHistoBackInvMassPtGroup4SubPi0[fiCut]->Fill(PiPlPiMiPiZeroBackgroundCandidate->M()-(EventPiZeroGoodMeson->M()-fPDGMassPi0),PiPlPiMiPiZeroBackgroundCandidate->Pt());
2898  fHistoBackInvMassPtGroup4FixedPzPi0[fiCut]->Fill(PiPlPiMiPiZerotmp->M(),PiPlPiMiPiZerotmp->Pt());
2899 
2900  } else if(nEventsInBGMi==nEventsInBGPl){
2901  // Pi+ and Pi- come from the same event (but different than pi0 event)
2902  fHistoBackInvMassPtGroup1[fiCut]->Fill(PiPlPiMiPiZeroBackgroundCandidate->M(),PiPlPiMiPiZeroBackgroundCandidate->Pt());
2903  fHistoBackInvMassPtGroup1SubPi0[fiCut]->Fill(PiPlPiMiPiZeroBackgroundCandidate->M()-(EventPiZeroGoodMeson->M()-fPDGMassPi0),PiPlPiMiPiZeroBackgroundCandidate->Pt());
2904  fHistoBackInvMassPtGroup1FixedPzPi0[fiCut]->Fill(PiPlPiMiPiZerotmp->M(),PiPlPiMiPiZerotmp->Pt());
2905  }
2906 
2907  delete Pi0tmp;
2908  delete PiMiPiZerotmp;
2909  delete PiPlPiMiPiZerotmp;
2910 
2911  delete PiPlPiMiPiZeroBackgroundCandidate;
2912  PiPlPiMiPiZeroBackgroundCandidate = 0x0;
2913  }
2914  }
2915  if(PiPlPiMiPiZeroBackgroundCandidate!=0x0){
2916  delete PiPlPiMiPiZeroBackgroundCandidate;
2917  PiPlPiMiPiZeroBackgroundCandidate = 0x0;
2918  }
2919  } // end pi- loop
2920  if(PiPlPiZeroBackgroundCandidate!=0x0){
2921  delete PiPlPiZeroBackgroundCandidate;
2922  PiPlPiZeroBackgroundCandidate = 0x0;
2923  }
2924  } // end pi+ loop
2925  } // end loop over all pi- event
2926  } // end loop over pi+ events
2927 
2928  // Loop over all pi+ events(from Handler)
2929  for(Int_t nEventsInBGPl=0;nEventsInBGPl<fBGHandlerPiPl[fiCut]->GetNBGEvents();nEventsInBGPl++){
2930  // Store all Pi+ of current event in right binning in vector
2931  AliGammaConversionMotherAODVector *EventPiPlMeson = fBGHandlerPiPl[fiCut]->GetBGGoodMesons(zbin,mbin,nEventsInBGPl);
2932 
2933  // Determine Vertex
2934  if(fMoveParticleAccordingToVertex == kTRUE){
2935  bgEventVertexPl = fBGHandlerPiPl[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBGPl);
2936  }
2937  // Begin loop over all pi+ in ecent
2938  for(UInt_t iCurrentPiPl = 0; iCurrentPiPl<EventPiPlMeson->size();iCurrentPiPl++){
2939  AliAODConversionMother EventPiPlGoodMeson= (AliAODConversionMother)(*(EventPiPlMeson->at(iCurrentPiPl)));
2940 
2941  // Move vertex
2942  if(fMoveParticleAccordingToVertex == kTRUE){
2943  MoveParticleAccordingToVertex(&EventPiPlGoodMeson, bgEventVertexPl);
2944  }
2945  // Combine Pi+ and Pi0
2946  AliAODConversionMother *PiPlPiZeroBackgroundCandidate = new AliAODConversionMother(EventPiZeroGoodMeson, &EventPiPlGoodMeson);
2947  // Loop over all pi- (from current event)
2948  for(Int_t iCurrentPiMi=0; iCurrentPiMi<fNegPionCandidates->GetEntries(); iCurrentPiMi++){
2949  AliAODConversionMother EventPiNegGoodMeson = *(AliAODConversionMother*)(fNegPionCandidates->At(iCurrentPiMi));
2950 
2951  // Mass cut on pi+pi-
2952  if (((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->DoMassCut()){
2953  AliAODConversionMother *backPiPlPiMiCandidate = new AliAODConversionMother(&EventPiPlGoodMeson,&EventPiNegGoodMeson);
2954  if (backPiPlPiMiCandidate->M() >= ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetMassCut()){
2955  delete backPiPlPiMiCandidate;
2956  backPiPlPiMiCandidate = 0x0;
2957  continue;
2958  }
2959  delete backPiPlPiMiCandidate;
2960  backPiPlPiMiCandidate = 0x0;
2961  }
2962 
2963  // Create (final) Candidate
2964  AliAODConversionMother *PiPlPiMiPiZeroBackgroundCandidate = new AliAODConversionMother(PiPlPiZeroBackgroundCandidate,&EventPiNegGoodMeson);
2965 
2966  // Check if candidate survives meson cut
2967  if( ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(PiPlPiMiPiZeroBackgroundCandidate,kFALSE, ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2968 
2969  // Check if candidate survives kinematic cut
2970  if(KinematicCut(&EventPiNegGoodMeson, &EventPiPlGoodMeson, EventPiZeroGoodMeson,PiPlPiMiPiZeroBackgroundCandidate)){
2971 
2972  // Create temporary mesons to be able to fix pz
2974  Pi0tmp->SetPxPyPzE(EventPiZeroGoodMeson->Px(), EventPiZeroGoodMeson->Py(), EventPiZeroGoodMeson->Pz(), EventPiZeroGoodMeson->Energy());
2975  FixPzToMatchPDGInvMassPi0(Pi0tmp);
2976  AliAODConversionMother *PiMiPiZerotmp = new AliAODConversionMother(&EventPiNegGoodMeson,Pi0tmp);
2977  AliAODConversionMother *PiPlPiMiPiZerotmp = new AliAODConversionMother(&EventPiPlGoodMeson,PiMiPiZerotmp);
2978 
2979  // Fill histograms (pi- and pi0 from same event)
2980  fHistoBackInvMassPtGroup3[fiCut]->Fill(PiPlPiMiPiZeroBackgroundCandidate->M(),PiPlPiMiPiZeroBackgroundCandidate->Pt());
2981  fHistoBackInvMassPtGroup3SubPi0[fiCut]->Fill(PiPlPiMiPiZeroBackgroundCandidate->M()-(EventPiZeroGoodMeson->M()-fPDGMassPi0),PiPlPiMiPiZeroBackgroundCandidate->Pt());
2982  fHistoBackInvMassPtGroup3FixedPzPi0[fiCut]->Fill(PiPlPiMiPiZerotmp->M(),PiPlPiMiPiZerotmp->Pt());
2983 
2984  delete Pi0tmp;
2985  delete PiMiPiZerotmp;
2986  delete PiPlPiMiPiZerotmp;
2987 
2988  delete PiPlPiMiPiZeroBackgroundCandidate;
2989  PiPlPiMiPiZeroBackgroundCandidate = 0x0;
2990  }
2991  }
2992  if(PiPlPiMiPiZeroBackgroundCandidate!=0x0){
2993  delete PiPlPiMiPiZeroBackgroundCandidate;
2994  PiPlPiMiPiZeroBackgroundCandidate = 0x0;
2995  }
2996  } // End loop pi- (from current event)
2997  if(PiPlPiZeroBackgroundCandidate!=0x0){
2998  delete PiPlPiZeroBackgroundCandidate;
2999  PiPlPiZeroBackgroundCandidate = 0x0;
3000  }
3001  } // End loop pi+
3002  } // end loop over pi+ events
3003 
3004  // Loop over all pi- events(from Handler)
3005  for(Int_t nEventsInBGMi=0;nEventsInBGMi<fBGHandlerPiPl[fiCut]->GetNBGEvents();nEventsInBGMi++){
3006  // Store all Pi- of current event in right binning in vector
3007  AliGammaConversionMotherAODVector *EventPiMiMeson = fBGHandlerPiMi[fiCut]->GetBGGoodMesons(zbin,mbin,nEventsInBGMi);
3008 
3009  // Determine vertex
3010  if(fMoveParticleAccordingToVertex == kTRUE){
3011  bgEventVertexMi = fBGHandlerPiMi[fiCut]->GetBGEventVertex(zbin,mbin,nEventsInBGMi);
3012  }
3013 
3014  // Begin loop over all pi- in event
3015  for(UInt_t iCurrentPiMi = 0; iCurrentPiMi<EventPiMiMeson->size();iCurrentPiMi++){
3016  AliAODConversionMother EventPiMiGoodMeson= (AliAODConversionMother)(*(EventPiMiMeson->at(iCurrentPiMi)));
3017 
3018  // move vertex
3019  if(fMoveParticleAccordingToVertex == kTRUE){
3020  MoveParticleAccordingToVertex(&EventPiMiGoodMeson, bgEventVertexMi);
3021  }
3022 
3023 
3024  // Combine Pi- and Pi0
3025  AliAODConversionMother *PiMiPiZeroBackgroundCandidate = new AliAODConversionMother(EventPiZeroGoodMeson, &EventPiMiGoodMeson);
3026 
3027  // Loop over all pi+ (from current event)
3028  for(Int_t iCurrentPiPl=0; iCurrentPiPl<fPosPionCandidates->GetEntries(); iCurrentPiPl++){
3029  AliAODConversionMother EventPiPlGoodMeson = *(AliAODConversionMother*)(fPosPionCandidates->At(iCurrentPiPl));
3030 
3031  // Mass cut on pi+pi-
3032  if (((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->DoMassCut()){
3033  AliAODConversionMother *backPiPlPiMiCandidate = new AliAODConversionMother(&EventPiPlGoodMeson,&EventPiMiGoodMeson);
3034  if (backPiPlPiMiCandidate->M() >= ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetMassCut()){
3035  delete backPiPlPiMiCandidate;
3036  backPiPlPiMiCandidate = 0x0;
3037  continue;
3038  }
3039  delete backPiPlPiMiCandidate;
3040  backPiPlPiMiCandidate = 0x0;
3041  }
3042 
3043  // Create (final) Candidate
3044  AliAODConversionMother *PiPlPiMiPiZeroBackgroundCandidate = new AliAODConversionMother(PiMiPiZeroBackgroundCandidate,&EventPiPlGoodMeson);
3045 
3046  // Check if candidate survives meson cut
3047  if( ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(PiMiPiZeroBackgroundCandidate,kFALSE, ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3048 
3049  // Check if candidate survives kinematic cut
3050  if(KinematicCut(&EventPiMiGoodMeson, &EventPiPlGoodMeson, EventPiZeroGoodMeson,PiPlPiMiPiZeroBackgroundCandidate)){
3051 
3052  // Create temporary mesons to be able to fix pz
3054  Pi0tmp->SetPxPyPzE(EventPiZeroGoodMeson->Px(), EventPiZeroGoodMeson->Py(), EventPiZeroGoodMeson->Pz(), EventPiZeroGoodMeson->Energy());
3055  FixPzToMatchPDGInvMassPi0(Pi0tmp);
3056  AliAODConversionMother *PiMiPiZerotmp = new AliAODConversionMother(&EventPiMiGoodMeson,Pi0tmp);
3057  AliAODConversionMother *PiPlPiMiPiZerotmp = new AliAODConversionMother(&EventPiPlGoodMeson,PiMiPiZerotmp);
3058 
3059  // Fill histograms (pi+ and pi0 from same event)
3060  fHistoBackInvMassPtGroup2[fiCut]->Fill(PiPlPiMiPiZeroBackgroundCandidate->M(),PiPlPiMiPiZeroBackgroundCandidate->Pt());
3061  fHistoBackInvMassPtGroup2SubPi0[fiCut]->Fill(PiPlPiMiPiZeroBackgroundCandidate->M()-(EventPiZeroGoodMeson->M()-fPDGMassPi0),PiPlPiMiPiZeroBackgroundCandidate->Pt());
3062  fHistoBackInvMassPtGroup2FixedPzPi0[fiCut]->Fill(PiPlPiMiPiZerotmp->M(),PiPlPiMiPiZerotmp->Pt());
3063 
3064  delete Pi0tmp;
3065  delete PiMiPiZerotmp;
3066  delete PiPlPiMiPiZerotmp;
3067 
3068  delete PiPlPiMiPiZeroBackgroundCandidate;
3069  PiPlPiMiPiZeroBackgroundCandidate = 0x0;
3070  }
3071  }
3072  if(PiPlPiMiPiZeroBackgroundCandidate!=0x0){
3073  delete PiPlPiMiPiZeroBackgroundCandidate;
3074  PiPlPiMiPiZeroBackgroundCandidate = 0x0;
3075  }
3076  } // End loop pi+ (from current event)
3077  if(PiMiPiZeroBackgroundCandidate!=0x0){
3078  delete PiMiPiZeroBackgroundCandidate;
3079  PiMiPiZeroBackgroundCandidate = 0x0;
3080  }
3081  } // End loop pi-
3082  } // end loop over pi+ events
3083  /*
3084  * LikeSign Mixing
3085  */
3086  } else if( ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseLikeSignMixing()){
3087  // Loops for Pi0Pi+Pi+ LikeSign mixing
3088  for(Int_t iCurrentPiPl=0; iCurrentPiPl<fPosPionCandidates->GetEntries(); iCurrentPiPl++){
3089 
3090  AliAODConversionMother EventPiPlGoodMeson = *(AliAODConversionMother*)(fPosPionCandidates->At(iCurrentPiPl));
3091 
3092  for(Int_t iCurrentPiPl2=0; iCurrentPiPl2<fPosPionCandidates->GetEntries(); iCurrentPiPl2++){
3093 
3094  if(iCurrentPiPl!=iCurrentPiPl2){ // dont mix same particle
3095  AliAODConversionMother EventPiPlGoodMeson2 = *(AliAODConversionMother*)(fPosPionCandidates->At(iCurrentPiPl2));
3096 
3097  // Combine Pi+ and Pi0
3098  AliAODConversionMother *PiPlPiZeroBackgroundCandidate = new AliAODConversionMother(&EventPiPlGoodMeson, EventPiZeroGoodMeson);
3099 
3100  // Mass cut on pi+pi+
3101  if (((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->DoMassCut()){
3102  AliAODConversionMother *backPiPlPiPlCandidate = new AliAODConversionMother(&EventPiPlGoodMeson,&EventPiPlGoodMeson2);
3103  if (backPiPlPiPlCandidate->M() >= ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetMassCut()){
3104  delete backPiPlPiPlCandidate;
3105  backPiPlPiPlCandidate = 0x0;
3106  continue;
3107  }
3108  delete backPiPlPiPlCandidate;
3109  backPiPlPiPlCandidate = 0x0;
3110  }
3111 
3112  // Create (final) Candidate
3113  AliAODConversionMother *PiPlPiPlPiZeroBackgroundCandidate = new AliAODConversionMother(PiPlPiZeroBackgroundCandidate, &EventPiPlGoodMeson2);
3114 
3115  // Check if candidate survives meson cut
3116  if( ((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(PiPlPiZeroBackgroundCandidate,kFALSE, ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3117 
3118  // Check if candidate survives kinematic cut
3119  if(KinematicCut(&EventPiPlGoodMeson, &EventPiPlGoodMeson2, EventPiZeroGoodMeson,PiPlPiPlPiZeroBackgroundCandidate)){
3120 
3121  // Create temporary mesons to be able to fix pz
3123  Pi0tmp->SetPxPyPzE(EventPiZeroGoodMeson->Px(), EventPiZeroGoodMeson->Py(), EventPiZeroGoodMeson->Pz(), EventPiZeroGoodMeson->Energy());
3124  FixPzToMatchPDGInvMassPi0(Pi0tmp);
3125  AliAODConversionMother *PiPlPiZerotmp = new AliAODConversionMother(&EventPiPlGoodMeson,Pi0tmp);
3126  AliAODConversionMother *PiPlPiPlPiZerotmp = new AliAODConversionMother(&EventPiPlGoodMeson2,PiPlPiZerotmp);
3127 
3128  // Fill histograms (likesign)
3129  fHistoMotherLikeSignBackInvMassPt[fiCut]->Fill(PiPlPiPlPiZeroBackgroundCandidate->M(),PiPlPiPlPiZeroBackgroundCandidate->Pt());
3130  fHistoMotherLikeSignBackInvMassSubPi0Pt[fiCut]->Fill(PiPlPiPlPiZeroBackgroundCandidate->M()-(EventPiZeroGoodMeson->M()-fPDGMassPi0),PiPlPiPlPiZeroBackgroundCandidate->Pt());
3131  fHistoMotherLikeSignBackInvMassFixedPzPi0Pt[fiCut]->Fill(PiPlPiPlPiZerotmp->M(),PiPlPiPlPiZerotmp->Pt());
3132 
3133  delete Pi0tmp;
3134  delete PiPlPiZerotmp;
3135  delete PiPlPiPlPiZerotmp;
3136 
3137  delete PiPlPiPlPiZeroBackgroundCandidate;
3138  PiPlPiPlPiZeroBackgroundCandidate = 0x0;
3139  }
3140  }
3141 
3142 
3143  }
3144  } // end of iCurrentPiPl2
3145  }// end of iCurrenPiPl
3146 
3147  // Loops for Pi0Pi-Pi- LikeSign mixing
3148  for(Int_t iCurrentPiMi=0; iCurrentPiMi<fNegPionCandidates->GetEntries(); iCurrentPiMi++){
3149 
3150  AliAODConversionMother EventPiMiGoodMeson = *(AliAODConversionMother*)(fNegPionCandidates->At(iCurrentPiMi));
3151 
3152  for(Int_t iCurrentPiMi2=0; iCurrentPiMi2<fNegPionCandidates->GetEntries(); iCurrentPiMi2++){
3153 
3154  if(iCurrentPiMi!=iCurrentPiMi2){ // dont mix same particle
3155  AliAODConversionMother EventPiMiGoodMeson2 = *(AliAODConversionMother*)(fNegPionCandidates->At(iCurrentPiMi2));
3156 
3157  // Combine Pi- and Pi0
3158  AliAODConversionMother *PiMiPiZeroBackgroundCandidate = new AliAODConversionMother(&EventPiMiGoodMeson, EventPiZeroGoodMeson);
3159 
3160  // Mass cut on pi-pi-
3161  if (((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->DoMassCut()){
3162  AliAODConversionMother *backPiMiPiMiCandidate = new AliAODConversionMother(&EventPiMiGoodMeson,&EventPiMiGoodMeson2);
3163  if (backPiMiPiMiCandidate->M() >= ((AliPrimaryPionCuts*)fPionCutArray->At(fiCut))->GetMassCut()){
3164  delete backPiMiPiMiCandidate;
3165  backPiMiPiMiCandidate = 0x0;
3166  continue;
3167  }
3168  delete backPiMiPiMiCandidate;
3169  backPiMiPiMiCandidate = 0x0;
3170  }
3171 
3172  // Create (final) Candidate
3173  AliAODConversionMother *PiMiPiMiPiZeroBackgroundCandidate = new AliAODConversionMother(PiMiPiZeroBackgroundCandidate, &EventPiMiGoodMeson2);
3174 
3175  // Check if candidate survives meson cut
3176  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelected(PiMiPiZeroBackgroundCandidate,kFALSE, ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
3177 
3178  // Check if candidate survives kinematic cut
3179  if(KinematicCut(&EventPiMiGoodMeson, &EventPiMiGoodMeson2, EventPiZeroGoodMeson,PiMiPiMiPiZeroBackgroundCandidate)){
3180 
3181  // Create temporary mesons to be able to fix pz
3183  Pi0tmp->SetPxPyPzE(EventPiZeroGoodMeson->Px(), EventPiZeroGoodMeson->Py(), EventPiZeroGoodMeson->Pz(), EventPiZeroGoodMeson->Energy());
3184  FixPzToMatchPDGInvMassPi0(Pi0tmp);
3185  AliAODConversionMother *PiMiPiZerotmp = new AliAODConversionMother(&EventPiMiGoodMeson,Pi0tmp);
3186  AliAODConversionMother *PiMiPiMiPiZerotmp = new AliAODConversionMother(&EventPiMiGoodMeson2,PiMiPiZerotmp);
3187 
3188  // Fill histograms (likesign)
3189  fHistoMotherLikeSignBackInvMassPt[fiCut]->Fill(PiMiPiMiPiZeroBackgroundCandidate->M(),PiMiPiMiPiZeroBackgroundCandidate->Pt());
3190  fHistoMotherLikeSignBackInvMassSubPi0Pt[fiCut]->Fill(PiMiPiMiPiZeroBackgroundCandidate->M()-(EventPiZeroGoodMeson->M()-fPDGMassPi0),PiMiPiMiPiZeroBackgroundCandidate->Pt());
3191  fHistoMotherLikeSignBackInvMassFixedPzPi0Pt[fiCut]->Fill(PiMiPiMiPiZerotmp->M(),PiMiPiMiPiZerotmp->Pt());
3192 
3193  delete Pi0tmp;
3194  delete PiMiPiZerotmp;
3195  delete PiMiPiMiPiZerotmp;
3196 
3197  delete PiMiPiMiPiZeroBackgroundCandidate;
3198  PiMiPiMiPiZeroBackgroundCandidate = 0x0;
3199  }
3200  }
3201 
3202 
3203  }
3204  } // end of iCurrentPiMi2
3205  }// end of iCurrenPiMi
3206  } // end of LikeSign if
3207  } //end loop pi0 candidates
3208 }
3209 
3210 //______________________________________________________________________
3212 
3213  if(fTolerance == -1) return kTRUE;
3214  if((omega->Pt())<=5.){
3215  if( (omega->Angle(pospion->Vect())) < ((2.78715*(TMath::Exp(-0.589934*(omega->Pt()))+0.0519574))*fTolerance) &&
3216  (omega->Angle(negpion->Vect())) < ((5.94216*(TMath::Exp(-0.444428*(omega->Pt()))-0.0574076))*fTolerance) &&
3217  (omega->Angle(neutpion->Vect())) < ((2.79529*(TMath::Exp(-0.565999*(omega->Pt()))+0.0413576))*fTolerance) &&
3218  (pospion->Angle(negpion->Vect())) < ((3.14446*(TMath::Exp(-0.666433*(omega->Pt()))+0.0964309))*fTolerance) &&
3219  (pospion->Angle(neutpion->Vect())) < ((3.08241*(TMath::Exp(-0.650657*(omega->Pt()))+0.0997539))*fTolerance) &&
3220  (negpion->Angle(neutpion->Vect())) < ((3.18536*(TMath::Exp(-0.752847*(omega->Pt()))+0.1262780))*fTolerance)
3221  ){
3222  return kTRUE;
3223  }
3224  }else{
3225  if( (omega->Angle(pospion->Vect())) < ((0.459270*(TMath::Exp(-0.126007*(omega->Pt()))+0.100475))*fTolerance) &&
3226  (omega->Angle(negpion->Vect())) < ((0.521250*(TMath::Exp(-0.152532*(omega->Pt()))+0.114617))*fTolerance) &&
3227  (omega->Angle(neutpion->Vect())) < ((0.409766*(TMath::Exp(-0.108566*(omega->Pt()))+0.103594))*fTolerance) &&
3228  (pospion->Angle(negpion->Vect())) < ((0.709206*(TMath::Exp(-0.149072*(omega->Pt()))+0.111345))*fTolerance) &&
3229  (pospion->Angle(neutpion->Vect())) < ((0.662184*(TMath::Exp(-0.123397*(omega->Pt()))+0.104675))*fTolerance) &&
3230  (negpion->Angle(neutpion->Vect())) < ((0.730228*(TMath::Exp(-0.120859*(omega->Pt()))+0.105522))*fTolerance)
3231  ){
3232  return kTRUE;
3233  }
3234  }
3235  return kFALSE;
3236 }
3237 
3238 
3239 //______________________________________________________________________
3241 {
3242 
3243  // Process True Mesons
3244 
3245  Bool_t isSameMotherPiPlPiMiPiZero = kFALSE; // pi+ pi- and pi0 have the same mother
3246  Bool_t isSameMotherPiPlPiMi = kFALSE; // pi+ and pi- have the same mother
3247  Bool_t isSameMotherPiPlPiZero = kFALSE; // pi+ and pi0 have the same mother
3248  Bool_t isSameMotherPiMiPiZero = kFALSE; // pi- and pi0 have the same mother
3249  Bool_t isNoSameMother = kFALSE; // none of the pions have the same mother
3250  Bool_t isNoPiPiPi = kFALSE; // the decay is not a 3 pion decay
3251 
3252 
3253  Int_t virtualParticleMCLabel = TrueVirtualParticleCandidate->GetMCParticleLabel(fMCEvent);
3254  Int_t virtualParticleMotherLabel = -1;
3255  Int_t trueMesonFlag = TrueNeutralPionCandidate->GetTrueMesonValue();
3256  Int_t pi0MCLabel = TrueNeutralPionCandidate->GetMCLabel();
3257 
3258  Float_t weighted= 1;
3259 
3260  if ( !(trueMesonFlag == 1 && pi0MCLabel != -1)){
3261  if((fDoMesonQA>0 ) && (!fDoLightOutput)){
3262  fHistoTruePiPlPiMiPiZeroContaminationInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3263  }
3264  return;
3265  }
3266  Int_t pi0MotherLabel = fMCEvent->Particle(pi0MCLabel)->GetMother(0);
3267 
3268  TParticle * negativeMC = (TParticle*)TrueVirtualParticleCandidate->GetNegativeMCDaughter(fMCEvent);
3269  TParticle * positiveMC = (TParticle*)TrueVirtualParticleCandidate->GetPositiveMCDaughter(fMCEvent);
3270 
3271  Int_t posMotherLabelMC = positiveMC->GetMother(0);
3272  Int_t negMotherLabelMC = negativeMC->GetMother(0);
3273 
3274  // Check case present
3275  if((TMath::Abs(negativeMC->GetPdgCode())==211) && (TMath::Abs(positiveMC->GetPdgCode())==211) && (fMCEvent->Particle(pi0MCLabel)->GetPdgCode()==111)){
3276  // three pion decay
3277  if(virtualParticleMCLabel!=-1){
3278  // pi+ pi- have same mother
3279  virtualParticleMotherLabel = virtualParticleMCLabel;
3280  if(virtualParticleMotherLabel==pi0MotherLabel){
3281  // all pions from same mother
3282  if(fMCEvent->Particle(pi0MotherLabel)->GetStatusCode()!=21) isSameMotherPiPlPiMiPiZero = kTRUE;
3283  } else{
3284  // only pi+ pi- from same mother
3285  if(fMCEvent->Particle(virtualParticleMotherLabel)->GetStatusCode()!=21) isSameMotherPiPlPiMi = kTRUE;
3286  }
3287  } else{
3288  if(pi0MotherLabel==negMotherLabelMC && negMotherLabelMC != -1){
3289  // pi0 and pi- same mother
3290  if(fMCEvent->Particle(negMotherLabelMC)->GetStatusCode()!=21) isSameMotherPiMiPiZero = kTRUE;
3291  } else if(pi0MotherLabel==posMotherLabelMC && posMotherLabelMC != -1){
3292  // pi0 and pi+ same mother
3293  if(fMCEvent->Particle(posMotherLabelMC)->GetStatusCode()!=21) isSameMotherPiPlPiZero = kTRUE;
3294  } else{
3295  // all pions different mother
3296  isNoSameMother = kTRUE;
3297  }
3298  }
3299  } else{
3300  // not a three pion decay
3301  isNoPiPiPi = kTRUE;
3302  }
3303 
3304  // Do things for each case
3305  if(isSameMotherPiPlPiMiPiZero){
3306  if(fMCEvent->Particle(pi0MotherLabel)->GetPdgCode() == 221){
3307  // eta was found
3308  fHistoTrueMotherPiPlPiMiPiZeroInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3309  fHistoTrueMotherEtaPiPlPiMiPiZeroInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3310  AliAODConversionMother *PosPiontmp = new AliAODConversionMother();
3311  PosPiontmp->SetPxPyPzE(positiveMC->Px(), positiveMC->Py(), positiveMC->Pz(), positiveMC->Energy());
3312  AliAODConversionMother *NegPiontmp = new AliAODConversionMother();
3313  NegPiontmp->SetPxPyPzE(negativeMC->Px(), negativeMC->Py(), negativeMC->Pz(), negativeMC->Energy());
3314  if(!fDoLightOutput) fHistoTrueAngleSum[fiCut]->Fill(mesoncand->Pt(),((PosPiontmp->Angle(mesoncand->Vect()))+(NegPiontmp->Angle(PosPiontmp->Vect()))+(PosPiontmp->Angle(TrueNeutralPionCandidate->Vect()))));
3315 
3316  delete PosPiontmp; PosPiontmp = 0x0;
3317  delete NegPiontmp; NegPiontmp = 0x0;
3318 
3319  // Fill tree to get info about event that the eta was found in
3320  if(fDoMesonQA>1 && (!fDoLightOutput)){
3321  fV0MultiplicityEtaEvent = fMCEvent->GetNumberOfV0s();
3322  fTrackMultiplicityEtaEvent = fMCEvent->GetNumberOfTracks();
3323  fZVertexEtaEvent = fMCEvent->GetPrimaryVertex()->GetZ();
3324  fPtEta = mesoncand->Pt();
3325 
3326  fTreeEventInfoEta[fiCut]->Fill();
3327  }
3328  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueEtas,pi0MotherLabel) && (!fDoLightOutput)) fHistoDoubleCountTrueEtaInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt());
3329  } else if(fMCEvent->Particle(pi0MotherLabel)->GetPdgCode() == 223){
3330  // omega was found
3331  fHistoTrueMotherPiPlPiMiPiZeroInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3332  fHistoTrueMotherOmegaPiPlPiMiPiZeroInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3333 
3334  AliAODConversionMother *PosPiontmp = new AliAODConversionMother();
3335  PosPiontmp->SetPxPyPzE(positiveMC->Px(), positiveMC->Py(), positiveMC->Pz(), positiveMC->Energy());
3336  AliAODConversionMother *NegPiontmp = new AliAODConversionMother();
3337  NegPiontmp->SetPxPyPzE(negativeMC->Px(), negativeMC->Py(), negativeMC->Pz(), negativeMC->Energy());
3338  if(!fDoLightOutput) fHistoTrueAngleSum[fiCut]->Fill(mesoncand->Pt(),((PosPiontmp->Angle(mesoncand->Vect()))+(NegPiontmp->Angle(PosPiontmp->Vect()))+(PosPiontmp->Angle(TrueNeutralPionCandidate->Vect()))));
3339 
3340  // Fill tree to get info about event that the omega was found in
3341  if(fDoMesonQA>1 && (!fDoLightOutput)){
3342  fV0MultiplicityOmegaEvent = fMCEvent->GetNumberOfV0s();
3343  fTrackMultiplicityOmegaEvent = fMCEvent->GetNumberOfTracks();
3344  fZVertexOmegaEvent = fMCEvent->GetPrimaryVertex()->GetZ();
3345  fPtOmega = mesoncand->Pt();
3346 
3347  fTreeEventInfoOmega[fiCut]->Fill();
3348  }
3349 
3350  if (CheckVectorForDoubleCount(fVectorDoubleCountTrueOmegas,pi0MotherLabel) && (!fDoLightOutput)) fHistoDoubleCountTrueOmegaInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt());
3351  } else{
3352  if(fDoMesonQA>1 && (!fDoLightOutput)){
3353  // Write "unknown" mother to TTree
3354  fSamePiPiPiMotherID = fMCEvent->Particle(posMotherLabelMC)->GetPdgCode();
3355  fSamePiPiPiMotherInvMass = mesoncand->M();
3356  fSamePiPiPiMotherPt = mesoncand->Pt();
3357 
3358  fTreePiPiPiSameMother[fiCut]->Fill();
3359  }
3360  }
3361  } else if(isSameMotherPiPlPiMi && (fDoMesonQA>0 ) && (!fDoLightOutput)){
3362  if(fMCEvent->Particle(posMotherLabelMC)->GetPdgCode() == 221){
3363  // pi+pi- come from eta
3364  fHistoTruePiPlPiMiSameMotherFromEtaInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3365  } else if(fMCEvent->Particle(posMotherLabelMC)->GetPdgCode() == 223){
3366  // pi+pi- come from omega
3367  fHistoTruePiPlPiMiSameMotherFromOmegaInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3368  } else if(fMCEvent->Particle(posMotherLabelMC)->GetPdgCode() == 113){
3369  // pi+pi- come from rho0
3370  fHistoTruePiPlPiMiSameMotherFromRhoInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3371  } else if(fMCEvent->Particle(posMotherLabelMC)->GetPdgCode() == 331){
3372  // pi+pi- come from eta prime
3373  fHistoTruePiPlPiMiSameMotherFromEtaPrimeInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3374  } else if(fMCEvent->Particle(posMotherLabelMC)->GetPdgCode() == 310){
3375  // pi+pi- come from K0 short
3376  fHistoTruePiPlPiMiSameMotherFromK0sInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3377  } else if(fMCEvent->Particle(posMotherLabelMC)->GetPdgCode() == 130){
3378  // pi+pi- come from K0 short
3379  fHistoTruePiPlPiMiSameMotherFromK0lInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3380  } else{
3381  // pi+pi- come from something else
3382  if(fDoMesonQA>1 && (!fDoLightOutput)){
3383  fCasePiPi = 0;
3384  // Write "unknown" mother to TTree
3385  fSamePiPiMotherID = fMCEvent->Particle(posMotherLabelMC)->GetPdgCode();
3386  fSamePiPiMotherInvMass = mesoncand->M();
3387  fSamePiPiMotherPt = mesoncand->Pt();
3388 
3389  fTreePiPiSameMother[fiCut]->Fill();
3390  }
3391  }
3392  } else if(isSameMotherPiMiPiZero && (fDoMesonQA>0 ) && (!fDoLightOutput)){
3393  if(fMCEvent->Particle(pi0MotherLabel)->GetPdgCode() == 221){
3394  // pi0pi- come from eta
3395  fHistoTruePiMiPiZeroSameMotherFromEtaInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3396  } else if(fMCEvent->Particle(pi0MotherLabel)->GetPdgCode() == 223){
3397  // pi0pi- come from omega
3398  fHistoTruePiMiPiZeroSameMotherFromOmegaInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3399  } else if(fMCEvent->Particle(pi0MotherLabel)->GetPdgCode() ==-213){
3400  // pi0pi- come from rho-
3401  fHistoTruePiMiPiZeroSameMotherFromRhoInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3402  } else if(fMCEvent->Particle(pi0MotherLabel)->GetPdgCode() == 130){
3403  // pi0pi- come from rho-
3404  fHistoTruePiMiPiZeroSameMotherFromK0lInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3405  } else{
3406  // pi0pi- come from something else
3407  if(fDoMesonQA>1){
3408  fCasePiPi = 1;
3409  // Write "unknown" mother to TTree
3410  fSamePiPiMotherID = fMCEvent->Particle(pi0MotherLabel)->GetPdgCode();
3411  fSamePiPiMotherInvMass = mesoncand->M();
3412  fSamePiPiMotherPt = mesoncand->Pt();
3413 
3414  fTreePiPiSameMother[fiCut]->Fill();
3415  }
3416  }
3417  } else if(isSameMotherPiPlPiZero && (fDoMesonQA>0 ) && (!fDoLightOutput)){
3418  if(fMCEvent->Particle(posMotherLabelMC)->GetPdgCode() == 221){
3419  // pi+pi0 come from eta
3420  fHistoTruePiPlPiZeroSameMotherFromEtaInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3421  } else if(fMCEvent->Particle(posMotherLabelMC)->GetPdgCode() == 223){
3422  // pi+pi0 come from omega
3423  fHistoTruePiPlPiZeroSameMotherFromOmegaInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3424  } else if(fMCEvent->Particle(posMotherLabelMC)->GetPdgCode() == 213) {
3425  // pi+pi0 come from rho+
3426  fHistoTruePiPlPiZeroSameMotherFromRhoInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3427  } else if(fMCEvent->Particle(posMotherLabelMC)->GetPdgCode() == 130) {
3428  // pi+pi0 come from rho+
3429  fHistoTruePiPlPiZeroSameMotherFromK0lInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3430  } else{
3431  // pi+pi0 come from something else
3432  if(fDoMesonQA>1){
3433  fCasePiPi = 2;
3434  // Write "unknown" mother to TTree
3435  fSamePiPiMotherID = fMCEvent->Particle(pi0MotherLabel)->GetPdgCode();
3436  fSamePiPiMotherInvMass = mesoncand->M();
3437  fSamePiPiMotherPt = mesoncand->Pt();
3438 
3439  fTreePiPiSameMother[fiCut]->Fill();
3440  }
3441  }
3442  } else if(isNoSameMother && (fDoMesonQA>0 ) && (!fDoLightOutput)){
3443  // no same mother purecombinatorical
3444  fHistoTruePiPlPiMiPiZeroPureCombinatoricalInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3445  } else if(isNoPiPiPi && (fDoMesonQA>0 ) && (!fDoLightOutput)){
3446  // no pi pi pi decay contamination
3447  fHistoTruePiPlPiMiPiZeroContaminationInvMassPt[fiCut]->Fill(mesoncand->M(),mesoncand->Pt(),weighted);
3448  // investigate here what was missmatched (?)
3449 
3450  }
3451 }
3452 
3453 
3454 //________________________________________________________________________
3456  //see header file for documentation
3457 
3458  Int_t method = 1;
3459  if( method == 1 ) {
3460  if(fPosPionCandidates->GetEntries() >0 && fNegPionCandidates->GetEntries() >0){
3461  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
3462  fBGHandlerPiPl[fiCut]->AddMesonEvent(fPosPionCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),0);
3463  fBGHandlerPiMi[fiCut]->AddMesonEvent(fNegPionCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),0);
3464  } else { // means we use #V0s for multiplicity
3465  if (fNeutralPionMode < 2){
3466  fBGHandlerPiPl[fiCut]->AddMesonEvent(fPosPionCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fGoodConvGammas->GetEntries(),0);
3467  fBGHandlerPiMi[fiCut]->AddMesonEvent(fNegPionCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fGoodConvGammas->GetEntries(),0);
3468  }else {
3469  fBGHandlerPiPl[fiCut]->AddMesonEvent(fPosPionCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fClusterCandidates->GetEntries(),0);
3470  fBGHandlerPiMi[fiCut]->AddMesonEvent(fNegPionCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fClusterCandidates->GetEntries(),0);
3471  }
3472  }
3473  }
3474  }
3475 // else if ( method == 2 ){
3476 // if(fGoodVirtualParticles->GetEntries() > 0 ){
3477 // if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
3478 // fBGHandler[fiCut]->AddEvent(fGoodVirtualParticles,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),0);
3479 // } else{ // means we use #V0s for multiplicity
3480 // fBGHandler[fiCut]->AddEvent(fGoodVirtualParticles,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fGoodVirtualParticles->GetEntries(),0);
3481 // }
3482 // }
3483 // }
3484 }
3485 
3486 //________________________________________________________________________
3488  //see header file for documentation
3489 
3490  Double_t dx = vertex->fX - fInputEvent->GetPrimaryVertex()->GetX();
3491  Double_t dy = vertex->fY - fInputEvent->GetPrimaryVertex()->GetY();
3492  Double_t dz = vertex->fZ - fInputEvent->GetPrimaryVertex()->GetZ();
3493 
3494  Double_t movedPlace[3] = {particle->GetProductionX() - dx,particle->GetProductionY() - dy,particle->GetProductionZ() - dz};
3495  particle->SetProductionPoint(movedPlace);
3496 }
3497 
3498 //________________________________________________________________________
3500 
3501 Double_t px = particle->Px();
3502 Double_t py = particle->Py();
3503 Int_t signPz = particle->Pz()<0?-1:1;
3504 Double_t energy = particle->Energy();
3505 Double_t pz = signPz*TMath::Sqrt(TMath::Abs(pow(fPDGMassPi0,2)-pow(energy,2)+pow(px,2)+pow(py,2)));
3506 particle->SetPxPyPzE(px,py,pz,energy);
3507 
3508 return;
3509 }
3510 
3511 //_____________________________________________________________________________________
3513 //
3514 // Returns true if the particle comes from eta -> pi+ pi- gamma
3515 //
3516  if(label<0) return kFALSE;
3517  Int_t motherLabel = fMCEvent->Particle( label )->GetMother(0);
3518  if( motherLabel < 0 || motherLabel >= fMCEvent->GetNumberOfTracks() ) return kFALSE;
3519 
3520  TParticle* mother = fMCEvent->Particle( motherLabel );
3521 // cout << "found eta? " << endl;
3522  if( mother->GetPdgCode() != 221 ) return kFALSE;
3523 // else cout << "YES" << endl;
3524  if( IsPiPlPiMiPiZeroDecay( mother ) ) return kTRUE;
3525  return kFALSE;
3526 }
3527 
3528 //_____________________________________________________________________________________
3530 //
3531 // Returns true if the particle comes from eta -> pi+ pi- gamma
3532 //
3533  if(label<0) return kFALSE;
3534  Int_t motherLabel = fMCEvent->Particle( label )->GetMother(0);
3535  if( motherLabel < 0 || motherLabel >= fMCEvent->GetNumberOfTracks() ) return kFALSE;
3536 
3537  TParticle* mother = fMCEvent->Particle( motherLabel );
3538 // cout << "found omega? " << endl;
3539  if( mother->GetPdgCode() != 223 ) return kFALSE;
3540 // else cout << "YES" << endl;
3541  if( IsPiPlPiMiPiZeroDecay( mother ) ) return kTRUE;
3542  return kFALSE;
3543 }
3544 
3545 
3546 //_____________________________________________________________________________
3548 {
3549 // cout << fMCMother->GetNDaughters() << endl;
3550  if( fMCMother->GetNDaughters() != 3 ) return kFALSE;
3551 // cout << fMCMother->GetPdgCode() << endl;
3552  if( !(fMCMother->GetPdgCode() == 221 || fMCMother->GetPdgCode() == 223) ) return kFALSE;
3553 // cout << "made it til here" << endl;
3554 
3555  TParticle *posPion = 0x0;
3556  TParticle *negPion = 0x0;
3557  TParticle *neutPion = 0x0;
3558 
3559  for(Int_t index= fMCMother->GetFirstDaughter();index<= fMCMother->GetLastDaughter();index++){
3560  if(index<0) continue;
3561  TParticle* temp = (TParticle*)fMCEvent->Particle( index );
3562 
3563  switch( temp->GetPdgCode() ) {
3564  case 211:
3565  posPion = temp;
3566  break;
3567  case -211:
3568  negPion = temp;
3569  break;
3570  case 111:
3571  neutPion = temp;
3572  break;
3573  }
3574  }
3575  if( posPion && negPion && neutPion) return kTRUE;
3576 
3577  return kFALSE;
3578 }
3579 
3580 //_____________________________________________________________________________________
3582 //
3583 // Returns true if the particle comes from eta -> pi+ pi- gamma
3584 //
3585  if(label<0) return kFALSE;
3586  Int_t motherLabel = fMCEvent->Particle( label )->GetMother(0);
3587  if( motherLabel < 0 || motherLabel >= fMCEvent->GetNumberOfTracks() ) return kFALSE;
3588 
3589  TParticle* mother = fMCEvent->Particle( motherLabel );
3590 // cout << "found omega? " << endl;
3591  if( mother->GetPdgCode() != 111 ) return kFALSE;
3592 // else cout << "YES" << endl;
3593  Int_t grandMotherLabel = mother->GetMother(0);
3594  if( grandMotherLabel < 0 || grandMotherLabel >= fMCEvent->GetNumberOfTracks() ) return kFALSE;
3595  TParticle* grandmother = fMCEvent->Particle( grandMotherLabel );
3596 
3597  if( IsPiPlPiMiPiZeroDecay( grandmother ) ) return kTRUE;
3598  return kFALSE;
3599 }
3600 
3601 //_________________________________________________________________________________
3603 {
3604  if(tobechecked > -1)
3605  {
3606  vector<Int_t>::iterator it;
3607  it = find (vec.begin(), vec.end(), tobechecked);
3608  if (it != vec.end()) return true;
3609  else{
3610  vec.push_back(tobechecked);
3611  return false;
3612  }
3613  }
3614  return false;
3615 }
3616 
3617 
TParticle * GetMCParticle(AliMCEvent *mcEvent)
vector< Int_t > GetReconstructedPosPionIndex()
void ProcessTrueNeutralPionCandidatesPureCalo(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
void SetCaloClusterRef(Long_t ref)
void SetLabels(Int_t label1, Int_t label2, Int_t label3=0)
double Double_t
Definition: External.C:58
vector< Int_t > fVectorDoubleCountTruePi0s
array of histos with double counted photons, R, pT
GammaConversionVertex * GetBGEventVertex(Int_t zbin, Int_t mbin, Int_t event)
Definition: External.C:236
void SetCaloPhotonMCFlags(AliMCEvent *mcEvent, Bool_t enableSort)
vector< Int_t > fVectorDoubleCountTrueOmegas
vector containing labels of validated eta
Int_t GetNumberOfPrimaryTracks()
energy
Definition: HFPtSpectrum.C:44
void AddMesonEvent(TList *const eventMothers, Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue=-100)
vector< Int_t > fVectorDoubleCountTrueEtas
vector containing labels of validated pi0
void SetProductionPoint(Double_t *point)
void SetTrueMesonValue(Int_t trueMeson)
TString GetPeriodName()
void ProcessTrueMesonCandidates(AliAODConversionMother *Pi0Candidate, AliAODConversionMother *TrueNeutralPionCandidate, AliAODConversionPhoton *TrueVirtualGammaCandidate)
TParticle * GetPositiveMCDaughter(AliMCEvent *mcEvent)
void SetCaloPhotonMCLabel(Int_t i, Int_t labelCaloPhoton)
TParticle * GetNegativeMCDaughter(AliMCEvent *mcEvent)
int Int_t
Definition: External.C:63
Class handling all kinds of selection cuts for Gamma Calo analysis.
Definition: External.C:204
unsigned int UInt_t
Definition: External.C:33
void ProcessTrueCaloPhotonCandidates(AliAODConversionPhoton *TruePhotonCandidate)
float Float_t
Definition: External.C:68
std::vector< AliAODConversionMother * > AliGammaConversionMotherAODVector
Int_t method
TH1I ** fHistoNEvents
vector containing labels of validated photons
AliConversionPhotonCuts * GetConversionCuts()
Definition: AliV0ReaderV1.h:89
Int_t GetTrackLabel(Int_t i) const
Class handling all kinds of selection cuts for Gamma Conversion analysis.
Int_t GetMCParticleLabel(AliMCEvent *mcEvent)
TH2F ** fHistoDoubleCountTrueConvGammaRPt
array of histos with double counted omegas, invMass, pT
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
Double_t centMax
void ProcessTrueNeutralPionCandidatesPureConversions(AliAODConversionMother *Pi0Candidate, AliAODConversionPhoton *TrueGammaCandidate0, AliAODConversionPhoton *TrueGammaCandidate1)
TList * GetCaloTrackMatcherHistograms()
Double_t GetProductionZ() const
Double_t GetProductionX() const
AliGammaConversionMotherAODVector * GetBGGoodMesons(Int_t zbin, Int_t mbin, Int_t event)
vector< Int_t > fVectorDoubleCountTrueConvGammas
vector containing labels of validated omega
Class handling all kinds of selection cuts for Gamma Conversion analysis.
TH2F ** fHistoDoubleCountTrueEtaInvMassPt
array of histos with double counted pi0s, invMass, pT
void SetNCaloPhotonMCLabels(Int_t nLabels)
TClonesArray * GetReconstructedGammas() const
Definition: AliV0ReaderV1.h:85
AliPrimaryPionCuts * GetPrimaryPionCuts()
TH2F ** fHistoDoubleCountTrueOmegaInvMassPt
array of histos with double counted etas, invMass, pT
Bool_t KinematicCut(AliAODConversionMother *negpion, AliAODConversionMother *pospion, AliAODConversionMother *neutpion, AliAODConversionMother *omega)
Class handling all kinds of selection cuts for Gamma Conversion analysis.