Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • external/fastjet/contribs/RecursiveTools/RecursiveSymmetryCutBase.hh

    rb7b836a r1f1f858  
    1 // $Id: RecursiveSymmetryCutBase.hh 1074 2017-09-18 15:15:20Z gsoyez $
     1// $Id: RecursiveSymmetryCutBase.hh 700 2014-07-07 12:50:05Z gsoyez $
    22//
    33// Copyright (c) 2014-, Gavin P. Salam, Gregory Soyez, Jesse Thaler
     
    2424
    2525#include <limits>
    26 #include <cassert>
    2726#include <fastjet/internal/base.hh>
    2827#include "fastjet/tools/Transformer.hh"
    2928#include "fastjet/WrappedStructure.hh"
    30 #include "fastjet/CompositeJetStructure.hh"
    31 
    32 #include "fastjet/config.h"
    33 
    34 // we'll use the native FJ class for reculstering if available
    35 #if FASTJET_VERSION_NUMBER >= 30100
    36 #include "fastjet/tools/Recluster.hh"
    37 #else
     29
    3830#include "Recluster.hh"
    39 #endif
    4031
    4132/** \mainpage RecursiveTools contrib
    4233
    43     The RecursiveTools contrib provides a set of tools for
    44     recursive investigation jet substructure. Currently it includes:
     34    The aims RecursiveTools contrib to provide a set of tools for
     35    recursive investigation of the substructure of jets.
     36
     37    Currently it includes:
    4538    - fastjet::contrib::ModifiedMassDropTagger
    4639    - fastjet::contrib::SoftDrop
    47     - fastjet::contrib::RecursiveSymmetryCutBase (from which the above two classes derive)
    48     - fastjet::contrib::IteratedSoftDropSymmetryFactors (defines ISD procedure)
    49     - fastjet::contrib::IteratedSoftDropMultiplicity (defines a useful observable using ISD) 
    50     - example*.cc provides usage examples
     40    - the two above classes derive from fastjet::contrib::RecursiveSymmetryCutBase
     41    - fastjet::contrib::Recluster provides a reclustering transformer
     42    - example*.cc provides a usage examples
    5143 */
    5244
     
    8678
    8779  /// an enum of the different (a)symmetry measures that can be used
    88   enum SymmetryMeasure{scalar_z,   ///< \f$ \min(p_{ti}, p_{tj})/(p_{ti} + p_{tj}) \f$
    89                        vector_z,   ///< \f$ \min(p_{ti}, p_{tj})/p_{t(i+j)} \f$
    90                        y,          ///< \f$ \min(p_{ti}^2,p_{tj}^2) \Delta R_{ij}^2 / m_{ij}^2 \f$
    91                        theta_E,    ///< \f$ \min(E_i,E_j)/(E_i+E_j) \f$ with 3d angle (ee collisions)
    92                        cos_theta_E ///< \f$ \min(E_i,E_j)/(E_i+E_j) \f$ with
    93                                    ///  \f$ \sqrt{2[1-cos(theta)]}\f$ for angles (ee collisions)
     80  enum SymmetryMeasure{scalar_z, ///< \f$ \min(p_{ti}, p_{tj})/(p_{ti} + p_{tj}) \f$
     81                       vector_z, ///< \f$ \min(p_{ti}, p_{tj})/p_{t(i+j)} \f$
     82                       y         ///  \f$ \min(p_{ti}^2,p_{tj}^2) \Delta R_{ij}^2 / m_{ij}^2 \f$
     83                       
    9484  };
    9585
     
    9787  enum RecursionChoice{larger_pt, ///< choose the subjet with larger \f$ p_t \f$
    9888                       larger_mt, ///< choose the subjet with larger \f$ m_t \equiv (m^2+p_t^2)^{\frac12}] \f$
    99                        larger_m,  ///< choose the subjet with larger mass (deprecated)
    100                        larger_E   ///< choose the subjet with larger energy (meant for ee collisions)
     89                       larger_m   ///  choose the subjet with larger mass (deprecated)
    10190  };
    10291
     
    130119  virtual ~RecursiveSymmetryCutBase(){}
    131120
    132   // access to class info
    133   //----------------------------------------------------------------------
    134   SymmetryMeasure symmetry_measure() const { return _symmetry_measure; }
    135   double mu_cut() const { return _mu_cut; }
    136   RecursionChoice recursion_choice() const { return _recursion_choice; }
    137 
    138121  // internal subtraction configuration
    139122  //----------------------------------------------------------------------
     
    164147  //----------------------------------------------------------------------
    165148
    166   /// configure the reclustering prior to the recursive de-clustering
     149  /// configure the reclustering prior to the SoftDrop de-clustering
    167150  ///  \param do_reclustering   recluster the jet or not?
    168151  ///  \param recluster         how to recluster the jet
     
    191174  /// in particular values of symmetry, delta_R, and mu of dropped branches
    192175  void set_verbose_structure(bool enable=true) { _verbose_structure = enable; }
    193   bool has_verbose_structure() const { return _verbose_structure; }
    194176 
    195177 
     
    203185  /// subtracted jet.
    204186  virtual PseudoJet result(const PseudoJet & j) const;
    205  
     187
    206188  /// description of the tool
    207189  virtual std::string description() const;
    208190
    209   /// returns the gepometrical distance between the two particles
    210   /// depending on the symmetry measure used
    211   double squared_geometric_distance(const PseudoJet &j1,
    212                                     const PseudoJet &j2) const;
    213  
     191  /// the type of the associated structure
     192  //typedef RecursiveSymmetryCutBaseStructure StructureType; 
    214193
    215194  class StructureType;
     
    224203  /// apply for a given pair of subjets p1 and p2
    225204  virtual double symmetry_cut_fn(const PseudoJet & /* p1 */,
    226                                  const PseudoJet & /* p2 */,
    227                                  void *extra_parameters = 0) const = 0;
     205                                 const PseudoJet & /* p2 */) const = 0;
    228206  /// the associated dwescription
    229207  virtual std::string symmetry_cut_description() const = 0;
    230 
    231   //----------------------------------------------------------------------
    232   /// this defines status codes when checking for substructure
    233   enum RecursionStatus{
    234     recursion_success=0,   //< found some substructure
    235     recursion_dropped,     //< dropped softest prong; recursion continues
    236     recursion_no_parents,  //< down to constituents; bottom of recursion
    237     recursion_issue        //< something went wrong; recursion stops
    238   };
    239  
    240   //----------------------------------------------------------------------
    241   /// the method below is the one actually performing one step of the
    242   /// recursion.
    243   ///
    244   /// It returns a status code (defined above)
    245   ///
    246   /// In case of success, all the information is filled
    247   /// In case of "no parents", piee1 is the same subjet
    248   /// In case of trouble, piece2 will be a 0 PJ and piece1 is the PJ we
    249   ///   should return (either 0 itself if the issue was critical, or
    250   ///   non-wero in case of a minor issue just causing the recursion to
    251   ///   stop)
    252   ///
    253   /// The extra_parameter argument allows one to pass extra agruments
    254   /// to the symmetry condition
    255   RecursionStatus recurse_one_step(const PseudoJet & subjet,
    256                                    PseudoJet &piece1, PseudoJet &piece2,
    257                                    double &sym, double &mu2,
    258                                    void *extra_parameters = 0) const;
    259 
    260   //----------------------------------------------------------------------
    261   /// helper for handling the reclustering
    262   PseudoJet _recluster_if_needed(const PseudoJet &jet) const;
    263  
    264   //----------------------------------------------------------------------
    265   // helpers for selecting between ee and pp cases
    266   bool is_ee() const{
    267     return ((_symmetry_measure==theta_E) || (_symmetry_measure==cos_theta_E));
    268   }
    269208
    270209private:
     
    299238public:
    300239  StructureType(const PseudoJet & j) :
    301     WrappedStructure(j.structure_shared_ptr()), _delta_R(-1.0), _symmetry(-1.0), _mu(-1.0),
    302     _is_composite(false), _has_verbose(false) // by default, do not store verbose structure
    303   {}
    304 
    305   /// construct a structure with
    306   ///  - basic info inherited from the reference jet "j"
    307   ///  - a given deltaR       for substructure
    308   ///  - a given symmetry     for substructure
    309   ///  - a given mu parameter for substructure
    310   /// If j is a "copmposite jet", it means that it has further
    311   /// substructure to potentially recurse  into
    312   StructureType(const PseudoJet & j, double delta_R_in, double symmetry_in, double mu_in=-1.0) :
    313     WrappedStructure(j.structure_shared_ptr()), _delta_R(delta_R_in), _symmetry(symmetry_in), _mu(mu_in),
    314     _is_composite(dynamic_cast<const CompositeJetStructure*>(j.structure_ptr()) != NULL),
     240    WrappedStructure(j.structure_shared_ptr()),
    315241    _has_verbose(false) // by default, do not store verbose structure
    316242  {}
    317243 
    318244  // information about kept branch
    319   double delta_R()  const {return _delta_R;}
    320   double thetag()   const {return _delta_R;}  // alternative name
    321   double symmetry() const {return _symmetry;}
    322   double zg()       const {return _symmetry;} // alternative name
    323   double mu()       const {return _mu;}
     245  double delta_R()  const {return _delta_R;};
     246  double symmetry() const {return _symmetry;};
     247  double mu()       const {return _mu;};
    324248 
    325249  // additional verbose information about dropped branches
    326250  bool has_verbose() const { return _has_verbose;}
    327   void set_verbose(bool value) { _has_verbose = value;}
    328 
    329   /// returns true if the current jet has some substructure (i.e. has
    330   /// been tagged by the resursion) or not
    331   ///
    332   /// Note that this should include deltaR==0 (e.g. a perfectly
    333   /// collinear branching with SoftDrop)
    334   bool has_substructure() const { return _delta_R>=0; }
    335  
    336   /// number of dropped branches
    337   int dropped_count(bool global=true) const;
    338  
    339   /// delta_R of dropped branches
    340   /// when "global" is set, recurse into possile further substructure
    341   std::vector<double> dropped_delta_R(bool global=true) const;
    342   void set_dropped_delta_R(const std::vector<double> &v) { _dropped_delta_R = v; }
    343 
    344   /// symmetry values of dropped branches
    345   std::vector<double> dropped_symmetry(bool global=true) const;
    346   void set_dropped_symmetry(const std::vector<double> &v) { _dropped_symmetry = v; }
    347 
    348   /// mass drop values of dropped branches
    349   std::vector<double> dropped_mu(bool global=true) const;
    350   void set_dropped_mu(const std::vector<double> &v) { _dropped_mu = v; }
    351  
    352   /// maximum symmetry value dropped
    353   double max_dropped_symmetry(bool global=true) const;
    354 
    355   /// (global) list of groomed away elements as zg and thetag
    356   /// sorted from largest to smallest anlge
    357   std::vector<std::pair<double,double> > sorted_zg_and_thetag() const;
    358 
     251 
     252  // number of dropped branches
     253  int dropped_count() const {
     254    if (!_has_verbose) throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get dropped_count() values.");
     255    return _dropped_delta_R.size();
     256  }
     257 
     258  // delta_R of dropped branches
     259  std::vector<double> dropped_delta_R() const {
     260    if (!_has_verbose) throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get dropped_delta_R() values.");
     261    return _dropped_delta_R;
     262  }
     263
     264  // symmetry values of dropped branches
     265  std::vector<double> dropped_symmetry() const {
     266    if (!_has_verbose) throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get dropped_symmetry() values.");
     267    return _dropped_symmetry;
     268  }
     269
     270  // mass drop values of dropped branches
     271  std::vector<double> dropped_mu() const {
     272    if (!_has_verbose) throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get dropped_mu() values.");
     273    return _dropped_mu;
     274  }
     275 
     276  // maximum symmetry value dropped
     277  double max_dropped_symmetry() const {
     278    if (!_has_verbose) throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get max_dropped_symmetry().");
     279    if (_dropped_symmetry.size() == 0) return 0.0;
     280    return *std::max_element(_dropped_symmetry.begin(),_dropped_symmetry.end());
     281  }
     282 
    359283private:
    360284  double _delta_R, _symmetry, _mu;
    361285  friend class RecursiveSymmetryCutBase;
    362286
    363   bool _is_composite;
    364  
    365287  // additional verbose information
    366288  bool _has_verbose;
     
    369291  std::vector<double> _dropped_symmetry;
    370292  std::vector<double> _dropped_mu;
    371 
    372   bool check_verbose(const std::string &what) const{
    373     if (!_has_verbose){
    374       throw Error("RecursiveSymmetryCutBase::StructureType: Verbose structure must be turned on to get "+what+".");
    375       return false;
    376     }
    377     return true;
    378   }
    379    
    380293 
    381294};
Note: See TracChangeset for help on using the changeset viewer.