Index: external/fastjet/ClusterSequence.hh
===================================================================
--- external/fastjet/ClusterSequence.hh	(revision 4564cba9fa0180ca6c293da8cea545291a6d0116)
+++ external/fastjet/ClusterSequence.hh	(revision d7d2da362406b9e37fdf238970417c94779b54b0)
@@ -1,9 +1,6 @@
-#ifndef __FASTJET_CLUSTERSEQUENCE_HH__
-#define __FASTJET_CLUSTERSEQUENCE_HH__
-
-//FJSTARTHEADER
-// $Id: ClusterSequence.hh 4442 2020-05-05 07:50:11Z soyez $
+//STARTHEADER
+// $Id: ClusterSequence.hh 2806 2011-12-01 17:21:00Z salam $
 //
-// Copyright (c) 2005-2020, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
+// Copyright (c) 2005-2011, Matteo Cacciari, Gavin P. Salam and Gregory Soyez
 //
 //----------------------------------------------------------------------
@@ -16,9 +13,7 @@
 //
 //  The algorithms that underlie FastJet have required considerable
-//  development. They are described in the original FastJet paper,
-//  hep-ph/0512210 and in the manual, arXiv:1111.6097. If you use
+//  development and are described in hep-ph/0512210. If you use
 //  FastJet as part of work towards a scientific publication, please
-//  quote the version you use and include a citation to the manual and
-//  optionally also to hep-ph/0512210.
+//  include a citation to the FastJet paper.
 //
 //  FastJet is distributed in the hope that it will be useful,
@@ -30,9 +25,13 @@
 //  along with FastJet. If not, see <http://www.gnu.org/licenses/>.
 //----------------------------------------------------------------------
-//FJENDHEADER
-
+//ENDHEADER
+
+
+#ifndef __FASTJET_CLUSTERSEQUENCE_HH__
+#define __FASTJET_CLUSTERSEQUENCE_HH__
 
 #include<vector>
 #include<map>
+#include "fastjet/internal/DynamicNearestNeighbours.hh"
 #include "fastjet/PseudoJet.hh"
 #include<memory>
@@ -49,12 +48,9 @@
 #include "fastjet/ClusterSequenceStructure.hh"
 
-#include "fastjet/internal/deprecated.hh"
-
 FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
 
 
-// forward declarations
+// forward declaration
 class ClusterSequenceStructure;
-class DynamicNearestNeighbours;
 
 /// @ingroup basic_classes
@@ -69,6 +65,21 @@
   ClusterSequence () : _deletes_self_when_unused(false) {}
 
-  /// create a ClusterSequence, starting from the supplied set
-  /// of PseudoJets and clustering them with jet definition specified
+//   /// create a clustersequence starting from the supplied set
+//   /// of pseudojets and clustering them with the long-invariant
+//   /// kt algorithm (E-scheme recombination) with the supplied
+//   /// value for R.
+//   ///
+//   /// If strategy=DumbN3 a very stupid N^3 algorithm is used for the
+//   /// clustering; otherwise strategy = NlnN* uses cylinders algorithms
+//   /// with some number of pi coverage. If writeout_combinations=true a
+//   /// summary of the recombination sequence is written out
+//   template<class L> ClusterSequence (const std::vector<L> & pseudojets, 
+// 		   const double & R = 1.0,
+// 		   const Strategy & strategy = Best,
+// 		   const bool & writeout_combinations = false);
+
+
+  /// create a clustersequence starting from the supplied set
+  /// of pseudojets and clustering them with jet definition specified
   /// by jet_def (which also specifies the clustering strategy)
   template<class L> ClusterSequence (
@@ -82,7 +93,4 @@
   }
 
-  /// explicit assignment operator for a ClusterSequence
-  ClusterSequence & operator=(const ClusterSequence & cs);
-  
   // virtual ClusterSequence destructor, in case any derived class
   // thinks of needing a destructor at some point
@@ -96,15 +104,15 @@
   /// algorithm) with pt >= ptmin. Time taken should be of the order
   /// of the number of jets returned.
-  std::vector<PseudoJet> inclusive_jets (const double ptmin = 0.0) const;
+  std::vector<PseudoJet> inclusive_jets (const double & ptmin = 0.0) const;
 
   /// return the number of jets (in the sense of the exclusive
   /// algorithm) that would be obtained when running the algorithm
   /// with the given dcut.
-  int n_exclusive_jets (const double dcut) const;
+  int n_exclusive_jets (const double & dcut) const;
 
   /// return a vector of all jets (in the sense of the exclusive
   /// algorithm) that would be obtained when running the algorithm
   /// with the given dcut.
-  std::vector<PseudoJet> exclusive_jets (const double dcut) const;
+  std::vector<PseudoJet> exclusive_jets (const double & dcut) const;
 
   /// return a vector of all jets when the event is clustered (in the
@@ -113,5 +121,5 @@
   /// If there are fewer than njets particles in the ClusterSequence
   /// an error is thrown
-  std::vector<PseudoJet> exclusive_jets (const int njets) const;
+  std::vector<PseudoJet> exclusive_jets (const int & njets) const;
 
   /// return a vector of all jets when the event is clustered (in the
@@ -120,10 +128,10 @@
   /// If there are fewer than njets particles in the ClusterSequence
   /// the function just returns however many particles there were.
-  std::vector<PseudoJet> exclusive_jets_up_to (const int njets) const;
+  std::vector<PseudoJet> exclusive_jets_up_to (const int & njets) const;
 
   /// return the dmin corresponding to the recombination that went
   /// from n+1 to n jets (sometimes known as d_{n n+1}). If the number
   /// of particles in the event is <= njets, the function returns 0.
-  double exclusive_dmerge (const int njets) const;
+  double exclusive_dmerge (const int & njets) const;
 
   /// return the maximum of the dmin encountered during all recombinations 
@@ -131,5 +139,5 @@
   /// exclusive_dmerge, except in cases where the dmin do not increase
   /// monotonically.
-  double exclusive_dmerge_max (const int njets) const;
+  double exclusive_dmerge_max (const int & njets) const;
 
   /// return the ymin corresponding to the recombination that went from
@@ -150,5 +158,5 @@
 
 
-  //int n_exclusive_jets (const PseudoJet & jet, const double dcut) const;
+  //int n_exclusive_jets (const PseudoJet & jet, const double & dcut) const;
 
   /// return a vector of all subjets of the current jet (in the sense
@@ -161,5 +169,5 @@
   /// just getting that list of constituents.
   std::vector<PseudoJet> exclusive_subjets (const PseudoJet & jet, 
-                                            const double dcut) const;
+                                            const double & dcut) const;
 
   /// return the size of exclusive_subjets(...); still n ln n with same
@@ -167,5 +175,5 @@
   /// exclusive_subjets.size()
   int n_exclusive_subjets(const PseudoJet & jet, 
-                          const double dcut) const;
+                          const double & dcut) const;
 
   /// return the list of subjets obtained by unclustering the supplied
@@ -185,5 +193,5 @@
 						  int nsub) const;
 
-  /// returns the dij that was present in the merging nsub+1 -> nsub 
+  /// return the dij that was present in the merging nsub+1 -> nsub 
   /// subjets inside this jet.
   ///
@@ -191,5 +199,5 @@
   double exclusive_subdmerge(const PseudoJet & jet, int nsub) const;
 
-  /// returns the maximum dij that occurred in the whole event at the
+  /// return the maximum dij that occurred in the whole event at the
   /// stage that the nsub+1 -> nsub merge of subjets occurred inside 
   /// this jet.
@@ -199,6 +207,6 @@
 
   //std::vector<PseudoJet> exclusive_jets (const PseudoJet & jet, 
-  //                                       const int njets) const;
-  //double exclusive_dmerge (const PseudoJet & jet, const int njets) const;
+  //                                       const int & njets) const;
+  //double exclusive_dmerge (const PseudoJet & jet, const int & njets) const;
 
   /// returns the sum of all energies in the event (relevant mainly for e+e-)
@@ -264,5 +272,5 @@
 // Not yet. Perhaps in a future release.
 //   /// print out all inclusive jets with pt > ptmin
-//   virtual void print_jets (const double ptmin=0.0) const;
+//   virtual void print_jets (const double & ptmin=0.0) const;
 
   /// add on to subjet_vector the constituents of jet (for internal use mainly)
@@ -292,6 +300,7 @@
   ///
   /// NB: after having made this call, the user is still allowed to
-  /// delete the CS. Jets associated with it will then simply not be
-  /// able to access their substructure after that point.
+  /// delete the CS or let it go out of scope. Jets associated with it
+  /// will then simply not be able to access their substructure after
+  /// that point.
   void delete_self_when_unused();
 
@@ -304,7 +313,6 @@
 
   /// returns the scale associated with a jet as required for this
-  /// clustering algorithm (kt^2 for the kt-algorithm, 1 for the
-  /// Cambridge algorithm). Intended mainly for internal use and not
-  /// valid for plugin algorithms.
+  /// clustering algorithm (kt^2 for the kt-algorithm, 1 for the 
+  /// Cambridge algorithm). [May become virtual at some point]
   double jet_scale_for_algorithm(const PseudoJet & jet) const;
 
@@ -355,24 +363,9 @@
 
   /// the plugin can associate some extra information with the
-  /// ClusterSequence object by calling this function. The
-  /// ClusterSequence takes ownership of the pointer (and
-  /// responsibility for deleting it when the CS gets deleted).
-  inline void plugin_associate_extras(Extras * extras_in) {
-    _extras.reset(extras_in);
-  }
-
-  /// the plugin can associate some extra information with the
   /// ClusterSequence object by calling this function
-  /// 
-  /// As of FJ v3.1, this is deprecated, in line with the deprecation
-  /// of auto_ptr in C++11
-#ifndef SWIG
-#ifdef FASTJET_HAVE_AUTO_PTR_INTERFACE
-  FASTJET_DEPRECATED_MSG("Please use ClusterSequence::plugin_associate_extras(Extras * extras_in)) instead")
-  inline void plugin_associate_extras(std::auto_ptr<Extras> extras_in){
+  inline void plugin_associate_extras(std::auto_ptr<Extras> extras_in) {
+    //_extras = extras_in;
     _extras.reset(extras_in.release());
   }
-#endif
-#endif //SWIG
 
   /// returns true when the plugin is allowed to run the show.
@@ -606,5 +599,5 @@
 //DEP   /// clustering, provided for legacy purposes. The jet finder is that
 //DEP   /// specified in the static member _default_jet_algorithm.
-//DEP   void _initialise_and_run (const double R,
+//DEP   void _initialise_and_run (const double & R,
 //DEP 			    const Strategy & strategy,
 //DEP 			    const bool & writeout_combinations);
@@ -629,10 +622,10 @@
   /// jet_j, at distance scale dij; return the index newjet_k of the
   /// result of the recombination of i and j.
-  void _do_ij_recombination_step(const int jet_i, const int jet_j, 
-				 const double dij, int & newjet_k);
+  void _do_ij_recombination_step(const int & jet_i, const int & jet_j, 
+				 const double & dij, int & newjet_k);
 
   /// carry out an recombination step in which _jets[jet_i] merges with
   /// the beam, 
-  void _do_iB_recombination_step(const int jet_i, const double diB);
+  void _do_iB_recombination_step(const int & jet_i, const double & diB);
 
   /// every time a jet is added internally during clustering, this
@@ -647,33 +640,4 @@
   void _update_structure_use_count();
   
-  /// returns a suggestion for the best strategy to use on event
-  /// multiplicity, algorithm, R, etc.
-  Strategy _best_strategy() const;
-  
-  /// \if internal_doc
-  /// \class _Parabola
-  /// returns c*(a*R**2 + b*R + 1);
-  /// Written as a class in case we want to give names to different
-  /// parabolas
-  /// \endif
-  class _Parabola {
-  public:
-    _Parabola(double a, double b, double c) : _a(a), _b(b), _c(c) {}
-    inline double operator()(const double R) const {return _c*(_a*R*R + _b*R + 1);}
-  private:
-    double _a, _b, _c;
-  };
-
-  /// \if internal_doc
-  /// \class _Line
-  /// operator()(R) returns a*R+b;
-  /// \endif
-  class _Line {
-  public:
-    _Line(double a, double b) : _a(a), _b(b) {}
-    inline double operator()(const double R) const {return _a*R + _b;}
-  private:
-    double _a, _b;
-  };
 
   /// This contains the physical PseudoJets; for each PseudoJet one
@@ -717,4 +681,5 @@
 
   bool _plugin_activated;
+  //std::auto_ptr<Extras> _extras; // things the plugin might want to add
   SharedPtr<Extras> _extras; // things the plugin might want to add
 
@@ -740,8 +705,7 @@
   void _fast_NsqrtN_cluster();
 
-  void _add_step_to_history( //const int step_number,
-                            const int parent1, 
-			    const int parent2, const int jetp_index,
-			    const double dij);
+  void _add_step_to_history(const int & step_number, const int & parent1, 
+			       const int & parent2, const int & jetp_index,
+			       const double & dij);
 
   /// internal routine associated with the construction of the unique
@@ -762,5 +726,5 @@
 
   /// currently used only in the Voronoi based code
-  void _add_ktdistance_to_map(const int ii, 
+  void _add_ktdistance_to_map(const int & ii, 
 			      DistMap & DijMap,
   			      const DynamicNearestNeighbours * DNN);
@@ -770,6 +734,8 @@
   static bool _first_time;
 
-  /// manage warnings related to exclusive jets access
-  static LimitedWarning _exclusive_warnings;
+  /// record the number of warnings provided about the exclusive
+  /// algorithm -- so that we don't print it out more than a few
+  /// times.
+  static int _n_exclusive_warnings;
 
   /// the limited warning member for notification of user that 
@@ -788,4 +754,5 @@
     int        _jets_index;
   };
+
 
   /// structure analogous to BriefJet, but with the extra information
@@ -895,5 +862,5 @@
   // routines for tiled case, including some overloads of the plain
   // BriefJet cases
-  int  _tile_index(const double eta, const double phi) const;
+  int  _tile_index(const double & eta, const double & phi) const;
   void _tj_set_jetinfo ( TiledJet * const jet, const int _jets_index);
   void  _bj_remove_from_tiles(TiledJet * const jet);
@@ -904,4 +871,5 @@
   void _add_untagged_neighbours_to_tile_union(const int tile_index, 
 		 std::vector<int> & tile_union, int & n_near_tiles);
+
 
   //----------------------------------------------------------------------
@@ -955,5 +923,5 @@
 // template<class L> ClusterSequence::ClusterSequence (
 // 			          const std::vector<L> & pseudojets,
-// 				  const double R,
+// 				  const double & R,
 // 				  const Strategy & strategy,
 // 				  const bool & writeout_combinations) {
@@ -999,33 +967,4 @@
 inline unsigned int ClusterSequence::n_particles() const {return _initial_n;}
 
-//----------------------------------------------------------------------
-// implementation of JetDefinition::operator() is here to avoid nasty
-// issues of order of implementations and includes
-#ifndef __CINT__
-template<class L>
-std::vector<PseudoJet> JetDefinition::operator()(const std::vector<L> & particles) const {
-  // create a new cluster sequence
-  ClusterSequence * cs = new ClusterSequence(particles, *this);
-
-  // get the jets, and sort them according to whether the algorithm
-  // is spherical or not
-  std::vector<PseudoJet> jets;
-  if (is_spherical()) {
-    jets = sorted_by_E(cs->inclusive_jets());
-  } else {
-    jets = sorted_by_pt(cs->inclusive_jets());
-  }
-  
-  // make sure the ClusterSequence gets deleted once it's no longer
-  // needed
-  if (jets.size() != 0) {
-    cs->delete_self_when_unused();
-  } else {
-    delete cs;
-  }
-
-  return jets;
-}
-#endif // __CINT__
 
 
@@ -1048,15 +987,7 @@
 template <class J> inline double ClusterSequence::_bj_dist(
                 const J * const jetA, const J * const jetB) const {
-  //#define FASTJET_NEW_DELTA_PHI
-#ifndef FASTJET_NEW_DELTA_PHI
-  //GPS+MC old version of Delta phi calculation
   double dphi = std::abs(jetA->phi - jetB->phi);
   double deta = (jetA->eta - jetB->eta);
   if (dphi > pi) {dphi = twopi - dphi;}
-#else 
-  //GPS+MC testing for 2015-02-faster-deltaR2
-  double dphi = pi-std::abs(pi-std::abs(jetA->phi - jetB->phi));
-  double deta = (jetA->eta - jetB->eta);
-#endif 
   return dphi*dphi + deta*deta;
 }
