00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
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
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;
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
00125
00126 #endif // __FASTJET_RANGEDEFINITION_HH__