1 //FJSTARTHEADER
2 // $Id: CDFJetCluPlugin.hh 4442 2020-05-05 07:50:11Z soyez $
3 //
4 // Copyright (c) 2005-2020, 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 #ifndef __CDFJETCLUPLUGIN_HH__
32 #define __CDFJETCLUPLUGIN_HH__
33 
34 #include "fastjet/JetDefinition.hh"
35 #include "fastjet/PseudoJet.hh"
36 #include <map>
37 
38 // questionable whether this should be in fastjet namespace or not...
39 
40 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
41 
42 /// @ingroup plugins
43 /// \class CDFJetCluPlugin
44 /// Implementation of the JetClu algorithm from CDF (plugin for
45 /// fastjet-v2.1 upwards)
46 class CDFJetCluPlugin : public JetDefinition::Plugin {
47 public:
48   /// a compact constructor
CDFJetCluPlugin(double cone_radius_in,double overlap_threshold_in,double seed_threshold_in=1.0,int iratch_in=1)49   CDFJetCluPlugin (double   cone_radius_in,
50 		   double   overlap_threshold_in,
51 		   double   seed_threshold_in = 1.0,
52 		   int      iratch_in = 1) :
53     _seed_threshold    ( seed_threshold_in    ),
54     _cone_radius       ( cone_radius_in       ),
55     _adjacency_cut     (   2                  ),
56     _max_iterations    ( 100                  ),
57     _iratch            ( iratch_in            ),
58     _overlap_threshold ( overlap_threshold_in )  {}
59 
60   /// a constructor that looks like the one provided by CDF
CDFJetCluPlugin(double seed_threshold_in,double cone_radius_in,int adjacency_cut_in,int max_iterations_in,int iratch_in,double overlap_threshold_in)61   CDFJetCluPlugin (double seed_threshold_in   ,
62 		   double cone_radius_in      ,
63 		   int    adjacency_cut_in    ,
64 		   int    max_iterations_in   ,
65 		   int    iratch_in           ,
66 		   double overlap_threshold_in) :
67     _seed_threshold    (seed_threshold_in    ),
68     _cone_radius       (cone_radius_in       ),
69     _adjacency_cut     (adjacency_cut_in     ),
70     _max_iterations    (max_iterations_in    ),
71     _iratch            (iratch_in            ),
72     _overlap_threshold (overlap_threshold_in )  {}
73 
74   // some functions to return info about parameters
seed_threshold() const75   double seed_threshold    () const {return _seed_threshold    ;}
cone_radius() const76   double cone_radius       () const {return _cone_radius       ;}
adjacency_cut() const77   int    adjacency_cut     () const {return _adjacency_cut     ;}
max_iterations() const78   int    max_iterations    () const {return _max_iterations    ;}
iratch() const79   int    iratch            () const {return _iratch            ;}
overlap_threshold() const80   double overlap_threshold () const {return _overlap_threshold ;}
81 
82 
83   // the things that are required by base class
84   virtual std::string description () const;
85   virtual void run_clustering(ClusterSequence &) const;
86   /// the plugin mechanism's standard way of accessing the jet radius
R() const87   virtual double R() const {return cone_radius();}
88 
89 private:
90 
91   double _seed_threshold   ;
92   double _cone_radius      ;
93   int    _adjacency_cut    ;
94   int    _max_iterations   ;
95   int    _iratch           ;
96   double _overlap_threshold;
97 
98   /// given a jet try inserting its energy into the map -- if that
99   /// energy entry already exists, modify the jet infinitesimally so
100   /// as ensure that the jet energy is unique
101   void _insert_unique (PseudoJet & jet, std::map<double,int> & jetmap) const;
102 
103   static bool _first_time;
104 
105   /// print a banner for reference to the 3rd-party code
106   void _print_banner(std::ostream *ostr) const;
107 };
108 
109 FASTJET_END_NAMESPACE      // defined in fastjet/internal/base.hh
110 
111 #endif // __CDFJETCLUPLUGIN_HH__
112