Skip to content

Commit

Permalink
[QC-1227] Get beam type from PDP parameter (#2461)
Browse files Browse the repository at this point in the history
* [QC-1227] Get beam type from PDP parameter

* remove useless line

* Update runnerUtils.cxx

Warn if we can't convert

* Update runnerUtils.cxx
  • Loading branch information
Barthelemy authored Oct 28, 2024
1 parent 4c981fb commit fb8ccce
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Framework/include/QualityControl/runnerUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 20 additions & 2 deletions Framework/src/runnerUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<int>(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,
Expand Down Expand Up @@ -201,4 +219,4 @@ void initInfologger(framework::InitContext& iCtx, core::LogDiscardParameters inf
}
}

} // namespace o2::quality_control::core
} // namespace o2::quality_control::core

0 comments on commit fb8ccce

Please sign in to comment.