FastJet  3.2.0
RangeDefinition.cc
1 //FJSTARTHEADER
2 // $Id: RangeDefinition.cc 3433 2014-07-23 08:17:03Z salam $
3 //
4 // Copyright (c) 2005-2014, 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. They are described in the original FastJet paper,
16 // hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
17 // FastJet as part of work towards a scientific publication, please
18 // quote the version you use and include a citation to the manual and
19 // optionally also to hep-ph/0512210.
20 //
21 // FastJet is distributed in the hope that it will be useful,
22 // but WITHOUT ANY WARRANTY; without even the implied warranty of
23 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 // GNU General Public License for more details.
25 //
26 // You should have received a copy of the GNU General Public License
27 // along with FastJet. If not, see <http://www.gnu.org/licenses/>.
28 //----------------------------------------------------------------------
29 //FJENDHEADER
30 
31 #include "fastjet/RangeDefinition.hh"
32 
33 FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
34 
35 using namespace std;
36 
37 LimitedWarning RangeDefinition::_warnings_deprecated;
38 
39 // calculate, and set in _total_area, the area with a numerical test
40 // takes a reasonable time with rapmax = 10, npoints = 100
41 void RangeDefinition::_numerical_total_area(double rapmax, int npoints) {
42 
43  int count = 0;
44  double deltaphi = twopi/double(npoints);
45  double deltarap = 2.0*rapmax/double(npoints);
46  double phi = 0.0;
47  for(int i = 0; i < npoints; i++) {
48  double rap = -rapmax;
49  for (int j = 0; j < npoints; j++) {
50  if ( is_in_range(rap,phi) ) { count++; }
51  rap += deltarap;
52  }
53  phi += deltaphi;
54  }
55 
56  _total_area = double(count)/double(npoints*npoints)*2.0*twopi*rapmax;
57 }
58 
59 
60 // the use of RangeDefinition is deprecated since FastJet version
61 // 3.0 onwards. Please use Selector instead.
62 // RangeDefinition is only provided for backward compatibility
63 // reasons and is not guaranteed to work in future releases of
64 // FastJet.
65 void RangeDefinition::_warn_deprecated() const{
66  _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.");
67 }
68 
69 FASTJET_END_NAMESPACE