SimG4CMS
CherenkovAnalysis
plugins
DreamSensitiveDetectorBuilder.cc
Go to the documentation of this file.
1
// system include files
2
3
// user include files
4
#include "
SimG4Core/SensitiveDetector/interface/SensitiveDetectorMakerBase.h
"
5
#include "
SimG4Core/Notification/interface/SimActivityRegistryEnroller.h
"
6
#include "
SimG4Core/SensitiveDetector/interface/SensitiveDetectorPluginFactory.h
"
7
8
#include "
DetectorDescription/Core/interface/DDCompactView.h
"
9
#include "
DetectorDescription/DDCMS/interface/DDCompactView.h
"
10
#include "
Geometry/Records/interface/IdealGeometryRecord.h
"
11
#include "
SimG4CMS/CherenkovAnalysis/interface/DreamSD.h
"
12
13
#include "
FWCore/Framework/interface/ConsumesCollector.h
"
14
#include "
FWCore/Framework/interface/EventSetup.h
"
15
#include "
FWCore/Utilities/interface/ESGetToken.h
"
16
#include "
FWCore/PluginManager/interface/ModuleDef.h
"
17
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
18
19
class
DreamSensitiveDetectorBuilder
:
public
SensitiveDetectorMakerBase
{
20
public
:
21
explicit
DreamSensitiveDetectorBuilder
(
edm::ParameterSet
const
&
p
,
edm::ConsumesCollector
cc
) {
22
fromDD4Hep_
=
p
.getParameter<
bool
>(
"g4GeometryDD4hepSource"
);
23
if
(
fromDD4Hep_
)
24
cpvTokenDD4Hep_
=
cc
.esConsumes<
edm::Transition::BeginRun
>();
25
else
26
cpvTokenDDD_
=
cc
.esConsumes<
edm::Transition::BeginRun
>();
27
}
28
29
void
beginRun
(
const
edm::EventSetup
& es)
final
{
30
if
(
fromDD4Hep_
) {
31
cpvDD4Hep_
= &es.getData(
cpvTokenDD4Hep_
);
32
}
else
{
33
cpvDDD_
= &es.getData(
cpvTokenDDD_
);
34
}
35
}
36
37
std::unique_ptr<SensitiveDetector>
make
(
const
std::string
& iname,
38
const
SensitiveDetectorCatalog
& clg,
39
const
edm::ParameterSet
&
p
,
40
const
SimTrackManager
* man,
41
SimActivityRegistry
& reg)
const
final
{
42
auto
sd
= std::make_unique<DreamSD>(iname,
cpvDDD_
,
cpvDD4Hep_
, clg,
p
, man);
43
SimActivityRegistryEnroller::enroll
(reg,
sd
.get());
44
return
sd
;
45
}
46
47
private
:
48
bool
fromDD4Hep_
;
49
edm::ESGetToken<DDCompactView, IdealGeometryRecord>
cpvTokenDDD_
;
50
edm::ESGetToken<cms::DDCompactView, IdealGeometryRecord>
cpvTokenDD4Hep_
;
51
const
DDCompactView
*
cpvDDD_
;
52
const
cms::DDCompactView
*
cpvDD4Hep_
;
53
};
54
55
typedef
DreamSD
DreamSensitiveDetector
;
56
DEFINE_SENSITIVEDETECTORBUILDER
(
DreamSensitiveDetectorBuilder
,
DreamSensitiveDetector
);
SimTrackManager
Definition:
SimTrackManager.h:35
DreamSD
Definition:
DreamSD.h:22
DreamSensitiveDetectorBuilder::cpvDD4Hep_
const cms::DDCompactView * cpvDD4Hep_
Definition:
DreamSensitiveDetectorBuilder.cc:52
ESGetToken.h
DDCompactView.h
DreamSensitiveDetectorBuilder::cpvTokenDDD_
edm::ESGetToken< DDCompactView, IdealGeometryRecord > cpvTokenDDD_
Definition:
DreamSensitiveDetectorBuilder.cc:49
DreamSensitiveDetector
DreamSD DreamSensitiveDetector
Definition:
DreamSensitiveDetectorBuilder.cc:55
DreamSensitiveDetectorBuilder
Definition:
DreamSensitiveDetectorBuilder.cc:19
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition:
DDCompactView.h:81
DreamSensitiveDetectorBuilder::fromDD4Hep_
bool fromDD4Hep_
Definition:
DreamSensitiveDetectorBuilder.cc:48
SensitiveDetectorCatalog
Definition:
SensitiveDetectorCatalog.h:10
DDCompactView.h
DreamSensitiveDetectorBuilder::make
std::unique_ptr< SensitiveDetector > make(const std::string &iname, const SensitiveDetectorCatalog &clg, const edm::ParameterSet &p, const SimTrackManager *man, SimActivityRegistry ®) const final
Definition:
DreamSensitiveDetectorBuilder.cc:37
DreamSensitiveDetectorBuilder::cpvTokenDD4Hep_
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > cpvTokenDD4Hep_
Definition:
DreamSensitiveDetectorBuilder.cc:50
DreamSensitiveDetectorBuilder::DreamSensitiveDetectorBuilder
DreamSensitiveDetectorBuilder(edm::ParameterSet const &p, edm::ConsumesCollector cc)
Definition:
DreamSensitiveDetectorBuilder.cc:21
edm::ParameterSet
Definition:
ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
DreamSensitiveDetectorBuilder::beginRun
void beginRun(const edm::EventSetup &es) final
Definition:
DreamSensitiveDetectorBuilder.cc:29
DreamSD.h
SensitiveDetectorMakerBase
Definition:
SensitiveDetectorMakerBase.h:28
ModuleDef.h
SimActivityRegistryEnroller::enroll
static void enroll(SimActivityRegistry &iReg, T *iObj)
Definition:
SimActivityRegistryEnroller.h:50
IdealGeometryRecord.h
edm::EventSetup
Definition:
EventSetup.h:58
cc
edm::ESGetToken< DDCompactView, IdealGeometryRecord >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
SimActivityRegistryEnroller.h
DreamSensitiveDetectorBuilder::cpvDDD_
const DDCompactView * cpvDDD_
Definition:
DreamSensitiveDetectorBuilder.cc:51
SimActivityRegistry
Definition:
SimActivityRegistry.h:39
DEFINE_SENSITIVEDETECTORBUILDER
#define DEFINE_SENSITIVEDETECTORBUILDER(type, name)
Definition:
SensitiveDetectorPluginFactory.h:21
edm::Transition::BeginRun
cms::DDCompactView
Definition:
DDCompactView.h:31
EventSetup.h
sd
double sd
Definition:
CascadeWrapper.h:113
ConsumesCollector.h
SensitiveDetectorPluginFactory.h
ParameterSet.h
SensitiveDetectorMakerBase.h
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
Generated for CMSSW Reference Manual by
1.8.16