Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
 
 BinnedArray1D (BinnedArray1D &&)=default
 
BinnedArray1Doperator= (BinnedArray1D &&)=default
 
 ~BinnedArray1D ()=default
 
 BinnedArray1D (const std::vector< std::pair< SharedObject< T >, Amg::Vector3D >> &tclassvector, const BinUtility &bingen)
 ctors with arguments More...
 
 BinnedArray1D (const std::vector< std::pair< SharedObject< T >, Amg::Vector3D >> &tclassvector, BinUtility &&bingen)
 
 BinnedArray1D (const BinnedArray1D &barr)
 Copy. More...
 
BinnedArray1Doperator= (const BinnedArray1D &barr)
 Assignment. More...
 
BinnedArray1Dclone () 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 &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
 
void initialize (const std::vector< std::pair< SharedObject< T >, Amg::Vector3D >> &tclassvector)
 vector of pointers to the class T More...
 

Private Attributes

std::vector< SharedObject< T > > m_array {}
 1D vector of cached not owning pointers to class T More...
 
CxxUtils::CachedUniquePtr< std::vector< T * > > m_arrayObjects {nullptr}
 binUtility for retrieving and filling the Array More...
 
BinUtility m_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 34 of file BinnedArray1D.h.

Constructor & Destructor Documentation

◆ BinnedArray1D() [1/5]

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

◆ BinnedArray1D() [2/5]

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

◆ ~BinnedArray1D()

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

◆ BinnedArray1D() [3/5]

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

ctors with arguments

Definition at line 44 of file BinnedArray1D.h.

47  : BinnedArray<T>(),
48  m_array{},
49  m_arrayObjects(nullptr),
50  m_binUtility(bingen) {
51  initialize(tclassvector);
52  }

◆ BinnedArray1D() [4/5]

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

Definition at line 53 of file BinnedArray1D.h.

56  : BinnedArray<T>()
57  , m_array{}
58  , m_arrayObjects(nullptr)
59  , m_binUtility(std::move(bingen))
60  {
61  initialize(tclassvector);
62  }

◆ BinnedArray1D() [5/5]

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

Copy.

Definition at line 64 of file BinnedArray1D.h.

65  : BinnedArray<T>()
66  , m_array{barr.m_array}
67  , m_arrayObjects(nullptr)
68  , m_binUtility(barr.m_binUtility)
69  {
70  }

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

125  {
127  return Trk::BinnedArraySpan<T* const>(&*(m_arrayObjects->begin()), &*(m_arrayObjects->end()));
128  }

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

132  {
134  return Trk::BinnedArraySpan<const T* const>(&*(m_arrayObjects->begin()), &*(m_arrayObjects->end()));
135  }

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

138 { 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 141 of file BinnedArray1D.h.

141 { return &m_binUtility; }

◆ clone()

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

Implicit Constructor.

Implements Trk::BinnedArray< T >.

Definition at line 83 of file BinnedArray1D.h.

83 { return new BinnedArray1D(*this); }

◆ createArrayCache()

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

Definition at line 144 of file BinnedArray1D.h.

145  {
146  if (!m_arrayObjects) {
147  std::unique_ptr<std::vector<T*>> arrayObjects = std::make_unique<std::vector<T*>>();
148  auto bins = m_binUtility.bins(0);
149  arrayObjects->reserve(bins);
150  for (size_t ill = 0; ill < bins; ++ill) {
151  arrayObjects->push_back((m_array[ill]).get());
152  }
153  m_arrayObjects.set(std::move(arrayObjects));
154  }
155  }

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

107  {
108  return (m_array[m_binUtility.entry(gp, 0)]).get();
109  }

◆ initialize()

template<class T >
void Trk::BinnedArray1D< T >::initialize ( const std::vector< std::pair< SharedObject< T >, Amg::Vector3D >> &  tclassvector)
inlineprivate

vector of pointers to the class T

Definition at line 157 of file BinnedArray1D.h.

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

116  {
117  // the bins
118  size_t bin = associatedResult ? m_binUtility.bin(gp, 0)
119  : m_binUtility.next(gp, mom, 0);
120  return (m_array[bin]).get();
121  }

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

Implements Trk::BinnedArray< T >.

Definition at line 88 of file BinnedArray1D.h.

89  {
90  if (m_binUtility.inside(lp)) {
91  return (m_array[m_binUtility.bin(lp, 0)]).get();
92  }
93  return nullptr;
94  }

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

Implements Trk::BinnedArray< T >.

Definition at line 99 of file BinnedArray1D.h.

100  {
101  return (m_array[m_binUtility.bin(gp, 0)]).get();
102  }

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

Assignment.

Definition at line 72 of file BinnedArray1D.h.

73  {
74  if (this != &barr) {
75  m_binUtility = barr.m_binUtility;
76  m_array.clear();
77  m_arrayObjects.release();
78  m_array = barr.m_array;
79  }
80  return *this;
81  }

Member Data Documentation

◆ m_array

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

1D vector of cached not owning pointers to class T

Definition at line 172 of file BinnedArray1D.h.

◆ m_arrayObjects

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

binUtility for retrieving and filling the Array

Definition at line 174 of file BinnedArray1D.h.

◆ m_binUtility

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

Definition at line 176 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:136
Trk::BinnedArray1D::m_array
std::vector< SharedObject< T > > m_array
1D vector of cached not owning pointers to class T
Definition: BinnedArray1D.h:172
bin
Definition: BinsDiffFromStripMedian.h:43
Trk::BinnedArray1D::initialize
void initialize(const std::vector< std::pair< SharedObject< T >, Amg::Vector3D >> &tclassvector)
vector of pointers to the class T
Definition: BinnedArray1D.h:157
Trk::BinnedArray1D::arrayObjects
BinnedArraySpan< T *const > arrayObjects()
Return all objects of the Array non-const T.
Definition: BinnedArray1D.h:124
Trk::BinUtility::bins
size_t bins(size_t ba=0) const
Number of bins.
Definition: BinUtility.h:221
Trk::BinnedArray1D::BinnedArray1D
BinnedArray1D()=default
ParticleGun_EoverP_Config.mom
mom
Definition: ParticleGun_EoverP_Config.py:63
Trk::BinnedArray1D::createArrayCache
void createArrayCache() const
Definition: BinnedArray1D.h:144
plotting.yearwise_luminosity_vs_mu.bins
bins
Definition: yearwise_luminosity_vs_mu.py:30
Trk::BinUtility::inside
bool inside(const Amg::Vector3D &position) const
Check if bin is inside from Vector3D.
Definition: BinUtility.h:186
Trk::BinnedArray1D::m_binUtility
BinUtility m_binUtility
Definition: BinnedArray1D.h:176
Trk::BinnedArray1D::m_arrayObjects
CxxUtils::CachedUniquePtr< std::vector< T * > > m_arrayObjects
binUtility for retrieving and filling the Array
Definition: BinnedArray1D.h:174
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::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:145