ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::CompactBinnedArray2D< T > Class Template Referencefinal

2-dimensional binned array More...

#include <CompactBinnedArray2D.h>

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

Public Member Functions

 CompactBinnedArray2D (const std::vector< T * > &tclassvector, const std::vector< std::vector< size_t > > &indexarray, const BinUtility &bingen, const std::vector< Trk::BinUtility > &bVec)
 Constructor with arguments.
 CompactBinnedArray2D (const std::vector< T * > &tclassvector, std::vector< std::vector< size_t > > &&indexarray, BinUtility &&bingen, std::vector< Trk::BinUtility > &&bVec)
CompactBinnedArray2Dclone () const
 Implicit Constructor.
CompactBinnedArray2Dclone (const std::vector< T * > &ptrs) const
T * object (const Amg::Vector2D &lp) const
 Returns the pointer to the templated class object from the BinnedArray, it returns nullptr if not defined;.
T * object (const Amg::Vector3D &gp) const
 Returns the pointer to the templated class object from the BinnedArray it returns nullptr if not defined;.
T * entryObject (const Amg::Vector3D &gp) const
 Returns the pointer to the templated class object from the BinnedArray - entry point.
T * nextObject (const Amg::Vector3D &gp, const Amg::Vector3D &mom, bool associatedResult=true) const
 Returns the pointer to the templated class object from the BinnedArray.
std::span< T *const > arrayObjects ()
 Return all objects of the Array.
std::span< T const *const > arrayObjects () const
 Return all objects of the Array const T.
unsigned int arrayObjectsNumber () const
 Number of Entries in the Array.
const BinUtilitybinUtility () const
 Return the BinUtility.
const BinUtilitylayerBinUtility (const Amg::Vector3D &pos) const
 Return the BinUtility.
size_t layerBin (const Amg::Vector3D &pos) const
 Return the layer bin.

Private Attributes

std::vector< std::vector< size_t > > m_array {}
 vector of indices to objects
std::vector< T * > m_arrayObjects {}
 objects
BinUtility m_binUtility {}
 binUtility
std::vector< BinUtilitym_buVec {}
 vector of bin utilities for 2nd dim

Detailed Description

template<class T>
class Trk::CompactBinnedArray2D< T >

2-dimensional binned array

Author
sarka.nosp@m..tod.nosp@m.orova.nosp@m.@cer.nosp@m.n.ch
Christos Anastopoulos (Athena MT modifications)

Definition at line 31 of file CompactBinnedArray2D.h.

Constructor & Destructor Documentation

◆ CompactBinnedArray2D() [1/2]

template<class T>
Trk::CompactBinnedArray2D< T >::CompactBinnedArray2D ( const std::vector< T * > & tclassvector,
const std::vector< std::vector< size_t > > & indexarray,
const BinUtility & bingen,
const std::vector< Trk::BinUtility > & bVec )
inline

Constructor with arguments.

Note that we do not take ownership of the pointers

Definition at line 39 of file CompactBinnedArray2D.h.

47 m_buVec(bVec) {}
2-dimensional binned array
std::vector< BinUtility > m_buVec
vector of bin utilities for 2nd dim
std::vector< std::vector< size_t > > m_array
vector of indices to objects
std::vector< T * > m_arrayObjects
objects
BinUtility m_binUtility
binUtility

◆ CompactBinnedArray2D() [2/2]

template<class T>
Trk::CompactBinnedArray2D< T >::CompactBinnedArray2D ( const std::vector< T * > & tclassvector,
std::vector< std::vector< size_t > > && indexarray,
BinUtility && bingen,
std::vector< Trk::BinUtility > && bVec )
inline

Member Function Documentation

◆ arrayObjects() [1/2]

template<class T>
std::span< T *const > Trk::CompactBinnedArray2D< T >::arrayObjects ( )
inlinevirtual

Return all objects of the Array.

Implements Trk::BinnedArray< T >.

Definition at line 129 of file CompactBinnedArray2D.h.

130 {
132 }

◆ arrayObjects() [2/2]

template<class T>
std::span< T const *const > Trk::CompactBinnedArray2D< T >::arrayObjects ( ) const
inlinevirtual

Return all objects of the Array const T.

Implements Trk::BinnedArray< T >.

Definition at line 136 of file CompactBinnedArray2D.h.

137 {
139 }

◆ arrayObjectsNumber()

template<class T>
unsigned int Trk::CompactBinnedArray2D< T >::arrayObjectsNumber ( ) const
inlinevirtual

Number of Entries in the Array.

Implements Trk::BinnedArray< T >.

Definition at line 142 of file CompactBinnedArray2D.h.

142{ return m_arrayObjects.size(); }

◆ binUtility()

template<class T>
const BinUtility * Trk::CompactBinnedArray2D< T >::binUtility ( ) const
inlinevirtual

Return the BinUtility.

Implements Trk::BinnedArray< T >.

Definition at line 145 of file CompactBinnedArray2D.h.

145{ return &m_binUtility; }

◆ clone() [1/2]

template<class T>
CompactBinnedArray2D * Trk::CompactBinnedArray2D< T >::clone ( ) const
inlinevirtual

Implicit Constructor.

Implements Trk::CompactBinnedArray< T >.

Definition at line 60 of file CompactBinnedArray2D.h.

61 {
63 }
CompactBinnedArray2D(const std::vector< T * > &tclassvector, const std::vector< std::vector< size_t > > &indexarray, const BinUtility &bingen, const std::vector< Trk::BinUtility > &bVec)
Constructor with arguments.

◆ clone() [2/2]

template<class T>
CompactBinnedArray2D * Trk::CompactBinnedArray2D< T >::clone ( const std::vector< T * > & ptrs) const
inlinevirtual

Implements Trk::CompactBinnedArray< T >.

Definition at line 65 of file CompactBinnedArray2D.h.

66 {
67 assert(ptrs.size() == m_arrayObjects.size());
69 }

◆ entryObject()

template<class T>
T * Trk::CompactBinnedArray2D< T >::entryObject ( const Amg::Vector3D & gp) const
inlinevirtual

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

Implements Trk::BinnedArray< T >.

Definition at line 96 of file CompactBinnedArray2D.h.

97 {
98 size_t bin = m_binUtility.bin(gp);
99 size_t biNext = m_binUtility.entry(gp, 0);
101 }

◆ layerBin()

template<class T>
size_t Trk::CompactBinnedArray2D< T >::layerBin ( const Amg::Vector3D & pos) const
inlinevirtual

Return the layer bin.

Implements Trk::CompactBinnedArray< T >.

Definition at line 154 of file CompactBinnedArray2D.h.

155 {
156 return (layerBinUtility(pos)->bin(pos));
157 }
const BinUtility * layerBinUtility(const Amg::Vector3D &pos) const
Return the BinUtility.

◆ layerBinUtility()

template<class T>
const BinUtility * Trk::CompactBinnedArray2D< T >::layerBinUtility ( const Amg::Vector3D & pos) const
inlinevirtual

Return the BinUtility.

Implements Trk::CompactBinnedArray< T >.

Definition at line 148 of file CompactBinnedArray2D.h.

149 {
150 return &(m_buVec[m_binUtility.bin(pos)]);
151 }

◆ nextObject()

template<class T>
T * Trk::CompactBinnedArray2D< T >::nextObject ( const Amg::Vector3D & gp,
const Amg::Vector3D & mom,
bool associatedResult = true ) const
inlinevirtual

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

Implements Trk::BinnedArray< T >.

Definition at line 105 of file CompactBinnedArray2D.h.

108 {
109 // search in layer utility only
110 size_t bin = m_binUtility.bin(gp, 0);
111 size_t binSub = m_buVec[bin].next(gp, mom, 0);
112 if (associatedResult) {
114 }
115 // evaluate distance
116 std::pair<int, float> ds = m_binUtility.distanceToNext(gp, mom, 0);
117 std::pair<int, float> dl = m_buVec[bin].distanceToNext(gp, mom, 0);
118 // the bins
119 if (dl.second < ds.second){
121 }
122 bin = m_binUtility.next(gp, mom, 0);
123 Amg::Vector3D probe = gp + (ds.second) * mom.normalized();
124 binSub = m_buVec[bin].bin(probe, 0);
126 }

◆ object() [1/2]

template<class T>
T * Trk::CompactBinnedArray2D< T >::object ( const Amg::Vector2D & lp) const
inlinevirtual

Returns the pointer to the templated class object from the BinnedArray, it returns nullptr if not defined;.

Implements Trk::BinnedArray< T >.

Definition at line 74 of file CompactBinnedArray2D.h.

75 {
76 if (m_binUtility.inside(lp)) {
77 size_t bin = m_binUtility.bin(lp, 0);
78 if (m_buVec[bin].inside(lp))
79 return m_arrayObjects[m_array[bin][m_buVec[bin].bin(lp, 0)]];
80 }
81 return nullptr;
82 }

◆ object() [2/2]

template<class T>
T * Trk::CompactBinnedArray2D< T >::object ( const Amg::Vector3D & gp) const
inlinevirtual

Returns the pointer to the templated class object from the BinnedArray it returns nullptr if not defined;.

Implements Trk::BinnedArray< T >.

Definition at line 87 of file CompactBinnedArray2D.h.

88 {
89 size_t bin = m_binUtility.bin(gp);
90 size_t index = m_array[bin][m_buVec[bin].bin(gp, 0)];
91 return m_arrayObjects[index];
92 }

Member Data Documentation

◆ m_array

template<class T>
std::vector<std::vector<size_t> > Trk::CompactBinnedArray2D< T >::m_array {}
private

vector of indices to objects

Definition at line 160 of file CompactBinnedArray2D.h.

160{};

◆ m_arrayObjects

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

objects

Definition at line 161 of file CompactBinnedArray2D.h.

161{};

◆ m_binUtility

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

binUtility

Definition at line 162 of file CompactBinnedArray2D.h.

162{};

◆ m_buVec

template<class T>
std::vector<BinUtility> Trk::CompactBinnedArray2D< T >::m_buVec {}
private

vector of bin utilities for 2nd dim

Definition at line 163 of file CompactBinnedArray2D.h.

163{};

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