File ConstantBField.hpp

namespace Acts

Note

This file is foreseen for the Geometry module to replace Extent

class ConstantBField : public Acts::MagneticFieldProvider
#include <Acts/MagneticField/ConstantBField.hpp>

This class implements a simple constant magnetic field.

The magnetic field value has to be set at creation time, but can be updated later on.

Public Functions

inline explicit ConstantBField(Vector3 B)

Construct constant magnetic field from field vector.

Parameters

B[in] magnetic field vector in global coordinate system

inline Vector3 getField() const

Get the B field at a position.

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

retrieve magnetic field value

Note

The position is ignored and only kept as argument to provide a consistent interface with other magnetic field services.

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

Note

The position is ignored and only kept as argument to provide a consistent interface with other magnetic field services.

Note

currently the derivative is not calculated

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 bool isInside(const Vector3 &position) const

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

Parameters

position[in] global 3D position

Returns

Always true for constant magnetic field

inline virtual Acts::MagneticFieldProvider::Cache makeCache(const Acts::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

inline void setField(const Vector3 &B)

update magnetic field vector

Parameters

B[in] magnetic field vector in global coordinate system

Private Members

Vector3 m_BField

magnetic field vector

struct Cache
#include <Acts/MagneticField/ConstantBField.hpp>

Public Functions

inline Cache(const MagneticFieldContext&)

constructor with context