From c4f9811d15d072b8c9a6aba226f57b775c21263e Mon Sep 17 00:00:00 2001 From: David Rohr Date: Fri, 8 Nov 2024 15:07:49 +0100 Subject: [PATCH] GPU: Add GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf and remove copy&paste --- Detectors/TPC/workflow/src/EntropyEncoderSpec.cxx | 2 +- GPU/GPUTracking/Interface/GPUO2InterfaceUtils.cxx | 7 ++++++- GPU/GPUTracking/Interface/GPUO2InterfaceUtils.h | 1 + GPU/Workflow/src/GPUWorkflowSpec.cxx | 4 ++-- GPU/Workflow/src/O2GPUDPLDisplay.cxx | 2 +- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Detectors/TPC/workflow/src/EntropyEncoderSpec.cxx b/Detectors/TPC/workflow/src/EntropyEncoderSpec.cxx index 8cca67f65f275..b81cb9a802a4a 100644 --- a/Detectors/TPC/workflow/src/EntropyEncoderSpec.cxx +++ b/Detectors/TPC/workflow/src/EntropyEncoderSpec.cxx @@ -92,7 +92,7 @@ void EntropyEncoderSpec::run(ProcessingContext& pc) LOG(fatal) << "configKeyValue tpcTriggeredMode does not match GRP isDetContinuousReadOut(TPC) setting"; } - mConfig->configGRP.grpContinuousMaxTimeBin = (GRPGeomHelper::instance().getGRPECS()->getNHBFPerTF() * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN; + mConfig->configGRP.grpContinuousMaxTimeBin = GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf(GRPGeomHelper::instance().getGRPECS()->getNHBFPerTF()); mConfig->configGRP.solenoidBzNominalGPU = GPUO2InterfaceUtils::getNominalGPUBz(*GRPGeomHelper::instance().getGRPMagField()); mParam->UpdateSettings(&mConfig->configGRP); diff --git a/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.cxx b/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.cxx index c765909fd879f..fa5705e903d1a 100644 --- a/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.cxx +++ b/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.cxx @@ -108,7 +108,7 @@ std::unique_ptr GPUO2InterfaceUtils::getFullParam(float solenoidBz, ui *autoMaxTimeBin = (*pConfiguration)->configGRP.grpContinuousMaxTimeBin == -1; } if ((*pConfiguration)->configGRP.grpContinuousMaxTimeBin == -1) { - (*pConfiguration)->configGRP.grpContinuousMaxTimeBin = (nHbfPerTf * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN; + (*pConfiguration)->configGRP.grpContinuousMaxTimeBin = GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf(nHbfPerTf); } retVal->SetDefaults(&(*pConfiguration)->configGRP, &(*pConfiguration)->configReconstruction, &(*pConfiguration)->configProcessing, nullptr); return retVal; @@ -135,3 +135,8 @@ void GPUO2InterfaceUtils::paramUseExternalOccupancyMap(GPUParam* param, uint32_t } } } + +uint32_t GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf(uint32_t nHbf) +{ + return (nHbf * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN; +} diff --git a/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.h b/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.h index 7b96326387f59..0b5d2b5aa3f7a 100644 --- a/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.h +++ b/GPU/GPUTracking/Interface/GPUO2InterfaceUtils.h @@ -58,6 +58,7 @@ class GPUO2InterfaceUtils static std::unique_ptr getFullParam(float solenoidBz, uint32_t nHbfPerTf = 0, std::unique_ptr* pConfiguration = nullptr, std::unique_ptr* pO2Settings = nullptr, bool* autoMaxTimeBin = nullptr); static std::shared_ptr getFullParamShared(float solenoidBz, uint32_t nHbfPerTf = 0, std::unique_ptr* pConfiguration = nullptr, std::unique_ptr* pO2Settings = nullptr, bool* autoMaxTimeBin = nullptr); // Return owning pointer static void paramUseExternalOccupancyMap(GPUParam* param, uint32_t nHbfPerTf, const uint32_t* occupancymap, int32_t occupancyMapSize); + static uint32_t getTpcMaxTimeBinFromNHbf(uint32_t nHbf); class GPUReconstructionZSDecoder { diff --git a/GPU/Workflow/src/GPUWorkflowSpec.cxx b/GPU/Workflow/src/GPUWorkflowSpec.cxx index fcf27074ca717..0360a352b0a90 100644 --- a/GPU/Workflow/src/GPUWorkflowSpec.cxx +++ b/GPU/Workflow/src/GPUWorkflowSpec.cxx @@ -156,7 +156,7 @@ void GPURecoWorkflowSpec::init(InitContext& ic) mAutoSolenoidBz = mConfParam->solenoidBzNominalGPU == -1e6f; mAutoContinuousMaxTimeBin = mConfig->configGRP.grpContinuousMaxTimeBin < 0; if (mAutoContinuousMaxTimeBin) { - mConfig->configGRP.grpContinuousMaxTimeBin = ((mConfParam->overrideNHbfPerTF ? mConfParam->overrideNHbfPerTF : 256) * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN; + mConfig->configGRP.grpContinuousMaxTimeBin = GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf(mConfParam->overrideNHbfPerTF ? mConfParam->overrideNHbfPerTF : 256); } if (mConfig->configProcessing.deviceNum == -2) { int32_t myId = ic.services().get().inputTimesliceId; @@ -1013,7 +1013,7 @@ void GPURecoWorkflowSpec::doCalibUpdates(o2::framework::ProcessingContext& pc, c LOG(info) << "Updating solenoid field " << newCalibValues.solenoidField; } if (mAutoContinuousMaxTimeBin) { - mConfig->configGRP.grpContinuousMaxTimeBin = (mTFSettings->nHBFPerTF * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN; + mConfig->configGRP.grpContinuousMaxTimeBin = GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf(mTFSettings->nHBFPerTF); newCalibValues.newContinuousMaxTimeBin = true; newCalibValues.continuousMaxTimeBin = mConfig->configGRP.grpContinuousMaxTimeBin; LOG(info) << "Updating max time bin " << newCalibValues.continuousMaxTimeBin << " (" << mTFSettings->nHBFPerTF << " orbits)"; diff --git a/GPU/Workflow/src/O2GPUDPLDisplay.cxx b/GPU/Workflow/src/O2GPUDPLDisplay.cxx index 6946d65915503..8513541bcae43 100644 --- a/GPU/Workflow/src/O2GPUDPLDisplay.cxx +++ b/GPU/Workflow/src/O2GPUDPLDisplay.cxx @@ -115,7 +115,7 @@ void O2GPUDPLDisplaySpec::run(ProcessingContext& pc) mGRPGeomUpdated = false; mConfig->configGRP.solenoidBzNominalGPU = GPUO2InterfaceUtils::getNominalGPUBz(*GRPGeomHelper::instance().getGRPMagField()); if (mAutoContinuousMaxTimeBin) { - mConfig->configGRP.grpContinuousMaxTimeBin = (mTFSettings->nHBFPerTF * o2::constants::lhc::LHCMaxBunches + 2 * o2::tpc::constants::LHCBCPERTIMEBIN - 2) / o2::tpc::constants::LHCBCPERTIMEBIN; + mConfig->configGRP.grpContinuousMaxTimeBin = GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf(mTFSettings->nHBFPerTF); } mDisplay->UpdateGRP(&mConfig->configGRP); if (mGeometryCreated == 0) {