ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
detray::axis::single_axis< bounds_t, binning_t > Struct Template Reference

A single axis. More...

#include <detray/utils/grid/axis.hpp>

Public Types

using binning_type = binning_t
 Make axis binning type accessible.
using bounds_type = bounds_t
 Make axis bounds accessible.
using scalar_type = typename binning_type::scalar_type
 Scalar type used by the binning implementation.
using container_types = typename binning_type::container_types
 Extract container typesContainer types used to store axis edges.
template<typename T>
using vector_type = typename binning_type::template vector_type<T>
 Container type for vectors with element type T.

Public Member Functions

constexpr single_axis ()=default
 Parameterized constructor - empty binning.
template<typename... Args>
 single_axis (const dsized_index_range &indx_range, const vector_type< scalar_type > *edges)
 Parametrized constructor that builds the binning scheme.
dindex bin (const scalar_type v) const
 Given a value on the axis, find the correct bin.
vector_type< scalar_type > bin_edges () const
darray< scalar_type, 2 > bin_edges (const dindex ibin) const
template<typename... Args>
constexpr scalar_type bin_width (Args &&...args) const
constexpr auto binning () const -> axis::binning
constexpr auto bounds () const -> axis::bounds
constexpr auto label () const -> axis::label
scalar_type max () const
scalar_type min () const
constexpr dindex nbins () const
constexpr bool operator== (const single_axis &rhs) const =default
 Equality operator.
template<typename neighbor_t>
bin_range range (const scalar_type v, const darray< neighbor_t, 2 > &nhood) const
 Given a value on the axis and a neighborhood, find the correct bin range.
darray< scalar_type, 2 > span () const

Public Attributes

binning_type m_binning {}
 Defines the binning on the axis as a service: regular vs irregular.
bounds_type m_bounds {}
 Defines the geometrical bounds of the axis as a service: open, closed or circular.

Detailed Description

template<typename bounds_t, typename binning_t>
struct detray::axis::single_axis< bounds_t, binning_t >

A single axis.

An axis ties bounds and binning behaviour with the bin edges storage. The bounds determine how bin indices are mapped at the over- and underflow bins. The type of binning determines whether the axis has regular or irregular binning. The bin edges needed to find bin indices are not owned by the axis, but are passed to the binning type.

Constructor & Destructor Documentation

◆ single_axis()

template<typename bounds_t, typename binning_t>
template<typename... Args>
detray::axis::single_axis< bounds_t, binning_t >::single_axis ( const dsized_index_range & indx_range,
const vector_type< scalar_type > * edges )

Parametrized constructor that builds the binning scheme.

Parameters
indx_rangeRange of bins represented by the supplied edges.
edgesPointer to the bin-edge values.

Member Function Documentation

◆ bin()

template<typename bounds_t, typename binning_t>
dindex detray::axis::single_axis< bounds_t, binning_t >::bin ( const scalar_type v) const

Given a value on the axis, find the correct bin.

Note
This includes bin index wrapping for circular axis.
Parameters
vis the value for the bin search
Returns
the bin index.

◆ bin_edges() [1/2]

template<typename bounds_t, typename binning_t>
vector_type< scalar_type > detray::axis::single_axis< bounds_t, binning_t >::bin_edges ( ) const
Returns
the values of the bin edges. Is a succession of lower edges.

◆ bin_edges() [2/2]

template<typename bounds_t, typename binning_t>
darray< scalar_type, 2 > detray::axis::single_axis< bounds_t, binning_t >::bin_edges ( const dindex ibin) const
Returns
the bin edges for a given
Parameters
ibin.

◆ bin_width()

template<typename bounds_t, typename binning_t>
template<typename... Args>
scalar_type detray::axis::single_axis< bounds_t, binning_t >::bin_width ( Args &&... args) const
constexpr
Returns
the width of a bin Return the width of a bin, forwarding arguments to the binning policy.
Parameters
argsArguments required by the binning policy.
Returns
Width of the selected bin.

◆ binning()

template<typename bounds_t, typename binning_t>
auto detray::axis::single_axis< bounds_t, binning_t >::binning ( ) const->axis::binning
constexpr
Returns
the type of binning of the axis, i.e. regular or irregular.

◆ bounds()

template<typename bounds_t, typename binning_t>
auto detray::axis::single_axis< bounds_t, binning_t >::bounds ( ) const->axis::bounds
constexpr
Returns
the type of bounds of the axis, i.e. closed, open or circular.

◆ label()

template<typename bounds_t, typename binning_t>
auto detray::axis::single_axis< bounds_t, binning_t >::label ( ) const->axis::label
constexpr
Returns
the axis label, i.e. x, y, z, r or phi axis.

◆ max()

template<typename bounds_t, typename binning_t>
scalar_type detray::axis::single_axis< bounds_t, binning_t >::max ( ) const
Returns
the axis span [min, max).

◆ min()

template<typename bounds_t, typename binning_t>
scalar_type detray::axis::single_axis< bounds_t, binning_t >::min ( ) const
Returns
the axis span [min, max).

◆ nbins()

template<typename bounds_t, typename binning_t>
dindex detray::axis::single_axis< bounds_t, binning_t >::nbins ( ) const
constexpr
Returns
the total number of bins

◆ operator==()

template<typename bounds_t, typename binning_t>
bool detray::axis::single_axis< bounds_t, binning_t >::operator== ( const single_axis< bounds_t, binning_t > & rhs) const
constexprdefault

Equality operator.

Parameters
rhsis the right-hand side of the comparison
Returns
whether the two axes are equal

◆ range()

template<typename bounds_t, typename binning_t>
template<typename neighbor_t>
bin_range detray::axis::single_axis< bounds_t, binning_t >::range ( const scalar_type v,
const darray< neighbor_t, 2 > & nhood ) const

Given a value on the axis and a neighborhood, find the correct bin range.

Note
(!) The circular axis index wrap-around happens in a separate step so that index sequences are well defined
Parameters
vis the value for the bin search
nhoodis the neighborhood range (in bins or value interval)
Returns
a dindex_range around the bin index.

◆ span()

template<typename bounds_t, typename binning_t>
darray< scalar_type, 2 > detray::axis::single_axis< bounds_t, binning_t >::span ( ) const
Returns
the axis span [min, max).