DetectorDescription
DDCMS
plugins
DDCMSDetector.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/one/EDAnalyzer.h
"
2
#include "
FWCore/ParameterSet/interface/FileInPath.h
"
3
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
4
#include "
FWCore/Framework/interface/MakerMacros.h
"
5
#include "
FWCore/Framework/interface/ESTransientHandle.h
"
6
#include "
FWCore/Framework/interface/EventSetup.h
"
7
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
8
#include "
Geometry/Records/interface/IdealGeometryRecord.h
"
9
#include "
DetectorDescription/DDCMS/interface/DDDetector.h
"
10
#include "
Geometry/Records/interface/DDVectorRegistryRcd.h
"
11
#include "
DetectorDescription/DDCMS/interface/DDVectorRegistry.h
"
12
#include "DD4hep/Detector.h"
13
14
#include <memory>
15
#include <string>
16
17
using namespace
std
;
18
using namespace
cms
;
19
using namespace
edm
;
20
using namespace
dd4hep
;
21
22
class
DDCMSDetector
:
public
one::EDAnalyzer
<> {
23
public
:
24
explicit
DDCMSDetector
(
const
ParameterSet
&
p
);
25
26
void
beginJob
()
override
{}
27
void
analyze
(
Event
const
&
iEvent
,
EventSetup
const
&)
override
;
28
void
endJob()
override
;
29
30
private
:
31
const
ESInputTag
m_tag
;
32
};
33
34
DDCMSDetector::DDCMSDetector
(
const
ParameterSet
& iConfig) : m_tag(iConfig.getParameter<
ESInputTag
>(
"DDDetector"
)) {}
35
36
void
DDCMSDetector::analyze
(
const
Event
&,
const
EventSetup
& iEventSetup) {
37
ESTransientHandle<DDDetector>
det;
38
iEventSetup.
get
<
IdealGeometryRecord
>().
get
(
m_tag
, det);
39
40
LogVerbatim
(
"Geometry"
) <<
"Iterate over the detectors:\n"
;
41
LogVerbatim
(
"Geometry"
).log([&](
auto
&
log
) {
42
for
(
auto
const
& it : det->
description
()->detectors()) {
43
dd4hep::DetElement det(it.second);
44
log
<< it.first <<
": "
<< det.path();
45
}
46
});
47
LogVerbatim
(
"Geometry"
) <<
"..done!"
;
48
49
ESTransientHandle<DDVectorRegistry>
registry;
50
iEventSetup.
get
<
DDVectorRegistryRcd
>().
get
(
m_tag
, registry);
51
52
LogVerbatim
(
"Geometry"
) <<
"DD Vector Registry size: "
<< registry->
vectors
.size();
53
LogVerbatim
(
"Geometry"
).log([&](
auto
&
log
) {
54
for
(
const
auto
&
p
: registry->
vectors
) {
55
log <<
" "
<< p.first <<
" => "
;
56
for (const auto& i : p.second)
57
log << i <<
", "
;
58
log <<
'\n'
;
59
}
60
});
61
}
62
63
void
DDCMSDetector::endJob
() {}
64
65
DEFINE_FWK_MODULE
(
DDCMSDetector
);
EDAnalyzer.h
edm::ESInputTag
Definition:
ESInputTag.h:87
ESTransientHandle.h
MessageLogger.h
edm
HLT enums.
Definition:
AlignableModifier.h:19
DDCMSDetector::endJob
void endJob() override
Definition:
DDCMSDetector.cc:63
DDVectorRegistryRcd
Definition:
DDVectorRegistryRcd.h:8
edm::one::EDAnalyzer
Definition:
EDAnalyzer.h:30
DDDetector.h
cms::DDDetector::description
dd4hep::Detector const * description() const
Definition:
DDDetector.h:35
DDCMSDetector
Definition:
DDCMSDetector.cc:22
MakerMacros.h
cms::DDVectorRegistry::vectors
DDVectorsMap vectors
Definition:
DDVectorRegistry.h:12
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:87
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
DDVectorRegistry.h
FileInPath.h
edm::ParameterSet
Definition:
ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
DDCMSDetector::m_tag
const ESInputTag m_tag
Definition:
DDCMSDetector.cc:31
DDCMSDetector::beginJob
void beginJob() override
Definition:
DDCMSDetector.cc:26
iEvent
int iEvent
Definition:
GenABIO.cc:224
analyze
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
IdealGeometryRecord.h
DDCMSDetector::analyze
void analyze(Event const &iEvent, EventSetup const &) override
Definition:
DDCMSDetector.cc:36
edm::EventSetup
Definition:
EventSetup.h:58
get
#define get
DDCMSDetector::DDCMSDetector
DDCMSDetector(const ParameterSet &p)
Definition:
DDCMSDetector.cc:34
edm::ESTransientHandle
Definition:
ESTransientHandle.h:41
std
Definition:
JetResolutionObject.h:76
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition:
MessageLogger.h:128
dd4hep
Definition:
DDPlugins.h:8
EventSetup.h
dqm-mbProfile.log
log
Definition:
dqm-mbProfile.py:17
ParameterSet.h
edm::Event
Definition:
Event.h:73
DDVectorRegistryRcd.h
IdealGeometryRecord
Definition:
IdealGeometryRecord.h:25
cms
Namespace of DDCMS conversion namespace.
Definition:
ProducerAnalyzer.cc:21
Generated for CMSSW Reference Manual by
1.8.16