CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 #ifndef CartesianStateAdaptor_H
00002 #define CartesianStateAdaptor_H
00003 
00004 class CartesianStateAdaptor {
00005 public:
00006 
00007     typedef double                            Scalar;
00008     typedef Basic3DVector<Scalar>             Vector3D;
00009 
00010     CartesianStateAdaptor( const RKSmallVector<double,6>& rk) :
00011       pos_(rk[0], rk[1], rk[2]), mom_(rk[3], rk[4], rk[5]) {}
00012 
00013     const Vector3D& position() const { return pos_;}
00014     const Vector3D& momentum() const { return mom_;}
00015 
00016     static Vector3D position(const RKSmallVector<double,6>& rk) {
00017       return Vector3D(rk[0], rk[1], rk[2]);
00018     }
00019 
00020     static Vector3D momentum(const RKSmallVector<double,6>& rk) {
00021       return Vector3D(rk[3], rk[4], rk[5]);
00022     }
00023 
00024     static RKSmallVector<double,6> rkstate( const Vector3D& pos, const Vector3D& mom) {
00025         RKSmallVector<double,6> res;
00026         res[0] = pos.x();
00027         res[1] = pos.y();
00028         res[2] = pos.z();
00029         res[3] = mom.x();
00030         res[4] = mom.y();
00031         res[5] = mom.z();
00032         return res;
00033     }
00034 
00035 private:
00036 
00037     Vector3D pos_;
00038     Vector3D mom_;
00039 
00040 };
00041 
00042 #endif