Skip to content

[PWGJE] Add Particle Transformer b-jet tagger to jetTaggerHF - #18409

Merged
nzardosh merged 1 commit into
AliceO2Group:masterfrom
ahmadtabikh:part-implementation
Oct 26, 2026
Merged

nzardosh merged 1 commit into
AliceO2Group:masterfrom
ahmadtabikh:part-implementation

Conversation

@ahmadtabikh

Copy link
Copy Markdown
Contributor

Adds a Particle Transformer (ParT) b-jet tagger to jetTaggerHF, alongside the existing GNN tagger. It writes its D_b score to the same scoreML / tagging tables.

  1. jetTaggerHF.cxx: new `processAlgorithmParT (data and MCD, off by default) and a part ConfigurableGroup (nConstit, nFeat, nVec, padWrap, minTracks). The model is loaded from CCDB or from a local file.
  2. JetTaggingUtilities.h: analyzeJetTrackInfo4ParT() builds the 10 per-constituent features and the 4-vector. getDbFromProb() computes D_b directly from the probabilities, with no softmax since the exported model already applies it.
  3. MlResponseHfTagging.h: ParTBjetAllocator reproduces the input preparation of weaver (the framework used to train the ParT model): pf_features (1, nFeat, nConstit), pf_vectors (1, nVec, nConstit) and pf_mask (1, 1, nConstit), with truncation at nConstit, wrap or zero padding (mask 0 on padded slots), and non-finite values set to 0. getModelOutputMultiInput() evaluates models with several input tensors.
    ParT_O2_pipeline_colored.pdf

@github-actions

Copy link
Copy Markdown

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


// The exported graph applies the softmax itself, so the output is already
// [p_b, p_c, p_udsg] and must not be passed through getDb(), which would softmax again.
auto modelOutput = bMlResponse.getModelOutputMultiInput(parTInput, 0);

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.

doesnt this always take the model in the first pT bin? is it intended?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The ParT model is trained inclusively in pT, so a single bin (binsPtMl = {5, 1000}) is the intended setup. That's why I hard-coded the model index to 0, following the existing GNN implementation, which uses the same approach.

@nzardosh
nzardosh self-requested a review October 26, 2026 12:16
@nzardosh
nzardosh enabled auto-merge (squash) October 26, 2026 12:16
@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for 6d3e25c at 2026-10-26 16:37:

## sw/BUILD/O2Physics-code-check-latest/log
--
========== List of issues found ==========
++ echo 'To reproduce the results below locally, run: '\''aliBuild build O2Physics-code-check -e ALIBUILD_BASE_HASH=upstream/master'\''.'
To reproduce the results below locally, run: 'aliBuild build O2Physics-code-check -e ALIBUILD_BASE_HASH=upstream/master'.
++ echo 'To apply all automatic fixes, add the '\''-e O2PHYSICS_CHECKER_FIX=1'\'' option.'
To apply all automatic fixes, add the '-e O2PHYSICS_CHECKER_FIX=1' option.
++ echo 'See the documentation for more details at: <https://aliceo2group.github.io/analysis-framework/docs/tools/#running-with-o2physics-code-check>.'
See the documentation for more details at: <https://aliceo2group.github.io/analysis-framework/docs/tools/#running-with-o2physics-code-check>.
++ echo 'Found 2 errors and 84 warnings.'
Found 2 errors and 84 warnings.
++ [[ 2 -gt 0 ]]
++ cat /sw/BUILD/889622c776b50fe71b6cb42e02845b7e0fa15cbd/O2Physics-code-check/errors.txt
PWGJE/Core/MlResponseHfTagging.h:417:9: error: 'push_back' is called inside a loop; consider pre-allocating the container capacity before the loop [performance-inefficient-vector-operation,-warnings-as-errors]
PWGJE/DataModel/Jet.h:181:1: error: Called C++ object pointer is null [clang-analyzer-core.CallAndMessage,-warnings-as-errors]
++ [[ 84 -gt 0 ]]
++ cat /sw/BUILD/889622c776b50fe71b6cb42e02845b7e0fa15cbd/O2Physics-code-check/warnings.txt
PWGJE/Core/JetTaggingUtilities.h:235:5: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGJE/Core/JetTaggingUtilities.h:294:9: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGJE/Core/JetTaggingUtilities.h:331:9: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGJE/Core/JetTaggingUtilities.h:403:11: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGJE/Core/JetTaggingUtilities.h:438:11: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGJE/Core/JetTaggingUtilities.h:449:5: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGJE/Core/JetTaggingUtilities.h:475:11: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGJE/Core/JetTaggingUtilities.h:495:47: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:497:45: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:508:41: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:510:41: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:512:58: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:514:58: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:518:55: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:521:53: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:533:41: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:534:12: warning: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr]
PWGJE/Core/JetTaggingUtilities.h:550:29: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:563:69: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:566:11: warning: variable 'varSignImpSig' is not initialized [cppcoreguidelines-init-variables]
PWGJE/Core/JetTaggingUtilities.h:589:7: warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]
PWGJE/Core/JetTaggingUtilities.h:644:42: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:676:69: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:689:30: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:709:69: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:738:30: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:754:15: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:759:120: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:781:61: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:783:8: warning: narrowing conversion from 'float' to 'bool' [bugprone-narrowing-conversions]
PWGJE/Core/JetTaggingUtilities.h:785:32: warning: statement should be inside braces [readability-braces-around-statements]
PWGJE/Core/JetTaggingUtilities.h:789:33: warning: statement should be inside braces [readability-braces-around-statements]
[0 more errors; see full log]

Full log here.

@nzardosh
nzardosh merged commit 654e2f0 into AliceO2Group:master Oct 26, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants