-
Notifications
You must be signed in to change notification settings - Fork 176
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
chore: Sonar fixes after detector refactor #3968
chore: Sonar fixes after detector refactor #3968
Conversation
ed3e144
to
cbf8f78
Compare
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.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (1)
Examples/Detectors/DD4hepDetector/src/DD4hepDetector.cpp (1)
121-136
: Duplicate sorting logic, I see. Refactor this, we should.Similar lambda functions, four times repeated they are. A template function or common comparator, better it would be.
+ auto compareDetElements = [](const dd4hep::DetElement& a, + const dd4hep::DetElement& b) { + return (a.id() < b.id()); + }; - std::ranges::sort( - muon, [](const dd4hep::DetElement& a, const dd4hep::DetElement& b) { - return (a.id() < b.id()); - }); + std::ranges::sort(muon, compareDetElements); - std::ranges::sort( - eCal, [](const dd4hep::DetElement& a, const dd4hep::DetElement& b) { - return (a.id() < b.id()); - }); + std::ranges::sort(eCal, compareDetElements); // Apply similar changes to hCal and tracker sorting
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (3)
Examples/Algorithms/Geant4/include/ActsExamples/Geant4/Geant4Simulation.hpp
(1 hunks)Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/AlignedDetector.hpp
(1 hunks)Examples/Detectors/DD4hepDetector/src/DD4hepDetector.cpp
(3 hunks)
🔇 Additional comments (3)
Examples/Detectors/ContextualDetector/include/ActsExamples/ContextualDetector/AlignedDetector.hpp (1)
25-29
: Careful with platform compatibility, you must be.
Changed from std::size_t
to unsigned int
, these configuration parameters have. On 64-bit systems where large values you need, limitations this may bring. Consider these implications, you should:
- On 64-bit systems,
std::size_t
is typically 64 bits unsigned int
usually 32 bits remains, regardless of platform
Examples/Detectors/DD4hepDetector/src/DD4hepDetector.cpp (1)
89-90
: Wisdom in const-correctness, I sense.
The Force is strong with this change. Using const auto&
prevents accidental modifications and improves clarity, it does.
Examples/Algorithms/Geant4/include/ActsExamples/Geant4/Geant4Simulation.hpp (1)
211-211
: Changed from final to override, the execute method has. Implications, this brings.
Removed the final
specifier, more flexibility it provides. But careful consideration needed:
- Derived classes may now override this method
- Ensure documentation reflects this design change
- Verify all derived classes maintain the contract
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.
Thanks!
|
Blocked by:
Summary by CodeRabbit
New Features
DD4hepDetector
class by using const references in loop iterations.Bug Fixes
Config
struct of theAlignedDetector
class for better performance and accuracy.Config
struct in theAlignedDetector
class.