1 | //FJSTARTHEADER
|
---|
2 | // $Id: Dnn4piCylinder.cc 4442 2020-05-05 07:50:11Z soyez $
|
---|
3 | //
|
---|
4 | // Copyright (c) 2005-2020, 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 |
|
---|
32 | #ifndef DROP_CGAL // in case we do not have the code for CGAL
|
---|
33 | #include <set>
|
---|
34 | #include "fastjet/internal/Dnn4piCylinder.hh"
|
---|
35 | using namespace std;
|
---|
36 |
|
---|
37 | FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
|
---|
38 |
|
---|
39 | //----------------------------------------------------------------------
|
---|
40 | /// initialiser...
|
---|
41 | Dnn4piCylinder::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
|
---|
61 | void 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 |
|
---|
93 | FASTJET_END_NAMESPACE
|
---|
94 |
|
---|
95 | #endif // DROP_CGAL
|
---|