mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 21:07:13 +02:00
merge fix
This commit is contained in:
@ -1263,26 +1263,26 @@ class Detector {
|
||||
void setVeto(const bool enable, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<defs::ethernetInterface> getVetoStream(Positions pos = {}) const;
|
||||
Result<defs::streamingInterface> getVetoStream(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard2] Options: NONE (Default), I3GBE, I10GBE (debugging), ALL
|
||||
/** [Gotthard2] Options: NONE (Default), LOW_LATENCY_LINK, ETHERNET_10GB (debugging), ALL
|
||||
* Enable or disable the 2 veto streaming interfaces available. Can
|
||||
* concatenate more than one interface. \n3GbE (2.5GbE) is the default
|
||||
* interface to work with. \n10GbE is for debugging and also enables second
|
||||
* concatenate more than one interface. \nLOW_LATENCY_LINK is the default
|
||||
* interface to work with. \nETHERNET_10GB is for debugging and also enables second
|
||||
* interface in receiver for listening to veto packets (writes a separate
|
||||
* file if writing enabled). Also restarts client and receiver zmq sockets
|
||||
* if zmq streaming enabled.*/
|
||||
void setVetoStream(const defs::ethernetInterface value, Positions pos = {});
|
||||
void setVetoStream(const defs::streamingInterface value, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<defs::vetoAlgorithm>
|
||||
getVetoAlgorithm(const defs::ethernetInterface value,
|
||||
getVetoAlgorithm(const defs::streamingInterface value,
|
||||
Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard2] Options(vetoAlgorithm): DEFAULT_ALGORITHM.
|
||||
* Options(ethernetInterface): I3GBE, I10GBE */
|
||||
* Options(streamingInterface): LOW_LATENCY_LINK, ETHERNET_10GB */
|
||||
void setVetoAlgorithm(const defs::vetoAlgorithm alg,
|
||||
const defs::ethernetInterface value,
|
||||
const defs::streamingInterface value,
|
||||
Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
|
@ -1869,9 +1869,9 @@ std::string CmdProxy::VetoStreaming(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[none|3gbe|10gbe|...]\n\t[Gotthard2] Enable or disable the 2 "
|
||||
os << "[none|lll|10gbe|...]\n\t[Gotthard2] Enable or disable the 2 "
|
||||
"veto streaming interfaces available. Can include more than one "
|
||||
"interface. \n\tDefault: none. 3GbE (2.5GbE) is the default "
|
||||
"interface. \n\tDefault: none. lll (low latency link) is the default "
|
||||
"interface to work with. \n\t10GbE is for debugging and also "
|
||||
"enables second interface in receiver for listening to veto "
|
||||
"packets (writes a separate file if writing enabled). Also "
|
||||
@ -1888,7 +1888,7 @@ std::string CmdProxy::VetoStreaming(int action) {
|
||||
if (args.empty()) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
defs::ethernetInterface interface = defs::ethernetInterface::NONE;
|
||||
defs::streamingInterface interface = defs::streamingInterface::NONE;
|
||||
for (const auto &arg : args) {
|
||||
if (arg == "none") {
|
||||
if (args.size() > 1) {
|
||||
@ -1899,7 +1899,7 @@ std::string CmdProxy::VetoStreaming(int action) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
interface = interface | (StringTo<defs::ethernetInterface>(arg));
|
||||
interface = interface | (StringTo<defs::streamingInterface>(arg));
|
||||
}
|
||||
det->setVetoStream(interface, std::vector<int>{det_id});
|
||||
os << ToString(interface) << '\n';
|
||||
@ -1913,16 +1913,16 @@ 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 "
|
||||
os << "[default] [lll|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) {
|
||||
defs::streamingInterface interface =
|
||||
StringTo<defs::streamingInterface>(args[0]);
|
||||
if (interface == defs::streamingInterface::NONE) {
|
||||
throw sls::RuntimeError(
|
||||
"Must specify an interface to set algorithm");
|
||||
}
|
||||
@ -1933,9 +1933,9 @@ std::string CmdProxy::VetoAlgorithm(int action) {
|
||||
WrongNumberOfParameters(2);
|
||||
}
|
||||
defs::vetoAlgorithm alg = StringTo<defs::vetoAlgorithm>(args[0]);
|
||||
defs::ethernetInterface interface =
|
||||
StringTo<defs::ethernetInterface>(args[1]);
|
||||
if (interface == defs::ethernetInterface::NONE) {
|
||||
defs::streamingInterface interface =
|
||||
StringTo<defs::streamingInterface>(args[1]);
|
||||
if (interface == defs::streamingInterface::NONE) {
|
||||
throw sls::RuntimeError(
|
||||
"Must specify an interface to set algorithm");
|
||||
}
|
||||
|
@ -1578,49 +1578,49 @@ void Detector::setVeto(bool enable, Positions pos) {
|
||||
pimpl->Parallel(&Module::setVeto, pos, enable);
|
||||
}
|
||||
|
||||
Result<defs::ethernetInterface> Detector::getVetoStream(Positions pos) const {
|
||||
Result<defs::streamingInterface> Detector::getVetoStream(Positions pos) const {
|
||||
// 3gbe
|
||||
auto r3 = pimpl->Parallel(&Module::getVetoStream, pos);
|
||||
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
||||
auto r10 = getNumberofUDPInterfaces_(pos);
|
||||
|
||||
Result<defs::ethernetInterface> res(r3.size());
|
||||
Result<defs::streamingInterface> res(r3.size());
|
||||
for (unsigned int i = 0; i < res.size(); ++i) {
|
||||
res[i] = (r3[i] ? defs::ethernetInterface::I3GBE
|
||||
: defs::ethernetInterface::NONE);
|
||||
res[i] = (r3[i] ? defs::streamingInterface::LOW_LATENCY_LINK
|
||||
: defs::streamingInterface::NONE);
|
||||
if (r10[i] == 2) {
|
||||
res[i] = res[i] | defs::ethernetInterface::I10GBE;
|
||||
res[i] = res[i] | defs::streamingInterface::ETHERNET_10GB;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void Detector::setVetoStream(defs::ethernetInterface interface, Positions pos) {
|
||||
void Detector::setVetoStream(defs::streamingInterface interface, Positions pos) {
|
||||
// 3gbe
|
||||
bool i3gbe = ((interface & defs::ethernetInterface::I3GBE) ==
|
||||
defs::ethernetInterface::I3GBE);
|
||||
pimpl->Parallel(&Module::setVetoStream, pos, i3gbe);
|
||||
bool LOW_LATENCY_LINK = ((interface & defs::streamingInterface::LOW_LATENCY_LINK) ==
|
||||
defs::streamingInterface::LOW_LATENCY_LINK);
|
||||
pimpl->Parallel(&Module::setVetoStream, pos, LOW_LATENCY_LINK);
|
||||
|
||||
// 10gbe (debugging interface) opens 2nd udp interface in receiver
|
||||
int old_numinterfaces = getNumberofUDPInterfaces_(pos).tsquash(
|
||||
"retrieved inconsistent number of udp interfaces");
|
||||
int numinterfaces = (((interface & defs::ethernetInterface::I10GBE) ==
|
||||
defs::ethernetInterface::I10GBE)
|
||||
? 2
|
||||
: 1);
|
||||
int numinterfaces = (((interface & defs::streamingInterface::ETHERNET_10GB) ==
|
||||
defs::streamingInterface::ETHERNET_10GB)
|
||||
? 2
|
||||
: 1);
|
||||
if (numinterfaces != old_numinterfaces) {
|
||||
setNumberofUDPInterfaces_(numinterfaces, pos);
|
||||
}
|
||||
}
|
||||
|
||||
Result<defs::vetoAlgorithm>
|
||||
Detector::getVetoAlgorithm(const defs::ethernetInterface interface,
|
||||
Detector::getVetoAlgorithm(const defs::streamingInterface interface,
|
||||
Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getVetoAlgorithm, pos, interface);
|
||||
}
|
||||
|
||||
void Detector::setVetoAlgorithm(const defs::vetoAlgorithm alg,
|
||||
defs::ethernetInterface interface,
|
||||
defs::streamingInterface interface,
|
||||
Positions pos) {
|
||||
pimpl->Parallel(&Module::setVetoAlgorithm, pos, alg, interface);
|
||||
}
|
||||
|
@ -1896,14 +1896,14 @@ void Module::setVetoStream(const bool value) {
|
||||
}
|
||||
|
||||
slsDetectorDefs::vetoAlgorithm Module::getVetoAlgorithm(
|
||||
const slsDetectorDefs::ethernetInterface interface) const {
|
||||
const slsDetectorDefs::streamingInterface interface) const {
|
||||
return sendToDetector<vetoAlgorithm>(F_GET_VETO_ALGORITHM,
|
||||
static_cast<int>(interface));
|
||||
}
|
||||
|
||||
void Module::setVetoAlgorithm(
|
||||
const slsDetectorDefs::vetoAlgorithm alg,
|
||||
const slsDetectorDefs::ethernetInterface interface) {
|
||||
const slsDetectorDefs::streamingInterface interface) {
|
||||
int args[]{static_cast<int>(alg), static_cast<int>(interface)};
|
||||
sendToDetector(F_SET_VETO_ALGORITHM, args, nullptr);
|
||||
}
|
||||
|
@ -411,9 +411,9 @@ class Module : public virtual slsDetectorDefs {
|
||||
bool getVetoStream() const;
|
||||
void setVetoStream(const bool value);
|
||||
slsDetectorDefs::vetoAlgorithm
|
||||
getVetoAlgorithm(const slsDetectorDefs::ethernetInterface interface) const;
|
||||
getVetoAlgorithm(const slsDetectorDefs::streamingInterface interface) const;
|
||||
void setVetoAlgorithm(const slsDetectorDefs::vetoAlgorithm alg,
|
||||
const slsDetectorDefs::ethernetInterface interface);
|
||||
const slsDetectorDefs::streamingInterface interface);
|
||||
int getADCConfiguration(const int chipIndex, const int adcIndex) const;
|
||||
void setADCConfiguration(const int chipIndex, const int adcIndex,
|
||||
int value);
|
||||
|
@ -657,25 +657,25 @@ TEST_CASE("vetostream", "[.cmd]") {
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetostream", {"3gbe"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "vetostream 3gbe\n");
|
||||
proxy.Call("vetostream", {"lll"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "vetostream lll\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetostream", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "vetostream 3gbe\n");
|
||||
REQUIRE(oss.str() == "vetostream lll\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetostream", {"3gbe", "10gbe"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "vetostream 3gbe, 10gbe\n");
|
||||
proxy.Call("vetostream", {"lll", "10gbe"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "vetostream lll, 10gbe\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetostream", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "vetostream 3gbe, 10gbe\n");
|
||||
REQUIRE(oss.str() == "vetostream lll, 10gbe\n");
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("vetostream", {"3gbe", "none"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("vetostream", {"lll", "none"}, -1, PUT));
|
||||
for (int i = 0; i != det.size(); ++i) {
|
||||
det.setVetoStream(prev_val[i], {i});
|
||||
}
|
||||
@ -691,18 +691,18 @@ TEST_CASE("vetoalg", "[.cmd]") {
|
||||
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_3g = det.getVetoAlgorithm(defs::streamingInterface::LOW_LATENCY_LINK);
|
||||
auto prev_val_10g =
|
||||
det.getVetoAlgorithm(defs::ethernetInterface::I10GBE);
|
||||
det.getVetoAlgorithm(defs::streamingInterface::ETHERNET_10GB);
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetoalg", {"default", "3gbe"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "vetoalg default 3gbe\n");
|
||||
proxy.Call("vetoalg", {"default", "lll"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "vetoalg default lll\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetoalg", {"3gbe"}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "vetoalg default 3gbe\n");
|
||||
proxy.Call("vetoalg", {"lll"}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "vetoalg default lll\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
@ -715,16 +715,16 @@ TEST_CASE("vetoalg", "[.cmd]") {
|
||||
REQUIRE(oss.str() == "vetoalg default 10gbe\n");
|
||||
}
|
||||
REQUIRE_THROWS(
|
||||
proxy.Call("vetoalg", {"default", "3gbe", "10gbe"}, -1, PUT));
|
||||
proxy.Call("vetoalg", {"default", "lll", "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,
|
||||
det.setVetoAlgorithm(prev_val_3g[i], defs::streamingInterface::LOW_LATENCY_LINK,
|
||||
{i});
|
||||
det.setVetoAlgorithm(prev_val_10g[i],
|
||||
defs::ethernetInterface::I10GBE, {i});
|
||||
defs::streamingInterface::ETHERNET_10GB, {i});
|
||||
}
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vetoalg", {"3gbe"}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vetoalg", {"lll"}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vetoalg", {"none"}, -1, PUT));
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("vetoalg", {"dfgd"}, -1, GET));
|
||||
|
Reference in New Issue
Block a user