Skip to content

[PWGEM] Use const& and std::move to avoid copies - #17708

Open
vkucera wants to merge 2 commits into
AliceO2Group:masterfrom
vkucera:const-PWGEM
Open

[PWGEM] Use const& and std::move to avoid copies#17708
vkucera wants to merge 2 commits into
AliceO2Group:masterfrom
vkucera:const-PWGEM

Conversation

@vkucera

@vkucera vkucera commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Mostly done automatically by Clang-Tidy.

Mostly done automatically by Clang-Tidy.
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

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

@github-actions github-actions Bot added pwgem photon Photon and neutral meson PAG label labels Sep 1, 2026
@github-actions github-actions Bot changed the title Use const& and std::move to avoid copies [PWGEM] Use const& and std::move to avoid copies Sep 1, 2026
@vkucera
vkucera marked this pull request as ready for review September 1, 2026 15:54
@alibuild

alibuild commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for f6fd7c3 at 2026-09-02 22:12:

## sw/BUILD/O2Physics-code-check-latest/log
--
========== List of issues found ==========
++ echo 'Found 173 errors and 302 warnings.'
Found 173 errors and 302 warnings.
++ [[ 173 -gt 0 ]]
++ cat /sw/BUILD/3f2a532f5124f8e8352b439ebf04d58150ae3720/O2Physics-code-check/errors.txt
PWGEM/Dilepton/Core/DielectronCut.h:323:7: error: switch has 2 consecutive identical branches [bugprone-branch-clone,-warnings-as-errors]
PWGEM/Dilepton/Core/DileptonSV.h:122:8: error: constructor does not initialize these fields: ccdb [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
PWGEM/Dilepton/Core/DileptonSV.h:648:25: error: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast,-warnings-as-errors]
PWGEM/Dilepton/Core/DileptonSV.h:1115:9: error: if with identical then and else branches [bugprone-branch-clone,-warnings-as-errors]
PWGEM/Dilepton/Core/DileptonSV.h:1156:105: error: repeated branch body in conditional chain [bugprone-branch-clone,-warnings-as-errors]
PWGEM/Dilepton/Core/DileptonSV.h:1763:7: error: if with identical then and else branches [bugprone-branch-clone,-warnings-as-errors]
PWGEM/Dilepton/Core/DileptonSV.h:1795:105: error: repeated branch body in conditional chain [bugprone-branch-clone,-warnings-as-errors]
PWGEM/Dilepton/Core/Dilepton.h:110:8: error: constructor does not initialize these fields: ccdb [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
PWGEM/Dilepton/Core/Dilepton.h:558:25: error: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast,-warnings-as-errors]
PWGEM/Dilepton/Core/Dilepton.h:888:9: error: if with identical then and else branches [bugprone-branch-clone,-warnings-as-errors]
PWGEM/Dilepton/Core/Dilepton.h:914:105: error: repeated branch body in conditional chain [bugprone-branch-clone,-warnings-as-errors]
PWGEM/Dilepton/Core/Dilepton.h:1464:39: error: repeated branch body in conditional chain [bugprone-branch-clone,-warnings-as-errors]
PWGEM/Dilepton/Core/Dilepton.h:1548:7: error: if with identical then and else branches [bugprone-branch-clone,-warnings-as-errors]
PWGEM/Dilepton/Core/Dilepton.h:1566:105: error: repeated branch body in conditional chain [bugprone-branch-clone,-warnings-as-errors]
PWGEM/Dilepton/TableProducer/skimmerPrimaryMuonQC.cxx:60:8: error: constructor does not initialize these fields: ccdb [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
PWGEM/Dilepton/TableProducer/skimmerPrimaryMuonQC.cxx:176:39: 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]
PWGEM/Dilepton/TableProducer/skimmerPrimaryMuonQC.cxx:177:24: error: 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,-warnings-as-errors]
PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx:66:8: error: constructor does not initialize these fields: ccdb [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx:163:39: 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]
PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx:164:24: error: 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,-warnings-as-errors]
PWGEM/Dilepton/TableProducer/skimmerPrimaryMuon.cxx:370:17: error: narrowing conversion from 'float' to 'int' [bugprone-narrowing-conversions,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:114:8: error: constructor does not initialize these fields: fHistMan, fEventCut [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:135:36: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:135:65: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:156:51: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:158:31: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:160:52: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:193:8: error: constructor does not initialize these fields: fHistMan [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:272:36: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:272:65: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:297:59: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:303:31: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:306:63: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:343:71: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:372:78: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:419:8: error: constructor does not initialize these fields: fHistMan [cppcoreguidelines-pro-type-member-init,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:448:34: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:448:63: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:564:64: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:567:83: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:572:66: error: 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,-warnings-as-errors]
PWGEM/Dilepton/Tasks/MCtemplates.cxx:575:85: error: 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,-warnings-as-errors]
[0 more errors; see full log]

Full log here.

@alibuild

alibuild commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/code-check for 5bec802 at 2026-09-10 05:36:

## sw/BUILD/O2Physics-code-check-latest/log
--
========== List of issues found ==========
++ echo 'Found 5 errors and 463 warnings.'
Found 5 errors and 463 warnings.
++ [[ 5 -gt 0 ]]
++ cat /sw/BUILD/8551299713595a48df748a0c9ce5ac3f4654ddeb/O2Physics-code-check/errors.txt
PWGEM/Dilepton/Tasks/emEfficiencyEE.cxx:1047:45: error: variable length arrays in C++ are a Clang extension [clang-diagnostic-vla-cxx-extension,-warnings-as-errors]
PWGEM/Dilepton/Tasks/emEfficiencyEE.cxx:1055:26: error: variable length arrays in C++ are a Clang extension [clang-diagnostic-vla-cxx-extension,-warnings-as-errors]
PWGEM/Dilepton/Tasks/emEfficiencyEE.cxx:1160:38: error: variable length arrays in C++ are a Clang extension [clang-diagnostic-vla-cxx-extension,-warnings-as-errors]
PWGEM/Dilepton/Tasks/lmeeLFCocktail.cxx:348:7: error: Value stored to 'i' is never read [clang-analyzer-deadcode.DeadStores,-warnings-as-errors]
PWGEM/Dilepton/Tasks/matchingMFT.cxx:216:24: error: variable length arrays in C++ are a Clang extension [clang-diagnostic-vla-cxx-extension,-warnings-as-errors]
++ [[ 463 -gt 0 ]]
++ cat /sw/BUILD/8551299713595a48df748a0c9ce5ac3f4654ddeb/O2Physics-code-check/warnings.txt
PWGEM/Dilepton/Core/DielectronCut.cxx:209:50: warning: redundant explicit casting to the same type 'int' as the sub-expression, remove this casting [readability-redundant-casting]
PWGEM/Dilepton/Core/DielectronCut.h:45:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead [modernize-deprecated-headers]
PWGEM/Dilepton/Core/DielectronCut.h:52:3: warning: annotate this function with 'override' or (rarely) 'final' [modernize-use-override]
PWGEM/Dilepton/Core/DielectronCut.h:52:3: warning: use '= default' to define a trivial destructor [modernize-use-equals-default]
PWGEM/Dilepton/Core/DielectronCut.h:161:14: warning: redundant boolean literal in conditional return statement [readability-simplify-boolean-expr]
PWGEM/Dilepton/Core/DielectronCut.h:323:7: warning: switch has 2 consecutive identical branches [bugprone-branch-clone]
PWGEM/Dilepton/Core/DielectronCut.h:422:11: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGEM/Dilepton/Core/DielectronCut.h:485:8: warning: function 'DielectronCut::SetMindEtadPhi' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
PWGEM/Dilepton/Core/DielectronCut.h:553:3: warning: function 'IsPhotonConversionSelected' should be marked [[nodiscard]] [modernize-use-nodiscard]
PWGEM/Dilepton/Core/DielectronCut.h:564:45: warning: initializer for member 'mMaxMeePhiVDep' is redundant [readability-redundant-member-init]
PWGEM/Dilepton/Core/DielectronCut.h:600:45: warning: initializer for member 'mMaxDcaXYPtDep' is redundant [readability-redundant-member-init]
PWGEM/Dilepton/Core/DielectronCut.h:631:29: warning: initializer for member 'mMLBins' is redundant [readability-redundant-member-init]
PWGEM/Dilepton/Core/DielectronCut.h:632:29: warning: initializer for member 'mMLCuts' is redundant [readability-redundant-member-init]
PWGEM/Dilepton/Core/DileptonSV.h:95:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead [modernize-deprecated-headers]
PWGEM/Dilepton/Core/DileptonSV.h:122:8: warning: constructor does not initialize these fields: ccdb [cppcoreguidelines-pro-type-member-init]
PWGEM/Dilepton/Core/DileptonSV.h:388:20: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGEM/Dilepton/Core/DileptonSV.h:430:7: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
PWGEM/Dilepton/Core/DileptonSV.h:431:7: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
PWGEM/Dilepton/Core/DileptonSV.h:447:7: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
PWGEM/Dilepton/Core/DileptonSV.h:448:7: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
PWGEM/Dilepton/Core/DileptonSV.h:464:7: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
PWGEM/Dilepton/Core/DileptonSV.h:465:7: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
PWGEM/Dilepton/Core/DileptonSV.h:482:7: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
PWGEM/Dilepton/Core/DileptonSV.h:483:7: warning: use auto when initializing with a cast to avoid duplicating the type name [modernize-use-auto]
PWGEM/Dilepton/Core/DileptonSV.h:592:39: warning: use nullptr [modernize-use-nullptr]
PWGEM/Dilepton/Core/DileptonSV.h:593:43: warning: use nullptr [modernize-use-nullptr]
PWGEM/Dilepton/Core/DileptonSV.h:648:25: warning: do not use reinterpret_cast [cppcoreguidelines-pro-type-reinterpret-cast]
PWGEM/Dilepton/Core/DileptonSV.h:669:11: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGEM/Dilepton/Core/DileptonSV.h:965:7: warning: do not use 'else' after 'return' [readability-else-after-return]
PWGEM/Dilepton/Core/DileptonSV.h:1115:9: warning: if with identical then and else branches [bugprone-branch-clone]
PWGEM/Dilepton/Core/DileptonSV.h:1156:105: warning: repeated branch body in conditional chain [bugprone-branch-clone]
PWGEM/Dilepton/Core/DileptonSV.h:1535:13: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGEM/Dilepton/Core/DileptonSV.h:1548:13: warning: do not declare C-style arrays, use 'std::array' instead [modernize-avoid-c-arrays]
PWGEM/Dilepton/Core/DileptonSV.h:1658:36: warning: boolean expression can be simplified by DeMorgan's theorem [readability-simplify-boolean-expr]
PWGEM/Dilepton/Core/DileptonSV.h:1763:7: warning: if with identical then and else branches [bugprone-branch-clone]
[0 more errors; see full log]

Full log here.

@alibuild

alibuild commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Error while checking build/O2Physics/o2 for 5bec802 at 2026-09-09 13:16:

## sw/BUILD/O2Physics-latest/log
c++: fatal error: Killed signal terminated program cc1plus
ninja: build stopped: subcommand failed.

Full log here.

@vkucera

vkucera commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

Ping

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

Labels

photon Photon and neutral meson PAG label pwgem

Development

Successfully merging this pull request may close these issues.

2 participants