Thread-local sensitive detector bridging Geant4 steps to GEMC hits via digitization plugins.
More...
#include <gsd.h>
GSensitiveDetector implements the G4VSensitiveDetector interface and participates in the Geant4 event loop through:
Responsibilities
- Own a per-event Geant4 hits collection (GHitsCollection) and register it into
G4HCofThisEvent.
- Use the assigned GDynamicDigitization routine to:
- decide whether a step should be ignored,
- map the Geant4 step to one or more logical touchables,
- read the HitBitSet describing which information is stored in hits.
- Track whether a touchable has already produced a hit in the current event and either create a new GHit or update an existing one.
Threading and lifetime
- Instances are intended to be thread-local.
- The digitization routine must be assigned with assign_digi_routine() before processing begins.
- Touchables are registered once at construction/setup time and then treated as read-only during event processing.
Definition at line 100 of file gsd.h.
◆ GSensitiveDetector()
| GSensitiveDetector::GSensitiveDetector |
( |
const std::string & | sdName, |
|
|
const std::shared_ptr< GOptions > & | goptions ) |
The constructor initializes the logging base and forwards the sensitive detector name to G4VSensitiveDetector. It also initializes the Geant4 collection name vector with a module-specific collection name based on sdName.
- Parameters
-
| sdName | Name of the sensitive detector instance (used by Geant4 and for collection naming). |
| goptions | Shared options object used to configure logging and module behavior. |
Definition at line 9 of file gsd.cc.
◆ assign_digi_routine()
| void GSensitiveDetector::assign_digi_routine |
( |
std::shared_ptr< GDynamicDigitization > | digi_routine | ) |
|
|
inline |
The assigned routine is expected to remain valid for the lifetime of this sensitive detector instance.
- Parameters
-
| digi_routine | Digitization routine responsible for readout specs and step processing. |
Definition at line 159 of file gsd.h.
◆ EndOfEvent()
| void GSensitiveDetector::EndOfEvent |
( |
G4HCofThisEvent * | g4HitCollection | ) |
|
|
override |
This method is invoked after all steps have been processed for the event. The Geant4 event system will own the hits collection registered during Initialize().
- Parameters
-
| g4HitCollection | Geant4 event hit container (not used by this implementation). |
Definition at line 133 of file gsd.cc.
◆ Initialize()
| void GSensitiveDetector::Initialize |
( |
G4HCofThisEvent * | g4hc | ) |
|
|
override |
This method:
- retrieves the HitBitSet from the digitization routine readout specifications,
- clears the per-event touchable cache,
- allocates a new Geant4 hits collection (GHitsCollection),
- registers it into the event hit container (
G4HCofThisEvent).
- Parameters
-
| g4hc | Geant4 event hit container that will own/track the hits collection for this event. |
Definition at line 26 of file gsd.cc.
◆ ProcessHits()
| G4bool GSensitiveDetector::ProcessHits |
( |
G4Step * | thisStep, |
|
|
G4TouchableHistory * | g4th ) |
|
override |
The digitization routine can choose to skip hits based on deposited energy and can transform the input touchable into one or more logical touchables. For each resulting touchable, this method either:
- creates a new GHit and inserts it in the hits collection, or
- locates an existing GHit and appends step information according to the HitBitSet.
- Parameters
-
| thisStep | Geant4 step being processed. |
| g4th | Geant4 touchable history (not used by this implementation). |
- Returns
true to indicate the step was handled (even if skipped by policy).
Definition at line 50 of file gsd.cc.
◆ registerGVolumeTouchable()
| void GSensitiveDetector::registerGVolumeTouchable |
( |
const std::string & | name, |
|
|
std::shared_ptr< GTouchable > | gt ) |
|
inline |
This function is typically used during detector construction (e.g., from GDetectorConstruction) to populate the mapping between volume names and their corresponding touchables.
- Parameters
-
| name | Volume name (key) used later to locate the touchable during ProcessHits(). |
| gt | Touchable instance associated with name. |
Definition at line 253 of file gsd.h.
The documentation for this class was generated from the following files: