34#ifndef __FASTJET_DNNPLANE_HH__
35#define __FASTJET_DNNPLANE_HH__
37#include "fastjet/internal/Triangulation.hh"
38#include "fastjet/internal/DynamicNearestNeighbours.hh"
40FASTJET_BEGIN_NAMESPACE
63 DnnPlane(
const std::vector<EtaPhi> &,
const bool & verbose =
false );
77 bool Valid(
const int index)
const;
80 const std::vector<EtaPhi> & points_to_add,
81 std::vector<int> & indices_added,
82 std::vector<int> & indices_of_updated_neighbours);
87 double eta(
const int i)
const;
89 double phi(
const int i)
const;
104 std::vector<SuperVertex> _supervertex;
109 static const bool _crash_on_coincidence =
false;
115 inline double _euclid_distance(
const Point& p1,
const Point& p2)
const {
116 double distx= p1.x()-p2.x();
117 double disty= p1.y()-p2.y();
118 return distx*distx+disty*disty;
124 void _SetNearest(
const int j);
136 void _SetAndUpdateNearest(
const int j,
137 std::vector<int> & indices_of_updated_neighbours);
143 int _CheckIfVertexPresent(
const Vertex_handle & vertex,
144 const int its_index);
155 inline bool _is_closer_to(
const Point &pref,
156 const Point &candidate,
157 const Vertex_handle &near,
160 dist = _euclid_distance(pref, candidate);
161 return _is_closer_to_with_hint(pref, candidate, near, dist, mindist);
166 inline bool _is_closer_to_with_hint(
const Point &pref,
167 const Point &candidate,
168 const Vertex_handle &near,
191 if ((std::abs(dist-mindist)<DISTANCE_FOR_CGAL_CHECKS) &&
192 _is_not_null(near) &&
193 (_euclid_distance(candidate, near->point())<DISTANCE_FOR_CGAL_CHECKS)){
201 if (_verbose) std::cout <<
"using CGAL's distance ordering" << std::endl;
202 if (CGAL::compare_distance_to_point(pref, candidate, near->point())!=CGAL::LARGER){
206 }
else if (dist <= mindist) {
223 static const double DISTANCE_FOR_CGAL_CHECKS;
231 inline static bool _is_not_null(
const Vertex_handle & vh) {
239 return vh.operator->();
249 return _supervertex[ii].NNindex;}
252 return _supervertex[ii].NNdistance;}
255 if (index >= 0 && index <
static_cast<int>(_supervertex.size())) {
256 return _is_not_null(_supervertex[index].vertex);
265 Point * p = & (_supervertex[i].vertex->point());
266 return EtaPhi(p->x(),p->y()); }
269 return _supervertex[i].vertex->point().x(); }
272 return _supervertex[i].vertex->point().y(); }
DnnPlane(const std::vector< EtaPhi > &, const bool &verbose=false)
Initialiser from a set of points on an Eta-Phi plane, where both eta and phi can have arbitrary range...
double NearestNeighbourDistance(const int ii) const
Returns the distance to the nearest neighbour of point labelled by index ii (assumes ii is valid).
double phi(const int i) const
returns the phi point with index i.
bool Valid(const int index) const
Returns true iff the given index corresponds to a point that exists in the DNN structure (meaning tha...
int NearestNeighbourIndex(const int ii) const
Returns the index of the nearest neighbour of point labelled by ii (assumes ii is valid).
double eta(const int i) const
returns the eta point with index i.
void RemoveAndAddPoints(const std::vector< int > &indices_to_remove, const std::vector< EtaPhi > &points_to_add, std::vector< int > &indices_added, std::vector< int > &indices_of_updated_neighbours)
remove the points labelled by the vector indices_to_remove, and add the points specified by the vecto...
EtaPhi etaphi(const int i) const
returns the EtaPhi of point with index i.
DnnPlane()
empty initaliser
Shortcut for dealing with eta-phi coordinates.