diff --git a/Generators/Pythia8B_i/Pythia8B_i/UserSelections.h b/Generators/Pythia8B_i/Pythia8B_i/UserSelections.h index 110180a996479abef33bd552cfb1158359e9d004..bd95d12717589b0ee53dd34be8cbd80bad45f1b8 100644 --- a/Generators/Pythia8B_i/Pythia8B_i/UserSelections.h +++ b/Generators/Pythia8B_i/Pythia8B_i/UserSelections.h @@ -469,7 +469,7 @@ bool Pythia8B_i::userSelection(Pythia8::Event &event, std::string userString, BsJpsiPhiAngles angles(v_Kplus, v_Muplus, v_Phi, v_Jpsi, v_Bs); CLHEP::HepRandomEngine* Rdmengine = - Pythia8B_i::p_AtRndmGenSvc->GetEngine(Pythia8_i::pythia_stream); + Pythia8B_i::p_AtRndmGenSvc->GetEngine(Pythia8_i::pythia_stream()); const double gentau = Pythia8_i::m_pythia->particleData.tau0(531); const double correctionfactor = 0.299792458; const double gentauCorrect = gentau / correctionfactor; @@ -675,7 +675,7 @@ bool Pythia8B_i::userSelection(Pythia8::Event &event, std::string userString, BsJpsiPhiAngles angles(v_Kplus, v_Muplus, v_Kstar, v_Jpsi, v_Bd); CLHEP::HepRandomEngine* Rdmengine = - Pythia8B_i::p_AtRndmGenSvc->GetEngine(Pythia8_i::pythia_stream); + Pythia8B_i::p_AtRndmGenSvc->GetEngine(Pythia8_i::pythia_stream()); const double gentau = Pythia8_i::m_pythia->particleData.tau0(511); const double correctionfactor = 0.299792458; const double gentauCorrect = gentau / correctionfactor; diff --git a/Generators/Pythia8B_i/src/Pythia8B_i.cxx b/Generators/Pythia8B_i/src/Pythia8B_i.cxx index 3752e6165c0288815533941833a7e0b98dfd619a..ddb186d0bbb50c66491e4982484a87e1710d2f10 100644 --- a/Generators/Pythia8B_i/src/Pythia8B_i.cxx +++ b/Generators/Pythia8B_i/src/Pythia8B_i.cxx @@ -167,7 +167,7 @@ StatusCode Pythia8B_i::callGenerator(){ if(useRndmGenSvc() && Pythia8B_i::p_AtRndmGenSvc){ // Save the random number seeds in the event - CLHEP::HepRandomEngine* engine = Pythia8B_i::p_AtRndmGenSvc->GetEngine(Pythia8_i::pythia_stream); + CLHEP::HepRandomEngine* engine = Pythia8B_i::p_AtRndmGenSvc->GetEngine(Pythia8_i::pythia_stream()); const long* s = engine->getSeeds(); m_seeds.clear(); m_seeds.push_back(s[0]); diff --git a/Generators/Pythia8_i/Pythia8_i/Pythia8_i.h b/Generators/Pythia8_i/Pythia8_i/Pythia8_i.h index 02396e5761b2c102506c74f3fa9d291c39bf37f5..9ca2cf026fd5297822044ea9060d53378b68ec84 100644 --- a/Generators/Pythia8_i/Pythia8_i/Pythia8_i.h +++ b/Generators/Pythia8_i/Pythia8_i/Pythia8_i.h @@ -90,9 +90,8 @@ public: virtual StatusCode genFinalize(); double pythiaVersion()const; - - static std::string pythia_stream; + static const std::string& pythia_stream(); static std::string xmlpath(); protected: @@ -166,11 +165,14 @@ private: bool m_doLHE3Weights; std::vector<std::string> m_weightCommands; std::vector<std::string> m_showerWeightNames; - + + static std::string m_pythia_stream; + ToolHandle<IPythia8Custom> m_athenaTool; static int s_allowedTunes(double version); + }; #endif diff --git a/Generators/Pythia8_i/src/Pythia8_i.cxx b/Generators/Pythia8_i/src/Pythia8_i.cxx index 44f6825be1ba8e6e4a47a796a727204d67527dad..3105d52dd8abc6364badf26efdaaa82b5fecbb3e 100644 --- a/Generators/Pythia8_i/src/Pythia8_i.cxx +++ b/Generators/Pythia8_i/src/Pythia8_i.cxx @@ -21,7 +21,7 @@ #include <limits> // Name of AtRndmGenSvc stream -std::string Pythia8_i::pythia_stream = "PYTHIA8_INIT"; +std::string Pythia8_i::m_pythia_stream = "PYTHIA8_INIT"; // fix Pythia8 shower weights change in conventions #define PYTHIA8_NWEIGHTS nWeights @@ -149,7 +149,7 @@ StatusCode Pythia8_i::genInitialize() { m_version = m_pythia->settings.parm("Pythia:versionNumber"); - Pythia8_i::pythia_stream = "PYTHIA8_INIT"; + Pythia8_i::m_pythia_stream = "PYTHIA8_INIT"; // By default add "nominal" to the list of shower weight names m_showerWeightNames.insert(m_showerWeightNames.begin(), "nominal"); @@ -251,19 +251,19 @@ StatusCode Pythia8_i::genInitialize() { if(m_atlasRndmEngine) delete m_atlasRndmEngine; m_atlasRndmEngine = new customRndm(); - m_atlasRndmEngine->init(atRndmGenSvc(),Pythia8_i::pythia_stream); + m_atlasRndmEngine->init(atRndmGenSvc(),Pythia8_i::m_pythia_stream); m_pythia->setRndmEnginePtr(m_atlasRndmEngine); // Save the PYTHIA_INIT stream seeds.... - CLHEP::HepRandomEngine* engine = atRndmGenSvc().GetEngine(Pythia8_i::pythia_stream); + CLHEP::HepRandomEngine* engine = atRndmGenSvc().GetEngine(Pythia8_i::m_pythia_stream); const long* sip = engine->getSeeds(); long int si1 = sip[0]; long int si2 = sip[1]; - atRndmGenSvc().CreateStream(si1, si2, Pythia8_i::pythia_stream); - Pythia8_i::pythia_stream = "PYTHIA8"; - m_atlasRndmEngine->m_stream=Pythia8_i::pythia_stream; + atRndmGenSvc().CreateStream(si1, si2, Pythia8_i::m_pythia_stream); + Pythia8_i::m_pythia_stream = "PYTHIA8"; + m_atlasRndmEngine->m_stream=Pythia8_i::m_pythia_stream; }else{ ATH_MSG_INFO(" !!!!!!!!!!!! WARNING ON PYTHIA RANDOM NUMBERS !!!!!!!!!! "); @@ -386,7 +386,7 @@ StatusCode Pythia8_i::callGenerator(){ if(m_useRndmGenSvc){ // Save the random number seeds in the event - CLHEP::HepRandomEngine* engine = atRndmGenSvc().GetEngine(Pythia8_i::pythia_stream); + CLHEP::HepRandomEngine* engine = atRndmGenSvc().GetEngine(Pythia8_i::m_pythia_stream); const long* s = engine->getSeeds(); m_seeds.clear(); m_seeds.push_back(s[0]); @@ -791,12 +791,15 @@ void Pythia8_i::addLHEToHepMC(HepMC::GenEvent *evt){ } //////////////////////////////////////////////////////////////////////// - - double Pythia8_i::pythiaVersion()const{ return m_version; } +//////////////////////////////////////////////////////////////////////// +const std::string& Pythia8_i::pythia_stream() { + return m_pythia_stream; +} + //////////////////////////////////////////////////////////////////////// std::string Pythia8_i::xmlpath(){ diff --git a/Simulation/FastSimulation/FastChainPileup/FastChainPileup/ATLAS_CHECK_THREAD_SAFETY b/Simulation/FastSimulation/FastChainPileup/FastChainPileup/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..43e73087e2e7336d21d0f3beb674216435afe501 --- /dev/null +++ b/Simulation/FastSimulation/FastChainPileup/FastChainPileup/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Simulation/FastSimulation/FastChainPileup diff --git a/Simulation/FastSimulation/FastChainPileup/FastChainPileup/Samplers.h b/Simulation/FastSimulation/FastChainPileup/FastChainPileup/Samplers.h index 2f19b5af741ded0e8f04b51e05db9f7f7b3a9db5..b7575d7dc5dd508231154a910e299f668e5b801c 100644 --- a/Simulation/FastSimulation/FastChainPileup/FastChainPileup/Samplers.h +++ b/Simulation/FastSimulation/FastChainPileup/FastChainPileup/Samplers.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // Helper for MultiParticleGunPileup @@ -41,7 +41,6 @@ class MomSampler { ~MomSampler(){}; virtual TLorentzVector shoot() {return m_val;}; TLorentzVector m_val; - static TRandom m_random; ConstSampler * m_mass; }; diff --git a/Simulation/FastSimulation/FastChainPileup/src/MultiPy8Pileup.cxx b/Simulation/FastSimulation/FastChainPileup/src/MultiPy8Pileup.cxx index dde8ab93aa6e35cf623511d0bbcc64d33259bd06..00b8e8b5209fb20e56393d385c462ad56d19dbef 100644 --- a/Simulation/FastSimulation/FastChainPileup/src/MultiPy8Pileup.cxx +++ b/Simulation/FastSimulation/FastChainPileup/src/MultiPy8Pileup.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // MultiPY8Pileup.cxx - extension of Pythia8_i to generate multiple pileup @@ -80,7 +80,7 @@ StatusCode MultiPy8Pileup::genInitialize() { StatusCode MultiPy8Pileup::callGenerator() { // initialise random generators the first time - delayed after Pythia init if ( !m_randomEngine) - m_randomEngine = atRndmGenSvc().GetEngine( Pythia8_i::pythia_stream ); + m_randomEngine = atRndmGenSvc().GetEngine( Pythia8_i::pythia_stream() ); // decide how many events to generate