gsystem
Loading...
Searching...
No Matches
GWorld Class Reference

Builds the “world” as a collection of systems, volumes, and post-load modifiers. More...

#include <gworld.h>

Public Member Functions

 GWorld (const std::shared_ptr< GOptions > &gopts)
 Construct the world from configuration.
 
 GWorld (const std::shared_ptr< GOptions > &gopts, SystemList systems)
 Construct the world from an explicit list of pre-built systems.
 
SystemMapgetSystemsMap () const
 Returns a pointer to the internal system map.
 
int get_number_of_volumes () const
 Returns the number of systems currently registered in the world.
 
std::vector< std::string > getSensitiveDetectorsList ()
 Collect the list of sensitive detector identifiers.
 
- Public Member Functions inherited from GBase< GWorld >
 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 ()
 
GBaseoperator= (const GBase &)=default
 
GBaseoperator= (GBase &&) noexcept=default
 

Additional Inherited Members

- Protected Attributes inherited from GBase< GWorld >
std::shared_ptr< GLoggerlog
 

Detailed Description

GWorld is responsible for the assembly phase of detector geometry:

  • It creates a map of detector systems (GSystem) from configuration (GOptions).
  • It instantiates the appropriate system factories (derived from GSystemFactory).
  • It asks each factory to load volumes/materials into each GSystem.
  • It loads modifiers (GModifier) and applies them to the already-loaded volumes.
  • It performs a final bookkeeping step assigning fully-qualified Geant4 names to volumes.

Ownership model:

  • The world owns the system map container (gsystemsMap).
  • Each GSystem owns its internal volume/material containers.
  • Modifiers are stored separately in gmodifiersMap and applied once during construction.
Note
This class uses the logger provided by GBase. See module mainpage for verbosity levels.

Definition at line 36 of file gworld.h.

Constructor & Destructor Documentation

◆ GWorld() [1/2]

GWorld::GWorld ( const std::shared_ptr< GOptions > & gopts)
explicit

Construction performs the full pipeline:

  • load system descriptors via gsystem::getSystems();
  • create internal system map;
  • load systems (factories → volumes/materials);
  • load and apply modifiers;
  • assign final Geant4 names.
Parameters
goptsShared configuration/options instance.

Definition at line 18 of file gworld.cc.

◆ GWorld() [2/2]

GWorld::GWorld ( const std::shared_ptr< GOptions > & gopts,
SystemList systems )
explicit

This overload is useful when systems are created elsewhere (e.g. by a GUI) and then passed into the world assembly stage.

Parameters
goptsShared configuration/options instance.
systemsList of systems to adopt into the world map.

Definition at line 35 of file gworld.cc.

Member Function Documentation

◆ get_number_of_volumes()

int GWorld::get_number_of_volumes ( ) const
inline

Historically this was referred to as “number of volumes”, but this method effectively returns the number of top-level systems in gsystemsMap.

Definition at line 78 of file gworld.h.

◆ getSensitiveDetectorsList()

std::vector< std::string > GWorld::getSensitiveDetectorsList ( )

This walks every system and volume and extracts the digitization string. A non-empty digitization string indicates that the volume contributes to a sensitive detector collection.

Returns
A de-duplicated list of digitization identifiers.

Definition at line 132 of file gworld.cc.

◆ getSystemsMap()

SystemMap * GWorld::getSystemsMap ( ) const
inline
Returns
Pointer to the internal SystemMap container.
Warning
The returned pointer is non-owning; callers must not delete it.

Definition at line 70 of file gworld.h.


The documentation for this class was generated from the following files: