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

Avoiding a map search, the templated BinnedArray class can help ordering geometrical objects by providing a dedicated BinUtility. More...

#include <BinnedArray1D1D1D.h>

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

Public Member Functions

 BinnedArray1D1D1D ()=default
 BinnedArray1D1D1D (BinnedArray1D1D1D &&)=default
BinnedArray1D1D1Doperator= (BinnedArray1D1D1D &&)=default
 ~BinnedArray1D1D1D ()=default
 BinnedArray1D1D1D (const std::vector< std::pair< std::shared_ptr< T >, Amg::Vector3D > > &tclassvector, const BinUtility &binUtil1, const BinUtility &binUtil2, const std::vector< std::vector< BinUtility > > &binUtilVec)
 ctors
 BinnedArray1D1D1D (const std::vector< std::pair< std::shared_ptr< T >, Amg::Vector3D > > &tclassvector, BinUtility &&binUtil1, BinUtility &&binUtil2, std::vector< std::vector< BinUtility > > &&binUtilVec)
 BinnedArray1D1D1D (const BinnedArray1D1D1D &barr)
 Copy.
BinnedArray1D1D1Doperator= (const BinnedArray1D1D1D &barr)
 Assignment operator.
BinnedArray1D1D1Dclone () const
 Implicit Constructor.
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 &, const Amg::Vector3D &, bool) const
 Returns the pointer to the templated class object from the BinnedArray dummy for multidimensional arrays.
std::span< T *const > arrayObjects ()
 Return all objects of the Array const T.
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 - returns the first binUtility in this case.

Private Member Functions

void createArrayCache () const
void initialize (const std::vector< std::pair< std::shared_ptr< T >, Amg::Vector3D > > &tclassvector)
 vector of pointers to the class T

Private Attributes

std::vector< std::vector< std::vector< std::shared_ptr< T > > > > m_array {}
 1D cache of non owning pointers to class T
CxxUtils::CachedUniquePtr< std::vector< T * > > m_arrayObjects {nullptr}
BinUtility m_binUtil1 {}
 binUtility for retrieving and filling the Array
BinUtility m_binUtil2 {}
 binUtility for retrieving and filling the Array
std::vector< std::vector< BinUtility > > m_binUtilArray {}

Detailed Description

template<class T>
class Trk::BinnedArray1D1D1D< T >

Avoiding a map search, the templated BinnedArray class can help ordering geometrical objects by providing a dedicated BinUtility.

dedicated for 3-dim (non-eq) binning ; allows variable binning in 1 coordinate

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

Definition at line 36 of file BinnedArray1D1D1D.h.

Constructor & Destructor Documentation

◆ BinnedArray1D1D1D() [1/5]

template<class T>
Trk::BinnedArray1D1D1D< T >::BinnedArray1D1D1D ( )
default

◆ BinnedArray1D1D1D() [2/5]

template<class T>
Trk::BinnedArray1D1D1D< T >::BinnedArray1D1D1D ( BinnedArray1D1D1D< T > && )
default

◆ ~BinnedArray1D1D1D()

template<class T>
Trk::BinnedArray1D1D1D< T >::~BinnedArray1D1D1D ( )
default

◆ BinnedArray1D1D1D() [3/5]

template<class T>
Trk::BinnedArray1D1D1D< T >::BinnedArray1D1D1D ( const std::vector< std::pair< std::shared_ptr< T >, Amg::Vector3D > > & tclassvector,
const BinUtility & binUtil1,
const BinUtility & binUtil2,
const std::vector< std::vector< BinUtility > > & binUtilVec )
inline

ctors

Definition at line 46 of file BinnedArray1D1D1D.h.

51 m_array{},
52 m_arrayObjects(nullptr),
57 }
Avoiding a map search, the templated BinnedArray class can help ordering geometrical objects by provi...
BinUtility m_binUtil2
binUtility for retrieving and filling the Array
std::vector< std::vector< std::vector< std::shared_ptr< T > > > > m_array
1D cache of non owning pointers to class T
CxxUtils::CachedUniquePtr< std::vector< T * > > m_arrayObjects
BinUtility m_binUtil1
binUtility for retrieving and filling the Array
std::vector< std::vector< BinUtility > > m_binUtilArray
BinnedArray()=default
void initialize()

◆ BinnedArray1D1D1D() [4/5]

template<class T>
Trk::BinnedArray1D1D1D< T >::BinnedArray1D1D1D ( const std::vector< std::pair< std::shared_ptr< T >, Amg::Vector3D > > & tclassvector,
BinUtility && binUtil1,
BinUtility && binUtil2,
std::vector< std::vector< BinUtility > > && binUtilVec )
inline

◆ BinnedArray1D1D1D() [5/5]

template<class T>
Trk::BinnedArray1D1D1D< T >::BinnedArray1D1D1D ( const BinnedArray1D1D1D< T > & barr)
inline

Member Function Documentation

◆ arrayObjects() [1/2]

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

Return all objects of the Array const T.

Implements Trk::BinnedArray< T >.

Definition at line 152 of file BinnedArray1D1D1D.h.

153 {
155 return std::span<T* const>(m_arrayObjects->begin(), m_arrayObjects->end());
156 }

◆ arrayObjects() [2/2]

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

Return all objects of the Array const T.

Implements Trk::BinnedArray< T >.

Definition at line 159 of file BinnedArray1D1D1D.h.

160 {
163 }

◆ arrayObjectsNumber()

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

Number of Entries in the Array.

Implements Trk::BinnedArray< T >.

Definition at line 166 of file BinnedArray1D1D1D.h.

166{ return arrayObjects().size(); }
std::span< T *const > arrayObjects()
Return all objects of the Array const T.

◆ binUtility()

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

Return the BinUtility - returns the first binUtility in this case.

Implements Trk::BinnedArray< T >.

Definition at line 169 of file BinnedArray1D1D1D.h.

169{ return &m_binUtil1; }

◆ clone()

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

Implicit Constructor.

Implements Trk::BinnedArray< T >.

Definition at line 94 of file BinnedArray1D1D1D.h.

94{ return new BinnedArray1D1D1D(*this); }

◆ createArrayCache()

template<class T>
void Trk::BinnedArray1D1D1D< T >::createArrayCache ( ) const
inlineprivate

Definition at line 172 of file BinnedArray1D1D1D.h.

172 {
173 if (!m_arrayObjects) {
175 for (size_t ibin1 = 0; ibin1 < m_binUtil1.bins(); ++ibin1) {
176 for (size_t ibin2 = 0; ibin2 < m_binUtil2.bins(); ++ibin2) {
177 for (size_t ibin3 = 0; ibin3 < std::as_const(m_binUtilArray)[ibin1][ibin2].bins(); ++ibin3) {
178 arrayObjects->push_back((m_array[ibin1][ibin2][ibin3]).get());
179 }
180 }
181 }
183 }
184 }
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:130

◆ entryObject()

template<class T>
T * Trk::BinnedArray1D1D1D< 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 136 of file BinnedArray1D1D1D.h.

137 {
138 int bin1 = m_binUtil1.entry(gp, 0);
139 int bin2 = m_binUtil2.entry(gp, 0);
140 int bin3 = std::as_const(m_binUtilArray)[bin1][bin2].entry(gp, 0);
141 return (m_array[bin1][bin2][bin3]).get();
142 }

◆ initialize()

template<class T>
void Trk::BinnedArray1D1D1D< T >::initialize ( const std::vector< std::pair< std::shared_ptr< T >, Amg::Vector3D > > & tclassvector)
inlineprivate

vector of pointers to the class T

Definition at line 186 of file BinnedArray1D1D1D.h.

◆ nextObject()

template<class T>
T * Trk::BinnedArray1D1D1D< T >::nextObject ( const Amg::Vector3D & ,
const Amg::Vector3D & ,
bool  ) const
inlinevirtual

Returns the pointer to the templated class object from the BinnedArray dummy for multidimensional arrays.

Implements Trk::BinnedArray< T >.

Definition at line 146 of file BinnedArray1D1D1D.h.

147 {
148 return nullptr;
149 }

◆ object() [1/2]

template<class T>
T * Trk::BinnedArray1D1D1D< 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 99 of file BinnedArray1D1D1D.h.

100 {
101 if (!m_binUtil1.inside(lp) || !m_binUtil2.inside(lp)){
102 return nullptr;
103 }
104 int bin1 = m_binUtil1.bin(lp);
105 int bin2 = m_binUtil2.bin(lp);
107 return nullptr;
108 }
110
111 return (m_array[bin1][bin2][bin3]).get();
112 }

◆ object() [2/2]

template<class T>
T * Trk::BinnedArray1D1D1D< 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 117 of file BinnedArray1D1D1D.h.

118 {
119 if (!m_binUtil1.inside(gp) || !m_binUtil2.inside(gp)){
120 return nullptr;
121 }
122 int bin1 = m_binUtil1.bin(gp);
123 int bin2 = m_binUtil2.bin(gp);
125 return nullptr;
126 }
127 unsigned int bin3 = std::as_const(m_binUtilArray)[bin1][bin2].bin(gp);
129 return nullptr;
130 }
131 return (m_array[bin1][bin2][bin3]).get();
132 }
static const std::vector< std::string > bins

◆ operator=() [1/2]

template<class T>
BinnedArray1D1D1D & Trk::BinnedArray1D1D1D< T >::operator= ( BinnedArray1D1D1D< T > && )
default

◆ operator=() [2/2]

template<class T>
BinnedArray1D1D1D & Trk::BinnedArray1D1D1D< T >::operator= ( const BinnedArray1D1D1D< T > & barr)
inline

Assignment operator.

Definition at line 82 of file BinnedArray1D1D1D.h.

82 {
83 if (this != &barr) {
84 // bin utilities
89 m_arrayObjects.release();
90 }
91 return *this;
92 }

Member Data Documentation

◆ m_array

template<class T>
std::vector<std::vector<std::vector<std::shared_ptr<T> > > > Trk::BinnedArray1D1D1D< T >::m_array {}
private

1D cache of non owning pointers to class T

Definition at line 214 of file BinnedArray1D1D1D.h.

214{};

◆ m_arrayObjects

template<class T>
CxxUtils::CachedUniquePtr<std::vector<T*> > Trk::BinnedArray1D1D1D< T >::m_arrayObjects {nullptr}
private

Definition at line 216 of file BinnedArray1D1D1D.h.

216{nullptr};

◆ m_binUtil1

template<class T>
BinUtility Trk::BinnedArray1D1D1D< T >::m_binUtil1 {}
private

binUtility for retrieving and filling the Array

Definition at line 217 of file BinnedArray1D1D1D.h.

217{};

◆ m_binUtil2

template<class T>
BinUtility Trk::BinnedArray1D1D1D< T >::m_binUtil2 {}
private

binUtility for retrieving and filling the Array

binUtility for retrieving and filling the Array

Definition at line 218 of file BinnedArray1D1D1D.h.

218{};

◆ m_binUtilArray

template<class T>
std::vector<std::vector<BinUtility> > Trk::BinnedArray1D1D1D< T >::m_binUtilArray {}
private

Definition at line 220 of file BinnedArray1D1D1D.h.

220{};

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