Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:17

0001 //FJSTARTHEADER
0002 // $Id$
0003 //
0004 // Copyright (c) 2005-2021, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
0005 //
0006 //----------------------------------------------------------------------
0007 // This file is part of FastJet.
0008 //
0009 //  FastJet is free software; you can redistribute it and/or modify
0010 //  it under the terms of the GNU General Public License as published by
0011 //  the Free Software Foundation; either version 2 of the License, or
0012 //  (at your option) any later version.
0013 //
0014 //  The algorithms that underlie FastJet have required considerable
0015 //  development. They are described in the original FastJet paper,
0016 //  hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
0017 //  FastJet as part of work towards a scientific publication, please
0018 //  quote the version you use and include a citation to the manual and
0019 //  optionally also to hep-ph/0512210.
0020 //
0021 //  FastJet is distributed in the hope that it will be useful,
0022 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
0023 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0024 //  GNU General Public License for more details.
0025 //
0026 //  You should have received a copy of the GNU General Public License
0027 //  along with FastJet. If not, see <http://www.gnu.org/licenses/>.
0028 //----------------------------------------------------------------------
0029 //FJENDHEADER
0030 
0031 
0032 #ifndef __FASTJET_CIRCULARRANGE_HH__
0033 #define __FASTJET_CIRCULARRANGE_HH__
0034 
0035 #include "fastjet/RangeDefinition.hh"
0036 #include "fastjet/Error.hh"
0037 #include "fastjet/internal/deprecated.hh"
0038 
0039 // for backwards compatibility: one should now use SelectorCircle,
0040 // defined in fastjet/Selector.hh, instead CircularRange
0041 #warning This file includes fastjet/CircularRange.hh, \
0042 a deprecated FastJet header provided only for backward compatibility. \
0043 This is not guaranteed to work in future releases of FastJet. \
0044 From FastJet 3.0 onwards, please consider using Selector, defined in \
0045 fastjet/Selector.hh, instead of RangeDefinition and, in particular, \
0046 SelectorCircle instead of CircularRange.
0047 
0048 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
0049 
0050 class CircularRange : public fastjet::RangeDefinition {
0051 public:
0052   /// constructor
0053   FASTJET_DEPRECATED_MSG("CircularRange is deprecated since FastJet 3.0. Use SelectorCircle instead",
0054   CircularRange()) {_set_invalid_rapphi();}
0055   
0056   /// initialise CircularRange with a jet
0057   FASTJET_DEPRECATED_MSG("CircularRange is deprecated since FastJet 3.0. Use SelectorCircle instead",
0058   CircularRange(const fastjet::PseudoJet & jet, double distance)) {
0059                 _distance = distance;
0060         _rapjet = jet.rap();
0061         _phijet = jet.phi();
0062         _total_area = fastjet::pi*_distance*_distance;  }
0063 
0064   /// initialise CircularRange with a (rap,phi) point
0065   FASTJET_DEPRECATED_MSG("CircularRange is deprecated since FastJet 3.0. Use SelectorCircle instead",
0066   CircularRange(double rap, double phi, double distance)) {
0067                 _distance = distance;
0068         _rapjet = rap;
0069         _phijet = phi;
0070         _total_area = fastjet::pi*_distance*_distance;  }
0071 
0072   /// initialise CircularRange with just the radius parameter
0073   FASTJET_DEPRECATED_MSG("CircularRange is deprecated since FastJet 3.0. Use SelectorCircle instead",
0074   CircularRange(double distance)) {
0075                 _set_invalid_rapphi();
0076                 _distance = distance;
0077         _total_area = fastjet::pi*_distance*_distance;  }
0078   
0079   /// destructor
0080   virtual ~CircularRange() {}
0081   
0082   /// return description of range
0083   virtual inline std::string description() const FASTJET_OVERRIDE {
0084     std::ostringstream ostr;
0085     ostr << "CircularRange: within distance "<< _distance << " of given jet or point." ;
0086     return ostr.str(); }
0087 
0088   /// returns true since this range is localizable (i.e. set_position
0089   /// does something meaningful)
0090   virtual inline bool is_localizable() const FASTJET_OVERRIDE { return true; }
0091   
0092   /// return bool according to whether (rap,phi) is in range
0093   virtual inline bool is_in_range(double rap, double phi) const FASTJET_OVERRIDE {
0094      if (! _rapphi_are_valid()) {
0095        throw Error("Circular range used without a center having being defined (use set_position())");
0096      }
0097      double deltaphi = _phijet - phi;
0098      if ( deltaphi > pi) { deltaphi -= twopi; }
0099      else if ( deltaphi < -pi) { deltaphi += twopi; }
0100      bool inrange = ( (rap-_rapjet)*(rap-_rapjet) +
0101                 deltaphi*deltaphi <= _distance*_distance );
0102      return inrange; }
0103 
0104   /// return the minimal and maximal rapidity of this range
0105   virtual inline void get_rap_limits(double & rapmin, double & rapmax) const FASTJET_OVERRIDE {
0106      rapmin = _rapjet - _distance;
0107      rapmax = _rapjet + _distance; }
0108 
0109 private:
0110   double _distance;
0111 
0112   /// value for phi that marks it as invalid
0113   const static double _invalid_phi = -1000.0;
0114   /// set internal phi so as to mark things as invalid
0115   void _set_invalid_rapphi() {_phijet = _invalid_phi;}
0116   /// true if rap,phi are valid (tests only phi)
0117   bool _rapphi_are_valid() const {return _phijet != _invalid_phi;}
0118 };
0119 
0120 FASTJET_END_NAMESPACE
0121 
0122 #endif // __FASTJET_CIRCULARRANGE_HH__