From 5b9a105494434e0251b26e53a6bfc6fc49086d39 Mon Sep 17 00:00:00 2001 From: Gerhard Raven Date: Wed, 12 Mar 2025 21:29:20 +0100 Subject: [PATCH 1/3] Migrate from gsl::span to std::span --- CMakeLists.txt | 2 +- .../BinaryDumpers/include/Dumpers/IUpdater.h | 2 +- Dumpers/BinaryDumpers/include/Dumpers/Utils.h | 10 +- Dumpers/BinaryDumpers/src/AllenUpdater.cpp | 2 +- Dumpers/BinaryDumpers/src/AllenUpdater.h | 2 +- Dumpers/BinaryDumpers/src/PVDumper.cpp | 86 ++++++++------ Dumpers/BinaryDumpers/src/PVDumper.h | 50 --------- Dumpers/BinaryDumpers/src/TestMuonTable.cpp | 12 +- Dumpers/RootDumpers/src/PrTrackerDumper.cpp | 106 +++++++----------- .../src/GaudiAllenLumiSummaryToRawEvent.cpp | 3 +- Rec/Allen/src/GaudiAllenReportsToRawEvent.cpp | 14 +-- backend/include/BackendCommon.h | 8 +- backend/include/CUDABackend.h | 1 + checker/pv/include/PVCheckerHistos.h | 40 +++---- checker/pv/include/PrimaryVertexChecker.h | 6 +- checker/pv/src/PVCheckerHistos.cpp | 40 +++---- checker/pv/src/PrimaryVertexChecker.cpp | 6 +- checker/selections/include/RateChecker.h | 2 +- checker/selections/src/RateChecker.cpp | 2 +- checker/tracking/include/CompositeDumper.h | 8 +- checker/tracking/include/KalmanChecker.h | 2 +- checker/tracking/include/PrepareTracks.h | 66 +++++------ checker/tracking/include/TrackChecker.h | 2 +- checker/tracking/src/KalmanChecker.cpp | 4 +- checker/tracking/src/PrepareTracks.cpp | 66 +++++------ cmake/AllenDependencies.cmake | 1 - cmake/GenerateConfiguration.cmake | 2 +- cmake/modules/Findcppgsl.cmake | 59 ---------- device/event_model/UT/include/UTUniqueID.cuh | 4 +- .../decoding/include/MuonCalculateSRQSize.cuh | 2 +- device/selections/Hlt1/src/DecReporter.cu | 2 +- device/selections/Hlt1/src/GlobalDecision.cu | 2 +- .../Hlt1/src/MakeSelectedObjectLists.cu | 2 +- .../utils/mva_models/src/CatboostDesTree.cu | 6 +- .../scaler/include/DeterministicScaler.cuh | 4 +- host/data_provider/include/HostDataProvider.h | 10 +- host/data_provider/include/LayoutProvider.h | 2 +- host/data_provider/include/MCDataProvider.h | 14 +-- host/data_provider/include/ODINProvider.h | 2 +- .../error_banks_cut/include/ErrorBankFilter.h | 2 +- .../include/HostOdinErrorFilter.h | 2 +- host/error_banks_cut/src/ErrorBankFilter.cpp | 2 +- host/global_event_cut/include/HostSciFiGEC.h | 10 +- host/global_event_cut/include/HostUTGEC.h | 10 +- .../include/HostRoutingBitsWriter.h | 2 +- .../src/HostRoutingBitsWriter.cpp | 2 +- host/tae/include/HostTAEFilter.h | 2 +- .../non_event_data/include/Consumers.h | 11 +- integration/non_event_data/include/Updater.h | 2 +- .../non_event_data/src/BasicGeometry.cpp | 4 +- .../non_event_data/src/MagneticField.cpp | 2 +- integration/non_event_data/src/UTBoards.cpp | 2 +- integration/non_event_data/src/UTGeometry.cpp | 6 +- integration/non_event_data/src/Updater.cpp | 2 +- main/include/BankTypes.h | 10 +- main/include/Common.h | 19 +--- main/include/FileWriter.h | 4 +- main/include/InputProvider.h | 7 +- main/include/InputReader.h | 2 +- main/include/MDFProvider.h | 6 +- main/include/OutputHandler.h | 10 +- main/include/TESProvider.h | 6 +- main/include/Transpose.h | 6 +- main/include/TransposeTypes.h | 8 +- main/include/ZMQOutputSender.h | 2 +- main/src/AllenThreads.cpp | 2 +- main/src/InputReader.cpp | 4 +- main/src/MDFProvider.cpp | 18 +-- main/src/OutputHandler.cpp | 46 ++++---- main/src/SliceUtils.cpp | 4 +- main/src/Transpose.cpp | 10 +- main/src/ZMQOutputSender.cpp | 4 +- mdf/include/eb_header.hpp | 20 ++-- mdf/include/read_mdf.hpp | 13 +-- mdf/include/write_mdf.hpp | 4 +- mdf/src/read_mdf.cpp | 14 +-- mdf/src/write_mdf.cpp | 2 +- mdf/test/bench_read.cpp | 4 +- mdf/test/bench_transpose.cpp | 2 +- mdf/test/bench_transpose_mep.cpp | 4 +- mdf/test/test_mep_banks.cpp | 98 ++++++++-------- mdf/test/test_read.cpp | 2 +- stream/sequence/include/Constants.cuh | 14 +-- .../sequence/include/HostBuffersManager.cuh | 2 +- stream/store/include/AllenBuffer.cuh | 22 ++-- stream/store/include/Argument.cuh | 6 +- stream/store/include/ArgumentOps.cuh | 12 +- stream/store/include/InputAggregate.cuh | 4 +- stream/store/include/Store.cuh | 13 ++- zmq/test/mdf_sender.cpp | 2 +- 90 files changed, 500 insertions(+), 621 deletions(-) delete mode 100644 Dumpers/BinaryDumpers/src/PVDumper.h delete mode 100644 cmake/modules/Findcppgsl.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index f0738cd2dbb..6da1089edb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -699,7 +699,7 @@ allen_add_host_library(HostCommon SHARED main/src/Transpose.cpp) target_link_libraries(AllenCommon INTERFACE - LHCbEvent AllenFS nlohmann_json::nlohmann_json cppgsl::cppgsl fmt::fmt) + LHCbEvent AllenFS nlohmann_json::nlohmann_json fmt::fmt) target_link_libraries(HostCommon PRIVATE mdf EventModel Gear Backend mdf AllenCommon LHCbEvent Boost::iostreams Rangev3::rangev3) diff --git a/Dumpers/BinaryDumpers/include/Dumpers/IUpdater.h b/Dumpers/BinaryDumpers/include/Dumpers/IUpdater.h index da0c949b2b7..70f19f66536 100644 --- a/Dumpers/BinaryDumpers/include/Dumpers/IUpdater.h +++ b/Dumpers/BinaryDumpers/include/Dumpers/IUpdater.h @@ -88,7 +88,7 @@ namespace Allen { * * @return void */ - virtual void update(gsl::span odin_data) = 0; + virtual void update(std::span odin_data) = 0; /** * @brief Register a consumer for that will consume binary non-event diff --git a/Dumpers/BinaryDumpers/include/Dumpers/Utils.h b/Dumpers/BinaryDumpers/include/Dumpers/Utils.h index 860fffe600d..03bed0cf120 100644 --- a/Dumpers/BinaryDumpers/include/Dumpers/Utils.h +++ b/Dumpers/BinaryDumpers/include/Dumpers/Utils.h @@ -40,21 +40,25 @@ namespace DumpUtils { bool createDirectory(boost::filesystem::path dir); namespace detail { + template + constexpr bool is_span_v = false; + template + constexpr bool is_span_v> = true; template std::ostream& write(std::ostream& os, const T& t) { // if you would like to know why there is a check for trivially copyable, // please read the 'notes' section of https://en.cppreference.com/w/cpp/types/is_trivially_copyable - if constexpr (std::is_same_v>) { + if constexpr (std::is_same_v>) { return os.write(reinterpret_cast(t.data()), t.size()); } - else if constexpr (std::is_trivially_copyable_v && !gsl::details::is_span::value) { + else if constexpr (std::is_trivially_copyable_v && !is_span_v) { return os.write(reinterpret_cast(&t), sizeof(T)); } else { static_assert(std::is_trivially_copyable_v); - return write(os, as_bytes(LHCb::make_span(t))); + return write(os, std::as_bytes(LHCb::make_span(t))); } } diff --git a/Dumpers/BinaryDumpers/src/AllenUpdater.cpp b/Dumpers/BinaryDumpers/src/AllenUpdater.cpp index e3865a9dce5..c526491dfa9 100644 --- a/Dumpers/BinaryDumpers/src/AllenUpdater.cpp +++ b/Dumpers/BinaryDumpers/src/AllenUpdater.cpp @@ -89,7 +89,7 @@ void AllenUpdater::registerProducer(string const& id, Allen::NonEventData::Produ } } -void AllenUpdater::update(gsl::span odin_data) +void AllenUpdater::update(std::span odin_data) { { std::scoped_lock lock {m_odinMutex}; diff --git a/Dumpers/BinaryDumpers/src/AllenUpdater.h b/Dumpers/BinaryDumpers/src/AllenUpdater.h index 51d38f442f5..be00121186b 100644 --- a/Dumpers/BinaryDumpers/src/AllenUpdater.h +++ b/Dumpers/BinaryDumpers/src/AllenUpdater.h @@ -56,7 +56,7 @@ public: * * @return void */ - void update(gsl::span odin) override; + void update(std::span odin) override; /** * @brief Register a consumer for that will consume binary non-event diff --git a/Dumpers/BinaryDumpers/src/PVDumper.cpp b/Dumpers/BinaryDumpers/src/PVDumper.cpp index cc983166d30..f7853ec86dd 100644 --- a/Dumpers/BinaryDumpers/src/PVDumper.cpp +++ b/Dumpers/BinaryDumpers/src/PVDumper.cpp @@ -8,18 +8,20 @@ * granted to it by virtue of its status as an Intergovernmental Organization * * or submit itself to any jurisdiction. * \*****************************************************************************/ -// Include files - -// local -#include "PVDumper.h" +#include "Event/MCParticle.h" +#include "Event/MCTrackInfo.h" +#include "Event/MCVertex.h" +#include "Event/ODIN.h" +#include "Event/RawEvent.h" +#include "Event/RawBank.h" +#include "LHCbAlgs/Transformer.h" +#include "Associators/Associators.h" #include "Associators/Associators.h" #include -#include +#include namespace { - namespace fs = boost::filesystem; - void collectProductss( const LHCb::MCVertex& mcpv, const LHCb::MCVertex& mcvtx, @@ -34,8 +36,43 @@ namespace { } } } + + // count number reconstructible tracks in the same way as PrimaryVertexChecker + int count_reconstructible_mc_particles(const LHCb::MCVertex& avtx, const MCTrackInfo& trInfo) + { + std::vector allproducts; + collectProductss(avtx, avtx, allproducts); + + return std::count_if(allproducts.begin(), allproducts.end(), [&](const auto* pmcp) { + if (pmcp->particleID().threeCharge() == 0 || !trInfo.hasVelo(pmcp)) return false; + double dv2 = (avtx.position() - pmcp->originVertex()->position()).Mag2(); + return dv2 < 0.0000001 && pmcp->p() > 100. * Gaudi::Units::MeV; + }); + } } // namespace +/** @class PVDumper PVDumper.h + * tool to dump the MC truth informaiton for PVs + * based on the PrTrackerDumper code + * + * @author Florian Reiss + * @date 2018-12-17 + */ +class PVDumper + : public LHCb::Algorithm::MultiTransformer< + std::tuple(const LHCb::MCVertices& MCVertices, const LHCb::MCProperty&)> { +public: + /// Standard constructor + PVDumper(const std::string& name, ISvcLocator* pSvcLocator); + + std::tuple operator()( + const LHCb::MCVertices& MCVertices, + const LHCb::MCProperty&) const override; + +private: + static const LHCb::RawBank::BankType m_bankType = LHCb::RawBank::BankType::OTError; +}; + // Declaration of the Algorithm Factory DECLARE_COMPONENT(PVDumper) @@ -44,21 +81,18 @@ DECLARE_COMPONENT(PVDumper) //============================================================================= PVDumper::PVDumper(const std::string& name, ISvcLocator* pSvcLocator) : - Transformer( - name, - pSvcLocator, - // Input - {KeyValue {"MCVerticesLocation", LHCb::MCVertexLocation::Default}, - KeyValue {"MCPropertyLocation", LHCb::MCPropertyLocation::TrackInfo}}, - // Output - KeyValue {"OutputRawEventLocation", "Allen/MCPVRawEvent"}) + MultiTransformer {name, + pSvcLocator, + {KeyValue {"MCVerticesLocation", LHCb::MCVertexLocation::Default}, + KeyValue {"MCPropertyLocation", LHCb::MCPropertyLocation::TrackInfo}}, + {KeyValue {"OutputRawEventLocation", "Allen/MCPVRawEvent"}, + KeyValue {"OutputRawBankLocation", "Allen/MCPVRawBank"}}} {} -StatusCode PVDumper::initialize() { return StatusCode::SUCCESS; } - -LHCb::RawEvent PVDumper::operator()(const LHCb::MCVertices& MCVertices, const LHCb::MCProperty& MCProp) const +std::tuple PVDumper::operator()( + const LHCb::MCVertices& MCVertices, + const LHCb::MCProperty& MCProp) const { - DumpUtils::Writer writer; auto goodVertex = [](const auto* v) { @@ -82,18 +116,6 @@ LHCb::RawEvent PVDumper::operator()(const LHCb::MCVertices& MCVertices, const LH rawEvent.addBank(sourceID, m_bankType, 1, data); } - return rawEvent; + return viewFromRawEvent(std::move(rawEvent), m_bankType); } -// count number reconstructible tracks in the same way as PrimaryVertexChecker -int PVDumper::count_reconstructible_mc_particles(const LHCb::MCVertex& avtx, const MCTrackInfo& trInfo) const -{ - std::vector allproducts; - collectProductss(avtx, avtx, allproducts); - - return std::count_if(allproducts.begin(), allproducts.end(), [&](const auto* pmcp) { - if (pmcp->particleID().threeCharge() == 0 || !trInfo.hasVelo(pmcp)) return false; - double dv2 = (avtx.position() - pmcp->originVertex()->position()).Mag2(); - return dv2 < 0.0000001 && pmcp->p() > 100. * Allen::Units::MeV; - }); -} diff --git a/Dumpers/BinaryDumpers/src/PVDumper.h b/Dumpers/BinaryDumpers/src/PVDumper.h deleted file mode 100644 index 2db187554ab..00000000000 --- a/Dumpers/BinaryDumpers/src/PVDumper.h +++ /dev/null @@ -1,50 +0,0 @@ -/*****************************************************************************\ -* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration * -* * -* This software is distributed under the terms of the Apache License * -* version 2 (Apache-2.0), copied verbatim in the file "LICENSE". * -* * -* In applying this licence, CERN does not waive the privileges and immunities * -* granted to it by virtue of its status as an Intergovernmental Organization * -* or submit itself to any jurisdiction. * -\*****************************************************************************/ -#ifndef PVDUMPER_H -#define PVDUMPER_H 1 - -#include -#include -#include - -// Include files -#include "Event/MCParticle.h" -#include "Event/MCTrackInfo.h" -#include "Event/MCVertex.h" -#include "Event/ODIN.h" -#include "Event/RawEvent.h" -#include "Event/RawBank.h" -#include "GaudiAlg/Transformer.h" - -#include "Associators/Associators.h" - -/** @class PVDumper PVDumper.h - * tool to dump the MC truth informaiton for PVs - * based on the PrTrackerDumper code - * - * @author Florian Reiss - * @date 2018-12-17 - */ -class PVDumper - : public Gaudi::Functional::Transformer { -public: - /// Standard constructor - PVDumper(const std::string& name, ISvcLocator* pSvcLocator); - - StatusCode initialize() override; - - LHCb::RawEvent operator()(const LHCb::MCVertices& MCVertices, const LHCb::MCProperty&) const override; - -private: - int count_reconstructible_mc_particles(const LHCb::MCVertex&, const MCTrackInfo&) const; - LHCb::RawBank::BankType m_bankType = LHCb::RawBank::BankType::OTError; -}; -#endif // PVDUMPER_H diff --git a/Dumpers/BinaryDumpers/src/TestMuonTable.cpp b/Dumpers/BinaryDumpers/src/TestMuonTable.cpp index 6e9fded75ef..7357880a21f 100644 --- a/Dumpers/BinaryDumpers/src/TestMuonTable.cpp +++ b/Dumpers/BinaryDumpers/src/TestMuonTable.cpp @@ -27,7 +27,7 @@ namespace { namespace fs = boost::filesystem; template - constexpr void pop_n(gsl::span& buffer, size_t n, gsl::span out) + constexpr void pop_n(std::span& buffer, size_t n, std::span out) { static_assert(std::is_trivially_copyable_v); assert(out.size() >= n); @@ -38,16 +38,16 @@ namespace { } template - constexpr void pop_n(gsl::span& buffer, size_t n, Out& out) + constexpr void pop_n(std::span& buffer, size_t n, Out& out) { - pop_n(buffer, n, gsl::span {out}); + pop_n(buffer, n, std::span {out}); } template - [[nodiscard]] constexpr Out pop(gsl::span& buffer) + [[nodiscard]] constexpr Out pop(std::span& buffer) { Out out {}; - pop_n(buffer, 1, gsl::span {&out, 1}); + pop_n(buffer, 1, std::span {&out, 1}); return out; } @@ -162,7 +162,7 @@ void hit_position( lookup(std::get<0>(r).get(), tile, x, dx, y, dy, z); } -void read_muon_table(gsl::span raw_input, MuonTable& pad, MuonTable& stripX, MuonTable& stripY) +void read_muon_table(std::span raw_input, MuonTable& pad, MuonTable& stripX, MuonTable& stripY) { size_t n = 0; auto version = pop(raw_input); diff --git a/Dumpers/RootDumpers/src/PrTrackerDumper.cpp b/Dumpers/RootDumpers/src/PrTrackerDumper.cpp index ba12a1de112..ebfa5061917 100644 --- a/Dumpers/RootDumpers/src/PrTrackerDumper.cpp +++ b/Dumpers/RootDumpers/src/PrTrackerDumper.cpp @@ -17,6 +17,7 @@ #include "Event/RawBank.h" #include "Event/RawEvent.h" #include "Event/VPLightCluster.h" +#include "Kernel/ParticleIDs.h" #include "UTDAQ/UTInfo.h" #include "PrKernel/UTHit.h" #include "PrKernel/UTHitHandler.h" @@ -153,9 +154,10 @@ using Gaudi::Functional::Traits::useLegacyGaudiAlgorithm; * @date 2017-11-06 */ -class PrTrackerDumper : public Gaudi::Functional::Transformer< - LHCb::RawEvent( +class PrTrackerDumper : public Gaudi::Functional::MultiTransformer< + std::tuple( const LHCb::MCParticles&, + const LHCb::MCVertices&, const std::vector&, const LHCb::Pr::FT::Hits&, const UT::HitHandler&, @@ -203,8 +205,9 @@ public: const unsigned int nbHits_in_SciFi, DumpUtils::Writer& outfile) const; - LHCb::RawEvent operator()( + std::tuple operator()( const LHCb::MCParticles& MCParticles, + const LHCb::MCVertices& mcVert, const std::vector& VPClusters, const LHCb::Pr::FT::Hits& ftHits, const UT::HitHandler& utHits, @@ -229,16 +232,17 @@ DECLARE_COMPONENT(PrTrackerDumper) //============================================================================= PrTrackerDumper::PrTrackerDumper(const string& name, ISvcLocator* pSvcLocator) : - Transformer( + MultiTransformer { name, pSvcLocator, {KeyValue {"MCParticlesLocation", LHCb::MCParticleLocation::Default}, + KeyValue {"MCVerticesLocation", LHCb::MCVertexLocation::Default}, KeyValue {"VPLightClusterLocation", LHCb::VPClusterLocation::Light}, KeyValue {"FTHitsLocation", PrFTInfo::SciFiHitsLocation}, KeyValue {"UTHitsLocation", UTInfo::HitLocation}, KeyValue {"ODINLocation", LHCb::ODINLocation::Default}, KeyValue {"LinkerLocation", Links::location("Pr/LHCbID")}}, - KeyValue {"OutputRawEventLocation", "Allen/MCRawEvent"}) + {KeyValue {"OutputRawEventLocation", "Allen/MCRawEvent"}, KeyValue {"OutputRawBanksLocation", "Allen/MCRawBanks"}}} {} StatusCode PrTrackerDumper::initialize() @@ -337,25 +341,6 @@ void PrTrackerDumper::write_MCP_info( } } -int computeNbUTHits(const UT::HitHandler& prUTHitHandler) -{ - int nbHits = 0; - for (int iSide = 0; iSide < NBSIDE; ++iSide) { - for (int iLayer = 0; iLayer < NBHALFLAYER; ++iLayer) { - for (int iStave = 0; iStave < NBSTAVE; ++iStave) { - for (int iFace = 0; iFace < NBFACE; ++iFace) { - for (int iModule = 0; iModule < NBMODULE; ++iModule) { - for (int iSector = 0; iSector < NBSUBSECTOR; ++iSector) { - nbHits += prUTHitHandler.hits(iSide, iLayer, iStave, iFace, iModule, iSector).size(); - } - } - } - } - } - } - return nbHits; -} - double mcpTau(const LHCb::MCParticle* mcp) { if (mcp->originVertex()) { @@ -370,8 +355,9 @@ double mcpTau(const LHCb::MCParticle* mcp) return 0; } -LHCb::RawEvent PrTrackerDumper::operator()( +std::tuple PrTrackerDumper::operator()( const LHCb::MCParticles& MCParticles, + const LHCb::MCVertices& mcVert, const vector& VPClusters, const LHCb::Pr::FT::Hits& ftHits, const UT::HitHandler& prUTHitHandler, @@ -502,7 +488,7 @@ LHCb::RawEvent PrTrackerDumper::operator()( } nbHits_in_Velo = VPClusters.size(); - nbHits_in_UT = computeNbUTHits(prUTHitHandler); + nbHits_in_UT = prUTHitHandler.nbHits(); nbHits_in_SciFi = (int) ftHits.size(); // SciFi @@ -638,22 +624,13 @@ LHCb::RawEvent PrTrackerDumper::operator()( (*tree)->Branch("charge", &charge); } // Count number of reconstructible primary vertices - LHCb::MCVertices* mcVert = getIfExists(LHCb::MCVertexLocation::Default); - if (mcVert == nullptr) { - error() << "Could not find MCVertices at " << LHCb::MCParticleLocation::Default << endmsg; - } - unsigned int nPrim = 0; - for (LHCb::MCVertices::iterator itV = mcVert->begin(); mcVert->end() != itV; ++itV) { - if ((*itV)->isPrimary()) { - int nbVisible = 0; - for (const auto* mcparticle : MCParticles) { - if (mcparticle->primaryVertex() == *itV) { - if (trackInfo.hasVelo(mcparticle)) nbVisible++; - } - } - if (nbVisible > 4) ++nPrim; - } - } + unsigned int nPrim = std::count_if(mcVert.begin(), mcVert.end(), [&](const auto* itV) { + if (!itV->isPrimary()) return false; + int nbVisible = std::count_if(MCParticles.begin(), MCParticles.end(), [&](const auto* mcparticle) { + return mcparticle->primaryVertex() == &(*itV) && trackInfo.hasVelo(mcparticle); + }); + return nbVisible > 4; + }); // Count number of MC partcles with hits in trackers unsigned int nMCPsWithHits = 0; @@ -817,48 +794,45 @@ LHCb::RawEvent PrTrackerDumper::operator()( ovtx_y = mcparticle->originVertex()->position().y(); ovtx_z = mcparticle->originVertex()->position().z(); const LHCb::MCParticle* mother = mcparticle->originVertex()->mother(); - if (nullptr != mother) { - if (nullptr != mother->originVertex()) { - double rOrigin = mother->originVertex()->position().rho(); - if (fabs(rOrigin) < 5.) { // radial origin position of the mother within 5 mm from beam pipe - int pid = abs(mother->particleID().pid()); - if ( - 130 == pid || // K0L - 310 == pid || // K0S - 3122 == pid || // Lambda - 3222 == pid || // Sigma+ - 3212 == pid || // Sigma0 - 3112 == pid || // Sigma- - 3322 == pid || // Xsi0 - 3312 == pid || // Xsi- - 3334 == pid // Omega- - ) { - fromStrangeDecay = true; - } + if (mother && mother->originVertex()) { + double rOrigin = mother->originVertex()->position().rho(); + if (fabs(rOrigin) < 5.) { // radial origin position of the mother within 5 mm from beam pipe + constexpr auto strange_ids = std::array {LHCb::ParticleIDs::kaon_long, + LHCb::ParticleIDs::kaon_short, + LHCb::ParticleIDs::lambda, + LHCb::ParticleIDs::sigma_plus, + LHCb::ParticleIDs::sigma_zero, + LHCb::ParticleIDs::sigma_minus, + LHCb::ParticleIDs::xi_zero, + LHCb::ParticleIDs::xi_minus, + LHCb::ParticleIDs::omega_minus}; + if (std::ranges::any_of(strange_ids, [pid = std::abs(mother->particleID())](auto i) { return i == pid; })) { + fromStrangeDecay = true; } } } - while (nullptr != mother) { + while (mother) { // Bottom. if (mother->particleID().hasBottom() && (mother->particleID().isMeson() || mother->particleID().isBaryon())) { + fromBeautyDecay = true; DecayOriginMother_pid = mother->particleID().pid(); DecayOriginMother_key = mother->key(); DecayOriginMother_pt = mother->momentum().Pt(); - fromBeautyDecay = true; DecayOriginMother_tau = mcpTau(mother); } // Charm. if (mother->particleID().hasCharm() && (mother->particleID().isMeson() || mother->particleID().isBaryon())) { + fromCharmDecay = true; DecayOriginMother_pid = mother->particleID().pid(); DecayOriginMother_key = mother->key(); DecayOriginMother_pt = mother->momentum().Pt(); - fromCharmDecay = true; DecayOriginMother_tau = mcpTau(mother); } // Higgs/EW. if ( - mother->particleID().pid() == 23 || std::abs(mother->particleID().pid()) == 24 || - mother->particleID().pid() == 25) { + mother->particleID() == LHCb::ParticleIDs::z_boson || + std::abs(mother->particleID()) == LHCb::ParticleIDs::w_plus || + mother->particleID() == LHCb::ParticleIDs::higgs_boson) { DecayOriginMother_pid = mother->particleID().pid(); DecayOriginMother_key = mother->key(); DecayOriginMother_pt = mother->momentum().Pt(); @@ -1070,7 +1044,7 @@ LHCb::RawEvent PrTrackerDumper::operator()( file->Write(); file->Close(); } - return rawEvent; + return viewFromRawEvent(std::move(rawEvent), m_bankType); } int PrTrackerDumper::mcVertexType(const LHCb::MCParticle& particle) const diff --git a/Rec/Allen/src/GaudiAllenLumiSummaryToRawEvent.cpp b/Rec/Allen/src/GaudiAllenLumiSummaryToRawEvent.cpp index 9dfbad727dd..8dd6511a608 100644 --- a/Rec/Allen/src/GaudiAllenLumiSummaryToRawEvent.cpp +++ b/Rec/Allen/src/GaudiAllenLumiSummaryToRawEvent.cpp @@ -56,7 +56,6 @@ std::tuple GaudiAllenLumiSummaryToRawEvent: if (!lumi_summaries.empty()) { raw_event.addBank(Hlt1::Constants::sourceID, LHCb::RawBank::BankType::HltLumiSummary, 2u, lumi_summaries); } - auto lumi_view = raw_event.banks(LHCb::RawBank::BankType::HltLumiSummary); - return {std::move(raw_event), std::move(lumi_view)}; + return viewFromRawEvent(std::move(raw_event), LHCb::RawBank::BankType::HltLumiSummary); } diff --git a/Rec/Allen/src/GaudiAllenReportsToRawEvent.cpp b/Rec/Allen/src/GaudiAllenReportsToRawEvent.cpp index f25bc8fb58e..6645fd1d5fd 100644 --- a/Rec/Allen/src/GaudiAllenReportsToRawEvent.cpp +++ b/Rec/Allen/src/GaudiAllenReportsToRawEvent.cpp @@ -23,8 +23,7 @@ class GaudiAllenReportsToRawEvent const std::vector&, const std::vector&, const std::vector&, - const std::vector&), - LHCb::Algorithm::Traits::writeOnly> { + const std::vector&)> { public: // Standard constructor GaudiAllenReportsToRawEvent(const std::string& name, ISvcLocator* pSvcLocator) : @@ -65,12 +64,11 @@ public: dec_reports.bank_data()); raw_event.addBank(Hlt1::Constants::sourceID, LHCb::RawBank::BankType::HltRoutingBits, 0u, routing_bits); - auto dec_view = raw_event.banks(LHCb::RawBank::BankType::HltDecReports); - auto sel_view = raw_event.banks(LHCb::RawBank::BankType::HltSelReports); - auto rb_view = raw_event.banks(LHCb::RawBank::BankType::HltRoutingBits); - // without std::move here the RawEvent gets copied which would invalidate the view - // View creation must be after RawEvent is made - return {std::move(raw_event), std::move(dec_view), std::move(sel_view), std::move(rb_view)}; + return viewsFromRawEvent( + std::move(raw_event), + std::array {LHCb::RawBank::BankType::HltDecReports, + LHCb::RawBank::BankType::HltSelReports, + LHCb::RawBank::BankType::HltRoutingBits}); } }; diff --git a/backend/include/BackendCommon.h b/backend/include/BackendCommon.h index 4616bee3d32..f944f17b15f 100644 --- a/backend/include/BackendCommon.h +++ b/backend/include/BackendCommon.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include "AllenTypeTraits.h" #include "BackendCommonInterface.h" @@ -114,8 +114,8 @@ namespace Allen { #include #endif -// Replacement for gsl::span in device code when building with HIP, -// gsl::span works for CUDA and CPU +// Replacement for span in device code when building with HIP, +// std::span works for CUDA and CPU namespace Allen::device { #if defined(TARGET_DEVICE_HIP) template @@ -168,7 +168,7 @@ namespace Allen::device { constexpr __device__ __host__ T* rend() const { return m_ptr - 1; } }; #else - using gsl::span; + using std::span; #endif } // namespace Allen::device diff --git a/backend/include/CUDABackend.h b/backend/include/CUDABackend.h index 40c06f68597..3a0706ec2bc 100644 --- a/backend/include/CUDABackend.h +++ b/backend/include/CUDABackend.h @@ -9,6 +9,7 @@ * or submit itself to any jurisdiction. * \*****************************************************************************/ #pragma once +#include #if defined(TARGET_DEVICE_CUDA) diff --git a/checker/pv/include/PVCheckerHistos.h b/checker/pv/include/PVCheckerHistos.h index 350c1547248..6029f861ae5 100644 --- a/checker/pv/include/PVCheckerHistos.h +++ b/checker/pv/include/PVCheckerHistos.h @@ -20,26 +20,26 @@ public: PVCheckerHistos(CheckerInvoker const* invoker, std::string const& root_file, std::string const& directory); void accumulate( - gsl::span vec_all_rec, - gsl::span vec_rec_x, - gsl::span vec_rec_y, - gsl::span vec_rec_z, - gsl::span vec_diff_x, - gsl::span vec_diff_y, - gsl::span vec_diff_z, - gsl::span vec_err_x, - gsl::span vec_err_y, - gsl::span vec_err_z, - gsl::span vec_n_trinmcpv, - gsl::span vec_n_mcpv, - gsl::span vec_mcpv_recd, - gsl::span vec_recpv_fake, - gsl::span vec_mcpv_mult, - gsl::span vec_recpv_mult, - gsl::span vec_mcpv_zpos, - gsl::span vec_mc_x, - gsl::span vec_mc_y, - gsl::span vec_mc_z); + std::span vec_all_rec, + std::span vec_rec_x, + std::span vec_rec_y, + std::span vec_rec_z, + std::span vec_diff_x, + std::span vec_diff_y, + std::span vec_diff_z, + std::span vec_err_x, + std::span vec_err_y, + std::span vec_err_z, + std::span vec_n_trinmcpv, + std::span vec_n_mcpv, + std::span vec_mcpv_recd, + std::span vec_recpv_fake, + std::span vec_mcpv_mult, + std::span vec_recpv_mult, + std::span vec_mcpv_zpos, + std::span vec_mc_x, + std::span vec_mc_y, + std::span vec_mc_z); void write(); diff --git a/checker/pv/include/PrimaryVertexChecker.h b/checker/pv/include/PrimaryVertexChecker.h index c5c54044861..c875f371640 100644 --- a/checker/pv/include/PrimaryVertexChecker.h +++ b/checker/pv/include/PrimaryVertexChecker.h @@ -36,9 +36,9 @@ public: void accumulate( MCEvents const& mc_events, - gsl::span rec_vertex, - gsl::span number_of_vertex, - gsl::span event_list, + std::span rec_vertex, + std::span number_of_vertex, + std::span event_list, const int nTracksToBeRecble); void report(size_t n_events) const override; diff --git a/checker/pv/src/PVCheckerHistos.cpp b/checker/pv/src/PVCheckerHistos.cpp index 2c0f4b71639..087faff8761 100644 --- a/checker/pv/src/PVCheckerHistos.cpp +++ b/checker/pv/src/PVCheckerHistos.cpp @@ -72,26 +72,26 @@ PVCheckerHistos::PVCheckerHistos( } void PVCheckerHistos::accumulate( - gsl::span vec_all_rec, - gsl::span vec_rec_x, - gsl::span vec_rec_y, - gsl::span vec_rec_z, - gsl::span vec_diff_x, - gsl::span vec_diff_y, - gsl::span vec_diff_z, - gsl::span vec_err_x, - gsl::span vec_err_y, - gsl::span vec_err_z, - gsl::span vec_n_trinmcpv, - gsl::span vec_n_mcpv, - gsl::span vec_mcpv_recd, - gsl::span vec_recpv_fake, - gsl::span vec_mcpv_mult, - gsl::span vec_recpv_mult, - gsl::span vec_mcpv_zpos, - gsl::span vec_mc_x, - gsl::span vec_mc_y, - gsl::span vec_mc_z) + std::span vec_all_rec, + std::span vec_rec_x, + std::span vec_rec_y, + std::span vec_rec_z, + std::span vec_diff_x, + std::span vec_diff_y, + std::span vec_diff_z, + std::span vec_err_x, + std::span vec_err_y, + std::span vec_err_z, + std::span vec_n_trinmcpv, + std::span vec_n_mcpv, + std::span vec_mcpv_recd, + std::span vec_recpv_fake, + std::span vec_mcpv_mult, + std::span vec_recpv_mult, + std::span vec_mcpv_zpos, + std::span vec_mc_x, + std::span vec_mc_y, + std::span vec_mc_z) { // save information about matched reconstructed PVs for pulls distributions for (size_t i = 0; i < vec_diff_x.size(); i++) { diff --git a/checker/pv/src/PrimaryVertexChecker.cpp b/checker/pv/src/PrimaryVertexChecker.cpp index 5c22afb358e..a56abddbe4f 100644 --- a/checker/pv/src/PrimaryVertexChecker.cpp +++ b/checker/pv/src/PrimaryVertexChecker.cpp @@ -19,9 +19,9 @@ PVChecker::PVChecker(CheckerInvoker const* invoker, std::string const& root_file void PVChecker::accumulate( MCEvents const& mc_events, - gsl::span rec_vertex, - gsl::span number_of_vertex, - gsl::span event_list, + std::span rec_vertex, + std::span number_of_vertex, + std::span event_list, const int nTracksToBeRecble) { std::lock_guard guard(m_mutex); diff --git a/checker/selections/include/RateChecker.h b/checker/selections/include/RateChecker.h index 1e3eee0141a..36921da8a38 100644 --- a/checker/selections/include/RateChecker.h +++ b/checker/selections/include/RateChecker.h @@ -38,7 +38,7 @@ private: public: RateChecker(CheckerInvoker const*, std::string const&, std::string const&) { m_tot = 0; } - void accumulate(const char* names_of_lines, gsl::span dec_reports, const unsigned number_of_events); + void accumulate(const char* names_of_lines, std::span dec_reports, const unsigned number_of_events); void report(const size_t requested_events) const override; }; diff --git a/checker/selections/src/RateChecker.cpp b/checker/selections/src/RateChecker.cpp index 6c540f2583b..93305845241 100644 --- a/checker/selections/src/RateChecker.cpp +++ b/checker/selections/src/RateChecker.cpp @@ -16,7 +16,7 @@ double binomial_error(int n, int k) { return 1. / n * std::sqrt(1. * k * (1. - 1 void RateChecker::accumulate( const char* line_names, - gsl::span dec_reports_data, + std::span dec_reports_data, const unsigned number_of_events) { std::lock_guard guard(m_mutex); diff --git a/checker/tracking/include/CompositeDumper.h b/checker/tracking/include/CompositeDumper.h index 9649ef40cb8..64d2693cde7 100644 --- a/checker/tracking/include/CompositeDumper.h +++ b/checker/tracking/include/CompositeDumper.h @@ -70,8 +70,8 @@ public: template void accumulate( MCEvents const& mc_events, - gsl::span tracks, - gsl::span event_list, + std::span tracks, + std::span event_list, FillComposite_t const& fill_composite, FilterComposite_t const& filter_composite = [](const unsigned, const Checker::Composite&, const MatchedComposite_t&) -> bool { return true; }, @@ -157,8 +157,8 @@ namespace { template void CompositeDumper::accumulate( MCEvents const& mc_events, - gsl::span all_composites, - gsl::span event_list, + std::span all_composites, + std::span event_list, FillComposite_t const& fill_composite, FilterComposite_t const& filter_composite, FilterEvent_t const& filter_event) diff --git a/checker/tracking/include/KalmanChecker.h b/checker/tracking/include/KalmanChecker.h index c3515cf50bc..93e1b3e0413 100644 --- a/checker/tracking/include/KalmanChecker.h +++ b/checker/tracking/include/KalmanChecker.h @@ -34,7 +34,7 @@ public: virtual ~KalmanChecker() = default; void - accumulate(MCEvents const& mc_events, gsl::span tracks, gsl::span event_list); + accumulate(MCEvents const& mc_events, std::span tracks, std::span event_list); void report(size_t n_events) const override; diff --git a/checker/tracking/include/PrepareTracks.h b/checker/tracking/include/PrepareTracks.h index 9c937625c1b..d0da0c041ed 100644 --- a/checker/tracking/include/PrepareTracks.h +++ b/checker/tracking/include/PrepareTracks.h @@ -26,54 +26,54 @@ */ std::vector prepareVeloTracks( const unsigned number_of_events, - gsl::span track_atomics, - gsl::span track_hit_number, - gsl::span track_hits, - gsl::span event_list); + std::span track_atomics, + std::span track_hit_number, + std::span track_hits, + std::span event_list); /** * @brief Prepares tracks for Velo, UT consolidated datatypes. */ std::vector prepareUTTracks( const unsigned number_of_events, - gsl::span velo_track_atomics, - gsl::span velo_track_hit_number, - gsl::span velo_track_hits, - gsl::span kalman_velo_states, - gsl::span ut_track_atomics, - gsl::span ut_track_hit_number, - gsl::span ut_track_hits, - gsl::span ut_track_velo_indices, - gsl::span ut_qop, - gsl::span event_list); + std::span velo_track_atomics, + std::span velo_track_hit_number, + std::span velo_track_hits, + std::span kalman_velo_states, + std::span ut_track_atomics, + std::span ut_track_hit_number, + std::span ut_track_hits, + std::span ut_track_velo_indices, + std::span ut_qop, + std::span event_list); std::vector prepareUnmatchedSeedingTracks( const unsigned number_of_events, - gsl::span matched_is_scifi_track_used, - gsl::span scifi_seed_atomics, - gsl::span scifi_seed_hit_number, - gsl::span scifi_seed_hits, - gsl::span scifi_seeds, - gsl::span seeding_states, - gsl::span event_list); + std::span matched_is_scifi_track_used, + std::span scifi_seed_atomics, + std::span scifi_seed_hit_number, + std::span scifi_seed_hits, + std::span scifi_seeds, + std::span seeding_states, + std::span event_list); std::vector prepareSeedingTracks( const unsigned number_of_events, - gsl::span scifi_seed_atomics, - gsl::span scifi_seed_hit_number, - gsl::span scifi_seed_hits, - gsl::span scifi_seeds, - gsl::span seeding_states, - gsl::span event_list); + std::span scifi_seed_atomics, + std::span scifi_seed_hit_number, + std::span scifi_seed_hits, + std::span scifi_seeds, + std::span seeding_states, + std::span event_list); std::vector prepareSeedingTracksXZ( const unsigned number_of_events, - gsl::span scifi_seed_atomics, - gsl::span scifi_seed_hit_number, - gsl::span scifi_hits, - gsl::span scifi_hit_count, - gsl::span scifi_seeds, - gsl::span event_list); + std::span scifi_seed_atomics, + std::span scifi_seed_hit_number, + std::span scifi_hits, + std::span scifi_hit_count, + std::span scifi_seeds, + std::span event_list); /** * @brief Read forward tracks from binary files diff --git a/checker/tracking/include/TrackChecker.h b/checker/tracking/include/TrackChecker.h index 23a78730cc2..08b78957887 100644 --- a/checker/tracking/include/TrackChecker.h +++ b/checker/tracking/include/TrackChecker.h @@ -161,7 +161,7 @@ public: m_histos->write(); } - void accumulate(const MCEvents& mc_events, gsl::span tracks, gsl::span event_list) + void accumulate(const MCEvents& mc_events, std::span tracks, std::span event_list) { auto guard = std::scoped_lock {m_mutex}; for (size_t i = 0; i < event_list.size(); ++i) { diff --git a/checker/tracking/src/KalmanChecker.cpp b/checker/tracking/src/KalmanChecker.cpp index 856aa0f1a9f..33063ad3ecf 100644 --- a/checker/tracking/src/KalmanChecker.cpp +++ b/checker/tracking/src/KalmanChecker.cpp @@ -62,8 +62,8 @@ KalmanChecker::KalmanChecker(CheckerInvoker const* invoker, std::string const& r void KalmanChecker::accumulate( MCEvents const& mc_events, - gsl::span tracks, - gsl::span event_list) + std::span tracks, + std::span event_list) { auto guard = std::scoped_lock {m_mutex}; for (size_t i = 0; i < event_list.size(); ++i) { diff --git a/checker/tracking/src/PrepareTracks.cpp b/checker/tracking/src/PrepareTracks.cpp index 24a5052849b..579e75232ed 100644 --- a/checker/tracking/src/PrepareTracks.cpp +++ b/checker/tracking/src/PrepareTracks.cpp @@ -27,10 +27,10 @@ std::vector prepareVeloTracks( const unsigned number_of_events, - gsl::span track_atomics, - gsl::span track_hit_number, - gsl::span track_hits, - gsl::span event_list) + std::span track_atomics, + std::span track_hit_number, + std::span track_hits, + std::span event_list) { /* Tracks to be checked, save in format for checker */ std::vector checker_tracks(event_list.size()); @@ -61,16 +61,16 @@ std::vector prepareVeloTracks( std::vector prepareUTTracks( const unsigned number_of_events, - gsl::span velo_track_atomics, - gsl::span velo_track_hit_number, - gsl::span velo_track_hits, - gsl::span kalman_velo_states, - gsl::span ut_track_atomics, - gsl::span ut_track_hit_number, - gsl::span ut_track_hits, - gsl::span ut_track_velo_indices, - gsl::span ut_qop, - gsl::span event_list) + std::span velo_track_atomics, + std::span velo_track_hit_number, + std::span velo_track_hits, + std::span kalman_velo_states, + std::span ut_track_atomics, + std::span ut_track_hit_number, + std::span ut_track_hits, + std::span ut_track_velo_indices, + std::span ut_qop, + std::span event_list) { std::vector checker_tracks(event_list.size()); for (unsigned i = 0; i < event_list.size(); i++) { @@ -129,13 +129,13 @@ std::vector prepareUTTracks( std::vector prepareUnmatchedSeedingTracks( const unsigned number_of_events, - gsl::span matched_is_scifi_track_used, - gsl::span scifi_seed_atomics, - gsl::span scifi_seed_hit_number, - gsl::span scifi_seed_hits, - gsl::span scifi_seeds, - gsl::span seeding_states, - gsl::span event_list) + std::span matched_is_scifi_track_used, + std::span scifi_seed_atomics, + std::span scifi_seed_hit_number, + std::span scifi_seed_hits, + std::span scifi_seeds, + std::span seeding_states, + std::span event_list) { /* Tracks to be checked, save in format for checker */ std::vector checker_tracks(event_list.size()); @@ -182,12 +182,12 @@ std::vector prepareUnmatchedSeedingTracks( std::vector prepareSeedingTracks( const unsigned number_of_events, - gsl::span scifi_seed_atomics, - gsl::span scifi_seed_hit_number, - gsl::span scifi_seed_hits, - gsl::span scifi_seeds, // FIXME - gsl::span seeding_states, - gsl::span event_list) + std::span scifi_seed_atomics, + std::span scifi_seed_hit_number, + std::span scifi_seed_hits, + std::span scifi_seeds, // FIXME + std::span seeding_states, + std::span event_list) { /* Tracks to be checked, save in format for checker */ std::vector checker_tracks(event_list.size()); @@ -228,12 +228,12 @@ std::vector prepareSeedingTracks( std::vector prepareSeedingTracksXZ( const unsigned number_of_events, - gsl::span scifi_seed_atomics, - gsl::span scifi_seed_hit_number, - gsl::span raw_scifi_hits, - gsl::span raw_scifi_hit_count, - gsl::span scifi_seeds, // FIXME - gsl::span event_list) + std::span scifi_seed_atomics, + std::span scifi_seed_hit_number, + std::span raw_scifi_hits, + std::span raw_scifi_hit_count, + std::span scifi_seeds, // FIXME + std::span event_list) { /* Tracks to be checked, save in format for checker */ diff --git a/cmake/AllenDependencies.cmake b/cmake/AllenDependencies.cmake index e5e728657b9..49e2b872720 100644 --- a/cmake/AllenDependencies.cmake +++ b/cmake/AllenDependencies.cmake @@ -93,7 +93,6 @@ elseif(TARGET_DEVICE STREQUAL "HIP") message(STATUS "HIP runtime: ${HIP_RUNTIME_LIB}") endif() -find_package(cppgsl REQUIRED) find_package(fmt REQUIRED) # std::filesytem detection diff --git a/cmake/GenerateConfiguration.cmake b/cmake/GenerateConfiguration.cmake index 9592dfcaa44..c0a30f79f28 100644 --- a/cmake/GenerateConfiguration.cmake +++ b/cmake/GenerateConfiguration.cmake @@ -223,7 +223,7 @@ elseif(STANDALONE) add_library(LHCbEvent STATIC ${LHCBOUTPUTS}) target_compile_definitions(LHCbEvent PUBLIC ODIN_WITHOUT_GAUDI) add_dependencies(LHCbEvent checkout_lhcb checkout_gaudi) - target_link_libraries(LHCbEvent PUBLIC ROOT::Core ROOT::MathCore Boost::headers cppgsl::cppgsl) + target_link_libraries(LHCbEvent PUBLIC ROOT::Core ROOT::MathCore Boost::headers) target_include_directories( LHCbEvent PUBLIC diff --git a/cmake/modules/Findcppgsl.cmake b/cmake/modules/Findcppgsl.cmake deleted file mode 100644 index a6749d41216..00000000000 --- a/cmake/modules/Findcppgsl.cmake +++ /dev/null @@ -1,59 +0,0 @@ -##################################################################################### -# (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations # -# # -# This software is distributed under the terms of the Apache version 2 licence, # -# copied verbatim in the file "LICENSE". # -# # -# In applying this licence, CERN does not waive the privileges and immunities # -# granted to it by virtue of its status as an Intergovernmental Organization # -# or submit itself to any jurisdiction. # -##################################################################################### -# Module locating the C++ Guidelines Support Library headers. -# -# Defines: -# - CPPGSL_FOUND -# - CPPGSL_INCLUDE_DIR -# - CPPGSL_INCLUDE_DIRS (not cached) -# -# Imports: -# -# cppgsl::cppgsl -# -# Usage of the target instead of the variables is advised - -# Find quietly if already found before -if(DEFINED CACHE{CPPGSL_INCLUDE_DIR}) - set(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY YES) -endif() - -# Look for the header directory: -find_path(CPPGSL_INCLUDE_DIR - NAMES gsl/gsl - HINTS $ENV{CPPGSL_ROOT_DIR} ${CPPGSL_ROOT_DIR}) -set(CPPGSL_INCLUDE_DIRS ${CPPGSL_INCLUDE_DIR}) - -# Handle the regular find_package arguments: -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(cppgsl DEFAULT_MSG CPPGSL_INCLUDE_DIR) - -# Mark the cached variables as "advanced": -mark_as_advanced(CPPGSL_FOUND CPPGSL_INCLUDE_DIR) - -# Modernisation: create an interface target to link against -if(TARGET cppgsl::cppgsl) - return() -endif() -if(CPPGSL_FOUND) - add_library(cppgsl::cppgsl IMPORTED INTERFACE) - target_include_directories(cppgsl::cppgsl SYSTEM INTERFACE "${CPPGSL_INCLUDE_DIR}") - # Display the imported target for the user to know - if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) - message(STATUS " Import target: cppgsl::cppgsl") - endif() -endif() - -if(COMMAND __deprecate_var_for_target) - foreach(v IN ITEMS CPPGSL_INCLUDE_DIR CPPGSL_INCLUDE_DIRS) - variable_watch(${v} __deprecate_var_for_target) - endforeach() -endif() diff --git a/device/event_model/UT/include/UTUniqueID.cuh b/device/event_model/UT/include/UTUniqueID.cuh index 3632eb6659b..0e4aafdd14f 100644 --- a/device/event_model/UT/include/UTUniqueID.cuh +++ b/device/event_model/UT/include/UTUniqueID.cuh @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include "BackendCommon.h" #include "Logger.h" @@ -113,4 +113,4 @@ get_sector_group_id(const uint32_t& stave, const uint32_t& face, const uint32_t& case 9: return (stave == 0) ? 17 : 7; default: return alpha - 2; } -} \ No newline at end of file +} diff --git a/device/muon/decoding/include/MuonCalculateSRQSize.cuh b/device/muon/decoding/include/MuonCalculateSRQSize.cuh index addcd9380e0..43af362dec3 100644 --- a/device/muon/decoding/include/MuonCalculateSRQSize.cuh +++ b/device/muon/decoding/include/MuonCalculateSRQSize.cuh @@ -14,7 +14,7 @@ #include "MuonDefinitions.cuh" #include "MuonRawToHits.cuh" #include "MuonRaw.cuh" -#include +#include namespace muon_calculate_srq_size { struct Parameters { diff --git a/device/selections/Hlt1/src/DecReporter.cu b/device/selections/Hlt1/src/DecReporter.cu index 5ffb90209ff..1c3e472b04a 100644 --- a/device/selections/Hlt1/src/DecReporter.cu +++ b/device/selections/Hlt1/src/DecReporter.cu @@ -56,7 +56,7 @@ dec_reporter::dec_reporter(dec_reporter::Parameters parameters, unsigned key, un Selections::ConstSelections selections { parameters.dev_selections, parameters.dev_selections_offsets, number_of_events}; - HltDecReports reports(parameters.dev_dec_reports, event_index, parameters.dev_number_of_active_lines[0]); + HltDecReports reports(parameters.dev_dec_reports.get(), event_index, parameters.dev_number_of_active_lines[0]); unsigned* event_selected_candidates_counts = parameters.dev_max_objects_offsets + event_index * parameters.dev_number_of_active_lines[0]; diff --git a/device/selections/Hlt1/src/GlobalDecision.cu b/device/selections/Hlt1/src/GlobalDecision.cu index 15b1f4f4eb9..3c09d4ccdc8 100644 --- a/device/selections/Hlt1/src/GlobalDecision.cu +++ b/device/selections/Hlt1/src/GlobalDecision.cu @@ -41,7 +41,7 @@ __global__ void global_decision::global_decision(global_decision::Parameters par event_index += blockDim.x) { bool global_decision = false; - HltDecReports reports(parameters.dev_dec_reports, event_index); + HltDecReports reports(parameters.dev_dec_reports.get(), event_index); for (HltDecReport dec_report : reports) { global_decision |= dec_report.decision(); diff --git a/device/selections/Hlt1/src/MakeSelectedObjectLists.cu b/device/selections/Hlt1/src/MakeSelectedObjectLists.cu index 9cc5ee154d6..4283f3fc3ce 100644 --- a/device/selections/Hlt1/src/MakeSelectedObjectLists.cu +++ b/device/selections/Hlt1/src/MakeSelectedObjectLists.cu @@ -310,7 +310,7 @@ __global__ void make_selected_object_lists::calc_rb_sizes( { const auto event_number = blockIdx.x; - const HltDecReports dec_reports {parameters.dev_dec_reports, event_number}; + const HltDecReports dec_reports {parameters.dev_dec_reports.get(), event_number}; const unsigned* line_selected_object_offsets = parameters.dev_max_objects_offsets + dec_reports.number_of_lines() * event_number; diff --git a/device/utils/mva_models/src/CatboostDesTree.cu b/device/utils/mva_models/src/CatboostDesTree.cu index 52feace52ff..1c7bcfdfcb8 100644 --- a/device/utils/mva_models/src/CatboostDesTree.cu +++ b/device/utils/mva_models/src/CatboostDesTree.cu @@ -13,14 +13,14 @@ namespace { template - inline void copy_to_data(gsl::span dst, std::vector src, unsigned& offset) + inline void copy_to_data(std::span dst, std::vector src, unsigned& offset) { memcpy(dst.data() + offset, src.data(), sizeof(T) * src.size()); offset += sizeof(T) * src.size(); } template - inline void copy_to_data(gsl::span dst, T src, unsigned& offset) + inline void copy_to_data(std::span dst, T src, unsigned& offset) { *(reinterpret_cast(dst.data() + offset)) = src; offset += sizeof(T); @@ -82,4 +82,4 @@ void Allen::MVAModels::CatboostDT::readData(std::string parameters_path) Allen::malloc((void**) &(m_device_view.m_offsets), host_offsets.size() * sizeof(unsigned)); Allen::memcpy( m_device_view.m_offsets, host_offsets.data(), host_offsets.size() * sizeof(unsigned), Allen::memcpyHostToDevice); -} \ No newline at end of file +} diff --git a/device/utils/scaler/include/DeterministicScaler.cuh b/device/utils/scaler/include/DeterministicScaler.cuh index 985c3fa1119..5952978f8d2 100644 --- a/device/utils/scaler/include/DeterministicScaler.cuh +++ b/device/utils/scaler/include/DeterministicScaler.cuh @@ -55,7 +55,7 @@ namespace { } // mix some 'extra' entropy into 'state' and return result - __host__ __device__ inline uint32_t mix4(uint32_t s, gsl::span a) + __host__ __device__ inline uint32_t mix4(uint32_t s, std::span a) { // FIXME: this _might_ do something different on big endian vs. small endian machines... return mix32(s, uint32_t(a[0]) | uint32_t(a[1]) << 8 | uint32_t(a[2]) << 16 | uint32_t(a[3]) << 24); @@ -73,7 +73,7 @@ namespace { extra.remove_prefix(rem); } for (; !extra.empty(); extra.remove_prefix(4)) - state = mix4(state, gsl::span {extra.substr(0, 4)}); + state = mix4(state, std::span {extra.substr(0, 4)}); return state; } diff --git a/host/data_provider/include/HostDataProvider.h b/host/data_provider/include/HostDataProvider.h index 93ed39fcac8..5348adfd07e 100644 --- a/host/data_provider/include/HostDataProvider.h +++ b/host/data_provider/include/HostDataProvider.h @@ -13,14 +13,14 @@ #include "Common.h" #include "AlgorithmTypes.cuh" #include "InputProvider.h" -#include +#include namespace host_data_provider { struct Parameters { - HOST_OUTPUT(host_raw_banks_t, gsl::span) host_raw_banks; - HOST_OUTPUT(host_raw_offsets_t, gsl::span) host_raw_offsets; - HOST_OUTPUT(host_raw_sizes_t, gsl::span) host_raw_sizes; - HOST_OUTPUT(host_raw_types_t, gsl::span) host_raw_types; + HOST_OUTPUT(host_raw_banks_t, std::span) host_raw_banks; + HOST_OUTPUT(host_raw_offsets_t, std::span) host_raw_offsets; + HOST_OUTPUT(host_raw_sizes_t, std::span) host_raw_sizes; + HOST_OUTPUT(host_raw_types_t, std::span) host_raw_types; HOST_OUTPUT(host_raw_bank_version_t, int) host_raw_bank_version; }; diff --git a/host/data_provider/include/LayoutProvider.h b/host/data_provider/include/LayoutProvider.h index f6d7daa6b2e..0430d0cc9e9 100644 --- a/host/data_provider/include/LayoutProvider.h +++ b/host/data_provider/include/LayoutProvider.h @@ -13,7 +13,7 @@ #include "Common.h" #include "AlgorithmTypes.cuh" #include "InputProvider.h" -#include +#include namespace layout_provider { struct Parameters { diff --git a/host/data_provider/include/MCDataProvider.h b/host/data_provider/include/MCDataProvider.h index 3ad11997ac9..bf06c107d4c 100644 --- a/host/data_provider/include/MCDataProvider.h +++ b/host/data_provider/include/MCDataProvider.h @@ -15,16 +15,16 @@ #include "InputProvider.h" #include "MCEvent.h" #include "MCRaw.h" -#include +#include namespace mc_data_provider { struct Parameters { - HOST_INPUT(host_mc_particle_banks_t, gsl::span) mc_particle_banks; - HOST_INPUT(host_mc_particle_offsets_t, gsl::span) mc_particle_offsets; - HOST_INPUT(host_mc_particle_sizes_t, gsl::span) mc_particle_sizes; - HOST_INPUT(host_mc_pv_banks_t, gsl::span) mc_pv_banks; - HOST_INPUT(host_mc_pv_offsets_t, gsl::span) mc_pv_offsets; - HOST_INPUT(host_mc_pv_sizes_t, gsl::span) mc_pv_sizes; + HOST_INPUT(host_mc_particle_banks_t, std::span) mc_particle_banks; + HOST_INPUT(host_mc_particle_offsets_t, std::span) mc_particle_offsets; + HOST_INPUT(host_mc_particle_sizes_t, std::span) mc_particle_sizes; + HOST_INPUT(host_mc_pv_banks_t, std::span) mc_pv_banks; + HOST_INPUT(host_mc_pv_offsets_t, std::span) mc_pv_offsets; + HOST_INPUT(host_mc_pv_sizes_t, std::span) mc_pv_sizes; HOST_INPUT(host_number_of_events_t, unsigned) host_number_of_events; HOST_INPUT(host_bank_version_t, int) host_bank_version; HOST_OUTPUT(host_mc_events_t, const MCEvents*) host_mc_events; diff --git a/host/data_provider/include/ODINProvider.h b/host/data_provider/include/ODINProvider.h index 1d16cf71b3d..3e5fa20b3eb 100644 --- a/host/data_provider/include/ODINProvider.h +++ b/host/data_provider/include/ODINProvider.h @@ -10,7 +10,7 @@ \*****************************************************************************/ #pragma once -#include +#include #include "Common.h" #include "AlgorithmTypes.cuh" diff --git a/host/error_banks_cut/include/ErrorBankFilter.h b/host/error_banks_cut/include/ErrorBankFilter.h index f2b0671e430..4185495a28e 100644 --- a/host/error_banks_cut/include/ErrorBankFilter.h +++ b/host/error_banks_cut/include/ErrorBankFilter.h @@ -10,7 +10,7 @@ \*****************************************************************************/ #pragma once -#include +#include #include #include "Common.h" diff --git a/host/error_banks_cut/include/HostOdinErrorFilter.h b/host/error_banks_cut/include/HostOdinErrorFilter.h index 5efa0307287..0a2f2289cd7 100644 --- a/host/error_banks_cut/include/HostOdinErrorFilter.h +++ b/host/error_banks_cut/include/HostOdinErrorFilter.h @@ -12,7 +12,7 @@ #include "Common.h" #include "AlgorithmTypes.cuh" -#include +#include #include "InputProvider.h" namespace host_odin_error_filter { diff --git a/host/error_banks_cut/src/ErrorBankFilter.cpp b/host/error_banks_cut/src/ErrorBankFilter.cpp index 59ff17b3520..e5859df952f 100644 --- a/host/error_banks_cut/src/ErrorBankFilter.cpp +++ b/host/error_banks_cut/src/ErrorBankFilter.cpp @@ -241,7 +241,7 @@ void error_bank_filter::error_bank_filter_t::error_bank_filter( auto source_counts = bin_storage.subspan(4 * LHCb::RawBank::types().size(), LHCb::RawBank::types().size()); auto unexpected_counts = bin_storage.subspan(5 * LHCb::RawBank::types().size(), 256); - auto add_counts = [](Gaudi::Accumulators::StaticHistogram<1>& histo, gsl::span counts) { + auto add_counts = [](Gaudi::Accumulators::StaticHistogram<1>& histo, std::span counts) { for (size_t i = 0; i < histo.nBins(0); ++i) { histo[i] += counts[i]; } diff --git a/host/global_event_cut/include/HostSciFiGEC.h b/host/global_event_cut/include/HostSciFiGEC.h index f5966cd26a6..3e2e6fc3b38 100644 --- a/host/global_event_cut/include/HostSciFiGEC.h +++ b/host/global_event_cut/include/HostSciFiGEC.h @@ -15,14 +15,14 @@ #include "Common.h" #include "SciFiRaw.cuh" #include "AlgorithmTypes.cuh" -#include +#include namespace host_scifi_gec { struct Parameters { - HOST_INPUT(host_scifi_raw_banks_t, gsl::span) scifi_banks; - HOST_INPUT(host_scifi_raw_offsets_t, gsl::span) scifi_offsets; - HOST_INPUT(host_scifi_raw_sizes_t, gsl::span) scifi_sizes; - HOST_INPUT(host_scifi_raw_types_t, gsl::span) scifi_types; + HOST_INPUT(host_scifi_raw_banks_t, std::span) scifi_banks; + HOST_INPUT(host_scifi_raw_offsets_t, std::span) scifi_offsets; + HOST_INPUT(host_scifi_raw_sizes_t, std::span) scifi_sizes; + HOST_INPUT(host_scifi_raw_types_t, std::span) scifi_types; HOST_INPUT(host_number_of_events_t, unsigned) host_number_of_events; HOST_OUTPUT(host_output_event_list_t, unsigned) host_output_event_list; HOST_OUTPUT(host_number_of_selected_events_t, unsigned) host_number_of_selected_events; diff --git a/host/global_event_cut/include/HostUTGEC.h b/host/global_event_cut/include/HostUTGEC.h index a78b55e3f12..a4128ea0e0c 100644 --- a/host/global_event_cut/include/HostUTGEC.h +++ b/host/global_event_cut/include/HostUTGEC.h @@ -16,14 +16,14 @@ #include "SciFiRaw.cuh" #include "UTRaw.cuh" #include "AlgorithmTypes.cuh" -#include +#include namespace host_ut_gec { struct Parameters { - HOST_INPUT(host_ut_raw_banks_t, gsl::span) ut_banks; - HOST_INPUT(host_ut_raw_offsets_t, gsl::span) ut_offsets; - HOST_INPUT(host_ut_raw_sizes_t, gsl::span) ut_sizes; - HOST_INPUT(host_ut_raw_types_t, gsl::span) ut_types; + HOST_INPUT(host_ut_raw_banks_t, std::span) ut_banks; + HOST_INPUT(host_ut_raw_offsets_t, std::span) ut_offsets; + HOST_INPUT(host_ut_raw_sizes_t, std::span) ut_sizes; + HOST_INPUT(host_ut_raw_types_t, std::span) ut_types; HOST_INPUT(host_ut_raw_bank_version_t, int) ut_raw_bank_version; HOST_INPUT(host_number_of_events_t, unsigned) host_number_of_events; HOST_OUTPUT(host_output_event_list_t, unsigned) host_output_event_list; diff --git a/host/routing_bits/include/HostRoutingBitsWriter.h b/host/routing_bits/include/HostRoutingBitsWriter.h index 3bf027cc8c6..a33920e4812 100644 --- a/host/routing_bits/include/HostRoutingBitsWriter.h +++ b/host/routing_bits/include/HostRoutingBitsWriter.h @@ -30,7 +30,7 @@ namespace host_routingbits_writer { void host_routingbits_impl( unsigned host_number_of_events, - gsl::span host_dec_reports, + std::span host_dec_reports, unsigned* host_routing_bits, const std::unordered_map>& rb_ids); diff --git a/host/routing_bits/src/HostRoutingBitsWriter.cpp b/host/routing_bits/src/HostRoutingBitsWriter.cpp index 41db1d2a1e8..1bdd2ed56c2 100644 --- a/host/routing_bits/src/HostRoutingBitsWriter.cpp +++ b/host/routing_bits/src/HostRoutingBitsWriter.cpp @@ -67,7 +67,7 @@ void host_routingbits_writer::host_routingbits_writer_t::operator()( void host_routingbits_writer::host_routingbits_impl( unsigned host_number_of_events, - gsl::span host_dec_reports, + std::span host_dec_reports, unsigned* host_routing_bits, const std::unordered_map>& rb_ids) { diff --git a/host/tae/include/HostTAEFilter.h b/host/tae/include/HostTAEFilter.h index 651f6d42f0f..8c767861bb2 100644 --- a/host/tae/include/HostTAEFilter.h +++ b/host/tae/include/HostTAEFilter.h @@ -10,7 +10,7 @@ \*****************************************************************************/ #pragma once -#include +#include #include #include diff --git a/integration/non_event_data/include/Consumers.h b/integration/non_event_data/include/Consumers.h index 4b058ee7f3a..619d9329ab5 100644 --- a/integration/non_event_data/include/Consumers.h +++ b/integration/non_event_data/include/Consumers.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include namespace Consumers { @@ -30,12 +30,12 @@ namespace Consumers { struct BasicGeometry final : public Allen::NonEventData::Consumer { public: - BasicGeometry(gsl::span& dev_geometry); + BasicGeometry(std::span& dev_geometry); void consume(std::vector const& data) override; private: - std::reference_wrapper> m_dev_geometry; + std::reference_wrapper> m_dev_geometry; }; struct VPGeometry final : public Allen::NonEventData::Consumer { @@ -127,12 +127,13 @@ namespace Consumers { struct MagneticFieldPolarity final : public Allen::NonEventData::Consumer { public: - MagneticFieldPolarity(gsl::span&, std::vector&); + MagneticFieldPolarity(std::span&, std::vector&); void consume(std::vector const& data) override; private: - std::reference_wrapper> m_dev_magnet_polarity; + std::reference_wrapper> + m_dev_magnet_polarity; // FIXME: a reference wrapper around a span does not make sense! std::reference_wrapper> m_host_magnet_polarity; }; diff --git a/integration/non_event_data/include/Updater.h b/integration/non_event_data/include/Updater.h index cb784ebf609..2183ee611f6 100644 --- a/integration/non_event_data/include/Updater.h +++ b/integration/non_event_data/include/Updater.h @@ -26,7 +26,7 @@ namespace Allen { Updater(std::map const& options); virtual ~Updater() = default; - void update(gsl::span odin_data) override; + void update(std::span odin_data) override; void registerConsumer(std::string const& id, std::unique_ptr c) override; diff --git a/integration/non_event_data/src/BasicGeometry.cpp b/integration/non_event_data/src/BasicGeometry.cpp index 4418d2ad754..ed2c006f310 100644 --- a/integration/non_event_data/src/BasicGeometry.cpp +++ b/integration/non_event_data/src/BasicGeometry.cpp @@ -34,7 +34,7 @@ void Consumers::RawGeometry::consume(std::vector const& data) Allen::memcpy(m_dev_geometry.get(), data.data(), m_size, Allen::memcpyHostToDevice); } -Consumers::BasicGeometry::BasicGeometry(gsl::span& dev_geometry) : m_dev_geometry {dev_geometry} {} +Consumers::BasicGeometry::BasicGeometry(std::span& dev_geometry) : m_dev_geometry {dev_geometry} {} void Consumers::BasicGeometry::consume(std::vector const& data) { @@ -43,7 +43,7 @@ void Consumers::BasicGeometry::consume(std::vector const& data) // Allocate space char* p = nullptr; Allen::malloc((void**) &p, data.size()); - dev_geometry = gsl::span {p, static_cast>(data.size())}; + dev_geometry = std::span {p, static_cast>(data.size())}; } else if ((size_t) dev_geometry.size() != data.size()) { throw StrException {string {"sizes don't match: "} + to_string(dev_geometry.size()) + " " + to_string(data.size())}; diff --git a/integration/non_event_data/src/MagneticField.cpp b/integration/non_event_data/src/MagneticField.cpp index 0b0873a6ef0..f3f3eb58cf5 100644 --- a/integration/non_event_data/src/MagneticField.cpp +++ b/integration/non_event_data/src/MagneticField.cpp @@ -21,7 +21,7 @@ namespace { } // namespace Consumers::MagneticFieldPolarity::MagneticFieldPolarity( - gsl::span& dev_magnet_polarity, + std::span& dev_magnet_polarity, std::vector& host_magnet_polarity) : m_dev_magnet_polarity {dev_magnet_polarity}, m_host_magnet_polarity {host_magnet_polarity} diff --git a/integration/non_event_data/src/UTBoards.cpp b/integration/non_event_data/src/UTBoards.cpp index 61a8b2beb77..4391852e194 100644 --- a/integration/non_event_data/src/UTBoards.cpp +++ b/integration/non_event_data/src/UTBoards.cpp @@ -67,7 +67,7 @@ void Consumers::UTBoards::initialize(std::vector const& data) using span_type = typename std::remove_reference_t::value_type; value_type* p = nullptr; Allen::malloc((void**) &p, host_data.size() * sizeof(value_type)); - device_data = gsl::span {p, static_cast>(host_data.size())}; + device_data = std::span {p, static_cast>(host_data.size())}; Allen::memcpy( device_data.data(), host_data.data(), host_data.size() * sizeof(value_type), Allen::memcpyHostToDevice); }; diff --git a/integration/non_event_data/src/UTGeometry.cpp b/integration/non_event_data/src/UTGeometry.cpp index 5fa5457e92e..1b6d90e91c5 100644 --- a/integration/non_event_data/src/UTGeometry.cpp +++ b/integration/non_event_data/src/UTGeometry.cpp @@ -77,11 +77,11 @@ namespace { } template - void alloc_and_copy(std::vector& host_data, gsl::span& device_data) + void alloc_and_copy(std::vector& host_data, std::span& device_data) // FIXME: span by & is weird { T* p; Allen::malloc((void**) &p, host_data.size() * sizeof(T)); - device_data = gsl::span {p, host_data.size()}; + device_data = {p, host_data.size()}; Allen::memcpy(device_data.data(), host_data.data(), host_data.size() * sizeof(T), Allen::memcpyHostToDevice); } @@ -102,7 +102,7 @@ void Consumers::UTGeometry::initialize(std::vector const& data) using span_type = typename std::remove_reference_t::value_type; char* g = nullptr; Allen::malloc((void**) &g, data.size()); - dev_ut_geometry = gsl::span {g, static_cast>(data.size())}; + dev_ut_geometry = {g, static_cast>(data.size())}; const ::UTGeometry geometry {data}; // Fill sector to group map diff --git a/integration/non_event_data/src/Updater.cpp b/integration/non_event_data/src/Updater.cpp index 65be48b3e8d..c63b72d4c6b 100644 --- a/integration/non_event_data/src/Updater.cpp +++ b/integration/non_event_data/src/Updater.cpp @@ -102,7 +102,7 @@ namespace Allen { } } - void Updater::update(gsl::span) + void Updater::update(std::span) { for (auto const& entry : m_pairs) { auto const& name = std::get<0>(entry); diff --git a/main/include/BankTypes.h b/main/include/BankTypes.h index 9822b2cc76c..7fe4449295d 100644 --- a/main/include/BankTypes.h +++ b/main/include/BankTypes.h @@ -17,7 +17,7 @@ #include #include #include -#include +#include #include "nlohmann/json.hpp" #include "Common.h" @@ -74,11 +74,11 @@ std::string bank_name(BankTypes type); BankTypes bank_type(std::string bank_name); struct BanksAndOffsets { - std::vector> fragments; - gsl::span offsets; + std::vector> fragments; + std::span offsets; size_t fragments_mem_size = 0; - gsl::span sizes; - gsl::span types; + std::span sizes; + std::span types; int version = -1; }; diff --git a/main/include/Common.h b/main/include/Common.h index 4d03bd1e251..69b59d9e39a 100644 --- a/main/include/Common.h +++ b/main/include/Common.h @@ -16,7 +16,8 @@ #include #include #include -#include +#include +#include #include #include "SystemOfUnits.h" @@ -113,21 +114,11 @@ constexpr auto to_integral(ENUM e) -> typename std::underlying_type::type return static_cast::type>(e); } -using events_span = gsl::span; -using offsets_span = gsl::span; +using events_span = std::span; +using offsets_span = std::span; -// Wrapper around span size to deal with changes between MS GSL 2.5 and 2.6 template -struct span_size { -#if defined(gsl_lite_VERSION) || (GSL_MAJOR_VERSION == 2 && GSL_MINON_VERSION < 6) - using type = typename gsl::span::index_type; -#else - using type = typename gsl::span::size_type; -#endif -}; - -template -using span_size_t = typename span_size::type; +using span_size_t = typename std::span::size_type; using events_size = span_size_t; using offsets_size = span_size_t; diff --git a/main/include/FileWriter.h b/main/include/FileWriter.h index f243c0fd469..78a441ae79b 100644 --- a/main/include/FileWriter.h +++ b/main/include/FileWriter.h @@ -37,10 +37,10 @@ public: } protected: - gsl::span buffer(size_t, size_t buffer_size, size_t) override + std::span buffer(size_t, size_t buffer_size, size_t) override { m_buffer.resize(buffer_size); - return gsl::span {&m_buffer[0], static_cast(buffer_size)}; + return std::span {&m_buffer[0], static_cast(buffer_size)}; } virtual bool write_buffer(size_t) override { return m_output.write(m_buffer.data(), m_buffer.size()); } diff --git a/main/include/InputProvider.h b/main/include/InputProvider.h index 8c768f19db4..61233c17e69 100644 --- a/main/include/InputProvider.h +++ b/main/include/InputProvider.h @@ -17,8 +17,7 @@ #include #include #include - -#include +#include #include @@ -104,10 +103,10 @@ public: virtual void event_sizes( size_t const slice_index, - gsl::span const selected_events, + std::span const selected_events, std::vector& sizes) const = 0; - virtual void copy_banks(size_t const slice_index, unsigned int const event, gsl::span buffer) const = 0; + virtual void copy_banks(size_t const slice_index, unsigned int const event, std::span buffer) const = 0; virtual bool release_buffers() = 0; }; diff --git a/main/include/InputReader.h b/main/include/InputReader.h index 55f97b76e1c..59e1ce6eebf 100644 --- a/main/include/InputReader.h +++ b/main/include/InputReader.h @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include "nlohmann/json.hpp" #include "Configuration.h" diff --git a/main/include/MDFProvider.h b/main/include/MDFProvider.h index e79df7dcfc2..e3579fde011 100644 --- a/main/include/MDFProvider.h +++ b/main/include/MDFProvider.h @@ -159,15 +159,15 @@ public: */ void slice_free(size_t slice_index) override; - gsl::span raw_banks(Allen::ReadBuffer const& buffer, size_t const read_event_start, size_t const event) + std::span raw_banks(Allen::ReadBuffer const& buffer, size_t const read_event_start, size_t const event) const; void event_sizes( size_t const slice_index, - gsl::span const selected_events, + std::span const selected_events, std::vector& sizes) const override; - void copy_banks(size_t const slice_index, unsigned int const event, gsl::span output_buffer) const override; + void copy_banks(size_t const slice_index, unsigned int const event, std::span output_buffer) const override; private: size_t count_writable() const; diff --git a/main/include/OutputHandler.h b/main/include/OutputHandler.h index a984a8345d2..e5cec42b030 100644 --- a/main/include/OutputHandler.h +++ b/main/include/OutputHandler.h @@ -10,10 +10,10 @@ \*****************************************************************************/ #pragma once +#include #include #include -#include #include "InputProvider.h" #include "BankTypes.h" @@ -118,7 +118,7 @@ protected: #endif } - virtual gsl::span buffer(size_t thread_id, size_t buffer_size, size_t n_events) = 0; + virtual std::span buffer(size_t thread_id, size_t buffer_size, size_t n_events) = 0; virtual bool write_buffer(size_t thread_id) = 0; @@ -131,7 +131,7 @@ private: unsigned const start_event); LHCb::MDFHeader* - add_mdf_header(gsl::span event_span, unsigned const run_number, gsl::span routing_bits); + add_mdf_header(std::span event_span, unsigned const run_number, std::span routing_bits); size_t add_banks( Allen::Store::PersistentStore const& store, @@ -139,9 +139,9 @@ private: unsigned const start_event, unsigned const event_number, unsigned const input_size, - gsl::span event_span); + std::span event_span); - void add_checksum(LHCb::MDFHeader* header, gsl::span event_span); + void add_checksum(LHCb::MDFHeader* header, std::span event_span); std::tuple output_single_events( size_t const thread_id, diff --git a/main/include/TESProvider.h b/main/include/TESProvider.h index 1b54a499127..56bc2fa61d8 100644 --- a/main/include/TESProvider.h +++ b/main/include/TESProvider.h @@ -83,7 +83,7 @@ public: // bank content auto data_size = static_cast>(banks.data.size()); - gsl::span b {banks.data.data(), data_size}; + std::span b {banks.data.data(), data_size}; m_banks_and_offsets[i] = {{std::move(b)}, {offsets.data(), 2u}, @@ -132,9 +132,9 @@ public: return {false, false, false, 0, 0, odin}; } - void event_sizes(size_t const, gsl::span const, std::vector&) const override {} + void event_sizes(size_t const, std::span const, std::vector&) const override {} - void copy_banks(size_t const, unsigned int const, gsl::span) const override {} + void copy_banks(size_t const, unsigned int const, std::span) const override {} bool release_buffers() override { return true; } diff --git a/main/include/Transpose.h b/main/include/Transpose.h index ff7c3d0b3e1..63486c4466c 100644 --- a/main/include/Transpose.h +++ b/main/include/Transpose.h @@ -66,7 +66,7 @@ BankTypes sd_from_sourceID(LHCb::RawBank const* raw_bank); * @return true if any of the sourceIDs has a non-zero value in * its 5 most-significant bits */ -bool check_sourceIDs(gsl::span bank_data); +bool check_sourceIDs(std::span bank_data); /** * @brief Use the bank type to source banks; @@ -144,7 +144,7 @@ std::tuple read_events( * @return (success, number of banks per bank type; 0 if the bank is not needed) */ std::tuple> fill_counts( - gsl::span bank_data, + std::span bank_data, Allen::sd_from_raw_bank sd_from_raw_bank, std::unordered_set const& skip_banks); @@ -171,7 +171,7 @@ std::tuple transpose_event( std::array& banks_version, EventIDs& event_ids, std::vector& event_mask, - const gsl::span bank_data, + const std::span bank_data, std::vector& sorted_banks, bool split_by_run); diff --git a/main/include/TransposeTypes.h b/main/include/TransposeTypes.h index 74f5718d366..44c03598572 100644 --- a/main/include/TransposeTypes.h +++ b/main/include/TransposeTypes.h @@ -38,12 +38,12 @@ namespace Allen { using ReadBuffers = std::vector; struct Slice { - std::vector> fragments; - gsl::span offsets; + std::vector> fragments; + std::span offsets; size_t fragments_mem_size = 0; size_t n_offsets = 0; - gsl::span sizes; - gsl::span types; + std::span sizes; + std::span types; }; using BankSlices = std::vector; diff --git a/main/include/ZMQOutputSender.h b/main/include/ZMQOutputSender.h index 7c2e31dc4e8..d5a4cdd4559 100644 --- a/main/include/ZMQOutputSender.h +++ b/main/include/ZMQOutputSender.h @@ -32,7 +32,7 @@ public: void handle() override; protected: - gsl::span buffer(size_t, size_t buffer_size, size_t) override; + std::span buffer(size_t, size_t buffer_size, size_t) override; virtual bool write_buffer(size_t) override; diff --git a/main/src/AllenThreads.cpp b/main/src/AllenThreads.cpp index 00f51bed897..2c0f7b7cf90 100644 --- a/main/src/AllenThreads.cpp +++ b/main/src/AllenThreads.cpp @@ -207,7 +207,7 @@ void run_slices(const size_t thread_id, IZeroMQSvc* zmqSvc, IInputProvider* inpu if (!timed_out && good && n_filled != 0) { // If run number has change then report this first if (a.has_value()) { - auto odin_data = std::any_cast>(a); + auto odin_data = std::any_cast>(a); LHCb::ODIN odin {odin_data}; if (odin.runNumber() == 0) { info_cout << "ODIN run number 0, skipping \n"; diff --git a/main/src/InputReader.cpp b/main/src/InputReader.cpp index f5eba6125ea..6b06521d622 100644 --- a/main/src/InputReader.cpp +++ b/main/src/InputReader.cpp @@ -8,7 +8,7 @@ * granted to it by virtue of its status as an Intergovernmental Organization * * or submit itself to any jurisdiction. * \*****************************************************************************/ -#include +#include #include #include #include "InputTools.h" @@ -189,4 +189,4 @@ bool compatible_configurations(ConfigurationReader const& a, ConfigurationReader auto const& [a, b] = entry; return ranges::equal(views::keys(a.second), views::keys(b.second)); }); -} \ No newline at end of file +} diff --git a/main/src/MDFProvider.cpp b/main/src/MDFProvider.cpp index 13fe19e6d1d..5d0d5695205 100644 --- a/main/src/MDFProvider.cpp +++ b/main/src/MDFProvider.cpp @@ -72,7 +72,7 @@ MDFProvider::MDFProvider( // Offsets are to the start of the event, which includes the header auto i_read = m_prefetched.front(); auto& [n_filled, event_offsets, buffer, transpose_start] = m_buffers[i_read]; - gsl::span const event_span = {buffer.data(), event_offsets[1]}; + std::span const event_span = {buffer.data(), event_offsets[1]}; // Check what type of file we have: old MC or (new MC or data) m_is_mc = check_sourceIDs(event_span); @@ -194,10 +194,10 @@ BanksAndOffsets MDFProvider::banks(BankTypes bank_type, size_t slice_index) cons return bno; } else { - gsl::span b {banks[0].data(), offsets[offsets_size - 1]}; - gsl::span s {slice.sizes.data(), slice.sizes.size()}; - gsl::span o {offsets.data(), static_cast<::offsets_size>(offsets_size)}; - gsl::span t {slice.types.data(), slice.types.size()}; + std::span b {banks[0].data(), offsets[offsets_size - 1]}; + std::span s {slice.sizes.data(), slice.sizes.size()}; + std::span o {offsets.data(), static_cast<::offsets_size>(offsets_size)}; + std::span t {slice.types.data(), slice.types.size()}; return BanksAndOffsets { {std::move(b)}, std::move(o), offsets[offsets_size - 1], std::move(s), std::move(t), version}; } @@ -228,7 +228,7 @@ std::tuple MDFProvider::get_slice(st std::tie(slice_index, n_filled) = m_transposed.front(); m_transposed.pop_front(); if (n_filled > 0) { - odin = gsl::span {m_odins[slice_index].data}; + odin = std::span {m_odins[slice_index].data}; } } } @@ -299,7 +299,7 @@ void MDFProvider::slice_free(size_t slice_index) } } -gsl::span +std::span MDFProvider::raw_banks(Allen::ReadBuffer const& buffer, size_t const read_event_start, size_t const event) const { auto const event_index = event + read_event_start; @@ -325,7 +325,7 @@ MDFProvider::raw_banks(Allen::ReadBuffer const& buffer, size_t const read_event_ void MDFProvider::event_sizes( size_t const slice_index, - gsl::span const selected_events, + std::span const selected_events, std::vector& sizes) const { auto const stb = m_slice_to_buffer[slice_index]; @@ -339,7 +339,7 @@ void MDFProvider::event_sizes( } } -void MDFProvider::copy_banks(size_t const slice_index, unsigned int const event, gsl::span output_buffer) const +void MDFProvider::copy_banks(size_t const slice_index, unsigned int const event, std::span output_buffer) const { // The first bank in the read buffer is the DAQ bank, which // contains the MDF header as bank payload diff --git a/main/src/OutputHandler.cpp b/main/src/OutputHandler.cpp index 0bd656e60e3..91d86a16340 100644 --- a/main/src/OutputHandler.cpp +++ b/main/src/OutputHandler.cpp @@ -42,30 +42,30 @@ struct HLT1Outputs { HLT1Outputs(Allen::Store::PersistentStore const& store); - gsl::span selected_events; - gsl::span dec_reports; - gsl::span lumi_summaries; - gsl::span lumi_summary_offsets; - gsl::span routing_bits; - gsl::span sel_reports; - gsl::span sel_reports_offsets; - gsl::span tae_events; + std::span selected_events; + std::span dec_reports; + std::span lumi_summaries; + std::span lumi_summary_offsets; + std::span routing_bits; + std::span sel_reports; + std::span sel_reports_offsets; + std::span tae_events; }; HLT1Outputs::HLT1Outputs(Allen::Store::PersistentStore const& store) { - selected_events = store.try_at("global_decision__host_global_decision_t").value_or(gsl::span {}); - dec_reports = store.try_at("dec_reporter__host_dec_reports_t").value_or(gsl::span {}); + selected_events = store.try_at("global_decision__host_global_decision_t").value_or(std::span {}); + dec_reports = store.try_at("dec_reporter__host_dec_reports_t").value_or(std::span {}); lumi_summaries = - store.try_at("make_lumi_summary__host_lumi_summaries_t").value_or(gsl::span {}); + store.try_at("make_lumi_summary__host_lumi_summaries_t").value_or(std::span {}); lumi_summary_offsets = - store.try_at("make_lumi_summary__host_lumi_summary_offsets_t").value_or(gsl::span {}); + store.try_at("make_lumi_summary__host_lumi_summary_offsets_t").value_or(std::span {}); routing_bits = - store.try_at("host_routingbits_writer__host_routingbits_t").value_or(gsl::span {}); - sel_reports = store.try_at("make_selreps__host_sel_reports_t").value_or(gsl::span {}); + store.try_at("host_routingbits_writer__host_routingbits_t").value_or(std::span {}); + sel_reports = store.try_at("make_selreps__host_sel_reports_t").value_or(std::span {}); sel_reports_offsets = - store.try_at("make_selreps__host_selrep_offsets_t").value_or(gsl::span {}); - tae_events = store.try_at("tae_filter__host_tae_events_t").value_or(gsl::span {}); + store.try_at("make_selreps__host_selrep_offsets_t").value_or(std::span {}); + tae_events = store.try_at("tae_filter__host_tae_events_t").value_or(std::span {}); if (selected_events.empty()) throw StrException { @@ -102,7 +102,7 @@ std::tuple OutputHandler::output_single_events( // If TAE events should to be output as batches, that's done // separately in output_tae_event, so skip them here - gsl::span tae_events; + std::span tae_events; bool output_tae = !outputs.tae_events.empty(); if (output_tae) { tae_events = outputs.tae_events; @@ -391,9 +391,9 @@ OutputSizes& OutputHandler::event_sizes( } LHCb::MDFHeader* OutputHandler::add_mdf_header( - gsl::span event_span, + std::span event_span, unsigned const run_number, - gsl::span routing_bits) + std::span routing_bits) { auto const header_size = LHCb::MDFHeader::sizeOf(Allen::mdf_header_version); @@ -424,7 +424,7 @@ LHCb::MDFHeader* OutputHandler::add_mdf_header( return header; } -void OutputHandler::add_checksum(LHCb::MDFHeader* header, gsl::span event_span) +void OutputHandler::add_checksum(LHCb::MDFHeader* header, std::span event_span) { if (m_checksum) { auto const skip = 4 * sizeof(int); @@ -443,7 +443,7 @@ size_t OutputHandler::add_banks( unsigned const start_event, unsigned const event_number, unsigned const input_size, - gsl::span event_span) + std::span event_span) { HLT1Outputs outputs {store}; @@ -476,7 +476,7 @@ size_t OutputHandler::add_banks( 0 : (outputs.lumi_summary_offsets[event_number + 1] - lumi_summary_offset) * sizeof(uint32_t); - using output_bank = std::tuple>; + using output_bank = std::tuple>; auto hlt_banks = std::make_tuple( // HltDecReports output_bank { @@ -505,7 +505,7 @@ size_t OutputHandler::add_banks( LHCb::RawBank::BankType bank_type, unsigned version, unsigned source_id, - gsl::span data, + std::span data, char* output) -> size_t { // add the dec report return data.empty() ? 0u : Allen::add_raw_bank(bank_type, version, source_id, data, output); diff --git a/main/src/SliceUtils.cpp b/main/src/SliceUtils.cpp index 5289322726a..3031d326af8 100644 --- a/main/src/SliceUtils.cpp +++ b/main/src/SliceUtils.cpp @@ -87,7 +87,7 @@ Allen::Slices allocate_slices( sizes_mem[i] = 0; types_mem[i] = 0; } - std::vector> bank_spans {}; + std::vector> bank_spans {}; if (n_bytes) { bank_spans.emplace_back(events_mem, n_bytes); } @@ -109,7 +109,7 @@ void free_slices(Allen::Slices& slices) for (auto& slice : bank_slices) { if (!slice.fragments.empty() && !slice.fragments[0].empty()) { Allen::free_host(slice.fragments[0].data()); - slice.fragments[0] = gsl::span {}; + slice.fragments[0] = std::span {}; } if (!slice.offsets.empty()) { Allen::free_host(slice.offsets.data()); diff --git a/main/src/Transpose.cpp b/main/src/Transpose.cpp index 2e03febc452..7158b42c5e6 100644 --- a/main/src/Transpose.cpp +++ b/main/src/Transpose.cpp @@ -46,7 +46,7 @@ std::array Allen::bank_ids() * @return true if any of the sourceIDs has a non-zero value in * its 5 most-significant bits */ -bool check_sourceIDs(gsl::span bank_data) +bool check_sourceIDs(std::span bank_data) { auto const* bank = bank_data.data(); @@ -137,7 +137,7 @@ std::tuple read_events( // Keep track of where to write and the end of the prefetch buffer size_t n_bytes = 0; bool eof = false, error = false; - gsl::span bank_span; + std::span bank_span; // Loop until the requested number of events is prefetched, the // maximum number of events per prefetch buffer is hit, an error @@ -148,7 +148,7 @@ std::tuple read_events( // Read the banks auto const buffer_offset = event_offsets[n_filled]; assert(buffer_offset < buffer.size()); - gsl::span buffer_span {buffer_start + buffer_offset, static_cast(buffer.size() - buffer_offset)}; + std::span buffer_span {buffer_start + buffer_offset, static_cast(buffer.size() - buffer_offset)}; std::tie(eof, error, bank_span) = MDF::read_banks(input, header, std::move(buffer_span), compress_buffer, check_checksum); if (eof || error) break; @@ -231,7 +231,7 @@ std::tuple read_events( * @return (success, number of banks per bank type; 0 if the bank is not needed) */ std::tuple> fill_counts( - gsl::span bank_data, + std::span bank_data, Allen::sd_from_raw_bank sd_from_raw_bank, std::unordered_set const& skip_banks) { @@ -272,7 +272,7 @@ std::tuple transpose_event( std::array& banks_version, EventIDs& event_ids, std::vector& event_mask, - const gsl::span bank_data, + const std::span bank_data, std::vector& sorted_banks, bool split_by_run) { diff --git a/main/src/ZMQOutputSender.cpp b/main/src/ZMQOutputSender.cpp index c5c18756fdb..5bda7df01a1 100644 --- a/main/src/ZMQOutputSender.cpp +++ b/main/src/ZMQOutputSender.cpp @@ -109,10 +109,10 @@ void ZMQOutputSender::handle() } } -gsl::span ZMQOutputSender::buffer(size_t, size_t buffer_size, size_t) +std::span ZMQOutputSender::buffer(size_t, size_t buffer_size, size_t) { m_buffer.rebuild(buffer_size); - return gsl::span {static_cast(m_buffer.data()), static_cast(buffer_size)}; + return std::span {static_cast(m_buffer.data()), static_cast(buffer_size)}; } bool ZMQOutputSender::write_buffer(size_t) diff --git a/mdf/include/eb_header.hpp b/mdf/include/eb_header.hpp index f42ad0067b2..00f2f872b5b 100644 --- a/mdf/include/eb_header.hpp +++ b/mdf/include/eb_header.hpp @@ -11,7 +11,7 @@ #pragma once #include -#include +#include #include namespace EB { @@ -25,20 +25,20 @@ namespace EB { } template - gsl::span make_span(uint16_t nf, char const*& d) + std::span make_span(uint16_t nf, char const*& d) { - gsl::span s {const_cast(reinterpret_cast(d)), padded_size(nf)}; + std::span s {const_cast(reinterpret_cast(d)), padded_size(nf)}; d += s.size_bytes(); return s; } template - void resize(uint16_t nf, std::vector& cont, gsl::span& view) + void resize(uint16_t nf, std::vector& cont, std::span& view) { auto size = padded_size(nf); cont.resize(size); cont.assign(size, 0); - view = gsl::span {&cont[0], static_cast>(size)}; + view = std::span {&cont[0], static_cast>(size)}; } } // namespace detail @@ -85,9 +85,9 @@ namespace EB { uint32_t reserved = 0; uint64_t mep_size = 0; - gsl::span source_ids; - gsl::span versions; - gsl::span offsets; + std::span source_ids; + std::span versions; + std::span offsets; static uint32_t base_size() { @@ -149,8 +149,8 @@ namespace EB { uint16_t n_frag = 0; uint16_t reserved = 0; uint32_t block_size = 0; - gsl::span types; - gsl::span sizes; + std::span types; + std::span sizes; static uint32_t header_size(uint16_t nf) { diff --git a/mdf/include/read_mdf.hpp b/mdf/include/read_mdf.hpp index 6d89617bb3b..d8e4f2e8c52 100644 --- a/mdf/include/read_mdf.hpp +++ b/mdf/include/read_mdf.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -24,8 +25,6 @@ #include "BankMapping.h" #include "AllenIO.h" -#include - #include #include "Event/ODIN.h" @@ -47,22 +46,22 @@ namespace MDF { void dump_hex(const char* start, int size, std::ostream& out = std::cout); - std::tuple>>> read_event( + std::tuple>>> read_event( Allen::IO& input, LHCb::MDFHeader& h, - gsl::span buffer, + std::span buffer, std::vector& decompression_buffer, bool checkChecksum = true, bool dbg = false); - std::tuple> read_banks( + std::tuple> read_banks( Allen::IO& input, const LHCb::MDFHeader& h, - gsl::span buffer, + std::span buffer, std::vector& decompression_buffer, bool checkChecksum = true, bool dbg = false); - LHCb::ODIN decode_odin(gsl::span data, unsigned const version); + LHCb::ODIN decode_odin(std::span data, unsigned const version); } // namespace MDF diff --git a/mdf/include/write_mdf.hpp b/mdf/include/write_mdf.hpp index a3bef1dd3ec..782e618cdc9 100644 --- a/mdf/include/write_mdf.hpp +++ b/mdf/include/write_mdf.hpp @@ -10,7 +10,7 @@ \*****************************************************************************/ #pragma once -#include +#include namespace Allen { constexpr int mdf_header_version = 3; @@ -25,6 +25,6 @@ namespace Allen { unsigned char const type, unsigned char const version, short const sourceID, - gsl::span fragment, + std::span fragment, char* buffer); } // namespace Allen diff --git a/mdf/src/read_mdf.cpp b/mdf/src/read_mdf.cpp index 974ccc06c24..3648afe8e5e 100644 --- a/mdf/src/read_mdf.cpp +++ b/mdf/src/read_mdf.cpp @@ -29,12 +29,12 @@ #include "root_mdf.hpp" namespace { - using gsl::span; using std::array; using std::cerr; using std::cout; using std::ifstream; using std::make_tuple; + using std::span; using std::vector; } // namespace @@ -63,10 +63,10 @@ Allen::IO MDF::open(std::string const& filepath, int flags, int mode) } // return eof, error, span that covers all banks in the event -std::tuple>>> MDF::read_event( +std::tuple>>> MDF::read_event( Allen::IO& input, LHCb::MDFHeader& h, - gsl::span buffer, + std::span buffer, std::vector& decompression_buffer, bool checkChecksum, bool dbg) @@ -104,7 +104,7 @@ std::tuple>>> MDF: int offset = *block++; int size = *block++; events.emplace_back( - bx, gsl::span {payload + offset, static_cast::size_type>(size)}); + bx, std::span {payload + offset, static_cast::size_type>(size)}); } assert(events.size() == n_blocks); return {eof, error, events}; @@ -121,10 +121,10 @@ std::tuple>>> MDF: } // return eof, error, span that covers all banks in the event -std::tuple> MDF::read_banks( +std::tuple> MDF::read_banks( Allen::IO& input, const LHCb::MDFHeader& h, - gsl::span buffer, + std::span buffer, std::vector& decompression_buffer, bool checkChecksum, bool dbg) @@ -252,7 +252,7 @@ std::tuple> MDF::read_banks( } // Decode the ODIN bank -LHCb::ODIN MDF::decode_odin(gsl::span data, unsigned const version) +LHCb::ODIN MDF::decode_odin(std::span data, unsigned const version) { // we just assume the buffer has the right size and cross fingers. // note that we only support the default bank version in Allen diff --git a/mdf/src/write_mdf.cpp b/mdf/src/write_mdf.cpp index 0006a7872a4..e0df0e3b5d4 100644 --- a/mdf/src/write_mdf.cpp +++ b/mdf/src/write_mdf.cpp @@ -17,7 +17,7 @@ size_t Allen::add_raw_bank( unsigned char const type, unsigned char const version, short const sourceID, - gsl::span fragment, + std::span fragment, char* buffer) { auto* bank = reinterpret_cast(buffer); diff --git a/mdf/test/bench_read.cpp b/mdf/test/bench_read.cpp index 95eab0ee419..965a3ec5ce7 100644 --- a/mdf/test/bench_read.cpp +++ b/mdf/test/bench_read.cpp @@ -66,7 +66,7 @@ int main(int argc, char* argv[]) while (true) { - gsl::span buffer_span {buffer.data() + offset, static_cast<::events_size>(buffer.size() - offset)}; + std::span buffer_span {buffer.data() + offset, static_cast<::events_size>(buffer.size() - offset)}; ++n_filled; auto [eof, error, event_span] = MDF::read_event(input, header, buffer_span, decompression_buffer, false); @@ -75,7 +75,7 @@ int main(int argc, char* argv[]) break; } size_t event_size = std::accumulate( - event_span.begin(), event_span.end(), 0u, [](size_t s, std::tuple> e) { + event_span.begin(), event_span.end(), 0u, [](size_t s, std::tuple> e) { return s + std::get<1>(e).size() + LHCb::MDFHeader::sizeOf(3); }); n_bytes += event_size; diff --git a/mdf/test/bench_transpose.cpp b/mdf/test/bench_transpose.cpp index d2383f6191e..eda637dd650 100644 --- a/mdf/test/bench_transpose.cpp +++ b/mdf/test/bench_transpose.cpp @@ -126,7 +126,7 @@ int main(int argc, char* argv[]) return static_cast(bank_ids[raw_bank->type()]); }; - gsl::span bank_data {read_buffer.data(), event_offsets[1]}; + std::span bank_data {read_buffer.data(), event_offsets[1]}; auto is_mc = check_sourceIDs(bank_data); Allen::sd_from_raw_bank sd_from_raw; Allen::bank_sorter bank_sorter; diff --git a/mdf/test/bench_transpose_mep.cpp b/mdf/test/bench_transpose_mep.cpp index 19117a8219b..7596718f3b4 100644 --- a/mdf/test/bench_transpose_mep.cpp +++ b/mdf/test/bench_transpose_mep.cpp @@ -19,7 +19,7 @@ #include #include -#include +#include #include #include #include @@ -54,7 +54,7 @@ int main(int argc, char* argv[]) } // Allocate read buffer space - vector, EB::Header, gsl::span, MEP::Blocks, MEP::SourceOffsets>> mep_buffers { + vector, EB::Header, std::span, MEP::Blocks, MEP::SourceOffsets>> mep_buffers { n_slices}; // Bank ID translation diff --git a/mdf/test/test_mep_banks.cpp b/mdf/test/test_mep_banks.cpp index bc3e3bbe124..baf9da01b65 100644 --- a/mdf/test/test_mep_banks.cpp +++ b/mdf/test/test_mep_banks.cpp @@ -87,7 +87,7 @@ namespace { namespace Allen { unsigned - number_of_banks(gsl::span allen_banks, gsl::span allen_offsets, unsigned const i_event) + number_of_banks(std::span allen_banks, std::span allen_offsets, unsigned const i_event) { return reinterpret_cast(allen_banks.data() + allen_offsets[i_event])[0]; } @@ -259,14 +259,14 @@ template struct compare { void operator()( const int, - gsl::span mep_fragments, - gsl::span mep_offsets, - gsl::span mep_sizes, - gsl::span mep_types, - gsl::span allen_banks, - gsl::span allen_offsets, - gsl::span allen_sizes, - gsl::span allen_types, + std::span mep_fragments, + std::span mep_offsets, + std::span mep_sizes, + std::span mep_types, + std::span allen_banks, + std::span allen_offsets, + std::span allen_sizes, + std::span allen_types, unsigned const i_event) { @@ -301,14 +301,14 @@ template struct compare { void operator()( const int, - gsl::span mep_fragments, - gsl::span mep_offsets, - gsl::span mep_sizes, - gsl::span mep_types, - gsl::span allen_banks, - gsl::span allen_offsets, - gsl::span allen_sizes, - gsl::span allen_types, + std::span mep_fragments, + std::span mep_offsets, + std::span mep_sizes, + std::span mep_types, + std::span allen_banks, + std::span allen_offsets, + std::span allen_sizes, + std::span allen_types, unsigned const i_event) { const auto allen_bank = odin_bank(allen_banks.data(), allen_offsets.data(), allen_sizes.data(), i_event); @@ -340,14 +340,14 @@ template struct compare { void operator()( const int, - gsl::span mep_fragments, - gsl::span mep_offsets, - gsl::span mep_sizes, - gsl::span mep_types, - gsl::span allen_banks, - gsl::span allen_offsets, - gsl::span allen_sizes, - gsl::span allen_types, + std::span mep_fragments, + std::span mep_offsets, + std::span mep_sizes, + std::span mep_types, + std::span allen_banks, + std::span allen_offsets, + std::span allen_sizes, + std::span allen_types, unsigned const i_event) { const auto allen_raw_event = Velo::RawEvent<4, false>( @@ -377,14 +377,14 @@ template struct compare { void operator()( const int version, - gsl::span mep_fragments, - gsl::span mep_offsets, - gsl::span mep_sizes, - gsl::span mep_types, - gsl::span allen_banks, - gsl::span allen_offsets, - gsl::span allen_sizes, - gsl::span allen_types, + std::span mep_fragments, + std::span mep_offsets, + std::span mep_sizes, + std::span mep_types, + std::span allen_banks, + std::span allen_offsets, + std::span allen_sizes, + std::span allen_types, unsigned const i_event) { const auto allen_raw_event = @@ -434,14 +434,14 @@ template struct compare { void operator()( const int, - gsl::span mep_fragments, - gsl::span mep_offsets, - gsl::span mep_sizes, - gsl::span mep_types, - gsl::span allen_banks, - gsl::span allen_offsets, - gsl::span allen_sizes, - gsl::span allen_types, + std::span mep_fragments, + std::span mep_offsets, + std::span mep_sizes, + std::span mep_types, + std::span allen_banks, + std::span allen_offsets, + std::span allen_sizes, + std::span allen_types, unsigned const i_event) { const auto allen_raw_event = @@ -475,14 +475,14 @@ template struct compare { void operator()( const int, - gsl::span mep_fragments, - gsl::span mep_offsets, - gsl::span mep_sizes, - gsl::span mep_types, - gsl::span allen_banks, - gsl::span allen_offsets, - gsl::span allen_sizes, - gsl::span allen_types, + std::span mep_fragments, + std::span mep_offsets, + std::span mep_sizes, + std::span mep_types, + std::span allen_banks, + std::span allen_offsets, + std::span allen_sizes, + std::span allen_types, unsigned const i_event) { diff --git a/mdf/test/test_read.cpp b/mdf/test/test_read.cpp index 561f5f13e74..85dc7f4b030 100644 --- a/mdf/test/test_read.cpp +++ b/mdf/test/test_read.cpp @@ -94,7 +94,7 @@ int main(int argc, char* argv[]) bool eof = false, error = false; - std::vector>> event_span; + std::vector>> event_span; auto input = MDF::open(filename.c_str(), O_RDONLY); if (input.good) { diff --git a/stream/sequence/include/Constants.cuh b/stream/sequence/include/Constants.cuh index 9abbc552dbe..df9da96e337 100644 --- a/stream/sequence/include/Constants.cuh +++ b/stream/sequence/include/Constants.cuh @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include #include "BackendCommon.h" #include "Logger.h" @@ -76,11 +76,11 @@ struct Constants { std::vector host_ut_board_to_sector_group_map; std::vector host_ut_sector_to_group_map; - gsl::span dev_ut_geometry; - gsl::span dev_ut_boards; - gsl::span dev_ut_board_geometry_map; - gsl::span dev_ut_board_to_sector_group_map; - gsl::span dev_ut_sector_to_group_map; + std::span dev_ut_geometry; + std::span dev_ut_boards; + std::span dev_ut_board_geometry_map; + std::span dev_ut_board_to_sector_group_map; + std::span dev_ut_sector_to_group_map; UTMagnetTool* dev_ut_magnet_tool = nullptr; @@ -100,7 +100,7 @@ struct Constants { std::vector host_gen_crossing_angles; // Magnet polarity - gsl::span dev_magnet_polarity; + std::span dev_magnet_polarity; std::vector host_magnet_polarity; // Magnetic field diff --git a/stream/sequence/include/HostBuffersManager.cuh b/stream/sequence/include/HostBuffersManager.cuh index bfb6a3d2c2e..dc709ef982f 100644 --- a/stream/sequence/include/HostBuffersManager.cuh +++ b/stream/sequence/include/HostBuffersManager.cuh @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include diff --git a/stream/store/include/AllenBuffer.cuh b/stream/store/include/AllenBuffer.cuh index e47f3ad43f5..d239f4b4ab9 100644 --- a/stream/store/include/AllenBuffer.cuh +++ b/stream/store/include/AllenBuffer.cuh @@ -11,7 +11,7 @@ #pragma once #include -#include +#include #include namespace Allen { @@ -26,7 +26,7 @@ namespace Allen { private: Allen::Store::memory_manager_t* m_mem_manager = nullptr; const std::string m_tag = ""; - gsl::span m_span {}; + std::span m_span {}; bool m_allocated = false; public: @@ -56,10 +56,10 @@ namespace Allen { m_mem_manager->free(m_tag); } m_allocated = true; - m_span = gsl::span {reinterpret_cast(m_mem_manager->reserve(m_tag, size * sizeof(T))), size}; + m_span = std::span {reinterpret_cast(m_mem_manager->reserve(m_tag, size * sizeof(T))), size}; } - __host__ gsl::span get() { return m_span; } - __host__ gsl::span get() const { return m_span; } + __host__ std::span get() { return m_span; } + __host__ std::span get() const { return m_span; } }; /** @@ -76,7 +76,7 @@ namespace Allen { __host__ nonstandalone_buffer(size_t size) : m_vector(size) {} __host__ nonstandalone_buffer(nonstandalone_buffer&& o) : m_vector {std::move(o.m_vector)} {} __host__ void resize(size_t size) { m_vector.resize(size); } - __host__ gsl::span get() + __host__ std::span get() { if constexpr (std::is_same_v, bool>) { return {Allen::forward_type_t(m_vector.data()), m_vector.size()}; @@ -85,7 +85,7 @@ namespace Allen { return m_vector; } } - __host__ gsl::span get() const + __host__ std::span get() const { if constexpr (std::is_same_v, bool>) { return {Allen::forward_type_t(m_vector.data()), m_vector.size()}; @@ -109,7 +109,7 @@ namespace Allen { struct buffer { private: std::variant, details::nonstandalone_buffer> m_buffer; - gsl::span m_span; + std::span m_span; public: __host__ buffer(Allen::Store::memory_manager_t& mem_manager, const std::string& tag) : @@ -138,8 +138,8 @@ namespace Allen { }, m_buffer); } - constexpr __host__ gsl::span get() { return m_span; } - constexpr __host__ gsl::span get() const { return m_span; } + constexpr __host__ std::span get() { return m_span; } + constexpr __host__ std::span get() const { return m_span; } constexpr __host__ auto begin() const { static_assert(S == Allen::Store::Scope::Host); @@ -164,7 +164,7 @@ namespace Allen { static_assert(S == Allen::Store::Scope::Host); return get()[i]; } - constexpr __host__ operator gsl::span() { return get(); } + constexpr __host__ operator std::span() { return get(); } constexpr __host__ auto operator-> () const { return data(); } constexpr __host__ operator T*() const { return data(); } constexpr __host__ auto empty() const { return m_span.empty(); } diff --git a/stream/store/include/Argument.cuh b/stream/store/include/Argument.cuh index 659649618e1..d6aff32d088 100644 --- a/stream/store/include/Argument.cuh +++ b/stream/store/include/Argument.cuh @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include namespace Allen::Store { @@ -57,13 +57,13 @@ namespace Allen::Store { size_t size_bytes() const { return size() * m_type_size; } template - operator gsl::span() + operator std::span() { return {cast(), size()}; } template - operator gsl::span() const + operator std::span() const { return {cast(), size()}; } diff --git a/stream/store/include/ArgumentOps.cuh b/stream/store/include/ArgumentOps.cuh index 754af988ff7..3b05002c714 100644 --- a/stream/store/include/ArgumentOps.cuh +++ b/stream/store/include/ArgumentOps.cuh @@ -11,7 +11,7 @@ #pragma once #include -#include +#include #include "BankTypes.h" #include "BackendCommon.h" #include "AllenTypeTraits.h" @@ -28,8 +28,8 @@ namespace Allen { */ template void copy_async( - gsl::span container_a, - gsl::span container_b, + std::span container_a, + std::span container_b, const Allen::Context& context, const Allen::memcpy_kind kind, const size_t count = 0, @@ -90,8 +90,8 @@ namespace Allen { */ template void copy( - gsl::span container_a, - gsl::span container_b, + std::span container_a, + std::span container_b, const Allen::Context& context, const Allen::memcpy_kind kind, const size_t count = 0, @@ -221,7 +221,7 @@ namespace Allen { void data_to_device(ARGUMENTS const& args, BanksAndOffsets const& bno, const Allen::Context& context) { auto offset = args.template data(); - for (gsl::span data_span : bno.fragments) { + for (std::span data_span : bno.fragments) { Allen::memcpy_async(offset, data_span.data(), data_span.size_bytes(), Allen::memcpyHostToDevice, context); offset += data_span.size_bytes(); } diff --git a/stream/store/include/InputAggregate.cuh b/stream/store/include/InputAggregate.cuh index a9dca05ada3..d08c154e057 100644 --- a/stream/store/include/InputAggregate.cuh +++ b/stream/store/include/InputAggregate.cuh @@ -11,7 +11,7 @@ #pragma once #include -#include +#include #include #include #include @@ -43,7 +43,7 @@ namespace Allen::Store { InputAggregate(Tuple t, std::index_sequence) : m_argument_data_v {std::get(t)...} {} - gsl::span get(const unsigned index) const + std::span get(const unsigned index) const { assert(index < m_argument_data_v.size() && "Index is in bounds"); return m_argument_data_v[index].get(); diff --git a/stream/store/include/Store.cuh b/stream/store/include/Store.cuh index d87ad3cc5c0..685881ac358 100644 --- a/stream/store/include/Store.cuh +++ b/stream/store/include/Store.cuh @@ -11,7 +11,7 @@ #pragma once #include -#include +#include #include #include #include @@ -73,16 +73,17 @@ namespace Allen::Store { } template - std::optional> try_at(const std::string& k) const + std::optional> try_at(const std::string& k) const { auto i = m_store.find(k); if (i == end(m_store)) return std::nullopt; - return static_cast>(i->second); + return static_cast>(i->second); } template void inject(const std::string& k, const std::vector& value) { + static_assert(std::is_trivially_copyable_v); Allen::Store::AllenArgument arg {std::in_place_type, k, Allen::Store::Scope::Host}; arg.set_size(value.size()); reserve(arg); @@ -90,7 +91,7 @@ namespace Allen::Store { if (!ok) { throw std::runtime_error("store register_entry failed, entry already exists"); } - gsl::span arg_span = arg; + std::span arg_span = arg; std::memcpy(arg_span.data(), value.data(), value.size() * sizeof(T)); } @@ -103,7 +104,7 @@ namespace Allen::Store { if (!ok) { throw std::runtime_error("store register_entry failed, entry already exists"); } - gsl::span arg_span = arg; + std::span arg_span = arg; for (auto i = 0u; i < value.size(); ++i) { arg_span[i] = value[i]; } @@ -306,7 +307,7 @@ namespace Allen::Store { } template - gsl::span get() const + std::span get() const { return arg(); } diff --git a/zmq/test/mdf_sender.cpp b/zmq/test/mdf_sender.cpp index 5e827ba6e16..e57db61fefc 100644 --- a/zmq/test/mdf_sender.cpp +++ b/zmq/test/mdf_sender.cpp @@ -84,7 +84,7 @@ int main(int argc, char* argv[]) bool eof = false, error = false; - std::vector>> event_span; + std::vector>> event_span; auto input = MDF::open(filename.c_str(), O_RDONLY); if (input.good) { -- GitLab From 09c34b1121fc7ff717219567212cdd9b87eeb673 Mon Sep 17 00:00:00 2001 From: Gerhard Raven Date: Wed, 17 Sep 2025 13:39:20 +0200 Subject: [PATCH 2/3] Decouple the version of span used in Allen from the one used in LHCb - add some migration scaffolding to adapt automatically if different versions of span are used; this must be removed again _after_ the migration is completed in both projects - add back an explicit dependency on cppgsl to allow standalone Allen to build against an LHCb version which requires gsl --- CMakeLists.txt | 2 +- .../BinaryDumpers/include/Dumpers/IUpdater.h | 1 + Dumpers/BinaryDumpers/include/Dumpers/Utils.h | 3 +- Dumpers/BinaryDumpers/src/PVDumper.cpp | 1 - Rec/Allen/src/GaudiAllenReportsToRawEvent.cpp | 12 +++- cmake/AllenDependencies.cmake | 1 + cmake/GenerateConfiguration.cmake | 2 +- cmake/modules/Findcppgsl.cmake | 59 +++++++++++++++++++ mdf/include/read_mdf.hpp | 7 +++ 9 files changed, 83 insertions(+), 5 deletions(-) create mode 100644 cmake/modules/Findcppgsl.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 6da1089edb5..f0738cd2dbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -699,7 +699,7 @@ allen_add_host_library(HostCommon SHARED main/src/Transpose.cpp) target_link_libraries(AllenCommon INTERFACE - LHCbEvent AllenFS nlohmann_json::nlohmann_json fmt::fmt) + LHCbEvent AllenFS nlohmann_json::nlohmann_json cppgsl::cppgsl fmt::fmt) target_link_libraries(HostCommon PRIVATE mdf EventModel Gear Backend mdf AllenCommon LHCbEvent Boost::iostreams Rangev3::rangev3) diff --git a/Dumpers/BinaryDumpers/include/Dumpers/IUpdater.h b/Dumpers/BinaryDumpers/include/Dumpers/IUpdater.h index 70f19f66536..3ded73324de 100644 --- a/Dumpers/BinaryDumpers/include/Dumpers/IUpdater.h +++ b/Dumpers/BinaryDumpers/include/Dumpers/IUpdater.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include diff --git a/Dumpers/BinaryDumpers/include/Dumpers/Utils.h b/Dumpers/BinaryDumpers/include/Dumpers/Utils.h index 03bed0cf120..e1b09dc61ca 100644 --- a/Dumpers/BinaryDumpers/include/Dumpers/Utils.h +++ b/Dumpers/BinaryDumpers/include/Dumpers/Utils.h @@ -58,7 +58,8 @@ namespace DumpUtils { } else { static_assert(std::is_trivially_copyable_v); - return write(os, std::as_bytes(LHCb::make_span(t))); + using std::as_bytes; + return write(os, as_bytes(LHCb::make_span(t))); } } diff --git a/Dumpers/BinaryDumpers/src/PVDumper.cpp b/Dumpers/BinaryDumpers/src/PVDumper.cpp index f7853ec86dd..b58fdbbccfc 100644 --- a/Dumpers/BinaryDumpers/src/PVDumper.cpp +++ b/Dumpers/BinaryDumpers/src/PVDumper.cpp @@ -118,4 +118,3 @@ std::tuple PVDumper::operator()( return viewFromRawEvent(std::move(rawEvent), m_bankType); } - diff --git a/Rec/Allen/src/GaudiAllenReportsToRawEvent.cpp b/Rec/Allen/src/GaudiAllenReportsToRawEvent.cpp index 6645fd1d5fd..bc7faf71bec 100644 --- a/Rec/Allen/src/GaudiAllenReportsToRawEvent.cpp +++ b/Rec/Allen/src/GaudiAllenReportsToRawEvent.cpp @@ -17,6 +17,16 @@ #include "HltConstants.cuh" #include +namespace { + // temporary migration hack to decouple the version of span used in Allen + // from the span used in LHCb + template + auto convert_(T const& s) + { + return LHCb::make_span(s.data(), s.size()); + } +} // namespace + class GaudiAllenReportsToRawEvent : public LHCb::Algorithm::MultiTransformer< std::tuple( @@ -61,7 +71,7 @@ public: Hlt1::Constants::sourceID, LHCb::RawBank::BankType::HltDecReports, dec_reports.version(), - dec_reports.bank_data()); + convert_(dec_reports.bank_data())); raw_event.addBank(Hlt1::Constants::sourceID, LHCb::RawBank::BankType::HltRoutingBits, 0u, routing_bits); return viewsFromRawEvent( diff --git a/cmake/AllenDependencies.cmake b/cmake/AllenDependencies.cmake index 49e2b872720..e5e728657b9 100644 --- a/cmake/AllenDependencies.cmake +++ b/cmake/AllenDependencies.cmake @@ -93,6 +93,7 @@ elseif(TARGET_DEVICE STREQUAL "HIP") message(STATUS "HIP runtime: ${HIP_RUNTIME_LIB}") endif() +find_package(cppgsl REQUIRED) find_package(fmt REQUIRED) # std::filesytem detection diff --git a/cmake/GenerateConfiguration.cmake b/cmake/GenerateConfiguration.cmake index c0a30f79f28..9592dfcaa44 100644 --- a/cmake/GenerateConfiguration.cmake +++ b/cmake/GenerateConfiguration.cmake @@ -223,7 +223,7 @@ elseif(STANDALONE) add_library(LHCbEvent STATIC ${LHCBOUTPUTS}) target_compile_definitions(LHCbEvent PUBLIC ODIN_WITHOUT_GAUDI) add_dependencies(LHCbEvent checkout_lhcb checkout_gaudi) - target_link_libraries(LHCbEvent PUBLIC ROOT::Core ROOT::MathCore Boost::headers) + target_link_libraries(LHCbEvent PUBLIC ROOT::Core ROOT::MathCore Boost::headers cppgsl::cppgsl) target_include_directories( LHCbEvent PUBLIC diff --git a/cmake/modules/Findcppgsl.cmake b/cmake/modules/Findcppgsl.cmake new file mode 100644 index 00000000000..a6749d41216 --- /dev/null +++ b/cmake/modules/Findcppgsl.cmake @@ -0,0 +1,59 @@ +##################################################################################### +# (c) Copyright 1998-2019 CERN for the benefit of the LHCb and ATLAS collaborations # +# # +# This software is distributed under the terms of the Apache version 2 licence, # +# copied verbatim in the file "LICENSE". # +# # +# In applying this licence, CERN does not waive the privileges and immunities # +# granted to it by virtue of its status as an Intergovernmental Organization # +# or submit itself to any jurisdiction. # +##################################################################################### +# Module locating the C++ Guidelines Support Library headers. +# +# Defines: +# - CPPGSL_FOUND +# - CPPGSL_INCLUDE_DIR +# - CPPGSL_INCLUDE_DIRS (not cached) +# +# Imports: +# +# cppgsl::cppgsl +# +# Usage of the target instead of the variables is advised + +# Find quietly if already found before +if(DEFINED CACHE{CPPGSL_INCLUDE_DIR}) + set(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY YES) +endif() + +# Look for the header directory: +find_path(CPPGSL_INCLUDE_DIR + NAMES gsl/gsl + HINTS $ENV{CPPGSL_ROOT_DIR} ${CPPGSL_ROOT_DIR}) +set(CPPGSL_INCLUDE_DIRS ${CPPGSL_INCLUDE_DIR}) + +# Handle the regular find_package arguments: +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(cppgsl DEFAULT_MSG CPPGSL_INCLUDE_DIR) + +# Mark the cached variables as "advanced": +mark_as_advanced(CPPGSL_FOUND CPPGSL_INCLUDE_DIR) + +# Modernisation: create an interface target to link against +if(TARGET cppgsl::cppgsl) + return() +endif() +if(CPPGSL_FOUND) + add_library(cppgsl::cppgsl IMPORTED INTERFACE) + target_include_directories(cppgsl::cppgsl SYSTEM INTERFACE "${CPPGSL_INCLUDE_DIR}") + # Display the imported target for the user to know + if(NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY) + message(STATUS " Import target: cppgsl::cppgsl") + endif() +endif() + +if(COMMAND __deprecate_var_for_target) + foreach(v IN ITEMS CPPGSL_INCLUDE_DIR CPPGSL_INCLUDE_DIRS) + variable_watch(${v} __deprecate_var_for_target) + endforeach() +endif() diff --git a/mdf/include/read_mdf.hpp b/mdf/include/read_mdf.hpp index d8e4f2e8c52..2d3330a7262 100644 --- a/mdf/include/read_mdf.hpp +++ b/mdf/include/read_mdf.hpp @@ -63,5 +63,12 @@ namespace MDF { bool dbg = false); LHCb::ODIN decode_odin(std::span data, unsigned const version); + // temporary migration hack to decouple the version of span used in Allen + // from the span used in LHCb + template + LHCb::ODIN decode_odin(S s, unsigned const version) + { + return decode_odin({s.data(), s.size()}, version); + } } // namespace MDF -- GitLab From 9879b69c5b710f17ebd237c737f0c0d893be29e8 Mon Sep 17 00:00:00 2001 From: Gerhard Raven Date: Tue, 21 Oct 2025 17:34:42 +0200 Subject: [PATCH 3/3] Reduce the code where RawBank.h is included, prefer RawBankType.h if possible --- Rec/Allen/src/ProvideRuntimeOptions.cpp | 1 - .../src/SciFiCalculateClusterCount.cu | 2 +- .../SciFi/preprocessing/src/SciFiPreDecode.cu | 2 +- device/calo/decoding/src/CaloDecode.cu | 2 +- .../event_model/UT/include/UTDefinitions.cuh | 4 ++- .../muon/decoding/src/MuonCalculateSRQSize.cu | 8 +++-- .../decoding/src/MuonPopulateTileAndTDC.cu | 8 +++-- device/plume/decoding/src/PlumeDecode.cu | 8 ++--- ...alculateNumberOfRetinaClustersPerSensor.cu | 6 ++-- .../src/DecodeRetinaClusters.cu | 4 +-- .../src/VeloCalculateNumberOfCandidates.cu | 12 +++++-- .../error_banks_cut/include/ErrorBankFilter.h | 1 - host/global_event_cut/include/HostSciFiGEC.h | 4 +-- host/global_event_cut/include/HostUTGEC.h | 6 ++-- main/include/BankMapping.h | 36 +++++++++---------- main/include/MDFProvider.h | 4 +-- main/include/MEPTools.h | 4 +-- main/include/TESProvider.h | 1 - main/src/OutputHandler.cpp | 2 ++ main/src/Provider.cpp | 10 +++--- mdf/include/read_mdf.hpp | 1 - mdf/test/bench_provider.cpp | 1 - mdf/test/bench_read.cpp | 1 - mdf/test/bench_transpose_mep.cpp | 1 - mdf/test/test_mep_banks.cpp | 1 - zmq/test/mdf_sender.cpp | 1 + 26 files changed, 69 insertions(+), 62 deletions(-) diff --git a/Rec/Allen/src/ProvideRuntimeOptions.cpp b/Rec/Allen/src/ProvideRuntimeOptions.cpp index 11b87c8497e..35dc649a104 100644 --- a/Rec/Allen/src/ProvideRuntimeOptions.cpp +++ b/Rec/Allen/src/ProvideRuntimeOptions.cpp @@ -13,7 +13,6 @@ // Gaudi #include #include -#include #include #include "AllenROOTService.h" diff --git a/device/SciFi/preprocessing/src/SciFiCalculateClusterCount.cu b/device/SciFi/preprocessing/src/SciFiCalculateClusterCount.cu index 590342456ff..7bb4e966983 100644 --- a/device/SciFi/preprocessing/src/SciFiCalculateClusterCount.cu +++ b/device/SciFi/preprocessing/src/SciFiCalculateClusterCount.cu @@ -44,7 +44,7 @@ __global__ void scifi_calculate_cluster_count_kernel( uint32_t* hits_module; auto rawbank = scifi_raw_event.raw_bank(iRawBank); - if (rawbank.type != LHCb::RawBank::BankType::FTCluster) continue; + if (rawbank.type != LHCb::Event::Enum::RawBank::BankType::FTCluster) continue; const auto iRowInMap = SciFi::getRowInMap(rawbank, geom); if (iRowInMap == geom.number_of_banks) continue; diff --git a/device/SciFi/preprocessing/src/SciFiPreDecode.cu b/device/SciFi/preprocessing/src/SciFiPreDecode.cu index d05a7fde1da..c8417a4cf57 100644 --- a/device/SciFi/preprocessing/src/SciFiPreDecode.cu +++ b/device/SciFi/preprocessing/src/SciFiPreDecode.cu @@ -34,7 +34,7 @@ scifi_pre_decode_kernel(scifi_pre_decode::Parameters parameters, const unsigned for (unsigned iRawBank = threadIdx.x; iRawBank < scifi_raw_event.number_of_raw_banks(); iRawBank += blockDim.x) { auto rawbank = scifi_raw_event.raw_bank(iRawBank); - if (rawbank.type != LHCb::RawBank::BankType::FTCluster) continue; + if (rawbank.type != LHCb::Event::Enum::RawBank::BankType::FTCluster) continue; const auto iRowInMap = SciFi::getRowInMap(rawbank, geom); if (iRowInMap == geom.number_of_banks) continue; diff --git a/device/calo/decoding/src/CaloDecode.cu b/device/calo/decoding/src/CaloDecode.cu index e3f07b5f3af..b9729597ff4 100644 --- a/device/calo/decoding/src/CaloDecode.cu +++ b/device/calo/decoding/src/CaloDecode.cu @@ -94,7 +94,7 @@ namespace { int32_t source_id = raw_bank.source_id; if (!((source_id >> 11) == 11)) continue; // Only decode Ecal banks - if (raw_bank.type != LHCb::RawBank::BankType::Calo) { + if (raw_bank.type != LHCb::Event::Enum::RawBank::BankType::Calo) { // printf("at event %u, raw bank %u bank type = %u \n", event_number, bank_number, raw_bank.type); continue; // Only decode data banks } diff --git a/device/event_model/UT/include/UTDefinitions.cuh b/device/event_model/UT/include/UTDefinitions.cuh index 34a9fa52502..a4297f94fdf 100644 --- a/device/event_model/UT/include/UTDefinitions.cuh +++ b/device/event_model/UT/include/UTDefinitions.cuh @@ -14,6 +14,7 @@ #include "VeloEventModel.cuh" #include "VeloConsolidated.cuh" #include "UTRaw.cuh" +#include #include "BackendCommon.h" #include #include @@ -51,7 +52,8 @@ namespace UT { __host__ __device__ inline bool allowed_rawbank_type(const uint8_t type) { - return (type == LHCb::RawBank::BankType::UT || type == LHCb::RawBank::BankType::UTError); + return ( + type == LHCb::Event::Enum::RawBank::BankType::UT || type == LHCb::Event::Enum::RawBank::BankType::UTError); } } // namespace Decoding diff --git a/device/muon/decoding/src/MuonCalculateSRQSize.cu b/device/muon/decoding/src/MuonCalculateSRQSize.cu index bc32db7457a..c086b0faa08 100644 --- a/device/muon/decoding/src/MuonCalculateSRQSize.cu +++ b/device/muon/decoding/src/MuonCalculateSRQSize.cu @@ -78,7 +78,7 @@ __device__ void calculate_srq_size( bool corrupted = false; for (unsigned link = threadIdx.y; link < number_of_readout_fibers; link += blockDim.y) { unsigned current_pointer = - raw_bank.type == LHCb::RawBank::BankType::MuonError ? link_start_pointer + 3 : link_start_pointer; + raw_bank.type == LHCb::Event::Enum::RawBank::BankType::MuonError ? link_start_pointer + 3 : link_start_pointer; auto size_of_link = (static_cast(range_data[current_pointer] & 0xF0) >> 4) + 1; for (unsigned j = 0; j < link; ++j) { @@ -105,7 +105,7 @@ __device__ void calculate_srq_size( auto quarterOfLink = muonGeometry->QuarterOfLink(tell_number, pci_number, reroutered_link); unsigned current_pointer = - raw_bank.type == LHCb::RawBank::BankType::MuonError ? link_start_pointer + 3 : link_start_pointer; + raw_bank.type == LHCb::Event::Enum::RawBank::BankType::MuonError ? link_start_pointer + 3 : link_start_pointer; auto size_of_link = (static_cast(range_data[current_pointer] & 0xF0) >> 4) + 1; for (unsigned j = 0; j < link; ++j) { @@ -177,7 +177,9 @@ __global__ void muon_calculate_srq_size_kernel( for (unsigned bank_index = threadIdx.x; bank_index < raw_event.number_of_raw_banks(); bank_index += blockDim.x) { const auto raw_bank = raw_event.raw_bank(bank_index); - if (raw_bank.type != LHCb::RawBank::BankType::Muon && raw_bank.type != LHCb::RawBank::BankType::MuonError) + if ( + raw_bank.type != LHCb::Event::Enum::RawBank::BankType::Muon && + raw_bank.type != LHCb::Event::Enum::RawBank::BankType::MuonError) continue; // skip invalid raw banks calculate_srq_size(muonTables, muonGeometry, raw_bank, storage_station_region_quarter_sizes); diff --git a/device/muon/decoding/src/MuonPopulateTileAndTDC.cu b/device/muon/decoding/src/MuonPopulateTileAndTDC.cu index 39d517d90c8..c5beca58b3b 100644 --- a/device/muon/decoding/src/MuonPopulateTileAndTDC.cu +++ b/device/muon/decoding/src/MuonPopulateTileAndTDC.cu @@ -154,7 +154,7 @@ __device__ void decode_muon_bank( bool corrupted = false; for (unsigned link = threadIdx.y; link < number_of_readout_fibers; link += blockDim.y) { unsigned current_pointer = - raw_bank.type == LHCb::RawBank::BankType::MuonError ? link_start_pointer + 3 : link_start_pointer; + raw_bank.type == LHCb::Event::Enum::RawBank::BankType::MuonError ? link_start_pointer + 3 : link_start_pointer; auto size_of_link = (static_cast(range_data[current_pointer] & 0xF0) >> 4) + 1; for (unsigned j = 0; j < link; ++j) { @@ -182,7 +182,7 @@ __device__ void decode_muon_bank( auto quarterOfLink = muonGeometry->QuarterOfLink(tell_number, pci_number, reroutered_link); unsigned current_pointer = - raw_bank.type == LHCb::RawBank::BankType::MuonError ? link_start_pointer + 3 : link_start_pointer; + raw_bank.type == LHCb::Event::Enum::RawBank::BankType::MuonError ? link_start_pointer + 3 : link_start_pointer; auto size_of_link = (static_cast(range_data[current_pointer] & 0xF0) >> 4) + 1; for (unsigned j = 0; j < link; ++j) { @@ -278,7 +278,9 @@ __global__ void muon_populate_tile_and_tdc_kernel( for (unsigned bank_index = threadIdx.x; bank_index < raw_event.number_of_raw_banks(); bank_index += blockDim.x) { const auto raw_bank = raw_event.raw_bank(bank_index); - if (raw_bank.type != LHCb::RawBank::BankType::Muon && raw_bank.type != LHCb::RawBank::BankType::MuonError) + if ( + raw_bank.type != LHCb::Event::Enum::RawBank::BankType::Muon && + raw_bank.type != LHCb::Event::Enum::RawBank::BankType::MuonError) continue; // skip invalid raw banks decode_muon_bank( diff --git a/device/plume/decoding/src/PlumeDecode.cu b/device/plume/decoding/src/PlumeDecode.cu index 83ccf8111ca..f38bc440cf4 100644 --- a/device/plume/decoding/src/PlumeDecode.cu +++ b/device/plume/decoding/src/PlumeDecode.cu @@ -33,7 +33,7 @@ namespace { auto raw_bank = raw_event.raw_bank(bank_number); int32_t source_id = raw_bank.source_id; - if (raw_bank.type != LHCb::RawBank::BankType::Plume) { + if (raw_bank.type != LHCb::Event::Enum::RawBank::BankType::Plume) { continue; } @@ -45,7 +45,7 @@ namespace { if (source_id != 0x5001) continue; } else { - if (source_id != 0x5001 and source_id != 0x5002 and source_id != 0x5003 and source_id != 0x5004) continue; + if (source_id != 0x5001 && source_id != 0x5002 && source_id != 0x5003 && source_id != 0x5004) continue; } uint32_t ovr_thb = {0}; // overthreshold bits: 1 bit objects for the n_ch channels @@ -57,8 +57,8 @@ namespace { for (unsigned ch = 0; ch < n_ch; ++ch) { - if (ch >= Lumi::Constants::n_plume_lumi_channels and (n_bank == 1 or n_bank == 2)) { // decode only the lumi - // PMTs in banks 1 and 2 + if (ch >= Lumi::Constants::n_plume_lumi_channels && (n_bank == 1 or n_bank == 2)) { // decode only the lumi + // PMTs in banks 1 and 2 continue; } diff --git a/device/velo/retinacluster_decoding/src/CalculateNumberOfRetinaClustersPerSensor.cu b/device/velo/retinacluster_decoding/src/CalculateNumberOfRetinaClustersPerSensor.cu index 7670c48e835..89fd25e7e01 100644 --- a/device/velo/retinacluster_decoding/src/CalculateNumberOfRetinaClustersPerSensor.cu +++ b/device/velo/retinacluster_decoding/src/CalculateNumberOfRetinaClustersPerSensor.cu @@ -49,10 +49,10 @@ __global__ void calculate_number_of_retinaclusters_each_sensor_pair_kernel( for (unsigned raw_bank_number = threadIdx.x; raw_bank_number < number_of_raw_banks; raw_bank_number += blockDim.x) { const auto raw_bank = velo_raw_event.raw_bank(raw_bank_number); if ( - check_velo_rawbank && - (raw_bank.type == LHCb::RawBank::BankType::VP || raw_bank.type == LHCb::RawBank::BankType::Velo)) + check_velo_rawbank && (raw_bank.type == LHCb::Event::Enum::RawBank::BankType::VP || + raw_bank.type == LHCb::Event::Enum::RawBank::BankType::Velo)) n_unexpected_velo_rawbank.increment(); - if (raw_bank.type == LHCb::RawBank::BankType::VPRetinaCluster) { + if (raw_bank.type == LHCb::Event::Enum::RawBank::BankType::VPRetinaCluster) { if constexpr (decoding_version == 2 || decoding_version == 3) { each_sensor_pair_size[raw_bank.sourceID] = (masked_modules & (1 << (raw_bank.sourceID / 4))) ? 0 : raw_bank.count; diff --git a/device/velo/retinacluster_decoding/src/DecodeRetinaClusters.cu b/device/velo/retinacluster_decoding/src/DecodeRetinaClusters.cu index 09a8de96f23..39c976def45 100644 --- a/device/velo/retinacluster_decoding/src/DecodeRetinaClusters.cu +++ b/device/velo/retinacluster_decoding/src/DecodeRetinaClusters.cu @@ -193,7 +193,7 @@ __global__ void velo_calculate_sorting_key( unsigned index_within_raw_bank = cluster_number - (sensor_pair_offsets[sensor_pair] - event_clusters_offset); const auto raw_bank = velo_raw_event.raw_bank(raw_bank_number); - if (raw_bank.type == LHCb::RawBank::BankType::VPRetinaCluster) { + if (raw_bank.type == LHCb::Event::Enum::RawBank::BankType::VPRetinaCluster) { populate_sorting_key( parameters.dev_hit_sorting_key, g, @@ -353,7 +353,7 @@ __global__ void decode_retinaclusters_sorted( unsigned index_within_raw_bank = cluster_number - sensor_pair_offsets[sensor_pair]; const auto raw_bank = velo_raw_event.raw_bank(raw_bank_number); - if (raw_bank.type == LHCb::RawBank::BankType::VPRetinaCluster) { + if (raw_bank.type == LHCb::Event::Enum::RawBank::BankType::VPRetinaCluster) { populate_retinacluster( velo_cluster_container, g, diff --git a/device/velo/sparse_ccl/src/VeloCalculateNumberOfCandidates.cu b/device/velo/sparse_ccl/src/VeloCalculateNumberOfCandidates.cu index 191593a2dac..dd11f68c692 100644 --- a/device/velo/sparse_ccl/src/VeloCalculateNumberOfCandidates.cu +++ b/device/velo/sparse_ccl/src/VeloCalculateNumberOfCandidates.cu @@ -35,9 +35,12 @@ __global__ void velo_count_sp_per_sensor( unsigned* superpixels_offsets = parameters.dev_superpixels_offsets + event_number * Velo::Constants::n_sensors; - if (check_velo_rawbank && raw_bank.type == LHCb::RawBank::BankType::VPRetinaCluster) + if (check_velo_rawbank && raw_bank.type == LHCb::Event::Enum::RawBank::BankType::VPRetinaCluster) n_unexpected_velo_rawbank.increment(); - if (raw_bank.type != LHCb::RawBank::BankType::VP && raw_bank.type != LHCb::RawBank::BankType::Velo) continue; + if ( + raw_bank.type != LHCb::Event::Enum::RawBank::BankType::VP && + raw_bank.type != LHCb::Event::Enum::RawBank::BankType::Velo) + continue; if constexpr (decoding_version == 2 || decoding_version == 3) { unsigned number_of_sp = raw_bank.count; @@ -95,7 +98,10 @@ __global__ void velo_partition_superpixels( unsigned* superpixels_offsets = parameters.dev_superpixels_offsets + event_number * Velo::Constants::n_sensors; - if (raw_bank.type != LHCb::RawBank::BankType::VP && raw_bank.type != LHCb::RawBank::BankType::Velo) continue; + if ( + raw_bank.type != LHCb::Event::Enum::RawBank::BankType::VP && + raw_bank.type != LHCb::Event::Enum::RawBank::BankType::Velo) + continue; if constexpr (decoding_version == 2 || decoding_version == 3) { unsigned number_of_sp = raw_bank.count; diff --git a/host/error_banks_cut/include/ErrorBankFilter.h b/host/error_banks_cut/include/ErrorBankFilter.h index 4185495a28e..286ff67a779 100644 --- a/host/error_banks_cut/include/ErrorBankFilter.h +++ b/host/error_banks_cut/include/ErrorBankFilter.h @@ -16,7 +16,6 @@ #include "Common.h" #include "AlgorithmTypes.cuh" #include "InputProvider.h" -#include "Event/RawBank.h" #include #ifndef ALLEN_STANDALONE diff --git a/host/global_event_cut/include/HostSciFiGEC.h b/host/global_event_cut/include/HostSciFiGEC.h index 3e2e6fc3b38..1693de228f4 100644 --- a/host/global_event_cut/include/HostSciFiGEC.h +++ b/host/global_event_cut/include/HostSciFiGEC.h @@ -10,7 +10,7 @@ \*****************************************************************************/ #pragma once -#include +#include #include "Common.h" #include "SciFiRaw.cuh" @@ -60,7 +60,7 @@ namespace host_scifi_gec { const auto scifi_event = SciFi::RawEvent { parameters.scifi_banks[0].data(), scifi_offsets.data(), scifi_sizes.data(), scifi_types.data(), event_number}; for (unsigned i = 0; i < scifi_event.number_of_raw_banks(); ++i) { - if (scifi_event.bank_type(i) == LHCb::RawBank::BankType::FTCluster) { + if (scifi_event.bank_type(i) == LHCb::Event::Enum::RawBank::BankType::FTCluster) { n_SciFi_clusters += scifi_event.bank_size(i); } } diff --git a/host/global_event_cut/include/HostUTGEC.h b/host/global_event_cut/include/HostUTGEC.h index a4128ea0e0c..e3d857ada84 100644 --- a/host/global_event_cut/include/HostUTGEC.h +++ b/host/global_event_cut/include/HostUTGEC.h @@ -10,7 +10,7 @@ \*****************************************************************************/ #pragma once -#include +#include #include "Common.h" #include "SciFiRaw.cuh" @@ -62,7 +62,7 @@ namespace host_ut_gec { auto const fragment_offset = ut_offsets[2 + number_of_ut_raw_banks * (1 + event_number) + i] - block_offset; char const* bank_data = parameters.ut_banks[i].data() + fragment_offset; auto const bank_type = MEP::bank_type(bank_data, ut_types.data(), event_number, i); - if (bank_type != LHCb::RawBank::BankType::UT) continue; + if (bank_type != LHCb::Event::Enum::RawBank::BankType::UT) continue; auto const bank_size = MEP::bank_size(bank_data, ut_sizes.data(), event_number, i); if (ut_raw_bank_version == 4) n_clusters += UTRawBank<4> {sourceID, bank_data, bank_size, bank_type}.get_n_hits(); @@ -78,7 +78,7 @@ namespace host_ut_gec { for (unsigned i = 0; i < ut_event.number_of_raw_banks(); ++i) { auto const bank_type = Allen::bank_type(ut_types.data(), event_number, i); - if (bank_type != LHCb::RawBank::BankType::UT) continue; + if (bank_type != LHCb::Event::Enum::RawBank::BankType::UT) continue; if (ut_raw_bank_version == 4) n_clusters += ut_event.raw_bank<4>(i).get_n_hits(); else if (ut_raw_bank_version == 3) diff --git a/main/include/BankMapping.h b/main/include/BankMapping.h index d1ed5b81e3e..6b42f644b84 100644 --- a/main/include/BankMapping.h +++ b/main/include/BankMapping.h @@ -11,29 +11,29 @@ #pragma once #include -#include +#include #include "sourceid.h" #include "BankTypes.h" namespace Allen { - const std::unordered_map> bank_mapping = { - {LHCb::RawBank::BankType::VP, {BankTypes::VP}}, - {LHCb::RawBank::BankType::VPRetinaCluster, {BankTypes::VP}}, - {LHCb::RawBank::BankType::UT, {BankTypes::UT}}, - {LHCb::RawBank::BankType::UTError, {BankTypes::UT}}, - {LHCb::RawBank::BankType::FTCluster, {BankTypes::FT}}, - {LHCb::RawBank::BankType::Muon, {BankTypes::MUON}}, - {LHCb::RawBank::BankType::MuonError, {BankTypes::MUON}}, - {LHCb::RawBank::BankType::ODIN, {BankTypes::ODIN}}, - {LHCb::RawBank::BankType::HcalPacked, {BankTypes::HCal}}, - {LHCb::RawBank::BankType::EcalPacked, {BankTypes::ECal}}, - {LHCb::RawBank::BankType::Calo, {BankTypes::ECal, BankTypes::HCal}}, - {LHCb::RawBank::BankType::Rich, {BankTypes::Rich1, BankTypes::Rich2}}, - {LHCb::RawBank::BankType::OTError, {BankTypes::MCVertices}}, // used for PV MC info - {LHCb::RawBank::BankType::OTRaw, {BankTypes::MCTracks}}, - {LHCb::RawBank::BankType::OTError, {BankTypes::Gen}}, // used for beam crossing angles Gen info - {LHCb::RawBank::BankType::Plume, {BankTypes::Plume}}}; // used for track MC info + const std::unordered_map> bank_mapping = { + {LHCb::Event::Enum::RawBank::BankType::VP, {BankTypes::VP}}, + {LHCb::Event::Enum::RawBank::BankType::VPRetinaCluster, {BankTypes::VP}}, + {LHCb::Event::Enum::RawBank::BankType::UT, {BankTypes::UT}}, + {LHCb::Event::Enum::RawBank::BankType::UTError, {BankTypes::UT}}, + {LHCb::Event::Enum::RawBank::BankType::FTCluster, {BankTypes::FT}}, + {LHCb::Event::Enum::RawBank::BankType::Muon, {BankTypes::MUON}}, + {LHCb::Event::Enum::RawBank::BankType::MuonError, {BankTypes::MUON}}, + {LHCb::Event::Enum::RawBank::BankType::ODIN, {BankTypes::ODIN}}, + {LHCb::Event::Enum::RawBank::BankType::HcalPacked, {BankTypes::HCal}}, + {LHCb::Event::Enum::RawBank::BankType::EcalPacked, {BankTypes::ECal}}, + {LHCb::Event::Enum::RawBank::BankType::Calo, {BankTypes::ECal, BankTypes::HCal}}, + {LHCb::Event::Enum::RawBank::BankType::Rich, {BankTypes::Rich1, BankTypes::Rich2}}, + {LHCb::Event::Enum::RawBank::BankType::OTError, {BankTypes::MCVertices}}, // used for PV MC info + {LHCb::Event::Enum::RawBank::BankType::OTRaw, {BankTypes::MCTracks}}, + {LHCb::Event::Enum::RawBank::BankType::OTError, {BankTypes::Gen}}, // used for beam crossing angles Gen info + {LHCb::Event::Enum::RawBank::BankType::Plume, {BankTypes::Plume}}}; // used for track MC info const std::unordered_map subdetectors = {{SourceIdSys::SourceIdSys_ODIN, BankTypes::ODIN}, {SourceIdSys::SourceIdSys_VELO_A, BankTypes::VP}, diff --git a/main/include/MDFProvider.h b/main/include/MDFProvider.h index e3579fde011..cd97ed20bd7 100644 --- a/main/include/MDFProvider.h +++ b/main/include/MDFProvider.h @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include "BankMapping.h" #include @@ -70,7 +70,7 @@ struct MDFProviderConfig { bool split_by_run = false; - std::unordered_set skip_banks; + std::unordered_set skip_banks; }; /** diff --git a/main/include/MEPTools.h b/main/include/MEPTools.h index b65f99817ce..efe2ad8129b 100644 --- a/main/include/MEPTools.h +++ b/main/include/MEPTools.h @@ -24,7 +24,7 @@ #ifdef __CUDACC__ #pragma pop #endif -#include +#include #include "Common.h" #include "BackendCommon.h" @@ -70,7 +70,7 @@ namespace Allen { return reinterpret_cast(event_data)[0]; } - static constexpr uint8_t LastBankType = static_cast(LHCb::RawBank::types().size()); + static constexpr uint8_t LastBankType = static_cast(LHCb::Event::Enum::RawBank::BankType::LastType); } // namespace Allen namespace MEP { diff --git a/main/include/TESProvider.h b/main/include/TESProvider.h index 56bc2fa61d8..fb9031130bd 100644 --- a/main/include/TESProvider.h +++ b/main/include/TESProvider.h @@ -13,7 +13,6 @@ #include #include -#include #include #include diff --git a/main/src/OutputHandler.cpp b/main/src/OutputHandler.cpp index 91d86a16340..0b2265f6e8c 100644 --- a/main/src/OutputHandler.cpp +++ b/main/src/OutputHandler.cpp @@ -23,6 +23,8 @@ #include #include +#include + #include #include #include diff --git a/main/src/Provider.cpp b/main/src/Provider.cpp index 95674ab326d..a9a83905d46 100644 --- a/main/src/Provider.cpp +++ b/main/src/Provider.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include @@ -261,13 +261,13 @@ std::unique_ptr Allen::make_provider( // This is a hack to avoid copying both SP and Retina banks to the device. auto [veloSP, retina] = Allen::velo_decoding_type(configuration_reader); - std::unordered_set skip_banks {}; + std::unordered_set skip_banks {}; if (!veloSP && retina) { - skip_banks.insert(LHCb::RawBank::BankType::Velo); - skip_banks.insert(LHCb::RawBank::BankType::VP); + skip_banks.insert(LHCb::Event::Enum::RawBank::BankType::Velo); + skip_banks.insert(LHCb::Event::Enum::RawBank::BankType::VP); } else if (veloSP && !retina) { - skip_banks.insert(LHCb::RawBank::BankType::VPRetinaCluster); + skip_banks.insert(LHCb::Event::Enum::RawBank::BankType::VPRetinaCluster); } if (!mdf_input.empty()) { diff --git a/mdf/include/read_mdf.hpp b/mdf/include/read_mdf.hpp index 2d3330a7262..361d04efb5e 100644 --- a/mdf/include/read_mdf.hpp +++ b/mdf/include/read_mdf.hpp @@ -28,7 +28,6 @@ #include #include "Event/ODIN.h" -#include "Event/RawBank.h" #include "mdf_header.hpp" namespace { diff --git a/mdf/test/bench_provider.cpp b/mdf/test/bench_provider.cpp index 9a18a84a0a1..844e67bf3fa 100644 --- a/mdf/test/bench_provider.cpp +++ b/mdf/test/bench_provider.cpp @@ -16,7 +16,6 @@ #include #include -#include #include #include #include diff --git a/mdf/test/bench_read.cpp b/mdf/test/bench_read.cpp index 965a3ec5ce7..1a62d737a56 100644 --- a/mdf/test/bench_read.cpp +++ b/mdf/test/bench_read.cpp @@ -21,7 +21,6 @@ #include #include -#include #include #include #include diff --git a/mdf/test/bench_transpose_mep.cpp b/mdf/test/bench_transpose_mep.cpp index 7596718f3b4..cf36e353b47 100644 --- a/mdf/test/bench_transpose_mep.cpp +++ b/mdf/test/bench_transpose_mep.cpp @@ -20,7 +20,6 @@ #include #include -#include #include #include #include diff --git a/mdf/test/test_mep_banks.cpp b/mdf/test/test_mep_banks.cpp index baf9da01b65..53ea57160ff 100644 --- a/mdf/test/test_mep_banks.cpp +++ b/mdf/test/test_mep_banks.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/zmq/test/mdf_sender.cpp b/zmq/test/mdf_sender.cpp index e57db61fefc..566daca5cb2 100644 --- a/zmq/test/mdf_sender.cpp +++ b/zmq/test/mdf_sender.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include -- GitLab