CMS 3D CMS Logo

MTDParametersESModule.cc
Go to the documentation of this file.
14 
15 #include <memory>
16 
18 public:
20 
21  using ReturnType = std::unique_ptr<PMTDParameters>;
22 
24 
26 
27 private:
29 
30  const bool fromDD4hep_;
33 };
34 
36  : fromDD4hep_(pset.getParameter<bool>("fromDD4hep")) {
37  auto cc = setWhatProduced(this);
38  if (!fromDD4hep_) {
40  } else {
42  }
43 }
44 
47  desc.add<bool>("fromDD4hep", false);
48  descriptions.add("mtdParameters", desc);
49 }
50 
52  auto ptp = std::make_unique<PMTDParameters>();
53  if (!fromDD4hep_) {
54  auto cpv = iRecord.getTransientHandle(ddCompactToken_);
55  builder.build(cpv.product(), *ptp);
56  } else {
57  auto cpv = iRecord.getTransientHandle(dd4hepToken_);
58  builder.build(cpv.product(), *ptp);
59  }
60 
61  return ptp;
62 }
63 
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
std::unique_ptr< PMTDParameters > ReturnType
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
ReturnType produce(const PMTDParametersRcd &)
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
static void fillDescriptions(edm::ConfigurationDescriptions &)
MTDParametersFromDD builder
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool build(const DDCompactView *, PMTDParameters &)
edm::ESGetToken< cms::DDCompactView, IdealGeometryRecord > dd4hepToken_
MTDParametersESModule(const edm::ParameterSet &)
edm::ESGetToken< DDCompactView, IdealGeometryRecord > ddCompactToken_