test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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 
24  typedef double Scalar;
28 
30 
31  CurvilinearState( const Vector& v, Scalar z, Scalar pzsign) :
32  par_(v), z_(z), pzSign_(pzsign) {}
33 
34  CurvilinearState( const Vector3D& pos, const Vector3D& p, Scalar ch) :
35  par_(Vector2D(pos.x(),pos.y()), Vector3D( p.x()/p.z(), p.y()/p.z(), ch/p.mag())),
36  z_(pos.z()), pzSign_(p.z()>0. ? 1.:-1.) {}
37 
38  const Vector3D position() const {
39  return Vector3D(par_.first().x(),par_.first().y(),z_);
40  }
41 
42  const Vector3D momentum() const {
43  Scalar p = 1./fabs(par_.second().z());
44  if ( p>1.e9 ) p = 1.e9;
45  Scalar dxdz = par_.second().x();
46  Scalar dydz = par_.second().y();
47  Scalar dz = pzSign_/sqrt(1. + dxdz*dxdz + dydz*dydz);
48  Scalar dx = dz*dxdz;
49  Scalar dy = dz*dydz;
50  return Vector3D(dx*p, dy*p, dz*p);
51  }
52 
53  const Vector& parameters() const { return par_;}
54 
55  Scalar charge() const { return par_.second().z()>0 ? 1 : -1;}
56 
57  Scalar z() const {return z_;}
58 
59  double pzSign() const {return pzSign_;}
60 
61 private:
62 
66 
67 };
68 
69 inline CurvilinearState
71  return CurvilinearState(a.parameters()+b.parameters(), a.z()+b.z(), a.pzSign());
72 }
73 
74 inline CurvilinearState
76  return CurvilinearState(a.parameters()-b.parameters(), a.z()-b.z(), a.pzSign());
77 }
78 
80  const CurvilinearState::Scalar& s) {
81  return CurvilinearState( v.parameters()*s, v.z()*s, v.pzSign());
82 }
84  const CurvilinearState& v) {
85  return CurvilinearState( v.parameters()*s, v.z()*s, v.pzSign());
86 }
87 
89  const CurvilinearState::Scalar& s) {
90  return CurvilinearState( v.parameters()/s, v.z()/s, v.pzSign());
91 }
92 
93 
94 #endif
Scalar charge() const
Basic2DVector< Scalar > Vector2D
double pzSign() const
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)
Basic3DVector< long double > operator/(const Basic3DVector< long double > &v, S s)
Scalar z() const
CurvilinearState(const Vector &v, Scalar z, Scalar pzsign)
T sqrt(T t)
Definition: SSEVec.h:18
VectorDoublet< Vector2D, Vector3D > Vector
Basic3DVector< Scalar > Vector3D
const Vector3D momentum() const
double b
Definition: hdecay.h:120
const Vector & parameters() const
const Vector3D position() const
#define dso_internal
double a
Definition: hdecay.h:121
MatrixMeschach operator*(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
CurvilinearState(const Vector3D &pos, const Vector3D &p, Scalar ch)
Scalar pzSign_
sign of local pz