Voltage and slow adc naming (#772)

* voltages in python 

* added voltage values in cmd line, added voltagelist in detector class

* voltage values in python

* slow adc list
This commit is contained in:
maliakal_d 2023-07-10 16:10:23 +02:00 committed by GitHub
parent fe4db54eb6
commit 054e733cd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 842 additions and 353 deletions

View File

@ -27,6 +27,8 @@ set( PYTHON_FILES
slsdet/__init__.py slsdet/__init__.py
slsdet/adcs.py slsdet/adcs.py
slsdet/dacs.py slsdet/dacs.py
slsdet/voltages.py
slsdet/slowadcs.py
slsdet/decorators.py slsdet/decorators.py
slsdet/detector_property.py slsdet/detector_property.py
slsdet/detector.py slsdet/detector.py

View File

@ -4,6 +4,8 @@
from .eiger import Eiger from .eiger import Eiger
from .ctb import Ctb from .ctb import Ctb
from .dacs import DetectorDacs, Dac from .dacs import DetectorDacs, Dac
from .voltages import DetectorVoltages, Voltage
from .slowadcs import DetectorSlowAdcs, SlowAdc
from .detector import Detector from .detector import Detector
from .jungfrau import Jungfrau from .jungfrau import Jungfrau
from .mythen3 import Mythen3 from .mythen3 import Mythen3

View File

@ -3,6 +3,8 @@
from .detector import Detector, freeze from .detector import Detector, freeze
from .utils import element_if_equal from .utils import element_if_equal
from .dacs import DetectorDacs, NamedDacs from .dacs import DetectorDacs, NamedDacs
from .voltages import DetectorVoltages, NamedVoltages
from .slowadcs import DetectorSlowAdcs, NamedSlowAdcs
import _slsdet import _slsdet
dacIndex = _slsdet.slsDetectorDefs.dacIndex dacIndex = _slsdet.slsDetectorDefs.dacIndex
from .detector_property import DetectorProperty from .detector_property import DetectorProperty
@ -15,8 +17,17 @@ class Ctb(Detector):
super().__init__(id) super().__init__(id)
self._frozen = False self._frozen = False
self._dacs = NamedDacs(self) self._dacs = NamedDacs(self)
self._voltages = NamedVoltages(self)
self._slowadcs = NamedSlowAdcs(self)
@property @property
def dacs(self): def dacs(self):
return self._dacs return self._dacs
@property
def voltages(self):
return self._voltages
@property
def slowadcs(self):
return self._slowadcs

View File

@ -1837,6 +1837,22 @@ class Detector(CppDetectorApi):
for dac in self.getDacList() for dac in self.getDacList()
} }
@property
def voltagevalues(self):
"""Gets the voltage values for every voltage for this detector."""
return {
voltage.name.lower(): element_if_equal(np.array(self.getVoltage(voltage)))
for voltage in self.getVoltageList()
}
@property
def slowadcvalues(self):
"""Gets the slow adc values for every slow adc for this detector."""
return {
slowadc.name.lower(): element_if_equal(np.array(self.getSlowADC(slowadc)))
for slowadc in self.getSlowADCList()
}
@property @property
def timinglist(self): def timinglist(self):
"""Gets the list of timing modes (timingMode) for this detector.""" """Gets the list of timing modes (timingMode) for this detector."""
@ -3755,45 +3771,45 @@ class Detector(CppDetectorApi):
@element @element
def v_a(self): def v_a(self):
"""[Ctb] Voltage supply a in mV.""" """[Ctb] Voltage supply a in mV."""
return self.getDAC(dacIndex.V_POWER_A, True) return self.getVoltage(dacIndex.V_POWER_A)
@v_a.setter @v_a.setter
def v_a(self, value): def v_a(self, value):
value = ut.merge_args(dacIndex.V_POWER_A, value, True) value = ut.merge_args(dacIndex.V_POWER_A, value)
ut.set_using_dict(self.setDAC, *value) ut.set_using_dict(self.setVoltage, *value)
@property @property
@element @element
def v_b(self): def v_b(self):
"""[Ctb] Voltage supply b in mV.""" """[Ctb] Voltage supply b in mV."""
return self.getDAC(dacIndex.V_POWER_B, True) return self.getVoltage(dacIndex.V_POWER_B)
@v_b.setter @v_b.setter
def v_b(self, value): def v_b(self, value):
value = ut.merge_args(dacIndex.V_POWER_B, value, True) value = ut.merge_args(dacIndex.V_POWER_B, value)
ut.set_using_dict(self.setDAC, *value) ut.set_using_dict(self.setVoltage, *value)
@property @property
@element @element
def v_c(self): def v_c(self):
"""[Ctb] Voltage supply c in mV.""" """[Ctb] Voltage supply c in mV."""
return self.getDAC(dacIndex.V_POWER_C, True) return self.getVoltage(dacIndex.V_POWER_C)
@v_c.setter @v_c.setter
def v_c(self, value): def v_c(self, value):
value = ut.merge_args(dacIndex.V_POWER_C, value, True) value = ut.merge_args(dacIndex.V_POWER_C, value)
ut.set_using_dict(self.setDAC, *value) ut.set_using_dict(self.setVoltage, *value)
@property @property
@element @element
def v_d(self): def v_d(self):
"""[Ctb] Voltage supply d in mV.""" """[Ctb] Voltage supply d in mV."""
return self.getDAC(dacIndex.V_POWER_D, True) return self.getVoltage(dacIndex.V_POWER_D)
@v_d.setter @v_d.setter
def v_d(self, value): def v_d(self, value):
value = ut.merge_args(dacIndex.V_POWER_D, value, True) value = ut.merge_args(dacIndex.V_POWER_D, value)
ut.set_using_dict(self.setDAC, *value) ut.set_using_dict(self.setVoltage, *value)
@property @property
@element @element
@ -3804,23 +3820,23 @@ class Detector(CppDetectorApi):
---- ----
Must be the first power regulator to be set after fpga reset (on-board detector server start up). Must be the first power regulator to be set after fpga reset (on-board detector server start up).
""" """
return self.getDAC(dacIndex.V_POWER_IO, True) return self.getVoltage(dacIndex.V_POWER_IO)
@v_io.setter @v_io.setter
def v_io(self, value): def v_io(self, value):
value = ut.merge_args(dacIndex.V_POWER_IO, value, True) value = ut.merge_args(dacIndex.V_POWER_IO, value)
ut.set_using_dict(self.setDAC, *value) ut.set_using_dict(self.setVoltage, *value)
@property @property
@element @element
def v_limit(self): def v_limit(self):
"""[Ctb] Soft limit for power supplies (ctb only) and DACS in mV.""" """[Ctb] Soft limit for power supplies (ctb only) and DACS in mV."""
return self.getDAC(dacIndex.V_LIMIT, True) return self.getVoltage(dacIndex.V_LIMIT)
@v_limit.setter @v_limit.setter
def v_limit(self, value): def v_limit(self, value):
value = ut.merge_args(dacIndex.V_LIMIT, value, True) value = ut.merge_args(dacIndex.V_LIMIT, value)
ut.set_using_dict(self.setDAC, *value) ut.set_using_dict(self.setVoltage, *value)
@property @property

195
python/slsdet/slowadcs.py Executable file
View File

@ -0,0 +1,195 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
from .detector_property import DetectorProperty
from functools import partial
import numpy as np
import _slsdet
from .detector import freeze
dacIndex = _slsdet.slsDetectorDefs.dacIndex
class SlowAdc(DetectorProperty):
"""
This class represents a slowadc on the Chip Test Board. One instance handles all
slowadcs with the same name for a multi detector instance. (TODO: Not needed for CTB)
.. note ::
This class is used to build up DetectorSlowAdcs and is in general
not directly accessible to the user.
"""
def __init__(self, name, enum, default, detector):
super().__init__(partial(detector.getVoltage, enum),
lambda x, y : detector.setVoltage(enum, x, y),
detector.size,
name)
self.default = default
def __repr__(self):
"""String representation for a single slowadc in all modules"""
slowadcstr = ''.join([f'{item:5d}' for item in self.get()])
return f'{self.__name__:15s}:{slowadcstr}'
class NamedSlowAdcs:
"""
New implementation of the detector slowadcs.
"""
_frozen = False
_direct_access = ['_detector', '_current', '_voltagenames']
def __init__(self, detector):
self._detector = detector
self._current = 0
#only get the voltagenames if we have modules attached
if detector.size() == 0:
self._voltagenames = ["VA", "VB", "VC", "VD", "VIO"]
else:
self._voltagenames = [n.replace(" ", "") for n in detector.getVoltageNames()]
# Populate the slowadcs
for i,name in enumerate(self._voltagenames):
#name, enum, low, high, default, detector
k = dacIndex(i + int(dacIndex.V_POWER_A))
setattr(self, name, SlowAdc(name, k, 0, detector))
self._frozen = True
# def __getattr__(self, name):
# return self.__getattribute__('_' + name)
def __setattr__(self, name, value):
if not self._frozen:
#durning init we need to be able to set up the class
super().__setattr__(name, value)
else:
#Later we restrict us to manipulate slowadcs and a few fields
if name in self._direct_access:
super().__setattr__(name, value)
elif name in self._voltagenames:
return self.__getattribute__(name).__setitem__(slice(None, None), value)
else:
raise AttributeError(f'SlowAdc not found: {name}')
def __next__(self):
if self._current >= len(self._voltagenames):
self._current = 0
raise StopIteration
else:
self._current += 1
return self.__getattribute__(self._voltagenames[self._current-1])
# return self.__getattr__(self._voltagenames[self._current-1])
def __iter__(self):
return self
def __repr__(self):
r_str = ['========== SLOW ADCS =========']
r_str += [repr(slowadc) for slowadc in self]
return '\n'.join(r_str)
def get_asarray(self):
"""
Read the slowadcs into a numpy array with dimensions [nslowadcs, nmodules]
"""
voltage_array = np.zeros((len(self._voltagenames), len(self._detector)))
for i, _d in enumerate(self):
voltage_array[i,:] = _d[:]
return voltage_array
def to_array(self):
return self.get_asarray()
def set_from_array(self, voltage_array):
"""
Set the slowadc from an numpy array with slowadc values. [nslowadcs, nmodules]
"""
voltage_array = voltage_array.astype(np.int)
for i, _d in enumerate(self):
_d[:] = voltage_array[i]
def from_array(self, voltage_array):
self.set_from_array(voltage_array)
class DetectorSlowAdcs:
_slowadcs = []
_voltagenames = [_d[0] for _d in _slowadcs]
_allowed_attr = ['_detector', '_current']
_frozen = False
def __init__(self, detector):
# We need to at least initially know which detector we are connected to
self._detector = detector
# Index to support iteration
self._current = 0
# Name the attributes?
for _d in self._slowadcs:
setattr(self, '_'+_d[0], SlowAdc(*_d, detector))
self._frozen = True
def __getattr__(self, name):
return self.__getattribute__('_' + name)
@property
def voltagenames(self):
return [_d[0] for _d in _slowadcs]
def __setattr__(self, name, value):
if name in self._voltagenames:
return self.__getattribute__('_' + name).__setitem__(slice(None, None), value)
else:
if self._frozen == True and name not in self._allowed_attr:
raise AttributeError(f'SlowAdc not found: {name}')
super().__setattr__(name, value)
def __next__(self):
if self._current >= len(self._slowadcs):
self._current = 0
raise StopIteration
else:
self._current += 1
return self.__getattr__(self._voltagenames[self._current-1])
def __iter__(self):
return self
def __repr__(self):
r_str = ['========== SLOW ADCS =========']
r_str += [repr(slowadc) for slowadc in self]
return '\n'.join(r_str)
def get_asarray(self):
"""
Read the slowadcs into a numpy array with dimensions [nslowadcs, nmodules]
"""
voltage_array = np.zeros((len(self._slowadcs), len(self._detector)))
for i, _d in enumerate(self):
voltage_array[i,:] = _d[:]
return voltage_array
def to_array(self):
return self.get_asarray()
def set_from_array(self, voltage_array):
"""
Set the slowadcs from an numpy array with slowadc values. [nslowadcs, nmodules]
"""
voltage_array = voltage_array.astype(np.int)
for i, _d in enumerate(self):
_d[:] = voltage_array[i]
def from_array(self, voltage_array):
self.set_from_array(voltage_array)
def set_default(self):
"""
Set all slowadcs to their default values
"""
for _d in self:
_d[:] = _d.default

195
python/slsdet/voltages.py Executable file
View File

@ -0,0 +1,195 @@
# SPDX-License-Identifier: LGPL-3.0-or-other
# Copyright (C) 2021 Contributors to the SLS Detector Package
from .detector_property import DetectorProperty
from functools import partial
import numpy as np
import _slsdet
from .detector import freeze
dacIndex = _slsdet.slsDetectorDefs.dacIndex
class Voltage(DetectorProperty):
"""
This class represents a voltage on the Chip Test Board. One instance handles all
voltages with the same name for a multi detector instance. (TODO: Not needed for CTB)
.. note ::
This class is used to build up DetectorVoltages and is in general
not directly accessible to the user.
"""
def __init__(self, name, enum, default, detector):
super().__init__(partial(detector.getVoltage, enum),
lambda x, y : detector.setVoltage(enum, x, y),
detector.size,
name)
self.default = default
def __repr__(self):
"""String representation for a single voltage in all modules"""
voltagestr = ''.join([f'{item:5d}' for item in self.get()])
return f'{self.__name__:15s}:{voltagestr}'
class NamedVoltages:
"""
New implementation of the detector voltages.
"""
_frozen = False
_direct_access = ['_detector', '_current', '_voltagenames']
def __init__(self, detector):
self._detector = detector
self._current = 0
#only get the voltagenames if we have modules attached
if detector.size() == 0:
self._voltagenames = ["VA", "VB", "VC", "VD", "VIO"]
else:
self._voltagenames = [n.replace(" ", "") for n in detector.getVoltageNames()]
# Populate the voltages
for i,name in enumerate(self._voltagenames):
#name, enum, low, high, default, detector
k = dacIndex(i + int(dacIndex.V_POWER_A))
setattr(self, name, Voltage(name, k, 0, detector))
self._frozen = True
# def __getattr__(self, name):
# return self.__getattribute__('_' + name)
def __setattr__(self, name, value):
if not self._frozen:
#durning init we need to be able to set up the class
super().__setattr__(name, value)
else:
#Later we restrict us to manipulate voltages and a few fields
if name in self._direct_access:
super().__setattr__(name, value)
elif name in self._voltagenames:
return self.__getattribute__(name).__setitem__(slice(None, None), value)
else:
raise AttributeError(f'Voltage not found: {name}')
def __next__(self):
if self._current >= len(self._voltagenames):
self._current = 0
raise StopIteration
else:
self._current += 1
return self.__getattribute__(self._voltagenames[self._current-1])
# return self.__getattr__(self._voltagenames[self._current-1])
def __iter__(self):
return self
def __repr__(self):
r_str = ['========== VOLTAGES =========']
r_str += [repr(voltage) for voltage in self]
return '\n'.join(r_str)
def get_asarray(self):
"""
Read the voltages into a numpy array with dimensions [nvoltages, nmodules]
"""
voltage_array = np.zeros((len(self._voltagenames), len(self._detector)))
for i, _d in enumerate(self):
voltage_array[i,:] = _d[:]
return voltage_array
def to_array(self):
return self.get_asarray()
def set_from_array(self, voltage_array):
"""
Set the voltage from an numpy array with voltage values. [nvoltages, nmodules]
"""
voltage_array = voltage_array.astype(np.int)
for i, _d in enumerate(self):
_d[:] = voltage_array[i]
def from_array(self, voltage_array):
self.set_from_array(voltage_array)
class DetectorVoltages:
_voltages = []
_voltagenames = [_d[0] for _d in _voltages]
_allowed_attr = ['_detector', '_current']
_frozen = False
def __init__(self, detector):
# We need to at least initially know which detector we are connected to
self._detector = detector
# Index to support iteration
self._current = 0
# Name the attributes?
for _d in self._voltages:
setattr(self, '_'+_d[0], Voltage(*_d, detector))
self._frozen = True
def __getattr__(self, name):
return self.__getattribute__('_' + name)
@property
def voltagenames(self):
return [_d[0] for _d in _voltages]
def __setattr__(self, name, value):
if name in self._voltagenames:
return self.__getattribute__('_' + name).__setitem__(slice(None, None), value)
else:
if self._frozen == True and name not in self._allowed_attr:
raise AttributeError(f'Voltage not found: {name}')
super().__setattr__(name, value)
def __next__(self):
if self._current >= len(self._voltages):
self._current = 0
raise StopIteration
else:
self._current += 1
return self.__getattr__(self._voltagenames[self._current-1])
def __iter__(self):
return self
def __repr__(self):
r_str = ['========== VOLTAGES =========']
r_str += [repr(voltage) for voltage in self]
return '\n'.join(r_str)
def get_asarray(self):
"""
Read the voltages into a numpy array with dimensions [nvoltages, nmodules]
"""
voltage_array = np.zeros((len(self._voltages), len(self._detector)))
for i, _d in enumerate(self):
voltage_array[i,:] = _d[:]
return voltage_array
def to_array(self):
return self.get_asarray()
def set_from_array(self, voltage_array):
"""
Set the voltages from an numpy array with voltage values. [nvoltages, nmodules]
"""
voltage_array = voltage_array.astype(np.int)
for i, _d in enumerate(self):
_d[:] = voltage_array[i]
def from_array(self, voltage_array):
self.set_from_array(voltage_array)
def set_default(self):
"""
Set all voltages to their default values
"""
for _d in self:
_d[:] = _d.default

View File

@ -1516,6 +1516,12 @@ void init_det(py::module &m) {
(void (Detector::*)(int, sls::Positions)) & (void (Detector::*)(int, sls::Positions)) &
Detector::setADCPipeline, Detector::setADCPipeline,
py::arg(), py::arg() = Positions{}); py::arg(), py::arg() = Positions{});
CppDetectorApi.def("getVoltageList",
(std::vector<defs::dacIndex>(Detector::*)() const) &
Detector::getVoltageList);
CppDetectorApi.def("getSlowADCList",
(std::vector<defs::dacIndex>(Detector::*)() const) &
Detector::getSlowADCList);
CppDetectorApi.def( CppDetectorApi.def(
"getVoltage", "getVoltage",
(Result<int>(Detector::*)(defs::dacIndex, sls::Positions) const) & (Result<int>(Detector::*)(defs::dacIndex, sls::Positions) const) &
@ -1716,26 +1722,26 @@ void init_det(py::module &m) {
(std::string(Detector::*)(const defs::dacIndex) const) & (std::string(Detector::*)(const defs::dacIndex) const) &
Detector::getVoltageName, Detector::getVoltageName,
py::arg()); py::arg());
CppDetectorApi.def("setSlowAdcNames", CppDetectorApi.def("setSlowADCNames",
(void (Detector::*)(const std::vector<std::string>)) & (void (Detector::*)(const std::vector<std::string>)) &
Detector::setSlowAdcNames, Detector::setSlowADCNames,
py::arg()); py::arg());
CppDetectorApi.def("getSlowAdcNames", CppDetectorApi.def("getSlowADCNames",
(std::vector<std::string>(Detector::*)() const) & (std::vector<std::string>(Detector::*)() const) &
Detector::getSlowAdcNames); Detector::getSlowADCNames);
CppDetectorApi.def( CppDetectorApi.def(
"getSlowAdcIndex", "getSlowADCIndex",
(defs::dacIndex(Detector::*)(const std::string &) const) & (defs::dacIndex(Detector::*)(const std::string &) const) &
Detector::getSlowAdcIndex, Detector::getSlowADCIndex,
py::arg()); py::arg());
CppDetectorApi.def( CppDetectorApi.def(
"setSlowAdcName", "setSlowADCName",
(void (Detector::*)(const defs::dacIndex, const std::string &)) & (void (Detector::*)(const defs::dacIndex, const std::string &)) &
Detector::setSlowAdcName, Detector::setSlowADCName,
py::arg(), py::arg()); py::arg(), py::arg());
CppDetectorApi.def("getSlowAdcName", CppDetectorApi.def("getSlowADCName",
(std::string(Detector::*)(const defs::dacIndex) const) & (std::string(Detector::*)(const defs::dacIndex) const) &
Detector::getSlowAdcName, Detector::getSlowADCName,
py::arg()); py::arg());
CppDetectorApi.def( CppDetectorApi.def(
"getPatterFileName", "getPatterFileName",

View File

@ -1611,6 +1611,12 @@ class Detector {
/** [CTB] */ /** [CTB] */
void setADCPipeline(int value, Positions pos = {}); void setADCPipeline(int value, Positions pos = {});
/** gets list of voltage enums */
std::vector<defs::dacIndex> getVoltageList() const;
/** gets list of slow adc enums */
std::vector<defs::dacIndex> getSlowADCList() const;
/** [CTB] */ /** [CTB] */
Result<int> getVoltage(defs::dacIndex index, Positions pos = {}) const; Result<int> getVoltage(defs::dacIndex index, Positions pos = {}) const;
@ -1783,19 +1789,19 @@ class Detector {
std::string getVoltageName(const defs::dacIndex i) const; std::string getVoltageName(const defs::dacIndex i) const;
/** [CTB] */ /** [CTB] */
void setSlowAdcNames(const std::vector<std::string> names); void setSlowADCNames(const std::vector<std::string> names);
/** [CTB] */ /** [CTB] */
std::vector<std::string> getSlowAdcNames() const; std::vector<std::string> getSlowADCNames() const;
/** [CTB] */ /** [CTB] */
defs::dacIndex getSlowAdcIndex(const std::string &name) const; defs::dacIndex getSlowADCIndex(const std::string &name) const;
/** [CTB] */ /** [CTB] */
void setSlowAdcName(const defs::dacIndex i, const std::string &name); void setSlowADCName(const defs::dacIndex i, const std::string &name);
/** [CTB] */ /** [CTB] */
std::string getSlowAdcName(const defs::dacIndex i) const; std::string getSlowADCName(const defs::dacIndex i) const;
///@} ///@}

View File

@ -1127,35 +1127,6 @@ std::string CmdProxy::TemperatureValues(int action) {
} }
/* list */ /* list */
std::string CmdProxy::DacList(const int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == slsDetectorDefs::HELP_ACTION) {
os << "\n\t[dacname1 dacname2 .. dacname18] \n\t\t[ChipTestBoard] Set "
"the list of dac names for this detector.\n\t\t[All] Gets the "
"list of dac names for every dac for this detector."
<< '\n';
} else if (action == slsDetectorDefs::GET_ACTION) {
if (!args.empty()) {
WrongNumberOfParameters(0);
}
auto t = det->getDacNames();
os << ToString(t) << '\n';
} else if (action == slsDetectorDefs::PUT_ACTION) {
if (det->getDetectorType().squash() != defs::CHIPTESTBOARD) {
throw RuntimeError("This detector already has fixed dac "
"names. Cannot change them.");
}
if (det_id != -1) {
throw RuntimeError("Cannot configure dacnames at module level");
}
det->setDacNames(args);
os << ToString(args) << '\n';
} else {
throw RuntimeError("Unknown action");
}
return os.str();
}
/* dacs */ /* dacs */
std::string CmdProxy::Dac(int action) { std::string CmdProxy::Dac(int action) {
@ -2688,7 +2659,7 @@ std::string CmdProxy::AdcVpp(int action) {
return os.str(); return os.str();
} }
std::string CmdProxy::SlowAdc(int action) { std::string CmdProxy::SlowADC(int action) {
std::ostringstream os; std::ostringstream os;
os << cmd << ' '; os << cmd << ' ';
if (action == defs::HELP_ACTION) { if (action == defs::HELP_ACTION) {

View File

@ -532,7 +532,8 @@ namespace sls {
os << HLPSTR << '\n'; \ os << HLPSTR << '\n'; \
return os.str(); \ return os.str(); \
} \ } \
if (det->getDetectorType().squash() != defs::CHIPTESTBOARD) { \ if (cmd != "daclist" && \
det->getDetectorType().squash() != defs::CHIPTESTBOARD) { \
throw RuntimeError(cmd + " only allowed for CTB."); \ throw RuntimeError(cmd + " only allowed for CTB."); \
} \ } \
if (det_id != -1) { \ if (det_id != -1) { \
@ -546,6 +547,11 @@ namespace sls {
auto t = det->GETFCN(); \ auto t = det->GETFCN(); \
os << ToString(t) << '\n'; \ os << ToString(t) << '\n'; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \ } else if (action == slsDetectorDefs::PUT_ACTION) { \
if (cmd == "daclist" && \
det->getDetectorType().squash() != defs::CHIPTESTBOARD) { \
throw RuntimeError("This detector already has fixed dac " \
"names. Cannot change them."); \
} \
det->SETFCN(args); \ det->SETFCN(args); \
os << ToString(args) << '\n'; \ os << ToString(args) << '\n'; \
} else { \ } else { \
@ -554,6 +560,41 @@ namespace sls {
return os.str(); \ return os.str(); \
} }
#define CTB_VALUES(CMDNAME, GETFCN, GETFCNLIST, GETFCNNAME, HLPSTR) \
std::string CMDNAME(const int action) { \
std::ostringstream os; \
os << cmd << ' '; \
if (action == slsDetectorDefs::HELP_ACTION) { \
os << HLPSTR << '\n'; \
return os.str(); \
} \
if (action == slsDetectorDefs::GET_ACTION) { \
if (!args.empty()) { \
WrongNumberOfParameters(0); \
} \
std::string suffix = " mV"; \
auto t = det->GETFCNLIST(); \
auto names = det->GETFCNNAME(); \
auto name_it = names.begin(); \
os << '['; \
auto it = t.cbegin(); \
os << ToString(*name_it++) << ' '; \
os << OutString(det->GETFCN(*it++, std::vector<int>{det_id})) \
<< suffix; \
while (it != t.cend()) { \
os << ", " << ToString(*name_it++) << ' '; \
os << OutString(det->GETFCN(*it++, std::vector<int>{det_id})) \
<< suffix; \
} \
os << "]\n"; \
} else if (action == slsDetectorDefs::PUT_ACTION) { \
throw RuntimeError("Cannot put"); \
} else { \
throw RuntimeError("Unknown action"); \
} \
return os.str(); \
}
#define CTB_SINGLE_DACNAME(CMDNAME, GETFCN, SETFCN, STARTINDEX, HLPSTR) \ #define CTB_SINGLE_DACNAME(CMDNAME, GETFCN, SETFCN, STARTINDEX, HLPSTR) \
std::string CMDNAME(const int action) { \ std::string CMDNAME(const int action) { \
std::ostringstream os; \ std::ostringstream os; \
@ -1002,7 +1043,7 @@ class CmdProxy {
{"temp_slowadc", &CmdProxy::temp_slowadc}, {"temp_slowadc", &CmdProxy::temp_slowadc},
/* lists */ /* lists */
{"daclist", &CmdProxy::DacList}, {"daclist", &CmdProxy::daclist},
{"dacname", &CmdProxy::dacname}, {"dacname", &CmdProxy::dacname},
{"dacindex", &CmdProxy::dacindex}, {"dacindex", &CmdProxy::dacindex},
{"adclist", &CmdProxy::adclist}, {"adclist", &CmdProxy::adclist},
@ -1014,9 +1055,11 @@ class CmdProxy {
{"voltagelist", &CmdProxy::voltagelist}, {"voltagelist", &CmdProxy::voltagelist},
{"voltagename", &CmdProxy::voltagename}, {"voltagename", &CmdProxy::voltagename},
{"voltageindex", &CmdProxy::voltageindex}, {"voltageindex", &CmdProxy::voltageindex},
{"voltagevalues", &CmdProxy::voltagevalues},
{"slowadclist", &CmdProxy::slowadclist}, {"slowadclist", &CmdProxy::slowadclist},
{"slowadcname", &CmdProxy::slowadcname}, {"slowadcname", &CmdProxy::slowadcname},
{"slowadcindex", &CmdProxy::slowadcindex}, {"slowadcindex", &CmdProxy::slowadcindex},
{"slowadcvalues", &CmdProxy::slowadcvalues},
/* dacs */ /* dacs */
{"dac", &CmdProxy::Dac}, {"dac", &CmdProxy::Dac},
@ -1214,7 +1257,7 @@ class CmdProxy {
{"im_c", &CmdProxy::im_c}, {"im_c", &CmdProxy::im_c},
{"im_d", &CmdProxy::im_d}, {"im_d", &CmdProxy::im_d},
{"im_io", &CmdProxy::im_io}, {"im_io", &CmdProxy::im_io},
{"slowadc", &CmdProxy::SlowAdc}, {"slowadc", &CmdProxy::SlowADC},
{"extsampling", &CmdProxy::extsampling}, {"extsampling", &CmdProxy::extsampling},
{"extsamplingsrc", &CmdProxy::extsamplingsrc}, {"extsamplingsrc", &CmdProxy::extsamplingsrc},
{"rx_dbitlist", &CmdProxy::ReceiverDbitList}, {"rx_dbitlist", &CmdProxy::ReceiverDbitList},
@ -1319,7 +1362,6 @@ class CmdProxy {
/** temperature */ /** temperature */
std::string TemperatureValues(int action); std::string TemperatureValues(int action);
/* list */ /* list */
std::string DacList(int action);
/* dacs */ /* dacs */
std::string Dac(int action); std::string Dac(int action);
std::string DacValues(int action); std::string DacValues(int action);
@ -1375,7 +1417,7 @@ class CmdProxy {
std::string Samples(int action); std::string Samples(int action);
/* CTB Specific */ /* CTB Specific */
std::string AdcVpp(int action); std::string AdcVpp(int action);
std::string SlowAdc(int action); std::string SlowADC(int action);
std::string ReceiverDbitList(int action); std::string ReceiverDbitList(int action);
std::string DigitalIODelay(int action); std::string DigitalIODelay(int action);
/* Pattern */ /* Pattern */
@ -1411,9 +1453,9 @@ class CmdProxy {
"[fname]\n\tFrees shared memory before loading configuration file. " "[fname]\n\tFrees shared memory before loading configuration file. "
"Set up once."); "Set up once.");
EXECUTE_SET_COMMAND_NOID_1ARG( EXECUTE_SET_COMMAND_NOID_1ARG(parameters, loadParameters,
parameters, loadParameters, "[fname]\n\tSets detector measurement "
"[fname]\n\tSets detector measurement parameters to those contained in " "parameters to those contained in "
"fname. Set up per measurement."); "fname. Set up per measurement.");
GET_COMMAND(detectorserverversion, getDetectorServerVersion, GET_COMMAND(detectorserverversion, getDetectorServerVersion,
@ -1506,8 +1548,9 @@ class CmdProxy {
frames, getNumberOfFrames, setNumberOfFrames, StringTo<int64_t>, frames, getNumberOfFrames, setNumberOfFrames, StringTo<int64_t>,
"[n_frames]\n\tNumber of frames per acquisition. In " "[n_frames]\n\tNumber of frames per acquisition. In "
"trigger mode, number of frames per trigger. \n\tCannot be set in " "trigger mode, number of frames per trigger. \n\tCannot be set in "
"modular level. \n\tIn scan mode, number of frames is set to number of " "modular level. \n\tIn scan mode, number of frames is set to "
"steps.\n\t[Gotthard2] Burst mode has a maximum of 2720 frames."); "number of steps.\n\t[Gotthard2] Burst mode has a maximum of 2720 "
"frames.");
INTEGER_COMMAND_SET_NOID_GET_ID( INTEGER_COMMAND_SET_NOID_GET_ID(
triggers, getNumberOfTriggers, setNumberOfTriggers, StringTo<int64_t>, triggers, getNumberOfTriggers, setNumberOfTriggers, StringTo<int64_t>,
@ -1518,11 +1561,10 @@ class CmdProxy {
period, getPeriod, setPeriod, period, getPeriod, setPeriod,
"[duration] [(optional unit) ns|us|ms|s]\n\tPeriod between frames"); "[duration] [(optional unit) ns|us|ms|s]\n\tPeriod between frames");
TIME_COMMAND( TIME_COMMAND(delay, getDelayAfterTrigger, setDelayAfterTrigger,
delay, getDelayAfterTrigger, setDelayAfterTrigger,
"[duration] [(optional unit) " "[duration] [(optional unit) "
"ns|us|ms|s]\n\t[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb][" "ns|us|ms|s]\n\t[Jungfrau][Moench][Gotthard][Mythen3]["
"Moench] Delay after trigger"); "Gotthard2][Ctb][Moench] Delay after trigger");
GET_COMMAND(framesl, getNumberOfFramesLeft, GET_COMMAND(framesl, getNumberOfFramesLeft,
"\n\t[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][CTB] " "\n\t[Gotthard][Jungfrau][Moench][Mythen3][Gotthard2][CTB] "
@ -1594,16 +1636,15 @@ class CmdProxy {
"will return power status. Can be off if temperature event occured " "will return power status. Can be off if temperature event occured "
"(temperature over temp_threshold with temp_control " "(temperature over temp_threshold with temp_control "
"enabled. Will configure chip (only chip v1.1)\n\t[Mythen3][Gotthard2] " "enabled. Will configure chip (only chip v1.1)\n\t[Mythen3][Gotthard2] "
"Default is 1. If module not " "Default is 1. If module not connected or wrong module, powerchip will "
"connected or wrong module, powerchip will fail."); "fail.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
imagetest, getImageTestMode, setImageTestMode, StringTo<int>, imagetest, getImageTestMode, setImageTestMode, StringTo<int>,
"[0, 1]\n\t[Gotthard] 1 adds channel intensity with precalculated " "[0, 1]\n\t[Gotthard] 1 adds channel intensity with precalculated "
"values when taking an acquisition. Default is 0." "values when taking an acquisition. Default is 0."
"\n\t[Eiger][Jungfrau][Moench] Only for Virtual servers. If 0, each " "\n\t[Eiger][Jungfrau][Moench] Only for Virtual servers. If 0, each "
"pixel " "pixel intensity incremented by 1. If 1, all pixels almost saturated.");
"intensity incremented by 1. If 1, all pixels almost saturated.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
parallel, getParallelMode, setParallelMode, StringTo<int>, parallel, getParallelMode, setParallelMode, StringTo<int>,
@ -1618,8 +1659,8 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
filterresistor, getFilterResistor, setFilterResistor, StringTo<int>, filterresistor, getFilterResistor, setFilterResistor, StringTo<int>,
"[value] [Gotthard2][Jungfrau] Set filter resistor. Increasing " "[value] [Gotthard2][Jungfrau] Set filter resistor. Increasing "
"values for increasing resistance.\n\t[Gotthard2] Options: [0|1|2|3]. " "values for increasing resistance.\n\t[Gotthard2] Options: "
"Default is 0.\n\t[Jungfrau] Options: [0|1]. Default is 1."); "[0|1|2|3]. Default is 0.\n\t[Jungfrau] Options: [0|1]. Default is 1.");
INTEGER_COMMAND_VEC_ID(dbitpipeline, getDBITPipeline, setDBITPipeline, INTEGER_COMMAND_VEC_ID(dbitpipeline, getDBITPipeline, setDBITPipeline,
StringTo<int>, StringTo<int>,
@ -1629,14 +1670,14 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
readnrows, getReadNRows, setReadNRows, StringTo<int>, readnrows, getReadNRows, setReadNRows, StringTo<int>,
"\n\t[1-256]\n\t\t[Eiger] Number of rows to readout per half module " "\n\t[1-256]\n\t\t[Eiger] Number of rows to readout per half "
"starting from the centre. Options: 0 - 256. 256 is default. The " "module starting from the centre. Options: 0 - 256. 256 is default. "
"permissible values depend on dynamic range and 10Gbe " "The permissible values depend on dynamic range and 10Gbe "
"enabled.\n\t[8-512 (multiple of 8)]\n\t\t[Jungfrau] Number of rows " "enabled.\n\t[8-512 (multiple of 8)]\n\t\t[Jungfrau] Number of rows "
"per module starting from the centre. Options: 8 - 512, must be " "per module starting from the centre. Options: 8 - 512, must be "
"multiples of 8. Default is 512.\n\t\t[Moench] Number of rows " "multiples of 8. Default is 512.\n\t\t[Moench] Number of rows per "
"per module starting from the centre. Options:16 - 400, must be " "module starting from the centre. Options:16 - 400, must be multiples "
"multiples of 16. Default is 400."); "of 16. Default is 400.");
/** temperature */ /** temperature */
GET_COMMAND_NOID( GET_COMMAND_NOID(
@ -1668,23 +1709,30 @@ class CmdProxy {
temp_sodl, getTemperature, slsDetectorDefs::TEMPERATURE_SODL, " °C", temp_sodl, getTemperature, slsDetectorDefs::TEMPERATURE_SODL, " °C",
"[n_value]\n\t[Eiger]Temperature close to the left so-dimm memory"); "[n_value]\n\t[Eiger]Temperature close to the left so-dimm memory");
GET_IND_COMMAND( GET_IND_COMMAND(temp_sodr, getTemperature,
temp_sodr, getTemperature, slsDetectorDefs::TEMPERATURE_SODR, " °C", slsDetectorDefs::TEMPERATURE_SODR, " °C",
"[n_value]\n\t[Eiger]Temperature close to the right so-dimm memory"); "[n_value]\n\t[Eiger]Temperature close to the right "
"so-dimm memory");
GET_IND_COMMAND( GET_IND_COMMAND(temp_fpgafl, getTemperature,
temp_fpgafl, getTemperature, slsDetectorDefs::TEMPERATURE_FPGA2, " °C", slsDetectorDefs::TEMPERATURE_FPGA2, " °C",
"[n_value]\n\t[Eiger]Temperature of the left front end board fpga."); "[n_value]\n\t[Eiger]Temperature of the left front end "
"board fpga.");
GET_IND_COMMAND( GET_IND_COMMAND(temp_fpgafr, getTemperature,
temp_fpgafr, getTemperature, slsDetectorDefs::TEMPERATURE_FPGA3, " °C", slsDetectorDefs::TEMPERATURE_FPGA3, " °C",
"[n_value]\n\t[Eiger]Temperature of the left front end board fpga."); "[n_value]\n\t[Eiger]Temperature of the left front end "
"board fpga.");
GET_IND_COMMAND(temp_slowadc, getTemperature, GET_IND_COMMAND(temp_slowadc, getTemperature,
slsDetectorDefs::SLOW_ADC_TEMP, " °C", slsDetectorDefs::SLOW_ADC_TEMP, " °C",
"[n_value]\n\t[Ctb]Temperature of the slow adc"); "[n_value]\n\t[Ctb]Temperature of the slow adc");
/* lists */ /* lists */
CTB_NAMED_LIST(daclist, getDacNames, setDacNames,
"[dacname1 dacname2 .. dacname18] \n\t\t[ChipTestBoard] Set "
"the list of dac names for this detector.\n\t\t[All] Gets "
"the list of dac names for every dac for this detector.");
CTB_SINGLE_DACNAME(dacname, getDacName, setDacName, defs::DAC_0, CTB_SINGLE_DACNAME(dacname, getDacName, setDacName, defs::DAC_0,
"\n\t[0-17][name] \n\t\t[ChipTestBoard] Set " "\n\t[0-17][name] \n\t\t[ChipTestBoard] Set "
@ -1706,9 +1754,9 @@ class CmdProxy {
"[name] \n\t\t[ChipTestBoard] Get " "[name] \n\t\t[ChipTestBoard] Get "
"the adc index for the given name."); "the adc index for the given name.");
CTB_NAMED_LIST( CTB_NAMED_LIST(signallist, getSignalNames, setSignalNames,
signallist, getSignalNames, setSignalNames, "[signalname1 signalname2 .. signalname63] "
"[signalname1 signalname2 .. signalname63] \n\t\t[ChipTestBoard] Set " "\n\t\t[ChipTestBoard] Set "
"the list of signal names for this board."); "the list of signal names for this board.");
CTB_SINGLE_NAME(signalname, getSignalName, setSignalName, CTB_SINGLE_NAME(signalname, getSignalName, setSignalName,
@ -1719,9 +1767,9 @@ class CmdProxy {
"[name] \n\t\t[ChipTestBoard] Get " "[name] \n\t\t[ChipTestBoard] Get "
"the signal index for the given name."); "the signal index for the given name.");
CTB_NAMED_LIST( CTB_NAMED_LIST(voltagelist, getVoltageNames, setVoltageNames,
voltagelist, getVoltageNames, setVoltageNames, "[voltagename1 voltagename2 .. voltagename4] "
"[voltagename1 voltagename2 .. voltagename4] \n\t\t[ChipTestBoard] Set " "\n\t\t[ChipTestBoard] Set "
"the list of voltage names for this board."); "the list of voltage names for this board.");
CTB_SINGLE_DACNAME(voltagename, getVoltageName, setVoltageName, CTB_SINGLE_DACNAME(voltagename, getVoltageName, setVoltageName,
@ -1733,17 +1781,23 @@ class CmdProxy {
"[name] \n\t\t[ChipTestBoard] Get " "[name] \n\t\t[ChipTestBoard] Get "
"the voltage index for the given name."); "the voltage index for the given name.");
CTB_NAMED_LIST( CTB_VALUES(voltagevalues, getVoltage, getVoltageList, getVoltageNames,
slowadclist, getSlowAdcNames, setSlowAdcNames, "[name] \n\t\t[ChipTestBoard] Get values of all voltages.");
"[slowadcname1 slowadcname2 .. slowadcname7] \n\t\t[ChipTestBoard] Set "
"the list of slowadc names for this board.");
CTB_SINGLE_DACNAME(slowadcname, getSlowAdcName, setSlowAdcName, CTB_VALUES(slowadcvalues, getSlowADC, getSlowADCList, getSlowADCNames,
"[name] \n\t\t[ChipTestBoard] Get values of all slow adcs.");
CTB_NAMED_LIST(
slowadclist, getSlowADCNames, setSlowADCNames,
"[slowadcname1 slowadcname2 .. slowadcname7] "
"\n\t\t[ChipTestBoard] Set the list of slowadc names for this board.");
CTB_SINGLE_DACNAME(slowadcname, getSlowADCName, setSlowADCName,
defs::SLOW_ADC0, defs::SLOW_ADC0,
"[0-7][name] \n\t\t[ChipTestBoard] Set " "[0-7][name] \n\t\t[ChipTestBoard] Set "
"the slowadc at the given position to the given name."); "the slowadc at the given position to the given name.");
CTB_GET_DACINDEX(slowadcindex, getSlowAdcIndex, defs::SLOW_ADC0, CTB_GET_DACINDEX(slowadcindex, getSlowADCIndex, defs::SLOW_ADC0,
"[name] \n\t\t[ChipTestBoard] Get " "[name] \n\t\t[ChipTestBoard] Get "
"the slowadc index for the given name."); "the slowadc index for the given name.");
@ -1753,49 +1807,52 @@ class CmdProxy {
INTEGER_USER_IND_COMMAND( INTEGER_USER_IND_COMMAND(
vchip_comp_fe, getOnChipDAC, setOnChipDAC, StringTo<int>, vchip_comp_fe, getOnChipDAC, setOnChipDAC, StringTo<int>,
defs::VB_COMP_FE, defs::VB_COMP_FE,
"[chip index 0-10, -1 for all][10 bit hex value] \n\t[Gotthard2] On " "[chip index 0-10, -1 for all][10 bit hex value] \n\t[Gotthard2] "
"chip Dac for comparator current of analogue front end."); "On chip Dac for comparator current of analogue front end.");
INTEGER_USER_IND_COMMAND( INTEGER_USER_IND_COMMAND(
vchip_opa_1st, getOnChipDAC, setOnChipDAC, StringTo<int>, vchip_opa_1st, getOnChipDAC, setOnChipDAC, StringTo<int>,
defs::VB_OPA_1ST, defs::VB_OPA_1ST,
"[chip index 0-10, -1 for all][10 bit hex value] \n\t[Gotthard2] On " "[chip index 0-10, -1 for all][10 bit hex value] \n\t[Gotthard2] "
"On "
"chip Dac for opa current for driving the other DACs in chip."); "chip Dac for opa current for driving the other DACs in chip.");
INTEGER_USER_IND_COMMAND( INTEGER_USER_IND_COMMAND(vchip_opa_fd, getOnChipDAC, setOnChipDAC,
vchip_opa_fd, getOnChipDAC, setOnChipDAC, StringTo<int>, StringTo<int>, defs::VB_OPA_FD,
defs::VB_OPA_FD, "[chip index 0-10, -1 for all][10 bit hex "
"[chip index 0-10, -1 for all][10 bit hex value] \n\t[Gotthard2] On " "value] \n\t[Gotthard2] On "
"chip Dac current for CDS opa stage."); "chip Dac current for CDS opa stage.");
INTEGER_USER_IND_COMMAND( INTEGER_USER_IND_COMMAND(vchip_comp_adc, getOnChipDAC, setOnChipDAC,
vchip_comp_adc, getOnChipDAC, setOnChipDAC, StringTo<int>, StringTo<int>, defs::VB_COMP_ADC,
defs::VB_COMP_ADC, "[chip index 0-10, -1 for all][10 bit hex "
"[chip index 0-10, -1 for all][10 bit hex value] \n\t[Gotthard2] On " "value] \n\t[Gotthard2] On "
"chip Dac for comparator current of ADC."); "chip Dac for comparator current of ADC.");
INTEGER_USER_IND_COMMAND( INTEGER_USER_IND_COMMAND(vchip_ref_comp_fe, getOnChipDAC, setOnChipDAC,
vchip_ref_comp_fe, getOnChipDAC, setOnChipDAC, StringTo<int>, StringTo<int>, defs::VREF_COMP_FE,
defs::VREF_COMP_FE, "[chip index 0-10, -1 for all][10 bit hex "
"[chip index 0-10, -1 for all][10 bit hex value] \n\t[Gotthard2] On " "value] \n\t[Gotthard2] On "
"chip Dac for reference voltage of the comparator of analogue front " "chip Dac for reference voltage of the "
"comparator of analogue front "
"end."); "end.");
INTEGER_USER_IND_COMMAND( INTEGER_USER_IND_COMMAND(
vchip_cs, getOnChipDAC, setOnChipDAC, StringTo<int>, defs::VB_CS, vchip_cs, getOnChipDAC, setOnChipDAC, StringTo<int>, defs::VB_CS,
"[chip index 0-10, -1 for all][10 bit hex value] \n\t[Gotthard2] On " "[chip index 0-10, -1 for all][10 bit hex value] \n\t[Gotthard2] "
"chip Dac for current injection into preamplifier."); "On chip Dac for current injection into preamplifier.");
/* acquisition */ /* acquisition */
EXECUTE_SET_COMMAND_NOID( EXECUTE_SET_COMMAND_NOID(
clearbusy, clearAcquiringFlag, clearbusy, clearAcquiringFlag,
"\n\tIf acquisition aborted during acquire command, use this to clear " "\n\tIf acquisition aborted during acquire command, use this to "
"acquiring flag in shared memory before starting next acquisition"); "clear acquiring flag in shared memory before starting next "
"acquisition");
EXECUTE_SET_COMMAND_NOID( EXECUTE_SET_COMMAND_NOID(rx_start, startReceiver,
rx_start, startReceiver, "\n\tStarts receiver listener for detector "
"\n\tStarts receiver listener for detector data packets and create a " "data packets and create a "
"data file (if file write enabled)."); "data file (if file write enabled).");
EXECUTE_SET_COMMAND_NOID( EXECUTE_SET_COMMAND_NOID(
@ -1805,15 +1862,16 @@ class CmdProxy {
EXECUTE_SET_COMMAND( EXECUTE_SET_COMMAND(
start, startDetector, start, startDetector,
"\n\tStarts detector acquisition. Status changes to RUNNING or WAITING " "\n\tStarts detector acquisition. Status changes to RUNNING or "
"and automatically returns to idle at the end of acquisition. If the " "WAITING and automatically returns to idle at the end of acquisition. "
"acquisition was abruptly stopped, some detectors come back to " "If the acquisition was abruptly stopped, some detectors come back to "
"STOPPED."); "STOPPED.");
EXECUTE_SET_COMMAND_NOID( EXECUTE_SET_COMMAND_NOID(
readout, startDetectorReadout, readout, startDetectorReadout,
"\n\t[Mythen3] Starts detector readout. Status changes to TRANSMITTING " "\n\t[Mythen3] Starts detector readout. Status changes to "
"and automatically returns to idle at the end of readout."); "TRANSMITTING and automatically returns to idle at the end of "
"readout.");
EXECUTE_SET_COMMAND(stop, stopDetector, EXECUTE_SET_COMMAND(stop, stopDetector,
"\n\tAbort detector acquisition. Status changes " "\n\tAbort detector acquisition. Status changes "
@ -1847,24 +1905,23 @@ class CmdProxy {
numinterfaces, getNumberofUDPInterfaces, setNumberofUDPInterfaces, numinterfaces, getNumberofUDPInterfaces, setNumberofUDPInterfaces,
StringTo<int>, StringTo<int>,
"[1, 2]\n\t[Jungfrau][Moench] Number of udp interfaces to stream " "[1, 2]\n\t[Jungfrau][Moench] Number of udp interfaces to stream "
"data from detector. Default: 1.\n\tAlso enables second interface in " "data from detector. Default: 1.\n\tAlso enables second interface "
"receiver for listening (Writes a file per interface if writing " "in receiver for listening (Writes a file per interface if writing "
"enabled).\n\tAlso restarts client and receiver zmq sockets if zmq " "enabled).\n\tAlso restarts client and receiver zmq sockets if zmq "
"streaming enabled.\n\t[Eiger] Only gets with result 2."); "streaming enabled.\n\t[Eiger] Only gets with result 2.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(selinterface, getSelectedUDPInterface,
selinterface, getSelectedUDPInterface, selectUDPInterface, selectUDPInterface, StringTo<int>,
StringTo<int>, "[0, 1]\n\t[Jungfrau][Moench] The udp interface "
"[0, 1]\n\t[Jungfrau][Moench] The udp interface to stream data from " "to stream data from detector. Effective only when "
"detector. " "number of interfaces is 1. Default: 0 (outer)");
"Effective only when number of interfaces is 1. Default: 0 (outer)");
GET_COMMAND( GET_COMMAND(
udp_numdst, getNumberofUDPDestinations, udp_numdst, getNumberofUDPDestinations,
"\n\t[Jungfrau][Moench][Eiger][Mythen3][Gotthard2] One can enter upto " "\n\t[Jungfrau][Moench][Eiger][Mythen3][Gotthard2] One can enter "
"32 (64 " "upto 32 (64 for Mythen3) destinations that the detector will stream "
"for Mythen3) destinations that the detector will stream images out in " "images out in a round robin fashion. This is get only command. "
"a round robin fashion. This is get only command. Default: 1"); "Default: 1");
EXECUTE_SET_COMMAND(udp_cleardst, clearUDPDestinations, EXECUTE_SET_COMMAND(udp_cleardst, clearUDPDestinations,
"\n\tClears udp destination details on the detector."); "\n\tClears udp destination details on the detector.");
@ -1873,17 +1930,16 @@ class CmdProxy {
udp_firstdst, getFirstUDPDestination, setFirstUDPDestination, udp_firstdst, getFirstUDPDestination, setFirstUDPDestination,
StringTo<int>, StringTo<int>,
"\n[0 - 31 (or number of udp " "\n[0 - 31 (or number of udp "
"destinations)]\n\t[Jungfrau][Moench][Gotthard2]\n[0-63]\n\t[Mythen3]" "destinations)]\n\t[Jungfrau][Moench][Gotthard2]\n[0-63]\n\t["
"\n\n\t " "Mythen3]\n\n\t One can set which is the first destination that the "
"One can set which is the first destination that the detector will " "detector will stream images out from in a round robin fashion. The "
"stream images out from in a round robin fashion. The entry must not " "entry must not have been empty. Default: 0");
"have been empty. Default: 0");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
udp_srcmac, getSourceUDPMAC, setSourceUDPMAC, MacAddr, udp_srcmac, getSourceUDPMAC, setSourceUDPMAC, MacAddr,
"[x:x:x:x:x:x]\n\tMac address of the detector (source) udp " "[x:x:x:x:x:x]\n\tMac address of the detector (source) udp "
"interface. \n\t[Eiger] Do not set as detector will replace with its " "interface. \n\t[Eiger] Do not set as detector will replace with "
"own DHCP Mac (1G) or DHCP Mac + 1 (10G)."); "its own DHCP Mac (1G) or DHCP Mac + 1 (10G).");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
udp_srcmac2, getSourceUDPMAC2, setSourceUDPMAC2, MacAddr, udp_srcmac2, getSourceUDPMAC2, setSourceUDPMAC2, MacAddr,
@ -1901,13 +1957,11 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
udp_dstmac2, getDestinationUDPMAC2, setDestinationUDPMAC2, MacAddr, udp_dstmac2, getDestinationUDPMAC2, setDestinationUDPMAC2, MacAddr,
"[x:x:x:x:x:x]\n\t[Jungfrau][Moench] Mac address of the receiver " "[x:x:x:x:x:x]\n\t[Jungfrau][Moench] Mac address of the receiver "
"(destination) " "(destination) udp interface 2. Not mandatory to set as udp_dstip2 "
"udp interface 2. Not mandatory to set as udp_dstip2 retrieves it from " "retrieves it from slsReceiver process but must be set if you use a "
"slsReceiver process but must be set if you use a custom receiver (not " "custom receiver (not slsReceiver). \n\t [Jungfrau][Moench] top half "
"slsReceiver). \n\t [Jungfrau][Moench] top half or inner interface " "or inner interface \n\t [Gotthard2] veto debugging. Use router mac if "
"\n\t " "router between detector and receiver.");
"[Gotthard2] veto debugging. Use router mac if router between detector "
"and receiver.");
INTEGER_COMMAND_VEC_ID_GET( INTEGER_COMMAND_VEC_ID_GET(
udp_dstport, getDestinationUDPPort, setDestinationUDPPort, udp_dstport, getDestinationUDPPort, setDestinationUDPPort,
@ -1922,15 +1976,14 @@ class CmdProxy {
"[n]\n\t[Jungfrau][Moench][Eiger][Gotthard2] Port number of the " "[n]\n\t[Jungfrau][Moench][Eiger][Gotthard2] Port number of the "
"receiver (destination) udp interface 2. Default is 50002. " "receiver (destination) udp interface 2. Default is 50002. "
"\n\tIf multi command, ports for each module is calculated " "\n\tIf multi command, ports for each module is calculated "
"(incremented by 2) \n\t[Jungfrau][Moench] top half or inner interface " "(incremented by 2) \n\t[Jungfrau][Moench] top half or inner "
"\n\t[Eiger] " "interface \n\t[Eiger] right half \n\t[Gotthard2] veto debugging");
"right half \n\t[Gotthard2] veto debugging");
EXECUTE_SET_COMMAND( EXECUTE_SET_COMMAND(
udp_reconfigure, reconfigureUDPDestination, udp_reconfigure, reconfigureUDPDestination,
"\n\tReconfigures Detector with UDP destination. More for debugging as " "\n\tReconfigures Detector with UDP destination. More for "
"the configuration is done automatically when the detector has " "debugging as the configuration is done automatically when the "
"sufficient UDP details."); "detector has sufficient UDP details.");
EXECUTE_SET_COMMAND( EXECUTE_SET_COMMAND(
udp_validate, validateUDPConfiguration, udp_validate, validateUDPConfiguration,
@ -1952,27 +2005,26 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
txdelay_frame, getTransmissionDelayFrame, setTransmissionDelayFrame, txdelay_frame, getTransmissionDelayFrame, setTransmissionDelayFrame,
StringTo<int>, StringTo<int>,
"[n_delay]\n\t[Eiger][Jungfrau][Moench][Mythen3] Transmission delay of " "[n_delay]\n\t[Eiger][Jungfrau][Moench][Mythen3] Transmission "
"first " "delay of first udp packet being streamed out of the "
"udp packet being streamed out of the module.\n\t[Jungfrau][Moench] " "module.\n\t[Jungfrau][Moench] [0-31] Each value represents 1 "
"[0-31] " "ms\n\t[Eiger] Additional delay to txdelay_left and txdelay_right. "
"Each value represents 1 ms\n\t[Eiger] Additional delay to " "Each value represents 10ns. Typical value is 50000.\n\t[Mythen3] "
"txdelay_left and txdelay_right. Each value represents 10ns. Typical " "[0-16777215] Each value represents 8 ns (125 MHz clock), max is 134 "
"value is 50000.\n\t[Mythen3] [0-16777215] Each value represents 8 ns " "ms.");
"(125 MHz clock), max is 134 ms.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
txdelay_left, getTransmissionDelayLeft, setTransmissionDelayLeft, txdelay_left, getTransmissionDelayLeft, setTransmissionDelayLeft,
StringTo<int>, StringTo<int>,
"[n_delay]\n\t[Eiger] Transmission delay of first packet in an image " "[n_delay]\n\t[Eiger] Transmission delay of first packet in an "
"being streamed out of the module's left UDP port. Each value " "image being streamed out of the module's left UDP port. Each value "
"represents 10ns. Typical value is 50000."); "represents 10ns. Typical value is 50000.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
txdelay_right, getTransmissionDelayRight, setTransmissionDelayRight, txdelay_right, getTransmissionDelayRight, setTransmissionDelayRight,
StringTo<int>, StringTo<int>,
"[n_delay]\n\t[Eiger] Transmission delay of first packet in an image " "[n_delay]\n\t[Eiger] Transmission delay of first packet in an "
"being streamed out of the module's right UDP port. Each value " "image being streamed out of the module's right UDP port. Each value "
"represents 10ns. Typical value is 50000."); "represents 10ns. Typical value is 50000.");
/* Receiver Config */ /* Receiver Config */
@ -1989,9 +2041,10 @@ class CmdProxy {
"[n_frames]\n\tSet the number of frames in the receiver " "[n_frames]\n\tSet the number of frames in the receiver "
"fifo depth (buffer between listener and writer threads)."); "fifo depth (buffer between listener and writer threads).");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(rx_silent, getRxSilentMode, setRxSilentMode,
rx_silent, getRxSilentMode, setRxSilentMode, StringTo<int>, StringTo<int>,
"[0, 1]\n\tSwitch on or off receiver text output during acquisition."); "[0, 1]\n\tSwitch on or off receiver text "
"output during acquisition.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
rx_discardpolicy, getRxFrameDiscardPolicy, setRxFrameDiscardPolicy, rx_discardpolicy, getRxFrameDiscardPolicy, setRxFrameDiscardPolicy,
@ -2006,20 +2059,19 @@ class CmdProxy {
"[0, 1]\n\tPartial frames padding enable in the " "[0, 1]\n\tPartial frames padding enable in the "
"receiver. Default: enabled. Disabling is fastest."); "receiver. Default: enabled. Disabling is fastest.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(rx_udpsocksize, getRxUDPSocketBufferSize,
rx_udpsocksize, getRxUDPSocketBufferSize, setRxUDPSocketBufferSize, setRxUDPSocketBufferSize, StringTo<int>,
StringTo<int>, "[n_size]\n\tUDP socket buffer size in "
"[n_size]\n\tUDP socket buffer size in receiver. Tune rmem_default and " "receiver. Tune rmem_default and rmem_max "
"rmem_max accordingly. Max value is INT_MAX/2."); "accordingly. Max value is INT_MAX/2.");
GET_COMMAND(rx_realudpsocksize, getRxRealUDPSocketBufferSize, GET_COMMAND(rx_realudpsocksize, getRxRealUDPSocketBufferSize,
"\n\tActual udp socket buffer size. Double the size of " "\n\tActual udp socket buffer size. Double the size of "
"rx_udpsocksize due to kernel bookkeeping."); "rx_udpsocksize due to kernel bookkeeping.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(rx_lock, getRxLock, setRxLock, StringTo<int>,
rx_lock, getRxLock, setRxLock, StringTo<int>, "[0, 1]\n\tLock receiver to one client IP, 1 locks, "
"[0, 1]\n\tLock receiver to one client IP, 1 locks, 0 " "0 unlocks. Default is unlocked.");
"unlocks. Default is unlocked.");
GET_COMMAND( GET_COMMAND(
rx_lastclient, getRxLastClientIP, rx_lastclient, getRxLastClientIP,
@ -2028,27 +2080,26 @@ class CmdProxy {
GET_COMMAND( GET_COMMAND(
rx_threads, getRxThreadIds, rx_threads, getRxThreadIds,
"\n\tGet kernel thread ids from the receiver in order of [parent, " "\n\tGet kernel thread ids from the receiver in order of [parent, "
"tcp, listener 0, processor 0, streamer 0, listener 1, " "tcp, listener 0, processor 0, streamer 0, listener 1, processor 1, "
"processor 1, streamer 1, arping]. If no streamer yet or there " "streamer 1, arping]. If no streamer yet or there is no second "
"is no second interface, it gives 0 in its place."); "interface, it gives 0 in its place.");
INTEGER_COMMAND_VEC_ID(rx_arping, getRxArping, setRxArping, StringTo<int>, INTEGER_COMMAND_VEC_ID(
rx_arping, getRxArping, setRxArping, StringTo<int>,
"[0, 1]\n\tStarts a thread in slsReceiver to arping " "[0, 1]\n\tStarts a thread in slsReceiver to arping "
"the interface it is " "the interface it is listening to every minute. Useful in 10G mode.");
"listening to every minute. Useful in 10G mode.");
EXECUTE_SET_COMMAND_NOID( EXECUTE_SET_COMMAND_NOID(rx_clearroi, clearRxROI,
rx_clearroi, clearRxROI, "Resets Region of interest in receiver. Default "
"Resets Region of interest in receiver. Default is all " "is all channels/pixels enabled.");
"channels/pixels enabled.");
/* File */ /* File */
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
fformat, getFileFormat, setFileFormat, fformat, getFileFormat, setFileFormat,
StringTo<slsDetectorDefs::fileFormat>, StringTo<slsDetectorDefs::fileFormat>,
"[binary|hdf5]\n\tFile format of data file. For HDF5, package must be " "[binary|hdf5]\n\tFile format of data file. For "
"compiled with HDF5 flags. Default is binary."); "HDF5, package must be compiled with HDF5 flags. Default is binary.");
STRING_COMMAND(fpath, getFilePath, setFilePath, STRING_COMMAND(fpath, getFilePath, setFilePath,
"[path]\n\tDirectory where output data files are written in " "[path]\n\tDirectory where output data files are written in "
@ -2079,25 +2130,26 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
rx_framesperfile, getFramesPerFile, setFramesPerFile, StringTo<int>, rx_framesperfile, getFramesPerFile, setFramesPerFile, StringTo<int>,
"[n_frames]\n\tNumber of frames per file in receiver in an " "[n_frames]\n\tNumber of frames per file in receiver in an "
"acquisition. Default depends on detector type. 0 is infinite or all " "acquisition. Default depends on detector type. 0 is infinite or "
"all "
"frames in single file."); "frames in single file.");
/* ZMQ Streaming Parameters (Receiver<->Client) */ /* ZMQ Streaming Parameters (Receiver<->Client) */
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
rx_zmqstream, getRxZmqDataStream, setRxZmqDataStream, StringTo<int>, rx_zmqstream, getRxZmqDataStream, setRxZmqDataStream, StringTo<int>,
"[0, 1]\n\tEnable/ disable data streaming from receiver via zmq (eg. " "[0, 1]\n\tEnable/ disable data streaming from receiver via zmq "
"to GUI or to another process for further processing). This creates/ " "(eg. to GUI or to another process for further processing). This "
"destroys zmq streamer threads in receiver. \n\tSwitching to Gui " "creates/ destroys zmq streamer threads in receiver. \n\tSwitching to "
"automatically enables data streaming in receiver. \n\tSwitching back " "Gui automatically enables data streaming in receiver. \n\tSwitching "
"to command line acquire will require disabling data streaming in " "back to command line acquire will require disabling data streaming in "
"receiver for fast applications. "); "receiver for fast applications. ");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
rx_zmqfreq, getRxZmqFrequency, setRxZmqFrequency, StringTo<int>, rx_zmqfreq, getRxZmqFrequency, setRxZmqFrequency, StringTo<int>,
"[nth frame]\n\tFrequency of frames streamed out from receiver via " "[nth frame]\n\tFrequency of frames streamed out from receiver via "
"zmq\n\tDefault: 1, Means every frame is streamed out. \n\tIf 2, every " "zmq\n\tDefault: 1, Means every frame is streamed out. \n\tIf 2, "
"second frame is streamed out. \n\tIf 0, streaming timer is the " "every second frame is streamed out. \n\tIf 0, streaming timer is the "
"timeout, after which current frame is sent out. (default timeout is " "timeout, after which current frame is sent out. (default timeout is "
"500 ms). Usually used for gui purposes."); "500 ms). Usually used for gui purposes.");
@ -2110,42 +2162,42 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID_GET( INTEGER_COMMAND_VEC_ID_GET(
rx_zmqport, getRxZmqPort, setRxZmqPort, StringTo<int>, rx_zmqport, getRxZmqPort, setRxZmqPort, StringTo<int>,
"[port]\n\tZmq port for data to be streamed out of the receiver. Also " "[port]\n\tZmq port for data to be streamed out of the receiver. "
"restarts receiver zmq streaming if enabled. Default is 30001. " "Also restarts receiver zmq streaming if enabled. Default is 30001. "
"Modified only when using an intermediate process between receiver and " "Modified only when using an intermediate process between receiver and "
"client(gui). Must be different for every detector (and udp port). " "client(gui). Must be different for every detector (and udp port). "
"Multi command will automatically increment for individual modules."); "Multi command will automatically increment for individual modules.");
INTEGER_COMMAND_VEC_ID_GET( INTEGER_COMMAND_VEC_ID_GET(
zmqport, getClientZmqPort, setClientZmqPort, StringTo<int>, zmqport, getClientZmqPort, setClientZmqPort, StringTo<int>,
"[port]\n\tZmq port in client(gui) or intermediate process for data to " "[port]\n\tZmq port in client(gui) or intermediate process for "
"be streamed to from receiver. Default connects to receiver zmq " "data to be streamed to from receiver. Default connects to receiver "
"streaming out port (30001). Modified only when using an intermediate " "zmq streaming out port (30001). Modified only when using an "
"process between receiver and client(gui). Also restarts client zmq " "intermediate process between receiver and client(gui). Also restarts "
"streaming if enabled. Must be different for every detector (and udp " "client zmq streaming if enabled. Must be different for every detector "
"port). Multi command will automatically increment for individual " "(and udp port). Multi command will automatically increment for "
"modules."); "individual modules.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
rx_zmqip, getRxZmqIP, setRxZmqIP, IpAddr, rx_zmqip, getRxZmqIP, setRxZmqIP, IpAddr,
"[x.x.x.x]\n\tZmq Ip Address from which data is to be streamed out of " "[x.x.x.x]\n\tZmq Ip Address from which data is to be streamed out "
"the receiver. Also restarts receiver zmq streaming if enabled. " "of the receiver. Also restarts receiver zmq streaming if enabled. "
"Default is from rx_hostname. Modified only when using an intermediate " "Default is from rx_hostname. Modified only when using an intermediate "
"process between receiver."); "process between receiver.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
zmqip, getClientZmqIp, setClientZmqIp, IpAddr, zmqip, getClientZmqIp, setClientZmqIp, IpAddr,
"[x.x.x.x]\n\tIp Address to listen to zmq data streamed out from " "[x.x.x.x]\n\tIp Address to listen to zmq data streamed out from "
"receiver or intermediate process. Default connects to " "receiver or intermediate process. Default connects to receiver zmq Ip "
"receiver zmq Ip Address (from rx_hostname). Modified only when using " "Address (from rx_hostname). Modified only when using an intermediate "
"an intermediate process between receiver and client(gui). Also " "process between receiver and client(gui). Also restarts client zmq "
"restarts client zmq streaming if enabled."); "streaming if enabled.");
INTEGER_COMMAND_SET_NOID_GET_ID( INTEGER_COMMAND_SET_NOID_GET_ID(
rx_zmqhwm, getRxZmqHwm, setRxZmqHwm, StringTo<int>, rx_zmqhwm, getRxZmqHwm, setRxZmqHwm, StringTo<int>,
"[n_value]\n\tReceiver's zmq send high water mark. Default is the zmq " "[n_value]\n\tReceiver's zmq send high water mark. Default is the "
"library's default (1000). This is a high number and can be set to 2 " "zmq library's default (1000). This is a high number and can be set to "
"for gui purposes. One must also set the client's receive high water " "2 for gui purposes. One must also set the client's receive high water "
"mark to similar value. Final effect is sum of them. Also restarts " "mark to similar value. Final effect is sum of them. Also restarts "
"receiver zmq streaming if enabled. Can set to -1 to set default " "receiver zmq streaming if enabled. Can set to -1 to set default "
"value."); "value.");
@ -2188,9 +2240,9 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
partialreset, getPartialReset, setPartialReset, StringTo<int>, partialreset, getPartialReset, setPartialReset, StringTo<int>,
"[0, 1]\n\t[Eiger] Sets up detector to do partial or complete reset at " "[0, 1]\n\t[Eiger] Sets up detector to do "
"start of acquisition. 0 complete reset, 1 partial reset. Default is " "partial or complete reset at start of acquisition. 0 complete reset, "
"complete reset. Advanced function!"); "1 partial reset. Default is complete reset. Advanced function!");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
top, getTop, setTop, StringTo<int>, top, getTop, setTop, StringTo<int>,
@ -2204,18 +2256,18 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
temp_threshold, getThresholdTemperature, setThresholdTemperature, temp_threshold, getThresholdTemperature, setThresholdTemperature,
StringTo<int>, StringTo<int>,
"[n_temp (in degrees)]\n\t[Jungfrau][Moench] Threshold temperature in " "[n_temp (in degrees)]\n\t[Jungfrau][Moench] Threshold temperature "
"degrees. " "in degrees. If temperature crosses threshold temperature and "
"If temperature crosses threshold temperature and temperature control " "temperature control is enabled, power to chip will be switched off "
"is enabled, power to chip will be switched off and temperature event " "and temperature event occurs. To power on chip again, temperature has "
"occurs. To power on chip again, temperature has to be less than " "to be less than threshold temperature and temperature event has to be "
"threshold temperature and temperature event has to be cleared."); "cleared.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
temp_control, getTemperatureControl, setTemperatureControl, temp_control, getTemperatureControl, setTemperatureControl,
StringTo<int>, StringTo<int>,
"[0, 1]\n\t[Jungfrau][Moench] Temperature control enable. Default is 0 " "[0, 1]\n\t[Jungfrau][Moench] Temperature control enable. Default "
"(disabled). If temperature crosses threshold temperature and " "is 0 (disabled). If temperature crosses threshold temperature and "
"temperature control is enabled, power to chip will be switched off " "temperature control is enabled, power to chip will be switched off "
"and temperature event occurs. To power on chip again, temperature has " "and temperature event occurs. To power on chip again, temperature has "
"to be less than threshold temperature and temperature event has to be " "to be less than threshold temperature and temperature event has to be "
@ -2226,12 +2278,12 @@ class CmdProxy {
StringTo<int>, StringTo<int>,
"[0, 1]\n\t[Jungfrau] Auto comparator disable mode. By " "[0, 1]\n\t[Jungfrau] Auto comparator disable mode. By "
"default, the on-chip gain switching is active during the entire " "default, the on-chip gain switching is active during the entire "
"exposure.This mode disables the on - chip gain switching comparator " "exposure.This mode disables the on - chip gain switching "
"automatically after 93.75% (only for chipv1.0) of exposure time (only " "comparator automatically after 93.75% (only for chipv1.0) of exposure "
"for longer than 100us). It is possible to set the duration for " "time (only for longer than 100us). It is possible to set the duration "
"chipv1.1 using compdisabletime command.\n\tDefault is 0 or this mode " "for chipv1.1 using compdisabletime command.\n\tDefault is 0 or this "
"disabled(comparator enabled throughout). 1 enables mode. 0 disables " "mode disabled(comparator enabled throughout). 1 enables mode. 0 "
"mode. "); "disables mode. ");
TIME_COMMAND(compdisabletime, getComparatorDisableTime, TIME_COMMAND(compdisabletime, getComparatorDisableTime,
setComparatorDisableTime, setComparatorDisableTime,
@ -2242,16 +2294,16 @@ class CmdProxy {
INTEGER_COMMAND_SET_NOID_GET_ID( INTEGER_COMMAND_SET_NOID_GET_ID(
extrastoragecells, getNumberOfAdditionalStorageCells, extrastoragecells, getNumberOfAdditionalStorageCells,
setNumberOfAdditionalStorageCells, StringTo<int>, setNumberOfAdditionalStorageCells, StringTo<int>,
"[0-15]\n\t[Jungfrau] Only for chipv1.0. Number of additional storage " "[0-15]\n\t[Jungfrau] Only for chipv1.0. Number of additional "
"cells. Default is 0. For advanced users only. \n\tThe #images = " "storage cells. Default is 0. For advanced users only. \n\tThe #images "
"#frames x #triggers x (#extrastoragecells + 1)."); "= #frames x #triggers x (#extrastoragecells + 1).");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
storagecell_start, getStorageCellStart, setStorageCellStart, storagecell_start, getStorageCellStart, setStorageCellStart,
StringTo<int>, StringTo<int>,
"[0-max]\n\t[Jungfrau] Storage cell that stores the first acquisition " "[0-max]\n\t[Jungfrau] Storage cell that stores "
"of the series. max is 15 (default) for chipv1.0 and 3 (default) for " "the first acquisition of the series. max is 15 (default) for chipv1.0 "
"chipv1.1. For advanced users only."); "and 3 (default) for chipv1.1. For advanced users only.");
TIME_COMMAND(storagecell_delay, getStorageCellDelay, setStorageCellDelay, TIME_COMMAND(storagecell_delay, getStorageCellDelay, setStorageCellDelay,
"[duration (0-1638375 ns)] [(optional unit) " "[duration (0-1638375 ns)] [(optional unit) "
@ -2262,8 +2314,8 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
gainmode, getGainMode, setGainMode, StringTo<slsDetectorDefs::gainMode>, gainmode, getGainMode, setGainMode, StringTo<slsDetectorDefs::gainMode>,
"[dynamicgain|forceswitchg1|forceswitchg2|fixg1|fixg2|fixg0]\n\t[" "[dynamicgain|forceswitchg1|forceswitchg2|fixg1|fixg2|fixg0]\n\t["
"Jungfrau] Gain mode.\n\tCAUTION: Do not use fixg0 without caution, " "Jungfrau] Gain mode.\n\tCAUTION: Do not use fixg0 without "
"you can damage the detector!!!"); "caution, you can damage the detector!!!");
INTEGER_COMMAND_VEC_ID(filtercells, getNumberOfFilterCells, INTEGER_COMMAND_VEC_ID(filtercells, getNumberOfFilterCells,
setNumberOfFilterCells, StringTo<int>, setNumberOfFilterCells, StringTo<int>,
@ -2286,10 +2338,10 @@ class CmdProxy {
"timing mode and burst mode. Use timing command to set timing mode and " "timing mode and burst mode. Use timing command to set timing mode and "
"burstmode command to set burst mode."); "burstmode command to set burst mode.");
TIME_COMMAND( TIME_COMMAND(burstperiod, getBurstPeriod, setBurstPeriod,
burstperiod, getBurstPeriod, setBurstPeriod,
"[duration] [(optional unit) ns|us|ms|s]\n\t[Gotthard2] " "[duration] [(optional unit) ns|us|ms|s]\n\t[Gotthard2] "
"Period between 2 bursts. Only in burst mode and auto timing mode."); "Period between 2 bursts. Only in burst mode and auto "
"timing mode.");
GET_COMMAND(burstsl, getNumberOfBurstsLeft, GET_COMMAND(burstsl, getNumberOfBurstsLeft,
"\n\t[Gotthard2] Number of bursts left in acquisition. Only in " "\n\t[Gotthard2] Number of bursts left in acquisition. Only in "
@ -2303,8 +2355,8 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
timingsource, getTimingSource, setTimingSource, timingsource, getTimingSource, setTimingSource,
StringTo<slsDetectorDefs::timingSourceType>, StringTo<slsDetectorDefs::timingSourceType>,
"[internal|external]\n\t[Gotthard2] Timing source. Internal is crystal " "[internal|external]\n\t[Gotthard2] Timing source. Internal is "
"and external is system timing. Default is internal."); "crystal and external is system timing. Default is internal.");
INTEGER_COMMAND_VEC_ID(veto, getVeto, setVeto, StringTo<int>, INTEGER_COMMAND_VEC_ID(veto, getVeto, setVeto, StringTo<int>,
"[0, 1]\n\t[Gotthard2] Enable or disable veto data " "[0, 1]\n\t[Gotthard2] Enable or disable veto data "
@ -2380,8 +2432,8 @@ class CmdProxy {
adcenable10g, getTenGigaADCEnableMask, setTenGigaADCEnableMask, adcenable10g, getTenGigaADCEnableMask, setTenGigaADCEnableMask,
StringTo<uint32_t>, StringTo<uint32_t>,
"[bitmask]\n\t[Ctb] ADC Enable Mask for 10Gb mode for each 32 " "[bitmask]\n\t[Ctb] ADC Enable Mask for 10Gb mode for each 32 "
"ADC channel. However, if any of a consecutive 4 bits are enabled, the " "ADC channel. However, if any of a consecutive 4 bits are enabled, "
"complete 4 bits are enabled."); "the complete 4 bits are enabled.");
/* CTB Specific */ /* CTB Specific */
@ -2396,9 +2448,9 @@ class CmdProxy {
"[analog|digital|analog_digital]\n\t[CTB] Readout mode. " "[analog|digital|analog_digital]\n\t[CTB] Readout mode. "
"Default is analog."); "Default is analog.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(dbitclk, getDBITClock, setDBITClock, StringTo<int>,
dbitclk, getDBITClock, setDBITClock, StringTo<int>, "[n_clk in MHz]\n\t[Ctb] Clock for latching the "
"[n_clk in MHz]\n\t[Ctb] Clock for latching the digital bits in MHz."); "digital bits in MHz.");
INTEGER_IND_COMMAND(v_a, getVoltage, setVoltage, StringTo<int>, INTEGER_IND_COMMAND(v_a, getVoltage, setVoltage, StringTo<int>,
defs::V_POWER_A, defs::V_POWER_A,
@ -2418,13 +2470,14 @@ class CmdProxy {
INTEGER_IND_COMMAND( INTEGER_IND_COMMAND(
v_io, getVoltage, setVoltage, StringTo<int>, defs::V_POWER_IO, v_io, getVoltage, setVoltage, StringTo<int>, defs::V_POWER_IO,
"[n_value]\n\t[Ctb] Voltage supply io in mV. Minimum 1200 mV. Must be " "[n_value]\n\t[Ctb] Voltage supply io in mV. Minimum 1200 mV. Must "
"the first power regulator to be set after fpga reset (on-board " "be the first power regulator to be set after fpga reset (on-board "
"detector server start up)."); "detector server start up).");
INTEGER_IND_COMMAND( INTEGER_IND_COMMAND(
v_chip, getVoltage, setVoltage, StringTo<int>, defs::V_POWER_CHIP, v_chip, getVoltage, setVoltage, StringTo<int>, defs::V_POWER_CHIP,
"[n_value]\n\t[Ctb] Voltage supply chip in mV. Do not use it unless " "[n_value]\n\t[Ctb] Voltage supply chip in mV. Do not use it "
"unless "
"you are completely sure you will not fry the board."); "you are completely sure you will not fry the board.");
GET_IND_COMMAND(vm_a, getMeasuredVoltage, defs::V_POWER_A, "", GET_IND_COMMAND(vm_a, getMeasuredVoltage, defs::V_POWER_A, "",
@ -2459,8 +2512,8 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
extsampling, getExternalSampling, setExternalSampling, StringTo<int>, extsampling, getExternalSampling, setExternalSampling, StringTo<int>,
"[0, 1]\n\t[Ctb] Enable for external sampling signal for digital data " "[0, 1]\n\t[Ctb] Enable for external sampling signal for digital "
"to signal by extsampling src command. For advanced users only."); "data to signal by extsampling src command. For advanced users only.");
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
extsamplingsrc, getExternalSamplingSource, setExternalSamplingSource, extsamplingsrc, getExternalSamplingSource, setExternalSamplingSource,
@ -2524,19 +2577,19 @@ class CmdProxy {
INTEGER_COMMAND_VEC_ID( INTEGER_COMMAND_VEC_ID(
updatemode, getUpdateMode, setUpdateMode, StringTo<int>, updatemode, getUpdateMode, setUpdateMode, StringTo<int>,
"[0|1]\n\tRestart the detector server in update mode or not. This is " "[0|1]\n\tRestart the detector server in update "
"useful when server-firmware compatibility is at its worst and server " "mode or not. This is useful when server-firmware compatibility is at "
"cannot start up normally"); "its worst and server cannot start up normally");
EXECUTE_SET_COMMAND( EXECUTE_SET_COMMAND(
firmwaretest, executeFirmwareTest, firmwaretest, executeFirmwareTest,
"\n\t[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb] Firmware " "\n\t[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb] "
"test, ie. reads a read fixed pattern from a register."); "Firmware test, ie. reads a read fixed pattern from a register.");
EXECUTE_SET_COMMAND( EXECUTE_SET_COMMAND(
bustest, executeBusTest, bustest, executeBusTest,
"\n\t[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb] Bus test, " "\n\t[Jungfrau][Moench][Gotthard][Mythen3][Gotthard2][Ctb] Bus "
"ie. Writes different values in a R/W register and confirms the " "test, ie. Writes different values in a R/W register and confirms the "
"writes to check bus.\n\tAdvanced User function!"); "writes to check bus.\n\tAdvanced User function!");
INTEGER_COMMAND_HEX( INTEGER_COMMAND_HEX(
@ -2565,22 +2618,22 @@ class CmdProxy {
lastclient, getLastClientIP, lastclient, getLastClientIP,
"\n\tClient IP Address that last communicated with the detector."); "\n\tClient IP Address that last communicated with the detector.");
GET_COMMAND(framecounter, getNumberOfFramesFromStart, GET_COMMAND(
"\n\t[Jungfrau][Moench][Mythen3][Gotthard2][CTB] " framecounter, getNumberOfFramesFromStart,
"Number of frames from start run control." "\n\t[Jungfrau][Moench][Mythen3][Gotthard2][CTB] Number of frames from "
"\n\t[Gotthard2] only in continuous mode."); "start run control.\n\t[Gotthard2] only in continuous mode.");
TIME_GET_COMMAND(runtime, getActualTime, TIME_GET_COMMAND(runtime, getActualTime,
"[(optional unit) " "[(optional unit) "
"ns|us|ms|s]\n\t[Jungfrau][Moench][Mythen3][Gotthard2][" "ns|us|ms|s]\n\t[Jungfrau][Moench][Mythen3][Gotthard2]["
"CTB] Time from detector start up." "CTB] Time from detector start up.\n\t[Gotthard2] not in "
"\n\t[Gotthard2] not in burst and auto mode."); "burst and auto mode.");
TIME_GET_COMMAND(frametime, getMeasurementTime, TIME_GET_COMMAND(frametime, getMeasurementTime,
"[(optional unit) " "[(optional unit) "
"ns|us|ms|s]\n\t[Jungfrau][Moench][Mythen3][Gotthard2][" "ns|us|ms|s]\n\t[Jungfrau][Moench][Mythen3][Gotthard2]["
"CTB] Timestamp at a frame start." "CTB] Timestamp at a frame start.\n\t[Gotthard2] not in "
"\n\t[Gotthard2] not in burst and auto mode."); "burst and auto mode.");
}; };
} // namespace sls } // namespace sls

View File

@ -25,8 +25,8 @@ CtbConfig::CtbConfig() {
setVoltageName(2, "VC"); setVoltageName(2, "VC");
setVoltageName(3, "VD"); setVoltageName(3, "VD");
setVoltageName(4, "VIO"); setVoltageName(4, "VIO");
for (size_t i = 0; i != num_slowAdcs; ++i) { for (size_t i = 0; i != num_slowADCs; ++i) {
setSlowAdcName(i, "SLOWADC" + ToString(i)); setSlowADCName(i, "SLOWADC" + ToString(i));
} }
} }
@ -64,9 +64,9 @@ void CtbConfig::check_voltage_index(size_t i) const {
} }
void CtbConfig::check_slow_adc_index(size_t i) const { void CtbConfig::check_slow_adc_index(size_t i) const {
if (i >= num_slowAdcs) { if (i >= num_slowADCs) {
std::ostringstream oss; std::ostringstream oss;
oss << "Invalid Slow ADC index. Options: 0 - " << num_slowAdcs oss << "Invalid Slow ADC index. Options: 0 - " << num_slowADCs
<< " or SLOW_ADC0 - SLOW_ADC7"; << " or SLOW_ADC0 - SLOW_ADC7";
throw RuntimeError(oss.str()); throw RuntimeError(oss.str());
} }
@ -206,33 +206,33 @@ std::vector<std::string> CtbConfig::getVoltageNames() const {
return names; return names;
} }
void CtbConfig::setSlowAdcName(size_t index, const std::string &name) { void CtbConfig::setSlowADCName(size_t index, const std::string &name) {
check_slow_adc_index(index); check_slow_adc_index(index);
check_size(name); check_size(name);
char *dst = &slowAdcnames[index * name_length]; char *dst = &slowADCnames[index * name_length];
memset(dst, '\0', name_length); memset(dst, '\0', name_length);
memcpy(dst, &name[0], name.size()); memcpy(dst, &name[0], name.size());
} }
void CtbConfig::setSlowAdcNames(const std::vector<std::string> &names) { void CtbConfig::setSlowADCNames(const std::vector<std::string> &names) {
if (names.size() != num_slowAdcs) { if (names.size() != num_slowADCs) {
throw RuntimeError("Slow ADC names need to be of size " + throw RuntimeError("Slow ADC names need to be of size " +
std::to_string(num_slowAdcs)); std::to_string(num_slowADCs));
} }
for (size_t i = 0; i != num_slowAdcs; ++i) { for (size_t i = 0; i != num_slowADCs; ++i) {
setSlowAdcName(i, names[i]); setSlowADCName(i, names[i]);
} }
} }
std::string CtbConfig::getSlowAdcName(size_t index) const { std::string CtbConfig::getSlowADCName(size_t index) const {
check_slow_adc_index(index); check_slow_adc_index(index);
return slowAdcnames + index * name_length; return slowADCnames + index * name_length;
} }
std::vector<std::string> CtbConfig::getSlowAdcNames() const { std::vector<std::string> CtbConfig::getSlowADCNames() const {
std::vector<std::string> names; std::vector<std::string> names;
for (size_t i = 0; i != num_slowAdcs; ++i) for (size_t i = 0; i != num_slowADCs; ++i)
names.push_back(getSlowAdcName(i)); names.push_back(getSlowADCName(i));
return names; return names;
} }

View File

@ -9,13 +9,13 @@ class CtbConfig {
static constexpr size_t num_adcs = 32; static constexpr size_t num_adcs = 32;
static constexpr size_t num_signals = 64; static constexpr size_t num_signals = 64;
static constexpr size_t num_voltages = 5; static constexpr size_t num_voltages = 5;
static constexpr size_t num_slowAdcs = 8; static constexpr size_t num_slowADCs = 8;
static constexpr const char *shm_tag_ = "ctbdacs"; static constexpr const char *shm_tag_ = "ctbdacs";
char dacnames[name_length * num_dacs]{}; char dacnames[name_length * num_dacs]{};
char adcnames[name_length * num_adcs]{}; char adcnames[name_length * num_adcs]{};
char signalnames[name_length * num_signals]{}; char signalnames[name_length * num_signals]{};
char voltagenames[name_length * num_voltages]{}; char voltagenames[name_length * num_voltages]{};
char slowAdcnames[name_length * num_slowAdcs]{}; char slowADCnames[name_length * num_slowADCs]{};
void check_dac_index(size_t i) const; void check_dac_index(size_t i) const;
void check_adc_index(size_t i) const; void check_adc_index(size_t i) const;
@ -51,10 +51,10 @@ class CtbConfig {
std::string getVoltageName(size_t index) const; std::string getVoltageName(size_t index) const;
std::vector<std::string> getVoltageNames() const; std::vector<std::string> getVoltageNames() const;
void setSlowAdcNames(const std::vector<std::string> &names); void setSlowADCNames(const std::vector<std::string> &names);
void setSlowAdcName(size_t index, const std::string &name); void setSlowADCName(size_t index, const std::string &name);
std::string getSlowAdcName(size_t index) const; std::string getSlowADCName(size_t index) const;
std::vector<std::string> getSlowAdcNames() const; std::vector<std::string> getSlowADCNames() const;
static const char *shm_tag(); static const char *shm_tag();
}; };

View File

@ -2040,6 +2040,24 @@ void Detector::setADCPipeline(int value, Positions pos) {
pimpl->Parallel(&Module::setADCPipeline, pos, value); pimpl->Parallel(&Module::setADCPipeline, pos, value);
} }
std::vector<defs::dacIndex> Detector::getVoltageList() const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD) {
throw RuntimeError("Voltage list not implemented for this detector");
}
return std::vector<defs::dacIndex>{defs::V_POWER_A, defs::V_POWER_B,
defs::V_POWER_C, defs::V_POWER_D,
defs::V_POWER_IO};
}
std::vector<defs::dacIndex> Detector::getSlowADCList() const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD) {
throw RuntimeError("Slow ADC list not implemented for this detector");
}
return std::vector<defs::dacIndex>{
defs::SLOW_ADC0, defs::SLOW_ADC1, defs::SLOW_ADC2, defs::SLOW_ADC3,
defs::SLOW_ADC4, defs::SLOW_ADC5, defs::SLOW_ADC6, defs::SLOW_ADC7};
}
Result<int> Detector::getVoltage(defs::dacIndex index, Positions pos) const { Result<int> Detector::getVoltage(defs::dacIndex index, Positions pos) const {
switch (index) { switch (index) {
case defs::V_LIMIT: case defs::V_LIMIT:
@ -2352,39 +2370,39 @@ std::string Detector::getVoltageName(const defs::dacIndex i) const {
return pimpl->getCtbVoltageName(i); return pimpl->getCtbVoltageName(i);
} }
void Detector::setSlowAdcNames(const std::vector<std::string> names) { void Detector::setSlowADCNames(const std::vector<std::string> names) {
if (getDetectorType().squash() != defs::CHIPTESTBOARD) if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named SlowAdcs only for CTB"); throw RuntimeError("Named SlowADCs only for CTB");
pimpl->setCtbSlowAdcNames(names); pimpl->setCtbSlowADCNames(names);
} }
std::vector<std::string> Detector::getSlowAdcNames() const { std::vector<std::string> Detector::getSlowADCNames() const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD) if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named SlowAdcs only for CTB"); throw RuntimeError("Named SlowADCs only for CTB");
return pimpl->getCtbSlowAdcNames(); return pimpl->getCtbSlowADCNames();
} }
defs::dacIndex Detector::getSlowAdcIndex(const std::string &name) const { defs::dacIndex Detector::getSlowADCIndex(const std::string &name) const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD) if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named SlowAdcs only for CTB"); throw RuntimeError("Named SlowADCs only for CTB");
auto names = getSlowAdcNames(); auto names = getSlowADCNames();
auto it = std::find(names.begin(), names.end(), name); auto it = std::find(names.begin(), names.end(), name);
if (it == names.end()) if (it == names.end())
throw RuntimeError("SlowAdc name not found"); throw RuntimeError("SlowADC name not found");
return static_cast<defs::dacIndex>(it - names.begin() + defs::SLOW_ADC0); return static_cast<defs::dacIndex>(it - names.begin() + defs::SLOW_ADC0);
} }
void Detector::setSlowAdcName(const defs::dacIndex index, void Detector::setSlowADCName(const defs::dacIndex index,
const std::string &name) { const std::string &name) {
if (getDetectorType().squash() != defs::CHIPTESTBOARD) if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named SlowAdcs only for CTB"); throw RuntimeError("Named SlowADCs only for CTB");
pimpl->setCtbSlowAdcName(index, name); pimpl->setCtbSlowADCName(index, name);
} }
std::string Detector::getSlowAdcName(const defs::dacIndex i) const { std::string Detector::getSlowADCName(const defs::dacIndex i) const {
if (getDetectorType().squash() != defs::CHIPTESTBOARD) if (getDetectorType().squash() != defs::CHIPTESTBOARD)
throw RuntimeError("Named SlowAdcs only for CTB"); throw RuntimeError("Named SlowADCs only for CTB");
return pimpl->getCtbSlowAdcName(i); return pimpl->getCtbSlowADCName(i);
} }
// Pattern // Pattern

View File

@ -2055,21 +2055,21 @@ void DetectorImpl::setCtbVoltageName(const defs::dacIndex index,
ctb_shm()->setVoltageName(static_cast<int>(index - defs::V_POWER_A), name); ctb_shm()->setVoltageName(static_cast<int>(index - defs::V_POWER_A), name);
} }
std::vector<std::string> DetectorImpl::getCtbSlowAdcNames() const { std::vector<std::string> DetectorImpl::getCtbSlowADCNames() const {
return ctb_shm()->getSlowAdcNames(); return ctb_shm()->getSlowADCNames();
} }
void DetectorImpl::setCtbSlowAdcNames(const std::vector<std::string> &names) { void DetectorImpl::setCtbSlowADCNames(const std::vector<std::string> &names) {
ctb_shm()->setSlowAdcNames(names); ctb_shm()->setSlowADCNames(names);
} }
std::string DetectorImpl::getCtbSlowAdcName(const defs::dacIndex i) const { std::string DetectorImpl::getCtbSlowADCName(const defs::dacIndex i) const {
return ctb_shm()->getSlowAdcName(static_cast<int>(i - defs::SLOW_ADC0)); return ctb_shm()->getSlowADCName(static_cast<int>(i - defs::SLOW_ADC0));
} }
void DetectorImpl::setCtbSlowAdcName(const defs::dacIndex index, void DetectorImpl::setCtbSlowADCName(const defs::dacIndex index,
const std::string &name) { const std::string &name) {
ctb_shm()->setSlowAdcName(static_cast<int>(index - defs::SLOW_ADC0), name); ctb_shm()->setSlowADCName(static_cast<int>(index - defs::SLOW_ADC0), name);
} }
} // namespace sls } // namespace sls

View File

@ -345,10 +345,10 @@ class DetectorImpl : public virtual slsDetectorDefs {
void setCtbVoltageNames(const std::vector<std::string> &names); void setCtbVoltageNames(const std::vector<std::string> &names);
void setCtbVoltageName(const defs::dacIndex index, const std::string &name); void setCtbVoltageName(const defs::dacIndex index, const std::string &name);
std::vector<std::string> getCtbSlowAdcNames() const; std::vector<std::string> getCtbSlowADCNames() const;
std::string getCtbSlowAdcName(const defs::dacIndex i) const; std::string getCtbSlowADCName(const defs::dacIndex i) const;
void setCtbSlowAdcNames(const std::vector<std::string> &names); void setCtbSlowADCNames(const std::vector<std::string> &names);
void setCtbSlowAdcName(const defs::dacIndex index, const std::string &name); void setCtbSlowADCName(const defs::dacIndex index, const std::string &name);
private: private:
/** /**

View File

@ -353,13 +353,27 @@ TEST_CASE("voltageindex", "[.cmd]") {
} }
} }
TEST_CASE("voltagevalues", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
REQUIRE_NOTHROW(proxy.Call("voltagevalues", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("voltagevalues", {}, -1, PUT));
}
TEST_CASE("slowadcvalues", "[.cmd]") {
Detector det;
CmdProxy proxy(&det);
REQUIRE_NOTHROW(proxy.Call("slowadcvalues", {}, -1, GET));
REQUIRE_THROWS(proxy.Call("slowadcvalues", {}, -1, PUT));
}
TEST_CASE("slowadclist", "[.cmd]") { TEST_CASE("slowadclist", "[.cmd]") {
Detector det; Detector det;
CmdProxy proxy(&det); CmdProxy proxy(&det);
auto det_type = det.getDetectorType().squash(); auto det_type = det.getDetectorType().squash();
if (det_type == defs::CHIPTESTBOARD) { if (det_type == defs::CHIPTESTBOARD) {
auto prev = det.getSlowAdcNames(); auto prev = det.getSlowADCNames();
REQUIRE_THROWS(proxy.Call("slowadclist", {"a", "s", "d"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("slowadclist", {"a", "s", "d"}, -1, PUT));
@ -377,7 +391,7 @@ TEST_CASE("slowadclist", "[.cmd]") {
REQUIRE(oss.str() == REQUIRE(oss.str() ==
std::string("slowadclist ") + ToString(names) + '\n'); std::string("slowadclist ") + ToString(names) + '\n');
} }
det.setSlowAdcNames(prev); det.setSlowADCNames(prev);
} else { } else {
REQUIRE_THROWS(proxy.Call("slowadclist", {"a", "b"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("slowadclist", {"a", "b"}, -1, PUT));
@ -393,7 +407,7 @@ TEST_CASE("slowadcname", "[.cmd]") {
if (det_type == defs::CHIPTESTBOARD) { if (det_type == defs::CHIPTESTBOARD) {
defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::SLOW_ADC0); defs::dacIndex ind = static_cast<defs::dacIndex>(2 + defs::SLOW_ADC0);
std::string str_slowadc_index = "2"; std::string str_slowadc_index = "2";
auto prev = det.getSlowAdcName(ind); auto prev = det.getSlowADCName(ind);
// 1 arg throw // 1 arg throw
REQUIRE_THROWS(proxy.Call("slowadcname", {"2", "3", "bname"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("slowadcname", {"2", "3", "bname"}, -1, PUT));
@ -411,7 +425,7 @@ TEST_CASE("slowadcname", "[.cmd]") {
REQUIRE(oss.str() == std::string("slowadcname ") + REQUIRE(oss.str() == std::string("slowadcname ") +
str_slowadc_index + " bname\n"); str_slowadc_index + " bname\n");
} }
det.setSlowAdcName(ind, prev); det.setSlowADCName(ind, prev);
} else { } else {
REQUIRE_THROWS(proxy.Call("slowadcname", {"2", "b"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("slowadcname", {"2", "b"}, -1, PUT));
@ -432,7 +446,7 @@ TEST_CASE("slowadcindex", "[.cmd]") {
REQUIRE_THROWS(proxy.Call("slowadcindex", {"2", "2"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("slowadcindex", {"2", "2"}, -1, PUT));
// invalid index // invalid index
REQUIRE_THROWS(proxy.Call("slowadcindex", {"8"}, -1, PUT)); REQUIRE_THROWS(proxy.Call("slowadcindex", {"8"}, -1, PUT));
auto slowadcname = det.getSlowAdcName(ind); auto slowadcname = det.getSlowADCName(ind);
{ {
std::ostringstream oss; std::ostringstream oss;
REQUIRE_NOTHROW( REQUIRE_NOTHROW(

View File

@ -39,7 +39,7 @@ TEST_CASE("Default construction") {
REQUIRE(signalnames[1] == "BIT1"); REQUIRE(signalnames[1] == "BIT1");
REQUIRE(signalnames[2] == "BIT2"); REQUIRE(signalnames[2] == "BIT2");
REQUIRE(signalnames[3] == "BIT3"); REQUIRE(signalnames[3] == "BIT3");
auto sensenames = c.getSlowAdcNames(); auto sensenames = c.getSlowADCNames();
REQUIRE(sensenames.size() == 8); REQUIRE(sensenames.size() == 8);
REQUIRE(sensenames[0] == "SLOWADC0"); REQUIRE(sensenames[0] == "SLOWADC0");
REQUIRE(sensenames[1] == "SLOWADC1"); REQUIRE(sensenames[1] == "SLOWADC1");