From 39c00e709d74d4e6e7dd236fb63969b10d1fd28a Mon Sep 17 00:00:00 2001 From: Felix Weiglhofer <weiglhofer@fias.uni-frankfurt.de> Date: Sun, 28 Apr 2024 22:07:55 +0000 Subject: [PATCH] online: Add support for 2024 setup files. --- algo/CMakeLists.txt | 1 + algo/ca/TrackingChain.cxx | 4 +- algo/detectors/tof/TrackingInterface.cxx | 4 +- algo/global/ParFiles.cxx | 44 ++++++++++++++++++++++ algo/global/ParFiles.h | 48 ++++++++++++++++++++++++ algo/global/Reco.cxx | 37 ++++++++---------- external/InstallParameter.cmake | 2 +- 7 files changed, 115 insertions(+), 25 deletions(-) create mode 100644 algo/global/ParFiles.cxx create mode 100644 algo/global/ParFiles.h diff --git a/algo/CMakeLists.txt b/algo/CMakeLists.txt index 6e2033806a..60d0bd9993 100644 --- a/algo/CMakeLists.txt +++ b/algo/CMakeLists.txt @@ -135,6 +135,7 @@ set(SRCS detectors/rich/ReadoutConfig.cxx detectors/rich/Unpack.cxx detectors/rich/UnpackMS.cxx + global/ParFiles.cxx global/Reco.cxx global/RecoResultsInputArchive.cxx global/RecoResultsOutputArchive.cxx diff --git a/algo/ca/TrackingChain.cxx b/algo/ca/TrackingChain.cxx index e44a7341af..c5213d0b85 100644 --- a/algo/ca/TrackingChain.cxx +++ b/algo/ca/TrackingChain.cxx @@ -13,6 +13,7 @@ #include "CaHit.h" #include "CaInitManager.h" #include "CaParameters.h" +#include "ParFiles.h" #include "compat/OpenMP.h" #include "yaml/Yaml.h" @@ -56,7 +57,8 @@ void TrackingChain::Init() // ------ Read tracking chain parameters from the config - fConfig = yaml::ReadFromFile<TrackingChainConfig>(Opts().ParamsDir() / "TrackingChainConfig.yaml"); + ParFiles parFiles(Opts().RunId()); + fConfig = yaml::ReadFromFile<TrackingChainConfig>(Opts().ParamsDir() / parFiles.ca.mainConfig); // ------ Read parameters from binary auto geomCfgFile = (Opts().ParamsDir() / fConfig.fsGeomConfig).string(); diff --git a/algo/detectors/tof/TrackingInterface.cxx b/algo/detectors/tof/TrackingInterface.cxx index 7e98e648b1..e8a6d0c9a9 100644 --- a/algo/detectors/tof/TrackingInterface.cxx +++ b/algo/detectors/tof/TrackingInterface.cxx @@ -11,6 +11,7 @@ #include "CbmTofAddress.h" #include "HitfindSetup.h" +#include "ParFiles.h" #include "fmt/format.h" #include "log.hpp" @@ -57,7 +58,8 @@ void TrackingInterface::Init() fvTrackingStationId[9] = {1, 2, 3, 4}; } else { - auto setup = yaml::ReadFromFile<HitfindSetup>(Opts().ParamsDir() / "TofHitfinderPar.yaml"); + ParFiles parFiles(Opts().RunId()); + auto setup = yaml::ReadFromFile<HitfindSetup>(Opts().ParamsDir() / parFiles.tof.hitfinder); fvNofSm = std::move(setup.NbSm); fvNofRpc = std::move(setup.NbRpc); assert(fvNofSm.size() == fvNofRpc.size()); diff --git a/algo/global/ParFiles.cxx b/algo/global/ParFiles.cxx new file mode 100644 index 0000000000..96285ba4f8 --- /dev/null +++ b/algo/global/ParFiles.cxx @@ -0,0 +1,44 @@ +/* Copyright (C) 2024 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main + SPDX-License-Identifier: GPL-3.0-only + Authors: Felix Weiglhofer [committer] */ +#include "ParFiles.h" + +using namespace cbm::algo; + +ParFiles::ParFiles(uint32_t runId) +{ + bool is2024 = 2724 <= runId; + + if (is2024) { + sts.readout = "StsReadout_mcbm2024.yaml"; + sts.chanMask = "StsChannelMaskSet_mcbm2024.yaml"; + sts.walkMap = "StsWalkMap_mcbm2024.yaml"; + sts.hitfinder = "StsHitfinder_mcbm2024.yaml"; + + tof.calibrate = "TofCalibratePar_mcbm2024.yaml"; + tof.hitfinder = "TofHitfinderPar_mcbm2024.yaml"; + + trd.readout = "TrdReadoutSetup_mcbm2024.yaml"; + trd.readout2d = "TrdReadout2DSetup_mcbm2022.yaml"; // TODO: no new readout for TRD2D? + trd.hitfinder = "TrdHitfinderPar_mcbm2024.yaml"; + trd.hitfinder2d = "TrdHitfinder2DPar_mcbm2024.yaml"; + + ca.mainConfig = "TrackingChainConfig_mcbm2024.yaml"; + } + else { // Assume 2022 setup + sts.readout = "StsReadout_mcbm2022.yaml"; + sts.chanMask = "StsChannelMaskSet_mcbm2022.yaml"; + sts.walkMap = "StsWalkMap_mcbm2022.yaml"; + sts.hitfinder = "StsHitfinder_mcbm2022.yaml"; + + tof.calibrate = "TofCalibratePar_mcbm2022.yaml"; + tof.hitfinder = "TofHitfinderPar_mcbm2022.yaml"; + + trd.readout = "TrdReadoutSetup_mcbm2022.yaml"; + trd.readout2d = "TrdReadout2DSetup_mcbm2022.yaml"; + trd.hitfinder = "TrdHitfinderPar_mcbm2022.yaml"; + trd.hitfinder2d = "TrdHitfinder2DPar_mcbm2022.yaml"; + + ca.mainConfig = "TrackingChainConfig_mcbm2022.yaml"; + } +} diff --git a/algo/global/ParFiles.h b/algo/global/ParFiles.h new file mode 100644 index 0000000000..877e06e000 --- /dev/null +++ b/algo/global/ParFiles.h @@ -0,0 +1,48 @@ +/* Copyright (C) 2024 FIAS Frankfurt Institute for Advanced Studies, Frankfurt / Main + SPDX-License-Identifier: GPL-3.0-only + Authors: Felix Weiglhofer [committer] */ +#pragma once + +/** + * @file ParFiles.h + * @brief This file contains the definition of the ParFiles class. + */ + +#include "compat/Filesystem.h" + +namespace cbm::algo +{ + + /** + * @class ParFiles + * @brief Class to hold the paths to the parameter files for the different detectors. + **/ + struct ParFiles { + + ParFiles(uint32_t runId); + + struct { + fs::path readout; + fs::path chanMask; + fs::path walkMap; + fs::path hitfinder; + } sts; + + struct { + fs::path calibrate; + fs::path hitfinder; + } tof; + + struct { + fs::path readout; + fs::path readout2d; + fs::path hitfinder; + fs::path hitfinder2d; + } trd; + + struct { + fs::path mainConfig; + } ca; + }; + +} // namespace cbm::algo diff --git a/algo/global/Reco.cxx b/algo/global/Reco.cxx index 5862bfd83e..1796c2745f 100644 --- a/algo/global/Reco.cxx +++ b/algo/global/Reco.cxx @@ -8,6 +8,7 @@ #include "EventbuildChain.h" #include "Exceptions.h" #include "HistogramSender.h" +#include "ParFiles.h" #include "StsDigiQa.h" #include "TrackingSetup.h" #include "bmon/Unpack.h" @@ -96,6 +97,8 @@ void Reco::Init(const Options& opts) // Reco Params fContext.recoParams = yaml::ReadFromFile<RecoParams>(opts.ParamsDir() / "RecoParams.yaml"); + ParFiles parFiles(opts.RunId()); + // Unpackers if (Opts().Has(Subsystem::BMON) && Opts().Has(Step::Unpack)) { bmon::ReadoutConfig cfg{}; @@ -113,18 +116,9 @@ void Reco::Init(const Options& opts) } if (Opts().Has(Subsystem::STS) && Opts().Has(Step::Unpack)) { - fs::path readoutFile = "StsReadout_mcbm2022.yaml"; - fs::path chanMaskFile = "StsChannelMaskSet_mcbm2022.yaml"; - fs::path walkFile = "StsWalkMap_mcbm2022.yaml"; - if (2724 <= Opts().RunId()) { - readoutFile = "StsReadout_mcbm2024.yaml"; - chanMaskFile = "StsChannelMaskSet_mcbm2024.yaml"; - walkFile = "StsWalkMap_mcbm2024.yaml"; - } - - sts::ReadoutSetup readoutSetup = yaml::ReadFromFile<sts::ReadoutSetup>(Opts().ParamsDir() / readoutFile); - auto chanMask = yaml::ReadFromFile<sts::ChannelMaskSet>(Opts().ParamsDir() / chanMaskFile); - auto walkMap = yaml::ReadFromFile<sts::WalkMap>(Opts().ParamsDir() / walkFile); + sts::ReadoutSetup readoutSetup = yaml::ReadFromFile<sts::ReadoutSetup>(Opts().ParamsDir() / parFiles.sts.readout); + auto chanMask = yaml::ReadFromFile<sts::ChannelMaskSet>(Opts().ParamsDir() / parFiles.sts.chanMask); + auto walkMap = yaml::ReadFromFile<sts::WalkMap>(Opts().ParamsDir() / parFiles.sts.walkMap); sts::ReadoutConfig readout{readoutSetup, chanMask}; sts::Unpack::Config cfg{.readout = readout, .walkMap = walkMap}; @@ -143,13 +137,12 @@ void Reco::Init(const Options& opts) } if (Opts().Has(Subsystem::TRD) && Opts().Has(Step::Unpack)) { - fs::path readoutFile = 2724 <= Opts().RunId() ? "TrdReadoutSetup_mcbm2024.yaml" : "TrdReadoutSetup_mcbm2022.yaml"; - auto cfg = yaml::ReadFromFile<trd::ReadoutConfig>(Opts().ParamsDir() / readoutFile); - fTrdUnpack = std::make_unique<trd::Unpack>(cfg); + auto cfg = yaml::ReadFromFile<trd::ReadoutConfig>(Opts().ParamsDir() / parFiles.trd.readout); + fTrdUnpack = std::make_unique<trd::Unpack>(cfg); } if (Opts().Has(Subsystem::TRD2D) && Opts().Has(Step::Unpack)) { - auto cfg = yaml::ReadFromFile<trd2d::ReadoutConfig>(Opts().ParamsDir() / "Trd2dReadoutSetup.yaml"); + auto cfg = yaml::ReadFromFile<trd2d::ReadoutConfig>(Opts().ParamsDir() / parFiles.trd.readout2d); fTrd2dUnpack = std::make_unique<trd2d::Unpack>(cfg); } @@ -169,7 +162,8 @@ void Reco::Init(const Options& opts) // STS Hitfinder if (Opts().Has(fles::Subsystem::STS) && Opts().Has(Step::LocalReco)) { - sts::HitfinderPars hitFinderSetup = yaml::ReadFromFile<sts::HitfinderPars>(opts.ParamsDir() / "StsHitfinder.yaml"); + sts::HitfinderPars hitFinderSetup = + yaml::ReadFromFile<sts::HitfinderPars>(opts.ParamsDir() / parFiles.sts.hitfinder); hitFinderSetup.landauTable = sts::LandauTable::FromFile(opts.ParamsDir() / "LandauWidthTable.txt"); sts::HitfinderChainPars hitFinderPars; hitFinderPars.setup = std::move(hitFinderSetup); @@ -182,17 +176,16 @@ void Reco::Init(const Options& opts) // TOF Hitfinder if (Opts().Has(fles::Subsystem::TOF) && Opts().Has(Step::LocalReco)) { - auto calibSetup = yaml::ReadFromFile<tof::CalibrateSetup>(opts.ParamsDir() / "TofCalibratePar.yaml"); + auto calibSetup = yaml::ReadFromFile<tof::CalibrateSetup>(opts.ParamsDir() / parFiles.tof.calibrate); fTofCalibrator = std::make_unique<tof::Calibrate>(calibSetup); - auto hitfindSetup = yaml::ReadFromFile<tof::HitfindSetup>(opts.ParamsDir() / "TofHitfinderPar.yaml"); + auto hitfindSetup = yaml::ReadFromFile<tof::HitfindSetup>(opts.ParamsDir() / parFiles.tof.hitfinder); fTofHitFinder = std::make_unique<tof::Hitfind>(hitfindSetup); } if (Opts().Has(fles::Subsystem::TRD) && Opts().Has(Step::LocalReco)) { - // TODO load setup files!!! - auto setup = yaml::ReadFromFile<trd::HitfindSetup>(opts.ParamsDir() / "TrdHitfinderPar.yaml"); - auto setup2d = yaml::ReadFromFile<trd::Hitfind2DSetup>(opts.ParamsDir() / "TrdHitfinder2DPar.yaml"); + auto setup = yaml::ReadFromFile<trd::HitfindSetup>(opts.ParamsDir() / parFiles.trd.hitfinder); + auto setup2d = yaml::ReadFromFile<trd::Hitfind2DSetup>(opts.ParamsDir() / parFiles.trd.hitfinder2d); fTrdHitfind = std::make_unique<trd::Hitfind>(setup, setup2d); } diff --git a/external/InstallParameter.cmake b/external/InstallParameter.cmake index 6fabadfe66..6807410688 100644 --- a/external/InstallParameter.cmake +++ b/external/InstallParameter.cmake @@ -1,4 +1,4 @@ -set(PARAMETER_VERSION 356c63407315fdf944f45e1351237ea4efe41faf) # 2024-04-25 +set(PARAMETER_VERSION 208494d2f668ff0fc349180008279739a7da864e) # 2024-04-27 set(PARAMETER_SRC_URL "https://git.cbm.gsi.de/CbmSoft/cbmroot_parameter.git") -- GitLab