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