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 {
18 public:
19 
21 
22  void beginJob() override {}
23  void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override;
24  void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {}
25  void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {}
26 
27 private:
30 };
31 
33 {
34  m_fname = iConfig.getUntrackedParameter<std::string>("XMLFileName","test.xml");
35  m_label = iConfig.getUntrackedParameter<std::string>("geomLabel","Extended");
36 }
37 
38 void
40 {
41  edm::LogInfo("XMLGeometryReader") << "XMLGeometryReader::beginRun";
42 
44  iSetup.get<GeometryFileRcd>().get(m_label,geometry);
45  std::unique_ptr<std::vector<unsigned char> > blob( (*geometry).getUncompressedBlob() );
46 
47  std::string outfile1(m_fname) ;
48  std::ofstream output1(outfile1.c_str()) ;
49  output1.write((const char *)&(*blob)[0], blob->size());
50  output1.close() ;
51 }
52 
T getUntrackedParameter(std::string const &, T const &) const
XMLGeometryReader(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
int iEvent
Definition: GenABIO.cc:230
void beginJob() override
const T & get() const
Definition: EventSetup.h:59
ESHandle< TrackerGeometry > geometry
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition: Run.h:43