ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
Acts::MultiRangeBField Class Referencefinal

Magnetic field provider modelling a magnetic field consisting of several (potentially overlapping) regions of constant values. More...

#include <Acts/MagneticField/MultiRangeBField.hpp>

Inheritance diagram for Acts::MultiRangeBField:
[legend]
Collaboration diagram for Acts::MultiRangeBField:
[legend]

Public Member Functions

 MultiRangeBField (const std::vector< BFieldRange > &ranges)
 Construct a magnetic field from a vector of ranges.
 MultiRangeBField (std::vector< BFieldRange > &&ranges)
 Construct from a vector of magnetic field ranges (move version).
Result< Vector3getField (const Vector3 &position, MagneticFieldProvider::Cache &cache) const override
 Request the value of the magnetic field at a given position.
MagneticFieldProvider::Cache makeCache (const MagneticFieldContext &mctx) const override
 Construct a cache object.
Public Member Functions inherited from Acts::MagneticFieldProvider
virtual ~MagneticFieldProvider ()=default

Additional Inherited Members

Public Types inherited from Acts::MagneticFieldProvider
using Cache = Acts::AnyBase<sizeof(char) * 512>
 Opaque cache type that can store arbitrary implementation specific cache data.

Detailed Description

Magnetic field provider modelling a magnetic field consisting of several (potentially overlapping) regions of constant values.

The multi-range constant field allows modelling cases where a magnetic field can be described as multiple (potentially overlapping) regions, each of which has its own constant magnetic field. This provides more flexibility than the Acts::ConstantBField while providing higher performance than Acts::InterpolatedBFieldMap.

This magnetic field provider is configured using a list of pairs, where each pair defines a region in three-dimensional space as well as a field vector. Magnetic field lookup then proceeds by finding the last region in the user-provided list that contains the requested coordinate and returning the corresponding field vector.

The implementation uses a simple caching mechanism to store the last matched region, providing improved performance for consecutive lookups within the same region. This is thread-safe when each thread uses its own cache instance. The field configuration itself is immutable after construction.

Constructor & Destructor Documentation

◆ MultiRangeBField() [1/2]

Acts::MultiRangeBField::MultiRangeBField ( const std::vector< BFieldRange > & ranges)
explicit

Construct a magnetic field from a vector of ranges.

Parameters
rangesVector of magnetic field ranges to use
Warning
These ranges are listed in increasing order of precedence, i.e. ranges further along the vector have higher priority.

◆ MultiRangeBField() [2/2]

Acts::MultiRangeBField::MultiRangeBField ( std::vector< BFieldRange > && ranges)
explicit

Construct from a vector of magnetic field ranges (move version).

Parameters
rangesVector of magnetic field ranges to use (moved)
Warning
These ranges are listed in increasing order of precedence, i.e. ranges further along the vector have higher priority.

Member Function Documentation

◆ getField()

Result< Vector3 > Acts::MultiRangeBField::getField ( const Vector3 & position,
MagneticFieldProvider::Cache & cache ) const
overridevirtual

Request the value of the magnetic field at a given position.

Parameters
[in]positionGlobal 3D position for the lookup.
[in,out]cacheCache object.
Returns
A successful value containing a field vector if the given location is contained inside any of the regions, or a failure value otherwise.

Implements Acts::MagneticFieldProvider.

◆ makeCache()

MagneticFieldProvider::Cache Acts::MultiRangeBField::makeCache ( const MagneticFieldContext & mctx) const
overridevirtual

Construct a cache object.

Parameters
mctxMagnetic field context for cache creation
Returns
Cache object for magnetic field computations

Implements Acts::MagneticFieldProvider.