From 3e1c9761c0af06ebc61cf1f22eadb9f9c4376afb Mon Sep 17 00:00:00 2001 From: ChrisJChang Date: Mon, 23 Mar 2026 16:58:44 +0100 Subject: [PATCH] Fix bugs in the Initial cross-section, and pythia banner printing. --- .../ColliderBit/colliders/Pythia8/Py8Collider.hpp | 2 +- .../gambit/ColliderBit/generateEventPy8Collider.hpp | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ColliderBit/include/gambit/ColliderBit/colliders/Pythia8/Py8Collider.hpp b/ColliderBit/include/gambit/ColliderBit/colliders/Pythia8/Py8Collider.hpp index c5461dc70e..be21d480ed 100644 --- a/ColliderBit/include/gambit/ColliderBit/colliders/Pythia8/Py8Collider.hpp +++ b/ColliderBit/include/gambit/ColliderBit/colliders/Pythia8/Py8Collider.hpp @@ -178,7 +178,7 @@ namespace Gambit // Create new _pythiaInstance from _pythiaBase if (_pythiaInstance) delete _pythiaInstance; - _pythiaInstance = new PythiaT(_pythiaBase->settings, _pythiaBase->particleData); + _pythiaInstance = new PythiaT(_pythiaBase->settings, _pythiaBase->particleData, false); // Send along the SLHAea::Coll pointer, if it exists if (slhaea) _pythiaInstance->slhaInterface.slha.setSLHAea(slhaea); diff --git a/ColliderBit/include/gambit/ColliderBit/generateEventPy8Collider.hpp b/ColliderBit/include/gambit/ColliderBit/generateEventPy8Collider.hpp index f64d689528..255b14dc81 100644 --- a/ColliderBit/include/gambit/ColliderBit/generateEventPy8Collider.hpp +++ b/ColliderBit/include/gambit/ColliderBit/generateEventPy8Collider.hpp @@ -69,7 +69,7 @@ namespace Gambit static bool first = true; static str pythia_doc_path; - PythiaT pythia; + thread_local PythiaT pythia; // Setup the Pythia documentation path and print the banner once if (first) @@ -129,7 +129,7 @@ namespace Gambit std::map combined_process_xsec; std::map combined_process_xsecErr; - #pragma omp parallel firstprivate(pythia, pythiaOptions) + #pragma omp parallel firstprivate(pythiaOptions) { // Add a thread-specific seed to this thread's copy of the Pythia options str seed = std::to_string(int(Random::draw() * 899990000.)); @@ -137,6 +137,7 @@ namespace Gambit try { + pythia.clear(); pythia.init(pythia_doc_path, pythiaOptions, &slha); } catch (...) @@ -146,6 +147,7 @@ namespace Gambit pythiaOptions.push_back("Random:seed = " + std::to_string(newSeedBase)); try { + pythia.clear(); pythia.init(pythia_doc_path, pythiaOptions, &slha); } catch (...) @@ -303,7 +305,7 @@ namespace Gambit void NAME(initialxsec_container& result) \ { \ using namespace Pipes::NAME; \ - static SLHAstruct slha = *Dep::SpectrumAndDecaysForPythia; \ + SLHAstruct slha = *Dep::SpectrumAndDecaysForPythia; \ \ PerformInitialCrossSection_Pythia(result, slha, "", *runOptions); \ } @@ -312,7 +314,7 @@ namespace Gambit void NAME(initialxsec_container& result) \ { \ using namespace Pipes::NAME; \ - static SLHAstruct slha = *Dep::SpectrumAndDecaysForPythia; \ + SLHAstruct slha = *Dep::SpectrumAndDecaysForPythia; \ \ PerformInitialCrossSection_Pythia(result, slha, #MODEL_EXTENSION, *runOptions); \ }