Fork me on GitHub

source: git/external/fastjet/plugins/SISCone/fastjet/SISConeBasePlugin.hh@ d7d2da3

ImprovedOutputFile Timing dual_readout llp 3.0.6
Last change on this file since d7d2da3 was d7d2da3, checked in by pavel <pavel@…>, 11 years ago

move branches/ModularDelphes to trunk

  • Property mode set to 100644
File size: 6.4 KB
Line 
1#ifndef __SISCONEBASEPLUGIN_HH__
2#define __SISCONEBASEPLUGIN_HH__
3
4#include "fastjet/JetDefinition.hh"
5#include "fastjet/ClusterSequence.hh"
6#include <vector>
7#include <memory>
8#include <cmath>
9
10#include <sstream>
11
12// questionable whether this should be in fastjet namespace or not...
13FASTJET_BEGIN_NAMESPACE // defined in fastjet/internal/base.hh
14
15//----------------------------------------------------------------------
16//
17/// \if internal_doc
18/// @ingroup internal
19/// \class SISConeBasePlugin
20/// Implementation of the SISCone algorithm, base class (plugin for fastjet v2.1 upwards)
21///
22/// SISConeBasePlugin is a plugin for fastjet (v2.1 upwards) that
23/// provides a base interface to SISCone-type cone jet finder by
24/// Gregory Soyez and Gavin Salam.
25///
26/// This is a purely virtual class that needs to be overloaded
27/// for the specific implementations of SISCone (i.e. regular or
28/// spherical as of July 16th 2008).
29///
30/// any derived plugin MUST overload the following methods:
31/// description()
32/// run_siscone_clustering()
33/// reset_stored_plugin()
34///
35/// For further details, see the derived plugins or
36/// http://projects.hepforge.com/siscone
37///
38/// \endif
39//
40class SISConeBasePlugin : public JetDefinition::Plugin {
41public:
42 /// default ctor
43 SISConeBasePlugin (){
44 _use_jet_def_recombiner = false;
45 }
46
47 /// copy constructor
48 SISConeBasePlugin (const SISConeBasePlugin & plugin) {
49 *this = plugin;
50 }
51
52 /// the cone radius
53 double cone_radius () const {return _cone_radius ;}
54
55 /// Fraction of overlap energy in a jet above which jets are merged
56 /// and below which jets are split.
57 double overlap_threshold () const {return _overlap_threshold ;}
58
59 /// the maximum number of passes of stable-cone searching (<=0 is same
60 /// as infinity).
61 int n_pass_max () const {return _n_pass_max ;}
62
63 /// set the "split_merge_stopping_scale": if the scale variable for
64 /// all protojets is below this, then stop the split-merge procedure
65 /// and keep only those jets found so far. This is useful in
66 /// determination of areas of hard jets because it can be used to
67 /// avoid running the split-merging on the pure ghost-part of the
68 /// event.
69 void set_split_merge_stopping_scale(double scale) {
70 _split_merge_stopping_scale = scale;}
71
72 /// return the value of the split_merge_stopping_scale (see
73 /// set_split_merge_stopping_scale(...) for description)
74 double split_merge_stopping_scale() {return _split_merge_stopping_scale;}
75
76 /// allow the user to decide if one uses the jet_def's own recombination scheme
77 void set_use_jet_def_recombiner(bool choice) {_use_jet_def_recombiner = choice;}
78
79 /// indicate if the jet_def's recombination scheme is being used
80 bool use_jet_def_recombiner() const {return _use_jet_def_recombiner;}
81
82 /// indicates whether caching is turned on or not.
83 bool caching() const {return _caching ;}
84
85 /// the plugin mechanism's standard way of accessing the jet radius
86 virtual double R() const {return cone_radius();}
87
88 /// return true since there is specific support for the measurement
89 /// of passive areas, in the sense that areas determined from all
90 /// particles below the ghost separation scale will be a passive
91 /// area.
92 virtual bool supports_ghosted_passive_areas() const {
93 return true;
94 }
95
96 /// set the ghost separation scale for passive area determinations
97 /// _just_ in the next run (strictly speaking that makes the routine
98 /// a non const, so related internal info must be stored as a mutable)
99 virtual void set_ghost_separation_scale(double scale) const {
100 _ghost_sep_scale = scale;
101 }
102
103 virtual double ghost_separation_scale() const {
104 return _ghost_sep_scale;
105 }
106
107 // the things that one MUST overload required by base class
108 //---------------------------------------------------------
109
110 /// plugin description
111 virtual std::string description () const =0;
112
113 /// really do the clustering work
114 virtual void run_clustering(ClusterSequence &) const = 0;
115
116protected:
117 double _cone_radius, _overlap_threshold;
118 int _n_pass_max;
119 bool _caching;//, _split_merge_on_transverse_mass;
120 double _split_merge_stopping_scale;
121 bool _use_jet_def_recombiner;
122
123 mutable double _ghost_sep_scale;
124
125 // the part that HAS to be overloaded
126 /// call the re-clustering itself
127 virtual void reset_stored_plugin() const =0;
128
129};
130
131
132//======================================================================
133/// @ingroup extra_info
134/// \class SISConeBaseExtras
135/// Class that provides extra information about a SISCone clustering
136///
137/// This is only the base class that the "regular" and "spherical"
138/// implementations of SISCone will have to overload. The only thing
139/// that needs to be done for the derived classes is to define
140/// '_jet_def_plugin', implement
141/// jet_def_plugin();
142/// and add the corresponding plugin class as a friend
143class SISConeBaseExtras : public ClusterSequence::Extras {
144public:
145
146 /// constructor
147 // it just initialises the pass information
148 SISConeBaseExtras(int nparticles) : _pass(nparticles*2,-1) {}
149
150 /// purely virtual destructor
151 inline virtual ~SISConeBaseExtras()=0;
152
153 /// returns a reference to the vector of stable cones (aka protocones)
154 const std::vector<PseudoJet> & stable_cones() const {return _protocones;}
155
156 /// an old name for getting the vector of stable cones (aka protocones)
157 const std::vector<PseudoJet> & protocones() const {return _protocones;}
158
159 /// return the # of the pass at which a given jet was found; will
160 /// return -1 if the pass is invalid
161 int pass(const PseudoJet & jet) const {return _pass[jet.cluster_hist_index()];}
162
163 /// return a brief summary of the contents of the extras object
164 /// (specifically, the number of protocones.
165 std::string description() const{
166 std::ostringstream ostr;
167 ostr << "This SISCone clustering found " << protocones().size()
168 << " stable protocones";
169 return ostr.str();
170 };
171
172 /// return the smallest difference in squared distance encountered
173 /// during splitting between a particle and two overlapping
174 /// protojets.
175 inline double most_ambiguous_split() const {return _most_ambiguous_split;}
176
177protected:
178 std::vector<PseudoJet> _protocones;
179 std::vector<int> _pass;
180 double _most_ambiguous_split;
181 const SISConeBasePlugin * _jet_def_plugin;
182};
183
184/// give the destructor its required implementation
185inline SISConeBaseExtras::~SISConeBaseExtras(){}
186
187
188FASTJET_END_NAMESPACE // defined in fastjet/internal/base.hh
189
190#endif // __SISCONEBASEPLUGIN_HH__
191
Note: See TracBrowser for help on using the repository browser.