DetectorModuleGeometry: More flexibility for modular geometry, allowing for non-zero top left corner

This commit is contained in:
2025-11-18 13:52:42 +01:00
parent a041b94a91
commit accbb6bd21
2 changed files with 31 additions and 2 deletions

View File

@@ -12,11 +12,24 @@ DetectorGeometryModular::DetectorGeometryModular(const std::vector<DetectorModul
width = 0;
height = 0;
int64_t min_x = modules[0].GetMinX();
int64_t max_x = modules[0].GetMaxX();
int64_t min_y = modules[0].GetMinY();
int64_t max_y = modules[0].GetMaxY();
for (auto &m: modules) {
width = std::max<int64_t>(width, m.GetMaxX()+1);
height = std::max<int64_t>(height, m.GetMaxY()+1);
min_x = std::min<int64_t>(min_x, m.GetMinX());
max_x = std::max<int64_t>(max_x, m.GetMaxX());
min_y = std::min<int64_t>(min_y, m.GetMinY());
max_y = std::max<int64_t>(max_y, m.GetMaxY());
}
width = max_x - min_x + 1;
height = max_y - min_y + 1;
for (auto &m: modules)
m.Translate(-min_x, -min_y);
if (vertical_flip)
VerticalFlip();
}