Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

JetDefinition.hh

Go to the documentation of this file.
00001 //STARTHEADER
00002 // $Id: JetDefinition.hh 483 2007-02-28 17:52:19Z salam $
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 
00042 //======================================================================
00045 enum Strategy {
00047   N2MinHeapTiled   = -4, 
00049   N2Tiled     = -3, 
00051   N2PoorTiled = -2, 
00053   N2Plain     = -1, 
00055   N3Dumb      =  0, 
00057   Best        =  1, 
00059   NlnN        =  2, 
00061   NlnN3pi     =  3, 
00063   NlnN4pi     =  4,
00066   NlnNCam4pi   = 14,
00067   NlnNCam2pi2R = 13,
00068   NlnNCam      = 12, // 2piMultD
00070   plugin_strategy = 999
00071 };
00072 
00073 
00074 //======================================================================
00076 enum JetFinder {
00078   kt_algorithm=0,
00081   cambridge_algorithm=1,
00083   plugin_algorithm = 99
00084 };
00085 
00086 
00087 //======================================================================
00089 enum RecombinationScheme {
00091   E_scheme=0,
00094   pt_scheme=1,
00097   pt2_scheme=2,
00100   Et_scheme=3,
00103   Et2_scheme=4,
00106   BIpt_scheme=5,
00109   BIpt2_scheme=6,
00111   external_scheme = 99
00112 };
00113 
00114 
00115 
00116 
00117 
00118 //======================================================================
00121 class JetDefinition {
00122   
00123 public:
00124 
00127   class Plugin;
00128 
00129   // forward declaration of a class that will provide the
00130   // recombination scheme facilities and/or allow a user to
00131   // extend these facilities
00132   class Recombiner;
00133 
00137   JetDefinition(JetFinder jet_finder, 
00138                 double R, 
00139                 Strategy strategy,
00140                 RecombinationScheme recomb_scheme = E_scheme) :
00141     _jet_finder(jet_finder), _Rparam(R), _strategy(strategy) {
00142     // the largest sensible value for R
00143     assert(_Rparam <= 0.5*pi);
00144     assert(_jet_finder != plugin_algorithm &&
00145            _strategy   != plugin_strategy);
00146     _plugin = 0;
00147     set_recombination_scheme(recomb_scheme);
00148   };
00149   
00150 
00154   JetDefinition(JetFinder jet_finder = kt_algorithm, 
00155                 double R = 1.0, 
00156                 RecombinationScheme recomb_scheme = E_scheme,
00157                 Strategy strategy = Best) {
00158     *this = JetDefinition(jet_finder, R, strategy, recomb_scheme);
00159   };
00160 
00161 
00165   JetDefinition(JetFinder jet_finder, 
00166                 double R, 
00167                 const Recombiner * recombiner,
00168                 Strategy strategy = Best) {
00169     *this = JetDefinition(jet_finder, R, strategy, external_scheme);
00170     _recombiner = recombiner;
00171   };
00172 
00176   JetDefinition(const Plugin * plugin) {
00177     _plugin = plugin;
00178     _strategy = plugin_strategy;
00179     _Rparam = -1.0;
00180     _jet_finder = plugin_algorithm;
00181     set_recombination_scheme(E_scheme);
00182   };
00183 
00185   void set_recombination_scheme(RecombinationScheme);
00186 
00188   void set_recombiner(const Recombiner * recomb) {
00189     _recombiner = recomb;
00190     _default_recombiner = DefaultRecombiner(external_scheme);
00191   };
00192 
00194   const Plugin * plugin() const {return _plugin;};
00195 
00196   // return information about the definition...
00197   JetFinder jet_finder  () const {return _jet_finder  ;}; 
00198   double    R           () const {return _Rparam      ;};
00199   Strategy  strategy    () const {return _strategy    ;};
00200   RecombinationScheme recombination_scheme() const {
00201     return _default_recombiner.scheme();};
00202 
00205   const Recombiner * recombiner() const {
00206     return _recombiner == 0 ? & _default_recombiner : _recombiner;};
00207 
00209   std::string description() const;
00210 
00211 
00212 public:
00213   //======================================================================
00216   class Recombiner {
00217   public:
00220     virtual std::string description() const = 0;
00221     
00223     virtual void recombine(const PseudoJet & pa, const PseudoJet & pb, 
00224                            PseudoJet & pab) const = 0;
00225 
00228     virtual void preprocess(PseudoJet & p) const {};
00229     
00231     virtual ~Recombiner() {};
00232 
00235     inline void plus_equal(PseudoJet & pa, const PseudoJet & pb) const {
00236       // put result in a temporary location in case the recombiner
00237       // does something funny (ours doesn't, but who knows about the
00238       // user's)
00239       PseudoJet pres; 
00240       recombine(pa,pb,pres);
00241       pa = pres;
00242     }
00243 
00244   };
00245   
00246   
00247   //======================================================================
00250   class DefaultRecombiner : public Recombiner {
00251   public:
00252     DefaultRecombiner(RecombinationScheme recomb_scheme = E_scheme) : 
00253       _recomb_scheme(recomb_scheme) {};
00254     
00255     virtual std::string description() const;
00256     
00258     virtual void recombine(const PseudoJet & pa, const PseudoJet & pb, 
00259                            PseudoJet & pab) const;
00260 
00261     virtual void preprocess(PseudoJet & p) const;
00262 
00264     RecombinationScheme scheme() const {return _recomb_scheme;};
00265     
00266   private:
00267     RecombinationScheme _recomb_scheme;
00268   };
00269 
00270 
00271 private:
00272 
00273 
00274   JetFinder _jet_finder;
00275   double      _Rparam    ;
00276   Strategy  _strategy  ;
00277 
00278   const Plugin * _plugin;
00279 
00280   // when we use our own recombiner it's useful to point to it here
00281   // so that we don't have to worry about deleting it etc...
00282   DefaultRecombiner _default_recombiner;
00283   const Recombiner * _recombiner;
00284 
00285 };
00286 
00287 
00288 // forward declaration, needed in order to specify interface for the
00289 // plugin.
00290 class ClusterSequence;
00291 
00292 
00293 //======================================================================
00296 class JetDefinition::Plugin{
00297 public:
00300   virtual std::string description() const = 0;
00301 
00308   virtual void run_clustering(ClusterSequence &) const = 0;
00309 
00311   virtual ~Plugin() {};
00312 };
00313 
00314 
00315 
00316 
00317 
00318 
00319 FASTJET_END_NAMESPACE
00320 
00321 #endif // __FASTJET_JETDEFINITION_HH__

Generated on Mon Apr 2 20:57:48 2007 for fastjet by  doxygen 1.4.2