FairRootGroup / FairRoot

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

Disable streamer for FairRootManager and fix unconditional dereference in `SetSink()` #1570

Closed dennisklein closed 4 months ago

dennisklein commented 4 months ago

@ChristianTackeGSI Here are some bits of the FairRootManager work I am currently preparing as separate PR as requested.

coderabbitai[bot] commented 4 months ago
Walkthrough ## Walkthrough This version introduces a breaking change in the FairRoot library, removing the auto-generation of streamers for `FairRootManager`, altering `ClassDefOverride`, modifying the linking directive, and updating `FairRun::SetSink`'s functionality. These changes refine how object management and output file handling are done by the library. ## Changes | File | Change Summary | |----------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------| | `CHANGELOG.md` | Noted the breaking change of no streamer generation for `FairRootManager` and its impact. | | `fairroot/base/LinkDef.h` | Removed the `+` after `FairRootManager` in `#pragma link` directive. | | `fairroot/base/steer/FairRootManager.h`| Changed `ClassDefOverride` macro for `FairRootManager` from `14` to `0`. | | `fairroot/base/steer/FairRun.cxx` | `FairRun::SetSink` now checks if `fSink` is null before setting `fUserOutputFileName` or clearing it if not. | | `fairroot/base/steer/FairRun.h` | Changed `SetSink` method declaration to accept a `std::unique_ptr`. Removed `SetSink(FairSink* tempSink)` method and adjusted the corresponding `.h`. | ## Sequence Diagrams ### FairRun SetSink Method (New Flow) ```mermaid sequenceDiagram participant User as Caller participant FRun as FairRun participant Sink as FairSink User->>FRun: SetSink(std::unique_ptr newsink) FRun->>Sink: Check if newsink is not nullptr alt newsink not nullptr Sink-->>FRun: Return FileName FRun->>FRun: Set fUserOutputFileName else newsink is nullptr FRun->>FRun: Clear fUserOutputFileName end ``` ### FairRun SetSink Method (Old Flow) ```mermaid sequenceDiagram participant User as Caller participant FRun as FairRun participant Sink as FairSink User->>FRun: SetSink(FairSink* tempSink) alt tempSink not nullptr Sink-->>FRun: Return FileName FRun->>FRun: Set fUserOutputFileName else tempSink is nullptr FRun->>FRun: Clear fUserOutputFileName end ```

Recent review details **Configuration used: CodeRabbit UI** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between 35dfce0cc03c450a6936cb53e43d81834aeacac1 and 39b93f7f8c73a2836afdf3911f425e1067da14b0.
Files selected for processing (5) * CHANGELOG.md (1 hunks) * fairroot/base/LinkDef.h (1 hunks) * fairroot/base/steer/FairRootManager.h (1 hunks) * fairroot/base/steer/FairRun.cxx (1 hunks) * fairroot/base/steer/FairRun.h (1 hunks)
Files skipped from review due to trivial changes (1) * fairroot/base/LinkDef.h
Additional context used
LanguageTool
CHANGELOG.md
[uncategorized] ~11-~11: Did you mean the adverb “anymore”? Context: ...amer is generated for `FairRootManager` any more ## 19.0.0 - 2024-05-17 ### Breaking C... (ANY_MORE) --- [style] ~58-~58: ‘was in conflict with’ might be wordy. Consider a shorter alternative. Context: ...pped build switch `BUILD_UNITTESTS`, it was in conflict with the CMake standard switch [`BUILD_T... (EN_WORDINESS_PREMIUM_WAS_IN_CONFLICT_WITH) --- [formatting] ~153-~153: Consider inserting a comma after an introductory phrase for better readability. Context: ...es * Allow running without output sink. In this case even persistent branches would not be s... (IN_THAT_CASE_COMMA) --- [uncategorized] ~161-~161: A comma may be missing after the conjunctive/linking adverb ‘Also’. Context: ... the Base into the Online library. * Also the MBS/LMD related source classes were... (SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA) --- [grammar] ~163-~163: With the singular noun ‘one’, use the verb “is”. Context: ...ne library. * If one of these classes are used in your code, you need to link... (SINGULAR_NOUN_VERB_AGREEMENT) --- [style] ~181-~181: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym. Context: ... being set, rewrite it accordingly. * If your code has specific C++ needs, consi... (ENGLISH_WORD_REPEAT_BEGINNING_RULE) --- [uncategorized] ~182-~182: Possible missing comma found. Context: ... CMake's `target_compile_features()`. * Dropped `CHECK_EXTERNAL_PACKAGE_INSTALL_DIR` ... (AI_HYDRA_LEO_MISSING_COMMA) --- [misspelling] ~184-~184: This word is normally spelled as one. Context: ...`USE_PATH_INFO` CMake option. It was an anti-pattern. Don't use it! * Dropped `ROOT_GENERATE... (EN_COMPOUNDS_ANTI_PATTERN) --- [grammar] ~200-~200: The word “opt-in” is a noun. The verb is spelled with a space. Context: ...on Boost.Serialization. The user must opt-in to the previously baseline Boost serial... (NOUN_VERB_CONFUSION) --- [grammar] ~200-~200: You used an adverb (‘previously’) instead of an adjective, or a noun (‘baseline’) instead of another adjective. Context: ...ialization. The user must opt-in to the previously baseline Boost serialization support by includ... (A_RB_NN) --- [typographical] ~213-~213: The conjunction “so that” does not have a comma in front. Context: ...y require some API, please file an issue, so that we can see how to handle this. * Depre... (SO_THAT_UNNECESSARY_COMMA) --- [uncategorized] ~225-~225: Loose punctuation mark. Context: ...tion`. * `FairRadMapManager::Instance`, `FairRadLenManager::Instance` * `Fair... (UNLIKELY_OPENING_PUNCTUATION) --- [uncategorized] ~229-~229: Loose punctuation mark. Context: ...thing. * `FairTask::*InputPersistance`: There's no getter for `fInputPersis... (UNLIKELY_OPENING_PUNCTUATION) --- [uncategorized] ~236-~236: Loose punctuation mark. Context: ...ConstructASCIIGeometry(T*, TString, U*)`, use `FairModule::ConstructASCIIGeom... (UNLIKELY_OPENING_PUNCTUATION) --- [uncategorized] ~262-~262: Possible missing comma found. Context: ...se` style naming. For those using the targets this change will not be visible. * Test... (AI_HYDRA_LEO_MISSING_COMMA) --- [formatting] ~263-~263: If the ‘because’ clause is essential to the meaning, do not use a comma before the clause. Context: ...ing Geant3 have been disabled by default, because those tests have a probability > 0 fo... (COMMA_BEFORE_BECAUSE) --- [style] ~265-~265: The word ‘anyways’ is informal American English. Did you mean “anyway”? Context: ... for failing. If you want to run them anyways, pass `-DENABLE_GEANT3_TESTING=ON` to... (ANYWAYS)
Markdownlint
CHANGELOG.md
120-120: Expected: 1; Actual: 0; Below Headings should be surrounded by blank lines (MD022, blanks-around-headings) --- 132-132: Expected: 1; Actual: 0; Below Headings should be surrounded by blank lines (MD022, blanks-around-headings) --- 140-140: Expected: 1; Actual: 0; Below Headings should be surrounded by blank lines (MD022, blanks-around-headings) --- 146-146: Expected: 1; Actual: 0; Below Headings should be surrounded by blank lines (MD022, blanks-around-headings) --- 152-152: Expected: 1; Actual: 0; Below Headings should be surrounded by blank lines (MD022, blanks-around-headings) --- 157-157: Expected: 1; Actual: 0; Below Headings should be surrounded by blank lines (MD022, blanks-around-headings) --- 245-245: Expected: 1; Actual: 0; Below Headings should be surrounded by blank lines (MD022, blanks-around-headings) --- 36-36: null Fenced code blocks should be surrounded by blank lines (MD031, blanks-around-fences) --- 39-39: null Fenced code blocks should be surrounded by blank lines (MD031, blanks-around-fences) --- 168-168: null Fenced code blocks should be surrounded by blank lines (MD031, blanks-around-fences) --- 170-170: null Fenced code blocks should be surrounded by blank lines (MD031, blanks-around-fences) --- 171-171: null Fenced code blocks should be surrounded by blank lines (MD031, blanks-around-fences) --- 173-173: null Fenced code blocks should be surrounded by blank lines (MD031, blanks-around-fences) --- 174-174: null Fenced code blocks should be surrounded by blank lines (MD031, blanks-around-fences) --- 178-178: null Fenced code blocks should be surrounded by blank lines (MD031, blanks-around-fences) --- 202-202: null Fenced code blocks should be surrounded by blank lines (MD031, blanks-around-fences) --- 205-205: null Fenced code blocks should be surrounded by blank lines (MD031, blanks-around-fences) --- 121-121: null Lists should be surrounded by blank lines (MD032, blanks-around-lists) --- 133-133: null Lists should be surrounded by blank lines (MD032, blanks-around-lists) --- 141-141: null Lists should be surrounded by blank lines (MD032, blanks-around-lists) --- 147-147: null Lists should be surrounded by blank lines (MD032, blanks-around-lists) --- 153-153: null Lists should be surrounded by blank lines (MD032, blanks-around-lists) --- 158-158: null Lists should be surrounded by blank lines (MD032, blanks-around-lists) --- 246-246: null Lists should be surrounded by blank lines (MD032, blanks-around-lists) --- 20-20: null Bare URL used (MD034, no-bare-urls) --- 22-22: null Bare URL used (MD034, no-bare-urls) --- 97-97: null Bare URL used (MD034, no-bare-urls) --- 116-116: null Bare URL used (MD034, no-bare-urls)
Additional comments not posted (4)
fairroot/base/steer/FairRun.h (1)
`90-90`: **Good use of smart pointers in `SetSink`.** The update to use `std::unique_ptr` for managing the `FairSink` object in `SetSink` method is a modern C++ practice that helps prevent memory leaks and ensures better resource management.
fairroot/base/steer/FairRun.cxx (1)
`194-198`: **Proper handling of sink state in `SetSink`.** The implementation of `SetSink` properly manages the state of `fSink` and `fUserOutputFileName`, ensuring that the filename is set correctly or cleared based on the state of `fSink`.
CHANGELOG.md (1)
`11-11`: **Accurate documentation of breaking changes.** The changelog correctly documents the removal of the streamer for `FairRootManager` as a breaking change, which aligns with the code changes made in the PR.
Tools
LanguageTool
[uncategorized] ~11-~11: Did you mean the adverb “anymore”? Context: ...amer is generated for `FairRootManager` any more ## 19.0.0 - 2024-05-17 ### Breaking C... (ANY_MORE)
fairroot/base/steer/FairRootManager.h (1)
`398-398`: **Correct setting of ClassDefOverride for streamer removal.** The `ClassDefOverride` macro is set to `0`, which correctly disables the generation of a streamer for `FairRootManager`, aligning with the intended changes.
--- 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](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `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 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 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 as 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. 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. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.