Skip to content

Draft: DepositionGeant4: add optionional event timeout

Draft idea to skip long events:

Considering different option, I figured the best option is indeed using a G4UserSteppingAction - it is not perfect IMHO since it isn't really related to a step, but AFAIK there is nothing in G4 that could make this cleaner, and external wrappers don't work nicely here. The only other good idea I have is to run a timer in parallel an call run_manager_g4_->AbortRun(), but idk if that works cleanly.

In terms of interface, event timeouts are completely optional since intercepting each step is not exactly a cheap operation - even though I kept the footprint as small as possible. Testing with a more complex simulation, I could not measure a performance impact since most of the time the event was in GenericPropagation (G4 event duration < 10ms).

When event_timeout is not set, no SteppingAction is added to the ActionInitialization - thus no performance is lost at all. I don't think the timeout should be enabled by default, but I believe it is a useful tool to debug apsq - knowing how many events take long and which ones without actually trying it out and setting skip_events by hand.

Still missing:

  • Documentation
  • Code documentation
  • Unit tests
  • Proper exception handling code
  • Proper performance testing

Merge request reports