|
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. | |
| void | prepare_geometry_for_run () |
| Reinitializes geometry through Geant4 before running events. | |
| 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. | |
| bool | has_built_geometry () const |
| Return whether a Geant4 world has been built. | |
| std::unordered_map< std::string, G4Volume * > | get_g4volumes_map () const |
| Returns a map of built Geant4 volumes indexed by their GEMC/G4World names. | |
| std::unordered_map< std::string, const GVolume * > | get_gvolumes_flat_map () const |
| Returns a flat map of GEMC volume descriptors indexed by their G4 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 61 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 59 of file gdetectorConstruction.cc.
|
override |
Called by Geant4 when it needs the detector geometry. This method:
Definition at line 68 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 102 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 145 of file gdetectorConstruction.h.
|
inline |
This exposes the internal mapping between sensitive detector names and their corresponding digitization plugins.
Definition at line 157 of file gdetectorConstruction.h.
|
inline |
This method reports an error if the Geant4 world has not been constructed yet.
Definition at line 178 of file gdetectorConstruction.h.
|
inline |
Iterates all systems in the GEMC world and assembles a single map keyed by the fully-qualified G4 name ("system/volume"), providing access to pygemc-defined fields (solid type, parameters, position, rotation, mother, description).
Definition at line 194 of file gdetectorConstruction.h.
|
inline |
GUI pages can use this to avoid querying volume maps before startup or setup-tab reload has constructed geometry.
Definition at line 167 of file gdetectorConstruction.h.
|
inline |
This delegates to the underlying G4World instance, which tracks whether volumes were successfully built.
Definition at line 108 of file gdetectorConstruction.h.
| void GDetectorConstruction::prepare_geometry_for_run | ( | ) |
Setup-tab reloads build an immediate master-world preview for the GUI. Before BeamOn, call this method so Geant4 destroys old geometry stores re-invokes detector construction, and initializes the run manager without touching visualization models that still reference the preview world.
Definition at line 357 of file gdetectorConstruction.cc.
| void GDetectorConstruction::reload_geometry | ( | SystemList | sl | ) |
This method updates the internal systems list used by Construct(). If a Geant4 run manager exists, it immediately replaces the master world volume and re-installs sensitive detectors and fields so GUI pages can inspect the reloaded geometry.
| 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 331 of file gdetectorConstruction.cc.