Hello,
I have some trouble with the random engine state.
I use the Geant4.11.0.0
VM from https://geant4.cenbg.in2p3.fr/
.
I changed in example B1
line 78 false
to true
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
I compiled it like this:
localhost.localdomain:/build < 91 >cmake -DGeant4_DIR=$G4COMP ..
localhost.localdomain:/build < 91 >make
Then I execute macro A
with ./exampleB1 A.mac
# macro A.mac
/run/numberOfThreads 1
#
/random/setDirectoryName A
/random/setSavingFlag 1
#
/run/initialize
#
/gun/particle gamma
/gun/energy 6 MeV
#
/random/setSeeds 2 2
/run/beamOn 50
/random/saveThisRun #save as A/run0.rndm
The result of macro A.mac is:
- Cumulated dose per run, in scoring volume : 1.45607 picoGy rms = 0.565989 picoGy
- A/run0.rndm
# A/run0.rndm
mixmax state, file version 1.0
N=17; V[N]={414469184642473095, 1887497230718120570, 2195475624800485765, 932596286296600524, 218172641998458221, 1120322260615769150, 539175102615237389, 1629436967027825808, 719649398285478826, 1292536263533526791, 1569870862419815394, 1958103466980645205, 824192756230114970, 1491737190745264678, 601594138938872905, 896013831305951495, 207235109353979734}; counter=17; sumtot=51334242799068912;
Excuting macro B
with ./exampleB1 B.mac
# macro B.mac
/run/numberOfThreads 1
#
/random/setDirectoryName B
/random/setSavingFlag 1
#
/run/initialize
#
/gun/particle gamma
/gun/energy 6 MeV
#
#
/random/resetEngineFrom A/run0.rndm
/random/setSeeds 2 2
/run/beamOn 50
/random/saveThisRun #save as B/run0.rndm
#
/random/setSeeds 2 2
/run/beamOn 50
/random/saveThisRun #save as B/run1.rndm
#
/random/setSeeds 2 2
/run/beamOn 50
/random/saveThisRun #save as B/run2.rndm
The result of macro B.mac is:
- Cumulated dose per run, in scoring volume : 1.45607 picoGy rms = 0.565989 picoGy
- Cumulated dose per run, in scoring volume : 1.45607 picoGy rms = 0.565989 picoGy
- Cumulated dose per run, in scoring volume : 1.45607 picoGy rms = 0.565989 picoGy
- B/run0.rndm
- B/run1.rndm
- B/run2.rndm
# B/run0.rndm
mixmax state, file version 1.0
N=17; V[N]={414469184642473095, 1887497230718120570, 2195475624800485765, 932596286296600524, 218172641998458221, 1120322260615769150, 539175102615237389, 1629436967027825808, 719649398285478826, 1292536263533526791, 1569870862419815394, 1958103466980645205, 824192756230114970, 1491737190745264678, 601594138938872905, 896013831305951495, 207235109353979734}; counter=17; sumtot=51334242799068912;
# B/run1.rndm
mixmax state, file version 1.0
N=17; V[N]={2014613053947753086, 824434115577448012, 1977348868538418011, 942717300151646196, 701090698124507451, 320258490287032540, 974022719453450161, 2007169125077615826, 1724623297724457375, 906722331111185825, 1568450006560729852, 1075756346485386457, 461179858001665605, 631993966527713475, 1495955318164271570, 1896413947367753032, 483205697332176607}; counter=7; sumtot=1559211066723659473;
# B/run2.rndm
mixmax state, file version 1.0
N=17; V[N]={2014613053947753086, 824434115577448012, 1977348868538418011, 942717300151646196, 701090698124507451, 320258490287032540, 974022719453450161, 2007169125077615826, 1724623297724457375, 906722331111185825, 1568450006560729852, 1075756346485386457, 461179858001665605, 631993966527713475, 1495955318164271570, 1896413947367753032, 483205697332176607}; counter=7; sumtot=1559211066723659473;
=> The runs give the same physics, but the saved mixmax state from B/run0.rndm differs from B/run1.rndm and B/run2.rndm (and subsequent).
??? Is this as expected ???
Executing macro C
with ./exampleB1 C.mac
# macro C.mac
/run/numberOfThreads 1
#
/random/setDirectoryName C
/random/setSavingFlag 1
#
/run/initialize
#
/gun/particle gamma
/gun/energy 6 MeV
#
#
/random/resetEngineFrom A/run0.rndm
/run/beamOn 50
/random/saveThisRun #save as C/run0.rndm
#
/random/resetEngineFrom A/run0.rndm
/run/beamOn 50
/random/saveThisRun #save as C/run1.rndm
#
/random/resetEngineFrom A/run0.rndm
/run/beamOn 50
/random/saveThisRun #save as C/run2.rndm
The result of macro C.mac is:
- Cumulated dose per run, in scoring volume : 2.11361 picoGy rms = 0.892899 picoGy
- Cumulated dose per run, in scoring volume : 2.11361 picoGy rms = 0.892899 picoGy
- Cumulated dose per run, in scoring volume : 2.11361 picoGy rms = 0.892899 picoGy
- C/run0.rndm
- C/run1.rndm
- C/run2.rndm
# C/run0.rndm
mixmax state, file version 1.0
N=17; V[N]={414469184642473095, 1887497230718120570, 2195475624800485765, 932596286296600524, 218172641998458221, 1120322260615769150, 539175102615237389, 1629436967027825808, 719649398285478826, 1292536263533526791, 1569870862419815394, 1958103466980645205, 824192756230114970, 1491737190745264678, 601594138938872905, 896013831305951495, 207235109353979734}; counter=17; sumtot=51334242799068912;
# C/run1.rndm
mixmax state, file version 1.0
N=17; V[N]={1047083528805871381, 73278982019940248, 80005222461718263, 1628391398291481934, 2302632883225043046, 1376218205706394186, 1022102991764472564, 902203220374063298, 914820296392405112, 1014491263249954051, 1829767848657640665, 2050654056682742913, 2296831036461902366, 48785260568466581, 2294715506087075472, 1696215684458299470, 655273341898698485}; counter=8; sumtot=480883644182924476;
# c/run2.rndm
mixmax state, file version 1.0
N=17; V[N]={1047083528805871381, 73278982019940248, 80005222461718263, 1628391398291481934, 2302632883225043046, 1376218205706394186, 1022102991764472564, 902203220374063298, 914820296392405112, 1014491263249954051, 1829767848657640665, 2050654056682742913, 2296831036461902366, 48785260568466581, 2294715506087075472, 1696215684458299470, 655273341898698485}; counter=8; sumtot=480883644182924476;
=> The runs give the same physics, which differ to macro B
because of the different seed. But despite of “loading” the saved run0.rndm
from A /random/resetEngineFrom A/run0.rndm
in front of each run, the saved mixmax state from C/run0.rndm differs from C/run1.rndm and C/run2.rndm (and subsequent).
??? Is this as expected ???
This behavior is similar with RanecuEngine
in exampleB1.cc
in line 55.
G4Random::setTheEngine(new CLHEP::RanecuEngine);
I could not find help here:
https://geant4.web.cern.ch/support/user_documentation
https://geant4-userdoc.web.cern.ch/UsersGuides/ForApplicationDeveloper/html/Control/AllResources/Control/UIcommands/_random_.html
https://proj-clhep.web.cern.ch/proj-clhep/
Maybe I don’t understand the concept of /random/saveThisRun
and /random/resetEngineFrom
correct.
Please can someone help me?