CMS 3D CMS Logo

GEMRecoIdealDBLoader.cc
Go to the documentation of this file.
22 
23 class GEMRecoIdealDBLoader : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
24 public:
26 
27  void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override;
28  void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {}
29  void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {}
30 
31 private:
36 };
37 
39  fromDD4hep_ = iC.getUntrackedParameter<bool>("fromDD4hep", false); // set true for DD4hep
40  dd4HepCompactViewToken_ = esConsumes<edm::Transition::BeginRun>();
41  compactViewToken_ = esConsumes<edm::Transition::BeginRun>();
42  muonGeomConstantsToken_ = esConsumes<edm::Transition::BeginRun>();
43 }
44 
46  edm::LogInfo("GEMRecoIdealDBLoader") << "GEMRecoIdealDBLoader::beginRun";
47 
49  if (!mydbservice.isAvailable()) {
50  edm::LogError("GEMRecoIdealDBLoader") << "PoolDBOutputService unavailable";
51  return;
52  }
53 
54  if (mydbservice->isNewTagRequest("GEMRecoGeometryRcd")) {
55  auto pMNDC = es.getHandle(muonGeomConstantsToken_);
56 
59 
60  if (fromDD4hep_) {
61  edm::LogVerbatim("GEMRecoIdealDBLoader") << "(0) GEMRecoIdealDBLoader - DD4hep ";
63  const cms::DDCompactView& cpv = *pDD;
64  rpcpd.build(&cpv, *pMNDC, rig);
65  } else {
66  edm::LogVerbatim("GEMRecoIdealDBLoader") << "(0) GEMRecoIdealDBLoader - DDD ";
68  const DDCompactView& cpv = *pDD;
69  rpcpd.build(&cpv, *pMNDC, rig);
70  }
71  mydbservice->createOneIOV(rig, mydbservice->beginOfTime(), "GEMRecoGeometryRcd");
72  } else {
73  edm::LogError("GEMRecoIdealDBLoader") << "GEMRecoGeometryRcd Tag is already present";
74  }
75 }
76 
Log< level::Info, true > LogVerbatim
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ESGetToken< DDCompactView, IdealGeometryRecord > compactViewToken_
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 beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
T getUntrackedParameter(std::string const &, T const &) const
GEMRecoIdealDBLoader(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:224
bool isNewTagRequest(const std::string &recordName)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
Log< level::Info, false > LogInfo
edm::ESGetToken< MuonGeometryConstants, IdealGeometryRecord > muonGeomConstantsToken_
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:162
bool isAvailable() const
Definition: Service.h:40
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > dd4HepCompactViewToken_
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
Definition: Run.h:45
void build(const DDCompactView *cview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rgeo)