AliPhysics  7f1bdba (7f1bdba)
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 = 1.e30;
1972  Double_t ratio = 0;
1973  if (particle->E() != TMath::Abs(particle->Pz())){
1974  ratio = (particle->E()+particle->Pz()) / (particle->E()-particle->Pz());
1975  }
1976  if( !(ratio <= 0) ){
1977  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
1978  }
1979 
1980  Double_t alpha = -10;
1981  if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
1982  alpha = (daughter0->E() - daughter1->E())/(daughter0->E() + daughter1->E());
1983  }
1984 
1985 
1986  if(particle->GetPdgCode() == 111){
1987  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Pi0
1988  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
1989  if (fIsMC > 1) fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
1990  if (fDoMesonQA > 0){
1991  fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC);
1992  fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC);
1993  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
1994  }
1995  }
1996 
1997  // Check the acceptance for both gammas
1998  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter0,AODMCTrackArray,kFALSE) &&
1999  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedAODMC(daughter1,AODMCTrackArray,kFALSE) &&
2000  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter0->Phi(),fEventPlaneAngle,kFALSE) &&
2001  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(daughter1->Phi(),fEventPlaneAngle,kFALSE)){
2002  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
2003  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter0,AODMCTrackArray) ||
2004  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedAODMC(daughter1,AODMCTrackArray) ){
2005  if(particle->GetPdgCode() == 111){
2006  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Pi0 with gamma in acc
2007  fHistoMCPi0WOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Pi0 with gamma in acc wo weight
2008  }
2009  }
2010  }
2011  }
2012  }
2013 }
2014 
2015 //________________________________________________________________________
2017 {
2018  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
2019  Double_t mcProdVtxX = primVtxMC->GetX();
2020  Double_t mcProdVtxY = primVtxMC->GetY();
2021  Double_t mcProdVtxZ = primVtxMC->GetZ();
2022 // cout << mcProdVtxX <<"\t" << mcProdVtxY << "\t" << mcProdVtxZ << endl;
2023 
2024  // Loop over all primary MC particles
2025  for(Int_t i = 0; i < fMCEvent->GetNumberOfTracks(); i++) {
2026  if (((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, i, mcProdVtxX, mcProdVtxY, mcProdVtxZ)){
2027  // fill primary histograms
2028  TParticle* particle = (TParticle *)fMCEvent->Particle(i);
2029  if (!particle) continue;
2030 
2031  // fill histograms for all true omegas
2032  if(particle->GetPdgCode() == 223){
2033 
2034  Bool_t DecaysToPiPlPiMiPiZero = kFALSE;
2035 
2036  TParticle *posPion = 0x0;
2037  TParticle *negPion = 0x0;
2038  TParticle *neutPion = 0x0;
2039 
2040  for(Int_t index= particle->GetFirstDaughter();index <= particle->GetLastDaughter();index++){
2041  if(index < 0) continue;
2042 
2043  TParticle *temp = (TParticle*)fMCEvent->Particle(index);
2044 
2045  switch(temp->GetPdgCode()) {
2046  case 211:
2047  posPion = temp;
2048  break;
2049  case -211:
2050  negPion = temp;
2051  break;
2052  case 111:
2053  neutPion = temp;
2054  break;
2055  }
2056  }
2057 
2058  if(posPion && negPion && neutPion) DecaysToPiPlPiMiPiZero = kTRUE;
2059 
2060  if(DecaysToPiPlPiMiPiZero){
2062  } else if (particle->GetNDaughters()==2){
2063  TParticle *gamma2 = 0x0;
2064  TParticle *pi0 = 0x0;
2065 
2066  for(Int_t index = particle->GetFirstDaughter();index <= particle->GetLastDaughter();index++){
2067  if(index < 0) continue;
2068 
2069  TParticle *temp = (TParticle*)fMCEvent->Particle(index);
2070  switch(temp->GetPdgCode()){
2071  case 22:
2072  gamma2 = temp;
2073  break;
2074  case 111:
2075  pi0 = temp;
2076  break;
2077  }
2078  }
2079 
2080  if(gamma2 && pi0){
2082  fHistoMCAllOmegaInvMassPt[fiCut]->Fill(TMath::Sqrt((particle->Energy())*(particle->Energy())-(particle->P())*(particle->P())),particle->Pt(),fWeightJetJetMC);
2083  fHistoMCGammaFromAllOmegaPt[fiCut]->Fill(gamma2->Pt(),fWeightJetJetMC);
2084  fHistoMCPi0FromAllOmegaInvMassPt[fiCut]->Fill(TMath::Sqrt((pi0->Energy())*(pi0->Energy())-(pi0->P())*(pi0->P())),pi0->Pt(),fWeightJetJetMC);
2085  if(fDoMesonQA>0){
2086 
2087  fHistoMCPi0FromAllOmegaEtaPhi[fiCut]->Fill(pi0->Phi(),pi0->Eta(),fWeightJetJetMC);
2088  fHistoMCAllOmegaPtPi0Pt[fiCut]->Fill(particle->Pt(),pi0->Pt(),fWeightJetJetMC);
2089  fHistoMCAllOmegaPtGammaPt[fiCut]->Fill(particle->Pt(),gamma2->Pt(),fWeightJetJetMC);
2090 
2091  Double_t alpha = (pi0->Energy() - gamma2->Energy())/(pi0->Energy() + gamma2->Energy());
2092  fHistoMCAllOmegaAlphaPt[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC);
2093 
2094  Double_t Pi0Y = 10.;
2095  if(pi0->Energy() - pi0->Pz() == 0 || pi0->Energy() + pi0->Pz() == 0){
2096  Pi0Y=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2097  }else{
2098  Pi0Y = 0.5*(TMath::Log((pi0->Energy()+pi0->Pz()) / (pi0->Energy()-pi0->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2099  }
2100  fHistoMCPi0FromAllOmegaYPt[fiCut]->Fill(pi0->Pt(),Pi0Y,fWeightJetJetMC);
2101 
2102  Double_t OmegaY = 10.;
2103  if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
2104  OmegaY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2105  }else{
2106  OmegaY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2107  }
2108  fHistoMCAllOmegaYPt[fiCut]->Fill(particle->Pt(),OmegaY,fWeightJetJetMC);
2109 
2110  fHistoMCAllOmegaEtaPhi[fiCut]->Fill(particle->Phi(),particle->Eta(),fWeightJetJetMC);
2111 
2112  //get angles and plot
2113  TVector3 omegavector = TVector3(particle->Px(),particle->Py(),particle->Pz());
2114  TVector3 pi0vector = TVector3(pi0->Px(),pi0->Py(),pi0->Pz());
2115  TVector3 gamma2vector = TVector3(gamma2->Px(),gamma2->Py(),gamma2->Pz());
2116  fHistoMCAllOmegaPiZeroAnglePt[fiCut]->Fill(particle->Pt(),TMath::Pi() - pi0vector.Angle(omegavector),fWeightJetJetMC);
2117  fHistoMCAllPiZeroGammaAnglePt[fiCut]->Fill(particle->Pt(),pi0vector.Angle(gamma2vector),fWeightJetJetMC);
2118  fHistoMCAllOmegaGammaAnglePt[fiCut]->Fill(particle->Pt(),TMath::Pi() - omegavector.Angle(gamma2vector),fWeightJetJetMC);
2119 
2120  //check whether pi0 decayed into two gammas
2121  if (pi0->GetNDaughters()==2 && pi0->GetFirstDaughter()>-1 && pi0->GetLastDaughter()>-1){
2122  TParticle *gamma0 = (TParticle*)fMCEvent->Particle(pi0->GetFirstDaughter());
2123  TParticle *gamma1 = (TParticle*)fMCEvent->Particle(pi0->GetLastDaughter());
2124  if (gamma0->GetPdgCode()==22 && gamma1->GetPdgCode()==22){
2125 
2126  //plot pi0 alpha
2127  Double_t pi0alpha = (gamma0->Energy() - gamma1->Energy())/(gamma0->Energy() + gamma1->Energy());
2128  fHistoMCPi0FromAllOmegaAlphaPt[fiCut]->Fill(pi0->Pt(),pi0alpha,fWeightJetJetMC);
2129  }
2130  }
2131  }
2132  } else{
2134  }
2135  } else{
2137  }
2138  }
2139 
2140  //fill histograms for omegas in acceptance
2141  Int_t labelNeutPion = -1;
2142  Int_t labelGamma = -1;
2143 
2145  ->MesonIsSelectedMCPiZeroGamma(particle,fMCEvent,labelNeutPion,labelGamma,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2146  if (labelNeutPion > -1 && labelGamma > -1){
2147  TParticle *neutPion = fMCEvent->Particle(labelNeutPion);
2148 
2149  //fill histograms for acceptance correction
2150  fHistoMCOmegaInvMassPt[fiCut]->Fill(TMath::Sqrt((particle->Energy())*(particle->Energy())-(particle->P())*(particle->P())),particle->Pt(),fWeightJetJetMC);
2151 
2152  if (neutPion->GetNDaughters()==2 && neutPion->GetFirstDaughter()>-1 && neutPion->GetLastDaughter()>-1){
2153 
2154  TParticle *gamma0 = (TParticle*)fMCEvent->Particle(neutPion->GetFirstDaughter());
2155  TParticle *gamma1 = (TParticle*)fMCEvent->Particle(neutPion->GetLastDaughter());
2156  TParticle *gamma2 = (TParticle*)fMCEvent->Particle(labelGamma);
2157 
2158  Bool_t InAcceptance = kFALSE;
2159 
2160  if (fReconMethod%2==1){ //cases 1,3,5 where reconstruction requires gamma2 to be a pcm photon
2161  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma2,fMCEvent,kFALSE)){ //check that gamma2 is in acceptance
2162  if(fReconMethod==5){
2163  //check that both gamma0 and gamma1 are in acceptance
2164  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma0,fMCEvent,kFALSE) &&
2165  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma1,fMCEvent,kFALSE)){
2166  InAcceptance = kTRUE;
2167  }
2168  } else if(fReconMethod==3){
2169  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma0,fMCEvent) &&
2170  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma1,fMCEvent)){
2171  InAcceptance = kTRUE;
2172  }
2173  } else if(fReconMethod==1){ // both gammas must be in tpc acceptance
2174  if((((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma0,fMCEvent,kFALSE) &&
2175  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma1,fMCEvent,kFALSE)) &&
2176  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
2177  (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma0,fMCEvent) ||
2178  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma1,fMCEvent))){
2179  InAcceptance = kTRUE;
2180  }
2181  }
2182  }
2183  } else{ //cases 0,2,4 where reconstruction requires gamma2 to be a calo photon
2184  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma2,fMCEvent)){
2185  if(fReconMethod==4){
2186  //check that both gamma0 and gamma1 are in acceptance
2187  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma0,fMCEvent,kFALSE) &&
2188  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma1,fMCEvent,kFALSE)){
2189  InAcceptance = kTRUE;
2190  }
2191  } else if(fReconMethod==2){
2192  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma0,fMCEvent) &&
2193  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma1,fMCEvent)){
2194  InAcceptance = kTRUE;
2195  }
2196  } else if(fReconMethod==0){ //either gamma0 is in tpc acc & gamma1 is in emcal acc or vice versa
2197  if((((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma0,fMCEvent,kFALSE) &&
2198  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(gamma1,fMCEvent,kFALSE)) &&
2199  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
2200  (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma0,fMCEvent) ||
2201  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(gamma1,fMCEvent))){
2202  InAcceptance = kTRUE;
2203  }
2204  }
2205  }
2206  }
2207  if(InAcceptance){
2208  // fill in acceptance histograms
2209  fHistoMCOmegaInAccInvMassPt[fiCut]->Fill(TMath::Sqrt((particle->Energy())*(particle->Energy())-(particle->P())*(particle->P())),particle->Pt(),fWeightJetJetMC);
2210  fHistoMCPi0FromOmegaInAccInvMassPt[fiCut]->Fill(TMath::Sqrt((neutPion->Energy())*(neutPion->Energy())-(neutPion->P())*(neutPion->P())),neutPion->Pt(),fWeightJetJetMC);
2212 
2213  if(fDoMesonQA>0){
2214 
2215  TVector3 omegavector = TVector3(particle->Px(),particle->Py(),particle->Pz());
2216  TVector3 pi0vector = TVector3(neutPion->Px(),neutPion->Py(),neutPion->Pz());
2217  TVector3 gamma2vector = TVector3(gamma2->Px(),gamma2->Py(),gamma2->Pz());
2218 
2219  Double_t OmegaPiZeroAngle = TMath::Pi() - pi0vector.Angle(omegavector);
2220  Double_t PiZeroGammaAngle = pi0vector.Angle(gamma2vector);
2221  Double_t OmegaGammaAngle = TMath::Pi() - omegavector.Angle(gamma2vector);
2222 
2223  Double_t OmegaY = 10.;
2224  if(particle->Energy() - particle->Pz() == 0 || particle->Energy() + particle->Pz() == 0){
2225  OmegaY=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2226  }else{
2227  OmegaY = 0.5*(TMath::Log((particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2228  }
2229  Double_t Pi0Y = 10.;
2230  if(neutPion->Energy() - neutPion->Pz() == 0 || neutPion->Energy() + neutPion->Pz() == 0){
2231  Pi0Y=10.-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2232  }else{
2233  Pi0Y = 0.5*(TMath::Log((neutPion->Energy()+neutPion->Pz()) / (neutPion->Energy()-neutPion->Pz())))-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2234  }
2235 
2236  Double_t OmegaAlpha = (neutPion->Energy() - gamma2->Energy())/(neutPion->Energy() + gamma2->Energy());
2237  Double_t Pi0Alpha = (gamma0->Energy() - gamma1->Energy())/(gamma0->Energy() + gamma1->Energy());
2238 
2239  fHistoMCOmegaInAccEtaPhi[fiCut]->Fill(particle->Phi(),particle->Eta(),fWeightJetJetMC);
2240  fHistoMCOmegaInAccYPt[fiCut]->Fill(particle->Pt(),OmegaY,fWeightJetJetMC);
2241  fHistoMCOmegaInAccAlphaPt[fiCut]->Fill(particle->Pt(),OmegaAlpha,fWeightJetJetMC);
2242  fHistoMCInAccOmegaPiZeroAnglePt[fiCut]->Fill(particle->Pt(),OmegaPiZeroAngle,fWeightJetJetMC);
2243  fHistoMCInAccPiZeroGammaAnglePt[fiCut]->Fill(particle->Pt(),PiZeroGammaAngle,fWeightJetJetMC);
2244  fHistoMCInAccOmegaGammaAnglePt[fiCut]->Fill(particle->Pt(),OmegaGammaAngle,fWeightJetJetMC);
2245  fHistoMCPi0FromOmegaInAccAlphaPt[fiCut]->Fill(neutPion->Pt(),Pi0Alpha,fWeightJetJetMC);
2246  fHistoMCPi0FromOmegaInAccYPt[fiCut]->Fill(neutPion->Pt(),Pi0Y,fWeightJetJetMC);
2247  fHistoMCPi0FromOmegaInAccEtaPhi[fiCut]->Fill(particle->Phi(),particle->Eta(),fWeightJetJetMC);
2248  fHistoMCInAccOmegaPtPi0Pt[fiCut]->Fill(particle->Pt(),neutPion->Pt(),fWeightJetJetMC);
2249  fHistoMCInAccOmegaPtGammaPt[fiCut]->Fill(particle->Pt(),gamma2->Pt(),fWeightJetJetMC);
2250  }
2251  }
2252  }
2253  }
2254  }
2255 
2256 
2257  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kFALSE)){
2258  fHistoMCAllGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // All MC Gamma
2259  if (TMath::Abs(particle->Eta()) < 0.66 ){
2260  if (particle->Phi() > 1.39626 && particle->Phi() < 3.125) fHistoMCAllGammaEMCALAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
2261  }
2262  }
2263  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(particle,fMCEvent,kTRUE)){
2264  fHistoMCConvGammaPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
2265  if (fDoPhotonQA > 0 && particle->GetFirstDaughter()>-1){
2266  fHistoMCConvGammaR[fiCut]->Fill(((TParticle*)fMCEvent->Particle(particle->GetFirstDaughter()))->R());
2267  fHistoMCConvGammaEta[fiCut]->Fill(particle->Eta());
2268  }
2269  }// Converted MC Gamma
2271  ->MesonIsSelectedMC(particle,fMCEvent,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())){
2272  if(particle->GetFirstDaughter()>-1 && particle->GetLastDaughter()>-1){
2273  TParticle* daughter0 = (TParticle*)fMCEvent->Particle(particle->GetFirstDaughter());
2274  TParticle* daughter1 = (TParticle*)fMCEvent->Particle(particle->GetLastDaughter());
2275 
2276  Float_t weighted= 1;
2277  if(((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsParticleFromBGEvent(i, fMCEvent, fInputEvent)){
2278  if (particle->Pt()>0.005){
2279  weighted= ((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetWeightForMeson(i, fMCEvent, fInputEvent);
2280  // if(particle->GetPdgCode() == 221){
2281  // cout << "MC input \t"<<i << "\t" << particle->Pt()<<"\t"<<weighted << endl;
2282  // }
2283  }
2284  }
2285 
2286  Double_t mesonY = 1.e30;
2287  Double_t ratio = 0;
2288  if (particle->Energy() != TMath::Abs(particle->Pz())){
2289  ratio = (particle->Energy()+particle->Pz()) / (particle->Energy()-particle->Pz());
2290  }
2291  if( !(ratio <= 0) ){
2292  mesonY = particle->Y()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift();
2293  }
2294 
2295 
2296  Double_t alpha = -10;
2297  if (particle->GetPdgCode() == 111 || particle->GetPdgCode() == 221){
2298  alpha = (daughter0->Energy() - daughter1->Energy())/(daughter0->Energy() + daughter1->Energy());
2299  }
2300 
2301  if(particle->GetPdgCode() == 111){
2302  fHistoMCPi0Pt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // All MC Pi0
2303  fHistoMCPi0WOWeightPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC);
2304  if (fIsMC > 1) fHistoMCPi0WOEvtWeightPt[fiCut]->Fill(particle->Pt());
2305  if (fDoMesonQA > 0){
2306  fHistoMCPi0PtY[fiCut]->Fill(particle->Pt(),mesonY,weighted*fWeightJetJetMC); // All MC Pi0
2307  fHistoMCPi0PtAlpha[fiCut]->Fill(particle->Pt(),alpha,fWeightJetJetMC); // All MC Pi0
2308  if (fIsMC == 2) fHistoMCPi0PtJetPt[fiCut]->Fill(particle->Pt(),((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetMaxPtJet(),fWeightJetJetMC);
2309  }
2310  }
2311  // Check the acceptance for both gammas & whether they are counted as primaries as well
2312  Bool_t kDaughter0IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, particle->GetFirstDaughter(), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2313  Bool_t kDaughter1IsPrim = ((AliConvEventCuts*)fEventCutArray->At(fiCut))->IsConversionPrimaryESD( fMCEvent, particle->GetLastDaughter(), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
2314  Bool_t InAcceptance = kFALSE;
2315 
2316  if(fReconMethod/2 == 0){
2317  if( kDaughter0IsPrim && kDaughter1IsPrim &&
2318  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter0,fMCEvent,kFALSE) &&
2319  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter1,fMCEvent,kFALSE)){
2320  // check acceptance of clusters as well, true if one of them points into the Calo acceptance
2321  if (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCEvent) ||
2322  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCEvent)){
2323  InAcceptance = kTRUE;
2324  }
2325  }
2326  } else if(fReconMethod/2 == 1){
2327  if(((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter0,fMCEvent) &&
2328  ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->ClusterIsSelectedMC(daughter1,fMCEvent)){
2329  InAcceptance = kTRUE;
2330  }
2331  } else if(fReconMethod/2 == 2){
2332  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter0,fMCEvent,kFALSE) &&
2333  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelectedMC(daughter1,fMCEvent,kFALSE)){
2334  InAcceptance = kTRUE;
2335  }
2336  }
2337  if(InAcceptance){
2338  // fill in acceptance histograms
2339  if(particle->GetPdgCode() == 111){
2340  fHistoMCPi0InAccPt[fiCut]->Fill(particle->Pt(),weighted*fWeightJetJetMC); // MC Pi0 with gamma in acc
2341  fHistoMCPi0WOWeightInAccPt[fiCut]->Fill(particle->Pt(),fWeightJetJetMC); // MC Pi0 with gamma in acc wo weighting
2342  }
2343  }
2344  }
2345  }
2346  }
2347  }
2348 }
2349 
2350 //________________________________________________________________________
2352 {
2353  switch(fReconMethod){
2354  //PCM-cal,cal
2355  case 0:
2356  if(fClusterCandidates->GetEntries()>1 && fGammaCandidates->GetEntries()>0){
2357  for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
2358  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
2359  if (gamma0==NULL) continue;
2360 
2361  for(Int_t secondGammaIndex=0;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
2362  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
2363  if (gamma1==NULL || !(gamma1->GetIsCaloPhoton())) continue;
2364  Bool_t matched = kFALSE;
2365  AliVCluster* cluster = fInputEvent->GetCaloCluster(gamma1->GetCaloClusterRef());
2366  matched = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma0,cluster,fInputEvent,fWeightJetJetMC);
2367 
2368  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
2369 
2370  if((((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))
2371  && pi0cand->Pt() > fMinPi0Pt){
2372  if (matched){
2373  fHistoPhotonPairMatchedInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(),fWeightJetJetMC);
2374  } else{
2375  fHistoPhotonPairInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(),fWeightJetJetMC);
2376  if (pi0cand->M() > ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionLow() &&
2377  pi0cand->M() < ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionHigh()){
2378  //change energy of pi0 candidate s.t. its mass is the pdg mass
2379  pi0cand->SetPxPyPzE(pi0cand->Px(),pi0cand->Py(),pi0cand->Pz(),TMath::Sqrt(0.1349766*0.1349766+pi0cand->P()*pi0cand->P()));
2380  fPi0Candidates->Add(pi0cand);
2381  if(fDoMesonQA>0){
2382  fHistoPhotonPairYPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2383  fHistoPhotonPairAlphaPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha(),fWeightJetJetMC);
2384  fHistoPhotonPairOpenAnglePt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle(),fWeightJetJetMC);
2385  fHistoPhotonPairEtaPhi[fiCut]->Fill(pi0cand->Phi(),pi0cand->Eta(),fWeightJetJetMC);
2386  }
2387  // get third photon from clusters and calculate inv mass of omega
2388  for(Int_t thirdGammaIndex=0;thirdGammaIndex<fClusterCandidates->GetEntries();thirdGammaIndex++){
2389  if (thirdGammaIndex==secondGammaIndex) continue;
2390  Bool_t matchedgamma2wconvgamma = kFALSE;
2391  AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(thirdGammaIndex));
2392  if (gamma2==NULL || !(gamma2->GetIsCaloPhoton())) continue;
2393  AliVCluster* cluster2 = fInputEvent->GetCaloCluster(gamma2->GetCaloClusterRef());
2394  matchedgamma2wconvgamma = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma0,cluster2, fInputEvent, fWeightJetJetMC);
2395  AliAODConversionMother *omegacand = new AliAODConversionMother(pi0cand,gamma2);
2396  if (matchedgamma2wconvgamma){
2397  fHistoMotherMatchedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2398  delete omegacand;
2399  omegacand=0x0;
2400  continue;
2401  }
2402  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(omegacand, pi0cand, gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
2403  fHistoMotherInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2404  if(fIsMC>0){
2405  if(fInputEvent->IsA()==AliESDEvent::Class())
2406  ProcessTrueMesonCandidates(omegacand,gamma0,gamma1,gamma2);
2407  if(fInputEvent->IsA()==AliAODEvent::Class())
2408  ProcessTrueMesonCandidatesAOD(omegacand,gamma0,gamma1,gamma2);
2409  }
2410  if(omegacand->M()>0.7 && omegacand->M()<0.85){
2411  fHistoGammaFromMotherPt[fiCut]->Fill(gamma2->Pt(),fWeightJetJetMC);
2412  if(fDoMesonQA>0){
2414  fHistoMotherYPt[fiCut]->Fill(omegacand->Pt(),omegacand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2415  fHistoMotherAlphaPt[fiCut]->Fill(omegacand->Pt(),omegacand->GetAlpha(),fWeightJetJetMC);
2416  fHistoMotherEtaPhi[fiCut]->Fill(omegacand->Phi(),omegacand->Eta(),fWeightJetJetMC);
2417  fHistoMotherPi0AnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(pi0cand->Vect()),fWeightJetJetMC);
2418  fHistoMotherGammaAnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(gamma2->Vect()),fWeightJetJetMC);
2419  fHistoPi0GammaAnglePt[fiCut]->Fill(omegacand->Pt(),pi0cand->Angle(gamma2->Vect()),fWeightJetJetMC);
2420  }
2421  }
2422  } else if(fDoPiZeroGammaAngleCut){
2423  fHistoMotherAngleCutRejectedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2424  }
2425  delete omegacand;
2426  omegacand=0x0;
2427  }
2428  } else{
2429  delete pi0cand;
2430  pi0cand=0x0;
2431  }
2432  }
2433  }
2434  }
2435  }
2436  }
2437  break;
2438  //PCM-cal,PCM
2439  case 1:
2440  if(fGammaCandidates->GetEntries()>1 && fClusterCandidates->GetEntries()>0){
2441  for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
2442  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
2443  if (gamma0==NULL) continue;
2444 
2445  for(Int_t secondGammaIndex=0;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
2446  Bool_t matched = kFALSE;
2447  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
2448  if (gamma1==NULL || !(gamma1->GetIsCaloPhoton())) continue;
2449 
2450  AliVCluster* cluster = fInputEvent->GetCaloCluster(gamma1->GetCaloClusterRef());
2451  matched = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma0,cluster, fInputEvent, fWeightJetJetMC);
2452 
2453  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
2454 
2455  if((((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift()))
2456  && pi0cand->Pt() > fMinPi0Pt){
2457  if (matched){
2458  fHistoPhotonPairMatchedInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(),fWeightJetJetMC);
2459  } else{
2460  // fill photon pair histograms
2461  fHistoPhotonPairInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(),fWeightJetJetMC);
2462  if (pi0cand->M() > ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionLow() &&
2463  pi0cand->M() < ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionHigh()){
2464  //change energy of pi0 candidate s.t. its mass is the pdg mass
2465  pi0cand->SetPxPyPzE(pi0cand->Px(),pi0cand->Py(),pi0cand->Pz(),TMath::Sqrt(0.1349766*0.1349766+pi0cand->P()*pi0cand->P()));
2466  fPi0Candidates->Add(pi0cand);
2467  if(fDoMesonQA>0){
2468  fHistoPhotonPairYPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2469  fHistoPhotonPairAlphaPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha(),fWeightJetJetMC);
2470  fHistoPhotonPairOpenAnglePt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle(),fWeightJetJetMC);
2471  fHistoPhotonPairEtaPhi[fiCut]->Fill(pi0cand->Phi(),pi0cand->Eta(),fWeightJetJetMC);
2472  }
2473  // get third photon from conversion photon candidates and calculate inv mass of omega
2474  for(Int_t thirdGammaIndex=0;thirdGammaIndex<fGammaCandidates->GetEntries();thirdGammaIndex++){
2475  if (thirdGammaIndex==firstGammaIndex) continue;
2476  Bool_t matchedgamma1wconvgamma2 = kFALSE;
2477  AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(thirdGammaIndex));
2478  if (gamma2==NULL) continue;
2479  matchedgamma1wconvgamma2 = ((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma2, cluster, fInputEvent, fWeightJetJetMC);
2480  AliAODConversionMother *omegacand = new AliAODConversionMother(pi0cand,gamma2);
2481  if (matchedgamma1wconvgamma2){
2482  fHistoMotherMatchedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2483  delete omegacand;
2484  omegacand=0x0;
2485  continue;
2486  }
2487  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(omegacand, pi0cand, gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
2488  fHistoMotherInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2489  if(fIsMC>0){
2490  if(fInputEvent->IsA()==AliESDEvent::Class())
2491  ProcessTrueMesonCandidates(omegacand,gamma0,gamma1,gamma2);
2492  if(fInputEvent->IsA()==AliAODEvent::Class())
2493  ProcessTrueMesonCandidatesAOD(omegacand,gamma0,gamma1,gamma2);
2494  }
2495  if(omegacand->M()>0.7 && omegacand->M()<0.85){
2496  fHistoGammaFromMotherPt[fiCut]->Fill(gamma2->Pt(),fWeightJetJetMC);
2497  if(fDoMesonQA>0){
2500  fHistoMotherYPt[fiCut]->Fill(omegacand->Pt(),omegacand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2501  fHistoMotherAlphaPt[fiCut]->Fill(omegacand->Pt(),omegacand->GetAlpha(),fWeightJetJetMC);
2502  fHistoMotherEtaPhi[fiCut]->Fill(omegacand->Phi(),omegacand->Eta(),fWeightJetJetMC);
2503  fHistoMotherPi0AnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(pi0cand->Vect()),fWeightJetJetMC);
2504  fHistoMotherGammaAnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(gamma2->Vect()),fWeightJetJetMC);
2505  fHistoPi0GammaAnglePt[fiCut]->Fill(omegacand->Pt(),pi0cand->Angle(gamma2->Vect()),fWeightJetJetMC);
2506  }
2507  }
2508  } else if(fDoPiZeroGammaAngleCut){
2509  fHistoMotherAngleCutRejectedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2510  }
2511  delete omegacand;
2512  omegacand=0x0;
2513  }
2514  } else{
2515  delete pi0cand;
2516  pi0cand=0x0;
2517  }
2518  }
2519  }
2520  }
2521  }
2522  }
2523  break;
2524  //cal-cal,cal
2525  case 2:
2526  if(fClusterCandidates->GetEntries()>2){
2527  for(Int_t firstGammaIndex=0;firstGammaIndex<fClusterCandidates->GetEntries();firstGammaIndex++){
2528  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(firstGammaIndex));
2529  if (gamma0==NULL || !(gamma0->GetIsCaloPhoton())) continue;
2530  for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
2531  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
2532  if (gamma1==NULL || !(gamma1->GetIsCaloPhoton())) continue;
2533  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0, gamma1);
2535  ->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())
2536  && pi0cand->Pt() > fMinPi0Pt){
2537  fHistoPhotonPairInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(),fWeightJetJetMC);
2538  if(pi0cand->M() > ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionLow() &&
2539  pi0cand->M() < ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionHigh()){
2540  //change energy of pi0 candidate s.t. its mass is the pdg mass
2541  pi0cand->SetPxPyPzE(pi0cand->Px(),pi0cand->Py(),pi0cand->Pz(),TMath::Sqrt(0.1349766*0.1349766+pi0cand->P()*pi0cand->P()));
2542  fPi0Candidates->Add(pi0cand);
2543  if(fDoMesonQA>0){
2544  fHistoPhotonPairYPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2545  fHistoPhotonPairAlphaPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha(),fWeightJetJetMC);
2546  fHistoPhotonPairOpenAnglePt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle(),fWeightJetJetMC);
2547  fHistoPhotonPairEtaPhi[fiCut]->Fill(pi0cand->Phi(),pi0cand->Eta(),fWeightJetJetMC);
2548  }
2549  for(Int_t thirdGammaIndex=0;thirdGammaIndex<fClusterCandidates->GetEntries();thirdGammaIndex++){
2550  if (thirdGammaIndex==secondGammaIndex || thirdGammaIndex==firstGammaIndex) continue;
2551  AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(thirdGammaIndex));
2552  if (gamma2==NULL || !(gamma2->GetIsCaloPhoton())) continue;
2553  AliAODConversionMother *omegacand = new AliAODConversionMother(pi0cand,gamma2);
2554  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(omegacand, pi0cand, gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
2555  fHistoMotherInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2556  if(fIsMC>0){
2557  if(fInputEvent->IsA()==AliESDEvent::Class())
2558  ProcessTrueMesonCandidates(omegacand,gamma0,gamma1,gamma2);
2559  if(fInputEvent->IsA()==AliAODEvent::Class())
2560  ProcessTrueMesonCandidatesAOD(omegacand,gamma0,gamma1,gamma2);
2561  }
2562  if(omegacand->M()>0.7 && omegacand->M()<0.85){
2563  fHistoGammaFromMotherPt[fiCut]->Fill(gamma2->Pt(),fWeightJetJetMC);
2564  if(fDoMesonQA>0){
2565  fHistoMotherYPt[fiCut]->Fill(omegacand->Pt(),omegacand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2566  fHistoMotherAlphaPt[fiCut]->Fill(omegacand->Pt(),omegacand->GetAlpha(),fWeightJetJetMC);
2567  fHistoMotherEtaPhi[fiCut]->Fill(omegacand->Phi(),omegacand->Eta(),fWeightJetJetMC);
2568  fHistoMotherPi0AnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(pi0cand->Vect()),fWeightJetJetMC);
2569  fHistoMotherGammaAnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(gamma2->Vect()),fWeightJetJetMC);
2570  fHistoPi0GammaAnglePt[fiCut]->Fill(omegacand->Pt(),pi0cand->Angle(gamma2->Vect()),fWeightJetJetMC);
2571  }
2572  }
2573  } else if(fDoPiZeroGammaAngleCut){
2574  fHistoMotherAngleCutRejectedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2575  }
2576  delete omegacand;
2577  omegacand=0x0;
2578  }
2579  } else{
2580  delete pi0cand;
2581  pi0cand=0x0;
2582  }
2583  }
2584  }
2585  }
2586  }
2587  break;
2588  //cal-cal,PCM
2589  case 3:
2590  if(fClusterCandidates->GetEntries()>1 && fGammaCandidates->GetEntries()>0){
2591  for(Int_t firstGammaIndex=0;firstGammaIndex<fClusterCandidates->GetEntries();firstGammaIndex++){
2592  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(firstGammaIndex));
2593  if (gamma0==NULL || !(gamma0->GetIsCaloPhoton())) continue;
2594  AliVCluster* cluster0 = fInputEvent->GetCaloCluster(gamma0->GetCaloClusterRef());
2595  for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fClusterCandidates->GetEntries();secondGammaIndex++){
2596  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(secondGammaIndex));
2597  if (gamma1==NULL || !(gamma1->GetIsCaloPhoton())) continue;
2598  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0, gamma1);
2600  ->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())
2601  && pi0cand->Pt() > fMinPi0Pt){
2602  fHistoPhotonPairInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(),fWeightJetJetMC);
2603  if(pi0cand->M() > ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionLow() &&
2604  pi0cand->M() < ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionHigh()){
2605  //change energy of pi0 candidate s.t. its mass is the pdg mass
2606  pi0cand->SetPxPyPzE(pi0cand->Px(),pi0cand->Py(),pi0cand->Pz(),TMath::Sqrt(0.1349766*0.1349766+pi0cand->P()*pi0cand->P()));
2607  fPi0Candidates->Add(pi0cand);
2608  if(fDoMesonQA>0){
2609  fHistoPhotonPairYPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2610  fHistoPhotonPairAlphaPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha(),fWeightJetJetMC);
2611  fHistoPhotonPairOpenAnglePt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle(),fWeightJetJetMC);
2612  fHistoPhotonPairEtaPhi[fiCut]->Fill(pi0cand->Phi(),pi0cand->Eta(),fWeightJetJetMC);
2613  }
2614  AliVCluster* cluster1 = fInputEvent->GetCaloCluster(gamma1->GetCaloClusterRef());
2615  for(Int_t thirdGammaIndex=0;thirdGammaIndex<fGammaCandidates->GetEntries();thirdGammaIndex++){
2616  AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(thirdGammaIndex));
2617  Bool_t matched = (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma2,cluster0, fInputEvent, fWeightJetJetMC))
2618  || (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma2,cluster1, fInputEvent, fWeightJetJetMC));
2619  AliAODConversionMother *omegacand = new AliAODConversionMother(pi0cand,gamma2);
2620  if (matched){
2621  fHistoMotherMatchedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2622  delete omegacand;
2623  omegacand=0x0;
2624  continue;
2625  }
2626  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(omegacand, pi0cand, gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
2627  fHistoMotherInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2628  if(fIsMC>0){
2629  if(fInputEvent->IsA()==AliESDEvent::Class())
2630  ProcessTrueMesonCandidates(omegacand,gamma0,gamma1,gamma2);
2631  if(fInputEvent->IsA()==AliAODEvent::Class())
2632  ProcessTrueMesonCandidatesAOD(omegacand,gamma0,gamma1,gamma2);
2633  }
2634  if(omegacand->M()>0.7 && omegacand->M()<0.85){
2635  fHistoGammaFromMotherPt[fiCut]->Fill(gamma2->Pt(),fWeightJetJetMC);
2636  if(fDoMesonQA>0){
2638  fHistoMotherYPt[fiCut]->Fill(omegacand->Pt(),omegacand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2639  fHistoMotherAlphaPt[fiCut]->Fill(omegacand->Pt(),omegacand->GetAlpha(),fWeightJetJetMC);
2640  fHistoMotherEtaPhi[fiCut]->Fill(omegacand->Phi(),omegacand->Eta(),fWeightJetJetMC);
2641  fHistoMotherPi0AnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(pi0cand->Vect()),fWeightJetJetMC);
2642  fHistoMotherGammaAnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(gamma2->Vect()),fWeightJetJetMC);
2643  fHistoPi0GammaAnglePt[fiCut]->Fill(omegacand->Pt(),pi0cand->Angle(gamma2->Vect()),fWeightJetJetMC);
2644  }
2645  }
2646  } else if(fDoPiZeroGammaAngleCut){
2647  fHistoMotherAngleCutRejectedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2648  }
2649  delete omegacand;
2650  omegacand=0x0;
2651  }
2652  } else{
2653  delete pi0cand;
2654  pi0cand=0x0;
2655  }
2656  }
2657  }
2658  }
2659  }
2660  break;
2661  //PCM-PCM,cal
2662  case 4:
2663  if(fGammaCandidates->GetEntries()>1 && fClusterCandidates->GetEntries()>0){
2664  for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
2665  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
2666  if(gamma0==NULL) continue;
2667  for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fGammaCandidates->GetEntries();secondGammaIndex++){
2668  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(secondGammaIndex));
2669  if(gamma1==NULL) continue;
2670  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0,gamma1);
2672  ->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())
2673  && pi0cand->Pt() > fMinPi0Pt){
2674  fHistoPhotonPairInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(),fWeightJetJetMC);
2675  if(pi0cand->M() > ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionLow() &&
2676  pi0cand->M() < ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionHigh()){
2677  //change energy of pi0 candidate s.t. its mass is the pdg mass
2678  pi0cand->SetPxPyPzE(pi0cand->Px(),pi0cand->Py(),pi0cand->Pz(),TMath::Sqrt(0.1349766*0.1349766+pi0cand->P()*pi0cand->P()));
2679  fPi0Candidates->Add(pi0cand);
2680  if(fDoMesonQA>0){
2681  fHistoPhotonPairYPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2682  fHistoPhotonPairAlphaPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha(),fWeightJetJetMC);
2683  fHistoPhotonPairOpenAnglePt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle(),fWeightJetJetMC);
2684  fHistoPhotonPairEtaPhi[fiCut]->Fill(pi0cand->Phi(),pi0cand->Eta(),fWeightJetJetMC);
2685  }
2686  for(Int_t thirdGammaIndex=0;thirdGammaIndex<fClusterCandidates->GetEntries();thirdGammaIndex++){
2687  AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(thirdGammaIndex));
2688  if(gamma2==NULL || !(gamma2->GetIsCaloPhoton())) continue;
2689  AliVCluster* cluster = fInputEvent->GetCaloCluster(gamma2->GetCaloClusterRef());
2690  Bool_t matched = (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma0,cluster, fInputEvent, fWeightJetJetMC))
2691  || (((AliCaloPhotonCuts*)fClusterCutArray->At(fiCut))->MatchConvPhotonToCluster(gamma1,cluster, fInputEvent, fWeightJetJetMC));
2692  AliAODConversionMother *omegacand = new AliAODConversionMother(pi0cand,gamma2);
2693  if (matched){
2694  fHistoMotherMatchedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2695  delete omegacand;
2696  omegacand=0x0;
2697  continue;
2698  }
2699  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(omegacand, pi0cand, gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
2700  fHistoMotherInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2701  if(fIsMC>0){
2702  if(fInputEvent->IsA()==AliESDEvent::Class())
2703  ProcessTrueMesonCandidates(omegacand,gamma0,gamma1,gamma2);
2704  if(fInputEvent->IsA()==AliAODEvent::Class())
2705  ProcessTrueMesonCandidatesAOD(omegacand,gamma0,gamma1,gamma2);
2706  }
2707  if(omegacand->M()>0.7 && omegacand->M()<0.85){
2708  fHistoGammaFromMotherPt[fiCut]->Fill(gamma2->Pt(),fWeightJetJetMC);
2709  if(fDoMesonQA){
2710  fHistoMotherYPt[fiCut]->Fill(omegacand->Pt(),omegacand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2711  fHistoMotherAlphaPt[fiCut]->Fill(omegacand->Pt(),omegacand->GetAlpha(),fWeightJetJetMC);
2712  fHistoMotherEtaPhi[fiCut]->Fill(omegacand->Phi(),omegacand->Eta(),fWeightJetJetMC);
2713  fHistoMotherPi0AnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(pi0cand->Vect()),fWeightJetJetMC);
2714  fHistoMotherGammaAnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(gamma2->Vect()),fWeightJetJetMC);
2715  fHistoPi0GammaAnglePt[fiCut]->Fill(omegacand->Pt(),pi0cand->Angle(gamma2->Vect()),fWeightJetJetMC);
2718  }
2719  }
2720  } else if(fDoPiZeroGammaAngleCut){
2721  fHistoMotherAngleCutRejectedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2722  }
2723  delete omegacand;
2724  omegacand=0x0;
2725  }
2726  } else{
2727  delete pi0cand;
2728  pi0cand=0x0;
2729  }
2730  }
2731  }
2732  }
2733  }
2734  break;
2735  //PCM-PCM,PCM
2736  case 5:
2737  if(fGammaCandidates->GetEntries()>2){
2738  for(Int_t firstGammaIndex=0;firstGammaIndex<fGammaCandidates->GetEntries();firstGammaIndex++){
2739  AliAODConversionPhoton *gamma0=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(firstGammaIndex));
2740  if (gamma0==NULL) continue;
2741  for(Int_t secondGammaIndex=firstGammaIndex+1;secondGammaIndex<fGammaCandidates->GetEntries();secondGammaIndex++){
2742  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(secondGammaIndex));
2743  if (gamma1==NULL || (secondGammaIndex+1)>=(fGammaCandidates->GetEntries())) continue;
2744  AliAODConversionMother *pi0cand = new AliAODConversionMother(gamma0, gamma1);
2746  ->MesonIsSelected(pi0cand,kTRUE,((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift())
2747  && pi0cand->Pt() > fMinPi0Pt){
2748  fHistoPhotonPairInvMassPt[fiCut]->Fill(pi0cand->M(),pi0cand->Pt(),fWeightJetJetMC);
2749  if(pi0cand->M() > ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionLow() &&
2750  pi0cand->M() < ((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->GetSelectionHigh()){
2751  //change energy of pi0 candidate s.t. its mass is the pdg mass
2752  pi0cand->SetPxPyPzE(pi0cand->Px(),pi0cand->Py(),pi0cand->Pz(),TMath::Sqrt(0.1349766*0.1349766+pi0cand->P()*pi0cand->P()));
2753  fPi0Candidates->Add(pi0cand);
2754  if(fDoMesonQA>0){
2755  fHistoPhotonPairYPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2756  fHistoPhotonPairAlphaPt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetAlpha(),fWeightJetJetMC);
2757  fHistoPhotonPairOpenAnglePt[fiCut]->Fill(pi0cand->Pt(),pi0cand->GetOpeningAngle(),fWeightJetJetMC);
2758  fHistoPhotonPairEtaPhi[fiCut]->Fill(pi0cand->Phi(),pi0cand->Eta(),fWeightJetJetMC);
2759  }
2760  for(Int_t thirdGammaIndex=0;thirdGammaIndex<fGammaCandidates->GetEntries();thirdGammaIndex++){
2761  if (thirdGammaIndex==firstGammaIndex || thirdGammaIndex==secondGammaIndex) continue;
2762  AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(thirdGammaIndex));
2763  if (gamma2==NULL) continue;
2764  AliAODConversionMother *omegacand = new AliAODConversionMother(pi0cand,gamma2);
2765  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(omegacand, pi0cand, gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
2766  if(fIsMC>0){
2767  if(fInputEvent->IsA()==AliESDEvent::Class())
2768  ProcessTrueMesonCandidates(omegacand,gamma0,gamma1,gamma2);
2769  if(fInputEvent->IsA()==AliAODEvent::Class())
2770  ProcessTrueMesonCandidatesAOD(omegacand,gamma0,gamma1,gamma2);
2771  }
2772  fHistoMotherInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2773  if(omegacand->M()>0.7 && omegacand->M()<0.85){
2774  fHistoGammaFromMotherPt[fiCut]->Fill(gamma2->Pt(),fWeightJetJetMC);
2775  if(fDoMesonQA>0){
2776  fHistoMotherYPt[fiCut]->Fill(omegacand->Pt(),omegacand->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2777  fHistoMotherAlphaPt[fiCut]->Fill(omegacand->Pt(),omegacand->GetAlpha(),fWeightJetJetMC);
2778  fHistoMotherEtaPhi[fiCut]->Fill(omegacand->Phi(),omegacand->Eta(),fWeightJetJetMC);
2779  fHistoMotherPi0AnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(pi0cand->Vect()),fWeightJetJetMC);
2780  fHistoMotherGammaAnglePt[fiCut]->Fill(omegacand->Pt(),TMath::Pi() - omegacand->Angle(gamma2->Vect()),fWeightJetJetMC);
2781  fHistoPi0GammaAnglePt[fiCut]->Fill(omegacand->Pt(),pi0cand->Angle(gamma2->Vect()),fWeightJetJetMC);
2782  }
2783  }
2784  } else if(fDoPiZeroGammaAngleCut){
2785  fHistoMotherAngleCutRejectedInvMassPt[fiCut]->Fill(omegacand->M(),omegacand->Pt(),fWeightJetJetMC);
2786  }
2787  delete omegacand;
2788  omegacand=0x0;
2789  }
2790  } else{
2791  delete pi0cand;
2792  pi0cand=0x0;
2793  }
2794  }
2795  }
2796  }
2797  }
2798  break;
2799  }
2800 }
2801 //______________________________________________________________________
2803 {
2804  switch (fReconMethod){
2805  // pcm-cal,cal
2806  case 0:
2807  {
2808  // get gamma0MotherLabel
2809  Int_t gamma0MCLabel = -1;
2810  Int_t gamma0MotherLabel = -1;
2811  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
2812  gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(fMCEvent);
2813  if(gamma0MCLabel>-1){
2814  TParticle * gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
2815  gamma0MotherLabel=gammaMC0->GetFirstMother();
2816  }
2817  }
2818 
2819  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2820  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
2821  Int_t gamma1MotherLabel = -1;
2822  TParticle * gammaMC1 = 0x0;
2823  if(gamma1MCLabel != -1){
2824  // get mother or grandmother of gamma1 depending on whether it is an electron-leading/photon-leading cluster
2825  gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
2826  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons it's the direct mother
2827  gamma1MotherLabel=gammaMC1->GetMother(0);
2828  }else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
2829  if (TrueGammaCandidate1->IsConversion() && gammaMC1->GetMother(0)>-1) gamma1MotherLabel=(fMCEvent->Particle(gammaMC1->GetMother(0)))->GetMother(0);
2830  else gamma1MotherLabel=gammaMC1->GetMother(0);
2831  }
2832  }
2833 
2834  // check if mother of gamma0 and gamma1 is really a pi0
2835  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel && ((TParticle*)fMCEvent->Particle(gamma0MotherLabel))->GetPdgCode() == 111){
2836 
2837  // fill pi0 histograms here if necessary
2838 
2839  if (!TrueGammaCandidate2->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2840  Int_t gamma2MCLabel = TrueGammaCandidate2->GetCaloPhotonMCLabel(0); // get most probable MC label
2841  Int_t gamma2MotherLabel = -1;
2842  TParticle * gammaMC2 = 0x0;
2843  if(gamma2MCLabel != -1){
2844  // get mother or grandmother of gamma1 (potentially true omega) depending on whether it is an electron-leading/photon-leading cluster
2845  gammaMC2 = (TParticle*)fMCEvent->Particle(gamma2MCLabel);
2846  if (TrueGammaCandidate2->IsLargestComponentPhoton()){ // for photons it's the direct mother
2847  gamma2MotherLabel=gammaMC2->GetMother(0);
2848  }else if (TrueGammaCandidate2->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
2849  if (TrueGammaCandidate2->IsConversion() && gammaMC2->GetMother(0)>-1) gamma2MotherLabel=fMCEvent->Particle(gammaMC2->GetMother(0))->GetMother(0);
2850  else gamma2MotherLabel=gammaMC2->GetMother(0);
2851  }
2852  }
2853 
2854  //get pi0MotherLabel
2855  Int_t pi0MotherLabel = fMCEvent->Particle(gamma0MotherLabel)->GetMother(0);
2856  // check if mother of pi0 and mother of gamma2 are the same particle and that it is an omega
2857  if(pi0MotherLabel>=0 && gamma2MotherLabel==pi0MotherLabel && ((TParticle*)fMCEvent->Particle(pi0MotherLabel))->GetPdgCode() == 223){
2858  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
2859  // create pi0 candidate and fill histograms
2860  AliAODConversionMother *TruePi0 = new AliAODConversionMother(TrueGammaCandidate0, TrueGammaCandidate1);
2861  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
2862  fHistoTrueGammaFromOmegaPt[fiCut]->Fill(TrueGammaCandidate2->Pt(),fWeightJetJetMC);
2863  if(fDoMesonQA>0){
2864  fHistoTrueOmegaYPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2865  fHistoTrueOmegaAlphaPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->GetAlpha(),fWeightJetJetMC);
2866  fHistoTrueOmegaEtaPhi[fiCut]->Fill(OmegaCandidate->Phi(),OmegaCandidate->Eta(),fWeightJetJetMC);
2867  fHistoTrueOmegaGammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
2868  fHistoTrueOmegaPtGammaPt[fiCut]->Fill(OmegaCandidate->Pt(),TrueGammaCandidate2->Pt(),fWeightJetJetMC);
2869  fHistoTruePi0FromOmegaAlphaPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->GetAlpha(),fWeightJetJetMC);
2870  fHistoTruePi0FromOmegaYPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2871  fHistoTruePi0FromOmegaEtaPhi[fiCut]->Fill(TruePi0->Phi(),TruePi0->Eta(),fWeightJetJetMC);
2873  fHistoTrueOmegaPi0AnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TruePi0->Vect()),fWeightJetJetMC);
2874  fHistoTruePi0GammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
2875  fHistoTrueOmegaPtPi0Pt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Pt(),fWeightJetJetMC);
2876  }
2877  delete TruePi0;
2878  TruePi0=0x0;
2879  }
2880  }
2881  }
2882  break;
2883  // pcm-cal,pcm
2884  case 1:
2885  {
2886  // get gamma0MotherLabel
2887  Int_t gamma0MCLabel = -1;
2888  Int_t gamma0MotherLabel = -1;
2889  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
2890  gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(fMCEvent);
2891  if(gamma0MCLabel>-1){
2892  TParticle * gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
2893  gamma0MotherLabel=gammaMC0->GetFirstMother();
2894  }
2895  }
2896 
2897  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2898  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
2899  Int_t gamma1MotherLabel = -1;
2900  TParticle * gammaMC1 = 0x0;
2901  if(gamma1MCLabel != -1){
2902  // get mother or grandmother of gamma1 depending on whether it is an electron-leading/photon-leading cluster
2903  gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
2904  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons it's the direct mother
2905  gamma1MotherLabel=gammaMC1->GetMother(0);
2906  }else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
2907  if (TrueGammaCandidate1->IsConversion() && gammaMC1->GetMother(0)>-1) gamma1MotherLabel=fMCEvent->Particle(gammaMC1->GetMother(0))->GetMother(0);
2908  else gamma1MotherLabel=gammaMC1->GetMother(0);
2909  }
2910  }
2911 
2912  // check if mother of gamma0 and gamma1 is really a pi0
2913  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel && ((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
2914 
2915  // fill pi0 histograms here if necessary
2916 
2917  // get mother of gamma2
2918  Int_t gamma2MCLabel = -1;
2919  Int_t gamma2MotherLabel = -1;
2920  if (TrueGammaCandidate2->IsTrueConvertedPhoton()){
2921  gamma2MCLabel = TrueGammaCandidate2->GetMCParticleLabel(fMCEvent);
2922  if(gamma2MCLabel>-1){
2923  TParticle * gammaMC2 = (TParticle*)fMCEvent->Particle(gamma2MCLabel);
2924  gamma2MotherLabel = gammaMC2->GetFirstMother();
2925  }
2926  }
2927 
2928  // get pi0MotherLabel
2929  Int_t pi0MotherLabel = fMCEvent->Particle(gamma0MotherLabel)->GetMother(0);
2930  // check if mother of pi0 and mother of gamma2 are the same particle and that it is an omega
2931  if(pi0MotherLabel>=0 && gamma2MotherLabel==pi0MotherLabel && ((TParticle*)fMCEvent->Particle(pi0MotherLabel))->GetPdgCode() == 223){
2932  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
2933  // create pi0 candidate and fill histograms
2934  AliAODConversionMother *TruePi0 = new AliAODConversionMother(TrueGammaCandidate0, TrueGammaCandidate1);
2935  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
2936  fHistoTrueGammaFromOmegaPt[fiCut]->Fill(TrueGammaCandidate2->Pt(),fWeightJetJetMC);
2937  if(fDoMesonQA>0){
2938  fHistoTrueOmegaYPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2939  fHistoTrueOmegaAlphaPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->GetAlpha(),fWeightJetJetMC);
2940  fHistoTrueOmegaEtaPhi[fiCut]->Fill(OmegaCandidate->Phi(),OmegaCandidate->Eta(),fWeightJetJetMC);
2941  fHistoTrueOmegaGammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
2942  fHistoTrueOmegaPtGammaPt[fiCut]->Fill(OmegaCandidate->Pt(),TrueGammaCandidate2->Pt(),fWeightJetJetMC);
2943  fHistoTruePi0FromOmegaAlphaPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->GetAlpha(),fWeightJetJetMC);
2944  fHistoTruePi0FromOmegaYPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
2945  fHistoTruePi0FromOmegaEtaPhi[fiCut]->Fill(TruePi0->Phi(),TruePi0->Eta(),fWeightJetJetMC);
2947  fHistoTrueOmegaPi0AnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TruePi0->Vect()),fWeightJetJetMC);
2948  fHistoTruePi0GammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
2949  fHistoTrueOmegaPtPi0Pt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Pt(),fWeightJetJetMC);
2950  }
2951  delete TruePi0;
2952  TruePi0=0x0;
2953  }
2954  }
2955  }
2956  break;
2957  // cal-cal,cal
2958  case 2:
2959  {
2960  // get gamma0MotherLabel
2961  if (!TrueGammaCandidate0->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2962  Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
2963  Int_t gamma0MotherLabel = -1;
2964  TParticle * gammaMC0 = 0x0;
2965  if(gamma0MCLabel != -1){
2966  // get mother or grandmother of gamma0 depending on whether it is an electron-leading/photon-leading cluster
2967  gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
2968  if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons it's the direct mother
2969  gamma0MotherLabel=gammaMC0->GetMother(0);
2970  }else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
2971  if (TrueGammaCandidate0->IsConversion() && gammaMC0->GetMother(0)>-1) gamma0MotherLabel=fMCEvent->Particle(gammaMC0->GetMother(0))->GetMother(0);
2972  else gamma0MotherLabel=gammaMC0->GetMother(0);
2973  }
2974  }
2975 
2976  // get gamma1MotherLabel
2977  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2978  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
2979  Int_t gamma1MotherLabel = -1;
2980  TParticle * gammaMC1 = 0x0;
2981  if(gamma1MCLabel != -1){
2982  // get mother or grandmother of gamma1 depending on whether it is an electron-leading/photon-leading cluster
2983  gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
2984  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons it's the direct mother
2985  gamma1MotherLabel=gammaMC1->GetMother(0);
2986  }else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
2987  if (TrueGammaCandidate1->IsConversion() && gammaMC1->GetMother(0)>-1) gamma1MotherLabel=fMCEvent->Particle(gammaMC1->GetMother(0))->GetMother(0);
2988  else gamma1MotherLabel=gammaMC1->GetMother(0);
2989  }
2990  }
2991 
2992  // check if mother of gamma0 and gamma1 is really a pi0
2993  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel && ((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
2994 
2995  // fill pi0 histograms here if necessary
2996 
2997  if (!TrueGammaCandidate2->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
2998  Int_t gamma2MCLabel = TrueGammaCandidate2->GetCaloPhotonMCLabel(0); // get most probable MC label
2999  Int_t gamma2MotherLabel = -1;
3000  TParticle * gammaMC2 = 0x0;
3001  if(gamma2MCLabel != -1){
3002  // get mother or grandmother of gamma2 (potentially true omega) depending on whether it is an electron-leading/photon-leading cluster
3003  gammaMC2 = (TParticle*)fMCEvent->Particle(gamma2MCLabel);
3004  if (TrueGammaCandidate2->IsLargestComponentPhoton()){ // for photons it's the direct mother
3005  gamma2MotherLabel=gammaMC2->GetMother(0);
3006  }else if (TrueGammaCandidate2->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3007  if (TrueGammaCandidate2->IsConversion() && gammaMC2->GetMother(0)>-1) gamma2MotherLabel=fMCEvent->Particle(gammaMC2->GetMother(0))->GetMother(0);
3008  else gamma2MotherLabel=gammaMC2->GetMother(0);
3009  }
3010  }
3011 
3012  //get pi0MotherLabel
3013  Int_t pi0MotherLabel = fMCEvent->Particle(gamma0MotherLabel)->GetMother(0);
3014  // check if mother of pi0 and mother of gamma2 are the same particle and that it is an omega
3015  if(pi0MotherLabel>=0 && gamma2MotherLabel==pi0MotherLabel && ((TParticle*)fMCEvent->Particle(pi0MotherLabel))->GetPdgCode() == 223){
3016  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3017  // create pi0 candidate and fill histograms
3018  AliAODConversionMother *TruePi0 = new AliAODConversionMother(TrueGammaCandidate0, TrueGammaCandidate1);
3019  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3020  fHistoTrueGammaFromOmegaPt[fiCut]->Fill(TrueGammaCandidate2->Pt(),fWeightJetJetMC);
3021  if(fDoMesonQA>0){
3022  fHistoTrueOmegaYPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
3023  fHistoTrueOmegaAlphaPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->GetAlpha(),fWeightJetJetMC);
3024  fHistoTrueOmegaEtaPhi[fiCut]->Fill(OmegaCandidate->Phi(),OmegaCandidate->Eta(),fWeightJetJetMC);
3025  fHistoTrueOmegaGammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
3026  fHistoTrueOmegaPtGammaPt[fiCut]->Fill(OmegaCandidate->Pt(),TrueGammaCandidate2->Pt(),fWeightJetJetMC);
3027  fHistoTruePi0FromOmegaAlphaPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->GetAlpha(),fWeightJetJetMC);
3028  fHistoTruePi0FromOmegaYPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
3029  fHistoTruePi0FromOmegaEtaPhi[fiCut]->Fill(TruePi0->Phi(),TruePi0->Eta(),fWeightJetJetMC);
3031  fHistoTrueOmegaPi0AnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TruePi0->Vect()),fWeightJetJetMC);
3032  fHistoTruePi0GammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
3033  fHistoTrueOmegaPtPi0Pt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Pt(),fWeightJetJetMC);
3034  }
3035  delete TruePi0;
3036  TruePi0=0x0;
3037  }
3038  }
3039  }
3040  break;
3041  // cal-cal,pcm
3042  case 3:
3043  {
3044  // get gamma0MotherLabel
3045  if (!TrueGammaCandidate0->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3046  Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
3047  Int_t gamma0MotherLabel = -1;
3048  TParticle * gammaMC0 = 0x0;
3049  if(gamma0MCLabel != -1){
3050  // get mother or grandmother of gamma0 depending on whether it is an electron-leading/photon-leading cluster
3051  gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
3052  if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons it's the direct mother
3053  gamma0MotherLabel=gammaMC0->GetMother(0);
3054  }else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3055  if (TrueGammaCandidate0->IsConversion() && gammaMC0->GetMother(0)>-1) gamma0MotherLabel=fMCEvent->Particle(gammaMC0->GetMother(0))->GetMother(0);
3056  else gamma0MotherLabel=gammaMC0->GetMother(0);
3057  }
3058  }
3059 
3060  // get gamma1MotherLabel
3061  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3062  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
3063  Int_t gamma1MotherLabel = -1;
3064  TParticle * gammaMC1 = 0x0;
3065  if(gamma1MCLabel != -1){
3066  // get mother or grandmother of gamma1 depending on whether it is an electron-leading/photon-leading cluster
3067  gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
3068  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons it's the direct mother
3069  gamma1MotherLabel=gammaMC1->GetMother(0);
3070  }else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3071  if (TrueGammaCandidate1->IsConversion() && gammaMC1->GetMother(0)>-1) gamma1MotherLabel=fMCEvent->Particle(gammaMC1->GetMother(0))->GetMother(0);
3072  else gamma1MotherLabel=gammaMC1->GetMother(0);
3073  }
3074  }
3075 
3076  // check if mother of gamma0 and gamma1 is really a pi0
3077  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel && ((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
3078 
3079  // fill pi0 histograms here if necessary
3080 
3081  // get mother of gamma2
3082  Int_t gamma2MCLabel = -1;
3083  Int_t gamma2MotherLabel = -1;
3084  if (TrueGammaCandidate2->IsTrueConvertedPhoton()){
3085  gamma2MCLabel = TrueGammaCandidate2->GetMCParticleLabel(fMCEvent);
3086  if(gamma2MCLabel>-1){
3087  TParticle * gammaMC2 = (TParticle*)fMCEvent->Particle(gamma2MCLabel);
3088  gamma2MotherLabel = gammaMC2->GetFirstMother();
3089  }
3090  }
3091 
3092  // get pi0MotherLabel
3093  Int_t pi0MotherLabel = fMCEvent->Particle(gamma0MotherLabel)->GetMother(0);
3094  // check if mother of pi0 and mother of gamma2 are the same particle and that it is an omega
3095  if(pi0MotherLabel>=0 && gamma2MotherLabel==pi0MotherLabel && ((TParticle*)fMCEvent->Particle(pi0MotherLabel))->GetPdgCode() == 223){
3096  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3097  // create pi0 candidate and fill histograms
3098  AliAODConversionMother *TruePi0 = new AliAODConversionMother(TrueGammaCandidate0, TrueGammaCandidate1);
3099  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3100  fHistoTrueGammaFromOmegaPt[fiCut]->Fill(TrueGammaCandidate2->Pt(),fWeightJetJetMC);
3101  if(fDoMesonQA>0){
3102  fHistoTrueOmegaYPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
3103  fHistoTrueOmegaAlphaPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->GetAlpha(),fWeightJetJetMC);
3104  fHistoTrueOmegaEtaPhi[fiCut]->Fill(OmegaCandidate->Phi(),OmegaCandidate->Eta(),fWeightJetJetMC);
3105  fHistoTrueOmegaGammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
3106  fHistoTrueOmegaPtGammaPt[fiCut]->Fill(OmegaCandidate->Pt(),TrueGammaCandidate2->Pt(),fWeightJetJetMC);
3107  fHistoTruePi0FromOmegaAlphaPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->GetAlpha(),fWeightJetJetMC);
3108  fHistoTruePi0FromOmegaYPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
3109  fHistoTruePi0FromOmegaEtaPhi[fiCut]->Fill(TruePi0->Phi(),TruePi0->Eta(),fWeightJetJetMC);
3111  fHistoTrueOmegaPi0AnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TruePi0->Vect()),fWeightJetJetMC);
3112  fHistoTruePi0GammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
3113  fHistoTrueOmegaPtPi0Pt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Pt(),fWeightJetJetMC);
3114  }
3115  delete TruePi0;
3116  TruePi0=0x0;
3117  }
3118  }
3119  }
3120  break;
3121  // pcm-pcm,cal
3122  case 4:
3123  {
3124  // get gamma0MotherLabel
3125  Int_t gamma0MCLabel = -1;
3126  Int_t gamma0MotherLabel = -1;
3127  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
3128  gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(fMCEvent);
3129  if(gamma0MCLabel>-1){
3130  TParticle * gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
3131  gamma0MotherLabel=gammaMC0->GetFirstMother();
3132  }
3133  }
3134 
3135  // get gamma1MotherLabel
3136  Int_t gamma1MCLabel = -1;
3137  Int_t gamma1MotherLabel = -1;
3138  if (TrueGammaCandidate1->IsTrueConvertedPhoton()){
3139  gamma1MCLabel = TrueGammaCandidate1->GetMCParticleLabel(fMCEvent);
3140  if(gamma1MCLabel>-1){
3141  TParticle * gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
3142  gamma1MotherLabel=gammaMC1->GetFirstMother();
3143  }
3144  }
3145 
3146  // check if mother of gamma0 and gamma1 is really a pi0
3147  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel &&
3148  ((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
3149 
3150  // fill pi0 histograms here if necessary
3151 
3152  if (!TrueGammaCandidate2->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3153  Int_t gamma2MCLabel = TrueGammaCandidate2->GetCaloPhotonMCLabel(0); // get most probable MC label
3154  Int_t gamma2MotherLabel = -1;
3155  TParticle * gammaMC2 = 0x0;
3156  if(gamma2MCLabel != -1){
3157  // get mother or grandmother of gamma1 (potentially true omega) depending on whether it is an electron-leading/photon-leading cluster
3158  gammaMC2 = (TParticle*)fMCEvent->Particle(gamma2MCLabel);
3159  if (TrueGammaCandidate2->IsLargestComponentPhoton()){ // for photons it's the direct mother
3160  gamma2MotherLabel=gammaMC2->GetMother(0);
3161  }else if (TrueGammaCandidate2->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3162  if (TrueGammaCandidate2->IsConversion() && gammaMC2->GetMother(0)>-1) gamma2MotherLabel=fMCEvent->Particle(gammaMC2->GetMother(0))->GetMother(0);
3163  else gamma2MotherLabel=gammaMC2->GetMother(0);
3164  }
3165  }
3166 
3167  //get pi0MotherLabel
3168  Int_t pi0MotherLabel = fMCEvent->Particle(gamma0MotherLabel)->GetMother(0);
3169  // check if mother of pi0 and mother of gamma2 are the same particle and that it is an omega
3170  if(pi0MotherLabel>=0 && gamma2MotherLabel==pi0MotherLabel && ((TParticle*)fMCEvent->Particle(pi0MotherLabel))->GetPdgCode() == 223){
3171  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3172  // create pi0 candidate and fill histograms
3173  AliAODConversionMother *TruePi0 = new AliAODConversionMother(TrueGammaCandidate0, TrueGammaCandidate1);
3174  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3175  fHistoTrueGammaFromOmegaPt[fiCut]->Fill(TrueGammaCandidate2->Pt(),fWeightJetJetMC);
3176  if(fDoMesonQA>0){
3177  fHistoTrueOmegaYPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
3178  fHistoTrueOmegaAlphaPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->GetAlpha(),fWeightJetJetMC);
3179  fHistoTrueOmegaEtaPhi[fiCut]->Fill(OmegaCandidate->Phi(),OmegaCandidate->Eta(),fWeightJetJetMC);
3180  fHistoTrueOmegaGammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
3181  fHistoTrueOmegaPtGammaPt[fiCut]->Fill(OmegaCandidate->Pt(),TrueGammaCandidate2->Pt(),fWeightJetJetMC);
3182  fHistoTruePi0FromOmegaAlphaPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->GetAlpha(),fWeightJetJetMC);
3183  fHistoTruePi0FromOmegaYPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
3184  fHistoTruePi0FromOmegaEtaPhi[fiCut]->Fill(TruePi0->Phi(),TruePi0->Eta(),fWeightJetJetMC);
3186  fHistoTrueOmegaPi0AnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TruePi0->Vect()),fWeightJetJetMC);
3187  fHistoTruePi0GammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
3188  fHistoTrueOmegaPtPi0Pt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Pt(),fWeightJetJetMC);
3189  }
3190  delete TruePi0;
3191  TruePi0=0x0;
3192  }
3193  }
3194  }
3195  break;
3196  // pcm-pcm,pcm
3197  case 5:
3198  {
3199  // get gamma0MotherLabel
3200  Int_t gamma0MCLabel = -1;
3201  Int_t gamma0MotherLabel = -1;
3202  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
3203  gamma0MCLabel = TrueGammaCandidate0->GetMCParticleLabel(fMCEvent);
3204  if(gamma0MCLabel>-1){
3205  TParticle * gammaMC0 = (TParticle*)fMCEvent->Particle(gamma0MCLabel);
3206  gamma0MotherLabel=gammaMC0->GetFirstMother();
3207  }
3208  }
3209 
3210  // get gamma1MotherLabel
3211  Int_t gamma1MCLabel = -1;
3212  Int_t gamma1MotherLabel = -1;
3213  if (TrueGammaCandidate1->IsTrueConvertedPhoton()){
3214  gamma1MCLabel = TrueGammaCandidate1->GetMCParticleLabel(fMCEvent);
3215  if(gamma1MCLabel>-1){
3216  TParticle * gammaMC1 = (TParticle*)fMCEvent->Particle(gamma1MCLabel);
3217  gamma1MotherLabel=gammaMC1->GetFirstMother();
3218  }
3219  }
3220 
3221  // check if mother of gamma0 and gamma1 is really a pi0
3222  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel &&
3223  ((TParticle*)fMCEvent->Particle(gamma1MotherLabel))->GetPdgCode() == 111){
3224 
3225  // fill pi0 histograms here if necessary
3226 
3227  Int_t gamma2MCLabel = -1;
3228  Int_t gamma2MotherLabel = -1;
3229  if (TrueGammaCandidate2->IsTrueConvertedPhoton()){
3230  gamma2MCLabel = TrueGammaCandidate2->GetMCParticleLabel(fMCEvent);
3231  if(gamma2MCLabel>-1){
3232  TParticle * gammaMC2 = (TParticle*)fMCEvent->Particle(gamma2MCLabel);
3233  gamma2MotherLabel=gammaMC2->GetFirstMother();
3234  }
3235  }
3236 
3237  //get pi0MotherLabel
3238  Int_t pi0MotherLabel = fMCEvent->Particle(gamma0MotherLabel)->GetMother(0);
3239  // check if mother of pi0 and mother of gamma2 are the same particle and that it is an omega
3240  if(pi0MotherLabel>=0 && gamma2MotherLabel==pi0MotherLabel && ((TParticle*)fMCEvent->Particle(pi0MotherLabel))->GetPdgCode() == 223){
3241  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3242  // create pi0 candidate and fill histograms
3243  AliAODConversionMother *TruePi0 = new AliAODConversionMother(TrueGammaCandidate0, TrueGammaCandidate1);
3244  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3245  fHistoTrueGammaFromOmegaPt[fiCut]->Fill(TrueGammaCandidate2->Pt(),fWeightJetJetMC);
3246  if(fDoMesonQA>0){
3247  fHistoTrueOmegaYPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
3248  fHistoTrueOmegaAlphaPt[fiCut]->Fill(OmegaCandidate->Pt(),OmegaCandidate->GetAlpha(),fWeightJetJetMC);
3249  fHistoTrueOmegaEtaPhi[fiCut]->Fill(OmegaCandidate->Phi(),OmegaCandidate->Eta(),fWeightJetJetMC);
3250  fHistoTrueOmegaGammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
3251  fHistoTrueOmegaPtGammaPt[fiCut]->Fill(OmegaCandidate->Pt(),TrueGammaCandidate2->Pt(),fWeightJetJetMC);
3252  fHistoTruePi0FromOmegaAlphaPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->GetAlpha(),fWeightJetJetMC);
3253  fHistoTruePi0FromOmegaYPt[fiCut]->Fill(TruePi0->Pt(),TruePi0->Rapidity()-((AliConvEventCuts*)fEventCutArray->At(fiCut))->GetEtaShift(),fWeightJetJetMC);
3254  fHistoTruePi0FromOmegaEtaPhi[fiCut]->Fill(TruePi0->Phi(),TruePi0->Eta(),fWeightJetJetMC);
3256  fHistoTrueOmegaPi0AnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TMath::Pi() - OmegaCandidate->Angle(TruePi0->Vect()),fWeightJetJetMC);
3257  fHistoTruePi0GammaAnglePt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Angle(TrueGammaCandidate2->Vect()),fWeightJetJetMC);
3258  fHistoTrueOmegaPtPi0Pt[fiCut]->Fill(OmegaCandidate->Pt(),TruePi0->Pt(),fWeightJetJetMC);
3259  }
3260  delete TruePi0;
3261  TruePi0=0x0;
3262  }
3263  }
3264  }
3265  break;
3266  }
3267 }
3268 
3269 //______________________________________________________________________
3271 {
3272  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
3273  if (AODMCTrackArray == NULL) return;
3274  Bool_t isTrueOmega = kFALSE;
3275 
3276  switch(fReconMethod){
3277  // pcm-cal,cal
3278  case 0:
3279  {
3280  AliAODMCParticle *positiveMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
3281  AliAODMCParticle *negativeMC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
3282 
3283  Int_t gamma0MCLabel = -1;
3284  Int_t gamma0MotherLabel = -1;
3285  if(!positiveMC||!negativeMC)
3286  return;
3287 
3288  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
3289  gamma0MCLabel = positiveMC->GetMother();
3290  AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3291  gamma0MotherLabel=gammaMC0->GetMother();
3292  }
3293 
3294  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3295  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
3296  Int_t gamma1MotherLabel = -1;
3297 
3298  AliAODMCParticle * gammaMC1 = 0x0;
3299  if(gamma1MCLabel != -1){
3300  gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
3301  // get gamma1MotherLabel
3302  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons it's the direct mother
3303  gamma1MotherLabel=gammaMC1->GetMother();
3304  }else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3305  if (TrueGammaCandidate1->IsConversion()){
3306  AliAODMCParticle * gammaGrandMotherMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
3307  gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
3308  }else gamma1MotherLabel=gammaMC1->GetMother();
3309  }
3310  }
3311 
3312  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel &&
3313  ((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
3314 
3315  // create pi0 and get pi0MotherLabel
3316  AliAODMCParticle * TruePi0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel));
3317  Int_t pi0MotherLabel = TruePi0->GetMother();
3318 
3319  if (!TrueGammaCandidate2->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3320  Int_t gamma2MCLabel = TrueGammaCandidate2->GetCaloPhotonMCLabel(0); // get most probable MC label
3321  Int_t gamma2MotherLabel = -1;
3322 
3323  AliAODMCParticle * gammaMC2 = 0x0;
3324  if(gamma2MCLabel != -1){
3325  gammaMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma2MCLabel));
3326  // get mother label
3327  if (TrueGammaCandidate2->IsLargestComponentPhoton()){ // for photons it's the direct mother
3328  gamma2MotherLabel=gammaMC2->GetMother();
3329  }else if (TrueGammaCandidate2->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3330  if (TrueGammaCandidate2->IsConversion()){
3331  AliAODMCParticle * gammaGrandMotherMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC2->GetMother()));
3332  gamma2MotherLabel=gammaGrandMotherMC2->GetMother();
3333  }else gamma2MotherLabel=gammaMC2->GetMother();
3334  }
3335  }
3336 
3337  if(pi0MotherLabel==gamma2MotherLabel && ((AliAODMCParticle*)AODMCTrackArray->At(gamma2MotherLabel))->GetPdgCode() == 223){
3338  isTrueOmega = kTRUE;
3339  }
3340  if(isTrueOmega){
3341  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3342  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3343  }
3344  }
3345  }
3346  break;
3347  // pcm-cal,pcm
3348  case 1:
3349  {
3350  AliAODMCParticle *positive0MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
3351  AliAODMCParticle *negative0MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
3352 
3353  Int_t gamma0MCLabel = -1;
3354  Int_t gamma0MotherLabel = -1;
3355  if(!positive0MC||!negative0MC)
3356  return;
3357 
3358  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
3359  gamma0MCLabel = positive0MC->GetMother();
3360  AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3361  gamma0MotherLabel=gammaMC0->GetMother();
3362  }
3363 
3364  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3365  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
3366  Int_t gamma1MotherLabel = -1;
3367 
3368  AliAODMCParticle * gammaMC1 = 0x0;
3369  if(gamma1MCLabel != -1){
3370  gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
3371  // get gamma1MotherLabel
3372  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons it's the direct mother
3373  gamma1MotherLabel=gammaMC1->GetMother();
3374  }else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3375  if (TrueGammaCandidate1->IsConversion()){
3376  AliAODMCParticle * gammaGrandMotherMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
3377  gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
3378  }else gamma1MotherLabel=gammaMC1->GetMother();
3379  }
3380  }
3381 
3382  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel &&
3383  ((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
3384 
3385  // create pi0 and get pi0MotherLabel
3386  AliAODMCParticle * TruePi0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel));
3387  Int_t pi0MotherLabel = TruePi0->GetMother();
3388 
3389  // get gamma2MotherLabel
3390  AliAODMCParticle *positive2MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate2->GetMCLabelPositive()));
3391  AliAODMCParticle *negative2MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate2->GetMCLabelNegative()));
3392 
3393  Int_t gamma2MCLabel = -1;
3394  Int_t gamma2MotherLabel = -1;
3395  if(!positive2MC||!negative2MC)
3396  return;
3397 
3398  if (TrueGammaCandidate2->IsTrueConvertedPhoton()){
3399  gamma2MCLabel = positive2MC->GetMother();
3400  AliAODMCParticle * gammaMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma2MCLabel));
3401  gamma2MotherLabel=gammaMC2->GetMother();
3402  }
3403 
3404  if(pi0MotherLabel==gamma2MotherLabel && ((AliAODMCParticle*)AODMCTrackArray->At(gamma2MotherLabel))->GetPdgCode() == 223){
3405  isTrueOmega = kTRUE;
3406  }
3407  if(isTrueOmega){
3408  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3409  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3410  }
3411  }
3412  }
3413  break;
3414  // cal-cal,cal
3415  case 2:
3416  {
3417  if (!TrueGammaCandidate0->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3418  Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
3419  Int_t gamma0MotherLabel = -1;
3420 
3421  AliAODMCParticle * gammaMC0 = 0x0;
3422  if(gamma0MCLabel != -1){
3423  gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3424  // get gamma0MotherLabel
3425  if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons it's the direct mother
3426  gamma0MotherLabel=gammaMC0->GetMother();
3427  }else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3428  if (TrueGammaCandidate0->IsConversion()){
3429  AliAODMCParticle * gammaGrandMotherMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC0->GetMother()));
3430  gamma0MotherLabel=gammaGrandMotherMC0->GetMother();
3431  }else gamma0MotherLabel=gammaMC0->GetMother();
3432  }
3433  }
3434 
3435  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3436  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
3437  Int_t gamma1MotherLabel = -1;
3438 
3439  AliAODMCParticle * gammaMC1 = 0x0;
3440  if(gamma1MCLabel != -1){
3441  gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
3442  // get gamma1MotherLabel
3443  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons it's the direct mother
3444  gamma1MotherLabel=gammaMC1->GetMother();
3445  }else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3446  if (TrueGammaCandidate1->IsConversion()){
3447  AliAODMCParticle * gammaGrandMotherMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
3448  gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
3449  }else gamma1MotherLabel=gammaMC1->GetMother();
3450  }
3451  }
3452 
3453  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel &&
3454  ((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
3455 
3456  // create pi0 and get pi0MotherLabel
3457  AliAODMCParticle * TruePi0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel));
3458  Int_t pi0MotherLabel = TruePi0->GetMother();
3459 
3460  if (!TrueGammaCandidate2->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3461  Int_t gamma2MCLabel = TrueGammaCandidate2->GetCaloPhotonMCLabel(0); // get most probable MC label
3462  Int_t gamma2MotherLabel = -1;
3463 
3464  AliAODMCParticle * gammaMC2 = 0x0;
3465  if(gamma2MCLabel != -1){
3466  gammaMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma2MCLabel));
3467  // get gamma2MotherLabel
3468  if (TrueGammaCandidate2->IsLargestComponentPhoton()){ // for photons it's the direct mother
3469  gamma2MotherLabel=gammaMC2->GetMother();
3470  }else if (TrueGammaCandidate2->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3471  if (TrueGammaCandidate2->IsConversion()){
3472  AliAODMCParticle * gammaGrandMotherMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC2->GetMother()));
3473  gamma2MotherLabel=gammaGrandMotherMC2->GetMother();
3474  }else gamma2MotherLabel=gammaMC2->GetMother();
3475  }
3476  }
3477 
3478  if(pi0MotherLabel==gamma2MotherLabel && ((AliAODMCParticle*)AODMCTrackArray->At(gamma2MotherLabel))->GetPdgCode() == 223){
3479  isTrueOmega = kTRUE;
3480  }
3481  if(isTrueOmega){
3482  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3483  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3484  }
3485  }
3486  }
3487  break;
3488  // cal-cal,pcm
3489  case 3:
3490  {
3491  if (!TrueGammaCandidate0->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3492  Int_t gamma0MCLabel = TrueGammaCandidate0->GetCaloPhotonMCLabel(0); // get most probable MC label
3493  Int_t gamma0MotherLabel = -1;
3494 
3495  AliAODMCParticle * gammaMC0 = 0x0;
3496  if(gamma0MCLabel != -1){
3497  gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3498  // get gamma0MotherLabel
3499  if (TrueGammaCandidate0->IsLargestComponentPhoton()){ // for photons it's the direct mother
3500  gamma0MotherLabel=gammaMC0->GetMother();
3501  }else if (TrueGammaCandidate0->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3502  if (TrueGammaCandidate0->IsConversion()){
3503  AliAODMCParticle * gammaGrandMotherMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC0->GetMother()));
3504  gamma0MotherLabel=gammaGrandMotherMC0->GetMother();
3505  }else gamma0MotherLabel=gammaMC0->GetMother();
3506  }
3507  }
3508 
3509  if (!TrueGammaCandidate1->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3510  Int_t gamma1MCLabel = TrueGammaCandidate1->GetCaloPhotonMCLabel(0); // get most probable MC label
3511  Int_t gamma1MotherLabel = -1;
3512 
3513  AliAODMCParticle * gammaMC1 = 0x0;
3514  if(gamma1MCLabel != -1){
3515  gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
3516  // get gamma1MotherLabel
3517  if (TrueGammaCandidate1->IsLargestComponentPhoton()){ // for photons it's the direct mother
3518  gamma1MotherLabel=gammaMC1->GetMother();
3519  }else if (TrueGammaCandidate1->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3520  if (TrueGammaCandidate1->IsConversion()){
3521  AliAODMCParticle * gammaGrandMotherMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC1->GetMother()));
3522  gamma1MotherLabel=gammaGrandMotherMC1->GetMother();
3523  }else gamma1MotherLabel=gammaMC1->GetMother();
3524  }
3525  }
3526 
3527  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel &&
3528  ((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
3529 
3530  // create pi0 and get pi0MotherLabel
3531  AliAODMCParticle * TruePi0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel));
3532  Int_t pi0MotherLabel = TruePi0->GetMother();
3533 
3534  // get gamma2MotherLabel
3535  AliAODMCParticle *positive2MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate2->GetMCLabelPositive()));
3536  AliAODMCParticle *negative2MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate2->GetMCLabelNegative()));
3537 
3538  Int_t gamma2MCLabel = -1;
3539  Int_t gamma2MotherLabel = -1;
3540  if(!positive2MC||!negative2MC)
3541  return;
3542 
3543  if (TrueGammaCandidate2->IsTrueConvertedPhoton()){
3544  gamma2MCLabel = positive2MC->GetMother();
3545  AliAODMCParticle * gammaMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma2MCLabel));
3546  gamma2MotherLabel=gammaMC2->GetMother();
3547  }
3548 
3549  if(pi0MotherLabel==gamma2MotherLabel && ((AliAODMCParticle*)AODMCTrackArray->At(gamma2MotherLabel))->GetPdgCode() == 223){
3550  isTrueOmega = kTRUE;
3551  }
3552  if(isTrueOmega){
3553  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3554  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3555  }
3556  }
3557  }
3558  break;
3559  // pcm-pcm,cal
3560  case 4:
3561  {
3562  AliAODMCParticle *positive0MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
3563  AliAODMCParticle *negative0MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
3564 
3565  Int_t gamma0MCLabel = -1;
3566  Int_t gamma0MotherLabel = -1;
3567  if(!positive0MC||!negative0MC)
3568  return;
3569 
3570  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
3571  gamma0MCLabel = positive0MC->GetMother();
3572  AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3573  gamma0MotherLabel=gammaMC0->GetMother();
3574  }
3575 
3576  AliAODMCParticle *positive1MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate1->GetMCLabelPositive()));
3577  AliAODMCParticle *negative1MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate1->GetMCLabelNegative()));
3578 
3579  Int_t gamma1MCLabel = -1;
3580  Int_t gamma1MotherLabel = -1;
3581  if(!positive1MC||!negative1MC)
3582  return;
3583 
3584  if (TrueGammaCandidate1->IsTrueConvertedPhoton()){
3585  gamma1MCLabel = positive1MC->GetMother();
3586  AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
3587  gamma1MotherLabel=gammaMC1->GetMother();
3588  }
3589 
3590  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel &&
3591  ((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
3592 
3593  // create pi0 and get pi0MotherLabel
3594  AliAODMCParticle * TruePi0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel));
3595  Int_t pi0MotherLabel = TruePi0->GetMother();
3596 
3597  if (!TrueGammaCandidate2->GetIsCaloPhoton()) AliFatal("CaloPhotonFlag has not been set. Aborting");
3598  Int_t gamma2MCLabel = TrueGammaCandidate2->GetCaloPhotonMCLabel(0); // get most probable MC label
3599  Int_t gamma2MotherLabel = -1;
3600 
3601  AliAODMCParticle * gammaMC2 = 0x0;
3602  if(gamma2MCLabel != -1){
3603  gammaMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma2MCLabel));
3604  // get mother label
3605  if (TrueGammaCandidate2->IsLargestComponentPhoton()){ // for photons it's the direct mother
3606  gamma2MotherLabel=gammaMC2->GetMother();
3607  }else if (TrueGammaCandidate2->IsLargestComponentElectron()){ // for electrons it's either the direct mother or for conversions the grandmother
3608  if (TrueGammaCandidate2->IsConversion()){
3609  AliAODMCParticle * gammaGrandMotherMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gammaMC2->GetMother()));
3610  gamma2MotherLabel=gammaGrandMotherMC2->GetMother();
3611  }else gamma2MotherLabel=gammaMC2->GetMother();
3612  }
3613  }
3614 
3615  if(pi0MotherLabel==gamma2MotherLabel && ((AliAODMCParticle*)AODMCTrackArray->At(gamma2MotherLabel))->GetPdgCode() == 223){
3616  isTrueOmega = kTRUE;
3617  }
3618  if(isTrueOmega){
3619  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3620  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3621  }
3622  }
3623  }
3624  break;
3625  // pcm-pcm,pcm
3626  case 5:
3627  {
3628  AliAODMCParticle *positive0MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelPositive()));
3629  AliAODMCParticle *negative0MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate0->GetMCLabelNegative()));
3630 
3631  Int_t gamma0MCLabel = -1;
3632  Int_t gamma0MotherLabel = -1;
3633  if(!positive0MC||!negative0MC)
3634  return;
3635 
3636  if (TrueGammaCandidate0->IsTrueConvertedPhoton()){
3637  gamma0MCLabel = positive0MC->GetMother();
3638  AliAODMCParticle * gammaMC0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MCLabel));
3639  gamma0MotherLabel=gammaMC0->GetMother();
3640  }
3641 
3642  AliAODMCParticle *positive1MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate1->GetMCLabelPositive()));
3643  AliAODMCParticle *negative1MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate1->GetMCLabelNegative()));
3644 
3645  Int_t gamma1MCLabel = -1;
3646  Int_t gamma1MotherLabel = -1;
3647  if(!positive1MC||!negative1MC)
3648  return;
3649 
3650  if (TrueGammaCandidate1->IsTrueConvertedPhoton()){
3651  gamma1MCLabel = positive1MC->GetMother();
3652  AliAODMCParticle * gammaMC1 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma1MCLabel));
3653  gamma1MotherLabel=gammaMC1->GetMother();
3654  }
3655 
3656  if(gamma0MotherLabel>=0 && gamma0MotherLabel==gamma1MotherLabel &&
3657  ((AliAODMCParticle*)AODMCTrackArray->At(gamma1MotherLabel))->GetPdgCode() == 111){
3658 
3659  // create pi0 and get pi0MotherLabel
3660  AliAODMCParticle * TruePi0 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma0MotherLabel));
3661  Int_t pi0MotherLabel = TruePi0->GetMother();
3662 
3663  AliAODMCParticle *positive2MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate2->GetMCLabelPositive()));
3664  AliAODMCParticle *negative2MC = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(TrueGammaCandidate2->GetMCLabelNegative()));
3665 
3666  Int_t gamma2MCLabel = -1;
3667  Int_t gamma2MotherLabel = -1;
3668  if(!positive2MC||!negative2MC)
3669  return;
3670 
3671  if (TrueGammaCandidate2->IsTrueConvertedPhoton()){
3672  gamma2MCLabel = positive2MC->GetMother();
3673  AliAODMCParticle * gammaMC2 = static_cast<AliAODMCParticle*>(AODMCTrackArray->At(gamma2MCLabel));
3674  gamma2MotherLabel=gammaMC2->GetMother();
3675  }
3676 
3677  if(pi0MotherLabel==gamma2MotherLabel && ((AliAODMCParticle*)AODMCTrackArray->At(gamma2MotherLabel))->GetPdgCode() == 223){
3678  isTrueOmega = kTRUE;
3679  }
3680  if(isTrueOmega){
3681  fHistoTrueOmegaInvMassPt[fiCut]->Fill(OmegaCandidate->M(),OmegaCandidate->Pt(),fWeightJetJetMC);
3682  fHistoTruePi0FromOmegaInvMassPt[fiCut]->Fill(TruePi0->M(),TruePi0->Pt(),fWeightJetJetMC);
3683  }
3684  }
3685  }
3686  break;
3687  }
3688 }
3689 
3690 //________________________________________________________________________
3692 
3693  //zbin and mbin from pi0handler
3694  Int_t Pi0zbin = fBGPi0Handler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
3695  Int_t Pi0mbin = 0;
3696 
3697  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
3699  }else {
3700  Pi0mbin = fBGPi0Handler[fiCut]->GetMultiplicityBinIndex(fPi0Candidates->GetEntries());
3701  }
3702 
3704 
3705  // background generation using pi0s and gammas
3706  // pi0 from handler, gamma from current event
3707  for(Int_t previous=0;previous<fBGPi0Handler[fiCut]->GetNBGEvents();previous++){
3708  AliGammaConversionMotherAODVector* previousPi0s = fBGPi0Handler[fiCut]->GetBGGoodMesons(Pi0zbin,Pi0mbin,previous);
3709  if(fMoveParticleAccordingToVertex == kTRUE){
3710  bgEvent1Vertex = fBGPi0Handler[fiCut]->GetBGEventVertex(Pi0zbin,Pi0mbin,previous);
3711  }
3712  for(UInt_t iPi0=0;iPi0<previousPi0s->size();iPi0++){
3713  AliAODConversionMother BGpi0cand = (AliAODConversionMother)(*(previousPi0s->at(iPi0)));
3714  if(fMoveParticleAccordingToVertex == kTRUE && bgEvent1Vertex){
3715  MoveParticleAccordingToVertex(&BGpi0cand, bgEvent1Vertex);
3716  }
3717  if(fReconMethod % 2 == 0){ //EMCAL gamma
3718  for(Int_t iCurrent3=0;iCurrent3<fClusterCandidates->GetEntries();iCurrent3++){
3719  AliAODConversionPhoton *gamma2 = dynamic_cast<AliAODConversionPhoton*>(fClusterCandidates->At(iCurrent3));
3720  if(gamma2 == NULL || !(gamma2->GetIsCaloPhoton())) continue;
3721  AliAODConversionMother *BGOmegacand = new AliAODConversionMother(&BGpi0cand,gamma2);
3722  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(BGOmegacand, &BGpi0cand, gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
3723  fHistoDiffPi0SameGammaBackInvMassPt[fiCut]->Fill(BGOmegacand->M(),BGOmegacand->Pt(),fWeightJetJetMC);
3724  }
3725  delete BGOmegacand;
3726  BGOmegacand = 0x0;
3727  }
3728  } else{ //PCM gamma
3729  for(Int_t iCurrent3=0;iCurrent3<fGammaCandidates->GetEntries();iCurrent3++){
3730  AliAODConversionPhoton *gamma2 = dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(iCurrent3));
3731  if(gamma2 == NULL) continue;
3732  AliAODConversionMother *BGOmegacand = new AliAODConversionMother(&BGpi0cand,gamma2);
3733  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(BGOmegacand, &BGpi0cand, gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
3734  fHistoDiffPi0SameGammaBackInvMassPt[fiCut]->Fill(BGOmegacand->M(),BGOmegacand->Pt(),fWeightJetJetMC);
3735  }
3736  delete BGOmegacand;
3737  BGOmegacand = 0x0;
3738  }
3739  }
3740  }
3741  }
3742 
3743  //pi0 from current event, gamma from handler
3744  //zbin and mbin from clushandler
3745  Int_t Cluszbin = fBGClusHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
3746  Int_t Clusmbin = 0;
3747 
3748  if(((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->UseTrackMultiplicity()){
3750  }else {
3751  Clusmbin = fBGClusHandler[fiCut]->GetMultiplicityBinIndex(fClusterCandidates->GetEntries());
3752  }
3753 
3754  //zbin and mbin from gammahandler
3755  Int_t Gammazbin = fBGHandler[fiCut]->GetZBinIndex(fInputEvent->GetPrimaryVertex()->GetZ());
3756  Int_t Gammambin = 0;
3757 
3758  if(((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->UseTrackMultiplicity()){
3760  }else {
3761  Gammambin = fBGHandler[fiCut]->GetMultiplicityBinIndex(fGammaCandidates->GetEntries());
3762  }
3763 
3764  for(Int_t iCurrent=0;iCurrent<fPi0Candidates->GetEntries();iCurrent++){
3765  AliAODConversionMother* BGpi0cand = dynamic_cast<AliAODConversionMother*>(fPi0Candidates->At(iCurrent));
3766  if(BGpi0cand == NULL) continue;
3767  if(fReconMethod % 2 == 0){ //EMCAL gamma
3768  for(Int_t previous=0;previous<fBGClusHandler[fiCut]->GetNBGEvents();previous++){
3769  AliGammaConversionAODVector *previousclusters = fBGClusHandler[fiCut]->GetBGGoodV0s(Cluszbin,Clusmbin,previous);
3770  if(fMoveParticleAccordingToVertex == kTRUE || ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
3771  bgEvent1Vertex = fBGClusHandler[fiCut]->GetBGEventVertex(Cluszbin,Clusmbin,previous);
3772  }
3773  for(UInt_t igamma2=0;igamma2<previousclusters->size();igamma2++){
3774  AliAODConversionPhoton gamma2 = (AliAODConversionPhoton)(*(previousclusters->at(igamma2)));
3775  if(fMoveParticleAccordingToVertex == kTRUE && bgEvent1Vertex){
3776  MoveParticleAccordingToVertex(&gamma2,bgEvent1Vertex);
3777  }
3778  AliAODConversionMother *BGOmegacand = new AliAODConversionMother(BGpi0cand,&gamma2);
3779  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(BGOmegacand, BGpi0cand, &gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
3780  fHistoSamePi0DiffGammaBackInvMassPt[fiCut]->Fill(BGOmegacand->M(),BGOmegacand->Pt(),fWeightJetJetMC);
3781  }
3782  delete BGOmegacand;
3783  BGOmegacand = 0x0;
3784  }
3785  }
3786  } else{ //PCM gamma
3787  for(Int_t previous=0;previous<fBGHandler[fiCut]->GetNBGEvents();previous++){
3788  AliGammaConversionAODVector *previousV0s = fBGHandler[fiCut]->GetBGGoodV0s(Gammazbin,Gammambin,previous);
3789  if(fMoveParticleAccordingToVertex == kTRUE || ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetInPlaneOutOfPlaneCut() != 0){
3790  bgEvent1Vertex = fBGHandler[fiCut]->GetBGEventVertex(Gammazbin,Gammambin,previous);
3791  }
3792  for(UInt_t igamma2=0;igamma2<previousV0s->size();igamma2++){
3793  AliAODConversionPhoton gamma2 = (AliAODConversionPhoton)(*(previousV0s->at(igamma2)));
3794  if(fMoveParticleAccordingToVertex == kTRUE && bgEvent1Vertex){
3795  MoveParticleAccordingToVertex(&gamma2,bgEvent1Vertex);
3796  }
3797  AliAODConversionMother *BGOmegacand = new AliAODConversionMother(BGpi0cand,&gamma2);
3798  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->MesonIsSelectedPiZeroGammaAngle(BGOmegacand, BGpi0cand, &gamma2, fDoPiZeroGammaAngleCut, fmaxfit, flowerFactor, fupperFactor)){
3799  fHistoSamePi0DiffGammaBackInvMassPt[fiCut]->Fill(BGOmegacand->M(),BGOmegacand->Pt(),fWeightJetJetMC);
3800  }
3801  delete BGOmegacand;
3802  BGOmegacand = 0x0;
3803  }
3804  }
3805  }
3806  }
3807 }
3808 
3809 //________________________________________________________________________
3811  //see header file for documentation
3812 
3813  Double_t dx = vertex->fX - fInputEvent->GetPrimaryVertex()->GetX();
3814  Double_t dy = vertex->fY - fInputEvent->GetPrimaryVertex()->GetY();
3815  Double_t dz = vertex->fZ - fInputEvent->GetPrimaryVertex()->GetZ();
3816 
3817  Double_t movedPlace[3] = {particle->GetConversionX() - dx,particle->GetConversionY() - dy,particle->GetConversionZ() - dz};
3818  particle->SetConversionPoint(movedPlace);
3819 }
3820 //________________________________________________________________________
3822  //see header file for documentation
3823 
3824  Double_t dx = vertex->fX - fInputEvent->GetPrimaryVertex()->GetX();
3825  Double_t dy = vertex->fY - fInputEvent->GetPrimaryVertex()->GetY();
3826  Double_t dz = vertex->fZ - fInputEvent->GetPrimaryVertex()->GetZ();
3827 
3828  Double_t movedPlace[3] = {particle->GetProductionX() - dx,particle->GetProductionY() - dy,particle->GetProductionZ() - dz};
3829  particle->SetProductionPoint(movedPlace);
3830 }
3831 //________________________________________________________________________
3833  //see header file for documentation
3834  if(fPi0Candidates->GetEntries()>0){
3835  if(fReconMethod % 2 == 1){ //single gamma is PCM
3836  if(((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->UseTrackMultiplicity()){
3837  fBGHandler[fiCut]->AddEvent(fGammaCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),fEventPlaneAngle);
3838  }else { // means we use #V0s for multiplicity
3839  fBGHandler[fiCut]->AddEvent(fGammaCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fGammaCandidates->GetEntries(),fEventPlaneAngle);
3840  }
3841  } else{ //single gamma is EMCAL
3842  if(((AliConversionMesonCuts*)fNeutralPionCutArray->At(fiCut))->UseTrackMultiplicity()){
3843  fBGClusHandler[fiCut]->AddEvent(fClusterCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),fEventPlaneAngle);
3844  }else {
3845  fBGClusHandler[fiCut]->AddEvent(fClusterCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fClusterCandidates->GetEntries(),fEventPlaneAngle);
3846  }
3847  }
3848  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
3849  fBGPi0Handler[fiCut]->AddMesonEvent(fPi0Candidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),0);
3850  }else {
3851  fBGPi0Handler[fiCut]->AddMesonEvent(fPi0Candidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fPi0Candidates->GetEntries(),0);
3852  }
3853  }
3854 }
3855 
3856 //________________________________________________________________________
3858 
3859  // Relabeling For AOD Event
3860  // ESDiD -> AODiD
3861  // MCLabel -> AODMCLabel
3862 
3863  if(mode){
3864  fMCEventPos = new Int_t[fReaderGammas->GetEntries()];
3865  fMCEventNeg = new Int_t[fReaderGammas->GetEntries()];
3866  fESDArrayPos = new Int_t[fReaderGammas->GetEntries()];
3867  fESDArrayNeg = new Int_t[fReaderGammas->GetEntries()];
3868  }
3869 
3870  for(Int_t iGamma = 0;iGamma<fReaderGammas->GetEntries();iGamma++){
3871  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(iGamma);
3872  if(!PhotonCandidate) continue;
3873  if(!mode){// Back to ESD Labels
3874  PhotonCandidate->SetMCLabelPositive(fMCEventPos[iGamma]);
3875  PhotonCandidate->SetMCLabelNegative(fMCEventNeg[iGamma]);
3876  PhotonCandidate->SetLabelPositive(fESDArrayPos[iGamma]);
3877  PhotonCandidate->SetLabelNegative(fESDArrayNeg[iGamma]);
3878  continue;
3879  }
3880  fMCEventPos[iGamma] = PhotonCandidate->GetMCLabelPositive();
3881  fMCEventNeg[iGamma] = PhotonCandidate->GetMCLabelNegative();
3882  fESDArrayPos[iGamma] = PhotonCandidate->GetTrackLabelPositive();
3883  fESDArrayNeg[iGamma] = PhotonCandidate->GetTrackLabelNegative();
3884 
3885  Bool_t AODLabelPos = kFALSE;
3886  Bool_t AODLabelNeg = kFALSE;
3887 
3888  for(Int_t i = 0; i<fInputEvent->GetNumberOfTracks();i++){
3889  AliAODTrack *tempDaughter = static_cast<AliAODTrack*>(fInputEvent->GetTrack(i));
3890  if(!AODLabelPos){
3891  if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelPositive() ){
3892  PhotonCandidate->SetMCLabelPositive(TMath::Abs(tempDaughter->GetLabel()));
3893  PhotonCandidate->SetLabelPositive(i);
3894  AODLabelPos = kTRUE;
3895  }
3896  }
3897  if(!AODLabelNeg){
3898  if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelNegative()){
3899  PhotonCandidate->SetMCLabelNegative(TMath::Abs(tempDaughter->GetLabel()));
3900  PhotonCandidate->SetLabelNegative(i);
3901  AODLabelNeg = kTRUE;
3902  }
3903  }
3904  if(AODLabelNeg && AODLabelPos){
3905  break;
3906  }