8 #include "G4RegionStore.hh"
9 #include "G4FastSimulationManager.hh"
28 ATH_MSG_ERROR(
"Trying to create a Fast Simulation Model which already exists!");
29 return StatusCode::FAILURE;
33 auto* fastsimmodel = makeFastSimModel();
41 G4RegionStore* regionStore = G4RegionStore::GetInstance();
42 bool missedOne =
false;
45 for (
auto* areg : *regionStore){
46 if (myreg.data()==areg->GetName()){
48 G4FastSimulationManager* theFastSimulationManager = areg->GetFastSimulationManager();
51 if ( theFastSimulationManager == 0 ) theFastSimulationManager =
new G4FastSimulationManager(areg);
53 theFastSimulationManager->ActivateFastSimulationModel(
getFastSimModel()->GetName());
66 ATH_MSG_ERROR(
"Failed to assign at least one volume to Fast Simulation Model " <<
name() );
67 return StatusCode::FAILURE;
70 return StatusCode::SUCCESS;
75 #ifdef G4MULTITHREADED
77 const auto tid = std::this_thread::get_id();
79 auto fastsimmodelPair = m_fastsimmodelThreadMap.find(tid);
80 if(fastsimmodelPair == m_fastsimmodelThreadMap.end())
return nullptr;
81 return fastsimmodelPair->second;
89 #ifdef G4MULTITHREADED
91 const auto tid = std::this_thread::get_id();
92 ATH_MSG_DEBUG(
"Creating and registering FastSimModel " << fastsimmodel <<
" in thread " << tid);
93 m_fastsimmodelThreadMap.insert( std::make_pair(tid, fastsimmodel) );
101 #ifdef G4MULTITHREADED
102 for(
auto& threadMapPair : m_fastsimmodelThreadMap)
104 auto fastSimModel = threadMapPair.second;
108 m_fastsimmodelThreadMap.clear();