Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:19

0001 #ifndef __SISCONEPLUGIN_HH__
0002 #define __SISCONEPLUGIN_HH__
0003 
0004 #include "SISConeBasePlugin.hh"
0005 
0006 // forward declaration of the siscone classes we'll need
0007 namespace siscone{
0008   class Csiscone;
0009   class Cjet;
0010 }
0011 
0012 
0013 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
0014 
0015 //----------------------------------------------------------------------
0016 //
0017 /// @ingroup plugins
0018 /// \class SISConePlugin
0019 /// Implementation of the SISCone algorithm (plugin for fastjet v2.1 upwards)
0020 ///
0021 /// SISConePlugin is a plugin for fastjet (v2.1 upwards) that provides
0022 /// an interface to the seedless infrared safe cone jet finder by
0023 /// Gregory Soyez and Gavin Salam.
0024 ///
0025 /// SISCone uses geometrical techniques to exhaustively consider all
0026 /// possible distinct cones. It then finds out which ones are stable
0027 /// and sends the result to the Tevatron Run-II type split-merge
0028 /// procedure for overlapping cones.
0029 ///
0030 /// Four parameters govern the "physics" of the algorithm:
0031 ///
0032 ///  - the cone_radius (this should be self-explanatory!)
0033 ///
0034 ///  - the overlap_threshold is the parameter which dictates how much
0035 ///    two jets must overlap (pt_overlap/min(pt1,pt2)) if they are to be 
0036 ///    merged
0037 ///
0038 ///  - Not all particles are in stable cones in the first round of
0039 ///    searching for stable cones; one can therefore optionally have the
0040 ///    the jet finder carry out additional passes of searching for
0041 ///    stable cones among particles that were in no stable cone in
0042 ///    previous passes --- the maximum number of passes carried out is
0043 ///    n_pass_max. If this is zero then additional passes are carried
0044 ///    out until no new stable cones are found.
0045 ///
0046 ///  - Protojet ptmin: protojets that are below this ptmin
0047 ///    (default = 0) are discarded before each iteration of the
0048 ///    split-merge loop.
0049 ///
0050 /// One parameter governs some internal algorithmic shortcuts: 
0051 ///
0052 /// - if "caching" is turned on then the last event clustered by
0053 ///   siscone is stored -- if the current event is identical and the
0054 ///   cone_radius and n_pass_mass are identical, then the only part of
0055 ///   the clustering that needs to be rerun is the split-merge part,
0056 ///   leading to significant speed gains; there is a small (O(N) storage
0057 ///   and speed) penalty for caching, so it should be kept off
0058 ///   (default) if only a single overlap_threshold is used.
0059 ///
0060 /// The final jets can be accessed by requestion the
0061 /// inclusive_jets(...) from the ClusterSequence object. Note that
0062 /// these PseudoJets have their user_index() set to the index of the
0063 /// pass in which they were found (first pass = 0). NB: This does not
0064 /// currently work for jets that consist of a single particle.
0065 ///
0066 /// For further information on the details of the algorithm see the
0067 /// SISCone paper, arXiv:0704.0292 [JHEP 0705:086,2007].
0068 ///
0069 /// For documentation about the implementation, see the
0070 /// siscone/doc/html/index.html file.
0071 //
0072 class SISConePlugin : public SISConeBasePlugin{
0073 public:
0074 
0075   /// enum for the different split-merge scale choices;
0076   /// Note that order _must_ be the same as in siscone
0077   enum SplitMergeScale {
0078     SM_pt,     ///< transverse momentum (E-scheme), IR unsafe
0079     SM_Et,     ///< transverse energy (E-scheme), not long. boost invariant
0080                ///< original run-II choice [may not be implemented]
0081     SM_mt,     ///< transverse mass (E-scheme), IR safe except
0082                ///< in decays of two identical narrow heavy particles
0083     SM_pttilde ///< pt-scheme pt = \sum_{i in jet} |p_{ti}|, should
0084                ///< be IR safe in all cases
0085   };
0086 
0087 
0088   /// Main constructor for the SISCone Plugin class.  
0089   ///
0090   /// Note: wrt version prior to 2.4 this constructor differs in that a 
0091   /// the default value has been removed for overlap_threshold. The
0092   /// former has been removed because the old default of 0.5 was found
0093   /// to be unsuitable in high-noise environments; so the user should
0094   /// now explicitly think about the value for this -- we recommend
0095   /// 0.75.
0096   ///
0097   SISConePlugin (double cone_radius_in,
0098                  double overlap_threshold_in,
0099                  int    n_pass_max_in = 0,
0100                  double protojet_ptmin_in = 0.0, 
0101                  bool   caching_in = false,
0102                  SplitMergeScale  split_merge_scale_in = SM_pttilde,
0103                  double split_merge_stopping_scale_in = 0.0){
0104     _cone_radius           = cone_radius_in;
0105     _overlap_threshold     = overlap_threshold_in;
0106     _n_pass_max            = n_pass_max_in;
0107     _protojet_ptmin        = protojet_ptmin_in;
0108     _caching               = caching_in;   
0109     _split_merge_scale     = split_merge_scale_in;
0110     _split_merge_stopping_scale = split_merge_stopping_scale_in;
0111     _ghost_sep_scale       = 0.0;
0112     _use_pt_weighted_splitting = false;
0113     _user_scale = 0;}
0114 
0115 
0116   /// Backwards compatible constructor for the SISCone Plugin class
0117   SISConePlugin (double cone_radius_in,
0118                  double overlap_threshold_in,
0119                  int    n_pass_max_in,
0120                  double protojet_ptmin_in, 
0121                  bool   caching_in,
0122                  bool   split_merge_on_transverse_mass_in){
0123     _cone_radius           = cone_radius_in;
0124     _overlap_threshold     = overlap_threshold_in;
0125     _n_pass_max            = n_pass_max_in;
0126     _protojet_ptmin        = protojet_ptmin_in;
0127     _caching               = caching_in;
0128     _split_merge_stopping_scale = 0.0;
0129     _split_merge_scale     = split_merge_on_transverse_mass_in ? SM_mt : SM_pttilde;
0130     _ghost_sep_scale       = 0.0;
0131     _user_scale = 0;}
0132   
0133   /// backwards compatible constructor for the SISCone Plugin class
0134   /// (avoid using this in future).
0135   SISConePlugin (double cone_radius_in,
0136                  double overlap_threshold_in,
0137                  int    n_pass_max_in,
0138                  bool   caching_in) {
0139     _cone_radius           = cone_radius_in;
0140     _overlap_threshold     = overlap_threshold_in;
0141     _n_pass_max            = n_pass_max_in;
0142     _protojet_ptmin        = 0.0;
0143     _caching               = caching_in;   
0144     _split_merge_scale     = SM_mt;
0145     _split_merge_stopping_scale = 0.0;
0146     _ghost_sep_scale       = 0.0;
0147     _use_pt_weighted_splitting = false;
0148     _user_scale = 0;}
0149 
0150   /// minimum pt for a protojet to be considered in the split-merge step
0151   /// of the algorithm
0152   double protojet_ptmin  () const {return _protojet_ptmin  ;}
0153 
0154   /// return the scale to be passed to SISCone as the protojet_ptmin
0155   /// -- if we have a ghost separation scale that is above the
0156   /// protojet_ptmin, then the ghost_separation_scale becomes the
0157   /// relevant one to use here
0158   double protojet_or_ghost_ptmin  () const {return std::max(_protojet_ptmin,
0159                                                             _ghost_sep_scale);}
0160 
0161   /// indicates scale used in split-merge
0162   SplitMergeScale split_merge_scale() const {return _split_merge_scale;}
0163   /// sets scale used in split-merge
0164   void set_split_merge_scale(SplitMergeScale sms) {_split_merge_scale = sms;}
0165 
0166   /// indicates whether the split-merge orders on transverse mass or not.
0167   /// retained for backwards compatibility with 2.1.0b3
0168   bool split_merge_on_transverse_mass() const {return _split_merge_scale == SM_mt ;}
0169   void set_split_merge_on_transverse_mass(bool val) {
0170     _split_merge_scale = val  ? SM_mt : SM_pt;}
0171 
0172   /// indicates whether the split-merge orders on transverse mass or not.
0173   /// retained for backwards compatibility with 2.1.0b3
0174   bool split_merge_use_pt_weighted_splitting() const {return _use_pt_weighted_splitting;}
0175   void set_split_merge_use_pt_weighted_splitting(bool val) {
0176     _use_pt_weighted_splitting = val;}
0177 
0178   // the things that are required by base class
0179   virtual std::string description () const;
0180   virtual void run_clustering(ClusterSequence &) const ;
0181 
0182 protected:
0183   virtual void reset_stored_plugin() const;
0184 
0185 private:
0186   double _protojet_ptmin;
0187   SplitMergeScale _split_merge_scale;
0188 
0189   bool _use_pt_weighted_splitting;
0190 
0191   // part needed for the cache 
0192   // variables for caching the results and the input
0193   static SharedPtr<SISConePlugin          > stored_plugin;
0194   static SharedPtr<std::vector<PseudoJet> > stored_particles;
0195   static SharedPtr<siscone::Csiscone      > stored_siscone;
0196 };
0197 
0198 
0199 /////\class SISConePlugin::UserScaleBase::StructureType
0200 ///// the structure that allows to store the information contained
0201 ///// into a siscone::Cjet (built internally in SISCone from a stable
0202 ///// cone) into a PseudoJet
0203 //class SISConePlugin::UserScaleBase::StructureType : public PseudoJetStructureBase {
0204 //public:
0205 //  StructureType(const siscone::Cjet & jet, const ClusterSequence &cs)
0206 //    : _jet(jet), _cs(cs){}
0207 //
0208 //  //--------------------------------------------------
0209 //  // members inherited from the base class
0210 //  /// the textual descripotion
0211 //  virtual std::string description() const;
0212 //
0213 //  /// this structure has constituents
0214 //  virtual bool has_constituents() const {return true;}
0215 //
0216 //  /// retrieve the constituents 
0217 //  ///
0218 //  /// if you simply need to iterate over the constituents, it will be
0219 //  /// faster to access them via constituent(i)
0220 //  virtual std::vector<PseudoJet> constituents(const PseudoJet & /*reference*/) const;
0221 //
0222 //  //--------------------------------------------------
0223 //  // additional information relevant for this structure
0224 //
0225 //  /// returns the number of constituents
0226 //  unsigned int size() const;
0227 //
0228 //  /// returns the index (in the original particle list) of the ith
0229 //  /// constituent
0230 //  int constituent_index(unsigned int i) const;
0231 //
0232 //  /// returns the ith constituent (as a PseusoJet)
0233 //  const PseudoJet & constituent(unsigned int i) const;
0234 //
0235 //  /// returns the scalar pt of this stable cone
0236 //  double pt_tilde() const;
0237 //
0238 //  /// returns the sm_var2 (signed ordering variable squared) for this stable cone
0239 //  double ordering_var2() const;
0240 //
0241 //protected:
0242 //  const siscone::Cjet &_jet;  ///< a dreference to the internal jet in SISCone
0243 //  const ClusterSequence &_cs; ///< a reference to the CS (for access to the particles)
0244 //};
0245 
0246 //======================================================================
0247 /// @ingroup extra_info
0248 /// \class SISConeExtras
0249 /// Class that provides extra information about a SISCone clustering
0250 class SISConeExtras : public SISConeBaseExtras {
0251 public:
0252   /// constructor
0253   //  it just initialises the pass information 
0254   SISConeExtras(int nparticles)
0255     : SISConeBaseExtras(nparticles){}
0256 
0257   /// access to the siscone jet def plugin (more convenient than
0258   /// getting it from the original jet definition, because here it's
0259   /// directly of the right type (rather than the base type)
0260   const SISConePlugin* jet_def_plugin() const {
0261     return dynamic_cast<const SISConePlugin*>(_jet_def_plugin);
0262   }
0263 
0264 private:
0265   // let us be written to by SISConePlugin
0266   friend class SISConePlugin;
0267 };
0268 
0269 FASTJET_END_NAMESPACE        // defined in fastjet/internal/base.hh
0270 
0271 #endif // __SISCONEPLUGIN_HH__
0272