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
fastjet::CircularRange
[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.

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.

00050 {}

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.

00053                                  {
00054                      assert ( rapmax > 0.0 );
00055                      _rapmax = rapmax;
00056                      _rapmin = -rapmax;
00057                      _phimin = 0.0;
00058                      _phimax = twopi;
00059                      _total_area = 2.0*rapmax*twopi;
00060                      _phispan = _phimax-_phimin; }

virtual fastjet::RangeDefinition::~RangeDefinition (  )  [inline, virtual]

destructor does nothing

Definition at line 63 of file RangeDefinition.hh.

00063 {}

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.

00068                                                               {
00069                      assert ( rapmin < rapmax);
00070                      assert ( phimin < phimax);
00071                      assert ( phimin > -twopi );
00072                      assert ( phimax < 2*twopi);
00073                      _rapmax = rapmax;
00074                      _rapmin = rapmin;
00075                      _phimin = phimin;
00076                      _phimax = phimax;
00077                      if (_phimax-_phimin > twopi)
00078                        _total_area = (_rapmax - _rapmin)*twopi;
00079                      else
00080                        _total_area = (_rapmax - _rapmin)*(_phimax - _phimin);
00081                      _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.

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

.rapmax,0..2pi) are contained in the range; it takes a reasonable time with rapmax = 10, npoints = 100.

Definition at line 39 of file RangeDefinition.cc.

References _total_area, is_in_range(), fastjet::d0::inline_maths::phi(), and fastjet::twopi.

00039                                                                       {
00040 
00041       int count = 0;
00042       double deltaphi = twopi/double(npoints);
00043       double deltarap = 2.0*rapmax/double(npoints);
00044       double phi = 0.0;
00045       for(int i = 0; i < npoints; i++) {
00046         double rap = -rapmax;
00047         for (int j = 0; j < npoints; j++) {
00048           if ( is_in_range(rap,phi) ) { count++; }
00049           rap += deltarap;
00050         }
00051         phi += deltaphi;
00052       }
00053 
00054       _total_area = double(count)/double(npoints*npoints)*2.0*twopi*rapmax;
00055 }

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().

00142 { 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.

00145                                                {
00146     std::ostringstream ostr;
00147     ostr << "Range: " << _rapmin << " <= y <= "   << _rapmax << ", "
00148                       << _phimin << " <= phi <= " << _phimax ;
00149     return ostr.str();
00150 }

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().

00136                                                                              {
00137     rapmin = _rapmin;
00138     rapmax = _rapmax;
00139   }

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.

00125                                                                 {
00126     double dphi=phi-_phimin;
00127     if (dphi >= twopi) dphi -= twopi;
00128     if (dphi < 0)      dphi += twopi;
00129     return  ( rap  >= _rapmin && 
00130               rap  <= _rapmax &&
00131               dphi <= _phispan );
00132   }

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.

00091 { 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().

00113                                                   {
00114      set_position(jet.rap(),jet.phi());
00115   }

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.

00100                                                                    {
00101      if (! is_localizable() ) {
00102        std::ostringstream err;
00103        err << description() << 
00104          "\nThis range is not localizable. set_position() should not be used on it.";         
00105        throw fastjet::Error(err.str()); 
00106      } else {
00107        _rapjet = rap;
00108        _phijet = phi;
00109      }
00110   }


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.

Referenced by _numerical_total_area().


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

Generated on Fri May 29 20:29:57 2009 for fastjet by  doxygen 1.5.7.1