// SPDX-FileCopyrightText: 2025 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #include "DetectorGeometryFixed.h" #include "JFJochException.h" DetectorGeometryFixed::DetectorGeometryFixed(int64_t width, int64_t height) { if ((width <= 0) || (height <= 0)) throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Cannot have negative fixed detector dimensions"); this->width = width; this->height = height; } int64_t DetectorGeometryFixed::GetModulesNum() const { return 1; } int64_t DetectorGeometryFixed::GetWidth(bool geom_transformed) const { return width; } int64_t DetectorGeometryFixed::GetHeight(bool geom_transformed) const { return height; } int64_t DetectorGeometryFixed::GetPixel0(int64_t module_number, bool geom_transformed) const { if (module_number != 0) throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Fixed geometry has only single module"); return 0; } int64_t DetectorGeometryFixed::GetX0(int64_t module_number) const { if (module_number != 0) throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Fixed geometry has only single module"); return 0; } int64_t DetectorGeometryFixed::GetY0(int64_t module_number) const { if (module_number != 0) throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Fixed geometry has only single module"); return 0; } int64_t DetectorGeometryFixed::GetFastDirectionStep(int64_t module_number) const { if (module_number != 0) throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Fixed geometry has only single module"); return 1; } int64_t DetectorGeometryFixed::GetSlowDirectionStep(int64_t module_number) const { if (module_number != 0) throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Fixed geometry has only single module"); return width; } Coord DetectorGeometryFixed::GetFastDirection(int64_t module_number) const { if (module_number != 0) throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Fixed geometry has only single module"); return {1,0,0}; } Coord DetectorGeometryFixed::GetSlowDirection(int64_t module_number) const { if (module_number != 0) throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Fixed geometry has only single module"); return {0,1,0}; } void DetectorGeometryFixed::VerticalFlip() { // Nothing; } bool DetectorGeometryFixed::IsModularDetector() const { return true; }