// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #include #include "DetectorTransformation.h" DetectorTransformation::DetectorTransformation(std::string name, TransformationType type, const Coord &vector) : name(std::move(name)), type(type), vector(vector) { units = (type == TransformationType::Rotation) ? "deg" : "m"; } DetectorTransformation &DetectorTransformation::Name(const std::string &input) { name = input; return *this; } DetectorTransformation &DetectorTransformation::Type(TransformationType input) { type = input; return *this; } DetectorTransformation &DetectorTransformation::Units(const std::string &input) { units = input; return *this; } DetectorTransformation &DetectorTransformation::Vector(const Coord &input) { vector = input; return *this; } DetectorTransformation &DetectorTransformation::Offset(const Coord &input) { offset = input; return *this; } DetectorTransformation &DetectorTransformation::DependsOn(const std::string &input) { depends_on = input; return *this; } DetectorTransformation &DetectorTransformation::Equipment(const std::string &input) { equipment = input; return *this; } DetectorTransformation &DetectorTransformation::EquipmentComponent(const std::string &input) { equipment_component = input; return *this; } DetectorTransformation &DetectorTransformation::Values(const std::vector &input) { values = input; return *this; } DetectorTransformation &DetectorTransformation::Value(float input) { values = {input}; return *this; } const std::string &DetectorTransformation::GetName() const { return name; } TransformationType DetectorTransformation::GetType() const { return type; } const std::string &DetectorTransformation::GetUnits() const { return units; } Coord DetectorTransformation::GetVector() const { return vector; } Coord DetectorTransformation::GetOffset() const { return offset; } const std::string &DetectorTransformation::GetDependsOn() const { return depends_on; } const std::string &DetectorTransformation::GetEquipment() const { return equipment; } const std::string &DetectorTransformation::GetEquipmentComponent() const { return equipment_component; } const std::vector &DetectorTransformation::GetValues() const { return values; } bool DetectorTransformation::IsRotation() const { return type == TransformationType::Rotation; } bool DetectorTransformation::IsConstant() const { return values.size() <= 1; }