src
SimG4Core
Application
interface
OscarMTMasterThread.h
Go to the documentation of this file.
1
#ifndef SimG4Core_OscarMTMasterThread_H
2
#define SimG4Core_OscarMTMasterThread_H
3
4
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
5
#include "
FWCore/Framework/interface/ESWatcher.h
"
6
7
#include "
DetectorDescription/Core/interface/DDCompactView.h
"
8
#include "
DetectorDescription/DDCMS/interface/DDCompactView.h
"
9
#include "
Geometry/Records/interface/IdealGeometryRecord.h
"
10
11
#include "HepPDT/ParticleDataTable.hh"
12
#include "
SimGeneral/HepPDTRecord/interface/PDTRecord.h
"
13
14
#include <memory>
15
#include <thread>
16
#include <mutex>
17
#include <condition_variable>
18
19
namespace
edm
{
20
class
EventSetup
;
21
class
ConsumesCollector;
22
}
// namespace edm
23
24
class
RunManagerMT
;
25
26
class
DDCompactView
;
27
class
MagneticField
;
28
29
namespace
cms
{
30
class
DDCompactView
;
31
}
32
33
namespace
HepPDT
{
34
class
ParticleDataTable
;
35
}
36
37
class
OscarMTMasterThread
{
38
public
:
39
explicit
OscarMTMasterThread
(
const
edm::ParameterSet
& iConfig);
40
~OscarMTMasterThread
();
41
42
void
beginRun
(
const
edm::EventSetup
& iSetup)
const
;
43
void
endRun
()
const
;
44
void
stopThread
();
45
46
void
callConsumes
(
edm::ConsumesCollector
&& iC)
const
;
47
48
inline
RunManagerMT
&
runManagerMaster
()
const
{
return
*
m_runManagerMaster
; }
49
inline
RunManagerMT
*
runManagerMasterPtr
()
const
{
return
m_runManagerMaster
.get(); }
50
51
private
:
52
enum class
ThreadState
{
NotExist
= 0,
BeginRun
= 1,
EndRun
= 2,
Destruct
= 3 };
53
54
const
bool
m_pGeoFromDD4hep
;
55
56
std::shared_ptr<RunManagerMT>
m_runManagerMaster
;
57
std::thread
m_masterThread
;
58
59
// ES products needed for Geant4 initialization
60
mutable
const
DDCompactView
*
m_pDDD
=
nullptr
;
61
mutable
const
cms::DDCompactView
*
m_pDD4hep
=
nullptr
;
62
mutable
const
HepPDT::ParticleDataTable
*
m_pTable
=
nullptr
;
63
mutable
edm::ESGetToken<DDCompactView, IdealGeometryRecord>
m_DDD
;
64
mutable
edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord>
m_DD4hep
;
65
mutable
edm::ESGetToken<HepPDT::ParticleDataTable, PDTRecord>
m_PDT
;
66
67
// status flags
68
mutable
std::mutex
m_protectMutex
;
69
mutable
std::mutex
m_threadMutex
;
70
mutable
std::condition_variable
m_notifyMasterCv
;
71
mutable
std::condition_variable
m_notifyMainCv
;
72
73
mutable
ThreadState
m_masterThreadState
;
74
75
mutable
bool
m_hasToken
=
false
;
76
mutable
bool
m_masterCanProceed
=
false
;
77
mutable
bool
m_mainCanProceed
=
false
;
78
mutable
bool
m_firstRun
=
true
;
79
mutable
bool
m_stopped
=
false
;
80
};
81
82
#endif
OscarMTMasterThread::stopThread
void stopThread()
Definition:
OscarMTMasterThread.cc:159
cms::DDCompactView
Definition:
DDCompactView.h:31
OscarMTMasterThread::runManagerMasterPtr
RunManagerMT * runManagerMasterPtr() const
Definition:
OscarMTMasterThread.h:49
OscarMTMasterThread::m_protectMutex
std::mutex m_protectMutex
Definition:
OscarMTMasterThread.h:68
OscarMTMasterThread::ThreadState::NotExist
ESWatcher.h
ParticleDataTable
HepPDT::ParticleDataTable ParticleDataTable
Definition:
ParticleDataTable.h:8
OscarMTMasterThread::m_runManagerMaster
std::shared_ptr< RunManagerMT > m_runManagerMaster
Definition:
OscarMTMasterThread.h:56
OscarMTMasterThread::m_mainCanProceed
bool m_mainCanProceed
Definition:
OscarMTMasterThread.h:77
OscarMTMasterThread::m_firstRun
bool m_firstRun
Definition:
OscarMTMasterThread.h:78
mutex
static std::mutex mutex
Definition:
Proxy.cc:8
OscarMTMasterThread::m_DD4hep
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > m_DD4hep
Definition:
OscarMTMasterThread.h:64
OscarMTMasterThread::beginRun
void beginRun(const edm::EventSetup &iSetup) const
Definition:
OscarMTMasterThread.cc:120
OscarMTMasterThread::m_hasToken
bool m_hasToken
Definition:
OscarMTMasterThread.h:75
MagneticField
Definition:
MagneticField.h:19
OscarMTMasterThread::m_masterThread
std::thread m_masterThread
Definition:
OscarMTMasterThread.h:57
OscarMTMasterThread::m_DDD
edm::ESGetToken< DDCompactView, IdealGeometryRecord > m_DDD
Definition:
OscarMTMasterThread.h:63
OscarMTMasterThread::m_masterCanProceed
bool m_masterCanProceed
Definition:
OscarMTMasterThread.h:76
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition:
DDCompactView.h:81
OscarMTMasterThread::ThreadState::Destruct
OscarMTMasterThread::m_masterThreadState
ThreadState m_masterThreadState
Definition:
OscarMTMasterThread.h:73
OscarMTMasterThread::ThreadState::EndRun
OscarMTMasterThread::ThreadState
ThreadState
Definition:
OscarMTMasterThread.h:52
ParameterSet.h
OscarMTMasterThread::runManagerMaster
RunManagerMT & runManagerMaster() const
Definition:
OscarMTMasterThread.h:48
edm::ESGetToken< DDCompactView, IdealGeometryRecord >
EventSetup
OscarMTMasterThread::~OscarMTMasterThread
~OscarMTMasterThread()
Definition:
OscarMTMasterThread.cc:101
PDTRecord.h
HepPDT
Definition:
ParticleManager.h:17
OscarMTMasterThread::m_pGeoFromDD4hep
const bool m_pGeoFromDD4hep
Definition:
OscarMTMasterThread.h:54
OscarMTMasterThread::m_pDD4hep
const cms::DDCompactView * m_pDD4hep
Definition:
OscarMTMasterThread.h:61
OscarMTMasterThread::endRun
void endRun() const
Definition:
OscarMTMasterThread.cc:145
OscarMTMasterThread
Definition:
OscarMTMasterThread.h:37
edm::EventSetup
Definition:
EventSetup.h:56
OscarMTMasterThread::m_notifyMasterCv
std::condition_variable m_notifyMasterCv
Definition:
OscarMTMasterThread.h:70
DDCompactView.h
cms
Namespace of DDCMS conversion namespace.
Definition:
ProducerAnalyzer.cc:41
OscarMTMasterThread::m_stopped
bool m_stopped
Definition:
OscarMTMasterThread.h:79
RunManagerMT
Definition:
RunManagerMT.h:50
OscarMTMasterThread::m_threadMutex
std::mutex m_threadMutex
Definition:
OscarMTMasterThread.h:69
OscarMTMasterThread::OscarMTMasterThread
OscarMTMasterThread(const edm::ParameterSet &iConfig)
Definition:
OscarMTMasterThread.cc:12
OscarMTMasterThread::m_PDT
edm::ESGetToken< HepPDT::ParticleDataTable, PDTRecord > m_PDT
Definition:
OscarMTMasterThread.h:65
OscarMTMasterThread::m_pDDD
const DDCompactView * m_pDDD
Definition:
OscarMTMasterThread.h:60
IdealGeometryRecord.h
edm
HLT enums.
Definition:
AlignableModifier.h:19
OscarMTMasterThread::callConsumes
void callConsumes(edm::ConsumesCollector &&iC) const
Definition:
OscarMTMasterThread.cc:107
edm::ParameterSet
Definition:
ParameterSet.h:48
OscarMTMasterThread::ThreadState::BeginRun
OscarMTMasterThread::m_pTable
const HepPDT::ParticleDataTable * m_pTable
Definition:
OscarMTMasterThread.h:62
OscarMTMasterThread::m_notifyMainCv
std::condition_variable m_notifyMainCv
Definition:
OscarMTMasterThread.h:71
DDCompactView.h
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
Generated for CMSSW Reference Manual by
1.8.14