From 56afb978b2416ee9a14ecacdf41ab996d1747b66 Mon Sep 17 00:00:00 2001 From: Stan Seibert Date: Wed, 10 Aug 2011 20:56:14 -0400 Subject: Set the GEANT4 and CUDA RNG seeds using current time and process ID if not set on command line. --- g4gen.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'g4gen.py') diff --git a/g4gen.py b/g4gen.py index 409570f..718df6e 100644 --- a/g4gen.py +++ b/g4gen.py @@ -18,7 +18,7 @@ except: import G4chroma class G4Generator(object): - def __init__(self, material): + def __init__(self, material, seed=None): '''Create generator to produce photons inside the specified material. material: chroma.geometry.Material object with density, @@ -26,7 +26,12 @@ class G4Generator(object): composition dictionary should be { element_symbol : fraction_by_weight, ... }. + seed: Random number generator seed for HepRandom. If None, + generator is not seeded. ''' + if seed is not None: + HepRandom.setTheSeed(seed) + g4py.NISTmaterials.Construct() g4py.ezgeom.Construct() self.physics_list = G4chroma.ChromaPhysicsList() -- cgit