Template Class InterpolatedBFieldMap

Nested Relationships

Nested Types

Inheritance Relationships

Base Type

Class Documentation

template<typename grid_t>
class Acts::InterpolatedBFieldMap : public Acts::MagneticFieldProvider

interpolate magnetic field value from field values on a given grid

This class implements a magnetic field service which is initialized by a field map defined by:

  • a list of field values on a regular grid in some n-Dimensional space,

  • a transformation of global 3D coordinates onto this n-Dimensional space.

  • a transformation of local n-Dimensional magnetic field coordinates into global (cartesian) 3D coordinates

The magnetic field value for a given global position is then determined by:

  • mapping the position onto the grid,

  • looking up the magnetic field values on the closest grid points,

  • doing a linear interpolation of these magnetic field values.

Template Parameters
  • grid_t: The Grid type which provides the field storage and interpolation

Public Types

using FieldType = typename Grid::value_type
using Grid = grid_t

Public Functions

InterpolatedBFieldMap(Config cfg)

default constructor

Result<Vector3> getField(const Vector3 &position) const

retrieve field at given position

Return

magnetic field value at the given position

Pre

The given position must lie within the range of the underlying magnetic field map.

Parameters
  • [in] position: global 3D position

Result<Vector3> getField(const Vector3 &position, MagneticFieldProvider::Cache &gcache) const override
Result<FieldCell> getFieldCell(const Vector3 &position) const

retrieve field cell for given position

Return

field cell containing the given global position

Pre

The given position must lie within the range of the underlying magnetic field map.

Parameters
  • [in] position: global 3D position

Result<Vector3> getFieldGradient(const Vector3 &position, ActsMatrix<3, 3>&, MagneticFieldProvider::Cache &cache) const override

Note

currently the derivative is not calculated

Note

Cache is not used currently

const Grid &getGrid() const

Get a const reference on the underlying grid structure.

Return

grid reference

std::vector<double> getMax() const

get the maximum value of all axes of the field map

Return

vector returning the maxima of all field map axes

std::vector<double> getMin() const

get the minimum value of all axes of the field map

Return

vector returning the minima of all field map axes

std::vector<size_t> getNBins() const

get the number of bins for all axes of the field map

Return

vector returning number of bins for all field map axes

bool isInside(const Vector3 &position) const

check whether given 3D position is inside look-up domain

Return

true if position is inside the defined look-up grid, otherwise false

Parameters
  • [in] position: global 3D position

bool isInsideLocal(const ActsVector<DIM_POS> &gridPosition) const

check whether given 3D position is inside look-up domain

Return

true if position is inside the defined look-up grid, otherwise false

Parameters
  • [in] position: local N-D position

MagneticFieldProvider::Cache makeCache(const MagneticFieldContext &mctx) const override

Public Static Attributes

constexpr size_t DIM_POS = Grid::DIM
struct Cache

Public Functions

Cache(const MagneticFieldContext&)

Constructor with magnetic field context.

Parameters
  • mcfg: the magnetic field context

Public Members

std::optional<FieldCell> fieldCell
bool initialized = false
struct Config

Config structure for the interpolated B field map.

Public Members

Grid grid

grid storing magnetic field values

double scale = 1.

global B-field scaling factor

Note

Negative values for scale are accepted and will invert the direction of the magnetic field.

std::function<Vector3(const FieldType&, const Vector3&)> transformBField

calculating the global 3D coordinates (cartesian) of the magnetic field with the local n dimensional field and the global 3D position as input

std::function< ActsVector< DIM_POS >const Vector3 &)> transformPos

mapping of global 3D coordinates (cartesian) onto grid space

struct FieldCell

struct representing smallest grid unit in magnetic field grid

This type encapsulate all required information to perform linear interpolation of magnetic field values within a confined 3D volume.

Public Functions

FieldCell(std::array<double, DIM_POS> lowerLeft, std::array<double, DIM_POS> upperRight, std::array<Vector3, N> fieldValues)

default constructor

Parameters
  • [in] lowerLeft: generalized lower-left corner of hyper box (containing the minima of the hyper box along each Dimension)

  • [in] upperRight: generalized upper-right corner of hyper box (containing the maxima of the hyper box along each Dimension)

  • [in] fieldValues: field values at the hyper box corners sorted in the canonical order defined in Acts::interpolate

Vector3 getField(const ActsVector<DIM_POS> &position) const

retrieve field at given position

Return

magnetic field value at the given position

Pre

The given position must lie within the current field cell.

Parameters
  • [in] position: global 3D position

bool isInside(const ActsVector<DIM_POS> &position) const

check whether given 3D position is inside this field cell

Return

true if position is inside the current field cell, otherwise false

Parameters
  • [in] position: global 3D position

Public Static Attributes

constexpr unsigned int N = 1 << DIM_POS

number of corner points defining the confining hyper-box