-
Notifications
You must be signed in to change notification settings - Fork 99
Fix pythia6 dependency #1602
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
Fix pythia6 dependency #1602
Conversation
📝 WalkthroughWalkthroughThe pull request updates numerous files across example, FairRoot, and template directories to replace direct accesses to the global Monte Carlo instance ( Changes
Sequence Diagram(s)sequenceDiagram
participant Code as Code Component
participant TVMC as TVirtualMC
participant MC as Monte Carlo Instance
Code->>TVMC: TVirtualMC::GetMC()
TVMC-->>Code: Returns current MC instance
Code->>MC: Call methods (e.g., GetDecayer, GetStack, IsMT)
Possibly related PRs
Suggested reviewers
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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
🧹 Nitpick comments (1)
templates/project_stl_containers/gconfig/UserDecay.C (1)
12-13: Style change: Pointer notation moved next to type.Formatting change that moves the asterisk from being next to the variable name to being next to the type name. This is a cosmetic change that does not affect functionality.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (21)
examples/common/gconfig/g4Config.C(0 hunks)examples/common/mcstack/FairStack.cxx(2 hunks)examples/simulation/Tutorial1/macros/CMakeLists.txt(1 hunks)examples/simulation/Tutorial4/gconfig/DecayConfig.C(3 hunks)examples/simulation/Tutorial4/gconfig/SetCuts.C(1 hunks)examples/simulation/Tutorial4/gconfig/flConfig.C(1 hunks)examples/simulation/Tutorial4/gconfig/g4Config.C(1 hunks)fairroot/base/sim/FairDetector.cxx(2 hunks)fairroot/base/sim/FairGenericStack.cxx(2 hunks)fairroot/base/sim/FairMCApplication.cxx(3 hunks)fairroot/fastsim/FairFastSimModel.cxx(3 hunks)templates/NewDetector_root_containers/NewDetector.cxx(4 hunks)templates/project_root_containers/MyProjData/MyProjStack.cxx(2 hunks)templates/project_root_containers/NewDetector/NewDetector.cxx(3 hunks)templates/project_root_containers/gconfig/DecayConfig.C(3 hunks)templates/project_root_containers/gconfig/UserDecay.C(2 hunks)templates/project_root_containers/gconfig/g4Config.C(1 hunks)templates/project_stl_containers/MyProjData/MyProjStack.cxx(2 hunks)templates/project_stl_containers/gconfig/DecayConfig.C(3 hunks)templates/project_stl_containers/gconfig/UserDecay.C(2 hunks)templates/project_stl_containers/gconfig/g4Config.C(1 hunks)
💤 Files with no reviewable changes (1)
- examples/common/gconfig/g4Config.C
🧰 Additional context used
🧬 Code Definitions (4)
templates/NewDetector_root_containers/NewDetector.cxx (7)
templates/project_root_containers/NewDetector/NewDetector.cxx (4) (4)
Reset(166-169)Reset(166-166)CloneModule(239-242)CloneModule(239-239)templates/project_stl_containers/NewDetector/NewDetector.cxx (4) (4)
Reset(153-159)Reset(153-153)CloneModule(229-229)CloneModule(229-229)examples/MQ/pixelDetector/src/Pixel.cxx (4) (4)
Reset(154-154)Reset(154-154)CloneModule(183-183)CloneModule(183-183)fairroot/base/sim/FairModule.cxx (2) (2)
CloneModule(683-687)CloneModule(683-683)examples/simulation/Tutorial1/src/FairFastSimExample.cxx (2) (2)
CloneModule(177-180)CloneModule(177-177)examples/simulation/Tutorial1/src/FairFastSimExample2.cxx (2) (2)
CloneModule(157-160)CloneModule(157-157)examples/simulation/Tutorial1/src/FairTutorialDet1.cxx (2) (2)
CloneModule(145-148)CloneModule(145-145)
fairroot/base/sim/FairGenericStack.cxx (1)
fairroot/base/sim/FairGenericStack.h (4) (4)
FairGenericStack(36-36)FairGenericStack(39-39)FairGenericStack(42-42)FairGenericStack(194-194)
fairroot/base/sim/FairDetector.cxx (2)
fairroot/base/sim/FairDetector.h (4) (4)
FairDetector(36-36)FairDetector(40-40)FairDetector(44-44)FairDetector(110-110)fairroot/base/sim/FairModule.h (1) (1)
flGeoPar(141-141)
fairroot/base/sim/FairMCApplication.cxx (1)
fairroot/base/sim/FairMCApplication.h (1) (1)
fMC(235-235)
🔇 Additional comments (51)
fairroot/base/sim/FairDetector.cxx (2)
45-48: Improved code formatting for destructorThe destructor has been reformatted from a single-line to a multi-line implementation, which enhances readability while maintaining the same functionality.
94-94: Improved encapsulation by replacing direct gMC accessChanged direct access to
gMCto useTVirtualMC::GetMC()instead, which improves encapsulation and decouples the code from the global Monte Carlo instance. This change aligns with the PR objective of fixing the pythia6 dependency issue.templates/project_root_containers/NewDetector/NewDetector.cxx (3)
150-150: Improved encapsulation by replacing direct gMC accessChanged direct access to
gMCto useTVirtualMC::GetMC()instead, which improves encapsulation and decouples the code from the global Monte Carlo instance. This change is consistent with similar changes in other files and aligns with the PR objective of fixing pythia6 dependencies.
166-169: Improved code formatting for Reset methodThe
Reset()method has been reformatted from a single-line to a multi-line implementation, which enhances readability while maintaining the same functionality.
239-242: Improved code formatting for CloneModule methodThe
CloneModule()method has been reformatted from a single-line to a multi-line implementation, which enhances readability while maintaining the same functionality.templates/project_stl_containers/gconfig/g4Config.C (1)
56-56: Decoupled from direct Pythia6 dependencyChanged from directly instantiating a Pythia6 decayer with
TPythia6Decayer::Instance()to retrieving the decayer from the Monte Carlo instance withTVirtualMC::GetMC()->GetDecayer(). This modification reduces direct dependency on Pythia6-specific classes and allows the framework to use whatever decayer is configured in the Monte Carlo instance, improving flexibility and directly addressing the PR objective of fixing pythia6 dependency issues.examples/simulation/Tutorial4/gconfig/g4Config.C (1)
51-51: Decoupled from direct Pythia6 dependencyChanged from directly instantiating a Pythia6 decayer with
TPythia6Decayer::Instance()to retrieving the decayer from the Monte Carlo instance withTVirtualMC::GetMC()->GetDecayer(). This modification reduces direct dependency on Pythia6-specific classes and allows the framework to use whatever decayer is configured in the Monte Carlo instance, improving flexibility and directly addressing the PR objective of fixing pythia6 dependency issues.templates/project_root_containers/gconfig/g4Config.C (1)
56-56: Good improvement in usingTVirtualMC::GetMC()->GetDecayer()This change replaces a direct decayer retrieval with the virtual MC interface, which is more robust and follows the pattern used throughout the codebase. This approach ensures consistent access to the Monte Carlo components and helps with the Pythia6 dependency issues.
templates/project_root_containers/MyProjData/MyProjStack.cxx (2)
28-28: Correct header inclusion for TVirtualMCAdding the proper include for
TVirtualMC.his necessary to support the changes in theRegistermethod.
358-358: Good refactoring to useTVirtualMC::GetMC()Replacing direct access to the global
gMCpointer with the static methodTVirtualMC::GetMC()improves encapsulation and makes the code more maintainable. This change also helps with the Pythia6 dependency issues by ensuring consistent access to Monte Carlo components.examples/simulation/Tutorial1/macros/CMakeLists.txt (2)
25-32: Good conditional test handling for Pythia6This change correctly adds a conditional check to ensure that Pythia6 tests only run when the Pythia6 library is found. This prevents test failures when Pythia6 is not available, which aligns with the PR's goal of fixing Pythia6 dependencies.
34-41: Good conditional test handling for Pythia8Similar to the Pythia6 check, this correctly adds a conditional check for Pythia8 tests, ensuring they only run when the Pythia8 library is available.
templates/project_stl_containers/MyProjData/MyProjStack.cxx (2)
28-28: Correct header inclusion for TVirtualMCAdding the proper include for
TVirtualMC.his necessary to support the changes in theRegistermethod.
363-363: Good refactoring to useTVirtualMC::GetMC()Replacing direct access to the global
gMCpointer with the static methodTVirtualMC::GetMC()improves encapsulation and makes the code more maintainable. This is consistent with similar changes in other files and helps resolve the Pythia6 dependency issues.examples/simulation/Tutorial4/gconfig/flConfig.C (2)
17-17: Style improvement for pointer declaration.The pointer asterisk is now attached to the type rather than the variable name, which is more consistent with modern C++ style.
19-20: Good replacement of direct gMC access with TVirtualMC::GetMC().This change from using the global Monte Carlo instance directly to accessing it through TVirtualMC::GetMC() is an important fix to maintain compatibility with newer ROOT versions where pythia6 support has changed.
examples/simulation/Tutorial4/gconfig/DecayConfig.C (4)
42-42: Updated comment to reflect API changes.The comment correctly reflects the updated method for setting user decay through TVirtualMC::GetMC() instead of directly using gMC.
46-46: Good replacement of direct gMC access with TVirtualMC::GetMC().Properly updated to use TVirtualMC::GetMC() for setting the external decayer, which aligns with the PR's objective of fixing pythia6 dependency issues.
60-61: Consistent use of TVirtualMC::GetMC() for condition and decay setting.Both the check for TGeant3 and SetUserDecay call have been updated to use TVirtualMC::GetMC(), maintaining consistency throughout the code.
79-81: Consistent use of TVirtualMC::GetMC() in second decay loop.The pattern of using TVirtualMC::GetMC() is correctly applied to the second loop handling different particle types, ensuring a consistent approach throughout the file.
fairroot/fastsim/FairFastSimModel.cxx (5)
77-77: Good replacement of direct gMC access with TVirtualMC::GetMC().Correctly updated to use TVirtualMC::GetMC()->GetStack() for getting the moved index from the FairGenericStack.
81-81: Consistent use of TVirtualMC::GetMC() for stack access.This second instance of stack access has been properly updated to use TVirtualMC::GetMC(), maintaining consistency throughout the method.
83-83: Consistent use of TVirtualMC::GetMC() for particles list access.The retrieval of particle list from the stack has been correctly updated to use TVirtualMC::GetMC().
113-114: Updated log message to use TVirtualMC::GetMC().The debug log message has been properly updated to retrieve the current track number through TVirtualMC::GetMC()->GetStack().
146-146: Consistent use of TVirtualMC::GetMC() for clearing moved index.The final operation to clear the moved index has been appropriately updated to use TVirtualMC::GetMC().
templates/project_root_containers/gconfig/UserDecay.C (2)
12-13: Style improvement for pointer declarations.The pointer asterisks are now attached to the type rather than the variable name, which is more consistent with modern C++ style.
41-41: Good replacement of direct gMC access with TVirtualMC::GetMC().The decay mode setting has been correctly updated to use TVirtualMC::GetMC() instead of gMC, which is essential for compatibility with newer ROOT versions where pythia6 support has changed.
templates/project_stl_containers/gconfig/UserDecay.C (1)
41-41: Good change replacing gMC with TVirtualMC::GetMC()This change replaces direct access to the global Monte Carlo instance (gMC) with the TVirtualMC::GetMC() accessor method. This is more robust and aligned with the PR's goal of fixing Pythia6 dependency issues in newer ROOT versions.
templates/project_stl_containers/gconfig/DecayConfig.C (4)
43-43: Comment updated to use TVirtualMC::GetMC() instead of gMC.The comment has been updated to reflect the code changes elsewhere in the file. This ensures consistency in the documentation.
47-47: Good change replacing gMC with TVirtualMC::GetMC()This change replaces direct access to the global Monte Carlo instance (gMC) with the TVirtualMC::GetMC() accessor method. This is more robust and aligned with the PR's goal of fixing Pythia6 dependency issues in newer ROOT versions.
61-62: Good change replacing gMC with TVirtualMC::GetMC()Both the conditional check and the method call now use TVirtualMC::GetMC() instead of directly accessing gMC. This makes the code more maintainable and aligned with modern ROOT versions.
80-81: Good change replacing gMC with TVirtualMC::GetMC()Both the conditional check and the method call now use TVirtualMC::GetMC() instead of directly accessing gMC. This makes the code more maintainable and aligned with modern ROOT versions.
templates/project_root_containers/gconfig/DecayConfig.C (4)
43-43: Comment updated to use TVirtualMC::GetMC() instead of gMC.The comment has been updated to reflect the code changes elsewhere in the file. This ensures consistency in the documentation.
47-47: Good change replacing gMC with TVirtualMC::GetMC()This change replaces direct access to the global Monte Carlo instance (gMC) with the TVirtualMC::GetMC() accessor method. This is more robust and aligned with the PR's goal of fixing Pythia6 dependency issues in newer ROOT versions.
61-62: Good change replacing gMC with TVirtualMC::GetMC()Both the conditional check and the method call now use TVirtualMC::GetMC() instead of directly accessing gMC. This makes the code more maintainable and aligned with modern ROOT versions.
80-81: Good change replacing gMC with TVirtualMC::GetMC()Both the conditional check and the method call now use TVirtualMC::GetMC() instead of directly accessing gMC. This makes the code more maintainable and aligned with modern ROOT versions.
examples/common/mcstack/FairStack.cxx (2)
26-26: Updated include comment for clarity.The comment has been updated to clarify that the include is for TVirtualMC rather than gMC. This improves code documentation.
317-317: Good change replacing gMC with TVirtualMC::GetMC()This change replaces direct access to the global Monte Carlo instance (gMC) with the TVirtualMC::GetMC() accessor method in the Register method. This makes the code more maintainable and aligned with modern ROOT versions where Pythia6 support has changed.
fairroot/base/sim/FairGenericStack.cxx (2)
54-57: Added explicit destructor implementation.The destructor has been expanded from a single-line to a multi-line block with explicit implementation. This improves readability while maintaining the same functionality.
120-121: Improved encapsulation by using TVirtualMC::GetMC() instead of gMC.The logging statement now uses
TVirtualMC::GetMC()instead of directly accessing the globalgMCvariable. This follows good encapsulation practices and is consistent with similar changes throughout the PR.templates/NewDetector_root_containers/NewDetector.cxx (4)
110-111: Improved code formatting for condition checks.The condition check has been split across multiple lines with proper indentation for better readability while maintaining the same functionality.
149-149: Replaced gMC with TVirtualMC::GetMC() for better encapsulation.Changed direct access to the global Monte Carlo instance (
gMC->IsMT()) with an encapsulated call to the static method (TVirtualMC::GetMC()->IsMT()). This improves code maintainability and follows object-oriented design principles.
165-168: Expanded Reset() method implementation.The
Reset()method has been reformatted from a single-line definition to a multi-line block. This improves readability while maintaining the same functionality.
238-241: Expanded CloneModule() method implementation.The
CloneModule()method has been reformatted from a single-line definition to a multi-line block. This improves readability while maintaining the same functionality.examples/simulation/Tutorial4/gconfig/SetCuts.C (3)
29-30: Improved code encapsulation by using TVirtualMC::GetMC().Created a local variable
MCthat holds the result ofTVirtualMC::GetMC(), which will be used instead of directly accessing the globalgMCobject. This improves encapsulation and follows the changes being made throughout the codebase.
31-42: Replaced direct gMC calls with MC variable for process settings.All process settings now use the local
MCvariable instead of directly accessing the globalgMCobject. This maintains the same functionality while improving code organization.
49-59: Replaced direct gMC calls with MC variable for cut settings.All cut settings now use the local
MCvariable instead of directly accessing the globalgMCobject. This maintains the same functionality while improving code organization.fairroot/base/sim/FairMCApplication.cxx (4)
466-468: Updated comment and implementation to use TVirtualMC::GetMC().Changed the thread-local caching comment to reflect the use of
TVirtualMC::GetMC(), and the implementation now correctly uses this method instead of directly accessing the globalgMCvariable.
639-639: Replaced gMC with TVirtualMC::GetMC() for current event access.Changed direct access to the global Monte Carlo instance (
gMC->CurrentEvent()) with an encapsulated call to the static method (TVirtualMC::GetMC()->CurrentEvent()). This follows the pattern of improvements being made throughout the codebase.
640-642: Updated multi-threading check and event ID setting.The check for multi-threading now uses
TVirtualMC::GetMC()->IsMT()instead ofgMC->IsMT(), and the subsequent event ID setting has been updated accordingly. This continues the pattern of using the encapsulated static method instead of the global variable.
687-687: Updated run info storage condition check.The condition for storing run information now uses
TVirtualMC::GetMC()->IsMT()instead ofgMC->IsMT(), maintaining consistency with the other changes in the file.
fd1de42 to
e5944a5
Compare
Instead of hardcoding the decayer get it from VMC.
ROOT has dropped pythia6 support with recent version. Execute the Pythia related tests only if Pythia6 and/or Pythia8 is available.
Use the static TVirualMC::GetMC() method instead of the global pointer.
e5944a5 to
eaa2fa2
Compare
|
please have a look at the PR. I need it and also the back ports to test the new FairSoft version. Currently we are stuck in a hen and egg problem. I can check the changes only with the upcoming FairSoft version and the upcoming FairSoft version only with this changes. |
With recent versions of ROOT the pythia6 support was dropped. This PR fixes the pythia6 usage in FairRoot.
The PR needs to be ported to the v19.0_patches, v18.8_patches and v18.6_patches branches. The needed changes are already prepared and PR to the branches will be created after this PR is merged.
Checklist: