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 FASTJET_BEGIN_NAMESPACE
43 double eta, phi, kt2, NN_dist;
44 TiledJet3 * NN, *previous, * next;
45 int _jets_index, tile_index;
46 bool _minheap_update_needed;
51 inline void label_minheap_update_needed() {_minheap_update_needed =
true;}
52 inline void label_minheap_update_done() {_minheap_update_needed =
false;}
53 inline bool minheap_update_needed()
const {
return _minheap_update_needed;}
60 Tile3 * begin_tiles[n_tile_neighbours];
62 Tile3 ** surrounding_tiles;
70 TiledJet3 * ghost_head;
76 double eta_centre, phi_centre;
78 bool is_near_zero_phi(
double tile_size_phi)
const {
79 return phi_centre < tile_size_phi || (twopi-phi_centre) < tile_size_phi;
85 class LazyTiling9SeparateGhosts {
87 LazyTiling9SeparateGhosts(ClusterSequence & cs);
101 static double ghost_pt2_threshold;
104 ClusterSequence & _cs;
105 const std::vector<PseudoJet> & _jets;
106 std::vector<Tile3> _tiles;
109 double _Rparam, _R2, _invR2;
110 double _tiles_eta_min, _tiles_eta_max;
111 double _tile_size_eta, _tile_size_phi;
112 double _tile_half_size_eta, _tile_half_size_phi;
113 int _n_tiles_phi,_tiles_ieta_min,_tiles_ieta_max;
115 std::vector<TiledJet3 *> _jets_for_minheap;
119 void _initialise_tiles();
123 inline int _tile_index (
int ieta,
int iphi)
const {
126 return (ieta-_tiles_ieta_min)*_n_tiles_phi
127 + (iphi+_n_tiles_phi) % _n_tiles_phi;
130 void _bj_remove_from_tiles(TiledJet3 *
const jet);
133 int _tile_index(
const double eta,
const double phi)
const;
136 void _tj_set_jetinfo(TiledJet3 *
const jet,
const int _jets_index,
bool is_ghost);
138 void _print_tiles(TiledJet3 * briefjets )
const;
139 void _add_neighbours_to_tile_union(
const int tile_index,
140 std::vector<int> & tile_union,
int & n_near_tiles)
const;
141 void _add_untagged_neighbours_to_tile_union(
const int tile_index,
142 std::vector<int> & tile_union,
int & n_near_tiles);
143 void _add_untagged_neighbours_to_tile_union_using_max_info(
const TiledJet3 *
const jet,
144 std::vector<int> & tile_union,
int & n_near_tiles);
145 double _distance_to_tile(
const TiledJet3 * bj,
const Tile3 *)
const;
146 void _update_jetX_jetI_NN(TiledJet3 * jetX, TiledJet3 * jetI, std::vector<TiledJet3 *> & jets_for_minheap);
148 void _set_NN(TiledJet3 * jetI, std::vector<TiledJet3 *> & jets_for_minheap);
152 template <
class J>
double _bj_diJ(
const J *
const jet)
const {
153 double kt2 = jet->kt2;
154 if (jet->NN != NULL) {
if (jet->NN->kt2 < kt2) {kt2 = jet->NN->kt2;}}
155 return jet->NN_dist * kt2;
160 template <
class J>
inline void _bj_set_jetinfo(
161 J *
const jetA,
const int _jets_index)
const {
162 jetA->eta = _jets[_jets_index].rap();
163 jetA->phi = _jets[_jets_index].phi_02pi();
164 jetA->kt2 = _cs.jet_scale_for_algorithm(_jets[_jets_index]);
165 jetA->_jets_index = _jets_index;
173 template <
class J>
inline double _bj_dist(
174 const J *
const jetA,
const J *
const jetB)
const {
175 double dphi = std::abs(jetA->phi - jetB->phi);
176 double deta = (jetA->eta - jetB->eta);
177 if (dphi > pi) {dphi = twopi - dphi;}
178 return dphi*dphi + deta*deta;
183 template <
class J>
inline double _bj_dist_not_periodic(
184 const J *
const jetA,
const J *
const jetB)
const {
185 double dphi = jetA->phi - jetB->phi;
186 double deta = (jetA->eta - jetB->eta);
187 return dphi*dphi + deta*deta;
193 FASTJET_END_NAMESPACE
195 #endif // __FASTJET_LAZYTILING9SEPARATEGHOSTS_HH__