AliPhysics  b752f14 (b752f14)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 fMCStackPos(NULL),
156 fMCStackNeg(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 fApplydPhidRCut(0),
176 fPerformExtraStudies(0),
177 fDebug(0),
178 fCutsRP(0),
179 fNullCuts(0),
180 fFlowEvent(NULL),
181 fIsMC(0),
182 fMCEvent(NULL),
183 fMCStack(NULL)
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 fMCStackPos(NULL),
278 fMCStackNeg(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 fApplydPhidRCut(0),
298 fPerformExtraStudies(0),
299 fDebug(0),
300 fCutsRP(0),
301 fNullCuts(0),
302 fFlowEvent(NULL),
303 fIsMC(0),
304 fMCEvent(NULL),
305 fMCStack(NULL)
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),
336 fOutputContainer(0),
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),
351 hdPhidRcandidates_MCsigsig(NULL),
352 hdPhidRcandidates_MCbkgsig(NULL),
353 hdPhidRcandidates_MCbkgbkg(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),
378 hESDMotherBackInvMassPt(NULL),
379 //sESDMotherBackInvMassPtZM(NULL),
380 hESDMotherInvMassEalpha(NULL),
381 hESDMotherPi0PtY(NULL),
382 hESDMotherEtaPtY(NULL),
383 hESDMotherPi0PtAlpha(NULL),
384 hESDMotherEtaPtAlpha(NULL),
385 hESDMotherPi0PtOpenAngle(NULL),
386 hESDMotherEtaPtOpenAngle(NULL),
387 hNEvents(NULL),
388 hNGoodESDTracks(NULL),
389 hNGammaCandidates(NULL),
390 hNGoodESDTracksVsNGammaCanditates(NULL),
391 hNV0Tracks(NULL),
392 hEtaShift(NULL),
393 tESDMesonsInvMassPtDcazMinDcazMaxFlag(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),
402 fnGammaCandidates(0),
403 fUnsmearedPx(NULL),
404 fUnsmearedPy(NULL),
405 fUnsmearedPz(NULL),
406 fUnsmearedE(NULL),
407 fMCStackPos(NULL),
408 fMCStackNeg(NULL),
409 fESDArrayPos(NULL),
410 fESDArrayNeg(NULL),
411 fnCuts(nCuts),
412 fiCut(0),
413 fMoveParticleAccordingToVertex(kTRUE),
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 fApplydPhidRCut(0),
428 fPerformExtraStudies(0),
429 fDebug(0),
430 fCutsRP(0),
431 fNullCuts(0),
432 fFlowEvent(NULL),
433 fIsMC(0),
434 fMCEvent(NULL),
435 fMCStack(NULL)
436 
437 {
438  // Define output slots here
439  DefineOutput(1, TList::Class());
440  for (Int_t i = 0; i<nCuts; i++){
441  DefineOutput(2+i, AliFlowEventSimple::Class());
442  }
443 
444 }
445 //___________________________________________________________
447 {
448  if(fGammaCandidates){
449  delete fGammaCandidates;
450  fGammaCandidates = 0x0;
451  }
452  if(fBGHandler){
453  delete[] fBGHandler;
454  fBGHandler = 0x0;
455  }
456  if(fBGHandlerRP){
457  delete[] fBGHandlerRP;
458  fBGHandlerRP = 0x0;
459  }
460 
461  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
462  if (fFlowEvent[iCut]) delete fFlowEvent[iCut];
463  }
464 
465 }
466 
467 //________________________________________________________________________
469 
470  // Create histograms
471  if(fOutputContainer != NULL){
472  delete fOutputContainer;
473  fOutputContainer = NULL;
474  }
475  if(fOutputContainer == NULL){
476  fOutputContainer = new TList();
477  fOutputContainer->SetOwner(kTRUE);
478  }
479 
480  //========================= again flow setting==========================
481  //Create histograms
482  //----------hfe initialising begin---------
483  fNullCuts = new AliFlowTrackCuts("null_cuts");
484 
486  cc->SetNbinsMult(10000);
487  cc->SetMultMin(0);
488  cc->SetMultMax(10000);
489 
490  cc->SetNbinsPt(200);
491  cc->SetPtMin(0);
492  cc->SetPtMax(20);
493 
494  cc->SetNbinsPhi(180);
495  cc->SetPhiMin(0.0);
496  cc->SetPhiMax(TMath::TwoPi());
497 
498  cc->SetNbinsEta(40);
499  cc->SetEtaMin(-2.0);
500  cc->SetEtaMax(+2.0);
501 
502  cc->SetNbinsQ(500);
503  cc->SetQMin(0.0);
504  cc->SetQMax(3.0);
505 
506  cc->SetMassMin(fMinFilter);
507  cc->SetMassMax(fMaxFilter);
508  cc->SetNbinsMass(100);
509 
510  // Array of current cut's gammas
511  fGammaCandidates = new TList();
512 
513  fCutFolder = new TList*[fnCuts];
514  fESDList = new TList*[fnCuts];
515  fBackList = new TList*[fnCuts];
516  fMotherList = new TList*[fnCuts];
517  hNEvents = new TH1I*[fnCuts];
518  hNGoodESDTracks = new TH1I*[fnCuts];
519  hNGammaCandidates = new TH1I*[fnCuts];
521  hNV0Tracks = new TH1I*[fnCuts];
522  hEtaShift = new TProfile*[fnCuts];
523  hESDConvGammaPt = new TH1F*[fnCuts];
524  hInvMassPair = new TH2F*[fnCuts];
525  hLTMPt = new TH2F*[fnCuts];
526  hLTMPt_MC = new TH2F*[fnCuts];
527  hPt_TruePt = new TH2F*[fnCuts];
528  hdPhidRcandidates = new TH2F*[fnCuts];
532  hKappaTPC = new TH2F*[fnCuts];
533  hKappaTPC_after = new TH2F*[fnCuts];
534  hKappaTPC_Temp0 = new TH2F*[fnCuts];
535  hKappaTPC_Temp1 = new TH2F*[fnCuts];
536  hKappaTPC_Temp2 = new TH2F*[fnCuts];
537  hKappaTPC_Temp3 = new TH2F*[fnCuts];
538  hKappaTPC_Temp4 = new TH2F*[fnCuts];
539  hKappaTPC_Temp5 = new TH2F*[fnCuts];
540  hKappaTPC_Temp6 = new TH2F*[fnCuts];
541  hKappaTPC_Temp7 = new TH2F*[fnCuts];
542  hKappaTPC_Temp8 = new TH2F*[fnCuts];
543  hKappaTPC_Temp9 = new TH2F*[fnCuts];
544  hKappaTPC_Temp10 = new TH2F*[fnCuts];
545 
546  if (fDoPhotonQA == 2){
547  fPhotonDCAList = new TList*[fnCuts];
548 // tESDConvGammaPtDcazCat = new TTree*[fnCuts];
549  }
550  if (fDoPhotonQA > 0){
551  hESDConvGammaR = new TH1F*[fnCuts];
552  hESDConvGammaEta = new TH1F*[fnCuts];
553  }
554 
555  if(fDoMesonAnalysis){
559  if (fDoMesonQA == 2){
560  fMesonDCAList = new TList*[fnCuts];
562  }
563  if (fDoMesonQA > 0){
564  hESDMotherPi0PtY = new TH2F*[fnCuts];
565  hESDMotherEtaPtY = new TH2F*[fnCuts];
570  }
571  }
572 
573  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
574 
575  TString cutstringEvent = ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber();
576  TString cutstringPhoton = ((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutNumber();
577  TString cutstringMeson = "NoMesonCut";
578  if(fDoMesonAnalysis)cutstringMeson = ((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutNumber();
579 
580  fCutFolder[iCut] = new TList();
581  fCutFolder[iCut]->SetName(Form("Cut Number %s_%s",cutstringEvent.Data() ,cutstringPhoton.Data()));
582  fCutFolder[iCut]->SetOwner(kTRUE);
583  fOutputContainer->Add(fCutFolder[iCut]);
584  fESDList[iCut] = new TList();
585  fESDList[iCut]->SetName(Form("%s_%s ESD histograms",cutstringEvent.Data() ,cutstringPhoton.Data()));
586  fESDList[iCut]->SetOwner(kTRUE);
587  fCutFolder[iCut]->Add(fESDList[iCut]);
588 
589  hNEvents[iCut] = new TH1I("NEvents","NEvents",13,-0.5,12.5);
590  hNEvents[iCut]->GetXaxis()->SetBinLabel(1,"Accepted");
591  hNEvents[iCut]->GetXaxis()->SetBinLabel(2,"Centrality");
592  hNEvents[iCut]->GetXaxis()->SetBinLabel(3,"Missing MC");
593  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->IsSpecialTrigger() > 1 ){
594  TString TriggerNames = "Not Trigger: ";
595  TriggerNames = TriggerNames+ ( (AliConvEventCuts*)fEventCutArray->At(iCut))->GetSpecialTriggerName();
596  hNEvents[iCut]->GetXaxis()->SetBinLabel(4,TriggerNames.Data());
597  } else {
598  hNEvents[iCut]->GetXaxis()->SetBinLabel(4,"Trigger");
599  }
600  hNEvents[iCut]->GetXaxis()->SetBinLabel(5,"Vertex Z");
601  hNEvents[iCut]->GetXaxis()->SetBinLabel(6,"Cont. Vertex");
602  hNEvents[iCut]->GetXaxis()->SetBinLabel(7,"Pile-Up");
603  hNEvents[iCut]->GetXaxis()->SetBinLabel(8,"no SDD");
604  hNEvents[iCut]->GetXaxis()->SetBinLabel(9,"no V0AND");
605  hNEvents[iCut]->GetXaxis()->SetBinLabel(10,"EMCAL problem");
606  hNEvents[iCut]->GetXaxis()->SetBinLabel(12,"SPD hits vs tracklet");
607  hNEvents[iCut]->GetXaxis()->SetBinLabel(13,"Out-of-Bunch pileup Past-Future");
608  fESDList[iCut]->Add(hNEvents[iCut]);
609 
610  if(fIsHeavyIon == 1) hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
611  else if(fIsHeavyIon == 2) hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",400,0,400);
612  else hNGoodESDTracks[iCut] = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
613  fESDList[iCut]->Add(hNGoodESDTracks[iCut]);
614  if(fIsHeavyIon == 1) hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",100,0,100);
615  else if(fIsHeavyIon == 2) hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
616  else hNGammaCandidates[iCut] = new TH1I("GammaCandidates","GammaCandidates",50,0,50);
617  fESDList[iCut]->Add(hNGammaCandidates[iCut]);
618  if(fIsHeavyIon == 1) hNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",4000,0,4000,100,0,100);
619  else if(fIsHeavyIon == 2) hNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",400,0,400,50,0,50);
620  else hNGoodESDTracksVsNGammaCanditates[iCut] = new TH2F("GoodESDTracksVsGammaCandidates","GoodESDTracksVsGammaCandidates",200,0,200,50,0,50);
622 
623 
624  if(fIsHeavyIon == 1) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
625  else if(fIsHeavyIon == 2) hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",2500,0,2500);
626  else hNV0Tracks[iCut] = new TH1I("V0 Multiplicity","V0 Multiplicity",1500,0,1500);
627  fESDList[iCut]->Add(hNV0Tracks[iCut]);
628  hEtaShift[iCut] = new TProfile("Eta Shift","Eta Shift",1, -0.5,0.5);
629  fESDList[iCut]->Add(hEtaShift[iCut]);
630  hESDConvGammaPt[iCut] = new TH1F("ESD_ConvGamma_Pt","ESD_ConvGamma_Pt",250,0,25);
631  fESDList[iCut]->Add(hESDConvGammaPt[iCut]);
632 
633  hInvMassPair[iCut]= new TH2F("InvMassPair_Pt","Gamma invariant mass vs Pt",200,0,0.2,250,0,25);
634  fESDList[iCut]->Add(hInvMassPair[iCut]);
635 
636  hLTMPt[iCut]= new TH2F("LTM_Pt","LTM vs Pt",200,0,200,250,0,25);
637  fESDList[iCut]->Add(hLTMPt[iCut]);
638  hLTMPt_MC[iCut]= new TH2F("LTM_Pt_MCgen","LTM vs Pt (MC)",200,0,200,250,0,25);
639  fESDList[iCut]->Add(hLTMPt_MC[iCut]);
640 
641  hPt_TruePt[iCut]= new TH2F("hPt_TruePt","Pt vs TruePt (MC)",250,0,25,250,0,25);
642  fESDList[iCut]->Add(hPt_TruePt[iCut]);
643  hdPhidRcandidates[iCut]= new TH2F("hdPhidRcandidates","dPhi vs dRconvVtx",400,0,4,300,0,300);
644  fESDList[iCut]->Add(hdPhidRcandidates[iCut]);
645  hdPhidRcandidates_MCsigsig[iCut]= new TH2F("hdPhidRcandidates_MCsigsig","dPhi vs dRconvVtx",400,0,4,300,0,300);
646  fESDList[iCut]->Add(hdPhidRcandidates_MCsigsig[iCut]);
647  hdPhidRcandidates_MCbkgsig[iCut]= new TH2F("hdPhidRcandidates_MCbkgsig","dPhi vs dRconvVtx",400,0,4,300,0,300);
648  fESDList[iCut]->Add(hdPhidRcandidates_MCbkgsig[iCut]);
649  hdPhidRcandidates_MCbkgbkg[iCut]= new TH2F("hdPhidRcandidates_MCbkgbkg","dPhi vs dRconvVtx",400,0,4,300,0,300);
650  fESDList[iCut]->Add(hdPhidRcandidates_MCbkgbkg[iCut]);
651 
652 
653 
654  hKappaTPC[iCut]= new TH2F("KappaTPC_Pt","Gamma KappaTPC vs Pt",200,-20,20,250,0,25);
655  fESDList[iCut]->Add(hKappaTPC[iCut]);
656 
657  hKappaTPC_after[iCut]= new TH2F("KappaTPC_Pt_after","Gamma KappaTPC vs Pt after cuts",200,-20,20,250,0,25);
658  fESDList[iCut]->Add(hKappaTPC_after[iCut]);
659 
660  hKappaTPC_Temp0[iCut]= new TH2F("hKappaTPC_Temp0_ee","Gamma KappaTPC vs Pt Template 0",200,-20,20,250,0,25);
661  fESDList[iCut]->Add(hKappaTPC_Temp0[iCut]);
662 
663  hKappaTPC_Temp1[iCut]= new TH2F("hKappaTPC_Temp1_pipi","Gamma KappaTPC vs Pt Template 1",200,-20,20,250,0,25);
664  fESDList[iCut]->Add(hKappaTPC_Temp1[iCut]);
665 
666  hKappaTPC_Temp2[iCut]= new TH2F("hKappaTPC_Temp2_pie","Gamma KappaTPC vs Pt Template 2",200,-20,20,250,0,25);
667  fESDList[iCut]->Add(hKappaTPC_Temp2[iCut]);
668 
669  hKappaTPC_Temp3[iCut]= new TH2F("hKappaTPC_Temp3_piK","Gamma KappaTPC vs Pt Template 3",200,-20,20,250,0,25);
670  fESDList[iCut]->Add(hKappaTPC_Temp3[iCut]);
671 
672  hKappaTPC_Temp4[iCut]= new TH2F("hKappaTPC_Temp4_pip","Gamma KappaTPC vs Pt Template 4",200,-20,20,250,0,25);
673  fESDList[iCut]->Add(hKappaTPC_Temp4[iCut]);
674 
675  hKappaTPC_Temp5[iCut]= new TH2F("hKappaTPC_Temp5_eK","Gamma KappaTPC vs Pt Template 5",200,-20,20,250,0,25);
676  fESDList[iCut]->Add(hKappaTPC_Temp5[iCut]);
677 
678  hKappaTPC_Temp6[iCut]= new TH2F("hKappaTPC_Temp6_ep","Gamma KappaTPC vs Pt Template 6",200,-20,20,250,0,25);
679  fESDList[iCut]->Add(hKappaTPC_Temp6[iCut]);
680 
681  hKappaTPC_Temp7[iCut]= new TH2F("hKappaTPC_Temp7_KK","Gamma KappaTPC vs Pt Template 7",200,-20,20,250,0,25);
682  fESDList[iCut]->Add(hKappaTPC_Temp7[iCut]);
683 
684  hKappaTPC_Temp8[iCut]= new TH2F("hKappaTPC_Temp8_had","Gamma KappaTPC vs Pt Template 8",200,-20,20,250,0,25);
685  fESDList[iCut]->Add(hKappaTPC_Temp8[iCut]);
686 
687  hKappaTPC_Temp9[iCut]= new TH2F("hKappaTPC_Temp9_rem4","Gamma KappaTPC vs Pt Template 9",200,-20,20,250,0,25);
688  fESDList[iCut]->Add(hKappaTPC_Temp9[iCut]);
689 
690  hKappaTPC_Temp10[iCut]= new TH2F("hKappaTPC_Temp10_rem10","Gamma KappaTPC vs Pt Template 10",200,-20,20,250,0,25);
691  fESDList[iCut]->Add(hKappaTPC_Temp10[iCut]);
692 
693  //2d histogram filling the cut and value - control check for selections
694 
695  if (fDoPhotonQA == 2){
696  fPhotonDCAList[iCut] = new TList();
697  fPhotonDCAList[iCut]->SetName(Form("%s_%s_%s Photon DCA tree",cutstringEvent.Data(),cutstringPhoton.Data(),cutstringMeson.Data()));
698  fPhotonDCAList[iCut]->SetOwner(kTRUE);
699  fCutFolder[iCut]->Add(fPhotonDCAList[iCut]);
700 
701 // tESDConvGammaPtDcazCat[iCut] = new TTree("ESD_ConvGamma_Pt_Dcaz_R_Eta","ESD_ConvGamma_Pt_Dcaz_R_Eta_Cat");
702 // tESDConvGammaPtDcazCat[iCut]->Branch("Pt",&fPtGamma,"fPtGamma/F");
703 // tESDConvGammaPtDcazCat[iCut]->Branch("DcaZPhoton",&fDCAzPhoton,"fDCAzPhoton/F");
704  // tESDConvGammaPtDcazCat[iCut]->Branch("R",&fRConvPhoton,"fRConvPhoton/F");
705  // tESDConvGammaPtDcazCat[iCut]->Branch("Eta",&fEtaPhoton,"fEtaPhoton/F");
706 
707  // tESDConvGammaPtDcazCat[iCut]->Branch("cat",&iCatPhoton,"iCatPhoton/b");
708 
709  // fPhotonDCAList[iCut]->Add(tESDConvGammaPtDcazCat[iCut]);
710  }
711 
712  if (fDoPhotonQA > 0){
713  hESDConvGammaR[iCut] = new TH1F("ESD_ConvGamma_R","ESD_ConvGamma_R",800,0,200);
714  fESDList[iCut]->Add(hESDConvGammaR[iCut]);
715  hESDConvGammaEta[iCut] = new TH1F("ESD_ConvGamma_Eta","ESD_ConvGamma_Eta",2000,-2,2);
716  fESDList[iCut]->Add(hESDConvGammaEta[iCut]);
717  }
718 
719  if(fDoMesonAnalysis){
720  hESDMotherInvMassPt[iCut] = new TH2F("ESD_Mother_InvMass_Pt","ESD_Mother_InvMass_Pt",800,0,0.8,250,0,25);
721  fESDList[iCut]->Add(hESDMotherInvMassPt[iCut]);
722  hESDMotherBackInvMassPt[iCut] = new TH2F("ESD_Background_InvMass_Pt","ESD_Background_InvMass_Pt",800,0,0.8,250,0,25);
723  fESDList[iCut]->Add(hESDMotherBackInvMassPt[iCut]);
724  hESDMotherInvMassEalpha[iCut] = new TH2F("ESD_Mother_InvMass_vs_E_alpha","ESD_Mother_InvMass_vs_E_alpha",800,0,0.8,250,0,25);
725  fESDList[iCut]->Add(hESDMotherInvMassEalpha[iCut]);
726  if (fDoMesonQA == 2){
727  fMesonDCAList[iCut] = new TList();
728  fMesonDCAList[iCut]->SetName(Form("%s_%s_%s Meson DCA tree",cutstringEvent.Data() ,cutstringPhoton.Data(),cutstringMeson.Data()));
729  fMesonDCAList[iCut]->SetOwner(kTRUE);
730  fCutFolder[iCut]->Add(fMesonDCAList[iCut]);
731 
732  tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut] = new TTree("ESD_Mesons_InvMass_Pt_DcazMin_DcazMax_Flag","ESD_Mesons_InvMass_Pt_DcazMin_DcazMax_Flag");
733  tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("InvMass",&fInvMass,"fInvMass/F");
734  tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("Pt",&fPt,"fPt/F");
735  tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("DcaZMin",&fDCAzGammaMin,"fDCAzGammaMin/F");
736  tESDMesonsInvMassPtDcazMinDcazMaxFlag[iCut]->Branch("DcaZMax",&fDCAzGammaMax,"fDCAzGammaMax/F");
737 
739 
740  }
741  if (fDoMesonQA > 0 ){
742  hESDMotherPi0PtY[iCut] = new TH2F("ESD_MotherPi0_Pt_Y","ESD_MotherPi0_Pt_Y",150,0.03,15.,150,-1.5,1.5);
744  fESDList[iCut]->Add(hESDMotherPi0PtY[iCut]);
745  hESDMotherEtaPtY[iCut] = new TH2F("ESD_MotherEta_Pt_Y","ESD_MotherEta_Pt_Y",150,0.03,15.,150,-1.5,1.5);
747  fESDList[iCut]->Add(hESDMotherEtaPtY[iCut]);
748  hESDMotherPi0PtAlpha[iCut] = new TH2F("ESD_MotherPi0_Pt_Alpha","ESD_MotherPi0_Pt_Alpha",150,0.03,15.,100,0,1);
750  fESDList[iCut]->Add(hESDMotherPi0PtAlpha[iCut]);
751  hESDMotherEtaPtAlpha[iCut] = new TH2F("ESD_MotherEta_Pt_Alpha","ESD_MotherEta_Pt_Alpha",150,0.03,15.,100,0,1);
753  fESDList[iCut]->Add(hESDMotherEtaPtAlpha[iCut]);
754  hESDMotherPi0PtOpenAngle[iCut] = new TH2F("ESD_MotherPi0_Pt_OpenAngle","ESD_MotherPi0_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
756  fESDList[iCut]->Add(hESDMotherPi0PtOpenAngle[iCut]);
757  hESDMotherEtaPtOpenAngle[iCut] = new TH2F("ESD_MotherEta_Pt_OpenAngle","ESD_MotherEta_Pt_OpenAngle",150,0.03,15.,100,0,TMath::Pi());
759  fESDList[iCut]->Add(hESDMotherEtaPtOpenAngle[iCut]);
760  }
761 
762 
763  }
764 
765 
766  }
767 // if(fDoMesonAnalysis){
768 // InitBack(); // Init Background Handler
769 // }
770 
771 
772 
773  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
774  if(!fV0Reader){printf("Error: No V0 Reader");return;} // GetV0Reader
775 
776  if(fV0Reader)
778  if(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms())
779  fOutputContainer->Add(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetCutHistograms());
780 
781  if(fV0Reader)
783  if(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms())
784  fOutputContainer->Add(((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetCutHistograms());
785 
786  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
787  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))) continue;
788  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms()){
789  fCutFolder[iCut]->Add(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutHistograms());
790  }
791  if(!((AliConversionPhotonCuts*)fCutArray->At(iCut))) continue;
792  if(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms()){
793  fCutFolder[iCut]->Add(((AliConversionPhotonCuts*)fCutArray->At(iCut))->GetCutHistograms());
794  }
795  if(fDoMesonAnalysis){
796  if(!((AliConversionMesonCuts*)fMesonCutArray->At(iCut))) continue;
797  if(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms()){
798  fCutFolder[iCut]->Add(((AliConversionMesonCuts*)fMesonCutArray->At(iCut))->GetCutHistograms());
799  }
800  }
801  }
802 
803  fhistoEPVZ = new TH1D("EPVZ", "EPVZ", 60, -TMath::Pi()/2, TMath::Pi()/2);
805 
806 
807 
808  PostData(1, fOutputContainer);
809 
811 
812  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
813  fFlowEvent[iCut] = new AliFlowEvent(10000);
814  if (fIsHeavyIon == 1){
815  PostData(2+iCut, fFlowEvent[iCut]);
816  }
817  }
818 }
819 
820 //_____________________________________________________________________________
822 {
823  for(Int_t iCut = 0; iCut<fnCuts;iCut++){
824  if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod && ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum() != AliConvEventCuts::kNoPeriod){
825  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnumExplicit(((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetPeriodEnum());
826  } else if (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetPeriodEnum() == AliConvEventCuts::kNoPeriod ){
827  ((AliConvEventCuts*)fEventCutArray->At(iCut))->SetPeriodEnum(fV0Reader->GetPeriodName());
828  }
829 
830  if(!((AliConvEventCuts*)fEventCutArray->At(iCut))->GetDoEtaShift()){
831  hEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
832  continue; // No Eta Shift requested, continue
833  }
834  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
835  ((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCorrectEtaShiftFromPeriod();
836  hEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
837  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
838  continue;
839  }
840  else{
841  printf(" Gamma Conversion Task %s :: Eta Shift Manually Set to %f \n\n",
842  (((AliConvEventCuts*)fEventCutArray->At(iCut))->GetCutNumber()).Data(),((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift());
843  hEtaShift[iCut]->Fill(0.,(((AliConvEventCuts*)fEventCutArray->At(iCut))->GetEtaShift()));
844  ((AliConvEventCuts*)fEventCutArray->At(iCut))->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
845  }
846  }
847  return kTRUE;
848 }
849 //_____________________________________________________________________________
851 {
852  //
853  // Called for each event
854  //
855  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
856  if(eventQuality == 2 || eventQuality == 3){// Event Not Accepted due to MC event missing or wrong trigger for V0ReaderV1
857  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
858  hNEvents[iCut]->Fill(eventQuality);
859  }
860  return;
861  }
862 
863  fInputEvent = InputEvent();
864  if(fIsMC) fMCEvent = MCEvent();
865  if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){ fMCStack = fMCEvent->Stack(); }
866 
867  fReaderGammas = fV0Reader->GetReconstructedGammas(); // Gammas from default Cut
868 
869  // ------------------- BeginEvent ----------------------------
870 
871  AliEventplane *EventPlane = fInputEvent->GetEventplane();
872  if(fIsHeavyIon ==1)fEventPlaneAngle = EventPlane->GetEventplane("V0",fInputEvent,2);
873  else fEventPlaneAngle=0.0;
874 
876 
877  for(Int_t iCut = 0; iCut<fnCuts; iCut++){
878 // cout << "event cut array = " << fEventCutArray->At(iCut) << endl;
879  PrepareFlowEvent(fInputEvent->GetNumberOfTracks(),fFlowEvent[iCut]); //Calculate event plane Qvector and EP resolution for inclusive
880 // Int_t iCut = 0;
881  fiCut = iCut;
882  Int_t eventNotAccepted =
883  ((AliConvEventCuts*)fEventCutArray->At(iCut))
884  ->IsEventAcceptedByCut(fV0Reader->GetEventCuts(),fInputEvent,fMCEvent,fIsHeavyIon,kFALSE);
885  if(eventNotAccepted){
886  // cout << "event rejected due to wrong trigger: " <<eventNotAccepted << endl;
887  hNEvents[iCut]->Fill(eventNotAccepted); // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
888  continue;
889  }
890 
891  if(eventQuality != 0){// Event Not Accepted
892  // cout << "event rejected due to: " <<eventQuality << endl;
893  hNEvents[iCut]->Fill(eventQuality);
894  continue;
895  }
896 
897  hNEvents[iCut]->Fill(eventQuality); // Should be 0 here
899  if(((AliConvEventCuts*)fEventCutArray->At(iCut))->IsHeavyIon() == 2) hNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A());
900  else hNV0Tracks[iCut]->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
901 
902  ProcessPhotonCandidates(); // Process this cuts gammas
903  ProcessPhotonCandidatesforV2(); // Process this cuts gammas and do v2
904 
906  ProcessPhotonCandidatesforLTM(); // calculate the Local Track Multiplicity in a jet cone around the candidates
907  GetdPhidRtoCandidate(); // calculate the distances to other conversions in the event for each selected candidate
908  }
909 
910  hNGammaCandidates[iCut]->Fill(fGammaCandidates->GetEntries());
912  if (fIsHeavyIon == 1){
913  PostData(2+iCut, fFlowEvent[iCut]);
914  }
915  fGammaCandidates->Clear(); // delete this cuts good gammas
916  }
917 
919 
920  PostData(1, fOutputContainer);
921 
922 
923 }
924 //________________________________________________________________________
926 {
927  Int_t nV0 = 0;
928  TList *GammaCandidatesStepOne = new TList();
929  TList *GammaCandidatesStepTwo = new TList();
930  Int_t PhotonTemplateID;
931  // Loop over Photon Candidates allocated by ReaderV1
932  for(Int_t i = 0; i < fReaderGammas->GetEntriesFast(); i++){
933  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fReaderGammas->At(i);
934  if(!PhotonCandidate) continue;
935  fIsFromMBHeader = kTRUE;
936 
937  hKappaTPC[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
938  if (PhotonCandidate->GetInvMassPair() < fMinMass || PhotonCandidate->GetInvMassPair() > fMaxMass) continue;
939  if (((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent) < fMinKappa || ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent) > fMaxKappa) continue;
940  if(fApplydPhidRCut==1){ if(GetdPhidRtoCandidate(PhotonCandidate,i)==1) continue; }
941  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->PhotonIsSelected(PhotonCandidate,fInputEvent)) continue;
942  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->InPlaneOutOfPlaneCut(PhotonCandidate->GetPhotonPhi(),fEventPlaneAngle)) continue;
943  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
944  !((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
945  fGammaCandidates->Add(PhotonCandidate); // if no second loop is required add to events good gammas
946 // cout << "IS IT MC? " << fIsMC << endl;
947  if(fIsMC){
948  PhotonTemplateID = GetTemplateID(PhotonCandidate);
949  if(PhotonTemplateID == 0) hKappaTPC_Temp0[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
950  if(PhotonTemplateID == 1) hKappaTPC_Temp1[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
951  if(PhotonTemplateID == 2) hKappaTPC_Temp2[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
952  if(PhotonTemplateID == 3) hKappaTPC_Temp3[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
953  if(PhotonTemplateID == 4) hKappaTPC_Temp4[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
954  if(PhotonTemplateID == 5) hKappaTPC_Temp5[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
955  if(PhotonTemplateID == 6) hKappaTPC_Temp6[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
956  if(PhotonTemplateID == 7) hKappaTPC_Temp7[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
957  if(PhotonTemplateID == 8) hKappaTPC_Temp8[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
958  if(PhotonTemplateID != 0 && PhotonTemplateID != 1 && PhotonTemplateID != 2) hKappaTPC_Temp9[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
959  if(PhotonTemplateID != 0 && PhotonTemplateID != 1 && PhotonTemplateID != 2 &&
960  PhotonTemplateID != 3 && PhotonTemplateID != 4 && PhotonTemplateID != 5 &&
961  PhotonTemplateID != 6 && PhotonTemplateID != 7 && PhotonTemplateID != 8) hKappaTPC_Temp10[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
962 
963  TParticle *TRUEPhoton = PhotonCandidate->GetMCParticle(fMCStack);
964  if(TRUEPhoton) hPt_TruePt[fiCut]->Fill(PhotonCandidate->Pt(),TRUEPhoton->Pt());
965  }
966 
967  if(fIsFromMBHeader){
968  hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
969  hInvMassPair[fiCut]->Fill(PhotonCandidate->GetInvMassPair(),PhotonCandidate->Pt());
970  hKappaTPC_after[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
971  if (fDoPhotonQA > 0){
972  hESDConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
973  hESDConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
974  }
975  }
976 
977 
978  if (fIsFromMBHeader && fDoPhotonQA == 2){
979  if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
980  fPtGamma = PhotonCandidate->Pt();
981  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
982  fRConvPhoton = PhotonCandidate->GetConversionRadius();
983  fEtaPhoton = PhotonCandidate->GetPhotonEta();
984  iCatPhoton = PhotonCandidate->GetPhotonQuality();
985  // tESDConvGammaPtDcazCat[fiCut]->Fill();
986  } else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
987  fPtGamma = PhotonCandidate->Pt();
988  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
989  fRConvPhoton = PhotonCandidate->GetConversionRadius();
990  fEtaPhoton = PhotonCandidate->GetPhotonEta();
991  iCatPhoton = PhotonCandidate->GetPhotonQuality();
992  // tESDConvGammaPtDcazCat[fiCut]->Fill();
993  }
994  }
995  } else if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){ // if Shared Electron cut is enabled, Fill array, add to step one
996  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->FillElectonLabelArray(PhotonCandidate,nV0);
997  nV0++;
998  GammaCandidatesStepOne->Add(PhotonCandidate);
999  } else if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut() &&
1000  ((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // shared electron is disabled, step one not needed -> step two
1001  GammaCandidatesStepTwo->Add(PhotonCandidate);
1002  }
1003  }
1004 
1005 
1006 
1007  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseElecSharingCut()){
1008  for(Int_t i = 0;i<GammaCandidatesStepOne->GetEntries();i++){
1009  AliAODConversionPhoton *PhotonCandidate= (AliAODConversionPhoton*) GammaCandidatesStepOne->At(i);
1010  if(!PhotonCandidate) continue;
1011  fIsFromMBHeader = kTRUE;
1012 
1013  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectSharedElectronV0s(PhotonCandidate,i,GammaCandidatesStepOne->GetEntries())) continue;
1014  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){ // To Colse v0s cut diabled, step two not needed
1015  fGammaCandidates->Add(PhotonCandidate);
1016  if(fIsFromMBHeader){
1017  hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1018  hInvMassPair[fiCut]->Fill(PhotonCandidate->GetInvMassPair(),PhotonCandidate->Pt());
1019  hKappaTPC_after[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
1020  if (fDoPhotonQA > 0){
1021  hESDConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
1022  hESDConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1023  }
1024  }
1025  }
1026 
1027 
1028  GammaCandidatesStepTwo->Add(PhotonCandidate); // Close v0s cut enabled -> add to list two
1029 
1030  if (fIsFromMBHeader && fDoPhotonQA == 2){
1031  if (fIsHeavyIon ==1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
1032  fPtGamma = PhotonCandidate->Pt();
1033  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1034  fRConvPhoton = PhotonCandidate->GetConversionRadius();
1035  fEtaPhoton = PhotonCandidate->GetPhotonEta();
1036  iCatPhoton = PhotonCandidate->GetPhotonQuality();
1037  // tESDConvGammaPtDcazCat[fiCut]->Fill();
1038  } else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
1039  fPtGamma = PhotonCandidate->Pt();
1040  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1041  fRConvPhoton = PhotonCandidate->GetConversionRadius();
1042  fEtaPhoton = PhotonCandidate->GetPhotonEta();
1043  iCatPhoton = PhotonCandidate->GetPhotonQuality();
1044  // tESDConvGammaPtDcazCat[fiCut]->Fill();
1045  }
1046  }
1047  }
1048  }
1049  if(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->UseToCloseV0sCut()){
1050  for(Int_t i = 0;i<GammaCandidatesStepTwo->GetEntries();i++){
1051  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) GammaCandidatesStepTwo->At(i);
1052  if(!PhotonCandidate) continue;
1053  fIsFromMBHeader = kTRUE;
1054 
1055  if(!((AliConversionPhotonCuts*)fCutArray->At(fiCut))->RejectToCloseV0s(PhotonCandidate,GammaCandidatesStepTwo,i)) continue;
1056  fGammaCandidates->Add(PhotonCandidate); // Add gamma to current cut TList
1057  if(fIsFromMBHeader){
1058  hESDConvGammaPt[fiCut]->Fill(PhotonCandidate->Pt());
1059  hInvMassPair[fiCut]->Fill(PhotonCandidate->GetInvMassPair(),PhotonCandidate->Pt());
1060  hKappaTPC_after[fiCut]->Fill(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(PhotonCandidate,fInputEvent),PhotonCandidate->Pt());
1061  if (fDoPhotonQA > 0){
1062  hESDConvGammaR[fiCut]->Fill(PhotonCandidate->GetConversionRadius());
1063  hESDConvGammaEta[fiCut]->Fill(PhotonCandidate->Eta());
1064  }
1065  }
1066 
1067  if (fIsFromMBHeader){
1068  if (fIsHeavyIon == 1 && PhotonCandidate->Pt() > 0.399 && PhotonCandidate->Pt() < 12.){
1069  fPtGamma = PhotonCandidate->Pt();
1070  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1071  fRConvPhoton = PhotonCandidate->GetConversionRadius();
1072  fEtaPhoton = PhotonCandidate->GetPhotonEta();
1073  iCatPhoton = PhotonCandidate->GetPhotonQuality();
1074  // tESDConvGammaPtDcazCat[fiCut]->Fill();
1075  } else if ( PhotonCandidate->Pt() > 0.299 && PhotonCandidate->Pt() < 16.){
1076  fPtGamma = PhotonCandidate->Pt();
1077  fDCAzPhoton = PhotonCandidate->GetDCAzToPrimVtx();
1078  fRConvPhoton = PhotonCandidate->GetConversionRadius();
1079  fEtaPhoton = PhotonCandidate->GetPhotonEta();
1080  iCatPhoton = PhotonCandidate->GetPhotonQuality();
1081  // tESDConvGammaPtDcazCat[fiCut]->Fill();
1082  }
1083  }
1084  }
1085  }
1086 
1087  delete GammaCandidatesStepOne;
1088  GammaCandidatesStepOne = 0x0;
1089  delete GammaCandidatesStepTwo;
1090  GammaCandidatesStepTwo = 0x0;
1091 
1092 }
1093 //________________________________________________________________________
1095  //see header file for documentation
1096  if(fGammaCandidates->GetEntries() >0 ){
1097  if(((AliConversionMesonCuts*)fMesonCutArray->At(fiCut))->UseTrackMultiplicity()){
1098  fBGHandler[fiCut]->AddEvent(fGammaCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fV0Reader->GetNumberOfPrimaryTracks(),fEventPlaneAngle);
1099  }
1100  else{ // means we use #V0s for multiplicity
1101  fBGHandler[fiCut]->AddEvent(fGammaCandidates,fInputEvent->GetPrimaryVertex()->GetX(),fInputEvent->GetPrimaryVertex()->GetY(),fInputEvent->GetPrimaryVertex()->GetZ(),fGammaCandidates->GetEntries(),fEventPlaneAngle);
1102  }
1103  }
1104 }
1105 //________________________________________________________________________
1107  TAxis *axisafter = histoRebin->GetXaxis();
1108  Int_t bins = axisafter->GetNbins();
1109  Double_t from = axisafter->GetXmin();
1110  Double_t to = axisafter->GetXmax();
1111  Double_t *newbins = new Double_t[bins+1];
1112  newbins[0] = from;
1113  Double_t factor = TMath::Power(to/from, 1./bins);
1114  for(Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
1115  axisafter->Set(bins, newbins);
1116  delete [] newbins;
1117 }
1118 
1119 //________________________________________________________________________
1121 {
1122 
1123  //fOutputContainer->Print(); // Will crash on GRID
1124 }
1125 
1126 //________________________________________________________________________
1128 {
1129 
1130  // Loop over Photon Candidates allocated by ReaderV1
1131 // cout << "number of gamma's: " << fGammaCandidates->GetEntries() << endl;
1132  for(Int_t i = 0; i < fGammaCandidates->GetEntries(); i++){
1133 
1134  AliAODConversionPhoton *gammaForv2=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(i));
1135  if (gammaForv2 == NULL) return;
1136  AliFlowTrack *sTrack = new AliFlowTrack();
1137  sTrack->SetForRPSelection(kFALSE);
1138  sTrack->SetForPOISelection(kTRUE);
1139 
1140  if(fFilterVariable==1){//using mass for POI selections
1141  sTrack->SetMass(gammaForv2->GetInvMassPair());
1142  }else if(fFilterVariable==2){//using Kappa for POI selections
1143  sTrack->SetMass(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(gammaForv2,fInputEvent));
1144  }else if(fFilterVariable==3 && fIsMC){//MC ElectronElectron + mass
1145  if(!MCElectronElectron(gammaForv2)) return;
1146  sTrack->SetMass(gammaForv2->GetInvMassPair());
1147  }else if(fFilterVariable==4 && fIsMC){//MC ElectronElectron + kappa
1148  if(!MCElectronElectron(gammaForv2)) return;
1149  sTrack->SetMass(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(gammaForv2,fInputEvent));
1150  }else if(fFilterVariable==5 && fIsMC){//MC Not ElectronElectron + mass
1151  if(MCElectronElectron(gammaForv2)) return;
1152  sTrack->SetMass(gammaForv2->GetInvMassPair());
1153  }else if(fFilterVariable==6 && fIsMC){//MC Not ElectronElectron + kappa
1154  if(MCElectronElectron(gammaForv2)) return;
1155  sTrack->SetMass(((AliConversionPhotonCuts*)fCutArray->At(fiCut))->GetKappaTPC(gammaForv2,fInputEvent));
1156  }else{//no additional POI selection
1157  sTrack->SetMass(123456);
1158  }
1159  sTrack->SetPt(gammaForv2->Pt());
1160  sTrack->SetPhi(gammaForv2->GetPhotonPhi());
1161  sTrack->SetEta(gammaForv2->GetPhotonEta());
1162 
1163  /* for(int iRPs=0; iRPs!=fFlowEvent->NumberOfTracks(); ++iRPs)
1164  {
1165  // cout << " no of rps " << iRPs << endl;
1166  AliFlowTrack *iRP = dynamic_cast<AliFlowTrack*>(fFlowEvent->GetTrack( iRPs ));
1167  if (!iRP) continue;
1168  if (!iRP->InRPSelection()) continue;
1169  if( sTrack->GetID() == iRP->GetID())
1170  {
1171  if(fDebug) printf(" was in RP set");
1172  // cout << sTrack->GetID() <<" == " << iRP->GetID() << " was in RP set====REMOVED" <<endl;
1173  iRP->SetForRPSelection(kFALSE);
1174  // fFlowEvent->SetNumberOfRPs(fFlowEvent->GetNumberOfRPs() - 1);
1175  }
1176  } //end of for loop on RPs*/
1177  fFlowEvent[fiCut]->InsertTrack(((AliFlowTrack*) sTrack));
1178  fFlowEvent[fiCut]->SetNumberOfPOIs(fFlowEvent[fiCut]->GetNumberOfPOIs()+1);
1179 // cout << "cutnumber: " << fiCut << " nPoi " << fFlowEvent[fiCut]->GetNumberOfPOIs() << " ntracks " << fFlowEvent[fiCut]->NumberOfTracks() << endl;
1180  }
1181 }
1182 //________________________________________________________________________
1184 {
1185 
1186  Float_t gamma_Eta = 0;
1187  Float_t gamma_Phi = 0;
1188  Float_t gamma_Pt = 0;
1189 
1190  Float_t LTMpart_Eta = 0;
1191  Float_t LTMpart_Phi = 0;
1192  Float_t LTMpart_Pt = 0;
1193 
1194  Float_t dPhi = 0;
1195 
1196  Float_t nCloseByTracks = 0;
1197 
1198  if(fIsMC){
1199  // Loop over Photon Candidates allocated by MCstack
1200  for(Int_t i = 0; i < fMCStack->GetNprimary(); i++){
1201  TParticle* gammaForLTM = (TParticle *)fMCStack->Particle(i);
1202  if(!gammaForLTM) return;
1203  if(!MCConversionPhotonCheck(gammaForLTM)) continue;
1204  gamma_Eta = gammaForLTM->Eta(); gamma_Phi = gammaForLTM->Phi(); gamma_Pt = gammaForLTM->Pt();
1205  if( gamma_Eta > 0.9 || gamma_Eta < -0.9 ) continue;
1206  if(gamma_Eta==0 || gamma_Phi==0 || gamma_Pt==0)continue;
1207  nCloseByTracks = 0;
1208  for(Int_t j = 0; j < fInputEvent->GetNumberOfTracks(); j++){
1209  AliVParticle *LTMpart = fInputEvent->GetTrack(j);
1210  if (LTMpart == NULL) return;
1211  LTMpart_Eta = LTMpart->Eta(); LTMpart_Phi = LTMpart->Phi(); LTMpart_Pt = LTMpart->Pt();
1212  if(LTMpart_Eta==0 || LTMpart_Phi==0 || LTMpart_Pt==0)continue;
1213  dPhi = TMath::Abs(LTMpart_Phi-gamma_Phi);
1214  if(dPhi > TMath::Pi()) dPhi = TMath::Abs(dPhi-2.0*TMath::Pi());
1215  if(TMath::Sqrt(pow((LTMpart_Eta-gamma_Eta),2)+pow(dPhi,2))<0.2) nCloseByTracks+=1;
1216  }
1217 // cout << "nCloseByTracks MCgen= " << nCloseByTracks << " with pt= " << gamma_Pt << endl;
1218  hLTMPt_MC[fiCut]->Fill(nCloseByTracks,gamma_Pt);
1219  }
1220  }
1221  // Loop over Photon Candidates allocated by ReaderV1
1222  for(Int_t i = 0; i < fGammaCandidates->GetEntries(); i++){
1223  AliAODConversionPhoton *gammaForLTM=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(i));
1224  if(!gammaForLTM) return;
1225  gamma_Eta = gammaForLTM->GetPhotonEta(); gamma_Phi = gammaForLTM->GetPhotonPhi(); gamma_Pt = gammaForLTM->GetPhotonPt();
1226  if(gamma_Eta==0 || gamma_Phi==0 || gamma_Pt==0)continue;
1227  nCloseByTracks = 0;
1228  for(Int_t j = 0; j < fInputEvent->GetNumberOfTracks(); j++){
1229  AliVParticle *LTMpart = fInputEvent->GetTrack(j);
1230  if (LTMpart == NULL) return;
1231  LTMpart_Eta = LTMpart->Eta(); LTMpart_Phi = LTMpart->Phi(); LTMpart_Pt = LTMpart->Pt();
1232  if(LTMpart_Eta==0 || LTMpart_Phi==0 || LTMpart_Pt==0)continue;
1233  dPhi = TMath::Abs(LTMpart_Phi-gamma_Phi);
1234  if(dPhi > TMath::Pi()) dPhi = TMath::Abs(dPhi-2.0*TMath::Pi());
1235  if(TMath::Sqrt(pow((LTMpart_Eta-gamma_Eta),2)+pow(dPhi,2))<0.2) nCloseByTracks+=1;
1236  }
1237 // cout << "nCloseByTracks= " << nCloseByTracks << " with pt= " << gamma_Pt << endl;
1238  hLTMPt[fiCut]->Fill(nCloseByTracks,gamma_Pt);
1239  }
1240 }
1241 
1242 //_____________________________________________________________________________
1243 template <typename T> void AliAnalysisTaskGammaConvFlow::SetNullCuts(T* event)
1244 {
1245  // Set null cuts
1246  if (fDebug) cout << " fCutsRP " << fCutsRP << endl;
1247  fCutsRP->SetEvent(event, MCEvent());
1249  fNullCuts->SetPtRange(+1, -1); // select nothing QUICK
1250  fNullCuts->SetEtaRange(+1, -1); // select nothing VZERO
1251  fNullCuts->SetEvent(event, MCEvent());
1252 }
1253 
1254 //_____________________________________________________________________________
1256 {
1257  //Prepare flow events
1258  FlowEv->ClearFast();
1259  FlowEv->Fill(fCutsRP, fNullCuts);
1260  FlowEv->SetReferenceMultiplicity(iMulti);
1261  FlowEv->DefineDeadZone(0, 0, 0, 0);
1262  // FlowEv->TagSubeventsInEta(-0.7, 0, 0, 0.7);
1263 }
1264 //_____________________________________________________________________________
1266 
1267 
1268  TParticle *posDaughter = MCPhoton->GetPositiveMCDaughter(fMCStack);
1269  TParticle *negDaughter = MCPhoton->GetNegativeMCDaughter(fMCStack);
1270  if(posDaughter==NULL || negDaughter==NULL) return kFALSE;
1271  Int_t pdgCodePos = 0;
1272  Int_t pdgCodeNeg = 0;
1273  Bool_t IsItGammaSignal = kFALSE;
1274 
1275  if( (posDaughter->GetMother(0) == negDaughter->GetMother(0)) ) {
1276  pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
1277  pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
1278  if(pdgCodePos==11 && pdgCodeNeg==11) IsItGammaSignal = kTRUE;
1279  }else{
1280  IsItGammaSignal = kFALSE;
1281  }
1282 
1283  return IsItGammaSignal;
1284 
1285 }
1286 //_____________________________________________________________________________
1288 
1289 
1290  TParticle *posDaughter = MCPhoton->GetPositiveMCDaughter(fMCStack);
1291  TParticle *negDaughter = MCPhoton->GetNegativeMCDaughter(fMCStack);
1292  if(posDaughter==NULL || negDaughter==NULL) return kFALSE;
1293  Int_t pdgCodePos = 0;
1294  Int_t pdgCodeNeg = 0;
1295  Bool_t IsItElectronElectron = kFALSE;
1296 
1297  if( (posDaughter->GetMother(0) != negDaughter->GetMother(0)) || (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1) ) {
1298  pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
1299  pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
1300  if(pdgCodePos==11 && pdgCodeNeg==11) IsItElectronElectron = kTRUE;
1301  }else{
1302  IsItElectronElectron = kFALSE;
1303  }
1304 
1305  return IsItElectronElectron;
1306 
1307 }
1308 //_____________________________________________________________________________
1310 
1311  if(MCPhoton->GetPdgCode()!=22) return kFALSE;
1312  if(MCPhoton->GetNDaughters() != 2) return kFALSE;
1313  TParticle *posDaughter = (TParticle*)fMCStack->Particle(MCPhoton->GetFirstDaughter());
1314  TParticle *negDaughter = (TParticle*)fMCStack->Particle(MCPhoton->GetLastDaughter());
1315  if(posDaughter==NULL || negDaughter==NULL) return kFALSE;
1316  if(posDaughter->GetUniqueID() != 5 || negDaughter->GetUniqueID() != 5) return kFALSE;
1317  Int_t pdgCodePos = 0;
1318  Int_t pdgCodeNeg = 0;
1319  Bool_t IsItPhoton = kFALSE;
1320 
1321  if(posDaughter->GetMother(0) == negDaughter->GetMother(0)) {
1322  pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
1323  pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
1324  if(pdgCodePos==11 && pdgCodeNeg==11) IsItPhoton = kTRUE;
1325  }else{
1326  IsItPhoton = kFALSE;
1327  }
1328 
1329  return IsItPhoton;
1330 
1331 }
1332 //_____________________________________________________________________________
1334 
1335 
1336  TParticle *posDaughter = MCPhoton->GetPositiveMCDaughter(fMCStack);
1337  TParticle *negDaughter = MCPhoton->GetNegativeMCDaughter(fMCStack);
1338  if(posDaughter==NULL || negDaughter==NULL) return kFALSE;
1339 
1340  Int_t pdgCodePos = 0;
1341  Int_t pdgCodeNeg = 0;
1342  Int_t TemplateID = -1;
1343 
1344  pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
1345  pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
1346 
1347  if(pdgCodePos==11 && pdgCodeNeg==11) TemplateID = 0; //signal -> e+ e-
1348  if(pdgCodePos==211 && pdgCodeNeg==211) TemplateID = 1; //pi pi 211 211
1349  if((pdgCodePos==211 && pdgCodeNeg==11) || (pdgCodePos==11 && pdgCodeNeg==211)) TemplateID = 2; //pi e 211 11
1350  if((pdgCodePos==211 && pdgCodeNeg==321) || (pdgCodePos==321 && pdgCodeNeg==211)) TemplateID = 3; //pi K 211 321
1351  if((pdgCodePos==211 && pdgCodeNeg==2212) || (pdgCodePos==2212 && pdgCodeNeg==211))TemplateID = 4; //pi p 211 2212
1352  if((pdgCodePos==11 && pdgCodeNeg==321) || (pdgCodePos==321 && pdgCodeNeg==11)) TemplateID = 5; //e K 11 321
1353  if((pdgCodePos==11 && pdgCodeNeg==2212) || (pdgCodePos==2212 && pdgCodeNeg==11)) TemplateID = 6; //e p 11 2212
1354  if(pdgCodePos==321 && pdgCodeNeg==321) TemplateID = 7; //K K 321 321
1355  if(pdgCodePos!=11 && pdgCodeNeg!=11 && TemplateID == -1) TemplateID = 8; //hadronic not 11 11
1356 
1357 // cout << "TEMPLATE ID IS: " << TemplateID << endl;
1358  return TemplateID;
1359 
1360 }
1361 //_____________________________________________________________________________
1363 
1364  Float_t gamma1_Eta = 0; Float_t gamma1_Phi = 0; Float_t gamma1_Pt = 0;
1365  Float_t gamma2_Eta = 0; Float_t gamma2_Phi = 0; Float_t gamma2_Pt = 0;
1366 
1367  Float_t dPhi = 0; Float_t dRconvVtx = 0;
1368 
1369  Float_t gamma1_Vtx_x = 0; Float_t gamma1_Vtx_y = 0; Float_t gamma1_Vtx_z = 0;
1370  Float_t gamma2_Vtx_x = 0; Float_t gamma2_Vtx_y = 0; Float_t gamma2_Vtx_z = 0;
1371 
1372  for(Int_t i = 0; i < fGammaCandidates->GetEntries(); i++){
1373  AliAODConversionPhoton *gamma1=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(i));
1374  if(!gamma1) return;
1375  gamma1_Eta = gamma1->GetPhotonEta(); gamma1_Phi = gamma1->GetPhotonPhi(); gamma1_Pt = gamma1->GetPhotonPt();
1376  if(gamma1_Eta==0 || gamma1_Phi==0 || gamma1_Pt==0)continue;
1377  gamma1_Vtx_x = gamma1->GetConversionX(); gamma1_Vtx_y = gamma1->GetConversionY(); gamma1_Vtx_z = gamma1->GetConversionZ();
1378  for(Int_t j = i+1; j < fGammaCandidates->GetEntries(); j++){
1379  AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fGammaCandidates->At(j));
1380  if(!gamma2) continue;
1381  gamma2_Eta = gamma2->GetPhotonEta(); gamma2_Phi = gamma2->GetPhotonPhi(); gamma2_Pt = gamma2->GetPhotonPt();
1382  if(gamma2_Eta==0 || gamma2_Phi==0 || gamma2_Pt==0)continue;
1383  gamma2_Vtx_x = gamma2->GetConversionX(); gamma2_Vtx_y = gamma2->GetConversionY(); gamma2_Vtx_z = gamma2->GetConversionZ();
1384  dPhi = TMath::Abs(gamma2_Phi-gamma1_Phi);
1385  if(dPhi > TMath::Pi()) dPhi = TMath::Abs(dPhi-2.0*TMath::Pi());
1386  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));
1387  hdPhidRcandidates[fiCut]->Fill(dPhi,dRconvVtx);
1388  if(fIsMC){
1389  // gamma1 = signal, gamma2 = signal => sigsig
1390  if( MCGammaSignal(gamma1) && MCGammaSignal(gamma2) ) hdPhidRcandidates_MCsigsig[fiCut]->Fill(dPhi,dRconvVtx);
1391  // gamma1 = bkg, gamma2 = signal => bkgsig
1392  if( (MCElectronElectron(gamma1) && MCGammaSignal(gamma2)) || (MCElectronElectron(gamma2) && MCGammaSignal(gamma1)) ) hdPhidRcandidates_MCbkgsig[fiCut]->Fill(dPhi,dRconvVtx);
1393  // gamma1 = bkg, gamma2 = bkg => bkgbkg
1394  if( MCElectronElectron(gamma1) && MCElectronElectron(gamma2) ) hdPhidRcandidates_MCbkgbkg[fiCut]->Fill(dPhi,dRconvVtx);
1395  }
1396  }
1397  }
1398 }
1399 //_____________________________________________________________________________
1401 
1402  Float_t gamma1_Eta = 0; Float_t gamma1_Phi = 0; Float_t gamma1_Pt = 0;
1403  Float_t gamma2_Eta = 0; Float_t gamma2_Phi = 0; Float_t gamma2_Pt = 0;
1404 
1405  Float_t dPhi = 0; Float_t dRconvVtx = 0;
1406 
1407  Float_t gamma1_Vtx_x = 0; Float_t gamma1_Vtx_y = 0; Float_t gamma1_Vtx_z = 0;
1408  Float_t gamma2_Vtx_x = 0; Float_t gamma2_Vtx_y = 0; Float_t gamma2_Vtx_z = 0;
1409 
1410  if(!gamma) return -1;
1411  gamma1_Eta = gamma->GetPhotonEta(); gamma1_Phi = gamma->GetPhotonPhi(); gamma1_Pt = gamma->GetPhotonPt();
1412  if(gamma1_Eta==0 || gamma1_Phi==0 || gamma1_Pt==0) return -1;
1413  gamma1_Vtx_x = gamma->GetConversionX(); gamma1_Vtx_y = gamma->GetConversionY(); gamma1_Vtx_z = gamma->GetConversionZ();
1414  for(Int_t i = 0; i < fReaderGammas->GetEntries(); i++){
1415  if(i==PhotonID) continue;
1416  AliAODConversionPhoton *gamma2=dynamic_cast<AliAODConversionPhoton*>(fReaderGammas->At(i));
1417  if(!gamma2) continue;
1418  gamma2_Eta = gamma2->GetPhotonEta(); gamma2_Phi = gamma2->GetPhotonPhi(); gamma2_Pt = gamma2->GetPhotonPt();
1419  if(gamma2_Eta==0 || gamma2_Phi==0 || gamma2_Pt==0)continue;
1420  gamma2_Vtx_x = gamma2->GetConversionX(); gamma2_Vtx_y = gamma2->GetConversionY(); gamma2_Vtx_z = gamma2->GetConversionZ();
1421  dPhi = TMath::Abs(gamma2_Phi-gamma1_Phi);
1422  if(dPhi > TMath::Pi()) dPhi = TMath::Abs(dPhi-2.0*TMath::Pi());
1423  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));
1424  if(dPhi < 0.04 && dRconvVtx < 7.5) return 1;
1425  }
1426  return 0;
1427 }
TParticle * GetMCParticle(AliStack *fMCStack)
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
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)
void SetParamType(trackParameterType paramType)
void SetReferenceMultiplicity(Int_t m)
UShort_t T(UShort_t m, UShort_t t)
Definition: RingBits.C:60
ClassImp(AliAnalysisTaskGammaConvFlow) AliAnalysisTaskGammaConvFlow
void SetForRPSelection(Bool_t b=kTRUE)
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:80
virtual void Terminate(const Option_t *)
Definition: External.C:212
static AliFlowCommonConstants * GetMaster()
Class handling all kinds of selection cuts for Gamma Conversion analysis.
TParticle * GetPositiveMCDaughter(AliStack *fMCStack)
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:76
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:81
TParticle * GetNegativeMCDaughter(AliStack *fMCStack)
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)