From 9493ae3da96faac50f6b54fc67a0c1aa533ee01e Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Wed, 27 May 2020 11:30:47 +0200 Subject: [PATCH] WIP --- slsDetectorSoftware/include/Detector.h | 10 ++++++-- slsDetectorSoftware/src/CmdProxy.h | 11 ++++++-- slsDetectorSoftware/src/Detector.cpp | 8 ++++++ slsDetectorSoftware/src/Module.cpp | 35 ++++++++++++-------------- slsDetectorSoftware/src/Module.h | 6 +++++ 5 files changed, 47 insertions(+), 23 deletions(-) diff --git a/slsDetectorSoftware/include/Detector.h b/slsDetectorSoftware/include/Detector.h index 47e4c8a7e..860646846 100644 --- a/slsDetectorSoftware/include/Detector.h +++ b/slsDetectorSoftware/include/Detector.h @@ -383,8 +383,8 @@ class Detector { Result getNumberofUDPInterfaces(Positions pos = {}) const; /** [Jungfrau][Gotthard2] Also restarts client and receiver zmq sockets - * [Gotthard2] second interface enabled to send veto information for - * debugging + * [Gotthard2] second interface enabled to send veto information via 10gbps + * for debugging. By default it is sent via 2.5gbps if veto enabled * n can be 1 or 2 */ void setNumberofUDPInterfaces(int n, Positions pos = {}); @@ -980,6 +980,12 @@ class Detector { /** [Gotthard2] Options: TIMING_INTERNAL, TIMING_EXTERNAL */ void setTimingSource(defs::timingSourceType value, Positions pos = {}); + /** [Gotthard2] */ + Result getVeto(Positions pos = {}) const; + + /** [Gotthard2] */ + void setVeto(const bool enable, Positions pos = {}); + /************************************************** * * * Mythen3 Specific * diff --git a/slsDetectorSoftware/src/CmdProxy.h b/slsDetectorSoftware/src/CmdProxy.h index cd4b4db3f..1b4cc3d01 100644 --- a/slsDetectorSoftware/src/CmdProxy.h +++ b/slsDetectorSoftware/src/CmdProxy.h @@ -795,6 +795,7 @@ class CmdProxy { {"burstmode", &CmdProxy::BurstMode}, {"currentsource", &CmdProxy::currentsource}, {"timingsource", &CmdProxy::timingsource}, + {"veto", &CmdProxy::veto}, /* Mythen3 Specific */ {"counters", &CmdProxy::Counters}, @@ -1522,8 +1523,10 @@ class CmdProxy { StringTo, "[1, 2]\n\t[Jungfrau][Gotthard2] Number of udp interfaces to stream " "data from detector. Default: 1.\n\t" - "[Gotthard2] Second interface enabled to send veto information for " - "debugging."); + "[Gotthard2] 2 will select 10gbps as channel for veto data streaming " + "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( selinterface, getSelectedUDPInterface, selectUDPInterface, @@ -1872,6 +1875,10 @@ class CmdProxy { "[internal|external]\n\t[Gotthard2] Timing source. Internal is crystal " "and external is system timing. Default is internal."); + INTEGER_COMMAND(veto, getVeto, setVeto, StringTo, + "[0, 1]\n\t[Gotthard2] Enable or disable veto data " + "streaming from detector. Default is 0."); + /* Mythen3 Specific */ /* CTB/ Moench Specific */ diff --git a/slsDetectorSoftware/src/Detector.cpp b/slsDetectorSoftware/src/Detector.cpp index 3422cde97..2a65d8559 100644 --- a/slsDetectorSoftware/src/Detector.cpp +++ b/slsDetectorSoftware/src/Detector.cpp @@ -1248,6 +1248,14 @@ void Detector::setTimingSource(defs::timingSourceType value, Positions pos) { pimpl->Parallel(&Module::setTimingSource, pos, value); } +Result 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 Result Detector::getCounterMask(Positions pos) const { diff --git a/slsDetectorSoftware/src/Module.cpp b/slsDetectorSoftware/src/Module.cpp index 780e9c8b4..389cd422b 100644 --- a/slsDetectorSoftware/src/Module.cpp +++ b/slsDetectorSoftware/src/Module.cpp @@ -4,8 +4,8 @@ #include "ToString.h" #include "file_utils.h" #include "network_utils.h" -#include "sls_detector_funcs.h" #include "sls_detector_exceptions.h" +#include "sls_detector_funcs.h" #include "string_utils.h" #include "versionAPI.h" @@ -139,16 +139,14 @@ void Module::sendToDetector(int fnum, std::nullptr_t, Ret &retval) { void Module::sendToDetector(int fnum) { LOG(logDEBUG1) << "Sending: [" - << getFunctionNameFromEnum( - static_cast(fnum)) + << getFunctionNameFromEnum(static_cast(fnum)) << "]"; sendToDetector(fnum, nullptr, 0, nullptr, 0); } template Ret Module::sendToDetector(int fnum) { LOG(logDEBUG1) << "Sending: [" - << getFunctionNameFromEnum( - static_cast(fnum)) + << getFunctionNameFromEnum(static_cast(fnum)) << ", nullptr, 0, " << typeid(Ret).name() << ", " << sizeof(Ret) << "]"; Ret retval{}; @@ -160,8 +158,7 @@ template Ret Module::sendToDetector(int fnum) { template Ret Module::sendToDetector(int fnum, const Arg &args) { LOG(logDEBUG1) << "Sending: [" - << getFunctionNameFromEnum( - static_cast(fnum)) + << getFunctionNameFromEnum(static_cast(fnum)) << ", " << args << ", " << sizeof(args) << ", " << typeid(Ret).name() << ", " << sizeof(Ret) << "]"; Ret retval{}; @@ -216,8 +213,7 @@ void Module::sendToDetectorStop(int fnum, std::nullptr_t, Ret &retval) const { void Module::sendToDetectorStop(int fnum) { LOG(logDEBUG1) << "Sending to detector stop: [" - << getFunctionNameFromEnum( - static_cast(fnum)) + << getFunctionNameFromEnum(static_cast(fnum)) << "]"; 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) { std::ostringstream oss; oss << "Set rx_hostname first to use receiver parameters, "; - oss << getFunctionNameFromEnum( - static_cast(fnum)); + oss << getFunctionNameFromEnum(static_cast(fnum)); throw RuntimeError(oss.str()); } auto receiver = ReceiverSocket(shm()->rxHostname, shm()->rxTCPPort); @@ -278,8 +273,7 @@ void Module::sendToReceiver(int fnum, std::nullptr_t, Ret &retval) const { template Ret Module::sendToReceiver(int fnum) { LOG(logDEBUG1) << "Sending: [" - << getFunctionNameFromEnum( - static_cast(fnum)) + << getFunctionNameFromEnum(static_cast(fnum)) << ", nullptr, 0, " << typeid(Ret).name() << ", " << sizeof(Ret) << "]"; Ret retval{}; @@ -290,8 +284,7 @@ template Ret Module::sendToReceiver(int fnum) { template Ret Module::sendToReceiver(int fnum) const { LOG(logDEBUG1) << "Sending: [" - << getFunctionNameFromEnum( - static_cast(fnum)) + << getFunctionNameFromEnum(static_cast(fnum)) << ", nullptr, 0, " << typeid(Ret).name() << ", " << sizeof(Ret) << "]"; Ret retval{}; @@ -303,8 +296,7 @@ template Ret Module::sendToReceiver(int fnum) const { template Ret Module::sendToReceiver(int fnum, const Arg &args) { LOG(logDEBUG1) << "Sending: [" - << getFunctionNameFromEnum( - static_cast(fnum)) + << getFunctionNameFromEnum(static_cast(fnum)) << ", " << args << ", " << sizeof(args) << ", " << typeid(Ret).name() << ", " << sizeof(Ret) << "]"; Ret retval{}; @@ -316,8 +308,7 @@ Ret Module::sendToReceiver(int fnum, const Arg &args) { template Ret Module::sendToReceiver(int fnum, const Arg &args) const { LOG(logDEBUG1) << "Sending: [" - << getFunctionNameFromEnum( - static_cast(fnum)) + << getFunctionNameFromEnum(static_cast(fnum)) << ", " << args << ", " << sizeof(args) << ", " << typeid(Ret).name() << ", " << sizeof(Ret) << "]"; Ret retval{}; @@ -2051,6 +2042,12 @@ void Module::setTimingSource(slsDetectorDefs::timingSourceType value) { sendToDetector(F_SET_TIMING_SOURCE, static_cast(value), nullptr); } +bool Module::getVeto() { return sendToDetector(F_GET_VETO); } + +void Module::setVeto(bool enable) { + sendToDetector(F_SET_VETO, static_cast(enable), nullptr); +} + int Module::setCounterBit(int cb) { return sendToDetector(F_SET_COUNTER_BIT, cb); } diff --git a/slsDetectorSoftware/src/Module.h b/slsDetectorSoftware/src/Module.h index b8cccfd93..a8a67b936 100644 --- a/slsDetectorSoftware/src/Module.h +++ b/slsDetectorSoftware/src/Module.h @@ -979,6 +979,12 @@ class Module : public virtual slsDetectorDefs { /** [Gotthard2] Options: TIMING_INTERNAL, TIMING_EXTERNAL */ void setTimingSource(slsDetectorDefs::timingSourceType value); + /** [Gotthard2] */ + bool getVeto(); + + /** default disabled */ + void setVeto(bool enable); + /** * Set/get counter bit in detector (Gotthard) * @param i is -1 to get, 0 to reset and any other value to set the counter