I want to reduce the uncertantity of my simulation. I have simulated a certain number of particles and get the result. Does the Geant4 support me to continue running on the existing basis. Can I specify the run at a certain particles based on current random engine in order to get non-repeating sampling?
For example, In my first run, 1000 particles simulated. Now I want to add another 1000 particles without changing the random number seed, the secondary run start from the 1001 seed.
You do it by changing the random seed. See the /random macro commands. You can have the random state for each event recorded, and you can start a new run with that state. This works best in “single threaded” operation, but I believe there are ways to do what you want in a multithreaded environment.
Hi, mkelsey. Thanks for your repley.
I change the random seed in the main(): G4Random::setTheEngine(new CLHEP::RanecuEngine());, which was set before G4MTRunManager is instantiated. I found that after changing to this seed, the calculation efficiency of the project increased by 3 times compared to use the default seed (the default seed seems to be MixMaxRng engine ). Other simulation consitions were not modified.
My Geant4 version is 10.05.P01, and the primary source was set via GPS. Is this change in efficiency reasonable?
what you describe is changing the engine, not the seed.
the state of the engine changes with every random number that is generates. so when you do a first run and then another one (in the same session of your simulation) then these two runs will be completely independent.
if, however, you start your simulation, make a first run, close the simulation and open it again and then do the second run, it depends how the rng is seeded.
check the examples, i think there should be some inspiration how to seed with, for example, the current time, or a specific number