 |
ATLAS Offline Software
|
Go to the documentation of this file.
9 #ifndef TRKDETDESCRUTILS_GENERICBINUTILITY1D_H
10 #define TRKDETDESCRUTILS_GENERICBINUTILITY1D_H
13 #include "GaudiKernel/GaudiException.h"
59 std::vector<float> bValues;
71 std::vector<float> bValues;
73 bValues.push_back(
min);
74 for (
size_t isb = 1; isb <= subbins; ++isb) {
75 bValues.push_back(
min + isb *
step - substep);
76 bValues.push_back(
min + isb *
step);
78 bValues.push_back(
max);
87 size_t nBins =
opt == 0 ? bValues.size() - 1 : bValues.size();
95 (bValues.back() - bValues[0]) / (
nBins),
101 BinUtility(
float phiRef, std::vector<std::pair<int, float>>& bValues)
111 const std::vector<BinningData>& bData = gbu.
binningData();
113 throw GaudiException(
"BinUtility does not support dim > 3",
"FATAL", StatusCode::FAILURE);
129 throw GaudiException(
"BinUtility",
"dimension out of bounds", StatusCode::FAILURE);
132 return (bEval >
bins(ba) - 1 ?
bins(ba) - 1 : bEval);
139 throw GaudiException(
"BinUtility",
"dimension out of bounds", StatusCode::FAILURE);
148 throw GaudiException(
"BinUtility",
"dimension out of bounds", StatusCode::FAILURE);
159 throw GaudiException(
"BinUtility",
"dimension out of bounds", StatusCode::FAILURE);
161 return m_binningData[ba].distanceToNext(position, direction);
168 throw GaudiException(
"BinUtility",
"dimension out of bounds", StatusCode::FAILURE);
170 return m_binningData[ba].orderDirection(position, direction);
180 throw GaudiException(
"BinUtility",
"dimension out of bounds", StatusCode::FAILURE);
188 std::vector<BinningData>::const_iterator bdIter =
m_binningData.begin();
190 if (!(*bdIter).inside(position))
200 std::vector<BinningData>::const_iterator bdIter =
m_binningData.begin();
202 if (!(*bdIter).inside(lposition)){
212 size_t max(
size_t ba = 0)
const
221 size_t bins(
size_t ba = 0)
const
233 throw GaudiException(
"BinUtility",
"dimension out of bounds", StatusCode::FAILURE);
242 throw GaudiException(
"BinUtility",
"dimension out of bounds", StatusCode::FAILURE);
251 MsgStream&
dump(MsgStream& sl)
const
254 std::vector<BinningData>::const_iterator bdIter =
m_binningData.begin();
255 for (
size_t ibd = 0; bdIter !=
m_binningData.end(); ++bdIter, ++ibd) {
257 sl <<
" - type : " << size_t((*bdIter).type) <<
endmsg;
258 sl <<
" - option : " << size_t((*bdIter).option) <<
endmsg;
259 sl <<
" - value : " << size_t((*bdIter).binvalue) <<
endmsg;
260 sl <<
" - bins : " << (*bdIter).bins <<
endmsg;
261 sl <<
" - min/max : " << (*bdIter).min <<
" / " << (*bdIter).max <<
endmsg;
262 sl <<
" - step/sub : " << (*bdIter).step <<
" / " << (*bdIter).subStep <<
endmsg;
263 sl <<
" - boundaries : | ";
264 std::vector<float>::const_iterator bIter = (*bdIter).boundaries.begin();
265 for (; bIter != (*bdIter).boundaries.end(); ++bIter)
266 sl << (*bIter) <<
" | ";
273 std::ostream&
dump(std::ostream& sl)
const
275 sl <<
"BinUtility for " <<
m_binningData.size() <<
"-dimensional array:" << std::endl;
276 std::vector<BinningData>::const_iterator bdIter =
m_binningData.begin();
277 for (
size_t ibd = 0; bdIter !=
m_binningData.end(); ++bdIter, ++ibd) {
278 sl <<
"dimension : " << ibd << std::endl;
279 sl <<
" - type : " << size_t((*bdIter).type) << std::endl;
280 sl <<
" - option : " << size_t((*bdIter).option) << std::endl;
281 sl <<
" - value : " << size_t((*bdIter).binvalue) << std::endl;
282 sl <<
" - bins : " << (*bdIter).bins << std::endl;
283 sl <<
" - min/max : " << (*bdIter).min <<
" / " << (*bdIter).max << std::endl;
284 sl <<
" - step/sub : " << (*bdIter).step <<
" / " << (*bdIter).subStep << std::endl;
285 sl <<
" - boundaries : | ";
286 std::vector<float>::const_iterator bIter = (*bdIter).boundaries.begin();
287 for (; bIter != (*bdIter).boundaries.end(); ++bIter)
288 sl << (*bIter) <<
" | ";
306 #endif // TRKDETDESCRUTILS_GENERICBINUTILITY1D_H
BinUtility(size_t subbins, float substep, float min, float max, BinningOption opt=open, BinningValue value=binR)
Constructor for bi-equidistant.
size_t entry(const Amg::Vector3D &position, size_t ba=0) const
Bin from a 3D vector (already in binning frame)
size_t dimensions() const
First bin maximal value.
LayerOrder orderDirection(const Amg::Vector3D &position, const Amg::Vector3D &direction, size_t ba=0) const
Return the oder direciton for fast interlinking.
size_t max(size_t ba=0) const
First bin maximal value.
Eigen::Matrix< double, 2, 1 > Vector2D
std::pair< size_t, float > distanceToNext(const Amg::Vector3D &position, const Amg::Vector3D &direction, size_t ba=0) const
Distance estimate to next bin
BinUtility(float phiRef, std::vector< std::pair< int, float >> &bValues)
Constructor for binH.
void clear()
Clear the data.
BinUtility & operator=(BinUtility &&sbu)=default
BinUtility & operator+=(const BinUtility &gbu)
Operator++ to make multidimensional BinUtility.
BinUtility(const BinUtility &sbu)=default
BinUtility(BinUtility &&sbu)=default
size_t bins(size_t ba=0) const
Number of bins.
BinUtility(size_t bins, float min, float max, BinningOption opt=open, BinningValue value=binR, float sStep=0.)
Constructor for equidistant - the substep is for phi binning offsets
BinUtility(std::vector< float > &bValues, BinningOption opt=closed, BinningValue value=binPhi)
Constructor for arbitrary.
BinUtility()
Constructor for equidistant.
BinningValue
how to take the global / local position
MsgStream & dump(MsgStream &sl) const
Output Method for MsgStream, to be overloaded by child classes.
bool inside(const Amg::Vector2D &lposition) const
Check if bin is inside from Vector3D.
size_t bin(const Amg::Vector2D &lposition, size_t ba=0) const
Bin from a 2D vector (following local parameters defintitions)
std::ostream & dump(std::ostream &sl) const
Output Method for std::ostream, to be overloaded by child classes.
BinUtility & operator=(const BinUtility &sbu)=default
BinningValue binningValue(size_t ba=0) const
The type/value of the binning.
Ensure that the ATLAS eigen extensions are properly loaded.
bool inside(const Amg::Vector3D &position) const
Check if bin is inside from Vector3D.
Eigen::Matrix< double, 3, 1 > Vector3D
MsgStream & operator<<(MsgStream &sl, const AlignModule &alignModule)
overload of << operator for MsgStream for debug output
std::vector< BinningData > m_binningData
BinUtility * clone() const
Implizit Constructor.
float binPosition(size_t bin, float pos, size_t ba=0) const
bin->BinningValue navigation : pos=+-1.
size_t bin(const Amg::Vector3D &position, size_t ba=0) const
Bin from a 3D vector (already in binning frame)
const std::vector< BinningData > & binningData() const
return the binning data
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)
BinningOption
enum BinValue