CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CylindricalState.h
Go to the documentation of this file.
1 #ifndef CylindricalState_H
2 #define CylindricalState_H
3 
5 
6 #include <iostream>
7 
21 public:
22 
23  typedef double Scalar;
25 
27 
28  CylindricalState( const LocalPoint& pos, const LocalVector& mom, Scalar ch) {
29  rho_ = pos.perp();
30  Scalar cosphi = pos.x() / rho_;
31  Scalar sinphi = pos.y() / rho_;
32  Scalar p_rho = mom.x() * cosphi + mom.y() * sinphi;
33  Scalar p_phi = -mom.x() * sinphi + mom.y() * cosphi;
34 
35  par_(0) = pos.phi();
36  par_(1) = pos.z();
37  par_(2) = p_phi / (p_rho * rho_);
38  par_(3) = mom.z() / p_rho;
39  par_(4) = ch / mom.mag();
40 
41  prSign_ = p_rho > 0 ? 1.0 : -1.0;
42 
43  std::cout << "CylindricalState built from pos " << pos << " mom " << mom << " charge " << ch << std::endl;
44  std::cout << "p_rho " << p_rho << " p_phi " << p_phi << " dphi_drho " << par_(2) << std::endl;
45  std::cout << "Which results in " << position() << " mom " << momentum()
46  << " charge " << charge() << std::endl;
47  }
48 
50  par_(par), rho_(rho), prSign_(prSign) {}
51 
52 
53  const LocalPoint position() const {
54  return LocalPoint( LocalPoint::Cylindrical( rho_, par_(0), par_(1)));
55  }
56 
57  const LocalVector momentum() const {
58  Scalar cosphi = cos( par_(0));
59  Scalar sinphi = sin( par_(0));
60  Scalar Q = sqrt(1 + rho_*rho_ * par_(2)*par_(2) + par_(3)*par_(3));
61  Scalar P = std::abs(1./par_(4));
62  Scalar p_rho = prSign_*P/Q;
63  Scalar p_phi = rho_*par_(2)*p_rho;
64  Scalar p_z = par_(3)*p_rho;
65  LocalVector result( p_rho*cosphi - p_phi*sinphi,
66  p_rho*sinphi + p_phi*cosphi,
67  p_z);
68  return result;
69  }
70 
71  const Vector& parameters() const { return par_;}
72 
73  Scalar charge() const { return par_(4) > 0 ? 1 : -1;}
74 
75  Scalar rho() const {return rho_;}
76 
77  double prSign() const {return prSign_;}
78 
79 private:
80 
84 
85 };
86 
87 #endif
const LocalPoint position() const
T perp() const
Definition: PV3DBase.h:66
const Vector & parameters() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:63
T y() const
Definition: PV3DBase.h:57
#define abs(x)
Definition: mlp_lapack.h:159
#define P
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:61
T sqrt(T t)
Definition: SSEVec.h:28
CylindricalState(const LocalPoint &pos, const LocalVector &mom, Scalar ch)
T z() const
Definition: PV3DBase.h:58
tuple result
Definition: query.py:137
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Scalar rho() const
Scalar charge() const
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
const LocalVector momentum() const
tuple cout
Definition: gather_cfg.py:41
double prSign() const
T x() const
Definition: PV3DBase.h:56
const double par[8 *NPar][4]