CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
CSCRecoIdealDBLoader.cc
Go to the documentation of this file.
20 
21 class CSCRecoIdealDBLoader : 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);
38  dd4HepCompactViewToken_ = esConsumes<edm::Transition::BeginRun>();
39  compactViewToken_ = esConsumes<edm::Transition::BeginRun>();
40  muonGeomConstantsToken_ = esConsumes<edm::Transition::BeginRun>();
41 }
42 
44  edm::LogInfo("CSCRecoIdealDBLoader") << "CSCRecoIdealDBLoader::beginRun";
45 
49  if (!mydbservice.isAvailable()) {
50  edm::LogError("CSCRecoIdealDBLoader") << "PoolDBOutputService unavailable";
51  return;
52  }
53 
54  auto pMNDC = es.getHandle(muonGeomConstantsToken_);
56 
57  if (fromDD4hep_) {
59  const cms::DDCompactView& cpv = *pDD;
60  cscgp.build(&cpv, *pMNDC, rig, rdp);
61  } else {
63  const DDCompactView& cpv = *pDD;
64  cscgp.build(&cpv, *pMNDC, rig, rdp);
65  }
66 
67  if (mydbservice->isNewTagRequest("CSCRecoGeometryRcd")) {
68  mydbservice->createOneIOV(rig, mydbservice->beginOfTime(), "CSCRecoGeometryRcd");
69  } else {
70  edm::LogError("CSCRecoIdealDBLoader") << "CSCRecoGeometryRcd Tag is already present.";
71  }
72  if (mydbservice->isNewTagRequest("CSCRecoDigiParametersRcd")) {
73  mydbservice->createOneIOV(rdp, mydbservice->beginOfTime(), "CSCRecoDigiParametersRcd");
74  } else {
75  edm::LogError("CSCRecoIdealDBLoader") << "CSCRecoDigiParametersRcd Tag is already present.";
76  }
77 }
78 
T getUntrackedParameter(std::string const &, T const &) const
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > dd4HepCompactViewToken_
CSCRecoIdealDBLoader(edm::ParameterSet const &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
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)
int iEvent
Definition: GenABIO.cc:224
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:40
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
Log< level::Info, false > LogInfo
bool build(const DDCompactView *cview, const MuonGeometryConstants &muonConstants, RecoIdealGeometry &rig, CSCRecoDigiParameters &rdp)
Build the geometry returning the RecoIdealGeometry and the CSCRecoDigiParameters objects.
edm::ESGetToken< DDCompactView, IdealGeometryRecord > compactViewToken_
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:162
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
edm::ESGetToken< MuonGeometryConstants, IdealGeometryRecord > muonGeomConstantsToken_
Definition: Run.h:45