/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
DetectorDescription/DDCMS/src/DDCompactView.cc
55 строк
2 KB
Ianna Osborne
final changes to replace tbb with std - requires updated dd4hep
20 окт 2020, 10:38
20 окт 2020, 10:38
966e129
Код
Авторство
О чём код?
#include "DetectorDescription/DDCMS/interface/DDCompactView.h" #include "FWCore/Utilities/interface/Exception.h" #include <DD4hep/Filter.h> #include <cmath> #include <vector> template <> std::vector<int> cms::DDCompactView::getVector<int>(const std::string& key) const { std::vector<int> result; const auto& vmap = this->detector()->vectors(); for (auto const& it : vmap) { if (dd4hep::dd::noNamespace(it.first) == key) { std::transform( it.second.begin(), it.second.end(), std::back_inserter(result), [](int n) -> int { return (int)n; }); return result; } } return result; } template <> std::vector<double> cms::DDCompactView::getVector<double>(const std::string& key) const { const auto& vmap = this->detector()->vectors(); for (auto const& it : vmap) { if (dd4hep::dd::noNamespace(it.first) == key) { return it.second; } } return std::vector<double>(); } template <> std::vector<double> const& cms::DDCompactView::get<std::vector<double>>(const std::string& key) const { const auto& vmap = this->detector()->vectors(); for (auto const& it : vmap) { if (dd4hep::dd::noNamespace(it.first) == key) { return it.second; } } throw cms::Exception("DDError") << "no vector<double> with name " << key; } template <> std::vector<double> const& cms::DDCompactView::get<std::vector<double>>(const std::string& name, const std::string& key) const { const auto& spec = specpars().specPar(name); if (spec != nullptr) { auto const& nitem = spec->numpars.find(key); if (nitem != end(spec->numpars)) { return nitem->second; } } throw cms::Exception("DDError") << "no SpecPar with name " << name << " and vector<double> key " << key; }