This commit is contained in:
maliakal_d 2020-05-27 11:30:47 +02:00
parent e0ea08332f
commit 9493ae3da9
5 changed files with 47 additions and 23 deletions

View File

@ -383,8 +383,8 @@ class Detector {
Result<int> getNumberofUDPInterfaces(Positions pos = {}) const; Result<int> getNumberofUDPInterfaces(Positions pos = {}) const;
/** [Jungfrau][Gotthard2] Also restarts client and receiver zmq sockets /** [Jungfrau][Gotthard2] Also restarts client and receiver zmq sockets
* [Gotthard2] second interface enabled to send veto information for * [Gotthard2] second interface enabled to send veto information via 10gbps
* debugging * for debugging. By default it is sent via 2.5gbps if veto enabled
* n can be 1 or 2 */ * n can be 1 or 2 */
void setNumberofUDPInterfaces(int n, Positions pos = {}); void setNumberofUDPInterfaces(int n, Positions pos = {});
@ -980,6 +980,12 @@ class Detector {
/** [Gotthard2] Options: TIMING_INTERNAL, TIMING_EXTERNAL */ /** [Gotthard2] Options: TIMING_INTERNAL, TIMING_EXTERNAL */
void setTimingSource(defs::timingSourceType value, Positions pos = {}); void setTimingSource(defs::timingSourceType value, Positions pos = {});
/** [Gotthard2] */
Result<bool> getVeto(Positions pos = {}) const;
/** [Gotthard2] */
void setVeto(const bool enable, Positions pos = {});
/************************************************** /**************************************************
* * * *
* Mythen3 Specific * * Mythen3 Specific *

View File

@ -795,6 +795,7 @@ class CmdProxy {
{"burstmode", &CmdProxy::BurstMode}, {"burstmode", &CmdProxy::BurstMode},
{"currentsource", &CmdProxy::currentsource}, {"currentsource", &CmdProxy::currentsource},
{"timingsource", &CmdProxy::timingsource}, {"timingsource", &CmdProxy::timingsource},
{"veto", &CmdProxy::veto},
/* Mythen3 Specific */ /* Mythen3 Specific */
{"counters", &CmdProxy::Counters}, {"counters", &CmdProxy::Counters},
@ -1522,8 +1523,10 @@ class CmdProxy {
StringTo<int>, StringTo<int>,
"[1, 2]\n\t[Jungfrau][Gotthard2] Number of udp interfaces to stream " "[1, 2]\n\t[Jungfrau][Gotthard2] Number of udp interfaces to stream "
"data from detector. Default: 1.\n\t" "data from detector. Default: 1.\n\t"
"[Gotthard2] Second interface enabled to send veto information for " "[Gotthard2] 2 will select 10gbps as channel for veto data streaming "
"debugging."); "in detector and also enable second interface in receiver to listen to "
"it. This is mainly for debugging purposes. By default, numinterfaces "
"is 1 and if veto enabled, it is sent via 2.5 gbps interface");
INTEGER_COMMAND( INTEGER_COMMAND(
selinterface, getSelectedUDPInterface, selectUDPInterface, selinterface, getSelectedUDPInterface, selectUDPInterface,
@ -1872,6 +1875,10 @@ class CmdProxy {
"[internal|external]\n\t[Gotthard2] Timing source. Internal is crystal " "[internal|external]\n\t[Gotthard2] Timing source. Internal is crystal "
"and external is system timing. Default is internal."); "and external is system timing. Default is internal.");
INTEGER_COMMAND(veto, getVeto, setVeto, StringTo<int>,
"[0, 1]\n\t[Gotthard2] Enable or disable veto data "
"streaming from detector. Default is 0.");
/* Mythen3 Specific */ /* Mythen3 Specific */
/* CTB/ Moench Specific */ /* CTB/ Moench Specific */

View File

@ -1248,6 +1248,14 @@ void Detector::setTimingSource(defs::timingSourceType value, Positions pos) {
pimpl->Parallel(&Module::setTimingSource, pos, value); pimpl->Parallel(&Module::setTimingSource, pos, value);
} }
Result<bool> Detector::getVeto(Positions pos) const {
return pimpl->Parallel(&Module::getVeto, pos);
}
void Detector::setVeto(bool enable, Positions pos) {
pimpl->Parallel(&Module::setVeto, pos, enable);
}
// Mythen3 Specific // Mythen3 Specific
Result<uint32_t> Detector::getCounterMask(Positions pos) const { Result<uint32_t> Detector::getCounterMask(Positions pos) const {

View File

@ -4,8 +4,8 @@
#include "ToString.h" #include "ToString.h"
#include "file_utils.h" #include "file_utils.h"
#include "network_utils.h" #include "network_utils.h"
#include "sls_detector_funcs.h"
#include "sls_detector_exceptions.h" #include "sls_detector_exceptions.h"
#include "sls_detector_funcs.h"
#include "string_utils.h" #include "string_utils.h"
#include "versionAPI.h" #include "versionAPI.h"
@ -139,16 +139,14 @@ void Module::sendToDetector(int fnum, std::nullptr_t, Ret &retval) {
void Module::sendToDetector(int fnum) { void Module::sendToDetector(int fnum) {
LOG(logDEBUG1) << "Sending: [" LOG(logDEBUG1) << "Sending: ["
<< getFunctionNameFromEnum( << getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
static_cast<detFuncs>(fnum))
<< "]"; << "]";
sendToDetector(fnum, nullptr, 0, nullptr, 0); sendToDetector(fnum, nullptr, 0, nullptr, 0);
} }
template <typename Ret> Ret Module::sendToDetector(int fnum) { template <typename Ret> Ret Module::sendToDetector(int fnum) {
LOG(logDEBUG1) << "Sending: [" LOG(logDEBUG1) << "Sending: ["
<< getFunctionNameFromEnum( << getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
static_cast<detFuncs>(fnum))
<< ", nullptr, 0, " << typeid(Ret).name() << ", " << ", nullptr, 0, " << typeid(Ret).name() << ", "
<< sizeof(Ret) << "]"; << sizeof(Ret) << "]";
Ret retval{}; Ret retval{};
@ -160,8 +158,7 @@ template <typename Ret> Ret Module::sendToDetector(int fnum) {
template <typename Ret, typename Arg> template <typename Ret, typename Arg>
Ret Module::sendToDetector(int fnum, const Arg &args) { Ret Module::sendToDetector(int fnum, const Arg &args) {
LOG(logDEBUG1) << "Sending: [" LOG(logDEBUG1) << "Sending: ["
<< getFunctionNameFromEnum( << getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
static_cast<detFuncs>(fnum))
<< ", " << args << ", " << sizeof(args) << ", " << ", " << args << ", " << sizeof(args) << ", "
<< typeid(Ret).name() << ", " << sizeof(Ret) << "]"; << typeid(Ret).name() << ", " << sizeof(Ret) << "]";
Ret retval{}; Ret retval{};
@ -216,8 +213,7 @@ void Module::sendToDetectorStop(int fnum, std::nullptr_t, Ret &retval) const {
void Module::sendToDetectorStop(int fnum) { void Module::sendToDetectorStop(int fnum) {
LOG(logDEBUG1) << "Sending to detector stop: [" LOG(logDEBUG1) << "Sending to detector stop: ["
<< getFunctionNameFromEnum( << getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
static_cast<detFuncs>(fnum))
<< "]"; << "]";
sendToDetectorStop(fnum, nullptr, 0, nullptr, 0); sendToDetectorStop(fnum, nullptr, 0, nullptr, 0);
} }
@ -237,8 +233,7 @@ void Module::sendToReceiver(int fnum, const void *args, size_t args_size,
if (!shm()->useReceiverFlag) { if (!shm()->useReceiverFlag) {
std::ostringstream oss; std::ostringstream oss;
oss << "Set rx_hostname first to use receiver parameters, "; oss << "Set rx_hostname first to use receiver parameters, ";
oss << getFunctionNameFromEnum( oss << getFunctionNameFromEnum(static_cast<detFuncs>(fnum));
static_cast<detFuncs>(fnum));
throw RuntimeError(oss.str()); throw RuntimeError(oss.str());
} }
auto receiver = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort); auto receiver = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort);
@ -278,8 +273,7 @@ void Module::sendToReceiver(int fnum, std::nullptr_t, Ret &retval) const {
template <typename Ret> Ret Module::sendToReceiver(int fnum) { template <typename Ret> Ret Module::sendToReceiver(int fnum) {
LOG(logDEBUG1) << "Sending: [" LOG(logDEBUG1) << "Sending: ["
<< getFunctionNameFromEnum( << getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
static_cast<detFuncs>(fnum))
<< ", nullptr, 0, " << typeid(Ret).name() << ", " << ", nullptr, 0, " << typeid(Ret).name() << ", "
<< sizeof(Ret) << "]"; << sizeof(Ret) << "]";
Ret retval{}; Ret retval{};
@ -290,8 +284,7 @@ template <typename Ret> Ret Module::sendToReceiver(int fnum) {
template <typename Ret> Ret Module::sendToReceiver(int fnum) const { template <typename Ret> Ret Module::sendToReceiver(int fnum) const {
LOG(logDEBUG1) << "Sending: [" LOG(logDEBUG1) << "Sending: ["
<< getFunctionNameFromEnum( << getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
static_cast<detFuncs>(fnum))
<< ", nullptr, 0, " << typeid(Ret).name() << ", " << ", nullptr, 0, " << typeid(Ret).name() << ", "
<< sizeof(Ret) << "]"; << sizeof(Ret) << "]";
Ret retval{}; Ret retval{};
@ -303,8 +296,7 @@ template <typename Ret> Ret Module::sendToReceiver(int fnum) const {
template <typename Ret, typename Arg> template <typename Ret, typename Arg>
Ret Module::sendToReceiver(int fnum, const Arg &args) { Ret Module::sendToReceiver(int fnum, const Arg &args) {
LOG(logDEBUG1) << "Sending: [" LOG(logDEBUG1) << "Sending: ["
<< getFunctionNameFromEnum( << getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
static_cast<detFuncs>(fnum))
<< ", " << args << ", " << sizeof(args) << ", " << ", " << args << ", " << sizeof(args) << ", "
<< typeid(Ret).name() << ", " << sizeof(Ret) << "]"; << typeid(Ret).name() << ", " << sizeof(Ret) << "]";
Ret retval{}; Ret retval{};
@ -316,8 +308,7 @@ Ret Module::sendToReceiver(int fnum, const Arg &args) {
template <typename Ret, typename Arg> template <typename Ret, typename Arg>
Ret Module::sendToReceiver(int fnum, const Arg &args) const { Ret Module::sendToReceiver(int fnum, const Arg &args) const {
LOG(logDEBUG1) << "Sending: [" LOG(logDEBUG1) << "Sending: ["
<< getFunctionNameFromEnum( << getFunctionNameFromEnum(static_cast<detFuncs>(fnum))
static_cast<detFuncs>(fnum))
<< ", " << args << ", " << sizeof(args) << ", " << ", " << args << ", " << sizeof(args) << ", "
<< typeid(Ret).name() << ", " << sizeof(Ret) << "]"; << typeid(Ret).name() << ", " << sizeof(Ret) << "]";
Ret retval{}; Ret retval{};
@ -2051,6 +2042,12 @@ void Module::setTimingSource(slsDetectorDefs::timingSourceType value) {
sendToDetector(F_SET_TIMING_SOURCE, static_cast<int>(value), nullptr); sendToDetector(F_SET_TIMING_SOURCE, static_cast<int>(value), nullptr);
} }
bool Module::getVeto() { return sendToDetector<int>(F_GET_VETO); }
void Module::setVeto(bool enable) {
sendToDetector(F_SET_VETO, static_cast<int>(enable), nullptr);
}
int Module::setCounterBit(int cb) { int Module::setCounterBit(int cb) {
return sendToDetector<int>(F_SET_COUNTER_BIT, cb); return sendToDetector<int>(F_SET_COUNTER_BIT, cb);
} }

View File

@ -979,6 +979,12 @@ class Module : public virtual slsDetectorDefs {
/** [Gotthard2] Options: TIMING_INTERNAL, TIMING_EXTERNAL */ /** [Gotthard2] Options: TIMING_INTERNAL, TIMING_EXTERNAL */
void setTimingSource(slsDetectorDefs::timingSourceType value); void setTimingSource(slsDetectorDefs::timingSourceType value);
/** [Gotthard2] */
bool getVeto();
/** default disabled */
void setVeto(bool enable);
/** /**
* Set/get counter bit in detector (Gotthard) * Set/get counter bit in detector (Gotthard)
* @param i is -1 to get, 0 to reset and any other value to set the counter * @param i is -1 to get, 0 to reset and any other value to set the counter