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