Fork me on GitHub

source: git/external/fastjet/Dnn4piCylinder.cc@ 6519cfb

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 6519cfb was d7d2da3, checked in by pavel <pavel@…>, 12 years ago

move branches/ModularDelphes to trunk

  • Property mode set to 100644
File size: 3.3 KB
Line 
1//STARTHEADER
2// $Id$
3//
4// Copyright (c) 2005-2011, 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 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, see <http://www.gnu.org/licenses/>.
26//----------------------------------------------------------------------
27//ENDHEADER
28
29
30#ifndef DROP_CGAL // in case we do not have the code for CGAL
31#include <set>
32#include "fastjet/internal/Dnn4piCylinder.hh"
33using namespace std;
34
35FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
36
37//----------------------------------------------------------------------
38/// initialiser...
39Dnn4piCylinder::Dnn4piCylinder(
40 const vector<EtaPhi> & input_points, const bool & verbose) {
41
42 _verbose = verbose;
43 vector<EtaPhi> copied_points(input_points.size());
44 for (unsigned int i=0; i < input_points.size(); i++) {
45 double phi = input_points[i].second;
46 assert(phi >= 0.0 && phi < 2*pi);
47 copied_points[i] = _remap_phi(input_points[i]);
48 }
49
50 if (_verbose) cout << "============== Preparing _DNN1" << endl;
51 _DNN1 = new DnnPlane(input_points, verbose);
52 if (_verbose) cout << "============== Preparing _DNN2" << endl;
53 _DNN2 = new DnnPlane(copied_points, verbose);
54}
55
56
57//----------------------------------------------------------------------
58/// insertion and removal of points
59void Dnn4piCylinder::RemoveAndAddPoints(const vector<int> & indices_to_remove,
60 const vector<EtaPhi> & points_to_add,
61 vector<int> & indices_added,
62 vector<int> & indices_of_updated_neighbours) {
63
64 vector<int> indices1, indices2;
65
66 _DNN1->RemoveAndAddPoints(indices_to_remove,points_to_add,
67 indices_added,indices1);
68
69 // create a vector with the remapped points (pi..3pi)
70 vector<EtaPhi> remapped_points(points_to_add.size());
71 for (size_t i = 0; i < points_to_add.size(); i++) {
72 remapped_points[i] = _remap_phi(points_to_add[i]);
73 }
74 _DNN2->RemoveAndAddPoints(indices_to_remove, remapped_points,
75 indices_added,indices2);
76
77 // merge the two sequences of updated vertices, avoiding double entries
78 // of vertices with the same index
79 set<int> index_set;
80 unsigned int i;
81 for (i=0; i < indices1.size(); i++) {index_set.insert(indices1[i]);}
82 for (i=0; i < indices2.size(); i++) {index_set.insert(indices2[i]);}
83
84 indices_of_updated_neighbours.clear();
85 for (set<int>::iterator iter = index_set.begin();
86 iter != index_set.end(); iter++) {
87 indices_of_updated_neighbours.push_back(*iter);
88 }
89}
90
91FASTJET_END_NAMESPACE
92
93#endif // DROP_CGAL
Note: See TracBrowser for help on using the repository browser.