diff --git a/CMakeLists.txt b/CMakeLists.txt index dd66f424..04caa5e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,7 +25,6 @@ IF (CMAKE_CUDA_COMPILER) ENDIF() SET(JFJOCH_COMPILE_WRITER ON CACHE BOOL "Compile HDF5 writer") -SET(JFJOCH_COMPILE_DETECTOR ON CACHE BOOL "Compile detector control") SET(JFJOCH_COMPILE_INDEXER ON CACHE BOOL "Compile indexer") SET(JFJOCH_COMPILE_TESTS OFF CACHE BOOL "Compile tests") @@ -50,14 +49,10 @@ ADD_SUBDIRECTORY(fpga) ADD_SUBDIRECTORY(acquisition_device) ADD_SUBDIRECTORY(receiver) ADD_SUBDIRECTORY(image_analysis) +ADD_SUBDIRECTORY(detector_control) SET(jfjoch_executables jfjoch_broker) -IF (JFJOCH_COMPILE_DETECTOR) - ADD_SUBDIRECTORY(detector_control) - LIST(APPEND jfjoch_executables jfjoch_detector) -ENDIF() - IF (JFJOCH_COMPILE_TESTS OR JFJOCH_COMPILE_WRITER) ADD_SUBDIRECTORY(writer) LIST(APPEND jfjoch_executables jfjoch_writer jfjoch_writer_multi) diff --git a/broker/CMakeLists.txt b/broker/CMakeLists.txt index 75cbf749..8f0ecfe4 100644 --- a/broker/CMakeLists.txt +++ b/broker/CMakeLists.txt @@ -3,7 +3,7 @@ ADD_LIBRARY(JFJochBroker STATIC JFJochServices.cpp JFJochServices.h JFJochBroker.cpp JFJochBroker.h JFJochBrokerParser.cpp JFJochBrokerParser.h) -TARGET_LINK_LIBRARIES(JFJochBroker JFJochReceiver gRPCClients CommonFunctions) +TARGET_LINK_LIBRARIES(JFJochBroker JFJochReceiver JFJochDetector gRPCClients CommonFunctions JFJochProtoBuf) ADD_EXECUTABLE(jfjoch_broker jfjoch_broker.cpp) TARGET_LINK_LIBRARIES(jfjoch_broker JFJochBroker) diff --git a/broker/JFJochBrokerParser.cpp b/broker/JFJochBrokerParser.cpp index 09ca495b..6637a1e9 100644 --- a/broker/JFJochBrokerParser.cpp +++ b/broker/JFJochBrokerParser.cpp @@ -240,8 +240,8 @@ void ParseBrokerConfiguration(const nlohmann::json &input, const std::string& ta } } - if (j.contains("detector_addr")) - broker.Services().Detector(GET_STR(j, "detector_addr")); + if (j.contains("detector")) + broker.Services().Detector(); } else throw JFJochException(JFJochExceptionCategory::JSON, "Service configuration not found"); } \ No newline at end of file diff --git a/broker/JFJochServices.cpp b/broker/JFJochServices.cpp index 3f468bbc..e1d0099e 100644 --- a/broker/JFJochServices.cpp +++ b/broker/JFJochServices.cpp @@ -23,24 +23,24 @@ void JFJochServices::Start(const DiffractionExperiment& experiment, const JFCali receiver->Start(experiment, nullptr); } - if (!experiment.IsUsingInternalPacketGen()) { + if (detector && !experiment.IsUsingInternalPacketGen()) { logger.Info(" ... detector start"); - detector.Start(experiment); + detector->Start(experiment); } logger.Info(" Done!"); } void JFJochServices::Off() { - detector.Off(); + if (detector) + detector->Deactivate(); } void JFJochServices::On(const DiffractionExperiment &x) { logger.Info("Detector on"); - if (receiver != nullptr) { - JFJochProtoBuf::DetectorConfig config = x.DetectorConfig(receiver->GetNetworkConfig()); - detector.On(config); - } + if (detector && (receiver != nullptr)) + detector->Configure(x, receiver->GetNetworkConfig()); + logger.Info(" ... done"); } @@ -86,13 +86,16 @@ JFJochServicesOutput JFJochServices::Stop(const JFCalibration &calibration) { } } - logger.Info("Stopping detector"); - try { - detector.Stop(); - logger.Info(" ... done"); - } catch (JFJochException &e) { - logger.Error(" ... finished with error {}",e.what()); - exception = std::make_unique(e); + if (detector) { + logger.Info("Stopping detector"); + try { + + detector->Stop(); + logger.Info(" ... done"); + } catch (JFJochException &e) { + logger.Error(" ... finished with error {}", e.what()); + exception = std::make_unique(e); + } } if (exception) @@ -113,7 +116,8 @@ void JFJochServices::Abort() { } void JFJochServices::Cancel() { - detector.Stop(); + if (detector) + detector->Stop(); if (receiver != nullptr) receiver->Cancel(); } @@ -130,9 +134,9 @@ JFJochServices &JFJochServices::Writer(const std::string &addr, const std::strin return *this; } -JFJochServices &JFJochServices::Detector(const std::string &addr) { - detector.Connect(addr); - logger.Info("Using detector service with gRPC {}", addr); +JFJochServices &JFJochServices::Detector() { + detector = std::make_unique(); + logger.Info("Using detector service"); return *this; } @@ -170,7 +174,8 @@ void JFJochServices::SetDataProcessingSettings(const DataProcessingSettings &set } void JFJochServices::Trigger() { - detector.Trigger(); + if (detector) + detector->Trigger(); } size_t JFJochServices::WriterZMQCount() const { diff --git a/broker/JFJochServices.h b/broker/JFJochServices.h index 52d06649..5a26746d 100644 --- a/broker/JFJochServices.h +++ b/broker/JFJochServices.h @@ -8,7 +8,7 @@ #include "../common/Logger.h" #include "../receiver/JFJochReceiverService.h" #include "../grpc/JFJochWriterGroupClient.h" -#include "../grpc/JFJochDetectorClient.h" +#include "../detector_control/DetectorWrapper.h" struct JFJochServicesOutput { JFJochReceiverOutput receiver_output; @@ -17,7 +17,7 @@ struct JFJochServicesOutput { class JFJochServices { JFJochReceiverService *receiver = nullptr; JFJochWriterGroupClient writer; - JFJochDetectorClient detector; + std::unique_ptr detector; Logger &logger; bool writer_running = false; @@ -39,7 +39,7 @@ public: void SetDataProcessingSettings(const DataProcessingSettings &settings); JFJochServices& Receiver(JFJochReceiverService *input); JFJochServices& Writer(const std::string &addr, const std::string &zmq_push_addr); - JFJochServices& Detector(const std::string &addr); + JFJochServices& Detector(); size_t WriterZMQCount() const; }; diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index f446a96e..2a72c875 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -53,7 +53,7 @@ ADD_LIBRARY( CommonFunctions STATIC RawToConvertedGeometryCore.h Plot.h) -TARGET_LINK_LIBRARIES(CommonFunctions Compression FrameSerialize libzmq JFCalibration JFJochProtoBuf -lrt) +TARGET_LINK_LIBRARIES(CommonFunctions Compression FrameSerialize libzmq JFCalibration -lrt) IF (CMAKE_CUDA_COMPILER) TARGET_SOURCES(CommonFunctions PRIVATE CUDAWrapper.cu ) diff --git a/common/DiffractionExperiment.cpp b/common/DiffractionExperiment.cpp index f47ecd7b..8233d52f 100644 --- a/common/DiffractionExperiment.cpp +++ b/common/DiffractionExperiment.cpp @@ -7,14 +7,11 @@ #include "GitInfo.h" #include "DiffractionExperiment.h" #include "JFJochException.h" -#include "../compression/MaxCompressedSize.h" #define check_max(param, val, max) if ((val) > (max)) throw JFJochException(JFJochExceptionCategory::InputParameterAboveMax, param) #define check_min(param, val, min) if ((val) < (min)) throw JFJochException(JFJochExceptionCategory::InputParameterBelowMin, param) - -DiffractionExperiment::DiffractionExperiment() : DiffractionExperiment(DetectorGeometry(8, 2)) -{} +DiffractionExperiment::DiffractionExperiment() : DiffractionExperiment(DetectorGeometry(8, 2)) {} DiffractionExperiment::DiffractionExperiment(const DetectorSetup& det_setup) : detector(det_setup) { dataset.photon_energy_keV = WVL_1A_IN_KEV; @@ -691,92 +688,6 @@ std::string DiffractionExperiment::GetSampleName() const { return dataset.sample_name; } -// Create ProtoBuf structures - -DiffractionExperiment::operator JFJochProtoBuf::DetectorInput() const { - JFJochProtoBuf::DetectorInput ret; - - ret.set_modules_num(GetModulesNum()); - switch (GetDetectorMode()) { - case DetectorMode::Conversion: - ret.set_mode(JFJochProtoBuf::CONVERSION); - break; - case DetectorMode::Raw: - ret.set_mode(JFJochProtoBuf::RAW); - break; - case DetectorMode::PedestalG0: - ret.set_mode(JFJochProtoBuf::PEDESTAL_G0); - break; - case DetectorMode::PedestalG1: - ret.set_mode(JFJochProtoBuf::PEDESTAL_G1); - break; - case DetectorMode::PedestalG2: - ret.set_mode(JFJochProtoBuf::PEDESTAL_G2); - break; - } - - if (GetNumTriggers() == 1) { - ret.set_num_frames(GetFrameNumPerTrigger() + DELAY_FRAMES_STOP_AND_QUIT); - ret.set_num_triggers(1); - } else { - // More than 1 trigger - detector needs one trigger or few more trigger - if (GetStorageCellNumber() > 1) - ret.set_num_frames(1); - else - ret.set_num_frames(GetFrameNumPerTrigger()); - - if (GetFrameNumPerTrigger() < DELAY_FRAMES_STOP_AND_QUIT) - ret.set_num_triggers(GetNumTriggers() + DELAY_FRAMES_STOP_AND_QUIT); - else - ret.set_num_triggers(GetNumTriggers() + 1); - } - ret.set_storage_cell_start(GetStorageCellStart()); - ret.set_storage_cell_number(GetStorageCellNumber()); - ret.set_storage_cell_delay_ns(GetStorageCellDelay().count()); - - if (GetStorageCellNumber() > 1) { - ret.set_period_us((GetFrameTime().count() +10) * GetStorageCellNumber()); - } else - ret.set_period_us(GetFrameTime().count()); - - ret.set_count_time_us(GetFrameCountTime().count()); - - return ret; -} - -JFJochProtoBuf::DetectorConfig DiffractionExperiment::DetectorConfig(const std::vector &net_config) const { - JFJochProtoBuf::DetectorConfig ret; - if (net_config.size() < GetDataStreamsNum()) - throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, - "Number of FPGA boards in the receiver is less then necessary"); - - if (!detector.GetDetectorModuleHostname().empty() && (detector.GetDetectorModuleHostname().size() != GetModulesNum())) - throw JFJochException(JFJochExceptionCategory::ArrayOutOfBounds, - "Inconsistent number of modules and detector module host names"); - - if (!detector.GetDetectorModuleHostname().empty()) - *ret.mutable_module_hostname() = {detector.GetDetectorModuleHostname().begin(), - detector.GetDetectorModuleHostname().end()}; - - ret.set_udp_interface_count(detector.GetUDPInterfaceCount()); - - for (int d = 0; d < GetDataStreamsNum(); d++) { - for (int m = 0; m < GetModulesNum(d); m++) { - auto mod_cfg = ret.add_modules(); - mod_cfg->set_udp_dest_port_1(net_config[d].udp_port); - mod_cfg->set_udp_dest_port_2(net_config[d].udp_port); - mod_cfg->set_ipv4_src_addr_1(IPv4AddressToStr(GetSrcIPv4Address(d, 2 * m))); - mod_cfg->set_ipv4_src_addr_2(IPv4AddressToStr(GetSrcIPv4Address(d, 2 * m + 1))); - mod_cfg->set_ipv4_dest_addr_1(net_config[d].ipv4_addr); - mod_cfg->set_ipv4_dest_addr_2(net_config[d].ipv4_addr); - mod_cfg->set_mac_addr_dest_1(net_config[d].mac_addr); - mod_cfg->set_mac_addr_dest_2(net_config[d].mac_addr); - mod_cfg->set_module_id_in_data_stream(m); - } - } - return ret; -} - void DiffractionExperiment::CheckDataProcessingSettings(const DataProcessingSettings &settings) { check_min("Signal to noise threshold", settings.signal_to_noise_threshold, 1); check_min("Photon count threshold", settings.photon_count_threshold, 0); @@ -931,9 +842,8 @@ int64_t DiffractionExperiment::GetModuleSlowDirectionStep(uint16_t module_number return detector.GetGeometry().GetSlowDirectionStep(module_number); } -void DiffractionExperiment::GetDetectorModuleHostname(std::vector &output) const { - for (const auto &iter: detector.GetDetectorModuleHostname()) - output.push_back(iter); +std::vector DiffractionExperiment::GetDetectorModuleHostname() const { + return detector.GetDetectorModuleHostname(); } std::string DiffractionExperiment::GetDetectorDescription() const { @@ -1020,3 +930,28 @@ DiffractionExperiment &DiffractionExperiment::FPGAOutputMode(FPGAPixelOutput inp FPGAPixelOutput DiffractionExperiment::GetFPGAOutputMode() const { return dataset.fpga_pixel_output; } + +int64_t DiffractionExperiment::GetUDPInterfaceCount() const { + return detector.GetUDPInterfaceCount(); +} + +std::vector +DiffractionExperiment::GetDetectorModuleConfig(const std::vector &net_config) const{ + std::vector ret; + for (int d = 0; d < GetDataStreamsNum(); d++) { + for (int m = 0; m < GetModulesNum(d); m++) { + DetectorModuleConfig mod_cfg; + mod_cfg.udp_dest_port_1 = net_config[d].udp_port; + mod_cfg.udp_dest_port_2 = net_config[d].udp_port; + mod_cfg.ipv4_src_addr_1 = IPv4AddressToStr(GetSrcIPv4Address(d, 2 * m)); + mod_cfg.ipv4_src_addr_2 = IPv4AddressToStr(GetSrcIPv4Address(d, 2 * m + 1)); + mod_cfg.ipv4_dest_addr_1 = net_config[d].ipv4_addr; + mod_cfg.ipv4_dest_addr_2 = net_config[d].ipv4_addr; + mod_cfg.mac_addr_dest_1 = net_config[d].mac_addr; + mod_cfg.mac_addr_dest_2 = net_config[d].mac_addr; + mod_cfg.module_id_in_data_stream = m; + ret.emplace_back(std::move(mod_cfg)); + } + } + return ret; +} diff --git a/common/DiffractionExperiment.h b/common/DiffractionExperiment.h index 10427bce..3719e3ca 100644 --- a/common/DiffractionExperiment.h +++ b/common/DiffractionExperiment.h @@ -5,9 +5,7 @@ #include #include -#include - -#include +#include #include "../compression/CompressionAlgorithmEnum.h" @@ -17,7 +15,6 @@ #include "../frame_serialize/CBORMessages.h" #include "DetectorSetup.h" #include "../image_analysis/DataProcessingSettings.h" -#include enum class DetectorMode { Conversion, Raw, PedestalG0, PedestalG1, PedestalG2 @@ -33,6 +30,19 @@ struct AcquisitionDeviceNetConfig { uint64_t udp_port; }; +struct DetectorModuleConfig { + uint64_t udp_dest_port_1; + uint64_t udp_dest_port_2; + std::string ipv4_src_addr_1; + std::string ipv4_src_addr_2; + std::string ipv4_dest_addr_1; + std::string ipv4_dest_addr_2; + std::string mac_addr_dest_1; + std::string mac_addr_dest_2; + uint64_t module_id_in_data_stream; +}; + + class DiffractionExperiment { // Internal detector settings std::chrono::microseconds frame_time_pedestalG1G2; @@ -160,9 +170,6 @@ public: void FillMessage(StartMessage &message) const; - operator JFJochProtoBuf::DetectorInput() const; - JFJochProtoBuf::DetectorConfig DetectorConfig(const std::vector& net_config) const; - static void CheckDataProcessingSettings(const DataProcessingSettings& settings); static DataProcessingSettings DefaultDataProcessingSettings(); DetectorMode GetDetectorMode() const; @@ -258,7 +265,7 @@ public: std::string GetInstrumentNameShort() const; std::string GetDetectorDescription() const; - void GetDetectorModuleHostname(std::vector& output) const; + std::vector GetDetectorModuleHostname() const; bool GetPedestalWithExternalTrigger() const; DiffractionExperiment& ApplySolidAngleCorr(bool input); @@ -276,6 +283,9 @@ public: DiffractionExperiment& FPGAOutputMode(FPGAPixelOutput input); FPGAPixelOutput GetFPGAOutputMode() const; + + int64_t GetUDPInterfaceCount() const; + std::vector GetDetectorModuleConfig(const std::vector& net_config) const; }; inline int64_t CalculateStride(const std::chrono::microseconds &frame_time, const std::chrono::microseconds &preview_time) { diff --git a/common/ZMQImagePusher.h b/common/ZMQImagePusher.h index 4d50ef61..4db04990 100644 --- a/common/ZMQImagePusher.h +++ b/common/ZMQImagePusher.h @@ -3,8 +3,6 @@ #ifndef JUNGFRAUJOCH_ZMQIMAGEPUSHER_H #define JUNGFRAUJOCH_ZMQIMAGEPUSHER_H -#include - #include "ImagePusher.h" #include "ThreadSafeFIFO.h" #include "ZMQWrappers.h" diff --git a/common/ZMQPreviewPublisher.h b/common/ZMQPreviewPublisher.h index 6a3c78ca..335c5f05 100644 --- a/common/ZMQPreviewPublisher.h +++ b/common/ZMQPreviewPublisher.h @@ -3,8 +3,6 @@ #ifndef JUNGFRAUJOCH_ZMQPREVIEWPUBLISHER_H #define JUNGFRAUJOCH_ZMQPREVIEWPUBLISHER_H -#include - #include "ZMQWrappers.h" #include "DiffractionExperiment.h" #include "../jungfrau/JFCalibration.h" diff --git a/detector_control/CMakeLists.txt b/detector_control/CMakeLists.txt index 4a7eaadb..6a61cbca 100644 --- a/detector_control/CMakeLists.txt +++ b/detector_control/CMakeLists.txt @@ -1,8 +1,7 @@ ADD_SUBDIRECTORY(slsDetectorPackage) +INSTALL(TARGETS sls_detector_put sls_detector_get RUNTIME) -ADD_EXECUTABLE(jfjoch_detector jfjoch_detector.cpp JFJochDetector.cpp JFJochDetector.h DetectorWrapper.cpp DetectorWrapper.h) +ADD_LIBRARY(JFJochDetector STATIC DetectorWrapper.cpp DetectorWrapper.h) +TARGET_LINK_LIBRARIES(JFJochDetector CommonFunctions slsSupportShared slsDetectorShared) -TARGET_LINK_LIBRARIES(jfjoch_detector CommonFunctions slsSupportShared slsDetectorShared) -INSTALL(TARGETS sls_detector_put sls_detector_get jfjoch_detector RUNTIME) -SET_PROPERTY(TARGET jfjoch_detector PROPERTY INTERPROCEDURAL_OPTIMIZATION True) \ No newline at end of file diff --git a/detector_control/DetectorWrapper.cpp b/detector_control/DetectorWrapper.cpp index 56612377..1041c530 100644 --- a/detector_control/DetectorWrapper.cpp +++ b/detector_control/DetectorWrapper.cpp @@ -6,7 +6,8 @@ #include "../common/JFJochException.h" #include "../common/Definitions.h" -void DetectorWrapper::Configure(const JFJochProtoBuf::DetectorConfig &request) { +void DetectorWrapper::Configure(const DiffractionExperiment& experiment, + const std::vector& net_config) { logger.Info("Configure"); try { if (det.size() > 0) { @@ -19,45 +20,43 @@ void DetectorWrapper::Configure(const JFJochProtoBuf::DetectorConfig &request) { det.setMaster(false, 0); det.setSynchronization(false); } + auto module_hostname = experiment.GetDetectorModuleHostname(); - if (request.module_hostname_size() > 0) { - std::vector module_hostname; - for (const auto &iter: request.module_hostname()) - module_hostname.push_back(iter); + if (!module_hostname.empty() > 0) { logger.Info("Resetting detector module host names"); det.setHostname(module_hostname); } - if (det.size() != request.modules_size()) { + + if (det.size() != experiment.GetModulesNum()) { logger.Error("Discrepancy in module number between DAQ and detector"); throw JFJochException(JFJochExceptionCategory::Detector, "Discrepancy in module number between DAQ and detector"); } - if ((request.udp_interface_count() != 1) && (request.udp_interface_count() != 2)) - throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, - "Only 1 and 2 are supported as UDP interface count"); - det.setNumberofUDPInterfaces(request.udp_interface_count()); + det.setNumberofUDPInterfaces(experiment.GetUDPInterfaceCount()); - for (int i = 0; i < request.modules_size(); i++) { + auto mod_cfg = experiment.GetDetectorModuleConfig(net_config); + + for (int i = 0; i < mod_cfg.size(); i++) { logger.Info("Configure network for module {}", i); - auto &cfg = request.modules(i); + auto &cfg = mod_cfg[i]; - det.setSourceUDPIP(sls::IpAddr(cfg.ipv4_src_addr_1()), {i}); + det.setSourceUDPIP(sls::IpAddr(cfg.ipv4_src_addr_1), {i}); det.setSourceUDPMAC(sls::MacAddr(BASE_DETECTOR_MAC + i * 2), {i}); - det.setDestinationUDPPort (cfg.udp_dest_port_1(), i); - det.setDestinationUDPIP( sls::IpAddr(cfg.ipv4_dest_addr_1()), {i}); - det.setDestinationUDPMAC( sls::MacAddr(cfg.mac_addr_dest_1()), {i}); + det.setDestinationUDPPort (cfg.udp_dest_port_1, i); + det.setDestinationUDPIP( sls::IpAddr(cfg.ipv4_dest_addr_1), {i}); + det.setDestinationUDPMAC( sls::MacAddr(cfg.mac_addr_dest_1), {i}); - if (request.udp_interface_count() == 2) { - det.setSourceUDPIP2(sls::IpAddr(cfg.ipv4_src_addr_2()), {i}); + if (experiment.GetUDPInterfaceCount() == 2) { + det.setSourceUDPIP2(sls::IpAddr(cfg.ipv4_src_addr_2), {i}); det.setSourceUDPMAC2(sls::MacAddr(BASE_DETECTOR_MAC + i * 2 + 1), {i}); - det.setDestinationUDPPort2(cfg.udp_dest_port_2(), i); - det.setDestinationUDPIP2( sls::IpAddr(cfg.ipv4_dest_addr_2()), {i}); - det.setDestinationUDPMAC2(sls::MacAddr(cfg.mac_addr_dest_2()), {i}); + det.setDestinationUDPPort2(cfg.udp_dest_port_2, i); + det.setDestinationUDPIP2( sls::IpAddr(cfg.ipv4_dest_addr_2), {i}); + det.setDestinationUDPMAC2(sls::MacAddr(cfg.mac_addr_dest_2), {i}); } - uint32_t tmp = (cfg.module_id_in_data_stream() * 2) % UINT16_MAX; + uint32_t tmp = (cfg.module_id_in_data_stream * 2) % UINT16_MAX; uint32_t column_id_register = ((tmp + 1) << 16) | tmp; det.writeRegister(0x7C, column_id_register, {i}); @@ -87,20 +86,20 @@ void DetectorWrapper::Configure(const JFJochProtoBuf::DetectorConfig &request) { logger.Info(" ... done"); } -void DetectorWrapper::Start(const JFJochProtoBuf::DetectorInput &request) { +void DetectorWrapper::Start(const DiffractionExperiment& experiment) { logger.Info("Start"); - if (det.size() != request.modules_num()) + if (det.size() != experiment.GetModulesNum()) throw JFJochException(JFJochExceptionCategory::Detector, "Discrepancy in module number between DAQ and detector"); try { InternalStop(); - switch (request.mode()) { - case JFJochProtoBuf::PEDESTAL_G1: + switch (experiment.GetDetectorMode()) { + case DetectorMode::PedestalG1: det.setGainMode(slsDetectorDefs::gainMode::FORCE_SWITCH_G1); break; - case JFJochProtoBuf::PEDESTAL_G2: + case DetectorMode::PedestalG2: det.setGainMode(slsDetectorDefs::gainMode::FORCE_SWITCH_G2); break; default: @@ -109,19 +108,38 @@ void DetectorWrapper::Start(const JFJochProtoBuf::DetectorInput &request) { } det.setNextFrameNumber(1); - det.setNumberOfFrames(request.num_frames()); - det.setNumberOfTriggers(request.num_triggers()); - det.setStorageCellStart(request.storage_cell_start()); - det.setNumberOfAdditionalStorageCells(request.storage_cell_number() - 1); - det.setStorageCellDelay(std::chrono::nanoseconds(request.storage_cell_delay_ns() - MIN_STORAGE_CELL_DELAY_IN_NS)); - if (request.period_us() < MIN_FRAME_TIME_HALF_SPEED_IN_US) + if (experiment.GetNumTriggers() == 1) { + det.setNumberOfFrames(experiment.GetFrameNumPerTrigger() + DELAY_FRAMES_STOP_AND_QUIT); + det.setNumberOfTriggers(1); + } else { + // More than 1 trigger - detector needs one trigger or few more trigger + if (experiment.GetStorageCellNumber() > 1) + det.setNumberOfFrames(1); + else + det.setNumberOfFrames(experiment.GetFrameNumPerTrigger()); + + if (experiment.GetFrameNumPerTrigger() < DELAY_FRAMES_STOP_AND_QUIT) + det.setNumberOfTriggers(experiment.GetNumTriggers() + DELAY_FRAMES_STOP_AND_QUIT); + else + det.setNumberOfTriggers(experiment.GetNumTriggers() + 1); + } + + det.setStorageCellStart(experiment.GetStorageCellStart()); + det.setNumberOfAdditionalStorageCells(experiment.GetStorageCellNumber() - 1); + det.setStorageCellDelay(experiment.GetStorageCellDelay() - std::chrono::nanoseconds(MIN_STORAGE_CELL_DELAY_IN_NS)); + + if ((experiment.GetStorageCellNumber() > 1) || (experiment.GetFrameTime().count() < MIN_FRAME_TIME_HALF_SPEED_IN_US)) det.setReadoutSpeed(slsDetectorDefs::speedLevel::FULL_SPEED); else det.setReadoutSpeed(slsDetectorDefs::speedLevel::HALF_SPEED); - det.setPeriod(std::chrono::microseconds(request.period_us())); - det.setExptime(std::chrono::microseconds(request.count_time_us())); + if (experiment.GetStorageCellNumber() > 1) { + det.setPeriod((experiment.GetFrameTime() + std::chrono::microseconds(10)) * experiment.GetStorageCellNumber() ); + } else + det.setPeriod(experiment.GetFrameTime()); + + det.setExptime(std::chrono::microseconds(experiment.GetFrameCountTime())); det.startDetector(); } catch (std::exception &e) { diff --git a/detector_control/DetectorWrapper.h b/detector_control/DetectorWrapper.h index 759c904c..b86913f0 100644 --- a/detector_control/DetectorWrapper.h +++ b/detector_control/DetectorWrapper.h @@ -4,7 +4,7 @@ #define JUNGFRAUJOCH_DETECTORWRAPPER_H #include -#include +#include "../common/DiffractionExperiment.h" #include "../common/Logger.h" #define BASE_DETECTOR_MAC 0xAABBCCDDEE10 // little-endian! @@ -18,8 +18,8 @@ class DetectorWrapper { public: enum class DetectorState {IDLE, ERROR, BUSY}; [[nodiscard]] DetectorState GetState() const; - void Configure(const JFJochProtoBuf::DetectorConfig &config); - void Start(const JFJochProtoBuf::DetectorInput &request); + void Configure(const DiffractionExperiment& experiment, const std::vector& net_config); + void Start(const DiffractionExperiment& experiment); void Stop(); void Trigger(); void Deactivate(); diff --git a/detector_control/JFJochDetector.cpp b/detector_control/JFJochDetector.cpp deleted file mode 100644 index fa328863..00000000 --- a/detector_control/JFJochDetector.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (2019-2023) Paul Scherrer Institute - -#include "JFJochDetector.h" -#include "../common/JFJochException.h" - -grpc::Status JFJochDetector::Start(grpc::ServerContext *context, const JFJochProtoBuf::DetectorInput *request, - JFJochProtoBuf::Empty *response) { - std::unique_lock ul(m); - - try { - detector.Start(*request); - return grpc::Status::OK; - } catch (JFJochException &e) { - return {grpc::StatusCode::ABORTED, e.what()}; - } -} - -grpc::Status JFJochDetector::Stop(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::Empty *response) { - std::unique_lock ul(m); - - try { - detector.Stop(); - return grpc::Status::OK; - } catch (JFJochException &e) { - return {grpc::StatusCode::ABORTED, e.what()}; - } -} - -grpc::Status JFJochDetector::On(grpc::ServerContext *context, const JFJochProtoBuf::DetectorConfig *request, - JFJochProtoBuf::Empty *response) { - std::unique_lock ul(m); - try { - detector.Configure(*request); - return grpc::Status::OK; - } catch (JFJochException &e) { - return {grpc::StatusCode::ABORTED, e.what()}; - } -} - - -grpc::Status JFJochDetector::Off(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::Empty *response) { - std::unique_lock ul(m); - try { - detector.Deactivate(); - return grpc::Status::OK; - } catch (JFJochException &e) { - return {grpc::StatusCode::ABORTED, e.what()}; - } -} - -grpc::Status JFJochDetector::Status(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::DetectorStatus *response) { - try { - switch(detector.GetState()) { - case DetectorWrapper::DetectorState::IDLE: - response->set_state(JFJochProtoBuf::IDLE); - break; - case DetectorWrapper::DetectorState::ERROR: - response->set_state(JFJochProtoBuf::ERROR); - break; - case DetectorWrapper::DetectorState::BUSY: - response->set_state(JFJochProtoBuf::BUSY); - break; - } - response->set_fw_version(detector.GetFirmwareVersion()); - response->set_server_version(detector.GetDetectorServerVersion()); - - return grpc::Status::OK; - } catch (JFJochException &e) { - return {grpc::StatusCode::ABORTED, e.what()}; - } -} - -grpc::Status JFJochDetector::Trigger(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::Empty *response) { - std::unique_lock ul(m); - try { - detector.Trigger(); - return grpc::Status::OK; - } catch (JFJochException &e) { - return {grpc::StatusCode::ABORTED, e.what()}; - } -} \ No newline at end of file diff --git a/detector_control/JFJochDetector.h b/detector_control/JFJochDetector.h deleted file mode 100644 index 73613726..00000000 --- a/detector_control/JFJochDetector.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (2019-2023) Paul Scherrer Institute - -#ifndef DETECTORWRAPPER_H -#define DETECTORWRAPPER_H - -#include -#include "jfjoch.grpc.pb.h" -#include "DetectorWrapper.h" - -#include "../common/Logger.h" - -class JFJochDetector final : public JFJochProtoBuf::gRPC_JFJochDetector::Service { - std::mutex m; - DetectorWrapper detector; -public: - grpc::Status Start(grpc::ServerContext *context, const JFJochProtoBuf::DetectorInput *request, - JFJochProtoBuf::Empty *response) override; - grpc::Status Stop(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::Empty *response) override; - grpc::Status Status(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::DetectorStatus *response) override; - grpc::Status On(grpc::ServerContext *context, const JFJochProtoBuf::DetectorConfig *request, - JFJochProtoBuf::Empty *response) override; - grpc::Status Off(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::Empty *response) override; - grpc::Status Trigger(grpc::ServerContext *context, const JFJochProtoBuf::Empty *request, - JFJochProtoBuf::Empty *response) override; - -}; - -#endif //JUNGFRAUJOCH_DETECTORWRAPPER_H diff --git a/detector_control/jfjoch_detector.cpp b/detector_control/jfjoch_detector.cpp deleted file mode 100644 index d3f0e133..00000000 --- a/detector_control/jfjoch_detector.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (2019-2023) Paul Scherrer Institute - -#include -#include -#include -#include -#include - -#include "JFJochDetector.h" -#include "../common/Logger.h" -#include "../grpc/gRPCServer_Template.h" - -int main(int argc, char **argv) { - Logger logger("jfjoch_detector"); - - nlohmann::json input; - - std::string grpc_addr = "unix:/opt/jfjoch/.jfjoch-detector"; - if (argc == 2) grpc_addr = "0.0.0.0:" + std::string(argv[1]); - - JFJochDetector service; - - auto server = gRPCServer(grpc_addr, service); - logger.Info("gRPC configuration listening on " + grpc_addr); - server->Wait(); -} diff --git a/grpc/CMakeLists.txt b/grpc/CMakeLists.txt index 3d0b809d..1b6bfcee 100644 --- a/grpc/CMakeLists.txt +++ b/grpc/CMakeLists.txt @@ -47,7 +47,6 @@ TARGET_INCLUDE_DIRECTORIES(JFJochProtoBuf PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) TARGET_LINK_LIBRARIES(JFJochProtoBuf ${_GRPC_GRPCPP}) ADD_LIBRARY(gRPCClients STATIC - JFJochDetectorClient.cpp JFJochDetectorClient.h JFJochWriterClient.cpp JFJochWriterClient.h JFJochWriterGroupClient.cpp JFJochWriterGroupClient.h) diff --git a/grpc/JFJochDetectorClient.cpp b/grpc/JFJochDetectorClient.cpp deleted file mode 100644 index 8c4b81f4..00000000 --- a/grpc/JFJochDetectorClient.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (2019-2023) Paul Scherrer Institute - -#include - -#include "JFJochDetectorClient.h" -#include "../common/JFJochException.h" - -void JFJochDetectorClient::Connect(const std::string &addr) { - if (addr.empty()) _stub.reset(); - else { - _stub = std::make_unique( - grpc::CreateChannel(addr, grpc::InsecureChannelCredentials())); - } -} - -void JFJochDetectorClient::Start(const DiffractionExperiment &in_experiment) { - if (_stub) { - grpc::ClientContext context; - JFJochProtoBuf::DetectorInput request = in_experiment; - JFJochProtoBuf::Empty empty; - auto status = _stub->Start(&context, request, &empty); - if (!status.ok()) throw JFJochException(JFJochExceptionCategory::gRPCError, - "JFJochDetector: " + status.error_message()); - } -} - -void JFJochDetectorClient::Stop() { - if (_stub) { - grpc::ClientContext context; - JFJochProtoBuf::Empty empty; - auto status = _stub->Stop(&context, empty, &empty); - if (!status.ok()) throw JFJochException(JFJochExceptionCategory::gRPCError, - "JFJochDetector: " + status.error_message()); - } -} - -void JFJochDetectorClient::On(const JFJochProtoBuf::DetectorConfig &request) { - if (_stub) { - grpc::ClientContext context; - JFJochProtoBuf::Empty empty; - auto status = _stub->On(&context, request, &empty); - if (!status.ok()) throw JFJochException(JFJochExceptionCategory::gRPCError, - "JFJochDetector: " + status.error_message()); - } -} - -void JFJochDetectorClient::Off() { - if (_stub) { - grpc::ClientContext context; - JFJochProtoBuf::Empty empty; - auto status = _stub->Off(&context, empty, &empty); - if (!status.ok()) throw JFJochException(JFJochExceptionCategory::gRPCError, - "JFJochDetector: " + status.error_message()); - } -} - -void JFJochDetectorClient::Trigger() { - if (_stub) { - grpc::ClientContext context; - JFJochProtoBuf::Empty empty; - auto status = _stub->Trigger(&context, empty, &empty); - if (!status.ok()) throw JFJochException(JFJochExceptionCategory::gRPCError, - "JFJochDetector: " + status.error_message()); - } -} - -JFJochProtoBuf::DetectorStatus JFJochDetectorClient::GetStatus() { - JFJochProtoBuf::DetectorStatus ret; - if (_stub) { - grpc::ClientContext context; - JFJochProtoBuf::Empty empty; - auto status = _stub->Status(&context, empty, &ret); - if (!status.ok()) throw JFJochException(JFJochExceptionCategory::gRPCError, - "JFJochDetector: " + status.error_message()); - } else { - ret.set_state(JFJochProtoBuf::NOT_INITIALIZED); - } - return ret; -} \ No newline at end of file diff --git a/grpc/JFJochDetectorClient.h b/grpc/JFJochDetectorClient.h deleted file mode 100644 index 814ec97d..00000000 --- a/grpc/JFJochDetectorClient.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (2019-2023) Paul Scherrer Institute - -#ifndef JUNGFRAUJOCH_JFJOCHDETECTORCLIENT_H -#define JUNGFRAUJOCH_JFJOCHDETECTORCLIENT_H - -#include -#include - -#include "../common/DiffractionExperiment.h" - -class JFJochDetectorClient { - std::unique_ptr _stub; -public: - void Connect(const std::string &addr); - void Start(const DiffractionExperiment &request); - void Stop(); - JFJochProtoBuf::DetectorStatus GetStatus(); - void On(const JFJochProtoBuf::DetectorConfig &request); - void Off(); - void Trigger(); -}; - - -#endif //JUNGFRAUJOCH_JFJOCHDETECTORCLIENT_H diff --git a/grpc/jfjoch.proto b/grpc/jfjoch.proto index 6d368bb1..4e68c452 100644 --- a/grpc/jfjoch.proto +++ b/grpc/jfjoch.proto @@ -19,12 +19,6 @@ enum DetectorMode { PEDESTAL_G2 = 4; }; -enum FPGAFIFOStatusEnum { - EMPTY = 0; - FULL = 1; - PARTIAL = 2; -} - enum State { NOT_INITIALIZED = 0; IDLE = 1; @@ -181,52 +175,6 @@ message WriterOutput { repeated DataFileStatistics file_statistics = 4; } -// Detector -message DetectorModuleConfig { - uint64 udp_dest_port_1 = 1; - uint64 udp_dest_port_2 = 2; - string ipv4_src_addr_1 = 3; - string ipv4_src_addr_2 = 4; - string ipv4_dest_addr_1 = 5; - string ipv4_dest_addr_2 = 6; - string mac_addr_dest_1 = 7; - string mac_addr_dest_2 = 8; - uint64 module_id_in_data_stream = 9; -} - -message DetectorConfig { - repeated DetectorModuleConfig modules = 1; - repeated string module_hostname = 2; - int64 udp_interface_count = 3; -} - -message DetectorInput { - int64 modules_num = 1; - DetectorMode mode = 2; - int64 num_frames = 3; - int64 num_triggers = 4; - int64 storage_cell_number = 5; - int64 storage_cell_start = 6; - int64 storage_cell_delay_ns = 7; - int64 period_us = 9; - int64 count_time_us = 10; -} - -message DetectorOutput { - -} - -message DetectorStatus { - State state = 1; - int64 fw_version = 2; - string server_version = 3; -} - -message FPGAFIFOStatus { - string name = 1; - FPGAFIFOStatusEnum value = 2; -} - message DataProcessingSettings { float signal_to_noise_threshold = 1; // STRONG_PIXEL in XDS int64 photon_count_threshold = 2; // Threshold in photon counts @@ -302,15 +250,6 @@ service gRPC_JFJochWriter { rpc Stop (Empty) returns (WriterOutput) {} } -service gRPC_JFJochDetector { - rpc Start (DetectorInput) returns (Empty) {} - rpc Stop (Empty) returns (Empty) {} - rpc Status (Empty) returns (DetectorStatus) {} - rpc On (DetectorConfig) returns (Empty) {} - rpc Off (Empty) returns (Empty) {} - rpc Trigger (Empty) returns (Empty) {} -} - service gRPC_JFJochBroker { rpc Start (DatasetSettings) returns (Empty) {} rpc Stop (Empty) returns (Empty) {} diff --git a/jungfrau/JFCalibration.cpp b/jungfrau/JFCalibration.cpp index ad8cefff..3bbdc2d9 100644 --- a/jungfrau/JFCalibration.cpp +++ b/jungfrau/JFCalibration.cpp @@ -3,6 +3,7 @@ #include "JFCalibration.h" #include "../compression/JFJochCompressor.h" +#include JFCalibration::JFCalibration(size_t in_nmodules, size_t in_nstorage_cells) : nmodules(in_nmodules), diff --git a/jungfrau/JFConversionFloatingPoint.cpp b/jungfrau/JFConversionFloatingPoint.cpp index bd4d20c8..54aee99b 100644 --- a/jungfrau/JFConversionFloatingPoint.cpp +++ b/jungfrau/JFConversionFloatingPoint.cpp @@ -1,5 +1,7 @@ // Copyright (2019-2023) Paul Scherrer Institute +#include + #include "JFConversionFloatingPoint.h" JFConversionFloatingPoint::JFConversionFloatingPoint() diff --git a/jungfrau/JFModulePedestal.h b/jungfrau/JFModulePedestal.h index 38e336f5..690fe744 100644 --- a/jungfrau/JFModulePedestal.h +++ b/jungfrau/JFModulePedestal.h @@ -8,7 +8,6 @@ #include #include #include -#include #include "../common/Definitions.h" diff --git a/python/jfjoch_pb2.py b/python/jfjoch_pb2.py index e157cb21..a86382fd 100644 --- a/python/jfjoch_pb2.py +++ b/python/jfjoch_pb2.py @@ -13,25 +13,23 @@ _sym_db = _symbol_database.Default() -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cjfjoch.proto\x12\x0eJFJochProtoBuf\"\x07\n\x05\x45mpty\"W\n\x08UnitCell\x12\t\n\x01\x61\x18\x01 \x01(\x02\x12\t\n\x01\x62\x18\x02 \x01(\x02\x12\t\n\x01\x63\x18\x03 \x01(\x02\x12\r\n\x05\x61lpha\x18\x04 \x01(\x02\x12\x0c\n\x04\x62\x65ta\x18\x05 \x01(\x02\x12\r\n\x05gamma\x18\x06 \x01(\x02\")\n\x06Vector\x12\t\n\x01x\x18\x01 \x01(\x02\x12\t\n\x01y\x18\x02 \x01(\x02\x12\t\n\x01z\x18\x03 \x01(\x02\"|\n\x10RotationSettings\x12\x17\n\x0fstart_angle_deg\x18\x01 \x01(\x02\x12 \n\x18\x61ngle_incr_per_image_deg\x18\x02 \x01(\x02\x12-\n\rrotation_axis\x18\x03 \x01(\x0b\x32\x16.JFJochProtoBuf.Vector\"\x1c\n\x04Plot\x12\t\n\x01x\x18\x01 \x03(\x02\x12\t\n\x01y\x18\x02 \x03(\x02\"\xb1\x04\n\x0f\x44\x61tasetSettings\x12\x1a\n\x12images_per_trigger\x18\x01 \x01(\x03\x12\x10\n\x08ntrigger\x18\x02 \x01(\x03\x12:\n\x11\x66pga_pixel_output\x18\x03 \x01(\x0e\x32\x1f.JFJochProtoBuf.FPGAPixelOutput\x12\x11\n\tsummation\x18\x04 \x01(\x03\x12\x12\n\nbeam_x_pxl\x18\x05 \x01(\x02\x12\x12\n\nbeam_y_pxl\x18\x06 \x01(\x02\x12\x1c\n\x14\x64\x65tector_distance_mm\x18\x07 \x01(\x02\x12\x19\n\x11photon_energy_keV\x18\x08 \x01(\x02\x12\x13\n\x0b\x66ile_prefix\x18\t \x01(\t\x12\x17\n\x0f\x64\x61ta_file_count\x18\n \x01(\x03\x12\x30\n\x0b\x63ompression\x18\x0b \x01(\x0e\x32\x1b.JFJochProtoBuf.Compression\x12\x13\n\x0bsample_name\x18\x0c \x01(\t\x12+\n\tunit_cell\x18\r \x01(\x0b\x32\x18.JFJochProtoBuf.UnitCell\x12\x1a\n\x12space_group_number\x18\x0e \x01(\x03\x12 \n\x18rad_int_solid_angle_corr\x18\x12 \x01(\x08\x12!\n\x19rad_int_polarization_corr\x18\x13 \x01(\x08\x12#\n\x1brad_int_polarization_factor\x18\x14 \x01(\x02\x12\x18\n\x10save_calibration\x18\x15 \x01(\x08\"\x90\x02\n\x10\x44\x65tectorSettings\x12\x15\n\rframe_time_us\x18\x01 \x01(\x03\x12\x15\n\rcount_time_us\x18\x02 \x01(\x03\x12\x1a\n\x12storage_cell_count\x18\x03 \x01(\x03\x12%\n\x1duse_internal_packet_generator\x18\x04 \x01(\x08\x12\x18\n\x10\x63ollect_raw_data\x18\x05 \x01(\x08\x12\x1a\n\x12pedestal_g0_frames\x18\x06 \x01(\x03\x12\x1a\n\x12pedestal_g1_frames\x18\x07 \x01(\x03\x12\x1a\n\x12pedestal_g2_frames\x18\x08 \x01(\x03\x12\x1d\n\x15storage_cell_delay_ns\x18\n \x01(\x03\"\xed\x01\n\x10ModuleStatistics\x12\x15\n\rmodule_number\x18\x01 \x01(\x03\x12\x1b\n\x13storage_cell_number\x18\x02 \x01(\x03\x12\x18\n\x10pedestal_g0_mean\x18\x03 \x01(\x02\x12\x18\n\x10pedestal_g1_mean\x18\x04 \x01(\x02\x12\x18\n\x10pedestal_g2_mean\x18\x05 \x01(\x02\x12\x14\n\x0cgain_g0_mean\x18\x06 \x01(\x02\x12\x14\n\x0cgain_g1_mean\x18\x07 \x01(\x02\x12\x14\n\x0cgain_g2_mean\x18\x08 \x01(\x02\x12\x15\n\rmasked_pixels\x18\t \x01(\x04\"V\n\x17JFCalibrationStatistics\x12;\n\x11module_statistics\x18\x01 \x03(\x0b\x32 .JFJochProtoBuf.ModuleStatistics\"F\n\x0bPlotRequest\x12&\n\x04type\x18\x01 \x01(\x0e\x32\x18.JFJochProtoBuf.PlotType\x12\x0f\n\x07\x62inning\x18\x02 \x01(\x04\"M\n\x18RadialIntegrationProfile\x12\r\n\x05title\x18\x01 \x01(\t\x12\"\n\x04plot\x18\x02 \x01(\x0b\x32\x14.JFJochProtoBuf.Plot\"W\n\x19RadialIntegrationProfiles\x12:\n\x08profiles\x18\x01 \x03(\x0b\x32(.JFJochProtoBuf.RadialIntegrationProfile\">\n\x0bWriterInput\x12\x1c\n\x14zmq_receiver_address\x18\x01 \x01(\t\x12\x11\n\tseries_id\x18\x02 \x01(\x03\"3\n\x12\x44\x61taFileStatistics\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07nimages\x18\x02 \x01(\x03\"\x8d\x01\n\x0cWriterOutput\x12\x0f\n\x07nimages\x18\x01 \x01(\x03\x12\x17\n\x0fperformance_MBs\x18\x02 \x01(\x02\x12\x16\n\x0eperformance_Hz\x18\x03 \x01(\x02\x12;\n\x0f\x66ile_statistics\x18\x04 \x03(\x0b\x32\".JFJochProtoBuf.DataFileStatistics\"\x82\x02\n\x14\x44\x65tectorModuleConfig\x12\x17\n\x0fudp_dest_port_1\x18\x01 \x01(\x04\x12\x17\n\x0fudp_dest_port_2\x18\x02 \x01(\x04\x12\x17\n\x0fipv4_src_addr_1\x18\x03 \x01(\t\x12\x17\n\x0fipv4_src_addr_2\x18\x04 \x01(\t\x12\x18\n\x10ipv4_dest_addr_1\x18\x05 \x01(\t\x12\x18\n\x10ipv4_dest_addr_2\x18\x06 \x01(\t\x12\x17\n\x0fmac_addr_dest_1\x18\x07 \x01(\t\x12\x17\n\x0fmac_addr_dest_2\x18\x08 \x01(\t\x12 \n\x18module_id_in_data_stream\x18\t \x01(\x04\"}\n\x0e\x44\x65tectorConfig\x12\x35\n\x07modules\x18\x01 \x03(\x0b\x32$.JFJochProtoBuf.DetectorModuleConfig\x12\x17\n\x0fmodule_hostname\x18\x02 \x03(\t\x12\x1b\n\x13udp_interface_count\x18\x03 \x01(\x03\"\xfc\x01\n\rDetectorInput\x12\x13\n\x0bmodules_num\x18\x01 \x01(\x03\x12*\n\x04mode\x18\x02 \x01(\x0e\x32\x1c.JFJochProtoBuf.DetectorMode\x12\x12\n\nnum_frames\x18\x03 \x01(\x03\x12\x14\n\x0cnum_triggers\x18\x04 \x01(\x03\x12\x1b\n\x13storage_cell_number\x18\x05 \x01(\x03\x12\x1a\n\x12storage_cell_start\x18\x06 \x01(\x03\x12\x1d\n\x15storage_cell_delay_ns\x18\x07 \x01(\x03\x12\x11\n\tperiod_us\x18\t \x01(\x03\x12\x15\n\rcount_time_us\x18\n \x01(\x03\"\x10\n\x0e\x44\x65tectorOutput\"b\n\x0e\x44\x65tectorStatus\x12$\n\x05state\x18\x01 \x01(\x0e\x32\x15.JFJochProtoBuf.State\x12\x12\n\nfw_version\x18\x02 \x01(\x03\x12\x16\n\x0eserver_version\x18\x03 \x01(\t\"Q\n\x0e\x46PGAFIFOStatus\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x31\n\x05value\x18\x02 \x01(\x0e\x32\".JFJochProtoBuf.FPGAFIFOStatusEnum\"\xbb\x02\n\x16\x44\x61taProcessingSettings\x12!\n\x19signal_to_noise_threshold\x18\x01 \x01(\x02\x12\x1e\n\x16photon_count_threshold\x18\x02 \x01(\x03\x12\x18\n\x10min_pix_per_spot\x18\x03 \x01(\x03\x12\x18\n\x10max_pix_per_spot\x18\x04 \x01(\x03\x12\x16\n\x0elocal_bkg_size\x18\x05 \x01(\x03\x12\x1d\n\x15high_resolution_limit\x18\x06 \x01(\x02\x12\x1c\n\x14low_resolution_limit\x18\x07 \x01(\x02\x12\x1a\n\x12\x62kg_estimate_low_q\x18\x08 \x01(\x02\x12\x1b\n\x13\x62kg_estimate_high_q\x18\t \x01(\x02\x12\x1c\n\x14preview_indexed_only\x18\n \x01(\x08\"I\n\x05Image\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\r\n\x05width\x18\x02 \x01(\x03\x12\x0e\n\x06height\x18\x03 \x01(\x03\x12\x13\n\x0bpixel_depth\x18\x04 \x01(\x03\".\n\nMaskToLoad\x12\x0c\n\x04mask\x18\x01 \x03(\r\x12\x12\n\nbit_to_set\x18\x02 \x01(\x05\"\xc9\x02\n\x15MeasurementStatistics\x12\x13\n\x0b\x66ile_prefix\x18\x01 \x01(\t\x12\x18\n\x10images_collected\x18\x02 \x01(\x03\x12\x1d\n\x15max_image_number_sent\x18\x03 \x01(\x03\x12\x1d\n\x15\x63ollection_efficiency\x18\x04 \x01(\x02\x12\x19\n\x11\x63ompression_ratio\x18\x05 \x01(\x02\x12\x11\n\tcancelled\x18\x06 \x01(\x08\x12\x19\n\x11max_receive_delay\x18\x07 \x01(\x03\x12\x15\n\rindexing_rate\x18\n \x01(\x02\x12\x16\n\x0e\x64\x65tector_width\x18\x0c \x01(\x03\x12\x17\n\x0f\x64\x65tector_height\x18\r \x01(\x03\x12\x1c\n\x14\x64\x65tector_pixel_depth\x18\x0e \x01(\x03\x12\x14\n\x0c\x62kg_estimate\x18\x10 \x01(\x02\"\x89\x01\n\x0c\x42rokerStatus\x12+\n\x0c\x62roker_state\x18\x01 \x01(\x0e\x32\x15.JFJochProtoBuf.State\x12\x10\n\x08progress\x18\x02 \x01(\x02\x12\x15\n\rindexing_rate\x18\x03 \x01(\x02\x12#\n\x1breceiver_send_buffers_avail\x18\x04 \x01(\x02\"H\n\x13\x44\x65tectorListElement\x12\x13\n\x0b\x64\x65scription\x18\x01 \x01(\t\x12\x10\n\x08nmodules\x18\x02 \x01(\x03\x12\n\n\x02id\x18\x03 \x01(\x03\"v\n\x0c\x44\x65tectorList\x12\x35\n\x08\x64\x65tector\x18\x01 \x03(\x0b\x32#.JFJochProtoBuf.DetectorListElement\x12\x12\n\ncurrent_id\x18\x02 \x01(\x03\x12\x1b\n\x13\x63urrent_description\x18\x03 \x01(\t\"\x1f\n\x11\x44\x65tectorSelection\x12\n\n\x02id\x18\x01 \x01(\x03*T\n\x0b\x43ompression\x12\r\n\tBSHUF_LZ4\x10\x00\x12\x0e\n\nBSHUF_ZSTD\x10\x01\x12\x12\n\x0e\x42SHUF_ZSTD_RLE\x10\x02\x12\x12\n\x0eNO_COMPRESSION\x10\x03*Z\n\x0c\x44\x65tectorMode\x12\x0e\n\nCONVERSION\x10\x00\x12\x07\n\x03RAW\x10\x01\x12\x0f\n\x0bPEDESTAL_G0\x10\x02\x12\x0f\n\x0bPEDESTAL_G1\x10\x03\x12\x0f\n\x0bPEDESTAL_G2\x10\x04*6\n\x12\x46PGAFIFOStatusEnum\x12\t\n\x05\x45MPTY\x10\x00\x12\x08\n\x04\x46ULL\x10\x01\x12\x0b\n\x07PARTIAL\x10\x02*^\n\x05State\x12\x13\n\x0fNOT_INITIALIZED\x10\x00\x12\x08\n\x04IDLE\x10\x01\x12\x08\n\x04\x42USY\x10\x02\x12\x0c\n\x08PEDESTAL\x10\x03\x12\x13\n\x0f\x44\x41TA_COLLECTION\x10\x04\x12\t\n\x05\x45RROR\x10\x05*I\n\x0f\x46PGAPixelOutput\x12\x08\n\x04\x41UTO\x10\x00\x12\t\n\x05INT16\x10\x01\x12\n\n\x06UINT16\x10\x02\x12\t\n\x05INT32\x10\x03\x12\n\n\x06UINT32\x10\x04*{\n\x08PlotType\x12\x10\n\x0c\x42KG_ESTIMATE\x10\x00\x12\x0b\n\x07RAD_INT\x10\x01\x12\x0e\n\nSPOT_COUNT\x10\x02\x12\x11\n\rINDEXING_RATE\x10\x03\x12\x1a\n\x16INDEXING_RATE_PER_FILE\x10\x04\x12\x11\n\rADU_HISTOGRAM\x10\x05\x32\xca\x01\n\x11gRPC_JFJochWriter\x12=\n\x05Start\x12\x1b.JFJochProtoBuf.WriterInput\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x37\n\x05\x41\x62ort\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12=\n\x04Stop\x12\x15.JFJochProtoBuf.Empty\x1a\x1c.JFJochProtoBuf.WriterOutput\"\x00\x32\x82\x03\n\x13gRPC_JFJochDetector\x12?\n\x05Start\x12\x1d.JFJochProtoBuf.DetectorInput\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x36\n\x04Stop\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x41\n\x06Status\x12\x15.JFJochProtoBuf.Empty\x1a\x1e.JFJochProtoBuf.DetectorStatus\"\x00\x12=\n\x02On\x12\x1e.JFJochProtoBuf.DetectorConfig\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x35\n\x03Off\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x39\n\x07Trigger\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x32\xd4\x0c\n\x11gRPC_JFJochBroker\x12\x41\n\x05Start\x12\x1f.JFJochProtoBuf.DatasetSettings\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x36\n\x04Stop\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12:\n\x08Pedestal\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12<\n\nInitialize\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x38\n\x06\x43\x61ncel\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12<\n\nDeactivate\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x39\n\x07Trigger\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x42\n\tGetStatus\x12\x15.JFJochProtoBuf.Empty\x1a\x1c.JFJochProtoBuf.BrokerStatus\"\x00\x12\\\n\x18GetCalibrationStatistics\x12\x15.JFJochProtoBuf.Empty\x1a\'.JFJochProtoBuf.JFCalibrationStatistics\"\x00\x12P\n\x13GetDetectorSettings\x12\x15.JFJochProtoBuf.Empty\x1a .JFJochProtoBuf.DetectorSettings\"\x00\x12P\n\x13PutDetectorSettings\x12 .JFJochProtoBuf.DetectorSettings\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12Z\n\x18GetMeasurementStatistics\x12\x15.JFJochProtoBuf.Empty\x1a%.JFJochProtoBuf.MeasurementStatistics\"\x00\x12\\\n\x19GetDataProcessingSettings\x12\x15.JFJochProtoBuf.Empty\x1a&.JFJochProtoBuf.DataProcessingSettings\"\x00\x12\\\n\x19PutDataProcessingSettings\x12&.JFJochProtoBuf.DataProcessingSettings\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12?\n\x08GetPlots\x12\x1b.JFJochProtoBuf.PlotRequest\x1a\x14.JFJochProtoBuf.Plot\"\x00\x12\x62\n\x1cGetRadialIntegrationProfiles\x12\x15.JFJochProtoBuf.Empty\x1a).JFJochProtoBuf.RadialIntegrationProfiles\"\x00\x12?\n\rGetPedestalG0\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Image\"\x00\x12?\n\rGetPedestalG1\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Image\"\x00\x12?\n\rGetPedestalG2\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Image\"\x00\x12\x39\n\x07GetMask\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Image\"\x00\x12H\n\x0fGetDetectorList\x12\x15.JFJochProtoBuf.Empty\x1a\x1c.JFJochProtoBuf.DetectorList\"\x00\x12L\n\x0eSelectDetector\x12!.JFJochProtoBuf.DetectorSelection\x1a\x15.JFJochProtoBuf.Empty\"\x00\x62\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0cjfjoch.proto\x12\x0eJFJochProtoBuf\"\x07\n\x05\x45mpty\"W\n\x08UnitCell\x12\t\n\x01\x61\x18\x01 \x01(\x02\x12\t\n\x01\x62\x18\x02 \x01(\x02\x12\t\n\x01\x63\x18\x03 \x01(\x02\x12\r\n\x05\x61lpha\x18\x04 \x01(\x02\x12\x0c\n\x04\x62\x65ta\x18\x05 \x01(\x02\x12\r\n\x05gamma\x18\x06 \x01(\x02\")\n\x06Vector\x12\t\n\x01x\x18\x01 \x01(\x02\x12\t\n\x01y\x18\x02 \x01(\x02\x12\t\n\x01z\x18\x03 \x01(\x02\"|\n\x10RotationSettings\x12\x17\n\x0fstart_angle_deg\x18\x01 \x01(\x02\x12 \n\x18\x61ngle_incr_per_image_deg\x18\x02 \x01(\x02\x12-\n\rrotation_axis\x18\x03 \x01(\x0b\x32\x16.JFJochProtoBuf.Vector\"\x1c\n\x04Plot\x12\t\n\x01x\x18\x01 \x03(\x02\x12\t\n\x01y\x18\x02 \x03(\x02\"\xb1\x04\n\x0f\x44\x61tasetSettings\x12\x1a\n\x12images_per_trigger\x18\x01 \x01(\x03\x12\x10\n\x08ntrigger\x18\x02 \x01(\x03\x12:\n\x11\x66pga_pixel_output\x18\x03 \x01(\x0e\x32\x1f.JFJochProtoBuf.FPGAPixelOutput\x12\x11\n\tsummation\x18\x04 \x01(\x03\x12\x12\n\nbeam_x_pxl\x18\x05 \x01(\x02\x12\x12\n\nbeam_y_pxl\x18\x06 \x01(\x02\x12\x1c\n\x14\x64\x65tector_distance_mm\x18\x07 \x01(\x02\x12\x19\n\x11photon_energy_keV\x18\x08 \x01(\x02\x12\x13\n\x0b\x66ile_prefix\x18\t \x01(\t\x12\x17\n\x0f\x64\x61ta_file_count\x18\n \x01(\x03\x12\x30\n\x0b\x63ompression\x18\x0b \x01(\x0e\x32\x1b.JFJochProtoBuf.Compression\x12\x13\n\x0bsample_name\x18\x0c \x01(\t\x12+\n\tunit_cell\x18\r \x01(\x0b\x32\x18.JFJochProtoBuf.UnitCell\x12\x1a\n\x12space_group_number\x18\x0e \x01(\x03\x12 \n\x18rad_int_solid_angle_corr\x18\x12 \x01(\x08\x12!\n\x19rad_int_polarization_corr\x18\x13 \x01(\x08\x12#\n\x1brad_int_polarization_factor\x18\x14 \x01(\x02\x12\x18\n\x10save_calibration\x18\x15 \x01(\x08\"\x90\x02\n\x10\x44\x65tectorSettings\x12\x15\n\rframe_time_us\x18\x01 \x01(\x03\x12\x15\n\rcount_time_us\x18\x02 \x01(\x03\x12\x1a\n\x12storage_cell_count\x18\x03 \x01(\x03\x12%\n\x1duse_internal_packet_generator\x18\x04 \x01(\x08\x12\x18\n\x10\x63ollect_raw_data\x18\x05 \x01(\x08\x12\x1a\n\x12pedestal_g0_frames\x18\x06 \x01(\x03\x12\x1a\n\x12pedestal_g1_frames\x18\x07 \x01(\x03\x12\x1a\n\x12pedestal_g2_frames\x18\x08 \x01(\x03\x12\x1d\n\x15storage_cell_delay_ns\x18\n \x01(\x03\"\xed\x01\n\x10ModuleStatistics\x12\x15\n\rmodule_number\x18\x01 \x01(\x03\x12\x1b\n\x13storage_cell_number\x18\x02 \x01(\x03\x12\x18\n\x10pedestal_g0_mean\x18\x03 \x01(\x02\x12\x18\n\x10pedestal_g1_mean\x18\x04 \x01(\x02\x12\x18\n\x10pedestal_g2_mean\x18\x05 \x01(\x02\x12\x14\n\x0cgain_g0_mean\x18\x06 \x01(\x02\x12\x14\n\x0cgain_g1_mean\x18\x07 \x01(\x02\x12\x14\n\x0cgain_g2_mean\x18\x08 \x01(\x02\x12\x15\n\rmasked_pixels\x18\t \x01(\x04\"V\n\x17JFCalibrationStatistics\x12;\n\x11module_statistics\x18\x01 \x03(\x0b\x32 .JFJochProtoBuf.ModuleStatistics\"F\n\x0bPlotRequest\x12&\n\x04type\x18\x01 \x01(\x0e\x32\x18.JFJochProtoBuf.PlotType\x12\x0f\n\x07\x62inning\x18\x02 \x01(\x04\"M\n\x18RadialIntegrationProfile\x12\r\n\x05title\x18\x01 \x01(\t\x12\"\n\x04plot\x18\x02 \x01(\x0b\x32\x14.JFJochProtoBuf.Plot\"W\n\x19RadialIntegrationProfiles\x12:\n\x08profiles\x18\x01 \x03(\x0b\x32(.JFJochProtoBuf.RadialIntegrationProfile\">\n\x0bWriterInput\x12\x1c\n\x14zmq_receiver_address\x18\x01 \x01(\t\x12\x11\n\tseries_id\x18\x02 \x01(\x03\"3\n\x12\x44\x61taFileStatistics\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x0f\n\x07nimages\x18\x02 \x01(\x03\"\x8d\x01\n\x0cWriterOutput\x12\x0f\n\x07nimages\x18\x01 \x01(\x03\x12\x17\n\x0fperformance_MBs\x18\x02 \x01(\x02\x12\x16\n\x0eperformance_Hz\x18\x03 \x01(\x02\x12;\n\x0f\x66ile_statistics\x18\x04 \x03(\x0b\x32\".JFJochProtoBuf.DataFileStatistics\"\xbb\x02\n\x16\x44\x61taProcessingSettings\x12!\n\x19signal_to_noise_threshold\x18\x01 \x01(\x02\x12\x1e\n\x16photon_count_threshold\x18\x02 \x01(\x03\x12\x18\n\x10min_pix_per_spot\x18\x03 \x01(\x03\x12\x18\n\x10max_pix_per_spot\x18\x04 \x01(\x03\x12\x16\n\x0elocal_bkg_size\x18\x05 \x01(\x03\x12\x1d\n\x15high_resolution_limit\x18\x06 \x01(\x02\x12\x1c\n\x14low_resolution_limit\x18\x07 \x01(\x02\x12\x1a\n\x12\x62kg_estimate_low_q\x18\x08 \x01(\x02\x12\x1b\n\x13\x62kg_estimate_high_q\x18\t \x01(\x02\x12\x1c\n\x14preview_indexed_only\x18\n \x01(\x08\"I\n\x05Image\x12\x0c\n\x04\x64\x61ta\x18\x01 \x01(\x0c\x12\r\n\x05width\x18\x02 \x01(\x03\x12\x0e\n\x06height\x18\x03 \x01(\x03\x12\x13\n\x0bpixel_depth\x18\x04 \x01(\x03\".\n\nMaskToLoad\x12\x0c\n\x04mask\x18\x01 \x03(\r\x12\x12\n\nbit_to_set\x18\x02 \x01(\x05\"\xc9\x02\n\x15MeasurementStatistics\x12\x13\n\x0b\x66ile_prefix\x18\x01 \x01(\t\x12\x18\n\x10images_collected\x18\x02 \x01(\x03\x12\x1d\n\x15max_image_number_sent\x18\x03 \x01(\x03\x12\x1d\n\x15\x63ollection_efficiency\x18\x04 \x01(\x02\x12\x19\n\x11\x63ompression_ratio\x18\x05 \x01(\x02\x12\x11\n\tcancelled\x18\x06 \x01(\x08\x12\x19\n\x11max_receive_delay\x18\x07 \x01(\x03\x12\x15\n\rindexing_rate\x18\n \x01(\x02\x12\x16\n\x0e\x64\x65tector_width\x18\x0c \x01(\x03\x12\x17\n\x0f\x64\x65tector_height\x18\r \x01(\x03\x12\x1c\n\x14\x64\x65tector_pixel_depth\x18\x0e \x01(\x03\x12\x14\n\x0c\x62kg_estimate\x18\x10 \x01(\x02\"\x89\x01\n\x0c\x42rokerStatus\x12+\n\x0c\x62roker_state\x18\x01 \x01(\x0e\x32\x15.JFJochProtoBuf.State\x12\x10\n\x08progress\x18\x02 \x01(\x02\x12\x15\n\rindexing_rate\x18\x03 \x01(\x02\x12#\n\x1breceiver_send_buffers_avail\x18\x04 \x01(\x02\"H\n\x13\x44\x65tectorListElement\x12\x13\n\x0b\x64\x65scription\x18\x01 \x01(\t\x12\x10\n\x08nmodules\x18\x02 \x01(\x03\x12\n\n\x02id\x18\x03 \x01(\x03\"v\n\x0c\x44\x65tectorList\x12\x35\n\x08\x64\x65tector\x18\x01 \x03(\x0b\x32#.JFJochProtoBuf.DetectorListElement\x12\x12\n\ncurrent_id\x18\x02 \x01(\x03\x12\x1b\n\x13\x63urrent_description\x18\x03 \x01(\t\"\x1f\n\x11\x44\x65tectorSelection\x12\n\n\x02id\x18\x01 \x01(\x03*T\n\x0b\x43ompression\x12\r\n\tBSHUF_LZ4\x10\x00\x12\x0e\n\nBSHUF_ZSTD\x10\x01\x12\x12\n\x0e\x42SHUF_ZSTD_RLE\x10\x02\x12\x12\n\x0eNO_COMPRESSION\x10\x03*Z\n\x0c\x44\x65tectorMode\x12\x0e\n\nCONVERSION\x10\x00\x12\x07\n\x03RAW\x10\x01\x12\x0f\n\x0bPEDESTAL_G0\x10\x02\x12\x0f\n\x0bPEDESTAL_G1\x10\x03\x12\x0f\n\x0bPEDESTAL_G2\x10\x04*^\n\x05State\x12\x13\n\x0fNOT_INITIALIZED\x10\x00\x12\x08\n\x04IDLE\x10\x01\x12\x08\n\x04\x42USY\x10\x02\x12\x0c\n\x08PEDESTAL\x10\x03\x12\x13\n\x0f\x44\x41TA_COLLECTION\x10\x04\x12\t\n\x05\x45RROR\x10\x05*I\n\x0f\x46PGAPixelOutput\x12\x08\n\x04\x41UTO\x10\x00\x12\t\n\x05INT16\x10\x01\x12\n\n\x06UINT16\x10\x02\x12\t\n\x05INT32\x10\x03\x12\n\n\x06UINT32\x10\x04*{\n\x08PlotType\x12\x10\n\x0c\x42KG_ESTIMATE\x10\x00\x12\x0b\n\x07RAD_INT\x10\x01\x12\x0e\n\nSPOT_COUNT\x10\x02\x12\x11\n\rINDEXING_RATE\x10\x03\x12\x1a\n\x16INDEXING_RATE_PER_FILE\x10\x04\x12\x11\n\rADU_HISTOGRAM\x10\x05\x32\xca\x01\n\x11gRPC_JFJochWriter\x12=\n\x05Start\x12\x1b.JFJochProtoBuf.WriterInput\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x37\n\x05\x41\x62ort\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12=\n\x04Stop\x12\x15.JFJochProtoBuf.Empty\x1a\x1c.JFJochProtoBuf.WriterOutput\"\x00\x32\xd4\x0c\n\x11gRPC_JFJochBroker\x12\x41\n\x05Start\x12\x1f.JFJochProtoBuf.DatasetSettings\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x36\n\x04Stop\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12:\n\x08Pedestal\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12<\n\nInitialize\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x38\n\x06\x43\x61ncel\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12<\n\nDeactivate\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x39\n\x07Trigger\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12\x42\n\tGetStatus\x12\x15.JFJochProtoBuf.Empty\x1a\x1c.JFJochProtoBuf.BrokerStatus\"\x00\x12\\\n\x18GetCalibrationStatistics\x12\x15.JFJochProtoBuf.Empty\x1a\'.JFJochProtoBuf.JFCalibrationStatistics\"\x00\x12P\n\x13GetDetectorSettings\x12\x15.JFJochProtoBuf.Empty\x1a .JFJochProtoBuf.DetectorSettings\"\x00\x12P\n\x13PutDetectorSettings\x12 .JFJochProtoBuf.DetectorSettings\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12Z\n\x18GetMeasurementStatistics\x12\x15.JFJochProtoBuf.Empty\x1a%.JFJochProtoBuf.MeasurementStatistics\"\x00\x12\\\n\x19GetDataProcessingSettings\x12\x15.JFJochProtoBuf.Empty\x1a&.JFJochProtoBuf.DataProcessingSettings\"\x00\x12\\\n\x19PutDataProcessingSettings\x12&.JFJochProtoBuf.DataProcessingSettings\x1a\x15.JFJochProtoBuf.Empty\"\x00\x12?\n\x08GetPlots\x12\x1b.JFJochProtoBuf.PlotRequest\x1a\x14.JFJochProtoBuf.Plot\"\x00\x12\x62\n\x1cGetRadialIntegrationProfiles\x12\x15.JFJochProtoBuf.Empty\x1a).JFJochProtoBuf.RadialIntegrationProfiles\"\x00\x12?\n\rGetPedestalG0\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Image\"\x00\x12?\n\rGetPedestalG1\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Image\"\x00\x12?\n\rGetPedestalG2\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Image\"\x00\x12\x39\n\x07GetMask\x12\x15.JFJochProtoBuf.Empty\x1a\x15.JFJochProtoBuf.Image\"\x00\x12H\n\x0fGetDetectorList\x12\x15.JFJochProtoBuf.Empty\x1a\x1c.JFJochProtoBuf.DetectorList\"\x00\x12L\n\x0eSelectDetector\x12!.JFJochProtoBuf.DetectorSelection\x1a\x15.JFJochProtoBuf.Empty\"\x00\x62\x06proto3') _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'jfjoch_pb2', globals()) if _descriptor._USE_C_DESCRIPTORS == False: DESCRIPTOR._options = None - _COMPRESSION._serialized_start=3981 - _COMPRESSION._serialized_end=4065 - _DETECTORMODE._serialized_start=4067 - _DETECTORMODE._serialized_end=4157 - _FPGAFIFOSTATUSENUM._serialized_start=4159 - _FPGAFIFOSTATUSENUM._serialized_end=4213 - _STATE._serialized_start=4215 - _STATE._serialized_end=4309 - _FPGAPIXELOUTPUT._serialized_start=4311 - _FPGAPIXELOUTPUT._serialized_end=4384 - _PLOTTYPE._serialized_start=4386 - _PLOTTYPE._serialized_end=4509 + _COMPRESSION._serialized_start=3137 + _COMPRESSION._serialized_end=3221 + _DETECTORMODE._serialized_start=3223 + _DETECTORMODE._serialized_end=3313 + _STATE._serialized_start=3315 + _STATE._serialized_end=3409 + _FPGAPIXELOUTPUT._serialized_start=3411 + _FPGAPIXELOUTPUT._serialized_end=3484 + _PLOTTYPE._serialized_start=3486 + _PLOTTYPE._serialized_end=3609 _EMPTY._serialized_start=32 _EMPTY._serialized_end=39 _UNITCELL._serialized_start=41 @@ -62,38 +60,24 @@ if _descriptor._USE_C_DESCRIPTORS == False: _DATAFILESTATISTICS._serialized_end=1851 _WRITEROUTPUT._serialized_start=1854 _WRITEROUTPUT._serialized_end=1995 - _DETECTORMODULECONFIG._serialized_start=1998 - _DETECTORMODULECONFIG._serialized_end=2256 - _DETECTORCONFIG._serialized_start=2258 - _DETECTORCONFIG._serialized_end=2383 - _DETECTORINPUT._serialized_start=2386 - _DETECTORINPUT._serialized_end=2638 - _DETECTOROUTPUT._serialized_start=2640 - _DETECTOROUTPUT._serialized_end=2656 - _DETECTORSTATUS._serialized_start=2658 - _DETECTORSTATUS._serialized_end=2756 - _FPGAFIFOSTATUS._serialized_start=2758 - _FPGAFIFOSTATUS._serialized_end=2839 - _DATAPROCESSINGSETTINGS._serialized_start=2842 - _DATAPROCESSINGSETTINGS._serialized_end=3157 - _IMAGE._serialized_start=3159 - _IMAGE._serialized_end=3232 - _MASKTOLOAD._serialized_start=3234 - _MASKTOLOAD._serialized_end=3280 - _MEASUREMENTSTATISTICS._serialized_start=3283 - _MEASUREMENTSTATISTICS._serialized_end=3612 - _BROKERSTATUS._serialized_start=3615 - _BROKERSTATUS._serialized_end=3752 - _DETECTORLISTELEMENT._serialized_start=3754 - _DETECTORLISTELEMENT._serialized_end=3826 - _DETECTORLIST._serialized_start=3828 - _DETECTORLIST._serialized_end=3946 - _DETECTORSELECTION._serialized_start=3948 - _DETECTORSELECTION._serialized_end=3979 - _GRPC_JFJOCHWRITER._serialized_start=4512 - _GRPC_JFJOCHWRITER._serialized_end=4714 - _GRPC_JFJOCHDETECTOR._serialized_start=4717 - _GRPC_JFJOCHDETECTOR._serialized_end=5103 - _GRPC_JFJOCHBROKER._serialized_start=5106 - _GRPC_JFJOCHBROKER._serialized_end=6726 + _DATAPROCESSINGSETTINGS._serialized_start=1998 + _DATAPROCESSINGSETTINGS._serialized_end=2313 + _IMAGE._serialized_start=2315 + _IMAGE._serialized_end=2388 + _MASKTOLOAD._serialized_start=2390 + _MASKTOLOAD._serialized_end=2436 + _MEASUREMENTSTATISTICS._serialized_start=2439 + _MEASUREMENTSTATISTICS._serialized_end=2768 + _BROKERSTATUS._serialized_start=2771 + _BROKERSTATUS._serialized_end=2908 + _DETECTORLISTELEMENT._serialized_start=2910 + _DETECTORLISTELEMENT._serialized_end=2982 + _DETECTORLIST._serialized_start=2984 + _DETECTORLIST._serialized_end=3102 + _DETECTORSELECTION._serialized_start=3104 + _DETECTORSELECTION._serialized_end=3135 + _GRPC_JFJOCHWRITER._serialized_start=3612 + _GRPC_JFJOCHWRITER._serialized_end=3814 + _GRPC_JFJOCHBROKER._serialized_start=3817 + _GRPC_JFJOCHBROKER._serialized_end=5437 # @@protoc_insertion_point(module_scope) diff --git a/python/jfjoch_pb2_grpc.py b/python/jfjoch_pb2_grpc.py index 79328e11..b3e11cda 100644 --- a/python/jfjoch_pb2_grpc.py +++ b/python/jfjoch_pb2_grpc.py @@ -132,232 +132,6 @@ class gRPC_JFJochWriter(object): insecure, call_credentials, compression, wait_for_ready, timeout, metadata) -class gRPC_JFJochDetectorStub(object): - """Missing associated documentation comment in .proto file.""" - - def __init__(self, channel): - """Constructor. - - Args: - channel: A grpc.Channel. - """ - self.Start = channel.unary_unary( - '/JFJochProtoBuf.gRPC_JFJochDetector/Start', - request_serializer=jfjoch__pb2.DetectorInput.SerializeToString, - response_deserializer=jfjoch__pb2.Empty.FromString, - ) - self.Stop = channel.unary_unary( - '/JFJochProtoBuf.gRPC_JFJochDetector/Stop', - request_serializer=jfjoch__pb2.Empty.SerializeToString, - response_deserializer=jfjoch__pb2.Empty.FromString, - ) - self.Status = channel.unary_unary( - '/JFJochProtoBuf.gRPC_JFJochDetector/Status', - request_serializer=jfjoch__pb2.Empty.SerializeToString, - response_deserializer=jfjoch__pb2.DetectorStatus.FromString, - ) - self.On = channel.unary_unary( - '/JFJochProtoBuf.gRPC_JFJochDetector/On', - request_serializer=jfjoch__pb2.DetectorConfig.SerializeToString, - response_deserializer=jfjoch__pb2.Empty.FromString, - ) - self.Off = channel.unary_unary( - '/JFJochProtoBuf.gRPC_JFJochDetector/Off', - request_serializer=jfjoch__pb2.Empty.SerializeToString, - response_deserializer=jfjoch__pb2.Empty.FromString, - ) - self.Trigger = channel.unary_unary( - '/JFJochProtoBuf.gRPC_JFJochDetector/Trigger', - request_serializer=jfjoch__pb2.Empty.SerializeToString, - response_deserializer=jfjoch__pb2.Empty.FromString, - ) - - -class gRPC_JFJochDetectorServicer(object): - """Missing associated documentation comment in .proto file.""" - - def Start(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def Stop(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def Status(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def On(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def Off(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - def Trigger(self, request, context): - """Missing associated documentation comment in .proto file.""" - context.set_code(grpc.StatusCode.UNIMPLEMENTED) - context.set_details('Method not implemented!') - raise NotImplementedError('Method not implemented!') - - -def add_gRPC_JFJochDetectorServicer_to_server(servicer, server): - rpc_method_handlers = { - 'Start': grpc.unary_unary_rpc_method_handler( - servicer.Start, - request_deserializer=jfjoch__pb2.DetectorInput.FromString, - response_serializer=jfjoch__pb2.Empty.SerializeToString, - ), - 'Stop': grpc.unary_unary_rpc_method_handler( - servicer.Stop, - request_deserializer=jfjoch__pb2.Empty.FromString, - response_serializer=jfjoch__pb2.Empty.SerializeToString, - ), - 'Status': grpc.unary_unary_rpc_method_handler( - servicer.Status, - request_deserializer=jfjoch__pb2.Empty.FromString, - response_serializer=jfjoch__pb2.DetectorStatus.SerializeToString, - ), - 'On': grpc.unary_unary_rpc_method_handler( - servicer.On, - request_deserializer=jfjoch__pb2.DetectorConfig.FromString, - response_serializer=jfjoch__pb2.Empty.SerializeToString, - ), - 'Off': grpc.unary_unary_rpc_method_handler( - servicer.Off, - request_deserializer=jfjoch__pb2.Empty.FromString, - response_serializer=jfjoch__pb2.Empty.SerializeToString, - ), - 'Trigger': grpc.unary_unary_rpc_method_handler( - servicer.Trigger, - request_deserializer=jfjoch__pb2.Empty.FromString, - response_serializer=jfjoch__pb2.Empty.SerializeToString, - ), - } - generic_handler = grpc.method_handlers_generic_handler( - 'JFJochProtoBuf.gRPC_JFJochDetector', rpc_method_handlers) - server.add_generic_rpc_handlers((generic_handler,)) - - - # This class is part of an EXPERIMENTAL API. -class gRPC_JFJochDetector(object): - """Missing associated documentation comment in .proto file.""" - - @staticmethod - def Start(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/JFJochProtoBuf.gRPC_JFJochDetector/Start', - jfjoch__pb2.DetectorInput.SerializeToString, - jfjoch__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def Stop(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/JFJochProtoBuf.gRPC_JFJochDetector/Stop', - jfjoch__pb2.Empty.SerializeToString, - jfjoch__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def Status(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/JFJochProtoBuf.gRPC_JFJochDetector/Status', - jfjoch__pb2.Empty.SerializeToString, - jfjoch__pb2.DetectorStatus.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def On(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/JFJochProtoBuf.gRPC_JFJochDetector/On', - jfjoch__pb2.DetectorConfig.SerializeToString, - jfjoch__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def Off(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/JFJochProtoBuf.gRPC_JFJochDetector/Off', - jfjoch__pb2.Empty.SerializeToString, - jfjoch__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - @staticmethod - def Trigger(request, - target, - options=(), - channel_credentials=None, - call_credentials=None, - insecure=False, - compression=None, - wait_for_ready=None, - timeout=None, - metadata=None): - return grpc.experimental.unary_unary(request, target, '/JFJochProtoBuf.gRPC_JFJochDetector/Trigger', - jfjoch__pb2.Empty.SerializeToString, - jfjoch__pb2.Empty.FromString, - options, channel_credentials, - insecure, call_credentials, compression, wait_for_ready, timeout, metadata) - - class gRPC_JFJochBrokerStub(object): """Missing associated documentation comment in .proto file.""" diff --git a/tests/DiffractionExperimentTest.cpp b/tests/DiffractionExperimentTest.cpp index 27227c48..20a82599 100644 --- a/tests/DiffractionExperimentTest.cpp +++ b/tests/DiffractionExperimentTest.cpp @@ -585,58 +585,6 @@ TEST_CASE("DiffractionExperiment_StorageCells_Pedestal","[DiffractionExperiment] REQUIRE(x.GetFrameNumPerTrigger() == 2); } -TEST_CASE("DiffractionExperiment_DetectorInput_MultiTriggger","[DiffractionExperiment]") { - DiffractionExperiment x(DetectorGeometry(8, 2, 8, 36)); - x.FrameTime(700us).ImagesPerTrigger(350).NumTriggers(7); - JFJochProtoBuf::DetectorInput ret = x; - REQUIRE(ret.modules_num() == 8); - REQUIRE(ret.period_us() == x.GetFrameTime().count()); - REQUIRE(ret.count_time_us() == x.GetFrameCountTime().count()); - REQUIRE(ret.num_triggers() == 8); - REQUIRE(ret.num_frames() == 350); - REQUIRE(ret.storage_cell_number() == 1); - REQUIRE(ret.mode() == JFJochProtoBuf::CONVERSION); -} - -TEST_CASE("DiffractionExperiment_DetectorInput_NoTriggger","[DiffractionExperiment]") { - DiffractionExperiment x(DetectorGeometry(8, 2, 8, 36)); - x.FrameTime(1200us).ImagesPerTrigger(350).NumTriggers(1); - JFJochProtoBuf::DetectorInput ret = x; - REQUIRE(ret.modules_num() == 8); - REQUIRE(ret.period_us() == x.GetFrameTime().count()); - REQUIRE(ret.count_time_us() == x.GetFrameCountTime().count()); - REQUIRE(ret.num_triggers() == 1); - REQUIRE(ret.num_frames() == 350 + DELAY_FRAMES_STOP_AND_QUIT); - REQUIRE(ret.storage_cell_number() == 1); - REQUIRE(ret.mode() == JFJochProtoBuf::CONVERSION); -} - -TEST_CASE("DiffractionExperiment_DetectorInput_PedestalG2","[DiffractionExperiment]") { - DiffractionExperiment x(DetectorGeometry(8, 2, 8, 36)); - x.FrameTime(1200us).PedestalG2Frames(4560).NumTriggers(1).Mode(DetectorMode::PedestalG2); - JFJochProtoBuf::DetectorInput ret = x; - REQUIRE(ret.modules_num() == 8); - REQUIRE(ret.period_us() == x.GetFrameTime().count()); - REQUIRE(ret.count_time_us() == x.GetFrameCountTime().count()); - REQUIRE(ret.num_triggers() == 1); - REQUIRE(ret.num_frames() == 4560 + DELAY_FRAMES_STOP_AND_QUIT); - REQUIRE(ret.storage_cell_number() == 1); -} - -TEST_CASE("DiffractionExperiment_DetectorInput_StorageCell","[DiffractionExperiment]") { - DiffractionExperiment x(DetectorGeometry(8, 2, 8, 36)); - x.FrameTime(1200us).NumTriggers(4560).StorageCells(8).StorageCellDelay(7000ns); - JFJochProtoBuf::DetectorInput ret = x; - REQUIRE(ret.modules_num() == 8); - REQUIRE(ret.period_us() == 8 * (x.GetFrameTime().count() + 10)); - REQUIRE(ret.count_time_us() == x.GetFrameCountTime().count()); - REQUIRE(ret.num_triggers() == 4560 + 1); - REQUIRE(ret.num_frames() == 1); - REQUIRE(ret.storage_cell_number() == 8); - REQUIRE(ret.storage_cell_delay_ns() == 7000); - REQUIRE(ret.storage_cell_start() == x.GetStorageCellStart()); -} - TEST_CASE("DiffractionExperiment_DefaultDataProcessingSettings","[DiffractionExperiment]") { REQUIRE_NOTHROW(DiffractionExperiment::CheckDataProcessingSettings( DiffractionExperiment::DefaultDataProcessingSettings())); @@ -680,7 +628,6 @@ TEST_CASE("DiffractionExperiment_FPGA_Summation_output","[DiffractionExperiment] TEST_CASE("DiffractionExperiment_DetectorModuleHostname","[DiffractionExperiment]") { std::vector h = {"mx1", "mx2", "mx3"}; DiffractionExperiment x(DetectorSetup(3, "X", h)); - JFJochProtoBuf::DetectorConfig det_cfg; std::vector net_cfg; @@ -695,9 +642,10 @@ TEST_CASE("DiffractionExperiment_DetectorModuleHostname","[DiffractionExperiment .udp_port = 1234}); std::vector h_out; - REQUIRE_NOTHROW(x.GetDetectorModuleHostname(h_out)); + REQUIRE_NOTHROW(h_out = x.GetDetectorModuleHostname()); REQUIRE(h == h_out); - REQUIRE_NOTHROW(det_cfg = x.DetectorConfig(net_cfg)); + auto det_cfg = x.GetDetectorModuleConfig(net_cfg); + REQUIRE(det_cfg.size() == x.GetModulesNum()); } diff --git a/tools/HDF5DatasetWriteTest.cpp b/tools/HDF5DatasetWriteTest.cpp index 046de4f6..4214c3f8 100644 --- a/tools/HDF5DatasetWriteTest.cpp +++ b/tools/HDF5DatasetWriteTest.cpp @@ -147,13 +147,6 @@ int main(int argc, char **argv) { logger.Info("Write HDF5 master file"); - JFJochProtoBuf::ReceiverOutput receiver_output; - - receiver_output.set_start_time_ms(1640995200000); - receiver_output.set_end_time_ms(1640995210000); - receiver_output.set_images_sent(nimages); - receiver_output.set_max_image_number_sent(nimages - 1); - EndMessage end_message; end_message.number_of_images = x.GetImageNum(); HDF5Metadata::NXmx(start_message, end_message); diff --git a/writer/CMakeLists.txt b/writer/CMakeLists.txt index 1db0db2d..28e1d5b5 100644 --- a/writer/CMakeLists.txt +++ b/writer/CMakeLists.txt @@ -15,7 +15,7 @@ ADD_LIBRARY(JFJochWriter STATIC StreamWriter.cpp StreamWriter.h JFJochWriterService.cpp JFJochWriterService.h) -TARGET_LINK_LIBRARIES(JFJochWriter HDF5Wrappers CommonFunctions) +TARGET_LINK_LIBRARIES(JFJochWriter HDF5Wrappers CommonFunctions JFJochProtoBuf) TARGET_LINK_LIBRARIES(jfjoch_writer JFJochWriter) TARGET_LINK_LIBRARIES(jfjoch_writer_multi JFJochWriter) diff --git a/writer/JFJochWriterService.h b/writer/JFJochWriterService.h index 802ac2aa..31240d0d 100644 --- a/writer/JFJochWriterService.h +++ b/writer/JFJochWriterService.h @@ -4,7 +4,7 @@ #define JUNGFRAUJOCH_JFJOCHWRITERSERVICE_H #include -#include "jfjoch.grpc.pb.h" +#include #include "StreamWriter.h" class JFJochWriterService final : public JFJochProtoBuf::gRPC_JFJochWriter::Service {