18 const std::vector<std::string>& fvec =
val.strings();
20 throw cms::Exception(
"MTDParametersFromDD") <<
"Failed to get " <<
s <<
" tag.";
25 result =
static_cast<int>(eparser);
28 throw cms::Exception(
"MTDParametersFromDD") <<
"Failed to get " <<
s <<
" tag.";
34 std::array<std::string, 2> mtdSubdet{{
"BTL",
"ETL"}};
36 for (
const auto&
name : mtdSubdet) {
41 putOne(subdet, subdetPars, ptp);
56 topoMode = getMTDTopologyMode(
"TopologyMode",
sv);
59 throw cms::Exception(
"MTDParametersFromDD") <<
"Not found " << attribute.c_str() <<
" but needed.";
63 std::array<std::string, 8> etlLayout{{
64 "StartCopyNo_Front_Left",
65 "StartCopyNo_Front_Right",
66 "StartCopyNo_Back_Left",
67 "StartCopyNo_Back_Right",
74 for (
const auto&
name : etlLayout) {
92 std::array<std::string, 2> mtdSubdet{{
"BTL",
"ETL"}};
94 for (
const auto&
name : mtdSubdet) {
96 for (
auto const& it : vmap) {
97 if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
name)) {
99 std::vector<int> subdetPars;
100 for (
const auto&
i : it.second)
101 subdetPars.emplace_back(std::round(
i));
102 putOne(subdet, subdetPars, ptp);
108 throw cms::Exception(
"MTDParametersFromDD") <<
"Not found " <<
name <<
" but needed.";
112 auto it = vmap.find(
"vPars");
113 if (it != end(vmap)) {
114 std::vector<int> tmpVec;
115 for (
const auto&
i : it->second)
116 tmpVec.emplace_back(std::round(
i));
123 mypar.filter(ref, attribute,
"MTD");
125 std::string topoModeS(mypar.specPar(
"mtdNumbering")->strValue(
"TopologyMode"));
127 if (!topoModeS.empty()) {
129 topoMode =
static_cast<int>(eparser);
132 throw cms::Exception(
"MTDParametersFromDD") <<
"Not found " << attribute.c_str() <<
" but needed.";
136 std::array<std::string, 8> etlLayout{{
137 "StartCopyNo_Front_Left",
138 "StartCopyNo_Front_Right",
139 "StartCopyNo_Back_Left",
140 "StartCopyNo_Back_Right",
142 "Offset_Front_Right",
147 for (
const auto&
name : etlLayout) {
149 for (
auto const& it : vmap) {
150 if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
name)) {
152 std::vector<int> ipos;
153 for (
const auto&
i : it.second)
154 ipos.emplace_back(std::round(
i));
155 putOne(
sector, ipos, ptp);
161 throw cms::Exception(
"MTDParametersFromDD") <<
"Not found " <<
name <<
" but needed.";
175 auto print_item = [&]() {
176 std::stringstream
ss;
177 ss <<
item.id_ <<
" with " <<
item.vpars_.size() <<
" elements:";
178 for (
const auto& thePar :
item.vpars_) {
183 edm::LogInfo(
"MTDParametersFromDD") <<
"Adding PMTDParameters item: " << print_item();
std::vector< Item > vitems_
dd4hep::SpecParRefs DDSpecParRefs
std::vector< double > const & vector(std::string_view iKey) const
returns an empty container if not found
const cms::DDDetector * detector() const
DDSpecParRegistry const & specpars() const
void putOne(int, std::vector< int > &, PMTDParameters &)
Compact representation of the geometrical detector hierarchy.
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
std::vector< int > vpars_
std::unordered_map< std::string, std::vector< double > > DDVectorsMap
dd4hep::SpecParRegistry DDSpecParRegistry
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Mode MTDStringToEnumParser(const std::string &)
ETLDetId::EtlLayout etlLayoutFromTopoMode(const int &topoMode)
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
DDsvalues_type mergedSpecifics() const
Log< level::Info, false > LogInfo
bool build(const DDCompactView *, PMTDParameters &)
bool firstChild()
set the current node to the first child ...
cms::DDVectorsMap const & vectors() const