Simulating Geometry/Reactions Over Time

I am currently simulating a pulsed proton beam accelerating protons at a cylindrical mercury target. My aim to to track neutron spallation over time. Specifically, I am interested in tracking the average energy of neutrons produced after each beam pulse, and the average number of neutrons produced after each beam pulse.

I understand that each beamOn(event) is basically like “resetting” the simulation. Therefore I can’t simply run the beam for a certain number of pulses, since after each pulse, the geometry/simulation resets. I am interested on the dynamics of the spallation over time, as the mercury degrades.

What would be a suitable methodology for tracking and event over time in Geant4? I am not familiar with how this is acheived. How would you all suggest I go about the pseudocode behind my simulation?

Thank you all for your time and help!

Geant4 Version: 11.1.3
Operating System: Ubuntu 22.04.4 LTS
Compiler/Version: GCC/G++
CMake Version: 3.29.2