]>
Commit | Line | Data |
---|---|---|
83253968 | 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 | #include "AliESDtrack.h" | |
17 | #include "AliTracker.h" | |
18 | #include "AliHMPIDtrack.h" | |
19 | ||
20 | ClassImp(AliHMPIDtrack) | |
21 | ||
22 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
23 | AliHMPIDtrack::AliHMPIDtrack():AliKalmanTrack() | |
24 | { | |
25 | // | |
26 | // def. ctor | |
27 | // | |
28 | } | |
29 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
30 | AliHMPIDtrack::AliHMPIDtrack(const AliHMPIDtrack& t):AliKalmanTrack(t) | |
31 | { | |
32 | // | |
33 | // cctor. | |
34 | // | |
35 | } | |
36 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
37 | AliHMPIDtrack::AliHMPIDtrack(const AliESDtrack& t):AliKalmanTrack() | |
38 | { | |
39 | // | |
40 | // Constructor from AliESDtrack | |
41 | // | |
42 | SetLabel(t.GetLabel()); | |
43 | SetChi2(0.); | |
44 | SetMass(t.GetMass()); | |
45 | ||
46 | Set(t.GetX(),t.GetAlpha(),t.GetParameter(),t.GetCovariance()); | |
47 | ||
48 | if ((t.GetStatus()&AliESDtrack::kTIME) == 0) return; | |
49 | StartTimeIntegral(); | |
50 | Double_t times[10]; t.GetIntegratedTimes(times); SetIntegratedTimes(times); | |
51 | SetIntegratedLength(t.GetIntegratedLength()); | |
52 | } | |
53 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
54 | AliHMPIDtrack& AliHMPIDtrack::operator=(const AliHMPIDtrack &/*source*/) | |
55 | { | |
56 | // ass. op. | |
57 | ||
58 | return *this; | |
59 | } | |
60 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
61 | Bool_t AliHMPIDtrack::PropagateTo(Double_t xk, Double_t xx0, Double_t xrho) | |
62 | { | |
63 | // | |
64 | // Propagates this track to a reference plane defined by "xk" [cm] | |
65 | // correcting for the mean crossed material. | |
66 | // Arguments: | |
67 | // "xx0" - thickness/rad.length [units of the radiation length] | |
68 | // "xrho" - thickness*density [g/cm^2] | |
69 | // Returns: kTRUE if the track propagates to plane, else kFALSE | |
70 | ||
71 | if (xk == GetX()) { | |
72 | return kTRUE; | |
73 | } | |
87a6d94b | 74 | Double_t b[3]; GetBxByBz(b); |
75 | if (!AliExternalTrackParam::PropagateToBxByBz(xk,b)) { | |
83253968 | 76 | return kFALSE; |
77 | } | |
78 | if (!AliExternalTrackParam::CorrectForMeanMaterial(xx0,xrho,GetMass())) { | |
79 | return kFALSE; | |
80 | } | |
81 | return kTRUE; | |
82 | }//PropagateTo() | |
83 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
84 | Bool_t AliHMPIDtrack::Rotate(Double_t alpha, Bool_t absolute) | |
85 | { | |
86 | // | |
87 | // Rotates track parameters in R*phi plane | |
88 | // if absolute rotation alpha is in global system | |
89 | // otherwise alpha rotation is relative to the current rotation angle | |
90 | // | |
91 | ||
92 | if (absolute) { | |
93 | alpha -= GetAlpha(); | |
94 | } | |
95 | ||
96 | ||
97 | return AliExternalTrackParam::Rotate(GetAlpha()+alpha); | |
98 | ||
99 | } | |
100 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
101 | Int_t AliHMPIDtrack::GetProlongation(Double_t xk, Double_t &y, Double_t &z) | |
102 | { | |
103 | // | |
104 | // Find a prolongation at given x | |
105 | // Return 0 if it does not exist | |
106 | // | |
107 | ||
87a6d94b | 108 | Double_t bz = GetBz(); |
83253968 | 109 | |
110 | if (!AliExternalTrackParam::GetYAt(xk,bz,y)) { | |
111 | return 0; | |
112 | } | |
113 | if (!AliExternalTrackParam::GetZAt(xk,bz,z)) { | |
114 | return 0; | |
115 | } | |
116 | ||
117 | return 1; | |
118 | ||
119 | } | |
120 | ||
121 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
496c71b0 | 122 | Bool_t AliHMPIDtrack::PropagateToR(Double_t r,Double_t step) |
83253968 | 123 | { |
124 | // | |
125 | // Propagate track to the radial position | |
126 | // Rotation always connected to the last track position | |
127 | // | |
128 | ||
129 | Double_t xyz0[3]; | |
130 | Double_t xyz1[3]; | |
131 | Double_t y; | |
132 | Double_t z; | |
133 | ||
134 | Double_t radius = TMath::Sqrt(GetX()*GetX() + GetY()*GetY()); | |
135 | // Direction +- | |
136 | Double_t dir = (radius > r) ? -1.0 : 1.0; | |
137 | ||
138 | for (Double_t x = radius+dir*step; dir*x < dir*r; x += dir*step) { | |
139 | ||
140 | GetXYZ(xyz0); | |
141 | Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]); | |
142 | Rotate(alpha,kTRUE); | |
143 | GetXYZ(xyz0); | |
6d256146 | 144 | if (!GetProlongation(x,y,z)) return kFALSE; |
83253968 | 145 | xyz1[0] = x * TMath::Cos(alpha) + y * TMath::Sin(alpha); |
146 | xyz1[1] = x * TMath::Sin(alpha) - y * TMath::Cos(alpha); | |
147 | xyz1[2] = z; | |
148 | Double_t param[7]; | |
149 | AliTracker::MeanMaterialBudget(xyz0,xyz1,param); | |
150 | if (param[1] <= 0) { | |
151 | param[1] = 100000000; | |
152 | } | |
153 | PropagateTo(x,param[1],param[0]*param[4]); | |
154 | ||
155 | } | |
156 | ||
157 | GetXYZ(xyz0); | |
158 | Double_t alpha = TMath::ATan2(xyz0[1],xyz0[0]); | |
159 | Rotate(alpha,kTRUE); | |
160 | GetXYZ(xyz0); | |
6d256146 | 161 | if (!GetProlongation(r,y,z)) return kFALSE; |
83253968 | 162 | xyz1[0] = r * TMath::Cos(alpha) + y * TMath::Sin(alpha); |
163 | xyz1[1] = r * TMath::Sin(alpha) - y * TMath::Cos(alpha); | |
164 | xyz1[2] = z; | |
165 | Double_t param[7]; | |
166 | AliTracker::MeanMaterialBudget(xyz0,xyz1,param); | |
167 | ||
168 | if (param[1] <= 0) { | |
169 | param[1] = 100000000; | |
170 | } | |
496c71b0 | 171 | |
172 | return PropagateTo(r,param[1],param[0]*param[4]); | |
83253968 | 173 | } |
174 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
175 | Double_t AliHMPIDtrack::GetPredictedChi2(const AliCluster3D *c) const { | |
176 | // | |
177 | // Arguments: AliCluster3D | |
178 | // Returns: Chi2 of track for the cluster | |
179 | Double_t p[3]={c->GetX(), c->GetY(), c->GetZ()}; | |
180 | Double_t covyz[3]={c->GetSigmaY2(), c->GetSigmaYZ(), c->GetSigmaZ2()}; | |
181 | Double_t covxyz[3]={c->GetSigmaX2(), c->GetSigmaXY(), c->GetSigmaXZ()}; | |
182 | return AliExternalTrackParam::GetPredictedChi2(p, covyz, covxyz); | |
183 | }//GetPredictedChi2() | |
184 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
185 | Bool_t AliHMPIDtrack::PropagateTo(const AliCluster3D *c) { | |
186 | // | |
187 | // Arguments: AliCluster3D | |
188 | // Returns: kTRUE if the track propagates to the plane of the cluster | |
189 | Double_t oldX=GetX(), oldY=GetY(), oldZ=GetZ(); | |
190 | Double_t p[3]={c->GetX(), c->GetY(), c->GetZ()}; | |
191 | Double_t covyz[3]={c->GetSigmaY2(), c->GetSigmaYZ(), c->GetSigmaZ2()}; | |
192 | Double_t covxyz[3]={c->GetSigmaX2(), c->GetSigmaXY(), c->GetSigmaXZ()}; | |
5b147198 | 193 | Double_t bz=-GetBz(); |
87a6d94b | 194 | |
83253968 | 195 | if(!AliExternalTrackParam::PropagateTo(p, covyz, covxyz, bz)) return kFALSE; |
196 | if(IsStartedTimeIntegral()) | |
197 | { | |
198 | Double_t d = TMath::Sqrt((GetX()-oldX)*(GetX()-oldX) + (GetY()-oldY)*(GetY()-oldY) + (GetZ()-oldZ)*(GetZ()-oldZ)); | |
199 | if (GetX()<oldX) d=-d; | |
200 | AddTimeStep(d); | |
87a6d94b | 201 | } |
83253968 | 202 | return kTRUE; |
203 | }//PropagateTo() | |
97a4d538 | 204 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
205 | Bool_t AliHMPIDtrack::Intersect(Double_t pnt[3], Double_t norm[3]) const { | |
83253968 | 206 | //+++++++++++++++++++++++++++++++++++++++++ |
207 | // Origin: K. Shileev (Kirill.Shileev@cern.ch) | |
208 | // Finds point of intersection (if exists) of the helix with the plane. | |
209 | // Stores result in fX and fP. | |
210 | // Arguments: planePoint,planeNorm - the plane defined by any plane's point | |
211 | // and vector, normal to the plane | |
212 | // Returns: kTrue if helix intersects the plane, kFALSE otherwise. | |
213 | //+++++++++++++++++++++++++++++++++++++++++ | |
214 | Double_t x0[3]; GetXYZ(x0); //get track position in MARS | |
83253968 | 215 | |
216 | //estimates initial helix length up to plane | |
217 | Double_t s=(pnt[0]-x0[0])*norm[0] + (pnt[1]-x0[1])*norm[1] + (pnt[2]-x0[2])*norm[2]; | |
218 | Double_t dist=99999,distPrev=dist; | |
97a4d538 | 219 | Double_t p[3],x[3]; |
83253968 | 220 | while(TMath::Abs(dist)>0.00001){ |
221 | //calculates helix at the distance s from x0 ALONG the helix | |
97a4d538 | 222 | Propagate(s,x,p); |
83253968 | 223 | //distance between current helix position and plane |
224 | dist=(x[0]-pnt[0])*norm[0]+(x[1]-pnt[1])*norm[1]+(x[2]-pnt[2])*norm[2]; | |
225 | if(TMath::Abs(dist) >= TMath::Abs(distPrev)) {return kFALSE;} | |
226 | distPrev=dist; | |
227 | s-=dist; | |
228 | } | |
229 | //on exit pnt is intersection point,norm is track vector at that point, | |
230 | //all in MARS | |
231 | for (Int_t i=0; i<3; i++) {pnt[i]=x[i]; norm[i]=p[i];} | |
232 | return kTRUE; | |
233 | }//Intersect() | |
234 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
97a4d538 | 235 | void AliHMPIDtrack::Propagate(Double_t len, Double_t x[3],Double_t p[3]) const { |
83253968 | 236 | //+++++++++++++++++++++++++++++++++++++++++ |
237 | // Origin: K. Shileev (Kirill.Shileev@cern.ch) | |
238 | // Extrapolate track along simple helix in magnetic field | |
239 | // Arguments: len -distance alogn helix, [cm] | |
240 | // bz - mag field, [kGaus] | |
241 | // Returns: x and p contain extrapolated positon and momentum | |
242 | // The momentum returned for straight-line tracks is meaningless ! | |
243 | //+++++++++++++++++++++++++++++++++++++++++ | |
244 | GetXYZ(x); | |
97a4d538 | 245 | Double_t bField[3]; |
246 | TGeoGlobalMagField::Instance()->Field(x,bField); | |
5b147198 | 247 | Double_t bz = -bField[2]; |
83253968 | 248 | if (OneOverPt() < kAlmost0 || TMath::Abs(bz) < kAlmost0Field ){ //straight-line tracks |
249 | Double_t unit[3]; GetDirection(unit); | |
250 | x[0]+=unit[0]*len; | |
251 | x[1]+=unit[1]*len; | |
252 | x[2]+=unit[2]*len; | |
253 | ||
254 | p[0]=unit[0]/kAlmost0; | |
255 | p[1]=unit[1]/kAlmost0; | |
256 | p[2]=unit[2]/kAlmost0; | |
257 | } else { | |
258 | GetPxPyPz(p); | |
259 | Double_t pp=GetP(); | |
260 | Double_t a = -kB2C*bz*GetSign(); ////////// what is kB2C | |
261 | Double_t rho = a/pp; | |
262 | x[0] += p[0]*TMath::Sin(rho*len)/a - p[1]*(1-TMath::Cos(rho*len))/a; | |
263 | x[1] += p[1]*TMath::Sin(rho*len)/a + p[0]*(1-TMath::Cos(rho*len))/a; | |
264 | x[2] += p[2]*len/pp; | |
265 | Double_t p0=p[0]; | |
266 | p[0] = p0 *TMath::Cos(rho*len) - p[1]*TMath::Sin(rho*len); | |
267 | p[1] = p[1]*TMath::Cos(rho*len) + p0 *TMath::Sin(rho*len); | |
268 | } | |
269 | }//Propagate() | |
270 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
ee2f3539 | 271 | Bool_t AliHMPIDtrack::Update(const AliHMPIDCluster *pClu, Double_t /*chisq*/, Int_t /*index*/) |
496c71b0 | 272 | { |
273 | // | |
274 | // Arguments: AliCluster3D, chi sq, and clu index | |
275 | // Returns: kTRUE if the track parameters are successfully updated | |
276 | Double_t p[2]={pClu->GetY(), pClu->GetZ()}; | |
277 | Double_t cov[3]={pClu->GetSigmaY2(), 0., pClu->GetSigmaZ2()}; | |
278 | if (!AliExternalTrackParam::Update(p,cov)) return kFALSE; | |
279 | ||
280 | /* | |
281 | AliTracker::FillResiduals(this,p,cov,pClu->GetVolumeId()); | |
282 | ||
283 | Int_t n=GetNumberOfClusters(); | |
284 | fIndex[n]=index; | |
285 | SetNumberOfClusters(n+1); | |
286 | SetChi2(GetChi2()+chisq); | |
287 | */ | |
288 | return kTRUE; | |
289 | ||
290 | }//Update() | |
291 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |