]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/hfe/AliHFEpriVtx.cxx
Use folder in ouput file: savannah 57874 (Markus)
[u/mrichter/AliRoot.git] / PWG3 / hfe / AliHFEpriVtx.cxx
CommitLineData
259c3296 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
50685501 15//
16// QA class of primary vertex study for Heavy Flavor electrons
17//
18// Authors:
19// MinJung Kweon <minjung@physi.uni-heidelberg.de>
20//
259c3296 21
22
259c3296 23#include <TH2F.h>
259c3296 24#include <TParticle.h>
25
26#include "AliESDEvent.h"
27#include <AliESDtrack.h>
28#include <AliStack.h>
29
30#include <AliLog.h>
31#include <AliKFParticle.h>
32#include <AliKFVertex.h>
33
34#include "AliHFEpriVtx.h"
35
36
37ClassImp(AliHFEpriVtx)
38
39//_______________________________________________________________________________________________
40AliHFEpriVtx::AliHFEpriVtx():
41 fESD1(0x0)
42 ,fStack(0x0)
43 ,fNtrackswoPid(0)
44 ,fHNtrackswoPid(0x0)
45 ,fNESDprimVtxContributor(0x0)
46 ,fNESDprimVtxIndices(0x0)
47 ,fDiffDCAvsPt(0x0)
48 ,fDiffDCAvsNt(0x0)
49{
50 //
51 // Default constructor
52 //
53
54 Init();
55
56}
57
58//_______________________________________________________________________________________________
59AliHFEpriVtx::AliHFEpriVtx(const AliHFEpriVtx &p):
60 TObject(p)
61 ,fESD1(0x0)
62 ,fStack(0x0)
63 ,fNtrackswoPid(p.fNtrackswoPid)
64 ,fHNtrackswoPid(0x0)
65 ,fNESDprimVtxContributor(0x0)
66 ,fNESDprimVtxIndices(0x0)
67 ,fDiffDCAvsPt(0x0)
68 ,fDiffDCAvsNt(0x0)
69{
70 //
71 // Copy constructor
72 //
73}
74
75//_______________________________________________________________________________________________
76AliHFEpriVtx&
77AliHFEpriVtx::operator=(const AliHFEpriVtx &)
78{
79 //
80 // Assignment operator
81 //
82
83 AliInfo("Not yet implemented.");
84 return *this;
85}
86
87//_______________________________________________________________________________________________
88AliHFEpriVtx::~AliHFEpriVtx()
89{
90 //
91 // Destructor
92 //
93
94 AliInfo("Analysis Done.");
95}
96
97//__________________________________________
98void AliHFEpriVtx::Init()
99{
100 //
101 // initialize counters
102 //
103
104 fNtrackswoPid = 0;
105 for (int i=0; i<10; i++){
106 fPrimVtx[i].fNtrackCount = 0 ;
107 fPrimVtx[i].fNprimVtxContributorCount = 0 ;
108 }
109}
110
111//_______________________________________________________________________________________________
112void AliHFEpriVtx::CreateHistograms(TString hnopt)
113{
114 //
115 // create histograms
116 //
117
118 fkSourceLabel[kAll]="all";
119 fkSourceLabel[kDirectCharm]="directCharm";
120 fkSourceLabel[kDirectBeauty]="directBeauty";
121 fkSourceLabel[kBeautyCharm]="beauty2charm";
122 fkSourceLabel[kGamma]="gamma";
123 fkSourceLabel[kPi0]="pi0";
124 fkSourceLabel[kElse]="others";
125 fkSourceLabel[kBeautyGamma]="beauty22gamma";
126 fkSourceLabel[kBeautyPi0]="beauty22pi0";
127 fkSourceLabel[kBeautyElse]="beauty22others";
128
129
130 TString hname;
131 for (Int_t isource = 0; isource < 10; isource++ ){
132
133 hname=hnopt+"ntracks_"+fkSourceLabel[isource];
134 fPrimVtx[isource].fNtracks = new TH1F(hname,hname,50,0,50);
135 hname=hnopt+"nPrimVtxContributor_"+fkSourceLabel[isource];
136 fPrimVtx[isource].fNprimVtxContributor = new TH1F(hname,hname,100,0,100);
137 hname=hnopt+"PtElec_"+fkSourceLabel[isource];
78ea5ef4 138 fPrimVtx[isource].fPtElec = new TH1F(hname,hname,250,0,50);
259c3296 139 hname=hnopt+"PtElecContributor_"+fkSourceLabel[isource];
78ea5ef4 140 fPrimVtx[isource].fPtElecContributor = new TH1F(hname,hname,250,0,50);
259c3296 141
142 }
143
144 hname=hnopt+"ntrackswopid";
145 fHNtrackswoPid = new TH1F(hname,hname,50,0,50);
146 hname=hnopt+"nESDprimVtxContributor";
147 fNESDprimVtxContributor = new TH1I(hname,hname,100,0,100);
148 hname=hnopt+"nESDprimVtxIndices";
149 fNESDprimVtxIndices= new TH1I(hname,hname,100,0,100);
150 hname=hnopt+"diffDCAvsPt";
78ea5ef4 151 fDiffDCAvsPt = new TH2F(hname,hname,250,0,50,500,0,1);
259c3296 152 hname=hnopt+"diffDCAvsNt";
153 fDiffDCAvsNt = new TH2F(hname,hname,100,0,100,500,0,1);
154
155}
156
157//_______________________________________________________________________________________________
158void AliHFEpriVtx::CountNtracks(Int_t sourcePart, Int_t recpid, Double_t recprob)
159{
160 //
161 // count number of tracks passed certain cuts
162 //
163
164 fNtrackswoPid++;
165
166 if (!recpid && recprob>0.5)
167 fPrimVtx[kAll].fNtrackCount++;
168 if(sourcePart<0) return;
169 fPrimVtx[sourcePart].fNtrackCount++;
170
171}
172
173//_______________________________________________________________________________________________
174void AliHFEpriVtx::FillNtracks()
175{
176 //
177 // count number of tracks passed certain cuts
178 //
179
180 fHNtrackswoPid->Fill(fNtrackswoPid);
181 for (int i=0; i<10; i++){
182 fPrimVtx[i].fNtracks->Fill(fPrimVtx[i].fNtrackCount);
183 }
184
185}
186
187//_______________________________________________________________________________________________
188Int_t AliHFEpriVtx::GetMCPID(AliESDtrack *track)
189{
190 //
191 // get MC pid
192 //
193
194 Int_t label = TMath::Abs(track->GetLabel());
195 TParticle* mcpart = fStack->Particle(label);
196 if ( !mcpart ) return 0;
197 Int_t pdgCode = mcpart->GetPdgCode();
198
199 return pdgCode;
200}
201
202//_______________________________________________________________________________________________
203void AliHFEpriVtx::GetNPriVxtContributor()
204{
205 //
206 // count number of primary vertex contributor
207 //
208
209 const AliESDVertex *primvtx = fESD1->GetPrimaryVertex();
210 fNESDprimVtxContributor->Fill(primvtx->GetNContributors());
211 fNESDprimVtxIndices->Fill(primvtx->GetNIndices());
212}
213
214//_______________________________________________________________________________________________
215void AliHFEpriVtx::CountPriVxtElecContributor(AliESDtrack *ESDelectron, Int_t sourcePart, Int_t recpid, Double_t recprob)
216{
217 //
218 // count number of electrons contributing to the primary vertex
219 //
220
221
222 if (recpid || recprob<0.5) return;
223
224 // get track id of our selected electron
225 Int_t elecTrkID = ESDelectron->GetID();
226
227 Int_t label = TMath::Abs(ESDelectron->GetLabel());
228 TParticle* mcpart = fStack->Particle(label);
229
230 AliKFParticle::SetField(fESD1->GetMagneticField());
231 AliKFParticle kfElectron(*ESDelectron,11);
232
233 // prepare kfprimary vertex
234 AliKFVertex kfESDprimary;
235
236 // Reconstructed Primary Vertex (with ESD tracks)
237 const AliESDVertex *primvtx = fESD1->GetPrimaryVertex();
238// Int_t nt = primvtx->GetNContributors();
239 Int_t n=primvtx->GetNIndices();
240
241 if (n>0 && primvtx->GetStatus()){
242
243 kfESDprimary = AliKFVertex(*primvtx);
244 Double_t dcaBFrmElec = kfElectron.GetDistanceFromVertexXY(kfESDprimary);
245
246 UShort_t *priIndex = primvtx->GetIndices();
247
248 fPrimVtx[kAll].fPtElec->Fill(mcpart->Pt());
249 if(sourcePart>=0) fPrimVtx[sourcePart].fPtElec->Fill(mcpart->Pt());
250
251 for (Int_t i=0;i<n;i++){
252
253 Int_t idx = Int_t(priIndex[i]);
254 if (idx == elecTrkID){
255 fPrimVtx[kAll].fNprimVtxContributorCount++;
256 fPrimVtx[kAll].fPtElecContributor->Fill(mcpart->Pt());
257 if(sourcePart<0) continue;
258 fPrimVtx[sourcePart].fNprimVtxContributorCount++;
259 fPrimVtx[sourcePart].fPtElecContributor->Fill(mcpart->Pt());
260
261 kfESDprimary -= kfElectron;
262 Double_t dcaAFrmElec = kfElectron.GetDistanceFromVertexXY(kfESDprimary);
263 fDiffDCAvsPt->Fill(mcpart->Pt(),dcaBFrmElec-dcaAFrmElec);
264 fDiffDCAvsNt->Fill(n,dcaBFrmElec-dcaAFrmElec);
265 }
266 }
267 }
268
269}
270
271//_______________________________________________________________________________________________
75d81601 272void AliHFEpriVtx::FillNprimVtxContributor() const
259c3296 273{
274 //
275 // Fill histogram with number of electrons contributing to the primary vertex
276 //
277
278 for (int i=0; i<10; i++){
279 fPrimVtx[i].fNprimVtxContributor->Fill(fPrimVtx[i].fNprimVtxContributorCount);
280 }
281
282}