diff --git a/broker/gen/model/Detector.cpp b/broker/gen/model/Detector.cpp index e7bbd72d..0b686db6 100644 --- a/broker/gen/model/Detector.cpp +++ b/broker/gen/model/Detector.cpp @@ -40,6 +40,7 @@ Detector::Detector() m_Min_frame_time_ns = 0L; m_Min_frame_time_nsIsSet = false; m_Calibration_fileIsSet = false; + m_Trim_energies_eVIsSet = false; m_HostnameIsSet = false; m_Sensor_material = "Si"; m_Sensor_materialIsSet = false; @@ -221,6 +222,32 @@ bool Detector::validate(std::stringstream& msg, const std::string& pathPrefix) c } + if (trimEnergiesEVIsSet()) + { + const std::vector& value = m_Trim_energies_eV; + const std::string currentValuePath = _pathPrefix + ".trimEnergiesEV"; + + + { // Recursive validation of array elements + const std::string oldValuePath = currentValuePath; + int i = 0; + for (const int32_t& value : value) + { + const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]"; + + + if (value < 100) + { + success = false; + msg << currentValuePath << ": must be greater than or equal to 100;"; + } + + i++; + } + } + + } + if (hostnameIsSet()) { const std::vector& value = m_Hostname; @@ -345,6 +372,9 @@ bool Detector::operator==(const Detector& rhs) const ((!calibrationFileIsSet() && !rhs.calibrationFileIsSet()) || (calibrationFileIsSet() && rhs.calibrationFileIsSet() && getCalibrationFile() == rhs.getCalibrationFile())) && + ((!trimEnergiesEVIsSet() && !rhs.trimEnergiesEVIsSet()) || (trimEnergiesEVIsSet() && rhs.trimEnergiesEVIsSet() && getTrimEnergiesEV() == rhs.getTrimEnergiesEV())) && + + ((!hostnameIsSet() && !rhs.hostnameIsSet()) || (hostnameIsSet() && rhs.hostnameIsSet() && getHostname() == rhs.getHostname())) && @@ -406,6 +436,8 @@ void to_json(nlohmann::json& j, const Detector& o) j["min_frame_time_ns"] = o.m_Min_frame_time_ns; if(o.calibrationFileIsSet() || !o.m_Calibration_file.empty()) j["calibration_file"] = o.m_Calibration_file; + if(o.trimEnergiesEVIsSet() || !o.m_Trim_energies_eV.empty()) + j["trim_energies_eV"] = o.m_Trim_energies_eV; if(o.hostnameIsSet() || !o.m_Hostname.empty()) j["hostname"] = o.m_Hostname; if(o.sensorMaterialIsSet()) @@ -482,6 +514,11 @@ void from_json(const nlohmann::json& j, Detector& o) j.at("calibration_file").get_to(o.m_Calibration_file); o.m_Calibration_fileIsSet = true; } + if(j.find("trim_energies_eV") != j.end()) + { + j.at("trim_energies_eV").get_to(o.m_Trim_energies_eV); + o.m_Trim_energies_eVIsSet = true; + } if(j.find("hostname") != j.end()) { j.at("hostname").get_to(o.m_Hostname); @@ -713,6 +750,23 @@ void Detector::unsetCalibration_file() { m_Calibration_fileIsSet = false; } +std::vector Detector::getTrimEnergiesEV() const +{ + return m_Trim_energies_eV; +} +void Detector::setTrimEnergiesEV(std::vector const value) +{ + m_Trim_energies_eV = value; + m_Trim_energies_eVIsSet = true; +} +bool Detector::trimEnergiesEVIsSet() const +{ + return m_Trim_energies_eVIsSet; +} +void Detector::unsetTrim_energies_eV() +{ + m_Trim_energies_eVIsSet = false; +} std::vector Detector::getHostname() const { return m_Hostname; diff --git a/broker/gen/model/Detector.h b/broker/gen/model/Detector.h index 999949c4..ee24d86d 100644 --- a/broker/gen/model/Detector.h +++ b/broker/gen/model/Detector.h @@ -139,6 +139,13 @@ public: bool calibrationFileIsSet() const; void unsetCalibration_file(); /// + /// List of energies at which trimming calibration is provided. Only needed for PSI EIGER and compulsory in this case + /// + std::vector getTrimEnergiesEV() const; + void setTrimEnergiesEV(std::vector const value); + bool trimEnergiesEVIsSet() const; + void unsetTrim_energies_eV(); + /// /// Hostname for detector module. One entry per module One entry per module. Either empty or number of module entries. /// std::vector getHostname() const; @@ -234,6 +241,8 @@ protected: bool m_Min_frame_time_nsIsSet; std::vector m_Calibration_file; bool m_Calibration_fileIsSet; + std::vector m_Trim_energies_eV; + bool m_Trim_energies_eVIsSet; std::vector m_Hostname; bool m_HostnameIsSet; std::string m_Sensor_material; diff --git a/broker/jfjoch_api.yaml b/broker/jfjoch_api.yaml index 31a53a89..00e70e80 100644 --- a/broker/jfjoch_api.yaml +++ b/broker/jfjoch_api.yaml @@ -2121,6 +2121,15 @@ components: For EIGER: one directory (with detector settings) or list of trim bit files, one entry per half-module. items: type: string + trim_energies_eV: + type: array + description: | + List of energies at which trimming calibration is provided. + Only needed for PSI EIGER and compulsory in this case + items: + type: integer + format: int32 + minimum: 100 hostname: type: array description: | diff --git a/broker/redoc-static.html b/broker/redoc-static.html index 2fceca1b..0bc418af 100644 --- a/broker/redoc-static.html +++ b/broker/redoc-static.html @@ -937,7 +937,7 @@ then image might be replaced in the buffer between calling /images and /image.cb