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