Fork me on GitHub

Ignore:
Timestamp:
Sep 3, 2014, 3:18:54 PM (10 years ago)
Author:
Pavel Demin <demin@…>
Branches:
ImprovedOutputFile, Timing, dual_readout, llp, master
Children:
be2222c
Parents:
5b5a56b
Message:

upgrade FastJet to version 3.1.0-beta.1, upgrade Nsubjettiness to version 2.1.0, add SoftKiller version 1.0.0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • external/fastjet/ClusterSequence.hh

    r5b5a56b r35cdc46  
    1 //STARTHEADER
    2 // $Id: ClusterSequence.hh 3114 2013-05-04 08:46:00Z salam $
     1#ifndef __FASTJET_CLUSTERSEQUENCE_HH__
     2#define __FASTJET_CLUSTERSEQUENCE_HH__
     3
     4//FJSTARTHEADER
     5// $Id: ClusterSequence.hh 3619 2014-08-13 14:17:19Z salam $
    36//
    4 // Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
     7// Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
    58//
    69//----------------------------------------------------------------------
     
    1316//
    1417//  The algorithms that underlie FastJet have required considerable
    15 //  development and are described in hep-ph/0512210. If you use
     18//  development. They are described in the original FastJet paper,
     19//  hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
    1620//  FastJet as part of work towards a scientific publication, please
    17 //  include a citation to the FastJet paper.
     21//  quote the version you use and include a citation to the manual and
     22//  optionally also to hep-ph/0512210.
    1823//
    1924//  FastJet is distributed in the hope that it will be useful,
     
    2530//  along with FastJet. If not, see <http://www.gnu.org/licenses/>.
    2631//----------------------------------------------------------------------
    27 //ENDHEADER
    28 
    29 
    30 #ifndef __FASTJET_CLUSTERSEQUENCE_HH__
    31 #define __FASTJET_CLUSTERSEQUENCE_HH__
     32//FJENDHEADER
     33
    3234
    3335#include<vector>
     
    6567  ClusterSequence () : _deletes_self_when_unused(false) {}
    6668
    67 //   /// create a clustersequence starting from the supplied set
    68 //   /// of pseudojets and clustering them with the long-invariant
    69 //   /// kt algorithm (E-scheme recombination) with the supplied
    70 //   /// value for R.
    71 //   ///
    72 //   /// If strategy=DumbN3 a very stupid N^3 algorithm is used for the
    73 //   /// clustering; otherwise strategy = NlnN* uses cylinders algorithms
    74 //   /// with some number of pi coverage. If writeout_combinations=true a
    75 //   /// summary of the recombination sequence is written out
    76 //   template<class L> ClusterSequence (const std::vector<L> & pseudojets,
    77 //                 const double & R = 1.0,
    78 //                 const Strategy & strategy = Best,
    79 //                 const bool & writeout_combinations = false);
    80 
    81 
    82   /// create a clustersequence starting from the supplied set
    83   /// of pseudojets and clustering them with jet definition specified
     69  /// create a ClusterSequence, starting from the supplied set
     70  /// of PseudoJets and clustering them with jet definition specified
    8471  /// by jet_def (which also specifies the clustering strategy)
    8572  template<class L> ClusterSequence (
     
    10491  /// algorithm) with pt >= ptmin. Time taken should be of the order
    10592  /// of the number of jets returned.
    106   std::vector<PseudoJet> inclusive_jets (const double & ptmin = 0.0) const;
     93  std::vector<PseudoJet> inclusive_jets (const double ptmin = 0.0) const;
    10794
    10895  /// return the number of jets (in the sense of the exclusive
    10996  /// algorithm) that would be obtained when running the algorithm
    11097  /// with the given dcut.
    111   int n_exclusive_jets (const double & dcut) const;
     98  int n_exclusive_jets (const double dcut) const;
    11299
    113100  /// return a vector of all jets (in the sense of the exclusive
    114101  /// algorithm) that would be obtained when running the algorithm
    115102  /// with the given dcut.
    116   std::vector<PseudoJet> exclusive_jets (const double & dcut) const;
     103  std::vector<PseudoJet> exclusive_jets (const double dcut) const;
    117104
    118105  /// return a vector of all jets when the event is clustered (in the
     
    121108  /// If there are fewer than njets particles in the ClusterSequence
    122109  /// an error is thrown
    123   std::vector<PseudoJet> exclusive_jets (const int & njets) const;
     110  std::vector<PseudoJet> exclusive_jets (const int njets) const;
    124111
    125112  /// return a vector of all jets when the event is clustered (in the
     
    128115  /// If there are fewer than njets particles in the ClusterSequence
    129116  /// the function just returns however many particles there were.
    130   std::vector<PseudoJet> exclusive_jets_up_to (const int & njets) const;
     117  std::vector<PseudoJet> exclusive_jets_up_to (const int njets) const;
    131118
    132119  /// return the dmin corresponding to the recombination that went
    133120  /// from n+1 to n jets (sometimes known as d_{n n+1}). If the number
    134121  /// of particles in the event is <= njets, the function returns 0.
    135   double exclusive_dmerge (const int & njets) const;
     122  double exclusive_dmerge (const int njets) const;
    136123
    137124  /// return the maximum of the dmin encountered during all recombinations
     
    139126  /// exclusive_dmerge, except in cases where the dmin do not increase
    140127  /// monotonically.
    141   double exclusive_dmerge_max (const int & njets) const;
     128  double exclusive_dmerge_max (const int njets) const;
    142129
    143130  /// return the ymin corresponding to the recombination that went from
     
    158145
    159146
    160   //int n_exclusive_jets (const PseudoJet & jet, const double & dcut) const;
     147  //int n_exclusive_jets (const PseudoJet & jet, const double dcut) const;
    161148
    162149  /// return a vector of all subjets of the current jet (in the sense
     
    169156  /// just getting that list of constituents.
    170157  std::vector<PseudoJet> exclusive_subjets (const PseudoJet & jet,
    171                                             const double & dcut) const;
     158                                            const double dcut) const;
    172159
    173160  /// return the size of exclusive_subjets(...); still n ln n with same
     
    175162  /// exclusive_subjets.size()
    176163  int n_exclusive_subjets(const PseudoJet & jet,
    177                           const double & dcut) const;
     164                          const double dcut) const;
    178165
    179166  /// return the list of subjets obtained by unclustering the supplied
     
    193180                                                  int nsub) const;
    194181
    195   /// return the dij that was present in the merging nsub+1 -> nsub
     182  /// returns the dij that was present in the merging nsub+1 -> nsub
    196183  /// subjets inside this jet.
    197184  ///
     
    199186  double exclusive_subdmerge(const PseudoJet & jet, int nsub) const;
    200187
    201   /// return the maximum dij that occurred in the whole event at the
     188  /// returns the maximum dij that occurred in the whole event at the
    202189  /// stage that the nsub+1 -> nsub merge of subjets occurred inside
    203190  /// this jet.
     
    207194
    208195  //std::vector<PseudoJet> exclusive_jets (const PseudoJet & jet,
    209   //                                       const int & njets) const;
    210   //double exclusive_dmerge (const PseudoJet & jet, const int & njets) const;
     196  //                                       const int njets) const;
     197  //double exclusive_dmerge (const PseudoJet & jet, const int njets) const;
    211198
    212199  /// returns the sum of all energies in the event (relevant mainly for e+e-)
     
    272259// Not yet. Perhaps in a future release.
    273260//   /// print out all inclusive jets with pt > ptmin
    274 //   virtual void print_jets (const double & ptmin=0.0) const;
     261//   virtual void print_jets (const double ptmin=0.0) const;
    275262
    276263  /// add on to subjet_vector the constituents of jet (for internal use mainly)
     
    300287  ///
    301288  /// NB: after having made this call, the user is still allowed to
    302   /// delete the CS or let it go out of scope. Jets associated with it
    303   /// will then simply not be able to access their substructure after
    304   /// that point.
     289  /// delete the CS. Jets associated with it will then simply not be
     290  /// able to access their substructure after that point.
    305291  void delete_self_when_unused();
    306292
     
    313299
    314300  /// returns the scale associated with a jet as required for this
    315   /// clustering algorithm (kt^2 for the kt-algorithm, 1 for the
    316   /// Cambridge algorithm). [May become virtual at some point]
     301  /// clustering algorithm (kt^2 for the kt-algorithm, 1 for the
     302  /// Cambridge algorithm). Intended mainly for internal use and not
     303  /// valid for plugin algorithms.
    317304  double jet_scale_for_algorithm(const PseudoJet & jet) const;
    318305
     
    363350
    364351  /// the plugin can associate some extra information with the
     352  /// ClusterSequence object by calling this function. The
     353  /// ClusterSequence takes ownership of the pointer (and
     354  /// responsibility for deleting it when the CS gets deleted).
     355  inline void plugin_associate_extras(Extras * extras_in) {
     356    _extras.reset(extras_in);
     357  }
     358
     359  /// the plugin can associate some extra information with the
    365360  /// ClusterSequence object by calling this function
     361  ///
     362  /// As of FJ v3.1, this is deprecated, in line with the deprecation
     363  /// of auto_ptr in C++11
    366364  inline void plugin_associate_extras(std::auto_ptr<Extras> extras_in) {
    367     //_extras = extras_in;
    368365    _extras.reset(extras_in.release());
    369366  }
     
    599596//DEP   /// clustering, provided for legacy purposes. The jet finder is that
    600597//DEP   /// specified in the static member _default_jet_algorithm.
    601 //DEP   void _initialise_and_run (const double & R,
     598//DEP   void _initialise_and_run (const double R,
    602599//DEP                       const Strategy & strategy,
    603600//DEP                       const bool & writeout_combinations);
     
    622619  /// jet_j, at distance scale dij; return the index newjet_k of the
    623620  /// result of the recombination of i and j.
    624   void _do_ij_recombination_step(const int & jet_i, const int & jet_j,
    625                                  const double & dij, int & newjet_k);
     621  void _do_ij_recombination_step(const int jet_i, const int jet_j,
     622                                 const double dij, int & newjet_k);
    626623
    627624  /// carry out an recombination step in which _jets[jet_i] merges with
    628625  /// the beam,
    629   void _do_iB_recombination_step(const int & jet_i, const double & diB);
     626  void _do_iB_recombination_step(const int jet_i, const double diB);
    630627
    631628  /// every time a jet is added internally during clustering, this
     
    640637  void _update_structure_use_count();
    641638 
     639  /// returns a suggestion for the best strategy to use on event
     640  /// multiplicity, algorithm, R, etc.
     641  Strategy _best_strategy() const;
     642 
     643  /// returns c*(a*R**2 + b*R + 1);
     644  /// Written as a class in case we want to give names to different
     645  /// parabolas
     646  class _Parabola {
     647  public:
     648    _Parabola(double a, double b, double c) : _a(a), _b(b), _c(c) {}
     649    inline double operator()(const double R) const {return _c*(_a*R*R + _b*R + 1);}
     650  private:
     651    double _a, _b, _c;
     652  };
     653
     654  /// operator()(R) returns a*R+b;
     655  class _Line {
     656  public:
     657    _Line(double a, double b) : _a(a), _b(b) {}
     658    inline double operator()(const double R) const {return _a*R + _b;}
     659  private:
     660    double _a, _b;
     661  };
    642662
    643663  /// This contains the physical PseudoJets; for each PseudoJet one
     
    681701
    682702  bool _plugin_activated;
    683   //std::auto_ptr<Extras> _extras; // things the plugin might want to add
    684703  SharedPtr<Extras> _extras; // things the plugin might want to add
    685704
     
    705724  void _fast_NsqrtN_cluster();
    706725
    707   void _add_step_to_history(const int & step_number, const int & parent1,
    708                                const int & parent2, const int & jetp_index,
    709                                const double & dij);
     726  void _add_step_to_history(const int step_number, const int parent1,
     727                               const int parent2, const int jetp_index,
     728                               const double dij);
    710729
    711730  /// internal routine associated with the construction of the unique
     
    726745
    727746  /// currently used only in the Voronoi based code
    728   void _add_ktdistance_to_map(const int & ii,
     747  void _add_ktdistance_to_map(const int ii,
    729748                              DistMap & DijMap,
    730749                              const DynamicNearestNeighbours * DNN);
     
    734753  static bool _first_time;
    735754
    736   /// record the number of warnings provided about the exclusive
    737   /// algorithm -- so that we don't print it out more than a few
    738   /// times.
    739   static int _n_exclusive_warnings;
     755  /// manage warnings related to exclusive jets access
     756  static LimitedWarning _exclusive_warnings;
    740757
    741758  /// the limited warning member for notification of user that
     
    754771    int        _jets_index;
    755772  };
    756 
    757773
    758774  /// structure analogous to BriefJet, but with the extra information
     
    862878  // routines for tiled case, including some overloads of the plain
    863879  // BriefJet cases
    864   int  _tile_index(const double & eta, const double & phi) const;
     880  int  _tile_index(const double eta, const double phi) const;
    865881  void _tj_set_jetinfo ( TiledJet * const jet, const int _jets_index);
    866882  void  _bj_remove_from_tiles(TiledJet * const jet);
     
    871887  void _add_untagged_neighbours_to_tile_union(const int tile_index,
    872888                 std::vector<int> & tile_union, int & n_near_tiles);
    873 
    874889
    875890  //----------------------------------------------------------------------
     
    923938// template<class L> ClusterSequence::ClusterSequence (
    924939//                                const std::vector<L> & pseudojets,
    925 //                                const double & R,
     940//                                const double R,
    926941//                                const Strategy & strategy,
    927942//                                const bool & writeout_combinations) {
     
    966981
    967982inline unsigned int ClusterSequence::n_particles() const {return _initial_n;}
     983
     984//----------------------------------------------------------------------
     985// implementation of JetDefinition::operator() is here to avoid nasty
     986// issues of order of implementations and includes
     987template<class L>
     988std::vector<PseudoJet> JetDefinition::operator()(const std::vector<L> & particles) const {
     989  // create a new cluster sequence
     990  ClusterSequence * cs = new ClusterSequence(particles, *this);
     991
     992  // get the jets, and sort them according to whether the algorithm
     993  // is spherical or not
     994  std::vector<PseudoJet> jets;
     995  if (is_spherical()) {
     996    jets = sorted_by_E(cs->inclusive_jets());
     997  } else {
     998    jets = sorted_by_pt(cs->inclusive_jets());
     999  }
     1000 
     1001  // make sure the ClusterSequence gets deleted once it's no longer
     1002  // needed
     1003  if (jets.size() != 0) {
     1004    cs->delete_self_when_unused();
     1005  } else {
     1006    delete cs;
     1007  }
     1008
     1009  return jets;
     1010}
    9681011
    9691012
Note: See TracChangeset for help on using the changeset viewer.