Skip to content

[PWGLF] Omega(2012): shared selection core, Xi(1530)K mode and ML training-table exporter - #18208

Merged
BongHwi merged 13 commits into
AliceO2Group:masterfrom
BongHwi:reso-omega2012-ml
Oct 8, 2026
Merged

BongHwi merged 13 commits into
AliceO2Group:masterfrom
BongHwi:reso-omega2012-ml

Conversation

@BongHwi

@BongHwi BongHwi commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Refactors omega2012Analysis along the lines of the K1(1270) split (#18167) and adds an ML exporter.
The two decay modes stay strictly separate (histograms, tables, features, truth).

  • PWGLF/Core/Omega2012AnalysisCore.h: Xi / K0S / track selection, candidate loops and truth matching per mode, cut-flow histograms
  • Mode A (Xi K0S): output unchanged (processData, processMixedEvent, processMC, processMCGenerated)
  • Mode B (Xi(1530)0 K-): replaces the charge-inconsistent omega2012_3body (Xi + pi + K0S) with Xi- pi+ K- using micro tracks;
    new processXi1530K{Micro,Tracks,MCMicro,MixedMicro}, wrong-sign controls in a separate folder
  • New omega2012-training-table workflow (omega2012TrainingTable.cxx, LFOmega2012MlTables.h, Omega2012MlFeatures.h):
    per-mode candidate, feature, truth tables and a generated-parent audit table

BongHwi and others added 12 commits September 30, 2026 06:23
- Use v001 resonance tables (ResoCollisions_001, ResoMicroTracks_001,
  ResoMCMicroTracks_001, ResoMCParents_001); keep ResoTracks as fallback
- Unify full/micro track selection and PID in a single code path,
  handling quantised v001 DCA/nSigma values and producer pT-dependent
  DCA bits
- Apply pion PID on micro tracks; apply cUseOnlyTOFTrackPi to both
  pions and cUseOnlyTOFTrackKa to the kaon; add cByPassTOF and
  optional pT-dependent PID/DCA
- Restore secondary-resonance and K1 candidate cuts (mass window,
  other-pair masses, opening angle, pair asymmetry); -999 disables a
  cut and skips its computation; fill QAcut and kaon QA
- Iterate unordered pion pairs to stop double-filling triplets, with a
  canonical pion assignment for role-dependent quantities
- Cache per-collision selections, record cut-flow from the selection
  functions, add event cuts and init-time config validation
- Replace TLorentzVector with ROOT::Math vectors, use PDG constants,
  remove unused options
- Use const references in range-based loops over configured PID cuts
- Replace magic numbers in init checks with named constants
…isMicroCore.h

Split the K1(1270) microtrack histogram task into a reusable core header
and a thin workflow, so that other K1 workflows can share one selection
and candidate loop implementation instead of copying it.

- PWGLF/Core/K1AnalysisMicroCore.h (new): event, track, PID, secondary
  and candidate configurable groups (no group prefix, so all JSON keys and
  defaults are unchanged), the track quality/PID stages, the quantised
  DCA/nSigma grid checks, the sibling-based truth classification, the
  unordered triplet loop with its selection cache and cut-flow
  histograms, and the histogram registration. No using-directives, no
  runDataProcessing.h.
- k1AnalysisMicro.cxx: struct K1AnalysisMicro now owns the configurable
  groups, the histogram registry and the process functions, and calls the
  core. Process switches, configurable names/defaults, histogram names and
  the selection are unchanged.
Add a derived-table workflow that writes the unlike-sign K1(1270) micro
candidates selected by the shared K1 core, together with the canonical
tracks and a 125-entry feature vector for ML training.

- PWGLF/Core/K1MlFeatures.h (new): canonical unlike-sign role assignment
  (kaon, same-sign pion, opposite-sign pion) and the master feature
  builder of the frozen feature contract (FeatureContractSha256), with
  compile-time checks of the feature-name count and of the projection
  indices. The pion mass keeps the contract value 0.13957039 GeV
  (O2 MassPionCharged is 0.1395704 and would change the features).
- PWGLF/DataModel/LFK1MlTables.h (new): K1MlEvents, K1MlTracks,
  K1MlCandidates, K1MlInputs (float[125] features), K1MlTruth and
  K1MlGenAudit. Relations point only to the derived tables.
- K1AnalysisMicroCore.h: optional candidate callback and loose-stage
  traversal (pass bits 1/2/4/8/16; selected = 31), loose cut-flow
  histograms. The histogram task does not use them and is unchanged.
  Candidates at the selected stage are emitted only if they satisfy the
  canonical/feature contract, as at the loose stage.
- k1TrainingTable.cxx (new, workflow k1-training-table): struct
  K1TrainingTable reuses the core loop; invalid candidates are skipped and
  counted in ML/exportSkipped by build status instead of aborting.
…ilder

The K1 ML feature contract SHA covers the 125 feature names and the three
projection index lists only, so switching the pion mass from the local
literal to o2::constants::physics::MassPionCharged does not change the
contract identity. Feature values change at the 1e-8 relative level for
the pair masses; exports written with the previous literal are therefore
not byte-identical to new exports.
Initialize the TPC n-sigma once from the species instead of overwriting
a NaN default in both branches. The selection is unchanged.
Move the event, track-quality, TOF-requirement and PID selection of
resonance daughters into PWGLF/Core/ResoAnalysisSelectionCore.h. The K1
core keeps the K1 selection, truth classification, candidate loop and
its cut-flow/ML audit histograms, and hands the selected pion pairs and
candidates to the task through hooks. The K1 analysis histograms are now
registered and filled in k1AnalysisMicro.cxx; the training-table task
writes only the ML tables, CutFlow/*, ML/* and MCReco event counters.

The selection, all configurable names and the ML table output are
unchanged.
Include Math/Vector4Dfwd.h where ROOT::Math::PxPyPzMVector is used, drop
the unused LFResonanceTables.h and PhysicsConstants.h includes, simplify
the candidate-cut boolean expressions, use designated initializers for
EncodedValue and remove redundant int64_t casts. No change in behaviour.
…ining-table exporter

Move the Xi, K0s and track selection and the candidate enumeration of the
Omega(2012) analysis into PWGLF/Core/Omega2012AnalysisCore.h with hooks for
the task histograms, in the same way as the K1 core. The two decay modes
are analysed separately throughout: Omega(2012)- -> Xi- K0S (unchanged
histogram output) and Omega(2012)- -> Xi(1530)0 K- -> Xi- pi+ K-. The
previous three-body code combined Xi + pi + K0S, which cannot be an
Omega(2012)- by charge, and is removed; the new mode uses a charged kaon
track selected with ResoAnalysisSelectionCore, with wrong-sign controls
kept apart from the signal pattern.

Add the per-mode feature contracts (Omega2012MlFeatures.h), the derived
tables (LFOmega2012MlTables.h) and the omega2012-training-table workflow
that writes the candidates of each mode, their features, pass bits and MC
truth, plus a generated-parent audit by decay channel.
# Conflicts:
#	PWGLF/Tasks/Resonances/k1AnalysisMicro.cxx
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

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

@alibuild

alibuild commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for a24fd98 at 2026-10-08 01:38:

## sw/BUILD/O2Physics-code-check-latest/log
--
========== List of issues found ==========
++ echo 'Found 10 errors and 29 warnings.'
Found 10 errors and 29 warnings.
++ [[ 10 -gt 0 ]]
++ cat /sw/BUILD/dac280797e2b1503624d93a6efd9c6219959b272/O2Physics-code-check/errors.txt
PWGLF/Core/Omega2012AnalysisCore.h:27:1: error: included header LFResonanceTables.h is not used directly [misc-include-cleaner,-warnings-as-errors]
PWGLF/Core/Omega2012AnalysisCore.h:281:15: error: no header providing "ROOT::Math::PxPyPzEVector" is directly included [misc-include-cleaner,-warnings-as-errors]
PWGLF/Core/Omega2012AnalysisCore.h:727:59: error: no header providing "ROOT::Math::PtEtaPhiMVector" is directly included [misc-include-cleaner,-warnings-as-errors]
PWGLF/Core/Omega2012MlFeatures.h:430:35: error: no header providing "ROOT::Math::PxPyPzMVector" is directly included [misc-include-cleaner,-warnings-as-errors]
PWGLF/Tasks/Resonances/omega2012Analysis.cxx:58:1: error: included header cstdint is not used directly [misc-include-cleaner,-warnings-as-errors]
PWGLF/Tasks/Resonances/omega2012Analysis.cxx:596:40: error: parameter 'xi' is unused [misc-unused-parameters,-warnings-as-errors]
PWGLF/Tasks/Resonances/omega2012Analysis.cxx:596:56: error: parameter 'pion' is unused [misc-unused-parameters,-warnings-as-errors]
PWGLF/Tasks/Resonances/omega2012Analysis.cxx:596:74: error: parameter 'kaon' is unused [misc-unused-parameters,-warnings-as-errors]
PWGLF/Tasks/Resonances/omega2012TrainingTable.cxx:336:46: error: lambda capture 'this' is not used [clang-diagnostic-unused-lambda-capture,-warnings-as-errors]
PWGLF/Tasks/Resonances/omega2012TrainingTable.cxx:346:54: error: lambda capture 'this' is not used [clang-diagnostic-unused-lambda-capture,-warnings-as-errors]
++ [[ 29 -gt 0 ]]
++ cat /sw/BUILD/dac280797e2b1503624d93a6efd9c6219959b272/O2Physics-code-check/warnings.txt
PWGLF/Core/Omega2012AnalysisCore.h:76:1: warning: initial values in enum 'o2::analysis::omega2012::XiStage' are not consistent, consider explicit initialization of all, none or only the first enumerator [readability-enum-initial-value]
PWGLF/Core/Omega2012AnalysisCore.h:88:1: warning: initial values in enum 'o2::analysis::omega2012::K0sStage' are not consistent, consider explicit initialization of all, none or only the first enumerator [readability-enum-initial-value]
PWGLF/Core/Omega2012MlFeatures.h:371:12: warning: use designated initializer list to initialize 'EncodedValue' [modernize-use-designated-initializers]
PWGLF/Core/Omega2012MlFeatures.h:373:10: warning: use designated initializer list to initialize 'EncodedValue' [modernize-use-designated-initializers]
PWGLF/Core/Omega2012MlFeatures.h:380:12: warning: use designated initializer list to initialize 'EncodedValue' [modernize-use-designated-initializers]
PWGLF/Core/Omega2012MlFeatures.h:383:12: warning: use designated initializer list to initialize 'EncodedValue' [modernize-use-designated-initializers]
PWGLF/Core/Omega2012MlFeatures.h:385:10: warning: use designated initializer list to initialize 'EncodedValue' [modernize-use-designated-initializers]
PWGLF/Core/Omega2012MlFeatures.h:392:12: warning: use designated initializer list to initialize 'EncodedValue' [modernize-use-designated-initializers]
PWGLF/Core/Omega2012MlFeatures.h:395:10: warning: use designated initializer list to initialize 'EncodedValue' [modernize-use-designated-initializers]
PWGLF/Core/Omega2012MlFeatures.h:427:25: warning: member 'out' of type 'std::array<float, 63UL> &' is a reference [cppcoreguidelines-avoid-const-or-ref-data-members]
PWGLF/Core/Omega2012MlFeatures.h:427:25: warning: member 'out' of type 'std::array<float, 126UL> &' is a reference [cppcoreguidelines-avoid-const-or-ref-data-members]
PWGLF/Core/Omega2012MlFeatures.h:427:25: warning: member 'out' of type 'std::array<float, N> &' is a reference [cppcoreguidelines-avoid-const-or-ref-data-members]
PWGLF/Core/Omega2012MlFeatures.h:504:63: warning: use designated initializer list to initialize 'EncodedValue' [modernize-use-designated-initializers]
PWGLF/DataModel/LFOmega2012MlTables.h:93:56: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGLF/DataModel/LFOmega2012MlTables.h:99:46: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGLF/DataModel/LFOmega2012MlTables.h:122:54: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGLF/DataModel/LFOmega2012MlTables.h:123:58: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGLF/Tasks/Resonances/omega2012Analysis.cxx:484:44: warning: statement should be inside braces [readability-braces-around-statements]
PWGLF/Tasks/Resonances/omega2012Analysis.cxx:498:52: warning: statement should be inside braces [readability-braces-around-statements]
PWGLF/Tasks/Resonances/omega2012TrainingTable.cxx:170:13: warning: use auto when initializing with a template cast to avoid duplicating the type name [modernize-use-auto]
PWGLF/Tasks/Resonances/omega2012TrainingTable.cxx:187:18: warning: redundant explicit casting to the same type 'int64_t' (aka 'long') as the sub-expression, remove this casting [readability-redundant-casting]
PWGLF/Tasks/Resonances/omega2012TrainingTable.cxx:197:26: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
PWGLF/Tasks/Resonances/omega2012TrainingTable.cxx:210:22: warning: redundant explicit casting to the same type 'int64_t' (aka 'long') as the sub-expression, remove this casting [readability-redundant-casting]
PWGLF/Tasks/Resonances/omega2012TrainingTable.cxx:222:26: warning: do not implicitly decay an array into a pointer; consider using gsl::array_view or an explicit cast instead [cppcoreguidelines-pro-bounds-array-to-pointer-decay]
PWGLF/Tasks/Resonances/omega2012TrainingTable.cxx:232:22: warning: redundant explicit casting to the same type 'int64_t' (aka 'long') as the sub-expression, remove this casting [readability-redundant-casting]
PWGLF/Tasks/Resonances/omega2012TrainingTable.cxx:247:22: warning: redundant explicit casting to the same type 'int64_t' (aka 'long') as the sub-expression, remove this casting [readability-redundant-casting]
PWGLF/Tasks/Resonances/omega2012TrainingTable.cxx:276:22: warning: redundant explicit casting to the same type 'int64_t' (aka 'long') as the sub-expression, remove this casting [readability-redundant-casting]
PWGLF/Tasks/Resonances/omega2012TrainingTable.cxx:319:22: warning: redundant explicit casting to the same type 'int64_t' (aka 'long') as the sub-expression, remove this casting [readability-redundant-casting]
PWGLF/Tasks/Resonances/omega2012TrainingTable.cxx:394:18: warning: redundant explicit casting to the same type 'int64_t' (aka 'long') as the sub-expression, remove this casting [readability-redundant-casting]
++ [[ 10 -gt 0 ]]
[0 more errors; see full log]

Full log here.

@BongHwi
BongHwi enabled auto-merge (squash) October 8, 2026 02:43
@BongHwi

BongHwi commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Could you approve this PR? @omvazque @mpuccio Thanks!

@BongHwi
BongHwi merged commit 9451931 into AliceO2Group:master Oct 8, 2026
15 checks passed
@BongHwi
BongHwi deleted the reso-omega2012-ml branch October 8, 2026 08:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants