]>
Commit | Line | Data |
---|---|---|
370be031 | 1 | // -*- C++ -*- |
2 | /////////////////////////////////////////////////////////////////////////////// | |
3 | // File: hash.h // | |
4 | // Description: header file for classes hash_element and hash_cones // | |
5 | // This file is part of the SISCone project. // | |
6 | // WARNING: this is not the main SISCone trunk but // | |
7 | // an adaptation to spherical coordinates // | |
8 | // For more details, see http://projects.hepforge.org/siscone // | |
9 | // // | |
10 | // Copyright (c) 2006-2008 Gavin Salam and Gregory Soyez // | |
11 | // // | |
12 | // This program is free software; you can redistribute it and/or modify // | |
13 | // it under the terms of the GNU General Public License as published by // | |
14 | // the Free Software Foundation; either version 2 of the License, or // | |
15 | // (at your option) any later version. // | |
16 | // // | |
17 | // This program is distributed in the hope that it will be useful, // | |
18 | // but WITHOUT ANY WARRANTY; without even the implied warranty of // | |
19 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // | |
20 | // GNU General Public License for more details. // | |
21 | // // | |
22 | // You should have received a copy of the GNU General Public License // | |
23 | // along with this program; if not, write to the Free Software // | |
24 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA // | |
25 | // // | |
26 | // $Revision:: 268 $// | |
27 | // $Date:: 2009-03-12 21:24:16 +0100 (Thu, 12 Mar 2009) $// | |
28 | /////////////////////////////////////////////////////////////////////////////// | |
29 | ||
30 | #ifndef __SPH_HASH_H__ | |
31 | #define __SPH_HASH_H__ | |
32 | ||
33 | #include "momentum.h" | |
34 | ||
35 | namespace siscone_spherical{ | |
36 | ||
37 | /** | |
38 | * \class sph_hash_element | |
39 | * information on store cones candidates. | |
40 | * | |
41 | * We store in this class the information used to count all | |
42 | * protocones in a first pass. This first pass only count | |
43 | * cones with different references and test their stbility | |
44 | * with the parent-child particles (border particles). | |
45 | */ | |
46 | class sph_hash_element{ | |
47 | public: | |
48 | CSph3vector centre; ///< centre of the cone | |
49 | bool is_stable; ///< true if stable w.r.t. "border particles" | |
50 | ||
51 | sph_hash_element *next; ///< pointer to the next element | |
52 | }; | |
53 | ||
54 | /** | |
55 | * \class sph_hash_cones | |
56 | * list of cones candidates. | |
57 | * | |
58 | * We store in this class all the hash_elements and give | |
59 | * functions to manipulate them. | |
60 | */ | |
61 | class sph_hash_cones{ | |
62 | public: | |
63 | /// constructor with initialisation | |
64 | /// \param _Np number of particles | |
65 | /// \param _R2 cone radius (squared) | |
66 | sph_hash_cones(int _Np, double _R2); | |
67 | ||
68 | /// destructor | |
69 | ~sph_hash_cones(); | |
70 | ||
71 | /** | |
72 | * insert a new candidate into the hash. | |
73 | * \param v 4-momentum of te cone to add | |
74 | * \param parent parent particle defining the cone | |
75 | * \param child child particle defining the cone | |
76 | * \param p_io whether the parent has to belong to the cone or not | |
77 | * \param c_io whether the child has to belong to the cone or not | |
78 | * \return 0 on success, 1 on error | |
79 | */ | |
80 | int insert(CSphmomentum *v, CSphmomentum *parent, CSphmomentum *child, bool p_io, bool c_io); | |
81 | ||
82 | /** | |
83 | * insert a new candidate into the hash. | |
84 | * \param v 4-momentum of te cone to add | |
85 | * Note, in this case, we assume stability. We also assume | |
86 | * that eta and phi are computed for v | |
87 | * \return 0 on success, 1 on error | |
88 | */ | |
89 | int insert(CSphmomentum *v); | |
90 | ||
91 | /// the cone data itself | |
92 | sph_hash_element **hash_array; | |
93 | ||
94 | /// number of elements | |
95 | int n_cones; | |
96 | ||
97 | /// number of occupied cells | |
98 | #ifdef DEBUG_STABLE_CONES | |
99 | int n_occupied_cells; | |
100 | #endif | |
101 | ||
102 | /// number of cells-1 | |
103 | int mask; | |
104 | ||
105 | /// circle radius (squared) | |
106 | /// NOTE: need to be set before any call to 'insert' | |
107 | double R2; | |
108 | ||
109 | /// its squreed tangent | |
110 | double tan2R; | |
111 | }; | |
112 | ||
113 | } | |
114 | #endif |