57 auto iDetExt = component.fDetId;
59 std::stringstream msg;
60 msg <<
"ModuleIndexMapFactory::MakeIndexMap: illegal detector subsystem enumeration: " << iDetExt
62 <<
"required to be non-negative";
63 throw std::out_of_range(msg.str());
65 if (iDetExt >=
static_cast<int>(vDetExtToInt.size())) {
66 vDetExtToInt.resize(iDetExt + 1, -1);
69 if (vDetExtToInt[iDetExt] == -1) {
71 vDetExtToInt[iDetExt] =
static_cast<int>(vDetIntToExt.size());
72 vDetIntToExt.push_back(iDetExt);
76 int nDet = vDetIntToExt.size();
77 vDetLocOffset.resize(nDet + 1, 0);
79 int pick = vDetExtToInt[component.fDetId] + 1;
80 vDetLocOffset[pick] = std::max(vDetLocOffset[pick], component.fLocId + 1);
82 for (
int iDet{0}; iDet < nDet; ++iDet) {
83 vDetLocOffset[iDet + 1] += vDetLocOffset[iDet];
87 vLocToGlb.resize(vDetLocOffset.back(), -1);
90 const auto& component{*itComp};
91 int iDetInt = vDetExtToInt[component.fDetId];
92 int iLoc = component.fLocId;
94 vLocToGlb[vDetLocOffset[iDetInt] + iLoc] = iGlb;
95 vGlbToLoc[iGlb] = std::pair(component.fDetId, iLoc);