diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/share/FTAG5.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/share/FTAG5.py
index 62878c3942d35b6840216988662d6d3e8f15531b..6928e95e8580e6741a4a2d5a1cfdf22bd567cdff 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/share/FTAG5.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/share/FTAG5.py
@@ -30,7 +30,21 @@ from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import (
 # flavor tagging
 from DerivationFrameworkFlavourTag.HbbCommon import addVRJets
 from DerivationFrameworkFlavourTag import BTaggingContent as bvars
-from DerivationFrameworkFlavourTag.JSSVariables import JSSVariables
+from DerivationFrameworkJetEtMiss.JSSVariables import JSSHighLevelVariables
+
+#====================================================================
+# SET UP STREAM
+#====================================================================
+
+# The base name (DAOD_FTAG5 here) must match the string in
+streamName = derivationFlags.WriteDAOD_FTAG5Stream.StreamName
+fileName   = buildFileName( derivationFlags.WriteDAOD_FTAG5Stream )
+FTAG5Stream = MSMgr.NewPoolRootStream( streamName, fileName )
+# Only events that pass the filters listed below are written out.
+# Name must match that of the kernel above
+# AcceptAlgs  = logical OR of filters
+# RequireAlgs = logical AND of filters
+FTAG5Stream.AcceptAlgs(["FTAG5Kernel"])
 
 
 #====================================================================
@@ -45,6 +59,29 @@ FTAG5StringSkimmingTool = DerivationFramework__xAODStringSkimmingTool(
 ToolSvc += FTAG5StringSkimmingTool
 print FTAG5StringSkimmingTool
 
+#=====================================================================
+# Thinning tools
+#=====================================================================
+
+FTAG5ThinningHelper = ThinningHelper( "FTAG5ThinningHelper" )
+FTAG5ThinningHelper.TriggerChains = ''
+FTAG5ThinningHelper.AppendToStream( FTAG5Stream )
+
+
+from DerivationFrameworkFlavourTag.DerivationFrameworkFlavourTagConf import (
+    DerivationFramework__HbbTrackThinner as HbbThinner )
+FTAG5HbbThinningTool = HbbThinner(
+    name = "FTAG5HbbThinningTool",
+    thinningService = FTAG5ThinningHelper.ThinningSvc(),
+    largeJetPtCut = 200e3,
+    largeJetEtaCut = 2.1,
+    smallJetPtCut = 7e3,
+    nLeadingSubjets = 3,
+    addConstituents = True,
+    addConeAssociated = True)
+ToolSvc += FTAG5HbbThinningTool
+print FTAG5HbbThinningTool
+
 #====================================================================
 # TRUTH SETUP
 #====================================================================
@@ -129,36 +166,27 @@ for jc in OutputJets["FTAG5"]:
 FTAG5Seq += CfgMgr.DerivationFramework__DerivationKernel(
     "FTAG5Kernel",
     SkimmingTools = [FTAG5StringSkimmingTool],
+    ThinningTools = [FTAG5HbbThinningTool],
     AugmentationTools = []
 )
 
 
 #====================================================================
-# SET UP STREAM
+# Add slimming tools
 #====================================================================
 
-# The base name (DAOD_FTAG5 here) must match the string in
-streamName = derivationFlags.WriteDAOD_FTAG5Stream.StreamName
-fileName   = buildFileName( derivationFlags.WriteDAOD_FTAG5Stream )
-FTAG5Stream = MSMgr.NewPoolRootStream( streamName, fileName )
-# Only events that pass the filters listed below are written out.
-# Name must match that of the kernel above
-# AcceptAlgs  = logical OR of filters
-# RequireAlgs = logical AND of filters
-FTAG5Stream.AcceptAlgs(["FTAG5Kernel"])
-
 FTAG5SlimmingHelper = SlimmingHelper("FTAG5SlimmingHelper")
 
 fatJetCollection = "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets"
 subJetCollection = "AntiKtVR30Rmax4Rmin02TrackJets"
 
 FTAG5SlimmingHelper.SmartCollections = [
-    "Electrons","Muons",
+    "Muons",
     "InDetTrackParticles",
     "BTagging_AntiKtVR30Rmax4Rmin02Track_expert",
     fatJetCollection]
 
-jssVariables = ['.'.join([fatJetCollection] + JSSVariables) ]
+jssVariables = ['.'.join([fatJetCollection] + JSSHighLevelVariables) ]
 FTAG5SlimmingHelper.ExtraVariables += jssVariables
 
 FTAG5SlimmingHelper.ExtraVariables += [
@@ -178,9 +206,4 @@ FTAG5SlimmingHelper.IncludeJetTriggerContent = False
 FTAG5SlimmingHelper.IncludeEtMissTriggerContent = False
 FTAG5SlimmingHelper.IncludeBJetTriggerContent = False
 
-#FTAG5 TrigNav Thinning
-FTAG5ThinningHelper = ThinningHelper( "FTAG5ThinningHelper" )
-FTAG5ThinningHelper.TriggerChains = ''
-FTAG5ThinningHelper.AppendToStream( FTAG5Stream )
-
 FTAG5SlimmingHelper.AppendContentToStream(FTAG5Stream)
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/src/HbbTrackThinner.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/src/HbbTrackThinner.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..61d443efb3807ea432dc835e1cd03ca8b32423a9
--- /dev/null
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/src/HbbTrackThinner.cxx
@@ -0,0 +1,201 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+/////////////////////////////////////////////////////////////////
+// HbbTrackThinner.cxx, (c) ATLAS Detector software
+///////////////////////////////////////////////////////////////////
+// Author: Dan Guest (dguest@cern.ch)
+//
+// Tool to remove all the tracks in an event except those which are
+// associated to a subjet within a large R jet over some pt threshold
+
+#include "HbbTrackThinner.h"
+#include "AthenaKernel/IThinningSvc.h"
+#include "xAODTracking/TrackParticleContainer.h"
+#include <vector>
+#include <string>
+
+namespace DerivationFramework {
+
+// internal accessor structure
+  HbbAccessors::HbbAccessors():
+    parent("Parent"),
+    subjets("GhostVR30Rmax4Rmin02TrackJet"),
+    coneAssociator("BTagTrackToJetAssociator"),
+    ghostAssociator("GhostTrack")
+  {
+  }
+
+
+// Constructor
+  HbbTrackThinner::HbbTrackThinner(
+    const std::string& t,
+    const std::string& n,
+    const IInterface* p ) :
+    AthAlgTool(t,n,p),
+    m_thinningSvc("ThinningSvc",n),
+    m_ntot(0),
+    m_npass(0),
+    m_largeJetPtCut(200e3),
+    m_largeJetEtaCut(2.1),
+    m_smallJetPtCut(7e3),
+    m_nLeadingSubjets(3),
+    m_jetCollectionName("AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets"),
+    m_addConeAssociated(false),
+    m_addSubjetGhosts(false),
+    m_addConstituents(false)
+  {
+    declareInterface<DerivationFramework::IThinningTool>(this);
+    declareProperty("thinningService", m_thinningSvc);
+    declareProperty("largeJetPtCut", m_largeJetPtCut);
+    declareProperty("largeJetEtaCut", m_largeJetEtaCut);
+    declareProperty("smallJetPtCut", m_smallJetPtCut);
+    declareProperty("nLeadingSubjets", m_nLeadingSubjets);
+    declareProperty("jetCollectionName", m_jetCollectionName);
+    declareProperty("addConeAssociated", m_addConeAssociated);
+    declareProperty("addSubjetGhosts", m_addSubjetGhosts);
+    declareProperty("addConstituents", m_addConstituents);
+  }
+
+// Destructor
+  HbbTrackThinner::~HbbTrackThinner() {
+  }
+
+// Athena initialize and finalize
+  StatusCode HbbTrackThinner::initialize()
+  {
+    ATH_MSG_VERBOSE("initialize() ...");
+    if (!(m_addConeAssociated || m_addSubjetGhosts || m_addConstituents)) {
+      ATH_MSG_ERROR(
+        "no association is selected, you will not save any tracks");
+      return StatusCode::FAILURE;
+    }
+    return StatusCode::SUCCESS;
+  }
+  StatusCode HbbTrackThinner::finalize()
+  {
+    ATH_MSG_VERBOSE("finalize() ...");
+    ATH_MSG_INFO("Processed "<< m_ntot
+                 <<" tracks, "<< m_npass<< " were retained ");
+    return StatusCode::SUCCESS;
+  }
+
+
+  /////////////////////////////////////////////////////////////////////
+  /// thinning function
+  ////////////////////////////////////////////////////////////////////
+  //
+  StatusCode HbbTrackThinner::doThinning() const
+  {
+
+    // build a set of pointers to the particles we want to keep
+    std::set<const xAOD::TrackParticle*> jet_tracks;
+
+    // build a list of all the tracks we have in the large R jet
+    const xAOD::JetContainer *fatJets = 0;
+    CHECK( evtStore()->retrieve(fatJets, m_jetCollectionName) );
+    for (const auto* fatJet: *fatJets) {
+      if (fatJet->pt() < m_largeJetPtCut ||
+          std::abs(fatJet->eta()) > m_largeJetEtaCut) {
+        continue;
+      }
+      try {
+        auto new_tracks = getTracksInJet(*fatJet);
+        jet_tracks.insert(new_tracks.begin(), new_tracks.end());
+      } catch (std::logic_error& err) {
+        ATH_MSG_ERROR(err.what() << " while looking for tracks in" +
+                      m_jetCollectionName);
+      }
+    }
+
+    // Get the track container
+    typedef xAOD::TrackParticleContainer Tracks;
+    const auto* tracks = evtStore()->retrieve<const Tracks>(
+      "InDetTrackParticles");
+    if(!tracks) {
+      ATH_MSG_ERROR ("Couldn't find InDetTrackParticles");
+      return StatusCode::FAILURE;
+    }
+    m_ntot += tracks->size();
+
+    // Loop over tracks, see if they pass, set mask
+    std::vector<bool> mask;
+    for (const xAOD::TrackParticle* track: *tracks) {
+      if ( jet_tracks.count(track) ) {
+        m_npass++;
+        mask.push_back(true);
+      } else {
+        mask.push_back(false);
+      }
+    }
+    if (m_thinningSvc->filter(*tracks, mask,
+                              IThinningSvc::Operator::Or).isFailure()) {
+      ATH_MSG_ERROR("Application of thinning service failed! ");
+      return StatusCode::FAILURE;
+    }
+
+    return StatusCode::SUCCESS;
+  }
+
+
+  /////////////////////////////////////////////////////////////////////
+  /// internal function to get tracks in the jet
+  ////////////////////////////////////////////////////////////////////
+  //
+  std::set<const xAOD::TrackParticle*> HbbTrackThinner::getTracksInJet(
+    const xAOD::Jet& fatJet) const {
+    using xAOD::Jet;
+    std::set<const xAOD::TrackParticle*> jet_tracks;
+    // get subjets
+    const Jet* parent_jet = *m_acc.parent(fatJet);
+    if (!parent_jet) throw std::logic_error("no valid parent jet");
+    auto subjet_links = m_acc.subjets(*parent_jet);
+    std::vector<const Jet*> subjets;
+    for (const auto& el: subjet_links) {
+      const auto* jet = dynamic_cast<const Jet*>(*el);
+      if (!jet) throw std::logic_error("subjet is invalid");
+      if (subjets.size() < m_nLeadingSubjets &&
+          jet->pt() >= m_smallJetPtCut) {
+        subjets.push_back(jet);
+      }
+    }
+    std::sort(subjets.begin(), subjets.end(),
+              [](const Jet* j1, const Jet* j2){return j1->pt() > j2->pt();});
+    for (const Jet* jet: subjets) {
+      // get tracks
+      // start with b-tagging cone association
+      const xAOD::BTagging *bjet = jet->btagging();
+      if (!bjet) {
+        throw std::logic_error("no btagging object: " + m_jetCollectionName);
+      }
+
+      // various ways to add tracks
+      if (m_addConeAssociated) {
+        const auto trackLinks = m_acc.coneAssociator(*bjet);
+        for (const auto& link: trackLinks) {
+          const xAOD::TrackParticle* track = *link;
+          jet_tracks.insert(track);
+        }
+      }
+      if (m_addSubjetGhosts) {
+        for (const auto& ghost: m_acc.ghostAssociator(*jet)) {
+          const auto* track = dynamic_cast<const xAOD::TrackParticle*>(*ghost);
+          if (!track) throw std::runtime_error("this isn't a track particle");
+          jet_tracks.insert(track);
+        }
+      }
+      if (m_addConstituents) {
+        for (const auto& link: jet->constituentLinks()) {
+          const auto* track = dynamic_cast<const xAOD::TrackParticle*>(*link);
+          if (!track) {
+            throw std::logic_error("constituent isn't a track particle");
+          }
+          jet_tracks.insert(track);
+        }
+      }
+    }
+    return jet_tracks;
+  }
+
+}
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/src/HbbTrackThinner.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/src/HbbTrackThinner.h
new file mode 100644
index 0000000000000000000000000000000000000000..42e89a7ba1af5a0865cdba3139e34ba5a3e0763a
--- /dev/null
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/src/HbbTrackThinner.h
@@ -0,0 +1,102 @@
+/*
+  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
+*/
+
+///////////////////////////////////////////////////////////////////
+// (c) ATLAS Detector software
+///////////////////////////////////////////////////////////////////
+
+/////////////////////////////////////////////////////////////////
+// HbbTrackThinner.h, (c) ATLAS Detector software
+///////////////////////////////////////////////////////////////////
+// Author: Dan Guest (dguest@cern.ch)
+//
+// Tool to remove all the tracks in an event except those which are
+// associated to a subjet within a large R jet over some pt threshold
+
+
+#ifndef DERIVATIONFRAMEWORK_HBB_TRACK_THINNER_H
+#define DERIVATIONFRAMEWORK_HBB_TRACK_THINNER_H 1
+
+#include<string>
+
+// Gaudi & Athena basics
+#include "AthenaBaseComps/AthAlgTool.h"
+#include "GaudiKernel/ServiceHandle.h"
+
+// DerivationFramework includes
+#include "DerivationFrameworkInterfaces/IThinningTool.h"
+
+// accessors
+#include "xAODTracking/TrackParticleContainer.h"
+#include "xAODJet/JetContainer.h"
+
+
+class IThinningSvc;
+
+namespace DerivationFramework {
+
+  /** @class HbbTrackThinner
+      @author dguest -at- cern.ch
+  */
+
+  // internal class
+  struct HbbAccessors
+  {
+    HbbAccessors();
+    typedef ElementLink<xAOD::JetContainer> JetLink;
+    SG::AuxElement::ConstAccessor<JetLink> parent;
+
+    typedef std::vector<ElementLink<xAOD::IParticleContainer> > ParticleLinks;
+    SG::AuxElement::ConstAccessor<ParticleLinks> subjets;
+
+    // particles in the jet (we get both ghosts and cone associated)
+    typedef ElementLink<xAOD::TrackParticleContainer> TrackLink;
+    typedef std::vector<TrackLink> TrackLinks;
+    SG::AuxElement::ConstAccessor<TrackLinks> coneAssociator;
+    SG::AuxElement::ConstAccessor<ParticleLinks> ghostAssociator;
+
+  };
+
+
+  class HbbTrackThinner : public AthAlgTool, public IThinningTool {
+
+  public:
+    /** Constructor with parameters */
+    HbbTrackThinner( const std::string& t,
+                     const std::string& n,
+                     const IInterface* p );
+
+    /** Destructor */
+    ~HbbTrackThinner();
+
+    // Athena algtool's Hooks
+    StatusCode  initialize();
+    StatusCode  finalize();
+
+    /** Check that the current event passes this filter */
+    virtual StatusCode doThinning() const;
+
+  private:
+    std::set<const xAOD::TrackParticle*> getTracksInJet(
+      const xAOD::Jet& fatJet) const;
+    ServiceHandle<IThinningSvc> m_thinningSvc;
+    mutable unsigned int m_ntot;
+    mutable unsigned int m_npass;
+    double m_largeJetPtCut;
+    double m_largeJetEtaCut;
+    double m_smallJetPtCut;
+    unsigned int m_nLeadingSubjets;
+    std::string m_jetCollectionName;
+    bool m_addConeAssociated;
+    bool m_addSubjetGhosts;
+    bool m_addConstituents;
+
+    HbbAccessors m_acc;
+
+  };
+
+}
+
+
+#endif
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/src/components/DerivationFrameworkFlavourTag_entries.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/src/components/DerivationFrameworkFlavourTag_entries.cxx
index 987208af93d60ce1869d628bbb8f1687d162a284..883038af6aa2d50580f4811996c77e5bc7198c2a 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/src/components/DerivationFrameworkFlavourTag_entries.cxx
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/src/components/DerivationFrameworkFlavourTag_entries.cxx
@@ -2,12 +2,16 @@
 
 #include "../BTagVertexAugmenter.h"
 #include "../BTagTrackAugmenter.h"
+#include "../HbbTrackThinner.h"
+using namespace DerivationFramework;
 
 DECLARE_ALGORITHM_FACTORY(BTagVertexAugmenter)
 DECLARE_ALGORITHM_FACTORY(BTagTrackAugmenter)
+DECLARE_TOOL_FACTORY(HbbTrackThinner)
 
 DECLARE_FACTORY_ENTRIES( DerivationFrameworkFlavourTag )
 {
   DECLARE_ALGORITHM( BTagVertexAugmenter );
   DECLARE_ALGORITHM( BTagTrackAugmenter );
+  DECLARE_TOOL( HbbTrackThinner );
 }
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/JSSVariables.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/JSSVariables.py
similarity index 88%
rename from PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/JSSVariables.py
rename to PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/JSSVariables.py
index e595b3a8e78a01fb4755df12dba103b2a449f4b3..2629116ee5b052662310b6ec8be3bd1b3aeada4d 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkFlavourTag/python/JSSVariables.py
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/python/JSSVariables.py
@@ -1,5 +1,5 @@
 
-JSSVariables = [
+JSSHighLevelVariables = [
     "ECF1", "ECF2", "ECF3",
     "Tau1_wta", "Tau2_wta", "Tau3_wta",
     "FoxWolfram0", "FoxWolfram2",