Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
srcs
larreco
test
RecoAlg
VoronoiDiagram_test.cc
Go to the documentation of this file.
1
/**
2
* @file VoronoiDiagram_test.cxx
3
* @brief Unit test for the Voronoi Diagram code in cluster3d
4
* @date February 15, 2018
5
* @author Tracy Usher (usher@slac.stanford.edu)
6
*
7
* Usage:
8
*
9
* TBD....
10
* geometry_icarus_test [ConfigurationFile [GeometryTestParameterSet]]
11
*
12
* By default, `GeometryTestParameterSet` is set to `"physics.analyzers.geotest"`.
13
*
14
*/
15
16
// ICARUS libraries
17
#include "
larreco/RecoAlg/Cluster3DAlgs/Cluster3D.h
"
18
#include "
larreco/RecoAlg/Cluster3DAlgs/Voronoi/Voronoi.h
"
19
20
// LArSoft libraries
21
22
// utility libraries
23
#include "messagefacility/MessageLogger/MessageLogger.h"
24
25
//------------------------------------------------------------------------------
26
//--- The test environment
27
//---
28
29
30
31
//------------------------------------------------------------------------------
32
//--- The tests
33
//---
34
35
/** ****************************************************************************
36
* @brief Runs the test
37
* @param argc number of arguments in argv
38
* @param argv arguments to the function
39
* @return number of detected errors (0 on success)
40
* @throw cet::exception most of error situations throw
41
*
42
* The arguments in argv are:
43
* 0. name of the executable ("Geometry_test")
44
* 1. path to the FHiCL configuration file
45
* 2. FHiCL path to the configuration of the geometry test
46
* (default: physics.analysers.geotest)
47
* 3. FHiCL path to the configuration of the geometry
48
* (default: services.Geometry)
49
*
50
*/
51
//------------------------------------------------------------------------------
52
int
main
(
int
argc,
char
const
** argv)
53
{
54
int
nErrors
(0);
55
/*
56
// This test program needs work before being released into the wild...
57
// In the meantime, comment out the guts here.
58
59
// Build a test point list
60
dcel2d::PointList pointList;
61
62
// Loop through hits and do projection to plane
63
// for(const auto& hit3D : clusterParameters.getHitPairListPtr())
64
// {
65
// Eigen::Vector3f pcaToHitVec(hit3D->getPosition()[0] - pcaCenter(0),
66
// hit3D->getPosition()[1] - pcaCenter(1),
67
// hit3D->getPosition()[2] - pcaCenter(2));
68
// Eigen::Vector3f pcaToHit = rotationMatrix * pcaToHitVec;
69
//
70
// pointList.emplace_back(dcel2d::Point(pcaToHit(0),pcaToHit(1),hit3D));
71
// }
72
73
// Make a dummy 3D hit
74
reco::ClusterHit3D clusterHit3D;
75
76
// pointList.emplace_back(dcel2d::Point(-10., 0., &clusterHit3D));
77
// pointList.emplace_back(dcel2d::Point( 0., -5., &clusterHit3D));
78
// pointList.emplace_back(dcel2d::Point( 0., 5., &clusterHit3D));
79
// pointList.emplace_back(dcel2d::Point( 10., 0., &clusterHit3D));
80
81
pointList.emplace_back(dcel2d::Point(-10., 0., &clusterHit3D));
82
pointList.emplace_back(dcel2d::Point( -5., 0., &clusterHit3D));
83
pointList.emplace_back(dcel2d::Point( 0., 0., &clusterHit3D));
84
pointList.emplace_back(dcel2d::Point( 5., 0., &clusterHit3D));
85
pointList.emplace_back(dcel2d::Point( 10., 0., &clusterHit3D));
86
87
// Sort the point vec by decreasing x, then increase y
88
pointList.sort([](const auto& left, const auto& right){return (std::abs(std::get<0>(left) - std::get<0>(right)) > std::numeric_limits<float>::epsilon()) ? std::get<0>(left) < std::get<0>(right) : std::get<1>(left) < std::get<1>(right);});
89
90
// Get some useful containers
91
dcel2d::FaceList faceList; // Keeps track of "faces" from Voronoi Diagram
92
dcel2d::VertexList vertexList; // Keeps track of "vertices" from Voronoi Diagram
93
dcel2d::HalfEdgeList halfEdgeList; // Keeps track of "halfedges" from Voronoi Diagram
94
95
// Set up the voronoi diagram builder
96
voronoi2d::VoronoiDiagram voronoiDiagram(halfEdgeList,vertexList,faceList);
97
98
// And make the diagram
99
voronoiDiagram.buildVoronoiDiagram(pointList);
100
101
// Recover the voronoi diagram vertex list and the container to store them in
102
// dcel2d::VertexList& vertexList = clusterParameters.getVertexList();
103
104
// 4. And finally we cross fingers.
105
if (nErrors > 0)
106
{
107
mf::LogError("VoronoiDiagram_test") << nErrors << " errors detected!";
108
}
109
*/
110
return
nErrors
;
111
}
// main()
112
Cluster3D.h
Voronoi.h
main
int main(int argc, char **argv)
Definition:
DetectorActivityRatePlots.cpp:996
SortModuleTimes.nErrors
int nErrors
Definition:
SortModuleTimes.py:897
Generated by
1.8.5