fastjet::DynamicNearestNeighbours Class Reference

Abstract base class for quick location of nearest neighbours in a set of points, with facilities for adding and removing points from the set after initialisation. More...

#include <DynamicNearestNeighbours.hh>

Inheritance diagram for fastjet::DynamicNearestNeighbours:

Inheritance graph
fastjet::Dnn2piCylinderfastjet::Dnn3piCylinderfastjet::Dnn4piCylinderfastjet::DnnPlane
[legend]
List of all members.

Public Member Functions

virtual int NearestNeighbourIndex (const int &ii) const =0
 Returns the index of the nearest neighbour of point labelled by ii (assumes ii is valid).
virtual double NearestNeighbourDistance (const int &ii) const =0
 Returns the distance to the nearest neighbour of point labelled by index ii (assumes ii is valid).
virtual bool Valid (const int &index) const=0
 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).
virtual 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)=0
 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.
void RemovePoint (const int &index, std::vector< int > &indices_of_updated_neighbours)
 Remove the point labelled by index and return the list of points whose nearest neighbours have changed in the process.
void RemoveCombinedAddCombination (const int &index1, const int &index2, const EtaPhi &newpoint, int &index3, std::vector< int > &indices_of_updated_neighbours)
 Removes the two points labelled by index1, index2 and adds in the a point with coordinates newpoint; it returns an index for the new point (index 3) and a std::vector of indices of neighbours whose nearest neighbour has changed (the list includes index3, i.e.
virtual ~DynamicNearestNeighbours ()
 destructor -- here it is now implemented

Detailed Description

Abstract base class for quick location of nearest neighbours in a set of points, with facilities for adding and removing points from the set after initialisation.

Derived classes will be named according to the convention DnnSomeName (e.g. DnnPlane).

The main purpose of this abstract base class is to define the general interface of a whole set of classes that deal with nearest-neighbour location on different 2-d geometries and with various underlying data structures and algorithms.

Definition at line 89 of file DynamicNearestNeighbours.hh.


Constructor & Destructor Documentation

virtual fastjet::DynamicNearestNeighbours::~DynamicNearestNeighbours (  )  [inline, virtual]

destructor -- here it is now implemented

Definition at line 165 of file DynamicNearestNeighbours.hh.

00165 {}


Member Function Documentation

virtual int fastjet::DynamicNearestNeighbours::NearestNeighbourIndex ( const int &  ii  )  const [pure virtual]

Returns the index of the nearest neighbour of point labelled by ii (assumes ii is valid).

Implemented in fastjet::Dnn2piCylinder, fastjet::Dnn3piCylinder, fastjet::Dnn4piCylinder, and fastjet::DnnPlane.

Referenced by fastjet::ClusterSequence::_add_ktdistance_to_map().

virtual double fastjet::DynamicNearestNeighbours::NearestNeighbourDistance ( const int &  ii  )  const [pure virtual]

Returns the distance to the nearest neighbour of point labelled by index ii (assumes ii is valid).

Implemented in fastjet::Dnn2piCylinder, fastjet::Dnn3piCylinder, fastjet::Dnn4piCylinder, and fastjet::DnnPlane.

Referenced by fastjet::ClusterSequence::_add_ktdistance_to_map().

virtual bool fastjet::DynamicNearestNeighbours::Valid ( const int &  index  )  const [pure 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).

Implemented in fastjet::Dnn2piCylinder, fastjet::Dnn3piCylinder, fastjet::Dnn4piCylinder, and fastjet::DnnPlane.

Referenced by fastjet::ClusterSequence::_delaunay_cluster().

virtual void fastjet::DynamicNearestNeighbours::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 
) [pure 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.

Implemented in fastjet::Dnn2piCylinder, fastjet::Dnn3piCylinder, fastjet::Dnn4piCylinder, and fastjet::DnnPlane.

void fastjet::DynamicNearestNeighbours::RemovePoint ( const int &  index,
std::vector< int > &  indices_of_updated_neighbours 
) [inline]

Remove the point labelled by index and return the list of points whose nearest neighbours have changed in the process.

Definition at line 131 of file DynamicNearestNeighbours.hh.

Referenced by fastjet::ClusterSequence::_delaunay_cluster().

00132                                                                            {
00133     std::vector<int> indices_added;
00134     std::vector<EtaPhi> points_to_add;
00135     std::vector<int> indices_to_remove(1);
00136     indices_to_remove[0] = index;
00137     RemoveAndAddPoints(indices_to_remove, points_to_add, indices_added,
00138                        indices_of_updated_neighbours
00139                        );};

void fastjet::DynamicNearestNeighbours::RemoveCombinedAddCombination ( const int &  index1,
const int &  index2,
const EtaPhi newpoint,
int &  index3,
std::vector< int > &  indices_of_updated_neighbours 
) [inline]

Removes the two points labelled by index1, index2 and adds in the a point with coordinates newpoint; it returns an index for the new point (index 3) and a std::vector of indices of neighbours whose nearest neighbour has changed (the list includes index3, i.e.

the new point).

Definition at line 147 of file DynamicNearestNeighbours.hh.

Referenced by fastjet::ClusterSequence::_delaunay_cluster().

00151                                                                         {
00152     std::vector<int> indices_added(1);
00153     std::vector<EtaPhi> points_to_add(1);
00154     std::vector<int> indices_to_remove(2);
00155     indices_to_remove[0] = index1;
00156     indices_to_remove[1] = index2;
00157     points_to_add[0] = newpoint;
00158     RemoveAndAddPoints(indices_to_remove, points_to_add, indices_added,
00159                        indices_of_updated_neighbours
00160                        );
00161     index3 = indices_added[0];
00162   };


The documentation for this class was generated from the following file:
Generated on Thu Jan 3 19:05:21 2008 for fastjet by  doxygen 1.5.2