setRandomNumberStore

Setting G4RunManager::GetRunManager()->SetRandomNumberStore(true) generates two files currentRun.rndm and currentEvent.rndm.

Here is an example of the currentRun.rndn generated when ‘/run/beamOn/100’ was executed. currentEvent.rndm has the exactly same format but is filled with different numbers.

mixmax state, file version 1.0
N=17; V[N]={2075170374712116539, 1471959819534234263, 1021822060063033209, 1805645913842247386, 1194695009288092020, 1781170456912949598, 942118788177246156, 1785674352477277205, 1114608862691621196, 2291480921118894230, 1105448525184166249, 1669202297040090443, 1529743089622339508, 730967562462860057, 2204855553807086384, 252298979738287068, 183722065015312578}; counter=8; sumtot=102154539550914579;

I assume these numbers can be used to generate the same random numbers, but I have no clue how to do it. Could anyone please tell how to use the two rndm files?

please, have a look to example electromagnetic TestEm4 : readme and macro rndmSeed.mac

Thank you so much!

Just to make sure, can you kindly confirm these?

  • With G4RunManager::GetRunManager()->SetRandomNumberStore(true), the ‘currentRun.rndm’ stores the random numbers for the entire run, while the ‘currentEvent.rndm’ stores the random numbers only for the last event (when there are more than 1 events).

  • Executing ‘/run/beamOn 10’ after ‘/random/resetEngineFrom currentEvent.rndm’, only 1 out of 10 events (maybe the first one?) is generated using the stored random numbers.

the seed is saved at each begin of event, overwriting currentEvent.rndm
I think item 8 of readme explain well principle of the mechanism.