Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #ifndef __FASTJET_GRIDJETPLUGIN_HH__
0002 #define __FASTJET_GRIDJETPLUGIN_HH__
0003 
0004 //FJSTARTHEADER
0005 // $Id: GridJetPlugin.hh 2267 2011-06-20 15:10:23Z salam $
0006 //
0007 // Copyright (c) 2005-2021, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
0008 //
0009 //----------------------------------------------------------------------
0010 // This file is part of FastJet.
0011 //
0012 //  FastJet is free software; you can redistribute it and/or modify
0013 //  it under the terms of the GNU General Public License as published by
0014 //  the Free Software Foundation; either version 2 of the License, or
0015 //  (at your option) any later version.
0016 //
0017 //  The algorithms that underlie FastJet have required considerable
0018 //  development. They are described in the original FastJet paper,
0019 //  hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
0020 //  FastJet as part of work towards a scientific publication, please
0021 //  quote the version you use and include a citation to the manual and
0022 //  optionally also to hep-ph/0512210.
0023 //
0024 //  FastJet is distributed in the hope that it will be useful,
0025 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
0026 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0027 //  GNU General Public License for more details.
0028 //
0029 //  You should have received a copy of the GNU General Public License
0030 //  along with FastJet. If not, see <http://www.gnu.org/licenses/>.
0031 //----------------------------------------------------------------------
0032 //FJENDHEADER
0033 
0034 
0035 #include "fastjet/JetDefinition.hh"
0036 
0037 // makes it easy to switch back and forth between use of
0038 // RectangularGrid or not; this got enabled in FJ3.1
0039 #define FASTJET_GRIDJET_USEFJGRID
0040 
0041 #ifdef FASTJET_GRIDJET_USEFJGRID
0042 #include "fastjet/RectangularGrid.hh"
0043 #endif
0044 
0045 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
0046 
0047 // forward declaration to reduce includes
0048 class ClusterSequence;
0049 
0050 //----------------------------------------------------------------------
0051 //
0052 /// @ingroup plugins
0053 /// \class GridJetPlugin
0054 /// plugin for fastjet (v3.0 upwards) that clusters particles such
0055 /// that all particles in a given cell of a rectangular rapidity-phi
0056 /// grid end up in a common "jet".
0057 ///
0058 /// This is not intended for use as a regular jet clustering algorithm, 
0059 /// but is rather provided for comparison purposes with the 
0060 /// GridMedianBackgroundEstimator (which is even faster).
0061 class GridJetPlugin : public JetDefinition::Plugin 
0062 #ifdef FASTJET_GRIDJET_USEFJGRID
0063                                       , RectangularGrid
0064 #endif 
0065 {
0066 public:
0067   /// Basic constructor for the GridJetPlugin Plugin class.
0068   ///
0069   /// \param ymax           The maximal rapidity extent of the grid
0070   /// \param requested_grid_spacing The requested grid spacing
0071   /// \param post_jet_def   if present, and not == JetDefinition()
0072   ///                       (which has undefined_jet_algorithm), then
0073   ///                       run the post_jet_def on the result of the grid
0074   ///                       clustering.
0075   GridJetPlugin (double ymax, double requested_grid_spacing,
0076          const JetDefinition & post_jet_def = JetDefinition());
0077 
0078 #ifdef FASTJET_GRIDJET_USEFJGRID
0079   /// Constructor for the GridJetPlugin Plugin class that allows
0080   /// full control over the underlying grid. New in FastJet 3.1.
0081   ///
0082   /// \param grid           The maximal rapidity extent of the grid
0083   /// \param post_jet_def   if present, and not == JetDefinition()
0084   ///                       (which has undefined_jet_algorithm), then
0085   ///                       run the post_jet_def on the result of the grid
0086   ///                       clustering.
0087   GridJetPlugin (const RectangularGrid & grid,
0088          const JetDefinition & post_jet_def = JetDefinition());
0089 #endif // FASTJET_GRIDJET_USEFJGRID
0090 
0091   
0092 
0093   // /// copy constructor
0094   // GridJetPlugin (const GridJetPlugin & plugin) {
0095   //   *this = plugin;
0096   // }
0097 
0098   // the things that are required by base class
0099   virtual std::string description () const;
0100   virtual void run_clustering(ClusterSequence &) const;
0101 
0102   /// This returns the sqrt(dphi*dy/pi) -- i.e. the radius that for a
0103   /// circular jet would give the same area.
0104   virtual double R() const;
0105 
0106   // As of FastJet 3.1 the following functions become available through
0107   // the underlying RectangularGrid class.
0108 #ifndef FASTJET_GRIDJET_USEFJGRID
0109   /// returns the actual rapidity spacing of the grid
0110   double drap()   const {return _dy;}
0111   /// returns the actual phi spacing of the grid
0112   double dphi() const {return _dphi;}
0113   /// returns the minimum rapidity of the grid
0114   double rapmin() const {return _ymin;}
0115   /// returns the maximum rapidity of the grid
0116   double rapmax() const {return _ymax;}
0117 #endif
0118 
0119 private:
0120 
0121 #ifndef FASTJET_GRIDJET_USEFJGRID
0122   void setup_grid();
0123 
0124   int n_tiles() const {return _ntotal;}
0125   int n_good_tiles() const {return _ntotal;}
0126 
0127   int tile_index(const PseudoJet & p) const;
0128   bool tile_is_good(int /* itile */) const {return true;}
0129 
0130   double _ymin, _ymax, _dy, _dphi, _requested_grid_spacing;
0131   int _ny, _nphi, _ntotal;
0132 #endif
0133 
0134   JetDefinition _post_jet_def;
0135 
0136 };
0137 
0138 FASTJET_END_NAMESPACE        // defined in fastjet/internal/base.hh
0139 
0140 #endif // __FASTJET_GRIDJETPLUGIN_HH__
0141