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 #include <set>
00034 #include "fastjet/internal/Dnn3piCylinder.hh"
00035 using namespace std;
00036
00037 FASTJET_BEGIN_NAMESPACE
00038
00039
00041 Dnn3piCylinder::Dnn3piCylinder(
00042 const vector<EtaPhi> & input_points,
00043 const bool & ignore_nearest_is_mirror,
00044 const bool & verbose) {
00045
00046 _verbose = verbose;
00047 _ignore_nearest_is_mirror = ignore_nearest_is_mirror;
00048 vector<EtaPhi> plane_points;
00049
00050
00051 for (unsigned int i=0; i < input_points.size(); i++) {
00052 _RegisterCylinderPoint(input_points[i], plane_points);
00053 }
00054
00055 if (_verbose) cout << "============== Preparing _DNN" << endl;
00056 _DNN = new DnnPlane(plane_points, verbose);
00057 }
00058
00059
00060
00079 void Dnn3piCylinder::_RegisterCylinderPoint (const EtaPhi & cylinder_point,
00080 vector<EtaPhi> & plane_points) {
00081 double phi = cylinder_point.second;
00082 assert(phi >= 0.0 && phi < 2*pi);
00083
00084
00085 MirrorVertexInfo mvi;
00086 mvi.main_index = _cylinder_index_of_plane_vertex.size();
00087 _cylinder_index_of_plane_vertex.push_back(_mirror_info.size());
00088 plane_points.push_back(cylinder_point);
00089
00090
00091 if (phi < pi) {
00092 mvi.mirror_index = _cylinder_index_of_plane_vertex.size();
00093 _cylinder_index_of_plane_vertex.push_back(_mirror_info.size());
00094 plane_points.push_back(_remap_phi(cylinder_point));
00095 } else {
00096 mvi.mirror_index = INEXISTENT_VERTEX;
00097 }
00098
00099
00100 _mirror_info.push_back(mvi);
00101 }
00102
00103
00104
00106 void Dnn3piCylinder::RemoveAndAddPoints(const vector<int> & indices_to_remove,
00107 const vector<EtaPhi> & points_to_add,
00108 vector<int> & indices_added,
00109 vector<int> & indices_of_updated_neighbours) {
00110
00111
00112
00113
00114 vector<int> plane_indices_to_remove;
00115 for (unsigned int i=0; i < indices_to_remove.size(); i++) {
00116 MirrorVertexInfo * mvi;
00117 mvi = & _mirror_info[indices_to_remove[i]];
00118 plane_indices_to_remove.push_back(mvi->main_index);
00119 if (mvi->mirror_index != INEXISTENT_VERTEX) {
00120 plane_indices_to_remove.push_back(mvi->mirror_index);
00121 }
00122 }
00123
00124
00125
00126 vector<EtaPhi> plane_points_to_add;
00127 indices_added.clear();
00128 for (unsigned int i=0; i < points_to_add.size(); i++) {
00129 indices_added.push_back(_mirror_info.size());
00130 _RegisterCylinderPoint(points_to_add[i], plane_points_to_add);
00131 }
00132
00133
00134
00135
00136
00137 vector<int> updated_plane_neighbours, plane_indices_added;
00138 _DNN->RemoveAndAddPoints(plane_indices_to_remove, plane_points_to_add,
00139 plane_indices_added, updated_plane_neighbours);
00140
00141
00142
00143 set<int> index_set;
00144 unsigned int i;
00145 for (i=0; i < updated_plane_neighbours.size(); i++) {
00146 index_set.insert(
00147 _cylinder_index_of_plane_vertex[updated_plane_neighbours[i]]);}
00148
00149
00150 indices_of_updated_neighbours.clear();
00151 for (set<int>::iterator iter = index_set.begin();
00152 iter != index_set.end(); iter++) {
00153 indices_of_updated_neighbours.push_back(*iter);
00154 }
00155 }
00156
00157
00158 FASTJET_END_NAMESPACE
00159
00160 #endif // DROP_CGAL
00161