// SPDX-FileCopyrightText: 2024 Filip Leonarski, Paul Scherrer Institute // SPDX-License-Identifier: GPL-3.0-only #pragma once #include #include "../common/DiffractionExperiment.h" #include "../common/Logger.h" #include "DetectorWrapper.h" #define BASE_DETECTOR_MAC 0xAABBCCDDEE10 // little-endian! class SLSDetectorWrapper : public DetectorWrapper { Logger logger{"SLSDetectorWrapper"}; DetectorType det_type = DetectorType::JUNGFRAU; sls::Detector det; // Mapping between the slsDetectorPackage module index space and the // Jungfraujoch (logical) module index space. // // Inactive half-modules (empty hostname string) are excluded from the // slsDetectorPackage entirely - they are never added with setHostname() and // never configured. They DO keep their slot in the logical numbering, so the // geometry, module count and UDP destination ports of the surviving modules // are unaffected. // // sls_to_logical[s] -> logical index of the s-th module known to SLS // n_logical_units -> total logical units (2 * modules for EIGER, // modules for JUNGFRAU), i.e. including placeholders std::vector sls_to_logical; int n_logical_units = 0; // Scatter an SLS-ordered (active-only) per-module vector back into a // logical-ordered vector of size n_logical_units, filling inactive slots // with the given placeholder. Used so that temperature / HV are reported at // the correct Jungfraujoch module position. [[nodiscard]] std::vector MapToLogical(const std::vector& sls_values, int64_t placeholder) const; void InternalStop(); [[nodiscard]] int64_t GetNumberOfTriggersLeft() const; [[nodiscard]] DetectorPowerState GetPowerState() const; int64_t GetFirmwareVersion() const; std::string GetDetectorServerVersion() const; std::vector GetFPGATemperatures() const; std::vector GetHighVoltage() const; public: SLSDetectorWrapper(); [[nodiscard]] DetectorState GetState() const override; void Initialize(DiffractionExperiment& experiment, const std::vector& net_config) override; void Configure(const DiffractionExperiment& experiment) override; void Start(const DiffractionExperiment& experiment) override; void Stop() override; void Trigger() override; void Deactivate() override; void LoadPixelMask(PixelMask &mask) override; DetectorStatus GetStatus() const override; };