00001
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00027
00028 #ifndef __PROTOCONES_H__
00029 #define __PROTOCONES_H__
00030
00031 #include "momentum.h"
00032 #include "vicinity.h"
00033 #include <stdio.h>
00034 #include <vector>
00035 #include <list>
00036 #include "hash.h"
00037
00038
00039
00040 namespace siscone{
00041
00053 class Cborder_store{
00054 public:
00056 Cborder_store(Cmomentum * momentum, double centre_eta, double centre_phi) :
00057 mom(momentum), is_in(false) {
00058 angle = atan2(mom->phi - centre_phi, mom->eta - centre_eta);
00059 }
00060
00061 Cmomentum * mom;
00062 double angle;
00063 bool is_in;
00064 };
00065
00066
00069 inline bool operator<(const Cborder_store & a, const Cborder_store & b) {
00070 return a.angle < b.angle;
00071 }
00072
00073
00082 class Cstable_cones : public Cvicinity{
00083 public:
00085 Cstable_cones();
00086
00088 Cstable_cones(std::vector<Cmomentum> &_particle_list);
00089
00091 ~Cstable_cones();
00092
00097 void init(std::vector<Cmomentum> &_particle_list);
00098
00106 int get_stable_cones(double _radius);
00107
00109 std::vector<Cmomentum> protocones;
00110
00112 hash_cones *hc;
00113
00115 int nb_tot;
00116
00117 protected:
00119 double R;
00120
00122 double R2;
00123
00124 private:
00127 Cmomentum cone;
00128
00130 Cmomentum *child;
00131
00133 Cvicinity_elm *centre;
00134
00136 unsigned int centre_idx;
00137
00139 unsigned int first_cone;
00140
00146 int init_cone();
00147
00154 int test_cone();
00155
00161 int update_cone();
00162
00163
00164
00165
00166
00167 void prepare_cocircular_lists();
00168
00176 bool cocircular_check();
00177
00182 void test_cone_cocircular(Cmomentum & borderless_cone,
00183 std::list<Cmomentum *> & border_list);
00184
00191 void test_stability(Cmomentum & candidate,
00192 const std::vector<Cborder_store> & border_vect);
00193
00200 void compute_cone_contents();
00201
00207 void recompute_cone_contents();
00208
00209
00210
00211
00212
00213
00214
00215 void recompute_cone_contents_if_needed(Cmomentum & this_cone, double & this_dpt);
00216
00222 int proceed_with_stability();
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232 Creference circle_intersect(double cx, double cy);
00233
00235 Cmomentum cone_candidate;
00236
00238 std::vector<Cmomentum*> child_list;
00239
00242 std::vector< std::pair<Creference,Creference> > multiple_centre_done;
00243
00244
00245 double dpt;
00246
00255 inline bool is_inside(Cmomentum *centre, Cmomentum *v);
00256 };
00257
00258
00259
00260
00261
00262
00263
00264
00265 inline double abs_dangle(double &angle1, double &angle2);
00266
00267 }
00268 #endif