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 //
00039 //
00040 class SISConeBasePlugin : public JetDefinition::Plugin {
00041 public:
00043   SISConeBasePlugin (){
00044     _use_jet_def_recombiner = false;
00045   }
00046 
00048   SISConeBasePlugin (const SISConeBasePlugin & plugin) {
00049     *this = plugin;
00050   }
00051 
00053   double cone_radius        () const {return _cone_radius        ;}
00054 
00057   double overlap_threshold  () const {return _overlap_threshold  ;}
00058 
00061   int n_pass_max  () const {return _n_pass_max  ;}
00062 
00069   void set_split_merge_stopping_scale(double scale) {
00070     _split_merge_stopping_scale = scale;}
00071 
00074   double split_merge_stopping_scale() {return _split_merge_stopping_scale;}
00075 
00077   void set_use_jet_def_recombiner(bool choice) {_use_jet_def_recombiner = choice;}
00078 
00080   bool use_jet_def_recombiner() const {return _use_jet_def_recombiner;}
00081 
00083   bool caching() const {return _caching ;}
00084 
00086   virtual double R() const {return cone_radius();}
00087 
00092   virtual bool supports_ghosted_passive_areas() const {
00093     return true;
00094   }
00095   
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 
00111   virtual std::string description () const =0;
00112 
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
00127   virtual void reset_stored_plugin() const =0;
00128 
00129 };
00130 
00131 
00132 //======================================================================
00143 class SISConeBaseExtras : public ClusterSequence::Extras {
00144 public:
00145 
00147   //  it just initialises the pass information 
00148   SISConeBaseExtras(int nparticles) : _pass(nparticles*2,-1) {}
00149 
00151   inline virtual ~SISConeBaseExtras()=0;
00152 
00154   const std::vector<PseudoJet> & stable_cones() const {return _protocones;}
00155 
00157   const std::vector<PseudoJet> & protocones() const {return _protocones;}
00158 
00161   int pass(const PseudoJet & jet) const {return _pass[jet.cluster_hist_index()];}
00162 
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 
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 
00185 inline SISConeBaseExtras::~SISConeBaseExtras(){}
00186 
00187 
00188 FASTJET_END_NAMESPACE        // defined in fastjet/internal/base.hh
00189 
00190 #endif // __SISCONEBASEPLUGIN_HH__
00191