fastjet 2.4.5
|
00001 //STARTHEADER 00002 // $Id: Dnn4piCylinder.cc 431 2007-01-20 10:44:55Z salam $ 00003 // 00004 // Copyright (c) 2005-2006, Matteo Cacciari and Gavin Salam 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, write to the Free Software 00026 // Foundation, Inc.: 00027 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00028 //---------------------------------------------------------------------- 00029 //ENDHEADER 00030 00031 00032 #ifndef DROP_CGAL // in case we do not have the code for CGAL 00033 #include <set> 00034 #include "fastjet/internal/Dnn4piCylinder.hh" 00035 using namespace std; 00036 00037 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh 00038 00039 //---------------------------------------------------------------------- 00041 Dnn4piCylinder::Dnn4piCylinder( 00042 const vector<EtaPhi> & input_points, const bool & verbose) { 00043 00044 _verbose = verbose; 00045 vector<EtaPhi> copied_points(input_points.size()); 00046 for (unsigned int i=0; i < input_points.size(); i++) { 00047 double phi = input_points[i].second; 00048 assert(phi >= 0.0 && phi < 2*pi); 00049 copied_points[i] = _remap_phi(input_points[i]); 00050 } 00051 00052 if (_verbose) cout << "============== Preparing _DNN1" << endl; 00053 _DNN1 = new DnnPlane(input_points, verbose); 00054 if (_verbose) cout << "============== Preparing _DNN2" << endl; 00055 _DNN2 = new DnnPlane(copied_points, verbose); 00056 } 00057 00058 00059 //---------------------------------------------------------------------- 00061 void Dnn4piCylinder::RemoveAndAddPoints(const vector<int> & indices_to_remove, 00062 const vector<EtaPhi> & points_to_add, 00063 vector<int> & indices_added, 00064 vector<int> & indices_of_updated_neighbours) { 00065 00066 vector<int> indices1, indices2; 00067 00068 _DNN1->RemoveAndAddPoints(indices_to_remove,points_to_add, 00069 indices_added,indices1); 00070 00071 // create a vector with the remapped points (pi..3pi) 00072 vector<EtaPhi> remapped_points(points_to_add.size()); 00073 for (size_t i = 0; i < points_to_add.size(); i++) { 00074 remapped_points[i] = _remap_phi(points_to_add[i]); 00075 } 00076 _DNN2->RemoveAndAddPoints(indices_to_remove, remapped_points, 00077 indices_added,indices2); 00078 00079 // merge the two sequences of updated vertices, avoiding double entries 00080 // of vertices with the same index 00081 set<int> index_set; 00082 unsigned int i; 00083 for (i=0; i < indices1.size(); i++) {index_set.insert(indices1[i]);} 00084 for (i=0; i < indices2.size(); i++) {index_set.insert(indices2[i]);} 00085 00086 indices_of_updated_neighbours.clear(); 00087 for (set<int>::iterator iter = index_set.begin(); 00088 iter != index_set.end(); iter++) { 00089 indices_of_updated_neighbours.push_back(*iter); 00090 } 00091 } 00092 00093 FASTJET_END_NAMESPACE 00094 00095 #endif // DROP_CGAL