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