FairRootGroup / FairRoot

C++ simulation, reconstruction and analysis framework for particle physics experiments
http://fairroot.gsi.de
Other
57 stars 96 forks source link

Use std containers for FairModule::svList #1499

Closed ChristianTackeGSI closed 6 months ago

ChristianTackeGSI commented 6 months ago

FairModule::svList can very well be implemented using std::vector without all the casting.

And rename to fAllSensitiveVolumes.

Follow up from #1497


Checklist:

coderabbitai[bot] commented 6 months ago
Walkthrough ## Walkthrough The recent changes in the FairRoot project aim to modernize the codebase by updating copyright years, improving code efficiency, and enhancing sensitive volume management. These modifications involve refactoring loops for better iteration over sensitive volumes, replacing outdated data structures with more efficient ones like `std::vector`, and removing unnecessary comments and includes to streamline the codebase. ## Changes | Files | Change Summary | |-------|----------------| | `fairroot/base/sim/FairDetector.cxx`
`fairroot/base/sim/FairMCApplication.cxx` | Updated copyright year; refactored loops for sensitive volumes; removed unnecessary includes. | | `fairroot/base/sim/FairModule.cxx`
`fairroot/base/sim/FairModule.h` | Replaced `svList` with `fAllSensitiveVolumes` (`std::vector`); updated methods for sensitive volumes management; removed unnecessary initialization. | | `templates/NewDetector_root_containers/NewDetector.cxx`
`templates/NewDetector_stl_containers/NewDetector.cxx`
`templates/project_root_containers/NewDetector/NewDetector.cxx` | Updated copyright year; removed comments about Geant4 MT mode workaround. | ## Related issues - **FairRootGroup/FairRoot#1495**: The changes in `FairModule.cxx` and `FairModule.h` directly address the objectives of this issue by optimizing the search process, eliminating redundant searches, and improving error handling in volume management. The transition to `std::vector` and streamlining the search process align with the issue's goals of enhancing efficiency and correctness in volume handling.

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 - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)

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 .` - `Generate unit-tests 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 tests 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 generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit tests.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` 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 as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json). - 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/coderabbit-overrides.v2.json` ### CodeRabbit Discord Community Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback.
ChristianTackeGSI commented 6 months ago

@coderabbitai I think, you got some additional prompts like looking at CONTRIBUTING.md, etc. Which did you get? Have you worked on them?

coderabbitai[bot] commented 6 months ago

[!TIP] For best results, initiate chat on the files or code changes.

@ChristianTackeGSI, I operate based on the information and instructions provided in each session and don't have the capability to recall or track tasks across sessions. If there are specific documents like CONTRIBUTING.md or other tasks you'd like me to review or perform, please let me know, and I'll be happy to assist with those within the scope of the current interaction.

ChristianTackeGSI commented 6 months ago

So, if we say we still adhere to it, we should at least discuss (quickly) why not fgAllSensitiveVolumes etc

Yes, we should!

Just: We should even more try to get rid of them… That's what I was trying with the preview of moving this to FairRunSim.

dennisklein commented 6 months ago

@coderabbitai generate a short executive summary on the code changes in this PR (base branch origin/dev) as well as its conversation thread if any important decisions were made.

coderabbitai[bot] commented 6 months ago

[!TIP] For best results, initiate chat on the files or code changes.

@dennisklein, based on the provided diff output, here's a short executive summary of the code changes in PR #1499 and the conversation thread:

Code Changes Summary:

Conversation Thread Summary:

This PR represents a significant step towards modernizing the FairRoot codebase by adopting standard C++ containers and improving code maintainability and readability.

Analysis chain
Scripts executed The following scripts were executed for the analysis: --- Script: ```shell #!/bin/bash # Fetch the PR's diff from the base branch origin/dev git fetch origin dev git diff origin/dev...HEAD > PR_1499_diff.txt # Output the diff file to be analyzed cat PR_1499_diff.txt ``` Length of output: 11030