Fork me on GitHub

source: git/external/fastjet/internal/Dnn4piCylinder.hh@ 400597a

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

move branches/ModularDelphes to trunk

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