Fork me on GitHub

source: svn/trunk/Utilities/Fastjet/src/Dnn4piCylinder.cc@ 443

Last change on this file since 443 was 11, checked in by severine ovyn, 16 years ago

Fastjet added; CDFCones directory has been changed

File size: 3.4 KB
RevLine 
[11]1//STARTHEADER
2// $Id: Dnn4piCylinder.cc,v 1.1 2008-11-06 14:32:14 ovyn Exp $
3//
4// Copyright (c) 2005-2006, Matteo Cacciari and Gavin Salam
5//
6//----------------------------------------------------------------------
7// This file is part of FastJet.
8//
9// FastJet is free software; you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation; either version 2 of the License, or
12// (at your option) any later version.
13//
14// The algorithms that underlie FastJet have required considerable
15// development and are described in hep-ph/0512210. If you use
16// FastJet as part of work towards a scientific publication, please
17// include a citation to the FastJet paper.
18//
19// FastJet is distributed in the hope that it will be useful,
20// but WITHOUT ANY WARRANTY; without even the implied warranty of
21// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22// GNU General Public License for more details.
23//
24// You should have received a copy of the GNU General Public License
25// along with FastJet; if not, write to the Free Software
26// Foundation, Inc.:
27// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28//----------------------------------------------------------------------
29//ENDHEADER
30
31
32#ifndef DROP_CGAL // in case we do not have the code for CGAL
33#include <set>
34#include "fastjet/internal/Dnn4piCylinder.hh"
35using namespace std;
36
37FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
38
39//----------------------------------------------------------------------
40/// initialiser...
41Dnn4piCylinder::Dnn4piCylinder(
42 const vector<EtaPhi> & input_points, const bool & verbose) {
43
44 _verbose = verbose;
45 vector<EtaPhi> copied_points(input_points.size());
46 for (unsigned int i=0; i < input_points.size(); i++) {
47 double phi = input_points[i].second;
48 assert(phi >= 0.0 && phi < 2*pi);
49 copied_points[i] = _remap_phi(input_points[i]);
50 }
51
52 if (_verbose) cout << "============== Preparing _DNN1" << endl;
53 _DNN1 = new DnnPlane(input_points, verbose);
54 if (_verbose) cout << "============== Preparing _DNN2" << endl;
55 _DNN2 = new DnnPlane(copied_points, verbose);
56}
57
58
59//----------------------------------------------------------------------
60/// insertion and removal of points
61void Dnn4piCylinder::RemoveAndAddPoints(const vector<int> & indices_to_remove,
62 const vector<EtaPhi> & points_to_add,
63 vector<int> & indices_added,
64 vector<int> & indices_of_updated_neighbours) {
65
66 vector<int> indices1, indices2;
67
68 _DNN1->RemoveAndAddPoints(indices_to_remove,points_to_add,
69 indices_added,indices1);
70
71 // create a vector with the remapped points (pi..3pi)
72 vector<EtaPhi> remapped_points(points_to_add.size());
73 for (size_t i = 0; i < points_to_add.size(); i++) {
74 remapped_points[i] = _remap_phi(points_to_add[i]);
75 }
76 _DNN2->RemoveAndAddPoints(indices_to_remove, remapped_points,
77 indices_added,indices2);
78
79 // merge the two sequences of updated vertices, avoiding double entries
80 // of vertices with the same index
81 set<int> index_set;
82 unsigned int i;
83 for (i=0; i < indices1.size(); i++) {index_set.insert(indices1[i]);}
84 for (i=0; i < indices2.size(); i++) {index_set.insert(indices2[i]);}
85
86 indices_of_updated_neighbours.clear();
87 for (set<int>::iterator iter = index_set.begin();
88 iter != index_set.end(); iter++) {
89 indices_of_updated_neighbours.push_back(*iter);
90 }
91}
92
93FASTJET_END_NAMESPACE
94
95#endif // DROP_CGAL
Note: See TracBrowser for help on using the repository browser.