diff --git a/algo/CMakeLists.txt b/algo/CMakeLists.txt index b8d0864d46f4035ada1fa1efc7bb38cc3df6fd10..aaca47bcb34404537d118bb0ff935698af0ae548 100644 --- a/algo/CMakeLists.txt +++ b/algo/CMakeLists.txt @@ -74,6 +74,7 @@ target_link_libraries(Algo ROOT::GenVector GSL Boost::program_options + Boost::filesystem xpu external::yaml-cpp INTERFACE FairLogger::FairLogger diff --git a/algo/base/Options.h b/algo/base/Options.h index f67827abf621c702ba28e8545fe5b035b72663a8..5075152d0f8e580c41ddb4447b757355e944282a 100644 --- a/algo/base/Options.h +++ b/algo/base/Options.h @@ -4,9 +4,10 @@ #ifndef CBM_ALGO_BASE_OPTIONS_H #define CBM_ALGO_BASE_OPTIONS_H -#include <filesystem> #include <string> +#include "compat/Filesystem.h" + namespace cbm::algo { @@ -16,7 +17,7 @@ namespace cbm::algo Options() = default; Options(int argc, char** argv); - std::filesystem::path ParamsDir() const { return fParamsDir; } + fs::path ParamsDir() const { return fParamsDir; } const std::string& InputLocator() const { return fInputLocator; } const std::string& LogLevel() const { return fLogLevel; } const std::string& Device() const { return fDevice; } diff --git a/algo/base/compat/Filesystem.h b/algo/base/compat/Filesystem.h new file mode 100644 index 0000000000000000000000000000000000000000..51ae1811d95b10f9b0ff56ca404a4c0989922985 --- /dev/null +++ b/algo/base/compat/Filesystem.h @@ -0,0 +1,18 @@ +/* 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_FILESYSTEM_H +#define CBM_ALGO_BASE_FILESYSTEM_H + +#include <boost/filesystem.hpp> + +namespace cbm::algo +{ + + // Use boost::filesystem by default instead of std::filesystem for + // compatibility with older compilers and ROOT versions + namespace fs = boost::filesystem; + +} // namespace cbm::algo + +#endif // CBM_ALGO_BASE_FILESYSTEM_H diff --git a/algo/data/sts/LandauTable.cxx b/algo/data/sts/LandauTable.cxx index 3dcf38f7533856733717ffd418ca5b95e58932d8..fe7fcabf5fec41414dd19f5dd150183d6cfd82c0 100644 --- a/algo/data/sts/LandauTable.cxx +++ b/algo/data/sts/LandauTable.cxx @@ -9,7 +9,7 @@ using namespace cbm::algo; -sts::LandauTable sts::LandauTable::FromFile(std::filesystem::path path) +sts::LandauTable sts::LandauTable::FromFile(fs::path path) { sts::LandauTable table; diff --git a/algo/data/sts/LandauTable.h b/algo/data/sts/LandauTable.h index b6ab665e0eef8c84306b47fc692d9307f202c71e..06ca3546925440779f42945d51e0a4570d612a8e 100644 --- a/algo/data/sts/LandauTable.h +++ b/algo/data/sts/LandauTable.h @@ -4,17 +4,17 @@ #ifndef CBM_ALGO_DATA_STS_LANDAUTABLE_H #define CBM_ALGO_DATA_STS_LANDAUTABLE_H -#include <filesystem> #include <vector> #include "Prelude.h" +#include "compat/Filesystem.h" namespace cbm::algo::sts { struct LandauTable { - static LandauTable FromFile(std::filesystem::path path); + static LandauTable FromFile(fs::path path); std::vector<f32> values; f32 stepSize = 0; diff --git a/algo/global/Reco.cxx b/algo/global/Reco.cxx index 195414689283c02fad633a890b55463368b7dfcf..dc5f6af7c6e08143cf5f2f27e180d4add40618eb 100644 --- a/algo/global/Reco.cxx +++ b/algo/global/Reco.cxx @@ -26,8 +26,9 @@ void Reco::Init(const Options& opts) LOG(info) << "Running CBM Reco on Device " << props.name(); // Reco Params - YAML::Node yaml = YAML::LoadFile(opts.ParamsDir() / "RecoParams.yaml"); - fContext.recoParams = config::Read<RecoParams>(yaml); + fs::path recoParamsPath = opts.ParamsDir() / "Reco.yaml"; + YAML::Node yaml = YAML::LoadFile(recoParamsPath.string()); + fContext.recoParams = config::Read<RecoParams>(yaml); // STS Unpacker // yaml = YAML::LoadFile(opts.ParamsDir() / "StsReadout.yaml"); @@ -36,7 +37,8 @@ void Reco::Init(const Options& opts) fUnpack.Init(readoutConfig); // STS Hitfinder - yaml = YAML::LoadFile(opts.ParamsDir() / "StsHitfinder.yaml"); + fs::path stsHitfinderParamsPath = opts.ParamsDir() / "StsHitfinder.yaml"; + yaml = YAML::LoadFile(stsHitfinderParamsPath.string()); sts::HitfinderPars hitFinderConfig = config::Read<sts::HitfinderPars>(yaml); hitFinderConfig.landauTable = sts::LandauTable::FromFile(opts.ParamsDir() / "LandauWidthTable.txt"); fStsHitFinder.SetParameters(hitFinderConfig);