CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
XMLGeometryReader.cc
Go to the documentation of this file.
11 
12 #include <string>
13 #include <vector>
14 #include <fstream>
15 
16 class XMLGeometryReader : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
17 public:
19 
20  void beginJob() override {}
21  void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override;
22  void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {}
23  void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {}
24 
25 private:
29 };
30 
32  m_fname = iConfig.getUntrackedParameter<std::string>("XMLFileName", "test.xml");
33  m_label = iConfig.getUntrackedParameter<std::string>("geomLabel", "Extended");
34  fileBlobToken_ = esConsumes<edm::Transition::BeginRun>();
35 }
36 
38  edm::LogInfo("XMLGeometryReader") << "XMLGeometryReader::beginRun";
39 
40  auto geometry = iSetup.getHandle(fileBlobToken_);
41  std::unique_ptr<std::vector<unsigned char> > blob((*geometry).getUncompressedBlob());
42 
43  std::string outfile1(m_fname);
44  std::ofstream output1(outfile1.c_str());
45  output1.write((const char*)&(*blob)[0], blob->size());
46  output1.close();
47 }
48 
T getUntrackedParameter(std::string const &, T const &) const
XMLGeometryReader(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
int iEvent
Definition: GenABIO.cc:224
void beginJob() override
Log< level::Info, false > LogInfo
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
edm::ESGetToken< FileBlob, GeometryFileRcd > fileBlobToken_
Definition: Run.h:45