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 public:
20 
21  void beginJob() override;
22  void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override {}
23  void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {}
24  void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {}
25 
26 private:
28  bool m_zip;
30 };
31 
33  m_fname = iConfig.getUntrackedParameter<std::string>("XMLFileName", "test.xml");
34  m_zip = iConfig.getUntrackedParameter<bool>("ZIP", true);
35  m_record = iConfig.getUntrackedParameter<std::string>("record", "GeometryFileRcd");
36 }
37 
39  edm::LogInfo("XMLGeometryBuilder") << "XMLGeometryBuilder::beginJob";
41  if (!mydbservice.isAvailable()) {
42  edm::LogError("XMLGeometryBuilder") << "PoolDBOutputService unavailable";
43  return;
44  }
45 
46  FileBlob* pgf = new FileBlob(m_fname, m_zip);
47 
48  if (mydbservice->isNewTagRequest(m_record)) {
49  mydbservice->createNewIOV<FileBlob>(pgf, mydbservice->beginOfTime(), mydbservice->endOfTime(), m_record);
50  } else {
51  edm::LogError("XMLGeometryBuilder") << "GeometryFileRcd Tag already exist";
52  }
53 }
54 
EDAnalyzer.h
MessageLogger.h
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:215
XMLGeometryBuilder::beginJob
void beginJob() override
Definition: XMLGeometryBuilder.cc:38
ESHandle.h
edm::Run
Definition: Run.h:45
XMLGeometryBuilder
Definition: XMLGeometryBuilder.cc:17
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
FileBlob.h
XMLGeometryBuilder::m_fname
std::string m_fname
Definition: XMLGeometryBuilder.cc:27
XMLGeometryBuilder::analyze
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
Definition: XMLGeometryBuilder.cc:23
XMLGeometryBuilder::m_zip
bool m_zip
Definition: XMLGeometryBuilder.cc:28
GeometryFileRcd.h
MakerMacros.h
PoolDBOutputService.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:116
XMLGeometryBuilder::XMLGeometryBuilder
XMLGeometryBuilder(const edm::ParameterSet &)
Definition: XMLGeometryBuilder.cc:32
Service.h
XMLGeometryBuilder::beginRun
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition: XMLGeometryBuilder.cc:22
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
XMLGeometryBuilder::m_record
std::string m_record
Definition: XMLGeometryBuilder.cc:29
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
edm::Service< cond::service::PoolDBOutputService >
iEvent
int iEvent
Definition: GenABIO.cc:224
XMLGeometryBuilder::endRun
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition: XMLGeometryBuilder.cc:24
edm::EventSetup
Definition: EventSetup.h:57
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:213
EventSetup.h
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:128
ParameterSet.h
edm::Event
Definition: Event.h:73
FileBlob
Definition: FileBlob.h:10