g4system
Loading...
Searching...
No Matches
G4NativeSystemFactory Class Referencefinal

Implements solid creation for Geant4 CSG primitives and validates constructor parameter counts. More...

#include <g4NativeObjectsFactory.h>

Public Member Functions

std::string_view className () const override
 Human-readable name used for logging.
 
 G4ObjectsFactory (const std::shared_ptr< GOptions > &g)
 Construct a factory using the global option set.
 
- Public Member Functions inherited from G4ObjectsFactory
 ~G4ObjectsFactory () override=default
 
 G4ObjectsFactory (const std::shared_ptr< GOptions > &g)
 Construct a factory using the global option set.
 
void initialize_context (int checkOverlaps, const std::string &backupMaterial)
 Configure overlap checking and backup material behavior for this factory.
 
bool build_g4volume (const GVolume *s, std::unordered_map< std::string, G4Volume * > *g4s)
 Build (or retrieve) solid, logical, and physical volumes for a given GVolume.
 
- Public Member Functions inherited from GBase< G4ObjectsFactory >
 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
 

Protected Member Functions

G4VSolid * buildSolid (const GVolume *s, std::unordered_map< std::string, G4Volume * > *g4s) override
 Create (or reuse) a native Geant4 solid based on the GVolume "type".
 
std::vector< double > checkAndReturnParameters (const GVolume *s)
 Validate the number of parameters for the given primitive and return them as numeric values.
 
- Protected Member Functions inherited from G4ObjectsFactory
virtual G4LogicalVolume * buildLogical (const GVolume *s, std::unordered_map< std::string, G4Volume * > *g4s)
 Build or retrieve the G4LogicalVolume for a volume.
 
virtual G4VPhysicalVolume * buildPhysical (const GVolume *s, std::unordered_map< std::string, G4Volume * > *g4s)
 Build or retrieve the G4VPhysicalVolume for a volume.
 
G4VolumegetOrCreateG4Volume (const std::string &volume_name, std::unordered_map< std::string, G4Volume * > *g4s)
 Get or create a G4Volume wrapper entry in the map.
 
G4VisAttributes createVisualAttributes (const GVolume *s)
 Build visualization attributes from the volume definition.
 
bool checkSolidDependencies (const GVolume *s, std::unordered_map< std::string, G4Volume * > *g4s)
 Check whether all prerequisites to build a solid are satisfied.
 
bool checkPhysicalDependencies (const GVolume *s, std::unordered_map< std::string, G4Volume * > *g4s)
 Verify prerequisites to build a physical placement.
 

Additional Inherited Members

- Static Protected Member Functions inherited from G4ObjectsFactory
static G4VSolid * getSolidFromMap (const std::string &volume_name, std::unordered_map< std::string, G4Volume * > *g4s)
 Lookup solid in the g4s map.
 
static G4LogicalVolume * getLogicalFromMap (const std::string &volume_name, std::unordered_map< std::string, G4Volume * > *g4s)
 Lookup logical volume in the g4s map.
 
static G4VPhysicalVolume * getPhysicalFromMap (const std::string &volume_name, std::unordered_map< std::string, G4Volume * > *g4s)
 Lookup physical volume in the g4s map.
 
static bool checkLogicalDependencies (const GVolume *s, std::unordered_map< std::string, G4Volume * > *g4s)
 Logical dependency check placeholder.
 
static G4RotationMatrix * getRotation (const GVolume *s)
 Parse rotation string and build a Geant4 rotation matrix.
 
static G4ThreeVector getPosition (const GVolume *s)
 Parse position and optional shift strings to compute placement translation.
 
- Protected Attributes inherited from G4ObjectsFactory
int checkOverlaps {0}
 
std::string backupMaterial
 Backup material name used if the requested material is absent.
 
- Protected Attributes inherited from GBase< G4ObjectsFactory >
std::shared_ptr< GLoggerlog
 

Detailed Description

The method buildSolid() dispatches on s->getType() and creates the corresponding Geant4 solid. The helper checkAndReturnParameters() validates and parses the parameter list.

Definition at line 38 of file g4NativeObjectsFactory.h.

Member Function Documentation

◆ buildSolid()

G4VSolid * G4NativeSystemFactory::buildSolid ( const GVolume * s,
std::unordered_map< std::string, G4Volume * > * g4s )
overrideprotectedvirtual
Parameters
sGEMC volume definition containing the type and parameters.
g4sMap holding cached G4Volume wrappers.
Returns
Pointer to the created/reused solid, or nullptr if dependencies are missing or type unsupported.

The method performs:

  • dependency checks (copy/boolean operations)
  • wrapper retrieval/creation
  • parameter parsing and validation
  • dispatch to the proper Geant4 constructor

Implements G4ObjectsFactory.

Definition at line 24 of file buildSolid.cc.

◆ checkAndReturnParameters()

std::vector< double > G4NativeSystemFactory::checkAndReturnParameters ( const GVolume * s)
protected
Parameters
sPointer to the GEMC volume record whose getParameters() string is to be parsed.
Returns
A std::vector<double> holding the converted values in the order expected by the constructor.

Some primitives have fixed parameter counts, while others have special rules:

  • polycones accept multiple constructor layouts, validated via modular arithmetic
  • polyhedra accept multiple constructor layouts, validated similarly

When validation fails, an error is emitted through the logger.

Definition at line 13 of file checkAndReturnParameters.cc.

◆ className()

std::string_view G4NativeSystemFactory::className ( ) const
inlineoverridevirtual
Returns
"G4NativeSystemFactory".

Implements G4ObjectsFactory.

Definition at line 48 of file g4NativeObjectsFactory.h.

◆ G4ObjectsFactory()

G4ObjectsFactory::G4ObjectsFactory ( const std::shared_ptr< GOptions > & g)
inlineexplicit
Parameters
gShared option set used to initialize the logging base and other behaviors.

Definition at line 62 of file g4objectsFactory.h.


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