Skip to content

Conversation

kresan
Copy link
Contributor

@kresan kresan commented Apr 25, 2019

Inherit FairModule from TVirtualMCSensitiveDetector, which allows to use VMC stepping.
Tested with Tutorial1.
Requires changes in detector interface.

@kresan kresan force-pushed the feature_sensitive_volumes branch from 10f4ab5 to b7cd258 Compare April 26, 2019 08:41
@FairRootGroup FairRootGroup deleted a comment Apr 26, 2019
@kresan kresan force-pushed the feature_sensitive_volumes branch from b7cd258 to 3cd6899 Compare April 26, 2019 08:51
@kresan kresan requested a review from karabowi April 26, 2019 09:05
@FairRootGroup FairRootGroup deleted a comment Apr 26, 2019
@sawenzel
Copy link
Contributor

Could you please summarize shortly what is the idea behind this change? Will it be backward compatible/optional or will it lead to deep changes?

@kresan
Copy link
Contributor Author

kresan commented May 6, 2019

It is still work in progress. Idea is to simplify handling of sensitive detectors in FairRoot. Currently foreseen as a default solution. Would require changes in FairDetector interface, which are not backward compatible. Changes are in ProcessHits method.

@dennisklein dennisklein added this to the v18.4 milestone Jul 4, 2019
@dennisklein dennisklein removed this from the v18.4 milestone Apr 6, 2020
@dennisklein dennisklein added this to the V18.6 milestone Apr 29, 2020
@kresan kresan force-pushed the feature_sensitive_volumes branch from 3cd6899 to c6ffc2e Compare February 9, 2021 08:02
@kresan kresan removed the in progress label Feb 9, 2021
@kresan kresan force-pushed the feature_sensitive_volumes branch from 1a157c0 to bd19c48 Compare February 9, 2021 08:40
@kresan
Copy link
Contributor Author

kresan commented Feb 9, 2021

@MohammadAlTurany , Looking into it again, I have realised that the experiments will need to change ProcessHits method in every detector class

@karabowi
Copy link
Collaborator

karabowi commented Feb 9, 2021

can you shortly describe, what the changes would have to be?

@kresan
Copy link
Contributor Author

kresan commented Feb 9, 2021

The declaration:

virtual Bool_t ProcessHits(FairVolume* v = 0) = 0;

will be changed to:

virtual void ProcessHits()=0;

@karabowi
Copy link
Collaborator

karabowi commented Feb 9, 2021

Looking at the code, you've also moved the function from FairDetector to FairModule.
What is the reason to remove its argument and return value?
Can't it stay it used to be?

@MohammadAlTurany
Copy link
Contributor

MohammadAlTurany commented Feb 9, 2021

This change is needed only if you went to use the sensitive detector or did I miss something here?

@fuhlig1
Copy link
Member

fuhlig1 commented Feb 9, 2021

I thought there was a wrapper in FairRoot which calls the old function if the new one isn't available.

@kresan
Copy link
Contributor Author

kresan commented Feb 9, 2021

@karabowi We used to take care about bookkeeping of sensitive volumes in FairRoot. Idea of this PR is to let VMC do it. The new function is VMC requirement.
@MohammadAlTurany I thought we want to get read of the parts where we have to handle sensitive volumes on our own completely. Does it make sense to keep both options?
I agree to Florian that a wrapper can help here.
But, we have to be aware, that FairVolume parameter of the overloaded methods might have been used in the experiment code. How do we handle this with the wrapper?

@MohammadAlTurany
Copy link
Contributor

One could get the current volume and the corresponding FairVolume and call the old method, at least for some time to allow the experiments to move smoothly to the new one!

@karabowi
Copy link
Collaborator

karabowi commented Feb 9, 2021

With the current state of this branch, there seems to be no any MC points stored in the output files.

@kresan
Copy link
Contributor Author

kresan commented Feb 10, 2021

@karabowi thanks for testing. Probably something went wrong while rebasing. The whole thing will be revisited completely. I will open another PR soon.

@dennisklein dennisklein modified the milestones: v19.0, v19.2 Mar 8, 2021
@dennisklein dennisklein marked this pull request as draft March 8, 2021 16:17
@fuhlig1
Copy link
Member

fuhlig1 commented Jun 7, 2022

@ChristianTackeGSI,

the requested test case is described in #1195 and implemented with #1196.

@fuhlig1
Copy link
Member

fuhlig1 commented Jun 7, 2022

@kresan,

sorry but I think I messed up the PR a minute ago. There was a conflict which I tried to solve using the web editor but it seems to me that instead off doing a rebase the webpage did a merge. Could you please have a look.

@kresan kresan force-pushed the feature_sensitive_volumes branch from ad6983f to 011da54 Compare June 8, 2022 07:09
@kresan
Copy link
Contributor Author

kresan commented Jun 8, 2022

@fuhlig1, I reverted back your merge action. Now we need to resolve conflicts properly.

@fuhlig1
Copy link
Member

fuhlig1 commented Jun 8, 2022

@kresan,

thanks. Could you solve the conflicts. I fear if I do it from the web frontend we run into the same problem.

@karabowi karabowi force-pushed the feature_sensitive_volumes branch 2 times, most recently from a96f67f to 2259768 Compare June 8, 2022 08:02
@ChristianTackeGSI
Copy link
Member

We noticed in this morning's meeting, that we should consider raising the minimum required geant3 version to the one containing some fixes relevant to this pull request.

If we do so, it should be done in the CMakeLists.txt.

@ChristianTackeGSI
Copy link
Member

Also before we merge this one, we probably should do a rebase/cleanup of the commits.

And before we merge it, we should get clear on our release planning (this currently targets 19.2, not 19.0).

@karabowi karabowi force-pushed the feature_sensitive_volumes branch from 2259768 to 2ab950f Compare July 7, 2022 09:34
kresan and others added 6 commits January 26, 2023 12:23
Remove the double function definition.
Define the void FairDetector::ProcessHits() function, which calls the
depracated Bool_t ProcessHits(FairVolume*) of derived classes.

Update the FairMCApplication to match the update of the VMC:
introduction of EndOfEvent function called before
the TVirtualMCSensitiveDetectors->EndOfEvent().

Implement the temporary FairMCApplication::GetFairVolume()
function to keep the backward compability.

Cleanup of FairModule, FairMCApplication double code.
FairRoot allows for construction of clones volumes
using the volume_name#{clone_number} scheme.
Changing FairMCApplication::ConstructSensitiveDetectors()
to support this.
@karabowi karabowi force-pushed the feature_sensitive_volumes branch from 96b1b31 to 0612207 Compare January 30, 2023 14:26
Since VMC is initializing TVirtualMCSensitiveDetector,
removed detector->Initialize() from FairMCApplication.

Removed the GetFairVolume function used by FairDetector::ProcessHits().
It now calls the deprecated function with NULL argument.

Changed the propagator example to use the new ProcessHits().
@karabowi karabowi force-pushed the feature_sensitive_volumes branch from 0612207 to b64b2fd Compare January 30, 2023 14:48
Comment on lines 1302 to 1303
std::map<std::string, FairModule*>::iterator it;
it = cloneVolumeMap.find(volName);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
std::map<std::string, FairModule*>::iterator it;
it = cloneVolumeMap.find(volName);
auto it = cloneVolumeMap.find(volName);

Comment on lines 552 to 553
Int_t id = fMC->CurrentVolID(copyNo);
id = fMC->CurrentVolID(copyNo);
Copy link
Member

Choose a reason for hiding this comment

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

You're assigning twice the same?

Suggested change
Int_t id = fMC->CurrentVolID(copyNo);
id = fMC->CurrentVolID(copyNo);
Int_t id = fMC->CurrentVolID(copyNo);

Copy link
Member

@ChristianTackeGSI ChristianTackeGSI left a comment

Choose a reason for hiding this comment

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

I have added a few minor comments.

In reality, I would like to discuss the whole design with people interested. Because I think, it's making things more and more complex and unmaintainable in the long run. It took me a few iterations to start to understand why things are done this way. And I have some ideas / questions about this.

@karabowi karabowi force-pushed the feature_sensitive_volumes branch from b64b2fd to e3810cc Compare January 31, 2023 09:44
Removed FairDetector::DefineSensitiveVolumes() function,
the functionality moved to FairMCApplication private special copy constructor.

Removed detector initialization from FairMCApplication::RegisterOutput(),
the detectors are initialized in the VMC.

Added few overrides for ProcessHits.
Removed the IsSensitive() function.
Increase the number of events to run in the MT mode to 20.
@karabowi karabowi force-pushed the feature_sensitive_volumes branch from e3810cc to e34b574 Compare February 1, 2023 09:21
@github-actions github-actions bot added the Stale label Jun 23, 2025
Copy link

coderabbitai bot commented Jun 23, 2025

📝 Walkthrough

Walkthrough

This change refactors the sensitive detector handling in the simulation framework. The ProcessHits method is standardized to a void signature without parameters, removing its boolean return value and volume argument. Sensitive detector registration and event lifecycle management are reworked, with explicit mapping and event hooks introduced in the application and module classes. All affected detectors and templates are updated accordingly.

Changes

File(s) Change Summary
base/sim/FairDetector.cxx, base/sim/FairDetector.h Remove DefineSensitiveVolumes, update ProcessHits to void with no params, deprecate old form.
base/sim/FairMCApplication.cxx, base/sim/FairMCApplication.h Remove old stepping logic, add sensitive detector mapping, event hooks, and registration methods.
base/sim/FairModule.cxx, base/sim/FairModule.h Change base class to TVirtualMCSensitiveDetector, add/override new event and hit methods.
base/sim/fastsim/FairFastSimDetector.cxx, base/sim/fastsim/FairFastSimDetector.h Change ProcessHits to void with no parameters.
examples/MQ/pixelDetector/src/Pixel.cxx, examples/MQ/pixelDetector/src/Pixel.h Update ProcessHits to void with no parameters, adjust logic to new interface.
examples/advanced/Tutorial3/simulation/FairTestDetector.cxx, .../FairTestDetector.h Update ProcessHits to void with no parameters, adjust logic to new interface.
examples/advanced/propagator/src/FairTutPropDet.cxx, .../FairTutPropDet.h Update ProcessHits to void with no parameters, adjust logic to new interface.
examples/simulation/Tutorial1/src/FairTutorialDet1.cxx, .../FairTutorialDet1.h Update ProcessHits to void with no parameters, remove IsSensitive, adjust logic.
examples/simulation/Tutorial2/src/FairTutorialDet2.cxx, .../FairTutorialDet2.h Update ProcessHits to void with no parameters, adjust logic to new interface.
examples/simulation/Tutorial4/src/mc/FairTutorialDet4.cxx, .../FairTutorialDet4.h Update ProcessHits to void with no parameters, adjust logic to new interface.
examples/simulation/rutherford/src/FairRutherford.cxx, .../FairRutherford.h Update ProcessHits to void with no parameters, adjust logic to new interface.
templates/project_root_containers/NewDetector/NewDetector.cxx, .../NewDetector.h Update ProcessHits to void with no parameters, adjust logic to new interface.
templates/project_stl_containers/NewDetector/NewDetector.cxx, .../NewDetector.h Update ProcessHits to void with no parameters, adjust logic to new interface.
examples/simulation/Tutorial1/macros/CMakeLists.txt Update copyright year, increase test event count.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant FairMCApplication
    participant FairModule
    participant TVirtualMC

    User->>FairMCApplication: Run Simulation
    FairMCApplication->>FairModule: AddSensitiveModule(volumeName, module)
    FairMCApplication->>FairMCApplication: ConstructSensitiveDetectors()
    FairMCApplication->>TVirtualMC: SetSensitiveDetector(volumeName, module)
    loop For Each Event
        FairMCApplication->>FairModule: ProcessHits()
        FairModule->>TVirtualMC: Query CurrentVolID, etc.
        FairMCApplication->>FairModule: EndOfEvent()
        FairMCApplication->>FairModule: FinishEvent()
    end
Loading

Suggested reviewers

  • karabowi
✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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 or @coderabbitai title 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

@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: 2

🔭 Outside diff range comments (1)
base/sim/FairMCApplication.cxx (1)

609-644: Fix typo in debug message

There's a typo in the debug log message with duplicated "MC":

-    LOG(debug) << "[" << fRootManager->GetInstanceId()
-               << " FairMCMCApplication::FinishEvent: " << fMCEventHeader->GetEventID() << " (MC "
-               << gMC->CurrentEvent() << ")";
+    LOG(debug) << "[" << fRootManager->GetInstanceId()
+               << "] FairMCApplication::EndOfEvent: " << fMCEventHeader->GetEventID() << " (MC "
+               << gMC->CurrentEvent() << ")";

Also note that the method name in the log should be "EndOfEvent" not "FinishEvent" since this is now in the EndOfEvent() method.

♻️ Duplicate comments (4)
base/sim/FairDetector.cxx (1)

110-121: Clarify the deprecation warning message per previous feedback.

The warning message is confusing as noted in past reviews. Consider rephrasing to "Please override / implement ProcessHits() on [detector name] instead of the old ProcessHits(FairVolume*)".

Additionally, verify that existing detector implementations properly handle the NULL pointer passed to ProcessHits(NULL).

#!/bin/bash
# Search for ProcessHits implementations that use the FairVolume parameter
# to ensure they handle NULL pointers properly
ast-grep --pattern $'Bool_t ProcessHits(FairVolume* $vol) {
  $$$
}'
base/sim/FairDetector.h (1)

51-54: Add proper deprecation annotations.

As previously suggested, consider using Doxygen and C++ deprecation annotations for better tooling support.

    /**
-    * DEPRECATED method, currently called by void FairDetector::ProcessHits()
+    * \deprecated This method is deprecated. Use ProcessHits() without parameters instead.
     */
-    virtual Bool_t ProcessHits(FairVolume* v = 0) { return false; }
+    [[deprecated("Use ProcessHits() without parameters")]] virtual Bool_t ProcessHits(FairVolume* v = 0) { return false; }
base/sim/FairMCApplication.h (1)

247-250: Apply deprecation attributes as previously suggested

As suggested in the previous review, please use C++ deprecation attributes:

    /**
-     * Method introduced temporarily. It should go awway with DEPRACATED Bool_t FairDetector::ProcessHits()
+     * \deprecated Method introduced temporarily. It should go away with DEPRECATED Bool_t FairDetector::ProcessHits()
     */
+    [[deprecated("Use new ProcessHits() signature without parameters")]]
    FairVolume* GetFairVolume();

Note: Also fixed the typos "awway" → "away" and "DEPRACATED" → "DEPRECATED".

base/sim/FairMCApplication.cxx (1)

1301-1301: Use auto for iterator as previously suggested

As suggested in the previous review:

-            auto it = cloneVolumeMap.find(volName);
+            auto it = cloneVolumeMap.find(volName);

The code already uses auto correctly, so this past comment can be ignored.

🧹 Nitpick comments (3)
examples/simulation/Tutorial4/src/mc/FairTutorialDet4.cxx (1)

175-176: Remove obsolete commented code.

The commented line showing the old volume ID retrieval method should be removed as it's no longer relevant with the new interface.

        fTrackID = TVirtualMC::GetMC()->GetStack()->GetCurrentTrackNumber();
-        //    fVolumeID = vol->getMCid();
        fVolumeID = fGeoHandler->GetUniqueDetectorId();
base/sim/FairMCApplication.h (1)

235-235: Consider using const reference for efficiency

Pass the string parameter by const reference to avoid unnecessary copies:

-    void AddSensitiveModule(std::string volName, FairModule* module);
+    void AddSensitiveModule(const std::string& volName, FairModule* module);
base/sim/FairMCApplication.cxx (1)

1313-1313: Update signature to match header if const reference is adopted

If the header signature is changed to use const std::string&, update this implementation to match:

-void FairMCApplication::AddSensitiveModule(std::string volName, FairModule* module)
+void FairMCApplication::AddSensitiveModule(const std::string& volName, FairModule* module)
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 628023c and e34b574.

📒 Files selected for processing (27)
  • base/sim/FairDetector.cxx (3 hunks)
  • base/sim/FairDetector.h (2 hunks)
  • base/sim/FairMCApplication.cxx (5 hunks)
  • base/sim/FairMCApplication.h (5 hunks)
  • base/sim/FairModule.cxx (7 hunks)
  • base/sim/FairModule.h (3 hunks)
  • base/sim/fastsim/FairFastSimDetector.cxx (1 hunks)
  • base/sim/fastsim/FairFastSimDetector.h (1 hunks)
  • examples/MQ/pixelDetector/src/Pixel.cxx (2 hunks)
  • examples/MQ/pixelDetector/src/Pixel.h (1 hunks)
  • examples/advanced/Tutorial3/simulation/FairTestDetector.cxx (2 hunks)
  • examples/advanced/Tutorial3/simulation/FairTestDetector.h (1 hunks)
  • examples/advanced/propagator/src/FairTutPropDet.cxx (2 hunks)
  • examples/advanced/propagator/src/FairTutPropDet.h (1 hunks)
  • examples/simulation/Tutorial1/macros/CMakeLists.txt (2 hunks)
  • examples/simulation/Tutorial1/src/FairTutorialDet1.cxx (6 hunks)
  • examples/simulation/Tutorial1/src/FairTutorialDet1.h (2 hunks)
  • examples/simulation/Tutorial2/src/FairTutorialDet2.cxx (2 hunks)
  • examples/simulation/Tutorial2/src/FairTutorialDet2.h (1 hunks)
  • examples/simulation/Tutorial4/src/mc/FairTutorialDet4.cxx (2 hunks)
  • examples/simulation/Tutorial4/src/mc/FairTutorialDet4.h (1 hunks)
  • examples/simulation/rutherford/src/FairRutherford.cxx (2 hunks)
  • examples/simulation/rutherford/src/FairRutherford.h (1 hunks)
  • templates/project_root_containers/NewDetector/NewDetector.cxx (2 hunks)
  • templates/project_root_containers/NewDetector/NewDetector.h (1 hunks)
  • templates/project_stl_containers/NewDetector/NewDetector.cxx (2 hunks)
  • templates/project_stl_containers/NewDetector/NewDetector.h (1 hunks)
🔇 Additional comments (39)
examples/simulation/Tutorial1/macros/CMakeLists.txt (2)

2-2: LGTM: Copyright year update is appropriate.

The copyright year update reflects current maintenance practices.


55-55: Verify the rationale for increasing test events.

The number of events was doubled from 10 to 20. While this may provide better test coverage for the new TVirtualMCSensitiveDetector implementation, please confirm this change is intentional and necessary.

Could you clarify why the event count was increased? Is this related to ensuring adequate testing of the new sensitive detector interface?

templates/project_stl_containers/NewDetector/NewDetector.h (1)

42-42: LGTM: ProcessHits signature correctly updated for TVirtualMCSensitiveDetector interface.

The method signature change from virtual Bool_t ProcessHits(FairVolume* v = 0) = 0; to virtual void ProcessHits(); is consistent with the PR's objective to use VMC stepping. Since this is a template file, the correct signature is crucial for users creating new detectors.

examples/simulation/Tutorial4/src/mc/FairTutorialDet4.h (1)

53-53: LGTM: ProcessHits signature correctly updated.

The method signature change to virtual void ProcessHits(); is consistent with the TVirtualMCSensitiveDetector interface refactoring. Ensure the corresponding implementation in the .cxx file has been updated to use TVirtualMC::GetMC()->CurrentVolID(copyNo) for volume ID retrieval instead of relying on the removed FairVolume parameter.

examples/advanced/Tutorial3/simulation/FairTestDetector.h (1)

42-42: LGTM: ProcessHits signature correctly updated with proper override specifier.

The method signature change to void ProcessHits() override; is consistent with the TVirtualMCSensitiveDetector interface refactoring. Good use of the override specifier for clarity and compile-time checking.

examples/advanced/propagator/src/FairTutPropDet.h (1)

38-38: LGTM: ProcessHits signature correctly updated.

The method signature change to void ProcessHits() override; is consistent with the TVirtualMCSensitiveDetector interface refactoring across all detector implementations.

examples/simulation/Tutorial2/src/FairTutorialDet2.h (1)

42-42: ProcessHits method signature updated to align with new VMC stepping approach.

The change from virtual Bool_t ProcessHits(FairVolume* v = 0) = 0; to virtual void ProcessHits(); is consistent with the broader refactoring to use VMC stepping. This simplifies the interface by removing the volume parameter and boolean return value, as volume information will now be obtained directly from the VMC interface.

Note: This is a breaking change that will require corresponding updates in the implementation file and any derived classes.

examples/MQ/pixelDetector/src/Pixel.h (1)

39-39: ProcessHits method signature updated with proper override specifier.

The change from virtual Bool_t ProcessHits(FairVolume* v = 0) = 0; to void ProcessHits() override; is consistent with the VMC stepping refactoring. Good use of the override specifier to ensure the method properly overrides the base class method.

templates/project_root_containers/NewDetector/NewDetector.h (1)

42-42: Template detector updated to match new ProcessHits interface.

The ProcessHits method signature change in this template is crucial as it ensures new detector implementations will have the correct interface from the start. The change from virtual Bool_t ProcessHits(FairVolume* v = 0) = 0; to virtual void ProcessHits(); maintains consistency with the VMC stepping refactoring across all detector classes.

examples/simulation/rutherford/src/FairRutherford.h (1)

39-41: ProcessHits method and documentation updated for VMC stepping.

Excellent updates:

  • Line 39: Comment updated from "(see FairMCApplication::Stepping())" to "(by the VMC)" accurately reflects the new architecture where VMC calls ProcessHits directly
  • Line 41: Method signature properly updated to void ProcessHits() override; with good use of the override specifier

These changes clearly communicate the shift from FairMCApplication-managed stepping to VMC-managed stepping.

base/sim/fastsim/FairFastSimDetector.cxx (1)

62-65: ProcessHits implementation updated for VMC stepping.

The method signature change from Bool_t ProcessHits(FairVolume* vol) to void ProcessHits() is consistent with the VMC stepping refactoring. The implementation is clean and straightforward, simply calling FastSimProcessParticle() which is appropriate for a fast simulation detector.

base/sim/fastsim/FairFastSimDetector.h (1)

28-28: LGTM - Method signature updated consistently with VMC interface refactoring.

The ProcessHits method signature change aligns with the broader refactoring to use VMC stepping. The override final specification is appropriate for the fast simulation detector base class.

examples/simulation/Tutorial1/src/FairTutorialDet1.h (2)

2-2: Copyright year update is appropriate.


45-45: Method signature updated consistently with VMC interface refactoring.

The ProcessHits method signature change aligns with the framework's shift to VMC stepping. This tutorial detector serves as a good example of the new interface.

base/sim/FairModule.h (3)

24-24: Include format is correct.

The use of angle brackets for the TVirtualMCSensitiveDetector include is appropriate for external library headers.


48-48: Base class change enables VMC stepping integration.

Changing the base class from TNamed to TVirtualMCSensitiveDetector is the core of this refactoring, enabling modules to integrate with the VMC sensitive detector mechanism.


153-157: Default implementations of VMC interface methods.

The empty override implementations provide sensible defaults for the TVirtualMCSensitiveDetector interface. Derived classes can override these as needed.

examples/advanced/propagator/src/FairTutPropDet.cxx (3)

65-65: Method signature updated consistently with VMC interface.

The ProcessHits method signature change aligns with the framework refactoring to use VMC stepping.


85-86: Volume ID retrieval updated to use VMC interface.

The change from vol->getMCid() to fMC->CurrentVolID(copyNo) is consistent with the VMC-based approach. The copyNo variable is properly declared.


89-89: Early return simplified appropriately.

The change from return kTRUE to just return is consistent with the void method signature.

examples/advanced/Tutorial3/simulation/FairTestDetector.cxx (3)

70-70: Method signature updated consistently with VMC interface.

The ProcessHits method signature change aligns with the framework refactoring to use VMC stepping.


90-91: Volume ID retrieval properly implemented.

The copyNo variable initialization and CurrentVolID() call follow the correct VMC pattern for obtaining volume information.


95-95: Early return simplified appropriately.

The change from return kTRUE to just return is consistent with the void method signature.

templates/project_root_containers/NewDetector/NewDetector.cxx (1)

95-132: LGTM: ProcessHits method correctly updated to new interface.

The method signature change from Bool_t ProcessHits(FairVolume* vol) to void ProcessHits() is correctly implemented. The volume ID retrieval using TVirtualMC::GetMC()->CurrentVolID(copyNo) replaces the previous vol->getMCid() approach, aligning with the VMC-based sensitive detector management.

examples/MQ/pixelDetector/src/Pixel.cxx (1)

76-129: LGTM: ProcessHits method correctly updated with custom volume ID logic preserved.

The method signature change is properly implemented, and the custom volume ID calculation logic (lines 107-115) that extracts station and sector numbers from the volume path is correctly preserved. The new CurrentVolID(copyNo) call provides the basic volume ID that can still be used alongside the custom logic.

base/sim/FairDetector.cxx (2)

2-2: LGTM: Copyright year updated appropriately.


48-51: LGTM: Destructor reformatted without changing behavior.

templates/project_stl_containers/NewDetector/NewDetector.cxx (1)

94-131: LGTM: ProcessHits method correctly updated to new interface.

The method signature change is properly implemented, consistent with the other template detector. The volume ID retrieval using CurrentVolID(copyNo) correctly replaces the previous volume parameter approach.

examples/simulation/rutherford/src/FairRutherford.cxx (1)

45-82: LGTM: ProcessHits method correctly updated to new interface.

The method signature change from Bool_t ProcessHits(FairVolume* vol) to void ProcessHits() is properly implemented. The volume ID retrieval pattern using TVirtualMC::GetMC()->CurrentVolID(copyNo) is consistent with the framework-wide refactoring.

examples/simulation/Tutorial4/src/mc/FairTutorialDet4.cxx (1)

155-155: Method signature correctly updated to match new interface.

The change from Bool_t ProcessHits(FairVolume* vol = 0) to void ProcessHits() aligns with the PR objective to use VMC stepping.

examples/simulation/Tutorial2/src/FairTutorialDet2.cxx (1)

73-110: ProcessHits implementation correctly updated.

The method properly implements the new void signature and uses the standard VMC interface for volume ID retrieval via CurrentVolID(copyNo).

examples/simulation/Tutorial1/src/FairTutorialDet1.cxx (3)

53-92: ProcessHits correctly implements the new interface.

The method properly uses the void signature and retrieves the volume ID through the standard VMC interface.


94-100: Good addition of logging in EndOfEvent.

The logging of registered points before clearing is helpful for debugging and monitoring detector performance.


123-126: Reset method signature simplified.

The change from Bool_t to void return type is reasonable, though unrelated to the main ProcessHits refactoring.

base/sim/FairModule.cxx (3)

76-76: Base class correctly changed to TVirtualMCSensitiveDetector.

This change enables FairModule to integrate with VMC's sensitive detector mechanism, which is the core objective of this PR.


284-295: Sensitive module registration properly implemented.

The module correctly registers itself with FairMCApplication when processing sensitive nodes, ensuring proper integration with the new VMC-based sensitive detector management.


300-303: Consistent registration in AddSensitiveVolume.

The module registration is consistently implemented here as well, maintaining the new sensitive detector management paradigm.

base/sim/FairMCApplication.h (1)

111-114: Good use of override keyword

The methods properly use the override keyword as recommended in previous reviews, making it clear these are overriding base class methods.

base/sim/FairMCApplication.cxx (1)

199-204: Proper handling of sensitive detector mapping in copy constructor

The implementation correctly clones the sensitive detector mappings for MT mode, ensuring each worker thread has its own properly mapped instances.

virtual Bool_t ProcessHits(FairVolume* v = 0) = 0;
virtual void ProcessHits();
/**
DEPRACTED method, currently called by void FairDetector::ProcessHits()
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix typo in comment.

"DEPRACTED" should be "DEPRECATED".

      /**
-      DEPRACTED method, currently called by void FairDetector::ProcessHits()
+      DEPRECATED method, currently called by void FairDetector::ProcessHits()
      */
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
DEPRACTED method, currently called by void FairDetector::ProcessHits()
/**
DEPRECATED method, currently called by void FairDetector::ProcessHits()
*/
🤖 Prompt for AI Agents
In base/sim/FairDetector.h at line 52, correct the typo in the comment by
changing "DEPRACTED" to "DEPRECATED" to accurately indicate the method's status.

class FairTask;
class FairTrajFilter;
class FairVolume;
class FairModule;
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Remove duplicate forward declaration

FairModule is already forward declared on line 33. This duplicate declaration should be removed.

-class FairModule;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
class FairModule;
🤖 Prompt for AI Agents
In base/sim/FairMCApplication.h at line 42, there is a duplicate forward
declaration of the class FairModule which is already declared at line 33. Remove
the forward declaration at line 42 to eliminate redundancy.

@github-actions github-actions bot removed the Stale label Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants