CMS 3D CMS Logo

EcalSimParametersESModule.cc
Go to the documentation of this file.
11 
12 #include <memory>
13 
14 //#define EDM_ML_DEBUG
15 
17 public:
19 
20  using ReturnType = std::unique_ptr<EcalSimulationParameters>;
21 
23 
25 
26 private:
29  const bool fromDD4Hep_;
31 };
32 
34  : fromDD4Hep_(ps.getParameter<bool>("fromDD4Hep")), name_(ps.getParameter<std::string>("name")) {
35  auto cc = setWhatProduced(this, name_);
38 
39 #ifdef EDM_ML_DEBUG
40  edm::LogVerbatim("EcalGeom") << "EcalSimParametersESModule::EcalSimParametersESModule called with dd4hep: "
41  << fromDD4Hep_ << " for " << name_;
42 #endif
43 }
44 
47  desc.add<bool>("fromDD4Hep", false);
48  desc.add<std::string>("name", "EcalHitsEB");
49  descriptions.add("ecalSimulationParametersEB", desc);
50 }
51 
53 #ifdef EDM_ML_DEBUG
54  edm::LogVerbatim("EcalGeom") << "EcalSimParametersESModule::produce(const IdealGeometryRecord& iRecord)";
55 #endif
56 
57  auto ptp = std::make_unique<EcalSimulationParameters>();
59  if (fromDD4Hep_) {
60 #ifdef EDM_ML_DEBUG
61  edm::LogVerbatim("EcalGeom") << "EcalSimParametersESModule::Try to access cms::DDCompactView";
62 #endif
64  builder.build(&(*cpv), name_, *ptp);
65  } else {
66 #ifdef EDM_ML_DEBUG
67  edm::LogVerbatim("EcalGeom") << "EcalSimParametersESModule::Try to access DDCompactView";
68 #endif
70  builder.build(&(*cpv), name_, *ptp);
71  }
72  return ptp;
73 }
74 
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
ReturnType produce(const IdealGeometryRecord &)
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 &)
edm::ESGetToken< DDCompactView, IdealGeometryRecord > cpvTokenDDD_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::unique_ptr< EcalSimulationParameters > ReturnType
EcalSimParametersESModule(const edm::ParameterSet &)
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > cpvTokenDD4Hep_