CMS 3D CMS Logo

DDCMSDetector.cc
Go to the documentation of this file.
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:
34 };
35 
37  : m_tag(iConfig.getParameter<ESInputTag>("DDDetector")),
38  m_detectorToken(esConsumes(m_tag)),
39  m_registryToken(esConsumes(m_tag)) {}
40 
41 void DDCMSDetector::analyze(const Event&, const EventSetup& iEventSetup) {
43 
44  LogVerbatim("Geometry") << "Iterate over the detectors:\n";
45  LogVerbatim("Geometry").log([&](auto& log) {
46  for (auto const& it : det->description()->detectors()) {
47  dd4hep::DetElement det(it.second);
48  log << it.first << ": " << det.path();
49  }
50  });
51  LogVerbatim("Geometry") << "..done!";
52 
54 
55  LogVerbatim("Geometry") << "DD Vector Registry size: " << registry->vectors.size();
56  LogVerbatim("Geometry").log([&](auto& log) {
57  for (const auto& p : registry->vectors) {
58  log << " " << p.first << " => ";
59  for (const auto& i : p.second)
60  log << i << ", ";
61  log << '\n';
62  }
63  });
64 }
65 
67 
DDCMSDetector(const ParameterSet &p)
Log< level::Info, true > LogVerbatim
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
dd4hep::Detector const * description() const
Definition: DDDetector.h:35
example_stream void analyze(const edm::Event &, const edm::EventSetup &) override
void analyze(Event const &iEvent, EventSetup const &) override
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const ESGetToken< DDVectorRegistry, DDVectorRegistryRcd > m_registryToken
const ESGetToken< DDDetector, IdealGeometryRecord > m_detectorToken
Namespace of DDCMS conversion namespace.
void endJob() override
HLT enums.
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:141
const ESInputTag m_tag
void beginJob() override