Fork me on GitHub

source: svn/trunk/Utilities/Fastjet/include/fastjet/RangeDefinition.hh@ 168

Last change on this file since 168 was 11, checked in by severine ovyn, 16 years ago

Fastjet added; CDFCones directory has been changed

File size: 4.3 KB
Line 
1//STARTHEADER
2// $Id: RangeDefinition.hh,v 1.1 2008-11-06 14:32:08 ovyn Exp $
3//
4// Copyright (c) 2005-2007, Matteo Cacciari and Gavin Salam
5//
6//----------------------------------------------------------------------
7// This file is part of FastJet.
8//
9// FastJet is free software; you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation; either version 2 of the License, or
12// (at your option) any later version.
13//
14// The algorithms that underlie FastJet have required considerable
15// development and are described in hep-ph/0512210. If you use
16// FastJet as part of work towards a scientific publication, please
17// include a citation to the FastJet paper.
18//
19// FastJet is distributed in the hope that it will be useful,
20// but WITHOUT ANY WARRANTY; without even the implied warranty of
21// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22// GNU General Public License for more details.
23//
24// You should have received a copy of the GNU General Public License
25// along with FastJet; if not, write to the Free Software
26// Foundation, Inc.:
27// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28//----------------------------------------------------------------------
29//ENDHEADER
30
31#ifndef __FASTJET_RANGEDEFINITION_HH__
32#define __FASTJET_RANGEDEFINITION_HH__
33
34#include "Utilities/Fastjet/include/fastjet/PseudoJet.hh"
35#include<sstream>
36#include<iostream>
37#include<string>
38
39FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
40
41//----------------------------------------------------------------------
42//
43/// class for holding a range definition specification, given by limits
44/// on rapidity and azimuth.
45///
46class RangeDefinition {
47public:
48 /// default constructor
49 RangeDefinition() {}
50
51 /// constructor for a range definition given by |y|<rapmax
52 RangeDefinition(double rapmax) {
53 assert ( rapmax > 0.0 );
54 _rapmax = rapmax;
55 _rapmin = -rapmax;
56 _phimin = 0.0;
57 _phimax = twopi;
58 _total_area = 2.0*rapmax*twopi; }
59
60 /// destructor does nothing
61 virtual ~RangeDefinition() {}
62
63 /// constructor for a range definition given by
64 /// rapmin <= y <= rapmax, phimin <= phi <= phimax
65 RangeDefinition(double rapmin, double rapmax,
66 double phimin = 0.0, double phimax = twopi) {
67 assert ( rapmin < rapmax);
68 assert ( phimin < phimax);
69 assert ( phimin >= 0.0 );
70 _rapmax = rapmax;
71 _rapmin = rapmin;
72 _phimin = phimin;
73 _phimax = phimax;
74 _total_area = (_rapmax - _rapmin)*(_phimax - _phimin); }
75
76
77 /// return bool according to whether the jet is within the given range
78 inline bool is_in_range(const PseudoJet & jet) const {
79 double rap = jet.rap();
80 double phi = jet.phi();
81 return is_in_range(rap,phi);
82 }
83
84 /// return bool according to whether a (rap,phi) point is in range
85 virtual inline bool is_in_range(double rap, double phi) const {
86 return ( rap >= _rapmin &&
87 rap <= _rapmax &&
88 phi >= _phimin &&
89 phi <= _phimax );
90 }
91
92 /// return the minimal and maximal rapidity of this range; remember to
93 /// replace this if you write a derived class with more complex ranges;
94 virtual inline void get_rap_limits(double & rapmin, double & rapmax) const {
95 rapmin = _rapmin;
96 rapmax = _rapmax;
97 }
98
99 /// area of the range region
100 virtual inline double area() const { return _total_area; }
101
102 /// textual description of range
103 virtual inline std::string description() const {
104 std::ostringstream ostr;
105 ostr << "Range: " << _rapmin << " <= y <= " << _rapmax << ", "
106 << _phimin << " <= phi <= " << _phimax ;
107 return ostr.str();
108}
109
110protected:
111 double _total_area; // total area of specified range
112
113 /// calculate, and set _total_area, by calculating which of points on
114 /// a grid (npoints * npoints from -rapmax..rapmax,0..2pi) are contained
115 /// in the range; it takes a reasonable time with rapmax = 10,
116 /// npoints = 100.
117 void _numerical_total_area(double rapmax, int npoints) ;
118
119private:
120 double _rapmin,_rapmax,_phimin,_phimax;
121
122};
123
124FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh
125
126#endif // __FASTJET_RANGEDEFINITION_HH__
Note: See TracBrowser for help on using the repository browser.