CMS 3D CMS Logo

CurvilinearState.h
Go to the documentation of this file.
1 #ifndef CurvilinearState_H
2 #define CurvilinearState_H
3 
7 #include "VectorDoublet.h"
8 
22 public:
23  typedef double Scalar;
27 
29 
30  CurvilinearState(const Vector& v, Scalar z, Scalar pzsign) : par_(v), z_(z), pzSign_(pzsign) {}
31 
33  : par_(Vector2D(pos.x(), pos.y()), Vector3D(p.x() / p.z(), p.y() / p.z(), ch / p.mag())),
34  z_(pos.z()),
35  pzSign_(p.z() > 0. ? 1. : -1.) {}
36 
37  const Vector3D position() const { return Vector3D(par_.first().x(), par_.first().y(), z_); }
38 
39  const Vector3D momentum() const {
40  Scalar p = 1. / fabs(par_.second().z());
41  if (p > 1.e9)
42  p = 1.e9;
43  Scalar dxdz = par_.second().x();
44  Scalar dydz = par_.second().y();
45  Scalar dz = pzSign_ / sqrt(1. + dxdz * dxdz + dydz * dydz);
46  Scalar dx = dz * dxdz;
47  Scalar dy = dz * dydz;
48  return Vector3D(dx * p, dy * p, dz * p);
49  }
50 
51  const Vector& parameters() const { return par_; }
52 
53  Scalar charge() const { return par_.second().z() > 0 ? 1 : -1; }
54 
55  Scalar z() const { return z_; }
56 
57  double pzSign() const { return pzSign_; }
58 
59 private:
63 };
64 
66  return CurvilinearState(a.parameters() + b.parameters(), a.z() + b.z(), a.pzSign());
67 }
68 
70  return CurvilinearState(a.parameters() - b.parameters(), a.z() - b.z(), a.pzSign());
71 }
72 
74  return CurvilinearState(v.parameters() * s, v.z() * s, v.pzSign());
75 }
77  return CurvilinearState(v.parameters() * s, v.z() * s, v.pzSign());
78 }
79 
81  return CurvilinearState(v.parameters() / s, v.z() / s, v.pzSign());
82 }
83 
84 #endif
const Vector & parameters() const
double pzSign() const
float dydz
VectorDoublet< Vector2D, Vector3D > Vector
const Vector3D position() const
Basic2DVector< Scalar > Vector2D
float dxdz
Scalar z() const
CurvilinearState operator*(const CurvilinearState &v, const CurvilinearState::Scalar &s)
CurvilinearState operator-(const CurvilinearState &a, const CurvilinearState &b)
CurvilinearState(const Vector &v, Scalar z, Scalar pzsign)
T sqrt(T t)
Definition: SSEVec.h:19
const Vector3D momentum() const
#define dso_internal
Definition: Visibility.h:13
Basic3DVector< Scalar > Vector3D
CurvilinearState operator/(const CurvilinearState &v, const CurvilinearState::Scalar &s)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119
Scalar charge() const
CurvilinearState(const Vector3D &pos, const Vector3D &p, Scalar ch)
Scalar pzSign_
sign of local pz
CurvilinearState operator+(const CurvilinearState &a, const CurvilinearState &b)