]> git.uio.no Git - u/mrichter/AliRoot.git/blob - JETAN/fastjet/fastjet/SISConeBasePlugin.hh
fixed assginment
[u/mrichter/AliRoot.git] / JETAN / fastjet / fastjet / SISConeBasePlugin.hh
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...
13 namespace fastjet {      // defined in fastjet/internal/base.hh
14
15 //----------------------------------------------------------------------
16 //
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.
20 ///
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).
24 ///
25 /// any derived plugin MUST overload the following methods:
26 ///   description()
27 ///   run_siscone_clustering()
28 ///   reset_stored_plugin()
29 ///
30 /// For further details, see the derived plugins or
31 /// http://projects.hepforge.com/siscone
32 //
33 class SISConeBasePlugin : public JetDefinition::Plugin {
34 public:
35   /// default ctor
36   SISConeBasePlugin (){
37     _use_jet_def_recombiner = false;
38   }
39
40   /// copy constructor
41   SISConeBasePlugin (const SISConeBasePlugin & plugin) {
42     *this = plugin;
43   }
44
45   /// the cone radius
46   double cone_radius        () const {return _cone_radius        ;}
47
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  ;}
51
52   /// the maximum number of passes of stable-cone searching (<=0 is same
53   /// as infinity).
54   int n_pass_max  () const {return _n_pass_max  ;}
55
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
61   /// event.
62   void set_split_merge_stopping_scale(double scale) {
63     _split_merge_stopping_scale = scale;}
64
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;}
68
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;}
71
72   /// indicate if the jet_def's recombination scheme is being used
73   bool use_jet_def_recombiner() const {return _use_jet_def_recombiner;}
74
75   /// indicates whether caching is turned on or not.
76   bool caching() const {return _caching ;}
77
78   /// the plugin mechanism's standard way of accessing the jet radius
79   virtual double R() const {return cone_radius();}
80
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
84   /// area. 
85   virtual bool supports_ghosted_passive_areas() const {
86     return true;
87   }
88   
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;
94   }
95
96   virtual double ghost_separation_scale() const {
97     return _ghost_sep_scale;
98   }
99
100   // the things that one MUST overload required by base class
101   //---------------------------------------------------------
102
103   /// plugin description
104   virtual std::string description () const =0;
105
106   /// really do the clustering work
107   virtual void run_clustering(ClusterSequence &) const = 0;
108
109 protected:
110   double _cone_radius, _overlap_threshold;
111   int    _n_pass_max;
112   bool   _caching;//, _split_merge_on_transverse_mass;
113   double _split_merge_stopping_scale;
114   bool   _use_jet_def_recombiner;
115
116   mutable double _ghost_sep_scale;
117
118   // the part that HAS to be overloaded
119   /// call the re-clustering itself 
120   virtual void reset_stored_plugin() const =0;
121
122 };
123
124
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 {
132 public:
133
134   /// constructor
135   //  it just initialises the pass information 
136   SISConeBaseExtras(int nparticles) : _pass(nparticles*2,-1) {}
137
138   /// purely virtual destructor
139   inline virtual ~SISConeBaseExtras()=0;
140
141   /// returns a reference to the vector of stable cones (aka protocones)
142   const std::vector<PseudoJet> & stable_cones() const {return _protocones;}
143
144   /// an old name for getting the vector of stable cones (aka protocones)
145   const std::vector<PseudoJet> & protocones() const {return _protocones;}
146
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()];}
150
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";
157     return ostr.str();
158   };
159
160   /// return the smallest difference in squared distance encountered
161   /// during splitting between a particle and two overlapping
162   /// protojets.
163   inline double most_ambiguous_split() const {return _most_ambiguous_split;}
164
165 protected:
166   std::vector<PseudoJet> _protocones;
167   std::vector<int>       _pass;
168   double                _most_ambiguous_split;
169   const SISConeBasePlugin * _jet_def_plugin;
170 };
171
172 /// give the destructor its required implementation
173 inline SISConeBaseExtras::~SISConeBaseExtras(){}
174
175
176 } // fastjet namespace 
177
178 #endif // __SISCONEBASEPLUGIN_HH__
179