From a64f088e37d6aa3edc9c59fa88d72c2f5be83b78 Mon Sep 17 00:00:00 2001 From: Andre Sailer <andre.philippe.sailer@cern.ch> Date: Tue, 5 Jul 2016 17:00:06 +0000 Subject: [PATCH] DDSim.Random: Initialize random before the input/outputFile as we are now potentially changing the random seed we need to initialize it before the output file, because we write the variables to the outputfile at this point --- DDSim/DD4hepSimulation.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/DDSim/DD4hepSimulation.py b/DDSim/DD4hepSimulation.py index d26a7ad50..dde0460c3 100644 --- a/DDSim/DD4hepSimulation.py +++ b/DDSim/DD4hepSimulation.py @@ -309,8 +309,10 @@ class DD4hepSimulation(object): kernel.registerGlobalAction(run1) kernel.runAction().add(run1) - # Configure I/O + # Configure the random seed, do it before the I/O because we might change the seed! + _rndm = self.random.initialize( DDG4, kernel, self.output.random ) + # Configure I/O if self.outputFile.endswith(".slcio"): lcOut = simple.setupLCIOOutput('LcioOutput', self.outputFile) lcOut.RunHeader = self.__addParametersToRunHeader() @@ -319,9 +321,6 @@ class DD4hepSimulation(object): actionList = [] - ##configure the random seed - rndm = self.random.initialize( DDG4, kernel, self.output.random ) - if self.enableGun: gun = DDG4.GeneratorAction(kernel,"Geant4ParticleGun/"+"Gun") self.gun.setOptions( gun ) -- GitLab