From 9058bfc033cf3c2e65a407322faad5f14cfbee21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADt=20Ku=C4=8Dera?= <26327373+vkucera@users.noreply.github.com> Date: Tue, 1 Dec 2026 23:39:52 +0100 Subject: [PATCH] Remove runtime asserts --- PWGHF/D2H/Tasks/taskCharmPolarisation.cxx | 16 ++++++++++------ PWGHF/D2H/Utils/utilsFlow.h | 4 +++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx b/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx index db34b9de314..3749e0cc14d 100644 --- a/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx +++ b/PWGHF/D2H/Tasks/taskCharmPolarisation.cxx @@ -364,7 +364,7 @@ struct HfTaskCharmPolarisation { std::string hAxisName = "Rotated cos(#vartheta_{EP}) with" + std::to_string(axisRotationAngle) + " rad"; const AxisSpec thnAxisCosThetaStarEP{configThnAxisCosThetaStarEP, activateAxisRotation ? hAxisName.c_str() : "cos(#vartheta_{EP})"}; // reaction plane // const AxisSpec thnAxisCosThetaStarEP{configThnAxisCosThetaStarEP, "cos(#vartheta_{EP})"}; // reaction plane - const AxisSpec thnAxisCosPhiStarEP{configThnAxisCosPhiStarEP, "cos(2#varphi_{EP})"}; // reaction plane + const AxisSpec thnAxisCosPhiStarEP{configThnAxisCosPhiStarEP, "cos(2#varphi_{EP})"}; // reaction plane const AxisSpec thnAxisCosSqThetaStarEP{configThnAxisCosSqThetaStarEP, "cos^{2}(#vartheta_{EP})"}; // reaction plane const AxisSpec thnAxisMlBkg{configThnAxisMlBkg, "ML bkg"}; const AxisSpec thnAxisMlNonPrompt{configThnAxisMlNonPrompt, "ML non-prompt"}; @@ -1987,8 +1987,12 @@ struct HfTaskCharmPolarisation { bool runPolarisationAnalysis(Cand const& candidate, int bkgRotationId, T numPvContributors, Part const& particles, Trk const& /*tracks*/, float centrality = -999.f, QVecs const* qVecs = nullptr) { if constexpr (WithEp && !DoMc) { - assert(qVecs && "EP analysis requested but qVecs == nullptr"); - assert(centrality && "EP analysis requested but centrality == nullptr"); + if (qVecs == nullptr) { + LOGF(fatal, "EP analysis requested but qVecs == nullptr"); + } + if (centrality < -900.f) { + LOGF(fatal, "EP analysis requested but centrality is invalid"); + } } constexpr std::size_t NScores{3u}; @@ -2590,9 +2594,9 @@ struct HfTaskCharmPolarisation { void runMcGenPolarisationAnalysis(Part const& mcParticle, Particles const& mcParticles, T numPvContributors, Cent const* centrality = nullptr) { if constexpr (WithCent) { - assert(qVecs && "Centrality analysis requested but Cent == nullptr"); - } - if constexpr (WithCent) { + if (centrality == nullptr) { + LOGF(fatal, "Centrality analysis requested but centrality == nullptr"); + } if (*centrality < centralityMin || *centrality > centralityMax) { return; // skip this collision if outside of the centrality range } diff --git a/PWGHF/D2H/Utils/utilsFlow.h b/PWGHF/D2H/Utils/utilsFlow.h index 70a4927c13b..18de5a66951 100644 --- a/PWGHF/D2H/Utils/utilsFlow.h +++ b/PWGHF/D2H/Utils/utilsFlow.h @@ -73,7 +73,9 @@ class HfQVectorResoHelper /// Direct array access with simple float return type float operator[](size_t index) const { - assert(mResoValues != nullptr && "CCDB resolution array accessed before initialization!"); + if (mResoValues == nullptr) { + LOGF(fatal, "CCDB resolution array accessed before initialization!"); + } return (*mResoValues)[index]; }