AliPhysics  5403132 (5403132)
AliAnalysisTaskGammaConvFlow.cxx
Go to the documentation of this file.
1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: Andrea Dubla, Redmer Alexander Bertens, Friederike Bock *
5 * *
6 * Permission to use, copy, modify and distribute this software and its *
7 * documentation strictly for non-commercial purposes is hereby granted *
8 * without fee, provided that the above copyright notice appears in all *
9 * copies and that both the copyright notice and this permission notice *
10 * appear in the supporting documentation. The authors make no claims *
11 * about the suitability of this software for any purpose. It is *
12 * provided "as is" without express or implied warranty. *
13 **************************************************************************/
14 
16 //---------------------------------------------
17 
18 // Class used to do analysis on conversion pairs
19 //---------------------------------------------
21 #include "TChain.h"
22 #include "TTree.h"
23 #include "TBranch.h"
24 #include "TFile.h"
25 #include "TH1F.h"
26 #include "TH2F.h"
27 #include "TH3F.h"
28 #include "THnSparse.h"
29 #include "TCanvas.h"
30 #include "TNtuple.h"
31 #include "AliAnalysisTask.h"
32 #include "AliAnalysisManager.h"
33 #include "AliESDEvent.h"
34 #include "AliESDInputHandler.h"
35 #include "AliMCEventHandler.h"
36 #include "AliMCEvent.h"
37 #include "AliMCParticle.h"
38 #include "AliCentrality.h"
39 #include "AliESDVZERO.h"
40 #include "AliESDpid.h"
42 #include "AliVParticle.h"
43 #include "AliESDtrack.h"
44 #include "AliESDtrackCuts.h"
45 #include "AliKFVertex.h"
46 #include "AliV0ReaderV1.h"
47 #include "AliGenCocktailEventHeader.h"
49 #include "AliAODMCParticle.h"
50 #include "AliAODMCHeader.h"
51 #include "AliEventplane.h"
52 
53 #include "AliFlowCandidateTrack.h"
54 #include "AliFlowTrackCuts.h"
55 #include "AliFlowEventSimple.h"
56 #include "AliFlowCommonConstants.h"
57 #include "AliFlowEvent.h"
58 #include "AliFlowTrack.h"
59 
60 class AliFlowTrackCuts;
61 
62 using namespace std;
63 
65 
66 //________________________________________________________________________
68 fV0Reader(NULL),
69 fV0ReaderName("V0ReaderV1"),
70 fBGHandler(NULL),
71 fBGHandlerRP(NULL),
72 fInputEvent(NULL),
73 
74 fCutFolder(NULL),
75 fESDList(NULL),
76 fBackList(NULL),
77 fMotherList(NULL),
78 fPhotonDCAList(NULL),
79 fMesonDCAList(NULL),
80 //fTrueList(NULL),
81 //fMCList(NULL),
82 fHeaderNameList(NULL),
83 fOutputContainer(0),
84 fReaderGammas(NULL),
85 fGammaCandidates(NULL),
86 fEventCutArray(NULL),
87 fEventCuts(NULL),
88 fCutArray(NULL),
89 fConversionCuts(NULL),
90 fMesonCutArray(NULL),
91 fMesonCuts(NULL),
92 hESDConvGammaPt(NULL),
93 hInvMassPair(NULL),
94 hLTMPt(NULL),
95 hLTMPt_MC(NULL),
96 hPt_TruePt(NULL),
97 hdPhidRcandidates(NULL),
98 hdPhidRcandidates_MCsigsig(NULL),
99 hdPhidRcandidates_MCbkgsig(NULL),
100 hdPhidRcandidates_MCbkgbkg(NULL),
101 hKappaTPC(NULL),
102 hKappaTPC_after(NULL),
103 hKappaTPC_Temp0(NULL),
104 hKappaTPC_Temp1(NULL),
105 hKappaTPC_Temp2(NULL),
106 hKappaTPC_Temp3(NULL),
107 hKappaTPC_Temp4(NULL),
108 hKappaTPC_Temp5(NULL),
109 hKappaTPC_Temp6(NULL),
110 hKappaTPC_Temp7(NULL),
111 hKappaTPC_Temp8(NULL),
112 hKappaTPC_Temp9(NULL),
113 hKappaTPC_Temp10(NULL),
114 hESDConvGammaR(NULL),
115 hESDConvGammaEta(NULL),
116 //tESDConvGammaPtDcazCat(NULL),
117 fPtGamma(0),
118 fDCAzPhoton(0),
119 fRConvPhoton(0),
120 fEtaPhoton(0),
121 iCatPhoton(0),
122 iPhotonMCInfo(0),
123 hESDMotherInvMassPt(NULL),
124 //sESDMotherInvMassPtZM(NULL),
125 hESDMotherBackInvMassPt(NULL),
126 //sESDMotherBackInvMassPtZM(NULL),
127 hESDMotherInvMassEalpha(NULL),
128 hESDMotherPi0PtY(NULL),
129 hESDMotherEtaPtY(NULL),
130 hESDMotherPi0PtAlpha(NULL),
131 hESDMotherEtaPtAlpha(NULL),
132 hESDMotherPi0PtOpenAngle(NULL),
133 hESDMotherEtaPtOpenAngle(NULL),
134 
135 hNEvents(NULL),
136 hNGoodESDTracks(NULL),
137 hNGammaCandidates(NULL),
138 hNGoodESDTracksVsNGammaCanditates(NULL),
139 hNV0Tracks(NULL),
140 hEtaShift(NULL),
141 tESDMesonsInvMassPtDcazMinDcazMaxFlag(NULL),
142 fInvMass(0),
143 fPt(0),
144 fDCAzGammaMin(0),
145 fDCAzGammaMax(0),
146 iFlag(0),
147 iMesonMCInfo(0),
148 fEventPlaneAngle(-100),
149 fRandom(0),
150 fnGammaCandidates(0),
151 fUnsmearedPx(NULL),
152 fUnsmearedPy(NULL),
153 fUnsmearedPz(NULL),
154 fUnsmearedE(NULL),
155 fMCEventPos(NULL),
156 fMCEventNeg(NULL),
157 fESDArrayPos(NULL),
158 fESDArrayNeg(NULL),
159 fnCuts(0),
160 fiCut(0),
161 fMoveParticleAccordingToVertex(kTRUE),
162 fIsHeavyIon(0),
163 fDoMesonAnalysis(kTRUE),
164 fDoMesonQA(0),
165 fDoPhotonQA(0),
166 fIsFromMBHeader(kTRUE),
167 fhistoEPVZ(NULL),
168 fMinMass(-1),
169 fMaxMass(10),
170 fMinKappa(-1),
171 fMaxKappa(100),
172 fFilterVariable(1),
173 fMinFilter(0),
174 fMaxFilter(0.2),
175 fIsMC(0),
176 fApplydPhidRCut(0),
177 fPerformExtraStudies(0),
178 fMCEvent(NULL),
179 fDebug(0),
180 fCutsRP(0),
181 fNullCuts(0),
182 fFlowEvent(NULL)
183 
184 {
185  // DefineOutput(1, TList::Class());
186  // DefineOutput(2, AliFlowEventSimple::Class());
187 }
188 
189 //________________________________________________________________________
191 AliAnalysisTaskSE(name),
192 fV0Reader(NULL),
193 fV0ReaderName("V0ReaderV1"),
194 fBGHandler(NULL),
195 fBGHandlerRP(NULL),
196 fInputEvent(NULL),
197 fCutFolder(NULL),
198 fESDList(NULL),
199 fBackList(NULL),
200 fMotherList(NULL),
201 fPhotonDCAList(NULL),
202 fMesonDCAList(NULL),
203 //fTrueList(NULL),
204 //fMCList(NULL),
205 fHeaderNameList(NULL),
206 fOutputContainer(0),
207 fReaderGammas(NULL),
208 fGammaCandidates(NULL),
209 fEventCutArray(NULL),
210 fEventCuts(NULL),
211 fCutArray(NULL),
212 fConversionCuts(NULL),
213 fMesonCutArray(NULL),
214 fMesonCuts(NULL),
215 hESDConvGammaPt(NULL),
216 hInvMassPair(NULL),
217 hLTMPt(NULL),
218 hLTMPt_MC(NULL),
219 hPt_TruePt(NULL),
220 hdPhidRcandidates(NULL),
221 hdPhidRcandidates_MCsigsig(NULL),
222 hdPhidRcandidates_MCbkgsig(NULL),
223 hdPhidRcandidates_MCbkgbkg(NULL),
224 hKappaTPC(NULL),
225 hKappaTPC_after(NULL),
226 hKappaTPC_Temp0(NULL),
227 hKappaTPC_Temp1(NULL),
228 hKappaTPC_Temp2(NULL),
229 hKappaTPC_Temp3(NULL),
230 hKappaTPC_Temp4(NULL),
231 hKappaTPC_Temp5(NULL),
232 hKappaTPC_Temp6(NULL),
233 hKappaTPC_Temp7(NULL),
234 hKappaTPC_Temp8(NULL),
235 hKappaTPC_Temp9(NULL),
236 hKappaTPC_Temp10(NULL),
237 hESDConvGammaR(NULL),
238 hESDConvGammaEta(NULL),
239 //tESDConvGammaPtDcazCat(NULL),
240 fPtGamma(0),
241 fDCAzPhoton(0),
242 fRConvPhoton(0),
243 fEtaPhoton(0),
244 iCatPhoton(0),
245 iPhotonMCInfo(0),
246 hESDMotherInvMassPt(NULL),
247 //sESDMotherInvMassPtZM(NULL),
248 hESDMotherBackInvMassPt(NULL),
249 //sESDMotherBackInvMassPtZM(NULL),
250 hESDMotherInvMassEalpha(NULL),
251 hESDMotherPi0PtY(NULL),
252 hESDMotherEtaPtY(NULL),
253 hESDMotherPi0PtAlpha(NULL),
254 hESDMotherEtaPtAlpha(NULL),
255 hESDMotherPi0PtOpenAngle(NULL),
256 hESDMotherEtaPtOpenAngle(NULL),
257 hNEvents(NULL),
258 hNGoodESDTracks(NULL),
259 hNGammaCandidates(NULL),
260 hNGoodESDTracksVsNGammaCanditates(NULL),
261 hNV0Tracks(NULL),
262 hEtaShift(NULL),
263 tESDMesonsInvMassPtDcazMinDcazMaxFlag(NULL),
264 fInvMass(0),
265 fPt(0),
266 fDCAzGammaMin(0),
267 fDCAzGammaMax(0),
268 iFlag(0),
269 iMesonMCInfo(0),
270 fEventPlaneAngle(-100),
271 fRandom(0),
272 fnGammaCandidates(0),
273 fUnsmearedPx(NULL),
274 fUnsmearedPy(NULL),
275 fUnsmearedPz(NULL),
276 fUnsmearedE(NULL),
277 fMCEventPos(NULL),
278 fMCEventNeg(NULL),
279 fESDArrayPos(NULL),
280 fESDArrayNeg(NULL),
281 fnCuts(0),
282 fiCut(0),
283 fMoveParticleAccordingToVertex(kTRUE),
284 fIsHeavyIon(0),
285 fDoMesonAnalysis(kTRUE),
286 fDoMesonQA(0),
287 fDoPhotonQA(0),
288 fIsFromMBHeader(kTRUE),
289 fhistoEPVZ(NULL),
290 fMinMass(-1),
291 fMaxMass(10),
292 fMinKappa(-1),
293 fMaxKappa(100),
294 fFilterVariable(1),
295 fMinFilter(0),
296 fMaxFilter(0.2),
297 fIsMC(0),
298 fApplydPhidRCut(0),
299 fPerformExtraStudies(0),
300 fMCEvent(NULL),
301 fDebug(0),
302 fCutsRP(0),
303 fNullCuts(0),
304 fFlowEvent(NULL)
305 
306 
307 {
308  // Define output slots here
309  DefineOutput(1, TList::Class());
310  DefineOutput(2, AliFlowEventSimple::Class());
311  DefineOutput(3, AliFlowEventSimple::Class());
312  DefineOutput(4, AliFlowEventSimple::Class());
313  DefineOutput(5, AliFlowEventSimple::Class());
314  DefineOutput(6, AliFlowEventSimple::Class());
315 
316 }
317 
318 
319 //________________________________________________________________________
321 AliAnalysisTaskSE(name),
322 fV0Reader(NULL),
323 fV0ReaderName("V0ReaderV1"),
324 fBGHandler(NULL),
325 fBGHandlerRP(NULL),
326 fInputEvent(NULL),
327 fCutFolder(NULL),
328 fESDList(NULL),
329 fBackList(NULL),
330 fMotherList(NULL),
331 fPhotonDCAList(NULL),
332 fMesonDCAList(NULL),
333 //fTrueList(NULL),
334 //fMCList(NULL),
335 fHeaderNameList(NULL),
337 fReaderGammas(NULL),
338 fGammaCandidates(NULL),
339 fEventCutArray(NULL),
340 fEventCuts(NULL),
341 fCutArray(NULL),
342 fConversionCuts(NULL),
343 fMesonCutArray(NULL),
344 fMesonCuts(NULL),
345 hESDConvGammaPt(NULL),
346 hInvMassPair(NULL),
347 hLTMPt(NULL),
348 hLTMPt_MC(NULL),
349 hPt_TruePt(NULL),
350 hdPhidRcandidates(NULL),
354 hKappaTPC(NULL),
355 hKappaTPC_after(NULL),
356 hKappaTPC_Temp0(NULL),
357 hKappaTPC_Temp1(NULL),
358 hKappaTPC_Temp2(NULL),
359 hKappaTPC_Temp3(NULL),
360 hKappaTPC_Temp4(NULL),
361 hKappaTPC_Temp5(NULL),
362 hKappaTPC_Temp6(NULL),
363 hKappaTPC_Temp7(NULL),
364 hKappaTPC_Temp8(NULL),
365 hKappaTPC_Temp9(NULL),
366 hKappaTPC_Temp10(NULL),
367 hESDConvGammaR(NULL),
368 hESDConvGammaEta(NULL),
369 //tESDConvGammaPtDcazCat(NULL),
370 fPtGamma(0),
371 fDCAzPhoton(0),
372 fRConvPhoton(0),
373 fEtaPhoton(0),
374 iCatPhoton(0),
375 iPhotonMCInfo(0),
376 hESDMotherInvMassPt(NULL),
377 //sESDMotherInvMassPtZM(NULL),
379 //sESDMotherBackInvMassPtZM(NULL),
381 hESDMotherPi0PtY(NULL),
382 hESDMotherEtaPtY(NULL),
387 hNEvents(NULL),
388 hNGoodESDTracks(NULL),
389 hNGammaCandidates(NULL),
391 hNV0Tracks(NULL),
392 hEtaShift(NULL),
394 fInvMass(0),
395 fPt(0),
396 fDCAzGammaMin(0),
397 fDCAzGammaMax(0),
398 iFlag(0),
399 iMesonMCInfo(0),
400 fEventPlaneAngle(-100),
401 fRandom(0),
403 fUnsmearedPx(NULL),
404 fUnsmearedPy(NULL),
405 fUnsmearedPz(NULL),
406 fUnsmearedE(NULL),
407 fMCEventPos(NULL),
408 fMCEventNeg(NULL),
409 fESDArrayPos(NULL),
410 fESDArrayNeg(NULL),
411 fnCuts(nCuts),
412 fiCut(0),
414 fIsHeavyIon(0),
415 fDoMesonAnalysis(kTRUE),
416 fDoMesonQA(0),
417 fDoPhotonQA(0),
418 fIsFromMBHeader(kTRUE),
419 fhistoEPVZ(NULL),
420 fMinMass(-1),
421 fMaxMass(10),
422 fMinKappa(-1),
423 fMaxKappa(100),
424 fFilterVariable(1),
425 fMinFilter(0),
426 fMaxFilter(0.2),
427 fIsMC(0),
428 fApplydPhidRCut(0),
430 fMCEvent(NULL),
431 fDebug(0),
432 fCutsRP(0),
433 fNullCuts(0),
434 fFlowEvent(NULL)
435 
436 {
437  // Define output slots here
438  DefineOutput(1, TList::Class());
439  for (Int_t i = 0; i<nCuts; i++){
440  DefineOutput(2+i, AliFlowEventSimple::Class());
441  }
442 
443 }
444 //___________________________________________________________
446 {
447  if(fGammaCandidates){
448  delete fGammaCandidates;
449  fGammaCandidates = 0x0;
450  }
451  if(fBGHandler){
452  delete[] fBGHandler;
453  fBGHandler = 0x0;
454  }
455  if(fBGHandlerRP){
456  delete[] fBGHandlerRP;
457  fBGHandlerRP = 0x0;
458  }
459 
460  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
461  if (fFlowEvent[iCut]) delete fFlowEvent[iCut];
462  }
463 
464 }
465 
466 //________________________________________________________________________
468 
469  // Create histograms
470  if(fOutputContainer != NULL){
471  delete fOutputContainer;
472  fOutputContainer = NULL;
473  }
474  if(fOutputContainer == NULL){
475  fOutputContainer = new TList();
476  fOutputContainer->SetOwner(kTRUE);
477  }
478 
479  //========================= again flow setting==========================
480  //Create histograms
481  //----------hfe initialising begin---------
482  fNullCuts = new AliFlowTrackCuts("null_cuts");
483 
485  cc->SetNbinsMult(10000);
486  cc->SetMultMin(0);
487  cc->SetMultMax(10000);
488 
489  cc->SetNbinsPt(200);
490  cc->SetPtMin(0);
491  cc->SetPtMax(20);
492 
493  cc->SetNbinsPhi(180);
494  cc->SetPhiMin(0.0);
495  cc->SetPhiMax(TMath::TwoPi());
496 
497  cc->SetNbinsEta(40);
498  cc->SetEtaMin(-2.0);
499  cc->SetEtaMax(+2.0);
500 
501  cc->SetNbinsQ(500);
502  cc->SetQMin(0.0);
503  cc->SetQMax(3.0);
504 
505  cc->SetMassMin(fMinFilter);
506  cc->SetMassMax(fMaxFilter);
507  cc->SetNbinsMass(100);
508 
509  // Array of current cut's gammas
510  fGammaCandidates = new TList();
511 
512  fCutFolder = new TList*[fnCuts];
513  fESDList = new TList*[fnCuts];
514  fBackList = new TList*[fnCuts];
515  fMotherList = new TList*[fnCuts];
516  hNEvents = new TH1I*[fnCuts];
517  hNGoodESDTracks = new TH1I*[fnCuts];
518  hNGammaCandidates = new TH1I*[fnCuts];
520  hNV0Tracks = new TH1I*[fnCuts];
521  hEtaShift = new TProfile*[fnCuts];
522  hESDConvGammaPt = new TH1F*[fnCuts];
523  hInvMassPair = new TH2F*[fnCuts];
524  hLTMPt = new TH2F*[fnCuts];
525  hLTMPt_MC = new TH2F*[fnCuts];
526  hPt_TruePt = new TH2F*[fnCuts];
527  hdPhidRcandidates = new TH2F*[fnCuts];
531  hKappaTPC = new TH2F*[fnCuts];
532  hKappaTPC_after = new TH2F*[fnCuts];
533  hKappaTPC_Temp0 = new TH2F*[fnCuts];
534  hKappaTPC_Temp1 = new TH2F*[fnCuts];
535  hKappaTPC_Temp2 = new TH2F*[fnCuts];
536  hKappaTPC_Temp3 = new TH2F*[fnCuts];
537  hKappaTPC_Temp4 = new TH2F*[fnCuts];
538  hKappaTPC_Temp5 = new TH2F*[fnCuts];
539  hKappaTPC_Temp6 = new TH2F*[fnCuts];
540  hKappaTPC_Temp7 = new TH2F*[fnCuts];
541  hKappaTPC_Temp8 = new TH2F*[fnCuts];
542  hKappaTPC_Temp9 = new TH2F*[fnCuts];
543  hKappaTPC_Temp10 = new TH2F*[fnCuts];
544 
545  if (fDoPhotonQA == 2){
546  fPhotonDCAList = new TList*[fnCuts];
547 // tESDConvGammaPtDcazCat = new TTree*[fnCuts];
548  }
549  if (fDoPhotonQA > 0){
550  hESDConvGammaR = new TH1F*[fnCuts];
551  hESDConvGammaEta = new TH1F*[fnCuts];
552  }
553 
554  if(fDoMesonAnalysis){
558  if (fDoMesonQA == 2){
559  fMesonDCAList = new TList*[fnCuts];
561  }
562  if (fDoMesonQA > 0){
563  hESDMotherPi0PtY = new TH2F*[fnCuts];
564  hESDMotherEtaPtY = new TH2F*[fnCuts];
569  }
570  }
571 
572  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
573 
574  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
575  TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
576  TString cutstringMeson = "NoMesonCut";
577  if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
578 
579  fCutFolder[iCut] = new TList();
580  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s",cutstringEvent.Data() ,cutstringPhoton.Data()));
581  fCutFolder[iCut]->SetOwner(kTRUE);
582  fOutputContainer->Add(fCutFolder[iCut]);
583  fESDList[iCut] = new TList();
584  fESDList[iCut]->SetName(Form("%s_%s ESD histograms",cutstringEvent.Data() ,cutstringPhoton.Data()));
585  fESDList[iCut]->SetOwner(kTRUE);
586  fCutFolder[iCut]->Add(fESDList[iCut]);
587 
588  hNEvents[iCut] = new TH1I("NEvents","NEvents",13,-0.5,12.5);
589  hNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
590  hNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
591  hNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
592  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
593  TString TriggerNames = "Not Trigger: ";
594  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
595  hNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
596  } else {
597  hNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
598  }
599  hNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
600  hNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
601  hNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
602  hNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
603  hNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
604  hNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
605  hNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
606  hNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
607  fESDList[iCut]->Add(hNEvents[iCut]);
608 
609  if(fIsHeavyIon == 1) hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
610  else if(fIsHeavyIon == 2) hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",400,0,400);
611  else hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
612  fESDList[iCut]->Add(hNGoodESDTracks[iCut]);
613  if(fIsHeavyIon == 1) hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",100,0,100);
614  else if(fIsHeavyIon == 2) hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
615  else hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
616  fESDList[iCut]->Add(hNGammaCandidates[iCut]);
617  if(fIsHeavyIon == 1) hNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",4000,0,4000,100,0,100);
618  else if(fIsHeavyIon == 2) hNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",400,0,400,50,0,50);
619  else hNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",200,0,200,50,0,50);
621 
622 
623  if(fIsHeavyIon == 1) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
624  else if(fIsHeavyIon == 2) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
625  else hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
626  fESDList[iCut]->Add(hNV0Tracks[iCut]);
627  hEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
628  fESDList[iCut]->Add(hEtaShift[iCut]);
629  hESDConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",250,0,25);
630  fESDList[iCut]->Add(hESDConvGammaPt[iCut]);
631 
632  hInvMassPair[iCut]= new TH2F("InvMassPair_Pt","Gamma invariant mass vs Pt",200,0,0.2,250,0,25);
633  fESDList[iCut]->Add(hInvMassPair[iCut]);
634 
635  hLTMPt[iCut]= new TH2F("LTM_Pt","LTM vs Pt",200,0,200,250,0,25);
636  fESDList[iCut]->Add(hLTMPt[iCut]);
637  hLTMPt_MC[iCut]= new TH2F("LTM_Pt_MCgen","LTM vs Pt (MC)",200,0,200,250,0,25);
638  fESDList[iCut]->Add(hLTMPt_MC[iCut]);
639 
640  hPt_TruePt[iCut]= new TH2F("hPt_TruePt","Pt vs TruePt (MC)",250,0,25,250,0,25);
641  fESDList[iCut]->Add(hPt_TruePt[iCut]);
642  hdPhidRcandidates[iCut]= new TH2F("hdPhidRcandidates","dPhi vs dRconvVtx",400,0,4,300,0,300);
643  fESDList[iCut]->Add(hdPhidRcandidates[iCut]);
644  hdPhidRcandidates_MCsigsig[iCut]= new TH2F("hdPhidRcandidates_MCsigsig","dPhi vs dRconvVtx",400,0,4,300,0,300);
645  fESDList[iCut]->Add(hdPhidRcandidates_MCsigsig[iCut]);
646  hdPhidRcandidates_MCbkgsig[iCut]= new TH2F("hdPhidRcandidates_MCbkgsig","dPhi vs dRconvVtx",400,0,4,300,0,300);
647  fESDList[iCut]->Add(hdPhidRcandidates_MCbkgsig[iCut]);
648  hdPhidRcandidates_MCbkgbkg[iCut]= new TH2F("hdPhidRcandidates_MCbkgbkg","dPhi vs dRconvVtx",400,0,4,300,0,300);
649  fESDList[iCut]->Add(hdPhidRcandidates_MCbkgbkg[iCut]);
650 
651 
652 
653  hKappaTPC[iCut]= new TH2F("KappaTPC_Pt","Gamma KappaTPC vs Pt",200,-20,20,250,0,25);
654  fESDList[iCut]->Add(hKappaTPC[iCut]);
655 
656  hKappaTPC_after[iCut]= new TH2F("KappaTPC_Pt_after","Gamma KappaTPC vs Pt after cuts",200,-20,20,250,0,25);
657  fESDList[iCut]->Add(hKappaTPC_after[iCut]);
658 
659  hKappaTPC_Temp0[iCut]= new TH2F("hKappaTPC_Temp0_ee","Gamma KappaTPC vs Pt Template 0",200,-20,20,250,0,25);
660  fESDList[iCut]->Add(hKappaTPC_Temp0[iCut]);
661 
662  hKappaTPC_Temp1[iCut]= new TH2F("hKappaTPC_Temp1_pipi","Gamma KappaTPC vs Pt Template 1",200,-20,20,250,0,25);
663  fESDList[iCut]->Add(hKappaTPC_Temp1[iCut]);
664 
665  hKappaTPC_Temp2[iCut]= new TH2F("hKappaTPC_Temp2_pie","Gamma KappaTPC vs Pt Template 2",200,-20,20,250,0,25);
666  fESDList[iCut]->Add(hKappaTPC_Temp2[iCut]);
667 
668  hKappaTPC_Temp3[iCut]= new TH2F("hKappaTPC_Temp3_piK","Gamma KappaTPC vs Pt Template 3",200,-20,20,250,0,25);
669  fESDList[iCut]->Add(hKappaTPC_Temp3[iCut]);
670 
671  hKappaTPC_Temp4[iCut]= new TH2F("hKappaTPC_Temp4_pip","Gamma KappaTPC vs Pt Template 4",200,-20,20,250,0,25);
672  fESDList[iCut]->Add(hKappaTPC_Temp4[iCut]);
673 
674  hKappaTPC_Temp5[iCut]= new TH2F("hKappaTPC_Temp5_eK","Gamma KappaTPC vs Pt Template 5",200,-20,20,250,0,25);
675  fESDList[iCut]->Add(hKappaTPC_Temp5[iCut]);
676 
677  hKappaTPC_Temp6[iCut]= new TH2F("hKappaTPC_Temp6_ep","Gamma KappaTPC vs Pt Template 6",200,-20,20,250,0,25);
678  fESDList[iCut]->Add(hKappaTPC_Temp6[iCut]);
679 
680  hKappaTPC_Temp7[iCut]= new TH2F("hKappaTPC_Temp7_KK","Gamma KappaTPC vs Pt Template 7",200,-20,20,250,0,25);
681  fESDList[iCut]->Add(hKappaTPC_Temp7[iCut]);
682 
683  hKappaTPC_Temp8[iCut]= new TH2F("hKappaTPC_Temp8_had","Gamma KappaTPC vs Pt Template 8",200,-20,20,250,0,25);
684  fESDList[iCut]->Add(hKappaTPC_Temp8[iCut]);
685 
686  hKappaTPC_Temp9[iCut]= new TH2F("hKappaTPC_Temp9_rem4","Gamma KappaTPC vs Pt Template 9",200,-20,20,250,0,25);
687  fESDList[iCut]->Add(hKappaTPC_Temp9[iCut]);
688 
689  hKappaTPC_Temp10[iCut]= new TH2F("hKappaTPC_Temp10_rem10","Gamma KappaTPC vs Pt Template 10",200,-20,20,250,0,25);
690  fESDList[iCut]->Add(hKappaTPC_Temp10[iCut]);
691 
692  //2d histogram filling the cut and value - control check for selections
693 
694  if (fDoPhotonQA == 2){
695  fPhotonDCAList[iCut] = new TList();
696  fPhotonDCAList[iCut]->SetName(Form("%s_%s_%s Photon DCA tree",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringMeson.Data()));
697  fPhotonDCAList[iCut]->SetOwner(kTRUE);
698  fCutFolder[iCut]->Add(fPhotonDCAList[iCut]);
699 
700 // tESDConvGammaPtDcazCat[iCut] = new TTree("ESD_ConvGamma_Pt_Dcaz_R_Eta","ESD_ConvGamma_Pt_Dcaz_R_Eta_Cat");
701 // tESDConvGammaPtDcazCat[iCut]->Branch("Pt",&fPtGamma,"fPtGamma/F");
702 // tESDConvGammaPtDcazCat[iCut]->Branch("DcaZPhoton",&fDCAzPhoton,"fDCAzPhoton/F");
703  // tESDConvGammaPtDcazCat[iCut]->Branch("R",&fRConvPhoton,"fRConvPhoton/F");
704  // tESDConvGammaPtDcazCat[iCut]->Branch("Eta",&fEtaPhoton,"fEtaPhoton/F");
705 
706  // tESDConvGammaPtDcazCat[iCut]->Branch("cat",&iCatPhoton,"iCatPhoton/b");
707 
708  // fPhotonDCAList[iCut]->Add(tESDConvGammaPtDcazCat[iCut]);
709  }
710 
711  if (fDoPhotonQA > 0){
712  hESDConvGammaR[iCut] = new TH1F("ESD_ConvGamma_R","ESD_ConvGamma_R",800,0,200);
713  fESDList[iCut]->Add(hESDConvGammaR[iCut]);
714  hESDConvGammaEta[iCut] = new TH1F("ESD_ConvGamma_Eta","ESD_ConvGamma_Eta",2000,-2,2);
715  fESDList[iCut]->Add(hESDConvGammaEta[iCut]);
716  }
717 
718  if(fDoMesonAnalysis){
719  hESDMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",800,0,0.8,250,0,25);
720  fESDList[iCut]->Add(hESDMotherInvMassPt[iCut]);
721  hESDMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt","ESD_Background_InvMass_Pt",800,0,0.8,250,0,25);
722  fESDList[iCut]->Add(hESDMotherBackInvMassPt[iCut]);
723  hESDMotherInvMassEalpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_E_alpha","ESD_Mother_InvMass_vs_E_alpha",800,0,0.8,250,0,25);
724  fESDList[iCut]->Add(hESDMotherInvMassEalpha[iCut]);
725  if (fDoMesonQA == 2){
726  fMesonDCAList[iCut] = new TList();
727  fMesonDCAList[iCut]->SetName(Form("%s_%s_%s Meson DCA tree",cutstringEvent.Data() ,cutstringPhoton.Data(),cutstringMeson.Data()));
728  fMesonDCAList[iCut]->SetOwner(kTRUE);
729  fCutFolder[iCut]->Add(fMesonDCAList[iCut]);
730 
731  tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut] = new TTree("ESD_Mesons_InvMass_Pt_DcazMin_DcazMax_Flag","ESD_Mesons_InvMass_Pt_DcazMin_DcazMax_Flag");
732  tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("InvMass",&fInvMass,"fInvMass/F");
733  tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("Pt",&fPt,"fPt/F");
734  tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("DcaZMin",&fDCAzGammaMin,"fDCAzGammaMin/F");
735  tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("DcaZMax",&fDCAzGammaMax,"fDCAzGammaMax/F");
736 
738 
739  }
740  if (fDoMesonQA > 0 ){
741  hESDMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y","ESD_MotherPi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
743  fESDList[iCut]->Add(hESDMotherPi0PtY[iCut]);
744  hESDMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y","ESD_MotherEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
746  fESDList[iCut]->Add(hESDMotherEtaPtY[iCut]);
747  hESDMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha","ESD_MotherPi0_Pt_Alpha",150,0.03,15.,100,0,1);
749  fESDList[iCut]->Add(hESDMotherPi0PtAlpha[iCut]);
750  hESDMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha","ESD_MotherEta_Pt_Alpha",150,0.03,15.,100,0,1);
752  fESDList[iCut]->Add(hESDMotherEtaPtAlpha[iCut]);
753  hESDMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
755  fESDList[iCut]->Add(hESDMotherPi0PtOpenAngle[iCut]);
756  hESDMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
758  fESDList[iCut]->Add(hESDMotherEtaPtOpenAngle[iCut]);
759  }
760 
761 
762  }
763 
764 
765  }
766 // if(fDoMesonAnalysis){
767 // InitBack(); // Init Background Handler
768 // }
769 
770 
771 
772  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
773  if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
774 
775  if(fV0Reader)
777  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
778  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
779 
780  if(fV0Reader)
782  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
783  fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
784 
785  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
786  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
787  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
788  fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
789  }
790  if(!((AliConversionPhotonCuts*)fCutArray->At(iCut))) continue;
791  if(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms()){
792  fCutFolder[iCut]->Add(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms());
793  }
794  if(fDoMesonAnalysis){
795  if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
796  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
797  fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
798  }
799  }
800  }
801 
802  fhistoEPVZ = new TH1D("EPVZ", "EPVZ", 60, -TMath::Pi()/2, TMath::Pi()/2);
804 
805 
806 
807  PostData(1, fOutputContainer);
808 
810 
811  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
812  fFlowEvent[iCut] = new AliFlowEvent(10000);
813  if (fIsHeavyIon == 1){
814  PostData(2+iCut, fFlowEvent[iCut]);
815  }
816  }
817 }
818 
819 //_____________________________________________________________________________
821 {
822  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
823  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
824  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
825  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
826  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
827  }
828 
829  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
830  hEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
831  continue; // No Eta Shift requested, continue
832  }
833  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
834  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
835  hEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
836  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
837  continue;
838  }
839  else{
840  printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
841  (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
842  hEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
843  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
844  }
845  }
846  return kTRUE;
847 }
848 //_____________________________________________________________________________
850 {
851  //
852  // Called for each event
853  //
854  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
855  if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1
856  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
857  hNEvents[iCut]->Fill(eventQuality);
858  }
859  return;
860  }
861 
862  fInputEvent = InputEvent();
863  if(fIsMC) fMCEvent = MCEvent();
864 
865  fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
866 
867  // ------------------- BeginEvent ----------------------------
868 
869  AliEventplane *EventPlane = fInputEvent->GetEventplane();
870  if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
871  else fEventPlaneAngle=0.0;
872 
874 
875  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
876 // cout << "event cut array = " << fEventCutArray->At(iCut) << endl;
877  PrepareFlowEvent(fInputEvent->GetNumberOfTracks(),fFlowEvent[iCut]); //Calculate event plane Qvector and EP resolution for inclusive
878 // Int_t iCut = 0;
879  fiCut = iCut;
880  Int_t eventNotAccepted =
881  ((AliConvEventCuts*)fEventCutArray->At(iCut))
882  ->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,kFALSE);
883  if(eventNotAccepted){
884  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
885  hNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
886  continue;
887  }
888 
889  if(eventQuality != 0){// Event Not Accepted
890  // cout << "event rejected due to: " <<eventQuality << endl;
891  hNEvents[iCut]->Fill(eventQuality);
892  continue;
893  }
894 
895  hNEvents[iCut]->Fill(eventQuality); // Should be 0 here
897  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) hNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A());
898  else hNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
899 
900  ProcessPhotonCandidates(); // Process this cuts gammas
901  ProcessPhotonCandidatesforV2(); // Process this cuts gammas and do v2
902 
904  ProcessPhotonCandidatesforLTM(); // calculate the Local Track Multiplicity in a jet cone around the candidates
905  GetdPhidRtoCandidate(); // calculate the distances to other conversions in the event for each selected candidate
906  }
907 
908  hNGammaCandidates[iCut]->Fill(fGammaCandidates->GetEntries());
910  if (fIsHeavyIon == 1){
911  PostData(2+iCut, fFlowEvent[iCut]);
912  }
913  fGammaCandidates->Clear(); // delete this cuts good gammas
914  }
915 
917 
918  PostData(1, fOutputContainer);
919 
920 
921 }
922 //________________________________________________________________________
924 {
925  Int_t nV0 = 0;
926  TList *GammaCandidatesStepOne = new TList();
927  TList *GammaCandidatesStepTwo = new TList();
928  Int_t PhotonTemplateID;
929  // Loop over Photon Candidates allocated by ReaderV1
930  for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
931  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
932  if(!PhotonCandidate) continue;
933  fIsFromMBHeader = kTRUE;
934 
935  hKappaTPC[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
936  if (PhotonCandidate->GetInvMassPair() < fMinMass || PhotonCandidate->GetInvMassPair() > fMaxMass) continue;
937  if (((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent) < fMinKappa || ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent) > fMaxKappa) continue;
938  if(fApplydPhidRCut==1){ if(GetdPhidRtoCandidate(PhotonCandidate,i)==1) continue; }
939  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fInputEvent)) continue;
940  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(PhotonCandidate->GetPhotonPhi(),fEventPlaneAngle)) continue;
941  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
942  !((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
943  fGammaCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
944 // cout << "IS IT MC? " << fIsMC << endl;
945  if(fIsMC){
946  PhotonTemplateID = GetTemplateID(PhotonCandidate);
947  if(PhotonTemplateID == 0) hKappaTPC_Temp0[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
948  if(PhotonTemplateID == 1) hKappaTPC_Temp1[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
949  if(PhotonTemplateID == 2) hKappaTPC_Temp2[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
950  if(PhotonTemplateID == 3) hKappaTPC_Temp3[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
951  if(PhotonTemplateID == 4) hKappaTPC_Temp4[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
952  if(PhotonTemplateID == 5) hKappaTPC_Temp5[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
953  if(PhotonTemplateID == 6) hKappaTPC_Temp6[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
954  if(PhotonTemplateID == 7) hKappaTPC_Temp7[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
955  if(PhotonTemplateID == 8) hKappaTPC_Temp8[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
956  if(PhotonTemplateID != 0 && PhotonTemplateID != 1 && PhotonTemplateID != 2) hKappaTPC_Temp9[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
957  if(PhotonTemplateID != 0 && PhotonTemplateID != 1 && PhotonTemplateID != 2 &&
958  PhotonTemplateID != 3 && PhotonTemplateID != 4 && PhotonTemplateID != 5 &&
959  PhotonTemplateID != 6 && PhotonTemplateID != 7 && PhotonTemplateID != 8) hKappaTPC_Temp10[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
960 
961  TParticle *TRUEPhoton = PhotonCandidate->GetMCParticle(fMCEvent);
962  if(TRUEPhoton) hPt_TruePt[fiCut]->Fill(PhotonCandidate->Pt(),TRUEPhoton->Pt());
963  }
964 
965  if(fIsFromMBHeader){
966  hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
967  hInvMassPair[fiCut]->Fill(PhotonCandidate->GetInvMassPair(),PhotonCandidate->Pt());
968  hKappaTPC_after[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
969  if (fDoPhotonQA > 0){
970  hESDConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
971  hESDConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
972  }
973  }
974 
975 
976  if (fIsFromMBHeader && fDoPhotonQA == 2){
977  if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
978  fPtGamma = PhotonCandidate->Pt();
979  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
980  fRConvPhoton = PhotonCandidate->GetConversionRadius();
981  fEtaPhoton = PhotonCandidate->GetPhotonEta();
982  iCatPhoton = PhotonCandidate->GetPhotonQuality();
983  // tESDConvGammaPtDcazCat[fiCut]->Fill();
984  } else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
985  fPtGamma = PhotonCandidate->Pt();
986  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
987  fRConvPhoton = PhotonCandidate->GetConversionRadius();
988  fEtaPhoton = PhotonCandidate->GetPhotonEta();
989  iCatPhoton = PhotonCandidate->GetPhotonQuality();
990  // tESDConvGammaPtDcazCat[fiCut]->Fill();
991  }
992  }
993  } else if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
994  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
995  nV0++;
996  GammaCandidatesStepOne->Add(PhotonCandidate);
997  } else if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
998  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
999  GammaCandidatesStepTwo->Add(PhotonCandidate);
1000  }
1001  }
1002 
1003 
1004 
1005  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){
1006  for(Int_t i = 0;i<GammaCandidatesStepOne->GetEntries();i++){
1007  AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GammaCandidatesStepOne->At(i);
1008  if(!PhotonCandidate) continue;
1009  fIsFromMBHeader = kTRUE;
1010 
1011  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GammaCandidatesStepOne->GetEntries())) continue;
1012  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
1013  fGammaCandidates->Add(PhotonCandidate);
1014  if(fIsFromMBHeader){
1015  hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1016  hInvMassPair[fiCut]->Fill(PhotonCandidate->GetInvMassPair(),PhotonCandidate->Pt());
1017  hKappaTPC_after[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
1018  if (fDoPhotonQA > 0){
1019  hESDConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
1020  hESDConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1021  }
1022  }
1023  }
1024 
1025 
1026  GammaCandidatesStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
1027 
1028  if (fIsFromMBHeader && fDoPhotonQA == 2){
1029  if (fIsHeavyIon ==1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
1030  fPtGamma = PhotonCandidate->Pt();
1031  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1032  fRConvPhoton = PhotonCandidate->GetConversionRadius();
1033  fEtaPhoton = PhotonCandidate->GetPhotonEta();
1034  iCatPhoton = PhotonCandidate->GetPhotonQuality();
1035  // tESDConvGammaPtDcazCat[fiCut]->Fill();
1036  } else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
1037  fPtGamma = PhotonCandidate->Pt();
1038  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1039  fRConvPhoton = PhotonCandidate->GetConversionRadius();
1040  fEtaPhoton = PhotonCandidate->GetPhotonEta();
1041  iCatPhoton = PhotonCandidate->GetPhotonQuality();
1042  // tESDConvGammaPtDcazCat[fiCut]->Fill();
1043  }
1044  }
1045  }
1046  }
1047  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
1048  for(Int_t i = 0;i<GammaCandidatesStepTwo->GetEntries();i++){
1049  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GammaCandidatesStepTwo->At(i);
1050  if(!PhotonCandidate) continue;
1051  fIsFromMBHeader = kTRUE;
1052 
1053  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GammaCandidatesStepTwo,i)) continue;
1054  fGammaCandidates->Add(PhotonCandidate); // Add gamma to current cut TList
1055  if(fIsFromMBHeader){
1056  hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1057  hInvMassPair[fiCut]->Fill(PhotonCandidate->GetInvMassPair(),PhotonCandidate->Pt());
1058  hKappaTPC_after[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
1059  if (fDoPhotonQA > 0){
1060  hESDConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
1061  hESDConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1062  }
1063  }
1064 
1065  if (fIsFromMBHeader){
1066  if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
1067  fPtGamma = PhotonCandidate->Pt();
1068  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1069  fRConvPhoton = PhotonCandidate->GetConversionRadius();
1070  fEtaPhoton = PhotonCandidate->GetPhotonEta();
1071  iCatPhoton = PhotonCandidate->GetPhotonQuality();
1072  // tESDConvGammaPtDcazCat[fiCut]->Fill();
1073  } else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
1074  fPtGamma = PhotonCandidate->Pt();
1075  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1076  fRConvPhoton = PhotonCandidate->GetConversionRadius();
1077  fEtaPhoton = PhotonCandidate->GetPhotonEta();
1078  iCatPhoton = PhotonCandidate->GetPhotonQuality();
1079  // tESDConvGammaPtDcazCat[fiCut]->Fill();
1080  }
1081  }
1082  }
1083  }
1084 
1085  delete GammaCandidatesStepOne;
1086  GammaCandidatesStepOne = 0x0;
1087  delete GammaCandidatesStepTwo;
1088  GammaCandidatesStepTwo = 0x0;
1089 
1090 }
1091 //________________________________________________________________________
1093  //see header file for documentation
1094  if(fGammaCandidates->GetEntries() >0 ){
1095  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
1096  fBGHandler[fiCut]->AddEvent(fGammaCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),fEventPlaneAngle);
1097  }
1098  else{ // means we use #V0s for multiplicity
1099  fBGHandler[fiCut]->AddEvent(fGammaCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fGammaCandidates->GetEntries(),fEventPlaneAngle);
1100  }
1101  }
1102 }
1103 //________________________________________________________________________
1105  TAxis *axisafter = histoRebin->GetXaxis();
1106  Int_t bins = axisafter->GetNbins();
1107  Double_t from = axisafter->GetXmin();
1108  Double_t to = axisafter->GetXmax();
1109  Double_t *newbins = new Double_t[bins+1];
1110  newbins[0] = from;
1111  Double_t factor = TMath::Power(to/from, 1./bins);
1112  for(Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
1113  axisafter->Set(bins, newbins);
1114  delete [] newbins;
1115 }
1116 
1117 //________________________________________________________________________
1119 {
1120 
1121  //fOutputContainer->Print(); // Will crash on GRID
1122 }
1123 
1124 //________________________________________________________________________
1126 {
1127 
1128  // Loop over Photon Candidates allocated by ReaderV1
1129 // cout << "number of gamma's: " << fGammaCandidates->GetEntries() << endl;
1130  for(Int_t i = 0; i < fGammaCandidates->GetEntries(); i++){
1131 
1132  AliAODConversionPhoton *gammaForv2=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(i));
1133  if (gammaForv2 == NULL) return;
1134  AliFlowTrack *sTrack = new AliFlowTrack();
1135  sTrack->SetForRPSelection(kFALSE);
1136  sTrack->SetForPOISelection(kTRUE);
1137 
1138  if(fFilterVariable==1){//using mass for POI selections
1139  sTrack->SetMass(gammaForv2->GetInvMassPair());
1140  }else if(fFilterVariable==2){//using Kappa for POI selections
1141  sTrack->SetMass(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(gammaForv2,fInputEvent));
1142  }else if(fFilterVariable==3 && fIsMC){//MC ElectronElectron + mass
1143  if(!MCElectronElectron(gammaForv2)) return;
1144  sTrack->SetMass(gammaForv2->GetInvMassPair());
1145  }else if(fFilterVariable==4 && fIsMC){//MC ElectronElectron + kappa
1146  if(!MCElectronElectron(gammaForv2)) return;
1147  sTrack->SetMass(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(gammaForv2,fInputEvent));
1148  }else if(fFilterVariable==5 && fIsMC){//MC Not ElectronElectron + mass
1149  if(MCElectronElectron(gammaForv2)) return;
1150  sTrack->SetMass(gammaForv2->GetInvMassPair());
1151  }else if(fFilterVariable==6 && fIsMC){//MC Not ElectronElectron + kappa
1152  if(MCElectronElectron(gammaForv2)) return;
1153  sTrack->SetMass(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(gammaForv2,fInputEvent));
1154  }else{//no additional POI selection
1155  sTrack->SetMass(123456);
1156  }
1157  sTrack->SetPt(gammaForv2->Pt());
1158  sTrack->SetPhi(gammaForv2->GetPhotonPhi());
1159  sTrack->SetEta(gammaForv2->GetPhotonEta());
1160 
1161  /* for(int iRPs=0; iRPs!=fFlowEvent->NumberOfTracks(); ++iRPs)
1162  {
1163  // cout << " no of rps " << iRPs << endl;
1164  AliFlowTrack *iRP = dynamic_cast<AliFlowTrack*>(fFlowEvent->GetTrack( iRPs ));
1165  if (!iRP) continue;
1166  if (!iRP->InRPSelection()) continue;
1167  if( sTrack->GetID() == iRP->GetID())
1168  {
1169  if(fDebug) printf(" was in RP set");
1170  // cout << sTrack->GetID() <<" == " << iRP->GetID() << " was in RP set====REMOVED" <<endl;
1171  iRP->SetForRPSelection(kFALSE);
1172  // fFlowEvent->SetNumberOfRPs(fFlowEvent->GetNumberOfRPs() - 1);
1173  }
1174  } //end of for loop on RPs*/
1175  fFlowEvent[fiCut]->InsertTrack(((AliFlowTrack*) sTrack));
1176  fFlowEvent[fiCut]->SetNumberOfPOIs(fFlowEvent[fiCut]->GetNumberOfPOIs()+1);
1177 // cout << "cutnumber: " << fiCut << " nPoi " << fFlowEvent[fiCut]->GetNumberOfPOIs() << " ntracks " << fFlowEvent[fiCut]->NumberOfTracks() << endl;
1178  }
1179 }
1180 //________________________________________________________________________
1182 {
1183 
1184  Float_t gamma_Eta = 0;
1185  Float_t gamma_Phi = 0;
1186  Float_t gamma_Pt = 0;
1187 
1188  Float_t LTMpart_Eta = 0;
1189  Float_t LTMpart_Phi = 0;
1190  Float_t LTMpart_Pt = 0;
1191 
1192  Float_t dPhi = 0;
1193 
1194  Float_t nCloseByTracks = 0;
1195 
1196  if(fIsMC){
1197  // Loop over Photon Candidates allocated by MCstack
1198  for(Int_t i = 0; i < fMCEvent->GetNumberOfPrimaries(); i++){
1199  TParticle* gammaForLTM = (TParticle *)fMCEvent->Particle(i);
1200  if(!gammaForLTM) return;
1201  if(!MCConversionPhotonCheck(gammaForLTM)) continue;
1202  gamma_Eta = gammaForLTM->Eta(); gamma_Phi = gammaForLTM->Phi(); gamma_Pt = gammaForLTM->Pt();
1203  if( gamma_Eta > 0.9 || gamma_Eta < -0.9 ) continue;
1204  if(gamma_Eta==0 || gamma_Phi==0 || gamma_Pt==0)continue;
1205  nCloseByTracks = 0;
1206  for(Int_t j = 0; j < fInputEvent->GetNumberOfTracks(); j++){
1207  AliVParticle *LTMpart = fInputEvent->GetTrack(j);
1208  if (LTMpart == NULL) return;
1209  LTMpart_Eta = LTMpart->Eta(); LTMpart_Phi = LTMpart->Phi(); LTMpart_Pt = LTMpart->Pt();
1210  if(LTMpart_Eta==0 || LTMpart_Phi==0 || LTMpart_Pt==0)continue;
1211  dPhi = TMath::Abs(LTMpart_Phi-gamma_Phi);
1212  if(dPhi > TMath::Pi()) dPhi = TMath::Abs(dPhi-2.0*TMath::Pi());
1213  if(TMath::Sqrt(pow((LTMpart_Eta-gamma_Eta),2)+pow(dPhi,2))<0.2) nCloseByTracks+=1;
1214  }
1215 // cout << "nCloseByTracks MCgen= " << nCloseByTracks << " with pt= " << gamma_Pt << endl;
1216  hLTMPt_MC[fiCut]->Fill(nCloseByTracks,gamma_Pt);
1217  }
1218  }
1219  // Loop over Photon Candidates allocated by ReaderV1
1220  for(Int_t i = 0; i < fGammaCandidates->GetEntries(); i++){
1221  AliAODConversionPhoton *gammaForLTM=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(i));
1222  if(!gammaForLTM) return;
1223  gamma_Eta = gammaForLTM->GetPhotonEta(); gamma_Phi = gammaForLTM->GetPhotonPhi(); gamma_Pt = gammaForLTM->GetPhotonPt();
1224  if(gamma_Eta==0 || gamma_Phi==0 || gamma_Pt==0)continue;
1225  nCloseByTracks = 0;
1226  for(Int_t j = 0; j < fInputEvent->GetNumberOfTracks(); j++){
1227  AliVParticle *LTMpart = fInputEvent->GetTrack(j);
1228  if (LTMpart == NULL) return;
1229  LTMpart_Eta = LTMpart->Eta(); LTMpart_Phi = LTMpart->Phi(); LTMpart_Pt = LTMpart->Pt();
1230  if(LTMpart_Eta==0 || LTMpart_Phi==0 || LTMpart_Pt==0)continue;
1231  dPhi = TMath::Abs(LTMpart_Phi-gamma_Phi);
1232  if(dPhi > TMath::Pi()) dPhi = TMath::Abs(dPhi-2.0*TMath::Pi());
1233  if(TMath::Sqrt(pow((LTMpart_Eta-gamma_Eta),2)+pow(dPhi,2))<0.2) nCloseByTracks+=1;
1234  }
1235 // cout << "nCloseByTracks= " << nCloseByTracks << " with pt= " << gamma_Pt << endl;
1236  hLTMPt[fiCut]->Fill(nCloseByTracks,gamma_Pt);
1237  }
1238 }
1239 
1240 //_____________________________________________________________________________
1241 template <typename T> void AliAnalysisTaskGammaConvFlow::SetNullCuts(T* event)
1242 {
1243  // Set null cuts
1244  if (fDebug) cout << " fCutsRP " << fCutsRP << endl;
1245  fCutsRP->SetEvent(event, MCEvent());
1247  fNullCuts->SetPtRange(+1, -1); // select nothing QUICK
1248  fNullCuts->SetEtaRange(+1, -1); // select nothing VZERO
1249  fNullCuts->SetEvent(event, MCEvent());
1250 }
1251 
1252 //_____________________________________________________________________________
1254 {
1255  //Prepare flow events
1256  FlowEv->ClearFast();
1257  FlowEv->Fill(fCutsRP, fNullCuts);
1258  FlowEv->SetReferenceMultiplicity(iMulti);
1259  FlowEv->DefineDeadZone(0, 0, 0, 0);
1260  // FlowEv->TagSubeventsInEta(-0.7, 0, 0, 0.7);
1261 }
1262 //_____________________________________________________________________________
1264 
1265 
1266  TParticle *posDaughter = MCPhoton->GetPositiveMCDaughter(fMCEvent);
1267  TParticle *negDaughter = MCPhoton->GetNegativeMCDaughter(fMCEvent);
1268  if(posDaughter==NULL || negDaughter==NULL) return kFALSE;
1269  Int_t pdgCodePos = 0;
1270  Int_t pdgCodeNeg = 0;
1271  Bool_t IsItGammaSignal = kFALSE;
1272 
1273  if( (posDaughter->GetMother(0) == negDaughter->GetMother(0)) ) {
1274  pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
1275  pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
1276  if(pdgCodePos==11 && pdgCodeNeg==11) IsItGammaSignal = kTRUE;
1277  }else{
1278  IsItGammaSignal = kFALSE;
1279  }
1280 
1281  return IsItGammaSignal;
1282 
1283 }
1284 //_____________________________________________________________________________
1286 
1287 
1288  TParticle *posDaughter = MCPhoton->GetPositiveMCDaughter(fMCEvent);
1289  TParticle *negDaughter = MCPhoton->GetNegativeMCDaughter(fMCEvent);
1290  if(posDaughter==NULL || negDaughter==NULL) return kFALSE;
1291  Int_t pdgCodePos = 0;
1292  Int_t pdgCodeNeg = 0;
1293  Bool_t IsItElectronElectron = kFALSE;
1294 
1295  if( (posDaughter->GetMother(0) != negDaughter->GetMother(0)) || (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1) ) {
1296  pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
1297  pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
1298  if(pdgCodePos==11 && pdgCodeNeg==11) IsItElectronElectron = kTRUE;
1299  }else{
1300  IsItElectronElectron = kFALSE;
1301  }
1302 
1303  return IsItElectronElectron;
1304 
1305 }
1306 //_____________________________________________________________________________
1308 
1309  if(MCPhoton->GetPdgCode()!=22) return kFALSE;
1310  if(MCPhoton->GetNDaughters() != 2) return kFALSE;
1311  TParticle *posDaughter = (TParticle*)fMCEvent->Particle(MCPhoton->GetFirstDaughter());
1312  TParticle *negDaughter = (TParticle*)fMCEvent->Particle(MCPhoton->GetLastDaughter());
1313  if(posDaughter==NULL || negDaughter==NULL) return kFALSE;
1314  if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() != 5) return kFALSE;
1315  Int_t pdgCodePos = 0;
1316  Int_t pdgCodeNeg = 0;
1317  Bool_t IsItPhoton = kFALSE;
1318 
1319  if(posDaughter->GetMother(0) == negDaughter->GetMother(0)) {
1320  pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
1321  pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
1322  if(pdgCodePos==11 && pdgCodeNeg==11) IsItPhoton = kTRUE;
1323  }else{
1324  IsItPhoton = kFALSE;
1325  }
1326 
1327  return IsItPhoton;
1328 
1329 }
1330 //_____________________________________________________________________________
1332 
1333 
1334  TParticle *posDaughter = MCPhoton->GetPositiveMCDaughter(fMCEvent);
1335  TParticle *negDaughter = MCPhoton->GetNegativeMCDaughter(fMCEvent);
1336  if(posDaughter==NULL || negDaughter==NULL) return kFALSE;
1337 
1338  Int_t pdgCodePos = 0;
1339  Int_t pdgCodeNeg = 0;
1340  Int_t TemplateID = -1;
1341 
1342  pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
1343  pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
1344 
1345  if(pdgCodePos==11 && pdgCodeNeg==11) TemplateID = 0; //signal -> e+ e-
1346  if(pdgCodePos==211 && pdgCodeNeg==211) TemplateID = 1; //pi pi 211 211
1347  if((pdgCodePos==211 && pdgCodeNeg==11) || (pdgCodePos==11 && pdgCodeNeg==211)) TemplateID = 2; //pi e 211 11
1348  if((pdgCodePos==211 && pdgCodeNeg==321) || (pdgCodePos==321 && pdgCodeNeg==211)) TemplateID = 3; //pi K 211 321
1349  if((pdgCodePos==211 && pdgCodeNeg==2212) || (pdgCodePos==2212 && pdgCodeNeg==211))TemplateID = 4; //pi p 211 2212
1350  if((pdgCodePos==11 && pdgCodeNeg==321) || (pdgCodePos==321 && pdgCodeNeg==11)) TemplateID = 5; //e K 11 321
1351  if((pdgCodePos==11 && pdgCodeNeg==2212) || (pdgCodePos==2212 && pdgCodeNeg==11)) TemplateID = 6; //e p 11 2212
1352  if(pdgCodePos==321 && pdgCodeNeg==321) TemplateID = 7; //K K 321 321
1353  if(pdgCodePos!=11 && pdgCodeNeg!=11 && TemplateID == -1) TemplateID = 8; //hadronic not 11 11
1354 
1355 // cout << "TEMPLATE ID IS: " << TemplateID << endl;
1356  return TemplateID;
1357 
1358 }
1359 //_____________________________________________________________________________
1361 
1362  Float_t gamma1_Eta = 0; Float_t gamma1_Phi = 0; Float_t gamma1_Pt = 0;
1363  Float_t gamma2_Eta = 0; Float_t gamma2_Phi = 0; Float_t gamma2_Pt = 0;
1364 
1365  Float_t dPhi = 0; Float_t dRconvVtx = 0;
1366 
1367  Float_t gamma1_Vtx_x = 0; Float_t gamma1_Vtx_y = 0; Float_t gamma1_Vtx_z = 0;
1368  Float_t gamma2_Vtx_x = 0; Float_t gamma2_Vtx_y = 0; Float_t gamma2_Vtx_z = 0;
1369 
1370  for(Int_t i = 0; i < fGammaCandidates->GetEntries(); i++){
1371  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(i));
1372  if(!gamma1) return;
1373  gamma1_Eta = gamma1->GetPhotonEta(); gamma1_Phi = gamma1->GetPhotonPhi(); gamma1_Pt = gamma1->GetPhotonPt();
1374  if(gamma1_Eta==0 || gamma1_Phi==0 || gamma1_Pt==0)continue;
1375  gamma1_Vtx_x = gamma1->GetConversionX(); gamma1_Vtx_y = gamma1->GetConversionY(); gamma1_Vtx_z = gamma1->GetConversionZ();
1376  for(Int_t j = i+1; j < fGammaCandidates->GetEntries(); j++){
1377  AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(j));
1378  if(!gamma2) continue;
1379  gamma2_Eta = gamma2->GetPhotonEta(); gamma2_Phi = gamma2->GetPhotonPhi(); gamma2_Pt = gamma2->GetPhotonPt();
1380  if(gamma2_Eta==0 || gamma2_Phi==0 || gamma2_Pt==0)continue;
1381  gamma2_Vtx_x = gamma2->GetConversionX(); gamma2_Vtx_y = gamma2->GetConversionY(); gamma2_Vtx_z = gamma2->GetConversionZ();
1382  dPhi = TMath::Abs(gamma2_Phi-gamma1_Phi);
1383  if(dPhi > TMath::Pi()) dPhi = TMath::Abs(dPhi-2.0*TMath::Pi());
1384  dRconvVtx = TMath::Sqrt(pow(gamma2_Vtx_x-gamma1_Vtx_x,2)+pow(gamma2_Vtx_y-gamma1_Vtx_y,2)+pow(gamma2_Vtx_z-gamma1_Vtx_z,2));
1385  hdPhidRcandidates[fiCut]->Fill(dPhi,dRconvVtx);
1386  if(fIsMC){
1387  // gamma1 = signal, gamma2 = signal => sigsig
1388  if( MCGammaSignal(gamma1) && MCGammaSignal(gamma2) ) hdPhidRcandidates_MCsigsig[fiCut]->Fill(dPhi,dRconvVtx);
1389  // gamma1 = bkg, gamma2 = signal => bkgsig
1390  if( (MCElectronElectron(gamma1) && MCGammaSignal(gamma2)) || (MCElectronElectron(gamma2) && MCGammaSignal(gamma1)) ) hdPhidRcandidates_MCbkgsig[fiCut]->Fill(dPhi,dRconvVtx);
1391  // gamma1 = bkg, gamma2 = bkg => bkgbkg
1392  if( MCElectronElectron(gamma1) && MCElectronElectron(gamma2) ) hdPhidRcandidates_MCbkgbkg[fiCut]->Fill(dPhi,dRconvVtx);
1393  }
1394  }
1395  }
1396 }
1397 //_____________________________________________________________________________
1399 
1400  Float_t gamma1_Eta = 0; Float_t gamma1_Phi = 0; Float_t gamma1_Pt = 0;
1401  Float_t gamma2_Eta = 0; Float_t gamma2_Phi = 0; Float_t gamma2_Pt = 0;
1402 
1403  Float_t dPhi = 0; Float_t dRconvVtx = 0;
1404 
1405  Float_t gamma1_Vtx_x = 0; Float_t gamma1_Vtx_y = 0; Float_t gamma1_Vtx_z = 0;
1406  Float_t gamma2_Vtx_x = 0; Float_t gamma2_Vtx_y = 0; Float_t gamma2_Vtx_z = 0;
1407 
1408  if(!gamma) return -1;
1409  gamma1_Eta = gamma->GetPhotonEta(); gamma1_Phi = gamma->GetPhotonPhi(); gamma1_Pt = gamma->GetPhotonPt();
1410  if(gamma1_Eta==0 || gamma1_Phi==0 || gamma1_Pt==0) return -1;
1411  gamma1_Vtx_x = gamma->GetConversionX(); gamma1_Vtx_y = gamma->GetConversionY(); gamma1_Vtx_z = gamma->GetConversionZ();
1412  for(Int_t i = 0; i < fReaderGammas->GetEntries(); i++){
1413  if(i==PhotonID) continue;
1414  AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fReaderGammas->At(i));
1415  if(!gamma2) continue;
1416  gamma2_Eta = gamma2->GetPhotonEta(); gamma2_Phi = gamma2->GetPhotonPhi(); gamma2_Pt = gamma2->GetPhotonPt();
1417  if(gamma2_Eta==0 || gamma2_Phi==0 || gamma2_Pt==0)continue;
1418  gamma2_Vtx_x = gamma2->GetConversionX(); gamma2_Vtx_y = gamma2->GetConversionY(); gamma2_Vtx_z = gamma2->GetConversionZ();
1419  dPhi = TMath::Abs(gamma2_Phi-gamma1_Phi);
1420  if(dPhi > TMath::Pi()) dPhi = TMath::Abs(dPhi-2.0*TMath::Pi());
1421  dRconvVtx = TMath::Sqrt(pow(gamma2_Vtx_x-gamma1_Vtx_x,2)+pow(gamma2_Vtx_y-gamma1_Vtx_y,2)+pow(gamma2_Vtx_z-gamma1_Vtx_z,2));
1422  if(dPhi < 0.04 && dRconvVtx < 7.5) return 1;
1423  }
1424  return 0;
1425 }
TParticle * GetMCParticle(AliMCEvent *mcEvent)
virtual Double_t GetPhotonPhi() const
const Color_t cc[]
Definition: DrawKs.C:1
double Double_t
Definition: External.C:58
void SetEta(Double_t eta)
Definition: External.C:236
AliConversionPhotonCuts * fConversionCuts
Bool_t MCElectronElectron(AliAODConversionPhoton *MCPhoton)
flow events Inclusive e
AliGammaConversionAODBGHandler ** fBGHandler
Bool_t MCConversionPhotonCheck(TParticle *MCPhoton)
Int_t GetNumberOfPrimaryTracks()
Float_t GetDCAzToPrimVtx() const
TString GetPeriodName()
void SetMass(Double_t mass)
TParticle * GetPositiveMCDaughter(AliMCEvent *mcEvent)
void SetParamType(trackParameterType paramType)
void SetReferenceMultiplicity(Int_t m)
UShort_t T(UShort_t m, UShort_t t)
Definition: RingBits.C:60
void SetForRPSelection(Bool_t b=kTRUE)
TParticle * GetNegativeMCDaughter(AliMCEvent *mcEvent)
void SetPtRange(Float_t r1, Float_t r2)
void Fill(AliFlowTrackCuts *rpCuts, AliFlowTrackCuts *poiCuts)
AliConversionAODBGHandlerRP ** fBGHandlerRP
int Int_t
Definition: External.C:63
Definition: External.C:204
float Float_t
Definition: External.C:68
void AddEvent(TList *const eventGammas, Double_t xvalue, Double_t yvalue, Double_t zvalue, Int_t multiplicity, Double_t epvalue=-100)
void SetNumberOfPOIs(Int_t nubmerOfPOIs, Int_t poiType=1)
AliConversionPhotonCuts * GetConversionCuts()
Definition: AliV0ReaderV1.h:89
virtual void Terminate(const Option_t *)
Definition: External.C:212
static AliFlowCommonConstants * GetMaster()
Class handling all kinds of selection cuts for Gamma Conversion analysis.
virtual Double_t GetPhotonEta() const
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
void SetPhi(Double_t phi)
void DefineDeadZone(Double_t etaMin, Double_t etaMax, Double_t phiMin, Double_t phiMax)
void SetPt(Double_t pt)
void SetEvent(AliVEvent *event, AliMCEvent *mcEvent=NULL)
Bool_t MCGammaSignal(AliAODConversionPhoton *MCPhoton)
Definition: External.C:220
Class handling all kinds of selection cuts for Gamma Conversion analysis.
void PrepareFlowEvent(Int_t iMulti, AliFlowEvent *FlowEv) const
TClonesArray * GetReconstructedGammas() const
Definition: AliV0ReaderV1.h:85
void SetForPOISelection(Bool_t b=kTRUE)
virtual Double_t GetPhotonPt() const
AliFlowTrackCuts * fCutsRP
enable debug mode
Class handling all kinds of selection cuts for Gamma Conversion analysis.
AliConvEventCuts * GetEventCuts()
Definition: AliV0ReaderV1.h:90
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
void InsertTrack(AliFlowTrack *)
virtual void ClearFast()
Int_t GetTemplateID(AliAODConversionPhoton *MCPhoton)
Double_t GetConversionRadius() const
void SetEtaRange(Float_t r1, Float_t r2)