32#ifndef __FASTJET_DYNAMICNEARESTNEIGHBOURS_HH__
33#define __FASTJET_DYNAMICNEARESTNEIGHBOURS_HH__
40#include "fastjet/internal/numconsts.hh"
41#include "fastjet/Error.hh"
43FASTJET_BEGIN_NAMESPACE
58 EtaPhi(
double a,
double b) {first = a; second = b;}
61 if (second < 0) second += twopi;
62 if (second >= twopi) second -= twopi;
77 DnnError(
const std::string & message_in) :
Error(message_in) {}
120 virtual bool Valid(
const int index)
const = 0;
133 const std::vector<EtaPhi> & points_to_add,
134 std::vector<int> & indices_added,
135 std::vector<int> & indices_of_updated_neighbours) = 0;
141 std::vector<int> & indices_of_updated_neighbours) {
142 std::vector<int> indices_added;
143 std::vector<EtaPhi> points_to_add;
144 std::vector<int> indices_to_remove(1);
145 indices_to_remove[0] = index;
146 RemoveAndAddPoints(indices_to_remove, points_to_add, indices_added,
147 indices_of_updated_neighbours
157 const int index1,
const int index2,
160 std::vector<int> & indices_of_updated_neighbours) {
161 std::vector<int> indices_added(1);
162 std::vector<EtaPhi> points_to_add(1);
163 std::vector<int> indices_to_remove(2);
164 indices_to_remove[0] = index1;
165 indices_to_remove[1] = index2;
166 points_to_add[0] = newpoint;
167 RemoveAndAddPoints(indices_to_remove, points_to_add, indices_added,
168 indices_of_updated_neighbours
170 index3 = indices_added[0];
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 change...
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 tha...
virtual ~DynamicNearestNeighbours()
destructor – here it is now implemented
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 ...
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; ...
virtual int NearestNeighbourIndex(const int ii) const =0
Dummy initialiser — does nothing!
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)
base class corresponding to errors that can be thrown by FastJet
Shortcut for dealing with eta-phi coordinates.
void sanitize()
put things into the desired range.