CMS 3D CMS Logo

RKCurvilinearDistance.h
Go to the documentation of this file.
1 #ifndef RKCurvilinearDistance_H
2 #define RKCurvilinearDistance_H
3 
5 #include "RKDistance.h"
6 #include "RKSmallVector.h"
7 
8 template <typename T, int N>
10 public:
11 
12  typedef T Scalar;
14 
15  ~RKCurvilinearDistance() override {}
16 
17  Scalar operator()( const Vector& a, const Vector& b, const Scalar& s) const override {
18  Basic3DVector<Scalar> amom = momentum(a);
19  Basic3DVector<Scalar> bmom = momentum(b);
20 
21  return sqrt( sqr(a(0)-b(0)) + sqr(a(1)-b(1))) + (amom - bmom).mag() / bmom.mag();
22  }
23 
24  Basic3DVector<Scalar> momentum( const Vector& v) const {
25  Scalar k = sqrt(1 + sqr(v(2)) + sqr(v(3)));
26  Scalar p = std::abs(1 / v(4));
27  Scalar pz = p/k;
28  return Basic3DVector<Scalar>( v(2)*pz, v(3)*pz, pz);
29  }
30 
31  T sqr(const T& t) const {return t*t;}
32 
33 };
34 
35 #endif
Basic3DVector< Scalar > momentum(const Vector &v) const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
ROOT::Math::SVector< T, N > RKSmallVector
Definition: RKSmallVector.h:13
T sqrt(T t)
Definition: SSEVec.h:18
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int k[5][pyjets_maxn]
Scalar operator()(const Vector &a, const Vector &b, const Scalar &s) const override
T sqr(const T &t) const
double b
Definition: hdecay.h:120
#define dso_internal
double a
Definition: hdecay.h:121
Square< F >::type sqr(const F &f)
Definition: Square.h:13
RKSmallVector< T, N > Vector
long double T