File BoundaryCheck.hpp

namespace Acts

Note

This file is foreseen for the Geometry module to replace Extent

class BoundaryCheck
#include <Acts/Surfaces/BoundaryCheck.hpp>

The BoundaryCheck class provides boundary checks and distance calculations for aligned box-like and polygonal boundaries on local surfaces.

Different types of boundary checks are supported and are transparently selected when calling the isInside(...) and distance(...) methods:

  • Hard checks w/o any tolerances

  • Tolerance-based checks in one or in both local coordinates

  • Chi2-based checks based on a covariance matrix. Non-vanishing correlations are correctly taken into account.

With a defined covariance matrix, the closest point and the distance are not defined along the usual Euclidean metric, but by the Mahalanobis distance induced by the covariance.

Public Types

enum Type

Values:

enumerator eNone

disable boundary check

enumerator eAbsolute

absolute cut

enumerator eChi2

chi2-based cut with full correlations

Public Functions

inline BoundaryCheck(bool check)

Construct either hard cut in both dimensions or no cut at all.

inline BoundaryCheck(bool checkLocal0, bool checkLocal1, double tolerance0 = 0, double tolerance1 = 0)

Construct a tolerance based check.

Parameters
  • checkLocal0 – Boolean directive to check coordinate 0

  • checkLocal1 – Boolean directive to check coordinate 1

  • tolerance0 – Tolerance along coordinate 0

  • tolerance1 – Tolerance along coordinate 1

inline BoundaryCheck(const SymMatrix2 &localCovariance, double sigmaMax = 1)

Construct a chi2-based check.

Parameters
  • localCovariance – Coverance matrix in local coordinates

  • sigmaMax – Significance for the compatibility test

template<typename Vector2Container>
inline Acts::Vector2 computeClosestPointOnPolygon(const Acts::Vector2 &point, const Vector2Container &vertices) const
inline SymMatrix2 covariance() const
template<typename Vector2Container>
inline double distance(const Vector2 &point, const Vector2Container &vertices) const

Calculate the signed, weighted, closest distance to a polygonal boundary.

If a covariance is defined, the distance is the corresponding Mahalanobis distance. Otherwise, it is the Eucleadian distance.

Parameters
  • point – Test point

  • vertices – Forward iterable container of convex polygon vertices. Calling std::begin/ std::end on the container must return an iterator where *it must be convertible to an Acts::Vector2.

Returns

Negative value if inside, positive if outside

inline double distance(const Vector2 &point, const Vector2 &lowerLeft, const Vector2 &upperRight) const

Calculate the signed, weighted, closest distance to an aligned box.

If a covariance is defined, the distance is the corresponding Mahalanobis distance. Otherwise, it is the Eucleadian distance.

Parameters
  • point – Test point

  • lowerLeft – Minimal vertex of the box

  • upperRight – Maximal vertex of the box

Returns

Negative value if inside, positive if outside

template<typename Vector2Container>
inline bool isInside(const Vector2 &point, const Vector2Container &vertices) const

Check if the point is inside a polygon.

The check takes into account whether tolerances or covariances are defined for the boundary check.

Parameters
  • point – Test point

  • vertices – Forward iterable container of convex polygon vertices. Calling std::begin/ std::end on the container must return an iterator where *it must be convertible to an Acts::Vector2.

inline bool isInside(const Vector2 &point, const Vector2 &lowerLeft, const Vector2 &upperRight) const

Check if the point is inside a box aligned with the local axes.

The check takes into account whether tolerances or covariances are defined for the boundary check.

Parameters
  • point – Test point

  • lowerLeft – Minimal vertex of the box

  • upperRight – Maximal vertex of the box

inline operator bool() const
inline bool operator!() const
inline const Vector2 &tolerance() const
inline Type type() const

Broadcast the type.

Private Functions

template<typename Vector2Container>
Vector2 computeClosestPointOnPolygon(const Vector2 &point, const Vector2Container &vertices) const

Calculate the closest point on the polygon.

inline Vector2 computeEuclideanClosestPointOnRectangle(const Vector2 &point, const Vector2 &lowerLeft, const Vector2 &upperRight) const

Calculate the closest point on the box.

inline bool isTolerated(const Vector2 &delta) const

Check if the distance vector is within the absolute or relative limits.

inline double squaredNorm(const Vector2 &x) const

Compute vector norm based on the covariance.

inline BoundaryCheck transformed(const ActsMatrix<2, 2> &jacobian) const

Return a new BoundaryCheck with updated covariance.

Warning

This currently only transforms the covariance and does not work for the tolerance based check.

Parameters

jacobian – Tranform Jacobian for the covariance

Private Members

Vector2 m_tolerance

dual use: absolute tolerances or relative chi2/ sigma cut.

Type m_type
SymMatrix2 m_weight

metric weight matrix: identity for absolute mode or inverse covariance

Friends

friend class CylinderBounds
friend class DiscTrapezoidBounds
friend class EllipseBounds
friend class RectangleBounds