AliPhysics  b76e98e (b76e98e)
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  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(-100),
144  ffillHistograms(kFALSE),
145  fOutputList(NULL),
146  fESDList(NULL),
147  hVertexZ(NULL),
148  hNGoodESDTracks(NULL),
149  hNV0Tracks(NULL),
150  hNContributorsVertex(NULL),
151  hITSClusterPhi(NULL),
152  hGammaPt(NULL),
153  hGammaPhi(NULL),
154  hGammaPhi_Pos(NULL),
155  hGammaPhi_Neg(NULL),
156  hGammaEta(NULL),
157  hGammaChi2perNDF(NULL),
158  hGammaPsiPair(NULL),
159  hGammaArmenteros(NULL),
160  hGammaCosinePointingAngle(NULL),
161  hGammaInvMass(NULL),
162  hElecPt(NULL),
163  hElecEta(NULL),
164  hElecPhi(NULL),
165  hElecNfindableClsTPC(NULL),
166  hPosiNfindableClsTPC(NULL),
167  hElecClsTPC(NULL),
168  hPosiClsTPC(NULL),
169  hElectrondEdxP(NULL),
170  hElectronITSdEdxP(NULL),
171  hElectronTOFP(NULL),
172  hElectronNSigmadEdxP(NULL),
173  hElectronNSigmadEdxEta(NULL),
174  hElectronNSigmaPiondEdxP(NULL),
175  hElectronNSigmaITSP(NULL),
176  hElectronNSigmaTOFP(NULL),
177  hPositrondEdxP(NULL),
178  hPositronITSdEdxP(NULL),
179  hPositronTOFP(NULL),
180  hPositronNSigmadEdxP(NULL),
181  hPositronNSigmadEdxEta(NULL),
182  hPositronNSigmaPiondEdxP(NULL),
183  hPositronNSigmaITSP(NULL),
184  hPositronNSigmaTOFP(NULL),
185  hInvMassPair(NULL),
186  // hGammaXY(NULL),
187  // hGammaZR(NULL),
188  // hElecAsymP(NULL),
189  // fTrueList(NULL),
190  // hTrueResolutionR(NULL),
191  // hTrueResolutionZ(NULL),
192  // hTrueResolutionPhi(NULL),
193  // hTrueGammaPt(NULL),
194  // hTrueGammaPhi(NULL),
195  // hTrueGammaEta(NULL),
196  // hTrueGammaMass(NULL),
197  // hTrueGammaChi2perNDF(NULL),
198  // hTrueGammaPsiPair(NULL),
199  // hTrueGammaQt(NULL),
200  // hTrueGammaCosinePointingAngle(NULL),
201  // hTrueGammaXY(NULL),
202  // hTrueGammaZR(NULL),
203  // hTrueElecPt(NULL),
204  // hTrueElecEta(NULL),
205  // hTrueElecPhi(NULL),
206  // hTrueElecNfindableClsTPC(NULL),
207  // hTruePosiNfindableClsTPC(NULL),
208  // hTrueElecAsymP(NULL),
209  fGammaPt(0),
210  fGammaTheta(0),
211  fGammaChi2NDF(0),
212  fGammaPhotonProp(5),
213  fGammaConvCoord(5),
214  fDaughterProp(24),
215  fKind(0),
216  fIsMC(kFALSE),
217  fnGammaCandidates(1),
218  fMCStackPos(NULL),
219  fMCStackNeg(NULL)
220 {
221  // Default constructor
222 
223  DefineInput(0, TChain::Class());
224  DefineOutput(1, TList::Class());
225  DefineOutput(2, TTree::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>=1.0){
421  fTreeQA = new TTree("PhotonQA","PhotonQA");
422 
423  fTreeQA->Branch("daughterProp",&fDaughterProp);
424  fTreeQA->Branch("recCords",&fGammaConvCoord);
425  fTreeQA->Branch("photonProp",&fGammaPhotonProp);
426  fTreeQA->Branch("pt",&fGammaPt,"fGammaPt/F");
427  fTreeQA->Branch("theta",&fGammaTheta,"fGammaTheta/F");
428  fTreeQA->Branch("chi2ndf",&fGammaChi2NDF,"fGammaChi2NDF/F");
429  if (fIsMC) {
430  fTreeQA->Branch("kind",&fKind,"fKind/b");
431  }
432  }
433 
434  fV0Reader=(AliV0ReaderV1*)AliAnalysisManager::GetAnalysisManager()->GetTask(fV0ReaderName.Data());
435 
439 
440 
441  PostData(1, fOutputList);
442  if(ffillTree>=1.0){
443  OpenFile(2);
444  PostData(2, fTreeQA);
445  }
446 }
447 //_____________________________________________________________________________
449 {
454  }
455 
456 
457  if(!fEventCuts->GetDoEtaShift()) return kTRUE; // No Eta Shift requested, continue
458 
459  if(fEventCuts->GetEtaShift() == 0.0){ // Eta Shift requested but not set, get shift automatically
461  fEventCuts->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
462  return kTRUE;
463  }
464  else{
465  printf(" Gamma Conversion QA Task %s :: Eta Shift Manually Set to %f \n\n",
467  fEventCuts->DoEtaShift(kFALSE); // Eta Shift Set, make sure that it is called only once
468  }
469 
470  return kTRUE;
471 }
472 //________________________________________________________________________
474 
475  Int_t eventQuality = ((AliConvEventCuts*)fV0Reader->GetEventCuts())->GetEventQuality();
476  if(eventQuality != 0){// Event Not Accepted
477  return;
478  }
479  fInputEvent = InputEvent();
480  if(fIsMC) fMCEvent = MCEvent();
481 
482  Int_t eventNotAccepted =
484  if(eventNotAccepted) return; // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
485 
487 
488  if(fMCEvent){
489  if(fEventCuts->GetSignalRejection() != 0){
490  if(fInputEvent->IsA()==AliESDEvent::Class()){
493  fMCEvent);
494  }
495  else if(fInputEvent->IsA()==AliAODEvent::Class()){
498  fInputEvent);
499  }
500  }
501  }
502 
503  if(ffillHistograms){
504  CountTracks();
505  hVertexZ->Fill(fInputEvent->GetPrimaryVertex()->GetZ());
508  hNV0Tracks->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
509  }
510 
511  if(fMCEvent && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
512  RelabelAODPhotonCandidates(kTRUE); // In case of AODMC relabeling MC
513  fV0Reader->RelabelAODs(kTRUE);
514  }
515 
516  // reduce event statistics in the tree by a factor ffilltree
517  Bool_t ffillTreeNew = kFALSE;
518  if(ffillTree>=1.0) {
519  ffillTreeNew = kTRUE;
520  if (ffillTree>1.0) {
521  gRandom->SetSeed(0);
522  if(gRandom->Uniform(ffillTree)>1.0) {
523  ffillTreeNew = kFALSE;
524  }
525  }
526  }
527 
528  for(Int_t firstGammaIndex=0;firstGammaIndex<fConversionGammas->GetEntriesFast();firstGammaIndex++){
529  AliAODConversionPhoton *gamma=dynamic_cast<AliAODConversionPhoton*>(fConversionGammas->At(firstGammaIndex));
530  if (gamma==NULL) continue;
531  if(fMCEvent && fEventCuts->GetSignalRejection() != 0){
533  continue;
535  continue;
536  }
538  continue;
539  }
540 
541  if(ffillTreeNew) ProcessQATree(gamma);
542  if(ffillHistograms) ProcessQA(gamma);
543  }
544 
545  if(fMCEvent && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
546  RelabelAODPhotonCandidates(kFALSE); // Back to ESDMC Label
547  fV0Reader->RelabelAODs(kFALSE);
548  }
549 
550  PostData(1, fOutputList);
551 }
552 
553 
556 
557  // Fill Histograms for QA and MC
558  AliVEvent* event = (AliVEvent*) InputEvent();
559 
560  AliPIDResponse* pidResonse = ((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetPIDResponse();
561 
562  fGammaPt = gamma->GetPhotonPt();
563 
564  fGammaTheta = gamma->Theta();
565  fGammaChi2NDF = gamma->GetChi2perNDF();
566 
567  fGammaPhotonProp(0) = gamma->GetArmenterosQt();
568  fGammaPhotonProp(1) = gamma->GetArmenterosAlpha();
569  fGammaPhotonProp(2) = gamma->GetPsiPair();
571  fGammaPhotonProp(4) = gamma->GetInvMassPair();
572 
573  fGammaConvCoord(0) = gamma->GetConversionX();
574  fGammaConvCoord(1) = gamma->GetConversionY();
575  fGammaConvCoord(2) = gamma->GetConversionZ();
576  fGammaConvCoord(3) = gamma->GetConversionRadius();
577  fGammaConvCoord(4) = gamma->GetPhotonPhi();
578 
579  AliVTrack * negTrack = fConversionCuts->GetTrack(event, gamma->GetTrackLabelNegative());
580  AliVTrack * posTrack = fConversionCuts->GetTrack(event, gamma->GetTrackLabelPositive());
581 
582 
583  if(!negTrack||!posTrack)return;
584 
585  fKind = 9;
586  if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){
587  fKind = IsTruePhotonESD(gamma);
588  } else if (fMCEvent && fInputEvent->IsA()==AliAODEvent::Class()){
589  // cout << "entering IsTruePhotonAOD" << endl;
590  fKind = IsTruePhotonAOD(gamma);
591  }
592 
593  fDaughterProp(0) = posTrack->Pt();
594  fDaughterProp(7) = negTrack->Pt();
595  fDaughterProp(1) = posTrack->Theta();
596  fDaughterProp(8) = negTrack->Theta();
597  // dEdx TPC
598  fDaughterProp(2) = posTrack->GetTPCsignal();
599  fDaughterProp(3) = pidResonse->NumberOfSigmasTPC(posTrack,AliPID::kElectron);
600  fDaughterProp(22) = pidResonse->NumberOfSigmasTPC(posTrack,AliPID::kPion);
601  fDaughterProp(9) = negTrack->GetTPCsignal();
602  fDaughterProp(10) = pidResonse->NumberOfSigmasTPC(negTrack,AliPID::kElectron);
603  fDaughterProp(23) = pidResonse->NumberOfSigmasTPC(negTrack,AliPID::kPion);
604  Int_t nPosClusterITS = 0;
605  Int_t nNegClusterITS = 0;
606  for(Int_t itsLayer = 0; itsLayer<6;itsLayer++){
607  if(TESTBIT(negTrack->GetITSClusterMap(),itsLayer)){
608  nNegClusterITS++;
609  }
610  if(TESTBIT(posTrack->GetITSClusterMap(),itsLayer)){
611  nPosClusterITS++;
612  }
613  }
614 
615  // ITS signal
616  fDaughterProp(14) = (Float_t)nPosClusterITS;
617  fDaughterProp(15) = (Float_t)nNegClusterITS;
618  if (nPosClusterITS > 0 ){
619  fDaughterProp(16) = posTrack->GetITSsignal();
620  fDaughterProp(20) = pidResonse->NumberOfSigmasITS(posTrack,AliPID::kElectron);
621  } else {
622  fDaughterProp(16) = 1000;
623  fDaughterProp(20) = 20;
624  }
625  if (nNegClusterITS > 0 ){
626  fDaughterProp(17) = negTrack->GetITSsignal();
627  fDaughterProp(21) = pidResonse->NumberOfSigmasITS(negTrack,AliPID::kElectron);
628  } else {
629  fDaughterProp(17) = 1000;
630  fDaughterProp(21) = 20;
631  }
632 
633  // TOF
634  if((posTrack->GetStatus() & AliESDtrack::kTOFpid) && !(posTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
635  Double_t t0pos = pidResonse->GetTOFResponse().GetStartTime(posTrack->P());
636  Double_t timesPos[9];
637  posTrack->GetIntegratedTimes(timesPos,9);
638  Double_t TOFsignalPos = posTrack->GetTOFsignal();
639  Double_t dTpos = TOFsignalPos - t0pos - timesPos[0];
640  fDaughterProp(4) = dTpos;
641  fDaughterProp(5) = pidResonse->NumberOfSigmasTOF(posTrack, AliPID::kElectron);
642  } else {
643  fDaughterProp(4) = 20000;
644  fDaughterProp(5) = -20;
645  }
646  if((negTrack->GetStatus() & AliESDtrack::kTOFpid) && !(negTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
647  Double_t t0neg = pidResonse->GetTOFResponse().GetStartTime(negTrack->P());
648  Double_t timesNeg[9];
649  negTrack->GetIntegratedTimes(timesNeg,9);
650  Double_t TOFsignalNeg = negTrack->GetTOFsignal();
651  Double_t dTneg = TOFsignalNeg - t0neg - timesNeg[0];
652  fDaughterProp(11) = dTneg;
653  fDaughterProp(12) = pidResonse->NumberOfSigmasTOF(negTrack, AliPID::kElectron);
654  } else {
655  fDaughterProp(11) = 20000;
656  fDaughterProp(12) = -20;
657  }
658 
659  fDaughterProp(6) = (Float_t)posTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius()));
660  fDaughterProp(18) = posTrack->GetNcls(1);
661  fDaughterProp(13) = (Float_t)negTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius()));
662  fDaughterProp(19) = negTrack->GetNcls(1);
663 
664  if (fTreeQA){
665  fTreeQA->Fill();
666  }
667 }
668 
669 //_____________________________________________________________________________________________________
671 
672  AliPIDResponse* pidResonse = ((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetPIDResponse();
673 
674  // Fill Histograms for QA and MC
675 
676  hGammaPt->Fill(gamma->GetPhotonPt());
677  hGammaPhi->Fill(gamma->GetPhotonPhi());
678  if(gamma->Eta() >= 0.00001){hGammaPhi_Pos->Fill(gamma->Phi());}
679  if(gamma->Eta() <= 0.00001){hGammaPhi_Neg->Fill(gamma->Phi());}
680  hGammaEta->Fill(gamma->Eta());
681  hGammaChi2perNDF->Fill(gamma->GetChi2perNDF());
682  hGammaPsiPair->Fill(gamma->GetPsiPair());
683  hGammaArmenteros->Fill(gamma->GetArmenterosAlpha(),gamma->GetArmenterosQt());
685  hGammaInvMass->Fill(gamma->GetMass());
686  hInvMassPair->Fill(gamma->GetInvMassPair(),gamma->GetPhotonPt());
687  // hGammaXY->Fill(gamma->GetConversionX(),gamma->GetConversionY());
688  // hGammaZR->Fill(gamma->GetConversionZ(),gamma->GetConversionRadius());
689 
690  AliVTrack * negTrack = fConversionCuts->GetTrack(fInputEvent, gamma->GetTrackLabelNegative());
691  AliVTrack * posTrack = fConversionCuts->GetTrack(fInputEvent, gamma->GetTrackLabelPositive());
692  if(!negTrack||!posTrack)return;
693 
694 
695  hElecPt->Fill(negTrack->Pt(),posTrack->Pt());
696  hElecEta->Fill(negTrack->Eta(),posTrack->Eta());
697  hElecPhi->Fill(negTrack->Phi(),posTrack->Phi());
698 
699  hElecNfindableClsTPC->Fill((Float_t)posTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius())));
700  hPosiNfindableClsTPC->Fill((Float_t)negTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius())));
701  hElecClsTPC->Fill(negTrack->GetNcls(1));
702  hPosiClsTPC->Fill(posTrack->GetNcls(1));
703  //TPC dEdx
704  hElectrondEdxP->Fill(negTrack->P() ,negTrack->GetTPCsignal());
705  hElectronNSigmadEdxP->Fill(negTrack->P() ,pidResonse->NumberOfSigmasTPC(negTrack, AliPID::kElectron));
706  hElectronNSigmadEdxEta->Fill(negTrack->Eta() ,pidResonse->NumberOfSigmasTPC(negTrack, AliPID::kElectron));
707  hElectronNSigmaPiondEdxP->Fill(negTrack->P() ,pidResonse->NumberOfSigmasTPC(negTrack, AliPID::kPion));
708  hPositrondEdxP->Fill(posTrack->P() ,posTrack->GetTPCsignal());
709  hPositronNSigmadEdxP->Fill(posTrack->P() ,pidResonse->NumberOfSigmasTPC(posTrack, AliPID::kElectron));
710  hPositronNSigmadEdxEta->Fill(posTrack->Eta() ,pidResonse->NumberOfSigmasTPC(posTrack, AliPID::kElectron));
711  hPositronNSigmaPiondEdxP->Fill(posTrack->P() ,pidResonse->NumberOfSigmasTPC(posTrack, AliPID::kPion));
712 
713  //TOF signal
714  if((negTrack->GetStatus() & AliESDtrack::kTOFpid)==0 && !(negTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
715  Double_t t0neg = pidResonse->GetTOFResponse().GetStartTime(negTrack->P());
716  Double_t timesNeg[9];
717  negTrack->GetIntegratedTimes(timesNeg,9);
718  Double_t TOFsignalNeg = negTrack->GetTOFsignal();
719  Double_t dTneg = TOFsignalNeg - t0neg - timesNeg[0];
720  hElectronTOFP->Fill(negTrack->P() ,dTneg);
721  hElectronNSigmaTOFP->Fill(negTrack->P() ,pidResonse->NumberOfSigmasTOF(negTrack, AliPID::kElectron));
722  }
723  if((posTrack->GetStatus() & AliESDtrack::kTOFpid)==0 && !(posTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
724  Double_t t0pos = pidResonse->GetTOFResponse().GetStartTime(posTrack->P());
725  Double_t timesPos[9];
726  posTrack->GetIntegratedTimes(timesPos,9);
727  Double_t TOFsignalPos = posTrack->GetTOFsignal();
728  Double_t dTpos = TOFsignalPos - t0pos - timesPos[0];
729  hPositronTOFP->Fill(posTrack->P() ,dTpos);
730  hPositronNSigmaTOFP->Fill(posTrack->P() ,pidResonse->NumberOfSigmasTOF(posTrack, AliPID::kElectron));
731  }
732 
733  Int_t nPosClusterITS = 0;
734  Int_t nNegClusterITS = 0;
735  for(Int_t itsLayer = 0; itsLayer<6;itsLayer++){
736  if(TESTBIT(negTrack->GetITSClusterMap(),itsLayer)){
737  nNegClusterITS++;
738  }
739  if(TESTBIT(posTrack->GetITSClusterMap(),itsLayer)){
740  nPosClusterITS++;
741  }
742  }
743  Double_t negtrackPhi = negTrack->Phi();
744  Double_t postrackPhi = posTrack->Phi();
745  hITSClusterPhi->Fill(negtrackPhi,nNegClusterITS);
746  hITSClusterPhi->Fill(postrackPhi,nPosClusterITS);
747 
748  // ITS signal
749  if (nPosClusterITS > 0 ){
750  hPositronITSdEdxP->Fill(posTrack->P() ,posTrack->GetITSsignal());
751  hPositronNSigmaITSP->Fill(posTrack->P() ,pidResonse->NumberOfSigmasITS(posTrack,AliPID::kElectron));
752  }
753  if (nNegClusterITS > 0 ){
754  hElectronITSdEdxP->Fill(negTrack->P() ,negTrack->GetITSsignal());
755  hElectronNSigmaITSP->Fill(negTrack->P() ,pidResonse->NumberOfSigmasITS(negTrack,AliPID::kElectron));
756  }
757 
758 
759 }
760 
761 
762 //________________________________________________________________________
764 
765  if(fInputEvent->IsA()==AliESDEvent::Class()){
766  // Using standard function for setting Cuts
767  Bool_t selectPrimaries=kTRUE;
768  AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
769  EsdTrackCuts->SetMaxDCAToVertexZ(2);
770  EsdTrackCuts->SetEtaRange(-0.8, 0.8);
771  EsdTrackCuts->SetPtRange(0.15);
772  fNumberOfESDTracks = 0;
773  for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
774  AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
775  if(!curTrack) continue;
776  if(EsdTrackCuts->AcceptTrack(curTrack) ) fNumberOfESDTracks++;
777  }
778  delete EsdTrackCuts;
779  EsdTrackCuts=0x0;
780  }
781  else if(fInputEvent->IsA()==AliAODEvent::Class()){
782  fNumberOfESDTracks = 0;
783  for(Int_t iTracks = 0; iTracks<fInputEvent->GetNumberOfTracks(); iTracks++){
784  AliAODTrack* curTrack = (AliAODTrack*) fInputEvent->GetTrack(iTracks);
785  if(curTrack->GetID()<0) continue; // Avoid double counting of tracks
786  if(!curTrack->IsHybridGlobalConstrainedGlobal()) continue;
787  if(TMath::Abs(curTrack->Eta())>0.8) continue;
788  if(curTrack->Pt()<0.15) continue;
790  }
791  }
792  return;
793 }
794 
796 {
797  UInt_t kind = 9;
798  TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCEvent);
799  TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCEvent);
800  Int_t pdgCodePos = 0;
801  Int_t pdgCodeNeg = 0;
802  Int_t pdgCode = 0;
803 
804  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
805  Double_t mcProdVtxX = primVtxMC->GetX();
806  Double_t mcProdVtxY = primVtxMC->GetY();
807  Double_t mcProdVtxZ = primVtxMC->GetZ();
808 
809 
810  if(posDaughter == NULL || negDaughter == NULL) {
811  kind = 9;
812  // return kFALSE; // One particle does not exist
813 
814  } else if( posDaughter->GetMother(0) != negDaughter->GetMother(0) || (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1)) {
815  kind = 1;
816  // return 1;
817  pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
818  pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
819  if(pdgCodePos==11 && pdgCodeNeg==11) return 10; //Electron Combinatorial
820  if(pdgCodePos==11 && pdgCodeNeg==11 &&
821  (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1)) return 15; //direct Electron Combinatorial
822 
823  if(pdgCodePos==211 && pdgCodeNeg==211) kind = 11; //Pion Combinatorial
824  if((pdgCodePos==211 && pdgCodeNeg==2212) ||(pdgCodePos==2212 && pdgCodeNeg==211)) kind = 12; //Pion, Proton Combinatorics
825  if((pdgCodePos==11 && pdgCodeNeg==2212) ||(pdgCodePos==2212 && pdgCodeNeg==11)) kind = 16; //electron, Proton Combinatorics
826  if((pdgCodePos==11 && pdgCodeNeg==321) ||(pdgCodePos==321 && pdgCodeNeg==11)) kind = 17; //electron, kaon
827  if((pdgCodePos==211 && pdgCodeNeg==321) ||(pdgCodePos==321 && pdgCodeNeg==211)) kind = 18; //pion, kaon
828  if((pdgCodePos==211 && pdgCodeNeg==11) ||(pdgCodePos==11 && pdgCodeNeg==211)) kind = 13; //Pion, Electron Combinatorics
829  if(pdgCodePos==321 && pdgCodeNeg==321) kind = 14; //Kaon,Kaon combinatorics
830  }else{
831  pdgCodePos=posDaughter->GetPdgCode();
832  pdgCodeNeg=negDaughter->GetPdgCode();
833  Bool_t gammaIsPrimary = fEventCuts->IsConversionPrimaryESD( fMCEvent, posDaughter->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
834  if ( TruePhotonCandidate->GetMCParticle(fMCEvent)->GetPdgCode()) pdgCode = TruePhotonCandidate->GetMCParticle(fMCEvent)->GetPdgCode();
835 
836  if(TMath::Abs(pdgCodePos)!=11 || TMath::Abs(pdgCodeNeg)!=11) return 2; // true from hadronic decays
837  else if ( !(pdgCodeNeg==pdgCodePos)){
838  if(pdgCode == 111) return 3; // pi0 Dalitz
839  else if (pdgCode == 221) return 4; // eta Dalitz
840  else if (!(negDaughter->GetUniqueID() != 5 || posDaughter->GetUniqueID() !=5)){
841  if(pdgCode == 22 && gammaIsPrimary){
842  return 0; // primary photons
843  } else if (pdgCode == 22){
844  return 5; //secondary photons
845  }
846  }
847  }
848  }
849 
850  return kind;
851 }
852 
853 //________________________________________________________________________
855 {
856 
857  UInt_t kind = 9;
858  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
859  if (AODMCTrackArray!=NULL && TruePhotonCandidate!=NULL){
860  AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
861  AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
862  Int_t pdgCodePos = 0;
863  Int_t pdgCodeNeg = 0;
864  Int_t pdgCode = 0;
865  if(posDaughter == NULL || negDaughter == NULL) {
866  kind = 9;
867  } else if( posDaughter->GetMother() != negDaughter->GetMother() || (posDaughter->GetMother() == negDaughter->GetMother() && posDaughter->GetMother() ==-1)) {
868  kind = 1;
869  pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
870  pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
871  if(pdgCodePos==11 && pdgCodeNeg==11) kind = 10; //Electron Combinatorial
872  if(pdgCodePos==11 && pdgCodeNeg==11 &&
873  (posDaughter->GetMother() == negDaughter->GetMother() && posDaughter->GetMother() ==-1))kind = 15; //direct Electron Combinatorial
874 
875  if(pdgCodePos==211 && pdgCodeNeg==211) kind = 11; //Pion Combinatorial
876  if((pdgCodePos==211 && pdgCodeNeg==2212) ||(pdgCodePos==2212 && pdgCodeNeg==211)) kind = 12; //Pion, Proton Combinatorics
877  if((pdgCodePos==11 && pdgCodeNeg==2212) ||(pdgCodePos==2212 && pdgCodeNeg==11)) kind = 16; //electron, Proton Combinatorics
878  if((pdgCodePos==11 && pdgCodeNeg==321) ||(pdgCodePos==321 && pdgCodeNeg==11)) kind = 17; //electron, kaon
879  if((pdgCodePos==211 && pdgCodeNeg==321) ||(pdgCodePos==321 && pdgCodeNeg==211)) kind = 18; //pion, kaon
880  if((pdgCodePos==211 && pdgCodeNeg==11) ||(pdgCodePos==11 && pdgCodeNeg==211)) kind = 13; //Pion, Electron Combinatorics
881  if(pdgCodePos==321 && pdgCodeNeg==321) kind = 14; //Kaon,Kaon combinatorics
882  }else{
883  AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
884  pdgCodePos=posDaughter->GetPdgCode();
885  pdgCodeNeg=negDaughter->GetPdgCode();
886 
887  if ( Photon->GetPdgCode())
888  pdgCode = Photon->GetPdgCode();
889  if(TMath::Abs(pdgCodePos)!=11 || TMath::Abs(pdgCodeNeg)!=11) kind = 2; // true from hadronic decays
890  else if ( !(pdgCodeNeg==pdgCodePos)){
891  if(pdgCode == 111) kind = 3; // pi0 Dalitz
892  else if (pdgCode == 221) kind = 4; // eta Dalitz
893  else if (!(negDaughter->GetMCProcessCode() != 5 || posDaughter->GetMCProcessCode() !=5)){
894  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
895  Double_t mcProdVtxX = primVtxMC->GetX();
896  Double_t mcProdVtxY = primVtxMC->GetY();
897  Double_t mcProdVtxZ = primVtxMC->GetZ();
898  Bool_t isPrimary = fEventCuts->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
899 
900  if(pdgCode == 22 && isPrimary){
901  kind = 0; // primary photons
902  } else if (pdgCode == 22){
903  kind = 5; //secondary photons
904  }
905  }
906  }
907  }
908 
909  return kind;
910  }
911  return kind;
912 }
913 
914 //________________________________________________________________________
916 
917  // Relabeling For AOD Event
918  // ESDiD -> AODiD
919  // MCLabel -> AODMCLabel
920 
921  if(mode){
922  fMCStackPos = new Int_t[fConversionGammas->GetEntries()];
923  fMCStackNeg = new Int_t[fConversionGammas->GetEntries()];
924  }
925 
926  for(Int_t iGamma = 0;iGamma<fConversionGammas->GetEntries();iGamma++){
927  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fConversionGammas->At(iGamma);
928  if(!PhotonCandidate) continue;
929  if(!mode){// Back to ESD Labels
930  PhotonCandidate->SetMCLabelPositive(fMCStackPos[iGamma]);
931  PhotonCandidate->SetMCLabelNegative(fMCStackNeg[iGamma]);
932  //PhotonCandidate->IsAODMCLabel(kFALSE);
933  continue;
934  }
935  fMCStackPos[iGamma] = PhotonCandidate->GetMCLabelPositive();
936  fMCStackNeg[iGamma] = PhotonCandidate->GetMCLabelNegative();
937 
938  Bool_t AODLabelPos = kFALSE;
939  Bool_t AODLabelNeg = kFALSE;
940 
941  for(Int_t i = 0; i<fInputEvent->GetNumberOfTracks();i++){
942  AliAODTrack *tempDaughter = static_cast<AliAODTrack*>(fInputEvent->GetTrack(i));
943  if(!AODLabelPos){
944  if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelPositive() ){
945  PhotonCandidate->SetMCLabelPositive(TMath::Abs(tempDaughter->GetLabel()));
946  AODLabelPos = kTRUE;
947  }
948  }
949  if(!AODLabelNeg){
950  if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelNegative()){
951  PhotonCandidate->SetMCLabelNegative(TMath::Abs(tempDaughter->GetLabel()));
952  AODLabelNeg = kTRUE;
953  }
954  }
955  if(AODLabelNeg && AODLabelPos){
956  break;
957  }
958  } // Both ESD Tracks have AOD Tracks with Positive IDs
959  if(!AODLabelPos || !AODLabelNeg){
960  for(Int_t i = 0; i<fInputEvent->GetNumberOfTracks();i++){
961  AliAODTrack *tempDaughter = static_cast<AliAODTrack*>(fInputEvent->GetTrack(i));
962  if(tempDaughter->GetID()<0){
963  if(!AODLabelPos){
964  if( (TMath::Abs(tempDaughter->GetID())-1) == PhotonCandidate->GetTrackLabelPositive()){
965  PhotonCandidate->SetMCLabelPositive(TMath::Abs(tempDaughter->GetLabel()));
966  AODLabelPos = kTRUE;
967  }
968  }
969  if(!AODLabelNeg){
970  if( (TMath::Abs(tempDaughter->GetID())-1) == PhotonCandidate->GetTrackLabelNegative()){
971  PhotonCandidate->SetMCLabelNegative(TMath::Abs(tempDaughter->GetLabel()));
972  AODLabelNeg = kTRUE;
973  }
974  }
975  }
976  if(AODLabelNeg && AODLabelPos){
977  break;
978  }
979  }
980  if(!AODLabelPos || !AODLabelNeg){
981  cout<<"WARNING!!! AOD TRACKS NOT FOUND FOR"<<endl;
982  if(!AODLabelNeg){
983  PhotonCandidate->SetMCLabelNegative(-999999);
984  PhotonCandidate->SetLabelNegative(-999999);
985  }
986  if(!AODLabelPos){
987  PhotonCandidate->SetMCLabelPositive(-999999);
988  PhotonCandidate->SetLabelPositive(-999999);
989  }
990  }
991  }
992  }
993 
994  if(!mode){
995  delete[] fMCStackPos;
996  delete[] fMCStackNeg;
997  }
998 }
999 
1001  TAxis *axisafter = histoRebin->GetXaxis();
1002  Int_t bins = axisafter->GetNbins();
1003  Double_t from = axisafter->GetXmin();
1004  Double_t to = axisafter->GetXmax();
1005  Double_t *newbins = new Double_t[bins+1];
1006  newbins[0] = from;
1007  Double_t factor = TMath::Power(to/from, 1./bins);
1008  for(Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
1009  axisafter->Set(bins, newbins);
1010  delete [] newbins;
1011 
1012 }
1013 
1014 //________________________________________________________________________
1016 {
1017 
1018 }
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 * OpenFile(const char *fname)
Definition: DrawAnaELoss.C:65
TList * GetV0FindingEfficiencyHistograms()