Functions
VoronoiDiagram_test.cc File Reference
#include "larreco/RecoAlg/Cluster3DAlgs/Cluster3D.h"
#include "larreco/RecoAlg/Cluster3DAlgs/Voronoi/Voronoi.h"
#include "messagefacility/MessageLogger/MessageLogger.h"

Go to the source code of this file.

Functions

int main (int argc, char const **argv)
 Runs the test. More...
 

Function Documentation

int main ( int  argc,
char const **  argv 
)

Runs the test.


Parameters
argcnumber of arguments in argv
argvarguments to the function
Returns
number of detected errors (0 on success)
Exceptions
cet::exceptionmost of error situations throw

The arguments in argv are: 0. name of the executable ("Geometry_test")

  1. path to the FHiCL configuration file
  2. FHiCL path to the configuration of the geometry test (default: physics.analysers.geotest)
  3. FHiCL path to the configuration of the geometry (default: services.Geometry)

Definition at line 52 of file VoronoiDiagram_test.cc.

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()