CMS 3D CMS Logo

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