32 #ifndef __FASTJET_DYNAMICNEARESTNEIGHBOURS_HH__ 33 #define __FASTJET_DYNAMICNEARESTNEIGHBOURS_HH__ 40 #include "fastjet/internal/numconsts.hh" 41 #include "fastjet/Error.hh" 43 FASTJET_BEGIN_NAMESPACE
58 EtaPhi(
double a,
double b) {first = a; second = b;}
61 if (second < 0) second += twopi;
62 if (second >= twopi) second -= twopi;
73 class DnnError :
public Error {
77 DnnError(
const std::string & message_in) :
Error(message_in) {}
98 class DynamicNearestNeighbours {
111 virtual int NearestNeighbourIndex(
const int ii)
const = 0;
115 virtual double NearestNeighbourDistance(
const int ii)
const = 0;
120 virtual bool Valid(
const int index)
const = 0;
132 virtual void RemoveAndAddPoints(
const std::vector<int> & indices_to_remove,
133 const std::vector<EtaPhi> & points_to_add,
134 std::vector<int> & indices_added,
135 std::vector<int> & indices_of_updated_neighbours) = 0;
140 inline void RemovePoint (
const int index,
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
156 inline void RemoveCombinedAddCombination(
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];
174 virtual ~DynamicNearestNeighbours () {}
178 FASTJET_END_NAMESPACE
180 #endif // __FASTJET_DYNAMICNEARESTNEIGHBOURS_HH__ Shortcut for dealing with eta-phi coordinates.
void sanitize()
put things into the desired range.
base class corresponding to errors that can be thrown by FastJet