00001 00002 #include "CartesianLorentzForce.h" 00003 #include "CartesianStateAdaptor.h" 00004 00005 CartesianLorentzForce::Vector 00006 CartesianLorentzForce::operator()( Scalar z, const Vector& state) const 00007 { 00008 // derivatives in case S is the free parameter 00009 CartesianStateAdaptor start(state); 00010 RKLocalFieldProvider::Vector bfield = theField.inTesla( RKLocalFieldProvider::LocalPoint(start.position())); 00011 double k = 2.99792458e-3; // conversion to [cm] 00012 00014 CartesianStateAdaptor::Vector3D dpos = start.momentum().unit(); 00015 00017 CartesianStateAdaptor::Vector3D dmom = k*theCharge * dpos.cross( bfield); 00018 00019 return CartesianStateAdaptor::rkstate( dpos, dmom); 00020 }