ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
Acts::InterpolatedBFieldMap< grid_t > Class Template Reference

Interpolates magnetic field value from field values on a given grid. More...

#include <Acts/MagneticField/InterpolatedBFieldMap.hpp>

Inheritance diagram for Acts::InterpolatedBFieldMap< grid_t >:
[legend]
Collaboration diagram for Acts::InterpolatedBFieldMap< grid_t >:
[legend]

Classes

struct  Cache
 Cache for field cell to improve performance of field lookups. More...
struct  Config
 Config structure for the interpolated B field map. More...
struct  FieldCell
 struct representing smallest grid unit in magnetic field grid More...

Public Types

using FieldType = typename Grid::value_type
 Type alias for magnetic field vector type.
using Grid = grid_t
 Type alias for magnetic field grid.
Public Types inherited from Acts::MagneticFieldProvider
using Cache = Acts::AnyBase<sizeof(char) * 512>
 Opaque cache type that can store arbitrary implementation specific cache data.

Public Member Functions

 InterpolatedBFieldMap (Config cfg)
 default constructor
Result< Vector3getField (const Vector3 &position) const
 retrieve field at given position
Result< Vector3getField (const Vector3 &position, MagneticFieldProvider::Cache &cache) const final
 Retrieve magnetic field value at a given location.
Result< FieldCellgetFieldCell (const Vector3 &position) const
 retrieve field cell for given position
Vector3 getFieldUnchecked (const Vector3 &position) const final
 Get magnetic field value without bounds checking (faster).
const GridgetGrid () const
 Get a const reference on the underlying grid structure.
std::vector< double > getMax () const final
 get the maximum value of all axes of the field map
std::vector< double > getMin () const final
 get the minimum value of all axes of the field map
std::vector< std::size_t > getNBins () const final
 get the number of bins for all axes of the field map
bool isInside (const Vector3 &position) const final
 check whether given 3D position is inside look-up domain
bool isInsideLocal (const ActsVector< DIM_POS > &gridPosition) const
 check whether given 3D position is inside look-up domain
MagneticFieldProvider::Cache makeCache (const MagneticFieldContext &mctx) const final
 Make an opaque cache for the magnetic field.
Public Member Functions inherited from Acts::MagneticFieldProvider
virtual ~MagneticFieldProvider ()=default

Static Public Attributes

static constexpr std::size_t DIM_POS = Grid::DIM
 Dimensionality of the position space for field interpolation.

Detailed Description

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

Interpolates 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.

Internally, this class uses a field interpolation cell to speed up lookups. This cell contains the interpolation points so the grid does not have to be consulted for each lookup. Explicit methods to create such a field cell are provided, but field cell creation is automatically handled by Acts::InterpolatedBFieldMap::makeCache, opaque to the client.

This class can leverage spatial symmetries in the magnetic field distribution. For cylindrically symmetric fields (e.g., solenoids, toroids), a 2D rz map can be used instead of a full 3D xyz map, significantly reducing memory requirements and improving performance. Helper functions Acts::fieldMapRZ and Acts::fieldMapXYZ are provided to construct field maps with the appropriate symmetries.

Template Parameters
grid_tThe Grid type which provides the field storage and interpolation

Member Typedef Documentation

◆ FieldType

template<typename grid_t>
using Acts::InterpolatedBFieldMap< grid_t >::FieldType = typename Grid::value_type

Type alias for magnetic field vector type.

◆ Grid

template<typename grid_t>
using Acts::InterpolatedBFieldMap< grid_t >::Grid = grid_t

Type alias for magnetic field grid.

Constructor & Destructor Documentation

◆ InterpolatedBFieldMap()

template<typename grid_t>
Acts::InterpolatedBFieldMap< grid_t >::InterpolatedBFieldMap ( Config cfg)
explicit

default constructor

Parameters
cfgConfiguration containing grid and scaling factor

Member Function Documentation

◆ getField() [1/2]

template<typename grid_t>
Result< Vector3 > Acts::InterpolatedBFieldMap< grid_t >::getField ( const Vector3 & position) const

retrieve field at given position

Parameters
[in]positionglobal 3D position
Returns
magnetic field value at the given position
Precondition
The given position must lie within the range of the underlying magnetic field map.

◆ getField() [2/2]

template<typename grid_t>
Result< Vector3 > Acts::InterpolatedBFieldMap< grid_t >::getField ( const Vector3 & position,
MagneticFieldProvider::Cache & cache ) const
finalvirtual

Retrieve magnetic field value at a given location.

Requires an instance of Acts::MagneticFieldProvider::Cache created through makeCache.

Parameters
[in]positionglobal 3D position for the lookup
[in,out]cacheField provider specific cache object
Returns
magnetic field vector at given position

Implements Acts::MagneticFieldProvider.

◆ getFieldCell()

template<typename grid_t>
Result< FieldCell > Acts::InterpolatedBFieldMap< grid_t >::getFieldCell ( const Vector3 & position) const

retrieve field cell for given position

Parameters
[in]positionglobal 3D position
Returns
field cell containing the given global position
Precondition
The given position must lie within the range of the underlying magnetic field map.

◆ getFieldUnchecked()

template<typename grid_t>
Vector3 Acts::InterpolatedBFieldMap< grid_t >::getFieldUnchecked ( const Vector3 & position) const
finalvirtual

Get magnetic field value without bounds checking (faster).

Parameters
positionGlobal 3D position for the lookup
Returns
Magnetic field value at the given position
Warning
No bounds checking is performed. The caller must ensure the position is within the valid range of the field map.

Implements Acts::InterpolatedMagneticField.

◆ getGrid()

template<typename grid_t>
const Grid & Acts::InterpolatedBFieldMap< grid_t >::getGrid ( ) const

Get a const reference on the underlying grid structure.

Returns
grid reference

◆ getMax()

template<typename grid_t>
std::vector< double > Acts::InterpolatedBFieldMap< grid_t >::getMax ( ) const
finalvirtual

get the maximum value of all axes of the field map

Returns
vector returning the maxima of all field map axes

Implements Acts::InterpolatedMagneticField.

◆ getMin()

template<typename grid_t>
std::vector< double > Acts::InterpolatedBFieldMap< grid_t >::getMin ( ) const
finalvirtual

get the minimum value of all axes of the field map

Returns
vector returning the minima of all field map axes

Implements Acts::InterpolatedMagneticField.

◆ getNBins()

template<typename grid_t>
std::vector< std::size_t > Acts::InterpolatedBFieldMap< grid_t >::getNBins ( ) const
finalvirtual

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

Returns
vector returning number of bins for all field map axes

Implements Acts::InterpolatedMagneticField.

◆ isInside()

template<typename grid_t>
bool Acts::InterpolatedBFieldMap< grid_t >::isInside ( const Vector3 & position) const
finalvirtual

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

Parameters
[in]positionglobal 3D position
Returns
true if position is inside the defined look-up grid, otherwise false

Implements Acts::InterpolatedMagneticField.

◆ isInsideLocal()

template<typename grid_t>
bool Acts::InterpolatedBFieldMap< grid_t >::isInsideLocal ( const ActsVector< DIM_POS > & gridPosition) const

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

Parameters
[in]gridPositionlocal N-D position
Returns
true if position is inside the defined look-up grid, otherwise false

◆ makeCache()

template<typename grid_t>
MagneticFieldProvider::Cache Acts::InterpolatedBFieldMap< grid_t >::makeCache ( const MagneticFieldContext & mctx) const
finalvirtual

Make an opaque cache for the magnetic field.

Instructs the specific implementation to generate a Acts::MagneticFieldProvider::Cache instance for magnetic field lookup.

Parameters
mctxThe magnetic field context to generate cache for
Returns
Cache The opaque cache object

Implements Acts::MagneticFieldProvider.

Member Data Documentation

◆ DIM_POS

template<typename grid_t>
std::size_t Acts::InterpolatedBFieldMap< grid_t >::DIM_POS = Grid::DIM
staticconstexpr

Dimensionality of the position space for field interpolation.