File SharedBField.hpp

namespace Acts

Note

This file is foreseen for the Geometry module to replace Extent

template<typename BField>
class SharedBField : public Acts::MagneticFieldProvider
#include <Acts/MagneticField/SharedBField.hpp>

allows to use a shared magnetic field in several places and with multiple steppers mainly targeted to save memory

Public Types

using Cache = typename BField::Cache

Public Functions

SharedBField() = delete

Disallow construction without a valid underlying field.

inline SharedBField(std::shared_ptr<const BField> bField)

Constructur with a shared pointer from a shared pointer.

Note

Since it is a shared field, we enforce it to be const

Template Parameters

bField – is the shared BField to be stored

inline virtual Result<Vector3> getField(const Vector3 &position, MagneticFieldProvider::Cache &cache) const override

retrieve magnetic field value

Parameters
  • position[in] global 3D position

  • cache[inout] Field provider specific cache object

Returns

magnetic field vector at given position

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

retrieve magnetic field value & its gradient

Parameters
  • position[in] global 3D position

  • derivative[out] gradient of magnetic field vector as (3x3) matrix

  • cache[inout] Field provider specific cache object

Returns

magnetic field vector

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

Make an opaque cache for the magnetic field.

Parameters

mctx – The magnetic field context to generate cache for

Returns

Cache The opaque cache object

Private Members

std::shared_ptr<const BField> m_bField