From 0aaea316c541b78ae8c01d254d95c7ec5d3f614c Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Thu, 6 Aug 2026 16:28:00 +0200 Subject: [PATCH] 1010/update rx metadata threshold m3 (#1508) * update rx master file for all threshold energies(m3) when setting dac directly, custom trimbits, setting settings, trimbits etc * formatting * refactored for future modifications for eier * renaming * release notes --- RELEASE.md | 2 ++ slsDetectorSoftware/src/Module.cpp | 11 ++++++++++- slsDetectorSoftware/src/Module.h | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/RELEASE.md b/RELEASE.md index 7939a4d8d..e3697b73b 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -58,6 +58,8 @@ added rx_streamdummyheader to send the zmq dummy header any time. Allows pre-con zmqsocket - allowing hwm to be set already at the constructor level. As before, can still be set after construction with socket reconnection. +M3: threshold energy updated to -1 in receiver master file whenever it is set in the detector server (setting dacs directly, custom trimbit file, set all trimbits etc.) + 2 On-board Detector Server Compatibility ========================================== diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 80860ef8a..2fe19bd54 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -197,6 +197,7 @@ void Module::setSettings(detectorSettings isettings) { "Cannot set settings for Eiger. Use threshold energy."); } sendToDetector(F_SET_SETTINGS, isettings); + updateRxThresholdEnergyMetadata(); } int Module::getThresholdEnergy() const { @@ -415,9 +416,14 @@ void Module::setAllThresholdEnergy(std::array e_eV, throw RuntimeError("setThresholdEnergyAndSettings: Could not set " "settings in Module"); } +} +void Module::updateRxThresholdEnergyMetadata() { if (shm()->useReceiverFlag) { - sendToReceiver(F_RECEIVER_SET_ALL_THRESHOLD, e_eV, nullptr); + if (shm()->detType == MYTHEN3) { + auto e_eV = getAllThresholdEnergy(); + sendToReceiver(F_RECEIVER_SET_ALL_THRESHOLD, e_eV, nullptr); + } } } @@ -478,6 +484,7 @@ int Module::getAllTrimbits() const { void Module::setAllTrimbits(int val) { sendToDetector(F_SET_ALL_TRIMBITS, val); + updateRxThresholdEnergyMetadata(); } std::vector Module::getTrimEn() const { @@ -805,6 +812,7 @@ void Module::resetToDefaultDacs(const bool hardReset) { void Module::setDAC(int val, dacIndex index, bool mV) { int args[]{static_cast(index), static_cast(mV), val}; sendToDetector(F_SET_DAC, args); + updateRxThresholdEnergyMetadata(); } bool Module::getPowerChip() const { @@ -3605,6 +3613,7 @@ void Module::setModule(sls_detector_module &module, bool trimbits) { throw DetectorError("Module " + std::to_string(moduleIndex) + " returned error: " + client.readErrorMessage()); } + updateRxThresholdEnergyMetadata(); } sls_detector_module Module::getModule() { diff --git a/slsDetectorSoftware/src/Module.h b/slsDetectorSoftware/src/Module.h index 51b522ead..b52a44012 100644 --- a/slsDetectorSoftware/src/Module.h +++ b/slsDetectorSoftware/src/Module.h @@ -110,6 +110,7 @@ class Module : public virtual slsDetectorDefs { void setAllThresholdEnergy(std::array e_eV, detectorSettings isettings, bool trimbits); std::string getSettingsDir() const; + void updateRxThresholdEnergyMetadata(); std::string setSettingsDir(const std::string &dir); void loadTrimbits(const std::string &fname); void saveTrimbits(const std::string &fname);