CMS 3D CMS Logo

CylindricalState.h
Go to the documentation of this file.
1 #ifndef CylindricalState_H
2 #define CylindricalState_H
3 
7 #include "RKSmallVector.h"
8 
9 #include <iostream>
10 
24 public:
25 
26  typedef double Scalar;
28 
30 
31  CylindricalState( const LocalPoint& pos, const LocalVector& mom, Scalar ch) {
32  rho_ = pos.perp();
33  Scalar cosphi = pos.x() / rho_;
34  Scalar sinphi = pos.y() / rho_;
35  Scalar p_rho = mom.x() * cosphi + mom.y() * sinphi;
36  Scalar p_phi = -mom.x() * sinphi + mom.y() * cosphi;
37 
38  par_(0) = pos.phi();
39  par_(1) = pos.z();
40  par_(2) = p_phi / (p_rho * rho_);
41  par_(3) = mom.z() / p_rho;
42  par_(4) = ch / mom.mag();
43 
44  prSign_ = p_rho > 0 ? 1.0 : -1.0;
45 
46  std::cout << "CylindricalState built from pos " << pos << " mom " << mom << " charge " << ch << std::endl;
47  std::cout << "p_rho " << p_rho << " p_phi " << p_phi << " dphi_drho " << par_(2) << std::endl;
48  std::cout << "Which results in " << position() << " mom " << momentum()
49  << " charge " << charge() << std::endl;
50  }
51 
52  CylindricalState( Scalar rho, const Vector& par, Scalar prSign) :
53  par_(par), rho_(rho), prSign_(prSign) {}
54 
55 
56  const LocalPoint position() const {
57  return LocalPoint( LocalPoint::Cylindrical( rho_, par_(0), par_(1)));
58  }
59 
60  const LocalVector momentum() const {
61  Scalar cosphi = cos( par_(0));
62  Scalar sinphi = sin( par_(0));
63  Scalar Q = sqrt(1 + rho_*rho_ * par_(2)*par_(2) + par_(3)*par_(3));
64  Scalar P = std::abs(1./par_(4));
65  Scalar p_rho = prSign_*P/Q;
66  Scalar p_phi = rho_*par_(2)*p_rho;
67  Scalar p_z = par_(3)*p_rho;
68  LocalVector result( p_rho*cosphi - p_phi*sinphi,
69  p_rho*sinphi + p_phi*cosphi,
70  p_z);
71  return result;
72  }
73 
74  const Vector& parameters() const { return par_;}
75 
76  Scalar charge() const { return par_(4) > 0 ? 1 : -1;}
77 
78  Scalar rho() const {return rho_;}
79 
80  double prSign() const {return prSign_;}
81 
82 private:
83 
84  Vector par_;
85  Scalar rho_;
86  Scalar prSign_;
87 
88 };
89 
90 #endif
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:32
const LocalPoint position() const
T perp() const
Definition: PV3DBase.h:72
const Vector & parameters() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T y() const
Definition: PV3DBase.h:63
ROOT::Math::SVector< T, N > RKSmallVector
Definition: RKSmallVector.h:13
CylindricalState(Scalar rho, const Vector &par, Scalar prSign)
Scalar prSign_
sign of local p_r
RKSmallVector< Scalar, 5 > Vector
T mag() const
Definition: PV3DBase.h:67
T sqrt(T t)
Definition: SSEVec.h:18
CylindricalState(const LocalPoint &pos, const LocalVector &mom, Scalar ch)
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define dso_internal
Definition: Visibility.h:13
std::pair< OmniClusterRef, TrackingParticleRef > P
Scalar rho() const
static int position[264][3]
Definition: ReadPGInfo.cc:509
Scalar charge() const
const LocalVector momentum() const
double prSign() const
T x() const
Definition: PV3DBase.h:62