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;
 
 };
