From efab36204ef2e757c5a89dec7c1f147359d67f3e Mon Sep 17 00:00:00 2001 From: Felix Weiglhofer <weiglhofer@fias.uni-frankfurt.de> Date: Mon, 19 Jun 2023 13:07:08 +0000 Subject: [PATCH] algo: Add UnpackChain to use algo::Unpack. --- algo/CMakeLists.txt | 1 + algo/global/Reco.cxx | 10 +++------- algo/global/Reco.h | 4 ++-- algo/unpack/UnpackChain.cxx | 14 ++++++++++++++ algo/unpack/UnpackChain.h | 27 +++++++++++++++++++++++++++ 5 files changed, 47 insertions(+), 9 deletions(-) create mode 100644 algo/unpack/UnpackChain.cxx create mode 100644 algo/unpack/UnpackChain.h diff --git a/algo/CMakeLists.txt b/algo/CMakeLists.txt index 4723ad70ff..7ebd5e2b35 100644 --- a/algo/CMakeLists.txt +++ b/algo/CMakeLists.txt @@ -19,6 +19,7 @@ set(SRCS trigger/TimeClusterTrigger.cxx evselector/DigiEventSelector.cxx unpack/Unpack.cxx + unpack/UnpackChain.cxx detectors/sts/ReadoutConfig.cxx detectors/sts/StsHitfinderChain.cxx detectors/sts/StsReadoutConfigLegacy.cxx diff --git a/algo/global/Reco.cxx b/algo/global/Reco.cxx index fba6629a2e..2e08ad96be 100644 --- a/algo/global/Reco.cxx +++ b/algo/global/Reco.cxx @@ -56,12 +56,8 @@ void Reco::Init(const Options& opts) YAML::Node yaml = YAML::LoadFile(recoParamsPath.string()); fContext.recoParams = config::Read<RecoParams>(yaml); - // STS Unpacker - fs::path stsUnpackParamsPath = opts.ParamsDir() / "StsReadout.yaml"; - yaml = YAML::LoadFile(stsUnpackParamsPath.string()); - sts::ReadoutSetup readoutConfig = config::Read<sts::ReadoutSetup>(yaml); - sts::ReadoutConfig mapping(readoutConfig); - fUnpack.Init(mapping); + // Unpackers + fUnpack.Init(); // STS Hitfinder fs::path stsHitfinderParamsPath = opts.ParamsDir() / "StsHitfinder.yaml"; @@ -95,7 +91,7 @@ void Reco::Run(const fles::Timeslice& ts) throw std::runtime_error("XPU unpacker currently not implemented"); break; default: - case RecoParams::UnpackMode::CPU: digis = fUnpack.Run(ts); break; + case RecoParams::UnpackMode::CPU: digis = fUnpack.Run(ts).first.fData.fSts.fDigis; break; } fStsHitFinder(digis); diff --git a/algo/global/Reco.h b/algo/global/Reco.h index d485da3534..662e3e762f 100644 --- a/algo/global/Reco.h +++ b/algo/global/Reco.h @@ -7,8 +7,8 @@ #include <xpu/host.h> #include "SubChain.h" +#include "UnpackChain.h" #include "sts/StsHitfinderChain.h" -#include "sts/StsUnpackChain.h" namespace fles { @@ -40,7 +40,7 @@ namespace cbm::algo xpu::timings fTimesliceTimesAcc; // STS - sts::UnpackChain fUnpack; + UnpackChain fUnpack; sts::HitfinderChain fStsHitFinder; void Validate(const Options& opts); diff --git a/algo/unpack/UnpackChain.cxx b/algo/unpack/UnpackChain.cxx new file mode 100644 index 0000000000..25b412ffd2 --- /dev/null +++ b/algo/unpack/UnpackChain.cxx @@ -0,0 +1,14 @@ +/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main + SPDX-License-Identifier: GPL-3.0-only + Authors: Felix Weiglhofer [committer] */ +#include "UnpackChain.h" + +using namespace cbm::algo; + +void UnpackChain::Init() +{ + bool ok = fUnpack.Init(); + if (!ok) throw std::runtime_error("Unpack::Init failed"); +} + +Unpack::resultType UnpackChain::Run(const fles::Timeslice& timeslice) { return fUnpack(×lice); } diff --git a/algo/unpack/UnpackChain.h b/algo/unpack/UnpackChain.h new file mode 100644 index 0000000000..6944f99ce6 --- /dev/null +++ b/algo/unpack/UnpackChain.h @@ -0,0 +1,27 @@ +/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main + SPDX-License-Identifier: GPL-3.0-only + Authors: Felix Weiglhofer [committer] */ +#ifndef CBM_ALGO_UNPACK_UNPACKCHAIN_H +#define CBM_ALGO_UNPACK_UNPACKCHAIN_H + +#include "SubChain.h" +#include "Unpack.h" + +namespace cbm::algo +{ + + class UnpackChain : public SubChain { + + public: + void Init(); + + Unpack::resultType Run(const fles::Timeslice&); + + private: + Unpack fUnpack; + }; + +} // namespace cbm::algo + + +#endif //CBM_ALGO_UNPACK_UNPACKCHAIN_H -- GitLab