ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
TrkDetDescr
TrkDetDescrUtils
TrkDetDescrUtils
CompactBinnedArray1D.h
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// CompactBinnedArray1D.h, (c) ATLAS Detector software
8
9
#ifndef TRKDETDESCRUTILS_COMPACTBINNEDARRAY1D_H
10
#define TRKDETDESCRUTILS_COMPACTBINNEDARRAY1D_H
11
12
#include "
TrkDetDescrUtils/BinUtility.h
"
13
#include "
TrkDetDescrUtils/CompactBinnedArray.h
"
14
15
// STL
16
#include <vector>
17
18
class
MsgStream;
19
20
namespace
Trk
{
21
30
31
template
<
class
T>
32
class
CompactBinnedArray1D
final :
public
CompactBinnedArray
<T>
33
{
34
public
:
35
36
//Rule of 0 for default ctors
37
40
CompactBinnedArray1D
(
const
std::vector<T*>& tclassvector,
41
const
std::vector<size_t>& indexvector,
42
const
BinUtility
& bingen)
43
:
CompactBinnedArray
<T>(),
44
m_array
(indexvector),
45
m_arrayObjects
(tclassvector),
46
m_binUtility
(bingen) {}
47
48
CompactBinnedArray1D
(
const
std::vector<T*>& tclassvector,
49
std::vector<size_t>&& indexvector,
50
BinUtility
&& bingen)
51
:
CompactBinnedArray
<T>(),
52
m_array
(
std
::move(indexvector)),
53
m_arrayObjects
(tclassvector),
54
m_binUtility
(
std
::move(bingen)) {}
55
57
CompactBinnedArray1D
*
clone
()
const
58
{
59
return
new
CompactBinnedArray1D
(
m_arrayObjects
,
m_array
,
m_binUtility
);
60
}
61
62
CompactBinnedArray1D
*
clone
(
const
std::vector<T*>& ptrs)
const
63
{
64
assert(ptrs.size() ==
m_arrayObjects
.size());
65
return
new
CompactBinnedArray1D
(ptrs,
m_array
,
m_binUtility
);
66
}
67
71
T*
object
(
const
Amg::Vector2D
& lp)
const
72
{
73
if
(
m_binUtility
.inside(lp)){
74
return
m_arrayObjects
[
m_array
[
m_binUtility
.bin(lp, 0)]];
75
}
76
return
nullptr
;
77
}
78
82
T*
object
(
const
Amg::Vector3D
& gp)
const
83
{
84
return
m_arrayObjects
[
m_array
[
m_binUtility
.bin(gp, 0)]];
85
}
86
89
T*
entryObject
(
const
Amg::Vector3D
& gp)
const
90
{
91
return
(
m_arrayObjects
[
m_array
[
m_binUtility
.entry(gp, 0)]]);
92
}
93
96
T*
nextObject
(
const
Amg::Vector3D
& gp,
97
const
Amg::Vector3D
& mom,
98
bool
associatedResult =
true
)
const
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
}
105
107
std::span<T* const>
arrayObjects
()
108
{
109
return
std::span<T* const>(
m_arrayObjects
.begin(),
m_arrayObjects
.end());
110
}
111
113
std::span<T const * const>
arrayObjects
()
const
114
{
115
return
std::span<T const * const>(
m_arrayObjects
.begin(),
m_arrayObjects
.end());
116
}
117
119
unsigned
int
arrayObjectsNumber
()
const
{
return
m_arrayObjects
.size(); }
120
122
const
BinUtility
*
binUtility
()
const
{
return
&
m_binUtility
; }
123
125
const
BinUtility
*
layerBinUtility
(
const
Amg::Vector3D
&)
const
126
{
127
return
&
m_binUtility
;
128
}
129
131
size_t
layerBin
(
const
Amg::Vector3D
& pos)
const
132
{
133
return
m_binUtility
.bin(pos);
134
}
135
136
private
:
137
std::vector<size_t>
m_array
{};
138
std::vector<T*>
m_arrayObjects
{};
139
BinUtility
m_binUtility
{};
140
};
141
142
}
// end of namespace Trk
143
144
#endif
// TRKDETDESCRUTILS_COMPACTBINNEDARRAY1D_H
BinUtility.h
CompactBinnedArray.h
Trk::BinUtility
A generic symmetric BinUtility, for fully symmetric binning in terms of binning grid and binning type...
Definition
BinUtility.h:39
Trk::CompactBinnedArray1D::object
T * object(const Amg::Vector2D &lp) const
Returns the pointer to the templated class object from the BinnedArray, it returns nullptr if not def...
Definition
CompactBinnedArray1D.h:71
Trk::CompactBinnedArray1D::clone
CompactBinnedArray1D * clone() const
Implicit Constructor.
Definition
CompactBinnedArray1D.h:57
Trk::CompactBinnedArray1D::nextObject
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.
Definition
CompactBinnedArray1D.h:96
Trk::CompactBinnedArray1D::layerBin
size_t layerBin(const Amg::Vector3D &pos) const
Return the layer bin.
Definition
CompactBinnedArray1D.h:131
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
Trk::CompactBinnedArray1D::object
T * object(const Amg::Vector3D &gp) const
Returns the pointer to the templated class object from the BinnedArray it returns nullptr if not defi...
Definition
CompactBinnedArray1D.h:82
Trk::CompactBinnedArray1D::m_binUtility
BinUtility m_binUtility
binUtility
Definition
CompactBinnedArray1D.h:139
Trk::CompactBinnedArray1D::m_arrayObjects
std::vector< T * > m_arrayObjects
not owning pointers to objects
Definition
CompactBinnedArray1D.h:138
Trk::CompactBinnedArray1D::layerBinUtility
const BinUtility * layerBinUtility(const Amg::Vector3D &) const
Return the BinUtility.
Definition
CompactBinnedArray1D.h:125
Trk::CompactBinnedArray1D::arrayObjects
std::span< T const *const > arrayObjects() const
Return all objects of the Array const T.
Definition
CompactBinnedArray1D.h:113
Trk::CompactBinnedArray1D::arrayObjects
std::span< T *const > arrayObjects()
Return all objects of the Array non const T.
Definition
CompactBinnedArray1D.h:107
Trk::CompactBinnedArray1D::arrayObjectsNumber
unsigned int arrayObjectsNumber() const
Number of Entries in the Array.
Definition
CompactBinnedArray1D.h:119
Trk::CompactBinnedArray1D::entryObject
T * entryObject(const Amg::Vector3D &gp) const
Returns the pointer to the templated class object from the BinnedArray - entry point.
Definition
CompactBinnedArray1D.h:89
Trk::CompactBinnedArray1D::clone
CompactBinnedArray1D * clone(const std::vector< T * > &ptrs) const
Definition
CompactBinnedArray1D.h:62
Trk::CompactBinnedArray1D::binUtility
const BinUtility * binUtility() const
Return the BinUtility.
Definition
CompactBinnedArray1D.h:122
Trk::CompactBinnedArray1D::CompactBinnedArray1D
CompactBinnedArray1D(const std::vector< T * > &tclassvector, std::vector< size_t > &&indexvector, BinUtility &&bingen)
Definition
CompactBinnedArray1D.h:48
Trk::CompactBinnedArray1D::m_array
std::vector< size_t > m_array
vector of indices to objects
Definition
CompactBinnedArray1D.h:137
Trk::CompactBinnedArray
defines common utilities needed for implementation of binned material
Definition
CompactBinnedArray.h:31
bin
Definition
BinsDiffFromStripMedian.h:43
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition
GeoPrimitives.h:48
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition
GeoPrimitives.h:47
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition
FakeTrackBuilder.h:9
std
STL namespace.
Generated on
for ATLAS Offline Software by
1.17.0