]>
Commit | Line | Data |
---|---|---|
7f6ddf58 | 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 | **************************************************************************/ | |
15 | ||
16 | //------------------------------------------------------------------------- | |
17 | // Implementation of the V0 vertexer class | |
18856a77 | 18 | // reads tracks writes out V0 vertices |
19 | // fills the ESD with the V0s | |
7f6ddf58 | 20 | // Origin: Iouri Belikov, IReS, Strasbourg, Jouri.Belikov@cern.ch |
21 | //------------------------------------------------------------------------- | |
7f6ddf58 | 22 | #include <TObjArray.h> |
116cbefd | 23 | #include <TTree.h> |
7f6ddf58 | 24 | |
e23730c7 | 25 | #include "AliESD.h" |
26 | #include "AliESDtrack.h" | |
116cbefd | 27 | #include "AliITStrackV2.h" |
7f6ddf58 | 28 | #include "AliV0vertex.h" |
29 | #include "AliV0vertexer.h" | |
7f6ddf58 | 30 | |
31 | ClassImp(AliV0vertexer) | |
32 | ||
e23730c7 | 33 | Int_t AliV0vertexer::Tracks2V0vertices(AliESD *event) { |
34 | //-------------------------------------------------------------------- | |
35 | //This function reconstructs V0 vertices | |
36 | //-------------------------------------------------------------------- | |
37 | ||
38 | Int_t nentr=event->GetNumberOfTracks(); | |
39 | ||
40 | TObjArray negtrks(nentr/2); | |
41 | TObjArray postrks(nentr/2); | |
42 | ||
43 | Int_t nneg=0, npos=0, nvtx=0; | |
44 | ||
45 | Int_t i; | |
46 | for (i=0; i<nentr; i++) { | |
47 | AliESDtrack *esd=event->GetTrack(i); | |
48 | Int_t status=esd->GetStatus(); | |
49 | ||
50 | if ((status&AliESDtrack::kITSrefit)==0) | |
51 | if ((status&AliESDtrack::kITSout)!=0 || (status&AliESDtrack::kITSin)==0) | |
52 | continue; | |
53 | ||
54 | AliITStrackV2 *iotrack=new AliITStrackV2(*esd); | |
55 | iotrack->SetLabel(i); // now it is the index in array of ESD tracks | |
18856a77 | 56 | if ((status&AliESDtrack::kITSrefit)==0) //correction for the beam pipe |
57 | iotrack->PropagateTo(3.,0.0023,65.19); //material | |
e23730c7 | 58 | iotrack->PropagateTo(2.5,0.,0.); |
59 | ||
60 | if (iotrack->Get1Pt() > 0.) {nneg++; negtrks.AddLast(iotrack);} | |
61 | else {npos++; postrks.AddLast(iotrack);} | |
62 | } | |
63 | ||
64 | ||
65 | for (i=0; i<nneg; i++) { | |
66 | //if (i%10==0) cerr<<nneg-i<<'\r'; | |
67 | AliITStrackV2 *ntrk=(AliITStrackV2 *)negtrks.UncheckedAt(i); | |
68 | ||
69 | if (TMath::Abs(ntrk->GetD(fX,fY))<fDPmin) continue; | |
70 | if (TMath::Abs(ntrk->GetD(fX,fY))>fRmax) continue; | |
71 | ||
72 | for (Int_t k=0; k<npos; k++) { | |
73 | AliITStrackV2 *ptrk=(AliITStrackV2 *)postrks.UncheckedAt(k); | |
74 | ||
75 | if (TMath::Abs(ptrk->GetD(fX,fY))<fDPmin) continue; | |
76 | if (TMath::Abs(ptrk->GetD(fX,fY))>fRmax) continue; | |
77 | ||
78 | if (TMath::Abs(ntrk->GetD(fX,fY))<fDNmin) | |
79 | if (TMath::Abs(ptrk->GetD(fX,fY))<fDNmin) continue; | |
80 | ||
81 | ||
82 | AliITStrackV2 nt(*ntrk), pt(*ptrk), *pnt=&nt, *ppt=&pt; | |
83 | ||
84 | Double_t dca=PropagateToDCA(pnt,ppt); | |
85 | if (dca > fDCAmax) continue; | |
86 | ||
87 | AliV0vertex vertex(*pnt,*ppt); | |
88 | if (vertex.GetChi2() > fChi2max) continue; | |
89 | ||
90 | /* Think of something better here ! | |
91 | nt.PropagateToVertex(); if (TMath::Abs(nt.GetZ())<0.04) continue; | |
92 | pt.PropagateToVertex(); if (TMath::Abs(pt.GetZ())<0.04) continue; | |
93 | */ | |
94 | ||
95 | Double_t x,y,z; vertex.GetXYZ(x,y,z); | |
96 | Double_t r2=x*x + y*y; | |
97 | if (r2 > fRmax*fRmax) continue; | |
98 | if (r2 < fRmin*fRmin) continue; | |
99 | ||
100 | Double_t px,py,pz; vertex.GetPxPyPz(px,py,pz); | |
101 | Double_t p2=px*px+py*py+pz*pz; | |
102 | Double_t cost=((x-fX)*px + (y-fY)*py + (z-fZ)*pz)/ | |
103 | TMath::Sqrt(p2*((x-fX)*(x-fX) + (y-fY)*(y-fY) + (z-fZ)*(z-fZ))); | |
104 | ||
105 | //if (cost < (5*fCPAmax-0.9-TMath::Sqrt(r2)*(fCPAmax-1))/4.1) continue; | |
106 | if (cost < fCPAmax) continue; | |
107 | ||
108 | //vertex.ChangeMassHypothesis(); //default is Lambda0 | |
109 | ||
110 | event->AddV0(&vertex); | |
111 | ||
112 | nvtx++; | |
113 | } | |
114 | } | |
115 | ||
116 | Info("Tracks2V0vertices","Number of reconstructed V0 vertices: %d",nvtx); | |
117 | ||
118 | negtrks.Delete(); | |
119 | postrks.Delete(); | |
120 | ||
121 | return 0; | |
122 | } | |
123 | ||
566abf75 | 124 | Int_t AliV0vertexer::Tracks2V0vertices(TTree *tTree, TTree *vTree) { |
7f6ddf58 | 125 | //-------------------------------------------------------------------- |
126 | //This function reconstructs V0 vertices | |
127 | //-------------------------------------------------------------------- | |
566abf75 | 128 | TBranch *branch=tTree->GetBranch("tracks"); |
129 | if (!branch) { | |
130 | Error("Tracks2V0vertices","Can't get the branch !"); | |
131 | return 1; | |
7f6ddf58 | 132 | } |
566abf75 | 133 | Int_t nentr=(Int_t)tTree->GetEntries(); |
7f6ddf58 | 134 | |
135 | TObjArray negtrks(nentr/2); | |
136 | TObjArray postrks(nentr/2); | |
137 | ||
138 | Int_t nneg=0, npos=0, nvtx=0; | |
139 | ||
140 | Int_t i; | |
141 | for (i=0; i<nentr; i++) { | |
142 | AliITStrackV2 *iotrack=new AliITStrackV2; | |
143 | branch->SetAddress(&iotrack); | |
566abf75 | 144 | tTree->GetEvent(i); |
4ab260d6 | 145 | |
146 | iotrack->PropagateTo(3.,0.0023,65.19); iotrack->PropagateTo(2.5,0.,0.); | |
147 | ||
7f6ddf58 | 148 | if (iotrack->Get1Pt() > 0.) {nneg++; negtrks.AddLast(iotrack);} |
149 | else {npos++; postrks.AddLast(iotrack);} | |
150 | } | |
151 | ||
152 | ||
7f6ddf58 | 153 | AliV0vertex *ioVertex=0; |
566abf75 | 154 | branch=vTree->GetBranch("vertices"); |
155 | if (!branch) vTree->Branch("vertices","AliV0vertex",&ioVertex,32000,3); | |
156 | else branch->SetAddress(&ioVertex); | |
7f6ddf58 | 157 | |
158 | ||
159 | for (i=0; i<nneg; i++) { | |
e23730c7 | 160 | //if (i%10==0) cerr<<nneg-i<<'\r'; |
7f6ddf58 | 161 | AliITStrackV2 *ntrk=(AliITStrackV2 *)negtrks.UncheckedAt(i); |
a9a2d814 | 162 | |
5d390eda | 163 | if (TMath::Abs(ntrk->GetD(fX,fY))<fDPmin) continue; |
164 | if (TMath::Abs(ntrk->GetD(fX,fY))>fRmax) continue; | |
4ab260d6 | 165 | |
7f6ddf58 | 166 | for (Int_t k=0; k<npos; k++) { |
167 | AliITStrackV2 *ptrk=(AliITStrackV2 *)postrks.UncheckedAt(k); | |
168 | ||
5d390eda | 169 | if (TMath::Abs(ptrk->GetD(fX,fY))<fDPmin) continue; |
170 | if (TMath::Abs(ptrk->GetD(fX,fY))>fRmax) continue; | |
4ab260d6 | 171 | |
5d390eda | 172 | if (TMath::Abs(ntrk->GetD(fX,fY))<fDNmin) |
173 | if (TMath::Abs(ptrk->GetD(fX,fY))<fDNmin) continue; | |
4ab260d6 | 174 | |
7f6ddf58 | 175 | |
176 | AliITStrackV2 nt(*ntrk), pt(*ptrk), *pnt=&nt, *ppt=&pt; | |
177 | ||
178 | Double_t dca=PropagateToDCA(pnt,ppt); | |
179 | if (dca > fDCAmax) continue; | |
180 | ||
181 | AliV0vertex vertex(*pnt,*ppt); | |
182 | if (vertex.GetChi2() > fChi2max) continue; | |
183 | ||
184 | /* Think of something better here ! | |
185 | nt.PropagateToVertex(); if (TMath::Abs(nt.GetZ())<0.04) continue; | |
186 | pt.PropagateToVertex(); if (TMath::Abs(pt.GetZ())<0.04) continue; | |
187 | */ | |
188 | ||
189 | Double_t x,y,z; vertex.GetXYZ(x,y,z); | |
190 | Double_t r2=x*x + y*y; | |
191 | if (r2 > fRmax*fRmax) continue; | |
192 | if (r2 < fRmin*fRmin) continue; | |
193 | ||
194 | Double_t px,py,pz; vertex.GetPxPyPz(px,py,pz); | |
195 | Double_t p2=px*px+py*py+pz*pz; | |
5d390eda | 196 | Double_t cost=((x-fX)*px + (y-fY)*py + (z-fZ)*pz)/ |
e23730c7 | 197 | TMath::Sqrt(p2*((x-fX)*(x-fX) + (y-fY)*(y-fY) + (z-fZ)*(z-fZ))); |
4ab260d6 | 198 | |
e23730c7 | 199 | //if (cost < (5*fCPAmax-0.9-TMath::Sqrt(r2)*(fCPAmax-1))/4.1) continue; |
5d390eda | 200 | if (cost < fCPAmax) continue; |
7f6ddf58 | 201 | |
202 | //vertex.ChangeMassHypothesis(); //default is Lambda0 | |
203 | ||
566abf75 | 204 | ioVertex=&vertex; vTree->Fill(); |
7f6ddf58 | 205 | |
206 | nvtx++; | |
207 | } | |
208 | } | |
209 | ||
e23730c7 | 210 | Info("Tracks2V0vertices","Number of reconstructed V0 vertices: %d",nvtx); |
7f6ddf58 | 211 | |
7f6ddf58 | 212 | negtrks.Delete(); |
213 | postrks.Delete(); | |
214 | ||
7f6ddf58 | 215 | return 0; |
216 | } | |
217 | ||
18856a77 | 218 | Double_t |
219 | AliV0vertexer::PropagateToDCA(AliITStrackV2 *n, AliITStrackV2 *p) const { | |
7f6ddf58 | 220 | //-------------------------------------------------------------------- |
221 | // This function returns the DCA between two tracks | |
222 | // The tracks will be moved to the point of DCA ! | |
223 | //-------------------------------------------------------------------- | |
49a7a79a | 224 | return n->PropagateToDCA(p); |
7f6ddf58 | 225 | } |
226 | ||
227 | ||
228 | ||
229 | ||
230 | ||
231 | ||
232 | ||
233 | ||
234 | ||
235 | ||
236 | ||
237 | ||
238 | ||
239 | ||
240 | ||
241 |