Thread-local sensitive detector bridging Geant4 steps to GEMC hits via digitization plugins.
More...
#include <gsd.h>
|
| | GSensitiveDetector (const std::string &sdName, const std::shared_ptr< GOptions > &goptions) |
| | Constructs a sensitive detector instance for a given detector name.
|
| |
| void | Initialize (G4HCofThisEvent *g4hc) override |
| | Per-event initialization hook called by Geant4.
|
| |
| G4bool | ProcessHits (G4Step *thisStep, G4TouchableHistory *g4th) override |
| | Processes a Geant4 step and creates or updates hits in the current hits collection.
|
| |
| void | EndOfEvent (G4HCofThisEvent *g4HitCollection) override |
| | End-of-event hook called by Geant4.
|
| |
| void | assign_digi_routine (std::shared_ptr< GDynamicDigitization > digi_routine) |
| | Assigns the digitization routine used to interpret steps and define hit content.
|
| |
| void | resetTouchableMap () |
| | Clears the volume-to-touchable map so a reused SD reflects the current geometry.
|
| |
| void | registerGVolumeTouchable (const std::string &name, std::shared_ptr< GTouchable > gt) |
| | Registers a GTouchable for a given gvolume name into the internal lookup map.
|
| |
| | GBase (const std::shared_ptr< GOptions > &gopt, std::string logger_name="") |
| |
| | GBase (const std::shared_ptr< GLogger > &logger) |
| |
| | GBase (const GBase &)=default |
| |
| | GBase (GBase &&) noexcept=default |
| |
| virtual | ~GBase () |
| |
| GBase & | operator= (const GBase &)=default |
| |
| GBase & | operator= (GBase &&) noexcept=default |
| |
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.
- 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 99 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 155 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 131 of file gsd.cc.
◆ Initialize()
| void GSensitiveDetector::Initialize |
( |
G4HCofThisEvent * | g4hc | ) |
|
|
override |
Clears the per-event touchable cache, allocates a new GHitsCollection, and 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 27 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.
- 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 49 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 252 of file gsd.h.
◆ resetTouchableMap()
| void GSensitiveDetector::resetTouchableMap |
( |
| ) |
|
|
inline |
Called by GDetectorConstruction when an existing SD is reused for a new geometry load rather than creating a fresh object. Stale touchable entries from the previous geometry would otherwise cause incorrect hit identity lookups in ProcessHits().
Definition at line 164 of file gsd.h.
The documentation for this class was generated from the following files: