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  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 
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 #endif
Basic3DVector< Scalar > momentum(const Vector &v) const
Scalar operator()(const Vector &a, const Vector &b, const Scalar &s) const override
ROOT::Math::SVector< T, N > RKSmallVector
Definition: RKSmallVector.h:13
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
int sqr(const T &t)
T sqrt(T t)
Definition: SSEVec.h:19
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define dso_internal
Definition: Visibility.h:13
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
double b
Definition: hdecay.h:118
RKSmallVector< T, N > Vector
double a
Definition: hdecay.h:119
long double T
T sqr(const T &t) const