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.";
64 std::array<std::string, 8> etlLayout{{
65 "StartCopyNo_Front_Left",
66 "StartCopyNo_Front_Right",
67 "StartCopyNo_Back_Left",
68 "StartCopyNo_Back_Right",
75 for (
const auto&
name : etlLayout) {
93 std::array<std::string, 2> mtdSubdet{{
"BTL",
"ETL"}};
95 for (
const auto&
name : mtdSubdet) {
97 for (
auto const&
it : vmap) {
98 if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(
it.first),
name)) {
100 std::vector<int> subdetPars;
101 subdetPars.reserve(
it.second.size());
102 for (
const auto&
i :
it.second)
103 subdetPars.emplace_back(std::round(
i));
104 putOne(subdet, subdetPars, ptp);
110 throw cms::Exception(
"MTDParametersFromDD") <<
"Not found " <<
name <<
" but needed.";
114 auto it = vmap.find(
"vPars");
115 if (
it != end(vmap)) {
116 std::vector<int> tmpVec;
117 for (
const auto&
i :
it->second)
118 tmpVec.emplace_back(std::round(
i));
125 mypar.filter(ref, attribute,
"MTD");
127 std::string topoModeS(mypar.specPar(
"mtdNumbering")->strValue(
"TopologyMode"));
129 if (!topoModeS.empty()) {
131 topoMode =
static_cast<int>(eparser);
134 throw cms::Exception(
"MTDParametersFromDD") <<
"Not found " << attribute.c_str() <<
" but needed.";
139 std::array<std::string, 8> etlLayout{{
140 "StartCopyNo_Front_Left",
141 "StartCopyNo_Front_Right",
142 "StartCopyNo_Back_Left",
143 "StartCopyNo_Back_Right",
145 "Offset_Front_Right",
150 for (
const auto&
name : etlLayout) {
152 for (
auto const&
it : vmap) {
153 if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(
it.first),
name)) {
155 std::vector<int> ipos;
156 ipos.reserve(
it.second.size());
157 for (
const auto&
i :
it.second)
158 ipos.emplace_back(std::round(
i));
159 putOne(
sector, ipos, ptp);
165 throw cms::Exception(
"MTDParametersFromDD") <<
"Not found " <<
name <<
" but needed.";
179 auto print_item = [&]() {
180 std::stringstream
ss;
181 ss <<
item.id_ <<
" with " <<
item.vpars_.size() <<
" elements:";
182 for (
const auto& thePar :
item.vpars_) {
187 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