File indexing completed on 2024-04-06 12:05:29
0001 #include "FWCore/Framework/interface/global/EDAnalyzer.h"
0002 #include "FWCore/Framework/interface/MakerMacros.h"
0003 #include "FWCore/Framework/interface/ESTransientHandle.h"
0004 #include "FWCore/Framework/interface/EventSetup.h"
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006 #include "Geometry/Records/interface/DDVectorRegistryRcd.h"
0007 #include "DetectorDescription/DDCMS/interface/DDVectorRegistry.h"
0008
0009 #include <iostream>
0010
0011 using namespace std;
0012 using namespace cms;
0013 using namespace edm;
0014
0015 class DDTestVectors : public global::EDAnalyzer<> {
0016 public:
0017 explicit DDTestVectors(const ParameterSet& iConfig)
0018 : m_tag(iConfig.getParameter<ESInputTag>("DDDetector")), m_token(esConsumes(m_tag)) {}
0019
0020 void beginJob() override {}
0021 void analyze(StreamID, Event const& iEvent, EventSetup const&) const override;
0022 void endJob() override {}
0023
0024 private:
0025 const ESInputTag m_tag;
0026 const ESGetToken<DDVectorRegistry, DDVectorRegistryRcd> m_token;
0027 };
0028
0029 void DDTestVectors::analyze(StreamID, const Event&, const EventSetup& iEventSetup) const {
0030 ESTransientHandle<DDVectorRegistry> registry = iEventSetup.getTransientHandle(m_token);
0031
0032 LogVerbatim("Geometry").log([®istry, this](auto& log) {
0033 log << "DDTestVectors::analyze: " << m_tag;
0034 log << "DD Vector Registry size: " << registry->vectors.size() << "\n";
0035 for (const auto& p : registry->vectors) {
0036 log << " " << p.first << " => ";
0037 for (const auto& i : p.second)
0038 log << i << ", ";
0039 log << "\n";
0040 }
0041 });
0042 }
0043
0044 DEFINE_FWK_MODULE(DDTestVectors);