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

#include <BinnedArray1D1D.h>

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

Public Member Functions

 BinnedArray1D1D ()=default
 
 BinnedArray1D1D (BinnedArray1D1D &&)=default
 
BinnedArray1D1Doperator= (BinnedArray1D1D &&)=default
 
 ~BinnedArray1D1D ()=default
 
 BinnedArray1D1D (const std::vector< std::pair< std::shared_ptr< T >, Amg::Vector3D >> &tclassvector, const BinUtility &steeringBinGen1D, const std::vector< BinUtility > &singleBinGen)
 ctors with arguments More...
 
 BinnedArray1D1D (const std::vector< std::pair< std::shared_ptr< T >, Amg::Vector3D >> &tclassvector, BinUtility &&steeringBinGen1D, std::vector< BinUtility > &&singleBinGen)
 
 BinnedArray1D1D (const BinnedArray1D1D &barr)
 Copy Constructor. More...
 
BinnedArray1D1Doperator= (const BinnedArray1D1D &barr)
 Assignment operator. More...
 
BinnedArray1D1Dclone () const
 Implicit Constructor. More...
 
T * object (const Amg::Vector2D &lp) const
 Returns the pointer to the templated class object from the BinnedArray, it returns 0 if not defined. More...
 
T * object (const Amg::Vector3D &gp) const
 Returns the pointer to the templated class object from the BinnedArray, it returns 0 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 &, const Amg::Vector3D &, bool) 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 - returns the steering binUtility in this case. More...
 

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

Private Attributes

std::vector< std::vector< std::shared_ptr< T > > > m_array {}
 forced 1D vector of pointers to class T More...
 
CxxUtils::CachedUniquePtr< std::vector< T * > > m_arrayObjects {nullptr}
 binUtility for retrieving and filling the Array More...
 
BinUtility m_steeringBinUtility {}
 
std::vector< BinUtilitym_singleBinUtilities {}
 single bin utilities More...
 

Detailed Description

template<class T>
class Trk::BinnedArray1D1D< T >

2D dimensional binned array, where the binning grid is not symmetric. One steering bin utility finds the associated array of the other.

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 33 of file BinnedArray1D1D.h.

Constructor & Destructor Documentation

◆ BinnedArray1D1D() [1/5]

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

◆ BinnedArray1D1D() [2/5]

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

◆ ~BinnedArray1D1D()

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

◆ BinnedArray1D1D() [3/5]

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

ctors with arguments

Constructor with std::vector and a BinUtility

Definition at line 44 of file BinnedArray1D1D.h.

48  : BinnedArray<T>(),
49  m_array{},
50  m_arrayObjects(nullptr),
51  m_steeringBinUtility(steeringBinGen1D),
52  m_singleBinUtilities(singleBinGen) {
53  initialize(tclassvector);
54  }

◆ BinnedArray1D1D() [4/5]

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

Definition at line 55 of file BinnedArray1D1D.h.

59  : BinnedArray<T>(),
60  m_array{},
61  m_arrayObjects(nullptr),
62  m_steeringBinUtility(std::move(steeringBinGen1D)),
63  m_singleBinUtilities(std::move(singleBinGen)) {
64  initialize(tclassvector);
65  }

◆ BinnedArray1D1D() [5/5]

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

Copy Constructor.

Definition at line 68 of file BinnedArray1D1D.h.

69  : BinnedArray<T>(),
70  m_array{barr.m_array},
71  m_arrayObjects(nullptr),
72  m_steeringBinUtility(barr.m_steeringBinUtility),
73  m_singleBinUtilities(barr.m_singleBinUtilities) {}

Member Function Documentation

◆ arrayObjects() [1/2]

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

Return all objects of the Array non-const T.

Implements Trk::BinnedArray< T >.

Definition at line 125 of file BinnedArray1D1D.h.

126  {
128  return std::span<T* const>(m_arrayObjects->begin(), m_arrayObjects->end());
129  }

◆ arrayObjects() [2/2]

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

Return all objects of the Array const T.

Implements Trk::BinnedArray< T >.

Definition at line 132 of file BinnedArray1D1D.h.

133  {
135  return std::span<const T* const>(m_arrayObjects->begin(), m_arrayObjects->end());
136  }

◆ arrayObjectsNumber()

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

Number of Entries in the Array.

Implements Trk::BinnedArray< T >.

Definition at line 139 of file BinnedArray1D1D.h.

139 { return arrayObjects().size(); }

◆ binUtility()

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

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

Implements Trk::BinnedArray< T >.

Definition at line 142 of file BinnedArray1D1D.h.

142 { return &m_steeringBinUtility; }

◆ clone()

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

Implicit Constructor.

Implements Trk::BinnedArray< T >.

Definition at line 87 of file BinnedArray1D1D.h.

87 { return new BinnedArray1D1D(*this); }

◆ createArrayCache()

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

Definition at line 145 of file BinnedArray1D1D.h.

146  {
147  if (!m_arrayObjects) {
148  std::unique_ptr<std::vector<T*>> arrayObjects = std::make_unique<std::vector<T*>>();
149  for (size_t isteer = 0; isteer < m_steeringBinUtility.bins(); ++isteer) {
150  for (size_t isingle = 0;
151  isingle < std::as_const(m_singleBinUtilities)[isteer].bins(); ++isingle) {
152  arrayObjects->push_back((m_array[isteer][isingle]).get());
153  }
154  }
155  m_arrayObjects.set(std::move(arrayObjects));
156  }
157  }

◆ entryObject()

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

112  {
113  int steerBin = m_steeringBinUtility.entry(gp, 0);
114  int singleBin = std::as_const(m_singleBinUtilities)[steerBin].entry(gp, 0);
115  return (m_array[steerBin][singleBin]).get();
116  }

◆ initialize()

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

◆ nextObject()

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

Returns the pointer to the templated class object from the BinnedArray.

Implements Trk::BinnedArray< T >.

Definition at line 119 of file BinnedArray1D1D.h.

120  {
121  return nullptr;
122  }

◆ object() [1/2]

template<class T >
T* Trk::BinnedArray1D1D< T >::object ( const Amg::Vector2D lp) const
inlinevirtual

Returns the pointer to the templated class object from the BinnedArray, it returns 0 if not defined.

Implements Trk::BinnedArray< T >.

Definition at line 92 of file BinnedArray1D1D.h.

93  {
94  int steerBin = m_steeringBinUtility.bin(lp, 0);
95  int singleBin = std::as_const(m_singleBinUtilities)[steerBin].bin(lp, 0);
96  return (m_array[steerBin][singleBin]).get();
97  }

◆ object() [2/2]

template<class T >
T* Trk::BinnedArray1D1D< T >::object ( const Amg::Vector3D gp) const
inlinevirtual

Returns the pointer to the templated class object from the BinnedArray, it returns 0 if not defined.

Implements Trk::BinnedArray< T >.

Definition at line 102 of file BinnedArray1D1D.h.

103  {
104  int steerBin = m_steeringBinUtility.bin(gp, 0);
105  int singleBin = std::as_const(m_singleBinUtilities)[steerBin].bin(gp, 0);
106  return (m_array[steerBin][singleBin]).get();
107  }

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Assignment operator.

Definition at line 76 of file BinnedArray1D1D.h.

76  {
77  if (this != &barr) {
78  m_arrayObjects.release();
79  m_steeringBinUtility = barr.m_steeringBinUtility;
80  m_singleBinUtilities = barr.m_singleBinUtilities;
81  m_array = barr.m_array;
82  }
83  return *this;
84  }

Member Data Documentation

◆ m_array

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

forced 1D vector of pointers to class T

Definition at line 182 of file BinnedArray1D1D.h.

◆ m_arrayObjects

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

binUtility for retrieving and filling the Array

Definition at line 184 of file BinnedArray1D1D.h.

◆ m_singleBinUtilities

template<class T >
std::vector<BinUtility> Trk::BinnedArray1D1D< T >::m_singleBinUtilities {}
private

single bin utilities

Definition at line 187 of file BinnedArray1D1D.h.

◆ m_steeringBinUtility

template<class T >
BinUtility Trk::BinnedArray1D1D< T >::m_steeringBinUtility {}
private

Definition at line 186 of file BinnedArray1D1D.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
Trk::BinnedArray1D1D::m_arrayObjects
CxxUtils::CachedUniquePtr< std::vector< T * > > m_arrayObjects
binUtility for retrieving and filling the Array
Definition: BinnedArray1D1D.h:184
Trk::BinnedArray1D1D::initialize
void initialize(const std::vector< std::pair< std::shared_ptr< T >, Amg::Vector3D >> &tclassvector)
vector of pointers to the class T
Definition: BinnedArray1D1D.h:159
Trk::BinUtility::bins
size_t bins(size_t ba=0) const
Number of bins.
Definition: BinUtility.h:221
Trk::BinnedArray1D1D::createArrayCache
void createArrayCache() const
Definition: BinnedArray1D1D.h:145
Trk::BinnedArray1D1D::m_singleBinUtilities
std::vector< BinUtility > m_singleBinUtilities
single bin utilities
Definition: BinnedArray1D1D.h:187
Trk::BinnedArray1D1D::m_steeringBinUtility
BinUtility m_steeringBinUtility
Definition: BinnedArray1D1D.h:186
Trk::BinnedArray1D1D::arrayObjects
std::span< T *const > arrayObjects()
Return all objects of the Array non-const T.
Definition: BinnedArray1D1D.h:125
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::BinnedArray1D1D::m_array
std::vector< std::vector< std::shared_ptr< T > > > m_array
forced 1D vector of pointers to class T
Definition: BinnedArray1D1D.h:182
Trk::BinnedArray1D1D::BinnedArray1D1D
BinnedArray1D1D()=default