|
gdetector
|
Builds and (optionally) reloads the Geant4 geometry from GEMC world definitions. More...
#include <gdetectorConstruction.h>
Public Member Functions | |
| GDetectorConstruction (std::shared_ptr< GOptions > gopts) | |
| Constructs a detector builder configured by the provided options. | |
| G4VPhysicalVolume * | Construct () override |
| Geant4 geometry construction hook. | |
| void | ConstructSDandField () override |
| Geant4 SD/field construction hook. | |
| bool | is_empty () const |
| Returns whether the currently built geometry is empty. | |
| void | reload_geometry (SystemList sl) |
| Reloads the geometry using a new list of GSystem objects. | |
| std::shared_ptr< GDynamicDigitization > | get_digitization_routines_for_sdname (const std::string &sd_name) const |
| Returns the digitization routine for a given sensitive detector name. | |
| std::shared_ptr< gdynamicdigitization::dRoutinesMap > | get_digitization_routines_map () const |
| Returns the full map of digitization routines. | |
| std::unordered_map< std::string, G4Volume * > | get_g4volumes_map () const |
| Returns a map of built Geant4 volumes indexed by their GEMC/G4World names. | |
Public Member Functions inherited from GBase< GDetectorConstruction > | |
| 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 |
Additional Inherited Members | |
Protected Attributes inherited from GBase< GDetectorConstruction > | |
| std::shared_ptr< GLogger > | log |
GDetectorConstruction is the module’s adapter between GEMC geometry/detector descriptions (GWorld/GSystem/GVolume) and Geant4 runtime objects (solids, logical volumes, physical volumes, sensitive detectors, and field managers).
Responsibilities:
Threading notes:
G4ThreadLocal to keep field state thread-safe.Ownership notes:
Definition at line 59 of file gdetectorConstruction.h.
|
explicit |
The options object is retained for later use during Construct() and ConstructSDandField().
| gopts | Shared options instance (must remain valid for the lifetime of this detector construction object). |
Definition at line 22 of file gdetectorConstruction.cc.
|
override |
Called by Geant4 when it needs the detector geometry. This method:
Definition at line 31 of file gdetectorConstruction.cc.
|
override |
Called by Geant4 to install sensitive detectors and EM fields after the geometry is built. This method:
Definition at line 74 of file gdetectorConstruction.cc.
|
inline |
The returned object is the per-sensitive-detector dynamic digitization plugin.
| sd_name | Sensitive detector name (digitization routine key). |
sd_name.at() on the underlying map and will throw if sd_name is not present. Callers should ensure the detector name exists in the geometry sensitive-detector list. Definition at line 132 of file gdetectorConstruction.h.
|
inline |
This exposes the internal mapping between sensitive detector names and their corresponding digitization plugins.
Definition at line 144 of file gdetectorConstruction.h.
|
inline |
This method reports an error if the Geant4 world has not been constructed yet.
Definition at line 155 of file gdetectorConstruction.h.
|
inline |
This delegates to the underlying G4World instance, which tracks whether volumes were successfully built.
Definition at line 106 of file gdetectorConstruction.h.
| void GDetectorConstruction::reload_geometry | ( | SystemList | sl | ) |
This method updates the internal systems list used by Construct(). If a Geant4 run manager exists, it triggers a re-definition of the world volume and re-installs sensitive detectors and fields.
| sl | New list of systems to build from. If empty, the previous system list is kept (useful for tests or when only forcing a rebuild). |
Definition at line 190 of file gdetectorConstruction.cc.