CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/TrackPropagation/RungeKutta/src/CartesianState.h

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