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 subdetPars.reserve(it.second.size());
101 for (
const auto&
i : it.second)
102 subdetPars.emplace_back(std::round(
i));
103 putOne(subdet, subdetPars, ptp);
109 throw cms::Exception(
"MTDParametersFromDD") <<
"Not found " <<
name <<
" but needed.";
113 auto it = vmap.find(
"vPars");
114 if (it != end(vmap)) {
115 std::vector<int> tmpVec;
116 for (
const auto&
i : it->second)
117 tmpVec.emplace_back(std::round(
i));
124 mypar.filter(ref, attribute,
"MTD");
126 std::string topoModeS(mypar.specPar(
"mtdNumbering")->strValue(
"TopologyMode"));
128 if (!topoModeS.empty()) {
130 topoMode =
static_cast<int>(eparser);
133 throw cms::Exception(
"MTDParametersFromDD") <<
"Not found " << attribute.c_str() <<
" but needed.";
137 std::array<std::string, 8> etlLayout{{
138 "StartCopyNo_Front_Left",
139 "StartCopyNo_Front_Right",
140 "StartCopyNo_Back_Left",
141 "StartCopyNo_Back_Right",
143 "Offset_Front_Right",
148 for (
const auto&
name : etlLayout) {
150 for (
auto const& it : vmap) {
151 if (dd4hep::dd::compareEqual(dd4hep::dd::noNamespace(it.first),
name)) {
153 std::vector<int> ipos;
154 ipos.reserve(it.second.size());
155 for (
const auto&
i : it.second)
156 ipos.emplace_back(std::round(
i));
157 putOne(
sector, ipos, ptp);
163 throw cms::Exception(
"MTDParametersFromDD") <<
"Not found " <<
name <<
" but needed.";
177 auto print_item = [&]() {
178 std::stringstream
ss;
179 ss <<
item.id_ <<
" with " <<
item.vpars_.size() <<
" elements:";
180 for (
const auto& thePar :
item.vpars_) {
185 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