116 G4double momentum_mag_square = y[3]*y[3] + y[4]*y[4] + y[5]*y[5];
117 G4double inv_momentum_magnitude = 1.0 / std::sqrt( momentum_mag_square );
119 G4double Energy = std::sqrt(momentum_mag_square + mass*mass);
122 G4double cof1 = ElectroMagCof*inv_momentum_magnitude;
124 G4double cof3 = inv_momentum_magnitude*mass;
126 dydx[0] = y[3]*inv_momentum_magnitude;
127 dydx[1] = y[4]*inv_momentum_magnitude;
128 dydx[2] = y[5]*inv_momentum_magnitude;
134 G4double field[18] = {0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
144 dydx[3] += cof1*(y[4]*field[2] - y[5]*field[1]);
145 dydx[4] += cof1*(y[5]*field[0] - y[3]*field[2]);
146 dydx[5] += cof1*(y[3]*field[1] - y[4]*field[0]);
164 dydx[3] += cof1*cof2*field[3];
165 dydx[4] += cof1*cof2*field[4];
166 dydx[5] += cof1*cof2*field[5];
172 if (!fBfield && !fEfield) {
184 dydx[3] += field[6]*cof2*cof3/
c_light;
185 dydx[4] += field[7]*cof2*cof3/
c_light;
186 dydx[5] += field[8]*cof2*cof3/
c_light;
192 if (!fBfield && !fEfield && !fGfield) {
194 field[10] = Field[1];
195 field[11] = Field[2];
196 field[12] = Field[3];
197 field[13] = Field[4];
198 field[14] = Field[5];
199 field[15] = Field[6];
200 field[16] = Field[7];
201 field[17] = Field[8];
204 field[10] = Field[10];
205 field[11] = Field[11];
206 field[12] = Field[12];
207 field[13] = Field[13];
208 field[14] = Field[14];
209 field[15] = Field[15];
210 field[16] = Field[16];
211 field[17] = Field[17];
215 if (magMoment != 0.) {
227 dydx[3] += magMoment*(y[9]*field[ 9]+y[10]*field[10]+y[11]*field[11])
228 *inv_momentum_magnitude*Energy;
229 dydx[4] += magMoment*(y[9]*field[12]+y[10]*field[13]+y[11]*field[14])
230 *inv_momentum_magnitude*Energy;
231 dydx[5] += magMoment*(y[9]*field[15]+y[10]*field[16]+y[11]*field[17])
232 *inv_momentum_magnitude*Energy;
241 dydx[7] = inverse_velocity;
260 u *= inv_momentum_magnitude;
262 G4double udb = anomaly*beta*gamma/(1.+gamma) * (BField * u);
263 G4double ucb = (anomaly+1./gamma)/beta;
264 G4double uce = anomaly + 1./(gamma+1.);
269 if (charge == 0.) pcharge = 1.;
270 else pcharge = charge;
273 if (Spin.mag2() != 0.) {
276 pcharge*omegac*( ucb*(Spin.cross(BField))-udb*(Spin.cross(u)) );
283 pcharge*omegac*( uce*(u*(Spin*EField) - EField*(Spin*u)) );
287 dydx[ 9] = dSpin.x();
288 dydx[10] = dSpin.y();
289 dydx[11] = dSpin.z();