diff --git a/algo/CMakeLists.txt b/algo/CMakeLists.txt index 0390d9e536445b0aaeb632fa76fef9ee100866ef..05585ea099e7506b5b5a9f0622971373a4312347 100644 --- a/algo/CMakeLists.txt +++ b/algo/CMakeLists.txt @@ -116,9 +116,6 @@ set(SRCS detectors/tof/UnpackMS.cxx detectors/tof/Hitfind.cxx detectors/tof/TrackingInterface.cxx - detectors/tof/config/ReadoutPars_mCBM2022.cxx - detectors/tof/config/ReadoutPars_mCBM2024.cxx - detectors/tof/config/ReadoutPars_mCBM2024_05.cxx detectors/bmon/ReadoutConfig.cxx detectors/bmon/Unpack.cxx detectors/bmon/UnpackMS.cxx diff --git a/algo/detectors/tof/ReadoutConfig.cxx b/algo/detectors/tof/ReadoutConfig.cxx index cd91a65198b2269998a509a3234678dca24bb640..4b807c5106cf6078b01639ac88f8b30d2465a859 100644 --- a/algo/detectors/tof/ReadoutConfig.cxx +++ b/algo/detectors/tof/ReadoutConfig.cxx @@ -6,7 +6,6 @@ #include "CbmTofAddress.h" #include "Exceptions.h" -#include "config/ReadoutPars.h" #include "gDpbMessv100.h" #include <bitset> @@ -15,10 +14,13 @@ using namespace std; +CBM_YAML_INSTANTIATE(cbm::algo::tof::ReadoutSetup); + namespace cbm::algo::tof { + // --- Constructor ------------------------------------------------------------------ - ReadoutConfig::ReadoutConfig(const config::ReadoutPars& pars) { Init(pars); } + ReadoutConfig::ReadoutConfig(const ReadoutSetup& pars) { Init(pars); } // ------------------------------------------------------------------------------------ // --- Destructor ----------------------------------------------------------------- @@ -60,7 +62,7 @@ namespace cbm::algo::tof } // ------------------------------------------------------------------------------------ - void ReadoutConfig::Init(const config::ReadoutPars& pars) + void ReadoutConfig::Init(const ReadoutSetup& pars) { // Constructing the map (equipmentId, eLink, channel) -> (TOF address) const uint32_t numChanPerComp = pars.NChansPerComponent(); @@ -83,14 +85,14 @@ namespace cbm::algo::tof const uint32_t chanInFeb = (asicId % pars.nAsicsPerFeb) * pars.nChannelsPerAsic + channel; const uint32_t remappedChan = comp * numChanPerComp + febId * pars.NChansPerFeb() + Get4ChanToPadiChan(chanInFeb, pars); - const uint32_t chanUId = fviRpcChUId[remappedChan]; + const uint32_t chanUId = fviRpcChUId[remappedChan]; fReadoutMap[equipment][elink][channel] = chanUId; } //# channel } //# elink } //# component } - int32_t ReadoutConfig::ElinkIdxToGet4Idx(uint32_t elink, const config::ReadoutPars& pars) + int32_t ReadoutConfig::ElinkIdxToGet4Idx(uint32_t elink, const ReadoutSetup& pars) { if (gdpbv100::kuChipIdMergedEpoch == elink) { return elink; @@ -104,7 +106,7 @@ namespace cbm::algo::tof } } - int32_t ReadoutConfig::ElinkIdxToGet4IdxInner(uint32_t elink, const config::ReadoutPars& pars) + int32_t ReadoutConfig::ElinkIdxToGet4IdxInner(uint32_t elink, const ReadoutSetup& pars) { if (0 == pars.elink2AsicInner.size()) { throw FatalError("tof::ReadoutConfig::ElinkIdxToGet4IdxInner => map is empty, stop there, check your Config!"); @@ -125,7 +127,7 @@ namespace cbm::algo::tof // ------------------------------------------------------------------------- - int32_t ReadoutConfig::Get4ChanToPadiChan(uint32_t channelInFee, const config::ReadoutPars& pars) + int32_t ReadoutConfig::Get4ChanToPadiChan(uint32_t channelInFee, const ReadoutSetup& pars) { if (channelInFee < pars.NChansPerFeb()) { return pars.asic2PadI[channelInFee]; @@ -138,16 +140,16 @@ namespace cbm::algo::tof // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- - void ReadoutConfig::BuildChannelsUidMap(const config::ReadoutPars& pars) + void ReadoutConfig::BuildChannelsUidMap(const ReadoutSetup& pars) { uint32_t uNrOfGet4 = pars.NComponents() * pars.nFebsPerComponent * pars.nAsicsPerFeb; uint32_t uNrOfChannels = uNrOfGet4 * pars.nChannelsPerAsic; fviRpcChUId.resize(uNrOfChannels); + // D.Smith 03.06.2024: TO DO. Clarify uint32_t nbRobPerComp = 2; // number of Gbtx per Gdpb (flim) for the final channel count check - if (pars.mcbmTof2024) { - // Hack for 2024 TOF mapping - nbRobPerComp = 1; + if (pars.elink2AsicInner.size() > 0) { + nbRobPerComp = 1; // Hack for 2024 TOF mapping } L_(debug) << "============================================================"; @@ -226,6 +228,7 @@ namespace cbm::algo::tof L_(error) << "Invalid Tof Type specifier for GBTx " << std::setw(2) << uGbtx << ": " << crob.rpcType; } } // switch (crob.rpcType) + if (uCh - uCh0 != pars.nFebsPerComponent * pars.nAsicsPerFeb * pars.nChannelsPerAsic / nbRobPerComp) { throw FatalError("Tof mapping error for Gbtx {}, diff = {}, type {}", uGbtx, uCh - uCh0, crob.rpcType); } @@ -293,7 +296,7 @@ namespace cbm::algo::tof // ------------------------------------------------------------------------- - void ReadoutConfig::BuildChannelsUidMapCbm(uint32_t& uCh, const config::CROB& crob) + void ReadoutConfig::BuildChannelsUidMapCbm(uint32_t& uCh, const CROB& crob) { if (crob.rpcSide < 4) { // mTof modules const int32_t RpcMap[5] = {4, 2, 0, 3, 1}; @@ -328,7 +331,7 @@ namespace cbm::algo::tof // ------------------------------------------------------------------------- - void ReadoutConfig::BuildChannelsUidMapStar(uint32_t& uCh, const config::CROB& crob) + void ReadoutConfig::BuildChannelsUidMapStar(uint32_t& uCh, const CROB& crob) { if (crob.rpcSide < 2) { // mTof modules @@ -356,7 +359,7 @@ namespace cbm::algo::tof } // ------------------------------------------------------------------------- - void ReadoutConfig::BuildChannelsUidMapCern(uint32_t& uCh, const config::CROB&) + void ReadoutConfig::BuildChannelsUidMapCern(uint32_t& uCh, const CROB&) { L_(debug) << " Map CERN 20 gap at GBTX - uCh = " << uCh; // clang-format off @@ -382,7 +385,7 @@ namespace cbm::algo::tof } // ------------------------------------------------------------------------- - void ReadoutConfig::BuildChannelsUidMapCera(uint32_t& uCh, const config::CROB&) + void ReadoutConfig::BuildChannelsUidMapCera(uint32_t& uCh, const CROB&) { int32_t iModuleId = 0; int32_t iModuleType = 8; @@ -396,7 +399,7 @@ namespace cbm::algo::tof // ------------------------------------------------------------------------- - void ReadoutConfig::BuildChannelsUidMapStar2(uint32_t& uCh, const config::CROB& crob) + void ReadoutConfig::BuildChannelsUidMapStar2(uint32_t& uCh, const CROB& crob) { const int32_t iRpc[5] = {1, -1, 1, 0, 0}; const int32_t iSide[5] = {1, -1, 0, 1, 0}; @@ -451,7 +454,7 @@ namespace cbm::algo::tof } // ------------------------------------------------------------------------- - void ReadoutConfig::BuildChannelsUidMapStar2Inner(uint32_t& uCh, const config::CROB& crob) + void ReadoutConfig::BuildChannelsUidMapStar2Inner(uint32_t& uCh, const CROB& crob) { if (crob.rpcSide < 3) { int32_t NrFeet = 2; @@ -569,7 +572,7 @@ namespace cbm::algo::tof } // ------------------------------------------------------------------------- - void ReadoutConfig::BuildChannelsUidMapBuc(uint32_t& uCh, const config::CROB& crob) + void ReadoutConfig::BuildChannelsUidMapBuc(uint32_t& uCh, const CROB& crob) { int32_t iModuleIdMap = crob.moduleId; const int32_t iRpc[5] = {0, -1, 0, 1, 1}; diff --git a/algo/detectors/tof/ReadoutConfig.h b/algo/detectors/tof/ReadoutConfig.h index 4b77c63789bbff4dd9959003d6b7a5043d0a52ec..041d545390cb5b50f204a09d8c304e763e630cc9 100644 --- a/algo/detectors/tof/ReadoutConfig.h +++ b/algo/detectors/tof/ReadoutConfig.h @@ -2,28 +2,80 @@ SPDX-License-Identifier: GPL-3.0-only Authors: Dominik Smith [committer] */ -#ifndef ALGO_DETECTORS_TOF_READOUTCONFIG_H -#define ALGO_DETECTORS_TOF_READOUTCONFIG_H +#pragma once + +#include "Definitions.h" +#include "yaml/Property.h" +#include "yaml/Yaml.h" #include <cstddef> #include <cstdint> #include <map> #include <vector> -namespace cbm::algo::tof::config -{ - struct CROB; - struct ReadoutPars; -} // namespace cbm::algo::tof::config - namespace cbm::algo::tof { + /** + * @brief Readout setup / Hardware cabling for TOF + * Used to create the hardware mapping for the TOF unpacker. + */ + struct ReadoutSetup { + + struct CROB { + i32 moduleId; + i32 rpcType; + i32 rpcSide; + i32 nRPC; + + CBM_YAML_PROPERTIES( + yaml::Property(&CROB::moduleId, "moduleId", "Unique ID of module the CROB resides in"), + yaml::Property(&CROB::rpcType, "rpcType", "add explanation."), + yaml::Property(&CROB::rpcSide, "rpcSide", "add explanation."), + yaml::Property(&CROB::nRPC, "nRPC", "number of RPCs.")); + }; + + i32 nFebsPerComponent; + i32 nAsicsPerFeb; + i32 nChannelsPerAsic; + i32 nCrobPerComponent; + std::vector<CROB> crobs; + std::vector<u16> eqIds; + std::vector<i32> elink2Asic; + std::vector<i32> elink2AsicInner; + std::vector<i32> asic2PadI; + + CBM_YAML_PROPERTIES(yaml::Property(&ReadoutSetup::nFebsPerComponent, "nFebsPerComponent", "Number of FEBs per component"), + yaml::Property(&ReadoutSetup::nAsicsPerFeb, "nAsicsPerFeb", "Number of ASICs per FEB"), + yaml::Property(&ReadoutSetup::nChannelsPerAsic, "nChannelsPerAsic", "Number of channels per ASIC"), + yaml::Property(&ReadoutSetup::nCrobPerComponent, "nCrobPerComponent", "Number of CROBs per component"), + yaml::Property(&ReadoutSetup::crobs, "crobs", "Crobs", {}, YAML::Flow), + yaml::Property(&ReadoutSetup::eqIds, "eqIds", "Array to hold the unique IDs (equipment ID) for all TOF DPBs" , YAML::Flow, YAML::Hex), + yaml::Property(&ReadoutSetup::elink2Asic, "elink2Asic", "Mapping to eLink to ASIC number within CROB. Mapping is the same for each CROB. (size: nElinksPerCrob)" , YAML::Flow), + yaml::Property(&ReadoutSetup::elink2AsicInner, "elink2AsicInner", "add explanation" , YAML::Flow), + yaml::Property(&ReadoutSetup::asic2PadI, "asic2PadI", "Mapping in Readout chain PCBs; Map from GET4 channel to PADI channel (size: nChansPerFeb)" , YAML::Flow)); + + + i32 NFebsPerCrob() const { return nFebsPerComponent / nCrobPerComponent; } + i32 NChansPerFeb() const { return nAsicsPerFeb * nChannelsPerAsic; } + i32 NChansPerComponent() const { return nChannelsPerAsic * NElinksPerComponent(); } + i32 NElinksPerCrob() const { return nAsicsPerFeb * NFebsPerCrob(); } + i32 NElinksPerComponent() const { return NElinksPerCrob() * nCrobPerComponent; } + size_t NCROBs() const { return crobs.size(); } + size_t NComponents() const { return eqIds.size(); } + + bool CheckBmonComp(uint32_t uCompId) const { return ((uCompId & 0xFFF0) == 0xABF0); } + bool CheckInnerComp(uint32_t uCompId) const { return ((uCompId & 0xFFF0) == 0xBBC0); } + }; + + class ReadoutConfig { + using CROB = ReadoutSetup::CROB; + public: /** @brief Constructor **/ - ReadoutConfig(const config::ReadoutPars& pars); + ReadoutConfig(const ReadoutSetup& pars); /** @brief Destructor **/ ~ReadoutConfig(); @@ -52,27 +104,27 @@ namespace cbm::algo::tof std::map<uint16_t, std::vector<std::vector<uint32_t>>> fReadoutMap = {}; /** @brief Initialisation of readout map **/ - void Init(const config::ReadoutPars& pars); + void Init(const ReadoutSetup& pars); /// Mapping to eLink to ASIC number within DPB. Mapping is the same for each DPB. - int32_t ElinkIdxToGet4Idx(uint32_t elink, const config::ReadoutPars& pars); + int32_t ElinkIdxToGet4Idx(uint32_t elink, const ReadoutSetup& pars); /// Mapping to eLink to ASIC number within DPB for 2024 inner TOF FEBs. Mapping is the same for each DPB. - int32_t ElinkIdxToGet4IdxInner(uint32_t elink, const config::ReadoutPars& pars); + int32_t ElinkIdxToGet4IdxInner(uint32_t elink, const ReadoutSetup& pars); - int32_t Get4ChanToPadiChan(uint32_t channelInFee, const config::ReadoutPars& pars); + int32_t Get4ChanToPadiChan(uint32_t channelInFee, const ReadoutSetup& pars); std::vector<int32_t> fviRpcChUId = {}; // UID/address for each channel, build from type, side and module - void BuildChannelsUidMap(const config::ReadoutPars& pars); - void BuildChannelsUidMapCbm(uint32_t& uCh, const config::CROB& crob); - void BuildChannelsUidMapStar(uint32_t& uCh, const config::CROB& crob); - void BuildChannelsUidMapCern(uint32_t& uCh, const config::CROB& crob); - void BuildChannelsUidMapCera(uint32_t& uCh, const config::CROB& crob); - void BuildChannelsUidMapStar2(uint32_t& uCh, const config::CROB& crob); - void BuildChannelsUidMapStar2Inner(uint32_t& uCh, const config::CROB& crob); - void BuildChannelsUidMapBuc(uint32_t& uCh, const config::CROB& crob); + void BuildChannelsUidMap(const ReadoutSetup& pars); + void BuildChannelsUidMapCbm(uint32_t& uCh, const CROB& crob); + void BuildChannelsUidMapStar(uint32_t& uCh, const CROB& crob); + void BuildChannelsUidMapCern(uint32_t& uCh, const CROB& crob); + void BuildChannelsUidMapCera(uint32_t& uCh, const CROB& crob); + void BuildChannelsUidMapStar2(uint32_t& uCh, const CROB& crob); + void BuildChannelsUidMapStar2Inner(uint32_t& uCh, const CROB& crob); + void BuildChannelsUidMapBuc(uint32_t& uCh, const CROB& crob); }; } // namespace cbm::algo::tof -#endif //ALGO_DETECTORS_TOF_READOUTCONFIG_H +CBM_YAML_EXTERN_DECL(cbm::algo::tof::ReadoutSetup); diff --git a/algo/detectors/tof/config/ReadoutPars.h b/algo/detectors/tof/config/ReadoutPars.h deleted file mode 100644 index c34275357794516975c7598931df358a11cc9c74..0000000000000000000000000000000000000000 --- a/algo/detectors/tof/config/ReadoutPars.h +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Felix Weiglhofer [committer], Dominik Smith */ -#pragma once - -#include "Definitions.h" - -#include <vector> - -namespace cbm::algo::tof::config -{ - - struct CROB { - i32 moduleId; - i32 rpcType; - i32 rpcSide; - i32 nRPC; - }; - - struct ReadoutPars { - - static ReadoutPars MakeMCBM2022(); - static ReadoutPars MakeMCBM2024(); - static ReadoutPars MakeMCBM2024_05(); - - bool mcbmTof2024 = false; - - i32 nFebsPerComponent; - i32 nAsicsPerFeb; - i32 nChannelsPerAsic; - i32 nCrobPerComponent; - - std::vector<CROB> crobs; - size_t NCROBs() const { return crobs.size(); } - - // Array to hold the unique IDs (equipment ID) for all TOF DPBs - std::vector<u16> eqIds; - size_t NComponents() const { return eqIds.size(); } - - - // Mapping to eLink to ASIC number within CROB. Mapping is the same for each CROB. (size: nElinksPerCrob) - std::vector<i32> elink2Asic; - std::vector<i32> elink2AsicInner; - - // Mapping in Readout chain PCBs - // Map from GET4 channel to PADI channel - // (size: nChansPerFeb) - std::vector<i32> asic2PadI; - - i32 NFebsPerCrob() const { return nFebsPerComponent / nCrobPerComponent; } - i32 NChansPerFeb() const { return nAsicsPerFeb * nChannelsPerAsic; } - i32 NChansPerComponent() const { return nChannelsPerAsic * NElinksPerComponent(); } - i32 NElinksPerCrob() const { return nAsicsPerFeb * NFebsPerCrob(); } - i32 NElinksPerComponent() const { return NElinksPerCrob() * nCrobPerComponent; } - - bool CheckBmonComp(uint32_t uCompId) const { return ((uCompId & 0xFFF0) == 0xABF0); } - bool CheckInnerComp(uint32_t uCompId) const { return ((uCompId & 0xFFF0) == 0xBBC0); } - }; - -} // namespace cbm::algo::tof::config diff --git a/algo/detectors/tof/config/ReadoutPars_mCBM2022.cxx b/algo/detectors/tof/config/ReadoutPars_mCBM2022.cxx deleted file mode 100644 index f0efa4bc2def5e5e784402c52e7eaf2d17763901..0000000000000000000000000000000000000000 --- a/algo/detectors/tof/config/ReadoutPars_mCBM2022.cxx +++ /dev/null @@ -1,60 +0,0 @@ -/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Felix Weiglhofer [committer], Dominik Smith */ -#include "Exceptions.h" -#include "ReadoutPars.h" - -using namespace cbm::algo::tof::config; - -ReadoutPars ReadoutPars::MakeMCBM2022() -{ - // This here refers to the mCBM 2022 setup. - // Taken from CbmMcbm2018TofPar in combination with macro/beamtime/mcbm2022/mTofCriParNickel.par - // and mTofCriParNickel_withBmon.par (?) - - ReadoutPars pars; - - pars.nFebsPerComponent = 10; - pars.nAsicsPerFeb = 8; - pars.nChannelsPerAsic = 4; - pars.nCrobPerComponent = 2; - - constexpr int NumCrob = 16; - - // Module Identifier connected to Gbtx link, has to match geometry - const int32_t moduleId[NumCrob] = {0, 0, 1, 1, 0, 0, 2, 2, 3, 3, 4, 4, 0, -1, 0, 0}; - - // type of Rpcs connected to Gbtx link - const int32_t rpcType[NumCrob] = {0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 9, 9, 6, 9}; - - // side of Rpcs connected to Gbtx link, i.e. 0 or 1 - const int32_t rpcSide[NumCrob] = {1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 8, 0}; - - // number of Rpcs connected to Gbtx link, i.e. 3 or 5 - const int32_t numRpc[NumCrob] = {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}; - - for (int i = 0; i < NumCrob; ++i) { - pars.crobs.push_back({moduleId[i], rpcType[i], rpcSide[i], numRpc[i]}); - } - - pars.eqIds = {0xabc0, 0xabc1, 0xabc2, 0xabc3, 0xabc4, 0xabc5, 0xabc6, 0xabc7}; - - pars.elink2Asic = {27, 2, 7, 3, 31, 26, 30, 1, 33, 37, 32, 13, 9, 14, 10, 15, 17, 21, 16, 35, - 34, 38, 25, 24, 0, 6, 20, 23, 18, 22, 28, 4, 29, 5, 19, 36, 39, 8, 12, 11}; - - // Mapping in Readout chain PCBs - pars.asic2PadI = { - 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12, - 19, 18, 17, 16, 23, 22, 21, 20, 27, 26, 25, 24, 31, 30, 29, 28}; //! Map from GET4 channel to PADI channel - - if (pars.NElinksPerCrob() != static_cast<i32>(pars.elink2Asic.size())) { - throw FatalError("tof::ReadoutPars::MakeMCBM2022 => size of elink2Asic not matching, {} vs {}, stop there!", - static_cast<uint32_t>(pars.elink2Asic.size()), static_cast<uint32_t>(pars.NElinksPerComponent())); - } - if (pars.NChansPerFeb() != static_cast<i32>(pars.asic2PadI.size())) { - throw FatalError("tof::ReadoutPars::MakeMCBM2022 => size of asic2PadI not matching, {} vs {}, stop there!", - static_cast<uint32_t>(pars.elink2Asic.size()), static_cast<uint32_t>(pars.NChansPerFeb())); - } - - return pars; -} diff --git a/algo/detectors/tof/config/ReadoutPars_mCBM2024.cxx b/algo/detectors/tof/config/ReadoutPars_mCBM2024.cxx deleted file mode 100644 index 44ec54cbbc820e1b6f9accc44b797edcb14fdd7a..0000000000000000000000000000000000000000 --- a/algo/detectors/tof/config/ReadoutPars_mCBM2024.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Felix Weiglhofer [committer], Dominik Smith */ -#include "Exceptions.h" -#include "ReadoutPars.h" - -using namespace cbm::algo::tof::config; - -ReadoutPars ReadoutPars::MakeMCBM2024() -{ - // This here refers to the mCBM 2022 and 2024 setups. - // Taken from CbmMcbm2018TofPar in combination with macro/beamtime/mcbm2022/mTofCriParNickel.par - // and mTofCriParNickel_withBmon.par (?) - - ReadoutPars pars; - - pars.mcbmTof2024 = true; - - pars.nFebsPerComponent = 5; - pars.nAsicsPerFeb = 8; - pars.nChannelsPerAsic = 4; - pars.nCrobPerComponent = 1; - - constexpr int NumCrob = 15; - - // Module Identifier connected to Gbtx link, has to match geometry - const int32_t moduleId[NumCrob] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 0, 0, 0, 1, 0}; - - // type of Rpcs connected to Gbtx link - const int32_t rpcType[NumCrob] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 9, 9, 6}; - - // side of Rpcs connected to Gbtx link, i.e. 0 or 1 - const int32_t rpcSide[NumCrob] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 4}; - - // number of Rpcs connected to Gbtx link, i.e. 3 or 5 - const int32_t numRpc[NumCrob] = {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 5}; - - for (int i = 0; i < NumCrob; ++i) { - pars.crobs.push_back({moduleId[i], rpcType[i], rpcSide[i], numRpc[i]}); - } - - pars.eqIds = {0xabc0, 0xabc1, 0xabc2, 0xabc3, 0xabc4, 0xabc5, 0xabc6, 0xabc7, - 0xabc8, 0xabc9, 0xabca, 0xabcb, 0xabcc, 0xabcd, 0xbbc0}; - - pars.elink2Asic = {27, 2, 7, 3, 31, 26, 30, 1, 33, 37, 32, 13, 9, 14, 10, 15, 17, 21, 16, 35, - 34, 38, 25, 24, 0, 6, 20, 23, 18, 22, 28, 4, 29, 5, 19, 36, 39, 8, 12, 11}; - pars.elink2AsicInner = {0, 16, 8, 17, 1, 18, 9, 19, 2, 20, 10, 21, 3, 22, 11, 23, 4, 24, 12, 25, - 5, 26, 13, 27, 6, 28, 14, 29, 7, 30, 15, 31, 32, 33, 34, 35, 36, 37, 38, 39}; - - // Mapping in Readout chain PCBs - pars.asic2PadI = { - 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12, - 19, 18, 17, 16, 23, 22, 21, 20, 27, 26, 25, 24, 31, 30, 29, 28}; //! Map from GET4 channel to PADI channel - - if (pars.NElinksPerCrob() != static_cast<i32>(pars.elink2Asic.size())) { - throw FatalError("tof::ReadoutPars::MakeMCBM2024 => size of elink2Asic not matching, {} vs {}, stop there!", - static_cast<uint32_t>(pars.elink2Asic.size()), static_cast<uint32_t>(pars.NElinksPerCrob())); - } - if (pars.NElinksPerCrob() != static_cast<i32>(pars.elink2AsicInner.size())) { - throw FatalError("tof::ReadoutPars::MakeMCBM2024 => size of elink2AsicInner not matching, {} vs {}, stop there!", - static_cast<uint32_t>(pars.elink2Asic.size()), static_cast<uint32_t>(pars.NElinksPerCrob())); - } - if (pars.NChansPerFeb() != static_cast<i32>(pars.asic2PadI.size())) { - throw FatalError("tof::ReadoutPars::MakeMCBM2024 => size of asic2PadI not matching, {} vs {}, stop there!", - static_cast<uint32_t>(pars.elink2Asic.size()), static_cast<uint32_t>(pars.NChansPerFeb())); - } - - return pars; -} diff --git a/algo/detectors/tof/config/ReadoutPars_mCBM2024_05.cxx b/algo/detectors/tof/config/ReadoutPars_mCBM2024_05.cxx deleted file mode 100644 index 1c0ff327aec3c89b267149a848e9488d87ec4869..0000000000000000000000000000000000000000 --- a/algo/detectors/tof/config/ReadoutPars_mCBM2024_05.cxx +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - SPDX-License-Identifier: GPL-3.0-only - Authors: Felix Weiglhofer [committer], Dominik Smith */ -#include "Exceptions.h" -#include "ReadoutPars.h" - -using namespace cbm::algo::tof::config; - -ReadoutPars ReadoutPars::MakeMCBM2024_05() -{ - // This here refers to the mCBM 2022 and 2024 setups. - // Taken from CbmMcbm2018TofPar in combination with macro/beamtime/mcbm2022/mTofCriParNickel.par - // and mTofCriParNickel_withBmon.par (?) - - ReadoutPars pars; - - pars.mcbmTof2024 = true; - - pars.nFebsPerComponent = 5; - pars.nAsicsPerFeb = 8; - pars.nChannelsPerAsic = 4; - pars.nCrobPerComponent = 1; - - constexpr int NumCrob = 19; - - // Module Identifier connected to Gbtx link, has to match geometry - const int32_t moduleId[NumCrob] = {0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 0, 0, 0, 1, 0, 1, 1, 5, 5}; - - // type of Rpcs connected to Gbtx link - const int32_t rpcType[NumCrob] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 9, 9, 6, 2, 2, 0, 0}; - - // side of Rpcs connected to Gbtx link, i.e. 0 or 1 - const int32_t rpcSide[NumCrob] = {0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 4, 2, 3, 2, 3}; - - // number of Rpcs connected to Gbtx link, i.e. 3 or 5 - const int32_t numRpc[NumCrob] = {5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 2, 5, 5, 5, 5}; - - for (int i = 0; i < NumCrob; ++i) { - pars.crobs.push_back({moduleId[i], rpcType[i], rpcSide[i], numRpc[i]}); - } - - pars.eqIds = {0xabc0, 0xabc1, 0xabc2, 0xabc3, 0xabc4, 0xabc5, 0xabc6, 0xabc7, 0xabc8, 0xabc9, - 0xabca, 0xabcb, 0xabd0, 0xabd1, 0xbbc0, 0xabcc, 0xabcd, 0xabce, 0xabcf}; - - pars.elink2Asic = {27, 2, 7, 3, 31, 26, 30, 1, 33, 37, 32, 13, 9, 14, 10, 15, 17, 21, 16, 35, - 34, 38, 25, 24, 0, 6, 20, 23, 18, 22, 28, 4, 29, 5, 19, 36, 39, 8, 12, 11}; - pars.elink2AsicInner = {0, 16, 8, 17, 1, 18, 9, 19, 2, 20, 10, 21, 3, 22, 11, 23, 4, 24, 12, 25, - 5, 26, 13, 27, 6, 28, 14, 29, 7, 30, 15, 31, 32, 33, 34, 35, 36, 37, 38, 39}; - - // Mapping in Readout chain PCBs - pars.asic2PadI = { - 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 9, 8, 15, 14, 13, 12, - 19, 18, 17, 16, 23, 22, 21, 20, 27, 26, 25, 24, 31, 30, 29, 28}; //! Map from GET4 channel to PADI channel - - if (pars.NElinksPerCrob() != static_cast<i32>(pars.elink2Asic.size())) { - throw FatalError("tof::ReadoutPars::MakeMCBM2024_05 => size of elink2Asic not matching, {} vs {}, stop there!", - static_cast<uint32_t>(pars.elink2Asic.size()), static_cast<uint32_t>(pars.NElinksPerCrob())); - } - if (pars.NElinksPerCrob() != static_cast<i32>(pars.elink2AsicInner.size())) { - throw FatalError("tof::ReadoutPars::MakeMCBM2024_05 => size of elink2AsicInner not matching, {} vs {}, stop there!", - static_cast<uint32_t>(pars.elink2Asic.size()), static_cast<uint32_t>(pars.NElinksPerCrob())); - } - if (pars.NChansPerFeb() != static_cast<i32>(pars.asic2PadI.size())) { - throw FatalError("tof::ReadoutPars::MakeMCBM2024_05 => size of asic2PadI not matching, {} vs {}, stop there!", - static_cast<uint32_t>(pars.elink2Asic.size()), static_cast<uint32_t>(pars.NChansPerFeb())); - } - - return pars; -} diff --git a/algo/global/ParFiles.cxx b/algo/global/ParFiles.cxx index 959ee5180157513374124e9facdcbe3836910690..a0809d7d70c8e71822fea5205178b64ad1cd3af1 100644 --- a/algo/global/ParFiles.cxx +++ b/algo/global/ParFiles.cxx @@ -27,6 +27,7 @@ ParFiles::ParFiles(uint32_t runId) sts.walkMap = "StsWalkMap_mcbm2022.yaml"; sts.hitfinder = "StsHitfinder_mcbm2022.yaml"; + tof.readout = "TofReadout_mcbm2022.yaml"; tof.calibrate = "TofCalibratePar_mcbm2022.yaml"; tof.hitfinder = "TofHitfinderPar_mcbm2022.yaml"; @@ -44,6 +45,7 @@ ParFiles::ParFiles(uint32_t runId) sts.walkMap = "StsWalkMap_mcbm2024.yaml"; sts.hitfinder = "StsHitfinder_mcbm2024.yaml"; + tof.readout = "TofReadout_mcbm2024.yaml"; tof.calibrate = "TofCalibratePar_mcbm2024.yaml"; tof.hitfinder = "TofHitfinderPar_mcbm2024.yaml"; @@ -61,6 +63,7 @@ ParFiles::ParFiles(uint32_t runId) sts.walkMap = "StsWalkMap_mcbm2024.yaml"; sts.hitfinder = "mcbm2024_05/StsHitfinder.yaml"; + tof.readout = "mcbm2024_05/TofReadout.yaml"; tof.calibrate = "mcbm2024_05/TofCalibratePar.yaml"; tof.hitfinder = "mcbm2024_05/TofHitfinderPar.yaml"; diff --git a/algo/global/ParFiles.h b/algo/global/ParFiles.h index 6c93c908a83c770fec969bbce2518a2e3704161d..92bbd4717abcc13ee813b98ee033b8373efecabc 100644 --- a/algo/global/ParFiles.h +++ b/algo/global/ParFiles.h @@ -32,6 +32,7 @@ namespace cbm::algo } sts; struct { + fs::path readout; fs::path calibrate; fs::path hitfinder; } tof; diff --git a/algo/global/Reco.cxx b/algo/global/Reco.cxx index 7637594e20f8c0381a3fe9a3b85ad0674b224948..5f67d0986a85a30cfc69349c9264596d041ecd05 100644 --- a/algo/global/Reco.cxx +++ b/algo/global/Reco.cxx @@ -26,7 +26,6 @@ #include "tof/Calibrate.h" #include "tof/Hitfind.h" #include "tof/Unpack.h" -#include "tof/config/ReadoutPars.h" #include "trd/Hitfind.h" #include "trd/Unpack.h" #include "trd2d/Unpack.h" @@ -135,9 +134,8 @@ void Reco::Init(const Options& opts) } if (Opts().Has(Subsystem::TOF) && Opts().Has(Step::Unpack)) { - tof::ReadoutConfig cfg{2918 <= Opts().RunId() ? tof::config::ReadoutPars::MakeMCBM2024_05() - : 2724 <= Opts().RunId() ? tof::config::ReadoutPars::MakeMCBM2024() - : tof::config::ReadoutPars::MakeMCBM2022()}; + tof::ReadoutSetup readoutSetup = yaml::ReadFromFile<tof::ReadoutSetup>(Opts().ParamsDir() / parFiles.tof.readout); + tof::ReadoutConfig cfg{readoutSetup}; fTofUnpack = std::make_unique<tof::Unpack>(cfg); } diff --git a/reco/tasks/CbmTaskUnpack.cxx b/reco/tasks/CbmTaskUnpack.cxx index f4eb372149d9424126dab2791578ff5335e0c824..5cb8ea9607294ebcd5b27623e55ea7d03b2be3d3 100644 --- a/reco/tasks/CbmTaskUnpack.cxx +++ b/reco/tasks/CbmTaskUnpack.cxx @@ -20,7 +20,7 @@ #include "MicrosliceDescriptor.hpp" #include "System.hpp" #include "bmon/config/ReadoutPars.h" -#include "tof/config/ReadoutPars.h" +#include "tof/ReadoutConfig.h" #include "yaml/Yaml.h" #include <FairParAsciiFileIo.h> @@ -175,10 +175,12 @@ InitStatus CbmTaskUnpack::Init() auto stsReadout = sts::ReadoutConfig::MakeMCBM2022(); auto stsWalkMap = sts::WalkMap::MakeMCBM2022(); fStsUnpack = std::make_unique<sts::Unpack>(sts::Unpack::Config{stsReadout, stsWalkMap}); - auto tofReadoutPars = tof::config::ReadoutPars::MakeMCBM2022(); - fTofUnpack = std::make_unique<tof::Unpack>(tof::ReadoutConfig{tofReadoutPars}); - fTrdUnpack = std::make_unique<trd::Unpack>(InitTrdReadoutConfig()); - fTrd2dUnpack = std::make_unique<trd2d::Unpack>(InitTrd2dReadoutConfig()); + + std::string tofReadoutFile = Form("%s/parameters/online/TofReadout_mcbm2022.yaml", std::getenv("VMCWORKDIR")); + auto tofReadoutPars = yaml::ReadFromFile<tof::ReadoutSetup>(tofReadoutFile); + fTofUnpack = std::make_unique<tof::Unpack>(tof::ReadoutConfig{tofReadoutPars}); + fTrdUnpack = std::make_unique<trd::Unpack>(InitTrdReadoutConfig()); + fTrd2dUnpack = std::make_unique<trd2d::Unpack>(InitTrd2dReadoutConfig()); if (fConfig.dumpSetup) { DumpUnpackSetup();