File indexing completed on 2025-01-30 10:06:45
0001 #ifndef __FASTJET_LAZYTILING9SEPARATEGHOSTS_HH__
0002 #define __FASTJET_LAZYTILING9SEPARATEGHOSTS_HH__
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 #include "fastjet/internal/MinHeap.hh"
0036 #include "fastjet/ClusterSequence.hh"
0037 #include "fastjet/internal/LazyTiling9Alt.hh"
0038
0039 #include "fastjet/config.h"
0040
0041 FASTJET_BEGIN_NAMESPACE
0042
0043 class TiledJet3 {
0044 public:
0045 double eta, phi, kt2, NN_dist;
0046 TiledJet3 * NN, *previous, * next;
0047 int _jets_index, tile_index;
0048 bool _minheap_update_needed;
0049 bool is_ghost;
0050
0051
0052
0053 inline void label_minheap_update_needed() {_minheap_update_needed = true;}
0054 inline void label_minheap_update_done() {_minheap_update_needed = false;}
0055 inline bool minheap_update_needed() const {return _minheap_update_needed;}
0056 };
0057
0058
0059 class Tile3 {
0060 public:
0061
0062 Tile3 * begin_tiles[n_tile_neighbours];
0063
0064 Tile3 ** surrounding_tiles;
0065
0066 Tile3 ** RH_tiles;
0067
0068 Tile3 ** end_tiles;
0069
0070 TiledJet3 * head;
0071
0072 TiledJet3 * ghost_head;
0073
0074 bool tagged;
0075
0076
0077 double max_NN_dist;
0078 double eta_centre, phi_centre;
0079
0080 bool is_near_zero_phi(double tile_size_phi) const {
0081 return phi_centre < tile_size_phi || (twopi-phi_centre) < tile_size_phi;
0082 }
0083 };
0084
0085
0086
0087 class LazyTiling9SeparateGhosts {
0088 public:
0089 LazyTiling9SeparateGhosts(ClusterSequence & cs);
0090
0091 void run();
0092
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103 static double ghost_pt2_threshold;
0104
0105 protected:
0106 ClusterSequence & _cs;
0107 const std::vector<PseudoJet> & _jets;
0108 std::vector<Tile3> _tiles;
0109
0110
0111 double _Rparam, _R2, _invR2;
0112 double _tiles_eta_min, _tiles_eta_max;
0113 double _tile_size_eta, _tile_size_phi;
0114 double _tile_half_size_eta, _tile_half_size_phi;
0115 int _n_tiles_phi,_tiles_ieta_min,_tiles_ieta_max;
0116
0117 std::vector<TiledJet3 *> _jets_for_minheap;
0118
0119
0120
0121 void _initialise_tiles();
0122
0123
0124
0125 inline int _tile_index (int ieta, int iphi) const {
0126
0127
0128 return (ieta-_tiles_ieta_min)*_n_tiles_phi
0129 + (iphi+_n_tiles_phi) % _n_tiles_phi;
0130 }
0131
0132 void _bj_remove_from_tiles(TiledJet3 * const jet);
0133
0134
0135 int _tile_index(const double eta, const double phi) const;
0136
0137
0138 void _tj_set_jetinfo(TiledJet3 * const jet, const int _jets_index, bool is_ghost);
0139
0140 void _print_tiles(TiledJet3 * briefjets ) const;
0141 void _add_neighbours_to_tile_union(const int tile_index,
0142 std::vector<int> & tile_union, int & n_near_tiles) const;
0143 void _add_untagged_neighbours_to_tile_union(const int tile_index,
0144 std::vector<int> & tile_union, int & n_near_tiles);
0145 void _add_untagged_neighbours_to_tile_union_using_max_info(const TiledJet3 * const jet,
0146 std::vector<int> & tile_union, int & n_near_tiles);
0147 double _distance_to_tile(const TiledJet3 * bj, const Tile3 *) const;
0148 void _update_jetX_jetI_NN(TiledJet3 * jetX, TiledJet3 * jetI, std::vector<TiledJet3 *> & jets_for_minheap);
0149
0150 void _set_NN(TiledJet3 * jetI, std::vector<TiledJet3 *> & jets_for_minheap);
0151
0152
0153
0154 template <class J> double _bj_diJ(const J * const jet) const {
0155 double kt2 = jet->kt2;
0156 if (jet->NN != NULL) {if (jet->NN->kt2 < kt2) {kt2 = jet->NN->kt2;}}
0157 return jet->NN_dist * kt2;
0158 }
0159
0160
0161
0162 template <class J> inline void _bj_set_jetinfo(
0163 J * const jetA, const int _jets_index) const {
0164 jetA->eta = _jets[_jets_index].rap();
0165 jetA->phi = _jets[_jets_index].phi_02pi();
0166 jetA->kt2 = _cs.jet_scale_for_algorithm(_jets[_jets_index]);
0167 jetA->_jets_index = _jets_index;
0168
0169 jetA->NN_dist = _R2;
0170 jetA->NN = NULL;
0171 }
0172
0173
0174
0175 template <class J> inline double _bj_dist(
0176 const J * const jetA, const J * const jetB) const {
0177 double dphi = std::abs(jetA->phi - jetB->phi);
0178 double deta = (jetA->eta - jetB->eta);
0179 if (dphi > pi) {dphi = twopi - dphi;}
0180 return dphi*dphi + deta*deta;
0181 }
0182
0183
0184
0185 template <class J> inline double _bj_dist_not_periodic(
0186 const J * const jetA, const J * const jetB) const {
0187 double dphi = jetA->phi - jetB->phi;
0188 double deta = (jetA->eta - jetB->eta);
0189 return dphi*dphi + deta*deta;
0190 }
0191
0192 };
0193
0194
0195 FASTJET_END_NAMESPACE
0196
0197 #endif