Ctb sense power signal names (#759)

*  adc names

* added python functions in src

*  signal, power, sense names

* fix tests
This commit is contained in:
maliakal_d 2023-06-07 17:06:41 +02:00 committed by GitHub
parent b9a346a396
commit a7dcfe4b31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 1039 additions and 253 deletions

View File

@ -1766,7 +1766,7 @@ class Detector(CppDetectorApi):
@property
def daclist(self):
"""
List of enums/names for every dac for this detector.
List of enums/names for every dac for this detector
:setter: Only implemented for Chiptestboard
"""
@ -1779,7 +1779,7 @@ class Detector(CppDetectorApi):
@property
def adclist(self):
"""
List of names for every adc for this detector.
List of names for every adc for this board. 32 adcs
:setter: Only implemented for Chiptestboard
"""
@ -1789,6 +1789,44 @@ class Detector(CppDetectorApi):
def adclist(self, value):
self.setAdcNames(value)
@property
def signallist(self):
"""
List of names for every io signal for this board. 64 signals
:setter: Only implemented for Chiptestboard
"""
return self.getSignalNames()
@signallist.setter
def signallist(self, value):
self.setSignalNames(value)
@property
def powerlist(self):
"""
List of names for every power supply for this board. 5 power supply
:setter: Only implemented for Chiptestboard
"""
return self.getPowerNames()
@powerlist.setter
def powerlist(self, value):
self.setPowerNames(value)
@property
def senselist(self):
"""
List of names for every sense for this board. 8 sense
:setter: Only implemented for Chiptestboard
"""
return self.getSenseNames()
@senselist.setter
def senselist(self, value):
self.setSenseNames(value)
@property
def dacvalues(self):

View File

@ -1674,6 +1674,60 @@ void init_det(py::module &m) {
CppDetectorApi.def("getAdcName",
(std::string(Detector::*)(int)) & Detector::getAdcName,
py::arg());
CppDetectorApi.def("setSignalNames",
(void (Detector::*)(const std::vector<std::string>)) &
Detector::setSignalNames,
py::arg());
CppDetectorApi.def("getSignalNames",
(std::vector<std::string>(Detector::*)() const) &
Detector::getSignalNames);
CppDetectorApi.def("getSignalIndex",
(int (Detector::*)(const std::string &)) &
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("setPowerNames",
(void (Detector::*)(const std::vector<std::string>)) &
Detector::setPowerNames,
py::arg());
CppDetectorApi.def("getPowerNames",
(std::vector<std::string>(Detector::*)() const) &
Detector::getPowerNames);
CppDetectorApi.def("getPowerIndex",
(int (Detector::*)(const std::string &)) &
Detector::getPowerIndex,
py::arg());
CppDetectorApi.def("setPowerName",
(void (Detector::*)(const int, const std::string &)) &
Detector::setPowerName,
py::arg(), py::arg());
CppDetectorApi.def("getPowerName",
(std::string(Detector::*)(int)) & Detector::getPowerName,
py::arg());
CppDetectorApi.def("setSenseNames",
(void (Detector::*)(const std::vector<std::string>)) &
Detector::setSenseNames,
py::arg());
CppDetectorApi.def("getSenseNames",
(std::vector<std::string>(Detector::*)() const) &
Detector::getSenseNames);
CppDetectorApi.def("getSenseIndex",
(int (Detector::*)(const std::string &)) &
Detector::getSenseIndex,
py::arg());
CppDetectorApi.def("setSenseName",
(void (Detector::*)(const int, const std::string &)) &
Detector::setSenseName,
py::arg(), py::arg());
CppDetectorApi.def("getSenseName",
(std::string(Detector::*)(int)) & Detector::getSenseName,
py::arg());
CppDetectorApi.def(
"setPattern",
(void (Detector::*)(const std::string &, sls::Positions)) &

View File

@ -1748,6 +1748,51 @@ class Detector {
/** [CTB] */
std::string getAdcName(int i);
/** [CTB] */
void setSignalNames(const std::vector<std::string> names);
/** [CTB] */
std::vector<std::string> getSignalNames() const;
/** [CTB] */
int getSignalIndex(const std::string &name);
/** [CTB] */
void setSignalName(const int i, const std::string &name);
/** [CTB] */
std::string getSignalName(int i);
/** [CTB] */
void setPowerNames(const std::vector<std::string> names);
/** [CTB] */
std::vector<std::string> getPowerNames() const;
/** [CTB] */
int getPowerIndex(const std::string &name);
/** [CTB] */
void setPowerName(const int i, const std::string &name);
/** [CTB] */
std::string getPowerName(int i);
/** [CTB] */
void setSenseNames(const std::vector<std::string> names);
/** [CTB] */
std::vector<std::string> getSenseNames() const;
/** [CTB] */
int getSenseIndex(const std::string &name);
/** [CTB] */
void setSenseName(const int i, const std::string &name);
/** [CTB] */
std::string getSenseName(int i);
///@}
/** @name Pattern */

View File

@ -1218,96 +1218,6 @@ std::string CmdProxy::DacIndex(const int action) {
return os.str();
}
std::string CmdProxy::AdcList(const int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == slsDetectorDefs::HELP_ACTION) {
os << "\n\t[adcname1 adcname2 .. adcname32] \n\t\t[ChipTestBoard] Set "
"the list of adc names for this board."
<< '\n';
return os.str();
}
if (det->getDetectorType().squash() != defs::CHIPTESTBOARD) {
throw RuntimeError("Named Adcs only allowed for CTB.");
}
if (action == slsDetectorDefs::GET_ACTION) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getAdcNames();
os << ToString(t) << '\n';
} else if (action == slsDetectorDefs::PUT_ACTION) {
if (det_id != -1) {
throw RuntimeError("Cannot configure adcnames at module level");
}
det->setAdcNames(args);
os << ToString(args) << '\n';
} else {
throw RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::AdcName(const int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == slsDetectorDefs::HELP_ACTION) {
os << "\n\t[0-31][name] \n\t\t[ChipTestBoard] Set "
"the adc at the given position to the given name."
<< '\n';
return os.str();
}
if (det->getDetectorType().squash() != defs::CHIPTESTBOARD) {
throw RuntimeError("Named Adcs only allowed for CTB.");
}
int index = StringTo<int>(args[0]);
if (action == slsDetectorDefs::GET_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
auto t = det->getAdcName(index);
os << args[0] << ' ' << ToString(t) << '\n';
} else if (action == slsDetectorDefs::PUT_ACTION) {
if (det_id != -1) {
throw RuntimeError("Cannot configure adcnames at module level");
}
if (args.size() != 2) {
WrongNumberOfParameters(2);
}
det->setAdcName(index, args[1]);
os << ToString(args) << '\n';
} else {
throw RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::AdcIndex(const int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == slsDetectorDefs::HELP_ACTION) {
os << "\n\t[name] \n\t\t[ChipTestBoard] Get "
"the adc index for the given name."
<< '\n';
return os.str();
}
if (det->getDetectorType().squash() != defs::CHIPTESTBOARD) {
throw RuntimeError("Named Adcs only allowed for CTB.");
}
if (action == slsDetectorDefs::GET_ACTION) {
if (args.size() != 1) {
WrongNumberOfParameters(1);
}
auto t = det->getAdcIndex(args[0]);
os << ToString(t) << '\n';
} else if (action == slsDetectorDefs::PUT_ACTION) {
throw RuntimeError("Cannot set adc index");
} else {
throw RuntimeError("Unknown action");
}
return os.str();
}
/* dacs */
std::string CmdProxy::Dac(int action) {
std::ostringstream os;

View File

@ -524,6 +524,98 @@ namespace sls {
return os.str(); \
}
#define CTB_NAMED_LIST(CMDNAME, GETFCN, SETFCN, 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.empty()) { \
WrongNumberOfParameters(0); \
} \
auto t = det->GETFCN(); \
os << ToString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
det->SETFCN(args); \
os << ToString(args) << '\n'; \
} 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; \
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(StringTo<int>(args[0])); \
os << args[0] << ' ' << ToString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
if (args.size() != 2) { \
WrongNumberOfParameters(2); \
} \
det->SETFCN(StringTo<int>(args[0]), args[1]); \
os << ToString(args) << '\n'; \
} else { \
throw RuntimeError("Unknown action"); \
} \
return os.str(); \
}
#define CTB_GET_INDEX(CMDNAME, GETFCN, 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(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
throw RuntimeError("Cannot put"); \
} else { \
throw RuntimeError("Unknown action"); \
} \
return os.str(); \
}
class CmdProxy {
public:
explicit CmdProxy(Detector *ptr) : det(ptr) {}
@ -846,9 +938,18 @@ class CmdProxy {
{"daclist", &CmdProxy::DacList},
{"dacname", &CmdProxy::DacName},
{"dacindex", &CmdProxy::DacIndex},
{"adclist", &CmdProxy::AdcList},
{"adcname", &CmdProxy::AdcName},
{"adcindex", &CmdProxy::AdcIndex},
{"adclist", &CmdProxy::adclist},
{"adcname", &CmdProxy::adcname},
{"adcindex", &CmdProxy::adcindex},
{"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},
/* dacs */
{"dac", &CmdProxy::Dac},
@ -1153,9 +1254,6 @@ class CmdProxy {
std::string DacList(int action);
std::string DacName(int action);
std::string DacIndex(int action);
std::string AdcList(int action);
std::string AdcName(int action);
std::string AdcIndex(int action);
/* dacs */
std::string Dac(int action);
std::string DacValues(int action);
@ -1518,6 +1616,58 @@ class CmdProxy {
slsDetectorDefs::SLOW_ADC_TEMP, " °C",
"[n_value]\n\t[Ctb]Temperature of the slow adc");
/* lists */
CTB_NAMED_LIST(adclist, getAdcNames, setAdcNames,
"[adcname1 adcname2 .. adcname32] \n\t\t[ChipTestBoard] Set "
"the list of adc names for this board.");
CTB_SINGLE_NAME(adcname, getAdcName, setAdcName,
"[0-31][name] \n\t\t[ChipTestBoard] Set "
"the adc at the given position to the given name.");
CTB_GET_INDEX(adcindex, getAdcIndex,
"[name] \n\t\t[ChipTestBoard] Get "
"the adc index for the given name.");
CTB_NAMED_LIST(
signallist, getSignalNames, setSignalNames,
"[signalname1 signalname2 .. signalname63] \n\t\t[ChipTestBoard] Set "
"the list of signal names for this board.");
CTB_SINGLE_NAME(signalname, getSignalName, setSignalName,
"[0-31][name] \n\t\t[ChipTestBoard] Set "
"the signal at the given position to the given name.");
CTB_GET_INDEX(signalindex, getSignalIndex,
"[name] \n\t\t[ChipTestBoard] Get "
"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.");
CTB_SINGLE_NAME(powername, getPowerName, setPowerName,
"[0-31][name] \n\t\t[ChipTestBoard] Set "
"the power at the given position to the given name.");
CTB_GET_INDEX(powerindex, getPowerIndex,
"[name] \n\t\t[ChipTestBoard] Get "
"the power 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.");
CTB_SINGLE_NAME(sensename, getSenseName, setSenseName,
"[0-31][name] \n\t\t[ChipTestBoard] Set "
"the sense at the given position to the given name.");
CTB_GET_INDEX(senseindex, getSenseIndex,
"[name] \n\t\t[ChipTestBoard] Get "
"the sense index for the given name.");
/* dacs */
/* on chip dacs */

View File

@ -17,6 +17,15 @@ CtbConfig::CtbConfig() {
for (size_t i = 0; i != num_adcs; ++i) {
setAdcName(i, "adc" + ToString(i));
}
for (size_t i = 0; i != num_signals; ++i) {
setSignalName(i, "signal" + ToString(i));
}
for (size_t i = 0; i != num_powers; ++i) {
setPowerName(i, "power" + ToString(i));
}
for (size_t i = 0; i != num_senses; ++i) {
setSenseName(i, "sense" + ToString(i));
}
}
void CtbConfig::check_dac_index(size_t i) const {
@ -35,12 +44,36 @@ void CtbConfig::check_adc_index(size_t i) const {
}
}
void CtbConfig::check_signal_index(size_t i) const {
if (!(i < num_signals)) {
std::ostringstream oss;
oss << "Signal index is too large.Needs to be below " << num_signals;
throw RuntimeError(oss.str());
}
}
void CtbConfig::check_power_index(size_t i) const {
if (!(i < num_powers)) {
std::ostringstream oss;
oss << "Power index is too large.Needs to be below " << num_powers;
throw RuntimeError(oss.str());
}
}
void CtbConfig::check_sense_index(size_t i) const {
if (!(i < num_senses)) {
std::ostringstream oss;
oss << "Sense index is too large.Needs to be below " << num_senses;
throw RuntimeError(oss.str());
}
}
void CtbConfig::check_size(const std::string &name) const {
if (name.empty())
throw RuntimeError("Name needs to be at least one character");
// dac/adc name_length -1 to account for \0 termination
// name_length -1 to account for \0 termination
if (!(name.size() < (name_length - 1))) {
std::ostringstream oss;
oss << "Length of name needs to be less than " << name_length - 1
@ -109,6 +142,96 @@ std::vector<std::string> CtbConfig::getAdcNames() const {
return names;
}
void CtbConfig::setSignalName(size_t index, const std::string &name) {
check_signal_index(index);
check_size(name);
char *dst = &signalnames[index * name_length];
memset(dst, '\0', name_length);
memcpy(dst, &name[0], name.size());
}
void CtbConfig::setSignalNames(const std::vector<std::string> &names) {
if (names.size() != num_signals) {
throw RuntimeError("Signal names need to be of size " +
std::to_string(num_signals));
}
for (size_t i = 0; i != num_signals; ++i) {
setSignalName(i, names[i]);
}
}
std::string CtbConfig::getSignalName(size_t index) const {
check_signal_index(index);
return signalnames + index * name_length;
}
std::vector<std::string> CtbConfig::getSignalNames() const {
std::vector<std::string> names;
for (size_t i = 0; i != num_signals; ++i)
names.push_back(getSignalName(i));
return names;
}
void CtbConfig::setPowerName(size_t index, const std::string &name) {
check_power_index(index);
check_size(name);
char *dst = &powernames[index * name_length];
memset(dst, '\0', name_length);
memcpy(dst, &name[0], name.size());
}
void CtbConfig::setPowerNames(const std::vector<std::string> &names) {
if (names.size() != num_powers) {
throw RuntimeError("Power names need to be of size " +
std::to_string(num_powers));
}
for (size_t i = 0; i != num_powers; ++i) {
setPowerName(i, names[i]);
}
}
std::string CtbConfig::getPowerName(size_t index) const {
check_power_index(index);
return powernames + index * name_length;
}
std::vector<std::string> CtbConfig::getPowerNames() const {
std::vector<std::string> names;
for (size_t i = 0; i != num_powers; ++i)
names.push_back(getPowerName(i));
return names;
}
void CtbConfig::setSenseName(size_t index, const std::string &name) {
check_sense_index(index);
check_size(name);
char *dst = &sensenames[index * name_length];
memset(dst, '\0', name_length);
memcpy(dst, &name[0], name.size());
}
void CtbConfig::setSenseNames(const std::vector<std::string> &names) {
if (names.size() != num_senses) {
throw RuntimeError("Sense names need to be of size " +
std::to_string(num_senses));
}
for (size_t i = 0; i != num_senses; ++i) {
setSenseName(i, names[i]);
}
}
std::string CtbConfig::getSenseName(size_t index) const {
check_sense_index(index);
return sensenames + index * name_length;
}
std::vector<std::string> CtbConfig::getSenseNames() const {
std::vector<std::string> names;
for (size_t i = 0; i != num_senses; ++i)
names.push_back(getSenseName(i));
return names;
}
const char *CtbConfig::shm_tag() { return shm_tag_; }
} // namespace sls

View File

@ -7,12 +7,21 @@ class CtbConfig {
static constexpr size_t name_length = 20;
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 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]{};
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_size(const std::string &name) const;
public:
@ -32,6 +41,20 @@ class CtbConfig {
std::string getAdcName(size_t index) const;
std::vector<std::string> getAdcNames() const;
void setSignalNames(const std::vector<std::string> &names);
void setSignalName(size_t index, const std::string &name);
std::string getSignalName(size_t index) const;
std::vector<std::string> getSignalNames() const;
void setPowerNames(const std::vector<std::string> &names);
void setPowerName(size_t index, const std::string &name);
std::string getPowerName(size_t index) const;
std::vector<std::string> getPowerNames() const;
void setSenseNames(const std::vector<std::string> &names);
void setSenseName(size_t index, const std::string &name);
std::string getSenseName(size_t index) const;
std::vector<std::string> getSenseNames() const;
static const char *shm_tag();
};

View File

@ -2225,7 +2225,7 @@ defs::dacIndex Detector::getDacIndex(const std::string &name) {
auto names = getDacNames();
auto it = std::find(names.begin(), names.end(), name);
if (it == names.end())
throw RuntimeError("Dacname not found");
throw RuntimeError("Dac name not found");
return static_cast<defs::dacIndex>(it - names.begin());
}
return StringTo<defs::dacIndex>(name);
@ -2262,7 +2262,7 @@ int Detector::getAdcIndex(const std::string &name) {
auto names = getAdcNames();
auto it = std::find(names.begin(), names.end(), name);
if (it == names.end())
throw RuntimeError("Adcname not found");
throw RuntimeError("Adc name not found");
return (it - names.begin());
}
@ -2278,6 +2278,108 @@ std::string Detector::getAdcName(int i) {
return pimpl->getCtbAdcName(i);
}
void Detector::setSignalNames(const std::vector<std::string> names) {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named signals only for CTB");
pimpl->setCtbSignalNames(names);
}
std::vector<std::string> Detector::getSignalNames() const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named signals only for CTB");
return pimpl->getCtbSignalNames();
}
int Detector::getSignalIndex(const std::string &name) {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named signals only for CTB");
auto names = getSignalNames();
auto it = std::find(names.begin(), names.end(), name);
if (it == names.end())
throw RuntimeError("Signalname not found");
return (it - names.begin());
}
void Detector::setSignalName(const int index, const std::string &name) {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named signals only for CTB");
pimpl->setCtbSignalName(index, name);
}
std::string Detector::getSignalName(int i) {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named signals only for CTB");
return pimpl->getCtbSignalName(i);
}
void Detector::setPowerNames(const std::vector<std::string> names) {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named powers only for CTB");
pimpl->setCtbPowerNames(names);
}
std::vector<std::string> Detector::getPowerNames() const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named powers only for CTB");
return pimpl->getCtbPowerNames();
}
int Detector::getPowerIndex(const std::string &name) {
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());
}
void Detector::setPowerName(const int 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) {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named powers only for CTB");
return pimpl->getCtbPowerName(i);
}
void Detector::setSenseNames(const std::vector<std::string> names) {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named senses only for CTB");
pimpl->setCtbSenseNames(names);
}
std::vector<std::string> Detector::getSenseNames() const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named senses only for CTB");
return pimpl->getCtbSenseNames();
}
int Detector::getSenseIndex(const std::string &name) {
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());
}
void Detector::setSenseName(const int 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) {
if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named senses only for CTB");
return pimpl->getCtbSenseName(i);
}
// Pattern
void Detector::setPattern(const std::string &fname, Positions pos) {

View File

@ -2021,4 +2021,52 @@ void DetectorImpl::setCtbAdcName(const int index, const std::string &name) {
ctb_shm()->setAdcName(index, name);
}
std::vector<std::string> DetectorImpl::getCtbSignalNames() const {
return ctb_shm()->getSignalNames();
}
void DetectorImpl::setCtbSignalNames(const std::vector<std::string> &names) {
ctb_shm()->setSignalNames(names);
}
std::string DetectorImpl::getCtbSignalName(int i) const {
return ctb_shm()->getSignalName(i);
}
void DetectorImpl::setCtbSignalName(const int index, const std::string &name) {
ctb_shm()->setSignalName(index, name);
}
std::vector<std::string> DetectorImpl::getCtbPowerNames() const {
return ctb_shm()->getPowerNames();
}
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);
}
void DetectorImpl::setCtbPowerName(const int index, const std::string &name) {
ctb_shm()->setPowerName(index, name);
}
std::vector<std::string> DetectorImpl::getCtbSenseNames() const {
return ctb_shm()->getSenseNames();
}
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);
}
void DetectorImpl::setCtbSenseName(const int index, const std::string &name) {
ctb_shm()->setSenseName(index, name);
}
} // namespace sls

View File

@ -335,6 +335,21 @@ class DetectorImpl : public virtual slsDetectorDefs {
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;
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;
void setCtbPowerNames(const std::vector<std::string> &names);
void setCtbPowerName(const int index, const std::string &name);
std::vector<std::string> getCtbSenseNames() const;
std::string getCtbSenseName(int i) const;
void setCtbSenseNames(const std::vector<std::string> &names);
void setCtbSenseName(const int index, const std::string &name);
private:
/**
* Creates/open shared memory, initializes detector structure and members

View File

@ -19,6 +19,434 @@ using test::PUT;
/* dacs */
TEST_CASE("dacname", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
defs::dacIndex ind = static_cast<defs::dacIndex>(2);
std::string str_dac_index = "2";
auto prev = det.getDacName(ind);
// 1 arg throw
REQUIRE_THROWS(proxy.Call("dacname", {"2", "3", "bname"}, -1, PUT));
// invalid index
REQUIRE_THROWS(proxy.Call("dacname", {"18", "bname"}, -1, PUT));
{
std::ostringstream oss;
REQUIRE_NOTHROW(
proxy.Call("dacname", {str_dac_index, "bname"}, -1, PUT, oss));
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(
proxy.Call("dacname", {str_dac_index}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("dacname ") + str_dac_index + " bname\n");
}
det.setDacName(ind, prev);
} else {
REQUIRE_THROWS(proxy.Call("dacname", {"2", "b"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("dacname", {"2"}, -1, GET));
}
}
TEST_CASE("dacindex", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
defs::dacIndex ind = static_cast<defs::dacIndex>(2);
std::string str_dac_index = "2";
// 1 arg throw
REQUIRE_THROWS(proxy.Call("dacindex", {"2", "2"}, -1, PUT));
// invalid index
REQUIRE_THROWS(proxy.Call("dacindex", {"18"}, -1, PUT));
auto dacname = det.getDacName(ind);
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call("dacindex", {dacname}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("dacindex ") + str_dac_index + '\n');
}
} else {
REQUIRE_THROWS(proxy.Call("dacindex", {"2"}, -1, GET));
}
}
TEST_CASE("adclist", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev = det.getAdcNames();
REQUIRE_THROWS(proxy.Call("adclist", {"a", "s", "d"}, -1, PUT));
std::vector<std::string> names;
for (int iarg = 0; iarg != 32; ++iarg) {
names.push_back("a");
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call("adclist", names, -1, PUT, oss));
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call("adclist", {}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("adclist ") + ToString(names) + '\n');
}
det.setAdcNames(prev);
} else {
REQUIRE_THROWS(proxy.Call("adclist", {"a", "b"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("adclist", {}, -1, GET));
}
}
TEST_CASE("adcname", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
int ind = 2;
std::string str_adc_index = "2";
auto prev = det.getAdcName(ind);
// 1 arg throw
REQUIRE_THROWS(proxy.Call("adcname", {"2", "3", "bname"}, -1, PUT));
// invalid index
REQUIRE_THROWS(proxy.Call("adcname", {"32", "bname"}, -1, PUT));
{
std::ostringstream oss;
REQUIRE_NOTHROW(
proxy.Call("adcname", {str_adc_index, "bname"}, -1, PUT, oss));
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(
proxy.Call("adcname", {str_adc_index}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("adcname ") + str_adc_index + " bname\n");
}
det.setAdcName(ind, prev);
} else {
REQUIRE_THROWS(proxy.Call("adcname", {"2", "b"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("adcname", {"2"}, -1, GET));
}
}
TEST_CASE("adcindex", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
int ind = 2;
std::string str_adc_index = "2";
// 1 arg throw
REQUIRE_THROWS(proxy.Call("adcindex", {"2", "2"}, -1, PUT));
// invalid index
REQUIRE_THROWS(proxy.Call("adcindex", {"32"}, -1, PUT));
auto adcname = det.getAdcName(ind);
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call("adcindex", {adcname}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("adcindex ") + str_adc_index + '\n');
}
} else {
REQUIRE_THROWS(proxy.Call("adcindex", {"2"}, -1, GET));
}
}
TEST_CASE("signallist", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev = det.getSignalNames();
REQUIRE_THROWS(proxy.Call("signallist", {"a", "s", "d"}, -1, PUT));
std::vector<std::string> names;
for (int iarg = 0; iarg != 64; ++iarg) {
names.push_back("a");
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call("signallist", names, -1, PUT, oss));
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call("signallist", {}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("signallist ") + ToString(names) + '\n');
}
det.setSignalNames(prev);
} else {
REQUIRE_THROWS(proxy.Call("signallist", {"a", "b"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("signallist", {}, -1, GET));
}
}
TEST_CASE("signalname", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
int ind = 2;
std::string str_signal_index = "2";
auto prev = det.getSignalName(ind);
// 1 arg throw
REQUIRE_THROWS(proxy.Call("signalname", {"2", "3", "bname"}, -1, PUT));
// invalid index
REQUIRE_THROWS(proxy.Call("signalname", {"64", "bname"}, -1, PUT));
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call(
"signalname", {str_signal_index, "bname"}, -1, PUT, oss));
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(
proxy.Call("signalname", {str_signal_index}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("signalname ") + str_signal_index + " bname\n");
}
det.setSignalName(ind, prev);
} else {
REQUIRE_THROWS(proxy.Call("signalname", {"2", "b"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("signalname", {"2"}, -1, GET));
}
}
TEST_CASE("signalindex", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
int ind = 2;
std::string str_signal_index = "2";
// 1 arg throw
REQUIRE_THROWS(proxy.Call("signalindex", {"2", "2"}, -1, PUT));
// invalid index
REQUIRE_THROWS(proxy.Call("signalindex", {"64"}, -1, PUT));
auto signalname = det.getSignalName(ind);
{
std::ostringstream oss;
REQUIRE_NOTHROW(
proxy.Call("signalindex", {signalname}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("signalindex ") + str_signal_index + '\n');
}
} else {
REQUIRE_THROWS(proxy.Call("signalindex", {"2"}, -1, GET));
}
}
TEST_CASE("powerlist", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev = det.getPowerNames();
REQUIRE_THROWS(proxy.Call("powerlist", {"a", "s", "d"}, -1, PUT));
std::vector<std::string> names;
for (int iarg = 0; iarg != 5; ++iarg) {
names.push_back("a");
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call("powerlist", names, -1, PUT, oss));
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call("powerlist", {}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("powerlist ") + ToString(names) + '\n');
}
det.setPowerNames(prev);
} else {
REQUIRE_THROWS(proxy.Call("powerlist", {"a", "b"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("powerlist", {}, -1, GET));
}
}
TEST_CASE("powername", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
int ind = 2;
std::string str_power_index = "2";
auto prev = det.getPowerName(ind);
// 1 arg throw
REQUIRE_THROWS(proxy.Call("powername", {"2", "3", "bname"}, -1, PUT));
// invalid index
REQUIRE_THROWS(proxy.Call("powername", {"5", "bname"}, -1, PUT));
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call("powername", {str_power_index, "bname"},
-1, PUT, oss));
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(
proxy.Call("powername", {str_power_index}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("powername ") + str_power_index + " bname\n");
}
det.setPowerName(ind, prev);
} else {
REQUIRE_THROWS(proxy.Call("powername", {"2", "b"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("powername", {"2"}, -1, GET));
}
}
TEST_CASE("powerindex", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
int ind = 2;
std::string str_power_index = "2";
// 1 arg throw
REQUIRE_THROWS(proxy.Call("powerindex", {"2", "2"}, -1, PUT));
// invalid index
REQUIRE_THROWS(proxy.Call("powerindex", {"5"}, -1, PUT));
auto powername = det.getPowerName(ind);
{
std::ostringstream oss;
REQUIRE_NOTHROW(
proxy.Call("powerindex", {powername}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("powerindex ") + str_power_index + '\n');
}
} else {
REQUIRE_THROWS(proxy.Call("powerindex", {"2"}, -1, GET));
}
}
TEST_CASE("senselist", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev = det.getSenseNames();
REQUIRE_THROWS(proxy.Call("senselist", {"a", "s", "d"}, -1, PUT));
std::vector<std::string> names;
for (int iarg = 0; iarg != 8; ++iarg) {
names.push_back("a");
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call("senselist", names, -1, PUT, oss));
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call("senselist", {}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("senselist ") + ToString(names) + '\n');
}
det.setSenseNames(prev);
} else {
REQUIRE_THROWS(proxy.Call("senselist", {"a", "b"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("senselist", {}, -1, GET));
}
}
TEST_CASE("sensename", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
int ind = 2;
std::string str_sense_index = "2";
auto prev = det.getSenseName(ind);
// 1 arg throw
REQUIRE_THROWS(proxy.Call("sensename", {"2", "3", "bname"}, -1, PUT));
// invalid index
REQUIRE_THROWS(proxy.Call("sensename", {"8", "bname"}, -1, PUT));
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call("sensename", {str_sense_index, "bname"},
-1, PUT, oss));
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(
proxy.Call("sensename", {str_sense_index}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("sensename ") + str_sense_index + " bname\n");
}
det.setSenseName(ind, prev);
} else {
REQUIRE_THROWS(proxy.Call("sensename", {"2", "b"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("sensename", {"2"}, -1, GET));
}
}
TEST_CASE("senseindex", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
int ind = 2;
std::string str_sense_index = "2";
// 1 arg throw
REQUIRE_THROWS(proxy.Call("senseindex", {"2", "2"}, -1, PUT));
// invalid index
REQUIRE_THROWS(proxy.Call("senseindex", {"8"}, -1, PUT));
auto sensename = det.getSenseName(ind);
{
std::ostringstream oss;
REQUIRE_NOTHROW(
proxy.Call("senseindex", {sensename}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("senseindex ") + str_sense_index + '\n');
}
} else {
REQUIRE_THROWS(proxy.Call("senseindex", {"2"}, -1, GET));
}
}
/* dacs */
TEST_CASE("dac", "[.cmd][.dacs]") {
// dac 0 to dac 17
@ -86,7 +514,7 @@ TEST_CASE("dac", "[.cmd][.dacs]") {
REQUIRE_THROWS(proxy.Call("dac", {"vicin"}, -1, GET));
REQUIRE_THROWS(proxy.Call("dac", {"vipre_out"}, -1, GET));
// gotthard2
REQUIRE_THROWS(proxy.Call("dac", {"vref_h_adc"}, -1, GET));
REQUIRE_THROWS(proxy.Call("dac", {"vref_h_Signal"}, -1, GET));
REQUIRE_THROWS(proxy.Call("dac", {"vb_comp_fe"}, -1, GET));
REQUIRE_THROWS(proxy.Call("dac", {"vb_comp_adc"}, -1, GET));
REQUIRE_THROWS(proxy.Call("dac", {"vcom_cds"}, -1, GET));

View File

@ -1964,156 +1964,6 @@ TEST_CASE("daclist", "[.cmd]") {
}
}
TEST_CASE("adclist", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
auto prev = det.getAdcNames();
REQUIRE_THROWS(proxy.Call("adclist", {"a", "s", "d"}, -1, PUT));
std::vector<std::string> names;
for (int iarg = 0; iarg != 32; ++iarg) {
names.push_back("a");
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call("adclist", names, -1, PUT, oss));
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call("adclist", {}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("adclist ") + ToString(names) + '\n');
}
det.setAdcNames(prev);
} else {
REQUIRE_THROWS(proxy.Call("adclist", {"a", "b"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("adclist", {}, -1, GET));
}
}
TEST_CASE("dacname", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
defs::dacIndex ind = static_cast<defs::dacIndex>(2);
std::string str_dac_index = "2";
auto prev = det.getDacName(ind);
// 1 arg throw
REQUIRE_THROWS(proxy.Call("dacname", {"2", "3", "bname"}, -1, PUT));
// invalid index
REQUIRE_THROWS(proxy.Call("dacname", {"18", "bname"}, -1, PUT));
{
std::ostringstream oss;
REQUIRE_NOTHROW(
proxy.Call("dacname", {str_dac_index, "bname"}, -1, PUT, oss));
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(
proxy.Call("dacname", {str_dac_index}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("dacname ") + str_dac_index + " bname\n");
}
det.setDacName(ind, prev);
} else {
REQUIRE_THROWS(proxy.Call("dacname", {"2", "b"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("dacname", {"2"}, -1, GET));
}
}
TEST_CASE("adcname", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
int ind = 2;
std::string str_adc_index = "2";
auto prev = det.getAdcName(ind);
// 1 arg throw
REQUIRE_THROWS(proxy.Call("adcname", {"2", "3", "bname"}, -1, PUT));
// invalid index
REQUIRE_THROWS(proxy.Call("adcname", {"32", "bname"}, -1, PUT));
{
std::ostringstream oss;
REQUIRE_NOTHROW(
proxy.Call("adcname", {str_adc_index, "bname"}, -1, PUT, oss));
}
{
std::ostringstream oss;
REQUIRE_NOTHROW(
proxy.Call("adcname", {str_adc_index}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("adcname ") + str_adc_index + " bname\n");
}
det.setAdcName(ind, prev);
} else {
REQUIRE_THROWS(proxy.Call("adcname", {"2", "b"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("adcname", {"2"}, -1, GET));
}
}
TEST_CASE("dacindex", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
defs::dacIndex ind = static_cast<defs::dacIndex>(2);
std::string str_dac_index = "2";
// 1 arg throw
REQUIRE_THROWS(proxy.Call("dacindex", {"2", "2"}, -1, PUT));
// invalid index
REQUIRE_THROWS(proxy.Call("dacindex", {"18"}, -1, PUT));
auto dacname = det.getDacName(ind);
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call("dacindex", {dacname}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("dacindex ") + str_dac_index + '\n');
}
} else {
REQUIRE_THROWS(proxy.Call("dacindex", {"2"}, -1, GET));
}
}
TEST_CASE("adcindex", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) {
int ind = 2;
std::string str_adc_index = "2";
// 1 arg throw
REQUIRE_THROWS(proxy.Call("adcindex", {"2", "2"}, -1, PUT));
// invalid index
REQUIRE_THROWS(proxy.Call("adcindex", {"32"}, -1, PUT));
auto adcname = det.getAdcName(ind);
{
std::ostringstream oss;
REQUIRE_NOTHROW(proxy.Call("adcindex", {adcname}, -1, GET, oss));
REQUIRE(oss.str() ==
std::string("adcindex ") + str_adc_index + '\n');
}
} else {
REQUIRE_THROWS(proxy.Call("adcindex", {"2"}, -1, GET));
}
}
/* dacs */
TEST_CASE("dacvalues", "[.cmd]") {

View File

@ -10,7 +10,7 @@
namespace sls {
TEST_CASE("Default construction") {
static_assert(sizeof(CtbConfig) == ((18 + 32) * 20),
static_assert(sizeof(CtbConfig) == ((18 + 32 + 64 + 5 + 8) * 20),
"Size of CtbConfig does not match");
CtbConfig c;