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

1-dimensional binned arry based on a sorting given by the BinUtitlity. More...

#include <BinnedArray1D.h>

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

Public Member Functions

 BinnedArray1D ()=default
 BinnedArray1D (BinnedArray1D &&)=default
BinnedArray1Doperator= (BinnedArray1D &&)=default
 ~BinnedArray1D ()=default
 BinnedArray1D (const std::vector< std::pair< std::shared_ptr< T >, Amg::Vector3D > > &tclassvector, const BinUtility &bingen)
 ctors with arguments
 BinnedArray1D (const std::vector< std::pair< std::shared_ptr< T >, Amg::Vector3D > > &tclassvector, BinUtility &&bingen)
 BinnedArray1D (const BinnedArray1D &barr)
 Copy.
BinnedArray1Doperator= (const BinnedArray1D &barr)
 Assignment.
BinnedArray1Dclone () 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 &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 non-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.

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::shared_ptr< T > > m_array {}
 1D vector of cached not owning pointers to class T
CxxUtils::CachedUniquePtr< std::vector< T * > > m_arrayObjects {nullptr}
 binUtility for retrieving and filling the Array
BinUtility m_binUtility {}

Detailed Description

template<class T>
class Trk::BinnedArray1D< T >

1-dimensional binned arry based on a sorting given by the BinUtitlity.

Author
Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch
Christos Anastopoulos (Athena MT modifications)

Definition at line 34 of file BinnedArray1D.h.

Constructor & Destructor Documentation

◆ BinnedArray1D() [1/5]

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

◆ BinnedArray1D() [2/5]

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

◆ ~BinnedArray1D()

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

◆ BinnedArray1D() [3/5]

template<class T>
Trk::BinnedArray1D< T >::BinnedArray1D ( const std::vector< std::pair< std::shared_ptr< T >, Amg::Vector3D > > & tclassvector,
const BinUtility & bingen )
inline

ctors with arguments

Definition at line 44 of file BinnedArray1D.h.

48 m_array{},
49 m_arrayObjects(nullptr),
52 }
1-dimensional binned arry based on a sorting given by the BinUtitlity.
BinUtility m_binUtility
CxxUtils::CachedUniquePtr< std::vector< T * > > m_arrayObjects
binUtility for retrieving and filling the Array
std::vector< std::shared_ptr< T > > m_array
1D vector of cached not owning pointers to class T
BinnedArray()=default
void initialize()

◆ BinnedArray1D() [4/5]

template<class T>
Trk::BinnedArray1D< T >::BinnedArray1D ( const std::vector< std::pair< std::shared_ptr< T >, Amg::Vector3D > > & tclassvector,
BinUtility && bingen )
inline

Definition at line 53 of file BinnedArray1D.h.

57 , m_array{}
58 , m_arrayObjects(nullptr)
60 {
62 }

◆ BinnedArray1D() [5/5]

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

Copy.

Definition at line 64 of file BinnedArray1D.h.

67 , m_arrayObjects(nullptr)
69 {
70 }

Member Function Documentation

◆ arrayObjects() [1/2]

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

Return all objects of the Array non-const T.

Implements Trk::BinnedArray< T >.

Definition at line 124 of file BinnedArray1D.h.

125 {
127 return std::span<T* const>(m_arrayObjects->begin(), m_arrayObjects->end());
128 }
void createArrayCache() const

◆ arrayObjects() [2/2]

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

Return all objects of the Array const T.

Implements Trk::BinnedArray< T >.

Definition at line 131 of file BinnedArray1D.h.

132 {
135 }

◆ arrayObjectsNumber()

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

Number of Entries in the Array.

Implements Trk::BinnedArray< T >.

Definition at line 138 of file BinnedArray1D.h.

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

◆ binUtility()

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

Return the BinUtility.

Implements Trk::BinnedArray< T >.

Definition at line 141 of file BinnedArray1D.h.

141{ return &m_binUtility; }

◆ clone()

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

Implicit Constructor.

Implements Trk::BinnedArray< T >.

Definition at line 83 of file BinnedArray1D.h.

83{ return new BinnedArray1D(*this); }
BinnedArray1D()=default

◆ createArrayCache()

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

Definition at line 144 of file BinnedArray1D.h.

145 {
146 if (!m_arrayObjects) {
148 auto bins = m_binUtility.bins(0);
149 arrayObjects->reserve(bins);
150 for (size_t ill = 0; ill < bins; ++ill) {
151 arrayObjects->push_back((m_array[ill]).get());
152 }
154 }
155 }
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::BinnedArray1D< 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 106 of file BinnedArray1D.h.

107 {
108 return (m_array[m_binUtility.entry(gp, 0)]).get();
109 }

◆ initialize()

template<class T>
void Trk::BinnedArray1D< 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 157 of file BinnedArray1D.h.

◆ nextObject()

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

116 {
117 // the bins
118 size_t bin = associatedResult ? m_binUtility.bin(gp, 0)
119 : m_binUtility.next(gp, mom, 0);
120 return (m_array[bin]).get();
121 }

◆ object() [1/2]

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

89 {
90 if (m_binUtility.inside(lp)) {
91 return (m_array[m_binUtility.bin(lp, 0)]).get();
92 }
93 return nullptr;
94 }

◆ object() [2/2]

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

100 {
101 return (m_array[m_binUtility.bin(gp, 0)]).get();
102 }

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Assignment.

Definition at line 72 of file BinnedArray1D.h.

73 {
74 if (this != &barr) {
76 m_array.clear();
77 m_arrayObjects.release();
79 }
80 return *this;
81 }

Member Data Documentation

◆ m_array

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

1D vector of cached not owning pointers to class T

Definition at line 172 of file BinnedArray1D.h.

172{};

◆ m_arrayObjects

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

binUtility for retrieving and filling the Array

Definition at line 174 of file BinnedArray1D.h.

174{nullptr};

◆ m_binUtility

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

Definition at line 176 of file BinnedArray1D.h.

176{};

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