After storing information from each event of a simulation in a ROOT file, I would be interested in finding an event I am interested in and resimulating it in exactly the same way, in order to store more information (or inspect it graphically).
Let’s say event 63 in my simulation catches my eye.
allow me to control the seed at the beginning of the run.
However if I check the engine at each event, with:
CLHEP::HepRandom::showEngineStatus();
eventually, event 63 (for example) will show:
--------- Ranecu engine status ---------
Initial seed (index) = 124
Current couple of seeds = 277819502, 115827135
How can I use the couple of seeds to run a simulation with only one event that is identical to event 63? I would imagine going to the BeginOfEventAction, and settings the couple of seeds, but I don’t understand how to do that.
There are two useful commands CLHEP::HepRandom::getTheEngine()->saveStatus() and CLHEP::HepRandom::getTheEngine()->restoreStatus().
I used this code some time ago to ensure I rerun the same events. It’s already in the primary generator action, not the event action, as it involved random numbers.
Thanks, this is also useful. I ended up using the getTheSeeds method instead because I was interested in storing this information in a compact way as a series of ints in a root ntuple, but your suggestion will be also useful for other applications I was working on!