From fb8ccce715a5f7a64d23161a75b0f3679cf7c2c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barth=C3=A9l=C3=A9my=20von=20Haller?= Date: Tue, 29 Oct 2024 00:40:47 +0100 Subject: [PATCH] [QC-1227] Get beam type from PDP parameter (#2461) * [QC-1227] Get beam type from PDP parameter * remove useless line * Update runnerUtils.cxx Warn if we can't convert * Update runnerUtils.cxx --- .../include/QualityControl/runnerUtils.h | 2 ++ Framework/src/runnerUtils.cxx | 22 +++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Framework/include/QualityControl/runnerUtils.h b/Framework/include/QualityControl/runnerUtils.h index b54dbcc3aa..2e864f4d1f 100644 --- a/Framework/include/QualityControl/runnerUtils.h +++ b/Framework/include/QualityControl/runnerUtils.h @@ -86,6 +86,8 @@ uint64_t getCurrentTimestamp(); void initInfologger(framework::InitContext& iCtx, core::LogDiscardParameters infologgerDiscardParameters, std::string facility, std::string detectorName = ""); +std::string translateBeamType(const std::string& pdpBeamType); + } // namespace o2::quality_control::core #endif // QUALITYCONTROL_RUNNERUTILS_H diff --git a/Framework/src/runnerUtils.cxx b/Framework/src/runnerUtils.cxx index ea000e4669..4532ef33d8 100644 --- a/Framework/src/runnerUtils.cxx +++ b/Framework/src/runnerUtils.cxx @@ -91,6 +91,23 @@ std::string computeStringActivityField(framework::ServiceRegistryRef services, c return property; } +std::string translateBeamType(const std::string& pdpBeamType) +{ + // convert the beam type received from pdp into the format we use in flp/ecs + std::string result = ""; + if (pdpBeamType == "pp") { + result = "PROTON-PROTON"; + } else if (pdpBeamType == "PbPb") { + result = "Pb-Pb"; + } else if (pdpBeamType == "pPb") { + result = "Pb-PROTON"; + } else { + ILOG(Warning, Ops) << "Failed to convert the pdp beam type ('" << pdpBeamType << "'), returning an empty string" << ENDM; + } + ILOG(Debug, Devel) << "Translated pdp beam type '" << pdpBeamType << "' to '" << result << "'" << ENDM; + return result; +} + Activity computeActivity(framework::ServiceRegistryRef services, const Activity& fallbackActivity) { // for a complete list of the properties provided by ECS, see here: https://github.com/AliceO2Group/Control/blob/master/docs/handbook/configuration.md#variables-pushed-to-controlled-tasks @@ -102,7 +119,8 @@ Activity computeActivity(framework::ServiceRegistryRef services, const Activity& auto partitionName = computeStringActivityField(services, "environment_id", fallbackActivity.mPartitionName); auto periodName = computeStringActivityField(services, "lhc_period", fallbackActivity.mPeriodName); auto fillNumber = computeNumericalActivityField(services, "fill_info_fill_number", fallbackActivity.mFillNumber); - auto beam_type = computeStringActivityField(services, "fill_info_beam_type", fallbackActivity.mBeamType); + auto beam_type = computeStringActivityField(services, "pdp_beam_type", fallbackActivity.mBeamType); + beam_type = translateBeamType(beam_type); Activity activity( runNumber, @@ -201,4 +219,4 @@ void initInfologger(framework::InitContext& iCtx, core::LogDiscardParameters inf } } -} // namespace o2::quality_control::core \ No newline at end of file +} // namespace o2::quality_control::core