CMS 3D CMS Logo

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:
28 };
29 
31  m_fname = iConfig.getUntrackedParameter<std::string>("XMLFileName", "test.xml");
32  m_label = iConfig.getUntrackedParameter<std::string>("geomLabel", "Extended");
33 }
34 
36  edm::LogInfo("XMLGeometryReader") << "XMLGeometryReader::beginRun";
37 
39  iSetup.get<GeometryFileRcd>().get(m_label, geometry);
40  std::unique_ptr<std::vector<unsigned char> > blob((*geometry).getUncompressedBlob());
41 
42  std::string outfile1(m_fname);
43  std::ofstream output1(outfile1.c_str());
44  output1.write((const char*)&(*blob)[0], blob->size());
45  output1.close();
46 }
47 
T getUntrackedParameter(std::string const &, T const &) const
XMLGeometryReader(const edm::ParameterSet &)
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void beginJob() override
ESHandle< TrackerGeometry > geometry
T get() const
Definition: EventSetup.h:73
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition: Run.h:45