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 
21 public:
22 
23  typedef double Scalar;
27 
29 
30  CurvilinearState( const Vector& v, Scalar z, Scalar pzsign) :
31  par_(v), z_(z), pzSign_(pzsign) {}
32 
33  CurvilinearState( const Vector3D& pos, const Vector3D& p, Scalar ch) :
34  par_(Vector2D(pos.x(),pos.y()), Vector3D( p.x()/p.z(), p.y()/p.z(), ch/p.mag())),
35  z_(pos.z()), pzSign_(p.z()>0. ? 1.:-1.) {}
36 
37  const Vector3D position() const {
38  return Vector3D(par_.first().x(),par_.first().y(),z_);
39  }
40 
41  const Vector3D momentum() const {
42  Scalar p = 1./fabs(par_.second().z());
43  if ( p>1.e9 ) p = 1.e9;
44  Scalar dxdz = par_.second().x();
45  Scalar dydz = par_.second().y();
46  Scalar dz = pzSign_/sqrt(1. + dxdz*dxdz + dydz*dydz);
47  Scalar dx = dz*dxdz;
48  Scalar dy = dz*dydz;
49  return Vector3D(dx*p, dy*p, dz*p);
50  }
51 
52  const Vector& parameters() const { return par_;}
53 
54  Scalar charge() const { return par_.second().z()>0 ? 1 : -1;}
55 
56  Scalar z() const {return z_;}
57 
58  double pzSign() const {return pzSign_;}
59 
60 private:
61 
65 
66 };
67 
68 inline CurvilinearState
70  return CurvilinearState(a.parameters()+b.parameters(), a.z()+b.z(), a.pzSign());
71 }
72 
73 inline CurvilinearState
75  return CurvilinearState(a.parameters()-b.parameters(), a.z()-b.z(), a.pzSign());
76 }
77 
79  const CurvilinearState::Scalar& s) {
80  return CurvilinearState( v.parameters()*s, v.z()*s, v.pzSign());
81 }
83  const CurvilinearState& v) {
84  return CurvilinearState( v.parameters()*s, v.z()*s, v.pzSign());
85 }
86 
88  const CurvilinearState::Scalar& s) {
89  return CurvilinearState( v.parameters()/s, v.z()/s, v.pzSign());
90 }
91 
92 
93 #endif
Scalar charge() const
Basic2DVector< Scalar > Vector2D
T y() const
Cartesian y coordinate.
double pzSign() const
T x() const
Cartesian x coordinate.
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)
const V1 & first() const
Definition: VectorDoublet.h:16
Basic3DVector< long double > operator/(const Basic3DVector< long double > &v, S s)
Scalar z() const
CurvilinearState(const Vector &v, Scalar z, Scalar pzsign)
T z() const
Cartesian z coordinate.
T sqrt(T t)
Definition: SSEVec.h:28
VectorDoublet< Vector2D, Vector3D > Vector
Basic3DVector< Scalar > Vector3D
const Vector3D momentum() const
T y() const
Cartesian y coordinate.
const V2 & second() const
Definition: VectorDoublet.h:17
double b
Definition: hdecay.h:120
const Vector & parameters() const
const Vector3D position() const
double a
Definition: hdecay.h:121
MatrixMeschach operator*(const MatrixMeschach &mat1, const MatrixMeschach &mat2)
string s
Definition: asciidump.py:422
Definition: DDAxes.h:10
CurvilinearState(const Vector3D &pos, const Vector3D &p, Scalar ch)
mathSSE::Vec4< T > v
T x() const
Cartesian x coordinate.
Scalar pzSign_
sign of local pz