diff --git a/algo/CMakeLists.txt b/algo/CMakeLists.txt index 9ab152e9aaaf0f00b13fb56818ad9c3e72e13df5..e43a2ab44f8b64fcf2379d598e539e982aad5cfa 100644 --- a/algo/CMakeLists.txt +++ b/algo/CMakeLists.txt @@ -53,7 +53,6 @@ if (CBM_ONLINE_STANDALONE) add_subdirectory(../core core) endif() -add_subdirectory(base) add_subdirectory(ca) add_subdirectory(kf) add_subdirectory(kfp) @@ -87,7 +86,6 @@ set(SRCS base/compat/Algorithm.cxx base/util/MemoryLogger.cxx base/util/StlUtils.cxx - base/util/EnumDict.cxx base/util/TimingsFormat.cxx data/sts/HitfinderPars.cxx data/sts/LandauTable.cxx @@ -225,6 +223,7 @@ target_include_directories(Algo target_link_libraries(Algo PUBLIC OnlineData + CbmUtility OnlineContainers KfCore CaCore @@ -243,7 +242,6 @@ target_link_libraries(Algo cppzmq poolstl PRIVATE CbmKFParticleOnlineInterface - INTERFACE CbmYamlInterface ) target_compile_definitions(Algo PUBLIC NO_ROOT) xpu_attach(Algo ${DEVICE_SRCS}) @@ -304,6 +302,7 @@ if (NOT CBM_ONLINE_STANDALONE) target_link_libraries(AlgoOffline PUBLIC CbmData + CbmUtility CbmContainers KfCoreOffline CaCoreOffline @@ -322,7 +321,6 @@ if (NOT CBM_ONLINE_STANDALONE) cppzmq poolstl PRIVATE CbmKFParticleOnlineInterface - INTERFACE CbmYamlInterface ) xpu_attach(AlgoOffline ${DEVICE_SRCS}) diff --git a/algo/base/CMakeLists.txt b/algo/base/CMakeLists.txt deleted file mode 100644 index 93b295fe0a83615d30852967c9754863bd3cd2d8..0000000000000000000000000000000000000000 --- a/algo/base/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(yaml) diff --git a/algo/base/Definitions.h b/algo/base/Definitions.h index c58e1db2578f03ade16ca5b4cb30e673639be827..f1cd9f8aac6fe0354ad7a33f3c5628d29b201e6a 100644 --- a/algo/base/Definitions.h +++ b/algo/base/Definitions.h @@ -4,8 +4,8 @@ #ifndef CBM_BASE_TYPES_H #define CBM_BASE_TYPES_H +#include "CbmEnumDict.h" #include "MicrosliceDescriptor.hpp" // For fles::Subsystem -#include "util/EnumDict.h" #include <cstdint> @@ -109,18 +109,18 @@ CBM_ENUM_DICT(fles::Subsystem, ); CBM_ENUM_DICT(cbm::algo::Step, - {"Unpack", Step::Unpack}, - {"DigiTrigger", Step::DigiTrigger}, - {"LocalReco", Step::LocalReco}, - {"Tracking", Step::Tracking} + {"Unpack", cbm::algo::Step::Unpack}, + {"DigiTrigger", cbm::algo::Step::DigiTrigger}, + {"LocalReco", cbm::algo::Step::LocalReco}, + {"Tracking", cbm::algo::Step::Tracking} ); CBM_ENUM_DICT(cbm::algo::RecoData, - {"DigiTimeslice", RecoData::DigiTimeslice}, - {"DigiEvent", RecoData::DigiEvent}, - {"Cluster", RecoData::Cluster}, - {"Hit", RecoData::Hit}, - {"Track", RecoData::Track} + {"DigiTimeslice", cbm::algo::RecoData::DigiTimeslice}, + {"DigiEvent", cbm::algo::RecoData::DigiEvent}, + {"Cluster", cbm::algo::RecoData::Cluster}, + {"Hit", cbm::algo::RecoData::Hit}, + {"Track", cbm::algo::RecoData::Track} ); CBM_ENUM_DICT(cbm::algo::Setup, diff --git a/algo/base/RecoParams.h b/algo/base/RecoParams.h index db747f189c96263f8dd7bc9fa1be3466c408c47e..3ffe7130b52f0ddcb867fead91511c404c45acf0 100644 --- a/algo/base/RecoParams.h +++ b/algo/base/RecoParams.h @@ -1,13 +1,11 @@ -/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main +/* Copyright (C) 2023-2025 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main SPDX-License-Identifier: GPL-3.0-only Authors: Felix Weiglhofer [committer] */ #ifndef CBM_ALGO_BASE_RECOPARAMS_H #define CBM_ALGO_BASE_RECOPARAMS_H +#include "CbmYaml.h" #include "Definitions.h" -#include "util/EnumDict.h" -#include "yaml/Property.h" -#include "yaml/Yaml.h" #include <xpu/defines.h> @@ -106,14 +104,14 @@ namespace cbm::algo CBM_YAML_EXTERN_DECL(cbm::algo::RecoParams); CBM_ENUM_DICT(cbm::algo::RecoParams::SortMode, - {"BlockSort", RecoParams::SortMode::BlockSort}, - {"CUBSegmentedSort", RecoParams::SortMode::CUBSegmentedSort} + {"BlockSort", cbm::algo::RecoParams::SortMode::BlockSort}, + {"CUBSegmentedSort", cbm::algo::RecoParams::SortMode::CUBSegmentedSort} ); CBM_ENUM_DICT(cbm::algo::RecoParams::AllocationMode, - {"Auto", RecoParams::AllocationMode::Auto}, - {"Static", RecoParams::AllocationMode::Static}, - {"Dynamic", RecoParams::AllocationMode::Dynamic} + {"Auto", cbm::algo::RecoParams::AllocationMode::Auto}, + {"Static", cbm::algo::RecoParams::AllocationMode::Static}, + {"Dynamic", cbm::algo::RecoParams::AllocationMode::Dynamic} ); #endif // CBM_ALGO_BASE_RECOPARAMS_H diff --git a/algo/base/util/ProfilingLevel.h b/algo/base/util/ProfilingLevel.h index d358bd36c9c6f5c3575981271ba59fa14c44c8d8..5d9469359ed8d41c3038bb40b7a4a84c1e85def0 100644 --- a/algo/base/util/ProfilingLevel.h +++ b/algo/base/util/ProfilingLevel.h @@ -4,7 +4,7 @@ #pragma once -#include "EnumDict.h" +#include "CbmEnumDict.h" namespace cbm::algo { diff --git a/algo/base/yaml/CMakeLists.txt b/algo/base/yaml/CMakeLists.txt deleted file mode 100644 index 756401d832e849767e03cf1f9b33188c770022b7..0000000000000000000000000000000000000000 --- a/algo/base/yaml/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -set(INCLUDE_DIRECTORIES - ${CMAKE_SOURCE_DIR}/algo/base # For "algo/base/yaml/*.h" included as relative "yaml/?????.h" to fit install tree -) - -add_library(CbmYamlInterface INTERFACE) - -target_include_directories(CbmYamlInterface - INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} -) - -target_link_libraries(CbmYamlInterface - INTERFACE GSL - xpu - fmt::fmt - external::yaml-cpp -) - -install( - FILES - BaseTypes.h - Property.h - Yaml.h - DESTINATION - include/yaml/ -) diff --git a/algo/ca/TrackingChain.cxx b/algo/ca/TrackingChain.cxx index d33ccb042ed8659fdd6455c52a13f37655b38305..2f1202d14c72421018ac3d4206526d5117900b56 100644 --- a/algo/ca/TrackingChain.cxx +++ b/algo/ca/TrackingChain.cxx @@ -13,10 +13,10 @@ #include "CaHit.h" #include "CaInitManager.h" #include "CaParameters.h" +#include "CbmYaml.h" #include "KfSetupBuilder.h" #include "ParFiles.h" #include "compat/OpenMP.h" -#include "yaml/Yaml.h" #include <boost/archive/binary_oarchive.hpp> diff --git a/algo/ca/TrackingChainConfig.h b/algo/ca/TrackingChainConfig.h index 5c16837f151e5012f29698d7cc28e26df18ac25b..d32b15c7b421334e6adee4af6fe65bb31893f8f6 100644 --- a/algo/ca/TrackingChainConfig.h +++ b/algo/ca/TrackingChainConfig.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt +/* Copyright (C) 2024-2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Sergei Zharko [committer] */ @@ -9,7 +9,7 @@ #pragma once -#include "yaml/Property.h" +#include "CbmYaml.h" #include <string> #include <tuple> diff --git a/algo/data/sts/HitfinderPars.h b/algo/data/sts/HitfinderPars.h index 3e58fa30e0d46d0649f23572d61d7ffee11db8f8..e0923d771bed407efba86815cff3c371483dc892 100644 --- a/algo/data/sts/HitfinderPars.h +++ b/algo/data/sts/HitfinderPars.h @@ -1,12 +1,11 @@ -/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main +/* Copyright (C) 2023-2025 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main SPDX-License-Identifier: GPL-3.0-only Authors: Felix Weiglhofer [committer] */ #pragma once +#include "CbmYaml.h" #include "Definitions.h" #include "LandauTable.h" -#include "yaml/Property.h" -#include "yaml/Yaml.h" #include <xpu/defines.h> diff --git a/algo/detectors/bmon/CalibrateSetup.h b/algo/detectors/bmon/CalibrateSetup.h index 975175a10e60f3a16140a9459c16c3a6097769df..1baea3958100153394dd46bfae2e75574c51660f 100644 --- a/algo/detectors/bmon/CalibrateSetup.h +++ b/algo/detectors/bmon/CalibrateSetup.h @@ -9,8 +9,8 @@ #pragma once +#include "CbmYaml.h" #include "Definitions.h" -#include "yaml/Property.h" #include <array> #include <map> diff --git a/algo/detectors/bmon/HitfindSetup.h b/algo/detectors/bmon/HitfindSetup.h index 96431fb0268c67883093e873ddaa06e80ed6c575..c93559ccd67f8556db8862ef0e0146c9ce03f5b6 100644 --- a/algo/detectors/bmon/HitfindSetup.h +++ b/algo/detectors/bmon/HitfindSetup.h @@ -9,8 +9,8 @@ #pragma once +#include "CbmYaml.h" #include "Definitions.h" -#include "yaml/Property.h" #include <string> #include <vector> diff --git a/algo/detectors/bmon/ReadoutConfig.h b/algo/detectors/bmon/ReadoutConfig.h index 88e0361d38e02a88289282b194f2878d63de1231..3bfc76f0c3f489126a5808e2c2d71c32847b8b13 100644 --- a/algo/detectors/bmon/ReadoutConfig.h +++ b/algo/detectors/bmon/ReadoutConfig.h @@ -1,12 +1,11 @@ -/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt +/* Copyright (C) 2022-2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Dominik Smith [committer] */ #pragma once +#include "CbmYaml.h" #include "Definitions.h" -#include "yaml/Property.h" -#include "yaml/Yaml.h" #include <cstddef> #include <cstdint> diff --git a/algo/detectors/sts/ChannelMaskSet.h b/algo/detectors/sts/ChannelMaskSet.h index bc0c0b83ad125cbc9d5028d2420ad9e81f94d042..8a7757158b81f760e3f5d586ea4de5cff4ed79e0 100644 --- a/algo/detectors/sts/ChannelMaskSet.h +++ b/algo/detectors/sts/ChannelMaskSet.h @@ -1,13 +1,12 @@ -/* Copyright (C) 2024 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main +/* Copyright (C) 2024-2025 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main SPDX-License-Identifier: GPL-3.0-only Authors: Felix Weiglhofer [committer], Dominik Smith */ #pragma once +#include "CbmYaml.h" #include "Definitions.h" #include "compat/Filesystem.h" -#include "yaml/Property.h" -#include "yaml/Yaml.h" #include <map> #include <set> diff --git a/algo/detectors/sts/HitfinderChain.cxx b/algo/detectors/sts/HitfinderChain.cxx index 2b4a4324b10cad7159f0b391a9f91527e1314d76..5796cfa54bf292f88d54d9ca5d30bda9441ce812 100644 --- a/algo/detectors/sts/HitfinderChain.cxx +++ b/algo/detectors/sts/HitfinderChain.cxx @@ -32,7 +32,7 @@ void sts::HitfinderChain::SetParameters(const HitfinderChainPars& parameters) if (!memoryPars.IsDynamic() && !memoryPars.IsStatic()) { throw std::runtime_error( - fmt::format("STS Hitfinder Chain: Unknown allocation mode: {}", ToString(memoryPars.allocationMode))); + fmt::format("STS Hitfinder Chain: Unknown allocation mode: {}", util::ToString(memoryPars.allocationMode))); } if (memoryPars.IsStatic()) { diff --git a/algo/detectors/sts/ReadoutConfig.h b/algo/detectors/sts/ReadoutConfig.h index b3db24c21975cfc0b28623368c171bdbe69bb826..caf5e9d7b34816b14824b1e56eba47181eb38839 100644 --- a/algo/detectors/sts/ReadoutConfig.h +++ b/algo/detectors/sts/ReadoutConfig.h @@ -1,12 +1,11 @@ -/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt +/* Copyright (C) 2022-2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Volker Friese [committer], Felix Weiglhofer */ #ifndef CBM_ALGO_DETECTOR_STS_READOUT_CONFIG_H #define CBM_ALGO_DETECTOR_STS_READOUT_CONFIG_H +#include "CbmYaml.h" #include "Definitions.h" -#include "yaml/Property.h" -#include "yaml/Yaml.h" #include <map> #include <string> diff --git a/algo/detectors/sts/WalkMap.h b/algo/detectors/sts/WalkMap.h index 57a23d54a0c1f3ccc2fe397cb7d52d5733ef5185..aa7659840c3b267a5ce8401c51d17d352bb0fa1d 100644 --- a/algo/detectors/sts/WalkMap.h +++ b/algo/detectors/sts/WalkMap.h @@ -1,12 +1,11 @@ -/* Copyright (C) 2024 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main +/* Copyright (C) 2024-2025 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main SPDX-License-Identifier: GPL-3.0-only Authors: Felix Weiglhofer [committer], Dominik Smith */ #pragma once +#include "CbmYaml.h" #include "Definitions.h" -#include "yaml/Property.h" -#include "yaml/Yaml.h" #include <map> #include <vector> diff --git a/algo/detectors/tof/CalibrateSetup.h b/algo/detectors/tof/CalibrateSetup.h index 89d806312b18b78ae2754dd8d1fed1db57ed2eb4..6cdfdc00dbb6418cd28a15e53e9fcc487676cc3a 100644 --- a/algo/detectors/tof/CalibrateSetup.h +++ b/algo/detectors/tof/CalibrateSetup.h @@ -1,11 +1,11 @@ -/* Copyright (C) 2023 Facility for Antiproton and Ion Research in Europe, Darmstadt +/* Copyright (C) 2023-2025 Facility for Antiproton and Ion Research in Europe, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Dominik Smith [committer] */ #ifndef CBM_ALGO_DETECTOR_TOF_CALIBRATE_SETUP_H #define CBM_ALGO_DETECTOR_TOF_CALIBRATE_SETUP_H +#include "CbmYaml.h" #include "Definitions.h" -#include "yaml/Property.h" #include <array> #include <map> diff --git a/algo/detectors/tof/HitfindSetup.h b/algo/detectors/tof/HitfindSetup.h index c3138ad7d3ab63213a70eb9c83754772bc3a3f6e..eff6f81d3818b00ff6a7f8d59e29dc57f8faa2a7 100644 --- a/algo/detectors/tof/HitfindSetup.h +++ b/algo/detectors/tof/HitfindSetup.h @@ -1,11 +1,11 @@ -/* Copyright (C) 2023 Facility for Antiproton and Ion Research in Europe, Darmstadt +/* Copyright (C) 2023-2025 Facility for Antiproton and Ion Research in Europe, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Dominik Smith [committer] */ #ifndef CBM_ALGO_DETECTOR_TOF_HITFIND_SETUP_H #define CBM_ALGO_DETECTOR_TOF_HITFIND_SETUP_H +#include "CbmYaml.h" #include "Definitions.h" -#include "yaml/Property.h" #include <array> #include <map> diff --git a/algo/detectors/tof/ReadoutConfig.h b/algo/detectors/tof/ReadoutConfig.h index 6b9ac632faef7de47e026881348a91e3ef750fd0..250e288bc6a18a5ee5f46bda7739ae16624c09c6 100644 --- a/algo/detectors/tof/ReadoutConfig.h +++ b/algo/detectors/tof/ReadoutConfig.h @@ -1,12 +1,11 @@ -/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt +/* Copyright (C) 2022-2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Dominik Smith [committer] */ #pragma once +#include "CbmYaml.h" #include "Definitions.h" -#include "yaml/Property.h" -#include "yaml/Yaml.h" #include <cstddef> #include <cstdint> diff --git a/algo/detectors/trd/Hitfind2DSetup.h b/algo/detectors/trd/Hitfind2DSetup.h index a045abbc75fa6e9c3ffc0b3063d6b41f94eb993d..d4bbffdb9a7067960f8276bd77edb648bc25f9ce 100644 --- a/algo/detectors/trd/Hitfind2DSetup.h +++ b/algo/detectors/trd/Hitfind2DSetup.h @@ -1,10 +1,10 @@ -/* Copyright (C) 2024 Facility for Antiproton and Ion Research in Europe, Darmstadt +/* Copyright (C) 2024-2025 Facility for Antiproton and Ion Research in Europe, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Dominik Smith [committer] */ #pragma once +#include "CbmYaml.h" #include "Definitions.h" -#include "yaml/Property.h" #include <array> #include <map> diff --git a/algo/detectors/trd/HitfindSetup.h b/algo/detectors/trd/HitfindSetup.h index 68214432c780359b567ff17082e975bc4d3fabaf..b702eda4ffa78d23cb0670694c3c760d538c4876 100644 --- a/algo/detectors/trd/HitfindSetup.h +++ b/algo/detectors/trd/HitfindSetup.h @@ -1,10 +1,10 @@ -/* Copyright (C) 2024 Facility for Antiproton and Ion Research in Europe, Darmstadt +/* Copyright (C) 2024-2025 Facility for Antiproton and Ion Research in Europe, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Dominik Smith [committer] */ #pragma once +#include "CbmYaml.h" #include "Definitions.h" -#include "yaml/Property.h" #include <array> #include <map> diff --git a/algo/detectors/trd/ReadoutConfig.h b/algo/detectors/trd/ReadoutConfig.h index 17160f0a3fd507b4ad80a21e0f33c301b1da7391..9a1edb8028209e680c09778fd1bd8d4bcc4fdea5 100644 --- a/algo/detectors/trd/ReadoutConfig.h +++ b/algo/detectors/trd/ReadoutConfig.h @@ -1,11 +1,10 @@ -/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt +/* Copyright (C) 2022-2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Volker Friese [committer] */ #pragma once -#include "yaml/Property.h" -#include "yaml/Yaml.h" +#include "CbmYaml.h" #include <map> #include <sstream> diff --git a/algo/detectors/trd2d/ReadoutConfig.h b/algo/detectors/trd2d/ReadoutConfig.h index 673b55f876c9bcebd5ed15cd832a18b35882ffd4..516aa62283f3edf4b8b8f80cc8ce265293f6e168 100644 --- a/algo/detectors/trd2d/ReadoutConfig.h +++ b/algo/detectors/trd2d/ReadoutConfig.h @@ -4,9 +4,8 @@ #pragma once +#include "CbmYaml.h" #include "UnpackMS.h" -#include "yaml/Property.h" -#include "yaml/Yaml.h" #include <map> #include <sstream> diff --git a/algo/global/ParFiles.cxx b/algo/global/ParFiles.cxx index d27a3ad91a1f9e37369b550bb9093329da565262..c7d2e8199a90729cec59def81374fed838df45d4 100644 --- a/algo/global/ParFiles.cxx +++ b/algo/global/ParFiles.cxx @@ -132,7 +132,7 @@ ParFiles::ParFiles(const cbm::RunDatabase& runDb) kfp.V0FinderConfig = "mcbm2025_02/kfp_lambda_v25a.yaml"; break; - default: throw FatalError("Unknown setup: {}", ToString(setup)); + default: throw FatalError("Unknown setup: {}", util::ToString(setup)); } if (setup != Setup::mCBM2024_03) { // NO alignment matrices, review of the parameters is needed diff --git a/algo/global/Reco.cxx b/algo/global/Reco.cxx index efc23dfbd64dd28535cabcac0c46c36c6434b418..d02e257c8bee62e3d81524dac36c194dbca3a079 100644 --- a/algo/global/Reco.cxx +++ b/algo/global/Reco.cxx @@ -8,6 +8,7 @@ #include "BuildInfo.h" #include "CbmDigiEvent.h" #include "CbmRunDatabase.h" +#include "CbmYaml.h" #include "EventbuildChain.h" #include "Exceptions.h" #include "HistogramSender.h" @@ -40,7 +41,6 @@ #include "trd2d/Unpack.h" #include "util/TimingsFormat.h" #include "util/TsUtils.h" -#include "yaml/Yaml.h" #include <Monitor.hpp> #include <System.hpp> @@ -649,7 +649,7 @@ void Reco::QueueUnpackerMetricsDet(const UnpackMonitor<MSMonitor>& monitor) return; } - std::string_view det = ToString(monitor.system); + std::string_view det = util::ToString(monitor.system); auto MkKey = [&](std::string_view key) { return fmt::format("{}{}", key, Capitalize(det)); }; diff --git a/algo/kfp/KfpV0FinderChain.cxx b/algo/kfp/KfpV0FinderChain.cxx index fd8b556e92544bc7cd035b0e6b4eb3de833f86b9..a6e60ce770281a21d850f204d85c570a19901bd5 100644 --- a/algo/kfp/KfpV0FinderChain.cxx +++ b/algo/kfp/KfpV0FinderChain.cxx @@ -10,9 +10,9 @@ #include "kfp/KfpV0FinderChain.h" #include "AlgoFairloggerCompat.h" +#include "CbmYaml.h" #include "global/ParFiles.h" #include "kfp/KfpV0FinderConfig.h" -#include "yaml/Yaml.h" #include <sstream> diff --git a/algo/kfp/KfpV0FinderConfig.h b/algo/kfp/KfpV0FinderConfig.h index 4bd992e0cb406145ad29495f89acfc00827b6622..f21fb77cb2cae13a97259e6ebcf82ddfa2435bd5 100644 --- a/algo/kfp/KfpV0FinderConfig.h +++ b/algo/kfp/KfpV0FinderConfig.h @@ -9,7 +9,7 @@ #pragma once -#include "yaml/Yaml.h" +#include "CbmYaml.h" #include <string> #include <vector> diff --git a/algo/kfp/KfpV0FinderCutter.h b/algo/kfp/KfpV0FinderCutter.h index 597121d9508d07c6765aed9c50ea0cc723b0ffbf..cf9da88468f9ebe5cb3adcecc716a0a85364f3d9 100644 --- a/algo/kfp/KfpV0FinderCutter.h +++ b/algo/kfp/KfpV0FinderCutter.h @@ -10,8 +10,8 @@ #ifndef KfpV0FinderCutter_h #define KfpV0FinderCutter_h 0 +#include "CbmYaml.h" #include "kfp/KfpV0FinderDefs.h" -#include "yaml/Yaml.h" #include <array> #include <string> diff --git a/algo/kfp/KfpV0FinderDefs.h b/algo/kfp/KfpV0FinderDefs.h index 7bd79ecdb1c77d2d66cc08d6909bfb789c0d95f7..5c1fd29adbfe904c6d4838829d2e9dca70abada8 100644 --- a/algo/kfp/KfpV0FinderDefs.h +++ b/algo/kfp/KfpV0FinderDefs.h @@ -10,7 +10,7 @@ #ifndef KfpV0FinderDefs_h #define KfpV0FinderDefs_h 1 -#include "util/EnumDict.h" +#include "CbmEnumDict.h" #include <array> @@ -69,7 +69,7 @@ namespace cbm::algo::kfp }; } // namespace cbm::algo::kfp -namespace cbm::algo +namespace cbm::util { CBM_ENUM_DICT(cbm::algo::kfp::ETrackPid, {"Pip", cbm::algo::kfp::ETrackPid::Pip}, diff --git a/algo/test/CMakeLists.txt b/algo/test/CMakeLists.txt index c03c2d8996141e3c1bbf5444e270321201d03833..dbfcfa07a873fbd6f698ae6ce9fae15890517f92 100644 --- a/algo/test/CMakeLists.txt +++ b/algo/test/CMakeLists.txt @@ -18,7 +18,6 @@ EndFunction() AddBasicTest(_GTestTimeClusterTrigger) AddBasicTest(_GTestEventBuilder) AddBasicTest(_GTestDigiEventSelector) -AddBasicTest(_GTestYamlConfig) AddBasicTest(_GTestTrdClusterizer) AddBasicTest(_GTestChannelMapping) diff --git a/algo/unpack/CommonUnpacker.cxx b/algo/unpack/CommonUnpacker.cxx index d7cc52db073c3d64534202dec590e6314147f08a..ba737260e98a02a3a6ee151bbc1e06b939ea30da 100644 --- a/algo/unpack/CommonUnpacker.cxx +++ b/algo/unpack/CommonUnpacker.cxx @@ -23,7 +23,7 @@ detail::MSData::MSData(const fles::Timeslice& ts, fles::Subsystem subsystem, gsl if (std::find(legalEqIds.begin(), legalEqIds.end(), componentId) == legalEqIds.end()) { L_(error) << "Invalid equipment id 0x" << std::hex << std::setw(4) << componentId << std::dec << " for subsystem " - << ToString(subsystem); + << util::ToString(subsystem); monitor.errInvalidEqId++; continue; } @@ -36,5 +36,5 @@ detail::MSData::MSData(const fles::Timeslice& ts, fles::Subsystem subsystem, gsl msContent.push_back(ts.content(comp, mslice)); } } - L_(debug) << "Found " << monitor.numMs << " microslices for subsystem " << ToString(subsystem); + L_(debug) << "Found " << monitor.numMs << " microslices for subsystem " << util::ToString(subsystem); } diff --git a/algo/unpack/CommonUnpacker.h b/algo/unpack/CommonUnpacker.h index 3db3952e782feee53bcbc62c353b867f8287eb01..3d644c1c9b2491129f24c34cf60f1641959bdd21 100644 --- a/algo/unpack/CommonUnpacker.h +++ b/algo/unpack/CommonUnpacker.h @@ -118,12 +118,12 @@ namespace cbm::algo if (algo == fAlgos.end()) { if (!Contains(legalEqIds, msDesc.eq_id)) { L_(error) << "Invalid equip id " << std::hex << int{msDesc.eq_id} << std::dec << " for subsystem " - << ToString(subsystem); + << util::ToString(subsystem); monitorOut.errInvalidEqId++; } else { L_(error) << "Invalid system version " << std::hex << int{msDesc.sys_ver} << std::dec << " for subsystem " - << ToString(subsystem); + << util::ToString(subsystem); monitorOut.errInvalidSysVer++; } continue; diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 8ba66dcf1dffdb80499edc6ffb292d9d5deb4d06..df1544f16b1dd927b4e1d2f0e59e4bb59bad6552 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -6,6 +6,7 @@ set(CBMBASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/base) add_subdirectory(containers) add_subdirectory(data) add_subdirectory(log) +add_subdirectory(utility) # CbmRoot core for offline installation only if(NOT DEFINED CBM_ONLINE_STANDALONE) diff --git a/core/containers/test/_GTestPartitionedVector.cxx b/core/containers/test/_GTestPartitionedVector.cxx index e32fc4030a7237512cd28af53d397e746ddd43a5..fef0e05791c4aed6e750b20ad31d47ff5fd4c5f5 100644 --- a/core/containers/test/_GTestPartitionedVector.cxx +++ b/core/containers/test/_GTestPartitionedVector.cxx @@ -10,6 +10,10 @@ using cbm::PartitionedPODVector; using cbm::PartitionedVector; using cbm::PODAllocator; +using cbm::PartitionedPODVector; +using cbm::PartitionedVector; +using cbm::PODAllocator; + template<typename T> void EXPECT_CONTAINER_EQ(gsl::span<const T> a, std::vector<T> b) { diff --git a/core/qa/CMakeLists.txt b/core/qa/CMakeLists.txt index 9b022d7bb8905345543b90516b6693cfa36a4ec4..fd2f546b0fc858ebe04d60ed97f38930aa0f2afc 100644 --- a/core/qa/CMakeLists.txt +++ b/core/qa/CMakeLists.txt @@ -2,7 +2,6 @@ set(INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/checker ${CMAKE_CURRENT_SOURCE_DIR}/report ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_SOURCE_DIR}/algo/base # For "algo/base/yaml/*.h" included as relative "yaml/?????.h" to fit install tree ) set(SRCS @@ -47,6 +46,7 @@ set(LIBRARY_NAME CbmQaBase) set(LINKDEF ${LIBRARY_NAME}LinkDef.h) set(PUBLIC_DEPENDENCIES AlgoOffline + CbmUtility FairRoot::Base FairLogger::FairLogger external::yaml-cpp @@ -64,7 +64,6 @@ set(PRIVATE_DEPENDENCIES set(INTERFACE_DEPENDENCIES ROOT::Graf - CbmYamlInterface ) generate_cbm_library() diff --git a/core/qa/CbmQaIO.h b/core/qa/CbmQaIO.h index 274fd67191781a7ed198d735dbfc1a3aa3c47af3..2b5e585643ecd1dd5be619d9f48fc327862a5a97 100644 --- a/core/qa/CbmQaIO.h +++ b/core/qa/CbmQaIO.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2023 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt +/* Copyright (C) 2023-2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Sergei Zharko [committer] */ @@ -13,6 +13,7 @@ #include "CbmQaCanvas.h" #include "CbmQaEff.h" #include "CbmQaTable.h" +#include "CbmYaml.h" #include "Logger.h" #include "TCanvas.h" #include "TEfficiency.h" @@ -26,8 +27,6 @@ #include "TProfile3D.h" #include "TROOT.h" #include "TString.h" -#include "yaml/Property.h" -#include "yaml/Yaml.h" #include <limits> #include <optional> @@ -129,7 +128,7 @@ class CbmQaIO { std::optional<Config> res = std::nullopt; const auto& node = fConfigNode["specific"]; if (node) { - res = std::make_optional(cbm::algo::yaml::Read<Config>(node)); + res = std::make_optional(cbm::util::yaml::Read<Config>(node)); } return res; } diff --git a/core/run/CbmRunDatabase.h b/core/run/CbmRunDatabase.h index df22027af51ef312b6aae53e28cde75b12b0c619..d4e4b625d7c18b7c70e53a5699cc7d9ff84dad2c 100644 --- a/core/run/CbmRunDatabase.h +++ b/core/run/CbmRunDatabase.h @@ -16,7 +16,7 @@ #ifndef CbmRunDatabase_h #define CbmRunDatabase_h 1 -#include "yaml/Yaml.h" +#include "CbmYaml.h" #include <map> #include <string> @@ -32,7 +32,7 @@ namespace cbm std::map<uint32_t, std::string> geoSetup; ///< geometry setup tag CBM_YAML_PROPERTIES( - algo::yaml::Property(&RunDatabase::DbCommon::geoSetup, "geoSetup", "Run ID map for geometry setup tags")); + util::yaml::Property(&RunDatabase::DbCommon::geoSetup, "geoSetup", "Run ID map for geometry setup tags")); }; /// \struct DbCalibration @@ -42,8 +42,8 @@ namespace cbm std::map<uint32_t, std::string> tof; ///< TOF calibration tag CBM_YAML_PROPERTIES( - algo::yaml::Property(&RunDatabase::DbCalibration::bmon, "bmon", "Run ID map for BMON calibration tags"), - algo::yaml::Property(&RunDatabase::DbCalibration::tof, "tof", "Run ID map for TOF calibration tags")); + util::yaml::Property(&RunDatabase::DbCalibration::bmon, "bmon", "Run ID map for BMON calibration tags"), + util::yaml::Property(&RunDatabase::DbCalibration::tof, "tof", "Run ID map for TOF calibration tags")); }; /// \struct DbContents @@ -54,9 +54,9 @@ namespace cbm std::map<uint32_t, std::string> alignment; ///< Alignment tags CBM_YAML_PROPERTIES( - algo::yaml::Property(&RunDatabase::DbContents::common, "common", "Common parameters"), - algo::yaml::Property(&RunDatabase::DbContents::calibration, "calibration", "Calibration of detector subsystems"), - algo::yaml::Property(&RunDatabase::DbContents::alignment, "alignment", "Alignment matrices tag")); + util::yaml::Property(&RunDatabase::DbContents::common, "common", "Common parameters"), + util::yaml::Property(&RunDatabase::DbContents::calibration, "calibration", "Calibration of detector subsystems"), + util::yaml::Property(&RunDatabase::DbContents::alignment, "alignment", "Alignment matrices tag")); }; public: diff --git a/core/utility/CMakeLists.txt b/core/utility/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..29d72e315c04dbb5bde93574b1fac978dca425c5 --- /dev/null +++ b/core/utility/CMakeLists.txt @@ -0,0 +1,35 @@ +# A library for CBM common utilities. The utilities include generic functions and classes +# to extend the STL and BOOST C++. The library is not a place for a detector- or analysis-specific +# software. +# +add_subdirectory(yaml) + +set(SRCS + CbmEnumDict.cxx +) + +add_library(CbmUtility SHARED ${SRCS}) + +target_include_directories(CbmUtility + PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/yaml +) + +target_link_libraries(CbmUtility + PUBLIC GSL + fmt::fmt + xpu + external::yaml-cpp +) + +install(TARGETS CbmUtility DESTINATION lib) + +install( + FILES + CbmEnumDict.h + yaml/CbmYaml.h + yaml/CbmYamlBaseTypes.h + yaml/CbmYamlProperty.h + DESTINATION + include/ +) diff --git a/algo/base/util/EnumDict.cxx b/core/utility/CbmEnumDict.cxx similarity index 85% rename from algo/base/util/EnumDict.cxx rename to core/utility/CbmEnumDict.cxx index a0ffd40f360a6bea9e7f3976e08ef7b2c8f44cee..960d54df601821377009fda2e01ec38cea7dc615 100644 --- a/algo/base/util/EnumDict.cxx +++ b/core/utility/CbmEnumDict.cxx @@ -1,11 +1,11 @@ /* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main SPDX-License-Identifier: GPL-3.0-only Authors: Felix Weiglhofer [committer] */ -#include "EnumDict.h" +#include "CbmEnumDict.h" #include <sstream> -void cbm::algo::detail::RaiseUnknownEntry(std::string_view str, const std::vector<std::string_view>& validEntries) +void cbm::util::detail::RaiseUnknownEntry(std::string_view str, const std::vector<std::string_view>& validEntries) { std::ostringstream oss; oss << "Could not parse '" << str << "'. Valid entries are: "; diff --git a/algo/base/util/EnumDict.h b/core/utility/CbmEnumDict.h similarity index 87% rename from algo/base/util/EnumDict.h rename to core/utility/CbmEnumDict.h index fde2d6d7850590a8c5f089ccad49762dba3c2174..c60ab8a5a0aaaf33186d938424c25c7fa87c6cf3 100644 --- a/algo/base/util/EnumDict.h +++ b/core/utility/CbmEnumDict.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main +/* Copyright (C) 2023-2025 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main SPDX-License-Identifier: GPL-3.0-only Authors: Felix Weiglhofer [committer] */ #ifndef CBM_ALGO_BASE_UTIL_SERIALIZABLEENUM_H @@ -16,7 +16,7 @@ #include <fmt/format.h> #include <xpu/defines.h> -namespace cbm::algo +namespace cbm::util { namespace detail { @@ -68,7 +68,7 @@ namespace cbm::algo if (it == dict.end()) throw std::runtime_error(fmt::format("Entry {} for enum missing!", static_cast<int>(t))); return it->first; } -} // namespace cbm::algo +} // namespace cbm::util #if XPU_IS_CPU /** @@ -97,9 +97,9 @@ namespace cbm::algo */ #define CBM_ENUM_DICT(type, ...) \ template<> \ - inline const cbm::algo::detail::EnumDict_t<type> cbm::algo::detail::EnumDict<type> = {__VA_ARGS__}; \ + inline const cbm::util::detail::EnumDict_t<type> cbm::util::detail::EnumDict<type> = {__VA_ARGS__}; \ template<> \ - struct cbm::algo::detail::EnumHasDict<type> : std::true_type { \ + struct cbm::util::detail::EnumHasDict<type> : std::true_type { \ } #else // XPU_IS_CPU // Disable macro in GPU code, causes some issues with nvcc @@ -110,22 +110,22 @@ namespace cbm::algo // Placed in global namespace to be found by ADL e.g. for std::ostream_iterator namespace std { - template<typename T, typename = std::enable_if_t<cbm::algo::detail::EnumHasDict_v<T>>> + template<typename T, typename = std::enable_if_t<cbm::util::detail::EnumHasDict_v<T>>> std::ostream& operator<<(std::ostream& os, T t) { - os << cbm::algo::ToString(t); + os << cbm::util::ToString(t); return os; } - template<typename T, typename = std::enable_if_t<cbm::algo::detail::EnumHasDict_v<T>>> + template<typename T, typename = std::enable_if_t<cbm::util::detail::EnumHasDict_v<T>>> std::istream& operator>>(std::istream& is, T& t) { std::string str; is >> str; - auto maybet = cbm::algo::FromString<T>(str); + auto maybet = cbm::util::FromString<T>(str); if (!maybet) { - cbm::algo::detail::RaiseUnknownEntry(str, cbm::algo::detail::ValidEntries<T>()); + cbm::util::detail::RaiseUnknownEntry(str, cbm::util::detail::ValidEntries<T>()); } t = *maybet; diff --git a/core/utility/yaml/CMakeLists.txt b/core/utility/yaml/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..41fd9e08c37a9ba0393a2b147204af02be429039 --- /dev/null +++ b/core/utility/yaml/CMakeLists.txt @@ -0,0 +1,3 @@ +if (NOT CBM_ONLINE_STANDALONE) + add_subdirectory(test) +endif() diff --git a/algo/base/yaml/Yaml.h b/core/utility/yaml/CbmYaml.h similarity index 90% rename from algo/base/yaml/Yaml.h rename to core/utility/yaml/CbmYaml.h index e5dfa3d33adbe63720b129d52f762028b4f00840..b8fb5d2e4267b2a25bb125602c674e21a407c3dd 100644 --- a/algo/base/yaml/Yaml.h +++ b/core/utility/yaml/CbmYaml.h @@ -1,15 +1,15 @@ -/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main +/* Copyright (C) 2023-2025 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main SPDX-License-Identifier: GPL-3.0-only Authors: Felix Weiglhofer [committer] */ #ifndef CBM_YAML_YAML_H #define CBM_YAML_YAML_H #pragma once -#include "Definitions.h" -#include "compat/Filesystem.h" -#include "util/EnumDict.h" -#include "yaml/BaseTypes.h" -#include "yaml/Property.h" +#include "CbmEnumDict.h" +#include "CbmYamlBaseTypes.h" +#include "CbmYamlProperty.h" + +#include <boost/filesystem.hpp> #include <sstream> #include <string_view> @@ -17,8 +17,9 @@ #include <fmt/format.h> #include <yaml-cpp/yaml.h> -namespace cbm::algo::yaml +namespace cbm::util::yaml { + namespace fs = boost::filesystem; template<typename T> T Read(const YAML::Node& node); @@ -71,14 +72,14 @@ namespace cbm::algo::yaml #endif using Type = std::remove_cv_t<std::remove_reference_t<T>>; - static_assert(!IsEnum<T> || detail::EnumHasDict_v<T>, "Enum must have a dictionary to be deserializable"); + static_assert(!IsEnum<T> || util::detail::EnumHasDict_v<T>, "Enum must have a dictionary to be deserializable"); // TODO: error handling if constexpr (IsFundamental<Type>) { return node.as<Type>(); } else if constexpr (IsEnum<Type>) { - std::optional<T> maybet = FromString<T>(node.as<std::string>()); + std::optional<T> maybet = util::FromString<T>(node.as<std::string>()); if (!maybet) { throw std::runtime_error(fmt::format("Invalid enum value: {}", node.as<std::string>())); } @@ -207,7 +208,7 @@ namespace cbm::algo::yaml template<typename T> void DoDump(const T& object, YAML::Emitter& ss, std::optional<YAML::EMITTER_MANIP> formatEntries = {}) { - static_assert(!IsEnum<T> || detail::EnumHasDict_v<T>, "Enum must have a dictionary"); + static_assert(!IsEnum<T> || util::detail::EnumHasDict_v<T>, "Enum must have a dictionary"); if constexpr (IsFundamental<T>) { // Take care that i8 and u8 are printed as integers not as characters @@ -217,7 +218,7 @@ namespace cbm::algo::yaml ss << object; } else if constexpr (IsEnum<T>) { - ss << std::string{ToString<T>(object)}; + ss << std::string{util::ToString<T>(object)}; } else if constexpr (IsVector<T> || IsArray<T> || IsSet<T>) { ss << YAML::BeginSeq; @@ -288,7 +289,7 @@ namespace cbm::algo::yaml } }; -} // namespace cbm::algo::yaml +} // namespace cbm::util::yaml /** * @brief Declare the external instantiation of the Read and Dump functions for a type. @@ -297,15 +298,20 @@ namespace cbm::algo::yaml * Must be paired with CBM_YAML_INSTANTIATE in a source file. **/ #define CBM_YAML_EXTERN_DECL(type) \ - extern template type cbm::algo::yaml::Read<type>(const YAML::Node& node); \ - extern template std::string cbm::algo::yaml::Dump::operator()<type>(const type& value, int floatPrecision) + extern template type cbm::util::yaml::Read<type>(const YAML::Node& node); \ + extern template std::string cbm::util::yaml::Dump::operator()<type>(const type& value, int floatPrecision) /** * @brief Explicitly instantiate the Read and Dump functions for a type. * @see CBM_YAML_EXTERN_DECL */ #define CBM_YAML_INSTANTIATE(type) \ - template type cbm::algo::yaml::Read<type>(const YAML::Node& node); \ - template std::string cbm::algo::yaml::Dump::operator()<type>(const type& value, int floatPrecision); + template type cbm::util::yaml::Read<type>(const YAML::Node& node); \ + template std::string cbm::util::yaml::Dump::operator()<type>(const type& value, int floatPrecision); + +namespace cbm::algo +{ + namespace yaml = util::yaml; ///< For backward compatibility +}; #endif // CBM_YAML_YAML_H diff --git a/algo/base/yaml/BaseTypes.h b/core/utility/yaml/CbmYamlBaseTypes.h similarity index 88% rename from algo/base/yaml/BaseTypes.h rename to core/utility/yaml/CbmYamlBaseTypes.h index 1743aace818e77ba8ad33993711f79111a7e1b86..b8c8da820ebf41bcd6fa7ea574f42661038e1320 100644 --- a/algo/base/yaml/BaseTypes.h +++ b/core/utility/yaml/CbmYamlBaseTypes.h @@ -1,12 +1,10 @@ -/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main +/* Copyright (C) 2023-2025 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main SPDX-License-Identifier: GPL-3.0-only Authors: Felix Weiglhofer [committer] */ #ifndef CBM_YAML_BASETYPES_H #define CBM_YAML_BASETYPES_H #pragma once -#include "Definitions.h" - #include <array> #include <map> #include <set> @@ -15,8 +13,19 @@ #include <unordered_set> #include <vector> -namespace cbm::algo::yaml +namespace cbm::util::yaml { + // typealias for Rust-like fixed size integer types + using i8 = std::int8_t; + using u8 = std::uint8_t; + using i16 = std::int16_t; + using u16 = std::uint16_t; + using i32 = std::int32_t; + using u32 = std::uint32_t; + using i64 = std::int64_t; + using u64 = std::uint64_t; + using f32 = float; + using f64 = double; // clang-format off using FundamentalTypes = std::tuple< bool @@ -140,5 +149,5 @@ namespace cbm::algo::yaml constexpr bool IsSet = is_std_set<T>::value || is_std_unordered_set<T>::value; -} // namespace cbm::algo::yaml +} // namespace cbm::util::yaml #endif // CBM_YAML_BASETYPES_H diff --git a/algo/base/yaml/Property.h b/core/utility/yaml/CbmYamlProperty.h similarity index 94% rename from algo/base/yaml/Property.h rename to core/utility/yaml/CbmYamlProperty.h index 223a978542779a9499bb7f95d5b273f5238f4d5c..9cec645220b455ae9739310a69c27c821b9ffbfa 100644 --- a/algo/base/yaml/Property.h +++ b/core/utility/yaml/CbmYamlProperty.h @@ -1,19 +1,17 @@ -/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main +/* Copyright (C) 2023-2025 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main SPDX-License-Identifier: GPL-3.0-only Authors: Felix Weiglhofer [committer] */ #ifndef CBM_YAML_PROPERTY_H #define CBM_YAML_PROPERTY_H #pragma once -#include "Definitions.h" - #include <optional> #include <string_view> #include <tuple> #include <yaml-cpp/emittermanip.h> -namespace cbm::algo::yaml +namespace cbm::util::yaml { template<typename Class, typename T> @@ -62,7 +60,7 @@ namespace cbm::algo::yaml template<typename Class, typename T> Property(T Class::*member, std::string_view key, std::string_view description) -> Property<Class, T>; -} // namespace cbm::algo::yaml +} // namespace cbm::util::yaml #define CBM_YAML_PROPERTIES(...) \ public: \ diff --git a/core/utility/yaml/test/CMakeLists.txt b/core/utility/yaml/test/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..8ad5d4b1d62a8b1607a330287e50fd6574e56fcf --- /dev/null +++ b/core/utility/yaml/test/CMakeLists.txt @@ -0,0 +1,18 @@ +Function(AddBasicTest name) + set(PVT_DEPS + CbmUtility + Gtest + GtestMain + pthread + ) + + add_executable(${name} ${name}.cxx) + target_link_libraries(${name} PUBLIC ${PVT_DEPS}) + Add_Test( + NAME ${name} + COMMAND ${name} + WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} + ) +EndFunction() + +AddBasicTest(_GTestYamlConfig) diff --git a/algo/test/_GTestYamlConfig.cxx b/core/utility/yaml/test/_GTestYamlConfig.cxx similarity index 73% rename from algo/test/_GTestYamlConfig.cxx rename to core/utility/yaml/test/_GTestYamlConfig.cxx index fd147efede1d2ee4567e7a7b0411198e4beed039..4d3daaedec3fe786c3a2ac1bebfd280c1750311f 100644 --- a/algo/test/_GTestYamlConfig.cxx +++ b/core/utility/yaml/test/_GTestYamlConfig.cxx @@ -1,12 +1,11 @@ -/* Copyright (C) 2023 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main +/* Copyright (C) 2023-2025 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main SPDX-License-Identifier: GPL-3.0-only Authors: Felix Weiglhofer [committer] */ +#include "CbmYaml.h" #include "gtest/gtest.h" -#include "yaml/Property.h" -#include "yaml/Yaml.h" -using namespace cbm::algo; +using namespace cbm::util::yaml; // // TODO: These tests are nowhere near exhaustive. Extend after the DC. @@ -22,7 +21,7 @@ TEST(Config, CanDeserializeStdMap) ss << "5: 6\n"; YAML::Node node = YAML::Load(ss.str()); - auto map = yaml::Read<Map_t>(node); + auto map = Read<Map_t>(node); EXPECT_EQ(map.size(), 3); EXPECT_EQ(map.at(1), 2); @@ -39,7 +38,7 @@ TEST(Config, CanSerializeStdMap) map[3] = 4; map[5] = 6; - YAML::Node node = YAML::Load(yaml::Dump{}(map)); + YAML::Node node = YAML::Load(Dump{}(map)); EXPECT_EQ(node.size(), 3); EXPECT_EQ(node[1].as<i32>(), 2); @@ -56,7 +55,7 @@ class Foo { i32 GetBar() const { return fBar; } i32 GetBaz() const { return fBaz; } - CBM_YAML_PROPERTIES(yaml::Property(&Foo::fBar, "bar", ""), yaml::Property(&Foo::fBaz, "baz", "")); + CBM_YAML_PROPERTIES(Property(&Foo::fBar, "bar", ""), Property(&Foo::fBaz, "baz", "")); }; TEST(Config, CanAccessPrivateMembers) @@ -66,7 +65,7 @@ TEST(Config, CanAccessPrivateMembers) ss << "baz: 2\n"; YAML::Node node = YAML::Load(ss.str()); - auto foo = yaml::Read<Foo>(node); + auto foo = Read<Foo>(node); EXPECT_EQ(foo.GetBar(), 1); EXPECT_EQ(foo.GetBaz(), 2); diff --git a/reco/KF/CbmKFV0FinderTask.cxx b/reco/KF/CbmKFV0FinderTask.cxx index d455da2f3fb4d89863315d93e789cbfc2b1470b3..69d8dedf613606f9176854ac80bda0b9487a1709 100644 --- a/reco/KF/CbmKFV0FinderTask.cxx +++ b/reco/KF/CbmKFV0FinderTask.cxx @@ -20,6 +20,7 @@ #include "CbmTofTrack.h" #include "CbmTrdHit.h" #include "CbmTrdTrack.h" +#include "CbmYaml.h" #include "FairRunAna.h" #include "KFPTrackVector.h" #include "KFVertex.h" @@ -28,7 +29,6 @@ #include "TMatrixTSym.h" #include "kfp/KfpV0FinderConfig.h" #include "kfp/KfpV0FinderCutter.h" -#include "yaml/Yaml.h" #include <boost/filesystem.hpp> diff --git a/reco/KF/KFParticleInterface.cmake b/reco/KF/KFParticleInterface.cmake index 24e7b0874fd11f24bf42ab1ddec74b783a638df5..f6368ee6def92ed8d69f4e6aa0df89faf0c23f14 100644 --- a/reco/KF/KFParticleInterface.cmake +++ b/reco/KF/KFParticleInterface.cmake @@ -57,6 +57,7 @@ Set(LIBRARY_NAME KFParticleInterface) set(LINKDEF ${LIBRARY_NAME}LinkDef.h) set(PUBLIC_DEPENDENCIES CbmData + CbmUtility KF FairRoot::Base ROOT::Core @@ -78,7 +79,6 @@ set(PRIVATE_DEPENDENCIES set(INTERFACE_DEPENDENCIES CbmRecoBase - CbmYamlInterface ) Set(DEFINITIONS -DDO_TPCCATRACKER_EFF_PERFORMANCE -DNonhomogeneousField -DCBM -DUSE_TIMERS) diff --git a/reco/L1/CMakeLists.txt b/reco/L1/CMakeLists.txt index 4e0573c8d40ae76c8f6b6ddf826e9fe2f24b3a72..d15126176085edb2ff96b7e1fa366ee8a2ce00f2 100644 --- a/reco/L1/CMakeLists.txt +++ b/reco/L1/CMakeLists.txt @@ -143,6 +143,7 @@ set(PUBLIC_DEPENDENCIES CbmStsBase CbmTofBase CbmTrdBase + CbmUtility CaCoreOffline KfCbm CbmBase @@ -175,10 +176,6 @@ set(PRIVATE_DEPENDENCIES ROOT::RIO ) -set(INTERFACE_DEPENDENCIES - CbmYamlInterface -) - generate_cbm_library() add_dependencies(G__L1 KFPARTICLE) diff --git a/reco/L1/OffLineInterface/CbmGenerateMaterialMaps.h b/reco/L1/OffLineInterface/CbmGenerateMaterialMaps.h index 1bb05bfc716982a2b7e1310b7d201a34ac9af3c0..c60cb81e994dc9d39bba66bbc3099d5cc6dadf5f 100644 --- a/reco/L1/OffLineInterface/CbmGenerateMaterialMaps.h +++ b/reco/L1/OffLineInterface/CbmGenerateMaterialMaps.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt +/* Copyright (C) 2024-2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Sergei Zharko [committer] */ @@ -9,10 +9,10 @@ #pragma once +#include "CbmYaml.h" #include "FairTask.h" #include "KfMaterialMap.h" #include "KfMaterialMapFactory.h" -#include "yaml/Yaml.h" #include <map> #include <string> @@ -36,11 +36,11 @@ class CbmGenerateMaterialMaps : public FairTask { bool operator<(const MaterialSlice& r) const { return (fRefZ < r.fRefZ); } - CBM_YAML_PROPERTIES(cbm::algo::yaml::Property(&CbmGenerateMaterialMaps::MaterialSlice::fName, "name", ""), - cbm::algo::yaml::Property(&CbmGenerateMaterialMaps::MaterialSlice::fRefZ, "ref_z", ""), - cbm::algo::yaml::Property(&CbmGenerateMaterialMaps::MaterialSlice::fMinZ, "min_z", ""), - cbm::algo::yaml::Property(&CbmGenerateMaterialMaps::MaterialSlice::fMaxZ, "max_z", ""), - cbm::algo::yaml::Property(&CbmGenerateMaterialMaps::MaterialSlice::fMaxXY, "max_xy", "")); + CBM_YAML_PROPERTIES(cbm::util::yaml::Property(&CbmGenerateMaterialMaps::MaterialSlice::fName, "name", ""), + cbm::util::yaml::Property(&CbmGenerateMaterialMaps::MaterialSlice::fRefZ, "ref_z", ""), + cbm::util::yaml::Property(&CbmGenerateMaterialMaps::MaterialSlice::fMinZ, "min_z", ""), + cbm::util::yaml::Property(&CbmGenerateMaterialMaps::MaterialSlice::fMaxZ, "max_z", ""), + cbm::util::yaml::Property(&CbmGenerateMaterialMaps::MaterialSlice::fMaxXY, "max_xy", "")); }; struct Config { @@ -53,14 +53,14 @@ class CbmGenerateMaterialMaps : public FairTask { bool fbTrackingStations = false; ///< Generates material maps for the actual geometry stations bool fbSafeMaterialInit = true; ///< Safe material initialization (takes extra computational time) - CBM_YAML_PROPERTIES(cbm::algo::yaml::Property(&CbmGenerateMaterialMaps::Config::fvUserSlices, "user_slices", ""), - cbm::algo::yaml::Property(&CbmGenerateMaterialMaps::Config::fPitch, "pitch", ""), - cbm::algo::yaml::Property(&CbmGenerateMaterialMaps::Config::fMaxNofBins, "max_nof_bins", ""), - cbm::algo::yaml::Property(&CbmGenerateMaterialMaps::Config::fNofRays, "nof_rays", ""), - cbm::algo::yaml::Property(&CbmGenerateMaterialMaps::Config::fbParallelRays, "parallel_rays", ""), - cbm::algo::yaml::Property(&CbmGenerateMaterialMaps::Config::fbTrackingStations, + CBM_YAML_PROPERTIES(cbm::util::yaml::Property(&CbmGenerateMaterialMaps::Config::fvUserSlices, "user_slices", ""), + cbm::util::yaml::Property(&CbmGenerateMaterialMaps::Config::fPitch, "pitch", ""), + cbm::util::yaml::Property(&CbmGenerateMaterialMaps::Config::fMaxNofBins, "max_nof_bins", ""), + cbm::util::yaml::Property(&CbmGenerateMaterialMaps::Config::fNofRays, "nof_rays", ""), + cbm::util::yaml::Property(&CbmGenerateMaterialMaps::Config::fbParallelRays, "parallel_rays", ""), + cbm::util::yaml::Property(&CbmGenerateMaterialMaps::Config::fbTrackingStations, "tracking_stations", ""), - cbm::algo::yaml::Property(&CbmGenerateMaterialMaps::Config::fbSafeMaterialInit, + cbm::util::yaml::Property(&CbmGenerateMaterialMaps::Config::fbSafeMaterialInit, "safe_material_init", "")); }; diff --git a/reco/tasks/CMakeLists.txt b/reco/tasks/CMakeLists.txt index cd37d5cbb1057f6162371f1ebb16d5b3160403d1..0c10f050b8b50e8472c56ed70fbbebc2bec4a646 100644 --- a/reco/tasks/CMakeLists.txt +++ b/reco/tasks/CMakeLists.txt @@ -61,7 +61,6 @@ set(PRIVATE_DEPENDENCIES set(INTERFACE_DEPENDENCIES external::fles_ipc - CbmYamlInterface ) generate_cbm_library() diff --git a/reco/tasks/CbmTaskStsHitFinderParWrite.cxx b/reco/tasks/CbmTaskStsHitFinderParWrite.cxx index cb27cbcfc71f78dcaade2853d8b6b96c89483b7d..928df95bb6f0a622dbc5b4d28098d8b6b0179eef 100644 --- a/reco/tasks/CbmTaskStsHitFinderParWrite.cxx +++ b/reco/tasks/CbmTaskStsHitFinderParWrite.cxx @@ -1,4 +1,4 @@ -/* Copyright (C) 2024 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main +/* Copyright (C) 2024-2025 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main SPDX-License-Identifier: GPL-3.0-only Authors: Felix Weiglhofer [committer] */ @@ -13,8 +13,8 @@ #include "CbmStsPhysics.h" #include "CbmStsRecoModule.h" #include "CbmStsSetup.h" +#include "CbmYaml.h" #include "sts/HitfinderPars.h" -#include "yaml/Yaml.h" #include <FairField.h> #include <FairRootManager.h> diff --git a/reco/tasks/CbmTaskTofClusterizer.cxx b/reco/tasks/CbmTaskTofClusterizer.cxx index cbf6ca5aefad193d9005c3ca177bec58e8510287..09f8b087575e5d1055efec82013683479ec7cc20 100644 --- a/reco/tasks/CbmTaskTofClusterizer.cxx +++ b/reco/tasks/CbmTaskTofClusterizer.cxx @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Facility for Antiproton and Ion Research in Europe, Darmstadt +/* Copyright (C) 2022-2025 Facility for Antiproton and Ion Research in Europe, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Dominik Smith [committer], Pierre-Alain Loizeau, Norbert Herrmann */ @@ -25,8 +25,8 @@ #include "TStopwatch.h" // C++ Classes and includes +#include "CbmYaml.h" #include "compat/Filesystem.h" -#include "yaml/Yaml.h" #include <iomanip> #include <vector> diff --git a/reco/tasks/CbmTaskTofClusterizerParWrite.cxx b/reco/tasks/CbmTaskTofClusterizerParWrite.cxx index 3ce04fce2fadf7024ddab60b4636ff0e0c977544..ca40713de2b88322d038751a2797f562ebbb9fb8 100644 --- a/reco/tasks/CbmTaskTofClusterizerParWrite.cxx +++ b/reco/tasks/CbmTaskTofClusterizerParWrite.cxx @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Facility for Antiproton and Ion Research in Europe, Darmstadt +/* Copyright (C) 2022-2025 Facility for Antiproton and Ion Research in Europe, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Dominik Smith [committer], Pierre-Alain Loizeau, Norbert Herrmann */ @@ -17,6 +17,7 @@ #include "CbmTofGeoHandler.h" // in tof/TofTools // FAIR classes and includes +#include "CbmYaml.h" #include "FairRootFileSink.h" #include "FairRootManager.h" #include "FairRunAna.h" @@ -25,7 +26,6 @@ #include "bmon/HitfindSetup.h" #include "tof/CalibrateSetup.h" #include "tof/HitfindSetup.h" -#include "yaml/Yaml.h" #include <Logger.h> diff --git a/reco/tasks/CbmTaskTrdHitFinder.cxx b/reco/tasks/CbmTaskTrdHitFinder.cxx index b9785e20b15aa968f7a3682ef998ed2928e9ba87..83a5001be3a94f6d5e49871c7c62dddd3c71522f 100644 --- a/reco/tasks/CbmTaskTrdHitFinder.cxx +++ b/reco/tasks/CbmTaskTrdHitFinder.cxx @@ -1,10 +1,11 @@ -/* Copyright (C) 2010-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt +/* Copyright (C) 2010-2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Florian Uhlig [committer], Pascal Raisig, Alexandru Bercuci */ #include "CbmTaskTrdHitFinder.h" #include "CbmDigiManager.h" +#include "CbmYaml.h" #include <FairRootManager.h> #include <FairRunAna.h> @@ -13,7 +14,6 @@ // C++ Classes and includes #include "compat/Filesystem.h" -#include "yaml/Yaml.h" #include <TStopwatch.h> #include <TVector3.h> diff --git a/reco/tasks/CbmTaskTrdHitFinderParWrite.cxx b/reco/tasks/CbmTaskTrdHitFinderParWrite.cxx index 247f73e738888386a51e3440416ce8ccb1c62ef3..d14949be4f62e24bf1c3579aab9b846b8a55bfd3 100644 --- a/reco/tasks/CbmTaskTrdHitFinderParWrite.cxx +++ b/reco/tasks/CbmTaskTrdHitFinderParWrite.cxx @@ -1,4 +1,4 @@ -/* Copyright (C) 2010-2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt +/* Copyright (C) 2010-2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Florian Uhlig [committer], Pascal Raisig, Alexandru Bercuci */ @@ -12,11 +12,11 @@ #include "CbmTrdParSetAsic.h" #include "CbmTrdParSetDigi.h" #include "CbmTrdParSetGeo.h" +#include "CbmYaml.h" #include "TGeoPhysicalNode.h" #include "TVector3.h" #include "trd/Hitfind2DSetup.h" #include "trd/HitfindSetup.h" -#include "yaml/Yaml.h" #include <FairRootManager.h> #include <FairRunAna.h> diff --git a/reco/tasks/CbmTaskTrdUnpackParWrite.cxx b/reco/tasks/CbmTaskTrdUnpackParWrite.cxx index 6679dc59958d92b6a44e010ad992276a813e980f..4282a8a09b9297d505670745ca7768173c379c38 100644 --- a/reco/tasks/CbmTaskTrdUnpackParWrite.cxx +++ b/reco/tasks/CbmTaskTrdUnpackParWrite.cxx @@ -1,4 +1,4 @@ -/* Copyright (C) 2024 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main +/* Copyright (C) 2024-2025 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main SPDX-License-Identifier: GPL-3.0-only Authors: Felix Weiglhofer [committer] */ @@ -10,9 +10,9 @@ #include "CbmTrdParSetAsic.h" #include "CbmTrdParSetDigi.h" #include "CbmTrdParSpadic.h" +#include "CbmYaml.h" #include "trd/ReadoutConfig.h" #include "trd2d/ReadoutConfig.h" -#include "yaml/Yaml.h" #include <FairParamList.h> #include <fairlogger/Logger.h> diff --git a/reco/tasks/CbmTaskUnpack.cxx b/reco/tasks/CbmTaskUnpack.cxx index feb1d29f409338f8ecd7c17a934bf19364a3bb3e..80a3fbd5a3d221d6b4a9d05c30ab49afe8f3975c 100644 --- a/reco/tasks/CbmTaskUnpack.cxx +++ b/reco/tasks/CbmTaskUnpack.cxx @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt +/* Copyright (C) 2022-2025 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt SPDX-License-Identifier: GPL-3.0-only Authors: Volker Friese [committer] */ @@ -20,13 +20,13 @@ #include "CbmTrdParSetDigi.h" #include "CbmTrdParSpadic.h" #include "CbmTsEventHeader.h" +#include "CbmYaml.h" #include "MicrosliceDescriptor.hpp" #include "ParFiles.h" #include "System.hpp" #include "bmon/ReadoutConfig.h" #include "sts/ChannelMaskSet.h" #include "tof/ReadoutConfig.h" -#include "yaml/Yaml.h" #include <FairParAsciiFileIo.h> #include <FairParamList.h>