1 #ifndef __FASTJET_LAZYTILING9SEPARATEGHOSTS_HH__
2 #define __FASTJET_LAZYTILING9SEPARATEGHOSTS_HH__
35 #include "fastjet/internal/MinHeap.hh"
36 #include "fastjet/ClusterSequence.hh"
37 #include "fastjet/internal/LazyTiling9Alt.hh"
39 #include "fastjet/config.h"
41 FASTJET_BEGIN_NAMESPACE
45 double eta, phi, kt2, NN_dist;
46 TiledJet3 * NN, *previous, * next;
47 int _jets_index, tile_index;
48 bool _minheap_update_needed;
53 inline void label_minheap_update_needed() {_minheap_update_needed =
true;}
54 inline void label_minheap_update_done() {_minheap_update_needed =
false;}
55 inline bool minheap_update_needed()
const {
return _minheap_update_needed;}
62 Tile3 * begin_tiles[n_tile_neighbours];
64 Tile3 ** surrounding_tiles;
72 TiledJet3 * ghost_head;
78 double eta_centre, phi_centre;
80 bool is_near_zero_phi(
double tile_size_phi)
const {
81 return phi_centre < tile_size_phi || (twopi-phi_centre) < tile_size_phi;
87 class LazyTiling9SeparateGhosts {
89 LazyTiling9SeparateGhosts(ClusterSequence & cs);
103 static double ghost_pt2_threshold;
106 ClusterSequence & _cs;
107 const std::vector<PseudoJet> & _jets;
108 std::vector<Tile3> _tiles;
111 double _Rparam, _R2, _invR2;
112 double _tiles_eta_min, _tiles_eta_max;
113 double _tile_size_eta, _tile_size_phi;
114 double _tile_half_size_eta, _tile_half_size_phi;
115 int _n_tiles_phi,_tiles_ieta_min,_tiles_ieta_max;
117 std::vector<TiledJet3 *> _jets_for_minheap;
121 void _initialise_tiles();
125 inline int _tile_index (
int ieta,
int iphi)
const {
128 return (ieta-_tiles_ieta_min)*_n_tiles_phi
129 + (iphi+_n_tiles_phi) % _n_tiles_phi;
132 void _bj_remove_from_tiles(TiledJet3 *
const jet);
135 int _tile_index(
const double eta,
const double phi)
const;
138 void _tj_set_jetinfo(TiledJet3 *
const jet,
const int _jets_index,
bool is_ghost);
140 void _print_tiles(TiledJet3 * briefjets )
const;
141 void _add_neighbours_to_tile_union(
const int tile_index,
142 std::vector<int> & tile_union,
int & n_near_tiles)
const;
143 void _add_untagged_neighbours_to_tile_union(
const int tile_index,
144 std::vector<int> & tile_union,
int & n_near_tiles);
145 void _add_untagged_neighbours_to_tile_union_using_max_info(
const TiledJet3 *
const jet,
146 std::vector<int> & tile_union,
int & n_near_tiles);
147 double _distance_to_tile(
const TiledJet3 * bj,
const Tile3 *)
const;
148 void _update_jetX_jetI_NN(TiledJet3 * jetX, TiledJet3 * jetI, std::vector<TiledJet3 *> & jets_for_minheap);
150 void _set_NN(TiledJet3 * jetI, std::vector<TiledJet3 *> & jets_for_minheap);
154 template <
class J>
double _bj_diJ(
const J *
const jet)
const {
155 double kt2 = jet->kt2;
156 if (jet->NN != NULL) {
if (jet->NN->kt2 < kt2) {kt2 = jet->NN->kt2;}}
157 return jet->NN_dist * kt2;
162 template <
class J>
inline void _bj_set_jetinfo(
163 J *
const jetA,
const int _jets_index)
const {
164 jetA->eta = _jets[_jets_index].rap();
165 jetA->phi = _jets[_jets_index].phi_02pi();
166 jetA->kt2 = _cs.jet_scale_for_algorithm(_jets[_jets_index]);
167 jetA->_jets_index = _jets_index;
175 template <
class J>
inline double _bj_dist(
176 const J *
const jetA,
const J *
const jetB)
const {
177 double dphi = std::abs(jetA->phi - jetB->phi);
178 double deta = (jetA->eta - jetB->eta);
179 if (dphi > pi) {dphi = twopi - dphi;}
180 return dphi*dphi + deta*deta;
185 template <
class J>
inline double _bj_dist_not_periodic(
186 const J *
const jetA,
const J *
const jetB)
const {
187 double dphi = jetA->phi - jetB->phi;
188 double deta = (jetA->eta - jetB->eta);
189 return dphi*dphi + deta*deta;
195 FASTJET_END_NAMESPACE