//STARTHEADER
// $Id$
//
// Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
//
//----------------------------------------------------------------------
// This file is part of FastJet.
//
// FastJet is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// The algorithms that underlie FastJet have required considerable
// development and are described in hep-ph/0512210. If you use
// FastJet as part of work towards a scientific publication, please
// include a citation to the FastJet paper.
//
// FastJet is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with FastJet. If not, see .
//----------------------------------------------------------------------
//ENDHEADER
#ifndef DROP_CGAL // in case we do not have the code for CGAL
#include
#include "fastjet/internal/Dnn4piCylinder.hh"
using namespace std;
FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
//----------------------------------------------------------------------
/// initialiser...
Dnn4piCylinder::Dnn4piCylinder(
const vector & input_points, const bool & verbose) {
_verbose = verbose;
vector copied_points(input_points.size());
for (unsigned int i=0; i < input_points.size(); i++) {
double phi = input_points[i].second;
assert(phi >= 0.0 && phi < 2*pi);
copied_points[i] = _remap_phi(input_points[i]);
}
if (_verbose) cout << "============== Preparing _DNN1" << endl;
_DNN1 = new DnnPlane(input_points, verbose);
if (_verbose) cout << "============== Preparing _DNN2" << endl;
_DNN2 = new DnnPlane(copied_points, verbose);
}
//----------------------------------------------------------------------
/// insertion and removal of points
void Dnn4piCylinder::RemoveAndAddPoints(const vector & indices_to_remove,
const vector & points_to_add,
vector & indices_added,
vector & indices_of_updated_neighbours) {
vector indices1, indices2;
_DNN1->RemoveAndAddPoints(indices_to_remove,points_to_add,
indices_added,indices1);
// create a vector with the remapped points (pi..3pi)
vector remapped_points(points_to_add.size());
for (size_t i = 0; i < points_to_add.size(); i++) {
remapped_points[i] = _remap_phi(points_to_add[i]);
}
_DNN2->RemoveAndAddPoints(indices_to_remove, remapped_points,
indices_added,indices2);
// merge the two sequences of updated vertices, avoiding double entries
// of vertices with the same index
set index_set;
unsigned int i;
for (i=0; i < indices1.size(); i++) {index_set.insert(indices1[i]);}
for (i=0; i < indices2.size(); i++) {index_set.insert(indices2[i]);}
indices_of_updated_neighbours.clear();
for (set::iterator iter = index_set.begin();
iter != index_set.end(); iter++) {
indices_of_updated_neighbours.push_back(*iter);
}
}
FASTJET_END_NAMESPACE
#endif // DROP_CGAL