FastJet  3.0.6
RangeDefinition.cc
1 //STARTHEADER
2 // $Id: RangeDefinition.cc 2577 2011-09-13 15:11:38Z salam $
3 //
4 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
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, see <http://www.gnu.org/licenses/>.
26 //----------------------------------------------------------------------
27 //ENDHEADER
28 
29 #include "fastjet/RangeDefinition.hh"
30 
31 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
32 
33 using namespace std;
34 
35 LimitedWarning RangeDefinition::_warnings_deprecated;
36 
37 // calculate, and set in _total_area, the area with a numerical test
38 // takes a reasonable time with rapmax = 10, npoints = 100
39 void RangeDefinition::_numerical_total_area(double rapmax, int npoints) {
40 
41  int count = 0;
42  double deltaphi = twopi/double(npoints);
43  double deltarap = 2.0*rapmax/double(npoints);
44  double phi = 0.0;
45  for(int i = 0; i < npoints; i++) {
46  double rap = -rapmax;
47  for (int j = 0; j < npoints; j++) {
48  if ( is_in_range(rap,phi) ) { count++; }
49  rap += deltarap;
50  }
51  phi += deltaphi;
52  }
53 
54  _total_area = double(count)/double(npoints*npoints)*2.0*twopi*rapmax;
55 }
56 
57 
58 // the use of RangeDefinition is deprecated since FastJet version
59 // 3.0 onwards. Please use Selector instead.
60 // RangeDefinition is only provided for backward compatibility
61 // reasons and is not guaranteed to work in future releases of
62 // FastJet.
63 void RangeDefinition::_warn_deprecated() const{
64  _warnings_deprecated.warn("The use of RangeDefinition is deprecated since FastJet version 3.0 onwards. Please consider using Selector (defined in fastjet/Selector.hh) instead. There is no guarantee that support for RangeDefinition will be provided in future releases of FastJet.");
65 }
66 
67 FASTJET_END_NAMESPACE