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