57 #include "SimG4Core/MagneticField/interface/G4MonopoleEquation.hh"
59 #include "G4PhysicalConstants.hh"
60 #include "G4SystemOfUnits.hh"
65 G4MonopoleEquation::G4MonopoleEquation(G4ElectroMagneticField *emField )
66 : G4EquationOfMotion( emField )
71 G4MonopoleEquation::~G4MonopoleEquation()
77 G4MonopoleEquation::SetChargeMomentumMass( G4ChargeState particleChargeState,
79 G4double particleMass)
81 G4double particleMagneticCharge= particleChargeState.MagneticCharge();
82 G4double particleElectricCharge= particleChargeState.GetCharge();
85 fElCharge =eplus* particleElectricCharge*c_light;
87 fMagCharge = eplus*particleMagneticCharge*c_light ;
93 fMassCof = particleMass*particleMass ;
99 G4MonopoleEquation::EvaluateRhsGivenB(
const G4double
y[],
100 const G4double Field[],
101 G4double dydx[] )
const
107 G4double pSquared = y[3]*y[3] + y[4]*y[4] + y[5]*y[5] ;
109 G4double Energy =
std::sqrt( pSquared + fMassCof );
111 G4double pModuleInverse = 1.0/
std::sqrt(pSquared);
113 G4double inverse_velocity = Energy * pModuleInverse / c_light;
115 G4double cofEl = fElCharge * pModuleInverse ;
116 G4double cofMag = fMagCharge * Energy * pModuleInverse;
119 dydx[0] = y[3]*pModuleInverse ;
120 dydx[1] = y[4]*pModuleInverse ;
121 dydx[2] = y[5]*pModuleInverse ;
133 dydx[3] = cofMag * Field[0] + cofEl * (y[4]*Field[2] - y[5]*Field[1]);
134 dydx[4] = cofMag * Field[1] + cofEl * (y[5]*Field[0] - y[3]*Field[2]);
135 dydx[5] = cofMag * Field[2] + cofEl * (y[3]*Field[1] - y[4]*Field[0]);
151 dydx[7] = inverse_velocity;