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