]>
Commit | Line | Data |
---|---|---|
3e87ef69 | 1 | // @(#) $Id$ |
6d4f1901 | 2 | |
2d04dcbf | 3 | // Author: Anders Vestbo <mailto:vestbo$fi.uib.no>, Uli Frankenfeld <mailto:franken@fi.uib.no> |
3e87ef69 | 4 | //*-- Copyright © ALICE HLT Group |
108615fc | 5 | |
118c26c3 | 6 | #include "AliL3StandardIncludes.h" |
14e76e91 | 7 | #include "AliL3RootTypes.h" |
108615fc | 8 | #include "AliL3RootTypes.h" |
108615fc | 9 | #include "AliL3Logging.h" |
10 | #include "AliL3Track.h" | |
0391971c | 11 | #include "AliL3Transform.h" |
6d4f1901 | 12 | #include "AliL3Vertex.h" |
de3c3890 | 13 | #include "AliL3SpacePointData.h" |
118c26c3 | 14 | |
0bd0c1ef | 15 | #if __GNUC__ == 3 |
3e87ef69 | 16 | using namespace std; |
17 | #endif | |
108615fc | 18 | |
3e87ef69 | 19 | /** \class AliL3Track |
20 | //<pre> | |
2d04dcbf | 21 | //_____________________________________________________________ |
22 | // AliL3Track | |
23 | // | |
24 | // Track base class | |
02cb36b2 | 25 | //Begin_Html |
3e87ef69 | 26 | //<img src="track_coordinates.gif"> |
02cb36b2 | 27 | //End_Html |
3e87ef69 | 28 | </pre> |
29 | */ | |
0391971c | 30 | |
108615fc | 31 | ClassImp(AliL3Track) |
32 | ||
108615fc | 33 | |
34 | AliL3Track::AliL3Track() | |
35 | { | |
36 | //Constructor | |
108615fc | 37 | fNHits = 0; |
38 | fMCid = -1; | |
39 | fKappa=0; | |
40 | fRadius=0; | |
41 | fCenterX=0; | |
42 | fCenterY=0; | |
43 | ComesFromMainVertex(false); | |
44 | fQ = 0; | |
45 | fPhi0=0; | |
46 | fPsi=0; | |
47 | fR0=0; | |
48 | fTanl=0; | |
49 | fZ0=0; | |
50 | fPt=0; | |
51 | fLength=0; | |
52 | fIsLocal=true; | |
53 | fRowRange[0]=0; | |
54 | fRowRange[1]=0; | |
3e87ef69 | 55 | SetFirstPoint(0,0,0); |
56 | SetLastPoint(0,0,0); | |
68a27388 | 57 | memset(fHitNumbers,0,159*sizeof(UInt_t)); |
de3c3890 | 58 | fPID = 0; |
61bd40de | 59 | |
60 | fSector=0; | |
61 | fPterr=0; | |
62 | fPsierr=0; | |
63 | fZ0err=0; | |
64 | fTanlerr=0; | |
65 | fPoint[0]=fPoint[1]=fPoint[2]=0; | |
66 | fPointPsi=0; | |
108615fc | 67 | } |
68 | ||
b1ed0288 | 69 | void AliL3Track::Set(AliL3Track *tpt) |
70 | { | |
71 | //setter | |
3a735e00 | 72 | SetRowRange(tpt->GetFirstRow(),tpt->GetLastRow()); |
73 | SetPhi0(tpt->GetPhi0()); | |
74 | SetKappa(tpt->GetKappa()); | |
75 | SetNHits(tpt->GetNHits()); | |
76 | SetFirstPoint(tpt->GetFirstPointX(),tpt->GetFirstPointY(),tpt->GetFirstPointZ()); | |
77 | SetLastPoint(tpt->GetLastPointX(),tpt->GetLastPointY(),tpt->GetLastPointZ()); | |
78 | SetPt(tpt->GetPt()); | |
79 | SetPsi(tpt->GetPsi()); | |
80 | SetTgl(tpt->GetTgl()); | |
81 | SetCharge(tpt->GetCharge()); | |
82 | SetHits(tpt->GetNHits(),(UInt_t *)tpt->GetHitNumbers()); | |
4a0bee4e | 83 | #ifdef do_mc |
84 | SetMCid(tpt->GetMCid()); | |
85 | #endif | |
de3c3890 | 86 | SetPID(tpt->GetPID()); |
87 | SetSector(tpt->GetSector()); | |
108615fc | 88 | } |
89 | ||
203925a9 | 90 | Int_t AliL3Track::Compare(const AliL3Track *track) const |
91 | { | |
b1ed0288 | 92 | // compare tracks |
203925a9 | 93 | if(track->GetNHits() < GetNHits()) return 1; |
94 | if(track->GetNHits() > GetNHits()) return -1; | |
95 | return 0; | |
96 | } | |
108615fc | 97 | |
98 | AliL3Track::~AliL3Track() | |
99 | { | |
203925a9 | 100 | //Nothing to do |
108615fc | 101 | } |
102 | ||
103 | Double_t AliL3Track::GetP() const | |
104 | { | |
203925a9 | 105 | // Returns total momentum. |
108615fc | 106 | return fabs(GetPt())*sqrt(1. + GetTgl()*GetTgl()); |
108615fc | 107 | } |
108 | ||
109 | Double_t AliL3Track::GetPseudoRapidity() const | |
b1ed0288 | 110 | { //get pseudo rap |
108615fc | 111 | return 0.5 * log((GetP() + GetPz()) / (GetP() - GetPz())); |
112 | } | |
eeddc64d | 113 | |
203925a9 | 114 | /* |
108615fc | 115 | Double_t AliL3Track::GetEta() const |
116 | { | |
117 | return GetPseudoRapidity(); | |
118 | } | |
203925a9 | 119 | */ |
eeddc64d | 120 | |
108615fc | 121 | Double_t AliL3Track::GetRapidity() const |
b1ed0288 | 122 | { |
123 | //get rap | |
14e76e91 | 124 | const Double_t kmpi = 0.13957; |
125 | return 0.5 * log((kmpi + GetPz()) / (kmpi - GetPz())); | |
108615fc | 126 | } |
127 | ||
203925a9 | 128 | void AliL3Track::Rotate(Int_t slice,Bool_t tolocal) |
0391971c | 129 | { |
0391971c | 130 | //Rotate track to global parameters |
203925a9 | 131 | //If flag tolocal is set, the track is rotated |
132 | //to local coordinates. | |
0391971c | 133 | |
0391971c | 134 | Float_t psi[1] = {GetPsi()}; |
203925a9 | 135 | if(!tolocal) |
494fad94 | 136 | AliL3Transform::Local2GlobalAngle(psi,slice); |
203925a9 | 137 | else |
494fad94 | 138 | AliL3Transform::Global2LocalAngle(psi,slice); |
0391971c | 139 | SetPsi(psi[0]); |
140 | Float_t first[3]; | |
141 | first[0] = GetFirstPointX(); | |
142 | first[1] = GetFirstPointY(); | |
143 | first[2] = GetFirstPointZ(); | |
203925a9 | 144 | if(!tolocal) |
494fad94 | 145 | AliL3Transform::Local2Global(first,slice); |
203925a9 | 146 | else |
5a31e9df | 147 | AliL3Transform::Global2LocHLT(first,slice); |
148 | //AliL3Transform::Global2Local(first,slice,kTRUE); | |
203925a9 | 149 | |
0391971c | 150 | SetFirstPoint(first[0],first[1],first[2]); |
151 | Float_t last[3]; | |
152 | last[0] = GetLastPointX(); | |
153 | last[1] = GetLastPointY(); | |
154 | last[2] = GetLastPointZ(); | |
203925a9 | 155 | if(!tolocal) |
494fad94 | 156 | AliL3Transform::Local2Global(last,slice); |
203925a9 | 157 | else |
5a31e9df | 158 | AliL3Transform::Global2LocHLT(last,slice); |
159 | //AliL3Transform::Global2Local(last,slice,kTRUE); | |
0391971c | 160 | SetLastPoint(last[0],last[1],last[2]); |
203925a9 | 161 | |
6d4f1901 | 162 | Float_t center[3] = {GetCenterX(),GetCenterY(),0}; |
163 | if(!tolocal) | |
494fad94 | 164 | AliL3Transform::Local2Global(center,slice); |
6d4f1901 | 165 | else |
5a31e9df | 166 | AliL3Transform::Global2LocHLT(center,slice); |
167 | //AliL3Transform::Global2Local(center,slice,kTRUE); | |
6d4f1901 | 168 | SetCenterX(center[0]); |
169 | SetCenterY(center[1]); | |
170 | ||
3e87ef69 | 171 | SetPhi0(atan2(fFirstPoint[1],fFirstPoint[0])); |
172 | SetR0(sqrt(fFirstPoint[0]*fFirstPoint[0]+fFirstPoint[1]*fFirstPoint[1])); | |
173 | ||
203925a9 | 174 | if(!tolocal) |
175 | fIsLocal=kFALSE; | |
176 | else | |
177 | fIsLocal=kTRUE; | |
0391971c | 178 | } |
179 | ||
b1ed0288 | 180 | void AliL3Track::CalculateHelix() |
181 | { | |
eeddc64d | 182 | //Calculate Radius, CenterX and CenterY from Psi, X0, Y0 |
5a31e9df | 183 | fRadius = fPt / (AliL3Transform::GetBFieldValue()); |
3ceb3fe1 | 184 | if(fRadius) fKappa = -fQ*1./fRadius; |
108615fc | 185 | else fRadius = 999999; //just zero |
5a31e9df | 186 | Double_t trackPhi0 = fPsi + fQ * AliL3Transform::PiHalf(); |
108615fc | 187 | |
188 | fCenterX = fFirstPoint[0] - fRadius * cos(trackPhi0); | |
189 | fCenterY = fFirstPoint[1] - fRadius * sin(trackPhi0); | |
3e87ef69 | 190 | |
191 | SetPhi0(atan2(fFirstPoint[1],fFirstPoint[0])); | |
192 | SetR0(sqrt(fFirstPoint[0]*fFirstPoint[0]+fFirstPoint[1]*fFirstPoint[1])); | |
108615fc | 193 | } |
194 | ||
3e87ef69 | 195 | Double_t AliL3Track::GetCrossingAngle(Int_t padrow,Int_t slice) |
0391971c | 196 | { |
197 | //Calculate the crossing angle between track and given padrow. | |
0391971c | 198 | //Take the dot product of the tangent vector of the track, and |
199 | //vector perpendicular to the padrow. | |
dab230b2 | 200 | //In order to do this, we need the tangent vector to the track at the |
201 | //point. This is done by rotating the radius vector by 90 degrees; | |
202 | //rotation matrix: ( 0 1 ) | |
203 | // ( -1 0 ) | |
3e87ef69 | 204 | |
205 | Float_t angle=0;//Angle perpendicular to the padrow in local coordinates | |
206 | if(slice>=0)//Global coordinates | |
207 | { | |
208 | AliL3Transform::Local2GlobalAngle(&angle,slice); | |
209 | if(!CalculateReferencePoint(angle,AliL3Transform::Row2X(padrow))) | |
210 | cerr<<"AliL3Track::GetCrossingAngle : Track does not cross line in slice "<<slice<<" row "<<padrow<<endl; | |
211 | } | |
212 | else //should be in local coordinates | |
213 | { | |
214 | Float_t xyz[3]; | |
215 | GetCrossingPoint(padrow,xyz); | |
216 | fPoint[0] = xyz[0]; | |
217 | fPoint[1] = xyz[1]; | |
218 | fPoint[2] = xyz[2]; | |
219 | } | |
220 | ||
0391971c | 221 | Double_t tangent[2]; |
dab230b2 | 222 | |
3e87ef69 | 223 | tangent[0] = (fPoint[1] - GetCenterY())/GetRadius(); |
224 | tangent[1] = -1.*(fPoint[0] - GetCenterX())/GetRadius(); | |
225 | ||
14e76e91 | 226 | Double_t perppadrow[2] = {cos(angle),sin(angle)}; |
227 | Double_t cosbeta = fabs(tangent[0]*perppadrow[0] + tangent[1]*perppadrow[1]); | |
228 | if(cosbeta > 1) cosbeta=1; | |
229 | return acos(cosbeta); | |
0391971c | 230 | } |
231 | ||
3e87ef69 | 232 | Bool_t AliL3Track::GetCrossingPoint(Int_t padrow,Float_t *xyz) |
0391971c | 233 | { |
234 | //Assumes the track is given in local coordinates | |
3e87ef69 | 235 | |
0391971c | 236 | if(!IsLocal()) |
237 | { | |
3e87ef69 | 238 | cerr<<"GetCrossingPoint: Track is given on global coordinates"<<endl; |
0391971c | 239 | return false; |
240 | } | |
241 | ||
494fad94 | 242 | Double_t xHit = AliL3Transform::Row2X(padrow); |
0391971c | 243 | |
244 | xyz[0] = xHit; | |
245 | Double_t aa = (xHit - GetCenterX())*(xHit - GetCenterX()); | |
246 | Double_t r2 = GetRadius()*GetRadius(); | |
247 | if(aa > r2) | |
248 | return false; | |
249 | ||
250 | Double_t aa2 = sqrt(r2 - aa); | |
251 | Double_t y1 = GetCenterY() + aa2; | |
252 | Double_t y2 = GetCenterY() - aa2; | |
253 | xyz[1] = y1; | |
254 | if(fabs(y2) < fabs(y1)) xyz[1] = y2; | |
3e87ef69 | 255 | |
0391971c | 256 | Double_t yHit = xyz[1]; |
257 | Double_t angle1 = atan2((yHit - GetCenterY()),(xHit - GetCenterX())); | |
9ca67380 | 258 | if(angle1 < 0) angle1 += 2.*AliL3Transform::Pi(); |
0391971c | 259 | Double_t angle2 = atan2((GetFirstPointY() - GetCenterY()),(GetFirstPointX() - GetCenterX())); |
5a31e9df | 260 | if(angle2 < 0) angle2 += AliL3Transform::TwoPi(); |
14e76e91 | 261 | Double_t diffangle = angle1 - angle2; |
262 | diffangle = fmod(diffangle,AliL3Transform::TwoPi()); | |
263 | if((GetCharge()*diffangle) > 0) diffangle = diffangle - GetCharge()*AliL3Transform::TwoPi(); | |
264 | Double_t stot = fabs(diffangle)*GetRadius(); | |
265 | Double_t zHit = GetFirstPointZ() + stot*GetTgl(); | |
0391971c | 266 | xyz[2] = zHit; |
3e87ef69 | 267 | |
0391971c | 268 | return true; |
3e87ef69 | 269 | |
0391971c | 270 | } |
271 | ||
b1ed0288 | 272 | Bool_t AliL3Track::CalculateReferencePoint(Double_t angle,Double_t radius) |
273 | { | |
5a31e9df | 274 | // Global coordinate: crossing point with y = ax+ b; |
275 | // a=tan(angle-AliL3Transform::PiHalf()); | |
108615fc | 276 | // |
14e76e91 | 277 | const Double_t krr=radius; //position of reference plane |
278 | const Double_t kxr = cos(angle) * krr; | |
279 | const Double_t kyr = sin(angle) * krr; | |
6d4f1901 | 280 | |
5a31e9df | 281 | Double_t a = tan(angle-AliL3Transform::PiHalf()); |
14e76e91 | 282 | Double_t b = kyr - a * kxr; |
108615fc | 283 | |
284 | Double_t pp=(fCenterX+a*fCenterY-a*b)/(1+pow(a,2)); | |
285 | Double_t qq=(pow(fCenterX,2)+pow(fCenterY,2)-2*fCenterY*b+pow(b,2)-pow(fRadius,2))/(1+pow(a,2)); | |
286 | ||
287 | Double_t racine = pp*pp-qq; | |
288 | if(racine<0) return IsPoint(kFALSE); //no Point | |
289 | ||
290 | Double_t rootRacine = sqrt(racine); | |
291 | Double_t x0 = pp+rootRacine; | |
292 | Double_t x1 = pp-rootRacine; | |
293 | Double_t y0 = a*x0 + b; | |
294 | Double_t y1 = a*x1 + b; | |
295 | ||
14e76e91 | 296 | Double_t diff0 = sqrt(pow(x0-kxr,2)+pow(y0-kyr,2)); |
297 | Double_t diff1 = sqrt(pow(x1-kxr,2)+pow(y1-kyr,2)); | |
108615fc | 298 | |
299 | if(diff0<diff1){ | |
300 | fPoint[0]=x0; | |
301 | fPoint[1]=y0; | |
302 | } | |
303 | else{ | |
304 | fPoint[0]=x1; | |
305 | fPoint[1]=y1; | |
306 | } | |
307 | ||
308 | Double_t pointPhi0 = atan2(fPoint[1]-fCenterY,fPoint[0]-fCenterX); | |
309 | Double_t trackPhi0 = atan2(fFirstPoint[1]-fCenterY,fFirstPoint[0]-fCenterX); | |
5a31e9df | 310 | if(fabs(trackPhi0-pointPhi0)>AliL3Transform::Pi()){ |
311 | if(trackPhi0<pointPhi0) trackPhi0 += AliL3Transform::TwoPi(); | |
312 | else pointPhi0 += AliL3Transform::TwoPi(); | |
108615fc | 313 | } |
314 | Double_t stot = -fQ * (pointPhi0-trackPhi0) * fRadius ; | |
315 | fPoint[2] = fFirstPoint[2] + stot * fTanl; | |
316 | ||
5a31e9df | 317 | fPointPsi = pointPhi0 - fQ * AliL3Transform::PiHalf(); |
318 | if(fPointPsi<0.) fPointPsi+= AliL3Transform::TwoPi(); | |
319 | fPointPsi = fmod(fPointPsi, AliL3Transform::TwoPi()); | |
108615fc | 320 | |
321 | return IsPoint(kTRUE); | |
322 | } | |
323 | ||
b1ed0288 | 324 | Bool_t AliL3Track::CalculateEdgePoint(Double_t angle) |
325 | { | |
108615fc | 326 | // Global coordinate: crossing point with y = ax; a=tan(angle); |
327 | // | |
4a0bee4e | 328 | Double_t rmin=AliL3Transform::Row2X(AliL3Transform::GetFirstRow(-1)); //min Radius of TPC |
329 | Double_t rmax=AliL3Transform::Row2X(AliL3Transform::GetLastRow(-1)); //max Radius of TPC | |
108615fc | 330 | |
331 | Double_t a = tan(angle); | |
332 | Double_t pp=(fCenterX+a*fCenterY)/(1+pow(a,2)); | |
333 | Double_t qq=(pow(fCenterX,2)+pow(fCenterY,2)-pow(fRadius,2))/(1+pow(a,2)); | |
334 | Double_t racine = pp*pp-qq; | |
335 | if(racine<0) return IsPoint(kFALSE); //no Point | |
336 | Double_t rootRacine = sqrt(racine); | |
337 | Double_t x0 = pp+rootRacine; | |
338 | Double_t x1 = pp-rootRacine; | |
339 | Double_t y0 = a*x0; | |
340 | Double_t y1 = a*x1; | |
341 | ||
342 | Double_t r0 = sqrt(pow(x0,2)+pow(y0,2)); | |
343 | Double_t r1 = sqrt(pow(x1,2)+pow(y1,2)); | |
344 | //find the right crossing point: | |
345 | //inside the TPC modules | |
346 | Bool_t ok0 = kFALSE; | |
347 | Bool_t ok1 = kFALSE; | |
472d9e24 | 348 | |
108615fc | 349 | if(r0>rmin&&r0<rmax){ |
350 | Double_t da=atan2(y0,x0); | |
5a31e9df | 351 | if(da<0) da+=AliL3Transform::TwoPi(); |
108615fc | 352 | if(fabs(da-angle)<0.5) |
353 | ok0 = kTRUE; | |
354 | } | |
355 | if(r1>rmin&&r1<rmax){ | |
472d9e24 | 356 | Double_t da=atan2(y1,x1); |
5a31e9df | 357 | if(da<0) da+=AliL3Transform::TwoPi(); |
108615fc | 358 | if(fabs(da-angle)<0.5) |
359 | ok1 = kTRUE; | |
360 | } | |
361 | if(!(ok0||ok1)) return IsPoint(kFALSE); //no Point | |
362 | ||
363 | if(ok0&&ok1){ | |
364 | Double_t diff0 = sqrt(pow(fFirstPoint[0]-x0,2)+pow(fFirstPoint[1]-y0,2)); | |
365 | Double_t diff1 = sqrt(pow(fFirstPoint[0]-x1,2)+pow(fFirstPoint[1]-y1,2)); | |
366 | if(diff0<diff1) ok1 = kFALSE; //use ok0 | |
367 | else ok0 = kFALSE; //use ok1 | |
368 | } | |
369 | if(ok0){fPoint[0]=x0; fPoint[1]=y0;} | |
370 | else {fPoint[0]=x1; fPoint[1]=y1;} | |
371 | ||
372 | Double_t pointPhi0 = atan2(fPoint[1]-fCenterY,fPoint[0]-fCenterX); | |
373 | Double_t trackPhi0 = atan2(fFirstPoint[1]-fCenterY,fFirstPoint[0]-fCenterX); | |
5a31e9df | 374 | if(fabs(trackPhi0-pointPhi0)>AliL3Transform::Pi()){ |
375 | if(trackPhi0<pointPhi0) trackPhi0 += AliL3Transform::TwoPi(); | |
376 | else pointPhi0 += AliL3Transform::TwoPi(); | |
108615fc | 377 | } |
378 | Double_t stot = -fQ * (pointPhi0-trackPhi0) * fRadius ; | |
379 | fPoint[2] = fFirstPoint[2] + stot * fTanl; | |
380 | ||
5a31e9df | 381 | fPointPsi = pointPhi0 - fQ * AliL3Transform::PiHalf(); |
382 | if(fPointPsi<0.) fPointPsi+= AliL3Transform::TwoPi(); | |
383 | fPointPsi = fmod(fPointPsi, AliL3Transform::TwoPi()); | |
108615fc | 384 | |
385 | return IsPoint(kTRUE); | |
386 | } | |
387 | ||
b1ed0288 | 388 | Bool_t AliL3Track::CalculatePoint(Double_t xplane) |
389 | { | |
108615fc | 390 | // Local coordinate: crossing point with x plane |
391 | // | |
392 | Double_t racine = pow(fRadius,2)-pow(xplane-fCenterX,2); | |
393 | if(racine<0) return IsPoint(kFALSE); | |
394 | Double_t rootRacine = sqrt(racine); | |
395 | ||
396 | Double_t y0 = fCenterY + rootRacine; | |
397 | Double_t y1 = fCenterY - rootRacine; | |
398 | //Double_t diff0 = sqrt(pow(fFirstPoint[0]-xplane)+pow(fFirstPoint[1]-y0)); | |
399 | //Double_t diff1 = sqrt(pow(fFirstPoint[0]-xplane)+pow(fFirstPoint[1]-y1)); | |
400 | Double_t diff0 = fabs(y0-fFirstPoint[1]); | |
401 | Double_t diff1 = fabs(y1-fFirstPoint[1]); | |
402 | ||
403 | fPoint[0]=xplane; | |
404 | if(diff0<diff1) fPoint[1]=y0; | |
405 | else fPoint[1]=y1; | |
406 | ||
407 | Double_t pointPhi0 = atan2(fPoint[1]-fCenterY,fPoint[0]-fCenterX); | |
408 | Double_t trackPhi0 = atan2(fFirstPoint[1]-fCenterY,fFirstPoint[0]-fCenterX); | |
5a31e9df | 409 | if(fabs(trackPhi0-pointPhi0)>AliL3Transform::Pi()){ |
410 | if(trackPhi0<pointPhi0) trackPhi0 += AliL3Transform::TwoPi(); | |
411 | else pointPhi0 += AliL3Transform::TwoPi(); | |
108615fc | 412 | } |
413 | Double_t stot = -fQ * (pointPhi0-trackPhi0) * fRadius ; | |
414 | fPoint[2] = fFirstPoint[2] + stot * fTanl; | |
415 | ||
5a31e9df | 416 | fPointPsi = pointPhi0 - fQ * AliL3Transform::PiHalf(); |
417 | if(fPointPsi<0.) fPointPsi+= AliL3Transform::TwoPi(); | |
418 | fPointPsi = fmod(fPointPsi, AliL3Transform::TwoPi()); | |
108615fc | 419 | |
420 | return IsPoint(kTRUE); | |
421 | } | |
422 | ||
3e87ef69 | 423 | void AliL3Track::UpdateToFirstPoint() |
424 | { | |
425 | //Update track parameters to the innermost point on the track. | |
1f1942b8 | 426 | //This means that the parameters of the track will be given in the point |
427 | //of closest approach to the first innermost point, i.e. the point | |
428 | //lying on the track fit (and not the coordinates of the innermost point itself). | |
429 | //This function assumes that fFirstPoint is already set to the coordinates of the innermost | |
430 | //assigned cluster. | |
431 | // | |
432 | //During the helix-fit, the first point on the track is set to the coordinates | |
433 | //of the innermost assigned cluster. This may be ok, if you just want a fast | |
434 | //estimate of the "global" track parameters; such as the momentum etc. | |
435 | //However, if you later on want to do more precise local calculations, such | |
436 | //as impact parameter, residuals etc, you need to give the track parameters | |
437 | //according to the actual fit. | |
3e87ef69 | 438 | |
1f1942b8 | 439 | Double_t xc = GetCenterX() - GetFirstPointX(); |
440 | Double_t yc = GetCenterY() - GetFirstPointY(); | |
3e87ef69 | 441 | |
14e76e91 | 442 | Double_t distx1 = xc*(1 + GetRadius()/sqrt(xc*xc + yc*yc)); |
443 | Double_t disty1 = yc*(1 + GetRadius()/sqrt(xc*xc + yc*yc)); | |
444 | Double_t distance1 = sqrt(distx1*distx1 + disty1*disty1); | |
3e87ef69 | 445 | |
14e76e91 | 446 | Double_t distx2 = xc*(1 - GetRadius()/sqrt(xc*xc + yc*yc)); |
447 | Double_t disty2 = yc*(1 - GetRadius()/sqrt(xc*xc + yc*yc)); | |
448 | Double_t distance2 = sqrt(distx2*distx2 + disty2*disty2); | |
3e87ef69 | 449 | |
1f1942b8 | 450 | //Choose the closest: |
451 | Double_t point[2]; | |
452 | if(distance1 < distance2) | |
453 | { | |
14e76e91 | 454 | point[0] = distx1 + GetFirstPointX(); |
455 | point[1] = disty1 + GetFirstPointY(); | |
1f1942b8 | 456 | } |
457 | else | |
458 | { | |
14e76e91 | 459 | point[0] = distx2 + GetFirstPointX(); |
460 | point[1] = disty2 + GetFirstPointY(); | |
1f1942b8 | 461 | } |
462 | ||
463 | Double_t pointpsi = atan2(point[1]-GetCenterY(),point[0]-GetCenterX()); | |
5a31e9df | 464 | pointpsi -= GetCharge()*AliL3Transform::PiHalf(); |
465 | if(pointpsi < 0) pointpsi += AliL3Transform::TwoPi(); | |
3e87ef69 | 466 | |
1f1942b8 | 467 | //Update the track parameters |
468 | SetR0(sqrt(point[0]*point[0]+point[1]*point[1])); | |
469 | SetPhi0(atan2(point[1],point[0])); | |
470 | SetFirstPoint(point[0],point[1],GetZ0()); | |
471 | SetPsi(pointpsi); | |
3e87ef69 | 472 | |
3e87ef69 | 473 | } |
474 | ||
14e76e91 | 475 | void AliL3Track::GetClosestPoint(AliL3Vertex *vertex,Double_t &closestx,Double_t &closesty,Double_t &closestz) |
6d4f1901 | 476 | { |
477 | //Calculate the point of closest approach to the vertex | |
1f1942b8 | 478 | //This function calculates the minimum distance from the helix to the vertex, and choose |
479 | //the corresponding point lying on the helix as the point of closest approach. | |
6d4f1901 | 480 | |
1f1942b8 | 481 | Double_t xc = GetCenterX() - vertex->GetX(); |
6d4f1901 | 482 | Double_t yc = GetCenterY() - vertex->GetY(); |
483 | ||
14e76e91 | 484 | Double_t distx1 = xc*(1 + GetRadius()/sqrt(xc*xc + yc*yc)); |
485 | Double_t disty1 = yc*(1 + GetRadius()/sqrt(xc*xc + yc*yc)); | |
486 | Double_t distance1 = sqrt(distx1*distx1 + disty1*disty1); | |
6d4f1901 | 487 | |
14e76e91 | 488 | Double_t distx2 = xc*(1 - GetRadius()/sqrt(xc*xc + yc*yc)); |
489 | Double_t disty2 = yc*(1 - GetRadius()/sqrt(xc*xc + yc*yc)); | |
490 | Double_t distance2 = sqrt(distx2*distx2 + disty2*disty2); | |
6d4f1901 | 491 | |
492 | //Choose the closest: | |
493 | if(distance1 < distance2) | |
494 | { | |
14e76e91 | 495 | closestx = distx1 + vertex->GetX(); |
496 | closesty = disty1 + vertex->GetY(); | |
6d4f1901 | 497 | } |
498 | else | |
499 | { | |
14e76e91 | 500 | closestx = distx2 + vertex->GetX(); |
501 | closesty = disty2 + vertex->GetY(); | |
6d4f1901 | 502 | } |
503 | ||
504 | //Get the z coordinate: | |
14e76e91 | 505 | Double_t angle1 = atan2((closesty-GetCenterY()),(closestx-GetCenterX())); |
5a31e9df | 506 | if(angle1 < 0) angle1 = angle1 + AliL3Transform::TwoPi(); |
6d4f1901 | 507 | |
508 | Double_t angle2 = atan2((GetFirstPointY()-GetCenterY()),(GetFirstPointX()-GetCenterX())); | |
5a31e9df | 509 | if(angle2 < 0) angle2 = angle2 + AliL3Transform::TwoPi(); |
6d4f1901 | 510 | |
511 | Double_t diff_angle = angle1 - angle2; | |
5a31e9df | 512 | diff_angle = fmod(diff_angle,AliL3Transform::TwoPi()); |
6d4f1901 | 513 | |
5a31e9df | 514 | if((GetCharge()*diff_angle) < 0) diff_angle = diff_angle + GetCharge()*AliL3Transform::TwoPi(); |
14e76e91 | 515 | Double_t stot = fabs(diff_angle)*GetRadius(); |
516 | closestz = GetFirstPointZ() - stot*GetTgl(); | |
6d4f1901 | 517 | } |
61bd40de | 518 | |
519 | void AliL3Track::Print() const | |
e9ecfae3 | 520 | { //print out parameters of track |
61bd40de | 521 | LOG(AliL3Log::kInformational,"AliL3Track::Print","Print values") |
e9ecfae3 | 522 | <<fNHits<<" "<<fMCid<<" "<<fKappa<<" "<<fRadius<<" "<<fCenterX<<" "<<fCenterY<<" " |
523 | <<fFromMainVertex<<" "<<fRowRange[0]<<" "<<fRowRange[1]<<" "<<fSector<<" "<<fQ<<" " | |
524 | <<fTanl<<" "<<fPsi<<" "<<fPt<<" "<<fLength<<" "<<fPterr<<" "<<fPsierr<<" "<<fZ0err<<" " | |
525 | <<fTanlerr<<" "<<fPhi0<<" "<<fR0<<" "<<fZ0<<" "<<fFirstPoint[0]<<" "<<fFirstPoint[1]<<" " | |
526 | <<fFirstPoint[2]<<" "<<fLastPoint[0]<<" "<<fLastPoint[1]<<" "<<fLastPoint[2]<<" " | |
527 | <<fPoint[0]<<" "<<fPoint[1]<<" "<<fPoint[2]<<" "<<fPointPsi<<" "<<fIsPoint<<" " | |
528 | <<fIsLocal<<" "<<fPID<<ENDLOG; | |
61bd40de | 529 | } |