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

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

#include <NavBinnedArray1D.h>

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

Public Member Functions

 NavBinnedArray1D ()=default
 NavBinnedArray1D (NavBinnedArray1D &&)=default
NavBinnedArray1Doperator= (NavBinnedArray1D &&)=default
 ~NavBinnedArray1D ()=default
 NavBinnedArray1D (const std::vector< std::shared_ptr< T > > &tclassvector, const BinUtility &bingen, const Amg::Transform3D &transform)
 Constructor with std::vector and a BinUtility - reference counted, will delete objects at the end, if this deletion should be turned off, the boolean deletion should be switched to false the global position is given by pointer and then deleted!
 NavBinnedArray1D (const NavBinnedArray1D &barr, std::vector< std::shared_ptr< T > > &&vec, const Amg::Transform3D &shift)
 Copy Constructor with shift.
 NavBinnedArray1D (const NavBinnedArray1D &barr)
 Copy Constructor.
NavBinnedArray1Doperator= (const NavBinnedArray1D &barr)
 Assignment operator.
NavBinnedArray1Dclone () 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 &) 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.
const Amg::Transform3Dtransform () const
 Return the transform.
void updateTransform (Amg::Transform3D &transform)
 Reposition.

Private Member Functions

void createArrayCache () const
 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
 binUtility for retrieving and filling the Array
BinUtility m_binUtility
Amg::Transform3D m_transf

Detailed Description

template<class T>
class Trk::NavBinnedArray1D< T >

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

For use within navigation objects, global coordinates/transform refer to the position within mother navigation object

Author
Andre.nosp@m.as.S.nosp@m.alzbu.nosp@m.rger.nosp@m.@cern.nosp@m..ch, Sarka.nosp@m..Tod.nosp@m.orova.nosp@m.@cer.nosp@m.n.ch
Christos Anastopoulos (Athena MT modifications)

Definition at line 35 of file NavBinnedArray1D.h.

Constructor & Destructor Documentation

◆ NavBinnedArray1D() [1/5]

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

◆ NavBinnedArray1D() [2/5]

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

◆ ~NavBinnedArray1D()

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

◆ NavBinnedArray1D() [3/5]

template<class T>
Trk::NavBinnedArray1D< T >::NavBinnedArray1D ( const std::vector< std::shared_ptr< T > > & tclassvector,
const BinUtility & bingen,
const Amg::Transform3D & transform )
inline

Constructor with std::vector and a BinUtility - reference counted, will delete objects at the end, if this deletion should be turned off, the boolean deletion should be switched to false the global position is given by pointer and then deleted!

Definition at line 49 of file NavBinnedArray1D.h.

53 m_arrayObjects(nullptr),
BinnedArray()=default
Avoiding a map search, the templated BinnedArray class can help ordereing geometrical objects by prov...
Amg::Transform3D m_transf
std::vector< std::shared_ptr< T > > m_array
1D vector of cached not owning pointers to class T
const Amg::Transform3D * transform() const
Return the transform.
CxxUtils::CachedUniquePtr< std::vector< T * > > m_arrayObjects
binUtility for retrieving and filling the Array

◆ NavBinnedArray1D() [4/5]

template<class T>
Trk::NavBinnedArray1D< T >::NavBinnedArray1D ( const NavBinnedArray1D< T > & barr,
std::vector< std::shared_ptr< T > > && vec,
const Amg::Transform3D & shift )
inline

Copy Constructor with shift.

Definition at line 58 of file NavBinnedArray1D.h.

◆ NavBinnedArray1D() [5/5]

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

Copy Constructor.

Definition at line 69 of file NavBinnedArray1D.h.

Member Function Documentation

◆ arrayObjects() [1/2]

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

Return all objects of the Array non-const T.

Implements Trk::BinnedArray< T >.

Definition at line 148 of file NavBinnedArray1D.h.

149 {
151 return std::span<T* const>(m_arrayObjects->begin(),m_arrayObjects->end());
152 }
void createArrayCache() const
vector of pointers to the class T

◆ arrayObjects() [2/2]

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

Return all objects of the Array const T.

Implements Trk::BinnedArray< T >.

Definition at line 155 of file NavBinnedArray1D.h.

156 {
159 }

◆ arrayObjectsNumber()

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

Number of Entries in the Array.

Implements Trk::BinnedArray< T >.

Definition at line 162 of file NavBinnedArray1D.h.

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

◆ binUtility()

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

Return the BinUtility.

Implements Trk::BinnedArray< T >.

Definition at line 165 of file NavBinnedArray1D.h.

165{ return &m_binUtility; }

◆ clone()

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

Implicit Constructor.

Implements Trk::BinnedArray< T >.

Definition at line 92 of file NavBinnedArray1D.h.

92{ return new NavBinnedArray1D(*this); }
NavBinnedArray1D()=default

◆ createArrayCache()

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

vector of pointers to the class T

Definition at line 177 of file NavBinnedArray1D.h.

◆ entryObject()

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

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

Implements Trk::BinnedArray< T >.

Definition at line 119 of file NavBinnedArray1D.h.

119{ return (m_array[0]).get(); }

◆ nextObject()

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

126 {
127 // transform into navig.coordinates
128 const Amg::Vector3D navGP((m_transf.inverse()) * gp);
129 const Amg::Vector3D navMom((m_transf.inverse()).linear() * mom);
130 // the bins
131 size_t firstBin = m_binUtility.next(navGP, navMom, 0);
132 // use the information of the associated result
133 if (associatedResult) {
134 if (firstBin <= m_binUtility.max(0)) {
135 return (m_array[firstBin]).get();
136 } else {
137 return nullptr;
138 }
139 }
140 // the associated result was 0 -> set to boundary
141 firstBin = (firstBin < m_binUtility.bins(0))
142 ? firstBin
143 : m_binUtility.max(0);
144 return (m_array[m_binUtility.bin(navGP)]).get();
145 }

◆ object() [1/2]

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

98 {
99 if (m_binUtility.inside(lp)) {
100 return (m_array[m_binUtility.bin(lp)]).get();
101 }
102 return nullptr;
103 }

◆ object() [2/2]

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

108 {
109 // transform into navig.coordinates
110 const Amg::Vector3D navGP((m_transf.inverse()) * gp);
111 if (m_binUtility.inside(navGP)) {
112 return (m_array[m_binUtility.bin(navGP)]).get();
113 }
114 return nullptr;
115 }

◆ operator=() [1/2]

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

Assignment operator.

Definition at line 79 of file NavBinnedArray1D.h.

80 {
81 if (this != &barr) {
82 m_arrayObjects.release();
84 // --------------------------------------------------------------------------
87 }
88 return *this;
89 }

◆ operator=() [2/2]

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

◆ transform()

template<class T>
const Amg::Transform3D * Trk::NavBinnedArray1D< T >::transform ( ) const
inline

Return the transform.

Definition at line 168 of file NavBinnedArray1D.h.

168{ return &m_transf; }

◆ updateTransform()

template<class T>
void Trk::NavBinnedArray1D< T >::updateTransform ( Amg::Transform3D & transform)
inline

Reposition.

Definition at line 171 of file NavBinnedArray1D.h.

172 {
174 }
Eigen::Affine3d Transform3D

Member Data Documentation

◆ m_array

template<class T>
std::vector<std::shared_ptr<T> > Trk::NavBinnedArray1D< T >::m_array
private

1D vector of cached not owning pointers to class T

Definition at line 189 of file NavBinnedArray1D.h.

◆ m_arrayObjects

template<class T>
CxxUtils::CachedUniquePtr<std::vector<T*> > Trk::NavBinnedArray1D< T >::m_arrayObjects
private

binUtility for retrieving and filling the Array

Definition at line 191 of file NavBinnedArray1D.h.

◆ m_binUtility

template<class T>
BinUtility Trk::NavBinnedArray1D< T >::m_binUtility
private

Definition at line 193 of file NavBinnedArray1D.h.

◆ m_transf

template<class T>
Amg::Transform3D Trk::NavBinnedArray1D< T >::m_transf
private

Definition at line 195 of file NavBinnedArray1D.h.


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