Skip to content

[PWGHF] Fix D0 ML prompt and non-prompt score ordering#17173

Merged
zhangbiao-phy merged 1 commit into
AliceO2Group:masterfrom
zhangbiao-phy:fix-tof-empty-collision-tables
Jul 23, 2026
Merged

[PWGHF] Fix D0 ML prompt and non-prompt score ordering#17173
zhangbiao-phy merged 1 commit into
AliceO2Group:masterfrom
zhangbiao-phy:fix-tof-empty-collision-tables

Conversation

@zhangbiao-phy

@zhangbiao-phy zhangbiao-phy commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

I received several reports from different analysers about the D0 BDT score ordering, which has caused some confusion.

This PR fixes the D0 ML score class ordering used in the D0 task and ML response helper.

The D0 ML output vector follows the common charm-hadron convention:

  • index 0: background
  • index 1: prompt
  • index 2: non-prompt

The previous code interpreted indices 1 and 2 as non-prompt and prompt in some places. This update aligns the D0 ML feature mapping and THnSparse axis ordering with the model output convention and with the convention used by other charm-hadron tasks.

The ML selection cut directions are unchanged. For o2-analysis-hf-candidate-selector-d0, cutDirMl should remain:

  • 0 for the background score
  • 1 for the prompt score
  • 1 for the non-prompt score

i.e. cutDirMl = 0,1,1.

Tagging D0 task users: @Mingyu3360715 @wuctlby @xinyepeng @kgwizdzi @atavirag

Please let me know if you have any comments on this! Thanks a lot!

@github-actions github-actions Bot added the pwghf PWG-HF label Jul 22, 2026
@github-actions

Copy link
Copy Markdown

O2 linter results: ❌ 0 errors, ⚠️ 0 warnings, 🔕 0 disabled

@github-actions github-actions Bot changed the title Fix D0 ML prompt and non-prompt score ordering [PWGHF] Fix D0 ML prompt and non-prompt score ordering Jul 22, 2026
@zhangbiao-phy
zhangbiao-phy marked this pull request as ready for review July 22, 2026 16:53
@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for 2167cb7 at 2026-07-22 19:31:

## sw/BUILD/O2Physics-code-check-latest/log
--
========== List of issues found ==========
++ echo 'Found 14 errors and 0 warnings.'
Found 14 errors and 0 warnings.
++ [[ 14 -gt 0 ]]
++ cat /sw/BUILD/5c493efe7d3fb384c62dfd6adf1ba15666c4c360/O2Physics-code-check/errors.txt
PWGHF/Core/HfMlResponseD0ToKPi.h:42:9: error: function-like macro 'CHECK_AND_FILL_VEC_D0_FULL' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage,-warnings-as-errors]
PWGHF/Core/HfMlResponseD0ToKPi.h:44:32: error: macro argument should be enclosed in parentheses [bugprone-macro-parentheses,-warnings-as-errors]
PWGHF/Core/HfMlResponseD0ToKPi.h:50:9: error: function-like macro 'CHECK_AND_FILL_VEC_D0' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage,-warnings-as-errors]
PWGHF/Core/HfMlResponseD0ToKPi.h:58:9: error: function-like macro 'CHECK_AND_FILL_VEC_D0_HFHELPER' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage,-warnings-as-errors]
PWGHF/Core/HfMlResponseD0ToKPi.h:67:9: error: function-like macro 'CHECK_AND_FILL_VEC_D0_HFHELPER_SIGNED' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage,-warnings-as-errors]
PWGHF/Core/HfMlResponseD0ToKPi.h:80:9: error: function-like macro 'CHECK_AND_FILL_VEC_D0_OBJECT_HFHELPER_SIGNED' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage,-warnings-as-errors]
PWGHF/Core/HfMlResponseD0ToKPi.h:83:34: error: macro argument should be enclosed in parentheses [bugprone-macro-parentheses,-warnings-as-errors]
PWGHF/Core/HfMlResponseD0ToKPi.h:85:34: error: macro argument should be enclosed in parentheses [bugprone-macro-parentheses,-warnings-as-errors]
PWGHF/Core/HfMlResponseD0ToKPi.h:93:9: error: function-like macro 'CHECK_AND_FILL_VEC_D0_SIGNED' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage,-warnings-as-errors]
PWGHF/Core/HfMlResponseD0ToKPi.h:96:34: error: macro argument should be enclosed in parentheses [bugprone-macro-parentheses,-warnings-as-errors]
PWGHF/Core/HfMlResponseD0ToKPi.h:98:34: error: macro argument should be enclosed in parentheses [bugprone-macro-parentheses,-warnings-as-errors]
PWGHF/Core/HfMlResponseD0ToKPi.h:107:9: error: function-like macro 'CHECK_AND_FILL_VEC_D0_ML' used; consider a 'constexpr' template function [cppcoreguidelines-macro-usage,-warnings-as-errors]
PWGHF/Core/HfMlResponseD0ToKPi.h:111:36: error: macro argument should be enclosed in parentheses [bugprone-macro-parentheses,-warnings-as-errors]
PWGHF/Core/HfMlResponseD0ToKPi.h:113:36: error: macro argument should be enclosed in parentheses [bugprone-macro-parentheses,-warnings-as-errors]
++ [[ 0 -gt 0 ]]
++ [[ 14 -gt 0 ]]
++ exit 1
--

Full log here.

@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/staging for 2167cb7 at 2026-07-23 09:34:

## sw/BUILD/O2Physics-latest/log
2026-07-23T07:04:07.023+0200 [12640:140423604657792] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "ByteStream.Write()", last gRPC error was [14: Socket closed]
2026-07-23T07:04:07.063+0200 [12640:140423604657792] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "ActionCache.UpdateActionResult()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]
2026-07-23T07:04:10.015+0200 [13597:139909783957120] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "FindMissingBlobs()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]
2026-07-23T07:04:11.312+0200 [13438:140709773299328] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "FindMissingBlobs()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]
2026-07-23T07:04:15.412+0200 [13619:140008781651584] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "FindMissingBlobs()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]
2026-07-23T07:04:19.717+0200 [12703:140172682636928] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "FindMissingBlobs()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]
2026-07-23T07:04:22.508+0200 [13694:139723122564736] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "FindMissingBlobs()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]
2026-07-23T07:04:16.648+0200 [14284:140272999440000] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "ActionCache.GetActionResult()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]
2026-07-23T07:04:16.648+0200 [14284:140272999440000] [executioncontext.cpp:544] [ERROR] Error while querying action cache at "http://localhost:8980": 14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused
2026-07-23T07:04:11.547+0200 [14188:140464772664960] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "ActionCache.GetActionResult()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]
2026-07-23T07:04:11.547+0200 [14188:140464772664960] [executioncontext.cpp:544] [ERROR] Error while querying action cache at "http://localhost:8980": 14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused
2026-07-23T07:04:08.703+0200 [14155:139868444892800] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "ActionCache.GetActionResult()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]
2026-07-23T07:04:08.703+0200 [14155:139868444892800] [executioncontext.cpp:544] [ERROR] Error while querying action cache at "http://localhost:8980": 14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused
2026-07-23T07:04:13.002+0200 [14214:140464972881536] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "ActionCache.GetActionResult()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]
2026-07-23T07:04:13.002+0200 [14214:140464972881536] [executioncontext.cpp:544] [ERROR] Error while querying action cache at "http://localhost:8980": 14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused
2026-07-23T07:04:15.581+0200 [14263:140248867401344] [buildboxcommon_grpcretrier.cpp:177] [ERROR] Retry limit (0) exceeded for "ActionCache.GetActionResult()", last gRPC error was [14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused]
2026-07-23T07:04:15.581+0200 [14263:140248867401344] [executioncontext.cpp:544] [ERROR] Error while querying action cache at "http://localhost:8980": 14: failed to connect to all addresses; last error: UNKNOWN: ipv4:127.0.0.1:8980: Failed to connect to remote host: Connection refused
c++: fatal error: Killed signal terminated program cc1plus
ninja: build stopped: subcommand failed.

Full log here.

@wuctlby

wuctlby commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Hi @zhangbiao-phy , thanks a lot for the implementation! It looks good to me. As you tagged all the D0 analysers, just a reminder, the order of the BDT responses is also related to that used in local training. That's saying the order in local training should also be:

  • index 0: background
  • index 1: prompt
  • index 2: non-prompt

@zhangbiao-phy
zhangbiao-phy enabled auto-merge (squash) July 23, 2026 13:04

@alibuild alibuild left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-approving on behalf of @zhangbiao-phy.

@zhangbiao-phy
zhangbiao-phy merged commit 96f9444 into AliceO2Group:master Jul 23, 2026
17 of 18 checks passed
@vkucera

vkucera commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

@zhangbiao-phy Please keep in mind that D0 task users are just a subset of the ML response users. If I understand correctly, this affects everyone who applies ML cuts on D0 selection, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pwghf PWG-HF

Development

Successfully merging this pull request may close these issues.

4 participants