We are trying to handle events getting aborted in our simulations in our subclasses of
G4MTRunManager. The most straightforward way of doing this seems to be to call
AbortRun() when we catch an exception with the severity
G4ExceptionSeverity::EventMustBeAborted. Doing this however leaves the simulation in the state
G4State_EventProc, which makes it impossible to run
BeamOn() for the next event (with the message
Illegal application state - BeamOn() ignored.). So, what we would like to do is just skip the event that throws the exception and move on with the simulation.
My way of handling this for now is to override
AbortRun() in our subclasses, and in there reset the state to
Is this an okay thing to do, or will it break something deeper within the Geant4 framework? I have tried to find out where the state would be set back to idle after aborting an event, but it doesn’t seem to happen anywhere. Is the intention that the user sets the state themselves, as I have done?