CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DTRecoIdealDBLoader.cc
Go to the documentation of this file.
21 
22 class DTRecoIdealDBLoader : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
23 public:
25 
26  void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override;
27  void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {}
28  void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {}
29 
30 private:
35 };
36 
38  fromDD4hep_ = iC.getUntrackedParameter<bool>("fromDD4hep", false);
39  dd4HepCompactViewToken_ = esConsumes<edm::Transition::BeginRun>();
40  compactViewToken_ = esConsumes<edm::Transition::BeginRun>();
41  muonGeomConstantsToken_ = esConsumes<edm::Transition::BeginRun>();
42 }
43 
47  if (!mydbservice.isAvailable()) {
48  edm::LogError("DTRecoIdealDBLoader") << "PoolDBOutputService unavailable";
49  return;
50  }
51 
52  auto pMNDC = es.getHandle(muonGeomConstantsToken_);
54 
55  if (fromDD4hep_) {
57  const cms::DDCompactView& cpv = *pDD;
58  dtgp.build(&cpv, *pMNDC, rig);
59  } else {
61  const DDCompactView& cpv = *pDD;
62  dtgp.build(&cpv, *pMNDC, rig);
63  }
64  if (mydbservice->isNewTagRequest("DTRecoGeometryRcd")) {
65  mydbservice->createOneIOV(rig, mydbservice->beginOfTime(), "DTRecoGeometryRcd");
66  } else {
67  edm::LogError("DTRecoIdealDBLoader") << "DTRecoGeometryRcd Tag is already present.";
68  }
69 }
70 
T getUntrackedParameter(std::string const &, T const &) const
DTRecoIdealDBLoader(edm::ParameterSet const &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void build(const DDCompactView *cview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rig)
Log< level::Error, false > LogError
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
int iEvent
Definition: GenABIO.cc:224
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:40
edm::ESGetToken< DDCompactView, IdealGeometryRecord > compactViewToken_
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > dd4HepCompactViewToken_
edm::ESGetToken< MuonGeometryConstants, IdealGeometryRecord > muonGeomConstantsToken_
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:168
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
Definition: Run.h:45