Problem 1969

Summary: Particle polarization lost in G4PropagatorInField
Product: Geant4 Reporter: Michal Koval <michal.koval>
Component: geometry/navigationAssignee: John Apostolakis <John.Apostolakis>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: P4    
Version: 10.3   
Hardware: All   
OS: All   

Description Michal Koval 2017-05-04 18:10:17 CEST
In our application we simulate decays of muons with defined polarization. 
We observed a problem when we propagate muons in magnetic fields; the muon polarization was reset to zero. 
The problem was tracked to the class G4PropagatorInField, method ComputeStep. 
We were able to fix the problem and set the particle polarization to the original value by adding one line like this:
  pFieldTrack.SetPolarization(OriginalState.GetPolarization());

to line 459 in: 
https://gitlab.cern.ch/geant4/geant4/blob/master/source/geometry/navigation/src/G4PropagatorInField.cc

In our application, the magnetic field correction to the track direction is rather small, and this fix is good enough.
Comment 1 John Apostolakis 2017-06-14 16:45:21 CEST
In my initial assessment, your proposed change would work only if the polarization is NOT integrated by the equation of motion.

Could you confirm that indeed, you are not using an equation of motion that integrate the polarization ? 

Best regards,
John Apostolakis
Comment 2 Michal Koval 2017-06-14 17:12:41 CEST
Yes, you are right, we are not using the equation of motion.
The proposed patch we used is OK in our specific case since the effect of the magnetic field on the polarization is small in our setup; but in general the equation of motion should be used.
Comment 3 John Apostolakis 2017-06-19 11:46:37 CEST
Your proposed patch will break those cases which do use the propagation of the polarisation in the magnetic field.
So we will need to figure out a different way to correct the behaviour in your use case - wanting to have the polarisation propagated, but not integrated.  It is a use case which we did not consider.
Comment 4 John Apostolakis 2019-03-06 15:13:35 CET
I will create a trial fix that allows the user to toggle a flag and request this behaviour.

Though it cannot be a default it should be possible for an application to obtain it: have the polarisation state copied from the input to the output state.

As it will be additional code, it may become an installation option - after verification.  This would allow you to use the code with subsequent versions of Geant4 without disturbing other users.

However in case this is no longer needed, please let us know.
Comment 5 Michal Koval 2019-03-07 12:03:11 CET
Dear John, thank you for the response. 

In the meantime we have included the magnetic field integration (equation of motion solving) in our simulation. Therefore, the proposed change is not necessary for us anymore. I think the bug can be closed if there are no other users that require the special option.
Comment 6 John Apostolakis 2019-03-07 12:29:12 CET
Thank you for your response!

We will close this report / request.