CMS 3D CMS Logo

ME0RecoIdealDBLoader.cc
Go to the documentation of this file.
20 
21 class ME0RecoIdealDBLoader : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
22 public:
24 
25  void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override;
26  void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {}
27  void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {}
28 
29 private:
34 };
35 
37  fromDD4hep_ = iC.getUntrackedParameter<bool>("fromDD4hep", false); // set true for DD4hep
38  dd4HepCompactViewToken_ = esConsumes<edm::Transition::BeginRun>();
39  compactViewToken_ = esConsumes<edm::Transition::BeginRun>();
40  muonGeomConstantsToken_ = esConsumes<edm::Transition::BeginRun>();
41 }
42 
44  edm::LogInfo("ME0RecoIdealDBLoader") << "ME0RecoIdealDBLoader::beginRun";
45 
47  if (!mydbservice.isAvailable()) {
48  edm::LogError("ME0RecoIdealDBLoader") << "PoolDBOutputService unavailable";
49  return;
50  }
51 
52  if (mydbservice->isNewTagRequest("ME0RecoGeometryRcd")) {
53  auto pMNDC = es.getHandle(muonGeomConstantsToken_);
56  if (fromDD4hep_) {
57  edm::LogVerbatim("ME0RecoIdealDBLoader") << "(0) ME0RecoIdealDBLoader - DD4hep ";
59  const cms::DDCompactView& cpv = *pDD;
60  me0pd.build(&cpv, *pMNDC, rig);
61  } else {
62  edm::LogVerbatim("ME0RecoIdealDBLoader") << "(0) ME0RecoIdealDBLoader - DDD ";
64  const DDCompactView& cpv = *pDD;
65  me0pd.build(&cpv, *pMNDC, rig);
66  }
67  mydbservice->createOneIOV(rig, mydbservice->beginOfTime(), "ME0RecoGeometryRcd");
68  } else {
69  edm::LogError("ME0RecoIdealDBLoader") << "ME0RecoGeometryRcd Tag is already present";
70  }
71 }
72 
Log< level::Info, true > LogVerbatim
void build(const DDCompactView *, const MuonGeometryConstants &, RecoIdealGeometry &)
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > dd4HepCompactViewToken_
Log< level::Error, false > LogError
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
edm::ESGetToken< MuonGeometryConstants, IdealGeometryRecord > muonGeomConstantsToken_
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
T getUntrackedParameter(std::string const &, T const &) const
int iEvent
Definition: GenABIO.cc:224
bool isNewTagRequest(const std::string &recordName)
ME0RecoIdealDBLoader(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
Log< level::Info, false > LogInfo
edm::ESGetToken< DDCompactView, IdealGeometryRecord > compactViewToken_
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:141
bool isAvailable() const
Definition: Service.h:40
Definition: Run.h:45
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override