AliPhysics  3337bb0 (3337bb0)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskOmegaToPiZeroGamma.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: Daniel Mühlheim, Ziruo Zhang *
5  * Version 1.0 *
6  * *
7  * *
8  * Permission to use, copy, modify and distribute this software and its *
9  * documentation strictly for non-commercial purposes is hereby granted *
10  * without fee, provided that the above copyright notice appears in all *
11  * copies and that both the copyright notice and this permission notice *
12  * appear in the supporting documentation. The authors make no claims *
13  * about the suitability of this software for any purpose. It is *
14  * provided "as is" without express or implied warranty. *
15  **************************************************************************/
16 
18 //----------------------------------------------------------------
19 // Class used to do analysis on conversion photons + calo photons
20 //----------------------------------------------------------------
22 #include "TChain.h"
23 #include "TTree.h"
24 #include "TBranch.h"
25 #include "TFile.h"
26 #include "TH1F.h"
27 #include "TH2F.h"
28 #include "TH3F.h"
29 #include "THnSparse.h"
30 #include "TCanvas.h"
31 #include "TNtuple.h"
32 #include "AliAnalysisTask.h"
33 #include "AliAnalysisManager.h"
34 #include "AliESDEvent.h"
35 #include "AliESDInputHandler.h"
36 #include "AliMCEventHandler.h"
37 #include "AliMCEvent.h"
38 #include "AliMCParticle.h"
39 #include "AliCentrality.h"
40 #include "AliESDVZERO.h"
41 #include "AliESDpid.h"
43 #include "AliVParticle.h"
44 #include "AliESDtrack.h"
45 #include "AliESDtrackCuts.h"
46 #include "AliKFVertex.h"
47 #include "AliGenCocktailEventHeader.h"
49 #include "AliAODMCParticle.h"
50 #include "AliAODMCHeader.h"
51 #include "AliEventplane.h"
53 #include "AliAODEvent.h"
54 #include "AliAODInputHandler.h"
55 #include "AliESDEvent.h"
56 #include "AliESDInputHandler.h"
57 #include "AliInputEventHandler.h"
58 #include "AliCaloTrackMatcher.h"
59 #include <vector>
60 #include <map>
61 
63 
64 //________________________________________________________________________
66  fV0Reader(NULL),
67  fV0ReaderName("V0ReaderV1"),
68  fBGHandler(NULL),
69  fBGClusHandler(NULL),
70  fBGPi0Handler(NULL),
71  fInputEvent(NULL),
72  fMCEvent(NULL),
73  fCutFolder(NULL),
74  fESDList(NULL),
75  fTrueList(NULL),
76  fMCList(NULL),
77  fClusterOutputList(NULL),
78  fOutputContainer(NULL),
79  fReaderGammas(NULL),
80  fGammaCandidates(NULL),
81  fClusterCandidates(NULL),
82  fPi0Candidates(NULL),
83  fEventCutArray(NULL),
84  fEventCuts(NULL),
85  fCutArray(NULL),
86  fConversionCuts(NULL),
87  fClusterCutArray(NULL),
88  fCaloPhotonCuts(NULL),
89  fNeutralPionCutArray(NULL),
90  fMesonCutArray(NULL),
91  fHistoConvGammaPt(NULL),
92  fHistoConvGammaR(NULL),
93  fHistoConvGammaEta(NULL),
94  fHistoPhotonPairInvMassPt(NULL),
95  fHistoPhotonPairMatchedInvMassPt(NULL),
96  fHistoPhotonPairYPt(NULL),
97  fHistoPhotonPairAlphaPt(NULL),
98  fHistoPhotonPairOpenAnglePt(NULL),
99  fHistoPhotonPairEtaPhi(NULL),
100  fHistoMotherConvPhotonEtaPhi(NULL),
101  fHistoMotherInvMassPt(NULL),
102  fHistoMotherMatchedInvMassPt(NULL),
103  fHistoMotherAngleCutRejectedInvMassPt(NULL),
104  fHistoMotherYPt(NULL),
105  fHistoMotherAlphaPt(NULL),
106  fHistoMotherEtaPhi(NULL),
107  fHistoMotherPi0AnglePt(NULL),
108  fHistoMotherGammaAnglePt(NULL),
109  fHistoPi0GammaAnglePt(NULL),
110  fHistoGammaFromMotherPt(NULL),
111  fHistoDiffPi0SameGammaBackInvMassPt(NULL),
112  fHistoSamePi0DiffGammaBackInvMassPt(NULL),
113  fHistoClusGammaPt(NULL),
114  fHistoClusOverlapHeadersGammaPt(NULL),
115  fHistoMCAllGammaPt(NULL),
116  fHistoMCAllGammaEMCALAccPt(NULL),
117  fHistoMCConvGammaPt(NULL),
118  fHistoMCConvGammaR(NULL),
119  fHistoMCConvGammaEta(NULL),
120  fHistoMCPi0Pt(NULL),
121  fHistoMCPi0WOWeightPt(NULL),
122  fHistoMCPi0WOEvtWeightPt(NULL),
123  fHistoMCPi0InAccPt(NULL),
124  fHistoMCPi0WOWeightInAccPt(NULL),
125  fHistoMCPi0PtY(NULL),
126  fHistoMCPi0PtAlpha(NULL),
127  fHistoMCPi0PtJetPt(NULL),
128  fHistoMCGammaFromAllOmegaPt(NULL),
129  fHistoMCGammaFromOmegaInAccPt(NULL),
130  fHistoMCPi0FromAllOmegaInvMassPt(NULL),
131  fHistoMCOmegaInAccInvMassPt(NULL),
132  fHistoMCOmegaInvMassPt(NULL),
133  fHistoMCAllOmegaYPt(NULL),
134  fHistoMCOmegaInAccYPt(NULL),
135  fHistoMCAllOmegaAlphaPt(NULL),
136  fHistoMCOmegaInAccAlphaPt(NULL),
137  fHistoMCPi0FromAllOmegaAlphaPt(NULL),
138  fHistoMCPi0FromOmegaInAccAlphaPt(NULL),
139  fHistoMCPi0FromAllOmegaYPt(NULL),
140  fHistoMCPi0FromOmegaInAccYPt(NULL),
141  fHistoMCPi0FromOmegaInAccInvMassPt(NULL),
142  fHistoMCPi0FromAllOmegaEtaPhi(NULL),
143  fHistoMCPi0FromOmegaInAccEtaPhi(NULL),
144  fHistoMCAllOmegaEtaPhi(NULL),
145  fHistoMCOmegaInAccEtaPhi(NULL),
146  fHistoMCAllOmegaPiZeroAnglePt(NULL),
147  fHistoMCAllPiZeroGammaAnglePt(NULL),
148  fHistoMCAllOmegaGammaAnglePt(NULL),
149  fHistoMCInAccOmegaPiZeroAnglePt(NULL),
150  fHistoMCInAccPiZeroGammaAnglePt(NULL),
151  fHistoMCInAccOmegaGammaAnglePt(NULL),
152  fHistoMCAllOmegaInvMassPt(NULL),
153  fHistoMCAllOmegaPtPi0Pt(NULL),
154  fHistoMCInAccOmegaPtPi0Pt(NULL),
155  fHistoMCAllOmegaPtGammaPt(NULL),
156  fHistoMCInAccOmegaPtGammaPt(NULL),
157  fHistoTrueOmegaInvMassPt(NULL),
158  fHistoTrueOmegaYPt(NULL),
159  fHistoTrueOmegaAlphaPt(NULL),
160  fHistoTruePi0FromOmegaYPt(NULL),
161  fHistoTruePi0FromOmegaInvMassPt(NULL),
162  fHistoTruePi0FromOmegaAlphaPt(NULL),
163  fHistoTruePi0FromOmegaEtaPhi(NULL),
164  fHistoTruePi0FromOmegaOpenAnglePt(NULL),
165  fHistoTrueOmegaPi0AnglePt(NULL),
166  fHistoTrueOmegaGammaAnglePt(NULL),
167  fHistoTruePi0GammaAnglePt(NULL),
168  fHistoTrueOmegaEtaPhi(NULL),
169  fHistoTrueOmegaPtPi0Pt(NULL),
170  fHistoTrueOmegaPtGammaPt(NULL),
171  fHistoTrueGammaFromOmegaPt(NULL),
172  fVectorRecTruePi0s(0),
173  fVectorDoubleCountTruePi0s(0),
174  fHistoMultipleCountTruePi0(NULL),
175  fMapMultipleCountTruePi0s(),
176  fHistoNEvents(NULL),
177  fHistoNEventsMinGamma(NULL),
178  fHistoMCOmegaDecayChannels(NULL),
179  fHistoNEventsWOWeight(NULL),
180  fHistoNGoodESDTracks(NULL),
181  fHistoVertexZ(NULL),
182  fHistoNGammaCandidates(NULL),
183  fHistoNClusterCandidates(NULL),
184  fHistoNGoodESDTracksVsNGammaCandidates(NULL),
185  fHistoSPDClusterTrackletBackground(NULL),
186  fHistoNV0Tracks(NULL),
187  fProfileEtaShift(NULL),
188  fProfileJetJetXSection(NULL),
189  fHistoJetJetNTrials(NULL),
190  fEventPlaneAngle(-100),
191  fNGammaCandidates(0),
192  fUnsmearedPx(NULL),
193  fUnsmearedPy(NULL),
194  fUnsmearedPz(NULL),
195  fUnsmearedE(NULL),
196  fMCEventPos(NULL),
197  fMCEventNeg(NULL),
198  fESDArrayPos(NULL),
199  fESDArrayNeg(NULL),
200  fnCuts(0),
201  fiCut(0),
202  fMoveParticleAccordingToVertex(kTRUE),
203  fIsHeavyIon(0),
204  fDoMesonQA(0),
205  fDoPhotonQA(0),
206  fIsFromMBHeader(kTRUE),
207  fIsOverlappingWithOtherHeader(kFALSE),
208  fIsMC(0),
209  fSetPlotHistsExtQA(kFALSE),
210  fWeightJetJetMC(1),
211  fEnableSortForClusMC(kFALSE),
212  fReconMethod(0),
213  flowerFactor(0),
214  fupperFactor(0),
215  fMinPi0Pt(0),
216  fmaxfit(NULL),
217  fDoPiZeroGammaAngleCut(kFALSE)
218 {
219 
220 }
221 
222 //________________________________________________________________________
224  AliAnalysisTaskSE(name),
225  fV0Reader(NULL),
226  fV0ReaderName("V0ReaderV1"),
227  fBGHandler(NULL),
228  fBGClusHandler(NULL),
229  fBGPi0Handler(NULL),
230  fInputEvent(NULL),
231  fMCEvent(NULL),
232  fCutFolder(NULL),
233  fESDList(NULL),
234  fTrueList(NULL),
235  fMCList(NULL),
236  fClusterOutputList(NULL),
237  fOutputContainer(0),
238  fReaderGammas(NULL),
239  fGammaCandidates(NULL),
240  fClusterCandidates(NULL),
241  fPi0Candidates(NULL),
242  fEventCutArray(NULL),
243  fEventCuts(NULL),
244  fCutArray(NULL),
245  fConversionCuts(NULL),
246  fClusterCutArray(NULL),
247  fCaloPhotonCuts(NULL),
248  fNeutralPionCutArray(NULL),
249  fMesonCutArray(NULL),
250  fHistoConvGammaPt(NULL),
251  fHistoConvGammaR(NULL),
252  fHistoConvGammaEta(NULL),
253  fHistoPhotonPairInvMassPt(NULL),
254  fHistoPhotonPairMatchedInvMassPt(NULL),
255  fHistoPhotonPairYPt(NULL),
256  fHistoPhotonPairAlphaPt(NULL),
257  fHistoPhotonPairOpenAnglePt(NULL),
258  fHistoPhotonPairEtaPhi(NULL),
259  fHistoMotherConvPhotonEtaPhi(NULL),
260  fHistoMotherInvMassPt(NULL),
261  fHistoMotherMatchedInvMassPt(NULL),
262  fHistoMotherAngleCutRejectedInvMassPt(NULL),
263  fHistoMotherYPt(NULL),
264  fHistoMotherAlphaPt(NULL),
265  fHistoMotherEtaPhi(NULL),
266  fHistoMotherPi0AnglePt(NULL),
267  fHistoMotherGammaAnglePt(NULL),
268  fHistoPi0GammaAnglePt(NULL),
269  fHistoGammaFromMotherPt(NULL),
270  fHistoDiffPi0SameGammaBackInvMassPt(NULL),
271  fHistoSamePi0DiffGammaBackInvMassPt(NULL),
272  fHistoClusGammaPt(NULL),
273  fHistoClusOverlapHeadersGammaPt(NULL),
274  fHistoMCAllGammaPt(NULL),
275  fHistoMCAllGammaEMCALAccPt(NULL),
276  fHistoMCConvGammaPt(NULL),
277  fHistoMCConvGammaR(NULL),
278  fHistoMCConvGammaEta(NULL),
279  fHistoMCPi0Pt(NULL),
280  fHistoMCPi0WOWeightPt(NULL),
281  fHistoMCPi0WOEvtWeightPt(NULL),
282  fHistoMCPi0InAccPt(NULL),
283  fHistoMCPi0WOWeightInAccPt(NULL),
284  fHistoMCPi0PtY(NULL),
285  fHistoMCPi0PtAlpha(NULL),
286  fHistoMCPi0PtJetPt(NULL),
287  fHistoMCGammaFromAllOmegaPt(NULL),
288  fHistoMCGammaFromOmegaInAccPt(NULL),
289  fHistoMCPi0FromAllOmegaInvMassPt(NULL),
290  fHistoMCOmegaInAccInvMassPt(NULL),
291  fHistoMCOmegaInvMassPt(NULL),
292  fHistoMCAllOmegaYPt(NULL),
293  fHistoMCOmegaInAccYPt(NULL),
294  fHistoMCAllOmegaAlphaPt(NULL),
295  fHistoMCOmegaInAccAlphaPt(NULL),
296  fHistoMCPi0FromAllOmegaAlphaPt(NULL),
297  fHistoMCPi0FromOmegaInAccAlphaPt(NULL),
298  fHistoMCPi0FromAllOmegaYPt(NULL),
299  fHistoMCPi0FromOmegaInAccYPt(NULL),
300  fHistoMCPi0FromOmegaInAccInvMassPt(NULL),
301  fHistoMCPi0FromAllOmegaEtaPhi(NULL),
302  fHistoMCPi0FromOmegaInAccEtaPhi(NULL),
303  fHistoMCAllOmegaEtaPhi(NULL),
304  fHistoMCOmegaInAccEtaPhi(NULL),
305  fHistoMCAllOmegaPiZeroAnglePt(NULL),
306  fHistoMCAllPiZeroGammaAnglePt(NULL),
307  fHistoMCAllOmegaGammaAnglePt(NULL),
308  fHistoMCInAccOmegaPiZeroAnglePt(NULL),
309  fHistoMCInAccPiZeroGammaAnglePt(NULL),
310  fHistoMCInAccOmegaGammaAnglePt(NULL),
311  fHistoMCAllOmegaInvMassPt(NULL),
312  fHistoMCAllOmegaPtPi0Pt(NULL),
313  fHistoMCInAccOmegaPtPi0Pt(NULL),
314  fHistoMCAllOmegaPtGammaPt(NULL),
315  fHistoMCInAccOmegaPtGammaPt(NULL),
316  fHistoTrueOmegaInvMassPt(NULL),
317  fHistoTrueOmegaYPt(NULL),
318  fHistoTrueOmegaAlphaPt(NULL),
319  fHistoTruePi0FromOmegaYPt(NULL),
320  fHistoTruePi0FromOmegaInvMassPt(NULL),
321  fHistoTruePi0FromOmegaAlphaPt(NULL),
322  fHistoTruePi0FromOmegaEtaPhi(NULL),
323  fHistoTruePi0FromOmegaOpenAnglePt(NULL),
324  fHistoTrueOmegaPi0AnglePt(NULL),
325  fHistoTrueOmegaGammaAnglePt(NULL),
326  fHistoTruePi0GammaAnglePt(NULL),
327  fHistoTrueOmegaEtaPhi(NULL),
328  fHistoTrueOmegaPtPi0Pt(NULL),
329  fHistoTrueOmegaPtGammaPt(NULL),
330  fHistoTrueGammaFromOmegaPt(NULL),
331  fVectorRecTruePi0s(0),
332  fVectorDoubleCountTruePi0s(0),
333  fHistoMultipleCountTruePi0(NULL),
334  fMapMultipleCountTruePi0s(),
335  fHistoNEvents(NULL),
336  fHistoNEventsMinGamma(NULL),
337  fHistoMCOmegaDecayChannels(NULL),
338  fHistoNEventsWOWeight(NULL),
339  fHistoNGoodESDTracks(NULL),
340  fHistoVertexZ(NULL),
341  fHistoNGammaCandidates(NULL),
342  fHistoNClusterCandidates(NULL),
343  fHistoNGoodESDTracksVsNGammaCandidates(NULL),
344  fHistoSPDClusterTrackletBackground(NULL),
345  fHistoNV0Tracks(NULL),
346  fProfileEtaShift(NULL),
347  fProfileJetJetXSection(NULL),
348  fHistoJetJetNTrials(NULL),
349  fEventPlaneAngle(-100),
350  fNGammaCandidates(0),
351  fUnsmearedPx(NULL),
352  fUnsmearedPy(NULL),
353  fUnsmearedPz(NULL),
354  fUnsmearedE(NULL),
355  fMCEventPos(NULL),
356  fMCEventNeg(NULL),
357  fESDArrayPos(NULL),
358  fESDArrayNeg(NULL),
359  fnCuts(0),
360  fiCut(0),
361  fMoveParticleAccordingToVertex(kTRUE),
362  fIsHeavyIon(0),
363  fDoMesonQA(0),
364  fDoPhotonQA(0),
365  fIsFromMBHeader(kTRUE),
366  fIsOverlappingWithOtherHeader(kFALSE),
367  fIsMC(0),
368  fSetPlotHistsExtQA(kFALSE),
369  fWeightJetJetMC(1),
370  fEnableSortForClusMC(kFALSE),
371  fReconMethod(0),
372  flowerFactor(0),
373  fupperFactor(0),
374  fMinPi0Pt(0),
375  fmaxfit(NULL),
376  fDoPiZeroGammaAngleCut(kFALSE)
377 {
378  // Define output slots here
379  DefineOutput(1, TList::Class());
380 }
381 
383 {
384  if(fGammaCandidates){
385  delete fGammaCandidates;
386  fGammaCandidates = 0x0;
387  }
388  if(fClusterCandidates){
389  delete fClusterCandidates;
390  fClusterCandidates = 0x0;
391  }
392  if(fPi0Candidates){
393  delete fPi0Candidates;
394  fPi0Candidates = 0x0;
395  }
396  if(fBGHandler){
397  delete[] fBGHandler;
398  fBGHandler = 0x0;
399  }
400  if(fBGClusHandler){
401  delete[] fBGClusHandler;
402  fBGClusHandler = 0x0;
403  }
404  if(fBGPi0Handler){
405  delete[] fBGPi0Handler;
406  fBGPi0Handler = 0x0;
407  }
409  delete fmaxfit;
410  fmaxfit = 0x0;
411  }
412 }
413 //___________________________________________________________
415 
419 
420  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
421  if (((AliConversionMesonCuts*)fNeutralPionCutArray->At(iCut))->DoBGCalculation()){
422 
423  Int_t collisionSystem = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(0,1));
424  Int_t centMin = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(1,1));
425  Int_t centMax = atoi((TString)(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber())(2,1));
426 
427  if(collisionSystem == 1 || collisionSystem == 2 ||
428  collisionSystem == 5 || collisionSystem == 8 ||
429  collisionSystem == 9){
430  centMin = centMin*10;
431  centMax = centMax*10;
432  if(centMax ==0 && centMax!=centMin) centMax=100;
433  }else if(collisionSystem == 3 || collisionSystem == 6){
434  centMin = centMin*5;
435  centMax = centMax*5;
436  }else if(collisionSystem == 4 || collisionSystem == 7){
437  centMin = ((centMin*5)+45);
438  centMax = ((centMax*5)+45);
439  }
440 
442  collisionSystem,centMin,centMax,
443  ((AliConversionMesonCuts*)fNeutralPionCutArray->At(iCut))->GetNumberOfBGEvents(),
444  ((AliConversionMesonCuts*)fNeutralPionCutArray->At(iCut))->UseTrackMultiplicity(),
445  2,8,5);
447  collisionSystem,centMin,centMax,
448  ((AliConversionMesonCuts*)fNeutralPionCutArray->At(iCut))->GetNumberOfBGEvents(),
449  ((AliConversionMesonCuts*)fNeutralPionCutArray->At(iCut))->UseTrackMultiplicity(),
450  2,8,5);
452  collisionSystem,centMin,centMax,
453  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetNumberOfBGEvents(),
454  ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->UseTrackMultiplicity(),
455  2,8,5);
456  }
457  }
458 }
459 //________________________________________________________________________
461 
462  if (fIsMC > 1){
463  fDoPhotonQA = 0;
464  }
465 
466  // create function for pi0-gamma angle cut
468  fmaxfit = new TF1("maxfit", "4.99209 / pow(x + 1.34075, 1.65) + 0.0568024");
469  }
470 
471  if(fReconMethod > 3) fMinPi0Pt = 0.5; //PCM-PCM
472  else if(fReconMethod > 1) fMinPi0Pt = 1.5; //EMCAL-EMCAL
473  else fMinPi0Pt = 1.0; //PCM-EMCAL
474 
475  // Create histograms
476  if(fOutputContainer != NULL){
477  delete fOutputContainer;
478  fOutputContainer = NULL;
479  }
480  if(fOutputContainer == NULL){
481  fOutputContainer = new TList();
482  fOutputContainer->SetOwner(kTRUE);
483  }
484 
485  // Array of current cut's gammas
486  fGammaCandidates = new TList();
487  fClusterCandidates = new TList();
488  fClusterCandidates->SetOwner(kTRUE);
489  fPi0Candidates = new TList();
490  fPi0Candidates->SetOwner(kTRUE);
491 
492  fCutFolder = new TList*[fnCuts];
493  fESDList = new TList*[fnCuts];
494 
495  fHistoNEvents = new TH1F*[fnCuts];
496  fHistoNEventsMinGamma = new TH1F*[fnCuts];
497  if (fIsMC > 1){
498  fHistoNEventsWOWeight = new TH1F*[fnCuts];
499  }
500  if (fIsMC == 2){
501  fProfileJetJetXSection = new TProfile*[fnCuts];
502  fHistoJetJetNTrials = new TH1F*[fnCuts];
503  }
504  fHistoNGoodESDTracks = new TH1F*[fnCuts];
505  fHistoVertexZ = new TH1F*[fnCuts];
506  fHistoNClusterCandidates = new TH1F*[fnCuts];
507  fHistoNGammaCandidates = new TH1F*[fnCuts];
508  if(fIsHeavyIon==2)
509  fProfileEtaShift = new TProfile*[fnCuts];
512  fHistoNV0Tracks = new TH1F*[fnCuts];
513  fHistoConvGammaPt = new TH1F*[fnCuts];
514 
515  if (fDoPhotonQA > 0){
516  fHistoConvGammaR = new TH1F*[fnCuts];
517  fHistoConvGammaEta = new TH1F*[fnCuts];
518  }
519 
522  fHistoGammaFromMotherPt = new TH1F*[fnCuts];
523  if(fReconMethod<2)
525  if(fReconMethod!=2 && fReconMethod!=5)
529 
530  // BG histograms
533 
534  // QA histograms
535  if(fDoMesonQA>0){
540  if(fReconMethod!=2 && fReconMethod!=5)
542  fHistoMotherYPt = new TH2F*[fnCuts];
548  }
549 
550  if(fReconMethod!=5){
552  fHistoClusGammaPt = new TH1F*[fnCuts];
554  }
555 
556  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
557  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
558  TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
559  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
560  TString cutstringNeutralPion = ((AliConversionMesonCuts*)fNeutralPionCutArray->At(iCut))->GetCutNumber();
561  TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
562 
563  fCutFolder[iCut] = new TList();
564  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s_%s_%s_%s",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringNeutralPion.Data(),cutstringMeson.Data()));
565  fCutFolder[iCut]->SetOwner(kTRUE);
566  fOutputContainer->Add(fCutFolder[iCut]);
567  fESDList[iCut] = new TList();
568  fESDList[iCut]->SetName(Form("%s_%s_%s_%s_%s ESD histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringNeutralPion.Data(),cutstringMeson.Data()));
569  fESDList[iCut]->SetOwner(kTRUE);
570  fCutFolder[iCut]->Add(fESDList[iCut]);
571 
572  fHistoNEvents[iCut] = new TH1F("NEvents","NEvents",14,-0.5,13.5);
573  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
574  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
575  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
576  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
577  TString TriggerNames = "Not Trigger: ";
578  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
579  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
580  }else {
581  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
582  }
583  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
584  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
585  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
586  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
587  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
588  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
589  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
590  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
591  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
592  fHistoNEvents[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
593  fESDList[iCut]->Add(fHistoNEvents[iCut]);
594 
595  fHistoNEventsMinGamma[iCut] = new TH1F("NEventsMinGamma","NEventsMinGamma",4,-0.5,3.5);
596  fHistoNEventsMinGamma[iCut]->GetXaxis()->SetBinLabel(1,"2 EMCal 1 PCM");
597  fHistoNEventsMinGamma[iCut]->GetXaxis()->SetBinLabel(2,"2 PCM 1 EMCal");
598  fHistoNEventsMinGamma[iCut]->GetXaxis()->SetBinLabel(3,"3 EMCal");
599  fHistoNEventsMinGamma[iCut]->GetXaxis()->SetBinLabel(4,"3 PCM");
600  fESDList[iCut]->Add(fHistoNEventsMinGamma[iCut]);
601 
602  if (fIsMC > 1){
603  fHistoNEventsWOWeight[iCut] = new TH1F("NEventsWOWeight","NEventsWOWeight",14,-0.5,13.5);
604  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
605  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
606  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(3,"Miss. MC or inc. ev.");
607  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
608  TString TriggerNames = "Not Trigger: ";
609  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
610  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
611  }else {
612  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
613  }
614  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
615  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
616  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
617  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
618  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
619  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
620  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(11,"rejectedForJetJetMC");
621  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
622  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
623  fHistoNEventsWOWeight[iCut]->GetXaxis()->SetBinLabel(14,"Pileup V0M-TPCout Tracks");
624  fESDList[iCut]->Add(fHistoNEventsWOWeight[iCut]);
625  }
626 
627  if (fIsMC == 2){
628  fProfileJetJetXSection[iCut] = new TProfile("XSection","XSection",1,-0.5,0.5);
629  fESDList[iCut]->Add(fProfileJetJetXSection[iCut]);
630  fHistoJetJetNTrials[iCut] = new TH1F("NTrials","#sum{NTrials}",1,0,1);
631  fHistoJetJetNTrials[iCut]->GetXaxis()->SetBinLabel(1,"#sum{NTrials}");
632  fESDList[iCut]->Add(fHistoJetJetNTrials[iCut]);
633  }
634 
635  if(fIsHeavyIon == 1)
636  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks","GoodESDTracks",4000,0,4000);
637  else if(fIsHeavyIon == 2)
638  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks","GoodESDTracks",400,0,400);
639  else
640  fHistoNGoodESDTracks[iCut] = new TH1F("GoodESDTracks","GoodESDTracks",200,0,200);
641  fHistoNGoodESDTracks[iCut]->SetXTitle("# TPC tracks");
642  fESDList[iCut]->Add(fHistoNGoodESDTracks[iCut]);
643 
644  fHistoVertexZ[iCut] = new TH1F("VertexZ","VertexZ",1000,-50,50);
645  fESDList[iCut]->Add(fHistoVertexZ[iCut]);
646 
647  if(fIsHeavyIon == 1)
648  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates","GammaCandidates",100,0,100);
649  else if(fIsHeavyIon == 2)
650  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates","GammaCandidates",50,0,50);
651  else
652  fHistoNGammaCandidates[iCut] = new TH1F("GammaCandidates","GammaCandidates",50,0,50);
653  fHistoNGammaCandidates[iCut]->SetXTitle("# accepted #gamma_{conv}");
654  fESDList[iCut]->Add(fHistoNGammaCandidates[iCut]);
655 
656  fHistoNClusterCandidates[iCut] = new TH1F("ClusterCandidates","ClusterCandidates",50,0,50);
657  fHistoNClusterCandidates[iCut]->SetXTitle("# accepted #gamma_{cluster}");
658  fESDList[iCut]->Add(fHistoNClusterCandidates[iCut]);
659 
660  if(fIsHeavyIon == 1)
661  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",4000,0,4000,100,0,100);
662  else if(fIsHeavyIon == 2)
663  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",400,0,400,50,0,50);
664  else
665  fHistoNGoodESDTracksVsNGammaCandidates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",200,0,200,50,0,50);
666  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetXTitle("# TPC tracks");
667  fHistoNGoodESDTracksVsNGammaCandidates[iCut]->SetYTitle("# accepted #gamma_{conv}");
669 
670  fHistoSPDClusterTrackletBackground[iCut] = new TH2F("SPD tracklets vs SPD clusters","SPD tracklets vs SPD clusters",100,0,200,250,0,1000);
672 
673  if(fIsHeavyIon == 1)
674  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
675  else if(fIsHeavyIon == 2)
676  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
677  else
678  fHistoNV0Tracks[iCut] = new TH1F("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
679  fHistoNV0Tracks[iCut]->SetXTitle("VZERO amp [arb. units]");
680  fESDList[iCut]->Add(fHistoNV0Tracks[iCut]);
681 
682  fHistoConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",500,0,50);
683  fHistoConvGammaPt[iCut]->SetXTitle("p_{T,conv}(GeV/c)");
684  fESDList[iCut]->Add(fHistoConvGammaPt[iCut]);
685 
686  if(fIsHeavyIon == 2){
687  fProfileEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
688  fESDList[iCut]->Add(fProfileEtaShift[iCut]);
689  }
690 
691  if (fIsMC > 1){
692  fHistoNEvents[iCut]->Sumw2();
693  fHistoNEventsMinGamma[iCut]->Sumw2();
694  fHistoNGoodESDTracks[iCut]->Sumw2();
695  fHistoVertexZ[iCut]->Sumw2();
696  fHistoNClusterCandidates[iCut]->Sumw2();
697  fHistoNGammaCandidates[iCut]->Sumw2();
699  fHistoSPDClusterTrackletBackground[iCut]->Sumw2();
700  fHistoNV0Tracks[iCut]->Sumw2();
701  fHistoConvGammaPt[iCut]->Sumw2();
702  }
703 
704  if (fDoPhotonQA > 0){
705  fHistoConvGammaR[iCut] = new TH1F("ESD_ConvGamma_R","ESD_ConvGamma_R",800,0,200);
706  fHistoConvGammaR[iCut]->SetXTitle("R_{conv}(cm)");
707  fESDList[iCut]->Add(fHistoConvGammaR[iCut]);
708  fHistoConvGammaEta[iCut] = new TH1F("ESD_ConvGamma_Eta","ESD_ConvGamma_Eta",2000,-2,2);
709  fHistoConvGammaEta[iCut]->SetXTitle("#eta_{conv}");
710  fESDList[iCut]->Add(fHistoConvGammaEta[iCut]);
711  }
712 
713  if(fReconMethod!=5){
714  fClusterOutputList[iCut] = new TList();
715  fClusterOutputList[iCut]->SetName(Form("%s_%s_%s_%s_%s Cluster Output",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringNeutralPion.Data(),cutstringMeson.Data()));
716  fClusterOutputList[iCut]->SetOwner(1);
717  fCutFolder[iCut]->Add(fClusterOutputList[iCut]);
718 
719  fHistoClusGammaPt[iCut] = new TH1F("ClusGamma_Pt","ClusGamma_Pt",200,0,20);
720  fHistoClusGammaPt[iCut]->SetXTitle("p_{T,clus}(GeV/c)");
721  fClusterOutputList[iCut]->Add(fHistoClusGammaPt[iCut]);
722  fHistoClusOverlapHeadersGammaPt[iCut] = new TH1F("ClusGammaOverlapHeaders_Pt","ClusGammaOverlapHeaders_Pt",200,0,20);
723  fHistoClusOverlapHeadersGammaPt[iCut]->SetXTitle("p_{T,clus}(GeV/c), selected header w/ overlap");
725 
726  if (fIsMC > 1){
727  fHistoClusGammaPt[iCut]->Sumw2();
728  fHistoClusOverlapHeadersGammaPt[iCut]->Sumw2();
729  }
730  }
731 
732  fHistoPhotonPairInvMassPt[iCut] = new TH2F("ESD_PhotonPair_InvMass_Pt","ESD_PhotonPair_InvMass_Pt",800,0,0.8,200,0,20);
733  fHistoPhotonPairInvMassPt[iCut]->SetXTitle("M_{inv, #pi^{0} cand}(GeV/c^{2})");
734  fHistoPhotonPairInvMassPt[iCut]->SetYTitle("p_{T, #pi^{0} cand}(GeV/c)");
735  fESDList[iCut]->Add(fHistoPhotonPairInvMassPt[iCut]);
736 
737  fHistoMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",800,0.4,1.2,200,0,20);
738  fHistoMotherInvMassPt[iCut]->SetXTitle("M_{inv, #omega cand}(GeV/c^{2})");
739  fHistoMotherInvMassPt[iCut]->SetYTitle("p_{T, #omega cand}(GeV/c)");
740  fESDList[iCut]->Add(fHistoMotherInvMassPt[iCut]);
741 
742  fHistoGammaFromMotherPt[iCut] = new TH1F("ESD_GammaFromMother_Pt","ESD_GammaFromMother_Pt",200,0,20);
743  fHistoGammaFromMotherPt[iCut]->SetXTitle("p_{T, #gamma from #omega cand}(GeV/c)");
744  fESDList[iCut]->Add(fHistoGammaFromMotherPt[iCut]);
745 
746  if(fReconMethod!=2 && fReconMethod!=5){
747  fHistoMotherMatchedInvMassPt[iCut] = new TH2F("ESD_Mother_Matched_InvMass_Pt","ESD_Mother_Matched_InvMass_Pt",800,0.4,1.2,200,0,20);
748  fHistoMotherMatchedInvMassPt[iCut]->SetXTitle("M_{inv, #omega matched}(GeV/c^{2})");
749  fHistoMotherMatchedInvMassPt[iCut]->SetYTitle("p_{T, #omega matched}(GeV/c)");
750  fESDList[iCut]->Add(fHistoMotherMatchedInvMassPt[iCut]);
751  }
752 
754  fHistoMotherAngleCutRejectedInvMassPt[iCut] = new TH2F("ESD_Mother_AngleCutRejected_InvMass_Pt","ESD_Mother_AngleCutRejected_InvMass_Pt",800,0.4,1.2,200,0,20);
755  fHistoMotherAngleCutRejectedInvMassPt[iCut]->SetXTitle("M_{inv, #omega rejected}(GeV/c^{2})");
756  fHistoMotherAngleCutRejectedInvMassPt[iCut]->SetYTitle("p_{T, #omega rejected}(GeV/c)");
758  }
759 
760  if(fReconMethod<2){
761  fHistoPhotonPairMatchedInvMassPt[iCut] = new TH2F("ESD_PhotonPair_Matched_InvMass_Pt","ESD_PhotonPair_Matched_InvMass_Pt",800,0,0.8,200,0,20);
762  fHistoPhotonPairMatchedInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2}) matched conv e^{+/-}to cluster");
763  fHistoPhotonPairMatchedInvMassPt[iCut]->SetYTitle("p_{T}(GeV/c)");
764  fESDList[iCut]->Add(fHistoPhotonPairMatchedInvMassPt[iCut]);
765  }
766 
767  fHistoDiffPi0SameGammaBackInvMassPt[iCut] = new TH2F("ESD_Mother_DiffPi0SameGamma_InvMass_Pt","ESD_Mother_DiffPi0SameGamma_InvMass_Pt",800,0.4,1.2,200,0,20);
768  fHistoDiffPi0SameGammaBackInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2})");
769  fHistoDiffPi0SameGammaBackInvMassPt[iCut]->SetYTitle("p_{T}(GeV/c)");
771 
772  fHistoSamePi0DiffGammaBackInvMassPt[iCut] = new TH2F("ESD_Mother_SamePi0DiffGamma_InvMass_Pt","ESD_Mother_SamePi0DiffGamma_InvMass_Pt",800,0.4,1.2,200,0,20);
773  fHistoSamePi0DiffGammaBackInvMassPt[iCut]->SetXTitle("M_{inv}(GeV/c^{2})");
774  fHistoSamePi0DiffGammaBackInvMassPt[iCut]->SetYTitle("p_{T}(GeV/c)");
776 
777  if (fIsMC > 1){
778  fHistoPhotonPairInvMassPt[iCut]->Sumw2();
779  fHistoMotherInvMassPt[iCut]->Sumw2();
780  fHistoGammaFromMotherPt[iCut]->Sumw2();
781  if(fReconMethod!=2 && fReconMethod!=5) fHistoMotherMatchedInvMassPt[iCut]->Sumw2();
783  if(fReconMethod<2) fHistoPhotonPairMatchedInvMassPt[iCut]->Sumw2();
786  }
787 
788  if(fDoMesonQA>0){
789  fHistoPhotonPairYPt[iCut] = new TH2F("ESD_PhotonPair_Y_Pt","ESD_PhotonPair_Y_Pt",300,0.03,30.,150,-1.5,1.5);
790  fHistoPhotonPairYPt[iCut]->SetXTitle("p_{T, #pi^{0}cand}(GeV/c)");
791  fHistoPhotonPairYPt[iCut]->SetYTitle("y_{#pi^{0}cand}");
793  fESDList[iCut]->Add(fHistoPhotonPairYPt[iCut]);
794 
795  fHistoPhotonPairAlphaPt[iCut] = new TH2F("ESD_PhotonPair_Alpha_Pt","ESD_PhotonPair_Alpha_Pt",300,0.03,30.,200,-1,1);
796  fHistoPhotonPairAlphaPt[iCut]->SetXTitle("p_{T, #pi^{0}cand}(GeV/c)");
797  fHistoPhotonPairAlphaPt[iCut]->SetYTitle("#alpha_{#pi^{0}cand}");
799  fESDList[iCut]->Add(fHistoPhotonPairAlphaPt[iCut]);
800 
801  fHistoPhotonPairOpenAnglePt[iCut] = new TH2F("ESD_PhotonPair_OpenAngle_Pt","ESD_PhotonPair_OpenAngle_Pt",300,0.03,30.,100,0,1);
802  fHistoPhotonPairOpenAnglePt[iCut]->SetXTitle("p_{T, #pi^{0}cand}(GeV/c)");
803  fHistoPhotonPairOpenAnglePt[iCut]->SetYTitle("#theta_{#pi^{0}cand}");
805  fESDList[iCut]->Add(fHistoPhotonPairOpenAnglePt[iCut]);
806 
807  fHistoPhotonPairEtaPhi[iCut] = new TH2F("ESD_PhotonPair_Eta_Phi","ESD_PhotonPair_Eta_Phi",600,0,2*TMath::Pi(),200,-1,1);
808  fHistoPhotonPairEtaPhi[iCut]->SetXTitle("#phi_{#pi^{0}cand}(rad)");
809  fHistoPhotonPairEtaPhi[iCut]->SetYTitle("#eta_{#pi^{0}cand}");
810  fESDList[iCut]->Add(fHistoPhotonPairEtaPhi[iCut]);
811 
812  if(fReconMethod!=2 && fReconMethod!=5){
813  fHistoMotherConvPhotonEtaPhi[iCut] = new TH2F("ESD_MotherConvPhoton_Eta_Phi","ConvPhoton under #omega peak",600,0,2*TMath::Pi(),200,-1,1);
814  fHistoMotherConvPhotonEtaPhi[iCut]->SetXTitle("#phi_{#gamma_{conv}}(rad)");
815  fHistoMotherConvPhotonEtaPhi[iCut]->SetYTitle("#eta_{#gamma_{conv}}");
816  fESDList[iCut]->Add(fHistoMotherConvPhotonEtaPhi[iCut]);
817  }
818 
819  fHistoMotherYPt[iCut] = new TH2F("ESD_Mother_Y_Pt","ESD_Mother_Y_Pt",200,0,20,150,-1.5,1.5);
820  fHistoMotherYPt[iCut]->SetYTitle("y_{#omega cand}");
821  fHistoMotherYPt[iCut]->SetXTitle("p_{T, #omega cand}(GeV/c)");
822  fESDList[iCut]->Add(fHistoMotherYPt[iCut]);
823 
824  fHistoMotherAlphaPt[iCut] = new TH2F("ESD_Mother_Alpha_Pt","ESD_Mother_Alpha_Pt",200,0,20,200,-1,1);
825  fHistoMotherAlphaPt[iCut]->SetXTitle("p_{T, #omega cand}(GeV/c)");
826  fHistoMotherAlphaPt[iCut]->SetYTitle("#alpha_{#omega cand}");
827  fESDList[iCut]->Add(fHistoMotherAlphaPt[iCut]);
828 
829  fHistoMotherEtaPhi[iCut] = new TH2F("ESD_Mother_Eta_Phi","ESD_Mother_Eta_Phi",600,0,2*TMath::Pi(),200,-1,1);
830  fHistoMotherEtaPhi[iCut]->SetXTitle("#phi_{#omega cand}(rad)");
831  fHistoMotherEtaPhi[iCut]->SetYTitle("#eta_{#omega cand}");
832  fESDList[iCut]->Add(fHistoMotherEtaPhi[iCut]);
833 
834  fHistoMotherPi0AnglePt[iCut] = new TH2F("ESD_MotherPi0_Angle_Pt","ESD_MotherPi0_Angle_Pt",200,0,20,360,0,TMath::Pi());
835  fHistoMotherPi0AnglePt[iCut]->SetXTitle("#omega p_{T}(GeV/c)");
836  fHistoMotherPi0AnglePt[iCut]->SetYTitle("#theta_{#omega cand, pi^{0}cand}");
837  fESDList[iCut]->Add(fHistoMotherPi0AnglePt[iCut]);
838 
839  fHistoMotherGammaAnglePt[iCut] = new TH2F("ESD_MotherGamma_Angle_Pt","ESD_MotherGamma_Angle_Pt",200,0,20,360,0,TMath::Pi());
840  fHistoMotherGammaAnglePt[iCut]->SetXTitle("#omega p_{T}(GeV/c)");
841  fHistoMotherGammaAnglePt[iCut]->SetYTitle("#theta_{#omega cand, #gamma}");
842  fESDList[iCut]->Add(fHistoMotherGammaAnglePt[iCut]);
843 
844  fHistoPi0GammaAnglePt[iCut] = new TH2F("ESD_Pi0Gamma_Angle_Pt","ESD_Pi0Gamma_Angle_Pt",200,0,20,360,0,TMath::Pi());
845  fHistoPi0GammaAnglePt[iCut]->SetXTitle("#omega p_{T}(GeV/c)");
846  fHistoPi0GammaAnglePt[iCut]->SetYTitle("#theta_{#pi^{0}cand,#gamma}");
847  fESDList[iCut]->Add(fHistoPi0GammaAnglePt[iCut]);
848 
849  if (fIsMC > 1){
850  fHistoPhotonPairYPt[iCut]->Sumw2();
851  fHistoPhotonPairAlphaPt[iCut]->Sumw2();
852  fHistoPhotonPairOpenAnglePt[iCut]->Sumw2();
853  fHistoPhotonPairEtaPhi[iCut]->Sumw2();
854  if(fReconMethod!=2 && fReconMethod!=5) fHistoMotherConvPhotonEtaPhi[iCut]->Sumw2();
855  fHistoMotherYPt[iCut]->Sumw2();
856  fHistoMotherPi0AnglePt[iCut]->Sumw2();
857  fHistoMotherGammaAnglePt[iCut]->Sumw2();
858  fHistoMotherAlphaPt[iCut]->Sumw2();
859  fHistoMotherEtaPhi[iCut]->Sumw2();
860  fHistoPi0GammaAnglePt[iCut]->Sumw2();
861  }
862  }
863  }
864 
865  InitBack(); // Init Background Handler
866 
867  if(fIsMC>0){
868  // MC Histogramms
869  fMCList = new TList*[fnCuts];
870  // True Histogramms
871  fTrueList = new TList*[fnCuts];
872 
873  fHistoMCAllGammaPt = new TH1F*[fnCuts];
874  fHistoMCAllGammaEMCALAccPt = new TH1F*[fnCuts];
875  fHistoMCConvGammaPt = new TH1F*[fnCuts];
881  fHistoMCPi0Pt = new TH1F*[fnCuts];
882  fHistoMCPi0WOWeightPt = new TH1F*[fnCuts];
883  fHistoMCPi0InAccPt = new TH1F*[fnCuts];
884  fHistoMCPi0WOWeightInAccPt = new TH1F*[fnCuts];
885  if (fIsMC > 1){
886  fHistoMCPi0WOEvtWeightPt = new TH1F*[fnCuts];
887  }
888  fHistoMCGammaFromAllOmegaPt = new TH1F*[fnCuts];
890  fHistoMCOmegaDecayChannels = new TH1F*[fnCuts];
891 
892  if(fDoMesonQA>0){
915  fHistoMCPi0PtY = new TH2F*[fnCuts];
917  if (fIsMC == 2){
919  }
920  }
921 
922  if (fDoPhotonQA > 0){
923  fHistoMCConvGammaR = new TH1F*[fnCuts];
924  fHistoMCConvGammaEta = new TH1F*[fnCuts];
925  }
926 
929  fHistoTrueGammaFromOmegaPt = new TH1F*[fnCuts];
930 
931  if(fDoMesonQA>0){
944  }
945 
946  fHistoMultipleCountTruePi0 = new TH1F*[fnCuts];
947 
948  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
949  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
950  TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
951  TString cutstringCalo = ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber();
952  TString cutstringNeutralPion = ((AliConversionMesonCuts*)fNeutralPionCutArray->At(iCut))->GetCutNumber();
953  TString cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
954 
955  fMCList[iCut] = new TList();
956  fMCList[iCut]->SetName(Form("%s_%s_%s_%s_%s MC histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringNeutralPion.Data(),cutstringMeson.Data()));
957  fMCList[iCut]->SetOwner(kTRUE);
958  fCutFolder[iCut]->Add(fMCList[iCut]);
959 
960  fHistoMCAllGammaPt[iCut] = new TH1F("MC_AllGamma_Pt","MC_AllGamma_Pt",200,0,20);
961  fMCList[iCut]->Add(fHistoMCAllGammaPt[iCut]);
962  fHistoMCAllGammaEMCALAccPt[iCut] = new TH1F("MC_AllGammaEMCALAcc_Pt","MC_AllGammaEMCALAcc_Pt",200,0,20);
963  fMCList[iCut]->Add(fHistoMCAllGammaEMCALAccPt[iCut]);
964  fHistoMCConvGammaPt[iCut] = new TH1F("MC_ConvGamma_Pt","MC_ConvGamma_Pt",500,0,50);
965  fMCList[iCut]->Add(fHistoMCConvGammaPt[iCut]);
966 
967  if (fIsMC > 1){
968  fHistoMCAllGammaPt[iCut]->Sumw2();
969  fHistoMCAllGammaEMCALAccPt[iCut]->Sumw2();
970  fHistoMCConvGammaPt[iCut]->Sumw2();
971  }
972 
973  if (fDoPhotonQA > 0){
974  fHistoMCConvGammaR[iCut] = new TH1F("MC_ConvGamma_R","MC_ConvGamma_R",800,0,200);
975  fMCList[iCut]->Add(fHistoMCConvGammaR[iCut]);
976  fHistoMCConvGammaEta[iCut] = new TH1F("MC_ConvGamma_Eta","MC_ConvGamma_Eta",2000,-2,2);
977  fMCList[iCut]->Add(fHistoMCConvGammaEta[iCut]);
978  }
979 
980  fHistoMCPi0Pt[iCut] = new TH1F("MC_Pi0_Pt","MC_Pi0_Pt",200,0,20);
981  fHistoMCPi0Pt[iCut]->Sumw2();
982  fMCList[iCut]->Add(fHistoMCPi0Pt[iCut]);
983  fHistoMCPi0WOWeightPt[iCut] = new TH1F("MC_Pi0_WOWeights_Pt","MC_Pi0_WOWeights_Pt",200,0,20);
984  fMCList[iCut]->Add(fHistoMCPi0WOWeightPt[iCut]);
985 
986  fHistoMCPi0InAccPt[iCut] = new TH1F("MC_Pi0InAcc_Pt","MC_Pi0InAcc_Pt",200,0,20);
987  fHistoMCPi0InAccPt[iCut]->Sumw2();
988  fMCList[iCut]->Add(fHistoMCPi0InAccPt[iCut]);
989  fHistoMCPi0WOWeightInAccPt[iCut] = new TH1F("MC_Pi0WOWeightInAcc_Pt","MC_Pi0WOWeightInAcc_Pt",200,0,20);
990  fMCList[iCut]->Add(fHistoMCPi0WOWeightInAccPt[iCut]);
991 
992  fHistoMCGammaFromAllOmegaPt[iCut] = new TH1F("MC_GammaFromAllOmega_Pt","MC_GammaFromAllOmega_Pt",200,0,20);
993  fHistoMCGammaFromAllOmegaPt[iCut]->SetXTitle("p_{T, #gamma}(GeV/c)");
994  fMCList[iCut]->Add(fHistoMCGammaFromAllOmegaPt[iCut]);
995 
996  fHistoMCGammaFromOmegaInAccPt[iCut] = new TH1F("MC_GammaFromOmegaInAcc_Pt","MC_GammaFromOmegaInAcc_Pt",200,0,20);
997  fHistoMCGammaFromOmegaInAccPt[iCut]->SetXTitle("p_{T, #gamma}(GeV/c)");
998  fMCList[iCut]->Add(fHistoMCGammaFromOmegaInAccPt[iCut]);
999 
1000  fHistoMCOmegaDecayChannels[iCut] = new TH1F("MC_OmegaDecayChannels","MC_OmegaDecayChannels",3,-0.5,2.5);
1001  fHistoMCOmegaDecayChannels[iCut]->GetXaxis()->SetBinLabel(1,"PiPlPiMiPiZero");
1002  fHistoMCOmegaDecayChannels[iCut]->GetXaxis()->SetBinLabel(2,"PiZeroGamma");
1003  fHistoMCOmegaDecayChannels[iCut]->GetXaxis()->SetBinLabel(3,"Others");
1004  fMCList[iCut]->Add(fHistoMCOmegaDecayChannels[iCut]);
1005 
1006  fHistoMCAllOmegaInvMassPt[iCut] = new TH2F("MC_AllOmega_InvMass_Pt","MC_AllOmega_InvMass_Pt",800,0.4,1.2,200,0,20);
1007  fHistoMCAllOmegaInvMassPt[iCut]->SetXTitle("M_{inv,#omega}(GeV/c^{2})");
1008  fHistoMCAllOmegaInvMassPt[iCut]->SetYTitle("#omega p_{T}(GeV/c)");
1009  fMCList[iCut]->Add(fHistoMCAllOmegaInvMassPt[iCut]);
1010 
1011  fHistoMCPi0FromAllOmegaInvMassPt[iCut] = new TH2F("MC_Pi0FromAllOmega_InvMass_Pt","MC_Pi0FromAllOmega_InvMass_Pt",800,0,0.8,200,0,20);
1012  fHistoMCPi0FromAllOmegaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1013  fHistoMCPi0FromAllOmegaInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T}(GeV/c)");
1014  fMCList[iCut]->Add(fHistoMCPi0FromAllOmegaInvMassPt[iCut]);
1015 
1016  fHistoMCPi0FromOmegaInAccInvMassPt[iCut] = new TH2F("MC_Pi0FromOmegaInAcc_InvMass_Pt","MC_Pi0FromOmegaInAcc_InvMass_Pt",800,0,0.8,200,0,20);
1017  fHistoMCPi0FromOmegaInAccInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1018  fHistoMCPi0FromOmegaInAccInvMassPt[iCut]->SetYTitle("#pi^{0} p_{T}(GeV/c)");
1019  fMCList[iCut]->Add(fHistoMCPi0FromOmegaInAccInvMassPt[iCut]);
1020 
1021  fHistoMCOmegaInvMassPt[iCut] = new TH2F("MC_OmegaInvMass_Pt","MC_OmegaInvMass_Pt",800,0.4,1.2,200,0,20);
1022  fHistoMCOmegaInvMassPt[iCut]->SetXTitle("M_{inv,#omega}(GeV/c^{2})");
1023  fHistoMCOmegaInvMassPt[iCut]->SetYTitle("#omega p_{T}(GeV/c)");
1024  fMCList[iCut]->Add(fHistoMCOmegaInvMassPt[iCut]);
1025 
1026  fHistoMCOmegaInAccInvMassPt[iCut] = new TH2F("MC_OmegaInAcc_InvMass_Pt","MC_OmegaInAcc_InvMass_Pt",800,0.4,1.2,200,0,20);
1027  fHistoMCOmegaInAccInvMassPt[iCut]->SetXTitle("M_{inv,#omega}(GeV/c^{2})");
1028  fHistoMCOmegaInAccInvMassPt[iCut]->SetYTitle("#omega p_{T}(GeV/c)");
1029  fMCList[iCut]->Add(fHistoMCOmegaInAccInvMassPt[iCut]);
1030 
1031  if(fDoMesonQA>0){
1032  fHistoMCAllOmegaYPt[iCut] = new TH2F("MC_AllOmega_Y_Pt","MC_AllOmega_Y_Pt",200,0,20,150,-1.5,1.5);
1033  fHistoMCAllOmegaYPt[iCut]->SetXTitle("p_{T,#omega}(GeV/c)");
1034  fHistoMCAllOmegaYPt[iCut]->SetYTitle("Y_{#omega}");
1035  fMCList[iCut]->Add(fHistoMCAllOmegaYPt[iCut]);
1036 
1037  fHistoMCOmegaInAccYPt[iCut] = new TH2F("MC_OmegaInAcc_Y_Pt","MC_OmegaInAcc_Y_Pt",200,0,20,150,-1.5,1.5);
1038  fHistoMCOmegaInAccYPt[iCut]->SetXTitle("p_{T,#omega}(GeV/c)");
1039  fHistoMCOmegaInAccYPt[iCut]->SetYTitle("Y_{#omega}");
1040  fMCList[iCut]->Add(fHistoMCOmegaInAccYPt[iCut]);
1041 
1042  fHistoMCAllOmegaAlphaPt[iCut] = new TH2F("MC_AllOmega_Alpha_Pt","MC_AllOmega_Alpha_Pt",200,0,20,200,-1,1);
1043  fHistoMCAllOmegaAlphaPt[iCut]->SetXTitle("p_{T,#omega}(GeV/c)");
1044  fHistoMCAllOmegaAlphaPt[iCut]->SetYTitle("#alpha_{#omega}");
1045  fMCList[iCut]->Add(fHistoMCAllOmegaAlphaPt[iCut]);
1046 
1047  fHistoMCOmegaInAccAlphaPt[iCut] = new TH2F("MC_OmegaInAcc_Alpha_Pt","MC_OmegaInAcc_Alpha_Pt",200,0,20,200,-1,1);
1048  fHistoMCOmegaInAccAlphaPt[iCut]->SetXTitle("p_{T,#omega}(GeV/c)");
1049  fHistoMCOmegaInAccAlphaPt[iCut]->SetYTitle("#alpha_{#omega}");
1050  fMCList[iCut]->Add(fHistoMCOmegaInAccAlphaPt[iCut]);
1051 
1052  fHistoMCPi0FromAllOmegaAlphaPt[iCut] = new TH2F("MC_Pi0FromAllOmega_Alpha_Pt","MC_Pi0FromAllOmega_Alpha_Pt",200,0,20,200,-1,1);
1053  fHistoMCPi0FromAllOmegaAlphaPt[iCut]->SetXTitle("p_{T,#pi^{0}}(GeV/c)");
1054  fHistoMCPi0FromAllOmegaAlphaPt[iCut]->SetYTitle("#alpha_{#pi^{0}}");
1055  fMCList[iCut]->Add(fHistoMCPi0FromAllOmegaAlphaPt[iCut]);
1056 
1057  fHistoMCPi0FromOmegaInAccAlphaPt[iCut] = new TH2F("MC_Pi0FromOmegaInAcc_Alpha_Pt","MC_Pi0FromOmegaInAcc_Alpha_Pt",200,0,20,200,-1,1);
1058  fHistoMCPi0FromOmegaInAccAlphaPt[iCut]->SetXTitle("p_{T,#pi^{0}}(GeV/c)");
1059  fHistoMCPi0FromOmegaInAccAlphaPt[iCut]->SetYTitle("#alpha_{#pi^{0}}");
1060  fMCList[iCut]->Add(fHistoMCPi0FromOmegaInAccAlphaPt[iCut]);
1061 
1062  fHistoMCPi0FromAllOmegaYPt[iCut] = new TH2F("MC_Pi0FromAllOmega_Y_Pt","MC_Pi0FromAllOmega_Y_Pt",200,0,20,150,-1.5,1.5);
1063  fHistoMCPi0FromAllOmegaYPt[iCut]->SetXTitle("p_{T,#pi^{0}}(GeV/c)");
1064  fHistoMCPi0FromAllOmegaYPt[iCut]->SetYTitle("Y_{#pi^{0}}");
1065  fMCList[iCut]->Add(fHistoMCPi0FromAllOmegaYPt[iCut]);
1066 
1067  fHistoMCPi0FromOmegaInAccYPt[iCut] = new TH2F("MC_Pi0FromOmegaInAcc_Y_Pt","MC_Pi0FromOmegaInAcc_Y_Pt",200,0,20,150,-1.5,1.5);
1068  fHistoMCPi0FromOmegaInAccYPt[iCut]->SetXTitle("p_{T,#pi^{0}}(GeV/c)");
1069  fHistoMCPi0FromOmegaInAccYPt[iCut]->SetYTitle("Y_{#pi^{0}}");
1070  fMCList[iCut]->Add(fHistoMCPi0FromOmegaInAccYPt[iCut]);
1071 
1072  fHistoMCPi0FromAllOmegaEtaPhi[iCut] = new TH2F("MC_Pi0FromAllOmega_Eta_Phi","MC_Pi0FromAllOmega_Eta_Phi",600,0,2*TMath::Pi(),200,-1,1);
1073  fHistoMCPi0FromAllOmegaEtaPhi[iCut]->SetXTitle("#phi_{#pi^{0}}(rad)");
1074  fHistoMCPi0FromAllOmegaEtaPhi[iCut]->SetYTitle("#eta_{#pi^{0}}");
1075  fMCList[iCut]->Add(fHistoMCPi0FromAllOmegaEtaPhi[iCut]);
1076 
1077  fHistoMCPi0FromOmegaInAccEtaPhi[iCut] = new TH2F("MC_Pi0FromOmegaInAcc_Eta_Phi","MC_Pi0FromOmegaInAcc_Eta_Phi",600,0,2*TMath::Pi(),200,-1,1);
1078  fHistoMCPi0FromOmegaInAccEtaPhi[iCut]->SetXTitle("#phi_{#pi^{0}}(rad)");
1079  fHistoMCPi0FromOmegaInAccEtaPhi[iCut]->SetYTitle("#eta_{#pi^{0}}");
1080  fMCList[iCut]->Add(fHistoMCPi0FromOmegaInAccEtaPhi[iCut]);
1081 
1082  fHistoMCAllOmegaEtaPhi[iCut] = new TH2F("MC_AllOmega_Eta_Phi","MC_AllOmega_Eta_Phi",600,0,2*TMath::Pi(),200,-1,1);
1083  fHistoMCAllOmegaEtaPhi[iCut]->SetXTitle("#phi_{#omega}(rad)");
1084  fHistoMCAllOmegaEtaPhi[iCut]->SetYTitle("#eta_{#omega}");
1085  fMCList[iCut]->Add(fHistoMCAllOmegaEtaPhi[iCut]);
1086 
1087  fHistoMCOmegaInAccEtaPhi[iCut] = new TH2F("MC_OmegaInAcc_Eta_Phi","MC_OmegaInAcc_Eta_Phi",600,0,2*TMath::Pi(),200,-1,1);
1088  fHistoMCOmegaInAccEtaPhi[iCut]->SetXTitle("#phi_{#omega}(rad)");
1089  fHistoMCOmegaInAccEtaPhi[iCut]->SetYTitle("#eta_{#omega}");
1090  fMCList[iCut]->Add(fHistoMCOmegaInAccEtaPhi[iCut]);
1091 
1092  fHistoMCAllOmegaPiZeroAnglePt[iCut] = new TH2F("MC_AllOmegaPiZero_Angle_Pt","MC_AllOmegaPiZero_Angle_Pt",200,0,20,360,0,TMath::Pi());
1093  fHistoMCAllOmegaPiZeroAnglePt[iCut]->SetYTitle("#theta_{#omega,#pi^{0}}");
1094  fHistoMCAllOmegaPiZeroAnglePt[iCut]->SetXTitle("#omega p_{T}(GeV/c)");
1095  fMCList[iCut]->Add(fHistoMCAllOmegaPiZeroAnglePt[iCut]);
1096 
1097  fHistoMCAllPiZeroGammaAnglePt[iCut] = new TH2F("MC_AllPiZeroGamma_Angle_Pt","MC_AllPiZeroGamma_Angle_Pt",200,0,20,360,0,TMath::Pi());
1098  fHistoMCAllPiZeroGammaAnglePt[iCut]->SetXTitle("#omega p_{T}(GeV/c)");
1099  fHistoMCAllPiZeroGammaAnglePt[iCut]->SetYTitle("#theta_{#pi^{0},#gamma}");
1100  fMCList[iCut]->Add(fHistoMCAllPiZeroGammaAnglePt[iCut]);
1101 
1102  fHistoMCAllOmegaGammaAnglePt[iCut] = new TH2F("MC_AllOmegaGamma_Angle_Pt","MC_AllOmegaGamma_Angle_Pt",200,0,20,360,0,TMath::Pi());
1103  fHistoMCAllOmegaGammaAnglePt[iCut]->SetXTitle("#omega p_{T}(GeV/c)");
1104  fHistoMCAllOmegaGammaAnglePt[iCut]->SetYTitle("#theta_{#omega,#gamma}");
1105  fMCList[iCut]->Add(fHistoMCAllOmegaGammaAnglePt[iCut]);
1106 
1107  fHistoMCInAccOmegaPiZeroAnglePt[iCut] = new TH2F("MC_InAccOmegaPiZero_Angle_Pt","MC_InAccOmegaPiZero_Angle_Pt",200,0,20,360,0,TMath::Pi());
1108  fHistoMCInAccOmegaPiZeroAnglePt[iCut]->SetXTitle("p_{T,#omega}(GeV/c)");
1109  fHistoMCInAccOmegaPiZeroAnglePt[iCut]->SetYTitle("#theta_{#omega,#pi^{0}}");
1110  fMCList[iCut]->Add(fHistoMCInAccOmegaPiZeroAnglePt[iCut]);
1111 
1112  fHistoMCInAccPiZeroGammaAnglePt[iCut] = new TH2F("MC_InAccPiZeroGamma_Angle_Pt","MC_InAccPiZeroGamma_Angle_Pt",200,0,20,360,0,TMath::Pi());
1113  fHistoMCInAccPiZeroGammaAnglePt[iCut]->SetXTitle("p_{T,#omega}(GeV/c)");
1114  fHistoMCInAccPiZeroGammaAnglePt[iCut]->SetYTitle("#theta_{#pi^{0},#gamma}");
1115  fMCList[iCut]->Add(fHistoMCInAccPiZeroGammaAnglePt[iCut]);
1116 
1117  fHistoMCInAccOmegaGammaAnglePt[iCut] = new TH2F("MC_InAccOmegaGamma_Angle_Pt","MC_InAccOmegaGamma_Angle_Pt",200,0,20,360,0,TMath::Pi());
1118  fHistoMCInAccOmegaGammaAnglePt[iCut]->SetXTitle("p_{T,#omega}(GeV/c)");
1119  fHistoMCInAccOmegaGammaAnglePt[iCut]->SetYTitle("#theta_{#omega,#gamma}");
1120  fMCList[iCut]->Add(fHistoMCInAccOmegaGammaAnglePt[iCut]);
1121 
1122  fHistoMCAllOmegaPtPi0Pt[iCut] = new TH2F("MC_All_OmegaPt_Pi0Pt","MC_All_OmegaPt_Pi0Pt",200,0,20,200,0,20);
1123  fHistoMCAllOmegaPtPi0Pt[iCut]->SetXTitle("#omega p_{T}(GeV/c)");
1124  fHistoMCAllOmegaPtPi0Pt[iCut]->SetYTitle("#pi^{0} p_{T}(GeV/c)");
1125  fMCList[iCut]->Add(fHistoMCAllOmegaPtPi0Pt[iCut]);
1126 
1127  fHistoMCInAccOmegaPtPi0Pt[iCut] = new TH2F("MC_InAcc_OmegaPt_Pi0Pt","MC_InAcc_OmegaPt_Pi0Pt",200,0,20,200,0,20);
1128  fHistoMCInAccOmegaPtPi0Pt[iCut]->SetXTitle("#omega p_{T}(GeV/c)");
1129  fHistoMCInAccOmegaPtPi0Pt[iCut]->SetYTitle("#pi^{0} p_{T}(GeV/c)");
1130  fMCList[iCut]->Add(fHistoMCInAccOmegaPtPi0Pt[iCut]);
1131 
1132  fHistoMCAllOmegaPtGammaPt[iCut] = new TH2F("MC_All_OmegaPt_GammaPt","MC_All_OmegaPt_GammaPt",200,0,20,200,0,20);
1133  fHistoMCAllOmegaPtGammaPt[iCut]->SetXTitle("#omega p_{T}(GeV/c)");
1134  fHistoMCAllOmegaPtGammaPt[iCut]->SetYTitle("#gamma p_{T}(GeV/c)");
1135  fMCList[iCut]->Add(fHistoMCAllOmegaPtGammaPt[iCut]);
1136 
1137  fHistoMCInAccOmegaPtGammaPt[iCut] = new TH2F("MC_InAcc_OmegaPt_GammaPt","MC_InAcc_OmegaPt_GammaPt",200,0,20,200,0,20);
1138  fHistoMCInAccOmegaPtGammaPt[iCut]->SetXTitle("#omega p_{T}(GeV/c)");
1139  fHistoMCInAccOmegaPtGammaPt[iCut]->SetYTitle("#gamma p_{T}(GeV/c)");
1140  fMCList[iCut]->Add(fHistoMCInAccOmegaPtGammaPt[iCut]);
1141 
1142  fHistoMCPi0PtY[iCut] = new TH2F("MC_Pi0_Pt_Y","MC_Pi0_Pt_Y",300,0.03,30.,150,-1.5,1.5);
1143  fHistoMCPi0PtY[iCut]->Sumw2();
1145  fMCList[iCut]->Add(fHistoMCPi0PtY[iCut]);
1146 
1147  fHistoMCPi0PtAlpha[iCut] = new TH2F("MC_Pi0_Pt_Alpha","MC_Pi0_Pt_Alpha",300,0.03,30.,200,-1,1);
1149  fMCList[iCut]->Add(fHistoMCPi0PtAlpha[iCut]);
1150 
1151  if (fIsMC > 1){
1152  fHistoMCPi0PtAlpha[iCut]->Sumw2();
1153  fHistoMCAllOmegaYPt[iCut]->Sumw2();
1154  fHistoMCOmegaInAccYPt[iCut]->Sumw2();
1155  fHistoMCAllOmegaAlphaPt[iCut]->Sumw2();
1156  fHistoMCOmegaInAccAlphaPt[iCut]->Sumw2();
1157  fHistoMCPi0FromAllOmegaAlphaPt[iCut]->Sumw2();
1158  fHistoMCPi0FromOmegaInAccAlphaPt[iCut]->Sumw2();
1159  fHistoMCPi0FromAllOmegaYPt[iCut]->Sumw2();
1160  fHistoMCPi0FromOmegaInAccYPt[iCut]->Sumw2();
1161  fHistoMCPi0FromAllOmegaEtaPhi[iCut]->Sumw2();
1162  fHistoMCPi0FromOmegaInAccEtaPhi[iCut]->Sumw2();
1163  fHistoMCAllOmegaEtaPhi[iCut]->Sumw2();
1164  fHistoMCOmegaInAccEtaPhi[iCut]->Sumw2();
1165  fHistoMCAllOmegaPiZeroAnglePt[iCut]->Sumw2();
1166  fHistoMCAllPiZeroGammaAnglePt[iCut]->Sumw2();
1167  fHistoMCAllOmegaGammaAnglePt[iCut]->Sumw2();
1168  fHistoMCInAccOmegaPiZeroAnglePt[iCut]->Sumw2();
1169  fHistoMCInAccPiZeroGammaAnglePt[iCut]->Sumw2();
1170  fHistoMCInAccOmegaGammaAnglePt[iCut]->Sumw2();
1171  fHistoMCAllOmegaPtPi0Pt[iCut]->Sumw2();
1172  fHistoMCInAccOmegaPtPi0Pt[iCut]->Sumw2();
1173  fHistoMCAllOmegaPtGammaPt[iCut]->Sumw2();
1174  fHistoMCInAccOmegaPtGammaPt[iCut]->Sumw2();
1175  }
1176  }
1177 
1178  if (fIsMC > 1){
1179  fHistoMCPi0WOWeightPt[iCut]->Sumw2();
1180  fHistoMCPi0WOWeightInAccPt[iCut]->Sumw2();
1181  fHistoMCPi0WOEvtWeightPt[iCut] = new TH1F("MC_Pi0_WOEventWeights_Pt","MC_Pi0_WOEventWeights_Pt",400,0,40);
1182  fMCList[iCut]->Add(fHistoMCPi0WOEvtWeightPt[iCut]);
1183  fHistoMCGammaFromAllOmegaPt[iCut]->Sumw2();
1184  fHistoMCGammaFromOmegaInAccPt[iCut]->Sumw2();
1185  fHistoMCOmegaInAccInvMassPt[iCut]->Sumw2();
1186  fHistoMCOmegaInvMassPt[iCut]->Sumw2();
1187  fHistoMCAllOmegaInvMassPt[iCut]->Sumw2();
1188  fHistoMCPi0FromAllOmegaInvMassPt[iCut]->Sumw2();
1189  fHistoMCPi0FromOmegaInAccInvMassPt[iCut]->Sumw2();
1190  fHistoMCOmegaDecayChannels[iCut]->Sumw2();
1191 
1192  if (fDoMesonQA > 0 && fIsMC == 2){
1193  fHistoMCPi0PtJetPt[iCut] = new TH2F("MC_Pi0_Pt_JetPt","MC_Pi0_Pt_JetPt",300,0.03,30.,200,0,200);
1194  fHistoMCPi0PtJetPt[iCut]->Sumw2();
1196  fMCList[iCut]->Add(fHistoMCPi0PtJetPt[iCut]);
1197  }
1198  }
1199 
1200  fTrueList[iCut] = new TList();
1201  fTrueList[iCut]->SetName(Form("%s_%s_%s_%s_%s True histograms",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringCalo.Data(),cutstringNeutralPion.Data(),cutstringMeson.Data()));
1202  fTrueList[iCut]->SetOwner(kTRUE);
1203  fCutFolder[iCut]->Add(fTrueList[iCut]);
1204 
1205  fHistoTrueOmegaInvMassPt[iCut] = new TH2F("True_Omega_InvMass_Pt","True_Omega_InvMass_Pt",800,0.4,1.2,200,0,20);
1206  fHistoTrueOmegaInvMassPt[iCut]->SetXTitle("M_{inv,#omega}(GeV/c^{2})");
1207  fHistoTrueOmegaInvMassPt[iCut]->SetYTitle("#omega p_{T}(GeV/c)");
1208  fTrueList[iCut]->Add(fHistoTrueOmegaInvMassPt[iCut]);
1209 
1210  fHistoTruePi0FromOmegaInvMassPt[iCut] = new TH2F("True_Pi0FromOmega_InvMass_Pt","True_Pi0FromOmega_InvMass_Pt",800,0,0.8,200,0,20);
1211  fHistoTruePi0FromOmegaInvMassPt[iCut]->SetXTitle("M_{inv,#pi^{0}}(GeV/c^{2})");
1212  fHistoTruePi0FromOmegaInvMassPt[iCut]->SetYTitle("#omega p_{T}(GeV/c)");
1213  fTrueList[iCut]->Add(fHistoTruePi0FromOmegaInvMassPt[iCut]);
1214 
1215  fHistoTrueGammaFromOmegaPt[iCut] = new TH1F("True_GammaFromOmega_Pt","True_GammaFromOmega_Pt",200,0,20);
1216  fHistoTrueGammaFromOmegaPt[iCut]->SetXTitle("p_{T,#gamma}(GeV/c)");
1217  fTrueList[iCut]->Add(fHistoTrueGammaFromOmegaPt[iCut]);
1218 
1219  if(fDoMesonQA>0){
1220  fHistoTrueOmegaYPt[iCut] = new TH2F("True_Omega_Y_Pt","True_Omega_Y_Pt",200,0,20,150,-1.5,1.5);
1221  fHistoTrueOmegaYPt[iCut]->SetXTitle("p_{T,#omega}(GeV/c)");
1222  fHistoTrueOmegaYPt[iCut]->SetYTitle("Y_{#omega}");
1223  fTrueList[iCut]->Add(fHistoTrueOmegaYPt[iCut]);
1224 
1225  fHistoTrueOmegaAlphaPt[iCut] = new TH2F("True_Omega_Alpha_Pt","True_Omega_Alpha_Pt",200,0,20,200,-1,1);
1226  fHistoTrueOmegaAlphaPt[iCut]->SetXTitle("p_{T,#omega}(GeV/c)");
1227  fHistoTrueOmegaAlphaPt[iCut]->SetYTitle("#alpha_{#omega}");
1228  fTrueList[iCut]->Add(fHistoTrueOmegaAlphaPt[iCut]);
1229 
1230  fHistoTruePi0FromOmegaYPt[iCut] = new TH2F("True_Pi0FromOmega_Y_Pt","True_Pi0FromOmega_Y_Pt",200,0,20,150,-1.5,1.5);
1231  fHistoTruePi0FromOmegaYPt[iCut]->SetXTitle("p_{T,pi^{0}}(GeV/c)");
1232  fHistoTruePi0FromOmegaYPt[iCut]->SetYTitle("Y_{#pi^{0}}");
1233  fTrueList[iCut]->Add(fHistoTruePi0FromOmegaYPt[iCut]);
1234 
1235  fHistoTruePi0FromOmegaAlphaPt[iCut] = new TH2F("True_Pi0FromOmega_Alpha_Pt","MC_Pi0FromOmega_Alpha_Pt",200,0,20,200,-1,1);
1236  fHistoTruePi0FromOmegaAlphaPt[iCut]->SetXTitle("p_{T,pi^{0}}(GeV/c)");
1237  fHistoTruePi0FromOmegaAlphaPt[iCut]->SetYTitle("#alpha_{#pi^{0}}");
1238  fTrueList[iCut]->Add(fHistoTruePi0FromOmegaAlphaPt[iCut]);
1239 
1240  fHistoTrueOmegaPi0AnglePt[iCut] = new TH2F("True_OmegaPiZero_Angle_Pt","True_OmegaPiZero_Angle_Pt",200,0,20,360,0,TMath::Pi());
1241  fHistoTrueOmegaPi0AnglePt[iCut]->SetXTitle("#omega p_{T}(GeV/c)");
1242  fHistoTrueOmegaPi0AnglePt[iCut]->SetYTitle("#theta_{#omega,#pi^{0}}");
1243  fTrueList[iCut]->Add(fHistoTrueOmegaPi0AnglePt[iCut]);
1244 
1245  fHistoTruePi0GammaAnglePt[iCut] = new TH2F("True_PiZeroGamma_Angle_Pt","True_PiZeroGamma_Angle_Pt",200,0,20,360,0,TMath::Pi());
1246  fHistoTruePi0GammaAnglePt[iCut]->SetXTitle("#omega p_{T}(GeV/c)");
1247  fHistoTruePi0GammaAnglePt[iCut]->SetYTitle("#theta_{#pi_{0},#gamma}");
1248  fTrueList[iCut]->Add(fHistoTruePi0GammaAnglePt[iCut]);
1249 
1250  fHistoTrueOmegaGammaAnglePt[iCut] = new TH2F("True_OmegaGamma_Angle_Pt","True_OmegaGamma_Angle_Pt",200,0,20,360,0,TMath::Pi());
1251  fHistoTrueOmegaGammaAnglePt[iCut]->SetXTitle("#omega p_{T}(GeV/c)");
1252  fHistoTrueOmegaGammaAnglePt[iCut]->SetYTitle("#theta_{#omega,#gamma}");
1253  fTrueList[iCut]->Add(fHistoTrueOmegaGammaAnglePt[iCut]);
1254 
1255  fHistoTrueOmegaEtaPhi[iCut] = new TH2F("True_Omega_Eta_Phi","True_Omega_Eta_Phi",600,0,2*TMath::Pi(),200,-1,1);
1256  fHistoTrueOmegaEtaPhi[iCut]->SetXTitle("#phi_{#omega}(rad)");
1257  fHistoTrueOmegaEtaPhi[iCut]->SetYTitle("#eta_{#omega}");
1258  fTrueList[iCut]->Add(fHistoTrueOmegaEtaPhi[iCut]);
1259 
1260  fHistoTruePi0FromOmegaEtaPhi[iCut] = new TH2F("True_Pi0FromOmega_Eta_Phi","True_Pi0FromOmega_Eta_Phi",600,0,2*TMath::Pi(),200,-1,1);
1261  fHistoTruePi0FromOmegaEtaPhi[iCut]->SetXTitle("#phi_{#pi^{0}}(rad)");
1262  fHistoTruePi0FromOmegaEtaPhi[iCut]->SetYTitle("#eta_{#pi^{0}}");
1263  fTrueList[iCut]->Add(fHistoTruePi0FromOmegaEtaPhi[iCut]);
1264 
1265  fHistoTruePi0FromOmegaOpenAnglePt[iCut] = new TH2F("True_Pi0FromOmega_OpenAngle_Pt","True_Pi0FromOmega_OpenAngle_Pt",200,0,20,100,0,1);
1266  fHistoTruePi0FromOmegaOpenAnglePt[iCut]->SetXTitle("p_{T, #pi^{0}}(GeV/c)");
1267  fHistoTruePi0FromOmegaOpenAnglePt[iCut]->SetYTitle("#theta_{#pi^{0}}");
1268  fTrueList[iCut]->Add(fHistoTruePi0FromOmegaOpenAnglePt[iCut]);
1269 
1270  fHistoTrueOmegaPtPi0Pt[iCut] = new TH2F("True_OmegaPt_Pi0Pt","True_OmegaPt_Pi0Pt",200,0,20,200,0,20);
1271  fHistoTrueOmegaPtPi0Pt[iCut]->SetXTitle("#omega p_{T}(GeV/c)");
1272  fHistoTrueOmegaPtPi0Pt[iCut]->SetYTitle("#pi^{0} p_{T}(GeV/c)");
1273  fTrueList[iCut]->Add(fHistoTrueOmegaPtPi0Pt[iCut]);
1274 
1275  fHistoTrueOmegaPtGammaPt[iCut] = new TH2F("True_OmegaPt_GammaPt","True_OmegaPt_GammaPt",200,0,20,200,0,20);
1276  fHistoTrueOmegaPtGammaPt[iCut]->SetXTitle("#omega p_{T}(GeV/c)");
1277  fHistoTrueOmegaPtGammaPt[iCut]->SetYTitle("#gamma p_{T}(GeV/c)");
1278  fTrueList[iCut]->Add(fHistoTrueOmegaPtGammaPt[iCut]);
1279 
1280  if (fIsMC > 1){
1281  fHistoTruePi0FromOmegaAlphaPt[iCut]->Sumw2();
1282  fHistoTruePi0FromOmegaYPt[iCut]->Sumw2();
1283  fHistoTruePi0FromOmegaEtaPhi[iCut]->Sumw2();
1284  fHistoTruePi0FromOmegaOpenAnglePt[iCut]->Sumw2();
1285  fHistoTrueOmegaPi0AnglePt[iCut]->Sumw2();
1286  fHistoTrueOmegaGammaAnglePt[iCut]->Sumw2();
1287  fHistoTruePi0GammaAnglePt[iCut]->Sumw2();
1288  fHistoTrueOmegaYPt[iCut]->Sumw2();
1289  fHistoTrueOmegaAlphaPt[iCut]->Sumw2();
1290  fHistoTrueOmegaEtaPhi[iCut]->Sumw2();
1291  fHistoTrueOmegaPtPi0Pt[iCut]->Sumw2();
1292  fHistoTrueOmegaPtGammaPt[iCut]->Sumw2();
1293  fHistoTrueOmegaYPt[iCut]->Sumw2();
1294  }
1295  }
1296 
1297  fHistoMultipleCountTruePi0[iCut] = new TH1F("ESD_TrueMultipleCountPi0","ESD_TrueMultipleCountPi0",10,1,11);
1298  fTrueList[iCut]->Add(fHistoMultipleCountTruePi0[iCut]);
1299 
1300  if (fIsMC > 1){
1301  fHistoMultipleCountTruePi0[iCut]->Sumw2();
1302  fHistoTrueOmegaInvMassPt[iCut]->Sumw2();
1303  fHistoTruePi0FromOmegaInvMassPt[iCut]->Sumw2();
1304  fHistoTrueGammaFromOmegaPt[iCut]->Sumw2();
1305  }
1306  }
1307  }
1308 
1310 
1311  fMapMultipleCountTruePi0s.clear();
1312 
1313  fVectorRecTruePi0s.clear();
1314 
1315  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
1316  if(!fV0Reader){printf("Error: No V0 Reader");return;}// GetV0Reader
1317 
1318  if(fV0Reader)
1320  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
1321  fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
1322  if(fV0Reader)
1324  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
1325  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
1326 
1330 
1331  for(Int_t iMatcherTask = 0; iMatcherTask < 3; iMatcherTask++){
1332  AliCaloTrackMatcher* temp = (AliCaloTrackMatcher*) (AliAnalysisManager::GetAnalysisManager()->GetTask(Form("CaloTrackMatcher_%i",iMatcherTask)));
1333  if(temp) fOutputContainer->Add(temp->GetCaloTrackMatcherHistograms());
1334  }
1335 
1336 
1337  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1338  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
1339  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
1340  fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
1341  }
1342  if(!((AliConversionPhotonCuts*)fCutArray->At(iCut))) continue;
1343  if(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms()){
1344  fCutFolder[iCut]->Add(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms());
1345  }
1346  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
1347  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms()){
1348  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutHistograms());
1349  }
1350  if(fSetPlotHistsExtQA){
1351  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))) continue;
1352  if(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms()){
1353  fCutFolder[iCut]->Add(((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetExtQAHistograms());
1354  }
1355  }
1356  if(!((AliConversionMesonCuts*)fNeutralPionCutArray->At(iCut))) continue;
1357  if(((AliConversionMesonCuts*)fNeutralPionCutArray->At(iCut))->GetCutHistograms()){
1358  fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fNeutralPionCutArray->At(iCut))->GetCutHistograms());
1359  }
1360  if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
1361  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
1362  fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
1363  }
1364  }
1365  PostData(1, fOutputContainer);
1366 }
1367 //_____________________________________________________________________________
1369 {
1370  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
1371  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
1372  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
1373  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
1374  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
1375  }
1376 
1377  if(fIsHeavyIon == 2){
1378  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
1379  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1380  continue; // No Eta Shift requested, continue
1381  }
1382  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
1383  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
1384  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1385  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
1386  continue;
1387  } else{
1388  printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
1389  (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
1390  fProfileEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
1391  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
1392  }
1393  }
1394  }
1395 
1396  return kTRUE;
1397 }
1398 //_____________________________________________________________________________
1400 {
1401  //
1402  // Called for each event
1403  //
1404  fInputEvent = InputEvent();
1405 
1406  if(fIsMC > 0) fMCEvent = MCEvent();
1407 
1408  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
1409  if(fInputEvent->IsIncompleteDAQ()==kTRUE) eventQuality = 2;// incomplete event
1410  // Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1 or because it is incomplete => skip broken event/files
1411  if(eventQuality == 2 || eventQuality == 3){
1412  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1413  fHistoNEvents[iCut]->Fill(eventQuality);
1414  if (fIsMC > 1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
1415  }
1416  return;
1417  }
1418 
1419  if(fInputEvent->IsA()==AliAODEvent::Class()){
1420  fInputEvent->InitMagneticField();
1421  }
1422 
1423  fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
1424 
1425  // ------------------- BeginEvent ----------------------------
1426  AliEventplane *EventPlane = fInputEvent->GetEventplane();
1427  if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
1428  else fEventPlaneAngle=0.0;
1429 
1430  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
1431  RelabelAODPhotonCandidates(kTRUE);// In case of AODMC relabeling MC
1432  fV0Reader->RelabelAODs(kTRUE);
1433  }
1434 
1435  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
1436 
1437  fiCut = iCut;
1438 // cout << ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber() << "_" << ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber() <<
1439 // "_" << ((AliCaloPhotonCuts*)fClusterCutArray->At(iCut))->GetCutNumber() <<endl;
1440 
1441  Bool_t isRunningEMCALrelAna = kFALSE;
1442  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->GetClusterType() == 1) isRunningEMCALrelAna = kTRUE;
1443 
1444  Int_t eventNotAccepted = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,isRunningEMCALrelAna);
1445 
1446  if(fIsMC==2){
1447  Float_t xsection = -1.;
1448  Float_t ntrials = -1.;
1449  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetXSectionAndNTrials(fMCEvent,xsection,ntrials);
1450  if((xsection==-1.) || (ntrials==-1.)) AliFatal(Form("ERROR: GetXSectionAndNTrials returned invalid xsection/ntrials, periodName from V0Reader: '%s'",fV0Reader->GetPeriodName().Data()));
1451  fProfileJetJetXSection[iCut]->Fill(0.,xsection);
1452  fHistoJetJetNTrials[iCut]->Fill("#sum{NTrials}",ntrials);
1453  }
1454 
1455  if(fIsMC>0){
1456  fWeightJetJetMC = 1;
1457  // cout << fMCEvent << endl;
1458  Bool_t isMCJet = ((AliConvEventCuts*)fEventCutArray->At(iCut))->IsJetJetMCEventAccepted( fMCEvent, fWeightJetJetMC );
1459  if (fIsMC == 3){
1460  Double_t weightMult = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetWeightForMultiplicity(fV0Reader->GetNumberOfPrimaryTracks());
1461  fWeightJetJetMC = fWeightJetJetMC*weightMult;
1462  }
1463  if(fIsMC==1) fWeightJetJetMC = 1;
1464  if (!isMCJet){
1465  fHistoNEvents[iCut]->Fill(10,fWeightJetJetMC);
1466  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(10);
1467  continue;
1468  }
1469  }
1470 
1471  Bool_t triggered = kTRUE;
1472 
1473  if(eventNotAccepted!= 0){
1474  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
1475  fHistoNEvents[iCut]->Fill(eventNotAccepted, fWeightJetJetMC); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
1476  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventNotAccepted);
1477  if (eventNotAccepted==3 && fIsMC > 0){
1478  triggered = kFALSE;
1479  }else {
1480  continue;
1481  }
1482  }
1483 
1484  if(eventQuality != 0){// Event Not Accepted
1485  //cout << "event rejected due to: " <<eventQuality << endl;
1486  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC);
1487  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality);
1488  continue;
1489  }
1490 
1491  if (triggered==kTRUE){
1492  fHistoNEvents[iCut]->Fill(eventQuality, fWeightJetJetMC); // Should be 0 here
1493  if (fIsMC>1) fHistoNEventsWOWeight[iCut]->Fill(eventQuality); // Should be 0 here
1494 
1496  fHistoVertexZ[iCut]->Fill(fInputEvent->GetPrimaryVertex()->GetZ(), fWeightJetJetMC);
1497  fHistoSPDClusterTrackletBackground[iCut]->Fill(fInputEvent->GetMultiplicity()->GetNumberOfTracklets(),(fInputEvent->GetNumberOfITSClusters(0)+fInputEvent->GetNumberOfITSClusters(1)),fWeightJetJetMC);
1498  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A(), fWeightJetJetMC);
1499  else fHistoNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C(), fWeightJetJetMC);
1500  }
1501 
1502  if(fIsMC>0){
1503  // Process MC Particle
1504  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection() != 0){
1505  if(fInputEvent->IsA()==AliESDEvent::Class()){
1506  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1507  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
1508  fMCEvent);
1509  }
1510  else if(fInputEvent->IsA()==AliAODEvent::Class()){
1511  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetNotRejectedParticles(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetSignalRejection(),
1512  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetAcceptedHeader(),
1513  fInputEvent);
1514  }
1515  }
1516  }
1517  if(fIsMC>0){
1518  if(fInputEvent->IsA()==AliESDEvent::Class())
1520  if(fInputEvent->IsA()==AliAODEvent::Class())
1522  }
1523 
1524  if (triggered==kFALSE) continue;
1525 
1526  // it is in the loop to have the same conversion cut string (used also for MC stuff that should be same for V0 and Cluster)
1527  if(fReconMethod!=5) ProcessClusters();// process calo clusters
1528  if(fReconMethod!=2) ProcessPhotonCandidates(); // Process this cuts gammas
1529 
1530  fHistoNGammaCandidates[iCut]->Fill(fGammaCandidates->GetEntries(),fWeightJetJetMC);
1531  fHistoNClusterCandidates[iCut]->Fill(fClusterCandidates->GetEntries(),fWeightJetJetMC);
1533  if(fClusterCandidates->GetEntries()>1 && fGammaCandidates->GetEntries()>0){
1534  fHistoNEventsMinGamma[iCut]->Fill(0.,fWeightJetJetMC);
1535  }
1536  if(fClusterCandidates->GetEntries()>0 && fGammaCandidates->GetEntries()>1){
1537  fHistoNEventsMinGamma[iCut]->Fill(1,fWeightJetJetMC);
1538  }
1539  if(fClusterCandidates->GetEntries()>2){
1540  fHistoNEventsMinGamma[iCut]->Fill(2,fWeightJetJetMC);
1541  }
1542  if(fGammaCandidates->GetEntries()>2){
1543  fHistoNEventsMinGamma[iCut]->Fill(3,fWeightJetJetMC);
1544  }
1545 
1546  // Meson Analysis
1547  if(((AliConversionMesonCuts*)fNeutralPionCutArray->At(iCut))->UseMCPSmearing() && fIsMC>0){
1548  fUnsmearedPx = new Double_t[fGammaCandidates->GetEntries()]; // Store unsmeared Momenta
1549  fUnsmearedPy = new Double_t[fGammaCandidates->GetEntries()];
1550  fUnsmearedPz = new Double_t[fGammaCandidates->GetEntries()];
1551  fUnsmearedE = new Double_t[fGammaCandidates->GetEntries()];
1552 
1553  for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
1554  fUnsmearedPx[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Px();
1555  fUnsmearedPy[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Py();
1556  fUnsmearedPz[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->Pz();
1557  fUnsmearedE[gamma] = ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->E();
1558  ((AliConversionMesonCuts*)fNeutralPionCutArray->At(iCut))->SmearParticle(dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(gamma)));
1559  }
1560  }
1561 
1562  CalculateOmegaCandidates(); // Combine Gammas from conversion and from calo
1563  CalculateBackground(); // Combinatorial Background
1564  UpdateEventByEventData(); // Store Event for mixed Events
1565 
1566  if(((AliConversionMesonCuts*)fNeutralPionCutArray->At(iCut))->UseMCPSmearing() && fIsMC>0){
1567  for(Int_t gamma=0;gamma<fGammaCandidates->GetEntries();gamma++){ // Smear the AODPhotons in MC
1568  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPx(fUnsmearedPx[gamma]); // Reset Unsmeared Momenta
1569  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPy(fUnsmearedPy[gamma]);
1570  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetPz(fUnsmearedPz[gamma]);
1571  ((AliAODConversionPhoton*)fGammaCandidates->At(gamma))->SetE(fUnsmearedE[gamma]);
1572  }
1573  delete[] fUnsmearedPx; fUnsmearedPx = 0x0;
1574  delete[] fUnsmearedPy; fUnsmearedPy = 0x0;
1575  delete[] fUnsmearedPz; fUnsmearedPz = 0x0;
1576  delete[] fUnsmearedE;fUnsmearedE = 0x0;
1577  }
1578 
1579  if(fIsMC>0){
1580  fVectorRecTruePi0s.clear();
1583  }
1584 
1585  fGammaCandidates->Clear(); // delete this cuts good gammas
1586  fClusterCandidates->Clear(); // delete cluster candidates
1587  fPi0Candidates->Clear(); // delete pi0 candidates
1588  }
1589 
1590  if(fIsMC>0 && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
1591  RelabelAODPhotonCandidates(kFALSE); // Back to ESDMC Label
1592  fV0Reader->RelabelAODs(kFALSE);
1593  }
1594 
1595  PostData(1, fOutputContainer);
1596 }
1597 
1598 //________________________________________________________________________
1600 
1601  Int_t nclus = 0;
1602  nclus = fInputEvent->GetNumberOfCaloClusters();
1603 
1604 // cout << nclus << endl;
1605 
1606  if(nclus == 0) return;
1607 
1608  // plotting histograms on cell/tower level, only if extendedMatchAndQA > 1
1609  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->FillHistogramsExtendedQA(fInputEvent,fIsMC);
1610 
1611  if(fReconMethod==2){
1612  // match tracks to clusters
1613  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchTracksToClusters(fInputEvent,fWeightJetJetMC);
1614  }
1615 
1616  // vertex
1617  Double_t vertex[3] = {0,0,0};
1618  InputEvent()->GetPrimaryVertex()->GetXYZ(vertex);
1619 
1620  // Loop over EMCal clusters
1621  for(Int_t i = 0; i < nclus; i++){
1622  AliVCluster* clus = NULL;
1623  if(fInputEvent->IsA()==AliESDEvent::Class()) clus = new AliESDCaloCluster(*(AliESDCaloCluster*)fInputEvent->GetCaloCluster(i));
1624  else if(fInputEvent->IsA()==AliAODEvent::Class()) clus = new AliAODCaloCluster(*(AliAODCaloCluster*)fInputEvent->GetCaloCluster(i));
1625 
1626  if (!clus) continue;
1627  if(!((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelected(clus,fInputEvent,fMCEvent,fIsMC,fWeightJetJetMC,i)){ delete clus; continue;}
1628 
1629  // TLorentzvector with cluster
1630  TLorentzVector clusterVector;
1631  clus->GetMomentum(clusterVector,vertex);
1632 
1633  TLorentzVector* tmpvec = new TLorentzVector();
1634  tmpvec->SetPxPyPzE(clusterVector.Px(),clusterVector.Py(),clusterVector.Pz(),clusterVector.E());
1635 
1636  // convert to AODConversionPhoton
1637  AliAODConversionPhoton *PhotonCandidate = new AliAODConversionPhoton(tmpvec);
1638  if(!PhotonCandidate){ delete clus; delete tmpvec; continue;}
1639 
1640  // Flag Photon as CaloPhoton
1641  PhotonCandidate->SetIsCaloPhoton();
1642  PhotonCandidate->SetCaloClusterRef((Long_t)i);
1643  // get MC label
1644  if(fIsMC>0){
1645  Int_t* mclabelsCluster = clus->GetLabels();
1646  PhotonCandidate->SetNCaloPhotonMCLabels(clus->GetNLabels());
1647 // cout << clus->GetNLabels() << endl;
1648  if (clus->GetNLabels()>0){
1649  for (Int_t k =0; k<(Int_t)clus->GetNLabels(); k++){
1650  if (k<50)PhotonCandidate->SetCaloPhotonMCLabel(k,mclabelsCluster[k]);
1651 // Int_t pdgCode = fMCEvent->Particle(mclabelsCluster[k])->GetPdgCode();
1652 // cout << "label " << k << "\t" << mclabelsCluster[k] << " pdg code: " << pdgCode << endl;
1653  }
1654  }
1655  }
1656 
1657  fIsFromMBHeader = kTRUE;
1659  //TString periodName = fV0Reader->GetPeriodName();
1660  // test whether largest contribution to cluster orginates in added signals
1661  if (fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() > 0){
1662  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetCaloPhotonMCLabel(0), fMCEvent, fInputEvent) == 0){
1663  fIsFromMBHeader = kFALSE;
1664  }
1665  if (clus->GetNLabels()>1){
1666  Int_t* mclabelsCluster = clus->GetLabels();
1667  for (Int_t l = 1; l < (Int_t)clus->GetNLabels(); l++ ){
1668  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(mclabelsCluster[l], fMCEvent, fInputEvent) == 0){
1670  }
1671  }
1672  }
1673  }
1674 
1676  fHistoClusOverlapHeadersGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
1677 
1679  if(fIsMC>0){
1680  if(fInputEvent->IsA()==AliESDEvent::Class()){
1681  ProcessTrueClusterCandidates(PhotonCandidate);
1682  }else {
1683  ProcessTrueClusterCandidatesAOD(PhotonCandidate);
1684  }
1685  }
1686  fHistoClusGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
1687  fClusterCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
1688  }else{
1689  delete PhotonCandidate;
1690  }
1691 
1692  delete clus;
1693  delete tmpvec;
1694  }
1695 }
1696 
1697 //________________________________________________________________________
1699 {
1700 
1701  TParticle *Photon = NULL;
1702  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
1703  if (TruePhotonCandidate->GetCaloPhotonMCLabel(0) < 0) return;
1704 
1705  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = fMCEvent->Particle(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
1706  else return;
1707 
1708  if(Photon == NULL){
1709  // cout << "no photon" << endl;
1710  return;
1711  }
1712 
1713  TruePhotonCandidate->SetCaloPhotonMCFlags(fMCEvent, fEnableSortForClusMC);
1714 
1715  return;
1716 }
1717 
1718 //________________________________________________________________________
1720 {
1721  AliAODMCParticle *Photon = NULL;
1722  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
1723  if (AODMCTrackArray){
1724  if (!TruePhotonCandidate->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set task will abort");
1725  if (TruePhotonCandidate->GetNCaloPhotonMCLabels()>0) Photon = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetCaloPhotonMCLabel(0));
1726  else return;
1727  }else {
1728  AliInfo("AODMCTrackArray could not be loaded");
1729  return;
1730  }
1731 
1732  if(Photon == NULL){
1733  // cout << "no photon" << endl;
1734  return;
1735  }
1736 
1738 
1739  return;
1740 }
1741 
1742 //________________________________________________________________________
1744 {
1745  Int_t nV0 = 0;
1746  TList *GammaCandidatesStepOne = new TList();
1747  TList *GammaCandidatesStepTwo = new TList();
1748  // Loop over Photon Candidates allocated by ReaderV1
1749  for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
1750  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
1751  if(!PhotonCandidate) continue;
1752  fIsFromMBHeader = kTRUE;
1753  if(fIsMC>0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1754  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
1755  if(isPosFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1756  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
1757  if(isNegFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1758  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1759  }
1760 
1761  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fInputEvent)) continue;
1762  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(PhotonCandidate->GetPhotonPhi(),fEventPlaneAngle)) continue;
1763  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
1764  !((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
1765  fGammaCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
1766 
1767  if(fIsFromMBHeader){
1768  fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
1769  if (fDoPhotonQA > 0){
1770  fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
1771  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1772  }
1773  }
1774  if(fIsMC>0){
1775  if(fInputEvent->IsA()==AliESDEvent::Class())
1776  ProcessTruePhotonCandidates(PhotonCandidate);
1777  if(fInputEvent->IsA()==AliAODEvent::Class())
1778  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
1779  }
1780 
1781  }else if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
1782  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
1783  nV0++;
1784  GammaCandidatesStepOne->Add(PhotonCandidate);
1785  }else if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
1786  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
1787  GammaCandidatesStepTwo->Add(PhotonCandidate);
1788  }
1789  }
1790  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){
1791  for(Int_t i = 0;i<GammaCandidatesStepOne->GetEntries();i++){
1792  AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GammaCandidatesStepOne->At(i);
1793  if(!PhotonCandidate) continue;
1794  fIsFromMBHeader = kTRUE;
1795  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1796  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
1797  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
1798  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1799  }
1800  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GammaCandidatesStepOne->GetEntries())) continue;
1801  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
1802  fGammaCandidates->Add(PhotonCandidate);
1803  if(fIsFromMBHeader){
1804  fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
1805  if (fDoPhotonQA > 0){
1806  fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
1807  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1808  }
1809  }
1810  if(fIsMC>0){
1811  if(fInputEvent->IsA()==AliESDEvent::Class())
1812  ProcessTruePhotonCandidates(PhotonCandidate);
1813  if(fInputEvent->IsA()==AliAODEvent::Class())
1814  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
1815  }
1816  } else GammaCandidatesStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
1817  }
1818  }
1819  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
1820  for(Int_t i = 0;i<GammaCandidatesStepTwo->GetEntries();i++){
1821  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GammaCandidatesStepTwo->At(i);
1822  if(!PhotonCandidate) continue;
1823  fIsFromMBHeader = kTRUE;
1824  if(fMCEvent && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1825  Int_t isPosFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelPositive(), fMCEvent, fInputEvent);
1826  Int_t isNegFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(PhotonCandidate->GetMCLabelNegative(), fMCEvent, fInputEvent);
1827  if( (isNegFromMBHeader+isPosFromMBHeader) != 4) fIsFromMBHeader = kFALSE;
1828  }
1829  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GammaCandidatesStepTwo,i)) continue;
1830  fGammaCandidates->Add(PhotonCandidate); // Add gamma to current cut TList
1831  if(fIsFromMBHeader){
1832  fHistoConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt(),fWeightJetJetMC);
1833  if (fDoPhotonQA > 0){
1834  fHistoConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
1835  fHistoConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1836  }
1837  }
1838  if(fIsMC>0){
1839  if(fInputEvent->IsA()==AliESDEvent::Class())
1840  ProcessTruePhotonCandidates(PhotonCandidate);
1841  if(fInputEvent->IsA()==AliAODEvent::Class())
1842  ProcessTruePhotonCandidatesAOD(PhotonCandidate);
1843  }
1844  }
1845  }
1846 
1847  delete GammaCandidatesStepOne;
1848  GammaCandidatesStepOne = 0x0;
1849  delete GammaCandidatesStepTwo;
1850  GammaCandidatesStepTwo = 0x0;
1851 
1852 }
1853 
1854 //________________________________________________________________________
1856 {
1857  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
1858  if (AODMCTrackArray == NULL) return;
1859  AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
1860  AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
1861 
1862  if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
1863  Int_t pdgCode[2] = {TMath::Abs(posDaughter->GetPdgCode()),TMath::Abs(negDaughter->GetPdgCode())};
1864 
1865  if(posDaughter->GetMother() != negDaughter->GetMother()) return;
1866 
1867  else if(posDaughter->GetMother() == -1) return;
1868 
1869  if(pdgCode[0]!=11 || pdgCode[1]!=11) return; //One Particle is not a electron
1870 
1871  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge
1872 
1873  AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
1874  if(Photon->GetPdgCode() != 22) return; // Mother is no Photon
1875 
1876  if(((posDaughter->GetMCProcessCode())) != 5 || ((negDaughter->GetMCProcessCode())) != 5) return; // check if the daughters come from a conversion
1877 
1878  TruePhotonCandidate->SetIsTrueConvertedPhoton();
1879 }
1880 
1881 //________________________________________________________________________
1883 {
1884  // Process True Photons
1885  TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCEvent);
1886  TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCEvent);
1887 
1888  if(posDaughter == NULL || negDaughter == NULL) return; // One particle does not exist
1889  Int_t pdgCode[2] = {TMath::Abs(posDaughter->GetPdgCode()),TMath::Abs(negDaughter->GetPdgCode())};
1890  if(posDaughter->GetMother(0) != negDaughter->GetMother(0)) return;
1891  else if(posDaughter->GetMother(0) == -1) return;
1892 
1893  if(pdgCode[0]!=11 || pdgCode[1]!=11) return; //One Particle is not a electron
1894 
1895  if(posDaughter->GetPdgCode()==negDaughter->GetPdgCode()) return; // Same Charge
1896 
1897  TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCEvent);
1898 
1899  if(Photon->GetPdgCode() != 22){
1900  return; // Mother is no Photon
1901  }
1902 
1903  if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() !=5) return;// check if the daughters come from a conversion
1904 
1905  // True Photon
1906  TruePhotonCandidate->SetIsTrueConvertedPhoton();
1907  return;
1908 }
1909 //________________________________________________________________________
1911 {
1912  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
1913  Double_t mcProdVtxX = primVtxMC->GetX();
1914  Double_t mcProdVtxY = primVtxMC->GetY();
1915  Double_t mcProdVtxZ = primVtxMC->GetZ();
1916 
1917  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
1918  if (AODMCTrackArray == NULL) return;
1919 
1920  // Loop over all primary MC particle
1921  for(Long_t i = 0; i < AODMCTrackArray->GetEntriesFast(); i++) {
1922 
1923  AliAODMCParticle* particle = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(i));
1924  if (!particle) continue;
1925 
1926  Bool_t isPrimary = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryAOD(fInputEvent, particle, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
1927  if (!isPrimary) continue;
1928 
1929  Int_t isMCFromMBHeader = -1;
1930  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 0){
1931  isMCFromMBHeader = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent);
1932  if(isMCFromMBHeader == 0 && ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetSignalRejection() != 3) continue;
1933  }
1934 
1935  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(particle->Phi(),fEventPlaneAngle,kFALSE)) continue;
1936  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kFALSE)){
1937  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Gamma
1938  if (TMath::Abs(particle->Eta()) < 0.66 ){
1939  if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
1940  }
1941  }
1942  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(particle,AODMCTrackArray,kTRUE)){
1943  Double_t rConv = 0;
1944  for(Int_t daughterIndex=particle->GetDaughter(0);daughterIndex<=particle->GetDaughter(1);daughterIndex++){
1945  AliAODMCParticle *tmpDaughter = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(daughterIndex));
1946  if(!tmpDaughter) continue;
1947  if(TMath::Abs(tmpDaughter->GetPdgCode()) == 11){
1948  rConv = sqrt( (tmpDaughter->Xv()*tmpDaughter->Xv()) + (tmpDaughter->Yv()*tmpDaughter->Yv()) );
1949  }
1950  }
1951  fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
1952  if (fDoPhotonQA > 0){
1953  fHistoMCConvGammaR[fiCut]->Fill(rConv);
1954  fHistoMCConvGammaEta[fiCut]->Fill(particle->Eta());
1955  }
1956  }
1957  // Converted MC Gamma
1959  ->MesonIsSelectedAODMC(particle,AODMCTrackArray,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
1960  AliAODMCParticle* daughter0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(0)));
1961  AliAODMCParticle* daughter1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(particle->GetDaughter(1)));
1962  Float_t weighted= 1;
1963  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
1964  if (particle->Pt()>0.005){
1965  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, 0x0, fInputEvent);
1966  // if(particle->GetPdgCode() == 221){
1967  // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
1968  // }
1969  }
1970  }
1971  Double_t mesonY = 10.;
1972  if(particle->E() - particle->Pz() == 0 || particle->E() + particle->Pz() == 0){
1973  mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1974  }else{
1975  mesonY = 0.5*(TMath::Log((particle->E()+particle->Pz()) / (particle->E()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1976  }
1977 
1978  Double_t alpha = -10;
1979  if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
1980  alpha = (daughter0->E() - daughter1->E())/(daughter0->E() + daughter1->E());
1981  }
1982 
1983 
1984  if(particle->GetPdgCode() == 111){
1985  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Pi0
1986  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
1987  if (fIsMC > 1) fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
1988  if (fDoMesonQA > 0){
1989  fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC);
1990  fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC);
1991  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
1992  }
1993  }
1994 
1995  // Check the acceptance for both gammas
1996  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter0,AODMCTrackArray,kFALSE) &&
1997  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter1,AODMCTrackArray,kFALSE) &&
1998  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
1999  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
2000  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
2001  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) ||
2002  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
2003  if(particle->GetPdgCode() == 111){
2004  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Pi0 with gamma in acc
2005  fHistoMCPi0WOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Pi0 with gamma in acc wo weight
2006  }
2007  }
2008  }
2009  }
2010  }
2011 }
2012 
2013 //________________________________________________________________________
2015 {
2016  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2017  Double_t mcProdVtxX = primVtxMC->GetX();
2018  Double_t mcProdVtxY = primVtxMC->GetY();
2019  Double_t mcProdVtxZ = primVtxMC->GetZ();
2020 // cout << mcProdVtxX <<"\t" << mcProdVtxY << "\t" << mcProdVtxZ << endl;
2021 
2022  // Loop over all primary MC particles
2023  for(Int_t i = 0; i < fMCEvent->GetNumberOfTracks(); i++) {
2024  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
2025  // fill primary histograms
2026  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
2027  if (!particle) continue;
2028 
2029  // fill histograms for all true omegas
2030  if(particle->GetPdgCode() == 223){
2031 
2032  Bool_t DecaysToPiPlPiMiPiZero = kFALSE;
2033 
2034  TParticle *posPion = 0x0;
2035  TParticle *negPion = 0x0;
2036  TParticle *neutPion = 0x0;
2037 
2038  for(Int_t index= particle->GetFirstDaughter();index <= particle->GetLastDaughter();index++){
2039  if(index < 0) continue;
2040 
2041  TParticle *temp = (TParticle*)fMCEvent->Particle(index);
2042 
2043  switch(temp->GetPdgCode()) {
2044  case 211:
2045  posPion = temp;
2046  break;
2047  case -211:
2048  negPion = temp;
2049  break;
2050  case 111:
2051  neutPion = temp;
2052  break;
2053  }
2054  }
2055 
2056  if(posPion && negPion && neutPion) DecaysToPiPlPiMiPiZero = kTRUE;
2057 
2058  if(DecaysToPiPlPiMiPiZero){
2060  } else if (particle->GetNDaughters()==2){
2061  TParticle *gamma2 = 0x0;
2062  TParticle *pi0 = 0x0;
2063 
2064  for(Int_t index = particle->GetFirstDaughter();index <= particle->GetLastDaughter();index++){
2065  if(index < 0) continue;
2066 
2067  TParticle *temp = (TParticle*)fMCEvent->Particle(index);
2068  switch(temp->GetPdgCode()){
2069  case 22:
2070  gamma2 = temp;
2071  break;
2072  case 111:
2073  pi0 = temp;
2074  break;
2075  }
2076  }
2077 
2078  if(gamma2 && pi0){
2080  fHistoMCAllOmegaInvMassPt[fiCut]->Fill(TMath::Sqrt((particle->Energy())*(particle->Energy())-(particle->P())*(particle->P())),particle->Pt(),fWeightJetJetMC);
2081  fHistoMCGammaFromAllOmegaPt[fiCut]->Fill(gamma2->Pt(),fWeightJetJetMC);
2082  fHistoMCPi0FromAllOmegaInvMassPt[fiCut]->Fill(TMath::Sqrt((pi0->Energy())*(pi0->Energy())-(pi0->P())*(pi0->P())),pi0->Pt(),fWeightJetJetMC);
2083  if(fDoMesonQA>0){
2084 
2085  fHistoMCPi0FromAllOmegaEtaPhi[fiCut]->Fill(pi0->Phi(),pi0->Eta(),fWeightJetJetMC);
2086  fHistoMCAllOmegaPtPi0Pt[fiCut]->Fill(particle->Pt(),pi0->Pt(),fWeightJetJetMC);
2087  fHistoMCAllOmegaPtGammaPt[fiCut]->Fill(particle->Pt(),gamma2->Pt(),fWeightJetJetMC);
2088 
2089  Double_t alpha = (pi0->Energy() - gamma2->Energy())/(pi0->Energy() + gamma2->Energy());
2090  fHistoMCAllOmegaAlphaPt[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC);
2091 
2092  Double_t Pi0Y = 10.;
2093  if(pi0->Energy() - pi0->Pz() == 0 || pi0->Energy() + pi0->Pz() == 0){
2094  Pi0Y=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2095  }else{
2096  Pi0Y = 0.5*(TMath::Log((pi0->Energy()+pi0->Pz()) / (pi0->Energy()-pi0->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2097  }
2098  fHistoMCPi0FromAllOmegaYPt[fiCut]->Fill(pi0->Pt(),Pi0Y,fWeightJetJetMC);
2099 
2100  Double_t OmegaY = 10.;
2101  if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
2102  OmegaY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2103  }else{
2104  OmegaY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2105  }
2106  fHistoMCAllOmegaYPt[fiCut]->Fill(particle->Pt(),OmegaY,fWeightJetJetMC);
2107 
2108  fHistoMCAllOmegaEtaPhi[fiCut]->Fill(particle->Phi(),particle->Eta(),fWeightJetJetMC);
2109 
2110  //get angles and plot
2111  TVector3 omegavector = TVector3(particle->Px(),particle->Py(),particle->Pz());
2112  TVector3 pi0vector = TVector3(pi0->Px(),pi0->Py(),pi0->Pz());
2113  TVector3 gamma2vector = TVector3(gamma2->Px(),gamma2->Py(),gamma2->Pz());
2114  fHistoMCAllOmegaPiZeroAnglePt[fiCut]->Fill(particle->Pt(),TMath::Pi() - pi0vector.Angle(omegavector),fWeightJetJetMC);
2115  fHistoMCAllPiZeroGammaAnglePt[fiCut]->Fill(particle->Pt(),pi0vector.Angle(gamma2vector),fWeightJetJetMC);
2116  fHistoMCAllOmegaGammaAnglePt[fiCut]->Fill(particle->Pt(),TMath::Pi() - omegavector.Angle(gamma2vector),fWeightJetJetMC);
2117 
2118  //check whether pi0 decayed into two gammas
2119  if (pi0->GetNDaughters()==2 && pi0->GetFirstDaughter()>-1 && pi0->GetLastDaughter()>-1){
2120  TParticle *gamma0 = (TParticle*)fMCEvent->Particle(pi0->GetFirstDaughter());
2121  TParticle *gamma1 = (TParticle*)fMCEvent->Particle(pi0->GetLastDaughter());
2122  if (gamma0->GetPdgCode()==22 && gamma1->GetPdgCode()==22){
2123 
2124  //plot pi0 alpha
2125  Double_t pi0alpha = (gamma0->Energy() - gamma1->Energy())/(gamma0->Energy() + gamma1->Energy());
2126  fHistoMCPi0FromAllOmegaAlphaPt[fiCut]->Fill(pi0->Pt(),pi0alpha,fWeightJetJetMC);
2127  }
2128  }
2129  }
2130  } else{
2132  }
2133  } else{
2135  }
2136  }
2137 
2138  //fill histograms for omegas in acceptance
2139  Int_t labelNeutPion = -1;
2140  Int_t labelGamma = -1;
2141 
2143  ->MesonIsSelectedMCPiZeroGamma(particle,fMCEvent,labelNeutPion,labelGamma,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2144  if (labelNeutPion > -1 && labelGamma > -1){
2145  TParticle *neutPion = fMCEvent->Particle(labelNeutPion);
2146 
2147  //fill histograms for acceptance correction
2148  fHistoMCOmegaInvMassPt[fiCut]->Fill(TMath::Sqrt((particle->Energy())*(particle->Energy())-(particle->P())*(particle->P())),particle->Pt(),fWeightJetJetMC);
2149 
2150  if (neutPion->GetNDaughters()==2 && neutPion->GetFirstDaughter()>-1 && neutPion->GetLastDaughter()>-1){
2151 
2152  TParticle *gamma0 = (TParticle*)fMCEvent->Particle(neutPion->GetFirstDaughter());
2153  TParticle *gamma1 = (TParticle*)fMCEvent->Particle(neutPion->GetLastDaughter());
2154  TParticle *gamma2 = (TParticle*)fMCEvent->Particle(labelGamma);
2155 
2156  Bool_t InAcceptance = kFALSE;
2157 
2158  if (fReconMethod%2==1){ //cases 1,3,5 where reconstruction requires gamma2 to be a pcm photon
2159  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma2,fMCEvent,kFALSE)){ //check that gamma2 is in acceptance
2160  if(fReconMethod==5){
2161  //check that both gamma0 and gamma1 are in acceptance
2162  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma0,fMCEvent,kFALSE) &&
2163  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma1,fMCEvent,kFALSE)){
2164  InAcceptance = kTRUE;
2165  }
2166  } else if(fReconMethod==3){
2167  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma0,fMCEvent) &&
2168  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma1,fMCEvent)){
2169  InAcceptance = kTRUE;
2170  }
2171  } else if(fReconMethod==1){ // both gammas must be in tpc acceptance
2172  if((((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma0,fMCEvent,kFALSE) &&
2173  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma1,fMCEvent,kFALSE)) &&
2174  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
2175  (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma0,fMCEvent) ||
2176  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma1,fMCEvent))){
2177  InAcceptance = kTRUE;
2178  }
2179  }
2180  }
2181  } else{ //cases 0,2,4 where reconstruction requires gamma2 to be a calo photon
2182  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma2,fMCEvent)){
2183  if(fReconMethod==4){
2184  //check that both gamma0 and gamma1 are in acceptance
2185  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma0,fMCEvent,kFALSE) &&
2186  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma1,fMCEvent,kFALSE)){
2187  InAcceptance = kTRUE;
2188  }
2189  } else if(fReconMethod==2){
2190  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma0,fMCEvent) &&
2191  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma1,fMCEvent)){
2192  InAcceptance = kTRUE;
2193  }
2194  } else if(fReconMethod==0){ //either gamma0 is in tpc acc & gamma1 is in emcal acc or vice versa
2195  if((((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma0,fMCEvent,kFALSE) &&
2196  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma1,fMCEvent,kFALSE)) &&
2197  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
2198  (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma0,fMCEvent) ||
2199  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma1,fMCEvent))){
2200  InAcceptance = kTRUE;
2201  }
2202  }
2203  }
2204  }
2205  if(InAcceptance){
2206  // fill in acceptance histograms
2207  fHistoMCOmegaInAccInvMassPt[fiCut]->Fill(TMath::Sqrt((particle->Energy())*(particle->Energy())-(particle->P())*(particle->P())),particle->Pt(),fWeightJetJetMC);
2208  fHistoMCPi0FromOmegaInAccInvMassPt[fiCut]->Fill(TMath::Sqrt((neutPion->Energy())*(neutPion->Energy())-(neutPion->P())*(neutPion->P())),neutPion->Pt(),fWeightJetJetMC);
2210 
2211  if(fDoMesonQA>0){
2212 
2213  TVector3 omegavector = TVector3(particle->Px(),particle->Py(),particle->Pz());
2214  TVector3 pi0vector = TVector3(neutPion->Px(),neutPion->Py(),neutPion->Pz());
2215  TVector3 gamma2vector = TVector3(gamma2->Px(),gamma2->Py(),gamma2->Pz());
2216 
2217  Double_t OmegaPiZeroAngle = TMath::Pi() - pi0vector.Angle(omegavector);
2218  Double_t PiZeroGammaAngle = pi0vector.Angle(gamma2vector);
2219  Double_t OmegaGammaAngle = TMath::Pi() - omegavector.Angle(gamma2vector);
2220 
2221  Double_t OmegaY = 10.;
2222  if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
2223  OmegaY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2224  }else{
2225  OmegaY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2226  }
2227  Double_t Pi0Y = 10.;
2228  if(neutPion->Energy() - neutPion->Pz() == 0 || neutPion->Energy() + neutPion->Pz() == 0){
2229  Pi0Y=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2230  }else{
2231  Pi0Y = 0.5*(TMath::Log((neutPion->Energy()+neutPion->Pz()) / (neutPion->Energy()-neutPion->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2232  }
2233 
2234  Double_t OmegaAlpha = (neutPion->Energy() - gamma2->Energy())/(neutPion->Energy() + gamma2->Energy());
2235  Double_t Pi0Alpha = (gamma0->Energy() - gamma1->Energy())/(gamma0->Energy() + gamma1->Energy());
2236 
2237  fHistoMCOmegaInAccEtaPhi[fiCut]->Fill(particle->Phi(),particle->Eta(),fWeightJetJetMC);
2238  fHistoMCOmegaInAccYPt[fiCut]->Fill(particle->Pt(),OmegaY,fWeightJetJetMC);
2239  fHistoMCOmegaInAccAlphaPt[fiCut]->Fill(particle->Pt(),OmegaAlpha,fWeightJetJetMC);
2240  fHistoMCInAccOmegaPiZeroAnglePt[fiCut]->Fill(particle->Pt(),OmegaPiZeroAngle,fWeightJetJetMC);
2241  fHistoMCInAccPiZeroGammaAnglePt[fiCut]->Fill(particle->Pt(),PiZeroGammaAngle,fWeightJetJetMC);
2242  fHistoMCInAccOmegaGammaAnglePt[fiCut]->Fill(particle->Pt(),OmegaGammaAngle,fWeightJetJetMC);
2243  fHistoMCPi0FromOmegaInAccAlphaPt[fiCut]->Fill(neutPion->Pt(),Pi0Alpha,fWeightJetJetMC);
2244  fHistoMCPi0FromOmegaInAccYPt[fiCut]->Fill(neutPion->Pt(),Pi0Y,fWeightJetJetMC);
2245  fHistoMCPi0FromOmegaInAccEtaPhi[fiCut]->Fill(particle->Phi(),particle->Eta(),fWeightJetJetMC);
2246  fHistoMCInAccOmegaPtPi0Pt[fiCut]->Fill(particle->Pt(),neutPion->Pt(),fWeightJetJetMC);
2247  fHistoMCInAccOmegaPtGammaPt[fiCut]->Fill(particle->Pt(),gamma2->Pt(),fWeightJetJetMC);
2248  }
2249  }
2250  }
2251  }
2252  }
2253 
2254 
2255  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kFALSE)){
2256  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Gamma
2257  if (TMath::Abs(particle->Eta()) < 0.66 ){
2258  if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
2259  }
2260  }
2261  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kTRUE)){
2262  fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
2263  if (fDoPhotonQA > 0 && particle->GetFirstDaughter()>-1){
2264  fHistoMCConvGammaR[fiCut]->Fill(((TParticle*)fMCEvent->Particle(particle->GetFirstDaughter()))->R());
2265  fHistoMCConvGammaEta[fiCut]->Fill(particle->Eta());
2266  }
2267  }// Converted MC Gamma
2269  ->MesonIsSelectedMC(particle,fMCEvent,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2270  if(particle->GetFirstDaughter()>-1 && particle->GetLastDaughter()>-1){
2271  TParticle* daughter0 = (TParticle*)fMCEvent->Particle(particle->GetFirstDaughter());
2272  TParticle* daughter1 = (TParticle*)fMCEvent->Particle(particle->GetLastDaughter());
2273 
2274  Float_t weighted= 1;
2275  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
2276  if (particle->Pt()>0.005){
2277  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent, fInputEvent);
2278  // if(particle->GetPdgCode() == 221){
2279  // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2280  // }
2281  }
2282  }
2283  Double_t mesonY = 10.;
2284  if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
2285  mesonY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2286  }else{
2287  mesonY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2288  }
2289 
2290  Double_t alpha = -10;
2291  if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
2292  alpha = (daughter0->Energy() - daughter1->Energy())/(daughter0->Energy() + daughter1->Energy());
2293  }
2294 
2295  if(particle->GetPdgCode() == 111){
2296  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Pi0
2297  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
2298  if (fIsMC > 1) fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
2299  if (fDoMesonQA > 0){
2300  fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC); // All MC Pi0
2301  fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC); // All MC Pi0
2302  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
2303  }
2304  }
2305  // Check the acceptance for both gammas & whether they are counted as primaries as well
2306  Bool_t kDaughter0IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, particle->GetFirstDaughter(), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2307  Bool_t kDaughter1IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, particle->GetLastDaughter(), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2308  Bool_t InAcceptance = kFALSE;
2309 
2310  if(fReconMethod/2 == 0){
2311  if( kDaughter0IsPrim && kDaughter1IsPrim &&
2312  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter0,fMCEvent,kFALSE) &&
2313  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter1,fMCEvent,kFALSE)){
2314  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
2315  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCEvent) ||
2316  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCEvent)){
2317  InAcceptance = kTRUE;
2318  }
2319  }
2320  } else if(fReconMethod/2 == 1){
2321  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCEvent) &&
2322  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCEvent)){
2323  InAcceptance = kTRUE;
2324  }
2325  } else if(fReconMethod/2 == 2){
2326  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter0,fMCEvent,kFALSE) &&
2327  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter1,fMCEvent,kFALSE)){
2328  InAcceptance = kTRUE;
2329  }
2330  }
2331  if(InAcceptance){
2332  // fill in acceptance histograms
2333  if(particle->GetPdgCode() == 111){
2334  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Pi0 with gamma in acc
2335  fHistoMCPi0WOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Pi0 with gamma in acc wo weighting
2336  }
2337  }
2338  }
2339  }
2340  }
2341  }
2342 }
2343 
2344 //________________________________________________________________________
2346 {
2347  switch(fReconMethod){
2348  //PCM-cal,cal
2349  case 0:
2350  if(fClusterCandidates->GetEntries()>1 && fGammaCandidates->GetEntries()>0){
2351  for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
2352  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
2353  if (gamma0==NULL) continue;
2354 
2355  for(Int_t secondGammaIndex=0;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
2356  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
2357  if (gamma1==NULL || !(gamma1->GetIsCaloPhoton())) continue;
2358  Bool_t matched = kFALSE;
2359  AliVCluster* cluster = fInputEvent->GetCaloCluster(gamma1->GetCaloClusterRef());
2360  matched = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma0,cluster,fInputEvent,fWeightJetJetMC);
2361 
2362  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
2363 
2364  if((((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))
2365  && pi0cand->Pt() > fMinPi0Pt){
2366  if (matched){
2367  fHistoPhotonPairMatchedInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(),fWeightJetJetMC);
2368  } else{
2369  fHistoPhotonPairInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(),fWeightJetJetMC);
2370  if (pi0cand->M() > ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionLow() &&
2371  pi0cand->M() < ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionHigh()){
2372  //change energy of pi0 candidate s.t. its mass is the pdg mass
2373  pi0cand->SetPxPyPzE(pi0cand->Px(),pi0cand->Py(),pi0cand->Pz(),TMath::Sqrt(0.1349766*0.1349766+pi0cand->P()*pi0cand->P()));
2374  fPi0Candidates->Add(pi0cand);
2375  if(fDoMesonQA>0){
2376  fHistoPhotonPairYPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2377  fHistoPhotonPairAlphaPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha(),fWeightJetJetMC);
2378  fHistoPhotonPairOpenAnglePt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle(),fWeightJetJetMC);
2379  fHistoPhotonPairEtaPhi[fiCut]->Fill(pi0cand->Phi(),pi0cand->Eta(),fWeightJetJetMC);
2380  }
2381  // get third photon from clusters and calculate inv mass of omega
2382  for(Int_t thirdGammaIndex=0;thirdGammaIndex<fClusterCandidates->GetEntries();thirdGammaIndex++){
2383  if (thirdGammaIndex==secondGammaIndex) continue;
2384  Bool_t matchedgamma2wconvgamma = kFALSE;
2385  AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(thirdGammaIndex));
2386  if (gamma2==NULL || !(gamma2->GetIsCaloPhoton())) continue;
2387  AliVCluster* cluster2 = fInputEvent->GetCaloCluster(gamma2->GetCaloClusterRef());
2388  matchedgamma2wconvgamma = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma0,cluster2, fInputEvent, fWeightJetJetMC);
2389  AliAODConversionMother *omegacand = new AliAODConversionMother(pi0cand,gamma2);
2390  if (matchedgamma2wconvgamma){
2391  fHistoMotherMatchedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2392  delete omegacand;
2393  omegacand=0x0;
2394  continue;
2395  }
2396  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(omegacand, pi0cand, gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
2397  fHistoMotherInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2398  if(fIsMC>0){
2399  if(fInputEvent->IsA()==AliESDEvent::Class())
2400  ProcessTrueMesonCandidates(omegacand,gamma0,gamma1,gamma2);
2401  if(fInputEvent->IsA()==AliAODEvent::Class())
2402  ProcessTrueMesonCandidatesAOD(omegacand,gamma0,gamma1,gamma2);
2403  }
2404  if(omegacand->M()>0.7 && omegacand->M()<0.85){
2405  fHistoGammaFromMotherPt[fiCut]->Fill(gamma2->Pt(),fWeightJetJetMC);
2406  if(fDoMesonQA>0){
2408  fHistoMotherYPt[fiCut]->Fill(omegacand->Pt(),omegacand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2409  fHistoMotherAlphaPt[fiCut]->Fill(omegacand->Pt(),omegacand->GetAlpha(),fWeightJetJetMC);
2410  fHistoMotherEtaPhi[fiCut]->Fill(omegacand->Phi(),omegacand->Eta(),fWeightJetJetMC);
2411  fHistoMotherPi0AnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(pi0cand->Vect()),fWeightJetJetMC);
2412  fHistoMotherGammaAnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(gamma2->Vect()),fWeightJetJetMC);
2413  fHistoPi0GammaAnglePt[fiCut]->Fill(omegacand->Pt(),pi0cand->Angle(gamma2->Vect()),fWeightJetJetMC);
2414  }
2415  }
2416  } else if(fDoPiZeroGammaAngleCut){
2417  fHistoMotherAngleCutRejectedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2418  }
2419  delete omegacand;
2420  omegacand=0x0;
2421  }
2422  } else{
2423  delete pi0cand;
2424  pi0cand=0x0;
2425  }
2426  }
2427  }
2428  }
2429  }
2430  }
2431  break;
2432  //PCM-cal,PCM
2433  case 1:
2434  if(fGammaCandidates->GetEntries()>1 && fClusterCandidates->GetEntries()>0){
2435  for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
2436  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
2437  if (gamma0==NULL) continue;
2438 
2439  for(Int_t secondGammaIndex=0;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
2440  Bool_t matched = kFALSE;
2441  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
2442  if (gamma1==NULL || !(gamma1->GetIsCaloPhoton())) continue;
2443 
2444  AliVCluster* cluster = fInputEvent->GetCaloCluster(gamma1->GetCaloClusterRef());
2445  matched = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma0,cluster, fInputEvent, fWeightJetJetMC);
2446 
2447  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
2448 
2449  if((((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))
2450  && pi0cand->Pt() > fMinPi0Pt){
2451  if (matched){
2452  fHistoPhotonPairMatchedInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(),fWeightJetJetMC);
2453  } else{
2454  // fill photon pair histograms
2455  fHistoPhotonPairInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(),fWeightJetJetMC);
2456  if (pi0cand->M() > ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionLow() &&
2457  pi0cand->M() < ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionHigh()){
2458  //change energy of pi0 candidate s.t. its mass is the pdg mass
2459  pi0cand->SetPxPyPzE(pi0cand->Px(),pi0cand->Py(),pi0cand->Pz(),TMath::Sqrt(0.1349766*0.1349766+pi0cand->P()*pi0cand->P()));
2460  fPi0Candidates->Add(pi0cand);
2461  if(fDoMesonQA>0){
2462  fHistoPhotonPairYPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2463  fHistoPhotonPairAlphaPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha(),fWeightJetJetMC);
2464  fHistoPhotonPairOpenAnglePt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle(),fWeightJetJetMC);
2465  fHistoPhotonPairEtaPhi[fiCut]->Fill(pi0cand->Phi(),pi0cand->Eta(),fWeightJetJetMC);
2466  }
2467  // get third photon from conversion photon candidates and calculate inv mass of omega
2468  for(Int_t thirdGammaIndex=0;thirdGammaIndex<fGammaCandidates->GetEntries();thirdGammaIndex++){
2469  if (thirdGammaIndex==firstGammaIndex) continue;
2470  Bool_t matchedgamma1wconvgamma2 = kFALSE;
2471  AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(thirdGammaIndex));
2472  if (gamma2==NULL) continue;
2473  matchedgamma1wconvgamma2 = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma2, cluster, fInputEvent, fWeightJetJetMC);
2474  AliAODConversionMother *omegacand = new AliAODConversionMother(pi0cand,gamma2);
2475  if (matchedgamma1wconvgamma2){
2476  fHistoMotherMatchedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2477  delete omegacand;
2478  omegacand=0x0;
2479  continue;
2480  }
2481  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(omegacand, pi0cand, gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
2482  fHistoMotherInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2483  if(fIsMC>0){
2484  if(fInputEvent->IsA()==AliESDEvent::Class())
2485  ProcessTrueMesonCandidates(omegacand,gamma0,gamma1,gamma2);
2486  if(fInputEvent->IsA()==AliAODEvent::Class())
2487  ProcessTrueMesonCandidatesAOD(omegacand,gamma0,gamma1,gamma2);
2488  }
2489  if(omegacand->M()>0.7 && omegacand->M()<0.85){
2490  fHistoGammaFromMotherPt[fiCut]->Fill(gamma2->Pt(),fWeightJetJetMC);
2491  if(fDoMesonQA>0){
2494  fHistoMotherYPt[fiCut]->Fill(omegacand->Pt(),omegacand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2495  fHistoMotherAlphaPt[fiCut]->Fill(omegacand->Pt(),omegacand->GetAlpha(),fWeightJetJetMC);
2496  fHistoMotherEtaPhi[fiCut]->Fill(omegacand->Phi(),omegacand->Eta(),fWeightJetJetMC);
2497  fHistoMotherPi0AnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(pi0cand->Vect()),fWeightJetJetMC);
2498  fHistoMotherGammaAnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(gamma2->Vect()),fWeightJetJetMC);
2499  fHistoPi0GammaAnglePt[fiCut]->Fill(omegacand->Pt(),pi0cand->Angle(gamma2->Vect()),fWeightJetJetMC);
2500  }
2501  }
2502  } else if(fDoPiZeroGammaAngleCut){
2503  fHistoMotherAngleCutRejectedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2504  }
2505  delete omegacand;
2506  omegacand=0x0;
2507  }
2508  } else{
2509  delete pi0cand;
2510  pi0cand=0x0;
2511  }
2512  }
2513  }
2514  }
2515  }
2516  }
2517  break;
2518  //cal-cal,cal
2519  case 2:
2520  if(fClusterCandidates->GetEntries()>2){
2521  for(Int_t firstGammaIndex=0;firstGammaIndex<fClusterCandidates->GetEntries();firstGammaIndex++){
2522  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(firstGammaIndex));
2523  if (gamma0==NULL || !(gamma0->GetIsCaloPhoton())) continue;
2524  for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
2525  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
2526  if (gamma1==NULL || !(gamma1->GetIsCaloPhoton())) continue;
2527  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0, gamma1);
2529  ->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())
2530  && pi0cand->Pt() > fMinPi0Pt){
2531  fHistoPhotonPairInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(),fWeightJetJetMC);
2532  if(pi0cand->M() > ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionLow() &&
2533  pi0cand->M() < ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionHigh()){
2534  //change energy of pi0 candidate s.t. its mass is the pdg mass
2535  pi0cand->SetPxPyPzE(pi0cand->Px(),pi0cand->Py(),pi0cand->Pz(),TMath::Sqrt(0.1349766*0.1349766+pi0cand->P()*pi0cand->P()));
2536  fPi0Candidates->Add(pi0cand);
2537  if(fDoMesonQA>0){
2538  fHistoPhotonPairYPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2539  fHistoPhotonPairAlphaPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha(),fWeightJetJetMC);
2540  fHistoPhotonPairOpenAnglePt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle(),fWeightJetJetMC);
2541  fHistoPhotonPairEtaPhi[fiCut]->Fill(pi0cand->Phi(),pi0cand->Eta(),fWeightJetJetMC);
2542  }
2543  for(Int_t thirdGammaIndex=0;thirdGammaIndex<fClusterCandidates->GetEntries();thirdGammaIndex++){
2544  if (thirdGammaIndex==secondGammaIndex || thirdGammaIndex==firstGammaIndex) continue;
2545  AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(thirdGammaIndex));
2546  if (gamma2==NULL || !(gamma2->GetIsCaloPhoton())) continue;
2547  AliAODConversionMother *omegacand = new AliAODConversionMother(pi0cand,gamma2);
2548  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(omegacand, pi0cand, gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
2549  fHistoMotherInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2550  if(fIsMC>0){
2551  if(fInputEvent->IsA()==AliESDEvent::Class())
2552  ProcessTrueMesonCandidates(omegacand,gamma0,gamma1,gamma2);
2553  if(fInputEvent->IsA()==AliAODEvent::Class())
2554  ProcessTrueMesonCandidatesAOD(omegacand,gamma0,gamma1,gamma2);
2555  }
2556  if(omegacand->M()>0.7 && omegacand->M()<0.85){
2557  fHistoGammaFromMotherPt[fiCut]->Fill(gamma2->Pt(),fWeightJetJetMC);
2558  if(fDoMesonQA>0){
2559  fHistoMotherYPt[fiCut]->Fill(omegacand->Pt(),omegacand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2560  fHistoMotherAlphaPt[fiCut]->Fill(omegacand->Pt(),omegacand->GetAlpha(),fWeightJetJetMC);
2561  fHistoMotherEtaPhi[fiCut]->Fill(omegacand->Phi(),omegacand->Eta(),fWeightJetJetMC);
2562  fHistoMotherPi0AnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(pi0cand->Vect()),fWeightJetJetMC);
2563  fHistoMotherGammaAnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(gamma2->Vect()),fWeightJetJetMC);
2564  fHistoPi0GammaAnglePt[fiCut]->Fill(omegacand->Pt(),pi0cand->Angle(gamma2->Vect()),fWeightJetJetMC);
2565  }
2566  }
2567  } else if(fDoPiZeroGammaAngleCut){
2568  fHistoMotherAngleCutRejectedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2569  }
2570  delete omegacand;
2571  omegacand=0x0;
2572  }
2573  } else{
2574  delete pi0cand;
2575  pi0cand=0x0;
2576  }
2577  }
2578  }
2579  }
2580  }
2581  break;
2582  //cal-cal,PCM
2583  case 3:
2584  if(fClusterCandidates->GetEntries()>1 && fGammaCandidates->GetEntries()>0){
2585  for(Int_t firstGammaIndex=0;firstGammaIndex<fClusterCandidates->GetEntries();firstGammaIndex++){
2586  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(firstGammaIndex));
2587  if (gamma0==NULL || !(gamma0->GetIsCaloPhoton())) continue;
2588  AliVCluster* cluster0 = fInputEvent->GetCaloCluster(gamma0->GetCaloClusterRef());
2589  for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
2590  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
2591  if (gamma1==NULL || !(gamma1->GetIsCaloPhoton())) continue;
2592  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0, gamma1);
2594  ->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())
2595  && pi0cand->Pt() > fMinPi0Pt){
2596  fHistoPhotonPairInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(),fWeightJetJetMC);
2597  if(pi0cand->M() > ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionLow() &&
2598  pi0cand->M() < ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionHigh()){
2599  //change energy of pi0 candidate s.t. its mass is the pdg mass
2600  pi0cand->SetPxPyPzE(pi0cand->Px(),pi0cand->Py(),pi0cand->Pz(),TMath::Sqrt(0.1349766*0.1349766+pi0cand->P()*pi0cand->P()));
2601  fPi0Candidates->Add(pi0cand);
2602  if(fDoMesonQA>0){
2603  fHistoPhotonPairYPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2604  fHistoPhotonPairAlphaPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha(),fWeightJetJetMC);
2605  fHistoPhotonPairOpenAnglePt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle(),fWeightJetJetMC);
2606  fHistoPhotonPairEtaPhi[fiCut]->Fill(pi0cand->Phi(),pi0cand->Eta(),fWeightJetJetMC);
2607  }
2608  AliVCluster* cluster1 = fInputEvent->GetCaloCluster(gamma1->GetCaloClusterRef());
2609  for(Int_t thirdGammaIndex=0;thirdGammaIndex<fGammaCandidates->GetEntries();thirdGammaIndex++){
2610  AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(thirdGammaIndex));
2611  Bool_t matched = (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma2,cluster0, fInputEvent, fWeightJetJetMC))
2612  || (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma2,cluster1, fInputEvent, fWeightJetJetMC));
2613  AliAODConversionMother *omegacand = new AliAODConversionMother(pi0cand,gamma2);
2614  if (matched){
2615  fHistoMotherMatchedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2616  delete omegacand;
2617  omegacand=0x0;
2618  continue;
2619  }
2620  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(omegacand, pi0cand, gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
2621  fHistoMotherInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2622  if(fIsMC>0){
2623  if(fInputEvent->IsA()==AliESDEvent::Class())
2624  ProcessTrueMesonCandidates(omegacand,gamma0,gamma1,gamma2);
2625  if(fInputEvent->IsA()==AliAODEvent::Class())
2626  ProcessTrueMesonCandidatesAOD(omegacand,gamma0,gamma1,gamma2);
2627  }
2628  if(omegacand->M()>0.7 && omegacand->M()<0.85){
2629  fHistoGammaFromMotherPt[fiCut]->Fill(gamma2->Pt(),fWeightJetJetMC);
2630  if(fDoMesonQA>0){
2632  fHistoMotherYPt[fiCut]->Fill(omegacand->Pt(),omegacand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2633  fHistoMotherAlphaPt[fiCut]->Fill(omegacand->Pt(),omegacand->GetAlpha(),fWeightJetJetMC);
2634  fHistoMotherEtaPhi[fiCut]->Fill(omegacand->Phi(),omegacand->Eta(),fWeightJetJetMC);
2635  fHistoMotherPi0AnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(pi0cand->Vect()),fWeightJetJetMC);
2636  fHistoMotherGammaAnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(gamma2->Vect()),fWeightJetJetMC);
2637  fHistoPi0GammaAnglePt[fiCut]->Fill(omegacand->Pt(),pi0cand->Angle(gamma2->Vect()),fWeightJetJetMC);
2638  }
2639  }
2640  } else if(fDoPiZeroGammaAngleCut){
2641  fHistoMotherAngleCutRejectedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2642  }
2643  delete omegacand;
2644  omegacand=0x0;
2645  }
2646  } else{
2647  delete pi0cand;
2648  pi0cand=0x0;
2649  }
2650  }
2651  }
2652  }
2653  }
2654  break;
2655  //PCM-PCM,cal
2656  case 4:
2657  if(fGammaCandidates->GetEntries()>1 && fClusterCandidates->GetEntries()>0){
2658  for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
2659  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
2660  if(gamma0==NULL) continue;
2661  for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fGammaCandidates->GetEntries();secondGammaIndex++){
2662  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(secondGammaIndex));
2663  if(gamma1==NULL) continue;
2664  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
2666  ->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())
2667  && pi0cand->Pt() > fMinPi0Pt){
2668  fHistoPhotonPairInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(),fWeightJetJetMC);
2669  if(pi0cand->M() > ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionLow() &&
2670  pi0cand->M() < ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionHigh()){
2671  //change energy of pi0 candidate s.t. its mass is the pdg mass
2672  pi0cand->SetPxPyPzE(pi0cand->Px(),pi0cand->Py(),pi0cand->Pz(),TMath::Sqrt(0.1349766*0.1349766+pi0cand->P()*pi0cand->P()));
2673  fPi0Candidates->Add(pi0cand);
2674  if(fDoMesonQA>0){
2675  fHistoPhotonPairYPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2676  fHistoPhotonPairAlphaPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha(),fWeightJetJetMC);
2677  fHistoPhotonPairOpenAnglePt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle(),fWeightJetJetMC);
2678  fHistoPhotonPairEtaPhi[fiCut]->Fill(pi0cand->Phi(),pi0cand->Eta(),fWeightJetJetMC);
2679  }
2680  for(Int_t thirdGammaIndex=0;thirdGammaIndex<fClusterCandidates->GetEntries();thirdGammaIndex++){
2681  AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(thirdGammaIndex));
2682  if(gamma2==NULL || !(gamma2->GetIsCaloPhoton())) continue;
2683  AliVCluster* cluster = fInputEvent->GetCaloCluster(gamma2->GetCaloClusterRef());
2684  Bool_t matched = (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma0,cluster, fInputEvent, fWeightJetJetMC))
2685  || (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma1,cluster, fInputEvent, fWeightJetJetMC));
2686  AliAODConversionMother *omegacand = new AliAODConversionMother(pi0cand,gamma2);
2687  if (matched){
2688  fHistoMotherMatchedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2689  delete omegacand;
2690  omegacand=0x0;
2691  continue;
2692  }
2693  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(omegacand, pi0cand, gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
2694  fHistoMotherInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2695  if(fIsMC>0){
2696  if(fInputEvent->IsA()==AliESDEvent::Class())
2697  ProcessTrueMesonCandidates(omegacand,gamma0,gamma1,gamma2);
2698  if(fInputEvent->IsA()==AliAODEvent::Class())
2699  ProcessTrueMesonCandidatesAOD(omegacand,gamma0,gamma1,gamma2);
2700  }
2701  if(omegacand->M()>0.7 && omegacand->M()<0.85){
2702  fHistoGammaFromMotherPt[fiCut]->Fill(gamma2->Pt(),fWeightJetJetMC);
2703  if(fDoMesonQA){
2704  fHistoMotherYPt[fiCut]->Fill(omegacand->Pt(),omegacand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2705  fHistoMotherAlphaPt[fiCut]->Fill(omegacand->Pt(),omegacand->GetAlpha(),fWeightJetJetMC);
2706  fHistoMotherEtaPhi[fiCut]->Fill(omegacand->Phi(),omegacand->Eta(),fWeightJetJetMC);
2707  fHistoMotherPi0AnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(pi0cand->Vect()),fWeightJetJetMC);
2708  fHistoMotherGammaAnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(gamma2->Vect()),fWeightJetJetMC);
2709  fHistoPi0GammaAnglePt[fiCut]->Fill(omegacand->Pt(),pi0cand->Angle(gamma2->Vect()),fWeightJetJetMC);
2712  }
2713  }
2714  } else if(fDoPiZeroGammaAngleCut){
2715  fHistoMotherAngleCutRejectedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2716  }
2717  delete omegacand;
2718  omegacand=0x0;
2719  }
2720  } else{
2721  delete pi0cand;
2722  pi0cand=0x0;
2723  }
2724  }
2725  }
2726  }
2727  }
2728  break;
2729  //PCM-PCM,PCM
2730  case 5:
2731  if(fGammaCandidates->GetEntries()>2){
2732  for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
2733  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
2734  if (gamma0==NULL) continue;
2735  for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fGammaCandidates->GetEntries();secondGammaIndex++){
2736  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(secondGammaIndex));
2737  if (gamma1==NULL || (secondGammaIndex+1)>=(fGammaCandidates->GetEntries())) continue;
2738  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0, gamma1);
2740  ->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())
2741  && pi0cand->Pt() > fMinPi0Pt){
2742  fHistoPhotonPairInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(),fWeightJetJetMC);
2743  if(pi0cand->M() > ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionLow() &&
2744  pi0cand->M() < ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionHigh()){
2745  //change energy of pi0 candidate s.t. its mass is the pdg mass
2746  pi0cand->SetPxPyPzE(pi0cand->Px(),pi0cand->Py(),pi0cand->Pz(),TMath::Sqrt(0.1349766*0.1349766+pi0cand->P()*pi0cand->P()));
2747  fPi0Candidates->Add(pi0cand);
2748  if(fDoMesonQA>0){
2749  fHistoPhotonPairYPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2750  fHistoPhotonPairAlphaPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha(),fWeightJetJetMC);
2751  fHistoPhotonPairOpenAnglePt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle(),fWeightJetJetMC);
2752  fHistoPhotonPairEtaPhi[fiCut]->Fill(pi0cand->Phi(),pi0cand->Eta(),fWeightJetJetMC);
2753  }
2754  for(Int_t thirdGammaIndex=0;thirdGammaIndex<fGammaCandidates->GetEntries();thirdGammaIndex++){
2755  if (thirdGammaIndex==firstGammaIndex || thirdGammaIndex==secondGammaIndex) continue;
2756  AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(thirdGammaIndex));
2757  if (gamma2==NULL) continue;
2758  AliAODConversionMother *omegacand = new AliAODConversionMother(pi0cand,gamma2);
2759  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(omegacand, pi0cand, gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
2760  if(fIsMC>0){
2761  if(fInputEvent->IsA()==AliESDEvent::Class())
2762  ProcessTrueMesonCandidates(omegacand,gamma0,gamma1,gamma2);
2763  if(fInputEvent->IsA()==AliAODEvent::Class())
2764  ProcessTrueMesonCandidatesAOD(omegacand,gamma0,gamma1,gamma2);
2765  }
2766  fHistoMotherInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2767  if(omegacand->M()>0.7 && omegacand->M()<0.85){
2768  fHistoGammaFromMotherPt[fiCut]->Fill(gamma2->Pt(),fWeightJetJetMC);
2769  if(fDoMesonQA>0){
2770  fHistoMotherYPt[fiCut]->Fill(omegacand->Pt(),omegacand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2771  fHistoMotherAlphaPt[fiCut]->Fill(omegacand->Pt(),omegacand->GetAlpha(),fWeightJetJetMC);
2772  fHistoMotherEtaPhi[fiCut]->Fill(omegacand->Phi(),omegacand->Eta(),fWeightJetJetMC);
2773  fHistoMotherPi0AnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(pi0cand->Vect()),fWeightJetJetMC);
2774  fHistoMotherGammaAnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(gamma2->Vect()),fWeightJetJetMC);
2775  fHistoPi0GammaAnglePt[fiCut]->Fill(omegacand->Pt(),pi0cand->Angle(gamma2->Vect()),fWeightJetJetMC);
2776  }
2777  }
2778  } else if(fDoPiZeroGammaAngleCut){
2779  fHistoMotherAngleCutRejectedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2780  }
2781  delete omegacand;
2782  omegacand=0x0;
2783  }
2784  } else{
2785  delete pi0cand;
2786  pi0cand=0x0;
2787  }
2788  }
2789  }
2790  }
2791  }
2792  break;
2793  }
2794 }
2795 //______________________________________________________________________
2797 {
2798  switch (fReconMethod){
2799  // pcm-cal,cal
2800  case 0:
2801  {
2802  // get gamma0MotherLabel
2803  Int_t gamma0MCLabel = -1;
2804  Int_t gamma0MotherLabel = -1;
2805  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
2806  gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(fMCEvent);
2807  if(gamma0MCLabel>-1){
2808  TParticle * gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
2809  gamma0MotherLabel=gammaMC0->GetFirstMother();
2810  }
2811  }
2812 
2813  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2814  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
2815  Int_t gamma1MotherLabel = -1;
2816  TParticle * gammaMC1 = 0x0;
2817  if(gamma1MCLabel != -1){
2818  // get mother or grandmother of gamma1 depending on whether it is an electron-leading/photon-leading cluster
2819  gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
2820  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons it's the direct mother
2821  gamma1MotherLabel=gammaMC1->GetMother(0);
2822  }else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
2823  if (TrueGammaCandidate1->IsConversion() && gammaMC1->GetMother(0)>-1) gamma1MotherLabel=(fMCEvent->Particle(gammaMC1->GetMother(0)))->GetMother(0);
2824  else gamma1MotherLabel=gammaMC1->GetMother(0);
2825  }
2826  }
2827 
2828  // check if mother of gamma0 and gamma1 is really a pi0
2829  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel && ((TParticle*)fMCEvent->Particle(gamma0MotherLabel))->GetPdgCode() == 111){
2830 
2831  // fill pi0 histograms here if necessary
2832 
2833  if (!TrueGammaCandidate2->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2834  Int_t gamma2MCLabel = TrueGammaCandidate2->GetCaloPhotonMCLabel(0); // get most probable MC label
2835  Int_t gamma2MotherLabel = -1;
2836  TParticle * gammaMC2 = 0x0;
2837  if(gamma2MCLabel != -1){
2838  // get mother or grandmother of gamma1 (potentially true omega) depending on whether it is an electron-leading/photon-leading cluster
2839  gammaMC2 = (TParticle*)fMCEvent->Particle(gamma2MCLabel);
2840  if (TrueGammaCandidate2->IsLargestComponentPhoton()){ // for photons it's the direct mother
2841  gamma2MotherLabel=gammaMC2->GetMother(0);
2842  }else if (TrueGammaCandidate2->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
2843  if (TrueGammaCandidate2->IsConversion() && gammaMC2->GetMother(0)>-1) gamma2MotherLabel=fMCEvent->Particle(gammaMC2->GetMother(0))->GetMother(0);
2844  else gamma2MotherLabel=gammaMC2->GetMother(0);
2845  }
2846  }
2847 
2848  //get pi0MotherLabel
2849  Int_t pi0MotherLabel = fMCEvent->Particle(gamma0MotherLabel)->GetMother(0);
2850  // check if mother of pi0 and mother of gamma2 are the same particle and that it is an omega
2851  if(pi0MotherLabel>=0 && gamma2MotherLabel==pi0MotherLabel && ((TParticle*)fMCEvent->Particle(pi0MotherLabel))->GetPdgCode() == 223){
2852  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
2853  // create pi0 candidate and fill histograms
2854  AliAODConversionMother *TruePi0 = new AliAODConversionMother(TrueGammaCandidate0, TrueGammaCandidate1);
2855  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
2856  fHistoTrueGammaFromOmegaPt[fiCut]->Fill(TrueGammaCandidate2->Pt(),fWeightJetJetMC);
2857  if(fDoMesonQA>0){
2858  fHistoTrueOmegaYPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2859  fHistoTrueOmegaAlphaPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->GetAlpha(),fWeightJetJetMC);
2860  fHistoTrueOmegaEtaPhi[fiCut]->Fill(OmegaCandidate->Phi(),OmegaCandidate->Eta(),fWeightJetJetMC);
2861  fHistoTrueOmegaGammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
2862  fHistoTrueOmegaPtGammaPt[fiCut]->Fill(OmegaCandidate->Pt(),TrueGammaCandidate2->Pt(),fWeightJetJetMC);
2863  fHistoTruePi0FromOmegaAlphaPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->GetAlpha(),fWeightJetJetMC);
2864  fHistoTruePi0FromOmegaYPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2865  fHistoTruePi0FromOmegaEtaPhi[fiCut]->Fill(TruePi0->Phi(),TruePi0->Eta(),fWeightJetJetMC);
2867  fHistoTrueOmegaPi0AnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TruePi0->Vect()),fWeightJetJetMC);
2868  fHistoTruePi0GammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
2869  fHistoTrueOmegaPtPi0Pt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Pt(),fWeightJetJetMC);
2870  }
2871  delete TruePi0;
2872  TruePi0=0x0;
2873  }
2874  }
2875  }
2876  break;
2877  // pcm-cal,pcm
2878  case 1:
2879  {
2880  // get gamma0MotherLabel
2881  Int_t gamma0MCLabel = -1;
2882  Int_t gamma0MotherLabel = -1;
2883  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
2884  gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(fMCEvent);
2885  if(gamma0MCLabel>-1){
2886  TParticle * gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
2887  gamma0MotherLabel=gammaMC0->GetFirstMother();
2888  }
2889  }
2890 
2891  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2892  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
2893  Int_t gamma1MotherLabel = -1;
2894  TParticle * gammaMC1 = 0x0;
2895  if(gamma1MCLabel != -1){
2896  // get mother or grandmother of gamma1 depending on whether it is an electron-leading/photon-leading cluster
2897  gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
2898  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons it's the direct mother
2899  gamma1MotherLabel=gammaMC1->GetMother(0);
2900  }else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
2901  if (TrueGammaCandidate1->IsConversion() && gammaMC1->GetMother(0)>-1) gamma1MotherLabel=fMCEvent->Particle(gammaMC1->GetMother(0))->GetMother(0);
2902  else gamma1MotherLabel=gammaMC1->GetMother(0);
2903  }
2904  }
2905 
2906  // check if mother of gamma0 and gamma1 is really a pi0
2907  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel && ((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
2908 
2909  // fill pi0 histograms here if necessary
2910 
2911  // get mother of gamma2
2912  Int_t gamma2MCLabel = -1;
2913  Int_t gamma2MotherLabel = -1;
2914  if (TrueGammaCandidate2->IsTrueConvertedPhoton()){
2915  gamma2MCLabel = TrueGammaCandidate2->GetMCParticleLabel(fMCEvent);
2916  if(gamma2MCLabel>-1){
2917  TParticle * gammaMC2 = (TParticle*)fMCEvent->Particle(gamma2MCLabel);
2918  gamma2MotherLabel = gammaMC2->GetFirstMother();
2919  }
2920  }
2921 
2922  // get pi0MotherLabel
2923  Int_t pi0MotherLabel = fMCEvent->Particle(gamma0MotherLabel)->GetMother(0);
2924  // check if mother of pi0 and mother of gamma2 are the same particle and that it is an omega
2925  if(pi0MotherLabel>=0 && gamma2MotherLabel==pi0MotherLabel && ((TParticle*)fMCEvent->Particle(pi0MotherLabel))->GetPdgCode() == 223){
2926  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
2927  // create pi0 candidate and fill histograms
2928  AliAODConversionMother *TruePi0 = new AliAODConversionMother(TrueGammaCandidate0, TrueGammaCandidate1);
2929  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
2930  fHistoTrueGammaFromOmegaPt[fiCut]->Fill(TrueGammaCandidate2->Pt(),fWeightJetJetMC);
2931  if(fDoMesonQA>0){
2932  fHistoTrueOmegaYPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2933  fHistoTrueOmegaAlphaPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->GetAlpha(),fWeightJetJetMC);
2934  fHistoTrueOmegaEtaPhi[fiCut]->Fill(OmegaCandidate->Phi(),OmegaCandidate->Eta(),fWeightJetJetMC);
2935  fHistoTrueOmegaGammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
2936  fHistoTrueOmegaPtGammaPt[fiCut]->Fill(OmegaCandidate->Pt(),TrueGammaCandidate2->Pt(),fWeightJetJetMC);
2937  fHistoTruePi0FromOmegaAlphaPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->GetAlpha(),fWeightJetJetMC);
2938  fHistoTruePi0FromOmegaYPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2939  fHistoTruePi0FromOmegaEtaPhi[fiCut]->Fill(TruePi0->Phi(),TruePi0->Eta(),fWeightJetJetMC);
2941  fHistoTrueOmegaPi0AnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TruePi0->Vect()),fWeightJetJetMC);
2942  fHistoTruePi0GammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
2943  fHistoTrueOmegaPtPi0Pt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Pt(),fWeightJetJetMC);
2944  }
2945  delete TruePi0;
2946  TruePi0=0x0;
2947  }
2948  }
2949  }
2950  break;
2951  // cal-cal,cal
2952  case 2:
2953  {
2954  // get gamma0MotherLabel
2955  if (!TrueGammaCandidate0->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2956  Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
2957  Int_t gamma0MotherLabel = -1;
2958  TParticle * gammaMC0 = 0x0;
2959  if(gamma0MCLabel != -1){
2960  // get mother or grandmother of gamma0 depending on whether it is an electron-leading/photon-leading cluster
2961  gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
2962  if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons it's the direct mother
2963  gamma0MotherLabel=gammaMC0->GetMother(0);
2964  }else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
2965  if (TrueGammaCandidate0->IsConversion() && gammaMC0->GetMother(0)>-1) gamma0MotherLabel=fMCEvent->Particle(gammaMC0->GetMother(0))->GetMother(0);
2966  else gamma0MotherLabel=gammaMC0->GetMother(0);
2967  }
2968  }
2969 
2970  // get gamma1MotherLabel
2971  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2972  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
2973  Int_t gamma1MotherLabel = -1;
2974  TParticle * gammaMC1 = 0x0;
2975  if(gamma1MCLabel != -1){
2976  // get mother or grandmother of gamma1 depending on whether it is an electron-leading/photon-leading cluster
2977  gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
2978  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons it's the direct mother
2979  gamma1MotherLabel=gammaMC1->GetMother(0);
2980  }else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
2981  if (TrueGammaCandidate1->IsConversion() && gammaMC1->GetMother(0)>-1) gamma1MotherLabel=fMCEvent->Particle(gammaMC1->GetMother(0))->GetMother(0);
2982  else gamma1MotherLabel=gammaMC1->GetMother(0);
2983  }
2984  }
2985 
2986  // check if mother of gamma0 and gamma1 is really a pi0
2987  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel && ((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
2988 
2989  // fill pi0 histograms here if necessary
2990 
2991  if (!TrueGammaCandidate2->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2992  Int_t gamma2MCLabel = TrueGammaCandidate2->GetCaloPhotonMCLabel(0); // get most probable MC label
2993  Int_t gamma2MotherLabel = -1;
2994  TParticle * gammaMC2 = 0x0;
2995  if(gamma2MCLabel != -1){
2996  // get mother or grandmother of gamma2 (potentially true omega) depending on whether it is an electron-leading/photon-leading cluster
2997  gammaMC2 = (TParticle*)fMCEvent->Particle(gamma2MCLabel);
2998  if (TrueGammaCandidate2->IsLargestComponentPhoton()){ // for photons it's the direct mother
2999  gamma2MotherLabel=gammaMC2->GetMother(0);
3000  }else if (TrueGammaCandidate2->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3001  if (TrueGammaCandidate2->IsConversion() && gammaMC2->GetMother(0)>-1) gamma2MotherLabel=fMCEvent->Particle(gammaMC2->GetMother(0))->GetMother(0);
3002  else gamma2MotherLabel=gammaMC2->GetMother(0);
3003  }
3004  }
3005 
3006  //get pi0MotherLabel
3007  Int_t pi0MotherLabel = fMCEvent->Particle(gamma0MotherLabel)->GetMother(0);
3008  // check if mother of pi0 and mother of gamma2 are the same particle and that it is an omega
3009  if(pi0MotherLabel>=0 && gamma2MotherLabel==pi0MotherLabel && ((TParticle*)fMCEvent->Particle(pi0MotherLabel))->GetPdgCode() == 223){
3010  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3011  // create pi0 candidate and fill histograms
3012  AliAODConversionMother *TruePi0 = new AliAODConversionMother(TrueGammaCandidate0, TrueGammaCandidate1);
3013  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3014  fHistoTrueGammaFromOmegaPt[fiCut]->Fill(TrueGammaCandidate2->Pt(),fWeightJetJetMC);
3015  if(fDoMesonQA>0){
3016  fHistoTrueOmegaYPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
3017  fHistoTrueOmegaAlphaPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->GetAlpha(),fWeightJetJetMC);
3018  fHistoTrueOmegaEtaPhi[fiCut]->Fill(OmegaCandidate->Phi(),OmegaCandidate->Eta(),fWeightJetJetMC);
3019  fHistoTrueOmegaGammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
3020  fHistoTrueOmegaPtGammaPt[fiCut]->Fill(OmegaCandidate->Pt(),TrueGammaCandidate2->Pt(),fWeightJetJetMC);
3021  fHistoTruePi0FromOmegaAlphaPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->GetAlpha(),fWeightJetJetMC);
3022  fHistoTruePi0FromOmegaYPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
3023  fHistoTruePi0FromOmegaEtaPhi[fiCut]->Fill(TruePi0->Phi(),TruePi0->Eta(),fWeightJetJetMC);
3025  fHistoTrueOmegaPi0AnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TruePi0->Vect()),fWeightJetJetMC);
3026  fHistoTruePi0GammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
3027  fHistoTrueOmegaPtPi0Pt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Pt(),fWeightJetJetMC);
3028  }
3029  delete TruePi0;
3030  TruePi0=0x0;
3031  }
3032  }
3033  }
3034  break;
3035  // cal-cal,pcm
3036  case 3:
3037  {
3038  // get gamma0MotherLabel
3039  if (!TrueGammaCandidate0->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3040  Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
3041  Int_t gamma0MotherLabel = -1;
3042  TParticle * gammaMC0 = 0x0;
3043  if(gamma0MCLabel != -1){
3044  // get mother or grandmother of gamma0 depending on whether it is an electron-leading/photon-leading cluster
3045  gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
3046  if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons it's the direct mother
3047  gamma0MotherLabel=gammaMC0->GetMother(0);
3048  }else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3049  if (TrueGammaCandidate0->IsConversion() && gammaMC0->GetMother(0)>-1) gamma0MotherLabel=fMCEvent->Particle(gammaMC0->GetMother(0))->GetMother(0);
3050  else gamma0MotherLabel=gammaMC0->GetMother(0);
3051  }
3052  }
3053 
3054  // get gamma1MotherLabel
3055  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3056  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
3057  Int_t gamma1MotherLabel = -1;
3058  TParticle * gammaMC1 = 0x0;
3059  if(gamma1MCLabel != -1){
3060  // get mother or grandmother of gamma1 depending on whether it is an electron-leading/photon-leading cluster
3061  gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
3062  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons it's the direct mother
3063  gamma1MotherLabel=gammaMC1->GetMother(0);
3064  }else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3065  if (TrueGammaCandidate1->IsConversion() && gammaMC1->GetMother(0)>-1) gamma1MotherLabel=fMCEvent->Particle(gammaMC1->GetMother(0))->GetMother(0);
3066  else gamma1MotherLabel=gammaMC1->GetMother(0);
3067  }
3068  }
3069 
3070  // check if mother of gamma0 and gamma1 is really a pi0
3071  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel && ((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
3072 
3073  // fill pi0 histograms here if necessary
3074 
3075  // get mother of gamma2
3076  Int_t gamma2MCLabel = -1;
3077  Int_t gamma2MotherLabel = -1;
3078  if (TrueGammaCandidate2->IsTrueConvertedPhoton()){
3079  gamma2MCLabel = TrueGammaCandidate2->GetMCParticleLabel(fMCEvent);
3080  if(gamma2MCLabel>-1){
3081  TParticle * gammaMC2 = (TParticle*)fMCEvent->Particle(gamma2MCLabel);
3082  gamma2MotherLabel = gammaMC2->GetFirstMother();
3083  }
3084  }
3085 
3086  // get pi0MotherLabel
3087  Int_t pi0MotherLabel = fMCEvent->Particle(gamma0MotherLabel)->GetMother(0);
3088  // check if mother of pi0 and mother of gamma2 are the same particle and that it is an omega
3089  if(pi0MotherLabel>=0 && gamma2MotherLabel==pi0MotherLabel && ((TParticle*)fMCEvent->Particle(pi0MotherLabel))->GetPdgCode() == 223){
3090  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3091  // create pi0 candidate and fill histograms
3092  AliAODConversionMother *TruePi0 = new AliAODConversionMother(TrueGammaCandidate0, TrueGammaCandidate1);
3093  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3094  fHistoTrueGammaFromOmegaPt[fiCut]->Fill(TrueGammaCandidate2->Pt(),fWeightJetJetMC);
3095  if(fDoMesonQA>0){
3096  fHistoTrueOmegaYPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
3097  fHistoTrueOmegaAlphaPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->GetAlpha(),fWeightJetJetMC);
3098  fHistoTrueOmegaEtaPhi[fiCut]->Fill(OmegaCandidate->Phi(),OmegaCandidate->Eta(),fWeightJetJetMC);
3099  fHistoTrueOmegaGammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
3100  fHistoTrueOmegaPtGammaPt[fiCut]->Fill(OmegaCandidate->Pt(),TrueGammaCandidate2->Pt(),fWeightJetJetMC);
3101  fHistoTruePi0FromOmegaAlphaPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->GetAlpha(),fWeightJetJetMC);
3102  fHistoTruePi0FromOmegaYPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
3103  fHistoTruePi0FromOmegaEtaPhi[fiCut]->Fill(TruePi0->Phi(),TruePi0->Eta(),fWeightJetJetMC);
3105  fHistoTrueOmegaPi0AnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TruePi0->Vect()),fWeightJetJetMC);
3106  fHistoTruePi0GammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
3107  fHistoTrueOmegaPtPi0Pt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Pt(),fWeightJetJetMC);
3108  }
3109  delete TruePi0;
3110  TruePi0=0x0;
3111  }
3112  }
3113  }
3114  break;
3115  // pcm-pcm,cal
3116  case 4:
3117  {
3118  // get gamma0MotherLabel
3119  Int_t gamma0MCLabel = -1;
3120  Int_t gamma0MotherLabel = -1;
3121  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
3122  gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(fMCEvent);
3123  if(gamma0MCLabel>-1){
3124  TParticle * gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
3125  gamma0MotherLabel=gammaMC0->GetFirstMother();
3126  }
3127  }
3128 
3129  // get gamma1MotherLabel
3130  Int_t gamma1MCLabel = -1;
3131  Int_t gamma1MotherLabel = -1;
3132  if (TrueGammaCandidate1->IsTrueConvertedPhoton()){
3133  gamma1MCLabel = TrueGammaCandidate1->GetMCParticleLabel(fMCEvent);
3134  if(gamma1MCLabel>-1){
3135  TParticle * gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
3136  gamma1MotherLabel=gammaMC1->GetFirstMother();
3137  }
3138  }
3139 
3140  // check if mother of gamma0 and gamma1 is really a pi0
3141  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel &&
3142  ((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
3143 
3144  // fill pi0 histograms here if necessary
3145 
3146  if (!TrueGammaCandidate2->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3147  Int_t gamma2MCLabel = TrueGammaCandidate2->GetCaloPhotonMCLabel(0); // get most probable MC label
3148  Int_t gamma2MotherLabel = -1;
3149  TParticle * gammaMC2 = 0x0;
3150  if(gamma2MCLabel != -1){
3151  // get mother or grandmother of gamma1 (potentially true omega) depending on whether it is an electron-leading/photon-leading cluster
3152  gammaMC2 = (TParticle*)fMCEvent->Particle(gamma2MCLabel);
3153  if (TrueGammaCandidate2->IsLargestComponentPhoton()){ // for photons it's the direct mother
3154  gamma2MotherLabel=gammaMC2->GetMother(0);
3155  }else if (TrueGammaCandidate2->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3156  if (TrueGammaCandidate2->IsConversion() && gammaMC2->GetMother(0)>-1) gamma2MotherLabel=fMCEvent->Particle(gammaMC2->GetMother(0))->GetMother(0);
3157  else gamma2MotherLabel=gammaMC2->GetMother(0);
3158  }
3159  }
3160 
3161  //get pi0MotherLabel
3162  Int_t pi0MotherLabel = fMCEvent->Particle(gamma0MotherLabel)->GetMother(0);
3163  // check if mother of pi0 and mother of gamma2 are the same particle and that it is an omega
3164  if(pi0MotherLabel>=0 && gamma2MotherLabel==pi0MotherLabel && ((TParticle*)fMCEvent->Particle(pi0MotherLabel))->GetPdgCode() == 223){
3165  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3166  // create pi0 candidate and fill histograms
3167  AliAODConversionMother *TruePi0 = new AliAODConversionMother(TrueGammaCandidate0, TrueGammaCandidate1);
3168  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3169  fHistoTrueGammaFromOmegaPt[fiCut]->Fill(TrueGammaCandidate2->Pt(),fWeightJetJetMC);
3170  if(fDoMesonQA>0){
3171  fHistoTrueOmegaYPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
3172  fHistoTrueOmegaAlphaPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->GetAlpha(),fWeightJetJetMC);
3173  fHistoTrueOmegaEtaPhi[fiCut]->Fill(OmegaCandidate->Phi(),OmegaCandidate->Eta(),fWeightJetJetMC);
3174  fHistoTrueOmegaGammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
3175  fHistoTrueOmegaPtGammaPt[fiCut]->Fill(OmegaCandidate->Pt(),TrueGammaCandidate2->Pt(),fWeightJetJetMC);
3176  fHistoTruePi0FromOmegaAlphaPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->GetAlpha(),fWeightJetJetMC);
3177  fHistoTruePi0FromOmegaYPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
3178  fHistoTruePi0FromOmegaEtaPhi[fiCut]->Fill(TruePi0->Phi(),TruePi0->Eta(),fWeightJetJetMC);
3180  fHistoTrueOmegaPi0AnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TruePi0->Vect()),fWeightJetJetMC);
3181  fHistoTruePi0GammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
3182  fHistoTrueOmegaPtPi0Pt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Pt(),fWeightJetJetMC);
3183  }
3184  delete TruePi0;
3185  TruePi0=0x0;
3186  }
3187  }
3188  }
3189  break;
3190  // pcm-pcm,pcm
3191  case 5:
3192  {
3193  // get gamma0MotherLabel
3194  Int_t gamma0MCLabel = -1;
3195  Int_t gamma0MotherLabel = -1;
3196  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
3197  gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(fMCEvent);
3198  if(gamma0MCLabel>-1){
3199  TParticle * gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
3200  gamma0MotherLabel=gammaMC0->GetFirstMother();
3201  }
3202  }
3203 
3204  // get gamma1MotherLabel
3205  Int_t gamma1MCLabel = -1;
3206  Int_t gamma1MotherLabel = -1;
3207  if (TrueGammaCandidate1->IsTrueConvertedPhoton()){
3208  gamma1MCLabel = TrueGammaCandidate1->GetMCParticleLabel(fMCEvent);
3209  if(gamma1MCLabel>-1){
3210  TParticle * gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
3211  gamma1MotherLabel=gammaMC1->GetFirstMother();
3212  }
3213  }
3214 
3215  // check if mother of gamma0 and gamma1 is really a pi0
3216  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel &&
3217  ((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
3218 
3219  // fill pi0 histograms here if necessary
3220 
3221  Int_t gamma2MCLabel = -1;
3222  Int_t gamma2MotherLabel = -1;
3223  if (TrueGammaCandidate2->IsTrueConvertedPhoton()){
3224  gamma2MCLabel = TrueGammaCandidate2->GetMCParticleLabel(fMCEvent);
3225  if(gamma2MCLabel>-1){
3226  TParticle * gammaMC2 = (TParticle*)fMCEvent->Particle(gamma2MCLabel);
3227  gamma2MotherLabel=gammaMC2->GetFirstMother();
3228  }
3229  }
3230 
3231  //get pi0MotherLabel
3232  Int_t pi0MotherLabel = fMCEvent->Particle(gamma0MotherLabel)->GetMother(0);
3233  // check if mother of pi0 and mother of gamma2 are the same particle and that it is an omega
3234  if(pi0MotherLabel>=0 && gamma2MotherLabel==pi0MotherLabel && ((TParticle*)fMCEvent->Particle(pi0MotherLabel))->GetPdgCode() == 223){
3235  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3236  // create pi0 candidate and fill histograms
3237  AliAODConversionMother *TruePi0 = new AliAODConversionMother(TrueGammaCandidate0, TrueGammaCandidate1);
3238  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3239  fHistoTrueGammaFromOmegaPt[fiCut]->Fill(TrueGammaCandidate2->Pt(),fWeightJetJetMC);
3240  if(fDoMesonQA>0){
3241  fHistoTrueOmegaYPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
3242  fHistoTrueOmegaAlphaPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->GetAlpha(),fWeightJetJetMC);
3243  fHistoTrueOmegaEtaPhi[fiCut]->Fill(OmegaCandidate->Phi(),OmegaCandidate->Eta(),fWeightJetJetMC);
3244  fHistoTrueOmegaGammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
3245  fHistoTrueOmegaPtGammaPt[fiCut]->Fill(OmegaCandidate->Pt(),TrueGammaCandidate2->Pt(),fWeightJetJetMC);
3246  fHistoTruePi0FromOmegaAlphaPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->GetAlpha(),fWeightJetJetMC);
3247  fHistoTruePi0FromOmegaYPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
3248  fHistoTruePi0FromOmegaEtaPhi[fiCut]->Fill(TruePi0->Phi(),TruePi0->Eta(),fWeightJetJetMC);
3250  fHistoTrueOmegaPi0AnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TruePi0->Vect()),fWeightJetJetMC);
3251  fHistoTruePi0GammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
3252  fHistoTrueOmegaPtPi0Pt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Pt(),fWeightJetJetMC);
3253  }
3254  delete TruePi0;
3255  TruePi0=0x0;
3256  }
3257  }
3258  }
3259  break;
3260  }
3261 }
3262 
3263 //______________________________________________________________________
3265 {
3266  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3267  if (AODMCTrackArray == NULL) return;
3268  Bool_t isTrueOmega = kFALSE;
3269 
3270  switch(fReconMethod){
3271  // pcm-cal,cal
3272  case 0:
3273  {
3274  AliAODMCParticle *positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
3275  AliAODMCParticle *negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
3276 
3277  Int_t gamma0MCLabel = -1;
3278  Int_t gamma0MotherLabel = -1;
3279  if(!positiveMC||!negativeMC)
3280  return;
3281 
3282  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
3283  gamma0MCLabel = positiveMC->GetMother();
3284  AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3285  gamma0MotherLabel=gammaMC0->GetMother();
3286  }
3287 
3288  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3289  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
3290  Int_t gamma1MotherLabel = -1;
3291 
3292  AliAODMCParticle * gammaMC1 = 0x0;
3293  if(gamma1MCLabel != -1){
3294  gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
3295  // get gamma1MotherLabel
3296  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons it's the direct mother
3297  gamma1MotherLabel=gammaMC1->GetMother();
3298  }else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3299  if (TrueGammaCandidate1->IsConversion()){
3300  AliAODMCParticle * gammaGrandMotherMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
3301  gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
3302  }else gamma1MotherLabel=gammaMC1->GetMother();
3303  }
3304  }
3305 
3306  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel &&
3307  ((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
3308 
3309  // create pi0 and get pi0MotherLabel
3310  AliAODMCParticle * TruePi0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel));
3311  Int_t pi0MotherLabel = TruePi0->GetMother();
3312 
3313  if (!TrueGammaCandidate2->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3314  Int_t gamma2MCLabel = TrueGammaCandidate2->GetCaloPhotonMCLabel(0); // get most probable MC label
3315  Int_t gamma2MotherLabel = -1;
3316 
3317  AliAODMCParticle * gammaMC2 = 0x0;
3318  if(gamma2MCLabel != -1){
3319  gammaMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma2MCLabel));
3320  // get mother label
3321  if (TrueGammaCandidate2->IsLargestComponentPhoton()){ // for photons it's the direct mother
3322  gamma2MotherLabel=gammaMC2->GetMother();
3323  }else if (TrueGammaCandidate2->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3324  if (TrueGammaCandidate2->IsConversion()){
3325  AliAODMCParticle * gammaGrandMotherMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC2->GetMother()));
3326  gamma2MotherLabel=gammaGrandMotherMC2->GetMother();
3327  }else gamma2MotherLabel=gammaMC2->GetMother();
3328  }
3329  }
3330 
3331  if(pi0MotherLabel==gamma2MotherLabel && ((AliAODMCParticle*)AODMCTrackArray->At(gamma2MotherLabel))->GetPdgCode() == 223){
3332  isTrueOmega = kTRUE;
3333  }
3334  if(isTrueOmega){
3335  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3336  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3337  }
3338  }
3339  }
3340  break;
3341  // pcm-cal,pcm
3342  case 1:
3343  {
3344  AliAODMCParticle *positive0MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
3345  AliAODMCParticle *negative0MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
3346 
3347  Int_t gamma0MCLabel = -1;
3348  Int_t gamma0MotherLabel = -1;
3349  if(!positive0MC||!negative0MC)
3350  return;
3351 
3352  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
3353  gamma0MCLabel = positive0MC->GetMother();
3354  AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3355  gamma0MotherLabel=gammaMC0->GetMother();
3356  }
3357 
3358  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3359  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
3360  Int_t gamma1MotherLabel = -1;
3361 
3362  AliAODMCParticle * gammaMC1 = 0x0;
3363  if(gamma1MCLabel != -1){
3364  gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
3365  // get gamma1MotherLabel
3366  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons it's the direct mother
3367  gamma1MotherLabel=gammaMC1->GetMother();
3368  }else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3369  if (TrueGammaCandidate1->IsConversion()){
3370  AliAODMCParticle * gammaGrandMotherMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
3371  gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
3372  }else gamma1MotherLabel=gammaMC1->GetMother();
3373  }
3374  }
3375 
3376  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel &&
3377  ((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
3378 
3379  // create pi0 and get pi0MotherLabel
3380  AliAODMCParticle * TruePi0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel));
3381  Int_t pi0MotherLabel = TruePi0->GetMother();
3382 
3383  // get gamma2MotherLabel
3384  AliAODMCParticle *positive2MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate2->GetMCLabelPositive()));
3385  AliAODMCParticle *negative2MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate2->GetMCLabelNegative()));
3386 
3387  Int_t gamma2MCLabel = -1;
3388  Int_t gamma2MotherLabel = -1;
3389  if(!positive2MC||!negative2MC)
3390  return;
3391 
3392  if (TrueGammaCandidate2->IsTrueConvertedPhoton()){
3393  gamma2MCLabel = positive2MC->GetMother();
3394  AliAODMCParticle * gammaMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma2MCLabel));
3395  gamma2MotherLabel=gammaMC2->GetMother();
3396  }
3397 
3398  if(pi0MotherLabel==gamma2MotherLabel && ((AliAODMCParticle*)AODMCTrackArray->At(gamma2MotherLabel))->GetPdgCode() == 223){
3399  isTrueOmega = kTRUE;
3400  }
3401  if(isTrueOmega){
3402  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3403  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3404  }
3405  }
3406  }
3407  break;
3408  // cal-cal,cal
3409  case 2:
3410  {
3411  if (!TrueGammaCandidate0->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3412  Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
3413  Int_t gamma0MotherLabel = -1;
3414 
3415  AliAODMCParticle * gammaMC0 = 0x0;
3416  if(gamma0MCLabel != -1){
3417  gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3418  // get gamma0MotherLabel
3419  if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons it's the direct mother
3420  gamma0MotherLabel=gammaMC0->GetMother();
3421  }else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3422  if (TrueGammaCandidate0->IsConversion()){
3423  AliAODMCParticle * gammaGrandMotherMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC0->GetMother()));
3424  gamma0MotherLabel=gammaGrandMotherMC0->GetMother();
3425  }else gamma0MotherLabel=gammaMC0->GetMother();
3426  }
3427  }
3428 
3429  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3430  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
3431  Int_t gamma1MotherLabel = -1;
3432 
3433  AliAODMCParticle * gammaMC1 = 0x0;
3434  if(gamma1MCLabel != -1){
3435  gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
3436  // get gamma1MotherLabel
3437  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons it's the direct mother
3438  gamma1MotherLabel=gammaMC1->GetMother();
3439  }else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3440  if (TrueGammaCandidate1->IsConversion()){
3441  AliAODMCParticle * gammaGrandMotherMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
3442  gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
3443  }else gamma1MotherLabel=gammaMC1->GetMother();
3444  }
3445  }
3446 
3447  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel &&
3448  ((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
3449 
3450  // create pi0 and get pi0MotherLabel
3451  AliAODMCParticle * TruePi0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel));
3452  Int_t pi0MotherLabel = TruePi0->GetMother();
3453 
3454  if (!TrueGammaCandidate2->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3455  Int_t gamma2MCLabel = TrueGammaCandidate2->GetCaloPhotonMCLabel(0); // get most probable MC label
3456  Int_t gamma2MotherLabel = -1;
3457 
3458  AliAODMCParticle * gammaMC2 = 0x0;
3459  if(gamma2MCLabel != -1){
3460  gammaMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma2MCLabel));
3461  // get gamma2MotherLabel
3462  if (TrueGammaCandidate2->IsLargestComponentPhoton()){ // for photons it's the direct mother
3463  gamma2MotherLabel=gammaMC2->GetMother();
3464  }else if (TrueGammaCandidate2->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3465  if (TrueGammaCandidate2->IsConversion()){
3466  AliAODMCParticle * gammaGrandMotherMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC2->GetMother()));
3467  gamma2MotherLabel=gammaGrandMotherMC2->GetMother();
3468  }else gamma2MotherLabel=gammaMC2->GetMother();
3469  }
3470  }
3471 
3472  if(pi0MotherLabel==gamma2MotherLabel && ((AliAODMCParticle*)AODMCTrackArray->At(gamma2MotherLabel))->GetPdgCode() == 223){
3473  isTrueOmega = kTRUE;
3474  }
3475  if(isTrueOmega){
3476  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3477  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3478  }
3479  }
3480  }
3481  break;
3482  // cal-cal,pcm
3483  case 3:
3484  {
3485  if (!TrueGammaCandidate0->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3486  Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
3487  Int_t gamma0MotherLabel = -1;
3488 
3489  AliAODMCParticle * gammaMC0 = 0x0;
3490  if(gamma0MCLabel != -1){
3491  gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3492  // get gamma0MotherLabel
3493  if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons it's the direct mother
3494  gamma0MotherLabel=gammaMC0->GetMother();
3495  }else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3496  if (TrueGammaCandidate0->IsConversion()){
3497  AliAODMCParticle * gammaGrandMotherMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC0->GetMother()));
3498  gamma0MotherLabel=gammaGrandMotherMC0->GetMother();
3499  }else gamma0MotherLabel=gammaMC0->GetMother();
3500  }
3501  }
3502 
3503  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3504  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
3505  Int_t gamma1MotherLabel = -1;
3506 
3507  AliAODMCParticle * gammaMC1 = 0x0;
3508  if(gamma1MCLabel != -1){
3509  gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
3510  // get gamma1MotherLabel
3511  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons it's the direct mother
3512  gamma1MotherLabel=gammaMC1->GetMother();
3513  }else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3514  if (TrueGammaCandidate1->IsConversion()){
3515  AliAODMCParticle * gammaGrandMotherMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
3516  gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
3517  }else gamma1MotherLabel=gammaMC1->GetMother();
3518  }
3519  }
3520 
3521  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel &&
3522  ((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
3523 
3524  // create pi0 and get pi0MotherLabel
3525  AliAODMCParticle * TruePi0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel));
3526  Int_t pi0MotherLabel = TruePi0->GetMother();
3527 
3528  // get gamma2MotherLabel
3529  AliAODMCParticle *positive2MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate2->GetMCLabelPositive()));
3530  AliAODMCParticle *negative2MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate2->GetMCLabelNegative()));
3531 
3532  Int_t gamma2MCLabel = -1;
3533  Int_t gamma2MotherLabel = -1;
3534  if(!positive2MC||!negative2MC)
3535  return;
3536 
3537  if (TrueGammaCandidate2->IsTrueConvertedPhoton()){
3538  gamma2MCLabel = positive2MC->GetMother();
3539  AliAODMCParticle * gammaMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma2MCLabel));
3540  gamma2MotherLabel=gammaMC2->GetMother();
3541  }
3542 
3543  if(pi0MotherLabel==gamma2MotherLabel && ((AliAODMCParticle*)AODMCTrackArray->At(gamma2MotherLabel))->GetPdgCode() == 223){
3544  isTrueOmega = kTRUE;
3545  }
3546  if(isTrueOmega){
3547  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3548  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3549  }
3550  }
3551  }
3552  break;
3553  // pcm-pcm,cal
3554  case 4:
3555  {
3556  AliAODMCParticle *positive0MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
3557  AliAODMCParticle *negative0MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
3558 
3559  Int_t gamma0MCLabel = -1;
3560  Int_t gamma0MotherLabel = -1;
3561  if(!positive0MC||!negative0MC)
3562  return;
3563 
3564  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
3565  gamma0MCLabel = positive0MC->GetMother();
3566  AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3567  gamma0MotherLabel=gammaMC0->GetMother();
3568  }
3569 
3570  AliAODMCParticle *positive1MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate1->GetMCLabelPositive()));
3571  AliAODMCParticle *negative1MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate1->GetMCLabelNegative()));
3572 
3573  Int_t gamma1MCLabel = -1;
3574  Int_t gamma1MotherLabel = -1;
3575  if(!positive1MC||!negative1MC)
3576  return;
3577 
3578  if (TrueGammaCandidate1->IsTrueConvertedPhoton()){
3579  gamma1MCLabel = positive1MC->GetMother();
3580  AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
3581  gamma1MotherLabel=gammaMC1->GetMother();
3582  }
3583 
3584  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel &&
3585  ((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
3586 
3587  // create pi0 and get pi0MotherLabel
3588  AliAODMCParticle * TruePi0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel));
3589  Int_t pi0MotherLabel = TruePi0->GetMother();
3590 
3591  if (!TrueGammaCandidate2->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3592  Int_t gamma2MCLabel = TrueGammaCandidate2->GetCaloPhotonMCLabel(0); // get most probable MC label
3593  Int_t gamma2MotherLabel = -1;
3594 
3595  AliAODMCParticle * gammaMC2 = 0x0;
3596  if(gamma2MCLabel != -1){
3597  gammaMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma2MCLabel));
3598  // get mother label
3599  if (TrueGammaCandidate2->IsLargestComponentPhoton()){ // for photons it's the direct mother
3600  gamma2MotherLabel=gammaMC2->GetMother();
3601  }else if (TrueGammaCandidate2->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3602  if (TrueGammaCandidate2->IsConversion()){
3603  AliAODMCParticle * gammaGrandMotherMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC2->GetMother()));
3604  gamma2MotherLabel=gammaGrandMotherMC2->GetMother();
3605  }else gamma2MotherLabel=gammaMC2->GetMother();
3606  }
3607  }
3608 
3609  if(pi0MotherLabel==gamma2MotherLabel && ((AliAODMCParticle*)AODMCTrackArray->At(gamma2MotherLabel))->GetPdgCode() == 223){
3610  isTrueOmega = kTRUE;
3611  }
3612  if(isTrueOmega){
3613  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3614  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3615  }
3616  }
3617  }
3618  break;
3619  // pcm-pcm,pcm
3620  case 5:
3621  {
3622  AliAODMCParticle *positive0MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
3623  AliAODMCParticle *negative0MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
3624 
3625  Int_t gamma0MCLabel = -1;
3626  Int_t gamma0MotherLabel = -1;
3627  if(!positive0MC||!negative0MC)
3628  return;
3629 
3630  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
3631  gamma0MCLabel = positive0MC->GetMother();
3632  AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3633  gamma0MotherLabel=gammaMC0->GetMother();
3634  }
3635 
3636  AliAODMCParticle *positive1MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate1->GetMCLabelPositive()));
3637  AliAODMCParticle *negative1MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate1->GetMCLabelNegative()));
3638 
3639  Int_t gamma1MCLabel = -1;
3640  Int_t gamma1MotherLabel = -1;
3641  if(!positive1MC||!negative1MC)
3642  return;
3643 
3644  if (TrueGammaCandidate1->IsTrueConvertedPhoton()){
3645  gamma1MCLabel = positive1MC->GetMother();
3646  AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
3647  gamma1MotherLabel=gammaMC1->GetMother();
3648  }
3649 
3650  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel &&
3651  ((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
3652 
3653  // create pi0 and get pi0MotherLabel
3654  AliAODMCParticle * TruePi0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel));
3655  Int_t pi0MotherLabel = TruePi0->GetMother();
3656 
3657  AliAODMCParticle *positive2MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate2->GetMCLabelPositive()));
3658  AliAODMCParticle *negative2MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate2->GetMCLabelNegative()));
3659 
3660  Int_t gamma2MCLabel = -1;
3661  Int_t gamma2MotherLabel = -1;
3662  if(!positive2MC||!negative2MC)
3663  return;
3664 
3665  if (TrueGammaCandidate2->IsTrueConvertedPhoton()){
3666  gamma2MCLabel = positive2MC->GetMother();
3667  AliAODMCParticle * gammaMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma2MCLabel));
3668  gamma2MotherLabel=gammaMC2->GetMother();
3669  }
3670 
3671  if(pi0MotherLabel==gamma2MotherLabel && ((AliAODMCParticle*)AODMCTrackArray->At(gamma2MotherLabel))->GetPdgCode() == 223){
3672  isTrueOmega = kTRUE;
3673  }
3674  if(isTrueOmega){
3675  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3676  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3677  }
3678  }
3679  }
3680  break;
3681  }
3682 }
3683 
3684 //________________________________________________________________________
3686 
3687  //zbin and mbin from pi0handler
3688  Int_t Pi0zbin = fBGPi0Handler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
3689  Int_t Pi0mbin = 0;
3690 
3691  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
3693  }else {
3694  Pi0mbin = fBGPi0Handler[fiCut]->GetMultiplicityBinIndex(fPi0Candidates->GetEntries());
3695  }
3696 
3698 
3699  // background generation using pi0s and gammas
3700  // pi0 from handler, gamma from current event
3701  for(Int_t previous=0;previous<fBGPi0Handler[fiCut]->GetNBGEvents();previous++){
3702  AliGammaConversionMotherAODVector* previousPi0s = fBGPi0Handler[fiCut]->GetBGGoodMesons(Pi0zbin,Pi0mbin,previous);
3703  if(fMoveParticleAccordingToVertex == kTRUE){
3704  bgEvent1Vertex = fBGPi0Handler[fiCut]->GetBGEventVertex(Pi0zbin,Pi0mbin,previous);
3705  }
3706  for(UInt_t iPi0=0;iPi0<previousPi0s->size();iPi0++){
3707  AliAODConversionMother BGpi0cand = (AliAODConversionMother)(*(previousPi0s->at(iPi0)));
3708  if(fMoveParticleAccordingToVertex == kTRUE && bgEvent1Vertex){
3709  MoveParticleAccordingToVertex(&BGpi0cand, bgEvent1Vertex);
3710  }
3711  if(fReconMethod % 2 == 0){ //EMCAL gamma
3712  for(Int_t iCurrent3=0;iCurrent3<fClusterCandidates->GetEntries();iCurrent3++){
3713  AliAODConversionPhoton *gamma2 = dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(iCurrent3));
3714  if(gamma2 == NULL || !(gamma2->GetIsCaloPhoton())) continue;
3715  AliAODConversionMother *BGOmegacand = new AliAODConversionMother(&BGpi0cand,gamma2);
3716  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(BGOmegacand, &BGpi0cand, gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
3717  fHistoDiffPi0SameGammaBackInvMassPt[fiCut]->Fill(BGOmegacand->M(),BGOmegacand->Pt(),fWeightJetJetMC);
3718  }
3719  delete BGOmegacand;
3720  BGOmegacand = 0x0;
3721  }
3722  } else{ //PCM gamma
3723  for(Int_t iCurrent3=0;iCurrent3<fGammaCandidates->GetEntries();iCurrent3++){
3724  AliAODConversionPhoton *gamma2 = dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(iCurrent3));
3725  if(gamma2 == NULL) continue;
3726  AliAODConversionMother *BGOmegacand = new AliAODConversionMother(&BGpi0cand,gamma2);
3727  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(BGOmegacand, &BGpi0cand, gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
3728  fHistoDiffPi0SameGammaBackInvMassPt[fiCut]->Fill(BGOmegacand->M(),BGOmegacand->Pt(),fWeightJetJetMC);
3729  }
3730  delete BGOmegacand;
3731  BGOmegacand = 0x0;
3732  }
3733  }
3734  }
3735  }
3736 
3737  //pi0 from current event, gamma from handler
3738  //zbin and mbin from clushandler
3739  Int_t Cluszbin = fBGClusHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
3740  Int_t Clusmbin = 0;
3741 
3742  if(((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->UseTrackMultiplicity()){
3744  }else {
3745  Clusmbin = fBGClusHandler[fiCut]->GetMultiplicityBinIndex(fClusterCandidates->GetEntries());
3746  }
3747 
3748  //zbin and mbin from gammahandler
3749  Int_t Gammazbin = fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
3750  Int_t Gammambin = 0;
3751 
3752  if(((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->UseTrackMultiplicity()){
3754  }else {
3755  Gammambin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
3756  }
3757 
3758  for(Int_t iCurrent=0;iCurrent<fPi0Candidates->GetEntries();iCurrent++){
3759  AliAODConversionMother* BGpi0cand = dynamic_cast<AliAODConversionMother*>(fPi0Candidates->At(iCurrent));
3760  if(BGpi0cand == NULL) continue;
3761  if(fReconMethod % 2 == 0){ //EMCAL gamma
3762  for(Int_t previous=0;previous<fBGClusHandler[fiCut]->GetNBGEvents();previous++){
3763  AliGammaConversionAODVector *previousclusters = fBGClusHandler[fiCut]->GetBGGoodV0s(Cluszbin,Clusmbin,previous);
3764  if(fMoveParticleAccordingToVertex == kTRUE || ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
3765  bgEvent1Vertex = fBGClusHandler[fiCut]->GetBGEventVertex(Cluszbin,Clusmbin,previous);
3766  }
3767  for(UInt_t igamma2=0;igamma2<previousclusters->size();igamma2++){
3768  AliAODConversionPhoton gamma2 = (AliAODConversionPhoton)(*(previousclusters->at(igamma2)));
3769  if(fMoveParticleAccordingToVertex == kTRUE && bgEvent1Vertex){
3770  MoveParticleAccordingToVertex(&gamma2,bgEvent1Vertex);
3771  }
3772  AliAODConversionMother *BGOmegacand = new AliAODConversionMother(BGpi0cand,&gamma2);
3773  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(BGOmegacand, BGpi0cand, &gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
3774  fHistoSamePi0DiffGammaBackInvMassPt[fiCut]->Fill(BGOmegacand->M(),BGOmegacand->Pt(),fWeightJetJetMC);
3775  }
3776  delete BGOmegacand;
3777  BGOmegacand = 0x0;
3778  }
3779  }
3780  } else{ //PCM gamma
3781  for(Int_t previous=0;previous<fBGHandler[fiCut]->GetNBGEvents();previous++){
3782  AliGammaConversionAODVector *previousV0s = fBGHandler[fiCut]->GetBGGoodV0s(Gammazbin,Gammambin,previous);
3783  if(fMoveParticleAccordingToVertex == kTRUE || ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
3784  bgEvent1Vertex = fBGHandler[fiCut]->GetBGEventVertex(Gammazbin,Gammambin,previous);
3785  }
3786  for(UInt_t igamma2=0;igamma2<previousV0s->size();igamma2++){
3787  AliAODConversionPhoton gamma2 = (AliAODConversionPhoton)(*(previousV0s->at(igamma2)));
3788  if(fMoveParticleAccordingToVertex == kTRUE && bgEvent1Vertex){
3789  MoveParticleAccordingToVertex(&gamma2,bgEvent1Vertex);
3790  }
3791  AliAODConversionMother *BGOmegacand = new AliAODConversionMother(BGpi0cand,&gamma2);
3792  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(BGOmegacand, BGpi0cand, &gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
3793  fHistoSamePi0DiffGammaBackInvMassPt[fiCut]->Fill(BGOmegacand->M(),BGOmegacand->Pt(),fWeightJetJetMC);
3794  }
3795  delete BGOmegacand;
3796  BGOmegacand = 0x0;
3797  }
3798  }
3799  }
3800  }
3801 }
3802 
3803 //________________________________________________________________________
3805  //see header file for documentation
3806 
3807  Double_t dx = vertex->fX - fInputEvent->GetPrimaryVertex()->GetX();
3808  Double_t dy = vertex->fY - fInputEvent->GetPrimaryVertex()->GetY();
3809  Double_t dz = vertex->fZ - fInputEvent->GetPrimaryVertex()->GetZ();
3810 
3811  Double_t movedPlace[3] = {particle->GetConversionX() - dx,particle->GetConversionY() - dy,particle->GetConversionZ() - dz};
3812  particle->SetConversionPoint(movedPlace);
3813 }
3814 //________________________________________________________________________
3816  //see header file for documentation
3817 
3818  Double_t dx = vertex->fX - fInputEvent->GetPrimaryVertex()->GetX();
3819  Double_t dy = vertex->fY - fInputEvent->GetPrimaryVertex()->GetY();
3820  Double_t dz = vertex->fZ - fInputEvent->GetPrimaryVertex()->GetZ();
3821 
3822  Double_t movedPlace[3] = {particle->GetProductionX() - dx,particle->GetProductionY() - dy,particle->GetProductionZ() - dz};
3823  particle->SetProductionPoint(movedPlace);
3824 }
3825 //________________________________________________________________________
3827  //see header file for documentation
3828  if(fPi0Candidates->GetEntries()>0){
3829  if(fReconMethod % 2 == 1){ //single gamma is PCM
3830  if(((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->UseTrackMultiplicity()){
3831  fBGHandler[fiCut]->AddEvent(fGammaCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),fEventPlaneAngle);
3832  }else { // means we use #V0s for multiplicity
3833  fBGHandler[fiCut]->AddEvent(fGammaCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fGammaCandidates->GetEntries(),fEventPlaneAngle);
3834  }
3835  } else{ //single gamma is EMCAL
3836  if(((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->UseTrackMultiplicity()){
3837  fBGClusHandler[fiCut]->AddEvent(fClusterCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),fEventPlaneAngle);
3838  }else {
3839  fBGClusHandler[fiCut]->AddEvent(fClusterCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fClusterCandidates->GetEntries(),fEventPlaneAngle);
3840  }
3841  }
3842  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
3843  fBGPi0Handler[fiCut]->AddMesonEvent(fPi0Candidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),0);
3844  }else {
3845  fBGPi0Handler[fiCut]->AddMesonEvent(fPi0Candidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fPi0Candidates->GetEntries(),0);
3846  }
3847  }
3848 }
3849 
3850 //________________________________________________________________________
3852 
3853  // Relabeling For AOD Event
3854  // ESDiD -> AODiD
3855  // MCLabel -> AODMCLabel
3856 
3857  if(mode){
3858  fMCEventPos = new Int_t[fReaderGammas->GetEntries()];
3859  fMCEventNeg = new Int_t[fReaderGammas->GetEntries()];
3860  fESDArrayPos = new Int_t[fReaderGammas->GetEntries()];
3861  fESDArrayNeg = new Int_t[fReaderGammas->GetEntries()];
3862  }
3863 
3864  for(Int_t iGamma = 0;iGamma<fReaderGammas->GetEntries();iGamma++){
3865  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(iGamma);
3866  if(!PhotonCandidate) continue;
3867  if(!mode){// Back to ESD Labels
3868  PhotonCandidate->SetMCLabelPositive(fMCEventPos[iGamma]);
3869  PhotonCandidate->SetMCLabelNegative(fMCEventNeg[iGamma]);
3870  PhotonCandidate->SetLabelPositive(fESDArrayPos[iGamma]);
3871  PhotonCandidate->SetLabelNegative(fESDArrayNeg[iGamma]);
3872  continue;
3873