33 #include "fastjet/RectangularGrid.hh" 
   37 FASTJET_BEGIN_NAMESPACE      
 
   40 RectangularGrid::RectangularGrid()
 
   41     : _ymax(-1.0), _ymin(1.0), _requested_drap(-1.0), _requested_dphi(-1.0) {
 
   60   double y_minus_ymin = p.
rap() - _ymin;
 
   61   if (y_minus_ymin < 0) 
return -1;
 
   62   int iy = int(y_minus_ymin * _inverse_dy); 
 
   63   if (iy >= _ny) 
return -1;
 
   72   int iphi = int( p.
phi() * _inverse_dphi );
 
   73   if (iphi == _nphi) iphi = 0; 
 
   75   return iy*_nphi + iphi;
 
   80 void RectangularGrid::_setup_grid() {
 
   82   assert(_ymax > _ymin);
 
   83   assert(_requested_drap > 0);
 
   84   assert(_requested_dphi > 0);
 
   86   double ny_double = (_ymax-_ymin) / _requested_drap;
 
   87   _ny = max(
int(ny_double+0.5),1);
 
   88   _dy = (_ymax-_ymin) / _ny;
 
   89   _inverse_dy = _ny/(_ymax-_ymin);
 
   91   _nphi = int (twopi / _requested_dphi + 0.5);
 
   92   _dphi = twopi / _nphi;
 
   93   _inverse_dphi = _nphi/twopi;
 
   96   assert(_ny >= 1 && _nphi >= 1);
 
   98   _ntotal = _nphi * _ny;
 
  100   _cell_area = _dy * _dphi;
 
  104   if (_tile_selector.
worker()) {
 
  107     for (
int i = 0; i < 
n_tiles(); i++) {
 
  108       int iphi = i % _nphi;
 
  109       int irap = i / _nphi;
 
  110       double phi = (iphi + 0.5)*_dphi;
 
  111       double rap = (irap + 0.5)*_dy + _ymin;
 
  112       _is_good[i] = _tile_selector.
pass(
PtYPhiM(1.0, rap, phi));
 
  113       if (_is_good[i]) _ngood++;
 
  123     return "Uninitialised rectangular grid";
 
  126   oss << 
"rectangular grid with rapidity extent " << _ymin << 
" < rap < " << _ymax
 
  127       << 
", tile size drap x dphi = " << _dy << 
" x " << _dphi;
 
  129   if (_tile_selector.
worker()) {
 
  130     oss << 
", good tiles are those that pass selector " <<  _tile_selector.
description();
 
  135 FASTJET_END_NAMESPACE      
 
PseudoJet PtYPhiM(double pt, double y, double phi, double m)
return a pseudojet with the given pt, y, phi and mass 
double rap() const 
returns the rapidity or some large value when the rapidity is infinite 
virtual bool is_initialised() const 
returns true if the grid is in a suitably initialised state 
std::string description() const 
returns a textual description of the selector 
const SharedPtr< SelectorWorker > & worker() const 
returns a (reference to) the underlying worker's shared pointer 
virtual int n_tiles() const 
returns the total number of tiles in the tiling; valid tile indices run from 0 ... 
double phi() const 
returns phi (in the range 0..2pi) 
bool pass(const PseudoJet &jet) const 
return true if the jet passes the selection 
virtual int tile_index(const PseudoJet &p) const 
returns the index of the tile in which p is located, or -1 if p is outside the tiling region ...
Class to contain pseudojets, including minimal information of use to jet-clustering routines...
virtual std::string description() const 
returns a textual description of the grid