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

#include <BinnedArray1D.h>

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

Public Member Functions

 BinnedArray1D ()
 Default Constructor - needed for inherited classes. More...
 
 BinnedArray1D (const std::vector< std::pair< SharedObject< T >, Amg::Vector3D >> &tclassvector, BinUtility *bingen)
 Constructor with std::vector and a BinUtility. More...
 
 BinnedArray1D (const BinnedArray1D &barr)
 Copy Constructor - copies only pointers ! More...
 
BinnedArray1Doperator= (const BinnedArray1D &barr)
 Assignment operator. More...
 
BinnedArray1Dclone () const
 Implicit Constructor. More...
 
 ~BinnedArray1D ()
 Virtual Destructor. 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 &gp, const Amg::Vector3D &mom, bool associatedResult=true) const
 Returns the pointer to the templated class object from the BinnedArray. More...
 
BinnedArraySpan< T *constarrayObjects ()
 Return all objects of the Array non-const T. More...
 
BinnedArraySpan< 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...
 

Private Member Functions

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

Private Attributes

std::vector< SharedObject< T > > m_array
 forced 1D vector of pointers to class T More...
 
CxxUtils::CachedUniquePtr< std::vector< T * > > m_arrayObjects
 binUtility for retrieving and filling the Array More...
 
BinUtilitym_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 35 of file BinnedArray1D.h.

Constructor & Destructor Documentation

◆ BinnedArray1D() [1/3]

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

Default Constructor - needed for inherited classes.

Definition at line 40 of file BinnedArray1D.h.

41  : BinnedArray<T>()
42  , m_array{}
43  , m_arrayObjects(nullptr)
44  , m_binUtility(nullptr)
45  {}

◆ BinnedArray1D() [2/3]

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

Constructor with std::vector and a BinUtility.

Definition at line 48 of file BinnedArray1D.h.

51  : BinnedArray<T>()
52  , m_array{}
53  , m_arrayObjects(nullptr)
54  , m_binUtility(bingen)
55  {
56  // prepare the binned Array
57  if (bingen) {
58  size_t vecsize = tclassvector.size();
59  m_array = std::vector<SharedObject<T>>(vecsize);
60  for (size_t ivec = 0; ivec < vecsize; ++ivec) {
61  const Amg::Vector3D currentGlobal(((tclassvector[ivec]).second));
62  if (bingen->inside(currentGlobal)) {
63  m_array[bingen->bin(currentGlobal, 0)] = ((tclassvector)[ivec]).first;
64  } else
65  throw GaudiException("BinnedArray1D constructor",
66  "Object outside bounds",
67  StatusCode::FAILURE);
68  }
69  }
70  }

◆ BinnedArray1D() [3/3]

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

Copy Constructor - copies only pointers !

Definition at line 73 of file BinnedArray1D.h.

74  : BinnedArray<T>()
75  , m_array{}
76  , m_arrayObjects(nullptr)
77  , m_binUtility(nullptr)
78  {
79  m_binUtility = (barr.m_binUtility) ? barr.m_binUtility->clone() : nullptr;
80  if (m_binUtility) {
81  m_array = std::vector<SharedObject<T>>(barr.m_array.size());
82  for (unsigned int ient = 0; ient < barr.m_array.size(); ++ient) {
83  m_array[ient] = (barr.m_array)[ient];
84  }
85  }
86  }

◆ ~BinnedArray1D()

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

Virtual Destructor.

Definition at line 110 of file BinnedArray1D.h.

110 { delete m_binUtility; }

Member Function Documentation

◆ arrayObjects() [1/2]

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

Return all objects of the Array non-const T.

Implements Trk::BinnedArray< T >.

Definition at line 151 of file BinnedArray1D.h.

152  {
154  return Trk::BinnedArraySpan<T* const>(&*(m_arrayObjects->begin()), &*(m_arrayObjects->end()));
155  }

◆ arrayObjects() [2/2]

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

Return all objects of the Array const T.

Implements Trk::BinnedArray< T >.

Definition at line 158 of file BinnedArray1D.h.

159  {
161  return Trk::BinnedArraySpan<const T* const>(&*(m_arrayObjects->begin()), &*(m_arrayObjects->end()));
162  }

◆ 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 165 of file BinnedArray1D.h.

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

◆ binUtility()

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

Return the BinUtility.

Implements Trk::BinnedArray< T >.

Definition at line 168 of file BinnedArray1D.h.

168 { return (m_binUtility); }

◆ clone()

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

Implicit Constructor.

Implements Trk::BinnedArray< T >.

Definition at line 107 of file BinnedArray1D.h.

107 { return new BinnedArray1D(*this); }

◆ createArrayCache()

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

vector of pointers to the class T

Definition at line 171 of file BinnedArray1D.h.

◆ 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 133 of file BinnedArray1D.h.

134  {
135  return (m_array[m_binUtility->entry(gp, 0)]).get();
136  }

◆ 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 140 of file BinnedArray1D.h.

143  {
144  // the bins
145  size_t bin = associatedResult ? m_binUtility->bin(gp, 0)
146  : m_binUtility->next(gp, mom, 0);
147  return (m_array[bin]).get();
148  }

◆ 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 0 if not defined;.

Implements Trk::BinnedArray< T >.

Definition at line 115 of file BinnedArray1D.h.

116  {
117  if (m_binUtility->inside(lp)) {
118  return (m_array[m_binUtility->bin(lp, 0)]).get();
119  }
120  return nullptr;
121  }

◆ 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 0 if not defined;.

Implements Trk::BinnedArray< T >.

Definition at line 126 of file BinnedArray1D.h.

127  {
128  return (m_array[m_binUtility->bin(gp, 0)]).get();
129  }

◆ operator=()

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

Assignment operator.

Definition at line 88 of file BinnedArray1D.h.

89  {
90  if (this != &barr) {
91  m_array.clear();
92  m_arrayObjects.release();
93  delete m_binUtility;
94  // now refill
95  m_binUtility = (barr.m_binUtility) ? barr.m_binUtility->clone() : 0;
96 
97  if (m_binUtility) {
98  m_array = std::vector<SharedObject<T>>(barr.m_array.size());
99  for (unsigned int ient = 0; ient < barr.m_array.size(); ++ient) {
100  m_array[ient] = (barr.m_array)[ient];
101  }
102  }
103  }
104  return *this;
105  }

Member Data Documentation

◆ m_array

template<class T >
std::vector<SharedObject<T> > Trk::BinnedArray1D< T >::m_array
private

forced 1D vector of pointers to class T

Definition at line 186 of file BinnedArray1D.h.

◆ m_arrayObjects

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

binUtility for retrieving and filling the Array

Definition at line 188 of file BinnedArray1D.h.

◆ m_binUtility

template<class T >
BinUtility* Trk::BinnedArray1D< T >::m_binUtility
private

Definition at line 190 of file BinnedArray1D.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:145
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
Trk::BinnedArray1D::m_array
std::vector< SharedObject< T > > m_array
forced 1D vector of pointers to class T
Definition: BinnedArray1D.h:186
bin
Definition: BinsDiffFromStripMedian.h:43
Trk::BinnedArray1D::arrayObjects
BinnedArraySpan< T *const > arrayObjects()
Return all objects of the Array non-const T.
Definition: BinnedArray1D.h:151
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
Trk::BinnedArray1D::createArrayCache
void createArrayCache() const
vector of pointers to the class T
Definition: BinnedArray1D.h:171
Trk::BinUtility::inside
bool inside(const Amg::Vector3D &position) const
Check if bin is inside from Vector3D.
Definition: BinUtility.h:190
Trk::BinnedArray1D::BinnedArray1D
BinnedArray1D()
Default Constructor - needed for inherited classes.
Definition: BinnedArray1D.h:40
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::BinnedArray1D::m_arrayObjects
CxxUtils::CachedUniquePtr< std::vector< T * > > m_arrayObjects
binUtility for retrieving and filling the Array
Definition: BinnedArray1D.h:188
Trk::BinUtility::clone
BinUtility * clone() const
Implizit Constructor.
Definition: BinUtility.h:130
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:136
CxxUtils::ivec
vec_fb< typename boost::int_t< sizeof(T) *8 >::exact, N > ivec
Definition: vec_fb.h:53
Trk::BinnedArraySpan
std::span< T > BinnedArraySpan
Definition: BinnedArray.h:34
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:153
Trk::BinnedArray1D::m_binUtility
BinUtility * m_binUtility
Definition: BinnedArray1D.h:190