CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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_);
36  if (fromDD4hep_) {
38  } else {
40  }
41 
42 #ifdef EDM_ML_DEBUG
43  edm::LogVerbatim("EcalGeom") << "EcalSimParametersESModule::EcalSimParametersESModule called with dd4hep: "
44  << fromDD4hep_ << " for " << name_;
45 #endif
46 }
47 
50  desc.add<bool>("fromDD4hep", false);
51  desc.add<std::string>("name", "EcalHitsEB");
52  descriptions.add("ecalSimulationParametersEB", desc);
53 }
54 
56 #ifdef EDM_ML_DEBUG
57  edm::LogVerbatim("EcalGeom") << "EcalSimParametersESModule::produce(const IdealGeometryRecord& iRecord)";
58 #endif
59 
60  auto ptp = std::make_unique<EcalSimulationParameters>();
62  if (fromDD4hep_) {
63 #ifdef EDM_ML_DEBUG
64  edm::LogVerbatim("EcalGeom") << "EcalSimParametersESModule::Try to access cms::DDCompactView";
65 #endif
67  builder.build(&(*cpv), name_, *ptp);
68  } else {
69 #ifdef EDM_ML_DEBUG
70  edm::LogVerbatim("EcalGeom") << "EcalSimParametersESModule::Try to access DDCompactView";
71 #endif
73  builder.build(&(*cpv), name_, *ptp);
74  }
75  return ptp;
76 }
77 
Log< level::Info, true > LogVerbatim
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
ReturnType produce(const IdealGeometryRecord &)
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > cpvTokenDD4hep_
static void fillDescriptions(edm::ConfigurationDescriptions &)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
edm::ESGetToken< DDCompactView, IdealGeometryRecord > cpvTokenDDD_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::unique_ptr< EcalSimulationParameters > ReturnType
EcalSimParametersESModule(const edm::ParameterSet &)