关于random seed的讨论
[gate-users] Random seed
Dirk Kruecker d.kruecker at fz-juelich.deThu Jun 30 12:55:11 CEST 2005
- Previous message: [gate-users] Random seed
- Next message: [gate-users]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Dear Martin,
I guess the random number generation in GATE can be somewhat
confusing. I better explain everything in detail.
-------------------------------------------------------------
The default behaviour:
Without any
  /gate/output/root/setSaveRndmFlag n
  /random/resetEngineFrom xxx
command GATE will create 2 random seed files:
  beginOfRun.rndm and endOfRun.rndm.
If you do not change these files the next run will be initialized from the 
endOfRun.rndm file (the beginOfRun.rndm will not change anyhow). So by
default each run will be different.
The random number engine will be initialized from the endOfRun.rndm.
If there is no  endOfRun.rndm    GATE will create a  beginOfRun.rndm and will
start from this file. The  beginOfRun.rndm  will _always_  be the same! The  
endOfRun.rndm   will change after each run.
------------------------------------------------------------
Rerunning with the same random numbers:
If you want to re-run the same events you can set
 /gate/output/root/setSaveRndmFlag 0
GATE will be initialized internally and each run will be the same.
----------------------------------------------------------------
Continuning an existing simulation to increase the number of events:
In the case where you already run a simulation and want to continue to get 
better statistics you need the endOfRun.rndm from your first simulation.
 /gate/output/root/setSaveRndmFlag 1
GATE will automatically look for the endOfRun.rndm file in directory where it
runs.
--------------------------------------------------------------------------------------
BTW
When the SaveRndmFlag is set you can observe the status of the random
generator at run end. There are some lines before GATE stops:
----- HepJamesRandom engine status -----
Initial seed = 9876
 u[] = 0.207714 ...
I skip the 103 numbers  describing the state of the random number engine. If
(at least 1 of) these 103 numbers are different  your events will be
statistically independent.
--------------------------------------------------------------------------------------
Continuning an existing simulation to increase the number of events in the
case where you did not save the  endOfRun.rndm from the first simulation:
Here the safest method is to use a seed which is totally different from what
GATE creates. I have included a zip file with a few seeds to create
independent random number streams.
 /gate/output/root/setSaveRndmFlag 0
 /random/resetEngineFrom  StartSeq(n).rndm
Just giving the filename without   /gate/output/root/setSaveRndmFlag 0 will   not be sufficient since GATE will still look for the endOfRun.rndm file.
I hope this helps
Dirk
-------------------------------------------------------------------
    
        

0 条评论:
发表评论
订阅 博文评论 [Atom]
<< 主页