2 ///////////////////////////////////////////////////////////////////////////////
4 // Description: header file for particle vicinity (Cvicinity class) //
5 // This file is part of the SISCone project. //
6 // For more details, see http://projects.hepforge.org/siscone //
8 // Copyright (c) 2006 Gavin Salam and Gregory Soyez //
10 // This program is free software; you can redistribute it and/or modify //
11 // it under the terms of the GNU General Public License as published by //
12 // the Free Software Foundation; either version 2 of the License, or //
13 // (at your option) any later version. //
15 // This program is distributed in the hope that it will be useful, //
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
18 // GNU General Public License for more details. //
20 // You should have received a copy of the GNU General Public License //
21 // along with this program; if not, write to the Free Software //
22 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA //
24 // $Revision:: 123 $//
25 // $Date:: 2007-03-01 02:52:16 +0100 (Thu, 01 Mar 2007) $//
26 ///////////////////////////////////////////////////////////////////////////////
28 #ifndef __VICINITY_H__
29 #define __VICINITY_H__
42 * \class Cvicinity_inclusion
43 * \brief a class to keep track of inclusion status in cone and in cocircular region
44 * while using minimal resources
46 class Cvicinity_inclusion {
49 Cvicinity_inclusion() : cone(false), cocirc(false) {}
51 bool cone; ///< flag for particle inclusion in the cone
52 bool cocirc; ///< flag for particle inclusion in the border
57 * \class Cvicinity_elm
58 * \brief element in the vicinity of a parent.
60 * class used to manage one points in the vicinity
65 /// pointer to the second borderline particle
68 /// variable to tell if the particle is inside or outside the cone
69 Cvicinity_inclusion *is_inside;
72 double eta; ///< eta coordinate of the center
73 double phi; ///< phi coordinate of the center
74 double angle; ///< angle with parent
75 bool side; ///< true if angle on the positive side, false otherwise
76 double cocircular_range; ///< amount by which the angle can be varied while
77 ///< maintaining this point within co-circularity margin
79 /// list of elements co-circular with this one
80 /// NB: empty list uses less mem than vector
81 std::list<Cvicinity_elm * > cocircular;
84 /// ordering pointers to Cvicinity_elm
85 bool ve_less(Cvicinity_elm *ve1, Cvicinity_elm *ve2);
90 * \brief list of element in the vicinity of a parent.
92 * class used to manage the points which are in the vicinity
97 /// default constructor
100 /// constructor with initialisation (see set_particle_list)
101 Cvicinity(std::vector<Cmomentum> &_particle_list);
103 /// default destructor
107 * set the particle_list
108 * \param _particle_list list of particles (type Cmomentum)
110 void set_particle_list(std::vector<Cmomentum> &_particle_list);
113 * build the vicinity list from the list of points.
114 * \param _parent reference particle
115 * \param _VR vicinity radius
117 void build(Cmomentum *_parent, double _VR);
119 // cone kinematical information
120 Cmomentum *parent; ///< parent vector
121 double VR; ///< radius of the vicinity
122 double VR2; ///< squared radius of the vicinity
123 double R; ///< normal radius
124 double R2; ///< squared normal radius
125 double inv_R_EPS_COCIRC; ///< R / EPSILON_COCIRCULAR
126 double inv_R_2EPS_COCIRC; ///< R / (2*EPSILON_COCIRCULAR)
128 // particle list information
129 int n_part; ///< number of particles
130 std::vector<Cmomentum> plist; ///< the list of particles
131 std::vector<Cvicinity_inclusion> pincluded; ///< the inclusion state of particles
132 Cvicinity_elm *ve_list; ///< list of vicinity elements built from particle list (size=2*n)
133 #ifdef USE_QUADTREE_FOR_STABILITY_TEST
134 Cquadtree *quadtree; ///< quadtree used for final stability tests
137 // vicinity information
138 std::vector<Cvicinity_elm*> vicinity; ///< list of points in parent's vicinity
139 unsigned int vicinity_size; ///< number of elements in vicinity
143 * append a particle to the 'vicinity' list after
144 * having tested it and computed the angular-ordering quantities
145 * \param v vector to test
147 void append_to_vicinity(Cmomentum *v);
149 // internal variables
150 double pcx; ///< parent centre (eta)
151 double pcy; ///< parent centre (phi)