CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
32  CurvilinearState(const Vector3D& pos, const Vector3D& p, Scalar ch)
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
Scalar charge() const
float dydz
VectorDoublet< Vector2D, Vector3D > Vector
Basic2DVector< Scalar > Vector2D
double pzSign() const
float dxdz
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
MatrixMeschach operator+(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
MatrixMeschach operator-(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
Scalar z() const
CurvilinearState(const Vector &v, Scalar z, Scalar pzsign)
T sqrt(T t)
Definition: SSEVec.h:19
#define dso_internal
Definition: Visibility.h:13
Basic3DVector< Scalar > Vector3D
const Vector3D momentum() const
T1 operator/(const Phi< T1, Range > &a, const Phi< T1, Range > &b)
Division.
Definition: Phi.h:176
double b
Definition: hdecay.h:118
const Vector & parameters() const
const Vector3D position() const
double a
Definition: hdecay.h:119
MatrixMeschach operator*(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
CurvilinearState(const Vector3D &pos, const Vector3D &p, Scalar ch)
Scalar pzSign_
sign of local pz