[gate-users] Random seed
Dirk Kruecker
d.kruecker at fz-juelich.de
Thu Jun 30 12:55:11 CEST 2005
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
-------------------------------------------------------------------
Dear Dirk,
First we want to get exactly the same set of events in two simulations, the
detector type #1 and the detector type #2 simulations. (As described in my
previous email, the first time we attach detector type #1 as crystalSD, and
detector type #2 as phantomSD, and in the second run - with the same seed -
we switch the crystalSD and phantomSD for the detectors. This produces two
singles files which we later sort into sinograms.) This part we have been
able to accomplish and we are getting good data that we can reconstruct.
After this, however, we want to increase statistics for our simulations, so we
want to run the same setup/simulation, but this time with a different random
seed. This is the part which does not work for us. The data that we get
somehow produces almost identical sinograms as our previous runs, so we do
not achieve higher statistics.
Martin
PS. We have also tried setting "/random/resetEngineFrom endOfRun.rndm" as
suggested by Mutanga Theodore, but with the same results as using
beginOfRunDummy.rndm.
-----Dirk Kruecker <d.kruecker at fz-juelich.de> wrote: -----
Dear Martin,
What do you want to achieve? Do you want to get exactly the same
set of events? This is impossible if you change your setup. At some point the
simulation will differ since it has to simulate the difference in your design
and it will consume a different amount of random numbers.
?
Best Regards
Dirk
> Hello GATE users,
> We are having trouble with the random seed in GATE. We are developing a PET
> system with two different detectors, and we therefore run GATE twice with
> the same seed. The first time we attach detector type #1 as crystalSD, and
> detector type #2 as phantomSD, and in the second run - with the same seed
> - we switch the crystalSD and phantomSD for the detectors. This produces
> two output (singles) files which we later sort into sinograms. This
> approach is working with the exception of producing original data in
> different runs. If we subtract sinograms from two different runs (with
> different seeds) from each other, it turns out that all events, except for
> a few hundred, are identical.
> We have tried several different approaches to getting original data. One
> approach is running a short dummy program, and copying the endOfRun.rndm
> file onto our random-file and then running GATE (both times) with :
> /gate/output/root/setSaveRndmFlag 0
> /random/resetEngineFrom beginOfRunDummy.rndm
>
> We have also tried setting "/gate/output/root/setSaveRndmFlag 1" for the
> first run, and copying beginOfRun.rndm onto our random file for the second
> simulation, but that doesn't produce correlated data. Does anybody have an
> idea of how to solve this problem?
> Sincerely,
> Martin Janecek
-------------- next part --------------
A non-text attachment was scrubbed...
Name: seeds.zip
Type: application/x-zip
Size: 229470 bytes
Desc: not available
URL: <http://lists.opengatecollaboration.org/mailman/private/gate-users/attachments/20050630/725bf5be/attachment.bin>
More information about the Gate-users
mailing list