From a27a1d94c171acfd8a648c131cfdd08faed0c455 Mon Sep 17 00:00:00 2001 From: msmk <msmk@cern.ch> Date: Wed, 17 Jan 2018 13:41:07 +0100 Subject: [PATCH 1/6] pythia8: set rngs --- Examples/Fatras/Pythia8/FatrasPythia8.cpp | 16 ++++++++++------ .../Fatras/Pythia8DD4hep/FatrasPythia8DD4hep.cpp | 16 ++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Examples/Fatras/Pythia8/FatrasPythia8.cpp b/Examples/Fatras/Pythia8/FatrasPythia8.cpp index 1d11464e0..d1cae1706 100644 --- a/Examples/Fatras/Pythia8/FatrasPythia8.cpp +++ b/Examples/Fatras/Pythia8/FatrasPythia8.cpp @@ -9,10 +9,12 @@ /// @file /// @brief Fatras example with a pythia8 generator and the generic detector -#include <ACTS/Detector/TrackingGeometry.hpp> -#include <ACTS/Utilities/Units.hpp> #include <boost/program_options.hpp> #include <cstdlib> + +#include <ACTS/Detector/TrackingGeometry.hpp> +#include <ACTS/Utilities/Units.hpp> + #include "ACTFW/Framework/StandardOptions.hpp" #include "ACTFW/GenericDetector/BuildGenericDetector.hpp" #include "ACTFW/Plugins/BField/BFieldOptions.hpp" @@ -59,8 +61,14 @@ main(int argc, char* argv[]) std::string outputDir = ""; // read and create the magnetic field auto bField = FW::Options::readBField<po::variables_map>(vm); + // Create the random number engine + auto randomNumbersCfg + = FW::Options::readRandomNumbersConfig<po::variables_map>(vm); + auto randomNumbers = std::make_shared<FW::RandomNumbersSvc>(randomNumbersCfg); // now read the pythia8 configs auto pythia8Configs = FW::Options::readPythia8Config<po::variables_map>(vm); + pythia8Configs.first.randomNumbers = randomNumbers; + pythia8Configs.second.randomNumbers = randomNumbers; // the hard scatter generator auto hsPythiaGenerator = std::make_shared<FW::GPythia8::Generator>( pythia8Configs.first, @@ -69,10 +77,6 @@ main(int argc, char* argv[]) auto puPythiaGenerator = std::make_shared<FW::GPythia8::Generator>( pythia8Configs.second, Acts::getDefaultLogger("PileUpPythia8Generator", logLevel)); - // Create the random number engine - auto randomNumbersCfg - = FW::Options::readRandomNumbersConfig<po::variables_map>(vm); - auto randomNumbers = std::make_shared<FW::RandomNumbersSvc>(randomNumbersCfg); // Create the barcode service FW::BarcodeSvc::Config barcodeSvcCfg; auto barcodeSvc = std::make_shared<FW::BarcodeSvc>( diff --git a/Examples/Fatras/Pythia8DD4hep/FatrasPythia8DD4hep.cpp b/Examples/Fatras/Pythia8DD4hep/FatrasPythia8DD4hep.cpp index b41f5d7db..5bbab48fa 100644 --- a/Examples/Fatras/Pythia8DD4hep/FatrasPythia8DD4hep.cpp +++ b/Examples/Fatras/Pythia8DD4hep/FatrasPythia8DD4hep.cpp @@ -9,11 +9,13 @@ /// @file /// @brief Fatras example with pythia8 generator and a DD4hep detector -#include <ACTS/Detector/TrackingGeometry.hpp> -#include <ACTS/Utilities/Units.hpp> #include <boost/program_options.hpp> #include <cstdlib> #include <iostream> + +#include <ACTS/Detector/TrackingGeometry.hpp> +#include <ACTS/Utilities/Units.hpp> + #include "ACTFW/Framework/StandardOptions.hpp" #include "ACTFW/Plugins/BField/BFieldOptions.hpp" #include "ACTFW/Plugins/DD4hep/DD4hepDetectorOptions.hpp" @@ -63,8 +65,14 @@ main(int argc, char* argv[]) std::string outputDir = ""; // now read the bfield options auto bField = FW::Options::readBField<po::variables_map>(vm); + // Create the random number engine + auto randomNumbersCfg + = FW::Options::readRandomNumbersConfig<po::variables_map>(vm); + auto randomNumbers = std::make_shared<FW::RandomNumbersSvc>(randomNumbersCfg); // now read the pythia8 configs auto pythia8Configs = FW::Options::readPythia8Config<po::variables_map>(vm); + pythia8Configs.first.randomNumbers = randomNumbers; + pythia8Configs.second.randomNumbers = randomNumbers; // the hard scatter generator auto hsPythiaGenerator = std::make_shared<FW::GPythia8::Generator>( pythia8Configs.first, @@ -73,10 +81,6 @@ main(int argc, char* argv[]) auto puPythiaGenerator = std::make_shared<FW::GPythia8::Generator>( pythia8Configs.second, Acts::getDefaultLogger("PileUpPythia8Generator", logLevel)); - // Create the random number engine - auto randomNumbersCfg - = FW::Options::readRandomNumbersConfig<po::variables_map>(vm); - auto randomNumbers = std::make_shared<FW::RandomNumbersSvc>(randomNumbersCfg); // Create the barcode service FW::BarcodeSvc::Config barcodeSvcCfg; auto barcodeSvc = std::make_shared<FW::BarcodeSvc>( -- GitLab From f00aebaf761dab1f4789fb62b0579f644e97e284 Mon Sep 17 00:00:00 2001 From: msmk <msmk@cern.ch> Date: Wed, 17 Jan 2018 13:46:50 +0100 Subject: [PATCH 2/6] ci: add test template and add fatras --- .gitlab-ci.yml | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6af8703c6..705e60bd1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -58,27 +58,48 @@ build: paths: - install -hello_world: +# template for test jobs +.test: &template_test stage: test tags: - cvmfs - script: + image: gitlab-registry.cern.ch/acts/machines/slc6:latest + before_script: + - set +e && source CI/setup_lcg92.sh; set -e - source install/bin/setup.sh + +hello_world: + <<: *template_test + script: - ACTFWHelloWorldExample generic_extrapolation: - stage: test - tags: - - cvmfs + <<: *template_test script: - - source install/bin/setup.sh - ACTFWGenericExtrapolationExample +fatras_gun: + <<: *template_test + script: + - ACTFWFatrasGun + +fatras_gun_dd4hep: + <<: *template_test + script: + - ACTFWFatrasGunDD4hep + +fatras_pythia8: + <<: *template_test + script: + - ACTFWFatrasPythia8 + +fatras_pythia8_dd4hep: + <<: *template_test + script: + - ACTFWFatrasPythia8DD4hep + reproducibility_generic_extrapolation: - stage: test - tags: - - cvmfs + <<: *template_test script: - - source install/bin/setup.sh - cd scripts - ./testReproducibility.sh GenericExtrapolation excells_charged -- GitLab From 157981b6b89a473b07ac36304bfe1df9a67035b1 Mon Sep 17 00:00:00 2001 From: msmk <msmk@cern.ch> Date: Wed, 17 Jan 2018 13:51:55 +0100 Subject: [PATCH 3/6] pythia8: clang-format --- Examples/Fatras/Pythia8/FatrasPythia8.cpp | 2 +- Examples/Fatras/Pythia8DD4hep/FatrasPythia8DD4hep.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples/Fatras/Pythia8/FatrasPythia8.cpp b/Examples/Fatras/Pythia8/FatrasPythia8.cpp index d1cae1706..fdaa53f69 100644 --- a/Examples/Fatras/Pythia8/FatrasPythia8.cpp +++ b/Examples/Fatras/Pythia8/FatrasPythia8.cpp @@ -67,7 +67,7 @@ main(int argc, char* argv[]) auto randomNumbers = std::make_shared<FW::RandomNumbersSvc>(randomNumbersCfg); // now read the pythia8 configs auto pythia8Configs = FW::Options::readPythia8Config<po::variables_map>(vm); - pythia8Configs.first.randomNumbers = randomNumbers; + pythia8Configs.first.randomNumbers = randomNumbers; pythia8Configs.second.randomNumbers = randomNumbers; // the hard scatter generator auto hsPythiaGenerator = std::make_shared<FW::GPythia8::Generator>( diff --git a/Examples/Fatras/Pythia8DD4hep/FatrasPythia8DD4hep.cpp b/Examples/Fatras/Pythia8DD4hep/FatrasPythia8DD4hep.cpp index 5bbab48fa..9e19ddd71 100644 --- a/Examples/Fatras/Pythia8DD4hep/FatrasPythia8DD4hep.cpp +++ b/Examples/Fatras/Pythia8DD4hep/FatrasPythia8DD4hep.cpp @@ -71,7 +71,7 @@ main(int argc, char* argv[]) auto randomNumbers = std::make_shared<FW::RandomNumbersSvc>(randomNumbersCfg); // now read the pythia8 configs auto pythia8Configs = FW::Options::readPythia8Config<po::variables_map>(vm); - pythia8Configs.first.randomNumbers = randomNumbers; + pythia8Configs.first.randomNumbers = randomNumbers; pythia8Configs.second.randomNumbers = randomNumbers; // the hard scatter generator auto hsPythiaGenerator = std::make_shared<FW::GPythia8::Generator>( -- GitLab From 6cc883f03ecf8f1afc44f51aa33cb869c18d0a12 Mon Sep 17 00:00:00 2001 From: msmk <msmk@cern.ch> Date: Wed, 17 Jan 2018 14:07:25 +0100 Subject: [PATCH 4/6] ci: force single-thread on all tests --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 705e60bd1..50401c98b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -63,6 +63,8 @@ build: stage: test tags: - cvmfs + variables: + OMP_NUM_THREADS: 1 image: gitlab-registry.cern.ch/acts/machines/slc6:latest before_script: - set +e && source CI/setup_lcg92.sh; set -e -- GitLab From 43dbd6f0a361b744331e7ca5cee77f13677697aa Mon Sep 17 00:00:00 2001 From: msmk <msmk@cern.ch> Date: Wed, 17 Jan 2018 14:30:28 +0100 Subject: [PATCH 5/6] ci: disable pythia8 jobs --- .gitlab-ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 50401c98b..9b9db8502 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -90,15 +90,15 @@ fatras_gun_dd4hep: script: - ACTFWFatrasGunDD4hep -fatras_pythia8: - <<: *template_test - script: - - ACTFWFatrasPythia8 +#fatras_pythia8: +# <<: *template_test +# script: +# - ACTFWFatrasPythia8 -fatras_pythia8_dd4hep: - <<: *template_test - script: - - ACTFWFatrasPythia8DD4hep +#fatras_pythia8_dd4hep: +# <<: *template_test +# script: +# - ACTFWFatrasPythia8DD4hep reproducibility_generic_extrapolation: <<: *template_test -- GitLab From 2660a26c11ef0db1170c46aad5b9ae54751c2fa4 Mon Sep 17 00:00:00 2001 From: msmk <msmk@cern.ch> Date: Wed, 17 Jan 2018 17:20:43 +0100 Subject: [PATCH 6/6] pythia8: disable framework rng --- Plugins/Pythia8/ACTFW/Plugins/Pythia8/Generator.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Plugins/Pythia8/ACTFW/Plugins/Pythia8/Generator.cpp b/Plugins/Pythia8/ACTFW/Plugins/Pythia8/Generator.cpp index 1d3baf4d6..609490bcf 100644 --- a/Plugins/Pythia8/ACTFW/Plugins/Pythia8/Generator.cpp +++ b/Plugins/Pythia8/ACTFW/Plugins/Pythia8/Generator.cpp @@ -47,6 +47,10 @@ FW::GPythia8::Generator::Generator(const FW::GPythia8::Generator::Config& cfg, ACTS_VERBOSE("Setting string " << pString << " to Pythia8"); m_pythia8.readString(pString.c_str()); } + // fix seed + m_pythia8.readString("Random:setSeed = on"); + m_pythia8.readString( + ("Random:seed = " + std::to_string(m_cfg.randomNumbers->seed())).c_str()); // Set arguments in Settings database. m_pythia8.settings.mode("Beams:idA", m_cfg.pdgBeam0); @@ -75,9 +79,10 @@ FW::GPythia8::Generator::read(std::vector<Acts::ProcessVertex>& processVertices, // pythia8 is not thread safe and needs to be protected std::lock_guard<std::mutex> lock(m_read_mutex); + // TODO 2018-01-18 msmk: does not work for unknown reason // use per-event random number generator - FrameworkRndmEngine rndm(m_cfg.randomNumbers->spawnGenerator(*context)); - m_pythia8.setRndmEnginePtr(&rndm); + // FrameworkRndmEngine rndm(m_cfg.randomNumbers->spawnGenerator(*context)); + // m_pythia8.setRndmEnginePtr(&rndm); // skip if needed if (skip) { -- GitLab