CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/TrackPropagation/RungeKutta/interface/RKCurvilinearDistance.h

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