111 G4double momentum_mag_square = y[3]*y[3] + y[4]*y[4] + y[5]*y[5];
112 G4double inv_momentum_magnitude = 1.0 / std::sqrt( momentum_mag_square );
114 G4double Energy = std::sqrt(momentum_mag_square + mass*mass);
115 G4double inverse_velocity = Energy*inv_momentum_magnitude/c_light;
117 G4double cof1 = ElectroMagCof*inv_momentum_magnitude;
119 G4double cof3 = inv_momentum_magnitude*mass;
121 dydx[0] = y[3]*inv_momentum_magnitude;
122 dydx[1] = y[4]*inv_momentum_magnitude;
123 dydx[2] = y[5]*inv_momentum_magnitude;
129 G4double field[18] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
141 dydx[3] += cof1*(y[4]*field[2] - y[5]*field[1]);
142 dydx[4] += cof1*(y[5]*field[0] - y[3]*field[2]);
143 dydx[5] += cof1*(y[3]*field[1] - y[4]*field[0]);
166 dydx[3] += cof1*cof2*field[3];
167 dydx[4] += cof1*cof2*field[4];
168 dydx[5] += cof1*cof2*field[5];
174 if (!fBfield && !fEfield)
191 dydx[3] += field[6]*cof2*cof3/c_light;
192 dydx[4] += field[7]*cof2*cof3/c_light;
193 dydx[5] += field[8]*cof2*cof3/c_light;
199 if (!fBfield && !fEfield && !fGfield)
202 field[10] = Field[1];
203 field[11] = Field[2];
204 field[12] = Field[3];
205 field[13] = Field[4];
206 field[14] = Field[5];
207 field[15] = Field[6];
208 field[16] = Field[7];
209 field[17] = Field[8];
214 field[10] = Field[10];
215 field[11] = Field[11];
216 field[12] = Field[12];
217 field[13] = Field[13];
218 field[14] = Field[14];
219 field[15] = Field[15];
220 field[16] = Field[16];
221 field[17] = Field[17];
228 dydx[3] += magMoment*(y[9]*field[ 9]+y[10]*field[10]+y[11]*field[11])
229 *inv_momentum_magnitude*Energy;
230 dydx[4] += magMoment*(y[9]*field[12]+y[10]*field[13]+y[11]*field[14])
231 *inv_momentum_magnitude*Energy;
232 dydx[5] += magMoment*(y[9]*field[15]+y[10]*field[16]+y[11]*field[17])
233 *inv_momentum_magnitude*Energy;
241 dydx[7] = inverse_velocity;
271 u *= inv_momentum_magnitude;
273 G4double udb = anomaly*beta*gamma/(1.+gamma) * (BField * u);
274 G4double ucb = (anomaly+1./gamma)/beta;
275 G4double uce = anomaly + 1./(gamma+1.);
290 if (Spin.mag2() != 0.)
295 pcharge*omegac*( ucb*(Spin.cross(BField))-udb*(Spin.cross(u)) );
299 dSpin -= pcharge*omegac*( uce*(u*(Spin*EField) - EField*(Spin*u)) );
306 dydx[ 9] = dSpin.
x();
307 dydx[10] = dSpin.
y();
308 dydx[11] = dSpin.
z();