CMS 3D CMS Logo

HGCalParametersESModule.cc
Go to the documentation of this file.
13 
14 //#define EDM_ML_DEBUG
15 
17 public:
19 
20  using ReturnType = std::unique_ptr<HGCalParameters>;
21 
23 
25 
26 private:
31 };
32 
34  name_ = iC.getParameter<std::string>("name");
35  name2_ = iC.getParameter<std::string>("name2");
36  namew_ = iC.getParameter<std::string>("nameW");
37  namec_ = iC.getParameter<std::string>("nameC");
38  namet_ = iC.getParameter<std::string>("nameT");
39  fromDD4Hep_ = iC.getParameter<bool>("fromDD4Hep");
40 #ifdef EDM_ML_DEBUG
41  edm::LogVerbatim("HGCalGeom") << "HGCalParametersESModule for " << name_ << ":" << namew_ << ":" << namec_ << ":"
42  << namet_ << " and fromDD4Hep flag " << fromDD4Hep_;
43 #endif
44  auto cc = setWhatProduced(this, name_);
45  cpvTokenDDD_ = cc.consumes<DDCompactView>(edm::ESInputTag());
47 }
48 
51  desc.add<std::string>("name", "HGCalEESensitive");
52  desc.add<std::string>("name2", "HGCalEE");
53  desc.add<std::string>("nameW", "HGCalEEWafer");
54  desc.add<std::string>("nameC", "HGCalEECell");
55  desc.add<std::string>("nameT", "HGCal");
56  desc.add<bool>("fromDD4Hep", false);
57  descriptions.add("hgcalEEParametersInitialize", desc);
58 }
59 
61 #ifdef EDM_ML_DEBUG
62  edm::LogVerbatim("HGCalGeom") << "HGCalParametersESModule::produce(const IdealGeometryRecord& iRecord)";
63 #endif
64  auto ptp = std::make_unique<HGCalParameters>(name_);
65  HGCalParametersFromDD builder;
66  if (fromDD4Hep_) {
67 #ifdef EDM_ML_DEBUG
68  edm::LogVerbatim("HGCalGeom") << "HGCalParametersESModule::Try to access cms::DDCompactView";
69 #endif
71  builder.build(cpv.product(), *ptp, name_, namew_, namec_, namet_, name2_);
72  } else {
73 #ifdef EDM_ML_DEBUG
74  edm::LogVerbatim("HGCalGeom") << "HGCalParametersESModule::Try to access DDCompactView";
75 #endif
77  builder.build(cpv.product(), *ptp, name_, namew_, namec_, namet_);
78  }
79  return ptp;
80 }
81 
82 // define this as a plug-in
T getParameter(std::string const &) const
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
ReturnType produce(const IdealGeometryRecord &)
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:80
std::unique_ptr< HGCalParameters > ReturnType
static void fillDescriptions(edm::ConfigurationDescriptions &)
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)
T const * product() const
HGCalParametersESModule(const edm::ParameterSet &)
edm::ESGetToken< DDCompactView, IdealGeometryRecord > cpvTokenDDD_
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > cpvTokenDD4Hep_