FastJet 3.0.4
SISConeBasePlugin.hh
00001 #ifndef __SISCONEBASEPLUGIN_HH__
00002 #define __SISCONEBASEPLUGIN_HH__
00003 
00004 #include "fastjet/JetDefinition.hh"
00005 #include "fastjet/ClusterSequence.hh"
00006 #include <vector>
00007 #include <memory>
00008 #include <cmath>
00009 
00010 #include <sstream>
00011 
00012 // questionable whether this should be in fastjet namespace or not...
00013 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
00014 
00015 //----------------------------------------------------------------------
00016 //
00017 /// \if internal_doc
00018 /// @ingroup internal
00019 /// \class SISConeBasePlugin
00020 /// Implementation of the SISCone algorithm, base class (plugin for fastjet v2.1 upwards)
00021 ///
00022 /// SISConeBasePlugin is a plugin for fastjet (v2.1 upwards) that
00023 /// provides a base interface to SISCone-type cone jet finder by
00024 /// Gregory Soyez and Gavin Salam.
00025 ///
00026 /// This is a purely virtual class that needs to be overloaded
00027 /// for the specific implementations of SISCone (i.e. regular or
00028 /// spherical as of July 16th 2008).
00029 ///
00030 /// any derived plugin MUST overload the following methods:
00031 ///   description()
00032 ///   run_siscone_clustering()
00033 ///   reset_stored_plugin()
00034 ///
00035 /// For further details, see the derived plugins or
00036 /// http://projects.hepforge.com/siscone
00037 ///
00038 /// \endif
00039 //
00040 class SISConeBasePlugin : public JetDefinition::Plugin {
00041 public:
00042   /// default ctor
00043   SISConeBasePlugin (){
00044     _use_jet_def_recombiner = false;
00045   }
00046 
00047   /// copy constructor
00048   SISConeBasePlugin (const SISConeBasePlugin & plugin) {
00049     *this = plugin;
00050   }
00051 
00052   /// the cone radius
00053   double cone_radius        () const {return _cone_radius        ;}
00054 
00055   /// Fraction of overlap energy in a jet above which jets are merged
00056   /// and below which jets are split.
00057   double overlap_threshold  () const {return _overlap_threshold  ;}
00058 
00059   /// the maximum number of passes of stable-cone searching (<=0 is same
00060   /// as infinity).
00061   int n_pass_max  () const {return _n_pass_max  ;}
00062 
00063   /// set the "split_merge_stopping_scale": if the scale variable for
00064   /// all protojets is below this, then stop the split-merge procedure
00065   /// and keep only those jets found so far. This is useful in
00066   /// determination of areas of hard jets because it can be used to
00067   /// avoid running the split-merging on the pure ghost-part of the
00068   /// event.
00069   void set_split_merge_stopping_scale(double scale) {
00070     _split_merge_stopping_scale = scale;}
00071 
00072   /// return the value of the split_merge_stopping_scale (see
00073   /// set_split_merge_stopping_scale(...) for description)
00074   double split_merge_stopping_scale() {return _split_merge_stopping_scale;}
00075 
00076   /// allow the user to decide if one uses the jet_def's own recombination scheme
00077   void set_use_jet_def_recombiner(bool choice) {_use_jet_def_recombiner = choice;}
00078 
00079   /// indicate if the jet_def's recombination scheme is being used
00080   bool use_jet_def_recombiner() const {return _use_jet_def_recombiner;}
00081 
00082   /// indicates whether caching is turned on or not.
00083   bool caching() const {return _caching ;}
00084 
00085   /// the plugin mechanism's standard way of accessing the jet radius
00086   virtual double R() const {return cone_radius();}
00087 
00088   /// return true since there is specific support for the measurement
00089   /// of passive areas, in the sense that areas determined from all
00090   /// particles below the ghost separation scale will be a passive
00091   /// area. 
00092   virtual bool supports_ghosted_passive_areas() const {
00093     return true;
00094   }
00095   
00096   /// set the ghost separation scale for passive area determinations
00097   /// _just_ in the next run (strictly speaking that makes the routine
00098   /// a non const, so related internal info must be stored as a mutable)
00099   virtual void set_ghost_separation_scale(double scale) const {
00100     _ghost_sep_scale = scale;
00101   }
00102 
00103   virtual double ghost_separation_scale() const {
00104     return _ghost_sep_scale;
00105   }
00106 
00107   // the things that one MUST overload required by base class
00108   //---------------------------------------------------------
00109 
00110   /// plugin description
00111   virtual std::string description () const =0;
00112 
00113   /// really do the clustering work
00114   virtual void run_clustering(ClusterSequence &) const = 0;
00115 
00116 protected:
00117   double _cone_radius, _overlap_threshold;
00118   int    _n_pass_max;
00119   bool   _caching;//, _split_merge_on_transverse_mass;
00120   double _split_merge_stopping_scale;
00121   bool   _use_jet_def_recombiner;
00122 
00123   mutable double _ghost_sep_scale;
00124 
00125   // the part that HAS to be overloaded
00126   /// call the re-clustering itself 
00127   virtual void reset_stored_plugin() const =0;
00128 
00129 };
00130 
00131 
00132 //======================================================================
00133 /// @ingroup extra_info
00134 /// \class SISConeBaseExtras
00135 /// Class that provides extra information about a SISCone clustering
00136 ///
00137 /// This is only the base class that the "regular" and "spherical"
00138 /// implementations of SISCone will have to overload. The only thing
00139 /// that needs to be done for the derived classes is to define
00140 /// '_jet_def_plugin', implement
00141 ///   jet_def_plugin();
00142 /// and add the corresponding plugin class as a friend
00143 class SISConeBaseExtras : public ClusterSequence::Extras {
00144 public:
00145 
00146   /// constructor
00147   //  it just initialises the pass information 
00148   SISConeBaseExtras(int nparticles) : _pass(nparticles*2,-1) {}
00149 
00150   /// purely virtual destructor
00151   inline virtual ~SISConeBaseExtras()=0;
00152 
00153   /// returns a reference to the vector of stable cones (aka protocones)
00154   const std::vector<PseudoJet> & stable_cones() const {return _protocones;}
00155 
00156   /// an old name for getting the vector of stable cones (aka protocones)
00157   const std::vector<PseudoJet> & protocones() const {return _protocones;}
00158 
00159   /// return the # of the pass at which a given jet was found; will
00160   /// return -1 if the pass is invalid
00161   int pass(const PseudoJet & jet) const {return _pass[jet.cluster_hist_index()];}
00162 
00163   /// return a brief summary of the contents of the extras object
00164   /// (specifically, the number of protocones.
00165   std::string description() const{
00166     std::ostringstream ostr;
00167     ostr << "This SISCone clustering found " << protocones().size()
00168          << " stable protocones";
00169     return ostr.str();
00170   };
00171 
00172   /// return the smallest difference in squared distance encountered
00173   /// during splitting between a particle and two overlapping
00174   /// protojets.
00175   inline double most_ambiguous_split() const {return _most_ambiguous_split;}
00176 
00177 protected:
00178   std::vector<PseudoJet> _protocones;
00179   std::vector<int>       _pass;
00180   double                _most_ambiguous_split;
00181   const SISConeBasePlugin * _jet_def_plugin;
00182 };
00183 
00184 /// give the destructor its required implementation
00185 inline SISConeBaseExtras::~SISConeBaseExtras(){}
00186 
00187 
00188 FASTJET_END_NAMESPACE        // defined in fastjet/internal/base.hh
00189 
00190 #endif // __SISCONEBASEPLUGIN_HH__
00191 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends