Looping particles in a magnetic field

Hi everyone!

I am trying to simulate energy deposition of electrons in solid of Beryllium. This solid element is sorrounded by vacuum.
When I perform the simulation without magnetic field, everything works fine, but when I set the magnetic field (5T) the simulation loops.

I used the command lines to kill looping particles, especially:

auto transportParams= G4TransportationParameters::Instance();
transportParams->SetWarningEnergy(  10*keV );
transportParams->SetImportantEnergy(  0.1*MeV );
transportParams->SetNumberOfTrials( 2);

which seem to work because I observe in the output the precise particles that are getting killed while the simulation goes.

Does anyone know how to improve this situation?

In the past I played around a bit with magnetic fields in Geant4 and I got some improvement when using different steppers, i.e. steppers which assume an helical track. Hope this helps!

Thank you! I will try and let you know in case of positive feedback.