ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
Acts::MultiAxis< Axes > Class Template Reference

Multi-dimensional binning defined by a product of one-dimensional axes. More...

#include <Acts/Utilities/MultiAxis.hpp>

Inheritance diagram for Acts::MultiAxis< Axes >:
[legend]
Collaboration diagram for Acts::MultiAxis< Axes >:
[legend]

Public Types

using AxesTuple = std::tuple<Axes...>
 Tuple type holding the concrete axes.
using Base = IMultiAxisXD<sizeof...(Axes)>
 Base interface for this multi-axis' dimension.
using GlobalBin = typename Base::GlobalBin
 Flattened global bin index across all axes.
using LocalBins = typename Base::LocalBins
 Statically sized multi-index holding one local bin index per axis.
using Point = typename Base::Point
 Statically sized point holding one coordinate per axis.
using VectorPoint = Vector<DIM>
 Point holding one coordinate per axis as an Eigen (algebra) vector.
Public Types inherited from Acts::IMultiAxisXD< sizeof...(Axes)>
using AnyAxesArray
 Statically sized array of (non-owning) pointers to the contained axes.
using AnyAxesTuple
 Tuple of const references to the contained axes.
using LocalBins
 Statically sized multi-index holding one local bin index per axis.
using Point
 Statically sized point holding one coordinate per axis.
Public Types inherited from Acts::IMultiAxis
using AnyAxesVector = SmallVector<const IAxis*>
 Dynamically sized vector of (non-owning) pointers to the contained axes.
using AnyLocalBins = SmallVector<std::size_t>
 Dynamically sized multi-index holding one local bin index per axis.
using AnyPoint = SmallVector<double>
 Dynamically sized point holding one coordinate per axis.
using GlobalBin = std::size_t
 Flattened global bin index across all axes.

Public Member Functions

 MultiAxis (Axes &&... axes)
 Construct from individual axes (forwarding).
 MultiAxis (const Axes &... axes)
 Construct from individual axes (copy).
 MultiAxis (const std::tuple< Axes... > &axes)
 Construct from a tuple of axes (copy).
 MultiAxis (std::tuple< Axes... > &&axes)
 Construct from a tuple of axes (move).
const AxesTuplegetAxesTuple () const
 Get the tuple of concrete axes.
const IAxisgetAxis (std::size_t i) const final
 Get the axis at the given dimension.
Point getBinCenter (const LocalBins &localBins) const final
 Get the center of the bin given by a multi-index.
Point getBinWidth (const LocalBins &localBins) const final
 Get the bin width along each axis for a given multi-index.
template<typename Derived>
detail::FlatNeighborHoodIndices< DIMgetClosestPointsIndices (const Eigen::MatrixBase< Derived > &point) const
 Get the global bin indices of the grid points closest to the given point.
detail::FlatNeighborHoodIndices< DIMgetClosestPointsIndices (const LocalBins &localBins) const override
 Get the global bin indices of the grid points closest to the given bin.
detail::FlatNeighborHoodIndices< DIMgetClosestPointsIndices (const Point &point) const override
 Get the global bin indices of the grid points closest to the given point.
GlobalBin getGlobalBinFromLocalBins (const LocalBins &localBins) const final
 Determine the flattened global bin index from a multi-index.
template<typename Derived>
GlobalBin getGlobalBinFromLowerLeftEdge (const Eigen::MatrixBase< Derived > &point) const
 Determine the flattened global bin index of the bin with the lower left edge closest to the given point for each axis.
GlobalBin getGlobalBinFromLowerLeftEdge (const Point &point) const
 Determine the flattened global bin index of the bin with the lower left edge closest to the given point for each axis.
template<typename Derived>
GlobalBin getGlobalBinFromPoint (const Eigen::MatrixBase< Derived > &point) const
 Determine the flattened global bin index for a given point.
GlobalBin getGlobalBinFromPoint (const Point &point) const final
 Determine the flattened global bin index for a given point.
LocalBins getLocalBinsFromGlobalBin (GlobalBin globalBin) const final
 Determine the multi-index of local bin indices from a flattened global bin index.
template<typename Derived>
LocalBins getLocalBinsFromLowerLeftEdge (const Eigen::MatrixBase< Derived > &point) const
 Determine the multi-index of local bin indices for a given point, where the point is interpreted as being shifted by half a bin width along each axis.
LocalBins getLocalBinsFromLowerLeftEdge (const Point &point) const
 Determine the multi-index of local bin indices for a given point, where the point is interpreted as being shifted by half a bin width along each axis.
template<typename Derived>
LocalBins getLocalBinsFromPoint (const Eigen::MatrixBase< Derived > &point) const
 Determine the multi-index of local bin indices for a given point.
LocalBins getLocalBinsFromPoint (const Point &point) const final
 Determine the multi-index of local bin indices for a given point.
Point getLowerLeftBinEdge (const LocalBins &localBins) const final
 Get the lower-left corner of the bin given by a multi-index.
Point getMaxPoint () const final
 Get the upper boundary of the grid range along each axis.
Point getMinPoint () const final
 Get the lower boundary of the grid range along each axis.
LocalBins getNBins () const final
 Get the number of bins along each axis.
detail::FlatNeighborHoodIndices< DIMgetNeighborHoodIndices (const LocalBins &localBins, const std::array< std::pair< int, int >, DIM > &sizePerAxis) const final
 Get the global bin indices of the bins in the neighborhood of a bin, with a separate neighborhood size per axis.
detail::FlatNeighborHoodIndices< DIMgetNeighborHoodIndices (const LocalBins &localBins, const std::pair< int, int > &size) const final
 Get the global bin indices of the bins in the neighborhood of a bin.
detail::FlatNeighborHoodIndices< DIMgetNeighborHoodIndices (const LocalBins &localBins, std::size_t size=1u) const final
 Get the global bin indices of the bins in the neighborhood of a bin.
Point getUpperRightBinEdge (const LocalBins &localBins) const final
 Get the upper-right corner of the bin given by a multi-index.
template<typename Derived>
bool isInside (const Eigen::MatrixBase< Derived > &point) const
 Check whether a point lies inside the grid limits.
bool isInside (const Point &point) const final
 Check whether a point lies inside the grid limits.
Public Member Functions inherited from Acts::IMultiAxisXD< sizeof...(Axes)>
virtual AnyAxesArray getAnyAxesArray () const
 Get (non-owning) pointers to all contained axes.
virtual AnyAxesTuple getAnyAxesTuple () const
 Get const references to all contained axes as a tuple.
std::size_t getNAxes () const override
 Get the number of axes spanning the grid.
Public Member Functions inherited from Acts::IMultiAxis
iterator begin () const
iterator end () const
virtual AnyAxesVector getAnyAxesVector () const
 Get (non-owning) pointers to all contained axes.
virtual AnyPoint getBinCenterAny (const AnyLocalBins &indices) const
 Get the center of the bin given by a multi-index.
virtual AnyPoint getLowerLeftBinEdgeAny (const AnyLocalBins &indices) const
 Get the lower-left corner of the bin given by a multi-index.
virtual AnyPoint getMaxPointAny () const
 Get the upper boundary of the grid range along each axis.
virtual AnyPoint getMinPointAny () const
 Get the lower boundary of the grid range along each axis.
virtual AnyLocalBins getNBinsAny () const
 Get the number of bins along each axis.
virtual std::size_t getNTotalBins (bool includeOverflowBins=false) const
 Get the total number of bins in the grid.
virtual AnyPoint getUpperRightBinEdgeAny (const AnyLocalBins &indices) const
 Get the upper-right corner of the bin given by a multi-index.
virtual bool isInsideAny (const AnyPoint &point) const
 Check whether a point lies inside the grid limits.

Static Public Attributes

static constexpr std::size_t DIM = Base::DIM
 Dimension of the grid (number of axes).
Static Public Attributes inherited from Acts::IMultiAxisXD< sizeof...(Axes)>
static constexpr std::size_t DIM
 Dimension of the grid (number of axes).

Additional Inherited Members

Static Public Member Functions inherited from Acts::IMultiAxis
static std::unique_ptr< IMultiAxis1Dcreate (const IAxis &axis1)
 Factory method to create a multi-axis of dimension 1.
static std::unique_ptr< IMultiAxis2Dcreate (const IAxis &axis1, const IAxis &axis2)
 Factory method to create a multi-axis of dimension 2.
static std::unique_ptr< IMultiAxis3Dcreate (const IAxis &axis1, const IAxis &axis2, const IAxis &axis3)
 Factory method to create a multi-axis of dimension 3.
Protected Member Functions inherited from Acts::IMultiAxis
virtual void toStream (std::ostream &os) const
 Print the contained axes to the given stream.

Detailed Description

template<AxisConcept... Axes>
class Acts::MultiAxis< Axes >

Multi-dimensional binning defined by a product of one-dimensional axes.

This class stores a fixed set of concrete Axis objects in a tuple and implements the IMultiAxisXD interface for the resulting grid. The grid dimension and the concrete axis types (binning and boundary types) are fixed at compile time, while the IMultiAxis base allows handling different multi-axes through a common pointer. The grid index conventions (per-axis local bin indices starting at 1, under-/overflow bins at 0 and nBins + 1, and flattened global bin indices including those under-/overflow bins) are described on IMultiAxis.

Template Parameters
Axesparameter pack of concrete Axis types spanning the grid

Constructor & Destructor Documentation

◆ MultiAxis() [1/4]

template<AxisConcept... Axes>
Acts::MultiAxis< Axes >::MultiAxis ( const std::tuple< Axes... > & axes)
explicit

Construct from a tuple of axes (copy).

Parameters
axestuple of axes spanning the grid

◆ MultiAxis() [2/4]

template<AxisConcept... Axes>
Acts::MultiAxis< Axes >::MultiAxis ( std::tuple< Axes... > && axes)
explicit

Construct from a tuple of axes (move).

Parameters
axestuple of axes spanning the grid

◆ MultiAxis() [3/4]

template<AxisConcept... Axes>
Acts::MultiAxis< Axes >::MultiAxis ( Axes &&... axes)
explicit

Construct from individual axes (forwarding).

Parameters
axesaxes spanning the grid

◆ MultiAxis() [4/4]

template<AxisConcept... Axes>
Acts::MultiAxis< Axes >::MultiAxis ( const Axes &... axes)
explicit

Construct from individual axes (copy).

Parameters
axesaxes spanning the grid

Member Function Documentation

◆ getAxesTuple()

template<AxisConcept... Axes>
const AxesTuple & Acts::MultiAxis< Axes >::getAxesTuple ( ) const

Get the tuple of concrete axes.

Returns
const reference to the stored axes tuple

◆ getAxis()

template<AxisConcept... Axes>
const IAxis & Acts::MultiAxis< Axes >::getAxis ( std::size_t i) const
finalvirtual

Get the axis at the given dimension.

Parameters
iindex of the axis
Returns
const reference to the requested axis

Implements Acts::IMultiAxis.

◆ getBinCenter()

template<AxisConcept... Axes>
Point Acts::MultiAxis< Axes >::getBinCenter ( const LocalBins & localBins) const
finalvirtual

Get the center of the bin given by a multi-index.

Parameters
localBinslocal bin indices along each axis
Returns
point holding the bin center coordinate of each axis

Reimplemented from Acts::IMultiAxisXD< sizeof...(Axes)>.

◆ getBinWidth()

template<AxisConcept... Axes>
Point Acts::MultiAxis< Axes >::getBinWidth ( const LocalBins & localBins) const
finalvirtual

Get the bin width along each axis for a given multi-index.

Parameters
localBinslocal bin indices along each axis
Returns
point holding the bin width along each axis

Reimplemented from Acts::IMultiAxisXD< sizeof...(Axes)>.

◆ getClosestPointsIndices() [1/3]

template<AxisConcept... Axes>
template<typename Derived>
detail::FlatNeighborHoodIndices< DIM > Acts::MultiAxis< Axes >::getClosestPointsIndices ( const Eigen::MatrixBase< Derived > & point) const

Get the global bin indices of the grid points closest to the given point.

Template Parameters
DerivedEigen expression type of the point (e.g. VectorPoint)
Parameters
pointcoordinates to look up, one per axis
Returns
sorted collection of global bin indices of the closest grid points

◆ getClosestPointsIndices() [2/3]

template<AxisConcept... Axes>
detail::FlatNeighborHoodIndices< DIM > Acts::MultiAxis< Axes >::getClosestPointsIndices ( const LocalBins & localBins) const
overridevirtual

Get the global bin indices of the grid points closest to the given bin.

Parameters
localBinslocal bin indices of the bin of interest
Returns
sorted collection of global bin indices whose lower-left corners are the closest grid points to every point in the given bin

Implements Acts::IMultiAxisXD< sizeof...(Axes)>.

◆ getClosestPointsIndices() [3/3]

template<AxisConcept... Axes>
detail::FlatNeighborHoodIndices< DIM > Acts::MultiAxis< Axes >::getClosestPointsIndices ( const Point & point) const
overridevirtual

Get the global bin indices of the grid points closest to the given point.

Parameters
pointcoordinates to look up, one per axis
Returns
sorted collection of global bin indices of the closest grid points

Reimplemented from Acts::IMultiAxisXD< sizeof...(Axes)>.

◆ getGlobalBinFromLocalBins()

template<AxisConcept... Axes>
GlobalBin Acts::MultiAxis< Axes >::getGlobalBinFromLocalBins ( const LocalBins & localBins) const
finalvirtual

Determine the flattened global bin index from a multi-index.

Parameters
localBinslocal bin indices along each axis (under-/overflow bins are allowed)
Returns
global bin index of the bin

Reimplemented from Acts::IMultiAxisXD< sizeof...(Axes)>.

◆ getGlobalBinFromLowerLeftEdge() [1/2]

template<AxisConcept... Axes>
template<typename Derived>
GlobalBin Acts::MultiAxis< Axes >::getGlobalBinFromLowerLeftEdge ( const Eigen::MatrixBase< Derived > & point) const

Determine the flattened global bin index of the bin with the lower left edge closest to the given point for each axis.

Parameters
pointcoordinates to look up, one per axis
Returns
global bin index of the bin
Template Parameters
DerivedEigen expression type of the point (e.g. VectorPoint)

◆ getGlobalBinFromLowerLeftEdge() [2/2]

template<AxisConcept... Axes>
GlobalBin Acts::MultiAxis< Axes >::getGlobalBinFromLowerLeftEdge ( const Point & point) const

Determine the flattened global bin index of the bin with the lower left edge closest to the given point for each axis.

Parameters
pointcoordinates to look up, one per axis
Returns
global bin index of the bin

◆ getGlobalBinFromPoint() [1/2]

template<AxisConcept... Axes>
template<typename Derived>
GlobalBin Acts::MultiAxis< Axes >::getGlobalBinFromPoint ( const Eigen::MatrixBase< Derived > & point) const

Determine the flattened global bin index for a given point.

Template Parameters
DerivedEigen expression type of the point (e.g. VectorPoint)
Parameters
pointcoordinates to look up, one per axis
Returns
global bin index of the bin containing the point

◆ getGlobalBinFromPoint() [2/2]

template<AxisConcept... Axes>
GlobalBin Acts::MultiAxis< Axes >::getGlobalBinFromPoint ( const Point & point) const
finalvirtual

Determine the flattened global bin index for a given point.

Parameters
pointcoordinates to look up, one per axis
Returns
global bin index of the bin containing the point

Reimplemented from Acts::IMultiAxisXD< sizeof...(Axes)>.

◆ getLocalBinsFromGlobalBin()

template<AxisConcept... Axes>
LocalBins Acts::MultiAxis< Axes >::getLocalBinsFromGlobalBin ( GlobalBin globalBin) const
finalvirtual

Determine the multi-index of local bin indices from a flattened global bin index.

Parameters
globalBinglobal bin index
Returns
local bin indices along each axis (may be under-/overflow bins)

Reimplemented from Acts::IMultiAxisXD< sizeof...(Axes)>.

◆ getLocalBinsFromLowerLeftEdge() [1/2]

template<AxisConcept... Axes>
template<typename Derived>
LocalBins Acts::MultiAxis< Axes >::getLocalBinsFromLowerLeftEdge ( const Eigen::MatrixBase< Derived > & point) const

Determine the multi-index of local bin indices for a given point, where the point is interpreted as being shifted by half a bin width along each axis.

Parameters
pointcoordinates to look up, one per axis
Returns
local bin indices along each axis (may be under-/overflow bins)
Template Parameters
DerivedEigen expression type of the point (e.g. VectorPoint)

◆ getLocalBinsFromLowerLeftEdge() [2/2]

template<AxisConcept... Axes>
LocalBins Acts::MultiAxis< Axes >::getLocalBinsFromLowerLeftEdge ( const Point & point) const

Determine the multi-index of local bin indices for a given point, where the point is interpreted as being shifted by half a bin width along each axis.

Parameters
pointcoordinates to look up, one per axis
Returns
local bin indices along each axis (may be under-/overflow bins)

◆ getLocalBinsFromPoint() [1/2]

template<AxisConcept... Axes>
template<typename Derived>
LocalBins Acts::MultiAxis< Axes >::getLocalBinsFromPoint ( const Eigen::MatrixBase< Derived > & point) const

Determine the multi-index of local bin indices for a given point.

Template Parameters
DerivedEigen expression type of the point (e.g. VectorPoint)
Parameters
pointcoordinates to look up, one per axis
Returns
local bin indices along each axis (may be under-/overflow bins)

◆ getLocalBinsFromPoint() [2/2]

template<AxisConcept... Axes>
LocalBins Acts::MultiAxis< Axes >::getLocalBinsFromPoint ( const Point & point) const
finalvirtual

Determine the multi-index of local bin indices for a given point.

Parameters
pointcoordinates to look up, one per axis
Returns
local bin indices along each axis (may be under-/overflow bins)

Reimplemented from Acts::IMultiAxisXD< sizeof...(Axes)>.

◆ getLowerLeftBinEdge()

template<AxisConcept... Axes>
Point Acts::MultiAxis< Axes >::getLowerLeftBinEdge ( const LocalBins & localBins) const
finalvirtual

Get the lower-left corner of the bin given by a multi-index.

Parameters
localBinslocal bin indices along each axis
Returns
point holding the lower bin boundary of each axis

Reimplemented from Acts::IMultiAxisXD< sizeof...(Axes)>.

◆ getMaxPoint()

template<AxisConcept... Axes>
Point Acts::MultiAxis< Axes >::getMaxPoint ( ) const
finalvirtual

Get the upper boundary of the grid range along each axis.

Returns
point holding the maximum of each axis

Reimplemented from Acts::IMultiAxisXD< sizeof...(Axes)>.

◆ getMinPoint()

template<AxisConcept... Axes>
Point Acts::MultiAxis< Axes >::getMinPoint ( ) const
finalvirtual

Get the lower boundary of the grid range along each axis.

Returns
point holding the minimum of each axis

Reimplemented from Acts::IMultiAxisXD< sizeof...(Axes)>.

◆ getNBins()

template<AxisConcept... Axes>
LocalBins Acts::MultiAxis< Axes >::getNBins ( ) const
finalvirtual

Get the number of bins along each axis.

Returns
per-axis number of bins (excluding under-/overflow bins)

Reimplemented from Acts::IMultiAxisXD< sizeof...(Axes)>.

◆ getNeighborHoodIndices() [1/3]

template<AxisConcept... Axes>
detail::FlatNeighborHoodIndices< DIM > Acts::MultiAxis< Axes >::getNeighborHoodIndices ( const LocalBins & localBins,
const std::array< std::pair< int, int >, DIM > & sizePerAxis ) const
finalvirtual

Get the global bin indices of the bins in the neighborhood of a bin, with a separate neighborhood size per axis.

Parameters
localBinslocal bin indices of the bin of interest
sizePerAxisper-axis lower/upper number of adjacent bins to include
Returns
sorted collection of global bin indices in the neighborhood

Implements Acts::IMultiAxisXD< sizeof...(Axes)>.

◆ getNeighborHoodIndices() [2/3]

template<AxisConcept... Axes>
detail::FlatNeighborHoodIndices< DIM > Acts::MultiAxis< Axes >::getNeighborHoodIndices ( const LocalBins & localBins,
const std::pair< int, int > & size ) const
finalvirtual

Get the global bin indices of the bins in the neighborhood of a bin.

Parameters
localBinslocal bin indices of the bin of interest
sizeof neighborhood determining how many adjacent bins along each axis are considered
Returns
sorted collection of global bin indices in the neighborhood

Implements Acts::IMultiAxisXD< sizeof...(Axes)>.

◆ getNeighborHoodIndices() [3/3]

template<AxisConcept... Axes>
detail::FlatNeighborHoodIndices< DIM > Acts::MultiAxis< Axes >::getNeighborHoodIndices ( const LocalBins & localBins,
std::size_t size = 1u ) const
finalvirtual

Get the global bin indices of the bins in the neighborhood of a bin.

Parameters
localBinslocal bin indices of the bin of interest
sizenumber of adjacent bins to include along each axis (symmetric)
Returns
sorted collection of global bin indices in the neighborhood

Implements Acts::IMultiAxisXD< sizeof...(Axes)>.

◆ getUpperRightBinEdge()

template<AxisConcept... Axes>
Point Acts::MultiAxis< Axes >::getUpperRightBinEdge ( const LocalBins & localBins) const
finalvirtual

Get the upper-right corner of the bin given by a multi-index.

Parameters
localBinslocal bin indices along each axis
Returns
point holding the upper bin boundary of each axis

Reimplemented from Acts::IMultiAxisXD< sizeof...(Axes)>.

◆ isInside() [1/2]

template<AxisConcept... Axes>
template<typename Derived>
bool Acts::MultiAxis< Axes >::isInside ( const Eigen::MatrixBase< Derived > & point) const

Check whether a point lies inside the grid limits.

Template Parameters
DerivedEigen expression type of the point (e.g. VectorPoint)
Parameters
pointcoordinates to check, one per axis
Returns
true if the point is within range along every axis

◆ isInside() [2/2]

template<AxisConcept... Axes>
bool Acts::MultiAxis< Axes >::isInside ( const Point & point) const
finalvirtual

Check whether a point lies inside the grid limits.

Parameters
pointcoordinates to check, one per axis
Returns
true if the point is within range along every axis

Reimplemented from Acts::IMultiAxisXD< sizeof...(Axes)>.