CMS 3D CMS Logo

HcalParametersESModule.cc
Go to the documentation of this file.
12 
13 #include <memory>
14 
15 //#define EDM_ML_DEBUG
16 
18 public:
20 
21  using ReturnType = std::unique_ptr<HcalParameters>;
22 
24 
26 
27 private:
31 };
32 
34  fromDD4Hep_ = ps.getParameter<bool>("fromDD4Hep");
35  auto cc = setWhatProduced(this);
38 
39 #ifdef EDM_ML_DEBUG
40  edm::LogVerbatim("HCalGeom") << "HcalParametersESModule::HcalParametersESModule called with dd4hep: " << fromDD4Hep_;
41 #endif
42 }
43 
46  desc.add<bool>("fromDD4Hep", false);
47  descriptions.add("hcalParameters", desc);
48 }
49 
51  edm::LogInfo("HCalGeom") << "HcalParametersESModule::produce(const HcalParametersRcd& iRecord)";
52 
53  auto ptp = std::make_unique<HcalParameters>();
54  HcalParametersFromDD builder;
55 
56  if (fromDD4Hep_) {
57 #ifdef EDM_ML_DEBUG
58  edm::LogVerbatim("HCalGeom") << "HcalParametersESModule::Try to access cms::DDCompactView";
59 #endif
61  builder.build(&(*cpv), *ptp);
62  } else {
63 #ifdef EDM_ML_DEBUG
64  edm::LogVerbatim("HCalGeom") << "HcalParametersESModule::Try to access DDCompactView";
65 #endif
67  builder.build(&(*cpv), *ptp);
68  }
69 
70  return ptp;
71 }
72 
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > cpvTokenDD4Hep_
ReturnType produce(const HcalParametersRcd &)
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
std::unique_ptr< HcalParameters > ReturnType
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
ParameterDescriptionBase * add(U const &iLabel, T const &value)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
static void fillDescriptions(edm::ConfigurationDescriptions &)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::ESGetToken< DDCompactView, IdealGeometryRecord > cpvTokenDDD_
HcalParametersESModule(const edm::ParameterSet &)