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