CMS 3D CMS Logo

CaloSimParametersESModule.cc
Go to the documentation of this file.
1 
13 
14 #include <memory>
15 
16 //#define EDM_ML_DEBUG
17 
19 public:
21  ~CaloSimParametersESModule(void) override;
22 
23  using ReturnType = std::unique_ptr<CaloSimulationParameters>;
24 
26 
28 
29 private:
33 };
34 
36  fromDD4Hep_ = ps.getParameter<bool>("fromDD4Hep");
37  auto cc = setWhatProduced(this);
40 
41 #ifdef EDM_ML_DEBUG
42  edm::LogVerbatim("HCalGeom") << "CaloSimParametersESModule::CaloSimParametersESModule called with dd4hep: "
43  << fromDD4Hep_;
44 #endif
45 }
46 
48 
51  desc.add<bool>("fromDD4Hep", false);
52  descriptions.add("caloSimulationParameters", desc);
53 }
54 
56 #ifdef EDM_ML_DEBUG
57  edm::LogVerbatim("HCalGeom") << "CaloSimParametersESModule::produce(const HcalParametersRcd& iRecord)";
58 #endif
59 
60  auto ptp = std::make_unique<CaloSimulationParameters>();
62  if (fromDD4Hep_) {
63 #ifdef EDM_ML_DEBUG
64  edm::LogVerbatim("HCalGeom") << "CaloSimParametersESModule::Try to access cms::DDCompactView";
65 #endif
67  builder.build(&(*cpv), *ptp);
68  } else {
69 #ifdef EDM_ML_DEBUG
70  edm::LogVerbatim("HCalGeom") << "CaloSimParametersESModule::Try to access DDCompactView";
71 #endif
73  builder.build(&(*cpv), *ptp);
74  }
75  return ptp;
76 }
77 
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
edm::ESGetToken< DDCompactView, IdealGeometryRecord > cpvTokenDDD_
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > cpvTokenDD4Hep_
std::unique_ptr< CaloSimulationParameters > ReturnType
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
ReturnType produce(const HcalParametersRcd &)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
void add(std::string const &label, ParameterSetDescription const &psetDescription)
CaloSimParametersESModule(const edm::ParameterSet &)
static void fillDescriptions(edm::ConfigurationDescriptions &)