CMS 3D CMS Logo

HcalParametersDBBuilder.cc
Go to the documentation of this file.
14 
15 //#define EDM_ML_DEBUG
16 
17 class HcalParametersDBBuilder : public edm::one::EDAnalyzer<edm::one::WatchRuns> {
18 public:
20 
22 
23  void beginRun(edm::Run const& iEvent, edm::EventSetup const&) override;
24  void analyze(edm::Event const& iEvent, edm::EventSetup const&) override {}
25  void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {}
26 
27 private:
29 };
30 
32  : fromDD4Hep_(ps.getParameter<bool>("fromDD4Hep")) {
33 #ifdef EDM_ML_DEBUG
34  edm::LogVerbatim("HCalGeom") << "HcalParametersDBBuilder::HcalParametersDBBuilder called with dd4hep: "
35  << fromDD4Hep_;
36 #endif
37 }
38 
41  desc.add<bool>("fromDD4Hep", false);
42  descriptions.add("HcalParametersWriter", desc);
43 }
44 
46  HcalParameters* php = new HcalParameters;
48  if (!mydbservice.isAvailable()) {
49  edm::LogError("HcalParametersDBBuilder") << "PoolDBOutputService unavailable";
50  return;
51  }
52 
53  HcalParametersFromDD builder;
54 
55  if (fromDD4Hep_) {
56 #ifdef EDM_ML_DEBUG
57  edm::LogVerbatim("HCalGeom") << "HcalParametersDBBuilder::Try to access cms::DDCompactView";
58 #endif
60  es.get<IdealGeometryRecord>().get(cpv);
61  builder.build((*cpv), *php);
62  } else {
63 #ifdef EDM_ML_DEBUG
64  edm::LogVerbatim("HCalGeom") << "HcalParametersDBBuilder::Try to access DDCompactView";
65 #endif
67  es.get<IdealGeometryRecord>().get(cpv);
68  builder.build(&(*cpv), *php);
69  }
70 
71  if (mydbservice->isNewTagRequest("HcalParametersRcd")) {
72  mydbservice->createNewIOV<HcalParameters>(
73  php, mydbservice->beginOfTime(), mydbservice->endOfTime(), "HcalParametersRcd");
74  } else {
75  edm::LogError("HcalParametersDBBuilder") << "HcalParameters and HcalParametersRcd Tag already present";
76  }
77 }
78 
ConfigurationDescriptions.h
electrons_cff.bool
bool
Definition: electrons_cff.py:372
EDAnalyzer.h
HcalParametersDBBuilder::beginRun
void beginRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition: HcalParametersDBBuilder.cc:45
edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
ESTransientHandle.h
MessageLogger.h
cond::service::PoolDBOutputService::beginOfTime
cond::Time_t beginOfTime() const
Definition: PoolDBOutputService.cc:177
HcalParametersDBBuilder::HcalParametersDBBuilder
HcalParametersDBBuilder(const edm::ParameterSet &)
Definition: HcalParametersDBBuilder.cc:31
edm::Run
Definition: Run.h:45
HcalParametersFromDD.h
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
HcalParameters.h
edm::one::EDAnalyzer
Definition: EDAnalyzer.h:30
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
DDCompactView.h
MakerMacros.h
HcalParametersFromDD
Definition: HcalParametersFromDD.h:9
PoolDBOutputService.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HcalParametersFromDD::build
bool build(const DDCompactView *, HcalParameters &)
Definition: HcalParametersFromDD.cc:57
HcalParametersDBBuilder::analyze
void analyze(edm::Event const &iEvent, edm::EventSetup const &) override
Definition: HcalParametersDBBuilder.cc:24
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
cond::service::PoolDBOutputService::createNewIOV
void createNewIOV(const T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t, const std::string &recordName)
Definition: PoolDBOutputService.h:107
Service.h
DDCompactView.h
ParameterSetDescription.h
HcalParametersDBBuilder
Definition: HcalParametersDBBuilder.cc:17
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
HcalParametersDBBuilder::fromDD4Hep_
bool fromDD4Hep_
Definition: HcalParametersDBBuilder.cc:28
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
edm::Service< cond::service::PoolDBOutputService >
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::LogVerbatim
Definition: MessageLogger.h:297
IdealGeometryRecord.h
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
cond::service::PoolDBOutputService::endOfTime
cond::Time_t endOfTime() const
Definition: PoolDBOutputService.cc:175
HcalParameters
Definition: HcalParameters.h:6
HcalParametersDBBuilder::endRun
void endRun(edm::Run const &iEvent, edm::EventSetup const &) override
Definition: HcalParametersDBBuilder.cc:25
cond::service::PoolDBOutputService::isNewTagRequest
bool isNewTagRequest(const std::string &recordName)
Definition: PoolDBOutputService.cc:90
HcalParametersDBBuilder::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &)
Definition: HcalParametersDBBuilder.cc:39
edm::Event
Definition: Event.h:73
IdealGeometryRecord
Definition: IdealGeometryRecord.h:27