test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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: LHEProxy.cc:11
HepPDT::ParticleDataTable ParticleDataTable
std::shared_ptr< RunManagerMT > m_runManagerMaster
edm::ESWatcher< IdealGeometryRecord > idealGeomRcdWatcher_
type of data representation of DDCompactView
Definition: DDCompactView.h:90
ThreadState m_masterThreadState
void beginRun(const edm::EventSetup &iSetup) const
RunManagerMT & runManagerMaster() const
std::condition_variable m_notifyMasterCv
RunManagerMT * runManagerMasterPtr() const
void readES(const edm::EventSetup &iSetup) const
const DDCompactView * m_pDD
OscarMTMasterThread(const edm::ParameterSet &iConfig)
edm::ESWatcher< IdealMagneticFieldRecord > idealMagRcdWatcher_
const MagneticField * m_pMF
const HepPDT::ParticleDataTable * m_pTable
std::condition_variable m_notifyMainCv