]>
Commit | Line | Data |
---|---|---|
73042f01 | 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 | ||
803d1ab0 | 16 | /* $Id$ */ |
0938c7d3 | 17 | |
73042f01 | 18 | //----------------------------------------------------------------- |
19 | // Implementation of the TPC track class | |
7c27857f | 20 | // This class is used by the AliTPCtracker class |
21 | // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch | |
73042f01 | 22 | //----------------------------------------------------------------- |
23 | ||
19364939 | 24 | #include <Riostream.h> |
b19a0509 | 25 | |
73042f01 | 26 | #include "AliTPCtrack.h" |
7c27857f | 27 | #include "AliCluster.h" |
6c94f330 | 28 | #include "AliTracker.h" |
83d73500 | 29 | #include "AliESDtrack.h" |
73042f01 | 30 | |
31 | ClassImp(AliTPCtrack) | |
b9de75e1 | 32 | |
e3f7105e | 33 | //_________________________________________________________________________ |
e13cc304 | 34 | AliTPCtrack::AliTPCtrack(): |
35 | AliKalmanTrack(), | |
e13cc304 | 36 | fdEdx(0), |
e13cc304 | 37 | fSdEdx(1e10), |
38 | fNFoundable(0), | |
39 | fBConstrain(kFALSE), | |
40 | fLastPoint(-1), | |
41 | fFirstPoint(-1), | |
42 | fRemoval(0), | |
43 | fTrackType(0), | |
44 | fLab2(-1), | |
45 | fNShared(0), | |
46 | fReference() | |
e3f7105e | 47 | { |
2fc0c115 | 48 | //------------------------------------------------- |
49 | // default constructor | |
50 | //------------------------------------------------- | |
e13cc304 | 51 | for (Int_t i=0; i<kMaxRow;i++) fIndex[i]=-2; |
52 | for (Int_t i=0; i<4;i++) fPoints[i]=0.; | |
53 | for (Int_t i=0; i<12;i++) fKinkPoint[i]=0.; | |
c84a5e9e | 54 | for (Int_t i=0; i<3;i++) fKinkIndexes[i]=0; |
e13cc304 | 55 | for (Int_t i=0; i<3;i++) fV0Indexes[i]=0; |
e3f7105e | 56 | } |
57 | ||
73042f01 | 58 | //_________________________________________________________________________ |
51ad6848 | 59 | |
60 | ||
61 | ||
6c94f330 | 62 | AliTPCtrack::AliTPCtrack(Double_t x, Double_t alpha, const Double_t p[5], |
63 | const Double_t cov[15], Int_t index) : | |
e13cc304 | 64 | AliKalmanTrack(), |
e13cc304 | 65 | fdEdx(0), |
e13cc304 | 66 | fSdEdx(1e10), |
67 | fNFoundable(0), | |
68 | fBConstrain(kFALSE), | |
69 | fLastPoint(0), | |
70 | fFirstPoint(0), | |
71 | fRemoval(0), | |
72 | fTrackType(0), | |
73 | fLab2(0), | |
74 | fNShared(0), | |
75 | fReference() | |
76 | { | |
73042f01 | 77 | //----------------------------------------------------------------- |
78 | // This is the main track constructor. | |
79 | //----------------------------------------------------------------- | |
beceeaec | 80 | Double_t cnv=1./(AliTracker::GetBz()*kB2C); |
6c94f330 | 81 | |
82 | Double_t pp[5]={ | |
83 | p[0], | |
84 | p[1], | |
85 | x*p[4] - p[2], | |
86 | p[3], | |
87 | p[4]*cnv | |
88 | }; | |
89 | ||
90 | Double_t c22 = x*x*cov[14] - 2*x*cov[12] + cov[5]; | |
91 | Double_t c32 = x*cov[13] - cov[8]; | |
92 | Double_t c20 = x*cov[10] - cov[3], | |
93 | c21 = x*cov[11] - cov[4], c42 = x*cov[14] - cov[12]; | |
94 | ||
95 | Double_t cc[15]={ | |
96 | cov[0 ], | |
97 | cov[1 ], cov[2 ], | |
98 | c20, c21, c22, | |
99 | cov[6 ], cov[7 ], c32, cov[9 ], | |
100 | cov[10]*cnv, cov[11]*cnv, c42*cnv, cov[13]*cnv, cov[14]*cnv*cnv | |
101 | }; | |
102 | ||
86fc30dc | 103 | Double_t mostProbablePt=AliExternalTrackParam::GetMostProbablePt(); |
104 | Double_t p0=TMath::Sign(1/mostProbablePt,pp[4]); | |
beceeaec | 105 | Double_t w0=cc[14]/(cc[14] + p0*p0), w1=p0*p0/(cc[14] + p0*p0); |
106 | pp[4] = w0*p0 + w1*pp[4]; | |
107 | cc[10]*=w1; cc[11]*=w1; cc[12]*=w1; cc[13]*=w1; cc[14]*=w1; | |
108 | ||
6c94f330 | 109 | Set(x,alpha,pp,cc); |
c84a5e9e | 110 | |
be9c5115 | 111 | SetNumberOfClusters(1); |
e13cc304 | 112 | |
113 | fIndex[0]=index; | |
9fe5b2ff | 114 | for (Int_t i=1; i<kMaxRow;i++) fIndex[i]=-2; |
115 | for (Int_t i=0; i<4;i++) fPoints[i]=0.; | |
116 | for (Int_t i=0; i<12;i++) fKinkPoint[i]=0.; | |
51ad6848 | 117 | for (Int_t i=0; i<3;i++) fKinkIndexes[i]=0; |
81e97e0d | 118 | for (Int_t i=0; i<3;i++) fV0Indexes[i]=0; |
b9de75e1 | 119 | } |
120 | ||
83d73500 | 121 | //_____________________________________________________________________________ |
e13cc304 | 122 | AliTPCtrack::AliTPCtrack(const AliESDtrack& t) : |
123 | AliKalmanTrack(), | |
6c94f330 | 124 | fdEdx(t.GetTPCsignal()), |
e13cc304 | 125 | fSdEdx(1e10), |
126 | fNFoundable(0), | |
127 | fBConstrain(kFALSE), | |
128 | fLastPoint(0), | |
129 | fFirstPoint(0), | |
130 | fRemoval(0), | |
131 | fTrackType(0), | |
132 | fLab2(0), | |
133 | fNShared(0), | |
134 | fReference() | |
135 | { | |
83d73500 | 136 | //----------------------------------------------------------------- |
137 | // Conversion AliESDtrack -> AliTPCtrack. | |
138 | //----------------------------------------------------------------- | |
139 | SetNumberOfClusters(t.GetTPCclusters(fIndex)); | |
140 | SetLabel(t.GetLabel()); | |
141 | SetMass(t.GetMass()); | |
9fe5b2ff | 142 | for (Int_t i=0; i<4;i++) fPoints[i]=0.; |
143 | for (Int_t i=0; i<12;i++) fKinkPoint[i]=0.; | |
144 | for (Int_t i=0; i<3;i++) fKinkIndexes[i]=0; | |
145 | for (Int_t i=0; i<3;i++) fV0Indexes[i]=0; | |
83d73500 | 146 | |
6c94f330 | 147 | Set(t.GetX(),t.GetAlpha(),t.GetParameter(),t.GetCovariance()); |
83d73500 | 148 | |
0798b21e | 149 | if ((t.GetStatus()&AliESDtrack::kTIME) == 0) return; |
83d73500 | 150 | StartTimeIntegral(); |
151 | Double_t times[10]; t.GetIntegratedTimes(times); SetIntegratedTimes(times); | |
152 | SetIntegratedLength(t.GetIntegratedLength()); | |
153 | } | |
154 | ||
73042f01 | 155 | //_____________________________________________________________________________ |
e13cc304 | 156 | AliTPCtrack::AliTPCtrack(const AliTPCtrack& t) : |
157 | AliKalmanTrack(t), | |
e13cc304 | 158 | fdEdx(t.fdEdx), |
e13cc304 | 159 | fSdEdx(t.fSdEdx), |
160 | fNFoundable(t.fNFoundable), | |
161 | fBConstrain(t.fBConstrain), | |
162 | fLastPoint(t.fLastPoint), | |
163 | fFirstPoint(t.fFirstPoint), | |
164 | fRemoval(t.fRemoval), | |
165 | fTrackType(t.fTrackType), | |
166 | fLab2(t.fLab2), | |
167 | fNShared(t.fNShared), | |
168 | fReference(t.fReference) | |
169 | ||
170 | { | |
73042f01 | 171 | //----------------------------------------------------------------- |
172 | // This is a track copy constructor. | |
173 | //----------------------------------------------------------------- | |
6c94f330 | 174 | Set(t.GetX(),t.GetAlpha(),t.GetParameter(),t.GetCovariance()); |
175 | ||
51584047 | 176 | for (Int_t i=0; i<kMaxRow; i++) fIndex[i]=t.fIndex[i]; |
9fe5b2ff | 177 | for (Int_t i=0; i<4;i++) fPoints[i]=t.fPoints[i]; |
178 | for (Int_t i=0; i<12;i++) fKinkPoint[i]=t.fKinkPoint[i]; | |
51ad6848 | 179 | for (Int_t i=0; i<3;i++) fKinkIndexes[i]=t.fKinkIndexes[i]; |
81e97e0d | 180 | for (Int_t i=0; i<3;i++) fV0Indexes[i]=t.fV0Indexes[i]; |
be9c5115 | 181 | } |
182 | ||
316c6cd9 | 183 | AliTPCtrack& AliTPCtrack::operator=(const AliTPCtrack& o){ |
184 | if(this!=&o){ | |
185 | AliKalmanTrack::operator=(o); | |
186 | fdEdx = o.fdEdx; | |
187 | for(Int_t i = 0;i<kMaxRow;++i)fIndex[i] = o.fIndex[i]; | |
188 | for(Int_t i = 0;i<4;++i)fPoints[i] = o.fPoints[i]; | |
189 | fSdEdx = o.fSdEdx; | |
190 | fNFoundable = o.fNFoundable; | |
191 | fBConstrain = o.fBConstrain; | |
192 | fLastPoint = o.fLastPoint; | |
193 | fFirstPoint = o.fFirstPoint; | |
194 | fTrackType = o.fTrackType; | |
195 | fLab2 = o.fLab2; | |
196 | fNShared = o.fNShared; | |
197 | fReference = o.fReference; | |
198 | for(Int_t i = 0;i<12;++i) fKinkPoint[i] = o.fKinkPoint[i]; | |
199 | ||
200 | for(Int_t i = 0;i<3;++i){ | |
201 | fKinkIndexes[i] = o.fKinkIndexes[i]; | |
202 | fV0Indexes[i] = o.fV0Indexes[i]; | |
203 | } | |
204 | } | |
205 | return *this; | |
206 | ||
207 | } | |
208 | ||
209 | ||
be9c5115 | 210 | //_____________________________________________________________________________ |
211 | Int_t AliTPCtrack::Compare(const TObject *o) const { | |
212 | //----------------------------------------------------------------- | |
213 | // This function compares tracks according to the their curvature | |
214 | //----------------------------------------------------------------- | |
215 | AliTPCtrack *t=(AliTPCtrack*)o; | |
6c23ffed | 216 | //Double_t co=t->OneOverPt(); |
217 | //Double_t c = OneOverPt(); | |
024a7fe9 | 218 | Double_t co=t->GetSigmaY2()*t->GetSigmaZ2(); |
219 | Double_t c =GetSigmaY2()*GetSigmaZ2(); | |
be9c5115 | 220 | if (c>co) return 1; |
221 | else if (c<co) return -1; | |
222 | return 0; | |
223 | } | |
224 | ||
6c94f330 | 225 | Double_t AliTPCtrack::GetPredictedChi2(const AliCluster *c) const { |
be9c5115 | 226 | //----------------------------------------------------------------- |
227 | // This function calculates a predicted chi2 increment. | |
228 | //----------------------------------------------------------------- | |
6c94f330 | 229 | Double_t p[2]={c->GetY(), c->GetZ()}; |
230 | Double_t cov[3]={c->GetSigmaY2(), 0., c->GetSigmaZ2()}; | |
231 | return AliExternalTrackParam::GetPredictedChi2(p,cov); | |
c630aafd | 232 | } |
233 | ||
73042f01 | 234 | //_____________________________________________________________________________ |
6c94f330 | 235 | Bool_t AliTPCtrack::PropagateTo(Double_t xk,Double_t rho,Double_t x0) { |
73042f01 | 236 | //----------------------------------------------------------------- |
6c94f330 | 237 | // This function propagates a track to a reference plane x=xk. |
238 | // rho - density of the crossed matrial (g/cm^3) | |
239 | // x0 - radiation length of the crossed material (g/cm^2) | |
73042f01 | 240 | //----------------------------------------------------------------- |
6c94f330 | 241 | Double_t oldX=GetX(), oldY=GetY(), oldZ=GetZ(); |
c84a5e9e | 242 | |
6c94f330 | 243 | Double_t bz=GetBz(); |
244 | if (!AliExternalTrackParam::PropagateTo(xk,bz)) return kFALSE; | |
73042f01 | 245 | |
6c94f330 | 246 | Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) + |
247 | (GetY()-oldY)*(GetY()-oldY) + | |
248 | (GetZ()-oldZ)*(GetZ()-oldZ)); | |
249 | if (IsStartedTimeIntegral() && GetX()>oldX) AddTimeStep(d); | |
250 | ||
251 | if (oldX < xk) d = -d; | |
252 | if (!AliExternalTrackParam::CorrectForMaterial(d*rho/x0,x0,GetMass())) | |
253 | return kFALSE; | |
e3f7105e | 254 | |
6c94f330 | 255 | return kTRUE; |
73042f01 | 256 | } |
257 | ||
258 | //_____________________________________________________________________________ | |
6c94f330 | 259 | Bool_t |
260 | AliTPCtrack::PropagateToVertex(const AliESDVertex *v,Double_t d,Double_t x0) | |
73042f01 | 261 | { |
262 | //----------------------------------------------------------------- | |
6c94f330 | 263 | // This function propagates tracks to the vertex. |
73042f01 | 264 | //----------------------------------------------------------------- |
6c94f330 | 265 | Double_t bz=GetBz(); |
266 | if (PropagateToDCA(v,bz,kVeryBig)) | |
267 | if (AliExternalTrackParam::CorrectForMaterial(d,x0,GetMass())) return kTRUE; | |
268 | return kFALSE; | |
73042f01 | 269 | } |
270 | ||
271 | //_____________________________________________________________________________ | |
6c94f330 | 272 | Bool_t AliTPCtrack::Update(const AliCluster *c, Double_t chisq, Int_t index) { |
73042f01 | 273 | //----------------------------------------------------------------- |
274 | // This function associates a cluster with this track. | |
275 | //----------------------------------------------------------------- | |
6c94f330 | 276 | Double_t p[2]={c->GetY(), c->GetZ()}; |
277 | Double_t cov[3]={c->GetSigmaY2(), 0., c->GetSigmaZ2()}; | |
73042f01 | 278 | |
6c94f330 | 279 | if (!AliExternalTrackParam::Update(p,cov)) return kFALSE; |
73042f01 | 280 | |
70e20dcf | 281 | AliTracker::FillResiduals(this,p,cov,c->GetVolumeId()); |
282 | ||
be9c5115 | 283 | Int_t n=GetNumberOfClusters(); |
284 | fIndex[n]=index; | |
285 | SetNumberOfClusters(n+1); | |
286 | SetChi2(GetChi2()+chisq); | |
287 | ||
6c94f330 | 288 | return kTRUE; |
73042f01 | 289 | } |
290 | ||
51584047 | 291 | //////////////////////////////////////////////////////////////////////// |
292 | // MI ADDITION | |
293 | ||
294 | Float_t AliTPCtrack::Density(Int_t row0, Int_t row1) | |
295 | { | |
296 | // | |
297 | // calculate cluster density | |
298 | Int_t good = 0; | |
299 | Int_t found = 0; | |
300 | //if (row0<fFirstPoint) row0 = fFirstPoint; | |
301 | if (row1>fLastPoint) row1 = fLastPoint; | |
302 | ||
303 | ||
304 | for (Int_t i=row0;i<=row1;i++){ | |
305 | // Int_t index = fClusterIndex[i]; | |
306 | Int_t index = fIndex[i]; | |
307 | if (index!=-1) good++; | |
308 | if (index>0) found++; | |
309 | } | |
310 | Float_t density=0; | |
311 | if (good>0) density = Float_t(found)/Float_t(good); | |
312 | return density; | |
313 | } | |
314 | ||
315 | ||
316 | Float_t AliTPCtrack::Density2(Int_t row0, Int_t row1) | |
317 | { | |
318 | // | |
319 | // calculate cluster density | |
320 | Int_t good = 0; | |
321 | Int_t found = 0; | |
322 | // | |
323 | for (Int_t i=row0;i<=row1;i++){ | |
324 | Int_t index = fIndex[i]; | |
325 | if (index!=-1) good++; | |
326 | if (index>0) found++; | |
327 | } | |
328 | Float_t density=0; | |
329 | if (good>0) density = Float_t(found)/Float_t(good); | |
330 | return density; | |
331 | } | |
332 | ||
51ad6848 | 333 | void AliTPCtrack::UpdatePoints() |
334 | { | |
335 | //-------------------------------------------------- | |
336 | //calculates first ,amx dens and last points | |
337 | //-------------------------------------------------- | |
338 | Float_t density[160]; | |
339 | for (Int_t i=0;i<160;i++) density[i]=-1.; | |
340 | fPoints[0]= 160; | |
341 | fPoints[1] = -1; | |
342 | // | |
343 | Int_t ngood=0; | |
344 | Int_t undeff=0; | |
345 | Int_t nall =0; | |
346 | Int_t range=20; | |
347 | for (Int_t i=0;i<160;i++){ | |
348 | Int_t last = i-range; | |
349 | if (nall<range) nall++; | |
350 | if (last>=0){ | |
351 | if (fIndex[last]>0&& (fIndex[last]&0x8000)==0) ngood--; | |
352 | if (fIndex[last]==-1) undeff--; | |
353 | } | |
354 | if (fIndex[i]>0&& (fIndex[i]&0x8000)==0) ngood++; | |
355 | if (fIndex[i]==-1) undeff++; | |
356 | if (nall==range &&undeff<range/2) density[i-range/2] = Float_t(ngood)/Float_t(nall-undeff); | |
357 | } | |
358 | Float_t maxdens=0; | |
359 | Int_t indexmax =0; | |
360 | for (Int_t i=0;i<160;i++){ | |
361 | if (density[i]<0) continue; | |
362 | if (density[i]>maxdens){ | |
363 | maxdens=density[i]; | |
364 | indexmax=i; | |
365 | } | |
366 | } | |
367 | // | |
368 | //max dens point | |
369 | fPoints[3] = maxdens; | |
370 | fPoints[1] = indexmax; | |
371 | // | |
372 | // last point | |
373 | for (Int_t i=indexmax;i<160;i++){ | |
374 | if (density[i]<0) continue; | |
375 | if (density[i]<maxdens/2.) { | |
376 | break; | |
377 | } | |
378 | fPoints[2]=i; | |
379 | } | |
380 | // | |
381 | // first point | |
382 | for (Int_t i=indexmax;i>0;i--){ | |
383 | if (density[i]<0) continue; | |
384 | if (density[i]<maxdens/2.) { | |
385 | break; | |
386 | } | |
387 | fPoints[0]=i; | |
388 | } | |
389 | // | |
390 | } | |
5773defd | 391 | |
6c94f330 | 392 | Double_t AliTPCtrack::GetBz() const { |
393 | // | |
394 | // returns Bz component of the magnetic field (kG) | |
395 | // | |
396 | if (AliTracker::UniformField()) return AliTracker::GetBz(); | |
397 | Double_t r[3]; GetXYZ(r); | |
398 | return AliTracker::GetBz(r); | |
5773defd | 399 | } |
6c94f330 | 400 |