diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/CMakeLists.txt b/InnerDetector/InDetValidation/InDetPhysValMonitoring/CMakeLists.txt
index ca34ab3c6cc7095c519b48698465ebe7909b95c3..a8d75e2c3e4be8da7beffb0546ba1ad0d8e987b3 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/CMakeLists.txt
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/CMakeLists.txt
@@ -2,6 +2,7 @@
 # Package: InDetPhysValMonitoring
 ################################################################################
 
+
 # Declare the package name:
 atlas_subdir( InDetPhysValMonitoring )
 
@@ -37,6 +38,7 @@ atlas_depends_on_subdirs( PUBLIC
                           Tracking/TrkEvent/TrkTrack
                           Tracking/TrkExtrapolation/TrkExInterfaces
                           Tracking/TrkTools/TrkToolInterfaces )
+                          
 
 # External dependencies:
 find_package( Eigen )
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/IAthSelectionTool.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/IAthSelectionTool.h
new file mode 100644
index 0000000000000000000000000000000000000000..882aa2afe1745174e6c6cdf8904a1eddab717edc
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/IAthSelectionTool.h
@@ -0,0 +1,51 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef INDETPHYSVALMONITORING_IATHSELECTIONTOOL_H
+#define INDETPHYSVALMONITORING_IATHSELECTIONTOOL_H
+
+/**
+ * @file IAthSelectionTool.h
+ * header file for interface of selection tools in this package
+ * @author shaun roe
+ * @date 10 October 2016
+**/
+
+
+
+//Gaudi
+#include "GaudiKernel/IAlgTool.h"
+#include "xAODBase/IParticle.h"
+#include <string>
+#include <vector>
+
+static const InterfaceID IID_IAthSelectionTool("IAthSelectionTool",1,0);
+
+/// IAthSelectionTool is a virtual baseclass for selection methods
+class IAthSelectionTool:virtual public IAlgTool{
+public:
+  ///interfaceID reimplemented from base
+  static const InterfaceID & interfaceID();
+  ///virtual destructor, does nothing
+  virtual ~IAthSelectionTool(){ }
+  /** @brief The most important method to determine whether the particle is accepted
+    * @param p Pointer to particle baseclass, will be cast to truth or track
+    * @return true if particle passes cuts
+    */ 
+  virtual bool accept(const xAOD::IParticle * p) = 0;
+  ///Clear internal counters for each cut
+  virtual void clearCounters()=0;
+  ///Gives a vector of unsigned int counters; relies on return-value-optimisation to be efficient
+  virtual std::vector<unsigned int> counters() const =0;
+  ///return the names of the cuts as a vector<string>
+  virtual std::vector<std::string> names() const = 0;
+  ///Returns a formatted text string reporting the cuts' results
+  virtual std::string str() const =0;
+};
+
+inline const InterfaceID & IAthSelectionTool::interfaceID(){
+	return IID_IAthSelectionTool;
+} 
+
+#endif
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/IHistogramDefinitionSvc.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/IHistogramDefinitionSvc.h
index b4123bf14e431c6046042d3e630a38acd733c639..0481bcc1b573836790d9c00a352dd1f9fb1e6110 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/IHistogramDefinitionSvc.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/IHistogramDefinitionSvc.h
@@ -16,23 +16,34 @@
 #include "GaudiKernel/IInterface.h"
 
 class SingleHistogramDefinition;
-///Interface class to get the histogram defintion for a named histogram in a given directory
+///Interface class to get the histogram definition for a named histogram in a given directory
 class IHistogramDefinitionSvc:virtual public IInterface{
 public:
 	///reimplemented from IInterface
 	static const InterfaceID & interfaceID();
-
+  ///Format of the data source holding the histogram definition
 	enum Formats{UNKNOWN,TEXT_XML,TEXT_PLAIN,NFORMATS};
+	///Virtual destructor does nothing
 	virtual ~IHistogramDefinitionSvc(){}
+	///typedef for axes limits, (lower bound, upper bound)
 	typedef std::pair<float, float> axesLimits_t ;
+	///Return a histogram definition, retrieved by histogram identifier (and directory name, if supplied)
 	virtual SingleHistogramDefinition definition(const std::string &name, const std::string & dirName="") const =0;
+	///Return Histogram type (TH1, TH2 etc) by histogram identifier (and directory name, if supplied)
 	virtual std::string histoType(const std::string &name, const std::string &dirName="") const = 0;
+	///Return Histogram title by histogram identifier (and directory name, if supplied)
 	virtual std::string title(const std::string &name, const std::string &dirName="") const =0;
+	///Return number of x bins by histogram identifier (and directory name, if supplied)
 	virtual unsigned int nBinsX(const std::string &name, const std::string &dirName="") const = 0;
+	///Return number of y bins by histogram identifier (and directory name, if supplied); default returns 0 for 1-D histos
 	virtual unsigned int nBinsY(const std::string &/*name*/, const std::string &/*dirName*/="") const { return 0; }
+	///Return x axes (lo,hi) by histogram identifier (and directory name, if supplied)
 	virtual axesLimits_t xLimits(const std::string &name, const std::string &dirName="") const = 0;
+	///Return y axes (lo,hi) by histogram identifier (and directory name, if supplied). Default returns (nan,nan).
 	virtual axesLimits_t yLimits(const std::string & /*name*/, const std::string &/*dirName*/="") const {return std::make_pair(std::numeric_limits<float>::quiet_NaN(),std::numeric_limits<float>::quiet_NaN());}
+	///Return x-axis title by histogram identifier (and directory name, if supplied)
 	virtual std::string xTitle(const std::string &name, const std::string &dirName="") const = 0;
+	///Return y-axis title by histogram identifier (and directory name, if supplied)
 	virtual std::string yTitle(const std::string &name, const std::string &dirName="") const = 0;
 	//virtual bool initialise()=0;
 	
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/IInDetPhysValDecoratorTool.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/IInDetPhysValDecoratorTool.h
index 2a0208a2c43529fd10bcc24b6a6731b14e7cde7f..da93c1df3a1fbad0f637173d43188674d01719c9 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/IInDetPhysValDecoratorTool.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/IInDetPhysValDecoratorTool.h
@@ -25,11 +25,9 @@ static const InterfaceID IID_IInDetPhysValDecoratorTool("IInDetPhysValDecoratorT
 class IInDetPhysValDecoratorTool:virtual public IAlgTool{
 public:
 	static const InterfaceID & interfaceID();
-	
+	virtual ~IInDetPhysValDecoratorTool(){/**nop**/}
 	virtual bool decorateTruth(const xAOD::TruthParticle & /*particle*/, const std::string& /*prefix = ""*/){return false;} //default implementation
   virtual bool decorateTrack(const xAOD::TrackParticle & /*particle*/, const std::string& /*prefix = ""*/){return false;}
-  
-
 };
 
 inline const InterfaceID & IInDetPhysValDecoratorTool::interfaceID(){
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/InDetPhysValMonitoringTool.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/InDetPhysValMonitoringTool.h
index 894bb00ef349e753e1f0776c31d0392a34393f11..3949c86d03684da0b0da5c9dc6804c19b4fafd3c 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/InDetPhysValMonitoringTool.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/InDetPhysValMonitoring/InDetPhysValMonitoringTool.h
@@ -10,22 +10,23 @@
  * @author shaun roe
  * @date 21 February 2014
 **/
-//STL includes
-#include <string>
 
-//#gaudi includes
-#include "GaudiKernel/ToolHandle.h"
+
+
 
 //local include
-#include "PATCore/IAsgSelectionTool.h"
+#include "InDetPhysValMonitoring/IInDetPhysValDecoratorTool.h"
+#include "InDetPhysValMonitoring/IAthSelectionTool.h"
+
+//#include "PATCore/IAsgSelectionTool.h"
 #include "AthenaMonitoring/ManagedMonitorToolBase.h"
 #include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h"
 
+//#gaudi includes
+#include "GaudiKernel/ToolHandle.h"
+//EDM includes
 #include "xAODTruth/TruthParticleContainer.h"
-
-#include "InDetPhysValMonitoring/IInDetPhysValDecoratorTool.h"
-#include "src/InDetPhysHitDecoratorTool.h"
-
+//Athena
 #include "AtlasDetDescr/AtlasDetectorID.h"
 #include "InDetIdentifier/PixelID.h"
 #include "InDetIdentifier/SCT_ID.h"
@@ -33,6 +34,10 @@
 #include "InDetReadoutGeometry/PixelDetectorManager.h"
 #include "InDetReadoutGeometry/SCT_DetectorManager.h"
 #include "InDetReadoutGeometry/TRT_DetectorManager.h"
+//STL includes
+#include <string>
+#include <vector>
+
 
 //fwd declaration
 class IInDetPhysValDecoratorTool;
@@ -40,6 +45,10 @@ class InDetRttPlots;
 namespace Root {
   class TAccept;
 }
+namespace IDPVM{
+  class CachedGetAssocTruth;
+}
+
 
 /**
  * Tool to book and fill inner detector histograms for physics validation
@@ -61,6 +70,20 @@ public:
 private:
 	///prevent default construction
 	InDetPhysValMonitoringTool();
+  // Private utility methods
+  void fillTrackCutFlow(Root::TAccept& accept);
+  void fillCutFlow(Root::TAccept& accept, std::vector<std::string> & names, std::vector<int> & cutFlow);
+  // Get truth particles into a vector, possibly using the pileup from the event
+	const std::vector<const xAOD::TruthParticle *> getTruthParticles();
+	//
+	const Trk::TrackParameters* getUnbiasedTrackParameters(const Trk::TrackParameters* trkParameters, const Trk::MeasurementBase* measurement );
+  // Get a data container; implementation at end of this header file
+  template<class T>
+	const T* getContainer( const std::string & containerName);
+	// Do Jet/TIDE plots (Tracking In Dense Environment)
+	StatusCode doJetPlots(const xAOD::TrackParticleContainer * pTracks, 
+	                      IDPVM::CachedGetAssocTruth & association,
+	                      const  xAOD::Vertex * primaryVtx);
 	///TrackParticle container's name
 	std::string m_trkParticleName;
 	///TruthParticle container's name
@@ -81,28 +104,17 @@ private:
 	bool m_useTrackSelection;
 	bool m_onlyInsideOutTracks;
 	bool m_TrkSelectPV;   // make track selection relative to PV
-
 	ToolHandle<InDet::IInDetTrackSelectionTool> m_trackSelectionTool;
-
-	//ToolHandle<Trk::ITrackSelectorTool> m_trackSelectionTool;
-	ToolHandle<IAsgSelectionTool> m_truthSelectionTool;
-
+  ToolHandle<IAthSelectionTool> m_truthSelectionTool;
 	std::vector<int> m_prospectsMatched;
 	int m_twoMatchedEProb;
 	int m_threeMatchedEProb;
 	int m_fourMatchedEProb;
 	int m_truthCounter;
 
-	void fillTrackCutFlow(Root::TAccept& accept);
 	std::vector<std::string> m_trackCutflowNames;
 	std::vector<int> m_trackCutflow;
-
-	void fillTruthCutFlow(Root::TAccept& accept);
-	std::vector<std::string> m_truthCutflowNames;
-	std::vector<int> m_truthCutflow;
-	
-	void fillCutFlow(Root::TAccept& accept, std::vector<std::string> & names, std::vector<int> & cutFlow);
-	
+	std::vector<unsigned int> m_truthCutCounters;
 	std::string m_pileupSwitch; // All, PileUp, or HardScatter
 	
 	///Jet Things
@@ -112,16 +124,10 @@ private:
 	bool m_fillExtraTIDEPlots;
 
 	std::string m_folder;
-
-	void getTruthParticles(std::vector<const xAOD::TruthParticle*>& truthParticles);
-	
-	const Trk::TrackParameters* getUnbiasedTrackParameters(const Trk::TrackParameters* trkParameters, const Trk::MeasurementBase* measurement );
-
-	template<class T>
-	const T* getContainer( const std::string & containerName);
 };
 
 template<class T>
+  inline 
 	const T* InDetPhysValMonitoringTool::getContainer(const std::string & containerName){
 		const T * ptr = evtStore()->retrieve< const T >( containerName );
     	if (!ptr) {
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/cmt/requirements b/InnerDetector/InDetValidation/InDetPhysValMonitoring/cmt/requirements
index e354de5c6c1920ad7083e8558228f74c568cb91d..54528dc487e787b5d16fcf18dda270aa5a490336 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/cmt/requirements
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/cmt/requirements
@@ -23,13 +23,14 @@ use AthenaBaseComps     AthenaBaseComps-*       Control
 use AtlasDetDescr               AtlasDetDescr-*         DetectorDescription
 use InDetIdentifier             InDetIdentifier-*       InnerDetector/InDetDetDescr
 use InDetReadoutGeometry  InDetReadoutGeometry-* InnerDetector/InDetDetDescr
+use xAODBase            xAODBase-*             Event/xAOD
+
 
 private
 use AtlasXercesC        AtlasXercesC-*        	External  
 use TrkExInterfaces		TrkExInterfaces-*		Tracking/TrkExtrapolation
 use TrkToolInterfaces           TrkToolInterfaces-*     Tracking/TrkTools
 use AtlasROOT           AtlasROOT-*             External
-use xAODBase            xAODBase-*             Event/xAOD
 #use GeneratorUtils      GeneratorUtils-*        Generators
 use TrkParameters       TrkParameters-*         Tracking/TrkEvent
 use InDetRIO_OnTrack            InDetRIO_OnTrack-*      InnerDetector/InDetRecEvent
@@ -37,7 +38,7 @@ use TrkEventPrimitives          TrkEventPrimitives-*    Tracking/TrkEvent
 use TrkTrack                    TrkTrack-*              Tracking/TrkEvent
 use GeoPrimitives               GeoPrimitives-*         DetectorDescription
 use EventPrimitives     EventPrimitives-*       Event
-use xAODEventInfo	xAODEventInfo-*		Event/xAOD
+use xAODEventInfo	      xAODEventInfo-*		Event/xAOD
 use  MCTruthClassifier          MCTruthClassifier-*             PhysicsAnalysis 
 use InDetBeamSpotService InDetBeamSpotService-* InnerDetector/InDetConditions
 use xAODJet             xAODJet-*               Event/xAOD
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/LargeD0_jobOptions.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/LargeD0_jobOptions.py
index 58689043198248230aa66f4af60465756710a459..7d7458620ae3354266b87fea8556e1218c63f96c 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/LargeD0_jobOptions.py
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/LargeD0_jobOptions.py
@@ -1,6 +1,6 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
-# $Id: LargeD0_jobOptions.py 760042 2016-07-06 15:33:22Z sche $
+# $Id: LargeD0_jobOptions.py 779296 2016-10-19 18:17:30Z sroe $
 
 # Set up the reading of the input xAOD:
 
@@ -9,13 +9,14 @@
 #"ESD.05297574._000081.pool.root.1" new ttbar dataset (this one should enable residuals)
 
 import getpass
-#FNAME = "AOD.pool.root.1"
+FNAME = "AOD.pool.root"
+'''
 FNAME = ["/n/atlas05/userdata/sche/MC15/xAOD/zprimemumu/emu_RecExCommon/r6/user.sche.LRT.r6.mc15_13TeV.301913.Pythia8EvtGen_A14NNPDF23LO_LLzprimemumu_m250t500.recon.ESD.e4821_s2698_r6939_AOD/user.sche.8294387.AOD._000001.pool.root",
          "/n/atlas05/userdata/sche/MC15/xAOD/zprimemumu/emu_RecExCommon/r6/user.sche.LRT.r6.mc15_13TeV.301913.Pythia8EvtGen_A14NNPDF23LO_LLzprimemumu_m250t500.recon.ESD.e4821_s2698_r6939_AOD/user.sche.8294387.AOD._000002.pool.root",
          "/n/atlas05/userdata/sche/MC15/xAOD/zprimemumu/emu_RecExCommon/r6/user.sche.LRT.r6.mc15_13TeV.301913.Pythia8EvtGen_A14NNPDF23LO_LLzprimemumu_m250t500.recon.ESD.e4821_s2698_r6939_AOD/user.sche.8294387.AOD._000003.pool.root",
          "/n/atlas05/userdata/sche/MC15/xAOD/zprimemumu/emu_RecExCommon/r6/user.sche.LRT.r6.mc15_13TeV.301913.Pythia8EvtGen_A14NNPDF23LO_LLzprimemumu_m250t500.recon.ESD.e4821_s2698_r6939_AOD/user.sche.8294387.AOD._000004.pool.root",
          "/n/atlas05/userdata/sche/MC15/xAOD/zprimemumu/emu_RecExCommon/r6/user.sche.LRT.r6.mc15_13TeV.301913.Pythia8EvtGen_A14NNPDF23LO_LLzprimemumu_m250t500.recon.ESD.e4821_s2698_r6939_AOD/user.sche.8294387.AOD._000005.pool.root"
-         ]
+         ]'''
 
 # -- Glob, if necessary ('*' is FNAME)
 if '*' in FNAME:
@@ -55,7 +56,7 @@ topSequence += monMan
 
 from InDetPhysValMonitoring.InDetPhysValMonitoringConf import TrackTruthSelectionTool
 truthSelection = TrackTruthSelectionTool()
-truthSelection.requireDecayBeforePixel = False
+#truthSelection.requireDecayBeforePixel = False
 truthSelection.minPt = 1000.
 truthSelection.maxBarcode = -1
 ToolSvc += truthSelection
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysValITk_jobOptions.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysValITk_jobOptions.py
index 9a7b90ac0d7ad58d894eeeaf343b150422846f25..b5a5a662dfed3b1615f56ca3436e2b754912a4b7 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysValITk_jobOptions.py
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysValITk_jobOptions.py
@@ -2,35 +2,32 @@
 
 # $Id: PhysVal_jobOptions.py 714189 2015-12-11 17:33:02Z sroe $
 
-# Set up the reading of the input xAOD:
-import AthenaPoolCnvSvc.ReadAthenaPool
-# read single file
-#FNAME="ESD.pool.root"
-# uncomment this for testing: step 1.2, mu=200 file:
-#FNAME="root://eosatlas//eos/atlas/user/l/lmijovic/shared_atlas/upgrade/inputs/mc15_14TeV.119995.Pythia8_A2MSTW2008LO_minbias_inelastic_low.recon.AOD.e1133_s2900_s2904_r7914/AOD.08762005._000011.pool.root.1"
-#FNAME="/afs/cern.ch/work/j/jwang/private/ATLAS-Upgrade/StripSim/TryLongShortStrips-Step15a/WorkArea/run/SLHCtest.ExtBrl4_GMX.AOD.pool.root"
-FNAME="/afs/cern.ch/work/j/jwang/public/ToShaun/SLHCtest.ExtBrl4_GMX.AOD.pool.root"
-
-svcMgr.EventSelector.InputCollections = [ FNAME ] 
-
-#eosDir = "/eos/atlas/user/n/norap/ITK/DAOD_IDTRKVALD/singleElectron/"
-#fileType = "mc15_14TeV.422024.ParticleGun_single_ele_PtFlat_0p2_2000.recon.DAOD_IDTRKVALID.e5074_s2897_t604_r8069/"
-#from InDetBeamSpotExample import DiskUtils
-#inFileList = DiskUtils.filelist( eosDir+fileType, "root://eosatlas.cern.ch/")
-#athenaCommonFlags.FilesInput = inFileList
+#Set to False if running on AOD or ESD - True for IDTRKVALDAOD
+runDAOD = False
 
+#-----------------------------------------------------------------------
+# set up the input file:
+# set up for reading pool.root format files (AOD,ESD,IDTRKVALDAOD)
+import AthenaPoolCnvSvc.ReadAthenaPool
 
-# read multiple files:
+# read single file: change acc. to your file name here
+FNAME=[ "AOD.pool.root" ]
+# uncomment this for testing: step 1.2, mu=200 file:
+#FNAME=[ "root://eosatlas//eos/atlas/user/l/lmijovic/shared_atlas/upgrade/inputs/mc15_14TeV.119995.Pythia8_A2MSTW2008LO_minbias_inelastic_low.recon.AOD.e1133_s2900_s2904_r7914/AOD.08762005._000011.pool.root.1" ]
+# uncomment to read multiple files:
 #import glob
-#INFILES=glob.glob('indir/*pool.root*')
-#svcMgr.EventSelector.InputCollections = INFILES
+#FNAME=glob.glob('indir/*pool.root*') 
 
-# Set global flags
+#
+# make AthenaCommonFlags aware of which file we are using
+# AthenaCommonFlags are used run-time configuration (InputFilePeeker)
 from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
+svcMgr.EventSelector.InputCollections = FNAME
 athenaCommonFlags.FilesInput = svcMgr.EventSelector.InputCollections
+#-----------------------------------------------------------------------
 
 from AthenaCommon.GlobalFlags import globalflags
-globalflags.DetGeo = 'atlas'
+#globalflags.DetGeo = 'atlas'
 
 from RecExConfig.InputFilePeeker import inputFileSummary
 globalflags.DataSource = 'data' if inputFileSummary['evt_type'][0] == "IS_DATA" else 'geant4'
@@ -39,11 +36,13 @@ globalflags.DetDescrVersion = inputFileSummary['geometry']
 xmlTags = [ ["ATLAS-P2-ITK-05","ExtBrl_32",""],
             ["ATLAS-P2-SFCAL-01-05-01","ExtBrl_32","GMX"],
             ["ATLAS-P2-ITK-06","ExtBrl_4",""],
-            ["ATLAS-P2-ITK-09-00-00","ExtBrl_4","GMX"],
+            ["ATLAS-P2-SFCAL-01-06-01","ExtBrl_4","GMX"],
             ["ATLAS-P2-ITK-07","IExtBrl_4",""],
             ["ATLAS-P2-SFCAL-01-07-01","IExtBrl_4","GMX"],
             ["ATLAS-P2-ITK-08","InclBrl_4",""],
-            ["ATLAS-P2-SFCAL-01-08-01","InclBrl_4","GMX"],]
+            ["ATLAS-P2-SFCAL-01-08-01","InclBrl_4","GMX"],
+            ["ATLAS-P2-ITK-10-00-00","InclBrl_4","GMX"],
+            ["ATLAS-P2-ITK-09-00-00","ExtBrl_4","GMX"],]
 
 for geoTag, layoutDescr, gmx in xmlTags:
    if (globalflags.DetDescrVersion().startswith(geoTag)):
@@ -54,27 +53,14 @@ for geoTag, layoutDescr, gmx in xmlTags:
       if gmx=="GMX":
          print "preIncludes for GMX strip layout"
          include('InDetSLHC_Example/preInclude.SLHC_Setup_Strip_GMX.py')
-         include('InDetSLHC_Example/SLHC_Setup_Reco_TrackingGeometry.py')
-      else:
+         if geoTag=="ATLAS-P2-ITK-10-00-00" or geoTag=="ATLAS-P2-ITK-09-00-00" :
+            include('InDetSLHC_Example/SLHC_Setup_Reco_TrackingGeometry.py')
+         else:
+            include('InDetSLHC_Example/SLHC_Setup_Reco_TrackingGeometry_GMX.py')
+      else : 
          include('InDetSLHC_Example/SLHC_Setup_Reco_TrackingGeometry.py')
       break
 
-
-include('InDetSLHC_Example/preInclude.SLHC_Setup_ExtBrl_4.py')
-include('InDetSLHC_Example/preInclude.SLHC_Setup_Strip_GMX.py')
-include('InDetSLHC_Example/preInclude.SiliconOnly.py')
-
-
-globalflags.ConditionsTag = 'OFLCOND-MC15c-SDR-12'
-
-from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags
-TrkDetFlags.MaterialMagicTag = 'ATLAS-P2-ITK-09-00-00' 
-TrkDetFlags.MaterialStoreGateKey = '/GLOBAL/TrackingGeo/LayerMaterialITK'
-TrkDetFlags.MaterialVersion = 17 
-TrkDetFlags.SLHC_Geometry = True 
-
-
-
 # Just turn on the detector components we need
 from AthenaCommon.DetFlags import DetFlags
 DetFlags.detdescr.all_setOff() 
@@ -85,13 +71,20 @@ DetFlags.detdescr.pixel_setOn()
 # Set up geometry and BField 
 include("RecExCond/AllDet_detDescr.py")
 
+from InDetSLHC_Example.SLHC_JobProperties import SLHC_Flags
+SLHC_Flags.SLHC_Version = ''
+
+         
+from AthenaCommon.GlobalFlags import jobproperties
+DetDescrVersion = jobproperties.Global.DetDescrVersion()
+
 for geoTag, layoutDescr,gmx in xmlTags:
    if (globalflags.DetDescrVersion().startswith(geoTag)):
       print "postInclude for ",layoutDescr, " layout"
-      #include('InDetSLHC_Example/postInclude.SLHC_Setup_'+layoutDescr+'.py')
+      include('InDetSLHC_Example/postInclude.SLHC_Setup_'+layoutDescr+'.py')
       break
 
-import TrkDetDescrSvc.AtlasTrackingGeometrySvc
+#import TrkDetDescrSvc.AtlasTrackingGeometrySvc
 
 # Access the algorithm sequence:
 from AthenaCommon.AlgSequence import AlgSequence
@@ -100,13 +93,14 @@ topSequence = AlgSequence()
 from InDetPhysValMonitoring.InDetPhysValMonitoringConf import HistogramDefinitionSvc
 ToolSvc = ServiceMgr.ToolSvc
 ServiceMgr+=HistogramDefinitionSvc()
-ServiceMgr.HistogramDefinitionSvc.DefinitionSource="../share/ITKHistDef.xml"
-# ../share/InDetPhysValMonitoringPlotDefinitions.xml"
+# new master/daughter xml-s common to Run2 and ITK: under testing
+ServiceMgr.HistogramDefinitionSvc.DefinitionSource="../share/InDetPVMPlotDefITK.xml"
 ServiceMgr.HistogramDefinitionSvc.DefinitionFormat="text/xml"
 
-from InDetPhysValMonitoring.InDetPhysValMonitoringConf import InDetPhysValDecoratorAlg
-decorators = InDetPhysValDecoratorAlg()
-topSequence += decorators
+if not runDAOD : 
+  from InDetPhysValMonitoring.InDetPhysValMonitoringConf import InDetPhysValDecoratorAlg
+  decorators = InDetPhysValDecoratorAlg()
+  topSequence += decorators
 
 
 from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
@@ -125,9 +119,9 @@ topSequence += monMan
 #-------------------------------------------------------------
 from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
 InDetTrackSelectorTool = InDet__InDetTrackSelectionTool("InDetTrackSelectorTool")
-InDetTrackSelectorTool.minPt            = 900           # Mev
-InDetTrackSelectorTool.maxD0            = 1             # mm
-InDetTrackSelectorTool.maxZ0            = 150           # mm
+InDetTrackSelectorTool.minPt            = 400           # Mev
+InDetTrackSelectorTool.maxD0            = 1              # mm
+InDetTrackSelectorTool.maxZ0            = 150          # mm
 InDetTrackSelectorTool.minNSiHits       = 9            # Pixel + SCT
 InDetTrackSelectorTool.maxNPixelHoles   = 2             # Pixel only
 #eta dependant hit cut below
@@ -139,8 +133,8 @@ print "Set Up InDetTrackSelectorTool"
 #-------------------------------------------------------------
 # Set up truth selection tool
 #-------------------------------------------------------------
-from InDetPhysValMonitoring.InDetPhysValMonitoringConf import TrackTruthSelectionTool
-TrackTruthSelectionTool = TrackTruthSelectionTool("TrackTruthSelectionTool")
+from InDetPhysValMonitoring.InDetPhysValMonitoringConf import AthTruthSelectionTool
+TrackTruthSelectionTool = AthTruthSelectionTool()
 # todo: manually adapt this acc. to the fiducial acceptance of your detector
 TrackTruthSelectionTool.maxEta     = 4.0
 TrackTruthSelectionTool.maxPt      = -1
@@ -149,8 +143,9 @@ TrackTruthSelectionTool.maxBarcode = 200e3
 TrackTruthSelectionTool.pdgId      = -1
 TrackTruthSelectionTool.requireCharged = True
 TrackTruthSelectionTool.requireStatus1 = True
-TrackTruthSelectionTool.maxProdVertRadius = 260. # max prod. vertex radius for secondaries [mm]
-TrackTruthSelectionTool.OutputLevel = DEBUG
+TrackTruthSelectionTool.maxProdVertRadius = 260. #max prod. vertex radius of secondaries [mm]
+#TrackTruthSelectionTool.requireDecayBeforePixel = True
+TrackTruthSelectionTool.OutputLevel = INFO
 ToolSvc += TrackTruthSelectionTool
 
 #-------------------------------------------------------------
@@ -161,37 +156,26 @@ InDetPhysValMonitoringTool = InDetPhysValMonitoringTool("InDetPhysValMonitoringT
 ##rdh InDetPhysValMonitoringTool.DirName = "InDetPhysValMon_inclusive/"
 InDetPhysValMonitoringTool.useTrackSelection = True
 InDetPhysValMonitoringTool.TrackSelectionTool = InDetTrackSelectorTool
-InDetPhysValMonitoringTool.TruthSelectionTool = TrackTruthSelectionTool
+#InDetPhysValMonitoringTool.TruthSelectionTool = TrackTruthSelectionTool
 InDetPhysValMonitoringTool.TruthParticleContainerName = "TruthParticles"
 #InDetPhysValMonitoringTool.PileupSwitch = "HardScatter"
-InDetPhysValMonitoringTool.OutputLevel = DEBUG
+InDetPhysValMonitoringTool.OutputLevel = INFO
 ToolSvc += InDetPhysValMonitoringTool
 
 monMan.AthenaMonTools += [InDetPhysValMonitoringTool]
 
-
+# set up output file 
 from GaudiSvc.GaudiSvcConf import THistSvc
 ServiceMgr += THistSvc()
 svcMgr.THistSvc.Output += ["MyPhysVal DATAFILE='MyPhysVal.root' OPT='RECREATE'"]
 
-# Do some additional tweaking:
+# set out message verbosity 
 from AthenaCommon.AppMgr import theApp
-ServiceMgr.MessageSvc.OutputLevel = INFO
+ServiceMgr.MessageSvc.OutputLevel = WARNING
 ServiceMgr.MessageSvc.defaultLimit = 10000
-theApp.EvtMax = 2
-
-
-from TrkDetDescrSvc.TrkDetDescrJobProperties import TrkDetFlags
-TrkDetFlags.MaterialMagicTag = 'ATLAS-P2-ITK-09-00-00'
-TrkDetFlags.MaterialStoreGateKey = '/GLOBAL/TrackingGeo/LayerMaterialITK'
-TrkDetFlags.MaterialVersion = 17
-TrkDetFlags.SLHC_Geometry = True
-
-print "TrkDetFlags: ",  TrkDetFlags 
-
-
-include('InDetSLHC_Example/postInclude.SLHC_Setup_ExtBrl_4.py')
 
+# max. number of events to process
+theApp.EvtMax = 10
 
 # dump configuration
 from AthenaCommon.ConfigurationShelve import saveToAscii
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysVal_jobOptions.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysVal_jobOptions.py
index a458804c555365bdce41bb5982899a662cccf41f..e1f038b76622b97b95dfb37834fd986a60412bf6 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysVal_jobOptions.py
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/PhysVal_jobOptions.py
@@ -1,32 +1,21 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
-# $Id: PhysVal_jobOptions.py 772874 2016-09-13 09:10:36Z sroe $
+# $Id: PhysVal_jobOptions.py 785412 2016-11-20 15:01:26Z sroe $
 
 # Set up the reading of the input xAOD:
 import getpass
 FNAME = "AOD.pool.root"
-#FNAME="root://eosatlas//eos/atlas/atlasgroupdisk/perf-idtracking/dq2/rucio/mc15_13TeV/0c/a1/RDO.07497163._000001.pool.root.1"
 if (getpass.getuser())=="mbaugh":
-  #FNAME = "../rootfile_storage/ESD.ttbarB.pool.root"
-  #FNAME = "../rootfile_storage/ESD.kshortBT_large.pool.root"
-  FNAME = "../rootfile_storage/ESD.newphoton_OFF.pool.root"
+  FNAME = "../command/target.pool.root"
   '''
   The following sets an environment variable to enable backtracking debug messages.
   To use in C++:
   const char * debugBacktracking = std::getenv("BACKTRACKDEBUG");
-  if (debugBacktracking){
-    std::cout<<"Rey: the number of Inside-Out tracks is "<<nInsideOut<<"\n";
-    std::cout<<"Finn: the number of Outside-In tracks is "<<nOutsideIn<<"\n";
-  }
   '''
-  os.environ["BACKTRACKDEBUG"] = "1"
+  os.environ["BACKTRACKDEBUG"] = "0"
   #
-  print " Hello, Max"
 include( "AthenaPython/iread_file.py" )
 
-if (getpass.getuser())=="woodsn":
-  print "Hi Natasha!"
-
 # Access the algorithm sequence:
 from AthenaCommon.AlgSequence import AlgSequence
 topSequence = AlgSequence()
@@ -52,21 +41,7 @@ monMan.LumiBlock           = 1
 monMan.FileKey = "M_output"
 topSequence += monMan
 
-#This doesn't work:
-'''
 
-from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetDetailedTrackSelectorTool
-InDetTrackSelectorTool = InDet__InDetDetailedTrackSelectorTool(name = "InDetDetailedTrackSelectionTool",
-                                                             TrackSummaryTool = InDetTrackSummaryTool,
-                                                             Extrapolator = InDetExtrapolator)        
-ToolSvc += InDetTrackSelectorTool
-tool1.TrackSelectionTool=InDetTrackSelectorTool
-tool1.onlyInsideOutTracks = True
-tool1.TrackSelectionTool.CutLevel         = "Loose" 
-tool1.TrackSelectionTool.UseTrkTrackTools = True
-tool1.TrackSelectionTool.TrackSummaryTool = InDetTrackSummaryTool
-tool1.TrackSelectionTool.Extrapolator     = InDetExtrapolator
-'''
 #this works:
 '''
 from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
@@ -93,26 +68,31 @@ InDetTrackSelectorTool = InDet__InDetTrackSelectionTool(name = "InDetTrackSelect
 ToolSvc += InDetTrackSelectorTool
 '''
 #This section should control TTST  7-12-16                                                        
-mode = "FWD" #Set this to "Back" for backtracking
-from InDetPhysValMonitoring.InDetPhysValMonitoringConf import TrackTruthSelectionTool
-truthSelection = TrackTruthSelectionTool()
-if mode == "Back":
+mode = "Fwd" #Set this to "Back" for backtracking
+from InDetPhysValMonitoring.InDetPhysValMonitoringConf import AthTruthSelectionTool
+AthTruthSelectionTool = AthTruthSelectionTool()
+
+if mode=="Back":
   # max prod. vertex radius for secondaries [mm]
-  # < 0 corresponds to : do not require decay before pixel
-  truthSelection.maxProdVertRadius = -999.9 
-  truthSelection.maxBarcode = -1
+  AthTruthSelectionTool.minPt = 5000
+  AthTruthSelectionTool.maxProdVertRadius = 4000 
+  AthTruthSelectionTool.maxBarcode = -1
+  AthTruthSelectionTool.hasNoGrandparent = True
 
-ToolSvc += truthSelection
+  os.environ["BACKTRACKDEBUG"] = "1"
+
+print AthTruthSelectionTool
+ToolSvc += AthTruthSelectionTool
 
 from InDetPhysValMonitoring.InDetPhysValMonitoringConf import InDetPhysValMonitoringTool
 tool1 = InDetPhysValMonitoringTool()
-tool1.TruthSelectionTool = truthSelection
+tool1.TruthSelectionTool = AthTruthSelectionTool
 tool1.useTrackSelection = False
 #tool1.TrackSelectionTool=InDetTrackSelectorTool
 tool1.FillTrackInJetPlots = False
-
-
+print tool1
 ToolSvc += tool1
+
 monMan.AthenaMonTools += [tool1]
 
 from InDetTrackHoleSearch.InDetTrackHoleSearchConf import InDet__InDetTrackHoleSearchTool
@@ -126,8 +106,8 @@ svcMgr.THistSvc.Output += ["M_output DATAFILE='M_output.root' OPT='RECREATE'"]
 
 # Do some additional tweaking:
 from AthenaCommon.AppMgr import theApp
-ServiceMgr.MessageSvc.OutputLevel = WARNING
+ServiceMgr.MessageSvc.OutputLevel = INFO
 ServiceMgr.MessageSvc.defaultLimit = 10000
 theApp.EvtMax = -1
 if (getpass.getuser())=="sroe":
-  theApp.EvtMax = 5
+  theApp.EvtMax = -1
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/ValidationOnly.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/ValidationOnly.py
new file mode 100644
index 0000000000000000000000000000000000000000..7e876d6df9bbe9bcf91207f573afa18b5382679e
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/ValidationOnly.py
@@ -0,0 +1,101 @@
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+# $Id: ValidationOnly.py 778514 2016-10-14 14:46:33Z sroe $
+
+# Set up the reading of the input xAOD:
+
+FNAME = "tmp.AOD"
+
+include( "AthenaPython/iread_file.py" )
+
+
+# Access the algorithm sequence:
+from AthenaCommon.AlgSequence import AlgSequence
+topSequence = AlgSequence()
+
+include ('PerfMonGPerfTools/ProfileEventLoop_preInclude.py')
+ServiceMgr.ProfilerService.InitEvent=10
+#from PerfMonComps.PerfMonFlags import jobproperties
+#jobproperties.PerfMonFlags.doMonitoring = True
+
+from InDetPhysValMonitoring.InDetPhysValMonitoringConf import HistogramDefinitionSvc
+ToolSvc = ServiceMgr.ToolSvc
+ServiceMgr+=HistogramDefinitionSvc()
+ServiceMgr.HistogramDefinitionSvc.DefinitionSource="../share/InDetPhysValMonitoringPlotDefinitions.xml"
+ServiceMgr.HistogramDefinitionSvc.DefinitionFormat="text/xml"
+
+
+from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager
+monMan = AthenaMonManager( "PhysValMonManager" )
+monMan.ManualDataTypeSetup = True
+monMan.DataType            = "monteCarlo"
+monMan.Environment         = "altprod"
+monMan.ManualRunLBSetup    = True
+monMan.Run                 = 1
+monMan.LumiBlock           = 1
+monMan.FileKey = "M_output"
+topSequence += monMan
+
+
+#this works:
+'''
+from InDetTrackSelectionTool.InDetTrackSelectionToolConf import InDet__InDetTrackSelectionTool
+InDetTrackSelectorTool = InDet__InDetTrackSelectionTool(name = "InDetTrackSelectorTool",
+                                                        CutLevel = InDetPrimaryVertexingCuts.TrackCutLevel(),
+                                                        minPt = InDetPrimaryVertexingCuts.minPT(),
+                                                        maxD0 = InDetPrimaryVertexingCuts.IPd0Max(),
+                                                        maxZ0 = InDetPrimaryVertexingCuts.z0Max(),
+                                                        maxZ0SinTheta = InDetPrimaryVertexingCuts.IPz0Max(),
+                                                        maxSigmaD0 = InDetPrimaryVertexingCuts.sigIPd0Max(),
+                                                        maxSigmaZ0SinTheta = InDetPrimaryVertexingCuts.sigIPz0Max(),
+                                                        # maxChiSqperNdf = InDetPrimaryVertexingCuts.fitChi2OnNdfMax(), # Seems not to be implemented?
+                                                        maxAbsEta = InDetPrimaryVertexingCuts.etaMax(),
+                                                        minNInnermostLayerHits = InDetPrimaryVertexingCuts.nHitInnermostLayer(),
+                                                        minNPixelHits = InDetPrimaryVertexingCuts.nHitPix(),
+                                                        maxNPixelHoles = InDetPrimaryVertexingCuts.nHolesPix(),
+                                                        minNSctHits = InDetPrimaryVertexingCuts.nHitSct(),
+                                                        minNTrtHits = InDetPrimaryVertexingCuts.nHitTrt(),
+                                                        minNSiHits = InDetPrimaryVertexingCuts.nHitSi(),
+                                                        TrackSummaryTool = InDetTrackSummaryTool,
+                                                        Extrapolator = InDetExtrapolator)
+
+
+ToolSvc += InDetTrackSelectorTool
+'''
+#This section should control TTST  7-12-16                                                        
+mode = "FWD" #Set this to "Back" for backtracking
+from InDetPhysValMonitoring.InDetPhysValMonitoringConf import AthTruthSelectionTool
+truthSelection = AthTruthSelectionTool()
+if mode == "Back":
+  # max prod. vertex radius for secondaries [mm]
+  # < 0 corresponds to : do not require decay before pixel
+  truthSelection.maxProdVertRadius = -999.9 
+  truthSelection.maxBarcode = -1
+
+ToolSvc += truthSelection
+
+from InDetPhysValMonitoring.InDetPhysValMonitoringConf import InDetPhysValMonitoringTool
+tool1 = InDetPhysValMonitoringTool()
+tool1.TruthSelectionTool = truthSelection
+tool1.useTrackSelection = False
+#tool1.TrackSelectionTool=InDetTrackSelectorTool
+tool1.FillTrackInJetPlots = False
+
+
+ToolSvc += tool1
+monMan.AthenaMonTools += [tool1]
+'''
+from InDetTrackHoleSearch.InDetTrackHoleSearchConf import InDet__InDetTrackHoleSearchTool
+InDetHoleSearchTool = InDet__InDetTrackHoleSearchTool(name = "InDetHoleSearchTool", Extrapolator = InDetExtrapolator, usePixel = True, useSCT= True, CountDeadModulesAfterLastHit = True)
+ToolSvc += InDetHoleSearchTool
+print InDetHoleSearchTool
+'''
+from GaudiSvc.GaudiSvcConf import THistSvc
+ServiceMgr += THistSvc()
+svcMgr.THistSvc.Output += ["M_output DATAFILE='M_output.root' OPT='RECREATE'"]
+
+# Do some additional tweaking:
+from AthenaCommon.AppMgr import theApp
+ServiceMgr.MessageSvc.OutputLevel = INFO
+ServiceMgr.MessageSvc.defaultLimit = 10000
+theApp.EvtMax = -1
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/generateESD.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/generateESD.py
index 1669ea35f698a2f017699b955500a46aedfb861f..ab9020435b8baf25df039f19fb7481b1bd23cdac 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/generateESD.py
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/generateESD.py
@@ -16,7 +16,10 @@ from AthenaCommon.AthenaCommonFlags import athenaCommonFlags
 #athenaCommonFlags.FilesInput = ["../rootfile_storage/mc15_13TeV.422016.ParticleGun_single_K0s_PtFlat1_10.recon.RDO.e4459_s2726_r7059/RDO.07275539._000001.pool.root.1"]
 
 #new photon conversion sample (8-18-16)
-athenaCommonFlags.FilesInput = ["root://eosatlas.cern.ch///eos/atlas/atlasgroupdisk/perf-idtracking/dq2/rucio/mc15_13TeV/54/d2/RDO.06634780._000001.pool.root.1"]
+#athenaCommonFlags.FilesInput = ["root://eosatlas.cern.ch///eos/atlas/atlasgroupdisk/perf-idtracking/dq2/rucio/mc15_13TeV/54/d2/RDO.06634780._000001.pool.root.1"]
+
+#better photon conversion sample (10-3-16)
+athenaCommonFlags.FilesInput = ["root://eosatlas.cern.ch//eos/atlas/atlasgroupdisk/perf-idtracking/dq2/rucio/mc15_13TeV/e6/ca/RDO.07275499._000001.pool.root.1"]
 
 #Control the number of events, -1 means "ALL"
 athenaCommonFlags.EvtMax = -1
@@ -30,9 +33,9 @@ rec.doTrigger=False
 
 from InDetRecExample.InDetJobProperties import InDetFlags
 InDetFlags.doSlimming.set_Value_and_Lock(False)          #7-21-16: normally False, set to True for testing
-InDetFlags.doBackTracking.statusOn = False
-InDetFlags.doTrtSegments.statusOn = False                 #8-8-16: new line added to enable backtracking
-InDetFlags.doTRTStandalone.set_Value_and_Lock(False)
+InDetFlags.doBackTracking.statusOn = True
+InDetFlags.doTrtSegments.statusOn = True                 #8-8-16: new line added to enable backtracking
+InDetFlags.doTRTStandalone.set_Value_and_Lock(False)      #10-3-16: Was False, now True
 #from JetRec.JetRecFlags import jetFlags
 #jetFlags.applyCalibration = False 
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/getSomeData.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/getSomeData.sh
index eab84abbaa7dd17cfb36e34592435128a72aa383..62ec14efad1d16bdc04fb55a0a61889df3a8540a 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/getSomeData.sh
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/getSomeData.sh
@@ -5,6 +5,8 @@ voms-proxy-init -voms atlas
 pushd /tmp/$USER
 #rucio download --nrandom 1 valid3:valid3.110401.PowhegPythia_P2012_ttbar_nonallhad.recon.ESD.e3099_s2578_r6603_tid05297574_00
 rucio download valid3:ESD.05297574._000080.pool.root.1
+#Itk
+#rucio download mc15_14TeV.117050.PowhegPythia_P2011C_ttbar.recon.DAOD_IDTRKVALID.e2176_s2897_s2901_r8209
 rm $TestArea/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/AOD.pool.root
 ln -s $PWD/`ls */*` $TestArea/InnerDetector/InDetValidation/InDetPhysValMonitoring/run/AOD.pool.root
 rm $TestArea/../run/AOD.pool.root
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/histdef_bookkeep/get_hdefs.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/histdef_bookkeep/get_hdefs.py
new file mode 100644
index 0000000000000000000000000000000000000000..51f6efcc5a77818858ae85cfc75ba43ba51a7f8f
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/histdef_bookkeep/get_hdefs.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+
+'''
+make ordered list of .xml histogram definitions for 
+ * input histogram title list (one per line)
+ * and an input .xml file (containing unordered superset
+     of input histo definitions)
+use-case: introducing some order in ~ 1k histograms InDetPVM produces
+'''
+
+import sys
+import string
+import re
+import argparse
+
+from hist_bookkeep_utils import *
+
+parser = argparse.ArgumentParser(
+    description='Get histogram xml blocks for list of id-s')
+
+parser.add_argument('--id',
+                    dest='in_histid',
+                    type=open,
+                    required=True,
+                    help='list of histogram id-s, one per line')
+
+parser.add_argument('--xml',
+                    dest='in_xmldef',
+                    type=open,
+                    required=True,
+                    help='xml file with histogram definitions')
+
+parser.add_argument('--c',
+                    dest='comment',
+                    required=False,
+                    default='',
+                    help='comment to put above each of the histograms')
+
+args = parser.parse_args()
+    
+##=========================================================
+# main
+in_histid_name=args.in_histid.name
+in_xmldef_name=args.in_xmldef.name
+
+out_xmldef_name=in_xmldef_name.split(".")[0]+"_"+in_histid_name.split(".")[0]+".xml"
+out_missingdef_name=in_xmldef_name.split(".")[0]+"_"+in_histid_name.split(".")[0]+"_missing.txt"
+
+print ''
+print ' reading input histogram ids in: ', in_histid_name
+print ' reading histogram xml definitions in: ', in_xmldef_name
+print ' writing histogram definitions to: ', out_xmldef_name
+print ' writing histos missing definitions to: ', out_missingdef_name
+print ''
+
+out_xmldef=open(out_xmldef_name, 'w')
+out_missingdef=open(out_missingdef_name, 'w')
+
+## --------------------------------------------------------
+for line in args.in_histid:
+    id=re.sub('\n','',line)
+    buff=get_hbuff(id,in_xmldef_name)
+    if not buff:
+        out_missingdef.write(id+'\n')
+    else:
+        for bline in buff:
+            out_xmldef.write(bline)
+## --------------------------------------------------------
+
+## --------------------------------------------------------
+## all done, clean-up
+out_xmldef.close()
+out_missingdef.close()
+
+print ''
+print 'all done'
+print ''
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/histdef_bookkeep/hist_bookkeep_utils.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/histdef_bookkeep/hist_bookkeep_utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..306e5a2dbad5603f34c415a7406e5d048fa9a2c2
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/histdef_bookkeep/hist_bookkeep_utils.py
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+#
+# utilities for  book-keeping xml histograms
+
+import re
+
+## --------------------------------------------------------
+def weed(line):
+    line=re.sub(' +',' ',line)
+    line=re.sub(' =','=',line)
+    line=re.sub('= ','=',line)
+ #   line=re.sub('>\n','>',line)
+    return line
+## --------------------------------------------------------
+
+## --------------------------------------------------------
+def get_val(_key,line):
+    _val=""
+    line=weed(line)
+    pieces=line.split(" ")
+    for piece in pieces:
+        if piece.startswith(_key+"="):
+            _val=piece.split("\"")[1]
+    return _val 
+## --------------------------------------------------------
+
+## --------------------------------------------------------
+def get_hbuff(_id,_infname,_withcomment=True):
+    # buffering the xml definition lines:
+    _buff=[]
+    _dobuff=False
+    # buffering the comment lines
+    _commbuff=[]
+    _docommbuff=False
+    
+    # loop over file to find histo-s with id xml and comment:
+    with open(_infname, 'r') as _f:
+        for _line in _f:
+            _line=weed(_line)
+            if _line.startswith("<h id=\""+_id+"\""):
+                _dobuff=True
+                _buff=_commbuff
+            elif _line.startswith("</h>"):
+                if (_dobuff):
+                    _buff.append(_line)
+                    # prepend comment
+                _dobuff=False
+                _commbuff=[]
+                _docommbuff=False
+            elif _withcomment and _line.startswith("<!--"):
+                if not _dobuff:
+                    _commbuff.append(_line)
+                    if ( not re.search("-->",_line) ):
+                        # multi-line comment
+                        _docommbuff=True
+                    else:
+                        _docommbuff=False
+            else:
+                if (_docommbuff):
+                    _commbuff.append(_line)
+                    if ( re.search("-->\s*",_line) ):
+                        _docommbuff=False
+                elif ( not re.search('\s*<',_line) and not _line in ['\n', '\r\n']):
+                    print 'Warning', _infname, 'non-xml formatted line :', _line
+                    
+            # buffer histo lines here:
+            if (_dobuff):
+                _buff.append(_line)
+                
+    return _buff
+## --------------------------------------------------------
+
+## --------------------------------------------------------
+## take a buffer of histogram + comment, and split it in comment+xml def
+def get_comm_def(_buff):
+    _comm_def=[[],[]]
+    _iscomm=False
+    for _bitem in _buff:
+        if _bitem.startswith("<!--"):
+            _iscomm=True
+            _comm_def[0].append(_bitem)
+            if ( re.search("-->",_bitem) ):
+                _iscomm=False
+        elif ( _iscomm):
+            _comm_def[0].append(_bitem)
+            if re.search("-->",_bitem):
+                _iscomm=False
+        else:
+            _comm_def[1].append(_bitem)
+
+    return _comm_def
+    
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/histdef_bookkeep/split_histdefs.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/histdef_bookkeep/split_histdefs.py
new file mode 100644
index 0000000000000000000000000000000000000000..edbf6ea5148bc47c9ee5d927a55fbc9f997dc1ba
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/histdef_bookkeep/split_histdefs.py
@@ -0,0 +1,193 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+'''
+take two files and find overlapping histogram definitions.
+... write out overlapping, different (in 1st file and 2nd file), 
+... and exclusive (only 1st file, only 2nd file)
+'''
+
+import sys
+import string
+import re
+import argparse
+
+from hist_bookkeep_utils import *
+
+parser = argparse.ArgumentParser(
+    description='Get histogram xml blocks for list of id-s')
+
+parser.add_argument('--xml1',
+                    dest='in_xml1',
+                    type=open,
+                    required=True,
+                    help='xml 1 file with histogram definitions')
+
+parser.add_argument('--xml2',
+                    dest='in_xml2',
+                    type=open,
+                    required=True,
+                    help='xml 2 file with histogram definitions')
+
+args = parser.parse_args()
+
+## ========================================================
+# helpers
+## --------------------------------------------------------
+def compare_idline(_l1,_l2):
+    _t1=[ get_val("id",_l1), get_val("type",_l1)]
+    _t2=[ get_val("id",_l2), get_val("type",_l2)]
+    check=compare_textrange(_t1,_t2,[],[])
+    if ("common"!=check):
+        return "error"
+    return compare_textrange(_t1,_t2,[],[])
+## --------------------------------------------------------
+
+## --------------------------------------------------------
+def compare_textrange(_t1,_t2,_r1,_r2):
+    if (_r1!=_r2):
+        return "rangediff"
+    elif (_t1!=_t2):
+        return "textdiff"
+    else:
+        return "common"
+## --------------------------------------------------------
+
+## --------------------------------------------------------   
+def compare_xyline(_l1,_l2):
+    _t1=[get_val("title",_l1)]
+    _t2=[get_val("title",_l2)]
+    _r1=[get_val("lo",_l1),get_val("hi",_l1),get_val("n",_l1)]
+    _r2=[get_val("lo",_l2),get_val("hi",_l2),get_val("n",_l2)]
+    return compare_textrange(_t1,_t2,_r1,_r2)
+## --------------------------------------------------------
+
+## --------------------------------------------------------
+def compare_hbuffs(blist):
+    # strip definitions 
+    _buff1=(get_comm_def(blist[0])[1])
+    _buff2=(get_comm_def(blist[1])[1])
+
+    textdiff=False
+    rangediff=False
+
+    if not _buff1:
+        return [-1,2]
+    elif not _buff2:
+        return [1,-1]
+
+    test=compare_idline(_buff1[0],_buff2[0])   
+    if ("error"==test):
+        return [-1,-1]
+    elif ("textdiff"==test):
+        textdiff=True    
+
+    type1=get_val("type",_buff1[0])
+    type2=get_val("type",_buff2[0])
+
+    testx=compare_xyline(_buff1[1],_buff2[1])
+    testy=compare_xyline(_buff1[2],_buff2[2])
+    if ("error"==testx or "error"==testy):
+        return [-1,-1]
+    elif ("textdiff"==testx or "textdiff"==testy):
+        textdiff=True
+    elif ("rangediff"==testx or "rangediff"==testy):
+        rangediff=True
+    if rangediff:
+        return [3,4]
+    elif textdiff:
+        return [5,6]
+    else:
+        return [0,-1]
+## --------------------------------------------------------
+
+##=========================================================
+# main     
+infname1=args.in_xml1.name
+infname2=args.in_xml2.name
+
+outfname_common=infname1.split(".")[0]+"_"+infname2.split(".")[0]+".xml"
+outfname_1only=infname1.split(".")[0]+"_only.xml"
+outfname_2only=infname2.split(".")[0]+"_only.xml"
+outfname_1diffrange=infname1.split(".")[0]+"_diffrange.xml"
+outfname_2diffrange=infname2.split(".")[0]+"_diffrange.xml"
+outfname_1difftext=infname1.split(".")[0]+"_difftext.xml"
+outfname_2difftext=infname2.split(".")[0]+"_difftext.xml"
+
+print ''
+print ' reading histogram xml definitions in ', infname1, infname2
+print ' writing histograms only in ', infname1, 'to', outfname_1only
+print ' writing histograms only in ', infname2, 'to', outfname_2only
+print ' writing histograms range diff in ', infname1, 'to', outfname_1diffrange
+print ' writing histograms range diff in ', infname2, 'to', outfname_2diffrange
+print ' writing histograms text diff in ', infname1, 'to', outfname_1difftext
+print ' writing histograms text diff in ', infname2, 'to', outfname_2difftext
+print ' writing histograms common to both to', outfname_common
+print ''
+
+outf_common=open(outfname_common, 'w')
+outf_1only=open(outfname_1only, 'w')
+outf_2only=open(outfname_2only, 'w')
+outf_1diffrange=open(outfname_1diffrange, 'w')
+outf_2diffrange=open(outfname_2diffrange, 'w')
+outf_1difftext=open(outfname_1difftext, 'w')
+outf_2difftext=open(outfname_2difftext, 'w')
+
+## --------------------------------------------------------
+## helper dictionary for writing out results to the right files
+buff_comp_dict={0:outf_common,
+                1:outf_1only,2:outf_2only,
+                3:outf_1diffrange,4:outf_2diffrange,
+                5:outf_1difftext,6:outf_2difftext}
+
+## --------------------------------------------------------
+buff1=[]
+buff2=[]
+## handle all definitions in 1st file:
+for line in args.in_xml1:
+    if line.startswith("<h"):
+        line=weed(line)
+        id=get_val("id",line)
+        #print id
+        buff1=get_hbuff(id,infname1,True)
+        buff2=get_hbuff(id,infname2,True)
+        # compare buffers
+        buffs=[buff1,buff2]
+        compvals=compare_hbuffs(buffs)
+        # write contents acc to the outcome of buffer-buffer comparison
+        for _val,_buff in zip(compvals,buffs):
+            for dkey,dval in buff_comp_dict.iteritems():
+                if (_val==dkey):
+                    for _bitem in _buff:
+                        dval.write(_bitem)
+        # clear all the buffers for the next comparison
+        buff1=[]
+        buff2=[]
+## --------------------------------------------------------
+
+## --------------------------------------------------------
+## handle all definitions only in 2nd file:
+buff1=[]
+buff2=[]
+for line in args.in_xml2:
+    line=weed(line)
+    if line.startswith("<h"):
+        id=get_val("id",line)
+        buff1=get_hbuff(id,infname1,True)
+        buff2=get_hbuff(id,infname2,True)   
+        if not buff1:
+            for _bitem in buff2:
+                buff_comp_dict[2].write(_bitem)
+        # clear all the buffers for the next comparison
+        buff1=[]
+        buff2=[]
+## --------------------------------------------------------
+
+## --------------------------------------------------------
+## all done, clean-up
+for key,of in buff_comp_dict.iteritems():
+    of.close()
+
+print ''
+print 'all done'
+print ''
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/histdef_bookkeep/test1.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/histdef_bookkeep/test1.xml
new file mode 100644
index 0000000000000000000000000000000000000000..68498aa176bcafebc27e3816a5da9868dddfd3d7
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/histdef_bookkeep/test1.xml
@@ -0,0 +1,13 @@
+<!--  -->
+<!-- basic plots -->
+<h id="basicd0" type="TH1F" title="d_{0} of selected tracks (in mm)">
+  <x title="d_{0}(mm)" n="200" lo="-2" hi="2"/>
+  <y title="Entries"/>
+</h>
+<!--
+long comment
+-->
+<h id="basicz0" type="TH1F" title="z_{0} of selected tracks (in mm)">
+  <x title="z_{0}(mm)" n="120" lo="-300" hi="300"/>
+  <y title="Entries"/>
+</h>
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/histdef_bookkeep/test2.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/histdef_bookkeep/test2.xml
new file mode 100644
index 0000000000000000000000000000000000000000..167fefa7f14a48b240d8d8aba755d82dc8794cef
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/scripts/histdef_bookkeep/test2.xml
@@ -0,0 +1,20 @@
+<!--  -->
+<!-- basic plots -->
+<h id="basicd0" type="TH1F" title="d_{0} of selected tracks (in mm)">
+  <x title="d_{0}(mm)" n="200" lo="-2" hi="2"/>
+  <y title="Entries"/>
+</h>
+<!--
+long comment
+-->
+<h id="basicz0" type="TH1F" title="z_{0} of selected tracks (in mm)">
+  <x title="z_{0}(mm)" n="1200" lo="-300" hi="300"/>
+  <y title="Entries"/>
+</h>
+<!--
+long 2 comment
+-->
+<h id="basicz20" type="TH1F" title="z_{0} of selected tracks (in mm)">
+  <x title="z_{0}(mm)" n="2000" lo="-300" hi="300"/>
+  <y title="Entries"/>
+</h>
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/ITKHistDef.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/ITKHistDef.xml
index 869c273700ed87ce6661408a14eb7d1ec46043b5..dd2a0face876636dd5fb78a5753992845215e2b3 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/ITKHistDef.xml
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/ITKHistDef.xml
@@ -43,7 +43,7 @@
   <y title="Entries"/>
 </h>
 <h id="basicphi" type="TH1F" title="#phi of selected tracks">
-  <x title="#phi" n="100" lo="-4" hi="4"/>
+  <x title="#phi" n="100" lo="-4;" hi="4"/>
   <y title="Entries"/>
 </h>
 <h id="basiceta" type="TH1F" title="#eta of selected tracks">
@@ -140,20 +140,20 @@
   <x title="z0" n="20" lo="-300" hi="300"/>
   <y title="Fake Rate" lo="0" hi="100"/>
 </h>
-<h id="fakeEtaTotal" type="TProfile" title="Fake Rate (primary & secondary)">
-  <x title="#eta" n="40" lo="-4" hi="4"/>
+<h id="fakeEtaTotal" type="TProfile" title="Fake Rate (primary and secondary)">
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
   <y title="Fake Rate" lo="0" hi="1"/>
 </h>
 <h id="fakeetaPrimary" type="TProfile" title="Fake Rate (primary)">
-  <x title="#eta" n="40" lo="-4" hi="4"/>
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
   <y title="Fake Rate" lo="0" hi="1"/>
 </h> 
 <h id="fakeetaSecondary" type="TProfile" title="Fake Rate (secondary)">
-  <x title="#eta" n="40" lo="-4" hi="4"/>
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
   <y title="Fake Rate" lo="0" hi="1"/>
 </h>
 <h id="fakeetaUnlinkedFrac" type="TProfile" title="Fake Rate (unlinked)">
-  <x title="#eta" n="40" lo="-4" hi="4"/>
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
   <y title="Fake Rate" lo="0" hi="1"/>
 </h>
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml
new file mode 100644
index 0000000000000000000000000000000000000000..881adc42008ad9a451e3403d5475d9dfbca8354a
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefCommon.xml
@@ -0,0 +1,1370 @@
+<!--
+   =======================================================
+   spectrum plots:
+   * filled by InDetPerfPlot_spectrum class
+   ========================================================
+  -->
+<h id="nSCTHits" type="TH1F" title="# SCT hits">
+  <x title="# SCT Hits" n="20" lo="0." hi="20"/>
+  <y title="Entries"/>
+</h>
+<h id="nPixHits" type="TH1F" title="# Pix hits">
+  <x title="# Pix Hits" n="20" lo="0." hi="20"/>
+  <y title="Entries"/>
+</h>
+<h id="nTotHits" type="TH1F" title="# Total hits">
+  <x title="# Totat Hits" n="20" lo="0." hi="20"/>
+  <y title="Entries"/>
+</h>
+<h id="nSCTDeadSensors" type="TH1F" title="# SCT DeadSensors">
+  <x title="# SCT DeadSensors" n="20" lo="0." hi="20"/>
+  <y title="Entries"/>
+</h>
+<h id="nPixDeadSensors" type="TH1F" title="# Pix DeadSensors">
+  <x title="# Pix DeadSensors" n="20" lo="0." hi="20"/>
+  <y title="Entries"/>
+</h>
+<h id="nTotDeadSensors" type="TH1F" title="# Total DeadSensors">
+  <x title="# Total DeadSensors" n="20" lo="0." hi="20"/>
+  <y title="Entries"/>
+</h>
+<h id="nSCTHits_vs_eta" type="TProfile" title="# SCT hits vs Eta">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="# SCT Hits" lo="0" hi="20"/>
+</h>
+<h id="nPixHits_vs_eta" type="TProfile" title="# Pix hits vs Eta">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="# Pix Hits" lo="0" hi="20"/>
+</h>
+<h id="nTotHits_vs_eta" type="TProfile" title="# total hits vs Eta">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="# total Hits" lo="0" hi="20"/>
+</h>
+<h id="nSCTDeadSensors_vs_eta" type="TProfile" title="# SCT deadsensors vs Eta">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="# SCT deadsensors" lo="0" hi="20"/>
+</h>
+<h id="nPixDeadSensors_vs_eta" type="TProfile" title="# pix deadsensors vs Eta">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="# pix deadsensors" lo="0" hi="20"/>
+</h>
+<h id="nTotDeadSensors_vs_eta" type="TProfile" title="# total deadsensors vs Eta">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="# total deadsensors" lo="0" hi="20"/>
+</h>
+<h id="recoEtaSpectrum" type="TH1F" title="reco eta spectrum">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Entries"/>
+</h>
+<h id="recod0Spectrum" type="TH1F" title="reco d0 spectrum">
+  <x title="d0" n="200" lo="-5." hi="5."/>
+  <y title="Entries"/>
+</h>
+<h id="recoz0Spectrum" type="TH1F" title="reco z0 spectrum">
+  <x title="z0" n="500" lo="-250." hi="250."/>
+  <y title="Entries"/>
+</h>
+<h id="recod0_vs_z0_good" type="TH2F" title="reco d0 vs. z0 - good TruthVert (vtxR &lt; 0.1)">
+  <x title="z0 [mm]" n="200" lo="-4000" hi="4000"/>
+  <y title="d0 [mm]" n="200" lo="-1000" hi="1000"/>
+</h>
+<h id="recod0_vs_z0_crazy" type="TH2F" title="reco d0 vs. z0 - crazy TruthVert (vtxR &gt; 0.1)">
+  <x title="z0 [mm]" n="200" lo="-4000" hi="4000"/>
+  <y title="d0 [mm]" n="200" lo="-1000" hi="1000"/>
+</h>
+<h id="recoz0sinSpectrum" type="TH1F" title="reco z0sin spectrum">
+  <x title="z0sintheta" n="500" lo="-250." hi="250."/>
+  <y title="Entries"/>
+</h>
+<h id="recoPtSpectrum" type="TH1F" title="reco pt spectrum">
+  <x title="pt (GeV/c)" n="100" lo="0." hi="100"/>
+  <y title="Entries"/>
+</h>
+<h id="recoPhiSpectrum" type="TH1F" title="reco phi spectrum">
+  <x title="#phi" n="60" lo="-3" hi="3"/>
+  <y title="Entries"/>
+</h>
+<h id="recoMatchProbabilitySpectrum" type="TH1F" title="truth match probability spectrum">
+  <x title="truth match probability" n="40" lo="0." hi="1.1"/>
+  <y title="Entries"/>
+</h>
+<h id="truthEtaSpectrum" type="TH1F" title="truth eta spectrum">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Entries"/>
+</h>
+<h id="truthPtSpectrum" type="TH1F" title="truth pt spectrum">
+  <x title="pt (GeV/c)" n="100" lo="0." hi="100"/>
+  <y title="Entries"/>
+</h>
+<h id="truthPhiSpectrum" type="TH1F" title="truth phi spectrum">
+  <x title="#phi" n="60" lo="-3" hi="3"/>
+  <y title="Entries"/>
+</h>
+<h id="recod0TVRSpectrum" type="TH1F" title="reco d0-TruthVtxR spectrum">
+  <x title="d0-TrVtR" n="200" lo="-5." hi="5."/>
+  <y title="Entries"/>
+</h>
+<h id="recoz0TVZSpectrum" type="TH1F" title="reco z0-TruthVtxZ spectrum">
+  <x title="d0-TrVtZ" n="200" lo="-10." hi="10."/>
+  <y title="Entries"/>
+</h>
+<h id="recoz0TVZsinSpectrum" type="TH1F" title="reco (z0-TruthVtxZ)sin spectrum">
+  <x title="(d0-TrVtZ)sin" n="200" lo="-10." hi="10."/>
+  <y title="Entries"/>
+</h>
+<!-- -->
+<!-- VTX-related -->
+<h id="TVXspectrum" type="TH1F" title="TruthVtxX spectrum">
+  <x title="TrVtxX" n="500" lo="-0.5" hi="0.5"/>
+  <y title="Entries"/>
+</h>
+<h id="TVYspectrum" type="TH1F" title="TruthVtxY spectrum">
+  <x title="TrVtxY" n="500" lo="-0.5" hi="0.5"/>
+  <y title="Entries"/>
+</h>
+<h id="TVZspectrum" type="TH1F" title="TruthVtxZ spectrum">
+  <x title="TrVtxZ" n="500" lo="-250." hi="250."/>
+  <y title="Entries"/>
+</h>
+<h id="TVRspectrum" type="TH1F" title="TruthVtxR spectrum">
+  <x title="TrVtxR" n="500" lo="0." hi="0.5"/>
+  <y title="Entries"/>
+</h>
+<h id="TVR_vs_Z" type="TH2F" title="Truth Vtx Rad vs. Z">
+  <x title="z [mm]" n="200" lo="-4000" hi="4000"/>
+  <y title="R [mm]" n="200" lo="0" hi="1000"/>
+</h>
+<h id="PVR_vs_Z" type="TH2F" title="Prim Vtx Rad vs. Z">
+  <x title="z [mm]" n="200" lo="-4000" hi="4000"/>
+  <y title="R [mm]" n="100" lo="0" hi="0.5"/>
+</h>
+<h id="recod0PVRSpectrum" type="TH1F" title="reco d0-PrimVtxR spectrum">
+  <x title="d0-PrVtR" n="200" lo="-10." hi="10."/>
+  <y title="Entries"/>
+</h>
+<h id="recoz0PVZSpectrum" type="TH1F" title="reco z0-PrimVtxZ spectrum">
+  <x title="d0-PrVtZ" n="200" lo="-20." hi="20."/>
+  <y title="Entries"/>
+</h>
+<h id="recoz0PVZsinSpectrum" type="TH1F" title="reco (z0-PrimVtxZ)sin spectrum">
+  <x title="(d0-PrVtZ)sin" n="200" lo="-20." hi="20."/>
+  <y title="Entries"/>
+</h>
+<h id="PVXspectrum" type="TH1F" title="PrimVtxX spectrum">
+  <x title="PrVtxX" n="500" lo="-0.25" hi="0.25"/>
+  <y title="Entries"/>
+</h>
+<h id="PVYspectrum" type="TH1F" title="PrimVtxY spectrum">
+  <x title="PrVtxY" n="500" lo="-0.25" hi="0.25"/>
+  <y title="Entries"/>
+</h>
+<h id="PVZspectrum" type="TH1F" title="PrimVtxZ spectrum">
+  <x title="PrVtxZ" n="500" lo="-250." hi="250."/>
+  <y title="Entries"/>
+</h>
+<h id="PVRspectrum" type="TH1F" title="PrimVtxR spectrum">
+  <x title="PrVtxR" n="100" lo="0." hi="0.25"/>
+  <y title="Entries"/>
+</h>
+<h id="ptvsEtaUnlinked_postSelect" type="TH2F" title="PT vs Eta Spectrum">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="p_{T}" n="200" lo="0" hi="200"/>
+</h>
+<h id="probvsSCTUnlinked_postSelect" type="TH2F" title="Truth Match Probability vs SCT Hits">
+  <x title="SCT Hits" n="20" lo="0" hi="20"/>
+  <y title="truth match probability" n="55" lo="0" hi="1.1"/>
+</h>
+<h id="probvsPixUnlinked_postSelect" type="TH2F" title="Truth Match Probability vs Pix Hits">
+  <x title="Pixel Hits" n="20" lo="0" hi="20"/>
+  <y title="truth match probability" n="55" lo="0" hi="1.1"/>
+</h>
+<h id="sharedHitsvsSCTUnlinked_postSelect" type="TH2F" title="Shared Hits vs SCT Hits">
+  <x title="SCT Hits" n="20" lo="0" hi="20"/>
+  <y title="Shared Hits" n="20" lo="0" hi="20"/>
+</h>
+<h id="sharedHitsvsPixUnlinked_postSelect" type="TH2F" title="Shared Hits vs Pixel Hits">
+  <x title="Pixel Hits" n="20" lo="0" hi="20"/>
+  <y title="Shared Hits" n="20" lo="0" hi="20"/>
+</h>
+<h id="holesvsPixUnlinked_postSelect" type="TH2F" title="Holes vs Pixel Hits">
+  <x title="Pixel Hits" n="20" lo="0" hi="20"/>
+  <y title="Holes" n="10" lo="0" hi="10"/>
+</h>
+<h id="pixholesvsPixUnlinked_postSelect" type="TH2F" title="Pixel Holes vs Pixel Hits">
+  <x title="Pixel Hits" n="20" lo="0" hi="20"/>
+  <y title="Holes" n="10" lo="0" hi="10"/>
+</h>
+<h id="holesvsSCTUnlinked_postSelect" type="TH2F" title="Holes vs SCT Hits">
+  <x title="SCT Hits" n="20" lo="0" hi="20"/>
+  <y title="Holes" n="10" lo="0" hi="10"/>
+</h>
+<h id="sctholesvsSCTUnlinked_postSelect" type="TH2F" title="SCT Holes vs SCT Hits">
+  <x title="SCT Hits" n="20" lo="0" hi="20"/>
+  <y title="Holes" n="10" lo="0" hi="10"/>
+</h>
+<h id="outliersvsPixUnlinked_postSelect" type="TH2F" title="Outliers vs Pixel Hits">
+  <x title="Pixel Hits" n="20" lo="0" hi="20"/>
+  <y title="Outliers" n="10" lo="0" hi="10"/>
+</h>
+<h id="pixoutliersvsPixUnlinked_postSelect" type="TH2F" title="Pixel Outliers vs Pixel Hits">
+  <x title="Pixel Hits" n="20" lo="0" hi="20"/>
+  <y title="Outliers" n="10" lo="0" hi="10"/>
+</h>
+<h id="outliersvsSCTUnlinked_postSelect" type="TH2F" title="Outliers vs SCT Hits">
+  <x title="SCT Hits" n="20" lo="0" hi="20"/>
+  <y title="Outliers" n="10" lo="0" hi="10"/>
+</h>
+<h id="sctoutliersvsSCTUnlinked_postSelect" type="TH2F" title="SCT Outliers vs SCT Hits">
+  <x title="SCT Hits" n="20" lo="0" hi="20"/>
+  <y title="Outliers" n="10" lo="0" hi="10"/>
+</h>
+<h id="hitsvsEtaUnlinked_postSelect" type="TProfile" title="Hits vs Eta">
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Hits" lo="0" hi="20"/>
+</h>
+<h id="pixHolesvsEtaUnlinked_postSelect" type="TProfile" title="Pixel Holes vs Eta">
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Pixel Holes" lo="0" hi="5"/>
+</h>
+<h id="sctHolesvsEtaUnlinked_postSelect" type="TProfile" title="SCT Holes vs Eta">
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Pixel Holes" lo="0" hi="5"/>
+</h>
+<h id="sctHitsvsPixHitsUnlinked_postSelect" type="TH2F" title="SCT Hits vs Pixel Hits">
+  <x title="Pixel Hits" n="20" lo="0" hi="20"/>
+  <y title="SCT Hits" n="20" lo="0" hi="20"/>
+</h>
+<h id="sctHitsvsEtaUnlinked_postSelect" type="TProfile" title="SCT Hits vs Eta">
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
+  <y title="SCT Hits" lo="0" hi="20"/>
+</h>
+<h id="pixHitsvsEtaUnlinked_postSelect" type="TProfile" title="Pixel Hits vs Eta">
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
+  <y title="SCT Hits" lo="0" hi="20"/>
+</h>
+<h id="pixOutliersvsEtaUnlinked_postSelect" type="TProfile" title="Pixel Outliers vs Eta">
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
+  <y title="SCT Hits" lo="0" hi="20"/>
+</h>
+<h id="sctOutliersvsEtaUnlinked_postSelect" type="TProfile" title="SCT Outliers vs Eta">
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
+  <y title="SCT Hits" lo="0" hi="20"/>
+</h>
+<h id="ptvsEtaLinked_postSelect" type="TH2F" title="PT vs Eta Spectrum">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Fake Rate" n="200" lo="0" hi="200"/>
+</h>
+<h id="probvsSCTLinked_postSelect" type="TH2F" title="Truth Match Probability vs SCT Hits">
+  <x title="SCT Hits" n="20" lo="0" hi="20"/>
+  <y title="truth match probability" n="55" lo="0" hi="1.1"/>
+</h>
+<h id="probvsPixLinked_postSelect" type="TH2F" title="Truth Match Probability vs Pix Hits">
+  <x title="Pixel Hits" n="20" lo="0" hi="20"/>
+  <y title="truth match probability" n="55" lo="0" hi="1.1"/>
+</h>
+<h id="sharedHitsvsSCTLinked_postSelect" type="TH2F" title="Shared Hits vs SCT Hits">
+  <x title="SCT Hits" n="20" lo="0" hi="20"/>
+  <y title="Shared Hits" n="20" lo="0" hi="20"/>
+</h>
+<h id="sharedHitsvsPixLinked_postSelect" type="TH2F" title="Shared Hits vs Pixel Hits">
+  <x title="Pixel Hits" n="20" lo="0" hi="20"/>
+  <y title="Shared Hits" n="20" lo="0" hi="20"/>
+</h>
+<h id="holesvsPixLinked_postSelect" type="TH2F" title="Holes vs Pixel Hits">
+  <x title="Pixel Hits" n="20" lo="0" hi="20"/>
+  <y title="Holes" n="10" lo="0" hi="10"/>
+</h>
+<h id="pixholesvsPixLinked_postSelect" type="TH2F" title="Pixel Holes vs Pixel Hits">
+  <x title="Pixel Hits" n="20" lo="0" hi="20"/>
+  <y title="Holes" n="10" lo="0" hi="10"/>
+</h>
+<h id="holesvsSCTLinked_postSelect" type="TH2F" title="Holes vs SCT Hits">
+  <x title="SCT Hits" n="20" lo="0" hi="20"/>
+  <y title="Holes" n="10" lo="0" hi="10"/>
+</h>
+<h id="sctholesvsSCTLinked_postSelect" type="TH2F" title="SCT Holes vs SCT Hits">
+  <x title="SCT Hits" n="20" lo="0" hi="20"/>
+  <y title="Holes" n="10" lo="0" hi="10"/>
+</h>
+<h id="pixoutliersvsPixLinked_postSelect" type="TH2F" title="Pixel Outliers vs Pixel Hits">
+  <x title="Pixel Hits" n="20" lo="0" hi="20"/>
+  <y title="Outliers" n="10" lo="0" hi="10"/>
+</h>
+<h id="outliersvsPixLinked_postSelect" type="TH2F" title="Outliers vs Pixel Hits">
+  <x title="Pixel Hits" n="20" lo="0" hi="20"/>
+  <y title="Outliers" n="10" lo="0" hi="10"/>
+</h>
+<h id="sctoutliersvsSCTLinked_postSelect" type="TH2F" title="SCT Outliers vs SCT Hits">
+  <x title="SCT Hits" n="20" lo="0" hi="20"/>
+  <y title="Outliers" n="10" lo="0" hi="10"/>
+</h>
+<h id="outliersvsSCTLinked_postSelect" type="TH2F" title="Outliers vs SCT Hits">
+  <x title="SCT Hits" n="20" lo="0" hi="20"/>
+  <y title="Outliers" n="10" lo="0" hi="10"/>
+</h>
+<h id="hitsvsEtaLinked_postSelect" type="TProfile" title="Hits vs Eta">
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Hits" lo="0" hi="20"/>
+</h>
+<h id="pixHolesvsEtaLinked_postSelect" type="TProfile" title="Pixel Holes vs Eta">
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Pixel Holes" lo="0" hi="5"/>
+</h>
+<h id="sctHolesvsEtaLinked_postSelect" type="TProfile" title="SCT Holes vs Eta">
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Pixel Holes" lo="0" hi="5"/>
+</h>
+<h id="sctHitsvsPixHitsLinked_postSelect" type="TH2F" title="SCT Hits vs Pixel Hits">
+  <x title="Pixel Hits" n="20" lo="0" hi="20"/>
+  <y title="SCT Hits" n="20" lo="0" hi="20"/>
+</h>
+<h id="sctHitsvsEtaLinked_postSelect" type="TProfile" title="SCT Hits vs Eta">
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
+  <y title="SCT Hits" lo="0" hi="20"/>
+</h>
+<h id="pixHitsvsEtaLinked_postSelect" type="TProfile" title="Pixel Hits vs Eta">
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
+  <y title="SCT Hits" lo="0" hi="20"/>
+</h>
+<h id="pixOutliersvsEtaLinked_postSelect" type="TProfile" title="Pixel Outliers vs Eta">
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
+  <y title="SCT Hits" lo="0" hi="20"/>
+</h>
+<h id="sctOutliersvsEtaLinked_postSelect" type="TProfile" title="SCT Outliers vs Eta">
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
+  <y title="SCT Hits" lo="0" hi="20"/>
+</h>
+<!--
+   =======================================================
+   end of spectrum plots:
+   ========================================================
+  -->
+<!--
+   =======================================================
+   hit residuals & cluster width plots:
+   * filled by InDetPerfPlot_hitResidual
+   * currently these plots will only get filled for ESD.
+   Not filled in xAOD/DxAOD.
+   Reason:contents are created by InDetPhysHitDecoratorTool
+   and require unlsimmed Trk::Track collection.
+   ========================================================
+  -->
+<!-- hitResidual plots -->
+<!-- x residuals -->
+<!-- barrel-->
+<h id="residualx_pixel_barrel" type="TH1F" title="Residual: Pixel Barrel X">
+  <x title="x residual(#mum)" n="1000" lo="-500" hi="500"/> 
+  <y title="Entries"/>
+</h>
+<h id="residualx_pixel_barrel_1hit" type="TH1F" title="Residual: Pixel Barrel X 1 hit">
+  <x title="x residual(#mum)" n="1000" lo="-500" hi="500"/>
+  <y title="Entries"/>
+</h>
+<h id="residualx_pixel_barrel_2ormorehits" type="TH1F" title="Residual: Pixel Barrel X &gt;=2 hits">
+  <x title="x residual(#mum)" n="1000" lo="-500" hi="500"/>
+  <y title="Entries"/>
+</h>
+<h id="residualx_sct_barrel" type="TH1F" title="Residual: SCT Barrel X">
+  <x title="x residual(#mum)" n="1200" lo="-600" hi="600"/> 
+  <y title="Entries"/>
+</h>
+<h id="residualx_sct_barrel_1hit" type="TH1F" title="Residual: SCT Barrel X 1 hit">
+  <x title="x residual(#mum)" n="1200" lo="-600" hi="600"/>
+  <y title="Entries"/>
+</h>
+<h id="residualx_sct_barrel_2ormorehits" type="TH1F" title="Residual: SCT Barrel X &gt;=2 hits">
+  <x title="x residual(#mum)" n="1200" lo="-600" hi="600"/>
+  <y title="Entries"/>
+</h>
+<!-- endcaps -->
+<h id="residualx_pixel_endcap" type="TH1F" title="Residual: Pixel Endcap X">
+  <x title="x residual(#mum)" n="1000" lo="-500" hi="500"/> 
+  <y title="Entries"/>
+</h>
+<h id="residualx_pixel_endcap_1hit" type="TH1F" title="Residual: Pixel Endcap X 1 hit">
+  <x title="x residual(#mum)" n="1000" lo="-500" hi="500"/>
+  <y title="Entries"/>
+</h>
+<h id="residualx_pixel_endcap_2ormorehits" type="TH1F" title="Residual: Pixel Endcap X &gt;=2 hits">
+  <x title="x residual(#mum)" n="1000" lo="-500" hi="500"/>
+  <y title="Entries"/>
+</h>
+<h id="residualx_sct_endcap" type="TH1F" title="Residual: SCT Endcap X">
+  <x title="x residual(#mum)" n="1200" lo="-600" hi="600"/> 
+  <y title="Entries"/>
+</h>
+<h id="residualx_sct_endcap_1hit" type="TH1F" title="Residual: SCT Endcap X 1 hit">
+  <x title="x residual(#mum)" n="1200" lo="-600" hi="600"/>
+  <y title="Entries"/>
+</h>
+<h id="residualx_sct_endcap_2ormorehits" type="TH1F" title="Residual: SCT Endcap X &gt;=2 hits">
+  <x title="x residual(#mum)" n="1200" lo="-600" hi="600"/>
+  <y title="Entries"/>
+</h>
+<!-- y residuals -->
+<!-- barrel -->
+<h id="residualy_pixel_barrel" type="TH1F" title="Residual: Pixel Barrel Y">
+  <x title="y residual(#mum)" n="1000" lo="-500" hi="500"/> 
+  <y title="Entries"/>
+</h>
+<h id="residualy_pixel_barrel_1hit" type="TH1F" title="Residual: Pixel Barrel Y 1 hit">
+  <x title="y residual(#mum)" n="1000" lo="-500" hi="500"/>
+  <y title="Entries"/>
+</h>
+<h id="residualy_pixel_barrel_2ormorehits" type="TH1F" title="Residual: Pixel Barrel Y &gt;=2 hits">
+  <x title="x residual(#mum)" n="1000" lo="-500" hi="500"/>
+  <y title="Entries"/>
+</h>
+<h id="residualy_sct_barrel" type="TH1F" title="Residual: SCT Barrel Y">
+  <x title="y residual(#mum)" n="1200" lo="-600" hi="600"/>
+  <y title="Entries"/>
+</h>
+<h id="residualy_sct_barrel_1hit" type="TH1F" title="Residual: SCT Barrel Y 1 hit">
+  <x title="y residual(#mum)" n="1200" lo="-600" hi="600"/>
+  <y title="Entries"/>
+</h>
+<h id="residualy_sct_barrel_2ormorehits" type="TH1F" title="Residual: SCT Barrel Y &gt;=2 hits">
+  <x title="y residual(#mum)" n="1200" lo="-600" hi="600"/>
+  <y title="Entries"/>
+</h>
+<!-- endcaps -->
+<h id="residualy_pixel_endcap" type="TH1F" title="Residual: Pixel Endcap Y">
+  <x title="y residual(#mum)" n="1000" lo="-500" hi="500"/> 
+  <y title="Entries"/>
+</h>
+<h id="residualy_pixel_endcap_1hit" type="TH1F" title="Residual: Pixel Endcap Y 1 hit">
+  <x title="y residual(#mum)" n="1000" lo="-500" hi="500"/>
+  <y title="Entries"/>
+</h>
+<h id="residualy_pixel_endcap_2ormorehits" type="TH1F" title="Residual: Pixel Endcap Y &gt;=2 hits">
+  <x title="y residual(#mum)" n="1000" lo="-500" hi="500"/>
+  <y title="Entries"/>
+</h>
+<!-- pulls -->
+<!-- barrel, x -->
+<h id="residualpullx_pixel_barrel" type="TH1F" title="Residualpull: Pixel Barrel X">
+  <x title="x residual(#mum)" n="100" lo="-5" hi="5"/>
+  <y title="Entries"/>
+</h>
+<h id="residualpullx_sct_barrel" type="TH1F" title="Residualpull: SCT Barrel X">
+  <x title="x residual(#mum)" n="100" lo="-5" hi="5"/>
+  <y title="Entries"/>
+</h>
+<!-- endcap, x -->
+<h id="residualpullx_pixel_endcap" type="TH1F" title="Residualpull: Pixel Endcap X">
+  <x title="x residual(#mum)" n="100" lo="-5" hi="5"/>
+  <y title="Entries"/>
+</h>
+<h id="residualpullx_sct_endcap" type="TH1F" title="Residualpull: SCT Endcap X">
+  <x title="x residual(#mum)" n="100" lo="-5" hi="5"/>
+  <y title="Entries"/>
+</h>
+<!-- barrel, y -->
+<h id="residualpully_pixel_barrel" type="TH1F" title="Residualpull: Pixel Barrel Y">
+  <x title="y residual(#mum)" n="100" lo="-5" hi="5"/>
+  <y title="Entries"/>
+</h>
+<h id="residualpully_sct_barrel" type="TH1F" title="Residualpull: SCT Barrel Y">
+  <x title="y residual(#mum)" n="10" lo="-5" hi="5"/>
+  <y title="Entries"/>
+</h>
+<!-- endcap,y -->
+<h id="residualpully_pixel_endcap" type="TH1F" title="Residualpull: Pixel Endcap Y">
+  <x title="y residual(#mum)" n="100" lo="-5" hi="5"/>
+  <y title="Entries"/>
+</h>
+<h id="residualpully_sct_endcap" type="TH1F" title="Residualpull: SCT Endcap Y">
+  <x title="y residual(#mum)" n="10" lo="-5" hi="5"/>
+  <y title="Entries"/>
+</h>
+<!-- cluster width plots -->
+<h id="clusterPhiWidth_pixel_barrel" type="TH1F" title="Cluster width in phi: Pixel Barrel">
+  <x title="Pixels" n="10" lo="0" hi="10"/>
+  <y title="Entries"/>
+</h>
+<h id="clusterPhiWidth_pixel_endcap" type="TH1F" title="Cluster width in phi: Pixel Endcap">
+  <x title="Pixels" n="10" lo="0" hi="10"/>
+  <y title="Entries"/>
+</h>
+<h id="clusterEtaWidth_pixel_barrel" type="TH1F" title="Cluster width in eta: Pixel Barrel">
+  <x title="Pixels" n="20" lo="0" hi="20"/>
+  <y title="Entries"/>
+</h>
+<h id="clusterEtaWidth_pixel_endcap" type="TH1F" title="Cluster width in eta: Pixel Endcap">
+  <x title="Pixels" n="10" lo="0" hi="10"/>
+  <y title="Entries"/>
+</h>
+<h id="clusterPhiWidth_sct_barrel" type="TH1F" title="Cluster width in phi: SCT Barrel">
+  <x title="num. strips" n="10" lo="0" hi="10"/>
+  <y title="Entries"/>
+</h>
+<h id="clusterPhiWidth_sct_endcap" type="TH1F" title="Cluster width in phi: SCT Endcap">
+  <x title="num. strips" n="10" lo="0" hi="10"/>
+  <y title="Entries"/>
+</h>
+<!--
+   =======================================================
+   end of hit residuals & cluster width plots
+   ========================================================
+  -->
+<!--
+   =======================================================
+   hit efficiency plots:
+   * filled by InDetPerfPlot_hitEff
+   * currently these plots will only get filled for ESD.
+   Reason:contents are created by InDetPhysHitDecoratorTool
+   and require unlsimmed Trk::Track collection.
+   ========================================================
+  -->
+<!-- Pixel innermost barrel -->
+<h id="eff_hit_vs_eta_ibl_barrel" type="TProfile" title="Cluster Efficiency: Pix Barrel Innermost">
+  <x title="#eta" n="10" lo="0" hi="&ETA;"/>
+  <y title="Cluster Efficiency" lo="0" hi="2.0"/>
+</h>
+<!-- Pixel barrel: all appart from inner-most barrel region -->
+<h id="eff_hit_vs_eta_pix_barrel" type="TProfile" title="Cluster Efficiency: Pixel Barrel">
+  <x title="#eta" n="20" lo="0" hi="&ETA;"/>
+  <y title="Cluster Efficiency" lo="0" hi="2.0"/>
+</h>
+<h id="eff_hit_vs_eta_pix_endcap" type="TProfile" title="Cluster Efficiency: Pixel Endcaps">
+  <x title="#eta" n="20" lo="&ETAPixECMin;" hi="&ETA;"/>
+  <y title="Cluster Efficiency" lo="0" hi="2.0"/>
+</h>
+<h id="eff_hit_vs_eta_sct_barrel" type="TProfile" title="Cluster Efficiency: SCT Barrel">
+  <x title="#eta" n="20" lo="0" hi="&ETASct;"/>
+  <y title="Cluster Efficiency" lo="0" hi="2.0"/>
+</h>
+<h id="eff_hit_vs_eta_sct_endcap" type="TProfile" title="Cluster Efficiency: SCT Endcaps">
+  <x title="#eta" n="20" lo="&ETASctECMin;" hi="&ETASct;"/>
+  <y title="Cluster Efficiency" lo="0" hi="2.0"/>
+</h>
+<!--
+   =======================================================
+   end of hit efficiency plots
+   ======================================================
+  -->
+
+<!--
+   =======================================================
+   xxx todo addcomments plots:
+   ========================================================
+  -->
+<h id="num_truthmatch_match" type="TH1F" title="num_truthmatch_match">
+  <x title="Num. matching truth" n="10" lo="0" hi="10"/>
+  <y title="Entries"/>
+</h>
+<h id="nparticle" type="TH1F" title="Number of Truth Particles">
+  <x title="Num. truth particles" n="500" lo="0" hi="5000"/>
+  <y title="Entries"/>
+</h>
+<h id="ntracksel" type="TH1F" title="Number of Selected Tracks">
+  <x title="Num. tracks" n="500" lo="0" hi="5000"/>
+  <y title="Entries"/>
+</h>
+<h id="ntrack" type="TH1F" title="Number of Tracks">
+  <x title="Num. tracks" n="500" lo="0" hi="5000"/>
+  <y title="Entries"/>
+</h>
+<!-- -->
+<!-- basic plots -->
+<h id="basicd0" type="TH1F" title="d_{0} of selected tracks (in mm)">
+  <x title="d_{0}(mm)" n="200" lo="-2" hi="2"/>
+  <y title="Entries"/>
+</h>
+<h id="basicz0" type="TH1F" title="z_{0} of selected tracks (in mm)">
+  <x title="z_{0}(mm)" n="120" lo="-300" hi="300"/>
+  <y title="Entries"/>
+</h>
+<h id="basicphi" type="TH1F" title="#phi of selected tracks">
+  <x title="#phi" n="100" lo="-&PI;" hi="&PI;"/>
+  <y title="Entries"/>
+</h>
+<h id="basiceta" type="TH1F" title="#eta of selected tracks">
+  <x title="#eta" n="100" lo="-5" hi="5"/>
+  <y title="Entries"/>
+</h>
+<h id="basictheta" type="TH1F" title="#theta of selected tracks">
+  <x title="#theta" n="100" lo="0" hi="&PI;"/>
+  <y title="Entries"/>
+</h>
+<h id="basicqOverP" type="TH1F" title="q/p of selected tracks (in GeV)">
+  <x title="p_{T}(GeV/c)" n="200" lo="-0.01" hi="0.01"/>
+  <y title="Entries"/>
+</h>
+<h id="truthd0" type="TH1F" title="d_{0} of selected truth (in mm)">
+  <x title="d_{0}(mm)" n="2000" lo="-2" hi="2"/>
+  <y title="Entries"/>
+</h>
+<h id="truthz0" type="TH1F" title="z_{0} of selected truth (in mm)">
+  <x title="z_{0}(mm)" n="120" lo="-300" hi="300"/>
+  <y title="Entries"/>
+</h>
+<h id="truthphi" type="TH1F" title="#phi of selected truth">
+  <x title="#phi" n="100" lo="-&PI;" hi="&PI;"/>
+  <y title="Entries"/>
+</h>
+<h id="trutheta" type="TH1F" title="#eta of selected truth">
+  <x title="#theta" n="100" lo="-5" hi="5"/>
+  <y title="Entries"/>
+</h>
+<h id="truththeta" type="TH1F" title="#theta of selected truth">
+  <x title="#theta" n="100" lo="0" hi="&PI;"/>
+  <y title="Entries"/>
+</h>
+<h id="truthqOverP" type="TH1F" title="q/p of selected truth (in GeV)">
+  <x title="p_{T}(GeV/c)" n="200" lo="-0.005" hi="0.005"/>
+  <y title="Entries"/>
+</h>
+<h id="truthz0st" type="TH1F" title="z_{0} sin(#theta) of selected truth ">
+  <x title="p_{T}(GeV/c)" n="200" lo="-300" hi="300"/>
+  <y title="Entries"/>
+</h>
+<h id="truthprodR" type="TH1F" title="Radial distance (r) of truth vtx parameter from origin">
+  <x title="(mm)" n="100" lo="0.0" hi="2.0"/>
+  <y title="Entries"/>
+</h>
+<h id="truthprodZ" type="TH1F" title="Longitudinal (z) distance of truth vtx parameter from origin">
+  <x title="(mm)" n="100" lo="0" hi="300"/>
+  <y title="Entries"/>
+</h>
+<!-- -->
+<!-- pT -->
+<h id="recpT" type="TH1F" title="p_{T} of selected rec tracks (in GeV)">
+  <x title="p_{T} (GeV/c)" n="200" lo="0." hi="200"/>
+  <y title="Entries"/>
+</h>
+<h id="recPtLow" type="TH1F" title="p_{T} of selected rec tracks (in GeV)">
+  <x title="p_{T} (GeV/c)" n="200" lo="0." hi="20"/>
+  <y title="Entries"/>
+</h>
+<!-- fakes -->
+<h id="fakepT" type="TH1F" title="p_{T} of selected fake tracks (in GeV)">
+  <x title="p_{T}(GeV/c)" n="200" lo="0." hi="200"/>
+  <y title="Entries"/>
+</h>
+<h id="fakepTlow" type="TH1F" title="p_{T} of selected fake tracks (in GeV)">
+  <x title="p_{T}(GeV/c)" n="200" lo="0" hi="20"/>
+  <y title="Entries"/>
+</h>
+<h id="fakephi" type="TH1F" title="#phi of selected fake tracks">
+  <x title="#phi" n="100" lo="-&PI;" hi="&PI;"/>
+  <y title="Entries"/>
+</h>
+<h id="fakeeta" type="TH1F" title="#eta of selected fake tracks">
+  <x title="#eta" n="100" lo="-5" hi="5"/>
+  <y title="Entries"/>
+</h>
+<h id="faked0" type="TH1F" title="d_{0} of selected fake tracks (in mm)">
+  <x title="d_{0}(mm)" n="200" lo="-5" hi="5"/>
+  <y title="Entries"/>
+</h>
+<h id="fakez0" type="TH1F" title="z_{0} of selected fake tracks (in mm)">
+  <x title="z_{0}(mm)" n="120" lo="-300" hi="300"/>
+  <y title="Entries"/>
+</h>
+<h id="track_fakerate_vs_eta" type="TProfile" title="Fraction of tracks with &lt;50% truth match probability">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Fake Rate" lo="0" hi="1"/>
+</h>
+<h id="track_fakerate_vs_pt" type="TProfile" title="Fraction of tracks with &lt;50% truth match probability">
+  <x title="p_{T}(GeV/c)" n="25" lo="0" hi="50"/>
+  <y title="Fake Rate" lo="0" hi="1"/>
+</h>
+<h id="track_fakerate_vs_phi" type="TProfile" title="Fraction of tracks with &lt;50% truth match probability">
+  <x title="#phi" n="24" lo="-180" hi="180"/>
+  <y title="Fake Rate" lo="0" hi="100"/>
+</h>
+<h id="track_fakerate_vs_d0" type="TProfile" title="Fraction of tracks with &lt;50% truth match probability">
+  <x title="d_{0}" n="20" lo="-6" hi="6"/>
+  <y title="Fake Rate" lo="0" hi="100"/>
+</h>
+<h id="track_fakerate_vs_z0" type="TProfile" title="Fraction of tracks with &lt;50% truth match probability">
+  <x title="z_{0}" n="20" lo="-300" hi="300"/>
+  <y title="Fake Rate" lo="0" hi="100"/>
+</h>
+<!-- -->
+<!-- More fake plots -->
+<h id="fakePtPrimary" type="TProfile" title="Fraction of Linked Primary tracks with &lt;50% truth match probability vs Pt">
+  <x title="Pt (GeV)" n="400" lo="0" hi="200" />
+  <y title="Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="fakeEtaTotal" type="TProfile" title="Fake Rate (primary and secondary)">
+  <x title="#eta" n="40" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="fakeetaPrimary" type="TProfile" title="Fraction of Linked Primary tracks with &lt;50% truth match probability vs #eta">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="fakePhiPrimary" type="TProfile" title="Fraction of Linked Primary tracks with &lt;50% truth match probability vs #phi">
+  <x title="#phi" n="50" lo="-&PI;" hi="&PI;"/>
+  <y title="Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="faked0Primary" type="TProfile" title="Fraction of Linked Primary tracks with &lt;50% truth match probability vs d_{0}">
+  <x title="d_{0}" n="60" lo="-1.5" hi="1.5"/>
+  <y title="Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="fakez0Primary" type="TProfile" title="Fraction of Linked Primary tracks with &lt;50% truth match probability vs z_{0}">
+  <x title="z_{0}" n="50" lo="-200" hi="200"/>
+  <y title="Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="fakePtSecondary" type="TProfile" title="Fraction of Linked Secondary tracks with &lt;50% truth match probability vs Pt">
+  <x title="Pt (GeV)" n="400" lo="0" hi="200" />
+  <y title="Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="fakeetaSecondary" type="TProfile" title="Fraction of Linked Secondary tracks with &lt;50% truth match probability vs #eta">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="fakePhiSecondary" type="TProfile" title="Fraction of Linked Secondary tracks with &lt;50% truth match probability vs #phi">
+  <x title="#phi" n="50" lo="-&PI;" hi="&PI;"/>
+  <y title="Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="faked0Secondary" type="TProfile" title="Fraction of Linked Secondary tracks with &lt;50% truth match probability vs d_{0}">
+  <x title="d_{0}" n="60" lo="-1.5" hi="1.5"/>
+  <y title="Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="fakez0Secondary" type="TProfile" title="Fraction of Linked Secondary tracks with &lt;50% truth match probability vs z_{0}">
+  <x title="z_{0}" n="50" lo="-200" hi="200"/>
+  <y title="Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="fakePtUnlinkedFrac" type="TProfile" title="Fake Rate (unlinked)">
+  <x title="p_{T} [GeV]" n="100" lo="0" hi="2.000"/>
+  <y title="Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="fakeetaUnlinkedFrac" type="TProfile" title="Fake Rate (unlinked)">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="fakePhiUnlinkedFrac" type="TProfile" title="Fake Rate (unlinked)">
+  <x title="#phi" n="50" lo="-&PI;" hi="&PI;"/>
+  <y title="Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="faked0UnlinkedFrac" type="TProfile" title="Fake Rate (unlinked)">
+  <x title="d_{0}" n="60" lo="-1.5" hi="1.5"/>
+  <y title="Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="fakez0UnlinkedFrac" type="TProfile" title="Fake Rate (unlinked)">
+  <x title="z_{0}" n="50" lo="-200" hi="200"/>
+  <y title="Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="incFakeEta" type="TProfile" title="Inclusive Fake Rate #eta">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Inclusive Fake Rate" lo="0" hi="2.0"/>
+</h>
+<h id="incFakePt" type="TProfile" title="Inclusive Fake Rate Pt">
+  <x title="Pt" n="400" lo="0" hi="200"/>
+  <y title="Inclusive Fake Rate" lo="0" hi="2.0"/>
+</h>
+<!-- -->
+<!-- GOOD eff plots -->
+<h id="trackeff_vs_eta" type="TProfile" title="Fraction of reco-matched truth track">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h> 
+<h id="trackeff_vs_pt" type="TProfile" title="Fraction of reco-matched truth track">
+  <x title="Pt (GeV)" n="25" lo="0" hi="50"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="trackeff_vs_phi" type="TProfile" title="Fraction of reco-matched truth track">
+  <x title="#phi" n="25" lo="-&PI;" hi="&PI;"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="trackeff_vs_d0" type="TProfile" title="Fraction of reco-matched truth track">
+  <x title="d0" n="100" lo="-25" hi="25"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="trackeff_vs_z0" type="TProfile" title="Fraction of reco-matched truth track">
+  <x title="z0" n="100" lo="-250" hi="250"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="trackeff_vs_R" type="TProfile" title="Fraction of reco-matched truth track">
+  <x title="R" n="100" lo="0" hi="50"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="trackeff_vs_Z" type="TProfile" title="Fraction of reco-matched truth track">
+  <x title="Z" n="100" lo="-350" hi="350"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="trackeff_vs_prodR" type="TProfile" title="Track Efficiency vs Production Vertex Radius">
+  <x title="prod_R" n="100" lo="0" hi="1500"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="trackeff_vs_prodZ" type="TProfile" title="Track Efficiency vs Production Vertex Z">
+  <x title="prod_Z" n="100" lo="0" hi="2000"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<!-- vertices -->
+<h id="vx_x" type="TH1F" title="X position of vertex">
+  <x title="X (mm)" n="200" lo="-1.0" hi="1.0"/>
+  <y title="Entries"/>
+</h>
+<h id="vx_y" type="TH1F" title="Y position of vertex">
+  <x title="Y (mm)" n="200" lo="-1.0" hi="1.0"/>
+  <y title="Entries"/>
+</h>
+<h id="vx_z" type="TH1F" title="Z position of vertex">
+  <x title="Z (mm)" n="100" lo="-300.0" hi="300.0"/>
+  <y title="Entries"/>
+</h>
+<h id="vx_err_x" type="TH1F" title="X position error of vertex">
+  <x title="#sigma(X) (mm)" n="100" lo="0.0" hi="0.2"/>
+  <y title="Entries"/>
+</h>
+<h id="vx_err_y" type="TH1F" title="Y position error of vertex">
+  <x title="#sigma(Y) (mm)" n="100" lo="0.0" hi="0.2"/>
+  <y title="Entries"/>
+</h>
+<h id="vx_err_z" type="TH1F" title="Z position error of vertex">
+  <x title="#sigma(Z) (mm)" n="100" lo="0.0" hi="1.0"/>
+  <y title="Entries"/>
+</h>
+<h id="vx_chi2_over_ndf" type="TH1F" title="vertex #chi^2 / ndf">
+  <x title="#chi^{2}/ndf" n="50" lo="0" hi="10."/>
+  <y title="Entries"/>
+</h>
+<h id="vx_type" type="TH1F" title="Vertex type">
+  <x title="Vertex type" n="7" lo="0" hi="7"/>
+  <y title="Entries"/>
+</h>
+<h id="vx_nTracks" type="TH1F" title="Number of tracks at vertex">
+  <x title="Number of Tracks" n="150" lo="0" hi="150"/>
+  <y title="Entries"/>
+</h>
+<h id="vx_track_weights" type="TH1F" title="Weights of tracks at vertex">
+  <x title="Weight" n="100" lo="0." hi="10.0"/>
+  <y title="Entries"/>
+</h>
+<h id="vx_track_pt" type="TH1F" title="Tracks at vertex p_{T}">
+  <x title="p_{T} (GeV)" n="100" lo="0" hi="20."/>
+  <y title="Entries"/>
+</h>
+<h id="vx_track_eta" type="TH1F" title="Tracks at vertex #eta">
+  <x title="#eta" n="100" lo="-2.7" hi="2.7"/>
+  <y title="Entries"/>
+</h>
+<h id="vx_track_nSiHits" type="TH1F" title="Tracks at vertex number of Silicon Hits">
+  <x title="Num. Si Hits" n="15" lo="5" hi="20"/>
+  <y title="Entries"/>
+</h>
+<h id="vx_track_nSiHoles" type="TH1F" title="Tracks at vertex number of Silicon Holes">
+  <x title="Num. Si Holes" n="5" lo="0" hi="5"/>
+  <y title="Entries"/>
+</h>
+<h id="vx_track_d0" type="TH1F" title="Tracks at vertex d_{0}">
+  <x title="d_{0} (mm)" n="100" lo="-2.0" hi="2.0"/>
+  <y title="Entries"/>
+</h>
+<h id="vx_track_err_d0" type="TH1F" title="Tracks at vertex d_{0} error">
+  <x title="#sigma(d_{0}) (mm)" n="50" lo="0.0" hi="1.0"/>
+  <y title="Entries"/>
+</h>
+<h id="vx_track_z0" type="TH1F" title="Tracks at vertex z_{0} - z_{0}^{vertex}">
+  <x title="z_{0}-z_{0}^{vertex} (mm)" n="100" lo="-5.0" hi="5.0"/>
+  <y title="Entries"/>
+</h>
+<h id="vx_track_err_z0" type="TH1F" title="Tracks at vertex z_{0} error">
+  <x title="#sigma(z_{0}) (mm)" n="50" lo="0.0" hi="5.0"/>
+  <y title="Entries"/>
+</h>
+<!-- -->
+<!-- Bad Match Rate (BMR) plots -->
+<h id="BadMatchRate" type="TProfile" title="Fraction of Tracks with &lt; 80% Truth Matching Probability">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Bad Match Rate" lo="0.0" hi="2.0" />
+</h>
+<h id="ReallyFakeRate" type="TProfile" title="Fraction of Tracks with &lt; 20% Truth Matching Probability">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Fake Rate" lo="0.0" hi="2.0" />
+</h>
+<h id="BadMatchRate_vs_logpt" type="TProfile" title="Fraction of Tracks with &lt; 80% TMP vs Log(Pt)">
+  <x title="Log(Pt)" n="10" lo="-0.5" hi="2" />
+  <y title="Bad Match Rate" lo="0.0" hi="2.0" />
+</h>
+<!-- -->
+<!-- Track Parameter Resolution Plots -->
+<!-- Track Parameter TH2s vs eta -->
+<h id="res_d0_vs_eta" type="TH2" title="d_{0}: deviation vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="d_{0}^{rec} - d_{0}^{tru}" n="2000" lo="-1.0" hi="1.0"/>
+</h>
+<h id="res_z0_vs_eta" type="TH2" title="z_{0}: deviation vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="z_{0}^{rec} - z_{0}^{tru}" n="200" lo="-1.5" hi="1.5"/>
+</h>
+<h id="res_phi_vs_eta" type="TH2" title="#phi: deviation vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#phi^{rec} - #phi^{tru}" n="3000" lo="-0.03" hi="0.03"/>
+</h>
+<h id="res_theta_vs_eta" type="TH2" title="#theta: deviation vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#theta^{rec} - #theta^{tru}" n="2000" lo="-0.1" hi="0.1"/>
+</h>
+<h id="res_z0*sin(theta)_vs_eta" type="TH2" title="z0*sin(#theta): deviation vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru}" n="200" lo="-1.5" hi="1.5"/>
+</h>
+<h id="res_qopt_vs_eta" type="TH2" title="q/pt: deviation vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="(q/pt)^{rec} - (q/pt)^{tru}" n="200" lo="-0.4" hi="0.4"/>
+</h>
+<!-- Track Parameter Means vs eta -->
+<h id="resmean_d0_vs_eta" type="TH1F" title="d_{0} Track Measurement Bias vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="d_{0}^{rec} - d_{0}^{tru}"/>
+</h> 
+<h id="resmean_z0_vs_eta" type="TH1F" title="z_{0} Track Measurement Bias vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="z_{0}^{rec} - z_{0}^{tru}"/>
+</h>
+<h id="resmean_phi_vs_eta" type="TH1F" title="#phi Track Measurement Bias vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#phi^{rec} - #phi^{tru}"/>
+</h>
+<h id="resmean_theta_vs_eta" type="TH1F" title="#theta Track Measurement Bias vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#theta^{rec} - #theta^{tru}"/>
+</h>
+<h id="resmean_z0*sin(theta)_vs_eta" type="TH1F" title="z_{0}*sin(#theta) Track Measurement Bias vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru}"/>
+</h>
+<h id="resmean_qopt_vs_eta" type="TH1F" title="q/pt Track Measurement Bias vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="(q/pt)^{rec} - (q/pt)^{tru}"/>
+</h>
+<!-- Track Parameter Resolutions vs eta -->
+<h id="reswidth_d0_vs_eta" type="TH1F" title="d_{0} Track Resolution vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#sigma(d_{0}^{rec} - d_{0}^{tru})"/>
+</h>
+<h id="reswidth_z0_vs_eta" type="TH1F" title="z_{0} Track Resolution vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#sigma(z_{0}^{rec} - z_{0}^{tru})"/>
+</h>
+<h id="reswidth_phi_vs_eta" type="TH1F" title="#phi Track Resolution vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#sigma(#phi^{rec} - #phi^{tru})"/>
+</h>
+<h id="reswidth_theta_vs_eta" type="TH1F" title="#theta Track Resolution vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#sigma(#theta^{rec} - #theta^{tru})"/>
+</h>
+<h id="reswidth_z0*sin(theta)_vs_eta" type="TH1F" title="z_{0}*sin(#theta) Track Resolution vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#sigma(z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru})"/>
+</h>
+<h id="reswidth_qopt_vs_eta" type="TH1F" title="q/pt Track Resolution vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#sigma((q/pt)^{rec} - (q/pt)^{tru})"/>
+</h>
+<!-- Track Parameter TH2s vs Log(Pt) -->
+<h id="res_d0_vs_pt" type="TH2" title="d_{0}: deviation vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="d_{0}^{rec} - d_{0}^{tru}" n="2000" lo="-1.0" hi="1.0"/>
+</h>
+<h id="res_z0_vs_pt" type="TH2" title="z_{0}: deviation vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="z_{0}^{rec} - z_{0}^{tru}" n="200" lo="-1.5" hi="1.5"/>
+</h>
+<h id="res_phi_vs_pt" type="TH2" title="#phi: deviation vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="#phi^{rec} - #phi^{tru}" n="3000" lo="-0.03" hi="0.03"/>
+</h>
+<h id="res_theta_vs_pt" type="TH2" title="#theta: deviation vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="#theta^{rec} - #theta^{tru}" n="2000" lo="-0.1" hi="0.1"/>
+</h>
+<h id="res_z0*sin(theta)_vs_pt" type="TH2" title="z_{0}*sin(#theta): deviation vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru}" n="200" lo="-1.5" hi="1.5"/>
+</h>
+<h id="res_qopt_vs_pt" type="TH2" title="q/pt: deviation vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="(q/pt)^{rec} - (q/pt)^{tru}" n="200" lo="-0.4" hi="0.4"/>
+</h>
+<!-- Track Parameter Means vs log(Pt) -->
+<h id="resmean_d0_vs_pt" type="TH1F" title="d_{0} Track Measurement Bias vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="d_{0}^{rec} - d_{0}^{tru}"/>
+</h>
+<h id="resmean_z0_vs_pt" type="TH1F" title="z_{0} Track Measurement Bias vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="z_{0}^{rec} - z_{0}^{tru}"/>
+</h>
+<h id="resmean_phi_vs_pt" type="TH1F" title="#phi Track Measurement Bias vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="#phi^{rec} - #phi^{tru}"/>
+</h>
+<h id="resmean_theta_vs_pt" type="TH1F" title="#theta Track Measurement Bias vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="#theta^{rec} - #theta^{tru}"/>
+</h>
+<h id="resmean_z0*sin(theta)_vs_pt" type="TH1F" title="z_{0}*sin(#theta) Track Measurement Bias vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru}"/>
+</h>
+<h id="resmean_qopt_vs_pt" type="TH1F" title="q/pt Track Measurement Bias vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="(q/pt)^{rec} - (q/pt)^{tru}"/>
+</h>
+<!-- Track Parameter Resolutions vs log(Pt) -->
+<h id="reswidth_d0_vs_pt" type="TH1F" title="d_{0} Track Resolution vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="#sigma(d_{0}^{rec} - d_{0}^{tru})"/>
+</h>
+<h id="reswidth_z0_vs_pt" type="TH1F" title="z_{0} Track Resolution vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="#sigma(z_{0}^{rec} - z_{0}^{tru})"/>
+</h>
+<h id="reswidth_phi_vs_pt" type="TH1F" title="#phi Track Resolution vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="#sigma(#phi^{rec} - #phi^{tru})"/>
+</h>
+<h id="reswidth_theta_vs_pt" type="TH1F" title="#theta Track Resolution vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="#sigma(#theta^{rec} - #theta^{tru})"/>
+</h>
+<h id="reswidth_z0*sin(theta)_vs_pt" type="TH1F" title="z_{0}*sin(#theta) Track Resolution vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="#sigma(z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru})"/>
+</h>
+<h id="reswidth_qopt_vs_pt" type="TH1F" title="q/pt Track Resolution vs log(Pt)">
+  <x title="log(Pt) (GeV)" n="10" lo="-0.5" hi="2.0"/>
+  <y title="#sigma((q/pt)^{rec} - (q/pt)^{tru})"/>
+</h>
+<!-- Basic Track Pulls -->
+<h id="pull_d0" type="TH1F" title="Pull of d_{0}">
+  <x title="pull" n="200" lo="-5.0" hi="5.0"/>
+  <y title="counts"/>
+</h>
+<h id="pull_z0" type="TH1F" title="Pull of z_{0}">
+  <x title="pull" n="200" lo="-5.0" hi="5.0"/>
+  <y title="counts"/>
+</h>
+<h id="pull_phi" type="TH1F" title="Pull of #phi">
+  <x title="pull" n="200" lo="-5.0" hi="5.0"/>
+  <y title="counts"/>
+</h>
+<h id="pull_theta" type="TH1F" title="Pull of #theta">
+  <x title="pull" n="200" lo="-5.0" hi="5.0"/>
+  <y title="counts"/>
+</h>
+<h id="pull_z0_sin_theta" type="TH1F" title="Pull of z0*sin(#theta)">
+  <x title="pull" n="200" lo="-5.0" hi="5.0"/>
+  <y title="counts"/>
+</h>
+<h id="pull_qopt" type="TH1F" title="Pull of qopt">
+  <x title="pull" n="200" lo="-5.0" hi="5.0"/>
+  <y title="counts"/>
+</h>
+<!-- Track Pull TH2s vs eta -->
+<h id="pull_d0_vs_eta" type="TH2" title="d_{0}: Pull vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="(d_{0}^{rec} - d_{0}^{tru})/#sigma_d_0" n="200" lo="-5.0" hi="5.0"/>
+</h>
+<h id="pull_z0_vs_eta" type="TH2" title="z0: Pull vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="(z_{0}^{rec} - z_{0}^{tru})/#sigma_z_0" n="200" lo="-5.0" hi="5.0"/>
+</h>
+<h id="pull_phi_vs_eta" type="TH2" title="#phi: Pull vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="(#phi^{rec} - #phi^{tru})/#sigma_#phi" n="200" lo="-5.0" hi="5.0"/>
+</h>
+<h id="pull_theta_vs_eta" type="TH2" title="#theta: Pull vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="(#theta^{rec} - #theta^{tru})/#sigma_#theta" n="200" lo="-5.0" hi="5.0"/>
+</h>
+<h id="pull_z0*sin(theta)_vs_eta" type="TH2" title="z0*sin(theta): Pull vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="(z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru})/#sigma_z_{0}*sin(#theta)" n="200" lo="-5.0" hi="5.0"/>
+</h>
+<h id="pull_qopt_vs_eta" type="TH2" title="q/pt: Pull vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="((q/pt)^{rec} - (q/pt)^{tru})/#sigma_(q/pt)" n="200" lo="-5.0" hi="5.0"/>
+</h>
+<!-- Track Pull Means vs eta -->
+<h id="pullmean_d0_vs_eta" type="TH1F" title="d_{0} Track Pull Mean vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="d_{0}^{rec} - d_{0}^{tru}"/>
+</h>
+<h id="pullmean_z0_vs_eta" type="TH1F" title="z_{0} Track Pull Mean vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="z_{0}^{rec} - z_{0}^{tru}"/>
+</h>
+<h id="pullmean_phi_vs_eta" type="TH1F" title="#phi Track Pull Mean vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#phi^{rec} - #phi^{tru}"/>
+</h>
+<h id="pullmean_theta_vs_eta" type="TH1F" title="#theta Track Pull Mean vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#theta^{rec} - #theta^{tru}"/>
+</h>
+<h id="pullmean_z0*sin(theta)_vs_eta" type="TH1F" title="z_{0}*sin(#theta) Track Pull Mean vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru}"/>
+</h>
+<h id="pullmean_qopt_vs_eta" type="TH1F" title="q/pt Track Pull Mean vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="(q/pt)^{rec} - (q/pt)^{tru}"/>
+</h>
+<!-- Track Pull Resolutions vs eta -->
+<h id="pullwidth_d0_vs_eta" type="TH1F" title="d_{0} Track Pull Resolution vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#sigma(d_{0}^{rec} - d_{0}^{tru})"/>
+</h>
+<h id="pullwidth_z0_vs_eta" type="TH1F" title="z_{0} Track Pull Resolution vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#sigma(z_{0}^{rec} - z_{0}^{tru})"/>
+</h>
+<h id="pullwidth_phi_vs_eta" type="TH1F" title="#phi Track Pull Resolution vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#sigma(#phi^{rec} - #phi^{tru})"/>
+</h>
+<h id="pullwidth_theta_vs_eta" type="TH1F" title="#theta Track Pull Resolution vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#sigma(#theta^{rec} - #theta^{tru})"/>
+</h>
+<h id="pullwidth_z0*sin(theta)_vs_eta" type="TH1F" title="z_{0}*sin(#theta) Track Pull Resolution vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#sigma(z_{0}*sin(#theta)^{rec} - z_{0}*sin(#theta)^{tru})"/>
+</h>
+<h id="pullwidth_qopt_vs_eta" type="TH1F" title="q/pt Track Pull Resolution vs #eta">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="#sigma((q/pt)^{rec} - (q/pt)^{tru})"/>
+</h>
+
+
+<!-- TrackInJets -->
+<h id="recInJetpT" type="TH1F" title="p_{T} of selected rec tracks in jets(in GeV)">
+  <x title="p_{T}(GeV/c)" n="200" lo="0." hi="200"/>
+  <y title="Entries"/>
+</h>
+<h id="nTrackInJet" type="TH1F" title="Number of Tracks in Jet">
+  <x title="N Tracks" n="50" lo="0." hi="50"/>
+  <y title="Entries"/>
+</h>
+<h id="sumPtinJet" type="TH1F" title="Sum p_{T} of Tracks in Jet">
+  <x title="sum p_{T}(GeV/c)" n="25" lo="0" hi="500"/>
+  <y title="Entries"/>
+</h>
+<h id="fracPtInJet" type="TH1F" title="Sum p_{T} of Tracks over jet p_{T}">
+  <x title="sum Track p_{T}/jet p_{T}" n="60" lo="0" hi="3"/>
+  <y title="Entries"/>
+</h>
+
+
+
+<!-- HitContent plots -->
+<h id="HitContent_vs_eta_NBlayerHits" type="TProfile" title="Number of B-Layer clusters">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of B-layer clusters&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NPixelHits" type="TProfile" title="Number of Pixel clusters">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of Pixel clusters&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_DBMHitsNeg" type="TProfile" title="Number of DBM Clusters">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of DBM clusters, - side&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_DBMHitsPos" type="TProfile" title="Number of DBM Clusters">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of DBM Clusters, + side&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NPixelHoles" type="TProfile" title="Number of Pixel Holes">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of Pixel Holes&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NSCTHits" type="TProfile" title="Number of SCT Clusters">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of SCT Clusters&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NSCTHoles" type="TProfile" title="Number of SCT Holes">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of SCT Holes&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NTRTHits" type="TProfile" title="Number of TRT Clusters">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of TRT Hits&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NTRTHighThresholdHits" type="TProfile" title="Number of TRT high threshold clusters">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of High Thresh TRT Hits&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NBlayerOutliers" type="TProfile" title="Number of B-layer outliers">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of B-layer Outliers&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NBlayerSharedHits" type="TProfile" title="Number of shared B-layer clusters">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of B-layer Shared Hits&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NBLayerSplitHits" type="TProfile" title="Number of split B-layer clusters">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of B-layer Split Hits&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NPixelOutliers" type="TProfile" title="Number of Pixel outliers">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of Pixel Outliers&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NPixelContribLayers" type="TProfile" title="Number of contributed Pixel layers">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of Pixel Layers&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NPixelSharedHits" type="TProfile" title="Number of shared Pixel clusters">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of Pixel Shared Hits&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NPixelSplitHits" type="TProfile" title="Number of split Pixel clusters">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of Pixel Split Hits&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NPixelGangedHits" type="TProfile" title="Number of ganged Pixel clusters">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of Pixel Ganged Hits&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NPixelGangedHitsFlaggedFakes" type="TProfile" title="Number of ganged flagged fake Pixel hits vs eta">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;" />
+  <y title="Flagged Fakes in Pixel" lo="0" hi="2" />
+</h>
+<h id="HitContent_vs_eta_NSCTOutliers" type="TProfile" title="Number of SCT Outliers">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of SCT Outliers&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NSCTDoubleHoles" type="TProfile" title="Number of SCT double holes">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of SCT Double Holes&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NSCTSharedHits" type="TProfile" title="Number of SCT Shared clusters">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of SCT Shared Hits&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NTRTOutliers" type="TProfile" title="Number of TRT outliers">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of TRT Outliers&gt;" lo="0" hi="100"/>
+</h>
+<h id="HitContent_vs_eta_NTRTHighThresholdOutliers" type="TProfile" title="Number of TRT High Threshold outliers">
+  <x title="#eta" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="&lt;Number of TRT High Thresh Outliers&gt;" lo="0" hi="100"/>
+</h>
+<!-- -->
+<!-- Track in Jet efficiencies -->
+<h id="trackinjeteff_vs_eta" type="TProfile" title="Track in jets efficiency vs #eta (Det. Paper def.)">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="trackinjeteff_vs_phi" type="TProfile" title="Track in jets efficiency vs #phi (Det. Paper def.)">
+  <x title="#eta" n="24" lo="-1.5708" hi="1.5708"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="trackinjeteff_vs_pt" type="TProfile" title="Track in jets efficiency vs p_{T} for |#eta| &lt; &ETA; (Det. Paper def.)">
+  <x title="p_{T} (GeV/c)" n="25" lo="0" hi="50"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="trackinjeteff_vs_dr" type="TProfile" title="Track in jets efficiency vs #DeltaR for |#eta| &lt; &ETA; (Det. Paper def.)">
+  <x title="#DeltaR" n="10" lo="0.0" hi="0.4"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="trackinjeteff_vs_dr_lt_j50" type="TProfile" title="Track in jets efficiency vs #DeltaR for |#eta| &lt; &ETA; (E_{T}(jet) &lt; 50 GeV)">
+  <x title="#DeltaR" n="10" lo="0.0" hi="0.2"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="trackinjeteff_vs_dr_gr_j100" type="TProfile" title="Track in jets efficiency vs #DeltaR for |#eta| &lt; &ETA; (E_{T}(jet) &gt; 100 GeV)">
+  <x title="#DeltaR" n="10" lo="0.0" hi="0.2"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="trackinjeteff_vs_jetet" type="TProfile" title="Track in jets efficiency vs jet E_{T} for |#eta| &lt; &ETA; ">
+  <x title="E_{jet} (GeV)" n="10" lo="0.0" hi="250"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<!-- -->
+<!-- Track in Jet Bad Match Rates -->
+<h id="trackinjet_badmatchrate_vs_dr_gr_j100" type="TProfile" title="Fraction of tracks with &lt; 80% truth matching probability in Jets with E_{T} &gt; 100 GeV">
+  <x title="#DeltaR" n="10" lo="0.0" hi="0.2"/>
+  <y title="Bad Match Rate" lo="0.0" hi="2.0"/>
+</h>
+<!-- -->
+<!-- Unsorted : todo: sort -->
+<h id="incFakevsTracks" type="TProfile" title="Selected Reco Tracks / Selected Truth Tracks vs # of reco tracks">
+  <x title="tracks" n="200" lo="0" hi="2000"/>
+  <y title="Inclusive Fake Rate" lo="0" hi="2"/>
+</h>
+<h id="selectedTracks_vs_nTracks" type="TH2F" title="Selected Reco Tracks vs # Reco Tracks ">
+  <x title="Reco Tracks" n="200" lo="0" hi="2000"/>
+  <y title="Selected Reco Tracks" n="80" lo="0" hi="1600"/>
+</h>
+<h id="nSCTHits_phi_vs_eta" type="TH2F" title="# SCT hits phi vs Eta">
+  <x title="#etaphi" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="# SCT Hits" n="60" lo="-3" hi="3"/>
+</h>
+<h id="nPixHits_phi_vs_eta" type="TH2F" title="# Pix hits phi vs Eta">
+  <x title="#etaphi" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="# Pix Hits" n="60" lo="-3" hi="3"/>
+</h>
+<h id="nTotHits_phi_vs_eta" type="TH2F" title="# total hits phi vs Eta">
+  <x title="#etaphi" n="80" lo="-&ETA;" hi="&ETA;"/>
+  <y title="# total Hits" n="60" lo="-3" hi="3"/>
+</h>
+<h id="recoMatchProbabilitySpectrumUNLINKED" type="TH1F" title="truth match probability spectrum">
+  <x title="truth match probability" n="110" lo="0." hi="1.1"/>
+  <y title="Entries"/>
+</h>
+<h id="recoMatchProbabilitySpectrumLINKED" type="TH1F" title="truth match probability spectrum">
+  <x title="truth match probability" n="110" lo="0." hi="1.1"/>
+  <y title="Entries"/>
+</h>
+<h id="recoMatchvsSiHitsUNLINKED_postSelect" type="TH2F" title="truth match probability vs Silicon hits (UNLINKED)">
+  <x title="Si Hits" n="25" lo="0" hi="25"/>
+  <y title="truth match probability" n="40" lo="0" hi="1.1"/>
+</h>
+<h id="recoMatchvsSCTHitsUNLINKED_postSelect" type="TH2F" title="truth match probability vs SCT hits (UNLINKED)">
+  <x title="SCT Hits" n="25" lo="0" hi="25"/>
+  <y title="truth match probability" n="40" lo="0" hi="1.1"/>
+</h>
+<h id="recoMatchvsPixHitsUNLINKED_postSelect" type="TH2F" title="truth match probability vs Pixel hits (UNLINKED)">
+  <x title="Pixel Hits" n="25" lo="0" hi="25"/>
+  <y title="truth match probability" n="40" lo="0" hi="1.1"/>
+</h>
+<h id="recoMatchvsSiHitsLINKED_postSelect" type="TH2F" title="truth match probability vs Silicon hits (LINKED)">
+  <x title="Si Hits" n="25" lo="0" hi="25"/>
+  <y title="truth match probability" n="40" lo="0" hi="1.1"/>
+</h>
+<h id="recoMatchvsSCTHitsLINKED_postSelect" type="TH2F" title="truth match probability vs SCT hits (LINKED)">
+  <x title="SCT Hits" n="25" lo="0" hi="25"/>
+  <y title="truth match probability" n="40" lo="0" hi="1.1"/>
+</h>
+<h id="recoMatchvsPixHitsLINKED_postSelect" type="TH2F" title="truth match probability vs Pixel hits (LINKED)">
+  <x title="Pixel Hits" n="25" lo="0" hi="25"/>
+  <y title="truth match probability" n="40" lo="0" hi="1.1"/>
+</h>
+<!-- -->
+<!-- stuff pilfered from old backtracking script -->
+<h id="eff_vs_eta_of_daughters" type="TProfile" title="Efficiency vs #eta of daughter particles">
+  <x title="#eta" n="20" lo="-&ETA;" hi="&ETA;"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="eff_vs_theta_of_daughters" type="TProfile" title="Efficiency vs #theta of daughter particles">
+  <x title="#theta" n="28" lo="0.0" hi="&PI;"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="eff_vs_theta_tan_of_daughters" type="TProfile" title="Efficiency vs tan(#theta) of daughter particles">
+  <x title="tan(#theta)" n="32" lo="-8" hi="8"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="eff_vs_theta_cotan_of_daughters" type="TProfile" title="Efficiency vs cotan(#theta) of daughter particles">
+  <x title="cotan(#theta)" n="32" lo="-8" hi="8"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="eff_vs_phi_of_daughters" type="TProfile" title="Efficiency vs #phi of daughter particles">
+  <x title="#phi" n="16" lo="-&PI;" hi="&PI;"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="eff_vs_phi_sin_of_daughters" type="TProfile" title="Efficiency vs sin(#phi) of daughter particles">
+  <x title="sin(#phi)" n="14" lo="-1.2" hi="1.2"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
+<h id="eff_vs_phi_cos_of_daughters" type="TProfile" title="Efficiency vs cos(#phi) of daughter particles">
+  <x title="cos(#phi)" n="14" lo="-1.2" hi="1.2"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefITK.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefITK.xml
new file mode 100644
index 0000000000000000000000000000000000000000..92be7d8c91b8b7094aca9597f4c7fce3fce7a3c0
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefITK.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" media="screen" href="hdefhtml.xsl"?>
+<?xml-stylesheet type="text/xsl" media="tty" href="hdeftty.xsl" alternate="yes"?>
+<!DOCTYPE  hdef [
+<!ENTITY PI "3.1415926">
+<!ENTITY ETA "4.0">
+<!ENTITY ETAPixECMin "1.5">
+<!ENTITY ETASct "2.5">
+<!ENTITY ETASctECMin "1.0">
+<!ENTITY Common SYSTEM "InDetPVMPlotDefCommon.xml">
+]>
+
+<hdef xmlns:xi="http://www.w3.org/2001/XInclude">
+  <!-- Plots common to Run2 and ITK -->
+  &Common;
+  <!-- ITK-specific plots -->
+</hdef>
+
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefRun2.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefRun2.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ac3fdb6f5b1ed027c7a82061340608473e00eb82
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPVMPlotDefRun2.xml
@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/xsl" media="screen" href="hdefhtml.xsl"?>
+<?xml-stylesheet type="text/xsl" media="tty" href="hdeftty.xsl" alternate="yes"?>
+<!DOCTYPE  hdef [
+<!ENTITY PI "3.1415926">
+<!ENTITY ETA "2.5">
+<!ENTITY ETAPixECMin "1.5">
+<!ENTITY ETASct "2.0">
+<!ENTITY ETASctECMin "1.0">
+<!ENTITY Common SYSTEM "InDetPVMPlotDefCommon.xml">
+]>
+
+<hdef xmlns:xi="http://www.w3.org/2001/XInclude">
+  <!-- Plots common to Run2 and ITK -->
+  &Common;
+  <!-- Run2-specific plots -->
+  <!--
+     =======================================================
+     hit residuals:
+     =======================================================
+    -->
+  <!-- x residuals -->
+  <!-- barrel-->
+  <h id="residualx_ibl_barrel" type="TH1F" title="Residual: IBL Barrel X">
+    <x title="x residual(#mum)" n="120" lo="-50" hi="50"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualx_ibl_barrel_1hit" type="TH1F" title="Residual: IBL Barrel X 1 hit">
+    <x title="x residual(#mum)" n="120" lo="-50" hi="50"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualx_ibl_barrel_2ormorehits" type="TH1F" title="Residual: IBL Barrel X &gt;=2 hits">
+    <x title="x residual(#mum)" n="120" lo="-50" hi="50"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualx_trt_barrel" type="TH1F" title="Residual: TRT Barrel X">
+    <x title="x residual(#mum)" n="200" lo="-500" hi="500"/> 
+    <y title="Entries"/>
+  </h>
+  <!-- endcap-->
+  <h id="residualx_blayer_endcap" type="TH1F" title="Residual: B-Layer Endcap X">
+    <x title="x residual(#mum)" n="120" lo="-3000" hi="3000"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualx_blayer_endcap_1hit" type="TH1F" title="Residual: B-Layer Endcap X 1 hit">
+    <x title="x residual(#mum)" n="120" lo="-3000" hi="3000"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualx_blayer_endcap_2ormorehits" type="TH1F" title="Residual: B-Layer Endcap X &gt;=2 hits">
+    <x title="x residual(#mum)" n="120" lo="-3000" hi="3000"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualx_trt_endcap" type="TH1F" title="Residual: TRT Endcap X">
+    <x title="x residual(#mum)" n="200" lo="-500" hi="500"/> 
+    <y title="Entries"/>
+  </h>
+  <h id="residualx_dbm_neg" type="TH1F" title="Residual: DBM -side X">
+    <x title="x residual(#mum)" n="120" lo="-3000" hi="3000"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualx_dbm_pos" type="TH1F" title="Residual: DBM +side X">
+    <x title="x residual(#mum)" n="120" lo="-3000" hi="3000"/>
+    <y title="Entries"/>
+  </h>
+  <!-- y residuals -->
+  <!-- barrel -->
+  <h id="residualy_ibl_barrel" type="TH1F" title="Residual: IBL Barrel Y">
+    <x title="y residual(#mum)" n="120" lo="-50" hi="50"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualy_ibl_barrel_1hit" type="TH1F" title="Residual: IBL Barrel Y 1 hit">
+    <x title="y residual(#mum)" n="120" lo="-50" hi="50"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualy_ibl_barrel_2ormorehits" type="TH1F" title="Residual: IBL Barrel Y &gt;=2 hits">
+    <x title="y residual(#mum)" n="120" lo="-50" hi="50"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualy_trt_barrel" type="TH1F" title="Residual: TRT Barrel Y">
+    <x title="y residual(#mum)" n="120" lo="0" hi="2500"/>
+    <y title="Entries"/>
+  </h>
+  <!-- endcaps -->
+  <h id="residualy_sct_endcap" type="TH1F" title="Residual: SCT Endcap Y">
+    <x title="y residual(#mum)" n="120" lo="-50" hi="50"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualy_sct_endcap_1hit" type="TH1F" title="Residual: SCT Endcap Y 1 hit">
+    <x title="y residual(#mum)" n="120" lo="-50" hi="50"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualy_sct_endcap_2ormorehits" type="TH1F" title="Residual: SCT Endcap Y &gt;=2 hits">
+    <x title="y residual(#mum)" n="120" lo="-50" hi="50"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualy_blayer_endcap" type="TH1F" title="Residual: B-Layer Endcap Y">
+    <x title="y residual(#mum)" n="120" lo="-50" hi="50"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualy_blayer_endcap_1hit" type="TH1F" title="Residual: B-Layer Endcap Y 1 hit">
+    <x title="y residual(#mum)" n="120" lo="-50" hi="50"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualy_blayer_endcap_2ormorehits" type="TH1F" title="Residual: B-Layer Endcap Y &gt;=2 hits">
+    <x title="y residual(#mum)" n="120" lo="-50" hi="50"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualy_trt_endcap" type="TH1F" title="Residual: TRT Endcap Y">
+    <x title="y residual(#mum)" n="120" lo="-50" hi="50"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualy_dbm_neg" type="TH1F" title="Residual: DBM -side Y">
+    <x title="y residual(#mum)" n="10" lo="-5" hi="5"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualy_dbm_pos" type="TH1F" title="Residual: DBM +side Y">
+    <x title="y residual(#mum)" n="10" lo="-5" hi="5"/>
+    <y title="Entries"/>
+  </h>
+  <!-- pulls -->
+  <!-- barrel, x -->
+  <h id="residualpullx_ibl_barrel" type="TH1F" title="Residualpull: B-Layer Barrel X">
+    <x title="x residual(#mum)" n="100" lo="-5" hi="5"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualpullx_trt_barrel" type="TH1F" title="Residualpull: TRT Barrel X">
+    <x title="x residual(#mum)" n="100" lo="-5" hi="5"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualpullx_dbm_barrel" type="TH1F" title="Residualpull: DBM -side X">
+    <x title="x residual(#mum)" n="100" lo="-5" hi="5"/>
+    <y title="Entries"/>
+  </h>
+  <!-- endcap, x -->
+  <h id="residualpullx_ibl_endcap" type="TH1F" title="Residualpull: B-Layer Endcap X">
+    <x title="x residual(#mum)" n="100" lo="-5" hi="5"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualpullx_trt_endcap" type="TH1F" title="Residualpull: TRT Endcap X">
+    <x title="x residual(#mum)" n="100" lo="-5" hi="5"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualpullx_dbm_endcap" type="TH1F" title="Residualpull: DBM +side X">
+    <x title="x residual(#mum)" n="100" lo="-5" hi="5"/>
+    <y title="Entries"/>
+  </h>
+  <!-- barrel, y -->
+  <h id="residualpully_ibl_barrel" type="TH1F" title="Residualpull: B-Layer Barrel Y">
+    <x title="y residual(#mum)" n="100" lo="-5" hi="5"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualpully_trt_barrel" type="TH1F" title="Residualpull: TRT Barrel Y">
+    <x title="y residual(#mum)" n="10" lo="-5" hi="5"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualpully_dbm_barrel" type="TH1F" title="Residualpull: DBM -side Y">
+    <x title="y residual(#mum)" n="100" lo="-5" hi="5"/>
+    <y title="Entries"/>
+  </h>
+  <!-- endcap,y -->
+  <h id="residualpully_ibl_endcap" type="TH1F" title="Residualpull: B-Layer Endcap Y">
+    <x title="y residual(#mum)" n="100" lo="-5" hi="5"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualpully_trt_endcap" type="TH1F" title="Residualpull: TRT Endcap Y">
+    <x title="y residual(#mum)" n="10" lo="-5" hi="5"/>
+    <y title="Entries"/>
+  </h>
+  <h id="residualpully_dbm_endcap" type="TH1F" title="Residualpull: DBM +side Y">
+    <x title="y residual(#mum)" n="100" lo="-5" hi="5"/>
+    <y title="Entries"/>
+  </h>
+  <!--
+     =======================================================
+     end of hit residuals plots
+     ========================================================
+    -->
+  <!--
+     =======================================================
+     hit efficiency plots: 
+     ========================================================
+    -->
+  <h id="eff_hit_vs_eta_trt_barrel" type="TProfile" title="Cluster Efficiency: TRT Barrel">
+    <x title="#eta" n="5" lo="0" hi="1.25"/>
+    <y title="Cluster Efficiency" lo="0" hi="2.0"/>
+  </h>
+  <h id="eff_hit_vs_eta_trt_endcap" type="TProfile" title="Cluster Efficiency: TRT Endcaps">
+    <x title="#eta" n="6" lo="0.75" hi="2.25"/>
+    <y title="Cluster Efficiency" lo="0" hi="2.0"/>
+  </h>
+  <!--
+     =======================================================
+     end of hit efficiency plots
+     ======================================================
+    -->
+</hdef>
+
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPhysValMonitoringPlotDefinitions.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPhysValMonitoringPlotDefinitions.xml
index 73a31913151c43664996c41057a6a9ea34a8cc25..814e8d55f57071db5df9e87d20c9405b8f39d419 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPhysValMonitoringPlotDefinitions.xml
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/InDetPhysValMonitoringPlotDefinitions.xml
@@ -160,6 +160,10 @@
 <!--  -->
 
 <!-- More fake plots -->
+<h id="fakeEtaTotal" type="TProfile" title="Fraction of Linked Primary or Secondary tracks with &lt;50% truth match probability vs Eta">
+  <x title="#eta" n="20" lo="-2.5" hi="2.5"/>
+  <y title="Fraction" lo="0.0" hi="2.0"/>
+</h>
 <h id="fakePtPrimary" type="TProfile" title="Fraction of Linked Primary tracks with &lt;50% truth match probability vs Pt">
   <x title="Pt (GeV)" n="400" lo="0" hi="200" />
   <y title="Fake Rate" lo="0" hi="2.0"/>
@@ -272,7 +276,10 @@
   <x title="prod_Z" n="100" lo="0" hi="2000"/>
   <y title="Efficiency" lo="0.0" hi="2.0"/>
 </h>
-
+<h id="low_Pt_lepton_frac" type="TProfile" title="Fraction of Primary Leptons with Pt below 3 GeV">
+  <x title="prod_R" n="100" lo="0" hi="1500"/>
+  <y title="Efficiency" lo="0.0" hi="2.0"/>
+</h>
 
 <!-- Layer-by-Layer Efficiencies -->
 <h id="eff_hit_vs_eta_ibl_barrel" type="TProfile" title="Cluster Efficiency: Pixel Barrel IBL">
@@ -1445,6 +1452,19 @@
   <x title="TrVtxZ" n="500" lo="-250." hi="250."/>
   <y title="Entries"/>
 </h>
+<h id="TVR_vs_Z" type="TH2F" title="Truth Vtx R vs Z">
+  <x title="TrVtxR" n="500" lo="0.0" hi="0.5"/>
+  <y title="TrVtxZ" n="500" lo="-250." hi="250."/>
+</h>
+<h id="recod0_vs_z0_good" type="TH2F" title="Reco d0 vs z0 good">
+  <x title="Reco d0" n="200" lo="-10." hi="10."/>
+  <y title="Reco z0" n="200" lo="-10." hi="10."/>
+</h>
+<h id="recod0_vs_z0_crazy" type="TH2F" title="Reco d0 vs z0 crazy">
+  <x title="Reco d0" n="200" lo="-10." hi="10."/>
+  <y title="Reco z0" n="200" lo="-10." hi="10."/>
+</h>
+
 <h id="recod0PVRSpectrum" type="TH1F" title="reco d0-PrimVtxR spectrum">
   <x title="d0-PrVtR" n="200" lo="-10." hi="10."/>
   <y title="Entries"/>
@@ -1473,6 +1493,10 @@
   <x title="PrVtxZ" n="500" lo="-250." hi="250."/>
   <y title="Entries"/>
 </h>
+<h id="PVR_vs_Z" type="TH2F" title="PrimVtx R vs Z">
+  <x title="PrVtxZ" n="500" lo="-250." hi="250."/>
+  <y title="PrVtxR" n="100" lo="0.0" hi="0.25"/>
+</h>
 <!-- -->
 
 <!-- stuff pilfered from old backtracking script -->
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/LargeD0PlotDefinitions.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/LargeD0PlotDefinitions.xml
index 994e1e7746a323f5e079b70fb331868339e2b7dd..de50ee5f6bc6a33d6b2909865029d83d5a8fe1ad 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/LargeD0PlotDefinitions.xml
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/LargeD0PlotDefinitions.xml
@@ -23,118 +23,298 @@
 </h>
 <!--  -->
 <!-- testing TRT extensions -->
+
+<h id="mu" type="TH1F" title="#mu">
+  <x title="#mu" n="60" lo="0" hi="60"/>
+  <y title="Entries"/>
+</h>
+<h id="nPV" type="TH1F" title="number of primary vertices">
+  <x title="nPV" n="60" lo="0" hi="60"/>
+  <y title="Entries"/>
+</h>
 <h id="matchProb" type="TH1F" title="Matching Probability">
-  <x title="Matching Probability" n="50" lo="0" hi="1"/>
+  <x title="Matching Probability" n="51" lo="0" hi="1.02"/>
+  <y title="Tracks"/>
+</h>
+<h id="trtTubeFrac" type="TH1F" title="TRT tube hit fraction">
+  <x title="TRT tube hit fraction" n="50" lo="0" hi="1"/>
   <y title="Tracks"/>
 </h>
 <h id="trackCategories" type="TH1F" title="Different track categories">
   <x title="   " n="15" lo="1" hi="16"/>
   <y title="Entries"/>
 </h>
-<h id="ld0TrackCategories" type="TH1F" title="Different track categories">
+<h id="slimTrackCategories" type="TH1F" title="Different track categories">
   <x title="   " n="4" lo="1" hi="5"/>
   <y title="Entries"/>
 </h>
-<h id="pt_lrt" type="TH1F" title="p_{T} of large d0 tracks (in GeV)">
+<h id="pt" type="TH1F" title="p_{T} (in GeV)">
+  <x title="p_{T} (GeV/c)" n="200" lo="0." hi="200"/>
+  <y title="Entries"/>
+</h>
+<h id="pt_ext" type="TH1F" title="p_{T} of extended tracks (in GeV)">
+  <x title="p_{T} (GeV/c)" n="200" lo="0." hi="200"/>
+  <y title="Entries"/>
+</h>
+<h id="pt_trtHit" type="TH1F" title="p_{T} of tracks with TRT hits (in GeV)">
   <x title="p_{T} (GeV/c)" n="200" lo="0." hi="200"/>
   <y title="Entries"/>
 </h>
-<h id="pt_lrtExt" type="TH1F" title="p_{T} of large d0, extended tracks (in GeV)">
+<h id="pt_trtHitNoOut" type="TH1F" title="p_{T} of tracks with TRT hits and no outliers (in GeV)">
   <x title="p_{T} (GeV/c)" n="200" lo="0." hi="200"/>
   <y title="Entries"/>
 </h>
-<h id="pt_lrtTrtHit" type="TH1F" title="p_{T} of large d0 tracks with TRT hits (in GeV)">
+<h id="pt_trtOutlier" type="TH1F" title="p_{T} of tracks with TRT outliers and no hits (in GeV)">
   <x title="p_{T} (GeV/c)" n="200" lo="0." hi="200"/>
   <y title="Entries"/>
 </h>
-<h id="pt_lrtTrtOutlier" type="TH1F" title="p_{T} of large d0 tracks with TRT outliers (in GeV)">
+<h id="pt_trtHitOut" type="TH1F" title="p_{T} of tracks with TRT hits and outliers (in GeV)">
   <x title="p_{T} (GeV/c)" n="200" lo="0." hi="200"/>
   <y title="Entries"/>
 </h>
-<h id="pt_lrtTrtHitOut" type="TH1F" title="p_{T} of large d0 tracks with TRT hits and outliers (in GeV)">
+<h id="pt_noTrt" type="TH1F" title="p_{T} of tracks with neither TRT hits nor outliers (in GeV)">
   <x title="p_{T} (GeV/c)" n="200" lo="0." hi="200"/>
   <y title="Entries"/>
 </h>
-<h id="eta_lrt" type="TH1F" title="#eta of large d0 tracks">
+<h id="eta" type="TH1F" title="#eta">
+  <x title="#eta" n="50" lo="-2.5" hi="2.5"/>
+  <y title="Entries"/>
+</h>
+<h id="eta_ext" type="TH1F" title="#eta of extended tracks">
   <x title="#eta" n="50" lo="-2.5" hi="2.5"/>
   <y title="Entries"/>
 </h>
-<h id="eta_lrtExt" type="TH1F" title="#eta of large d0, extended tracks">
+<h id="eta_trtHit" type="TH1F" title="#eta of tracks with TRT hits">
   <x title="#eta" n="50" lo="-2.5" hi="2.5"/>
   <y title="Entries"/>
 </h>
-<h id="eta_lrtTrtHit" type="TH1F" title="#eta of large d0 tracks with TRT hits">
+<h id="eta_trtHitNoOut" type="TH1F" title="#eta of tracks with TRT hits and no outliers">
   <x title="#eta" n="50" lo="-2.5" hi="2.5"/>
   <y title="Entries"/>
 </h>
-<h id="eta_lrtTrtOutlier" type="TH1F" title="#eta of large d0 tracks with TRT outliers">
+<h id="eta_trtOutlier" type="TH1F" title="#eta of tracks with TRT outliers and no hits">
   <x title="#eta" n="50" lo="-2.5" hi="2.5"/>
   <y title="Entries"/>
 </h>
-<h id="eta_lrtTrtHitOut" type="TH1F" title="#eta of large d0 tracks with TRT hits and outliers">
+<h id="eta_trtHitOut" type="TH1F" title="#eta of tracks with TRT hits and outliers">
   <x title="#eta" n="50" lo="-2.5" hi="2.5"/>
   <y title="Entries"/>
 </h>
-<h id="phi_lrt" type="TH1F" title="#phi of large d0 tracks">
+<h id="eta_noTrt" type="TH1F" title="#eta of tracks with neither TRT hits nor outliers">
+  <x title="#eta" n="50" lo="-2.5" hi="2.5"/>
+  <y title="Entries"/>
+</h>
+<h id="phi" type="TH1F" title="#phi">
+  <x title="#phi" n="100" lo="-4" hi="4"/>
+  <y title="Entries"/>
+</h>
+<h id="phi_ext" type="TH1F" title="#phi of extended tracks">
   <x title="#phi" n="100" lo="-4" hi="4"/>
   <y title="Entries"/>
 </h>
-<h id="phi_lrtExt" type="TH1F" title="#phi of large d0, extended tracks">
+<h id="phi_trtHit" type="TH1F" title="#phi of tracks with TRT hits">
   <x title="#phi" n="100" lo="-4" hi="4"/>
   <y title="Entries"/>
 </h>
-<h id="phi_lrtTrtHit" type="TH1F" title="#phi of large d0 tracks with TRT hits">
+<h id="phi_trtHitNoOut" type="TH1F" title="#phi of tracks with TRT hits and no outliers">
   <x title="#phi" n="100" lo="-4" hi="4"/>
   <y title="Entries"/>
 </h>
-<h id="phi_lrtTrtOutlier" type="TH1F" title="#phi of large d0 tracks with TRT outliers">
+<h id="phi_trtOutlier" type="TH1F" title="#phi of tracks with TRT outliers and no hits">
   <x title="#phi" n="100" lo="-4" hi="4"/>
   <y title="Entries"/>
 </h>
-<h id="phi_lrtTrtHitOut" type="TH1F" title="#phi of large d0 tracks with TRT hits and outliers">
+<h id="phi_trtHitOut" type="TH1F" title="#phi of tracks with TRT hits and outliers">
   <x title="#phi" n="100" lo="-4" hi="4"/>
   <y title="Entries"/>
 </h>
-<h id="d0_lrt" type="TH1F" title="d_{0} of large d0 tracks (in mm)">
+<h id="phi_noTrt" type="TH1F" title="#phi of tracks with neither TRT hits nor outliers">
+  <x title="#phi" n="100" lo="-4" hi="4"/>
+  <y title="Entries"/>
+</h>
+<h id="d0" type="TH1F" title="d_{0} (in mm)">
+  <x title="d_{0} (mm)" n="300" lo="-300" hi="300"/>
+  <y title="Entries"/>
+</h>
+<h id="d0_ext" type="TH1F" title="d_{0} of extended tracks (in mm)">
   <x title="d_{0} (mm)" n="300" lo="-300" hi="300"/>
   <y title="Entries"/>
 </h>
-<h id="d0_lrtExt" type="TH1F" title="d_{0} of large d0, extended tracks (in mm)">
+<h id="d0_trtHit" type="TH1F" title="d_{0} of tracks with TRT hits (in mm)">
   <x title="d_{0} (mm)" n="300" lo="-300" hi="300"/>
   <y title="Entries"/>
 </h>
-<h id="d0_lrtTrtHit" type="TH1F" title="d_{0} of large d0 tracks with TRT hits (in mm)">
+<h id="d0_trtHitNoOut" type="TH1F" title="d_{0} of tracks with TRT hits and no outliers (in mm)">
   <x title="d_{0} (mm)" n="300" lo="-300" hi="300"/>
   <y title="Entries"/>
 </h>
-<h id="d0_lrtTrtOutlier" type="TH1F" title="d_{0} of large d0 tracks with TRT outliers (in mm)">
+<h id="d0_trtOutlier" type="TH1F" title="d_{0} of tracks with TRT outliers and no hits (in mm)">
   <x title="d_{0} (mm)" n="300" lo="-300" hi="300"/>
   <y title="Entries"/>
 </h>
-<h id="d0_lrtTrtHitOut" type="TH1F" title="d_{0} of large d0 tracks with TRT hits and outliers (in mm)">
+<h id="d0_trtHitOut" type="TH1F" title="d_{0} of tracks with TRT hits and outliers (in mm)">
   <x title="d_{0} (mm)" n="300" lo="-300" hi="300"/>
   <y title="Entries"/>
 </h>
-<h id="z0_lrt" type="TH1F" title="z_{0} of large d0 tracks (in mm)">
+<h id="d0_noTrt" type="TH1F" title="d_{0} of tracks with neither TRT hits nor outliers (in mm)">
+  <x title="d_{0} (mm)" n="300" lo="-300" hi="300"/>
+  <y title="Entries"/>
+</h>
+<h id="z0" type="TH1F" title="z_{0} (in mm)">
   <x title="z_{0} (mm)" n="500" lo="-500" hi="500"/>
   <y title="Entries"/>
 </h>
-<h id="z0_lrtExt" type="TH1F" title="z_{0} of large d0, extended tracks (in mm)">
+<h id="z0_ext" type="TH1F" title="z_{0} of extended tracks (in mm)">
   <x title="z_{0} (mm)" n="500" lo="-500" hi="500"/>
   <y title="Entries"/>
 </h>
-<h id="z0_lrtTrtHit" type="TH1F" title="z_{0} of large d0 tracks with TRT hits (in mm)">
+<h id="z0_trtHit" type="TH1F" title="z_{0} of tracks with TRT hits (in mm)">
   <x title="z_{0} (mm)" n="500" lo="-500" hi="500"/>
   <y title="Entries"/>
 </h>
-<h id="z0_lrtTrtOutlier" type="TH1F" title="z_{0} of large d0 tracks with TRT outliers (in mm)">
+<h id="z0_trtHitNoOut" type="TH1F" title="z_{0} of tracks with TRT hits and no outliers (in mm)">
   <x title="z_{0} (mm)" n="500" lo="-500" hi="500"/>
   <y title="Entries"/>
 </h>
-<h id="z0_lrtTrtHitOut" type="TH1F" title="z_{0} of large d0 tracks with TRT hits and outliers (in mm)">
+<h id="z0_trtOutlier" type="TH1F" title="z_{0} of tracks with TRT outliers and no hits (in mm)">
   <x title="z_{0} (mm)" n="500" lo="-500" hi="500"/>
   <y title="Entries"/>
 </h>
+<h id="z0_trtHitOut" type="TH1F" title="z_{0} of tracks with TRT hits and outliers (in mm)">
+  <x title="z_{0} (mm)" n="500" lo="-500" hi="500"/>
+  <y title="Entries"/>
+</h>
+<h id="z0_noTrt" type="TH1F" title="z_{0} of §tracks with neither TRT hits nor outliers (in mm)">
+  <x title="z_{0} (mm)" n="500" lo="-500" hi="500"/>
+  <y title="Entries"/>
+</h>
+<h id="tube" type="TH1F" title="nTRTTubeHits">
+  <x title="nTRTTubeHits" n="20" lo="0" hi="20"/>
+  <y title="Entries"/>
+</h>
+<h id="tube_ext" type="TH1F" title="nTRTTubeHits of extended tracks">
+  <x title="nTRTTubeHits" n="20" lo="0" hi="20"/>
+  <y title="Entries"/>
+</h>
+<h id="tube_trtHit" type="TH1F" title="nTRTTubeHits of tracks with TRT hits">
+  <x title="nTRTTubeHits" n="20" lo="0" hi="20"/>
+  <y title="Entries"/>
+</h>
+<h id="tube_trtHitNoOut" type="TH1F" title="nTRTTubeHits of tracks with TRT hits and no outliers">
+  <x title="nTRTTubeHts" n="20" lo="0" hi="20"/>
+  <y title="Entries"/>
+</h>
+<h id="tube_trtOutlier" type="TH1F" title="nTRTTubeHits of tracks with TRT outliers and no hits">
+  <x title="nTRTTubeHits" n="20" lo="0" hi="20"/>
+  <y title="Entries"/>
+</h>
+<h id="tube_trtHitOut" type="TH1F" title="nTRTTubeHits of tracks with TRT hits and outliers">
+  <x title="nTRTTubeHits" n="20" lo="0" hi="20"/>
+  <y title="Entries"/>
+</h>
+<h id="tube_noTrt" type="TH1F" title="nTRTTubeHits of tracks with neither TRT hits nor outliers">
+  <x title="nTRTTubeHits" n="20" lo="0" hi="20"/>
+  <y title="Entries"/>
+</h>
+
+<!-- TRT testing TH2s -->
+<h id="pt_vs_nTrtTubeHits" type="TH2" title="pT vs nTrtTubeHits">
+  <x title="pT" n="200" lo="0" hi="200"/>
+  <y title="nTrtTubeHits" n="20" lo="0" hi="20"/>
+</h>
+<h id="eta_vs_nTrtTubeHits" type="TH2" title="#eta vs nTrtTubeHits">
+  <x title="#eta" n="50" lo="-2.5" hi="2.5"/>
+  <y title="nTrtTubeHits" n="20" lo="0" hi="20"/>
+</h>
+<h id="phi_vs_nTrtTubeHits" type="TH2" title="#phi vs nTrtTubeHits">
+  <x title="#phi" n="100" lo="-4" hi="4"/>
+  <y title="nTrtTubeHits" n="20" lo="0" hi="20"/>
+</h>
+<h id="d0_vs_nTrtTubeHits" type="TH2" title="d_{0} vs nTrtTubeHits (mm)">
+  <x title="d_{0} (mm)" n="100" lo="-300" hi="300"/>
+  <y title="nTrtTubeHits" n="20" lo="0" hi="20"/>
+</h>
+<h id="z0_vs_nTrtTubeHits" type="TH2" title="z_{0} vs nTrtTubeHits (mm)">
+  <x title="z_{0} (mm)" n="200" lo="-500" hi="500"/>
+  <y title="nTrtTubeHits" n="20" lo="0" hi="20"/>
+</h>
+<h id="mu_vs_nTrtTubeHits" type="TH2" title="#mu vs nTrtTubeHits">
+  <x title="#mu" n="60" lo="0" hi="60"/>
+  <y title="nTrtTubeHits" n="20" lo="0" hi="20"/>
+</h>
+<h id="nPV_vs_nTrtTubeHits" type="TH2" title="nPV vs nTrtTubeHits">
+  <x title="nPV" n="60" lo="0" hi="60"/>
+  <y title="nTrtTubeHits" n="20" lo="0" hi="20"/>
+</h>
+<h id="pt_vs_nTrtHits" type="TH2" title="pT vs nTrtHits">
+  <x title="pT" n="200" lo="0" hi="200"/>
+  <y title="nTrtHits" n="50" lo="0" hi="50"/>
+</h>
+<h id="eta_vs_nTrtHits" type="TH2" title="#eta vs nTrtHits">
+  <x title="#eta" n="50" lo="-2.5" hi="2.5"/>
+  <y title="nTrtHits" n="50" lo="0" hi="50"/>
+</h>
+<h id="phi_vs_nTrtHits" type="TH2" title="#phi vs nTrtHits">
+  <x title="#phi" n="100" lo="-4" hi="4"/>
+  <y title="nTrtHits" n="50" lo="0" hi="50"/>
+</h>
+<h id="d0_vs_nTrtHits" type="TH2" title="d_{0} vs nTrtHits (mm)">
+  <x title="d_{0} (mm)" n="100" lo="-300" hi="300"/>
+  <y title="nTrtHits" n="50" lo="0" hi="50"/>
+</h>
+<h id="z0_vs_nTrtHits" type="TH2" title="z_{0} vs nTrtHits (mm)">
+  <x title="z_{0} (mm)" n="200" lo="-500" hi="500"/>
+  <y title="nTrtHits" n="50" lo="0" hi="50"/>
+</h>
+<h id="mu_vs_nTrtHits" type="TH2" title="#mu vs nTrtHits">
+  <x title="#mu" n="60" lo="0" hi="60"/>
+  <y title="nTrtHits" n="50" lo="0" hi="50"/>
+</h>
+<h id="nPV_vs_nTrtHits" type="TH2" title="nPV vs nTrtHits">
+  <x title="nPV" n="60" lo="0" hi="60"/>
+  <y title="nTrtHits" n="50" lo="0" hi="50"/>
+</h>
+<h id="pt_vs_tubeHitFraction" type="TH2" title="pT vs TRT tube hit fraction">
+  <x title="pT" n="200" lo="0" hi="200"/>
+  <y title="TRT tube hit fraction" n="25" lo="0" hi="1"/>
+</h>
+<h id="eta_vs_tubeHitFraction" type="TH2" title="#eta vs TRT tube hit fraction">
+  <x title="#eta" n="50" lo="-2.5" hi="2.5"/>
+  <y title="TRT tube hit fraction" n="25" lo="0" hi="1"/>
+</h>
+<h id="phi_vs_tubeHitFraction" type="TH2" title="#phi vs TRT tube hit fraction">
+  <x title="#phi" n="100" lo="-4" hi="4"/>
+  <y title="TRT tube hit fraction" n="25" lo="0" hi="1"/>
+</h>
+<h id="d0_vs_tubeHitFraction" type="TH2" title="d_{0} vs TRT tube hit fraction (mm)">
+  <x title="d_{0} (mm)" n="100" lo="-300" hi="300"/>
+  <y title="TRT tube hit fraction" n="25" lo="0" hi="1"/>
+</h>
+<h id="z0_vs_tubeHitFraction" type="TH2" title="z_{0} vs TRT tube hit fraction (mm)">
+  <x title="z_{0} (mm)" n="200" lo="-500" hi="500"/>
+  <y title="TRT tube hit fraction" n="25" lo="0" hi="1"/>
+</h>
+<h id="mu_vs_tubeHitFraction" type="TH2" title="#mu vs TRT tube hit fraction">
+  <x title="#mu" n="60" lo="0" hi="60"/>
+  <y title="TRT tube hit fraction" n="25" lo="0" hi="1"/>
+</h>
+<h id="nPV_vs_tubeHitFraction" type="TH2" title="nPV vs TRT tube hit fraction">
+  <x title="nPV" n="60" lo="0" hi="60"/>
+  <y title="TRT tube hit fraction" n="25" lo="0" hi="1"/>
+</h>
+<h id="nTrtHit_vs_nTrtTubeHit" type="TH2" title="nTrtHits vs nTrtTubeHits">
+  <x title="nTrtHits" n="50" lo="0" hi="50"/>
+  <y title="nTrtTubeHits" n="20" lo="0" hi="20"/>
+</h>
+<h id="nTrtHit_vs_trtTubeFrac" type="TH2" title="nTrtHits vs TRT tube hit fraction">
+  <x title="nTrtHits" n="50" lo="0" hi="50"/>
+  <y title="TRT tube hit fraction" n="25" lo="0" hi="1"/>
+</h>
+<h id="d0_vs_eta" type="TH2" title="d_{0}(mm) vs #eta">
+  <x title="d_{0} (mm)" n="100" lo="-300" hi="300"/>
+  <y title="eta" n="50" lo="-2.5" hi="2.5"/>
+</h>
+
 
 <!--  -->
 <!-- testing -->
@@ -237,7 +417,7 @@
   <y title="Entries"/>
 </h>
 <h id="fakeeta" type="TH1F" title="#eta of selected fake tracks">
-  <x title="#eta" n="100" lo="-5" hi="5"/>
+  <x title="#eta" n="50" lo="-2.5" hi="2.5"/>
   <y title="Entries"/>
 </h>
 <h id="faked0" type="TH1F" title="d_{0} of selected fake tracks (in mm)">
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/inDetPhysValMonitoringPlotDefinitions.hdef b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/inDetPhysValMonitoringPlotDefinitions.hdef
index e23083cf6c8283b1131379476cb612c28cc892c3..a48a321999da3e462ff7ef4fd5924124b399dac6 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/inDetPhysValMonitoringPlotDefinitions.hdef
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/share/inDetPhysValMonitoringPlotDefinitions.hdef
@@ -93,6 +93,7 @@ TProfile trackeff_vs_R "Fraction of reco-matched truth track"  100 0  50 0 2  "R
 TProfile trackeff_vs_Z "Fraction of reco-matched truth track"  100 -350  350 0 2  "Z" "Efficiency" default
 TProfile trackeff_vs_prodR "Track Efficiency vs Production Vertex Radius" 100 0 1500 0 2 "prod_R" "Efficiency" default
 TProfile trackeff_vs_prodZ "Track Efficiency vs Production Vertex Z" 100 0 2000 0 2 "prod_Z" "Efficiency" default
+TProfile low_Pt_lepton_frac "Fraction of Primary Leptons with Pt below 3 GeV" 100 0 1500 0 2 "prod_R" "Efficiency" default
 
 #layer-by-layer efficiencies
 TProfile eff_hit_vs_eta_ibl_barrel "Cluster Efficiency: Pixel Barrel IBL" 10 0 2.5 0 2 "#eta" "Cluster Efficiency" default
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AthTruthSelectionTool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AthTruthSelectionTool.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..5eacdc0a167bc42b5be3948dc83d5a1e41ef0bde
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AthTruthSelectionTool.cxx
@@ -0,0 +1,104 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+ * @file AthTruthSelectionTool.cxx
+ * implementation file for truth selection in this package
+ * @author shaun roe
+ * @date 10 October 2016
+**/
+
+#include "AthTruthSelectionTool.h"
+#include "xAODTruth/TruthVertex.h"
+
+#include <vector>
+#include <cmath>
+
+
+
+AthTruthSelectionTool::AthTruthSelectionTool(const std::string &type, const std::string &name,
+                                                 const IInterface *parent) :
+  AthAlgTool(type, name, parent),
+  m_counters{}{
+    //declare interface from base class
+    declareInterface<IAthSelectionTool>(this);
+    // declareProperty( "Property", m_nProperty ); set defaults
+    declareProperty("maxEta", m_maxEta = 2.5);
+    declareProperty("minPt", m_minPt = 400); 
+    declareProperty("maxPt", m_maxPt = -1);
+    declareProperty("maxBarcode", m_maxBarcode = 200e3);  
+    declareProperty("requireCharged", m_requireCharged = true); 
+    declareProperty("requireStatus1", m_requireStatus1 = true); 
+    declareProperty("maxProdVertRadius", m_maxProdVertRadius = 110.); 
+    declareProperty("pdgId", m_pdgId = -1);
+    declareProperty("hasNoGrandparent", m_grandparent = false); 
+    
+} 
+
+StatusCode
+AthTruthSelectionTool::initialize(){
+  //can set cut properties now
+  typedef xAOD::TruthParticle  P_t;
+  typedef Accept<P_t> Accept_t;
+  typedef Accept_t::func_type F_t;
+  //
+  const std::vector<Accept_t> filters={ 
+   // if p.pt=0, TVector3 generates an error when querying p.eta(); a limit of 1e-7 was not found to be enough to prevent this
+   // the following also vetoes the case where the p.pt()=NaN, as any inequality with NaN evaluates to false
+   Accept_t([this](const P_t &p)->bool{ return ( (p.pt() > 0.1)? (std::abs(p.eta()) < m_maxEta):false );}, std::string("eta")),
+   Accept_t([this](const P_t &p)->bool{ return (p.pt() > m_minPt);}, std::string("min_pt")),
+   Accept_t([this](const P_t &p)->bool{ return ((not (p.hasProdVtx())) or (p.prodVtx()->perp() < m_maxProdVertRadius));},"decay_before_"+std::to_string(m_maxProdVertRadius))
+  };
+  //
+  m_cutFlow=CutFlow<P_t>(filters);
+  if (m_maxPt > 0) m_cutFlow.add(Accept_t([this](const P_t &p){ return (p.pt() < m_maxPt);}, "max_pt"));
+  if (m_maxBarcode > -1) m_cutFlow.add(Accept_t([this](const P_t &p){ return (p.barcode() < m_maxBarcode);}, "barcode < "+std::to_string(m_maxBarcode) ));
+  if (m_requireCharged) m_cutFlow.add(Accept_t([](const P_t &p){ return(not (p.isNeutral()) );},"charged"));
+  if (m_requireStatus1) m_cutFlow.add(Accept_t([](const P_t &p){ return(p.status()==1);},"status1"));
+  if (m_pdgId > 0) m_cutFlow.add(Accept_t([this](const P_t &p){ return (std::abs(p.pdgId())==m_pdgId);},"pdgId"));
+  if (m_grandparent) m_cutFlow.add(Accept_t([](const P_t &p){ return ((p.nParents() == 0) || ( (p.nParents() == 1) and ((p.parent(0))->nParents() == 0)) ); }, "hasNoGrandparent"));
+  m_counters=std::vector<unsigned int>(m_cutFlow.size(),0);
+  std::string msg=std::to_string(m_cutFlow.size())+" truth acceptance cuts are used:\n";
+  for (const auto & i:m_cutFlow.names()){
+    msg+=i+"\n";
+  }
+  ATH_MSG_INFO(msg);
+  clearCounters();
+  
+  return StatusCode::SUCCESS;
+}
+
+StatusCode
+AthTruthSelectionTool::finalize(){
+  //nop
+  return StatusCode::SUCCESS;
+}
+
+void
+AthTruthSelectionTool::clearCounters(){
+  m_cutFlow.clear();
+  m_counters=m_cutFlow.counters();
+}
+
+std::vector<unsigned int> 
+AthTruthSelectionTool::counters() const {
+  return m_cutFlow.counters();
+}
+
+std::vector<std::string> 
+AthTruthSelectionTool::names() const {
+  return m_cutFlow.names();
+}
+
+bool
+AthTruthSelectionTool::accept(const xAOD::IParticle *particle){
+  const xAOD::TruthParticle * pTruth= dynamic_cast<const xAOD::TruthParticle*>(particle);
+  if (not pTruth) return false;
+  return m_cutFlow.accept(*pTruth);
+}
+
+std::string
+AthTruthSelectionTool::str() const{
+  return m_cutFlow.report();
+}
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AthTruthSelectionTool.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AthTruthSelectionTool.h
new file mode 100644
index 0000000000000000000000000000000000000000..94449e128479768a33a6499511b8e8b05bfc19da
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AthTruthSelectionTool.h
@@ -0,0 +1,56 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef INDETPHYSVALMONITORING_ATHTRUTHSELECTIONTOOL_H
+#define INDETPHYSVALMONITORING_ATHTRUTHSELECTIONTOOL_H
+
+/**
+ * @file AthTruthSelectionTool.h
+ * header file for truth selection in this package
+ * @author shaun roe
+ * @date 10 October 2016
+**/
+
+// STL includes
+#include <string>
+#include "InDetPhysValMonitoring/IAthSelectionTool.h"
+#include "xAODTruth/TruthParticle.h" //typedef, can't fwd declare
+#include "AthenaBaseComps/AthAlgTool.h"
+#include "CutFlow.h"
+
+
+
+/// class to apply selection to xAOD::TruthParticles,required by validation
+class AthTruthSelectionTool: virtual public IAthSelectionTool, public AthAlgTool {
+public:
+  AthTruthSelectionTool(const std::string &type, const std::string &name, const IInterface *parent);
+  virtual ~AthTruthSelectionTool () {
+    /*nop*/
+  };
+  StatusCode initialize() final;
+  StatusCode finalize() final;
+  bool accept(const xAOD::IParticle *particle) final;
+  void clearCounters() final;
+  std::vector<unsigned int> counters() const final;
+  std::vector<std::string> names() const final;
+  std::string str() const final;
+private:
+  CutFlow<xAOD::TruthParticle> m_cutFlow;
+  // Cut values;
+  float  m_maxEta;
+  float  m_maxPt;
+  float  m_minPt;
+  int    m_maxBarcode;
+  bool   m_requireCharged;
+  bool   m_requireStatus1;
+  // max decay radius for secondaries [mm];
+  // set to within (Run2) pixel by default
+  double m_maxProdVertRadius;
+  int    m_pdgId;
+  bool   m_grandparent;
+  std::vector<unsigned int> m_counters;
+};
+
+
+#endif
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/CachedGetAssocTruth.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/CachedGetAssocTruth.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..54c33754714c6bddaf0b1d570b070ea2240322fa
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/CachedGetAssocTruth.cxx
@@ -0,0 +1,75 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+ * @file CachedGetAssocTruth.cxx
+ * @author shaun roe
+ * @date 11 October 2016
+ **/
+ 
+ #include "CachedGetAssocTruth.h"
+ #include "xAODTruth/TruthParticleContainer.h"
+ 
+namespace IDPVM{
+  CachedGetAssocTruth::CachedGetAssocTruth():m_cache{}{
+  #ifndef NDEBUG
+    m_nCalls=0; m_nCacheHits=0;
+  #endif
+    //nop
+  }
+  
+  void
+  CachedGetAssocTruth::clear(){
+    #ifndef NDEBUG
+      m_nCalls=0;
+      m_nCacheHits=0;
+    #endif
+    m_cache.clear();
+  }
+  
+  const xAOD::TruthParticle * 
+  CachedGetAssocTruth::getTruth(const xAOD::TrackParticle * trackParticle){
+    #ifndef NDEBUG
+      m_nCalls++;
+    #endif
+    if (not trackParticle) return nullptr;
+    auto pCache = m_cache.find(trackParticle);
+    if (pCache!=m_cache.end()){
+      #ifndef NDEBUG
+        m_nCacheHits++;
+      #endif
+      return pCache->second;
+    }
+    typedef ElementLink<xAOD::TruthParticleContainer> ElementTruthLink_t;
+    const xAOD::TruthParticle *result(nullptr);
+    // 0. is there any truth?
+    if (trackParticle->isAvailable<ElementTruthLink_t>("truthParticleLink")) {
+      // 1. ..then get link
+      const ElementTruthLink_t ptruthContainer = trackParticle->auxdata<ElementTruthLink_t>("truthParticleLink");
+      if (ptruthContainer.isValid()) {
+        result = *ptruthContainer;
+      }
+    }
+    m_cache[trackParticle]=result;
+    return result;
+  }
+  
+  const xAOD::TruthParticle * 
+  CachedGetAssocTruth::operator()(const xAOD::TrackParticle * trackParticle){
+    return getTruth(trackParticle);
+  }
+  
+  std::string
+  CachedGetAssocTruth::report() const{
+    std::string op("No cache report from 'CachedGetAssocTruth' is available in OPT builds.");
+    #ifndef NDEBUG
+      op="\nCache report\nNum. calls = "+std::to_string(m_nCalls);
+      op+="\nNum. cache hits = "+std::to_string(m_nCacheHits);
+      op+="\nCache size = "+std::to_string(m_cache.size());
+    #endif
+    return op;
+  }
+ 
+ 
+}
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/CachedGetAssocTruth.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/CachedGetAssocTruth.h
new file mode 100644
index 0000000000000000000000000000000000000000..08fec264cd9260512e285897f941447b4bfc69ed
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/CachedGetAssocTruth.h
@@ -0,0 +1,51 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef IDPVM_CachedGetAssocTruth_h
+#define IDPVM_CachedGetAssocTruth_h
+
+/**
+ * @file CachedGetAssocTruth.h
+ * @author shaun roe
+ * @date 11 October 2016
+ **/
+ 
+//#include <map>
+#include <unordered_map>
+#include <string>
+#include "xAODTruth/TruthParticle.h"
+#include "xAODTracking/TrackParticle.h"
+
+///Class to retrieve associated truth from a track, implementing a cached response
+namespace IDPVM{
+  class CachedGetAssocTruth{
+  public:
+    CachedGetAssocTruth();
+    ///copy and assignment are not possible
+    CachedGetAssocTruth & operator=(const CachedGetAssocTruth &) =delete;
+    CachedGetAssocTruth(const CachedGetAssocTruth &) =delete;
+    ///clear the cache
+    void clear();
+    ///Get the associated truth particle, given a track particle
+    const xAOD::TruthParticle * operator()(const xAOD::TrackParticle * trackParticle);
+    const xAOD::TruthParticle * getTruth(const xAOD::TrackParticle * const trackParticle);
+    ///Report statistics
+    std::string report() const;
+    
+    
+  private:
+    ///private cache container; map or unordered_map could be used
+    std::unordered_map<const xAOD::TrackParticle *, const xAOD::TruthParticle *> m_cache;
+     #ifndef NDEBUG
+      ///number of calls
+      unsigned int m_nCalls;
+      ///number of cache hits
+      unsigned int m_nCacheHits;
+    #endif
+ 
+  };
+}//end of namespace
+#endif
+ 
+ 
\ No newline at end of file
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/CutFlow.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/CutFlow.h
new file mode 100644
index 0000000000000000000000000000000000000000..b7010de57f2d86d928a196148e66e1748d137c16
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/CutFlow.h
@@ -0,0 +1,182 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+ * @file CutFlow.h
+ * @author shaun roe
+ **/
+
+
+#include <functional>
+#include <algorithm>
+#include <string>
+#include <vector>
+
+
+/** Templated class containing a cut, name of cut and description of cut(optional)
+  * Typically, the class will be templated on <xAOD::TruthParticle> or <xAOD::TrackParticle>.
+  * The cut is passed in as any predicate function, the type is declared as function<bool(A)>
+  * although typically these will be lambda functions.
+  * The cut is an 'accept' cut, i.e. the value passes if it is true.
+  * These predicate functions are called each time the 'pass' method is called.
+  * The class keeps an internal count of how many values passed, and may be used
+  * as a functional due to the overloaded () operator.
+  */
+template<class A>
+class Accept{
+public:
+  ///Default constructor with a simple predicate returning false
+  Accept():m_predicate([](A){return false;}),m_name{},m_desc{},m_nPassed(0){
+      //nop
+  }
+  /** @brief Normal constructor
+    * @param predicate any function taking the templated value and returning a bool
+    * @param name optional name for this cut
+    * @param description optional description for this cut
+    */
+  Accept(const std::function<bool(const A &)> & predicate, const std::string & name="", const std::string & description=""):m_predicate(predicate), m_name(name),m_desc(description),m_nPassed(0){
+      //nop
+  }
+  ///Overloading the () operator allows the class to be used as a functional
+  bool operator()(const A & i) {
+      return pass(i);
+  }
+  ///Apply the predicate function and return the value, also updating an internal counter
+  bool pass(const A & i) {
+      const bool passed=m_predicate(i);
+      m_nPassed+=(int)passed;
+      return passed;
+  }
+  ///Clear internal counter
+  void clearCount(){ m_nPassed=0;}
+  ///Return internal counter
+  unsigned int getCount() const { return m_nPassed;}
+  ///Return cut name
+  std::string name() const { return m_name;}
+  ///Return cut description
+  std::string description() const { return m_desc;}
+  ///Utility typedefs to help callers: the value type
+  typedef A value_type;
+  ///Utility typedefs to help callers: the function type
+  typedef const std::function<bool(const A &)> func_type;
+private:
+  //std::function<bool(A)> m_predicate;
+  func_type m_predicate;
+  std::string m_name;
+  std::string m_desc;
+  unsigned int m_nPassed;
+};
+
+/** Templated CutFlow class to contain a group of cuts.
+  * The CutFlow is typically instantiated with a vector of Accept objects, although
+  * additional cuts may be added with the 'add' method.
+  * Cuts may be applied in one of two ways, determined by the 'mode' parameter:
+  * ALL: Always apply every cut
+  * UNTIL_FAIL: Apply cuts until the first one fails
+  * The 'accept' method applies the cuts and keeps internal count of how many times it is called.
+  */
+template<class A>
+class CutFlow{
+public:
+  ///Cut mode: Apply ALL cuts, or until the first failure
+  enum CutFlowMode{ALL,UNTIL_FAIL};
+  ///Normal constructor takes a vector<Accept>. Note default mode is 'ALL'.
+  CutFlow(const std::vector<Accept<A> > & cuts):m_cuts(cuts),m_mode(ALL),
+    m_passed(0), m_processed(0){
+      //nop
+  }
+  ///Default constructor with no cuts implemented
+  CutFlow():m_cuts{},m_mode(ALL),m_passed(0),m_processed(0){
+    //nop
+  }
+  ///Add one cut
+  void 
+  add(const Accept<A> & newCut){
+    m_cuts.push_back(newCut);
+  }
+  ///Clear internal counters
+  void 
+  clear(){
+      m_processed=0;
+      m_passed=0;
+      for (auto & i:m_cuts) i.clearCount();
+  }
+  ///set the accept mode according to the CutFlowMode
+  void 
+  setMode(const CutFlowMode m){
+      m_mode=m;
+  }
+  ///get the accept mode
+  CutFlowMode getMode() const{
+      return m_mode;
+  }
+  ///Apply cuts and return the boolean result; keep count of number of calls and passes
+  bool 
+  accept(const A & value){
+      bool result(true);
+      if (m_mode==ALL){
+          for (auto &thisCut:m_cuts){
+              const bool passed=thisCut.pass(value);
+              result &= passed;
+          }
+      } else {
+          for (auto &thisCut:m_cuts){
+              const bool passed=thisCut.pass(value);
+              if (not passed){
+                  result=false;
+                  break;
+              }             }
+      }
+      m_processed++;
+      m_passed+=(int) result;
+      return result;
+  }
+  ///Return the number of cuts
+  unsigned int
+  size() const{ return m_cuts.size(); }
+  ///Return the number of times the 'accept' method was called
+  unsigned int 
+  nProcessed() const {return m_processed;}
+  ///Returnn the number of values which passed all cuts
+  unsigned int 
+  nPassed() const {return m_passed;}
+  ///Return a vector of individual counters for each cut
+  std::vector<unsigned int>
+  counters() const{
+    std::vector<unsigned int> result(m_cuts.size(),0);
+    unsigned int idx(0);
+    for (const auto & i:m_cuts){
+      result[idx++]=i.getCount();
+    }
+    return result; //return-value-optimisation is invoked
+  }
+  ///Return a vector of the cut names
+  std::vector<std::string>
+  names() const{
+    std::vector<std::string> result(m_cuts.size());
+    unsigned int idx(0);
+    for (const auto &i:m_cuts){
+      result[idx++]=i.name();
+    }
+    return result; //return-value-optimisation is invoked
+  }
+  ///Produce a formatted string report of the results
+  std::string 
+  report() const {
+      std::string op="\nCutFlow Report; Total processed: "+std::to_string(m_processed);
+      op+="\nTotal passed: "+std::to_string(m_passed);
+      std::string modeString=(m_mode==ALL)?"\nAll cuts were applied\n":"\nCuts were applied until one fails\n";
+      op+=modeString;
+      for (const auto & thisCut:m_cuts){
+          op+=thisCut.name()+": "+std::to_string(thisCut.getCount())+" passed\n";
+      }
+      return op;
+  }
+private:
+    std::vector<Accept<A>> m_cuts;
+    CutFlowMode m_mode;
+    unsigned int m_passed;
+    unsigned int m_processed;
+};
+
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetBasicPlot.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetBasicPlot.cxx
index fb75bbe66a52eae8051d982072ccadca0cc2a2f4..069f551367cdc93b6a3c924f7b7cd54e1191f0ff 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetBasicPlot.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetBasicPlot.cxx
@@ -46,11 +46,20 @@ InDetBasicPlot::initializePlots() {
 
 void
 InDetBasicPlot::fill(const xAOD::TruthParticle &particle) {
+  static const std::array<bool,NPARAMS> available{
+    particle.isAvailable<float>("d0"),
+    particle.isAvailable<float>("z0"),
+    particle.isAvailable<float>("phi"),
+    particle.isAvailable<float>("theta"),
+    particle.isAvailable<float>("eta"),
+    particle.isAvailable<float>("qOverP")
+  };
   unsigned int i(0);
 
   ++m_numCallsToFillTruth;
+  unsigned int idx(0);
   for (const auto &p:m_paramNames) {
-    if (particle.isAvailable<float>(p)) {
+    if (available[idx++]) {
       const auto thisParameterValue = particle.auxdata< float >(p);
       if ((i == 0) and thisParameterValue == 0.) {
         ++m_d0IsExactlyZeroInTruthCounter;
@@ -90,10 +99,10 @@ InDetBasicPlot::fill(const xAOD::TrackParticle &particle) {
 
 void
 InDetBasicPlot::finalizePlots() {
-  ATH_MSG_INFO(
+  ATH_MSG_DEBUG(
     "Number of exact zero values for d0 in tracks: " << m_d0IsExactlyZeroInTrackCounter << " out of " <<
     m_numCallsToFillTrack);
-  ATH_MSG_INFO(
+  ATH_MSG_DEBUG(
     "Number of exact zero values for d0 in truth: " << m_d0IsExactlyZeroInTruthCounter << " out of " <<
     m_numCallsToFillTruth);
 }
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Eff.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Eff.cxx
index f7b04ff588b947ffa37cc39fcbe9fa7836ecdc20..0aae1e97b72362f7fdad014b9fc9b5498aeec7fe 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Eff.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Eff.cxx
@@ -3,7 +3,7 @@
 */
 
 #include "InDetPerfPlot_Eff.h"
-#include "TrkValHistUtils/EfficiencyPurityCalculator.h"
+//#include "TrkValHistUtils/EfficiencyPurityCalculator.h"
 #include "xAODTruth/TruthParticle.h"
 #include "xAODTruth/TruthVertex.h"
 
@@ -20,6 +20,7 @@ InDetPerfPlot_Eff::InDetPerfPlot_Eff(InDetPlotBase *pParent, const std::string &
   m_trackeff_vs_Z{},
   m_trackeff_vs_prodR{},
   m_trackeff_vs_prodZ{},
+  m_low_Pt_lepton_frac{},
   m_eff_vs_eta_of_daughters{},
   m_eff_vs_theta_of_daughters{},
   m_eff_vs_theta_tan_of_daughters{},
@@ -50,6 +51,8 @@ InDetPerfPlot_Eff::initializePlots() {
   book(m_trackeff_vs_prodR, "trackeff_vs_prodR");
   book(m_trackeff_vs_prodZ, "trackeff_vs_prodZ");
 
+  book(m_low_Pt_lepton_frac, "low_Pt_lepton_frac");
+
   book(m_eff_vs_eta_of_daughters, "eff_vs_eta_of_daughters");
   book(m_eff_vs_theta_of_daughters, "eff_vs_theta_of_daughters");
   book(m_eff_vs_theta_tan_of_daughters, "eff_vs_theta_tan_of_daughters");
@@ -94,6 +97,12 @@ InDetPerfPlot_Eff::pro_fill(const xAOD::TruthParticle &truth, float weight) {
   }
 }
 
+void
+InDetPerfPlot_Eff::lepton_fill(const xAOD::TruthParticle &truth, float weight){
+  double R = truth.auxdata<float>("prodR");
+  fillHisto(m_low_Pt_lepton_frac, R, weight);
+}
+
 void
 InDetPerfPlot_Eff::BT_fill(const xAOD::TruthParticle &truth, float weight) {
   double eta = truth.eta();
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Eff.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Eff.h
index 43ffe9ef1ad0b5fe084fdac5ebe31d5b0af06097..1a1f4595d858f951fc7932c75689f52c236b41c3 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Eff.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_Eff.h
@@ -34,6 +34,7 @@ public:
   InDetPerfPlot_Eff(InDetPlotBase *pParent, const std::string &dirName);
 
   void pro_fill(const xAOD::TruthParticle &truth, float weight);
+  void lepton_fill(const xAOD::TruthParticle &truth, float weight);
   void BT_fill(const xAOD::TruthParticle &truth, float weight);
   void jet_fill(const xAOD::TrackParticle &track, const xAOD::Jet &jet, float weight);
 private:
@@ -48,6 +49,8 @@ private:
   TProfile *m_trackeff_vs_prodR;
   TProfile *m_trackeff_vs_prodZ;
 
+  TProfile *m_low_Pt_lepton_frac;
+
   TProfile *m_eff_vs_eta_of_daughters;
   TProfile *m_eff_vs_theta_of_daughters;
   TProfile *m_eff_vs_theta_tan_of_daughters;
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrkInJet.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrkInJet.cxx
index 542b780678cff9caa359ef2a350f243ef35202e9..369b80b9e3f07b0e6f38546a89a4fd1f923b35a1 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrkInJet.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrkInJet.cxx
@@ -13,6 +13,7 @@
 #include "xAODTracking/TrackParticle.h"
 #include "xAODTracking/TrackParticleContainer.h"
 #include <algorithm>
+#include <numeric>
 
 
 InDetPerfPlot_TrkInJet::InDetPerfPlot_TrkInJet(InDetPlotBase *pParent, std::string sDir) :
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrtTest.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrtTest.cxx
index c4138c098bec37bff4472a6eb69efb2fb7b255a1..355598c1dd7785571f6f3d9c31f9c1dd920dff8f 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrtTest.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrtTest.cxx
@@ -10,71 +10,142 @@
 #include "InDetPerfPlot_TrtTest.h"
 #include "xAODTracking/TrackParticle.h"
 #include "xAODTracking/TrackParticleContainer.h"
+#include "xAODTracking/Vertex.h"
+#include "xAODTracking/VertexContainer.h"
+#include "EventPrimitives/EventPrimitives.h"
+#include "EventPrimitives/EventPrimitivesHelpers.h"
+#include "xAODEventInfo/EventInfo.h"
 
 // get truth/track matching probability
-float
-getMatchingProbability(const xAOD::TrackParticle &trackParticle) {
-  float result(std::numeric_limits<float>::quiet_NaN());
-
-  if (trackParticle.isAvailable<float>("truthMatchProbability")) {
-    result = trackParticle.auxdata<float>("truthMatchProbability");
+namespace{
+  float
+  getMatchingProbability(const xAOD::TrackParticle &trackParticle) {
+    float result(std::numeric_limits<float>::quiet_NaN());
+    if (trackParticle.isAvailable<float>("truthMatchProbability")) {
+      result = trackParticle.auxdata<float>("truthMatchProbability");
+    }
+    return result;
+  }
+  bool
+  inRange(const double eta){
+    return ((eta >= -2.0) and (eta <= 2.0));
   }
-  return result;
 }
+InDetPerfPlot_TrtTest::InDetPerfPlot_TrtTest(InDetPlotBase *pParent, const std::string &sDir) : InDetPlotBase(pParent, sDir),
+m_mu{},m_nPV{},m_matchProb{},m_trtTubeFrac{},
+m_trackCategories{},m_slimTrackCategories{},
+m_pt{},m_pt_ext{},m_pt_trtHit{},m_pt_trtHitNoOut{},m_pt_trtOutlier{},m_pt_trtHitOut{},m_pt_noTrt{},
+m_eta{},m_eta_ext{},m_eta_trtHit{},m_eta_trtHitNoOut{},m_eta_trtOutlier{},m_eta_trtHitOut{},m_eta_noTrt{},
+m_phi{},m_phi_ext{},m_phi_trtHit{},m_phi_trtHitNoOut{},m_phi_trtOutlier{},m_phi_trtHitOut{},m_phi_noTrt{},
+m_d0{},m_d0_ext{},m_d0_trtHit{},m_d0_trtHitNoOut{},m_d0_trtOutlier{},m_d0_trtHitOut{},m_d0_noTrt{}, 
+m_z0{}, m_z0_ext{},m_z0_trtHit{},m_z0_trtHitNoOut{},m_z0_trtOutlier{},m_z0_trtHitOut{},m_z0_noTrt{},
+m_tube{},m_tube_ext{},m_tube_trtHit{},m_tube_trtHitNoOut{},m_tube_trtOutlier{},m_tube_trtHitOut{},m_tube_noTrt{},
 
-InDetPerfPlot_TrtTest::InDetPerfPlot_TrtTest(InDetPlotBase *pParent, const std::string &sDir) : InDetPlotBase(pParent,
-                                                                                                              sDir),
-  m_matchProb{}, m_trackCategories{}, m_ld0TrackCategories{},
-  m_pt_lrt{}, m_pt_lrtExt{}, m_pt_lrtTrtHit{}, m_pt_lrtTrtOutlier{}, m_pt_lrtTrtHitOut{},
-  m_eta_lrt{}, m_eta_lrtExt{}, m_eta_lrtTrtHit{}, m_eta_lrtTrtOutlier{}, m_eta_lrtTrtHitOut{},
-  m_phi_lrt{}, m_phi_lrtExt{}, m_phi_lrtTrtHit{}, m_phi_lrtTrtOutlier{}, m_phi_lrtTrtHitOut{},
-  m_d0_lrt{}, m_d0_lrtExt{}, m_d0_lrtTrtHit{}, m_d0_lrtTrtOutlier{}, m_d0_lrtTrtHitOut{},
-  m_z0_lrt{}, m_z0_lrtExt{}, m_z0_lrtTrtHit{}, m_z0_lrtTrtOutlier{}, m_z0_lrtTrtHitOut{} {
+m_pt_tubeHitFrac_05_1{},m_eta_tubeHitFrac_05_1{},m_phi_tubeHitFrac_05_1{},m_d0_tubeHitFrac_05_1{},m_z0_tubeHitFrac_05_1{},
+m_pt_tubeHitFrac_04_05{},m_eta_tubeHitFrac_04_05{},m_phi_tubeHitFrac_04_05{},m_d0_tubeHitFrac_04_05{},m_z0_tubeHitFrac_04_05{},
+m_pt_tubeHitFrac_03_04{},m_eta_tubeHitFrac_03_04{},m_phi_tubeHitFrac_03_04{},m_d0_tubeHitFrac_03_04{},m_z0_tubeHitFrac_03_04{},
+m_pt_tubeHitFrac_0_03{},m_eta_tubeHitFrac_0_03{},m_phi_tubeHitFrac_0_03{},m_d0_tubeHitFrac_0_03{},m_z0_tubeHitFrac_0_03{},
+
+m_pt_vs_nTrtTubeHits{},m_eta_vs_nTrtTubeHits{},m_phi_vs_nTrtTubeHits{},m_d0_vs_nTrtTubeHits{},m_z0_vs_nTrtTubeHits{},m_mu_vs_nTrtTubeHits{},m_nPV_vs_nTrtTubeHits{},
+m_pt_vs_nTrtHits{},m_eta_vs_nTrtHits{},m_phi_vs_nTrtHits{},m_d0_vs_nTrtHits{},m_z0_vs_nTrtHits{},m_mu_vs_nTrtHits{},m_nPV_vs_nTrtHits{},
+m_pt_vs_tubeHitFrac{},m_eta_vs_tubeHitFrac{},m_phi_vs_tubeHitFrac{},m_d0_vs_tubeHitFrac{},m_z0_vs_tubeHitFrac{},m_mu_vs_tubeHitFrac{},m_nPV_vs_tubeHitFrac{},
+m_nTrtHit_vs_nTrtTubeHit{},m_nTrtHit_vs_trtTubeFrac{},
+m_d0_vs_eta{}
+{
   // Filled with nothing (?)
 }
 
 void
 InDetPerfPlot_TrtTest::initializePlots() {
+  book(m_mu, "mu");
+  book(m_nPV, "nPV");
   book(m_matchProb, "matchProb");
+  book(m_trtTubeFrac, "trtTubeFrac");
   book(m_trackCategories, "trackCategories");
-  book(m_ld0TrackCategories, "ld0TrackCategories");
-  book(m_pt_lrt, "pt_lrt");
-  book(m_pt_lrtExt, "pt_lrtExt");
-  book(m_pt_lrtTrtHit, "pt_lrtTrtHit");
-  book(m_pt_lrtTrtOutlier, "pt_lrtTrtOutlier");
-  book(m_pt_lrtTrtHitOut, "pt_lrtTrtHitOut");
-  book(m_eta_lrt, "eta_lrt");
-  book(m_eta_lrtExt, "eta_lrtExt");
-  book(m_eta_lrtTrtHit, "eta_lrtTrtHit");
-  book(m_eta_lrtTrtOutlier, "eta_lrtTrtOutlier");
-  book(m_eta_lrtTrtHitOut, "eta_lrtTrtHitOut");
-  book(m_phi_lrt, "phi_lrt");
-  book(m_phi_lrtExt, "phi_lrtExt");
-  book(m_phi_lrtTrtHit, "phi_lrtTrtHit");
-  book(m_phi_lrtTrtOutlier, "phi_lrtTrtOutlier");
-  book(m_phi_lrtTrtHitOut, "phi_lrtTrtHitOut");
-  book(m_d0_lrt, "d0_lrt");
-  book(m_d0_lrtExt, "d0_lrtExt");
-  book(m_d0_lrtTrtHit, "d0_lrtTrtHit");
-  book(m_d0_lrtTrtOutlier, "d0_lrtTrtOutlier");
-  book(m_d0_lrtTrtHitOut, "d0_lrtTrtHitOut");
-  book(m_z0_lrt, "z0_lrt");
-  book(m_z0_lrtExt, "z0_lrtExt");
-  book(m_z0_lrtTrtHit, "z0_lrtTrtHit");
-  book(m_z0_lrtTrtOutlier, "z0_lrtTrtOutlier");
-  book(m_z0_lrtTrtHitOut, "z0_lrtTrtHitOut");
+  book(m_slimTrackCategories, "slimTrackCategories");
+  book(m_pt, "pt");
+  book(m_pt_ext, "pt_ext");
+  book(m_pt_trtHit, "pt_trtHit");
+  book(m_pt_trtHitNoOut, "pt_trtHitNoOut");
+  book(m_pt_trtOutlier, "pt_trtOutlier");
+  book(m_pt_trtHitOut, "pt_trtHitOut");
+  book(m_pt_noTrt, "pt_noTrt");
+  book(m_eta, "eta");
+  book(m_eta_ext, "eta_ext");
+  book(m_eta_trtHit, "eta_trtHit");
+  book(m_eta_trtHitNoOut, "eta_trtHitNoOut");
+  book(m_eta_trtOutlier, "eta_trtOutlier");
+  book(m_eta_trtHitOut, "eta_trtHitOut");
+  book(m_eta_noTrt, "eta_noTrt");
+  book(m_phi, "phi");
+  book(m_phi_ext, "phi_ext");
+  book(m_phi_trtHit, "phi_trtHit");
+  book(m_phi_trtHitNoOut, "phi_trtHitNoOut");
+  book(m_phi_trtOutlier, "phi_trtOutlier");
+  book(m_phi_trtHitOut, "phi_trtHitOut");
+  book(m_phi_noTrt, "phi_noTrt");
+  book(m_d0, "d0");
+  book(m_d0_ext, "d0_ext");
+  book(m_d0_trtHit, "d0_trtHit");
+  book(m_d0_trtHitNoOut, "d0_trtHitNoOut");
+  book(m_d0_trtOutlier, "d0_trtOutlier");
+  book(m_d0_trtHitOut, "d0_trtHitOut");
+  book(m_d0_noTrt, "d0_noTrt");
+  book(m_z0, "z0");
+  book(m_z0_ext, "z0_ext");
+  book(m_z0_trtHit, "z0_trtHit");
+  book(m_z0_trtHitNoOut, "z0_trtHitNoOut");
+  book(m_z0_trtOutlier, "z0_trtOutlier");
+  book(m_z0_trtHitOut, "z0_trtHitOut");
+  book(m_z0_noTrt, "z0_noTrt");
+  book(m_tube, "tube");
+  book(m_tube_ext, "tube_ext");
+  book(m_tube_trtHit, "tube_trtHit");
+  book(m_tube_trtHitNoOut, "tube_trtHitNoOut");
+  book(m_tube_trtOutlier, "tube_trtOutlier");
+  book(m_tube_trtHitOut, "tube_trtHitOut");
+  book(m_tube_noTrt, "tube_noTrt");
+  book(m_pt_vs_nTrtTubeHits, "pt_vs_nTrtTubeHits");
+  book(m_eta_vs_nTrtTubeHits, "eta_vs_nTrtTubeHits");
+  book(m_phi_vs_nTrtTubeHits, "phi_vs_nTrtTubeHits");
+  book(m_d0_vs_nTrtTubeHits, "d0_vs_nTrtTubeHits");
+  book(m_z0_vs_nTrtTubeHits, "z0_vs_nTrtTubeHits");
+  book(m_mu_vs_nTrtTubeHits, "mu_vs_nTrtTubeHits");
+  book(m_nPV_vs_nTrtTubeHits, "nPV_vs_nTrtTubeHits");
+  book(m_pt_vs_nTrtHits, "pt_vs_nTrtHits");
+  book(m_eta_vs_nTrtHits, "eta_vs_nTrtHits");
+  book(m_phi_vs_nTrtHits, "phi_vs_nTrtHits");
+  book(m_d0_vs_nTrtHits, "d0_vs_nTrtHits");
+  book(m_z0_vs_nTrtHits, "z0_vs_nTrtHits");
+  book(m_mu_vs_nTrtHits, "mu_vs_nTrtHits");
+  book(m_nPV_vs_nTrtHits, "nPV_vs_nTrtHits");
+  book(m_pt_vs_tubeHitFrac, "pt_vs_tubeHitFraction");
+  book(m_eta_vs_tubeHitFrac, "eta_vs_tubeHitFraction");
+  book(m_phi_vs_tubeHitFrac, "phi_vs_tubeHitFraction");
+  book(m_d0_vs_tubeHitFrac, "d0_vs_tubeHitFraction");
+  book(m_z0_vs_tubeHitFrac, "z0_vs_tubeHitFraction");
+  book(m_mu_vs_tubeHitFrac, "mu_vs_tubeHitFraction");
+  book(m_nPV_vs_tubeHitFrac, "nPV_vs_tubeHitFraction");
+  book(m_nTrtHit_vs_nTrtTubeHit, "nTrtHit_vs_nTrtTubeHit");
+  book(m_nTrtHit_vs_trtTubeFrac, "nTrtHit_vs_trtTubeFrac");
+  book(m_d0_vs_eta, "d0_vs_eta");
 }
 
 void
-InDetPerfPlot_TrtTest::fill(const xAOD::TrackParticle &particle) {
-  uint8_t iTrtHits(0), iTrtOutliers(0);
+InDetPerfPlot_TrtTest::fill(const xAOD::TrackParticle &particle, const xAOD::EventInfo& ei, const xAOD::VertexContainer& pv) {
+  uint8_t iTrtHits(0), iTrtOutliers(0), iTrtTubeHits(0);
   std::bitset<xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo>  patternReco = particle.patternRecoInfo();
   float prob = getMatchingProbability(particle);
-  double pt = particle.pt() / 1000.;
+  float mu = ei.actualInteractionsPerCrossing();
+  int nPV = pv.size();
+  double pt = particle.pt()*0.001;;
   double eta = particle.eta();
   double phi = particle.phi();
   double d0 = particle.d0();
   double z0 = particle.z0();
+  //  double theta = particle.theta();
+  //  double rFirst = particle.radiusOfFirstHit();
+  int nTubeHits(0), nTrtHits(0);
   bool TRTHit = false;
   bool TRTOut = false;
   bool Ext = false;
@@ -83,131 +154,165 @@ InDetPerfPlot_TrtTest::fill(const xAOD::TrackParticle &particle) {
   bool TRTStdAl = false;
   bool Ambi = false;
   bool LRT = false;
+  double tubeFrac = -1.0;
 
-  if (patternReco.test(0)) {
-    SiSd = true;
-  }
-  if (patternReco.test(3)) {
-    Ext = true;
-  }
-  if (patternReco.test(4)) {
-    TRTSd = true;
-  }
-  if (patternReco.test(19)) {
-    Ambi = true;
-  }
-  if (patternReco.test(20)) {
-    TRTStdAl = true;
-  }
-  if (patternReco.test(49)) {
-    LRT = true;
-  }
+  if (patternReco.test(0)) { SiSd = true; }
+  if (patternReco.test(3)) { Ext = true; }
+  if (patternReco.test(4)) { TRTSd = true; }
+  if (patternReco.test(19)) { Ambi = true; }
+  if (patternReco.test(20)) { TRTStdAl = true; }
+  if (patternReco.test(49)) { LRT = true; }
   if (particle.summaryValue(iTrtHits, xAOD::numberOfTRTHits)) {
     if (iTrtHits > 0) {
       TRTHit = true;
-    }
-  }
+      nTrtHits = (int)iTrtHits; }  }
   if (particle.summaryValue(iTrtOutliers, xAOD::numberOfTRTOutliers)) {
-    if (iTrtOutliers > 0) {
-      TRTOut = true;
-    }
-  }
-
+    if (iTrtOutliers > 0) { TRTOut = true; } }
+  if(particle.summaryValue(iTrtTubeHits,xAOD::numberOfTRTTubeHits)){
+    if(iTrtTubeHits > 0) { nTubeHits = (int)iTrtTubeHits;  } }
 
+  if(TRTHit) { tubeFrac = ((double)nTubeHits)/((double)nTrtHits); }
+  // std::cout << "nTrtHits is " << nTrtHits << ", nTrtTubeHits is " << nTubeHits << ", and the fraction of trt tube hits is " << tubeFrac << std::endl;
+  
+  //Fill histograms for matching probability and µ, other general things//
+  fillHisto(m_mu,mu);
+  fillHisto(m_nPV,nPV);
   fillHisto(m_matchProb,prob);
 
+  if(TRTHit) { fillHisto(m_trtTubeFrac, tubeFrac); }
+  
+  //Fill histograms for track categories//
   fillHisto(m_trackCategories,1);
-  if (SiSd || Ambi) {
-    fillHisto(m_trackCategories,2);
-  }
-  if (SiSd || Ambi || Ext) {
-    fillHisto(m_trackCategories,3);
-  }
-  if ((SiSd || Ambi) && Ext) {
-    fillHisto(m_trackCategories,4);
-  }
-  if (LRT) {
-    fillHisto(m_trackCategories,5);
-  }
-  if (LRT && Ext) {
-    fillHisto(m_trackCategories,6);
-  }
-  if (LRT && TRTHit) {
-    fillHisto(m_trackCategories,7);
-  }
-  if (LRT && TRTOut) {
-    fillHisto(m_trackCategories,8);
-  }
-  if (Ext && !TRTHit && !TRTOut) {
-    fillHisto(m_trackCategories,9);
-  }
-  if ((SiSd || Ambi) && LRT) {
-    fillHisto(m_trackCategories,10);
-  }
-  if (TRTHit && !Ext) {
-    fillHisto(m_trackCategories,11);
-  }
-  if (TRTOut && !Ext) {
-    fillHisto(m_trackCategories,12);
+  if (SiSd || Ambi) { fillHisto(m_trackCategories,2); }
+  if (SiSd || Ambi || Ext) { fillHisto(m_trackCategories,3); }
+  if ((SiSd || Ambi) && Ext) { fillHisto(m_trackCategories,4); }
+  if (LRT) { fillHisto(m_trackCategories,5); }
+  if (LRT && Ext) { fillHisto(m_trackCategories,6); }
+  if (LRT && TRTHit) { fillHisto(m_trackCategories,7); }
+  if (LRT && TRTOut) { fillHisto(m_trackCategories,8); }
+  if (Ext && !TRTHit && !TRTOut) { fillHisto(m_trackCategories,9); }
+  if ((SiSd || Ambi) && LRT) { fillHisto(m_trackCategories,10); }
+  if (TRTHit && !Ext) { fillHisto(m_trackCategories,11); }
+  if (TRTOut && !Ext) { fillHisto(m_trackCategories,12); }
+  if (TRTOut && !Ext && !TRTSd && !TRTStdAl) { fillHisto(m_trackCategories,13); }
+  if (TRTHit) { fillHisto(m_trackCategories,14); }
+  if (TRTOut) { fillHisto(m_trackCategories,15); }
+
+  fillHisto(m_slimTrackCategories,1);
+  if (TRTHit) { fillHisto(m_slimTrackCategories,2); }
+  if (TRTOut && !TRTHit) { fillHisto(m_slimTrackCategories,3); }
+  if (!TRTOut && !TRTHit) { fillHisto(m_slimTrackCategories,4); }
+
+  //Fill 1D histograms split by TRT hits//
+
+  fillHisto(m_eta,eta);
+  fillHisto(m_tube,nTubeHits);
+  if(inRange(eta)) {
+    fillHisto(m_pt,pt);
+    fillHisto(m_phi,phi);
+    fillHisto(m_d0,d0);
+    fillHisto(m_z0,z0);
   }
-  if (TRTOut && !Ext && !TRTSd && !TRTStdAl) {
-    fillHisto(m_trackCategories,13);
+
+  if (Ext) {
+    fillHisto(m_eta_ext,eta);
+    fillHisto(m_tube_ext,nTubeHits);
+    if(inRange(eta)) {	  
+      fillHisto(m_pt_ext,pt);
+      fillHisto(m_phi_ext,phi);
+      fillHisto(m_d0_ext,d0);
+      fillHisto(m_z0_ext,z0);
+    }
   }
   if (TRTHit) {
-    fillHisto(m_trackCategories,14);
-  }
-  if (TRTOut) {
-    fillHisto(m_trackCategories,15);
+    fillHisto(m_eta_trtHit,eta);
+    fillHisto(m_tube_trtHit,nTubeHits);
+    if(inRange(eta)) {	  
+      fillHisto(m_pt_trtHit,pt);
+      fillHisto(m_eta_trtHit,eta);
+      fillHisto(m_phi_trtHit,phi);
+      fillHisto(m_d0_trtHit,d0);
+      fillHisto(m_z0_trtHit,z0);
+    }
   }
-
-  if (LRT) {
-    fillHisto(m_ld0TrackCategories,1);
+  if (TRTHit && !TRTOut) {
+    fillHisto(m_eta_trtHitNoOut,eta);
+    fillHisto(m_tube_trtHitNoOut,nTubeHits);
+    if(inRange(eta)) { 
+      fillHisto(m_pt_trtHitNoOut,pt);
+      fillHisto(m_phi_trtHitNoOut,phi);
+      fillHisto(m_d0_trtHitNoOut,d0);
+      fillHisto(m_z0_trtHitNoOut,z0);
+    }
   }
-  if (LRT && TRTHit) {
-    fillHisto(m_ld0TrackCategories,2);
+  if (TRTHit && TRTOut) {
+    fillHisto(m_eta_trtHitOut,eta);
+    fillHisto(m_tube_trtHitOut,nTubeHits);
+    if(inRange(eta)) { 
+      fillHisto(m_pt_trtHitOut,pt);
+      fillHisto(m_phi_trtHitOut,phi);
+      fillHisto(m_d0_trtHitOut,d0);
+      fillHisto(m_z0_trtHitOut,z0);
+    }
   }
-  if (LRT && TRTOut && !TRTHit) {
-    fillHisto(m_ld0TrackCategories,3);
+  if (!TRTHit && TRTOut) {
+    fillHisto(m_eta_trtOutlier,eta);
+    fillHisto(m_tube_trtOutlier,nTubeHits);
+    if(inRange(eta)) { 
+      fillHisto(m_pt_trtOutlier,pt);
+      fillHisto(m_phi_trtOutlier,phi);
+      fillHisto(m_d0_trtOutlier,d0);
+      fillHisto(m_z0_trtOutlier,z0);
+    }
   }
-  if (LRT && !TRTOut && !TRTHit) {
-    fillHisto(m_ld0TrackCategories,4);
+  if (!TRTHit && !TRTOut) {
+    fillHisto(m_eta_noTrt,eta);
+    fillHisto(m_tube_noTrt,nTubeHits);
+    if(inRange(eta)) { 
+      fillHisto(m_pt_noTrt,pt);
+      fillHisto(m_phi_noTrt,phi);
+      fillHisto(m_d0_noTrt,d0);
+      fillHisto(m_z0_noTrt,z0);
+    }
   }
 
-  if (LRT) {
-    fillHisto(m_pt_lrt,pt);
-    fillHisto(m_eta_lrt,eta);
-    fillHisto(m_phi_lrt,phi);
-    fillHisto(m_d0_lrt,d0);
-    fillHisto(m_z0_lrt,z0);
-  }
-  if (LRT && Ext) {
-    fillHisto(m_pt_lrtExt,pt);
-    fillHisto(m_eta_lrtExt,eta);
-    fillHisto(m_phi_lrtExt,phi);
-    fillHisto(m_d0_lrtExt,d0);
-    fillHisto(m_z0_lrtExt,z0);
-  }
-  if (LRT && TRTHit && !TRTOut) {
-    fillHisto(m_pt_lrtTrtHit,pt);
-    fillHisto(m_eta_lrtTrtHit,eta);
-    fillHisto(m_phi_lrtTrtHit,phi);
-    fillHisto(m_d0_lrtTrtHit,d0);
-    fillHisto(m_z0_lrtTrtHit,z0);
-  }
-  if (LRT && TRTHit && TRTOut) {
-    fillHisto(m_pt_lrtTrtHitOut,pt);
-    fillHisto(m_eta_lrtTrtHitOut,eta);
-    fillHisto(m_phi_lrtTrtHitOut,phi);
-    fillHisto(m_d0_lrtTrtHitOut,d0);
-    fillHisto(m_z0_lrtTrtHitOut,z0);
-  }
-  if (LRT && !TRTHit && TRTOut) {
-    fillHisto(m_pt_lrtTrtOutlier,pt);
-    fillHisto(m_eta_lrtTrtOutlier,eta);
-    fillHisto(m_phi_lrtTrtOutlier,phi);
-    fillHisto(m_d0_lrtTrtOutlier,d0);
-    fillHisto(m_z0_lrtTrtOutlier,z0);
+  //Fill 2D histograms//
+  // general things//
+  fillHisto(m_d0_vs_eta,d0,eta);
+
+  //trt things
+  fillHisto(m_eta_vs_nTrtTubeHits,eta,nTubeHits);
+  fillHisto(m_mu_vs_nTrtTubeHits,mu,nTubeHits);
+  fillHisto(m_nPV_vs_nTrtTubeHits,nPV,nTubeHits);
+  fillHisto(m_eta_vs_nTrtHits,eta,nTrtHits);
+  fillHisto(m_mu_vs_nTrtHits,mu,nTrtHits);
+  fillHisto(m_nPV_vs_nTrtHits,nPV,nTrtHits);
+  if(inRange(eta)) { 
+    fillHisto(m_pt_vs_nTrtTubeHits,pt,nTubeHits);
+    fillHisto(m_phi_vs_nTrtTubeHits,phi,nTubeHits);
+    fillHisto(m_d0_vs_nTrtTubeHits,d0,nTubeHits);
+    fillHisto(m_z0_vs_nTrtTubeHits,z0,nTubeHits);
+    fillHisto(m_pt_vs_nTrtHits,pt,nTrtHits);
+    fillHisto(m_phi_vs_nTrtHits,phi,nTrtHits);
+    fillHisto(m_d0_vs_nTrtHits,d0,nTrtHits);
+    fillHisto(m_z0_vs_nTrtHits,z0,nTrtHits);
+  }
+  
+
+  if(TRTHit && !TRTStdAl && !TRTSd) {
+    fillHisto(m_nTrtHit_vs_nTrtTubeHit,nTrtHits,nTubeHits);
+    fillHisto(m_nTrtHit_vs_trtTubeFrac,nTrtHits,tubeFrac);
+    fillHisto(m_eta_vs_tubeHitFrac,eta,tubeFrac);
+    fillHisto(m_mu_vs_tubeHitFrac,mu,tubeFrac);
+    fillHisto(m_nPV_vs_tubeHitFrac,nPV,tubeFrac);
+    if(inRange(eta)) {
+      fillHisto(m_pt_vs_tubeHitFrac,pt,tubeFrac);
+      fillHisto(m_phi_vs_tubeHitFrac,phi,tubeFrac);
+      fillHisto(m_d0_vs_tubeHitFrac,d0,tubeFrac);
+      fillHisto(m_z0_vs_tubeHitFrac,z0,tubeFrac);
+    }
   }
+
 }
 
 void
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrtTest.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrtTest.h
index 5c22aafd6f7611e1acdab6db3ed295a1f0a8f9b5..7f7af2f3ccda28ba4d1c8f596151966f155c82c8 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrtTest.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_TrtTest.h
@@ -17,19 +17,41 @@
 // local includes
 #include "xAODTracking/TrackParticle.h"
 #include "InDetPlotBase.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODTracking/VertexContainer.h"
 
 class InDetPerfPlot_TrtTest: public InDetPlotBase {
 public:
   InDetPerfPlot_TrtTest(InDetPlotBase *pParent, const std::string &dirName);
-  void fill(const xAOD::TrackParticle &particle);
+  void fill(const xAOD::TrackParticle &particle, const xAOD::EventInfo& ei, const xAOD::VertexContainer& pv);
 private:
+  ///////////////1D Histograms/////////////////////
+  ///////////////////general stuff/////////////////
+  TH1 *m_mu, *m_nPV;
   TH1 *m_matchProb;
-  TH1 *m_trackCategories, *m_ld0TrackCategories;
-  TH1 *m_pt_lrt, *m_pt_lrtExt, *m_pt_lrtTrtHit, *m_pt_lrtTrtOutlier, *m_pt_lrtTrtHitOut;
-  TH1 *m_eta_lrt, *m_eta_lrtExt, *m_eta_lrtTrtHit, *m_eta_lrtTrtOutlier, *m_eta_lrtTrtHitOut;
-  TH1 *m_phi_lrt, *m_phi_lrtExt, *m_phi_lrtTrtHit, *m_phi_lrtTrtOutlier, *m_phi_lrtTrtHitOut;
-  TH1 *m_d0_lrt, *m_d0_lrtExt, *m_d0_lrtTrtHit, *m_d0_lrtTrtOutlier, *m_d0_lrtTrtHitOut;
-  TH1 *m_z0_lrt, *m_z0_lrtExt, *m_z0_lrtTrtHit, *m_z0_lrtTrtOutlier, *m_z0_lrtTrtHitOut;
+  TH1 *m_trtTubeFrac;
+  ///////////////track categories//////////////////
+  TH1 *m_trackCategories,*m_slimTrackCategories;
+
+  TH1 *m_pt,*m_pt_ext,*m_pt_trtHit,*m_pt_trtHitNoOut,*m_pt_trtOutlier,*m_pt_trtHitOut,*m_pt_noTrt;
+  TH1 *m_eta,*m_eta_ext,*m_eta_trtHit,*m_eta_trtHitNoOut,*m_eta_trtOutlier,*m_eta_trtHitOut,*m_eta_noTrt;
+  TH1 *m_phi,*m_phi_ext,*m_phi_trtHit,*m_phi_trtHitNoOut,*m_phi_trtOutlier,*m_phi_trtHitOut,*m_phi_noTrt;
+  TH1 *m_d0,*m_d0_ext,*m_d0_trtHit,*m_d0_trtHitNoOut,*m_d0_trtOutlier,*m_d0_trtHitOut,*m_d0_noTrt;
+  TH1 *m_z0,*m_z0_ext,*m_z0_trtHit,*m_z0_trtHitNoOut,*m_z0_trtOutlier,*m_z0_trtHitOut,*m_z0_noTrt;
+  TH1 *m_tube,*m_tube_ext,*m_tube_trtHit,*m_tube_trtHitNoOut,*m_tube_trtOutlier,*m_tube_trtHitOut,*m_tube_noTrt;
+  ///////////split by tube fraction//////////////// ////////////not used at the moment///////////////////
+  TH1 *m_pt_tubeHitFrac_05_1,*m_eta_tubeHitFrac_05_1,*m_phi_tubeHitFrac_05_1,*m_d0_tubeHitFrac_05_1,*m_z0_tubeHitFrac_05_1;
+  TH1 *m_pt_tubeHitFrac_04_05,*m_eta_tubeHitFrac_04_05,*m_phi_tubeHitFrac_04_05,*m_d0_tubeHitFrac_04_05,*m_z0_tubeHitFrac_04_05;
+  TH1 *m_pt_tubeHitFrac_03_04,*m_eta_tubeHitFrac_03_04,*m_phi_tubeHitFrac_03_04,*m_d0_tubeHitFrac_03_04,*m_z0_tubeHitFrac_03_04;
+  TH1 *m_pt_tubeHitFrac_0_03,*m_eta_tubeHitFrac_0_03,*m_phi_tubeHitFrac_0_03,*m_d0_tubeHitFrac_0_03,*m_z0_tubeHitFrac_0_03;
+  ///////////////2D Histograms/////////////////////
+  TH2 *m_pt_vs_nTrtTubeHits,*m_eta_vs_nTrtTubeHits,*m_phi_vs_nTrtTubeHits,*m_d0_vs_nTrtTubeHits,*m_z0_vs_nTrtTubeHits,*m_mu_vs_nTrtTubeHits,*m_nPV_vs_nTrtTubeHits;
+  TH2 *m_pt_vs_nTrtHits,*m_eta_vs_nTrtHits,*m_phi_vs_nTrtHits,*m_d0_vs_nTrtHits,*m_z0_vs_nTrtHits,*m_mu_vs_nTrtHits,*m_nPV_vs_nTrtHits;
+  TH2 *m_pt_vs_tubeHitFrac,*m_eta_vs_tubeHitFrac,*m_phi_vs_tubeHitFrac,*m_d0_vs_tubeHitFrac,*m_z0_vs_tubeHitFrac,*m_mu_vs_tubeHitFrac,*m_nPV_vs_tubeHitFrac;
+  TH2 *m_nTrtHit_vs_nTrtTubeHit, *m_nTrtHit_vs_trtTubeFrac;
+
+  TH2 *m_d0_vs_eta;
+
 
   // Plot base has no default implementation of this; we use it to book the histos
   void initializePlots();
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_duplicate.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_duplicate.cxx
index dafea4849c0459a4dae8a2bdf913fe06ec99ebeb..ae7a0bb2b7aa8e6178acee0cf29bcf7e78895f40 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_duplicate.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_duplicate.cxx
@@ -177,7 +177,7 @@ InDetPerfPlot_duplicate::fillTwoMatchDuplicate(const float prob1, const float pr
   float truthPt(tp.pt() / 1000);
   float eta1(trackParticle.eta());
   float eta2(particle.eta());
-  float truthEta(tp.eta());
+  float truthEta((truthPt>1e-7)? tp.eta(): std::nanf(""));
   float phi1(trackParticle.phi());
   float phi2(particle.phi());
   float truthPhi(tp.phi());
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_fakes.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_fakes.cxx
index 47a8587c165df9aedacbb3a039ec4c346e3510c1..71440220daf5eca66b3e19a452322cce15c6773e 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_fakes.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_fakes.cxx
@@ -8,7 +8,7 @@
  **/
 
 #include "InDetPerfPlot_fakes.h"
-// #include <cmath> //for M_PI
+#include <cmath> //for std::sqrt
 
 
 InDetPerfPlot_fakes::InDetPerfPlot_fakes(InDetPlotBase *pParent, const std::string &sDir) :
@@ -227,7 +227,7 @@ InDetPerfPlot_fakes::finalizePlots() {
     ATH_MSG_INFO("InDetPerfPlot_fakes: some plots have null pointer, probably were not fully specified in the histogram definition xml file");
   }
   
-  int nPlot = 6;
+  static const int nPlot = 6;
   TH1* incTrkNum[nPlot] = {m_nTracks_vs_mu,m_nTracks_vs_mu2,m_nTracks_vs_mu3,m_incFakeNum_pt1,m_incFakeNum_pt2,m_incFakeNum_pt5};
   TH1* incTrkDenom[nPlot] = {m_nTruth_vs_mu,m_nTruth_vs_mu2,m_nTruth_vs_mu3,m_incFakeDenomEta_pt1,m_incFakeDenomEta_pt2,m_incFakeDenomEta_pt5};
   TH1* incTrk[nPlot] = {m_incTrkRate_vs_mu,m_incTrkRate_vs_mu2,m_incTrkRate_vs_mu3,m_incFakeEta_pt1,m_incFakeEta_pt2,m_incFakeEta_pt5};
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_hitEff.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_hitEff.cxx
index 366aa0cf885c51988f94da7599f61e5bd651aaab..c98408a63022ffe13c074f0611c4ce035afc77b7 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_hitEff.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_hitEff.cxx
@@ -11,13 +11,14 @@
 #include "InDetPhysHitDecoratorTool.h"
 #include "xAODTracking/TrackParticle.h"
 #include <vector>
+#include <cmath> //for std::fabs
 
 
 
 
 InDetPerfPlot_hitEff::InDetPerfPlot_hitEff(InDetPlotBase *pParent, const std::string &sDir)  : InDetPlotBase(pParent,
                                                                                                              sDir),
-  m_eff_hit_vs_eta{}, hit_DEBUG{false} {
+  m_eff_hit_vs_eta{}, m_debug{false} {
   //
 }
 
@@ -38,7 +39,7 @@ InDetPerfPlot_hitEff::initializePlots() {
 
 void
 InDetPerfPlot_hitEff::fill(const xAOD::TrackParticle &trkprt) {
-  if (hit_DEBUG) {
+  if (m_debug) {
     ATH_MSG_INFO("Filling hitEff");
   }
 
@@ -54,25 +55,18 @@ InDetPerfPlot_hitEff::fill(const xAOD::TrackParticle &trkprt) {
       const std::vector<int> &result_measureType = trkprt.auxdata< std::vector<int> >("measurement_type");
       const std::vector<int> &result_region = trkprt.auxdata< std::vector<int> >("measurement_region");
       // const std::vector<int> &result_iLayer = trkprt.auxdata< std::vector<int> >("hitResiduals_iLayer");
-      // NP: this should be fine... resiudal filled with -1 if not hit
+      // NP: this should be fine... residual filled with -1 if not hit
 
       for (unsigned int idx = 0; idx < result_region.size(); ++idx) {
-        const int measureType = result_measureType.at(idx);
-        bool isHit = false;
-        if (measureType == 0 || measureType == 4) {
-          isHit = true;
-        }
-        const int det = result_det.at(idx); // LAYER TYPE IBL / PIXEL / ...
-        const int region = result_region.at(idx); // BARREL OR ENDCAP
-        float eta = fabs(trkprt.eta());
+        const int measureType = result_measureType[idx];
+        const bool isHit((measureType == 0) or (measureType == 4));
+        const int det = result_det[idx]; // LAYER TYPE IBL / PIXEL / ...
+        const int region = result_region[idx]; // BARREL OR ENDCAP
+        float eta = std::fabs(trkprt.eta());
         if ((det == IBL && region == ENDCAP) || det == DBM) {
           continue; // IBL have no endcaps! and ignore DBM
         }
-        if (isHit) {
-          fillHisto(m_eff_hit_vs_eta[det][region],eta, 1);
-        }else {
-            fillHisto(m_eff_hit_vs_eta[det][region],eta, 0);
-        }
+        fillHisto(m_eff_hit_vs_eta[det][region],eta, int(isHit));
       }
     }
   }
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_hitEff.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_hitEff.h
index 49347bbf014f9b154358ba6a627d2ca2e7cc1b36..d530294753ad25456f43014df6f82aeebb72d97c 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_hitEff.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_hitEff.h
@@ -43,7 +43,7 @@ private:
   void initializePlots();
 
   TProfile *m_eff_hit_vs_eta[N_SUBDETECTORS][N_REGIONS];
-  bool hit_DEBUG;
+  bool m_debug;
 };
 
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_hitResidual.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_hitResidual.cxx
index a55388a977e8455697708b6d1ca16f9491d06353..8b81b26bcff426c28e4bbb0207e2ff9744bcbef4 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_hitResidual.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_hitResidual.cxx
@@ -142,7 +142,7 @@ InDetPerfPlot_hitResidual::initializePlots() {
 
 void
 InDetPerfPlot_hitResidual::fill(const xAOD::TrackParticle &trkprt) {
-  const bool hitDetailsAvailable = trkprt.isAvailable<std::vector<int> >("measurement_region");
+  const static bool hitDetailsAvailable = trkprt.isAvailable<std::vector<int> >("measurement_region");
   static int warnCount(0);
   if (!hitDetailsAvailable) {
     if (warnCount++<10){
@@ -166,20 +166,21 @@ InDetPerfPlot_hitResidual::fill(const xAOD::TrackParticle &trkprt) {
       if (result_det.size() != result_residualLocX.size()) {
         ATH_MSG_WARNING("Vectors of results are not matched in size!");
       }
-      for (unsigned int idx = 0; idx < result_region.size(); ++idx) {
-        const int measureType = result_measureType.at(idx);
+      const auto resultSize = result_region.size();
+      for (unsigned int idx = 0; idx < resultSize; ++idx) {
+        const int measureType = result_measureType[idx];
         if (measureType != 4) {
           continue; // NP: Only use unbiased hits for the hit residuals ;)
         }
-        const int det = result_det.at(idx);
-        const int region = result_region.at(idx);
+        const int det = result_det[idx];
+        const int region = result_region[idx];
         // const int layer = result_iLayer.at(idx);
-        const int width = result_phiWidth.at(idx);
-        const int etaWidth = result_etaWidth.at(idx);
-        const float residualLocX = result_residualLocX.at(idx);
-        const float pullLocX = result_pullLocX.at(idx);
-        const float residualLocY = result_residualLocY.at(idx);
-        const float pullLocY = result_pullLocY.at(idx);
+        const int width = result_phiWidth[idx];
+        const int etaWidth = result_etaWidth[idx];
+        const float residualLocX = result_residualLocX[idx];
+        const float pullLocX = result_pullLocX[idx];
+        const float residualLocY = result_residualLocY[idx];
+        const float pullLocY = result_pullLocY[idx];
         if ((det == INVALID_DETECTOR) or(region == INVALID_REGION)) {
           continue;
         }
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_res.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_res.cxx
index 1ce7547527f10197be75537461c66cb36005da72..b7278bf53149b3f25a8d261f9956be527758af0f 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_res.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_res.cxx
@@ -11,10 +11,16 @@
 #include "xAODTracking/TrackingPrimitives.h"
 #include <vector>
 #include <utility>
+#include <cmath>
 #include "TH1D.h"
 #include "TH2D.h"
 
-using namespace TMath;
+namespace{
+  constexpr float twoPi = 2*M_PI;
+
+}
+
+//using namespace TMath;
 
 InDetPerfPlot_res::InDetPerfPlot_res(InDetPlotBase *pParent, const std::string &sDir)  : InDetPlotBase(pParent, sDir),
   m_meanbasePlots(NPARAMS, nullptr),
@@ -238,9 +244,17 @@ InDetPerfPlot_res::initializePlots() {
 
 void
 InDetPerfPlot_res::fill(const xAOD::TrackParticle &trkprt, const xAOD::TruthParticle &truthprt) {
-  double truth_eta = truthprt.eta();  // eta of the truthParticle
-  double truth_pt = truthprt.pt();    // pt of the truthParticle
-  double log_trupt = Log10(truth_pt) - 3.0;
+  static const std::array<bool, NPARAMS> truthAvailable{
+    truthprt.isAvailable<float>("d0"),
+    truthprt.isAvailable<float>("z0"),
+    truthprt.isAvailable<float>("phi"),
+    truthprt.isAvailable<float>("theta"),
+    truthprt.isAvailable<float>("z0*sin(theta)"),
+    truthprt.isAvailable<float>("qOverP")}; //! Careful
+  //
+  const double truth_eta = truthprt.eta();  // eta of the truthParticle
+  const double truth_pt = truthprt.pt();    // pt of the truthParticle
+  const double log_trupt = std::log10(truth_pt) - 3.0;
 
   float truth_charge = 1;
 
@@ -250,69 +264,75 @@ InDetPerfPlot_res::fill(const xAOD::TrackParticle &trkprt, const xAOD::TruthPart
   trkParticleParams[Z0] = trkprt.z0();
   trkParticleParams[PHI] = trkprt.phi0();
   trkParticleParams[THETA] = trkprt.theta();
-  trkParticleParams[Z0SIN_THETA] = trkprt.z0() * std::sin(trkprt.theta());
+  const float trkSinTheta=std::sin(trkprt.theta()); //track sin(theta)
+  float truthSinTheta(NAN);
+  //static bool truthThetaAvailable(false), truthZ0SinTheta_OK(false), truthZ0SinThetaErr_OK(false);
+  const static bool truthThetaAvailable=truthAvailable[THETA];
+  const static bool truthZ0SinTheta_OK=(truthAvailable[Z0] and truthThetaAvailable);
+  const static bool truthZ0SinThetaErr_OK= (trkprt.isAvailable<float>("z0err") and trkprt.isAvailable<float>("thetaerr"));
+  
+  if (truthThetaAvailable){
+    truthSinTheta= std::sin(truthprt.auxdata< float >("theta"));
+  }
+  //
+  trkParticleParams[Z0SIN_THETA] = trkprt.z0() * trkSinTheta;
   // trkParticleParams[QOVERP] = trkprt.qOverP();
-  trkParticleParams[QOPT] = (trkprt.qOverP()) * 1000. / sin(trkprt.theta()); // This switches it to the "qOverPt" PRTT
+  
+  trkParticleParams[QOPT] = (trkprt.qOverP() * 1000. / trkSinTheta); // This switches it to the "qOverPt" PRTT
                                                                              // uses
 
   if (trkParticleParams[PHI] < 0) {
-    trkParticleParams[PHI] += 2 * CLHEP::pi;  // Add in the 2*pi correction for negative phi, as in PRTT
+    trkParticleParams[PHI] += twoPi;  // Add in the 2*pi correction for negative phi, as in PRTT
   }
   for (unsigned int var(0); var != NPARAMS; ++var) {
-    const std::string varName = m_paramNames.at(var);
+    const std::string varName = m_paramNames[var];
     const std::string errName = varName + std::string("err");
     float trackParameter = trkParticleParams[var];                      // needed for all of them
-    bool truthIsAvailable = truthprt.isAvailable<float>(varName);
-    if (varName == "qopt") {
-      truthIsAvailable = truthprt.isAvailable<float>("qOverP");                      // need to get q/pt to actually
-                                                                                     // fill
-    }
+    bool truthIsAvailable = truthAvailable[var];
     bool sigmaIsAvailable = trkprt.isAvailable<float>(errName);
     if (varName == "z0*sin(theta)") {
-      truthIsAvailable = (truthprt.isAvailable<float>("z0") and truthprt.isAvailable<float>("theta"));
-      sigmaIsAvailable = (trkprt.isAvailable<float>("z0err") and trkprt.isAvailable<float>("thetaerr"));
-      if (truthIsAvailable and sigmaIsAvailable){
-      //ATH_MSG_INFO("yeay! truth and sigma are available");
-      }
+      truthIsAvailable = truthZ0SinTheta_OK;
+      sigmaIsAvailable = truthZ0SinThetaErr_OK;
     }
     if (truthIsAvailable) {  // get the corresponding truth variable, only Fill if it exists
       float truthParameter = 0;
       float deviation(0);
       if (m_meanbasePlots[var]) {
         if (var == QOPT) {
-          truthParameter = (truthprt.auxdata< float >("qOverP")) * 1000. / sin(truthprt.auxdata< float >("theta"));
+          truthParameter = (truthprt.auxdata< float >("qOverP") * 1000. / truthSinTheta);
           if (truthParameter < 0) {
             truth_charge = -1;
           }
-          deviation = (trackParameter - truthParameter) * fabs(truth_pt / 1000.) * truth_charge;  // Used to match PRTT
+          deviation = (trackParameter - truthParameter) * fabs(truth_pt *0.001 ) * truth_charge;  // Used to match PRTT
                                                                                                   // version
         }else if (var == Z0SIN_THETA) {
-          truthParameter = truthprt.auxdata< float >("z0") * std::sin(truthprt.auxdata< float >("theta"));
+          truthParameter = truthprt.auxdata< float >("z0") * truthSinTheta;
           deviation = trackParameter - truthParameter;
         }else {
           truthParameter = (truthprt.auxdata< float >(varName));
           if ((var == PHI)and(truthParameter < 0)) {
-            truthParameter += 2 * CLHEP::pi; // add in 2*pi correction for negative phi, as in PRTT
+            truthParameter += twoPi; // add in 2*pi correction for negative phi, as in PRTT
           }
           deviation = trackParameter - truthParameter;
         }
         fillHisto(m_meanbasePlots[var],truth_eta, deviation);
 	      fillHisto(m_mean_vs_ptbasePlots[var],log_trupt, deviation);
-	      //ATH_MSG_INFO("Filling "<<varName<<" "<<truth_eta<<" "<<deviation);
       }
       if (sigmaIsAvailable) {
-        //ATH_MSG_INFO("sigma exists for "<<varName);
         float sigma(0);
         if (var == Z0SIN_THETA) {
           float z0_sigma = (trkprt.auxdata< float >("z0err"));
           float theta_sigma = (trkprt.auxdata< float >("thetaerr"));
-          const float theta = trkprt.theta();
-          const float cosTheta = std::cos(theta);
-          const float sinTheta = std::sin(theta);
-          const float z0 = trkprt.z0();
-          const float sigmaSq = ((z0_sigma * sinTheta) * (z0_sigma * sinTheta)) +
-                                ((z0 * theta_sigma * cosTheta) * (z0 * theta_sigma * cosTheta));
-          sigma = std::sqrt(sigmaSq);
+          //const float theta = trkprt.theta();
+          const float cosTheta = std::cos(trkParticleParams[THETA]);
+          const float sinTheta = trkSinTheta;
+          const float z0 = trkParticleParams[Z0];
+          const float term1 = z0_sigma * sinTheta;
+          const float term2 = z0 * theta_sigma * cosTheta;
+          //const float sigmaSq = ((z0_sigma * sinTheta) * (z0_sigma * sinTheta)) +
+          //                      ((z0 * theta_sigma * cosTheta) * (z0 * theta_sigma * cosTheta));
+          //sigma = std::sqrt(sigmaSq);
+          sigma=std::sqrt( (term1 * term1) + (term2 * term2) );
         } else {
           sigma = (trkprt.auxdata< float >(errName));
         }
@@ -325,7 +345,6 @@ InDetPerfPlot_res::fill(const xAOD::TrackParticle &trkprt, const xAOD::TruthPart
           }
           fillHisto(m_pullPlots[var],pull);
           fillHisto(m_pullbasePlots[var],truth_eta, pull);
-          //ATH_MSG_INFO("Filling "<<varName<<" "<<truth_eta<<" "<<pull);
         }
       }
     }// REAL END OF IF(TRUTHISAVAILABLE) STATEMENT
@@ -333,7 +352,7 @@ InDetPerfPlot_res::fill(const xAOD::TrackParticle &trkprt, const xAOD::TruthPart
 }
 
 void
-InDetPerfPlot_res::Refinement(TH1D *temp, std::string width, int var, int j, const std::vector<TH1 *> &tvec,
+InDetPerfPlot_res::Refinement(TH1D *temp, const std::string & width, int var, int j, const std::vector<TH1 *> &tvec,
                               const std::vector<TH1 *> &rvec) {
   if (temp->GetXaxis()->TestBit(TAxis::kAxisRange)) {
     // remove range if set previously
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_res.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_res.h
index cdec0d4bdc97d6be3af1ffdb3b8fc74eebfec78c..c030be9201bcdfbe29191dc47414ba31cdcedccd 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_res.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_res.h
@@ -130,7 +130,7 @@ private:
   std::vector<std::string> m_paramNames;
 
   void initializePlots();
-  void Refinement(TH1D *temp, std::string width, int var, int j, const std::vector<TH1 *> &tvec,
+  void Refinement(TH1D *temp, const std::string & width, int var, int j, const std::vector<TH1 *> &tvec,
                   const std::vector<TH1 *> &rvec);
   void finalizePlots();
 };
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.cxx
index e1aa1d10dc0fb8072a22af926b40bd4767fa1bfb..343a77db9c21ef29689e0f366e506518bd4ff2c1 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.cxx
@@ -4,31 +4,30 @@
 
 /**
  * @file InDetPerfPlot_resITk.cxx
- * @author me!  WHO?! :P
+ * @author nora pettersson
  **/
 
 #include "InDetPerfPlot_resITk.h"
-#include <iostream>
+//#include <iostream>
 #include <map>
 
-InDetPerfPlot_resITk::InDetPerfPlot_resITk(InDetPlotBase *pParent, const std::string &sDir)  :
-  InDetPlotBase(pParent, sDir),
-  m_EtaBins{},
-  m_primTrk{},
-  m_secdTrk{},
-  m_allTrk{},
-  trkP{},
-  truetrkP{},
-  trkErrP{},
-  resP{},
-  pullP{},
-  sigP{},
-  paramProp{},
+InDetPerfPlot_resITk::InDetPerfPlot_resITk(PlotBase *pParent, const std::string &sDir)  : PlotBase(pParent, sDir),
+  m_primTrk (false),
+  m_secdTrk(false),
+  m_allTrk (false),
+  m_trkP{},
+  m_truetrkP{},
+  m_trkErrP{},
+
+  m_resP{},
+  m_pullP{},
+  m_sigP{},
   m_resITk_pull{},
   m_resITk_res{},
   m_resITk_reco{},
   m_resITk_true{},
   m_resITk_sigma{},
+
   m_resITk_chargeID{},
   m_resITk_chargeID_vs_eta{},
   m_resITk_chargeID_vs_pt{},
@@ -59,29 +58,47 @@ InDetPerfPlot_resITk::InDetPerfPlot_resITk(InDetPlotBase *pParent, const std::st
   m_resITk_resHelperpt_neg{},
   m_resITk_Resolution_vs_pt_neg{},
 
-
   m_resITk_resHelperetapt{},
-  m_resITk_pullHelperpt{},
+  m_resITk_pullHelperpt{}, 
   m_resITk_pullHelpereta{},
-  
+
   m_resITk_pullResolution_vs_pt{},
   m_resITk_pullResolution_vs_eta{},
+
   m_resITk_pullProjections_vs_pt{},
   m_resITk_pullProjections_vs_eta{},
 
   m_resITk_Resolution_vs_pt_EtaBin{},
   m_resITk_Resolution_vs_eta_PtBin{},
-
   m_resITk_meanProfeta{},
   m_resITk_meanProfpt{},
   m_resITk_sigmaVsEta{},
   m_DEBUG_D0dep{},
   m_DEBUG_FirstHitR_d0{},
   m_DEBUG_NOBREM_d0{},
-  m_DEBUG_BREM_d0{} {
-  m_primTrk = false;
-  m_secdTrk = false;
-  m_allTrk = false;
+  m_DEBUG_BREM_d0{},
+
+  m_trk_chi2ndof{},
+  m_trk_chi2ndof_vs_eta{},
+  m_trk_chi2ndof_vs_totHits{},
+  m_trk_chi2ndof_vs_totHits_prob{},
+
+  m_trk_chi2{},
+  m_trk_ndof{},
+
+  m_significance_d0{},
+  m_significance_z0{},
+
+  m_significance_d0_vs_eta{},
+  m_significance_z0_vs_eta{},
+
+  m_fix_qoverpt_res{},
+  m_fix_qoverptresolutionRMS_vs_eta{},
+  m_fix_d0_res{},
+  m_fix_d0resolutionRMS_vs_eta{},
+  m_fix_z0_res{},
+  m_fix_z0resolutionRMS_vs_eta{}
+ {
   TString tsDir = (TString) sDir;
   if (tsDir.Contains("Primary")) {
     m_primTrk = true; // control if sec/prim from init
@@ -96,147 +113,142 @@ InDetPerfPlot_resITk::InDetPerfPlot_resITk(InDetPlotBase *pParent, const std::st
     m_EtaBins[ieta] = -4.0 + (8.0 / m_nEtaBins) * ieta;
   }
   // Parameter definitions
-  paramProp[D0].paraName = std::string("d0");
-  paramProp[D0].paraLabel = std::string("d_{0}");
-  paramProp[D0].paraUnit = std::string("[mm]");
-  paramProp[D0].nBinsRes = 300;
-  paramProp[D0].limRes = {
+  m_paramProp[D0].paraName = std::string("d0");
+  m_paramProp[D0].paraLabel = std::string("d_{0}");
+  m_paramProp[D0].paraUnit = std::string("[mm]");
+  m_paramProp[D0].nBinsRes = 1000;
+  m_paramProp[D0].limRes = {
     -1.5, 1.5
   };
-  paramProp[D0].nBinsPrp = 200;
-  paramProp[D0].limPrp = {
+  m_paramProp[D0].nBinsPrp = 200;
+  m_paramProp[D0].limPrp = {
     -0.4, 0.4
   };
-  paramProp[D0].nBinsSig = 200;
-  paramProp[D0].limSig = {
+  m_paramProp[D0].nBinsSig = 200;
+  m_paramProp[D0].limSig = {
     0.005, 0.04
   };
-  paramProp[D0].resUnit = std::string("[#mum]");
+  m_paramProp[D0].resUnit = std::string("[#mum]");
 
-  paramProp[Z0].paraName = std::string("z0");
-  paramProp[Z0].paraLabel = std::string("z_{0}");
-  paramProp[Z0].paraUnit = std::string("[mm]");
-  paramProp[Z0].nBinsRes = 400;
-  paramProp[Z0].limRes = {
+  m_paramProp[Z0].paraName = std::string("z0");
+  m_paramProp[Z0].paraLabel = std::string("z_{0}");
+  m_paramProp[Z0].paraUnit = std::string("[mm]");
+  m_paramProp[Z0].nBinsRes = 2000;
+  m_paramProp[Z0].limRes = {
     -10.0, 10.0
   };
-  paramProp[Z0].nBinsPrp = 200;
-  paramProp[Z0].limPrp = {
+  m_paramProp[Z0].nBinsPrp = 200;
+  m_paramProp[Z0].limPrp = {
     -150.0, 150.0
   };
-  paramProp[Z0].nBinsSig = 200;
-  paramProp[Z0].limSig = {
+  m_paramProp[Z0].nBinsSig = 200;
+  m_paramProp[Z0].limSig = {
     0.005, 0.04
   };
-  paramProp[Z0].resUnit = std::string("[#mum]");
+  m_paramProp[Z0].resUnit = std::string("[#mum]");
 
-  paramProp[Z0SIN].paraName = std::string("z0sin");
-  paramProp[Z0SIN].paraLabel = std::string("z_{0}#times sin(#theta)");
-  paramProp[Z0SIN].paraUnit = std::string("[mm]");
-  paramProp[Z0SIN].nBinsRes = 100;
-  paramProp[Z0SIN].limRes = {
+  m_paramProp[Z0SIN].paraName = std::string("z0sin");
+  m_paramProp[Z0SIN].paraLabel = std::string("z_{0}#times sin(#theta)");
+  m_paramProp[Z0SIN].paraUnit = std::string("[mm]");
+  m_paramProp[Z0SIN].nBinsRes = 1000;
+  m_paramProp[Z0SIN].limRes = {
     -0.2, 0.2
   };
-  paramProp[Z0SIN].nBinsPrp = 200;
-  paramProp[Z0SIN].limPrp = {
+  m_paramProp[Z0SIN].nBinsPrp = 200;
+  m_paramProp[Z0SIN].limPrp = {
     -150.0, 150.0
   };
-  paramProp[Z0SIN].nBinsSig = 200;
-  paramProp[Z0SIN].limSig = {
+  m_paramProp[Z0SIN].nBinsSig = 200;
+  m_paramProp[Z0SIN].limSig = {
     0.005, 0.04
   };
-  paramProp[Z0SIN].resUnit = std::string("[#mum]");
+  m_paramProp[Z0SIN].resUnit = std::string("[#mum]");
 
 
-  paramProp[QOVERP].paraName = std::string("qoverp");
-  paramProp[QOVERP].paraLabel = std::string("(q/p)");
-  paramProp[QOVERP].paraUnit = std::string("[MeV^{-1}]");
-  paramProp[QOVERP].nBinsRes = 100;
-  paramProp[QOVERP].limRes = {
+  m_paramProp[QOVERP].paraName = std::string("qoverp");
+  m_paramProp[QOVERP].paraLabel = std::string("(q/p)");
+  m_paramProp[QOVERP].paraUnit = std::string("[MeV^{-1}]");
+  m_paramProp[QOVERP].nBinsRes = 2000;
+  m_paramProp[QOVERP].limRes = {
     -2.5e-5, 2.5e-5
   };
-  paramProp[QOVERP].nBinsPrp = 200;
-  paramProp[QOVERP].limPrp = {
+  m_paramProp[QOVERP].nBinsPrp = 200;
+  m_paramProp[QOVERP].limPrp = {
     -2.5e-5, 2.5e-5
   };
-  paramProp[QOVERP].nBinsSig = 100;
-  paramProp[QOVERP].limSig = {
+  m_paramProp[QOVERP].nBinsSig = 100;
+  m_paramProp[QOVERP].limSig = {
     0.0, 1.0e-6
   };
-  paramProp[QOVERP].resUnit = std::string("[MeV^{-1}]");
-
-  paramProp[QOVERPT].paraName = std::string("qoverpt");
-  paramProp[QOVERPT].paraLabel = std::string("(q/p_{T})");
-  paramProp[QOVERPT].paraUnit = std::string("[MeV^{-1}]");
-  paramProp[QOVERPT].nBinsRes = 300;
-  paramProp[QOVERPT].limRes = {
-    -0.5e-3, 0.5e-3
+  m_paramProp[QOVERP].resUnit = std::string("[MeV^{-1}]");
+
+  m_paramProp[QOVERPT].paraName = std::string("qoverpt");
+  m_paramProp[QOVERPT].paraLabel = std::string("(1/p_{T})");
+  m_paramProp[QOVERPT].paraUnit = std::string("[MeV^{-1}]");
+  m_paramProp[QOVERPT].nBinsRes = 2000;
+  m_paramProp[QOVERPT].limRes = {
+    -15.0, 15.0
   };
-  paramProp[QOVERPT].nBinsPrp = 200;
-  paramProp[QOVERPT].limPrp = {
+  m_paramProp[QOVERPT].nBinsPrp = 200;
+  m_paramProp[QOVERPT].limPrp = {
     -1e-2, 1e-2
   };
-  paramProp[QOVERPT].nBinsSig = 100;
-  paramProp[QOVERPT].limSig = {
+  m_paramProp[QOVERPT].nBinsSig = 100;
+  m_paramProp[QOVERPT].limSig = {
     0.0, 1.0e-6
   };
-  paramProp[QOVERPT].resUnit = std::string("[MeV^{-1}]");
-
-  paramProp[THETA].paraName = std::string("theta");
-  paramProp[THETA].paraLabel = std::string("#theta");
-  paramProp[THETA].paraUnit = std::string("[rad]");
-  paramProp[THETA].nBinsRes = 200;
-  paramProp[THETA].limRes = {
-    -0.004, 0.004
+  m_paramProp[QOVERPT].resUnit = std::string("[MeV^{-1}]");
+
+  m_paramProp[THETA].paraName = std::string("theta");
+  m_paramProp[THETA].paraLabel = std::string("#theta");
+  m_paramProp[THETA].paraUnit = std::string("[rad]");
+  m_paramProp[THETA].nBinsRes = 1000;
+  m_paramProp[THETA].limRes = {
+    -0.01, 0.01
   };
-  paramProp[THETA].nBinsPrp = 200;
-  paramProp[THETA].limPrp = {
+  m_paramProp[THETA].nBinsPrp = 200;
+  m_paramProp[THETA].limPrp = {
     0.0, 3.14
   };
-  paramProp[THETA].nBinsSig = 150;
-  paramProp[THETA].limSig = {
+  m_paramProp[THETA].nBinsSig = 150;
+  m_paramProp[THETA].limSig = {
     0.0, 0.0005
   };
-  paramProp[THETA].resUnit = std::string("[mrad]");
-
-  paramProp[PHI].paraName = std::string("phi");
-  paramProp[PHI].paraLabel = std::string("#phi");
-  paramProp[PHI].paraUnit = std::string("[rad]");
-  paramProp[PHI].nBinsRes = 200;
-  paramProp[PHI].limRes = {
-    -0.02, 0.02
+  m_paramProp[THETA].resUnit = std::string("[mrad]");
+
+  m_paramProp[PHI].paraName = std::string("phi");
+  m_paramProp[PHI].paraLabel = std::string("#phi");
+  m_paramProp[PHI].paraUnit = std::string("[rad]");
+  m_paramProp[PHI].nBinsRes = 1000;
+  m_paramProp[PHI].limRes = {
+    -0.01, 0.01
   };
-  paramProp[PHI].nBinsPrp = 60;
-  paramProp[PHI].limPrp = {
+  m_paramProp[PHI].nBinsPrp = 60;
+  m_paramProp[PHI].limPrp = {
     -3.14, 3.14
   };
-  paramProp[PHI].nBinsSig = 200;
-  paramProp[PHI].limSig = {
+  m_paramProp[PHI].nBinsSig = 200;
+  m_paramProp[PHI].limSig = {
     0.0, 0.0005
   };
-  paramProp[PHI].resUnit = std::string("[mrad]");
-
-  paramProp[PT].paraName = std::string("pt");
-  paramProp[PT].paraLabel = std::string("p_{T}");
-  paramProp[PT].paraUnit = std::string("[GeV]");
-  paramProp[PT].nBinsRes = 200;
-  paramProp[PT].limRes = {
-    -2.0, 2.0
+  m_paramProp[PHI].resUnit = std::string("[mrad]");
+
+  m_paramProp[PT].paraName = std::string("pt");
+  m_paramProp[PT].paraLabel = std::string("p_{T}");
+  m_paramProp[PT].paraUnit = std::string("[GeV]");
+  m_paramProp[PT].nBinsRes = 1000;
+  m_paramProp[PT].limRes = {
+    -100.0, 100.0
   };
-  paramProp[PT].nBinsPrp = 200;
-  paramProp[PT].limPrp = {
+  m_paramProp[PT].nBinsPrp = 200;
+  m_paramProp[PT].limPrp = {
     0.0, 110.0
   };
-  paramProp[PT].nBinsSig = 200;
-  paramProp[PT].limSig = {
+  m_paramProp[PT].nBinsSig = 200;
+  m_paramProp[PT].limSig = {
     0.0, 0.1
   };
-  paramProp[PT].resUnit = std::string("[GeV]");
-}
-
-InDetPerfPlot_resITk::pCfg::pCfg() :
-  paraName{}, paraLabel{}, paraUnit{}, resUnit{}, nBinsRes{0}, limRes{}, nBinsPrp{0}, limPrp{}, nBinsSig{0}, limSig{} {
-  // nop
+  m_paramProp[PT].resUnit = std::string("[GeV]");
 }
 
 void
@@ -252,45 +264,44 @@ InDetPerfPlot_resITk::initializePlots() {
 
   for (unsigned int iparam = 0; iparam < NPARAMS; iparam++) {
     ///pull
-    std::string tmpName = "pull_" + paramProp[iparam].paraName;
-    std::string tmpTitle = tmpName + "; (" + paramProp[iparam].paraLabel + "^{reco}-" + paramProp[iparam].paraLabel +
-                           "^{true})/#sigma_{" + paramProp[iparam].paraLabel + "}";
+    std::string tmpName = "pull_" + m_paramProp[iparam].paraName;
+    std::string tmpTitle = tmpName + "; (" + m_paramProp[iparam].paraLabel + "^{reco}-" + m_paramProp[iparam].paraLabel +
+                           "^{true})/#sigma_{" + m_paramProp[iparam].paraLabel + "}";
     m_resITk_pull[iparam] = Book1D(tmpName, tmpTitle, 200, -5.0, 5.0, false);
     // res
-    tmpName = "res_" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; " + paramProp[iparam].paraLabel + "^{reco}-" + paramProp[iparam].paraLabel + "^{true} " +
-               paramProp[iparam].paraUnit;
-    m_resITk_res[iparam] = Book1D(tmpName, tmpTitle, paramProp[iparam].nBinsRes, paramProp[iparam].limRes.at(
-                                    0), paramProp[iparam].limRes.at(1), false);
+    tmpName = "res_" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; " + m_paramProp[iparam].paraLabel + "^{reco}-" + m_paramProp[iparam].paraLabel + "^{true} / " + m_paramProp[iparam].paraLabel + "^{true}";
+        //       paramProp[iparam].paraUnit;
+    m_resITk_res[iparam] = Book1D(tmpName, tmpTitle, m_paramProp[iparam].nBinsRes, m_paramProp[iparam].limRes.at(
+                                    0), m_paramProp[iparam].limRes.at(1), false);
     // reco
-    tmpName = "reco_" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; " + paramProp[iparam].paraLabel + "^{reco} " + paramProp[iparam].paraUnit;
-    m_resITk_reco[iparam] = Book1D(tmpName, tmpTitle, paramProp[iparam].nBinsPrp, paramProp[iparam].limPrp.at(
-                                     0), paramProp[iparam].limPrp.at(1), false);
+    tmpName = "reco_" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; " + m_paramProp[iparam].paraLabel + "^{reco} " + m_paramProp[iparam].paraUnit;
+    m_resITk_reco[iparam] = Book1D(tmpName, tmpTitle, m_paramProp[iparam].nBinsPrp, m_paramProp[iparam].limPrp.at(
+                                     0), m_paramProp[iparam].limPrp.at(1), false);
     // true
-    tmpName = "true_" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; " + paramProp[iparam].paraLabel + "^{true} " + paramProp[iparam].paraUnit;
-    m_resITk_true[iparam] = Book1D(tmpName, tmpTitle, paramProp[iparam].nBinsPrp, paramProp[iparam].limPrp.at(
-                                     0), paramProp[iparam].limPrp.at(1), false);
+    tmpName = "true_" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; " + m_paramProp[iparam].paraLabel + "^{true} " + m_paramProp[iparam].paraUnit;
+    m_resITk_true[iparam] = Book1D(tmpName, tmpTitle, m_paramProp[iparam].nBinsPrp, m_paramProp[iparam].limPrp.at(
+                                     0), m_paramProp[iparam].limPrp.at(1), false);
     // sigma
-    tmpName = "sigma_" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; #sigma_{" + paramProp[iparam].paraLabel + "} " + paramProp[iparam].paraUnit;
-    m_resITk_sigma[iparam] = Book1D(tmpName, tmpTitle, paramProp[iparam].nBinsSig, paramProp[iparam].limSig.at(
-                                      0), paramProp[iparam].limSig.at(1), false);
+    tmpName = "sigma_" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; #sigma_{" + m_paramProp[iparam].paraLabel + "} " + m_paramProp[iparam].paraUnit;
+    m_resITk_sigma[iparam] = Book1D(tmpName, tmpTitle, m_paramProp[iparam].nBinsSig, m_paramProp[iparam].limSig.at(
+                                      0), m_paramProp[iparam].limSig.at(1), false);
     // res versus eta
-    tmpName = "resHelpereta_" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; true track #eta; " + paramProp[iparam].paraLabel + "^{reco}-" +
-               paramProp[iparam].paraLabel + "^{true} " + paramProp[iparam].paraUnit;
+    tmpName = "resHelpereta_" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; true track #eta; " + m_paramProp[iparam].paraLabel + "^{reco}-" +
+               m_paramProp[iparam].paraLabel + "^{true} " + m_paramProp[iparam].paraUnit;
     m_resITk_resHelpereta[iparam] =
-      Book2D(tmpName, tmpTitle, nBinsEta, nMinEta, nMaxEta, paramProp[iparam].nBinsRes, paramProp[iparam].limRes.at(
-               0), paramProp[iparam].limRes.at(1), false);
+      Book2D(tmpName, tmpTitle, nBinsEta, nMinEta, nMaxEta, m_paramProp[iparam].nBinsRes, m_paramProp[iparam].limRes.at(0), m_paramProp[iparam].limRes.at(1),false);
     for (unsigned int ibins = 0; ibins < m_nEtaBins; ibins++) {
-      tmpName = "EtaProjections/resProjection_" + paramProp[iparam].paraName + std::to_string(ibins + 1);
-      tmpTitle = tmpName + "; " + paramProp[iparam].paraLabel + "^{reco}-" + paramProp[iparam].paraLabel + "^{true} " +
-                 paramProp[iparam].paraUnit;
+      tmpName = "EtaProjections_resProjection_" + m_paramProp[iparam].paraName + std::to_string(ibins + 1);
+      tmpTitle = "resProjection_" + m_paramProp[iparam].paraName + std::to_string(ibins + 1) + "; " + m_paramProp[iparam].paraLabel + "^{reco}-" + m_paramProp[iparam].paraLabel + "^{true} " +
+                 m_paramProp[iparam].paraUnit;
       m_resITk_ResProjections_vs_eta[iparam][ibins] =
-        Book1D(tmpName, tmpTitle, paramProp[iparam].nBinsRes, paramProp[iparam].limRes.at(0),
-               paramProp[iparam].limRes.at(1), false);
+        Book1D(tmpName, tmpTitle, m_paramProp[iparam].nBinsRes, m_paramProp[iparam].limRes.at(0),
+               m_paramProp[iparam].limRes.at(1), false);
     }
     std::string ytitle[4] = {
       " resolution ", " mean ", " resolution ", " mean "
@@ -300,172 +311,172 @@ InDetPerfPlot_resITk::initializePlots() {
     };
 
     for (unsigned int ires = 0; ires < m_nResHist; ires++) {
-      tmpName = paramProp[iparam].paraName + m_resHisto[ires] + "_vs_eta";
-      tmpTitle = tmpName + "; true track #eta [rad]; " + paramProp[iparam].paraLabel + ytitle[ires] +
-                 paramProp[iparam].resUnit;
+      tmpName = m_paramProp[iparam].paraName + m_resHisto[ires] + "_vs_eta";
+      tmpTitle = tmpName + "; true track #eta; " + m_paramProp[iparam].paraLabel + ytitle[ires] +
+                 m_paramProp[iparam].resUnit;
       m_resITk_Resolution_vs_eta[iparam][ires] = Book1D(tmpName, tmpTitle, m_nEtaBins, -4.0, 4.0, false);
     }
 
     
-    tmpName = "resHelpereta_pos" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; true track #eta; " + paramProp[iparam].paraLabel + "^{reco}-" +
-               paramProp[iparam].paraLabel + "^{true} " + paramProp[iparam].paraUnit;
+    tmpName = "resHelpereta_pos" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; true track #eta; " + m_paramProp[iparam].paraLabel + "^{reco}-" +
+               m_paramProp[iparam].paraLabel + "^{true} " + m_paramProp[iparam].paraUnit;
     m_resITk_resHelpereta_pos[iparam] = Book2D(tmpName, tmpTitle, nBinsEta, nMinEta, nMaxEta,
-                                               paramProp[iparam].nBinsRes, paramProp[iparam].limRes.at(0),
-                                               paramProp[iparam].limRes.at(1), false);
+                                               m_paramProp[iparam].nBinsRes, m_paramProp[iparam].limRes.at(0),
+                                               m_paramProp[iparam].limRes.at(1),false);
     for (unsigned int ires = 0; ires < m_nResHist; ires++) {
-      tmpName = paramProp[iparam].paraName + m_resHisto[ires] + "_vs_eta_pos";
-      tmpTitle = tmpName + "; true track #eta [rad]; " + paramProp[iparam].paraLabel + ytitle[ires] +
-                 paramProp[iparam].resUnit;
+      tmpName = m_paramProp[iparam].paraName + m_resHisto[ires] + "_vs_eta_pos";
+      tmpTitle = tmpName + "; true track #eta; " + m_paramProp[iparam].paraLabel + ytitle[ires] +
+                 m_paramProp[iparam].resUnit;
       m_resITk_Resolution_vs_eta_pos[iparam][ires] = Book1D(tmpName, tmpTitle, m_nEtaBins, -4.0, 4.0, false);
     }
-    tmpName = "resHelpereta_neg" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; true track #eta; " + paramProp[iparam].paraLabel + "^{reco}-" +
-               paramProp[iparam].paraLabel + "^{true} " + paramProp[iparam].paraUnit;
+    tmpName = "resHelpereta_neg" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; true track #eta; " + m_paramProp[iparam].paraLabel + "^{reco}-" +
+               m_paramProp[iparam].paraLabel + "^{true} " + m_paramProp[iparam].paraUnit;
     m_resITk_resHelpereta_neg[iparam] = Book2D(tmpName, tmpTitle, nBinsEta, nMinEta, nMaxEta,
-                                               paramProp[iparam].nBinsRes, paramProp[iparam].limRes.at(0),
-                                               paramProp[iparam].limRes.at(1), false);
+                                               m_paramProp[iparam].nBinsRes, m_paramProp[iparam].limRes.at(0),
+                                               m_paramProp[iparam].limRes.at(1),false);
     for (unsigned int ires = 0; ires < m_nResHist; ires++) {
-      tmpName = paramProp[iparam].paraName + m_resHisto[ires] + "_vs_eta_neg";
-      tmpTitle = tmpName + "; true track #eta [rad]; " + paramProp[iparam].paraLabel + ytitle[ires] +
-                 paramProp[iparam].resUnit;
+      tmpName = m_paramProp[iparam].paraName + m_resHisto[ires] + "_vs_eta_neg";
+      tmpTitle = tmpName + "; true track #eta; " + m_paramProp[iparam].paraLabel + ytitle[ires] +
+                 m_paramProp[iparam].resUnit;
       m_resITk_Resolution_vs_eta_neg[iparam][ires] = Book1D(tmpName, tmpTitle, m_nEtaBins, -4.0, 4.0, false);
     }
 
     // res versus pt
-    tmpName = "resHelperpt_" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; true track p_{T} [GeV]; " + paramProp[iparam].paraLabel + "^{reco}-" +
-               paramProp[iparam].paraLabel + "^{true} " + paramProp[iparam].paraUnit;
+    tmpName = "resHelperpt_" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; true track p_{T} [GeV]; " + m_paramProp[iparam].paraLabel + "^{reco}-" +
+               m_paramProp[iparam].paraLabel + "^{true} " + m_paramProp[iparam].paraUnit;
     m_resITk_resHelperpt[iparam] =
-      Book2D(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, paramProp[iparam].nBinsRes, paramProp[iparam].limRes.at(
-               0), paramProp[iparam].limRes.at(1), false);
-    tmpName = "pullHelperpt_" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; true track p_{T} [GeV]; (" + paramProp[iparam].paraLabel + "^{reco}-" +
-               paramProp[iparam].paraLabel + "^{true})/#sigma_{" + paramProp[iparam].paraLabel + "}";
-    m_resITk_pullHelperpt[iparam] = Book2D(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, 200, -10.0, 10.0, false);
+      Book2D(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, m_paramProp[iparam].nBinsRes, m_paramProp[iparam].limRes.at(
+               0), m_paramProp[iparam].limRes.at(1),false);
+    tmpName = "pullHelperpt_" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; true track p_{T} [GeV]; (" + m_paramProp[iparam].paraLabel + "^{reco}-" +
+               m_paramProp[iparam].paraLabel + "^{true})/#sigma_{" + m_paramProp[iparam].paraLabel + "}";
+    m_resITk_pullHelperpt[iparam] = Book2D(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, 200, -10.0, 10.0,false);
 
-    tmpName = "pullHelpereta_" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; true track #eta; (" + paramProp[iparam].paraLabel + "^{reco}-" +
-               paramProp[iparam].paraLabel + "^{true})/#sigma_{" + paramProp[iparam].paraLabel + "}";
-    m_resITk_pullHelpereta[iparam] = Book2D(tmpName, tmpTitle, nBinsEta, nMinEta, nMaxEta, 200, -10.0, 10.0, false);
+    tmpName = "pullHelpereta_" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; true track #eta; (" + m_paramProp[iparam].paraLabel + "^{reco}-" +
+               m_paramProp[iparam].paraLabel + "^{true})/#sigma_{" + m_paramProp[iparam].paraLabel + "}";
+    m_resITk_pullHelpereta[iparam] = Book2D(tmpName, tmpTitle, nBinsEta, nMinEta, nMaxEta, 200, -10.0, 10.0,false);
 
 
     for (unsigned int ires = 0; ires < m_nResHist; ires++) {
-      tmpName = paramProp[iparam].paraName + "pull" + m_resHisto[ires] + "_vs_pt";
-      tmpTitle = tmpName + "; true track p_{T} [GeV]; " + paramProp[iparam].paraLabel + ytitlePull[ires];
+      tmpName = m_paramProp[iparam].paraName + "pull" + m_resHisto[ires] + "_vs_pt";
+      tmpTitle = tmpName + "; true track p_{T} [GeV]; " + m_paramProp[iparam].paraLabel + ytitlePull[ires];
       m_resITk_pullResolution_vs_pt[iparam][ires] = Book1D(tmpName, tmpTitle, m_nPtBins, 0., 50.0, false);
       m_resITk_pullResolution_vs_pt[iparam][ires]->GetXaxis()->Set(m_nPtBins, m_PtBins);
     }
 
     for (unsigned int ires = 0; ires < m_nResHist; ires++) {
-      tmpName = paramProp[iparam].paraName + "pull" + m_resHisto[ires] + "_vs_eta";
-      tmpTitle = tmpName + "; true track #eta; " + paramProp[iparam].paraLabel + ytitlePull[ires];
+      tmpName = m_paramProp[iparam].paraName + "pull" + m_resHisto[ires] + "_vs_eta";
+      tmpTitle = tmpName + "; true track #eta; " + m_paramProp[iparam].paraLabel + ytitlePull[ires];
       m_resITk_pullResolution_vs_eta[iparam][ires] = Book1D(tmpName, tmpTitle, m_nEtaBins, 0., 50.0, false);
       m_resITk_pullResolution_vs_eta[iparam][ires]->GetXaxis()->Set(m_nEtaBins, m_EtaBins);
     }
 
 
     for (unsigned int ibins = 0; ibins < m_nPtBins; ibins++) {
-      tmpName = "PtPullProjections/pullProjection_" + paramProp[iparam].paraName + std::to_string(ibins + 1);
-      tmpTitle = tmpName + "; (" + paramProp[iparam].paraLabel + "^{reco}-" + paramProp[iparam].paraLabel +
-                 "^{true})/#sigma_{" + paramProp[iparam].paraLabel + "}";
+      tmpName = "PtPullProjections/pullProjection_" + m_paramProp[iparam].paraName + std::to_string(ibins + 1);
+      tmpTitle = tmpName + "; (" + m_paramProp[iparam].paraLabel + "^{reco}-" + m_paramProp[iparam].paraLabel +
+                 "^{true})/#sigma_{" + m_paramProp[iparam].paraLabel + "}";
       m_resITk_pullProjections_vs_pt[iparam][ibins] = Book1D(tmpName, tmpTitle, 200, -10.0, 10.0, false);
     }
 
     for (unsigned int ibins = 0; ibins < m_nEtaBins; ibins++) {
-      tmpName = "EtaPullProjections/pullProjection_" + paramProp[iparam].paraName + std::to_string(ibins + 1);
-      tmpTitle = tmpName + "; (" + paramProp[iparam].paraLabel + "^{reco}-" + paramProp[iparam].paraLabel +
-                 "^{true})/#sigma_{" + paramProp[iparam].paraLabel + "}";
+      tmpName = "EtaPullProjections/pullProjection_" + m_paramProp[iparam].paraName + std::to_string(ibins + 1);
+      tmpTitle = tmpName + "; (" + m_paramProp[iparam].paraLabel + "^{reco}-" + m_paramProp[iparam].paraLabel +
+                 "^{true})/#sigma_{" + m_paramProp[iparam].paraLabel + "}";
       m_resITk_pullProjections_vs_eta[iparam][ibins] = Book1D(tmpName, tmpTitle, 200, -10.0, 10.0, false);
     }
     for (unsigned int ibins = 0; ibins < m_nPtBins; ibins++) {
-      tmpName = "PtProjections/resProjection_" + paramProp[iparam].paraName + std::to_string(ibins + 1);
-      tmpTitle = tmpName + "; " + paramProp[iparam].paraLabel + "^{reco}-" + paramProp[iparam].paraLabel + "^{true} " +
-                 paramProp[iparam].paraUnit;
+      tmpName = "PtProjections/resProjection_" + m_paramProp[iparam].paraName + std::to_string(ibins + 1);
+      tmpTitle = tmpName + "; " + m_paramProp[iparam].paraLabel + "^{reco}-" + m_paramProp[iparam].paraLabel + "^{true} " +
+                 m_paramProp[iparam].paraUnit;
       m_resITk_ResProjections_vs_pt[iparam][ibins] =
-        Book1D(tmpName, tmpTitle, paramProp[iparam].nBinsRes, paramProp[iparam].limRes.at(0),
-               paramProp[iparam].limRes.at(1), false);
+        Book1D(tmpName, tmpTitle, m_paramProp[iparam].nBinsRes, m_paramProp[iparam].limRes.at(0),
+               m_paramProp[iparam].limRes.at(1), false);
     }
     for (unsigned int ires = 0; ires < m_nResHist; ires++) {
-      tmpName = paramProp[iparam].paraName + m_resHisto[ires] + "_vs_pt";
-      tmpTitle = tmpName + "; true track p_{T} [GeV]; " + paramProp[iparam].paraLabel + ytitle[ires] +
-                 paramProp[iparam].resUnit;
+      tmpName = m_paramProp[iparam].paraName + m_resHisto[ires] + "_vs_pt";
+      tmpTitle = tmpName + "; true track p_{T} [GeV]; " + m_paramProp[iparam].paraLabel + ytitle[ires] +
+                 m_paramProp[iparam].resUnit;
       m_resITk_Resolution_vs_pt[iparam][ires] = Book1D(tmpName, tmpTitle, m_nPtBins, 0., 50.0, false);
       m_resITk_Resolution_vs_pt[iparam][ires]->GetXaxis()->Set(m_nPtBins, m_PtBins);
     }
-    tmpName = "resHelperpt_pos" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; true track p_{T} [GeV]; " + paramProp[iparam].paraLabel + "^{reco}-" +
-               paramProp[iparam].paraLabel + "^{true} " + paramProp[iparam].paraUnit;
+    tmpName = "resHelperpt_pos" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; true track p_{T} [GeV]; " + m_paramProp[iparam].paraLabel + "^{reco}-" +
+               m_paramProp[iparam].paraLabel + "^{true} " + m_paramProp[iparam].paraUnit;
     m_resITk_resHelperpt_pos[iparam] =
-      Book2D(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, paramProp[iparam].nBinsRes, paramProp[iparam].limRes.at(
-               0), paramProp[iparam].limRes.at(1), false);
+      Book2D(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, m_paramProp[iparam].nBinsRes, m_paramProp[iparam].limRes.at(
+               0), m_paramProp[iparam].limRes.at(1),false);
     for (unsigned int ires = 0; ires < m_nResHist; ires++) {
-      tmpName = paramProp[iparam].paraName + m_resHisto[ires] + "_vs_pt_pos";
-      tmpTitle = tmpName + "; true track p_{T} [GeV]; " + paramProp[iparam].paraLabel + ytitle[ires] +
-                 paramProp[iparam].resUnit;
+      tmpName = m_paramProp[iparam].paraName + m_resHisto[ires] + "_vs_pt_pos";
+      tmpTitle = tmpName + "; true track p_{T} [GeV]; " + m_paramProp[iparam].paraLabel + ytitle[ires] +
+                 m_paramProp[iparam].resUnit;
       m_resITk_Resolution_vs_pt_pos[iparam][ires] = Book1D(tmpName, tmpTitle, m_nPtBins, 0., 50.0, false);
       m_resITk_Resolution_vs_pt_pos[iparam][ires]->GetXaxis()->Set(m_nPtBins, m_PtBins);
     }
-    tmpName = "resHelperpt_neg" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; true track p_{T} [GeV]; " + paramProp[iparam].paraLabel + "^{reco}-" +
-               paramProp[iparam].paraLabel + "^{true} " + paramProp[iparam].paraUnit;
+    tmpName = "resHelperpt_neg" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; true track p_{T} [GeV]; " + m_paramProp[iparam].paraLabel + "^{reco}-" +
+               m_paramProp[iparam].paraLabel + "^{true} " + m_paramProp[iparam].paraUnit;
     m_resITk_resHelperpt_neg[iparam] =
-      Book2D(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, paramProp[iparam].nBinsRes, paramProp[iparam].limRes.at(
-               0), paramProp[iparam].limRes.at(1), false);
+      Book2D(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, m_paramProp[iparam].nBinsRes, m_paramProp[iparam].limRes.at(
+               0), m_paramProp[iparam].limRes.at(1),false);
     for (unsigned int ires = 0; ires < m_nResHist; ires++) {
-      tmpName = paramProp[iparam].paraName + m_resHisto[ires] + "_vs_pt_neg";
-      tmpTitle = tmpName + "; true track p_{T} [GeV]; " + paramProp[iparam].paraLabel + ytitle[ires] +
-                 paramProp[iparam].resUnit;
+      tmpName = m_paramProp[iparam].paraName + m_resHisto[ires] + "_vs_pt_neg";
+      tmpTitle = tmpName + "; true track p_{T} [GeV]; " + m_paramProp[iparam].paraLabel + ytitle[ires] +
+                 m_paramProp[iparam].resUnit;
       m_resITk_Resolution_vs_pt_neg[iparam][ires] = Book1D(tmpName, tmpTitle, m_nPtBins, 0., 50.0, false);
       m_resITk_Resolution_vs_pt_neg[iparam][ires]->GetXaxis()->Set(m_nPtBins, m_PtBins);
     }
     // res versus eta pt
-    tmpName = "resHelperetapt_" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; true track p_{T}; true track #eta; " + paramProp[iparam].paraLabel + "^{reco}-" +
-               paramProp[iparam].paraLabel + "^{true} " + paramProp[iparam].paraUnit;
+    tmpName = "resHelperetapt_" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; true track p_{T}; true track #eta; " + m_paramProp[iparam].paraLabel + "^{reco}-" +
+               m_paramProp[iparam].paraLabel + "^{true} " + m_paramProp[iparam].paraUnit;
     m_resITk_resHelperetapt[iparam] = Book3D(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, nBinsEta, nMinEta, nMaxEta,
-                                             paramProp[iparam].nBinsRes, paramProp[iparam].limRes.at(0),
-                                             paramProp[iparam].limRes.at(1), false);
+                                             m_paramProp[iparam].nBinsRes, m_paramProp[iparam].limRes.at(0),
+                                             m_paramProp[iparam].limRes.at(1), false);
 
     for (unsigned int ires = 0; ires < 2; ires++) {
       for (int ibin = 0; ibin < 4; ibin++) {
         int tmpInt = ibin + 1;
-        tmpName = paramProp[iparam].paraName + m_resHisto[ires] + "_vs_pt_EtaBin" + std::to_string(tmpInt);
-        tmpTitle = tmpName + "; true track p_{T} [GeV]; " + paramProp[iparam].paraLabel + ytitle[ires] +
-                   paramProp[iparam].resUnit;
+        tmpName = m_paramProp[iparam].paraName + m_resHisto[ires] + "_vs_pt_EtaBin" + std::to_string(tmpInt);
+        tmpTitle = tmpName + "; true track p_{T} [GeV]; " + m_paramProp[iparam].paraLabel + ytitle[ires] +
+                   m_paramProp[iparam].resUnit;
         m_resITk_Resolution_vs_pt_EtaBin[iparam][ibin][ires] = Book1D(tmpName, tmpTitle, m_nPtBins, 0., 50.0, false);
         m_resITk_Resolution_vs_pt_EtaBin[iparam][ibin][ires]->GetXaxis()->Set(m_nPtBins, m_PtBins);
       }
       for (int iPtBin = 0; iPtBin < 4; iPtBin++) {
-        tmpName = paramProp[iparam].paraName + m_resHisto[ires] + "_vs_eta_PtBin" + std::to_string(iPtBin + 1);
-        tmpTitle = tmpName + "; true track #eta; " + paramProp[iparam].paraLabel + ytitle[ires] +
-                   paramProp[iparam].resUnit;
+        tmpName = m_paramProp[iparam].paraName + m_resHisto[ires] + "_vs_eta_PtBin" + std::to_string(iPtBin + 1);
+        tmpTitle = tmpName + "; true track #eta; " + m_paramProp[iparam].paraLabel + ytitle[ires] +
+                   m_paramProp[iparam].resUnit;
         m_resITk_Resolution_vs_eta_PtBin[iparam][iPtBin][ires] =
           Book1D(tmpName, tmpTitle, m_nEtaBins, -4.0, 4.0, false);
       }
     }
 
-    tmpName = "meanProfeta_" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; true track #eta; #sigma_{" + paramProp[iparam].paraLabel + "} " +
-               paramProp[iparam].paraUnit;
+    tmpName = "meanProfeta_" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; true track #eta; #sigma_{" + m_paramProp[iparam].paraLabel + "} " +
+               m_paramProp[iparam].paraUnit;
     m_resITk_meanProfeta[iparam] = BookTProfile(tmpName, tmpTitle, nBinsEta, nMinEta, nMaxEta, -1.0, 1.0, false);
 
-    tmpName = "SigmaVsEta_" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; true track #eta; #sigma_{" + paramProp[iparam].paraLabel + "} " +
-               paramProp[iparam].paraUnit;
-    m_resITk_sigmaVsEta[iparam] = Book2D(tmpName, tmpTitle, nBinsEta, nMinEta, nMaxEta, paramProp[iparam].nBinsSig,
+    tmpName = "SigmaVsEta_" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; true track #eta; #sigma_{" + m_paramProp[iparam].paraLabel + "} " +
+               m_paramProp[iparam].paraUnit;
+    m_resITk_sigmaVsEta[iparam] = Book2D(tmpName, tmpTitle, nBinsEta, nMinEta, nMaxEta, m_paramProp[iparam].nBinsSig,
                                          -1.0, 1.0, false);
 
-    tmpName = "meanProfpt_" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; true track p_{T}; #sigma_{" + paramProp[iparam].paraLabel + "} " +
-               paramProp[iparam].paraUnit;
+    tmpName = "meanProfpt_" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; true track p_{T}; #sigma_{" + m_paramProp[iparam].paraLabel + "} " +
+               m_paramProp[iparam].paraUnit;
     m_resITk_meanProfpt[iparam] = BookTProfile(tmpName, tmpTitle, nBinsPt, nMinPt, nMaxPt, -1.0, 1.0, false);
     m_resITk_meanProfpt[iparam]->GetXaxis()->Set(m_nPtBins, m_PtBins);
 
-    tmpName = "DEBUG_D0dep_" + paramProp[iparam].paraName;
-    tmpTitle = tmpName + "; " + paramProp[iparam].paraLabel + "^{reco} " + paramProp[iparam].paraUnit + "; d_{0} [mm]";
-    m_DEBUG_D0dep[iparam] = BookTProfile(tmpName, tmpTitle, paramProp[iparam].nBinsPrp, paramProp[iparam].limPrp.at(
-                                           0), paramProp[iparam].limPrp.at(1), -0.1, 0.1, false);
+    tmpName = "DEBUG_D0dep_" + m_paramProp[iparam].paraName;
+    tmpTitle = tmpName + "; " + m_paramProp[iparam].paraLabel + "^{reco} " + m_paramProp[iparam].paraUnit + "; d_{0} [mm]";
+    m_DEBUG_D0dep[iparam] = BookTProfile(tmpName, tmpTitle, m_paramProp[iparam].nBinsPrp, m_paramProp[iparam].limPrp.at(
+                                           0), m_paramProp[iparam].limPrp.at(1), -0.1, 0.1, false);
   }
 
   m_resITk_chargeID = Book1D("chargeID", "chargeID", 2, 0., 2., false);
@@ -495,13 +506,86 @@ InDetPerfPlot_resITk::initializePlots() {
   m_resITk_momTail_Frac = Book1D("momTail_Frac", "momTail_Frac; (p^{reco}_{T}-p^{true}_{T})/p^{true}_{T}", 100, 0.,
                                  100., false);
 
-  m_DEBUG_BREM_d0 = Book1D("DEBUG_BREM_d0", "DEBUG_BREM_d0; d_{0} [mm]", paramProp[D0].nBinsPrp, paramProp[D0].limPrp.at(
-                             0), paramProp[D0].limPrp.at(1), false);
-  m_DEBUG_NOBREM_d0 = Book1D("DEBUG_NOBREM_d0", "DEBUG_NOBREM_d0; d_{0} [mm]", paramProp[D0].nBinsPrp, paramProp[D0].limPrp.at(
-                               0), paramProp[D0].limPrp.at(1), false);
+  m_DEBUG_BREM_d0 = Book1D("DEBUG_BREM_d0", "DEBUG_BREM_d0; d_{0} [mm]", m_paramProp[D0].nBinsPrp, m_paramProp[D0].limPrp.at(
+                             0), m_paramProp[D0].limPrp.at(1), false);
+  m_DEBUG_NOBREM_d0 = Book1D("DEBUG_NOBREM_d0", "DEBUG_NOBREM_d0; d_{0} [mm]", m_paramProp[D0].nBinsPrp, m_paramProp[D0].limPrp.at(
+                               0), m_paramProp[D0].limPrp.at(1), false);
 
   m_DEBUG_FirstHitR_d0 =
     BookTProfile("DEBUG_FirstHitR_d0", "DEBUG_FirstHitR_d0; R [mm]", 150, 0., 10., -1.0, 1.0, false);
+
+  m_trk_chi2ndof = Book1D("trk_chi2ndof","trk_chi2ndof; #chi_{0}/ndof", 200, 0., 20,false);
+  m_trk_chi2 = Book1D("trk_chi2","trk_chi2; #chi^{2}/ndof", 200, 0., 200,false);
+  m_trk_ndof = Book1D("trk_ndof","trk_ndof; #chi^{2}/ndof", 200, 0., 200,false);
+  m_trk_chi2ndof_vs_eta = BookTProfile("trk_chi2ndof_vs_eta","trk_chi2ndof_vs_eta; #eta; #chi^{2}/ndof", nBinsEta, nMinEta, nMaxEta, -1.0, 1.0, false);
+  m_trk_chi2ndof_vs_totHits = BookTProfile("trk_chi2ndof_vs_totHits","trk_chi2ndof_vs_totHits; number of Total Hits; #chi^{2}/ndof", 30, 0, 30, -1.0, 1.0, false);
+  m_trk_chi2ndof_vs_totHits_prob = BookTProfile("trk_chi2ndof_vs_totHits_prob","trk_chi2ndof_vs_totHits_prob; number of Total Hits; #chi^{2}/ndof", 30, 0, 30, -1.0, 1.0, false);
+
+  m_significance_d0 = Book2D("significance_d0","d0 significance w.r.t pv; #eta; d_{0}/#sigma_{d_{0}}",320,-4.0,4.0,150,-5.0,5.0,false);
+  m_significance_z0 = Book2D("significance_z0","z0 significance w.r.t pv; #eta; z_{0}/#sigma_{z_{0}}",320,-4.0,4.0,150,-5.0,5.0,false);
+
+  m_significance_d0_vs_eta = Book1D("significance_d0_vs_eta","d0 significance with w.r.t pv; #eta; d_{0} sign width",m_nEtaBins,-4.0,4.0,false);
+  m_significance_z0_vs_eta = Book1D("significance_z0_vs_eta","z0 significance with w.r.t pv; #eta; z_{0} sign width",m_nEtaBins,-4.0,4.0,false);
+
+//tmp fix for pT resolution
+  //16 eta bins
+  std::string fixName = "fix_qoverpt_res1";
+  m_fix_qoverpt_res[0] = Book1D(fixName,fixName,600,-15.0,15.0,false);
+  fixName = "fix_qoverpt_res2";
+  m_fix_qoverpt_res[1] = Book1D(fixName,fixName,600,-5.0,5.0,false);
+  fixName = "fix_qoverpt_res3";
+  m_fix_qoverpt_res[2] = Book1D(fixName,fixName,600,-2.0,2.0,false);
+  fixName = "fix_qoverpt_res4";
+  m_fix_qoverpt_res[3] = Book1D(fixName,fixName,600,-1.0,1.0,false);
+  fixName = "fix_qoverpt_res5";
+  m_fix_qoverpt_res[4] = Book1D(fixName,fixName,600,-1.0,1.0,false);
+  fixName = "fix_qoverpt_res6";
+  m_fix_qoverpt_res[5] = Book1D(fixName,fixName,600,-0.5,0.5,false);
+  fixName = "fix_qoverpt_res7";
+  m_fix_qoverpt_res[6] = Book1D(fixName,fixName,600,-0.2,0.2,false);
+  fixName = "fix_qoverpt_res8";
+  m_fix_qoverpt_res[7] = Book1D(fixName,fixName,600,-0.2,0.2,false);
+
+  fixName = "fix_qoverpt_res16";
+  m_fix_qoverpt_res[15] = Book1D(fixName,fixName,600,-15.0,15.0,false);
+  fixName = "fix_qoverpt_res15";
+  m_fix_qoverpt_res[14] = Book1D(fixName,fixName,600,-5.0,5.0,false);
+  fixName = "fix_qoverpt_res14";
+  m_fix_qoverpt_res[13] = Book1D(fixName,fixName,600,-2.0,2.0,false);
+  fixName = "fix_qoverpt_res13";
+  m_fix_qoverpt_res[12] = Book1D(fixName,fixName,600,-1.0,1.0,false);
+  fixName = "fix_qoverpt_res12";
+  m_fix_qoverpt_res[11] = Book1D(fixName,fixName,600,-1.0,1.0,false);
+  fixName = "fix_qoverpt_res11";
+  m_fix_qoverpt_res[10] = Book1D(fixName,fixName,600,-0.5,0.5,false);
+  fixName = "fix_qoverpt_res10";
+  m_fix_qoverpt_res[9] = Book1D(fixName,fixName,600,-0.2,0.2,false);
+  fixName = "fix_qoverpt_res9";
+  m_fix_qoverpt_res[8] = Book1D(fixName,fixName,600,-0.2,0.2,false);
+
+  m_fix_qoverptresolutionRMS_vs_eta = Book1D("fix_qoverptresolutionRMS_vs_eta","fix_qoverptresolutionRMS_vseta; true particle #eta; p_{T} #times #sigma(1/p_{T})",m_nEtaBins, -4.0, 4.0, false);
+
+
+
+  float rangesd0[16] = { 1.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
+                         1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.5 };
+
+  float rangesz0[16] = { 10.0, 10.0, 8.0, 6.0, 6.0, 4.0, 3.0, 2.0,
+                         2.0, 3.0, 4.0, 6.0, 6.0, 8.0, 10.0, 10.0 };
+
+  for(int ieta = 0; ieta < 16; ieta++){
+    fixName = "fix_d0_res" + std::to_string(ieta+1);
+    m_fix_d0_res[ieta] = Book1D(fixName,fixName,600,-rangesd0[ieta],rangesd0[ieta],false);
+  }
+  m_fix_d0resolutionRMS_vs_eta = Book1D("fix_d0resolutionRMS_vs_eta","fix_d0resolutionRMS_vs_eta; true particle #eta; #sigma(d_{0}) [#mum]",m_nEtaBins,-4.0,4.0,false);
+
+
+  for(int ieta = 0; ieta < 16; ieta++){
+    fixName = "fix_z0_res" + std::to_string(ieta+1);
+    m_fix_z0_res[ieta] = Book1D(fixName,fixName,600,-rangesz0[ieta],rangesz0[ieta],false);
+  }
+  m_fix_z0resolutionRMS_vs_eta = Book1D("fix_z0resolutionRMS_vs_eta","fix_z0resolutionRMS_vs_eta; true particle #eta; #sigma(z_{0}) [#mum]",m_nEtaBins,-4.0,4.0,false);
+
 }
 
 void
@@ -536,75 +620,109 @@ InDetPerfPlot_resITk::fill(const xAOD::TrackParticle &trkprt, const xAOD::TruthP
   getTrackParameters(truthprt);
   getPlotParameters();
   getPlots();
+  uint8_t iPixHits, iSCTHits;
+
+  int pixHits = 0;
+  int sctHits = 0;
+  if (trkprt.summaryValue(iPixHits, xAOD::numberOfPixelHits)) {
+    pixHits = iPixHits;
+  }
+  if (trkprt.summaryValue(iSCTHits, xAOD::numberOfSCTHits)) {
+    sctHits = iSCTHits;
+  }
+  float chi2ndof = 1e-7;
+  if(trkprt.chiSquared()/trkprt.numberDoF() > chi2ndof) chi2ndof = trkprt.chiSquared()/trkprt.numberDoF(); 
+  m_trk_chi2ndof->Fill(chi2ndof);
+  m_trk_chi2ndof_vs_eta->Fill(trkprt.eta(),chi2ndof);
+  m_trk_chi2ndof_vs_totHits->Fill(pixHits+sctHits,chi2ndof);
+  m_trk_chi2ndof_vs_totHits_prob->Fill(pixHits+sctHits,TMath::Prob(trkprt.chiSquared(),trkprt.numberDoF()));
+
+  m_trk_chi2->Fill(trkprt.chiSquared());
+  m_trk_ndof->Fill(trkprt.numberDoF());
+
 }
 
 void
 InDetPerfPlot_resITk::getPlots() {
-  float eta = -TMath::Log(TMath::Tan(truetrkP[THETA] / 2));
+  float eta = -TMath::Log(TMath::Tan(m_truetrkP[THETA] / 2));
 
   for (unsigned int iparam = 0; iparam < NPARAMS; iparam++) {
-    fillHisto(m_resITk_pull[iparam],pullP[iparam]);
-    fillHisto(m_resITk_res[iparam],resP[iparam]);
-    fillHisto(m_resITk_reco[iparam],trkP[iparam]);
-    fillHisto(m_resITk_true[iparam],truetrkP[iparam]);
-    fillHisto(m_resITk_sigma[iparam],sigP[iparam]);
-
-    fillHisto(m_resITk_meanProfeta[iparam],eta, sigP[iparam]);
-    fillHisto(m_resITk_sigmaVsEta[iparam],eta, sigP[iparam]);
-
-    fillHisto(m_resITk_meanProfpt[iparam],truetrkP[PT], sigP[iparam]);
-    fillHisto(m_resITk_resHelpereta[iparam],eta, resP[iparam]);
-    fillHisto(m_resITk_resHelperpt[iparam],truetrkP[PT], resP[iparam]);
-    fillHisto(m_resITk_resHelperetapt[iparam],truetrkP[PT], eta, resP[iparam]);
-
-    fillHisto(m_resITk_pullHelperpt[iparam],truetrkP[PT], pullP[iparam]);
-    fillHisto(m_resITk_pullHelpereta[iparam],eta, pullP[iparam]);
-
-    if (trkP[QOVERP] >= 0.) {
-      fillHisto(m_resITk_resHelpereta_pos[iparam],eta, resP[iparam]);
-      fillHisto(m_resITk_resHelperpt_pos[iparam],truetrkP[PT], resP[iparam]);
+    m_resITk_pull[iparam]->Fill(m_pullP[iparam]);
+    m_resITk_res[iparam]->Fill(m_resP[iparam]);
+    m_resITk_reco[iparam]->Fill(m_trkP[iparam]);
+    m_resITk_true[iparam]->Fill(m_truetrkP[iparam]);
+    m_resITk_sigma[iparam]->Fill(m_sigP[iparam]);
+
+    m_resITk_meanProfeta[iparam]->Fill(eta, m_sigP[iparam]);
+    m_resITk_sigmaVsEta[iparam]->Fill(eta, m_sigP[iparam]);
+
+    m_resITk_meanProfpt[iparam]->Fill(m_truetrkP[PT], m_sigP[iparam]);
+    m_resITk_resHelpereta[iparam]->Fill(eta, m_resP[iparam]);
+    m_resITk_resHelperpt[iparam]->Fill(m_truetrkP[PT], m_resP[iparam]);
+    m_resITk_resHelperetapt[iparam]->Fill(m_truetrkP[PT], eta, m_resP[iparam]);
+
+    m_resITk_pullHelperpt[iparam]->Fill(m_truetrkP[PT], m_pullP[iparam]);
+    m_resITk_pullHelpereta[iparam]->Fill(eta, m_pullP[iparam]);
+
+    if (m_trkP[QOVERP] >= 0.) {
+      m_resITk_resHelpereta_pos[iparam]->Fill(eta, m_resP[iparam]);
+      m_resITk_resHelperpt_pos[iparam]->Fill(m_truetrkP[PT], m_resP[iparam]);
     }
-    if (trkP[QOVERP] < 0.) {
-      fillHisto(m_resITk_resHelpereta_neg[iparam],eta, resP[iparam]);
-      fillHisto(m_resITk_resHelperpt_neg[iparam],truetrkP[PT], resP[iparam]);
+    if (m_trkP[QOVERP] < 0.) {
+      m_resITk_resHelpereta_neg[iparam]->Fill(eta, m_resP[iparam]);
+      m_resITk_resHelperpt_neg[iparam]->Fill(m_truetrkP[PT], m_resP[iparam]);
     }
 
     if (iparam == QOVERP) {
-      if (trkP[QOVERP] / truetrkP[QOVERP] > 0.) {
-        fillHisto(m_resITk_chargeID,0.);
+      if (m_trkP[QOVERP] / m_truetrkP[QOVERP] > 0.) {
+        m_resITk_chargeID->Fill(0.);
       }
-      if (trkP[QOVERP] / truetrkP[QOVERP] < 0.) {
-        fillHisto(m_resITk_chargeID,1.);
-        fillHisto(m_resITk_chargeID_vs_eta,eta);
-        fillHisto(m_resITk_chargeID_vs_pt,truetrkP[PT]);
+      if (m_trkP[QOVERP] / m_truetrkP[QOVERP] < 0.) {
+        m_resITk_chargeID->Fill(1.);
+        m_resITk_chargeID_vs_eta->Fill(eta);
+        m_resITk_chargeID_vs_pt->Fill(m_truetrkP[PT]);
 
-        fillHisto(m_resITk_chargeID_chgvschg,trkP[QOVERP] / fabs(trkP[QOVERP]), truetrkP[QOVERP] / fabs(truetrkP[QOVERP]));
+        m_resITk_chargeID_chgvschg->Fill(m_trkP[QOVERP] / fabs(m_trkP[QOVERP]), m_truetrkP[QOVERP] / fabs(m_truetrkP[QOVERP]));
       }
     }
     // Look at PT tails
     if (iparam == PT) {
-      fillHisto(m_resITk_momTail_Frac,(trkP[PT] - truetrkP[PT]) / truetrkP[PT]);
-      if ((trkP[PT] - truetrkP[PT]) / truetrkP[PT] > 0.5 && truetrkP[PT] > 0.0) {
-        fillHisto(m_resITk_momTail,1.);
-        fillHisto(m_resITk_momTail_vs_phi,truetrkP[PHI]);
-        fillHisto(m_resITk_momTail_vs_eta,eta);
-        fillHisto(m_resITk_momTail_vs_pt,truetrkP[PT]);
+      m_resITk_momTail_Frac->Fill((m_trkP[PT] - m_truetrkP[PT]) / m_truetrkP[PT]);
+      if ((m_trkP[PT] - m_truetrkP[PT]) / m_truetrkP[PT] > 0.5 && m_truetrkP[PT] > 0.0) {
+        m_resITk_momTail->Fill(1.);
+        m_resITk_momTail_vs_phi->Fill(m_truetrkP[PHI]);
+        m_resITk_momTail_vs_eta->Fill(eta);
+        m_resITk_momTail_vs_pt->Fill(m_truetrkP[PT]);
       }else {
-        fillHisto(m_resITk_momTail,0.);
+        m_resITk_momTail->Fill(0.);
       }
     }
 
-    fillHisto(m_DEBUG_D0dep[iparam],trkP[iparam], trkP[D0]);
+    m_DEBUG_D0dep[iparam]->Fill(m_trkP[iparam], m_trkP[D0]);
+  }
+  for(int ieta = 0; ieta < m_nEtaBins; ieta++){
+    //std::cout << eta << " " << m_EtaBins[ieta+1] << " " << m_EtaBins[ieta] << std::endl;
+    if( eta < m_EtaBins[ieta+1] && eta > m_EtaBins[ieta]) {
+      m_fix_qoverpt_res[ieta]->Fill(m_resP[QOVERPT]);
+      m_fix_d0_res[ieta]->Fill(m_resP[D0]);
+      m_fix_z0_res[ieta]->Fill(m_resP[Z0]);
+      //std::cout << ieta << std::endl;
+    }
   }
+  m_significance_d0->Fill(eta,m_trkP[D0]);
+  m_significance_z0->Fill(eta,m_trkP[Z0]);
 }
 
 void
 InDetPerfPlot_resITk::getPlotParameters() {
   for (unsigned int iparam = 0; iparam < NPARAMS; iparam++) {
-    resP[iparam] = trkP[iparam] - truetrkP[iparam];
-    sigP[iparam] = trkErrP[iparam];
-    (sigP[iparam] != 0) ? pullP[iparam] = resP[iparam] / sigP[iparam] : pullP[iparam] = -9999.;
+    m_resP[iparam] = m_trkP[iparam] - m_truetrkP[iparam];
+    //if(iparam == PT) m_resP[iparam] = (trkP[iparam] - m_truetrkP[iparam]);
+    m_sigP[iparam] = m_trkErrP[iparam];
+    (m_sigP[iparam] != 0) ? m_pullP[iparam] = m_resP[iparam] / m_sigP[iparam] : m_pullP[iparam] = -9999.;
   }
+  m_resP[QOVERPT] = (m_trkP[QOVERPT] - m_truetrkP[QOVERPT]) * (1/m_truetrkP[QOVERPT]);
+//  std::cout << m_resP[QOVERPT] << std::endl;
 }
 
 void
@@ -622,35 +740,35 @@ InDetPerfPlot_resITk::getTrackParameters(const xAOD::TrackParticle &trkprt) {
   // std::cout << trkprt.track()->info().trackProperties(Trk::TrackInfo::BremFit) << std::endl;
   // std::cout << trkprt.trackProperties(xAOD::BremFit) << std::endl;
 
-  trkP[D0] = trkprt.d0();
-  trkP[Z0] = trkprt.z0();
-  trkP[QOVERP] = trkprt.qOverP();
-  trkP[QOVERPT] = trkprt.qOverP() * (1 / TMath::Sin(trkprt.theta()));
-  trkP[THETA] = trkprt.theta();
-  trkP[PHI] = trkprt.phi0();
-  trkP[PT] = trkprt.pt() / 1000.;
-  trkP[Z0SIN] = trkprt.z0() * TMath::Sin(trkprt.theta());
+  m_trkP[D0] = trkprt.d0();
+  m_trkP[Z0] = trkprt.z0();
+  m_trkP[QOVERP] = trkprt.qOverP();
+  m_trkP[QOVERPT] = trkprt.qOverP() * (1 / TMath::Sin(trkprt.theta()));
+  m_trkP[THETA] = trkprt.theta();
+  m_trkP[PHI] = trkprt.phi0();
+  m_trkP[PT] = trkprt.pt() / 1000.;
+  m_trkP[Z0SIN] = trkprt.z0() * TMath::Sin(trkprt.theta());
 
 
-  fillHisto(m_DEBUG_FirstHitR_d0,trkprt.radiusOfFirstHit(), trkP[D0]);
+  m_DEBUG_FirstHitR_d0->Fill(trkprt.radiusOfFirstHit(), m_trkP[D0]);
   if (trkprt.track()) {
     if (trkprt.track()->info().trackProperties(Trk::TrackInfo::BremFit) &&
         trkprt.track()->info().trackProperties(Trk::TrackInfo::BremFitSuccessful)) {
-      fillHisto(m_DEBUG_BREM_d0,trkP[D0]);
+      m_DEBUG_BREM_d0->Fill(m_trkP[D0]);
     }else {
-      fillHisto(m_DEBUG_NOBREM_d0,trkP[D0]);
+      m_DEBUG_NOBREM_d0->Fill(m_trkP[D0]);
     }
   }
   // Track fit errors
-  trkErrP[D0] = TMath::Sqrt(trkprt.definingParametersCovMatrix()(0, 0));
-  trkErrP[Z0] = TMath::Sqrt(trkprt.definingParametersCovMatrix()(1, 1));
-  trkErrP[PHI] = TMath::Sqrt(trkprt.definingParametersCovMatrix()(2, 2));
-  trkErrP[THETA] = TMath::Sqrt(trkprt.definingParametersCovMatrix()(3, 3));
-  trkErrP[QOVERP] = TMath::Sqrt(trkprt.definingParametersCovMatrix()(4, 4));
-  trkErrP[QOVERPT] = trkErrP[QOVERP] * (1 / TMath::Sin(trkprt.theta()));
-  trkErrP[Z0SIN] =
-    TMath::Sqrt(pow(trkErrP[THETA] * TMath::Sin(trkP[THETA]),
-                    2) + pow(trkP[Z0] * trkErrP[THETA] * TMath::Cos(trkP[THETA]), 2));
+  m_trkErrP[D0] = TMath::Sqrt(trkprt.definingParametersCovMatrix()(0, 0));
+  m_trkErrP[Z0] = TMath::Sqrt(trkprt.definingParametersCovMatrix()(1, 1));
+  m_trkErrP[PHI] = TMath::Sqrt(trkprt.definingParametersCovMatrix()(2, 2));
+  m_trkErrP[THETA] = TMath::Sqrt(trkprt.definingParametersCovMatrix()(3, 3));
+  m_trkErrP[QOVERP] = TMath::Sqrt(trkprt.definingParametersCovMatrix()(4, 4));
+  m_trkErrP[QOVERPT] = m_trkErrP[QOVERP] * (1 / TMath::Sin(trkprt.theta()));
+  m_trkErrP[Z0SIN] =
+    TMath::Sqrt(pow(m_trkErrP[THETA] * TMath::Sin(m_trkP[THETA]),
+                    2) + pow(m_trkP[Z0] * m_trkErrP[THETA] * TMath::Cos(m_trkP[THETA]), 2));
 
   // Get error on pT, taken from xAOD::TrackingHelpers.pTErr() but this function only works on a pointer input...
   if (trkprt.definingParametersCovMatrixVec().size() < 15) {
@@ -658,7 +776,7 @@ InDetPerfPlot_resITk::getTrackParameters(const xAOD::TrackParticle &trkprt) {
             "TrackParticle without covariance matrix for defining parameters or the covariance matrix is wrong dimensionality.");
   }
   if (std::abs(trkprt.qOverP()) < 0) {
-    trkErrP[PT] = 0.0;
+    m_trkErrP[PT] = 0.0;
     throw std::runtime_error("q/p is zero");
   }else {
     double pt = trkprt.pt();
@@ -666,7 +784,7 @@ InDetPerfPlot_resITk::getTrackParameters(const xAOD::TrackParticle &trkprt) {
     double diff_theta = pt / tan(trkprt.theta());
     const std::vector<float> &cov = trkprt.definingParametersCovMatrixVec();
     double pt_err2 = diff_qp * (diff_qp * cov[14] + diff_theta * cov[13]) + diff_theta * diff_theta * cov[9];
-    trkErrP[PT] = sqrt(pt_err2) / 1000.;
+    m_trkErrP[PT] = sqrt(pt_err2) / 1000.;
   }
 }
 
@@ -677,30 +795,30 @@ InDetPerfPlot_resITk::getTrackParameters(const xAOD::TruthParticle &truthprt) {
   int nParams = 6;
 
   for (int iParams = 0; iParams < nParams; iParams++) {
-    truetrkP[iParams] = -9999.;
-    if (truthprt.isAvailable<float>(paramProp[iParams].paraName)) {
-      truetrkP[iParams] = (truthprt.auxdata<float>(paramProp[iParams].paraName));
+    m_truetrkP[iParams] = -9999.;
+    if (truthprt.isAvailable<float>(m_paramProp[iParams].paraName)) {
+      m_truetrkP[iParams] = (truthprt.auxdata<float>(m_paramProp[iParams].paraName));
     }
   }
 
-  (truthprt.isAvailable<float>("d0")) ? truetrkP[D0] = truthprt.auxdata<float>("d0") : truetrkP[D0] = -9999.;
-  (truthprt.isAvailable<float>("z0")) ? truetrkP[Z0] = truthprt.auxdata<float>("z0") : truetrkP[Z0] = -9999.;
-  (truthprt.isAvailable<float>("qOverP")) ? truetrkP[QOVERP] = truthprt.auxdata<float>("qOverP") : truetrkP[QOVERP] =
+  (truthprt.isAvailable<float>("d0")) ? m_truetrkP[D0] = truthprt.auxdata<float>("d0") : m_truetrkP[D0] = -9999.;
+  (truthprt.isAvailable<float>("z0")) ? m_truetrkP[Z0] = truthprt.auxdata<float>("z0") : m_truetrkP[Z0] = -9999.;
+  (truthprt.isAvailable<float>("qOverP")) ? m_truetrkP[QOVERP] = truthprt.auxdata<float>("qOverP") : m_truetrkP[QOVERP] =
                                                                  -9999.;
-  (truthprt.isAvailable<float>("theta")) ? truetrkP[THETA] = truthprt.auxdata<float>("theta") : truetrkP[THETA] =
+  (truthprt.isAvailable<float>("theta")) ? m_truetrkP[THETA] = truthprt.auxdata<float>("theta") : m_truetrkP[THETA] =
                                                                -9999.;
-  (truthprt.isAvailable<float>("phi")) ? truetrkP[PHI] = truthprt.auxdata<float>("phi") : truetrkP[PHI] = -9999.;
+  (truthprt.isAvailable<float>("phi")) ? m_truetrkP[PHI] = truthprt.auxdata<float>("phi") : m_truetrkP[PHI] = -9999.;
   (truthprt.isAvailable<float>("theta") &&
-   truthprt.isAvailable<float>("qOverP")) ? truetrkP[QOVERPT] = truthprt.auxdata<float>("qOverP") *
+   truthprt.isAvailable<float>("qOverP")) ? m_truetrkP[QOVERPT] = truthprt.auxdata<float>("qOverP") *
                                                                 (1 /
                                                                  TMath::Sin(truthprt.auxdata<float>("theta"))) :
-                                                                truetrkP[QOVERPT] = -9999.;
+                                                                m_truetrkP[QOVERPT] = -9999.;
 
 
-  truetrkP[PT] = truthprt.pt() / 1000.;
+  m_truetrkP[PT] = truthprt.pt() / 1000.;
   (truthprt.isAvailable<float>("z0") &&
-   truthprt.isAvailable<float>("theta")) ? truetrkP[Z0SIN] = truetrkP[Z0] *
-                                                             TMath::Sin(truetrkP[THETA]) : truetrkP[Z0SIN] = -9999.;
+   truthprt.isAvailable<float>("theta")) ? m_truetrkP[Z0SIN] = m_truetrkP[Z0] *
+                                                             TMath::Sin(m_truetrkP[THETA]) : m_truetrkP[Z0SIN] = -9999.;
 }
 
 void
@@ -732,6 +850,34 @@ InDetPerfPlot_resITk::finalizePlots() {
   m_resITk_momTail_vs_pt->Scale(1 / m_resITk_momTail->GetEntries());
   m_resITk_momTail_vs_phi->Scale(1 / m_resITk_momTail->GetEntries());
   m_resITk_momTail_vs_eta->Scale(1 / m_resITk_momTail->GetEntries());
+  
+  for (unsigned int ieta = 0; ieta < m_nEtaBins; ieta++) {
+     TH1D *tmp = (TH1D*)m_significance_d0->ProjectionY("tmp_py",m_significance_d0->GetXaxis()->FindBin(m_EtaBins[ieta]),m_significance_d0->GetXaxis()->FindBin(m_EtaBins[ieta+1]));
+     m_significance_d0_vs_eta->SetBinContent(ieta+1,tmp->GetRMS());
+     m_significance_d0_vs_eta->SetBinError(ieta+1,tmp->GetRMSError());
+  }
+  for (unsigned int ieta = 0; ieta < m_nEtaBins; ieta++) {
+     TH1D *tmp = (TH1D*)m_significance_z0->ProjectionY("tmp_py",m_significance_z0->GetXaxis()->FindBin(m_EtaBins[ieta]),m_significance_z0->GetXaxis()->FindBin(m_EtaBins[ieta+1]));
+     m_significance_z0_vs_eta->SetBinContent(ieta+1,tmp->GetRMS());
+     m_significance_z0_vs_eta->SetBinError(ieta+1,tmp->GetRMSError());
+  }
+  //m_fix_qoverpt_res[8] = Book1D(fixName,fixName,600,-0.2,0.2,false);
+
+  for(int ieta = 0; ieta < m_nEtaBins; ieta++){
+     std::vector<float> result = getResolution(m_fix_qoverpt_res[ieta], std::string("RMS"));
+     m_fix_qoverptresolutionRMS_vs_eta->SetBinContent(ieta+1,result.at(0));
+     m_fix_qoverptresolutionRMS_vs_eta->SetBinError(ieta+1,result.at(1));
+  }
+  for(int ieta = 0; ieta < m_nEtaBins; ieta++){
+     std::vector<float> result = getResolution(m_fix_d0_res[ieta], std::string("RMS"));
+     m_fix_d0resolutionRMS_vs_eta->SetBinContent(ieta+1,result.at(0));
+     m_fix_d0resolutionRMS_vs_eta->SetBinError(ieta+1,result.at(1));
+  }
+  for(int ieta = 0; ieta < m_nEtaBins; ieta++){
+     std::vector<float> result = getResolution(m_fix_z0_res[ieta], std::string("RMS"));
+     m_fix_z0resolutionRMS_vs_eta->SetBinContent(ieta+1,result.at(0));
+     m_fix_z0resolutionRMS_vs_eta->SetBinError(ieta+1,result.at(1));
+  }
 }
 
 void
@@ -912,7 +1058,7 @@ InDetPerfPlot_resITk::makeResolutions(TH3 *h, TH1 *hres_eta[4][4], TH1 *hres_pt[
 std::vector<float> InDetPerfPlot_resITk::getResolution(TH1 *h, std::string s) {
   std::vector<float> result;
 
-  if (h->GetEntries() == 0.0 || h->Integral() < 100.0) {
+  if (h->GetEntries() == 0.0){// || h->Integral() < 100.0) {
     result.push_back(0.0);
     result.push_back(0.0);
     result.push_back(0.0);
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.h
index 9f30e5e452a634dd1b079539ad89e423cc968073..f09fae68c53065aa0f4ae9d9339ae277239f58bd 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_resITk.h
@@ -6,19 +6,17 @@
 #define INDETPHYSVALMONITORING_InDetPerfPlot_resITk
 /**
  * @file InDetPerfPlot_resITk.h
- * @author shaun roe
+ * @author nora pettersson
  **/
 
 
-// std includes
-#include <string>
-#include <vector>
-#include "TProfile.h"
+
+
 
 // local includes
 
-//#include "TrkValHistUtils/PlotBase.h"
-#include "InDetPlotBase.h"
+#include "TrkValHistUtils/PlotBase.h"
+#include "TProfile.h"
 // could be fwd declared?
 #include "xAODTracking/TrackParticle.h"
 #include "xAODTracking/TrackParticlexAODHelpers.h"
@@ -28,7 +26,9 @@
 
 #include "TFitResultPtr.h"
 #include "TFitResult.h"
-
+// std includes
+#include <string>
+#include <vector>
 #include <map>
 
 // fwd declaration
@@ -37,13 +37,12 @@ class IExtrapolator;
 
 
 ///class holding res plots for Inner Detector RTT Validation and implementing fill methods
-class InDetPerfPlot_resITk: public InDetPlotBase {
+class InDetPerfPlot_resITk: public PlotBase {
 public:
   enum Param {
     D0, Z0, QOVERP, QOVERPT, THETA, PHI, PT, Z0SIN, NPARAMS
   };
   struct pCfg {
-    pCfg();
     std::string paraName;
     std::string paraLabel;
     std::string paraUnit;
@@ -57,7 +56,7 @@ public:
   };
 
 
-  InDetPerfPlot_resITk(InDetPlotBase *pParent, const std::string &dirName);
+  InDetPerfPlot_resITk(PlotBase *pParent, const std::string &dirName);
 
   void fill(const xAOD::TrackParticle &trkprt, const xAOD::TruthParticle &truthprt);
 //  virtual bool isDefined(TString t);
@@ -96,15 +95,15 @@ private:
   void cloneHistogram(TH1D *h, TH1 *hcopy);
   std::vector<float> getResolution(TH1 *h, std::string s);
 
-  float trkP[NPARAMS];
-  float truetrkP[NPARAMS];
-  float trkErrP[NPARAMS];
+  float m_trkP[NPARAMS];
+  float m_truetrkP[NPARAMS];
+  float m_trkErrP[NPARAMS];
 
-  float resP[NPARAMS];
-  float pullP[NPARAMS];
-  float sigP[NPARAMS];
+  float m_resP[NPARAMS];
+  float m_pullP[NPARAMS];
+  float m_sigP[NPARAMS];
 
-  pCfg paramProp[NPARAMS];
+  pCfg m_paramProp[NPARAMS];
 
   TH1 *m_resITk_pull[NPARAMS];
   TH1 *m_resITk_res[NPARAMS];
@@ -160,11 +159,37 @@ private:
 
   TProfile *m_resITk_meanProfeta[NPARAMS];
   TProfile *m_resITk_meanProfpt[NPARAMS];
-  TH2 *m_resITk_sigmaVsEta[NPARAMS];
+  TH2      *m_resITk_sigmaVsEta[NPARAMS];
   TProfile *m_DEBUG_D0dep[NPARAMS];
   TProfile *m_DEBUG_FirstHitR_d0;
-  TH1 *m_DEBUG_NOBREM_d0;
-  TH1 *m_DEBUG_BREM_d0;
+  TH1      *m_DEBUG_NOBREM_d0;
+  TH1      *m_DEBUG_BREM_d0;
+
+  TH1      *m_trk_chi2ndof;
+  TProfile *m_trk_chi2ndof_vs_eta;
+  TProfile *m_trk_chi2ndof_vs_totHits;
+  TProfile *m_trk_chi2ndof_vs_totHits_prob;
+
+  TH1      *m_trk_chi2;
+  TH1      *m_trk_ndof;
+
+  TH2      *m_significance_d0;
+  TH2      *m_significance_z0;
+
+  TH1      *m_significance_d0_vs_eta;
+  TH1      *m_significance_z0_vs_eta;
+
+  TH1      *m_fix_qoverpt_res[16];
+
+  TH1      *m_fix_qoverptresolutionRMS_vs_eta;
+
+
+  TH1      *m_fix_d0_res[16];
+  TH1      *m_fix_d0resolutionRMS_vs_eta;
+
+  TH1      *m_fix_z0_res[16];
+  TH1      *m_fix_z0resolutionRMS_vs_eta;
+
 };
 
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_spectrum.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_spectrum.cxx
index 1554a618647ea9f563e8cfc177d79aee7b450990..08717613403a858dd2c15417f75304b05986eab9 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_spectrum.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPerfPlot_spectrum.cxx
@@ -132,8 +132,6 @@ InDetPerfPlot_spectrum::InDetPerfPlot_spectrum(InDetPlotBase *pParent, const std
 
 void
 InDetPerfPlot_spectrum::initializePlots() {
-  //
-  const bool prependDirectory(false);
 
   book(m_nSCTHits, "nSCTHits");
   book(m_nPixHits, "nPixHits");
@@ -173,11 +171,9 @@ InDetPerfPlot_spectrum::initializePlots() {
   book(m_TruthVtxR, "TVRspectrum");
 
 
-  m_TVR_vs_Z = Book2D("TVR_vs_Z", "Truth Vtx Rad vs. Z", 200, -4000, 4000, 200, 0., 1000, prependDirectory);
-  m_recod0_vs_z0_good = Book2D("recod0_vs_z0_good", "reco d0 vs. z0 - good TruthVert", 200, -4000., 4000, 200, -1000.,
-                               1000., prependDirectory);
-  m_recod0_vs_z0_crazy = Book2D("recod0_vs_z0_crazy", "reco d0 vs. z0 - crazy TruthVert", 200, -4000., 4000, 200,
-                                -1000., 1000., prependDirectory);
+  book(m_TVR_vs_Z,"TVR_vs_Z");
+  book(m_recod0_vs_z0_good,"recod0_vs_z0_good");
+  book(m_recod0_vs_z0_crazy,"recod0_vs_z0_crazy");
 
   book(m_recod0_PrimVtxR, "recod0PVRSpectrum");
   book(m_recoz0_PrimVtxZ, "recoz0PVZSpectrum");
@@ -188,7 +184,7 @@ InDetPerfPlot_spectrum::initializePlots() {
   book(m_PrimVtxZ, "PVZspectrum");
   book(m_PrimVtxR, "PVRspectrum");
 
-  m_PVR_vs_Z = Book2D("PVR_vs_Z", "Prim Vtx Rad vs. Z", 200, -4000, 4000, 100, 0., 0.5, prependDirectory);
+  book(m_PVR_vs_Z,"PVR_vs_Z");
   book(m_ptvsEtaUnlinked, "ptvsEtaUnlinked_postSelect");
   book(m_probvsSCTUnlinked, "probvsSCTUnlinked_postSelect");
   book(m_probvsPixUnlinked, "probvsPixUnlinked_postSelect");
@@ -236,10 +232,10 @@ InDetPerfPlot_spectrum::initializePlots() {
 
 void
 InDetPerfPlot_spectrum::fillSpectrum(const xAOD::TrackParticle &trkprt, Float_t prob) {
-  double pt = trkprt.pt() / 1000.;
+  double pt = trkprt.pt() *0.001;
   double eta = 0.0;
 
-  if (trkprt.pt() > 1e-7) {
+  if (trkprt.pt() > 0.1) {
     eta = trkprt.eta();
   }
   double phi(trkprt.phi());
@@ -294,7 +290,7 @@ InDetPerfPlot_spectrum::fillSpectrum(const xAOD::TruthParticle &particle) {
   // double eta = particle.eta();
   double eta = 0.0;
 
-  if (particle.pt() > 1e-7) {
+  if (particle.pt() > 0.1) {
     eta = particle.eta();
   }
 
@@ -345,13 +341,13 @@ void
 InDetPerfPlot_spectrum::fillSpectrum(const xAOD::TrackParticle &trkprt, const xAOD::Vertex &vertex, bool fill) {
   double d0(trkprt.d0());
   double z0(trkprt.z0());
-  double sinth = sin(trkprt.theta());
+  double sinth = std::sin(trkprt.theta());
   //
   double vtxX = vertex.x();
   double vtxY = vertex.y();
   double vtxZ = vertex.z();
 
-  double vtxR = sqrt(vtxX * vtxX + vtxY * vtxY);
+  double vtxR = std::hypot(vtxX,vtxY);
 
   fillHisto(m_recod0_PrimVtxR,d0 - vtxR);
   fillHisto(m_recoz0_PrimVtxZ,z0 - vtxZ);
@@ -381,8 +377,9 @@ InDetPerfPlot_spectrum::fillSpectrum(const xAOD::TrackParticle &trkprt, const xA
 void
 InDetPerfPlot_spectrum::fillSpectrumUnlinked2(const xAOD::TrackParticle &trkprt, double prob) {
   // unused constexpr double degreesPerRadian(180./M_PI);
-  double pt = trkprt.pt() / 1000.;
-  double eta(trkprt.eta());
+  double pt = trkprt.pt() *0.001;
+  double eta(0);
+  if (trkprt.pt()>0.1) eta = trkprt.eta();
   // unused double phi(trkprt.phi());
 
   uint8_t iPixOutliers, iSCTOutliers, iPixHoles, iSCTHoles, iPixHits, iSCTHits, iPixSharedHits, iSCTSharedHits;
@@ -441,7 +438,7 @@ void
 InDetPerfPlot_spectrum::fillSpectrumLinked(const xAOD::TrackParticle &trkprt, const xAOD::TruthParticle & /* particle*/,
                                            double prob) {
   // unused constexpr double degreesPerRadian(180./M_PI);
-  double pt = trkprt.pt() / 1000.;
+  double pt = trkprt.pt() *0.001;
   double eta(trkprt.eta());
   // unused double phi(trkprt.phi());
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysHitDecoratorTool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysHitDecoratorTool.cxx
index 583844f93208ae7cfa831da5cffa9b009f4bbd02..776917e20316d8d0807c27c38bdbc2a9e9bea974 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysHitDecoratorTool.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysHitDecoratorTool.cxx
@@ -201,11 +201,15 @@ InDetPhysHitDecoratorTool::decorateTrack(const xAOD::TrackParticle &particle, co
         if (mesb && biasedTrackParameters) {
           ATH_MSG_DEBUG("mesb and biased track parameters are ok");
           // for outliers, the measurement is not part of the fit, so track parameters are already unbiased
+          std::unique_ptr<const Trk::TrackParameters> cleanup_trackparam;
           const Trk::TrackParameters *trackParameters =
             (!thisTrackState->type(Trk::TrackStateOnSurface::Outlier)) ? getUnbiasedTrackParameters(
               biasedTrackParameters,
               mesb) :
             biasedTrackParameters;
+          if (trackParameters != biasedTrackParameters) {
+              cleanup_trackparam.reset(trackParameters);
+          }
           if (not trackParameters) {
             ATH_MSG_DEBUG("unbiased track parameters pointer is NULL");
           }
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValLargeD0Tool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValLargeD0Tool.cxx
index 326abfc2f3eda681676a9a47b044c7525f7244a0..d8beb8c3310d2a21eed3dedb13a8b2778f8f35fe 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValLargeD0Tool.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValLargeD0Tool.cxx
@@ -36,6 +36,7 @@
 #include "xAODTruth/TruthVertexContainer.h"
 
 // #include <unordered_map>
+#include <utility>
 
 using std::pair;
 using std::make_pair;
@@ -90,7 +91,11 @@ InDetPhysValLargeD0Tool::InDetPhysValLargeD0Tool(const std::string &type, const
   m_useTrackSelection(true),
   m_onlyInsideOutTracks(false),
   m_trackSelectionTool("TrackSelectionTool/TrackSelectionTool"),
-  m_truthSelectionTool("TrackTruthSelectionTool/TruthSelectionTool") {
+  m_truthSelectionTool("TrackTruthSelectionTool/TruthSelectionTool"),
+  m_maxTrkJetDR{},
+  m_folder{},
+  m_fillTIDEPlots{},
+  m_fillExtraTIDEPlots{} {
   declareProperty("TrackParticleContainerName", m_trkParticleName = "InDetTrackParticles");
   declareProperty("TruthParticleContainerName", m_truthParticleName = "TruthParticles");
   declareProperty("VertexContainerName", m_vertexContainerName = "PrimaryVertices");
@@ -145,6 +150,10 @@ InDetPhysValLargeD0Tool::fillHistograms() {
   if (!ptracks) {
     return StatusCode::FAILURE;
   }
+  //Retrieve EventInfo container
+  auto eventinfo = getContainer<xAOD::EventInfo>(m_eventInfoContainerName);
+  //Retrieve vertex container
+  auto privert = getContainer<xAOD::VertexContainer>(m_vertexContainerName);
 
   // Retrieve truthParticle container.
   const xAOD::TruthParticleContainer *truthParticles =
@@ -192,6 +201,22 @@ InDetPhysValLargeD0Tool::fillHistograms() {
     const xAOD::TruthParticle *associatedTruth = getTruthPtr(*thisTrack);
     float prob = getMatchingProbability(*thisTrack);
 
+    bool trtHit(false), trtOut(false);
+    uint8_t iTrtHits(0), iTrtOutliers(0), iTrtTubeHits(0);
+    int nTrtHits(0), nTrtTubeHits(0);
+
+    if (thisTrack->summaryValue(iTrtHits,xAOD::numberOfTRTHits)){
+      if(iTrtHits > 0) { 
+	trtHit = true; 
+	nTrtHits = (int)iTrtHits;
+      }      }
+    if (thisTrack->summaryValue(iTrtOutliers,xAOD::numberOfTRTOutliers)){
+      if(iTrtOutliers > 0) { trtOut = true; }      }
+    if (thisTrack->summaryValue(iTrtTubeHits,xAOD::numberOfTRTTubeHits)){
+      if(iTrtTubeHits > 0) { 
+	nTrtTubeHits = (int)iTrtTubeHits;
+      }      }
+
     // This is where the BMR, Fake, and Really Fake fillers need to go.
     float BMR_w(0), RF_w(0);
     if (prob < minProbEffHigh) {
@@ -204,23 +229,16 @@ InDetPhysValLargeD0Tool::fillHistograms() {
     m_LargeD0Plots->fillRF(*thisTrack, RF_w);
 
     bool isFake = (prob < minProbEffLow);
-    bool hasTruthLink = !(associatedTruth == nullptr);
-    int barcode = -1;
-    // bool isPrimary = false;
-
-    if (hasTruthLink) {
-      barcode = associatedTruth->barcode();
-    }
-
+    int barcode = (associatedTruth ? associatedTruth->barcode() : -1);
+    
     // * Fake rate plots, using 'fake' flag.
-    m_LargeD0Plots->fillFakeRate(*thisTrack, isFake);
+    m_LargeD0Plots->fillFakeRate(*thisTrack, isFake, barcode,trtHit,trtOut, nTrtHits, nTrtTubeHits);
 
-    // * Distributions for only fake tracks.
     if (isFake) {
-      m_LargeD0Plots->fillFake(*thisTrack);
-    }else {
+      m_LargeD0Plots->fillFake(*thisTrack, barcode, *eventinfo, *privert);
+    } else {
       // * Distributions for non-fake tracks.
-      m_LargeD0Plots->fill(*thisTrack, barcode);
+      m_LargeD0Plots->fill(*thisTrack, barcode, *eventinfo, *privert);
     }
   } // END: Main track loop.
 
@@ -232,6 +250,7 @@ InDetPhysValLargeD0Tool::fillHistograms() {
    * This is the beginning of the nested Loop, built mainly for the Efficiency Plots.
    */
   if (truthParticles) {
+
     // Outer loop: All truth particles.
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     for (const auto &thisTruth : *truthParticles) {
@@ -242,12 +261,11 @@ InDetPhysValLargeD0Tool::fillHistograms() {
         continue;
       }
 
-      bool reconstructed = false;
-      bool largeD0Track = false;
-      bool trtExtended = false;
-      float bestMatch = 0;
+      bool reconstructed(false), largeD0Track(false), trtHit(false), trtOut(false);
+      float bestMatch(0.0); 
       float PF_w(1); // weight for the trackeff histos
-      uint8_t iTrtHits = 0;
+      uint8_t iTrtHits(0), iTrtOutliers(0), iTrtTubeHits(0);
+      int nTrtHits(0), nTrtTubeHits(0);
 
       m_LargeD0Plots->fillTruth(*thisTruth);
 
@@ -256,6 +274,7 @@ InDetPhysValLargeD0Tool::fillHistograms() {
 
       // Inner loop: All track particles.
       for (const auto &thisTrack : *ptracks) {
+
         if (m_useTrackSelection) {
           // * 0 means z0, d0 cut is wrt. beam spot - put in a PV to change this.
           // if ( !(m_trackSelectionTool->accept(*thisTrack, 0)) ) { continue; }
@@ -271,19 +290,24 @@ InDetPhysValLargeD0Tool::fillHistograms() {
         float prob = getMatchingProbability(*thisTrack);
 
         // * If the associated truth particle matches the current particle in the truth particle loop...
-        if (associatedTruth && associatedTruth == thisTruth) {
+        if (associatedTruth && associatedTruth == thisTruth) {	
+	  // * Determine TRT hits, outliers, and tube hits for truth associated tracks
+	  if (thisTrack->summaryValue(iTrtHits, xAOD::numberOfTRTHits)) {
+	    if (iTrtHits > 0) {
+	      trtHit = true;
+	      nTrtHits = (int)iTrtHits;
+	    }   }
+	  if (thisTrack->summaryValue(iTrtOutliers,xAOD::numberOfTRTOutliers)){
+	    if(iTrtOutliers > 0) { trtOut = true; } }
+	  if (thisTrack->summaryValue(iTrtTubeHits,xAOD::numberOfTRTTubeHits)){
+	    if(iTrtTubeHits > 0) { nTrtTubeHits = (int)iTrtTubeHits; } }	
+	  // * ... as a standard or largeD0 track.
+	  largeD0Track = isLargeD0Track(thisTrack);
           bestMatch = std::max(prob, bestMatch);
           if (prob > minProbEffLow) {
             prospects.push_back(make_pair(prob, thisTrack));
             // * Current truth particle has been reconstructed...
             reconstructed = true;
-            // * ... as a standard or largeD0 track.
-            largeD0Track = isLargeD0Track(thisTrack);
-            if (thisTrack->summaryValue(iTrtHits, xAOD::numberOfTRTHits)) {
-              if (iTrtHits > 0) {
-                trtExtended = true;
-              }
-            }
           }
         }
       }
@@ -303,7 +327,7 @@ InDetPhysValLargeD0Tool::fillHistograms() {
       m_LargeD0Plots->pro_fill(*thisTruth, PF_w);
       // end of bestMatch >= minProbEffHigh
 
-      m_LargeD0Plots->fillEfficiency(*thisTruth, reconstructed, largeD0Track, trtExtended, isSignal(thisTruth));
+      m_LargeD0Plots->fillEfficiency(*thisTruth, reconstructed, largeD0Track, trtHit,trtOut,nTrtHits,nTrtTubeHits, isSignal(thisTruth));
     } // END: loop truthParticles
   } // END: if truthParticles
 
@@ -356,11 +380,6 @@ InDetPhysValLargeD0Tool::isLargeD0Track(const xAOD::TrackParticle *tp) {
   return false;
 }
 
-// bool InDetPhysValLargeD0Tool::isPrimaryTrack (const xAOD::TruthParticle* tp) {
-//  if ((tp->barcode() > 0) and (tp->barcode() < 200000)) return true;
-//  else return false;
-// }
-
 
 bool
 InDetPhysValLargeD0Tool::isSignal(const xAOD::TruthParticle *p) {
@@ -371,7 +390,7 @@ InDetPhysValLargeD0Tool::isSignal(const xAOD::TruthParticle *p) {
       (p->status() == 1) &&  \
       (p->hasProdVtx()) &&   \
       (!p->hasDecayVtx()) && \
-      (p->nParents() > 0) && \
+      //     (p->nParents() > 0) &&		\ //taken out because not all signatures have tracks that stop decaying the way muons do
       (p->isCharged())) {
     const xAOD::TruthParticle *parent = p->parent();
     if (parent == NULL) {
@@ -394,7 +413,7 @@ InDetPhysValLargeD0Tool::isSignal(const xAOD::TruthParticle *p) {
 bool
 InDetPhysValLargeD0Tool::MinTrackSelection(const xAOD::TrackParticle *tp) {
   float maxEta = 2.5;
-  float minPt = 1000. /*0*/;
+  float minPt = /*1000.*/ 0; //Putting in this minPt cut actually increases the fake rate, so I am putting back to zero.
 
   if ((tp->pt() > 1e-7 ? (fabs(tp->eta()) < maxEta) : false) &&  \
       (tp->pt() > minPt)) {
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx
index b8cd35ac5500c606ee4ff7c8dde0f45c4a7c41e1..5265718387756c5d3ca30f7d9f44f5416aaa53fe 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetPhysValMonitoringTool.cxx
@@ -8,8 +8,13 @@
  **/
 
 #include "InDetPhysValMonitoring/InDetPhysValMonitoringTool.h"
-
-#include <vector>
+#include "InDetPhysHitDecoratorTool.h"
+#include "InDetRttPlots.h"
+#include "InDetPerfPlot_nTracks.h"
+#include "AthTruthSelectionTool.h"
+#include "CachedGetAssocTruth.h"
+//#include "TrackTruthLookup.h"
+//
 #include "TrkToolInterfaces/ITrackSelectorTool.h"
 #include "xAODTracking/TrackParticle.h"
 #include "xAODTracking/TrackStateValidationContainer.h"
@@ -23,15 +28,18 @@
 #include "xAODTruth/TruthPileupEvent.h"
 #include "xAODTruth/TruthPileupEventContainer.h"
 #include "xAODTruth/TruthPileupEventAuxContainer.h"
-#include "InDetRttPlots.h"
-#include "InDetPerfPlot_nTracks.h"
+
 #include "TrkTrack/TrackCollection.h"
 #include "xAODJet/JetContainer.h"
 #include "PATCore/TAccept.h"
+//
+#include <algorithm>
 #include <limits>
-#include <cmath> // to get std::isnan()
+#include <cmath> // to get std::isnan(), std::abs etc.
+//#include <functional> // to get std::plus
 #include <utility>
 #include <cstdlib> //to getenv
+#include <vector>
 
 
 namespace { // utility functions used here
@@ -42,27 +50,10 @@ namespace { // utility functions used here
     return(pair1.first < pair2.first);
   }
 
-  // get truth particle associated with a track particle
-  const xAOD::TruthParticle *
-  getTruthPtr(const xAOD::TrackParticle &trackParticle) {
-    typedef ElementLink<xAOD::TruthParticleContainer> ElementTruthLink_t;
-    const xAOD::TruthParticle *result(nullptr);
-    // 0. is there any truth?
-    if (trackParticle.isAvailable<ElementTruthLink_t>("truthParticleLink")) {
-      // 1. ..then get link
-      const ElementTruthLink_t ptruthContainer = trackParticle.auxdata<ElementTruthLink_t>("truthParticleLink");
-      if (ptruthContainer.isValid()) {
-        result = *ptruthContainer;
-      }
-    }
-    return result;
-  }
-
   // get truth/track matching probability
   float
   getMatchingProbability(const xAOD::TrackParticle &trackParticle) {
     float result(std::numeric_limits<float>::quiet_NaN());
-
     if (trackParticle.isAvailable<float>("truthMatchProbability")) {
       result = trackParticle.auxdata<float>("truthMatchProbability");
     }
@@ -72,7 +63,6 @@ namespace { // utility functions used here
   bool
   isInsideOut(const xAOD::TrackParticle &track) {
     std::bitset<xAOD::TrackPatternRecoInfo::NumberOfTrackRecoInfo>  patternInfo = track.patternRecoInfo();
-
     return patternInfo.test(0);
   }
 
@@ -97,7 +87,6 @@ namespace { // utility functions used here
     if (eta > etaMax) {
       return false;
     }
-
     return true;
   }
 }// namespace
@@ -109,12 +98,13 @@ InDetPhysValMonitoringTool::InDetPhysValMonitoringTool(const std::string &type,
   m_useTrackSelection(false),
   m_onlyInsideOutTracks(false),
   m_trackSelectionTool("InDet::InDetTrackSelectionTool/TrackSelectionTool"),
-  m_truthSelectionTool("TrackTruthSelectionTool/TruthSelectionTool"),
+  m_truthSelectionTool("AthTruthSelectionTool",this),
   m_prospectsMatched(6, 0),
   m_twoMatchedEProb(0),
   m_threeMatchedEProb(0),
   m_fourMatchedEProb(0),
   m_truthCounter(0),
+  m_truthCutCounters{},
   m_fillTIDEPlots(false),
   m_fillExtraTIDEPlots(false) {
   declareProperty("TrackParticleContainerName", m_trkParticleName = "InDetTrackParticles"); // Aug 8th: switch
@@ -159,25 +149,25 @@ InDetPhysValMonitoringTool::initialize() {
     }
   }
   ATH_CHECK(m_truthSelectionTool.retrieve());
+  m_truthCutCounters=m_truthSelectionTool->counters();
   m_monPlots = std::move(std::unique_ptr<InDetRttPlots> (new InDetRttPlots(0, m_dirName + m_folder)));
   m_monPlots->SetFillExtraTIDEPlots(m_fillExtraTIDEPlots);
-
   return StatusCode::SUCCESS;
 }
 
 StatusCode
 InDetPhysValMonitoringTool::fillHistograms() {
   ATH_MSG_DEBUG("Filling hists " << name() << "...");
+  // function object could be used to retrieve truth: IDPVM::CachedGetAssocTruth getTruth;
   // retrieve trackParticle container
-  auto ptracks = getContainer<xAOD::TrackParticleContainer>(m_trkParticleName);
-  // const xAOD::TruthParticleContainer* truthParticles = (!m_truthParticleName.empty() ?
-  // getContainer<xAOD::TruthParticleContainer>(m_truthParticleName) : nullptr);
-  if ((!ptracks)) {
-    return StatusCode::FAILURE;
-  }
+  const auto ptracks = getContainer<xAOD::TrackParticleContainer>(m_trkParticleName);
+  if (not ptracks) return StatusCode::FAILURE;
+  //
   // retrieve truthParticle container
-  std::vector<const xAOD::TruthParticle *> truthParticlesVec;
-  getTruthParticles(truthParticlesVec);
+  std::vector<const xAOD::TruthParticle *> truthParticlesVec=getTruthParticles();
+  //IDPVM::TrackTruthLookup getAsTruth(ptracks, &truthParticlesVec); //caches everything upon construction
+  IDPVM::CachedGetAssocTruth getAsTruth; //only cache one way, track->truth, not truth->tracks
+  //
   bool incFake = false;
   int nMuEvents= 0;
   const xAOD::TruthPileupEventContainer *truthPileupEventContainer = 0;
@@ -190,27 +180,29 @@ InDetPhysValMonitoringTool::fillHistograms() {
 
   ATH_MSG_DEBUG("Filling vertex plots");
   const xAOD::VertexContainer *pvertex = getContainer<xAOD::VertexContainer>(m_vertexContainerName);
-  const xAOD::Vertex *pvtx = 0;
-  if (pvertex) {
+  const xAOD::Vertex *pvtx = nullptr;
+  if (pvertex and not pvertex->empty()) {
+    ATH_MSG_DEBUG("Number of vertices retrieved for this event "<<pvertex->size());
+    const auto & stdVertexContainer= pvertex->stdcont();
+    auto predicate = [](const xAOD::Vertex * vtx) { return (vtx->vertexType() != xAOD::VxType::NoVtx);};
+    //find last non-dummy vertex; note *usually* there is only one (or maybe zero)
+    auto findVtx = std::find_if(stdVertexContainer.rbegin(), stdVertexContainer.rend(), predicate);
+    pvtx= (findVtx==stdVertexContainer.rend()) ? nullptr: *findVtx;
+    /**
     for (const auto &vtx : pvertex->stdcont()) {
-      if (vtx->vertexType() == xAOD::VxType::NoVtx) {
-        continue; // skip dummy vertex
-      }
-      //   if (vtx->vertexType() == xAOD::VxType::PriVtx) ATH_MSG_INFO("PV x/y/z " << vtx->x() << "," <<vtx->y() << ","
-      // << vtx->z() );
-      pvtx = vtx;
-    }
-
+	      if (vtx->vertexType() == xAOD::VxType::NoVtx) {
+	        continue; // skip dummy vertex
+	      }
+	      pvtx = vtx;
+	  }**/
     m_monPlots->fill(*pvertex);
   } else {
     ATH_MSG_WARNING("Skipping vertexing plots.");
   }
   ATH_MSG_DEBUG("Filling vertex/event info monitoring plots");
   const xAOD::EventInfo *pei = getContainer<xAOD::EventInfo>(m_eventInfoContainerName);
-  if (pei) {
-    if (pvertex) {
+  if (pei and pvertex) {
       m_monPlots->fill(*pvertex, *pei);
-    }
   } else {
     ATH_MSG_WARNING(
       "Skipping vertexing plots using EventInfo.");
@@ -221,16 +213,15 @@ InDetPhysValMonitoringTool::fillHistograms() {
   const xAOD::TruthVertex *truthVertex = 0;
   if (truthVrt) {
     if (!m_TrkSelectPV) {
-      ATH_MSG_INFO("size of TruthVertex container = " << truthVrt->size());
+      ATH_MSG_VERBOSE("size of TruthVertex container = " << truthVrt->size());
     }
 
     for (const auto &vtx : truthVrt->stdcont()) {
       if (!m_TrkSelectPV) {
 	//        ATH_MSG_INFO("TruthVertex XYZ = " << vtx->x() << "," << vtx->y() << "," << vtx->z());
       }
-      float vrtR = sqrt(vtx->x() * vtx->x() + vtx->y() * vtx->y());
-
-      if (vrtR > 1 || abs(vtx->z()) > 500) {
+      float vrtR = std::sqrt(vtx->x() * vtx->x() + vtx->y() * vtx->y());
+      if (vrtR > 1 || std::abs(vtx->z()) > 500) {
         continue;
       }
       truthVertex = vtx;
@@ -240,8 +231,6 @@ InDetPhysValMonitoringTool::fillHistograms() {
   }
 
   unsigned int num_truth_selected(0), nSelectedTracks(0), num_truthmatch_match(0);
-  // const unsigned int nTracks(ptracks->size()); //unused
-  // const unsigned int nTruth(truthParticles  ? truthParticles->size() : 0);
 
   // the truth matching probability must not be <= 0., otherwise the tool will seg fault in case of missing truth (e.g.
   // data):
@@ -249,27 +238,27 @@ InDetPhysValMonitoringTool::fillHistograms() {
   //    const float minProbEffHigh(0.80); //if the probability of a match is higher than this, it either feeds the NUM
   // or is a duplicate
   // VJ - Mar 14, 2016 - even for effs, use 0.51
-  const float minProbEffHigh(0.501); // if the probability of a match is higher than this, it either feeds the NUM or is
+  const float minProbEffHigh(0.5); // if the probability of a match is higher than this, it either feeds the NUM or is
                                      // a duplicate
 
-  // check if we are doing track selection relative to PV (or the default, which is the BS)
+  // check if we are doing track selection relative to PV (or the default, which is the Beam Spot)
   if (!m_TrkSelectPV) {
-    pvtx = 0;
-  }
-  if (pvtx && pvtx->vertexType() == xAOD::VxType::PriVtx) {
-    ATH_MSG_DEBUG("PV x/y/z " << pvtx->x() << "," << pvtx->y() << "," << pvtx->z());
+    pvtx = nullptr;
   }
 
   bool fillVtx = true; // fill PV plots in fillSpectrum only once
 
-  //float Inclusive_w(0); //weight for the "inclusive fake" plots NOT THE RIGHT PLACE FOR THIS
-
   // Main track loop, filling Track-only, Track 'n' Truth with good matching probability (meas, res, & pull), and Fakes
   std::vector<int> incTrkNum = {0,0,0};
+  m_truthSelectionTool->clearCounters();
+
+  //dummy variables
+  int base(0), hasTruth(0), hashighprob(0), passtruthsel(0);
+  
   for (const auto &thisTrack: *ptracks) {
     m_monPlots->fillSpectrum(*thisTrack); // This one needs prob anyway, why not rearrange & eliminate
                                           // getMatchingProbability from RttPlots? 5-17-16
-    const xAOD::TruthParticle *associatedTruth = getTruthPtr(*thisTrack);
+    const xAOD::TruthParticle *associatedTruth = getAsTruth.getTruth(thisTrack);
     float prob = getMatchingProbability(*thisTrack);
     if (!m_TrkSelectPV && truthVertex) {
       m_monPlots->fillSpectrum(*thisTrack, *truthVertex);
@@ -290,8 +279,9 @@ InDetPhysValMonitoringTool::fillHistograms() {
     ++nSelectedTracks;                                                    // increment number of selected tracks
     m_monPlots->fill(*thisTrack);                                         // Make all the plots requiring only
                                                                           // trackParticle
-    if(fabs(thisTrack->eta()) < 2.7) ++incTrkNum[0];
-    else if(fabs(thisTrack->eta()) >= 2.7 && fabs(thisTrack->eta()) < 3.5) ++incTrkNum[1];
+    const float absTrackEta = (thisTrack->pt() >1e-7) ? std::abs(thisTrack->eta()) : std::nan("");
+    if(absTrackEta < 2.7) ++incTrkNum[0];
+    else if(absTrackEta >= 2.7 && absTrackEta < 3.5) ++incTrkNum[1];
     else ++incTrkNum[2];
 
     // This is where the BMR, Fake, and Really Fake fillers need to go.
@@ -311,14 +301,17 @@ InDetPhysValMonitoringTool::fillHistograms() {
       m_monPlots->fillSpectrumUnlinked2(*thisTrack);
       Unlinked_w = 1; //Unlinked, set weight to 1
     }
-
+    base += 1;
     if (associatedTruth) {
+      hasTruth += 1;
       if ((prob < minProbEffLow) and (not std::isnan(prob))) {
         const bool isFake = (prob < minProbEffLow);
         m_monPlots->fillFakeRate(*thisTrack, isFake);
 	       if((associatedTruth->barcode() < 200e3) and (associatedTruth->barcode() != 0)) Prim_w = 1; //Fake Primary, set weight to 1
 	       if(associatedTruth->barcode() >= 200e3) Sec_w = 1;                                         //Fake Secondary, set weight to 1
       }
+      if (prob > minProbEffLow) hashighprob += 1;
+      if (m_truthSelectionTool->accept(associatedTruth)) passtruthsel += 1;
       if ((prob > minProbEffLow) and m_truthSelectionTool->accept(associatedTruth)) {
         m_monPlots->fill(*thisTrack, *associatedTruth); // Make all plots requiring both truth & track (meas, res, &
                                                         // pull)
@@ -328,48 +321,90 @@ InDetPhysValMonitoringTool::fillHistograms() {
     
     m_monPlots->fillLinkedandUnlinked(*thisTrack, Prim_w, Sec_w, Unlinked_w);
   }
+  ATH_MSG_DEBUG(m_truthSelectionTool->str());
+  const auto & tmp=m_truthSelectionTool->counters(); //get array of counters for the cuts
 
+  unsigned idx(0);
+  for (auto & i:m_truthCutCounters){
+    i+=tmp[idx++]; //i=sum of all the individual counters on each cut.
+  }
   int nTruths(0), nInsideOut(0), nOutsideIn(0);
   std::vector<int> incTrkDenom = {0,0,0};
+  
+  const char * debugBacktracking = std::getenv("BACKTRACKDEBUG");
+
   // This is the beginning of the Nested Loop, built mainly for the Efficiency Plots
+  if (debugBacktracking){
+    std::cout<<"Start of new nested loop event ------------------------------------------------ \n";
+  }
+  
+  ATH_MSG_DEBUG("Starting nested loop efficiency calculation");
   for (int itruth = 0; itruth < (int) truthParticlesVec.size(); itruth++) {  // Outer loop over all truth particles
     nTruths += 1;
     const xAOD::TruthParticle *thisTruth = truthParticlesVec[itruth];
     m_monPlots->fillSpectrum(*thisTruth);
-    Root::TAccept accept = m_truthSelectionTool->accept(thisTruth);
-    fillTruthCutFlow(accept);
+    const bool accept = m_truthSelectionTool->accept(thisTruth);
     if (accept) {
       ++m_truthCounter; // total number of truth tracks which pass cuts
       ++num_truth_selected; // total number of truth which pass cuts per event
-      if(fabs(thisTruth->eta()) < 2.7) ++incTrkDenom[0];
-      else if(fabs(thisTruth->eta()) >= 2.7 && fabs(thisTruth->eta()) < 3.5) ++incTrkDenom[1];
+      const float absTruthEta=(thisTruth->pt() >0.1) ? std::abs(thisTruth->eta()) : std::nan("");
+      if(absTruthEta < 2.7) ++incTrkDenom[0];
+      else if(absTruthEta >= 2.7 && absTruthEta < 3.5) ++incTrkDenom[1];
       else ++incTrkDenom[2];
       // LMTODO add this Jain/Swift
-
       float PF_w(1); // weight for the trackeff histos
-
       float bestMatch = 0;
       std::vector <std::pair<float, const xAOD::TrackParticle *> > prospects; // Vector of pairs:
                                                                               // <truth_matching_probability, track> if
                                                                               // prob > minProbEffLow (0.5)
+      
+      double lepton_w(0);
+      if(debugBacktracking){
+        std::cout<<"Rey: these are the numbers for this truthParticle \n";
+        std::cout<<"Barcode: "<<thisTruth->barcode()<<"\n";
+        std::cout<<"PDGId: "<<thisTruth->pdgId()<<"\n";
+        std::cout<<"Number of Parents: "<<thisTruth->nParents()<<"\n";
+
+        if(thisTruth->hasProdVtx()){
+          const xAOD::TruthVertex *vtx = thisTruth->prodVtx();
+          double prod_rad = vtx->perp();
+          double prod_z = vtx->z();
+          std::cout<<"Vertex Radial Position: "<<prod_rad<<"\n";
+          std::cout<<"Vertex z Position: "<<prod_z<<"\n";
+        }
+        double Px = thisTruth->px();
+        double Py = thisTruth->py();
+        std::cout<<"Px: "<<Px<<"\n";
+        std::cout<<"Py: "<<Py<<"\n";
+        std::cout<<"Pz: "<<thisTruth->pz()<<"\n";
+
+        if(thisTruth->absPdgId() == 11){
+          double Pt = std::sqrt((Px * Px) + (Py * Py));
+          if(Pt < 3000){
+            lepton_w = 1;
+          }
+        }
+      }// end of debugging backtracking section
+
+      m_monPlots->lepton_fill(*thisTruth, lepton_w);
+
       for (const auto &thisTrack: *ptracks) { // Inner loop over all track particle
-        if (m_useTrackSelection) {
-          if (!(m_trackSelectionTool->accept(*thisTrack, pvtx))) {
+        //filter tracks
+        if (m_useTrackSelection and not(m_trackSelectionTool->accept(*thisTrack, pvtx))) {
             continue;
-          }
         }
 
-	if(itruth == 1){
-	  if(isInsideOut(*thisTrack)){
-	    nInsideOut += 1;
-	  }else{
-	    nOutsideIn += 1;
-	  }
-	}
+        if(itruth == 1){
+          if(isInsideOut(*thisTrack)){
+            nInsideOut += 1;
+          }else{
+            nOutsideIn += 1;
+          }
+        }
         if (m_onlyInsideOutTracks and(not isInsideOut(*thisTrack))) {
           continue;  // not an inside-out track
         }
-        const xAOD::TruthParticle *associatedTruth = getTruthPtr(*thisTrack); // get the associated truth for this track
+        const xAOD::TruthParticle *associatedTruth = getAsTruth.getTruth(thisTrack);
         if (associatedTruth && associatedTruth == thisTruth) {
           float prob = getMatchingProbability(*thisTrack);
           if (not std::isnan(prob)) {
@@ -382,6 +417,7 @@ InDetPhysValMonitoringTool::fillHistograms() {
           }
         }
       }
+      
       // count number of prospects and increment entry in vector for this event
       int deg_count = prospects.size();
       if (deg_count <= 4) {
@@ -403,55 +439,48 @@ InDetPhysValMonitoringTool::fillHistograms() {
       if (deg_count > 1) {
         std::vector<float> probs;
         for (int i = 0; i < deg_count; i++) {
-          probs.push_back(prospects.at(i).first);
+          probs.push_back(prospects[i].first);
         }
-        sort(prospects.begin(), prospects.end(), sortProspects);
-
+        std::sort(prospects.begin(), prospects.end(), sortProspects);
         // count duplicates
         float prev = prospects[0].first;
         int nduplicates = 0;
+        const std::array<int *,5> matchedEProbs={nullptr, nullptr, &m_twoMatchedEProb, &m_threeMatchedEProb, &m_fourMatchedEProb};
         for (int i = 1; i < deg_count; i++) {
           bool duplicate = std::fabs(prospects[i].first - prev) < 1.e-9;
           if (duplicate) {
             ++nduplicates;
           }
           if (!duplicate || i == deg_count - 1) {
-            if (nduplicates >= 1) {
-              if (deg_count == 2) {
-                ++m_twoMatchedEProb;
-              } else if (deg_count == 3) {
-                ++m_threeMatchedEProb;
-              } else if (deg_count == 4) {
-                ++m_fourMatchedEProb;
-              }
+            if (nduplicates > 1) {
+              (*(matchedEProbs[deg_count]))++;
             }
             nduplicates = 0;
             prev = prospects[i].first;
           }
         }
       }
-
+      //if (prospects.empty()) ATH_MSG_WARNING("Called 'back' on empty container!");
+      //auto thisProspect=prospects.back();
+      
       // fill truth-only plots
+      
       if (bestMatch >= minProbEffHigh) {
         ++num_truthmatch_match;
-        const xAOD::TruthParticle *assoc_Truth = getTruthPtr(*prospects.back().second);
-        if (!assoc_Truth) {
+        const xAOD::TruthParticle *associatedTruth = prospects.empty()? nullptr : getAsTruth.getTruth(prospects.back().second);
+        if (!associatedTruth) {
           continue;
         }
-        m_monPlots->fill(*assoc_Truth); // This is filling truth-only plots:  m_TrackTruthInfoPlots
+        m_monPlots->fill(*associatedTruth); // This is filling truth-only plots:  m_TrackTruthInfoPlots
       }else {
         PF_w = 0;
       }
+      
       m_monPlots->pro_fill(*thisTruth, PF_w);                                               
     } // end of the "if(accept)" loop
   }// End of Big truthParticle loop
-
-  const char * debugBacktracking = std::getenv("BACKTRACKDEBUG");
-  if (debugBacktracking){
-    std::cout<<"Rey: the number of Inside-Out tracks is "<<nInsideOut<<"\n";
-    std::cout<<"Finn: the number of Outside-In tracks is "<<nOutsideIn<<"\n";
-    //std::cout<<"Poe: the ratio of the above number  is "<<ratio<<"\n";
-  }
+  ATH_MSG_DEBUG("End of efficiency calculation");
+  
   if (m_useTrackSelection) {
     for (const auto &thisTrack: *ptracks) { // Inner loop over all track particle
       if (m_useTrackSelection) {
@@ -460,9 +489,9 @@ InDetPhysValMonitoringTool::fillHistograms() {
       }
     }
   }
-
+ 
   if (num_truthmatch_match == 0) {
-    ATH_MSG_DEBUG("NO TRACKS had associated truth.");
+    ATH_MSG_INFO("NO TRACKS had associated truth.");
   } else {
     ATH_MSG_DEBUG(num_truthmatch_match << " tracks out of " << ptracks->size() << " had associated truth.");
   }
@@ -471,88 +500,11 @@ InDetPhysValMonitoringTool::fillHistograms() {
   m_monPlots->fillCounter(ptracks->size(), InDetPerfPlot_nTracks::ALL);
   m_monPlots->fillCounter(truthParticlesVec.size(), InDetPerfPlot_nTracks::TRUTH);
   m_monPlots->fillCounter(num_truthmatch_match, InDetPerfPlot_nTracks::TRUTH_MATCHED);
-
-
-
+  //Tracking In Dense Environment
   if (m_fillTIDEPlots && !m_jetContainerName.empty()) {
-    ATH_MSG_DEBUG("Getting jet Container");
-    const xAOD::JetContainer *jets = getContainer<xAOD::JetContainer>(m_jetContainerName);
-    ATH_MSG_DEBUG("Getting Truth Container");
-    const xAOD::TruthParticleContainer *truthParticles = getContainer<xAOD::TruthParticleContainer>("TruthParticles");
-    ATH_MSG_VERBOSE("Truth Container obtained");
-    if (!jets || !truthParticles) {
-      ATH_MSG_WARNING(
-        "Cannot open " << m_jetContainerName <<
-        " jet container or TruthParticles truth particle container. Skipping jet plots.");
-    } else {
-      for (const auto &thisJet: *jets) {         // The big jets loop
-        if (not passJetCuts(*thisJet)) {
-          continue;
-        }
-        ATH_MSG_VERBOSE("Got a jet");
-        for (const auto thisTrack: *ptracks) {    // The beginning of the track loop
-          ATH_MSG_VERBOSE("looping over the tracks now");
-          if (m_useTrackSelection and not (m_trackSelectionTool->accept(*thisTrack, pvtx))) {
-            continue;
-          }
-          ATH_MSG_VERBOSE("track in acceptance");
-          if (m_onlyInsideOutTracks and !(isInsideOut(*thisTrack))) {
-            continue; // not an inside out track
-          }
-          ATH_MSG_VERBOSE("track insideout accepted");
-          if (thisJet->p4().DeltaR(thisTrack->p4()) > m_maxTrkJetDR) {
-            continue;
-          }
-          //
-          ATH_MSG_VERBOSE("Filling trkInJet");
-          const bool safelyFilled = m_monPlots->filltrkInJetPlot(*thisTrack, *thisJet);
-          ATH_MSG_VERBOSE("Is it safely filled? 0 means no, 1 means yes " << safelyFilled);
-          if (safelyFilled) {
-            float trkInJet_w(0), trkInJet_BMR(1);
-            float prob = getMatchingProbability(*thisTrack);
-            ATH_MSG_VERBOSE("got matching");
-            if (prob > minProbEffHigh) {
-              trkInJet_w = 1;
-              trkInJet_BMR = 0;
-            }
-            ATH_MSG_VERBOSE("Filling in three jet plots");
-            m_monPlots->jet_fill(*thisTrack, *thisJet, trkInJet_w);                          // fill trkinjeteff plots
-            m_monPlots->jetBMR(*thisTrack, *thisJet, trkInJet_BMR);                          // fin in track in jet bad
-                                                                                             // match rate plots
-            m_monPlots->fillSimpleJetPlots(*thisTrack, prob);                                      // Fill all the
-                                                                                                   // simple jet plots
-            const xAOD::TruthParticle *associatedTruth = getTruthPtr(*thisTrack);           // Get the associated truth
-                                                                                            // for this track
-            if (associatedTruth) {
-              ATH_MSG_VERBOSE("Found associated truth");
-              m_monPlots->fillJetResPlots(*thisTrack, *associatedTruth, *thisJet);             // Fill jet pull &
-                                                                                               // resolution plots
-              int barcode = associatedTruth->barcode();
-              m_monPlots->fillJetHitsPlots(*thisTrack, prob, barcode);                         // Fill the two extra
-                                                                                               // plots
-              if (m_truthSelectionTool->accept(associatedTruth)) {                            // Fill the Jet plots with
-                                                                                              // "Eff" in the name
-                m_monPlots->fillJetEffPlots(*associatedTruth, *thisJet);
-              }
-            } else {
-              ATH_MSG_VERBOSE("No associated truth");
-            }
-          }
-        } // end of track loop
-        ATH_MSG_DEBUG("Finished loop over Jets");
-        // fill in things like sum jet pT in dR bins - need all tracks in the jet first
-        m_monPlots->fillJetPlotCounter(*thisJet);
-        for (const auto &thisTruth: *truthParticles) {
-          // for primary tracks we want an efficiency as a function of track jet dR
-          if ((m_truthSelectionTool->accept(thisTruth) and(thisJet->p4().DeltaR(thisTruth->p4()) < m_maxTrkJetDR))) {
-            m_monPlots->fillJetTrkTruth(*thisTruth, *thisJet);
-          }
-        }
-        m_monPlots->fillJetTrkTruthCounter(*thisJet);
-      } // loop over jets
-    }   // if have collections needed
+    return doJetPlots(ptracks,getAsTruth, pvtx);
   }     // if TIDE
-
+  //ATH_MSG_INFO(getTruth.report());
   return StatusCode::SUCCESS;
 }
 
@@ -581,7 +533,7 @@ InDetPhysValMonitoringTool::procHistograms() {
   ATH_MSG_INFO(" number with five+ matched reco = " << m_prospectsMatched[5]);
   ATH_MSG_INFO(" total number of truth particles which pass cuts = " << m_truthCounter);
   ATH_MSG_INFO(
-    " total number of truth particles which match a reco track (including duplicates) = " << m_prospectsMatched[1] +
+    " total number of truth particles which pass and match a reco track (including duplicates) = " << m_prospectsMatched[1] +
     m_prospectsMatched[2] + m_prospectsMatched[3] + m_prospectsMatched[4] + m_prospectsMatched[5]);
   ATH_MSG_INFO(" number zero matched reco = " << m_prospectsMatched[0]);
   ATH_MSG_INFO(
@@ -601,9 +553,9 @@ InDetPhysValMonitoringTool::procHistograms() {
 
   ATH_MSG_INFO("");
   ATH_MSG_INFO("Cutflow for truth tracks:");
-  ATH_MSG_INFO("");
-  for (int i = 0; i < (int) m_truthCutflow.size(); i++) {
-    ATH_MSG_INFO("number after " << m_truthCutflowNames[i] << ": " << m_truthCutflow[i]);
+  unsigned int idx(0);
+  for (const auto & cutName:m_truthSelectionTool->names()) {
+    ATH_MSG_INFO("number after " << cutName << ": " << m_truthCutCounters[idx++]);
   }
   if (endOfRunFlag()) {
     m_monPlots->finalize();
@@ -612,53 +564,47 @@ InDetPhysValMonitoringTool::procHistograms() {
   return StatusCode::SUCCESS;
 }
 
-void
-InDetPhysValMonitoringTool::getTruthParticles(std::vector<const xAOD::TruthParticle *> &truthParticles) {
-  truthParticles.clear();
+const std::vector<const xAOD::TruthParticle *>  
+InDetPhysValMonitoringTool::getTruthParticles() {
+  //truthParticles.clear();
+  std::vector<const xAOD::TruthParticle *> tempVec{};
   if (m_pileupSwitch == "All") {
     std::string m_truthContainerName = "TruthParticles";
     const xAOD::TruthParticleContainer *truthParticleContainer =
       (!m_truthParticleName.empty() ? getContainer<xAOD::TruthParticleContainer>(m_truthParticleName) : nullptr);
-    if (!truthParticleContainer) {
-      return;
-    }
-    for (const auto &thisTruth: *truthParticleContainer) {
-      truthParticles.push_back(thisTruth);
-    }
-  }else {
+    tempVec.insert(tempVec.begin(), truthParticleContainer->begin(), truthParticleContainer->end());
+  } else {
     if (m_pileupSwitch == "HardScatter") {
       // get truthevent container to separate out pileup and hardscatter truth particles
-      const xAOD::TruthEventContainer *truthEventContainer = 0;
-      const char *truthEventCollName =
+      const xAOD::TruthEventContainer *truthEventContainer = nullptr;
+      const std::string truthEventCollName =
         evtStore()->contains<xAOD::TruthEventContainer>("TruthEvents") ? "TruthEvents" : "TruthEvent";
       evtStore()->retrieve(truthEventContainer, truthEventCollName);
-      auto event = truthEventContainer->at(0);
-
-      // get truth particles from first event only
-      int ntruth = event->nTruthParticles();
-      ATH_MSG_VERBOSE("looping over " << ntruth << " truth particles in TruthEvents container");
-      for (int j = 0; j < ntruth; j++) {
-        const xAOD::TruthParticle *thisTruth = event->truthParticle(j);
-        truthParticles.push_back(thisTruth);
+      const xAOD::TruthEvent * event = truthEventContainer->at(0);
+      const auto & links= event->truthParticleLinks();
+      tempVec.reserve(event->nTruthParticles());
+      for( const auto& link : links ) {
+        tempVec.push_back(*link);
       }
     }else if (m_pileupSwitch == "PileUp") {
       ATH_MSG_VERBOSE("getting TruthPileupEvents container");
       // get truth particles from all pileup events
-      const xAOD::TruthPileupEventContainer *truthPileupEventContainer = 0;
-      const char *truthPUEventCollName =
+      const xAOD::TruthPileupEventContainer *truthPileupEventContainer = nullptr;
+      const std::string truthPUEventCollName =
         evtStore()->contains<xAOD::TruthPileupEventContainer>("TruthPileupEvents") ? "TruthPileupEvents" :
         "TruthPileupEvent";
       evtStore()->retrieve(truthPileupEventContainer, truthPUEventCollName);
-
-      if (truthPileupEventContainer != NULL) {
-        for (int i = 0; i < (int) truthPileupEventContainer->size(); ++i) {
+      if (truthPileupEventContainer) {
+        const unsigned int nPileup= truthPileupEventContainer->size();
+        tempVec.reserve(nPileup*200); //quick initial guess, will still save some time
+        for (unsigned int i(0); i != nPileup; ++i) {
           auto eventPileup = truthPileupEventContainer->at(i);
           // get truth particles from each pileup event
           int ntruth = eventPileup->nTruthParticles();
-          ATH_MSG_VERBOSE("looping over " << ntruth << " truth particles in TruthPileupEvents container");
-          for (int j = 0; j < ntruth; ++j) {
-            const xAOD::TruthParticle *thisTruth = eventPileup->truthParticle(j);
-            truthParticles.push_back(thisTruth);
+          ATH_MSG_VERBOSE("Adding " << ntruth << " truth particles from TruthPileupEvents container");
+          const auto & links=eventPileup->truthParticleLinks();
+          for( const auto& link : links ) {
+            tempVec.push_back(*link);
           }
         }
       } else {
@@ -668,9 +614,7 @@ InDetPhysValMonitoringTool::getTruthParticles(std::vector<const xAOD::TruthParti
       ATH_MSG_ERROR("bad value for PileUpSwitch");
     }
   }
-
-  ATH_MSG_VERBOSE("returning " << truthParticles.size() << " truth particles");
-  return;
+  return tempVec;
 }
 
 void
@@ -679,11 +623,6 @@ InDetPhysValMonitoringTool::fillTrackCutFlow(Root::TAccept &accept) {
   return;
 }
 
-void
-InDetPhysValMonitoringTool::fillTruthCutFlow(Root::TAccept &accept) {
-  fillCutFlow(accept, m_truthCutflowNames, m_truthCutflow);
-  return;
-}
 
 void
 InDetPhysValMonitoringTool::fillCutFlow(Root::TAccept &accept, std::vector<std::string> &names,
@@ -698,17 +637,84 @@ InDetPhysValMonitoringTool::fillCutFlow(Root::TAccept &accept, std::vector<std::
     }
   }
   // get cutflow
-  cutFlow[0] = cutFlow[0] + 1;
+  cutFlow[0] += 1;
   bool cutPositive = true;
   for (unsigned int i = 0; i != (accept.getNCuts() + 1); ++i) {
     if (!cutPositive) {
       continue;
     }
     if (accept.getCutResult(i)) {
-      cutFlow[i + 1] = cutFlow[i + 1] + 1;
+      cutFlow[i + 1] +=1;
     } else {
       cutPositive = false;
     }
   }
   return;
 }
+
+StatusCode
+InDetPhysValMonitoringTool::doJetPlots(const xAOD::TrackParticleContainer * ptracks, 
+                                       IDPVM::CachedGetAssocTruth & getAsTruth, 
+                                       const  xAOD::Vertex * primaryVtx){
+  const xAOD::JetContainer *jets = getContainer<xAOD::JetContainer>(m_jetContainerName);
+  const xAOD::TruthParticleContainer *truthParticles = getContainer<xAOD::TruthParticleContainer>("TruthParticles");
+  const float minProbEffHigh=0.5;
+  if (!jets || !truthParticles) {
+    ATH_MSG_WARNING(
+      "Cannot open " << m_jetContainerName <<
+      " jet container or TruthParticles truth particle container. Skipping jet plots.");
+  } else {
+    for (const auto &thisJet: *jets) {         // The big jets loop
+      if (not passJetCuts(*thisJet)) {
+        continue;
+      }
+      for (auto thisTrack: *ptracks) {    // The beginning of the track loop
+        if (m_useTrackSelection and not (m_trackSelectionTool->accept(*thisTrack, primaryVtx))) {
+          continue;
+        }
+        if (m_onlyInsideOutTracks and !(isInsideOut(*thisTrack))) {
+          continue; // not an inside out track
+        }
+        if (thisJet->p4().DeltaR(thisTrack->p4()) > m_maxTrkJetDR) {
+          continue;
+        }
+        //
+        const bool safelyFilled = m_monPlots->filltrkInJetPlot(*thisTrack, *thisJet);
+        if (safelyFilled) {
+          float trkInJet_w(0), trkInJet_BMR(1);
+          float prob = getMatchingProbability(*thisTrack);
+          if (prob > minProbEffHigh) {
+            trkInJet_w = 1;
+            trkInJet_BMR = 0;
+          }
+          m_monPlots->jet_fill(*thisTrack, *thisJet, trkInJet_w);                          // fill trkinjeteff plots
+          m_monPlots->jetBMR(*thisTrack, *thisJet, trkInJet_BMR);                          // fin in track in jet bad
+          m_monPlots->fillSimpleJetPlots(*thisTrack, prob);                                // Fill all the                                            // match rate plots
+                                                                                           // simple jet plots
+          const xAOD::TruthParticle *associatedTruth = getAsTruth.getTruth(thisTrack);                                                                              // for this track
+          if (associatedTruth) {
+            m_monPlots->fillJetResPlots(*thisTrack, *associatedTruth, *thisJet);             // Fill jet pull &
+                                                                                             // resolution plots
+            int barcode = associatedTruth->barcode();
+            m_monPlots->fillJetHitsPlots(*thisTrack, prob, barcode);                         // Fill the two extra
+                                                                                             // plots
+            if (m_truthSelectionTool->accept(associatedTruth)) {                            // Fill the Jet plots with
+                                                                                            // "Eff" in the name
+              m_monPlots->fillJetEffPlots(*associatedTruth, *thisJet);
+            }
+          } 
+        }
+      } // end of track loop
+      // fill in things like sum jet pT in dR bins - need all tracks in the jet first
+      m_monPlots->fillJetPlotCounter(*thisJet);
+      for (const auto &thisTruth: *truthParticles) {
+        // for primary tracks we want an efficiency as a function of track jet dR
+        if ((m_truthSelectionTool->accept(thisTruth) and(thisJet->p4().DeltaR(thisTruth->p4()) < m_maxTrkJetDR))) {
+          m_monPlots->fillJetTrkTruth(*thisTruth, *thisJet);
+        }
+      }
+      m_monPlots->fillJetTrkTruthCounter(*thisJet);
+    } // loop over jets
+  }
+  return StatusCode::SUCCESS;
+}
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttLargeD0Plots.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttLargeD0Plots.cxx
index 9a2e3ef63bda1850648f047c3d1e836c878db20e..9c2bec291272b5ed4117871150737556d75c0a71 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttLargeD0Plots.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttLargeD0Plots.cxx
@@ -12,6 +12,8 @@
 #include "xAODTruth/TruthParticleContainer.h"
 #include "xAODTruth/TruthParticle.h"
 #include "xAODTruth/TruthVertex.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "xAODTracking/VertexContainer.h"
 #include <cmath> // std::isnan()
 #include <limits>
 
@@ -36,127 +38,269 @@ namespace {
 InDetRttLargeD0Plots::InDetRttLargeD0Plots(InDetPlotBase *pParent, const std::string &sDir) :
   InDetPlotBase(pParent, sDir),
 
-// =============================================================
-// plots for LargeD0 performance study
-// =============================================================
-
-// //Testing TRT extension efficiency
-  m_trtTesting_nonfake(this, "LargeD0/TRTTesting/NonFakeTracks/"),
-  m_trtTesting_matching_truthLink_primary(this, "LargeD0/TRTTesting/Matching/TruthLink/Primary"),
-  m_trtTesting_matching_truthLink_secondary(this, "LargeD0/TRTTesting/Matching/TruthLink/Secondary/"),
-  m_trtTesting_matching_noTruthLink(this, "LargeD0/TRTTesting/Matching/noTruthLink/"),
-  m_trtTesting_fakes(this, "LargeD0/TRTTesting/FakeTracks/"),
-
-// hits plots
-  m_hitsPlots_nonfake_st(this, "LargeD0/HitsPlots/StandardTracks/NonFakeTracks"),
-  m_hitsPlots_matching_truthLink_primary_st(this, "LargeD0/HitsPlots/StandardTracks/Matching/TruthLink/Primary"),
-  m_hitsPlots_matching_truthLink_secondary_st(this, "LargeD0/HitsPlots/StandardTracks/Matching/TruthLink/Secondary"),
-  m_hitsPlots_matching_NotruthLink_st(this, "LargeD0/HitsPlots/StandardTracks/Matching/NotruthLink"),
-  m_hitsPlots_fake_st(this, "LargeD0/HitsPlots/StandardTracks/FakeTracks"),
-
-  m_hitsPlots_nonfake_ld0(this, "LargeD0/HitsPlots/LargeD0Tracks/NonFakeTracks"),
-  m_hitsPlots_matching_truthLink_primary_ld0(this, "LargeD0/HitsPlots/LargeD0Tracks/Matching/TruthLink/Primary"),
-  m_hitsPlots_matching_truthLink_secondary_ld0(this, "LargeD0/HitsPlots/LargeD0Tracks/Matching/TruthLink/Secondary"),
-  m_hitsPlots_matching_NotruthLink_ld0(this, "LargeD0/HitsPlots/LargeD0Tracks/Matching/NotruthLink"),
-  m_hitsPlots_fake_ld0(this, "LargeD0/HitsPlots/LargeD0Tracks/FakeTracks"),
-
-// basic plots
-  m_basicPlot_nonfake_st(this, "LargeD0/basicPlot/StandardTracks/NonFakeTracks"),
-  m_basicPlot_nonfake_ld0(this, "LargeD0/basicPlot/LargeD0Tracks/NonFakeTracks"),
-  m_basicPlot_fake_st(this, "LargeD0/basicPlot/StandardTracks/FakeTracks"),
-  m_basicPlot_fake_ld0(this, "LargeD0/basicPlot/LargeD0Tracks/FakeTracks"),
-  m_basicPlot_truth(this, "LargeD0/basicPlot/TruthTracks"),
-
-  m_basicPlot_primary_truth(this, "LargeD0/basicPlot/TruthTracksPrimary"),
-  m_basicPlot_secondary_truth(this, "LargeD0/basicPlot/TruthTracksSecondary"),
-
-  m_basicPlot_pileup_primary_truth(this, "LargeD0/basicPlot/Pileup/TruthTracksPrimary"),
-  m_basicPlot_pileup_secondary_truth(this, "LargeD0/basicPlot/Pileup/TruthTracksSecondary"),
-
-
-// pt plots
-  m_ptPlot_nonfake_st(this, "LargeD0/ptPlot/StandardTracks/NonFakeTracks"),
-  m_ptPlot_nonfake_ld0(this, "LargeD0/ptPlot/LargeD0Tracks/NonFakeTracks"),
-  m_ptPlot_fake_st(this, "LargeD0/ptPlot/StandardTracks/FakeTracks"),
-  m_ptPlot_fake_ld0(this, "LargeD0/ptPlot/LargeD0Tracks/FakeTracks"),
-
-  m_ptPlot_primary(this, "LargeD0/ptPlot/TruthTracks/Primary"),
-  m_ptPlot_secondary(this, "LargeD0/ptPlot/TruthTracks/Secondary"),
+  // =============================================================
+  // plots for LargeD0 performance study
+  // =============================================================
+  
+  // //Testing TRT extension efficiency
+  m_trtTesting_st_matched(this, "LargeD0/TRTTesting/StandardTracks/MatchedTracks/"),
+  m_trtTesting_st_matched_primary(this, "LargeD0/TRTTesting/StandardTracks/MatchedTracks/Primary"),
+  m_trtTesting_st_matched_secondary(this, "LargeD0/TRTTesting/StandardTracks/MatchedTracks/Secondary/"),
+  m_trtTesting_st_matched_noTruthLink(this, "LargeD0/TRTTesting/StandardTracks/MatchedTracks/NoTruthLink/"),
+  m_trtTesting_st_fake(this, "LargeD0/TRTTesting/StandardTracks/FakeTracks/"),
+  m_trtTesting_st_fake_primary(this, "LargeD0/TRTTesting/StandardTracks/FakeTracks/Primary"),
+  m_trtTesting_st_fake_secondary(this, "LargeD0/TRTTesting/StandardTracks/FakeTracks/Secondary"),
+  m_trtTesting_st_fake_noTruthLink(this, "LargeD0/TRTTesting/StandardTracks/FakeTracks/NoTruthLink"),
+
+  m_trtTesting_ld0_matched(this, "LargeD0/TRTTesting/LargeD0Tracks/MatchedTracks/"),
+  m_trtTesting_ld0_matched_primary(this, "LargeD0/TRTTesting/LargeD0Tracks/MatchedTracks/Primary"),
+  m_trtTesting_ld0_matched_secondary(this, "LargeD0/TRTTesting/LargeD0Tracks/MatchedTracks/Secondary/"),
+  m_trtTesting_ld0_matched_noTruthLink(this, "LargeD0/TRTTesting/LargeD0Tracks/MatchedTracks/NoTruthLink/"),
+  m_trtTesting_ld0_fake(this, "LargeD0/TRTTesting/LargeD0Tracks/FakeTracks/"),
+  m_trtTesting_ld0_fake_primary(this, "LargeD0/TRTTesting/LargeD0Tracks/FakeTracks/Primary"),
+  m_trtTesting_ld0_fake_secondary(this, "LargeD0/TRTTesting/LargeD0Tracks/FakeTracks/Secondary"),
+  m_trtTesting_ld0_fake_noTruthLink(this, "LargeD0/TRTTesting/LargeD0Tracks/FakeTracks/NoTruthLink"),
+  
+  // hits plots
+  m_hitsPlots_st_matched(this, "LargeD0/HitsPlots/StandardTracks/MatchedTracks"),
+  m_hitsPlots_st_matched_primary(this, "LargeD0/HitsPlots/StandardTracks/MatchedTracks/Primary"),
+  m_hitsPlots_st_matched_secondary(this, "LargeD0/HitsPlots/StandardTracks/MatchedTracks/Secondary"),
+  m_hitsPlots_st_matched_noTruthLink(this, "LargeD0/HitsPlots/StandardTracks/MatchedTracks/NoTruthLink"),
+  m_hitsPlots_st_fake(this, "LargeD0/HitsPlots/StandardTracks/FakeTracks"),
+  m_hitsPlots_st_fake_primary(this, "LargeD0/HitsPlots/StandardTracks/FakeTracks/Primary"),
+  m_hitsPlots_st_fake_secondary(this, "LargeD0/HitsPlots/StandardTracks/FakeTracks/Secondary"),
+  m_hitsPlots_st_fake_noTruthLink(this, "LargeD0/HitsPlots/StandardTracks/FakeTracks/NoTruthLink"),
+  
+  m_hitsPlots_ld0_matched(this, "LargeD0/HitsPlots/LargeD0Tracks/MatchedTracks"),
+  m_hitsPlots_ld0_matched_primary(this, "LargeD0/HitsPlots/LargeD0Tracks/MatchedTracks/Primary"),
+  m_hitsPlots_ld0_matched_secondary(this, "LargeD0/HitsPlots/LargeD0Tracks/MatchedTracks/Secondary"),
+  m_hitsPlots_ld0_matched_noTruthLink(this, "LargeD0/HitsPlots/LargeD0Tracks/MatchedTracks/NoTruthLink"),
+  m_hitsPlots_ld0_fake(this, "LargeD0/HitsPlots/LargeD0Tracks/FakeTracks"),
+  m_hitsPlots_ld0_fake_primary(this, "LargeD0/HitsPlots/LargeD0Tracks/FakeTracks/Primary"),
+  m_hitsPlots_ld0_fake_secondary(this, "LargeD0/HitsPlots/LargeD0Tracks/FakeTracks/Secondary"),
+  m_hitsPlots_ld0_fake_noTruthLink(this, "LargeD0/HitsPlots/LargeD0Tracks/FakeTracks/NoTruthLink"),
+  
+  // basic plots
+  m_basicPlot_st_matched(this, "LargeD0/basicPlot/StandardTracks/MatchedTracks"),
+  m_basicPlot_st_matched_primary(this, "LargeD0/basicPlot/StandardTracks/MatchedTracks/Primary"),
+  m_basicPlot_st_matched_secondary(this, "LargeD0/basicPlot/StandardTracks/MatchedTracks/Secondary"),
+  m_basicPlot_st_matched_noTruthLink(this, "LargeD0/basicPlot/StandardTracks/MatchedTracks/NoTruthLink"),
+  m_basicPlot_st_fake(this, "LargeD0/basicPlot/StandardTracks/FakeTracks"),
+  m_basicPlot_st_fake_primary(this, "LargeD0/basicPlot/StandardTracks/FakeTracks/Primary"),
+  m_basicPlot_st_fake_secondary(this, "LargeD0/basicPlot/StandardTracks/FakeTracks/Secondary"),
+  m_basicPlot_st_fake_noTruthLink(this, "LargeD0/basicPlot/StandardTracks/FakeTracks/NoTruthLink"),
+  
+  m_basicPlot_ld0_matched(this, "LargeD0/basicPlot/LargeD0Tracks/MatchedTracks"),
+  m_basicPlot_ld0_matched_primary(this, "LargeD0/basicPlot/LargeD0Tracks/MatchedTracks/Primary"),
+  m_basicPlot_ld0_matched_secondary(this, "LargeD0/basicPlot/LargeD0Tracks/MatchedTracks/Secondary"),
+  m_basicPlot_ld0_matched_noTruthLink(this, "LargeD0/basicPlot/LargeD0Tracks/MatchedTracks/NoTruthLink"),
+  m_basicPlot_ld0_fake(this, "LargeD0/basicPlot/LargeD0Tracks/FakeTracks"),
+  m_basicPlot_ld0_fake_primary(this, "LargeD0/basicPlot/LargeD0Tracks/FakeTracks/Primary"),
+  m_basicPlot_ld0_fake_secondary(this, "LargeD0/basicPlot/LargeD0Tracks/FakeTracks/Secondary"),
+  m_basicPlot_ld0_fake_noTruthLink(this, "LargeD0/basicPlot/LargeD0Tracks/FakeTracks/NoTruthLink"),
+
+  // pt plots
+  m_ptPlot_st_matched(this, "LargeD0/ptPlot/StandardTracks/MatchedTracks"),
+  m_ptPlot_st_matched_primary(this, "LargeD0/ptPlot/StandardTracks/MatchedTracks/Primary"),
+  m_ptPlot_st_matched_secondary(this, "LargeD0/ptPlot/StandardTracks/MatchedTracks/Secondary"),
+  m_ptPlot_st_matched_noTruthLink(this, "LargeD0/ptPlot/StandardTracks/MatchedTracks/NoTruthLink"),
+  m_ptPlot_st_fake(this, "LargeD0/ptPlot/StandardTracks/FakeTracks"),
+  m_ptPlot_st_fake_primary(this, "LargeD0/ptPlot/StandardTracks/FakeTracks/Primary"),
+  m_ptPlot_st_fake_secondary(this, "LargeD0/ptPlot/StandardTracks/FakeTracks/Secondary"),
+  m_ptPlot_st_fake_noTruthLink(this, "LargeD0/ptPlot/StandardTracks/FakeTracks/NoTruthLink"), 
+ 
+  m_ptPlot_ld0_matched(this, "LargeD0/ptPlot/LargeD0Tracks/MatchedTracks"),
+  m_ptPlot_ld0_matched_primary(this, "LargeD0/ptPlot/LargeD0Tracks/MatchedTracks/Primary"),
+  m_ptPlot_ld0_matched_secondary(this, "LargeD0/ptPlot/LargeD0Tracks/MatchedTracks/Secondary"),
+  m_ptPlot_ld0_matched_noTruthLink(this, "LargeD0/ptPlot/LargeD0Tracks/MatchedTracks/NoTruthLink"),   
+  m_ptPlot_ld0_fake(this, "LargeD0/ptPlot/LargeD0Tracks/FakeTracks"),
+  m_ptPlot_ld0_fake_primary(this, "LargeD0/ptPlot/LargeD0Tracks/FakeTracks/Primary"),
+  m_ptPlot_ld0_fake_secondary(this, "LargeD0/ptPlot/LargeD0Tracks/FakeTracks/Secondary"),
+  m_ptPlot_ld0_fake_noTruthLink(this, "LargeD0/ptPlot/LargeD0Tracks/FakeTracks/NoTruthLink"),
+  
+  m_ptPlot_truth_primary(this, "LargeD0/ptPlot/TruthTracks/Primary"),
+  m_ptPlot_truth_secondary(this, "LargeD0/ptPlot/TruthTracks/Secondary"),
   m_ptPlot_pileup_primary(this, "LargeD0/ptPlot/Pileup/TruthTracks/Primary"),
   m_ptPlot_pileup_secondary(this, "LargeD0/ptPlot/Pileup/TruthTracks/Secondary"),
+  
+  // Reco info plots
+  m_TrackRecoInfoPlots_st_matched(this, "LargeD0/TrackRecoInfoPlots/StandardTracks/MatchedTracks"),
+  m_TrackRecoInfoPlots_st_matched_primary(this, "LargeD0/TrackRecoInfoPlots/StandardTracks/MatchedTracks/Primary"),
+  m_TrackRecoInfoPlots_st_matched_secondary(this, "LargeD0/TrackRecoInfoPlots/StandardTracks/MatchedTracks/Secondary"),
+  m_TrackRecoInfoPlots_st_matched_noTruthLink(this, "LargeD0/TrackRecoInfoPlots/StandardTracks/MatchedTracks/NoTruthLink"),
+  m_TrackRecoInfoPlots_st_fake(this, "LargeD0/TrackRecoInfoPlots/StandardTracks/FakeTracks"),
+  m_TrackRecoInfoPlots_st_fake_primary(this, "LargeD0/TrackRecoInfoPlots/StandardTracks/FakeTracks/Primary"),
+  m_TrackRecoInfoPlots_st_fake_secondary(this, "LargeD0/TrackRecoInfoPlots/StandardTracks/FakeTracks/Secondary"),
+  m_TrackRecoInfoPlots_st_fake_noTruthLink(this, "LargeD0/TrackRecoInfoPlots/StandardTracks/FakeTracks/NoTruthLink"),
+
+  m_TrackRecoInfoPlots_ld0_matched(this, "LargeD0/TrackRecoInfoPlots/LargeD0Tracks/MatchedTracks"),
+  m_TrackRecoInfoPlots_ld0_matched_primary(this, "LargeD0/TrackRecoInfoPlots/LargeD0Tracks/MatchedTracks/Primary"),
+  m_TrackRecoInfoPlots_ld0_matched_secondary(this, "LargeD0/TrackRecoInfoPlots/LargeD0Tracks/MatchedTracks/Secondary"),
+  m_TrackRecoInfoPlots_ld0_matched_noTruthLink(this, "LargeD0/TrackRecoInfoPlots/LargeD0Tracks/MatchedTracks/NoTruthLink"),
+  m_TrackRecoInfoPlots_ld0_fake(this, "LargeD0/TrackRecoInfoPlots/LargeD0Tracks/FakeTracks"),
+  m_TrackRecoInfoPlots_ld0_fake_primary(this, "LargeD0/TrackRecoInfoPlots/LargeD0Tracks/FakeTracks/Primary"),
+  m_TrackRecoInfoPlots_ld0_fake_secondary(this, "LargeD0/TrackRecoInfoPlots/LargeD0Tracks/FakeTracks/Secondary"),
+  m_TrackRecoInfoPlots_ld0_fake_noTruthLink(this, "LargeD0/TrackRecoInfoPlots/LargeD0Tracks/FakeTracks/NoTruthLink"),
+  
+  // Fake rate plots
+  m_fakePlots_st(this, "LargeD0/FakeRatePlots/StandardTracks"),
+  m_fakePlots_st_trtHit(this, "LargeD0/FakeRatePlots/StandardTracks/TRT"),
+  m_fakePlots_st_trtOut(this, "LargeD0/FakeRatePlots/StandardTracks/TRTOut"),
+  m_fakePlots_st_noTrt(this, "LargeD0/FakeRatePlots/StandardTracks/NoTRT"),
+  m_fakePlots_st_tubeFrac051(this, "LargeD0/FakeRatePlots/StandardTracks/TubeFrac05_1"),
+  m_fakePlots_st_tubeFrac0405(this, "LargeD0/FakeRatePlots/StandardTracks/TubeFrac04_05"),
+  m_fakePlots_st_tubeFrac004(this, "LargeD0/FakeRatePlots/StandardTracks/TubeFrac0_04"),
+  m_fakePlots_st_primary(this, "LargeD0/FakeRatePlots/StandardTracks/Primary"),
+  m_fakePlots_st_primary_trtHit(this, "LargeD0/FakeRatePlots/StandardTracks/Primary/TRT"),
+  m_fakePlots_st_primary_trtOut(this, "LargeD0/FakeRatePlots/StandardTracks/Primary/TRTOut"),
+  m_fakePlots_st_primary_noTrt(this, "LargeD0/FakeRatePlots/StandardTracks/Primary/NoTRT"),
+  m_fakePlots_st_primary_tubeFrac051(this, "LargeD0/FakeRatePlots/StandardTracks/Primary/TubeFrac05_1"),
+  m_fakePlots_st_primary_tubeFrac0405(this, "LargeD0/FakeRatePlots/StandardTracks/Primary/TubeFrac04_05"),
+  m_fakePlots_st_primary_tubeFrac004(this, "LargeD0/FakeRatePlots/StandardTracks/Primary/TubeFrac0_04"),
+  m_fakePlots_st_secondary(this, "LargeD0/FakeRatePlots/StandardTracks/Secondary"),
+  m_fakePlots_st_secondary_trtHit(this, "LargeD0/FakeRatePlots/StandardTracks/Secondary/TRT"),
+  m_fakePlots_st_secondary_trtOut(this, "LargeD0/FakeRatePlots/StandardTracks/Secondary/TRTOut"),
+  m_fakePlots_st_secondary_noTrt(this, "LargeD0/FakeRatePlots/StandardTracks/Secondary/NoTRT"),
+  m_fakePlots_st_secondary_tubeFrac051(this, "LargeD0/FakeRatePlots/StandardTracks/Secondary/TubeFrac05_1"),
+  m_fakePlots_st_secondary_tubeFrac0405(this, "LargeD0/FakeRatePlots/StandardTracks/Secondary/TubeFrac04_05"),
+  m_fakePlots_st_secondary_tubeFrac004(this, "LargeD0/FakeRatePlots/StandardTracks/Secondary/TubeFrac0_04"),
+  m_fakePlots_st_linked(this, "LargeD0/FakeRatePlots/StandardTracks/Linked"),
+  m_fakePlots_st_linked_trtHit(this, "LargeD0/FakeRatePlots/StandardTracks/Linked/TRT"),
+  m_fakePlots_st_linked_trtOut(this, "LargeD0/FakeRatePlots/StandardTracks/Linked/TRTOut"),
+  m_fakePlots_st_linked_noTrt(this, "LargeD0/FakeRatePlots/StandardTracks/Linked/NoTRT"),
+  m_fakePlots_st_linked_tubeFrac051(this, "LargeD0/FakeRatePlots/StandardTracks/Linked/TubeFrac05_1"),
+  m_fakePlots_st_linked_tubeFrac0405(this, "LargeD0/FakeRatePlots/StandardTracks/Linked/TubeFrac04_05"),
+  m_fakePlots_st_linked_tubeFrac004(this, "LargeD0/FakeRatePlots/StandardTracks/Linked/TubeFrac0_04"),
+  m_fakePlots_st_notruth(this, "LargeD0/FakeRatePlots/StandardTracks/NoTruth"),
+  m_fakePlots_st_notruth_trtHit(this, "LargeD0/FakeRatePlots/StandardTracks/NoTruth/TRT"),
+  m_fakePlots_st_notruth_trtOut(this, "LargeD0/FakeRatePlots/StandardTracks/NoTruth/TRTOut"),
+  m_fakePlots_st_notruth_noTrt(this, "LargeD0/FakeRatePlots/StandardTracks/NoTruth/NoTRT"),
+  m_fakePlots_st_notruth_tubeFrac051(this, "LargeD0/FakeRatePlots/StandardTracks/NoTruth/TubeFrac05_1"),
+  m_fakePlots_st_notruth_tubeFrac0405(this, "LargeD0/FakeRatePlots/StandardTracks/NoTruth/TubeFrac04_05"),
+  m_fakePlots_st_notruth_tubeFrac004(this, "LargeD0/FakeRatePlots/StandardTracks/NoTruth/TubeFrac0_04"),
+  m_fakePlots_st_combined(this, "LargeD0/FakeRatePlots/StandardTracks/Combined"),
+  m_fakePlots_st_combined_trtHit(this, "LargeD0/FakeRatePlots/StandardTracks/Combined/TRT"),
+  m_fakePlots_st_combined_trtOut(this, "LargeD0/FakeRatePlots/StandardTracks/Combined/TRTOut"),
+  m_fakePlots_st_combined_noTrt(this, "LargeD0/FakeRatePlots/StandardTracks/Combined/NoTRT"),
+  m_fakePlots_st_combined_tubeFrac051(this, "LargeD0/FakeRatePlots/StandardTracks/Combined/TubeFrac05_1"),
+  m_fakePlots_st_combined_tubeFrac0405(this, "LargeD0/FakeRatePlots/StandardTracks/Combined/TubeFrac04_05"),
+  m_fakePlots_st_combined_tubeFrac004(this, "LargeD0/FakeRatePlots/StandardTracks/Combined/TubeFrac0_04"),
+  
+  m_fakePlots_ld0(this, "LargeD0/FakeRatePlots/LargeD0Tracks"),
+  m_fakePlots_ld0_trtHit(this, "LargeD0/FakeRatePlots/LargeD0Tracks/TRT"),
+  m_fakePlots_ld0_trtOut(this, "LargeD0/FakeRatePlots/LargeD0Tracks/TRTOut"),
+  m_fakePlots_ld0_noTrt(this, "LargeD0/FakeRatePlots/LargeD0Tracks/NoTRT"),
+  m_fakePlots_ld0_tubeFrac051(this, "LargeD0/FakeRatePlots/LargeD0Tracks/TubeFrac05_1"),
+  m_fakePlots_ld0_tubeFrac0405(this, "LargeD0/FakeRatePlots/LargeD0Tracks/TubeFrac04_05"),
+  m_fakePlots_ld0_tubeFrac004(this, "LargeD0/FakeRatePlots/LargeD0Tracks/TubeFrac0_04"),
+  m_fakePlots_ld0_primary(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Primary"),
+  m_fakePlots_ld0_primary_trtHit(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Primary/TRT"),
+  m_fakePlots_ld0_primary_trtOut(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Primary/TRTOut"),
+  m_fakePlots_ld0_primary_noTrt(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Primary/NoTRT"),
+  m_fakePlots_ld0_primary_tubeFrac051(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Primary/TubeFrac05_1"),
+  m_fakePlots_ld0_primary_tubeFrac0405(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Primary/TubeFrac04_05"),
+  m_fakePlots_ld0_primary_tubeFrac004(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Primary/TubeFrac0_04"),
+  m_fakePlots_ld0_secondary(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Secondary"),
+  m_fakePlots_ld0_secondary_trtHit(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Secondary/TRT"),
+  m_fakePlots_ld0_secondary_trtOut(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Secondary/TRTOut"),
+  m_fakePlots_ld0_secondary_noTrt(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Secondary/NoTRT"),
+  m_fakePlots_ld0_secondary_tubeFrac051(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Secondary/TubeFrac05_1"),
+  m_fakePlots_ld0_secondary_tubeFrac0405(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Secondary/TubeFrac04_05"),
+  m_fakePlots_ld0_secondary_tubeFrac004(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Secondary/TubeFrac0_04"),
+  m_fakePlots_ld0_linked(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Linked"),
+  m_fakePlots_ld0_linked_trtHit(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Linked/TRT"),
+  m_fakePlots_ld0_linked_trtOut(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Linked/TRTOut"),
+  m_fakePlots_ld0_linked_noTrt(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Linked/NoTRT"),
+  m_fakePlots_ld0_linked_tubeFrac051(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Linked/TubeFrac05_1"),
+  m_fakePlots_ld0_linked_tubeFrac0405(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Linked/TubeFrac04_05"),
+  m_fakePlots_ld0_linked_tubeFrac004(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Linked/TubeFrac0_04"),
+  m_fakePlots_ld0_notruth(this, "LargeD0/FakeRatePlots/LargeD0Tracks/NoTruth"),
+  m_fakePlots_ld0_notruth_trtHit(this, "LargeD0/FakeRatePlots/LargeD0Tracks/NoTruth/TRT"),
+  m_fakePlots_ld0_notruth_trtOut(this, "LargeD0/FakeRatePlots/LargeD0Tracks/NoTruth/TRTOut"),
+  m_fakePlots_ld0_notruth_noTrt(this, "LargeD0/FakeRatePlots/LargeD0Tracks/NoTruth/NoTRT"), 
+  m_fakePlots_ld0_notruth_tubeFrac051(this, "LargeD0/FakeRatePlots/LargeD0Tracks/NoTruth/TubeFrac05_1"),
+  m_fakePlots_ld0_notruth_tubeFrac0405(this, "LargeD0/FakeRatePlots/LargeD0Tracks/NoTruth/TubeFrac04_05"),
+  m_fakePlots_ld0_notruth_tubeFrac004(this, "LargeD0/FakeRatePlots/LargeD0Tracks/NoTruth/TubeFrac0_04"),
+  m_fakePlots_ld0_combined(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Combined"),
+  m_fakePlots_ld0_combined_trtHit(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Combined/TRT"),
+  m_fakePlots_ld0_combined_trtOut(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Combined/TRTOut"),
+  m_fakePlots_ld0_combined_noTrt(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Combined/NoTRT"),
+  m_fakePlots_ld0_combined_tubeFrac051(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Combined/TubeFrac05_1"),
+  m_fakePlots_ld0_combined_tubeFrac0405(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Combined/TubeFrac04_05"),
+  m_fakePlots_ld0_combined_tubeFrac004(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Combined/TubeFrac0_04"),
+  
+  // Efficiency plots
+  m_effPlots_all(this, "LargeD0/EffPlots/AllTracks/"),
+  m_effPlots_all_trtHit(this, "LargeD0/EffPlots/AllTracks/TRT"),
+  m_effPlots_all_trtOut(this, "LargeD0/EffPlots/AllTracks/TRTOut"),
+  m_effPlots_all_noTrt(this, "LargeD0/EffPlots/AllTracks/noTRT"),
+  m_effPlots_all_signal(this, "LargeD0/EffPlots/AllTracks/Signal"),
+  m_effPlots_all_signal_trtHit(this, "LargeD0/EffPlots/AllTracks/Signal/TRT"),
+  m_effPlots_all_signal_trtOut(this, "LargeD0/EffPlots/AllTracks/Signal/TRTOut"),
+  m_effPlots_all_signal_noTrt(this, "LargeD0/EffPlots/AllTracks/Signal/noTRT"),
+  m_effPlots_all_signal_tubeFrac051(this, "LargeD0/EffPlots/AllTracks/Signal/TubeFrac05_1"),
+  m_effPlots_all_signal_tubeFrac0405(this, "LargeD0/EffPlots/AllTracks/Signal/TubeFrac04_05"),
+  m_effPlots_all_signal_tubeFrac004(this, "LargeD0/EffPlots/AllTracks/Signal/TubeFrac0_04"),
+
+  m_effPlots_st(this, "LargeD0/EffPlots/StandardTracks/"), 
+  m_effPlots_st_trtHit(this, "LargeD0/EffPlots/StandardTracks/TRT/"),
+  m_effPlots_st_trtOut(this, "LargeD0/EffPlots/StandardTracks/TRTOut/"),
+  m_effPlots_st_noTrt(this, "LargeD0/EffPlots/StandardTracks/noTRT/"),
+  m_effPlots_st_signal(this, "LargeD0/EffPlots/StandardTracks/Signal"),
+  m_effPlots_st_signal_trtHit(this, "LargeD0/EffPlots/StandardTracks/Signal/TRT"),
+  m_effPlots_st_signal_trtOut(this, "LargeD0/EffPlots/StandardTracks/Signal/TRTOut"),
+  m_effPlots_st_signal_noTrt(this, "LargeD0/EffPlots/StandardTracks/Signal/noTRT"),
+  m_effPlots_st_signal_tubeFrac051(this, "LargeD0/EffPlots/StandardTracks/Signal/TubeFrac05_1"),
+  m_effPlots_st_signal_tubeFrac0405(this, "LargeD0/EffPlots/StandardTracks/Signal/TubeFrac04_05"),
+  m_effPlots_st_signal_tubeFrac004(this, "LargeD0/EffPlots/StandardTracks/Signal/TubeFrac0_04"),
+
+  m_effPlots_ld0(this, "LargeD0/EffPlots/LargeD0Tracks"),
+  m_effPlots_ld0_trtHit(this, "LargeD0/EffPlots/LargeD0Tracks/TRT"),
+  m_effPlots_ld0_trtOut(this, "LargeD0/EffPlots/LargeD0Tracks/TRTOut"),
+  m_effPlots_ld0_noTrt(this, "LargeD0/EffPlots/LargeD0Tracks/noTRT"),
+  m_effPlots_ld0_signal(this, "LargeD0/EffPlots/LargeD0Tracks/Signal"),
+  m_effPlots_ld0_signal_trtHit(this, "LargeD0/EffPlots/LargeD0Tracks/Signal/TRT"),
+  m_effPlots_ld0_signal_trtOut(this, "LargeD0/EffPlots/LargeD0Tracks/Signal/TRTOut"),
+  m_effPlots_ld0_signal_noTrt(this, "LargeD0/EffPlots/LargeD0Tracks/Signal/noTRT"),
+  m_effPlots_ld0_signal_tubeFrac051(this, "LargeD0/EffPlots/LargeD0Tracks/Signal/TubeFrac05_1"),
+  m_effPlots_ld0_signal_tubeFrac0405(this, "LargeD0/EffPlots/LargeD0Tracks/Signal/TubeFrac04_05"),
+  m_effPlots_ld0_signal_tubeFrac004(this, "LargeD0/EffPlots/LargeD0Tracks/Signal/TubeFrac0_04"),
+
+  m_effPlots_stNonLd0(this, "LargeD0/EffPlots/StandardTracksNonLRT"),
+  m_effPlots_stNonLd0_trtHit(this, "LargeD0/EffPlots/StandardTracksNonLRT/TRT"),
+  m_effPlots_stNonLd0_trtOut(this, "LargeD0/EffPlots/StandardTracksNonLRT/TRTOut"),
+  m_effPlots_stNonLd0_noTrt(this, "LargeD0/EffPlots/StandardTracksNonLRT/noTRT"),
+  m_effPlots_stNonLd0_signal(this, "LargeD0/EffPlots/StandardTracksNonLRT/Signal"),
+  m_effPlots_stNonLd0_signal_trtHit(this, "LargeD0/EffPlots/StandardTracksNonLRT/Signal/TRT"),
+  m_effPlots_stNonLd0_signal_trtOut(this, "LargeD0/EffPlots/StandardTracksNonLRT/Signal/TRTOut"),
+  m_effPlots_stNonLd0_signal_noTrt(this, "LargeD0/EffPlots/StandardTracksNonLRT/Signal/noTRT"),
+  m_effPlots_stNonLd0_signal_tubeFrac051(this, "LargeD0/EffPlots/StandardTracksNonLRT/Signal/TubeFrac05_1"),
+  m_effPlots_stNonLd0_signal_tubeFrac0405(this, "LargeD0/EffPlots/StandardTracksNonLRT/Signal/TubeFrac04_05"),
+  m_effPlots_stNonLd0_signal_tubeFrac004(this, "LargeD0/EffPlots/StandardTracksNonLRT/Signal/TubeFrac0_04"),
+
+  m_effPlots_ld0NonSt(this, "LargeD0/EffPlots/LargeD0TracksNonStd"),
+  m_effPlots_ld0NonSt_trtHit(this, "LargeD0/EffPlots/LargeD0TracksNonStd/TRT"),
+  m_effPlots_ld0NonSt_trtOut(this, "LargeD0/EffPlots/LargeD0TracksNonStd/TRTOut"),
+  m_effPlots_ld0NonSt_noTrt(this, "LargeD0/EffPlots/LargeD0TracksNonStd/noTRT"),
+  m_effPlots_ld0NonSt_signal(this, "LargeD0/EffPlots/LargeD0TracksNonStd/Signal"),
+  m_effPlots_ld0NonSt_signal_trtHit(this, "LargeD0/EffPlots/LargeD0TracksNonStd/Signal/TRT"),
+  m_effPlots_ld0NonSt_signal_trtOut(this, "LargeD0/EffPlots/LargeD0TracksNonStd/Signal/TRTOut"),
+  m_effPlots_ld0NonSt_signal_noTrt(this, "LargeD0/EffPlots/LargeD0TracksNonStd/Signal/noTRT"),
+  m_effPlots_ld0NonSt_signal_tubeFrac051(this, "LargeD0/EffPlots/LargeD0TracksNonStd/Signal/TubeFrac05_1"),
+  m_effPlots_ld0NonSt_signal_tubeFrac0405(this, "LargeD0/EffPlots/LargeD0TracksNonStd/Signal/TubeFrac04_05"),
+  m_effPlots_ld0NonSt_signal_tubeFrac004(this, "LargeD0/EffPlots/LargeD0TracksNonStd/Signal/TubeFrac0_04"),
 
-// Reco info plots
-  m_TrackRecoInfoPlots_nonfake_st(this, "LargeD0/TrackRecoInfoPlots/StandardTracks/NonFakeTracks"),
-  m_TrackRecoInfoPlots_nonfake_ld0(this, "LargeD0/TrackRecoInfoPlots/LargeD0Tracks/NonFakeTracks"),
-  m_TrackRecoInfoPlots_fake_st(this, "LargeD0/TrackRecoInfoPlots/StandardTracks/FakeTracks"),
-  m_TrackRecoInfoPlots_fake_ld0(this, "LargeD0/TrackRecoInfoPlots/LargeD0Tracks/FakeTracks"),
-
-// Fake rate plots
-// m_fakePlots    (this,"LargeD0/FakeRatePlots/StandardTracks"),
-// m_fakePlotsLRT (this,"LargeD0/FakeRatePlots/LargeD0Tracks"),
-
-/**
- * Categories:
- *  (1) Primary:   Prob. > 0.5, truthlink valid and linking to primary particle   (barcode <  200k)
- *  (2) Secondary: Prob. > 0.5, truthlink valid and linking to secondary particle (barcode >= 200k or == 0)
- *  (3) No truth:  Prob. > 0.5, no truth link
- *  --(4) Fake:      Prob. < 0.5 --
- */
-
-  m_fakePlots_primary(this, "LargeD0/FakeRatePlots/StandardTracks/Primary"),
-  m_fakePlots_secondary(this, "LargeD0/FakeRatePlots/StandardTracks/Secondary"),
-  m_fakePlots_noTruth(this, "LargeD0/FakeRatePlots/StandardTracks/NoTruth"),
-  // m_fakePlots_fake     (this, "LargeD0/FakeRatePlots/StandardTracks/Fake"),
-  m_fakePlots_rest(this, "LargeD0/FakeRatePlots/StandardTracks/Rest"),
-
-  m_fakePlots_primary_LRT(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Primary"),
-  m_fakePlots_secondary_LRT(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Secondary"),
-  m_fakePlots_noTruth_LRT(this, "LargeD0/FakeRatePlots/LargeD0Tracks/NoTruth"),
-  // m_fakePlots_fake_LRT     (this, "LargeD0/FakeRatePlots/LargeD0Tracks/Fake"),
-  m_fakePlots_rest_LRT(this, "LargeD0/FakeRatePlots/LargeD0Tracks/Rest"),
-
-/*
-   m_fakePlots_noTruthLink    (this,"LargeD0/FakeRatePlots/StandardTracks/noTruthLink"),
-   m_fakePlots_noTruthLink_matched_05    (this,"LargeD0/FakeRatePlots/StandardTracks/noTruthLink_matched_05"),
-   m_fakePlots_noTruthLink_LRT    (this,"LargeD0/FakeRatePlots/LargeD0Tracks/noTruthLink"),
-   m_fakePlots_noTruthLink_matched_05_LRT    (this,"LargeD0/FakeRatePlots/LargeD0Tracks/noTruthLink_matched_05"),
- */
-
-
-// Efficiency plots
-  m_effPlotsStd(this, "LargeD0/EffPlots/StandardTracks/All"),    /* <-- Works...   */
-  m_effPlotsStdSignal(this, "LargeD0/EffPlots/StandardTracks/Signal"), /* <-- Doesn't... */
-  m_effPlotsStdTRT(this, "LargeD0/EffPlots/StandardTracks/TRT/"),
-  m_effPlotsStdTRTSignal(this, "LargeD0/EffPlots/StandardTracks/TRT/Signal"),
-  m_effPlotsStdnoTRT(this, "LargeD0/EffPlots/StandardTracks/noTRT/"),
-  m_effPlotsStdnoTRTSignal(this, "LargeD0/EffPlots/StandardTracks/noTRT/Signal"),
-  m_effPlotsLRT(this, "LargeD0/EffPlots/LargeD0Tracks/All"),
-  m_effPlotsLRTSignal(this, "LargeD0/EffPlots/LargeD0Tracks/Signal"),
-  m_effPlotsLRTTRT(this, "LargeD0/EffPlots/LargeD0Tracks/TRT"),
-  m_effPlotsLRTTRTSignal(this, "LargeD0/EffPlots/LargeD0Tracks/TRT/Signal"),
-  m_effPlotsLRTnoTRT(this, "LargeD0/EffPlots/LargeD0Tracks/noTRT"),
-  m_effPlotsLRTnoTRTSignal(this, "LargeD0/EffPlots/LargeD0Tracks/noTRT/Signal"),
-  m_effPlotsLRTnonStd(this, "LargeD0/EffPlots/LargeD0TracksNonStd/All"),
-  m_effPlotsLRTnonStdSignal(this, "LargeD0/EffPlots/LargeD0TracksNonStd/Signal"),
-  m_effPlotsLRTnonStdTRT(this, "LargeD0/EffPlots/LargeD0TracksNonStd/TRT"),
-  m_effPlotsLRTnonStdnoTRT(this, "LargeD0/EffPlots/LargeD0TracksNonStd/noTRT"),
-  m_effPlotsAll(this, "LargeD0/EffPlots/AllTracks/All"),
-  m_effPlotsAllSignal(this, "LargeD0/EffPlots/AllTracks/Signal"),
-  m_effPlotsAllTRT(this, "LargeD0/EffPlots/AllTracks/TRT"),
-  m_effPlotsAllTRTSignal(this, "LargeD0/EffPlots/AllTracks/TRT/Signal"),
-  m_effPlotsAllnoTRT(this, "LargeD0/EffPlots/AllTracks/noTRT"),
-  m_effPlotsAllnoTRTSignal(this, "LargeD0/EffPlots/AllTracks/noTRT/Signal"),
   m_effPlots(this, "LargeD0/EffPlots"),
-
-// =============================================================
-// plots not used for LargeD0
-// =============================================================
+  
+  // =============================================================
+  // plots not used for LargeD0
+  // =============================================================
   m_ptPlot(this, "LargeD0_NOTUSED/SelectedGoodTracks"),
   m_basicPlot(this, "LargeD0_NOTUSED/SelectedGoodTracks"),
-
+  
   m_PtEtaPlots(this, "LargeD0_NOTUSED/SelectedGoodTracks", "TrackParticle"),
   m_IPPlots(this, "LargeD0_NOTUSED/SelectedGoodTracks"),
-
+  
   m_TrackRecoInfoPlots(this, "LargeD0_NOTUSED/SelectedGoodTracks"),
   m_TrackTruthInfoPlots(this, "LargeD0_NOTUSED/Truth"),
   m_nTracks(this, "LargeD0_NOTUSED/SelectedGoodTracks"),
@@ -196,54 +340,70 @@ InDetRttLargeD0Plots::fill(const xAOD::TrackParticle &particle) {
 }
 
 void
-InDetRttLargeD0Plots::fill(const xAOD::TrackParticle &particle, const int barcode) {
-  m_trtTesting_nonfake.fill(particle);
-  if ((barcode > 0)and(barcode < 200000)) {
-    m_trtTesting_matching_truthLink_primary.fill(particle);
-  }else if (barcode >= 200000) {
-    m_trtTesting_matching_truthLink_secondary.fill(particle);
-  }else if (barcode == -1 or barcode == 0) {
-    m_trtTesting_matching_noTruthLink.fill(particle);
-  }
-
-
+InDetRttLargeD0Plots::fill(const xAOD::TrackParticle &particle, const int barcode, const xAOD::EventInfo& ei, const xAOD::VertexContainer& pv) {
+  const bool noTruthLink=((barcode == 0) or (barcode == -1));
   if (isLargeD0Track(particle)) {
-    m_basicPlot_nonfake_ld0.fill(particle);
-    m_ptPlot_nonfake_ld0.fill(particle);
-    m_TrackRecoInfoPlots_nonfake_ld0.fill(particle);
-    m_hitsPlots_nonfake_ld0.fill(particle);
-
-    // primary tracks
-    if ((barcode > 0)and(barcode < 200000)) {
-      m_hitsPlots_matching_truthLink_primary_ld0.fill(particle);
-    }
-    // secondary tracks
-    else if (barcode >= 200000) {
-      m_hitsPlots_matching_truthLink_secondary_ld0.fill(particle);
-    }
-    // no truth link
-    else if (barcode == -1 or barcode == 0) {
-      m_hitsPlots_matching_NotruthLink_ld0.fill(particle);
-    }
-  }else {
-    m_basicPlot_nonfake_st.fill(particle);
-    m_ptPlot_nonfake_st.fill(particle);
-    m_TrackRecoInfoPlots_nonfake_st.fill(particle);
-    m_hitsPlots_nonfake_st.fill(particle);
-
-    // primary tracks
-    if ((barcode > 0)and(barcode < 200000)) {
-      m_hitsPlots_matching_truthLink_primary_st.fill(particle);
-    }
-    // secondary tracks
-    else if (barcode >= 200000) {
-      m_hitsPlots_matching_truthLink_secondary_st.fill(particle);
+    //all ld0 tracks
+    m_trtTesting_ld0_matched.fill(particle,ei,pv);
+    m_hitsPlots_ld0_matched.fill(particle); 
+    m_basicPlot_ld0_matched.fill(particle);
+    m_ptPlot_ld0_matched.fill(particle);
+    m_TrackRecoInfoPlots_ld0_matched.fill(particle);
+    if (noTruthLink) { // no truth link
+      m_trtTesting_ld0_matched_noTruthLink.fill(particle,ei,pv);
+      m_hitsPlots_ld0_matched_noTruthLink.fill(particle);
+      m_basicPlot_ld0_matched_noTruthLink.fill(particle);
+      m_ptPlot_ld0_matched_noTruthLink.fill(particle);
+      m_TrackRecoInfoPlots_ld0_matched_noTruthLink.fill(particle);
+    } else {
+      if (barcode >= 200000) { // secondary tracks
+        m_trtTesting_ld0_matched_secondary.fill(particle,ei,pv);
+        m_hitsPlots_ld0_matched_secondary.fill(particle);
+        m_basicPlot_ld0_matched_secondary.fill(particle);
+        m_ptPlot_ld0_matched_secondary.fill(particle);
+        m_TrackRecoInfoPlots_ld0_matched_secondary.fill(particle);
+            } else if (barcode > 0) {  // primary tracks
+        m_trtTesting_ld0_matched_primary.fill(particle,ei,pv);
+        m_hitsPlots_ld0_matched_primary.fill(particle);
+        m_basicPlot_ld0_matched_primary.fill(particle);
+        m_ptPlot_ld0_matched_primary.fill(particle);
+        m_TrackRecoInfoPlots_ld0_matched_primary.fill(particle);
+      } else {
+	std::cout << "<InDetRttLargeD0Plots::fill> Barcode " << barcode << " was not recognised." << std::endl;
+      }
     }
-    // no truth link
-    else if (barcode == -1 or barcode == 0) {
-      m_hitsPlots_matching_NotruthLink_st.fill(particle);
+  } else {
+    //all std tracks
+    m_trtTesting_st_matched.fill(particle,ei,pv);
+    m_hitsPlots_st_matched.fill(particle);
+    m_basicPlot_st_matched.fill(particle);
+    m_ptPlot_st_matched.fill(particle);
+    m_TrackRecoInfoPlots_st_matched.fill(particle);
+    if (noTruthLink) { // no truth link
+      m_trtTesting_st_matched_noTruthLink.fill(particle,ei,pv);
+      m_hitsPlots_st_matched_noTruthLink.fill(particle);
+      m_basicPlot_st_matched_noTruthLink.fill(particle);
+      m_ptPlot_st_matched_noTruthLink.fill(particle);
+      m_TrackRecoInfoPlots_st_matched_noTruthLink.fill(particle);
+    } else { 
+      if (barcode >= 200000) { // secondary tracks 
+	m_trtTesting_st_matched_secondary.fill(particle,ei,pv);
+	m_hitsPlots_st_matched_secondary.fill(particle);
+	m_basicPlot_st_matched_secondary.fill(particle);
+	m_ptPlot_st_matched_secondary.fill(particle);
+	m_TrackRecoInfoPlots_st_matched_secondary.fill(particle);
+      } else if (barcode > 0) { // primary tracks
+	m_trtTesting_st_matched_primary.fill(particle,ei,pv);
+	m_hitsPlots_st_matched_primary.fill(particle);
+	m_basicPlot_st_matched_primary.fill(particle);
+	m_ptPlot_st_matched_primary.fill(particle);
+	m_TrackRecoInfoPlots_st_matched_primary.fill(particle);
+      } else {
+	std::cout << "<InDetRttLargeD0Plots::fill> Barcode " << barcode << " was not recognised." << std::endl;
+      }
     }
   }
+  
 }
 
 // ===================================================================================
@@ -252,19 +412,66 @@ InDetRttLargeD0Plots::fill(const xAOD::TrackParticle &particle, const int barcod
 // ===================================================================================
 
 void
-InDetRttLargeD0Plots::fillFake(const xAOD::TrackParticle &trackParticle) {
-  m_trtTesting_fakes.fill(trackParticle);
-
+InDetRttLargeD0Plots::fillFake(const xAOD::TrackParticle &trackParticle, const int barcode, const xAOD::EventInfo& ei, const xAOD::VertexContainer& pv) {
+  const bool noTruthLink=(barcode == 0) or (barcode == -1);
   if (isLargeD0Track(trackParticle)) {
-    m_hitsPlots_fake_ld0.fill(trackParticle);
-    m_basicPlot_fake_ld0.fill(trackParticle);
-    m_ptPlot_fake_ld0.fill(trackParticle);
-    m_TrackRecoInfoPlots_fake_ld0.fill(trackParticle);
+    m_trtTesting_ld0_fake.fill(trackParticle, ei, pv);
+    m_hitsPlots_ld0_fake.fill(trackParticle);
+    m_basicPlot_ld0_fake.fill(trackParticle);
+    m_ptPlot_ld0_fake.fill(trackParticle);
+    m_TrackRecoInfoPlots_ld0_fake.fill(trackParticle);
+    if (noTruthLink) { // no truth link
+      m_trtTesting_ld0_fake_noTruthLink.fill(trackParticle, ei, pv);
+      m_hitsPlots_ld0_fake_noTruthLink.fill(trackParticle);
+      m_basicPlot_ld0_fake_noTruthLink.fill(trackParticle);
+      m_ptPlot_ld0_fake_noTruthLink.fill(trackParticle);
+      m_TrackRecoInfoPlots_ld0_fake_noTruthLink.fill(trackParticle);
+    } else {
+      if (barcode >= 200000) { // secondary tracks
+	m_trtTesting_ld0_fake_secondary.fill(trackParticle,ei, pv);
+	m_hitsPlots_ld0_fake_secondary.fill(trackParticle);
+	m_basicPlot_ld0_fake_secondary.fill(trackParticle);
+	m_ptPlot_ld0_fake_secondary.fill(trackParticle);
+	m_TrackRecoInfoPlots_ld0_fake_secondary.fill(trackParticle);
+      } else if (barcode > 0) {  // primary tracks
+	m_trtTesting_ld0_fake_primary.fill(trackParticle,ei, pv);
+	m_hitsPlots_ld0_fake_primary.fill(trackParticle);
+	m_basicPlot_ld0_fake_primary.fill(trackParticle);
+	m_ptPlot_ld0_fake_primary.fill(trackParticle);
+	m_TrackRecoInfoPlots_ld0_fake_primary.fill(trackParticle);
+      } else {
+	std::cout << "<InDetRttLargeD0Plots::fill> Barcode " << barcode << " was not recognised." << std::endl;
+      }
+    }
   }else {
-    m_hitsPlots_fake_st.fill(trackParticle);
-    m_basicPlot_fake_st.fill(trackParticle);
-    m_ptPlot_fake_st.fill(trackParticle);
-    m_TrackRecoInfoPlots_fake_st.fill(trackParticle);
+    m_trtTesting_st_fake.fill(trackParticle,ei, pv);
+    m_hitsPlots_st_fake.fill(trackParticle);
+    m_basicPlot_st_fake.fill(trackParticle);
+    m_ptPlot_st_fake.fill(trackParticle);
+    m_TrackRecoInfoPlots_st_fake.fill(trackParticle);
+    if (noTruthLink) { // no truth link
+      m_trtTesting_st_fake_noTruthLink.fill(trackParticle,ei, pv);
+      m_hitsPlots_st_fake_noTruthLink.fill(trackParticle);
+      m_basicPlot_st_fake_noTruthLink.fill(trackParticle);
+      m_ptPlot_st_fake_noTruthLink.fill(trackParticle);
+      m_TrackRecoInfoPlots_st_fake_noTruthLink.fill(trackParticle);
+    } else {
+      if (barcode >= 200000) { // secondary tracks
+	m_trtTesting_st_fake_secondary.fill(trackParticle,ei, pv);
+	m_hitsPlots_st_fake_secondary.fill(trackParticle);
+	m_basicPlot_st_fake_secondary.fill(trackParticle);
+	m_ptPlot_st_fake_secondary.fill(trackParticle);
+	m_TrackRecoInfoPlots_st_fake_secondary.fill(trackParticle);
+      } else if (barcode > 0) {  // primary tracks
+	m_trtTesting_st_fake_primary.fill(trackParticle,ei, pv);
+	m_hitsPlots_st_fake_primary.fill(trackParticle);
+	m_basicPlot_st_fake_primary.fill(trackParticle);
+	m_ptPlot_st_fake_primary.fill(trackParticle);
+	m_TrackRecoInfoPlots_st_fake_primary.fill(trackParticle);
+      } else {
+	std::cout << "<InDetRttLargeD0Plots::fill> Barcode " << barcode << " was not recognised." << std::endl;
+      }
+    }
   }
 }
 
@@ -275,14 +482,14 @@ InDetRttLargeD0Plots::fillFake(const xAOD::TrackParticle &trackParticle) {
 
 void
 InDetRttLargeD0Plots::fillTruth(const xAOD::TruthParticle &truth) {
-  m_basicPlot_truth.fill(truth);
+  //m_basicPlot_truth.fill(truth);
 
   if ((truth.barcode() > 0)and(truth.barcode() < 200000)) {
-    m_basicPlot_primary_truth.fill(truth);
-    m_ptPlot_primary.fill(truth);
+    //m_basicPlot_primary_truth.fill(truth);
+    m_ptPlot_truth_primary.fill(truth);
   }else {
-    m_basicPlot_secondary_truth.fill(truth);
-    m_ptPlot_secondary.fill(truth);
+    //m_basicPlot_secondary_truth.fill(truth);
+    m_ptPlot_truth_secondary.fill(truth);
   }
 }
 
@@ -293,46 +500,98 @@ InDetRttLargeD0Plots::pro_fill(const xAOD::TruthParticle &truth, float weight) {
 
 void
 InDetRttLargeD0Plots::fillEfficiency(const xAOD::TruthParticle &truth, \
-                                     const bool isReconstructed,   \
-                                     const bool isLargeD0Track,    \
-                                     const bool isTRTExtended,     \
+                                     const bool isReconstructed,       \
+                                     const bool isLargeD0Track,	       \
+                                     const bool hasTRTHit,	       \
+				     const bool hasTRTOut,	       \
+				     const int  nTrtHits,	       \
+				     const int  nTrtTubeHits,	       \
                                      const bool isSignal) {
   unsigned int rec = (unsigned int) isReconstructed;
-  unsigned int LRT = (unsigned int) isLargeD0Track;
-  unsigned int TRT = (unsigned int) isTRTExtended;
-  // unsigned int sig = (unsigned int) isSignal;
+  unsigned int LRT = (unsigned int)(isLargeD0Track and isReconstructed);
+  unsigned int TRT = (unsigned int) hasTRTHit;
+  unsigned int TRTout = (unsigned int) hasTRTOut;
   bool isStandardTrack = false;
-
-  if (isReconstructed && !isLargeD0Track) {
+  double tubeFrac = -1.0;
+  if(nTrtHits > 0) {tubeFrac = ((double)nTrtTubeHits)/((double)nTrtHits); } //determine the fraction of TRT hits which are TRT tube hits (rather than precision hits)
+  bool tubeFrac05 = false;
+  if( tubeFrac < 0.5 ){ tubeFrac05 = true; }
+  bool tubeFrac04 = false;
+  if( tubeFrac < 0.4 ){ tubeFrac04 = true; }
+  unsigned int tubeFracLess05 = (unsigned int) tubeFrac05;
+  unsigned int tubeFracLess04 = (unsigned int) tubeFrac04;
+  if (!isLargeD0Track) {
     isStandardTrack = true;
   }
+  unsigned int STD = (unsigned int)(isStandardTrack and isReconstructed);
+
+  m_effPlots_all.pro_fill(truth, rec); //efficiency of all types of tracks - all matched reco tracks/all truth tracks
+  m_effPlots_all_trtHit.pro_fill(truth, rec and TRT); //how much of efficiency is from tracks with TRT hits?
+  m_effPlots_all_trtOut.pro_fill(truth, rec and TRTout and not TRT); //how much from tracks with TRT outliers but no TRT hits?
+  m_effPlots_all_noTrt.pro_fill(truth, rec and not TRT and not TRTout); //how much from tracks without any TRT contribution?
+  m_effPlots_st.pro_fill(truth, STD); //all matched reco tracks from standard tracking/all truth tracks
+  m_effPlots_st_trtHit.pro_fill(truth, STD and TRT);
+  m_effPlots_st_trtOut.pro_fill(truth, STD and TRTout and not TRT);
+  m_effPlots_st_noTrt.pro_fill(truth, STD and not TRT and not TRTout);
+  m_effPlots_ld0.pro_fill(truth, LRT); //all matched reco tracks from large d0 tracking/all truth tracks
+  m_effPlots_ld0_trtHit.pro_fill(truth, LRT and TRT);
+  m_effPlots_ld0_trtOut.pro_fill(truth, LRT and TRTout and not TRT);
+  m_effPlots_ld0_noTrt.pro_fill(truth, LRT and not TRT and not TRTout);
+
+  if (isStandardTrack) { //the point of these plots is that the denominator is only std tracks, so we can see the peformance of the std tracking itself as comparison to lrt
+    m_effPlots_stNonLd0.pro_fill(truth, STD);
+    m_effPlots_stNonLd0_trtHit.pro_fill(truth, STD and TRT);
+    m_effPlots_stNonLd0_trtOut.pro_fill(truth, STD and TRTout and not TRT);
+    m_effPlots_stNonLd0_noTrt.pro_fill(truth, STD and not TRT and not TRTout);
+  }
 
-  m_effPlotsAll.pro_fill(truth, rec);
-  m_effPlotsAllTRT.pro_fill(truth, rec and TRT);
-  m_effPlotsAllnoTRT.pro_fill(truth, rec and not TRT);
-  m_effPlotsStd.pro_fill(truth, rec and not LRT);
-  m_effPlotsLRT.pro_fill(truth, rec and LRT);
-  m_effPlotsStdTRT.pro_fill(truth, rec and TRT and not LRT);
-  m_effPlotsStdnoTRT.pro_fill(truth, rec and not TRT and not LRT);
-  m_effPlotsLRTTRT.pro_fill(truth, rec and LRT and TRT);
-  m_effPlotsLRTnoTRT.pro_fill(truth, rec and LRT and not TRT);
-
-  if (!(isStandardTrack)) {
-    m_effPlotsLRTnonStd.pro_fill(truth, rec and LRT);
-    m_effPlotsLRTnonStdTRT.pro_fill(truth, rec and LRT and TRT);
-    m_effPlotsLRTnonStdnoTRT.pro_fill(truth, rec and LRT and not TRT);
+  if (isLargeD0Track) { //the point of these plots is that the denominator is only ld0 tracks, so we can see the peformance of the ld0 tracking itself
+    m_effPlots_ld0NonSt.pro_fill(truth, LRT);
+    m_effPlots_ld0NonSt_trtHit.pro_fill(truth, LRT and TRT);
+    m_effPlots_ld0NonSt_trtOut.pro_fill(truth, rec and LRT and TRTout and not TRT);
+    m_effPlots_ld0NonSt_noTrt.pro_fill(truth, rec and LRT and not TRT and not TRTout);
   }
 
-  if (isSignal) {
-    m_effPlotsAllSignal.pro_fill(truth, rec);
-    m_effPlotsAllTRTSignal.pro_fill(truth, rec and TRT);
-    m_effPlotsAllnoTRTSignal.pro_fill(truth, rec and not TRT);
-    m_effPlotsStdSignal.pro_fill(truth, rec and not LRT);
-    m_effPlotsStdTRTSignal.pro_fill(truth, rec and TRT and not LRT);
-    m_effPlotsStdnoTRTSignal.pro_fill(truth, rec and not TRT and not LRT);
-    m_effPlotsLRTSignal.pro_fill(truth, rec and LRT);
-    m_effPlotsLRTTRTSignal.pro_fill(truth, rec and LRT and TRT);
-    m_effPlotsLRTnoTRTSignal.pro_fill(truth, rec and LRT and not TRT);
+  if (isSignal) { //reco signal tracks/tracks from all signal
+    m_effPlots_all_signal.pro_fill(truth, rec);
+    m_effPlots_all_signal_trtHit.pro_fill(truth, rec and TRT);
+    m_effPlots_all_signal_trtOut.pro_fill(truth, rec and TRTout and not TRT);
+    m_effPlots_all_signal_noTrt.pro_fill(truth, rec and not TRT and not TRTout);
+    m_effPlots_all_signal_tubeFrac051.pro_fill(truth, rec and TRT and not tubeFracLess05); //how much of eff comes from tracks with tube frac > 0.5?
+    m_effPlots_all_signal_tubeFrac0405.pro_fill(truth, rec and TRT and tubeFracLess05 and not tubeFracLess04); //how much from tracks with tube frac (0.4,0.5)
+    m_effPlots_all_signal_tubeFrac004.pro_fill(truth, rec and TRT and tubeFracLess04); //how much from tracks with tube frac < 0.4?
+    m_effPlots_st_signal.pro_fill(truth, STD);
+    m_effPlots_st_signal_trtHit.pro_fill(truth, STD and TRT);
+    m_effPlots_st_signal_trtOut.pro_fill(truth, STD and TRTout and not TRT);
+    m_effPlots_st_signal_noTrt.pro_fill(truth, STD and not TRT and not TRTout);
+    m_effPlots_st_signal_tubeFrac051.pro_fill(truth, STD and TRT and not tubeFracLess05);
+    m_effPlots_st_signal_tubeFrac0405.pro_fill(truth, STD and TRT and tubeFracLess05 and not tubeFracLess04);
+    m_effPlots_st_signal_tubeFrac004.pro_fill(truth, STD  and TRT and tubeFracLess04);
+    m_effPlots_ld0_signal.pro_fill(truth, LRT);
+    m_effPlots_ld0_signal_trtHit.pro_fill(truth, LRT and TRT);
+    m_effPlots_ld0_signal_trtOut.pro_fill(truth, LRT and TRTout and not TRT);
+    m_effPlots_ld0_signal_noTrt.pro_fill(truth, LRT and not TRT and not TRTout);
+    m_effPlots_ld0_signal_tubeFrac051.pro_fill(truth, LRT and TRT and not tubeFracLess05);
+    m_effPlots_ld0_signal_tubeFrac0405.pro_fill(truth, LRT and TRT and tubeFracLess05 and not tubeFracLess04);
+    m_effPlots_ld0_signal_tubeFrac004.pro_fill(truth, LRT and TRT and tubeFracLess04);
+    if (isStandardTrack) {
+      m_effPlots_stNonLd0_signal.pro_fill(truth, STD);
+      m_effPlots_stNonLd0_signal_trtHit.pro_fill(truth, STD and TRT);
+      m_effPlots_stNonLd0_signal_trtOut.pro_fill(truth, STD and TRTout and not TRT);
+      m_effPlots_stNonLd0_signal_noTrt.pro_fill(truth, STD and not TRT and not TRTout);
+      m_effPlots_stNonLd0_signal_tubeFrac051.pro_fill(truth, STD and TRT and not tubeFracLess05);
+      m_effPlots_stNonLd0_signal_tubeFrac0405.pro_fill(truth, STD and TRT and tubeFracLess05 and not tubeFracLess04);
+      m_effPlots_stNonLd0_signal_tubeFrac004.pro_fill(truth, STD and TRT and tubeFracLess04);
+    }
+    if (isLargeD0Track) {
+      m_effPlots_ld0NonSt_signal.pro_fill(truth, LRT);
+      m_effPlots_ld0NonSt_signal_trtHit.pro_fill(truth, LRT and TRT);
+      m_effPlots_ld0NonSt_signal_trtOut.pro_fill(truth, LRT and TRTout and not TRT);
+      m_effPlots_ld0NonSt_signal_noTrt.pro_fill(truth, LRT and not TRT and not TRTout);
+      m_effPlots_ld0NonSt_signal_tubeFrac051.pro_fill(truth, LRT and TRT and not tubeFracLess05);
+      m_effPlots_ld0NonSt_signal_tubeFrac0405.pro_fill(truth, LRT and TRT and tubeFracLess05 and not tubeFracLess04);
+      m_effPlots_ld0NonSt_signal_tubeFrac004.pro_fill(truth, LRT and TRT and tubeFracLess04);
+    }
   }
 
 
@@ -391,46 +650,114 @@ InDetRttLargeD0Plots::fillCounter(const unsigned int freq, const InDetPerfPlot_n
 }
 
 void
-InDetRttLargeD0Plots::fillFakeRate(const xAOD::TrackParticle &particle, const bool fake,
-                                   const InDetPerfPlot_fakes::Category /* c*/) {
-  // unsigned int link = (unsigned int) hasTruthLink;
-
-  // Get associated truth particle, is a valid link exists.
-  typedef ElementLink<xAOD::TruthParticleContainer> ElementTruthLink_t;
-  const xAOD::TruthParticle *truth = nullptr;
-  if (particle.isAvailable<ElementTruthLink_t>("truthParticleLink")) {
-    const ElementTruthLink_t truthContainer = particle.auxdata<ElementTruthLink_t>("truthParticleLink");
-    if (truthContainer.isValid()) {
-      truth = *truthContainer;
-    }
-  }
+InDetRttLargeD0Plots::fillFakeRate(const xAOD::TrackParticle &particle, \
+				   const bool fake,			\
+				   const int barcode,			\
+				   const bool trtHit,			\
+				   const bool trtOut,			\
+				   const int nTRTHit,			\
+				   const int nTRTTube) {
 
   // Declare and get necessary variables.
   const bool isLargeD0 = isLargeD0Track(particle);
-  const int barcode = (truth == nullptr ? -1 : truth->barcode());
-  const bool primary = (barcode < 200000 and barcode > 0); // match and ...
+  const bool primary   = (barcode < 200000 and barcode > 0); // match and ...
   const bool secondary = (barcode >= 200000); // match and ...
-
+  const bool notruthlink = ((barcode == 0) or (barcode == -1));
+  double tubeFrac = -1.0;
+  if(nTRTHit > 0) tubeFrac = ((double)nTRTTube)/((double)nTRTHit);
+  bool tubeFrac05 = false;
+  if( tubeFrac < 0.5 ){ tubeFrac05 = true; }
+  bool tubeFrac04 = false;
+  if( tubeFrac < 0.4 ){ tubeFrac04 = true; }
+ 
   // Fill fakerate distributions.
-  if (isLargeD0) {
-    if (primary) {
-      m_fakePlots_primary_LRT.fill(particle, fake);
-    } else if (secondary) {
-      m_fakePlots_secondary_LRT.fill(particle, fake);
-    } else if (barcode == -1 or barcode == 0) {
-      m_fakePlots_noTruth_LRT.fill(particle, fake);
-    } else {
-      m_fakePlots_rest_LRT.fill(particle, fake);
-    }
-  } else {
-    if (primary) {
-      m_fakePlots_primary.fill(particle, fake);
-    } else if (secondary) {
-      m_fakePlots_secondary.fill(particle, fake);
-    } else if (barcode == -1 or barcode == 0) {
-      m_fakePlots_noTruth.fill(particle, fake);
-    } else {
-      m_fakePlots_rest.fill(particle, fake);
-    }
+  /* "New" definition, cf. [https://indico.cern.ch/event/559023/contributions/2255673/attachments/1314623/1968909/2016.07.25.pdf] */
+  if (isLargeD0) { // ld0 fakes (matching prob < 0.5) or not associated to a particle with finite barcode/all ld0 tracks
+    m_fakePlots_ld0                       .fill(particle, fake); //numerator is tracks that are fake, regardless of barcode status
+    m_fakePlots_ld0_trtHit                .fill(particle, fake and trtHit); //for tracks with any number of trt hits 
+    m_fakePlots_ld0_trtOut                .fill(particle, fake and trtOut and not trtHit); //for tracks with some trt outliers but no trt hits
+    m_fakePlots_ld0_noTrt                 .fill(particle, fake and not trtHit and not trtOut); //tracks with no trt hits/outliers of any kind
+    m_fakePlots_ld0_tubeFrac051           .fill(particle, fake and trtHit and not tubeFrac05); //tracks with trt hits with tube fraction > 0.5
+    m_fakePlots_ld0_tubeFrac0405          .fill(particle, fake and trtHit and tubeFrac05 and not tubeFrac04); //tracks with trt hits and tube fraction (.4,.5);
+    m_fakePlots_ld0_tubeFrac004           .fill(particle, fake and trtHit and tubeFrac04); //tracks with trt hits and tube fraction < 0.4
+    m_fakePlots_ld0_primary               .fill(particle, fake and primary); //numeator is tracks that are fake and have barcode > 0 and < 200 000
+    m_fakePlots_ld0_primary_trtHit        .fill(particle, fake and primary and trtHit);
+    m_fakePlots_ld0_primary_trtOut        .fill(particle, fake and primary and trtOut and not trtHit);
+    m_fakePlots_ld0_primary_noTrt         .fill(particle, fake and primary and not trtHit and not trtOut);
+    m_fakePlots_ld0_primary_tubeFrac051   .fill(particle, fake and primary and trtHit and not tubeFrac05);
+    m_fakePlots_ld0_primary_tubeFrac0405  .fill(particle, fake and primary and trtHit and tubeFrac05 and not tubeFrac04);
+    m_fakePlots_ld0_primary_tubeFrac004   .fill(particle, fake and primary and trtHit and tubeFrac04);
+    m_fakePlots_ld0_secondary             .fill(particle, fake and secondary); //numerator is tracks that are fake and have barcode > 200 000
+    m_fakePlots_ld0_secondary_trtHit      .fill(particle, fake and secondary and trtHit);
+    m_fakePlots_ld0_secondary_trtOut      .fill(particle, fake and secondary and trtOut and not trtHit);
+    m_fakePlots_ld0_secondary_noTrt       .fill(particle, fake and secondary and not trtHit and not trtOut);
+    m_fakePlots_ld0_secondary_tubeFrac051 .fill(particle, fake and secondary and trtHit and not tubeFrac05);
+    m_fakePlots_ld0_secondary_tubeFrac0405.fill(particle, fake and secondary and trtHit and tubeFrac05 and not tubeFrac04);
+    m_fakePlots_ld0_secondary_tubeFrac004 .fill(particle, fake and secondary and trtHit and tubeFrac04);
+    m_fakePlots_ld0_linked                .fill(particle, fake and (primary or secondary)); //numerator is tracks that are fake and have any finite barcode
+    m_fakePlots_ld0_linked_trtHit         .fill(particle, fake and (primary or secondary) and trtHit);
+    m_fakePlots_ld0_linked_trtOut         .fill(particle, fake and (primary or secondary) and trtOut and not trtHit);
+    m_fakePlots_ld0_linked_noTrt          .fill(particle, fake and (primary or secondary) and not trtHit and not trtOut);
+    m_fakePlots_ld0_linked_tubeFrac051    .fill(particle, fake and (primary or secondary) and trtHit and not tubeFrac05);
+    m_fakePlots_ld0_linked_tubeFrac0405   .fill(particle, fake and (primary or secondary) and trtHit and tubeFrac05 and not tubeFrac04);
+    m_fakePlots_ld0_linked_tubeFrac004    .fill(particle, fake and (primary or secondary) and trtHit and tubeFrac04);
+    m_fakePlots_ld0_notruth               .fill(particle, fake and notruthlink); //numerator is tracks that are fake and have barcode 0/no barcode
+    m_fakePlots_ld0_notruth_trtHit        .fill(particle, fake and notruthlink and trtHit);
+    m_fakePlots_ld0_notruth_trtOut        .fill(particle, fake and notruthlink and trtOut and not trtHit);
+    m_fakePlots_ld0_notruth_noTrt         .fill(particle, fake and notruthlink and not trtHit and not trtOut);
+    m_fakePlots_ld0_notruth_tubeFrac051   .fill(particle, fake and notruthlink and trtHit and not tubeFrac05);
+    m_fakePlots_ld0_notruth_tubeFrac0405  .fill(particle, fake and notruthlink and trtHit and tubeFrac05 and not tubeFrac04);
+    m_fakePlots_ld0_notruth_tubeFrac004   .fill(particle, fake and notruthlink and trtHit and tubeFrac04);
+    m_fakePlots_ld0_combined              .fill(particle, (fake or notruthlink)); //numerator tracks that are either fake or barcode 0/no barcode
+    m_fakePlots_ld0_combined_trtHit       .fill(particle, (fake or notruthlink) and trtHit);
+    m_fakePlots_ld0_combined_trtOut       .fill(particle, (fake or notruthlink) and trtOut and not trtHit);
+    m_fakePlots_ld0_combined_noTrt        .fill(particle, (fake or notruthlink) and not trtHit and not trtOut);
+    m_fakePlots_ld0_combined_tubeFrac051  .fill(particle, (fake or notruthlink) and trtHit and not tubeFrac05);
+    m_fakePlots_ld0_combined_tubeFrac0405 .fill(particle, (fake or notruthlink) and trtHit and tubeFrac05 and not tubeFrac04);
+    m_fakePlots_ld0_combined_tubeFrac004  .fill(particle, (fake or notruthlink) and trtHit and tubeFrac04);
+  } else {// st fakes (matching prob < 0.5) or not associated to a particle with finite barcode/all std tracks
+    m_fakePlots_st                        .fill(particle, fake);
+    m_fakePlots_st_trtHit                 .fill(particle, fake and trtHit); 
+    m_fakePlots_st_trtOut                 .fill(particle, fake and trtOut and not trtHit);
+    m_fakePlots_st_noTrt                  .fill(particle, fake and not trtHit and not trtOut);
+    m_fakePlots_st_primary                .fill(particle, fake and primary);
+    m_fakePlots_st_tubeFrac051            .fill(particle, fake and trtHit and not tubeFrac05);
+    m_fakePlots_st_tubeFrac0405           .fill(particle, fake and trtHit and tubeFrac05 and not tubeFrac04);
+    m_fakePlots_st_tubeFrac004            .fill(particle, fake and trtHit and tubeFrac04);
+    m_fakePlots_st_primary_trtHit         .fill(particle, fake and primary and trtHit); 
+    m_fakePlots_st_primary_trtOut         .fill(particle, fake and primary and trtOut and not trtHit);
+    m_fakePlots_st_primary_noTrt          .fill(particle, fake and primary and not trtHit and not trtOut);
+    m_fakePlots_st_primary_tubeFrac051    .fill(particle, fake and primary and trtHit and not tubeFrac05);
+    m_fakePlots_st_primary_tubeFrac0405   .fill(particle, fake and primary and trtHit and tubeFrac05 and not tubeFrac04);
+    m_fakePlots_st_primary_tubeFrac004    .fill(particle, fake and primary and trtHit and tubeFrac04);
+    m_fakePlots_st_secondary              .fill(particle, fake and secondary); 
+    m_fakePlots_st_secondary_trtHit       .fill(particle, fake and secondary and trtHit);
+    m_fakePlots_st_secondary_trtOut       .fill(particle, fake and secondary and trtOut and not trtHit);
+    m_fakePlots_st_secondary_noTrt        .fill(particle, fake and secondary and not trtHit and not trtOut);
+    m_fakePlots_st_secondary_tubeFrac051  .fill(particle, fake and secondary and trtHit and not tubeFrac05);
+    m_fakePlots_st_secondary_tubeFrac0405 .fill(particle, fake and secondary and trtHit and tubeFrac05 and not tubeFrac04);
+    m_fakePlots_st_secondary_tubeFrac004  .fill(particle, fake and secondary and trtHit and tubeFrac04);
+    m_fakePlots_st_linked_trtHit          .fill(particle, fake and (primary or secondary) and trtHit);
+    m_fakePlots_st_linked_trtOut          .fill(particle, fake and (primary or secondary) and trtOut and not trtHit);
+    m_fakePlots_st_linked_noTrt           .fill(particle, fake and (primary or secondary) and not trtHit and not trtOut);
+    m_fakePlots_st_linked_tubeFrac051     .fill(particle, fake and (primary or secondary) and trtHit and not tubeFrac05);
+    m_fakePlots_st_linked_tubeFrac0405    .fill(particle, fake and (primary or secondary) and trtHit and tubeFrac05 and not tubeFrac04);
+    m_fakePlots_st_linked_tubeFrac004     .fill(particle, fake and (primary or secondary) and trtHit and tubeFrac04);
+    m_fakePlots_st_linked                 .fill(particle, fake and (primary or secondary)); 
+    m_fakePlots_st_notruth                .fill(particle, fake and notruthlink);
+    m_fakePlots_st_notruth_trtHit         .fill(particle, fake and notruthlink and trtHit);
+    m_fakePlots_st_notruth_trtOut         .fill(particle, fake and notruthlink and trtOut and not trtHit);
+    m_fakePlots_st_notruth_noTrt          .fill(particle, fake and notruthlink and not trtHit and not trtOut);
+    m_fakePlots_st_notruth_tubeFrac051    .fill(particle, fake and notruthlink and trtHit and not tubeFrac05);
+    m_fakePlots_st_notruth_tubeFrac0405   .fill(particle, fake and notruthlink and trtHit and tubeFrac05 and not tubeFrac04);
+    m_fakePlots_st_notruth_tubeFrac004    .fill(particle, fake and notruthlink and trtHit and tubeFrac04);
+    m_fakePlots_st_combined               .fill(particle, (fake or notruthlink));
+    m_fakePlots_st_combined_trtHit        .fill(particle, (fake or notruthlink) and trtHit);
+    m_fakePlots_st_combined_trtOut        .fill(particle, (fake or notruthlink) and trtOut and not trtHit);
+    m_fakePlots_st_combined_noTrt         .fill(particle, (fake or notruthlink) and not trtHit and not trtOut);
+    m_fakePlots_st_combined_tubeFrac051   .fill(particle, (fake or notruthlink) and trtHit and not tubeFrac05);
+    m_fakePlots_st_combined_tubeFrac0405  .fill(particle, (fake or notruthlink) and trtHit and tubeFrac05 and not tubeFrac04);
+    m_fakePlots_st_combined_tubeFrac004   .fill(particle, (fake or notruthlink) and trtHit and tubeFrac04);
   }
+
 }
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttLargeD0Plots.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttLargeD0Plots.h
index 0c73a10d60249e47571fd3bf315b48c917a83e60..31b4d6cc5d809d4260e1629e639f12a98fb47613 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttLargeD0Plots.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttLargeD0Plots.h
@@ -44,6 +44,7 @@
 #include "xAODTracking/Vertex.h"
 #include "xAODTracking/VertexContainer.h"
 #include "xAODEventInfo/EventInfo.h"
+#include "xAODTracking/VertexContainer.h"
 
 ///class holding all plots for Inner Detector RTT Validation and implementing fill methods
 class InDetRttLargeD0Plots: public InDetPlotBase {
@@ -53,7 +54,7 @@ public:
   // void fill(const xAOD::TrackParticle& particle, const xAOD::TruthParticle& truthParticle); // not used. SC
   ///fill for things needing track only
   void fill(const xAOD::TrackParticle &particle);
-  void fill(const xAOD::TrackParticle &particle, const int barcode);
+  void fill(const xAOD::TrackParticle &particle, const int barcode, const xAOD::EventInfo& ei, const xAOD::VertexContainer& pv);
   ///fill for things needing truth only
   void fill(const xAOD::TruthParticle &particle);
   ///fill for things needing all truth - not just the ones from the reco tracks
@@ -64,7 +65,10 @@ public:
   void fillEfficiency(const xAOD::TruthParticle &particle,      \
                       const bool isReconstructed,               \
                       const bool isLargeD0Track = false,        \
-                      const bool isTRTExtended = false,     \
+                      const bool hasTRTHit = false,		\
+		      const bool hasTRTOut = false,		\
+		      const int  nTrtHits = 0,			\
+		      const int  nTrtTubeHits = 0,		\
                       const bool isSignal = false);
 
 
@@ -82,103 +86,272 @@ public:
   ///fill for Counters
   void fillCounter(const unsigned int freq, const InDetPerfPlot_nTracks::CounterCategory counter);
   ///fill for fakes
-  void fillFakeRate(const xAOD::TrackParticle &particle, const bool isFake,
-                    const InDetPerfPlot_fakes::Category c = InDetPerfPlot_fakes::ALL);
+  void fillFakeRate(const xAOD::TrackParticle &particle,		\
+		    const bool isFake,					\
+		    const int barcode = -1,				\
+		    const bool trtHit = false,				\
+		    const bool trtOut = false,				\
+		    const int nTRTHit = 0,				\
+		    const int nTRTTube = 0);
 
   ///fill for fakes (Siinn)
-  void fillFake(const xAOD::TrackParticle &particle);
+  void fillFake(const xAOD::TrackParticle &particle, const int barcode, const xAOD::EventInfo &ei, const xAOD::VertexContainer &pv);
 private:
   // ============================================
   // Plots used for LargeD0 performance study
   // ============================================
 
   // Testing track categories/authors for TRT studies
-  InDetPerfPlot_TrtTest m_trtTesting_nonfake;
-  InDetPerfPlot_TrtTest m_trtTesting_matching_truthLink_primary;
-  InDetPerfPlot_TrtTest m_trtTesting_matching_truthLink_secondary;
-  InDetPerfPlot_TrtTest m_trtTesting_matching_noTruthLink;
-  InDetPerfPlot_TrtTest m_trtTesting_fakes;
-  //       InDetPerfPlot_TrtTest m_trtTesting_fakes_noTruthLink;
+  InDetPerfPlot_TrtTest m_trtTesting_st_matched;
+  InDetPerfPlot_TrtTest m_trtTesting_st_matched_primary;
+  InDetPerfPlot_TrtTest m_trtTesting_st_matched_secondary;
+  InDetPerfPlot_TrtTest m_trtTesting_st_matched_noTruthLink;
+  InDetPerfPlot_TrtTest m_trtTesting_st_fake;
+  InDetPerfPlot_TrtTest m_trtTesting_st_fake_primary;
+  InDetPerfPlot_TrtTest m_trtTesting_st_fake_secondary;
+  InDetPerfPlot_TrtTest m_trtTesting_st_fake_noTruthLink;
+
+  InDetPerfPlot_TrtTest m_trtTesting_ld0_matched;
+  InDetPerfPlot_TrtTest m_trtTesting_ld0_matched_primary;
+  InDetPerfPlot_TrtTest m_trtTesting_ld0_matched_secondary;
+  InDetPerfPlot_TrtTest m_trtTesting_ld0_matched_noTruthLink;
+  InDetPerfPlot_TrtTest m_trtTesting_ld0_fake;
+  InDetPerfPlot_TrtTest m_trtTesting_ld0_fake_primary;
+  InDetPerfPlot_TrtTest m_trtTesting_ld0_fake_secondary;
+  InDetPerfPlot_TrtTest m_trtTesting_ld0_fake_noTruthLink;
 
   // hit plots
-  Trk::IDHitPlots m_hitsPlots_nonfake_st;
-  Trk::IDHitPlots m_hitsPlots_matching_truthLink_primary_st;
-  Trk::IDHitPlots m_hitsPlots_matching_truthLink_secondary_st;
-  Trk::IDHitPlots m_hitsPlots_matching_NotruthLink_st;
-  Trk::IDHitPlots m_hitsPlots_fake_st;
-
-  Trk::IDHitPlots m_hitsPlots_nonfake_ld0;
-  Trk::IDHitPlots m_hitsPlots_matching_truthLink_primary_ld0;
-  Trk::IDHitPlots m_hitsPlots_matching_truthLink_secondary_ld0;
-  Trk::IDHitPlots m_hitsPlots_matching_NotruthLink_ld0;
-  Trk::IDHitPlots m_hitsPlots_fake_ld0;
+  Trk::IDHitPlots m_hitsPlots_st_matched;
+  Trk::IDHitPlots m_hitsPlots_st_matched_primary;
+  Trk::IDHitPlots m_hitsPlots_st_matched_secondary;
+  Trk::IDHitPlots m_hitsPlots_st_matched_noTruthLink;
+  Trk::IDHitPlots m_hitsPlots_st_fake;
+  Trk::IDHitPlots m_hitsPlots_st_fake_primary;
+  Trk::IDHitPlots m_hitsPlots_st_fake_secondary;
+  Trk::IDHitPlots m_hitsPlots_st_fake_noTruthLink;
+
+  Trk::IDHitPlots m_hitsPlots_ld0_matched;
+  Trk::IDHitPlots m_hitsPlots_ld0_matched_primary;
+  Trk::IDHitPlots m_hitsPlots_ld0_matched_secondary;
+  Trk::IDHitPlots m_hitsPlots_ld0_matched_noTruthLink;
+  Trk::IDHitPlots m_hitsPlots_ld0_fake;
+  Trk::IDHitPlots m_hitsPlots_ld0_fake_primary;
+  Trk::IDHitPlots m_hitsPlots_ld0_fake_secondary;
+  Trk::IDHitPlots m_hitsPlots_ld0_fake_noTruthLink;
 
   // basic plots
-  InDetBasicPlot m_basicPlot_nonfake_st;
-  InDetBasicPlot m_basicPlot_nonfake_ld0;
-  InDetBasicPlot m_basicPlot_fake_st;
-  InDetBasicPlot m_basicPlot_fake_ld0;
-  InDetBasicPlot m_basicPlot_truth;
-
-  InDetBasicPlot m_basicPlot_primary_truth;
-  InDetBasicPlot m_basicPlot_secondary_truth;
-
-  InDetBasicPlot m_basicPlot_pileup_primary_truth;
-  InDetBasicPlot m_basicPlot_pileup_secondary_truth;
+  InDetBasicPlot m_basicPlot_st_matched;
+  InDetBasicPlot m_basicPlot_st_matched_primary;
+  InDetBasicPlot m_basicPlot_st_matched_secondary;
+  InDetBasicPlot m_basicPlot_st_matched_noTruthLink;
+  InDetBasicPlot m_basicPlot_st_fake;
+  InDetBasicPlot m_basicPlot_st_fake_primary;
+  InDetBasicPlot m_basicPlot_st_fake_secondary;
+  InDetBasicPlot m_basicPlot_st_fake_noTruthLink;
+  
+  InDetBasicPlot m_basicPlot_ld0_matched;
+  InDetBasicPlot m_basicPlot_ld0_matched_primary;
+  InDetBasicPlot m_basicPlot_ld0_matched_secondary;
+  InDetBasicPlot m_basicPlot_ld0_matched_noTruthLink;
+  InDetBasicPlot m_basicPlot_ld0_fake;
+  InDetBasicPlot m_basicPlot_ld0_fake_primary;
+  InDetBasicPlot m_basicPlot_ld0_fake_secondary;
+  InDetBasicPlot m_basicPlot_ld0_fake_noTruthLink;
 
   // pT plots
-  InDetPerfPlot_Pt m_ptPlot_nonfake_st;
-  InDetPerfPlot_Pt m_ptPlot_nonfake_ld0;
-  InDetPerfPlot_Pt m_ptPlot_fake_st;
-  InDetPerfPlot_Pt m_ptPlot_fake_ld0;
-
-  InDetPerfPlot_Pt m_ptPlot_primary;
-  InDetPerfPlot_Pt m_ptPlot_secondary;
+  InDetPerfPlot_Pt m_ptPlot_st_matched;
+  InDetPerfPlot_Pt m_ptPlot_st_matched_primary;
+  InDetPerfPlot_Pt m_ptPlot_st_matched_secondary;
+  InDetPerfPlot_Pt m_ptPlot_st_matched_noTruthLink;
+  InDetPerfPlot_Pt m_ptPlot_st_fake;
+  InDetPerfPlot_Pt m_ptPlot_st_fake_primary;
+  InDetPerfPlot_Pt m_ptPlot_st_fake_secondary;
+  InDetPerfPlot_Pt m_ptPlot_st_fake_noTruthLink;
+
+  InDetPerfPlot_Pt m_ptPlot_ld0_matched;
+  InDetPerfPlot_Pt m_ptPlot_ld0_matched_primary;
+  InDetPerfPlot_Pt m_ptPlot_ld0_matched_secondary;
+  InDetPerfPlot_Pt m_ptPlot_ld0_matched_noTruthLink;
+  InDetPerfPlot_Pt m_ptPlot_ld0_fake;
+  InDetPerfPlot_Pt m_ptPlot_ld0_fake_primary;
+  InDetPerfPlot_Pt m_ptPlot_ld0_fake_secondary;
+  InDetPerfPlot_Pt m_ptPlot_ld0_fake_noTruthLink;
+
+  InDetPerfPlot_Pt m_ptPlot_truth_primary;
+  InDetPerfPlot_Pt m_ptPlot_truth_secondary;
 
   InDetPerfPlot_Pt m_ptPlot_pileup_primary;
   InDetPerfPlot_Pt m_ptPlot_pileup_secondary;
 
 
   // Reco info plots
-  Trk::RecoInfoPlots m_TrackRecoInfoPlots_nonfake_st;
-  Trk::RecoInfoPlots m_TrackRecoInfoPlots_nonfake_ld0;
-  Trk::RecoInfoPlots m_TrackRecoInfoPlots_fake_st;
-  Trk::RecoInfoPlots m_TrackRecoInfoPlots_fake_ld0;
+  Trk::RecoInfoPlots m_TrackRecoInfoPlots_st_matched;
+  Trk::RecoInfoPlots m_TrackRecoInfoPlots_st_matched_primary;
+  Trk::RecoInfoPlots m_TrackRecoInfoPlots_st_matched_secondary;
+  Trk::RecoInfoPlots m_TrackRecoInfoPlots_st_matched_noTruthLink;
+  Trk::RecoInfoPlots m_TrackRecoInfoPlots_st_fake;
+  Trk::RecoInfoPlots m_TrackRecoInfoPlots_st_fake_primary;
+  Trk::RecoInfoPlots m_TrackRecoInfoPlots_st_fake_secondary;
+  Trk::RecoInfoPlots m_TrackRecoInfoPlots_st_fake_noTruthLink;
+
+  Trk::RecoInfoPlots m_TrackRecoInfoPlots_ld0_matched;
+  Trk::RecoInfoPlots m_TrackRecoInfoPlots_ld0_matched_primary;
+  Trk::RecoInfoPlots m_TrackRecoInfoPlots_ld0_matched_secondary;
+  Trk::RecoInfoPlots m_TrackRecoInfoPlots_ld0_matched_noTruthLink;
+  Trk::RecoInfoPlots m_TrackRecoInfoPlots_ld0_fake;
+  Trk::RecoInfoPlots m_TrackRecoInfoPlots_ld0_fake_primary;
+  Trk::RecoInfoPlots m_TrackRecoInfoPlots_ld0_fake_secondary;
+  Trk::RecoInfoPlots m_TrackRecoInfoPlots_ld0_fake_noTruthLink;
+
 
   // Fake rate plots.
-  InDetPerfPlot_ExtendedFakes m_fakePlots_primary;
-  InDetPerfPlot_ExtendedFakes m_fakePlots_secondary;
-  InDetPerfPlot_ExtendedFakes m_fakePlots_noTruth;
-  InDetPerfPlot_ExtendedFakes m_fakePlots_rest;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_trtHit;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_trtOut;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_noTrt;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_tubeFrac051;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_tubeFrac0405;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_tubeFrac004;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_primary;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_primary_trtHit;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_primary_trtOut;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_primary_noTrt;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_primary_tubeFrac051;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_primary_tubeFrac0405;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_primary_tubeFrac004;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_secondary;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_secondary_trtHit;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_secondary_trtOut;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_secondary_noTrt;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_secondary_tubeFrac051;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_secondary_tubeFrac0405;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_secondary_tubeFrac004;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_linked;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_linked_trtHit;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_linked_trtOut;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_linked_noTrt;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_linked_tubeFrac051;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_linked_tubeFrac0405;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_linked_tubeFrac004;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_notruth;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_notruth_trtHit;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_notruth_trtOut;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_notruth_noTrt;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_notruth_tubeFrac051;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_notruth_tubeFrac0405;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_notruth_tubeFrac004;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_combined;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_combined_trtHit;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_combined_trtOut;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_combined_noTrt;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_combined_tubeFrac051;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_combined_tubeFrac0405;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_st_combined_tubeFrac004;
+
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_trtHit;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_trtOut;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_noTrt;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_tubeFrac051;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_tubeFrac0405;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_tubeFrac004;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_primary;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_primary_trtHit;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_primary_trtOut;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_primary_noTrt;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_primary_tubeFrac051;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_primary_tubeFrac0405;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_primary_tubeFrac004;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_secondary;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_secondary_trtHit;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_secondary_trtOut;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_secondary_noTrt;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_secondary_tubeFrac051;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_secondary_tubeFrac0405;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_secondary_tubeFrac004;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_linked;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_linked_trtHit;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_linked_trtOut;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_linked_noTrt;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_linked_tubeFrac051;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_linked_tubeFrac0405;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_linked_tubeFrac004;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_notruth;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_notruth_trtHit;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_notruth_trtOut;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_notruth_noTrt;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_notruth_tubeFrac051;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_notruth_tubeFrac0405;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_notruth_tubeFrac004;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_combined;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_combined_trtHit;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_combined_trtOut;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_combined_noTrt;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_combined_tubeFrac051;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_combined_tubeFrac0405;
+  InDetPerfPlot_ExtendedFakes m_fakePlots_ld0_combined_tubeFrac004;
 
-  InDetPerfPlot_ExtendedFakes m_fakePlots_primary_LRT;
-  InDetPerfPlot_ExtendedFakes m_fakePlots_secondary_LRT;
-  InDetPerfPlot_ExtendedFakes m_fakePlots_noTruth_LRT;
-  InDetPerfPlot_ExtendedFakes m_fakePlots_rest_LRT;
 
   // Efficiency plots
-  InDetPerfPlot_Eff m_effPlotsStd;
-  InDetPerfPlot_Eff m_effPlotsStdSignal;
-  InDetPerfPlot_Eff m_effPlotsStdTRT;
-  InDetPerfPlot_Eff m_effPlotsStdTRTSignal;
-  InDetPerfPlot_Eff m_effPlotsStdnoTRT;
-  InDetPerfPlot_Eff m_effPlotsStdnoTRTSignal;
-  InDetPerfPlot_Eff m_effPlotsLRT;
-  InDetPerfPlot_Eff m_effPlotsLRTSignal;
-  InDetPerfPlot_Eff m_effPlotsLRTTRT;
-  InDetPerfPlot_Eff m_effPlotsLRTTRTSignal;
-  InDetPerfPlot_Eff m_effPlotsLRTnoTRT;
-  InDetPerfPlot_Eff m_effPlotsLRTnoTRTSignal;
-  InDetPerfPlot_Eff m_effPlotsLRTnonStd;
-  InDetPerfPlot_Eff m_effPlotsLRTnonStdSignal;
-  InDetPerfPlot_Eff m_effPlotsLRTnonStdTRT;
-  InDetPerfPlot_Eff m_effPlotsLRTnonStdnoTRT;
-  InDetPerfPlot_Eff m_effPlotsAll;
-  InDetPerfPlot_Eff m_effPlotsAllSignal;
-  InDetPerfPlot_Eff m_effPlotsAllTRT;
-  InDetPerfPlot_Eff m_effPlotsAllTRTSignal;
-  InDetPerfPlot_Eff m_effPlotsAllnoTRT;
-  InDetPerfPlot_Eff m_effPlotsAllnoTRTSignal;
+  InDetPerfPlot_Eff m_effPlots_all;
+  InDetPerfPlot_Eff m_effPlots_all_trtHit;
+  InDetPerfPlot_Eff m_effPlots_all_trtOut;
+  InDetPerfPlot_Eff m_effPlots_all_noTrt;
+  InDetPerfPlot_Eff m_effPlots_all_signal;
+  InDetPerfPlot_Eff m_effPlots_all_signal_trtHit;
+  InDetPerfPlot_Eff m_effPlots_all_signal_trtOut;
+  InDetPerfPlot_Eff m_effPlots_all_signal_noTrt;
+  InDetPerfPlot_Eff m_effPlots_all_signal_tubeFrac051;
+  InDetPerfPlot_Eff m_effPlots_all_signal_tubeFrac0405;
+  InDetPerfPlot_Eff m_effPlots_all_signal_tubeFrac004;
+
+  InDetPerfPlot_Eff m_effPlots_st;
+  InDetPerfPlot_Eff m_effPlots_st_trtHit;
+  InDetPerfPlot_Eff m_effPlots_st_trtOut;
+  InDetPerfPlot_Eff m_effPlots_st_noTrt;
+  InDetPerfPlot_Eff m_effPlots_st_signal;
+  InDetPerfPlot_Eff m_effPlots_st_signal_trtHit;
+  InDetPerfPlot_Eff m_effPlots_st_signal_trtOut;
+  InDetPerfPlot_Eff m_effPlots_st_signal_noTrt;
+  InDetPerfPlot_Eff m_effPlots_st_signal_tubeFrac051;
+  InDetPerfPlot_Eff m_effPlots_st_signal_tubeFrac0405;
+  InDetPerfPlot_Eff m_effPlots_st_signal_tubeFrac004;
+
+  InDetPerfPlot_Eff m_effPlots_ld0;
+  InDetPerfPlot_Eff m_effPlots_ld0_trtHit;
+  InDetPerfPlot_Eff m_effPlots_ld0_trtOut;
+  InDetPerfPlot_Eff m_effPlots_ld0_noTrt;
+  InDetPerfPlot_Eff m_effPlots_ld0_signal;
+  InDetPerfPlot_Eff m_effPlots_ld0_signal_trtHit;
+  InDetPerfPlot_Eff m_effPlots_ld0_signal_trtOut;
+  InDetPerfPlot_Eff m_effPlots_ld0_signal_noTrt;
+  InDetPerfPlot_Eff m_effPlots_ld0_signal_tubeFrac051;
+  InDetPerfPlot_Eff m_effPlots_ld0_signal_tubeFrac0405;
+  InDetPerfPlot_Eff m_effPlots_ld0_signal_tubeFrac004;
+
+  InDetPerfPlot_Eff m_effPlots_stNonLd0;
+  InDetPerfPlot_Eff m_effPlots_stNonLd0_trtHit;
+  InDetPerfPlot_Eff m_effPlots_stNonLd0_trtOut;
+  InDetPerfPlot_Eff m_effPlots_stNonLd0_noTrt;
+  InDetPerfPlot_Eff m_effPlots_stNonLd0_signal;
+  InDetPerfPlot_Eff m_effPlots_stNonLd0_signal_trtHit;
+  InDetPerfPlot_Eff m_effPlots_stNonLd0_signal_trtOut;
+  InDetPerfPlot_Eff m_effPlots_stNonLd0_signal_noTrt;
+  InDetPerfPlot_Eff m_effPlots_stNonLd0_signal_tubeFrac051;
+  InDetPerfPlot_Eff m_effPlots_stNonLd0_signal_tubeFrac0405;
+  InDetPerfPlot_Eff m_effPlots_stNonLd0_signal_tubeFrac004;
+
+  InDetPerfPlot_Eff m_effPlots_ld0NonSt;
+  InDetPerfPlot_Eff m_effPlots_ld0NonSt_trtHit;
+  InDetPerfPlot_Eff m_effPlots_ld0NonSt_trtOut;
+  InDetPerfPlot_Eff m_effPlots_ld0NonSt_noTrt;
+  InDetPerfPlot_Eff m_effPlots_ld0NonSt_signal;
+  InDetPerfPlot_Eff m_effPlots_ld0NonSt_signal_trtHit;
+  InDetPerfPlot_Eff m_effPlots_ld0NonSt_signal_trtOut;
+  InDetPerfPlot_Eff m_effPlots_ld0NonSt_signal_noTrt;
+  InDetPerfPlot_Eff m_effPlots_ld0NonSt_signal_tubeFrac051;
+  InDetPerfPlot_Eff m_effPlots_ld0NonSt_signal_tubeFrac0405;
+  InDetPerfPlot_Eff m_effPlots_ld0NonSt_signal_tubeFrac004;
 
   InDetPerfPlot_Eff m_effPlots;
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.cxx
index 15a47d25d39062f32bb98101840952adfe50089c..a087d96d35cf2b42a172d417a9e1b026d7203c39 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.cxx
@@ -188,6 +188,11 @@ InDetRttPlots::pro_fill(const xAOD::TruthParticle &truth, float weight) {
   m_fakePlots.fillIncFakeDenom(truth);
 }
 
+void
+InDetRttPlots::lepton_fill(const xAOD::TruthParticle &truth, float weight){
+  m_effPlots.lepton_fill(truth, weight);
+}
+
 void
 InDetRttPlots::BT_fill(const xAOD::TruthParticle &truth, float weight) {
   m_effPlots.BT_fill(truth, weight);
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.h
index 7beb2caaf00c22047d361c74638c435a33e3734f..5b6c9b9cb65e1a2a3c214ffbe2c5fe0ecb420365 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/InDetRttPlots.h
@@ -73,10 +73,12 @@ public:
   void fillTwoMatchDuplicate(Float_t prob1, Float_t prob2, const xAOD::TrackParticle &trackParticle,
                              const xAOD::TrackParticle &particle, const xAOD::TruthParticle &tp);
   ///fill for things needing all truth - not just the ones from the reco tracks
-  void BT_fill(const xAOD::TruthParticle &truth, float weight);
-
   void pro_fill(const xAOD::TruthParticle &truth, float weight);
 
+  void lepton_fill(const xAOD::TruthParticle &truth, float weight);
+
+  void BT_fill(const xAOD::TruthParticle &truth, float weight);
+
   // fill the fake and bad match rate plots
   void fillBMR(const xAOD::TrackParticle &track, float weight);
   void fillRF(const xAOD::TrackParticle &track, float weight);
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackSelectionTool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackSelectionTool.cxx
index 836c789f57080813cd55e5572fd577f1c17f6d6e..9a696d73a2ca89b403505558266eb0c2f4bce0c9 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackSelectionTool.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackSelectionTool.cxx
@@ -4,7 +4,7 @@
 
 // InDetPhysValMonitoring includes
 #include "TrackSelectionTool.h"
-
+#include <cmath> //std::fabs
 
 TrackSelectionTool::TrackSelectionTool(const std::string &name) :
   asg::AsgTool(name),
@@ -292,22 +292,22 @@ TrackSelectionTool::accept(const xAOD::TrackParticle *p) const {
     m_accept.setCutResult("minPt", p->pt() > m_minPt);
   }
   if (m_maxEta > -1) {
-    m_accept.setCutResult("maxEta", p->pt() > 1E-07 ? fabs(p->eta() < m_maxEta) : false);
+    m_accept.setCutResult("maxEta", p->pt() > 1E-07 ? std::fabs(p->eta()) < m_maxEta : false);
   }
   if (m_minEta > -1) {
-    m_accept.setCutResult("minEta", p->pt() > 1E-07 ? fabs(p->eta()) > m_minEta : false);
+    m_accept.setCutResult("minEta", p->pt() > 1E-07 ? std::fabs(p->eta()) > m_minEta : false);
   }
   if (m_maxPrimaryImpact > -1) {
-    m_accept.setCutResult("maxPrimaryImpact", fabs(p->d0()) < m_maxPrimaryImpact);
+    m_accept.setCutResult("maxPrimaryImpact", std::fabs(p->d0()) < m_maxPrimaryImpact);
   }
   if (m_maxZImpact > -1) {
-    m_accept.setCutResult("maxZImpact", fabs(p->z0()) < m_maxZImpact);
+    m_accept.setCutResult("maxZImpact", std::fabs(p->z0()) < m_maxZImpact);
   }
   if (m_minPrimaryImpact > -1) {
-    m_accept.setCutResult("minPrimaryImpact", fabs(p->d0()) > m_minPrimaryImpact);
+    m_accept.setCutResult("minPrimaryImpact", std::fabs(p->d0()) > m_minPrimaryImpact);
   }
   if (m_minZImpact > -1) {
-    m_accept.setCutResult("minZImpact", fabs(p->z0()) > m_minZImpact);
+    m_accept.setCutResult("minZImpact", std::fabs(p->z0()) > m_minZImpact);
   }
   if (m_maxSecondaryImpact > -1) {
     m_accept.setCutResult("maxSecondaryImpact", true /* nop */);
@@ -366,7 +366,7 @@ TrackSelectionTool::accept(const xAOD::TrackParticle *p) const {
     m_accept.setCutResult("maxSCTHits", iSCTHits <= m_maxSCTHits);
   }
   if (m_minSCTHits > -1) {
-    m_accept.setCutResult("minSCTHits", iSCTHits <= m_minSCTHits);
+    m_accept.setCutResult("minSCTHits", iSCTHits >= m_minSCTHits);
   }
   if (m_maxTRTOutliers > -1) {
     m_accept.setCutResult("maxTRTOutliers", iTRTOutliers <= m_maxTRTOutliers);
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackSelectionTool.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackSelectionTool.h
index d88065cdfc8374d253978098c354299a34245f17..1e6a4ee5591792d88b0926d1b71afd86982dfed7 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackSelectionTool.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackSelectionTool.h
@@ -10,6 +10,7 @@
 #include "xAODTracking/TrackParticle.h"
 #include "AsgTools/AsgTool.h"
 
+
 class TrackSelectionTool:
   public virtual ::IAsgSelectionTool,
   public asg::AsgTool  {
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackTruthLookup.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackTruthLookup.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..4740da20ea2b94d5607dbb623a6675dc46436abf
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackTruthLookup.cxx
@@ -0,0 +1,115 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "TrackTruthLookup.h"
+
+namespace IDPVM {
+
+// Utility function to get the linked truth particle from a track.
+// Taken directly from InDetPhysValLargeD0Tool.cxx
+const xAOD::TruthParticle* getTruthPointer(const xAOD::TrackParticle &track) {
+  typedef ElementLink<xAOD::TruthParticleContainer> ElementTruthLink_t;
+  const xAOD::TruthParticle *result(nullptr);
+
+  // Check whether truthParticleLink exists.
+  if (track.isAvailable<ElementTruthLink_t>("truthParticleLink")) {
+    // If so, get linked xAOD::TruthParticle.
+    const ElementTruthLink_t ptruthContainer = \
+      track.auxdata<ElementTruthLink_t>("truthParticleLink");
+    if (ptruthContainer.isValid()) {
+      result = *ptruthContainer;
+    }
+  }
+  return result;
+}
+
+std::vector<const xAOD::TrackParticle*> 
+TrackTruthLookup::getTracks(const xAOD::TruthParticle* truth) const{
+  // C++ try-catch blocks are zero-cost if no exception is thrown, so 
+  // performance should be unaffected by this check.
+  try {
+    return m_mapTruth.at(truth);
+  } catch (const std::out_of_range& oor) {
+    throw std::out_of_range("Truth particle was not found in lookup map. Did you remember to call TrackTruthLookup::cache?");
+    }
+  return {};
+}
+
+const xAOD::TruthParticle* 
+TrackTruthLookup::getTruth(const xAOD::TrackParticle* track) const{
+  // C++ try-catch blocks are zero-cost if no exception is thrown, so 
+  // performance should be unaffected by this check.
+  try {
+    return m_mapTrack.at(track);
+  } catch (const std::out_of_range& oor) {
+    throw std::out_of_range("Track particle was not found in lookup map. Did you remember to call TrackTruthLookup::cache?");
+  }
+  return nullptr;
+}
+
+void 
+TrackTruthLookup::cacheTracks(const xAOD::TrackParticleContainer* trackParticles){
+  // Cache all track particles.
+  for (const xAOD::TrackParticle* track : *trackParticles) {
+    const xAOD::TruthParticle* truth = getTruthPointer(*track);
+
+    // Store pointer, even if null.
+    m_mapTrack[track] = truth; 
+
+    // Store link in reverse direction as well, to avoid O(N^2) complexity.
+    if (truth) { 
+      if (!contains(truth)) {
+        // New truth particle; initialise vector.
+        m_mapTruth[truth] = {track}; 
+      } else {
+        // Existing truth particle; append vector.
+        m_mapTruth[truth].push_back(track); 
+      }
+    }
+  }
+  return;
+}
+
+void
+TrackTruthLookup::cacheTruth(const xAOD::TruthParticleContainer* truthParticles){
+  // Cache remaining truth particles.
+  for (const xAOD::TruthParticle* truth : *truthParticles) {
+    if (!contains(truth)) { m_mapTruth[truth] = {}; }
+  }
+  return;
+}
+
+void
+TrackTruthLookup::cacheTruth(const std::vector<const xAOD::TruthParticle*> * truthParticlesVec){
+  // Cache remaining truth particles.
+  for (const xAOD::TruthParticle* truth : *truthParticlesVec) {
+    if (!contains(truth)) { m_mapTruth[truth] = {}; }
+  }
+  return;
+}
+
+
+void
+TrackTruthLookup::cache(const xAOD::TrackParticleContainer* trackParticles,
+			const xAOD::TruthParticleContainer* truthParticles) {
+
+  // Clear existing cache.
+  clear();
+  cacheTracks(trackParticles);
+  cacheTruth(truthParticles);
+  return;
+}
+
+void
+TrackTruthLookup::cache(const xAOD::TrackParticleContainer* trackParticles,
+			const std::vector<const xAOD::TruthParticle*> * truthParticlesVec) {
+
+  // Clear existing cache.
+  clear();
+  cacheTracks(trackParticles);
+  cacheTruth(truthParticlesVec);
+  return;
+}
+
+} // namespace
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackTruthLookup.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackTruthLookup.h
new file mode 100644
index 0000000000000000000000000000000000000000..ef7d23b505d6fe5326311676a2fb506caec38c93
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackTruthLookup.h
@@ -0,0 +1,159 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef INDETPHYSVALMONITORING_TRACKTRUTHLOOKUP_H
+#define INDETPHYSVALMONITORING_TRACKTRUTHLOOKUP_H 1
+
+/**
+ * @file   TrackTruthLookup.h
+ * @author Andreas Sogaard <andreas.sogaard@cern.ch>
+ * @date   5 November 2016
+ **/
+
+// STL include(s)
+#include <unordered_map> /* std::unordered_map */
+#include <vector> /* std::vector */
+#include <stdexcept> /* std::out_of_range */
+
+// xAOD include(s)
+#include "xAODTracking/TrackParticle.h"
+#include "xAODTracking/TrackParticleContainer.h"
+#include "xAODTruth/TruthParticle.h"
+#include "xAODTruth/TruthParticleContainer.h"
+
+namespace IDPVM {
+
+/**
+ * Class for providing fast lookup of linked tracks and truth particles. 
+ *
+ * Intended to be used to avoid nested loops when matching tracks and truth
+ * particles, e.g. when computing efficiencies.
+ * 
+ * The links are stored in two unordered maps (single caching call per event,
+ * with O(N) complexity), emulating a bidirectional[1] map with O(1) look-up
+ * complexity. Tracks in the provided container are guaranteed to exist in the
+ * corresponding map, but may map to a nullptr if no link to a truth particle
+ * exists. Conversely, every truth particle is guaranteed to exist in the 
+ * corresponding map, but may map to an empty vector if no link to a track 
+ * exists.
+ *
+ * Use, e.g. in the InDetPhysValLargeD0Tool, like:
+ * 
+ *     [InDetPhysValMonitoring/InDetPhysValLargeD0Tool.h]
+ *         #include "src/TrackTruthLookup.h"
+ *         ...   
+ *         private:
+ *             std::unique_ptr<IDPVM::TrackTruthLookup> m_lookup;
+ *         ...
+ *
+ *     [src/InDetPhysValLargeD0Tool.cxx]
+ *         InDetPhysValLargeD0Tool::initialize() {
+ *             ...
+ *             m_lookup = std::move(std::unique_ptr<IDPVM::TrackTruthLookup>(new IDPVM::TrackTruthLookup()));
+ *             ...
+ *         }
+ *         ...
+ *         InDetPhysValLargeD0Tool::fillHistograms() {
+ *             ...
+ *             m_lookup->cache(ptracks, truthParticles);
+ *             ...
+ *             for (const auto &thisTruth : *truthParticles) {
+ *                 for (const auto& track :  m_lookup->getTracks(thisTruth)) {
+ *                     // Only looping explicitly associated tracks, hence
+ *                     // O(N) complexity rather than O(N^2).
+ *                 }
+ *             }
+ *             ...
+ *         }         
+ *
+ * [1] It is not *exactly* bidirectional, since the mapping track <-> truth is 
+ *     not exactly bijective: tracks are injective (one-to-one) on the set of
+ *     truth particles but one truth particle may (although rarely) be 
+ *     associated to more than one track.
+ */
+class TrackTruthLookup {
+
+ public:
+  /// Constructor(s).
+  TrackTruthLookup() {}
+  
+  TrackTruthLookup(const xAOD::TrackParticleContainer* trackParticles,
+		   const xAOD::TruthParticleContainer* truthParticles) {
+    cache(trackParticles, truthParticles);
+  }
+  
+  TrackTruthLookup(const xAOD::TrackParticleContainer* trackParticles,
+		   const std::vector<const xAOD::TruthParticle*> * truthParticlesVec) {
+    cache(trackParticles, truthParticlesVec);
+  }
+
+  /// Destructor.
+  ~TrackTruthLookup() {}
+
+  /** @name CacheMethods 
+   *  Methods for initial cache generation of links between associated 
+   *  tracks and truth particles in the provided containers.
+   */
+  //@{ 
+  /** Cache using a vector of TruthParticles, for compatibility with datatype returned
+	 *  from the xAOD::TruthEvent::truthParticleLinks()
+	 */
+  void cache(const xAOD::TrackParticleContainer* trackParticles,
+	     const std::vector<const xAOD::TruthParticle*> * truthParticlesVec);
+	     
+	/// Generate cache from usual evtStore() retrieved container pointers.
+	void cache(const xAOD::TrackParticleContainer* trackParticles,
+	     const xAOD::TruthParticleContainer* truthParticles);
+  //@}
+  
+  /** Accessor to get the vector of xAOD::TrackParticles associated with 'truth',
+   *  possibly empty if none is associated.
+   *  Throws out_of_range exception if truth particle does not exist in cache.
+   */
+  std::vector<const xAOD::TrackParticle*> getTracks(const xAOD::TruthParticle* truth) const;
+
+  /** Accessor to get the unique xAOD::TruthParticle associated with 'track', or
+   *  a nullptr is none is associated.
+   * Throws out_of_range exception if track does not exist in cache.
+   */
+  const xAOD::TruthParticle* getTruth(const xAOD::TrackParticle* track) const;
+
+  /// Returns true if the Lookup contains the pointer 'truth'.
+  inline bool contains (const xAOD::TruthParticle* truth) const { 
+    return m_mapTruth.find(truth) != m_mapTruth.end(); 
+  }
+
+  /// Returns true if the Lookup contains the pointer 'track'.
+  inline bool contains (const xAOD::TrackParticle* track) const{ 
+    return m_mapTrack.find(track) != m_mapTrack.end(); 
+  }
+
+  /// Clears the contents of the unordered map data members.
+  inline void clear() {
+    m_mapTrack.clear();
+    m_mapTruth.clear();
+    return;
+  }
+
+
+ private:
+  void cacheTracks(const xAOD::TrackParticleContainer* trackParticles);
+  void cacheTruth(const xAOD::TruthParticleContainer* truthParticles);
+  void cacheTruth(const std::vector<const xAOD::TruthParticle*> * truthParticlesVec);
+  /// Data member(s).
+  // Mapping of xAOD::TrackParticle to their unique associated
+  // xAOD::TruthParticle. nullptr if none exist.
+  std::unordered_map<const xAOD::TrackParticle*, 
+                     const xAOD::TruthParticle*> m_mapTrack;
+
+  // Mapping of xAOD::TruthParticle to vector of their (possibly multiple
+  // associated xAOD::TrackParticles. Empty if none exist.
+  std::unordered_map<const xAOD::TruthParticle*, 
+                     std::vector<const xAOD::TrackParticle*> > m_mapTruth;
+
+}; 
+
+} // namespace
+
+#endif // > !INDETPHYSVALMONITORING_TRACKTRUTHLOOKUP_H
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackTruthSelectionTool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackTruthSelectionTool.cxx
index 7c5b697cb41ab82a34350ee9efb3349c089fa4e6..6f829048b259f54c006964151d0f973dfa68d738 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackTruthSelectionTool.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackTruthSelectionTool.cxx
@@ -5,14 +5,15 @@
 // InDetPhysValMonitoring includes
 #include "TrackTruthSelectionTool.h"
 #include "xAODTruth/TruthVertex.h"
+#include <cmath> //std::fabs
 
 
 TrackTruthSelectionTool::TrackTruthSelectionTool(const std::string &name) :
   asg::AsgTool(name)
   , m_accept("TrackTruthSelection")
   , m_numTruthProcessed(0)
-  , m_numTruthPassed(0) ,
-  m_maxProdVertRadius(0){
+  , m_numTruthPassed(0) {
+
   declareInterface<IAsgSelectionTool>(this);
 
   // declareProperty( "Property", m_nProperty ); //example property declaration
@@ -22,7 +23,7 @@ TrackTruthSelectionTool::TrackTruthSelectionTool(const std::string &name) :
   declareProperty("maxBarcode", m_maxBarcode = 200e3); 
   declareProperty("requireCharged", m_requireCharged = true); 
   declareProperty("requireStatus1", m_requireStatus1 = true); 
-  declareProperty("requireDecayBeforePixel", m_requireDecayBeforePixel = true); 
+  declareProperty("maxProdVertRadius", m_maxProdVertRadius = 110.);
   declareProperty("pdgId", m_pdgId = -1);
 } 
 
@@ -115,7 +116,7 @@ TrackTruthSelectionTool::accept(const xAOD::TruthParticle *p) const {
 
   // Check cuts
   if (m_maxEta > -1) {
-    m_accept.setCutResult("eta", (p->pt() > 1e-7 ? (fabs(p->eta()) < m_maxEta) : false));
+    m_accept.setCutResult("eta", (p->pt() > 1e-7 ? (std::fabs(p->eta()) < m_maxEta) : false));
   }
   if (m_minPt > -1) {
     m_accept.setCutResult("min_pt", (p->pt() > m_minPt));
@@ -137,7 +138,7 @@ TrackTruthSelectionTool::accept(const xAOD::TruthParticle *p) const {
     m_accept.setCutResult("decay_before_pixel", (!p->hasProdVtx() || p->prodVtx()->perp() < m_maxProdVertRadius));
   }
   if (m_pdgId > -1) {
-    m_accept.setCutResult("pdgId", (fabs(p->pdgId()) == m_pdgId));// 3-18-16 normally on, disabled for testing
+    m_accept.setCutResult("pdgId", (std::fabs(p->pdgId()) == m_pdgId));// 3-18-16 normally on, disabled for testing
   }
   // Book keep cuts
   for (const auto &cut : m_cuts) {
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackTruthSelectionTool.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackTruthSelectionTool.h
index 8f7441e85a640b049a1e22edda26e49db4775ee4..9c1dae9cbc0ab1b4d297af00ae6559a4405cb136 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackTruthSelectionTool.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/TrackTruthSelectionTool.h
@@ -40,9 +40,8 @@ private:
   float m_maxBarcode;
   bool m_requireCharged;
   bool m_requireStatus1;
-  bool m_requireDecayBeforePixel;
   // max decay radius for secondaries [mm];
-  // set to within (Run2) pixel by default
+  // set to within (Run2) pixel by default; set to <0 for no cut
   double m_maxProdVertRadius;
   int m_pdgId;
 };
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/components/InDetPhysValMonitoring_entries.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/components/InDetPhysValMonitoring_entries.cxx
index 91c37bc97d13ca4f398a1d12d52dea2260460697..d39857ac45778528aff1524c9198c324321cde7b 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/components/InDetPhysValMonitoring_entries.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/components/InDetPhysValMonitoring_entries.cxx
@@ -7,10 +7,12 @@
 #include "../TruthClassDecoratorTool.h"
 #include "InDetPhysValMonitoring/InDetPhysValDecoratorAlg.h"
 #include "../TrackTruthSelectionTool.h"
+#include "../dRMatchingTool.h"
 #include "../TrackSelectionTool.h"
 #include "InDetPhysValMonitoring/HistogramDefinitionSvc.h"
 #include "InDetPhysValMonitoring/AlgTestHistoDefSvc.h"
 #include "InDetPhysValMonitoring/ToolTestMonitoringPlots.h"
+#include "../AthTruthSelectionTool.h"
 
 #include "../DummyTrackSlimmingTool.h"
 
@@ -25,11 +27,15 @@ DECLARE_TOOL_FACTORY(InDetPhysHitDecoratorTool)
 DECLARE_TOOL_FACTORY(ParameterErrDecoratorTool)
 DECLARE_TOOL_FACTORY(TruthClassDecoratorTool)
 DECLARE_TOOL_FACTORY(TrackTruthSelectionTool)
+DECLARE_TOOL_FACTORY(dRMatchingTool)
 DECLARE_TOOL_FACTORY(TrackSelectionTool)
 DECLARE_TOOL_FACTORY( DummyTrackSlimmingTool)
+DECLARE_TOOL_FACTORY( AthTruthSelectionTool)
 
 DECLARE_FACTORY_ENTRIES(InDetPhysValMonitoring){
-  DECLARE_SERVICE(HistogramDefinitionSvc)
+    DECLARE_ALGORITHM( InDetPhysValDecoratorAlg )
+    DECLARE_ALGORITHM( AlgTestHistoDefSvc )
+    DECLARE_SERVICE(HistogramDefinitionSvc)
     DECLARE_TOOL(InDetPhysValMonitoringTool)
     DECLARE_TOOL(InDetPhysValLargeD0Tool)
     DECLARE_TOOL(ToolTestMonitoringPlots)
@@ -38,9 +44,10 @@ DECLARE_FACTORY_ENTRIES(InDetPhysValMonitoring){
     DECLARE_TOOL(ParameterErrDecoratorTool)
     DECLARE_TOOL(TruthClassDecoratorTool)
     DECLARE_TOOL(TrackTruthSelectionTool)
+    DECLARE_TOOL(dRMatchingTool)
     DECLARE_TOOL(TrackSelectionTool)
     DECLARE_TOOL( DummyTrackSlimmingTool)
-    DECLARE_ALGORITHM( InDetPhysValDecoratorAlg )
-    DECLARE_ALGORITHM( AlgTestHistoDefSvc )
+    DECLARE_TOOL( AthTruthSelectionTool)
+
 }
 
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/dRMatchingTool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/dRMatchingTool.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..cb417eb64143a85b8e03258317890222c8bc9bef
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/dRMatchingTool.cxx
@@ -0,0 +1,594 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#include "dRMatchingTool.h"
+
+// InDetPhysValMonitoring include(s)
+#include "../src/TrackTruthSelectionTool.h" /* to perform dynamic_cast */
+
+namespace { // Placing utility functions in anonymous namespace.
+
+// Utility definitions.
+const float pi    = 3.14159265359;
+const float twopi = 6.28318530718;
+
+// Accessor utility function, for getting the best available value of pT.
+template<class U>
+float pt(const U* p) { return p->pt(); }
+
+// Accessor utility function, for getting the best available value of phi.
+// Need to explicitly state that 'isAvailable' and 'auxdata' are templated 
+// functions.
+template<class U>
+float phi(const U* p) { return (p->template isAvailable<float>("phi") ?
+				p->template auxdata<float>("phi") : p->phi()); }
+
+// Accessor utility function, for getting the best available value of eta.
+// Need to explicitly state that 'isAvailable' and 'auxdata' are templated 
+// functions.
+template<class U>
+float eta(const U* p) { return (p->template isAvailable<float>("eta") ?
+				p->template auxdata<float>("eta") : p->eta()); }
+
+// Function to compute dPhi-separation using best available parameter values.
+template<class U, class V>
+float comp_deltaPhi(const U* p1, const V* p2) { 
+  // Ensures that $\Delta\phi \in [-pi, pi)$, and takes absolute value.
+  float dphi = phi(p1) - phi(p2);
+  while (dphi >=  pi) { dphi -= twopi; }
+  while (dphi <  -pi) { dphi += twopi; }
+  return std::fabs(dphi);
+}
+
+// Function to compute dEta-separation using best available parameter values.
+template<class U, class V>
+float comp_deltaEta(const U* p1, const V* p2) { return eta(p1) - eta(p2); }
+
+// Function to compute dR-separation using best available parameter values.
+template<class U, class V>
+float comp_deltaR(const U* p1, const V* p2) { 
+  return sqrt( pow(comp_deltaPhi(p1, p2), 2.) + pow(comp_deltaEta(p1, p2), 2.) );
+}
+
+// Function for sorting vector of xAOD particles by increasing pT.
+template<class U>
+bool sort_pt(const U* p1, const U* p2) { return pt(p1) < pt(p2); }
+
+// Function for sorting vector of xAOD particles by increasing eta.
+template<class U>
+bool sort_eta(const U* p1, const U* p2) { return eta(p1) < eta(p2); }
+
+// Function for sorting vector of xAOD particles by increasing phi.
+template<class U>
+bool sort_phi(const U* p1, const U* p2) { return phi(p1) < phi(p2); }
+
+} // namespace
+
+
+dRMatchingTool::dRMatchingTool(const std::string &name) :
+  asg::AsgTool(name),
+  m_accept("dRMatching"),
+  m_numProcessed(0),
+  m_numPassed(0) {
+  declareInterface<IAsgSelectionTool>(this);
+
+  // Decleare cut properties, for access in job option.
+  declareProperty("dRmax",    m_dRmax    = -1);
+  declareProperty("pTResMax", m_pTResMax = -1);
+}
+
+dRMatchingTool::~dRMatchingTool() {
+}
+
+StatusCode
+dRMatchingTool::initialize() {
+  if (AlgTool::initialize().isFailure()) {
+    return StatusCode::FAILURE;
+  }
+
+  ATH_MSG_INFO("Initializing " << name() << "...");
+
+  // Clear cuts container.
+  m_cuts.clear();
+
+  // Define cut names and descriptions.
+  if (m_dRmax > -1) {
+    m_cuts.push_back(std::make_pair("dRmax", "Cut on maximal dR between track and truth particle."));
+  }
+  if (m_pTResMax > -1) {
+    m_cuts.push_back(std::make_pair("pTResMax", "Cut on maximal, relativ pT difference between track and truth particle."));
+  }
+
+  // Add cuts to the TAccept.
+  for (const auto &cut : m_cuts) {
+    if (m_accept.addCut(cut.first, cut.second) < 0) {
+      ATH_MSG_ERROR("Failed to add cut " << cut.first << " because the TAccept object is full.");
+      return StatusCode::FAILURE;
+    }
+  }
+
+  // Initialise counters.
+  m_numPassedCuts.resize(m_accept.getNCuts(), 0);
+
+  /**
+   * If no cuts are enabled, force to have length one, such that it will always
+   * return 'false'. This is because we want the dRMatchingTool to be 
+   * ineffecitive in this case, and not select _all_ tracks.
+   */
+  if (m_accept.getNCuts() == 0) {
+    m_accept.addCut("nop", "Forcing to have length 1.");
+  }
+
+  return StatusCode::SUCCESS;
+}
+
+const Root::TAccept &
+dRMatchingTool::getTAccept( ) const {
+  return m_accept;
+}
+
+const Root::TAccept &
+dRMatchingTool::accept(const xAOD::IParticle * /*p*/) const {
+  m_accept.clear();
+  
+  ATH_MSG_ERROR("accept(...) function called without needed Truth- or TrackParticleContainer. Please use one of the dRMatchingTool-specific accept methods.");
+
+  return m_accept;
+}
+
+template<class T, class U>
+void
+dRMatchingTool::sortVectors(const T* container,
+			    std::vector< const U* >& vec_pt,
+			    std::vector< const U* >& vec_eta,
+			    std::vector< const U* >& vec_phi,
+			    bool (*selectionTool)(const U*)) const {
+
+  // Look all particles in container.
+  for (const U* p : *container) {
+
+    // Ignore particles not passing the selection, if applicable.
+    if (selectionTool and !(*selectionTool)(p)) { continue; }
+
+    // Append passing particles to cached vectors.
+    vec_pt .push_back(p);
+    vec_eta.push_back(p);
+    vec_phi.push_back(p);
+
+  }
+
+  // Sort vectors.
+  std::sort(vec_pt.begin(),  vec_pt.end(),  sort_pt <U>);
+  std::sort(vec_eta.begin(), vec_eta.end(), sort_eta<U>);
+  std::sort(vec_phi.begin(), vec_phi.end(), sort_phi<U>);
+
+  return;
+}
+
+void 
+dRMatchingTool::checkCacheTrackParticles(const xAOD::TrackParticleContainer *trackParticles,
+					 bool (*trackSelectionTool)(const xAOD::TrackParticle*)) const {
+  
+  // Check whether to cache. 
+  if (*trackParticles == m_baseTrackContainer) { return; }
+
+  // Clear existing cache.
+  clearTrackParticles();
+
+  // Cache track particles.
+  sortVectors<xAOD::TrackParticleContainer,
+              xAOD::TrackParticle>(trackParticles, 
+				   m_trackParticlesSortedPt,
+				   m_trackParticlesSortedEta,
+				   m_trackParticlesSortedPhi,
+				   trackSelectionTool);
+
+  // Store copy of base track container.
+  m_baseTrackContainer = *trackParticles;
+
+  return;
+}
+
+void 
+dRMatchingTool::checkCacheTruthParticles(const xAOD::TruthParticleContainer *truthParticles,
+					 bool (*truthSelectionTool)(const xAOD::TruthParticle*)) const {
+  
+  // Check whether to cache.
+  if (*truthParticles == m_baseTruthContainer) { return; }
+
+  // Clear existing cache.
+  clearTruthParticles();
+
+  // Cache truth particles.
+  sortVectors<xAOD::TruthParticleContainer, 
+              xAOD::TruthParticle>(truthParticles, 
+				   m_truthParticlesSortedPt,
+				   m_truthParticlesSortedEta,
+				   m_truthParticlesSortedPhi,
+				   truthSelectionTool);
+
+  // Store copy of base truth container.
+  m_baseTruthContainer = *truthParticles;
+
+  return;
+}
+
+template<class U, class V>
+bool
+dRMatchingTool::sortedMatch(const U* p,
+			     std::vector< const V* >& vec_pt,
+			     std::vector< const V* >& vec_eta,
+			     std::vector< const V* >& vec_phi) const {
+
+  // (Re-)set variables.
+  m_dRmin = 9999.;
+
+  // Perform search in cached vectors.
+  auto it_pt_lower = m_pTResMax < 0 ? vec_pt.begin() :
+                     std::lower_bound(vec_pt.begin(), vec_pt.end(), 
+				      pt(p) * (1. - m_pTResMax),
+				      [](const V* o, const float& val) -> bool { 
+					return pt(o) < val;
+				      });
+  
+  auto it_pt_upper = m_pTResMax < 0 ? vec_pt.end() :
+                     std::upper_bound(vec_pt.begin(), vec_pt.end(), 
+				      pt(p) * (1. + m_pTResMax),
+				      [](const float& val, const V* o) -> bool { 
+					return val < pt(o); 
+				      });
+
+  auto it_eta_lower = m_dRmax < 0 ? vec_eta.begin() :
+                      std::lower_bound(vec_eta.begin(), vec_eta.end(), 
+				       eta(p) - m_dRmax,
+				       [](const V* o, const float& val) -> bool { 
+					 return eta(o) < val; 
+				       });
+  
+  auto it_eta_upper = m_dRmax < 0 ? vec_eta.end() :
+                      std::upper_bound(vec_eta.begin(), vec_eta.end(), 
+				       eta(p) + m_dRmax,
+				       [](const float& val, const V* o) -> bool { 
+					 return val < eta(o);
+				       });
+
+  // Dealing with cyclic nature of phi: Determining whether phi range wraps 
+  // around +-pi.
+  bool wrapLow  = phi(p) - m_dRmax < -pi;
+  bool wrapHigh = phi(p) + m_dRmax >  pi;
+  bool wrap = wrapLow or wrapHigh;
+
+  auto it_phi_lower = m_dRmax < 0 ? vec_phi.begin() :
+                      std::lower_bound(vec_phi.begin(), vec_phi.end(), 
+				       phi(p) - m_dRmax + (wrapLow ? twopi : 0),
+				       [](const V* o, const float& val) -> bool { 
+					 return phi(o) < val;
+				       });
+  
+  auto it_phi_upper = m_dRmax < 0 ? vec_phi.end() : 
+                      std::upper_bound(vec_phi.begin(), vec_phi.end(), 
+				       phi(p) + m_dRmax + (wrapHigh ? -twopi : 0),
+				       [](const float& val, const V* o) -> bool { 
+					 return val < phi(o); 
+				       }); 
+  
+  // Break early if no truth particles passed selection.
+  if      (m_pTResMax > 0 and it_pt_upper  < it_pt_lower)  { return false; }
+  else if (m_dRmax    > 0 and it_eta_upper < it_eta_lower) { return false; }
+  else if (m_dRmax    > 0 and ((!wrap and it_phi_upper < it_phi_lower) or 
+			       ( wrap and it_phi_upper > it_phi_lower))) { return false; }
+  
+  // Initialise base set.
+  std::vector< const V* > set (vec_pt);
+
+  // -- Sort, pointer-based; necessary for set_intersection.
+  std::sort(set.begin(), set.end()); 
+
+  // Compute subset of selected truth particles.
+  std::vector< const V* > subset_pt  (it_pt_lower,  it_pt_upper);
+  std::vector< const V* > subset_eta (it_eta_lower, it_eta_upper);
+  std::vector< const V* > subset_phi;
+  if (!wrap) {
+    subset_phi = std::vector< const V* >(it_phi_lower, it_phi_upper);
+  } else {
+    subset_phi = std::vector< const V* >(vec_phi.begin(), it_phi_upper);
+    subset_phi.insert(subset_phi.end(), it_phi_lower, vec_phi.end());
+  }
+
+  // Add subsets according to specified cut values.
+  std::vector< std::vector< const V* > > subsets;
+  if (m_pTResMax > 0) {
+    subsets.push_back(subset_pt);
+  }
+  if (m_dRmax > 0) {
+    subsets.push_back(subset_eta);
+    subsets.push_back(subset_phi);
+  }
+  
+  // Compute successive intersections between base set and subset.
+  for (std::vector< const V* > subset : subsets) {
+    
+    // -- Sort, pointer-based; necessary for set::set_intersection.
+    std::sort(subset.begin(), subset.end());
+
+    // -- Set intersection.
+    std::vector< const V* > intersection;
+    std::set_intersection(set   .begin(), set   .end(),
+			  subset.begin(), subset.end(),
+			  std::back_inserter(intersection));
+    
+    // -- Break early if intersection is empty.
+    if (intersection.size() == 0) { return false; }
+
+    set = intersection;
+  }
+
+  // If only pT-matching, we're done.
+  if (m_dRmax < 0) { return set.size() > 0; }
+
+  // Otherwise, compute dR for all remaining particles.
+  bool passes = false;
+  for (const V* other : set) {
+    float dR = comp_deltaR(p, other);
+    m_dRmin  = (dR < m_dRmin ? dR : m_dRmin);
+    passes  |= m_dRmin < m_dRmax;
+  }
+
+  return passes;
+}
+
+const Root::TAccept &
+dRMatchingTool::accept(const xAOD::TrackParticle *track,
+		       const xAOD::TruthParticleContainer *truthParticles,
+		       bool(*truthSelectionTool)(const xAOD::TruthParticle*)) const {
+  
+  // Reset the results.
+  m_accept.clear();
+
+  // Determine whether to cache current truth particle container
+  checkCacheTruthParticles(truthParticles, truthSelectionTool);
+
+  bool passes = sortedMatch<xAOD::TrackParticle, 
+                            xAOD::TruthParticle>(track, 
+						 m_truthParticlesSortedPt,
+						 m_truthParticlesSortedEta,
+						 m_truthParticlesSortedPhi);
+
+  // Set cut values.
+  if (m_dRmax > -1) {
+    m_accept.setCutResult("dRmax",    passes);
+  }
+  if (m_pTResMax > -1) {
+    m_accept.setCutResult("pTResMax", passes);
+  }
+
+  // Book keep cuts
+  for (const auto &cut : m_cuts) {
+    unsigned int pos = m_accept.getCutPosition(cut.first);
+    if (m_accept.getCutResult(pos)) {
+      m_numPassedCuts[pos]++;
+    }
+  }
+
+  m_numProcessed++;
+  if (m_accept) {
+    m_numPassed++;
+  }
+
+  return m_accept;
+
+}
+
+const Root::TAccept &
+dRMatchingTool::accept(const xAOD::TruthParticle *truth,
+		       const xAOD::TrackParticleContainer *trackParticles,
+		       bool(*trackSelectionTool)(const xAOD::TrackParticle*)) const {
+  
+  // Reset the results.
+  m_accept.clear();
+
+  // Determine whether to cache current track particle container
+  checkCacheTrackParticles(trackParticles, trackSelectionTool);
+
+  bool passes = sortedMatch<xAOD::TruthParticle, 
+                            xAOD::TrackParticle>(truth, 
+						 m_trackParticlesSortedPt,
+						 m_trackParticlesSortedEta,
+						 m_trackParticlesSortedPhi);
+
+  // Set cut values.
+  if (m_dRmax > -1) {
+    m_accept.setCutResult("dRmax",    passes);
+  }
+  if (m_pTResMax > -1) {
+    m_accept.setCutResult("pTResMax", passes);
+  }
+
+  // Book keep cuts
+  for (const auto &cut : m_cuts) {
+    unsigned int pos = m_accept.getCutPosition(cut.first);
+    if (m_accept.getCutResult(pos)) {
+      m_numPassedCuts[pos]++;
+    }
+  }
+
+  m_numProcessed++;
+  if (m_accept) {
+    m_numPassed++;
+  }
+
+  return m_accept;
+
+}
+
+
+const Root::TAccept &
+dRMatchingTool::acceptLegacy(const xAOD::TrackParticle *p,
+			     const xAOD::TruthParticleContainer *truthParticles,
+			     bool(*truthSelectionTool)(const xAOD::TruthParticle*)) const {
+
+  // Reset the results.
+  m_accept.clear();
+  m_dRmin = 9999.;
+
+  // Define variables.
+  const unsigned int Ncuts (m_cuts.size());
+  bool passes(false), passesThis(false);
+
+  // Loop all truth particles.
+  for (const xAOD::TruthParticle* truth : *truthParticles) {
+
+    // Ignore all truth particles failing the selection.
+    if (truthSelectionTool and !(*truthSelectionTool)(truth)) { continue; }
+
+    // Compute cut variable values.
+    float dR = comp_deltaR(p, truth);
+    float pTRes = std::fabs(pt(truth) / pt(p) - 1.);
+    
+    // Initialise cut monitoring objects.
+    std::vector<bool> vecPassesThis (Ncuts, false);
+
+    // Check whether each individual cut passed.
+    unsigned int icut = 0;
+    if (m_dRmax > -1) {
+      vecPassesThis[icut++] = dR < m_dRmax;
+    }
+    if (m_pTResMax > -1) {
+      vecPassesThis[icut++] = pTRes < m_pTResMax;
+    }
+
+    // Check whether all cuts passed.
+    passesThis = std::all_of(vecPassesThis.begin(), 
+			     vecPassesThis.end(), 
+			     [](const bool& v) { return v; });
+    passes |= passesThis;
+
+    // If the current truth particle was matched, check minimal dR.
+    if (passesThis) {
+      m_dRmin = (dR < m_dRmin ? dR : m_dRmin);
+    }
+    
+  }
+
+  // Set cut values.
+  if (m_dRmax > -1) {
+    m_accept.setCutResult("dRmax",    passes);
+  }
+  if (m_pTResMax > -1) {
+    m_accept.setCutResult("pTResMax", passes);
+  }
+
+  // Book keep cuts
+  for (const auto &cut : m_cuts) {
+    unsigned int pos = m_accept.getCutPosition(cut.first);
+    if (m_accept.getCutResult(pos)) {
+      m_numPassedCuts[pos]++;
+    }
+  }
+
+  m_numProcessed++;
+  if (m_accept) {
+    m_numPassed++;
+  }
+
+  return m_accept;
+}
+
+
+const Root::TAccept &
+dRMatchingTool::acceptLegacy(const xAOD::TruthParticle *p, 
+			     const xAOD::TrackParticleContainer *trackParticles,
+			     bool(*trackSelectionTool)(const xAOD::TrackParticle*)) const {
+
+  // Reset the results.
+  m_accept.clear();
+  m_dRmin = 9999.;
+
+  // Define variables.
+  const unsigned int Ncuts (m_cuts.size());
+  bool passes(false), passesThis(false);
+
+  // Loop all track particles.
+  for (const xAOD::TrackParticle* track : *trackParticles) {
+
+    // Ignore all tracks failing the selection.
+    if (trackSelectionTool and !(*trackSelectionTool)(track)) { continue; }
+
+    // Compute cut variable values.
+    float dR = comp_deltaR(p, track);
+    float pTRes = std::fabs(pt(track) / pt(p) - 1.);
+
+    // Initialise cut monitoring objects.
+    std::vector<bool> vecPassesThis (Ncuts, false);
+
+    // Check whether each individual cut passed.
+    unsigned int icut = 0;
+    if (m_dRmax > -1) {
+      vecPassesThis[icut++] = dR < m_dRmax;
+    }
+    if (m_pTResMax > -1) {
+      vecPassesThis[icut++] = pTRes < m_pTResMax;
+    }
+
+    // Check whether all cuts passed.
+    passesThis = std::all_of(vecPassesThis.begin(), 
+			     vecPassesThis.end(), 
+			     [](const bool& v) { return v; });
+    passes |= passesThis;
+
+    // If the current track particle was matched, check minimal dR.
+    if (passesThis) {
+      m_dRmin = (dR < m_dRmin ? dR : m_dRmin);
+    }
+
+  }
+
+  // Set cut values.
+  if (m_dRmax > -1) {
+    m_accept.setCutResult("dRmax",    passes);
+  }
+  if (m_pTResMax > -1) {
+    m_accept.setCutResult("pTResMax", passes);
+  }
+
+  // Book keep cuts
+  for (const auto &cut : m_cuts) {
+    unsigned int pos = m_accept.getCutPosition(cut.first);
+    if (m_accept.getCutResult(pos)) {
+      m_numPassedCuts[pos]++;
+    }
+  }
+
+  m_numProcessed++;
+  if (m_accept) {
+    m_numPassed++;
+  }
+
+  return m_accept;
+}
+
+StatusCode
+dRMatchingTool::finalize() {
+  ATH_MSG_INFO("Finalizing " << name() << "...");
+
+  if (m_numProcessed == 0) {
+    ATH_MSG_INFO("No tracks processed in selection tool.");
+    return StatusCode::SUCCESS;
+  }
+  ATH_MSG_INFO(m_numPassed << " / " << m_numProcessed << " = "
+                           << m_numPassed * 100. / m_numProcessed
+	                   << "% passed all cuts.");
+  for (const auto &cut : m_cuts) {
+    ULong64_t numPassed = m_numPassedCuts.at(m_accept.getCutPosition(cut.first));
+    ATH_MSG_INFO(numPassed << " = " << numPassed * 100. / m_numProcessed
+		           << "% passed " << cut.first << " cut.");
+  }
+
+  return StatusCode::SUCCESS;
+}
+
+float
+dRMatchingTool::dRmin() const {
+  return m_dRmin;
+}
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/dRMatchingTool.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/dRMatchingTool.h
new file mode 100644
index 0000000000000000000000000000000000000000..6c53ec71caba8435de72544a4cce65b3970b10a2
--- /dev/null
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/dRMatchingTool.h
@@ -0,0 +1,209 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+#ifndef INDETPHYSVALMONITORING_DRMATCHINGTOOL_H
+#define INDETPHYSVALMONITORING_DRMATCHINGTOOL_H 1
+
+/**
+ * @file   dRMatchingTool.h
+ * @author Andreas Sogaard <andreas.sogaard@cern.ch>
+ * @date   3 November 2016
+ * @brief  Tool to perform dR-based matching of tracks and truth particles.
+ */
+
+// STL include(s)
+#include <cmath> /* std::fabs, sqrt, pow */
+#include <algorithm> /* std::all_of (C++11), std::sort, std::lower_bound, std::upper_bound, std::set_intersection */
+#include <iterator> /* std::back_inserter */
+
+// ATLAS software include(s)
+#include "AthenaBaseComps/AthAlgTool.h"
+#include "PATCore/IAsgSelectionTool.h"
+#include "AsgTools/AsgTool.h"
+
+// xAOD include(s)
+#include "xAODTracking/TrackParticle.h"
+#include "xAODTracking/TrackParticleContainer.h"
+#include "xAODTruth/TruthParticle.h"
+#include "xAODTruth/TruthParticleContainer.h"
+
+// Local include(s)
+#include "../src/TrackTruthSelectionTool.h"
+
+/**
+ * @brief Tool to perform dR-based matching of tracks and truth particles.
+ *
+ * The tool can match both a single track to a set of truth particles, and vice
+ * versa. As the tool derives from the general IAsgSelectionTool interface, the
+ * actual 'accept' methods has to be invoked using (dynamic) type casting, e.g.
+ *
+ *   bool dRMatched = (bool) dynamic_cast<dRMatchingTool&>(*m_dRMatchingTool) \
+ *     .accept(track, truthParticles, &truthSelectionTool);
+ *
+ * to match a track to a subset of truth particle, or 
+ *
+ *   bool dRMatched = (bool) dynamic_cast<dRMatchingTool&>(*m_dRMatchingTool) \
+ *     .accept(truth, trackParticles);
+ *
+ * to match a truth particle to all tracks. The standard accept(const 
+ * xAOD::IParticle*) method is disabled.
+ *
+ * Optional track- and truth particle selection functions are allowed, to 
+ * perform the matching to only a subset of the respective containers. If these
+ * functions are omitted as arguments, the matching is performed to the all 
+ * particles in the specified container.
+ * 
+ * The tool is able to perform matching wrt. dR as well relative pT-resolution,
+ * i.e.
+ *   \Delta p_{T}/p_{T} = \frac{|p_{T,this} - p_{T,other}|}{p_{T,this}}
+ * The tool is configured such that a successful match means that all set cuts
+ * were passed. That means that if only the dR-cut is set, no pT-resoution cut
+ * is imposed, and conversely. In particular, if neither cut is set, no 
+ * particles pass the matching. The cut values are set in the job option as e.g.
+ *
+ *   from InDetPhysValMonitoring.InDetPhysValMonitoringConf import \
+ *     dRMatchingTool
+ *   dRMatcher = dRMatchingTool()
+ *   dRMatcher.dRmax    = 0.1 # Disabled: -1
+ *   dRMatcher.pTResMax = 0.1 # Disabled: -1
+ *   ToolSvc += dRMatcher
+ * 
+ * The main 'accept' methods are implemented using caching and sorting to avoid 
+ * O(N^2) complexity from what is essentially nested loops. This speeds up 
+ * performance drastically, at the cost of transparency. To this end, and for 
+ * validation purposes, 'acceptLegacy' methods are kept in, which are 
+ * conceptually simpler and more intuitive, but much slower, than the main 
+ * methods. However, these legacy methods ought not to be used for actual, even
+ * just moderately large runs.
+ */
+class dRMatchingTool:
+public virtual ::IAsgSelectionTool,
+  public asg::AsgTool  {
+  ASG_TOOL_CLASS1(dRMatchingTool, IAsgSelectionTool);
+
+ public:
+
+  /// Constructor(s).
+  dRMatchingTool(const std::string &name);
+
+  /// Destructor.
+  virtual ~dRMatchingTool();
+
+  /// SelectionTool method(s).
+  virtual StatusCode initialize();
+  virtual StatusCode finalize();
+  virtual const Root::TAccept &getTAccept( ) const;
+  virtual const Root::TAccept &accept(const xAOD::IParticle *p) const;
+
+  /// dR-matching specific method(s).
+  // For matching single track to set of truth particles.
+  virtual const Root::TAccept&
+    acceptLegacy(const xAOD::TrackParticle *p,
+		 const xAOD::TruthParticleContainer *truthParticles,
+		 bool (*truthSelectionTool)(const xAOD::TruthParticle*) = nullptr) const;
+
+  const Root::TAccept&
+    accept(const xAOD::TrackParticle *p,
+	   const xAOD::TruthParticleContainer *truthParticles,
+	   bool (*truthSelectionTool)(const xAOD::TruthParticle*) = nullptr) const;
+
+  // For matching single truth particle to set of tracks.
+  virtual const Root::TAccept&
+    acceptLegacy(const xAOD::TruthParticle *p,
+		 const xAOD::TrackParticleContainer *trackParticles,
+		 bool (*trackSelectionTool)(const xAOD::TrackParticle*) = nullptr) const;
+
+  const Root::TAccept&
+    accept(const xAOD::TruthParticle *p,
+	   const xAOD::TrackParticleContainer *trackParticles,
+	   bool (*trackSelectionTool)(const xAOD::TrackParticle*) = nullptr) const;
+
+  // Accessor for the minimal dR from the latest matching of either type.
+  float dRmin() const;
+
+
+ protected:
+
+  /// Internal method(s).
+  // Cache track particles.
+  void checkCacheTrackParticles(const xAOD::TrackParticleContainer *trackParticles,
+				bool (*trackSelectionTool)(const xAOD::TrackParticle*) = nullptr) const;
+  // Cache truth particles.
+  void checkCacheTruthParticles(const xAOD::TruthParticleContainer *truthParticles,
+				bool (*truthSelectionTool)(const xAOD::TruthParticle*) = nullptr) const;
+
+  // Clear cached track particle arrays.
+  inline void clearTrackParticles() const {
+    m_trackParticlesSortedPt .clear();
+    m_trackParticlesSortedEta.clear();
+    m_trackParticlesSortedPhi.clear();
+    return;
+  }
+  // Clear cached truth particle arrays.
+  inline void clearTruthParticles() const {
+    m_truthParticlesSortedPt .clear();
+    m_truthParticlesSortedEta.clear();
+    m_truthParticlesSortedPhi.clear();
+    return;
+  }
+
+  // Sort and cache all particles of type U in container into the three vectors,
+  // subject to their passing the selectionTool.
+  template<class T, class U>
+  void sortVectors(const T* container,
+		   std::vector< const U* >& vec_pt,
+		   std::vector< const U* >& vec_eta,
+		   std::vector< const U* >& vec_phi,
+		   bool (*selectionTool)(const U*)) const;
+
+  // Match the particle p by dR and/or pT to the particles in the three cached 
+  // vectors.
+  template<class U, class V>
+  bool sortedMatch(const U* p,
+		   std::vector< const V* >& vec_pt,
+		   std::vector< const V* >& vec_eta,
+		   std::vector< const V* >& vec_phi) const;
+
+private:
+
+  /// Data member(s).
+  // TAccept object.
+  mutable Root::TAccept m_accept;
+  // Vector of stored cut names and descriptions.
+  std::vector<std::pair<std::string, std::string> > m_cuts;
+
+  // Counters.
+  mutable ULong64_t m_numProcessed; // !< a counter of the number of tracks proccessed
+  mutable ULong64_t m_numPassed; // !< a counter of the number of tracks that passed all cuts
+  mutable std::vector<ULong64_t> m_numPassedCuts; // !< tracks the number of tracks that passed each cut family
+
+  /// Cut vales.
+  // The maximal dR-distance allowed for successful matching.
+  float m_dRmax;
+  // The maximal pT-resolution allowed for successful matching.
+  float m_pTResMax;
+  // The minimal dR for latest successful matching of either type.
+  mutable float m_dRmin = 9999.;
+
+  // Copy of the xAOD::TruthParticleContainer used to perform the caching. A 
+  // copy, rather than a pointer or reference, is necessary to check when a new 
+  // container is encountered (i.e. when a new event is processed).
+  mutable xAOD::TruthParticleContainer m_baseTruthContainer;
+  // Copy of the xAOD::TrackParticleContainer used to perform the caching. 
+  mutable xAOD::TrackParticleContainer m_baseTrackContainer;
+
+  // Cached vectors of the xAOD::TruthParticles in m_baseTruthContainer, sorted 
+  // in ascending order accoring to their pT, eta, and phi, resp.
+  mutable std::vector< const xAOD::TruthParticle* > m_truthParticlesSortedPt;
+  mutable std::vector< const xAOD::TruthParticle* > m_truthParticlesSortedEta;
+  mutable std::vector< const xAOD::TruthParticle* > m_truthParticlesSortedPhi;
+  // Cached vectors of the xAOD::TrackParticles in m_baseTrackContainer, sorted 
+  // in ascending order accoring to their pT, eta, and phi, resp.
+  mutable std::vector< const xAOD::TrackParticle* > m_trackParticlesSortedPt;
+  mutable std::vector< const xAOD::TrackParticle* > m_trackParticlesSortedEta;
+  mutable std::vector< const xAOD::TrackParticle* > m_trackParticlesSortedPhi;
+  
+};
+
+#endif // > !INDETPHYSVALMONITORING_DRMATCHINGTOOL_H
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/safeDecorator.h b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/safeDecorator.h
index afebc7a0255549a9a9978d2437dce2f53ee7a0ca..d6c3c97a4b0778eb2a4229b66cd28725379b8338 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/safeDecorator.h
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/safeDecorator.h
@@ -2,6 +2,8 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
+#ifndef IDPVM_safeDecorator_h
+#define IDPVM_safeDecorator_h
 /**
  * @file safeDecorator.h
  * header file for function of same name
@@ -9,8 +11,7 @@
  * @date 20 July 2016
  */
 
-#ifndef IDPVM_safeDecorator_h
-#define IDPVM_safeDecorator_h
+
 
 #include "xAODTracking/TrackParticle.h"
 #include "xAODTruth/TruthParticle.h"
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/InDetPhysValMonitoring_TestConfiguration.xml b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/InDetPhysValMonitoring_TestConfiguration.xml
index 634056b30cd506fb3b52e5591a7a61eaba44e13e..4afa0556d64f3e1952549d899f86a3f684eb7def 100755
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/InDetPhysValMonitoring_TestConfiguration.xml
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/InDetPhysValMonitoring_TestConfiguration.xml
@@ -21,7 +21,7 @@
          IdPhysValTtbar
          </jobTransformJobName>
          <jobTransformCmd>
-	    Reco_tf.py  --steering doRAWtoALL  --checkEventCount  False --ignoreErrors True --maxEvents 25 --valid True --inputRDOFile root://eosatlas.cern.ch//eos/atlas/atlasgroupdisk/perf-idtracking/dq2/rucio/mc15_13TeV/60/11/RDO.07497143._000001.pool.root.1  --outputNTUP_PHYSVALFile physval.root --outputAODFile physval.AOD.root --validationFlags doInDet --preExec "from InDetRecExample.InDetJobProperties import InDetFlags;InDetFlags.doSlimming.set_Value_and_Lock(False);rec.doTrigger.set_Value_and_Lock(False); from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags; InDetPhysValFlags.doValidateGSFTracks.set_Value_and_Lock(False);rec.doDumpProperties=True;rec.doCalo=False;rec.doEgamma=False;rec.doForwardDet=False;rec.doInDet=True;rec.doJetMissingETTag=False;rec.doLArg=False;rec.doLucid=False;rec.doMuon=False;rec.doMuonCombined=False;rec.doSemiDetailedPerfMon=True;rec.doTau=False;rec.doTile=False;"	     
+	    Reco_tf.py  --steering doRAWtoALL  --checkEventCount  False --ignoreErrors True --maxEvents 500 --valid True --inputRDOFile root://eosatlas.cern.ch//eos/atlas/atlasgroupdisk/perf-idtracking/dq2/rucio/mc15_13TeV/d6/dc/RDO.08543088._000001.pool.root.1 --outputNTUP_PHYSVALFile physval.root --outputAODFile physval.AOD.root --validationFlags doInDet --preExec "from InDetRecExample.InDetJobProperties import InDetFlags;InDetFlags.doSlimming.set_Value_and_Lock(False);rec.doTrigger.set_Value_and_Lock(False); from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags; InDetPhysValFlags.doValidateGSFTracks.set_Value_and_Lock(False);rec.doDumpProperties=True;rec.doCalo=False;rec.doEgamma=False;rec.doForwardDet=False;rec.doInDet=True;rec.doJetMissingETTag=False;rec.doLArg=False;rec.doLucid=False;rec.doMuon=False;rec.doMuonCombined=False;rec.doSemiDetailedPerfMon=True;rec.doTau=False;rec.doTile=False;"	     
          </jobTransformCmd>
          <group>IdPhysValTtbar</group>
          <queue>medium</queue>