mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-26 16:20:03 +02:00
commit
7d3b7881d1
18
RELEASE.txt
18
RELEASE.txt
@ -1,4 +1,4 @@
|
|||||||
SLS Detector Package 5.2.0 released on 15.07.2021 (Minor Release)
|
SLS Detector Package 5.2.0 released on 28.07.2021 (Minor Release)
|
||||||
===================================================================
|
===================================================================
|
||||||
|
|
||||||
This document describes the differences between 5.2.0 and 5.1.0 releases.
|
This document describes the differences between 5.2.0 and 5.1.0 releases.
|
||||||
@ -27,6 +27,10 @@ This document describes the differences between 5.2.0 and 5.1.0 releases.
|
|||||||
Command: vetostream, Detector::setVetoStream
|
Command: vetostream, Detector::setVetoStream
|
||||||
|
|
||||||
|
|
||||||
|
2. (Gotthard2) veto algorithm
|
||||||
|
New command to set veto algorithm for 2.5GbE or 10GbE (debugging).
|
||||||
|
Command: vetoalg, Detector::setVetoAlgorithm
|
||||||
|
|
||||||
Gotthard2 server
|
Gotthard2 server
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
@ -37,18 +41,6 @@ This document describes the differences between 5.2.0 and 5.1.0 releases.
|
|||||||
2. Resolved Issues
|
2. Resolved Issues
|
||||||
==================
|
==================
|
||||||
|
|
||||||
|
|
||||||
Receiver
|
|
||||||
--------
|
|
||||||
|
|
||||||
1.
|
|
||||||
|
|
||||||
|
|
||||||
Client
|
|
||||||
------
|
|
||||||
|
|
||||||
1.
|
|
||||||
|
|
||||||
Gotthard2 Server
|
Gotthard2 Server
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import subprocess
|
|||||||
|
|
||||||
from parse import remove_comments
|
from parse import remove_comments
|
||||||
|
|
||||||
allow_bitwise_op = ["EthernetInterface"]
|
allow_bitwise_op = ["ethernetInterface"]
|
||||||
|
|
||||||
op_key = {"operator|": "__or__",
|
op_key = {"operator|": "__or__",
|
||||||
"operator&" : "__and__"}
|
"operator&" : "__and__"}
|
||||||
@ -22,7 +22,7 @@ def single_line_enum(line):
|
|||||||
|
|
||||||
def extract_enums(lines):
|
def extract_enums(lines):
|
||||||
|
|
||||||
# deal with enum class EthernetInterface : int32_t
|
# deal with enum class ethernetInterface : int32_t
|
||||||
# and normal enum burstMode {
|
# and normal enum burstMode {
|
||||||
|
|
||||||
line_iter = iter(lines)
|
line_iter = iter(lines)
|
||||||
@ -89,7 +89,7 @@ def generate_enum_string(enums):
|
|||||||
|
|
||||||
#Here add the operators
|
#Here add the operators
|
||||||
for op in operators:
|
for op in operators:
|
||||||
data.append(f"\n\t.def(\"{op_key[op]}\", py::overload_cast< const slsDetectorDefs::EthernetInterface&, const slsDetectorDefs::EthernetInterface&>(&{op}))")
|
data.append(f"\n\t.def(\"{op_key[op]}\", py::overload_cast< const slsDetectorDefs::ethernetInterface&, const slsDetectorDefs::ethernetInterface&>(&{op}))")
|
||||||
|
|
||||||
|
|
||||||
data.append(';\n\n')
|
data.append(';\n\n')
|
||||||
|
@ -7,6 +7,7 @@ timingMode = slsDetectorDefs.timingMode
|
|||||||
speedLevel = slsDetectorDefs.speedLevel
|
speedLevel = slsDetectorDefs.speedLevel
|
||||||
dacIndex = slsDetectorDefs.dacIndex
|
dacIndex = slsDetectorDefs.dacIndex
|
||||||
detectorType = slsDetectorDefs.detectorType
|
detectorType = slsDetectorDefs.detectorType
|
||||||
|
ethernetInterface = slsDetectorDefs.ethernetInterface
|
||||||
|
|
||||||
from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask
|
from .utils import element_if_equal, all_equal, get_set_bits, list_to_bitmask
|
||||||
from .utils import Geometry, to_geo, element, reduce_time, is_iterable
|
from .utils import Geometry, to_geo, element, reduce_time, is_iterable
|
||||||
@ -2335,6 +2336,13 @@ class Detector(CppDetectorApi):
|
|||||||
@property
|
@property
|
||||||
@element
|
@element
|
||||||
def vetostream(self):
|
def vetostream(self):
|
||||||
|
"""[Gotthard2] Enabling/ disabling veto interface
|
||||||
|
Note
|
||||||
|
----
|
||||||
|
Default: both off
|
||||||
|
Options: NONE, I3GBE, 10GBE (debugging)
|
||||||
|
Debugging interface also enables second interface in receiver (separate file), which also restarts zmq streaming if enabled.
|
||||||
|
"""
|
||||||
return self.getVetoStream()
|
return self.getVetoStream()
|
||||||
|
|
||||||
@vetostream.setter
|
@vetostream.setter
|
||||||
@ -2343,6 +2351,25 @@ class Detector(CppDetectorApi):
|
|||||||
args = (args,)
|
args = (args,)
|
||||||
ut.set_using_dict(self.setVetoStream, *args)
|
ut.set_using_dict(self.setVetoStream, *args)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def vetoalg(self):
|
||||||
|
"""[Gotthard2] Algorithm used for veto
|
||||||
|
Example
|
||||||
|
----------
|
||||||
|
>>> d.vetoalg = defs.DEFAULT_ALGORITHM, defs.I10GBE
|
||||||
|
"""
|
||||||
|
result = {}
|
||||||
|
interface = [ethernetInterface.I3GBE, ethernetInterface.I10GBE]
|
||||||
|
for eth in interface:
|
||||||
|
result[eth] = element_if_equal(self.getVetoAlgorithm(eth))
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
@vetoalg.setter
|
||||||
|
def vetoalg(self, args):
|
||||||
|
if not isinstance(args, tuple):
|
||||||
|
args = (args,)
|
||||||
|
ut.set_using_dict(self.setVetoAlgorithm, *args)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Mythen3 specific
|
Mythen3 specific
|
||||||
|
@ -1075,15 +1075,26 @@ void init_det(py::module &m) {
|
|||||||
Detector::setVeto,
|
Detector::setVeto,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
.def("getVetoStream",
|
.def("getVetoStream",
|
||||||
(Result<defs::EthernetInterface>(Detector::*)(sls::Positions)
|
(Result<defs::ethernetInterface>(Detector::*)(sls::Positions)
|
||||||
const) &
|
const) &
|
||||||
Detector::getVetoStream,
|
Detector::getVetoStream,
|
||||||
py::arg() = Positions{})
|
py::arg() = Positions{})
|
||||||
.def("setVetoStream",
|
.def("setVetoStream",
|
||||||
(void (Detector::*)(const defs::EthernetInterface,
|
(void (Detector::*)(const defs::ethernetInterface,
|
||||||
sls::Positions)) &
|
sls::Positions)) &
|
||||||
Detector::setVetoStream,
|
Detector::setVetoStream,
|
||||||
py::arg(), py::arg() = Positions{})
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("getVetoAlgorithm",
|
||||||
|
(Result<defs::vetoAlgorithm>(Detector::*)(
|
||||||
|
const defs::ethernetInterface, sls::Positions) const) &
|
||||||
|
Detector::getVetoAlgorithm,
|
||||||
|
py::arg(), py::arg() = Positions{})
|
||||||
|
.def("setVetoAlgorithm",
|
||||||
|
(void (Detector::*)(const defs::vetoAlgorithm,
|
||||||
|
const defs::ethernetInterface,
|
||||||
|
sls::Positions)) &
|
||||||
|
Detector::setVetoAlgorithm,
|
||||||
|
py::arg(), py::arg(), py::arg() = Positions{})
|
||||||
.def("getADCConfiguration",
|
.def("getADCConfiguration",
|
||||||
(Result<int>(Detector::*)(const int, const int, sls::Positions)
|
(Result<int>(Detector::*)(const int, const int, sls::Positions)
|
||||||
const) &
|
const) &
|
||||||
|
@ -278,19 +278,24 @@ void init_enums(py::module &m) {
|
|||||||
slsDetectorDefs::timingSourceType::TIMING_EXTERNAL)
|
slsDetectorDefs::timingSourceType::TIMING_EXTERNAL)
|
||||||
.export_values();
|
.export_values();
|
||||||
|
|
||||||
py::enum_<slsDetectorDefs::EthernetInterface>(Defs, "EthernetInterface",
|
py::enum_<slsDetectorDefs::ethernetInterface>(Defs, "ethernetInterface",
|
||||||
py::arithmetic())
|
py::arithmetic())
|
||||||
.value("NONE", slsDetectorDefs::EthernetInterface::NONE)
|
.value("NONE", slsDetectorDefs::ethernetInterface::NONE)
|
||||||
.value("I3GBE", slsDetectorDefs::EthernetInterface::I3GBE)
|
.value("I3GBE", slsDetectorDefs::ethernetInterface::I3GBE)
|
||||||
.value("I10GBE", slsDetectorDefs::EthernetInterface::I10GBE)
|
.value("I10GBE", slsDetectorDefs::ethernetInterface::I10GBE)
|
||||||
.value("ALL", slsDetectorDefs::EthernetInterface::ALL)
|
.value("ALL", slsDetectorDefs::ethernetInterface::ALL)
|
||||||
.export_values()
|
.export_values()
|
||||||
.def("__or__",
|
.def("__or__",
|
||||||
py::overload_cast<const slsDetectorDefs::EthernetInterface &,
|
py::overload_cast<const slsDetectorDefs::ethernetInterface &,
|
||||||
const slsDetectorDefs::EthernetInterface &>(
|
const slsDetectorDefs::ethernetInterface &>(
|
||||||
&operator|))
|
&operator|))
|
||||||
.def("__and__",
|
.def("__and__",
|
||||||
py::overload_cast<const slsDetectorDefs::EthernetInterface &,
|
py::overload_cast<const slsDetectorDefs::ethernetInterface &,
|
||||||
const slsDetectorDefs::EthernetInterface &>(
|
const slsDetectorDefs::ethernetInterface &>(
|
||||||
&operator&));
|
&operator&));
|
||||||
|
|
||||||
|
py::enum_<slsDetectorDefs::vetoAlgorithm>(Defs, "vetoAlgorithm")
|
||||||
|
.value("DEFAULT_ALGORITHM",
|
||||||
|
slsDetectorDefs::vetoAlgorithm::DEFAULT_ALGORITHM)
|
||||||
|
.export_values();
|
||||||
}
|
}
|
||||||
|
@ -90,8 +90,14 @@
|
|||||||
|
|
||||||
#define CONFIG_VETO_ENBL_OFST (0)
|
#define CONFIG_VETO_ENBL_OFST (0)
|
||||||
#define CONFIG_VETO_ENBL_MSK (0x00000001 << CONFIG_VETO_ENBL_OFST)
|
#define CONFIG_VETO_ENBL_MSK (0x00000001 << CONFIG_VETO_ENBL_OFST)
|
||||||
|
#define CONFIG_VETO_CH_3GB_ALG_OFST (8)
|
||||||
|
#define CONFIG_VETO_CH_3GB_ALG_MSK (0x00000007 << CONFIG_VETO_CH_3GB_ALG_OFST)
|
||||||
|
#define CONFIG_VETO_CH_3GB_ALG_DEFAULT_VAL ((0x0 << CONFIG_VETO_CH_3GB_ALG_OFST) & CONFIG_VETO_CH_3GB_ALG_MSK)
|
||||||
#define CONFIG_VETO_CH_3GB_ENBL_OFST (11)
|
#define CONFIG_VETO_CH_3GB_ENBL_OFST (11)
|
||||||
#define CONFIG_VETO_CH_3GB_ENBL_MSK (0x00000001 << CONFIG_VETO_CH_3GB_ENBL_OFST)
|
#define CONFIG_VETO_CH_3GB_ENBL_MSK (0x00000001 << CONFIG_VETO_CH_3GB_ENBL_OFST)
|
||||||
|
#define CONFIG_VETO_CH_10GB_ALG_OFST (12)
|
||||||
|
#define CONFIG_VETO_CH_10GB_ALG_MSK (0x00000007 << CONFIG_VETO_CH_10GB_ALG_OFST)
|
||||||
|
#define CONFIG_VETO_CH_10GB_ALG_DEFAULT_VAL ((0x0 << CONFIG_VETO_CH_10GB_ALG_OFST) & CONFIG_VETO_CH_10GB_ALG_MSK)
|
||||||
#define CONFIG_VETO_CH_10GB_ENBL_OFST (15)
|
#define CONFIG_VETO_CH_10GB_ENBL_OFST (15)
|
||||||
#define CONFIG_VETO_CH_10GB_ENBL_MSK (0x00000001 << CONFIG_VETO_CH_10GB_ENBL_OFST)
|
#define CONFIG_VETO_CH_10GB_ENBL_MSK (0x00000001 << CONFIG_VETO_CH_10GB_ENBL_OFST)
|
||||||
|
|
||||||
|
Binary file not shown.
@ -2595,6 +2595,36 @@ int getVetoStream() {
|
|||||||
return ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_3GB_ENBL_MSK) ? 1 : 0);
|
return ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_3GB_ENBL_MSK) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum vetoAlgorithm getVetoAlgorithm(enum ethernetInterface interface) {
|
||||||
|
// 3gbe
|
||||||
|
if (interface == I3GBE) {
|
||||||
|
int retval = ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_3GB_ALG_MSK) >>
|
||||||
|
CONFIG_VETO_CH_3GB_ALG_OFST);
|
||||||
|
switch (retval) {
|
||||||
|
// more to follow
|
||||||
|
case CONFIG_VETO_CH_3GB_ALG_DEFAULT_VAL:
|
||||||
|
return DEFAULT_ALGORITHM;
|
||||||
|
default:
|
||||||
|
LOG(logERROR, ("unknown algorithm %d for 3gbe\n", retval));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 10gbe
|
||||||
|
int retval = ((bus_r(CONFIG_REG) & CONFIG_VETO_CH_10GB_ALG_MSK) >>
|
||||||
|
CONFIG_VETO_CH_10GB_ALG_OFST);
|
||||||
|
switch (retval) {
|
||||||
|
// more to follow
|
||||||
|
case CONFIG_VETO_CH_10GB_ALG_DEFAULT_VAL:
|
||||||
|
return DEFAULT_ALGORITHM;
|
||||||
|
default:
|
||||||
|
LOG(logERROR, ("unknown algorithm %d for 3gbe\n", retval));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setVetoAlgorithm(enum ethernetInterface interface,
|
||||||
|
enum vetoAlgorithm alg) {}
|
||||||
|
|
||||||
void setBadChannels(int nch, int *channels) {
|
void setBadChannels(int nch, int *channels) {
|
||||||
LOG(logINFO, ("Setting %d bad channels\n", nch));
|
LOG(logINFO, ("Setting %d bad channels\n", nch));
|
||||||
|
|
||||||
|
@ -542,6 +542,8 @@ void setVeto(int enable);
|
|||||||
int getVeto();
|
int getVeto();
|
||||||
void setVetoStream(int value);
|
void setVetoStream(int value);
|
||||||
int getVetoStream();
|
int getVetoStream();
|
||||||
|
enum vetoAlgorithm getVetoAlgorithm(enum ethernetInterface interface);
|
||||||
|
void setVetoAlgorithm(enum ethernetInterface interface, enum vetoAlgorithm alg);
|
||||||
void setBadChannels(int nch, int *channels);
|
void setBadChannels(int nch, int *channels);
|
||||||
int *getBadChannels(int *nch);
|
int *getBadChannels(int *nch);
|
||||||
#endif
|
#endif
|
||||||
|
@ -248,4 +248,6 @@ int load_default_pattern(int);
|
|||||||
int get_all_threshold_energy(int);
|
int get_all_threshold_energy(int);
|
||||||
int get_master(int);
|
int get_master(int);
|
||||||
int get_veto_stream(int);
|
int get_veto_stream(int);
|
||||||
int set_veto_stream(int);
|
int set_veto_stream(int);
|
||||||
|
int get_veto_algorithm(int);
|
||||||
|
int set_veto_algorithm(int);
|
@ -371,6 +371,8 @@ void function_table() {
|
|||||||
flist[F_GET_MASTER] = &get_master;
|
flist[F_GET_MASTER] = &get_master;
|
||||||
flist[F_GET_VETO_STREAM] = &get_veto_stream;
|
flist[F_GET_VETO_STREAM] = &get_veto_stream;
|
||||||
flist[F_SET_VETO_STREAM] = &set_veto_stream;
|
flist[F_SET_VETO_STREAM] = &set_veto_stream;
|
||||||
|
flist[F_GET_VETO_ALGORITHM] = &get_veto_algorithm;
|
||||||
|
flist[F_SET_VETO_ALGORITHM] = &set_veto_algorithm;
|
||||||
|
|
||||||
// check
|
// check
|
||||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||||
@ -8412,7 +8414,7 @@ int get_master(int file_des){
|
|||||||
int get_veto_stream(int file_des) {
|
int get_veto_stream(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
enum EthernetInterface retval = NONE;
|
enum ethernetInterface retval = NONE;
|
||||||
|
|
||||||
LOG(logDEBUG1, ("Getting veto stream\n"));
|
LOG(logDEBUG1, ("Getting veto stream\n"));
|
||||||
|
|
||||||
@ -8429,7 +8431,7 @@ int get_veto_stream(int file_des) {
|
|||||||
int set_veto_stream(int file_des) {
|
int set_veto_stream(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
enum EthernetInterface arg = 0;
|
enum ethernetInterface arg = 0;
|
||||||
|
|
||||||
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
@ -8456,4 +8458,71 @@ int set_veto_stream(int file_des) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int get_veto_algorithm(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
enum ethernetInterface arg = NONE;
|
||||||
|
enum vetoAlgorithm retval = DEFAULT_ALGORITHM;
|
||||||
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
|
||||||
|
LOG(logDEBUG1, ("Getting veto algorithm for interface %d\n", arg));
|
||||||
|
|
||||||
|
#ifndef GOTTHARD2D
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// get only
|
||||||
|
if (arg != I3GBE && arg != I10GBE) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess, "Could not get vetoalgorithm. Invalid interface %d.\n",
|
||||||
|
arg);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else {
|
||||||
|
retval = getVetoAlgorithm(arg);
|
||||||
|
LOG(logDEBUG1, ("vetoalgorithm retval: %u\n", retval));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||||
|
}
|
||||||
|
|
||||||
|
int set_veto_algorithm(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
int args[2] = {-1, -1};
|
||||||
|
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
|
||||||
|
enum vetoAlgorithm alg = args[0];
|
||||||
|
enum ethernetInterface interface = args[1];
|
||||||
|
LOG(logINFO, ("Setting vetoalgorithm (interface: %d): %u\n", (int)interface,
|
||||||
|
(int)alg));
|
||||||
|
|
||||||
|
#ifndef GOTTHARD2D
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// only set
|
||||||
|
if (Server_VerifyLock() == OK) {
|
||||||
|
if (interface != I3GBE && interface != I10GBE) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not set vetoalgorithm. Invalid interface %d.\n",
|
||||||
|
interface);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else if (alg != DEFAULT_ALGORITHM) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess,
|
||||||
|
"Could not set vetoalgorithm. Invalid algorithm %d.\n",
|
||||||
|
alg);
|
||||||
|
LOG(logERROR, (mess));
|
||||||
|
} else {
|
||||||
|
setVetoAlgorithm(alg, interface);
|
||||||
|
int retval = getVetoAlgorithm(interface);
|
||||||
|
LOG(logDEBUG1, ("vetoalgorithm retval: %u\n", retval));
|
||||||
|
validate(alg, retval, "set veto algorithm", DEC);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||||
}
|
}
|
@ -1248,7 +1248,7 @@ class Detector {
|
|||||||
void setVeto(const bool enable, Positions pos = {});
|
void setVeto(const bool enable, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Gotthard2] */
|
||||||
Result<defs::EthernetInterface> getVetoStream(Positions pos = {}) const;
|
Result<defs::ethernetInterface> getVetoStream(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Gotthard2] Options: NONE (Default), I3GBE, I10GBE (debugging), ALL
|
/** [Gotthard2] Options: NONE (Default), I3GBE, I10GBE (debugging), ALL
|
||||||
* Enable or disable the 2 veto streaming interfaces available. Can
|
* Enable or disable the 2 veto streaming interfaces available. Can
|
||||||
@ -1257,7 +1257,18 @@ class Detector {
|
|||||||
* interface in receiver for listening to veto packets (writes a separate
|
* interface in receiver for listening to veto packets (writes a separate
|
||||||
* file if writing enabled). Also restarts client and receiver zmq sockets
|
* file if writing enabled). Also restarts client and receiver zmq sockets
|
||||||
* if zmq streaming enabled.*/
|
* if zmq streaming enabled.*/
|
||||||
void setVetoStream(const defs::EthernetInterface value, Positions pos = {});
|
void setVetoStream(const defs::ethernetInterface value, Positions pos = {});
|
||||||
|
|
||||||
|
/** [Gotthard2] */
|
||||||
|
Result<defs::vetoAlgorithm>
|
||||||
|
getVetoAlgorithm(const defs::ethernetInterface value,
|
||||||
|
Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [Gotthard2] Options(vetoAlgorithm): DEFAULT_ALGORITHM.
|
||||||
|
* Options(ethernetInterface): I3GBE, I10GBE */
|
||||||
|
void setVetoAlgorithm(const defs::vetoAlgorithm alg,
|
||||||
|
const defs::ethernetInterface value,
|
||||||
|
Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Gotthard2] */
|
||||||
Result<int> getADCConfiguration(const int chipIndex, const int adcIndex,
|
Result<int> getADCConfiguration(const int chipIndex, const int adcIndex,
|
||||||
|
@ -1825,18 +1825,18 @@ std::string CmdProxy::VetoStreaming(int action) {
|
|||||||
if (args.empty()) {
|
if (args.empty()) {
|
||||||
WrongNumberOfParameters(1);
|
WrongNumberOfParameters(1);
|
||||||
}
|
}
|
||||||
defs::EthernetInterface interface = defs::EthernetInterface::NONE;
|
defs::ethernetInterface interface = defs::ethernetInterface::NONE;
|
||||||
for (const auto &arg : args) {
|
for (const auto &arg : args) {
|
||||||
if (arg == "none") {
|
if (arg == "none") {
|
||||||
if (args.size() > 1) {
|
if (args.size() > 1) {
|
||||||
throw sls::RuntimeError(
|
throw sls::RuntimeError(
|
||||||
"cannot have other arguments with 'none'. args: " +
|
std::string(
|
||||||
|
"cannot have other arguments with 'none'. args: ") +
|
||||||
ToString(args));
|
ToString(args));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
StringTo<defs::EthernetInterface>(arg);
|
interface = interface | (StringTo<defs::ethernetInterface>(arg));
|
||||||
interface = interface | (StringTo<defs::EthernetInterface>(arg));
|
|
||||||
}
|
}
|
||||||
det->setVetoStream(interface, std::vector<int>{det_id});
|
det->setVetoStream(interface, std::vector<int>{det_id});
|
||||||
os << ToString(interface) << '\n';
|
os << ToString(interface) << '\n';
|
||||||
@ -1846,6 +1846,44 @@ std::string CmdProxy::VetoStreaming(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string CmdProxy::VetoAlgorithm(int action) {
|
||||||
|
std::ostringstream os;
|
||||||
|
os << cmd << ' ';
|
||||||
|
if (action == defs::HELP_ACTION) {
|
||||||
|
os << "[default] [3gbe|10gbe]\n\t[Gotthard2] Set the veto "
|
||||||
|
"algorithm."
|
||||||
|
<< '\n';
|
||||||
|
} else if (action == defs::GET_ACTION) {
|
||||||
|
if (args.size() != 1) {
|
||||||
|
WrongNumberOfParameters(1);
|
||||||
|
}
|
||||||
|
defs::ethernetInterface interface =
|
||||||
|
StringTo<defs::ethernetInterface>(args[0]);
|
||||||
|
if (interface == defs::ethernetInterface::NONE) {
|
||||||
|
throw sls::RuntimeError(
|
||||||
|
"Must specify an interface to set algorithm");
|
||||||
|
}
|
||||||
|
auto t = det->getVetoAlgorithm(interface, std::vector<int>{det_id});
|
||||||
|
os << OutString(t) << ' ' << ToString(interface) << '\n';
|
||||||
|
} else if (action == defs::PUT_ACTION) {
|
||||||
|
if (args.size() != 2) {
|
||||||
|
WrongNumberOfParameters(2);
|
||||||
|
}
|
||||||
|
defs::vetoAlgorithm alg = StringTo<defs::vetoAlgorithm>(args[0]);
|
||||||
|
defs::ethernetInterface interface =
|
||||||
|
StringTo<defs::ethernetInterface>(args[1]);
|
||||||
|
if (interface == defs::ethernetInterface::NONE) {
|
||||||
|
throw sls::RuntimeError(
|
||||||
|
"Must specify an interface to set algorithm");
|
||||||
|
}
|
||||||
|
det->setVetoAlgorithm(alg, interface, std::vector<int>{det_id});
|
||||||
|
os << ToString(alg) << ' ' << ToString(interface) << '\n';
|
||||||
|
} else {
|
||||||
|
throw sls::RuntimeError("Unknown action");
|
||||||
|
}
|
||||||
|
return os.str();
|
||||||
|
}
|
||||||
|
|
||||||
std::string CmdProxy::ConfigureADC(int action) {
|
std::string CmdProxy::ConfigureADC(int action) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
|
@ -958,6 +958,7 @@ class CmdProxy {
|
|||||||
{"timingsource", &CmdProxy::timingsource},
|
{"timingsource", &CmdProxy::timingsource},
|
||||||
{"veto", &CmdProxy::veto},
|
{"veto", &CmdProxy::veto},
|
||||||
{"vetostream", &CmdProxy::VetoStreaming},
|
{"vetostream", &CmdProxy::VetoStreaming},
|
||||||
|
{"vetoalg", &CmdProxy::VetoAlgorithm},
|
||||||
{"confadc", &CmdProxy::ConfigureADC},
|
{"confadc", &CmdProxy::ConfigureADC},
|
||||||
{"badchannels", &CmdProxy::BadChannels},
|
{"badchannels", &CmdProxy::BadChannels},
|
||||||
|
|
||||||
@ -1134,6 +1135,7 @@ class CmdProxy {
|
|||||||
std::string VetoFile(int action);
|
std::string VetoFile(int action);
|
||||||
std::string BurstMode(int action);
|
std::string BurstMode(int action);
|
||||||
std::string VetoStreaming(int action);
|
std::string VetoStreaming(int action);
|
||||||
|
std::string VetoAlgorithm(int action);
|
||||||
std::string ConfigureADC(int action);
|
std::string ConfigureADC(int action);
|
||||||
std::string BadChannels(int action);
|
std::string BadChannels(int action);
|
||||||
/* Mythen3 Specific */
|
/* Mythen3 Specific */
|
||||||
|
@ -1565,36 +1565,52 @@ void Detector::setVeto(bool enable, Positions pos) {
|
|||||||
pimpl->Parallel(&Module::setVeto, pos, enable);
|
pimpl->Parallel(&Module::setVeto, pos, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<defs::EthernetInterface> Detector::getVetoStream(Positions pos) const {
|
Result<defs::ethernetInterface> Detector::getVetoStream(Positions pos) const {
|
||||||
// 3gbe
|
// 3gbe
|
||||||
auto r3 = pimpl->Parallel(&Module::getVetoStream, pos);
|
auto r3 = pimpl->Parallel(&Module::getVetoStream, pos);
|
||||||
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
||||||
auto r10 = getNumberofUDPInterfaces_(pos);
|
auto r10 = getNumberofUDPInterfaces_(pos);
|
||||||
|
|
||||||
Result<defs::EthernetInterface> res(r3.size());
|
Result<defs::ethernetInterface> res(r3.size());
|
||||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||||
res[i] = (r3[i] ? defs::EthernetInterface::I3GBE
|
res[i] = (r3[i] ? defs::ethernetInterface::I3GBE
|
||||||
: defs::EthernetInterface::NONE);
|
: defs::ethernetInterface::NONE);
|
||||||
if (r10[i] == 2) {
|
if (r10[i] == 2) {
|
||||||
res[i] = res[i] | defs::EthernetInterface::I10GBE;
|
res[i] = res[i] | defs::ethernetInterface::I10GBE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Detector::setVetoStream(defs::EthernetInterface interface, Positions pos) {
|
void Detector::setVetoStream(defs::ethernetInterface interface, Positions pos) {
|
||||||
// 3gbe
|
// 3gbe
|
||||||
bool i3gbe = (interface & defs::EthernetInterface::I3GBE) == defs::EthernetInterface::I3GBE;
|
bool i3gbe = (interface & defs::ethernetInterface::I3GBE) ==
|
||||||
|
defs::ethernetInterface::I3GBE;
|
||||||
pimpl->Parallel(&Module::setVetoStream, pos, i3gbe);
|
pimpl->Parallel(&Module::setVetoStream, pos, i3gbe);
|
||||||
|
|
||||||
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
||||||
int old_numinterfaces = getNumberofUDPInterfaces_(pos).tsquash(
|
int old_numinterfaces = getNumberofUDPInterfaces_(pos).tsquash(
|
||||||
"retrieved inconsistent number of udp interfaces");
|
"retrieved inconsistent number of udp interfaces");
|
||||||
int numinterfaces = ((interface & defs::EthernetInterface::I10GBE) == defs::EthernetInterface::I3GBE) ? 2 : 1;
|
int numinterfaces = ((interface & defs::ethernetInterface::I10GBE) ==
|
||||||
|
defs::ethernetInterface::I3GBE)
|
||||||
|
? 2
|
||||||
|
: 1;
|
||||||
if (numinterfaces != old_numinterfaces) {
|
if (numinterfaces != old_numinterfaces) {
|
||||||
setNumberofUDPInterfaces_(numinterfaces, pos);
|
setNumberofUDPInterfaces_(numinterfaces, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result<defs::vetoAlgorithm>
|
||||||
|
Detector::getVetoAlgorithm(const defs::ethernetInterface interface,
|
||||||
|
Positions pos) const {
|
||||||
|
return pimpl->Parallel(&Module::getVetoAlgorithm, pos, interface);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setVetoAlgorithm(const defs::vetoAlgorithm alg,
|
||||||
|
defs::ethernetInterface interface,
|
||||||
|
Positions pos) {
|
||||||
|
pimpl->Parallel(&Module::setVetoAlgorithm, pos, alg, interface);
|
||||||
|
}
|
||||||
|
|
||||||
Result<int> Detector::getADCConfiguration(const int chipIndex,
|
Result<int> Detector::getADCConfiguration(const int chipIndex,
|
||||||
const int adcIndex,
|
const int adcIndex,
|
||||||
|
@ -1878,6 +1878,19 @@ void Module::setVetoStream(const bool value) {
|
|||||||
sendToDetector(F_SET_VETO_STREAM, static_cast<int>(value), nullptr);
|
sendToDetector(F_SET_VETO_STREAM, static_cast<int>(value), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slsDetectorDefs::vetoAlgorithm Module::getVetoAlgorithm(
|
||||||
|
const slsDetectorDefs::ethernetInterface interface) const {
|
||||||
|
return sendToDetector<vetoAlgorithm>(F_GET_VETO_ALGORITHM,
|
||||||
|
static_cast<int>(interface));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Module::setVetoAlgorithm(
|
||||||
|
const slsDetectorDefs::vetoAlgorithm alg,
|
||||||
|
const slsDetectorDefs::ethernetInterface interface) {
|
||||||
|
int args[]{static_cast<int>(alg), static_cast<int>(interface)};
|
||||||
|
sendToDetector(F_SET_VETO_ALGORITHM, args, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
int Module::getADCConfiguration(const int chipIndex, const int adcIndex) const {
|
int Module::getADCConfiguration(const int chipIndex, const int adcIndex) const {
|
||||||
int args[]{chipIndex, adcIndex};
|
int args[]{chipIndex, adcIndex};
|
||||||
return sendToDetector<int>(F_GET_ADC_CONFIGURATION, args);
|
return sendToDetector<int>(F_GET_ADC_CONFIGURATION, args);
|
||||||
|
@ -408,6 +408,10 @@ class Module : public virtual slsDetectorDefs {
|
|||||||
void setVeto(bool enable);
|
void setVeto(bool enable);
|
||||||
bool getVetoStream() const;
|
bool getVetoStream() const;
|
||||||
void setVetoStream(const bool value);
|
void setVetoStream(const bool value);
|
||||||
|
slsDetectorDefs::vetoAlgorithm
|
||||||
|
getVetoAlgorithm(const slsDetectorDefs::ethernetInterface interface) const;
|
||||||
|
void setVetoAlgorithm(const slsDetectorDefs::vetoAlgorithm alg,
|
||||||
|
const slsDetectorDefs::ethernetInterface interface);
|
||||||
int getADCConfiguration(const int chipIndex, const int adcIndex) const;
|
int getADCConfiguration(const int chipIndex, const int adcIndex) const;
|
||||||
void setADCConfiguration(const int chipIndex, const int adcIndex,
|
void setADCConfiguration(const int chipIndex, const int adcIndex,
|
||||||
int value);
|
int value);
|
||||||
|
@ -686,6 +686,50 @@ TEST_CASE("vetostream", "[.cmd]") {
|
|||||||
REQUIRE_THROWS(proxy.Call("vetostream", {"dfgd"}, -1, GET));
|
REQUIRE_THROWS(proxy.Call("vetostream", {"dfgd"}, -1, GET));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("vetoalg", "[.cmd]") {
|
||||||
|
Detector det;
|
||||||
|
CmdProxy proxy(&det);
|
||||||
|
auto det_type = det.getDetectorType().squash();
|
||||||
|
if (det_type == defs::GOTTHARD2) {
|
||||||
|
auto prev_val_3g = det.getVetoAlgorithm(defs::ethernetInterface::I3GBE);
|
||||||
|
auto prev_val_10g =
|
||||||
|
det.getVetoAlgorithm(defs::ethernetInterface::I10GBE);
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("vetoalg", {"default", "3gbe"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "vetoalg default 3gbe\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("vetoalg", {"3gbe"}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "vetoalg default 3gbe\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("vetoalg", {"default", "10gbe"}, -1, PUT, oss);
|
||||||
|
REQUIRE(oss.str() == "vetoalg default 10gbe\n");
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream oss;
|
||||||
|
proxy.Call("vetoalg", {"10gbe"}, -1, GET, oss);
|
||||||
|
REQUIRE(oss.str() == "vetoalg default 10gbe\n");
|
||||||
|
}
|
||||||
|
REQUIRE_THROWS(
|
||||||
|
proxy.Call("vetoalg", {"default", "3gbe", "10gbe"}, -1, PUT));
|
||||||
|
REQUIRE_THROWS(proxy.Call("vetoalg", {"default", "none"}, -1, PUT));
|
||||||
|
for (int i = 0; i != det.size(); ++i) {
|
||||||
|
det.setVetoAlgorithm(prev_val_3g[i], defs::ethernetInterface::I3GBE,
|
||||||
|
{i});
|
||||||
|
det.setVetoAlgorithm(prev_val_10g[i],
|
||||||
|
defs::ethernetInterface::I10GBE, {i});
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
REQUIRE_THROWS(proxy.Call("vetoalg", {"3gbe"}, -1, GET));
|
||||||
|
REQUIRE_THROWS(proxy.Call("vetoalg", {"none"}, -1, PUT));
|
||||||
|
}
|
||||||
|
REQUIRE_THROWS(proxy.Call("vetoalg", {"dfgd"}, -1, GET));
|
||||||
|
}
|
||||||
|
|
||||||
TEST_CASE("confadc", "[.cmd]") {
|
TEST_CASE("confadc", "[.cmd]") {
|
||||||
Detector det;
|
Detector det;
|
||||||
CmdProxy proxy(&det);
|
CmdProxy proxy(&det);
|
||||||
|
@ -36,7 +36,8 @@ std::string ToString(const defs::dacIndex s);
|
|||||||
std::string ToString(const std::vector<defs::dacIndex> &vec);
|
std::string ToString(const std::vector<defs::dacIndex> &vec);
|
||||||
std::string ToString(const defs::burstMode s);
|
std::string ToString(const defs::burstMode s);
|
||||||
std::string ToString(const defs::timingSourceType s);
|
std::string ToString(const defs::timingSourceType s);
|
||||||
std::string ToString(const defs::EthernetInterface s);
|
std::string ToString(const defs::ethernetInterface s);
|
||||||
|
std::string ToString(const defs::vetoAlgorithm s);
|
||||||
|
|
||||||
std::string ToString(const slsDetectorDefs::xy &coord);
|
std::string ToString(const slsDetectorDefs::xy &coord);
|
||||||
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::xy &coord);
|
std::ostream &operator<<(std::ostream &os, const slsDetectorDefs::xy &coord);
|
||||||
@ -298,7 +299,8 @@ template <> defs::readoutMode StringTo(const std::string &s);
|
|||||||
template <> defs::dacIndex StringTo(const std::string &s);
|
template <> defs::dacIndex StringTo(const std::string &s);
|
||||||
template <> defs::burstMode StringTo(const std::string &s);
|
template <> defs::burstMode StringTo(const std::string &s);
|
||||||
template <> defs::timingSourceType StringTo(const std::string &s);
|
template <> defs::timingSourceType StringTo(const std::string &s);
|
||||||
template <> defs::EthernetInterface StringTo(const std::string &s);
|
template <> defs::ethernetInterface StringTo(const std::string &s);
|
||||||
|
template <> defs::vetoAlgorithm StringTo(const std::string &s);
|
||||||
|
|
||||||
template <> uint32_t StringTo(const std::string &s);
|
template <> uint32_t StringTo(const std::string &s);
|
||||||
template <> uint64_t StringTo(const std::string &s);
|
template <> uint64_t StringTo(const std::string &s);
|
||||||
|
@ -395,16 +395,18 @@ typedef struct {
|
|||||||
enum timingSourceType { TIMING_INTERNAL, TIMING_EXTERNAL };
|
enum timingSourceType { TIMING_INTERNAL, TIMING_EXTERNAL };
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
enum class EthernetInterface {
|
enum class ethernetInterface {
|
||||||
#else
|
#else
|
||||||
enum EthernetInterface {
|
enum ethernetInterface {
|
||||||
#endif
|
#endif
|
||||||
NONE = 0,
|
NONE = 0,
|
||||||
I3GBE = 1 << 1,
|
I3GBE = 1 << 0,
|
||||||
I10GBE = 1 << 2,
|
I10GBE = 1 << 1,
|
||||||
ALL = I3GBE | I10GBE
|
ALL = I3GBE | I10GBE
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum vetoAlgorithm { DEFAULT_ALGORITHM };
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
||||||
/** scan structure */
|
/** scan structure */
|
||||||
@ -496,16 +498,18 @@ typedef struct {
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
inline slsDetectorDefs::EthernetInterface
|
inline slsDetectorDefs::ethernetInterface
|
||||||
operator|( const slsDetectorDefs::EthernetInterface &a,
|
operator|(const slsDetectorDefs::ethernetInterface &a,
|
||||||
const slsDetectorDefs::EthernetInterface &b) {
|
const slsDetectorDefs::ethernetInterface &b) {
|
||||||
return slsDetectorDefs::EthernetInterface(static_cast<int32_t>(a) |
|
return slsDetectorDefs::ethernetInterface(static_cast<int32_t>(a) |
|
||||||
static_cast<int32_t>(b));
|
static_cast<int32_t>(b));
|
||||||
};
|
};
|
||||||
|
|
||||||
inline slsDetectorDefs::EthernetInterface operator&( const slsDetectorDefs::EthernetInterface &a,
|
inline slsDetectorDefs::ethernetInterface
|
||||||
const slsDetectorDefs::EthernetInterface &b) {
|
operator&(const slsDetectorDefs::ethernetInterface &a,
|
||||||
return slsDetectorDefs::EthernetInterface(static_cast<int32_t>(a) & static_cast<int32_t>(b));
|
const slsDetectorDefs::ethernetInterface &b) {
|
||||||
|
return slsDetectorDefs::ethernetInterface(static_cast<int32_t>(a) &
|
||||||
|
static_cast<int32_t>(b));
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -583,7 +587,7 @@ struct detParameters {
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
struct sls_detector_module {
|
struct sls_detector_module {
|
||||||
#else
|
#else
|
||||||
typedef struct {
|
typedef struct {
|
||||||
#endif
|
#endif
|
||||||
int serialnumber; /**< is the module serial number */
|
int serialnumber; /**< is the module serial number */
|
||||||
int nchan; /**< is the number of channels on the module*/
|
int nchan; /**< is the number of channels on the module*/
|
||||||
|
@ -223,6 +223,8 @@ enum detFuncs {
|
|||||||
F_GET_MASTER,
|
F_GET_MASTER,
|
||||||
F_GET_VETO_STREAM,
|
F_GET_VETO_STREAM,
|
||||||
F_SET_VETO_STREAM,
|
F_SET_VETO_STREAM,
|
||||||
|
F_GET_VETO_ALGORITHM,
|
||||||
|
F_SET_VETO_ALGORITHM,
|
||||||
|
|
||||||
NUM_DET_FUNCTIONS,
|
NUM_DET_FUNCTIONS,
|
||||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
|
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this
|
||||||
@ -552,7 +554,8 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_GET_MASTER: return "F_GET_MASTER";
|
case F_GET_MASTER: return "F_GET_MASTER";
|
||||||
case F_GET_VETO_STREAM: return "F_GET_VETO_STREAM";
|
case F_GET_VETO_STREAM: return "F_GET_VETO_STREAM";
|
||||||
case F_SET_VETO_STREAM: return "F_SET_VETO_STREAM";
|
case F_SET_VETO_STREAM: return "F_SET_VETO_STREAM";
|
||||||
|
case F_GET_VETO_ALGORITHM: return "F_GET_VETO_ALGORITHM";
|
||||||
|
case F_SET_VETO_ALGORITHM: return "F_SET_VETO_ALGORITHM";
|
||||||
|
|
||||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||||
|
@ -9,4 +9,4 @@
|
|||||||
#define APILIB 0x210225
|
#define APILIB 0x210225
|
||||||
#define APIRECEIVER 0x210225
|
#define APIRECEIVER 0x210225
|
||||||
#define APIGUI 0x210225
|
#define APIGUI 0x210225
|
||||||
#define APIGOTTHARD2 0x210715
|
#define APIGOTTHARD2 0x210721
|
||||||
|
@ -519,16 +519,18 @@ std::string ToString(const defs::timingSourceType s) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ToString(const defs::EthernetInterface s) {
|
std::string ToString(const defs::ethernetInterface s) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
std::string rs;
|
std::string rs;
|
||||||
switch (s) {
|
switch (s) {
|
||||||
case defs::EthernetInterface::NONE:
|
case defs::ethernetInterface::NONE:
|
||||||
return std::string("none");
|
return std::string("none");
|
||||||
default:
|
default:
|
||||||
if ((s & defs::EthernetInterface::I3GBE)!=defs::EthernetInterface::NONE)
|
if ((s & defs::ethernetInterface::I3GBE) !=
|
||||||
|
defs::ethernetInterface::NONE)
|
||||||
os << "3gbe, ";
|
os << "3gbe, ";
|
||||||
if ((s & defs::EthernetInterface::I10GBE)!=defs::EthernetInterface::NONE)
|
if ((s & defs::ethernetInterface::I10GBE) !=
|
||||||
|
defs::ethernetInterface::NONE)
|
||||||
os << "10gbe, ";
|
os << "10gbe, ";
|
||||||
auto rs = os.str();
|
auto rs = os.str();
|
||||||
rs.erase(rs.end() - 2, rs.end());
|
rs.erase(rs.end() - 2, rs.end());
|
||||||
@ -536,6 +538,15 @@ std::string ToString(const defs::EthernetInterface s) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string ToString(const defs::vetoAlgorithm s) {
|
||||||
|
switch (s) {
|
||||||
|
case defs::DEFAULT_ALGORITHM:
|
||||||
|
return std::string("default");
|
||||||
|
default:
|
||||||
|
return std::string("Unknown");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const std::string &ToString(const std::string &s) { return s; }
|
const std::string &ToString(const std::string &s) { return s; }
|
||||||
|
|
||||||
template <> defs::detectorType StringTo(const std::string &s) {
|
template <> defs::detectorType StringTo(const std::string &s) {
|
||||||
@ -876,17 +887,23 @@ template <> defs::timingSourceType StringTo(const std::string &s) {
|
|||||||
throw sls::RuntimeError("Unknown timing source type " + s);
|
throw sls::RuntimeError("Unknown timing source type " + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <> defs::EthernetInterface StringTo(const std::string &s) {
|
template <> defs::ethernetInterface StringTo(const std::string &s) {
|
||||||
std::string rs = s;
|
std::string rs = s;
|
||||||
if (s.find(',') != std::string::npos)
|
if (s.find(',') != std::string::npos)
|
||||||
rs.erase(rs.find(','));
|
rs.erase(rs.find(','));
|
||||||
if (rs == "none")
|
if (rs == "none")
|
||||||
return defs::EthernetInterface::NONE;
|
return defs::ethernetInterface::NONE;
|
||||||
if (rs == "3gbe")
|
if (rs == "3gbe")
|
||||||
return defs::EthernetInterface::I3GBE;
|
return defs::ethernetInterface::I3GBE;
|
||||||
if (rs == "10gbe")
|
if (rs == "10gbe")
|
||||||
return defs::EthernetInterface::I10GBE;
|
return defs::ethernetInterface::I10GBE;
|
||||||
throw sls::RuntimeError("Unknown EthernetInterface type " + s);
|
throw sls::RuntimeError("Unknown ethernetInterface type " + s);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <> defs::vetoAlgorithm StringTo(const std::string &s) {
|
||||||
|
if (s == "default")
|
||||||
|
return defs::DEFAULT_ALGORITHM;
|
||||||
|
throw sls::RuntimeError("Unknown veto algorithm " + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <> uint32_t StringTo(const std::string &s) {
|
template <> uint32_t StringTo(const std::string &s) {
|
||||||
|
@ -324,10 +324,10 @@ TEST_CASE("Print a member of patternParameters") {
|
|||||||
REQUIRE(ToString(pat->limits) == "[4, 100]");
|
REQUIRE(ToString(pat->limits) == "[4, 100]");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("EthernetInterface") {
|
TEST_CASE("ethernetInterface") {
|
||||||
REQUIRE(ToString(sls::defs::EthernetInterface::NONE) == "none");
|
REQUIRE(ToString(sls::defs::ethernetInterface::NONE) == "none");
|
||||||
REQUIRE(ToString(sls::defs::EthernetInterface::I10GBE) == "10gbe");
|
REQUIRE(ToString(sls::defs::ethernetInterface::I10GBE) == "10gbe");
|
||||||
REQUIRE(ToString(sls::defs::EthernetInterface::I3GBE) == "3gbe");
|
REQUIRE(ToString(sls::defs::ethernetInterface::I3GBE) == "3gbe");
|
||||||
REQUIRE(ToString(sls::defs::EthernetInterface::I3GBE |
|
REQUIRE(ToString(sls::defs::ethernetInterface::I3GBE |
|
||||||
sls::defs::EthernetInterface::I10GBE) == "3gbe, 10gbe");
|
sls::defs::ethernetInterface::I10GBE) == "3gbe, 10gbe");
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user