8#ifndef LAR_KD_TREE_LINKER_TOOLS_TEMPLATED_H
9#define LAR_KD_TREE_LINKER_TOOLS_TEMPLATED_H 1
35template <
unsigned DIM>
49 template <
typename... Ts>
65template <
typename DATA,
unsigned DIM>
80 template <
typename... Ts>
84 std::array<float, DIM>
dims;
92template <
typename DATA,
unsigned DIM>
151std::pair<float, float>
minmax(
const float a,
const float b);
224template <
unsigned DIM>
231template <
unsigned DIM>
232template <
typename... Ts>
235 static_assert(
sizeof...(dimargs) == 2 * DIM,
"Constructor requires 2*DIM args");
236 std::vector<float> dims = {dimargs...};
238 for (
unsigned i = 0; i < DIM; ++i)
240 dimmin[i] = dims[2 * i];
241 dimmax[i] = dims[2 * i + 1];
248template <
typename DATA,
unsigned DIM>
255template <
typename DATA,
unsigned DIM>
256template <
typename... Ts>
264template <
typename DATA,
unsigned DIM>
271template <
typename DATA,
unsigned DIM>
280template <
typename DATA,
unsigned DIM>
291 return t->GetPosition();
311 std::array<float, 2> minpos{{0.f, 0.f}}, maxpos{{0.f, 0.f}};
315 for (
const T *
const point : points)
318 nodes.emplace_back(point, pos.
GetX(), pos.
GetZ());
322 minpos[0] = pos.
GetX();
323 minpos[1] = pos.
GetZ();
324 maxpos[0] = pos.
GetX();
325 maxpos[1] = pos.
GetZ();
329 minpos[0] = std::min(pos.
GetX(), minpos[0]);
330 minpos[1] = std::min(pos.
GetZ(), minpos[1]);
331 maxpos[0] = std::max(pos.
GetX(), maxpos[0]);
332 maxpos[1] = std::max(pos.
GetZ(), maxpos[1]);
338 return KDTreeBox(minpos[0], maxpos[0], minpos[1], maxpos[1]);
346 std::array<float, 3> minpos{{0.f, 0.f, 0.f}}, maxpos{{0.f, 0.f, 0.f}};
350 for (
const T *
const point : points)
353 nodes.emplace_back(point, pos.
GetX(), pos.
GetY(), pos.
GetZ());
357 minpos[0] = pos.
GetX();
358 minpos[1] = pos.
GetY();
359 minpos[2] = pos.
GetZ();
360 maxpos[0] = pos.
GetX();
361 maxpos[1] = pos.
GetY();
362 maxpos[2] = pos.
GetZ();
366 minpos[0] = std::min(pos.
GetX(), minpos[0]);
367 minpos[1] = std::min(pos.
GetY(), minpos[1]);
368 minpos[2] = std::min(pos.
GetZ(), minpos[2]);
369 maxpos[0] = std::max(pos.
GetX(), maxpos[0]);
370 maxpos[1] = std::max(pos.
GetY(), maxpos[1]);
371 maxpos[2] = std::max(pos.
GetZ(), maxpos[2]);
377 return KDTreeCube(minpos[0], maxpos[0], minpos[1], maxpos[1], minpos[2], maxpos[2]);
Header file for the calo hit class.
Header file for the cartesian vector class.
Header file for the pandora content api class.
Header file defining relevant internal typedefs, sort and string conversion functions.
Box structure used to define 2D field. It's used in KDTree building step to divide the detector space...
std::array< float, DIM > dimmax
KDTreeBoxT()
Default constructor.
std::array< float, DIM > dimmin
Data stored in each KDTree node. The dim1/dim2 fields are usually the duplication of some PFRecHit va...
std::array< float, DIM > dims
KDTreeNodeInfoT(const DATA &d, Ts... dimargs)
Constructor.
KDTreeNodeInfoT()
Default constructor.
KDTreeNodeT()
Default constructor.
KDTreeBoxT< DIM > region
Region bounding box.
KDTreeNodeT< DATA, DIM > * left
Left son.
void setAttributs(const KDTreeBoxT< DIM > ®ionBox)
setAttributs
void setAttributs(const KDTreeBoxT< DIM > ®ionBox, const KDTreeNodeInfoT< DATA, DIM > &infoToStore)
setAttributs
KDTreeNodeInfoT< DATA, DIM > info
Data.
KDTreeNodeT< DATA, DIM > * right
Right son.
static const pandora::CartesianVector & position(const T *const t)
position
const CartesianVector & GetPositionVector() const
Get the position vector of center of calorimeter cell, units mm.
float GetX() const
Get the cartesian x coordinate.
float GetZ() const
Get the cartesian z coordinate.
float GetY() const
Get the cartesian y coordinate.
KDTreeBox fill_and_bound_2d_kd_tree(const MANAGED_CONTAINER< const T * > &points, std::vector< KDTreeNodeInfoT< const T *, 2 > > &nodes)
fill_and_bound_2d_kd_tree
KDTreeBoxT< 2 > KDTreeBox
KDTreeBoxT< 3 > KDTreeCube
std::pair< float, float > minmax(const float a, const float b)
minmax
KDTreeCube fill_and_bound_3d_kd_tree(const MANAGED_CONTAINER< const T * > &points, std::vector< KDTreeNodeInfoT< const T *, 3 > > &nodes)
fill_and_bound_3d_kd_tree
KDTreeBox build_2d_kd_search_region(const pandora::CaloHit *const point, const float x_span, const float z_span)
build_2d_kd_search_region
KDTreeCube build_3d_kd_search_region(const pandora::CaloHit *const point, const float x_span, const float y_span, const float z_span)
build_3d_kd_search_region