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