]>
Commit | Line | Data |
---|---|---|
006b5f7f | 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 ITS track class | |
18 | // | |
19 | // Origin: Iouri Belikov, CERN, Jouri.Belikov@cern.ch | |
20 | //------------------------------------------------------------------------- | |
21 | ||
22 | #include <TMatrixD.h> | |
23 | ||
24 | #include <TMath.h> | |
25 | #include <iostream.h> | |
26 | ||
27 | #include "AliCluster.h" | |
517b130f | 28 | #include "AliTPCtrack.h" |
006b5f7f | 29 | #include "AliITStrackV2.h" |
30 | ||
31 | ClassImp(AliITStrackV2) | |
32 | ||
33 | const Int_t kWARN=1; | |
34 | ||
35 | //____________________________________________________________________________ | |
36 | AliITStrackV2::AliITStrackV2(const AliTPCtrack& t) throw (const Char_t *) { | |
37 | //------------------------------------------------------------------ | |
9b280d80 | 38 | //Conversion TPC track -> ITS track |
006b5f7f | 39 | //------------------------------------------------------------------ |
40 | SetLabel(t.GetLabel()); | |
41 | SetChi2(0.); | |
42 | SetNumberOfClusters(0); | |
14825d5a | 43 | //SetConvConst(t.GetConvConst()); |
44 | ||
006b5f7f | 45 | fdEdx = 0.; |
46 | fAlpha = t.GetAlpha(); | |
47 | if (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi(); | |
48 | else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi(); | |
49 | ||
9b280d80 | 50 | //Conversion of the track parameters |
006b5f7f | 51 | Double_t x,p[5]; t.GetExternalParameters(x,p); |
9b280d80 | 52 | fX=x; x=GetConvConst(); |
006b5f7f | 53 | fP0=p[0]; |
54 | fP1=p[1]; | |
55 | fP2=p[2]; | |
56 | fP3=p[3]; | |
57 | fP4=p[4]/x; | |
58 | ||
9b280d80 | 59 | //Conversion of the covariance matrix |
006b5f7f | 60 | Double_t c[15]; t.GetExternalCovariance(c); |
61 | ||
62 | fC00=c[0 ]; | |
63 | fC10=c[1 ]; fC11=c[2 ]; | |
64 | fC20=c[3 ]; fC21=c[4 ]; fC22=c[5 ]; | |
65 | fC30=c[6 ]; fC31=c[7 ]; fC32=c[8 ]; fC33=c[9 ]; | |
66 | fC40=c[10]/x; fC41=c[11]/x; fC42=c[12]/x; fC43=c[13]/x; fC44=c[14]/x/x; | |
67 | ||
68 | if (!Invariant()) throw "AliITStrackV2: conversion failed !\n"; | |
69 | } | |
70 | ||
71 | //____________________________________________________________________________ | |
72 | AliITStrackV2::AliITStrackV2(const AliITStrackV2& t) : AliKalmanTrack(t) { | |
73 | //------------------------------------------------------------------ | |
74 | //Copy constructor | |
75 | //------------------------------------------------------------------ | |
76 | fX=t.fX; | |
77 | fAlpha=t.fAlpha; | |
78 | fdEdx=t.fdEdx; | |
79 | ||
80 | fP0=t.fP0; fP1=t.fP1; fP2=t.fP2; fP3=t.fP3; fP4=t.fP4; | |
81 | ||
82 | fC00=t.fC00; | |
83 | fC10=t.fC10; fC11=t.fC11; | |
84 | fC20=t.fC20; fC21=t.fC21; fC22=t.fC22; | |
85 | fC30=t.fC30; fC31=t.fC31; fC32=t.fC32; fC33=t.fC33; | |
86 | fC40=t.fC40; fC41=t.fC41; fC42=t.fC42; fC43=t.fC43; fC44=t.fC44; | |
87 | ||
88 | Int_t n=GetNumberOfClusters(); | |
89 | for (Int_t i=0; i<n; i++) fIndex[i]=t.fIndex[i]; | |
90 | } | |
91 | ||
92 | //_____________________________________________________________________________ | |
93 | Int_t AliITStrackV2::Compare(const TObject *o) const { | |
94 | //----------------------------------------------------------------- | |
95 | // This function compares tracks according to the their curvature | |
96 | //----------------------------------------------------------------- | |
97 | AliTPCtrack *t=(AliTPCtrack*)o; | |
98 | Double_t co=TMath::Abs(t->Get1Pt()); | |
99 | Double_t c =TMath::Abs(Get1Pt()); | |
100 | if (c>co) return 1; | |
101 | else if (c<co) return -1; | |
102 | return 0; | |
103 | } | |
104 | ||
105 | //_____________________________________________________________________________ | |
106 | void AliITStrackV2::GetExternalCovariance(Double_t cc[15]) const { | |
107 | //------------------------------------------------------------------------- | |
108 | // This function returns an external representation of the covriance matrix. | |
109 | // (See comments in AliTPCtrack.h about external track representation) | |
110 | //------------------------------------------------------------------------- | |
9b280d80 | 111 | Double_t a=GetConvConst(); |
006b5f7f | 112 | |
113 | cc[0 ]=fC00; | |
114 | cc[1 ]=fC10; cc[2 ]=fC11; | |
115 | cc[3 ]=fC20; cc[4 ]=fC21; cc[5 ]=fC22; | |
116 | cc[6 ]=fC30; cc[7 ]=fC31; cc[8 ]=fC32; cc[9 ]=fC33; | |
117 | cc[10]=fC40*a; cc[11]=fC41*a; cc[12]=fC42*a; cc[13]=fC43*a; cc[14]=fC44*a*a; | |
118 | } | |
119 | ||
120 | //____________________________________________________________________________ | |
121 | Int_t AliITStrackV2::PropagateToVertex(Double_t x0,Double_t rho,Double_t pm) { | |
122 | //------------------------------------------------------------------ | |
123 | //This function propagates a track to the minimal distance from the origin | |
124 | //------------------------------------------------------------------ | |
125 | Double_t xv=fP2*(fX*fP2 - fP0*TMath::Sqrt(1.- fP2*fP2)); //linear approxim. | |
126 | Propagate(fAlpha,xv,0.,0.,pm); | |
127 | return 0; | |
128 | } | |
129 | ||
130 | //____________________________________________________________________________ | |
131 | Int_t AliITStrackV2:: | |
132 | GetGlobalXYZat(Double_t xk, Double_t &x, Double_t &y, Double_t &z) const { | |
133 | //------------------------------------------------------------------ | |
134 | //This function returns a track position in the global system | |
135 | //------------------------------------------------------------------ | |
136 | Double_t dx=xk-fX; | |
137 | Double_t f1=fP2, f2=f1 + fP4*dx; | |
138 | if (TMath::Abs(f2) >= 0.99999) { | |
139 | Int_t n=GetNumberOfClusters(); | |
140 | if (n>kWARN) cerr<<n<<" AliITStrackV2 warning: Propagation failed !\n"; | |
141 | return 0; | |
142 | } | |
143 | ||
144 | Double_t r1=sqrt(1.- f1*f1), r2=sqrt(1.- f2*f2); | |
145 | ||
146 | Double_t yk = fP0 + dx*(f1+f2)/(r1+r2); | |
147 | Double_t zk = fP1 + dx*(f1+f2)/(f1*r2 + f2*r1)*fP3; | |
148 | ||
149 | Double_t cs=TMath::Cos(fAlpha), sn=TMath::Sin(fAlpha); | |
150 | x = xk*cs - yk*sn; | |
151 | y = xk*sn + yk*cs; | |
152 | z = zk; | |
153 | ||
154 | return 1; | |
155 | } | |
156 | ||
157 | //_____________________________________________________________________________ | |
158 | Double_t AliITStrackV2::GetPredictedChi2(const AliCluster *c) const | |
159 | { | |
160 | //----------------------------------------------------------------- | |
161 | // This function calculates a predicted chi2 increment. | |
162 | //----------------------------------------------------------------- | |
163 | Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2(); | |
164 | r00+=fC00; r01+=fC10; r11+=fC11; | |
165 | ||
166 | Double_t det=r00*r11 - r01*r01; | |
167 | if (TMath::Abs(det) < 1.e-10) { | |
168 | Int_t n=GetNumberOfClusters(); | |
169 | if (n>4) cerr<<n<<" AliKalmanTrack warning: Singular matrix !\n"; | |
170 | return 1e10; | |
171 | } | |
172 | Double_t tmp=r00; r00=r11; r11=tmp; r01=-r01; | |
173 | ||
174 | Double_t dy=c->GetY() - fP0, dz=c->GetZ() - fP1; | |
175 | ||
176 | return (dy*r00*dy + 2*r01*dy*dz + dz*r11*dz)/det; | |
177 | } | |
178 | ||
179 | //_____________________________________________________________________________ | |
180 | Double_t AliITStrackV2::GetPredictedChi2(const AliCluster *c,Double_t *m, | |
60e5fcc3 | 181 | Double_t x0, Double_t pm) const { |
006b5f7f | 182 | //----------------------------------------------------------------- |
183 | // This function calculates a chi2 increment with a vertex contraint | |
184 | //----------------------------------------------------------------- | |
185 | TVectorD x(5); x(0)=fP0; x(1)=fP1; x(2)=fP2; x(3)=fP3; x(4)=fP4; | |
186 | TMatrixD C(5,5); | |
187 | C(0,0)=fC00; | |
188 | C(1,0)=fC10; C(1,1)=fC11; | |
189 | C(2,0)=fC20; C(2,1)=fC21; C(2,2)=fC22; | |
190 | C(3,0)=fC30; C(3,1)=fC31; C(3,2)=fC32; C(3,3)=fC33; | |
191 | C(4,0)=fC40; C(4,1)=fC41; C(4,2)=fC42; C(4,3)=fC43; C(4,4)=fC44; | |
192 | ||
193 | C(0,1)=C(1,0); | |
194 | C(0,2)=C(2,0); C(1,2)=C(2,1); | |
195 | C(0,3)=C(3,0); C(1,3)=C(3,1); C(2,3)=C(3,2); | |
196 | C(0,4)=C(4,0); C(1,4)=C(4,1); C(2,4)=C(4,2); C(3,4)=C(4,3); | |
197 | ||
198 | TMatrixD H(4,5); H.UnitMatrix(); | |
199 | Double_t dy=(c->GetY() - m[0]), dz=(c->GetZ() - m[1]); | |
200 | ||
201 | Double_t dr=TMath::Sqrt(fX*fX + dy*dy); | |
202 | Double_t r =TMath::Sqrt(4/dr/dr - fP4*fP4); | |
203 | Double_t sn=0.5*(fP4*fX + dy*r); | |
204 | Double_t tg=0.5*fP4*dz/TMath::ASin(0.5*fP4*dr); | |
205 | TVectorD mm(4); | |
206 | mm(0)=m[0]=c->GetY(); mm(1)=m[1]=c->GetZ(); mm(2)=m[2]=sn; mm(3)=m[3]=tg; | |
207 | ||
208 | Double_t v22=0.,v33=0.; | |
209 | //x0=0.; | |
210 | if (x0!=0.) { | |
211 | Double_t pp2=(1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt()); | |
212 | Double_t beta2=pp2/(pp2 + pm*pm); | |
213 | x0*=TMath::Sqrt((1.+ GetTgl()*GetTgl())/(1.- GetSnp()*GetSnp())); | |
214 | Double_t theta2=14.1*14.1/(beta2*pp2*1e6)*x0; | |
215 | v22 = theta2*(1.- GetSnp()*GetSnp())*(1. + GetTgl()*GetTgl()); | |
216 | v33 = theta2*(1.+ GetTgl()*GetTgl())*(1. + GetTgl()*GetTgl()); | |
217 | } | |
218 | Double_t sy2=c->GetSigmaY2(), sz2=c->GetSigmaZ2(); | |
219 | v22+=kSigmaYV*kSigmaYV/dr/dr; | |
220 | v22+=sy2/dr/dr; | |
221 | Double_t v20=sy2/dr; | |
222 | ||
223 | v33+=kSigmaZV*kSigmaZV/dr/dr; | |
224 | v33+=sz2/dr/dr; | |
225 | Double_t v31=sz2/dr; | |
226 | ||
227 | TMatrixD V(4,4); | |
228 | V(0,0)=m[4 ]=sy2; V(0,1)=m[5 ]=0.; V(0,2)=m[6 ]=v20; V(0,3)=m[7 ]=0.; | |
229 | V(1,0)=m[8 ]=0.; V(1,1)=m[9 ]=sz2; V(1,2)=m[10]=0.; V(1,3)=m[11]=v31; | |
230 | V(2,0)=m[12]=v20; V(2,1)=m[13]=0.; V(2,2)=m[14]=v22; V(2,3)=m[15]=0.; | |
231 | V(3,0)=m[16]=0.; V(3,1)=m[17]=v31; V(3,2)=m[18]=0.; V(3,3)=m[19]=v33; | |
232 | ||
233 | TVectorD res=x; res*=H; res-=mm; //res*=-1; | |
234 | TMatrixD tmp(H,TMatrixD::kMult,C); | |
235 | TMatrixD R(tmp,TMatrixD::kMult,TMatrixD(TMatrixD::kTransposed,H)); R+=V; | |
236 | ||
237 | Double_t det=R.Determinant(); | |
238 | if (TMath::Abs(det) < 1.e-25) { | |
239 | Int_t n=GetNumberOfClusters(); | |
240 | if (n>kWARN) cerr<<n<<" AliITStrackV2 warning: Singular matrix !\n"; | |
241 | return 1e10; | |
242 | } | |
243 | ||
244 | R.Invert(); | |
245 | ||
246 | TVectorD rs=res; | |
247 | res*=R; | |
248 | return rs*res; | |
249 | } | |
250 | ||
251 | //____________________________________________________________________________ | |
252 | Int_t | |
253 | AliITStrackV2::PropagateTo(Double_t xk,Double_t x0,Double_t rho,Double_t pm) { | |
254 | //------------------------------------------------------------------ | |
255 | //This function propagates a track | |
256 | //------------------------------------------------------------------ | |
257 | Double_t x1=fX, x2=xk, dx=x2-x1; | |
258 | Double_t f1=fP2, f2=f1 + fP4*dx; | |
259 | if (TMath::Abs(f2) >= 0.99999) { | |
260 | Int_t n=GetNumberOfClusters(); | |
261 | if (n>kWARN) cerr<<n<<" AliITStrackV2 warning: Propagation failed !\n"; | |
262 | return 0; | |
263 | } | |
264 | ||
265 | Double_t r1=sqrt(1.- f1*f1), r2=sqrt(1.- f2*f2); | |
266 | ||
267 | fP0 += dx*(f1+f2)/(r1+r2); | |
268 | fP1 += dx*(f1+f2)/(f1*r2 + f2*r1)*fP3; | |
269 | fP2 += dx*fP4; | |
270 | ||
271 | //f = F - 1 | |
272 | ||
273 | Double_t f02= dx/(r1*r1*r1); | |
274 | Double_t f04=0.5*dx*dx/(r1*r1*r1); | |
275 | Double_t f12= dx*fP3*f1/(r1*r1*r1); | |
276 | Double_t f14=0.5*dx*dx*fP3*f1/(r1*r1*r1); | |
277 | Double_t f13= dx/r1; | |
278 | Double_t f24= dx; | |
279 | ||
280 | //b = C*ft | |
281 | Double_t b00=f02*fC20 + f04*fC40, b01=f12*fC20 + f14*fC40 + f13*fC30; | |
282 | Double_t b02=f24*fC40; | |
283 | Double_t b10=f02*fC21 + f04*fC41, b11=f12*fC21 + f14*fC41 + f13*fC31; | |
284 | Double_t b12=f24*fC41; | |
285 | Double_t b20=f02*fC22 + f04*fC42, b21=f12*fC22 + f14*fC42 + f13*fC32; | |
286 | Double_t b22=f24*fC42; | |
287 | Double_t b40=f02*fC42 + f04*fC44, b41=f12*fC42 + f14*fC44 + f13*fC43; | |
288 | Double_t b42=f24*fC44; | |
289 | Double_t b30=f02*fC32 + f04*fC43, b31=f12*fC32 + f14*fC43 + f13*fC33; | |
290 | Double_t b32=f24*fC43; | |
291 | ||
292 | //a = f*b = f*C*ft | |
293 | Double_t a00=f02*b20+f04*b40,a01=f02*b21+f04*b41,a02=f02*b22+f04*b42; | |
294 | Double_t a11=f12*b21+f14*b41+f13*b31,a12=f12*b22+f14*b42+f13*b32; | |
295 | Double_t a22=f24*b42; | |
296 | ||
297 | //F*C*Ft = C + (b + bt + a) | |
298 | fC00 += b00 + b00 + a00; | |
299 | fC10 += b10 + b01 + a01; | |
300 | fC20 += b20 + b02 + a02; | |
301 | fC30 += b30; | |
302 | fC40 += b40; | |
303 | fC11 += b11 + b11 + a11; | |
304 | fC21 += b21 + b12 + a12; | |
305 | fC31 += b31; | |
306 | fC41 += b41; | |
307 | fC22 += b22 + b22 + a22; | |
308 | fC32 += b32; | |
309 | fC42 += b42; | |
310 | ||
311 | fX=x2; | |
312 | ||
313 | Double_t p2=(1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt()); | |
314 | Double_t beta2=p2/(p2 + pm*pm); | |
315 | ||
316 | //Multiple scattering****************** | |
317 | //x0=0.; | |
318 | if (x0!=0) { | |
319 | x0*=TMath::Sqrt((1.+ fP3*fP3)/(1.- fP2*fP2)); | |
320 | Double_t theta2=14.1*14.1/(beta2*p2*1e6)*x0; | |
321 | fC22 += theta2*(1.- fP2*fP2)*(1. + fP3*fP3); | |
322 | fC33 += theta2*(1. + fP3*fP3)*(1. + fP3*fP3); | |
323 | fC43 += theta2*fP3*fP4*(1. + fP3*fP3); | |
324 | fC44 += theta2*fP3*fP4*fP3*fP4; | |
325 | } | |
326 | ||
327 | //Energy losses************************ | |
328 | if (rho!=0.) { | |
329 | rho*=TMath::Sqrt((1.+ fP3*fP3)/(1.- fP2*fP2)); | |
330 | Double_t dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2)) - beta2)*rho; | |
331 | if (x1 < x2) dE=-dE; | |
332 | fP4*=(1.- sqrt(p2+pm*pm)/p2*dE); | |
333 | } | |
334 | ||
335 | if (!Invariant()) {cout<<"Propagate !\n"; return 0;} | |
336 | ||
337 | return 1; | |
338 | } | |
339 | ||
340 | //____________________________________________________________________________ | |
341 | Int_t AliITStrackV2::Update(const AliCluster* c, Double_t chi2, UInt_t index) { | |
342 | //------------------------------------------------------------------ | |
343 | //This function updates track parameters | |
344 | //------------------------------------------------------------------ | |
345 | Double_t p0=fP0,p1=fP1,p2=fP2,p3=fP3,p4=fP4; | |
346 | Double_t c00=fC00; | |
347 | Double_t c10=fC10, c11=fC11; | |
348 | Double_t c20=fC20, c21=fC21, c22=fC22; | |
349 | Double_t c30=fC30, c31=fC31, c32=fC32, c33=fC33; | |
350 | Double_t c40=fC40, c41=fC41, c42=fC42, c43=fC43, c44=fC44; | |
351 | ||
352 | ||
353 | Double_t r00=c->GetSigmaY2(), r01=0., r11=c->GetSigmaZ2(); | |
354 | r00+=fC00; r01+=fC10; r11+=fC11; | |
355 | Double_t det=r00*r11 - r01*r01; | |
356 | Double_t tmp=r00; r00=r11/det; r11=tmp/det; r01=-r01/det; | |
357 | ||
358 | Double_t k00=fC00*r00+fC10*r01, k01=fC00*r01+fC10*r11; | |
359 | Double_t k10=fC10*r00+fC11*r01, k11=fC10*r01+fC11*r11; | |
360 | Double_t k20=fC20*r00+fC21*r01, k21=fC20*r01+fC21*r11; | |
361 | Double_t k30=fC30*r00+fC31*r01, k31=fC30*r01+fC31*r11; | |
362 | Double_t k40=fC40*r00+fC41*r01, k41=fC40*r01+fC41*r11; | |
363 | ||
364 | Double_t dy=c->GetY() - fP0, dz=c->GetZ() - fP1; | |
365 | Double_t sf=fP2 + k20*dy + k21*dz; | |
366 | /* | |
367 | if (TMath::Abs(sf) >= 0.99999) { | |
368 | Int_t n=GetNumberOfClusters(); | |
369 | if (n>kWARN) cerr<<n<<" AliITStrackV2 warning: Filtering failed !\n"; | |
370 | return 0; | |
371 | } | |
372 | */ | |
373 | fP0 += k00*dy + k01*dz; | |
374 | fP1 += k10*dy + k11*dz; | |
375 | fP2 = sf; | |
376 | fP3 += k30*dy + k31*dz; | |
377 | fP4 += k40*dy + k41*dz; | |
378 | ||
379 | Double_t c01=fC10, c02=fC20, c03=fC30, c04=fC40; | |
380 | Double_t c12=fC21, c13=fC31, c14=fC41; | |
381 | ||
382 | fC00-=k00*fC00+k01*fC10; fC10-=k00*c01+k01*fC11; | |
383 | fC20-=k00*c02+k01*c12; fC30-=k00*c03+k01*c13; | |
384 | fC40-=k00*c04+k01*c14; | |
385 | ||
386 | fC11-=k10*c01+k11*fC11; | |
387 | fC21-=k10*c02+k11*c12; fC31-=k10*c03+k11*c13; | |
388 | fC41-=k10*c04+k11*c14; | |
389 | ||
390 | fC22-=k20*c02+k21*c12; fC32-=k20*c03+k21*c13; | |
391 | fC42-=k20*c04+k21*c14; | |
392 | ||
393 | fC33-=k30*c03+k31*c13; | |
394 | fC43-=k30*c04+k31*c14; | |
395 | ||
396 | fC44-=k40*c04+k41*c14; | |
397 | ||
398 | if (!Invariant()) { | |
399 | fP0=p0; fP1=p1; fP2=p2; fP3=p3; fP4=p4; | |
400 | fC00=c00; | |
401 | fC10=c10; fC11=c11; | |
402 | fC20=c20; fC21=c21; fC22=c22; | |
403 | fC30=c30; fC31=c31; fC32=c32; fC33=c33; | |
404 | fC40=c40; fC41=c41; fC42=c42; fC43=c43; fC44=c44; | |
405 | return 0; | |
406 | } | |
407 | ||
408 | Int_t n=GetNumberOfClusters(); | |
409 | fIndex[n]=index; | |
410 | SetNumberOfClusters(n+1); | |
411 | SetChi2(GetChi2()+chi2); | |
412 | ||
413 | return 1; | |
414 | } | |
415 | ||
416 | ||
417 | //____________________________________________________________________________ | |
418 | Int_t AliITStrackV2::Update(const Double_t* m, Double_t chi2, UInt_t index) { | |
419 | //------------------------------------------------------------------ | |
420 | //This function updates track parameters with a vertex constraint | |
421 | //------------------------------------------------------------------ | |
422 | Double_t p0=fP0,p1=fP1,p2=fP2,p3=fP3,p4=fP4; | |
423 | Double_t c00=fC00; | |
424 | Double_t c10=fC10, c11=fC11; | |
425 | Double_t c20=fC20, c21=fC21, c22=fC22; | |
426 | Double_t c30=fC30, c31=fC31, c32=fC32, c33=fC33; | |
427 | Double_t c40=fC40, c41=fC41, c42=fC42, c43=fC43, c44=fC44; | |
428 | ||
429 | ||
430 | TVectorD x(5); x(0)=fP0; x(1)=fP1; x(2)=fP2; x(3)=fP3; x(4)=fP4; | |
431 | TMatrixD C(5,5); | |
432 | C(0,0)=fC00; | |
433 | C(1,0)=fC10; C(1,1)=fC11; | |
434 | C(2,0)=fC20; C(2,1)=fC21; C(2,2)=fC22; | |
435 | C(3,0)=fC30; C(3,1)=fC31; C(3,2)=fC32; C(3,3)=fC33; | |
436 | C(4,0)=fC40; C(4,1)=fC41; C(4,2)=fC42; C(4,3)=fC43; C(4,4)=fC44; | |
437 | ||
438 | C(0,1)=C(1,0); | |
439 | C(0,2)=C(2,0); C(1,2)=C(2,1); | |
440 | C(0,3)=C(3,0); C(1,3)=C(3,1); C(2,3)=C(3,2); | |
441 | C(0,4)=C(4,0); C(1,4)=C(4,1); C(2,4)=C(4,2); C(3,4)=C(4,3); | |
442 | ||
443 | TMatrixD H(4,5); H.UnitMatrix(); | |
444 | TMatrixD Ht(TMatrixD::kTransposed,H); | |
445 | TVectorD mm(4); mm(0)=m[0]; mm(1)=m[1]; mm(2)=m[2]; mm(3)=m[3]; | |
446 | TMatrixD V(4,4); | |
447 | V(0,0)=m[4 ]; V(0,1)=m[5 ]; V(0,2)=m[6 ]; V(0,3)=m[7 ]; | |
448 | V(1,0)=m[8 ]; V(1,1)=m[9 ]; V(1,2)=m[10]; V(1,3)=m[11]; | |
449 | V(2,0)=m[12]; V(2,1)=m[13]; V(2,2)=m[14]; V(2,3)=m[15]; | |
450 | V(3,0)=m[16]; V(3,1)=m[17]; V(3,2)=m[18]; V(3,3)=m[19]; | |
451 | ||
452 | TMatrixD tmp(H,TMatrixD::kMult,C); | |
453 | TMatrixD R(tmp,TMatrixD::kMult,Ht); R+=V; | |
454 | ||
455 | R.Invert(); | |
456 | ||
457 | TMatrixD K(C,TMatrixD::kMult,Ht); K*=R; | |
458 | ||
459 | TVectorD savex=x; | |
460 | x*=H; x-=mm; x*=-1; x*=K; x+=savex; | |
461 | ||
462 | TMatrixD saveC=C; | |
463 | C.Mult(K,tmp); C-=saveC; C*=-1; | |
464 | ||
465 | fP0=x(0); fP1=x(1); fP2=x(2); fP3=x(3); fP4=x(4); | |
466 | fC00=C(0,0); | |
467 | fC10=C(1,0); fC11=C(1,1); | |
468 | fC20=C(2,0); fC21=C(2,1); fC22=C(2,2); | |
469 | fC30=C(3,0); fC31=C(3,1); fC32=C(3,2); fC33=C(3,3); | |
470 | fC40=C(4,0); fC41=C(4,1); fC42=C(4,2); fC43=C(4,3); fC44=C(4,4); | |
471 | ||
472 | ||
473 | if (!Invariant()) { | |
474 | fP0=p0; fP1=p1; fP2=p2; fP3=p3; fP4=p4; | |
475 | fC00=c00; | |
476 | fC10=c10; fC11=c11; | |
477 | fC20=c20; fC21=c21; fC22=c22; | |
478 | fC30=c30; fC31=c31; fC32=c32; fC33=c33; | |
479 | fC40=c40; fC41=c41; fC42=c42; fC43=c43; fC44=c44; | |
480 | return 0; | |
481 | } | |
482 | ||
483 | Int_t n=GetNumberOfClusters(); | |
484 | fIndex[n]=index; | |
485 | SetNumberOfClusters(n+1); | |
486 | SetChi2(GetChi2()+chi2); | |
487 | ||
488 | return 1; | |
489 | } | |
490 | ||
491 | Int_t AliITStrackV2::Invariant() const { | |
492 | //------------------------------------------------------------------ | |
493 | // This function is for debugging purpose only | |
494 | //------------------------------------------------------------------ | |
495 | //if (TMath::Abs(fP1)>11.5) | |
496 | //if (fP1*fP4<0) {cout<<"fP1*fP4="<<fP1*fP4<<' '<<fP1<<endl; return 0;} | |
497 | if (TMath::Abs(fP2)>=1) {cout<<"fP2="<<fP2<<endl; return 0;} | |
498 | ||
499 | if (fC00<=0) {cout<<"fC00="<<fC00<<endl; return 0;} | |
500 | if (fC11<=0) {cout<<"fC11="<<fC11<<endl; return 0;} | |
501 | if (fC22<=0) {cout<<"fC22="<<fC22<<endl; return 0;} | |
502 | if (fC33<=0) {cout<<"fC33="<<fC33<<endl; return 0;} | |
503 | if (fC44<=0) {cout<<"fC44="<<fC44<<endl; return 0;} | |
14825d5a | 504 | /* |
505 | TMatrixD m(5,5); | |
506 | m(0,0)=fC00; | |
507 | m(1,0)=fC10; m(1,1)=fC11; | |
508 | m(2,0)=fC20; m(2,1)=fC21; m(2,2)=fC22; | |
509 | m(3,0)=fC30; m(3,1)=fC31; m(3,2)=fC32; m(3,3)=fC33; | |
510 | m(4,0)=fC40; m(4,1)=fC41; m(4,2)=fC42; m(4,3)=fC43; m(4,4)=fC44; | |
511 | ||
512 | m(0,1)=m(1,0); | |
513 | m(0,2)=m(2,0); m(1,2)=m(2,1); | |
514 | m(0,3)=m(3,0); m(1,3)=m(3,1); m(2,3)=m(3,2); | |
515 | m(0,4)=m(4,0); m(1,4)=m(4,1); m(2,4)=m(4,2); m(3,4)=m(4,3); | |
516 | ||
517 | Double_t det=m.Determinant(); | |
518 | ||
519 | if (det <= 0) { | |
520 | cout<<" bad determinant "<<det<<endl; | |
521 | m.Print(); | |
522 | return 0; | |
523 | } | |
524 | */ | |
525 | return 1; | |
006b5f7f | 526 | } |
527 | ||
528 | //____________________________________________________________________________ | |
529 | Int_t AliITStrackV2::Propagate(Double_t alp, Double_t xk, | |
530 | Double_t x0,Double_t rho,Double_t pm) { | |
531 | //------------------------------------------------------------------ | |
532 | //This function propagates a track | |
533 | //------------------------------------------------------------------ | |
534 | Double_t p0=fP0,p1=fP1,p2=fP2,p3=fP3,p4=fP4; | |
535 | Double_t c00=fC00; | |
536 | Double_t c10=fC10, c11=fC11; | |
537 | Double_t c20=fC20, c21=fC21, c22=fC22; | |
538 | Double_t c30=fC30, c31=fC31, c32=fC32, c33=fC33; | |
539 | Double_t c40=fC40, c41=fC41, c42=fC42, c43=fC43, c44=fC44; | |
540 | ||
541 | ||
542 | Double_t dalp=alp-fAlpha; | |
543 | ||
544 | Double_t ca=TMath::Cos(dalp), sa=TMath::Sin(dalp); | |
545 | Double_t sf=fP2, cf=TMath::Sqrt(1.- fP2*fP2); | |
546 | ||
547 | Double_t pp2=fP2*ca - cf*sa; | |
548 | if (TMath::Abs(pp2) >= 0.99999) { | |
549 | Int_t n=GetNumberOfClusters(); | |
550 | if (n>kWARN) cerr<<n<<" AliITStrackV2 warning: Rotation failed !\n"; | |
551 | return 0; | |
552 | } | |
553 | ||
554 | fAlpha = alp; | |
555 | if (fAlpha < -TMath::Pi()) fAlpha += 2*TMath::Pi(); | |
556 | else if (fAlpha >= TMath::Pi()) fAlpha -= 2*TMath::Pi(); | |
557 | ||
558 | Double_t x1=fX, y1=fP0; | |
559 | ||
560 | fX = x1*ca + y1*sa; | |
561 | fP0=-x1*sa + y1*ca; | |
562 | fP2 = pp2; | |
563 | ||
564 | cf=ca + sf*sa/cf; | |
565 | ||
566 | if (!Invariant()) {cout<<dalp<<" Rotate !\n"; return 0;} | |
567 | ||
568 | x1=fX; Double_t x2=xk, dx=x2-x1; | |
569 | Double_t f1=fP2, f2=f1 + fP4*dx; | |
570 | if (TMath::Abs(f2) >= 0.99999) { | |
571 | Int_t n=GetNumberOfClusters(); | |
572 | if (n>kWARN) cerr<<n<<" AliITStrackV2 warning: Propagation failed !\n"; | |
573 | return 0; | |
574 | } | |
575 | ||
576 | Double_t r1=sqrt(1.- f1*f1), r2=sqrt(1.- f2*f2); | |
577 | ||
578 | fP0 += dx*(f1+f2)/(r1+r2); | |
579 | fP1 += dx*(f1+f2)/(f1*r2 + f2*r1)*fP3; | |
580 | fP2 += dx*fP4; | |
581 | ||
582 | //f = F - 1 | |
583 | Double_t f02= dx/(r1*r1*r1); | |
584 | Double_t f04=0.5*dx*dx/(r1*r1*r1); | |
585 | Double_t f12= dx*fP3*f1/(r1*r1*r1); | |
586 | Double_t f14=0.5*dx*dx*fP3*f1/(r1*r1*r1); | |
587 | Double_t f13= dx/r1; | |
588 | Double_t f24= dx; | |
589 | /* | |
590 | //b = C*ft | |
591 | Double_t b00=f02*fC20 + f03*fC30, b01=f12*fC20 + f13*fC30 + f14*fC40; | |
592 | Double_t b02=f23*fC30; | |
593 | Double_t b10=f02*fC21 + f03*fC31, b11=f12*fC21 + f13*fC31 + f14*fC41; | |
594 | Double_t b12=f23*fC31; | |
595 | Double_t b20=f02*fC22 + f03*fC32, b21=f12*fC22 + f13*fC32 + f14*fC42; | |
596 | Double_t b22=f23*fC32; | |
597 | Double_t b30=f02*fC32 + f03*fC33, b31=f12*fC32 + f13*fC33 + f14*fC43; | |
598 | Double_t b32=f23*fC33; | |
599 | Double_t b40=f02*fC42 + f03*fC43, b41=f12*fC42 + f13*fC43 + f14*fC44; | |
600 | Double_t b42=f23*fC43; | |
601 | ||
602 | //a = f*b = f*C*ft | |
603 | Double_t a00=f02*b20+f03*b30,a01=f02*b21+f03*b31,a02=f02*b22+f03*b32; | |
604 | Double_t a11=f12*b21+f13*b31+f14*b41,a12=f12*b22+f13*b32+f14*b42; | |
605 | Double_t a22=f23*b32; | |
606 | ||
607 | //F*C*Ft = C + (b + bt + a) | |
608 | fC00 += b00 + b00 + a00; | |
609 | fC10 += b10 + b01 + a01; | |
610 | fC20 += b20 + b02 + a02; | |
611 | fC30 += b30; | |
612 | fC40 += b40; | |
613 | fC11 += b11 + b11 + a11; | |
614 | fC21 += b21 + b12 + a12; | |
615 | fC31 += b31; | |
616 | fC41 += b41; | |
617 | fC22 += b22 + b22 + a22; | |
618 | fC32 += b32; | |
619 | fC42 += b42; | |
620 | */ | |
621 | ||
622 | TMatrixD F(5,5); F.UnitMatrix(); | |
623 | F(0,0)=-(f1+f2)/(r1+r2)*sa + ca; F(0,2)=f02*cf; F(0,4)=f04; | |
624 | F(1,0)=-(f1+f2)/(f1*r2 + f2*r1)*fP3*sa; F(1,2)=f12*cf; F(1,4)=f14; F(1,3)=f13; | |
625 | F(2,0)=-fP4*sa; F(2,2)=cf; F(2,4)=f24; | |
626 | ||
627 | TMatrixD C(5,5); | |
628 | C(0,0)=fC00; | |
629 | C(1,0)=fC10; C(1,1)=fC11; | |
630 | C(2,0)=fC20; C(2,1)=fC21; C(2,2)=fC22; | |
631 | C(3,0)=fC30; C(3,1)=fC31; C(3,2)=fC32; C(3,3)=fC33; | |
632 | C(4,0)=fC40; C(4,1)=fC41; C(4,2)=fC42; C(4,3)=fC43; C(4,4)=fC44; | |
633 | ||
634 | C(0,1)=C(1,0); | |
635 | C(0,2)=C(2,0); C(1,2)=C(2,1); | |
636 | C(0,3)=C(3,0); C(1,3)=C(3,1); C(2,3)=C(3,2); | |
637 | C(0,4)=C(4,0); C(1,4)=C(4,1); C(2,4)=C(4,2); C(3,4)=C(4,3); | |
638 | ||
639 | TMatrixD tmp(C,TMatrixD::kMult,TMatrixD(TMatrixD::kTransposed, F)); | |
640 | C.Mult(F,tmp); | |
641 | ||
642 | fC00=C(0,0); | |
643 | fC10=C(1,0); fC11=C(1,1); | |
644 | fC20=C(2,0); fC21=C(2,1); fC22=C(2,2); | |
645 | fC30=C(3,0); fC31=C(3,1); fC32=C(3,2); fC33=C(3,3); | |
646 | fC40=C(4,0); fC41=C(4,1); fC42=C(4,2); fC43=C(4,3); fC44=C(4,4); | |
647 | ||
648 | pp2=(1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt()); | |
649 | Double_t beta2=pp2/(pp2 + pm*pm); | |
650 | ||
651 | //Multiple scattering****************** | |
652 | //x0=0.; | |
653 | if (x0!=0.) { | |
654 | x0*=TMath::Sqrt((1.+ fP3*fP3)/(1.- fP2*fP2)); | |
655 | Double_t theta2=14.1*14.1/(beta2*pp2*1e6)*x0; | |
656 | fC22 += theta2*(1.- fP2*fP2)*(1. + fP3*fP3); | |
657 | fC33 += theta2*(1. + fP3*fP3)*(1. + fP3*fP3); | |
658 | fC43 += theta2*fP3*fP4*(1. + fP3*fP3); | |
659 | fC44 += theta2*fP3*fP4*fP3*fP4; | |
660 | } | |
661 | ||
662 | //Energy losses************************ | |
663 | if (rho!=0.) { | |
664 | rho*=TMath::Sqrt((1.+ fP3*fP3)/(1.- fP2*fP2)); | |
665 | Double_t dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2)) - beta2)*rho; | |
666 | if (x1 < x2) dE=-dE; | |
667 | fP4*=(1.- sqrt(pp2+pm*pm)/pp2*dE); | |
668 | } | |
669 | ||
670 | if (!Invariant()) { | |
671 | fP0=p0; fP1=p1; fP2=p2; fP3=p3; fP4=p4; | |
672 | fC00=c00; | |
673 | fC10=c10; fC11=c11; | |
674 | fC20=c20; fC21=c21; fC22=c22; | |
675 | fC30=c30; fC31=c31; fC32=c32; fC33=c33; | |
676 | fC40=c40; fC41=c41; fC42=c42; fC43=c43; fC44=c44; | |
677 | return 0; | |
678 | } | |
679 | ||
680 | fX=x2; | |
681 | ||
682 | return 1; | |
683 | } | |
684 | ||
685 | Double_t AliITStrackV2::GetD() const { | |
686 | //------------------------------------------------------------------ | |
687 | //This function calculates the transverse impact parameter | |
688 | //------------------------------------------------------------------ | |
689 | Double_t sn=fP4*fX - fP2, cs=fP4*fP0 + TMath::Sqrt(1.- fP2*fP2); | |
690 | Double_t a=2*(fX*fP2 - fP0*TMath::Sqrt(1.- fP2*fP2))-fP4*(fX*fX + fP0*fP0); | |
691 | if (fP4<0) a=-a; | |
692 | return a/(1 + TMath::Sqrt(sn*sn + cs*cs)); | |
693 | } | |
694 | ||
695 | ||
696 | Int_t AliITStrackV2::Improve(Double_t x0,Double_t yv,Double_t zv) { | |
697 | //------------------------------------------------------------------ | |
698 | //This function improves angular track parameters | |
699 | //------------------------------------------------------------------ | |
700 | Double_t dy=fP0-yv, dz=fP1-zv; | |
701 | Double_t r2=fX*fX+dy*dy; | |
702 | Double_t p2=(1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt()); | |
703 | Double_t beta2=p2/(p2 + 0.14*0.14); | |
704 | x0*=TMath::Sqrt((1.+ GetTgl()*GetTgl())/(1.- GetSnp()*GetSnp())); | |
705 | Double_t theta2=14.1*14.1/(beta2*p2*1e6)*x0; | |
706 | ||
707 | Double_t par=0.5*(fP4*fX + dy*TMath::Sqrt(4/r2-fP4*fP4)); | |
708 | Double_t sigma2 = theta2*(1.- GetSnp()*GetSnp())*(1. + GetTgl()*GetTgl()); | |
709 | sigma2 += fC00/r2*(1.- dy*dy/r2)*(1.- dy*dy/r2); | |
710 | sigma2 += kSigmaYV*kSigmaYV/r2; | |
711 | sigma2 += 0.25*fC44*fX*fX; | |
712 | Double_t eps2=sigma2/(fC22+sigma2), eps=TMath::Sqrt(eps2); | |
713 | if (10*r2*fC44<fC22) { | |
714 | fP2 = eps2*fP2 + (1-eps2)*par; | |
715 | fC22*=eps2; fC21*=eps; fC20*=eps; fC32*=eps; fC42*=eps; | |
716 | } | |
717 | ||
718 | par=0.5*fP4*dz/TMath::ASin(0.5*fP4*TMath::Sqrt(r2)); | |
719 | sigma2=theta2; | |
720 | sigma2 += fC11/r2+fC00*dy*dy*dz*dz/(r2*r2*r2); | |
721 | sigma2 += kSigmaZV*kSigmaZV/r2; | |
722 | eps2=sigma2/(fC33+sigma2); eps=TMath::Sqrt(eps2); | |
723 | Double_t tgl=fP3; | |
724 | fP3 = eps2*fP3 + (1-eps2)*par; | |
725 | fC33*=eps2; fC32*=eps; fC31*=eps; fC30*=eps; fC43*=eps; | |
726 | ||
727 | eps=TMath::Sqrt((1+fP3*fP3)/(1+tgl*tgl)); | |
728 | fP4*=eps; | |
729 | fC44*=eps*eps; fC43*=eps;fC42*=eps; fC41*=eps; fC40*=eps; | |
730 | ||
731 | if (!Invariant()) return 0; | |
732 | return 1; | |
733 | } | |
734 | ||
735 | /* | |
736 | Int_t AliITStrackV2::Improve(Double_t x0,Double_t xv,Double_t yv) { | |
737 | //------------------------------------------------------------------ | |
738 | //This function improves angular track parameters | |
739 | //------------------------------------------------------------------ | |
740 | TMatrixD I(5,5); | |
741 | TVectorD v(5); v(0)=fP0; v(1)=fP1; v(2)=fP2; v(3)=fP3; v(4)=fP4; | |
742 | ||
743 | Double_t r2=fX*fX+fP0*fP0; | |
744 | Double_t p2=(1.+ GetTgl()*GetTgl())/(Get1Pt()*Get1Pt()); | |
745 | Double_t beta2=p2/(p2 + 0.14*0.14); | |
746 | x0*=TMath::Sqrt((1.+ GetTgl()*GetTgl())/(1.- GetSnp()*GetSnp())); | |
747 | Double_t theta2=14.1*14.1/(beta2*p2*1e6)*x0; | |
748 | ||
749 | v(2)=0.5*(fP4*fX + fP0*TMath::Sqrt(4/r2-fP4*fP4)); | |
750 | Double_t sigma2 = theta2*(1.- GetSnp()*GetSnp())*(1. + GetTgl()*GetTgl()); | |
751 | sigma2 += fC00/r2*(1.- fP0*fP0/r2)*(1.- fP0*fP0/r2); | |
752 | sigma2 += kSigmaYV*kSigmaYV/r2; | |
753 | I(2,2)=1/sigma2; | |
754 | ||
755 | v(3)=0.5*fP4*fP1/TMath::ASin(0.5*fP4*TMath::Sqrt(r2)); | |
756 | sigma2=theta2; | |
757 | sigma2 += fC11/r2+fC00*fP0*fP0*fP1*fP1/(r2*r2*r2); | |
758 | sigma2 += kSigmaZV*kSigmaZV/r2; | |
759 | I(3,3)=1/sigma2; | |
760 | ||
761 | Double_t tgl=fP3; | |
762 | ||
763 | TVectorD x(5); x(0)=fP0; x(1)=fP1; x(2)=fP2; x(3)=fP3; x(4)=fP4; | |
764 | TMatrixD C(5,5); | |
765 | C(0,0)=fC00; | |
766 | C(1,0)=fC10; C(1,1)=fC11; | |
767 | C(2,0)=fC20; C(2,1)=fC21; C(2,2)=fC22; | |
768 | C(3,0)=fC30; C(3,1)=fC31; C(3,2)=fC32; C(3,3)=fC33; | |
769 | C(4,0)=fC40; C(4,1)=fC41; C(4,2)=fC42; C(4,3)=fC43; C(4,4)=fC44; | |
770 | ||
771 | C(0,1)=C(1,0); | |
772 | C(0,2)=C(2,0); C(1,2)=C(2,1); | |
773 | C(0,3)=C(3,0); C(1,3)=C(3,1); C(2,3)=C(3,2); | |
774 | C(0,4)=C(4,0); C(1,4)=C(4,1); C(2,4)=C(4,2); C(3,4)=C(4,3); | |
775 | ||
776 | TMatrixD tmp(I,TMatrixD::kMult,C),U(5,5); U.UnitMatrix(); | |
777 | U+=tmp; | |
778 | U.Invert(); | |
779 | TMatrixD W1(U); | |
780 | TMatrixD W2(tmp,TMatrixD::kMult,W1); | |
781 | ||
782 | v*=W2; x*=W1; x+=v; | |
783 | ||
784 | C*=W1; | |
785 | ||
786 | ||
787 | fP0=x(0); fP1=x(1); fP2=x(2); fP3=x(3); fP4=x(4); | |
788 | fC00=C(0,0); | |
789 | fC10=C(1,0); fC11=C(1,1); | |
790 | fC20=C(2,0); fC21=C(2,1); fC22=C(2,2); | |
791 | fC30=C(3,0); fC31=C(3,1); fC32=C(3,2); fC33=C(3,3); | |
792 | fC40=C(4,0); fC41=C(4,1); fC42=C(4,2); fC43=C(4,3); fC44=C(4,4); | |
793 | ||
794 | eps=TMath::Sqrt((1+fP3*fP3)/(1+tgl*tgl)); | |
795 | fP4*=eps; | |
796 | fC44*=eps*eps; fC43*=eps;fC42*=eps; fC41*=eps; fC40*=eps; | |
797 | ||
798 | if (!Invariant()) return 0; | |
799 | return 1; | |
800 | } | |
801 | */ | |
802 | ||
14825d5a | 803 | void AliITStrackV2::ResetCovariance() { |
804 | //------------------------------------------------------------------ | |
805 | //This function makes a track forget its history :) | |
806 | //------------------------------------------------------------------ | |
807 | ||
808 | fC00*=10.; | |
809 | fC10=0.; fC11*=10.; | |
810 | fC20=0.; fC21=0.; fC22*=10.; | |
811 | fC30=0.; fC31=0.; fC32=0.; fC33*=10.; | |
812 | fC40=0.; fC41=0.; fC42=0.; fC43=0.; fC44*=10.; | |
813 | ||
814 | } |