00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef DROP_CGAL // in case we do not have the code for CGAL
00033 #ifndef __FASTJET_DNN4PICYLINDER_HH__
00034 #define __FASTJET_DNN4PICYLINDER_HH__
00035
00036 #include "fastjet/internal/DynamicNearestNeighbours.hh"
00037 #include "fastjet/internal/DnnPlane.hh"
00038 #include "fastjet/internal/numconsts.hh"
00039
00040 FASTJET_BEGIN_NAMESPACE
00041
00042
00043
00044
00045
00046
00047
00048
00049 class Dnn4piCylinder : public DynamicNearestNeighbours {
00050 public:
00051
00052 Dnn4piCylinder() {}
00053
00054
00055
00056
00057 Dnn4piCylinder(const std::vector<EtaPhi> &, const bool & verbose = false );
00058
00059
00060
00061 int NearestNeighbourIndex(const int & ii) const ;
00062
00063
00064
00065 double NearestNeighbourDistance(const int & ii) const ;
00066
00067
00068
00069
00070 bool Valid(const int & index) const;
00071
00072 void RemoveAndAddPoints(const std::vector<int> & indices_to_remove,
00073 const std::vector<EtaPhi> & points_to_add,
00074 std::vector<int> & indices_added,
00075 std::vector<int> & indices_of_updated_neighbours);
00076
00077 ~Dnn4piCylinder();
00078
00079 private:
00080
00081 bool _verbose;
00082
00083
00084
00085
00086
00087 DnnPlane * _DNN1, * _DNN2;
00088
00089
00090
00091 inline EtaPhi _remap_phi(const EtaPhi & point) {
00092 double phi = point.second;
00093 if (phi < pi) { phi += twopi ;}
00094 return EtaPhi(point.first, phi);}
00095
00096 };
00097
00098
00099
00100
00101
00102 inline int Dnn4piCylinder::NearestNeighbourIndex(const int & current) const {
00103 return (_DNN1->NearestNeighbourDistance(current) <
00104 _DNN2->NearestNeighbourDistance(current)) ?
00105 _DNN1->NearestNeighbourIndex(current) :
00106 _DNN2->NearestNeighbourIndex(current) ;
00107 }
00108
00109 inline double Dnn4piCylinder::NearestNeighbourDistance(const int & current) const {
00110 return (_DNN1->NearestNeighbourDistance(current) <
00111 _DNN2->NearestNeighbourDistance(current)) ?
00112 _DNN1->NearestNeighbourDistance(current) :
00113 _DNN2->NearestNeighbourDistance(current) ;
00114 }
00115
00116 inline bool Dnn4piCylinder::Valid(const int & index) const {
00117 return (_DNN1->Valid(index) && _DNN2->Valid(index));
00118 }
00119
00120
00121 inline Dnn4piCylinder::~Dnn4piCylinder() {
00122 delete _DNN1;
00123 delete _DNN2;
00124 }
00125
00126
00127 FASTJET_END_NAMESPACE
00128
00129 #endif // __FASTJET_DNN4PICYLINDER_HH__
00130 #endif // DROP_CGAL