|
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"
54 std::vector<float> bValues;
66 std::vector<float> bValues;
68 bValues.push_back(
min);
69 for (
size_t isb = 1; isb <= subbins; ++isb) {
70 bValues.push_back(
min + isb *
step - substep);
71 bValues.push_back(
min + isb *
step);
73 bValues.push_back(
max);
82 size_t nBins =
opt == 0 ? bValues.size() - 1 : bValues.size();
90 (bValues.back() - bValues[0]) / (
nBins),
96 BinUtility(
float phiRef, std::vector<std::pair<int, float>>& bValues)
119 const std::vector<BinningData>& bData = gbu.
binningData();
121 throw GaudiException(
"BinUtility does not support dim > 3",
"FATAL", StatusCode::FAILURE);
139 throw GaudiException(
"BinUtility",
"dimension out of bounds", StatusCode::FAILURE);
141 return (bEval >
bins(ba) - 1 ?
bins(ba) - 1 : bEval);
148 throw GaudiException(
"BinUtility",
"dimension out of bounds", StatusCode::FAILURE);
156 throw GaudiException(
"BinUtility",
"dimension out of bounds", StatusCode::FAILURE);
166 throw GaudiException(
"BinUtility",
"dimension out of bounds", StatusCode::FAILURE);
167 return m_binningData[ba].distanceToNext(position, direction);
174 throw GaudiException(
"BinUtility",
"dimension out of bounds", StatusCode::FAILURE);
175 return m_binningData[ba].orderDirection(position, direction);
185 throw GaudiException(
"BinUtility",
"dimension out of bounds", StatusCode::FAILURE);
192 std::vector<BinningData>::const_iterator bdIter =
m_binningData.begin();
194 if (!(*bdIter).inside(position))
204 std::vector<BinningData>::const_iterator bdIter =
m_binningData.begin();
206 if (!(*bdIter).inside(lposition))
215 size_t max(
size_t ba = 0)
const
223 size_t bins(
size_t ba = 0)
const
234 throw GaudiException(
"BinUtility",
"dimension out of bounds", StatusCode::FAILURE);
242 throw GaudiException(
"BinUtility",
"dimension out of bounds", StatusCode::FAILURE);
250 MsgStream&
dump(MsgStream& sl)
const
253 std::vector<BinningData>::const_iterator bdIter =
m_binningData.begin();
254 for (
size_t ibd = 0; bdIter !=
m_binningData.end(); ++bdIter, ++ibd) {
256 sl <<
" - type : " << size_t((*bdIter).type) <<
endmsg;
257 sl <<
" - option : " << size_t((*bdIter).option) <<
endmsg;
258 sl <<
" - value : " << size_t((*bdIter).binvalue) <<
endmsg;
259 sl <<
" - bins : " << (*bdIter).bins <<
endmsg;
260 sl <<
" - min/max : " << (*bdIter).min <<
" / " << (*bdIter).max <<
endmsg;
261 sl <<
" - step/sub : " << (*bdIter).step <<
" / " << (*bdIter).subStep <<
endmsg;
262 sl <<
" - boundaries : | ";
263 std::vector<float>::const_iterator bIter = (*bdIter).boundaries.begin();
264 for (; bIter != (*bdIter).boundaries.end(); ++bIter)
265 sl << (*bIter) <<
" | ";
272 std::ostream&
dump(std::ostream& sl)
const
274 sl <<
"BinUtility for " <<
m_binningData.size() <<
"-dimensional array:" << std::endl;
275 std::vector<BinningData>::const_iterator bdIter =
m_binningData.begin();
276 for (
size_t ibd = 0; bdIter !=
m_binningData.end(); ++bdIter, ++ibd) {
277 sl <<
"dimension : " << ibd << std::endl;
278 sl <<
" - type : " << size_t((*bdIter).type) << std::endl;
279 sl <<
" - option : " << size_t((*bdIter).option) << std::endl;
280 sl <<
" - value : " << size_t((*bdIter).binvalue) << std::endl;
281 sl <<
" - bins : " << (*bdIter).bins << std::endl;
282 sl <<
" - min/max : " << (*bdIter).min <<
" / " << (*bdIter).max << std::endl;
283 sl <<
" - step/sub : " << (*bdIter).step <<
" / " << (*bdIter).subStep << std::endl;
284 sl <<
" - boundaries : | ";
285 std::vector<float>::const_iterator bIter = (*bdIter).boundaries.begin();
286 for (; bIter != (*bdIter).boundaries.end(); ++bIter)
287 sl << (*bIter) <<
" | ";
305 #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 & operator=(const BinUtility &sbu)
Assignment operator Constructor.
BinUtility(float phiRef, std::vector< std::pair< int, float >> &bValues)
Constructor for binH.
void clear()
Clear the data.
BinUtility & operator+=(const BinUtility &gbu)
Operator++ to make multidimensional BinUtility.
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
BinUtility(const BinUtility &sbu)
Copy constructor.
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.
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