Fork me on GitHub

Ignore:
Timestamp:
Jun 6, 2018, 10:05:10 PM (6 years ago)
Author:
Pavel Demin <pavel-demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
17d0ab8
Parents:
95e6b7a
Message:

update FastJet library to 3.3.1 and FastJet Contrib library to 1.036

File:
1 edited

Legend:

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

    r95e6b7a rb7b836a  
    1 // $Id: RecursiveSymmetryCutBase.hh 700 2014-07-07 12:50:05Z gsoyez $
     1// $Id: RecursiveSymmetryCutBase.hh 1074 2017-09-18 15:15:20Z gsoyez $
    22//
    33// Copyright (c) 2014-, Gavin P. Salam, Gregory Soyez, Jesse Thaler
     
    2424
    2525#include <limits>
     26#include <cassert>
    2627#include <fastjet/internal/base.hh>
    2728#include "fastjet/tools/Transformer.hh"
    2829#include "fastjet/WrappedStructure.hh"
    29 
     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
    3038#include "Recluster.hh"
     39#endif
    3140
    3241/** \mainpage RecursiveTools contrib
    3342
    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:
     43    The RecursiveTools contrib provides a set of tools for
     44    recursive investigation jet substructure. Currently it includes:
    3845    - fastjet::contrib::ModifiedMassDropTagger
    3946    - fastjet::contrib::SoftDrop
    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
     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
    4351 */
    4452
     
    7886
    7987  /// an enum of the different (a)symmetry measures that can be used
    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                        
     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)
    8494  };
    8595
     
    8797  enum RecursionChoice{larger_pt, ///< choose the subjet with larger \f$ p_t \f$
    8898                       larger_mt, ///< choose the subjet with larger \f$ m_t \equiv (m^2+p_t^2)^{\frac12}] \f$
    89                        larger_m   ///  choose the subjet with larger mass (deprecated)
     99                       larger_m,  ///< choose the subjet with larger mass (deprecated)
     100                       larger_E   ///< choose the subjet with larger energy (meant for ee collisions)
    90101  };
    91102
     
    119130  virtual ~RecursiveSymmetryCutBase(){}
    120131
     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
    121138  // internal subtraction configuration
    122139  //----------------------------------------------------------------------
     
    147164  //----------------------------------------------------------------------
    148165
    149   /// configure the reclustering prior to the SoftDrop de-clustering
     166  /// configure the reclustering prior to the recursive de-clustering
    150167  ///  \param do_reclustering   recluster the jet or not?
    151168  ///  \param recluster         how to recluster the jet
     
    174191  /// in particular values of symmetry, delta_R, and mu of dropped branches
    175192  void set_verbose_structure(bool enable=true) { _verbose_structure = enable; }
     193  bool has_verbose_structure() const { return _verbose_structure; }
    176194 
    177195 
     
    185203  /// subtracted jet.
    186204  virtual PseudoJet result(const PseudoJet & j) const;
    187 
     205 
    188206  /// description of the tool
    189207  virtual std::string description() const;
    190208
    191   /// the type of the associated structure
    192   //typedef RecursiveSymmetryCutBaseStructure StructureType; 
     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 
    193214
    194215  class StructureType;
     
    203224  /// apply for a given pair of subjets p1 and p2
    204225  virtual double symmetry_cut_fn(const PseudoJet & /* p1 */,
    205                                  const PseudoJet & /* p2 */) const = 0;
     226                                 const PseudoJet & /* p2 */,
     227                                 void *extra_parameters = 0) const = 0;
    206228  /// the associated dwescription
    207229  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  }
    208269
    209270private:
     
    238299public:
    239300  StructureType(const PseudoJet & j) :
    240     WrappedStructure(j.structure_shared_ptr()),
     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),
    241315    _has_verbose(false) // by default, do not store verbose structure
    242316  {}
    243317 
    244318  // information about kept branch
    245   double delta_R()  const {return _delta_R;};
    246   double symmetry() const {return _symmetry;};
    247   double mu()       const {return _mu;};
     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;}
    248324 
    249325  // additional verbose information about dropped branches
    250326  bool has_verbose() const { return _has_verbose;}
    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  
     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
    283359private:
    284360  double _delta_R, _symmetry, _mu;
    285361  friend class RecursiveSymmetryCutBase;
    286362
     363  bool _is_composite;
     364 
    287365  // additional verbose information
    288366  bool _has_verbose;
     
    291369  std::vector<double> _dropped_symmetry;
    292370  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   
    293380 
    294381};
Note: See TracChangeset for help on using the changeset viewer.