From f648d86bec9ec2bc0915acb670eb3c76c45d35c4 Mon Sep 17 00:00:00 2001 From: Marilena Bandieramonte <marilena.bandieramonte@cern.ch> Date: Mon, 16 Nov 2020 11:14:47 +0100 Subject: [PATCH] Use always the same random number seed for the Pythia generator, to make the simulation reproducible - benchmarking purposes --- FullSimLight/src/PythiaPrimaryGeneratorAction.cc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/FullSimLight/src/PythiaPrimaryGeneratorAction.cc b/FullSimLight/src/PythiaPrimaryGeneratorAction.cc index c840ed9af..37aecd0ab 100644 --- a/FullSimLight/src/PythiaPrimaryGeneratorAction.cc +++ b/FullSimLight/src/PythiaPrimaryGeneratorAction.cc @@ -57,6 +57,19 @@ PythiaPrimaryGeneratorAction::PythiaPrimaryGeneratorAction() { if (access(config, R_OK) == 0) { pythia.readFile(config); } else { + /* + flag name="Pythia:setSeed" default="off" + Indicates whether a user-set seed should be used every time the Pythia::init routine is called. If off, the random number generator is initialized with its default seed at the beginning of the run, and never again. If on, each new Pythia::init call (should several be made in the same run) results in the random number being re-initialized, thereby possibly starting over with the same sequence, if you do not watch out. + + mode name="Pythia:seed" default="-1" max="900000000" + The seed to be used, if setSeed is on. + A negative value gives the default seed, + a value 0 gives a random seed based on the time, and + a value between 1 and 900,000,000 a unique different random number sequence. + */ + pythia.readString("Random:setSeed = on"); + // use a reproducible seed: always the same results for benchmarks. + pythia.readString("Random:seed = 1234"); for (const auto str : pythia_defaults) pythia.readString(str); -- GitLab