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

#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! More...
 
 NavBinnedArray1D (const NavBinnedArray1D &barr, std::vector< std::shared_ptr< T >> &&vec, const Amg::Transform3D &shift)
 Copy Constructor with shift. More...
 
 NavBinnedArray1D (const NavBinnedArray1D &barr)
 Copy Constructor. More...
 
NavBinnedArray1Doperator= (const NavBinnedArray1D &barr)
 Assignment operator. More...
 
NavBinnedArray1Dclone () const
 Implicit Constructor. More...
 
T * object (const Amg::Vector2D &lp) const
 Returns the pointer to the templated class object from the BinnedArray, it returns nullptr if not defined;. More...
 
T * object (const Amg::Vector3D &gp) const
 Returns the pointer to the templated class object from the BinnedArray it returns nullptr if not defined;. More...
 
T * entryObject (const Amg::Vector3D &) const
 Returns the pointer to the templated class object from the BinnedArray - entry point. More...
 
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. More...
 
std::span< T *constarrayObjects ()
 Return all objects of the Array non-const T. More...
 
std::span< T const *constarrayObjects () const
 Return all objects of the Array const T. More...
 
unsigned int arrayObjectsNumber () const
 Number of Entries in the Array. More...
 
const BinUtilitybinUtility () const
 Return the BinUtility. More...
 
const Amg::Transform3Dtransform () const
 Return the transform. More...
 
void updateTransform (Amg::Transform3D &transform)
 Reposition. More...
 

Private Member Functions

void createArrayCache () const
 vector of pointers to the class T More...
 

Private Attributes

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

51  : BinnedArray<T>(),
52  m_array{tclassvector},
53  m_arrayObjects(nullptr),
54  m_binUtility(bingen),

◆ 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.

61  : BinnedArray<T>()
62  , m_array(std::move(vec))
63  , m_arrayObjects{}
64  , m_binUtility(barr.m_binUtility)
65  , m_transf(Amg::Transform3D(shift * (barr.m_transf)))
66  {}

◆ 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.

70  : BinnedArray<T>()
71  , m_array{barr.m_array}
72  , m_arrayObjects(nullptr)
73  , m_binUtility(barr.m_binUtility)
74  , m_transf(barr.m_transf)
75  {
76  }

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  }

◆ 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  {
158  return std::span<T const * const>(m_arrayObjects->begin(), m_arrayObjects->end());
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(); }

◆ 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); }

◆ 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();
83  m_binUtility = barr.m_binUtility;
84  // --------------------------------------------------------------------------
85  m_array = (barr.m_array);
86  m_transf = barr.m_transf;
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  }

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:
Trk::NavBinnedArray1D::m_binUtility
BinUtility m_binUtility
Definition: NavBinnedArray1D.h:193
Trk::BinUtility::max
size_t max(size_t ba=0) const
First bin maximal value.
Definition: BinUtility.h:212
Trk::NavBinnedArray1D::m_array
std::vector< std::shared_ptr< T > > m_array
1D vector of cached not owning pointers to class T
Definition: NavBinnedArray1D.h:189
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:9
Trk::NavBinnedArray1D::transform
const Amg::Transform3D * transform() const
Return the transform.
Definition: NavBinnedArray1D.h:168
Trk::BinUtility::bins
size_t bins(size_t ba=0) const
Number of bins.
Definition: BinUtility.h:221
Trk::NavBinnedArray1D::m_transf
Amg::Transform3D m_transf
Definition: NavBinnedArray1D.h:195
Trk::NavBinnedArray1D::m_arrayObjects
CxxUtils::CachedUniquePtr< std::vector< T * > > m_arrayObjects
binUtility for retrieving and filling the Array
Definition: NavBinnedArray1D.h:191
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Trk::NavBinnedArray1D::arrayObjects
std::span< T *const > arrayObjects()
Return all objects of the Array non-const T.
Definition: NavBinnedArray1D.h:148
Trk::BinUtility::inside
bool inside(const Amg::Vector3D &position) const
Check if bin is inside from Vector3D.
Definition: BinUtility.h:186
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
get
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition: hcg.cxx:127
Trk::NavBinnedArray1D::NavBinnedArray1D
NavBinnedArray1D()=default
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
Trk::BinUtility::next
size_t next(const Amg::Vector3D &position, const Amg::Vector3D &direction, size_t ba=0) const
Bin from a 3D vector (already in binning frame)
Definition: BinUtility.h:145
Trk::NavBinnedArray1D::createArrayCache
void createArrayCache() const
vector of pointers to the class T
Definition: NavBinnedArray1D.h:177