mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
wip
This commit is contained in:
@ -1244,9 +1244,21 @@ class Detector {
|
||||
/** [Gotthard2] */
|
||||
Result<bool> getVeto(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard2] Default disabled */
|
||||
/** [Gotthard2] Veto data in chip, Default disabled */
|
||||
void setVeto(const bool enable, Positions pos = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<defs::EthernetInterface> getVetoStream(Positions pos = {}) const;
|
||||
|
||||
/** [Gotthard2] Options: NONE (Default), I3GBE, I10GBE (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
|
||||
* 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 = {});
|
||||
|
||||
/** [Gotthard2] */
|
||||
Result<int> getADCConfiguration(const int chipIndex, const int adcIndex,
|
||||
Positions pos = {}) const;
|
||||
@ -1727,6 +1739,7 @@ class Detector {
|
||||
private:
|
||||
std::vector<int> getPortNumbers(int start_port);
|
||||
void updateRxRateCorrections();
|
||||
defs::EthernetInterface in_{defs::NONE};
|
||||
};
|
||||
|
||||
} // namespace sls
|
@ -1802,6 +1802,49 @@ std::string CmdProxy::BurstMode(int action) {
|
||||
return os.str();
|
||||
}
|
||||
|
||||
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 "
|
||||
"veto streaming interfaces available. Can include more than one "
|
||||
"interface. \n\tDefault: none. 3GbE (2.5GbE) 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 "
|
||||
"restarts client and receiver zmq sockets if zmq streaming "
|
||||
"enabled."
|
||||
<< '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
auto t = det->getVetoStream(std::vector<int>{det_id});
|
||||
os << OutString(t) << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
if (args.empty()) {
|
||||
WrongNumberOfParameters(1);
|
||||
}
|
||||
defs::EthernetInterface interface = defs::EthernetInterface::none;
|
||||
for (const auto &arg : args) {
|
||||
if (arg == "none") {
|
||||
if (args.size() > 1) {
|
||||
throw sls::RuntimeError(
|
||||
"cannot have other arguments with 'none'. args: " +
|
||||
arg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
interface = interface | (StringTo<defs::EthernetInterface>(arg));
|
||||
}
|
||||
det->setVetoStream(interface, std::vector<int>{det_id});
|
||||
os << ToString(args) << '\n';
|
||||
} else {
|
||||
throw sls::RuntimeError("Unknown action");
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
std::string CmdProxy::ConfigureADC(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
|
@ -957,6 +957,7 @@ class CmdProxy {
|
||||
{"currentsource", &CmdProxy::currentsource},
|
||||
{"timingsource", &CmdProxy::timingsource},
|
||||
{"veto", &CmdProxy::veto},
|
||||
{"vetostream", &CmdProxy::VetoStreaming},
|
||||
{"confadc", &CmdProxy::ConfigureADC},
|
||||
{"badchannels", &CmdProxy::BadChannels},
|
||||
|
||||
@ -1132,6 +1133,7 @@ class CmdProxy {
|
||||
std::string VetoReference(int action);
|
||||
std::string VetoFile(int action);
|
||||
std::string BurstMode(int action);
|
||||
std::string VetoStreaming(int action);
|
||||
std::string ConfigureADC(int action);
|
||||
std::string BadChannels(int action);
|
||||
/* Mythen3 Specific */
|
||||
@ -1484,13 +1486,11 @@ class CmdProxy {
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
numinterfaces, getNumberofUDPInterfaces, setNumberofUDPInterfaces,
|
||||
StringTo<int>,
|
||||
"[1, 2]\n\t[Jungfrau][Gotthard2] Number of udp interfaces to stream "
|
||||
"[1, 2]\n\t[Jungfrau] Number of udp interfaces to stream "
|
||||
"data from detector. Default: 1.\n\tAlso enables second interface in "
|
||||
"receiver for listening (Writes a file per interface if writing "
|
||||
"enabled).\n\tAlso restarts client and receiver zmq sockets if zmq "
|
||||
"streaming enabled.\n\t[Gotthard2] second interface enabled to send "
|
||||
"veto information via 10Gbps for debugging. By default, if veto "
|
||||
"enabled, it is sent via 2.5 gbps interface.");
|
||||
"streaming enabled.");
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(
|
||||
selinterface, getSelectedUDPInterface, selectUDPInterface,
|
||||
@ -1913,7 +1913,7 @@ class CmdProxy {
|
||||
|
||||
INTEGER_COMMAND_VEC_ID(veto, getVeto, setVeto, StringTo<int>,
|
||||
"[0, 1]\n\t[Gotthard2] Enable or disable veto data "
|
||||
"streaming from detector. Default is 0.");
|
||||
"data from chip. Default is 0.");
|
||||
|
||||
/* Mythen3 Specific */
|
||||
|
||||
|
@ -1547,6 +1547,16 @@ void Detector::setVeto(bool enable, Positions pos) {
|
||||
pimpl->Parallel(&Module::setVeto, pos, enable);
|
||||
}
|
||||
|
||||
Result<defs::EthernetInterface> Detector::getVetoStream(Positions pos) const {
|
||||
// return pimpl->Parallel(&Module::getVetoStream, pos);
|
||||
return Result<defs::EthernetInterface> res{in_};
|
||||
}
|
||||
|
||||
void Detector::setVetoStream(defs::EthernetInterface interface, Positions pos) {
|
||||
// pimpl->Parallel(&Module::setVetoStream, pos, enable);
|
||||
in_ = interface;
|
||||
}
|
||||
|
||||
Result<int> Detector::getADCConfiguration(const int chipIndex,
|
||||
const int adcIndex,
|
||||
Positions pos) const {
|
||||
|
@ -552,6 +552,36 @@ TEST_CASE("veto", "[.cmd]") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("vetostream", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::GOTTHARD2) {
|
||||
// auto prev_val = det.getNumberofUDPInterfaces().tsquash(
|
||||
// "inconsistent numinterfaces to test");
|
||||
/* {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetostream", {"sdf"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "vetostream 2\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetostream", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "vetostream 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("vetostream", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "vetostream 1\n");
|
||||
}*/
|
||||
// det.setNumberofUDPInterfaces(prev_val);
|
||||
} else {
|
||||
REQUIRE_THROWS(proxy.Call("vetostream", {}, -1, GET));
|
||||
REQUIRE_THROWS(proxy.Call("vetostream", {"1"}, -1, PUT));
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("vetostream", {"dfgd"}, -1, GET));
|
||||
}
|
||||
|
||||
TEST_CASE("confadc", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
|
@ -96,6 +96,39 @@ TEST_CASE("Setting and reading back Jungfrau dacs", "[.cmd][.dacs]") {
|
||||
|
||||
/* Network Configuration (Detector<->Receiver) */
|
||||
|
||||
TEST_CASE("numinterfaces", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU) {
|
||||
auto prev_val = det.getNumberofUDPInterfaces().tsquash(
|
||||
"inconsistent numinterfaces to test");
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("numinterfaces", {"2"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "numinterfaces 2\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("numinterfaces", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "numinterfaces 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("numinterfaces", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "numinterfaces 1\n");
|
||||
}
|
||||
det.setNumberofUDPInterfaces(prev_val);
|
||||
} else {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("numinterfaces", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "numinterfaces 1\n");
|
||||
REQUIRE_THROWS(proxy.Call("numinterfaces", {"1"}, -1, PUT));
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("numinterfaces", {"3"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("numinterfaces", {"0"}, -1, PUT));
|
||||
}
|
||||
|
||||
TEST_CASE("selinterface", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
|
@ -1751,39 +1751,6 @@ TEST_CASE("scanerrmsg", "[.cmd]") {
|
||||
|
||||
/* Network Configuration (Detector<->Receiver) */
|
||||
|
||||
TEST_CASE("numinterfaces", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
auto det_type = det.getDetectorType().squash();
|
||||
if (det_type == defs::JUNGFRAU || det_type == defs::GOTTHARD2) {
|
||||
auto prev_val = det.getNumberofUDPInterfaces().tsquash(
|
||||
"inconsistent numinterfaces to test");
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("numinterfaces", {"2"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "numinterfaces 2\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("numinterfaces", {"1"}, -1, PUT, oss);
|
||||
REQUIRE(oss.str() == "numinterfaces 1\n");
|
||||
}
|
||||
{
|
||||
std::ostringstream oss;
|
||||
proxy.Call("numinterfaces", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "numinterfaces 1\n");
|
||||
}
|
||||
det.setNumberofUDPInterfaces(prev_val);
|
||||
} else {
|
||||
std::ostringstream oss;
|
||||
proxy.Call("numinterfaces", {}, -1, GET, oss);
|
||||
REQUIRE(oss.str() == "numinterfaces 1\n");
|
||||
REQUIRE_THROWS(proxy.Call("numinterfaces", {"1"}, -1, PUT));
|
||||
}
|
||||
REQUIRE_THROWS(proxy.Call("numinterfaces", {"3"}, -1, PUT));
|
||||
REQUIRE_THROWS(proxy.Call("numinterfaces", {"0"}, -1, PUT));
|
||||
}
|
||||
|
||||
TEST_CASE("udp_srcip", "[.cmd]") {
|
||||
Detector det;
|
||||
CmdProxy proxy(&det);
|
||||
|
Reference in New Issue
Block a user