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.

00050 {}

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.

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 RangeDefinition::~RangeDefinition (  )  [inline, virtual]

destructor does nothing

Definition at line 63 of file RangeDefinition.hh.

00063 {}

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.

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 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 _total_area, is_in_range(), fastjet::d0::inline_maths::phi(), and 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 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().

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

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

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

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

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.

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 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 PseudoJet::phi(), fastjet::d0::inline_maths::phi(), and PseudoJet::rap().

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

00118                                                        {
00119     double rap = jet.rap();
00120     double phi = jet.phi();
00121     return is_in_range(rap,phi);
00122   }

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

00091 { 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 PseudoJet::phi(), PseudoJet::rap(), and set_position().

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

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(), and is_localizable().

Referenced by set_position().

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

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 _numerical_total_area(), area(), and RangeDefinition().


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

Generated on 26 Feb 2010 for fastjet by  doxygen 1.6.1