Can user code know about FindNextChord errors?

Geant4 Version: 10.7.4, 11.4.0
Operating System: MacOS
Compiler/Version: Apple Clang 17.0.0
CMake Version: 4.2.1


In our simulation, we have some particles (semiconductor charge carriers) which can take very small steps, microns or smaller. I’m running into a situation where occasionally (1 in 25,000 tracks or so), I start getting a cascade of warnings of the form

-------- WWWW ------- G4Exception-START -------- WWWW -------
*** G4Exception : GeomField0003
      issued by : G4ChordFinder::FindNextChord()
Exceeded maximum number of trials= 75
Current sagita dist= nan
Max sagita dist= 0.25
Step sizes (actual and proposed): 
Last trial =         1.14808e-72
Next trial =         1.14808e-73
Proposed for chord = 2.29616e-72

*** This is just a warning message. ***
-------- WWWW -------- G4Exception-END --------- WWWW -------

I would love to be able to catch these errors the first time they happen, and just kill the track or something.

Is there a generic way to “catch” G4Exceptions that get thrown elsewhere in the code? Or more specifically, test at the process level whatever unpleasant condition with the track is triggering the Transportation problem above?

1 Like