When tracking particles (other than gammas) in an electromagnetic field which exerts a force on them, the particle's time (both the global and the local) is reset to zero. More specifically: I created an inhomogenous magnetic field in which there is a force on neutral particles with a magnetic moment. Therefore in my field class, which inherits from G4MagneticField, the DoesFieldChangeEnergy() method returns true. In that case, both the local and the global times of the tracked particle are reset to zero after the first step, and afterwards it remains zero. If I change DoesFieldChangeEnergy() to return false, then the times are calculated correctly (I believe). But in this case, of course, the calculated trajectories can be wrong.
Dear Bertalan, Thank you for the problem report. Your case is unusual, as it involves an extension to the ability of the Transportation. Considering this and the likeliest scenario for its implementatation, I identified a likely cause in the class G4Mag_SpinEqRhs, which does not enable the integration of the time, using the path length and velocity. A correction is in preparation, utilising the functionality already available in the equation for the full Electromagnetic field. I am sharing prototype code for this via direct contact - and other affected users are encouraged to contact us. John Apostolakis
Together with the user we have figured out that the origin of the issue was in a user-written Equation of Motion class. Two revisions were necessary in the application code: - revising the equation of motion to update the time , as is done in equation for the 'full' electromagnetic field, and - ensuring all relevant classes are initialized with all 8 relevant components (x,y,z, 3p, null, t) chosen for integration. Many thanks to Bertalan for his feedback. Best regards, John Apostolakis