AliPhysics  b752f14 (b752f14)
 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  fMCStack(NULL),
51  fTreeQA(NULL),
52  fIsHeavyIon(kFALSE),
53  ffillTree(kFALSE),
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  fMCStack(NULL),
143  fTreeQA(NULL),
144  fIsHeavyIon(kFALSE),
145  ffillTree(kFALSE),
146  ffillHistograms(kFALSE),
147  fOutputList(NULL),
148  fTreeList(NULL),
149  fESDList(NULL),
150  hVertexZ(NULL),
151  hNGoodESDTracks(NULL),
152  hNV0Tracks(NULL),
153  hNContributorsVertex(NULL),
154  hITSClusterPhi(NULL),
155  hGammaPt(NULL),
156  hGammaPhi(NULL),
157  hGammaPhi_Pos(NULL),
158  hGammaPhi_Neg(NULL),
159  hGammaEta(NULL),
160  hGammaChi2perNDF(NULL),
161  hGammaPsiPair(NULL),
162  hGammaArmenteros(NULL),
163  hGammaCosinePointingAngle(NULL),
164  hGammaInvMass(NULL),
165  hElecPt(NULL),
166  hElecEta(NULL),
167  hElecPhi(NULL),
168  hElecNfindableClsTPC(NULL),
169  hPosiNfindableClsTPC(NULL),
170  hElecClsTPC(NULL),
171  hPosiClsTPC(NULL),
172  hElectrondEdxP(NULL),
173  hElectronITSdEdxP(NULL),
174  hElectronTOFP(NULL),
175  hElectronNSigmadEdxP(NULL),
176  hElectronNSigmadEdxEta(NULL),
177  hElectronNSigmaPiondEdxP(NULL),
178  hElectronNSigmaITSP(NULL),
179  hElectronNSigmaTOFP(NULL),
180  hPositrondEdxP(NULL),
181  hPositronITSdEdxP(NULL),
182  hPositronTOFP(NULL),
183  hPositronNSigmadEdxP(NULL),
184  hPositronNSigmadEdxEta(NULL),
185  hPositronNSigmaPiondEdxP(NULL),
186  hPositronNSigmaITSP(NULL),
187  hPositronNSigmaTOFP(NULL),
188  hInvMassPair(NULL),
189  // hGammaXY(NULL),
190  // hGammaZR(NULL),
191  // hElecAsymP(NULL),
192  // fTrueList(NULL),
193  // hTrueResolutionR(NULL),
194  // hTrueResolutionZ(NULL),
195  // hTrueResolutionPhi(NULL),
196  // hTrueGammaPt(NULL),
197  // hTrueGammaPhi(NULL),
198  // hTrueGammaEta(NULL),
199  // hTrueGammaMass(NULL),
200  // hTrueGammaChi2perNDF(NULL),
201  // hTrueGammaPsiPair(NULL),
202  // hTrueGammaQt(NULL),
203  // hTrueGammaCosinePointingAngle(NULL),
204  // hTrueGammaXY(NULL),
205  // hTrueGammaZR(NULL),
206  // hTrueElecPt(NULL),
207  // hTrueElecEta(NULL),
208  // hTrueElecPhi(NULL),
209  // hTrueElecNfindableClsTPC(NULL),
210  // hTruePosiNfindableClsTPC(NULL),
211  // hTrueElecAsymP(NULL),
212  fGammaPt(0),
213  fGammaTheta(0),
214  fGammaChi2NDF(0),
215  fGammaPhotonProp(5),
216  fGammaConvCoord(5),
217  fDaughterProp(24),
218  fKind(0),
219  fIsMC(kFALSE),
220  fnGammaCandidates(1),
221  fMCStackPos(NULL),
222  fMCStackNeg(NULL)
223 {
224  // Default constructor
225 
226  DefineInput(0, TChain::Class());
227  DefineOutput(1, TList::Class());
228 }
229 
230 //________________________________________________________________________
232 {
233  // default deconstructor
234 
235 }
236 //________________________________________________________________________
238 {
239  // Create User Output Objects
240 
241  if(fOutputList != NULL){
242  delete fOutputList;
243  fOutputList = NULL;
244  }
245  if(fOutputList == NULL){
246  fOutputList = new TList();
247  fOutputList->SetOwner(kTRUE);
248  }
249 
250  if(ffillHistograms){
251  fESDList = new TList();
252  fESDList->SetOwner(kTRUE);
253  fESDList->SetName("ESD QA");
254  fOutputList->Add(fESDList);
255 
256  hVertexZ = new TH1F("Vertex_Z","Vertex_Z",300,-15,15);
257  fESDList->Add(hVertexZ);
258  hNContributorsVertex = new TH1I("ContrVertex_Z","ContrVertex_Z",3000,0,3000);
260  if(fIsHeavyIon) hNGoodESDTracks = new TH1I("GoodESDTracks","GoodESDTracks",4000,0,4000);
261  else hNGoodESDTracks = new TH1I("GoodESDTracks","GoodESDTracks",200,0,200);
263  if(fIsHeavyIon) hNV0Tracks = new TH1I("V0 Multiplicity","V0 Multiplicity",30000,0,30000);
264  else hNV0Tracks = new TH1I("V0 Multiplicity","V0 Multiplicity",2000,0,2000);
265  fESDList->Add(hNV0Tracks);
266 
267  hITSClusterPhi = new TH2F("ITSClusterPhi","hITSClusterPhi",72,0,2*TMath::Pi(),7,0,7);
268  fESDList->Add(hITSClusterPhi);
269  hGammaPt = new TH1F("Gamma_Pt","Gamma_Pt",250,0,25);
270  fESDList->Add(hGammaPt);
271  hGammaPhi = new TH1F("Gamma_Phi","Gamma_Phi",360,0,2*TMath::Pi());
272  fESDList->Add(hGammaPhi);
273  hGammaPhi_Pos = new TH1F("GammaPhi_EtaPos","GammaPhi_EtaPos",360,0,2*TMath::Pi());
274  fESDList->Add(hGammaPhi_Pos);
275  hGammaPhi_Neg = new TH1F("GammaPhi_EtaNeg","GammaPhi_EtaNeg",360,0,2*TMath::Pi());
276  fESDList->Add(hGammaPhi_Neg);
277 
278  hGammaEta = new TH1F("Gamma_Eta","Gamma_Eta",600,-1.5,1.5);
279  fESDList->Add(hGammaEta);
280  hGammaChi2perNDF = new TH1F("Gamma_Chi2perNDF","Gamma_Chi2perNDF",500,0,100);
282  hGammaPsiPair = new TH1F("Gamma_PsiPair","Gamma_PsiPair",500,0,2);
283  fESDList->Add(hGammaPsiPair);
284  hGammaArmenteros = new TH2F("Gamma_Armenteros","Gamma_Armenteros",200,-1,1,400,0,0.1);
286  hGammaCosinePointingAngle = new TH1F("Gamma_CosinePointingAngle","Gamma_CosinePointingAngle",1000,-1.,1.);
288  hGammaInvMass = new TH1F( "Gamma_InvMass","",200, 0, 0.2);
289  fESDList->Add(hGammaInvMass);
290 
291  hElecPt = new TH2F("Electron_Positron_Pt","Electron_Positron_Pt",250,0,25,250,0,25);
292  fESDList->Add(hElecPt);
293  hElecEta = new TH2F("Electron_Positron_Eta","Electron_Positron_Eta",600,-1.5,1.5,600,-1.5,1.5);
294  fESDList->Add(hElecEta);
295  hElecPhi = new TH2F("Electron_Positron_Phi","Electron_Positron_Phi",360,0,2*TMath::Pi(),360,0,2*TMath::Pi());
296  fESDList->Add(hElecPhi);
297  hElecClsTPC = new TH1F("Electron_ClusterTPC","Electron_ClusterTPC",200,0,200);
298  fESDList->Add(hElecClsTPC);
299  hPosiClsTPC = new TH1F("Positron_ClusterTPC","Positron_ClusterTPC",200,0,200);
300  fESDList->Add(hPosiClsTPC);
301 
302  hElecNfindableClsTPC = new TH1F("Electron_findableClusterTPC","Electron_findableClusterTPC",100,0,1);
304  hPosiNfindableClsTPC = new TH1F("Positron_findableClusterTPC","Positron_findableClusterTPC",100,0,1);
306 
307  hElectrondEdxP = new TH2F("Electron_dEdx_P","Electron_dEdx_P",100, 0.05, 20, 200, 0, 200);
309  fESDList->Add(hElectrondEdxP);
310  hPositrondEdxP = new TH2F("Positron_dEdx_P","Positron_dEdx_P",100, 0.05, 20, 200, 0, 200);
312  fESDList->Add(hPositrondEdxP);
313  hElectronNSigmadEdxP = new TH2F("Electron_NSigmadEdx_P","Electron_NSigmadEdx_P",100, 0.05, 20, 200, -10, 10);
316  hElectronNSigmadEdxEta = new TH2F("Electron_NSigmadEdx_Eta","Electron_NSigmadEdx_Eta",140, -1.4, 1.4, 200, -10, 10);
318  hPositronNSigmadEdxP = new TH2F("Positron_NSigmadEdx_P","Positron_NSigmadEdx_P",100, 0.05, 20, 200, -10, 10);
321  hPositronNSigmadEdxEta = new TH2F("Positron_NSigmadEdx_Eta","Positron_NSigmadEdx_Eta",140, -1.4, 1.4, 200, -10, 10);
323  hElectronNSigmaPiondEdxP = new TH2F("Electron_NSigmaPiondEdx_P","Electron_NSigmaPiondEdx_P",100, 0.05, 20, 200, -10, 10);
326  hPositronNSigmaPiondEdxP = new TH2F("Positron_NSigmaPiondEdx_P","Positron_NSigmaPiondEdx_P",100, 0.05, 20, 200, -10, 10);
329 
330  hElectronTOFP = new TH2F("Electron_TOF_P","Electron_TOF_P",100, 0.05, 20, 600, -1000, 29000);
332  fESDList->Add(hElectronTOFP);
333  hPositronTOFP = new TH2F("Positron_TOF_P","Positron_TOF_P",100, 0.05, 20, 600, -1000, 29000);
335  fESDList->Add(hPositronTOFP);
336  hElectronNSigmaTOFP = new TH2F("Electron_NSigmaTOF_P","Electron_NSigmaTOF_P",100, 0.05, 20, 200, -10, 10);
339  hPositronNSigmaTOFP = new TH2F("Positron_NSigmaTOF_P","Positron_NSigmaTOF_P",100, 0.05, 20, 200, -10, 10);
342 
343  hElectronITSdEdxP = new TH2F("Electron_ITSdEdx_P","Electron_ITSdEdx_P",100, 0.05, 20, 200, 0, 200);
346  hPositronITSdEdxP = new TH2F("Positron_ITSdEdx_P","Positron_ITSdEdx_P",100, 0.05, 20, 200, 0, 200);
349  hElectronNSigmaITSP = new TH2F("Electron_NSigmaITS_P","Electron_NSigmaITS_P",100, 0.05, 20, 200, -10, 10);
352  hPositronNSigmaITSP = new TH2F("Positron_NSigmaITS_P","Positron_NSigmaITS_P",100, 0.05, 20, 200, -10, 10);
355 
356  hInvMassPair = new TH2F("Gamma_InvMassPair_Pt","Gamma invariant mass vs Pt",200,0,0.2,250,0,25);
357  hInvMassPair->SetXTitle("mass (GeV/c)");
358  hInvMassPair->SetYTitle("p_{T} (GeV/c)");
359  fESDList->Add(hInvMassPair);
360 
361  // hGammaXY = new TH2F("Gamma_ConversionPoint_XY","Gamma_ConversionPoint_XY",960,-120,120,960,-120,120);
362  // fESDList->Add(hGammaXY);
363  // hGammaZR= new TH2F("Gamma_ConversionPoint_ZR","Gamma_ConversionPoint_ZR",1200,-150,150,480,0,120);
364  // fESDList->Add(hGammaZR);
365 
366 
367  // hElecAsymP = new TH2F("Electron_Asym_vs_P", "Electron_Asym_vs_P",200,0.,20.,200,0.,1.);
368  // fESDList->Add(hElecAsymP);
369 
370  // if(fIsMC){
371  // fTrueList = new TList();
372  // fTrueList->SetOwner(kTRUE);
373  // fTrueList->SetName("True QA");
374  // fOutputList->Add(fTrueList);
375  //
376  // hTrueResolutionR = new TH2F("True_ConversionPointResolution_R","True_ConversionPointResolution_R",240,0,120,200,-20,20);
377  // fTrueList->Add(hTrueResolutionR);
378  // hTrueResolutionZ = new TH2F("True_ConversionPointResolution_Z","True_ConversionPointResolution_Z",480,-120,120,200,-20,20);
379  // fTrueList->Add(hTrueResolutionZ);
380  // hTrueResolutionPhi = new TH2F("True_ConversionPointResolution_Phi","True_ConversionPointResolution_Phi",360,0,2*TMath::Pi(),200,-TMath::Pi()/30., TMath::Pi()/30.);
381  // fTrueList->Add(hTrueResolutionPhi);
382  //
383  // hTrueGammaPt = new TH1F("True_Gamma_Pt","True_Gamma_Pt",250,0,25);
384  // fTrueList->Add(hTrueGammaPt);
385  // hTrueGammaPhi = new TH1F("True_Gamma_Phi","True_Gamma_Phi",360,0,2*TMath::Pi());
386  // fTrueList->Add(hTrueGammaPhi);
387  // hTrueGammaEta = new TH1F("True_Gamma_Eta","True_Gamma_Eta",600,-1.5,1.5);
388  // fTrueList->Add(hTrueGammaEta);
389  // hTrueGammaMass = new TH1F("True_Gamma_Mass","True_Gamma_Mass",1000,0,0.3);
390  // fTrueList->Add(hTrueGammaMass);
391  // hTrueGammaChi2perNDF = new TH1F("True_Gamma_Chi2perNDF","True_Gamma_Chi2perNDF",500,0,100);
392  // fTrueList->Add(hTrueGammaChi2perNDF);
393  // hTrueGammaPsiPair = new TH1F("True_Gamma_PsiPair","True_Gamma_PsiPair",500,0,2);
394  // fTrueList->Add(hTrueGammaPsiPair);
395  // hTrueGammaQt = new TH1F("True_Gamma_Qt","True_Gamma_Qt",400,0,0.1);
396  // fTrueList->Add(hTrueGammaQt);
397  // hTrueGammaCosinePointingAngle = new TH1F("True_Gamma_CosinePointingAngle","True_Gamma_CosinePointingAngle",900,0.7,1.);
398  // fTrueList->Add(hTrueGammaCosinePointingAngle);
399  // hTrueGammaXY = new TH2F("True_Gamma_ConversionPoint_XY","True_Gamma_ConversionPoint_XY",960,-120,120,960,-120,120);
400  // fTrueList->Add(hTrueGammaXY);
401  // hTrueGammaZR= new TH2F("TrueGamma_ConversionPoint_ZR","TrueGamma_ConversionPoint_ZR",1200,-150,150,480,0,120);
402  // fTrueList->Add(hTrueGammaZR);
403  //
404  // hTrueElecPt = new TH2F("True_Electron_Positron_Pt","True_Electron_Positron_Pt",250,0,25,250,0,25);
405  // fTrueList->Add(hTrueElecPt);
406  // hTrueElecEta = new TH2F("True_Electron_Positron_Eta","True_Electron_Positron_Eta",600,-1.5,1.5,600,-1.5,1.5);
407  // fTrueList->Add(hTrueElecEta);
408  // hTrueElecPhi = new TH2F("True_Electron_Positron_Phi","True_Electron_Positron_Phi",360,0,2*TMath::Pi(),360,0,2*TMath::Pi());
409  // fTrueList->Add(hTrueElecPhi);
410  // hTrueElecNfindableClsTPC = new TH1F("True_Electron_findableClusterTPC","True_Electron_findableClusterTPC",100,0,1);
411  // fTrueList->Add(hTrueElecNfindableClsTPC);
412  // hTruePosiNfindableClsTPC = new TH1F("True_Positron_findableClusterTPC","True_Positron_findableClusterTPC",100,0,1);
413  // fTrueList->Add(hTruePosiNfindableClsTPC);
414  // hTrueElecAsymP = new TH2F("True_Electron_Asym_vs_P", "True_Electron_Asym_vs_P",200,0.,20.,200,0.,1.);
415  // fTrueList->Add(hTrueElecAsymP);
416  // }
419  }
420  }
421 
422  if(ffillTree){
423  fTreeList = new TList();
424  fTreeList->SetOwner(kTRUE);
425  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  if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class() && fMCEvent){ fMCStack = fMCEvent->Stack(); }
486 
487  Int_t eventNotAccepted =
489  if(eventNotAccepted) return; // Check Centrality, PileUp, SDD and V0AND --> Not Accepted => eventQuality = 1
490 
492 
493  if(fMCEvent){
494  if(fEventCuts->GetSignalRejection() != 0){
495  if(fInputEvent->IsA()==AliESDEvent::Class()){
498  fMCEvent);
499  }
500  else if(fInputEvent->IsA()==AliAODEvent::Class()){
503  fInputEvent);
504  }
505  }
506  }
507 
508  if(ffillHistograms){
509  CountTracks();
510  hVertexZ->Fill(fInputEvent->GetPrimaryVertex()->GetZ());
513  hNV0Tracks->Fill(fInputEvent->GetVZEROData()->GetMTotV0A()+fInputEvent->GetVZEROData()->GetMTotV0C());
514  }
515 
516  if(fMCEvent && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
517  RelabelAODPhotonCandidates(kTRUE); // In case of AODMC relabeling MC
518  fV0Reader->RelabelAODs(kTRUE);
519  }
520 
521 
522  for(Int_t firstGammaIndex=0;firstGammaIndex<fConversionGammas->GetEntriesFast();firstGammaIndex++){
523  AliAODConversionPhoton *gamma=dynamic_cast<AliAODConversionPhoton*>(fConversionGammas->At(firstGammaIndex));
524  if (gamma==NULL) continue;
525  if(fMCEvent && fEventCuts->GetSignalRejection() != 0){
527  continue;
529  continue;
530  }
532  continue;
533  }
534 
535  if(ffillTree) ProcessQATree(gamma);
536  if(ffillHistograms) ProcessQA(gamma);
537  }
538 
539  if(fMCEvent && fInputEvent->IsA()==AliAODEvent::Class() && !(fV0Reader->AreAODsRelabeled())){
540  RelabelAODPhotonCandidates(kFALSE); // Back to ESDMC Label
541  fV0Reader->RelabelAODs(kFALSE);
542  }
543 
544  PostData(1, fOutputList);
545 }
546 
547 
550 
551  // Fill Histograms for QA and MC
552  AliVEvent* event = (AliVEvent*) InputEvent();
553 
554  AliPIDResponse* pidResonse = ((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetPIDResponse();
555 
556  fGammaPt = gamma->GetPhotonPt();
557 
558  fGammaTheta = gamma->Theta();
559  fGammaChi2NDF = gamma->GetChi2perNDF();
560 
561  fGammaPhotonProp(0) = gamma->GetArmenterosQt();
562  fGammaPhotonProp(1) = gamma->GetArmenterosAlpha();
563  fGammaPhotonProp(2) = gamma->GetPsiPair();
565  fGammaPhotonProp(4) = gamma->GetInvMassPair();
566 
567  fGammaConvCoord(0) = gamma->GetConversionX();
568  fGammaConvCoord(1) = gamma->GetConversionY();
569  fGammaConvCoord(2) = gamma->GetConversionZ();
570  fGammaConvCoord(3) = gamma->GetConversionRadius();
571  fGammaConvCoord(4) = gamma->GetPhotonPhi();
572 
573  AliVTrack * negTrack = fConversionCuts->GetTrack(event, gamma->GetTrackLabelNegative());
574  AliVTrack * posTrack = fConversionCuts->GetTrack(event, gamma->GetTrackLabelPositive());
575 
576 
577  if(!negTrack||!posTrack)return;
578 
579  fKind = 9;
580  if(fMCEvent && fInputEvent->IsA()==AliESDEvent::Class()){
581  fKind = IsTruePhotonESD(gamma);
582  } else if (fMCEvent && fInputEvent->IsA()==AliAODEvent::Class()){
583  // cout << "entering IsTruePhotonAOD" << endl;
584  fKind = IsTruePhotonAOD(gamma);
585  }
586 
587  fDaughterProp(0) = posTrack->Pt();
588  fDaughterProp(7) = negTrack->Pt();
589  fDaughterProp(1) = posTrack->Theta();
590  fDaughterProp(8) = negTrack->Theta();
591  // dEdx TPC
592  fDaughterProp(2) = posTrack->GetTPCsignal();
593  fDaughterProp(3) = pidResonse->NumberOfSigmasTPC(posTrack,AliPID::kElectron);
594  fDaughterProp(22) = pidResonse->NumberOfSigmasTPC(posTrack,AliPID::kPion);
595  fDaughterProp(9) = negTrack->GetTPCsignal();
596  fDaughterProp(10) = pidResonse->NumberOfSigmasTPC(negTrack,AliPID::kElectron);
597  fDaughterProp(23) = pidResonse->NumberOfSigmasTPC(negTrack,AliPID::kPion);
598  Int_t nPosClusterITS = 0;
599  Int_t nNegClusterITS = 0;
600  for(Int_t itsLayer = 0; itsLayer<6;itsLayer++){
601  if(TESTBIT(negTrack->GetITSClusterMap(),itsLayer)){
602  nNegClusterITS++;
603  }
604  if(TESTBIT(posTrack->GetITSClusterMap(),itsLayer)){
605  nPosClusterITS++;
606  }
607  }
608 
609  // ITS signal
610  fDaughterProp(14) = (Float_t)nPosClusterITS;
611  fDaughterProp(15) = (Float_t)nNegClusterITS;
612  if (nPosClusterITS > 0 ){
613  fDaughterProp(16) = posTrack->GetITSsignal();
614  fDaughterProp(20) = pidResonse->NumberOfSigmasITS(posTrack,AliPID::kElectron);
615  } else {
616  fDaughterProp(16) = 1000;
617  fDaughterProp(20) = 20;
618  }
619  if (nNegClusterITS > 0 ){
620  fDaughterProp(17) = negTrack->GetITSsignal();
621  fDaughterProp(21) = pidResonse->NumberOfSigmasITS(negTrack,AliPID::kElectron);
622  } else {
623  fDaughterProp(17) = 1000;
624  fDaughterProp(21) = 20;
625  }
626 
627  // TOF
628  if((posTrack->GetStatus() & AliESDtrack::kTOFpid) && !(posTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
629  Double_t t0pos = pidResonse->GetTOFResponse().GetStartTime(posTrack->P());
630  Double_t timesPos[9];
631  posTrack->GetIntegratedTimes(timesPos,9);
632  Double_t TOFsignalPos = posTrack->GetTOFsignal();
633  Double_t dTpos = TOFsignalPos - t0pos - timesPos[0];
634  fDaughterProp(4) = dTpos;
635  fDaughterProp(5) = pidResonse->NumberOfSigmasTOF(posTrack, AliPID::kElectron);
636  } else {
637  fDaughterProp(4) = 20000;
638  fDaughterProp(5) = -20;
639  }
640  if((negTrack->GetStatus() & AliESDtrack::kTOFpid) && !(negTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
641  Double_t t0neg = pidResonse->GetTOFResponse().GetStartTime(negTrack->P());
642  Double_t timesNeg[9];
643  negTrack->GetIntegratedTimes(timesNeg,9);
644  Double_t TOFsignalNeg = negTrack->GetTOFsignal();
645  Double_t dTneg = TOFsignalNeg - t0neg - timesNeg[0];
646  fDaughterProp(11) = dTneg;
647  fDaughterProp(12) = pidResonse->NumberOfSigmasTOF(negTrack, AliPID::kElectron);
648  } else {
649  fDaughterProp(11) = 20000;
650  fDaughterProp(12) = -20;
651  }
652 
653  fDaughterProp(6) = (Float_t)posTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius()));
654  fDaughterProp(18) = posTrack->GetNcls(1);
655  fDaughterProp(13) = (Float_t)negTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius()));
656  fDaughterProp(19) = negTrack->GetNcls(1);
657 
658  if (fTreeQA){
659  fTreeQA->Fill();
660  }
661 }
662 
663 //_____________________________________________________________________________________________________
665 
666  AliPIDResponse* pidResonse = ((AliConversionPhotonCuts*)fV0Reader->GetConversionCuts())->GetPIDResponse();
667 
668  // Fill Histograms for QA and MC
669 
670  hGammaPt->Fill(gamma->GetPhotonPt());
671  hGammaPhi->Fill(gamma->GetPhotonPhi());
672  if(gamma->Eta() >= 0.00001){hGammaPhi_Pos->Fill(gamma->Phi());}
673  if(gamma->Eta() <= 0.00001){hGammaPhi_Neg->Fill(gamma->Phi());}
674  hGammaEta->Fill(gamma->Eta());
675  hGammaChi2perNDF->Fill(gamma->GetChi2perNDF());
676  hGammaPsiPair->Fill(gamma->GetPsiPair());
677  hGammaArmenteros->Fill(gamma->GetArmenterosAlpha(),gamma->GetArmenterosQt());
679  hGammaInvMass->Fill(gamma->GetMass());
680  hInvMassPair->Fill(gamma->GetInvMassPair(),gamma->GetPhotonPt());
681  // hGammaXY->Fill(gamma->GetConversionX(),gamma->GetConversionY());
682  // hGammaZR->Fill(gamma->GetConversionZ(),gamma->GetConversionRadius());
683 
684  AliVTrack * negTrack = fConversionCuts->GetTrack(fInputEvent, gamma->GetTrackLabelNegative());
685  AliVTrack * posTrack = fConversionCuts->GetTrack(fInputEvent, gamma->GetTrackLabelPositive());
686  if(!negTrack||!posTrack)return;
687 
688 
689  hElecPt->Fill(negTrack->Pt(),posTrack->Pt());
690  hElecEta->Fill(negTrack->Eta(),posTrack->Eta());
691  hElecPhi->Fill(negTrack->Phi(),posTrack->Phi());
692 
693  hElecNfindableClsTPC->Fill((Float_t)posTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius())));
694  hPosiNfindableClsTPC->Fill((Float_t)negTrack->GetTPCClusterInfo(2,0,fConversionCuts->GetFirstTPCRow(gamma->GetConversionRadius())));
695  hElecClsTPC->Fill(negTrack->GetNcls(1));
696  hPosiClsTPC->Fill(posTrack->GetNcls(1));
697  //TPC dEdx
698  hElectrondEdxP->Fill(negTrack->P() ,negTrack->GetTPCsignal());
699  hElectronNSigmadEdxP->Fill(negTrack->P() ,pidResonse->NumberOfSigmasTPC(negTrack, AliPID::kElectron));
700  hElectronNSigmadEdxEta->Fill(negTrack->Eta() ,pidResonse->NumberOfSigmasTPC(negTrack, AliPID::kElectron));
701  hElectronNSigmaPiondEdxP->Fill(negTrack->P() ,pidResonse->NumberOfSigmasTPC(negTrack, AliPID::kPion));
702  hPositrondEdxP->Fill(posTrack->P() ,posTrack->GetTPCsignal());
703  hPositronNSigmadEdxP->Fill(posTrack->P() ,pidResonse->NumberOfSigmasTPC(posTrack, AliPID::kElectron));
704  hPositronNSigmadEdxEta->Fill(posTrack->Eta() ,pidResonse->NumberOfSigmasTPC(posTrack, AliPID::kElectron));
705  hPositronNSigmaPiondEdxP->Fill(posTrack->P() ,pidResonse->NumberOfSigmasTPC(posTrack, AliPID::kPion));
706 
707  //TOF signal
708  if((negTrack->GetStatus() & AliESDtrack::kTOFpid)==0 && !(negTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
709  Double_t t0neg = pidResonse->GetTOFResponse().GetStartTime(negTrack->P());
710  Double_t timesNeg[9];
711  negTrack->GetIntegratedTimes(timesNeg,9);
712  Double_t TOFsignalNeg = negTrack->GetTOFsignal();
713  Double_t dTneg = TOFsignalNeg - t0neg - timesNeg[0];
714  hElectronTOFP->Fill(negTrack->P() ,dTneg);
715  hElectronNSigmaTOFP->Fill(negTrack->P() ,pidResonse->NumberOfSigmasTOF(negTrack, AliPID::kElectron));
716  }
717  if((posTrack->GetStatus() & AliESDtrack::kTOFpid)==0 && !(posTrack->GetStatus() & AliESDtrack::kTOFmismatch)){
718  Double_t t0pos = pidResonse->GetTOFResponse().GetStartTime(posTrack->P());
719  Double_t timesPos[9];
720  posTrack->GetIntegratedTimes(timesPos,9);
721  Double_t TOFsignalPos = posTrack->GetTOFsignal();
722  Double_t dTpos = TOFsignalPos - t0pos - timesPos[0];
723  hPositronTOFP->Fill(posTrack->P() ,dTpos);
724  hPositronNSigmaTOFP->Fill(posTrack->P() ,pidResonse->NumberOfSigmasTOF(posTrack, AliPID::kElectron));
725  }
726 
727  Int_t nPosClusterITS = 0;
728  Int_t nNegClusterITS = 0;
729  for(Int_t itsLayer = 0; itsLayer<6;itsLayer++){
730  if(TESTBIT(negTrack->GetITSClusterMap(),itsLayer)){
731  nNegClusterITS++;
732  }
733  if(TESTBIT(posTrack->GetITSClusterMap(),itsLayer)){
734  nPosClusterITS++;
735  }
736  }
737  Double_t negtrackPhi = negTrack->Phi();
738  Double_t postrackPhi = posTrack->Phi();
739  hITSClusterPhi->Fill(negtrackPhi,nNegClusterITS);
740  hITSClusterPhi->Fill(postrackPhi,nPosClusterITS);
741 
742  // ITS signal
743  if (nPosClusterITS > 0 ){
744  hPositronITSdEdxP->Fill(posTrack->P() ,posTrack->GetITSsignal());
745  hPositronNSigmaITSP->Fill(posTrack->P() ,pidResonse->NumberOfSigmasITS(posTrack,AliPID::kElectron));
746  }
747  if (nNegClusterITS > 0 ){
748  hElectronITSdEdxP->Fill(negTrack->P() ,negTrack->GetITSsignal());
749  hElectronNSigmaITSP->Fill(negTrack->P() ,pidResonse->NumberOfSigmasITS(negTrack,AliPID::kElectron));
750  }
751 
752 
753 }
754 
755 
756 //________________________________________________________________________
758 
759  if(fInputEvent->IsA()==AliESDEvent::Class()){
760  // Using standard function for setting Cuts
761  Bool_t selectPrimaries=kTRUE;
762  AliESDtrackCuts *EsdTrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(selectPrimaries);
763  EsdTrackCuts->SetMaxDCAToVertexZ(2);
764  EsdTrackCuts->SetEtaRange(-0.8, 0.8);
765  EsdTrackCuts->SetPtRange(0.15);
766  fNumberOfESDTracks = 0;
767  for(Int_t iTracks = 0; iTracks < fInputEvent->GetNumberOfTracks(); iTracks++){
768  AliESDtrack* curTrack = (AliESDtrack*) fInputEvent->GetTrack(iTracks);
769  if(!curTrack) continue;
770  if(EsdTrackCuts->AcceptTrack(curTrack) ) fNumberOfESDTracks++;
771  }
772  delete EsdTrackCuts;
773  EsdTrackCuts=0x0;
774  }
775  else if(fInputEvent->IsA()==AliAODEvent::Class()){
776  fNumberOfESDTracks = 0;
777  for(Int_t iTracks = 0; iTracks<fInputEvent->GetNumberOfTracks(); iTracks++){
778  AliAODTrack* curTrack = (AliAODTrack*) fInputEvent->GetTrack(iTracks);
779  if(curTrack->GetID()<0) continue; // Avoid double counting of tracks
780  if(!curTrack->IsHybridGlobalConstrainedGlobal()) continue;
781  if(TMath::Abs(curTrack->Eta())>0.8) continue;
782  if(curTrack->Pt()<0.15) continue;
784  }
785  }
786  return;
787 }
788 
790 {
791  UInt_t kind = 9;
792  TParticle *posDaughter = TruePhotonCandidate->GetPositiveMCDaughter(fMCStack);
793  TParticle *negDaughter = TruePhotonCandidate->GetNegativeMCDaughter(fMCStack);
794  Int_t motherLabelPhoton;
795  Int_t pdgCodePos = 0;
796  Int_t pdgCodeNeg = 0;
797  Int_t pdgCode = 0;
798 
799  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
800  Double_t mcProdVtxX = primVtxMC->GetX();
801  Double_t mcProdVtxY = primVtxMC->GetY();
802  Double_t mcProdVtxZ = primVtxMC->GetZ();
803 
804 
805  if(posDaughter == NULL || negDaughter == NULL) {
806  kind = 9;
807  // return kFALSE; // One particle does not exist
808 
809  } else if( posDaughter->GetMother(0) != negDaughter->GetMother(0) || (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1)) {
810  kind = 1;
811  // return 1;
812  pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
813  pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
814  if(pdgCodePos==11 && pdgCodeNeg==11) return 10; //Electron Combinatorial
815  if(pdgCodePos==11 && pdgCodeNeg==11 &&
816  (posDaughter->GetMother(0) == negDaughter->GetMother(0) && posDaughter->GetMother(0) ==-1)) return 15; //direct Electron Combinatorial
817 
818  if(pdgCodePos==211 && pdgCodeNeg==211) kind = 11; //Pion Combinatorial
819  if((pdgCodePos==211 && pdgCodeNeg==2212) ||(pdgCodePos==2212 && pdgCodeNeg==211)) kind = 12; //Pion, Proton Combinatorics
820  if((pdgCodePos==11 && pdgCodeNeg==2212) ||(pdgCodePos==2212 && pdgCodeNeg==11)) kind = 16; //electron, Proton Combinatorics
821  if((pdgCodePos==11 && pdgCodeNeg==321) ||(pdgCodePos==321 && pdgCodeNeg==11)) kind = 17; //electron, kaon
822  if((pdgCodePos==211 && pdgCodeNeg==321) ||(pdgCodePos==321 && pdgCodeNeg==211)) kind = 18; //pion, kaon
823  if((pdgCodePos==211 && pdgCodeNeg==11) ||(pdgCodePos==11 && pdgCodeNeg==211)) kind = 13; //Pion, Electron Combinatorics
824  if(pdgCodePos==321 && pdgCodeNeg==321) kind = 14; //Kaon,Kaon combinatorics
825  }else{
826  TParticle *Photon = TruePhotonCandidate->GetMCParticle(fMCStack);
827  pdgCodePos=posDaughter->GetPdgCode();
828  pdgCodeNeg=negDaughter->GetPdgCode();
829  motherLabelPhoton= Photon->GetMother(0);
830  Bool_t gammaIsPrimary = fEventCuts->IsConversionPrimaryESD( fMCStack, posDaughter->GetMother(0), mcProdVtxX, mcProdVtxY, mcProdVtxZ);
831  if ( TruePhotonCandidate->GetMCParticle(fMCStack)->GetPdgCode()) pdgCode = TruePhotonCandidate->GetMCParticle(fMCStack)->GetPdgCode();
832 
833  if(TMath::Abs(pdgCodePos)!=11 || TMath::Abs(pdgCodeNeg)!=11) return 2; // true from hadronic decays
834  else if ( !(pdgCodeNeg==pdgCodePos)){
835  if(pdgCode == 111) return 3; // pi0 Dalitz
836  else if (pdgCode == 221) return 4; // eta Dalitz
837  else if (!(negDaughter->GetUniqueID() != 5 || posDaughter->GetUniqueID() !=5)){
838  if(pdgCode == 22 && gammaIsPrimary){
839  return 0; // primary photons
840  } else if (pdgCode == 22){
841  return 5; //secondary photons
842  }
843  }
844  }
845  }
846 
847  return kind;
848 }
849 
850 //________________________________________________________________________
852 {
853 
854  UInt_t kind = 9;
855  TClonesArray *AODMCTrackArray = dynamic_cast<TClonesArray*>(fInputEvent->FindListObject(AliAODMCParticle::StdBranchName()));
856  if (AODMCTrackArray!=NULL && TruePhotonCandidate!=NULL){
857  AliAODMCParticle *posDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelPositive());
858  AliAODMCParticle *negDaughter = (AliAODMCParticle*) AODMCTrackArray->At(TruePhotonCandidate->GetMCLabelNegative());
859  Int_t pdgCodePos = 0;
860  Int_t pdgCodeNeg = 0;
861  Int_t pdgCode = 0;
862  if(posDaughter == NULL || negDaughter == NULL) {
863  kind = 9;
864  } else if( posDaughter->GetMother() != negDaughter->GetMother() || (posDaughter->GetMother() == negDaughter->GetMother() && posDaughter->GetMother() ==-1)) {
865  kind = 1;
866  pdgCodePos=TMath::Abs(posDaughter->GetPdgCode());
867  pdgCodeNeg=TMath::Abs(negDaughter->GetPdgCode());
868  if(pdgCodePos==11 && pdgCodeNeg==11) kind = 10; //Electron Combinatorial
869  if(pdgCodePos==11 && pdgCodeNeg==11 &&
870  (posDaughter->GetMother() == negDaughter->GetMother() && posDaughter->GetMother() ==-1))kind = 15; //direct Electron Combinatorial
871 
872  if(pdgCodePos==211 && pdgCodeNeg==211) kind = 11; //Pion Combinatorial
873  if((pdgCodePos==211 && pdgCodeNeg==2212) ||(pdgCodePos==2212 && pdgCodeNeg==211)) kind = 12; //Pion, Proton Combinatorics
874  if((pdgCodePos==11 && pdgCodeNeg==2212) ||(pdgCodePos==2212 && pdgCodeNeg==11)) kind = 16; //electron, Proton Combinatorics
875  if((pdgCodePos==11 && pdgCodeNeg==321) ||(pdgCodePos==321 && pdgCodeNeg==11)) kind = 17; //electron, kaon
876  if((pdgCodePos==211 && pdgCodeNeg==321) ||(pdgCodePos==321 && pdgCodeNeg==211)) kind = 18; //pion, kaon
877  if((pdgCodePos==211 && pdgCodeNeg==11) ||(pdgCodePos==11 && pdgCodeNeg==211)) kind = 13; //Pion, Electron Combinatorics
878  if(pdgCodePos==321 && pdgCodeNeg==321) kind = 14; //Kaon,Kaon combinatorics
879  }else{
880  AliAODMCParticle *Photon = (AliAODMCParticle*) AODMCTrackArray->At(posDaughter->GetMother());
881  pdgCodePos=posDaughter->GetPdgCode();
882  pdgCodeNeg=negDaughter->GetPdgCode();
883 
884  if ( Photon->GetPdgCode())
885  pdgCode = Photon->GetPdgCode();
886  if(TMath::Abs(pdgCodePos)!=11 || TMath::Abs(pdgCodeNeg)!=11) kind = 2; // true from hadronic decays
887  else if ( !(pdgCodeNeg==pdgCodePos)){
888  if(pdgCode == 111) kind = 3; // pi0 Dalitz
889  else if (pdgCode == 221) kind = 4; // eta Dalitz
890  else if (!(negDaughter->GetMCProcessCode() != 5 || posDaughter->GetMCProcessCode() !=5)){
891  const AliVVertex* primVtxMC = fMCEvent->GetPrimaryVertex();
892  Double_t mcProdVtxX = primVtxMC->GetX();
893  Double_t mcProdVtxY = primVtxMC->GetY();
894  Double_t mcProdVtxZ = primVtxMC->GetZ();
895  Bool_t isPrimary = fEventCuts->IsConversionPrimaryAOD(fInputEvent, Photon, mcProdVtxX, mcProdVtxY, mcProdVtxZ);
896 
897  if(pdgCode == 22 && isPrimary){
898  kind = 0; // primary photons
899  } else if (pdgCode == 22){
900  kind = 5; //secondary photons
901  }
902  }
903  }
904  }
905 
906  return kind;
907  }
908  return kind;
909 }
910 
911 //________________________________________________________________________
913 
914  // Relabeling For AOD Event
915  // ESDiD -> AODiD
916  // MCLabel -> AODMCLabel
917 
918  if(mode){
919  fMCStackPos = new Int_t[fConversionGammas->GetEntries()];
920  fMCStackNeg = new Int_t[fConversionGammas->GetEntries()];
921  }
922 
923  for(Int_t iGamma = 0;iGamma<fConversionGammas->GetEntries();iGamma++){
924  AliAODConversionPhoton* PhotonCandidate = (AliAODConversionPhoton*) fConversionGammas->At(iGamma);
925  if(!PhotonCandidate) continue;
926  if(!mode){// Back to ESD Labels
927  PhotonCandidate->SetMCLabelPositive(fMCStackPos[iGamma]);
928  PhotonCandidate->SetMCLabelNegative(fMCStackNeg[iGamma]);
929  //PhotonCandidate->IsAODMCLabel(kFALSE);
930  continue;
931  }
932  fMCStackPos[iGamma] = PhotonCandidate->GetMCLabelPositive();
933  fMCStackNeg[iGamma] = PhotonCandidate->GetMCLabelNegative();
934 
935  Bool_t AODLabelPos = kFALSE;
936  Bool_t AODLabelNeg = kFALSE;
937 
938  for(Int_t i = 0; i<fInputEvent->GetNumberOfTracks();i++){
939  AliAODTrack *tempDaughter = static_cast<AliAODTrack*>(fInputEvent->GetTrack(i));
940  if(!AODLabelPos){
941  if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelPositive() ){
942  PhotonCandidate->SetMCLabelPositive(TMath::Abs(tempDaughter->GetLabel()));
943  AODLabelPos = kTRUE;
944  }
945  }
946  if(!AODLabelNeg){
947  if( tempDaughter->GetID() == PhotonCandidate->GetTrackLabelNegative()){
948  PhotonCandidate->SetMCLabelNegative(TMath::Abs(tempDaughter->GetLabel()));
949  AODLabelNeg = kTRUE;
950  }
951  }
952  if(AODLabelNeg && AODLabelPos){
953  break;
954  }
955  } // Both ESD Tracks have AOD Tracks with Positive IDs
956  if(!AODLabelPos || !AODLabelNeg){
957  for(Int_t i = 0; i<fInputEvent->GetNumberOfTracks();i++){
958  AliAODTrack *tempDaughter = static_cast<AliAODTrack*>(fInputEvent->GetTrack(i));
959  if(tempDaughter->GetID()<0){
960  if(!AODLabelPos){
961  if( (TMath::Abs(tempDaughter->GetID())-1) == PhotonCandidate->GetTrackLabelPositive()){
962  PhotonCandidate->SetMCLabelPositive(TMath::Abs(tempDaughter->GetLabel()));
963  AODLabelPos = kTRUE;
964  }
965  }
966  if(!AODLabelNeg){
967  if( (TMath::Abs(tempDaughter->GetID())-1) == PhotonCandidate->GetTrackLabelNegative()){
968  PhotonCandidate->SetMCLabelNegative(TMath::Abs(tempDaughter->GetLabel()));
969  AODLabelNeg = kTRUE;
970  }
971  }
972  }
973  if(AODLabelNeg && AODLabelPos){
974  break;
975  }
976  }
977  if(!AODLabelPos || !AODLabelNeg){
978  cout<<"WARNING!!! AOD TRACKS NOT FOUND FOR"<<endl;
979  if(!AODLabelNeg){
980  PhotonCandidate->SetMCLabelNegative(-999999);
981  PhotonCandidate->SetLabelNegative(-999999);
982  }
983  if(!AODLabelPos){
984  PhotonCandidate->SetMCLabelPositive(-999999);
985  PhotonCandidate->SetLabelPositive(-999999);
986  }
987  }
988  }
989  }
990 
991  if(!mode){
992  delete[] fMCStackPos;
993  delete[] fMCStackNeg;
994  }
995 }
996 
998  TAxis *axisafter = histoRebin->GetXaxis();
999  Int_t bins = axisafter->GetNbins();
1000  Double_t from = axisafter->GetXmin();
1001  Double_t to = axisafter->GetXmax();
1002  Double_t *newbins = new Double_t[bins+1];
1003  newbins[0] = from;
1004  Double_t factor = TMath::Power(to/from, 1./bins);
1005  for(Int_t i=1; i<=bins; ++i) newbins[i] = factor * newbins[i-1];
1006  axisafter->Set(bins, newbins);
1007  delete [] newbins;
1008 
1009 }
1010 
1011 //________________________________________________________________________
1013 {
1014 
1015 }
void SetPeriodEnum(TString periodName)
TParticle * GetMCParticle(AliStack *fMCStack)
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)
Bool_t IsConversionPrimaryAOD(AliVEvent *fInputEvent, AliAODMCParticle *AODMCParticle, Double_t prodVtxX, Double_t prodVtxY, Double_t prodVtxZ)
void GetNotRejectedParticles(Int_t rejection, TList *HeaderList, AliVEvent *MCEvent)
Double_t GetEtaShift()
void DoEtaShift(Bool_t doEtaShift)
TString GetPeriodName()
Int_t GetNumberOfContributorsVtx(AliVEvent *event)
Bool_t IsConversionPrimaryESD(AliStack *MCStack, Long_t stackpos, Double_t prodVtxX, Double_t prodVtxY, Double_t prodVtxZ)
Bool_t GetProduceV0FindingEfficiency()
AliConversionPhotonCuts * fConversionCuts
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)
UInt_t IsTruePhotonESD(AliAODConversionPhoton *TruePhotonCandidate)
AliConversionPhotonCuts * GetConversionCuts()
Definition: AliV0ReaderV1.h:80
Int_t IsEventAcceptedByCut(AliConvEventCuts *ReaderCuts, AliVEvent *InputEvent, AliMCEvent *MCEvent, Int_t isHeavyIon, Bool_t isEMCALAnalysis)
Class handling all kinds of selection cuts for Gamma Conversion analysis.
TParticle * GetPositiveMCDaughter(AliStack *fMCStack)
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)
Int_t IsParticleFromBGEvent(Int_t index, AliStack *MCStack, AliVEvent *InputEvent=0x0)
Cut functions.
Definition: External.C:220
void SetLabelPositive(Int_t label)
Track labels.
void SetLabelNegative(Int_t label)
TClonesArray * GetReconstructedGammas() const
Definition: AliV0ReaderV1.h:76
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:81
TParticle * GetNegativeMCDaughter(AliStack *fMCStack)
const char Option_t
Definition: External.C:48
void ProcessQATree(AliAODConversionPhoton *gamma)
bool Bool_t
Definition: External.C:53
void ProcessQA(AliAODConversionPhoton *gamma)
ClassImp(AliAnalysisTaskConversionQA) AliAnalysisTaskConversionQA
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()