Skip to content

Commit

Permalink
Merge pull request #665 from cpommranz/add_mixmaxrng
Browse files Browse the repository at this point in the history
Add mixmaxrng
  • Loading branch information
dsarrut authored Feb 6, 2024
2 parents 22c8dac + be5d9d9 commit 3621e0b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 James Random, 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
Expand Down
5 changes: 5 additions & 0 deletions source/general/src/GateRandomEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ctime>
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 3621e0b

Please sign in to comment.