CMS 3D CMS Logo

MuonNumberingESProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: DetectorDescription/MuonNumberingESProducer
4 // Class: MuonNumberingESProducer
5 //
13 //
14 // Original Author: Ianna Osborne
15 // Created: Tue, 15 Jan 2019 09:10:32 GMT
16 //
17 //
18 
19 #include <memory>
20 
28 
29 //#define EDM_ML_DEBUG
30 
32 public:
34  ~MuonNumberingESProducer() override;
35 
36  using ReturnType = std::unique_ptr<cms::MuonNumbering>;
37 
39 
40 private:
44 };
45 
47  : m_label(iConfig.getParameter<std::string>("label")),
48  m_key(iConfig.getParameter<std::string>("key")),
49  m_token(setWhatProduced(this).consumesFrom<cms::DDSpecParRegistry, DDSpecParRegistryRcd>(
50  edm::ESInputTag("", m_label))) {}
51 
53 
55 #ifdef EDM_ML_DEBUG
56  edm::LogVerbatim("MuonGeom") << "MuonNumberingESProducer::produce from " << m_label << " with " << m_key;
57 #endif
58  auto product = std::make_unique<cms::MuonNumbering>();
59 
60  cms::DDSpecParRegistry const& registry = iRecord.get(m_token);
61  auto it = registry.specpars.find(m_key);
62  if (it != end(registry.specpars)) {
63  for (const auto& l : it->second.spars) {
64  if (l.first == "OnlyForMuonNumbering") {
65  for (const auto& k : it->second.numpars) {
66  for (const auto& ik : k.second) {
67  product->put(k.first, static_cast<int>(ik)); //values.emplace(k.first, static_cast<int>(ik));
68  }
69  }
70  }
71  }
72  }
73  return product;
74 }
75 
Log< level::Info, true > LogVerbatim
dd4hep::SpecParRegistry DDSpecParRegistry
Definition: DDCompactView.h:28
std::unique_ptr< cms::MuonNumbering > ReturnType
MuonNumberingESProducer(const edm::ParameterSet &)
ReturnType produce(const MuonNumberingRecord &)
Namespace of DDCMS conversion namespace.
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
const edm::ESGetToken< cms::DDSpecParRegistry, DDSpecParRegistryRcd > m_token
HLT enums.
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const