From 8223897a4658c27aa9fc3201eaa1f3fb4935939e Mon Sep 17 00:00:00 2001 From: David Rohr Date: Wed, 25 Nov 2026 16:22:22 +0100 Subject: [PATCH 1/2] DPL / MC: Add std::span support, switch some things from gsl::span to std::span --- .../include/SimulationDataFormat/ConstMCTruthContainer.h | 3 ++- Detectors/CPV/simulation/src/RawWriter.cxx | 8 ++++---- .../GlobalTracking/include/GlobalTracking/TrackMethods.h | 1 + Detectors/HMPID/simulation/src/HmpidCoder2.cxx | 2 +- Detectors/ITSMFT/common/simulation/src/MC2RawEncoder.cxx | 2 +- .../MUON/MCH/Raw/Encoder/Payload/PayloadPaginator.cxx | 2 +- Detectors/Raw/include/DetectorsRaw/RawFileWriter.h | 5 +++-- Detectors/Raw/src/RawFileWriter.cxx | 2 +- Detectors/TOF/reconstruction/src/Encoder.cxx | 2 +- Detectors/TPC/workflow/src/ClusterDecoderRawSpec.cxx | 2 +- Detectors/TPC/workflow/src/ClustererSpec.cxx | 2 +- Detectors/TPC/workflow/src/ZSSpec.cxx | 1 + Framework/Core/include/Framework/InputRecord.h | 4 ++-- Framework/Core/include/Framework/TypeTraits.h | 6 +++++- Framework/Core/test/test_TypeTraits.cxx | 3 +++ 15 files changed, 28 insertions(+), 17 deletions(-) diff --git a/DataFormats/simulation/include/SimulationDataFormat/ConstMCTruthContainer.h b/DataFormats/simulation/include/SimulationDataFormat/ConstMCTruthContainer.h index 72c66c863f698..50c42237f5f26 100644 --- a/DataFormats/simulation/include/SimulationDataFormat/ConstMCTruthContainer.h +++ b/DataFormats/simulation/include/SimulationDataFormat/ConstMCTruthContainer.h @@ -20,6 +20,7 @@ #ifndef GPUCA_STANDALONE #include #endif +#include class TTree; @@ -132,7 +133,7 @@ template class ConstMCTruthContainerView { public: - ConstMCTruthContainerView(gsl::span const bufferview) : mStorage(bufferview){}; + ConstMCTruthContainerView(std::span const bufferview) : mStorage(bufferview.data(), bufferview.size()) {}; ConstMCTruthContainerView(ConstMCTruthContainer const& cont) : mStorage(gsl::span(cont)){}; // be explicit that we want nullptr / 0 for an uninitialized container (needs (void)0 to avoid false codechecker warning) ConstMCTruthContainerView() : mStorage{nullptr, static_cast::size_type>(0)} diff --git a/Detectors/CPV/simulation/src/RawWriter.cxx b/Detectors/CPV/simulation/src/RawWriter.cxx index bed3a4b51f4a6..caad5b4f19cb9 100644 --- a/Detectors/CPV/simulation/src/RawWriter.cxx +++ b/Detectors/CPV/simulation/src/RawWriter.cxx @@ -189,7 +189,7 @@ bool RawWriter::processOrbit(const gsl::span digitsbranch, const } } mRawWriter->addData(links[iLink].feeId, links[iLink].cruId, links[iLink].linkId, links[iLink].endPointId, currentIR, - gsl::span(mPayload[iLink].data(), mPayload[iLink].size()), preformatted); + std::span(mPayload[iLink].data(), mPayload[iLink].size()), preformatted); mPayload[iLink].clear(); cpvWordCounter[iLink] = 0; cpvWordCounterBeforeCPVTrailer[iLink] = 0; @@ -262,7 +262,7 @@ bool RawWriter::processOrbit(const gsl::span digitsbranch, const } } mRawWriter->addData(links[iLink].feeId, links[iLink].cruId, links[iLink].linkId, links[iLink].endPointId, currentIR, - gsl::span(mPayload[iLink].data(), mPayload[iLink].size()), preformatted); + std::span(mPayload[iLink].data(), mPayload[iLink].size()), preformatted); mPayload[iLink].clear(); cpvWordCounter[iLink] = 0; @@ -322,7 +322,7 @@ bool RawWriter::processOrbit(const gsl::span digitsbranch, const } } mRawWriter->addData(links[iLink].feeId, links[iLink].cruId, links[iLink].linkId, links[iLink].endPointId, currentIR, - gsl::span(mPayload[iLink].data(), mPayload[iLink].size()), preformatted); + std::span(mPayload[iLink].data(), mPayload[iLink].size()), preformatted); mPayload[iLink].clear(); cpvWordCounter[iLink] = 0; @@ -373,7 +373,7 @@ bool RawWriter::processOrbit(const gsl::span digitsbranch, const } } mRawWriter->addData(links[iLink].feeId, links[iLink].cruId, links[iLink].linkId, links[iLink].endPointId, - trgs.back().getBCData(), gsl::span(mPayload[iLink].data(), mPayload[iLink].size()), preformatted); + trgs.back().getBCData(), std::span(mPayload[iLink].data(), mPayload[iLink].size()), preformatted); mPayload[iLink].clear(); } } diff --git a/Detectors/GlobalTracking/include/GlobalTracking/TrackMethods.h b/Detectors/GlobalTracking/include/GlobalTracking/TrackMethods.h index f65d9ffd260e6..b5baab2d43857 100644 --- a/Detectors/GlobalTracking/include/GlobalTracking/TrackMethods.h +++ b/Detectors/GlobalTracking/include/GlobalTracking/TrackMethods.h @@ -20,6 +20,7 @@ #include "GPUTPCGMMergedTrackHit.h" #include "DataFormatsITS/TrackITS.h" #include +#include #include namespace o2 diff --git a/Detectors/HMPID/simulation/src/HmpidCoder2.cxx b/Detectors/HMPID/simulation/src/HmpidCoder2.cxx index c96b7485bc8cd..d081641ce9ee0 100644 --- a/Detectors/HMPID/simulation/src/HmpidCoder2.cxx +++ b/Detectors/HMPID/simulation/src/HmpidCoder2.cxx @@ -186,7 +186,7 @@ void HmpidCoder2::writePaginatedEvent(uint32_t orbit, uint16_t bc) ReadOut::LnkId(eq), 0, {bc, orbit}, - gsl::span(reinterpret_cast(ptrStartEquipment), + std::span(reinterpret_cast(ptrStartEquipment), EventSize * sizeof(uint32_t)), false, 0, diff --git a/Detectors/ITSMFT/common/simulation/src/MC2RawEncoder.cxx b/Detectors/ITSMFT/common/simulation/src/MC2RawEncoder.cxx index 417178f723a24..18c5570d1a0d2 100644 --- a/Detectors/ITSMFT/common/simulation/src/MC2RawEncoder.cxx +++ b/Detectors/ITSMFT/common/simulation/src/MC2RawEncoder.cxx @@ -222,7 +222,7 @@ void MC2RawEncoder::fillGBTLinks(RUDecodeData& ru) LOGF(debug, "Filled %s with %d GBT words", link->describe(), nPayLoadWordsNeeded + 3); // flush to writer - mWriter.addData(link->feeID, link->cruID, link->idInCRU, link->endPointID, mCurrIR, gsl::span((char*)link->data.data(), link->data.getSize())); + mWriter.addData(link->feeID, link->cruID, link->idInCRU, link->endPointID, mCurrIR, std::span((char*)link->data.data(), link->data.getSize())); link->data.clear(); // } // loop over links of RU diff --git a/Detectors/MUON/MCH/Raw/Encoder/Payload/PayloadPaginator.cxx b/Detectors/MUON/MCH/Raw/Encoder/Payload/PayloadPaginator.cxx index f11467098945e..41ec16dacdf66 100644 --- a/Detectors/MUON/MCH/Raw/Encoder/Payload/PayloadPaginator.cxx +++ b/Detectors/MUON/MCH/Raw/Encoder/Payload/PayloadPaginator.cxx @@ -136,7 +136,7 @@ void paginate(o2::raw::RawFileWriter& rawFileWriter, filled[o2::InteractionRecord{h.bc, h.orbit}].insert(li.value()); rawFileWriter.addData(rdhFromLinkInfo(li.value()), {h.bc, h.orbit}, - gsl::span(const_cast(reinterpret_cast(&b.payload[0])), + std::span(const_cast(reinterpret_cast(&b.payload[0])), b.payload.size())); } diff --git a/Detectors/Raw/include/DetectorsRaw/RawFileWriter.h b/Detectors/Raw/include/DetectorsRaw/RawFileWriter.h index 1f4632d273bfc..c324011570284 100644 --- a/Detectors/Raw/include/DetectorsRaw/RawFileWriter.h +++ b/Detectors/Raw/include/DetectorsRaw/RawFileWriter.h @@ -17,6 +17,7 @@ /// @brief Utility class to write detectors data to (multiple) raw data file(s) respecting CRU format #include +#include #include #include #include @@ -205,10 +206,10 @@ class RawFileWriter } void addData(uint16_t feeid, uint16_t cru, uint8_t lnk, uint8_t endpoint, const IR& ir, - const gsl::span data, bool preformatted = false, uint32_t trigger = 0, uint32_t detField = 0); + const std::span data, bool preformatted = false, uint32_t trigger = 0, uint32_t detField = 0); template - void addData(const H& rdh, const IR& ir, const gsl::span data, bool preformatted = false, uint32_t trigger = 0) + void addData(const H& rdh, const IR& ir, const std::span data, bool preformatted = false, uint32_t trigger = 0) { RDHAny::sanityCheckLoose(); addData(RDHUtils::getFEEID(rdh), RDHUtils::getCRUID(rdh), RDHUtils::getLinkID(rdh), RDHUtils::getEndPointID(rdh), ir, data, trigger); diff --git a/Detectors/Raw/src/RawFileWriter.cxx b/Detectors/Raw/src/RawFileWriter.cxx index d7a0aae7fe47e..d07b0fa98fec8 100644 --- a/Detectors/Raw/src/RawFileWriter.cxx +++ b/Detectors/Raw/src/RawFileWriter.cxx @@ -177,7 +177,7 @@ RawFileWriter::LinkData& RawFileWriter::registerLink(uint16_t fee, uint16_t cru, } //_____________________________________________________________________ -void RawFileWriter::addData(uint16_t feeid, uint16_t cru, uint8_t lnk, uint8_t endpoint, const IR& ir, const gsl::span data, bool preformatted, uint32_t trigger, uint32_t detField) +void RawFileWriter::addData(uint16_t feeid, uint16_t cru, uint8_t lnk, uint8_t endpoint, const IR& ir, const std::span data, bool preformatted, uint32_t trigger, uint32_t detField) { // add payload to relevant links auto sspec = RDHUtils::getSubSpec(cru, lnk, endpoint, feeid); diff --git a/Detectors/TOF/reconstruction/src/Encoder.cxx b/Detectors/TOF/reconstruction/src/Encoder.cxx index b761a10ca2b38..34d882f63dd74 100644 --- a/Detectors/TOF/reconstruction/src/Encoder.cxx +++ b/Detectors/TOF/reconstruction/src/Encoder.cxx @@ -114,7 +114,7 @@ bool Encoder::flush(int icrate) if (nbyte) { if (mCrateOn[icrate]) { //printf("flush crate %d -- byte = %d -- orbit = %d, bc = %d\n",icrate, nbyte, mIR.orbit, mIR.bc); - mFileWriter.addData(Geo::getFEEid(icrate), Geo::getCRUid(icrate), Geo::getCRUlink(icrate), Geo::getCRUendpoint(icrate), mIR, gsl::span(mBuffer[icrate], nbyte)); + mFileWriter.addData(Geo::getFEEid(icrate), Geo::getCRUid(icrate), Geo::getCRUlink(icrate), Geo::getCRUendpoint(icrate), mIR, std::span(mBuffer[icrate], nbyte)); } mIntegratedAllBytes += nbyte; } diff --git a/Detectors/TPC/workflow/src/ClusterDecoderRawSpec.cxx b/Detectors/TPC/workflow/src/ClusterDecoderRawSpec.cxx index c5c444e077703..0362eafb38614 100644 --- a/Detectors/TPC/workflow/src/ClusterDecoderRawSpec.cxx +++ b/Detectors/TPC/workflow/src/ClusterDecoderRawSpec.cxx @@ -111,7 +111,7 @@ DataProcessorSpec getClusterDecoderRawSpec(bool sendMC) std::vector mcinCopiesFlatView; ConstMCLabelContainerView mcin; if (DataRefUtils::isValid(mclabelref)) { - mcin = pc.inputs().get>(mclabelref); + mcin = pc.inputs().get>(mclabelref); mcinCopiesFlat.resize(nPages); mcinCopiesFlatView.reserve(nPages); if (verbosity > 0) { diff --git a/Detectors/TPC/workflow/src/ClustererSpec.cxx b/Detectors/TPC/workflow/src/ClustererSpec.cxx index 310551a67753e..00ce52658bf73 100644 --- a/Detectors/TPC/workflow/src/ClustererSpec.cxx +++ b/Detectors/TPC/workflow/src/ClustererSpec.cxx @@ -89,7 +89,7 @@ DataProcessorSpec getClustererSpec(bool sendMC) } ConstMCLabelContainerView inMCLabels; if (DataRefUtils::isValid(mclabelref)) { - inMCLabels = pc.inputs().get>(mclabelref); + inMCLabels = pc.inputs().get>(mclabelref); } auto inDigits = pc.inputs().get>(dataref); if (verbosity > 0 && inMCLabels.getBuffer().size()) { diff --git a/Detectors/TPC/workflow/src/ZSSpec.cxx b/Detectors/TPC/workflow/src/ZSSpec.cxx index eaedb537faba8..3fb13d520cdea 100644 --- a/Detectors/TPC/workflow/src/ZSSpec.cxx +++ b/Detectors/TPC/workflow/src/ZSSpec.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include "GPUO2InterfaceUtils.h" diff --git a/Framework/Core/include/Framework/InputRecord.h b/Framework/Core/include/Framework/InputRecord.h index dc8d8455bb418..7e678a6e9a67a 100644 --- a/Framework/Core/include/Framework/InputRecord.h +++ b/Framework/Core/include/Framework/InputRecord.h @@ -303,7 +303,6 @@ class InputRecord // implementation (f) } else if constexpr (is_span::value) { // substitution for span of messageable objects - // FIXME: there will be std::span in C++20 static_assert(is_messageable::value, "span can only be created for messageable types"); auto header = DataRefUtils::getHeader(ref); assert(header); @@ -318,7 +317,8 @@ class InputRecord " payload size " + std::to_string(payloadSize)) .c_str()); } - return gsl::span(reinterpret_cast(ref.payload), payloadSize / sizeof(ValueT)); + using SpanT = std::conditional_t>, std::span, gsl::span>; + return SpanT(reinterpret_cast(ref.payload), payloadSize / sizeof(ValueT)); // implementation (g) } else if constexpr (is_container::value) { diff --git a/Framework/Core/include/Framework/TypeTraits.h b/Framework/Core/include/Framework/TypeTraits.h index bb2d338f42af3..4ebc2651a30bc 100644 --- a/Framework/Core/include/Framework/TypeTraits.h +++ b/Framework/Core/include/Framework/TypeTraits.h @@ -17,6 +17,7 @@ #include "Framework/Traits.h" #include +#include namespace o2::framework { @@ -60,6 +61,9 @@ struct is_messageable : std::conditional<(std::is_trivially_copyable::value | template struct is_messageable> : std::false_type { }; +template +struct is_messageable> : std::false_type { +}; // Detect a container by checking on the container properties // this is the default trait implementation inheriting from false_type @@ -107,7 +111,7 @@ template struct is_span : std::false_type { }; template -struct is_span> : std::is_same, T> { +struct is_span> : std::bool_constant, T> || std::is_same_v, T>> { }; // Detect whether a class has a ROOT dictionary diff --git a/Framework/Core/test/test_TypeTraits.cxx b/Framework/Core/test/test_TypeTraits.cxx index 5d38ca33c137c..58958b8e71fa5 100644 --- a/Framework/Core/test/test_TypeTraits.cxx +++ b/Framework/Core/test/test_TypeTraits.cxx @@ -135,9 +135,12 @@ TEST_CASE("TestIsSpan") gsl::span a; int b; std::vector c; + std::span d; REQUIRE(is_span::value == true); REQUIRE(is_span::value == false); REQUIRE(is_span::value == false); + REQUIRE(is_span::value == true); + REQUIRE(is_messageable::value == false); } template From a687e8455e2adc86a5fb6cc89f676d4498190ca3 Mon Sep 17 00:00:00 2001 From: David Rohr Date: Wed, 25 Nov 2026 14:38:43 +0100 Subject: [PATCH 2/2] GPU: Switch from gsl::span to std::span --- Detectors/TPC/workflow/src/ZSSpec.cxx | 10 +++++++--- .../TPC/workflow/src/convertDigitsToRawZS.cxx | 3 ++- GPU/GPUTracking/Base/GPUReconstructionConvert.cxx | 7 ++++--- GPU/GPUTracking/Global/GPUChainTrackingIO.cxx | 10 +++++----- .../Interface/GPUO2InterfaceConfiguration.h | 1 - GPU/GPUTracking/Interface/GPUO2InterfaceRefit.cxx | 2 +- GPU/GPUTracking/Interface/GPUO2InterfaceRefit.h | 4 ++-- GPU/GPUTracking/Interface/GPUO2InterfaceUtils.cxx | 4 ++-- GPU/GPUTracking/qa/GPUQA.h | 4 ++-- GPU/Workflow/src/GPUWorkflowSpec.cxx | 15 ++++++++------- 10 files changed, 33 insertions(+), 27 deletions(-) diff --git a/Detectors/TPC/workflow/src/ZSSpec.cxx b/Detectors/TPC/workflow/src/ZSSpec.cxx index 3fb13d520cdea..39cbfc5f5dea6 100644 --- a/Detectors/TPC/workflow/src/ZSSpec.cxx +++ b/Detectors/TPC/workflow/src/ZSSpec.cxx @@ -63,7 +63,7 @@ DataProcessorSpec getZSEncoderSpec(std::vector const& tpcSectors, bool outR std::string processorName = "tpc-zsEncoder"; constexpr static size_t NSectors = o2::tpc::Sector::MAXSECTOR; constexpr static size_t NEndpoints = o2::gpu::GPUTrackingInOutZS::NENDPOINTS; - using DigitArray = std::array, NSectors>; + using DigitArray = std::array, NSectors>; struct ProcessAttributes { std::unique_ptr zsoutput; @@ -113,9 +113,13 @@ DataProcessorSpec getZSEncoderSpec(std::vector const& tpcSectors, bool outR } const auto& inputs = getWorkflowTPCInput(pc, 0, false, false, tpcSectorMask, true); + DigitArray inputDigits; + for (size_t i = 0; i < NSectors; i++) { + inputDigits[i] = {inputs->inputDigits[i].data(), inputs->inputDigits[i].size()}; + } sizes.resize(NSectors * NEndpoints); o2::InteractionRecord ir{0, pc.services().get().firstTForbit}; - o2::gpu::GPUO2InterfaceUtils::RunZSEncoder(inputs->inputDigits, &zsoutput, sizes.data(), nullptr, &ir, processAttributes->config, 4, verify, false, digitsFilter); + o2::gpu::GPUO2InterfaceUtils::RunZSEncoder(inputDigits, &zsoutput, sizes.data(), nullptr, &ir, processAttributes->config, 4, verify, false, digitsFilter); ZeroSuppressedContainer8kb* page = reinterpret_cast(zsoutput.get()); unsigned int offset = 0; for (unsigned int i = 0; i < NSectors; i++) { @@ -168,7 +172,7 @@ DataProcessorSpec getZSEncoderSpec(std::vector const& tpcSectors, bool outR writer.useCaching(); } ir = o2::raw::HBFUtils::Instance().getFirstSampledTFIR(); - o2::gpu::GPUO2InterfaceUtils::RunZSEncoder(inputs->inputDigits, nullptr, nullptr, &writer, &ir, processAttributes->config, 4, false, false, digitsFilter); + o2::gpu::GPUO2InterfaceUtils::RunZSEncoder(inputDigits, nullptr, nullptr, &writer, &ir, processAttributes->config, 4, false, false, digitsFilter); writer.writeConfFile("TPC", "RAWDATA", fmt::format("{}tpcraw.cfg", outDir)); } zsoutput.reset(nullptr); diff --git a/Detectors/TPC/workflow/src/convertDigitsToRawZS.cxx b/Detectors/TPC/workflow/src/convertDigitsToRawZS.cxx index e55b35bdadf52..54a024c4759ea 100644 --- a/Detectors/TPC/workflow/src/convertDigitsToRawZS.cxx +++ b/Detectors/TPC/workflow/src/convertDigitsToRawZS.cxx @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include "TFile.h" @@ -53,7 +54,7 @@ using o2::MCCompLabel; constexpr static size_t NSectors = o2::tpc::Sector::MAXSECTOR; constexpr static size_t NEndpoints = o2::gpu::GPUTrackingInOutZS::NENDPOINTS; -using DigitArray = std::array, Sector::MAXSECTOR>; +using DigitArray = std::array, Sector::MAXSECTOR>; static constexpr const char* CRU_FLPS[361] = { "alio2-cr1-flp070", "alio2-cr1-flp069", "alio2-cr1-flp070", "alio2-cr1-flp069", "alio2-cr1-flp072", "alio2-cr1-flp071", "alio2-cr1-flp072", "alio2-cr1-flp071", "alio2-cr1-flp072", "alio2-cr1-flp071", "alio2-cr1-flp002", "alio2-cr1-flp001", "alio2-cr1-flp002", "alio2-cr1-flp001", "alio2-cr1-flp004", "alio2-cr1-flp003", "alio2-cr1-flp004", "alio2-cr1-flp003", diff --git a/GPU/GPUTracking/Base/GPUReconstructionConvert.cxx b/GPU/GPUTracking/Base/GPUReconstructionConvert.cxx index 441c15de289cb..c2eb1c4cd44dc 100644 --- a/GPU/GPUTracking/Base/GPUReconstructionConvert.cxx +++ b/GPU/GPUTracking/Base/GPUReconstructionConvert.cxx @@ -30,6 +30,7 @@ #include "GPULogging.h" #include #include +#include #include "clusterFinderDefs.h" #include "DataFormatsTPC/ZeroSuppression.h" @@ -208,7 +209,7 @@ inline void zsEncoder::ZSstreamOut(uint16_t* bufIn, uint32_t& lenIn, uint8_t* bu static inline auto ZSEncoderGetDigits(const GPUTrackingInOutDigits& in, int32_t i) { return in.tpcDigits[i]; } static inline auto ZSEncoderGetNDigits(const GPUTrackingInOutDigits& in, int32_t i) { return in.nTPCDigits[i]; } #ifndef GPUCA_STANDALONE -using DigitArray = std::array, o2::tpc::Sector::MAXSECTOR>; +using DigitArray = std::array, o2::tpc::Sector::MAXSECTOR>; static inline auto ZSEncoderGetDigits(const DigitArray& in, int32_t i) { return in[i].data(); } static inline auto ZSEncoderGetNDigits(const DigitArray& in, int32_t i) { return in[i].size(); } #endif @@ -1142,7 +1143,7 @@ inline uint32_t zsEncoderRun::run(std::vector* buffer, std::vector(size); #ifndef GPUCA_STANDALONE if (raw) { - raw->addData(rawfeeid, rawcru, 0, rawendpoint, *ir + hbf * o2::constants::lhc::LHCMaxBunches, gsl::span((char*)page + sizeof(o2::header::RAWDataHeader), (char*)page + size), true, 0, 2); + raw->addData(rawfeeid, rawcru, 0, rawendpoint, *ir + hbf * o2::constants::lhc::LHCMaxBunches, std::span((char*)page + sizeof(o2::header::RAWDataHeader), (char*)page + size), true, 0, 2); maxhbf = std::max(maxhbf, hbf); minhbf = std::min(minhbf, hbf); } else @@ -1222,7 +1223,7 @@ inline uint32_t zsEncoderRun::run(std::vector* buffer, std::vectoraddData(46208, 360, rdh_utils::SACLinkID, 0, *ir + i * o2::constants::lhc::LHCMaxBunches, gsl::span((char*)&singleBuffer, (char*)&singleBuffer), true, 0, 4); + raw->addData(46208, 360, rdh_utils::SACLinkID, 0, *ir + i * o2::constants::lhc::LHCMaxBunches, std::span((char*)&singleBuffer, (char*)&singleBuffer), true, 0, 4); } } #endif diff --git a/GPU/GPUTracking/Global/GPUChainTrackingIO.cxx b/GPU/GPUTracking/Global/GPUChainTrackingIO.cxx index 909581e5c6c04..f498f27532fa4 100644 --- a/GPU/GPUTracking/Global/GPUChainTrackingIO.cxx +++ b/GPU/GPUTracking/Global/GPUChainTrackingIO.cxx @@ -45,11 +45,11 @@ #include "CalibdEdxContainer.h" #include "TPCFastTransformPOD.h" - -using namespace o2::gpu; - #include "GPUO2DataTypes.h" +#include + +using namespace o2::gpu; using namespace o2::tpc; using namespace o2::trd; using namespace o2::dataformats; @@ -195,7 +195,7 @@ int32_t GPUChainTracking::ReadData(const char* filename) mIOPtrs.clustersNative = mIOMem.clusterNativeAccess.get(); std::pair tmp = {nullptr, 0}; if (ReadData(fp, &tmp.first, &tmp.second, &mIOMem.clusterNativeMC, InOutPointerType::CLUSTER_NATIVE_MC)) { - mIOMem.clusterNativeMCView = std::make_unique(gsl::span(tmp.first, tmp.first + tmp.second)); + mIOMem.clusterNativeMCView = std::make_unique(std::span(tmp.first, tmp.first + tmp.second)); mIOMem.clusterNativeAccess->clustersMCTruth = mIOMem.clusterNativeMCView.get(); } } @@ -209,7 +209,7 @@ int32_t GPUChainTracking::ReadData(const char* filename) mIOMem.tpcDigitMCView.reset(new ConstMCLabelContainerView[NSECTORS]); for (uint32_t i = 0; i < NSECTORS; i++) { if (sizes[i]) { - mIOMem.tpcDigitMCView.get()[i] = gsl::span(ptrs[i], ptrs[i] + sizes[i]); + mIOMem.tpcDigitMCView.get()[i] = std::span(ptrs[i], ptrs[i] + sizes[i]); mIOMem.tpcDigitMCMap->v[i] = mIOMem.tpcDigitMCView.get() + i; } else { mIOMem.tpcDigitMCMap->v[i] = nullptr; diff --git a/GPU/GPUTracking/Interface/GPUO2InterfaceConfiguration.h b/GPU/GPUTracking/Interface/GPUO2InterfaceConfiguration.h index b63c0585d3e2f..ae569327f82ca 100644 --- a/GPU/GPUTracking/Interface/GPUO2InterfaceConfiguration.h +++ b/GPU/GPUTracking/Interface/GPUO2InterfaceConfiguration.h @@ -26,7 +26,6 @@ #include #include #include -#include // TODO: Get rid of gsl class TH1F; class TH1D; diff --git a/GPU/GPUTracking/Interface/GPUO2InterfaceRefit.cxx b/GPU/GPUTracking/Interface/GPUO2InterfaceRefit.cxx index aa9a036c4fb41..69c363104fd93 100644 --- a/GPU/GPUTracking/Interface/GPUO2InterfaceRefit.cxx +++ b/GPU/GPUTracking/Interface/GPUO2InterfaceRefit.cxx @@ -25,7 +25,7 @@ using namespace o2::gpu; using namespace o2::tpc; -void GPUO2InterfaceRefit::fillSharedClustersAndOccupancyMap(const ClusterNativeAccess* cl, const gsl::span trks, const TPCClRefElem* trackRef, uint8_t* shmap, uint32_t* ocmap, uint32_t nHbfPerTf, const GPUParam* param) +void GPUO2InterfaceRefit::fillSharedClustersAndOccupancyMap(const ClusterNativeAccess* cl, const std::span trks, const TPCClRefElem* trackRef, uint8_t* shmap, uint32_t* ocmap, uint32_t nHbfPerTf, const GPUParam* param) { if (!cl || (!shmap && cl->nClustersTotal > 0)) { throw std::runtime_error("Must provide clusters access and preallocated buffer for shared map"); diff --git a/GPU/GPUTracking/Interface/GPUO2InterfaceRefit.h b/GPU/GPUTracking/Interface/GPUO2InterfaceRefit.h index 052f728821cac..089cb842a3189 100644 --- a/GPU/GPUTracking/Interface/GPUO2InterfaceRefit.h +++ b/GPU/GPUTracking/Interface/GPUO2InterfaceRefit.h @@ -19,7 +19,7 @@ #include #include #include -#include +#include namespace o2::base { @@ -79,7 +79,7 @@ class GPUO2InterfaceRefit // If the param object / default object requires an occupancy map, an occupancy map ptr and nHbfPerTf value must be provided. // You can use the function fillOccupancyMapGetSize(...) to get the required size of the occupancy map. If 0 is returned, no map is required. // Providing only the shmap ptr but no ocmap ptr will create only the shared map, but no occupancy map. - static void fillSharedClustersAndOccupancyMap(const o2::tpc::ClusterNativeAccess* cl, const gsl::span trks, const o2::tpc::TPCClRefElem* trackRef, uint8_t* shmap, uint32_t* ocmap = nullptr, uint32_t nHbfPerTf = 0, const GPUParam* param = nullptr); + static void fillSharedClustersAndOccupancyMap(const o2::tpc::ClusterNativeAccess* cl, const std::span trks, const o2::tpc::TPCClRefElem* trackRef, uint8_t* shmap, uint32_t* ocmap = nullptr, uint32_t nHbfPerTf = 0, const GPUParam* param = nullptr); static size_t fillOccupancyMapGetSize(uint32_t nHbfPerTf, const GPUParam* param = nullptr); private: diff --git a/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.cxx b/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.cxx index b5a6ef14bd907..7c48898965422 100644 --- a/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.cxx +++ b/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.cxx @@ -27,11 +27,11 @@ #include "TPCBase/RDHUtils.h" #include "DataFormatsTPC/ZeroSuppression.h" #include "GPUTPCClusterOccupancyMap.h" -#include +#include using namespace o2::gpu; -using DigitArray = std::array, o2::tpc::Sector::MAXSECTOR>; +using DigitArray = std::array, o2::tpc::Sector::MAXSECTOR>; std::unique_ptr GPUO2InterfaceUtils::getPadGainCalibDefault() { diff --git a/GPU/GPUTracking/qa/GPUQA.h b/GPU/GPUTracking/qa/GPUQA.h index f236498a858c6..a92cf0173d35f 100644 --- a/GPU/GPUTracking/qa/GPUQA.h +++ b/GPU/GPUTracking/qa/GPUQA.h @@ -69,7 +69,7 @@ class GPUQA #include #include #ifndef GPUCA_RUN2 -#include +#include #endif namespace o2 @@ -103,7 +103,7 @@ class GPUQA ~GPUQA(); #ifndef GPUCA_RUN2 - using mcLabels_t = gsl::span; + using mcLabels_t = std::span; using mcLabel_t = o2::MCCompLabel; using mcLabelI_t = mcLabel_t; #else diff --git a/GPU/Workflow/src/GPUWorkflowSpec.cxx b/GPU/Workflow/src/GPUWorkflowSpec.cxx index 5fa9be0fecb25..15f07ead20ddd 100644 --- a/GPU/Workflow/src/GPUWorkflowSpec.cxx +++ b/GPU/Workflow/src/GPUWorkflowSpec.cxx @@ -101,6 +101,7 @@ #include #include #include +#include using namespace o2::framework; using namespace o2::header; @@ -426,7 +427,7 @@ void GPURecoWorkflowSpec::processInputs(ProcessingContext& pc, D& tpcZSmeta, E& if (recv) { throw std::runtime_error("Received multiple TPCZS data"); } - inputZS = pc.inputs().get>(ref); + inputZS = pc.inputs().get>(ref); recv = true; } if (!recv || !recvsizes) { @@ -540,7 +541,7 @@ void GPURecoWorkflowSpec::run(ProcessingContext& pc) mTimer->Start(false); mNTFs++; - std::vector> inputs; + std::vector> inputs; const o2::tpc::CompressedClustersFlat* pCompClustersFlat = nullptr; size_t compClustersFlatDummyMemory[(sizeof(o2::tpc::CompressedClustersFlat) + sizeof(size_t) - 1) / sizeof(size_t)]; @@ -549,7 +550,7 @@ void GPURecoWorkflowSpec::run(ProcessingContext& pc) o2::gpu::GPUTrackingInOutZS tpcZS; GPURecoWorkflowSpec_TPCZSBuffers tpcZSmeta; std::array tpcZSonTheFlySizes; - gsl::span inputZS; + std::span inputZS; std::unique_ptr tmpEmptyCompClusters; bool getWorkflowTPCInput_clusters = false, getWorkflowTPCInput_mc = false, getWorkflowTPCInput_digits = false; @@ -853,7 +854,7 @@ void GPURecoWorkflowSpec::run(ProcessingContext& pc) FILE* fp = fopen(filename.c_str(), "w+b"); std::vector filter = {{"check", ConcreteDataTypeMatcher{gDataOriginTPC, "RAWDATA"}, Lifetime::Timeframe}}; for (auto const& ref : InputRecordWalker(pc.inputs(), filter)) { - auto data = pc.inputs().get>(ref); + auto data = pc.inputs().get>(ref); if (mConfParam->dumpBadTFMode == 1) { uint64_t size = data.size(); fwrite(&size, 1, sizeof(size), fp); @@ -917,9 +918,9 @@ void GPURecoWorkflowSpec::run(ProcessingContext& pc) tmpEmptyClNative->clustersMCTruth = &clustersMCBuffer.second; } } else { - gsl::span spanOutputTracks = {ptrs.outputTracksTPCO2, ptrs.nOutputTracksTPCO2}; - gsl::span spanOutputClusRefs = {ptrs.outputClusRefsTPCO2, ptrs.nOutputClusRefsTPCO2}; - gsl::span spanOutputTracksMCTruth = {ptrs.outputTracksTPCO2MC, ptrs.outputTracksTPCO2MC ? ptrs.nOutputTracksTPCO2 : 0}; + std::span spanOutputTracks = {ptrs.outputTracksTPCO2, ptrs.nOutputTracksTPCO2}; + std::span spanOutputClusRefs = {ptrs.outputClusRefsTPCO2, ptrs.nOutputClusRefsTPCO2}; + std::span spanOutputTracksMCTruth = {ptrs.outputTracksTPCO2MC, ptrs.outputTracksTPCO2MC ? ptrs.nOutputTracksTPCO2 : 0}; if (!mConfParam->allocateOutputOnTheFly) { for (uint32_t i = 0; i < outputRegions.count(); i++) { if (outputRegions.asArray()[i].ptrBase) {