RangeDefinition.hh

Go to the documentation of this file.
00001 //STARTHEADER
00002 // $Id: RangeDefinition.hh 958 2007-11-28 17:43:48Z cacciari $
00003 //
00004 // Copyright (c) 2005-2007, Matteo Cacciari and Gavin Salam
00005 //
00006 //----------------------------------------------------------------------
00007 // This file is part of FastJet.
00008 //
00009 //  FastJet is free software; you can redistribute it and/or modify
00010 //  it under the terms of the GNU General Public License as published by
00011 //  the Free Software Foundation; either version 2 of the License, or
00012 //  (at your option) any later version.
00013 //
00014 //  The algorithms that underlie FastJet have required considerable
00015 //  development and are described in hep-ph/0512210. If you use
00016 //  FastJet as part of work towards a scientific publication, please
00017 //  include a citation to the FastJet paper.
00018 //
00019 //  FastJet is distributed in the hope that it will be useful,
00020 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022 //  GNU General Public License for more details.
00023 //
00024 //  You should have received a copy of the GNU General Public License
00025 //  along with FastJet; if not, write to the Free Software
00026 //  Foundation, Inc.:
00027 //      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028 //----------------------------------------------------------------------
00029 //ENDHEADER
00030 
00031 #ifndef __FASTJET_RANGEDEFINITION_HH__
00032 #define __FASTJET_RANGEDEFINITION_HH__
00033 
00034 #include "fastjet/PseudoJet.hh"
00035 #include<sstream>
00036 #include<iostream>
00037 #include<string>
00038 
00039 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
00040 
00041 //----------------------------------------------------------------------
00042 //
00046 class RangeDefinition {
00047 public:
00049   RangeDefinition() {}
00050 
00052   RangeDefinition(double rapmax) {
00053                      assert ( rapmax > 0.0 );
00054                      _rapmax = rapmax;
00055                      _rapmin = -rapmax;
00056                      _phimin = 0.0;
00057                      _phimax = twopi;
00058                      _total_area = 2.0*rapmax*twopi; }
00059   
00061   virtual ~RangeDefinition() {}
00062      
00065   RangeDefinition(double rapmin, double rapmax, 
00066                   double phimin = 0.0, double phimax = twopi) {
00067                      assert ( rapmin < rapmax);
00068                      assert ( phimin < phimax);
00069                      assert ( phimin >= 0.0 );
00070                      _rapmax = rapmax;
00071                      _rapmin = rapmin;
00072                      _phimin = phimin;
00073                      _phimax = phimax;
00074                      _total_area = (_rapmax - _rapmin)*(_phimax - _phimin); }
00075 
00076 
00078   inline bool is_in_range(const PseudoJet & jet) const {
00079     double rap = jet.rap();
00080     double phi = jet.phi();
00081     return is_in_range(rap,phi);
00082   }
00083   
00085   virtual inline bool is_in_range(double rap, double phi) const {
00086     return  ( rap >= _rapmin && 
00087               rap <= _rapmax &&
00088               phi >= _phimin &&
00089               phi <= _phimax );
00090   }
00091 
00094   virtual inline void get_rap_limits(double & rapmin, double & rapmax) const {
00095     rapmin = _rapmin;
00096     rapmax = _rapmax;
00097   }
00098   
00100   virtual inline double area() const { return _total_area; }
00101   
00103   virtual inline std::string description() const {
00104     std::ostringstream ostr;
00105     ostr << "Range: " << _rapmin << " <= y <= "   << _rapmax << ", "
00106                       << _phimin << " <= phi <= " << _phimax ;
00107     return ostr.str();
00108 }
00109 
00110 protected:
00111   double _total_area;  // total area of specified range
00112 
00117   void _numerical_total_area(double rapmax, int npoints) ;
00118 
00119 private:
00120   double _rapmin,_rapmax,_phimin,_phimax;
00121 
00122 };
00123 
00124 FASTJET_END_NAMESPACE        // defined in fastjet/internal/base.hh
00125 
00126 #endif // __FASTJET_RANGEDEFINITION_HH__

Generated on Tue Dec 18 17:05:02 2007 for fastjet by  doxygen 1.5.2