FastJet 3.0.2
|
00001 //STARTHEADER 00002 // $Id: Dnn4piCylinder.cc 2577 2011-09-13 15:11:38Z salam $ 00003 // 00004 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez 00005 // 00006 //---------------------------------------------------------------------- 00007 // This file is part of FastJet. 00008 // 00009 // FastJet is free software; you can redistribute it and/or modify 00010 // it under the terms of the GNU General Public License as published by 00011 // the Free Software Foundation; either version 2 of the License, or 00012 // (at your option) any later version. 00013 // 00014 // The algorithms that underlie FastJet have required considerable 00015 // development and are described in hep-ph/0512210. If you use 00016 // FastJet as part of work towards a scientific publication, please 00017 // include a citation to the FastJet paper. 00018 // 00019 // FastJet is distributed in the hope that it will be useful, 00020 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 // GNU General Public License for more details. 00023 // 00024 // You should have received a copy of the GNU General Public License 00025 // along with FastJet. If not, see <http://www.gnu.org/licenses/>. 00026 //---------------------------------------------------------------------- 00027 //ENDHEADER 00028 00029 00030 #ifndef DROP_CGAL // in case we do not have the code for CGAL 00031 #include <set> 00032 #include "fastjet/internal/Dnn4piCylinder.hh" 00033 using namespace std; 00034 00035 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 00036 00037 //---------------------------------------------------------------------- 00038 /// initialiser... 00039 Dnn4piCylinder::Dnn4piCylinder( 00040 const vector<EtaPhi> & input_points, const bool & verbose) { 00041 00042 _verbose = verbose; 00043 vector<EtaPhi> copied_points(input_points.size()); 00044 for (unsigned int i=0; i < input_points.size(); i++) { 00045 double phi = input_points[i].second; 00046 assert(phi >= 0.0 && phi < 2*pi); 00047 copied_points[i] = _remap_phi(input_points[i]); 00048 } 00049 00050 if (_verbose) cout << "============== Preparing _DNN1" << endl; 00051 _DNN1 = new DnnPlane(input_points, verbose); 00052 if (_verbose) cout << "============== Preparing _DNN2" << endl; 00053 _DNN2 = new DnnPlane(copied_points, verbose); 00054 } 00055 00056 00057 //---------------------------------------------------------------------- 00058 /// insertion and removal of points 00059 void Dnn4piCylinder::RemoveAndAddPoints(const vector<int> & indices_to_remove, 00060 const vector<EtaPhi> & points_to_add, 00061 vector<int> & indices_added, 00062 vector<int> & indices_of_updated_neighbours) { 00063 00064 vector<int> indices1, indices2; 00065 00066 _DNN1->RemoveAndAddPoints(indices_to_remove,points_to_add, 00067 indices_added,indices1); 00068 00069 // create a vector with the remapped points (pi..3pi) 00070 vector<EtaPhi> remapped_points(points_to_add.size()); 00071 for (size_t i = 0; i < points_to_add.size(); i++) { 00072 remapped_points[i] = _remap_phi(points_to_add[i]); 00073 } 00074 _DNN2->RemoveAndAddPoints(indices_to_remove, remapped_points, 00075 indices_added,indices2); 00076 00077 // merge the two sequences of updated vertices, avoiding double entries 00078 // of vertices with the same index 00079 set<int> index_set; 00080 unsigned int i; 00081 for (i=0; i < indices1.size(); i++) {index_set.insert(indices1[i]);} 00082 for (i=0; i < indices2.size(); i++) {index_set.insert(indices2[i]);} 00083 00084 indices_of_updated_neighbours.clear(); 00085 for (set<int>::iterator iter = index_set.begin(); 00086 iter != index_set.end(); iter++) { 00087 indices_of_updated_neighbours.push_back(*iter); 00088 } 00089 } 00090 00091 FASTJET_END_NAMESPACE 00092 00093 #endif // DROP_CGAL