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 #include "RKSmallVector.h"
6 
7 #include <iostream>
8 
22 public:
23 
24  typedef double Scalar;
26 
28 
29  CylindricalState( const LocalPoint& pos, const LocalVector& mom, Scalar ch) {
30  rho_ = pos.perp();
31  Scalar cosphi = pos.x() / rho_;
32  Scalar sinphi = pos.y() / rho_;
33  Scalar p_rho = mom.x() * cosphi + mom.y() * sinphi;
34  Scalar p_phi = -mom.x() * sinphi + mom.y() * cosphi;
35 
36  par_(0) = pos.phi();
37  par_(1) = pos.z();
38  par_(2) = p_phi / (p_rho * rho_);
39  par_(3) = mom.z() / p_rho;
40  par_(4) = ch / mom.mag();
41 
42  prSign_ = p_rho > 0 ? 1.0 : -1.0;
43 
44  std::cout << "CylindricalState built from pos " << pos << " mom " << mom << " charge " << ch << std::endl;
45  std::cout << "p_rho " << p_rho << " p_phi " << p_phi << " dphi_drho " << par_(2) << std::endl;
46  std::cout << "Which results in " << position() << " mom " << momentum()
47  << " charge " << charge() << std::endl;
48  }
49 
50  CylindricalState( Scalar rho, const Vector& par, Scalar prSign) :
51  par_(par), rho_(rho), prSign_(prSign) {}
52 
53 
54  const LocalPoint position() const {
55  return LocalPoint( LocalPoint::Cylindrical( rho_, par_(0), par_(1)));
56  }
57 
58  const LocalVector momentum() const {
59  Scalar cosphi = cos( par_(0));
60  Scalar sinphi = sin( par_(0));
61  Scalar Q = sqrt(1 + rho_*rho_ * par_(2)*par_(2) + par_(3)*par_(3));
62  Scalar P = std::abs(1./par_(4));
63  Scalar p_rho = prSign_*P/Q;
64  Scalar p_phi = rho_*par_(2)*p_rho;
65  Scalar p_z = par_(3)*p_rho;
66  LocalVector result( p_rho*cosphi - p_phi*sinphi,
67  p_rho*sinphi + p_phi*cosphi,
68  p_z);
69  return result;
70  }
71 
72  const Vector& parameters() const { return par_;}
73 
74  Scalar charge() const { return par_(4) > 0 ? 1 : -1;}
75 
76  Scalar rho() const {return rho_;}
77 
78  double prSign() const {return prSign_;}
79 
80 private:
81 
85 
86 };
87 
88 #endif
const LocalPoint position() const
T perp() const
Definition: PV3DBase.h:71
const Vector & parameters() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Definition: DDAxes.h:10
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
T y() const
Definition: PV3DBase.h:62
#define abs(x)
Definition: mlp_lapack.h:159
#define P
CylindricalState(Scalar rho, const Vector &par, Scalar prSign)
double charge(const std::vector< uint8_t > &Ampls)
Scalar prSign_
sign of local p_r
RKSmallVector< Scalar, 5 > Vector
T mag() const
Definition: PV3DBase.h:66
T sqrt(T t)
Definition: SSEVec.h:46
CylindricalState(const LocalPoint &pos, const LocalVector &mom, Scalar ch)
T z() const
Definition: PV3DBase.h:63
tuple result
Definition: query.py:137
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
#define dso_internal
Definition: Visibility.h:13
Scalar rho() const
static int position[264][3]
Definition: ReadPGInfo.cc:509
Scalar charge() const
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
const LocalVector momentum() const
tuple cout
Definition: gather_cfg.py:121
double prSign() const
T x() const
Definition: PV3DBase.h:61