diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6af8703c6b7cfbbd85b28decdf2e781dfa2864df..9b9db85022b09bf10a75a0d28a51a9749e6d6f30 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -58,27 +58,50 @@ build: paths: - install -hello_world: +# template for test jobs +.test: &template_test stage: test tags: - cvmfs - script: + 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 - 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 diff --git a/Examples/Fatras/Pythia8/FatrasPythia8.cpp b/Examples/Fatras/Pythia8/FatrasPythia8.cpp index 1d11464e05258b76f45d9c6f2fb4578caa1c508d..fdaa53f6997ee7beb8a28b4fcbe2b4d3ab4da102 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 b41f5d7dbf235734c765b9ddc6b6cf001bad0ddc..9e19ddd71a95636a1b542cbdc869077005098564 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>( diff --git a/Plugins/Pythia8/ACTFW/Plugins/Pythia8/Generator.cpp b/Plugins/Pythia8/ACTFW/Plugins/Pythia8/Generator.cpp index 1d3baf4d605655c33b756a37adb0ce0ba9289c14..609490bcfd7da921920f84cc72a1e37eb999dcfa 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) {