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

#include <CompactBinnedArray1D.h>

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

Public Member Functions

 CompactBinnedArray1D (const std::vector< T * > &tclassvector, const std::vector< size_t > &indexvector, const BinUtility &bingen)
 Constructor with arguents. More...
 
 CompactBinnedArray1D (const std::vector< T * > &tclassvector, std::vector< size_t > &&indexvector, BinUtility &&bingen)
 
CompactBinnedArray1Dclone () const
 Implicit Constructor. More...
 
CompactBinnedArray1Dclone (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;. 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 &gp) 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 BinUtilitylayerBinUtility (const Amg::Vector3D &) const
 Return the BinUtility. More...
 
size_t layerBin (const Amg::Vector3D &pos) const
 Return the layer bin. More...
 

Private Attributes

std::vector< size_t > m_array {}
 vector of indices to objects More...
 
std::vector< T * > m_arrayObjects {}
 not owning pointers to objects More...
 
BinUtility m_binUtility {}
 binUtility More...
 

Detailed Description

template<class T>
class Trk::CompactBinnedArray1D< T >

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

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

Definition at line 32 of file CompactBinnedArray1D.h.

Constructor & Destructor Documentation

◆ CompactBinnedArray1D() [1/2]

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

Constructor with arguents.

Note that we do not take ownership of pointersy

Definition at line 40 of file CompactBinnedArray1D.h.

43  : CompactBinnedArray<T>(),
44  m_array(indexvector),
45  m_arrayObjects(tclassvector),
46  m_binUtility(bingen) {}

◆ CompactBinnedArray1D() [2/2]

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

Definition at line 48 of file CompactBinnedArray1D.h.

51  : CompactBinnedArray<T>(),
52  m_array(std::move(indexvector)),
53  m_arrayObjects(tclassvector),
54  m_binUtility(std::move(bingen)) {}

Member Function Documentation

◆ arrayObjects() [1/2]

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

Return all objects of the Array non const T.

Implements Trk::BinnedArray< T >.

Definition at line 107 of file CompactBinnedArray1D.h.

108  {
109  return std::span<T* const>(m_arrayObjects.begin(),m_arrayObjects.end());
110  }

◆ arrayObjects() [2/2]

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

Return all objects of the Array const T.

Implements Trk::BinnedArray< T >.

Definition at line 113 of file CompactBinnedArray1D.h.

114  {
115  return std::span<T const * const>(m_arrayObjects.begin(),m_arrayObjects.end());
116  }

◆ arrayObjectsNumber()

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

Number of Entries in the Array.

Implements Trk::BinnedArray< T >.

Definition at line 119 of file CompactBinnedArray1D.h.

119 { return m_arrayObjects.size(); }

◆ binUtility()

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

Return the BinUtility.

Implements Trk::BinnedArray< T >.

Definition at line 122 of file CompactBinnedArray1D.h.

122 { return &m_binUtility; }

◆ clone() [1/2]

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

Implicit Constructor.

Implements Trk::CompactBinnedArray< T >.

Definition at line 57 of file CompactBinnedArray1D.h.

58  {
60  }

◆ clone() [2/2]

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

Implements Trk::CompactBinnedArray< T >.

Definition at line 62 of file CompactBinnedArray1D.h.

63  {
64  assert(ptrs.size() == m_arrayObjects.size());
65  return new CompactBinnedArray1D(ptrs, m_array, m_binUtility);
66  }

◆ entryObject()

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

90  {
91  return (m_arrayObjects[m_array[m_binUtility.entry(gp, 0)]]);
92  }

◆ layerBin()

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

Return the layer bin.

Implements Trk::CompactBinnedArray< T >.

Definition at line 131 of file CompactBinnedArray1D.h.

132  {
133  return m_binUtility.bin(pos);
134  }

◆ layerBinUtility()

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

Return the BinUtility.

Implements Trk::CompactBinnedArray< T >.

Definition at line 125 of file CompactBinnedArray1D.h.

126  {
127  return &m_binUtility;
128  }

◆ nextObject()

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

99  {
100  // the bins
101  size_t bin = associatedResult ? m_binUtility.bin(gp, 0)
102  : m_binUtility.next(gp, mom, 0);
103  return m_arrayObjects[m_array[bin]];
104  }

◆ object() [1/2]

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

72  {
73  if (m_binUtility.inside(lp)){
74  return m_arrayObjects[m_array[m_binUtility.bin(lp, 0)]];
75  }
76  return nullptr;
77  }

◆ object() [2/2]

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

83  {
84  return m_arrayObjects[m_array[m_binUtility.bin(gp, 0)]];
85  }

Member Data Documentation

◆ m_array

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

vector of indices to objects

Definition at line 137 of file CompactBinnedArray1D.h.

◆ m_arrayObjects

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

not owning pointers to objects

Definition at line 138 of file CompactBinnedArray1D.h.

◆ m_binUtility

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

binUtility

Definition at line 139 of file CompactBinnedArray1D.h.


The documentation for this class was generated from the following file:
Trk::BinUtility::entry
size_t entry(const Amg::Vector3D &position, size_t ba=0) const
Bin from a 3D vector (already in binning frame)
Definition: BinUtility.h:136
bin
Definition: BinsDiffFromStripMedian.h:43
Trk::CompactBinnedArray1D::CompactBinnedArray1D
CompactBinnedArray1D(const std::vector< T * > &tclassvector, const std::vector< size_t > &indexvector, const BinUtility &bingen)
Constructor with arguents.
Definition: CompactBinnedArray1D.h:40
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
Trk::CompactBinnedArray1D::m_arrayObjects
std::vector< T * > m_arrayObjects
not owning pointers to objects
Definition: CompactBinnedArray1D.h:138
Trk::CompactBinnedArray1D::m_binUtility
BinUtility m_binUtility
binUtility
Definition: CompactBinnedArray1D.h:139
Trk::BinUtility::inside
bool inside(const Amg::Vector3D &position) const
Check if bin is inside from Vector3D.
Definition: BinUtility.h:186
plotBeamSpotVxVal.bin
int bin
Definition: plotBeamSpotVxVal.py:82
Trk::CompactBinnedArray1D::m_array
std::vector< size_t > m_array
vector of indices to objects
Definition: CompactBinnedArray1D.h:137
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:16
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