class derived from DynamicNearestNeighbours that provides an implementation for the Euclidean plane More...
#include <DnnPlane.hh>
Classes | |
struct | SuperVertex |
Structure containing a vertex_handle and cached information on the nearest neighbour. More... | |
Public Member Functions | |
DnnPlane () | |
empty initaliser | |
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 ranges. | |
int | NearestNeighbourIndex (const int &ii) const |
Returns the index of the nearest neighbour of point labelled by ii (assumes ii is valid). | |
double | NearestNeighbourDistance (const int &ii) const |
Returns the distance to the nearest neighbour of point labelled by index ii (assumes ii is valid). | |
bool | Valid (const int &index) const |
Returns true iff the given index corresponds to a point that exists in the DNN structure (meaning that it has been added, and not removed in the meantime). | |
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 std::vector indices_to_remove, and add the points specified by the std::vector points_to_add (corresponding indices will be calculated automatically); the idea behind this routine is that the points to be added will somehow be close to the one or other of the points being removed and this can be used by the implementation to provide hints for inserting the new points in whatever structure it is using. | |
EtaPhi | etaphi (const int i) const |
returns the EtaPhi of point with index i. | |
double | eta (const int i) const |
returns the eta point with index i. | |
double | phi (const int i) const |
returns the phi point with index i. | |
Private Member Functions | |
double | _euclid_distance (const Point &p1, const Point &p2) const |
CGAL object for dealing with triangulations. | |
void | _SetNearest (const int &j) |
Determines the index and distance of the nearest neighbour to point j and puts the information into the _supervertex entry for j. | |
void | _SetAndUpdateNearest (const int &j, std::vector< int > &indices_of_updated_neighbours) |
Determines and stores the nearest neighbour of j. | |
void | _CrashIfVertexPresent (const Vertex_handle &vertex, const int &its_index) |
given a vertex_handle returned by CGAL on insertion of a new points, crash if it turns out that it corresponds to a vertex that we already knew about (usually because two points coincide) | |
Private Attributes | |
std::vector< SuperVertex > | _supervertex |
bool | _verbose |
Triangulation | _TR |
Static Private Attributes | |
static const bool | _crash_on_coincidence = true |
class derived from DynamicNearestNeighbours that provides an implementation for the Euclidean plane
Definition at line 45 of file DnnPlane.hh.
fastjet::DnnPlane::DnnPlane | ( | ) | [inline] |
fastjet::DnnPlane::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 ranges.
void fastjet::DnnPlane::_CrashIfVertexPresent | ( | const Vertex_handle & | vertex, | |
const int & | its_index | |||
) | [private] |
given a vertex_handle returned by CGAL on insertion of a new points, crash if it turns out that it corresponds to a vertex that we already knew about (usually because two points coincide)
double fastjet::DnnPlane::_euclid_distance | ( | const Point & | p1, | |
const Point & | p2 | |||
) | const [inline, private] |
CGAL object for dealing with triangulations.
calculates and returns the euclidean distance between points p1 and p2
Definition at line 102 of file DnnPlane.hh.
References fastjet::Point::x, and fastjet::Point::y.
void fastjet::DnnPlane::_SetAndUpdateNearest | ( | const int & | j, | |
std::vector< int > & | indices_of_updated_neighbours | |||
) | [private] |
Determines and stores the nearest neighbour of j.
For each voronoi neighbour D of j if the distance between j and D is less than D's own nearest neighbour, then update the nearest-neighbour info in D; push D's index onto indices_of_updated_neighbours
Note that j is NOT pushed onto indices_of_updated_neighbours -- if you want it there, put it there yourself.
void fastjet::DnnPlane::_SetNearest | ( | const int & | j | ) | [private] |
Determines the index and distance of the nearest neighbour to point j and puts the information into the _supervertex entry for j.
double fastjet::DnnPlane::eta | ( | const int | i | ) | const [inline] |
returns the eta point with index i.
Definition at line 152 of file DnnPlane.hh.
References _supervertex.
00152 { 00153 return _supervertex[i].vertex->point().x(); }
EtaPhi fastjet::DnnPlane::etaphi | ( | const int | i | ) | const [inline] |
returns the EtaPhi of point with index i.
Definition at line 148 of file DnnPlane.hh.
References _supervertex, fastjet::Point::x, and fastjet::Point::y.
00148 { 00149 Point * p = & (_supervertex[i].vertex->point()); 00150 return EtaPhi(p->x(),p->y()); }
double fastjet::DnnPlane::NearestNeighbourDistance | ( | const int & | ii | ) | const [inline, virtual] |
Returns the distance to the nearest neighbour of point labelled by index ii (assumes ii is valid).
Implements fastjet::DynamicNearestNeighbours.
Definition at line 141 of file DnnPlane.hh.
References _supervertex.
Referenced by fastjet::Dnn4piCylinder::NearestNeighbourDistance(), fastjet::Dnn3piCylinder::NearestNeighbourDistance(), fastjet::Dnn2piCylinder::NearestNeighbourDistance(), fastjet::Dnn4piCylinder::NearestNeighbourIndex(), fastjet::Dnn3piCylinder::NearestNeighbourIndex(), and fastjet::Dnn2piCylinder::NearestNeighbourIndex().
00141 { 00142 return _supervertex[ii].NNdistance;}
int fastjet::DnnPlane::NearestNeighbourIndex | ( | const int & | ii | ) | const [inline, virtual] |
Returns the index of the nearest neighbour of point labelled by ii (assumes ii is valid).
Implements fastjet::DynamicNearestNeighbours.
Definition at line 138 of file DnnPlane.hh.
References _supervertex.
Referenced by fastjet::Dnn4piCylinder::NearestNeighbourIndex(), fastjet::Dnn3piCylinder::NearestNeighbourIndex(), and fastjet::Dnn2piCylinder::NearestNeighbourIndex().
00138 { 00139 return _supervertex[ii].NNindex;}
double fastjet::DnnPlane::phi | ( | const int | i | ) | const [inline] |
returns the phi point with index i.
Definition at line 155 of file DnnPlane.hh.
References _supervertex.
00155 { 00156 return _supervertex[i].vertex->point().y(); }
void fastjet::DnnPlane::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 | |||
) | [virtual] |
remove the points labelled by the std::vector indices_to_remove, and add the points specified by the std::vector points_to_add (corresponding indices will be calculated automatically); the idea behind this routine is that the points to be added will somehow be close to the one or other of the points being removed and this can be used by the implementation to provide hints for inserting the new points in whatever structure it is using.
In a kt-algorithm the points being added will be a result of a combination of the points to be removed -- hence the proximity is (more or less) guaranteed.
Implements fastjet::DynamicNearestNeighbours.
bool fastjet::DnnPlane::Valid | ( | const int & | index | ) | const [inline, virtual] |
Returns true iff the given index corresponds to a point that exists in the DNN structure (meaning that it has been added, and not removed in the meantime).
Implements fastjet::DynamicNearestNeighbours.
Definition at line 144 of file DnnPlane.hh.
References _supervertex.
Referenced by fastjet::Dnn4piCylinder::Valid(), fastjet::Dnn3piCylinder::Valid(), and fastjet::Dnn2piCylinder::Valid().
00144 { 00145 if (index >= 0 && index < static_cast<int>(_supervertex.size())) { 00146 return (_supervertex[index].vertex != NULL);} else {return false;} }
const bool fastjet::DnnPlane::_crash_on_coincidence = true [static, private] |
Definition at line 95 of file DnnPlane.hh.
std::vector<SuperVertex> fastjet::DnnPlane::_supervertex [private] |
Definition at line 91 of file DnnPlane.hh.
Referenced by eta(), etaphi(), NearestNeighbourDistance(), NearestNeighbourIndex(), phi(), and Valid().
Triangulation fastjet::DnnPlane::_TR [private] |
Definition at line 98 of file DnnPlane.hh.
bool fastjet::DnnPlane::_verbose [private] |
Definition at line 93 of file DnnPlane.hh.