fastjet 2.4.3
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes

RangeDefinition Class Reference

class for holding a range definition specification, given by limits on rapidity and azimuth. More...

#include <RangeDefinition.hh>

List of all members.

Public Member Functions

 RangeDefinition ()
 default constructor
 RangeDefinition (double rapmax)
 constructor for a range definition given by |y|<rapmax
virtual ~RangeDefinition ()
 destructor does nothing
 RangeDefinition (double rapmin, double rapmax, double phimin=0.0, double phimax=twopi)
 constructor for a range definition given by rapmin <= y <= rapmax, phimin <= phi <= phimax
virtual bool is_localizable () const
 returns true if the range is localizable (i.e.
void set_position (const double &rap, const double &phi)
 place the range on the rap-phi position
void set_position (const PseudoJet &jet)
 place the range on the jet position
bool is_in_range (const PseudoJet &jet) const
 return bool according to whether the jet is within the given range
virtual bool is_in_range (double rap, double phi) const
 return bool according to whether a (rap,phi) point is in range
virtual void get_rap_limits (double &rapmin, double &rapmax) const
 return the minimal and maximal rapidity of this range; remember to replace this if you write a derived class with more complex ranges;
virtual double area () const
 area of the range region
virtual std::string description () const
 textual description of range

Protected Member Functions

void _numerical_total_area (double rapmax, int npoints)
 calculate, and set _total_area, by calculating which of points on a grid (npoints * npoints from -rapmax..rapmax,0..2pi) are contained in the range; it takes a reasonable time with rapmax = 10, npoints = 100.

Protected Attributes

double _total_area
double _rapjet
double _phijet

Private Attributes

double _rapmin
double _rapmax
double _phimin
double _phimax
double _phispan

Detailed Description

class for holding a range definition specification, given by limits on rapidity and azimuth.

Definition at line 47 of file RangeDefinition.hh.


Constructor & Destructor Documentation

RangeDefinition::RangeDefinition ( ) [inline]

default constructor

Definition at line 50 of file RangeDefinition.hh.

{}
RangeDefinition::RangeDefinition ( double  rapmax) [inline]

constructor for a range definition given by |y|<rapmax

Definition at line 53 of file RangeDefinition.hh.

References _phimax, _phimin, _phispan, _rapmax, _rapmin, _total_area, and twopi.

                                 {
                     assert ( rapmax > 0.0 );
                     _rapmax = rapmax;
                     _rapmin = -rapmax;
                     _phimin = 0.0;
                     _phimax = twopi;
                     _total_area = 2.0*rapmax*twopi;
                     _phispan = _phimax-_phimin; }
virtual RangeDefinition::~RangeDefinition ( ) [inline, virtual]

destructor does nothing

Definition at line 63 of file RangeDefinition.hh.

{}
RangeDefinition::RangeDefinition ( double  rapmin,
double  rapmax,
double  phimin = 0.0,
double  phimax = twopi 
) [inline]

constructor for a range definition given by rapmin <= y <= rapmax, phimin <= phi <= phimax

Definition at line 67 of file RangeDefinition.hh.

References _phimax, _phimin, _phispan, _rapmax, _rapmin, _total_area, and twopi.

                                                              {
                     assert ( rapmin < rapmax);
                     assert ( phimin < phimax);
                     assert ( phimin > -twopi );
                     assert ( phimax < 2*twopi);
                     _rapmax = rapmax;
                     _rapmin = rapmin;
                     _phimin = phimin;
                     _phimax = phimax;
                     if (_phimax-_phimin > twopi)
                       _total_area = (_rapmax - _rapmin)*twopi;
                     else
                       _total_area = (_rapmax - _rapmin)*(_phimax - _phimin);
                     _phispan = _phimax-_phimin; }

Member Function Documentation

void RangeDefinition::_numerical_total_area ( double  rapmax,
int  npoints 
) [protected]

calculate, and set _total_area, by calculating which of points on a grid (npoints * npoints from -rapmax..rapmax,0..2pi) are contained in the range; it takes a reasonable time with rapmax = 10, npoints = 100.

calculate, and set in _total_area, the area with a numerical test takes a reasonable time with rapmax = 10, npoints = 100

Definition at line 39 of file RangeDefinition.cc.

References d0::inline_maths::phi(), and twopi.

                                                                      {

      int count = 0;
      double deltaphi = twopi/double(npoints);
      double deltarap = 2.0*rapmax/double(npoints);
      double phi = 0.0;
      for(int i = 0; i < npoints; i++) {
        double rap = -rapmax;
        for (int j = 0; j < npoints; j++) {
          if ( is_in_range(rap,phi) ) { count++; }
          rap += deltarap;
        }
        phi += deltaphi;
      }

      _total_area = double(count)/double(npoints*npoints)*2.0*twopi*rapmax;
}
virtual double RangeDefinition::area ( ) const [inline, virtual]

area of the range region

Definition at line 142 of file RangeDefinition.hh.

References _total_area.

Referenced by ClusterSequenceAreaBase::empty_area_from_jets().

{ return _total_area; }
virtual std::string RangeDefinition::description ( ) const [inline, virtual]

textual description of range

Definition at line 145 of file RangeDefinition.hh.

References _phimax, _phimin, _rapmax, and _rapmin.

Referenced by set_position().

                                               {
    std::ostringstream ostr;
    ostr << "Range: " << _rapmin << " <= y <= "   << _rapmax << ", "
                      << _phimin << " <= phi <= " << _phimax ;
    return ostr.str();
}
virtual void RangeDefinition::get_rap_limits ( double &  rapmin,
double &  rapmax 
) const [inline, virtual]

return the minimal and maximal rapidity of this range; remember to replace this if you write a derived class with more complex ranges;

Definition at line 136 of file RangeDefinition.hh.

References _rapmax, and _rapmin.

Referenced by ClusterSequenceArea::_warn_if_range_unsuitable().

                                                                             {
    rapmin = _rapmin;
    rapmax = _rapmax;
  }
virtual bool RangeDefinition::is_in_range ( double  rap,
double  phi 
) const [inline, virtual]

return bool according to whether a (rap,phi) point is in range

Definition at line 125 of file RangeDefinition.hh.

References _phimin, _phispan, _rapmax, _rapmin, and twopi.

                                                                {
    double dphi=phi-_phimin;
    if (dphi >= twopi) dphi -= twopi;
    if (dphi < 0)      dphi += twopi;
    return  ( rap  >= _rapmin && 
              rap  <= _rapmax &&
              dphi <= _phispan );
  }
bool RangeDefinition::is_in_range ( const PseudoJet &  jet) const [inline]

return bool according to whether the jet is within the given range

Definition at line 118 of file RangeDefinition.hh.

References d0::inline_maths::phi().

Referenced by ClusterSequenceActiveArea::empty_area(), ClusterSequenceAreaBase::empty_area_from_jets(), ClusterSequenceActiveArea::n_empty_jets(), and ClusterSequenceAreaBase::parabolic_pt_per_unit_area().

                                                       {
    double rap = jet.rap();
    double phi = jet.phi();
    return is_in_range(rap,phi);
  }
virtual bool RangeDefinition::is_localizable ( ) const [inline, virtual]

returns true if the range is localizable (i.e.

set_position is meant to do something meaningful).

This version of the class is not localizable and so it returns false.

For localizable classes override this function with a function that returns true

Definition at line 91 of file RangeDefinition.hh.

Referenced by set_position().

{ return false; }
void RangeDefinition::set_position ( const PseudoJet &  jet) [inline]

place the range on the jet position

Definition at line 113 of file RangeDefinition.hh.

References set_position().

                                                  {
     set_position(jet.rap(),jet.phi());
  }
void RangeDefinition::set_position ( const double &  rap,
const double &  phi 
) [inline]

place the range on the rap-phi position

THIS DOES NOT DO ANYTHING FOR THIS CLASS AND IS ONLY THERE TO FACILITATE DERIVED CLASSES

DON'T NECESSARILY COUNT ON IT IN THE FUTURE EITHER???

Definition at line 100 of file RangeDefinition.hh.

References _phijet, _rapjet, description(), is_localizable(), and d0::inline_maths::phi().

Referenced by set_position().

                                                                   {
     if (! is_localizable() ) {
       std::ostringstream err;
       err << description() << 
         "\nThis range is not localizable. set_position() should not be used on it.";         
       throw fastjet::Error(err.str()); 
     } else {
       _rapjet = rap;
       _phijet = phi;
     }
  }

Member Data Documentation

double RangeDefinition::_phijet [protected]

Definition at line 160 of file RangeDefinition.hh.

Referenced by set_position().

double RangeDefinition::_phimax [private]

Definition at line 163 of file RangeDefinition.hh.

Referenced by description(), and RangeDefinition().

double RangeDefinition::_phimin [private]

Definition at line 163 of file RangeDefinition.hh.

Referenced by description(), is_in_range(), and RangeDefinition().

double RangeDefinition::_phispan [private]

Definition at line 163 of file RangeDefinition.hh.

Referenced by is_in_range(), and RangeDefinition().

double RangeDefinition::_rapjet [protected]

Definition at line 160 of file RangeDefinition.hh.

Referenced by set_position().

double RangeDefinition::_rapmax [private]

Definition at line 163 of file RangeDefinition.hh.

Referenced by description(), get_rap_limits(), is_in_range(), and RangeDefinition().

double RangeDefinition::_rapmin [private]

Definition at line 163 of file RangeDefinition.hh.

Referenced by description(), get_rap_limits(), is_in_range(), and RangeDefinition().

double RangeDefinition::_total_area [protected]

Definition at line 153 of file RangeDefinition.hh.

Referenced by area(), and RangeDefinition().


The documentation for this class was generated from the following files: