SISCone  2.0.5
protocones.h
1 // -*- C++ -*-
3 // File: protocones.h //
4 // Description: header file for stable cones determination (Cstable_cones) //
5 // This file is part of the SISCone project. //
6 // For more details, see http://projects.hepforge.org/siscone //
7 // //
8 // Copyright (c) 2006 Gavin Salam and Gregory Soyez //
9 // //
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. //
14 // //
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. //
19 // //
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 //
23 // //
24 // $Revision:: 224 $//
25 // $Date:: 2008-05-16 19:58:30 +0200 (Fri, 16 May 2008) $//
27 
28 #ifndef __PROTOCONES_H__
29 #define __PROTOCONES_H__
30 
31 #include "momentum.h"
32 #include "vicinity.h"
33 #include <stdio.h>
34 #include <vector>
35 #include <list>
36 #include "hash.h"
37 
38 #include "defines.h"
39 
40 namespace siscone{
41 
54 public:
56  Cborder_store(Cmomentum * momentum, double centre_eta, double centre_phi) :
57  mom(momentum), is_in(false) {
58  angle = atan2(mom->phi - centre_phi, mom->eta - centre_eta);
59  }
60 
62  double angle;
63  bool is_in;
64 };
65 
66 
69 inline bool operator<(const Cborder_store & a, const Cborder_store & b) {
70  return a.angle < b.angle;
71 }
72 
73 
82 class Cstable_cones : public Cvicinity{
83  public:
85  Cstable_cones();
86 
88  Cstable_cones(std::vector<Cmomentum> &_particle_list);
89 
92 
97  void init(std::vector<Cmomentum> &_particle_list);
98 
106  int get_stable_cones(double _radius);
107 
109  std::vector<Cmomentum> protocones;
110 
113 
115  int nb_tot;
116 #ifdef DEBUG_STABLE_CONES
117  int nb_hash_cones, nb_hash_occupied;
118 #endif
119 
120  protected:
122  double R;
123 
125  double R2;
126 
127  private:
130  Cmomentum cone;
131 
133  Cmomentum *child;
134 
136  Cvicinity_elm *centre;
137 
139  unsigned int centre_idx;
140 
142  unsigned int first_cone;
143 
149  int init_cone();
150 
157  int test_cone();
158 
164  int update_cone();
165 
166  /*
167  * run through the vicinity of the current parent and for each child
168  * indicate which members are cocircular...
169  */
170  void prepare_cocircular_lists();
171 
179  bool cocircular_check();
180 
185  void test_cone_cocircular(Cmomentum & borderless_cone,
186  std::list<Cmomentum *> & border_list);
187 
194  void test_stability(Cmomentum & candidate,
195  const std::vector<Cborder_store> & border_vect);
196 
203  void compute_cone_contents();
204 
210  void recompute_cone_contents();
211 
212  /*
213  * if we have gone beyond the acceptable threshold of change, compute
214  * the cone momentum from particle list. in this version, we use the
215  * 'pincluded' information from the Cvicinity class, but we don't
216  * change the member cone, only the locally supplied one
217  */
218  void recompute_cone_contents_if_needed(Cmomentum & this_cone, double & this_dpt);
219 
225  int proceed_with_stability();
226 
227  /*
228  * circle intersection.
229  * computes the intersection with a circle of given centre and radius.
230  * The output takes the form of a checkxor of the intersection's particles
231  * - cx circle centre x coordinate
232  * - cy circle centre y coordinate
233  * return the checkxor for the intersection
234  ******************************************************************/
235  Creference circle_intersect(double cx, double cy);
236 
238  Cmomentum cone_candidate;
239 
241  std::vector<Cmomentum*> child_list;
242 
245  std::vector< std::pair<Creference,Creference> > multiple_centre_done;
246 
247  // information for updating cone contents to avoid rounding errors
248  double dpt;
249 
258  inline bool is_inside(Cmomentum *centre, Cmomentum *v);
259 };
260 
261 /*
262  * compute the absolute value of the difference between 2 angles.
263  * We take care of the 2pi periodicity
264  * \param angle1 first angle
265  * \param angle2 second angle
266  * \return the absolute value of the difference between the angles
267  *****************************************************************/
268 inline double abs_dangle(double &angle1, double &angle2);
269 
270 }
271 #endif
The SISCone project has been developed by Gavin Salam and Gregory Soyez
Documentation generated on Wed May 30 2012 06:46:25 for SISCone by  Doxygen 1.8.1