Skip to content

[PWGDQ] Event mixing in classes of the selected pairing in tableReader - #18804

Open
JinjooSeo wants to merge 5 commits into
AliceO2Group:masterfrom
JinjooSeo:pwgdq-mixing-nsel
Open

JinjooSeo wants to merge 5 commits into
AliceO2Group:masterfrom
JinjooSeo:pwgdq-mixing-nsel

Conversation

@JinjooSeo

Copy link
Copy Markdown
Contributor

Add mixing in classes of the selected pairing

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

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

@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for d903174 at 2026-11-18 18:05:

## 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 3 errors and 25 warnings.'
Found 3 errors and 25 warnings.
++ [[ 3 -gt 0 ]]
++ cat /sw/BUILD/c7dfa3bbc380ebca9447ace9a8c9ef60565bd56d/O2Physics-code-check/errors.txt
PWGDQ/Tasks/tableReader_withAssoc.h:354:86: error: no header providing "o2::constants::lhc::LHCRevFreq" is directly included [misc-include-cleaner,-warnings-as-errors]
PWGDQ/Tasks/tableReader_withAssoc.h:1868:33: error: do not use static_cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-static-cast-downcast,-warnings-as-errors]
PWGDQ/Tasks/tableReader_withAssoc.h:3010:40: error: no header providing "std::decay_t" is directly included [misc-include-cleaner,-warnings-as-errors]
++ [[ 25 -gt 0 ]]
++ cat /sw/BUILD/c7dfa3bbc380ebca9447ace9a8c9ef60565bd56d/O2Physics-code-check/warnings.txt
PWGDQ/Core/VarManager.cxx:57:1: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.cxx:58:1: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.cxx:60:1: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.cxx:72:1: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.cxx:98:28: warning: initializer for base class 'TObject' is redundant [readability-redundant-member-init]
PWGDQ/Core/VarManager.cxx:156:14: 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]
PWGDQ/Core/VarManager.cxx:318:5: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGDQ/Core/VarManager.cxx:425:14: 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]
PWGDQ/Core/VarManager.cxx:492:5: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGDQ/Core/VarManager.cxx:3046:14: 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]
PWGDQ/Core/VarManager.cxx:3056:9: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
PWGDQ/Core/VarManager.cxx:3057:9: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
PWGDQ/Core/VarManager.h:1272:10: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.h:1273:10: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.h:1658:15: warning: function 'VarManager::SetPhiMap' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
PWGDQ/Core/VarManager.h:1689:10: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.h:1693:10: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.h:3504:11: warning: variable 'dcaX' is not initialized [cppcoreguidelines-init-variables]
PWGDQ/Core/VarManager.h:3505:11: warning: variable 'dcaY' is not initialized [cppcoreguidelines-init-variables]
PWGDQ/Core/VarManager.h:4773:14: 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]
PWGDQ/Core/VarManager.h:5515:7: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.h:5518:33: 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]
PWGDQ/Core/VarManager.h:5519:33: 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]
PWGDQ/Core/VarManager.h:7318:9: warning: variable 'pairPhiV' is not initialized [cppcoreguidelines-init-variables]
PWGDQ/Tasks/tableReader_withAssoc.h:5046:36: warning: initializer for member 'fDileptonCut' is redundant [readability-redundant-member-init]
++ [[ 3 -gt 0 ]]
++ exit 1
--

Full log here.

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

Hi Jinjoo, thanks for the PR!

May you add those checks + failure messages? Otherwise it is good

// mix only events in the same class of cfgMixingNSelEdges
if (mixingCategory >= 0 && !fMixNSelEdges.empty()) {
const int nSel = static_cast<int>(VarManager::fgValues[VarManager::kNSelTracksForPairing]);
const int nSelClassIndex = static_cast<int>(std::upper_bound(fMixNSelEdges.begin(), fMixNSelEdges.end(), nSel) - fMixNSelEdges.begin()) - 1;

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.

I think std::upper_bound requires a sorted list, if the user enters something that unsorted in fConfigMixingNSelEdges, this might crash without a reasonable failure message.

Could you add a check that fConfigMixingNSelEdges contains at least two edges and that they all edges are sorted in strictly increasing order? I think std::is_sorted provides a check for that
Then add a proper failure message

@JinjooSeo JinjooSeo Nov 18, 2026 •

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.

Thanks for the comments! I modified and added the failure messages to indicate that at least two integer edges are in strictly increasing order in init()

Comment thread PWGDQ/Tasks/tableReader_withAssoc.h Outdated
if (!fConfigMixingNSelEdges.value.empty()) {
std::unique_ptr<TObjArray> edgeArr(TString(fConfigMixingNSelEdges.value).Tokenize(","));
for (int ie = 0; ie < edgeArr->GetEntries(); ++ie) {
fMixNSelEdges.push_back(static_cast<TObjString*>(edgeArr->At(ie))->GetString().Atoi());

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.

I think ROOTs Atoi returns a 0 if the input string is not a valid ASCII numerical value, this is hard to check on.

Maybe you could use instead std::from_chars to convert to the integer, there you could check the validity and also provide a proper error message

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.

Now this is done in init() when the edges are validated. So std::upper_bound here only sees valid edges

@alibuild

alibuild commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for c9715dd at 2026-11-19 01:28:

## 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 25 warnings.'
Found 2 errors and 25 warnings.
++ [[ 2 -gt 0 ]]
++ cat /sw/BUILD/d386caa9e4d31f1ac8bd2e7a8e5b0669d145e5bc/O2Physics-code-check/errors.txt
PWGDQ/Tasks/tableReader_withAssoc.h:354:86: error: no header providing "o2::constants::lhc::LHCRevFreq" is directly included [misc-include-cleaner,-warnings-as-errors]
PWGDQ/Tasks/tableReader_withAssoc.h:1868:33: error: do not use static_cast to downcast from a base to a derived class; use dynamic_cast instead [cppcoreguidelines-pro-type-static-cast-downcast,-warnings-as-errors]
++ [[ 25 -gt 0 ]]
++ cat /sw/BUILD/d386caa9e4d31f1ac8bd2e7a8e5b0669d145e5bc/O2Physics-code-check/warnings.txt
PWGDQ/Core/VarManager.cxx:57:1: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.cxx:58:1: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.cxx:60:1: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.cxx:72:1: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.cxx:98:28: warning: initializer for base class 'TObject' is redundant [readability-redundant-member-init]
PWGDQ/Core/VarManager.cxx:156:14: 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]
PWGDQ/Core/VarManager.cxx:318:5: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGDQ/Core/VarManager.cxx:425:14: 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]
PWGDQ/Core/VarManager.cxx:492:5: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGDQ/Core/VarManager.cxx:3046:14: 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]
PWGDQ/Core/VarManager.cxx:3056:9: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
PWGDQ/Core/VarManager.cxx:3057:9: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
PWGDQ/Core/VarManager.h:1272:10: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.h:1273:10: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.h:1658:15: warning: function 'VarManager::SetPhiMap' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
PWGDQ/Core/VarManager.h:1689:10: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.h:1693:10: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.h:3504:11: warning: variable 'dcaX' is not initialized [cppcoreguidelines-init-variables]
PWGDQ/Core/VarManager.h:3505:11: warning: variable 'dcaY' is not initialized [cppcoreguidelines-init-variables]
PWGDQ/Core/VarManager.h:4773:14: 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]
PWGDQ/Core/VarManager.h:5515:7: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.h:5518:33: 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]
PWGDQ/Core/VarManager.h:5519:33: 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]
PWGDQ/Core/VarManager.h:7318:9: warning: variable 'pairPhiV' is not initialized [cppcoreguidelines-init-variables]
PWGDQ/Tasks/tableReader_withAssoc.h:5046:36: warning: initializer for member 'fDileptonCut' is redundant [readability-redundant-member-init]
++ [[ 2 -gt 0 ]]
++ exit 1
--

Full log here.

@alibuild

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for bd8e7a9 at 2026-11-19 00:51:

## 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 1 errors and 25 warnings.'
Found 1 errors and 25 warnings.
++ [[ 1 -gt 0 ]]
++ cat /sw/BUILD/3b131b479130b3e8c6a29846181271b18faec76e/O2Physics-code-check/errors.txt
PWGDQ/Tasks/tableReader_withAssoc.h:356:86: error: no header providing "o2::constants::lhc::LHCRevFreq" is directly included [misc-include-cleaner,-warnings-as-errors]
++ [[ 25 -gt 0 ]]
++ cat /sw/BUILD/3b131b479130b3e8c6a29846181271b18faec76e/O2Physics-code-check/warnings.txt
PWGDQ/Core/VarManager.cxx:57:1: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.cxx:58:1: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.cxx:60:1: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.cxx:72:1: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.cxx:98:28: warning: initializer for base class 'TObject' is redundant [readability-redundant-member-init]
PWGDQ/Core/VarManager.cxx:156:14: 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]
PWGDQ/Core/VarManager.cxx:318:5: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGDQ/Core/VarManager.cxx:425:14: 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]
PWGDQ/Core/VarManager.cxx:492:5: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGDQ/Core/VarManager.cxx:3046:14: 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]
PWGDQ/Core/VarManager.cxx:3056:9: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
PWGDQ/Core/VarManager.cxx:3057:9: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
PWGDQ/Core/VarManager.h:1272:10: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.h:1273:10: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.h:1658:15: warning: function 'VarManager::SetPhiMap' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
PWGDQ/Core/VarManager.h:1689:10: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.h:1693:10: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.h:3504:11: warning: variable 'dcaX' is not initialized [cppcoreguidelines-init-variables]
PWGDQ/Core/VarManager.h:3505:11: warning: variable 'dcaY' is not initialized [cppcoreguidelines-init-variables]
PWGDQ/Core/VarManager.h:4773:14: 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]
PWGDQ/Core/VarManager.h:5515:7: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGDQ/Core/VarManager.h:5518:33: 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]
PWGDQ/Core/VarManager.h:5519:33: 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]
PWGDQ/Core/VarManager.h:7318:9: warning: variable 'pairPhiV' is not initialized [cppcoreguidelines-init-variables]
PWGDQ/Tasks/tableReader_withAssoc.h:5057:36: warning: initializer for member 'fDileptonCut' is redundant [readability-redundant-member-init]
++ [[ 1 -gt 0 ]]
++ exit 1
--

Full log here.

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