10 #include "G4PhysicalVolumeStore.hh" 13 : m_pGeoFromDD4hep(iConfig.getParameter<
bool>(
"g4GeometryDD4hepSource")),
19 <<
"OscarMTMasterThread: creating master thread DD4hep: " <<
m_pGeoFromDD4hep;
25 std::unique_ptr<CustomUIsession> uiSession;
30 edm::LogVerbatim(
"SimG4CoreApplication") <<
"OscarMTMasterThread: initializing RunManagerMT";
33 uiSession = std::make_unique<CustomUIsession>();
40 bool isG4Alive =
false;
44 edm::LogVerbatim(
"OscarMTMasterThread") <<
"Master thread: State loop, notify main thread";
49 edm::LogVerbatim(
"OscarMTMasterThread") <<
"Master thread: State loop, starting wait";
57 edm::LogVerbatim(
"OscarMTMasterThread") <<
"Master thread: Initializing Geant4";
64 G4PhysicalVolumeStore::Clean();
68 edm::LogVerbatim(
"OscarMTMasterThread") <<
"Master thread: Breaking out of state loop";
70 throw cms::Exception(
"LogicError") <<
"OscarMTMasterThread: Geant4 is still alive, master thread " 71 <<
"state must be set to EndRun before Destruct";
75 <<
"OscarMTMasterThread: Illegal master thread state " <<
static_cast<int>(
m_masterThreadState);
81 edm::LogVerbatim(
"SimG4CoreApplication") <<
"OscarMTMasterThread: start RunManagerMT destruction";
86 edm::LogVerbatim(
"SimG4CoreApplication") <<
"OscarMTMasterThread: physics and geometry are cleaned";
88 edm::LogVerbatim(
"SimG4CoreApplication") <<
"OscarMTMasterThread: Master thread is finished";
94 LogDebug(
"OscarMTMasterThread") <<
"Main thread: Signal master for initialization";
98 edm::LogVerbatim(
"SimG4CoreApplication") <<
"OscarMTMasterThread: Master thread is constructed";
123 edm::LogVerbatim(
"SimG4CoreApplication") <<
"OscarMTMasterThread::beginRun";
137 edm::LogVerbatim(
"SimG4CoreApplication") <<
"OscarMTMasterThread: Signal master for BeginRun";
142 edm::LogVerbatim(
"SimG4CoreApplication") <<
"OscarMTMasterThread: finish BeginRun";
152 edm::LogVerbatim(
"SimG4CoreApplication") <<
"OscarMTMasterThread: Signal master for EndRun";
156 edm::LogVerbatim(
"SimG4CoreApplication") <<
"OscarMTMasterThread: finish EndRun";
163 edm::LogVerbatim(
"SimG4CoreApplication") <<
"OscarMTMasterThread::stopTread: stop main thread";
167 edm::LogVerbatim(
"SimG4CoreApplication") <<
"OscarMTMasterThread::stopTread: notify";
171 edm::LogVerbatim(
"SimG4CoreApplication") <<
"OscarMTMasterThread::stopTread: is done";
Log< level::Info, true > LogVerbatim
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
std::mutex m_protectMutex
HepPDT::ParticleDataTable ParticleDataTable
std::shared_ptr< RunManagerMT > m_runManagerMaster
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > m_DD4hep
void beginRun(const edm::EventSetup &iSetup) const
std::thread m_masterThread
edm::ESGetToken< DDCompactView, IdealGeometryRecord > m_DDD
Compact representation of the geometrical detector hierarchy.
ThreadState m_masterThreadState
const bool m_pGeoFromDD4hep
const cms::DDCompactView * m_pDD4hep
std::condition_variable m_notifyMasterCv
OscarMTMasterThread(const edm::ParameterSet &iConfig)
edm::ESGetToken< HepPDT::ParticleDataTable, PDTRecord > m_PDT
const DDCompactView * m_pDDD
void callConsumes(edm::ConsumesCollector &&iC) const
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
const HepPDT::ParticleDataTable * m_pTable
std::condition_variable m_notifyMainCv