36 namespace field_utils {
43 const G4double invMomentum2 = 1.0 / momentum2;
46 const G4double relativeMomentumError2 = momentumError2 * invMomentum2;
48 return std::max(std::sqrt(positionError2),
49 std::sqrt(relativeMomentumError2) * hstep);
59 G4double inv_eps_vel_sq = 1.0 / (eps_rel_max * eps_rel_max);
63 G4double inv_eps_pos_sq = 1.0 / (eps_pos * eps_pos);
68 errpos_sq *= inv_eps_pos_sq;
76 errvel_sq = sumerr_sq / magvel_sq;
80 G4Exception(
"field_utils::relativeError",
"Field001",
82 errvel_sq = sumerr_sq;
84 errvel_sq *= inv_eps_vel_sq;
85 errmax_sq =
std::max(errpos_sq, errvel_sq);
100 std::memcpy(dst, src,
sizeof(
G4double) * size);