Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-21 08:23:36

0001 #ifndef __FJCONTRIB_IFNPLUGIN_HH__
0002 #define __FJCONTRIB_IFNPLUGIN_HH__
0003 
0004 // #ifdef __FJC_FLAVNEUT_USEFJCORE__
0005 // #include "fjcore.hh"
0006 // #define FASTJET_BEGIN_NAMESPACE "namespace fastjet {"
0007 // #define FASTJET_END_NAMESPACE   "}"
0008 // #else 
0009 // #include "fastjet/JetDefinition.hh"
0010 // #define precision_type double
0011 // #endif 
0012 
0013 #include "fastjet/contrib/FlavNeutraliser.hh"
0014 
0015 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
0016 namespace contrib{
0017 
0018 /// Plugin that runs a specified jet algorithm in conjunction
0019 /// with Flavour Neutralisation
0020 class IFNPlugin : public JetDefinition::Plugin {
0021 public:
0022 
0023  /// Main constructor for a IFNPlugin
0024  ///
0025  /// \param jet_def: the jet definition on which this plugin will be based
0026  /// \param alpha: the parameter alpha in the uij neutralisation measure
0027  /// \param omega: the parameter omega in the uij neutralisation measure (<=0 defaults to
0028  ///               3 - alpha as used in the paper); relevant only for pp algorithms
0029  /// \param flav_summation: the flavour summation method to be used (should be one of 
0030  ///        FlavRecombiner::net and FlavRecombiner::modulo_2)
0031  /// \param use_mass_flav: intended for IRC tests when dealing with large rapidities
0032  IFNPlugin(
0033     const JetDefinition & jet_def,
0034     double alpha,                  
0035     double omega = -1,
0036     FlavRecombiner::FlavSummation flav_summation = FlavRecombiner::net, 
0037     bool use_mass_flav = false
0038  ) :  _jet_def(jet_def), 
0039       _p(0.5*alpha), 
0040       _q(0.5*(2-alpha)), 
0041       _a(omega > 0 ? omega : 3 - alpha),
0042       _modulo_2(flav_summation == FlavRecombiner::modulo_2),
0043       _measure_in(FlavNeutraliser::general), 
0044       _use_mass_flav(use_mass_flav),
0045       _spherical_algo(_jet_def.is_spherical()),
0046        _pp(1), // dummy value
0047       _recursive(true) {
0048         if (flav_summation == FlavRecombiner::any_abs) {
0049           throw Error("IFNPlugin: FlavRecombiner::any_abs is not supported");
0050           }
0051           check_mod2_consistency();
0052       }
0053 
0054  /// Old main constructor for the class. Intended only for developers.
0055  ///
0056  /// \param jet_def: the jet definition on which this plugin will be based
0057  /// \param modulo_2: if true, flavour should be treated modulo 2
0058  /// \param measure_in: the distance measure to be used in the neutralisation
0059  /// \param use_mass_flav: only intended for tests
0060  /// \param pp: in [old, pre-release] e+e- alg we use (Emax^2/Emin^2)^pp
0061  /// \param recursive_neutralisation: if true (default), use recursive algo
0062  IFNPlugin(
0063      JetDefinition jet_def,
0064      bool modulo_2,
0065      FlavNeutraliser::measure measure_in,
0066      bool use_mass_flav = false,
0067      double pp = 1,
0068      bool recursive_neutralisation = true)
0069      : _jet_def(jet_def),
0070        _modulo_2(modulo_2),
0071        _measure_in(measure_in),
0072        _use_mass_flav(use_mass_flav),
0073        _spherical_algo(_jet_def.is_spherical()),
0074        _pp(pp),
0075        _recursive(recursive_neutralisation) {check_mod2_consistency();}
0076          
0077 
0078 
0079  /// Alternative constructor for the class that allows
0080  /// defining the neutraliser measure with general p, q and a
0081  /// according to
0082  ///   u_ij = max( pti^2 , ptj^2 )^p min( pti^2 , ptj^2 )^q 
0083  ///          x 2[ 1/a^2 (cosh(a*Δy_ij) - 1) + (cos(Δφ_ij) - 1) ]
0084  /// \param jet_def: the jet definition on which this plugin will be based
0085  /// \param p: p parameter in the definition above
0086  /// \param q: q parameter in the definition above
0087  /// \param a: a parameter in the definition above
0088  /// \param modulo_2: if true, flavour should be treated modulo 2
0089  /// \param measure_in: the distance measure to be used in the neutralisation
0090  /// \param use_mass_flav: only intended for tests
0091  /// \param pp: in e+e- alg we use (Emax^2/Emin^2)^pp (default = 1)
0092  /// \param recursive_neutralisation: if true (default), use recursive algo
0093  IFNPlugin(
0094      JetDefinition jet_def,
0095      double p, double q, double a,
0096      bool modulo_2 = false,
0097      FlavNeutraliser::measure measure_in = FlavNeutraliser::general,
0098      bool use_mass_flav = false,
0099      double pp = 1,
0100      bool recursive_neutralisation = true)
0101      : _jet_def(jet_def), 
0102        _p(p), _q(q), _a(a),
0103        _modulo_2(modulo_2),
0104        _measure_in(measure_in),
0105        _use_mass_flav(use_mass_flav),
0106        _spherical_algo(_jet_def.is_spherical()),
0107        _pp(pp),
0108        _recursive(recursive_neutralisation)
0109         {check_mod2_consistency();}
0110 
0111  typedef FlavNeutraliser::measure Measure;
0112 
0113  void set_recursive(bool val) {_recursive = val;}
0114  bool recursive() const {return _recursive;}
0115 
0116  void set_measure(FlavNeutraliser::measure measure) {_measure_in = measure;}
0117  FlavNeutraliser::measure measure() const {return _measure_in;}
0118 
0119  // Jet radius
0120  double R() const FASTJET_OVERRIDE { return _jet_def.R(); }
0121 
0122  // Required by base class:
0123  std::string description() const FASTJET_OVERRIDE;
0124 
0125  void run_clustering(ClusterSequence &) const FASTJET_OVERRIDE;
0126 
0127  bool is_spherical() const FASTJET_OVERRIDE {return _spherical_algo;}
0128 
0129 private:
0130 
0131   /// checks that the mod2 setting is consistent with the base
0132   /// algorithm's flavour recombiner, if it has one
0133   void check_mod2_consistency() const;
0134 
0135   /// the base jet definition
0136   JetDefinition _jet_def;
0137 
0138   /// the general form of the uij distance measure is max(pti^2, ptj^2)^p min(pti^2, ptj^2)^q Omega_ij
0139   double _p;
0140   double _q;
0141 
0142   /// the internal variable that stores what is known as omega in the paper
0143   double _a;
0144 
0145   // whether modulo 2 should be used
0146   bool _modulo_2;
0147   FlavNeutraliser::measure _measure_in;
0148   bool _use_mass_flav;
0149   bool _spherical_algo;
0150   double _pp;
0151   bool _recursive;
0152 };
0153 
0154 // a typedef for backward compatibility
0155 typedef IFNPlugin FlavNeutraliserPlugin;
0156 
0157 } // namespace contrib
0158 
0159 
0160 FASTJET_END_NAMESPACE
0161 
0162 #endif // __FJCONTRIB_IFNPLUGIN_HH__