Abstract base class representing a magnetic field.
More...
#include <gfield.h>
A concrete field implementation must provide GetFieldValue() and may override load_field_definitions() to parse/cache configuration from a GFieldDefinition.
Integration:
- The field is also a
G4MagneticField and is used by Geant4 stepping infrastructure.
- The helper create_FieldManager() constructs a
G4FieldManager and its chord finder using a supported stepper name.
Definition at line 99 of file gfield.h.
◆ GField()
| GField::GField |
( |
const std::shared_ptr< GOptions > & | gopt | ) |
|
|
inlineexplicit |
- Parameters
-
| gopt | Shared options object. |
Definition at line 106 of file gfield.h.
◆ create_FieldManager()
| G4FieldManager * GField::create_FieldManager |
( |
| ) |
|
- Returns
- Newly allocated
G4FieldManager pointer.
The manager is created using:
G4Mag_UsualEqRhs as the equation of motion,
- one of the supported integration steppers (selected by name),
- a
G4ChordFinder constructed with the configured minimum step.
Ownership:
- The returned object is heap-allocated. In this module it is owned by GMagneto.
Definition at line 24 of file gfield.cc.
◆ get_field_parameter_double()
| double GField::get_field_parameter_double |
( |
const std::string & | key | ) |
|
|
inline |
- Parameters
-
- Returns
- Parsed floating-point value.
Definition at line 151 of file gfield.h.
◆ get_field_parameter_int()
| int GField::get_field_parameter_int |
( |
const std::string & | key | ) |
|
|
inline |
- Parameters
-
- Returns
- Parsed integer value.
Definition at line 144 of file gfield.h.
◆ GetFieldValue()
| virtual void GField::GetFieldValue |
( |
const double | x[3], |
|
|
double * | bfield ) const |
|
pure virtual |
- Parameters
-
| x | Position in the lab frame as {x,y,z}. |
| bfield | Output array filled with {Bx,By,Bz}. |
This method is the key interface used by Geant4 when transporting tracks in a field.
◆ instantiate()
- Parameters
-
| h | Dynamic library handle. |
| g | Shared options passed to the plugin factory. |
- Returns
- Newly allocated field pointer, or
nullptr on failure.
The plugin must export a C symbol named "GFieldFactory" with a compatible signature. This method looks up that symbol and calls it to construct the concrete GField instance.
Definition at line 197 of file gfield.h.
◆ load_field_definitions()
- Parameters
-
| gfd | Field definition to copy into internal storage. |
Concrete implementations typically override this method to parse and cache frequently used parameters.
Reimplemented in GField_MultipolesFactory.
Definition at line 137 of file gfield.h.
◆ set_loggers()
| void GField::set_loggers |
( |
const std::shared_ptr< GOptions > & | g | ) |
|
|
inline |
- Parameters
-
This module currently does not add additional logger wiring here.
Definition at line 159 of file gfield.h.
◆ gfield_definitions
The documentation for this class was generated from the following files: