diff --git a/algo/CMakeLists.txt b/algo/CMakeLists.txt index 4723ad70ff35fc0d07ac777bdb5c21ecf76849d9..7ebd5e2b35e787756f5cfa95f6000000ae97675c 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 fba6629a2e6a694939b499328b954933c0bdd70f..2e08ad96be42cdc79ee35b9a6ec46eae44e24702 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 d485da35348bc116cbf49138e5a735a07651c076..662e3e762f4a1ac9e3472995e91767fd72d4d071 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 0000000000000000000000000000000000000000..25b412ffd20a2a10790790903021530dc3bf0041 --- /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 0000000000000000000000000000000000000000..6944f99ce65e6b799f51897fbd25f3407d0e2543 --- /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