CMS 3D CMS Logo

OscarMTMasterThread.h
Go to the documentation of this file.
1 #ifndef SimG4Core_OscarMTMasterThread_H
2 #define SimG4Core_OscarMTMasterThread_H
3 
6 
9 
10 #include <memory>
11 #include <thread>
12 #include <mutex>
13 #include <condition_variable>
14 
15 namespace edm {
16  class EventSetup;
17 }
18 
19 class RunManagerMT;
20 
21 class DDCompactView;
22 class MagneticField;
23 
24 namespace cms {
25  class DDCompactView;
26 }
27 
28 namespace HepPDT {
29  class ParticleDataTable;
30 }
31 
33 public:
34  explicit OscarMTMasterThread(const edm::ParameterSet& iConfig);
36 
37  void beginRun(const edm::EventSetup& iSetup) const;
38  void endRun() const;
39  void stopThread();
40 
41  inline RunManagerMT& runManagerMaster() const { return *m_runManagerMaster; }
42  inline RunManagerMT* runManagerMasterPtr() const { return m_runManagerMaster.get(); }
43 
44 private:
45  void readES(const edm::EventSetup& iSetup) const;
46 
47  enum class ThreadState { NotExist = 0, BeginRun = 1, EndRun = 2, Destruct = 3 };
48 
49  const bool m_pGeoFromDD4hep;
50 
51  std::shared_ptr<RunManagerMT> m_runManagerMaster;
52  std::thread m_masterThread;
53 
54  // ES products needed for Geant4 initialization
57  mutable const DDCompactView* m_pDD;
58  mutable const cms::DDCompactView* m_pDD4hep;
60 
63  mutable std::condition_variable m_notifyMasterCv;
64  mutable std::condition_variable m_notifyMainCv;
65 
67 
68  mutable bool m_masterCanProceed;
69  mutable bool m_mainCanProceed;
70  mutable bool m_firstRun;
71  mutable bool m_stopped;
72 };
73 
74 #endif
static boost::mutex mutex
Definition: Proxy.cc:9
HepPDT::ParticleDataTable ParticleDataTable
std::shared_ptr< RunManagerMT > m_runManagerMaster
edm::ESWatcher< IdealGeometryRecord > idealGeomRcdWatcher_
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
ThreadState m_masterThreadState
const cms::DDCompactView * m_pDD4hep
RunManagerMT & runManagerMaster() const
std::condition_variable m_notifyMasterCv
RunManagerMT * runManagerMasterPtr() const
Namespace of DDCMS conversion namespace.
const DDCompactView * m_pDD
HLT enums.
edm::ESWatcher< IdealMagneticFieldRecord > idealMagRcdWatcher_
const HepPDT::ParticleDataTable * m_pTable
std::condition_variable m_notifyMainCv