diff --git a/.clang-format b/.clang-format index 95a9e1a080431717dd6a8ef09cca5b8d6049cdaa..75638529d9da9a7f193d62a4d5b4ad72d434fbdc 100644 --- a/.clang-format +++ b/.clang-format @@ -150,7 +150,7 @@ SpacesInContainerLiterals: false SpacesInParentheses: false SpacesInSquareBrackets: false -WhitespaceSensitiveMacros: ['CBM_ENUM_DICT'] +WhitespaceSensitiveMacros: ['CBM_ENUM_DICT', 'CBM_YAML_PROPERTIES'] StatementMacros: ['CBM_PARALLEL_FOR'] Standard: c++11 diff --git a/algo/CMakeLists.txt b/algo/CMakeLists.txt index c96bac5cfd7e22bfbfd14264e36675385d6030e1..0d419051e43f3529ede26dd5026da8dd62674455 100644 --- a/algo/CMakeLists.txt +++ b/algo/CMakeLists.txt @@ -213,7 +213,7 @@ endif() install(TARGETS Algo DESTINATION lib) install(DIRECTORY base/compat TYPE INCLUDE FILES_MATCHING PATTERN "*.h") -install(DIRECTORY base/config TYPE INCLUDE FILES_MATCHING PATTERN "*.h") +install(DIRECTORY base/yaml TYPE INCLUDE FILES_MATCHING PATTERN "*.h") install(DIRECTORY base/util TYPE INCLUDE FILES_MATCHING PATTERN "*.h") install(DIRECTORY base/gpu TYPE INCLUDE FILES_MATCHING PATTERN "*.h") install(DIRECTORY data/sts TYPE INCLUDE FILES_MATCHING PATTERN "*.h") diff --git a/algo/base/RecoParams.h b/algo/base/RecoParams.h index 22a01f3769bc4b01856eb45e25e0afc3b62350ea..e8093afe797539dd7299217d989e19b9ccd8c256 100644 --- a/algo/base/RecoParams.h +++ b/algo/base/RecoParams.h @@ -5,9 +5,9 @@ #define CBM_ALGO_BASE_RECOPARAMS_H #include "Definitions.h" -#include "config/Property.h" -#include "config/Yaml.h" #include "util/EnumDict.h" +#include "yaml/Property.h" +#include "yaml/Yaml.h" #include <xpu/defines.h> @@ -58,40 +58,40 @@ namespace cbm::algo bool IsStatic() const { return allocationMode == RecoParams::AllocationMode::Static; } bool IsAuto() const { return allocationMode == RecoParams::AllocationMode::Auto; } - static constexpr auto Properties = std::make_tuple( - config::Property(&Memory::allocationMode, "allocationMode", "Allocation mode (Auto, Static, Dynamic)"), - config::Property(&Memory::maxNDigisPerTS, "maxNDigisPerTS", "Maximal number of digis per time slice"), - config::Property(&Memory::maxNDigisPerModule, "maxNDigisPerModule", "Maximal number of digis per module"), - config::Property(&Memory::clustersPerDigi, "clustersPerDigi", "Number of clusters per digi in a time slice"), - config::Property(&Memory::hitsPerCluster, "hitsPerCluster", "Number of hits per cluster in a time slice")); + CBM_YAML_PROPERTIES( + yaml::Property(&Memory::allocationMode, "allocationMode", "Allocation mode (Auto, Static, Dynamic)"), + yaml::Property(&Memory::maxNDigisPerTS, "maxNDigisPerTS", "Maximal number of digis per time slice"), + yaml::Property(&Memory::maxNDigisPerModule, "maxNDigisPerModule", "Maximal number of digis per module"), + yaml::Property(&Memory::clustersPerDigi, "clustersPerDigi", "Number of clusters per digi in a time slice"), + yaml::Property(&Memory::hitsPerCluster, "hitsPerCluster", "Number of hits per cluster in a time slice")); } memory; - static constexpr auto Properties = std::make_tuple( - config::Property(&STS::digiSortMode, "digiSortMode", + CBM_YAML_PROPERTIES( + yaml::Property(&STS::digiSortMode, "digiSortMode", "Digi sort mode (0 = block sort, 1 = cub segmented sort))"), - config::Property(&STS::clusterSortMode, "clusterSortMode", "Cluster sort mode"), + yaml::Property(&STS::clusterSortMode, "clusterSortMode", "Cluster sort mode"), - config::Property(&STS::findClustersMultiKernels, "findClustersMultiKernels", + yaml::Property(&STS::findClustersMultiKernels, "findClustersMultiKernels", "Split cluster finding into multiple kernels"), - config::Property(&STS::timeCutDigiAbs, "timeCutDigiAbs", + yaml::Property(&STS::timeCutDigiAbs, "timeCutDigiAbs", "Time delta for neighboring digis to be considered for the same cluster. [ns]"), - config::Property( + yaml::Property( &STS::timeCutDigiSig, "timeCutDigiSig", "Used if timeCutDigiAbs is negative. Time delta must be < 'value * sqrt2 * timeResolution'. [ns]"), - config::Property(&STS::timeCutClusterAbs, "timeCutClusterAbs", + yaml::Property(&STS::timeCutClusterAbs, "timeCutClusterAbs", "Maximal time difference between two clusters in a hit [ns]." " Setting to a positive value will override timeCutClustersSig."), - config::Property( + yaml::Property( &STS::timeCutClusterSig, "timeCutClusterSig", "Time cut for clusters." " Two clusters are considered it their time difference is below 'value * sqrt(terr1**2 + terr2*+2)'"), - config::Property(&STS::memory, "memory", "Memory limits for STS reco")); + yaml::Property(&STS::memory, "memory", "Memory limits for STS reco")); }; STS sts; - static constexpr auto Properties = std::make_tuple(config::Property(&RecoParams::sts, "sts", "STS reco settings")); + CBM_YAML_PROPERTIES(yaml::Property(&RecoParams::sts, "sts", "STS reco settings")); }; } // namespace cbm::algo diff --git a/algo/base/config/BaseTypes.h b/algo/base/yaml/BaseTypes.h similarity index 94% rename from algo/base/config/BaseTypes.h rename to algo/base/yaml/BaseTypes.h index d3f9441c87207e0d70c41bee12fcbcf5985188a0..1a58763e2b5b016f30574883a80b90e396ded45e 100644 --- a/algo/base/config/BaseTypes.h +++ b/algo/base/yaml/BaseTypes.h @@ -1,8 +1,7 @@ /* 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_BASE_CONFIG_BASETYPES_H -#define CBM_ALGO_BASE_CONFIG_BASETYPES_H +#pragma once #include "Definitions.h" @@ -14,7 +13,7 @@ #include <unordered_set> #include <vector> -namespace cbm::algo::config +namespace cbm::algo::yaml { // clang-format off @@ -139,6 +138,4 @@ namespace cbm::algo::config constexpr bool IsSet = is_std_set<T>::value || is_std_unordered_set<T>::value; -} // namespace cbm::algo::config - -#endif // CBM_ALGO_BASE_CONFIG_BASETYPES_H +} // namespace cbm::algo::yaml diff --git a/algo/base/config/Property.h b/algo/base/yaml/Property.h similarity index 88% rename from algo/base/config/Property.h rename to algo/base/yaml/Property.h index f337749ccdde1c2f579d05ad73039dc137284b30..644c77bfdc9b284f49180455aad534970f0db23d 100644 --- a/algo/base/config/Property.h +++ b/algo/base/yaml/Property.h @@ -1,8 +1,7 @@ /* 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_BASE_CONFIG_PROPERTY_H -#define CBM_ALGO_BASE_CONFIG_PROPERTY_H +#pragma once #include "Definitions.h" @@ -12,7 +11,7 @@ #include <yaml-cpp/emittermanip.h> -namespace cbm::algo::config +namespace cbm::algo::yaml { template<typename Class, typename T> @@ -61,16 +60,16 @@ namespace cbm::algo::config template<typename Class, typename T> Property(T Class::*member, std::string_view key, std::string_view description) -> Property<Class, T>; -} // namespace cbm::algo::config +} // namespace cbm::algo::yaml -#define CBM_PROPERTIES(...) \ +#define CBM_YAML_PROPERTIES(...) \ public: \ static constexpr auto Properties = std::make_tuple(__VA_ARGS__) /** * @brief Optional tag to specify a formatting of the class (YAML::Flow vs YAML::Block) */ -#define CBM_FORMAT(tag) \ +#define CBM_YAML_FORMAT(tag) \ public: \ static constexpr std::optional<YAML::EMITTER_MANIP> FormatAs = tag @@ -80,8 +79,6 @@ namespace cbm::algo::config * * @note This is useful to make some config files more compact. */ -#define CBM_MERGE_PROPERTY() \ +#define CBM_YAML_MERGE_PROPERTY() \ public: \ static constexpr bool MergeProperty = true - -#endif // CBM_ALGO_BASE_CONFIG_PROPERTY_H diff --git a/algo/base/config/Yaml.h b/algo/base/yaml/Yaml.h similarity index 94% rename from algo/base/config/Yaml.h rename to algo/base/yaml/Yaml.h index d7b5d5c0c3d00c6eae45c65593f096fd1babb168..8745bd141637487614d040c39427a6e1b9c2393e 100644 --- a/algo/base/config/Yaml.h +++ b/algo/base/yaml/Yaml.h @@ -1,8 +1,7 @@ /* 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_BASE_CONFIG_DESERIALIZE_H -#define CBM_ALGO_BASE_CONFIG_DESERIALIZE_H +#pragma once #include "BaseTypes.h" #include "Definitions.h" @@ -16,7 +15,7 @@ #include <fmt/format.h> #include <yaml-cpp/yaml.h> -namespace cbm::algo::config +namespace cbm::algo::yaml { template<typename T> @@ -287,7 +286,7 @@ namespace cbm::algo::config } }; -} // namespace cbm::algo::config +} // namespace cbm::algo::yaml /** * @brief Declare the external instantiation of the Read and Dump functions for a type. @@ -296,15 +295,13 @@ namespace cbm::algo::config * Must be paired with CBM_YAML_INSTANTIATE in a source file. **/ #define CBM_YAML_EXTERN_DECL(type) \ - extern template type cbm::algo::config::Read<type>(const YAML::Node& node); \ - extern template std::string cbm::algo::config::Dump::operator()<type>(const type& value, int floatPrecision) + 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) /** * @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::config::Read<type>(const YAML::Node& node); \ - template std::string cbm::algo::config::Dump::operator()<type>(const type& value, int floatPrecision); - -#endif + 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); diff --git a/algo/ca/TrackingChain.cxx b/algo/ca/TrackingChain.cxx index 58d90696c7c5db4d26f3c7fec028f5ca33c87dde..f84d9f8fe0ad9895837559e99f9cb3d64b795579 100644 --- a/algo/ca/TrackingChain.cxx +++ b/algo/ca/TrackingChain.cxx @@ -14,8 +14,8 @@ #include "CaInitManager.h" #include "CaParameters.h" #include "TrackingChainConfig.h" -#include "config/Yaml.h" #include "tof/Config.h" +#include "yaml/Yaml.h" #include <fstream> #include <unordered_map> @@ -43,7 +43,7 @@ TrackingChain::TrackingChain(std::shared_ptr<HistogramSender> histoSender) : fQa void TrackingChain::Init() { // ------ Read tracking chain parameters from the config - auto config = config::ReadFromFile<TrackingChainConfig>(Opts().ParamsDir() / "CaConfig.yaml"); + auto config = yaml::ReadFromFile<TrackingChainConfig>(Opts().ParamsDir() / "CaConfig.yaml"); // ------ Read parameters from binary auto paramFile = Opts().ParamsDir() / config.fsParName; diff --git a/algo/ca/TrackingChainConfig.h b/algo/ca/TrackingChainConfig.h index bf765e927aa5a307e047e61ad94d1d9954941a3f..a6844f09b80b99c5db59dcded195cf44f0209306 100644 --- a/algo/ca/TrackingChainConfig.h +++ b/algo/ca/TrackingChainConfig.h @@ -9,7 +9,7 @@ #pragma once -#include "config/Property.h" +#include "yaml/Property.h" #include <string> #include <tuple> @@ -22,8 +22,7 @@ namespace cbm::algo int fNofThreads; ///< Number of threads for tracking std::string fsParName; ///< Tracking parameter file name - static constexpr auto Properties = - std::make_tuple(config::Property(&TrackingChainConfig::fNofThreads, "NofThreads", "Number of threads"), - config::Property(&TrackingChainConfig::fsParName, "ParName", "CA parameters input")); + CBM_YAML_PROPERTIES(yaml::Property(&TrackingChainConfig::fNofThreads, "NofThreads", "Number of threads"), + yaml::Property(&TrackingChainConfig::fsParName, "ParName", "CA parameters input")); }; } // namespace cbm::algo diff --git a/algo/data/sts/HitfinderPars.h b/algo/data/sts/HitfinderPars.h index b0923900ec5a918448881e0767e196903b1c3693..3e58fa30e0d46d0649f23572d61d7ffee11db8f8 100644 --- a/algo/data/sts/HitfinderPars.h +++ b/algo/data/sts/HitfinderPars.h @@ -5,8 +5,8 @@ #include "Definitions.h" #include "LandauTable.h" -#include "config/Property.h" -#include "config/Yaml.h" +#include "yaml/Property.h" +#include "yaml/Yaml.h" #include <xpu/defines.h> @@ -27,11 +27,15 @@ namespace cbm::algo::sts return threshold + dynamicRange / float(nAdc) * (float(adc) + 0.5f); } - static constexpr auto Properties = std::make_tuple( - config::Property(&Asic::nAdc, "nAdc"), config::Property(&Asic::dynamicRange, "dynamicRange"), - config::Property(&Asic::threshold, "threshold"), config::Property(&Asic::timeResolution, "timeResolution"), - config::Property(&Asic::deadTime, "deadTime"), config::Property(&Asic::noise, "noise"), - config::Property(&Asic::zeroNoiseRate, "zeroNoiseRate")); + CBM_YAML_PROPERTIES( + yaml::Property(&Asic::nAdc, "nAdc"), + yaml::Property(&Asic::dynamicRange, "dynamicRange"), + yaml::Property(&Asic::threshold, "threshold"), + yaml::Property(&Asic::timeResolution, "timeResolution"), + yaml::Property(&Asic::deadTime, "deadTime"), + yaml::Property(&Asic::noise, "noise"), + yaml::Property(&Asic::zeroNoiseRate, "zeroNoiseRate") + ); }; struct ModuleTransform { @@ -43,9 +47,9 @@ namespace cbm::algo::sts std::array<float, 9> rotation; // 3x3 matrix std::array<float, 3> translation; - static constexpr auto Properties = std::make_tuple( - config::Property(&ModuleTransform::rotation, "rotation", "Rotation matrix", YAML::Flow), - config::Property(&ModuleTransform::translation, "translation", "Translation vector", YAML::Flow)); + CBM_YAML_PROPERTIES(yaml::Property(&ModuleTransform::rotation, "rotation", "Rotation matrix", YAML::Flow), + yaml::Property(&ModuleTransform::translation, "translation", "Translation vector", + YAML::Flow)); }; struct Module { @@ -58,12 +62,11 @@ namespace cbm::algo::sts float lorentzB; ModuleTransform localToGlobal; - static constexpr auto Properties = std::make_tuple( - config::Property(&Module::address, "address", "Hardware Address", YAML::Hex), - config::Property(&Module::dY, "dY"), config::Property(&Module::pitch, "pitch"), - config::Property(&Module::stereoF, "stereoF"), config::Property(&Module::stereoB, "stereoB"), - config::Property(&Module::lorentzF, "lorentzF"), config::Property(&Module::lorentzB, "lorentzB"), - config::Property(&Module::localToGlobal, "localToGlobal")); + CBM_YAML_PROPERTIES(yaml::Property(&Module::address, "address", "Hardware Address", YAML::Hex), + yaml::Property(&Module::dY, "dY"), yaml::Property(&Module::pitch, "pitch"), + yaml::Property(&Module::stereoF, "stereoF"), yaml::Property(&Module::stereoB, "stereoB"), + yaml::Property(&Module::lorentzF, "lorentzF"), yaml::Property(&Module::lorentzB, "lorentzB"), + yaml::Property(&Module::localToGlobal, "localToGlobal")); }; Asic asic; @@ -71,12 +74,12 @@ namespace cbm::algo::sts std::vector<Module> modules; LandauTable landauTable; // Landau table for hitfinder, read from a seperate file - static constexpr auto Properties = std::make_tuple( - config::Property(&HitfinderPars::asic, "asic", - "Asic definitions. Currently assumes same parameters for all asics."), - config::Property(&HitfinderPars::nChannels, "nChannels", - "Total number of channels per module. Hitfinder assumes nChannels / 2 channels per side."), - config::Property(&HitfinderPars::modules, "modules")); + CBM_YAML_PROPERTIES( + yaml::Property(&HitfinderPars::asic, "asic", + "Asic definitions. Currently assumes same parameters for all asics."), + yaml::Property(&HitfinderPars::nChannels, "nChannels", + "Total number of channels per module. Hitfinder assumes nChannels / 2 channels per side."), + yaml::Property(&HitfinderPars::modules, "modules")); }; } // namespace cbm::algo::sts diff --git a/algo/detectors/sts/ChannelMaskSet.h b/algo/detectors/sts/ChannelMaskSet.h index aab508cee3e8153b17b76a36ecc6d7915ae4981d..9c259b5b17422ca41323159ece258ccb72b01126 100644 --- a/algo/detectors/sts/ChannelMaskSet.h +++ b/algo/detectors/sts/ChannelMaskSet.h @@ -6,8 +6,8 @@ #include "Definitions.h" #include "compat/Filesystem.h" -#include "config/Property.h" -#include "config/Yaml.h" +#include "yaml/Property.h" +#include "yaml/Yaml.h" #include <map> #include <set> @@ -26,9 +26,9 @@ namespace cbm::algo::sts MaskedChannels(std::initializer_list<u16> chans) : channels(chans) {} - CBM_FORMAT(YAML::Flow); - CBM_MERGE_PROPERTY(); - CBM_PROPERTIES(config::Property(&MaskedChannels::channels, "channels", "Channel mask", YAML::Flow)); + CBM_YAML_FORMAT(YAML::Flow); + CBM_YAML_MERGE_PROPERTY(); + CBM_YAML_PROPERTIES(yaml::Property(&MaskedChannels::channels, "channels", "Channel mask", YAML::Flow)); }; // febId -> set of channel numbers @@ -45,8 +45,8 @@ namespace cbm::algo::sts ChannelMaskSet() = default; ~ChannelMaskSet() = default; - CBM_MERGE_PROPERTY(); - CBM_PROPERTIES(config::Property(&ChannelMaskSet::values, "maskSet", "Channel mask set")); + CBM_YAML_MERGE_PROPERTY(); + CBM_YAML_PROPERTIES(yaml::Property(&ChannelMaskSet::values, "maskSet", "Channel mask set")); }; } // namespace cbm::algo::sts diff --git a/algo/detectors/sts/ReadoutConfig.h b/algo/detectors/sts/ReadoutConfig.h index 324b3efca0ea76447d9619060a3059acb9cbf334..0ce1d1a9ca091bbc0cc5b2ae2db742134b181efb 100644 --- a/algo/detectors/sts/ReadoutConfig.h +++ b/algo/detectors/sts/ReadoutConfig.h @@ -5,8 +5,8 @@ #define CBM_ALGO_DETECTOR_STS_READOUT_CONFIG_H #include "Definitions.h" -#include "config/Property.h" -#include "config/Yaml.h" +#include "yaml/Property.h" +#include "yaml/Yaml.h" #include <map> #include <string> @@ -27,9 +27,9 @@ namespace cbm::algo::sts i32 address; i32 type; - static constexpr auto Properties = std::make_tuple( - config::Property(&Module::address, "address", "HW address of module", YAML::Hex), - config::Property(&Module::type, "type", + CBM_YAML_PROPERTIES( + yaml::Property(&Module::address, "address", "HW address of module", YAML::Hex), + yaml::Property(&Module::type, "type", "Type 0 had the connector at the right side, type 1 at the left side. For type 0, the mapping " "of FEB to module side as above applies, for type 1, it has to be inverted.")); }; @@ -40,14 +40,14 @@ namespace cbm::algo::sts std::vector<std::vector<i16>> feb2moduleSide; std::vector<std::vector<bool>> febIsPulser; - static constexpr auto Properties = std::make_tuple( - config::Property(&Component::equipmentId, "equipmentId", + CBM_YAML_PROPERTIES( + yaml::Property(&Component::equipmentId, "equipmentId", "Equipment ID of component. Written to the data stream (MicrosliceDescriptor).", YAML::Hex), - config::Property(&Component::feb2module, "feb2module", + yaml::Property(&Component::feb2module, "feb2module", "Mapping of FEB within CROB to module index (-1 = inactive)"), - config::Property(&Component::feb2moduleSide, "feb2moduleSide", + yaml::Property(&Component::feb2moduleSide, "feb2moduleSide", "Mapping of FEB within CROB to module side (0 = left, 1 = right)"), - config::Property(&Component::febIsPulser, "febIsPulser", "Flag if FEB is pulser (true) or not (false)")); + yaml::Property(&Component::febIsPulser, "febIsPulser", "Flag if FEB is pulser (true) or not (false)")); }; struct Elink { @@ -55,10 +55,10 @@ namespace cbm::algo::sts u32 toAsicFebA; u32 toAsicFebB; - static constexpr auto Properties = std::make_tuple( - config::Property(&Elink::toFeb, "toFeb", "Mapping of elink to FEB within CROB (-1 = inactive)"), - config::Property(&Elink::toAsicFebA, "toAsicFebA", "Mapping of eLink to ASIC for FEB Type A", YAML::Hex), - config::Property(&Elink::toAsicFebB, "toAsicFebB", "Mapping of eLink to ASIC for FEB Type B", YAML::Hex)); + CBM_YAML_PROPERTIES( + yaml::Property(&Elink::toFeb, "toFeb", "Mapping of elink to FEB within CROB (-1 = inactive)"), + yaml::Property(&Elink::toAsicFebA, "toAsicFebA", "Mapping of eLink to ASIC for FEB Type A", YAML::Hex), + yaml::Property(&Elink::toAsicFebB, "toAsicFebB", "Mapping of eLink to ASIC for FEB Type B", YAML::Hex)); }; u16 numAsicsPerFeb; @@ -66,11 +66,10 @@ namespace cbm::algo::sts std::vector<Component> components; std::vector<Elink> elinks; - static constexpr auto Properties = - std::make_tuple(config::Property(&ReadoutSetup::numAsicsPerFeb, "numAsicsPerFeb", "Number of ASICs per FEB"), - config::Property(&ReadoutSetup::modules, "modules", "Modules", {}, YAML::Flow), - config::Property(&ReadoutSetup::components, "components", "Components", {}, YAML::Flow), - config::Property(&ReadoutSetup::elinks, "elinks", "Elinks", {}, YAML::Flow)); + CBM_YAML_PROPERTIES(yaml::Property(&ReadoutSetup::numAsicsPerFeb, "numAsicsPerFeb", "Number of ASICs per FEB"), + yaml::Property(&ReadoutSetup::modules, "modules", "Modules", {}, YAML::Flow), + yaml::Property(&ReadoutSetup::components, "components", "Components", {}, YAML::Flow), + yaml::Property(&ReadoutSetup::elinks, "elinks", "Elinks", {}, YAML::Flow)); }; /** @class ReadoutConfig diff --git a/algo/detectors/sts/WalkMap.h b/algo/detectors/sts/WalkMap.h index 04fcc7df317e03f072c9f95cc510f39fb2705ec9..64017d6419d903de1364b506dbe5788b91e342fe 100644 --- a/algo/detectors/sts/WalkMap.h +++ b/algo/detectors/sts/WalkMap.h @@ -5,8 +5,8 @@ #pragma once #include "Definitions.h" -#include "config/Property.h" -#include "config/Yaml.h" +#include "yaml/Property.h" +#include "yaml/Yaml.h" #include <map> #include <vector> @@ -44,17 +44,17 @@ namespace cbm::algo::sts AdcMap() = default; AdcMap(std::initializer_list<double> coeffs) : walkCoefficients(coeffs) {} - CBM_FORMAT(YAML::Flow); - CBM_MERGE_PROPERTY(); - CBM_PROPERTIES(config::Property(&AdcMap::walkCoefficients, "walkCoefficients", "Walk coefficients")); + CBM_YAML_FORMAT(YAML::Flow); + CBM_YAML_MERGE_PROPERTY(); + CBM_YAML_PROPERTIES(yaml::Property(&AdcMap::walkCoefficients, "walkCoefficients", "Walk coefficients")); }; // --- STS walk correction map // --- Map index: (module address, ASIC number in module, ADC value), map value: (walk coefficient) std::map<i32, std::vector<AdcMap>> fWalkMap; - CBM_MERGE_PROPERTY(); - CBM_PROPERTIES(config::Property(&WalkMap::fWalkMap, "WalkMap", "Walk correction map", YAML::Hex, YAML::Flow)); + CBM_YAML_MERGE_PROPERTY(); + CBM_YAML_PROPERTIES(yaml::Property(&WalkMap::fWalkMap, "WalkMap", "Walk correction map", YAML::Hex, YAML::Flow)); }; } // namespace cbm::algo::sts diff --git a/algo/detectors/tof/CalibrateSetup.h b/algo/detectors/tof/CalibrateSetup.h index 79e331b3df761b873deb76edcdcc4c538672a298..89d806312b18b78ae2754dd8d1fed1db57ed2eb4 100644 --- a/algo/detectors/tof/CalibrateSetup.h +++ b/algo/detectors/tof/CalibrateSetup.h @@ -5,7 +5,7 @@ #define CBM_ALGO_DETECTOR_TOF_CALIBRATE_SETUP_H #include "Definitions.h" -#include "config/Property.h" +#include "yaml/Property.h" #include <array> #include <map> @@ -25,11 +25,10 @@ namespace cbm::algo::tof std::vector<double> vCPTotOff; std::vector<std::vector<double>> vCPWalk; - static constexpr auto Properties = - std::make_tuple(config::Property(&Channel::vCPTOff, "vCPTOff", "CPT offset"), - config::Property(&Channel::vCPTotGain, "vCPTotGain", "CP time over threshold gain"), - config::Property(&Channel::vCPTotOff, "vCPTotOff", "CP time over threshold offset"), - config::Property(&Channel::vCPWalk, "vCPWalk", "CP walk correction", YAML::Block, YAML::Flow)); + CBM_YAML_PROPERTIES(yaml::Property(&Channel::vCPTOff, "vCPTOff", "CPT offset"), + yaml::Property(&Channel::vCPTotGain, "vCPTotGain", "CP time over threshold gain"), + yaml::Property(&Channel::vCPTotOff, "vCPTotOff", "CP time over threshold offset"), + yaml::Property(&Channel::vCPWalk, "vCPWalk", "CP walk correction", YAML::Block, YAML::Flow)); }; struct Rpc { @@ -40,13 +39,12 @@ namespace cbm::algo::tof double channelDeadtime; std::vector<Channel> chanPar; - static constexpr auto Properties = - std::make_tuple(config::Property(&Rpc::numClWalkBinX, "numClWalkBinX", "number of walk correction bins"), - config::Property(&Rpc::TOTMax, "TOTMax", "maximum time over threshold"), - config::Property(&Rpc::TOTMin, "TOTMin", "minimum time over threshold"), - config::Property(&Rpc::swapChannelSides, "swapChannelSides", "flag for swapping channel sides"), - config::Property(&Rpc::channelDeadtime, "channelDeadtime", "channel dead time"), - config::Property(&Rpc::chanPar, "chanPar", "channel parameters")); + CBM_YAML_PROPERTIES(yaml::Property(&Rpc::numClWalkBinX, "numClWalkBinX", "number of walk correction bins"), + yaml::Property(&Rpc::TOTMax, "TOTMax", "maximum time over threshold"), + yaml::Property(&Rpc::TOTMin, "TOTMin", "minimum time over threshold"), + yaml::Property(&Rpc::swapChannelSides, "swapChannelSides", "flag for swapping channel sides"), + yaml::Property(&Rpc::channelDeadtime, "channelDeadtime", "channel dead time"), + yaml::Property(&Rpc::chanPar, "chanPar", "channel parameters")); }; /* Members */ @@ -54,10 +52,10 @@ namespace cbm::algo::tof std::vector<int32_t> NbRpc; std::vector<std::vector<Rpc>> rpcs; - static constexpr auto Properties = std::make_tuple( - config::Property(&CalibrateSetup::NbSm, "NbSm", "Number of SMs per super module type", {}, YAML::Flow), - config::Property(&CalibrateSetup::NbRpc, "NbRpc", "Number of RPCs per super module type", {}, YAML::Flow), - config::Property(&CalibrateSetup::rpcs, "rpcs", "Parameters of RPCs")); + CBM_YAML_PROPERTIES( + yaml::Property(&CalibrateSetup::NbSm, "NbSm", "Number of SMs per super module type", {}, YAML::Flow), + yaml::Property(&CalibrateSetup::NbRpc, "NbRpc", "Number of RPCs per super module type", {}, YAML::Flow), + yaml::Property(&CalibrateSetup::rpcs, "rpcs", "Parameters of RPCs")); }; } // namespace cbm::algo::tof diff --git a/algo/detectors/tof/CalibratorChain.cxx b/algo/detectors/tof/CalibratorChain.cxx index 075413a691b3863d40fa7c1be1af10fe02bb01a8..d0dafc0d769407219af0c8a211ed1e82761bdd92 100644 --- a/algo/detectors/tof/CalibratorChain.cxx +++ b/algo/detectors/tof/CalibratorChain.cxx @@ -3,14 +3,14 @@ Authors: Dominik Smith [committer], Felix Weiglhofer */ #include "CalibratorChain.h" -#include "config/Yaml.h" +#include "yaml/Yaml.h" using namespace cbm::algo; using namespace cbm::algo::tof; void CalibratorChain::Init() { - auto setup = config::ReadFromFile<CalibrateSetup>(Opts().ParamsDir() / "TofCalibratePar.yaml"); + auto setup = yaml::ReadFromFile<CalibrateSetup>(Opts().ParamsDir() / "TofCalibratePar.yaml"); fCalibrate = std::make_unique<Calibrate>(setup); } diff --git a/algo/detectors/tof/HitfindSetup.h b/algo/detectors/tof/HitfindSetup.h index 93626b2690676adc2662c1b4978151d15f6cdf8d..103166bca84d6efcdfe9e344695517eb3dac2799 100644 --- a/algo/detectors/tof/HitfindSetup.h +++ b/algo/detectors/tof/HitfindSetup.h @@ -5,7 +5,7 @@ #define CBM_ALGO_DETECTOR_TOF_HITFIND_SETUP_H #include "Definitions.h" -#include "config/Property.h" +#include "yaml/Property.h" #include <array> #include <map> @@ -27,18 +27,16 @@ namespace cbm::algo::tof std::array<double, 3> translation; std::array<double, 9> rotation; - static constexpr auto Properties = - std::make_tuple(config::Property(&Cell::sizeX, "sizeX", "size in X direction"), - config::Property(&Cell::sizeY, "sizeY", "size in Y direction"), - config::Property(&Cell::translation, "translation", "Translation vector", YAML::Flow), - config::Property(&Cell::rotation, "rotation", "Rotation matrix", YAML::Flow)); + CBM_YAML_PROPERTIES(yaml::Property(&Cell::sizeX, "sizeX", "size in X direction"), + yaml::Property(&Cell::sizeY, "sizeY", "size in Y direction"), + yaml::Property(&Cell::translation, "translation", "Translation vector", YAML::Flow), + yaml::Property(&Cell::rotation, "rotation", "Rotation matrix", YAML::Flow)); }; struct Channel { i32 address; - static constexpr auto Properties = - std::make_tuple(config::Property(&Channel::address, "address", "unique address", YAML::Hex)); + CBM_YAML_PROPERTIES(yaml::Property(&Channel::address, "address", "unique address", YAML::Hex)); }; struct Rpc { @@ -54,28 +52,26 @@ namespace cbm::algo::tof std::vector<double> CPTOffY; std::vector<Channel> chanPar; - static constexpr auto Properties = - std::make_tuple(config::Property(&Rpc::deadStrips, "deadStrips", "bit mask for dead strips"), - config::Property(&Rpc::posYMaxScal, "posYMaxScal", "maximum value of y position"), - config::Property(&Rpc::maxTimeDist, "maxTimeDist", "maximum time distance"), - config::Property(&Rpc::maxSpaceDist, "maxSpaceDist", "maximum space distance"), - config::Property(&Rpc::sigVel, "sigVel", "signal velocity"), - config::Property(&Rpc::timeRes, "timeRes", "time resolution"), - config::Property(&Rpc::cell, "cell", "cell parameters"), - config::Property(&Rpc::CPTOffYBinWidth, "CPTOffYBinWidth", "CPT Y offset bin width"), - config::Property(&Rpc::CPTOffYRange, "CPTOffYRange", "CPT Y offset range"), - config::Property(&Rpc::CPTOffY, "CPTOffY", "CPT Y offset array"), - config::Property(&Rpc::chanPar, "chanPar", "channel parameters")); + CBM_YAML_PROPERTIES(yaml::Property(&Rpc::deadStrips, "deadStrips", "bit mask for dead strips"), + yaml::Property(&Rpc::posYMaxScal, "posYMaxScal", "maximum value of y position"), + yaml::Property(&Rpc::maxTimeDist, "maxTimeDist", "maximum time distance"), + yaml::Property(&Rpc::maxSpaceDist, "maxSpaceDist", "maximum space distance"), + yaml::Property(&Rpc::sigVel, "sigVel", "signal velocity"), + yaml::Property(&Rpc::timeRes, "timeRes", "time resolution"), + yaml::Property(&Rpc::cell, "cell", "cell parameters"), + yaml::Property(&Rpc::CPTOffYBinWidth, "CPTOffYBinWidth", "CPT Y offset bin width"), + yaml::Property(&Rpc::CPTOffYRange, "CPTOffYRange", "CPT Y offset range"), + yaml::Property(&Rpc::CPTOffY, "CPTOffY", "CPT Y offset array"), + yaml::Property(&Rpc::chanPar, "chanPar", "channel parameters")); }; std::vector<int32_t> NbSm; std::vector<int32_t> NbRpc; std::vector<std::vector<Rpc>> rpcs; - static constexpr auto Properties = std::make_tuple( - config::Property(&HitfindSetup::NbSm, "NbSm", "Number of SMs per super module type", {}, YAML::Flow), - config::Property(&HitfindSetup::NbRpc, "NbRpc", "Number of RPCs per super module type", {}, YAML::Flow), - config::Property(&HitfindSetup::rpcs, "rpcs", "Parameters of RPCs")); + CBM_YAML_PROPERTIES(yaml::Property(&HitfindSetup::NbSm, "NbSm", "Number of SMs per super module type", {}, YAML::Flow), + yaml::Property(&HitfindSetup::NbRpc, "NbRpc", "Number of RPCs per super module type", {}, YAML::Flow), + yaml::Property(&HitfindSetup::rpcs, "rpcs", "Parameters of RPCs")); }; diff --git a/algo/detectors/tof/HitfinderChain.cxx b/algo/detectors/tof/HitfinderChain.cxx index 22fc90eab404fe171bf67a474d789c179643c7b5..3911a6d8c689e2138a33a6237d8a6b53934bcefa 100644 --- a/algo/detectors/tof/HitfinderChain.cxx +++ b/algo/detectors/tof/HitfinderChain.cxx @@ -3,14 +3,14 @@ Authors: Felix Weiglhofer [committer] */ #include "HitfinderChain.h" -#include "config/Yaml.h" +#include "yaml/Yaml.h" using namespace cbm::algo; using namespace cbm::algo::tof; void HitfinderChain::Init() { - auto setup = config::ReadFromFile<HitfindSetup>(Opts().ParamsDir() / "TofHitfinderPar.yaml"); + auto setup = yaml::ReadFromFile<HitfindSetup>(Opts().ParamsDir() / "TofHitfinderPar.yaml"); fHitfind = std::make_unique<Hitfind>(setup); } diff --git a/algo/detectors/trd/ReadoutConfig.h b/algo/detectors/trd/ReadoutConfig.h index b8730f47b6486150e66ee6dc32df282a26abc0ef..42cec6d95adb009480019fd4e10bb3cdf0d91900 100644 --- a/algo/detectors/trd/ReadoutConfig.h +++ b/algo/detectors/trd/ReadoutConfig.h @@ -4,8 +4,8 @@ #pragma once -#include "config/Property.h" -#include "config/Yaml.h" +#include "yaml/Property.h" +#include "yaml/Yaml.h" #include <map> #include <sstream> @@ -86,8 +86,8 @@ namespace cbm::algo::trd // --- Map index: (equipment, crob, elink, chan), map value: (channel address) std::map<uint16_t, std::vector<std::vector<std::vector<uint32_t>>>> fChannelMap = {}; //! - CBM_PROPERTIES(config::Property(&ReadoutConfig::fReadoutMap, "readoutMap", "TRD readout map", {}, YAML::Hex), - config::Property(&ReadoutConfig::fChannelMap, "channelMap", "TRD channel map")); + CBM_YAML_PROPERTIES(yaml::Property(&ReadoutConfig::fReadoutMap, "readoutMap", "TRD readout map", {}, YAML::Hex), + yaml::Property(&ReadoutConfig::fChannelMap, "channelMap", "TRD channel map")); }; } // namespace cbm::algo::trd diff --git a/algo/detectors/trd2d/ReadoutConfig.h b/algo/detectors/trd2d/ReadoutConfig.h index 6942caa9bc9652a426831206a023908057299aa8..44df9ad7981cd546dd98c1ac82ab826a9e764fa0 100644 --- a/algo/detectors/trd2d/ReadoutConfig.h +++ b/algo/detectors/trd2d/ReadoutConfig.h @@ -5,8 +5,8 @@ #pragma once #include "UnpackMS.h" -#include "config/Property.h" -#include "config/Yaml.h" +#include "yaml/Property.h" +#include "yaml/Yaml.h" #include <map> #include <sstream> @@ -36,9 +36,9 @@ namespace cbm::algo::trd2d uint16_t moduleId; uint8_t crobId; - CBM_FORMAT(YAML::Flow); - CBM_PROPERTIES(config::Property(&CompMapping::moduleId, "moduleId", "Module ID"), - config::Property(&CompMapping::crobId, "crobId", "CROB ID")); + CBM_YAML_FORMAT(YAML::Flow); + CBM_YAML_PROPERTIES(yaml::Property(&CompMapping::moduleId, "moduleId", "Module ID"), + yaml::Property(&CompMapping::crobId, "crobId", "CROB ID")); }; struct ChanMapping { @@ -46,10 +46,10 @@ namespace cbm::algo::trd2d bool rPairingFlag; uint64_t daqOffset; - CBM_FORMAT(YAML::Flow); - CBM_PROPERTIES(config::Property(&ChanMapping::padAddress, "padAddress", "Pad address"), - config::Property(&ChanMapping::rPairingFlag, "rPairingFlag", "R pairing flag"), - config::Property(&ChanMapping::daqOffset, "daqOffset", "DAQ offset")); + CBM_YAML_FORMAT(YAML::Flow); + CBM_YAML_PROPERTIES(yaml::Property(&ChanMapping::padAddress, "padAddress", "Pad address"), + yaml::Property(&ChanMapping::rPairingFlag, "rPairingFlag", "R pairing flag"), + yaml::Property(&ChanMapping::daqOffset, "daqOffset", "DAQ offset")); }; /** @brief Constructor **/ @@ -117,9 +117,9 @@ namespace cbm::algo::trd2d // --- Map index: (equipment, asic, chan), map value: (pad address, mask flag, daq offset) std::map<uint16_t, std::vector<std::vector<ChanMapping>>> fChannelMap = {}; //! - CBM_PROPERTIES(config::Property(&ReadoutConfig::fReadoutMap, "readoutMap", "Maps equipment to module and CROB ID", + CBM_YAML_PROPERTIES(yaml::Property(&ReadoutConfig::fReadoutMap, "readoutMap", "Maps equipment to module and CROB ID", YAML::Hex), - config::Property(&ReadoutConfig::fChannelMap, "channelMap", + yaml::Property(&ReadoutConfig::fChannelMap, "channelMap", "Maps equipment, ASIC and channel to pad address, R pairing flag and DAQ offset", {}, YAML::Hex)); }; diff --git a/algo/global/Reco.cxx b/algo/global/Reco.cxx index 57964a6958ffd3da413d8cfe3c90af7d495bcdd9..118a3a96e1201a3bdea9bd0b22304654d6bf440c 100644 --- a/algo/global/Reco.cxx +++ b/algo/global/Reco.cxx @@ -11,7 +11,6 @@ #include "bmon/Unpack.h" #include "ca/TrackingChain.h" #include "compat/OpenMP.h" -#include "config/Yaml.h" #include "evbuild/Config.h" #include "log.hpp" #include "much/Unpack.h" @@ -23,6 +22,7 @@ #include "trd2d/Unpack.h" #include "util/TimingsFormat.h" #include "util/TsUtils.h" +#include "yaml/Yaml.h" #include <Monitor.hpp> #include <System.hpp> @@ -90,7 +90,7 @@ void Reco::Init(const Options& opts) } // Reco Params - fContext.recoParams = config::ReadFromFile<RecoParams>(opts.ParamsDir() / "RecoParams.yaml"); + fContext.recoParams = yaml::ReadFromFile<RecoParams>(opts.ParamsDir() / "RecoParams.yaml"); // Unpackers if (Opts().Has(Subsystem::BMON) && Opts().Has(Step::Unpack)) { @@ -109,10 +109,10 @@ void Reco::Init(const Options& opts) } if (Opts().Has(Subsystem::STS) && Opts().Has(Step::Unpack)) { - sts::ReadoutSetup readoutSetup = config::ReadFromFile<sts::ReadoutSetup>(Opts().ParamsDir() / "StsReadout.yaml"); - auto chanMask = config::ReadFromFile<sts::ChannelMaskSet>(Opts().ParamsDir() / "StsChannelMaskSet.yaml"); + sts::ReadoutSetup readoutSetup = yaml::ReadFromFile<sts::ReadoutSetup>(Opts().ParamsDir() / "StsReadout.yaml"); + auto chanMask = yaml::ReadFromFile<sts::ChannelMaskSet>(Opts().ParamsDir() / "StsChannelMaskSet.yaml"); sts::ReadoutConfig readout{readoutSetup, chanMask}; - auto walkMap = config::ReadFromFile<sts::WalkMap>(Opts().ParamsDir() / "StsWalkMap.yaml"); + auto walkMap = yaml::ReadFromFile<sts::WalkMap>(Opts().ParamsDir() / "StsWalkMap.yaml"); sts::Unpack::Config cfg{.readout = readout, .walkMap = walkMap}; fStsUnpack = std::make_unique<sts::Unpack>(cfg); } @@ -123,12 +123,12 @@ void Reco::Init(const Options& opts) } if (Opts().Has(Subsystem::TRD) && Opts().Has(Step::Unpack)) { - auto cfg = config::ReadFromFile<trd::ReadoutConfig>(Opts().ParamsDir() / "TrdReadoutSetup.yaml"); + auto cfg = yaml::ReadFromFile<trd::ReadoutConfig>(Opts().ParamsDir() / "TrdReadoutSetup.yaml"); fTrdUnpack = std::make_unique<trd::Unpack>(cfg); } if (Opts().Has(Subsystem::TRD2D) && Opts().Has(Step::Unpack)) { - auto cfg = config::ReadFromFile<trd2d::ReadoutConfig>(Opts().ParamsDir() / "Trd2dReadoutSetup.yaml"); + auto cfg = yaml::ReadFromFile<trd2d::ReadoutConfig>(Opts().ParamsDir() / "Trd2dReadoutSetup.yaml"); fTrd2dUnpack = std::make_unique<trd2d::Unpack>(cfg); } @@ -138,7 +138,7 @@ void Reco::Init(const Options& opts) fEventBuild = std::make_unique<evbuild::EventbuildChain>(config, fSender); // STS Hitfinder - sts::HitfinderPars hitFinderSetup = config::ReadFromFile<sts::HitfinderPars>(opts.ParamsDir() / "StsHitfinder.yaml"); + sts::HitfinderPars hitFinderSetup = yaml::ReadFromFile<sts::HitfinderPars>(opts.ParamsDir() / "StsHitfinder.yaml"); hitFinderSetup.landauTable = sts::LandauTable::FromFile(opts.ParamsDir() / "LandauWidthTable.txt"); sts::HitfinderChainPars hitFinderPars; hitFinderPars.setup = std::move(hitFinderSetup); diff --git a/algo/test/_GTestYamlConfig.cxx b/algo/test/_GTestYamlConfig.cxx index c7869b60f9bd56cff7ee0c6d0b2c2b44c7d582f0..fd147efede1d2ee4567e7a7b0411198e4beed039 100644 --- a/algo/test/_GTestYamlConfig.cxx +++ b/algo/test/_GTestYamlConfig.cxx @@ -2,9 +2,9 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Felix Weiglhofer [committer] */ -#include "config/Property.h" -#include "config/Yaml.h" #include "gtest/gtest.h" +#include "yaml/Property.h" +#include "yaml/Yaml.h" using namespace cbm::algo; @@ -22,7 +22,7 @@ TEST(Config, CanDeserializeStdMap) ss << "5: 6\n"; YAML::Node node = YAML::Load(ss.str()); - auto map = config::Read<Map_t>(node); + auto map = yaml::Read<Map_t>(node); EXPECT_EQ(map.size(), 3); EXPECT_EQ(map.at(1), 2); @@ -39,7 +39,7 @@ TEST(Config, CanSerializeStdMap) map[3] = 4; map[5] = 6; - YAML::Node node = YAML::Load(config::Dump{}(map)); + YAML::Node node = YAML::Load(yaml::Dump{}(map)); EXPECT_EQ(node.size(), 3); EXPECT_EQ(node[1].as<i32>(), 2); @@ -56,7 +56,7 @@ class Foo { i32 GetBar() const { return fBar; } i32 GetBaz() const { return fBaz; } - CBM_PROPERTIES(config::Property(&Foo::fBar, "bar", ""), config::Property(&Foo::fBaz, "baz", "")); + CBM_YAML_PROPERTIES(yaml::Property(&Foo::fBar, "bar", ""), yaml::Property(&Foo::fBaz, "baz", "")); }; TEST(Config, CanAccessPrivateMembers) @@ -66,7 +66,7 @@ TEST(Config, CanAccessPrivateMembers) ss << "baz: 2\n"; YAML::Node node = YAML::Load(ss.str()); - auto foo = config::Read<Foo>(node); + auto foo = yaml::Read<Foo>(node); EXPECT_EQ(foo.GetBar(), 1); EXPECT_EQ(foo.GetBaz(), 2); diff --git a/reco/L1/OffLineInterface/CbmGenerateMaterialMaps.cxx b/reco/L1/OffLineInterface/CbmGenerateMaterialMaps.cxx index 07e57c83d178e96db8f3ca92676b42ea6b80b02a..d8d125cb0f7a4aad4e989c7af3dfa7a31a0f79c1 100644 --- a/reco/L1/OffLineInterface/CbmGenerateMaterialMaps.cxx +++ b/reco/L1/OffLineInterface/CbmGenerateMaterialMaps.cxx @@ -33,7 +33,7 @@ InitStatus CbmGenerateMaterialMaps::Init() { // ----- Init configuration if (!fsUserConfig.empty()) { - fConfig = cbm::algo::config::ReadFromFile<Config>(fsUserConfig); + fConfig = cbm::algo::yaml::ReadFromFile<Config>(fsUserConfig); } else { LOG(info) << fName << ": configuration file was not provided. Using default settings"; diff --git a/reco/L1/OffLineInterface/CbmGenerateMaterialMaps.h b/reco/L1/OffLineInterface/CbmGenerateMaterialMaps.h index bde2425c7f2d03a9a65a6006c4061793d4173a6b..e93497c9cfd93964e055f57ba20a6cc5c55a4ab0 100644 --- a/reco/L1/OffLineInterface/CbmGenerateMaterialMaps.h +++ b/reco/L1/OffLineInterface/CbmGenerateMaterialMaps.h @@ -12,7 +12,7 @@ #include "CaMaterialMap.h" #include "CaToolsMaterialHelper.h" #include "FairTask.h" -#include "config/Yaml.h" +#include "yaml/Yaml.h" #include <map> #include <string> @@ -37,11 +37,11 @@ class CbmGenerateMaterialMaps : public FairTask { bool operator<(const MaterialSlice& r) const { return (fRefZ < r.fRefZ); } - CBM_PROPERTIES(cbm::algo::config::Property(&CbmGenerateMaterialMaps::MaterialSlice::fName, "name", ""), - cbm::algo::config::Property(&CbmGenerateMaterialMaps::MaterialSlice::fRefZ, "ref_z", ""), - cbm::algo::config::Property(&CbmGenerateMaterialMaps::MaterialSlice::fMinZ, "min_z", ""), - cbm::algo::config::Property(&CbmGenerateMaterialMaps::MaterialSlice::fMaxZ, "max_z", ""), - cbm::algo::config::Property(&CbmGenerateMaterialMaps::MaterialSlice::fMaxXY, "max_xy", "")); + 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", "")); }; struct Config { @@ -54,14 +54,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_PROPERTIES(cbm::algo::config::Property(&CbmGenerateMaterialMaps::Config::fvUserSlices, "user_slices", ""), - cbm::algo::config::Property(&CbmGenerateMaterialMaps::Config::fPitch, "pitch", ""), - cbm::algo::config::Property(&CbmGenerateMaterialMaps::Config::fMaxNofBins, "max_nof_bins", ""), - cbm::algo::config::Property(&CbmGenerateMaterialMaps::Config::fNofRays, "nof_rays", ""), - cbm::algo::config::Property(&CbmGenerateMaterialMaps::Config::fbParallelRays, "parallel_rays", ""), - cbm::algo::config::Property(&CbmGenerateMaterialMaps::Config::fbTrackingStations, + 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, "tracking_stations", ""), - cbm::algo::config::Property(&CbmGenerateMaterialMaps::Config::fbSafeMaterialInit, + cbm::algo::yaml::Property(&CbmGenerateMaterialMaps::Config::fbSafeMaterialInit, "safe_material_init", "")); }; diff --git a/reco/tasks/CbmTaskTofClusterizer.cxx b/reco/tasks/CbmTaskTofClusterizer.cxx index a494de46294289f3898ea43e90eb8e26cdf9d0b8..cbf6ca5aefad193d9005c3ca177bec58e8510287 100644 --- a/reco/tasks/CbmTaskTofClusterizer.cxx +++ b/reco/tasks/CbmTaskTofClusterizer.cxx @@ -26,7 +26,7 @@ // C++ Classes and includes #include "compat/Filesystem.h" -#include "config/Yaml.h" +#include "yaml/Yaml.h" #include <iomanip> #include <vector> @@ -316,11 +316,11 @@ bool CbmTaskTofClusterizer::InitAlgos() { // Read hitfinder parameters and initialize algo fAlgo = std::make_unique<cbm::algo::tof::Hitfind>( - cbm::algo::config::ReadFromFile<cbm::algo::tof::HitfindSetup>("TofHitfinderPar.yaml")); + cbm::algo::yaml::ReadFromFile<cbm::algo::tof::HitfindSetup>("TofHitfinderPar.yaml")); // Read calibration parameters initialize algo fCalibrate = std::make_unique<cbm::algo::tof::Calibrate>( - cbm::algo::config::ReadFromFile<cbm::algo::tof::CalibrateSetup>("TofCalibratePar.yaml")); + cbm::algo::yaml::ReadFromFile<cbm::algo::tof::CalibrateSetup>("TofCalibratePar.yaml")); return true; } diff --git a/reco/tasks/CbmTaskTofClusterizerParWrite.cxx b/reco/tasks/CbmTaskTofClusterizerParWrite.cxx index 8c604fd248da6a1823a7d461561d5f2e27c51439..95d273af3048adc09bb182acd3ba29cb52eeb481 100644 --- a/reco/tasks/CbmTaskTofClusterizerParWrite.cxx +++ b/reco/tasks/CbmTaskTofClusterizerParWrite.cxx @@ -20,9 +20,9 @@ #include "FairRootManager.h" #include "FairRunAna.h" #include "FairRuntimeDb.h" -#include "config/Yaml.h" #include "tof/CalibrateSetup.h" #include "tof/HitfindSetup.h" +#include "yaml/Yaml.h" #include <Logger.h> @@ -201,10 +201,10 @@ bool CbmTaskTofClusterizerParWrite::InitCalibParameter() /* D.Smith 23.8.23: For testing hit time calibration. Please remove when done. fvCPTOffYBinWidth[iSmType][iSm * iNbRpc + iRpc] = 1.; // initialize fvCPTOffYRange[iSmType][iSm * iNbRpc + iRpc] = 200.; // initialize - fvCPTOffY[iSmType][iSm * iNbRpc + iRpc] = std::vector<double>(10000, 1000.); + fvCPTOffY[iSmType][iSm * iNbRpc + iRpc] = std::vector<double>(10000, 1000.); for( size_t i = 0; i < fvCPTOffY[iSmType][iSm * iNbRpc + iRpc].size(); i++ ) { - fvCPTOffY[iSmType][iSm * iNbRpc + iRpc][i] = 1000.+500.*i; + fvCPTOffY[iSmType][iSm * iNbRpc + iRpc][i] = 1000.+500.*i; } */ int32_t iNbChan = fDigiBdfPar->GetNbChan(iSmType, iRpc); @@ -530,7 +530,7 @@ bool CbmTaskTofClusterizerParWrite::InitAlgos() /* Write Yaml files */ - cbm::algo::config::Dump dump; + cbm::algo::yaml::Dump dump; std::ofstream fout("TofHitfinderPar.yaml"); fout << dump(setup); fout.close(); diff --git a/reco/tasks/CbmTaskUnpack.cxx b/reco/tasks/CbmTaskUnpack.cxx index 378a3935776860f161d6538e0a4bc60e9370fcf4..5cae447460669c392ccddde682b6d04041b92822 100644 --- a/reco/tasks/CbmTaskUnpack.cxx +++ b/reco/tasks/CbmTaskUnpack.cxx @@ -19,7 +19,7 @@ #include "CbmTrdParSpadic.h" #include "MicrosliceDescriptor.hpp" #include "System.hpp" -#include "config/Yaml.h" +#include "yaml/Yaml.h" #include <FairParAsciiFileIo.h> #include <FairParamList.h> @@ -327,10 +327,10 @@ void CbmTaskUnpack::DumpUnpackSetup() { LOG(info) << "--- Dumping readout setup to yaml file ---"; - auto yaml = config::Dump{}(fTrdUnpack->Readout()); + auto yaml = yaml::Dump{}(fTrdUnpack->Readout()); std::ofstream("TrdReadoutSetup.yaml") << yaml; - yaml = config::Dump{}(fTrd2dUnpack->Readout()); + yaml = yaml::Dump{}(fTrd2dUnpack->Readout()); std::ofstream("Trd2dReadoutSetup.yaml") << yaml; }