CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DDCompactView.cc
Go to the documentation of this file.
3 #include <DD4hep/Filter.h>
4 
5 #include <cmath>
6 #include <vector>
7 
8 template <>
9 std::vector<int> cms::DDCompactView::getVector<int>(const std::string& key) const {
10  std::vector<int> result;
11  const auto& vmap = this->detector()->vectors();
12  for (auto const& it : vmap) {
13  if (dd4hep::dd::noNamespace(it.first) == key) {
15  it.second.begin(), it.second.end(), std::back_inserter(result), [](int n) -> int { return (int)n; });
16  return result;
17  }
18  }
19  return result;
20 }
21 
22 template <>
23 std::vector<double> cms::DDCompactView::getVector<double>(const std::string& key) const {
24  const auto& vmap = this->detector()->vectors();
25  for (auto const& it : vmap) {
26  if (dd4hep::dd::noNamespace(it.first) == key) {
27  return it.second;
28  }
29  }
30  return std::vector<double>();
31 }
32 
33 template <>
34 std::vector<double> const& cms::DDCompactView::get<std::vector<double>>(const std::string& key) const {
35  const auto& vmap = this->detector()->vectors();
36  for (auto const& it : vmap) {
37  if (dd4hep::dd::noNamespace(it.first) == key) {
38  return it.second;
39  }
40  }
41  throw cms::Exception("DDError") << "no vector<double> with name " << key;
42 }
43 
44 template <>
45 std::vector<double> const& cms::DDCompactView::get<std::vector<double>>(const std::string& name,
46  const std::string& key) const {
47  const auto& spec = specpars().specPar(name);
48  if (spec != nullptr) {
49  auto const& nitem = spec->numpars.find(key);
50  if (nitem != end(spec->numpars)) {
51  return nitem->second;
52  }
53  }
54  throw cms::Exception("DDError") << "no SpecPar with name " << name << " and vector<double> key " << key;
55 }
tuple result
Definition: mps_fire.py:311
tuple key
prepare the HTCondor submission files and eventually submit them
string end
Definition: dataset.py:937
unsigned transform(const HcalDetId &id, unsigned transformCode)