vetoalg added hits and raw

This commit is contained in:
2021-08-11 16:08:32 +02:00
parent 0dbb6ff512
commit 7a76064223
13 changed files with 120 additions and 77 deletions

View File

@ -1337,7 +1337,7 @@ class Detector {
getVetoAlgorithm(const defs::streamingInterface value,
Positions pos = {}) const;
/** [Gotthard2] Options(vetoAlgorithm): DEFAULT_ALGORITHM.
/** [Gotthard2] Options(vetoAlgorithm): ALG_HITS, ALG_RAW.
* Options(streamingInterface): LOW_LATENCY_LINK, ETHERNET_10GB */
void setVetoAlgorithm(const defs::vetoAlgorithm alg,
const defs::streamingInterface value,

View File

@ -2051,7 +2051,7 @@ std::string CmdProxy::VetoAlgorithm(int action) {
std::ostringstream os;
os << cmd << ' ';
if (action == defs::HELP_ACTION) {
os << "[default] [lll|10gbe]\n\t[Gotthard2] Set the veto "
os << "[hits|raw] [lll|10gbe]\n\t[Gotthard2] Set the veto "
"algorithm."
<< '\n';
} else if (action == defs::GET_ACTION) {

View File

@ -1688,6 +1688,8 @@ Detector::getVetoAlgorithm(const defs::streamingInterface interface,
void Detector::setVetoAlgorithm(const defs::vetoAlgorithm alg,
defs::streamingInterface interface,
Positions pos) {
LOG(logINFOBLUE) << "alg:" << ToString(alg)
<< " interface:" << ToString(interface);
pimpl->Parallel(&Module::setVetoAlgorithm, pos, alg, interface);
}

View File

@ -631,34 +631,46 @@ 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::streamingInterface::LOW_LATENCY_LINK);
auto prev_val_lll =
det.getVetoAlgorithm(defs::streamingInterface::LOW_LATENCY_LINK);
auto prev_val_10g =
det.getVetoAlgorithm(defs::streamingInterface::ETHERNET_10GB);
{
std::ostringstream oss;
proxy.Call("vetoalg", {"default", "lll"}, -1, PUT, oss);
REQUIRE(oss.str() == "vetoalg default lll\n");
proxy.Call("vetoalg", {"hits", "lll"}, -1, PUT, oss);
REQUIRE(oss.str() == "vetoalg hits lll\n");
}
{
std::ostringstream oss;
proxy.Call("vetoalg", {"lll"}, -1, GET, oss);
REQUIRE(oss.str() == "vetoalg default lll\n");
REQUIRE(oss.str() == "vetoalg hits lll\n");
}
{
std::ostringstream oss;
proxy.Call("vetoalg", {"default", "10gbe"}, -1, PUT, oss);
REQUIRE(oss.str() == "vetoalg default 10gbe\n");
proxy.Call("vetoalg", {"hits", "10gbe"}, -1, PUT, oss);
REQUIRE(oss.str() == "vetoalg hits 10gbe\n");
}
{
std::ostringstream oss;
proxy.Call("vetoalg", {"10gbe"}, -1, GET, oss);
REQUIRE(oss.str() == "vetoalg default 10gbe\n");
REQUIRE(oss.str() == "vetoalg hits 10gbe\n");
}
{
std::ostringstream oss;
proxy.Call("vetoalg", {"raw", "lll"}, -1, PUT, oss);
REQUIRE(oss.str() == "vetoalg raw lll\n");
}
{
std::ostringstream oss;
proxy.Call("vetoalg", {"raw", "10gbe"}, -1, PUT, oss);
REQUIRE(oss.str() == "vetoalg raw 10gbe\n");
}
REQUIRE_THROWS(
proxy.Call("vetoalg", {"default", "lll", "10gbe"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("vetoalg", {"default", "none"}, -1, PUT));
REQUIRE_THROWS(proxy.Call("vetoalg", {"hits", "none"}, -1, PUT));
for (int i = 0; i != det.size(); ++i) {
det.setVetoAlgorithm(prev_val_3g[i], defs::streamingInterface::LOW_LATENCY_LINK,
det.setVetoAlgorithm(prev_val_lll[i],
defs::streamingInterface::LOW_LATENCY_LINK,
{i});
det.setVetoAlgorithm(prev_val_10g[i],
defs::streamingInterface::ETHERNET_10GB, {i});