FastJet 3.5.0
Loading...
Searching...
No Matches
Dnn4piCylinder.cc
1//FJSTARTHEADER
2// $Id$
3//
4// Copyright (c) 2005-2025, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
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. They are described in the original FastJet paper,
16// hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
17// FastJet as part of work towards a scientific publication, please
18// quote the version you use and include a citation to the manual and
19// optionally also to hep-ph/0512210.
20//
21// FastJet is distributed in the hope that it will be useful,
22// but WITHOUT ANY WARRANTY; without even the implied warranty of
23// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24// GNU General Public License for more details.
25//
26// You should have received a copy of the GNU General Public License
27// along with FastJet. If not, see <http://www.gnu.org/licenses/>.
28//----------------------------------------------------------------------
29//FJENDHEADER
30
31#include "fastjet/config.h"
32
33#ifndef DROP_CGAL // in case we do not have the code for CGAL
34#include <set>
35#include "fastjet/internal/Dnn4piCylinder.hh"
36using namespace std;
37
38FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
39
40//----------------------------------------------------------------------
41/// initialiser...
42Dnn4piCylinder::Dnn4piCylinder(
43 const vector<EtaPhi> & input_points, const bool & verbose) {
44
45 _verbose = verbose;
46 vector<EtaPhi> copied_points(input_points.size());
47 for (unsigned int i=0; i < input_points.size(); i++) {
48 double phi = input_points[i].second;
49 assert(phi >= 0.0 && phi < 2*pi);
50 copied_points[i] = _remap_phi(input_points[i]);
51 }
52
53 if (_verbose) cout << "============== Preparing _DNN1" << endl;
54 _DNN1 = new DnnPlane(input_points, verbose);
55 if (_verbose) cout << "============== Preparing _DNN2" << endl;
56 _DNN2 = new DnnPlane(copied_points, verbose);
57}
58
59
60//----------------------------------------------------------------------
61/// insertion and removal of points
62void Dnn4piCylinder::RemoveAndAddPoints(const vector<int> & indices_to_remove,
63 const vector<EtaPhi> & points_to_add,
64 vector<int> & indices_added,
65 vector<int> & indices_of_updated_neighbours) {
66
67 vector<int> indices1, indices2;
68
69 _DNN1->RemoveAndAddPoints(indices_to_remove,points_to_add,
70 indices_added,indices1);
71
72 // create a vector with the remapped points (pi..3pi)
73 vector<EtaPhi> remapped_points(points_to_add.size());
74 for (size_t i = 0; i < points_to_add.size(); i++) {
75 remapped_points[i] = _remap_phi(points_to_add[i]);
76 }
77 _DNN2->RemoveAndAddPoints(indices_to_remove, remapped_points,
78 indices_added,indices2);
79
80 // merge the two sequences of updated vertices, avoiding double entries
81 // of vertices with the same index
82 set<int> index_set;
83 unsigned int i;
84 for (i=0; i < indices1.size(); i++) {index_set.insert(indices1[i]);}
85 for (i=0; i < indices2.size(); i++) {index_set.insert(indices2[i]);}
86
87 indices_of_updated_neighbours.clear();
88 for (set<int>::iterator iter = index_set.begin();
89 iter != index_set.end(); iter++) {
90 indices_of_updated_neighbours.push_back(*iter);
91 }
92}
93
94FASTJET_END_NAMESPACE
95
96#endif // DROP_CGAL