CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/TrackPropagation/RungeKutta/src/RKCurvilinearDistance.h

Go to the documentation of this file.
00001 #ifndef RKCurvilinearDistance_H
00002 #define RKCurvilinearDistance_H
00003 
00004 #include "FWCore/Utilities/interface/Visibility.h"
00005 #include "RKDistance.h"
00006 #include "RKSmallVector.h"
00007 
00008 template <typename T, int N>
00009 class dso_internal RKCurvilinearDistance : public RKDistance<T,N> {
00010 public:
00011  
00012   typedef T                                   Scalar;
00013   typedef RKSmallVector<T,N>                  Vector;
00014 
00015   virtual ~RKCurvilinearDistance() {}
00016 
00017   virtual Scalar operator()( const Vector& a, const Vector& b, const Scalar& s) const {
00018       Basic3DVector<Scalar> amom = momentum(a);
00019       Basic3DVector<Scalar> bmom = momentum(b);
00020 
00021     return sqrt( sqr(a(0)-b(0)) + sqr(a(1)-b(1))) + (amom - bmom).mag() / bmom.mag();
00022   }
00023 
00024   Basic3DVector<Scalar> momentum( const Vector& v) const {
00025       Scalar k = sqrt(1 + sqr(v(2)) + sqr(v(3)));
00026       Scalar p = std::abs(1 / v(4));
00027       Scalar pz = p/k;
00028       return Basic3DVector<Scalar>( v(2)*pz, v(3)*pz, pz);
00029   }
00030 
00031   T sqr(const T& t) const {return t*t;}
00032  
00033 };
00034 
00035 #endif