Go to the documentation of this file.00001 #ifndef CylindricalState_H
00002 #define CylindricalState_H
00003
00004 #include "TrackPropagation/RungeKutta/interface/RKSmallVector.h"
00005
00006 #include <iostream>
00007
00020 class CylindricalState {
00021 public:
00022
00023 typedef double Scalar;
00024 typedef RKSmallVector<Scalar,5> Vector;
00025
00026 CylindricalState() {}
00027
00028 CylindricalState( const LocalPoint& pos, const LocalVector& mom, Scalar ch) {
00029 rho_ = pos.perp();
00030 Scalar cosphi = pos.x() / rho_;
00031 Scalar sinphi = pos.y() / rho_;
00032 Scalar p_rho = mom.x() * cosphi + mom.y() * sinphi;
00033 Scalar p_phi = -mom.x() * sinphi + mom.y() * cosphi;
00034
00035 par_(0) = pos.phi();
00036 par_(1) = pos.z();
00037 par_(2) = p_phi / (p_rho * rho_);
00038 par_(3) = mom.z() / p_rho;
00039 par_(4) = ch / mom.mag();
00040
00041 prSign_ = p_rho > 0 ? 1.0 : -1.0;
00042
00043 std::cout << "CylindricalState built from pos " << pos << " mom " << mom << " charge " << ch << std::endl;
00044 std::cout << "p_rho " << p_rho << " p_phi " << p_phi << " dphi_drho " << par_(2) << std::endl;
00045 std::cout << "Which results in " << position() << " mom " << momentum()
00046 << " charge " << charge() << std::endl;
00047 }
00048
00049 CylindricalState( Scalar rho, const Vector& par, Scalar prSign) :
00050 par_(par), rho_(rho), prSign_(prSign) {}
00051
00052
00053 const LocalPoint position() const {
00054 return LocalPoint( LocalPoint::Cylindrical( rho_, par_(0), par_(1)));
00055 }
00056
00057 const LocalVector momentum() const {
00058 Scalar cosphi = cos( par_(0));
00059 Scalar sinphi = sin( par_(0));
00060 Scalar Q = sqrt(1 + rho_*rho_ * par_(2)*par_(2) + par_(3)*par_(3));
00061 Scalar P = std::abs(1./par_(4));
00062 Scalar p_rho = prSign_*P/Q;
00063 Scalar p_phi = rho_*par_(2)*p_rho;
00064 Scalar p_z = par_(3)*p_rho;
00065 LocalVector result( p_rho*cosphi - p_phi*sinphi,
00066 p_rho*sinphi + p_phi*cosphi,
00067 p_z);
00068 return result;
00069 }
00070
00071 const Vector& parameters() const { return par_;}
00072
00073 Scalar charge() const { return par_(4) > 0 ? 1 : -1;}
00074
00075 Scalar rho() const {return rho_;}
00076
00077 double prSign() const {return prSign_;}
00078
00079 private:
00080
00081 Vector par_;
00082 Scalar rho_;
00083 Scalar prSign_;
00084
00085 };
00086
00087 #endif