-
Notifications
You must be signed in to change notification settings - Fork 36
fix: use find_if instead of iterator loops with break #2383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Refactors a few remaining “iterator loop + break” patterns into std::find_if-based lookups now that podio collections support this more cleanly, and removes outdated commented examples.
Changes:
- Replace manual association-search loops with
std::find_ifin scattered-electron association logic. - Update beam-particle selection helpers in
Beam.hto usestd::find_if. - Remove a large block of obsolete commented-out iteration examples.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/algorithms/reco/ScatteredElectronsTruth.cc |
Uses std::find_if to locate the truth↔reco association instead of a manual loop. |
src/algorithms/reco/InclusiveKinematicsElectron.cc |
Removes outdated commented code demonstrating older iteration patterns. |
src/algorithms/reco/HadronicFinalState.cc |
Uses std::find_if for truth↔reco association lookup instead of a manual loop. |
src/algorithms/reco/Beam.h |
Refactors “find first with PDG/status” helpers to std::find_if and adds <algorithm>. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This reverts commit e4db126.
Briefly, what does this PR introduce?
Needs:
In a few places, due to historical limitations of podio collections, we were still using iterator-based loops with tests and early break to do things that are more nicely done with
find_ifnowadays. This PR introduces thefind_ifbased approach in a few cases, and removes a comment block complaints about all that used to not work...What kind of change does this PR introduce?
Please check if this PR fulfills the following:
Does this PR introduce breaking changes? What changes might users need to make to their code?
No.
Does this PR change default behavior?
No.