|
gsystem
|
Represents a single detector system (e.g., calorimeter, tracker). More...
#include <gsystem.h>
Public Member Functions | |
| GSystem (const std::shared_ptr< GOptions > &gopts, const std::string &dbhost, const std::string &sname, const std::string &factory, const std::string &experiment, int runno, const std::string &variation, const std::string &annotations="none") | |
| Construct a detector system descriptor. | |
| GSystem (const GSystem &other) | |
| Deep copy constructor (used only by clone()). | |
| GSystem (GSystem &&) noexcept=default | |
| GSystem & | operator= (GSystem &&) noexcept=default |
| GSystem & | operator= (const GSystem &)=delete |
| std::unique_ptr< GSystem > | clone () const |
| Clone helper. | |
| std::string | getFilePath () |
| Gets the full file path of the system. | |
| void | set_dbhost (const std::string &dbh) |
| Sets the database host. | |
| void | addROOTVolume (const std::string &rootVolumeDefinition) |
| Adds the special ROOT/world volume to the system. | |
| void | addGVolume (std::vector< std::string > pars) |
| Build and add a volume from a serialized parameter list. | |
| void | addVolumeFromFile (const std::string &importType, const std::string &filename) |
| Add a volume imported from a file (CAD, GDML, etc.). | |
| GVolume * | getGVolume (const std::string &volumeName) const |
| Retrieve a volume by name. | |
| const std::map< std::string, std::shared_ptr< GVolume > > & | getGVolumesMap () const |
| Access all volumes in this system. | |
| const std::map< std::string, std::shared_ptr< GMaterial > > & | getGMaterialMap () const |
| Access all materials in this system. | |
| void | addGMaterial (std::vector< std::string > pars) |
| Build and add a material from a serialized parameter list. | |
| const GMaterial * | getMaterialForGVolume (const std::string &volumeName) const |
| Retrieve the material associated with a given volume. | |
System metadata | |
| std::string | getName () const |
| std::string | getFactoryName () const |
| std::string | getVariation () const |
| std::string | getExperiment () const |
| std::string | getAnnotations () const |
| int | getRunno () const |
| std::string | get_dbhost () const |
Public Member Functions inherited from GBase< GSystem > | |
| 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< GSystem > | |
| std::shared_ptr< GLogger > | log |
A GSystem is a container for:
Systems are typically created from configuration (GOptions) and then populated by a factory (derived from GSystemFactory) that loads geometry/material rows from a source (sqlite DB, ASCII, CAD import, GDML import, etc.).
Key configuration dimensions:
experiment : filters DB queries and system selectionvariation : selects a geometry/material variantrunno : selects a run-dependent configuration | GSystem::GSystem | ( | const std::shared_ptr< GOptions > & | gopts, |
| const std::string & | dbhost, | ||
| const std::string & | sname, | ||
| const std::string & | factory, | ||
| const std::string & | experiment, | ||
| int | runno, | ||
| const std::string & | variation, | ||
| const std::string & | annotations = "none" ) |
| gopts | Shared options/configuration instance. |
| dbhost | Database host (sqlite filename or remote host, depending on factory). |
| sname | Absolute or relative path including the system name (e.g. "detectors/ecal"). The name and path are parsed from this string. |
| factory | Factory label used to load this system (e.g. "ascii", "sqlite", "CAD", "GDML"). |
| experiment | Experiment name used in DB filtering. |
| runno | Run number used in DB filtering. |
| variation | Variation string used in DB filtering and file naming. |
| annotations | Optional system annotations (e.g. "mats_only"). |
Definition at line 44 of file gsystem.cc.
| GSystem::GSystem | ( | const GSystem & | other | ) |
| other | Source system. |
This constructor performs a deep copy of volumes and materials so that the copied system owns independent objects (while preserving value semantics).
Definition at line 15 of file gsystem.cc.
|
defaultnoexcept |
| void GSystem::addGMaterial | ( | std::vector< std::string > | pars | ) |
| pars | Serialized material parameter list. |
Definition at line 161 of file gsystem.cc.
| void GSystem::addGVolume | ( | std::vector< std::string > | pars | ) |
| pars | Serialized volume parameter list. |
This method appends system-wide selectors (variation and run number) and then constructs a new volume, inserting it into the internal volume map.
Error handling:
Definition at line 77 of file gsystem.cc.
| void GSystem::addROOTVolume | ( | const std::string & | rootVolumeDefinition | ) |
| rootVolumeDefinition | The ROOT/world definition string (solid + parameters + material). |
This method is typically called only when the world volume is injected automatically. It creates a top-level volume whose mother marker is MOTHEROFUSALL.
Definition at line 99 of file gsystem.cc.
| void GSystem::addVolumeFromFile | ( | const std::string & | importType, |
| const std::string & | filename ) |
| importType | Import label (factory-specific). |
| filename | Full filename (including path) of the imported geometry asset. |
This builds a synthetic parameter vector with reasonable defaults and forwards it to addGVolume().
The defaults are chosen so the imported asset is placeable:
G4_AIR Definition at line 113 of file gsystem.cc.
|
inline |
| std::string GSystem::getFilePath | ( | ) |
path is empty, returns name; otherwise returns path + "/" + name.This is used primarily by file-based factories to resolve where to search for system resources (e.g. ASCII geometry/material files, CAD directories).
Definition at line 194 of file gsystem.cc.
|
inline |
| GVolume * GSystem::getGVolume | ( | const std::string & | volumeName | ) | const |
| volumeName | Volume name key. |
nullptr.The returned pointer is non-owning and remains valid as long as the system retains the corresponding shared pointer in its volume map.
Definition at line 150 of file gsystem.cc.
|
inline |
| const GMaterial * GSystem::getMaterialForGVolume | ( | const std::string & | volumeName | ) | const |
| volumeName | Name of the volume whose material is requested. |
nullptr.The lookup is performed by:
If the volume exists but the material does not, the method logs ERR_GMATERIALNOTFOUND.
Definition at line 177 of file gsystem.cc.
|
inline |