Namespace Acts::VectorHelpers

namespace VectorHelpers

Functions

inline double cast(const Vector3 &position, BinningValue bval)

Helper method to extract the binning value from a 3D vector.

For this method a 3D vector is required to guarantee all potential binning values.

inline ActsMatrix<3, 3> cross(const ActsMatrix<3, 3> &m, const Vector3 &v)

Calculates column-wise cross products of a matrix and a vector and stores the result column-wise in a matrix.

Parameters
  • m[in] Matrix that will be used for cross products

  • v[in] Vector for cross products

Returns

Constructed matrix

template<typename Derived>
double eta(const Eigen::MatrixBase<Derived> &v) noexcept

Calculate the pseudorapidity for a vector.

Note

Will static assert that the number of rows of v is at least 3, or in case of dynamic size, will abort execution if that is not the case.

Template Parameters

Derived – Eigen derived concrete type

Parameters

v – Any vector like Eigen type, static or dynamic

Returns

The pseudorapidity value

static inline const std::array<ActsScalar, 5> evaluateTrigonomics(const Vector3 &direction)

Fast evaluation of trigonomic functions.

Parameters

direction – for this evaluatoin

Returns

cos(phi), sin(phi), cos(theta), sin(theta), 1/sin(theta)

template<typename vector3_t>
inline auto makeVector4(const Eigen::MatrixBase<vector3_t> &vec3, typename vector3_t::Scalar w) -> Eigen::Matrix<typename vector3_t::Scalar, 4, 1>

Construct a four-vector from a three-vector and scalar fourth component.

template<typename Derived>
double perp(const Eigen::MatrixBase<Derived> &v) noexcept

Calculate radius in the transverse (xy) plane of a vector.

Note

Will static assert that the number of rows of v is at least 2, or in case of dynamic size, will abort execution if that is not the case.

Template Parameters

Derived – Eigen derived concrete type

Parameters

v – Any vector like Eigen type, static or dynamic

Returns

The transverse radius value.

template<typename Derived>
double phi(const Eigen::MatrixBase<Derived> &v) noexcept

Calculate phi (transverse plane angle) from compatible Eigen types.

Note

Will static assert that the number of rows of v is at least 2, or in case of dynamic size, will abort execution if that is not the case.

Template Parameters

Derived – Eigen derived concrete type

Parameters

v – Any vector like Eigen type, static or dynamic

Returns

The value of the angle in the transverse plane.

template<typename T, std::enable_if_t<detail::has_phi_method<T>::value, int> = 0>
double phi(const T &v) noexcept

Calculate phi (transverse plane angle) from anything implementing a method like phi() returing anything convertible to double.

Template Parameters

T – anything that has a phi method

Parameters

v – Any type that implements a phi method

Returns

The phi value

inline auto position(const Vector4 &pos4)

Access the three-position components in a four-position vector.

inline auto position(const FreeVector &params)

Access the three-position components in a free parameters vector.

template<typename Derived>
double theta(const Eigen::MatrixBase<Derived> &v) noexcept

Calculate the theta angle (longitudinal w.r.t.

z axis) of a vector

Note

Will static assert that the number of rows of v is at least 3, or in case of dynamic size, will abort execution if that is not the case.

Template Parameters

Derived – Eigen derived concrete type

Parameters

v – Any vector like Eigen type, static or dynamic

Returns

The theta value