Fork me on GitHub

Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • external/fastjet/ClusterSequence.hh

    r273e668 rd69dfe4  
    1 #ifndef __FASTJET_CLUSTERSEQUENCE_HH__
    2 #define __FASTJET_CLUSTERSEQUENCE_HH__
    3 
    4 //FJSTARTHEADER
    5 // $Id: ClusterSequence.hh 3709 2014-09-29 13:19:11Z soyez $
     1//STARTHEADER
     2// $Id: ClusterSequence.hh 3114 2013-05-04 08:46:00Z salam $
    63//
    7 // Copyright (c) 2005-2014, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
     4// Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
    85//
    96//----------------------------------------------------------------------
     
    1613//
    1714//  The algorithms that underlie FastJet have required considerable
    18 //  development. They are described in the original FastJet paper,
    19 //  hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
     15//  development and are described in hep-ph/0512210. If you use
    2016//  FastJet as part of work towards a scientific publication, please
    21 //  quote the version you use and include a citation to the manual and
    22 //  optionally also to hep-ph/0512210.
     17//  include a citation to the FastJet paper.
    2318//
    2419//  FastJet is distributed in the hope that it will be useful,
     
    3025//  along with FastJet. If not, see <http://www.gnu.org/licenses/>.
    3126//----------------------------------------------------------------------
    32 //FJENDHEADER
    33 
     27//ENDHEADER
     28
     29
     30#ifndef __FASTJET_CLUSTERSEQUENCE_HH__
     31#define __FASTJET_CLUSTERSEQUENCE_HH__
    3432
    3533#include<vector>
     
    6765  ClusterSequence () : _deletes_self_when_unused(false) {}
    6866
    69   /// create a ClusterSequence, starting from the supplied set
    70   /// of PseudoJets and clustering them with jet definition specified
     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
    7184  /// by jet_def (which also specifies the clustering strategy)
    7285  template<class L> ClusterSequence (
     
    91104  /// algorithm) with pt >= ptmin. Time taken should be of the order
    92105  /// of the number of jets returned.
    93   std::vector<PseudoJet> inclusive_jets (const double ptmin = 0.0) const;
     106  std::vector<PseudoJet> inclusive_jets (const double & ptmin = 0.0) const;
    94107
    95108  /// return the number of jets (in the sense of the exclusive
    96109  /// algorithm) that would be obtained when running the algorithm
    97110  /// with the given dcut.
    98   int n_exclusive_jets (const double dcut) const;
     111  int n_exclusive_jets (const double & dcut) const;
    99112
    100113  /// return a vector of all jets (in the sense of the exclusive
    101114  /// algorithm) that would be obtained when running the algorithm
    102115  /// with the given dcut.
    103   std::vector<PseudoJet> exclusive_jets (const double dcut) const;
     116  std::vector<PseudoJet> exclusive_jets (const double & dcut) const;
    104117
    105118  /// return a vector of all jets when the event is clustered (in the
     
    108121  /// If there are fewer than njets particles in the ClusterSequence
    109122  /// an error is thrown
    110   std::vector<PseudoJet> exclusive_jets (const int njets) const;
     123  std::vector<PseudoJet> exclusive_jets (const int & njets) const;
    111124
    112125  /// return a vector of all jets when the event is clustered (in the
     
    115128  /// If there are fewer than njets particles in the ClusterSequence
    116129  /// the function just returns however many particles there were.
    117   std::vector<PseudoJet> exclusive_jets_up_to (const int njets) const;
     130  std::vector<PseudoJet> exclusive_jets_up_to (const int & njets) const;
    118131
    119132  /// return the dmin corresponding to the recombination that went
    120133  /// from n+1 to n jets (sometimes known as d_{n n+1}). If the number
    121134  /// of particles in the event is <= njets, the function returns 0.
    122   double exclusive_dmerge (const int njets) const;
     135  double exclusive_dmerge (const int & njets) const;
    123136
    124137  /// return the maximum of the dmin encountered during all recombinations
     
    126139  /// exclusive_dmerge, except in cases where the dmin do not increase
    127140  /// monotonically.
    128   double exclusive_dmerge_max (const int njets) const;
     141  double exclusive_dmerge_max (const int & njets) const;
    129142
    130143  /// return the ymin corresponding to the recombination that went from
     
    145158
    146159
    147   //int n_exclusive_jets (const PseudoJet & jet, const double dcut) const;
     160  //int n_exclusive_jets (const PseudoJet & jet, const double & dcut) const;
    148161
    149162  /// return a vector of all subjets of the current jet (in the sense
     
    156169  /// just getting that list of constituents.
    157170  std::vector<PseudoJet> exclusive_subjets (const PseudoJet & jet,
    158                                             const double dcut) const;
     171                                            const double & dcut) const;
    159172
    160173  /// return the size of exclusive_subjets(...); still n ln n with same
     
    162175  /// exclusive_subjets.size()
    163176  int n_exclusive_subjets(const PseudoJet & jet,
    164                           const double dcut) const;
     177                          const double & dcut) const;
    165178
    166179  /// return the list of subjets obtained by unclustering the supplied
     
    180193                                                  int nsub) const;
    181194
    182   /// returns the dij that was present in the merging nsub+1 -> nsub
     195  /// return the dij that was present in the merging nsub+1 -> nsub
    183196  /// subjets inside this jet.
    184197  ///
     
    186199  double exclusive_subdmerge(const PseudoJet & jet, int nsub) const;
    187200
    188   /// returns the maximum dij that occurred in the whole event at the
     201  /// return the maximum dij that occurred in the whole event at the
    189202  /// stage that the nsub+1 -> nsub merge of subjets occurred inside
    190203  /// this jet.
     
    194207
    195208  //std::vector<PseudoJet> exclusive_jets (const PseudoJet & jet,
    196   //                                       const int njets) const;
    197   //double exclusive_dmerge (const PseudoJet & jet, const int njets) const;
     209  //                                       const int & njets) const;
     210  //double exclusive_dmerge (const PseudoJet & jet, const int & njets) const;
    198211
    199212  /// returns the sum of all energies in the event (relevant mainly for e+e-)
     
    259272// Not yet. Perhaps in a future release.
    260273//   /// print out all inclusive jets with pt > ptmin
    261 //   virtual void print_jets (const double ptmin=0.0) const;
     274//   virtual void print_jets (const double & ptmin=0.0) const;
    262275
    263276  /// add on to subjet_vector the constituents of jet (for internal use mainly)
     
    287300  ///
    288301  /// NB: after having made this call, the user is still allowed to
    289   /// delete the CS. Jets associated with it will then simply not be
    290   /// able to access their substructure after that point.
     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.
    291305  void delete_self_when_unused();
    292306
     
    299313
    300314  /// returns the scale associated with a jet as required for this
    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.
     315  /// clustering algorithm (kt^2 for the kt-algorithm, 1 for the
     316  /// Cambridge algorithm). [May become virtual at some point]
    304317  double jet_scale_for_algorithm(const PseudoJet & jet) const;
    305318
     
    350363
    351364  /// 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
    360365  /// 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
    364366  inline void plugin_associate_extras(std::auto_ptr<Extras> extras_in) {
     367    //_extras = extras_in;
    365368    _extras.reset(extras_in.release());
    366369  }
     
    596599//DEP   /// clustering, provided for legacy purposes. The jet finder is that
    597600//DEP   /// specified in the static member _default_jet_algorithm.
    598 //DEP   void _initialise_and_run (const double R,
     601//DEP   void _initialise_and_run (const double & R,
    599602//DEP                       const Strategy & strategy,
    600603//DEP                       const bool & writeout_combinations);
     
    619622  /// jet_j, at distance scale dij; return the index newjet_k of the
    620623  /// result of the recombination of i and j.
    621   void _do_ij_recombination_step(const int jet_i, const int jet_j,
    622                                  const double dij, int & newjet_k);
     624  void _do_ij_recombination_step(const int & jet_i, const int & jet_j,
     625                                 const double & dij, int & newjet_k);
    623626
    624627  /// carry out an recombination step in which _jets[jet_i] merges with
    625628  /// the beam,
    626   void _do_iB_recombination_step(const int jet_i, const double diB);
     629  void _do_iB_recombination_step(const int & jet_i, const double & diB);
    627630
    628631  /// every time a jet is added internally during clustering, this
     
    637640  void _update_structure_use_count();
    638641 
    639   /// returns a suggestion for the best strategy to use on event
    640   /// multiplicity, algorithm, R, etc.
    641   Strategy _best_strategy() const;
    642  
    643   /// \if internal_doc
    644   /// \class _Parabola
    645   /// returns c*(a*R**2 + b*R + 1);
    646   /// Written as a class in case we want to give names to different
    647   /// parabolas
    648   /// \endif
    649   class _Parabola {
    650   public:
    651     _Parabola(double a, double b, double c) : _a(a), _b(b), _c(c) {}
    652     inline double operator()(const double R) const {return _c*(_a*R*R + _b*R + 1);}
    653   private:
    654     double _a, _b, _c;
    655   };
    656 
    657   /// \if internal_doc
    658   /// \class _Line
    659   /// operator()(R) returns a*R+b;
    660   /// \endif
    661   class _Line {
    662   public:
    663     _Line(double a, double b) : _a(a), _b(b) {}
    664     inline double operator()(const double R) const {return _a*R + _b;}
    665   private:
    666     double _a, _b;
    667   };
    668642
    669643  /// This contains the physical PseudoJets; for each PseudoJet one
     
    707681
    708682  bool _plugin_activated;
     683  //std::auto_ptr<Extras> _extras; // things the plugin might want to add
    709684  SharedPtr<Extras> _extras; // things the plugin might want to add
    710685
     
    730705  void _fast_NsqrtN_cluster();
    731706
    732   void _add_step_to_history(const int step_number, const int parent1,
    733                                const int parent2, const int jetp_index,
    734                                const double dij);
     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);
    735710
    736711  /// internal routine associated with the construction of the unique
     
    751726
    752727  /// currently used only in the Voronoi based code
    753   void _add_ktdistance_to_map(const int ii,
     728  void _add_ktdistance_to_map(const int & ii,
    754729                              DistMap & DijMap,
    755730                              const DynamicNearestNeighbours * DNN);
     
    759734  static bool _first_time;
    760735
    761   /// manage warnings related to exclusive jets access
    762   static LimitedWarning _exclusive_warnings;
     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;
    763740
    764741  /// the limited warning member for notification of user that
     
    777754    int        _jets_index;
    778755  };
     756
    779757
    780758  /// structure analogous to BriefJet, but with the extra information
     
    884862  // routines for tiled case, including some overloads of the plain
    885863  // BriefJet cases
    886   int  _tile_index(const double eta, const double phi) const;
     864  int  _tile_index(const double & eta, const double & phi) const;
    887865  void _tj_set_jetinfo ( TiledJet * const jet, const int _jets_index);
    888866  void  _bj_remove_from_tiles(TiledJet * const jet);
     
    893871  void _add_untagged_neighbours_to_tile_union(const int tile_index,
    894872                 std::vector<int> & tile_union, int & n_near_tiles);
     873
    895874
    896875  //----------------------------------------------------------------------
     
    944923// template<class L> ClusterSequence::ClusterSequence (
    945924//                                const std::vector<L> & pseudojets,
    946 //                                const double R,
     925//                                const double & R,
    947926//                                const Strategy & strategy,
    948927//                                const bool & writeout_combinations) {
     
    987966
    988967inline unsigned int ClusterSequence::n_particles() const {return _initial_n;}
    989 
    990 //----------------------------------------------------------------------
    991 // implementation of JetDefinition::operator() is here to avoid nasty
    992 // issues of order of implementations and includes
    993 template<class L>
    994 std::vector<PseudoJet> JetDefinition::operator()(const std::vector<L> & particles) const {
    995   // create a new cluster sequence
    996   ClusterSequence * cs = new ClusterSequence(particles, *this);
    997 
    998   // get the jets, and sort them according to whether the algorithm
    999   // is spherical or not
    1000   std::vector<PseudoJet> jets;
    1001   if (is_spherical()) {
    1002     jets = sorted_by_E(cs->inclusive_jets());
    1003   } else {
    1004     jets = sorted_by_pt(cs->inclusive_jets());
    1005   }
    1006  
    1007   // make sure the ClusterSequence gets deleted once it's no longer
    1008   // needed
    1009   if (jets.size() != 0) {
    1010     cs->delete_self_when_unused();
    1011   } else {
    1012     delete cs;
    1013   }
    1014 
    1015   return jets;
    1016 }
    1017968
    1018969
Note: See TracChangeset for help on using the changeset viewer.