From 4af9e3c56f5f25d13f5e34f3738527822999bb34 Mon Sep 17 00:00:00 2001 From: Dominik Smith <d.smith@gsi.de> Date: Tue, 4 Jun 2024 15:36:33 +0200 Subject: [PATCH] Added YAML-configurable system offset TRD unpacker in cbm::algo. --- algo/detectors/trd/ReadoutConfig.h | 7 +++++++ algo/detectors/trd/Unpack.cxx | 3 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/algo/detectors/trd/ReadoutConfig.h b/algo/detectors/trd/ReadoutConfig.h index a20bc9d1ab..619e448e4e 100644 --- a/algo/detectors/trd/ReadoutConfig.h +++ b/algo/detectors/trd/ReadoutConfig.h @@ -87,7 +87,13 @@ namespace cbm::algo::trd void Init(const std::map<size_t, std::map<size_t, std::map<size_t, size_t>>>& addressMap, std::map<size_t, std::map<size_t, std::map<size_t, std::map<size_t, size_t>>>>& channelMap); + /** @brief Get system time offset **/ + int64_t GetSystemTimeOffset() { return fSystemTimeOffset; }; + private: + // --- System time offset + int64_t fSystemTimeOffset = 0; + // --- TRD readout map // --- Map index: (equipment, crob, elink), map value: (ASIC address) std::map<uint16_t, std::vector<std::vector<uint16_t>>> fReadoutMap = {}; //! @@ -100,6 +106,7 @@ namespace cbm::algo::trd std::map<uint32_t, std::vector<int32_t>> fElinkTimeOffsetMap; CBM_YAML_PROPERTIES( + yaml::Property(&ReadoutConfig::fSystemTimeOffset, "timeOffset", "System time offset for TRD1D"), yaml::Property(&ReadoutConfig::fReadoutMap, "readoutMap", "TRD readout map", {}, YAML::Hex), yaml::Property(&ReadoutConfig::fChannelMap, "channelMap", "TRD channel map"), yaml::Property(&ReadoutConfig::fElinkTimeOffsetMap, "elinkTimeOffset", "TRD time offset per CRI&Elink combination") diff --git a/algo/detectors/trd/Unpack.cxx b/algo/detectors/trd/Unpack.cxx index 9a5fcdc1e5..55eec70197 100644 --- a/algo/detectors/trd/Unpack.cxx +++ b/algo/detectors/trd/Unpack.cxx @@ -11,7 +11,6 @@ using fles::Subsystem; Unpack::Unpack(const ReadoutConfig& readout) : fReadout(readout) { - constexpr i64 SystemTimeOffset = 1300; constexpr std::array<u8, 2> SystemVersion = {0x01, 0x10}; // Create one algorithm per component for TRD and configure it with parameters @@ -29,7 +28,7 @@ Unpack::Unpack(const ReadoutConfig& readout) : fReadout(readout) auto addresses = fReadout.Map(equip, crob, elink); elinkPar.fAddress = addresses.first; // Asic address for this elink elinkPar.fChanAddress = addresses.second; // Channel addresses for this elink - elinkPar.fTimeOffset = SystemTimeOffset + fReadout.GetElinkTimeOffset(crob, elink); + elinkPar.fTimeOffset = fReadout.GetSystemTimeOffset() + fReadout.GetElinkTimeOffset(crob, elink); crobPar.fElinkParams.push_back(elinkPar); } par.fCrobParams.push_back(crobPar); -- GitLab