]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliExternalTrackParam.cxx
minor
[u/mrichter/AliRoot.git] / STEER / AliExternalTrackParam.cxx
index 5840784cdde72aa3b3f927bff547f570c293adaa..651ae7e80b162350b95a8bd41ace96f2c3a6994f 100644 (file)
 // Origin: I.Belikov, CERN, Jouri.Belikov@cern.ch                            //
 ///////////////////////////////////////////////////////////////////////////////
 #include "AliExternalTrackParam.h"
-#include "AliKalmanTrack.h"
-#include "AliTracker.h"
-#include "AliStrLine.h"
 #include "AliESDVertex.h"
-
+#include "AliLog.h"
 
 ClassImp(AliExternalTrackParam)
 
 //_____________________________________________________________________________
 AliExternalTrackParam::AliExternalTrackParam() :
+  TObject(),
   fX(0),
   fAlpha(0)
 {
@@ -46,10 +44,24 @@ AliExternalTrackParam::AliExternalTrackParam() :
   for (Int_t i = 0; i < 15; i++) fC[i] = 0;
 }
 
+//_____________________________________________________________________________
+AliExternalTrackParam::AliExternalTrackParam(const AliExternalTrackParam &track):
+  TObject(track),
+  fX(track.fX),
+  fAlpha(track.fAlpha)
+{
+  //
+  // copy constructor
+  //
+  for (Int_t i = 0; i < 5; i++) fP[i] = track.fP[i];
+  for (Int_t i = 0; i < 15; i++) fC[i] = track.fC[i];
+}
+
 //_____________________________________________________________________________
 AliExternalTrackParam::AliExternalTrackParam(Double_t x, Double_t alpha, 
                                             const Double_t param[5], 
                                             const Double_t covar[15]) :
+  TObject(),
   fX(x),
   fAlpha(alpha)
 {
@@ -61,26 +73,22 @@ AliExternalTrackParam::AliExternalTrackParam(Double_t x, Double_t alpha,
 }
 
 //_____________________________________________________________________________
-AliExternalTrackParam::AliExternalTrackParam(const AliKalmanTrack& track) :
-  fAlpha(track.GetAlpha())
-{
+void AliExternalTrackParam::Set(Double_t x, Double_t alpha,
+                               const Double_t p[5], const Double_t cov[15]) {
   //
+  //  Sets the parameters
   //
-  track.GetExternalParameters(fX,fP);
-  track.GetExternalCovariance(fC);
+  fX=x;
+  fAlpha=alpha;
+  for (Int_t i = 0; i < 5; i++)  fP[i] = p[i];
+  for (Int_t i = 0; i < 15; i++) fC[i] = cov[i];
 }
 
 //_____________________________________________________________________________
-void AliExternalTrackParam::Set(const AliKalmanTrack& track) {
+void AliExternalTrackParam::Reset() {
   //
+  // Resets all the parameters to 0 
   //
-  fAlpha=track.GetAlpha();
-  track.GetExternalParameters(fX,fP);
-  track.GetExternalCovariance(fC);
-}
-
-//_____________________________________________________________________________
-void AliExternalTrackParam::Reset() {
   fX=fAlpha=0.;
   for (Int_t i = 0; i < 5; i++) fP[i] = 0;
   for (Int_t i = 0; i < 15; i++) fC[i] = 0;
@@ -91,7 +99,7 @@ Double_t AliExternalTrackParam::GetP() const {
   // This function returns the track momentum
   // Results for (nearly) straight tracks are meaningless !
   //---------------------------------------------------------------------
-  if (TMath::Abs(fP[4])<=0) return kVeryBig;
+  if (TMath::Abs(fP[4])<=kAlmost0) return kVeryBig;
   return TMath::Sqrt(1.+ fP[3]*fP[3])/TMath::Abs(fP[4]);
 }
 
@@ -110,7 +118,7 @@ Double_t AliExternalTrackParam::GetD(Double_t x,Double_t y,Double_t b) const {
   // in the magnetic field "b" (kG)
   //------------------------------------------------------------------
   if (TMath::Abs(b) < kAlmost0Field) return GetLinearD(x,y);
-  Double_t rp4=kB2C*b*fP[4];
+  Double_t rp4=GetC(b);
 
   Double_t xt=fX, yt=fP[0];
 
@@ -121,8 +129,37 @@ Double_t AliExternalTrackParam::GetD(Double_t x,Double_t y,Double_t b) const {
 
   sn=rp4*xt - fP[2]; cs=rp4*yt + TMath::Sqrt(1.- fP[2]*fP[2]);
   a=2*(xt*fP[2] - yt*TMath::Sqrt(1.- fP[2]*fP[2]))-rp4*(xt*xt + yt*yt);
-  if (rp4<0) a=-a;
-  return a/(1 + TMath::Sqrt(sn*sn + cs*cs));
+  return  -a/(1 + TMath::Sqrt(sn*sn + cs*cs));
+}
+
+//_______________________________________________________________________
+void AliExternalTrackParam::
+GetDZ(Double_t x, Double_t y, Double_t z, Double_t b, Float_t dz[2]) const {
+  //------------------------------------------------------------------
+  // This function calculates the transverse and longitudinal impact parameters
+  // with respect to a point with global coordinates (x,y)
+  // in the magnetic field "b" (kG)
+  //------------------------------------------------------------------
+  Double_t f1 = fP[2], r1 = TMath::Sqrt(1. - f1*f1);
+  Double_t xt=fX, yt=fP[0];
+  Double_t sn=TMath::Sin(fAlpha), cs=TMath::Cos(fAlpha);
+  Double_t a = x*cs + y*sn;
+  y = -x*sn + y*cs; x=a;
+  xt-=x; yt-=y;
+
+  Double_t rp4=GetC(b);
+  if ((TMath::Abs(b) < kAlmost0Field) || (TMath::Abs(rp4) < kAlmost0)) {
+     dz[0] = -(xt*f1 - yt*r1);
+     dz[1] = fP[1] + (dz[0]*f1 - xt)/r1*fP[3] - z;
+     return;
+  }
+
+  sn=rp4*xt - f1; cs=rp4*yt + r1;
+  a=2*(xt*f1 - yt*r1)-rp4*(xt*xt + yt*yt);
+  Double_t rr=TMath::Sqrt(sn*sn + cs*cs);
+  dz[0] = -a/(1 + rr);
+  Double_t f2 = -sn/rr, r2 = TMath::Sqrt(1. - f2*f2);
+  dz[1] = fP[1] + fP[3]/rp4*TMath::ASin(f2*r1 - f1*r2) - z;
 }
 
 //_______________________________________________________________________
@@ -138,11 +175,11 @@ Double_t AliExternalTrackParam::GetLinearD(Double_t xv,Double_t yv) const {
 
   Double_t d = (fX-x)*fP[2] - (fP[0]-y)*TMath::Sqrt(1.- fP[2]*fP[2]);
 
-  return d;
+  return -d;
 }
 
-Bool_t AliExternalTrackParam::
-CorrectForMaterial(Double_t d,  Double_t x0, Double_t mass) {
+Bool_t AliExternalTrackParam::CorrectForMaterial
+(Double_t d,  Double_t x0, Double_t mass, Double_t (*Bethe)(Double_t)) {
   //------------------------------------------------------------------
   // This function corrects the track parameters for the crossed material
   // "d"    - the thickness (fraction of the radiation length)
@@ -158,7 +195,8 @@ CorrectForMaterial(Double_t d,  Double_t x0, Double_t mass) {
   Double_t &fC43=fC[13];
   Double_t &fC44=fC[14];
 
-  Double_t p2=(1.+ fP3*fP3)/(fP4*fP4);
+  Double_t p=GetP();
+  Double_t p2=p*p;
   Double_t beta2=p2/(p2 + mass*mass);
   d*=TMath::Sqrt((1.+ fP3*fP3)/(1.- fP2*fP2));
 
@@ -173,23 +211,45 @@ CorrectForMaterial(Double_t d,  Double_t x0, Double_t mass) {
   }
 
   //Energy losses************************
-  if (x0!=0.) {
+  if (x0!=0. && beta2<1) {
      d*=x0;
-     Double_t dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2)) - beta2)*d;
-     if (beta2/(1-beta2)>3.5*3.5)
-       dE=0.153e-3/beta2*(log(3.5*5940)+0.5*log(beta2/(1-beta2)) - beta2)*d;
-
-     fP4*=(1.- TMath::Sqrt(p2 + mass*mass)/p2*dE);
+     Double_t dE=Bethe(beta2)*d;
+     Double_t e=TMath::Sqrt(p2 + mass*mass);
+     if ( TMath::Abs(dE) > 0.3*e ) return kFALSE; //30% energy loss is too much!
+     fP4*=(1.- e/p2*dE);
+
+     // Approximate energy loss fluctuation (M.Ivanov)
+     const Double_t cnst=0.07; // To be tuned.  
+     Double_t sigmadE=cnst*TMath::Sqrt(TMath::Abs(dE)); 
+     fC44+=((sigmadE*e/p2*fP4)*(sigmadE*e/p2*fP4)); 
   }
 
   return kTRUE;
 }
 
+Double_t ApproximateBetheBloch(Double_t beta2) {
+  //------------------------------------------------------------------
+  // This is an approximation of the Bethe-Bloch formula with 
+  // the density effect taken into account at beta*gamma > 3.5
+  // (the approximation is reasonable only for solid materials) 
+  //------------------------------------------------------------------
+  if (beta2/(1-beta2)>3.5*3.5)
+     return 0.153e-3/beta2*(log(3.5*5940)+0.5*log(beta2/(1-beta2)) - beta2);
+
+  return 0.153e-3/beta2*(log(5940*beta2/(1-beta2)) - beta2);
+}
+
 Bool_t AliExternalTrackParam::Rotate(Double_t alpha) {
   //------------------------------------------------------------------
   // Transform this track to the local coord. system rotated
   // by angle "alpha" (rad) with respect to the global coord. system. 
   //------------------------------------------------------------------
+  if (TMath::Abs(fP[2]) >= kAlmost1) {
+     AliError(Form("Precondition is not satisfied: |sin(phi)|>1 ! %f",fP[2])); 
+     return kFALSE;
+  }
   if      (alpha < -TMath::Pi()) alpha += 2*TMath::Pi();
   else if (alpha >= TMath::Pi()) alpha -= 2*TMath::Pi();
 
@@ -209,10 +269,18 @@ Bool_t AliExternalTrackParam::Rotate(Double_t alpha) {
   Double_t ca=TMath::Cos(alpha-fAlpha), sa=TMath::Sin(alpha-fAlpha);
   Double_t sf=fP2, cf=TMath::Sqrt(1.- fP2*fP2);
 
+  Double_t tmp=sf*ca - cf*sa;
+  if (TMath::Abs(tmp) >= kAlmost1) return kFALSE;
+
   fAlpha = alpha;
   fX =  x*ca + fP0*sa;
   fP0= -x*sa + fP0*ca;
-  fP2=  sf*ca - cf*sa;
+  fP2=  tmp;
+
+  if (TMath::Abs(cf)<kAlmost0) {
+    AliError(Form("Too small cosine value %f",cf)); 
+    cf = kAlmost0;
+  } 
 
   Double_t rr=(ca+sf/cf*sa);  
 
@@ -234,9 +302,9 @@ Bool_t AliExternalTrackParam::PropagateTo(Double_t xk, Double_t b) {
   // Propagate this track to the plane X=xk (cm) in the field "b" (kG)
   //----------------------------------------------------------------
   Double_t dx=xk-fX;
-  if (TMath::Abs(dx)<=0)  return kTRUE;
+  if (TMath::Abs(dx)<=kAlmost0)  return kTRUE;
 
-  Double_t crv=kB2C*b*fP[4];
+  Double_t crv=GetC(b);
   if (TMath::Abs(b) < kAlmost0Field) crv=0.;
 
   Double_t f1=fP[2], f2=f1 + crv*dx;
@@ -301,6 +369,76 @@ Bool_t AliExternalTrackParam::PropagateTo(Double_t xk, Double_t b) {
   return kTRUE;
 }
 
+void AliExternalTrackParam::Propagate(Double_t len, Double_t x[3],
+Double_t p[3], Double_t bz) const {
+  //+++++++++++++++++++++++++++++++++++++++++    
+  // Origin: K. Shileev (Kirill.Shileev@cern.ch)
+  // Extrapolate track along simple helix in magnetic field
+  // Arguments: len -distance alogn helix, [cm]
+  //            bz  - mag field, [kGaus]   
+  // Returns: x and p contain extrapolated positon and momentum  
+  // The momentum returned for straight-line tracks is meaningless !
+  //+++++++++++++++++++++++++++++++++++++++++    
+  GetXYZ(x);
+    
+  if (TMath::Abs(Get1Pt()) < kAlmost0 || TMath::Abs(bz) < kAlmost0Field ){ //straight-line tracks
+     Double_t unit[3]; GetDirection(unit);
+     x[0]+=unit[0]*len;   
+     x[1]+=unit[1]*len;   
+     x[2]+=unit[2]*len;
+
+     p[0]=unit[0]/kAlmost0;   
+     p[1]=unit[1]/kAlmost0;   
+     p[2]=unit[2]/kAlmost0;   
+  } else {
+     GetPxPyPz(p);
+     Double_t pp=GetP();
+     Double_t a = -kB2C*bz*GetSign();
+     Double_t rho = a/pp;
+     x[0] += p[0]*TMath::Sin(rho*len)/a - p[1]*(1-TMath::Cos(rho*len))/a;
+     x[1] += p[1]*TMath::Sin(rho*len)/a + p[0]*(1-TMath::Cos(rho*len))/a;
+     x[2] += p[2]*len/pp;
+
+     Double_t p0=p[0];
+     p[0] = p0  *TMath::Cos(rho*len) - p[1]*TMath::Sin(rho*len);
+     p[1] = p[1]*TMath::Cos(rho*len) + p0  *TMath::Sin(rho*len);
+  }
+}
+
+Bool_t AliExternalTrackParam::Intersect(Double_t pnt[3], Double_t norm[3],
+Double_t bz) const {
+  //+++++++++++++++++++++++++++++++++++++++++    
+  // Origin: K. Shileev (Kirill.Shileev@cern.ch)
+  // Finds point of intersection (if exists) of the helix with the plane. 
+  // Stores result in fX and fP.   
+  // Arguments: planePoint,planeNorm - the plane defined by any plane's point 
+  // and vector, normal to the plane
+  // Returns: kTrue if helix intersects the plane, kFALSE otherwise.
+  //+++++++++++++++++++++++++++++++++++++++++    
+  Double_t x0[3]; GetXYZ(x0); //get track position in MARS
+  
+  //estimates initial helix length up to plane
+  Double_t s=
+    (pnt[0]-x0[0])*norm[0] + (pnt[1]-x0[1])*norm[1] + (pnt[2]-x0[2])*norm[2];
+  Double_t dist=99999,distPrev=dist;
+  Double_t x[3],p[3]; 
+  while(TMath::Abs(dist)>0.00001){
+    //calculates helix at the distance s from x0 ALONG the helix
+    Propagate(s,x,p,bz);
+
+    //distance between current helix position and plane
+    dist=(x[0]-pnt[0])*norm[0]+(x[1]-pnt[1])*norm[1]+(x[2]-pnt[2])*norm[2];
+
+    if(TMath::Abs(dist) >= TMath::Abs(distPrev)) {return kFALSE;}
+    distPrev=dist;
+    s-=dist;
+  }
+  //on exit pnt is intersection point,norm is track vector at that point, 
+  //all in MARS
+  for (Int_t i=0; i<3; i++) {pnt[i]=x[i]; norm[i]=p[i];}
+  return kTRUE;
+}
+
 Double_t 
 AliExternalTrackParam::GetPredictedChi2(Double_t p[2],Double_t cov[3]) const {
   //----------------------------------------------------------------
@@ -387,14 +525,14 @@ AliExternalTrackParam::GetHelixParameters(Double_t hlx[6], Double_t b) const {
   //--------------------------------------------------------------------
   Double_t cs=TMath::Cos(fAlpha), sn=TMath::Sin(fAlpha);
   
-  hlx[0]=fP[0]; hlx[1]=fP[1]; hlx[2]=fP[2]; hlx[3]=fP[3]; hlx[4]=fP[4];
+  hlx[0]=fP[0]; hlx[1]=fP[1]; hlx[2]=fP[2]; hlx[3]=fP[3];
 
   hlx[5]=fX*cs - hlx[0]*sn;               // x0
   hlx[0]=fX*sn + hlx[0]*cs;               // y0
 //hlx[1]=                                 // z0
   hlx[2]=TMath::ASin(hlx[2]) + fAlpha;    // phi0
 //hlx[3]=                                 // tgl
-  hlx[4]=hlx[4]*kB2C*b;                   // C
+  hlx[4]=GetC(b);                         // C
 }
 
 
@@ -595,7 +733,7 @@ Bool_t Local2GlobalMomentum(Double_t p[3],Double_t alpha) {
   //    p[2] = pz
   // Results for (nearly) straight tracks are meaningless !
   //----------------------------------------------------------------
-  if (TMath::Abs(p[0])<=0)        return kFALSE;
+  if (TMath::Abs(p[0])<=kAlmost0) return kFALSE;
   if (TMath::Abs(p[1])> kAlmost1) return kFALSE;
 
   Double_t pt=1./TMath::Abs(p[0]);
@@ -626,6 +764,20 @@ Bool_t Local2GlobalPosition(Double_t r[3],Double_t alpha) {
   return kTRUE;
 }
 
+void AliExternalTrackParam::GetDirection(Double_t d[3]) const {
+  //----------------------------------------------------------------
+  // This function returns a unit vector along the track direction
+  // in the global coordinate system.
+  //----------------------------------------------------------------
+  Double_t cs=TMath::Cos(fAlpha), sn=TMath::Sin(fAlpha);
+  Double_t snp=fP[2];
+  Double_t csp =TMath::Sqrt((1.- snp)*(1.+snp));
+  Double_t norm=TMath::Sqrt(1.+ fP[3]*fP[3]);
+  d[0]=(csp*cs - snp*sn)/norm; 
+  d[1]=(snp*cs + csp*sn)/norm; 
+  d[2]=fP[3]/norm;
+}
+
 Bool_t AliExternalTrackParam::GetPxPyPz(Double_t *p) const {
   //---------------------------------------------------------------------
   // This function returns the global track momentum components
@@ -656,7 +808,7 @@ Bool_t AliExternalTrackParam::GetCovarianceXYZPxPyPz(Double_t cv[21]) const {
   //
   // Results for (nearly) straight tracks are meaningless !
   //---------------------------------------------------------------------
-  if (TMath::Abs(fP[4])<=0) {
+  if (TMath::Abs(fP[4])<=kAlmost0) {
      for (Int_t i=0; i<21; i++) cv[i]=0.;
      return kFALSE;
   }
@@ -666,7 +818,7 @@ Bool_t AliExternalTrackParam::GetCovarianceXYZPxPyPz(Double_t cv[21]) const {
   }
   Double_t pt=1./TMath::Abs(fP[4]);
   Double_t cs=TMath::Cos(fAlpha), sn=TMath::Sin(fAlpha);
-  Double_t r=TMath::Sqrt(1-fP[2]*fP[2]);
+  Double_t r=TMath::Sqrt((1.-fP[2])*(1.+fP[2]));
 
   Double_t m00=-sn, m10=cs;
   Double_t m23=-pt*(sn + fP[2]*cs/r), m43=-pt*pt*(r*cs - fP[2]*sn);
@@ -706,11 +858,51 @@ AliExternalTrackParam::GetPxPyPzAt(Double_t x, Double_t b, Double_t *p) const {
   // the radial position "x" (cm) in the magnetic field "b" (kG)
   //---------------------------------------------------------------------
   p[0]=fP[4]; 
-  p[1]=fP[2]+(x-fX)*fP[4]*b*kB2C
+  p[1]=fP[2]+(x-fX)*GetC(b)
   p[2]=fP[3];
   return Local2GlobalMomentum(p,fAlpha);
 }
 
+Bool_t 
+AliExternalTrackParam::GetYAt(Double_t x, Double_t b, Double_t &y) const {
+  //---------------------------------------------------------------------
+  // This function returns the local Y-coordinate of the intersection 
+  // point between this track and the reference plane "x" (cm). 
+  // Magnetic field "b" (kG)
+  //---------------------------------------------------------------------
+  Double_t dx=x-fX;
+  if(TMath::Abs(dx)<=kAlmost0) {y=fP[0]; return kTRUE;}
+
+  Double_t f1=fP[2], f2=f1 + dx*GetC(b);
+
+  if (TMath::Abs(f1) >= kAlmost1) return kFALSE;
+  if (TMath::Abs(f2) >= kAlmost1) return kFALSE;
+  
+  Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2);
+  y = fP[0] + dx*(f1+f2)/(r1+r2);
+  return kTRUE;
+}
+
+Bool_t 
+AliExternalTrackParam::GetZAt(Double_t x, Double_t b, Double_t &z) const {
+  //---------------------------------------------------------------------
+  // This function returns the local Z-coordinate of the intersection 
+  // point between this track and the reference plane "x" (cm). 
+  // Magnetic field "b" (kG)
+  //---------------------------------------------------------------------
+  Double_t dx=x-fX;
+  if(TMath::Abs(dx)<=kAlmost0) {z=fP[1]; return kTRUE;}
+
+  Double_t f1=fP[2], f2=f1 + dx*fP[4]*b*kB2C;
+
+  if (TMath::Abs(f1) >= kAlmost1) return kFALSE;
+  if (TMath::Abs(f2) >= kAlmost1) return kFALSE;
+  
+  Double_t r1=sqrt(1.- f1*f1), r2=sqrt(1.- f2*f2);
+  z = fP[1] + dx*(r2 + f2*(f1+f2)/(r1+r2))*fP[3]; // Many thanks to P.Hristov !
+  return kTRUE;
+}
+
 Bool_t 
 AliExternalTrackParam::GetXYZAt(Double_t x, Double_t b, Double_t *r) const {
   //---------------------------------------------------------------------
@@ -718,8 +910,11 @@ AliExternalTrackParam::GetXYZAt(Double_t x, Double_t b, Double_t *r) const {
   // the radial position "x" (cm) in the magnetic field "b" (kG)
   //---------------------------------------------------------------------
   Double_t dx=x-fX;
-  Double_t f1=fP[2], f2=f1 + dx*fP[4]*b*kB2C;
+  if(TMath::Abs(dx)<=kAlmost0) return GetXYZ(r);
+
+  Double_t f1=fP[2], f2=f1 + dx*GetC(b);
 
+  if (TMath::Abs(f1) >= kAlmost1) return kFALSE;
   if (TMath::Abs(f2) >= kAlmost1) return kFALSE;
   
   Double_t r1=TMath::Sqrt(1.- f1*f1), r2=TMath::Sqrt(1.- f2*f2);
@@ -729,25 +924,6 @@ AliExternalTrackParam::GetXYZAt(Double_t x, Double_t b, Double_t *r) const {
   return Local2GlobalPosition(r,fAlpha);
 }
 
-
-//_____________________________________________________________________________
-void AliExternalTrackParam::ApproximateHelixWithLine(Double_t xk, Double_t b, AliStrLine *line)
-{
-  //------------------------------------------------------------
-  // Approximate the track (helix) with a straight line tangent to the
-  // helix in the point defined by r (F. Prino, prino@to.infn.it)
-  //------------------------------------------------------------
-  Double_t mom[3];
-  Double_t azim = TMath::ASin(fP[2])+fAlpha;
-  Double_t theta = TMath::Pi()/2. - TMath::ATan(fP[3]);
-  mom[0] = TMath::Sin(theta)*TMath::Cos(azim);
-  mom[1] = TMath::Sin(theta)*TMath::Sin(azim);
-  mom[2] = TMath::Cos(theta);
-  Double_t pos[3];
-  GetXYZAt(xk,b,pos);
-  line->SetP0(pos);
-  line->SetCd(mom);
-}
 //_____________________________________________________________________________
 void AliExternalTrackParam::Print(Option_t* /*option*/) const
 {
@@ -765,75 +941,13 @@ void AliExternalTrackParam::Print(Option_t* /*option*/) const
         fC[10], fC[11], fC[12], fC[13], fC[14]);
 }
 
-
-Bool_t AliExternalTrackParam::PropagateTo(Double_t xToGo, Double_t mass, Double_t maxStep, Bool_t rotateTo){
-  //----------------------------------------------------------------
-  // Propagate this track to the plane X=xk (cm) 
-  // correction for unhomogenity of the magnetic field and the
-  // the correction for the material is included
-  //
-  //  Require acces to magnetic field and geomanager
+Double_t AliExternalTrackParam::GetSnpAt(Double_t x,Double_t b) const {
   //
-  // mass     - mass used in propagation - used for energy loss correction
-  // maxStep  - maximal step for propagation
-  //----------------------------------------------------------------
-  const Double_t kEpsilon = 0.00001;
-  Double_t xpos     = GetX();
-  Double_t dir      = (xpos<xToGo) ? 1.:-1.;
+  // Get sinus at given x
   //
-  while ( (xToGo-xpos)*dir > kEpsilon){
-    Double_t step = dir*TMath::Min(TMath::Abs(xToGo-xpos), maxStep);
-    Double_t x    = xpos+step;
-    Double_t xyz0[3],xyz1[3],param[7];
-    GetXYZ(xyz0);   //starting global position
-    Float_t  pos0[3] = {xyz0[0],xyz0[1],xyz0[2]};
-    Double_t magZ = AliTracker::GetBz(pos0);
-    if (!GetXYZAt(x,magZ,xyz1)) return kFALSE;   // no prolongation
-    AliKalmanTrack::MeanMaterialBudget(xyz0,xyz1,param);       
-    if (!PropagateTo(x,magZ))  return kFALSE;
-    Double_t distance = param[4];
-    if (!CorrectForMaterial(distance,param[1],param[0],mass)) return kFALSE;
-    if (rotateTo){
-      GetXYZ(xyz0);   // global position
-      Double_t alphan = TMath::ATan2(xyz0[1], xyz0[0]);
-      if (!Rotate(alphan)) return kFALSE;
-    }
-    xpos = GetX();
-  }
-  return kTRUE;
-}
-
-//_____________________________________________________________________________
-Bool_t AliExternalTrackParam::CorrectForMaterial(Double_t d, Double_t x0, Double_t rho, Double_t mass)
-{
-  //
-  // Take into account material effects assuming:
-  // x0  - mean rad length
-  // rho - mean density
-
-  //
-  // multiple scattering
-  //
-  if (mass<=0) {
-    AliError("Non-positive mass");
-    return kFALSE;
-  }
-  Double_t p2=(1.+ fP[3]*fP[3])/(fP[4]*fP[4]);
-  Double_t beta2=p2/(p2 + mass*mass);
-  Double_t theta2=14.1*14.1/(beta2*p2*1e6)*d/x0*rho;
-  //
-  fC[5] += theta2*(1.- fP[2]*fP[2])*(1. + fP[3]*fP[3]);
-  fC[9] += theta2*(1. + fP[3]*fP[3])*(1. + fP[3]*fP[3]);
-  fC[13] += theta2*fP[3]*fP[4]*(1. + fP[3]*fP[3]);
-  fC[14] += theta2*fP[3]*fP[4]*fP[3]*fP[4];
-  //
-  Double_t dE=0.153e-3/beta2*(log(5940*beta2/(1-beta2+1e-10)) - beta2)*d*rho;  
-  fP[4] *=(1.- TMath::Sqrt(p2+mass*mass)/p2*dE);
-  //
-  Double_t sigmade = 0.02*TMath::Sqrt(TMath::Abs(dE));   // energy loss fluctuation 
-  Double_t sigmac2 = sigmade*sigmade*fP[4]*fP[4]*(p2+mass*mass)/(p2*p2);
-  fC[14] += sigmac2;
-  return kTRUE;
+  Double_t crv=GetC(b);
+  if (TMath::Abs(b) < kAlmost0Field) crv=0.;
+  Double_t dx = x-fX;
+  Double_t res = fP[2]+dx*crv;
+  return res;
 }
-
-