23#include <gemc/gsystem/gworld.h>
33#include <unordered_map>
36#include "G4NistManager.hh"
64 G4World(
const GWorld* gworld,
const std::shared_ptr<GOptions>& gopts);
69 for (
auto& [name, vol] : g4volumesMap) {
delete vol; }
102 bool forceToAllDaughters);
108 [[nodiscard]]
bool is_empty() const noexcept {
return g4volumesMap.empty(); }
126 auto it = g4systemFactory.find(factoryName);
127 if (it != g4systemFactory.end())
return it->second;
130 "G4World: factory <", factoryName,
"> not found.");
157 std::string g4FactoryNameFromSystemFactory(
const std::string& factory)
const;
169 bool createG4Material(
const std::shared_ptr<GMaterial>& gmaterial);
178 void buildDefaultMaterialsElementsAndIsotopes();
184 void buildMaterials(
SystemMap* system_map);
198 void createG4SystemFactory(
const std::shared_ptr<GOptions>& gopts,
200 const std::string& backup_material,
214 G4Element* Deuterium =
nullptr;
215 G4Element* Helium3 =
nullptr;
216 G4Element* Tritium =
nullptr;
221 std::unordered_map<std::string, G4ObjectsFactory*> g4systemFactory;
224 std::unordered_map<std::string, G4Volume*> g4volumesMap;
233 std::unordered_map<std::string, G4Material*> g4materialsMap;
Base class orchestrating the conversion of a GVolume into a Geant4 representation.
Convenience container holding a Geant4 solid, logical, and physical volume.
Builds a full Geant4 geometry "world" from a GEMC GWorld description.
std::unordered_map< std::string, G4Volume * > get_g4volumes_map() const
Return a copy of the current volume map (name → wrapper pointer).
G4World(const GWorld *gworld, const std::shared_ptr< GOptions > &gopts)
Construct and build the Geant4 world from a GEMC world.
std::size_t number_of_volumes() const noexcept
Number of volumes stored so far.
void setFieldManagerForVolume(const std::string &volumeName, G4FieldManager *fm, bool forceToAllDaughters)
Attach a G4FieldManager to the logical volume of a named volume.
bool is_empty() const noexcept
Check whether the world currently has no cached volumes.
G4World & operator=(const G4World &)=delete
G4World & operator=(G4World &&)=delete
G4World(G4World &&)=delete
G4World(const G4World &)=delete
G4ObjectsFactory * get_factory(const std::string &factoryName)
Retrieve a registered factory by name.
const G4Volume * getG4Volume(const std::string &volumeName) const
Return the G4Volume wrapper for a volume name.
std::shared_ptr< GLogger > log
void error(int exit_code, Args &&... args) const
Abstract factory that converts a GEMC DB GVolume into Geant4 objects.
Conventions, labels, and error codes used by the g4system geometry/material layer.
#define ERR_G4SYSTEMFACTORYNOTFOUND
A required Geant4 system factory was not found/mapped.
Thin wrapper that stores the Geant4 solid/logical/physical triple for one GEMC volume.
std::map< std::string, SystemPtr > SystemMap