File BinUtility.hpp

namespace Acts

Note

This file is foreseen for the Geometry module to replace Extent

Functions

std::ostream &operator<<(std::ostream &sl, const BinUtility &bgen)

Overload of << operator for std::ostream for debug output.

class BinUtility
#include <Acts/Utilities/BinUtility.hpp>

The BinUtility class that translated global and local position into a bins of a BinnedArray, most performant is equidistant binning without a transform, however, optionally a transform can be provided, e.g.

for binning on shifted object, the transform is usually shared with the geometric object the Array is defined on, for performance reasons, also the inverse transform is stored.

Public Functions

inline BinUtility()

Constructor for equidistant.

inline BinUtility(const Transform3 &tForm)

Constructor with only a Transform3.

Parameters

tForm – is the local to global transform

inline BinUtility(const BinningData &bData, const Transform3 &tForm = Transform3::Identity())

Constructor from BinningData directly.

Parameters
  • bData – is the provided binning data

  • tForm – is the (optional) transform

inline BinUtility(size_t bins, float min, float max, BinningOption opt = open, BinningValue value = binX, const Transform3 &tForm = Transform3::Identity())

Constructor for equidistant.

Parameters
  • bins – is the number of bins

  • min – in the minimal value

  • max – is the maximal value

  • opt – is the binning option : open, closed

  • value – is the binninb value : binX, binY, binZ, etc.

  • tForm – is the (optional) transform

inline BinUtility(std::vector<float> &bValues, BinningOption opt = open, BinningValue value = binPhi, const Transform3 &tForm = Transform3::Identity())

Constructor for arbitrary.

Parameters
  • bValues – is the boundary values of the binning

  • opt – is the binning option : open, closed

  • value – is the binninb value : binX, binY, binZ, etc.

  • tForm – is the (optional) transform

inline BinUtility(const BinUtility &sbu)

Copy constructor.

Parameters

sbu – is the source bin utility

~BinUtility() = default

Virtual Destructor.

inline size_t bin(const Vector3 &position, size_t ba = 0) const

Bin from a 3D vector (already in binning frame)

Parameters
  • position – is the 3D position to be evaluated

  • ba – is the bin dimension

Returns

is the bin value

inline size_t bin(const Vector2 &lposition, size_t ba = 0) const

Bin from a 2D vector (following local parameters defintitions)

  • no optional transform applied

  • USE WITH CARE !!

You need to make sure that the local position is actually in the binning frame of the BinUtility

Parameters
  • lposition – is the local position to be set

  • ba – is the bin dimension

Returns

bin calculated from local

inline const std::vector<BinningData> &binningData() const

Return the binning data vector.

inline BinningValue binningValue(size_t ba = 0) const

The type/value of the binning.

Parameters

ba – is the binaccessor

Returns

the binning value of the accessor entry

inline size_t bins() const

Return the total number of bins.

inline size_t bins(size_t ba) const

Number of bins.

Parameters

ba – is the binaccessor

Returns

size_t is the bins of the accessor entry

inline std::array<size_t, 3> binTriple(const Vector3 &position) const

Bin-triple fast access.

  • calculate the bin triple with one transform

Parameters

position – is the 3D position to be evaluated

Returns

is the bin value in 3D

inline size_t dimensions() const

First bin maximal value.

Returns

the dimenstion of the binning data

inline bool inside(const Vector3 &position) const

Check if bin is inside from Vector2 - optional transform applied.

Parameters

position – is the global position to be evaluated

Returns

is a boolean check

inline bool inside(const Vector2 &lposition) const

Check if bin is inside from Vector2 - no optional transform applied.

Parameters

lposition – is the local position to be evaluated

Returns

is a boolean check

inline size_t max(size_t ba = 0) const

First bin maximal value.

Parameters

ba – is the binaccessor

Returns

size_t is the maximal bin of the accessor entry

inline int nextDirection(const Vector3 &position, const Vector3 &direction, size_t ba = 0) const

Return the oder direction for fast interlinking.

Parameters
  • position – is the global position for the next search

  • direction – is the global position for the next search

  • ba – is the bin accessor

Returns

the next bin

inline BinUtility &operator+=(const BinUtility &gbu)

Operator+= to make multidimensional BinUtility.

Parameters

gbu – is the additional BinUtility to be chosen

inline BinUtility &operator=(const BinUtility &sbu)

Assignment operator.

Parameters

sbu – is the source bin utility

inline bool operator==(const BinUtility &other) const

Equality operator.

inline size_t serialize(const std::array<size_t, 3> &bin) const

Serialize the bin triple.

  • this creates a simple size_t from a triple object

Parameters

bin – is the bin to be serialized

inline std::ostream &toStream(std::ostream &sl) const

Output Method for std::ostream, to be overloaded by child classes.

Parameters

sl – is the ostream to be dumped into

inline const Transform3 &transform() const

Transform applied to global positions before lookup.

Returns

Shared pointer to transform

Private Members

std::vector<BinningData> m_binningData
Transform3 m_itransform

shared transform

Transform3 m_transform

vector of BinningData