Concrete GField reading a magnetic field from an ASCII map and a YAML definition.
More...
#include <gfield_asciimap.h>
- Supported symmetries
dipole-x, dipole-y, dipole-z: 2D map of a single on-axis component, depending on a longitudinal and a transverse coordinate.
cylindrical-x, cylindrical-y, cylindrical-z: 2D phi-symmetric map of a transverse (radial) and a longitudinal component.
phi-segmented: 3D map in cylindrical coordinates (azimuthal, transverse, longitudinal) of three cartesian components, replicated over 60-degree segments.
cartesian_3D, cartesian_3D_quadrant: 3D cartesian map of three cartesian components. The _quadrant variant stores only the first quadrant (x>=0, y>=0) and mirrors it.
- YAML parameters (all forwarded as scalar strings through the
gfields node)
symmetry : one of the names above. Mandatory.
map : map file name. When it contains a / it is used as-is, otherwise it is looked up in dir. Mandatory.
dir : directory holding the map. Optional; when empty the map is read from the fields directory installed next to this plugin (<plugin_dir>/../fields).
coordinate1, coordinate2, coordinate3 : one grid axis each, as the compact string "name, npoints, min, max". min/max are Geant4-number expressions with units (e.g. 0*m, 3*m); the unit there also sets the unit of the matching coordinate column in the map file. coordinate3 is required only for the 3D symmetries. The column order in the map file follows coordinate1, coordinate2, coordinate3.
field_unit : unit of the field columns in the map file (default gauss).
scale : dimensionless multiplier applied to every field value (default 1).
interpolation : linear (default) or none (nearest neighbour).
vx,vy,vz : map origin subtracted from the query point before lookup (default 0).
rx,ry,rz : map rotation applied to the field vector (default 0*deg).
- Coordinate names per symmetry
- dipole :
longitudinal, transverse
- cylindrical :
transverse, longitudinal
- phi-segmented:
azimuthal, transverse, longitudinal
- cartesian :
X, Y, Z
- Implementation notes (improvements over the legacy asciiField)
- Field values are stored in contiguous
std::vector<float> buffers addressed with precomputed strides, instead of the legacy float**/float*** pointer pyramids; this keeps the hot GetFieldValue loop cache friendly and removes manual new/delete.
- The symmetry is decoded once into an enum, so GetFieldValue dispatches on an integer rather than comparing strings at every step.
- Rotation trigonometry is cached at load time.
- The map rows may be listed in any order: the grid index of each row is computed from its coordinate columns and validated against the YAML grid.
Definition at line 77 of file gfield_asciimap.h.
◆ GField_AsciiMapFactory()
| GField_AsciiMapFactory::GField_AsciiMapFactory |
( |
const std::shared_ptr< GOptions > & | gopt | ) |
|
|
inlineexplicit |
◆ GetFieldValue()
| void GField_AsciiMapFactory::GetFieldValue |
( |
const double | pos[3], |
|
|
G4double * | bfield ) const |
|
override |
◆ load_field_definitions()
The documentation for this class was generated from the following files: