From f68d486600ec68fb400f295918b10ec9b08e4cdd Mon Sep 17 00:00:00 2001 From: Christian Pommranz Date: Sat, 3 Feb 2024 11:18:12 +0100 Subject: [PATCH 1/3] Add MixMaxRng (the current Geant4 default) to the list of available random engines --- source/general/src/GateRandomEngine.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/general/src/GateRandomEngine.cc b/source/general/src/GateRandomEngine.cc index f69738800..15ef1ee02 100644 --- a/source/general/src/GateRandomEngine.cc +++ b/source/general/src/GateRandomEngine.cc @@ -11,6 +11,7 @@ #include "CLHEP/Random/Random.h" #include "CLHEP/Random/RandomEngine.h" #include "CLHEP/Random/JamesRandom.h" +#include "CLHEP/Random/MixMaxRng.h" #include "CLHEP/Random/MTwistEngine.h" #include "CLHEP/Random/Ranlux64Engine.h" #include @@ -73,6 +74,10 @@ void GateRandomEngine::SetRandomEngine(const G4String& aName) { delete theRandomEngine; theRandomEngine = new CLHEP::MTwistEngine(); } + else if (aName=="MixMaxRng") { + delete theRandomEngine; + theRandomEngine = new CLHEP::MixMaxRng(); + } else { G4String msg = "Unknown random engine '"+aName+"'. Computation aborted !!!\n"; G4Exception( "GateRandomEngine::SetRandomEngine", "SetRandomEngine", FatalException, msg); From cc07de6bf9c4d23581ed838eba290e1868ef871c Mon Sep 17 00:00:00 2001 From: Christian Pommranz Date: Sat, 3 Feb 2024 11:19:13 +0100 Subject: [PATCH 2/3] Docs: Add MixMaxRng to the random engine section --- docs/getting_started.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 1eb812ebc..bc2b11efb 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -625,11 +625,11 @@ If you want to exit from the Gate program when the simulation time exceed the time duration, the last line of your program has to be **exit**. As a Monte Carlo tool, GATE needs a random generator. The CLHEP libraries -provide various ones. Three different random engines are currently available in -GATE, the Ranlux64, the James Random and the Mersenne Twister. The default one -is the Mersenne Twister, but this can be changed easily using:: +provide various ones. Four different random engines are currently available in +GATE, Ranlux64, James Random, MixMaxRng (default random engine in Geant4), and Mersenne Twister. The default random +engine in GATE is Mersenne Twister, but this can be changed easily using:: - /gate/random/setEngineName aName (where aName can be: Ranlux64, JamesRandom, or MersenneTwister) + /gate/random/setEngineName aName (where aName can be: Ranlux64, JamesRandom, MixMaxRng, or MersenneTwister) **NB** Several users have reported artifacts in PET data when using the Ranlux64 generator. These users have said that the artifacts are not present in data From be5d9d9b9af80eb69cd6dd3517241176aadb30d6 Mon Sep 17 00:00:00 2001 From: Christian Pommranz Date: Sat, 3 Feb 2024 11:20:42 +0100 Subject: [PATCH 3/3] Docs: Correct the default random engine in GATE The default GATE random engine is James Random (and apparently has been throughout the available Git history), but the documentation mistakenly stated MersenneTwister as the default. --- docs/getting_started.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index bc2b11efb..76329971c 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -627,7 +627,7 @@ time duration, the last line of your program has to be **exit**. As a Monte Carlo tool, GATE needs a random generator. The CLHEP libraries provide various ones. Four different random engines are currently available in GATE, Ranlux64, James Random, MixMaxRng (default random engine in Geant4), and Mersenne Twister. The default random -engine in GATE is Mersenne Twister, but this can be changed easily using:: +engine in GATE is James Random, but this can be changed easily using:: /gate/random/setEngineName aName (where aName can be: Ranlux64, JamesRandom, MixMaxRng, or MersenneTwister)