fastjet 2.4.5
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
fastjet::RangeDefinition Class Reference

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

#include <RangeDefinition.hh>

Inheritance diagram for fastjet::RangeDefinition:
Inheritance graph
[legend]

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

fastjet::RangeDefinition::RangeDefinition ( ) [inline]

default constructor

Definition at line 50 of file RangeDefinition.hh.

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

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

Definition at line 53 of file RangeDefinition.hh.

References twopi.

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

destructor does nothing

Definition at line 63 of file RangeDefinition.hh.

{}
fastjet::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 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 fastjet::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 fastjet::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 fastjet::RangeDefinition::area ( ) const [inline, virtual]

area of the range region

Definition at line 142 of file RangeDefinition.hh.

Referenced by fastjet::ClusterSequenceAreaBase::empty_area_from_jets().

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

textual description of range

Reimplemented in fastjet::CircularRange.

Definition at line 145 of file RangeDefinition.hh.

                                               {
    std::ostringstream ostr;
    ostr << "Range: " << _rapmin << " <= y <= "   << _rapmax << ", "
                      << _phimin << " <= phi <= " << _phimax ;
    return ostr.str();
}
virtual void fastjet::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;

Reimplemented in fastjet::CircularRange.

Definition at line 136 of file RangeDefinition.hh.

Referenced by fastjet::ClusterSequenceArea::_warn_if_range_unsuitable().

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

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

Reimplemented in fastjet::CircularRange.

Definition at line 125 of file RangeDefinition.hh.

References twopi.

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

Reimplemented in fastjet::CircularRange.

Definition at line 91 of file RangeDefinition.hh.

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

place the range on the jet position

Definition at line 113 of file RangeDefinition.hh.

References fastjet::PseudoJet::phi(), and fastjet::PseudoJet::rap().

                                                  {
     set_position(jet.rap(),jet.phi());
  }
void fastjet::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 fastjet::d0::inline_maths::phi().

                                                                   {
     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

Definition at line 160 of file RangeDefinition.hh.

Definition at line 163 of file RangeDefinition.hh.

Definition at line 163 of file RangeDefinition.hh.

Definition at line 163 of file RangeDefinition.hh.

Definition at line 160 of file RangeDefinition.hh.

Definition at line 163 of file RangeDefinition.hh.

Definition at line 163 of file RangeDefinition.hh.

Definition at line 153 of file RangeDefinition.hh.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines