ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Trk::BinnedArrayArray2D< T > Class Template Referencefinal

#include <BinnedArrayArray2D.h>

Inheritance diagram for Trk::BinnedArrayArray2D< T >:
Collaboration diagram for Trk::BinnedArrayArray2D< T >:

Public Member Functions

 BinnedArrayArray2D (std::vector< std::pair< BinnedArray2D< T >, Amg::Vector3D > > &&tbas, const BinUtility &bUtility)
 
virtual BinnedArrayArray2Dclone () const override
 Implicit constructor. More...
 
virtual T * object (const Amg::Vector2D &lp) const override
 Returns the pointer to the templated class object from the BinnedArrayArray2D. More...
 
virtual T * object (const Amg::Vector3D &gp) const override
 Returns the pointer to the templated class object from the BinnedArrayArray2D it returns nullptr if not defined, takes global position. More...
 
virtual T * entryObject (const Amg::Vector3D &gp) const override
 Returns the pointer to the templated class object from the BinnedArrayArray2D - entry point. More...
 
virtual T * nextObject (const Amg::Vector3D &gp, const Amg::Vector3D &, bool) const override
 Returns the pointer to the templated class object from the BinnedArrayArray2D, takes 3D position & direction. More...
 
virtual std::span< T *constarrayObjects () override final
 Return all objects of the Array non-const T. More...
 
virtual std::span< T const *constarrayObjects () const override final
 Return all objects of the Array const T. More...
 
virtual unsigned int arrayObjectsNumber () const override final
 Number of Entries in the Array. More...
 
virtual const BinUtilitybinUtility () const override
 Return the BinUtility. More...
 

Private Member Functions

void buildCache ()
 

Private Attributes

BinUtility m_binUtility {}
 
std::vector< BinnedArray2D< T > > m_binnedArrays {}
 
std::vector< T * > m_arrayObjects {}
 

Detailed Description

template<class T>
class Trk::BinnedArrayArray2D< T >

Definition at line 30 of file BinnedArrayArray2D.h.

Constructor & Destructor Documentation

◆ BinnedArrayArray2D()

template<class T >
Trk::BinnedArrayArray2D< T >::BinnedArrayArray2D ( std::vector< std::pair< BinnedArray2D< T >, Amg::Vector3D > > &&  tbas,
const BinUtility bUtility 
)
inline

Definition at line 35 of file BinnedArrayArray2D.h.

37  : m_binUtility(bUtility),
38  m_binnedArrays(bUtility.bins(0)),
39  m_arrayObjects() {
40  // looping over the contained binned arrays so as to flatten
41  for (auto& barray : tbas) {
42  // flat ordered binned array
43  auto index = m_binUtility.bin(barray.second, 0);
44  m_binnedArrays[index] = std::move(barray.first);
45  }
46  buildCache();
47  }

Member Function Documentation

◆ arrayObjects() [1/2]

template<class T >
virtual std::span<T const * const> Trk::BinnedArrayArray2D< T >::arrayObjects ( ) const
inlinefinaloverridevirtual

Return all objects of the Array const T.

Implements Trk::BinnedArray< T >.

Definition at line 100 of file BinnedArrayArray2D.h.

101  {
102  return std::span<T const* const>(m_arrayObjects.begin(), m_arrayObjects.end());
103  }

◆ arrayObjects() [2/2]

template<class T >
virtual std::span<T* const > Trk::BinnedArrayArray2D< T >::arrayObjects ( )
inlinefinaloverridevirtual

Return all objects of the Array non-const T.

Implements Trk::BinnedArray< T >.

Definition at line 94 of file BinnedArrayArray2D.h.

95  {
96  return std::span<T* const >(m_arrayObjects.begin(), m_arrayObjects.end());
97  }

◆ arrayObjectsNumber()

template<class T >
virtual unsigned int Trk::BinnedArrayArray2D< T >::arrayObjectsNumber ( ) const
inlinefinaloverridevirtual

Number of Entries in the Array.

Implements Trk::BinnedArray< T >.

Definition at line 106 of file BinnedArrayArray2D.h.

107  {
108  return m_arrayObjects.size();
109  };

◆ binUtility()

template<class T >
virtual const BinUtility* Trk::BinnedArrayArray2D< T >::binUtility ( ) const
inlineoverridevirtual

Return the BinUtility.

Implements Trk::BinnedArray< T >.

Definition at line 112 of file BinnedArrayArray2D.h.

112 { return &m_binUtility; }

◆ buildCache()

template<class T >
void Trk::BinnedArrayArray2D< T >::buildCache ( )
inlineprivate

Definition at line 116 of file BinnedArrayArray2D.h.

116  {
117  // flattened array object
118  size_t numArrrays = m_binnedArrays.size();
119  //reserve num of Bin Arrays times num of Bins
120  m_arrayObjects.reserve(numArrrays * m_binUtility.bins(0));
121  for (size_t index = 0; index <numArrrays; ++index) {
122  std::span<T* const> aObjects = m_binnedArrays[index].arrayObjects();
123  for (auto& o : aObjects) {
124  m_arrayObjects.push_back(o);
125  }
126  }
127  }

◆ clone()

template<class T >
virtual BinnedArrayArray2D* Trk::BinnedArrayArray2D< T >::clone ( ) const
inlineoverridevirtual

Implicit constructor.

Implements Trk::BinnedArray< T >.

Definition at line 50 of file BinnedArrayArray2D.h.

51  {
52  return new BinnedArrayArray2D(*this);
53  }

◆ entryObject()

template<class T >
virtual T* Trk::BinnedArrayArray2D< T >::entryObject ( const Amg::Vector3D gp) const
inlineoverridevirtual

Returns the pointer to the templated class object from the BinnedArrayArray2D - entry point.

Implements Trk::BinnedArray< T >.

Definition at line 79 of file BinnedArrayArray2D.h.

80  {
81  return object(gp);
82  }

◆ nextObject()

template<class T >
virtual T* Trk::BinnedArrayArray2D< T >::nextObject ( const Amg::Vector3D gp,
const Amg::Vector3D ,
bool   
) const
inlineoverridevirtual

Returns the pointer to the templated class object from the BinnedArrayArray2D, takes 3D position & direction.

Implements Trk::BinnedArray< T >.

Definition at line 86 of file BinnedArrayArray2D.h.

89  {
90  return object(gp);
91  }

◆ object() [1/2]

template<class T >
virtual T* Trk::BinnedArrayArray2D< T >::object ( const Amg::Vector2D lp) const
inlineoverridevirtual

Returns the pointer to the templated class object from the BinnedArrayArray2D.

It returns nullptr if not defined, takes local position

Implements Trk::BinnedArray< T >.

Definition at line 58 of file BinnedArrayArray2D.h.

58  {
59  if (m_binUtility.inside(lp)) {
60  const BinnedArray2D<T>& ba = m_binnedArrays[m_binUtility.bin(lp, 0)];
61  return ba.object(lp);
62  }
63  return nullptr;
64  }

◆ object() [2/2]

template<class T >
virtual T* Trk::BinnedArrayArray2D< T >::object ( const Amg::Vector3D gp) const
inlineoverridevirtual

Returns the pointer to the templated class object from the BinnedArrayArray2D it returns nullptr if not defined, takes global position.

Implements Trk::BinnedArray< T >.

Definition at line 68 of file BinnedArrayArray2D.h.

69  {
70  if (m_binUtility.inside(gp)) {
71  const BinnedArray2D<T>& ba = m_binnedArrays[m_binUtility.bin(gp, 0)];
72  return ba.object(gp);
73  }
74  return nullptr;
75  }

Member Data Documentation

◆ m_arrayObjects

template<class T >
std::vector<T*> Trk::BinnedArrayArray2D< T >::m_arrayObjects {}
private

Definition at line 133 of file BinnedArrayArray2D.h.

◆ m_binnedArrays

template<class T >
std::vector<BinnedArray2D<T> > Trk::BinnedArrayArray2D< T >::m_binnedArrays {}
private

Definition at line 130 of file BinnedArrayArray2D.h.

◆ m_binUtility

template<class T >
BinUtility Trk::BinnedArrayArray2D< T >::m_binUtility {}
private

Definition at line 129 of file BinnedArrayArray2D.h.


The documentation for this class was generated from the following file:
index
Definition: index.py:1
Trk::BinnedArrayArray2D::BinnedArrayArray2D
BinnedArrayArray2D(std::vector< std::pair< BinnedArray2D< T >, Amg::Vector3D > > &&tbas, const BinUtility &bUtility)
Definition: BinnedArrayArray2D.h:35
Trk::BinnedArrayArray2D::m_binnedArrays
std::vector< BinnedArray2D< T > > m_binnedArrays
Definition: BinnedArrayArray2D.h:130
Trk::BinUtility::bins
size_t bins(size_t ba=0) const
Number of bins.
Definition: BinUtility.h:221
Trk::BinnedArrayArray2D::m_arrayObjects
std::vector< T * > m_arrayObjects
Definition: BinnedArrayArray2D.h:133
Trk::BinnedArrayArray2D::object
virtual T * object(const Amg::Vector2D &lp) const override
Returns the pointer to the templated class object from the BinnedArrayArray2D.
Definition: BinnedArrayArray2D.h:58
Trk::BinUtility::inside
bool inside(const Amg::Vector3D &position) const
Check if bin is inside from Vector3D.
Definition: BinUtility.h:186
DeMoScan.index
string index
Definition: DeMoScan.py:362
Trk::BinnedArrayArray2D::m_binUtility
BinUtility m_binUtility
Definition: BinnedArrayArray2D.h:129
Trk::BinnedArrayArray2D::buildCache
void buildCache()
Definition: BinnedArrayArray2D.h:116
Trk::BinUtility::bin
size_t bin(const Amg::Vector3D &position, size_t ba=0) const
Bin from a 3D vector (already in binning frame)
Definition: BinUtility.h:126