1. Ctb powerindices (#767)

* power and sense returning dac indices instead of int in Detector class
This commit is contained in:
2023-06-19 15:19:50 +02:00
committed by GitHub
parent 3f9ec695db
commit d3d98db7e9
10 changed files with 205 additions and 174 deletions

View File

@ -1643,17 +1643,18 @@ void init_det(py::module &m) {
CppDetectorApi.def("getDacNames",
(std::vector<std::string>(Detector::*)() const) &
Detector::getDacNames);
CppDetectorApi.def("getDacIndex",
(defs::dacIndex(Detector::*)(const std::string &)) &
CppDetectorApi.def(
"getDacIndex",
(defs::dacIndex(Detector::*)(const std::string &) const) &
Detector::getDacIndex,
py::arg());
CppDetectorApi.def(
"setDacName",
(void (Detector::*)(defs::dacIndex, const std::string &)) &
(void (Detector::*)(const defs::dacIndex, const std::string &)) &
Detector::setDacName,
py::arg(), py::arg());
CppDetectorApi.def("getDacName",
(std::string(Detector::*)(defs::dacIndex)) &
(std::string(Detector::*)(const defs::dacIndex) const) &
Detector::getDacName,
py::arg());
CppDetectorApi.def("setAdcNames",
@ -1664,7 +1665,7 @@ void init_det(py::module &m) {
(std::vector<std::string>(Detector::*)() const) &
Detector::getAdcNames);
CppDetectorApi.def("getAdcIndex",
(int (Detector::*)(const std::string &)) &
(int (Detector::*)(const std::string &) const) &
Detector::getAdcIndex,
py::arg());
CppDetectorApi.def("setAdcName",
@ -1672,7 +1673,8 @@ void init_det(py::module &m) {
Detector::setAdcName,
py::arg(), py::arg());
CppDetectorApi.def("getAdcName",
(std::string(Detector::*)(int)) & Detector::getAdcName,
(std::string(Detector::*)(const int) const) &
Detector::getAdcName,
py::arg());
CppDetectorApi.def("setSignalNames",
(void (Detector::*)(const std::vector<std::string>)) &
@ -1682,16 +1684,17 @@ void init_det(py::module &m) {
(std::vector<std::string>(Detector::*)() const) &
Detector::getSignalNames);
CppDetectorApi.def("getSignalIndex",
(int (Detector::*)(const std::string &)) &
(int (Detector::*)(const std::string &) const) &
Detector::getSignalIndex,
py::arg());
CppDetectorApi.def("setSignalName",
(void (Detector::*)(const int, const std::string &)) &
Detector::setSignalName,
py::arg(), py::arg());
CppDetectorApi.def(
"getSignalName",
(std::string(Detector::*)(int)) & Detector::getSignalName, py::arg());
CppDetectorApi.def("getSignalName",
(std::string(Detector::*)(const int) const) &
Detector::getSignalName,
py::arg());
CppDetectorApi.def("setPowerNames",
(void (Detector::*)(const std::vector<std::string>)) &
Detector::setPowerNames,
@ -1699,16 +1702,19 @@ void init_det(py::module &m) {
CppDetectorApi.def("getPowerNames",
(std::vector<std::string>(Detector::*)() const) &
Detector::getPowerNames);
CppDetectorApi.def("getPowerIndex",
(int (Detector::*)(const std::string &)) &
CppDetectorApi.def(
"getPowerIndex",
(defs::dacIndex(Detector::*)(const std::string &) const) &
Detector::getPowerIndex,
py::arg());
CppDetectorApi.def("setPowerName",
(void (Detector::*)(const int, const std::string &)) &
CppDetectorApi.def(
"setPowerName",
(void (Detector::*)(const defs::dacIndex, const std::string &)) &
Detector::setPowerName,
py::arg(), py::arg());
CppDetectorApi.def("getPowerName",
(std::string(Detector::*)(int)) & Detector::getPowerName,
(std::string(Detector::*)(const defs::dacIndex) const) &
Detector::getPowerName,
py::arg());
CppDetectorApi.def("setSenseNames",
(void (Detector::*)(const std::vector<std::string>)) &
@ -1717,16 +1723,19 @@ void init_det(py::module &m) {
CppDetectorApi.def("getSenseNames",
(std::vector<std::string>(Detector::*)() const) &
Detector::getSenseNames);
CppDetectorApi.def("getSenseIndex",
(int (Detector::*)(const std::string &)) &
CppDetectorApi.def(
"getSenseIndex",
(defs::dacIndex(Detector::*)(const std::string &) const) &
Detector::getSenseIndex,
py::arg());
CppDetectorApi.def("setSenseName",
(void (Detector::*)(const int, const std::string &)) &
CppDetectorApi.def(
"setSenseName",
(void (Detector::*)(const defs::dacIndex, const std::string &)) &
Detector::setSenseName,
py::arg(), py::arg());
CppDetectorApi.def("getSenseName",
(std::string(Detector::*)(int)) & Detector::getSenseName,
(std::string(Detector::*)(const defs::dacIndex) const) &
Detector::getSenseName,
py::arg());
CppDetectorApi.def(
"setPattern",

View File

@ -1726,12 +1726,13 @@ class Detector {
std::vector<std::string> getDacNames() const;
defs::dacIndex getDacIndex(const std::string &name);
defs::dacIndex getDacIndex(const std::string &name) const;
/** [CTB] */
void setDacName(defs::dacIndex i, const std::string &name);
void setDacName(const defs::dacIndex i, const std::string &name);
std::string getDacName(defs::dacIndex i);
/** [CTB] */
std::string getDacName(const defs::dacIndex i) const;
/** [CTB] */
void setAdcNames(const std::vector<std::string> names);
@ -1740,13 +1741,13 @@ class Detector {
std::vector<std::string> getAdcNames() const;
/** [CTB] */
int getAdcIndex(const std::string &name);
int getAdcIndex(const std::string &name) const;
/** [CTB] */
void setAdcName(const int i, const std::string &name);
/** [CTB] */
std::string getAdcName(int i);
std::string getAdcName(const int i) const;
/** [CTB] */
void setSignalNames(const std::vector<std::string> names);
@ -1755,13 +1756,13 @@ class Detector {
std::vector<std::string> getSignalNames() const;
/** [CTB] */
int getSignalIndex(const std::string &name);
int getSignalIndex(const std::string &name) const;
/** [CTB] */
void setSignalName(const int i, const std::string &name);
/** [CTB] */
std::string getSignalName(int i);
std::string getSignalName(const int i) const;
/** [CTB] */
void setPowerNames(const std::vector<std::string> names);
@ -1770,13 +1771,13 @@ class Detector {
std::vector<std::string> getPowerNames() const;
/** [CTB] */
int getPowerIndex(const std::string &name);
defs::dacIndex getPowerIndex(const std::string &name) const;
/** [CTB] */
void setPowerName(const int i, const std::string &name);
void setPowerName(const defs::dacIndex i, const std::string &name);
/** [CTB] */
std::string getPowerName(int i);
std::string getPowerName(const defs::dacIndex i) const;
/** [CTB] */
void setSenseNames(const std::vector<std::string> names);
@ -1785,13 +1786,13 @@ class Detector {
std::vector<std::string> getSenseNames() const;
/** [CTB] */
int getSenseIndex(const std::string &name);
defs::dacIndex getSenseIndex(const std::string &name) const;
/** [CTB] */
void setSenseName(const int i, const std::string &name);
void setSenseName(const defs::dacIndex i, const std::string &name);
/** [CTB] */
std::string getSenseName(int i);
std::string getSenseName(const defs::dacIndex i) const;
///@}

View File

@ -1158,66 +1158,6 @@ std::string CmdProxy::DacList(const int action) {
return os.str();
}
std::string CmdProxy::DacName(const int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == slsDetectorDefs::HELP_ACTION) {
os << "\n\t[0-18][name] \n\t\t[ChipTestBoard] Set "
"the dac at the given position to the given name."
<< '\n';
return os.str();
}
if (det->getDetectorType().squash() != defs::CHIPTESTBOARD) {
throw RuntimeError("Named Dacs only allowed for CTB.");
}
defs::dacIndex index = static_cast<defs::dacIndex>(StringTo<int>(args[0]));
if (action == slsDetectorDefs::GET_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
auto t = det->getDacName(index);
os << args[0] << ' ' << ToString(t) << '\n';
} else if (action == slsDetectorDefs::PUT_ACTION) {
if (det_id != -1) {
throw RuntimeError("Cannot configure dacnames at module level");
}
if (args.size() != 2) {
WrongNumberOfParameters(2);
}
det->setDacName(index, args[1]);
os << ToString(args) << '\n';
} else {
throw RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::DacIndex(const int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == slsDetectorDefs::HELP_ACTION) {
os << "\n\t[name] \n\t\t[ChipTestBoard] Get "
"the dac index for the given name."
<< '\n';
return os.str();
}
if (det->getDetectorType().squash() != defs::CHIPTESTBOARD) {
throw RuntimeError("Named Dacs only allowed for CTB.");
}
if (action == slsDetectorDefs::GET_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
auto t = det->getDacIndex(args[0]);
os << ToString(static_cast<int>(t)) << '\n';
} else if (action == slsDetectorDefs::PUT_ACTION) {
throw RuntimeError("Cannot set dac index");
} else {
throw RuntimeError("Unknown action");
}
return os.str();
}
/* dacs */
std::string CmdProxy::Dac(int action) {
std::ostringstream os;

View File

@ -554,6 +554,73 @@ namespace sls {
return os.str(); \
}
#define CTB_SINGLE_DACNAME(CMDNAME, GETFCN, SETFCN, STARTINDEX, HLPSTR) \
std::string CMDNAME(const int action) { \
std::ostringstream os; \
os << cmd << ' '; \
if (action == slsDetectorDefs::HELP_ACTION) { \
os << HLPSTR << '\n'; \
return os.str(); \
} \
if (det->getDetectorType().squash() != defs::CHIPTESTBOARD) { \
throw RuntimeError(cmd + " only allowed for CTB."); \
} \
if (det_id != -1) { \
throw RuntimeError("Cannot configure " + cmd + \
" at module level"); \
} \
defs::dacIndex index = defs::DAC_0; \
if (args.size() > 0) { \
index = static_cast<defs::dacIndex>(StringTo<int>(args[0]) + \
STARTINDEX); \
} \
if (action == slsDetectorDefs::GET_ACTION) { \
if (args.size() != 1) { \
WrongNumberOfParameters(1); \
} \
auto t = det->GETFCN(index); \
os << args[0] << ' ' << t << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 2) { \
WrongNumberOfParameters(2); \
} \
det->SETFCN(index, args[1]); \
os << ToString(args) << '\n'; \
} else { \
throw RuntimeError("Unknown action"); \
} \
return os.str(); \
}
#define CTB_GET_DACINDEX(CMDNAME, GETFCN, STARTINDEX, HLPSTR) \
std::string CMDNAME(const int action) { \
std::ostringstream os; \
os << cmd << ' '; \
if (action == slsDetectorDefs::HELP_ACTION) { \
os << HLPSTR << '\n'; \
return os.str(); \
} \
if (det->getDetectorType().squash() != defs::CHIPTESTBOARD) { \
throw RuntimeError(cmd + " only allowed for CTB."); \
} \
if (det_id != -1) { \
throw RuntimeError("Cannot configure " + cmd + \
" at module level"); \
} \
if (action == slsDetectorDefs::GET_ACTION) { \
if (args.size() != 1) { \
WrongNumberOfParameters(1); \
} \
auto t = det->GETFCN(args[0]); \
os << ToString(static_cast<int>(t) - STARTINDEX) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
throw RuntimeError("Cannot put"); \
} else { \
throw RuntimeError("Unknown action"); \
} \
return os.str(); \
}
#define CTB_SINGLE_NAME(CMDNAME, GETFCN, SETFCN, HLPSTR) \
std::string CMDNAME(const int action) { \
std::ostringstream os; \
@ -574,7 +641,7 @@ namespace sls {
WrongNumberOfParameters(1); \
} \
auto t = det->GETFCN(StringTo<int>(args[0])); \
os << args[0] << ' ' << ToString(t) << '\n'; \
os << args[0] << ' ' << t << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 2) { \
WrongNumberOfParameters(2); \
@ -607,7 +674,7 @@ namespace sls {
WrongNumberOfParameters(1); \
} \
auto t = det->GETFCN(args[0]); \
os << ToString(t) << '\n'; \
os << ToString(static_cast<int>(t)) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
throw RuntimeError("Cannot put"); \
} else { \
@ -936,8 +1003,8 @@ class CmdProxy {
/* lists */
{"daclist", &CmdProxy::DacList},
{"dacname", &CmdProxy::DacName},
{"dacindex", &CmdProxy::DacIndex},
{"dacname", &CmdProxy::dacname},
{"dacindex", &CmdProxy::dacindex},
{"adclist", &CmdProxy::adclist},
{"adcname", &CmdProxy::adcname},
{"adcindex", &CmdProxy::adcindex},
@ -1252,8 +1319,6 @@ class CmdProxy {
std::string TemperatureValues(int action);
/* list */
std::string DacList(int action);
std::string DacName(int action);
std::string DacIndex(int action);
/* dacs */
std::string Dac(int action);
std::string DacValues(int action);
@ -1617,6 +1682,15 @@ class CmdProxy {
"[n_value]\n\t[Ctb]Temperature of the slow adc");
/* lists */
CTB_SINGLE_DACNAME(dacname, getDacName, setDacName, defs::DAC_0,
"\n\t[0-18][name] \n\t\t[ChipTestBoard] Set "
"the dac at the given position to the given name.");
CTB_GET_DACINDEX(dacindex, getDacIndex, defs::DAC_0,
"\n\t[name] \n\t\t[ChipTestBoard] Get "
"the dac index for the given name.");
CTB_NAMED_LIST(adclist, getAdcNames, setAdcNames,
"[adcname1 adcname2 .. adcname32] \n\t\t[ChipTestBoard] Set "
"the list of adc names for this board.");
@ -1647,11 +1721,11 @@ class CmdProxy {
"[powername1 powername2 .. powername4] \n\t\t[ChipTestBoard] Set "
"the list of power names for this board.");
CTB_SINGLE_NAME(powername, getPowerName, setPowerName,
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_GET_INDEX(powerindex, getPowerIndex,
CTB_GET_DACINDEX(powerindex, getPowerIndex, defs::V_POWER_A,
"[name] \n\t\t[ChipTestBoard] Get "
"the power index for the given name.");
@ -1660,11 +1734,11 @@ class CmdProxy {
"[sensename1 sensename2 .. sensename7] \n\t\t[ChipTestBoard] Set "
"the list of sense names for this board.");
CTB_SINGLE_NAME(sensename, getSenseName, setSenseName,
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_GET_INDEX(senseindex, getSenseIndex,
CTB_GET_DACINDEX(senseindex, getSenseIndex, defs::SLOW_ADC0,
"[name] \n\t\t[ChipTestBoard] Get "
"the sense index for the given name.");

View File

@ -31,41 +31,43 @@ CtbConfig::CtbConfig() {
}
void CtbConfig::check_dac_index(size_t i) const {
if (!(i < num_dacs)) {
if (i >= num_dacs) {
std::ostringstream oss;
oss << "DAC index is too large. Needs to be below " << num_dacs;
oss << "Invalid DAC index. Options: 0 - " << num_dacs;
throw RuntimeError(oss.str());
}
}
void CtbConfig::check_adc_index(size_t i) const {
if (!(i < num_adcs)) {
if (i >= num_adcs) {
std::ostringstream oss;
oss << "ADC index is too large.Needs to be below " << num_adcs;
oss << "Invalid ADC index. Options: 0 - " << num_adcs;
throw RuntimeError(oss.str());
}
}
void CtbConfig::check_signal_index(size_t i) const {
if (!(i < num_signals)) {
if (i >= num_signals) {
std::ostringstream oss;
oss << "Signal index is too large.Needs to be below " << num_signals;
oss << "Invalid Signal index. Options: 0 - " << num_signals;
throw RuntimeError(oss.str());
}
}
void CtbConfig::check_power_index(size_t i) const {
if (!(i < num_powers)) {
if (i >= num_powers) {
std::ostringstream oss;
oss << "Power index is too large.Needs to be below " << num_powers;
oss << "Invalid Power index. Options: 0 - " << num_signals
<< " or V_POWER_A - V_POWER_IO";
throw RuntimeError(oss.str());
}
}
void CtbConfig::check_sense_index(size_t i) const {
if (!(i < num_senses)) {
if (i >= num_senses) {
std::ostringstream oss;
oss << "Sense index is too large.Needs to be below " << num_senses;
oss << "Invalid Sense index. Options: 0 - " << num_senses
<< " or SLOW_ADC0 - SLOW_ADC7";
throw RuntimeError(oss.str());
}
}

View File

@ -2219,7 +2219,7 @@ std::vector<std::string> Detector::getDacNames() const {
return names;
}
defs::dacIndex Detector::getDacIndex(const std::string &name) {
defs::dacIndex Detector::getDacIndex(const std::string &name) const {
auto type = getDetectorType().squash();
if (type == defs::CHIPTESTBOARD) {
auto names = getDacNames();
@ -2231,13 +2231,13 @@ defs::dacIndex Detector::getDacIndex(const std::string &name) {
return StringTo<defs::dacIndex>(name);
}
void Detector::setDacName(defs::dacIndex i, const std::string &name) {
void Detector::setDacName(const defs::dacIndex i, const std::string &name) {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named dacs only for CTB");
pimpl->setCtbDacName(i, name);
}
std::string Detector::getDacName(defs::dacIndex i) {
std::string Detector::getDacName(const defs::dacIndex i) const {
auto type = getDetectorType().squash();
if (type == defs::CHIPTESTBOARD)
return pimpl->getCtbDacName(i);
@ -2256,7 +2256,7 @@ std::vector<std::string> Detector::getAdcNames() const {
return pimpl->getCtbAdcNames();
}
int Detector::getAdcIndex(const std::string &name) {
int Detector::getAdcIndex(const std::string &name) const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named adcs only for CTB");
auto names = getAdcNames();
@ -2272,7 +2272,7 @@ void Detector::setAdcName(const int index, const std::string &name) {
pimpl->setCtbAdcName(index, name);
}
std::string Detector::getAdcName(int i) {
std::string Detector::getAdcName(const int i) const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named adcs only for CTB");
return pimpl->getCtbAdcName(i);
@ -2290,7 +2290,7 @@ std::vector<std::string> Detector::getSignalNames() const {
return pimpl->getCtbSignalNames();
}
int Detector::getSignalIndex(const std::string &name) {
int Detector::getSignalIndex(const std::string &name) const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named signals only for CTB");
auto names = getSignalNames();
@ -2306,7 +2306,7 @@ void Detector::setSignalName(const int index, const std::string &name) {
pimpl->setCtbSignalName(index, name);
}
std::string Detector::getSignalName(int i) {
std::string Detector::getSignalName(const int i) const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named signals only for CTB");
return pimpl->getCtbSignalName(i);
@ -2324,23 +2324,24 @@ std::vector<std::string> Detector::getPowerNames() const {
return pimpl->getCtbPowerNames();
}
int Detector::getPowerIndex(const std::string &name) {
defs::dacIndex Detector::getPowerIndex(const std::string &name) const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named powers only for CTB");
auto names = getPowerNames();
auto it = std::find(names.begin(), names.end(), name);
if (it == names.end())
throw RuntimeError("Power name not found");
return (it - names.begin());
return static_cast<defs::dacIndex>(it - names.begin() + defs::V_POWER_A);
}
void Detector::setPowerName(const int index, const std::string &name) {
void Detector::setPowerName(const defs::dacIndex index,
const std::string &name) {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named powers only for CTB");
pimpl->setCtbPowerName(index, name);
}
std::string Detector::getPowerName(int i) {
std::string Detector::getPowerName(const defs::dacIndex i) const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named powers only for CTB");
return pimpl->getCtbPowerName(i);
@ -2358,23 +2359,24 @@ std::vector<std::string> Detector::getSenseNames() const {
return pimpl->getCtbSenseNames();
}
int Detector::getSenseIndex(const std::string &name) {
defs::dacIndex Detector::getSenseIndex(const std::string &name) const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named senses only for CTB");
auto names = getSenseNames();
auto it = std::find(names.begin(), names.end(), name);
if (it == names.end())
throw RuntimeError("Sense name not found");
return (it - names.begin());
return static_cast<defs::dacIndex>(it - names.begin() + defs::SLOW_ADC0);
}
void Detector::setSenseName(const int index, const std::string &name) {
void Detector::setSenseName(const defs::dacIndex index,
const std::string &name) {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named senses only for CTB");
pimpl->setCtbSenseName(index, name);
}
std::string Detector::getSenseName(int i) {
std::string Detector::getSenseName(const defs::dacIndex i) const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named senses only for CTB");
return pimpl->getCtbSenseName(i);

View File

@ -2001,7 +2001,8 @@ std::string DetectorImpl::getCtbDacName(defs::dacIndex i) const {
return ctb_shm()->getDacName(static_cast<int>(i));
}
void DetectorImpl::setCtbDacName(const int index, const std::string &name) {
void DetectorImpl::setCtbDacName(const defs::dacIndex index,
const std::string &name) {
ctb_shm()->setDacName(index, name);
}
@ -2013,7 +2014,7 @@ void DetectorImpl::setCtbAdcNames(const std::vector<std::string> &names) {
ctb_shm()->setAdcNames(names);
}
std::string DetectorImpl::getCtbAdcName(int i) const {
std::string DetectorImpl::getCtbAdcName(const int i) const {
return ctb_shm()->getAdcName(i);
}
@ -2029,7 +2030,7 @@ void DetectorImpl::setCtbSignalNames(const std::vector<std::string> &names) {
ctb_shm()->setSignalNames(names);
}
std::string DetectorImpl::getCtbSignalName(int i) const {
std::string DetectorImpl::getCtbSignalName(const int i) const {
return ctb_shm()->getSignalName(i);
}
@ -2045,12 +2046,13 @@ void DetectorImpl::setCtbPowerNames(const std::vector<std::string> &names) {
ctb_shm()->setPowerNames(names);
}
std::string DetectorImpl::getCtbPowerName(int i) const {
return ctb_shm()->getPowerName(i);
std::string DetectorImpl::getCtbPowerName(const defs::dacIndex i) const {
return ctb_shm()->getPowerName(static_cast<int>(i - defs::V_POWER_A));
}
void DetectorImpl::setCtbPowerName(const int index, const std::string &name) {
ctb_shm()->setPowerName(index, name);
void DetectorImpl::setCtbPowerName(const defs::dacIndex index,
const std::string &name) {
ctb_shm()->setPowerName(static_cast<int>(index - defs::V_POWER_A), name);
}
std::vector<std::string> DetectorImpl::getCtbSenseNames() const {
@ -2061,12 +2063,13 @@ void DetectorImpl::setCtbSenseNames(const std::vector<std::string> &names) {
ctb_shm()->setSenseNames(names);
}
std::string DetectorImpl::getCtbSenseName(int i) const {
return ctb_shm()->getSenseName(i);
std::string DetectorImpl::getCtbSenseName(const defs::dacIndex i) const {
return ctb_shm()->getSenseName(static_cast<int>(i - defs::SLOW_ADC0));
}
void DetectorImpl::setCtbSenseName(const int index, const std::string &name) {
ctb_shm()->setSenseName(index, name);
void DetectorImpl::setCtbSenseName(const defs::dacIndex index,
const std::string &name) {
ctb_shm()->setSenseName(static_cast<int>(index - defs::SLOW_ADC0), name);
}
} // namespace sls

View File

@ -326,29 +326,29 @@ class DetectorImpl : public virtual slsDetectorDefs {
void setBadChannels(const std::vector<int> list, Positions pos);
std::vector<std::string> getCtbDacNames() const;
std::string getCtbDacName(defs::dacIndex i) const;
std::string getCtbDacName(const defs::dacIndex i) const;
void setCtbDacNames(const std::vector<std::string> &names);
void setCtbDacName(const int index, const std::string &name);
void setCtbDacName(const defs::dacIndex index, const std::string &name);
std::vector<std::string> getCtbAdcNames() const;
std::string getCtbAdcName(int i) const;
std::string getCtbAdcName(const int i) const;
void setCtbAdcNames(const std::vector<std::string> &names);
void setCtbAdcName(const int index, const std::string &name);
std::vector<std::string> getCtbSignalNames() const;
std::string getCtbSignalName(int i) const;
std::string getCtbSignalName(const int i) const;
void setCtbSignalNames(const std::vector<std::string> &names);
void setCtbSignalName(const int index, const std::string &name);
std::vector<std::string> getCtbPowerNames() const;
std::string getCtbPowerName(int i) const;
std::string getCtbPowerName(const defs::dacIndex i) const;
void setCtbPowerNames(const std::vector<std::string> &names);
void setCtbPowerName(const int index, const std::string &name);
void setCtbPowerName(const defs::dacIndex index, const std::string &name);
std::vector<std::string> getCtbSenseNames() const;
std::string getCtbSenseName(int i) const;
std::string getCtbSenseName(const defs::dacIndex i) const;
void setCtbSenseNames(const std::vector<std::string> &names);
void setCtbSenseName(const int index, const std::string &name);
void setCtbSenseName(const defs::dacIndex index, const std::string &name);
private:
/**

View File

@ -299,7 +299,7 @@ TEST_CASE("powername", "[.cmd]") {
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
int ind = 2;
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::V_POWER_A);
std::string str_power_index = "2";
auto prev = det.getPowerName(ind);
@ -333,7 +333,7 @@ TEST_CASE("powerindex", "[.cmd]") {
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
int ind = 2;
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::V_POWER_A);
std::string str_power_index = "2";
// 1 arg throw
@ -391,7 +391,7 @@ TEST_CASE("sensename", "[.cmd]") {
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
int ind = 2;
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::SLOW_ADC0);
std::string str_sense_index = "2";
auto prev = det.getSenseName(ind);
@ -425,7 +425,7 @@ TEST_CASE("senseindex", "[.cmd]") {
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
int ind = 2;
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::SLOW_ADC0);
std::string str_sense_index = "2";
// 1 arg throw