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