1 #ifndef __SISCONEBASEPLUGIN_HH__
2 #define __SISCONEBASEPLUGIN_HH__
4 #include "fastjet/JetDefinition.hh"
5 #include "fastjet/ClusterSequence.hh"
12 // questionable whether this should be in fastjet namespace or not...
13 namespace fastjet { // defined in fastjet/internal/base.hh
15 //----------------------------------------------------------------------
17 /// SISConeBasePlugin is a plugin for fastjet (v2.1 upwards) that
18 /// provides a base interface to SISCone-type cone jet finder by
19 /// Gregory Soyez and Gavin Salam.
21 /// This is a purely virtual class that needs to be overloaded
22 /// for the specific implementations of SISCone (i.e. regular or
23 /// spherical as of July 16th 2008).
25 /// any derived plugin MUST overload the following methods:
27 /// run_siscone_clustering()
28 /// reset_stored_plugin()
30 /// For further details, see the derived plugins or
31 /// http://projects.hepforge.com/siscone
33 class SISConeBasePlugin : public JetDefinition::Plugin {
37 _use_jet_def_recombiner = false;
41 SISConeBasePlugin (const SISConeBasePlugin & plugin) {
46 double cone_radius () const {return _cone_radius ;}
48 /// Fraction of overlap energy in a jet above which jets are merged
49 /// and below which jets are split.
50 double overlap_threshold () const {return _overlap_threshold ;}
52 /// the maximum number of passes of stable-cone searching (<=0 is same
54 int n_pass_max () const {return _n_pass_max ;}
56 /// set the "split_merge_stopping_scale": if the scale variable for
57 /// all protojets is below this, then stop the split-merge procedure
58 /// and keep only those jets found so far. This is useful in
59 /// determination of areas of hard jets because it can be used to
60 /// avoid running the split-merging on the pure ghost-part of the
62 void set_split_merge_stopping_scale(double scale) {
63 _split_merge_stopping_scale = scale;}
65 /// return the value of the split_merge_stopping_scale (see
66 /// set_split_merge_stopping_scale(...) for description)
67 double split_merge_stopping_scale() {return _split_merge_stopping_scale;}
69 /// allow the user to decide if one uses the jet_def's own recombination scheme
70 void set_use_jet_def_recombiner(bool choice) {_use_jet_def_recombiner = choice;}
72 /// indicate if the jet_def's recombination scheme is being used
73 bool use_jet_def_recombiner() const {return _use_jet_def_recombiner;}
75 /// indicates whether caching is turned on or not.
76 bool caching() const {return _caching ;}
78 /// the plugin mechanism's standard way of accessing the jet radius
79 virtual double R() const {return cone_radius();}
81 /// return true since there is specific support for the measurement
82 /// of passive areas, in the sense that areas determined from all
83 /// particles below the ghost separation scale will be a passive
85 virtual bool supports_ghosted_passive_areas() const {
89 /// set the ghost separation scale for passive area determinations
90 /// _just_ in the next run (strictly speaking that makes the routine
91 /// a non const, so related internal info must be stored as a mutable)
92 virtual void set_ghost_separation_scale(double scale) const {
93 _ghost_sep_scale = scale;
96 virtual double ghost_separation_scale() const {
97 return _ghost_sep_scale;
100 // the things that one MUST overload required by base class
101 //---------------------------------------------------------
103 /// plugin description
104 virtual std::string description () const =0;
106 /// really do the clustering work
107 virtual void run_clustering(ClusterSequence &) const = 0;
110 double _cone_radius, _overlap_threshold;
112 bool _caching;//, _split_merge_on_transverse_mass;
113 double _split_merge_stopping_scale;
114 bool _use_jet_def_recombiner;
116 mutable double _ghost_sep_scale;
118 // the part that HAS to be overloaded
119 /// call the re-clustering itself
120 virtual void reset_stored_plugin() const =0;
125 //======================================================================
126 /// Class that provides extra information about a SISCone clustering
127 /// the only thing that needs to be done for thee derived classes
128 /// is to define '_jet_def_plugin', implement
129 /// jet_def_plugin();
130 /// and add the corresponding plugin class as a friend
131 class SISConeBaseExtras : public ClusterSequence::Extras {
135 // it just initialises the pass information
136 SISConeBaseExtras(int nparticles) : _pass(nparticles*2,-1) {}
138 /// purely virtual destructor
139 inline virtual ~SISConeBaseExtras()=0;
141 /// returns a reference to the vector of stable cones (aka protocones)
142 const std::vector<PseudoJet> & stable_cones() const {return _protocones;}
144 /// an old name for getting the vector of stable cones (aka protocones)
145 const std::vector<PseudoJet> & protocones() const {return _protocones;}
147 /// return the # of the pass at which a given jet was found; will
148 /// return -1 if the pass is invalid
149 int pass(const PseudoJet & jet) const {return _pass[jet.cluster_hist_index()];}
151 /// return a brief summary of the contents of the extras object
152 /// (specifically, the number of protocones.
153 std::string description() const{
154 std::ostringstream ostr;
155 ostr << "This SISCone clustering found " << protocones().size()
156 << " stable protocones";
160 /// return the smallest difference in squared distance encountered
161 /// during splitting between a particle and two overlapping
163 inline double most_ambiguous_split() const {return _most_ambiguous_split;}
166 std::vector<PseudoJet> _protocones;
167 std::vector<int> _pass;
168 double _most_ambiguous_split;
169 const SISConeBasePlugin * _jet_def_plugin;
172 /// give the destructor its required implementation
173 inline SISConeBaseExtras::~SISConeBaseExtras(){}
176 } // fastjet namespace
178 #endif // __SISCONEBASEPLUGIN_HH__