CMS 3D CMS Logo

XMLGeometryBuilder.cc
Go to the documentation of this file.
12 
13 #include <string>
14 #include <vector>
15 #include <fstream>
16 
17 class XMLGeometryBuilder : public edm::one::EDAnalyzer<edm::one::WatchRuns>
18 {
19 public:
20 
22 
23  void beginJob() override;
24  void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override {}
25  void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {}
26  void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {}
27 
28 private:
30  bool m_zip;
32 };
33 
35 {
36  m_fname = iConfig.getUntrackedParameter<std::string>("XMLFileName","test.xml");
37  m_zip = iConfig.getUntrackedParameter<bool>("ZIP",true);
38  m_record = iConfig.getUntrackedParameter<std::string>("record","GeometryFileRcd");
39 }
40 
41 void
43 {
44  edm::LogInfo("XMLGeometryBuilder")<<"XMLGeometryBuilder::beginJob";
46  if( !mydbservice.isAvailable() ){
47  edm::LogError("XMLGeometryBuilder")<<"PoolDBOutputService unavailable";
48  return;
49  }
50 
51  FileBlob* pgf= new FileBlob(m_fname, m_zip);
52 
53  if ( mydbservice->isNewTagRequest(m_record) ) {
54  mydbservice->createNewIOV<FileBlob>( pgf,mydbservice->beginOfTime(),mydbservice->endOfTime(),m_record);
55  } else {
56  edm::LogError("XMLGeometryBuilder")<<"GeometryFileRcd Tag already exist";
57  }
58 }
59 
T getUntrackedParameter(std::string const &, T const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
XMLGeometryBuilder(const edm::ParameterSet &)
void beginJob() override
int iEvent
Definition: GenABIO.cc:230
bool isNewTagRequest(const std::string &recordName)
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
bool isAvailable() const
Definition: Service.h:46
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition: Run.h:42