32 #ifndef DROP_CGAL // in case we do not have the code for CGAL 
   33 #ifndef __FASTJET_DNN3PICYLINDER_HH__ 
   34 #define __FASTJET_DNN3PICYLINDER_HH__ 
   36 #include "fastjet/internal/DynamicNearestNeighbours.hh" 
   37 #include "fastjet/internal/DnnPlane.hh" 
   38 #include "fastjet/internal/numconsts.hh" 
   40 FASTJET_BEGIN_NAMESPACE      
 
   49 class Dnn3piCylinder : 
public DynamicNearestNeighbours {
 
   68   Dnn3piCylinder(
const std::vector<EtaPhi> &,
 
   69                  const bool & ignore_nearest_is_mirror = 
false,
 
   70                  const bool & verbose = 
false );
 
   74   int NearestNeighbourIndex(
const int ii) 
const ;
 
   78   double NearestNeighbourDistance(
const int ii) 
const ;
 
   83   bool Valid(
const int index) 
const;
 
   85   void RemoveAndAddPoints(
const std::vector<int> & indices_to_remove,
 
   86                           const std::vector<EtaPhi> & points_to_add,
 
   87                           std::vector<int> & indices_added,
 
   88                           std::vector<int> & indices_of_updated_neighbours);
 
   95   const static int INEXISTENT_VERTEX=-3;
 
   99   bool _ignore_nearest_is_mirror;
 
  139   struct MirrorVertexInfo {
 
  152   std::vector<MirrorVertexInfo> _mirror_info;
 
  156   std::vector<int> _cylinder_index_of_plane_vertex;
 
  166   inline EtaPhi _remap_phi(
const EtaPhi & point) {
 
  167     double phi = point.second;
 
  168     if (phi < pi) { phi += twopi ;}
 
  169     return EtaPhi(point.first, phi);}
 
  191   void _RegisterCylinderPoint (
const EtaPhi & cylinder_point,
 
  192                                std::vector<EtaPhi> & plane_points);
 
  208 inline int Dnn3piCylinder::NearestNeighbourIndex(
const int current)
 const {
 
  209   int main_index = _mirror_info[current].main_index;
 
  210   int mirror_index = _mirror_info[current].mirror_index;
 
  212   if (mirror_index == INEXISTENT_VERTEX ) {
 
  213     plane_index = _DNN->NearestNeighbourIndex(main_index);
 
  216         _DNN->NearestNeighbourDistance(main_index) < 
 
  217         _DNN->NearestNeighbourDistance(mirror_index)) ? 
 
  218       _DNN->NearestNeighbourIndex(main_index) : 
 
  219       _DNN->NearestNeighbourIndex(mirror_index) ; 
 
  221   int this_cylinder_index = _cylinder_index_of_plane_vertex[plane_index];
 
  225   assert(_ignore_nearest_is_mirror || this_cylinder_index != current);
 
  230   return this_cylinder_index;
 
  233 inline double Dnn3piCylinder::NearestNeighbourDistance(
const int current)
 const {
 
  234   int main_index = _mirror_info[current].main_index;
 
  235   int mirror_index = _mirror_info[current].mirror_index;
 
  236   if (mirror_index == INEXISTENT_VERTEX ) {
 
  237     return _DNN->NearestNeighbourDistance(main_index);
 
  240         _DNN->NearestNeighbourDistance(main_index) < 
 
  241         _DNN->NearestNeighbourDistance(mirror_index)) ? 
 
  242       _DNN->NearestNeighbourDistance(main_index) : 
 
  243       _DNN->NearestNeighbourDistance(mirror_index) ; 
 
  248 inline bool Dnn3piCylinder::Valid(
const int index)
 const {
 
  249   return (_DNN->Valid(_mirror_info[index].main_index));
 
  253 inline Dnn3piCylinder::~Dnn3piCylinder() {
 
  258 FASTJET_END_NAMESPACE
 
  260 #endif //  __FASTJET_DNN3PICYLINDER_HH__