EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Acts::detail::Axis< AxisType::Variable, bdt > Exception Template Referencefinal

calculate bin indices for a variable binning More...

#include <acts/blob/sPHENIX/Core/include/Acts/Utilities/detail/Axis.hpp>

+ Inheritance diagram for Acts::detail::Axis< AxisType::Variable, bdt >:
+ Collaboration diagram for Acts::detail::Axis< AxisType::Variable, bdt >:

Public Member Functions

 Axis (std::vector< double > binEdges)
 default constructor
 
bool isEquidistant () const override
 returns whether the axis is equidistante
 
bool isVariable () const override
 returns whether the axis is variable
 
AxisBoundaryType getBoundaryType () const override
 returns the boundary type set in the template param
 
NeighborHoodIndices neighborHoodIndices (size_t idx, size_t size=1) const
 Get #size bins which neighbor the one given.
 
template<AxisBoundaryType T = bdt, std::enable_if_t< T==AxisBoundaryType::Open, int > = 0>
NeighborHoodIndices neighborHoodIndices (size_t idx, std::pair< size_t, size_t > sizes={1, 1}) const
 Get #size bins which neighbor the one given.
 
template<AxisBoundaryType T = bdt, std::enable_if_t< T==AxisBoundaryType::Bound, int > = 0>
NeighborHoodIndices neighborHoodIndices (size_t idx, std::pair< size_t, size_t > sizes={1, 1}) const
 Get #size bins which neighbor the one given.
 
template<AxisBoundaryType T = bdt, std::enable_if_t< T==AxisBoundaryType::Closed, int > = 0>
NeighborHoodIndices neighborHoodIndices (size_t idx, std::pair< size_t, size_t > sizes={1, 1}) const
 Get #size bins which neighbor the one given.
 
template<AxisBoundaryType T = bdt, std::enable_if_t< T==AxisBoundaryType::Open, int > = 0>
size_t wrapBin (int bin) const
 Converts bin index into a valid one for this axis.
 
template<AxisBoundaryType T = bdt, std::enable_if_t< T==AxisBoundaryType::Bound, int > = 0>
size_t wrapBin (int bin) const
 Converts bin index into a valid one for this axis.
 
template<AxisBoundaryType T = bdt, std::enable_if_t< T==AxisBoundaryType::Closed, int > = 0>
size_t wrapBin (int bin) const
 Converts bin index into a valid one for this axis.
 
size_t getBin (double x) const
 get corresponding bin index for given coordinate
 
double getBinWidth (size_t bin) const
 get bin width
 
double getBinLowerBound (size_t bin) const
 get lower bound of bin
 
double getBinUpperBound (size_t bin) const
 get upper bound of bin
 
double getBinCenter (size_t bin) const
 get bin center
 
double getMax () const override
 get maximum of binning range
 
double getMin () const override
 get minimum of binning range
 
size_t getNBins () const override
 get total number of bins
 
bool isInside (double x) const
 check whether value is inside axis limits
 
std::vector< double > getBinEdges () const override
 Return a vector of bin edges.
 

Private Attributes

std::vector< double > m_binEdges
 vector of bin edges (sorted in ascending order)
 

Detailed Description

template<AxisBoundaryType bdt>
exception Acts::detail::Axis< AxisType::Variable, bdt >

calculate bin indices for a variable binning

This class provides some basic functionality for calculating bin indices for a given binning with variable bin sizes.

Definition at line 383 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 383 of file Axis.hpp

Constructor & Destructor Documentation

template<AxisBoundaryType bdt>
Acts::detail::Axis< AxisType::Variable, bdt >::Axis ( std::vector< double >  binEdges)
inline

default constructor

Parameters
[in]binEdgesvector of bin edges
Precondition
binEdges must be strictly sorted in ascending order.
binEdges must contain at least two entries.

Create a binning structure with nBins variable-sized bins from the given bin boundaries. nBins is given by the number of bin edges reduced by one.

Definition at line 394 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 394 of file Axis.hpp

Member Function Documentation

template<AxisBoundaryType bdt>
size_t Acts::detail::Axis< AxisType::Variable, bdt >::getBin ( double  x) const
inline

get corresponding bin index for given coordinate

Parameters
[in]xinput coordinate
Returns
index of bin containing the given value
Note
Bin intervals are defined with closed lower bounds and open upper bounds, that is $l <= x < u$ if the value x lies within a bin with lower bound l and upper bound u.
Bin indices start at 1. The underflow bin has the index 0 while the index nBins + 1 indicates the overflow bin .

Definition at line 561 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 561 of file Axis.hpp

References it.

template<AxisBoundaryType bdt>
double Acts::detail::Axis< AxisType::Variable, bdt >::getBinCenter ( size_t  bin) const
inline

get bin center

Parameters
[in]binindex of bin
Returns
bin center position
Precondition
bin must be a valid bin index (excluding under-/overflow bins), i.e. $1 \le \text{bin} \le \text{nBins}$

Definition at line 609 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 609 of file Axis.hpp

template<AxisBoundaryType bdt>
std::vector<double> Acts::detail::Axis< AxisType::Variable, bdt >::getBinEdges ( ) const
inlineoverridevirtual

Return a vector of bin edges.

Returns
Vector which contains the bin edges

Implements Acts::IAxis.

Definition at line 641 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 641 of file Axis.hpp

template<AxisBoundaryType bdt>
double Acts::detail::Axis< AxisType::Variable, bdt >::getBinLowerBound ( size_t  bin) const
inline

get lower bound of bin

Parameters
[in]binindex of bin
Returns
lower bin boundary
Precondition
bin must be a valid bin index (excluding the underflow bin), i.e. $1 \le \text{bin} \le \text{nBins} + 1$
Note
Bin intervals have a closed lower bound, i.e. the lower boundary belongs to the bin with the given bin index.

Definition at line 588 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 588 of file Axis.hpp

template<AxisBoundaryType bdt>
double Acts::detail::Axis< AxisType::Variable, bdt >::getBinUpperBound ( size_t  bin) const
inline

get upper bound of bin

Parameters
[in]binindex of bin
Returns
upper bin boundary
Precondition
bin must be a valid bin index (excluding the overflow bin), i.e. $0 \le \text{bin} \le \text{nBins}$
Note
Bin intervals have an open upper bound, i.e. the upper boundary does not belong to the bin with the given bin index.

Definition at line 600 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 600 of file Axis.hpp

template<AxisBoundaryType bdt>
double Acts::detail::Axis< AxisType::Variable, bdt >::getBinWidth ( size_t  bin) const
inline

get bin width

Parameters
[in]binindex of bin
Returns
width of given bin
Precondition
bin must be a valid bin index (excluding under-/overflow bins), i.e. $1 \le \text{bin} \le \text{nBins}$

Definition at line 574 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 574 of file Axis.hpp

template<AxisBoundaryType bdt>
AxisBoundaryType Acts::detail::Axis< AxisType::Variable, bdt >::getBoundaryType ( ) const
inlineoverridevirtual

returns the boundary type set in the template param

Returns
AxisBoundaryType of this axis

Implements Acts::IAxis.

Definition at line 409 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 409 of file Axis.hpp

template<AxisBoundaryType bdt>
double Acts::detail::Axis< AxisType::Variable, bdt >::getMax ( ) const
inlineoverridevirtual

get maximum of binning range

Returns
maximum of binning range

Implements Acts::IAxis.

Definition at line 616 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 616 of file Axis.hpp

template<AxisBoundaryType bdt>
double Acts::detail::Axis< AxisType::Variable, bdt >::getMin ( ) const
inlineoverridevirtual

get minimum of binning range

Returns
minimum of binning range

Implements Acts::IAxis.

Definition at line 621 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 621 of file Axis.hpp

template<AxisBoundaryType bdt>
size_t Acts::detail::Axis< AxisType::Variable, bdt >::getNBins ( ) const
inlineoverridevirtual

get total number of bins

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

Implements Acts::IAxis.

Definition at line 626 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 626 of file Axis.hpp

template<AxisBoundaryType bdt>
bool Acts::detail::Axis< AxisType::Variable, bdt >::isEquidistant ( ) const
inlineoverridevirtual

returns whether the axis is equidistante

Returns
bool is equidistant

Implements Acts::IAxis.

Definition at line 399 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 399 of file Axis.hpp

template<AxisBoundaryType bdt>
bool Acts::detail::Axis< AxisType::Variable, bdt >::isInside ( double  x) const
inline

check whether value is inside axis limits

Returns
true if $\text{xmin} \le x < \text{xmax}$, otherwise false
Postcondition
If true is returned, the bin containing the given value is a valid bin, i.e. it is neither the underflow nor the overflow bin.

Definition at line 635 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 635 of file Axis.hpp

References x.

template<AxisBoundaryType bdt>
bool Acts::detail::Axis< AxisType::Variable, bdt >::isVariable ( ) const
inlineoverridevirtual

returns whether the axis is variable

Returns
bool is variable

Implements Acts::IAxis.

Definition at line 404 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 404 of file Axis.hpp

template<AxisBoundaryType bdt>
NeighborHoodIndices Acts::detail::Axis< AxisType::Variable, bdt >::neighborHoodIndices ( size_t  idx,
size_t  size = 1 
) const
inline

Get #size bins which neighbor the one given.

Generic overload with symmetric size

Parameters
[in]idxrequested bin index
[in]sizehow many neighboring bins
Returns
Set of neighboring bin indices (global)

Definition at line 418 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 418 of file Axis.hpp

template<AxisBoundaryType bdt>
template<AxisBoundaryType T = bdt, std::enable_if_t< T==AxisBoundaryType::Open, int > = 0>
NeighborHoodIndices Acts::detail::Axis< AxisType::Variable, bdt >::neighborHoodIndices ( size_t  idx,
std::pair< size_t, size_t >  sizes = { 1, 1} 
) const
inline

Get #size bins which neighbor the one given.

This is the version for Open

Parameters
[in]idxrequested bin index
[in]sizeshow many neighboring bins (up/down)
Returns
Set of neighboring bin indices (global)
Note
Open varies given bin and allows 0 and NBins+1 (underflow, overflow) as neighbors

Definition at line 434 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 434 of file Axis.hpp

template<AxisBoundaryType bdt>
template<AxisBoundaryType T = bdt, std::enable_if_t< T==AxisBoundaryType::Bound, int > = 0>
NeighborHoodIndices Acts::detail::Axis< AxisType::Variable, bdt >::neighborHoodIndices ( size_t  idx,
std::pair< size_t, size_t >  sizes = { 1, 1} 
) const
inline

Get #size bins which neighbor the one given.

This is the version for Bound

Parameters
[in]idxrequested bin index
[in]sizeshow many neighboring bins (up/down)
Returns
Set of neighboring bin indices (global)
Note
Bound varies given bin and allows 1 and NBins (regular bins) as neighbors

Definition at line 455 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 455 of file Axis.hpp

template<AxisBoundaryType bdt>
template<AxisBoundaryType T = bdt, std::enable_if_t< T==AxisBoundaryType::Closed, int > = 0>
NeighborHoodIndices Acts::detail::Axis< AxisType::Variable, bdt >::neighborHoodIndices ( size_t  idx,
std::pair< size_t, size_t >  sizes = { 1, 1} 
) const
inline

Get #size bins which neighbor the one given.

This is the version for Closed

Parameters
[in]idxrequested bin index
[in]sizeshow many neighboring bins (up/down)
Returns
Set of neighboring bin indices (global)
Note
Closed varies given bin and allows bins on the opposite side of the axis as neighbors. (excludes underflow / overflow)

Definition at line 479 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 479 of file Axis.hpp

template<AxisBoundaryType bdt>
template<AxisBoundaryType T = bdt, std::enable_if_t< T==AxisBoundaryType::Open, int > = 0>
size_t Acts::detail::Axis< AxisType::Variable, bdt >::wrapBin ( int  bin) const
inline

Converts bin index into a valid one for this axis.

Note
Open: bin index is clamped to [0, nBins+1]
Parameters
[in]binThe bin to wrap
Returns
valid bin index

Definition at line 521 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 521 of file Axis.hpp

References max, and min.

template<AxisBoundaryType bdt>
template<AxisBoundaryType T = bdt, std::enable_if_t< T==AxisBoundaryType::Bound, int > = 0>
size_t Acts::detail::Axis< AxisType::Variable, bdt >::wrapBin ( int  bin) const
inline

Converts bin index into a valid one for this axis.

Note
Bound: bin index is clamped to [1, nBins]
Parameters
[in]binThe bin to wrap
Returns
valid bin index

Definition at line 533 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 533 of file Axis.hpp

References max, and min.

template<AxisBoundaryType bdt>
template<AxisBoundaryType T = bdt, std::enable_if_t< T==AxisBoundaryType::Closed, int > = 0>
size_t Acts::detail::Axis< AxisType::Variable, bdt >::wrapBin ( int  bin) const
inline

Converts bin index into a valid one for this axis.

Note
Closed: bin index wraps around to other side
Parameters
[in]binThe bin to wrap
Returns
valid bin index

Definition at line 545 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 545 of file Axis.hpp

Member Data Documentation

template<AxisBoundaryType bdt>
std::vector<double> Acts::detail::Axis< AxisType::Variable, bdt >::m_binEdges
private

vector of bin edges (sorted in ascending order)

Definition at line 645 of file Axis.hpp.

View newest version in sPHENIX GitHub at line 645 of file Axis.hpp


The documentation for this exception was generated from the following file: