Fork me on GitHub

source: git/external/fastjet/CircularRange.hh@ 50d7259

ImprovedOutputFile Timing dual_readout llp
Last change on this file since 50d7259 was 35cdc46, checked in by Pavel Demin <demin@…>, 10 years ago

upgrade FastJet to version 3.1.0-beta.1, upgrade Nsubjettiness to version 2.1.0, add SoftKiller version 1.0.0

  • Property mode set to 100644
File size: 4.4 KB
Line 
1//FJSTARTHEADER
2// $Id: CircularRange.hh 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
32#ifndef __FASTJET_CIRCULARRANGE_HH__
33#define __FASTJET_CIRCULARRANGE_HH__
34
35#include "fastjet/RangeDefinition.hh"
36#include "fastjet/Error.hh"
37
38// for backwards compatibility: one should now use SelectorCircle,
39// defined in fastjet/Selector.hh, instead CircularRange
40#warning This file includes fastjet/CircularRange.hh, \
41a deprecated FastJet header provided only for backward compatibility. \
42This is not guaranteed to work in future releases of FastJet. \
43From FastJet 3.0 onwards, please consider using Selector, defined in \
44fastjet/Selector.hh, instead of RangeDefinition and, in particular, \
45SelectorCircle instead of CircularRange.
46
47FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
48
49class CircularRange : public fastjet::RangeDefinition {
50public:
51 /// constructor
52 CircularRange() {_set_invalid_rapphi();}
53
54 /// initialise CircularRange with a jet
55 CircularRange(const fastjet::PseudoJet & jet, double distance) {
56 _distance = distance;
57 _rapjet = jet.rap();
58 _phijet = jet.phi();
59 _total_area = fastjet::pi*_distance*_distance; }
60
61 /// initialise CircularRange with a (rap,phi) point
62 CircularRange(double rap, double phi, double distance) {
63 _distance = distance;
64 _rapjet = rap;
65 _phijet = phi;
66 _total_area = fastjet::pi*_distance*_distance; }
67
68 /// initialise CircularRange with just the radius parameter
69 CircularRange(double distance) {
70 _set_invalid_rapphi();
71 _distance = distance;
72 _total_area = fastjet::pi*_distance*_distance; }
73
74 /// destructor
75 virtual ~CircularRange() {}
76
77 /// return description of range
78 virtual inline std::string description() const {
79 std::ostringstream ostr;
80 ostr << "CircularRange: within distance "<< _distance << " of given jet or point." ;
81 return ostr.str(); }
82
83 /// returns true since this range is localizable (i.e. set_position
84 /// does something meaningful)
85 virtual inline bool is_localizable() const { return true; }
86
87 /// return bool according to whether (rap,phi) is in range
88 virtual inline bool is_in_range(double rap, double phi) const {
89 if (! _rapphi_are_valid()) {
90 throw Error("Circular range used without a center having being defined (use set_position())");
91 }
92 double deltaphi = _phijet - phi;
93 if ( deltaphi > pi) { deltaphi -= twopi; }
94 else if ( deltaphi < -pi) { deltaphi += twopi; }
95 bool inrange = ( (rap-_rapjet)*(rap-_rapjet) +
96 deltaphi*deltaphi <= _distance*_distance );
97 return inrange; }
98
99 /// return the minimal and maximal rapidity of this range
100 virtual inline void get_rap_limits(double & rapmin, double & rapmax) const {
101 rapmin = _rapjet - _distance;
102 rapmax = _rapjet + _distance; }
103
104private:
105 double _distance;
106
107 /// value for phi that marks it as invalid
108 const static double _invalid_phi = -1000.0;
109 /// set internal phi so as to mark things as invalid
110 void _set_invalid_rapphi() {_phijet = _invalid_phi;}
111 /// true if rap,phi are valid (tests only phi)
112 bool _rapphi_are_valid() const {return _phijet != _invalid_phi;}
113};
114
115FASTJET_END_NAMESPACE
116
117#endif // __FASTJET_CIRCULARRANGE_HH__
Note: See TracBrowser for help on using the repository browser.