Skip to content
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

refactor: replace long unsigned int with std::size_t #3930

Merged
merged 3 commits into from
Dec 2, 2024

Conversation

AJPfleger
Copy link
Contributor

@AJPfleger AJPfleger commented Dec 2, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced error handling for input space points in the GbtsSeedingAlgorithm.
    • Improved seed finding logic based on internal ROI descriptors.
  • Bug Fixes

    • Updated handling of mapping logic to ensure clarity and prevent missing keys.
  • Refactor

    • Changed variable types from long unsigned int to std::size_t across multiple components for improved type safety.
  • Tests

    • Updated loop index types in various test cases to enhance type safety and align with best practices.

@AJPfleger AJPfleger added this to the next milestone Dec 2, 2024
Copy link

coderabbitai bot commented Dec 2, 2024

Walkthrough

Modifications made to the GbtsSeedingAlgorithm class enhance configuration handling, input validation, and error checking. The constructor processes various parameters, while the execute method introduces a new seed finder. The mapping logic in makeActsGbtsMap is refined, and several methods now utilize std::size_t for improved type consistency. Changes in the RootAthenaDumpReader class and various test files also replace long unsigned int with std::size_t, reinforcing type safety across the codebase.

Changes

File Change Summary
Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp Constructor updates for configuration parameters; enhanced error checking; new seed finder in execute; refined makeActsGbtsMap and MakeGbtsSpacePoints methods; updated loop index in LayerNumbering to std::size_t.
Examples/Io/Root/include/ActsExamples/Io/Root/RootAthenaDumpReader.hpp Changed member variable m_events from long unsigned int to std::size_t.
Tests/UnitTests/Plugins/GeoModel/GeoBoxToVolumeTest.cpp Updated loop index from long unsigned int to std::size_t.
Tests/UnitTests/Plugins/GeoModel/GeoDetectorObjectTest.cpp Changed loop counters from long unsigned int to std::size_t in two instances.
Tests/UnitTests/Plugins/GeoModel/GeoPolyConverterTests.cpp Updated loop indices from long unsigned int to std::size_t in two loops.
Tests/UnitTests/Plugins/GeoModel/GeoTubeToVolumeTest.cpp Changed loop variable type from long unsigned int to std::size_t.

Possibly related PRs

Suggested labels

Component - Core, Changes Performance

Suggested reviewers

  • andiwand
  • benjaminhuth

In code we trust, with changes so bright,
From long unsigned to std::size_t, we write.
With seeds now found, and errors checked,
The algorithm shines, our code we perfect!
Hooray for the updates, let’s celebrate,
In the world of coding, we elevate! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Member

@stephenswat stephenswat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sizeable if true.

@AJPfleger AJPfleger marked this pull request as ready for review December 2, 2024 12:37
Copy link

@coderabbitai coderabbitai bot left a 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/Io/Root/include/ActsExamples/Io/Root/RootAthenaDumpReader.hpp (1)

175-175: Approve this change, I do! Wise choice, std::size_t is.

Consistent with modern C++ practices and STL containers, this change is. A natural fit for size-related variables, std::size_t proves to be.

Hmmmm... Consider similar updates for array size constants like maxCL, maxSP, you should. Consistency in the Force, important it is.

- static constexpr unsigned int maxCL = 1500000;
- static constexpr unsigned int maxSP = 1500000;
- static constexpr unsigned int maxDTT = 1500000;
- static constexpr unsigned int maxTRK = 1500000;
- static constexpr unsigned int maxPart = 1500000;
+ static constexpr std::size_t maxCL = 1500000;
+ static constexpr std::size_t maxSP = 1500000;
+ static constexpr std::size_t maxDTT = 1500000;
+ static constexpr std::size_t maxTRK = 1500000;
+ static constexpr std::size_t maxPart = 1500000;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between bf997eb and 778a5a7.

📒 Files selected for processing (6)
  • Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp (1 hunks)
  • Examples/Io/Root/include/ActsExamples/Io/Root/RootAthenaDumpReader.hpp (1 hunks)
  • Tests/UnitTests/Plugins/GeoModel/GeoBoxToVolumeTest.cpp (1 hunks)
  • Tests/UnitTests/Plugins/GeoModel/GeoDetectorObjectTest.cpp (2 hunks)
  • Tests/UnitTests/Plugins/GeoModel/GeoPolyConverterTests.cpp (1 hunks)
  • Tests/UnitTests/Plugins/GeoModel/GeoTubeToVolumeTest.cpp (1 hunks)
🔇 Additional comments (7)
Examples/Algorithms/TrackFinding/src/GbtsSeedingAlgorithm.cpp (1)

358-360: Good choice, using std::size_t for loop index, you have made.

Type safety and consistency, it enhances, when iterating over container sizes.

Tests/UnitTests/Plugins/GeoModel/GeoTubeToVolumeTest.cpp (1)

59-61: Wise decision, changing loop index to std::size_t is.

Prevents type mismatches, it does, and enhances safety.

Tests/UnitTests/Plugins/GeoModel/GeoBoxToVolumeTest.cpp (1)

61-63: Commendable, your use of std::size_t for loop index is.

Improves type safety, it does, ensuring proper iteration.

Tests/UnitTests/Plugins/GeoModel/GeoPolyConverterTests.cpp (2)

91-94: Enhanced, your loop indices are, with std::size_t.

Consistency and safety, this change brings.


99-102: Again, std::size_t for loop index, you have wisely used.

Robustness in code, it ensures.

Tests/UnitTests/Plugins/GeoModel/GeoDetectorObjectTest.cpp (2)

46-48: Improved, the loop counter is, by using std::size_t.

Type safety, it provides, when indexing containers.


78-81: Consistent use of std::size_t, commendable it is.

Enhances code reliability, this change does.

Copy link

github-actions bot commented Dec 2, 2024

📊: Physics performance monitoring for 778a5a7

Full contents

physmon summary

Copy link

sonarqubecloud bot commented Dec 2, 2024

@kodiakhq kodiakhq bot merged commit 4a506f8 into acts-project:main Dec 2, 2024
49 checks passed
@github-actions github-actions bot removed the automerge label Dec 2, 2024
@AJPfleger AJPfleger deleted the long-unsigned-int branch December 2, 2024 17:53
@paulgessinger paulgessinger modified the milestones: next, v38.1.0 Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Examples Affects the Examples module Component - Plugins Affects one or more Plugins Track Finding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants