Problem 2037

Summary: Passing momentum^2 instead of momentum to equations of motion
Product: Geant4 Reporter: Renee Fatemi <renee.fatemi>
Component: geometry/navigationAssignee: John Apostolakis <John.Apostolakis>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P4    
Version: 10.3   
Hardware: All   
OS: All   

Description Renee Fatemi 2018-02-26 15:29:51 CET
There is a bug at line 1165 in /geometry/navigation/src/G4PathFinder.cc caused by passing the magnitude squared of the momentum, instead of just the momentum, into the equation of motion. When G4EqEMFieldWithSpin is used for the equations of motion this error will result in gamma becoming very very large which effectively removes all 1/gamma terms in the BMT equation that governs the spin precession of the muon in a magnetic field. 


Existing:
equationOfMotion->SetChargeMomentumMass(*(initialState.GetChargeState()),
initialState.GetMomentum().mag2(),
initialState.GetRestMass() );

Corrected:
equationOfMotion->SetChargeMomentumMass(*(initialState.GetChargeState()),
initialState.GetMomentum().mag(),
initialState.GetRestMass() );

I have verified that the spin precession of the muon is right once the momentum is passed instead of momentum squared.
Comment 1 John Apostolakis 2018-02-26 21:22:51 CET
I agree with the diagnosis.
Many thanks for pointing out the problem and the correction.
I have committed the requested fix in the Geant4 repository, for inclusion in the development and patching.
Comment 2 Gabriele Cosmo 2018-03-05 08:45:25 CET
Thanks, the fix is included in the patch release 10.4.p01.