68 std::vector<std::set<std::pair<int, uint32_t>>> units(stsSetup->GetNofDaughters());
69 for (
int iSt = 0; iSt < stsSetup->GetNofStations(); ++iSt) {
71 for (
int iLadder = 0; iLadder < station->
GetNofLadders(); ++iLadder) {
78 res.resize(units.size(), std::pair{std::numeric_limits<uint32_t>::max(), -1});
79 for (
size_t iUnit = 0; iUnit < units.size(); ++iUnit) {
80 const auto& unit = units[iUnit];
81 if (!unit.size())
continue;
83 auto& stationIdMapElement = res[iUnit];
84 stationIdMapElement.second = (*unit.begin()).first;
85 int curStationId = stationIdMapElement.second;
86 for (
const auto& [stationId, ladderId] : unit) {
87 if (stationId != curStationId) {
88 stationIdMapElement.first = ladderId;
89 curStationId = stationId;
96 int diffStationId = curStationId - stationIdMapElement.second;
97 if (diffStationId != 0 && diffStationId != 1) {
98 std::stringstream msg;
99 msg <<
"Failed to build a map of STS address to STS station index for unitId=" << iUnit <<
". "
100 <<
"The convention for distribution ladders over units was corrupted, and the current mapping"
101 <<
"scheme cannot be initialized. "
102 <<
"NOTE: the current map implementation relies on the next points:\n"
103 <<
" (1) ladders on a unit are attached to a single or two neighboring stations;\n"
104 <<
" (2) ladders within a unit are ordered in stationId\n"
105 <<
"Ladders, attached to the unitId=" << iUnit <<
" : ";
106 for (
const auto& p : units[iUnit]) {
107 msg <<
"(stationId=" << p.first <<
", ladderId=" << p.second <<
")";
109 throw std::logic_error(msg.str());
120 int nStations = stsSetup->GetNofStations();
121 std::vector<GeoVolume> fullVolumes;
122 fullVolumes.reserve(nStations);
123 for (
int iSt = 0; iSt < nStations; ++iSt) {
124 const auto* pStation{stsSetup->GetStation(iSt)};
125 fullVolumes.emplace_back(pStation->GetXmin(), pStation->GetXmax(), pStation->GetYmin(), pStation->GetYmax(),
126 pStation->GetZmin(), pStation->GetZmax());
129 std::vector<GeoVolume> activeVolumes = fullVolumes;
130 return {std::move(fullVolumes), std::move(activeVolumes)};