JetDefinition.hh

Go to the documentation of this file.
00001 //STARTHEADER
00002 // $Id: JetDefinition.hh 958 2007-11-28 17:43:48Z cacciari $
00003 //
00004 // Copyright (c) 2005-2006, Matteo Cacciari and Gavin Salam
00005 //
00006 //----------------------------------------------------------------------
00007 // This file is part of FastJet.
00008 //
00009 //  FastJet is free software; you can redistribute it and/or modify
00010 //  it under the terms of the GNU General Public License as published by
00011 //  the Free Software Foundation; either version 2 of the License, or
00012 //  (at your option) any later version.
00013 //
00014 //  The algorithms that underlie FastJet have required considerable
00015 //  development and are described in hep-ph/0512210. If you use
00016 //  FastJet as part of work towards a scientific publication, please
00017 //  include a citation to the FastJet paper.
00018 //
00019 //  FastJet is distributed in the hope that it will be useful,
00020 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022 //  GNU General Public License for more details.
00023 //
00024 //  You should have received a copy of the GNU General Public License
00025 //  along with FastJet; if not, write to the Free Software
00026 //  Foundation, Inc.:
00027 //      59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028 //----------------------------------------------------------------------
00029 //ENDHEADER
00030 
00031 #ifndef __FASTJET_JETDEFINITION_HH__
00032 #define __FASTJET_JETDEFINITION_HH__
00033 
00034 #include<cassert>
00035 #include "fastjet/internal/numconsts.hh"
00036 #include "fastjet/PseudoJet.hh"
00037 #include<string>
00038 #include<memory>
00039 
00040 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
00041 
00043 //  NB: (implemented in ClusterSequence.cc but defined here because
00044 //  this is a visible location)
00045 std::string fastjet_version_string();
00046 
00047 //======================================================================
00050 enum Strategy {
00052   N2MinHeapTiled   = -4, 
00054   N2Tiled     = -3, 
00056   N2PoorTiled = -2, 
00058   N2Plain     = -1, 
00060   N3Dumb      =  0, 
00062   Best        =  1, 
00064   NlnN        =  2, 
00066   NlnN3pi     =  3, 
00068   NlnN4pi     =  4,
00071   NlnNCam4pi   = 14,
00072   NlnNCam2pi2R = 13,
00073   NlnNCam      = 12, // 2piMultD
00075   plugin_strategy = 999
00076 };
00077 
00078 
00079 //======================================================================
00081 enum JetAlgorithm {
00083   kt_algorithm=0,
00086   cambridge_algorithm=1,
00090   antikt_algorithm=2, 
00094   genkt_algorithm=3, 
00097   cambridge_for_passive_algorithm=11,
00100   genkt_for_passive_algorithm=13, 
00102   plugin_algorithm = 99
00103 };
00104 
00107 typedef JetAlgorithm JetFinder;
00108 
00110 const JetAlgorithm aachen_algorithm = cambridge_algorithm;
00111 const JetAlgorithm cambridge_aachen_algorithm = cambridge_algorithm;
00112 
00113 //======================================================================
00115 enum RecombinationScheme {
00117   E_scheme=0,
00120   pt_scheme=1,
00123   pt2_scheme=2,
00126   Et_scheme=3,
00129   Et2_scheme=4,
00132   BIpt_scheme=5,
00135   BIpt2_scheme=6,
00137   external_scheme = 99
00138 };
00139 
00140 
00141 
00142 
00143 // forward declaration, needed in order to specify interface for the
00144 // plugin.
00145 class ClusterSequence;
00146 
00147 
00148 
00149 
00150 //======================================================================
00153 class JetDefinition {
00154   
00155 public:
00156 
00159   class Plugin;
00160 
00161   // forward declaration of a class that will provide the
00162   // recombination scheme facilities and/or allow a user to
00163   // extend these facilities
00164   class Recombiner;
00165 
00169   JetDefinition(JetAlgorithm jet_algorithm, 
00170                 double R, 
00171                 Strategy strategy,
00172                 RecombinationScheme recomb_scheme = E_scheme) :
00173     _jet_algorithm(jet_algorithm), _Rparam(R), _strategy(strategy) {
00174     // the largest sensible value for R
00175     assert(_Rparam <= 0.5*pi);
00176     assert(_jet_algorithm != plugin_algorithm &&
00177            _strategy   != plugin_strategy);
00178     _plugin = NULL;
00179     set_recombination_scheme(recomb_scheme);
00180   }
00181   
00182 
00186   JetDefinition(JetAlgorithm jet_algorithm = kt_algorithm, 
00187                 double R = 1.0, 
00188                 RecombinationScheme recomb_scheme = E_scheme,
00189                 Strategy strategy = Best) {
00190     *this = JetDefinition(jet_algorithm, R, strategy, recomb_scheme);
00191   }
00192 
00193 
00197   JetDefinition(JetAlgorithm jet_algorithm, 
00198                 double R, 
00199                 const Recombiner * recombiner,
00200                 Strategy strategy = Best) {
00201     *this = JetDefinition(jet_algorithm, R, strategy, external_scheme);
00202     _recombiner = recombiner;
00203   }
00204 
00208   JetDefinition(const Plugin * plugin) {
00209     _plugin = plugin;
00210     _strategy = plugin_strategy;
00211     _Rparam = _plugin->R();
00212     _jet_algorithm = plugin_algorithm;
00213     set_recombination_scheme(E_scheme);
00214   }
00215 
00217   void set_recombination_scheme(RecombinationScheme);
00218 
00220   void set_recombiner(const Recombiner * recomb) {
00221     _recombiner = recomb;
00222     _default_recombiner = DefaultRecombiner(external_scheme);
00223   }
00224 
00226   const Plugin * plugin() const {return _plugin;};
00227 
00229   JetAlgorithm jet_algorithm  () const {return _jet_algorithm  ;}
00231   JetAlgorithm jet_finder     () const {return _jet_algorithm  ;}
00232   double    R           () const {return _Rparam      ;}
00233   // a general purpose extra parameter, whose meaning depends on
00234   // the algorithm, and may often be unused.
00235   double    extra_param () const {return _extra_param ;}
00236   Strategy  strategy    () const {return _strategy    ;}
00237   RecombinationScheme recombination_scheme() const {
00238     return _default_recombiner.scheme();}
00239 
00241   void set_jet_algorithm(JetAlgorithm njf) {_jet_algorithm = njf;}
00243   void set_jet_finder(JetAlgorithm njf)    {_jet_algorithm = njf;}
00245   void set_extra_param(double xtra_param) {_extra_param = xtra_param;}
00246 
00249   const Recombiner * recombiner() const {
00250     return _recombiner == 0 ? & _default_recombiner : _recombiner;}
00251 
00253   std::string description() const;
00254 
00255 
00256 public:
00257   //======================================================================
00260   class Recombiner {
00261   public:
00264     virtual std::string description() const = 0;
00265     
00267     virtual void recombine(const PseudoJet & pa, const PseudoJet & pb, 
00268                            PseudoJet & pab) const = 0;
00269 
00272     virtual void preprocess(PseudoJet & p) const {};
00273     
00275     virtual ~Recombiner() {};
00276 
00279     inline void plus_equal(PseudoJet & pa, const PseudoJet & pb) const {
00280       // put result in a temporary location in case the recombiner
00281       // does something funny (ours doesn't, but who knows about the
00282       // user's)
00283       PseudoJet pres; 
00284       recombine(pa,pb,pres);
00285       pa = pres;
00286     }
00287 
00288   };
00289   
00290   
00291   //======================================================================
00294   class DefaultRecombiner : public Recombiner {
00295   public:
00296     DefaultRecombiner(RecombinationScheme recomb_scheme = E_scheme) : 
00297       _recomb_scheme(recomb_scheme) {}
00298     
00299     virtual std::string description() const;
00300     
00302     virtual void recombine(const PseudoJet & pa, const PseudoJet & pb, 
00303                            PseudoJet & pab) const;
00304 
00305     virtual void preprocess(PseudoJet & p) const;
00306 
00308     RecombinationScheme scheme() const {return _recomb_scheme;}
00309     
00310   private:
00311     RecombinationScheme _recomb_scheme;
00312   };
00313 
00314 
00315   //======================================================================
00318   class Plugin{
00319   public:
00322     virtual std::string description() const = 0;
00323     
00330     virtual void run_clustering(ClusterSequence &) const = 0;
00331     
00332     virtual double R() const = 0;
00333     
00338     virtual bool supports_ghosted_passive_areas() const {return false;}
00339 
00343     virtual void set_ghost_separation_scale(double scale) const;
00344     virtual double ghost_separation_scale() const {return 0.0;}
00345 
00347     virtual ~Plugin() {};
00348   };
00349 
00350 private:
00351 
00352 
00353   JetAlgorithm _jet_algorithm;
00354   double    _Rparam;
00355   double    _extra_param ; 
00356   Strategy  _strategy  ;
00357 
00358   const Plugin * _plugin;
00359 
00360   // when we use our own recombiner it's useful to point to it here
00361   // so that we don't have to worry about deleting it etc...
00362   DefaultRecombiner _default_recombiner;
00363   const Recombiner * _recombiner;
00364 
00365 };
00366 
00367 
00368 
00369 
00370 
00371 
00372 FASTJET_END_NAMESPACE
00373 
00374 #endif // __FASTJET_JETDEFINITION_HH__

Generated on Tue Dec 18 17:05:02 2007 for fastjet by  doxygen 1.5.2