1 #ifndef __FASTJET_LAZYTILING9_HH__
2 #define __FASTJET_LAZYTILING9_HH__
37 #include "fastjet/internal/MinHeap.hh"
38 #include "fastjet/ClusterSequence.hh"
39 #include "fastjet/internal/LazyTiling9Alt.hh"
42 FASTJET_BEGIN_NAMESPACE
47 Tile2Base * begin_tiles[NN];
49 Tile2Base ** surrounding_tiles;
51 Tile2Base ** RH_tiles;
53 Tile2Base ** end_tiles;
60 bool use_periodic_delta_phi;
64 double eta_centre, phi_centre;
68 int jet_count()
const {
70 const TiledJet * jet = head;
80 typedef Tile2Base<9> Tile2;
119 LazyTiling9(ClusterSequence & cs);
127 ClusterSequence & _cs;
128 const std::vector<PseudoJet> & _jets;
129 std::vector<Tile2> _tiles;
134 #endif // INSTRUMENT2
136 double _Rparam, _R2, _invR2;
137 double _tiles_eta_min, _tiles_eta_max;
138 double _tile_size_eta, _tile_size_phi;
139 double _tile_half_size_eta, _tile_half_size_phi;
140 int _n_tiles_phi,_tiles_ieta_min,_tiles_ieta_max;
142 std::vector<TiledJet *> _jets_for_minheap;
146 void _initialise_tiles();
150 inline int _tile_index (
int ieta,
int iphi)
const {
153 return (ieta-_tiles_ieta_min)*_n_tiles_phi
154 + (iphi+_n_tiles_phi) % _n_tiles_phi;
157 void _bj_remove_from_tiles(TiledJet *
const jet);
160 int _tile_index(
const double eta,
const double phi)
const;
163 void _tj_set_jetinfo(TiledJet *
const jet,
const int _jets_index);
165 void _print_tiles(TiledJet * briefjets )
const;
166 void _add_neighbours_to_tile_union(
const int tile_index,
167 std::vector<int> & tile_union,
int & n_near_tiles)
const;
168 void _add_untagged_neighbours_to_tile_union(
const int tile_index,
169 std::vector<int> & tile_union,
int & n_near_tiles);
170 void _add_untagged_neighbours_to_tile_union_using_max_info(
const TiledJet *
const jet,
171 std::vector<int> & tile_union,
int & n_near_tiles);
172 double _distance_to_tile(
const TiledJet * bj,
const Tile2 *)
178 void _update_jetX_jetI_NN(TiledJet * jetX, TiledJet * jetI, std::vector<TiledJet *> & jets_for_minheap);
180 void _set_NN(TiledJet * jetI, std::vector<TiledJet *> & jets_for_minheap);
184 template <
class J>
double _bj_diJ(
const J *
const jet)
const {
185 double kt2 = jet->kt2;
186 if (jet->NN != NULL) {
if (jet->NN->kt2 < kt2) {kt2 = jet->NN->kt2;}}
187 return jet->NN_dist * kt2;
192 template <
class J>
inline void _bj_set_jetinfo(
193 J *
const jetA,
const int _jets_index)
const {
194 jetA->eta = _jets[_jets_index].rap();
195 jetA->phi = _jets[_jets_index].phi_02pi();
196 jetA->kt2 = _cs.jet_scale_for_algorithm(_jets[_jets_index]);
197 jetA->_jets_index = _jets_index;
205 template <
class J>
inline double _bj_dist(
206 const J *
const jetA,
const J *
const jetB)
213 double dphi = std::abs(jetA->phi - jetB->phi);
214 double deta = (jetA->eta - jetB->eta);
215 if (dphi > pi) {dphi = twopi - dphi;}
216 return dphi*dphi + deta*deta;
221 template <
class J>
inline double _bj_dist_not_periodic(
222 const J *
const jetA,
const J *
const jetB)
230 double dphi = jetA->phi - jetB->phi;
231 double deta = (jetA->eta - jetB->eta);
232 return dphi*dphi + deta*deta;
238 FASTJET_END_NAMESPACE
240 #endif // __FASTJET_LAZYTILING9_HH__