refactoring

This commit is contained in:
2025-07-02 14:08:00 +02:00
parent b775dd0efa
commit 6c4c60ca71
2 changed files with 17 additions and 28 deletions

View File

@@ -208,11 +208,12 @@ defs::xy Detector::getPortPerModuleGeometry() const {
Result<defs::xy> Detector::getPortSize(Positions pos) const {
Result<defs::xy> res = pimpl->Parallel(&Module::getNumberOfChannels, pos);
defs::xy portGeometry = getPortPerModuleGeometry();
if ((portGeometry.x != 1 && portGeometry.x != 2) || (portGeometry.y != 1 && portGeometry.y != 2)) {
throw RuntimeError("Port size is not 1 or 2 in either dimension. Port geometry:" + ToString(portGeometry));
}
for (auto &it : res) {
if (portGeometry.x == 2)
it.x /= 2;
if (portGeometry.y == 2)
it.y /= 2;
it.x /= portGeometry.x;
it.y /= portGeometry.y;
}
return res;
}