LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
KDTreeLinkerToolsT.cc
Go to the documentation of this file.
1 
10 
11 namespace lar_content
12 {
13 
14 std::pair<float, float> minmax(const float a, const float b)
15 {
16  return ((b < a) ? std::pair<float, float>(b, a) : std::pair<float, float>(a, b));
17 }
18 
19 //------------------------------------------------------------------------------------------------------------------------------------------
20 
21 KDTreeBox build_2d_kd_search_region(const pandora::CaloHit *const point, const float x_span, const float z_span)
22 {
23  return build_2d_kd_search_region(point->GetPositionVector(), x_span, z_span);
24 }
25 
26 //------------------------------------------------------------------------------------------------------------------------------------------
27 
28 KDTreeBox build_2d_kd_search_region(const pandora::CartesianVector &pos, const float x_span, const float z_span)
29 {
30  const auto x_side = minmax(pos.GetX() + x_span, pos.GetX() - x_span);
31  const auto z_side = minmax(pos.GetZ() + z_span, pos.GetZ() - z_span);
32 
33  return KDTreeBox(x_side.first, x_side.second, z_side.first, z_side.second);
34 }
35 
36 //------------------------------------------------------------------------------------------------------------------------------------------
37 
38 KDTreeCube build_3d_kd_search_region(const pandora::CaloHit *const point, const float x_span, const float y_span, const float z_span)
39 {
40  return build_3d_kd_search_region(point->GetPositionVector(), x_span, y_span, z_span);
41 }
42 
43 //------------------------------------------------------------------------------------------------------------------------------------------
44 
45 KDTreeCube build_3d_kd_search_region(const pandora::CartesianVector &pos, const float x_span, const float y_span, const float z_span)
46 {
47  const auto x_side = minmax(pos.GetX() + x_span, pos.GetX() - x_span);
48  const auto y_side = minmax(pos.GetY() + y_span, pos.GetY() - y_span);
49  const auto z_side = minmax(pos.GetZ() + z_span, pos.GetZ() - z_span);
50 
51  return KDTreeCube(x_side.first, x_side.second, y_side.first, y_side.second, z_side.first, z_side.second);
52 }
53 
54 } // namespace lar_content
std::pair< float, float > minmax(const float a, const float b)
minmax
Box structure used to define 2D field. It&#39;s used in KDTree building step to divide the detector space...
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
KDTreeBoxT< 3 > KDTreeCube
KDTreeBox build_2d_kd_search_region(const pandora::CaloHit *const point, const float x_span, const float z_span)
build_2d_kd_search_region
KDTreeBoxT< 2 > KDTreeBox
Header file for the kd tree linker tools template class.