AliPhysics  e6c8d43 (e6c8d43)
AliAnalysisTaskConversionQA.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Authors: Svein Lindal, Daniel Lohner *
5  * Version 1.0 *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
17 //---------------------------------------------
18 // QA Task for V0 Reader V1
19 //---------------------------------------------
21 
23 #include "TChain.h"
24 #include "TRandom.h"
25 #include "AliAnalysisManager.h"
26 #include "TParticle.h"
27 #include "TVectorF.h"
28 #include "AliPIDResponse.h"
29 #include "TFile.h"
30 #include "AliESDtrackCuts.h"
31 #include "AliAODMCParticle.h"
32 #include "AliAODMCHeader.h"
33 #include "AliAODEvent.h"
34 
35 class iostream;
36 
37 using namespace std;
38 
40 
41 //________________________________________________________________________
43  fV0Reader(NULL),
44  fV0ReaderName("V0ReaderV1"),
45  fConversionGammas(NULL),
46  fConversionCuts(NULL),
47  fEventCuts(NULL),
48  fInputEvent(NULL),
49  fNumberOfESDTracks(0),
50  fMCEvent(NULL),
51  fTreeQA(NULL),
52  fIsHeavyIon(kFALSE),
53  ffillTree(-100),
54  ffillHistograms(kFALSE),
55  fOutputList(NULL),
56  fTreeList(NULL),
57  fESDList(NULL),
58  hVertexZ(NULL),
59  hNGoodESDTracks(NULL),
60  hNV0Tracks(NULL),
61  hNContributorsVertex(NULL),
62  hITSClusterPhi(NULL),
63  hGammaPt(NULL),
64  hGammaPhi(NULL),
65  hGammaPhi_Pos(NULL),
66  hGammaPhi_Neg(NULL),
67  hGammaEta(NULL),
68  hGammaChi2perNDF(NULL),
69  hGammaPsiPair(NULL),
70  hGammaArmenteros(NULL),
71  hGammaCosinePointingAngle(NULL),
72  hGammaInvMass(NULL),
73  hElecPt(NULL),
74  hElecEta(NULL),
75  hElecPhi(NULL),
76  hElecNfindableClsTPC(NULL),
77  hPosiNfindableClsTPC(NULL),
78  hElecClsTPC(NULL),
79  hPosiClsTPC(NULL),
80  hElectrondEdxP(NULL),
81  hElectronITSdEdxP(NULL),
82  hElectronTOFP(NULL),
83  hElectronNSigmadEdxP(NULL),
84  hElectronNSigmadEdxEta(NULL),
85  hElectronNSigmaPiondEdxP(NULL),
86  hElectronNSigmaITSP(NULL),
87  hElectronNSigmaTOFP(NULL),
88  hPositrondEdxP(NULL),
89  hPositronITSdEdxP(NULL),
90  hPositronTOFP(NULL),
91  hPositronNSigmadEdxP(NULL),
92  hPositronNSigmadEdxEta(NULL),
93  hPositronNSigmaPiondEdxP(NULL),
94  hPositronNSigmaITSP(NULL),
95  hPositronNSigmaTOFP(NULL),
96  hInvMassPair(NULL),
97  // hElecAsymP(NULL),
98  // fTrueList(NULL),
99  // hTrueResolutionR(NULL),
100  // hTrueResolutionZ(NULL),
101  // hTrueResolutionPhi(NULL),
102  // hTrueGammaPt(NULL),
103  // hTrueGammaPhi(NULL),
104  // hTrueGammaEta(NULL),
105  // hTrueGammaMass(NULL),
106  // hTrueGammaChi2perNDF(NULL),
107  // hTrueGammaPsiPair(NULL),
108  // hTrueGammaQt(NULL),
109  // hTrueGammaCosinePointingAngle(NULL),
110  // hTrueGammaXY(NULL),
111  // hTrueGammaZR(NULL),
112  // hTrueElecPt(NULL),
113  // hTrueElecEta(NULL),
114  // hTrueElecPhi(NULL),
115  // hTrueElecNfindableClsTPC(NULL),
116  // hTruePosiNfindableClsTPC(NULL),
117  // hTrueElecAsymP(NULL),
118  fGammaPt(0),
119  fGammaTheta(0),
120  fGammaChi2NDF(0),
121  fGammaPhotonProp(5),
122  fGammaConvCoord(5),
123  fDaughterProp(24),
124  fKind(0),
125  fIsMC(kFALSE),
126  fnGammaCandidates(1),
127  fMCStackPos(NULL),
128  fMCStackNeg(NULL)
129 {
130 
131 }
132 
134  fV0Reader(NULL),
135  fV0ReaderName("V0ReaderV1"),
136  fConversionGammas(NULL),
137  fConversionCuts(NULL),
138  fEventCuts(NULL),
139  fInputEvent(NULL),
140  fNumberOfESDTracks(0),
141  fMCEvent(NULL),
142  fTreeQA(NULL),
143  fIsHeavyIon(kFALSE),
144  ffillTree(-100),
145  ffillHistograms(kFALSE),
146  fOutputList(NULL),
147  fTreeList(NULL),
148  fESDList(NULL),
149  hVertexZ(NULL),
150  hNGoodESDTracks(NULL),
151  hNV0Tracks(NULL),
152  hNContributorsVertex(NULL),
153  hITSClusterPhi(NULL),
154  hGammaPt(NULL),
155  hGammaPhi(NULL),
156  hGammaPhi_Pos(NULL),
157  hGammaPhi_Neg(NULL),
158  hGammaEta(NULL),
159  hGammaChi2perNDF(NULL),
160  hGammaPsiPair(NULL),
161  hGammaArmenteros(NULL),
162  hGammaCosinePointingAngle(NULL),
163  hGammaInvMass(NULL),
164  hElecPt(NULL),
165  hElecEta(NULL),
166  hElecPhi(NULL),
167  hElecNfindableClsTPC(NULL),
168  hPosiNfindableClsTPC(NULL),
169  hElecClsTPC(NULL),
170  hPosiClsTPC(NULL),
171  hElectrondEdxP(NULL),
172  hElectronITSdEdxP(NULL),
173  hElectronTOFP(NULL),
174  hElectronNSigmadEdxP(NULL),
175  hElectronNSigmadEdxEta(NULL),
176  hElectronNSigmaPiondEdxP(NULL),
177  hElectronNSigmaITSP(NULL),
178  hElectronNSigmaTOFP(NULL),
179  hPositrondEdxP(NULL),
180  hPositronITSdEdxP(NULL),
181  hPositronTOFP(NULL),
182  hPositronNSigmadEdxP(NULL),
183  hPositronNSigmadEdxEta(NULL),
184  hPositronNSigmaPiondEdxP(NULL),
185  hPositronNSigmaITSP(NULL),
186  hPositronNSigmaTOFP(NULL),
187  hInvMassPair(NULL),
188  // hGammaXY(NULL),
189  // hGammaZR(NULL),
190  // hElecAsymP(NULL),
191  // fTrueList(NULL),
192  // hTrueResolutionR(NULL),
193  // hTrueResolutionZ(NULL),
194  // hTrueResolutionPhi(NULL),
195  // hTrueGammaPt(NULL),
196  // hTrueGammaPhi(NULL),
197  // hTrueGammaEta(NULL),
198  // hTrueGammaMass(NULL),
199  // hTrueGammaChi2perNDF(NULL),
200  // hTrueGammaPsiPair(NULL),
201  // hTrueGammaQt(NULL),
202  // hTrueGammaCosinePointingAngle(NULL),
203  // hTrueGammaXY(NULL),
204  // hTrueGammaZR(NULL),
205  // hTrueElecPt(NULL),
206  // hTrueElecEta(NULL),
207  // hTrueElecPhi(NULL),
208  // hTrueElecNfindableClsTPC(NULL),
209  // hTruePosiNfindableClsTPC(NULL),
210  // hTrueElecAsymP(NULL),
211  fGammaPt(0),
212  fGammaTheta(0),
213  fGammaChi2NDF(0),
214  fGammaPhotonProp(5),
215  fGammaConvCoord(5),
216  fDaughterProp(24),
217  fKind(0),
218  fIsMC(kFALSE),
219  fnGammaCandidates(1),
220  fMCStackPos(NULL),
221  fMCStackNeg(NULL)
222 {
223  // Default constructor
224 
225  DefineInput(0, TChain::Class());
226  DefineOutput(1, TList::Class());
227 }
228 
229 //________________________________________________________________________
231 {
232  // default deconstructor
233 
234 }
235 //________________________________________________________________________
237 {
238  // Create User Output Objects
239 
240  if(fOutputList != NULL){
241  delete fOutputList;
242  fOutputList = NULL;
243  }
244  if(fOutputList == NULL){
245  fOutputList = new TList();
246  fOutputList->SetOwner(kTRUE);
247  }
248 
249  if(ffillHistograms){
250  fESDList = new TList();
251  fESDList->SetOwner(kTRUE);
252  fESDList->SetName("ESD QA");
253  fOutputList->Add(fESDList);
254 
255  hVertexZ = new TH1F("Vertex_Z","Vertex_Z",300,-15,15);
256  fESDList->Add(hVertexZ);
257  hNContributorsVertex = new TH1I("ContrVertex_Z","ContrVertex_Z",3000,0,3000);
259  if(fIsHeavyIon) hNGoodESDTracks = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
260  else hNGoodESDTracks = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
262  if(fIsHeavyIon) hNV0Tracks = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
263  else hNV0Tracks = new TH1I("V0 Multiplicity","V0 Multiplicity",2000,0,2000);
264  fESDList->Add(hNV0Tracks);
265 
266  hITSClusterPhi = new TH2F("ITSClusterPhi","hITSClusterPhi",72,0,2*TMath::Pi(),7,0,7);
267  fESDList->Add(hITSClusterPhi);
268  hGammaPt = new TH1F("Gamma_Pt","Gamma_Pt",250,0,25);
269  fESDList->Add(hGammaPt);
270  hGammaPhi = new TH1F("Gamma_Phi","Gamma_Phi",360,0,2*TMath::Pi());
271  fESDList->Add(hGammaPhi);
272  hGammaPhi_Pos = new TH1F("GammaPhi_EtaPos","GammaPhi_EtaPos",360,0,2*TMath::Pi());
273  fESDList->Add(hGammaPhi_Pos);
274  hGammaPhi_Neg = new TH1F("GammaPhi_EtaNeg","GammaPhi_EtaNeg",360,0,2*TMath::Pi());
275  fESDList->Add(hGammaPhi_Neg);
276 
277  hGammaEta = new TH1F("Gamma_Eta","Gamma_Eta",600,-1.5,1.5);
278  fESDList->Add(hGammaEta);
279  hGammaChi2perNDF = new TH1F("Gamma_Chi2perNDF","Gamma_Chi2perNDF",500,0,100);
281  hGammaPsiPair = new TH1F("Gamma_PsiPair","Gamma_PsiPair",500,0,2);
282  fESDList->Add(hGammaPsiPair);
283  hGammaArmenteros = new TH2F("Gamma_Armenteros","Gamma_Armenteros",200,-1,1,400,0,0.1);
285  hGammaCosinePointingAngle = new TH1F("Gamma_CosinePointingAngle","Gamma_CosinePointingAngle",1000,-1.,1.);
287  hGammaInvMass = new TH1F( "Gamma_InvMass","",200, 0, 0.2);
288  fESDList->Add(hGammaInvMass);
289 
290  hElecPt = new TH2F("Electron_Positron_Pt","Electron_Positron_Pt",250,0,25,250,0,25);
291  fESDList->Add(hElecPt);
292  hElecEta = new TH2F("Electron_Positron_Eta","Electron_Positron_Eta",600,-1.5,1.5,600,-1.5,1.5);
293  fESDList->Add(hElecEta);
294  hElecPhi = new TH2F("Electron_Positron_Phi","Electron_Positron_Phi",360,0,2*TMath::Pi(),360,0,2*TMath::Pi());
295  fESDList->Add(hElecPhi);
296  hElecClsTPC = new TH1F("Electron_ClusterTPC","Electron_ClusterTPC",200,0,200);
297  fESDList->Add(hElecClsTPC);
298  hPosiClsTPC = new TH1F("Positron_ClusterTPC","Positron_ClusterTPC",200,0,200);
299  fESDList->Add(hPosiClsTPC);
300 
301  hElecNfindableClsTPC = new TH1F("Electron_findableClusterTPC","Electron_findableClusterTPC",100,0,1);
303  hPosiNfindableClsTPC = new TH1F("Positron_findableClusterTPC","Positron_findableClusterTPC",100,0,1);
305 
306  hElectrondEdxP = new TH2F("Electron_dEdx_P","Electron_dEdx_P",100, 0.05, 20, 200, 0, 200);
308  fESDList->Add(hElectrondEdxP);
309  hPositrondEdxP = new TH2F("Positron_dEdx_P","Positron_dEdx_P",100, 0.05, 20, 200, 0, 200);
311  fESDList->Add(hPositrondEdxP);
312  hElectronNSigmadEdxP = new TH2F("Electron_NSigmadEdx_P","Electron_NSigmadEdx_P",100, 0.05, 20, 200, -10, 10);
315  hElectronNSigmadEdxEta = new TH2F("Electron_NSigmadEdx_Eta","Electron_NSigmadEdx_Eta",140, -1.4, 1.4, 200, -10, 10);
317  hPositronNSigmadEdxP = new TH2F("Positron_NSigmadEdx_P","Positron_NSigmadEdx_P",100, 0.05, 20, 200, -10, 10);
320  hPositronNSigmadEdxEta = new TH2F("Positron_NSigmadEdx_Eta","Positron_NSigmadEdx_Eta",140, -1.4, 1.4, 200, -10, 10);
322  hElectronNSigmaPiondEdxP = new TH2F("Electron_NSigmaPiondEdx_P","Electron_NSigmaPiondEdx_P",100, 0.05, 20, 200, -10, 10);
325  hPositronNSigmaPiondEdxP = new TH2F("Positron_NSigmaPiondEdx_P","Positron_NSigmaPiondEdx_P",100, 0.05, 20, 200, -10, 10);
328 
329  hElectronTOFP = new TH2F("Electron_TOF_P","Electron_TOF_P",100, 0.05, 20, 600, -1000, 29000);
331  fESDList->Add(hElectronTOFP);
332  hPositronTOFP = new TH2F("Positron_TOF_P","Positron_TOF_P",100, 0.05, 20, 600, -1000, 29000);
334  fESDList->Add(hPositronTOFP);
335  hElectronNSigmaTOFP = new TH2F("Electron_NSigmaTOF_P","Electron_NSigmaTOF_P",100, 0.05, 20, 200, -10, 10);
338  hPositronNSigmaTOFP = new TH2F("Positron_NSigmaTOF_P","Positron_NSigmaTOF_P",100, 0.05, 20, 200, -10, 10);
341 
342  hElectronITSdEdxP = new TH2F("Electron_ITSdEdx_P","Electron_ITSdEdx_P",100, 0.05, 20, 200, 0, 200);
345  hPositronITSdEdxP = new TH2F("Positron_ITSdEdx_P","Positron_ITSdEdx_P",100, 0.05, 20, 200, 0, 200);
348  hElectronNSigmaITSP = new TH2F("Electron_NSigmaITS_P","Electron_NSigmaITS_P",100, 0.05, 20, 200, -10, 10);
351  hPositronNSigmaITSP = new TH2F("Positron_NSigmaITS_P","Positron_NSigmaITS_P",100, 0.05, 20, 200, -10, 10);
354 
355  hInvMassPair = new TH2F("Gamma_InvMassPair_Pt","Gamma invariant mass vs Pt",200,0,0.2,250,0,25);
356  hInvMassPair->SetXTitle("mass (GeV/c)");
357  hInvMassPair->SetYTitle("p_{T} (GeV/c)");
358  fESDList->Add(hInvMassPair);
359 
360  // hGammaXY = new TH2F("Gamma_ConversionPoint_XY","Gamma_ConversionPoint_XY",960,-120,120,960,-120,120);
361  // fESDList->Add(hGammaXY);
362  // hGammaZR= new TH2F("Gamma_ConversionPoint_ZR","Gamma_ConversionPoint_ZR",1200,-150,150,480,0,120);
363  // fESDList->Add(hGammaZR);
364 
365 
366  // hElecAsymP = new TH2F("Electron_Asym_vs_P", "Electron_Asym_vs_P",200,0.,20.,200,0.,1.);
367  // fESDList->Add(hElecAsymP);
368 
369  // if(fIsMC){
370  // fTrueList = new TList();
371  // fTrueList->SetOwner(kTRUE);
372  // fTrueList->SetName("True QA");
373  // fOutputList->Add(fTrueList);
374  //
375  // hTrueResolutionR = new TH2F("True_ConversionPointResolution_R","True_ConversionPointResolution_R",240,0,120,200,-20,20);
376  // fTrueList->Add(hTrueResolutionR);
377  // hTrueResolutionZ = new TH2F("True_ConversionPointResolution_Z","True_ConversionPointResolution_Z",480,-120,120,200,-20,20);
378  // fTrueList->Add(hTrueResolutionZ);
379  // hTrueResolutionPhi = new TH2F("True_ConversionPointResolution_Phi","True_ConversionPointResolution_Phi",360,0,2*TMath::Pi(),200,-TMath::Pi()/30., TMath::Pi()/30.);
380  // fTrueList->Add(hTrueResolutionPhi);
381  //
382  // hTrueGammaPt = new TH1F("True_Gamma_Pt","True_Gamma_Pt",250,0,25);
383  // fTrueList->Add(hTrueGammaPt);
384  // hTrueGammaPhi = new TH1F("True_Gamma_Phi","True_Gamma_Phi",360,0,2*TMath::Pi());
385  // fTrueList->Add(hTrueGammaPhi);
386  // hTrueGammaEta = new TH1F("True_Gamma_Eta","True_Gamma_Eta",600,-1.5,1.5);
387  // fTrueList->Add(hTrueGammaEta);
388  // hTrueGammaMass = new TH1F("True_Gamma_Mass","True_Gamma_Mass",1000,0,0.3);
389  // fTrueList->Add(hTrueGammaMass);
390  // hTrueGammaChi2perNDF = new TH1F("True_Gamma_Chi2perNDF","True_Gamma_Chi2perNDF",500,0,100);
391  // fTrueList->Add(hTrueGammaChi2perNDF);
392  // hTrueGammaPsiPair = new TH1F("True_Gamma_PsiPair","True_Gamma_PsiPair",500,0,2);
393  // fTrueList->Add(hTrueGammaPsiPair);
394  // hTrueGammaQt = new TH1F("True_Gamma_Qt","True_Gamma_Qt",400,0,0.1);
395  // fTrueList->Add(hTrueGammaQt);
396  // hTrueGammaCosinePointingAngle = new TH1F("True_Gamma_CosinePointingAngle","True_Gamma_CosinePointingAngle",900,0.7,1.);
397  // fTrueList->Add(hTrueGammaCosinePointingAngle);
398  // hTrueGammaXY = new TH2F("True_Gamma_ConversionPoint_XY","True_Gamma_ConversionPoint_XY",960,-120,120,960,-120,120);
399  // fTrueList->Add(hTrueGammaXY);
400  // hTrueGammaZR= new TH2F("TrueGamma_ConversionPoint_ZR","TrueGamma_ConversionPoint_ZR",1200,-150,150,480,0,120);
401  // fTrueList->Add(hTrueGammaZR);
402  //
403  // hTrueElecPt = new TH2F("True_Electron_Positron_Pt","True_Electron_Positron_Pt",250,0,25,250,0,25);
404  // fTrueList->Add(hTrueElecPt);
405  // hTrueElecEta = new TH2F("True_Electron_Positron_Eta","True_Electron_Positron_Eta",600,-1.5,1.5,600,-1.5,1.5);
406  // fTrueList->Add(hTrueElecEta);
407  // hTrueElecPhi = new TH2F("True_Electron_Positron_Phi","True_Electron_Positron_Phi",360,0,2*TMath::Pi(),360,0,2*TMath::Pi());
408  // fTrueList->Add(hTrueElecPhi);
409  // hTrueElecNfindableClsTPC = new TH1F("True_Electron_findableClusterTPC","True_Electron_findableClusterTPC",100,0,1);
410  // fTrueList->Add(hTrueElecNfindableClsTPC);
411  // hTruePosiNfindableClsTPC = new TH1F("True_Positron_findableClusterTPC","True_Positron_findableClusterTPC",100,0,1);
412  // fTrueList->Add(hTruePosiNfindableClsTPC);
413  // hTrueElecAsymP = new TH2F("True_Electron_Asym_vs_P", "True_Electron_Asym_vs_P",200,0.,20.,200,0.,1.);
414  // fTrueList->Add(hTrueElecAsymP);
415  // }
418  }
419  }
420 
421  if(ffillTree>=1.0){
422  fTreeList = new TList();
423  fTreeList->SetOwner(kTRUE);
424  if(ffillTree>1.0) fTreeList->SetName(Form("TreeList_%f",ffillTree));
425  else fTreeList->SetName("TreeList");
426  fOutputList->Add(fTreeList);
427 
428  fTreeQA = new TTree("PhotonQA","PhotonQA");
429 
430  fTreeQA->Branch("daughterProp",&fDaughterProp);
431  fTreeQA->Branch("recCords",&fGammaConvCoord);
432  fTreeQA->Branch("photonProp",&fGammaPhotonProp);
433  fTreeQA->Branch("pt",&fGammaPt,"fGammaPt/F");
434  fTreeQA->Branch("theta",&fGammaTheta,"fGammaTheta/F");
435  fTreeQA->Branch("chi2ndf",&fGammaChi2NDF,"fGammaChi2NDF/F");
436  if (fIsMC) {
437  fTreeQA->Branch("kind",&fKind,"fKind/b");
438  }
439  fTreeList->Add(fTreeQA);
440  }
441 
442  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
443 
447 
448 
449  PostData(1, fOutputList);
450 }
451 //_____________________________________________________________________________
453 {
458  }
459 
460 
461  if(!fEventCuts->GetDoEtaShift()) return kTRUE;; // No Eta Shift requested, continue
462 
463  if(fEventCuts->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
465  fEventCuts->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
466  return kTRUE;
467  }
468  else{
469  printf(" Gamma Conversion QA Task %s :: Eta Shift Manually Set to %f \n\n",
471  fEventCuts->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
472  }
473 
474  return kTRUE;
475 }
476 //________________________________________________________________________
478 
479  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
480  if(eventQuality != 0){// Event Not Accepted
481  return;
482  }
483  fInputEvent = InputEvent();
484  if(fIsMC) fMCEvent = MCEvent();
485 
486  Int_t eventNotAccepted =
488  if(eventNotAccepted) return; // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
489 
491 
492  if(fMCEvent){
493  if(fEventCuts->GetSignalRejection() != 0){
494  if(fInputEvent->IsA()==AliESDEvent::Class()){
497  fMCEvent);
498  }
499  else if(fInputEvent->IsA()==AliAODEvent::Class()){
502  fInputEvent);
503  }
504  }
505  }
506 
507  if(ffillHistograms){
508  CountTracks();
509  hVertexZ->Fill(fInputEvent->GetPrimaryVertex()->GetZ());
512  hNV0Tracks->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
513  }
514 
515  if(fMCEvent && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
516  RelabelAODPhotonCandidates(kTRUE); // In case of AODMC relabeling MC
517  fV0Reader->RelabelAODs(kTRUE);
518  }
519 
520  // reduce event statistics in the tree by a factor ffilltree
521  Bool_t ffillTreeNew = kFALSE;
522  if(ffillTree>=1.0) {
523  ffillTreeNew = kTRUE;
524  if (ffillTree>1.0) {
525  gRandom->SetSeed(0);
526  if(gRandom->Uniform(ffillTree)>1.0) {
527  ffillTreeNew = kFALSE;
528  }
529  }
530  }
531 
532  for(Int_t firstGammaIndex=0;firstGammaIndex<fConversionGammas->GetEntriesFast();firstGammaIndex++){
533  AliAODConversionPhoton *gamma=dynamic_cast<AliAODConversionPhoton*>(fConversionGammas->At(firstGammaIndex));
534  if (gamma==NULL) continue;
535  if(fMCEvent && fEventCuts->GetSignalRejection() != 0){
537  continue;
539  continue;
540  }
542  continue;
543  }
544 
545  if(ffillTreeNew) ProcessQATree(gamma);
546  if(ffillHistograms) ProcessQA(gamma);
547  }
548 
549  if(fMCEvent && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
550  RelabelAODPhotonCandidates(kFALSE); // Back to ESDMC Label
551  fV0Reader->RelabelAODs(kFALSE);
552  }
553 
554  PostData(1, fOutputList);
555 }
556 
557 
560 
561  // Fill Histograms for QA and MC
562  AliVEvent* event = (AliVEvent*) InputEvent();
563 
564  AliPIDResponse* pidResonse = ((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetPIDResponse();
565 
566  fGammaPt = gamma->GetPhotonPt();
567 
568  fGammaTheta = gamma->Theta();
569  fGammaChi2NDF = gamma->GetChi2perNDF();
570 
571  fGammaPhotonProp(0) = gamma->GetArmenterosQt();
572  fGammaPhotonProp(1) = gamma->GetArmenterosAlpha();
573  fGammaPhotonProp(2) = gamma->GetPsiPair();
575  fGammaPhotonProp(4) = gamma->GetInvMassPair();
576 
577  fGammaConvCoord(0) = gamma->GetConversionX();
578  fGammaConvCoord(1) = gamma->GetConversionY();
579  fGammaConvCoord(2) = gamma->GetConversionZ();
580  fGammaConvCoord(3) = gamma->GetConversionRadius();
581  fGammaConvCoord(4) = gamma->GetPhotonPhi();
582 
583  AliVTrack * negTrack = fConversionCuts->GetTrack(event, gamma->GetTrackLabelNegative());
584  AliVTrack * posTrack = fConversionCuts->GetTrack(event, gamma->GetTrackLabelPositive());
585 
586 
587  if(!negTrack||!posTrack)return;
588 
589  fKind = 9;
590  if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){
591  fKind = IsTruePhotonESD(gamma);
592  } else if (fMCEvent && fInputEvent->IsA()==AliAODEvent::Class()){
593  // cout << "entering IsTruePhotonAOD" << endl;
594  fKind = IsTruePhotonAOD(gamma);
595  }
596 
597  fDaughterProp(0) = posTrack->Pt();
598  fDaughterProp(7) = negTrack->Pt();
599  fDaughterProp(1) = posTrack->Theta();
600  fDaughterProp(8) = negTrack->Theta();
601  // dEdx TPC
602  fDaughterProp(2) = posTrack->GetTPCsignal();
603  fDaughterProp(3) = pidResonse->NumberOfSigmasTPC(posTrack,AliPID::kElectron);
604  fDaughterProp(22) = pidResonse->NumberOfSigmasTPC(posTrack,AliPID::kPion);
605  fDaughterProp(9) = negTrack->GetTPCsignal();
606  fDaughterProp(10) = pidResonse->NumberOfSigmasTPC(negTrack,AliPID::kElectron);
607  fDaughterProp(23) = pidResonse->NumberOfSigmasTPC(negTrack,AliPID::kPion);
608  Int_t nPosClusterITS = 0;
609  Int_t nNegClusterITS = 0;
610  for(Int_t itsLayer = 0; itsLayer<6;itsLayer++){
611  if(TESTBIT(negTrack->GetITSClusterMap(),itsLayer)){
612  nNegClusterITS++;
613  }
614  if(TESTBIT(posTrack->GetITSClusterMap(),itsLayer)){
615  nPosClusterITS++;
616  }
617  }
618 
619  // ITS signal
620  fDaughterProp(14) = (Float_t)nPosClusterITS;
621  fDaughterProp(15) = (Float_t)nNegClusterITS;
622  if (nPosClusterITS > 0 ){
623  fDaughterProp(16) = posTrack->GetITSsignal();
624  fDaughterProp(20) = pidResonse->NumberOfSigmasITS(posTrack,AliPID::kElectron);
625  } else {
626  fDaughterProp(16) = 1000;
627  fDaughterProp(20) = 20;
628  }
629  if (nNegClusterITS > 0 ){
630  fDaughterProp(17) = negTrack->GetITSsignal();
631  fDaughterProp(21) = pidResonse->NumberOfSigmasITS(negTrack,AliPID::kElectron);
632  } else {
633  fDaughterProp(17) = 1000;
634  fDaughterProp(21) = 20;
635  }
636 
637  // TOF
638  if((posTrack->GetStatus() & AliESDtrack::kTOFpid) && !(posTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
639  Double_t t0pos = pidResonse->GetTOFResponse().GetStartTime(posTrack->P());
640  Double_t timesPos[9];
641  posTrack->GetIntegratedTimes(timesPos,9);
642  Double_t TOFsignalPos = posTrack->GetTOFsignal();
643  Double_t dTpos = TOFsignalPos - t0pos - timesPos[0];
644  fDaughterProp(4) = dTpos;
645  fDaughterProp(5) = pidResonse->NumberOfSigmasTOF(posTrack, AliPID::kElectron);
646  } else {
647  fDaughterProp(4) = 20000;
648  fDaughterProp(5) = -20;
649  }
650  if((negTrack->GetStatus() & AliESDtrack::kTOFpid) && !(negTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
651  Double_t t0neg = pidResonse->GetTOFResponse().GetStartTime(negTrack->P());
652  Double_t timesNeg[9];
653  negTrack->GetIntegratedTimes(timesNeg,9);
654  Double_t TOFsignalNeg = negTrack->GetTOFsignal();
655  Double_t dTneg = TOFsignalNeg - t0neg - timesNeg[0];
656  fDaughterProp(11) = dTneg;
657  fDaughterProp(12) = pidResonse->NumberOfSigmasTOF(negTrack, AliPID::kElectron);
658  } else {
659  fDaughterProp(11) = 20000;
660  fDaughterProp(12) = -20;
661  }
662 
663  fDaughterProp(6) = (Float_t)posTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius()));
664  fDaughterProp(18) = posTrack->GetNcls(1);
665  fDaughterProp(13) = (Float_t)negTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius()));
666  fDaughterProp(19) = negTrack->GetNcls(1);
667 
668  if (fTreeQA){
669  fTreeQA->Fill();
670  }
671 }
672 
673 //_____________________________________________________________________________________________________
675 
676  AliPIDResponse* pidResonse = ((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetPIDResponse();
677 
678  // Fill Histograms for QA and MC
679 
680  hGammaPt->Fill(gamma->GetPhotonPt());
681  hGammaPhi->Fill(gamma->GetPhotonPhi());
682  if(gamma->Eta() >= 0.00001){hGammaPhi_Pos->Fill(gamma->Phi());}
683  if(gamma->Eta() <= 0.00001){hGammaPhi_Neg->Fill(gamma->Phi());}
684  hGammaEta->Fill(gamma->Eta());
685  hGammaChi2perNDF->Fill(gamma->GetChi2perNDF());
686  hGammaPsiPair->Fill(gamma->GetPsiPair());
687  hGammaArmenteros->Fill(gamma->GetArmenterosAlpha(),gamma->GetArmenterosQt());
689  hGammaInvMass->Fill(gamma->GetMass());
690  hInvMassPair->Fill(gamma->GetInvMassPair(),gamma->GetPhotonPt());
691  // hGammaXY->Fill(gamma->GetConversionX(),gamma->GetConversionY());
692  // hGammaZR->Fill(gamma->GetConversionZ(),gamma->GetConversionRadius());
693 
694  AliVTrack * negTrack = fConversionCuts->GetTrack(fInputEvent, gamma->GetTrackLabelNegative());
695  AliVTrack * posTrack = fConversionCuts->GetTrack(fInputEvent, gamma->GetTrackLabelPositive());
696  if(!negTrack||!posTrack)return;
697 
698 
699  hElecPt->Fill(negTrack->Pt(),posTrack->Pt());
700  hElecEta->Fill(negTrack->Eta(),posTrack->Eta());
701  hElecPhi->Fill(negTrack->Phi(),posTrack->Phi());
702 
703  hElecNfindableClsTPC->Fill((Float_t)posTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius())));
704  hPosiNfindableClsTPC->Fill((Float_t)negTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius())));
705  hElecClsTPC->Fill(negTrack->GetNcls(1));
706  hPosiClsTPC->Fill(posTrack->GetNcls(1));
707  //TPC dEdx
708  hElectrondEdxP->Fill(negTrack->P() ,negTrack->GetTPCsignal());
709  hElectronNSigmadEdxP->Fill(negTrack->P() ,pidResonse->NumberOfSigmasTPC(negTrack, AliPID::kElectron));
710  hElectronNSigmadEdxEta->Fill(negTrack->Eta() ,pidResonse->NumberOfSigmasTPC(negTrack, AliPID::kElectron));
711  hElectronNSigmaPiondEdxP->Fill(negTrack->P() ,pidResonse->NumberOfSigmasTPC(negTrack, AliPID::kPion));
712  hPositrondEdxP->Fill(posTrack->P() ,posTrack->GetTPCsignal());
713  hPositronNSigmadEdxP->Fill(posTrack->P() ,pidResonse->NumberOfSigmasTPC(posTrack, AliPID::kElectron));
714  hPositronNSigmadEdxEta->Fill(posTrack->Eta() ,pidResonse->NumberOfSigmasTPC(posTrack, AliPID::kElectron));
715  hPositronNSigmaPiondEdxP->Fill(posTrack->P() ,pidResonse->NumberOfSigmasTPC(posTrack, AliPID::kPion));
716 
717  //TOF signal
718  if((negTrack->GetStatus() & AliESDtrack::kTOFpid)==0 && !(negTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
719  Double_t t0neg = pidResonse->GetTOFResponse().GetStartTime(negTrack->P());
720  Double_t timesNeg[9];
721  negTrack->GetIntegratedTimes(timesNeg,9);
722  Double_t TOFsignalNeg = negTrack->GetTOFsignal();
723  Double_t dTneg = TOFsignalNeg - t0neg - timesNeg[0];
724  hElectronTOFP->Fill(negTrack->P() ,dTneg);
725  hElectronNSigmaTOFP->Fill(negTrack->P() ,pidResonse->NumberOfSigmasTOF(negTrack, AliPID::kElectron));
726  }
727  if((posTrack->GetStatus() & AliESDtrack::kTOFpid)==0 && !(posTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
728  Double_t t0pos = pidResonse->GetTOFResponse().GetStartTime(posTrack->P());
729  Double_t timesPos[9];
730  posTrack->GetIntegratedTimes(timesPos,9);
731  Double_t TOFsignalPos = posTrack->GetTOFsignal();
732  Double_t dTpos = TOFsignalPos - t0pos - timesPos[0];
733  hPositronTOFP->Fill(posTrack->P() ,dTpos);
734  hPositronNSigmaTOFP->Fill(posTrack->P() ,pidResonse->NumberOfSigmasTOF(posTrack, AliPID::kElectron));
735  }
736 
737  Int_t nPosClusterITS = 0;
738  Int_t nNegClusterITS = 0;
739  for(Int_t itsLayer = 0; itsLayer<6;itsLayer++){
740  if(TESTBIT(negTrack->GetITSClusterMap(),itsLayer)){
741  nNegClusterITS++;
742  }
743  if(TESTBIT(posTrack->GetITSClusterMap(),itsLayer)){
744  nPosClusterITS++;
745  }
746  }
747  Double_t negtrackPhi = negTrack->Phi();
748  Double_t postrackPhi = posTrack->Phi();
749  hITSClusterPhi->Fill(negtrackPhi,nNegClusterITS);
750  hITSClusterPhi->Fill(postrackPhi,nPosClusterITS);
751 
752  // ITS signal
753  if (nPosClusterITS > 0 ){
754  hPositronITSdEdxP->Fill(posTrack->P() ,posTrack->GetITSsignal());
755  hPositronNSigmaITSP->Fill(posTrack->P() ,pidResonse->NumberOfSigmasITS(posTrack,AliPID::kElectron));
756  }
757  if (nNegClusterITS > 0 ){
758  hElectronITSdEdxP->Fill(negTrack->P() ,negTrack->GetITSsignal());
759  hElectronNSigmaITSP->Fill(negTrack->P() ,pidResonse->NumberOfSigmasITS(negTrack,AliPID::kElectron));
760  }
761 
762 
763 }
764 
765 
766 //________________________________________________________________________
768 
769  if(fInputEvent->IsA()==AliESDEvent::Class()){
770  // Using standard function for setting Cuts
771  Bool_t selectPrimaries=kTRUE;
772  AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
773  EsdTrackCuts->SetMaxDCAToVertexZ(2);
774  EsdTrackCuts->SetEtaRange(-0.8, 0.8);
775  EsdTrackCuts->SetPtRange(0.15);
776  fNumberOfESDTracks = 0;
777  for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
778  AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
779  if(!curTrack) continue;
780  if(EsdTrackCuts->AcceptTrack(curTrack) ) fNumberOfESDTracks++;
781  }
782  delete EsdTrackCuts;
783  EsdTrackCuts=0x0;
784  }
785  else if(fInputEvent->IsA()==AliAODEvent::Class()){
786  fNumberOfESDTracks = 0;
787  for(Int_t iTracks = 0; iTracks<fInputEvent->GetNumberOfTracks(); iTracks++){
788  AliAODTrack* curTrack = (AliAODTrack*) fInputEvent->GetTrack(iTracks);
789  if(curTrack->GetID()<0) continue; // Avoid double counting of tracks
790  if(!curTrack->IsHybridGlobalConstrainedGlobal()) continue;
791  if(TMath::Abs(curTrack->Eta())>0.8) continue;
792  if(curTrack->Pt()<0.15) continue;
794  }
795  }
796  return;
797 }
798 
800 {
801  UInt_t kind = 9;
802  TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCEvent);
803  TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCEvent);
804  Int_t pdgCodePos = 0;
805  Int_t pdgCodeNeg = 0;
806  Int_t pdgCode = 0;
807 
808  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
809  Double_t mcProdVtxX = primVtxMC->GetX();
810  Double_t mcProdVtxY = primVtxMC->GetY();
811  Double_t mcProdVtxZ = primVtxMC->GetZ();
812 
813 
814  if(posDaughter == NULL || negDaughter == NULL) {
815  kind = 9;
816  // return kFALSE; // One particle does not exist
817 
818  } else if( posDaughter->GetMother(0) != negDaughter->GetMother(0) || (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1)) {
819  kind = 1;
820  // return 1;
821  pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
822  pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
823  if(pdgCodePos==11 && pdgCodeNeg==11) return 10; //Electron Combinatorial
824  if(pdgCodePos==11 && pdgCodeNeg==11 &&
825  (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1)) return 15; //direct Electron Combinatorial
826 
827  if(pdgCodePos==211 && pdgCodeNeg==211) kind = 11; //Pion Combinatorial
828  if((pdgCodePos==211 && pdgCodeNeg==2212) ||(pdgCodePos==2212 && pdgCodeNeg==211)) kind = 12; //Pion, Proton Combinatorics
829  if((pdgCodePos==11 && pdgCodeNeg==2212) ||(pdgCodePos==2212 && pdgCodeNeg==11)) kind = 16; //electron, Proton Combinatorics
830  if((pdgCodePos==11 && pdgCodeNeg==321) ||(pdgCodePos==321 && pdgCodeNeg==11)) kind = 17; //electron, kaon
831  if((pdgCodePos==211 && pdgCodeNeg==321) ||(pdgCodePos==321 && pdgCodeNeg==211)) kind = 18; //pion, kaon
832  if((pdgCodePos==211 && pdgCodeNeg==11) ||(pdgCodePos==11 && pdgCodeNeg==211)) kind = 13; //Pion, Electron Combinatorics
833  if(pdgCodePos==321 && pdgCodeNeg==321) kind = 14; //Kaon,Kaon combinatorics
834  }else{
835  pdgCodePos=posDaughter->GetPdgCode();
836  pdgCodeNeg=negDaughter->GetPdgCode();
837  Bool_t gammaIsPrimary = fEventCuts->IsConversionPrimaryESD( fMCEvent, posDaughter->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
838  if ( TruePhotonCandidate->GetMCParticle(fMCEvent)->GetPdgCode()) pdgCode = TruePhotonCandidate->GetMCParticle(fMCEvent)->GetPdgCode();
839 
840  if(TMath::Abs(pdgCodePos)!=11 || TMath::Abs(pdgCodeNeg)!=11) return 2; // true from hadronic decays
841  else if ( !(pdgCodeNeg==pdgCodePos)){
842  if(pdgCode == 111) return 3; // pi0 Dalitz
843  else if (pdgCode == 221) return 4; // eta Dalitz
844  else if (!(negDaughter->GetUniqueID() != 5 || posDaughter->GetUniqueID() !=5)){
845  if(pdgCode == 22 && gammaIsPrimary){
846  return 0; // primary photons
847  } else if (pdgCode == 22){
848  return 5; //secondary photons
849  }
850  }
851  }
852  }
853 
854  return kind;
855 }
856 
857 //________________________________________________________________________
859 {
860 
861  UInt_t kind = 9;
862  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
863  if (AODMCTrackArray!=NULL && TruePhotonCandidate!=NULL){
864  AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
865  AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
866  Int_t pdgCodePos = 0;
867  Int_t pdgCodeNeg = 0;
868  Int_t pdgCode = 0;
869  if(posDaughter == NULL || negDaughter == NULL) {
870  kind = 9;
871  } else if( posDaughter->GetMother() != negDaughter->GetMother() || (posDaughter->GetMother() == negDaughter->GetMother() && posDaughter->GetMother() ==-1)) {
872  kind = 1;
873  pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
874  pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
875  if(pdgCodePos==11 && pdgCodeNeg==11) kind = 10; //Electron Combinatorial
876  if(pdgCodePos==11 && pdgCodeNeg==11 &&
877  (posDaughter->GetMother() == negDaughter->GetMother() && posDaughter->GetMother() ==-1))kind = 15; //direct Electron Combinatorial
878 
879  if(pdgCodePos==211 && pdgCodeNeg==211) kind = 11; //Pion Combinatorial
880  if((pdgCodePos==211 && pdgCodeNeg==2212) ||(pdgCodePos==2212 && pdgCodeNeg==211)) kind = 12; //Pion, Proton Combinatorics
881  if((pdgCodePos==11 && pdgCodeNeg==2212) ||(pdgCodePos==2212 && pdgCodeNeg==11)) kind = 16; //electron, Proton Combinatorics
882  if((pdgCodePos==11 && pdgCodeNeg==321) ||(pdgCodePos==321 && pdgCodeNeg==11)) kind = 17; //electron, kaon
883  if((pdgCodePos==211 && pdgCodeNeg==321) ||(pdgCodePos==321 && pdgCodeNeg==211)) kind = 18; //pion, kaon
884  if((pdgCodePos==211 && pdgCodeNeg==11) ||(pdgCodePos==11 && pdgCodeNeg==211)) kind = 13; //Pion, Electron Combinatorics
885  if(pdgCodePos==321 && pdgCodeNeg==321) kind = 14; //Kaon,Kaon combinatorics
886  }else{
887  AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
888  pdgCodePos=posDaughter->GetPdgCode();
889  pdgCodeNeg=negDaughter->GetPdgCode();
890 
891  if ( Photon->GetPdgCode())
892  pdgCode = Photon->GetPdgCode();
893  if(TMath::Abs(pdgCodePos)!=11 || TMath::Abs(pdgCodeNeg)!=11) kind = 2; // true from hadronic decays
894  else if ( !(pdgCodeNeg==pdgCodePos)){
895  if(pdgCode == 111) kind = 3; // pi0 Dalitz
896  else if (pdgCode == 221) kind = 4; // eta Dalitz
897  else if (!(negDaughter->GetMCProcessCode() != 5 || posDaughter->GetMCProcessCode() !=5)){
898  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
899  Double_t mcProdVtxX = primVtxMC->GetX();
900  Double_t mcProdVtxY = primVtxMC->GetY();
901  Double_t mcProdVtxZ = primVtxMC->GetZ();
902  Bool_t isPrimary = fEventCuts->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
903 
904  if(pdgCode == 22 && isPrimary){
905  kind = 0; // primary photons
906  } else if (pdgCode == 22){
907  kind = 5; //secondary photons
908  }
909  }
910  }
911  }
912 
913  return kind;
914  }
915  return kind;
916 }
917 
918 //________________________________________________________________________
920 
921  // Relabeling For AOD Event
922  // ESDiD -> AODiD
923  // MCLabel -> AODMCLabel
924 
925  if(mode){
926  fMCStackPos = new Int_t[fConversionGammas->GetEntries()];
927  fMCStackNeg = new Int_t[fConversionGammas->GetEntries()];
928  }
929 
930  for(Int_t iGamma = 0;iGamma<fConversionGammas->GetEntries();iGamma++){
931  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fConversionGammas->At(iGamma);
932  if(!PhotonCandidate) continue;
933  if(!mode){// Back to ESD Labels
934  PhotonCandidate->SetMCLabelPositive(fMCStackPos[iGamma]);
935  PhotonCandidate->SetMCLabelNegative(fMCStackNeg[iGamma]);
936  //PhotonCandidate->IsAODMCLabel(kFALSE);
937  continue;
938  }
939  fMCStackPos[iGamma] = PhotonCandidate->GetMCLabelPositive();
940  fMCStackNeg[iGamma] = PhotonCandidate->GetMCLabelNegative();
941 
942  Bool_t AODLabelPos = kFALSE;
943  Bool_t AODLabelNeg = kFALSE;
944 
945  for(Int_t i = 0; i<fInputEvent->GetNumberOfTracks();i++){
946  AliAODTrack *tempDaughter = static_cast<AliAODTrack*>(fInputEvent->GetTrack(i));
947  if(!AODLabelPos){
948  if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelPositive() ){
949  PhotonCandidate->SetMCLabelPositive(TMath::Abs(tempDaughter->GetLabel()));
950  AODLabelPos = kTRUE;
951  }
952  }
953  if(!AODLabelNeg){
954  if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelNegative()){
955  PhotonCandidate->SetMCLabelNegative(TMath::Abs(tempDaughter->GetLabel()));
956  AODLabelNeg = kTRUE;
957  }
958  }
959  if(AODLabelNeg && AODLabelPos){
960  break;
961  }
962  } // Both ESD Tracks have AOD Tracks with Positive IDs
963  if(!AODLabelPos || !AODLabelNeg){
964  for(Int_t i = 0; i<fInputEvent->GetNumberOfTracks();i++){
965  AliAODTrack *tempDaughter = static_cast<AliAODTrack*>(fInputEvent->GetTrack(i));
966  if(tempDaughter->GetID()<0){
967  if(!AODLabelPos){
968  if( (TMath::Abs(tempDaughter->GetID())-1) == PhotonCandidate->GetTrackLabelPositive()){
969  PhotonCandidate->SetMCLabelPositive(TMath::Abs(tempDaughter->GetLabel()));
970  AODLabelPos = kTRUE;
971  }
972  }
973  if(!AODLabelNeg){
974  if( (TMath::Abs(tempDaughter->GetID())-1) == PhotonCandidate->GetTrackLabelNegative()){
975  PhotonCandidate->SetMCLabelNegative(TMath::Abs(tempDaughter->GetLabel()));
976  AODLabelNeg = kTRUE;
977  }
978  }
979  }
980  if(AODLabelNeg && AODLabelPos){
981  break;
982  }
983  }
984  if(!AODLabelPos || !AODLabelNeg){
985  cout<<"WARNING!!! AOD TRACKS NOT FOUND FOR"<<endl;
986  if(!AODLabelNeg){
987  PhotonCandidate->SetMCLabelNegative(-999999);
988  PhotonCandidate->SetLabelNegative(-999999);
989  }
990  if(!AODLabelPos){
991  PhotonCandidate->SetMCLabelPositive(-999999);
992  PhotonCandidate->SetLabelPositive(-999999);
993  }
994  }
995  }
996  }
997 
998  if(!mode){
999  delete[] fMCStackPos;
1000  delete[] fMCStackNeg;
1001  }
1002 }
1003 
1005  TAxis *axisafter = histoRebin->GetXaxis();
1006  Int_t bins = axisafter->GetNbins();
1007  Double_t from = axisafter->GetXmin();
1008  Double_t to = axisafter->GetXmax();
1009  Double_t *newbins = new Double_t[bins+1];
1010  newbins[0] = from;
1011  Double_t factor = TMath::Power(to/from, 1./bins);
1012  for(Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
1013  axisafter->Set(bins, newbins);
1014  delete [] newbins;
1015 
1016 }
1017 
1018 //________________________________________________________________________
1020 {
1021 
1022 }
TParticle * GetMCParticle(AliMCEvent *mcEvent)
void SetPeriodEnum(TString periodName)
virtual Double_t GetPhotonPhi() const
Int_t IsParticleFromBGEvent(Int_t index, AliMCEvent *mcEvent, AliVEvent *event=0x0, Int_t debug=0)
Cut functions.
Double_t GetArmenterosAlpha() const
double Double_t
Definition: External.C:58
Definition: External.C:236
Int_t GetFirstTPCRow(Double_t radius)
void SetMCLabelNegative(Int_t label)
Bool_t AreAODsRelabeled()
PeriodVar GetPeriodEnum()
void SetPeriodEnumExplicit(PeriodVar periodEnum)
Double_t GetEtaShift()
void DoEtaShift(Bool_t doEtaShift)
TString GetPeriodName()
TParticle * GetPositiveMCDaughter(AliMCEvent *mcEvent)
Int_t GetNumberOfContributorsVtx(AliVEvent *event)
TRandom * gRandom
Bool_t GetProduceV0FindingEfficiency()
TParticle * GetNegativeMCDaughter(AliMCEvent *mcEvent)
AliConversionPhotonCuts * fConversionCuts
void GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliVEvent *event)
Int_t IsEventAcceptedByCut(AliConvEventCuts *ReaderCuts, AliVEvent *event, AliMCEvent *mcEvent, Int_t isHeavyIon, Bool_t isEMCALAnalysis)
int Int_t
Definition: External.C:63
virtual void UserExec(Option_t *option)
Definition: External.C:204
unsigned int UInt_t
Definition: External.C:33
float Float_t
Definition: External.C:68
void SetMCLabelPositive(Int_t label)
Bool_t IsConversionPrimaryESD(AliMCEvent *mcEvent, Long_t eventpos, Double_t prodVtxX, Double_t prodVtxY, Double_t prodVtxZ)
UInt_t IsTruePhotonESD(AliAODConversionPhoton *TruePhotonCandidate)
AliConversionPhotonCuts * GetConversionCuts()
Definition: AliV0ReaderV1.h:89
Class handling all kinds of selection cuts for Gamma Conversion analysis.
Int_t mode
Definition: anaM.C:41
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 GetCorrectEtaShiftFromPeriod()
UInt_t IsTruePhotonAOD(AliAODConversionPhoton *TruePhotonCandidate)
Definition: External.C:220
void SetLabelPositive(Int_t label)
Track labels.
void SetLabelNegative(Int_t label)
TClonesArray * GetReconstructedGammas() const
Definition: AliV0ReaderV1.h:85
AliVTrack * GetTrack(AliVEvent *event, Int_t label)
virtual Double_t GetPhotonPt() const
TList * GetAcceptedHeader()
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
void ProcessQATree(AliAODConversionPhoton *gamma)
bool Bool_t
Definition: External.C:53
Bool_t IsConversionPrimaryAOD(AliVEvent *event, AliAODMCParticle *AODMCParticle, Double_t prodVtxX, Double_t prodVtxY, Double_t prodVtxZ)
void ProcessQA(AliAODConversionPhoton *gamma)
Double_t GetCosineOfPointingAngle(const AliConversionPhotonBase *photon, AliVEvent *event) const
Double_t GetConversionRadius() const
void RelabelAODs(Bool_t relabel=kTRUE)
Bool_t PhotonIsSelected(AliConversionPhotonBase *photon, AliVEvent *event)
TList * GetV0FindingEfficiencyHistograms()