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