30 #ifndef DROP_CGAL // in case we do not have the code for CGAL
31 #ifndef __FASTJET_DNN3PICYLINDER_HH__
32 #define __FASTJET_DNN3PICYLINDER_HH__
34 #include "fastjet/internal/DynamicNearestNeighbours.hh"
35 #include "fastjet/internal/DnnPlane.hh"
36 #include "fastjet/internal/numconsts.hh"
38 FASTJET_BEGIN_NAMESPACE
47 class Dnn3piCylinder :
public DynamicNearestNeighbours {
66 Dnn3piCylinder(
const std::vector<EtaPhi> &,
67 const bool & ignore_nearest_is_mirror =
false,
68 const bool & verbose =
false );
72 int NearestNeighbourIndex(
const int & ii)
const ;
76 double NearestNeighbourDistance(
const int & ii)
const ;
81 bool Valid(
const int & index)
const;
83 void RemoveAndAddPoints(
const std::vector<int> & indices_to_remove,
84 const std::vector<EtaPhi> & points_to_add,
85 std::vector<int> & indices_added,
86 std::vector<int> & indices_of_updated_neighbours);
93 const static int INEXISTENT_VERTEX=-3;
97 bool _ignore_nearest_is_mirror;
137 struct MirrorVertexInfo {
150 std::vector<MirrorVertexInfo> _mirror_info;
154 std::vector<int> _cylinder_index_of_plane_vertex;
164 inline EtaPhi _remap_phi(
const EtaPhi & point) {
165 double phi = point.second;
166 if (phi < pi) { phi += twopi ;}
167 return EtaPhi(point.first, phi);}
189 void _RegisterCylinderPoint (
const EtaPhi & cylinder_point,
190 std::vector<EtaPhi> & plane_points);
206 inline int Dnn3piCylinder::NearestNeighbourIndex(
const int & current)
const {
207 int main_index = _mirror_info[current].main_index;
208 int mirror_index = _mirror_info[current].mirror_index;
210 if (mirror_index == INEXISTENT_VERTEX ) {
211 plane_index = _DNN->NearestNeighbourIndex(main_index);
214 _DNN->NearestNeighbourDistance(main_index) <
215 _DNN->NearestNeighbourDistance(mirror_index)) ?
216 _DNN->NearestNeighbourIndex(main_index) :
217 _DNN->NearestNeighbourIndex(mirror_index) ;
219 int this_cylinder_index = _cylinder_index_of_plane_vertex[plane_index];
223 assert(_ignore_nearest_is_mirror || this_cylinder_index != current);
228 return this_cylinder_index;
231 inline double Dnn3piCylinder::NearestNeighbourDistance(
const int & current)
const {
232 int main_index = _mirror_info[current].main_index;
233 int mirror_index = _mirror_info[current].mirror_index;
234 if (mirror_index == INEXISTENT_VERTEX ) {
235 return _DNN->NearestNeighbourDistance(main_index);
238 _DNN->NearestNeighbourDistance(main_index) <
239 _DNN->NearestNeighbourDistance(mirror_index)) ?
240 _DNN->NearestNeighbourDistance(main_index) :
241 _DNN->NearestNeighbourDistance(mirror_index) ;
246 inline bool Dnn3piCylinder::Valid(
const int & index)
const {
247 return (_DNN->Valid(_mirror_info[index].main_index));
251 inline Dnn3piCylinder::~Dnn3piCylinder() {
256 FASTJET_END_NAMESPACE
258 #endif // __FASTJET_DNN3PICYLINDER_HH__