Skip to content

[PWGCF] Add q-space K+K- balance function task - #18859

Merged
victor-gonzalez merged 12 commits into
AliceO2Group:masterfrom
lakshithaf1998:qspace-kk-bf
Dec 1, 2026
Merged

victor-gonzalez merged 12 commits into
AliceO2Group:masterfrom
lakshithaf1998:qspace-kk-bf

Conversation

@lakshithaf1998

Copy link
Copy Markdown
Contributor

Adds a new PWGCF/TwoParticleCorrelations task, o2-analysis-cf-q-space-balance-function, for K+K- balance functions in q-space (Q_inv, Q_long, Q_out, Q_side).

  • Reads the existing DptDpt filter tables; works at generator level and at detector level on MC with truth matching.
  • Same-event and mixed-event pair densities per (z_vtx, FT0C multiplicity) class. Mixing uses its own cross-data-frame event pool, with configurable depth.
  • A2 = C2/N and B(Q) in both the C2 (rho2 - rho1 rho1) and n2 versions; statistical errors from 10 event subsamples.
  • Validated locally on MC
  • O2 linter passes; builds and runs on current master (99f6526) without errors.

AI use: this code was developed with AI assistance (Claude); I reviewed, built and tested it myself and take responsibility for it.

Lakshitha Fernando and others added 7 commits November 8, 2026 13:18
…st version

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01Tpx2ZQ7HXMcQXLLUbEx35H
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tpx2ZSUeCZncb9cRCRUxvQ
…ay, none)

Beam and non-hadron mothers are rejected, same criterion as particleOriginAnalysis.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01Tpx2ZQhMsissFM7LZMPFGi
…urity and Q resolution

Histograms grouped per level (generator at top level, detector under rec/); MC origin split at both levels; split tracks never count as a common mother.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01Tpx2ZQhMsissFM7LZMPFGi
@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

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

using HistoPerCharge = std::array<std::shared_ptr<TH1>, NCharges>;
using Histo2DPerCharge = std::array<std::shared_ptr<TH2>, NCharges>;
using Histo2DPerPair = std::array<Histo2DPerCharge, NCharges>;
using HistoPerPair = std::array<HistoPerCharge, NCharges>;

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.

camelCase is suggested

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.

Could you point me to the names you mean? These are type aliases, and the O2 linter rule for types asks for UpperCamelCase (HistoPerCharge, Histo2DPerPair, ...). I am happy to rename anything that does not follow the convention.

@wenyaCern wenyaCern 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.

Please fix the errors reported by the linters

@lakshithaf1998

Copy link
Copy Markdown
Contributor Author

Thanks for the review. I ran the O2 linter locally the same way as CI: qSpaceBalanceFunction.cxx and QSpaceKinematics.h now have no errors and no warnings, and MegaLinter passes after adding #include . The remaining O2 linter warning is in PWGCF/TwoParticleCorrelations/Tasks/CMakeLists.txt, from the workflow names of existing tasks (e.g. nuclei-balance, mft-correlations), not from the q-space lines. Please let me know if you see another error I should fix.

@alibuild

alibuild commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for 039e847 at 2026-12-01 22: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 33 errors and 4 warnings.'
Found 33 errors and 4 warnings.
++ [[ 33 -gt 0 ]]
++ cat /sw/BUILD/8247dca9a08ac071a75687cdd0c666e9a13c04b9/O2Physics-code-check/errors.txt
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:50:1: error: included header AnalysisHelpers.h is not used directly [misc-include-cleaner,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:215:76: error: C-style casts are discouraged; use static_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:216:70: error: C-style casts are discouraged; use static_cast [google-readability-casting,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:242:85: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:243:75: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:244:75: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:245:87: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:248:86: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:249:88: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:250:86: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:251:88: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:252:86: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:253:109: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:254:111: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:257:110: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:258:112: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:259:110: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:260:112: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:266:103: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:271:99: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:272:101: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:273:99: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:274:101: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:297:85: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:298:87: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:299:85: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:300:87: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:301:87: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:302:89: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:303:87: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:304:89: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:318:93: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:319:95: error: string concatenation results in allocation of unnecessary temporary strings; consider using 'operator+=' or 'string::append()' instead [performance-inefficient-string-concatenation,-warnings-as-errors]
++ [[ 4 -gt 0 ]]
++ cat /sw/BUILD/8247dca9a08ac071a75687cdd0c666e9a13c04b9/O2Physics-code-check/warnings.txt
PWGCF/TwoParticleCorrelations/Tasks/qSpaceBalanceFunction.cxx:111:22: warning: 'KPdgHadronThreshold' is a static definition in anonymous namespace; static is redundant here [readability-static-definition-in-anonymous-namespace]
[0 more errors; see full log]

Full log here.

@victor-gonzalez
victor-gonzalez merged commit 41c4a10 into AliceO2Group:master Dec 1, 2026
16 of 17 checks passed
@victor-gonzalez

Copy link
Copy Markdown
Collaborator

@lakshithaf1998 Could you please fix the code-check errors in the next iteration? Thanks!

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.

4 participants