ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
Acts::IAxis Class Referenceabstract

Common base class for all Axis instance. More...

#include <Acts/Utilities/IAxis.hpp>

Inheritance diagram for Acts::IAxis:
[legend]

Public Member Functions

 IAxis (std::optional< AxisDirection > direction)
 Constructs a new axis with the given direction.
virtual std::size_t getBin (double x) const =0
 Get corresponding bin index for given coordinate.
virtual std::vector< double > getBinEdges () const =0
 Returns a vector of bin edges.
virtual AxisBoundaryType getBoundaryType () const =0
 Returns the boundary type set in the template param.
std::optional< AxisDirectiongetDirection () const
 Returns the direction of the axis.
virtual double getMax () const =0
 Get maximum of binning range.
virtual double getMin () const =0
 Get minimum of binning range.
virtual std::size_t getNBins () const =0
 Get total number of bins.
virtual AxisType getType () const =0
 Returns the type of the axis.
virtual bool isEquidistant () const =0
 Returns whether the axis is equidistant.
virtual bool isVariable () const =0
 Returns whether the axis is variable.
template<typename callable_t>
decltype(auto) visit (const callable_t &callable) const
 Helper function that dispatches from the IAxis base class to a concrete axis type.

Static Public Member Functions

static std::unique_ptr< IAxis > createEquidistant (AxisBoundaryType aBoundaryType, double min, double max, std::size_t nbins, std::optional< AxisDirection > direction=std::nullopt)
 Centralized axis factory for equidistant binning.
static std::unique_ptr< IAxis > createVariable (AxisBoundaryType aBoundaryType, const std::vector< double > &edges, std::optional< AxisDirection > direction=std::nullopt)
 Centralized axis factory for variable binning.

Protected Member Functions

virtual void toStream (std::ostream &os) const =0
 Dispatch to the correct stream operator.

Detailed Description

Common base class for all Axis instance.

This allows generice handling such as for inspection.

Constructor & Destructor Documentation

◆ IAxis()

Acts::IAxis::IAxis ( std::optional< AxisDirection > direction)
explicit

Constructs a new axis with the given direction.

Parameters
directionthe optional direction of the axis

Member Function Documentation

◆ createEquidistant()

std::unique_ptr< IAxis > Acts::IAxis::createEquidistant ( AxisBoundaryType aBoundaryType,
double min,
double max,
std::size_t nbins,
std::optional< AxisDirection > direction = std::nullopt )
static

Centralized axis factory for equidistant binning.

Parameters
aBoundaryTypethe axis boundary type
minthe minimum edge of the axis
maxthe maximum edge of the axis
nbinsthe number of bins
directionthe optional direction of the axis
Exceptions
std::invalid_argumentif min >= max or nbins == 0
Returns
a unique pointer to the axis

◆ createVariable()

std::unique_ptr< IAxis > Acts::IAxis::createVariable ( AxisBoundaryType aBoundaryType,
const std::vector< double > & edges,
std::optional< AxisDirection > direction = std::nullopt )
static

Centralized axis factory for variable binning.

Parameters
aBoundaryTypethe axis boundary type
edgesare the bin edges
directionthe optional direction of the axis
Exceptions
std::invalid_argumentif edges is empty or not strictly increasing
Returns
a unique pointer to the axis

◆ getBin()

virtual std::size_t Acts::IAxis::getBin ( double x) const
pure virtual

Get corresponding bin index for given coordinate.

Parameters
[in]xinput coordinate
Returns
index of bin containing the given value
Note
Bin indices start at 1. The underflow bin has the index 0 while the index nBins + 1 indicates the overflow bin .

Implemented in Acts::Axis< AxisType::Equidistant, bdt >, and Acts::Axis< AxisType::Variable, bdt >.

◆ getBinEdges()

virtual std::vector< double > Acts::IAxis::getBinEdges ( ) const
pure virtual

Returns a vector of bin edges.

Returns
Vector which contains the bin edges

Implemented in Acts::Axis< AxisType::Equidistant, bdt >, and Acts::Axis< AxisType::Variable, bdt >.

◆ getBoundaryType()

virtual AxisBoundaryType Acts::IAxis::getBoundaryType ( ) const
pure virtual

Returns the boundary type set in the template param.

Returns
AxisBoundaryType of this axis

Implemented in Acts::Axis< AxisType::Equidistant, bdt >, and Acts::Axis< AxisType::Variable, bdt >.

◆ getDirection()

std::optional< AxisDirection > Acts::IAxis::getDirection ( ) const

Returns the direction of the axis.

Returns
AxisDirection of this axis

◆ getMax()

virtual double Acts::IAxis::getMax ( ) const
pure virtual

Get maximum of binning range.

Returns
maximum of binning range

Implemented in Acts::Axis< AxisType::Equidistant, bdt >, and Acts::Axis< AxisType::Variable, bdt >.

◆ getMin()

virtual double Acts::IAxis::getMin ( ) const
pure virtual

Get minimum of binning range.

Returns
minimum of binning range

Implemented in Acts::Axis< AxisType::Equidistant, bdt >, and Acts::Axis< AxisType::Variable, bdt >.

◆ getNBins()

virtual std::size_t Acts::IAxis::getNBins ( ) const
pure virtual

Get total number of bins.

Returns
total number of bins (excluding under-/overflow bins)

Implemented in Acts::Axis< AxisType::Equidistant, bdt >, and Acts::Axis< AxisType::Variable, bdt >.

◆ getType()

virtual AxisType Acts::IAxis::getType ( ) const
pure virtual

Returns the type of the axis.

Returns
AxisType of this axis

Implemented in Acts::Axis< AxisType::Equidistant, bdt >, and Acts::Axis< AxisType::Variable, bdt >.

◆ isEquidistant()

virtual bool Acts::IAxis::isEquidistant ( ) const
pure virtual

Returns whether the axis is equidistant.

Returns
bool is equidistant

Implemented in Acts::Axis< AxisType::Equidistant, bdt >, and Acts::Axis< AxisType::Variable, bdt >.

◆ isVariable()

virtual bool Acts::IAxis::isVariable ( ) const
pure virtual

Returns whether the axis is variable.

Returns
bool is variable

Implemented in Acts::Axis< AxisType::Equidistant, bdt >, and Acts::Axis< AxisType::Variable, bdt >.

◆ toStream()

virtual void Acts::IAxis::toStream ( std::ostream & os) const
protectedpure virtual

Dispatch to the correct stream operator.

Parameters
osoutput stream

Implemented in Acts::Axis< AxisType::Equidistant, bdt >, and Acts::Axis< AxisType::Variable, bdt >.

◆ visit()

template<typename callable_t>
decltype(auto) Acts::IAxis::visit ( const callable_t & callable) const

Helper function that dispatches from the IAxis base class to a concrete axis type.

It will call the provided callable with a const reference to the concrete axis type.

Template Parameters
callable_tthe callable type
Parameters
callablethe callable object
Returns
the value returned by the callable