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 HepPDT {
25  class ParticleDataTable;
26 }
27 
29 public:
30  explicit OscarMTMasterThread(const edm::ParameterSet& iConfig);
32 
33  void beginRun(const edm::EventSetup& iSetup) const;
34  void endRun() const;
35  void stopThread();
36 
37  inline RunManagerMT& runManagerMaster() const { return *m_runManagerMaster; }
38  inline RunManagerMT *runManagerMasterPtr() const { return m_runManagerMaster.get(); }
39 
40 private:
41  void readES(const edm::EventSetup& iSetup) const;
42 
43  enum class ThreadState {
44  NotExist=0, BeginRun=1, EndRun=2, Destruct=3
45  };
46 
47  const bool m_pUseMagneticField;
48 
49  std::shared_ptr<RunManagerMT> m_runManagerMaster;
50  std::thread m_masterThread;
51 
52  // ES products needed for Geant4 initialization
55  mutable const DDCompactView *m_pDD;
56  mutable const MagneticField *m_pMF;
58 
61  mutable std::condition_variable m_notifyMasterCv;
62  mutable std::condition_variable m_notifyMainCv;
63 
65 
66  mutable bool m_masterCanProceed;
67  mutable bool m_mainCanProceed;
68  mutable bool m_firstRun;
69  mutable bool m_stopped;
70 };
71 
72 
73 #endif
static boost::mutex mutex
Definition: Proxy.cc:11
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
RunManagerMT & runManagerMaster() const
std::condition_variable m_notifyMasterCv
RunManagerMT * runManagerMasterPtr() const
const DDCompactView * m_pDD
HLT enums.
edm::ESWatcher< IdealMagneticFieldRecord > idealMagRcdWatcher_
const MagneticField * m_pMF
const HepPDT::ParticleDataTable * m_pTable
std::condition_variable m_notifyMainCv