Problem 1831

Summary: wrong spin tracking using G4Mag_SpinEqRhs for particle with negative magnetic moment
Product: Geant4 Reporter: Andrea Merli <andrea.merli>
Component: geometry/magneticfieldAssignee: gum
Status: RESOLVED FIXED    
Severity: trivial    
Priority: P5    
Version: 10.1   
Hardware: Apple   
OS: Mac OS X   
Attachments: comparison between mu- motion given by G4Mag_SpinRhs and mymodification
comparison between mu+ motion given by G4Mag_SpinRhs and mymodification

Description Andrea Merli 2016-02-18 17:20:28 CET
I'm simulating a muon with 1 GeV of kinetic energy with initial polarization (0,0,1) and constant magnetic field (1,0,0) tesla in a empty world (i.e. filled only with Galactic material).

Analytically the frequency spin precession (\omega_{pol}) should be \omega_{pol}=\omega_{dir}*(1+a\gamma) where \omega_{dir} is the frequency for the direction (velocity) of the particle while a and \gamma is the anomaly and the relativistic lorentz factor respectively. Since for a muon with 1 GeV of kinematic energy \gamma \approx 10 and a\approx 0.001 I would expect \omega_{pol} is similar to \omega_{dir}. This is what I obtain for a mu+ (the fits give me the correct values) but not for mu- as you can see in the attachment.

I think this is due to the wrong calculation of the anomaly in the G4Mag_SpinRhs class (and similar which, however, I've not tested). This could be easy resolved adding an absolute value at line 64 of the file G4Mag_SpinRhs.cc.

In the attachment you can find the tested precession for direction and polarization along z axis for a mu-. The obtained results are for the equation class given by the G4 package and with my modification explained above. The curve G4_mum_dirz is not visible because is covered by my_mum_dirz (i.e. my modification and G4Mag_SpinRhs provide the same motion, what changes is only the spin precession)
Comment 1 Andrea Merli 2016-02-18 17:25:30 CET
Created attachment 385 [details]
comparison between mu- motion given by G4Mag_SpinRhs and mymodification
Comment 2 Andrea Merli 2016-02-18 17:27:24 CET
Created attachment 386 [details]
comparison between mu+ motion given by G4Mag_SpinRhs and mymodification

Here the G4 results are not visible because are covered by my modification (i.e. my modification provide exactly the same results as G4Mag_SpinRhs for particle with positive magnetic moment)
Comment 3 John Apostolakis 2016-02-25 11:57:22 CET
Thanks for your report.  I have asked a colleague to review your proposed changes.
Comment 4 gum 2016-02-26 02:25:04 CET
Hi Andrea,

Thank you for spotting this mistake. Instead of defining the magnetic moment to be always positive, it is the Lande g factor that should always be defined positive. Hence, I leave the line 64 unchanged but change line 72 to:

if ( spin != 0. ) g_BMT = (std::abs(magMoment)/muB)/spin;

The magMoment itself has a sign in G4RepleteEofM::EvaluateRhsGivenB.

This will appear in the next correction patch for G4Mag_SpinEqRhs,  G4EqEMFieldWithSpin, G4EqEMFieldWithEDM and G4RepleteEofM.cc

Thank you, Peter