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