Manager for magnetic fields and their associated G4FieldManager objects.
More...
#include <gmagneto.h>
|
| | GMagneto (const std::shared_ptr< GOptions > &gopts, const std::set< std::string > &required_fields={}) |
| | Construct and initialize the magnetic field registry.
|
| |
| bool | isField (const std::string &name) const |
| | Check whether a field with the given name exists.
|
| |
| std::vector< std::string > | getFieldNames () const |
| | Return the configured field names.
|
| |
| std::shared_ptr< GField > | getField (std::string name) |
| | Retrieve a field object by name.
|
| |
| std::shared_ptr< G4FieldManager > | getFieldMgr (std::string name) |
| | Retrieve the G4FieldManager associated with a given field name.
|
| |
| | 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 |
| |
Ownership model:
Lifecycle:
Definition at line 47 of file gmagneto.h.
◆ GMagneto()
| GMagneto::GMagneto |
( |
const std::shared_ptr< GOptions > & | gopts, |
|
|
const std::set< std::string > & | required_fields = {} ) |
|
explicit |
- Parameters
-
| gopts | Shared options used for configuration and logging. |
| required_fields | Optional set of field names to load. When empty, every configured field is loaded; when non-empty, only the named fields have their plugin and map loaded (so fields no volume uses are skipped). |
This constructor:
- Builds the list of GFieldDefinition objects from options,
- Loads each corresponding plugin library using the factory manager,
- Instantiates the field and calls load_field_definitions(),
- Creates and stores a
G4FieldManager via create_FieldManager().
Definition at line 37 of file gmagneto.cc.
◆ getField()
| std::shared_ptr< GField > GMagneto::getField |
( |
std::string | name | ) |
|
|
inline |
- Parameters
-
- Returns
- Shared pointer to the requested GField instance.
If the field is not found, an error is logged and execution is terminated by the logger.
Definition at line 119 of file gmagneto.h.
◆ getFieldMgr()
| std::shared_ptr< G4FieldManager > GMagneto::getFieldMgr |
( |
std::string | name | ) |
|
|
inline |
- Parameters
-
- Returns
- Shared pointer to the requested
G4FieldManager.
If the field manager is not found, an error is logged and execution is terminated by the logger.
Definition at line 133 of file gmagneto.h.
◆ getFieldNames()
| std::vector< std::string > GMagneto::getFieldNames |
( |
| ) |
const |
- Returns
- Sorted list of field names loaded by this manager.
Definition at line 153 of file gmagneto.cc.
◆ initialize_magnetic_field()
| std::shared_ptr< GField > GMagneto::initialize_magnetic_field |
( |
const std::shared_ptr< GOptions > & | gopts, |
|
|
double & | field_polarity, |
|
|
std::shared_ptr< GLogger > | caller_log = nullptr ) |
|
static |
- Parameters
-
| gopts | Shared options used for configuration and logging. |
| field_polarity | Output torus polarity derived from the global field definition. |
| caller_log | Optional caller logger used for diagnostics. |
- Returns
- Shared pointer to the configured global field, or nullptr when no field should be used.
This helper honors = NO_FIELD_ALL before looking at GLOBAL_FIELD_OPTION, so digitization code sees the same no-field configuration as tracking.
Definition at line 85 of file gmagneto.cc.
◆ isField()
| bool GMagneto::isField |
( |
const std::string & | name | ) |
const |
|
inline |
- Parameters
-
- Returns
- True if
name is present in the internal field map.
Definition at line 104 of file gmagneto.h.
◆ magnetic_field_magnitude_tesla()
| double GMagneto::magnetic_field_magnitude_tesla |
( |
const std::shared_ptr< GField > & | magnetic_field, |
|
|
const G4ThreeVector & | position ) |
|
static |
- Parameters
-
- Returns
- Field magnitude in Tesla, or 0 when no field was configured.
Definition at line 140 of file gmagneto.cc.
The documentation for this class was generated from the following files: