From 1a338346d5000b6b588f984c5ddc54fad8bd7e85 Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Mon, 19 Jun 2023 16:05:30 +0200 Subject: [PATCH] 2. Ctb fname voltage (#768) * power and sense returning dac indices instead of int in Detector class * power -> voltage, sense -> slowadc --- python/slsdet/detector.py | 24 ++-- python/src/detector.cpp | 40 +++---- slsDetectorSoftware/include/sls/Detector.h | 20 ++-- slsDetectorSoftware/src/CmdProxy.h | 48 ++++---- slsDetectorSoftware/src/CtbConfig.cpp | 86 +++++++------- slsDetectorSoftware/src/CtbConfig.h | 28 ++--- slsDetectorSoftware/src/Detector.cpp | 54 ++++----- slsDetectorSoftware/src/DetectorImpl.cpp | 32 ++--- slsDetectorSoftware/src/DetectorImpl.h | 16 +-- .../tests/test-CmdProxy-chiptestboard.cpp | 112 +++++++++--------- slsDetectorSoftware/tests/test-CtbConfig.cpp | 12 +- 11 files changed, 236 insertions(+), 236 deletions(-) diff --git a/python/slsdet/detector.py b/python/slsdet/detector.py index 68a3b2373..d8df1c5b7 100755 --- a/python/slsdet/detector.py +++ b/python/slsdet/detector.py @@ -1803,30 +1803,30 @@ class Detector(CppDetectorApi): self.setSignalNames(value) @property - def powerlist(self): + def voltagelist(self): """ - List of names for every power supply for this board. 5 power supply + List of names for every voltage for this board. 5 voltage supply :setter: Only implemented for Chiptestboard """ - return self.getPowerNames() + return self.getVoltageNames() - @powerlist.setter - def powerlist(self, value): - self.setPowerNames(value) + @voltagelist.setter + def voltagelist(self, value): + self.setVoltageNames(value) @property - def senselist(self): + def slowadclist(self): """ - List of names for every sense for this board. 8 sense + List of names for every slowadc for this board. 8 slowadc :setter: Only implemented for Chiptestboard """ - return self.getSenseNames() + return self.getSlowAdcNames() - @senselist.setter - def senselist(self, value): - self.setSenseNames(value) + @slowadclist.setter + def slowadclist(self, value): + self.setSlowAdcNames(value) @property def dacvalues(self): diff --git a/python/src/detector.cpp b/python/src/detector.cpp index 37f85c689..dea965a63 100644 --- a/python/src/detector.cpp +++ b/python/src/detector.cpp @@ -1695,47 +1695,47 @@ void init_det(py::module &m) { (std::string(Detector::*)(const int) const) & Detector::getSignalName, py::arg()); - CppDetectorApi.def("setPowerNames", + CppDetectorApi.def("setVoltageNames", (void (Detector::*)(const std::vector)) & - Detector::setPowerNames, + Detector::setVoltageNames, py::arg()); - CppDetectorApi.def("getPowerNames", + CppDetectorApi.def("getVoltageNames", (std::vector(Detector::*)() const) & - Detector::getPowerNames); + Detector::getVoltageNames); CppDetectorApi.def( - "getPowerIndex", + "getVoltageIndex", (defs::dacIndex(Detector::*)(const std::string &) const) & - Detector::getPowerIndex, + Detector::getVoltageIndex, py::arg()); CppDetectorApi.def( - "setPowerName", + "setVoltageName", (void (Detector::*)(const defs::dacIndex, const std::string &)) & - Detector::setPowerName, + Detector::setVoltageName, py::arg(), py::arg()); - CppDetectorApi.def("getPowerName", + CppDetectorApi.def("getVoltageName", (std::string(Detector::*)(const defs::dacIndex) const) & - Detector::getPowerName, + Detector::getVoltageName, py::arg()); - CppDetectorApi.def("setSenseNames", + CppDetectorApi.def("setSlowAdcNames", (void (Detector::*)(const std::vector)) & - Detector::setSenseNames, + Detector::setSlowAdcNames, py::arg()); - CppDetectorApi.def("getSenseNames", + CppDetectorApi.def("getSlowAdcNames", (std::vector(Detector::*)() const) & - Detector::getSenseNames); + Detector::getSlowAdcNames); CppDetectorApi.def( - "getSenseIndex", + "getSlowAdcIndex", (defs::dacIndex(Detector::*)(const std::string &) const) & - Detector::getSenseIndex, + Detector::getSlowAdcIndex, py::arg()); CppDetectorApi.def( - "setSenseName", + "setSlowAdcName", (void (Detector::*)(const defs::dacIndex, const std::string &)) & - Detector::setSenseName, + Detector::setSlowAdcName, py::arg(), py::arg()); - CppDetectorApi.def("getSenseName", + CppDetectorApi.def("getSlowAdcName", (std::string(Detector::*)(const defs::dacIndex) const) & - Detector::getSenseName, + Detector::getSlowAdcName, py::arg()); CppDetectorApi.def( "setPattern", diff --git a/slsDetectorSoftware/include/sls/Detector.h b/slsDetectorSoftware/include/sls/Detector.h index e38006626..45be0bb05 100644 --- a/slsDetectorSoftware/include/sls/Detector.h +++ b/slsDetectorSoftware/include/sls/Detector.h @@ -1765,34 +1765,34 @@ class Detector { std::string getSignalName(const int i) const; /** [CTB] */ - void setPowerNames(const std::vector names); + void setVoltageNames(const std::vector names); /** [CTB] */ - std::vector getPowerNames() const; + std::vector getVoltageNames() const; /** [CTB] */ - defs::dacIndex getPowerIndex(const std::string &name) const; + defs::dacIndex getVoltageIndex(const std::string &name) const; /** [CTB] */ - void setPowerName(const defs::dacIndex i, const std::string &name); + void setVoltageName(const defs::dacIndex i, const std::string &name); /** [CTB] */ - std::string getPowerName(const defs::dacIndex i) const; + std::string getVoltageName(const defs::dacIndex i) const; /** [CTB] */ - void setSenseNames(const std::vector names); + void setSlowAdcNames(const std::vector names); /** [CTB] */ - std::vector getSenseNames() const; + std::vector getSlowAdcNames() const; /** [CTB] */ - defs::dacIndex getSenseIndex(const std::string &name) const; + defs::dacIndex getSlowAdcIndex(const std::string &name) const; /** [CTB] */ - void setSenseName(const defs::dacIndex i, const std::string &name); + void setSlowAdcName(const defs::dacIndex i, const std::string &name); /** [CTB] */ - std::string getSenseName(const defs::dacIndex i) const; + std::string getSlowAdcName(const defs::dacIndex i) const; ///@} diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index 18ac8a8d9..ddea0dbf3 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -1011,12 +1011,12 @@ class CmdProxy { {"signallist", &CmdProxy::signallist}, {"signalname", &CmdProxy::signalname}, {"signalindex", &CmdProxy::signalindex}, - {"powerlist", &CmdProxy::powerlist}, - {"powername", &CmdProxy::powername}, - {"powerindex", &CmdProxy::powerindex}, - {"senselist", &CmdProxy::senselist}, - {"sensename", &CmdProxy::sensename}, - {"senseindex", &CmdProxy::senseindex}, + {"voltagelist", &CmdProxy::voltagelist}, + {"voltagename", &CmdProxy::voltagename}, + {"voltageindex", &CmdProxy::voltageindex}, + {"slowadclist", &CmdProxy::slowadclist}, + {"slowadcname", &CmdProxy::slowadcname}, + {"slowadcindex", &CmdProxy::slowadcindex}, /* dacs */ {"dac", &CmdProxy::Dac}, @@ -1684,7 +1684,7 @@ class CmdProxy { /* lists */ CTB_SINGLE_DACNAME(dacname, getDacName, setDacName, defs::DAC_0, - "\n\t[0-18][name] \n\t\t[ChipTestBoard] Set " + "\n\t[0-17][name] \n\t\t[ChipTestBoard] Set " "the dac at the given position to the given name."); CTB_GET_DACINDEX(dacindex, getDacIndex, defs::DAC_0, @@ -1709,7 +1709,7 @@ class CmdProxy { "the list of signal names for this board."); CTB_SINGLE_NAME(signalname, getSignalName, setSignalName, - "[0-31][name] \n\t\t[ChipTestBoard] Set " + "[0-63][name] \n\t\t[ChipTestBoard] Set " "the signal at the given position to the given name."); CTB_GET_INDEX(signalindex, getSignalIndex, @@ -1717,30 +1717,30 @@ class CmdProxy { "the signal index for the given name."); CTB_NAMED_LIST( - powerlist, getPowerNames, setPowerNames, - "[powername1 powername2 .. powername4] \n\t\t[ChipTestBoard] Set " - "the list of power names for this board."); + voltagelist, getVoltageNames, setVoltageNames, + "[voltagename1 voltagename2 .. voltagename4] \n\t\t[ChipTestBoard] Set " + "the list of voltage names for this board."); - CTB_SINGLE_DACNAME(powername, getPowerName, setPowerName, defs::V_POWER_A, - "[0-31][name] \n\t\t[ChipTestBoard] Set " - "the power at the given position to the given name."); + CTB_SINGLE_DACNAME(voltagename, getVoltageName, setVoltageName, defs::V_POWER_A, + "[0-4][name] \n\t\t[ChipTestBoard] Set " + "the voltage at the given position to the given name."); - CTB_GET_DACINDEX(powerindex, getPowerIndex, defs::V_POWER_A, + CTB_GET_DACINDEX(voltageindex, getVoltageIndex, defs::V_POWER_A, "[name] \n\t\t[ChipTestBoard] Get " - "the power index for the given name."); + "the voltage index for the given name."); CTB_NAMED_LIST( - senselist, getSenseNames, setSenseNames, - "[sensename1 sensename2 .. sensename7] \n\t\t[ChipTestBoard] Set " - "the list of sense names for this board."); + slowadclist, getSlowAdcNames, setSlowAdcNames, + "[slowadcname1 slowadcname2 .. slowadcname7] \n\t\t[ChipTestBoard] Set " + "the list of slowadc names for this board."); - CTB_SINGLE_DACNAME(sensename, getSenseName, setSenseName, defs::SLOW_ADC0, - "[0-31][name] \n\t\t[ChipTestBoard] Set " - "the sense at the given position to the given name."); + CTB_SINGLE_DACNAME(slowadcname, getSlowAdcName, setSlowAdcName, defs::SLOW_ADC0, + "[0-7][name] \n\t\t[ChipTestBoard] Set " + "the slowadc at the given position to the given name."); - CTB_GET_DACINDEX(senseindex, getSenseIndex, defs::SLOW_ADC0, + CTB_GET_DACINDEX(slowadcindex, getSlowAdcIndex, defs::SLOW_ADC0, "[name] \n\t\t[ChipTestBoard] Get " - "the sense index for the given name."); + "the slowadc index for the given name."); /* dacs */ diff --git a/slsDetectorSoftware/src/CtbConfig.cpp b/slsDetectorSoftware/src/CtbConfig.cpp index a3f8e03f4..77edb1a3d 100644 --- a/slsDetectorSoftware/src/CtbConfig.cpp +++ b/slsDetectorSoftware/src/CtbConfig.cpp @@ -20,13 +20,13 @@ CtbConfig::CtbConfig() { for (size_t i = 0; i != num_signals; ++i) { setSignalName(i, "BIT" + ToString(i)); } - setPowerName(0, "VA"); - setPowerName(1, "VB"); - setPowerName(2, "VC"); - setPowerName(3, "VD"); - setPowerName(4, "VIO"); - for (size_t i = 0; i != num_senses; ++i) { - setSenseName(i, "SENSE" + ToString(i)); + setVoltageName(0, "VA"); + setVoltageName(1, "VB"); + setVoltageName(2, "VC"); + setVoltageName(3, "VD"); + setVoltageName(4, "VIO"); + for (size_t i = 0; i != num_slowAdcs; ++i) { + setSlowAdcName(i, "SLOWADC" + ToString(i)); } } @@ -54,19 +54,19 @@ void CtbConfig::check_signal_index(size_t i) const { } } -void CtbConfig::check_power_index(size_t i) const { - if (i >= num_powers) { +void CtbConfig::check_voltage_index(size_t i) const { + if (i >= num_voltages) { std::ostringstream oss; - oss << "Invalid Power index. Options: 0 - " << num_signals + oss << "Invalid Voltage index. Options: 0 - " << num_voltages << " or V_POWER_A - V_POWER_IO"; throw RuntimeError(oss.str()); } } -void CtbConfig::check_sense_index(size_t i) const { - if (i >= num_senses) { +void CtbConfig::check_slow_adc_index(size_t i) const { + if (i >= num_slowAdcs) { std::ostringstream oss; - oss << "Invalid Sense index. Options: 0 - " << num_senses + oss << "Invalid Slow ADC index. Options: 0 - " << num_slowAdcs << " or SLOW_ADC0 - SLOW_ADC7"; throw RuntimeError(oss.str()); } @@ -176,63 +176,63 @@ std::vector CtbConfig::getSignalNames() const { return names; } -void CtbConfig::setPowerName(size_t index, const std::string &name) { - check_power_index(index); +void CtbConfig::setVoltageName(size_t index, const std::string &name) { + check_voltage_index(index); check_size(name); - char *dst = &powernames[index * name_length]; + char *dst = &voltagenames[index * name_length]; memset(dst, '\0', name_length); memcpy(dst, &name[0], name.size()); } -void CtbConfig::setPowerNames(const std::vector &names) { - if (names.size() != num_powers) { - throw RuntimeError("Power names need to be of size " + - std::to_string(num_powers)); +void CtbConfig::setVoltageNames(const std::vector &names) { + if (names.size() != num_voltages) { + throw RuntimeError("Voltage names need to be of size " + + std::to_string(num_voltages)); } - for (size_t i = 0; i != num_powers; ++i) { - setPowerName(i, names[i]); + for (size_t i = 0; i != num_voltages; ++i) { + setVoltageName(i, names[i]); } } -std::string CtbConfig::getPowerName(size_t index) const { - check_power_index(index); - return powernames + index * name_length; +std::string CtbConfig::getVoltageName(size_t index) const { + check_voltage_index(index); + return voltagenames + index * name_length; } -std::vector CtbConfig::getPowerNames() const { +std::vector CtbConfig::getVoltageNames() const { std::vector names; - for (size_t i = 0; i != num_powers; ++i) - names.push_back(getPowerName(i)); + for (size_t i = 0; i != num_voltages; ++i) + names.push_back(getVoltageName(i)); return names; } -void CtbConfig::setSenseName(size_t index, const std::string &name) { - check_sense_index(index); +void CtbConfig::setSlowAdcName(size_t index, const std::string &name) { + check_slow_adc_index(index); check_size(name); - char *dst = &sensenames[index * name_length]; + char *dst = &slowAdcnames[index * name_length]; memset(dst, '\0', name_length); memcpy(dst, &name[0], name.size()); } -void CtbConfig::setSenseNames(const std::vector &names) { - if (names.size() != num_senses) { - throw RuntimeError("Sense names need to be of size " + - std::to_string(num_senses)); +void CtbConfig::setSlowAdcNames(const std::vector &names) { + if (names.size() != num_slowAdcs) { + throw RuntimeError("Slow ADC names need to be of size " + + std::to_string(num_slowAdcs)); } - for (size_t i = 0; i != num_senses; ++i) { - setSenseName(i, names[i]); + for (size_t i = 0; i != num_slowAdcs; ++i) { + setSlowAdcName(i, names[i]); } } -std::string CtbConfig::getSenseName(size_t index) const { - check_sense_index(index); - return sensenames + index * name_length; +std::string CtbConfig::getSlowAdcName(size_t index) const { + check_slow_adc_index(index); + return slowAdcnames + index * name_length; } -std::vector CtbConfig::getSenseNames() const { +std::vector CtbConfig::getSlowAdcNames() const { std::vector names; - for (size_t i = 0; i != num_senses; ++i) - names.push_back(getSenseName(i)); + for (size_t i = 0; i != num_slowAdcs; ++i) + names.push_back(getSlowAdcName(i)); return names; } diff --git a/slsDetectorSoftware/src/CtbConfig.h b/slsDetectorSoftware/src/CtbConfig.h index e110767f4..78863f5f6 100644 --- a/slsDetectorSoftware/src/CtbConfig.h +++ b/slsDetectorSoftware/src/CtbConfig.h @@ -8,20 +8,20 @@ class CtbConfig { static constexpr size_t num_dacs = 18; static constexpr size_t num_adcs = 32; static constexpr size_t num_signals = 64; - static constexpr size_t num_powers = 5; - static constexpr size_t num_senses = 8; + static constexpr size_t num_voltages = 5; + static constexpr size_t num_slowAdcs = 8; static constexpr const char *shm_tag_ = "ctbdacs"; char dacnames[name_length * num_dacs]{}; char adcnames[name_length * num_adcs]{}; char signalnames[name_length * num_signals]{}; - char powernames[name_length * num_powers]{}; - char sensenames[name_length * num_senses]{}; + char voltagenames[name_length * num_voltages]{}; + char slowAdcnames[name_length * num_slowAdcs]{}; void check_dac_index(size_t i) const; void check_adc_index(size_t i) const; void check_signal_index(size_t i) const; - void check_power_index(size_t i) const; - void check_sense_index(size_t i) const; + void check_voltage_index(size_t i) const; + void check_slow_adc_index(size_t i) const; void check_size(const std::string &name) const; public: @@ -46,15 +46,15 @@ class CtbConfig { std::string getSignalName(size_t index) const; std::vector getSignalNames() const; - void setPowerNames(const std::vector &names); - void setPowerName(size_t index, const std::string &name); - std::string getPowerName(size_t index) const; - std::vector getPowerNames() const; + void setVoltageNames(const std::vector &names); + void setVoltageName(size_t index, const std::string &name); + std::string getVoltageName(size_t index) const; + std::vector getVoltageNames() const; - void setSenseNames(const std::vector &names); - void setSenseName(size_t index, const std::string &name); - std::string getSenseName(size_t index) const; - std::vector getSenseNames() const; + void setSlowAdcNames(const std::vector &names); + void setSlowAdcName(size_t index, const std::string &name); + std::string getSlowAdcName(size_t index) const; + std::vector getSlowAdcNames() const; static const char *shm_tag(); }; diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index c8277e62e..be93dfa6b 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -2312,74 +2312,74 @@ std::string Detector::getSignalName(const int i) const { return pimpl->getCtbSignalName(i); } -void Detector::setPowerNames(const std::vector names) { +void Detector::setVoltageNames(const std::vector names) { if (getDetectorType().squash() != defs::CHIPTESTBOARD) throw RuntimeError("Named powers only for CTB"); - pimpl->setCtbPowerNames(names); + pimpl->setCtbVoltageNames(names); } -std::vector Detector::getPowerNames() const { +std::vector Detector::getVoltageNames() const { if (getDetectorType().squash() != defs::CHIPTESTBOARD) throw RuntimeError("Named powers only for CTB"); - return pimpl->getCtbPowerNames(); + return pimpl->getCtbVoltageNames(); } -defs::dacIndex Detector::getPowerIndex(const std::string &name) const { +defs::dacIndex Detector::getVoltageIndex(const std::string &name) const { if (getDetectorType().squash() != defs::CHIPTESTBOARD) throw RuntimeError("Named powers only for CTB"); - auto names = getPowerNames(); + auto names = getVoltageNames(); auto it = std::find(names.begin(), names.end(), name); if (it == names.end()) - throw RuntimeError("Power name not found"); + throw RuntimeError("Voltage name not found"); return static_cast(it - names.begin() + defs::V_POWER_A); } -void Detector::setPowerName(const defs::dacIndex index, +void Detector::setVoltageName(const defs::dacIndex index, const std::string &name) { if (getDetectorType().squash() != defs::CHIPTESTBOARD) throw RuntimeError("Named powers only for CTB"); - pimpl->setCtbPowerName(index, name); + pimpl->setCtbVoltageName(index, name); } -std::string Detector::getPowerName(const defs::dacIndex i) const { +std::string Detector::getVoltageName(const defs::dacIndex i) const { if (getDetectorType().squash() != defs::CHIPTESTBOARD) throw RuntimeError("Named powers only for CTB"); - return pimpl->getCtbPowerName(i); + return pimpl->getCtbVoltageName(i); } -void Detector::setSenseNames(const std::vector names) { +void Detector::setSlowAdcNames(const std::vector names) { if (getDetectorType().squash() != defs::CHIPTESTBOARD) - throw RuntimeError("Named senses only for CTB"); - pimpl->setCtbSenseNames(names); + throw RuntimeError("Named SlowAdcs only for CTB"); + pimpl->setCtbSlowAdcNames(names); } -std::vector Detector::getSenseNames() const { +std::vector Detector::getSlowAdcNames() const { if (getDetectorType().squash() != defs::CHIPTESTBOARD) - throw RuntimeError("Named senses only for CTB"); - return pimpl->getCtbSenseNames(); + throw RuntimeError("Named SlowAdcs only for CTB"); + return pimpl->getCtbSlowAdcNames(); } -defs::dacIndex Detector::getSenseIndex(const std::string &name) const { +defs::dacIndex Detector::getSlowAdcIndex(const std::string &name) const { if (getDetectorType().squash() != defs::CHIPTESTBOARD) - throw RuntimeError("Named senses only for CTB"); - auto names = getSenseNames(); + throw RuntimeError("Named SlowAdcs only for CTB"); + auto names = getSlowAdcNames(); auto it = std::find(names.begin(), names.end(), name); if (it == names.end()) - throw RuntimeError("Sense name not found"); + throw RuntimeError("SlowAdc name not found"); return static_cast(it - names.begin() + defs::SLOW_ADC0); } -void Detector::setSenseName(const defs::dacIndex index, +void Detector::setSlowAdcName(const defs::dacIndex index, const std::string &name) { if (getDetectorType().squash() != defs::CHIPTESTBOARD) - throw RuntimeError("Named senses only for CTB"); - pimpl->setCtbSenseName(index, name); + throw RuntimeError("Named SlowAdcs only for CTB"); + pimpl->setCtbSlowAdcName(index, name); } -std::string Detector::getSenseName(const defs::dacIndex i) const { +std::string Detector::getSlowAdcName(const defs::dacIndex i) const { if (getDetectorType().squash() != defs::CHIPTESTBOARD) - throw RuntimeError("Named senses only for CTB"); - return pimpl->getCtbSenseName(i); + throw RuntimeError("Named SlowAdcs only for CTB"); + return pimpl->getCtbSlowAdcName(i); } // Pattern diff --git a/slsDetectorSoftware/src/DetectorImpl.cpp b/slsDetectorSoftware/src/DetectorImpl.cpp index 7e2f941ec..0a74b412f 100644 --- a/slsDetectorSoftware/src/DetectorImpl.cpp +++ b/slsDetectorSoftware/src/DetectorImpl.cpp @@ -2038,38 +2038,38 @@ void DetectorImpl::setCtbSignalName(const int index, const std::string &name) { ctb_shm()->setSignalName(index, name); } -std::vector DetectorImpl::getCtbPowerNames() const { - return ctb_shm()->getPowerNames(); +std::vector DetectorImpl::getCtbVoltageNames() const { + return ctb_shm()->getVoltageNames(); } -void DetectorImpl::setCtbPowerNames(const std::vector &names) { - ctb_shm()->setPowerNames(names); +void DetectorImpl::setCtbVoltageNames(const std::vector &names) { + ctb_shm()->setVoltageNames(names); } -std::string DetectorImpl::getCtbPowerName(const defs::dacIndex i) const { - return ctb_shm()->getPowerName(static_cast(i - defs::V_POWER_A)); +std::string DetectorImpl::getCtbVoltageName(const defs::dacIndex i) const { + return ctb_shm()->getVoltageName(static_cast(i - defs::V_POWER_A)); } -void DetectorImpl::setCtbPowerName(const defs::dacIndex index, +void DetectorImpl::setCtbVoltageName(const defs::dacIndex index, const std::string &name) { - ctb_shm()->setPowerName(static_cast(index - defs::V_POWER_A), name); + ctb_shm()->setVoltageName(static_cast(index - defs::V_POWER_A), name); } -std::vector DetectorImpl::getCtbSenseNames() const { - return ctb_shm()->getSenseNames(); +std::vector DetectorImpl::getCtbSlowAdcNames() const { + return ctb_shm()->getSlowAdcNames(); } -void DetectorImpl::setCtbSenseNames(const std::vector &names) { - ctb_shm()->setSenseNames(names); +void DetectorImpl::setCtbSlowAdcNames(const std::vector &names) { + ctb_shm()->setSlowAdcNames(names); } -std::string DetectorImpl::getCtbSenseName(const defs::dacIndex i) const { - return ctb_shm()->getSenseName(static_cast(i - defs::SLOW_ADC0)); +std::string DetectorImpl::getCtbSlowAdcName(const defs::dacIndex i) const { + return ctb_shm()->getSlowAdcName(static_cast(i - defs::SLOW_ADC0)); } -void DetectorImpl::setCtbSenseName(const defs::dacIndex index, +void DetectorImpl::setCtbSlowAdcName(const defs::dacIndex index, const std::string &name) { - ctb_shm()->setSenseName(static_cast(index - defs::SLOW_ADC0), name); + ctb_shm()->setSlowAdcName(static_cast(index - defs::SLOW_ADC0), name); } } // namespace sls \ No newline at end of file diff --git a/slsDetectorSoftware/src/DetectorImpl.h b/slsDetectorSoftware/src/DetectorImpl.h index ef7cd5441..08727df07 100644 --- a/slsDetectorSoftware/src/DetectorImpl.h +++ b/slsDetectorSoftware/src/DetectorImpl.h @@ -340,15 +340,15 @@ class DetectorImpl : public virtual slsDetectorDefs { void setCtbSignalNames(const std::vector &names); void setCtbSignalName(const int index, const std::string &name); - std::vector getCtbPowerNames() const; - std::string getCtbPowerName(const defs::dacIndex i) const; - void setCtbPowerNames(const std::vector &names); - void setCtbPowerName(const defs::dacIndex index, const std::string &name); + std::vector getCtbVoltageNames() const; + std::string getCtbVoltageName(const defs::dacIndex i) const; + void setCtbVoltageNames(const std::vector &names); + void setCtbVoltageName(const defs::dacIndex index, const std::string &name); - std::vector getCtbSenseNames() const; - std::string getCtbSenseName(const defs::dacIndex i) const; - void setCtbSenseNames(const std::vector &names); - void setCtbSenseName(const defs::dacIndex index, const std::string &name); + std::vector getCtbSlowAdcNames() const; + std::string getCtbSlowAdcName(const defs::dacIndex i) const; + void setCtbSlowAdcNames(const std::vector &names); + void setCtbSlowAdcName(const defs::dacIndex index, const std::string &name); private: /** diff --git a/slsDetectorSoftware/tests/test-CmdProxy-chiptestboard.cpp b/slsDetectorSoftware/tests/test-CmdProxy-chiptestboard.cpp index 8e95e9130..918033e11 100644 --- a/slsDetectorSoftware/tests/test-CmdProxy-chiptestboard.cpp +++ b/slsDetectorSoftware/tests/test-CmdProxy-chiptestboard.cpp @@ -261,15 +261,15 @@ TEST_CASE("signalindex", "[.cmd]") { } } -TEST_CASE("powerlist", "[.cmd]") { +TEST_CASE("voltagelist", "[.cmd]") { Detector det; CmdProxy proxy(&det); auto det_type = det.getDetectorType().squash(); if (det_type == defs::CHIPTESTBOARD) { - auto prev = det.getPowerNames(); + auto prev = det.getVoltageNames(); - REQUIRE_THROWS(proxy.Call("powerlist", {"a", "s", "d"}, -1, PUT)); + REQUIRE_THROWS(proxy.Call("voltagelist", {"a", "s", "d"}, -1, PUT)); std::vector names; for (int iarg = 0; iarg != 5; ++iarg) { @@ -277,91 +277,91 @@ TEST_CASE("powerlist", "[.cmd]") { } { std::ostringstream oss; - REQUIRE_NOTHROW(proxy.Call("powerlist", names, -1, PUT, oss)); + REQUIRE_NOTHROW(proxy.Call("voltagelist", names, -1, PUT, oss)); } { std::ostringstream oss; - REQUIRE_NOTHROW(proxy.Call("powerlist", {}, -1, GET, oss)); + REQUIRE_NOTHROW(proxy.Call("voltagelist", {}, -1, GET, oss)); REQUIRE(oss.str() == - std::string("powerlist ") + ToString(names) + '\n'); + std::string("voltagelist ") + ToString(names) + '\n'); } - det.setPowerNames(prev); + det.setVoltageNames(prev); } else { - REQUIRE_THROWS(proxy.Call("powerlist", {"a", "b"}, -1, PUT)); - REQUIRE_THROWS(proxy.Call("powerlist", {}, -1, GET)); + REQUIRE_THROWS(proxy.Call("voltagelist", {"a", "b"}, -1, PUT)); + REQUIRE_THROWS(proxy.Call("voltagelist", {}, -1, GET)); } } -TEST_CASE("powername", "[.cmd]") { +TEST_CASE("voltagename", "[.cmd]") { Detector det; CmdProxy proxy(&det); auto det_type = det.getDetectorType().squash(); if (det_type == defs::CHIPTESTBOARD) { defs::dacIndex ind = static_cast(2 + defs::V_POWER_A); - std::string str_power_index = "2"; - auto prev = det.getPowerName(ind); + std::string str_voltage_index = "2"; + auto prev = det.getVoltageName(ind); // 1 arg throw - REQUIRE_THROWS(proxy.Call("powername", {"2", "3", "bname"}, -1, PUT)); + REQUIRE_THROWS(proxy.Call("voltagename", {"2", "3", "bname"}, -1, PUT)); // invalid index - REQUIRE_THROWS(proxy.Call("powername", {"5", "bname"}, -1, PUT)); + REQUIRE_THROWS(proxy.Call("voltagename", {"5", "bname"}, -1, PUT)); { std::ostringstream oss; - REQUIRE_NOTHROW(proxy.Call("powername", {str_power_index, "bname"}, + REQUIRE_NOTHROW(proxy.Call("voltagename", {str_voltage_index, "bname"}, -1, PUT, oss)); } { std::ostringstream oss; REQUIRE_NOTHROW( - proxy.Call("powername", {str_power_index}, -1, GET, oss)); + proxy.Call("voltagename", {str_voltage_index}, -1, GET, oss)); REQUIRE(oss.str() == - std::string("powername ") + str_power_index + " bname\n"); + std::string("voltagename ") + str_voltage_index + " bname\n"); } - det.setPowerName(ind, prev); + det.setVoltageName(ind, prev); } else { - REQUIRE_THROWS(proxy.Call("powername", {"2", "b"}, -1, PUT)); - REQUIRE_THROWS(proxy.Call("powername", {"2"}, -1, GET)); + REQUIRE_THROWS(proxy.Call("voltagename", {"2", "b"}, -1, PUT)); + REQUIRE_THROWS(proxy.Call("voltagename", {"2"}, -1, GET)); } } -TEST_CASE("powerindex", "[.cmd]") { +TEST_CASE("voltageindex", "[.cmd]") { Detector det; CmdProxy proxy(&det); auto det_type = det.getDetectorType().squash(); if (det_type == defs::CHIPTESTBOARD) { defs::dacIndex ind = static_cast(2 + defs::V_POWER_A); - std::string str_power_index = "2"; + std::string str_voltage_index = "2"; // 1 arg throw - REQUIRE_THROWS(proxy.Call("powerindex", {"2", "2"}, -1, PUT)); + REQUIRE_THROWS(proxy.Call("voltageindex", {"2", "2"}, -1, PUT)); // invalid index - REQUIRE_THROWS(proxy.Call("powerindex", {"5"}, -1, PUT)); - auto powername = det.getPowerName(ind); + REQUIRE_THROWS(proxy.Call("voltageindex", {"5"}, -1, PUT)); + auto voltagename = det.getVoltageName(ind); { std::ostringstream oss; REQUIRE_NOTHROW( - proxy.Call("powerindex", {powername}, -1, GET, oss)); + proxy.Call("voltageindex", {voltagename}, -1, GET, oss)); REQUIRE(oss.str() == - std::string("powerindex ") + str_power_index + '\n'); + std::string("voltageindex ") + str_voltage_index + '\n'); } } else { - REQUIRE_THROWS(proxy.Call("powerindex", {"2"}, -1, GET)); + REQUIRE_THROWS(proxy.Call("voltageindex", {"2"}, -1, GET)); } } -TEST_CASE("senselist", "[.cmd]") { +TEST_CASE("slowadclist", "[.cmd]") { Detector det; CmdProxy proxy(&det); auto det_type = det.getDetectorType().squash(); if (det_type == defs::CHIPTESTBOARD) { - auto prev = det.getSenseNames(); + auto prev = det.getSlowAdcNames(); - REQUIRE_THROWS(proxy.Call("senselist", {"a", "s", "d"}, -1, PUT)); + REQUIRE_THROWS(proxy.Call("slowadclist", {"a", "s", "d"}, -1, PUT)); std::vector names; for (int iarg = 0; iarg != 8; ++iarg) { @@ -369,79 +369,79 @@ TEST_CASE("senselist", "[.cmd]") { } { std::ostringstream oss; - REQUIRE_NOTHROW(proxy.Call("senselist", names, -1, PUT, oss)); + REQUIRE_NOTHROW(proxy.Call("slowadclist", names, -1, PUT, oss)); } { std::ostringstream oss; - REQUIRE_NOTHROW(proxy.Call("senselist", {}, -1, GET, oss)); + REQUIRE_NOTHROW(proxy.Call("slowadclist", {}, -1, GET, oss)); REQUIRE(oss.str() == - std::string("senselist ") + ToString(names) + '\n'); + std::string("slowadclist ") + ToString(names) + '\n'); } - det.setSenseNames(prev); + det.setSlowAdcNames(prev); } else { - REQUIRE_THROWS(proxy.Call("senselist", {"a", "b"}, -1, PUT)); - REQUIRE_THROWS(proxy.Call("senselist", {}, -1, GET)); + REQUIRE_THROWS(proxy.Call("slowadclist", {"a", "b"}, -1, PUT)); + REQUIRE_THROWS(proxy.Call("slowadclist", {}, -1, GET)); } } -TEST_CASE("sensename", "[.cmd]") { +TEST_CASE("slowadcname", "[.cmd]") { Detector det; CmdProxy proxy(&det); auto det_type = det.getDetectorType().squash(); if (det_type == defs::CHIPTESTBOARD) { defs::dacIndex ind = static_cast(2 + defs::SLOW_ADC0); - std::string str_sense_index = "2"; - auto prev = det.getSenseName(ind); + std::string str_slowadc_index = "2"; + auto prev = det.getSlowAdcName(ind); // 1 arg throw - REQUIRE_THROWS(proxy.Call("sensename", {"2", "3", "bname"}, -1, PUT)); + REQUIRE_THROWS(proxy.Call("slowadcname", {"2", "3", "bname"}, -1, PUT)); // invalid index - REQUIRE_THROWS(proxy.Call("sensename", {"8", "bname"}, -1, PUT)); + REQUIRE_THROWS(proxy.Call("slowadcname", {"8", "bname"}, -1, PUT)); { std::ostringstream oss; - REQUIRE_NOTHROW(proxy.Call("sensename", {str_sense_index, "bname"}, + REQUIRE_NOTHROW(proxy.Call("slowadcname", {str_slowadc_index, "bname"}, -1, PUT, oss)); } { std::ostringstream oss; REQUIRE_NOTHROW( - proxy.Call("sensename", {str_sense_index}, -1, GET, oss)); + proxy.Call("slowadcname", {str_slowadc_index}, -1, GET, oss)); REQUIRE(oss.str() == - std::string("sensename ") + str_sense_index + " bname\n"); + std::string("slowadcname ") + str_slowadc_index + " bname\n"); } - det.setSenseName(ind, prev); + det.setSlowAdcName(ind, prev); } else { - REQUIRE_THROWS(proxy.Call("sensename", {"2", "b"}, -1, PUT)); - REQUIRE_THROWS(proxy.Call("sensename", {"2"}, -1, GET)); + REQUIRE_THROWS(proxy.Call("slowadcname", {"2", "b"}, -1, PUT)); + REQUIRE_THROWS(proxy.Call("slowadcname", {"2"}, -1, GET)); } } -TEST_CASE("senseindex", "[.cmd]") { +TEST_CASE("slowadcindex", "[.cmd]") { Detector det; CmdProxy proxy(&det); auto det_type = det.getDetectorType().squash(); if (det_type == defs::CHIPTESTBOARD) { defs::dacIndex ind = static_cast(2 + defs::SLOW_ADC0); - std::string str_sense_index = "2"; + std::string str_slowadc_index = "2"; // 1 arg throw - REQUIRE_THROWS(proxy.Call("senseindex", {"2", "2"}, -1, PUT)); + REQUIRE_THROWS(proxy.Call("slowadcindex", {"2", "2"}, -1, PUT)); // invalid index - REQUIRE_THROWS(proxy.Call("senseindex", {"8"}, -1, PUT)); - auto sensename = det.getSenseName(ind); + REQUIRE_THROWS(proxy.Call("slowadcindex", {"8"}, -1, PUT)); + auto slowadcname = det.getSlowAdcName(ind); { std::ostringstream oss; REQUIRE_NOTHROW( - proxy.Call("senseindex", {sensename}, -1, GET, oss)); + proxy.Call("slowadcindex", {slowadcname}, -1, GET, oss)); REQUIRE(oss.str() == - std::string("senseindex ") + str_sense_index + '\n'); + std::string("slowadcindex ") + str_slowadc_index + '\n'); } } else { - REQUIRE_THROWS(proxy.Call("senseindex", {"2"}, -1, GET)); + REQUIRE_THROWS(proxy.Call("slowadcindex", {"2"}, -1, GET)); } } diff --git a/slsDetectorSoftware/tests/test-CtbConfig.cpp b/slsDetectorSoftware/tests/test-CtbConfig.cpp index a89bf1ac0..7fb6a76ff 100644 --- a/slsDetectorSoftware/tests/test-CtbConfig.cpp +++ b/slsDetectorSoftware/tests/test-CtbConfig.cpp @@ -26,7 +26,7 @@ TEST_CASE("Default construction") { REQUIRE(adcnames[1] == "ADC1"); REQUIRE(adcnames[2] == "ADC2"); REQUIRE(adcnames[3] == "ADC3"); - auto powernames = c.getPowerNames(); + auto powernames = c.getVoltageNames(); REQUIRE(powernames.size() == 5); REQUIRE(powernames[0] == "VA"); REQUIRE(powernames[1] == "VB"); @@ -39,12 +39,12 @@ TEST_CASE("Default construction") { REQUIRE(signalnames[1] == "BIT1"); REQUIRE(signalnames[2] == "BIT2"); REQUIRE(signalnames[3] == "BIT3"); - auto sensenames = c.getSenseNames(); + auto sensenames = c.getSlowAdcNames(); REQUIRE(sensenames.size() == 8); - REQUIRE(sensenames[0] == "SENSE0"); - REQUIRE(sensenames[1] == "SENSE1"); - REQUIRE(sensenames[2] == "SENSE2"); - REQUIRE(sensenames[3] == "SENSE3"); + REQUIRE(sensenames[0] == "SLOWADC0"); + REQUIRE(sensenames[1] == "SLOWADC1"); + REQUIRE(sensenames[2] == "SLOWADC2"); + REQUIRE(sensenames[3] == "SLOWADC3"); } TEST_CASE("Set and get a single dac name") {