Fork me on GitHub

source: git/external/fastjet/internal/Dnn4piCylinder.hh@ df315dc

ImprovedOutputFile Timing dual_readout llp
Last change on this file since df315dc was 35cdc46, checked in by Pavel Demin <demin@…>, 10 years ago

upgrade FastJet to version 3.1.0-beta.1, upgrade Nsubjettiness to version 2.1.0, add SoftKiller version 1.0.0

  • Property mode set to 100644
File size: 4.5 KB
Line 
1//FJSTARTHEADER
2// $Id: Dnn4piCylinder.hh 3442 2014-07-24 07:20:49Z salam $
3//
4// Copyright (c) 2005-2014, 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#ifndef __FASTJET_DNN4PICYLINDER_HH__
34#define __FASTJET_DNN4PICYLINDER_HH__
35
36#include "fastjet/internal/DynamicNearestNeighbours.hh"
37#include "fastjet/internal/DnnPlane.hh"
38#include "fastjet/internal/numconsts.hh"
39
40FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
41
42/// \if internal_doc
43/// @ingroup internal
44/// \class Dnn4piCylinder
45/// class derived from DynamicNearestNeighbours that provides an
46/// implementation for the surface of cylinder (using two copies of
47/// DnnPlane, one running from 0--2pi, the other from pi--3pi).
48/// \endif
49class Dnn4piCylinder : public DynamicNearestNeighbours {
50 public:
51 /// empty initaliser
52 Dnn4piCylinder() {}
53
54 /// Initialiser from a set of points on an Eta-Phi plane, where
55 /// eta can have an arbitrary ranges and phi must be in range
56 /// 0 <= phi < 2pi
57 Dnn4piCylinder(const std::vector<EtaPhi> &, const bool & verbose = false );
58
59 /// Returns the index of the nearest neighbour of point labelled
60 /// by ii (assumes ii is valid)
61 int NearestNeighbourIndex(const int ii) const ;
62
63 /// Returns the distance to the nearest neighbour of point labelled
64 /// by index ii (assumes ii is valid)
65 double NearestNeighbourDistance(const int ii) const ;
66
67 /// Returns true iff the given index corresponds to a point that
68 /// exists in the DNN structure (meaning that it has been added, and
69 /// not removed in the meantime)
70 bool Valid(const int index) const;
71
72 void RemoveAndAddPoints(const std::vector<int> & indices_to_remove,
73 const std::vector<EtaPhi> & points_to_add,
74 std::vector<int> & indices_added,
75 std::vector<int> & indices_of_updated_neighbours);
76
77 ~Dnn4piCylinder();
78
79 private:
80
81 bool _verbose;
82
83 // NB: we define POINTERS here because the initialisation gave
84 // us problems (things crashed!), perhaps because in practice
85 // we were making a copy without being careful and defining
86 // a proper copy constructor.
87 DnnPlane * _DNN1, * _DNN2;
88
89 /// given a phi value in the 0--2pi range return one
90 /// in the pi--3pi range.
91 inline EtaPhi _remap_phi(const EtaPhi & point) {
92 double phi = point.second;
93 if (phi < pi) { phi += twopi ;}
94 return EtaPhi(point.first, phi);}
95
96};
97
98
99// here follow some inline implementations of the simpler of the
100// functions defined above
101
102inline int Dnn4piCylinder::NearestNeighbourIndex(const int current) const {
103 return (_DNN1->NearestNeighbourDistance(current) <
104 _DNN2->NearestNeighbourDistance(current)) ?
105 _DNN1->NearestNeighbourIndex(current) :
106 _DNN2->NearestNeighbourIndex(current) ;
107}
108
109inline double Dnn4piCylinder::NearestNeighbourDistance(const int current) const {
110 return (_DNN1->NearestNeighbourDistance(current) <
111 _DNN2->NearestNeighbourDistance(current)) ?
112 _DNN1->NearestNeighbourDistance(current) :
113 _DNN2->NearestNeighbourDistance(current) ;
114}
115
116inline bool Dnn4piCylinder::Valid(const int index) const {
117 return (_DNN1->Valid(index) && _DNN2->Valid(index));
118}
119
120
121inline Dnn4piCylinder::~Dnn4piCylinder() {
122 delete _DNN1;
123 delete _DNN2;
124}
125
126
127FASTJET_END_NAMESPACE
128
129#endif // __FASTJET_DNN4PICYLINDER_HH__
130#endif // DROP_CGAL
Note: See TracBrowser for help on using the repository browser.