]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliExternalTrackParam.cxx
PropagateToDCA in case of track and vertex (M.Ivanov)
[u/mrichter/AliRoot.git] / STEER / AliExternalTrackParam.cxx
index fe5be899138b56011d6f84013a80172a0e1b647c..d7f6b5685586cf3c7cf5a96db54f49f3d2c9ee03 100644 (file)
@@ -29,6 +29,7 @@
 #include "AliKalmanTrack.h"
 #include "AliTracker.h"
 #include "AliStrLine.h"
+#include "AliESDVertex.h"
 
 
 ClassImp(AliExternalTrackParam)
@@ -528,6 +529,44 @@ PropagateToDCA(AliExternalTrackParam *p, Double_t b) {
 
 
 
+
+Bool_t AliExternalTrackParam::PropagateToDCA(const AliESDVertex *vtx, Double_t b, Double_t maxd){
+  //
+  // Try to relate this track to the vertex "vtx", 
+  // if the (rough) transverse impact parameter is not bigger then "maxd". 
+  //            Magnetic field is "b" (kG).
+  //
+  // a) The track gets extapolated to the DCA to the vertex.
+  // b) The impact parameters and their covariance matrix are calculated.
+  //
+  //    In the case of success, the returned value is kTRUE
+  //    (otherwise, it's kFALSE)
+  //  
+  Double_t alpha=GetAlpha();
+  Double_t sn=TMath::Sin(alpha), cs=TMath::Cos(alpha);
+  Double_t x=GetX(), y=GetParameter()[0], snp=GetParameter()[2];
+  Double_t xv= vtx->GetXv()*cs + vtx->GetYv()*sn;
+  Double_t yv=-vtx->GetXv()*sn + vtx->GetYv()*cs, zv=vtx->GetZv();
+  x-=xv; y-=yv;
+
+  //Estimate the impact parameter neglecting the track curvature
+  Double_t d=TMath::Abs(x*snp - y*TMath::Sqrt(1.- snp*snp));
+  if (d > maxd) return kFALSE; 
+
+  //Propagate to the DCA
+  Double_t crv=0.299792458e-3*b*GetParameter()[4];
+  Double_t tgfv=-(crv*x - snp)/(crv*y + TMath::Sqrt(1.-snp*snp));
+  sn=tgfv/TMath::Sqrt(1.+ tgfv*tgfv); cs=TMath::Sqrt(1.- sn*sn);
+
+  x = xv*cs + yv*sn;
+  yv=-xv*sn + yv*cs; xv=x;
+
+  if (!Propagate(alpha+TMath::ASin(sn),xv,b)) return kFALSE;
+}
+
+
+
+
 Bool_t Local2GlobalMomentum(Double_t p[3],Double_t alpha) {
   //----------------------------------------------------------------
   // This function performs local->global transformation of the