Index: external/fastjet/contribs/Nsubjettiness/AUTHORS
===================================================================
--- external/fastjet/contribs/Nsubjettiness/AUTHORS	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ external/fastjet/contribs/Nsubjettiness/AUTHORS	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -1,12 +1,16 @@
-The Nsubjettiness FastJet contrib was written and is maintained and developed by:
+-------------------------------------------------------------------------------
 
-   Jesse Thaler <jthaler@jthaler.net>
+The Nsubjettiness FastJet contrib was written, maintained, and developed by:
+
+   Jesse Thaler <jthaler@mit.edu>
    Ken Van Tilburg <kenvt@stanford.edu>
    Christopher K. Vermilion <christopher.vermilion@gmail.com>
    TJ Wilkason <tjwilk@mit.edu>
 
-Questions and comments should be directed to:  jthaler@jthaler.net.
+Questions and comments should be directed to:  jthaler@mit.edu.
 
-For physics details, see:
+-------------------------------------------------------------------------------
+
+For physics details on N-subjettiness, see:
 
    Identifying Boosted Objects with N-subjettiness.
@@ -20,9 +24,24 @@
 New in v2.0 is the winner-take-all axis, described in:
 
+   Jet Observables Without Jet Algorithms. 
+   Daniele Bertolini, Tucker Chan, and Jesse Thaler. 
+   JHEP 1404:013 (2014), arXiv:1310.7584.
+
    Jet Shapes with the Broadening Axis. 
    Andrew J. Larkoski, Duff Neill, and Jesse Thaler. 
    JHEP 1404:017 (2014), arXiv:1401.2158.
 
-as well as in unpublished work by Gavin Salam.
+   Unpublished work by Gavin Salam.
 
-----------------------------------------------------------------------
+New in v2.2 is the XCone jet algorithm, described in:
+
+   XCone: N-jettiness as an Exclusive Cone Jet Algorithm.
+   Iain W. Stewart, Frank J. Tackmann, Jesse Thaler,
+   Christopher K. Vermilion, and Thomas F. Wilkason.
+   arXiv:1508.01516.
+
+   Resolving Boosted Jets with XCone.
+   Jesse Thaler and Thomas F. Wilkason.
+   arXiv:1508.01518.
+
+-------------------------------------------------------------------------------
Index: external/fastjet/contribs/Nsubjettiness/AxesDefinition.cc
===================================================================
--- external/fastjet/contribs/Nsubjettiness/AxesDefinition.cc	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
+++ external/fastjet/contribs/Nsubjettiness/AxesDefinition.cc	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -0,0 +1,95 @@
+//  Nsubjettiness Package
+//  Questions/Comments?  jthaler@jthaler.net
+//
+//  Copyright (c) 2011-14
+//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
+//
+//  $Id: AxesDefinition.cc 833 2015-07-23 14:35:23Z jthaler $
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#include "AxesDefinition.hh"
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+namespace contrib {
+  
+// Repeatedly calls the one pass finder to try to find global minimum
+std::vector<fastjet::PseudoJet> AxesDefinition::get_multi_pass_axes(int n_jets,
+                                                                    const std::vector <fastjet::PseudoJet> & inputJets,
+                                                                    const std::vector <fastjet::PseudoJet> & seedAxes,
+                                                                    const MeasureDefinition* measure) const {
+   
+   assert(n_jets == (int)seedAxes.size()); //added int casting to get rid of compiler warning
+   
+   // first iteration
+   std::vector<fastjet::PseudoJet> bestAxes = measure->get_one_pass_axes(n_jets, inputJets, seedAxes,_nAttempts,_accuracy);
+   
+   double bestTau = measure->result(inputJets,bestAxes);
+   
+   for (int l = 1; l < _Npass; l++) { // Do minimization procedure multiple times (l = 1 to start since first iteration is done already)
+      
+      // Add noise to current best axes
+      std::vector< PseudoJet > noiseAxes(n_jets, PseudoJet(0,0,0,0));
+      for (int k = 0; k < n_jets; k++) {
+         noiseAxes[k] = jiggle(bestAxes[k]);
+      }
+      
+      std::vector<fastjet::PseudoJet> testAxes = measure->get_one_pass_axes(n_jets, inputJets, noiseAxes,_nAttempts,_accuracy);
+      double testTau = measure->result(inputJets,testAxes);
+      
+      if (testTau < bestTau) {
+         bestTau = testTau;
+         bestAxes = testAxes;
+      }
+   }
+   
+   return bestAxes;
+}
+
+   
+// Used by multi-pass minimization to jiggle axes with noise range.
+PseudoJet AxesDefinition::jiggle(const PseudoJet& axis) const {
+   double phi_noise = ((double)rand()/(double)RAND_MAX) * _noise_range * 2.0 - _noise_range;
+   double rap_noise = ((double)rand()/(double)RAND_MAX) * _noise_range * 2.0 - _noise_range;
+   
+   double new_phi = axis.phi() + phi_noise;
+   if (new_phi >= 2.0*M_PI) new_phi -= 2.0*M_PI;
+   if (new_phi <= -2.0*M_PI) new_phi += 2.0*M_PI;
+   
+   PseudoJet newAxis(0,0,0,0);
+   newAxis.reset_PtYPhiM(axis.perp(),axis.rap() + rap_noise,new_phi);
+   return newAxis;
+}
+
+   
+LimitedWarning HardestJetAxes::_too_few_axes_warning;
+LimitedWarning ExclusiveJetAxes::_too_few_axes_warning;
+LimitedWarning ExclusiveCombinatorialJetAxes::_too_few_axes_warning;
+
+std::vector<fastjet::PseudoJet> Manual_Axes::get_starting_axes(int,
+                                                               const std::vector<fastjet::PseudoJet>&,
+                                                               const MeasureDefinition *) const {
+   // This is a function dummy and should never be called
+   assert(false);
+   std::vector<fastjet::PseudoJet> dummy;
+   return dummy;
+}
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
Index: external/fastjet/contribs/Nsubjettiness/AxesDefinition.hh
===================================================================
--- external/fastjet/contribs/Nsubjettiness/AxesDefinition.hh	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
+++ external/fastjet/contribs/Nsubjettiness/AxesDefinition.hh	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -0,0 +1,1282 @@
+//  Nsubjettiness Package
+//  Questions/Comments?  jthaler@jthaler.net
+//
+//  Copyright (c) 2011-14
+//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
+//
+//  $Id: AxesDefinition.hh 833 2015-07-23 14:35:23Z jthaler $
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#ifndef __FASTJET_CONTRIB_AXES_DEFINITION_HH__
+#define __FASTJET_CONTRIB_AXES_DEFINITION_HH__
+
+
+#include "MeasureDefinition.hh"
+#include "ExtraRecombiners.hh"
+
+#include "fastjet/PseudoJet.hh"
+#include <fastjet/LimitedWarning.hh>
+
+#include <iomanip>
+#include <cmath>
+#include <vector>
+#include <list>
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+namespace contrib {
+   
+// The following AxesDefinitions are currently available (and the relevant arguments, if needed)
+class KT_Axes;
+class CA_Axes;
+class AntiKT_Axes;         // (R0)
+class WTA_KT_Axes;
+class WTA_CA_Axes;
+class GenKT_Axes;          // (p, R0 = infinity)
+class WTA_GenKT_Axes;      // (p, R0 = infinity)
+class GenET_GenKT_Axes;    // (delta, p, R0 = infinity)
+class Manual_Axes;
+   
+class OnePass_KT_Axes;
+class OnePass_CA_Axes;
+class OnePass_AntiKT_Axes;       // (R0)
+class OnePass_WTA_KT_Axes;
+class OnePass_WTA_CA_Axes;
+class OnePass_GenKT_Axes;        // (p, R0 = infinity)
+class OnePass_WTA_GenKT_Axes;    // (p, R0 = infinity)
+class OnePass_GenET_GenKT_Axes;  // (delta, p, R0 = infinity)
+class OnePass_Manual_Axes;
+   
+class MultiPass_Axes;            // (NPass) (currently only defined for KT_Axes)
+class MultiPass_Manual_Axes;     // (NPass)
+
+class Comb_GenKT_Axes;           // (nExtra, p, R0 = infinity)
+class Comb_WTA_GenKT_Axes;       // (nExtra, p, R0 = infinity)
+class Comb_GenET_GenKT_Axes;     // (nExtra, delta, p, R0 = infinity)
+
+///////
+//
+// AxesDefinition
+//
+///////
+
+///------------------------------------------------------------------------
+/// \class AxesDefinition
+/// \brief Base class for axes definitions
+///
+/// A generic AxesDefinition first finds a set of seed axes.
+/// Then, if desired, uses measure information
+/// (from MeasureDefinition) to refine those axes starting from those seed axes.
+/// The AxesDefinitions are typically based on sequential jet algorithms.
+///------------------------------------------------------------------------
+class AxesDefinition {
+   
+public:
+   
+   /// This function should be overloaded in all derived classes, and defines how to find the seed axes.
+   /// If desired, the measure information (which might be NULL) can be used to test multiple axes choices, but should
+   /// not be used for iterative refining (since that is the job of MeasureDefinition).
+   virtual std::vector<fastjet::PseudoJet> get_starting_axes(int n_jets,
+                                                             const std::vector<fastjet::PseudoJet>& inputs,
+                                                             const MeasureDefinition * measure) const = 0;
+   
+   /// Short description of AxesDefinitions (and any parameters)
+   virtual std::string short_description() const = 0;
+
+   /// Long description of AxesDefinitions (and any parameters)
+   virtual std::string description() const = 0;
+   
+   /// This has to be defined in all derived classes, and allows these to be copied around.
+   virtual AxesDefinition* create() const = 0;
+   
+public:
+   
+   /// Starting from seeds, refine axes using one or more passes.
+   /// Note that in order to do >0 passes, we need information from the MeasureDefinition about how to do the appropriate minimization.
+   std::vector<fastjet::PseudoJet> get_refined_axes(int n_jets,
+                                                    const std::vector<fastjet::PseudoJet>& inputs,
+                                                    const std::vector<fastjet::PseudoJet>& seedAxes,
+                                                    const MeasureDefinition * measure = NULL) const {
+
+      assert(n_jets == (int)seedAxes.size()); //added int casting to get rid of compiler warning
+            
+      if (_Npass == 0) {
+         // no refining, just use seeds
+         return seedAxes;
+      } else if (_Npass == 1) {
+         if (measure == NULL) throw Error("AxesDefinition:  One-pass minimization requires specifying a MeasureDefinition.");
+         
+         // do one pass minimum using measure definition
+         return measure->get_one_pass_axes(n_jets, inputs, seedAxes,_nAttempts,_accuracy);
+      } else {
+         if (measure == NULL) throw Error("AxesDefinition:  Multi-pass minimization requires specifying a MeasureDefinition.");
+         return get_multi_pass_axes(n_jets, inputs, seedAxes, measure);
+      }
+   }
+   
+   /// Combines get_starting_axes with get_refined_axes.
+   /// In the Njettiness class, these two steps are done separately in order to store seed axes information.
+   std::vector<fastjet::PseudoJet> get_axes(int n_jets,
+                                            const std::vector<fastjet::PseudoJet>& inputs,
+                                            const MeasureDefinition * measure = NULL) const {
+      std::vector<fastjet::PseudoJet> seedAxes = get_starting_axes(n_jets, inputs, measure);
+      return get_refined_axes(n_jets,inputs,seedAxes,measure);
+   }
+
+   
+   /// Short-hand for the get_axes function.  Useful when trying to write terse code.
+   inline std::vector<fastjet::PseudoJet> operator() (int n_jets,
+                                               const std::vector<fastjet::PseudoJet>& inputs,
+                                               const MeasureDefinition * measure = NULL) const {
+      return get_axes(n_jets,inputs,measure);
+   }
+   
+   /// \enum AxesRefiningEnum
+   /// Defines the cases of zero pass and one pass for convenience
+   enum AxesRefiningEnum {
+      UNDEFINED_REFINE = -1, // added to create a default value
+      NO_REFINING = 0,
+      ONE_PASS = 1,
+      MULTI_PASS = 100,
+   };
+   
+   /// A integer that is used externally to decide how to do multi-pass minimization
+   int nPass() const { return _Npass; }
+
+   /// A flag that indicates whether results are deterministics.
+   bool givesRandomizedResults() const {
+      return (_Npass > 1);
+   }
+   
+   /// A flag that indicates whether manual axes are being used.
+   bool needsManualAxes() const {
+      return _needsManualAxes; // if there is no starting axes finder
+   }
+   
+   /// Allows user to change number of passes.  Also used internally to set nPass.
+   /// Can also specify details of one/multi pass minimziation
+   void setNPass(int nPass,
+                 int nAttempts = 1000,
+                 double accuracy  = 0.0001,
+                 double noise_range = 1.0 // only needed for MultiPass minimization
+                 )
+   {
+      _Npass = nPass;
+      _nAttempts = nAttempts;
+      _accuracy = accuracy;
+      _noise_range = noise_range;
+      if (nPass < 0) throw Error("AxesDefinition requires a nPass >= 0");
+   }
+   
+   /// Destructor
+   virtual ~AxesDefinition() {};
+   
+protected:
+   
+   /// Default constructor contains no information.  Number of passes has to be set
+   /// manually by derived classes using setNPass function.
+   AxesDefinition() : _Npass(UNDEFINED_REFINE),
+                     _nAttempts(0),
+                     _accuracy(0.0),
+                     _noise_range(0.0),
+                     _needsManualAxes(false) {}
+
+   /// Does multi-pass minimization by randomly jiggling the axes within _noise_range
+   std::vector<fastjet::PseudoJet> get_multi_pass_axes(int n_jets,
+                                                       const std::vector<fastjet::PseudoJet>& inputs,
+                                                       const std::vector<fastjet::PseudoJet>& seedAxes,
+                                                       const MeasureDefinition* measure) const;
+   
+   /// Function to jiggle axes within _noise_range
+   PseudoJet jiggle(const PseudoJet& axis) const;
+   
+   int _Npass;            ///< Number of passes (0 = no refining, 1 = one-pass, >1 multi-pass)
+   int _nAttempts;        ///< Number of attempts per pass
+   double _accuracy;      ///< Accuracy goal per pass
+   double _noise_range;   ///< Noise in rapidity/phi (for multi-pass minimization only)
+   bool _needsManualAxes; ///< Flag to indicate special case of manual axes
+};
+  
+///------------------------------------------------------------------------
+/// \class ExclusiveJetAxes
+/// \brief Base class for axes defined from exclusive jet algorithm
+///
+/// This class finds axes by clustering particles with an exclusive jet definition.
+/// This can be implemented with different jet algorithms.  The user can call this directly
+/// using their favorite fastjet::JetDefinition
+///------------------------------------------------------------------------
+class ExclusiveJetAxes : public AxesDefinition {
+   
+public:
+   /// Constructor takes JetDefinition as an argument
+   ExclusiveJetAxes(fastjet::JetDefinition def)
+   : AxesDefinition(), _def(def) {
+      setNPass(NO_REFINING);    // default to no minimization
+   }
+   
+   /// Starting axes obtained by creating a cluster sequenence and running exclusive_jets.
+   virtual std::vector<fastjet::PseudoJet> get_starting_axes(int n_jets,
+                                                             const std::vector <fastjet::PseudoJet> & inputs,
+                                                             const MeasureDefinition * ) const {
+      fastjet::ClusterSequence jet_clust_seq(inputs, _def);
+      
+      std::vector<fastjet::PseudoJet> axes = jet_clust_seq.exclusive_jets_up_to(n_jets);
+      
+      if ((int)axes.size() < n_jets) {
+         _too_few_axes_warning.warn("ExclusiveJetAxes::get_starting_axes:  Fewer than N axes found; results are unpredictable.");
+         axes.resize(n_jets);  // resize to make sure there are enough axes to not yield an error elsewhere
+      }
+      
+      return axes;
+   }
+   
+   /// Short description
+   virtual std::string short_description() const { return "ExclAxes";}
+   /// Long description
+   virtual std::string description() const { return "ExclAxes: " + _def.description();}
+   
+   /// To make it possible to copy around.
+   virtual ExclusiveJetAxes* create() const {return new ExclusiveJetAxes(*this);}
+
+private:
+   fastjet::JetDefinition _def; ///< Jet definition to use.
+   static LimitedWarning _too_few_axes_warning;
+};
+
+///------------------------------------------------------------------------
+/// \class ExclusiveCombinatorialJetAxes
+/// \brief Base class for axes defined from exclusive jet algorithm, checking combinatorial options
+///
+/// This class finds axes by clustering particles with an exclusive jet definition.
+/// It takes an extra number of jets (specificed by the user via nExtra), and then finds the set of N that minimizes N-jettiness.
+/// WARNING: If one wants to be guarenteed that results improve by increasing nExtra, then one should use
+/// winner-take-all-style recombination schemes
+///------------------------------------------------------------------------
+class ExclusiveCombinatorialJetAxes : public AxesDefinition {
+   
+public:
+   /// Constructor takes JetDefinition and nExtra as options (nExtra=0 acts the same as ExclusiveJetAxes)
+   ExclusiveCombinatorialJetAxes(fastjet::JetDefinition def, int nExtra = 0)
+   : AxesDefinition(), _def(def), _nExtra(nExtra) {
+      if (nExtra < 0) throw Error("Need nExtra >= 0");
+      setNPass(NO_REFINING);   // default to no minimization
+   }
+   
+    /// Find n_jets + _nExtra axes, and then choose the n_jets subset with the smallest N-(sub)jettiness value.
+    virtual std::vector<fastjet::PseudoJet> get_starting_axes(int n_jets, 
+                                                           const std::vector<fastjet::PseudoJet> & inputs,
+                                                           const MeasureDefinition *measure) const {
+      int starting_number = n_jets + _nExtra;
+      fastjet::ClusterSequence jet_clust_seq(inputs, _def);
+      std::vector<fastjet::PseudoJet> starting_axes = jet_clust_seq.exclusive_jets_up_to(starting_number);
+       
+       if ((int)starting_axes.size() < n_jets) {
+          _too_few_axes_warning.warn("ExclusiveCombinatorialJetAxes::get_starting_axes:  Fewer than N + nExtra axes found; results are unpredictable.");
+          starting_axes.resize(n_jets);  // resize to make sure there are enough axes to not yield an error elsewhere
+       }
+       
+      std::vector<fastjet::PseudoJet> final_axes;
+
+      // check so that no computation time is wasted if there are no extra axes
+      if (_nExtra == 0) final_axes = starting_axes;
+
+      else {
+ 
+        // define string of 1's based on number of desired jets
+        std::string bitmask(n_jets, 1);
+        // expand the array size to the total number of jets with extra 0's at the end, makes string easy to permute
+        bitmask.resize(starting_number, 0); 
+ 
+        double min_tau = std::numeric_limits<double>::max();
+        std::vector<fastjet::PseudoJet> temp_axes;
+         
+        do {
+
+          temp_axes.clear();
+ 
+          // only take an axis if it is listed as true (1) in the string
+          for (int i = 0; i < (int)starting_axes.size(); ++i) {
+            if (bitmask[i]) temp_axes.push_back(starting_axes[i]);
+          }
+ 
+          double temp_tau = measure->result(inputs, temp_axes);
+          if (temp_tau < min_tau) {
+            min_tau = temp_tau;
+            final_axes = temp_axes;
+          }
+ 
+          // permutes string of 1's and 0's according to next lexicographic ordering and returns true
+          // continues to loop through all possible lexicographic orderings
+          // returns false and breaks the loop when there are no more possible orderings
+        } while (std::prev_permutation(bitmask.begin(), bitmask.end()));
+      }
+
+      return final_axes;
+    }
+
+   /// Short description
+   virtual std::string short_description() const { return "ExclCombAxes";}
+   /// Long description
+   virtual std::string description() const { return "ExclCombAxes: " + _def.description();}
+   /// To make it possible to copy around.
+   virtual ExclusiveCombinatorialJetAxes* create() const {return new ExclusiveCombinatorialJetAxes(*this);}
+
+private:
+   fastjet::JetDefinition _def;   ///< Jet definition to use
+   int _nExtra;                   ///< Extra axes to find
+   static LimitedWarning _too_few_axes_warning;
+};
+   
+///------------------------------------------------------------------------
+/// \class HardestJetAxes
+/// \brief Base class for axes defined from an inclusive jet algorithm
+///
+/// This class finds axes by running an inclusive algorithm and then finding the n hardest jets.
+/// This can be implemented with different jet algorithms, and can be called by the user.
+///------------------------------------------------------------------------
+class HardestJetAxes : public AxesDefinition {
+public:
+   /// Constructor takes JetDefinition
+   HardestJetAxes(fastjet::JetDefinition def)
+   : AxesDefinition(), _def(def) {
+      setNPass(NO_REFINING);    // default to no minimization
+   }
+   
+   /// Finds seed axes by running a ClusterSequence, running inclusive_jets, and finding the N hardest
+   virtual std::vector<fastjet::PseudoJet> get_starting_axes(int n_jets,
+                                                             const std::vector <fastjet::PseudoJet> & inputs,
+                                                             const MeasureDefinition * ) const {
+      fastjet::ClusterSequence jet_clust_seq(inputs, _def);
+      std::vector<fastjet::PseudoJet> axes = sorted_by_pt(jet_clust_seq.inclusive_jets());
+      
+      if ((int)axes.size() < n_jets) {
+         _too_few_axes_warning.warn("HardestJetAxes::get_starting_axes:  Fewer than N axes found; results are unpredictable.");
+      }
+      
+      axes.resize(n_jets);  // only keep n hardest
+      return axes;
+   }
+   
+   /// Short description
+   virtual std::string short_description() const { return "HardAxes";}
+   /// Long description
+   virtual std::string description() const { return "HardAxes: " + _def.description();}
+   /// To make it possible to copy around.
+   virtual HardestJetAxes* create() const {return new HardestJetAxes(*this);}
+   
+private:
+   fastjet::JetDefinition _def;  ///< Jet Definition to use.
+   
+   static LimitedWarning _too_few_axes_warning;
+
+};
+   
+///------------------------------------------------------------------------
+/// \class KT_Axes
+/// \brief Axes from exclusive kT
+///
+/// Axes from kT algorithm with E_scheme recombination.
+///------------------------------------------------------------------------
+class KT_Axes : public ExclusiveJetAxes {
+public:
+   /// Constructor
+   KT_Axes()
+   : ExclusiveJetAxes(fastjet::JetDefinition(fastjet::kt_algorithm,
+                                             fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant
+                                             fastjet::E_scheme,
+                                             fastjet::Best)
+                      ) {
+      setNPass(NO_REFINING);
+   }
+
+   /// Short description
+   virtual std::string short_description() const {
+      return "KT";
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "KT Axes";
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual KT_Axes* create() const {return new KT_Axes(*this);}
+
+};
+
+///------------------------------------------------------------------------
+/// \class CA_Axes
+/// \brief Axes from exclusive CA
+///
+/// Axes from CA algorithm with E_scheme recombination.
+///------------------------------------------------------------------------
+class CA_Axes : public ExclusiveJetAxes {
+public:
+   /// Constructor
+   CA_Axes()
+   : ExclusiveJetAxes(fastjet::JetDefinition(fastjet::cambridge_algorithm,
+                                             fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant
+                                             fastjet::E_scheme,
+                                             fastjet::Best)
+                      ) {
+      setNPass(NO_REFINING);
+   }
+
+   /// Short description
+   virtual std::string short_description() const {
+      return "CA";
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "CA Axes";
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual CA_Axes* create() const {return new CA_Axes(*this);}
+   
+};
+
+   
+///------------------------------------------------------------------------
+/// \class AntiKT_Axes
+/// \brief Axes from inclusive anti-kT
+///
+/// Axes from anti-kT algorithm and E_scheme.
+/// The one parameter R0 is subjet radius
+///------------------------------------------------------------------------
+class AntiKT_Axes : public HardestJetAxes {
+
+public:
+   /// Constructor.  Takes jet radius as argument
+   AntiKT_Axes(double R0)
+   : HardestJetAxes(fastjet::JetDefinition(fastjet::antikt_algorithm,
+                                           R0,
+                                           fastjet::E_scheme,
+                                           fastjet::Best)
+                    ), _R0(R0) {
+      setNPass(NO_REFINING);
+   }
+
+   /// Short description
+   virtual std::string short_description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "AKT" << _R0;
+      return stream.str();
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "Anti-KT Axes (R0 = " << _R0 << ")";
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual AntiKT_Axes* create() const {return new AntiKT_Axes(*this);}
+   
+protected:
+   double _R0;  ///<  AKT jet radius
+
+};
+
+///------------------------------------------------------------------------
+/// \class JetDefinitionWrapper
+/// \brief Wrapper for jet definitions (for memory management)
+///
+/// This class was introduced to avoid issue of a FastJet bug when using genKT clustering
+/// Now using this for all AxesDefinition with a manual recombiner to use the delete_recombiner_when_unused function
+///------------------------------------------------------------------------
+class JetDefinitionWrapper {
+
+public: 
+   
+   /// Default Constructor
+   JetDefinitionWrapper(JetAlgorithm jet_algorithm_in, double R_in, double xtra_param_in, const JetDefinition::Recombiner *recombiner) {
+      jet_def = fastjet::JetDefinition(jet_algorithm_in, R_in, xtra_param_in);
+      jet_def.set_recombiner(recombiner);
+      jet_def.delete_recombiner_when_unused();        // added to prevent memory leaks
+   }
+
+   /// Additional constructor so that build-in FastJet algorithms can also be called
+   JetDefinitionWrapper(JetAlgorithm jet_algorithm_in, double R_in, const JetDefinition::Recombiner *recombiner, fastjet::Strategy strategy_in) {
+      jet_def = fastjet::JetDefinition(jet_algorithm_in, R_in, recombiner, strategy_in);
+      jet_def.delete_recombiner_when_unused();
+   }
+
+   /// Return jet definition
+   JetDefinition getJetDef() {
+      return jet_def;
+   }
+
+private:
+   JetDefinition jet_def;  ///< my jet definition
+};
+
+///------------------------------------------------------------------------
+/// \class WTA_KT_Axes
+/// \brief Axes from exclusive kT, winner-take-all recombination
+///
+/// Axes from kT algorithm and winner-take-all recombination
+///------------------------------------------------------------------------
+class WTA_KT_Axes : public ExclusiveJetAxes {
+public:
+   /// Constructor
+   WTA_KT_Axes()
+   : ExclusiveJetAxes(JetDefinitionWrapper(fastjet::kt_algorithm,
+                                          fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant
+                                          _recomb = new WinnerTakeAllRecombiner(), // Needs to be explicitly declared (this will be deleted by JetDefinitionWrapper)
+                                          fastjet::Best).getJetDef()
+                      ) {
+      setNPass(NO_REFINING);
+    }
+
+   /// Short description
+   virtual std::string short_description() const {
+      return "WTA KT";
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "Winner-Take-All KT Axes";
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual WTA_KT_Axes* create() const {return new WTA_KT_Axes(*this);}
+
+private:
+   const WinnerTakeAllRecombiner *_recomb;  ///< Internal recombiner
+
+};
+   
+///------------------------------------------------------------------------
+/// \class WTA_CA_Axes
+/// \brief Axes from exclusive CA, winner-take-all recombination
+///
+/// Axes from CA algorithm and winner-take-all recombination
+///------------------------------------------------------------------------
+class WTA_CA_Axes : public ExclusiveJetAxes {
+public:
+   /// Constructor
+   WTA_CA_Axes()
+   : ExclusiveJetAxes(JetDefinitionWrapper(fastjet::cambridge_algorithm,
+                                             fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant
+                                             _recomb = new WinnerTakeAllRecombiner(), // Needs to be explicitly declared (this will be deleted by JetDefinitionWrapper)
+                                             fastjet::Best).getJetDef()) {
+    setNPass(NO_REFINING);
+  }
+
+   /// Short description
+   virtual std::string short_description() const {
+      return "WTA CA";
+   };
+   
+   /// Long descriptions
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "Winner-Take-All CA Axes";
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual WTA_CA_Axes* create() const {return new WTA_CA_Axes(*this);}
+   
+private:
+   const WinnerTakeAllRecombiner *_recomb;  ///< Internal recombiner
+
+};
+
+
+///------------------------------------------------------------------------
+/// \class GenKT_Axes
+/// \brief Axes from exclusive generalized kT
+///
+/// Axes from a general KT algorithm (standard E-scheme recombination)
+/// Requires the power of the KT algorithm to be used and the radius parameter
+///------------------------------------------------------------------------
+class GenKT_Axes : public ExclusiveJetAxes {
+   
+public:
+   /// Constructor
+   GenKT_Axes(double p, double R0 = fastjet::JetDefinition::max_allowable_R)
+   : ExclusiveJetAxes(fastjet::JetDefinition(fastjet::genkt_algorithm,
+                                             R0,
+                                             p)), _p(p), _R0(R0) {
+      if (p < 0) throw Error("GenKT_Axes:  Currently only p >=0 is supported.");
+      setNPass(NO_REFINING);
+   }
+   
+   /// Short description
+   virtual std::string short_description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "GenKT Axes";
+      return stream.str();
+   };
+   
+   /// Long descriptions
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "General KT (p = " << _p << "), R0 = " << _R0;
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual GenKT_Axes* create() const {return new GenKT_Axes(*this);}
+   
+protected:
+   double _p;   ///< genkT power
+   double _R0;  ///< jet radius
+};
+   
+   
+///------------------------------------------------------------------------
+/// \class WTA_GenKT_Axes
+/// \brief Axes from exclusive generalized kT, winner-take-all recombination
+///
+/// Axes from a general KT algorithm with a Winner Take All Recombiner
+/// Requires the power of the KT algorithm to be used and the radius parameter
+///------------------------------------------------------------------------
+class WTA_GenKT_Axes : public ExclusiveJetAxes {
+
+public:
+   /// Constructor
+   WTA_GenKT_Axes(double p, double R0 = fastjet::JetDefinition::max_allowable_R)
+   : ExclusiveJetAxes(JetDefinitionWrapper(fastjet::genkt_algorithm,
+                                            R0,
+                                            p,
+                                            _recomb = new WinnerTakeAllRecombiner()
+                                            ).getJetDef()), _p(p), _R0(R0) {
+      if (p < 0) throw Error("WTA_GenKT_Axes:  Currently only p >=0 is supported.");
+      setNPass(NO_REFINING);
+   }
+
+   /// Short description
+   virtual std::string short_description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "WTA, GenKT Axes";
+      return stream.str();
+   };
+   
+   /// Long descriptions
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "Winner-Take-All General KT (p = " << _p << "), R0 = " << _R0;
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual WTA_GenKT_Axes* create() const {return new WTA_GenKT_Axes(*this);}
+   
+protected:
+   double _p;   ///< genkT power
+   double _R0;  ///< jet radius
+   const WinnerTakeAllRecombiner *_recomb; ///< Internal recombiner
+};
+   
+///------------------------------------------------------------------------
+/// \class GenET_GenKT_Axes
+/// \brief Axes from exclusive kT, generalized Et-scheme recombination
+///
+/// Class using general KT algorithm with a more general recombination scheme
+/// Requires power of KT algorithm, power of recombination weights, and radius parameter
+///------------------------------------------------------------------------
+class GenET_GenKT_Axes : public ExclusiveJetAxes {
+
+public:
+   /// Constructor
+   GenET_GenKT_Axes(double delta, double p, double R0 = fastjet::JetDefinition::max_allowable_R)
+   : ExclusiveJetAxes((JetDefinitionWrapper(fastjet::genkt_algorithm, R0, p, _recomb = new GeneralEtSchemeRecombiner(delta))).getJetDef() ),
+    _delta(delta), _p(p), _R0(R0) {
+       if (p < 0) throw Error("GenET_GenKT_Axes:  Currently only p >=0 is supported.");
+       if (delta <= 0) throw Error("GenET_GenKT_Axes:  Currently only delta >0 is supported.");
+       setNPass(NO_REFINING);
+   }
+
+   /// Short description
+   virtual std::string short_description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "GenET, GenKT Axes";
+      return stream.str();
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2);
+      // TODO: if _delta is huge, change to "WTA"
+      if (_delta < std::numeric_limits<int>::max()) stream << "General Recombiner (delta = " << _delta << "), " << "General KT (p = " << _p << ") Axes, R0 = " << _R0;
+      else stream << "Winner-Take-All General KT (p = " << _p << "), R0 = " << _R0;
+
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual GenET_GenKT_Axes* create() const {return new GenET_GenKT_Axes(*this);}
+   
+protected:
+   double _delta; ///< Recombination pT weighting
+   double _p;     ///< GenkT power
+   double _R0;    ///< jet radius
+   const GeneralEtSchemeRecombiner *_recomb;   ///< Internal recombiner
+};
+
+///------------------------------------------------------------------------
+/// \class OnePass_KT_Axes
+/// \brief Axes from exclusive kT, with one-pass minimization
+///
+/// Onepass minimization from kt axes
+///------------------------------------------------------------------------
+class OnePass_KT_Axes : public KT_Axes {
+public:
+   /// Constructor
+   OnePass_KT_Axes() : KT_Axes() {
+      setNPass(ONE_PASS);
+   }
+   
+   /// Short description
+   virtual std::string short_description() const {
+      return "OnePass KT";
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "One-Pass Minimization from KT Axes";
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual OnePass_KT_Axes* create() const {return new OnePass_KT_Axes(*this);}
+   
+
+};
+
+///------------------------------------------------------------------------
+/// \class OnePass_CA_Axes
+/// \brief Axes from exclusive CA, with one-pass minimization
+///
+/// Onepass minimization from CA axes
+///------------------------------------------------------------------------
+class OnePass_CA_Axes : public CA_Axes {
+public:
+   /// Constructor
+   OnePass_CA_Axes() : CA_Axes() {
+      setNPass(ONE_PASS);
+   }
+
+   /// Short description
+   virtual std::string short_description() const {
+      return "OnePass CA";
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "One-Pass Minimization from CA Axes";
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual OnePass_CA_Axes* create() const {return new OnePass_CA_Axes(*this);}
+
+
+};
+   
+///------------------------------------------------------------------------
+/// \class OnePass_AntiKT_Axes
+/// \brief Axes from inclusive anti-kT, with one-pass minimization
+///
+/// Onepass minimization from AntiKT axes, one parameter R0
+///------------------------------------------------------------------------
+class OnePass_AntiKT_Axes : public AntiKT_Axes {
+
+public:
+   /// Constructor
+   OnePass_AntiKT_Axes(double R0) : AntiKT_Axes(R0) {
+      setNPass(ONE_PASS);
+   }
+   
+   /// Short Description
+   virtual std::string short_description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "OnePassAKT" << _R0;
+      return stream.str();
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "One-Pass Minimization from Anti-KT Axes (R0 = " << _R0 << ")";
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual OnePass_AntiKT_Axes* create() const {return new OnePass_AntiKT_Axes(*this);}
+
+};
+
+///------------------------------------------------------------------------
+/// \class OnePass_WTA_KT_Axes
+/// \brief Axes from exclusive kT, winner-take-all recombination, with one-pass minimization
+///
+/// Onepass minimization from winner-take-all kt axes
+///------------------------------------------------------------------------
+class OnePass_WTA_KT_Axes : public WTA_KT_Axes {
+public:
+   /// Constructor
+   OnePass_WTA_KT_Axes() : WTA_KT_Axes() {
+      setNPass(ONE_PASS);
+   }
+   
+   /// Short description
+   virtual std::string short_description() const {
+      return "OnePass WTA KT";
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "One-Pass Minimization from Winner-Take-All KT Axes";
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual OnePass_WTA_KT_Axes* create() const {return new OnePass_WTA_KT_Axes(*this);}
+   
+
+};
+
+///------------------------------------------------------------------------
+/// \class OnePass_WTA_CA_Axes
+/// \brief Axes from exclusive CA, winner-take-all recombination, with one-pass minimization
+///
+/// Onepass minimization from winner-take-all CA axes
+///------------------------------------------------------------------------
+class OnePass_WTA_CA_Axes : public WTA_CA_Axes {
+   
+public:
+   /// Constructor
+   OnePass_WTA_CA_Axes() : WTA_CA_Axes() {
+      setNPass(ONE_PASS);
+   }
+
+   /// Short description
+   virtual std::string short_description() const {
+      return "OnePass WTA CA";
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "One-Pass Minimization from Winner-Take-All CA Axes";
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual OnePass_WTA_CA_Axes* create() const {return new OnePass_WTA_CA_Axes(*this);}
+   
+};
+
+///------------------------------------------------------------------------
+/// \class OnePass_GenKT_Axes
+/// \brief Axes from exclusive generalized kT with one-pass minimization
+///
+/// Onepass minimization, General KT Axes (standard E-scheme recombination)
+///------------------------------------------------------------------------
+class OnePass_GenKT_Axes : public GenKT_Axes {
+   
+public:
+   /// Constructor
+   OnePass_GenKT_Axes(double p, double R0 = fastjet::JetDefinition::max_allowable_R) : GenKT_Axes(p, R0) {
+      setNPass(ONE_PASS);
+   }
+   
+   /// Short description
+   virtual std::string short_description() const {
+      return "OnePass GenKT";
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "One-Pass Minimization from General KT (p = " << _p << "), R0 = " << _R0;
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual OnePass_GenKT_Axes* create() const {return new OnePass_GenKT_Axes(*this);}
+};
+   
+///------------------------------------------------------------------------
+/// \class OnePass_WTA_GenKT_Axes
+/// \brief Axes from exclusive generalized kT, winner-take-all recombination, with one-pass minimization
+///
+/// Onepass minimization from winner-take-all, General KT Axes
+///------------------------------------------------------------------------
+class OnePass_WTA_GenKT_Axes : public WTA_GenKT_Axes {
+   
+public:
+   /// Constructor
+   OnePass_WTA_GenKT_Axes(double p, double R0 = fastjet::JetDefinition::max_allowable_R) : WTA_GenKT_Axes(p, R0) {
+      setNPass(ONE_PASS);
+   }
+
+   /// Short description
+   virtual std::string short_description() const {
+      return "OnePass WTA GenKT";
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "One-Pass Minimization from Winner-Take-All General KT (p = " << _p << "), R0 = " << _R0;
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual OnePass_WTA_GenKT_Axes* create() const {return new OnePass_WTA_GenKT_Axes(*this);}
+};
+
+///------------------------------------------------------------------------
+/// \class OnePass_GenET_GenKT_Axes
+/// \brief Axes from exclusive generalized kT, generalized Et-scheme recombination, with one-pass minimization
+///
+/// Onepass minimization from General Recomb, General KT axes
+///------------------------------------------------------------------------
+class OnePass_GenET_GenKT_Axes : public GenET_GenKT_Axes {
+   
+public:
+   /// Constructor
+   OnePass_GenET_GenKT_Axes(double delta, double p, double R0 = fastjet::JetDefinition::max_allowable_R) : GenET_GenKT_Axes(delta, p, R0) {
+      setNPass(ONE_PASS);
+   }
+
+   /// Short description
+   virtual std::string short_description() const {
+      return "OnePass GenET, GenKT";
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2);
+      if (_delta < std::numeric_limits<int>::max()) stream << "One-Pass Minimization from General Recombiner (delta = " 
+        << _delta << "), " << "General KT (p = " << _p << ") Axes, R0 = " << _R0;
+      else stream << "One-Pass Minimization from Winner-Take-All General KT (p = " << _p << "), R0 = " << _R0;
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual OnePass_GenET_GenKT_Axes* create() const {return new OnePass_GenET_GenKT_Axes(*this);}
+};
+
+
+///------------------------------------------------------------------------
+/// \class Manual_Axes
+/// \brief Manual axes finding
+///
+/// Allows the user to set the axes manually
+///------------------------------------------------------------------------
+class Manual_Axes : public AxesDefinition {
+public:
+   /// Constructor.  Note that _needsManualAxes is set to true.
+   Manual_Axes() : AxesDefinition() {
+      setNPass(NO_REFINING);
+      _needsManualAxes = true;
+   }
+   
+   /// This is now a dummy function since this is manual mode
+   virtual std::vector<fastjet::PseudoJet> get_starting_axes(int,
+                                                             const std::vector<fastjet::PseudoJet>&,
+                                                             const MeasureDefinition *) const;
+
+   
+   /// Short description
+   virtual std::string short_description() const {
+      return "Manual";
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "Manual Axes";
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual Manual_Axes* create() const {return new Manual_Axes(*this);}
+
+
+};
+
+///------------------------------------------------------------------------
+/// \class OnePass_Manual_Axes
+/// \brief Manual axes finding, with one-pass minimization
+///
+/// One pass minimization from manual starting point
+///------------------------------------------------------------------------
+class OnePass_Manual_Axes : public Manual_Axes {
+public:
+   /// Constructor.  Note that _needsManualAxes is set to true.
+   OnePass_Manual_Axes() : Manual_Axes() {
+      setNPass(ONE_PASS);
+   }
+   
+   /// Short description
+   virtual std::string short_description() const {
+      return "OnePass Manual";
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "One-Pass Minimization from Manual Axes";
+      return stream.str();
+   };
+   
+   // For copying purposes
+   virtual OnePass_Manual_Axes* create() const {return new OnePass_Manual_Axes(*this);}
+
+};
+   
+///------------------------------------------------------------------------
+/// \class MultiPass_Axes
+/// \brief Manual axes finding, with multi-pass (randomized) minimization
+///
+/// Multi-pass minimization from kT starting point
+///------------------------------------------------------------------------
+class MultiPass_Axes : public KT_Axes {
+
+public:
+   
+   /// Constructor
+   MultiPass_Axes(unsigned int Npass) : KT_Axes() {
+      setNPass(Npass);
+   }
+
+   /// Short description
+   virtual std::string short_description() const {
+      return "MultiPass";
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "Multi-Pass Axes (Npass = " << _Npass << ")";
+      return stream.str();
+   };
+   
+   /// For copying purposs
+   virtual MultiPass_Axes* create() const {return new MultiPass_Axes(*this);}
+   
+};
+
+///------------------------------------------------------------------------
+/// \class MultiPass_Manual_Axes
+/// \brief Axes finding from exclusive kT, with multi-pass (randomized) minimization
+///
+/// multi-pass minimization from kT starting point
+///------------------------------------------------------------------------
+class MultiPass_Manual_Axes : public Manual_Axes {
+
+public:
+   /// Constructor
+   MultiPass_Manual_Axes(unsigned int Npass) : Manual_Axes() {
+      setNPass(Npass);
+   }
+
+   /// Short Description
+   virtual std::string short_description() const {
+      return "MultiPass Manual";
+   };
+   
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "Multi-Pass Manual Axes (Npass = " << _Npass << ")";
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual MultiPass_Manual_Axes* create() const {return new MultiPass_Manual_Axes(*this);}
+   
+};
+
+///------------------------------------------------------------------------
+/// \class Comb_GenKT_Axes
+/// \brief Axes from exclusive generalized kT with combinatorial testing
+///
+/// Axes from kT algorithm (standard E-scheme recombination)
+/// Requires nExtra parameter and returns set of N that minimizes N-jettiness
+/// Note that this method is not guaranteed to find a deeper minimum than GenKT_Axes
+///------------------------------------------------------------------------
+class Comb_GenKT_Axes : public ExclusiveCombinatorialJetAxes {
+public:
+   /// Constructor
+   Comb_GenKT_Axes(int nExtra, double p, double R0 = fastjet::JetDefinition::max_allowable_R)
+   : ExclusiveCombinatorialJetAxes(fastjet::JetDefinition(fastjet::genkt_algorithm, R0, p), nExtra),
+      _p(p), _R0(R0) {
+      if (p < 0) throw Error("Comb_GenKT_Axes:  Currently only p >=0 is supported.");
+      setNPass(NO_REFINING);
+   }
+   
+   /// Short description
+   virtual std::string short_description() const {
+      return "N Choose M GenKT";
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "N Choose M Minimization (nExtra = " << _nExtra << ") from General KT (p = " << _p << "), R0 = " << _R0;
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual Comb_GenKT_Axes* create() const {return new Comb_GenKT_Axes(*this);}
+   
+private:
+   double _nExtra;   ///< Number of extra axes
+   double _p;        ///< GenkT power
+   double _R0;       ///< jet radius
+};
+   
+   
+
+///------------------------------------------------------------------------
+/// \class Comb_WTA_GenKT_Axes
+/// \brief Axes from exclusive generalized kT, winner-take-all recombination, with combinatorial testing
+///
+/// Axes from kT algorithm and winner-take-all recombination
+/// Requires nExtra parameter and returns set of N that minimizes N-jettiness
+///------------------------------------------------------------------------
+class Comb_WTA_GenKT_Axes : public ExclusiveCombinatorialJetAxes {
+public:
+   /// Constructor
+   Comb_WTA_GenKT_Axes(int nExtra, double p, double R0 = fastjet::JetDefinition::max_allowable_R)
+   : ExclusiveCombinatorialJetAxes((JetDefinitionWrapper(fastjet::genkt_algorithm, R0, p, _recomb = new WinnerTakeAllRecombiner())).getJetDef(), nExtra),
+    _p(p), _R0(R0) {
+       if (p < 0) throw Error("Comb_WTA_GenKT_Axes:  Currently only p >=0 is supported.");
+       setNPass(NO_REFINING);
+    }
+
+   /// Short description
+   virtual std::string short_description() const {
+      return "N Choose M WTA GenKT";
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2)
+      << "N Choose M Minimization (nExtra = " << _nExtra << ") from Winner-Take-All General KT (p = " << _p << "), R0 = " << _R0;
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual Comb_WTA_GenKT_Axes* create() const {return new Comb_WTA_GenKT_Axes(*this);}
+
+private:
+   double _nExtra;   ///< Number of extra axes
+   double _p;        ///< GenkT power
+   double _R0;       ///< jet radius
+   const WinnerTakeAllRecombiner *_recomb;   ///< Internal recombiner
+};
+   
+///------------------------------------------------------------------------
+/// \class Comb_GenET_GenKT_Axes
+/// \brief Axes from exclusive generalized kT, generalized Et-scheme recombination, with combinatorial testing
+///
+/// Axes from kT algorithm and General Et scheme recombination
+/// Requires nExtra parameter and returns set of N that minimizes N-jettiness
+///------------------------------------------------------------------------
+class Comb_GenET_GenKT_Axes : public ExclusiveCombinatorialJetAxes {
+public:
+   /// Constructor
+   Comb_GenET_GenKT_Axes(int nExtra, double delta, double p, double R0 = fastjet::JetDefinition::max_allowable_R)
+   : ExclusiveCombinatorialJetAxes((JetDefinitionWrapper(fastjet::genkt_algorithm, R0, p, _recomb = new GeneralEtSchemeRecombiner(delta))).getJetDef(), nExtra),
+    _delta(delta), _p(p), _R0(R0) {
+       if (p < 0) throw Error("Comb_GenET_GenKT_Axes:  Currently only p >=0 is supported.");
+       if (delta <= 0) throw Error("Comb_GenET_GenKT_Axes:  Currently only delta >=0 is supported.");
+        setNPass(NO_REFINING);
+    }
+
+   /// Short description
+   virtual std::string short_description() const {
+      return "N Choose M GenET GenKT";
+   };
+   
+   /// Long description
+   virtual std::string description() const {
+      std::stringstream stream;
+      stream << std::fixed << std::setprecision(2);
+      if (_delta < std::numeric_limits<int>::max()) stream << "N choose M Minimization (nExtra = " << _nExtra 
+        << ") from General Recombiner (delta = " << _delta << "), " << "General KT (p = " << _p << ") Axes, R0 = " << _R0;
+      else stream << "N choose M Minimization (nExtra = " << _nExtra << ") from Winner-Take-All General KT (p = " << _p << "), R0 = " << _R0;
+      return stream.str();
+   };
+   
+   /// For copying purposes
+   virtual Comb_GenET_GenKT_Axes* create() const {return new Comb_GenET_GenKT_Axes(*this);}
+
+private:
+   double _nExtra;   ///< Number of extra axes
+   double _delta;    ///< Recombination pT weighting exponent
+   double _p;        ///< GenkT power
+   double _R0;       ///< jet radius
+   const GeneralEtSchemeRecombiner *_recomb;  ///<  Internal recombiner
+};
+   
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
+
+#endif  // __FASTJET_CONTRIB_NJETTINESS_HH__
+
Index: external/fastjet/contribs/Nsubjettiness/AxesFinder.cc
===================================================================
--- external/fastjet/contribs/Nsubjettiness/AxesFinder.cc	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ 	(revision )
@@ -1,307 +1,0 @@
-//  Nsubjettiness Package
-//  Questions/Comments?  jthaler@jthaler.net
-//
-//  Copyright (c) 2011-14
-//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
-//
-//  $Id: AxesFinder.cc 670 2014-06-06 01:24:42Z jthaler $
-//----------------------------------------------------------------------
-// This file is part of FastJet contrib.
-//
-// It is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2 of the License, or (at
-// your option) any later version.
-//
-// It is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
-// License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this code. If not, see <http://www.gnu.org/licenses/>.
-//----------------------------------------------------------------------
-
-#include "AxesFinder.hh"
-
-FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
-
-namespace contrib{
-
-///////
-//
-// Functions for minimization.
-//
-///////
-
-// Given starting axes, update to find better axes by using Kmeans clustering around the old axes
-template <int N>
-std::vector<LightLikeAxis> AxesFinderFromOnePassMinimization::UpdateAxesFast(const std::vector <LightLikeAxis> & old_axes, 
-                                  const std::vector <fastjet::PseudoJet> & inputJets) const {
-   assert(old_axes.size() == N);
-   
-   // some storage, declared static to save allocation/re-allocation costs
-   static LightLikeAxis new_axes[N];
-   static fastjet::PseudoJet new_jets[N];
-   for (int n = 0; n < N; ++n) {
-      new_axes[n].reset(0.0,0.0,0.0,0.0);
-      new_jets[n].reset_momentum(0.0,0.0,0.0,0.0);
-   }
-
-   double precision = _precision;
-   
-   /////////////// Assignment Step //////////////////////////////////////////////////////////
-   std::vector<int> assignment_index(inputJets.size()); 
-   int k_assign = -1;
-   
-   for (unsigned i = 0; i < inputJets.size(); i++){
-      double smallestDist = std::numeric_limits<double>::max();  //large number
-      for (int k = 0; k < N; k++) {
-         double thisDist = old_axes[k].DistanceSq(inputJets[i]);
-         if (thisDist < smallestDist) {
-            smallestDist = thisDist;
-            k_assign = k;
-         }
-      }
-      if (smallestDist > sq(_Rcutoff)) {k_assign = -1;}
-      assignment_index[i] = k_assign;
-   }
-   
-   //////////////// Update Step /////////////////////////////////////////////////////////////
-   double distPhi, old_dist;
-   for (unsigned i = 0; i < inputJets.size(); i++) {
-      int old_jet_i = assignment_index[i];
-      if (old_jet_i == -1) {continue;}
-
-      const fastjet::PseudoJet& inputJet_i = inputJets[i];
-      LightLikeAxis& new_axis_i = new_axes[old_jet_i];
-      double inputPhi_i = inputJet_i.phi();
-      double inputRap_i = inputJet_i.rap();
-            
-      // optimize pow() call
-      // add noise (the precision term) to make sure we don't divide by zero
-      if (_beta == 1.0) {
-         double DR = std::sqrt(sq(precision) + old_axes[old_jet_i].DistanceSq(inputJet_i));
-         old_dist = 1.0/DR;
-      } else if (_beta == 2.0) {
-         old_dist = 1.0;
-      } else if (_beta == 0.0) {
-         double DRSq = sq(precision) + old_axes[old_jet_i].DistanceSq(inputJet_i);
-         old_dist = 1.0/DRSq;
-      } else {
-         old_dist = sq(precision) + old_axes[old_jet_i].DistanceSq(inputJet_i);
-         old_dist = std::pow(old_dist, (0.5*_beta-1.0));
-      }
-      
-      // TODO:  Put some of these addition functions into light-like axes
-      // rapidity sum
-      new_axis_i.set_rap(new_axis_i.rap() + inputJet_i.perp() * inputRap_i * old_dist);
-      // phi sum
-      distPhi = inputPhi_i - old_axes[old_jet_i].phi();
-      if (fabs(distPhi) <= M_PI){
-         new_axis_i.set_phi( new_axis_i.phi() + inputJet_i.perp() * inputPhi_i * old_dist );
-      } else if (distPhi > M_PI) {
-         new_axis_i.set_phi( new_axis_i.phi() + inputJet_i.perp() * (-2*M_PI + inputPhi_i) * old_dist );
-      } else if (distPhi < -M_PI) {
-         new_axis_i.set_phi( new_axis_i.phi() + inputJet_i.perp() * (+2*M_PI + inputPhi_i) * old_dist );
-      }
-      // weights sum
-      new_axis_i.set_weight( new_axis_i.weight() + inputJet_i.perp() * old_dist );
-      // momentum magnitude sum
-      new_jets[old_jet_i] += inputJet_i;
-   }
-   // normalize sums
-   for (int k = 0; k < N; k++) {
-      if (new_axes[k].weight() == 0) {
-         // no particles were closest to this axis!  Return to old axis instead of (0,0,0,0)
-         new_axes[k] = old_axes[k];
-      } else {
-         new_axes[k].set_rap( new_axes[k].rap() / new_axes[k].weight() );
-         new_axes[k].set_phi( new_axes[k].phi() / new_axes[k].weight() );
-         new_axes[k].set_phi( std::fmod(new_axes[k].phi() + 2*M_PI, 2*M_PI) );
-         new_axes[k].set_mom( std::sqrt(new_jets[k].modp2()) );
-      }
-   }
-   std::vector<LightLikeAxis> new_axes_vec(N);
-   for (unsigned k = 0; k < N; ++k) new_axes_vec[k] = new_axes[k];
-   return new_axes_vec;
-}
-
-// Given N starting axes, this function updates all axes to find N better axes. 
-// (This is just a wrapper for the templated version above.)
-std::vector<LightLikeAxis> AxesFinderFromOnePassMinimization::UpdateAxes(const std::vector <LightLikeAxis> & old_axes,
-                                      const std::vector <fastjet::PseudoJet> & inputJets) const {
-   int N = old_axes.size();
-   switch (N) {
-      case 1: return UpdateAxesFast<1>(old_axes, inputJets);
-      case 2: return UpdateAxesFast<2>(old_axes, inputJets);
-      case 3: return UpdateAxesFast<3>(old_axes, inputJets);
-      case 4: return UpdateAxesFast<4>(old_axes, inputJets);
-      case 5: return UpdateAxesFast<5>(old_axes, inputJets);
-      case 6: return UpdateAxesFast<6>(old_axes, inputJets);
-      case 7: return UpdateAxesFast<7>(old_axes, inputJets);
-      case 8: return UpdateAxesFast<8>(old_axes, inputJets);
-      case 9: return UpdateAxesFast<9>(old_axes, inputJets);
-      case 10: return UpdateAxesFast<10>(old_axes, inputJets);
-      case 11: return UpdateAxesFast<11>(old_axes, inputJets);
-      case 12: return UpdateAxesFast<12>(old_axes, inputJets);
-      case 13: return UpdateAxesFast<13>(old_axes, inputJets);
-      case 14: return UpdateAxesFast<14>(old_axes, inputJets);
-      case 15: return UpdateAxesFast<15>(old_axes, inputJets);
-      case 16: return UpdateAxesFast<16>(old_axes, inputJets);
-      case 17: return UpdateAxesFast<17>(old_axes, inputJets);
-      case 18: return UpdateAxesFast<18>(old_axes, inputJets);
-      case 19: return UpdateAxesFast<19>(old_axes, inputJets);
-      case 20: return UpdateAxesFast<20>(old_axes, inputJets);
-      default: std::cout << "N-jettiness is hard-coded to only allow up to 20 jets!" << std::endl;
-         return std::vector<LightLikeAxis>();
-   }
-
-}
-
-// uses minimization of N-jettiness to continually update axes until convergence.
-// The function returns the axes found at the (local) minimum
-std::vector<fastjet::PseudoJet> AxesFinderFromOnePassMinimization::getAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputJets, const std::vector<fastjet::PseudoJet>& seedAxes) const {
-	  
-   // convert from PseudoJets to LightLikeAxes
-   std::vector< LightLikeAxis > old_axes(n_jets, LightLikeAxis(0,0,0,0));
-   for (int k = 0; k < n_jets; k++) {
-      old_axes[k].set_rap( seedAxes[k].rap() );
-      old_axes[k].set_phi( seedAxes[k].phi() );
-   }
-   
-   // Find new axes by iterating (only one pass here)
-   std::vector< LightLikeAxis > new_axes(n_jets, LightLikeAxis(0,0,0,0));
-   double cmp = std::numeric_limits<double>::max();  //large number
-   int h = 0;
-   while (cmp > _precision && h < _halt) { // Keep updating axes until near-convergence or too many update steps
-      cmp = 0.0;
-      h++;
-      new_axes = UpdateAxes(old_axes, inputJets); // Update axes
-      for (int k = 0; k < n_jets; k++) {
-         cmp += old_axes[k].Distance(new_axes[k]);
-      }
-      cmp = cmp / ((double) n_jets);
-      old_axes = new_axes;
-   }
-      
-   // Convert from internal LightLikeAxes to PseudoJet
-   std::vector<fastjet::PseudoJet> outputAxes;
-   for (int k = 0; k < n_jets; k++) {
-      fastjet::PseudoJet temp = old_axes[k].ConvertToPseudoJet();
-      outputAxes.push_back(temp);
-   }
-   
-   // this is used to debug the minimization routine to make sure that it works.
-   bool do_debug = false;
-   if (do_debug) {
-      // get this information to make sure that minimization is working properly
-      TauComponents seed_tau_components = _measureFunction.result(inputJets, seedAxes);
-      double seed_tau = seed_tau_components.tau();
-      TauComponents tau_components = _measureFunction.result(inputJets, outputAxes);
-      double outputTau = tau_components.tau();
-      assert(outputTau <= seed_tau);
-   }
-   
-   return outputAxes;
-}
-
-PseudoJet AxesFinderFromKmeansMinimization::jiggle(const PseudoJet& axis) const {
-   double phi_noise = ((double)rand()/(double)RAND_MAX) * _noise_range * 2.0 - _noise_range;
-   double rap_noise = ((double)rand()/(double)RAND_MAX) * _noise_range * 2.0 - _noise_range;
-   
-   double new_phi = axis.phi() + phi_noise;
-   if (new_phi >= 2.0*M_PI) new_phi -= 2.0*M_PI;
-   if (new_phi <= -2.0*M_PI) new_phi += 2.0*M_PI;
-
-   PseudoJet newAxis(0,0,0,0);
-   newAxis.reset_PtYPhiM(axis.perp(),axis.rap() + rap_noise,new_phi);
-   return newAxis;
-}
-   
-   
-// Repeatedly calls the one pass finder to try to find global minimum
-std::vector<fastjet::PseudoJet> AxesFinderFromKmeansMinimization::getAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputJets, const std::vector<fastjet::PseudoJet>& seedAxes) const {
-   
-   // first iteration
-	std::vector<fastjet::PseudoJet> bestAxes = _onePassFinder.getAxes(n_jets, inputJets, seedAxes);
-   
-   double bestTau = (_measureFunction.result(inputJets,bestAxes)).tau();
-   
-   for (int l = 1; l < _n_iterations; l++) { // Do minimization procedure multiple times (l = 1 to start since first iteration is done already)
-   
-      // Add noise to current best axes
-      std::vector< PseudoJet > noiseAxes(n_jets, PseudoJet(0,0,0,0));
-      for (int k = 0; k < n_jets; k++) {
-         noiseAxes[k] = jiggle(bestAxes[k]);
-      }
-
-      std::vector<fastjet::PseudoJet> testAxes = _onePassFinder.getAxes(n_jets, inputJets, noiseAxes);
-      double testTau = (_measureFunction.result(inputJets,testAxes)).tau();
-      
-      if (testTau < bestTau) {
-         bestTau = testTau;
-         bestAxes = testAxes;
-      }
-   }
-   
-   return bestAxes;
-}
-
-// Uses minimization of the geometric distance in order to find the minimum axes.
-// It continually updates until it reaches convergence or it reaches the maximum number of attempts.
-// This is essentially the same as a stable cone finder.
-std::vector<fastjet::PseudoJet> AxesFinderFromGeometricMinimization::getAxes(int /*n_jets*/, const std::vector <fastjet::PseudoJet> & particles, const std::vector<fastjet::PseudoJet>& currentAxes) const {
-
-   std::vector<fastjet::PseudoJet> seedAxes = currentAxes;
-   double seedTau = _function.tau(particles, seedAxes);
-   
-   for (int i = 0; i < _nAttempts; i++) {
-      
-      std::vector<fastjet::PseudoJet> newAxes(seedAxes.size(),fastjet::PseudoJet(0,0,0,0));
-      
-      // find closest axis and assign to that
-      for (unsigned int i = 0; i < particles.size(); i++) {
-         
-         // start from unclustered beam measure
-         int minJ = -1;
-         double minDist = _function.beam_distance_squared(particles[i]);
-         
-         // which axis am I closest to?
-         for (unsigned int j = 0; j < seedAxes.size(); j++) {
-            double tempDist = _function.jet_distance_squared(particles[i],seedAxes[j]);
-            if (tempDist < minDist) {
-               minDist = tempDist;
-               minJ = j;
-            }
-         }
-         
-         // if not unclustered, then cluster
-         if (minJ != -1) newAxes[minJ] += particles[i];
-      }
-      
-      // calculate tau on new axes
-      seedAxes = newAxes;
-      double tempTau = _function.tau(particles, newAxes);
-      
-      // close enough to stop?
-      if (fabs(tempTau - seedTau) < _accuracy) break;
-      seedTau = tempTau;
-   }
-   
-   return seedAxes;
-}
-
-// Go from internal LightLikeAxis to PseudoJet
-fastjet::PseudoJet LightLikeAxis::ConvertToPseudoJet() {
-    double px, py, pz, E;
-    E = _mom;
-    pz = (std::exp(2.0*_rap) - 1.0) / (std::exp(2.0*_rap) + 1.0) * E;
-    px = std::cos(_phi) * std::sqrt( std::pow(E,2) - std::pow(pz,2) );
-    py = std::sin(_phi) * std::sqrt( std::pow(E,2) - std::pow(pz,2) );
-    return fastjet::PseudoJet(px,py,pz,E);
-}
-
-} //namespace contrib
-
-FASTJET_END_NAMESPACE
Index: external/fastjet/contribs/Nsubjettiness/AxesFinder.hh
===================================================================
--- external/fastjet/contribs/Nsubjettiness/AxesFinder.hh	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ 	(revision )
@@ -1,369 +1,0 @@
-//  Nsubjettiness Package
-//  Questions/Comments?  jthaler@jthaler.net
-//
-//  Copyright (c) 2011-14
-//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
-//
-//  $Id: AxesFinder.hh 678 2014-06-12 20:43:03Z jthaler $
-//----------------------------------------------------------------------
-// This file is part of FastJet contrib.
-//
-// It is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2 of the License, or (at
-// your option) any later version.
-//
-// It is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
-// License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this code. If not, see <http://www.gnu.org/licenses/>.
-//----------------------------------------------------------------------
-
-
-#ifndef __FASTJET_CONTRIB_AXESFINDER_HH__
-#define __FASTJET_CONTRIB_AXESFINDER_HH__
-
-#include "WinnerTakeAllRecombiner.hh"
-#include "MeasureFunction.hh"
-
-#include "fastjet/PseudoJet.hh"
-#include "fastjet/ClusterSequence.hh"
-#include "fastjet/JetDefinition.hh"
-
-#include <cmath>
-#include <vector>
-#include <list>
-
-FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
-
-namespace contrib{
-
-///////
-//
-// Axes Finder Options
-//
-///////
-
-//------------------------------------------------------------------------
-/// \class AxesFinder
-// This is the base class for all axes finders. These axes are used along with the MeasureFunctions to calculate 
-// tau_N. There are different implementations of axes finding that are defined in derived classes below.
-class AxesFinder {
-   
-public:
-   
-   // This function should be overloaded, and updates the seedAxes to return new axes
-   virtual std::vector<fastjet::PseudoJet> getAxes(int n_jets,
-                                                   const std::vector<fastjet::PseudoJet>& inputs,
-                                                   const std::vector<fastjet::PseudoJet>& seedAxes) const = 0;
-   // convenient shorthand for squaring
-   static inline double sq(double x) {return x*x;}
-
-   //virtual destructor
-   virtual ~AxesFinder(){}
-   
-};
-
-   
-//------------------------------------------------------------------------
-/// \class AxesFinderFromExclusiveJetDefinition
-// This class finds axes by clustering the particles and then finding the exclusive jets. This can be implemented
-// with different jet algorithms.
-class AxesFinderFromExclusiveJetDefinition : public AxesFinder {
-   
-public:
-   AxesFinderFromExclusiveJetDefinition(fastjet::JetDefinition def)
-   : _def(def) {}
-   
-   virtual std::vector<fastjet::PseudoJet> getAxes(int n_jets,
-                                                   const std::vector <fastjet::PseudoJet> & inputs,
-                                                   const std::vector<fastjet::PseudoJet>& /*seedAxes*/) const {
-      fastjet::ClusterSequence jet_clust_seq(inputs, _def);
-      return jet_clust_seq.exclusive_jets(n_jets);
-   }
-   
-private:
-   fastjet::JetDefinition _def;
-
-};
-
-//------------------------------------------------------------------------
-/// \class AxesFinderFromWTA_KT
-// This class finds axes by finding the exlusive jets after clustering according to a kT algorithm and a 
-// winner take all recombination scheme.
-class AxesFinderFromWTA_KT : public AxesFinderFromExclusiveJetDefinition { 
-
-public:
-   AxesFinderFromWTA_KT()
-   : AxesFinderFromExclusiveJetDefinition(
-      fastjet::JetDefinition(fastjet::kt_algorithm,
-      fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant
-      &_recomb,
-      fastjet::Best)) {}
-   
-private:
-   const WinnerTakeAllRecombiner _recomb;
-
-};
-   
-//------------------------------------------------------------------------
-/// \class AxesFinderFromWTA_CA
-// This class finds axes by finding the exlusive jets after clustering according to a CA algorithm and a 
-// winner take all recombination scheme.
-class AxesFinderFromWTA_CA : public AxesFinderFromExclusiveJetDefinition {
-public:
-   AxesFinderFromWTA_CA()
-   : AxesFinderFromExclusiveJetDefinition(
-      fastjet::JetDefinition(fastjet::cambridge_algorithm, 
-      fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant
-      &_recomb,
-      fastjet::Best)) {}
-   
-private:
-   const WinnerTakeAllRecombiner _recomb;
-};
-
-
-//------------------------------------------------------------------------
-/// \class AxesFinderFromKT
-// This class finds axes by finding the exlusive jets after clustering according to a kT algorithm and a 
-// E_scheme recombination.
-class AxesFinderFromKT : public AxesFinderFromExclusiveJetDefinition {
-public:
-   AxesFinderFromKT()
-   : AxesFinderFromExclusiveJetDefinition(
-      fastjet::JetDefinition(fastjet::kt_algorithm,
-      fastjet::JetDefinition::max_allowable_R, //maximum jet radius constant
-      fastjet::E_scheme,
-      fastjet::Best)) {}
-};
-
-//------------------------------------------------------------------------
-/// \class AxesFinderFromCA
-// This class finds axes by finding the exlusive jets after clustering according to a CA algorithm and a 
-// E_scheme recombination.
-class AxesFinderFromCA : public AxesFinderFromExclusiveJetDefinition { 
-public:
-   AxesFinderFromCA()
-   : AxesFinderFromExclusiveJetDefinition(
-      fastjet::JetDefinition(fastjet::cambridge_algorithm,
-                             fastjet::JetDefinition::max_allowable_R,  //maximum jet radius constant
-      fastjet::E_scheme,
-      fastjet::Best)) {}
-};
-
-
-//------------------------------------------------------------------------
-/// \class AxesFinderFromHardestJetDefinition
-// This class finds axes by clustering the particles and then finding the n hardest inclusive jets. 
-// This can be implemented with different jet algorithms.
-class AxesFinderFromHardestJetDefinition : public AxesFinder {
-public:
-   AxesFinderFromHardestJetDefinition(fastjet::JetDefinition def)
-   : _def(def) {}
-   
-   virtual std::vector<fastjet::PseudoJet> getAxes(int n_jets,
-                                                   const std::vector <fastjet::PseudoJet> & inputs,
-                                                   const std::vector<fastjet::PseudoJet>& /*seedAxes*/) const {
-      fastjet::ClusterSequence jet_clust_seq(inputs, _def);
-      std::vector<fastjet::PseudoJet> myJets = sorted_by_pt(jet_clust_seq.inclusive_jets());
-      myJets.resize(n_jets);  // only keep n hardest
-      return myJets;
-   }
-   
-private:
-   fastjet::JetDefinition _def;
-};
-
-//------------------------------------------------------------------------
-/// \class AxesFinderFromAntiKT
-// This class finds axes by finding the n hardest jets after clustering the particles according 
-// to an anti kT algorithm and E_scheme.
-class AxesFinderFromAntiKT : public AxesFinderFromHardestJetDefinition {
-public:
-   AxesFinderFromAntiKT(double R0)
-   : AxesFinderFromHardestJetDefinition(
-      fastjet::JetDefinition(fastjet::antikt_algorithm,
-                             R0,fastjet::E_scheme,fastjet::Best)) {}
-};
-
-
-//------------------------------------------------------------------------
-/// \class AxesFinderFromUserInput
-// This class allows the user to manually define the axes.
-class AxesFinderFromUserInput : public AxesFinder {
-
-public:
-   AxesFinderFromUserInput() {}
-   
-   virtual std::vector<fastjet::PseudoJet> getAxes(int n_jets, const std::vector <fastjet::PseudoJet> & /*inputs*/, const std::vector<fastjet::PseudoJet>& currentAxes) const {
-      assert(currentAxes.size() == (unsigned int) n_jets);
-      (void)(n_jets);  // adding this line to fix unused-parameter warning
-      return currentAxes;
-   }
-};
-
-//This is a helper class for the Minimum Axes Finders. It is defined later.
-class LightLikeAxis;                                          
-
-
-//------------------------------------------------------------------------
-/// \class AxesFinderFromOnePassMinimization
-// This class defines an AxesFinder that uses Kmeans minimization, but only on a single pass.
-class AxesFinderFromOnePassMinimization : public AxesFinder {
-
-public:
-
-   // From a startingFinder, try to minimize the unnormalized_measure
-   AxesFinderFromOnePassMinimization(double beta, double Rcutoff)
-      : _precision(0.0001), //hard coded for now
-        _halt(1000), //hard coded for now
-        _beta(beta),
-        _Rcutoff(Rcutoff),
-        _measureFunction(beta, Rcutoff)
-        {}
-
-   virtual std::vector<fastjet::PseudoJet> getAxes(int n_jets,
-                                                   const std::vector <fastjet::PseudoJet> & inputJets,
-                                                   const std::vector<fastjet::PseudoJet>& currentAxes) const;
-   
-private:
-   double _precision;  // Desired precision in axes alignment
-   int _halt;  // maximum number of steps per iteration
-   
-   double _beta;
-   double _Rcutoff;
-   
-   DefaultUnnormalizedMeasureFunction _measureFunction;
-   
-   template <int N> std::vector<LightLikeAxis> UpdateAxesFast(const std::vector <LightLikeAxis> & old_axes,
-                                                              const std::vector <fastjet::PseudoJet> & inputJets) const;
-   
-   std::vector<LightLikeAxis> UpdateAxes(const std::vector <LightLikeAxis> & old_axes,
-                                         const std::vector <fastjet::PseudoJet> & inputJets) const;
-
-};
-
-
-//------------------------------------------------------------------------
-/// \class AxesFinderFromKmeansMinimization
-// This class finds finds axes by using Kmeans clustering to minimizaiton N-jettiness. Given a first set of 
-// starting axes, it updates n times to get as close to the global minimum as possible. This class calls OnePass many times,
-// added noise to the axes.
-class AxesFinderFromKmeansMinimization : public AxesFinder{
-
-public:
-   AxesFinderFromKmeansMinimization(double beta, double Rcutoff, int n_iterations)
-   :  _n_iterations(n_iterations),
-      _noise_range(1.0), // hard coded for the time being
-      _measureFunction(beta, Rcutoff),
-      _onePassFinder(beta, Rcutoff)
-      {}
-
-   virtual std::vector<fastjet::PseudoJet> getAxes(int n_jets, const std::vector <fastjet::PseudoJet> & inputJets, const std::vector<fastjet::PseudoJet>& currentAxes) const;
-   
-private:
-   int _n_iterations;   // Number of iterations to run  (0 for no minimization, 1 for one-pass, >>1 for global minimum)
-   double _noise_range; // noise range for random initialization
-   
-   DefaultUnnormalizedMeasureFunction _measureFunction; //function to test whether minimum is reached
-   
-   AxesFinderFromOnePassMinimization _onePassFinder;  //one pass finder that is repeatedly called
-   
-   PseudoJet jiggle(const PseudoJet& axis) const;
-};
-
-//------------------------------------------------------------------------
-/// \class AxesFinderFromGeometricMinimization
-// This class finds axes by minimizing the Lorentz dot product distance between axes and particles. Given a first set of starting axes,
-// it essentially does stable cone finxing.
-class AxesFinderFromGeometricMinimization : public AxesFinder {
-
-public:
-   AxesFinderFromGeometricMinimization(double beta, double Rcutoff)
-   :  _nAttempts(100),
-      _accuracy(0.000000001),
-      _function(beta,Rcutoff)
-   {
-      if (beta != 2.0) {
-         throw Error("Geometric minimization is currently only defined for beta = 2.0.");
-      }
-   }
-
-   virtual std::vector<fastjet::PseudoJet> getAxes(int n_jets, const std::vector <fastjet::PseudoJet> & particles, const std::vector<fastjet::PseudoJet>& currentAxes) const;
-
-private:
-   double _nAttempts;
-   double _accuracy;
-   GeometricMeasureFunction _function;
-
-
-};
-
-//------------------------------------------------------------------------
-/// \class LightLikeAxis
-// This is a helper class for the minimum Axes Finders classes above. It creates a convenient way of defining axes
-// in order to better facilitate calculations.
-class LightLikeAxis {
-
-public:
-   LightLikeAxis() : _rap(0.0), _phi(0.0), _weight(0.0), _mom(0.0) {}
-   LightLikeAxis(double my_rap, double my_phi, double my_weight, double my_mom) :
-   _rap(my_rap), _phi(my_phi), _weight(my_weight), _mom(my_mom) {}
-   double rap() const {return _rap;}
-   double phi() const {return _phi;}
-   double weight() const {return _weight;}
-   double mom() const {return _mom;}
-   void set_rap(double my_set_rap) {_rap = my_set_rap;}
-   void set_phi(double my_set_phi) {_phi = my_set_phi;}
-   void set_weight(double my_set_weight) {_weight = my_set_weight;}
-   void set_mom(double my_set_mom) {_mom = my_set_mom;}
-   void reset(double my_rap, double my_phi, double my_weight, double my_mom) {_rap=my_rap; _phi=my_phi; _weight=my_weight; _mom=my_mom;}
-
-   // return PseudoJet with information
-   fastjet::PseudoJet ConvertToPseudoJet();
-   
-   double DistanceSq(const fastjet::PseudoJet& input) const {
-      return DistanceSq(input.rap(),input.phi());
-   }
-
-   double Distance(const fastjet::PseudoJet& input) const {
-      return std::sqrt(DistanceSq(input));
-   }
-
-   double DistanceSq(const LightLikeAxis& input) const {
-      return DistanceSq(input.rap(),input.phi());
-   }
-
-   double Distance(const LightLikeAxis& input) const {
-      return std::sqrt(DistanceSq(input));
-   }
-
-private:
-   double _rap, _phi, _weight, _mom;
-   
-   double DistanceSq(double rap2, double phi2) const {
-      double rap1 = _rap;
-      double phi1 = _phi;
-      
-      double distRap = rap1-rap2;
-      double distPhi = std::fabs(phi1-phi2);
-      if (distPhi > M_PI) {distPhi = 2.0*M_PI - distPhi;}
-      return distRap*distRap + distPhi*distPhi;
-   }
-   
-   double Distance(double rap2, double phi2) const {
-      return std::sqrt(DistanceSq(rap2,phi2));
-   }
-   
-   
-};
-
-} //namespace contrib
-
-FASTJET_END_NAMESPACE
-
-#endif  // __FASTJET_CONTRIB_AXESFINDER_HH__
Index: external/fastjet/contribs/Nsubjettiness/COPYING
===================================================================
--- external/fastjet/contribs/Nsubjettiness/COPYING	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ external/fastjet/contribs/Nsubjettiness/COPYING	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -12,7 +12,15 @@
 to
 
+N-subjettiness:
   arXiv:1011.2268
   arXiv:1108.2701
 
+Winner-take-all axes:
+  arXiv:1310.7584
+  arXiv:1401.2158
+
+XCone:
+  arXiv:1508.01516
+  arXiv:1508.01518
 
 
Index: external/fastjet/contribs/Nsubjettiness/ChangeLog
===================================================================
--- external/fastjet/contribs/Nsubjettiness/ChangeLog	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ external/fastjet/contribs/Nsubjettiness/ChangeLog	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -1,2 +1,138 @@
+2015-09-28 <jthaler>
+   Updated NEWS for 2.2.1 release.
+2015-09-18 <jthaler>
+   Fixed duplicate XConePlugin entry in Makefile.
+2015-08-20 <jthaler>
+   Trying to fix "abs" bug in ExtraRecombiners.cc
+2015-08-19 <jthaler>
+   Adding arXiv numbers to XCone papers
+   Used this_jet in example_basic_usage.
+   Fixed typo in example_advanced_usage header.
+   Added copy/paste code in README file.
+2015-08-13 <jthaler>
+   Ready for 2.2.0 release
+2015-07-23 <jthaler>
+   Fixed typo in GenET_GenKT_Axes error message
+   Added _too_few_axes_warning to ExclusiveJetAxes and ExclusiveCombinatorialJetAxes
+   Switched to ../data/single_event_ee.dat for make check
+2015-07-20 <jthaler>
+   Renamed WinnerTakeAllRecombiner.hh/cc to ExtraRecombiners.hh/cc
+   Added _too_few_axes_warning to HardestJetAxes
+   Added GenKT_Axes and OnePass_GenKT_Axes and Comb_GenKT_Axes (using E-scheme recombination).
+   Added warning about p < 0 or delta <=0 in GenKT axes finders.
+   Added warning about beta <= 0 in all measures.
+2015-07-10 <jthaler>
+   Putting in small tweaks in documentation to get ready for 2.2 release candidate 1.
+2015-06-15 <jthaler>
+   Starting doxygen file for eventual improved documentation.
+   Starting long process of improving documentation throughout.
+   Made the basic usage file a bit easier to read.
+   Adding in LimitedWarnings for old style constructors
+2015-06-12 <jthaler>
+   Synchronized definition of new measures with XCone paper.
+   In MeasureDefinition, added default values of jet_distance_squared and beam_distance_squared for cases where we don't want to optimize specifically.
+   Fixed bug in OriginalGeometricMeasure and ModifiedGeometric Measure
+   Commented out DeprecatedGeometricMeasure and DeprecatedGeometricCutoffMeasure since they were only causing confusion
+2015-05-26 <TJW>
+   Removed axis_scale_factor(), added bool to calculate this value if needed to save computation time
+   Defined small offset in denominator of axis scaling according to accuracy of refinement
+   Updated advanced examples to include tau values and number of jet constituents
+2015-05-25 <jthaler>
+   Clean up of AxesDefinition
+   Splitting get_axes into get_starting_axes and get_refined axes
+   Putting in proper noise ranges (hopefully) for MultiPass
+   Clean up of MeasureDefinition, rename jet_gamma to beam_gamma
+   Put in zero checking for jet_distance in ConicalGeometricMeasure
+   Added in ConicalMeasure for consistency
+   Changing OnePass Minimization to allow for temporary uphill
+2015-05-24 <TJW>
+   Added Combinatorial GenET_GenKT_Axes and MultiPass_Manual_Axes
+   Moved Axes refining information into MeasureDefinition, associated each measure with corresponding axes refiner
+   Moved get_one_pass_axes into MeasureDefinition, removed any mention of Npass
+   Moved all information on number of passes to AxesDefinition
+   Made AxesRefiner.hh/.cc into defunct files
+2015-05-22 <jthaler>
+   Cleaning out commented text.  Renaming classes to be consistent with recommended usage.
+2015-05-22 <TJW>
+   Added XConePlugin as a specific implementation of NjettinessPlugin
+   Added usage of XCone beta = 1.0 and beta = 2.0 to both basic and advanced example files
+   Added OriginalGeometric, ModifiedGeometric, ConicalGeometric, and XCone measures to list of test measures
+   Added OnePass_GenRecomb_GenKT_Axes to list of test axes
+   Added description to XCone measure in MeasureDefinition
+2015-05-21 <TJW>
+   Updated minimization scheme to avoid divide-by-zero errors
+   Fixed various factors of 2 in the definition of the measures
+2015-04-19 <TJW>
+   Fixed bug in minimization scheme for GeneralAxesRefiner
+   Moved measure_type to DefaultMeasure, removed geometric measure from e+e- example file
+2015-03-22 <TJW>
+   Added OriginalGeometricMeasure and ModifiedGeometricMeasure definitions
+   Changed all instances of GeometricMeasure to DeprecatedGeometricMeasure, and added error statements
+   Made GeneralAxesRefiner the default axes refiner for Measure Definition, overwritten by DefaultMeasure and GeometricMeasure
+   Created DefaultMeasure class for all the conical measure subclasses
+   Separated out e+e- and pp measures into separate example files
+2015-03-09 <TJW>
+   Added ConicalGeometric measures with jet_beta and jet_gamma definitions
+   Added XCone measures derived from ConicalGeometric with jet_gamma = 1.0
+   Added GeneralAxesRefiner for use with any measure (currently defined with XCone measure)
+   Added axes_numerator in MeasureDefinition to define the momentum scaling for minimization (currently only defined for Conical Geometric measure)
+2014-11-28 <TJW>
+   Minor change to default parameters in axes definition
+2014-10-08 <TJW>
+   Updated example file with new e+e- measure definitions
+   Added measure type to measure definition descriptions
+   Changed order of parameters in new axes definitions
+   Added standard C++ epsilon definition to GeneralERecombiner
+2014-10-07 <TJW>
+   Updated example_advanced_usage with new axes choices
+   Reversed inheritance of NormalizedMeasure and NormalizedCutoffMeasure (and Geometric) back to original
+   Storing _RcutoffSq as separate variable, and recalculating it in NormalizedMeasure 
+   Cleaning up ExclusiveCombinatorialJetAxes and added comments to explain the process
+   Fixed memory leaks using delete_recombiner_when_unused()
+   Fixed manual axes bug in Njettiness
+   Cleaned up enum definitions
+2014-10-01 <TJW>
+   Added new parameterized recombination scheme to Winner-Take-All recombiner
+   Created Winner-Take-All GenKT and general Recomb GenKT axes finders and onepass versions
+   Created new N choose M minimization axis finder, created N choose M WTA GenKT axis finder as example
+   Removed NPass as constructor argument in AxesDefinition, made it set through protected method
+   Removed TauMode as constructor argument in MeasureDefinition, made it set through protected method
+   Flipped inheritance of NormalizedMeasure and NormalizedCutoffMeasure (same for Geometric) to remove error of squaring the integer maximum
+   Created new MeasureType enum to allow user to choose between pp and ee variables (ee variables need testing)
+   Updated MeasureDefinition constructors to take in extra MeasureType parameter (but defaulted to pp variables)
+   Added new Default TauMode argument 
+   Fixed unsigned integers in various places
+   Added setAxes method to NjettinessPlugin
+2014-08-26 <JDT>
+   Enhanced TauComponents to include more infomation
+   NjettinessExtras now inherits from TauComponents
+   Removed getPartition from Njettiness, to avoid code duplication
+   Fixed double calculating issue in NjettinessPlugin::run_clustering()
+   Now AxesDefinition can use measure information without running AxesRefiner
+   Added TauStructure so the jets returned by TauComponents can know their tau value.
+2014-08-25 <JDT>
+   Merged MeasureDefinition and MeasureFunction into new MeasureDefinition.
+   Merged StartingAxesFinder and AxesDefinition into new AxesDefinition.
+   Renamed AxesFinder.cc/hh to AxesRefiner.cc/hh
+   Renamed NjettinessDefinition.cc/hh to AxesDefinition.cc/hh
+   Renamed MeasureFunction.cc/hh to MeasureDefinition.cc/hh
+   Renaming result() function in MeasureDefinition to be consistent with Nsubjettiness interface.
+   Split off TauComponents into separate header
+   Added TauPartition class for readability of partitioning
+   Moved NjettinessExtras into TauComponents, as this will eventually be the logical location
+   Added cross check of new MeasureDefinition and AxesDefinition in example_advanced_usage.
+   Lots of comments updated.
+   Changed version number to 2.2.0-alpha-dev, since this is going to be a bigger update than I had originally thought
+2014-08-20 <JDT>
+   Incorporated code in NjettinessPlugin to handle FJ3.1 treatment of auto_ptr (thanks Gregory)
+   Changed version number to 2.1.1-alpha-dev
+   Split AxesFinder into StartingAxesFinder and RefiningAxesFinder for clarity.
+   Manual axes mode now corresponds to a NULL StartingAxesFinder in Njettiness (so removed AxesFinderFromUserInput)
+   Added AxesRefiningMode to make selection of minimization routine more transparent in Njettiness
+   Moved sq() to more appropriate place in AxesFinder.hh
+   Rearranged Nsubjettiness.hh to make the old code less visible.
+   Renamed AxesFinderFromOnePassMinimization -> AxesFinderFromConicalMinimization
+   Renamed DefaultUnnormalizedMeasureFunction -> ConicalUnnormalizedMeasureFunction
+   Removed supportsMultiPassMinimization() from MeasureDefinition since any One Pass algorithm can be multipass.
 2014-07-09 <JDT>
    Changed version for 2.1.0 release.
Index: external/fastjet/contribs/Nsubjettiness/ExtraRecombiners.cc
===================================================================
--- external/fastjet/contribs/Nsubjettiness/ExtraRecombiners.cc	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
+++ external/fastjet/contribs/Nsubjettiness/ExtraRecombiners.cc	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -0,0 +1,103 @@
+//  Nsubjettiness Package
+//  Questions/Comments?  jthaler@jthaler.net
+//
+//  Copyright (c) 2011-14
+//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
+//
+//  $Id: ExtraRecombiners.cc 842 2015-08-20 13:44:31Z jthaler $
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#include "ExtraRecombiners.hh"
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+namespace contrib{
+  
+std::string GeneralEtSchemeRecombiner::description() const {
+   return "General Et-scheme recombination";
+}
+
+// recombine pa and pb according to a generalized Et-scheme parameterized by the power delta
+void GeneralEtSchemeRecombiner::recombine(const fastjet::PseudoJet & pa, const fastjet::PseudoJet & pb, fastjet::PseudoJet & pab) const {
+   
+   // Define new weights for recombination according to delta
+   // definition of ratio done so that we do not encounter issues about numbers being too large for huge values of delta
+   double ratio;
+   if (std::abs(_delta - 1.0) < std::numeric_limits<double>::epsilon()) ratio = pb.perp()/pa.perp(); // save computation time of pow()
+   else ratio = pow(pb.perp()/pa.perp(), _delta);
+   double weighta = 1.0/(1.0 + ratio);
+   double weightb = 1.0/(1.0 + 1.0/ratio);
+   
+   double perp_ab = pa.perp() + pb.perp();
+   // reweight the phi and rap sums according to the weights above
+   if (perp_ab != 0.0) {
+      double y_ab = (weighta * pa.rap() + weightb * pb.rap());
+      
+      double phi_a = pa.phi(), phi_b = pb.phi();
+      if (phi_a - phi_b > pi)  phi_b += twopi;
+      if (phi_a - phi_b < -pi) phi_b -= twopi;
+      double phi_ab = (weighta * phi_a + weightb * phi_b);
+      
+      pab.reset_PtYPhiM(perp_ab, y_ab, phi_ab);
+      
+   }
+   else {
+      pab.reset(0.0,0.0,0.0,0.0);
+   }
+}
+
+
+std::string WinnerTakeAllRecombiner::description() const {
+   return "Winner-Take-All recombination";
+}
+
+// recombine pa and pb by creating pab with energy of the sum of particle energies in the direction of the harder particle
+// updated recombiner to use more general form of a metric equal to E*(pT/E)^(alpha), which reduces to pT*cosh(rap)^(1-alpha)
+// alpha is specified by the user. The default is alpha = 1, which is the typical behavior. alpha = 2 provides a metric which more 
+// favors central jets
+void WinnerTakeAllRecombiner::recombine(const fastjet::PseudoJet & pa, const fastjet::PseudoJet & pb, fastjet::PseudoJet & pab) const {
+   double a_pt = pa.perp(), b_pt = pb.perp(), a_rap = pa.rap(), b_rap = pb.rap();
+   
+   // special case of alpha = 1, everything is just pt (made separate so that pow function isn't called)
+   if (_alpha == 1.0) {
+      if (a_pt >= b_pt) {
+         pab.reset_PtYPhiM(a_pt + b_pt, a_rap, pa.phi());
+      }
+      else if (b_pt > a_pt) {
+         pab.reset_PtYPhiM(a_pt + b_pt, b_rap, pb.phi());
+      }
+   }
+
+   // every other case uses additional cosh(rap) term
+   else {
+      double a_metric = a_pt*pow(cosh(a_rap), 1.0-_alpha);
+      double b_metric = b_pt*pow(cosh(b_rap), 1.0-_alpha);
+      if (a_metric >= b_metric) {
+   	  double new_pt = a_pt + b_pt*pow(cosh(b_rap)/cosh(a_rap), 1.0-_alpha);
+   	  pab.reset_PtYPhiM(new_pt, a_rap, pa.phi());
+      }
+      if (b_metric > a_metric) {
+   	  double new_pt = b_pt + a_pt*pow(cosh(a_rap)/cosh(b_rap), 1.0-_alpha);
+   	  pab.reset_PtYPhiM(new_pt, b_rap, pb.phi());
+      }
+   }
+}
+
+} //namespace contrib
+
+FASTJET_END_NAMESPACE
Index: external/fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh
===================================================================
--- external/fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
+++ external/fastjet/contribs/Nsubjettiness/ExtraRecombiners.hh	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -0,0 +1,103 @@
+//  Nsubjettiness Package
+//  Questions/Comments?  jthaler@jthaler.net
+//
+//  Copyright (c) 2011-14
+//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
+//
+//  $Id: ExtraRecombiners.hh 828 2015-07-20 14:52:06Z jthaler $
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#ifndef __FASTJET_CONTRIB_WINNERTAKEALLRECOMBINER_HH__
+#define __FASTJET_CONTRIB_WINNERTAKEALLRECOMBINER_HH__
+
+#include "fastjet/PseudoJet.hh"
+#include "fastjet/JetDefinition.hh"
+
+#include <cmath>
+#include <vector>
+#include <list>
+#include <limits>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+namespace contrib {
+
+///------------------------------------------------------------------------
+/// \class GeneralEtSchemeRecombiner
+/// \brief Recombination scheme with generalized Et weighting
+///
+/// GeneralEtSchemeRecombiner defines a new recombination scheme by inheriting from JetDefinition::Recombiner.
+/// This scheme compares the pT of two input particles, and then combines them into a particle with
+/// a pT equal to the sum of the two particle pTs and a direction (in rapidity/phi) weighted by the respective momenta of the
+/// particle. The weighting is dependent on the power delta. For delta = infinity, this should return the same result as the
+/// WinnerTakeAllRecombiner.
+///------------------------------------------------------------------------
+class GeneralEtSchemeRecombiner : public fastjet::JetDefinition::Recombiner {
+public:
+
+   /// Constructor takes delta weighting
+   /// (delta = 1.0 for Et-scheme, delta = infinity for winner-take-all scheme)
+   GeneralEtSchemeRecombiner(double delta) : _delta(delta) {}
+  
+   /// Description
+   virtual std::string description() const;
+  
+   /// Recombine pa and pb and put result into pab
+   virtual void recombine(const fastjet::PseudoJet & pa,
+                         const fastjet::PseudoJet & pb, 
+                         fastjet::PseudoJet & pab) const;
+
+private:
+  double _delta;  ///< Weighting exponent
+};
+
+///------------------------------------------------------------------------
+/// \class WinnerTakeAllRecombiner
+/// \brief Recombination scheme with winner-take-all weighting
+///
+/// WinnerTakeAllRecombiner defines a new recombination scheme by inheriting from JetDefinition::Recombiner.
+/// This scheme compares the pT of two input particles, and then combines them into a particle with
+/// a pT equal to the sum of the two particle pTs and a direction (in rapidity/phi) identical to that of the harder
+/// particle. This creates a jet with an axis guaranteed to align with a particle in the event.
+///------------------------------------------------------------------------
+class WinnerTakeAllRecombiner : public fastjet::JetDefinition::Recombiner {
+public:
+   
+	/// Constructor to choose value of alpha (defaulted to 1 for normal pT sum)
+   WinnerTakeAllRecombiner(double alpha = 1.0) : _alpha(alpha) {}
+
+   /// Description
+   virtual std::string description() const;
+   
+   /// recombine pa and pb and put result into pab
+   virtual void recombine(const fastjet::PseudoJet & pa,
+                          const fastjet::PseudoJet & pb,
+                          fastjet::PseudoJet & pab) const;
+
+private:
+	double _alpha; //power of (pt/E) term when recombining particles
+};
+
+} //namespace contrib
+
+FASTJET_END_NAMESPACE
+
+#endif  // __FASTJET_CONTRIB_WINNERTAKEALLRECOMBINER_HH__
Index: external/fastjet/contribs/Nsubjettiness/Makefile
===================================================================
--- external/fastjet/contribs/Nsubjettiness/Makefile	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ 	(revision )
@@ -1,101 +1,0 @@
-# If you are using this Makefile standalone and fastjet-config is not
-# in your path, edit this line to specify the full path
-FASTJETCONFIG=fastjet-config
-PREFIX=`$(FASTJETCONFIG) --prefix`
-CXX=g++
-CXXFLAGS= -O3 -Wall -Woverloaded-virtual -g -Wunused-parameter
-install_script = $(SHELL) ../utils/install-sh
-check_script = ../utils/check.sh
-
-# global contrib-wide Makefile include may override some of the above
-# variables (leading "-" means don't give an error if you can't find
-# the file)
--include ../.Makefile.inc
-
-#------------------------------------------------------------------------
-# things that are specific to this contrib
-NAME=Nsubjettiness
-SRCS=Nsubjettiness.cc Njettiness.cc NjettinessPlugin.cc MeasureFunction.cc AxesFinder.cc WinnerTakeAllRecombiner.cc NjettinessDefinition.cc
-EXAMPLES=example_basic_usage example_advanced_usage example_v1p0p3
-INSTALLED_HEADERS=Nsubjettiness.hh Njettiness.hh NjettinessPlugin.hh MeasureFunction.hh AxesFinder.hh WinnerTakeAllRecombiner.hh NjettinessDefinition.hh
-#------------------------------------------------------------------------
-
-CXXFLAGS+= $(shell $(FASTJETCONFIG) --cxxflags)
-LDFLAGS += -lm $(shell $(FASTJETCONFIG) --libs)
-
-OBJS  = $(SRCS:.cc=.o)
-EXAMPLES_SRCS  = $(EXAMPLES:=.cc)
-
-install_HEADER  = $(install_script) -c -m 644
-install_LIB     = $(install_script) -c -m 644
-install_DIR     = $(install_script) -d
-install_DATA    = $(install_script) -c -m 644
-install_PROGRAM = $(install_script) -c -s
-install_SCRIPT  = $(install_script) -c
-
-.PHONY: clean distclean examples check install
-
-# compilation of the code (default target)
-all: lib$(NAME).a
-
-lib$(NAME).a: $(OBJS)
-	ar cru lib$(NAME).a $(OBJS)
-	ranlib lib$(NAME).a
-
-# building the examples
-examples: $(EXAMPLES)
-
-# the following construct alloews to build each of the examples listed
-# in $EXAMPLES automatically
-$(EXAMPLES): % : %.o all
-	$(CXX) -o $@ $< -L. -l$(NAME) $(LDFLAGS)
-
-# check that everything went fine
-check: examples
-	@for prog in $(EXAMPLES); do\
-	  $(check_script) $${prog} ../data/single-event.dat || exit 1; \
-	done
-	@echo "All tests successful"
-
-# cleaning the directory
-clean:
-	rm -f *~ *.o *.a
-
-distclean: clean
-	rm -f lib$(NAME).a $(EXAMPLES)
-
-# install things in PREFIX/...
-install: all
-	$(install_DIR) $(PREFIX)/include/fastjet/contrib
-	for header in $(INSTALLED_HEADERS); do\
-	  $(install_HEADER) $$header $(PREFIX)/include/fastjet/contrib/;\
-	done
-	$(install_DIR) $(PREFIX)/lib
-	$(install_LIB) lib$(NAME).a $(PREFIX)/lib
-
-depend:
-	makedepend -Y --   -- $(SRCS) $(EXAMPLES_SRCS)
-# DO NOT DELETE
-
-Nsubjettiness.o: Nsubjettiness.hh Njettiness.hh MeasureFunction.hh
-Nsubjettiness.o: AxesFinder.hh WinnerTakeAllRecombiner.hh
-Nsubjettiness.o: NjettinessDefinition.hh
-Njettiness.o: Njettiness.hh MeasureFunction.hh AxesFinder.hh
-Njettiness.o: WinnerTakeAllRecombiner.hh NjettinessDefinition.hh
-NjettinessPlugin.o: NjettinessPlugin.hh Njettiness.hh MeasureFunction.hh
-NjettinessPlugin.o: AxesFinder.hh WinnerTakeAllRecombiner.hh
-NjettinessPlugin.o: NjettinessDefinition.hh
-MeasureFunction.o: MeasureFunction.hh
-AxesFinder.o: AxesFinder.hh WinnerTakeAllRecombiner.hh MeasureFunction.hh
-WinnerTakeAllRecombiner.o: WinnerTakeAllRecombiner.hh
-NjettinessDefinition.o: NjettinessDefinition.hh MeasureFunction.hh
-NjettinessDefinition.o: AxesFinder.hh WinnerTakeAllRecombiner.hh
-example_basic_usage.o: Nsubjettiness.hh Njettiness.hh MeasureFunction.hh
-example_basic_usage.o: AxesFinder.hh WinnerTakeAllRecombiner.hh
-example_basic_usage.o: NjettinessDefinition.hh NjettinessPlugin.hh
-example_advanced_usage.o: Nsubjettiness.hh Njettiness.hh MeasureFunction.hh
-example_advanced_usage.o: AxesFinder.hh WinnerTakeAllRecombiner.hh
-example_advanced_usage.o: NjettinessDefinition.hh NjettinessPlugin.hh
-example_v1p0p3.o: Nsubjettiness.hh Njettiness.hh MeasureFunction.hh
-example_v1p0p3.o: AxesFinder.hh WinnerTakeAllRecombiner.hh
-example_v1p0p3.o: NjettinessDefinition.hh NjettinessPlugin.hh
Index: external/fastjet/contribs/Nsubjettiness/MeasureDefinition.cc
===================================================================
--- external/fastjet/contribs/Nsubjettiness/MeasureDefinition.cc	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
+++ external/fastjet/contribs/Nsubjettiness/MeasureDefinition.cc	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -0,0 +1,627 @@
+//  Nsubjettiness Package
+//  Questions/Comments?  jthaler@jthaler.net
+//
+//  Copyright (c) 2011-14
+//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
+//
+//  $Id: MeasureDefinition.cc 819 2015-06-12 21:23:24Z jthaler $
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+
+// #include "AxesRefiner.hh"
+#include "MeasureDefinition.hh"
+
+#include <iomanip>
+
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+namespace contrib {
+
+///////
+//
+// Measure Function
+//
+///////
+
+
+//descriptions updated to include measure type
+std::string DefaultMeasure::description() const {
+   std::stringstream stream;
+   stream << std::fixed << std::setprecision(2)
+   << "Default Measure (should not be used directly)";
+   return stream.str();
+};
+
+std::string NormalizedMeasure::description() const {
+   std::stringstream stream;
+   stream << std::fixed << std::setprecision(2)
+   << "Normalized Measure (beta = " << _beta << ", R0 = " << _R0 << ")";
+   return stream.str();
+};
+
+std::string UnnormalizedMeasure::description() const {
+   std::stringstream stream;
+   stream << std::fixed << std::setprecision(2)
+   << "Unnormalized Measure (beta = " << _beta << ", in GeV)";
+   return stream.str();
+};
+
+
+std::string NormalizedCutoffMeasure::description() const {
+   std::stringstream stream;
+   stream << std::fixed << std::setprecision(2)
+   << "Normalized Cutoff Measure (beta = " << _beta << ", R0 = " << _R0 << ", Rcut = " << _Rcutoff << ")";
+   return stream.str();
+};
+
+std::string UnnormalizedCutoffMeasure::description() const {
+   std::stringstream stream;
+   stream << std::fixed << std::setprecision(2)
+   << "Unnormalized Cutoff Measure (beta = " << _beta << ", Rcut = " << _Rcutoff << ", in GeV)";
+   return stream.str();
+};
+
+//std::string DeprecatedGeometricMeasure::description() const {
+//   std::stringstream stream;
+//   stream << std::fixed << std::setprecision(2)
+//   << "Deprecated Geometric Measure (beta = " << _jet_beta << ", in GeV)";
+//   return stream.str();
+//};
+   
+//std::string DeprecatedGeometricCutoffMeasure::description() const {
+//   std::stringstream stream;
+//   stream << std::fixed << std::setprecision(2)
+//   << "Deprecated Geometric Cutoff Measure (beta = " << _jet_beta << ", Rcut = " << _Rcutoff << ", in GeV)";
+//   return stream.str();
+//};
+   
+std::string ConicalMeasure::description() const {
+   std::stringstream stream;
+   stream << std::fixed << std::setprecision(2)
+   << "Conical Measure (beta = " << _beta << ", Rcut = " << _Rcutoff << ", in GeV)";
+   return stream.str();
+};
+
+std::string OriginalGeometricMeasure::description() const {
+   std::stringstream stream;
+   stream << std::fixed << std::setprecision(2)
+   << "Original Geometric Measure (Rcut = " << _Rcutoff << ", in GeV)";
+   return stream.str();
+}; 
+
+std::string ModifiedGeometricMeasure::description() const {
+   std::stringstream stream;
+   stream << std::fixed << std::setprecision(2)
+   << "Modified Geometric Measure (Rcut = " << _Rcutoff << ", in GeV)";
+   return stream.str();
+}; 
+
+std::string ConicalGeometricMeasure::description() const {
+   std::stringstream stream;
+   stream << std::fixed << std::setprecision(2)
+   << "Conical Geometric Measure (beta = " << _jet_beta << ", gamma = " << _beam_gamma << ", Rcut = " << _Rcutoff << ", in GeV)";
+   return stream.str();
+}; 
+   
+
+std::string XConeMeasure::description() const {
+   std::stringstream stream;
+   stream << std::fixed << std::setprecision(2)
+   << "XCone Measure (beta = " << _jet_beta << ", Rcut = " << _Rcutoff << ", in GeV)";
+   return stream.str();
+}; 
+    
+// Return all of the necessary TauComponents for specific input particles and axes
+TauComponents MeasureDefinition::component_result(const std::vector<fastjet::PseudoJet>& particles,
+                                                  const std::vector<fastjet::PseudoJet>& axes) const {
+   
+   // first find partition
+   TauPartition partition = get_partition(particles,axes);
+   
+   // then return result calculated from partition
+   return component_result_from_partition(partition,axes);
+}
+
+TauPartition MeasureDefinition::get_partition(const std::vector<fastjet::PseudoJet>& particles,
+                                            const std::vector<fastjet::PseudoJet>& axes) const {
+   
+   TauPartition myPartition(axes.size());
+   
+   // Figures out the partiting of the input particles into the various jet pieces
+   // Based on which axis the parition is closest to
+   for (unsigned i = 0; i < particles.size(); i++) {
+      
+      // find minimum distance; start with beam (-1) for reference
+      int j_min = -1;
+      double minRsq;
+      if (has_beam()) minRsq = beam_distance_squared(particles[i]);
+      else minRsq = std::numeric_limits<double>::max(); // make it large value
+      
+      
+      // check to see which axis the particle is closest to
+      for (unsigned j = 0; j < axes.size(); j++) {
+         double tempRsq = jet_distance_squared(particles[i],axes[j]); // delta R distance
+         
+         if (tempRsq < minRsq) {
+            minRsq = tempRsq;
+            j_min = j;
+         }
+      }
+      
+      if (j_min == -1) {
+         assert(has_beam());  // should have beam for this to make sense.
+         myPartition.push_back_beam(particles[i],i);
+      } else {
+         myPartition.push_back_jet(j_min,particles[i],i);
+      }
+   }
+   
+   return myPartition;
+}
+
+// Uses existing partition and calculates result
+// TODO:  Can we cache this for speed up when doing area subtraction?
+TauComponents MeasureDefinition::component_result_from_partition(const TauPartition& partition,
+                                                     const std::vector<fastjet::PseudoJet>& axes) const {
+   
+   std::vector<double> jetPieces(axes.size(), 0.0);
+   double beamPiece = 0.0;
+   
+   double tauDen = 0.0;
+   if (!has_denominator()) tauDen = 1.0;  // if no denominator, then 1.0 for no normalization factor
+   
+   // first find jet pieces
+   for (unsigned j = 0; j < axes.size(); j++) {
+      std::vector<PseudoJet> thisPartition = partition.jet(j).constituents();
+      for (unsigned i = 0; i < thisPartition.size(); i++) {
+         jetPieces[j] += jet_numerator(thisPartition[i],axes[j]); //numerator jet piece
+         if (has_denominator()) tauDen += denominator(thisPartition[i]); // denominator
+      }
+   }
+   
+   // then find beam piece
+   if (has_beam()) {
+      std::vector<PseudoJet> beamPartition = partition.beam().constituents();
+
+      for (unsigned i = 0; i < beamPartition.size(); i++) {
+         beamPiece += beam_numerator(beamPartition[i]); //numerator beam piece
+         if (has_denominator()) tauDen += denominator(beamPartition[i]); // denominator
+      }
+   }
+   
+   // create jets for storage in TauComponents
+   std::vector<PseudoJet> jets = partition.jets();
+   
+   return TauComponents(_tau_mode, jetPieces, beamPiece, tauDen, jets, axes);
+}
+
+// new methods added to generalize energy and angle squared for different measure types
+double DefaultMeasure::energy(const PseudoJet& jet) const {
+   double energy;
+   switch (_measure_type) {
+      case pt_R : 
+      case perp_lorentz_dot : 
+         energy = jet.perp();
+         break;
+      case E_theta : 
+      case lorentz_dot : 
+         energy = jet.e();
+         break;
+      default : {
+         assert(_measure_type == pt_R || _measure_type == E_theta || _measure_type == lorentz_dot || _measure_type == perp_lorentz_dot);
+         energy = std::numeric_limits<double>::quiet_NaN();
+         break;
+      }
+   }
+   return energy;
+}
+   
+double DefaultMeasure::angleSquared(const PseudoJet& jet1, const PseudoJet& jet2) const {
+   double pseudoRsquared;
+   switch(_measure_type) {
+      case pt_R : {
+         pseudoRsquared = jet1.squared_distance(jet2);
+         break; 
+      }
+      case E_theta : {
+         // doesn't seem to be a fastjet built in for this
+         double dot = jet1.px()*jet2.px() + jet1.py()*jet2.py() + jet1.pz()*jet2.pz();
+         double norm1 = sqrt(jet1.px()*jet1.px() + jet1.py()*jet1.py() + jet1.pz()*jet1.pz());
+         double norm2 = sqrt(jet2.px()*jet2.px() + jet2.py()*jet2.py() + jet2.pz()*jet2.pz());
+        
+         double costheta = dot/(norm1 * norm2);
+         if (costheta > 1.0) costheta = 1.0; // Need to handle case of numerical overflow
+         double theta = acos(costheta);
+         pseudoRsquared = theta*theta;   
+         break;
+      }
+      case lorentz_dot : {
+         double dotproduct = dot_product(jet1,jet2);
+         pseudoRsquared = 2.0 * dotproduct / (jet1.e() * jet2.e());
+         break;
+      }
+      case perp_lorentz_dot : {
+         PseudoJet lightJet = lightFrom(jet2); // assuming jet2 is the axis
+         double dotproduct = dot_product(jet1,lightJet);
+         pseudoRsquared = 2.0 * dotproduct / (lightJet.pt() * jet1.pt());
+         break;
+      }
+      default : {
+         assert(_measure_type == pt_R || _measure_type == E_theta || _measure_type == lorentz_dot || _measure_type == perp_lorentz_dot);
+         pseudoRsquared = std::numeric_limits<double>::quiet_NaN();
+         break;
+      }
+   }
+
+   return pseudoRsquared;
+
+}
+
+
+///////
+//
+// Axes Refining
+//
+///////
+
+// uses minimization of N-jettiness to continually update axes until convergence.
+// The function returns the axes found at the (local) minimum
+// This is the general axes refiner that can be used for a generic measure (but is
+// overwritten in the case of the conical measure and the deprecated geometric measure)
+std::vector<fastjet::PseudoJet> MeasureDefinition::get_one_pass_axes(int n_jets,
+                                                                     const std::vector <fastjet::PseudoJet> & particles,
+                                                                     const std::vector<fastjet::PseudoJet>& currentAxes,
+                                                                     int nAttempts,
+                                                                     double accuracy) const {
+
+   assert(n_jets == (int)currentAxes.size());
+   
+   std::vector<fastjet::PseudoJet> seedAxes = currentAxes;
+
+   std::vector<fastjet::PseudoJet> temp_axes(seedAxes.size(),fastjet::PseudoJet(0,0,0,0));
+   for (unsigned int k = 0; k < seedAxes.size(); k++) {
+      seedAxes[k] = lightFrom(seedAxes[k]) * seedAxes[k].E(); // making light-like, but keeping energy
+   }
+   
+   double seedTau = result(particles, seedAxes);
+
+   std::vector<fastjet::PseudoJet> bestAxesSoFar = seedAxes;
+   double bestTauSoFar = seedTau;
+   
+   for (int i_att = 0; i_att < nAttempts; i_att++) {
+      
+      std::vector<fastjet::PseudoJet> newAxes(seedAxes.size(),fastjet::PseudoJet(0,0,0,0));
+      std::vector<fastjet::PseudoJet> summed_jets(seedAxes.size(), fastjet::PseudoJet(0,0,0,0));      
+      
+      // find closest axis and assign to that
+      for (unsigned int i = 0; i < particles.size(); i++) {
+         
+         // start from unclustered beam measure
+         int minJ = -1;
+         double minDist = beam_distance_squared(particles[i]);
+         
+         // which axis am I closest to?
+         for (unsigned int j = 0; j < seedAxes.size(); j++) {
+            double tempDist = jet_distance_squared(particles[i],seedAxes[j]);
+            if (tempDist < minDist) {
+               minDist = tempDist;
+               minJ = j;
+            }
+         }
+         
+         // if not unclustered, then cluster
+         if (minJ != -1) {
+            summed_jets[minJ] += particles[i]; // keep track of energy to use later.
+            if (_useAxisScaling) {
+               double pseudoMomentum = dot_product(lightFrom(seedAxes[minJ]),particles[i]) + accuracy; // need small offset to avoid potential divide by zero issues
+               double axis_scaling = (double)jet_numerator(particles[i], seedAxes[minJ])/pseudoMomentum;
+
+               newAxes[minJ] += particles[i]*axis_scaling;
+            }
+         }
+      }
+      if (!_useAxisScaling) newAxes = summed_jets;
+
+      // convert the axes to LightLike and then back to PseudoJet
+      for (unsigned int k = 0; k < newAxes.size(); k++) {
+         if (newAxes[k].perp() > 0) {
+            newAxes[k] = lightFrom(newAxes[k]);
+            newAxes[k] *= summed_jets[k].E(); // scale by energy to get sensible result
+         }
+      }
+
+      // calculate tau on new axes
+      double newTau = result(particles, newAxes);
+      
+      // find the smallest value of tau (and the corresponding axes) so far
+      if (newTau < bestTauSoFar) {
+         bestAxesSoFar = newAxes;
+         bestTauSoFar = newTau;
+      }
+
+      if (fabs(newTau - seedTau) < accuracy) {// close enough for jazz
+         seedAxes = newAxes;
+         seedTau = newTau;
+         break;
+      }
+
+      seedAxes = newAxes;
+      seedTau = newTau;
+
+}
+
+   // return the axes corresponding to the smallest tau found throughout all iterations
+   // this is to prevent the minimization from returning a non-minimized of tau due to potential oscillations around the minimum
+   return bestAxesSoFar;
+
+}
+
+
+// One pass minimization for the DefaultMeasure
+   
+// Given starting axes, update to find better axes by using Kmeans clustering around the old axes
+template <int N>
+std::vector<LightLikeAxis> DefaultMeasure::UpdateAxesFast(const std::vector <LightLikeAxis> & old_axes,
+                                                          const std::vector <fastjet::PseudoJet> & inputJets,
+                                                          double accuracy
+                                                          ) const {
+   assert(old_axes.size() == N);
+   
+   // some storage, declared static to save allocation/re-allocation costs
+   static LightLikeAxis new_axes[N];
+   static fastjet::PseudoJet new_jets[N];
+   for (int n = 0; n < N; ++n) {
+      new_axes[n].reset(0.0,0.0,0.0,0.0);
+      new_jets[n].reset_momentum(0.0,0.0,0.0,0.0);
+   }
+
+   double precision = accuracy;  //TODO: actually cascade this in
+   
+   /////////////// Assignment Step //////////////////////////////////////////////////////////
+   std::vector<int> assignment_index(inputJets.size()); 
+   int k_assign = -1;
+   
+   for (unsigned i = 0; i < inputJets.size(); i++){
+      double smallestDist = std::numeric_limits<double>::max();  //large number
+      for (int k = 0; k < N; k++) {
+         double thisDist = old_axes[k].DistanceSq(inputJets[i]);
+         if (thisDist < smallestDist) {
+            smallestDist = thisDist;
+            k_assign = k;
+         }
+      }
+      if (smallestDist > sq(_Rcutoff)) {k_assign = -1;}
+      assignment_index[i] = k_assign;
+   }
+   
+   //////////////// Update Step /////////////////////////////////////////////////////////////
+   double distPhi, old_dist;
+   for (unsigned i = 0; i < inputJets.size(); i++) {
+      int old_jet_i = assignment_index[i];
+      if (old_jet_i == -1) {continue;}
+
+      const fastjet::PseudoJet& inputJet_i = inputJets[i];
+      LightLikeAxis& new_axis_i = new_axes[old_jet_i];
+      double inputPhi_i = inputJet_i.phi();
+      double inputRap_i = inputJet_i.rap();
+            
+      // optimize pow() call
+      // add noise (the precision term) to make sure we don't divide by zero
+      if (_beta == 1.0) {
+         double DR = std::sqrt(sq(precision) + old_axes[old_jet_i].DistanceSq(inputJet_i));
+         old_dist = 1.0/DR;
+      } else if (_beta == 2.0) {
+         old_dist = 1.0;
+      } else if (_beta == 0.0) {
+         double DRSq = sq(precision) + old_axes[old_jet_i].DistanceSq(inputJet_i);
+         old_dist = 1.0/DRSq;
+      } else {
+         old_dist = sq(precision) + old_axes[old_jet_i].DistanceSq(inputJet_i);
+         old_dist = std::pow(old_dist, (0.5*_beta-1.0));
+      }
+      
+      // TODO:  Put some of these addition functions into light-like axes
+      // rapidity sum
+      new_axis_i.set_rap(new_axis_i.rap() + inputJet_i.perp() * inputRap_i * old_dist);
+      // phi sum
+      distPhi = inputPhi_i - old_axes[old_jet_i].phi();
+      if (fabs(distPhi) <= M_PI){
+         new_axis_i.set_phi( new_axis_i.phi() + inputJet_i.perp() * inputPhi_i * old_dist );
+      } else if (distPhi > M_PI) {
+         new_axis_i.set_phi( new_axis_i.phi() + inputJet_i.perp() * (-2*M_PI + inputPhi_i) * old_dist );
+      } else if (distPhi < -M_PI) {
+         new_axis_i.set_phi( new_axis_i.phi() + inputJet_i.perp() * (+2*M_PI + inputPhi_i) * old_dist );
+      }
+      // weights sum
+      new_axis_i.set_weight( new_axis_i.weight() + inputJet_i.perp() * old_dist );
+      // momentum magnitude sum
+      new_jets[old_jet_i] += inputJet_i;
+   }
+   // normalize sums
+   for (int k = 0; k < N; k++) {
+      if (new_axes[k].weight() == 0) {
+         // no particles were closest to this axis!  Return to old axis instead of (0,0,0,0)
+         new_axes[k] = old_axes[k];
+      } else {
+         new_axes[k].set_rap( new_axes[k].rap() / new_axes[k].weight() );
+         new_axes[k].set_phi( new_axes[k].phi() / new_axes[k].weight() );
+         new_axes[k].set_phi( std::fmod(new_axes[k].phi() + 2*M_PI, 2*M_PI) );
+         new_axes[k].set_mom( std::sqrt(new_jets[k].modp2()) );
+      }
+   }
+   std::vector<LightLikeAxis> new_axes_vec(N);
+   for (unsigned k = 0; k < N; ++k) new_axes_vec[k] = new_axes[k];
+   return new_axes_vec;
+}
+
+// Given N starting axes, this function updates all axes to find N better axes. 
+// (This is just a wrapper for the templated version above.)
+//  TODO:  Consider removing this in a future version
+std::vector<LightLikeAxis> DefaultMeasure::UpdateAxes(const std::vector <LightLikeAxis> & old_axes,
+                                                      const std::vector <fastjet::PseudoJet> & inputJets,
+                                                      double accuracy) const {
+   int N = old_axes.size();
+   switch (N) {
+      case 1: return UpdateAxesFast<1>(old_axes, inputJets, accuracy);
+      case 2: return UpdateAxesFast<2>(old_axes, inputJets, accuracy);
+      case 3: return UpdateAxesFast<3>(old_axes, inputJets, accuracy);
+      case 4: return UpdateAxesFast<4>(old_axes, inputJets, accuracy);
+      case 5: return UpdateAxesFast<5>(old_axes, inputJets, accuracy);
+      case 6: return UpdateAxesFast<6>(old_axes, inputJets, accuracy);
+      case 7: return UpdateAxesFast<7>(old_axes, inputJets, accuracy);
+      case 8: return UpdateAxesFast<8>(old_axes, inputJets, accuracy);
+      case 9: return UpdateAxesFast<9>(old_axes, inputJets, accuracy);
+      case 10: return UpdateAxesFast<10>(old_axes, inputJets, accuracy);
+      case 11: return UpdateAxesFast<11>(old_axes, inputJets, accuracy);
+      case 12: return UpdateAxesFast<12>(old_axes, inputJets, accuracy);
+      case 13: return UpdateAxesFast<13>(old_axes, inputJets, accuracy);
+      case 14: return UpdateAxesFast<14>(old_axes, inputJets, accuracy);
+      case 15: return UpdateAxesFast<15>(old_axes, inputJets, accuracy);
+      case 16: return UpdateAxesFast<16>(old_axes, inputJets, accuracy);
+      case 17: return UpdateAxesFast<17>(old_axes, inputJets, accuracy);
+      case 18: return UpdateAxesFast<18>(old_axes, inputJets, accuracy);
+      case 19: return UpdateAxesFast<19>(old_axes, inputJets, accuracy);
+      case 20: return UpdateAxesFast<20>(old_axes, inputJets, accuracy);
+      default: std::cout << "N-jettiness is hard-coded to only allow up to 20 jets!" << std::endl;
+         return std::vector<LightLikeAxis>();
+   }
+
+}
+
+// uses minimization of N-jettiness to continually update axes until convergence.
+// The function returns the axes found at the (local) minimum
+std::vector<fastjet::PseudoJet> DefaultMeasure::get_one_pass_axes(int n_jets,
+                                                                  const std::vector <fastjet::PseudoJet> & inputJets,
+                                                                  const std::vector<fastjet::PseudoJet>& seedAxes,
+                                                                  int nAttempts,
+                                                                  double accuracy
+                                                                  ) const {
+
+   // if the measure type doesn't use the pt_R metric, then the standard minimization scheme should be used   
+   if (_measure_type != pt_R) {
+      return MeasureDefinition::get_one_pass_axes(n_jets, inputJets, seedAxes, nAttempts, accuracy);
+   }
+
+   // convert from PseudoJets to LightLikeAxes
+   std::vector< LightLikeAxis > old_axes(n_jets, LightLikeAxis(0,0,0,0));
+   for (int k = 0; k < n_jets; k++) {
+      old_axes[k].set_rap( seedAxes[k].rap() );
+      old_axes[k].set_phi( seedAxes[k].phi() );
+   }
+   
+   // Find new axes by iterating (only one pass here)
+   std::vector< LightLikeAxis > new_axes(n_jets, LightLikeAxis(0,0,0,0));
+   double cmp = std::numeric_limits<double>::max();  //large number
+   int h = 0;
+
+   while (cmp > accuracy && h < nAttempts) { // Keep updating axes until near-convergence or too many update steps
+      cmp = 0.0;
+      h++;
+      new_axes = UpdateAxes(old_axes, inputJets,accuracy); // Update axes
+      for (int k = 0; k < n_jets; k++) {
+         cmp += old_axes[k].Distance(new_axes[k]);
+      }
+      cmp = cmp / ((double) n_jets);
+      old_axes = new_axes;
+   }
+      
+   // Convert from internal LightLikeAxes to PseudoJet
+   std::vector<fastjet::PseudoJet> outputAxes;
+   for (int k = 0; k < n_jets; k++) {
+      fastjet::PseudoJet temp = old_axes[k].ConvertToPseudoJet();
+      outputAxes.push_back(temp);
+   }
+   
+   // this is used to debug the minimization routine to make sure that it works.
+   bool do_debug = false;
+   if (do_debug) {
+      // get this information to make sure that minimization is working properly
+      double seed_tau = result(inputJets, seedAxes);
+      double outputTau = result(inputJets, outputAxes);
+      assert(outputTau <= seed_tau);
+   }
+   
+   return outputAxes;
+}
+   
+//// One-pass minimization for the Deprecated Geometric Measure
+//// Uses minimization of the geometric distance in order to find the minimum axes.
+//// It continually updates until it reaches convergence or it reaches the maximum number of attempts.
+//// This is essentially the same as a stable cone finder.
+//std::vector<fastjet::PseudoJet> DeprecatedGeometricCutoffMeasure::get_one_pass_axes(int n_jets,
+//                                                                                    const std::vector <fastjet::PseudoJet> & particles,
+//                                                                                    const std::vector<fastjet::PseudoJet>& currentAxes,
+//                                                                                    int nAttempts,
+//                                                                                    double accuracy) const {
+//
+//   assert(n_jets == (int)currentAxes.size()); //added int casting to get rid of compiler warning
+//   
+//   std::vector<fastjet::PseudoJet> seedAxes = currentAxes;
+//   double seedTau = result(particles, seedAxes);
+//   
+//   for (int i = 0; i < nAttempts; i++) {
+//      
+//      std::vector<fastjet::PseudoJet> newAxes(seedAxes.size(),fastjet::PseudoJet(0,0,0,0));
+//      
+//      // find closest axis and assign to that
+//      for (unsigned int i = 0; i < particles.size(); i++) {
+//         
+//         // start from unclustered beam measure
+//         int minJ = -1;
+//         double minDist = beam_distance_squared(particles[i]);
+//         
+//         // which axis am I closest to?
+//         for (unsigned int j = 0; j < seedAxes.size(); j++) {
+//            double tempDist = jet_distance_squared(particles[i],seedAxes[j]);
+//            if (tempDist < minDist) {
+//               minDist = tempDist;
+//               minJ = j;
+//            }
+//         }
+//         
+//         // if not unclustered, then cluster
+//         if (minJ != -1) newAxes[minJ] += particles[i];
+//      }
+//
+//      // calculate tau on new axes
+//      seedAxes = newAxes;
+//      double tempTau = result(particles, newAxes);
+//      
+//      // close enough to stop?
+//      if (fabs(tempTau - seedTau) < accuracy) break;
+//      seedTau = tempTau;
+//   }
+//   
+//   return seedAxes;
+//}
+
+
+// Go from internal LightLikeAxis to PseudoJet
+fastjet::PseudoJet LightLikeAxis::ConvertToPseudoJet() {
+    double px, py, pz, E;
+    E = _mom;
+    pz = (std::exp(2.0*_rap) - 1.0) / (std::exp(2.0*_rap) + 1.0) * E;
+    px = std::cos(_phi) * std::sqrt( std::pow(E,2) - std::pow(pz,2) );
+    py = std::sin(_phi) * std::sqrt( std::pow(E,2) - std::pow(pz,2) );
+    return fastjet::PseudoJet(px,py,pz,E);
+}
+
+} //namespace contrib
+
+FASTJET_END_NAMESPACE
Index: external/fastjet/contribs/Nsubjettiness/MeasureDefinition.hh
===================================================================
--- external/fastjet/contribs/Nsubjettiness/MeasureDefinition.hh	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
+++ external/fastjet/contribs/Nsubjettiness/MeasureDefinition.hh	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -0,0 +1,853 @@
+//  Nsubjettiness Package
+//  Questions/Comments?  jthaler@jthaler.net
+//
+//  Copyright (c) 2011-14
+//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
+//
+//  $Id: MeasureDefinition.hh 828 2015-07-20 14:52:06Z jthaler $
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#ifndef __FASTJET_CONTRIB_MEASUREDEFINITION_HH__
+#define __FASTJET_CONTRIB_MEASUREDEFINITION_HH__
+
+#include "fastjet/PseudoJet.hh"
+#include <cmath>
+#include <vector>
+#include <list>
+#include <limits>
+
+#include "TauComponents.hh"
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+namespace contrib{
+
+
+
+// The following Measures are available (and their relevant arguments):
+// Recommended for usage as jet shapes
+class DefaultMeasure;               // Default measure from which next classes derive (should not be called directly)
+class NormalizedMeasure;            // (beta,R0)
+class UnnormalizedMeasure;          // (beta)
+class NormalizedCutoffMeasure;      // (beta,R0,Rcutoff)
+class UnnormalizedCutoffMeasure;    // (beta,Rcutoff)
+
+// New measures as of v2.2
+// Recommended for usage as event shapes (or for jet finding)
+class ConicalMeasure;               // (beta,R)
+class OriginalGeometricMeasure;     // (R)
+class ModifiedGeometricMeasure;     // (R)
+class ConicalGeometricMeasure;      // (beta, gamma, R)
+class XConeMeasure;                 // (beta, R)
+   
+// Formerly GeometricMeasure, now no longer recommended, kept commented out only for cross-check purposes
+//class DeprecatedGeometricMeasure;         // (beta)
+//class DeprecatedGeometricCutoffMeasure;   // (beta,Rcutoff)
+
+   
+///////
+//
+// MeasureDefinition
+//
+///////
+
+//This is a helper class for the Minimum Axes Finders. It is defined later.
+class LightLikeAxis;                                          
+   
+///------------------------------------------------------------------------
+/// \class MeasureDefinition
+/// \brief Base class for measure definitions
+///
+/// This is the base class for measure definitions.  Derived classes will calculate
+/// the tau_N of a jet given a specific measure and a set of axes.  The measure is
+/// determined by various jet and beam distances (and possible normalization factors).
+///------------------------------------------------------------------------
+class MeasureDefinition {
+   
+public:
+   
+   /// Description of measure and parameters
+   virtual std::string description() const = 0;
+   
+   /// In derived classes, this should return a copy of the corresponding derived class
+   virtual MeasureDefinition* create() const = 0;
+
+   //The following five functions define the measure by which tau_N is calculated,
+   //and are overloaded by the various measures below
+   
+   /// Distanes to jet axis.  This is called many times, so needs to be as fast as possible
+   /// Unless overloaded, it just calls jet_numerator
+   virtual double jet_distance_squared(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const {
+      return jet_numerator(particle,axis);
+   }
+
+   /// Distanes to beam.  This is called many times, so needs to be as fast as possible
+   /// Unless overloaded, it just calls beam_numerator
+   virtual double beam_distance_squared(const fastjet::PseudoJet& particle) const {
+      return beam_numerator(particle);
+   }
+   
+   /// The jet measure used in N-(sub)jettiness
+   virtual double jet_numerator(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const = 0;
+   /// The beam measure used in N-(sub)jettiness
+   virtual double beam_numerator(const fastjet::PseudoJet& particle) const = 0;
+   
+   /// A possible normalization factor
+   virtual double denominator(const fastjet::PseudoJet& particle) const = 0;
+   
+   /// Run a one-pass minimization routine.  There is a generic one-pass minimization that works for a wide variety of measures.
+   /// This should be overloaded to create a measure-specific minimization scheme
+   virtual std::vector<fastjet::PseudoJet> get_one_pass_axes(int n_jets,
+                                                             const std::vector<fastjet::PseudoJet>& inputs,
+                                                             const std::vector<fastjet::PseudoJet>& seedAxes,
+                                                             int nAttempts = 1000,         // cap number of iterations
+                                                             double accuracy = 0.0001      // cap distance of closest approach
+   ) const;
+   
+public:
+   
+   /// Returns the tau value for a give set of particles and axes
+   double result(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes) const {
+      return component_result(particles,axes).tau();
+   }
+   
+   /// Short-hand for the result() function
+   inline double operator() (const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes) const {
+      return result(particles,axes);
+   }
+   
+   /// Return all of the TauComponents for specific input particles and axes
+   TauComponents component_result(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes) const;
+   
+   /// Create the partitioning according the jet/beam distances and stores them a TauPartition
+   TauPartition get_partition(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes) const;
+
+   /// Calculate the tau result using an existing partition
+   TauComponents component_result_from_partition(const TauPartition& partition, const std::vector<fastjet::PseudoJet>& axes) const;
+
+   
+
+   /// virtual destructor
+   virtual ~MeasureDefinition(){}
+   
+protected:
+   
+   /// Flag set by derived classes to choose whether or not to use beam/denominator
+   TauMode _tau_mode;
+   
+   /// Flag set by derived classes to say whether cheap get_one_pass_axes method can be used (true by default)
+   bool _useAxisScaling;
+
+   /// This is the only constructor, which requires _tau_mode and _useAxisScaling to be manually set by derived classes.
+   MeasureDefinition() : _tau_mode(UNDEFINED_SHAPE), _useAxisScaling(true) {}
+
+   
+   /// Used by derived classes to set whether or not to use beam/denominator information
+   void setTauMode(TauMode tau_mode) {
+      _tau_mode = tau_mode;
+   }
+
+   /// Used by derived classes to say whether one can use cheap get_one_pass_axes
+   void setAxisScaling(bool useAxisScaling) {
+      _useAxisScaling = useAxisScaling;
+   }
+
+   /// Uses denominator information?
+   bool has_denominator() const { return (_tau_mode == NORMALIZED_JET_SHAPE || _tau_mode == NORMALIZED_EVENT_SHAPE);}
+   /// Uses beam information?
+   bool has_beam() const {return (_tau_mode == UNNORMALIZED_EVENT_SHAPE || _tau_mode == NORMALIZED_EVENT_SHAPE);}
+
+   /// Create light-like axis (used in default one-pass minimization routine)
+   fastjet::PseudoJet lightFrom(const fastjet::PseudoJet& input) const {
+      double length = sqrt(pow(input.px(),2) + pow(input.py(),2) + pow(input.pz(),2));
+      return fastjet::PseudoJet(input.px()/length,input.py()/length,input.pz()/length,1.0);
+   }
+   
+   /// Shorthand for squaring
+   static inline double sq(double x) {return x*x;}
+
+};
+   
+
+///////
+//
+// Default Measures
+//
+///////
+   
+   
+///------------------------------------------------------------------------
+/// \enum DefaultMeasureType
+/// \brief Options for default measure
+///
+/// Can be used to switch between pp and ee measure types in the DefaultMeasure
+///------------------------------------------------------------------------
+enum DefaultMeasureType {
+   pt_R,       ///  use transverse momenta and boost-invariant angles,
+   E_theta,    ///  use energies and angles,
+   lorentz_dot, ///  use dot product inspired measure
+   perp_lorentz_dot /// use conical geometric inspired measures
+};
+
+///------------------------------------------------------------------------
+/// \class DefaultMeasure
+/// \brief Base class for default N-subjettiness measure definitions
+///
+/// This class is the default measure as defined in the original N-subjettiness papers.
+/// Based on the conical measure, but with a normalization factor
+/// This measure is defined as the pT of the particle multiplied by deltaR
+/// to the power of beta. This class includes the normalization factor determined by R0
+///------------------------------------------------------------------------
+class DefaultMeasure : public MeasureDefinition {
+   
+public:
+
+   /// Description
+   virtual std::string description() const;
+   /// To allow copying around of these objects
+   virtual DefaultMeasure* create() const {return new DefaultMeasure(*this);}
+
+   /// fast jet distance
+   virtual double jet_distance_squared(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const {
+      return angleSquared(particle, axis);
+   }
+   
+   /// fast beam distance
+   virtual double beam_distance_squared(const fastjet::PseudoJet& /*particle*/) const {
+      return _RcutoffSq;
+   }
+   
+   /// true jet distance (given by general definitions of energy and angle)
+   virtual double jet_numerator(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const{
+      double jet_dist = angleSquared(particle, axis);
+      if (jet_dist > 0.0) {
+         return energy(particle) * std::pow(jet_dist,_beta/2.0);
+      } else {
+         return 0.0;
+      }
+   }
+   
+   /// true beam distance
+   virtual double beam_numerator(const fastjet::PseudoJet& particle) const {
+      return energy(particle) * std::pow(_Rcutoff,_beta);
+   }
+   
+   /// possible denominator for normalization
+   virtual double denominator(const fastjet::PseudoJet& particle) const {
+      return energy(particle) * std::pow(_R0,_beta);
+   }
+
+   /// Special minimization routine (from v1.0 of N-subjettiness)
+   virtual std::vector<fastjet::PseudoJet> get_one_pass_axes(int n_jets,
+                                                             const std::vector<fastjet::PseudoJet>& inputs,
+                                                             const std::vector<fastjet::PseudoJet>& seedAxes,
+                                                             int nAttempts,   // cap number of iterations
+                                                             double accuracy  // cap distance of closest approach
+                                                             ) const;
+   
+protected:
+   double _beta;      ///< Angular exponent
+   double _R0;        ///< Normalization factor
+   double _Rcutoff;   ///< Cutoff radius
+   double _RcutoffSq; ///< Cutoff radius squared
+   DefaultMeasureType _measure_type;  ///< Type of measure used (i.e. pp style or ee style)
+   
+   
+   /// Constructor is protected so that no one tries to call this directly.
+   DefaultMeasure(double beta, double R0, double Rcutoff, DefaultMeasureType measure_type = pt_R)
+   : MeasureDefinition(), _beta(beta), _R0(R0), _Rcutoff(Rcutoff), _RcutoffSq(sq(Rcutoff)), _measure_type(measure_type)
+   {
+      if (beta <= 0) throw Error("DefaultMeasure:  You must choose beta > 0.");
+      if (R0 <= 0) throw Error("DefaultMeasure:  You must choose R0 > 0.");
+      if (Rcutoff <= 0) throw Error("DefaultMeasure:  You must choose Rcutoff > 0.");
+   }
+   
+   /// Added set measure method in case it becomes useful later
+   void setDefaultMeasureType(DefaultMeasureType measure_type) {
+      _measure_type = measure_type;
+   }
+
+   /// Generalized energy value (determined by _measure_type)
+   double energy(const PseudoJet& jet) const;
+   /// Generalized angle value (determined by _measure_type)
+   double angleSquared(const PseudoJet& jet1, const PseudoJet& jet2) const;
+
+   /// Name of _measure_type, so description will include the measure type
+   std::string measure_type_name() const {
+      if (_measure_type == pt_R) return "pt_R";
+      else if (_measure_type == E_theta) return "E_theta";
+      else if (_measure_type == lorentz_dot) return "lorentz_dot";
+      else if (_measure_type == perp_lorentz_dot) return "perp_lorentz_dot";
+      else return "Measure Type Undefined";
+   }      
+
+   /// templated for speed (TODO: probably should remove, since not clear that there is a speed gain)
+   template <int N> std::vector<LightLikeAxis> UpdateAxesFast(const std::vector <LightLikeAxis> & old_axes,
+                                                              const std::vector <fastjet::PseudoJet> & inputJets,
+                                                              double accuracy) const;
+   
+   /// called by get_one_pass_axes to update axes iteratively
+   std::vector<LightLikeAxis> UpdateAxes(const std::vector <LightLikeAxis> & old_axes,
+                                         const std::vector <fastjet::PseudoJet> & inputJets,
+                                         double accuracy) const;
+};
+   
+
+///------------------------------------------------------------------------
+/// \class NormalizedCutoffMeasure
+/// \brief Dimensionless default measure, with radius cutoff
+///
+/// This measure is just a wrapper for DefaultMeasure
+///------------------------------------------------------------------------
+class NormalizedCutoffMeasure : public DefaultMeasure {
+
+public:
+
+   /// Constructor
+   NormalizedCutoffMeasure(double beta, double R0, double Rcutoff, DefaultMeasureType measure_type = pt_R) 
+   : DefaultMeasure(beta, R0, Rcutoff, measure_type) {
+      setTauMode(NORMALIZED_JET_SHAPE);
+   }
+
+   /// Description
+   virtual std::string description() const;
+
+   /// For copying purposes
+   virtual NormalizedCutoffMeasure* create() const {return new NormalizedCutoffMeasure(*this);}
+
+};
+
+///------------------------------------------------------------------------
+/// \class NormalizedMeasure
+/// \brief Dimensionless default measure, with no cutoff
+///
+/// This measure is the same as NormalizedCutoffMeasure, with Rcutoff taken to infinity.
+///------------------------------------------------------------------------
+class NormalizedMeasure : public NormalizedCutoffMeasure {
+
+public:
+
+   /// Constructor
+   NormalizedMeasure(double beta, double R0, DefaultMeasureType measure_type = pt_R)
+   : NormalizedCutoffMeasure(beta, R0, std::numeric_limits<double>::max(), measure_type) {
+      _RcutoffSq = std::numeric_limits<double>::max();
+      setTauMode(NORMALIZED_JET_SHAPE);
+   }
+   
+   /// Description
+   virtual std::string description() const;
+   /// For copying purposes
+   virtual NormalizedMeasure* create() const {return new NormalizedMeasure(*this);}
+
+};
+   
+
+///------------------------------------------------------------------------
+/// \class UnnormalizedCutoffMeasure
+/// \brief Dimensionful default measure, with radius cutoff
+///
+/// This class is the unnormalized conical measure. The only difference from NormalizedCutoffMeasure
+/// is that the denominator is defined to be 1.0 by setting _has_denominator to false.
+/// class UnnormalizedCutoffMeasure : public NormalizedCutoffMeasure {
+///------------------------------------------------------------------------
+class UnnormalizedCutoffMeasure : public DefaultMeasure {
+   
+public:
+   
+   /// Since all methods are identical, UnnormalizedMeasure inherits directly
+   /// from NormalizedMeasure. R0 is a dummy value since the value of R0 is unecessary for this class,
+   /// and the "false" flag sets _has_denominator in MeasureDefinition to false so no denominator is used.
+   UnnormalizedCutoffMeasure(double beta, double Rcutoff, DefaultMeasureType measure_type = pt_R)
+   : DefaultMeasure(beta, std::numeric_limits<double>::quiet_NaN(), Rcutoff, measure_type) {
+      setTauMode(UNNORMALIZED_EVENT_SHAPE);
+   }
+
+   /// Description
+   virtual std::string description() const;
+   /// For copying purposes
+   virtual UnnormalizedCutoffMeasure* create() const {return new UnnormalizedCutoffMeasure(*this);}
+
+};
+
+   
+///------------------------------------------------------------------------
+/// \class UnnormalizedMeasure
+/// \brief Dimensionless default measure, with no cutoff
+///
+/// This measure is the same as UnnormalizedCutoffMeasure, with Rcutoff taken to infinity.
+///------------------------------------------------------------------------
+class UnnormalizedMeasure : public UnnormalizedCutoffMeasure {
+   
+public:
+   /// Since all methods are identical, UnnormalizedMeasure inherits directly
+   /// from NormalizedMeasure. R0 is a dummy value since the value of R0 is unecessary for this class,
+   /// and the "false" flag sets _has_denominator in MeasureDefinition to false so no denominator is used.
+   UnnormalizedMeasure(double beta, DefaultMeasureType measure_type = pt_R)
+   : UnnormalizedCutoffMeasure(beta, std::numeric_limits<double>::max(), measure_type) {
+      _RcutoffSq = std::numeric_limits<double>::max();
+      setTauMode(UNNORMALIZED_JET_SHAPE);
+   }
+
+   /// Description
+   virtual std::string description() const;
+   
+   /// For copying purposes
+   virtual UnnormalizedMeasure* create() const {return new UnnormalizedMeasure(*this);}
+   
+};
+
+
+///------------------------------------------------------------------------
+/// \class ConicalMeasure
+/// \brief Dimensionful event-shape measure, with radius cutoff
+///
+/// Very similar to UnnormalizedCutoffMeasure, but with different normalization convention
+/// and using the new default one-pass minimization algorithm.
+/// Axes are also made to be light-like to ensure sensible behavior
+/// Intended to be used as an event shape.
+///------------------------------------------------------------------------
+class ConicalMeasure : public MeasureDefinition {
+   
+public:
+   
+   /// Constructor
+   ConicalMeasure(double beta, double Rcutoff)
+   :   MeasureDefinition(), _beta(beta), _Rcutoff(Rcutoff), _RcutoffSq(sq(Rcutoff)) {
+      if (beta <= 0) throw Error("ConicalMeasure:  You must choose beta > 0.");
+      if (Rcutoff <= 0) throw Error("ConicalMeasure:  You must choose Rcutoff > 0.");
+      setTauMode(UNNORMALIZED_EVENT_SHAPE);
+   }
+   
+   /// Description
+   virtual std::string description() const;
+   /// For copying purposes
+   virtual ConicalMeasure* create() const {return new ConicalMeasure(*this);}
+   
+   /// fast jet distance
+   virtual double jet_distance_squared(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const {
+      PseudoJet lightAxis = lightFrom(axis);
+      return particle.squared_distance(lightAxis);
+   }
+   
+   /// fast beam distance
+   virtual double beam_distance_squared(const fastjet::PseudoJet&  /*particle*/) const {
+      return _RcutoffSq;
+   }
+   
+   
+   /// true jet distance
+   virtual double jet_numerator(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const {
+      PseudoJet lightAxis = lightFrom(axis);
+      double jet_dist = particle.squared_distance(lightAxis)/_RcutoffSq;
+      double jet_perp = particle.perp();
+      
+      if (_beta == 2.0) {
+         return jet_perp * jet_dist;
+      } else {
+         return jet_perp * pow(jet_dist,_beta/2.0);
+      }
+   }
+   
+   /// true beam distance
+   virtual double beam_numerator(const fastjet::PseudoJet& particle) const {
+      return particle.perp();
+   }
+   
+   /// no denominator used for this measure
+   virtual double denominator(const fastjet::PseudoJet&  /*particle*/) const {
+      return std::numeric_limits<double>::quiet_NaN();
+   }
+   
+protected:
+   double _beta;     ///< angular exponent
+   double _Rcutoff;  ///< effective jet radius
+   double _RcutoffSq;///< effective jet radius squared
+};
+   
+
+
+///------------------------------------------------------------------------
+/// \class OriginalGeometricMeasure
+/// \brief Dimensionful event-shape measure, with dot-product distances
+///
+/// This class is the original (and hopefully now correctly coded) geometric measure.
+/// This measure is defined by the Lorentz dot product between
+/// the particle and the axis.  This class does not include normalization of tau_N.
+/// New in Nsubjettiness v2.2
+/// NOTE: This is defined differently from the DeprecatedGeometricMeasure which are now commented out.
+///------------------------------------------------------------------------
+class OriginalGeometricMeasure : public MeasureDefinition {
+
+public:
+   /// Constructor
+   OriginalGeometricMeasure(double Rcutoff)
+   : MeasureDefinition(), _Rcutoff(Rcutoff), _RcutoffSq(sq(Rcutoff)) {
+      if (Rcutoff <= 0) throw Error("OriginalGeometricMeasure:  You must choose Rcutoff > 0.");
+      setTauMode(UNNORMALIZED_EVENT_SHAPE);
+      setAxisScaling(false);  // No need to rescale axes (for speed up in one-pass minimization)
+   }
+
+   /// Description
+   virtual std::string description() const;
+   /// For copying purposes
+   virtual OriginalGeometricMeasure* create() const {return new OriginalGeometricMeasure(*this);}
+   
+   // This class uses the default jet_distance_squared and beam_distance_squared
+
+   /// true jet measure
+   virtual double jet_numerator(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const {
+      return dot_product(lightFrom(axis), particle)/_RcutoffSq;
+   }
+
+   /// true beam measure
+   virtual double beam_numerator(const fastjet::PseudoJet& particle) const {
+      fastjet::PseudoJet beam_a(0,0,1,1);
+      fastjet::PseudoJet beam_b(0,0,-1,1);
+      double min_perp = std::min(dot_product(beam_a, particle),dot_product(beam_b, particle));
+      return min_perp;
+   }
+
+   /// no denominator needed for this measure.
+   virtual double denominator(const fastjet::PseudoJet&  /*particle*/) const {
+      return std::numeric_limits<double>::quiet_NaN();
+   }
+   
+protected:
+   double _Rcutoff;   ///< Effective jet radius (rho = R^2)
+   double _RcutoffSq; ///< Effective jet radius squared
+
+};
+
+
+///------------------------------------------------------------------------
+/// \class ModifiedGeometricMeasure
+/// \brief Dimensionful event-shape measure, with dot-product distances, modified beam measure
+///
+/// This class is the Modified geometric measure.  This jet measure is defined by the Lorentz dot product between
+/// the particle and the axis, as in the Original Geometric Measure. The beam measure is defined differently from
+/// the above OriginalGeometric to allow for more conical jets. New in Nsubjettiness v2.2
+///------------------------------------------------------------------------
+class ModifiedGeometricMeasure : public MeasureDefinition {
+
+public:
+   /// Constructor
+   ModifiedGeometricMeasure(double Rcutoff)
+   :  MeasureDefinition(), _Rcutoff(Rcutoff), _RcutoffSq(sq(Rcutoff)) {
+      if (Rcutoff <= 0) throw Error("ModifiedGeometricMeasure:  You must choose Rcutoff > 0.");
+      setTauMode(UNNORMALIZED_EVENT_SHAPE);
+      setAxisScaling(false);  // No need to rescale axes (for speed up in one-pass minimization)
+   }
+
+   /// Description
+   virtual std::string description() const;
+   /// For copying purposes
+   virtual ModifiedGeometricMeasure* create() const {return new ModifiedGeometricMeasure(*this);}
+   
+   // This class uses the default jet_distance_squared and beam_distance_squared
+
+   /// True jet measure
+   virtual double jet_numerator(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const {
+      return dot_product(lightFrom(axis), particle)/_RcutoffSq;
+   }
+
+   /// True beam measure
+   virtual double beam_numerator(const fastjet::PseudoJet& particle) const {
+      fastjet::PseudoJet lightParticle = lightFrom(particle);
+      return 0.5*particle.mperp()*lightParticle.pt();
+   }
+
+   /// This measure does not require a denominator
+   virtual double denominator(const fastjet::PseudoJet&  /*particle*/) const {
+      return std::numeric_limits<double>::quiet_NaN();
+   }
+   
+protected:
+   double _Rcutoff;   ///< Effective jet radius (rho = R^2)
+   double _RcutoffSq; ///< Effective jet radius squared
+
+
+};
+
+///------------------------------------------------------------------------
+/// \class ConicalGeometricMeasure
+/// \brief Dimensionful event-shape measure, basis for XCone jet algorithm
+///
+/// This class is the Conical Geometric measure.  This measure is defined by the Lorentz dot product between
+/// the particle and the axis normalized by the axis and particle pT, as well as a factor of cosh(y) to vary
+/// the rapidity depepdence of the beam. New in Nsubjettiness v2.2, and the basis for the XCone jet algorithm
+///------------------------------------------------------------------------
+class ConicalGeometricMeasure : public MeasureDefinition {
+
+public:
+   
+   /// Constructor
+   ConicalGeometricMeasure(double jet_beta, double beam_gamma, double Rcutoff)
+   :  MeasureDefinition(),  _jet_beta(jet_beta), _beam_gamma(beam_gamma), _Rcutoff(Rcutoff), _RcutoffSq(sq(Rcutoff)){
+      if (jet_beta <= 0)   throw Error("ConicalGeometricMeasure:  You must choose beta > 0.");
+      if (beam_gamma <= 0) throw Error("ConicalGeometricMeasure:  You must choose gamma > 0.");
+      if (Rcutoff <= 0)   throw Error("ConicalGeometricMeasure:  You must choose Rcutoff > 0.");
+      setTauMode(UNNORMALIZED_EVENT_SHAPE);
+   }
+
+   /// Description
+   virtual std::string description() const;
+   /// For copying purposes
+   virtual ConicalGeometricMeasure* create() const {return new ConicalGeometricMeasure(*this);}
+   
+   /// fast jet measure
+   virtual double jet_distance_squared(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const {
+      fastjet::PseudoJet lightAxis = lightFrom(axis);
+      double pseudoRsquared = 2.0*dot_product(lightFrom(axis),particle)/(lightAxis.pt()*particle.pt());
+      return pseudoRsquared;
+   }
+
+   /// fast beam measure
+   virtual double beam_distance_squared(const fastjet::PseudoJet&  /*particle*/) const {
+      return _RcutoffSq;
+   }
+
+   /// true jet measure
+   virtual double jet_numerator(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const {
+      double jet_dist = jet_distance_squared(particle,axis)/_RcutoffSq;
+      if (jet_dist > 0.0) {
+         fastjet::PseudoJet lightParticle = lightFrom(particle);
+         double weight = (_beam_gamma == 1.0) ? 1.0 : std::pow(0.5*lightParticle.pt(),_beam_gamma - 1.0);
+         return particle.pt() * weight * std::pow(jet_dist,_jet_beta/2.0);
+      } else {
+         return 0.0;
+      }
+   }
+
+   /// true beam measure
+   virtual double beam_numerator(const fastjet::PseudoJet& particle) const {
+      fastjet::PseudoJet lightParticle = lightFrom(particle);
+      double weight = (_beam_gamma == 1.0) ? 1.0 : std::pow(0.5*lightParticle.pt(),_beam_gamma - 1.0);
+      return particle.pt() * weight;
+   }
+
+   /// no denominator needed
+   virtual double denominator(const fastjet::PseudoJet&  /*particle*/) const {
+      return std::numeric_limits<double>::quiet_NaN();
+   }
+      
+protected:
+   double _jet_beta;   ///< jet angular exponent
+   double _beam_gamma; ///< beam angular exponent (gamma = 1.0 is recommended)
+   double _Rcutoff;    ///< effective jet radius
+   double _RcutoffSq;  ///< effective jet radius squared
+   
+};
+
+///------------------------------------------------------------------------
+/// \class XConeMeasure
+/// \brief Dimensionful event-shape measure used in XCone jet algorithm
+///
+/// This class is the XCone Measure.  This is the default measure for use with the
+/// XCone algorithm. It is identical to the conical geometric measure but with gamma = 1.0.
+///------------------------------------------------------------------------
+class XConeMeasure : public ConicalGeometricMeasure {
+
+public:
+   /// Constructor
+   XConeMeasure(double jet_beta, double R)
+   :   ConicalGeometricMeasure(jet_beta,
+                               1.0, // beam_gamma, hard coded at gamma = 1.0 default
+                               R    // Rcutoff scale
+                               ) { }
+
+   /// Description
+   virtual std::string description() const;
+   /// For copying purposes
+   virtual XConeMeasure* create() const {return new XConeMeasure(*this);}
+
+};
+
+///------------------------------------------------------------------------
+/// \class LightLikeAxis
+/// \brief Helper class to define light-like axes directions
+///
+/// This is a helper class for the minimization routines.
+/// It creates a convenient way of defining axes in order to better facilitate calculations.
+///------------------------------------------------------------------------
+class LightLikeAxis {
+
+public:
+   /// Bare constructor
+   LightLikeAxis() : _rap(0.0), _phi(0.0), _weight(0.0), _mom(0.0) {}
+   /// Constructor
+   LightLikeAxis(double my_rap, double my_phi, double my_weight, double my_mom) :
+   _rap(my_rap), _phi(my_phi), _weight(my_weight), _mom(my_mom) {}
+   
+   /// Rapidity
+   double rap() const {return _rap;}
+   /// Azimuth
+   double phi() const {return _phi;}
+   /// weight factor
+   double weight() const {return _weight;}
+   /// pt momentum
+   double mom() const {return _mom;}
+   
+   /// set rapidity
+   void set_rap(double my_set_rap) {_rap = my_set_rap;}
+   /// set azimuth
+   void set_phi(double my_set_phi) {_phi = my_set_phi;}
+   /// set weight factor
+   void set_weight(double my_set_weight) {_weight = my_set_weight;}
+   /// set pt momentum
+   void set_mom(double my_set_mom) {_mom = my_set_mom;}
+   /// set all kinematics
+   void reset(double my_rap, double my_phi, double my_weight, double my_mom) {_rap=my_rap; _phi=my_phi; _weight=my_weight; _mom=my_mom;}
+
+   /// Return PseudoJet version
+   fastjet::PseudoJet ConvertToPseudoJet();
+   
+   /// Squared distance to PseudoJet
+   double DistanceSq(const fastjet::PseudoJet& input) const {
+      return DistanceSq(input.rap(),input.phi());
+   }
+
+   /// Distance to PseudoJet
+   double Distance(const fastjet::PseudoJet& input) const {
+      return std::sqrt(DistanceSq(input));
+   }
+
+   /// Squared distance to Lightlikeaxis
+   double DistanceSq(const LightLikeAxis& input) const {
+      return DistanceSq(input.rap(),input.phi());
+   }
+
+   /// Distance to Lightlikeaxis
+   double Distance(const LightLikeAxis& input) const {
+      return std::sqrt(DistanceSq(input));
+   }
+
+private:
+   double _rap;    ///< rapidity
+   double _phi;    ///< azimuth
+   double _weight; ///< weight factor
+   double _mom;    ///< pt momentum
+   
+   /// Internal squared distance calculation
+   double DistanceSq(double rap2, double phi2) const {
+      double rap1 = _rap;
+      double phi1 = _phi;
+      
+      double distRap = rap1-rap2;
+      double distPhi = std::fabs(phi1-phi2);
+      if (distPhi > M_PI) {distPhi = 2.0*M_PI - distPhi;}
+      return distRap*distRap + distPhi*distPhi;
+   }
+   
+   /// Internal distance calculation
+   double Distance(double rap2, double phi2) const {
+      return std::sqrt(DistanceSq(rap2,phi2));
+   }
+      
+};
+   
+   
+////------------------------------------------------------------------------
+///// \class DeprecatedGeometricCutoffMeasure
+//// This class is the old, incorrectly coded geometric measure.
+//// It is kept in case anyone wants to check old code, but should not be used for production purposes.
+//class DeprecatedGeometricCutoffMeasure : public MeasureDefinition {
+//
+//public:
+//
+//   // Please, please don't use this.
+//   DeprecatedGeometricCutoffMeasure(double jet_beta, double Rcutoff)
+//   :   MeasureDefinition(),
+//      _jet_beta(jet_beta),
+//      _beam_beta(1.0), // This is hard coded, since alternative beta_beam values were never checked.
+//      _Rcutoff(Rcutoff),
+//      _RcutoffSq(sq(Rcutoff)) {
+//         setTauMode(UNNORMALIZED_EVENT_SHAPE);
+//         setAxisScaling(false);
+//         if (jet_beta != 2.0) {
+//         throw Error("Geometric minimization is currently only defined for beta = 2.0.");
+//      }
+//   }
+//
+//   virtual std::string description() const;
+//
+//   virtual DeprecatedGeometricCutoffMeasure* create() const {return new DeprecatedGeometricCutoffMeasure(*this);}
+//
+//   virtual double jet_distance_squared(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const {
+//      fastjet::PseudoJet lightAxis = lightFrom(axis);
+//      double pseudoRsquared = 2.0*dot_product(lightFrom(axis),particle)/(lightAxis.pt()*particle.pt());
+//      return pseudoRsquared;
+//   }
+//
+//   virtual double beam_distance_squared(const fastjet::PseudoJet&  /*particle*/) const {
+//      return _RcutoffSq;
+//   }
+//
+//   virtual double jet_numerator(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const {
+//      fastjet::PseudoJet lightAxis = lightFrom(axis);
+//      double weight = (_beam_beta == 1.0) ? 1.0 : std::pow(lightAxis.pt(),_beam_beta - 1.0);
+//      return particle.pt() * weight * std::pow(jet_distance_squared(particle,axis),_jet_beta/2.0);
+//   }
+//
+//   virtual double beam_numerator(const fastjet::PseudoJet& particle) const {
+//      double weight = (_beam_beta == 1.0) ? 1.0 : std::pow(particle.pt()/particle.e(),_beam_beta - 1.0);
+//      return particle.pt() * weight * std::pow(_Rcutoff,_jet_beta);
+//   }
+//
+//   virtual double denominator(const fastjet::PseudoJet&  /*particle*/) const {
+//      return std::numeric_limits<double>::quiet_NaN();
+//   }
+//
+//   virtual std::vector<fastjet::PseudoJet> get_one_pass_axes(int n_jets,
+//                                                             const std::vector<fastjet::PseudoJet>& inputs,
+//                                                             const std::vector<fastjet::PseudoJet>& seedAxes,
+//                                                             int nAttempts,    // cap number of iterations
+//                                                             double accuracy   // cap distance of closest approach
+//                                                            ) const;
+//
+//protected:
+//   double _jet_beta;
+//   double _beam_beta;
+//   double _Rcutoff;
+//   double _RcutoffSq;
+//
+//};
+//
+//// ------------------------------------------------------------------------
+//// / \class DeprecatedGeometricMeasure
+//// Same as DeprecatedGeometricMeasureCutoffMeasure, but with Rcutoff taken to infinity.
+//// NOTE:  This class should not be used for production purposes.
+//class DeprecatedGeometricMeasure : public DeprecatedGeometricCutoffMeasure {
+//
+//public:
+//   DeprecatedGeometricMeasure(double beta)
+//   : DeprecatedGeometricCutoffMeasure(beta,std::numeric_limits<double>::max()) {
+//      _RcutoffSq = std::numeric_limits<double>::max();
+//      setTauMode(UNNORMALIZED_JET_SHAPE);
+//   }
+//
+//   virtual std::string description() const;
+//
+//   virtual DeprecatedGeometricMeasure* create() const {return new DeprecatedGeometricMeasure(*this);}
+//};
+
+
+} //namespace contrib
+
+FASTJET_END_NAMESPACE
+
+#endif  // __FASTJET_CONTRIB_MEASUREDEFINITION_HH__
Index: external/fastjet/contribs/Nsubjettiness/MeasureFunction.cc
===================================================================
--- external/fastjet/contribs/Nsubjettiness/MeasureFunction.cc	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ 	(revision )
@@ -1,174 +1,0 @@
-//  Nsubjettiness Package
-//  Questions/Comments?  jthaler@jthaler.net
-//
-//  Copyright (c) 2011-14
-//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
-//
-//  $Id: MeasureFunction.cc 670 2014-06-06 01:24:42Z jthaler $
-//----------------------------------------------------------------------
-// This file is part of FastJet contrib.
-//
-// It is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2 of the License, or (at
-// your option) any later version.
-//
-// It is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
-// License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this code. If not, see <http://www.gnu.org/licenses/>.
-//----------------------------------------------------------------------
-
-
-#include "MeasureFunction.hh"
-
-FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
-
-namespace contrib{
-
-///////
-//
-// Measure Function
-//
-///////
-
-// Return all of the necessary TauComponents for specific input particles and axes
-TauComponents MeasureFunction::result(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes) const {
-   
-   // first find partition
-   // this sets jetPartitionStorage and beamPartitionStorage
-   PseudoJet beamPartitionStorage;
-   std::vector<fastjet::PseudoJet> jetPartitionStorage = get_partition(particles,axes,&beamPartitionStorage);
-   
-   // then return result calculated from partition
-   return result_from_partition(jetPartitionStorage,axes,&beamPartitionStorage);
-}
-
-std::vector<fastjet::PseudoJet> MeasureFunction::get_partition(const std::vector<fastjet::PseudoJet>& particles,
-                                                               const std::vector<fastjet::PseudoJet>& axes,
-                                                               PseudoJet * beamPartitionStorage) const {
-   
-   std::vector<std::vector<PseudoJet> > jetPartition(axes.size());
-   std::vector<PseudoJet> beamPartition;
-   
-   // Figures out the partiting of the input particles into the various jet pieces
-   // Based on which axis the parition is closest to
-   for (unsigned i = 0; i < particles.size(); i++) {
-      
-      // find minimum distance; start with beam (-1) for reference
-      int j_min = -1;
-      double minRsq;
-      if (_has_beam) minRsq = beam_distance_squared(particles[i]);
-      else minRsq = std::numeric_limits<double>::max(); // make it large value
-      
-      // check to see which axis the particle is closest to
-      for (unsigned j = 0; j < axes.size(); j++) {
-         double tempRsq = jet_distance_squared(particles[i],axes[j]); // delta R distance
-         if (tempRsq < minRsq) {
-            minRsq = tempRsq;
-            j_min = j;
-         }
-      }
-      
-      if (j_min == -1) {
-         if (_has_beam) beamPartition.push_back(particles[i]);
-         else assert(_has_beam);  // this should never happen.
-      } else {
-         jetPartition[j_min].push_back(particles[i]);
-      }
-   }
-   
-   // Store beam partition
-   if (beamPartitionStorage) {
-      *beamPartitionStorage = join(beamPartition);
-   }
-
-   // Store jet partitions
-   std::vector<PseudoJet> jetPartitionStorage(axes.size(),PseudoJet(0,0,0,0));
-   for (unsigned j = 0; j < axes.size(); j++) {
-      jetPartitionStorage[j] = join(jetPartition[j]);
-   }
-   
-   return jetPartitionStorage;
-}
-
-// does partition, but only stores index of PseudoJets
-std::vector<std::list<int> > MeasureFunction::get_partition_list(const std::vector<fastjet::PseudoJet>& particles,
-                                                                 const std::vector<fastjet::PseudoJet>& axes) const {
-
-   std::vector<std::list<int> > jetPartition(axes.size());
-   
-   // Figures out the partiting of the input particles into the various jet pieces
-   // Based on which axis the parition is closest to
-   for (unsigned i = 0; i < particles.size(); i++) {
-      
-      // find minimum distance; start with beam (-1) for reference
-      int j_min = -1;
-      double minRsq;
-      if (_has_beam) minRsq = beam_distance_squared(particles[i]);
-      else minRsq = std::numeric_limits<double>::max(); // make it large value
-      
-      // check to see which axis the particle is closest to
-      for (unsigned j = 0; j < axes.size(); j++) {
-         double tempRsq = jet_distance_squared(particles[i],axes[j]); // delta R distance
-         if (tempRsq < minRsq) {
-            minRsq = tempRsq;
-            j_min = j;
-         }
-      }
-      
-      if (j_min == -1) {
-         assert(_has_beam); // consistency check
-      } else {
-         jetPartition[j_min].push_back(i);
-      }
-   }
-   
-   return jetPartition;
-}
-   
-
-// Uses existing partition and calculates result
-// TODO:  Can we cache this for speed up when doing area subtraction?
-TauComponents MeasureFunction::result_from_partition(const std::vector<fastjet::PseudoJet>& jet_partition,
-                                                     const std::vector<fastjet::PseudoJet>& axes,
-                                                     PseudoJet * beamPartitionStorage) const {
-   
-   std::vector<double> jetPieces(axes.size(), 0.0);
-   double beamPiece = 0.0;
-   
-   double tauDen = 0.0;
-   if (!_has_denominator) tauDen = 1.0;  // if no denominator, then 1.0 for no normalization factor
-   
-   // first find jet pieces
-   for (unsigned j = 0; j < axes.size(); j++) {
-      std::vector<PseudoJet> thisPartition = jet_partition[j].constituents();
-      for (unsigned i = 0; i < thisPartition.size(); i++) {
-         jetPieces[j] += jet_numerator(thisPartition[i],axes[j]); //numerator jet piece
-         if (_has_denominator) tauDen += denominator(thisPartition[i]); // denominator
-      }
-   }
-   
-   // then find beam piece
-   if (_has_beam) {
-      assert(beamPartitionStorage); // make sure I have beam information
-      std::vector<PseudoJet> beamPartition = beamPartitionStorage->constituents();
-
-      for (unsigned i = 0; i < beamPartition.size(); i++) {
-         beamPiece += beam_numerator(beamPartition[i]); //numerator beam piece
-         if (_has_denominator) tauDen += denominator(beamPartition[i]); // denominator
-      }
-   }
-   return TauComponents(jetPieces, beamPiece, tauDen, _has_denominator, _has_beam);
-}
-
-   
-   
-   
-   
-} //namespace contrib
-
-FASTJET_END_NAMESPACE
Index: external/fastjet/contribs/Nsubjettiness/MeasureFunction.hh
===================================================================
--- external/fastjet/contribs/Nsubjettiness/MeasureFunction.hh	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ 	(revision )
@@ -1,298 +1,0 @@
-//  Nsubjettiness Package
-//  Questions/Comments?  jthaler@jthaler.net
-//
-//  Copyright (c) 2011-14
-//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
-//
-//  $Id: MeasureFunction.hh 678 2014-06-12 20:43:03Z jthaler $
-//----------------------------------------------------------------------
-// This file is part of FastJet contrib.
-//
-// It is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2 of the License, or (at
-// your option) any later version.
-//
-// It is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
-// License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this code. If not, see <http://www.gnu.org/licenses/>.
-//----------------------------------------------------------------------
-
-#ifndef __FASTJET_CONTRIB_MEASUREFUNCTION_HH__
-#define __FASTJET_CONTRIB_MEASUREFUNCTION_HH__
-
-#include "fastjet/PseudoJet.hh"
-#include <cmath>
-#include <vector>
-#include <list>
-#include <limits>
-
-
-FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
-
-namespace contrib{
-
-///////
-//
-// TauComponents
-// (eventually we might want to put this in a separate header file)
-//
-///////
-   
-/// \class TauComponents
-// This class creates a wrapper for the various tau/subtau values calculated in Njettiness. This class allows Njettiness access to these variables
-// without ever having to do the calculation itself. It takes in subtau numerators and tau denominator from MeasureFunction
-// and outputs tau numerator, and normalized tau and subtau.
-class TauComponents {
-   
-public:
-   // empty constructor necessary to initialize tau_components in Njettiness
-   // later set correctly in Njettiness::getTau function
-   TauComponents() {
-      _jet_pieces_numerator.resize(1, 0.0);
-      _beam_piece_numerator = 0.0;
-      _denominator = 0;
-      _numerator = 0;
-      _jet_pieces.resize(1, 0.0);
-      _beam_piece = 0.0;
-      _tau = 0;
-      _has_denominator = false;
-      _has_beam = false;
-   }
-   
-   // This constructor takes input vector and double and calculates all necessary tau components
-   TauComponents(std::vector<double> jet_pieces_numerator, double beam_piece_numerator, double denominator, bool has_denominator, bool has_beam)
-   : _jet_pieces_numerator(jet_pieces_numerator),
-   _beam_piece_numerator(beam_piece_numerator),
-   _denominator(denominator),
-   _has_denominator(has_denominator),
-   _has_beam(has_beam) {
-      
-      if (!_has_denominator) assert(_denominator == 1.0); //make sure no effect from _denominator if _has_denominator is false
-      if (!_has_beam) assert (_beam_piece_numerator == 0.0); //make sure no effect from _beam_piece_numerator if _has_beam is false
-      
-      _numerator = _beam_piece_numerator;
-      _jet_pieces.resize(_jet_pieces_numerator.size(),0.0);
-      for (unsigned j = 0; j < _jet_pieces_numerator.size(); j++) {
-         _jet_pieces[j] = _jet_pieces_numerator[j]/_denominator;
-         _numerator += _jet_pieces_numerator[j];
-      }
-      
-      _beam_piece = _beam_piece_numerator/_denominator;
-      _tau = _numerator/_denominator;
-   }
-   
-   
-   // return values
-   std::vector<double> jet_pieces_numerator() const { return _jet_pieces_numerator; }
-   double beam_piece_numerator() const { return _beam_piece_numerator; }
-   double denominator() const { return _denominator; }
-   double numerator() const { return _numerator; }
-
-   bool has_denominator() const { return _has_denominator; }
-   bool has_beam() const { return _has_beam; }
-   
-   std::vector<double> jet_pieces() const { return _jet_pieces; }
-   double beam_piece() const { return _beam_piece; }
-   double tau() const { return _tau; }
-
-private:
-   
-   // these values are input in the constructor
-   std::vector<double> _jet_pieces_numerator;
-   double _beam_piece_numerator;
-   double _denominator;
-   bool _has_denominator; //added so that TauComponents knows if denominator is used or not
-   bool _has_beam; //added so that TauComponents knows if beam regions is used or not
-   
-   // these values are derived from above values
-   std::vector<double> _jet_pieces;
-   double _beam_piece;
-   double _numerator;
-   double _tau;
-   
-};
-
-///////
-//
-// Measure Function
-//
-///////
-
-
-//------------------------------------------------------------------------
-/// \class MeasureFunction
-// This class calculates the tau_N of a jet given a specific measure.
-// It serves as a base class for calculating tau_N according to different measures that are implemented 
-// in further derived classes, but does not define a particular measure itself.
-class MeasureFunction {
-   
-public:
-   //These functions define the measure by which tau_N is calculated,
-   //and are overloaded by the various measures below
-   
-   // Distanes to axes.  These are called many times, so need to be as fast as possible
-   virtual double jet_distance_squared(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const = 0;
-   virtual double beam_distance_squared(const fastjet::PseudoJet& particle) const = 0;
-   
-   // The actual measures used in N-(sub)jettiness
-   virtual double jet_numerator(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const  = 0;
-   virtual double beam_numerator(const fastjet::PseudoJet& particle) const = 0;
-   
-   // a possible normalization factor
-   virtual double denominator(const fastjet::PseudoJet& particle) const = 0;
-   
-   //------
-   // The functions below call the above functions and are not virtual
-   //------
-   
-   // Return all of the necessary TauComponents for specific input particles and axes
-   // Also have optional pointers to get out information about partitioning
-   TauComponents result(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes) const;
-
-   // Just getting tau value if that is all that is needed
-   double tau(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes) const {
-      return result(particles,axes).tau();
-   }
-   
-   // Create the partitioning and stores internally
-   std::vector<fastjet::PseudoJet> get_partition(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes, PseudoJet * beamPartitionStorage = NULL) const;
-
-   // Essentially same as get_partition, but in the form needed for the jet algorithm
-   std::vector<std::list<int> > get_partition_list(const std::vector<fastjet::PseudoJet>& particles, const std::vector<fastjet::PseudoJet>& axes) const;
-
-   // calculates the tau result using an existing partition
-   TauComponents result_from_partition(const std::vector<fastjet::PseudoJet>& jet_partitioning, const std::vector<fastjet::PseudoJet>& axes, PseudoJet * beamPartitionStorage = NULL) const;
-
-   // shorthand for squaring
-   static inline double sq(double x) {return x*x;}
-
-   //virtual destructor
-   virtual ~MeasureFunction(){}
-   
-protected:
-   //bool set by derived classes to choose whether or not to use the denominator
-   bool _has_denominator;
-   bool _has_beam;
-   
-   // This constructor allows _has_denominator to be set by derived classes
-   MeasureFunction(bool has_denominator = true, bool has_beam = true) : _has_denominator(has_denominator), _has_beam(has_beam) {}
-   
-};
-
-
-/// \class DefaultNormalizedMeasureFunction
-// This class is the default measure, inheriting from the class above. This class will calculate tau_N 
-// of a jet according to this measure. This measure is defined as the pT of the particle multiplied by deltaR 
-// to the power of beta. This class includes the normalization factor determined by R0
-class DefaultNormalizedMeasureFunction : public MeasureFunction {
-
-public:
-
-   DefaultNormalizedMeasureFunction(double beta, double R0, double Rcutoff, bool normalized = true)
-   : MeasureFunction(normalized), _beta(beta), _R0(R0), _Rcutoff(Rcutoff) {}
-
-   virtual double jet_distance_squared(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const {
-      return particle.squared_distance(axis);
-   }
-
-   virtual double beam_distance_squared(const fastjet::PseudoJet& /*particle*/) const {
-      return sq(_Rcutoff);
-   }
-
-   virtual double jet_numerator(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const{
-      return particle.perp() * std::pow(jet_distance_squared(particle,axis),_beta/2.0);
-   }
-
-   virtual double beam_numerator(const fastjet::PseudoJet& particle) const {
-      return particle.perp() * std::pow(_Rcutoff,_beta);
-   }
-
-   virtual double denominator(const fastjet::PseudoJet& particle) const {
-      return particle.perp() * std::pow(_R0,_beta);
-   }
-   
-private:
-   double _beta;
-   double _R0;
-   double _Rcutoff;
-
-   
-};
-
-//------------------------------------------------------------------------
-/// \class DefaultUnnormalizedMeasureFunction
-// This class is the unnormalized default measure, inheriting from the class above. The only difference from above
-// is that the denominator is defined to be 1.0 by setting _has_denominator to false.
-class DefaultUnnormalizedMeasureFunction : public DefaultNormalizedMeasureFunction {
-
-public:
-   // Since all methods are identical, UnnormalizedMeasure inherits directly
-   // from NormalizedMeasure. R0 is a dummy value since the value of R0 is unecessary for this class,
-   // and the "false" flag sets _has_denominator in MeasureFunction to false so no denominator is used.
-   DefaultUnnormalizedMeasureFunction(double beta, double Rcutoff)
-   : DefaultNormalizedMeasureFunction(beta, std::numeric_limits<double>::quiet_NaN(), Rcutoff, false) {}
-};
-
-//------------------------------------------------------------------------
-/// \class GeometricMeasureFunction
-// This class is the geometic measure, inheriting from the class above. This class will calculate tau_N 
-// of a jet according to this measure. This measure is defined by the Lorentz dot product between
-// the particle and the axis. This class includes normalization of tau_N.
-class GeometricMeasureFunction : public MeasureFunction {
-
-public:
-   // Right now, we are hard coded for beam_beta = 1.0, but that will need to change
-   GeometricMeasureFunction(double jet_beta, double Rcutoff) : 
-     MeasureFunction(false), // doesn't have denominator
-     _jet_beta(jet_beta), _beam_beta(1.0), _Rcutoff(Rcutoff) {}
-
-   virtual double jet_distance_squared(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const {
-      fastjet::PseudoJet lightAxis = lightFrom(axis);
-      double pseudoRsquared = 2.0*dot_product(lightFrom(axis),particle)/(lightAxis.pt()*particle.pt());
-      return pseudoRsquared;
-   }
-
-   virtual double beam_distance_squared(const fastjet::PseudoJet&  /*particle*/) const {
-      return sq(_Rcutoff);
-   }
-
-   virtual double jet_numerator(const fastjet::PseudoJet& particle, const fastjet::PseudoJet& axis) const {
-      fastjet::PseudoJet lightAxis = lightFrom(axis);
-      double weight = (_beam_beta == 1.0) ? 1.0 : std::pow(lightAxis.pt(),_beam_beta - 1.0);
-      return particle.pt() * weight * std::pow(jet_distance_squared(particle,axis),_jet_beta/2.0);
-   }
-
-   virtual double beam_numerator(const fastjet::PseudoJet& particle) const {
-      double weight = (_beam_beta == 1.0) ? 1.0 : std::pow(particle.pt()/particle.e(),_beam_beta - 1.0);
-      return particle.pt() * weight * std::pow(_Rcutoff,_jet_beta);
-   }
-
-   virtual double denominator(const fastjet::PseudoJet&  /*particle*/) const {
-      return std::numeric_limits<double>::quiet_NaN();
-   }
-   
-   
-private:
-   double _jet_beta;
-   double _beam_beta;
-   double _Rcutoff;
-   
-   // create light-like axis
-   fastjet::PseudoJet lightFrom(const fastjet::PseudoJet& input) const {
-      double length = sqrt(pow(input.px(),2) + pow(input.py(),2) + pow(input.pz(),2));
-      return fastjet::PseudoJet(input.px()/length,input.py()/length,input.pz()/length,1.0);
-   }
-
-};
-   
-   
-} //namespace contrib
-
-FASTJET_END_NAMESPACE
-
-#endif  // __FASTJET_CONTRIB_MEASUREFUNCTION_HH__
Index: external/fastjet/contribs/Nsubjettiness/NEWS
===================================================================
--- external/fastjet/contribs/Nsubjettiness/NEWS	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ external/fastjet/contribs/Nsubjettiness/NEWS	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -10,5 +10,5 @@
 Note that we have maintain backwards compatibility for the typical ways that
 Nsubjettiness was used.  In particular, all of the Nsubjettiness class code in
-the example file v1.0.3 from still compiles, as does the NjettinessPlugin class
+the example file from v1.0.3 still compiles, as does the NjettinessPlugin class
 code that uses the default measure.
 
@@ -17,18 +17,29 @@
   * NsubjettinessRatio:  Direct access to tau_N / tau_M (the most requested
     feature)
-  * MeasureDefinition to allow access to both normalized and unnormalized measures
+  * MeasureDefinition to allow access to normalized and unnormalized measures
   * AxesDefinition to allow for access to more general axes modes
-  * Winner-Take-All recombination axes:  a faster way to find axes than beta = 1
+  * Winner-Take-All recombination axes:  a faster way to find axes than beta=1
     minimization, but with comparable performance.
   * TauComponents to get access to the pieces of the N-(sub)jettiness
     calculation.
+  * TauExtras to get complete access to get partitioning and axes information.
   * For clarity, split the example file into an example_basic_usage and
-    example_advanced_usage
+    example_advanced_usage (and example_advanced_usage_ee for e+e- collisions).
   * In Nsubjettiness, access to seedAxes() and currentAxes() to figure out the
     axes used before and after minimization.
   * In Nsubjettiness, access to currentSubjets() to get the subjet fourvectors.
+  * (v2.2)  XConePlugin, which improves on the previous NjettinessPlugin to use
+    N-jettiness as a jet finder using the new ConicalGeometric measure.
 
+-- 2.2.1:  (Sept 28, 2015)  Fix of small Makefile bug
+-- 2.2.0:  (Sept 7, 2015)  Inclusion of the XCone jet algorithm, as well as a
+           few new measures, including the "conical geometric" measure and
+           options for e+e- colliders.  Improvement of the
+           Measure/AxesDefinition interface to allow for direct
+           use in calculations.
+           * Fixed bug where MultiPass_Axes did not actually minimize
+           * Fixed floating point error with infinity^2 in various measures
 
--- 2.1.0:  (July 9, 2014) Inclusion of MeasureDefinition/AxesDefinition interface.
+-- 2.1.0:  (July 9, 2014) Inclusion of Measure/AxesDefinition interface.
            This was the first publicly available version of Nsubjettiness v2.
 -- 2.0.0:  Initial release of v2.0.  This was never officially made public.
Index: external/fastjet/contribs/Nsubjettiness/Njettiness.cc
===================================================================
--- external/fastjet/contribs/Nsubjettiness/Njettiness.cc	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ external/fastjet/contribs/Nsubjettiness/Njettiness.cc	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -5,5 +5,5 @@
 //  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
 //
-//  $Id: Njettiness.cc 677 2014-06-12 18:56:46Z jthaler $
+//  $Id: Njettiness.cc 821 2015-06-15 18:50:53Z jthaler $
 //----------------------------------------------------------------------
 // This file is part of FastJet contrib.
@@ -36,18 +36,77 @@
 ///////
 
+LimitedWarning Njettiness::_old_measure_warning;
+LimitedWarning Njettiness::_old_axes_warning;
+
+   
+// Constructor
 Njettiness::Njettiness(const AxesDefinition & axes_def, const MeasureDefinition & measure_def)
-: _axes_def(axes_def.create()), _measure_def(measure_def.create()) {
-   setMeasureFunctionAndAxesFinder();  // call helper function to do the hard work
-}
-
+: _axes_def(axes_def.create()), _measure_def(measure_def.create()) {}
+   
+// setAxes for Manual mode
+void Njettiness::setAxes(const std::vector<fastjet::PseudoJet> & myAxes) {
+   if (_axes_def()->needsManualAxes()) {
+      _currentAxes = myAxes;
+   } else {
+      throw Error("You can only use setAxes for manual AxesDefinitions");
+   }
+}
+   
+// Calculates and returns all TauComponents that user would want.
+// This information is stored in _current_tau_components for later access as well.
+TauComponents Njettiness::getTauComponents(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const {
+   if (inputJets.size() <= n_jets) {  //if not enough particles, return zero
+      _currentAxes = inputJets;
+      _currentAxes.resize(n_jets,fastjet::PseudoJet(0.0,0.0,0.0,0.0));
+      _current_tau_components = TauComponents();
+      _seedAxes = _currentAxes;
+      _currentPartition = TauPartition(n_jets); // empty partition
+   } else {
+      assert(_axes_def()); // this should never fail.
+      
+      if (_axes_def()->needsManualAxes()) { // if manual mode
+         // take current axes as seeds
+         _seedAxes = _currentAxes;
+         
+         // refine axes if requested
+         _currentAxes = _axes_def->get_refined_axes(n_jets,inputJets,_seedAxes, _measure_def());
+      } else { // non-manual axes
+         
+          //set starting point for minimization
+         _seedAxes = _axes_def->get_starting_axes(n_jets,inputJets,_measure_def());
+         
+         // refine axes as needed
+         _currentAxes = _axes_def->get_refined_axes(n_jets,inputJets,_seedAxes, _measure_def());
+         
+         // NOTE:  The above two function calls are combined in "AxesDefinition::get_axes"
+         // but are separated here to allow seed axes to be stored.
+      }
+      
+      // Find and store partition
+      _currentPartition = _measure_def->get_partition(inputJets,_currentAxes);
+      
+      // Find and store tau value
+      _current_tau_components = _measure_def->component_result_from_partition(_currentPartition, _currentAxes);  // sets current Tau Values
+   }
+   return _current_tau_components;
+}
+   
+
+///////
+//
+// Below is code for backward compatibility to use the old interface.
+// May be deleted in a future version
+//
+///////
+   
 Njettiness::Njettiness(AxesMode axes_mode, const MeasureDefinition & measure_def)
-: _axes_def(createAxesDef(axes_mode)), _measure_def(measure_def.create()) {
-   setMeasureFunctionAndAxesFinder();  // call helper function to do the hard work
-}
-   
+: _axes_def(createAxesDef(axes_mode)), _measure_def(measure_def.create()) {}
+
 // Convert from MeasureMode enum to MeasureDefinition
 // This returns a pointer that will be claimed by a SharedPtr
 MeasureDefinition* Njettiness::createMeasureDef(MeasureMode measure_mode, int num_para, double para1, double para2, double para3) const {
-
+   
+   _old_measure_warning.warn("Njettiness::createMeasureDef:  You are using the old MeasureMode way of specifying N-subjettiness measures.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use MeasureDefinition instead.");
+   
    // definition of maximum Rcutoff for non-cutoff measures, changed later by other measures
    double Rcutoff = std::numeric_limits<double>::max();  //large number
@@ -77,10 +136,5 @@
          break;
       case geometric_measure:
-         beta = para1;
-         if (num_para == 1) {
-            return new GeometricMeasure(beta);
-         } else {
-            throw Error("geometric_measure needs 1 parameter (beta)");
-         }
+         throw Error("This class has been removed. Please use OriginalGeometricMeasure, ModifiedGeometricMeasure, or ConicalGeometricMeasure with the new Njettiness constructor.");
          break;
       case normalized_cutoff_measure:
@@ -104,12 +158,5 @@
          break;
       case geometric_cutoff_measure:
-         beta = para1;
-         Rcutoff = para2; //Rcutoff parameter is 2nd parameter in geometric_cutoff_measure
-         if(num_para == 2) {
-           return new GeometricCutoffMeasure(beta,Rcutoff);
-         } else {
-            throw Error("geometric_cutoff_measure has 2 parameters (beta, Rcutoff)");
-         }
-         break;
+         throw Error("This class has been removed. Please use OriginalGeometricMeasure, ModifiedGeometricMeasure, or ConicalGeometricMeasure with the new Njettiness constructor.");
       default:
          assert(false);
@@ -122,4 +169,7 @@
 // This returns a pointer that will be claimed by a SharedPtr
 AxesDefinition* Njettiness::createAxesDef(Njettiness::AxesMode axes_mode) const {
+   
+   _old_axes_warning.warn("Njettiness::createAxesDef:  You are using the old AxesMode way of specifying N-subjettiness axes.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use AxesDefinition instead.");
+   
    
    switch (axes_mode) {
@@ -156,62 +206,7 @@
 }
 
-   
-// Parsing needed for constructor to set AxesFinder and MeasureFunction
-// All of the parameter handling is here, and checking that number of parameters is correct.
-void Njettiness::setMeasureFunctionAndAxesFinder() {
-   // Get the correct MeasureFunction and AxesFinders
-   _measureFunction.reset(_measure_def->createMeasureFunction());
-   _startingAxesFinder.reset(_axes_def->createStartingAxesFinder(*_measure_def));
-   _finishingAxesFinder.reset(_axes_def->createFinishingAxesFinder(*_measure_def));
-}
-
-// setAxes for Manual mode
-void Njettiness::setAxes(const std::vector<fastjet::PseudoJet> & myAxes) {
-   if (_axes_def->supportsManualAxes()) {
-      _currentAxes = myAxes;
-   } else {
-      throw Error("You can only use setAxes for manual AxesDefinitions");
-   }
-}
-   
-// Calculates and returns all TauComponents that user would want.
-// This information is stored in _current_tau_components for later access as well.
-TauComponents Njettiness::getTauComponents(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const {
-   if (inputJets.size() <= n_jets) {  //if not enough particles, return zero
-      _currentAxes = inputJets;
-      _currentAxes.resize(n_jets,fastjet::PseudoJet(0.0,0.0,0.0,0.0));
-      _current_tau_components = TauComponents();
-      _seedAxes = _currentAxes;
-      _currentJets = _currentAxes;
-      _currentBeam = PseudoJet(0.0,0.0,0.0,0.0);
-   } else {
-
-      _seedAxes = _startingAxesFinder->getAxes(n_jets,inputJets,_currentAxes); //sets starting point for minimization
-      if (_finishingAxesFinder) {
-         _currentAxes = _finishingAxesFinder->getAxes(n_jets,inputJets,_seedAxes);
-      } else {
-         _currentAxes = _seedAxes;
-      }
-      
-      // Find partition and store information
-      // (jet information in _currentJets, beam in _currentBeam)
-      _currentJets = _measureFunction->get_partition(inputJets,_currentAxes,&_currentBeam);
-      
-      // Find tau value and store information
-      _current_tau_components = _measureFunction->result_from_partition(_currentJets, _currentAxes,&_currentBeam);  // sets current Tau Values
-   }
-   return _current_tau_components;
-}
-   
-   
-// Partition a list of particles according to which N-jettiness axis they are closest to.
-// Return a vector of length _currentAxes.size() (which should be N).
-// Each vector element is a list of ints corresponding to the indices in
-// particles of the particles belonging to that jet.
-std::vector<std::list<int> > Njettiness::getPartitionList(const std::vector<fastjet::PseudoJet> & particles) const {
-   // core code is in MeasureFunction
-   return _measureFunction->get_partition_list(particles,_currentAxes);
-}
-
+
+   
+   
    
 } // namespace contrib
Index: external/fastjet/contribs/Nsubjettiness/Njettiness.hh
===================================================================
--- external/fastjet/contribs/Nsubjettiness/Njettiness.hh	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ external/fastjet/contribs/Nsubjettiness/Njettiness.hh	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -5,5 +5,5 @@
 //  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
 //
-//  $Id: Njettiness.hh 670 2014-06-06 01:24:42Z jthaler $
+//  $Id: Njettiness.hh 822 2015-06-15 23:52:57Z jthaler $
 //----------------------------------------------------------------------
 // This file is part of FastJet contrib.
@@ -27,7 +27,7 @@
 
 
-#include "MeasureFunction.hh"
-#include "AxesFinder.hh"
-#include "NjettinessDefinition.hh"
+#include "MeasureDefinition.hh"
+#include "AxesDefinition.hh"
+#include "TauComponents.hh"
 
 #include "fastjet/PseudoJet.hh"
@@ -42,5 +42,73 @@
 
 namespace contrib {
-   
+
+/** \mainpage Nsubjettiness Documentation
+ *
+ * These Doxygen pages provide automatically generated documentation for the
+ * Nsubjettiness FastJet contrib.  This documentation is being slowly improved.
+ *
+ * \section core_classes Core Classes
+ *
+ * - Nsubjettiness:  Calculating N-subjettiness jet shapes
+ * - NsubjettinessRatio:  Calculating N-subjettiness ratios
+ * - XConePlugin:  Running the XCone jet algorithm
+ * - NjettinessPlugin:  Running generic N-jettiness as a jet algorithm
+ *
+ * \subsection core_classes_helper Helper Classes for Core
+ * - Njettiness:  Core code for all N-(sub)jettiness calculations
+ * - NjettinessExtras:  Way to access additional N-jettiness information
+ * - TauComponents:  Output format for all N-(sub)jettiness information
+ * - TauPartition:  Access to N-(sub)jettiness partitioning information
+ * - PseudoXConePlugin:  Testing code to compare to XConePlugin (doesn't use one-pass minimization)
+ *
+ * \section axes_classes Axes Definitions
+ *
+ * \subsection axes_classes_base Base Classes
+ * - AxesDefinition:  Defines generic axes definition
+ * - ExclusiveJetAxes:  Axes finder from exclusive jet algorithm
+ * - ExclusiveCombinatorialJetAxes:  Axes finder from exclusive jet algorithm (with extra axes to test combinatoric options)
+ * - HardestJetAxes:  Axes finder from inclusive jet algorithm
+ *
+ * \subsection axes_classes_derived Derived Classes
+ *
+ * \b OnePass means iterative improvement to a (local) N-(sub)jettiness minimum.
+ *
+ * \b MultiPass means using multiple random seed inputs
+ *
+ * \b Comb means checking N + Nextra choose N combinatorial options
+ *
+ * - KT_Axes / OnePass_KT_Axes:  Axes from exclusive kT
+ * - CA_Axes / OnePass_CA_Axes:  Axes from exclusive Cambridge/Aachen
+ * - AntiKT_Axes / OnePass_AntiKT_Axes:  Axes from inclusive anti-kT
+ * - WTA_KT_Axes / OnePass_WTA_KT_Axes:  Axes from exclusive kT, using winner-take-all recombination
+ * - WTA_CA_Axes / OnePass_WTA_CA_Axes:  Axes from exclusive CA, using winner-take-all recombination
+ *
+ * - GenET_GenKT_Axes / OnePass_GenET_GenKT_Axes / Comb_GenET_GenKT_Axes:  Axes from exclusive generalized kt, with generalized Et recombination
+ * - WTA_GenKT_Axes / OnePass_WTA_GenKT_Axes / Comb_WTA_GenKT_Axes:  Axes from exclusive generalized kt, with winner-take-all recombination
+ *
+ * - Manual_Axes / OnePass_Manual_Axes / MultiPass_Manual_Axes:  Use manual axes
+ * - MultiPass_Axes:  Multiple passes with random input seeds
+ *
+ * \subsection axes_classes_helper Helper Classes for Axes
+ * - GeneralEtSchemeRecombiner:  Generalized Et-scheme recombiner
+ * - WinnerTakeAllRecombiner:  Winner-take-all recombiner (similar functionality now in FastJet 3.1)
+ * - JetDefinitionWrapper:  Wrapper for Jet Definitions to handle memory management
+ *
+ * \section measure_classes Measure Definitions
+ *
+ * \subsection measure_classes_bases Base Classes
+ * - MeasureDefinition:  Defines generic measures
+ * - DefaultMeasure:  Base class for the original N-subjettiness measures
+ *
+ * \subsection measure_classes_derived Derived Classes
+ * - NormalizedMeasure / UnnormalizedMeasure / NormalizedCutoffMeasure / UnnormalizedCutoffMeasure : Variants on the default N-subjettiness measure.
+ * - ConicalMeasure: Similar to default measure, but intended as N-jettiness event shape
+ * - ConicalGeometricMeasure / XConeMeasure:  Measure used in XCone jet algorithm
+ * - OriginalGeometricMeasure / ModifiedGeometricMeasure:  Dot product measures useful for theoretical calcualtions
+ *
+ * \subsection measure_classes_helper Helper Classes for Measures
+ * - LightLikeAxis : Defines light-like axis
+ */
+
 ///////
 //
@@ -49,15 +117,88 @@
 ///////
 
-//------------------------------------------------------------------------
+///------------------------------------------------------------------------
 /// \class Njettiness
-// Njettiness uses AxesFinder and MeasureFunction together in order to find tau_N for the event. The user specifies
-// which AxesFinder and which MeasureFunction to use in the calculation, and then Njettiness returns tau_N for the event.
-// It also can return information about the axes and jets it used in the calculation, as well as information about 
-// how the event was partitioned.
+/// \brief Core class for N-(sub)jettiness calculations
+///
+/**
+ * The N-jettiness event shape.
+ *
+ * This is the core class used to perform N-jettiness jet finding (via NjettinessPlugin or XConePluggin)
+ * as well as find the N-subjettiness jet shape (via Nsubjettiness).
+ *
+ * In general, the user should never need to call this object.  In addition, its API should not be considered
+ * fixed, since all code improvements effectively happen from reorganizing this class.
+ *
+ * Njettiness uses AxesDefinition and MeasureDefinition together in order to find tau_N for the event.
+ * It also can return information about the axes and jets it used in the calculation, as well as
+ * information about how the event was partitioned.
+ */
 class Njettiness {
 public:
    
-   // The various axes choices available to the user
-   // It is recommended to use AxesDefinition instead of these.
+   /// Main constructor that uses AxesMode and MeasureDefinition to specify measure
+   /// Unlike Nsubjettiness or NjettinessPlugin, the value N is not chosen
+   Njettiness(const AxesDefinition & axes_def, const MeasureDefinition & measure_def);
+
+   /// Destructor
+   ~Njettiness() {};
+   
+   /// setAxes for Manual mode
+   void setAxes(const std::vector<fastjet::PseudoJet> & myAxes);
+   
+   /// Calculates and returns all TauComponents that user would want.
+   /// This information is stored in _current_tau_components for later access as well.
+   TauComponents getTauComponents(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const;
+
+   /// Calculates the value of N-subjettiness,
+   /// but only returns the tau value from _current_tau_components
+   double getTau(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const {
+      return getTauComponents(n_jets, inputJets).tau();
+   }
+
+   /// Return all relevant information about tau components
+   TauComponents currentTauComponents() const {return _current_tau_components;}
+   /// Return axes found by getTauComponents.
+   std::vector<fastjet::PseudoJet> currentAxes() const { return _currentAxes;}
+   /// Return seedAxes used if onepass minimization (otherwise, same as currentAxes)
+   std::vector<fastjet::PseudoJet> seedAxes() const { return _seedAxes;}
+   /// Return jet partition found by getTauComponents.
+   std::vector<fastjet::PseudoJet> currentJets() const {return _currentPartition.jets();}
+   /// Return beam partition found by getTauComponents.
+   fastjet::PseudoJet currentBeam() const {return _currentPartition.beam();}
+   /// Return beam partition found by getTauComponents.
+   TauPartition currentPartition() const {return _currentPartition;}
+   
+
+private:
+   
+   /// AxesDefinition to use.  Implemented as SharedPtrs to avoid memory management headaches
+   SharedPtr<const AxesDefinition> _axes_def;
+   /// MeasureDefinition to use.  Implemented as SharedPtrs to avoid memory management headaches
+   SharedPtr<const MeasureDefinition> _measure_def;
+
+   
+   // Information about the current information
+   // Defined as mutables, so user should be aware that these change when getTau is called.
+   // TODO:  These are not thread safe and should be fixed somehow
+   mutable TauComponents _current_tau_components; //automatically set to have components of 0; these values will be set by the getTau function call
+   mutable std::vector<fastjet::PseudoJet> _currentAxes; //axes found after minimization
+   mutable std::vector<fastjet::PseudoJet> _seedAxes; // axes used prior to minimization (if applicable)
+   mutable TauPartition _currentPartition; //partitioning information
+
+   /// Warning if the user tries to use v1.0.3 measure style.
+   static LimitedWarning _old_measure_warning;
+   /// Warning if the user tries to use v1.0.3 axes style.
+   static LimitedWarning _old_axes_warning;
+
+   
+public:
+   
+   // These interfaces are included for backwards compability, and will be deprecated in a future release (scheduled for deletion in v3.0)
+   
+   /// \deprecated
+   /// Deprecated enum to determine axes mode
+   /// The various axes choices available to the user
+   /// It is recommended to use AxesDefinition instead of these.
    enum AxesMode {
       kt_axes,             // exclusive kt axes
@@ -69,20 +210,17 @@
       onepass_ca_axes,     // one-pass minimization from ca starting point
       onepass_antikt_0p2_axes,  // one-pass minimization from antikt-0.2 starting point
-      onepass_wta_kt_axes, //one-pass minimization of WTA axes with kt 
-      onepass_wta_ca_axes, //one-pass minimization of WTA axes with ca 
+      onepass_wta_kt_axes, //one-pass minimization of WTA axes with kt
+      onepass_wta_ca_axes, //one-pass minimization of WTA axes with ca
       min_axes,            // axes that minimize N-subjettiness (100 passes by default)
       manual_axes,         // set your own axes with setAxes()
       onepass_manual_axes  // one-pass minimization from manual starting point
-      //  These options are commented out because they have not been fully tested
-      //      wta2_kt_axes,        // Winner Take All (alpha = 2) with kt
-      //      wta2_ca_axes,         // Winner Take All (alpha = 2) with CA
-      //      onepass_wta2_kt_axes, //one-pass minimization of WTA (alpha = 2) axes with kt
-      //      onepass_wta2_ca_axes, //one-pass minimization of WTA (alpha = 2) axes with ca
    };
-
-   // The measures available to the user.
-   // "normalized_cutoff_measure" was the default in v1.0 of Nsubjettiness
-   // "unnormalized_measure" is now the recommended default usage
-   // But it is recommended to use MeasureDefinition instead of these.
+   
+   /// \deprecated
+   /// Deprecated enum to determine measure mode
+   /// The measures available to the user.
+   /// "normalized_cutoff_measure" was the default in v1.0 of Nsubjettiness
+   /// "unnormalized_measure" is now the recommended default usage
+   /// But it is recommended to use MeasureDefinition instead of these.
    enum MeasureMode {
       normalized_measure,           //default normalized measure
@@ -93,14 +231,12 @@
       geometric_cutoff_measure      //geometric measure with explicit Rcutoff
    };
-
-   // Main constructor that uses AxesMode and MeasureDefinition to specify measure
-   // Unlike Nsubjettiness or NjettinessPlugin, the value N is not chosen
-   Njettiness(const AxesDefinition & axes_def, const MeasureDefinition & measure_def);
-
-   // Intermediate constructor (needed to enable v1.0.3 backwards compatibility?)
+   
+   /// \deprecated
+   /// Intermediate constructor (needed to enable v1.0.3 backwards compatibility?)
    Njettiness(AxesMode axes_mode, const MeasureDefinition & measure_def);
-
-   // Alternative constructor which takes axes/measure information as enums with measure parameters
-   // This version is not recommended
+   
+   /// \deprecated
+   /// Old-style constructor which takes axes/measure information as enums with measure parameters
+   /// This version absolutely is not recommended
    Njettiness(AxesMode axes_mode,
               MeasureMode measure_mode,
@@ -110,66 +246,12 @@
               double para3 = std::numeric_limits<double>::quiet_NaN())
    : _axes_def(createAxesDef(axes_mode)), _measure_def(createMeasureDef(measure_mode, num_para, para1, para2, para3)) {
-      setMeasureFunctionAndAxesFinder();  // call helper function to do the hard work
    }
-
-   // destructor
-   ~Njettiness() {};
-   
-   // setAxes for Manual mode
-   void setAxes(const std::vector<fastjet::PseudoJet> & myAxes);
-   
-   // Calculates and returns all TauComponents that user would want.
-   // This information is stored in _current_tau_components for later access as well.
-   TauComponents getTauComponents(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const;
-
-   // Calculates the value of N-subjettiness,
-   // but only returns the tau value from _current_tau_components
-   double getTau(unsigned n_jets, const std::vector<fastjet::PseudoJet> & inputJets) const {
-      return getTauComponents(n_jets, inputJets).tau();
-   }
-
-   // Return all relevant information about tau components
-   TauComponents currentTauComponents() const {return _current_tau_components;}
-   // Return axes found by getTauComponents.
-   std::vector<fastjet::PseudoJet> currentAxes() const { return _currentAxes;}
-   // Return seedAxes used if onepass minimization (otherwise, same as currentAxes)
-   std::vector<fastjet::PseudoJet> seedAxes() const { return _seedAxes;}
-   // Return jet partition found by getTauComponents.
-   std::vector<fastjet::PseudoJet> currentJets() const {return _currentJets;}
-   // Return beam partition found by getTauComponents.
-   fastjet::PseudoJet currentBeam() const {return _currentBeam;}
-   
-   // partition inputs by Voronoi (each vector stores indices corresponding to inputJets)
-   std::vector<std::list<int> > getPartitionList(const std::vector<fastjet::PseudoJet> & inputJets) const;
-
-private:
-   
-   // Information about Axes and Measures to be Used
-   // Implemented as SharedPtrs to avoid memory management headaches
-   SharedPtr<const AxesDefinition> _axes_def;
-   SharedPtr<const MeasureDefinition> _measure_def;
-   
-   // The chosen axes/measure mode workers
-   // Implemented as SharedPtrs to avoid memory management headaches
-   // TODO: make into a SharedPtr<const AxesFinder>?
-   SharedPtr<MeasureFunction> _measureFunction;  // The chosen measure
-   SharedPtr<AxesFinder> _startingAxesFinder;    // The initial axes finder
-   SharedPtr<AxesFinder> _finishingAxesFinder;   // A possible minimization step
-   
-   // Information about the current information
-   // Defined as mutables, so user should be aware that these change when getTau is called.
-   mutable TauComponents _current_tau_components; //automatically set to have components of 0; these values will be set by the getTau function call
-   mutable std::vector<fastjet::PseudoJet> _currentAxes; //axes found after minimization
-   mutable std::vector<fastjet::PseudoJet> _seedAxes; // axes used prior to minimization (if applicable)
-   mutable std::vector<fastjet::PseudoJet> _currentJets; //partitioning information
-   mutable fastjet::PseudoJet _currentBeam; //return beam, if requested
-   
-   // created separate function to set MeasureFunction and AxesFinder in order to keep constructor cleaner.
-   void setMeasureFunctionAndAxesFinder();
-   
-   // Convert old style enums into new style MeasureDefinition
+  
+   /// \deprecated
+   /// Convert old style enums into new style MeasureDefinition
    AxesDefinition* createAxesDef(AxesMode axes_mode) const;
    
-   // Convert old style enums into new style MeasureDefinition
+   /// \deprecated
+   /// Convert old style enums into new style MeasureDefinition
    MeasureDefinition* createMeasureDef(MeasureMode measure_mode, int num_para, double para1, double para2, double para3) const;
 
Index: external/fastjet/contribs/Nsubjettiness/NjettinessDefinition.cc
===================================================================
--- external/fastjet/contribs/Nsubjettiness/NjettinessDefinition.cc	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ 	(revision )
@@ -1,76 +1,0 @@
-//  Nsubjettiness Package
-//  Questions/Comments?  jthaler@jthaler.net
-//
-//  Copyright (c) 2011-14
-//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
-//
-//  $Id: NjettinessDefinition.cc 704 2014-07-07 14:30:43Z jthaler $
-//----------------------------------------------------------------------
-// This file is part of FastJet contrib.
-//
-// It is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2 of the License, or (at
-// your option) any later version.
-//
-// It is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
-// License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this code. If not, see <http://www.gnu.org/licenses/>.
-//----------------------------------------------------------------------
-
-#include "NjettinessDefinition.hh"
-
-FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
-
-namespace contrib {
-
-   std::string NormalizedMeasure::description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "Normalized Measure (beta = " << _beta << ", R0 = " << _R0 << ")";
-      return stream.str();
-   };
-   
-   std::string UnnormalizedMeasure::description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "Unnormalized Measure (beta = " << _beta << ", in GeV)";
-      return stream.str();
-   };
-   
-   std::string GeometricMeasure::description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "Geometric Measure (beta = " << _beta << ", in GeV)";
-      return stream.str();
-   };
-   
-   std::string NormalizedCutoffMeasure::description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "Normalized Cutoff Measure (beta = " << _beta << ", R0 = " << _R0 << ", Rcut = " << _Rcutoff << ")";
-      return stream.str();
-   };
-   
-   std::string UnnormalizedCutoffMeasure::description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "Unnormalized Cutoff Measure (beta = " << _beta << ", Rcut = " << _Rcutoff << ", in GeV)";
-      return stream.str();
-   };
-   
-   std::string GeometricCutoffMeasure::description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "Geometric Cutoff Measure (beta = " << _beta << ", Rcut = " << _Rcutoff << ", in GeV)";
-      return stream.str();
-   };
-   
-   
-} // namespace contrib
-
-FASTJET_END_NAMESPACE
Index: external/fastjet/contribs/Nsubjettiness/NjettinessDefinition.hh
===================================================================
--- external/fastjet/contribs/Nsubjettiness/NjettinessDefinition.hh	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ 	(revision )
@@ -1,721 +1,0 @@
-//  Nsubjettiness Package
-//  Questions/Comments?  jthaler@jthaler.net
-//
-//  Copyright (c) 2011-14
-//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
-//
-//  $Id: NjettinessDefinition.hh 704 2014-07-07 14:30:43Z jthaler $
-//----------------------------------------------------------------------
-// This file is part of FastJet contrib.
-//
-// It is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2 of the License, or (at
-// your option) any later version.
-//
-// It is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
-// License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this code. If not, see <http://www.gnu.org/licenses/>.
-//----------------------------------------------------------------------
-
-#ifndef __FASTJET_CONTRIB_NJETTINESS_DEFINITION_HH__
-#define __FASTJET_CONTRIB_NJETTINESS_DEFINITION_HH__
-
-
-#include "MeasureFunction.hh"
-#include "AxesFinder.hh"
-
-#include "fastjet/PseudoJet.hh"
-#include <fastjet/LimitedWarning.hh>
-
-#include <iomanip>
-#include <cmath>
-#include <vector>
-#include <list>
-
-FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
-
-namespace contrib {
-   
-// Eventually this file might contains an NjettinessDefinition that combines an
-// AxesDefinition with a MeasureDefinition. It's not clear how useful that would be, though
-  
-// The following Measures are available (and the relevant arguments):
-class NormalizedMeasure;         // (beta,R0)
-class UnnormalizedMeasure;       // (beta)
-class GeometricMeasure;          // (beta)
-class NormalizedCutoffMeasure;   // (beta,R0,Rcutoff)
-class UnnormalizedCutoffMeasure; // (beta,Rcutoff)
-class GeometricCutoffMeasure;    // (beta,Rcutoff)
-
-// The following Axes are available (and the relevant arguments, if needed)
-class KT_Axes;
-class CA_Axes;
-class AntiKT_Axes;   // (R0)
-class WTA_KT_Axes;
-class WTA_CA_Axes;
-class Manual_Axes;
-class OnePass_KT_Axes;
-class OnePass_CA_Axes;
-class OnePass_AntiKT_Axes;   // (R0)
-class OnePass_WTA_KT_Axes;
-class OnePass_WTA_CA_Axes;
-class OnePass_Manual_Axes;
-class MultiPass_Axes;
-
-// Below are just technical implementations of the variable axes and measures.
-  
-///////
-//
-// MeasureDefinition
-//
-///////
-
-//The MeasureDefinition is a way to set the MeasureMode and
-//parameters used by Njettiness, with errors in the number of parameters given at
-//compile time (instead of at run time).  The MeasureDefintion knows which core objects
-//to call to make the measurement, as well as properties of the MeasureFunction
-class MeasureDefinition {
-   
-public:
-
-   // Description of measure and parameters
-   virtual std::string description() const = 0;
-   
-   // In derived classes, this should return a copy of the corresponding
-   // derived class
-   virtual MeasureDefinition* create() const = 0;
-   
-   //Return the MeasureFunction corresponding to this definition
-   virtual MeasureFunction* createMeasureFunction() const = 0;
-   
-   //Return the AxesFinder that should be used for one-pass minimization
-   virtual AxesFinder* createOnePassAxesFinder() const = 0;
-
-   //Specify whether multi-pass minimization makes sense, and if so, return the AxesFinder that should be used for multi-pass minimization
-   virtual bool supportsMultiPassMinimization() const = 0;
-   virtual AxesFinder* createMultiPassAxesFinder( unsigned int) const = 0;
-   
-   virtual ~MeasureDefinition(){};
-};
-
-// The normalized measure, with two parameters: beta and R0
-class NormalizedMeasure : public MeasureDefinition {
-   
-public:
-   NormalizedMeasure(double beta, double R0)
-   : _beta(beta), _R0(R0) {}
-   
-   virtual std::string description() const;
-
-   virtual MeasureFunction* createMeasureFunction() const {
-      return (new DefaultNormalizedMeasureFunction(_beta,_R0,std::numeric_limits<double>::max()));
-   }
-
-   virtual NormalizedMeasure* create() const {return new NormalizedMeasure(*this);}
-   
-   virtual AxesFinder* createOnePassAxesFinder() const {
-      return (new AxesFinderFromOnePassMinimization(_beta, std::numeric_limits<double>::max()));
-   }
-   virtual AxesFinder* createMultiPassAxesFinder( unsigned int Npass) const {
-      return (new AxesFinderFromKmeansMinimization(_beta, std::numeric_limits<double>::max(),Npass));
-   }
-
-   virtual bool supportsMultiPassMinimization() const { return true; }
-   
-private:
-   double _beta;
-   double _R0;
-};
-   
-// The unnormalized measure, with just one parameter: beta
-class UnnormalizedMeasure : public MeasureDefinition {
-
-public:
-   UnnormalizedMeasure(double beta)
-   : _beta(beta) {}
-
-   virtual UnnormalizedMeasure* create() const {return new UnnormalizedMeasure(*this);}
-   
-   virtual std::string description() const;
-   
-   virtual MeasureFunction* createMeasureFunction() const {
-      return (new DefaultUnnormalizedMeasureFunction(_beta,std::numeric_limits<double>::max()));
-   }
-
-   
-   virtual AxesFinder* createOnePassAxesFinder() const {
-      return (new AxesFinderFromOnePassMinimization(_beta, std::numeric_limits<double>::max()));
-   }
-   virtual AxesFinder* createMultiPassAxesFinder( unsigned int Npass) const {
-      return (new AxesFinderFromKmeansMinimization(_beta, std::numeric_limits<double>::max(),Npass));
-   }
-
-   virtual bool supportsMultiPassMinimization() const { return true; }
-
-private:
-   double _beta;
-};
-   
-   
-// The geometric  measure, with 1 parameter: beta
-// This measure is still evolving and shouldn't be used for any critial applications yet
-class GeometricMeasure : public MeasureDefinition {
-   
-public:
-   GeometricMeasure(double beta)
-   : _beta(beta) {}
-   
-   virtual GeometricMeasure* create() const {return new GeometricMeasure(*this);}
-   
-   virtual std::string description() const;
-   
-   virtual MeasureFunction* createMeasureFunction() const {
-      return (new GeometricMeasureFunction(_beta,std::numeric_limits<double>::max()));
-   }
-   
-   virtual AxesFinder* createOnePassAxesFinder() const {
-      return (new AxesFinderFromGeometricMinimization(_beta, std::numeric_limits<double>::max()));
-   }
-   virtual AxesFinder* createMultiPassAxesFinder(unsigned int) const {
-      throw Error("GeometricMeasure does not support multi-pass minimization.");
-      return NULL;
-   }
-   
-   virtual bool supportsMultiPassMinimization() const { return false; }
-
-private:
-   double _beta;
-
-};
-
-
-// The normalized cutoff measure, with 3 parameters: beta, R0, Rcutoff
-class NormalizedCutoffMeasure : public MeasureDefinition {
-
-public:
-   NormalizedCutoffMeasure(double beta, double R0, double Rcutoff)
-   : _beta(beta), _R0(R0), _Rcutoff(Rcutoff) {}
-
-   virtual std::string description() const;
-   
-   virtual NormalizedCutoffMeasure* create() const {return new NormalizedCutoffMeasure(*this);}
-   
-   virtual MeasureFunction* createMeasureFunction() const {
-      return (new DefaultNormalizedMeasureFunction(_beta,_R0,_Rcutoff));
-   }
-   
-   virtual AxesFinder* createOnePassAxesFinder() const {
-      return (new AxesFinderFromOnePassMinimization(_beta, _Rcutoff));
-   }
-   virtual AxesFinder* createMultiPassAxesFinder( unsigned int Npass) const {
-      return (new AxesFinderFromKmeansMinimization(_beta, std::numeric_limits<double>::max(),Npass));
-   }
-  
-   virtual bool supportsMultiPassMinimization() const { return true; }
-
-private:
-   double _beta;
-   double _R0;
-   double _Rcutoff;
-   
-};
-
-// The unnormalized cutoff measure, with 2 parameters: beta, Rcutoff
-class UnnormalizedCutoffMeasure : public MeasureDefinition {
-   
-public:
-   UnnormalizedCutoffMeasure(double beta, double Rcutoff)
-   : _beta(beta), _Rcutoff(Rcutoff) {}
-
-   virtual std::string description() const;
-   
-   virtual UnnormalizedCutoffMeasure* create() const {return new UnnormalizedCutoffMeasure(*this);}
-
-   virtual MeasureFunction* createMeasureFunction() const {
-      return (new DefaultUnnormalizedMeasureFunction(_beta,_Rcutoff));
-   }
-   
-   virtual AxesFinder* createOnePassAxesFinder() const {
-      return (new AxesFinderFromOnePassMinimization(_beta, _Rcutoff));
-   }
-   virtual AxesFinder* createMultiPassAxesFinder( unsigned int Npass) const {
-      return (new AxesFinderFromKmeansMinimization(_beta, std::numeric_limits<double>::max(),Npass));
-   }
-
-   virtual bool supportsMultiPassMinimization() const { return true; }
-
-private:
-   double _beta;
-   double _Rcutoff;
-   
-};
-
-// The Geometric  measure, with 2 parameters: beta, Rcutoff
-// This measure is still evolving and shouldn't be used for any critial applications yet
-class GeometricCutoffMeasure : public MeasureDefinition {
-   
-public:
-   GeometricCutoffMeasure(double beta, double Rcutoff)
-   : _beta(beta), _Rcutoff(Rcutoff) {}
-
-   virtual GeometricCutoffMeasure* create() const {return new GeometricCutoffMeasure(*this);}
-
-   virtual std::string description() const;
-   
-   virtual MeasureFunction* createMeasureFunction() const {
-      return (new GeometricMeasureFunction(_beta,_Rcutoff));
-   }
-   
-   virtual AxesFinder* createOnePassAxesFinder() const {
-      return (new AxesFinderFromGeometricMinimization(_beta, _Rcutoff));
-   }
-   virtual AxesFinder* createMultiPassAxesFinder(unsigned int) const {
-      throw Error("GeometricCutoffMeasure does not support multi-pass minimization.");
-      return NULL;
-   }
-   
-   virtual bool supportsMultiPassMinimization() const { return false; }
-
-private:
-   double _beta;
-   double _Rcutoff;
-   
-};
-   
-   
-///////
-//
-// AxesDefinition
-//
-///////
-
-//Analogous to MeasureDefinition, AxesDefinition defines which AxesFinder to use
-//At the moment, most AxesDefinition do not have an arugment (except the Anti-KT ones)
-class AxesDefinition {
-   
-public:
-   // description of axes (and any parameters)
-   virtual std::string short_description() const = 0;
-   virtual std::string description() const = 0;
-   
-   // In derived classes, this should return a copy of the corresponding
-   // derived class
-   virtual AxesDefinition* create() const = 0;
-   
-   // These describe how the axes finder works
-   virtual bool givesRandomizedResults() const = 0;
-   virtual bool supportsManualAxes() const = 0;
-   
-   //for best testing
-   virtual AxesFinder* createStartingAxesFinder(const MeasureDefinition &) const = 0;
-   virtual AxesFinder* createFinishingAxesFinder(const MeasureDefinition &) const {
-      return NULL;  //By default, nothing.
-   };
-
-   virtual ~AxesDefinition() {};
-};
-
-// kt axes
-class KT_Axes : public AxesDefinition {
-public:
-   KT_Axes() {}
-
-   virtual std::string short_description() const {
-      return "KT";
-   };
-   
-   virtual std::string description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "KT Axes";
-      return stream.str();
-   };
-   
-   virtual KT_Axes* create() const {return new KT_Axes(*this);}
-
-   virtual bool givesRandomizedResults() const {return false;}
-   virtual bool supportsManualAxes() const {return false;}
-
-   virtual AxesFinder* createStartingAxesFinder(const MeasureDefinition &) const {
-      return (new AxesFinderFromKT());
-   }
-   
-};
-
-// ca axes
-class CA_Axes : public AxesDefinition {
-public:
-   CA_Axes() {}
-
-   virtual std::string short_description() const {
-      return "CA";
-   };
-   
-   virtual std::string description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "CA Axes";
-      return stream.str();
-   };
-   
-   virtual CA_Axes* create() const {return new CA_Axes(*this);}
-
-   virtual bool givesRandomizedResults() const {return false;}
-   virtual bool supportsManualAxes() const {return false;}
-
-   virtual AxesFinder* createStartingAxesFinder(const MeasureDefinition &) const {
-      return (new AxesFinderFromCA());
-   }
-   
-};
-
-// anti-kt axes, one parameter R0 is subjet radius
-class AntiKT_Axes : public AxesDefinition {
-
-public:
-   AntiKT_Axes(double R0 = 0.2): _R0(R0) {}
-
-   virtual std::string short_description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "AKT" << _R0;
-      return stream.str();
-   };
-   
-   virtual std::string description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "Anti-KT Axes (R0 = " << _R0 << ")";
-      return stream.str();
-   };
-   
-   virtual AntiKT_Axes* create() const {return new AntiKT_Axes(*this);}
-
-   virtual bool givesRandomizedResults() const {return false;}
-   virtual bool supportsManualAxes() const {return false;}
-
-   virtual AxesFinder* createStartingAxesFinder(const MeasureDefinition &) const {
-      return (new AxesFinderFromAntiKT(_R0));
-   }
-   
-   
-private:
-   double _R0;
-
-};
-
-// winner-take-all recombination with kt axes
-class WTA_KT_Axes : public AxesDefinition {
-public:
-   WTA_KT_Axes() {}
-
-   virtual std::string short_description() const {
-      return "WTA KT";
-   };
-   
-   virtual std::string description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "Winner-Take-All KT Axes";
-      return stream.str();
-   };
-   
-   virtual WTA_KT_Axes* create() const {return new WTA_KT_Axes(*this);}
-
-   virtual bool givesRandomizedResults() const {return false;}
-   virtual bool supportsManualAxes() const {return false;}
-
-   virtual AxesFinder* createStartingAxesFinder(const MeasureDefinition &) const {
-      return (new AxesFinderFromWTA_KT());
-   }
-
-   
-};
-
-// winner-take-all recombination with CA axes
-class WTA_CA_Axes : public AxesDefinition {
-public:
-   WTA_CA_Axes() {}
-
-   virtual std::string short_description() const {
-      return "WTA CA";
-   };
-   
-   virtual std::string description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "Winner-Take-All CA Axes";
-      return stream.str();
-   };
-   
-   virtual WTA_CA_Axes* create() const {return new WTA_CA_Axes(*this);}
-
-   virtual bool givesRandomizedResults() const {return false;}
-   virtual bool supportsManualAxes() const {return false;}
-
-   virtual AxesFinder* createStartingAxesFinder(const MeasureDefinition &) const {
-      return (new AxesFinderFromWTA_CA());
-   }
-   
-};
-   
-// Onepass minimization from kt axes
-class OnePass_KT_Axes : public AxesDefinition {
-public:
-   OnePass_KT_Axes() {}
-   
-   virtual std::string short_description() const {
-      return "OnePass KT";
-   };
-   
-   virtual std::string description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "One-Pass Minimization from KT Axes";
-      return stream.str();
-   };
-   
-   virtual OnePass_KT_Axes* create() const {return new OnePass_KT_Axes(*this);}
-   
-   virtual bool givesRandomizedResults() const {return false;}
-   virtual bool supportsManualAxes() const {return false;}
-
-   virtual AxesFinder* createStartingAxesFinder(const MeasureDefinition & ) const {
-      return (new AxesFinderFromKT());
-   }
-   virtual AxesFinder* createFinishingAxesFinder(const MeasureDefinition & measure_def) const {
-      return measure_def.createOnePassAxesFinder();
-   }
-
-};
-
-// Onepass minimization from CA axes
-class OnePass_CA_Axes : public AxesDefinition {
-public:
-   OnePass_CA_Axes() {}
-
-   virtual std::string short_description() const {
-      return "OnePass CA";
-   };
-   
-   virtual std::string description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "One-Pass Minimization from CA Axes";
-      return stream.str();
-   };
-   
-   virtual OnePass_CA_Axes* create() const {return new OnePass_CA_Axes(*this);}
-
-   virtual bool givesRandomizedResults() const {return false;}
-   virtual bool supportsManualAxes() const {return false;}
-
-   virtual AxesFinder* createStartingAxesFinder(const MeasureDefinition & ) const {
-      return (new AxesFinderFromCA());
-   }
-   virtual AxesFinder* createFinishingAxesFinder(const MeasureDefinition & measure_def) const {
-      return measure_def.createOnePassAxesFinder();
-   }
-};
-
-// Onepass minimization from AntiKT axes, one parameter R0
-class OnePass_AntiKT_Axes : public AxesDefinition {
-
-public:
-   OnePass_AntiKT_Axes(double R0): _R0(R0) {}
-   
-   virtual std::string short_description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "OnePassAKT" << _R0;
-      return stream.str();
-   };
-   
-   virtual std::string description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "One-Pass Minimization from Anti-KT Axes (R0 = " << _R0 << ")";
-      return stream.str();
-   };
-   
-   virtual OnePass_AntiKT_Axes* create() const {return new OnePass_AntiKT_Axes(*this);}
-
-   virtual bool givesRandomizedResults() const {return false;}
-   virtual bool supportsManualAxes() const {return false;}
-
-   virtual AxesFinder* createStartingAxesFinder(const MeasureDefinition & ) const {
-      return (new AxesFinderFromAntiKT(_R0));
-   }
-   virtual AxesFinder* createFinishingAxesFinder(const MeasureDefinition & measure_def) const {
-      return measure_def.createOnePassAxesFinder();
-   }
-
-private:
-   double _R0;
-};
-
-// Onepass minimization from winner-take-all kt axes
-class OnePass_WTA_KT_Axes : public AxesDefinition {
-public:
-   OnePass_WTA_KT_Axes() {}
-   
-   virtual std::string short_description() const {
-      return "OnePass WTA KT";
-   };
-   
-   virtual std::string description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "One-Pass Minimization from Winner-Take-All KT Axes";
-      return stream.str();
-   };
-   
-   virtual OnePass_WTA_KT_Axes* create() const {return new OnePass_WTA_KT_Axes(*this);}
-   
-   virtual bool givesRandomizedResults() const {return false;}
-   virtual bool supportsManualAxes() const {return false;}
-
-   virtual AxesFinder* createStartingAxesFinder(const MeasureDefinition & ) const {
-      return (new AxesFinderFromWTA_KT());
-   }
-   virtual AxesFinder* createFinishingAxesFinder(const MeasureDefinition & measure_def) const {
-      return measure_def.createOnePassAxesFinder();
-   }
-};
-
-
-// Onepass minimization from winner-take-all CA axes
-class OnePass_WTA_CA_Axes : public AxesDefinition {
-public:
-   OnePass_WTA_CA_Axes() {}
-
-   virtual std::string short_description() const {
-      return "OnePass WTA CA";
-   };
-   
-   virtual std::string description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "One-Pass Minimization from Winner-Take-All CA Axes";
-      return stream.str();
-   };
-   
-   virtual OnePass_WTA_CA_Axes* create() const {return new OnePass_WTA_CA_Axes(*this);}
-   
-
-   virtual bool givesRandomizedResults() const {return false;}
-   virtual bool supportsManualAxes() const {return false;}
-
-   
-   virtual AxesFinder* createStartingAxesFinder(const MeasureDefinition & ) const {
-      return (new AxesFinderFromWTA_CA());
-   }
-   virtual AxesFinder* createFinishingAxesFinder(const MeasureDefinition & measure_def) const {
-      return measure_def.createOnePassAxesFinder();
-   }
-
-   
-};
-   
-// set axes manually
-class Manual_Axes : public AxesDefinition {
-public:
-   Manual_Axes() {}
-   
-   virtual std::string short_description() const {
-      return "Manual";
-   };
-   
-   virtual std::string description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "Manual Axes";
-      return stream.str();
-   };
-   
-   virtual Manual_Axes* create() const {return new Manual_Axes(*this);}
-
-   virtual bool givesRandomizedResults() const {return false;}
-   virtual bool supportsManualAxes() const {return true;}
-
-   virtual AxesFinder* createStartingAxesFinder(const MeasureDefinition &) const {
-      return (new AxesFinderFromUserInput());
-   }
-};
-
-// one pass minimization from manual starting point
-class OnePass_Manual_Axes : public AxesDefinition {
-public:
-   OnePass_Manual_Axes() {}
-
-   virtual std::string short_description() const {
-      return "OnePass Manual";
-   };
-   
-   virtual std::string description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "One-Pass Minimization from Manual Axes";
-      return stream.str();
-   };
-   
-   virtual OnePass_Manual_Axes* create() const {return new OnePass_Manual_Axes(*this);}
-
-   virtual bool givesRandomizedResults() const {return false;}
-   virtual bool supportsManualAxes() const {return true;}
-
-   virtual AxesFinder* createStartingAxesFinder(const MeasureDefinition & ) const {
-      return (new AxesFinderFromUserInput());
-   }
-   virtual AxesFinder* createFinishingAxesFinder(const MeasureDefinition & measure_def) const {
-      return measure_def.createOnePassAxesFinder();
-   }
-
-   
-};
-   
-// multi-pass minimization from kT starting point
-class MultiPass_Axes : public AxesDefinition {
-
-public:
-   MultiPass_Axes(unsigned int Npass) : _Npass(Npass) {}
-
-   virtual std::string short_description() const {
-      return "MultiPass";
-   };
-   
-   virtual std::string description() const {
-      std::stringstream stream;
-      stream << std::fixed << std::setprecision(2)
-      << "Multi-Pass Axes (Npass = " << _Npass << ")";
-      return stream.str();
-   };
-   
-   virtual MultiPass_Axes* create() const {return new MultiPass_Axes(*this);}
-
-   virtual bool givesRandomizedResults() const {return true;}
-   virtual bool supportsManualAxes() const {return false;}
-
-   virtual AxesFinder* createStartingAxesFinder(const MeasureDefinition & ) const {
-      return (new AxesFinderFromKT());
-   }
-   virtual AxesFinder* createFnishingAxesFinder(const MeasureDefinition & measure_def) const {
-      return measure_def.createMultiPassAxesFinder(_Npass);
-   }
-   
-private:
-   unsigned int _Npass;
-   
-};
-   
-} // namespace contrib
-
-FASTJET_END_NAMESPACE
-
-#endif  // __FASTJET_CONTRIB_NJETTINESS_HH__
-
Index: external/fastjet/contribs/Nsubjettiness/NjettinessPlugin.cc
===================================================================
--- external/fastjet/contribs/Nsubjettiness/NjettinessPlugin.cc	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ external/fastjet/contribs/Nsubjettiness/NjettinessPlugin.cc	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -5,5 +5,5 @@
 //  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
 //
-//  $Id: NjettinessPlugin.cc 663 2014-06-03 21:26:41Z jthaler $
+//  $Id: NjettinessPlugin.cc 821 2015-06-15 18:50:53Z jthaler $
 //----------------------------------------------------------------------
 // This file is part of FastJet contrib.
@@ -29,5 +29,5 @@
 namespace contrib{
 
-
+LimitedWarning NjettinessPlugin::_old_constructor_warning;
 
 std::string NjettinessPlugin::description() const {return "N-jettiness jet finder";}
@@ -48,9 +48,9 @@
    
    
-   _njettinessFinder.getTau(_N, particles);
-
-   std::vector<std::list<int> > partition = _njettinessFinder.getPartitionList(particles);
-
-   std::vector<fastjet::PseudoJet> jet_indices_for_extras;
+   TauComponents tau_components = _njettinessFinder.getTauComponents(_N, particles);
+   TauPartition tau_partition = _njettinessFinder.currentPartition();
+   std::vector<std::list<int> > partition = tau_partition.jets_list();
+   
+   std::vector<int> jet_indices_for_extras;
 
    // output clusterings for each jet
@@ -73,5 +73,5 @@
       int finalJet = indices.back();
       cs.plugin_record_iB_recombination(finalJet, fakeDib);
-      jet_indices_for_extras.push_back(cs.jets()[finalJet]);  // Get the four vector for the final jets to compare later.
+      jet_indices_for_extras.push_back(cs.jets()[finalJet].cluster_hist_index());  // Get the four vector for the final jets to compare later.
    }
 
@@ -79,7 +79,14 @@
    reverse(jet_indices_for_extras.begin(),jet_indices_for_extras.end());
 
-   NjettinessExtras * extras = new NjettinessExtras(_njettinessFinder.currentTauComponents(),jet_indices_for_extras,_njettinessFinder.currentAxes());
+   // Store extra information about jets 
+   NjettinessExtras * extras = new NjettinessExtras(tau_components,jet_indices_for_extras);
+
+#if FASTJET_VERSION_NUMBER>=30100
+   cs.plugin_associate_extras(extras);
+#else
+   // auto_ptr no longer supported, apparently
    cs.plugin_associate_extras(std::auto_ptr<ClusterSequence::Extras>(extras));
-   
+#endif
+  
 }
 
Index: external/fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh
===================================================================
--- external/fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ external/fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -5,5 +5,5 @@
 //  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
 //
-//  $Id: NjettinessPlugin.hh 671 2014-06-10 17:47:52Z jthaler $
+//  $Id: NjettinessPlugin.hh 822 2015-06-15 23:52:57Z jthaler $
 //----------------------------------------------------------------------
 // This file is part of FastJet contrib.
@@ -26,7 +26,10 @@
 #define __FASTJET_CONTRIB_NJETTINESSPLUGIN_HH__
 
+#include <fastjet/config.h>
+
 #include "Njettiness.hh"
-#include "MeasureFunction.hh"
-#include "AxesFinder.hh"
+#include "MeasureDefinition.hh"
+#include "AxesDefinition.hh"
+#include "TauComponents.hh"
 
 #include "fastjet/ClusterSequence.hh"
@@ -41,72 +44,7 @@
 namespace contrib {
 
-//------------------------------------------------------------------------
-/// \class NjettinessExtras
-// This class contains the same information as Njettiness, but redoes it in terms of the ClusterSequence::Extras class.
-// This is done in order to help improve the interface for the main NjettinessPlugin class.
-// TODO:  This class should probably be merged with TauComponents, since both have access
-// to similar information
-class NjettinessExtras : public ClusterSequence::Extras {
-   
-   public:
-      NjettinessExtras(TauComponents tau_components, std::vector<fastjet::PseudoJet> jets, std::vector<fastjet::PseudoJet> axes) : _tau_components(tau_components), _jets(jets), _axes(axes) {}
-      
-      double totalTau() const {return _tau_components.tau();}
-      std::vector<double> subTaus() const {return _tau_components.jet_pieces();}
-      std::vector<fastjet::PseudoJet> jets() const {return _jets;}
-      std::vector<fastjet::PseudoJet> axes() const {return _axes;}
-      
-      double totalTau(const fastjet::PseudoJet& /*jet*/) const {
-         return _tau_components.tau();
-      }
-      
-      double subTau(const fastjet::PseudoJet& jet) const {
-         if (labelOf(jet) == -1) return std::numeric_limits<double>::quiet_NaN(); // nonsense
-         return _tau_components.jet_pieces()[labelOf(jet)];
-      }
-      
-      double beamTau() const {
-         return _tau_components.beam_piece();
-      }
-      
-      fastjet::PseudoJet axis(const fastjet::PseudoJet& jet) const {
-         return _axes[labelOf(jet)];
-      }
 
-      bool has_njettiness_extras(const fastjet::PseudoJet& jet) const {
-         return (labelOf(jet) >= 0);
-      }
-   
-private:
-   
-   TauComponents _tau_components;
-   std::vector<fastjet::PseudoJet> _jets;
-   std::vector<fastjet::PseudoJet> _axes;
-   
-   int labelOf(const fastjet::PseudoJet& jet) const {
-      int thisJet = -1;
-      for (unsigned int i = 0; i < _jets.size(); i++) {
-         if (_jets[i].cluster_hist_index() == jet.cluster_hist_index()) {
-            thisJet = i;
-            break;
-         }
-      }
-      return thisJet;
-   }
-};
-
-inline const NjettinessExtras * njettiness_extras(const fastjet::PseudoJet& jet) {
-   const ClusterSequence * myCS = jet.associated_cluster_sequence();   
-   if (myCS == NULL) return NULL;
-   const NjettinessExtras* extras = dynamic_cast<const NjettinessExtras*>(myCS->extras());   
-   return extras;   
-}
-
-inline const NjettinessExtras * njettiness_extras(const fastjet::ClusterSequence& myCS) {
-   const NjettinessExtras* extras = dynamic_cast<const NjettinessExtras*>(myCS.extras());   
-   return extras;   
-}
-
-/// The Njettiness jet algorithm
+/// \class NjettinessPlugin
+/// \brief Implements the N-jettiness Jet Algorithm
 /**
  * An exclusive jet finder that identifies N jets; first N axes are found, then
@@ -114,29 +52,33 @@
  * corresponding jet is simply the four-momentum sum of these particles.
  *
- * Axes can be found in several ways, specified by the AxesMode argument.  The
- * recommended choices are
+ * As of version 2.2, it is recommended to use the XConePlugin, which has
+ * sensible default values for jet finding.
  *
- * kt_axes              : exclusive kT
- * wta_kt_axes          : exclusive kT with winner-take-all-recombination
- * onepass_kt_axes      : one-pass minimization seeded by kt (pretty good)
- * onepass_wta_kt_axes  : one-pass minimization seeded by wta_kt
+ * Axes can be found in several ways, specified by the AxesDefinition argument.
+ * The recommended AxesDefinitions for jet finding (different than for jet shapes)
+ *    OnePass_AntiKT(R0)  :  one-pass minimization from anti-kT starting point
+ *    OnePass_GenET_GenKT_Axes(delta, p, R0) : one-pass min. from GenET/KT
+ *    OnePass_WTA_GenKT_Axes(p, R0)          : one-pass min from WTA/GenKT
+ * For recommendations on which axes to use, please see the README file.
+ * 
+ * Jet regions are determined by the MeasureDefinition.  The recommended choices
+ * for jet finding are
+ *    ConicalMeasure(beta,R0) : perfect cones in rapidity/azimuth plane
+ *    XConeMeasure(beta,R0)   : approximate cones based on dot product distances.
  *
- * For the UnnormalizedMeasure(beta), N-jettiness is defined as:
- *
- * tau_N = Sum_{all particles i} p_T^i min((DR_i1)^beta, (DR_i2)^beta, ...)
- *
- *   DR_ij is the distance sqrt(Delta_phi^2 + Delta_rap^2) between particle i
- *   and jet j.
+ * Other measures introduced in version 2.2 include OriginalGeometricMeasure,
+ * ModifiedGeometricMeasure, and ConicalGeometricMeasure, which define N-jettiness
+ * through dot products of particle momenta with light-like axes. OriginalGeometricMeasure
+ * produces football-shaped jets due to its central weighting of the beam measure,
+ * but ModifiedGeometric and ConicalGeometric both deform the original geometric measure
+ * to allow for cone-shaped jets. The size of these cones can be controlled through Rcutoff
+ * just as in the other measures. See the README file or MeasureDefinition.hh for information
+ * on how to call these measures.
  * 
- * The NormalizedMeausure include an extra parameter R0, and the various cutoff
- * measures include an Rcutoff, which effectively defines an angular cutoff
- * similar in effect to a cone-jet radius.
- *
  */
-
 class NjettinessPlugin : public JetDefinition::Plugin {
 public:
 
-   // Constructor with same arguments as Nsubjettiness.
+   /// Constructor with same arguments as Nsubjettiness (N, AxesDefinition, MeasureDefinition)
    NjettinessPlugin(int N,
                     const AxesDefinition & axes_def,
@@ -144,39 +86,81 @@
    : _njettinessFinder(axes_def, measure_def), _N(N) {}
    
+
+   /// Description
+   virtual std::string description () const;
+   /// Jet radius (this does not make sense yet)
+   virtual double R() const {return -1.0;} // TODO: make this not stupid
+
+   /// The actually clustering, which first called Njettiness and then creates a dummy ClusterSequence
+   virtual void run_clustering(ClusterSequence&) const;
+
+   /// For using manual axes with Njettiness Plugin
+   void setAxes(const std::vector<fastjet::PseudoJet> & myAxes) {
+      // Cross check that manual axes are being used is in Njettiness
+      _njettinessFinder.setAxes(myAxes);
+   }
+
+   /// Destructor
+   virtual ~NjettinessPlugin() {}
+
+private:
+
+   Njettiness _njettinessFinder;  ///< The core Njettiness that does the heavy lifting
+   int _N;  ///< Number of exclusive jets to find.
+
+   /// Warning if the user tries to use v1.0.3 constructor.
+   static LimitedWarning _old_constructor_warning;
    
+public:
+
    // Alternative constructors that define the measure via enums and parameters
-   // These constructors are likely be removed
+   // These constructors are deprecated and will be removed in a future version.
+   
+   /// \deprecated
+   /// Old-style constructor with 0 arguments (DEPRECATED)
    NjettinessPlugin(int N,
-                 Njettiness::AxesMode axes_mode,
-                 Njettiness::MeasureMode measure_mode)
-   : _njettinessFinder(axes_mode, measure_mode, 0), _N(N) {}
+                    Njettiness::AxesMode axes_mode,
+                    Njettiness::MeasureMode measure_mode)
+   : _njettinessFinder(axes_mode, measure_mode, 0), _N(N) {
+      _old_constructor_warning.warn("NjettinessPlugin:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the NjettinessPlugin constructor based on AxesDefinition and MeasureDefinition instead.");
+   }
    
+   /// \deprecated
+   /// Old-style constructor with 1 argument (DEPRECATED)
+      NjettinessPlugin(int N,
+                    Njettiness::AxesMode axes_mode,
+                    Njettiness::MeasureMode measure_mode,
+                    double para1)
+   : _njettinessFinder(axes_mode, measure_mode, 1, para1), _N(N) {
+      _old_constructor_warning.warn("NjettinessPlugin:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the NjettinessPlugin constructor based on AxesDefinition and MeasureDefinition instead.");
    
+   }
+   
+   /// \deprecated
+   /// Old-style constructor with 2 arguments (DEPRECATED)
    NjettinessPlugin(int N,
-                 Njettiness::AxesMode axes_mode,
-                 Njettiness::MeasureMode measure_mode,
-                 double para1)
-   : _njettinessFinder(axes_mode, measure_mode, 1, para1), _N(N) {}
+                    Njettiness::AxesMode axes_mode,
+                    Njettiness::MeasureMode measure_mode,
+                    double para1,
+                    double para2)
+   : _njettinessFinder(axes_mode, measure_mode, 2, para1, para2), _N(N) {
+      _old_constructor_warning.warn("NjettinessPlugin:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the NjettinessPlugin constructor based on AxesDefinition and MeasureDefinition instead.");
    
+   }
    
+   /// \deprecated
+   /// Old-style constructor with 3 arguments (DEPRECATED)
    NjettinessPlugin(int N,
-                 Njettiness::AxesMode axes_mode,
-                 Njettiness::MeasureMode measure_mode,
-                 double para1,
-                 double para2)
-   : _njettinessFinder(axes_mode, measure_mode, 2, para1, para2), _N(N) {}
+                    Njettiness::AxesMode axes_mode,
+                    Njettiness::MeasureMode measure_mode,
+                    double para1,
+                    double para2,
+                    double para3)
+   : _njettinessFinder(axes_mode, measure_mode, 3, para1, para2, para3), _N(N) {
+      _old_constructor_warning.warn("NjettinessPlugin:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the NjettinessPlugin constructor based on AxesDefinition and MeasureDefinition instead.");
+   }
    
-   
-   NjettinessPlugin(int N,
-                 Njettiness::AxesMode axes_mode,
-                 Njettiness::MeasureMode measure_mode,
-                 double para1,
-                 double para2,
-                 double para3)
-   : _njettinessFinder(axes_mode, measure_mode, 3, para1, para2, para3), _N(N) {}
-
-
-   // Old constructor for backwards compatibility with v1.0,
-   // where NormalizedCutoffMeasure was the only option
+   /// \deprecated
+   /// Old-style constructor for backwards compatibility with v1.0, when NormalizedCutoffMeasure was the only option
    NjettinessPlugin(int N,
                     Njettiness::AxesMode mode,
@@ -184,19 +168,8 @@
                     double R0,
                     double Rcutoff=std::numeric_limits<double>::max())
-   : _njettinessFinder(mode, NormalizedCutoffMeasure(beta, R0, Rcutoff)), _N(N) {}
+   : _njettinessFinder(mode, NormalizedCutoffMeasure(beta, R0, Rcutoff)), _N(N) {
+      _old_constructor_warning.warn("NjettinessPlugin:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the NjettinessPlugin constructor based on AxesDefinition and MeasureDefinition instead.");
+   }
 
-
-
-   // The things that are required by base class.
-   virtual std::string description () const;
-   virtual double R() const {return -1.0;} // TODO: make this not stupid
-   virtual void run_clustering(ClusterSequence&) const;
-
-   virtual ~NjettinessPlugin() {}
-
-private:
-
-   Njettiness _njettinessFinder;
-   int _N;
 
 };
Index: external/fastjet/contribs/Nsubjettiness/Nsubjettiness.cc
===================================================================
--- external/fastjet/contribs/Nsubjettiness/Nsubjettiness.cc	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ external/fastjet/contribs/Nsubjettiness/Nsubjettiness.cc	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -5,5 +5,5 @@
 //  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
 //
-//  $Id: Nsubjettiness.cc 597 2014-04-16 23:07:55Z jthaler $
+//  $Id: Nsubjettiness.cc 821 2015-06-15 18:50:53Z jthaler $
 //----------------------------------------------------------------------
 // This file is part of FastJet contrib.
@@ -29,4 +29,7 @@
 namespace contrib {
 
+LimitedWarning Nsubjettiness::_old_constructor_warning;
+   
+   
 //result returns tau_N with normalization dependent on what is specified in constructor
 double Nsubjettiness::result(const PseudoJet& jet) const {
Index: external/fastjet/contribs/Nsubjettiness/Nsubjettiness.hh
===================================================================
--- external/fastjet/contribs/Nsubjettiness/Nsubjettiness.hh	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ external/fastjet/contribs/Nsubjettiness/Nsubjettiness.hh	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -5,5 +5,5 @@
 //  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
 //
-//  $Id: Nsubjettiness.hh 670 2014-06-06 01:24:42Z jthaler $
+//  $Id: Nsubjettiness.hh 822 2015-06-15 23:52:57Z jthaler $
 //----------------------------------------------------------------------
 // This file is part of FastJet contrib.
@@ -38,36 +38,56 @@
 namespace contrib {
 
-//------------------------------------------------------------------------
+// Classes defined in this file.
+class Nsubjettiness;
+class NsubjettinessRatio;
+   
+///------------------------------------------------------------------------
 /// \class Nsubjettiness
-/// Nsubjettiness extends the concept of Njettiness to a jet shape, but other
-/// than the set of particles considered, they are identical.  This class
-/// wraps the core Njettiness code to provide the fastjet::FunctionOfPseudoJet
-/// interface for convenience in larger analyses.  See NjettinessPlugin.hh for
-/// definitions of tau_N and the constructor options.
+/// \brief Implements the N-subjettiness jet shape
+///
+/**
+ * The N-jettiness jet shape.
+ *
+ * Nsubjettiness extends the concept of Njettiness to a jet shape, but other
+ * than the set of particles considered, they are identical.  This class
+ * wraps the core Njettiness code to provide the fastjet::FunctionOfPseudoJet
+ * interface for convenience in larger analyses.
+ *
+ * The recommended AxesDefinitions are:
+ *   KT_Axes             : exclusive kt axes
+ *   WTA_KT_Axes         : exclusive kt with winner-take-all recombination
+ *   OnePass_KT_Axes     : one-pass minimization from kt starting point
+ *   OnePass_WTA_KT_Axes : one-pass min. from wta_kt starting point
+ * More AxesDefinitions are listed in the README and defined in AxesDefinition.hh
+ *
+ * The recommended MeasureDefinitions are (with the corresponding parameters)
+ *   NormalizedMeasure(beta,R0)
+ *      :  This was the original N-subjettiness measure (dimensionless)
+ *   UnnormalizedMeasure(beta)
+ *      :  This is the new recommended default, same as above but without
+ *      :  the normalization factor, and hence has units of GeV
+ *   NormalizedCutoffMeasure(beta,R0,Rcutoff)
+ *      :  Same as normalized_measure, but cuts off at Rcutoff
+ *   UnnormalizedCutoffMeasure(beta,Rcutoff)
+ *      :  Same as unnormalized_measure, but cuts off at Rcutoff
+ * More MeasureDefinitions are listed in the README and defined in MeasureDefinition.hh
+ *
+ * For example, for the UnnormalizedMeasure(beta), N-subjettiness is defined as:
+ *
+ * tau_N = Sum_{i in jet} p_T^i min((DR_i1)^beta, (DR_i2)^beta, ...)
+ *
+ *   DR_ij is the distance sqrt(Delta_phi^2 + Delta_rap^2) between particle i
+ *   and jet j.
+ *
+ * The NormalizedMeausure include an extra parameter R0, and the various cutoff
+ * measures include an Rcutoff, which effectively defines an angular cutoff
+ * similar in effect to a cone-jet radius.
+ */
 class Nsubjettiness : public FunctionOfPseudoJet<double> {
 
 public:
-
-   
-   // Main constructor, which takes N, the AxesDefiniation, and the MeasureDefinition.
-   // The Definitions are given in NjettinessDefinition.hh
-   //
-   // The recommended AxesDefinitions are (more are available as listed in the README
-   // and defined in NjettinessDefinition.hh):
-   //   KT_Axes             : exclusive kt axes
-   //   WTA_KT_Axes         : exclusive kt with winner-take-all recombination
-   //   OnePass_KT_Axes     : one-pass minimization from kt starting point
-   //   OnePass_WTA_KT_Axes : one-pass min. from wta_kt starting point
-   //
-   // The recommended measure definitions are (with the corresponding parameters)
-   //   NormalizedMeasure(beta,R0)
-   //      :  This was the original N-subjettiness measure (dimensionless)
-   //   UnnormalizedMeasure(beta)
-   //      :  This is the new recommended default, same as above but without
-   //      :  the normalization factor, and hence has units of GeV
-   //   NormalizedCutoffMeasure(beta,R0,Rcutoff)
-   //      :  Same as normalized_measure, but cuts off at Rcutoff
-   //   UnnormalizedCutoffMeasure(beta,Rcutoff)
-   //      :  Same as unnormalized_measure, but cuts off at Rcutoff
+   
+   /// Main constructor, which takes N, the AxesDefinition, and the MeasureDefinition.
+   /// The Definitions are given in AxesDefinition.hh and MeasureDefinition.hh
    Nsubjettiness(int N,
                  const AxesDefinition& axes_def,
@@ -75,25 +95,84 @@
    : _njettinessFinder(axes_def,measure_def), _N(N) {}
    
-   
-   // Alternative constructors that define the measure via enums and parameters
-   // These constructors are likely be removed
-   // Zero parameter arguments
-   // (Currently, no measure uses this)
+   /// Returns tau_N, measured on the constituents of this jet
+   double result(const PseudoJet& jet) const;
+
+   /// Returns components of tau_N, so that user can find individual tau values.
+   TauComponents component_result(const PseudoJet& jet) const;
+   
+   /// To set axes in manual mode
+   void setAxes(const std::vector<fastjet::PseudoJet> & myAxes) {
+      // Note that cross check that manual mode has been set is in Njettiness
+    	_njettinessFinder.setAxes(myAxes);
+   }
+   
+   /// returns seed axes used for onepass minimization (otherwise same as currentAxes)
+   std::vector<fastjet::PseudoJet> seedAxes() const {
+      return _njettinessFinder.seedAxes();
+   }
+   
+   /// returns current axes found by result() calculation
+   std::vector<fastjet::PseudoJet> currentAxes() const {
+      return _njettinessFinder.currentAxes();
+   }
+
+   /// returns subjet regions found by result() calculation (these have valid constituents)
+   /// Note that the axes and the subjets are not the same
+   std::vector<fastjet::PseudoJet> currentSubjets() const {
+      return _njettinessFinder.currentJets();
+   }
+
+   /// returns components of tau_N without recalculating anything
+   TauComponents currentTauComponents() const {
+      return _njettinessFinder.currentTauComponents();
+   }
+
+   /// returns components of tau_N without recalculating anything
+   TauPartition currentPartition() const {
+      return _njettinessFinder.currentPartition();
+   }
+   
+private:
+   
+   /// Core Njettiness code that is called
+   Njettiness _njettinessFinder; // TODO:  should muck with this so result can be const without this mutable
+   /// Number of subjets to find
+   int _N;
+   
+   /// Warning if the user tries to use v1.0.3 constructor.
+   static LimitedWarning _old_constructor_warning;
+
+public:
+   
+   // The following interfaces are included for backwards compatibility, but no longer recommended.
+   // They may be deleted in a future release
+   
+   /// \deprecated
+   /// Alternative constructors that define the measure via enums and parameters
+   /// These constructors will be removed in v3.0
+   /// Zero parameter arguments
+   /// (Currently, no measure uses this)
    Nsubjettiness(int N,
                  Njettiness::AxesMode axes_mode,
                  Njettiness::MeasureMode measure_mode)
-   : _njettinessFinder(axes_mode, measure_mode, 0), _N(N) {}
-
-   // One parameter argument
-   // (for unnormalized_measure, para1=beta)
+   : _njettinessFinder(axes_mode, measure_mode, 0), _N(N) {
+      _old_constructor_warning.warn("Nsubjettiness:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead.");
+   }
+   
+   /// \deprecated
+   /// Construcotr for one parameter argument
+   /// (for unnormalized_measure, para1=beta)
    Nsubjettiness(int N,
                  Njettiness::AxesMode axes_mode,
                  Njettiness::MeasureMode measure_mode,
                  double para1)
-   : _njettinessFinder(axes_mode, measure_mode, 1, para1), _N(N) {}
-
-   // Two parameter arguments
-   // (for normalized_measure, para1=beta, para2=R0)
-   // (for unnormalized_cutoff_measure, para1=beta, para2=Rcutoff)
+   : _njettinessFinder(axes_mode, measure_mode, 1, para1), _N(N) {
+      _old_constructor_warning.warn("Nsubjettiness:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead.");
+   }
+   
+   /// \deprecated
+   /// Constructor for two parameter arguments
+   /// (for normalized_measure, para1=beta, para2=R0)
+   /// (for unnormalized_cutoff_measure, para1=beta, para2=Rcutoff)
    Nsubjettiness(int N,
                  Njettiness::AxesMode axes_mode,
@@ -101,8 +180,11 @@
                  double para1,
                  double para2)
-   : _njettinessFinder(axes_mode, measure_mode, 2, para1, para2), _N(N) {}
-
-   // Three parameter arguments
-   // (for unnormalized_cutoff_measure, para1=beta, para2=R0, para3=Rcutoff)
+   : _njettinessFinder(axes_mode, measure_mode, 2, para1, para2), _N(N) {
+      _old_constructor_warning.warn("Nsubjettiness:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead.");
+   }
+   
+   /// \deprecated
+   /// Constructor for three parameter arguments
+   /// (for unnormalized_cutoff_measure, para1=beta, para2=R0, para3=Rcutoff)
    Nsubjettiness(int N,
                  Njettiness::AxesMode axes_mode,
@@ -111,8 +193,11 @@
                  double para2,
                  double para3)
-   : _njettinessFinder(axes_mode, measure_mode, 3, para1, para2, para3), _N(N) {}
-
-   // Old constructor for backwards compatibility with v1.0,
-   // where normalized_cutoff_measure was the only option
+   : _njettinessFinder(axes_mode, measure_mode, 3, para1, para2, para3), _N(N) {
+      _old_constructor_warning.warn("Nsubjettiness:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead.");
+   }
+   
+   /// \deprecated
+   /// Old constructor for backwards compatibility with v1.0,
+   /// where normalized_cutoff_measure was the only option
    Nsubjettiness(int N,
                  Njettiness::AxesMode axes_mode,
@@ -120,57 +205,23 @@
                  double R0,
                  double Rcutoff=std::numeric_limits<double>::max())
-   : _njettinessFinder(axes_mode, NormalizedCutoffMeasure(beta,R0,Rcutoff)), _N(N) {}
-   
-   /// returns tau_N, measured on the constituents of this jet 
-   double result(const PseudoJet& jet) const;
-
-   /// returns components of tau_N, so that user can find individual tau values.
-   TauComponents component_result(const PseudoJet& jet) const;
-   
-   /// returns current axes found by result() calculation
-   std::vector<fastjet::PseudoJet> currentAxes() const {
-      return _njettinessFinder.currentAxes();
-   }
-
-   /// returns seed axes used for onepass minimization (otherwise same as currentAxes)
-   std::vector<fastjet::PseudoJet> seedAxes() const {
-      return _njettinessFinder.seedAxes();
-   }
-   
-   /// returns subjet regions found by result() calculation (these have valid constituents)
-   /// Note that the axes and the subjets are not the same
-   std::vector<fastjet::PseudoJet> currentSubjets() const {
-      return _njettinessFinder.currentJets();
-   }
-
-   /// returns components of tau_N without recalculating anything
-   TauComponents currentTauComponents() const {
-      return _njettinessFinder.currentTauComponents();
-   }
-   
-   // To set axes for manual use
-   void setAxes(const std::vector<fastjet::PseudoJet> & myAxes) {
-      // Cross check that manual axes are being used is in Njettiness
-    	_njettinessFinder.setAxes(myAxes);
-   }
-   
-   
-private:
-   
-   Njettiness _njettinessFinder; // TODO:  should muck with this so result can be const without this mutable
-   int _N;
-
+   : _njettinessFinder(axes_mode, NormalizedCutoffMeasure(beta,R0,Rcutoff)), _N(N) {
+      _old_constructor_warning.warn("Nsubjettiness:  You are using the old style constructor.  This is deprecated as of v2.1 and will be removed in v3.0.  Please use the Nsubjettiness constructor based on AxesDefinition and MeasureDefinition instead.");
+   }
+   
 };
 
 
-//------------------------------------------------------------------------
+///------------------------------------------------------------------------
 /// \class NsubjettinessRatio
-// NsubjettinessRatio uses the results from Nsubjettiness to calculate the ratio
-// tau_N/tau_M, where N and M are specified by the user. The ratio of different tau values
-// is often used in analyses, so this class is helpful to streamline code.
+/// \brief Implements ratios of N-subjettiness jet shapes
+///
+/// NsubjettinessRatio uses the results from Nsubjettiness to calculate the ratio
+/// tau_N/tau_M, where N and M are specified by the user. The ratio of different tau values
+/// is often used in analyses, so this class is helpful to streamline code.  Note that
+/// manual axis mode is not supported
 class NsubjettinessRatio : public FunctionOfPseudoJet<double> {
 public:
 
-   // Main constructor.  Apart from specifying both N and M, the same options as Nsubjettiness
+   /// Main constructor.  Apart from specifying both N and M, the same options as Nsubjettiness
    NsubjettinessRatio(int N,
                       int M,
@@ -178,8 +229,27 @@
                       const MeasureDefinition & measure_def)
    : _nsub_numerator(N,axes_def,measure_def),
-   _nsub_denominator(M,axes_def,measure_def) {}
-   
-   // Alternative constructor with enums and parameters
-   // Again, likely to be removed
+   _nsub_denominator(M,axes_def,measure_def) {
+      if (axes_def.needsManualAxes()) {
+         throw Error("NsubjettinessRatio does not support ManualAxes mode.");
+      }
+   }
+
+   /// Returns tau_N/tau_M based off the input jet using result function from Nsubjettiness
+   double result(const PseudoJet& jet) const;
+
+private: 
+
+   Nsubjettiness _nsub_numerator;   ///< Function for numerator
+   Nsubjettiness _nsub_denominator; ///< Function for denominator
+
+public:
+   
+   // The following interfaces are included for backwards compatibility, but no longer recommended.
+   // They may be deprecated at some point.
+   
+   /// \deprecated
+   /// Old-style constructor for zero arguments
+   /// Alternative constructor with enums and parameters
+   /// Again, likely to be removed
    NsubjettinessRatio(int N,
                       int M,
@@ -188,6 +258,7 @@
    : _nsub_numerator(N, axes_mode, measure_mode),
    _nsub_denominator(M, axes_mode, measure_mode) {}
-
-   
+   
+   /// \deprecated
+   /// Old-style constructor for one argument
    NsubjettinessRatio(int N,
                       int M,
@@ -197,5 +268,7 @@
    : _nsub_numerator(N, axes_mode, measure_mode, para1),
    _nsub_denominator(M, axes_mode, measure_mode, para1) {}
-
+   
+   /// \deprecated
+   /// Old-style constructor for 2 arguments
    NsubjettinessRatio(int N,
                       int M,
@@ -207,4 +280,6 @@
    _nsub_denominator(M, axes_mode, measure_mode, para1, para2) {}
    
+   /// \deprecated
+   /// Old-style constructor for 3 arguments
    NsubjettinessRatio(int N,
                       int M,
@@ -217,12 +292,5 @@
    _nsub_denominator(M, axes_mode, measure_mode, para1, para2, para3) {}
 
-   //returns tau_N/tau_M based off the input jet using result function from Nsubjettiness
-   double result(const PseudoJet& jet) const;
-
-private: 
-
-   Nsubjettiness _nsub_numerator;
-   Nsubjettiness _nsub_denominator;
-
+   
 };
 
Index: external/fastjet/contribs/Nsubjettiness/README
===================================================================
--- external/fastjet/contribs/Nsubjettiness/README	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ external/fastjet/contribs/Nsubjettiness/README	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -15,9 +15,24 @@
 New in v2.0 is the winner-take-all axis, which is described in:
 
+   Jet Observables Without Jet Algorithms. 
+   Daniele Bertolini, Tucker Chan, and Jesse Thaler. 
+   JHEP 1404:013 (2014), arXiv:1310.7584.
+
    Jet Shapes with the Broadening Axis. 
    Andrew J. Larkoski, Duff Neill, and Jesse Thaler. 
    JHEP 1404:017 (2014), arXiv:1401.2158.
 
-as well as in unpublished work by Gavin Salam.
+   Unpublished work by Gavin Salam
+
+New in v2.2 are new measures used in the XCone jet algorithm, described in:
+
+   XCone: N-jettiness as an Exclusive Cone Jet Algorithm.
+   Iain W. Stewart, Frank J. Tackmann, Jesse Thaler,
+   Christopher K. Vermilion, and Thomas F. Wilkason.
+   arXiv:1508.01516.
+
+   Resolving Boosted Jets with XCone.
+   Jesse Thaler and Thomas F. Wilkason.
+   arXiv:1508.01518.
 
 --------------------------------------------------------------------------------
@@ -29,17 +44,27 @@
 
 Nsubjettiness       [Nsubjettiness.hh]:
-   A FunctionOfPseudoJet<double> interface to measure N-subjettiness
+   A FunctionOfPseudoJet<double> interface to measure the
+   N-subjettiness jet shape
    (Recommended for most users)
+
 NsubjettinessRatio  [Nsubjettiness.hh]:
    A FunctionOfPseudoJet<double> interface to measure ratios of
    two different N-subjettiness (i.e. tau3/tau2)
+   (Recommended for most users)
+
+XConePlugin         [XConePlugin.hh]:
+   A FastJet plugin for using the XCone jet algorithm.
+   (Recommended for most users)
+
 NjettinessPlugin    [NjettinessPlugin.hh]:
-   A FastJet plugin for finding jets by minimizing N-jettiness
-   (Recommended for advanced users)
+   A FastJet plugin for finding jets by minimizing N-jettiness.
+   Same basic philosophy as XCone, but many more options.
+   (Recommended for advanced users only.)
+
 Njettiness          [Njettiness.hh]:
    Access to the core Njettiness code.
    (Not recommended for users, since the interface might change)
 
-The code assumes that you have FastJet 3.
+The code assumes that you have FastJet 3, but does not (yet) require FastJet 3.1
 
 --------------------------------------------------------------------------------
@@ -64,4 +89,14 @@
     // N and M give tau_N / tau_M, all other options the same
 
+For example, if you just want the tau_2/tau_1 value of a jet, using recommended
+parameter choices, do this:
+
+    PseudoJet this_jet = /*from your favorite jet algorithm*/;
+    double beta = 1.0;
+    NsubjettinessRatio nSub21(2,1,
+                              OnePass_WTA_KT_Axes(),
+                              UnnormalizedMeasure(beta));
+    double tau21 = nSub21(this_jet);
+
 --------------------------------------------------------------------------------
 AxesDefinition  [NjettinessDefinition.hh]
@@ -72,14 +107,34 @@
 recommended. Arguments in parentheses are parameters that the user must set.
 
-Axes can be found using standard recursive clustering procedures.  New is the
-option to use the "winner-take-all" recombination scheme:
-(*) KT_Axes           // exclusive kt axes
-    CA_Axes           // exclusive ca axes
-    AntiKT_Axes(R0)   // inclusive hardest axes with antikt, R0 = radius
-(*) WTA_KT_Axes       // exclusive kt with winner-take-all recombination
-    WTA_CA_Axes       // exclusive ca with winner-take-all recombination
-
-One can also run a minimization routine to find a (local) minimum of
-N-(sub)jettiness:
+Axes can be found using standard recursive clustering procedures.  New in v2 is
+the option to use the "winner-take-all" recombination scheme:
+(*) KT_Axes          // exclusive kt axes
+    CA_Axes          // exclusive ca axes
+    AntiKT_Axes(R0)  // inclusive hardest axes with antikt, R0 = radius
+(*) WTA_KT_Axes      // exclusive kt with winner-take-all recombination
+    WTA_CA_Axes      // exclusive ca with winner-take-all recombination
+
+New in v2.2 are generalized recombination/clustering schemes:
+    GenET_GenKT_Axes(delta, p, R0 = inf)
+    WTA_GenKT_Axes(p, R0 = inf)
+    GenKT_Axes(p, R0 = inf)
+Here, delta > 0 labels the generalized ET recombination scheme (delta = 1 for
+standard ET scheme, delta = 2 for ET^2 scheme, delta = infinity for WTA scheme)
+p >= 0 labels the generalized KT clustering metric (p = 0 for ca, p = 1 for kt),
+R0 is the radius parameter, and the clustering is run in exclusive mode.  The
+GenKT_Axes mode uses standard E-scheme recombination.  By default the value of
+R0 is set to "infinity", namely fastjet::JetDefinition::max_allowable_R.
+
+Also new in v2.2 is option of identifying nExtra axes through exclusive
+clustering and then looking at all (N + nExtra) choose N axes and finding the 
+one that gives the smallest N-(sub)jettiness value:
+    Comb_GenET_GenKT_Axes(nExtra, delta, p, R0 = inf)
+    Comb_WTA_GenKT_Axes(nExtra, p, R0 = inf)
+    Comb_GenKT_Axes(nExtra, p, R0 = inf)
+These modes are not recommended for reasons of speed.
+
+Starting from any set of seed axes, one can run a minimization routine to find
+a (local) minimum of N-(sub)jettiness.  Note that the one-pass minimization
+routine is tied to the choice of MeasureDefinition.
 (*) OnePass_KT_Axes          // one-pass minimization from kt starting point
     OnePass_CA_Axes          // one-pass min. from ca starting point
@@ -87,19 +142,35 @@
 (*) OnePass_WTA_KT_Axes      // one-pass min. from wta_kt starting point
     OnePass_WTA_CA_Axes      // one-pass min. from wta_ca starting point
-
-In general, it is difficult to finding the global minimum, but this mode
-attempts to do so
-    MultiPass_Axes(Npass)    // axes that (attempt to) minimize N-subjettiness
-                             // (NPass = 100 is typical)
+    OnePass_GenET_GenKT_Axes(delta, p, R0 = inf) // one-pass min. from GenET/KT
+    OnePass_WTA_GenKT_Axes(p, R0 = inf)          // one-pass min from WTA/GenKT
+    OnePass_GenKT_Axes(p, R0 = inf)              // one-pass min from GenKT
+
+For one-pass minimization, OnePass_CA_Axes and OnePass_WTA_CA_Axes are not
+recommended as they provide a poor choice of seed axes.
+
+In general, it is difficult to find the global minimum, but this mode attempts
+to do so:
+    MultiPass_Axes(NPass) // axes that (attempt to) minimize N-subjettiness
+                          // (NPass = 100 is typical)
+This does multi-pass minimization from KT_Axes starting points.
 
 Finally, one can set manual axes:
-    Manual_Axes          // set your own axes with setAxes()
-    OnePass_Manual_Axes  // one-pass minimization from manual starting point
+    Manual_Axes              // set your own axes with setAxes()
+    OnePass_Manual_Axes      // one-pass minimization from manual starting point
+    MultiPass_Manual_Axes(Npass) // multi-pass min. from manual
+
+If one wants to change the number of passes used by any of the axes finders, one
+can call the function
+    setNPass(NPass,nAttempts,accuracy,noise_range)
+where NPass = 0 only uses the seed axes, NPass = 1 is one-pass minimization, and
+NPass = 100 is the default multi-pass.  nAttempts is the number of iterations to
+use in each pass, accuracy is how close to the minimum one tries to get, and
+noise_range is how much in rapidity/azimuth the random axes are jiggled.
 
 For most cases, running with OnePass_KT_Axes or OnePass_WTA_KT_Axes gives
 reasonable results (and the results are IRC safe).  Because it uses random
-number seeds, MultiPass_Axes is not IRC safe (and the code is rather slow).  Note
-that for the minimization routines, beta = 1.1 is faster than beta = 1, with
-comparable performance.
+number seeds, MultiPass_Axes is not IRC safe (and the code is rather slow).
+Note that for the minimization routines, beta = 1.1 is faster than beta = 1,
+with comparable performance.
 
 --------------------------------------------------------------------------------
@@ -107,7 +178,8 @@
 --------------------------------------------------------------------------------
 
-At the moment, there are only a few measures.  Note that each one has a
-different number of parameters.  The one indicated by (*)
-is the one recommended for use by users new to Nsubjettiness.
+The value of N-(sub)jettiness depends crucially on the choice of measure.  Each
+measure has a different number of parameters, so one has to be careful when
+switching between measures  The one indicated by (*) is the one recommended for
+use by users new to Nsubjettiness.
 
 The original N-subjettiness measures are:
@@ -122,10 +194,41 @@
     UnnormalizedCutoffMeasure(beta,Rcutoff)  //unnormalized measure with
                                              //additional Rcutoff
-
-In beta testing are "geometric" measures where distances are measured using the
-Lorentz dot product (N.B. the formula for the geometric measure is likely to
-change since there should be separate beam and jet beta factors.)
-    GeometricMeasure(beta)               //geometric measure with exponent beta
-    GeometricCutoffMeasure(beta,Rcutoff) //geometric measure with Rcutoff
+                                             
+For all of the above measures, there is an optional argument to change from the
+ordinary pt_R distance measure recommended for pp collisions to an 
+E_theta distance measure recommended for ee collisions.  There are also
+lorentz_dot and perp_lorentz_dot distance measures recommended only for
+advanced users.
+
+New for v2.2 is a set of measures defined in arXiv:1508.01516.  First, there is
+the "conical measure":
+
+    ConicalMeasure(beta,R0) // same jets as UnnormalizedCutoffMeasure
+                            // but differs in normalization and specifics
+                            // of one-pass minimization
+
+Next, there is the geometric measure (as well as a modified version to yield
+more conical jet regions):
+
+    OriginalGeometricMeasure(R) // not recommended for analysis
+    ModifiedGeometricMeasure(R)
+
+(Prior to v2.2, there was a "GeometricMeasure" which unfortunately had the wrong
+definition.  These have been commented out in the code as
+"DeprecatedGeometricMeasure" and "DeprecatedGeometricCutoffMeasure", but they
+should not be used.)
+
+Next, there is a "conical geometric" measure:
+
+    ConicalGeometricMeasure(beta, gamma, Rcutoff)
+
+This is a hybrid between the conical and geometric measures and is the basis for
+the XCone jet algorithm.  Finally, setting to the gamma = 1 default gives the
+XCone default measure, which is used in the XConePlugin jet finder
+
+(*)  XConeMeasure(beta,Rcutoff)
+    
+where beta = 2 is the recommended default value and beta = 1 is the recoil-free
+default.
 
 --------------------------------------------------------------------------------
@@ -138,7 +241,9 @@
 
 beta = 1:  aka broadening/girth/width measure
+   the axes behave like the "median" in that they point to the hardest cluster
    wta_kt_axes are approximately the same as minimizing beta = 1 measure
 
 beta = 2:  aka thrust/mass measure
+   the axes behave like the "mean" in that they point along the jet momentum
    kt_axes are approximately the same as minimizing beta = 2 measure
 
@@ -149,33 +254,32 @@
 
 --------------------------------------------------------------------------------
-TauComponents  [MeasureFunction.hh]
---------------------------------------------------------------------------------
-
-For most users, they will only need the value of N-subjettiness (i.e. tau)
-itself.  For advanced users, they can access individual tau components (i.e. 
-the individual numerator pieces, the denominator, etc.)  
-
-   TauComponents tauComp = nSub.component_result(jet);
-   vector<double> numer = tauComp.jet_pieces_numerator(); //tau for each subjet
-   double denom = tauComp.denominator();  //normalization factor
-
---------------------------------------------------------------------------------
-WinnerTakeAllRecombiner  [WinnerTakeAllRecombiner.hh]
---------------------------------------------------------------------------------
-
-New for version 2.0 of Nsubjettiness are winner-take-all axes.  They are found
-with the help of the WinnerTakeAllRecombiner. This class defines a new
-recombination scheme for clustering particles. This scheme recombines two
-PseudoJets into a PseudoJet with pT of the sum of the two input PseudoJet pTs
-and direction of the harder PseudoJet.  This is a "recoil-free" recombination
-scheme that guarantees that the axes is aligned with one of the input particles.
-It is IRC safe.  Axes found with the standard E-scheme recombiner at similar to
-the beta = 2 minimization, while winner-take-all is similar to the beta = 1
-measure.
-
-Note that the WinnerTakeAllRecombiner can be used outside of Nsubjettiness
-itself for jet finding.  For example, the direction of anti-kT jets found
-with the WinnerTakeAllRecombiner is particularly robust against soft jet
-contamination.
+XConePlugin  [XConePlugin.hh]
+--------------------------------------------------------------------------------
+
+The XCone FastJet plugin is an exclusive cone jet finder which yields a
+fixed N number of jets which approximately conical boundaries. The algorithm
+finds N axes, and jets are simply the sum of particles closest to a given axis
+(or unclustered if they are closest to the beam).  Unlike the NjettinessPlugin
+below, the user is restricted to using the XConeMeasure. 
+
+   XConePlugin plugin(N,R,beta=2);
+   JetDefinition def(&plugin);
+   ClusterSequence cs(vector<PseudoJet>,def);
+   vector<PseudoJet> jets = cs.inclusive_jets();
+
+Note that despite being an exclusive jet algorithm, one finds the jets using the
+inclusive_jets() call.
+
+The AxesDefinition and MeasureDefinition are defaulted in this measure to 
+OnePass_GenET_GenKT_Axes and XConeMeasure, respectively. The parameters chosen 
+for the OnePass_GenET_GenKT_Axes are defined according to the chosen value of
+beta as delta = 1/(beta - 1) and p = 1/beta. These have been shown to give the
+optimal choice of seed axes. The R value for finding the axes is chosen to be
+the same as the R for the jet algorithm, although in principle, these two radii
+could be different. 
+
+N.B.:  The order of the R, beta arguments is *reversed* from the XConeMeasure
+itself, since this ordering is the more natural one to use for Plugins.  We
+apologize in advance for any confusion this might cause.
 
 --------------------------------------------------------------------------------
@@ -183,8 +287,6 @@
 --------------------------------------------------------------------------------
 
-The Njettiness FastJet plugin represents an exclusive jet finder (yielding a
-fixed N number of jets). The algorithm finds N axes, and jets are simply the sum
-of particles closest to a given axis (or unclustered if they are closest to the
-beam).  The axes finding methods and measures are the same as for Nsubjettiness.
+Same as the XConePlugin, but the axes finding methods and measures are the same
+as for Nsubjettiness, allowing more flexibility.
 
    NjettinessPlugin plugin(N, AxesDefinition, MeasureDefinition);
@@ -193,7 +295,4 @@
    vector<PseudoJet> jets = cs.inclusive_jets();
 
-Note that despite being an exclusive jet algorithm, one finds the jets using the
-inclusive_jets() call.
-
 --------------------------------------------------------------------------------
 Very Advanced Usage:  Njettiness  [Njettiness.hh]
@@ -202,6 +301,47 @@
 Most users will want to use the Nsubjettiness or NjettinessPlugin classes to
 access N-(sub)jettiness information.  For direct access to the Njettiness class,
-one can use Njettiness.hh directly. This class is still evolving, so users who
-wish to extend its functionality should contact the authors first.
+one can use Njettiness.hh directly. This class is in constant evolution, so
+users who wish to extend its functionality should contact the authors first.
+
+--------------------------------------------------------------------------------
+TauComponents  [MeasureDefinition.hh]
+--------------------------------------------------------------------------------
+
+For most users, they will only need the value of N-subjettiness (i.e. tau)
+itself.  For advanced users, they can access individual tau components (i.e. 
+the individual numerator pieces, the denominator, etc.)  
+
+   TauComponents tauComp = nSub.component_result(jet);
+   vector<double> numer = tauComp.jet_pieces_numerator(); //tau for each subjet
+   double denom = tauComp.denominator();  //normalization factor
+
+--------------------------------------------------------------------------------
+Extra Recombiners  [ExtraRecombiners.hh]
+--------------------------------------------------------------------------------
+
+New in v2.0 are winner-take-all axes.  (These have now been included in 
+FastJet 3.1, but we have left the code here to allow the plugin to work under
+FJ 3.0).  These axes are found with the help of the WinnerTakeAllRecombiner.
+This class defines a new recombination scheme for clustering particles. This
+scheme recombines two PseudoJets into a PseudoJet with pT of the sum of the two
+input PseudoJet pTs and direction of the harder PseudoJet.  This is a
+"recoil-free" recombination scheme that guarantees that the axes is aligned with
+one of the input particles. It is IRC safe.  Axes found with the standard
+E-scheme recombiner at similar to the beta = 2 minimization, while
+winner-take-all is similar to the beta = 1 measure.
+
+New in v2.2 is the GeneralEtSchemeRecombiner, as defined in arxiv:1506.XXXX.
+This functions similarly to the Et-scheme defined in Fastjet, but the reweighting
+of the sum of rap and phi is parameterized by an exponent delta. Thus, delta = 1
+is the normal Et-scheme recombination, delta = 2 is Et^2 recombination, and
+delta = infinity is the winner-take-all recombination. This recombination scheme
+is used in GenET_GenKT_Axes, and we find that optimal seed axes for minimization
+can be found by using delta = 1/(beta - 1). 
+
+Note that the WinnerTakeAllRecombiner can be used outside of Nsubjettiness
+itself for jet finding.  For example, the direction of anti-kT jets found
+with the WinnerTakeAllRecombiner is particularly robust against soft jet
+contamination.  That said, this functionality is now included in FJ 3.1, so this
+code is likely to be deprecated in a future version.
 
 --------------------------------------------------------------------------------
@@ -213,7 +353,7 @@
 N-(sub)jettiness:
 
-AxesFinder.hh:
-
-The AxesFinder class (and derived classes) defines the axes used in the
+AxesDefinition.hh:
+
+The AxesDefinition class (and derived classes) defines the axes used in the
 calculation of N-(sub)jettiness.  These axes can be defined from the exclusive
 jets from a kT or CA algorithm, the hardest jets from an anti-kT algorithm,
@@ -223,7 +363,7 @@
 AxesDefinition.
 
-MeasureFunction.hh:
-
-The MeasureFunction class (and derived classes) defines the measure by which
+MeasureDefinition.hh:
+
+The MeasureDefinition class (and derived classes) defines the measure by which
 N-(sub)jettiness is calculated. This measure is calculated between each
 particle and its corresponding axis, and then summed and normalized to
@@ -232,5 +372,7 @@
 and its axis, and beta is the angular exponent.  Again, in the future the user
 will be able to write their own measures, but for the time being, only the
-predefined MeasureDefinition values should be used.
+predefined MeasureDefinition values should be used.  Note that the one-pass
+minimization algorithms are defined within MeasureDefinition, since they are
+measure specific.
 
 --------------------------------------------------------------------------------
@@ -240,5 +382,13 @@
 -- The MultiPass_Axes mode gives different answers on different runs, since
    random numbers are used.
--- In rare cases, one pass minimization can give a larger value of Njettiness
-   than without minimization.
+-- For the default measures, in rare cases, one pass minimization can give a 
+   larger value of Njettiness than without minimization. The reason is due 
+   to the fact that axes in default measure are not defined as light-like
 -- Nsubjettiness is not thread safe, since there are mutables in Njettiness.
+-- If the AxesDefinition does not find N axes, then it adds zero vectors to the
+   list of axes to get the total up to N.  This can lead to unpredictable
+   results (including divide by zero issues), and a warning is thrown to alert
+   the user.
+
+--------------------------------------------------------------------------------
+--------------------------------------------------------------------------------
Index: external/fastjet/contribs/Nsubjettiness/TauComponents.cc
===================================================================
--- external/fastjet/contribs/Nsubjettiness/TauComponents.cc	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
+++ external/fastjet/contribs/Nsubjettiness/TauComponents.cc	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -0,0 +1,89 @@
+//  Nsubjettiness Package
+//  Questions/Comments?  jthaler@jthaler.net
+//
+//  Copyright (c) 2011-14
+//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
+//
+//  $Id: NjettinessDefinition.cc 704 2014-07-07 14:30:43Z jthaler $
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#include "TauComponents.hh"
+#include "MeasureDefinition.hh"
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+namespace contrib {
+
+// This constructor takes input vector and double and calculates all necessary tau components
+TauComponents::TauComponents(TauMode tau_mode,
+              const std::vector<double> & jet_pieces_numerator,
+              double beam_piece_numerator,
+              double denominator,
+              const std::vector<PseudoJet> & jets,
+              const std::vector<PseudoJet> & axes
+              )
+:  _tau_mode(tau_mode),
+_jet_pieces_numerator(jet_pieces_numerator),
+_beam_piece_numerator(beam_piece_numerator),
+_denominator(denominator),
+_jets(jets),
+_axes(axes)
+{
+   
+   if (!has_denominator()) assert(_denominator == 1.0); //make sure no effect from _denominator if _has_denominator is false
+   if (!has_beam()) assert (_beam_piece_numerator == 0.0); //make sure no effect from _beam_piece_numerator if _has_beam is false
+   
+   // Put the pieces together
+   _numerator = _beam_piece_numerator;
+   _jet_pieces.resize(_jet_pieces_numerator.size(),0.0);
+   for (unsigned j = 0; j < _jet_pieces_numerator.size(); j++) {
+      _jet_pieces[j] = _jet_pieces_numerator[j]/_denominator;
+      _numerator += _jet_pieces_numerator[j];
+      
+      // Add structural information to jets
+      StructureType * structure = new StructureType(_jets[j]);
+      structure->_tau_piece = _jet_pieces[j];
+      _jets[j].set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(structure));
+   }
+   
+   _beam_piece = _beam_piece_numerator/_denominator;
+   _tau = _numerator/_denominator;
+   
+   // Add total_jet with structural information
+   _total_jet = join(_jets);
+   StructureType * total_structure = new StructureType(_total_jet);
+   total_structure->_tau_piece = _tau;
+   _total_jet.set_structure_shared_ptr(SharedPtr<PseudoJetStructureBase>(total_structure));
+}
+   
+   
+   
+// test for denominator/beams
+bool TauComponents::has_denominator() const {
+   return (_tau_mode == NORMALIZED_JET_SHAPE
+           || _tau_mode == NORMALIZED_EVENT_SHAPE);
+}
+
+bool TauComponents::has_beam() const {
+   return (_tau_mode == UNNORMALIZED_EVENT_SHAPE
+           || _tau_mode == NORMALIZED_EVENT_SHAPE);
+}
+
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
Index: external/fastjet/contribs/Nsubjettiness/TauComponents.hh
===================================================================
--- external/fastjet/contribs/Nsubjettiness/TauComponents.hh	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
+++ external/fastjet/contribs/Nsubjettiness/TauComponents.hh	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -0,0 +1,352 @@
+//  Nsubjettiness Package
+//  Questions/Comments?  jthaler@jthaler.net
+//
+//  Copyright (c) 2011-14
+//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
+//
+//  $Id: MeasureFunction.hh 742 2014-08-23 15:43:29Z jthaler $
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#ifndef __FASTJET_CONTRIB_TAUCOMPONENTS_HH__
+#define __FASTJET_CONTRIB_TAUCOMPONENTS_HH__
+
+#include "fastjet/PseudoJet.hh"
+#include "fastjet/ClusterSequence.hh"
+#include "fastjet/WrappedStructure.hh"
+
+
+#include <cmath>
+#include <vector>
+#include <list>
+#include <limits>
+
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+namespace contrib{
+
+// Classes defined in this file.
+class TauComponents;
+class TauPartition;
+class NjettinessExtras;
+
+///------------------------------------------------------------------------
+/// \enum TauMode
+/// Specified whether tau value has beam region or denominators
+///------------------------------------------------------------------------
+enum TauMode {
+   UNDEFINED_SHAPE = -1, // Added so that constructor would default to some value
+   UNNORMALIZED_JET_SHAPE = 0,
+   NORMALIZED_JET_SHAPE = 1,
+   UNNORMALIZED_EVENT_SHAPE = 2,
+   NORMALIZED_EVENT_SHAPE = 3,
+};
+   
+///////
+//
+// TauComponents
+//
+///////
+
+///------------------------------------------------------------------------
+/// \class TauComponents
+/// \brief Output wrapper for supplemental N-(sub)jettiness information
+///
+/// This class creates a wrapper for the various tau/subtau values calculated in Njettiness. This class allows Njettiness access to these variables
+/// without ever having to do the calculation itself. It takes in subtau numerators and tau denominator from MeasureFunction
+/// and outputs tau numerator, and normalized tau and subtau.
+///------------------------------------------------------------------------
+class TauComponents {
+   
+public:
+   
+   /// empty constructor necessary to initialize tau_components in Njettiness
+   /// later set correctly in Njettiness::getTau function
+   TauComponents() {}
+   
+   /// This constructor takes input vector and double and calculates all necessary tau components
+   TauComponents(TauMode tau_mode,
+                 const std::vector<double> & jet_pieces_numerator,
+                 double beam_piece_numerator,
+                 double denominator,
+                 const std::vector<PseudoJet> & jets,
+                 const std::vector<PseudoJet> & axes
+                 );
+   
+   /// Test for denominator
+   bool has_denominator() const;
+   /// Test for beam region
+   bool has_beam() const;
+   
+   /// Return tau value
+   double tau() const { return _tau; }
+   /// Return jet regions
+   const std::vector<double>& jet_pieces() const { return _jet_pieces; }
+   /// Return beam region
+   double beam_piece() const { return _beam_piece; }
+   
+   /// Return jet regions (no denominator)
+   std::vector<double> jet_pieces_numerator() const { return _jet_pieces_numerator; }
+   /// Return beam regions (no denominator)
+   double beam_piece_numerator() const { return _beam_piece_numerator; }
+   /// Return numerator
+   double numerator() const { return _numerator; }
+   /// Return denominator
+   double denominator() const { return _denominator; }
+
+   /// Four-vector of total jet (sum of clustered regions)
+   PseudoJet total_jet() const { return _total_jet;}
+   /// Four-vector of jet regions
+   const std::vector<PseudoJet>& jets() const { return _jets;}
+   /// Four-vector of axes
+   const std::vector<PseudoJet>& axes() const { return _axes;}
+
+   class StructureType;
+   
+protected:
+   
+   /// Defines whether there is a beam or denominator
+   TauMode _tau_mode;
+   
+   std::vector<double> _jet_pieces_numerator;   ///< Constructor input (jet region numerator)
+   double _beam_piece_numerator;                ///< Constructor input (beam region numerator)
+   double _denominator;                         ///< Constructor input (denominator)
+   
+   std::vector<double> _jet_pieces;             ///< Derived value (jet regions)
+   double _beam_piece;                          ///< Derived value (beam region)
+   double _numerator;                           ///< Derived value (total numerator)
+   double _tau;                                 ///< Derived value (final value)
+   
+   PseudoJet _total_jet;                        ///< Total jet four-vector
+   std::vector<PseudoJet> _jets;                ///< Jet four-vectors
+   std::vector<PseudoJet> _axes;                ///< AXes four-vectors
+   
+};
+
+///////
+//
+// TauPartition
+//
+///////
+
+///------------------------------------------------------------------------
+/// \class TauPartition
+/// \brief Output wrapper for N-(sub)jettiness partitioning information
+///
+/// Class for storing partitioning information.
+///------------------------------------------------------------------------
+class TauPartition {
+
+public:
+   /// empty constructor
+   TauPartition() {}
+   
+   /// Make partition of size to hold n_jet partitions
+   TauPartition(int n_jet) {
+      _jets_list.resize(n_jet);
+      _jets_partition.resize(n_jet);
+   }
+   
+   /// add a particle to the jet
+   void push_back_jet(int jet_num, const PseudoJet& part_to_add, int part_index) {
+      _jets_list[jet_num].push_back(part_index);
+      _jets_partition[jet_num].push_back(part_to_add);
+   }
+   
+   /// add a particle to the beam
+   void push_back_beam(const PseudoJet& part_to_add, int part_index) {
+      _beam_list.push_back(part_index);
+      _beam_partition.push_back(part_to_add);
+   }
+   
+   /// return jet regions
+   PseudoJet jet(int jet_num) const { return join(_jets_partition.at(jet_num)); }
+   /// return beam region
+   PseudoJet beam() const { return join(_beam_partition);}
+   
+   /// return jets
+   std::vector<PseudoJet> jets() const {
+      std::vector<PseudoJet> jets;
+      for (unsigned int i = 0; i < _jets_partition.size(); i++) {
+         jets.push_back(jet(i));
+      }
+      return jets;
+   }
+   
+   /// jets in list form
+   const std::list<int> & jet_list(int jet_num) const { return _jets_list.at(jet_num);}
+   /// beam in list form
+   const std::list<int> & beam_list() const { return _beam_list;}
+   /// all jets in list form
+   const std::vector<std::list<int> > & jets_list() const { return _jets_list;}
+   
+private:
+   
+   std::vector<std::list<int> > _jets_list;   ///<  jets in list form
+   std::list<int> _beam_list;                 ///<  beam in list form
+  
+   std::vector<std::vector<PseudoJet> > _jets_partition;  ///< Partition in jet regions
+   std::vector<PseudoJet> _beam_partition;                ///< Partition in beam region
+   
+};
+
+   
+///////
+//
+// NjettinessExtras
+//
+///////
+   
+///------------------------------------------------------------------------
+/// \class NjettinessExtras
+/// \brief ClusterSequence add on for N-jettiness information
+///
+/// This class contains the same information as TauComponents, but adds additional ways of linking up
+/// the jets found in the ClusterSequence::Extras class.
+/// This is done in order to help improve the interface for the main NjettinessPlugin class.
+///------------------------------------------------------------------------
+class NjettinessExtras : public ClusterSequence::Extras, public TauComponents {
+   
+public:
+   /// Constructor
+   NjettinessExtras(TauComponents tau_components,
+                    std::vector<int> cluster_hist_indices)
+   : TauComponents(tau_components), _cluster_hist_indices(cluster_hist_indices) {}
+   
+   
+   
+   /// Ask for tau of the whole event, but by querying a jet
+   double tau(const fastjet::PseudoJet& /*jet*/) const {return _tau;}
+
+   /// Ask for tau of an individual jet
+   double tau_piece(const fastjet::PseudoJet& jet) const {
+      if (labelOf(jet) == -1) return std::numeric_limits<double>::quiet_NaN(); // nonsense
+      return _jet_pieces[labelOf(jet)];
+   }
+
+   /// Find axis associated with jet
+   fastjet::PseudoJet axis(const fastjet::PseudoJet& jet) const {
+      return _axes[labelOf(jet)];
+   }
+   
+   /// Check if extra information is available.
+   bool has_njettiness_extras(const fastjet::PseudoJet& jet) const {
+      return (labelOf(jet) >= 0);
+   }
+   
+private:
+   
+   /// Store cluster history indices to link up with ClusterSequence
+   std::vector<int> _cluster_hist_indices;
+   
+   /// Figure out which jet things belonged to
+   int labelOf(const fastjet::PseudoJet& jet) const {
+      int thisJet = -1;
+      for (unsigned int i = 0; i < _jets.size(); i++) {
+         if (_cluster_hist_indices[i] == jet.cluster_hist_index()) {
+            thisJet = i;
+            break;
+         }
+      }
+      return thisJet;
+   }
+
+public:
+   
+   // These are old methods for gaining this information
+   // The recommended interface is given in TauComponents
+   
+   /// Tau value
+   double totalTau() const {return _tau;}
+   /// Jet regions
+   std::vector<double> subTaus() const {return _jet_pieces;}
+   
+   /// Tau value
+   double totalTau(const fastjet::PseudoJet& /*jet*/) const {
+      return _tau;
+   }
+   
+   /// Jet region
+   double subTau(const fastjet::PseudoJet& jet) const {
+      if (labelOf(jet) == -1) return std::numeric_limits<double>::quiet_NaN(); // nonsense
+      return _jet_pieces[labelOf(jet)];
+   }
+   
+   /// beam region
+   double beamTau() const {
+      return _beam_piece;
+   }
+
+};
+   
+   
+/// Helper function to find out what njettiness_extras are (from jet)
+inline const NjettinessExtras * njettiness_extras(const fastjet::PseudoJet& jet) {
+   const ClusterSequence * myCS = jet.associated_cluster_sequence();
+   if (myCS == NULL) return NULL;
+   const NjettinessExtras* extras = dynamic_cast<const NjettinessExtras*>(myCS->extras());
+   return extras;
+}
+
+/// Helper function to find out what njettiness_extras are (from ClusterSequence)
+inline const NjettinessExtras * njettiness_extras(const fastjet::ClusterSequence& myCS) {
+   const NjettinessExtras* extras = dynamic_cast<const NjettinessExtras*>(myCS.extras());
+   return extras;   
+}
+
+///////
+//
+// TauComponents::StructureType
+//
+///////
+
+   
+///------------------------------------------------------------------------
+/// \class TauComponents::StructureType
+/// \brief Wrapped structure for jet-based N-(sub)jettiness information
+///
+/// Small wrapped structure to store tau information
+/// TODO:  Can these be auto-joined?
+///------------------------------------------------------------------------
+class TauComponents::StructureType : public WrappedStructure {
+
+public:
+   /// Constructor
+   StructureType(const PseudoJet& j) :
+      WrappedStructure(j.structure_shared_ptr())
+   {}
+   
+   /// tau associated with jet
+   double tau_piece() const { return _tau_piece; }
+
+   /// alternative call, though might be confusing
+   double tau() const { return _tau_piece; }
+
+private:
+   friend class TauComponents;
+   double _tau_piece;  ///< tau value associated with jet
+};
+   
+   
+   
+   
+} //namespace contrib
+
+FASTJET_END_NAMESPACE
+
+#endif  // __FASTJET_CONTRIB_TAUCOMPONENTS_HH__
Index: external/fastjet/contribs/Nsubjettiness/VERSION
===================================================================
--- external/fastjet/contribs/Nsubjettiness/VERSION	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ external/fastjet/contribs/Nsubjettiness/VERSION	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -1,1 +1,1 @@
-2.1.0
+2.2.1
Index: external/fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.cc
===================================================================
--- external/fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.cc	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ 	(revision )
@@ -1,69 +1,0 @@
-//  Nsubjettiness Package
-//  Questions/Comments?  jthaler@jthaler.net
-//
-//  Copyright (c) 2011-14
-//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
-//
-//  $Id: WinnerTakeAllRecombiner.cc 597 2014-04-16 23:07:55Z jthaler $
-//----------------------------------------------------------------------
-// This file is part of FastJet contrib.
-//
-// It is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2 of the License, or (at
-// your option) any later version.
-//
-// It is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
-// License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this code. If not, see <http://www.gnu.org/licenses/>.
-//----------------------------------------------------------------------
-
-#include "WinnerTakeAllRecombiner.hh"
-
-FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
-
-namespace contrib{
-
-std::string WinnerTakeAllRecombiner::description() const {
-   return "Winner Take All scheme recombination";
-}
-
-// recombine pa and pb by creating pab with energy of the sum of particle energies in the direction of the harder particle
-// updated recombiner to use more general form of a metric equal to E*(pT/E)^(alpha), which reduces to pT*cosh(rap)^(1-alpha)
-// alpha is specified by the user. The default is alpha = 1, which is the typical behavior. alpha = 2 provides a metric which more 
-// favors central jets
-void WinnerTakeAllRecombiner::recombine(const fastjet::PseudoJet & pa, const fastjet::PseudoJet & pb, fastjet::PseudoJet & pab) const {
-   double a_pt = pa.perp(), b_pt = pb.perp(), a_rap = pa.rap(), b_rap = pb.rap();
-   
-   // special case of alpha = 1, everything is just pt (made separate so that pow function isn't called)
-   if (_alpha == 1.0) {
-      if (a_pt >= b_pt) {
-         pab.reset_PtYPhiM(a_pt + b_pt, a_rap, pa.phi());
-      }
-      else if (b_pt > a_pt) {
-         pab.reset_PtYPhiM(a_pt + b_pt, b_rap, pb.phi());
-      }
-   }
-
-   // every other case uses additional cosh(rap) term
-   else {
-      double a_metric = a_pt*pow(cosh(a_rap), 1.0-_alpha);
-      double b_metric = b_pt*pow(cosh(b_rap), 1.0-_alpha);
-      if (a_metric >= b_metric) {
-   	  double new_pt = a_pt + b_pt*pow(cosh(b_rap)/cosh(a_rap), 1.0-_alpha);
-   	  pab.reset_PtYPhiM(new_pt, a_rap, pa.phi());
-      }
-      if (b_metric > a_metric) {
-   	  double new_pt = b_pt + a_pt*pow(cosh(a_rap)/cosh(b_rap), 1.0-_alpha);
-   	  pab.reset_PtYPhiM(new_pt, b_rap, pb.phi());
-      }
-   }
-}
-
-} //namespace contrib
-
-FASTJET_END_NAMESPACE
Index: external/fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.hh
===================================================================
--- external/fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.hh	(revision 35cdc461e095e63247ab9dded070d76bc2c888e2)
+++ 	(revision )
@@ -1,65 +1,0 @@
-//  Nsubjettiness Package
-//  Questions/Comments?  jthaler@jthaler.net
-//
-//  Copyright (c) 2011-14
-//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
-//
-//  $Id: WinnerTakeAllRecombiner.hh 670 2014-06-06 01:24:42Z jthaler $
-//----------------------------------------------------------------------
-// This file is part of FastJet contrib.
-//
-// It is free software; you can redistribute it and/or modify it under
-// the terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2 of the License, or (at
-// your option) any later version.
-//
-// It is distributed in the hope that it will be useful, but WITHOUT
-// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
-// License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this code. If not, see <http://www.gnu.org/licenses/>.
-//----------------------------------------------------------------------
-
-#ifndef __FASTJET_CONTRIB_WINNERTAKEALLRECOMBINER_HH__
-#define __FASTJET_CONTRIB_WINNERTAKEALLRECOMBINER_HH__
-
-#include "fastjet/PseudoJet.hh"
-#include "fastjet/JetDefinition.hh"
-
-#include <cmath>
-#include <vector>
-#include <list>
-
-FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
-
-namespace contrib {
-
-//------------------------------------------------------------------------
-/// \class WinnerTakeAllRecombiner
-// WinnerTakeAllRecombiner defines a new recombination scheme by inheriting from JetDefinition::Recombiner.
-// This scheme compares the energy of two input particles, and then combines them into a particle with
-// an energy equal to the sum of the two particle energies and a direction identical to that of the harder 
-// particle. This creates a jet with an axis guaranteed to align with a particle in the event.
-class WinnerTakeAllRecombiner : public fastjet::JetDefinition::Recombiner {
-public:
-	// Constructor to choose value of alpha (defaulted to 1 for normal pT sum)
-   WinnerTakeAllRecombiner(double alpha = 1.0) : _alpha(alpha) {}
-
-   virtual std::string description() const;
-   
-   /// recombine pa and pb and put result into pab
-   virtual void recombine(const fastjet::PseudoJet & pa,
-                          const fastjet::PseudoJet & pb,
-                          fastjet::PseudoJet & pab) const;
-
-private:
-	double _alpha; //power of (pt/E) term when recombining particles
-};
-
-} //namespace contrib
-
-FASTJET_END_NAMESPACE
-
-#endif  // __FASTJET_CONTRIB_WINNERTAKEALLRECOMBINER_HH__
Index: external/fastjet/contribs/Nsubjettiness/XConePlugin.cc
===================================================================
--- external/fastjet/contribs/Nsubjettiness/XConePlugin.cc	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
+++ external/fastjet/contribs/Nsubjettiness/XConePlugin.cc	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -0,0 +1,46 @@
+//  Nsubjettiness Package
+//  Questions/Comments?  jthaler@jthaler.net
+//
+//  Copyright (c) 2011-14
+//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
+//
+//  $Id: XConePlugin.cc 745 2014-08-26 23:51:48Z jthaler $
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#include "XConePlugin.hh"
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+namespace contrib{
+
+std::string XConePlugin::description() const {
+   std::stringstream stream;
+   stream << "XCone Jet Algorithm with N = " << _N << std::fixed << std::setprecision(2) << ", Rcut = " << _R0 << ", beta = " << _beta;
+   return stream.str();
+}
+
+std::string PseudoXConePlugin::description() const {
+   std::stringstream stream;
+   stream
+   << "PseudoXCone Jet Algorithm with N = " << _N << std::fixed << std::setprecision(2) << ", Rcut = " << _R0 << ", beta = " << _beta;
+   return stream.str();
+}
+   
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
Index: external/fastjet/contribs/Nsubjettiness/XConePlugin.hh
===================================================================
--- external/fastjet/contribs/Nsubjettiness/XConePlugin.hh	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
+++ external/fastjet/contribs/Nsubjettiness/XConePlugin.hh	(revision 8713dee253b44fe1d26e1aad36beeb66152508c4)
@@ -0,0 +1,169 @@
+//  Nsubjettiness Package
+//  Questions/Comments?  jthaler@jthaler.net
+//
+//  Copyright (c) 2011-14
+//  Jesse Thaler, Ken Van Tilburg, Christopher K. Vermilion, and TJ Wilkason
+//
+//  $Id: XConePlugin.hh 748 2014-10-02 06:13:28Z tjwilk $
+//----------------------------------------------------------------------
+// This file is part of FastJet contrib.
+//
+// It is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2 of the License, or (at
+// your option) any later version.
+//
+// It is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
+// License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this code. If not, see <http://www.gnu.org/licenses/>.
+//----------------------------------------------------------------------
+
+#ifndef __FASTJET_CONTRIB_XCONEPLUGIN_HH__
+#define __FASTJET_CONTRIB_XCONEPLUGIN_HH__
+
+#include <fastjet/config.h>
+
+#include "NjettinessPlugin.hh"
+
+#include "fastjet/ClusterSequence.hh"
+#include "fastjet/JetDefinition.hh"
+
+#include <string>
+#include <climits>
+
+FASTJET_BEGIN_NAMESPACE      // defined in fastjet/internal/base.hh
+
+
+namespace contrib {
+
+///------------------------------------------------------------------------
+/// \class XConePlugin
+/// \brief Implements the XCone Jet Algorithm
+/**
+ * An exclusive jet finder that identifies N jets.  First N axes are found, then
+ * particles are assigned to the nearest (approximte DeltaR) axis and for each axis the
+ * corresponding jet is simply the four-momentum sum of these particles.
+ *
+ * The XConePlugin is based on NjettinessPlugin, but with sensible default
+ * values for the AxesDefinition and MeasureDefinition.  There are three arguments
+ *
+ *   int N:       number of exclusive jets to be found
+ *   double R0:   approximate jet radius
+ *   double beta: determines style of jet finding with the recommended values being:
+ *                beta = 2:  standard "mean" jets where jet momentum/axis align approximately.
+ *                beta = 1:  recoil-free "median" variant where jet axis points at hardest cluster.
+ *
+ * The AxesDefinition is OnePass_GenET_GenKT_Axes, which uses a generalized kT
+ * clustering algorithm matched to the beta value.
+ *
+ * The MeasureDefinition is the XConeMeasure, which is based on the
+ * ConicalGeometric measure.
+ */
+class XConePlugin : public NjettinessPlugin {
+public:
+
+   /// Constructor with N, R0, and beta as the options.  beta = 2.0 is the default
+   /// All this does is use the NjettinessPlugin with OnePass_GenET_GenKT_Axes and the XConeMeasure.
+   /// For more advanced usage, call NjettinessPlugin directly
+   /// Note that the order of the R0 and beta values is reversed from the XConeMeasure to
+   /// standard usage for Plugins.
+   XConePlugin(int N, double R0, double beta = 2.0)
+   : NjettinessPlugin(N,
+                      OnePass_GenET_GenKT_Axes(calc_delta(beta), calc_power(beta), R0), // use recommended axes method only
+                      XConeMeasure(beta, R0)  // use recommended XCone measure.
+                      ),
+   _N(N), _R0(R0), _beta(beta)
+   {}
+   
+   // The things that are required by base class.
+   virtual std::string description () const;
+   virtual double R() const {return _R0;}
+   
+   // run_clustering is done by NjettinessPlugin
+
+   virtual ~XConePlugin() {}
+
+private:
+
+   /// Static call used within the constructor to set the recommended delta value
+   static double calc_delta(double beta) {
+      double delta;
+      if (beta > 1) delta = 1/(beta - 1);
+      else delta = std::numeric_limits<int>::max(); // use winner take all
+      return delta;
+   }
+
+   /// Static call used within the constructor to set the recommended p value
+   static double calc_power(double beta) {
+      return (double) 1.0/beta;
+   }
+
+   double _N;    ///< Number of desired jets
+   double _R0;   ///< Jet radius
+   double _beta; ///< Angular exponent (beta = 2.0 is dafault, beta = 1.0 is recoil-free)
+
+public:
+
+};
+
+   
+/// \class PseudoXConePlugin
+/// \brief Implements a faster, non-optimal version of the XCone Jet Algorithm
+///
+/// A "poor man's" version of XCone with no minimization step
+/// Right now, used just for testing purposes by the developers
+class PseudoXConePlugin : public NjettinessPlugin {
+public:
+   
+   /// Constructor with N, R0, and beta as the options.  beta = 2.0 is the default
+   /// All this does is use the NjettinessPlugin with GenET_GenKT_Axes and the XConeMeasure.
+   PseudoXConePlugin(int N, double R0, double beta = 2.0)
+   : NjettinessPlugin(N,
+                      GenET_GenKT_Axes(calc_delta(beta), calc_power(beta), R0), // poor man's axes
+                      XConeMeasure(beta, R0)  // use recommended XCone measure.
+                      ),
+   _N(N), _R0(R0), _beta(beta)
+   {}
+   
+   // The things that are required by base class.
+   virtual std::string description () const;
+   virtual double R() const {return _R0;}
+   
+   // run_clustering is done by NjettinessPlugin
+   
+   virtual ~PseudoXConePlugin() {}
+   
+private:
+   
+   /// Static call used within the constructor to set the recommended delta value
+   static double calc_delta(double beta) {
+      double delta;
+      if (beta > 1) delta = 1/(beta - 1);
+      else delta = std::numeric_limits<int>::max(); // use winner take all
+      return delta;
+   }
+   
+   /// Static call used within the constructor to set the recommended p value
+   static double calc_power(double beta) {
+      return (double) 1.0/beta;
+   }
+   
+   double _N;    ///< Number of desired jets
+   double _R0;   ///< Jet radius
+   double _beta; ///< Angular exponent (beta = 2.0 is dafault, beta = 1.0 is recoil-free)
+   
+public:
+   
+};
+
+   
+   
+} // namespace contrib
+
+FASTJET_END_NAMESPACE
+
+#endif  // __FASTJET_CONTRIB_XConePlugin_HH__
