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::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 ()=default
 
 BinnedArray1D1D (const std::vector< std::pair< SharedObject< T >, Amg::Vector3D >> &tclassvector, const BinUtility &steeringBinGen1D, const std::vector< BinUtility > &singleBinGen)
 Constructor with std::vector and a BinUtility. More...
 
 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...
 
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 - returns the steering binUtility in this case. More...
 

Private Member Functions

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

Private Attributes

std::vector< std::vector< SharedObject< 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/3]

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

◆ ~BinnedArray1D1D()

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

◆ BinnedArray1D1D() [2/3]

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

Constructor with std::vector and a BinUtility.

Definition at line 40 of file BinnedArray1D1D.h.

44  : BinnedArray<T>()
45  , m_array{}
46  , m_arrayObjects(nullptr)
47  , m_steeringBinUtility(steeringBinGen1D)
48  , m_singleBinUtilities(singleBinGen)
49  {
50  // prepare the binned Array
51  m_array =std::vector<std::vector<SharedObject<T>>>(steeringBinGen1D.bins());
52  for (size_t i = 0; i < steeringBinGen1D.bins(); ++i) {
53  size_t sizeOfSubBin = ((m_singleBinUtilities)[i]).bins();
54  m_array[i] = std::vector<SharedObject<T>>(sizeOfSubBin);
55  }
56  // fill the Volume vector into the array
57  int vecsize(tclassvector.size());
58  for (int ivec = 0; ivec < vecsize; ++ivec) {
59  const Amg::Vector3D currentGlobal((tclassvector[ivec]).second);
60  if (steeringBinGen1D.inside(currentGlobal)) {
61  int steeringBin = steeringBinGen1D.bin(currentGlobal, 0);
62  int singleBin = ((m_singleBinUtilities)[steeringBin]).bin(currentGlobal, 0);
63  std::vector<SharedObject<T>>& curVec = m_array[steeringBin];
64  curVec[singleBin] = ((tclassvector)[ivec]).first;
65  } else{
66  throw GaudiException(
67  "BinnedArray1D1D", "Object outside bounds", StatusCode::FAILURE);
68  }
69  }
70  }

◆ BinnedArray1D1D() [3/3]

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

Copy Constructor.

Definition at line 72 of file BinnedArray1D1D.h.

73  : BinnedArray<T>()
74  , m_array{}
75  , m_arrayObjects(nullptr)
76  , m_steeringBinUtility(barr.m_steeringBinUtility)
77  , m_singleBinUtilities(barr.m_singleBinUtilities)
78  {
79  // prepare the binned Array
80  if (!m_singleBinUtilities.empty()) {
81  // prepare the array
82  m_array = std::vector<std::vector<SharedObject<T>>>(m_steeringBinUtility.bins(0));
83  for (size_t i = 0; i < m_steeringBinUtility.bins(0); ++i) {
84  size_t sizeOfSubBin = (m_singleBinUtilities[i]).bins(0);
85  m_array[i] = std::vector<SharedObject<T>>(sizeOfSubBin, nullptr);
86  }
87 
88  // assign the items
89  for (size_t isteer = 0; isteer < m_steeringBinUtility.bins(0); ++isteer) {
90  for (size_t isingle = 0; isingle < (m_singleBinUtilities)[isteer].bins(0); ++isingle) {
91  m_array[isteer][isingle] = (barr.m_array)[isteer][isingle];
92  }
93  }
94  }
95  }

Member Function Documentation

◆ arrayObjects() [1/2]

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

Return all objects of the Array non-const T.

Implements Trk::BinnedArray< T >.

Definition at line 162 of file BinnedArray1D1D.h.

163  {
165  return Trk::BinnedArraySpan<T* const>(&*(m_arrayObjects->begin()), &*(m_arrayObjects->end()));
166  }

◆ arrayObjects() [2/2]

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

Return all objects of the Array const T.

Implements Trk::BinnedArray< T >.

Definition at line 169 of file BinnedArray1D1D.h.

170  {
172  return BinnedArraySpan<const T* const>(&*(m_arrayObjects->begin()), &*(m_arrayObjects->end()));
173  }

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

176 { 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 179 of file BinnedArray1D1D.h.

179 { return &m_steeringBinUtility; }

◆ clone()

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

Implicit Constructor.

Implements Trk::BinnedArray< T >.

Definition at line 124 of file BinnedArray1D1D.h.

124 { return new BinnedArray1D1D(*this); }

◆ createArrayCache()

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

vector of pointers to the class T

Definition at line 182 of file BinnedArray1D1D.h.

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

149  {
150  int steerBin = m_steeringBinUtility.entry(gp, 0);
151  int singleBin = std::as_const(m_singleBinUtilities)[steerBin].entry(gp, 0);
152  return (m_array[steerBin][singleBin]).get();
153  }

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

157  {
158  return nullptr;
159  }

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

130  {
131  int steerBin = m_steeringBinUtility.bin(lp, 0);
132  int singleBin = std::as_const(m_singleBinUtilities)[steerBin].bin(lp, 0);
133  return (m_array[steerBin][singleBin]).get();
134  }

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

140  {
141  int steerBin = m_steeringBinUtility.bin(gp, 0);
142  int singleBin = std::as_const(m_singleBinUtilities)[steerBin].bin(gp, 0);
143  return (m_array[steerBin][singleBin]).get();
144  }

◆ operator=()

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

Assignment operator.

Definition at line 98 of file BinnedArray1D1D.h.

99  {
100  if (this != &barr) {
101  m_arrayObjects.release();
102  m_singleBinUtilities = barr.m_steeringBinUtility;
103  m_steeringBinUtility = barr.m_steeringBinUtility;
104  // prepare the binned Array
105  if (m_singleBinUtilities.size()) {
106  // prepare the array
107  m_array = std::vector<std::vector<SharedObject<T>>>(m_steeringBinUtility.bins(0));
108  for (int i = 0; i < m_steeringBinUtility.bins(0); ++i) {
109  unsigned int sizeOfSubBin = (m_singleBinUtilities[i]).bins(0);
110  m_array[i] = std::vector<SharedObject<T>>(sizeOfSubBin);
111  }
112  // assign the items
113  for (int isteer = 0; isteer < m_steeringBinUtility.bins(0); ++isteer) {
114  for (int isingle = 0; isingle < m_singleBinUtilities[isteer].bins(0); ++isingle) {
115  m_array[isteer][isingle] = (barr.m_array)[isteer][isingle];
116  }
117  }
118  }
119  }
120  return *this;
121  }

Member Data Documentation

◆ m_array

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

forced 1D vector of pointers to class T

Definition at line 196 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 198 of file BinnedArray1D1D.h.

◆ m_singleBinUtilities

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

single bin utilities

Definition at line 201 of file BinnedArray1D1D.h.

◆ m_steeringBinUtility

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

Definition at line 200 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
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
Trk::BinnedArray1D1D::m_arrayObjects
CxxUtils::CachedUniquePtr< std::vector< T * > > m_arrayObjects
binUtility for retrieving and filling the Array
Definition: BinnedArray1D1D.h:198
Trk::BinnedArray1D1D::m_array
std::vector< std::vector< SharedObject< T > > > m_array
forced 1D vector of pointers to class T
Definition: BinnedArray1D1D.h:196
Trk::BinUtility::bins
size_t bins(size_t ba=0) const
Number of bins.
Definition: BinUtility.h:221
Trk::BinnedArray1D1D::arrayObjects
BinnedArraySpan< T *const > arrayObjects()
Return all objects of the Array non-const T.
Definition: BinnedArray1D1D.h:162
lumiFormat.i
int i
Definition: lumiFormat.py:85
Trk::BinnedArray1D1D::createArrayCache
void createArrayCache() const
vector of pointers to the class T
Definition: BinnedArray1D1D.h:182
plotting.yearwise_luminosity_vs_mu.bins
bins
Definition: yearwise_luminosity_vs_mu.py:30
Trk::BinnedArray1D1D::m_singleBinUtilities
std::vector< BinUtility > m_singleBinUtilities
single bin utilities
Definition: BinnedArray1D1D.h:201
Trk::BinnedArray1D1D::m_steeringBinUtility
BinUtility m_steeringBinUtility
Definition: BinnedArray1D1D.h:200
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
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
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::BinnedArray1D1D::BinnedArray1D1D
BinnedArray1D1D()=default