30 #ifndef __FASTJET_DYNAMICNEARESTNEIGHBOURS_HH__
31 #define __FASTJET_DYNAMICNEARESTNEIGHBOURS_HH__
38 #include "fastjet/internal/numconsts.hh"
40 FASTJET_BEGIN_NAMESPACE
55 EtaPhi(
double a,
double b) {first = a; second = b;}
58 if (second < 0) second += twopi;
59 if (second >= twopi) second -= twopi;
74 DnnError(
const std::string & message_in) {
75 _message = message_in; std::cerr << message_in << std::endl;};
77 std::string message()
const {
return _message;};
101 class DynamicNearestNeighbours {
114 virtual int NearestNeighbourIndex(
const int & ii)
const = 0;
118 virtual double NearestNeighbourDistance(
const int & ii)
const = 0;
123 virtual bool Valid(
const int & index)
const = 0;
135 virtual void RemoveAndAddPoints(
const std::vector<int> & indices_to_remove,
136 const std::vector<EtaPhi> & points_to_add,
137 std::vector<int> & indices_added,
138 std::vector<int> & indices_of_updated_neighbours) = 0;
143 inline void RemovePoint (
const int & index,
144 std::vector<int> & indices_of_updated_neighbours) {
145 std::vector<int> indices_added;
146 std::vector<EtaPhi> points_to_add;
147 std::vector<int> indices_to_remove(1);
148 indices_to_remove[0] = index;
149 RemoveAndAddPoints(indices_to_remove, points_to_add, indices_added,
150 indices_of_updated_neighbours
159 inline void RemoveCombinedAddCombination(
160 const int & index1,
const int & index2,
161 const EtaPhi & newpoint,
163 std::vector<int> & indices_of_updated_neighbours) {
164 std::vector<int> indices_added(1);
165 std::vector<EtaPhi> points_to_add(1);
166 std::vector<int> indices_to_remove(2);
167 indices_to_remove[0] = index1;
168 indices_to_remove[1] = index2;
169 points_to_add[0] = newpoint;
170 RemoveAndAddPoints(indices_to_remove, points_to_add, indices_added,
171 indices_of_updated_neighbours
173 index3 = indices_added[0];
177 virtual ~DynamicNearestNeighbours () {}
181 FASTJET_END_NAMESPACE
183 #endif // __FASTJET_DYNAMICNEARESTNEIGHBOURS_HH__
Shortcut for dealing with eta-phi coordinates.
void sanitize()
put things into the desired range.