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