Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:31:54

0001 #ifndef CartesianStateAdaptor_H
0002 #define CartesianStateAdaptor_H
0003 #include "FWCore/Utilities/interface/Visibility.h"
0004 
0005 #include "RKSmallVector.h"
0006 #include "DataFormats/GeometryVector/interface/Basic3DVector.h"
0007 
0008 class dso_internal CartesianStateAdaptor {
0009 public:
0010   typedef float Scalar;
0011   typedef Basic3DVector<Scalar> Vector3D;
0012 
0013   CartesianStateAdaptor(const RKSmallVector<double, 6>& rk) : pos_(rk[0], rk[1], rk[2]), mom_(rk[3], rk[4], rk[5]) {}
0014 
0015   const Vector3D& position() const { return pos_; }
0016   const Vector3D& momentum() const { return mom_; }
0017 
0018   static Vector3D position(const RKSmallVector<double, 6>& rk) { return Vector3D(rk[0], rk[1], rk[2]); }
0019 
0020   static Vector3D momentum(const RKSmallVector<double, 6>& rk) { return Vector3D(rk[3], rk[4], rk[5]); }
0021 
0022   static RKSmallVector<double, 6> rkstate(const Vector3D& pos, const Vector3D& mom) {
0023     RKSmallVector<double, 6> res;
0024     res[0] = pos.x();
0025     res[1] = pos.y();
0026     res[2] = pos.z();
0027     res[3] = mom.x();
0028     res[4] = mom.y();
0029     res[5] = mom.z();
0030     return res;
0031   }
0032 
0033 private:
0034   Vector3D pos_;
0035   Vector3D mom_;
0036 };
0037 
0038 #endif