merge conflict

This commit is contained in:
2021-07-22 11:15:57 +02:00
28 changed files with 655 additions and 116 deletions

View File

@ -1865,6 +1865,50 @@ 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: " +
ToString(args));
}
break;
}
StringTo<defs::EthernetInterface>(arg);
interface = interface | (StringTo<defs::EthernetInterface>(arg));
}
det->setVetoStream(interface, std::vector<int>{det_id});
os << ToString(interface) << '\n';
} else {
throw sls::RuntimeError("Unknown action");
}
return os.str();
}
std::string CmdProxy::ConfigureADC(int action) {
std::ostringstream os;
os << cmd << ' ';

View File

@ -945,6 +945,7 @@ class CmdProxy {
{"currentsource", &CmdProxy::currentsource},
{"timingsource", &CmdProxy::timingsource},
{"veto", &CmdProxy::veto},
{"vetostream", &CmdProxy::VetoStreaming},
{"confadc", &CmdProxy::ConfigureADC},
{"badchannels", &CmdProxy::BadChannels},
@ -1123,6 +1124,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 */
@ -1472,13 +1474,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,
@ -1901,7 +1901,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 */

View File

@ -749,10 +749,28 @@ Result<std::string> Detector::getScanErrorMessage(Positions pos) const {
// Network Configuration (Detector<->Receiver)
Result<int> Detector::getNumberofUDPInterfaces(Positions pos) const {
return pimpl->Parallel(&Module::getNumberofUDPInterfaces, pos);
if (getDetectorType().squash() != defs::JUNGFRAU) {
throw sls::RuntimeError(
"Cannot set number of udp interfaces for this detector.");
}
// also called by vetostream (for gotthard2)
return getNumberofUDPInterfaces_(pos);
}
void Detector::setNumberofUDPInterfaces(int n, Positions pos) {
if (getDetectorType().squash() != defs::JUNGFRAU) {
throw sls::RuntimeError(
"Cannot set number of udp interfaces for this detector.");
}
// also called by vetostream (for gotthard2)
setNumberofUDPInterfaces_(n, pos);
}
Result<int> Detector::getNumberofUDPInterfaces_(Positions pos) const {
return pimpl->Parallel(&Module::getNumberofUDPInterfaces, pos);
}
void Detector::setNumberofUDPInterfaces_(int n, Positions pos) {
bool previouslyClientStreaming = pimpl->getDataStreamingToClient();
bool useReceiver = getUseReceiverFlag().squash(false);
bool previouslyReceiverStreaming = false;
@ -1560,6 +1578,41 @@ void Detector::setVeto(bool enable, Positions pos) {
pimpl->Parallel(&Module::setVeto, pos, enable);
}
Result<defs::EthernetInterface> 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());
for (unsigned int i = 0; i < res.size(); ++i) {
res[i] = (r3[i] ? defs::EthernetInterface::I3GBE
: defs::EthernetInterface::NONE);
if (r10[i] == 2) {
res[i] = res[i] | defs::EthernetInterface::I10GBE;
}
}
return res;
}
void Detector::setVetoStream(defs::EthernetInterface interface, Positions pos) {
// 3gbe
bool i3gbe = ((interface & defs::EthernetInterface::I3GBE) ==
defs::EthernetInterface::I3GBE);
pimpl->Parallel(&Module::setVetoStream, pos, i3gbe);
// 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);
if (numinterfaces != old_numinterfaces) {
setNumberofUDPInterfaces_(numinterfaces, pos);
}
}
Result<int> Detector::getADCConfiguration(const int chipIndex,
const int adcIndex,
Positions pos) const {

View File

@ -1887,6 +1887,14 @@ void Module::setVeto(bool enable) {
sendToDetector(F_SET_VETO, static_cast<int>(enable), nullptr);
}
bool Module::getVetoStream() const {
return (sendToDetector<int>(F_GET_VETO_STREAM));
}
void Module::setVetoStream(const bool value) {
sendToDetector(F_SET_VETO_STREAM, static_cast<int>(value), nullptr);
}
int Module::getADCConfiguration(const int chipIndex, const int adcIndex) const {
int args[]{chipIndex, adcIndex};
return sendToDetector<int>(F_GET_ADC_CONFIGURATION, args);

View File

@ -408,6 +408,8 @@ class Module : public virtual slsDetectorDefs {
void setTimingSource(slsDetectorDefs::timingSourceType value);
bool getVeto() const;
void setVeto(bool enable);
bool getVetoStream() const;
void setVetoStream(const bool value);
int getADCConfiguration(const int chipIndex, const int adcIndex) const;
void setADCConfiguration(const int chipIndex, const int adcIndex,
int value);