Index: modules/FastJetFinder.cc
===================================================================
--- modules/FastJetFinder.cc	(revision a0431dcbf4f6030aaef06db0f34e0959b4b9c6ae)
+++ modules/FastJetFinder.cc	(revision 9687203133c32a58144435a449f6d077a04b38c7)
@@ -47,11 +47,18 @@
 #include "fastjet/plugins/CDFCones/fastjet/CDFJetCluPlugin.hh"
 
+#include "fastjet/contribs/Nsubjettiness/Nsubjettiness.hh" 
+#include "fastjet/contribs/Nsubjettiness/Njettiness.hh"
+#include "fastjet/contribs/Nsubjettiness/NjettinessPlugin.hh"
+#include "fastjet/contribs/Nsubjettiness/WinnerTakeAllRecombiner.hh"
+
 using namespace std;
 using namespace fastjet;
+using namespace fastjet::contrib;
+
 
 //------------------------------------------------------------------------------
 
 FastJetFinder::FastJetFinder() :
-  fPlugin(0), fDefinition(0), fAreaDefinition(0), fItInputArray(0)
+  fPlugin(0), fDefinition(0), fAreaDefinition(0), fItInputArray(0), fRecomb(0), fNjettinessPlugin(0)
 {
 
@@ -69,6 +76,9 @@
 void FastJetFinder::Init()
 {
+  
   JetDefinition::Plugin *plugin = NULL;
-
+  JetDefinition::Recombiner *recomb = NULL;
+  NjettinessPlugin *njet_plugin = NULL;
+  
   // read eta ranges
 
@@ -99,7 +109,16 @@
   fJetPTMin = GetDouble("JetPTMin", 10.0);
 
+  //-- N(sub)jettiness parameters --
+  
+  fComputeNsubjettiness = GetBool("ComputeNsubjettiness", false);
+  fBeta = GetDouble("Beta", 1.0);
+  fAxisMode = GetInt("AxisMode", 1);
+  fRcutOff = GetDouble("RcutOff", 0.8); //used only if Njettiness is used as jet clustering algo (case 8)
+  fN = GetInt("N", 2);                  //used only if Njettiness is used as jet clustering algo (case 8)
+  
   // ---  Jet Area Parameters ---
   fAreaAlgorithm = GetInt("AreaAlgorithm", 0);
   fComputeRho = GetBool("ComputeRho", false);
+  
   // - ghost based areas -
   fGhostEtaMax = GetDouble("GhostEtaMax", 5.0);
@@ -109,4 +128,5 @@
   fPtScatter = GetDouble("PtScatter", 0.1);
   fMeanGhostPt = GetDouble("MeanGhostPt", 1.0E-100);
+  
   // - voronoi based areas -
   fEffectiveRfact = GetDouble("EffectiveRfact", 1.0);
@@ -159,8 +179,19 @@
       fDefinition = new fastjet::JetDefinition(fastjet::antikt_algorithm, fParameterR);
       break;
-  }
+    case 7:
+      recomb = new fastjet::contrib::WinnerTakeAllRecombiner();
+      fDefinition = new fastjet::JetDefinition(fastjet::antikt_algorithm, fParameterR, recomb, Best);
+      break;
+    case 8:
+      njet_plugin = new fastjet::contrib::NjettinessPlugin(fN, Njettiness::wta_kt_axes, Njettiness::unnormalized_cutoff_measure, fBeta, fRcutOff);
+      fDefinition = new fastjet::JetDefinition(njet_plugin);
+      break;
+  }
+ 
 
   fPlugin = plugin;
-
+  fRecomb = recomb;
+  fNjettinessPlugin = njet_plugin;
+  
   ClusterSequence::print_banner();
 
@@ -184,4 +215,6 @@
   if(fAreaDefinition) delete fAreaDefinition;
   if(fPlugin) delete static_cast<JetDefinition::Plugin*>(fPlugin);
+  if(fRecomb) delete static_cast<JetDefinition::Recombiner*>(fRecomb);
+  if(fNjettinessPlugin) delete static_cast<JetDefinition::Plugin*>(fNjettinessPlugin);
 }
 
@@ -248,4 +281,5 @@
   outputList = sorted_by_pt(sequence->inclusive_jets(fJetPTMin));
 
+
   // loop over all jets and export them
   detaMax = 0.0;
@@ -265,4 +299,5 @@
     inputList.clear();
     inputList = sequence->constituents(*itOutputList);
+      
     for(itInputList = inputList.begin(); itInputList != inputList.end(); ++itInputList)
     {
@@ -289,4 +324,31 @@
     candidate->DeltaPhi = dphiMax;
 
+    // --- compute N-subjettiness with N = 1,2,3,4,5 ----
+    
+    if(fComputeNsubjettiness)
+    {
+      Njettiness::AxesMode axisMode;
+     
+      if (fAxisMode == 1) axisMode = Njettiness::wta_kt_axes;
+      if (fAxisMode == 2) axisMode = Njettiness::onepass_wta_kt_axes;
+      if (fAxisMode == 3) axisMode = Njettiness::kt_axes;
+      if (fAxisMode == 4) axisMode = Njettiness::onepass_kt_axes;
+       
+      Njettiness::MeasureMode measureMode = Njettiness::unnormalized_measure;
+      
+      Nsubjettiness nSub1(1, axisMode, measureMode, fBeta);
+      Nsubjettiness nSub2(2, axisMode, measureMode, fBeta);
+      Nsubjettiness nSub3(3, axisMode, measureMode, fBeta); 
+      Nsubjettiness nSub4(4, axisMode, measureMode, fBeta); 
+      Nsubjettiness nSub5(5, axisMode, measureMode, fBeta); 
+    
+      candidate -> Tau1 = nSub1(*itOutputList);
+      candidate -> Tau2 = nSub2(*itOutputList);
+      candidate -> Tau3 = nSub3(*itOutputList);
+      candidate -> Tau4 = nSub4(*itOutputList);
+      candidate -> Tau5 = nSub5(*itOutputList);
+    }
+
+
     fOutputArray->Add(candidate);
   }
Index: modules/FastJetFinder.h
===================================================================
--- modules/FastJetFinder.h	(revision a0431dcbf4f6030aaef06db0f34e0959b4b9c6ae)
+++ modules/FastJetFinder.h	(revision 9687203133c32a58144435a449f6d077a04b38c7)
@@ -41,4 +41,7 @@
 
   void *fPlugin; //!
+  void *fRecomb; //!
+  void *fNjettinessPlugin; //!
+  
   fastjet::JetDefinition *fDefinition; //!
 
@@ -55,4 +58,12 @@
   Double_t fOverlapThreshold;
 
+  //-- N (sub)jettiness parameters --
+  
+  Bool_t fComputeNsubjettiness;
+  Double_t fBeta;
+  Int_t fAxisMode;
+  Double_t fRcutOff; 
+  Int_t fN ;
+  
   // --- FastJet Area method --------
 
Index: modules/TreeWriter.cc
===================================================================
--- modules/TreeWriter.cc	(revision a0431dcbf4f6030aaef06db0f34e0959b4b9c6ae)
+++ modules/TreeWriter.cc	(revision 9687203133c32a58144435a449f6d077a04b38c7)
@@ -554,5 +554,13 @@
     entry->FracPt[3] = candidate->FracPt[3];
     entry->FracPt[4] = candidate->FracPt[4];
-
+   
+    //--- N-subjettiness variables ----
+    
+    entry->Tau1 = candidate->Tau1;
+    entry->Tau2 = candidate->Tau2;
+    entry->Tau3 = candidate->Tau3;
+    entry->Tau4 = candidate->Tau4;
+    entry->Tau5 = candidate->Tau5;
+   
     FillParticles(candidate, &entry->Particles);
   }
