CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/TrackPropagation/RungeKutta/interface/CartesianState.h

Go to the documentation of this file.
00001 #ifndef CartesianState_H
00002 #define CartesianState_H
00003 
00004 #include "DataFormats/GeometryVector/interface/Basic3DVector.h"
00005 #include "TrackPropagation/RungeKutta/interface/VectorDoublet.h"
00006 
00007 class CartesianState {
00008 public:
00009 
00010   typedef double                            Scalar;
00011   typedef Basic3DVector<Scalar>             Vector3D;
00012   typedef VectorDoublet<Vector3D,Vector3D>  Vector;
00013 
00014   CartesianState() {}
00015   CartesianState( const Vector& v, Scalar s) : par_(v), charge_(s) {}
00016   CartesianState( const Vector3D& pos, const Vector3D& mom, Scalar s) : 
00017     par_(pos,mom), charge_(s) {}
00018 
00019   const Vector3D& position() const { return par_.first();}
00020   const Vector3D& momentum() const { return par_.second();}
00021 
00022   const Vector& parameters() const { return par_;}
00023 
00024   Scalar charge() const { return charge_;}
00025 
00026 private:
00027 
00028   Vector par_;
00029   Scalar charge_;
00030 
00031 };
00032 
00033 inline CartesianState
00034 operator+( const CartesianState& a, const CartesianState& b) {
00035   return CartesianState(a.parameters()+b.parameters(), a.charge());
00036 }
00037 
00038 inline CartesianState
00039 operator-( const CartesianState& a, const CartesianState& b) {
00040   return CartesianState(a.parameters()-b.parameters(), a.charge());
00041 }
00042 
00043 inline CartesianState operator*( const CartesianState& v, const CartesianState::Scalar& s) {
00044   return CartesianState( v.parameters()*s, v.charge());
00045 }
00046 inline CartesianState operator*( const CartesianState::Scalar& s, const CartesianState& v) {
00047   return CartesianState( v.parameters()*s, v.charge());
00048 }
00049 
00050 inline CartesianState operator/( const CartesianState& v, const CartesianState::Scalar& s) {
00051   return CartesianState( v.parameters()/s, v.charge());
00052 }
00053 
00054 
00055 #endif