diff --git a/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrManager.h b/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrManager.h
index c4a380a566cb7c43d58d1870947e1b83e0169c60..c20404c50f4b1553e6a4b952e68371f913568896 100755
--- a/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrManager.h
+++ b/Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrManager.h
@@ -16,6 +16,7 @@
 
 #include "AthenaKernel/CLASS_DEF.h"
 #include "CaloIdentifier/CaloCell_ID.h"
+#include "CaloDetDescr/CaloConstIteratorAdaptor.h"
 #include "boost/range/iterator_range.hpp"
 
 class CaloCell_SuperCell_ID;
@@ -167,11 +168,19 @@ class CaloDetDescrManager_Base
    */
   const CaloIdManager* getCalo_Mgr() const;
 
+  // Iterator over detector elements.
+  // Value type is `const CaloDetDescrElement*'.
   typedef std::vector <CaloDetDescrElement*> calo_element_vec;
   typedef calo_element_vec::size_type        calo_element_vec_size;
-  typedef calo_element_vec::const_iterator   calo_element_const_iterator;
+  typedef CaloConstIteratorAdaptor<calo_element_vec::const_iterator>
+    calo_element_const_iterator;
   typedef boost::iterator_range<calo_element_const_iterator> calo_element_range;
 
+  // Iterator over non-const detector elements.
+  typedef calo_element_vec::const_iterator   calo_nonconst_element_const_iterator;
+  typedef boost::iterator_range<calo_nonconst_element_const_iterator> calo_nonconst_element_range;
+
+  
   /** @brief total number of elements
    */
   calo_element_vec_size       element_size()  const;
@@ -194,6 +203,10 @@ class CaloDetDescrManager_Base
    */
   calo_element_range element_range(CaloCell_ID::SUBCALO subCalo)   const;
 
+  /** @brief Range over element vector, with non-const elements.
+   */
+  calo_nonconst_element_range element_range_nonconst();
+
   /** @brief get element by its identifier
       @param cellId [IN] element identifier
    */
@@ -205,17 +218,17 @@ class CaloDetDescrManager_Base
   /** @brief get element by hash identifier
       @param caloCellHash [IN] hash identifier for the element
    */
-  const CaloDetDescrElement* get_element(const IdentifierHash& caloCellHash) const;
+  const CaloDetDescrElement* get_element(IdentifierHash caloCellHash) const;
   /** @brief get element by hash identifier, non-const version.
       @param caloCellHash [IN] hash identifier for the element
    */
-  CaloDetDescrElement* get_element_nonconst(const IdentifierHash& caloCellHash);
+  CaloDetDescrElement* get_element_nonconst(IdentifierHash caloCellHash);
   /** @brief get element by subcalo and hash identifier
       @param subCalo [IN] subsystem
       @param subCaloCellHash [IN] sub calo hash
    */
   const CaloDetDescrElement* get_element (CaloCell_ID::SUBCALO subCalo,
-                                          const IdentifierHash& subCaloCellHash) const;
+                                          IdentifierHash subCaloCellHash) const;
   /** @brief LAr only! get element by subcalo, sampling, barrel flag, eta, phi.  This is slower for FCAL
    */
   const CaloDetDescrElement* get_element (CaloCell_ID::SUBCALO subCalo,
@@ -291,11 +304,21 @@ class CaloDetDescrManager_Base
 		      int& sampling_or_module,
 		      CaloCell_ID::CaloSample sample) const;   
 
+
+  // Iterator over detector descriptors.
+  // Value type is `const CaloDetDescriptor*'.
   typedef std::vector <CaloDetDescriptor*>   calo_descr_vec;
   typedef calo_descr_vec::size_type	     calo_descr_size;
-  typedef calo_descr_vec::const_iterator     calo_descr_const_iterator;
+  typedef CaloConstIteratorAdaptor<calo_descr_vec::const_iterator>
+    calo_descr_const_iterator;
   typedef boost::iterator_range<calo_descr_const_iterator> calo_descr_range;
     
+
+  // Iterator over non-const detector descriptors.
+  typedef calo_descr_vec::const_iterator   calo_nonconst_descr_const_iterator;
+  typedef boost::iterator_range<calo_nonconst_descr_const_iterator> calo_nonconst_descr_range;
+
+
   /** @brief first descriptor in the vector
    */
   calo_descr_const_iterator	calo_descriptors_begin() const;
@@ -308,6 +331,9 @@ class CaloDetDescrManager_Base
   /** @brief Range over descriptors
    */
   calo_descr_range 		calo_descriptors_range() const;
+  /** @brief Range over descriptors, with non-const elements.
+   */
+  calo_nonconst_descr_range 	calo_descriptors_range_nonconst();
 
   /** @brief get descriptor by region identifier
    */
@@ -345,6 +371,9 @@ class CaloDetDescrManager_Base
   /** @brief Range over tile descriptors
    */
   calo_descr_range            tile_descriptors_range  () const;
+  /** @brief Range over tile descriptors, with non-const elements.
+   */
+  calo_nonconst_descr_range   tile_descriptors_range_nonconst  ();
 
   /** @brief set calo Cell ID helper
    */
@@ -480,7 +509,7 @@ CLASS_DEF( CaloSuperCellDetDescrManager , 241807251 , 1 )
 
 
 inline  const CaloDetDescrElement*			
-CaloDetDescrManager_Base::get_element (const IdentifierHash& caloCellHash) const
+CaloDetDescrManager_Base::get_element (IdentifierHash caloCellHash) const
 {
   if ( caloCellHash < m_element_vec.size() ) 
     return m_element_vec[caloCellHash] ;
@@ -488,7 +517,7 @@ CaloDetDescrManager_Base::get_element (const IdentifierHash& caloCellHash) const
 }
                        
 inline CaloDetDescrElement*			
-CaloDetDescrManager_Base::get_element_nonconst (const IdentifierHash& caloCellHash)
+CaloDetDescrManager_Base::get_element_nonconst (IdentifierHash caloCellHash)
 {
   if ( caloCellHash < m_element_vec.size() ) 
     return m_element_vec[caloCellHash] ;
diff --git a/Calorimeter/CaloDetDescr/src/CaloDetDescrManager.cxx b/Calorimeter/CaloDetDescr/src/CaloDetDescrManager.cxx
index de853b406f97aaeb27bdbbdaafeccd3b560f5bb3..8a019744dd337c4cdeea721587b11d443a79153e 100755
--- a/Calorimeter/CaloDetDescr/src/CaloDetDescrManager.cxx
+++ b/Calorimeter/CaloDetDescr/src/CaloDetDescrManager.cxx
@@ -71,8 +71,8 @@ void CaloDetDescrManager_Base::initialize ()
   for(int i = 0; i < nb; i++) {
     m_cell_id->calo_cell_hash_range(i,m_subCalo_min[i],m_subCalo_max[i]);
 
-    m_subCalo_begin[i] = m_element_vec.begin() + m_subCalo_min[i];
-    m_subCalo_end[i]   = m_element_vec.begin() + m_subCalo_max[i];
+    m_subCalo_begin[i] = calo_element_const_iterator(m_element_vec.begin()) + m_subCalo_min[i];
+    m_subCalo_end[i]   = calo_element_const_iterator(m_element_vec.begin()) + m_subCalo_max[i];
   }
 }
 
@@ -126,6 +126,13 @@ CaloDetDescrManager_Base::element_range() const
                              m_element_vec.end());
 }
     
+CaloDetDescrManager_Base::calo_nonconst_element_range
+CaloDetDescrManager_Base::element_range_nonconst()
+{
+  return calo_nonconst_element_range (m_element_vec.begin(), 
+                                      m_element_vec.end());
+}
+    
 CaloDetDescrManager_Base::calo_element_const_iterator
 CaloDetDescrManager_Base::element_begin(CaloCell_ID::SUBCALO subCalo) const
 {
@@ -164,7 +171,7 @@ CaloDetDescrManager_Base::get_element_nonconst(const Identifier& cellId)
 
 const CaloDetDescrElement*
 CaloDetDescrManager_Base::get_element (CaloCell_ID::SUBCALO subCalo,
-                                       const IdentifierHash& subCaloCellHash) const
+                                       IdentifierHash subCaloCellHash) const
 {
   // meaningless interface for Tiles, will only work for LAr
 
@@ -527,6 +534,12 @@ CaloDetDescrManager_Base::calo_descriptors_range() const
   return calo_descr_range (m_descr_vec.begin(), m_descr_vec.end());
 }
 
+CaloDetDescrManager_Base::calo_nonconst_descr_range
+CaloDetDescrManager_Base::calo_descriptors_range_nonconst()
+{
+  return calo_nonconst_descr_range (m_descr_vec.begin(), m_descr_vec.end());
+}
+
 CaloDetDescrManager_Base::calo_descr_const_iterator
 CaloDetDescrManager_Base::tile_descriptors_begin() const
 {
@@ -552,6 +565,13 @@ CaloDetDescrManager_Base::tile_descriptors_range() const
                            m_tile_descr_vec.end());
 }
  
+CaloDetDescrManager_Base::calo_nonconst_descr_range
+CaloDetDescrManager_Base::tile_descriptors_range_nonconst()
+{
+  return calo_nonconst_descr_range (m_tile_descr_vec.begin(),
+                                    m_tile_descr_vec.end());
+}
+ 
 const CaloDetDescriptor*
 CaloDetDescrManager_Base::get_descriptor(const Identifier& regionId) const
 {
diff --git a/Calorimeter/CaloDetDescr/src/CaloSuperCellAlignTool.cxx b/Calorimeter/CaloDetDescr/src/CaloSuperCellAlignTool.cxx
index de9b7030ff5594cb5d7ade32a1b43c4c897880af..b6cd9a5e847b391bbea37d1dc0c2efc1cd9e2b43 100644
--- a/Calorimeter/CaloDetDescr/src/CaloSuperCellAlignTool.cxx
+++ b/Calorimeter/CaloDetDescr/src/CaloSuperCellAlignTool.cxx
@@ -126,7 +126,10 @@ StatusCode CaloSuperCellAlignTool::align(IOVSVC_CALLBACK_ARGS)
   CHECK( detStore()->retrieve (scmgr, m_scMgrKey) );
   CHECK( detStore()->retrieve (mgr,   m_mgrKey) );
 
-  CHECK( doUpdate ((CaloSuperCellDetDescrManager*)scmgr, mgr) );
+  // FIXME: This tool changes the content of the (const) CaloSuperCellDetDescrManager
+  // recorded in the detector store.  Need to get rid of this for MT.
+  // This should go away with the new scheme for dealing with alignments.
+  CHECK( doUpdate (const_cast<CaloSuperCellDetDescrManager*>(scmgr), mgr) );
   return StatusCode::SUCCESS;
 }
 
@@ -184,7 +187,7 @@ CaloSuperCellAlignTool::updateElements (CaloSuperCellDetDescrManager* mgr,
   // For each supercell, we make a list of the corresponding cells.
   // Then we pass that list to the supercell's @c update method.
 
-  for (CaloDetDescrElement* elt : mgr->element_range()) {
+  for (CaloDetDescrElement* elt : mgr->element_range_nonconst()) {
     if (!elt) continue;
     CaloSuperCellDetectorElement* selt =
       dynamic_cast<CaloSuperCellDetectorElement*> (elt);
@@ -251,7 +254,7 @@ CaloSuperCellAlignTool::updateDescriptors (CaloSuperCellDetDescrManager* mgr,
   std::vector<DescrMinMax> descr_minmax (maxdesc);
 
   // Loop over cells and record range limits for each descriptor.
-  for (CaloDetDescrElement* elt : mgr->element_range()) {
+  for (const CaloDetDescrElement* elt : mgr->element_range()) {
     if (!elt) continue;
     CaloDetDescriptor* desc = const_cast<CaloDetDescriptor*>(elt->descriptor());
     int ndx = descr_index (desc, mgr);
@@ -268,11 +271,11 @@ CaloSuperCellAlignTool::updateDescriptors (CaloSuperCellDetDescrManager* mgr,
 
   // Loop over each descriptor and update.
   size_t i = 0;
-  for (CaloDetDescriptor* desc : mgr->calo_descriptors_range()) {
+  for (CaloDetDescriptor* desc : mgr->calo_descriptors_range_nonconst()) {
     updateDescriptor (desc, descr_minmax[i], cellmgr);
     ++i;
   }
-  for (CaloDetDescriptor* desc : mgr->tile_descriptors_range()) {
+  for (CaloDetDescriptor* desc : mgr->tile_descriptors_range_nonconst()) {
     updateDescriptor (desc, descr_minmax[i], cellmgr);
     ++i;
   }
diff --git a/Calorimeter/CaloLocalHadCalib/src/GetLCClassification.cxx b/Calorimeter/CaloLocalHadCalib/src/GetLCClassification.cxx
index 17e9e31e3597d61e77263c2d2d43f005d5a06d5e..98324b0b41928b9d01ec8aadef1810908cf45732 100644
--- a/Calorimeter/CaloLocalHadCalib/src/GetLCClassification.cxx
+++ b/Calorimeter/CaloLocalHadCalib/src/GetLCClassification.cxx
@@ -30,7 +30,6 @@
 #include "AthenaKernel/errorcheck.h"
 #include "GaudiKernel/ISvcLocator.h"
 #include "GaudiKernel/StatusCode.h"
-#include "GaudiKernel/MsgStream.h"
 
 #include "StoreGate/StoreGateSvc.h" 
 #include "TFile.h"
diff --git a/Calorimeter/CaloLocalHadCalib/src/GetLCDeadMaterial.cxx b/Calorimeter/CaloLocalHadCalib/src/GetLCDeadMaterial.cxx
index d26159326970b523249b23a459640f0f977b0e5d..210f0ab8868273d386d4167703e43e7b0a9fd7b9 100644
--- a/Calorimeter/CaloLocalHadCalib/src/GetLCDeadMaterial.cxx
+++ b/Calorimeter/CaloLocalHadCalib/src/GetLCDeadMaterial.cxx
@@ -29,7 +29,6 @@
 #include "AthenaKernel/errorcheck.h"
 #include "GaudiKernel/ISvcLocator.h"
 #include "GaudiKernel/StatusCode.h"
-#include "GaudiKernel/MsgStream.h"
 
 #include "CaloConditions/CaloLocalHadCoeff.h"
 #include "CaloLocalHadCalib/CaloLocalHadCoeffHelper.h"
diff --git a/Calorimeter/CaloLocalHadCalib/src/GetLCDeadMaterialTree.cxx b/Calorimeter/CaloLocalHadCalib/src/GetLCDeadMaterialTree.cxx
index 147f6d5a8d2510bc9a0fbdebdb38802cfff1e887..8a69f9c78f1f73c80005d516236dbc525a274f04 100644
--- a/Calorimeter/CaloLocalHadCalib/src/GetLCDeadMaterialTree.cxx
+++ b/Calorimeter/CaloLocalHadCalib/src/GetLCDeadMaterialTree.cxx
@@ -29,7 +29,6 @@
 #include "AthenaKernel/errorcheck.h"
 #include "GaudiKernel/ISvcLocator.h"
 #include "GaudiKernel/StatusCode.h"
-#include "GaudiKernel/MsgStream.h"
 
 #include "xAODCaloEvent/CaloClusterContainer.h"
 #include "CaloEvent/CaloCell.h"
diff --git a/Calorimeter/CaloLocalHadCalib/src/GetLCOutOfCluster.cxx b/Calorimeter/CaloLocalHadCalib/src/GetLCOutOfCluster.cxx
index 41cd6aa4f06d497baa4e13e39ccfebdcc9583a09..e4c49dca8edb4e6ff4e3481d23e4fceb3def47d6 100644
--- a/Calorimeter/CaloLocalHadCalib/src/GetLCOutOfCluster.cxx
+++ b/Calorimeter/CaloLocalHadCalib/src/GetLCOutOfCluster.cxx
@@ -103,36 +103,36 @@ StatusCode GetLCOutOfCluster::initialize() {
   mapparse();
 
   if ( m_NormalizationType == "Lin" ) {
-    msg(MSG::INFO) << "Using weighting proportional to E_calib" << endmsg;
+    ATH_MSG_INFO( "Using weighting proportional to E_calib" );
     m_NormalizationTypeNumber = GetLCDefs::LIN;
   }
   else if ( m_NormalizationType == "Log" ) {
-    msg(MSG::INFO) << "Using weighting proportional to log(E_calib)" << endmsg;
+    ATH_MSG_INFO( "Using weighting proportional to log(E_calib)" );
     m_NormalizationTypeNumber = GetLCDefs::LOG;
   }
   else if ( m_NormalizationType == "NClus" ) {
-    msg(MSG::INFO) << "Using weighting proportional to 1/N_Clus_E_calib>0" << endmsg;
+    ATH_MSG_INFO( "Using weighting proportional to 1/N_Clus_E_calib>0" );
     m_NormalizationTypeNumber = GetLCDefs::NCLUS;
   }
   else {
-    msg(MSG::INFO) << "Using constant weighting" << endmsg;
+    ATH_MSG_INFO( "Using constant weighting" );
     m_NormalizationTypeNumber = GetLCDefs::CONST;
   }
 
   if ( m_ClassificationType == "None" ) {
-    msg(MSG::INFO) << "Expecting single particle input" << endmsg;
+    ATH_MSG_INFO( "Expecting single particle input" );
     m_ClassificationTypeNumber = GetLCDefs::NONE;
   }
   else if ( m_ClassificationType == "ParticleID_EM" ) {
-    msg(MSG::INFO) << "Expecting ParticleID simulation as input -- use EM type clusters only" << endmsg;
+    ATH_MSG_INFO( "Expecting ParticleID simulation as input -- use EM type clusters only" );
     m_ClassificationTypeNumber = GetLCDefs::PARTICLEID_EM;
   }
   else if ( m_ClassificationType == "ParticleID_HAD" ) {
-    msg(MSG::INFO) << "Expecting ParticleID simulation as input -- use HAD type clusters only" << endmsg;
+    ATH_MSG_INFO( "Expecting ParticleID simulation as input -- use HAD type clusters only" );
     m_ClassificationTypeNumber = GetLCDefs::PARTICLEID_HAD;
   }
   else {
-    msg(MSG::WARNING) << " unknown classification type " << m_ClassificationType << " given! Using None instead" << endmsg;
+    ATH_MSG_WARNING( " unknown classification type " << m_ClassificationType << " given! Using None instead" );
     m_ClassificationTypeNumber = GetLCDefs::NONE;
   }
 
@@ -165,9 +165,7 @@ StatusCode GetLCOutOfCluster::initialize() {
       iweight = idim;
   }
   if ( ilogE < 0 || ieta < 0 || iloglambda < 0 || iweight < 0 || iside < 0 ) {
-    msg(MSG::FATAL)
-	<< " Mandatory dimension log10E, |eta|, log10lambda or weight missing ..."
-	<< endmsg;
+    ATH_MSG_FATAL(" Mandatory dimension log10E, |eta|, log10lambda or weight missing ...");
     return StatusCode::FAILURE;
   }
   int nside = m_dimensions[iside].bins();
@@ -233,7 +231,7 @@ StatusCode GetLCOutOfCluster::initialize() {
       }
     }
     if ( theSampling == CaloSampling::Unknown ) {
-      msg(MSG::ERROR) << "Calorimeter sampling " 
+      msg(MSG::ERROR)  << "Calorimeter sampling " 
 	  << *samplingIter
           << " is not a valid Calorimeter sampling name and will be ignored! "
           << "Valid names are: ";
@@ -264,7 +262,7 @@ StatusCode GetLCOutOfCluster::initialize() {
 
 StatusCode GetLCOutOfCluster::finalize()
 {
-  msg(MSG::INFO) << "Writing out histograms" << endmsg;
+  ATH_MSG_INFO( "Writing out histograms" );
   m_outputFile->cd();
   for(unsigned int i=0;i<m_ooc.size();i++) {
     m_ooc[i]->Write();
@@ -282,8 +280,8 @@ StatusCode GetLCOutOfCluster::execute()
   StatusCode sc = evtStore()->retrieve(cc,m_clusterCollName);
 
   if(sc != StatusCode::SUCCESS) {
-    msg(MSG::ERROR) << "Could not retrieve ClusterContainer " 
-	<< m_clusterCollName << " from StoreGate" << endmsg;
+    ATH_MSG_ERROR( "Could not retrieve ClusterContainer " 
+	<< m_clusterCollName << " from StoreGate" );
     return sc;
   }
 
@@ -297,13 +295,13 @@ StatusCode GetLCOutOfCluster::execute()
     const xAOD::CaloCluster * theCluster = (*clusIter);      
     double eC=999; 
     if (!theCluster->retrieveMoment(xAOD::CaloCluster::ENG_CALIB_TOT,eC)) {
-      msg(MSG::ERROR) << "Failed to retrieve cluster moment ENG_CALIB_TOT" <<endmsg;
+      ATH_MSG_ERROR( "Failed to retrieve cluster moment ENG_CALIB_TOT" );
       return StatusCode::FAILURE;      
     }
     if ( m_ClassificationTypeNumber != GetLCDefs::NONE ) {
       double emFrac=-999; 
       if (!theCluster->retrieveMoment(xAOD::CaloCluster::ENG_CALIB_FRAC_EM,emFrac)){
-	msg(MSG::ERROR) << "Failed to retrieve cluster moment ENG_CALIB_FAC_EM" <<endmsg;
+	ATH_MSG_ERROR( "Failed to retrieve cluster moment ENG_CALIB_FAC_EM" );
 	return StatusCode::FAILURE;
       }
       if (m_ClassificationTypeNumber == GetLCDefs::PARTICLEID_EM && emFrac < 0.5 )
@@ -328,7 +326,7 @@ StatusCode GetLCOutOfCluster::execute()
       if ( m_ClassificationTypeNumber != GetLCDefs::NONE ) {
 	double emFrac=-999; 
 	if (!pClus->retrieveMoment(xAOD::CaloCluster::ENG_CALIB_FRAC_EM,emFrac)){
-	  msg(MSG::ERROR) << "Failed to retrieve cluster moment ENG_CALIB_FAC_EM" <<endmsg;
+	  ATH_MSG_ERROR( "Failed to retrieve cluster moment ENG_CALIB_FAC_EM");
 	  return StatusCode::FAILURE;
 	}
 	if (m_ClassificationTypeNumber == GetLCDefs::PARTICLEID_EM && emFrac < 0.5 )
@@ -359,8 +357,8 @@ StatusCode GetLCOutOfCluster::execute()
 	  iside = (int)(nside*(((pClus->eta()<0?-1.0:1.0) - hd.lowEdge())
 			       /(hd.highEdge()-hd.lowEdge())));
 	  if ( iside < 0 || iside > nside-1 ) {
-	    msg(MSG::WARNING) << " Side index out of bounds " <<
-	      iside << " not in [0," << nside-1 << "]" << endmsg; 
+	    ATH_MSG_WARNING( " Side index out of bounds " <<
+	      iside << " not in [0," << nside-1 << "]" ); 
 	    iside = -1;
 	  }
 	}
@@ -371,8 +369,8 @@ StatusCode GetLCOutOfCluster::execute()
 	  iphi = (int)(nphi*((pClus->phi() - hd.lowEdge())
 			     /(hd.highEdge()-hd.lowEdge())));
 	  if ( iphi < 0 || iphi > nphi-1 ) {
-	    msg(MSG::WARNING) << " Phi index out of bounds " <<
-	      iphi << " not in [0," << nphi-1 << "]" << endmsg; 
+	    ATH_MSG_WARNING( " Phi index out of bounds " <<
+	      iphi << " not in [0," << nphi-1 << "]" ); 
 	    iphi = -1;
 	  }
 	}
@@ -387,7 +385,7 @@ StatusCode GetLCOutOfCluster::execute()
 	      !pClus->retrieveMoment(xAOD::CaloCluster::ENG_CALIB_OUT_L,eout) ||
 	      !pClus->retrieveMoment(xAOD::CaloCluster::ENG_CALIB_TOT,etot) ||
 	      !pClus->retrieveMoment(xAOD::CaloCluster::ISOLATION,isol)) {
-	    msg(MSG::ERROR) << "Failed to retrieve a cluster moment (CENTER_LAMBDA,ENG_CALIB_OUT,ENG_CALIB_TOT,ISOLATION)" << endmsg;
+	    ATH_MSG_ERROR( "Failed to retrieve a cluster moment (CENTER_LAMBDA,ENG_CALIB_OUT,ENG_CALIB_TOT,ISOLATION)" );
 	    return StatusCode::FAILURE;
 	  }
 	
diff --git a/Calorimeter/CaloLocalHadCalib/src/GetLCSinglePionsPerf.cxx b/Calorimeter/CaloLocalHadCalib/src/GetLCSinglePionsPerf.cxx
index 5159d3d6ef4cdb4fa46b6f38cace4b7866ede54f..bb0c031fa6572d4a54cd72a79f417a4fa16131a1 100644
--- a/Calorimeter/CaloLocalHadCalib/src/GetLCSinglePionsPerf.cxx
+++ b/Calorimeter/CaloLocalHadCalib/src/GetLCSinglePionsPerf.cxx
@@ -27,7 +27,6 @@
 #include "AthenaKernel/errorcheck.h"
 #include "GaudiKernel/ISvcLocator.h"
 #include "GaudiKernel/StatusCode.h"
-#include "GaudiKernel/MsgStream.h"
 #include "StoreGate/StoreGateSvc.h" 
 
 #include "CaloEvent/CaloCell.h"
@@ -189,24 +188,6 @@ StatusCode GetLCSinglePionsPerf::initialize()
 
   ATH_CHECK( detStore()->retrieve(m_id_helper) );
 
-//   // tool services
-//   IToolSvc* p_toolSvc = 0;
-//   sg = service("ToolSvc", p_toolSvc);
-//   if (sg.isFailure()) {
-//     log << MSG::FATAL << " Tool Service not found " << endmsg;
-//     return StatusCode::FAILURE;
-//   }
-//   IAlgTool* algToolPtr;
-//   sg = p_toolSvc->retrieveTool("CaloDepthTool",algToolPtr,this);
-//   if (sg.isFailure()) {
-//     log << MSG::FATAL << " Could not find CaloDepthTool " <<endmsg;
-//     return StatusCode::FAILURE;
-//   }
-//   else {
-//     log << MSG::INFO << " Found CaloDepthTool" << endmsg;
-//     m_caloDepthTool = dynamic_cast<CaloDepthTool*>(algToolPtr); // check for tool type
-//   }
-
 
   m_deta = (m_etamax - m_etamin)/m_netabin;
   m_dphi = (m_phimax - m_phimin)/m_nphibin;
@@ -805,7 +786,7 @@ int GetLCSinglePionsPerf::fill_reco()
   std::vector<const xAOD::CaloClusterContainer *> clusCollVector;
   for(std::vector<std::string >::iterator it=m_clusterCollNames.begin(); it!=m_clusterCollNames.end(); it++){    
     const DataHandle<xAOD::CaloClusterContainer> pColl;
-    ATH_CHECK( evtStore()->retrieve(pColl, (*it) ) );
+    ATH_CHECK( evtStore()->retrieve(pColl, (*it) ), -1 );
     clusCollVector.push_back(pColl);
   }
 
@@ -998,13 +979,13 @@ int GetLCSinglePionsPerf::fill_moments()
   std::vector<const CaloCalibrationHitContainer *> v_cchc;
   std::vector<std::string>::iterator iter;
   for (iter=m_CalibrationHitContainerNames.begin(); iter!=m_CalibrationHitContainerNames.end();iter++) {
-    ATH_CHECK( evtStore()->retrieve(cchc,*iter) );
+    ATH_CHECK( evtStore()->retrieve(cchc,*iter), -1 );
     v_cchc.push_back(cchc);
   }
 
   std::vector<const CaloCalibrationHitContainer *> v_dmcchc;
   for (iter=m_DMCalibrationHitContainerNames.begin();iter!=m_DMCalibrationHitContainerNames.end();iter++) {
-    ATH_CHECK(  evtStore()->retrieve(cchc,*iter) );
+    ATH_CHECK(  evtStore()->retrieve(cchc,*iter), -1 );
     v_dmcchc.push_back(cchc);
   }
 
@@ -1228,13 +1209,13 @@ int GetLCSinglePionsPerf::fill_calibhits()
   std::vector<const CaloCalibrationHitContainer *> v_cchc;
   std::vector<std::string>::iterator iter;
   for (iter=m_CalibrationHitContainerNames.begin(); iter!=m_CalibrationHitContainerNames.end();iter++) {
-    ATH_CHECK( evtStore()->retrieve(cchc,*iter) );
+    ATH_CHECK( evtStore()->retrieve(cchc,*iter), -1 );
     v_cchc.push_back(cchc);
   }
 
   std::vector<const CaloCalibrationHitContainer *> v_dmcchc;
   for (iter=m_DMCalibrationHitContainerNames.begin();iter!=m_DMCalibrationHitContainerNames.end();iter++) {
-    ATH_CHECK( evtStore()->retrieve(cchc,*iter) );
+    ATH_CHECK( evtStore()->retrieve(cchc,*iter), -1 );
     v_dmcchc.push_back(cchc);
   }
 
diff --git a/Calorimeter/CaloLocalHadCalib/src/GetLCWeights.cxx b/Calorimeter/CaloLocalHadCalib/src/GetLCWeights.cxx
index 12dd10a631c4a4c66b8743c2908efac747cb6cfb..ae3a3565774d27306608de96680193646bf8e9f1 100644
--- a/Calorimeter/CaloLocalHadCalib/src/GetLCWeights.cxx
+++ b/Calorimeter/CaloLocalHadCalib/src/GetLCWeights.cxx
@@ -34,11 +34,7 @@
 #include "CaloIdentifier/CaloCell_ID.h"
 
 #include "AthenaKernel/errorcheck.h"
-//#include "GaudiKernel/ISvcLocator.h"
-//#include "GaudiKernel/StatusCode.h"
-//#include "GaudiKernel/MsgStream.h"
 
-//#include "StoreGate/StoreGateSvc.h" 
 #include "TFile.h"
 #include "TProfile2D.h"
 #include "TString.h"
@@ -182,36 +178,36 @@ StatusCode GetLCWeights::initialize()
 
 
   if ( m_NormalizationType == "Lin" ) {
-    msg(MSG::INFO) << "Using weighting proportional to E_calib" << endmsg;
+    ATH_MSG_INFO( "Using weighting proportional to E_calib" );
     m_NormalizationTypeNumber = GetLCDefs::LIN;
   }
   else if ( m_NormalizationType == "Log" ) {
-    msg(MSG::INFO) << "Using weighting proportional to log(E_calib)" << endmsg;
+    ATH_MSG_INFO( "Using weighting proportional to log(E_calib)" );
     m_NormalizationTypeNumber = GetLCDefs::LOG;
   }
   else if ( m_NormalizationType == "NClus" ) {
-    msg(MSG::INFO) << "Using weighting proportional to 1/N_Clus_E_calib>0" << endmsg;
+    ATH_MSG_INFO( "Using weighting proportional to 1/N_Clus_E_calib>0" );
     m_NormalizationTypeNumber = GetLCDefs::NCLUS;
   }
   else {
-    msg(MSG::INFO) << "Using constant weighting" << endmsg;
+    ATH_MSG_INFO( "Using constant weighting" );
     m_NormalizationTypeNumber = GetLCDefs::CONST;
   }
 
   if ( m_ClassificationType == "None" ) {
-    msg(MSG::INFO) << "Expecting single particle input" << endmsg;
+    ATH_MSG_INFO( "Expecting single particle input" );
     m_ClassificationTypeNumber = GetLCDefs::NONE;
   }
   else if ( m_ClassificationType == "ParticleID_EM" ) {
-    msg(MSG::INFO) << "Expecting ParticleID simulation as input -- use EM type clusters only" << endmsg;
+    ATH_MSG_INFO( "Expecting ParticleID simulation as input -- use EM type clusters only" );
     m_ClassificationTypeNumber = GetLCDefs::PARTICLEID_EM;
   }
   else if ( m_ClassificationType == "ParticleID_HAD" ) {
-    msg(MSG::INFO) << "Expecting ParticleID simulation as input -- use HAD type clusters only" << endmsg;
+    ATH_MSG_INFO( "Expecting ParticleID simulation as input -- use HAD type clusters only" );
     m_ClassificationTypeNumber = GetLCDefs::PARTICLEID_HAD;
   }
   else {
-    msg(MSG::WARNING) << " unknown classification type " << m_ClassificationType << " given! Using None instead" << endmsg;
+    ATH_MSG_WARNING( " unknown classification type " << m_ClassificationType << " given! Using None instead" );
     m_ClassificationTypeNumber = GetLCDefs::NONE;
   }
 
@@ -224,7 +220,7 @@ StatusCode GetLCWeights::initialize()
       }
     }
     if ( theSampling == CaloSampling::Unknown ) {
-      msg(MSG::ERROR) << "Calorimeter sampling " 
+      ATH_MSG_ERROR( "Calorimeter sampling " 
 	  << m_dimensions[isamp][0].title() 
           << " is not a valid Calorimeter sampling name and will be ignored! "
           << "Valid names are: ";
@@ -235,7 +231,7 @@ StatusCode GetLCWeights::initialize()
 	else 
 	  msg() << ".";
       }
-      msg() << endmsg;
+      msg() );
     }
     else {
       m_isampmap[theSampling].resize(4,-1);
@@ -268,9 +264,7 @@ StatusCode GetLCWeights::initialize()
 	  iweight = idim;
       }
       if ( ilogE < 0 || ilogrho < 0 || iweight < 0 ) {
-	msg(MSG::FATAL)
-	    << " Mandatory dimension log10E, log10rho or weight missing ..."
-	    << endmsg;
+	ATH_MSG_FATAL( " Mandatory dimension log10E, log10rho or weight missing ..." );
 	return StatusCode::FAILURE;
       }
       int nside = (iside>=0?m_dimensions[isamp][iside].bins():1);
@@ -348,7 +342,7 @@ StatusCode GetLCWeights::initialize()
 
 StatusCode GetLCWeights::finalize()
 {
-  msg(MSG::INFO) << "Writing out histograms" << endmsg;
+  ATH_MSG_INFO( "Writing out histograms" );
   m_outputFile->cd();
   for(unsigned int i=0;i<m_weight.size();i++) {
     for(unsigned int j=0;j<m_weight[i].size();j++) {
@@ -369,8 +363,8 @@ StatusCode GetLCWeights::execute()
   StatusCode sc = evtStore()->retrieve(cc,m_clusterCollName);
 
   if(sc != StatusCode::SUCCESS) {
-    msg(MSG::ERROR) << "Could not retrieve ClusterContainer " 
-	<< m_clusterCollName << " from StoreGate" << endmsg;
+    ATH_MSG_ERROR( "Could not retrieve ClusterContainer " 
+	<< m_clusterCollName << " from StoreGate" );
     return sc;
   }
 
@@ -380,13 +374,13 @@ StatusCode GetLCWeights::execute()
   for (iter=m_CalibrationHitContainerNames.begin();
        iter!=m_CalibrationHitContainerNames.end();iter++) {
     if ( !evtStore()->contains<CaloCalibrationHitContainer>(*iter)) {
-      msg(MSG::ERROR) << "SG does not contain calibration hit container " << *iter << endmsg;
+      ATH_MSG_ERROR( "SG does not contain calibration hit container " << *iter );
       return StatusCode::FAILURE;
     }
     else {
       sc = evtStore()->retrieve(cchc,*iter);
       if (sc.isFailure() ) {
-	msg(MSG::ERROR) << "Cannot retrieve calibration hit container " << *iter << endmsg;
+	ATH_MSG_ERROR( "Cannot retrieve calibration hit container " << *iter );
 	return sc;
       } 
       else
@@ -419,13 +413,13 @@ StatusCode GetLCWeights::execute()
     
     double eC=999; 
     if (!theCluster->retrieveMoment(xAOD::CaloCluster::ENG_CALIB_TOT,eC)) {
-      msg(MSG::ERROR) << "Failed to retrieve cluster moment ENG_CALIB_TOT" <<endmsg;
+      ATH_MSG_ERROR( "Failed to retrieve cluster moment ENG_CALIB_TOT");
       return StatusCode::FAILURE;      
     }
     if ( m_ClassificationTypeNumber != GetLCDefs::NONE ) {
       double emFrac=-999; 
       if (!theCluster->retrieveMoment(xAOD::CaloCluster::ENG_CALIB_FRAC_EM,emFrac)){
-	msg(MSG::ERROR) << "Failed to retrieve cluster moment ENG_CALIB_FAC_EM" <<endmsg;
+	ATH_MSG_ERROR( "Failed to retrieve cluster moment ENG_CALIB_FAC_EM");
 	return StatusCode::FAILURE;
       }
       if (m_ClassificationTypeNumber == GetLCDefs::PARTICLEID_EM && emFrac < 0.5 )
@@ -496,14 +490,14 @@ StatusCode GetLCWeights::execute()
       double eng = pClus->e();
       double eCalib=-999;  
       if (!pClus->retrieveMoment(xAOD::CaloCluster::ENG_CALIB_TOT,eCalib)) {
-	msg(MSG::ERROR) << "Failed to retrieve cluster moment ENG_CALIB_TOT" <<endmsg;
+	ATH_MSG_ERROR( "Failed to retrieve cluster moment ENG_CALIB_TOT");
 	return StatusCode::FAILURE;
       }
       if ( eng > 0 && eCalib > 0 ) {
 	if ( m_ClassificationTypeNumber != GetLCDefs::NONE ) {
 	  double emFrac=-999;
 	  if (!pClus->retrieveMoment(xAOD::CaloCluster::ENG_CALIB_FRAC_EM,emFrac)) {
-	    msg(MSG::ERROR) << "Failed to retrieve cluster moment ENG_CALIB_FAC_EM" <<endmsg;
+	    ATH_MSG_ERROR( "Failed to retrieve cluster moment ENG_CALIB_FAC_EM");
 	    return StatusCode::FAILURE;
 	  }
 	  if (m_ClassificationTypeNumber == GetLCDefs::PARTICLEID_EM && emFrac < 0.5 )
@@ -532,9 +526,9 @@ StatusCode GetLCWeights::execute()
 	      isideCell = (int)(nside*(((pCell->eta()<0?-1.0:1.0) - hd.lowEdge())
 				       /(hd.highEdge()-hd.lowEdge())));
 	      if ( isideCell < 0 || isideCell > nside-1 ) {
-		msg(MSG::WARNING) << " Side index out of bounds " <<
+		ATH_MSG_WARNING( " Side index out of bounds " <<
 		  isideCell << " not in [0," << nside-1 << "] for "
-		    << "Sampl=" << caloSample << endmsg; 
+		    << "Sampl=" << caloSample ); 
 		isideCell = -1;
 	      }
 	    }
@@ -544,9 +538,9 @@ StatusCode GetLCWeights::execute()
 	      ietaCell = (int)(neta*((fabs(pCell->eta()) - hd.lowEdge())
 				     /(hd.highEdge()-hd.lowEdge())));
 	      if ( ietaCell < 0 || ietaCell > neta-1 ) {
-		msg(MSG::WARNING) << " Eta index out of bounds " <<
+		ATH_MSG_WARNING( " Eta index out of bounds " <<
 		  ietaCell << " not in [0," << neta-1 << "] for "
-		    << "Sampl=" << caloSample << endmsg; 
+		    << "Sampl=" << caloSample ); 
 		ietaCell = -1;
 	      }
 	    }
@@ -556,9 +550,9 @@ StatusCode GetLCWeights::execute()
 	      iphiCell = (int)(nphi*((pCell->phi() - hd.lowEdge())
 				     /(hd.highEdge()-hd.lowEdge())));
 	      if ( iphiCell < 0 || iphiCell > nphi-1 ) {
-		msg(MSG::WARNING) << " Phi index out of bounds " <<
+		ATH_MSG_WARNING( " Phi index out of bounds " <<
 		  iphiCell << " not in [0," << nphi-1 << "] for "
-		    << "Sampl=" << caloSample << endmsg; 
+		    << "Sampl=" << caloSample ); 
 		iphiCell = -1;
 	      }
 	    }
@@ -569,12 +563,12 @@ StatusCode GetLCWeights::execute()
 		myHashId = m_calo_id->subcalo_cell_hash(myId,otherSubDet);
 		unsigned int iW = iphiCell*neta*nside+ietaCell*nside+isideCell;
 		if ( iW >= m_weight[caloSample].size() ) {
-		  msg(MSG::WARNING) << " Index out of bounds " <<
+		  ATH_MSG_WARNING( " Index out of bounds " <<
 		    iW << " > " << m_weight[caloSample].size()-1 << " for "
 		      << "Sampl=" << caloSample
 		      << ", iphi=" << iphiCell 
 		      << ", ieta=" << ietaCell 
-		      << ", iside=" << isideCell << endmsg;
+		      << ", iside=" << isideCell );
 		}
 		else {
 		  ClusWeight * theList = cellVector[otherSubDet][(unsigned int)myHashId];
diff --git a/Calorimeter/CaloMonitoring/src/CaloTowerVecMon.cxx b/Calorimeter/CaloMonitoring/src/CaloTowerVecMon.cxx
index d60336e272e174163057fb27099e577118ee4492..a14a847faf99dc972d3e42e7f864af005521f37c 100755
--- a/Calorimeter/CaloMonitoring/src/CaloTowerVecMon.cxx
+++ b/Calorimeter/CaloMonitoring/src/CaloTowerVecMon.cxx
@@ -316,7 +316,7 @@ StatusCode CaloTowerVecMon::checkTimeGran(bool isNewEventsBlock, bool isNewLumiB
     }
   }
 
-  return isNewTimeGran;
+  return StatusCode(isNewTimeGran);
 }
 
 void CaloTowerVecMon::bookTwrPreHists(const Interval_t theinterval){
diff --git a/Calorimeter/CaloUtils/src/LocalNoiseSuppressionTool.cxx b/Calorimeter/CaloUtils/src/LocalNoiseSuppressionTool.cxx
index c7ccfd4e67241932bf4ae431820707233c6b39cd..1d3debf94b98672b971d1a6c2a87b6986ec2ed44 100644
--- a/Calorimeter/CaloUtils/src/LocalNoiseSuppressionTool.cxx
+++ b/Calorimeter/CaloUtils/src/LocalNoiseSuppressionTool.cxx
@@ -232,9 +232,9 @@ LocalNoiseSuppressionTool::getTestStatistic( const CaloCell* theCell,
     StatusCode sc = evtStore()->retrieve(caloCellContainer, m_caloCellContainerName);
 
     if(sc.isFailure()  ||  !caloCellContainer) {
-      ATH_MSG_ERROR( "the CaloCellContainer " << m_caloCellContainerName 
+      ATH_MSG_WARNING( "the CaloCellContainer " << m_caloCellContainerName 
                      << "was not found in TDS" );
-      return StatusCode::SUCCESS;
+      return -9999.;
     }    
   }
 
diff --git a/Commission/CommissionUtils/src/CosmicTriggerTimeTool.cxx b/Commission/CommissionUtils/src/CosmicTriggerTimeTool.cxx
index b4063c39e21173ec2ebe7ea9e9b8be10d9a7b873..a80e49d11f0c8038db7d9748ee0cfc1d768d84c7 100644
--- a/Commission/CommissionUtils/src/CosmicTriggerTimeTool.cxx
+++ b/Commission/CommissionUtils/src/CosmicTriggerTimeTool.cxx
@@ -142,7 +142,7 @@ double CosmicTriggerTimeTool::larTime()
   for (;it!=it_e;++it) {
     const LArHitContainer* cont; 
 
-    CHECK( evtStore()->retrieve(cont,(*it)) );
+    CHECK( evtStore()->retrieve(cont,(*it)), 0 );
 
     LArHitContainer::const_iterator hit_it = cont->begin(); 
     LArHitContainer::const_iterator hit_it_e = cont->end(); 
diff --git a/Control/AthAllocators/share/DataPool_test.ref b/Control/AthAllocators/share/DataPool_test.ref
index 21159b5cdedac7044fe7546ed698f240706774f5..2d04da3a150d361bce836056716c0e338783c3cb 100644
--- a/Control/AthAllocators/share/DataPool_test.ref
+++ b/Control/AthAllocators/share/DataPool_test.ref
@@ -1,42 +1,34 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/DataPool_test.txt
-JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work5/Control/DataModel/run/../share/DataPool_test.txt)
-JobOptionsSvc        INFO # (5,1): ApplicationMgr.DLLs += ["StoreGate"]
+JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/Control/AthAllocators/share/../share/DataPool_test.txt
 JobOptionsSvc        INFO # (6,1): MessageSvc.OutputLevel = 2
 JobOptionsSvc        INFO # (8,1): ApplicationMgr.ExtSvc += ["IncidentSvc", "ChronoStatSvc", "AuditorSvc"]
 JobOptionsSvc        INFO Job options successfully read in from ../share/DataPool_test.txt
 ApplicationMgr      DEBUG Getting my own properties
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v1r3p3)
-                                          running on lxplus446.cern.ch on Mon Apr 22 17:38:11 2013
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
+                                          running on lxplus020.cern.ch on Mon Dec 11 13:11:58 2017
 ====================================================================================================================================
-ApplicationMgr       INFO Successfully loaded modules : StoreGate
 ApplicationMgr       INFO Application Manager Configured successfully
-ServiceManager      DEBUG Initializing service IncidentSvc
 IncidentSvc         DEBUG Service base class initialized successfully
-ServiceManager      DEBUG Initializing service ChronoStatSvc
 ChronoStatSvc       DEBUG Service base class initialized successfully
 ChronoStatSvc        INFO  Number of skipped events for MemStat-1
-ServiceManager      DEBUG Initializing service AuditorSvc
 AuditorSvc          DEBUG Service base class initialized successfully
-ServiceManager      DEBUG Initializing service AppMgrRunable
 AppMgrRunable       DEBUG Service base class initialized successfully
-ServiceManager      DEBUG Initializing service EventLoopMgr
 EventLoopMgr        DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0
 EventDataSvc        DEBUG Service base class initialized successfully
 EventPersistenc...  DEBUG Service base class initialized successfully
+AlgExecStateSvc     DEBUG Service base class initialized successfully
 EventLoopMgr      WARNING Unable to locate service "EventSelector" 
 EventLoopMgr      WARNING No events will be processed from external input.
 HistogramDataSvc    DEBUG Service base class initialized successfully
-HistogramPersis...  DEBUG  'CnvServices':[ 'RootHistSvc' ]
 HistogramPersis...  DEBUG Service base class initialized successfully
 HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr Ready
  *** DataPool test in progress: 
-IncidentSvc         DEBUG Adding [BeginEvent] listener '<unknown>' with priority 100
  **** DataPool test successfully completed **** 
 ChronoStatSvc        INFO Time User   : Tot=    0 [us]                                             #=  1
diff --git a/Control/AthContainers/AthContainers/tools/DVLDataBucket.h b/Control/AthContainers/AthContainers/tools/DVLDataBucket.h
index d8e76b253c5fbcad64ea44094c3889ecbb9748f1..6ca86a13087f492f7d6cc09c7ac4849c17b8e076 100644
--- a/Control/AthContainers/AthContainers/tools/DVLDataBucket.h
+++ b/Control/AthContainers/AthContainers/tools/DVLDataBucket.h
@@ -142,7 +142,7 @@ public:
 private:
   typedef std::pair<DataModel_detail::DVLInfoBase*, void*> ent_t;
   typedef std::vector<ent_t> vec_t;
-  mutable vec_t m_copies;
+  vec_t m_copies;
 
   /// The std::type_info for the class of object we're holding.
   /// May be different from that of the base @c DataVector in the case
diff --git a/Control/AthContainers/AthContainers/tools/DVLDataBucket.icc b/Control/AthContainers/AthContainers/tools/DVLDataBucket.icc
index 785a12f08e62bde39ef84a947a6551fca6215b5e..728f3470a2122698e1dc8bac1052f91b70477c90 100644
--- a/Control/AthContainers/AthContainers/tools/DVLDataBucket.icc
+++ b/Control/AthContainers/AthContainers/tools/DVLDataBucket.icc
@@ -143,15 +143,15 @@ void*
 DVLDataBucket<T>::cast (CLID clid, IRegisterTransient* irt /*= 0*/,
                         bool /*isConst = true*/)
 {
-  const T* ptr = *((DataBucket<T>*)this);
+  T* ptr = *((DataBucket<T>*)this);
 
   // Test for trivial conversion.
   // FIXME: Assumes we can reinterpret_cast between DV* and ViewVector<DV>*.
   if (clid == m_clid || clid == DataBucket<T>::classID())
-    return const_cast<T*>(ptr);
+    return ptr;
 
   // Try looking for a true base conversion.
-  void* ret = SG::BaseInfo<T>::cast (const_cast<T*>(ptr), clid);
+  void* ret = SG::BaseInfo<T>::cast (ptr, clid);
   if (ret)
     return ret;
 
@@ -163,7 +163,7 @@ DVLDataBucket<T>::cast (CLID clid, IRegisterTransient* irt /*= 0*/,
     if (clid == it->first->clid()) {
       // Recopy the elements if the container size has changed.
       if (it->first->size (it->second) != ptr->size()) {
-        dvl_update (*const_cast<T*> (ptr), it->second, it->first);
+        dvl_update (*ptr, it->second, it->first);
       }
       return it->second;
     }
@@ -171,7 +171,7 @@ DVLDataBucket<T>::cast (CLID clid, IRegisterTransient* irt /*= 0*/,
 
   // Try to do a copying conversion.
   DataModel_detail::DVLInfoBase* info;
-  void* newcont = dvl_convert (*const_cast<T*> (ptr), clid, info);
+  void* newcont = dvl_convert (*ptr, clid, info);
   if (newcont) {
     m_copies.push_back (std::make_pair (info, newcont));
     irt->registerTransient (newcont);
@@ -195,15 +195,15 @@ DVLDataBucket<T>::cast (const std::type_info& tinfo,
                         IRegisterTransient* irt /*= 0*/,
                         bool /*isConst = true*/)
 {
-  const T* ptr = *((DataBucket<T>*)this);
+  T* ptr = *((DataBucket<T>*)this);
 
   // Test for trivial conversion.
   // FIXME: Assumes we can reinterpret_cast between DV* and ViewVector<DV>*.
   if (&tinfo == m_ti || tinfo == DataBucket<T>::tinfo())
-    return const_cast<T*>(ptr);
+    return ptr;
 
   // Try looking for a true base conversion.
-  void* ret = SG::BaseInfo<T>::cast (const_cast<T*>(ptr), tinfo);
+  void* ret = SG::BaseInfo<T>::cast (ptr, tinfo);
   if (ret)
     return ret;
 
@@ -215,7 +215,7 @@ DVLDataBucket<T>::cast (const std::type_info& tinfo,
     if (tinfo == it->first->tinfo()) {
       // Recopy the elements if the container size has changed.
       if (it->first->size (it->second) != ptr->size()) {
-        dvl_update (*const_cast<T*> (ptr), it->second, it->first);
+        dvl_update (*ptr, it->second, it->first);
       }
       return it->second;
     }
@@ -223,7 +223,7 @@ DVLDataBucket<T>::cast (const std::type_info& tinfo,
 
   // Try to do a copying conversion.
   DataModel_detail::DVLInfoBase* info;
-  void* newcont = dvl_convert (*const_cast<T*> (ptr), tinfo, info);
+  void* newcont = dvl_convert (*ptr, tinfo, info);
   if (newcont) {
     m_copies.push_back (std::make_pair (info, newcont));
     irt->registerTransient (newcont);
diff --git a/Control/AthContainers/AthContainers/tools/DVLEltBaseInfo.icc b/Control/AthContainers/AthContainers/tools/DVLEltBaseInfo.icc
index 7dd84b834fc3c0fc69eb5c7134787c5fde85216b..240f80d796baa14c7989655de81f09d1864475eb 100644
--- a/Control/AthContainers/AthContainers/tools/DVLEltBaseInfo.icc
+++ b/Control/AthContainers/AthContainers/tools/DVLEltBaseInfo.icc
@@ -91,7 +91,7 @@ template <class T>
 struct RegisterDVLEltBaseInit
 {
   RegisterDVLEltBaseInit();
-  static const SG::BaseInfoBase& doinit();
+  static void doinit (SG::BaseInfoBase* bib);
 };
 #ifndef __REFLEX__
 template <class T>
@@ -104,17 +104,13 @@ RegisterDVLEltBaseInit<T>::RegisterDVLEltBaseInit()
 }
 #endif
 template <class T>
-const SG::BaseInfoBase& RegisterDVLEltBaseInit<T>::doinit()
+void RegisterDVLEltBaseInit<T>::doinit (SG::BaseInfoBase* bib)
 {
-  // Find the BaseInfo instance.
-  SG::BaseInfoBase* bib =
-    const_cast<SG::BaseInfoBase*> (SG::BaseInfoBase::find (typeid(T)));
   if (bib) {
     // Walk the base classes and add to it.
     SG::BaseInfoImpl<T>& impl = *static_cast<SG::BaseInfoImpl<T>*> (bib);
     DVLEltBase_init<T>::init (impl, false);
   }
-  return *bib;
 }
 
 
diff --git a/Control/AthToolSupport/AsgTools/AsgTools/Check.h b/Control/AthToolSupport/AsgTools/AsgTools/Check.h
index 649e46894e91900997b9eb4dd8e95b432655d544..78a422336e383de7a2f8b9d0d2b589ce53862a54 100644
--- a/Control/AthToolSupport/AsgTools/AsgTools/Check.h
+++ b/Control/AthToolSupport/AsgTools/AsgTools/Check.h
@@ -25,17 +25,35 @@
 ///    ASG_CHECK( someFunction() );
 /// </code>
 ///
+/// or for functions that do not return a StatusCode:
+///
+/// <code>
+///    ASG_CHECK( someFunction(), -1 );
+/// </code>
+///
 /// The macro may only be used inside of member functions of dual-use tools.
 ///
-#define ASG_CHECK( EXP )                                       \
+#define ASG_CHECK(...)  \
+   BOOST_PP_OVERLOAD(ASG_CHECK_, __VA_ARGS__)(__VA_ARGS__)
+
+#define ASG_CHECK_1( EXP )                                     \
    do {                                                        \
-      const StatusCode sc__ = EXP;                             \
+      const StatusCode sc__(EXP);                              \
       if( ! sc__.isSuccess() ) {                               \
          ATH_MSG_ERROR( "Failed to call \"" << #EXP << "\"" ); \
          return sc__;                                          \
       }                                                        \
    } while( 0 )
 
+#define ASG_CHECK_2( EXP, RET )                                \
+   do {                                                        \
+      const StatusCode sc__(EXP);                              \
+      if( ! sc__.isSuccess() ) {                               \
+         ATH_MSG_ERROR( "Failed to call \"" << #EXP << "\"" ); \
+         return RET;                                           \
+      }                                                        \
+   } while( 0 )
+
 /// Helper macro for checking the status code of a call outside of an ASG tool
 ///
 /// The other version of this macro can be used to write very compact code
@@ -47,7 +65,7 @@
 ///
 #define ASG_CHECK_SA( SOURCE, EXP )                                     \
    do {                                                                 \
-      const StatusCode sc__ = EXP;                                      \
+      const StatusCode sc__(EXP);                                       \
       if( ! sc__.isSuccess() ) {                                        \
          static MsgStream msg( SOURCE );                                \
          msg << MSGSTREAM_REPORT_PREFIX << MSG::ERROR                   \
@@ -58,7 +76,7 @@
 
 /// In standalone mode use the ASG specific macro as a replacement for ATH_CHECK
 #ifdef ASGTOOL_STANDALONE
-#   define ATH_CHECK( EXP ) ASG_CHECK( EXP )
+#   define ATH_CHECK ASG_CHECK
 #endif
 
 #endif // ASGTOOLS_CHECK_H
diff --git a/Control/AthenaBaseComps/AthenaBaseComps/AthAlgTool.h b/Control/AthenaBaseComps/AthenaBaseComps/AthAlgTool.h
index 51b16cb29f4162c704bbf4bb2335f45d660dae00..ea0a3762c84f4799e7621be6144cb339e5b4bdcd 100644
--- a/Control/AthenaBaseComps/AthenaBaseComps/AthAlgTool.h
+++ b/Control/AthenaBaseComps/AthenaBaseComps/AthAlgTool.h
@@ -46,7 +46,6 @@ namespace Gaudi {
 #include "StoreGate/VarHandleBase.h"
 #include "StoreGate/VarHandleKeyArray.h"
 #include "StoreGate/VarHandleKeyArrayProperty.h"
-#include "AthenaKernel/IUserDataSvc.h"
 
 
 class AthAlgTool : 
@@ -82,10 +81,6 @@ public:
    */
   ServiceHandle<StoreGateSvc>& detStore() const;
 
-  /** @brief The standard @c UserDataSvc 
-   * Returns (kind of) a pointer to the @c UserDataSvc
-   */
-  ServiceHandle<IUserDataSvc>& userStore() const;
 
 private:
   // to keep track of VarHandleKeyArrays for data dep registration
@@ -306,6 +301,15 @@ public:
   virtual StatusCode sysInitialize() override;
 
 
+  /**
+   * @brief Handle START transition.
+   *
+   * We override this in order to make sure that conditions handle keys
+   * can cache a pointer to the conditions container.
+   */
+  virtual StatusCode sysStart() override;
+
+
   /**
    * @brief Return this tool's input handles.
    *
@@ -370,10 +374,6 @@ private:
   /// Pointer to StoreGate (detector store by default)
   mutable StoreGateSvc_t m_detStore;
 
-  typedef ServiceHandle<IUserDataSvc> UserDataSvc_t;
-  /// Pointer to IUserDataSvc
-  mutable UserDataSvc_t m_userStore;
-
   bool m_varHandleArraysDeclared;
 }; 
 
@@ -389,8 +389,4 @@ inline
 ServiceHandle<StoreGateSvc>& AthAlgTool::detStore() const 
 { return m_detStore; }
 
-inline
-ServiceHandle<IUserDataSvc>& AthAlgTool::userStore() const 
-{ return m_userStore; }
-
 #endif //> ATHENABASECOMPS_ATHALGTOOL_H
diff --git a/Control/AthenaBaseComps/AthenaBaseComps/AthAlgorithm.h b/Control/AthenaBaseComps/AthenaBaseComps/AthAlgorithm.h
index 29f049a6a289d65bd385416de2ef28619b58074a..0ede9cfbdb1a38ed40aa26d26c5234c719b995f3 100644
--- a/Control/AthenaBaseComps/AthenaBaseComps/AthAlgorithm.h
+++ b/Control/AthenaBaseComps/AthenaBaseComps/AthAlgorithm.h
@@ -47,7 +47,6 @@ namespace Gaudi {
 #include "StoreGate/VarHandleKey.h"
 #include "StoreGate/VarHandleBase.h"
 #include "StoreGate/VarHandleKeyArray.h"
-#include "AthenaKernel/IUserDataSvc.h"
 
 // Forward declaration
 
@@ -111,10 +110,6 @@ class AthAlgorithm
    */
   ServiceHandle<StoreGateSvc>& detStore() const;
 
-  /** @brief The standard @c UserDataSvc 
-   * Returns (kind of) a pointer to the @c UserDataSvc
-   */
-  ServiceHandle<IUserDataSvc>& userStore() const;
 
 private:
   // to keep track of VarHandleKeyArrays for data dep registration
@@ -351,6 +346,15 @@ public:
   virtual StatusCode sysInitialize() override;
 
 
+  /**
+   * @brief Handle START transition.
+   *
+   * We override this in order to make sure that conditions handle keys
+   * can cache a pointer to the conditions container.
+   */
+  virtual StatusCode sysStart() override;
+
+
   /**
    * @brief Return this algorithm's input handles.
    *
@@ -426,10 +430,6 @@ public:
   /// Pointer to StoreGate (detector store by default)
   mutable StoreGateSvc_t m_detStore;
 
-  typedef ServiceHandle<IUserDataSvc> UserDataSvc_t;
-  /// Pointer to IUserDataSvc
-  mutable UserDataSvc_t m_userStore;
-
   /// Extra output dependency collection, extended by AthAlgorithmDHUpdate
   /// to add symlinks.  Empty if no symlinks were found.
   DataObjIDColl m_extendedExtraObjects;
@@ -453,8 +453,4 @@ inline
 ServiceHandle<StoreGateSvc>& AthAlgorithm::detStore() const 
 { return m_detStore; }
 
-inline
-ServiceHandle<IUserDataSvc>& AthAlgorithm::userStore() const 
-{ return m_userStore; }
-
 #endif //> !ATHENABASECOMPS_ATHALGORITHM_H
diff --git a/Control/AthenaBaseComps/AthenaBaseComps/AthReentrantAlgorithm.h b/Control/AthenaBaseComps/AthenaBaseComps/AthReentrantAlgorithm.h
index b7b9bd05caa1db285a04f00a2ed3cdb69455a988..c9fb9721caec92b3e5bf79c93642119707577f19 100644
--- a/Control/AthenaBaseComps/AthenaBaseComps/AthReentrantAlgorithm.h
+++ b/Control/AthenaBaseComps/AthenaBaseComps/AthReentrantAlgorithm.h
@@ -57,7 +57,6 @@ namespace Gaudi {
 #include "StoreGate/VarHandleKey.h"
 #include "StoreGate/VarHandleBase.h"
 #include "StoreGate/VarHandleKeyArray.h"
-#include "AthenaKernel/IUserDataSvc.h"
 
 /**
  * @brief An algorithm that can be simultaneously executed in multiple threads.
@@ -150,10 +149,6 @@ class AthReentrantAlgorithm
    */
   ServiceHandle<StoreGateSvc>& detStore() const;
 
-  /** @brief The standard @c UserDataSvc 
-   * Returns (kind of) a pointer to the @c UserDataSvc
-   */
-  ServiceHandle<IUserDataSvc>& userStore() const;
 
 #ifndef REENTRANT_GAUDI
   /**
@@ -394,6 +389,15 @@ public:
   virtual StatusCode sysInitialize() override;
 
 
+  /**
+   * @brief Handle START transition.
+   *
+   * We override this in order to make sure that conditions handle keys
+   * can cache a pointer to the conditions container.
+   */
+  virtual StatusCode sysStart() override;
+
+
   /**
    * @brief Return this algorithm's input handles.
    *
@@ -469,10 +473,6 @@ public:
   /// Pointer to StoreGate (detector store by default)
   mutable StoreGateSvc_t m_detStore;
 
-  typedef ServiceHandle<IUserDataSvc> UserDataSvc_t;
-  /// Pointer to IUserDataSvc
-  mutable UserDataSvc_t m_userStore;
-
   /// Extra output dependency collection, extended by AthAlgorithmDHUpdate
   /// to add symlinks.  Empty if no symlinks were found.
   DataObjIDColl m_extendedExtraObjects;
@@ -496,8 +496,4 @@ inline
 ServiceHandle<StoreGateSvc>& AthReentrantAlgorithm::detStore() const 
 { return m_detStore; }
 
-inline
-ServiceHandle<IUserDataSvc>& AthReentrantAlgorithm::userStore() const 
-{ return m_userStore; }
-
 #endif //> !ATHENABASECOMPS_ATHREENTRANTALGORITHM_H
diff --git a/Control/AthenaBaseComps/src/AthAlgTool.cxx b/Control/AthenaBaseComps/src/AthAlgTool.cxx
index ef62075d4fe1c778b4eae36c29e6d986b64e2bb7..ee50d14a7ce0891f05b2a3b7640af0d7ffec10c3 100644
--- a/Control/AthenaBaseComps/src/AthAlgTool.cxx
+++ b/Control/AthenaBaseComps/src/AthAlgTool.cxx
@@ -29,7 +29,6 @@ AthAlgTool::AthAlgTool( const std::string& type,
   ::AlgTool      ( type, name, parent ),
   m_evtStore     ( "StoreGateSvc/StoreGateSvc",  name ),
   m_detStore     ( "StoreGateSvc/DetectorStore", name ),
-  m_userStore    ( "UserDataSvc/UserDataSvc", name ),
   m_varHandleArraysDeclared (false)
 {
   //
@@ -53,11 +52,6 @@ AthAlgTool::AthAlgTool( const std::string& type,
                    m_detStore = StoreGateSvc_t ("StoreGateSvc/DetectorStore", name),
                    "Handle to a StoreGateSvc/DetectorStore instance: it will be used to "
                    "retrieve data during the course of the job" );
-
-  declareProperty( "UserStore",
-                   m_userStore = UserDataSvc_t ("UserDataSvc/UserDataSvc", name),
-                   "Handle to a UserDataSvc/UserDataSvc instance: it will be used to "
-                   "retrieve user data during the course of the job" );
 }
 
 // Destructor
@@ -87,6 +81,32 @@ StatusCode AthAlgTool::sysInitialize()
 }
 
 
+/**
+ * @brief Handle START transition.
+ *
+ * We override this in order to make sure that conditions handle keys
+ * can cache a pointer to the conditions container.
+ */
+StatusCode AthAlgTool::sysStart()
+{
+  ATH_CHECK( AlgTool::sysStart() );
+
+  // Call start() on all input handles.
+  // This allows CondHandleKeys to cache pointers to their conditions containers.
+  // (CondInputLoader makes the containers that it creates during start(),
+  // so initialize() is too early for this.)
+  for (Gaudi::DataHandle* h : inputHandles()) {
+    if (h->isCondition()) {
+      if (SG::VarHandleKey* k = dynamic_cast<SG::VarHandleKey*> (h)) {
+        ATH_CHECK( k->start() );
+      }
+    }
+  }
+  
+  return StatusCode::SUCCESS;
+}
+
+
 /**
  * @brief Return this tool's input handles.
  *
diff --git a/Control/AthenaBaseComps/src/AthAlgorithm.cxx b/Control/AthenaBaseComps/src/AthAlgorithm.cxx
index 153f1663028fb87c858130ea2307a26a7ae304df..9381c1e1a925607ad6dfad6b2b464d607ba36e5d 100644
--- a/Control/AthenaBaseComps/src/AthAlgorithm.cxx
+++ b/Control/AthenaBaseComps/src/AthAlgorithm.cxx
@@ -31,7 +31,6 @@ AthAlgorithm::AthAlgorithm( const std::string& name,
   ::Algorithm   ( name, pSvcLocator, version ),
   m_evtStore    ( "StoreGateSvc/StoreGateSvc",  name ),
   m_detStore    ( "StoreGateSvc/DetectorStore", name ),
-  m_userStore   ( "UserDataSvc/UserDataSvc", name ),
   m_varHandleArraysDeclared (false)
 {
   //
@@ -56,13 +55,8 @@ AthAlgorithm::AthAlgorithm( const std::string& name,
                    "Handle to a StoreGateSvc/DetectorStore instance: it will be used to "
                    "retrieve data during the course of the job" );
 
-  declareProperty( "UserStore",
-                   m_userStore = UserDataSvc_t ("UserDataSvc/UserDataSvc", name),
-                   "Handle to a UserDataSvc/UserDataSvc instance: it will be used to "
-                   "retrieve user data during the course of the job" );
-
   // Set up to run AthAlgorithmDHUpdate in sysInitialize before
-  // merging depedency lists.  This extends the output dependency
+  // merging dependency lists.  This extends the output dependency
   // list with any symlinks implied by inheritance relations.
   m_updateDataHandles =
     std::make_unique<AthenaBaseComps::AthAlgorithmDHUpdate>
@@ -156,6 +150,33 @@ StatusCode AthAlgorithm::sysInitialize()
   return StatusCode::SUCCESS;
 }
 
+
+/**
+ * @brief Handle START transition.
+ *
+ * We override this in order to make sure that conditions handle keys
+ * can cache a pointer to the conditions container.
+ */
+StatusCode AthAlgorithm::sysStart()
+{
+  ATH_CHECK( Algorithm::sysStart() );
+
+  // Call start() on all input handles.
+  // This allows CondHandleKeys to cache pointers to their conditions containers.
+  // (CondInputLoader makes the containers that it creates during start(),
+  // so initialize() is too early for this.)
+  for (Gaudi::DataHandle* h : inputHandles()) {
+    if (h->isCondition()) {
+      if (SG::VarHandleKey* k = dynamic_cast<SG::VarHandleKey*> (h)) {
+        ATH_CHECK( k->start() );
+      }
+    }
+  }
+  
+  return StatusCode::SUCCESS;
+}
+
+
 void AthAlgorithm::renounceArray( SG::VarHandleKeyArray& vh ) {
   vh.renounce();
 }
diff --git a/Control/AthenaBaseComps/src/AthReentrantAlgorithm.cxx b/Control/AthenaBaseComps/src/AthReentrantAlgorithm.cxx
index c423c0c38962e133087b0b15d0ced09c4dbd35b5..e39d22807c159303f4115058705915e2665b3243 100644
--- a/Control/AthenaBaseComps/src/AthReentrantAlgorithm.cxx
+++ b/Control/AthenaBaseComps/src/AthReentrantAlgorithm.cxx
@@ -33,7 +33,6 @@ AthReentrantAlgorithm::AthReentrantAlgorithm( const std::string& name,
   ::ReEntAlgorithm   ( name, pSvcLocator, version ),
   m_evtStore    ( "StoreGateSvc/StoreGateSvc",  name ),
   m_detStore    ( "StoreGateSvc/DetectorStore", name ),
-  m_userStore   ( "UserDataSvc/UserDataSvc", name ),
   m_varHandleArraysDeclared (false)
 {
   //
@@ -62,11 +61,6 @@ AthReentrantAlgorithm::AthReentrantAlgorithm( const std::string& name,
                    "Handle to a StoreGateSvc/DetectorStore instance: it will be used to "
                    "retrieve data during the course of the job" );
 
-  declareProperty( "UserStore",
-                   m_userStore = UserDataSvc_t ("UserDataSvc/UserDataSvc", name),
-                   "Handle to a UserDataSvc/UserDataSvc instance: it will be used to "
-                   "retrieve user data during the course of the job" );
-
   // Set up to run AthAlgorithmDHUpdate in sysInitialize before
   // merging depedency lists.  This extends the output dependency
   // list with any symlinks implied by inheritance relations.
@@ -175,6 +169,33 @@ StatusCode AthReentrantAlgorithm::sysInitialize()
   return StatusCode::SUCCESS;
 }
 
+
+/**
+ * @brief Handle START transition.
+ *
+ * We override this in order to make sure that conditions handle keys
+ * can cache a pointer to the conditions container.
+ */
+StatusCode AthReentrantAlgorithm::sysStart()
+{
+  ATH_CHECK( ReEntAlgorithm::sysStart() );
+
+  // Call start() on all input handles.
+  // This allows CondHandleKeys to cache pointers to their conditions containers.
+  // (CondInputLoader makes the containers that it creates during start(),
+  // so initialize() is too early for this.)
+  for (Gaudi::DataHandle* h : inputHandles()) {
+    if (h->isCondition()) {
+      if (SG::VarHandleKey* k = dynamic_cast<SG::VarHandleKey*> (h)) {
+        ATH_CHECK( k->start() );
+      }
+    }
+  }
+  
+  return StatusCode::SUCCESS;
+}
+
+
 void AthReentrantAlgorithm::renounceArray( SG::VarHandleKeyArray& vh ) {
   vh.renounce();
 }
diff --git a/Control/AthenaExamples/AthExJobOptions/AthExJobOptions/SomeData.h b/Control/AthenaExamples/AthExJobOptions/AthExJobOptions/SomeData.h
index 466b2a37ad0b45d49663f8f2adcbda74db4f4e3c..c957ef9ca13040e07162d242cfa153edd089eb9c 100755
--- a/Control/AthenaExamples/AthExJobOptions/AthExJobOptions/SomeData.h
+++ b/Control/AthenaExamples/AthExJobOptions/AthExJobOptions/SomeData.h
@@ -7,7 +7,7 @@
 #ifndef ATHEXJOBOPTIONS_SOMEDATA_H
 #define ATHEXJOBOPTIONS_SOMEDATA_H 1
 
-#include "CLIDSvc/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 
 
 /////////////////////////////////////////////////////////////////////////////
diff --git a/Control/AthenaExamples/AthExJobOptions/CMakeLists.txt b/Control/AthenaExamples/AthExJobOptions/CMakeLists.txt
index 729233ece58e4963c55c1a4bca4475ea5a89bb17..52c36308bd90ec832a5138dd50f2f9c153bd8e9d 100644
--- a/Control/AthenaExamples/AthExJobOptions/CMakeLists.txt
+++ b/Control/AthenaExamples/AthExJobOptions/CMakeLists.txt
@@ -9,8 +9,6 @@ atlas_subdir( AthExJobOptions )
 atlas_depends_on_subdirs( PUBLIC
                           Control/AthenaBaseComps
                           Control/AthenaKernel
-                          Control/CLIDSvc
-                          Control/SGTools
                           GaudiKernel
                           PRIVATE
                           AtlasTest/TestTools
@@ -21,7 +19,7 @@ atlas_depends_on_subdirs( PUBLIC
 atlas_add_component( AthExJobOptions
                      src/*.cxx
                      src/components/*.cxx
-                     LINK_LIBRARIES AthenaBaseComps AthenaKernel SGTools GaudiKernel StoreGateLib SGtests EventInfo )
+                     LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel StoreGateLib SGtests EventInfo )
 
 # Install files from the package:
 atlas_install_headers( AthExJobOptions )
diff --git a/Control/AthenaExamples/AthExJobOptions/share/BasicJobOptions.ref b/Control/AthenaExamples/AthExJobOptions/share/BasicJobOptions.ref
index 1b218ebb97965a961fd4f671077982d20e86c0ab..2ca1927d4282cfa903249231f04854837eb76ef0 100644
--- a/Control/AthenaExamples/AthExJobOptions/share/BasicJobOptions.ref
+++ b/Control/AthenaExamples/AthExJobOptions/share/BasicJobOptions.ref
@@ -1,13 +1,13 @@
-Wed Dec  6 20:09:07 CET 2017
+Wed Dec 13 13:37:55 CET 2017
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [AthenaWorkDir-22.0.0] [x86_64-slc6-gcc62-dbg] [atlas-work3/b8b99ab992] -- built on [2017-12-06T1522]
+Py:Athena            INFO using release [AthenaWorkDir-22.0.0] [x86_64-slc6-gcc62-dbg] [atlas-work3/5c32a9a2b2] -- built on [2017-12-13T1129]
 Py:Athena            INFO including file "AthenaCommon/Bootstrap.py"
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "AthExJobOptions/AthExJobOptions_BasicJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5437 configurables from 59 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5439 configurables from 37 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 Py:Athena            INFO Can't set int to string property (this is correct)
 Py:Athena            INFO Can't set non-existing property (this is correct)
@@ -46,7 +46,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 |-StopOverride               = False
 |-TimeOut                    = 0.0
 |-Timeline                   = True
-|-UserStore                  = ServiceHandle('UserDataSvc/UserDataSvc')
 |=/***** Algorithm TopAlgorithm/TopAlgorithm *********************************************************
 | |-AuditAlgorithms            = False
 | |-AuditBeginRun              = False
@@ -85,7 +84,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | |-TheTool                    = PrivateToolHandle('ToolSpace::TemplatedTool<double>/TSTT')
 | |                            (default: 'ToolUsingTool')
 | |-Timeline                   = True
-| |-UserStore                  = ServiceHandle('UserDataSvc/UserDataSvc')
 | |=/***** Private AlgTool ToolSpace::TemplatedTool<double>/TSTT ***************************************
 | | |-AuditFinalize     = False
 | | |-AuditInitialize   = False
@@ -102,7 +100,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | | |-Factor            = 1.0
 | | |-MonitorService    = 'MonitorSvc'
 | | |-OutputLevel       = 2  (default: 0)
-| | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | \----- (End of Private AlgTool ToolSpace::TemplatedTool<double>/TSTT) ------------------------------
 | |=/***** Private AlgTool ConcreteTool/Tool1 **********************************************************
 | | |-AuditFinalize     = False
@@ -120,7 +117,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | | |-Factor            = 1.0
 | | |-MonitorService    = 'MonitorSvc'
 | | |-OutputLevel       = 2  (default: 0)
-| | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | \----- (End of Private AlgTool ConcreteTool/Tool1) -------------------------------------------------
 | |=/***** Private AlgTool ToolUsingTool/Tool2 *********************************************************
 | | |-AuditFinalize     = False
@@ -141,7 +137,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | | |-TheToolPubTool    = PublicToolHandle('ConcreteTool/PublicConcreteTool')
 | | |-TheToolTool       = PrivateToolHandle('ConcreteTool/ConcreteTool')  (default: 'ConcreteTool')
 | | |-TheToolToolArray  = PrivateToolHandleArray(['ConcreteTool/CxxDefaultTool'])
-| | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | |=/***** Private AlgTool ConcreteTool/ConcreteTool ***************************************************
 | | | |-AuditFinalize     = False
 | | | |-AuditInitialize   = False
@@ -158,7 +153,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | | | |-Factor            = 1.0
 | | | |-MonitorService    = 'MonitorSvc'
 | | | |-OutputLevel       = 2  (default: 0)
-| | | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | | \----- (End of Private AlgTool ConcreteTool/ConcreteTool) ------------------------------------------
 | | |=/***** Private AlgTool ConcreteTool/CxxDefaultTool *************************************************
 | | | |-AuditFinalize     = False
@@ -176,7 +170,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | | | |-Factor            = 1.0
 | | | |-MonitorService    = 'MonitorSvc'
 | | | |-OutputLevel       = 2  (default: 0)
-| | | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | | \----- (End of Private AlgTool ConcreteTool/CxxDefaultTool) ----------------------------------------
 | | \----- (End of Private AlgTool ToolUsingTool/Tool2) ------------------------------------------------
 | |=/***** Private AlgTool ToolSpace::TemplatedTool<double>/Tool3 **************************************
@@ -195,7 +188,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | | |-Factor            = 1.0
 | | |-MonitorService    = 'MonitorSvc'
 | | |-OutputLevel       = 2  (default: 0)
-| | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | \----- (End of Private AlgTool ToolSpace::TemplatedTool<double>/Tool3) -----------------------------
 | \----- (End of Algorithm TopAlgorithm/TopAlgorithm) ------------------------------------------------
 |=/***** Algorithm TopAlgorithm/MyAlg ****************************************************************
@@ -237,7 +229,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | |-TheSvc                     = ServiceHandle('QotdSvc')  (default: 'ConcreteSvc')
 | |-TheTool                    = PrivateToolHandle('ToolUsingTool/ToolUsingTool')  (default: 'ToolUsingTool')
 | |-Timeline                   = True
-| |-UserStore                  = ServiceHandle('UserDataSvc/UserDataSvc')
 | |=/***** Private AlgTool ConcreteTool/PyCT1 **********************************************************
 | | |-AuditFinalize     = False
 | | |-AuditInitialize   = False
@@ -254,7 +245,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | | |-Factor            = 1.0
 | | |-MonitorService    = 'MonitorSvc'
 | | |-OutputLevel       = 2  (default: 0)
-| | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | \----- (End of Private AlgTool ConcreteTool/PyCT1) -------------------------------------------------
 | |=/***** Private AlgTool ConcreteTool/PyCT2 **********************************************************
 | | |-AuditFinalize     = False
@@ -272,7 +262,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | | |-Factor            = 1.0
 | | |-MonitorService    = 'MonitorSvc'
 | | |-OutputLevel       = 2  (default: 0)
-| | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | \----- (End of Private AlgTool ConcreteTool/PyCT2) -------------------------------------------------
 | |=/***** Private AlgTool ToolSpace::TemplatedTool<double>/PyTSTT3 ************************************
 | | |-AuditFinalize     = False
@@ -290,7 +279,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | | |-Factor            = 30  (default: 1.0)
 | | |-MonitorService    = 'MonitorSvc'
 | | |-OutputLevel       = 2  (default: 0)
-| | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | \----- (End of Private AlgTool ToolSpace::TemplatedTool<double>/PyTSTT3) ---------------------------
 | |=/***** Private AlgTool ToolSpace::TemplatedTool<double>/PyTSTT4 ************************************
 | | |-AuditFinalize     = False
@@ -308,7 +296,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | | |-Factor            = 40  (default: 1.0)
 | | |-MonitorService    = 'MonitorSvc'
 | | |-OutputLevel       = 2  (default: 0)
-| | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | \----- (End of Private AlgTool ToolSpace::TemplatedTool<double>/PyTSTT4) ---------------------------
 | |=/***** Private AlgTool ToolUsingTool/Special *******************************************************
 | | |-AuditFinalize     = False
@@ -331,7 +318,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | | |                   (default: 'ConcreteTool')
 | | |-TheToolToolArray  = PrivateToolHandleArray(['ConcreteTool/PySpSubTool'])
 | | |                   (default: "['ConcreteTool/CxxDefaultTool']")
-| | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | |=/***** Private AlgTool ConcreteTool/PySpSubTool ****************************************************
 | | | |-AuditFinalize     = False
 | | | |-AuditInitialize   = False
@@ -348,7 +334,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | | | |-Factor            = 3.1415  (default: 1.0)
 | | | |-MonitorService    = 'MonitorSvc'
 | | | |-OutputLevel       = 2  (default: 0)
-| | | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | | \----- (End of Private AlgTool ConcreteTool/PySpSubTool) -------------------------------------------
 | | |=/***** Private AlgTool ToolSpace::TemplatedTool<double>/PyTSTTSp1 **********************************
 | | | |-AuditFinalize     = False
@@ -366,7 +351,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | | | |-Factor            = 6.283  (default: 1.0)
 | | | |-MonitorService    = 'MonitorSvc'
 | | | |-OutputLevel       = 2  (default: 0)
-| | | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | | \----- (End of Private AlgTool ToolSpace::TemplatedTool<double>/PyTSTTSp1) -------------------------
 | | \----- (End of Private AlgTool ToolUsingTool/Special) ----------------------------------------------
 | |=/***** Private AlgTool ToolUsingTool/ToolUsingTool *************************************************
@@ -388,7 +372,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | | |-TheToolPubTool    = PublicToolHandle('ConcreteTool/PublicConcreteTool')
 | | |-TheToolTool       = PrivateToolHandle('ConcreteTool/ConcreteTool')  (default: 'ConcreteTool')
 | | |-TheToolToolArray  = PrivateToolHandleArray(['ConcreteTool/CxxDefaultTool'])
-| | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | |=/***** Private AlgTool ConcreteTool/ConcreteTool ***************************************************
 | | | |-AuditFinalize     = False
 | | | |-AuditInitialize   = False
@@ -405,7 +388,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | | | |-Factor            = 1.0
 | | | |-MonitorService    = 'MonitorSvc'
 | | | |-OutputLevel       = 2  (default: 0)
-| | | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | | \----- (End of Private AlgTool ConcreteTool/ConcreteTool) ------------------------------------------
 | | |=/***** Private AlgTool ConcreteTool/CxxDefaultTool *************************************************
 | | | |-AuditFinalize     = False
@@ -423,7 +405,6 @@ Py:Athena            INFO Can't set non-existing property (this is correct)
 | | | |-Factor            = 1.0
 | | | |-MonitorService    = 'MonitorSvc'
 | | | |-OutputLevel       = 2  (default: 0)
-| | | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | | \----- (End of Private AlgTool ConcreteTool/CxxDefaultTool) ----------------------------------------
 | | \----- (End of Private AlgTool ToolUsingTool/ToolUsingTool) ----------------------------------------
 | \----- (End of Algorithm TopAlgorithm/MyAlg) -------------------------------------------------------
@@ -432,8 +413,8 @@ Py:Athena            INFO including file "AthenaCommon/runbatch.py"
 [?1034hApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r0)
-                                          running on lxplus021.cern.ch on Wed Dec  6 20:09:25 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
+                                          running on lxplus048.cern.ch on Wed Dec 13 13:38:17 2017
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
@@ -441,11 +422,11 @@ ApplicationMgr                     INFO Updating Gaudi::PluginService::SetDebug(
 StatusCodeSvc                      INFO initialize
 AthDictLoaderSvc                   INFO in initialize...
 AthDictLoaderSvc                   INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 2398 CLIDRegistry entries for module ALL
+ClassIDSvc                         INFO  getRegistryEntries: read 2318 CLIDRegistry entries for module ALL
 ChronoStatSvc                      INFO  Number of skipped events for MemStat-1
 CoreDumpSvc                        INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc                        INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
-AthenaEventLoopMgr   INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
+AthenaEventLoopMgr                 INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00
 TopAlgorithm                      DEBUG Property update for OutputLevel : new value = 2
 TopAlgorithm.TSTT                 DEBUG Property update for OutputLevel : new value = 2
 TopAlgorithm                       INFO Retrieved TheTool = PrivateToolHandle('ToolSpace::TemplatedTool<double>/TSTT')
@@ -537,9 +518,9 @@ MyAlg                             DEBUG Data Deps for MyAlg
 HistogramPersistencySvc         WARNING Histograms saving not required.
 ApplicationMgr                     INFO Application Manager Initialized successfully
 ApplicationMgr                     INFO Application Manager Started successfully
-ClassIDSvc           INFO  getRegistryEntries: read 1330 CLIDRegistry entries for module ALL
-AthenaEventLoopMgr   INFO   ===>>>  start of run 1    <<<===
-AthenaEventLoopMgr   INFO   ===>>>  start processing event #1, run #1 0 events processed so far  <<<===
+ClassIDSvc                         INFO  getRegistryEntries: read 1358 CLIDRegistry entries for module ALL
+AthenaEventLoopMgr                 INFO   ===>>>  start of run 1    <<<===
+AthenaEventLoopMgr                 INFO   ===>>>  start processing event #1, run #1 0 events processed so far  <<<===
 TopAlgorithm                       INFO got this quote [Your day will be somewhat dictated by authority].
 TopAlgorithm                      DEBUG no reading requested
 TopAlgorithm                       INFO doing my work ...
@@ -628,8 +609,8 @@ ToolSvc.PyTSTT7                    INFO performing templated task factor ( 1) ..
 ToolSvc.PyTSTT7                    INFO ... templated task is done
 MyAlg                              INFO ... my work is done! 
 MyAlg                             DEBUG wrote data: 1.2957e+59 for key: BBB
-AthenaEventLoopMgr   INFO   ===>>>  done processing event #1, run #1 1 events processed so far  <<<===
-AthenaEventLoopMgr   INFO   ===>>>  start processing event #2, run #1 1 events processed so far  <<<===
+AthenaEventLoopMgr                 INFO   ===>>>  done processing event #1, run #1 1 events processed so far  <<<===
+AthenaEventLoopMgr                 INFO   ===>>>  start processing event #2, run #1 1 events processed so far  <<<===
 TopAlgorithm                       INFO got this quote [Your day will be somewhat dictated by authority].
 TopAlgorithm                      DEBUG no reading requested
 TopAlgorithm                       INFO doing my work ...
@@ -715,7 +696,7 @@ ToolSvc.PyTSTT7                    INFO performing templated task factor ( 1) ..
 ToolSvc.PyTSTT7                    INFO ... templated task is done
 MyAlg                              INFO ... my work is done! 
 MyAlg                             DEBUG wrote data: 1.00913e+59 for key: BBB
-AthenaEventLoopMgr   INFO   ===>>>  done processing event #2, run #1 2 events processed so far  <<<===
+AthenaEventLoopMgr                 INFO   ===>>>  done processing event #2, run #1 2 events processed so far  <<<===
 ApplicationMgr                     INFO Application Manager Stopped successfully
 IncidentProcAlg1                   INFO Finalize
 IncidentProcAlg2                   INFO Finalize
@@ -726,7 +707,7 @@ ToolSvc                            INFO Removing all tools created by ToolSvc
 *****Chrono*****                   INFO ****************************************************************************************************
 *****Chrono*****                   INFO  The Final CPU consumption ( Chrono ) Table (ordered)
 *****Chrono*****                   INFO ****************************************************************************************************
-ChronoStatSvc                      INFO Time User   : Tot=  220 [ms]                                             #=  1
+ChronoStatSvc                      INFO Time User   : Tot=  260 [ms]                                             #=  1
 *****Chrono*****                   INFO ****************************************************************************************************
 ChronoStatSvc.finalize()           INFO  Service finalized successfully 
 ApplicationMgr                     INFO Application Manager Finalized successfully
diff --git a/Control/AthenaExamples/AthExJobOptions/share/CustomToolJobOptions.ref b/Control/AthenaExamples/AthExJobOptions/share/CustomToolJobOptions.ref
index 35c436a81684593804e80b7495e0f58df0c584ae..9a4aad8cc41b4e6b3545285d91654ce2ac360c9e 100644
--- a/Control/AthenaExamples/AthExJobOptions/share/CustomToolJobOptions.ref
+++ b/Control/AthenaExamples/AthExJobOptions/share/CustomToolJobOptions.ref
@@ -1,15 +1,15 @@
-Wed Dec  6 20:16:34 CET 2017
+Wed Dec 13 13:37:55 CET 2017
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [AthenaWorkDir-22.0.0] [x86_64-slc6-gcc62-dbg] [atlas-work3/b8b99ab992] -- built on [2017-12-06T1522]
+Py:Athena            INFO using release [AthenaWorkDir-22.0.0] [x86_64-slc6-gcc62-dbg] [atlas-work3/5c32a9a2b2] -- built on [2017-12-13T1129]
 Py:Athena            INFO including file "AthenaCommon/Bootstrap.py"
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
 Py:Athena            INFO including file "AthenaCommon/Execution.py"
 Py:Athena            INFO including file "AthExJobOptions/AthExJobOptions_CustomToolJobOptions.py"
-Py:ConfigurableDb    INFO Read module info for 5437 configurables from 59 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5439 configurables from 37 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
-{'TheTool': <ToolUsingTool/YourTopAlg.ToolUsingTool at 0x7f69c81ccd10>, 'ErrorMax': '<no value>', 'RndmFactor': '<no value>', 'PublicToolList': PublicToolHandleArray(['ConcreteTool/Tool4','ToolUsingTool/Tool5','ToolSpace::TemplatedTool<double>/Tool6']), 'AuditExecute': '<no value>', 'EmptyPublicTool': PublicToolHandle(''), 'AuditReinitialize': '<no value>', 'EmptyPrivateTool': PrivateToolHandle(''), 'InputKey': '<no value>', 'AuditRestart': '<no value>', 'OutputKey': '<no value>', 'MonitorService': '<no value>', 'Enable': '<no value>', 'Timeline': '<no value>', 'UserStore': ServiceHandle('UserDataSvc/UserDataSvc'), 'AuditFinalize': '<no value>', 'PrivateToolList': PrivateToolHandleArray(['ConcreteTool/Tool1','ToolUsingTool/Tool2','ToolSpace::TemplatedTool<double>/Tool3']), 'AuditEndRun': '<no value>', 'NeededResources': [], 'AuditBeginRun': '<no value>', 'AutoRetrieveTools': '<no value>', 'FilterCircularDependencies': '<no value>', 'ExtraOutputs': [], 'IsIOBound': '<no value>', 'AuditInitialize': '<no value>', 'OutputLevel': '<no value>', 'ExtraInputs': [], 'AuditStop': '<no value>', 'DetStore': ServiceHandle('StoreGateSvc/DetectorStore'), 'TheSvc': ServiceHandle('ConcreteSvc'), 'Cardinality': '<no value>', 'EvtStore': ServiceHandle('StoreGateSvc'), 'AuditStart': '<no value>', 'RegisterForContextService': '<no value>', 'AuditAlgorithms': '<no value>', 'ThePublicTool': PublicToolHandle('ConcreteTool'), 'ErrorCounter': '<no value>'}
+{'TheTool': <ToolUsingTool/YourTopAlg.ToolUsingTool at 0x7f4ff0064470>, 'ErrorMax': '<no value>', 'RndmFactor': '<no value>', 'PublicToolList': PublicToolHandleArray(['ConcreteTool/Tool4','ToolUsingTool/Tool5','ToolSpace::TemplatedTool<double>/Tool6']), 'AuditExecute': '<no value>', 'EmptyPublicTool': PublicToolHandle(''), 'AuditReinitialize': '<no value>', 'EmptyPrivateTool': PrivateToolHandle(''), 'InputKey': '<no value>', 'AuditRestart': '<no value>', 'OutputKey': '<no value>', 'MonitorService': '<no value>', 'Enable': '<no value>', 'Timeline': '<no value>', 'AuditFinalize': '<no value>', 'PrivateToolList': PrivateToolHandleArray(['ConcreteTool/Tool1','ToolUsingTool/Tool2','ToolSpace::TemplatedTool<double>/Tool3']), 'AuditEndRun': '<no value>', 'NeededResources': [], 'AuditBeginRun': '<no value>', 'AutoRetrieveTools': '<no value>', 'FilterCircularDependencies': '<no value>', 'ExtraOutputs': [], 'IsIOBound': '<no value>', 'AuditInitialize': '<no value>', 'OutputLevel': '<no value>', 'ExtraInputs': [], 'AuditStop': '<no value>', 'DetStore': ServiceHandle('StoreGateSvc/DetectorStore'), 'TheSvc': ServiceHandle('ConcreteSvc'), 'Cardinality': '<no value>', 'EvtStore': ServiceHandle('StoreGateSvc'), 'AuditStart': '<no value>', 'RegisterForContextService': '<no value>', 'AuditAlgorithms': '<no value>', 'ThePublicTool': PublicToolHandle('ConcreteTool'), 'ErrorCounter': '<no value>'}
 /***** Algorithm AthSequencer/TopAlg ***************************************************************
 |-Atomic                     = False
 |-AuditAlgorithms            = False
@@ -45,7 +45,6 @@ Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 |-StopOverride               = False
 |-TimeOut                    = 0.0
 |-Timeline                   = True
-|-UserStore                  = ServiceHandle('UserDataSvc/UserDataSvc')
 |=/***** Algorithm TopAlgorithm/MyTopAlg *************************************************************
 | |-AuditAlgorithms            = False
 | |-AuditBeginRun              = False
@@ -83,7 +82,6 @@ Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 | |-TheSvc                     = ServiceHandle('ConcreteSvc')
 | |-TheTool                    = PrivateToolHandle('ToolUsingTool/CustomTool')  (default: 'ToolUsingTool')
 | |-Timeline                   = True
-| |-UserStore                  = ServiceHandle('UserDataSvc/UserDataSvc')
 | |=/***** Private AlgTool ToolUsingTool/CustomTool ****************************************************
 | | |-AuditFinalize     = False
 | | |-AuditInitialize   = False
@@ -103,7 +101,6 @@ Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 | | |-TheToolPubTool    = PublicToolHandle('ConcreteTool/PublicConcreteTool')
 | | |-TheToolTool       = PrivateToolHandle('ConcreteTool/ToolTool')
 | | |-TheToolToolArray  = PrivateToolHandleArray(['ConcreteTool/CxxDefaultTool'])
-| | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | |=/***** Private AlgTool ConcreteTool/CxxDefaultTool *************************************************
 | | | |-AuditFinalize     = False
 | | | |-AuditInitialize   = False
@@ -120,7 +117,6 @@ Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 | | | |-Factor            = 1.0
 | | | |-MonitorService    = 'MonitorSvc'
 | | | |-OutputLevel       = 0
-| | | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | | \----- (End of Private AlgTool ConcreteTool/CxxDefaultTool) ----------------------------------------
 | | |=/***** Private AlgTool ConcreteTool/ToolTool *******************************************************
 | | | |-AuditFinalize     = False
@@ -138,7 +134,6 @@ Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 | | | |-Factor            = 1.0
 | | | |-MonitorService    = 'MonitorSvc'
 | | | |-OutputLevel       = 0
-| | | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | | \----- (End of Private AlgTool ConcreteTool/ToolTool) ----------------------------------------------
 | | \----- (End of Private AlgTool ToolUsingTool/CustomTool) -------------------------------------------
 | \----- (End of Algorithm TopAlgorithm/MyTopAlg) ----------------------------------------------------
@@ -179,7 +174,6 @@ Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 | |-TheSvc                     = ServiceHandle('ConcreteSvc')
 | |-TheTool                    = PrivateToolHandle('ToolUsingTool/CustomTool2')  (default: 'ToolUsingTool')
 | |-Timeline                   = True
-| |-UserStore                  = ServiceHandle('UserDataSvc/UserDataSvc')
 | |=/***** Private AlgTool ToolUsingTool/CustomTool2 ***************************************************
 | | |-AuditFinalize     = False
 | | |-AuditInitialize   = False
@@ -199,7 +193,6 @@ Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 | | |-TheToolPubTool    = PublicToolHandle('ConcreteTool/PublicConcreteTool')
 | | |-TheToolTool       = PrivateToolHandle('ConcreteTool/ToolTool')  (default: 'ConcreteTool')
 | | |-TheToolToolArray  = PrivateToolHandleArray(['ConcreteTool/CxxDefaultTool'])
-| | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | |=/***** Private AlgTool ConcreteTool/CxxDefaultTool *************************************************
 | | | |-AuditFinalize     = False
 | | | |-AuditInitialize   = False
@@ -216,7 +209,6 @@ Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 | | | |-Factor            = 1.0
 | | | |-MonitorService    = 'MonitorSvc'
 | | | |-OutputLevel       = 0
-| | | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | | \----- (End of Private AlgTool ConcreteTool/CxxDefaultTool) ----------------------------------------
 | | |=/***** Private AlgTool ConcreteTool/ToolTool *******************************************************
 | | | |-AuditFinalize     = False
@@ -234,7 +226,6 @@ Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 | | | |-Factor            = 1.0
 | | | |-MonitorService    = 'MonitorSvc'
 | | | |-OutputLevel       = 0
-| | | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | | \----- (End of Private AlgTool ConcreteTool/ToolTool) ----------------------------------------------
 | | \----- (End of Private AlgTool ToolUsingTool/CustomTool2) ------------------------------------------
 | |=/***** Private AlgTool ConcreteTool/Tool1 **********************************************************
@@ -253,7 +244,6 @@ Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 | | |-Factor            = 1.0
 | | |-MonitorService    = 'MonitorSvc'
 | | |-OutputLevel       = 0
-| | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | \----- (End of Private AlgTool ConcreteTool/Tool1) -------------------------------------------------
 | |=/***** Private AlgTool ToolUsingTool/Tool2 *********************************************************
 | | |-AuditFinalize     = False
@@ -274,7 +264,6 @@ Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 | | |-TheToolPubTool    = PublicToolHandle('ConcreteTool/PublicConcreteTool')
 | | |-TheToolTool       = PrivateToolHandle('ConcreteTool/ConcreteTool')  (default: 'ConcreteTool')
 | | |-TheToolToolArray  = PrivateToolHandleArray(['ConcreteTool/CxxDefaultTool'])
-| | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | |=/***** Private AlgTool ConcreteTool/ConcreteTool ***************************************************
 | | | |-AuditFinalize     = False
 | | | |-AuditInitialize   = False
@@ -291,7 +280,6 @@ Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 | | | |-Factor            = 1.0
 | | | |-MonitorService    = 'MonitorSvc'
 | | | |-OutputLevel       = 0
-| | | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | | \----- (End of Private AlgTool ConcreteTool/ConcreteTool) ------------------------------------------
 | | |=/***** Private AlgTool ConcreteTool/CxxDefaultTool *************************************************
 | | | |-AuditFinalize     = False
@@ -309,7 +297,6 @@ Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 | | | |-Factor            = 1.0
 | | | |-MonitorService    = 'MonitorSvc'
 | | | |-OutputLevel       = 0
-| | | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | | \----- (End of Private AlgTool ConcreteTool/CxxDefaultTool) ----------------------------------------
 | | \----- (End of Private AlgTool ToolUsingTool/Tool2) ------------------------------------------------
 | |=/***** Private AlgTool ToolSpace::TemplatedTool<double>/Tool3 **************************************
@@ -328,7 +315,6 @@ Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 | | |-Factor            = 1.0
 | | |-MonitorService    = 'MonitorSvc'
 | | |-OutputLevel       = 0
-| | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | \----- (End of Private AlgTool ToolSpace::TemplatedTool<double>/Tool3) -----------------------------
 | \----- (End of Algorithm TopAlgorithm/YourTopAlg) --------------------------------------------------
 \----- (End of Algorithm AthSequencer/TopAlg) ------------------------------------------------------
@@ -336,8 +322,8 @@ Py:Athena            INFO including file "AthenaCommon/runbatch.py"
 [?1034hApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r0)
-                                          running on lxplus021.cern.ch on Wed Dec  6 20:16:51 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
+                                          running on lxplus048.cern.ch on Wed Dec 13 13:38:17 2017
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
@@ -345,7 +331,7 @@ ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to leve
 StatusCodeSvc        INFO initialize
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 2398 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 2318 CLIDRegistry entries for module ALL
 ChronoStatSvc        INFO  Number of skipped events for MemStat-1
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
@@ -382,7 +368,7 @@ YourTopAlg           INFO Empty public tool is empty (OK)
 HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr       INFO Application Manager Started successfully
-ClassIDSvc           INFO  getRegistryEntries: read 1330 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1358 CLIDRegistry entries for module ALL
 AthenaEventLoopMgr   INFO   ===>>>  start of run 1    <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #1, run #1 0 events processed so far  <<<===
 MyTopAlg             INFO got this quote [Your day will be somewhat dictated by authority].
@@ -540,7 +526,7 @@ ToolSvc              INFO Removing all tools created by ToolSvc
 *****Chrono*****     INFO ****************************************************************************************************
 *****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
 *****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc        INFO Time User   : Tot=  190 [ms]                                             #=  1
+ChronoStatSvc        INFO Time User   : Tot=  280 [ms]                                             #=  1
 *****Chrono*****     INFO ****************************************************************************************************
 ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
diff --git a/Control/AthenaExamples/AthExJobOptions/share/CustomTopAlgorithmJobOptions.ref b/Control/AthenaExamples/AthExJobOptions/share/CustomTopAlgorithmJobOptions.ref
index eab831e43a500423f33eaede2f447f15d2b8d14b..329e51fd2bbd9f6d07adef67fbd2f82c5f727711 100644
--- a/Control/AthenaExamples/AthExJobOptions/share/CustomTopAlgorithmJobOptions.ref
+++ b/Control/AthenaExamples/AthExJobOptions/share/CustomTopAlgorithmJobOptions.ref
@@ -1,7 +1,7 @@
-Wed Dec  6 20:23:10 CET 2017
+Wed Dec 13 13:37:55 CET 2017
 Preloading tcmalloc_minimal.so
 Py:Athena            INFO including file "AthenaCommon/Preparation.py"
-Py:Athena            INFO using release [AthenaWorkDir-22.0.0] [x86_64-slc6-gcc62-dbg] [atlas-work3/b8b99ab992] -- built on [2017-12-06T1522]
+Py:Athena            INFO using release [AthenaWorkDir-22.0.0] [x86_64-slc6-gcc62-dbg] [atlas-work3/5c32a9a2b2] -- built on [2017-12-13T1129]
 Py:Athena            INFO including file "AthenaCommon/Bootstrap.py"
 Py:Athena            INFO including file "AthenaCommon/Atlas.UnixStandardJob.py"
 Py:Athena            INFO executing ROOT6Setup
@@ -42,7 +42,6 @@ Py:Athena            INFO including file "AthExJobOptions/AthExJobOptions_Custom
 |-StopOverride               = False
 |-TimeOut                    = 0.0
 |-Timeline                   = True
-|-UserStore                  = ServiceHandle('UserDataSvc/UserDataSvc')
 |=/***** Algorithm TopAlgorithm/MyCustomAlg **********************************************************
 | |-AuditAlgorithms            = False
 | |-AuditBeginRun              = False
@@ -80,7 +79,6 @@ Py:Athena            INFO including file "AthExJobOptions/AthExJobOptions_Custom
 | |-TheSvc                     = ServiceHandle('ConcreteSvc')
 | |-TheTool                    = PrivateToolHandle('ConcreteTool/ConcreteTool')
 | |-Timeline                   = True
-| |-UserStore                  = ServiceHandle('UserDataSvc/UserDataSvc')
 | |=/***** Private AlgTool ConcreteTool/ConcreteTool ***************************************************
 | | |-AuditFinalize     = False
 | | |-AuditInitialize   = False
@@ -97,18 +95,17 @@ Py:Athena            INFO including file "AthExJobOptions/AthExJobOptions_Custom
 | | |-Factor            = 1.0
 | | |-MonitorService    = 'MonitorSvc'
 | | |-OutputLevel       = 0
-| | |-UserStore         = ServiceHandle('UserDataSvc/UserDataSvc')
 | | \----- (End of Private AlgTool ConcreteTool/ConcreteTool) ------------------------------------------
 | \----- (End of Algorithm TopAlgorithm/MyCustomAlg) -------------------------------------------------
 \----- (End of Algorithm AthSequencer/TopAlg) ------------------------------------------------------
 Py:Athena            INFO including file "AthenaCommon/runbatch.py"
-Py:ConfigurableDb    INFO Read module info for 5437 configurables from 59 genConfDb files
+Py:ConfigurableDb    INFO Read module info for 5439 configurables from 37 genConfDb files
 Py:ConfigurableDb    INFO No duplicates have been found: that's good !
 [?1034hApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r0)
-                                          running on lxplus021.cern.ch on Wed Dec  6 20:23:31 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
+                                          running on lxplus048.cern.ch on Wed Dec 13 13:38:18 2017
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
@@ -116,7 +113,7 @@ ApplicationMgr       INFO Updating Gaudi::PluginService::SetDebug(level) to leve
 StatusCodeSvc        INFO initialize
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-ClassIDSvc           INFO  getRegistryEntries: read 2398 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 2318 CLIDRegistry entries for module ALL
 ChronoStatSvc        INFO  Number of skipped events for MemStat-1
 CoreDumpSvc          INFO install f-a-t-a-l handler... (flag = -1)
 CoreDumpSvc          INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) 
@@ -138,7 +135,7 @@ MyCustomAlg          INFO Empty public tool is empty (OK)
 HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr       INFO Application Manager Started successfully
-ClassIDSvc           INFO  getRegistryEntries: read 1330 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1358 CLIDRegistry entries for module ALL
 AthenaEventLoopMgr   INFO   ===>>>  start of run 1    <<<===
 AthenaEventLoopMgr   INFO   ===>>>  start processing event #1, run #1 0 events processed so far  <<<===
 MyCustomAlg          INFO got this quote [Your day will be somewhat dictated by authority].
@@ -214,7 +211,7 @@ ToolSvc              INFO Removing all tools created by ToolSvc
 *****Chrono*****     INFO ****************************************************************************************************
 *****Chrono*****     INFO  The Final CPU consumption ( Chrono ) Table (ordered)
 *****Chrono*****     INFO ****************************************************************************************************
-ChronoStatSvc        INFO Time User   : Tot=  250 [ms]                                             #=  1
+ChronoStatSvc        INFO Time User   : Tot=  270 [ms]                                             #=  1
 *****Chrono*****     INFO ****************************************************************************************************
 ChronoStatSvc.f...   INFO  Service finalized successfully 
 ApplicationMgr       INFO Application Manager Finalized successfully
diff --git a/Control/AthenaKernel/AthenaKernel/BaseInfo.h b/Control/AthenaKernel/AthenaKernel/BaseInfo.h
index 2d7bb8270758caaf1d07a893b296c63e52b01594..ace7008f6e9420687f12aec247dc841ba9b2c467 100755
--- a/Control/AthenaKernel/AthenaKernel/BaseInfo.h
+++ b/Control/AthenaKernel/AthenaKernel/BaseInfo.h
@@ -680,7 +680,7 @@ public:
 
 
   /// Type for an initialization function.
-  typedef const BaseInfoBase& init_func_t();
+  typedef void init_func_t (BaseInfoBase* bib);
 
 
 #ifndef __REFLEX__
@@ -725,16 +725,6 @@ private:
   static BaseInfoBase* find1 (const std::type_info& tinfo);
 
 
-  /**
-   * @brief Find the @c BaseInfoBase instance for @c tinfo.
-   * @param tinfo The @c std::type_info of the class
-   *              for which we want information.
-   *
-   * Returns 0 if no @c BaseInfoBase instance is available.
-   */
-  static BaseInfoBase* find_nc (const std::type_info& tinfo);
-
-
   /// Pointer to internal state.
   BaseInfoBaseImpl* m_impl;
 
diff --git a/Control/AthenaKernel/AthenaKernel/BaseInfo.icc b/Control/AthenaKernel/AthenaKernel/BaseInfo.icc
index 9e8bdfad6c121cbae84c355d438d26890cd855e0..3dd5f2108f359602c0e1a57874ce64b2657af3a9 100755
--- a/Control/AthenaKernel/AthenaKernel/BaseInfo.icc
+++ b/Control/AthenaKernel/AthenaKernel/BaseInfo.icc
@@ -517,7 +517,8 @@ struct RegisterBaseInit
 template <class T>
 RegisterBaseInit<T>::RegisterBaseInit()
 {
-  BaseInfoBase::addInit(&typeid(T), BaseInfo<T>::baseinfo);
+  BaseInfoBase::addInit(&typeid(T),
+                        [] (BaseInfoBase*) { BaseInfo<T>::baseinfo(); });
 }
 #endif
 
@@ -547,7 +548,7 @@ struct RegisterAddBaseInit
   RegisterAddBaseInit();
 
   /// Init callback: add the new base to the BIB.
-  static const BaseInfoBase& doinit();
+  static void doinit (BaseInfoBase* bib);
 };
 
 
@@ -556,7 +557,7 @@ struct RegisterAddBaseInit
  * @brief Init callback: add the new base to the BIB.
  */
 template <class D, class B>
-const BaseInfoBase& RegisterAddBaseInit<D, B>::doinit()
+void RegisterAddBaseInit<D, B>::doinit (BaseInfoBase* bib)
 {
   // B may either be the actual base class we want,
   // or Virtual<BB>. Unwrap a surrounding Virtual<> if needed.
@@ -564,7 +565,6 @@ const BaseInfoBase& RegisterAddBaseInit<D, B>::doinit()
   bool is_virtual = BaseType<B>::is_virtual::value;
 
   // Look up the BIB.
-  SG::BaseInfoBase* bib = SG::BaseInfoBase::find_nc (typeid(D));
   if (!bib)
     bib = &BaseInfo<D>::instance();
   if (bib) {
@@ -572,7 +572,6 @@ const BaseInfoBase& RegisterAddBaseInit<D, B>::doinit()
     SG::BaseInfoImpl<D>& impl = *static_cast<SG::BaseInfoImpl<D>*> (bib);
     impl.template add_base<base_type> (is_virtual);
   }
-  return *bib;
 }
 
 
@@ -610,7 +609,7 @@ struct RegisterAddCopyConversionInit
   RegisterAddCopyConversionInit();
 
   /// Init callback: xxx
-  static const BaseInfoBase& doinit();
+  static void doinit (BaseInfoBase* bib);
 };
 
 
@@ -619,10 +618,9 @@ struct RegisterAddCopyConversionInit
  * @brief Init callback: add the new conversion to the BIB.
  */
 template <class T, class C>
-const BaseInfoBase& RegisterAddCopyConversionInit<T, C>::doinit()
+void RegisterAddCopyConversionInit<T, C>::doinit (BaseInfoBase* bib)
 {
   // Look up the BIB.
-  SG::BaseInfoBase* bib = SG::BaseInfoBase::find_nc (typeid(T));
   if (!bib)
     bib = &BaseInfo<T>::instance();
   if (bib) {
@@ -630,7 +628,6 @@ const BaseInfoBase& RegisterAddCopyConversionInit<T, C>::doinit()
     bib->add_copy_conversion (typeid(target_type),
                               new C);
   }
-  return *bib;
 }
 
 
diff --git a/Control/AthenaKernel/AthenaKernel/errorcheck.h b/Control/AthenaKernel/AthenaKernel/errorcheck.h
index 1a779e27ed5a08804aad75160e0aff62ce76dd63..63ea7a88973d921d4ffaa8e452c60a3e3b4b7ddf 100644
--- a/Control/AthenaKernel/AthenaKernel/errorcheck.h
+++ b/Control/AthenaKernel/AthenaKernel/errorcheck.h
@@ -389,13 +389,13 @@ private:
     BOOST_PP_OVERLOAD(CHECK_WITH_CONTEXT_, __VA_ARGS__)(__VA_ARGS__)
 
 #define CHECK_WITH_CONTEXT_2(EXP, CONTEXT_NAME) do {       \
-    StatusCode sc__ = (EXP);                               \
+    StatusCode sc__(EXP);                                  \
     if (! sc__.isSuccess())                                \
       CHECK_FAILED(EXP, CONTEXT_NAME, sc__, sc__);         \
   } while (0)
 
 #define CHECK_WITH_CONTEXT_3(EXP, CONTEXT_NAME, RET) do {  \
-    StatusCode sc__ = (EXP);                               \
+    StatusCode sc__(EXP);                                  \
     if (! sc__.isSuccess())                                \
       CHECK_FAILED(EXP, CONTEXT_NAME, sc__, RET);          \
   } while (0)
diff --git a/Control/AthenaKernel/share/SlotSpecificObj_test.ref b/Control/AthenaKernel/share/SlotSpecificObj_test.ref
index a04ce915b991d2f5aa2088e974ce61caa32278ba..9918982fc78f2653254b9a802bc116c1a75eb402 100644
--- a/Control/AthenaKernel/share/SlotSpecificObj_test.ref
+++ b/Control/AthenaKernel/share/SlotSpecificObj_test.ref
@@ -1,20 +1,17 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/SlotSpecificObj_test.txt
-JobOptionsSvc        INFO # =======> /home/leggett/bld2/work/cmsg/src/Control/AthenaKernel/share/../share/SlotSpecificObj_test.txt
+JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/Control/AthenaKernel/share/../share/SlotSpecificObj_test.txt
 JobOptionsSvc        INFO # (1,1): MessageSvc.OutputLevel = 2
 JobOptionsSvc        INFO Job options successfully read in from ../share/SlotSpecificObj_test.txt
-MessageSvc          DEBUG Service base class initialized successfully
 ApplicationMgr      DEBUG Getting my own properties
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r1)
-                                          running on zeus on Thu Nov  9 09:47:34 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
+                                          running on lxplus020.cern.ch on Mon Dec 11 13:14:37 2017
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
-ServiceManager      DEBUG Initializing service AppMgrRunable
 AppMgrRunable       DEBUG Service base class initialized successfully
-ServiceManager      DEBUG Initializing service EventLoopMgr
 EventLoopMgr        DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0
diff --git a/Control/AthenaKernel/src/BaseInfo.cxx b/Control/AthenaKernel/src/BaseInfo.cxx
index d284090d8573614682675c32e76e619e19bb70db..ea3e1ca6b7da1cb3d612d4b59fa851878df21a4c 100755
--- a/Control/AthenaKernel/src/BaseInfo.cxx
+++ b/Control/AthenaKernel/src/BaseInfo.cxx
@@ -606,7 +606,7 @@ BaseInfoBase* BaseInfoBase::find1 (const std::type_info& tinfo)
       init = it->second;
       BaseInfoBaseImpl::s_init_list->erase (it);
     }
-    init();
+    init (bib);
   }
 
   return bib;
@@ -620,7 +620,7 @@ BaseInfoBase* BaseInfoBase::find1 (const std::type_info& tinfo)
  *
  * Returns 0 if no @c BaseInfoBase instance is available.
  */
-BaseInfoBase* BaseInfoBase::find_nc (const std::type_info& tinfo)
+const BaseInfoBase* BaseInfoBase::find (const std::type_info& tinfo)
 {
   BaseInfoBase* bib = find1 (tinfo);
 
@@ -655,19 +655,6 @@ BaseInfoBase* BaseInfoBase::find_nc (const std::type_info& tinfo)
 }
 
 
-/**
- * @brief Find the @c BaseInfoBase instance for @c tinfo.
- * @param tinfo The @c std::type_info of the class
- *              for which we want information.
- *
- * Returns 0 if no @c BaseInfoBase instance is available.
- */
-const BaseInfoBase* BaseInfoBase::find (const std::type_info& tinfo)
-{
-  return find_nc (tinfo);
-}
-
-
 /**
  * @brief Register an initialization function.
  * @param tinfo The @c std::type_info for the class being registered.
diff --git a/Control/AthenaMonitoring/src/DQFilledBunchFilterTool.cxx b/Control/AthenaMonitoring/src/DQFilledBunchFilterTool.cxx
index e3033b075757186611fca6eba7413d8e13edaa9d..35fc4f132eea9189b092564959b096385df11cee 100644
--- a/Control/AthenaMonitoring/src/DQFilledBunchFilterTool.cxx
+++ b/Control/AthenaMonitoring/src/DQFilledBunchFilterTool.cxx
@@ -36,7 +36,7 @@ bool DQFilledBunchFilterTool::accept() const {
     return true;
   } else {
     const EventInfo* eventInfo(0);
-    CHECK( evtStore()->retrieve( eventInfo ) );
+    CHECK( evtStore()->retrieve( eventInfo ), false );
     
     EventID::number_type bcid = eventInfo->event_ID()->bunch_crossing_id();  
     bool value = m_bunchtool->isFilled(bcid) ^ m_invert;
diff --git a/Control/AthenaServices/share/AthenaOutputStream_test.ref b/Control/AthenaServices/share/AthenaOutputStream_test.ref
index 7639af6cff8d88056af5808afe587e89aec731bb..861a889344fd21aff8ef641aec2fbe577a3a02fc 100644
--- a/Control/AthenaServices/share/AthenaOutputStream_test.ref
+++ b/Control/AthenaServices/share/AthenaOutputStream_test.ref
@@ -2,24 +2,21 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/AthenaOutputStream_test.txt
-JobOptionsSvc        INFO # =======> /home/leggett/work/v30r0.msg/src/Control/AthenaServices/share/../share/AthenaOutputStream_test.txt
+JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/Control/AthenaServices/share/../share/AthenaOutputStream_test.txt
 JobOptionsSvc        INFO # (5,1): MessageSvc.OutputLevel = 2
 JobOptionsSvc        INFO # (6,1): StoreGateSvc.OutputLevel = 2
 JobOptionsSvc        INFO # (8,1): AthenaOutputStream.OutputLevel = 1
 JobOptionsSvc        INFO # (10,1): AthenaOutputStream.ItemList = ["Bar#uno", "Bar#due", "Bar#tre", "8101#*", "Fee#quattro", "Fee!#cinque", "13#*"]
 JobOptionsSvc        INFO # (15,1): AthenaOutputStream.AcceptAlgs = ["AthenaOutputStream", "aSFQS"]
 JobOptionsSvc        INFO Job options successfully read in from ../share/AthenaOutputStream_test.txt
-MessageSvc          DEBUG Service base class initialized successfully
 ApplicationMgr      DEBUG Getting my own properties
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r0)
-                                          running on zeus.lbl.gov on Fri Dec  1 12:14:33 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
+                                          running on lxplus020.cern.ch on Mon Dec 11 13:15:32 2017
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
-ServiceManager      DEBUG Initializing service AppMgrRunable
 AppMgrRunable       DEBUG Service base class initialized successfully
-ServiceManager      DEBUG Initializing service EventLoopMgr
 EventLoopMgr        DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0
@@ -35,7 +32,9 @@ ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr Ready
 ClassIDSvc          DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [ModuleLoaded] listener 'ClassIDSvc' with priority 100
-ClassIDSvc           INFO  getRegistryEntries: read 917 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 919 CLIDRegistry entries for module ALL
+ClassIDSvc          DEBUG processCLIDDB: read 1485 entries from CLIDDB file: /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-opt/x86_64-slc6-gcc62-opt/share/clid.db
+ClassIDSvc          DEBUG processCLIDDB: read 1485 entries from CLIDDB file: /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2017-12-10T2303/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-opt/share/clid.db
 StoreGateSvc        DEBUG Service base class initialized successfully
 StoreGateSvc        DEBUG trying to create store SGImplSvc/StoreGateSvc_Impl
 StoreGateSvc_Impl   DEBUG Service base class initialized successfully
@@ -71,9 +70,7 @@ MetaDataStore_Impl  DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [EndEvent] listener 'MetaDataStore' with priority 100
 IncidentSvc         DEBUG Adding [BeginEvent] listener 'MetaDataStore' with priority 100
 AthenaPoolCnvSvc     INFO Initializing AthenaPoolCnvSvc - package version AthenaPoolCnvSvc-00-00-00
-DataModelCompatSvc  DEBUG Property update for OutputLevel : new value = -777138672
 DataModelCompatSvc  DEBUG FILE:LINE (StatusCode DataModelCompatSvc::initialize()): running
-DataModelCompatSvcVERBOSE ServiceLocatorHelper::service: found service IncidentSvc
 IncidentSvc         DEBUG Adding [BeginEvent] listener 'DataModelCompatSvc' with priority 0
 IoComponentMgr      DEBUG --> initialize()
 IoComponentMgr      DEBUG Service base class initialized successfully
@@ -86,12 +83,19 @@ IoComponentMgr      DEBUG --> io_hasitem()
 PoolSvc              INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok]
 PoolSvc              INFO Set connectionsvc retry/timeout/IDLE timeout to  'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled
 PoolSvc              INFO Frontier compression level set to 5
-DBReplicaSvc        DEBUG HOSTNAME zeus has no domain - try hostname --fqdn
-DBReplicaSvc        DEBUG HOSTNAME from fqdn: zeus.lbl.gov
-DBReplicaSvc         INFO Frontier server at (serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(proxyurl=http://msquid01-ib.nersc.gov:3128)(proxyurl=http://msquid02-ib.nersc.gov:3128) will be considered for COOL data
-DBReplicaSvc         INFO Read replica configuration from /bld1/leggett/build/v30r0.msg/build/install/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-dbg/share/dbreplica.config
-DBReplicaSvc        DEBUG Candidate server ATLF (priority -2300)
-DBReplicaSvc         INFO Total of 1 servers found for host zeus.lbl.gov [ATLF ]
+DBReplicaSvc         INFO Frontier server at (serverurl=http://atlasfrontier-local.cern.ch:8000/atlr)(serverurl=http://atlasfrontier-ai.cern.ch:8000/atlr)(serverurl=http://lcgft-atlas.gridpp.rl.ac.uk:3128/frontierATLAS)(serverurl=http://ccfrontier.in2p3.fr:23128/ccin2p3-AtlasFrontier)(proxyurl=http://ca-proxy.cern.ch:3128)(proxyurl=http://ca-proxy-meyrin.cern.ch:3128)(proxyurl=http://ca-proxy-wigner.cern.ch:3128) will be considered for COOL data
+DBReplicaSvc         INFO Read replica configuration from /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2017-12-10T2303/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-opt/share/dbreplica.config
+DBReplicaSvc        DEBUG Candidate server ATLF (priority -2700)
+DBReplicaSvc        DEBUG Candidate server ATLAS_COOLPROD (priority -695)
+DBReplicaSvc        DEBUG Candidate server atlas_dd (priority -690)
+DBReplicaSvc        DEBUG Candidate server ATLAS_CONFIG (priority -685)
+DBReplicaSvc        DEBUG Candidate server INT8R (priority -680)
+DBReplicaSvc        DEBUG Candidate server INTR (priority -675)
+DBReplicaSvc        DEBUG Candidate server ATONR_COOL (priority -670)
+DBReplicaSvc        DEBUG Candidate server ATONR_CONF (priority -665)
+DBReplicaSvc        DEBUG Candidate server DEVDB11 (priority -660)
+DBReplicaSvc        DEBUG Candidate server ATLF (priority -2200)
+DBReplicaSvc         INFO Total of 10 servers found for host lxplus020.cern.ch [ATLF ATLAS_COOLPROD atlas_dd ATLAS_CONFIG INT8R INTR ATONR_COOL ATONR_CONF DEVDB11 ATLF ]
 PoolSvc              INFO Successfully setup replica sorting algorithm
 PoolSvc             DEBUG OutputLevel is 
 PoolSvc              INFO Setting up APR FileCatalog and Streams
@@ -137,23 +141,23 @@ AthenaOutputStream  DEBUG Registering all Tools in ToolHandleArray HelperTools
 AthenaOutputStream  DEBUG Adding private ToolHandle tool AthenaOutputStream.AthenaOutputStreamTool (AthenaOutputStreamTool)
 AthenaOutputStream  DEBUG Data Deps for AthenaOutputStream
 ClassIDSvc           INFO  getRegistryEntries: read 929 CLIDRegistry entries for module ALL
-StoreGateSvc_Impl   DEBUG Recorded object @0x3737610 with key uno of type Foo(CLID 8101)
- in DataObject @0x3737550
+StoreGateSvc_Impl   DEBUG Recorded object @0x3598c60 with key uno of type Foo(CLID 8101)
+ in DataObject @0x3598ca0
  object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x2bdb430 with key due of type Foo(CLID 8101)
- in DataObject @0x37d19d0
+StoreGateSvc_Impl   DEBUG Recorded object @0x2a0f0d0 with key due of type Foo(CLID 8101)
+ in DataObject @0x29e36c0
  object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x2c1e1e0 with key uno of type Bar(CLID 8107)
- in DataObject @0x37d20e0
+StoreGateSvc_Impl   DEBUG Recorded object @0x2a67f30 with key uno of type Bar(CLID 8107)
+ in DataObject @0x3632b70
  object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x37d1760 with key due of type Bar(CLID 8107)
- in DataObject @0x2c36d30
+StoreGateSvc_Impl   DEBUG Recorded object @0x2bec7a0 with key due of type Bar(CLID 8107)
+ in DataObject @0x2a820f0
  object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x37367c0 with key quattro of type Bar(CLID 8107)
- in DataObject @0x3737060
+StoreGateSvc_Impl   DEBUG Recorded object @0x2a0c9b0 with key quattro of type Bar(CLID 8107)
+ in DataObject @0x35983e0
  object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x3737e00 with key cinque of type Bar(CLID 8107)
- in DataObject @0x37383f0
+StoreGateSvc_Impl   DEBUG Recorded object @0x3599270 with key cinque of type Bar(CLID 8107)
+ in DataObject @0x2bec540
  object modifiable when retrieved
 AthenaOutputStr...WARNING add: can not find clid 13 in clid db
 AthenaOutputStream  DEBUG addItemObjects(13,"*") called
diff --git a/Control/AthenaServices/share/RCUSvc_test.ref b/Control/AthenaServices/share/RCUSvc_test.ref
index 9434f3e2d07240c4a50b1f668850deb5e1c6e233..5074ee4e8cf66df8dd386dfa85bb1e343d6a9968 100644
--- a/Control/AthenaServices/share/RCUSvc_test.ref
+++ b/Control/AthenaServices/share/RCUSvc_test.ref
@@ -1,42 +1,31 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/RCUSvc_test.txt
-JobOptionsSvc        INFO # =======> /home/sss/atlas/dvtest/build/../tests/../share/RCUSvc_test.txt
+JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/Control/AthenaServices/share/../share/RCUSvc_test.txt
 JobOptionsSvc        INFO # (4,1): MessageSvc.OutputLevel = 2
-JobOptionsSvc        INFO # (6,1): RCUSvc.HiveWhiteBoardSvc = "TestWhiteBoard"
+JobOptionsSvc        INFO # (6,1): Athena::RCUSvc.HiveWhiteBoardSvc = "TestWhiteBoard"
 JobOptionsSvc        INFO Job options successfully read in from ../share/RCUSvc_test.txt
 ApplicationMgr      DEBUG Getting my own properties
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99)
-                                          running on karma on Wed Aug 31 23:21:11 2016
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
+                                          running on lxplus020.cern.ch on Mon Dec 11 13:21:55 2017
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
-ServiceManager      DEBUG Initializing service AppMgrRunable
-AppMgrRunable       DEBUG Property update for OutputLevel : new value = 2
 AppMgrRunable       DEBUG Service base class initialized successfully
-ServiceManager      DEBUG Initializing service EventLoopMgr
-EventLoopMgr        DEBUG Property update for OutputLevel : new value = 2
 EventLoopMgr        DEBUG Service base class initialized successfully
-IncidentSvc         DEBUG Property update for OutputLevel : new value = 2
 IncidentSvc         DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0
-AlgExecStateSvc     DEBUG Property update for OutputLevel : new value = 2
-AlgExecStateSvc     DEBUG Service base class initialized successfully
-EventDataSvc        DEBUG Property update for OutputLevel : new value = 2
 EventDataSvc        DEBUG Service base class initialized successfully
-EventPersistenc...  DEBUG Property update for OutputLevel : new value = 2
 EventPersistenc...  DEBUG Service base class initialized successfully
+AlgExecStateSvc     DEBUG Service base class initialized successfully
 EventLoopMgr      WARNING Unable to locate service "EventSelector" 
 EventLoopMgr      WARNING No events will be processed from external input.
-HistogramDataSvc    DEBUG Property update for OutputLevel : new value = 2
 HistogramDataSvc    DEBUG Service base class initialized successfully
 HistogramPersis...  DEBUG Service base class initialized successfully
 HistogramPersis...WARNING Histograms saving not required.
 ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr Ready
-RCUSvc              DEBUG Property update for OutputLevel : new value = 2
-TestWhiteBoard      DEBUG Property update for OutputLevel : new value = 2
-IncidentSvc         DEBUG Adding [EndEvent] listener 'RCUSvc' with priority 0
+IncidentSvc         DEBUG Adding [EndEvent] listener 'Athena::RCUSvc' with priority 0
 test1
 test2
diff --git a/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx b/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx
index b06c3b97f5cf4ebc03d28e819e1ded25eb2d05ed..ee3f7e9c798ed614f5407c1631ffba2271cfaeb8 100644
--- a/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx
+++ b/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx
@@ -568,10 +568,10 @@ StatusCode AthenaHiveEventLoopMgr::writeHistograms(bool force) {
 //=========================================================================
 // Run the algorithms beginRun hook
 //=========================================================================
-StatusCode AthenaHiveEventLoopMgr::beginRunAlgorithms(const EventInfo& event) {
+StatusCode AthenaHiveEventLoopMgr::beginRunAlgorithms(const EventInfo& /*event */) {
 
   // Fire BeginRun "Incident"
-  m_incidentSvc->fireIncident(EventIncident(event, name(),"BeginRun"));
+  //  m_incidentSvc->fireIncident(EventIncident(event, name(),"BeginRun"));
 
   return StatusCode::SUCCESS;
 }
@@ -582,7 +582,7 @@ StatusCode AthenaHiveEventLoopMgr::beginRunAlgorithms(const EventInfo& event) {
 StatusCode AthenaHiveEventLoopMgr::endRunAlgorithms() {
 
   // Fire EndRun Incident
-  m_incidentSvc->fireIncident(Incident(name(),"EndRun"));
+  //  m_incidentSvc->fireIncident(Incident(name(),"EndRun"));
 
   return StatusCode::SUCCESS;
 }
@@ -655,15 +655,19 @@ StatusCode AthenaHiveEventLoopMgr::executeEvent(void* createdEvts_IntPtr )
   if (m_firstRun || (m_currentRun != pEvent->event_ID()->run_number()) ) {
     // Fire EndRun incident unless this is the first run
     if (!m_firstRun) {
-      if (!(this->endRunAlgorithms()).isSuccess()) return (StatusCode::FAILURE);
+      // FIXME!!!
+      m_incidentSvc->fireIncident(Incident(name(), IncidentType::EndRun));
     }
     m_firstRun=false;
     m_currentRun = pEvent->event_ID()->run_number();
 
     info() << "  ===>>>  start of run " << m_currentRun << "    <<<==="
            << endmsg;
- 
-    if (!(this->beginRunAlgorithms(*pEvent)).isSuccess()) return (StatusCode::FAILURE);
+
+    // FIXME!!! Fire BeginRun "Incident"
+    m_incidentSvc->fireIncident(EventIncident(*pEvent, name(),
+                                              IncidentType::BeginRun));
+
   }
 
   bool toolsPassed=true;
@@ -767,24 +771,15 @@ StatusCode AthenaHiveEventLoopMgr::executeRun(int maxevt)
   StatusCode  sc;
   bool eventfailed = false;
   
-  sc = m_algResourcePool->beginRun();
-  if (sc.isFailure()) 
-    eventfailed=true;
-
   // Call now the nextEvent(...)
   sc = nextEvent(maxevt);
   if (!sc.isSuccess())
     eventfailed = true;
 
-  sc = m_algResourcePool->endRun();
-  if (sc.isFailure())
-    eventfailed=true;
-
   if (eventfailed)
     return StatusCode::FAILURE;
 
   m_incidentSvc->fireIncident(Incident(name(),"EndEvtLoop"));
-  //    return this->endRunAlgorithms();
   return StatusCode::SUCCESS;
 }
 //-----------------------------------------------------------------------------
@@ -1005,12 +1000,6 @@ void AthenaHiveEventLoopMgr::handle(const Incident& inc)
     return;
   }
 
-  sc = beginRunAlgorithms(*pEvent);
-  if (!sc.isSuccess()) {
-    error() << "beginRunAlgorithms() failed" << endmsg;
-    return;
-  } 
-
   m_firstRun=false;
   m_currentRun = pEvent->event_ID()->run_number();
 
diff --git a/Control/IOVSvc/share/IOVSvcTool_test.ref b/Control/IOVSvc/share/IOVSvcTool_test.ref
index 0012fe6e2eca20d9d5d6f0e4616a877a56ff38de..9aa70380ce53b219bc2b4943d43a7001b95fb11c 100644
--- a/Control/IOVSvc/share/IOVSvcTool_test.ref
+++ b/Control/IOVSvc/share/IOVSvcTool_test.ref
@@ -2,35 +2,32 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/IOVSvcTool_test.txt
-JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3g/Control/IOVSvc/share/../share/IOVSvcTool_test.txt
+JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/Control/IOVSvc/share/../share/IOVSvcTool_test.txt
 JobOptionsSvc        INFO # (2,1): ApplicationMgr.DLLs += ["StoreGate", "IOVSvc"]
 JobOptionsSvc        INFO # (3,1): ApplicationMgr.CreateSvc += ["StoreGateSvc/DetectorStore"]
 JobOptionsSvc        INFO # (5,1): MessageSvc.OutputLevel = 2
 JobOptionsSvc        INFO Job options successfully read in from ../share/IOVSvcTool_test.txt
-MessageSvc          DEBUG Service base class initialized successfully
 ApplicationMgr      DEBUG Getting my own properties
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r0)
-                                          running on lxplus080.cern.ch on Wed Dec  6 16:11:05 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
+                                          running on lxplus020.cern.ch on Mon Dec 11 13:23:13 2017
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : StoreGate, IOVSvc
 ApplicationMgr       INFO Application Manager Configured successfully
-ServiceManager      DEBUG Initializing service IncidentSvc
 IncidentSvc         DEBUG Service base class initialized successfully
-ServiceManager      DEBUG Initializing service DetectorStore
 DetectorStore       DEBUG Service base class initialized successfully
 DetectorStore       DEBUG trying to create store SGImplSvc/DetectorStore_Impl
 DetectorStore_Impl  DEBUG Service base class initialized successfully
 EventPersistenc...  DEBUG Service base class initialized successfully
 ClassIDSvc          DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [ModuleLoaded] listener 'ClassIDSvc' with priority 100
-ClassIDSvc           INFO  getRegistryEntries: read 1112 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1114 CLIDRegistry entries for module ALL
+ClassIDSvc          DEBUG processCLIDDB: read 1485 entries from CLIDDB file: /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-opt/x86_64-slc6-gcc62-opt/share/clid.db
+ClassIDSvc          DEBUG processCLIDDB: read 1485 entries from CLIDDB file: /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2017-12-10T2303/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-opt/share/clid.db
 IncidentSvc         DEBUG Adding [EndEvent] listener 'DetectorStore' with priority 100
 IncidentSvc         DEBUG Adding [BeginEvent] listener 'DetectorStore' with priority 100
-ServiceManager      DEBUG Initializing service AppMgrRunable
 AppMgrRunable       DEBUG Service base class initialized successfully
-ServiceManager      DEBUG Initializing service EventLoopMgr
 EventLoopMgr        DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0
 EventDataSvc        DEBUG Service base class initialized successfully
@@ -59,5 +56,5 @@ IOVSvcTool           INFO IOVRanges will be checked at every Event
 IncidentSvc         DEBUG Adding [CheckIOV] listener 'ToolSvc.IOVSvcTool' with priority 100
 IncidentSvc         DEBUG Adding [ReloadProxies] listener 'ToolSvc.IOVSvcTool' with priority 100
 ClassIDSvc           INFO  getRegistryEntries: read 372 CLIDRegistry entries for module ALL
-IOVSvcTool          DEBUG replace proxy [Dooo:6666/old] @0x286ab50 with [Dooo:6666/new] @0x2882ab0
+IOVSvcTool          DEBUG replace proxy [Dooo:6666/old] @0x2801b60 with [Dooo:6666/new] @0x2819910
 *** IOVSvcTool_test OK ***
diff --git a/Control/RngComps/CMakeLists.txt b/Control/RngComps/CMakeLists.txt
index bd809b1ef3e9fbb8d73092c9c8b799a9e255933f..2f577ce47614b622c872bd8f70ee229bdbcb0c50 100644
--- a/Control/RngComps/CMakeLists.txt
+++ b/Control/RngComps/CMakeLists.txt
@@ -29,7 +29,7 @@ atlas_add_component( RngComps src/*.h src/*.cxx src/components/*.cxx
    AtlasCLHEP_RandomGenerators )
 
 # Test(s) in the package:
-set( RNGCOMPS_REFERENCE_TAG RngComps/RngCompsReference-01-00-02 ) 
+set( RNGCOMPS_REFERENCE_TAG RngComps/RngCompsReference-01-00-03 ) 
  
 atlas_add_test( AtRndmGen_test
    SOURCES test/AtRndmGen_test.cxx
diff --git a/Control/RngComps/share/AtRanlux_test.ref b/Control/RngComps/share/AtRanlux_test.ref
index 68929b8c76f04cff0ef57716a682660c26ae335b..a2166d11bc1ab42b9e35b415dc7f3c4e30c344c1 100644
--- a/Control/RngComps/share/AtRanlux_test.ref
+++ b/Control/RngComps/share/AtRanlux_test.ref
@@ -17,20 +17,16 @@ JobOptionsSvc        INFO # (23,1): AtRanluxGenSvc3.ReadFromFile = 1
 JobOptionsSvc        INFO # (24,1): AtRanluxGenSvc3.FileToRead = "test_AtRanluxGenSvc.out"
 JobOptionsSvc        INFO # (25,1): AtRanluxGenSvc3.SaveToFile = 0
 JobOptionsSvc        INFO Job options successfully read in from ../share/AtRanlux_test.txt
-MessageSvc          DEBUG Service base class initialized successfully
 ApplicationMgr      DEBUG Getting my own properties
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r0)
-                                          running on lxplus021.cern.ch on Wed Dec  6 21:07:57 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
+                                          running on lxplus020.cern.ch on Mon Dec 11 13:31:06 2017
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
-ServiceManager      DEBUG Initializing service IncidentSvc
 IncidentSvc         DEBUG Service base class initialized successfully
-ServiceManager      DEBUG Initializing service AppMgrRunable
 AppMgrRunable       DEBUG Service base class initialized successfully
-ServiceManager      DEBUG Initializing service EventLoopMgr
 EventLoopMgr        DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0
 EventDataSvc        DEBUG Service base class initialized successfully
diff --git a/Control/RngComps/share/AtRndmGen_test.ref b/Control/RngComps/share/AtRndmGen_test.ref
index 67850040b37d5103f89a2dd1f640c0bb3bb5a05f..72d443e00c5c5b9888614e217c4facbc3c1cccfe 100644
--- a/Control/RngComps/share/AtRndmGen_test.ref
+++ b/Control/RngComps/share/AtRndmGen_test.ref
@@ -18,20 +18,16 @@ JobOptionsSvc        INFO # (25,1): AtRndmGenSvc3.ReadFromFile = 1
 JobOptionsSvc        INFO # (26,1): AtRndmGenSvc3.FileToRead = "test_AtRndmGenSvc.out"
 JobOptionsSvc        INFO # (27,1): AtRndmGenSvc3.SaveToFile = 0
 JobOptionsSvc        INFO Job options successfully read in from ../share/AtRndmGen_test.txt
-MessageSvc          DEBUG Service base class initialized successfully
 ApplicationMgr      DEBUG Getting my own properties
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r0)
-                                          running on lxplus021.cern.ch on Wed Dec  6 21:06:58 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
+                                          running on lxplus020.cern.ch on Mon Dec 11 13:31:47 2017
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : AthenaServices
 ApplicationMgr       INFO Application Manager Configured successfully
-ServiceManager      DEBUG Initializing service IncidentSvc
 IncidentSvc         DEBUG Service base class initialized successfully
-ServiceManager      DEBUG Initializing service AppMgrRunable
 AppMgrRunable       DEBUG Service base class initialized successfully
-ServiceManager      DEBUG Initializing service EventLoopMgr
 EventLoopMgr        DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0
 EventDataSvc        DEBUG Service base class initialized successfully
diff --git a/Control/SGComps/share/SGFolder_test.ref b/Control/SGComps/share/SGFolder_test.ref
index 4aa85877085697d45d0692a7d50f07f63914b82b..a9b9c41f946e3ee55cc21d3c35a951d1c0452e8a 100644
--- a/Control/SGComps/share/SGFolder_test.ref
+++ b/Control/SGComps/share/SGFolder_test.ref
@@ -2,22 +2,19 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/SGFolder_test.txt
-JobOptionsSvc        INFO # =======> /home/leggett/work/v30r0.msg/src/Control/SGComps/share/../share/SGFolder_test.txt
+JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/Control/SGComps/share/../share/SGFolder_test.txt
 JobOptionsSvc        INFO # (5,1): MessageSvc.OutputLevel = 2
 JobOptionsSvc        INFO # (6,1): ToolSvc.MyFolder.ItemList = ["Foo#Bla", "Bar#*", "8101", "8107#", "Baricco#*"]
 JobOptionsSvc        INFO # (7,1): ToolSvc.MyFolder.CheckItems = 1
 JobOptionsSvc        INFO Job options successfully read in from ../share/SGFolder_test.txt
-MessageSvc          DEBUG Service base class initialized successfully
 ApplicationMgr      DEBUG Getting my own properties
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r0)
-                                          running on zeus.lbl.gov on Fri Dec  1 11:36:27 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
+                                          running on lxplus020.cern.ch on Mon Dec 11 13:32:57 2017
 ====================================================================================================================================
 ApplicationMgr       INFO Application Manager Configured successfully
-ServiceManager      DEBUG Initializing service AppMgrRunable
 AppMgrRunable       DEBUG Service base class initialized successfully
-ServiceManager      DEBUG Initializing service EventLoopMgr
 EventLoopMgr        DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [AbortEvent] listener '<unknown>' with priority 0
@@ -34,7 +31,9 @@ ApplicationMgr Ready
 ToolSvc             DEBUG Service base class initialized successfully
 ClassIDSvc          DEBUG Service base class initialized successfully
 IncidentSvc         DEBUG Adding [ModuleLoaded] listener 'ClassIDSvc' with priority 100
-ClassIDSvc           INFO  getRegistryEntries: read 1205 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1207 CLIDRegistry entries for module ALL
+ClassIDSvc          DEBUG processCLIDDB: read 1485 entries from CLIDDB file: /afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-slc6-gcc62-opt/x86_64-slc6-gcc62-opt/share/clid.db
+ClassIDSvc          DEBUG processCLIDDB: read 1485 entries from CLIDDB file: /cvmfs/atlas-nightlies.cern.ch/repo/sw/master/2017-12-10T2303/Athena/22.0.0/InstallArea/x86_64-slc6-gcc62-opt/share/clid.db
 ToolSvc.MyFolder  WARNING add: can not find type [Baricco] in clid db
 ToolSvc.MyFolder  WARNING add: can not find type [basfbojjvd] in clid db
 ToolSvc.MyFolder  WARNING add: can not find type [cucu] in clid db
diff --git a/Control/StoreGate/StoreGate/CondHandleKey.h b/Control/StoreGate/StoreGate/CondHandleKey.h
index d38d4b295a90b3e92ed3dff25b4cbaa3ea591608..f0ff4001d49f925b81ae5ace4b70ab5673257bbe 100644
--- a/Control/StoreGate/StoreGate/CondHandleKey.h
+++ b/Control/StoreGate/StoreGate/CondHandleKey.h
@@ -29,6 +29,17 @@ namespace SG {
     const std::string& dbKey() const { return m_dbKey; }
     void setDbKey(const std::string& dbKey) { m_dbKey = dbKey; }
 
+
+    /**
+     * @brief Called by the owning algorithm during the START transition.
+     *
+     * AthAlgorithm and friends will call this during START.  This allows
+     * for extra initialization that we can't do during initialize(), such
+     * as retrieving a conditions container from the store.
+     */
+    virtual StatusCode start() override;
+
+
   protected:
     bool isInit() const { return m_isInit; }
 
diff --git a/Control/StoreGate/StoreGate/CondHandleKey.icc b/Control/StoreGate/StoreGate/CondHandleKey.icc
index 71b9e7838c7487750c1c3d37f2f3585ccdb30d76..b3d85249334c829b7d9d3ed5cc59a09792c8315f 100644
--- a/Control/StoreGate/StoreGate/CondHandleKey.icc
+++ b/Control/StoreGate/StoreGate/CondHandleKey.icc
@@ -13,7 +13,7 @@ namespace SG {
                                   const std::string& dbKey,
                                   Gaudi::DataHandle::Mode mode ) :
     VarHandleKey(ClassID_traits<T>::ID(), key, mode,
-                 StoreID::storeName(StoreID::CONDITION_STORE)),
+                 StoreID::storeName(StoreID::CONDITION_STORE), true),
     m_cs(StoreID::storeName(StoreID::CONDITION_STORE),"CondHandleKey"),
     m_dbKey(dbKey)
   {
@@ -93,7 +93,7 @@ namespace SG {
 
   }
 
-  //---------------------------------------------------------------------------
+//---------------------------------------------------------------------------
 
   template <class T>
   StoreGateSvc* 
@@ -110,4 +110,28 @@ namespace SG {
   }
 
 
+//---------------------------------------------------------------------------
+
+
+  /**
+   * @brief Called by the owning algorithm during the START transition.
+   *
+   * AthAlgorithm and friends will call this during START.  This allows
+   * for extra initialization that we can't do during initialize(), such
+   * as retrieving a conditions container from the store.
+   */
+  template <class T>
+  StatusCode CondHandleKey<T>::start()
+  {
+    if (m_isInit && m_cc == nullptr && mode() == DataHandle::Reader) {
+      // Try again to retrieve the conditions container from the store.
+      // If this is a conditions object that is read by CondInputLoader,
+      // then we will not have found this during initialize(),
+      // as CondInputLoader only records the object during start().
+      m_cc = m_cs->tryRetrieve< CondCont<T> > (SG::VarHandleKey::key());
+    }
+    return StatusCode::SUCCESS;
+  }
+
+
 }
diff --git a/Control/StoreGate/StoreGate/VarHandleBase.h b/Control/StoreGate/StoreGate/VarHandleBase.h
index 26c309361bb93e0c4e4191a923499fd421d5aca0..27ad0a657a23a09ca18c444c3422f282870d6273 100644
--- a/Control/StoreGate/StoreGate/VarHandleBase.h
+++ b/Control/StoreGate/StoreGate/VarHandleBase.h
@@ -529,8 +529,10 @@ namespace SG {
      * @brief Initialize the store pointer from the store handle.
      *        Also checks that the key is valid.
      * @param ctx The current event context, or nullptr.
+     *
+     * Returns true on success.
      */
-    StatusCode setStoreFromHandle (const EventContext* ctx);
+    bool setStoreFromHandle (const EventContext* ctx);
 
 
     /**
diff --git a/Control/StoreGate/StoreGate/VarHandleKey.h b/Control/StoreGate/StoreGate/VarHandleKey.h
index 4482fe9dfb6ecd79025d2f821c32dda49f9a3feb..297913c5a14348aaaebb195c15fcf5af6ac10f3c 100644
--- a/Control/StoreGate/StoreGate/VarHandleKey.h
+++ b/Control/StoreGate/StoreGate/VarHandleKey.h
@@ -62,6 +62,7 @@ public:
    * @param sgkey The StoreGate key for the object.
    * @param a Mode: read/write/update.
    * @param storeName Name to use for the store, if it's not encoded in sgkey.
+   * @param isCond True if this is a CondHandleKey.
    *
    * The provided key may actually start with the name of the store,
    * separated by a "+":  "MyStore:Obj".  If no "+" is present
@@ -75,7 +76,8 @@ public:
   VarHandleKey (CLID clid,
                 const std::string& sgkey,
                 Gaudi::DataHandle::Mode a,
-                const std::string& storeName = StoreID::storeName(StoreID::EVENT_STORE));
+                const std::string& storeName = StoreID::storeName(StoreID::EVENT_STORE),
+                bool isCond = false);
 
 
   /**
@@ -151,6 +153,18 @@ public:
   bool isEventStore() const;
 
 
+  /**
+   * @brief Called by the owning algorithm during the START transition.
+   *
+   * AthAlgorithm and friends will call this during START.  This allows
+   * for extra initialization that we can't do during initialize(), such
+   * as retrieving a conditions container from the store.
+   *
+   * The default implementation is a no-op.
+   */
+  virtual StatusCode start();
+
+
 private:
   /// Set the owning handle.  Only callable from VarHandleBase.
   friend class VarHandleBase;
diff --git a/Control/StoreGate/StoreGate/VarHandleKey.icc b/Control/StoreGate/StoreGate/VarHandleKey.icc
index 890bca0d5e3b1f090f41428506268ffbe91a4b8e..b102b15967b11671c84f42517dd8b0df2a8801e2 100644
--- a/Control/StoreGate/StoreGate/VarHandleKey.icc
+++ b/Control/StoreGate/StoreGate/VarHandleKey.icc
@@ -54,4 +54,20 @@ bool VarHandleKey::isEventStore() const
 }
 
 
+/**
+ * @brief Called by the owning algorithm during the START transition.
+ *
+ * AthAlgorithm and friends will call this during START.  This allows
+ * for extra initialization that we can't do during initialize(), such
+ * as retrieving a conditions container from the store.
+ *
+ * The default implementation is a no-op.
+ */
+inline
+StatusCode VarHandleKey::start()
+{
+  return StatusCode::SUCCESS;
+}
+
+
 } // namespace SG
diff --git a/Control/StoreGate/src/SGHiveMgrSvc.cxx b/Control/StoreGate/src/SGHiveMgrSvc.cxx
index 5927ac513a91148683202f5d0f8475dfc63973ac..2fe5815d1f97478e5a8c8cb2cea2153d94ae7a19 100644
--- a/Control/StoreGate/src/SGHiveMgrSvc.cxx
+++ b/Control/StoreGate/src/SGHiveMgrSvc.cxx
@@ -155,7 +155,20 @@ bool HiveMgrSvc::exists( const DataObjID& id) {
   // don't care if it's slow
   std::string key = id.key();
   key.erase(0,key.find("+")+1);
-  return m_hiveStore->transientContains(id.clid(), id.key());
+
+  if (id.clid() == 0) {
+    // this is an ugly hack in case the DataObjID gets munged
+    // upstream, and we have to re-separate it into (class,key)
+    // from "class/key"
+    std::string cl = id.fullKey();
+    cl.erase(cl.find("/"),cl.length());
+
+    DataObjID d2(cl,key);
+    return m_hiveStore->transientContains(d2.clid(), key);
+  } else {    
+    return m_hiveStore->transientContains(id.clid(), key);
+  }
+ 
 } 
 
 StatusCode HiveMgrSvc::initialize() {
diff --git a/Control/StoreGate/src/VarHandleBase.cxx b/Control/StoreGate/src/VarHandleBase.cxx
index fa40361f512dcd5682b3046a4b55c5951d95ffec..3917c09d020f8c0887626b7f5d84de456ab0e4fa 100644
--- a/Control/StoreGate/src/VarHandleBase.cxx
+++ b/Control/StoreGate/src/VarHandleBase.cxx
@@ -146,13 +146,15 @@ namespace SG {
       m_storeWasSet(false),
       m_key (&key)
   {
-    if (key.storeHandle().get() == nullptr)
+    if (key.storeHandle().get() == nullptr) {
       throw SG::ExcUninitKey (key.clid(), key.key(),
                               key.storeHandle().name());
+    }
     
-    if (setStoreFromHandle(ctx).isFailure())
+    if (!setStoreFromHandle(ctx)) {
       throw SG::ExcHandleInitError (key.clid(), key.key(),
                                     key.storeHandle().name());
+    }
   }
 
 
@@ -310,7 +312,9 @@ namespace SG {
     std::cerr << ", key=" <<this->key() << ")...\n";
 #endif
 
-    resetProxy();
+    if (m_ownedKey) {
+      resetProxy();
+    }
     m_ptr = 0;
   }
 
@@ -951,16 +955,20 @@ namespace SG {
    * @brief Initialize the store pointer from the store handle.
    *        Also checks that the key is valid.
    * @param ctx The current event context, or nullptr.
+   *
+   * Returns true on success.
    */
-  StatusCode VarHandleBase::setStoreFromHandle (const EventContext* ctx)
+  bool VarHandleBase::setStoreFromHandle (const EventContext* ctx)
   {
     if (m_ownedKey) {
-      CHECK( m_ownedKey->initialize() );
+      if (m_ownedKey->initialize().isFailure()) {
+        return false;
+      }
     }
     m_store = storeFromHandle (ctx);
     m_storeWasSet = (ctx && m_store ==
                      ctx->getExtension<Atlas::ExtendedEventContext>()->proxy());
-    return StatusCode::SUCCESS;
+    return true;
   }
 
 
diff --git a/Control/StoreGate/src/VarHandleKey.cxx b/Control/StoreGate/src/VarHandleKey.cxx
index 9b2d6c35ec3314931ee1fa583705213c7b42e5fa..20385c4712d1589259a7f8b291174d6cf021488e 100644
--- a/Control/StoreGate/src/VarHandleKey.cxx
+++ b/Control/StoreGate/src/VarHandleKey.cxx
@@ -29,7 +29,8 @@ namespace SG {
  * @brief Constructor.
  * @param clid The class ID for the referenced object.
  * @param sgkey The StoreGate key for the object.
- * @param a Mode: read/write/update.
+ * @param a: read/write/update.
+ * @param isCond True if this is a CondHandleKey.
  *
  * The provided key may actually start with the name of the store,
  * separated by a "+":  "MyStore+Obj".  If no "+" is present,
@@ -43,8 +44,9 @@ namespace SG {
 VarHandleKey::VarHandleKey (CLID clid,
                             const std::string& sgkey,
                             Gaudi::DataHandle::Mode a,
-                            const std::string& storeName /*= "StoreGateSvc"*/)
-  : Gaudi::DataHandle (DataObjID (clid, sgkey), a),
+                            const std::string& storeName /*= "StoreGateSvc"*/,
+                            bool isCond /*= false*/)
+  : Gaudi::DataHandle (DataObjID (clid, sgkey), isCond, a),
     m_storeHandle (storeName, "VarHandleKey")
 {
   parseKey (sgkey, storeName);
@@ -108,7 +110,7 @@ StatusCode VarHandleKey::assign (const std::string& sgkey)
 StatusCode VarHandleKey::initialize (bool used /*= true*/)
 {
   if (!used) {
-    Gaudi::DataHandle::updateKey (m_storeHandle.name() + ":");
+    Gaudi::DataHandle::updateKey (m_storeHandle.name() + storeSeparator);
     m_sgKey = "";
     return StatusCode::SUCCESS;
   }
diff --git a/Control/StoreGate/test/VarHandleKey_test.cxx b/Control/StoreGate/test/VarHandleKey_test.cxx
index 411f5d3b07397f65fa6b6ef3bda5e6771d115120..aeeb3a42a3ef975684ef8da5896186bae2bb150f 100644
--- a/Control/StoreGate/test/VarHandleKey_test.cxx
+++ b/Control/StoreGate/test/VarHandleKey_test.cxx
@@ -42,6 +42,8 @@ void test1()
   assert (!k1.storeHandle().isSet());
   assert (k1.initialize().isSuccess());
   assert (k1.storeHandle().isSet());
+  assert (k1.start().isSuccess());
+  assert (!k1.isCondition());
 
   k1 = "aab";
   assert (k1.clid() == 1234);
@@ -68,7 +70,7 @@ void test1()
   EXPECT_EXCEPTION (SG::ExcBadHandleKey,
                     k1 = "FeeSvc+foo/aac");
   
-  SG::VarHandleKey k2 (1235, "bbb", Gaudi::DataHandle::Writer, "FooSvc");
+  SG::VarHandleKey k2 (1235, "bbb", Gaudi::DataHandle::Writer, "FooSvc", true);
   assert (k2.clid() == 1235);
   assert (k2.key() == "bbb");
   assert (k2.mode() == Gaudi::DataHandle::Writer);
@@ -76,6 +78,7 @@ void test1()
   assert (!k2.storeHandle().isSet());
   assert (k2.initialize().isFailure());
   assert (!k2.storeHandle().isSet());
+  assert (k2.isCondition());
 
   SG::VarHandleKey k3 (1236, "BarSvc+ccc", Gaudi::DataHandle::Updater, "FooSvc");
   assert (k3.clid() == 1236);
diff --git a/DataQuality/DataQualityTools/src/DQTMuonIDTrackTool.cxx b/DataQuality/DataQualityTools/src/DQTMuonIDTrackTool.cxx
index f5f5b3afb62c1d2e38cf4eb609ee22b4ebb0420f..225bafdb3362b7fd4d41539c344165f9c3047ff7 100644
--- a/DataQuality/DataQualityTools/src/DQTMuonIDTrackTool.cxx
+++ b/DataQuality/DataQualityTools/src/DQTMuonIDTrackTool.cxx
@@ -204,10 +204,9 @@ bool DQTMuonIDTrackTool::bookMuons()
    MsgStream log(msgSvc(), name());
     
 
-   StatusCode sc = m_extrapolator.retrieve();
-   if(sc.isFailure()) {
+   if(m_extrapolator.retrieve().isFailure()) {
       log << MSG::FATAL << "Could not get " << m_extrapolator.type() << endmsg;
-      return sc;
+      return false;
    }
 
 
diff --git a/DataQuality/DataQualityTools/src/DQTNonCollBkg_ZDC.cxx b/DataQuality/DataQualityTools/src/DQTNonCollBkg_ZDC.cxx
index 810722520eb1324db472696ddbbd9059b596bb6e..3408fabbe332d138b0f62c85d37e3f3a20c82caa 100644
--- a/DataQuality/DataQualityTools/src/DQTNonCollBkg_ZDC.cxx
+++ b/DataQuality/DataQualityTools/src/DQTNonCollBkg_ZDC.cxx
@@ -195,7 +195,7 @@ StatusCode DQTNonCollBkg_ZDC::fillHistograms()
   // Do the trigger selection here
   // Trigger selection suggested by D.Berge
   // Too rare :for testing, comment it 
-  if (! m_trigDec->isPassed("L1_ZDC_UNPAIRED")) return 0;
+  if (! m_trigDec->isPassed("L1_ZDC_UNPAIRED")) return StatusCode::FAILURE;
  
   std::vector<std::string> L1items = m_trigDec->getChainGroup("L1_.*")->getListOfTriggers();
   unsigned int nL1Items = L1items.size();
diff --git a/DetectorDescription/AGDD/AGDD2GeoSvc/src/DefaultAGDDTool.cxx b/DetectorDescription/AGDD/AGDD2GeoSvc/src/DefaultAGDDTool.cxx
index c915ad87f53655fff4098adb1e80129568599dc0..29b7a50f30d98a6786ab52e870026bf845a4f19c 100644
--- a/DetectorDescription/AGDD/AGDD2GeoSvc/src/DefaultAGDDTool.cxx
+++ b/DetectorDescription/AGDD/AGDD2GeoSvc/src/DefaultAGDDTool.cxx
@@ -25,23 +25,23 @@ StatusCode DefaultAGDDTool::construct()
 	ATH_MSG_INFO(" Name = "<<name());
 	
 	ATH_MSG_INFO(" trying to parse files ");
-	controller->ParseFiles();
+	m_controller->ParseFiles();
 	
 	if (m_printSections) 
 	{
 		ATH_MSG_INFO(" \tPrinting all Sections");
-		controller->PrintSections();
+		m_controller->PrintSections();
 	}
 	
 	if (!m_defaultDetector.empty())
     {
 		ATH_MSG_INFO(" setting default detector to "<<m_defaultDetector);
-	   	controller->UseGeoModelDetector(m_defaultDetector);
+	   	m_controller->UseGeoModelDetector(m_defaultDetector);
 	}
 	
-	controller->BuildAll();
+	m_controller->BuildAll();
 	
-	controller->Clean();
+	m_controller->Clean();
 	
 	return StatusCode::SUCCESS;
 }
diff --git a/DetectorDescription/AGDD/AGDDControl/AGDDControl/AGDDToolBase.h b/DetectorDescription/AGDD/AGDDControl/AGDDControl/AGDDToolBase.h
index 8cb9e579399424e4813dafcfb60a80f0e725afd1..bc2b607f99e2cae15c8df4e5675e60170105030a 100644
--- a/DetectorDescription/AGDD/AGDDControl/AGDDControl/AGDDToolBase.h
+++ b/DetectorDescription/AGDD/AGDDControl/AGDDControl/AGDDToolBase.h
@@ -33,7 +33,7 @@ protected:
 	
 	void InitializeAGDD();
 	
-	AGDDController* controller;
+	AGDDController* m_controller;
 };
 
 #endif
diff --git a/DetectorDescription/AGDD/AGDDControl/AGDDControl/IAGDDParser.h b/DetectorDescription/AGDD/AGDDControl/AGDDControl/IAGDDParser.h
index 06f5f6b9b967848d4fb63bfcfddf774c7feba6b2..a693b4594254db2ee15867caca245c3ca2772227 100644
--- a/DetectorDescription/AGDD/AGDDControl/AGDDControl/IAGDDParser.h
+++ b/DetectorDescription/AGDD/AGDDControl/AGDDControl/IAGDDParser.h
@@ -10,8 +10,8 @@
 
 class IAGDDParser {
 public:
-	IAGDDParser():fileName("") {}
-	IAGDDParser(std::string s):fileName(s) {}
+	IAGDDParser():m_fileName("") {}
+	IAGDDParser(std::string s):m_fileName(s) {}
 	virtual ~IAGDDParser() {;}
 	virtual bool ParseFile(std::string)=0;
 	virtual bool ParseFileAndNavigate(std::string)=0;
@@ -19,7 +19,7 @@ public:
 	virtual bool ParseStringAndNavigate(std::string)=0;
 	virtual void navigateTree()=0;
 protected:
-	std::string fileName;
+	std::string m_fileName;
 };
 
 #endif
diff --git a/DetectorDescription/AGDD/AGDDControl/AGDDControl/XMLHandler.h b/DetectorDescription/AGDD/AGDDControl/AGDDControl/XMLHandler.h
index 9e460807a059ec1e27add49dcd6eacf8086c32d2..53a3e1950fbad3bcb08a9b4cb7aafeb6f2a91873 100644
--- a/DetectorDescription/AGDD/AGDDControl/AGDDControl/XMLHandler.h
+++ b/DetectorDescription/AGDD/AGDDControl/AGDDControl/XMLHandler.h
@@ -10,17 +10,15 @@
 
 #include "AGDDControl/ExpressionEvaluator.h"
 
-using namespace xercesc;
-
 class XMLHandlerStore;
 
 class XMLHandler {
 public:
 	XMLHandler(std::string n);
 	virtual ~XMLHandler() {}
-	std::string GetName() {return name;}
+	std::string GetName() {return m_name;}
 	virtual void ElementHandle()=0;
-	virtual void Handle(DOMNode *t) 
+	virtual void Handle(xercesc::DOMNode *t) 
 	{
 		SetCurrentElement(t);
 		ElementHandle();
@@ -28,12 +26,12 @@ public:
 	void StopLoop(bool);
 	bool IsLoopToBeStopped();
 protected:
-	std::string name;
-	bool stopLoop;
+	std::string m_name;
+	bool m_stopLoop;
 
-	static DOMNode *currentElement;
-	static void SetCurrentElement(DOMNode *t) {currentElement=t;}
-	static DOMNode *GetCurrentElement() {return currentElement;}
+	static xercesc::DOMNode *s_currentElement;
+	static void SetCurrentElement(xercesc::DOMNode *t) {s_currentElement=t;}
+	static xercesc::DOMNode *GetCurrentElement() {return s_currentElement;}
 	
 	bool isAttribute(const std::string) const;
 
@@ -53,7 +51,7 @@ protected:
 	int getAttributeAsInt(const std::string, const int) const;
 	std::vector<double> getAttributeAsVector(const std::string, const std::vector<double>) const;
     std::vector<int> getAttributeAsIntVector(const std::string, const std::vector<int>) const;
-	static bool printFlag;
+	static bool s_printFlag;
 	
 	ExpressionEvaluator& Evaluator() const
 	{
diff --git a/DetectorDescription/AGDD/AGDDControl/AGDDControl/XercesParser.h b/DetectorDescription/AGDD/AGDDControl/AGDDControl/XercesParser.h
index 78d806d887dbfc9ca96bb02eeb6d519d933dc1d7..b571e387f7baa816abf4f5403f8bda1a439e3635 100644
--- a/DetectorDescription/AGDD/AGDDControl/AGDDControl/XercesParser.h
+++ b/DetectorDescription/AGDD/AGDDControl/AGDDControl/XercesParser.h
@@ -27,7 +27,7 @@ public:
 	static void elementLoop();
 	static void elementLoop(xercesc::DOMNode*);
 	static ExpressionEvaluator& Evaluator();
-	static xercesc::DOMNode* GetCurrentElement() {return currentElement;}
+	static xercesc::DOMNode* GetCurrentElement() {return s_currentElement;}
 	bool Initialize();
 	bool Finalize();
 private:
@@ -37,7 +37,7 @@ private:
 	
 	bool m_initialized;
 protected:
-	static xercesc::DOMNode *currentElement;
+	static xercesc::DOMNode *s_currentElement;
 };
 
 #endif
diff --git a/DetectorDescription/AGDD/AGDDControl/src/AGDDToolBase.cxx b/DetectorDescription/AGDD/AGDDControl/src/AGDDToolBase.cxx
index ac8daa6fc8e521f9b6f8d85102c6c9cd64fbc542..77b2c1e9be59e1d9740ca06b2212122bbc3a2481 100644
--- a/DetectorDescription/AGDD/AGDDControl/src/AGDDToolBase.cxx
+++ b/DetectorDescription/AGDD/AGDDControl/src/AGDDToolBase.cxx
@@ -25,7 +25,7 @@ AGDDToolBase::AGDDToolBase(const std::string& type, const std::string& name,
 	declareProperty("DisableSections",	m_disableSections);
 	
 	ATH_MSG_DEBUG(" trying to get the controller");
-  	controller =AGDDController::GetController();
+  	m_controller =AGDDController::GetController();
 }
 
 StatusCode AGDDToolBase::initialize()
@@ -38,13 +38,13 @@ void AGDDToolBase::InitializeAGDD()
 {
 	ATH_MSG_INFO(" initializing AGDD builder");
 	
-	controller->Locked(m_locked);
+	m_controller->Locked(m_locked);
 	
 	ATH_MSG_INFO(" XML file ");
   	for (unsigned int i=0;i<m_xmlFiles.size();i++)
   	{
   		ATH_MSG_INFO(" \t file "<<m_xmlFiles[i]);
-		controller->AddFile(m_xmlFiles[i]);		
+		m_controller->AddFile(m_xmlFiles[i]);		
   	}
   	ATH_MSG_INFO (" ---------");	
 	
@@ -53,7 +53,7 @@ void AGDDToolBase::InitializeAGDD()
   	for (unsigned int i=0;i<m_sectionsToBuild.size();i++)
   	{
   		ATH_MSG_INFO(" \t section "<<m_sectionsToBuild[i]);
-		controller->AddSection(m_sectionsToBuild[i]);		
+		m_controller->AddSection(m_sectionsToBuild[i]);		
   	}
   	ATH_MSG_INFO (" ---------");
 	
@@ -62,7 +62,7 @@ void AGDDToolBase::InitializeAGDD()
   	for (unsigned int i=0;i<m_volumesToBuild.size();i++)
   	{
   		ATH_MSG_INFO(" \t volume "<<m_volumesToBuild[i]);
-		controller->AddVolume(m_volumesToBuild[i]);		
+		m_controller->AddVolume(m_volumesToBuild[i]);		
   	}
   	ATH_MSG_INFO (" ---------");
 
diff --git a/DetectorDescription/AGDD/AGDDControl/src/XMLHandler.cxx b/DetectorDescription/AGDD/AGDDControl/src/XMLHandler.cxx
index 510b4c2b42270b12ed13049cd24abdc20b409bcc..813eda01998347c06a98dcb44829b073d8d0b309 100644
--- a/DetectorDescription/AGDD/AGDDControl/src/XMLHandler.cxx
+++ b/DetectorDescription/AGDD/AGDDControl/src/XMLHandler.cxx
@@ -7,13 +7,15 @@
 
 #include <vector>
 
-DOMNode* XMLHandler::currentElement=0;
-bool XMLHandler::printFlag=false;
+using namespace xercesc;
 
-XMLHandler::XMLHandler(std::string n):name(n) 
+DOMNode* XMLHandler::s_currentElement=0;
+bool XMLHandler::s_printFlag=false;
+
+XMLHandler::XMLHandler(std::string n):m_name(n) 
 {
 //    std::cout<< " creating new handler "<<n<<std::endl;
-	stopLoop=false;
+	m_stopLoop=false;
 	RegisterToStore();
 }
 
@@ -24,11 +26,11 @@ void XMLHandler::RegisterToStore()
 
 void XMLHandler::StopLoop(bool v)
 {
-	stopLoop=v;
+	m_stopLoop=v;
 }
 bool XMLHandler::IsLoopToBeStopped()
 {
-	return stopLoop;
+	return m_stopLoop;
 }
 bool XMLHandler::isAttribute(const std::string name) const
 {
@@ -40,8 +42,8 @@ std::string XMLHandler::getAttribute(const std::string name, bool& isPresent) co
 {
 	std::string retValue="";
 	isPresent=false;
-	if (currentElement->hasAttributes()) {
-		DOMNamedNodeMap *pAttributes = currentElement->getAttributes();
+	if (s_currentElement->hasAttributes()) {
+		DOMNamedNodeMap *pAttributes = s_currentElement->getAttributes();
 		DOMAttr *pAttributeNode = (DOMAttr*) pAttributes->getNamedItem(XMLString::transcode(name.c_str()));
 		if (pAttributeNode) {
 
diff --git a/DetectorDescription/AGDD/AGDDControl/src/XercesParser.cxx b/DetectorDescription/AGDD/AGDDControl/src/XercesParser.cxx
index c5664704ad29d16a700e721700c951d9c7b36717..80eb79c89ee3bdf93e69d7bc14e12e4157bd87ff 100644
--- a/DetectorDescription/AGDD/AGDDControl/src/XercesParser.cxx
+++ b/DetectorDescription/AGDD/AGDDControl/src/XercesParser.cxx
@@ -24,7 +24,7 @@
 
 using namespace xercesc;
 
-DOMNode* XercesParser::currentElement=0;
+DOMNode* XercesParser::s_currentElement=0;
 
 XercesParser::~XercesParser()
 {
@@ -48,7 +48,7 @@ XercesParser::XercesParser(std::string s):IAGDDParser(s),m_doc(0),m_parser(0),m_
 bool XercesParser::ParseFile(std::string s)
 {
 //	std::cout<<"+++++++++++> Xerces Parser parsing file "<<s <<std::endl;
-        fileName=s;
+        m_fileName=s;
 	s=PathResolver::find_file(s,"XMLPATH",PathResolver::RecursiveSearch);
 	if (s.empty())
 		std::cout<<" something wrong, could not find XML file "<<s<<std::endl;
@@ -173,7 +173,7 @@ void XercesParser::navigateTree()
 	DOMNode* node = 0;
 	node = dynamic_cast<DOMNode*>(m_doc->getDocumentElement());
 	if( !node ) throw;
-	currentElement=node;
+	s_currentElement=node;
 	elementLoop(node);
 }
 
@@ -189,7 +189,7 @@ void XercesParser::elementLoop(DOMNode *e)
 		return;
 	}
 	if (!(e->getNodeType()==DOMNode::ELEMENT_NODE)) return;
-	currentElement=e;
+	s_currentElement=e;
 	XMLHandler *h=XMLHandlerStore::GetHandlerStore()->GetHandler(e);
 	bool stopLoop=false;
 	if (h)
diff --git a/DetectorDescription/AGDD/AGDDHandlers/src/posXYZHandler.cxx b/DetectorDescription/AGDD/AGDDHandlers/src/posXYZHandler.cxx
index 45bbd2224340a9e2643e2ffd5dca387870045728..b8648ea7f7ffeac1401fcf3c9fe6e12c4d9e7fee 100644
--- a/DetectorDescription/AGDD/AGDDHandlers/src/posXYZHandler.cxx
+++ b/DetectorDescription/AGDD/AGDDHandlers/src/posXYZHandler.cxx
@@ -40,7 +40,7 @@ void posXYZHandler::ElementHandle()
 		crot.rotateY(rot[1]*deg);
 		crot.rotateZ(rot[2]*deg);
 	}
-	if (printFlag) {
+	if (s_printFlag) {
 		std::cout<<"   posXYV "<<volume;
 		if (posRet) std::cout<<" pos= ("<<X_Y_Z[0]<<";"<<X_Y_Z[1]<<";"<<X_Y_Z[2]<<")";
 		if (rotRet) std::cout<<" rot= ("<<rot[0]<<";"<<rot[1]<<";"<<rot[2]<<")";
diff --git a/DetectorDescription/AGDD/AGDDKernel/AGDDKernel/AGDDDetector.h b/DetectorDescription/AGDD/AGDDKernel/AGDDKernel/AGDDDetector.h
index c3b374a3caa317058a262560035af2e8e7e832a8..b221478041e225f17ed8421306a57ae658fe4fa1 100644
--- a/DetectorDescription/AGDD/AGDDKernel/AGDDKernel/AGDDDetector.h
+++ b/DetectorDescription/AGDD/AGDDKernel/AGDDKernel/AGDDDetector.h
@@ -17,7 +17,7 @@ public:
         AGDDDetector(std::string s):m_small_x(0),m_large_x(0),m_y(0),m_z(0),m_name(s) {}
         AGDDDetector(std::string s,std::string t):m_small_x(0),m_large_x(0),m_y(0),m_z(0),m_detectorType(t),m_name(s) {}
         virtual ~AGDDDetector() {}
-	virtual void SetXYZ(std::vector<double> v) 
+	virtual void SetXYZ(const std::vector<double>& v) 
 	{
 		m_small_x=v[0];
 		m_large_x=v[1];
diff --git a/DetectorDescription/RegSelSvcTest/CMakeLists.txt b/DetectorDescription/RegSelSvcTest/CMakeLists.txt
index 837213f61a71da87f7ce87e4f6bdafccb73cb655..d71d783ae86c3623a61e2062451aef14b6716c78 100644
--- a/DetectorDescription/RegSelSvcTest/CMakeLists.txt
+++ b/DetectorDescription/RegSelSvcTest/CMakeLists.txt
@@ -25,6 +25,7 @@ atlas_depends_on_subdirs( PUBLIC
 
 # Component(s) in the package:
 atlas_add_library( RegSelSvcTestLib
+                   NO_PUBLIC_HEADERS
                    src/*.cxx
                    PRIVATE_LINK_LIBRARIES SGTools IRegionSelector Identifier GaudiKernel StoreGateLib SGtests AthenaBaseComps AthenaPoolUtilities RegSelLUT PathResolver TrigSteeringEvent )
 
diff --git a/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/IROBDataProviderSvc.h b/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/IROBDataProviderSvc.h
index a5c5a0d3abff0a32e8240597d56c1acde4eb1f95..f78e47850d28771a97e8339f4941ef51920b3dea 100755
--- a/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/IROBDataProviderSvc.h
+++ b/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/IROBDataProviderSvc.h
@@ -13,6 +13,7 @@
 #include <vector>
 #include <string>
 #include <stdexcept>
+#include <functional>
 
 // Declaration of the interface ID ( interface id, major version, minor version)
 //static const InterfaceID IID_IROBDataProviderSvc("IROBDataProviderSvc", 1 , 0);
@@ -23,7 +24,8 @@
 class IROBDataProviderSvc : virtual public IInterface {
 
 public:
-   typedef std::vector<const OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment*> VROBFRAG;
+  typedef OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment ROBF;
+  typedef std::vector<const ROBF*> VROBFRAG;
 
    /// Retrieve interface ID
   //   static const InterfaceID& interfaceID() { return IID_IROBDataProviderSvc; }
@@ -33,7 +35,7 @@ public:
    virtual void addROBData(const std::vector<uint32_t>& robIds, const std::string callerName="UNKNOWN") = 0 ;
 
    /// Add a given LVL1/LVL2 ROBFragment to cache
-   virtual void setNextEvent(const std::vector<OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment>& result) = 0 ;
+   virtual void setNextEvent(const std::vector<ROBF>& result) = 0 ;
 
 
    /// Add all ROBFragments of a RawEvent to cache
@@ -58,16 +60,16 @@ public:
 
    // variants for MT, it has an implementation for now in order not to require change in all implementations yet, they will all become pure virtual methods
    virtual void addROBData(const EventContext& /*context*/, const std::vector<uint32_t>& /*robIds*/, const std::string callerName="UNKNOWN") { 
-     throw std::runtime_error( std::string( "Unimplemented ") + __FUNCTION__ + callerName) ; 
+     throw std::runtime_error( std::string( callerName+" is using unimplemented ") + __FUNCTION__ ) ; 
    }
-   virtual void setNextEvent(const EventContext& /*context*/, const std::vector<OFFLINE_FRAGMENTS_NAMESPACE::ROBFragment>& /*result*/) {
+   virtual void setNextEvent(const EventContext& /*context*/, const std::vector<ROBF>& /*result*/) {
      throw std::runtime_error( std::string("Unimplemented ") + __FUNCTION__ ); 
    }
    virtual void setNextEvent( const EventContext& /*context*/, const RawEvent* /*re*/) {
      throw std::runtime_error(std::string("Unimplemented ") + __FUNCTION__ ); 
    }
    virtual void getROBData(const EventContext& /*context*/, const std::vector<uint32_t>& /*robIds*/, VROBFRAG& /*robFragments*/, const std::string callerName="UNKNOWN") { 
-     throw std::runtime_error( std::string( "Unimplemented ") + __FUNCTION__ + callerName) ; 
+     throw std::runtime_error( std::string( callerName+" is using unimplemented ") + __FUNCTION__ ) ; 
    }
    virtual const RawEvent* getEvent(const EventContext& /*context*/) {
      throw std::runtime_error(std::string("Unimplemented ") + __FUNCTION__ ); 
@@ -79,6 +81,32 @@ public:
      throw std::runtime_error(std::string("Unimplemented ") + __FUNCTION__ ); 
      return 0;
    }
+   
+   /// @brief Interface to access cache of ROBs (it is a full event in case of offline)
+   /// In online implementation the cache will contain only a subset of ROBs. 
+   /// This method allows read access to the cache. 
+   /// @warning in case the cache is updated in the meantime the iteration is guaranteed to be safe 
+   /// but may not give access to all the ROBs available n the very moment
+   /// Example of counting: size_t counter = 0; svc->processCahcedROBs(ctx, [&](const ROBF*){ counter ++; })
+   /// Example of printout: svc->processCahcedROBs(ctx, [&](const ROBF* rob){ log() << MSG::DEBUG << "ROB " << rob->source_id() << endmsg; })
+   virtual void processCachedROBs(const EventContext& /*context*/, 
+				  const std::function< void(const ROBF* )>& /*fn*/ ) const {
+     throw std::runtime_error(std::string("Unimplemented ") + __FUNCTION__ ); 
+   }
+  
+  /// Check if complete event data are already in cache
+  virtual bool isEventComplete(const EventContext& /*context*/) const {
+    throw std::runtime_error(std::string("Unimplemented ") + __FUNCTION__ );      
+  } 
+  
+  /// @brief Collect all data for an event from the ROS and put them into the cache
+  /// @return value: number of ROBs which were retrieved to complete the event
+  /// Optionally the name of the caller of this method can be specified for monitoring
+  virtual int collectCompleteEventData(const EventContext& /*context*/, const std::string callerName="UNKNOWN") {
+    throw std::runtime_error(std::string(callerName + " is using unimplemented ") + __FUNCTION__ );
+    return 0;
+  }
+
 };
 
 #endif
diff --git a/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/ROBDataProviderSvc.h b/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/ROBDataProviderSvc.h
index d0c003e21c79902e061510bbecc7cdddf0bee3b9..dc1ef63edd6e94d14318a2cd92181358b47eccb9 100755
--- a/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/ROBDataProviderSvc.h
+++ b/Event/ByteStreamCnvSvcBase/ByteStreamCnvSvcBase/ROBDataProviderSvc.h
@@ -81,6 +81,14 @@ public:
    virtual void setEventStatus(const EventContext& context, uint32_t status) override;
    virtual uint32_t getEventStatus(const EventContext& context) override;
 
+   virtual void processCachedROBs(const EventContext& context, 
+				  const std::function< void(const ROBF* )>& fn ) const override;
+
+   virtual bool isEventComplete(const EventContext& /*context*/) const override { return true; }
+   virtual int collectCompleteEventData(const EventContext& /*context*/, const std::string /*callerName*/ ) {  return 0; }
+
+
+
 protected:
    /// vector of ROBFragment class
    typedef std::vector<ROBF*> VROBF;
diff --git a/Event/ByteStreamCnvSvcBase/src/ROBDataProviderMTTest.cxx b/Event/ByteStreamCnvSvcBase/src/ROBDataProviderMTTest.cxx
index 5797f9b7fb5eafe5737d6e498d3ef31cd9c77419..f4563fee2548f1ba952dfc6909478096653c84c6 100644
--- a/Event/ByteStreamCnvSvcBase/src/ROBDataProviderMTTest.cxx
+++ b/Event/ByteStreamCnvSvcBase/src/ROBDataProviderMTTest.cxx
@@ -60,7 +60,17 @@ StatusCode ROBDataProviderMTTest::execute_r( const EventContext& context ) const
 		       <<  rob->rod_lvl1_id() << " in Event header " << lvl1ID );      
     }
   }
-  
+  size_t count = 0;
+  m_robDataProvider->processCachedROBs( context, 
+					[&]( const IROBDataProviderSvc::ROBF* ){ count++; } );
+  ATH_MSG_DEBUG( "Size of the cache " << count );
+
+  m_robDataProvider->processCachedROBs( context, 
+					[&]( const IROBDataProviderSvc::ROBF* rob ){ 
+					  if ( 1120005 == rob->rob_source_id() ) 
+					    ATH_MSG_DEBUG( "rob in the cache " << rob->rob_source_id() ); } 
+					);
+
   return StatusCode::SUCCESS;
 }
 
diff --git a/Event/ByteStreamCnvSvcBase/src/ROBDataProviderSvc.cxx b/Event/ByteStreamCnvSvcBase/src/ROBDataProviderSvc.cxx
index 1b2cce4381550b65db9a47ffcaaa31633d940d3c..879cd668dec2e068e2887a84daa36db7a5366f2c 100755
--- a/Event/ByteStreamCnvSvcBase/src/ROBDataProviderSvc.cxx
+++ b/Event/ByteStreamCnvSvcBase/src/ROBDataProviderSvc.cxx
@@ -396,6 +396,16 @@ uint32_t ROBDataProviderSvc::getEventStatus() {
 uint32_t ROBDataProviderSvc::getEventStatus( const EventContext& context ) {
   return m_eventsCache.get( context )->eventStatus;
 }
+
+void ROBDataProviderSvc::processCachedROBs(const EventContext& context, 
+					   const std::function< void(const ROBF* )>& fn ) const {
+  for ( const auto&  el : m_eventsCache.get( context )->robmap ) {
+    fn( el.second );
+  }
+}
+
+
+
 /** - filter ROB with Sub Detector Id and Status Code
 */
 bool ROBDataProviderSvc::filterRobWithStatus(const ROBF* rob) {
@@ -442,3 +452,4 @@ ROBDataProviderSvc::EventCache::~EventCache() {
   delete event;
   ROBDataProviderSvc::robmapClear( robmap );
 }
+
diff --git a/Event/EventCommonTPCnv/CMakeLists.txt b/Event/EventCommonTPCnv/CMakeLists.txt
index 60813892ecf7d35ac46b4e264a7ea5dd28e9b9a4..7d45e44f2cf1c365b9ef003ab566450a84b8c87d 100644
--- a/Event/EventCommonTPCnv/CMakeLists.txt
+++ b/Event/EventCommonTPCnv/CMakeLists.txt
@@ -7,7 +7,7 @@ atlas_subdir( EventCommonTPCnv )
 
 # Declare the package's dependencies:
 atlas_depends_on_subdirs( PUBLIC
-                          Control/DataModel
+                          Control/AthLinks
                           Control/DataModelAthenaPool
                           Database/AthenaPOOL/AthenaPoolCnvSvc
                           Event/FourMom
@@ -28,17 +28,17 @@ atlas_add_tpcnv_library( EventCommonTPCnv
                          INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
                          PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
                          DEFINITIONS ${CLHEP_DEFINITIONS}
-                         LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModel DataModelAthenaPoolLib AthenaPoolCnvSvcLib FourMom NavFourMom AthenaKernel StoreGateLib SGtests GaudiKernel )
+                         LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthLinks DataModelAthenaPoolLib AthenaPoolCnvSvcLib FourMom NavFourMom AthenaKernel StoreGateLib SGtests GaudiKernel )
 
 atlas_add_dictionary( EventCommonTPCnvDict
                       EventCommonTPCnv/EventCommonTPCnvDict.h
                       EventCommonTPCnv/selection.xml
                       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModel DataModelAthenaPoolLib AthenaPoolCnvSvcLib FourMom NavFourMom AthenaKernel StoreGateLib SGtests GaudiKernel EventCommonTPCnv )
+                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthLinks DataModelAthenaPoolLib AthenaPoolCnvSvcLib FourMom NavFourMom AthenaKernel StoreGateLib SGtests GaudiKernel EventCommonTPCnv )
 
 atlas_add_dictionary( OLD_EventCommonTPCnvDict
                       EventCommonTPCnv/EventCommonTPCnvDict.h
                       EventCommonTPCnv/OLD_selection.xml
                       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModel DataModelAthenaPoolLib AthenaPoolCnvSvcLib FourMom NavFourMom AthenaKernel StoreGateLib SGtests GaudiKernel EventCommonTPCnv )
+                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthLinks DataModelAthenaPoolLib AthenaPoolCnvSvcLib FourMom NavFourMom AthenaKernel StoreGateLib SGtests GaudiKernel EventCommonTPCnv )
 
diff --git a/Event/EventCommonTPCnv/EventCommonTPCnv/INav4MomAssocsCnv_p2.h b/Event/EventCommonTPCnv/EventCommonTPCnv/INav4MomAssocsCnv_p2.h
index 0055bd70cdbb28aed7d45e42425e2f82de5238df..47f288755f645a9e6a86f09e5086ee851c3892ae 100644
--- a/Event/EventCommonTPCnv/EventCommonTPCnv/INav4MomAssocsCnv_p2.h
+++ b/Event/EventCommonTPCnv/EventCommonTPCnv/INav4MomAssocsCnv_p2.h
@@ -18,7 +18,7 @@
 // Gaudi includes
 
 // DataModel includes
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 
 // DataModelAthenaPool includes
 #include "DataModelAthenaPool/ElementLinkCnv_p2.h"
diff --git a/Event/EventCommonTPCnv/EventCommonTPCnv/INav4MomAssocsCnv_p3.h b/Event/EventCommonTPCnv/EventCommonTPCnv/INav4MomAssocsCnv_p3.h
index ea76bb0afd48c5663baf3691f866b0646be6b6f5..ad22b07d8e098bfab0ea4d02af53fb426f00c42f 100755
--- a/Event/EventCommonTPCnv/EventCommonTPCnv/INav4MomAssocsCnv_p3.h
+++ b/Event/EventCommonTPCnv/EventCommonTPCnv/INav4MomAssocsCnv_p3.h
@@ -18,7 +18,7 @@
 // Gaudi includes
 
 // DataModel includes
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 
 // DataModelAthenaPool includes
 #include "DataModelAthenaPool/ElementLinkCnv_p3.h"
diff --git a/Event/EventKernel/CMakeLists.txt b/Event/EventKernel/CMakeLists.txt
index 47f636f93ee89074087394f9e4f5c1b3b8b54b6b..2bc2596e3f757db94c58accec144050406af8bb0 100644
--- a/Event/EventKernel/CMakeLists.txt
+++ b/Event/EventKernel/CMakeLists.txt
@@ -15,9 +15,9 @@ endif()
 
 # Declare the package's dependencies:
 atlas_depends_on_subdirs( PUBLIC
-                          Control/DataModel
+                          Control/AthLinks
                           Control/Navigation
-                          Control/SGTools
+                          Control/AthenaKernel
                           ${extra_dep} )
 
 # External dependencies:
@@ -31,14 +31,14 @@ atlas_add_library( EventKernel
                    INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
                    DEFINITIONS ${CLHEP_DEFINITIONS}
-                   LINK_LIBRARIES ${CLHEP_LIBRARIES} DataModel Navigation SGTools ${extra_lib}
+                   LINK_LIBRARIES ${CLHEP_LIBRARIES} AthLinks Navigation AthenaKernel ${extra_lib}
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} )
 
 atlas_add_dictionary( EventKernelDict
                       EventKernel/EventKernelDict.h
                       EventKernel/selection.xml
                       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModel Navigation SGTools ${extra_lib} EventKernel )
+                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthLinks Navigation AthenaKernel ${extra_lib} EventKernel )
 
 # Install files from the package:
 atlas_install_python_modules( python/__init__.py python/ParticleDataType.py )
diff --git a/Event/EventKernel/EventKernel/INavigable4Momentum.h b/Event/EventKernel/EventKernel/INavigable4Momentum.h
index 5d6fd57a7cdc13532126c051384ac7ce0f6d49f1..1f438e6ad4b5cce71accf170073b19ac4eb51085 100755
--- a/Event/EventKernel/EventKernel/INavigable4Momentum.h
+++ b/Event/EventKernel/EventKernel/INavigable4Momentum.h
@@ -14,7 +14,7 @@
 
 #include "EventKernel/I4Momentum.h"
 #include "Navigation/INavigable.h"
-#include "SGTools/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 #include "Navigation/IAthenaBarCode.h"
 
 class INavigable4Momentum : public virtual IAthenaBarCode, public virtual INavigable, public virtual I4Momentum
diff --git a/Event/EventKernel/EventKernel/IParticle.h b/Event/EventKernel/EventKernel/IParticle.h
index f1c4d5954440f7d0c9547edccc478f47693ebdac..e218acd7a3f84d3f5f7a0bee6063a56c37f61c52 100755
--- a/Event/EventKernel/EventKernel/IParticle.h
+++ b/Event/EventKernel/EventKernel/IParticle.h
@@ -15,10 +15,10 @@
 //                                                                           //
 ///////////////////////////////////////////////////////////////////////////////
 
-#include "SGTools/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 #include "EventKernel/INavigable4Momentum.h"
 #include "EventKernel/PdtPdg.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 
 #ifndef SIMULATIONBASE
 #ifndef XAOD_ANALYSIS
diff --git a/ForwardDetectors/ALFA/ALFA_CLinkAlg/src/ALFA_CLinkAlg.cxx b/ForwardDetectors/ALFA/ALFA_CLinkAlg/src/ALFA_CLinkAlg.cxx
index 26ceb9318d70e884588434e80852c6d54c0a9887..fa6ba0ebd8429c9cdca3ac2d774aa62b44fb65a4 100644
--- a/ForwardDetectors/ALFA/ALFA_CLinkAlg/src/ALFA_CLinkAlg.cxx
+++ b/ForwardDetectors/ALFA/ALFA_CLinkAlg/src/ALFA_CLinkAlg.cxx
@@ -290,7 +290,7 @@ unsigned long long ALFA_CLinkAlg::CalcDCSId(eDCSItem eItem)
 	}
 
 	const CondAttrListCollection* pAttrListCol=NULL;
-	CHECK(detStore()->retrieve(pAttrListCol,Folder));
+	CHECK(detStore()->retrieve(pAttrListCol,Folder), 0);
 	if(!m_iovSvc->getKeyInfo(Folder,Foldername,Tag,Range,bRetrieved,ullBytesRead,fReadTime)) {
 		msg(MSG::ERROR)<<"Couldn't get IOV data about folder: "<<Folder<<endmsg;
 		return 0;
diff --git a/ForwardDetectors/ALFA/ALFA_EventCnv/ALFA_EventAthenaPool/src/ALFA_HitCollectionCnv.h b/ForwardDetectors/ALFA/ALFA_EventCnv/ALFA_EventAthenaPool/src/ALFA_HitCollectionCnv.h
index 302c9bcab6ffe660993200da094e3cfb2154736f..64eec442a8374b7732285b85e117099e7cfad33b 100644
--- a/ForwardDetectors/ALFA/ALFA_EventCnv/ALFA_EventAthenaPool/src/ALFA_HitCollectionCnv.h
+++ b/ForwardDetectors/ALFA/ALFA_EventCnv/ALFA_EventAthenaPool/src/ALFA_HitCollectionCnv.h
@@ -10,41 +10,13 @@
 
 #include "AthenaPoolCnvSvc/T_AthenaPoolCustomCnv.h"
 
-//#include "AthenaPoolCnvSvc/AthenaPoolCnvTPExtension.h"  // for TL classes
-//#include "AthenaPoolCnvSvc/T_AthenaPoolExtendingCnv.h"  // for TL classes
-//#include "ALFA_SimEvTPCnv/ALFA_HitCollectionCnv_tlp1.h" // for TL classes
-
 // Gaudi
 #include "GaudiKernel/MsgStream.h"
  
 // typedef to the latest persistent version
-
-// typedef ALFA_HitCollection_tlp1  ALFA_HitCollection_PERS; // for TL classes
 typedef ALFA_HitCollection_p1  ALFA_HitCollection_PERS;
 
 
-//typedef T_AthenaPoolCustomCnv < ALFA_HitCollection, ALFA_HitCollection_PERS > ALFA_HitCollectionCnvBase;
-//typedef T_AthenaPoolExtendingCnv < ALFA_HitCollection, ALFA_HitCollection_PERS > ALFA_HitCollectionCnvBase; // for TL classes
-
-
-/*class ALFA_HitCollectionCnv : public ALFA_HitCollectionCnvBase //, public AthenaPoolCnvTPExtension
- {
-   friend class CnvFactory<ALFA_HitCollectionCnv>;
- 
- protected:  
-  
-  
-  ALFA_HitCollectionCnv(ISvcLocator* svcloc) : ALFA_HitCollectionCnvBase(svcloc) {} 
-  ~ALFA_HitCollectionCnv(); 
-  
-  virtual ALFA_HitCollection_PERS*  createPersistent (ALFA_HitCollection *transCont);
-  virtual ALFA_HitCollection*       createTransient ();
-  
-  // virtual AthenaPoolTopLevelTPCnvBase*  getTopLevelTPCnv() { return &m_TPConverter; } // for TL classes
-  
-//  ALFA_HitCollectionCnv_p1 m_TPConverter;
-    
- };*/
  
 class ALFA_HitCollectionCnv : public T_AthenaPoolCustomCnv <ALFA_HitCollection, ALFA_HitCollection_PERS>
  {
diff --git a/Generators/Tauola_i/src/tauface-jetset.F b/Generators/Tauola_i/src/tauface-jetset.F
index cc28ffeeb597c3645fa26b0cc238bbedc2a88577..5afc689a39ea434376a70b03da13b8c6c00db691 100644
--- a/Generators/Tauola_i/src/tauface-jetset.F
+++ b/Generators/Tauola_i/src/tauface-jetset.F
@@ -2865,7 +2865,7 @@ c  ATHENA would "crash" because of FORTRAN's "STOP"! We leave modifying
 c  THIS piece of code for future work. 
 c
         WRITE(*,*) 'INITWK_ZP: WRONG IDFX',IDFX
-		
+                
 C Disable the call to the non-existent HWUEPR subroutine when using CMAKE for
 C the release build since this treats unresolved symbols as an error.
 #ifndef ATLAS_CMAKE
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/python/createLinkMaskingSQLiteFile.py b/InnerDetector/InDetConditions/SCT_ConditionsServices/python/createLinkMaskingSQLiteFile.py
index cc2d7e235c1680fcd236f3f546ff27c2499b17d4..3f5e16859b7b3cebbeaeeed78c9f288436ad3266 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/python/createLinkMaskingSQLiteFile.py
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/python/createLinkMaskingSQLiteFile.py
@@ -2,6 +2,7 @@
 
 # Taken from InnerDetector/InDetRecTools/TRT_ElectronPidTools/DatabaseTools/WritePyCoolAll.py
 # https://twiki.cern.ch/twiki/bin/view/Atlas/ConditionsSimpleExample
+# Usage: python createLinkMaskingSQLiteFile.py
 
 import sys
 from PyCool import cool
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testCachedSummary.py b/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testCachedSummary.py
index 302ba4dc6afedefd0c91615badce0919e2308974..2c3b071a5539df5b38c74dc062d88f55d3fd1826 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testCachedSummary.py
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testCachedSummary.py
@@ -21,7 +21,7 @@ from AthenaCommon.GlobalFlags import globalflags
 globalflags.DetDescrVersion="ATLAS-R2-2016-01-00-01"
 globalflags.DetGeo="atlas"
 globalflags.InputFormat="pool"
-globalflags.DataSource="geant4"
+globalflags.DataSource="data"
 print globalflags
 
 #--------------------------------------------------------------
@@ -66,20 +66,30 @@ job = AlgSequence()
 #--------------------------------------------------------------
 IOVDbSvc = Service("IOVDbSvc")
 from IOVDbSvc.CondDB import conddb
-IOVDbSvc.GlobalTag="OFLCOND-FDR-01-02-00"
+IOVDbSvc.GlobalTag="CONDBR2-BLKPA-2017-06"
 IOVDbSvc.OutputLevel = 3
 
 #ToolSvc = ServiceMgr.ToolSvc
 
-conddb.addFolder("","<db>COOLONL_SCT/COMP200</db> /SCT/DAQ/Configuration/Chip")
-conddb.addFolder("","<db>COOLONL_SCT/COMP200</db> /SCT/DAQ/Configuration/Module")
-conddb.addFolder("","<db>COOLONL_SCT/COMP200</db> /SCT/DAQ/Configuration/MUR")
-conddb.addFolder("","<db>COOLONL_SCT/COMP200</db> /SCT/DAQ/Configuration/ROD")
-conddb.addFolder("","<db>COOLONL_SCT/COMP200</db> /SCT/DAQ/Configuration/Geog")
-conddb.addFolder("","<db>COOLONL_SCT/COMP200</db> /SCT/DAQ/Configuration/RODMUR")
-conddb.addFolder('',"<db>COOLONL_TDAQ/COMP200</db> /TDAQ/EnabledResources/ATLAS/SCT/Robins")
-
-
+from AthenaCommon.AlgSequence import AthSequencer
+condSeq = AthSequencer("AthCondSeq")
+
+conddb.addFolder("TDAQ", "/TDAQ/Resources/ATLAS/SCT/Robins", className="CondAttrListCollection")
+from  SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_TdaqEnabledCondAlg
+condSeq += SCT_TdaqEnabledCondAlg(name="SCT_TdaqEnabledCondAlg")
+
+conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/Chip", "/SCT/DAQ/Config/Chip", className="CondAttrListVec")
+conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/Module", "/SCT/DAQ/Config/Module", className="CondAttrListVec")
+conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/MUR", "/SCT/DAQ/Config/MUR", className="CondAttrListVec") # Also for cabling
+from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_ConfigurationCondAlg
+condSeq += SCT_ConfigurationCondAlg(name = "SCT_ConfigurationCondAlg",
+                                    ReadKeyChannel = "/SCT/DAQ/Config/Chip",
+                                    ReadKeyModule = "/SCT/DAQ/Config/Module",
+                                    ReadKeyMur = "/SCT/DAQ/Config/MUR")
+
+conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/Geog", "/SCT/DAQ/Config/Geog") # Needed for cabling
+conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/RODMUR", "/SCT/DAQ/Config/RODMUR") # Needed for cabling
+conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/ROD", "/SCT/DAQ/Config/ROD") # Needed for cabling
 
 from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_ModuleVetoSvc
 ServiceMgr +=SCT_ModuleVetoSvc()
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testCalibChipRead.py b/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testCalibChipRead.py
index e86e7d3393b0ff4692f81bc81306ad553b1c032d..2f8827502993fb89fef370dddfd7900339df1b57 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testCalibChipRead.py
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testCalibChipRead.py
@@ -53,9 +53,6 @@ conddb.dbdata="COMP200"
 IOVDbSvc.GlobalTag=globalflags.ConditionsTag()
 IOVDbSvc.OutputLevel = DEBUG
 
-conddb.addFolderWithTag("SCT","/SCT/DAQ/Calibration/ChipNoise","SctDaqCalibrationChipNoise-UPD1-002-00")
-conddb.addFolderWithTag("SCT","/SCT/DAQ/Calibration/ChipGain","SctDaqCalibrationChipGain-UPD1-002-00")
-
 #--------------------------------------------------------------
 # Set Detector setup
 #--------------------------------------------------------------
@@ -95,6 +92,30 @@ ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc=""
 from AthenaCommon.AlgSequence import AlgSequence
 topSequence = AlgSequence()
 
+from xAODEventInfoCnv.xAODEventInfoCreator import xAODMaker__EventInfoCnvAlg
+topSequence +=xAODMaker__EventInfoCnvAlg(OutputLevel=2)
+
+from AthenaCommon.AlgSequence import AthSequencer
+condSeq = AthSequencer("AthCondSeq")
+
+sctGainFolder = "/SCT/DAQ/Calibration/ChipGain"
+sctGainCondAlg = "SCT_ReadCalibChipGainCondAlg"
+if not conddb.folderRequested(sctGainFolder):
+    conddb.addFolderWithTag("SCT","/SCT/DAQ/Calibration/ChipGain","SctDaqCalibrationChipGain-UPD1-002-00", className="CondAttrListCollection")
+if not hasattr(condSeq, sctGainCondAlg):
+    from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_ReadCalibChipGainCondAlg
+    condSeq += SCT_ReadCalibChipGainCondAlg(name=sctGainCondAlg, ReadKey=sctGainFolder)
+
+sctNoiseFolder = "/SCT/DAQ/Calibration/ChipNoise"
+sctNoiseCondAlg = "SCT_ReadCalibChipNoiseCondAlg"
+if not conddb.folderRequested(sctNoiseFolder):
+    conddb.addFolderWithTag("SCT","/SCT/DAQ/Calibration/ChipNoise","SctDaqCalibrationChipNoise-UPD1-002-00", className="CondAttrListCollection")
+if not hasattr(condSeq, sctNoiseCondAlg):
+    from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_ReadCalibChipNoiseCondAlg
+    condSeq += SCT_ReadCalibChipNoiseCondAlg(name=sctNoiseCondAlg, ReadKey=sctNoiseFolder)
+
+from AthenaCommon.AppMgr import ServiceMgr
+
 from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_ReadCalibChipDataTestAlg
 topSequence+= SCT_ReadCalibChipDataTestAlg()
 
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testCalibRead.py b/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testCalibRead.py
index 53768f3f63415fabb8d65485d3684e6c7f44f6bd..ac22a56b91934178d4ee24329d14bf049fe0c7b5 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testCalibRead.py
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testCalibRead.py
@@ -23,9 +23,7 @@ from AthenaCommon.AppMgr import theApp
 ServiceMgr += AuditorSvc()
 theAuditorSvc = ServiceMgr.AuditorSvc
 theAuditorSvc.Auditors  += [ "ChronoAuditor"]
-#ChronoStatSvc = Service ( "ChronoStatSvc")
 theAuditorSvc.Auditors  += [ "MemStatAuditor" ]
-#MemStatAuditor = theAuditorSvc.auditor( "MemStatAuditor" )
 theApp.AuditAlgorithms=True
 
 
@@ -40,16 +38,12 @@ jobproperties.PerfMonFlags.OutputFile = "perfmon.root"
 # Load Geometry
 #--------------------------------------------------------------
 from AthenaCommon.GlobalFlags import globalflags
-globalflags.DetDescrVersion="ATLAS-R1-2012-03-00-00"
+globalflags.DetDescrVersion="ATLAS-R2-2015-03-01-00"
 globalflags.DetGeo="atlas"
 globalflags.InputFormat="pool"
 globalflags.DataSource="data"
 print globalflags
 
-eventInfoKey = "ByteStreamEventInfo"
-if globalflags.DataSource()=="geant4":
-    eventInfoKey = "McEventInfo"
-
 #--------------------------------------------------------------
 # Set Detector setup
 #--------------------------------------------------------------
@@ -89,17 +83,46 @@ ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc=""
 from AthenaCommon.AlgSequence import AlgSequence
 topSequence = AlgSequence()
 
+#--------------------------------------------------------------
+# Load IOVDbSvc
+#--------------------------------------------------------------
+#include("IOVDbSvc/IOVDbSvc_jobOptions.py")
+IOVDbSvc = Service("IOVDbSvc")
+from IOVDbSvc.CondDB import conddb
+IOVDbSvc.GlobalTag='CONDBR2-BLKPA-2017-06'
+IOVDbSvc.OutputLevel = DEBUG
+
+# Load AthCondSeq
+from AthenaCommon.AlgSequence import AthSequencer 
+condSeq = AthSequencer("AthCondSeq")
+
+# Load conditions folders
+sctGainDefectFolder="/SCT/DAQ/Calibration/NPtGainDefects"
+if not conddb.folderRequested(sctGainDefectFolder):
+    conddb.addFolderSplitMC("SCT", sctGainDefectFolder, sctGainDefectFolder, className="CondAttrListCollection")
+sctNoiseDefectFolder="/SCT/DAQ/Calibration/NoiseOccupancyDefects"
+if not conddb.folderRequested(sctNoiseDefectFolder):
+    conddb.addFolderSplitMC("SCT", sctNoiseDefectFolder, sctNoiseDefectFolder, className="CondAttrListCollection")
+
+
+from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_ReadCalibDataCondAlg
+condSeq += SCT_ReadCalibDataCondAlg(name = "SCT_ReadCalibDataCondAlg",
+                                    ReadKeyGain = sctGainDefectFolder,
+                                    ReadKeyNoise = sctNoiseDefectFolder)
+SCT_ReadCalibDataCondAlg = condSeq.SCT_ReadCalibDataCondAlg
+
 from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_ReadCalibDataTestAlg
 topSequence+= SCT_ReadCalibDataTestAlg()
 
 from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_ReadCalibDataSvc
-ServiceMgr += SCT_ReadCalibDataSvc(EventInfoKey=eventInfoKey)
+ServiceMgr += SCT_ReadCalibDataSvc()
 
 SCT_ReadCalibDataSvc=ServiceMgr.SCT_ReadCalibDataSvc
+
 #SCT_ReadCalibDataSvc.RecoOnly = False
 # <-999 setting ignores the defect, otherwise it will be checked against the set value
-SCT_ReadCalibDataSvc.IgnoreDefects = ["NOISE_SLOPE","OFFSET_SLOPE","GAIN_SLOPE","BAD_OPE"]
-SCT_ReadCalibDataSvc.IgnoreDefectsParameters = [-1000,-1000,-1000,-1000]
+SCT_ReadCalibDataCondAlg.IgnoreDefects = ["NOISE_SLOPE","OFFSET_SLOPE","GAIN_SLOPE","BAD_OPE"]
+SCT_ReadCalibDataCondAlg.IgnoreDefectsParameters = [-1000,-1000,-1000,-1000]
 #SCT_ReadCalibDataSvc.IgnoreDefects = ["BADFIT","NOISE_SLOPE","OFFSET_SLOPE","GAIN_SLOPE","BAD_OPE"]
 #SCT_ReadCalibDataSvc.IgnoreDefectsParameters = [-1000,-1000,-1000,-1000,-1000]
 #SCT_ReadCalibDataSvc.IgnoreDefects = ["NOISE_SLOPE","OFFSET_SLOPE","GAIN_SLOPE"]
@@ -131,48 +154,21 @@ theApp.EvtMax                    = 1
 
 #For real data, earliest timestamp is 0
 #ServiceMgr.EventSelector.InitialTimeStamp = 1228950000
-ServiceMgr.EventSelector.InitialTimeStamp = 1530617600
-ServiceMgr.EventSelector.RunNumber = 198232
+ServiceMgr.EventSelector.InitialTimeStamp = 1476741326 # LB 18 of run 310809, 10/17/2016 @ 9:55pm (UTC)
+ServiceMgr.EventSelector.RunNumber = 310809
 
 #--------------------------------------------------------------
 # Set output lvl (VERBOSE, DEBUG, INFO, WARNING, ERROR, FATAL)
 #--------------------------------------------------------------
 ServiceMgr.MessageSvc.OutputLevel = INFO
+ServiceMgr.MessageSvc.Format = "% F%50W%S%7W%R%T %0W%M"
 ServiceMgr.SCT_ReadCalibDataSvc.OutputLevel = INFO
 topSequence.SCT_ReadCalibDataTestAlg.OutputLevel = INFO
 
-
-#--------------------------------------------------------------
-# Load IOVDbSvc
-#--------------------------------------------------------------
-#include("IOVDbSvc/IOVDbSvc_jobOptions.py")
-IOVDbSvc = Service("IOVDbSvc")
-from IOVDbSvc.CondDB import conddb
-IOVDbSvc.GlobalTag='COMCOND-BLKPA-RUN1-09'
-IOVDbSvc.OutputLevel = DEBUG
-#ToolSvc = Service( "ToolSvc" )
-
-# Not clear why these tags are not resolved from global tag
-conddb.blockFolder("/Indet/Align")
-conddb.addFolderWithTag("INDET_OFL","/Indet/Align","InDetAlign-BLK-UPD4-09")
-
-#For testing against the DEVDB10
-#DBname='<dbConnection>oracle://DEVDB10;schema=ATLAS_SCT_COMMCOND_DEV;dbname=ACALTEST;user=ATLAS_SCT_COMMCOND_DEV;password=********</dbConnection>'
-#IOVDbSvc.Folders += [ DBname + '/SCT/DAQ/Calibration/NPtGainDefects' ]
-#IOVDbSvc.Folders += [ DBname + '/SCT/DAQ/Calibration/NoiseOccupancyDefects' ]
-
-#For real Pit one data in comp200
-#conddb.addFolder("SCT",CoolFldrPathNoiseOcc)
-#conddb.addFolder("SCT",CoolFldrPathNPtGain)
-#Now multi-version in comp200:
-
-conddb.addFolder("SCT","/SCT/DAQ/Calibration/NoiseOccupancyDefects <tag>HEAD</tag>")
-conddb.addFolder("SCT","/SCT/DAQ/Calibration/NPtGainDefects <tag>HEAD</tag>")
-conddb.addFolder("SCT","/SCT/DAQ/Configuration/ROD <tag>HEAD</tag>")
-conddb.addFolder("SCT","/SCT/DAQ/Configuration/Geog <tag>HEAD</tag>")
-conddb.addFolder("SCT","/SCT/DAQ/Configuration/RODMUR <tag>HEAD</tag>")
-conddb.addFolder("SCT","/SCT/DAQ/Configuration/MUR <tag>HEAD</tag>")
-
+conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/MUR", "/SCT/DAQ/Config/MUR")
+conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/Geog", "/SCT/DAQ/Config/Geog")
+conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/RODMUR", "/SCT/DAQ/Config/RODMUR")
+conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/ROD", "/SCT/DAQ/Config/ROD")
 
 #--------------------------------------------------------------
 # Set the correct flags
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testConfig.py b/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testConfig.py
index 5d875fc7b6de14e217049c2b270f58fc7466bcea..f949a07d0a08103c9795f5787124a44d26313f6f 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testConfig.py
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testConfig.py
@@ -62,11 +62,15 @@ job = AlgSequence()
 #--------------------------------------------------------------
 IOVDbSvc = Service("IOVDbSvc")
 from IOVDbSvc.CondDB import conddb
-#--------------------------------------------------------------
-# Load IOVDbSvc
-#--------------------------------------------------------------
 IOVDbSvc.GlobalTag='OFLCOND-RUN12-SDR-25'
 IOVDbSvc.OutputLevel = DEBUG
+
+#--------------------------------------------------------------
+# Load AthCondSeq
+#--------------------------------------------------------------
+from AthenaCommon.AlgSequence import AthSequencer
+condSeq = AthSequencer("AthCondSeq")
+
 test='MC'
 #
 #NOTE: Testing with run2 requires presence of local sqlite file 'configTest.db'
@@ -119,14 +123,21 @@ else:
   conddb.addFolder("","<db>sqlite://none;schema=output.db;dbname=CONDBR2</db> /SCT/DAQ/Config/Chip <tag>SctDaqConfigChip-Oct2016_00</tag><forceRunNumber>20</forceRunNumber>")
   conddb.addFolder("","<db>sqlite://none;schema=output.db;dbname=CONDBR2</db> /SCT/DAQ/Config/Module <tag>SctDaqConfigModule-Oct2016_00</tag><forceRunNumber>20</forceRunNumber>")
   '''
+
   #test perfect DB on server
-  conddb.addFolder("","<db>COOLOFL_SCT/OFLP200</db> /SCT/DAQ/Config/Chip <tag>SctDaqConfigChip-PERFECT-Oct2016_00</tag><forceRunNumber>200805</forceRunNumber>")
-  conddb.addFolder("","<db>COOLOFL_SCT/OFLP200</db> /SCT/DAQ/Config/Module <tag>SctDaqConfigModule-PERFECT-Oct2016_00</tag><forceRunNumber>200805</forceRunNumber>")
-  conddb.addFolder("","<db>COOLOFL_SCT/OFLP200</db> /SCT/DAQ/Config/MUR <tag>SctDaqConfigMur-PERFECT-Oct2016_00</tag><forceRunNumber>200805</forceRunNumber>")
+  conddb.addFolder("","<db>COOLOFL_SCT/OFLP200</db> /SCT/DAQ/Config/Chip <tag>SctDaqConfigChip-PERFECT-Oct2016_00</tag><forceRunNumber>200805</forceRunNumber>", className="CondAttrListVec")
+  conddb.addFolder("","<db>COOLOFL_SCT/OFLP200</db> /SCT/DAQ/Config/Module <tag>SctDaqConfigModule-PERFECT-Oct2016_00</tag><forceRunNumber>200805</forceRunNumber>", className="CondAttrListVec")
+  conddb.addFolder("","<db>COOLOFL_SCT/OFLP200</db> /SCT/DAQ/Config/MUR <tag>SctDaqConfigMur-PERFECT-Oct2016_00</tag><forceRunNumber>200805</forceRunNumber>", className="CondAttrListVec")
   conddb.addFolder("","<db>COOLOFL_SCT/OFLP200</db> /SCT/DAQ/Config/ROD <tag>SctDaqConfigRod-PERFECT-Oct2016_00</tag><forceRunNumber>200805</forceRunNumber>")
   conddb.addFolder("","<db>COOLOFL_SCT/OFLP200</db> /SCT/DAQ/Config/Geog <tag>SctDaqConfigGeog-PERFECT-Oct2016_00</tag><forceRunNumber>200805</forceRunNumber>")
   conddb.addFolder("","<db>COOLOFL_SCT/OFLP200</db> /SCT/DAQ/Config/RODMUR <tag>SctDaqConfigRodmur-PERFECT-Oct2016_00</tag><forceRunNumber>200805</forceRunNumber>")
-  
+  if not hasattr(condSeq, "SCT_ConfigurationCondAlg"):
+    from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_ConfigurationCondAlg
+    condSeq += SCT_ConfigurationCondAlg(name = "SCT_ConfigurationCondAlg",
+                                        ReadKeyChannel = "/SCT/DAQ/Config/Chip",
+                                        ReadKeyModule = "/SCT/DAQ/Config/Module",
+                                        ReadKeyMur = "/SCT/DAQ/Config/MUR")
+
   from SCT_Cabling.SCT_CablingConf import SCT_CablingSvc
   ToolSvc = ServiceMgr.ToolSvc
   ServiceMgr+=SCT_CablingSvc()
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testDCSConditions.py b/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testDCSConditions.py
index 01ebad5bf7251d1006bfa54cc805081a5862824d..947ce74a4bef4f56116803a0ad13e6fd7f951e18 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testDCSConditions.py
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testDCSConditions.py
@@ -32,7 +32,7 @@ from AthenaCommon.GlobalFlags import globalflags
 globalflags.DetDescrVersion="ATLAS-R2-2015-03-01-00"
 globalflags.DetGeo="atlas"
 globalflags.InputFormat="pool"
-globalflags.DataSource="geant4"
+globalflags.DataSource="data"
 print globalflags
 
 
@@ -92,10 +92,9 @@ import AthenaCommon.AtlasUnixGeneratorJob
 #ServiceMgr+= EventSelector()
 #ServiceMgr.EventSelector.FirstEvent = 1
 #ServiceMgr.EventSelector.EventsPerRun = 5
-ServiceMgr.EventSelector.RunNumber = 0
+ServiceMgr.EventSelector.RunNumber = 310809
 # initial time stamp - this is number of seconds since 1st Jan 1970 GMT
-# the value given here corresponds to Sat Oct 18 2008 16:04:41 UTC
-ServiceMgr.EventSelector.InitialTimeStamp  = 1224345881
+ServiceMgr.EventSelector.InitialTimeStamp  = 1476741326 # LB 18 of run 310809, 10/17/2016 @ 9:55pm (UTC)
 # increment of 3 minutes
 ServiceMgr.EventSelector.TimeStampInterval = 180
 
@@ -114,13 +113,35 @@ ServiceMgr.MessageSvc.OutputLevel = 3
 IOVDbSvc = Service("IOVDbSvc")
 from IOVDbSvc.CondDB import conddb
 #IOVDbSvc.GlobalTag="HEAD"
-IOVDbSvc.GlobalTag="OFLCOND-FDR-01-02-00"
+IOVDbSvc.GlobalTag="CONDBR2-BLKPA-2017-06"
 IOVDbSvc.OutputLevel = 3
-conddb.addFolder('',"<db>COOLOFL_DCS/COMP200</db> /SCT/DCS/HV")
-conddb.addFolder('',"<db>COOLOFL_DCS/COMP200</db> /SCT/DCS/MODTEMP")
-conddb.addFolder('',"<db>COOLOFL_DCS/COMP200</db> /SCT/DCS/CHANSTAT")
-conddb.addFolder('',"<db>COOLOFL_DCS/COMP200</db> /SCT/DCS/MPS/LV")
 
+# Conditions sequence for Athena MT
+from AthenaCommon.AlgSequence import AthSequencer
+condSeq = AthSequencer("AthCondSeq")
+
+sctDCSStateFolder = '/SCT/DCS/CHANSTAT'
+sctDCSTempFolder = '/SCT/DCS/MODTEMP'
+sctDCSHVFolder = '/SCT/DCS/HV'
+if not conddb.folderRequested(sctDCSStateFolder):
+    conddb.addFolder("DCS_OFL", sctDCSStateFolder, className="CondAttrListCollection")
+if not conddb.folderRequested(sctDCSTempFolder):
+    conddb.addFolder("DCS_OFL", sctDCSTempFolder, className="CondAttrListCollection")
+if not conddb.folderRequested(sctDCSHVFolder):
+    conddb.addFolder("DCS_OFL", sctDCSHVFolder, className="CondAttrListCollection")
+if not hasattr(condSeq, "SCT_DCSConditionsHVCondAlg"):
+    from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_DCSConditionsHVCondAlg
+    condSeq += SCT_DCSConditionsHVCondAlg(name = "SCT_DCSConditionsHVCondAlg",
+                                          ReadKey = sctDCSHVFolder)
+if not hasattr(condSeq, "SCT_DCSConditionsStatCondAlg"):
+    from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_DCSConditionsStatCondAlg
+    condSeq += SCT_DCSConditionsStatCondAlg(name = "SCT_DCSConditionsStatCondAlg",
+                                            ReadKeyHV = sctDCSHVFolder,
+                                            ReadKeyState = sctDCSStateFolder)
+if not hasattr(condSeq, "SCT_DCSConditionsTempCondAlg"):
+    from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_DCSConditionsTempCondAlg
+    condSeq += SCT_DCSConditionsTempCondAlg(name = "SCT_DCSConditionsTempCondAlg",
+                                            ReadKey = sctDCSTempFolder)
 
 #InDetSCT_ConditionsSummarySvc.ConditionsServices+=["InDetSCT_DCSConditionsSvc"]
 #Temporary access to May Barrel COOL 2.0 data
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testParameters.py b/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testParameters.py
index ea4ac4ddd7cdd51244c96da7ec662e6393d42fe9..54741d3368a95b2616e532ce1ac1635d70cfa2d7 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testParameters.py
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testParameters.py
@@ -20,21 +20,22 @@ from GaudiSvc.GaudiSvcConf import AuditorSvc
 ServiceMgr += AuditorSvc()
 theAuditorSvc = ServiceMgr.AuditorSvc
 theAuditorSvc.Auditors  += [ "ChronoAuditor"]
-#ChronoStatSvc = Service ( "ChronoStatSvc")
 theAuditorSvc.Auditors  += [ "MemStatAuditor" ]
-#MemStatAuditor = theAuditorSvc.auditor( "MemStatAuditor" )
 theApp.AuditAlgorithms=True
 
 #--------------------------------------------------------------
 # Load Geometry
 #--------------------------------------------------------------
 from AthenaCommon.GlobalFlags import globalflags
-globalflags.DetDescrVersion="ATLAS-R2-2016-01-00-01"
+globalflags.DetDescrVersion="ATLAS-R1-2012-03-00-00"
+globalflags.ConditionsTag="COMCOND-BLKPA-RUN1-09"
 globalflags.DetGeo="atlas"
 globalflags.InputFormat="pool"
 globalflags.DataSource="data"
 print globalflags
 
+from RecExConfig.RecFlags import rec
+rec.projectName.set_Value_and_Lock("data12_8TeV")
 
 #--------------------------------------------------------------
 # Set Detector setup
@@ -76,6 +77,9 @@ ServiceMgr.GeoModelSvc.DetectorTools['SCT_DetectorTool'].LorentzAngleSvc=""
 from AthenaCommon.AlgSequence import AlgSequence
 topSequence = AlgSequence()
 
+from xAODEventInfoCnv.xAODEventInfoCreator import xAODMaker__EventInfoCnvAlg
+topSequence += xAODMaker__EventInfoCnvAlg(OutputLevel=2)
+
 from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_ConditionsParameterTestAlg
 topSequence+= SCT_ConditionsParameterTestAlg()
 
@@ -83,7 +87,7 @@ from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_ConditionsPara
 ServiceMgr += SCT_ConditionsParameterSvc()
 
 #SCT_DCSConditionsSvc=ServiceMgr.SCT_DCSConditionsSvc
-SCT_ConditionsParameterSvc.AttrListCollFolders=["/SCT/DAQ/Config/Chip"]
+SCT_ConditionsParameterSvc.AttrListCollFolders=["/SCT/DAQ/Configuration/Chip"]
 
 
 #--------------------------------------------------------------
@@ -93,10 +97,10 @@ import AthenaCommon.AtlasUnixGeneratorJob
 #ServiceMgr+= EventSelector()
 #ServiceMgr.EventSelector.FirstEvent = 1
 #ServiceMgr.EventSelector.EventsPerRun = 5
-ServiceMgr.EventSelector.RunNumber = 310809
+ServiceMgr.EventSelector.RunNumber = 215643
 # initial time stamp - this is number of seconds since 1st Jan 1970 GMT
 # run 310809 Recording start/end 2016-Oct-17 21:39:18 / 2016-Oct-18 16:45:23 UTC
-ServiceMgr.EventSelector.InitialTimeStamp  = 1476741326 # LB 18 of run 310809, 10/17/2016 @ 9:55pm (UTC)
+#ServiceMgr.EventSelector.InitialTimeStamp  = 1476741326 # LB 18 of run 310809, 10/17/2016 @ 9:55pm (UTC)
 # increment of 3 minutes
 ServiceMgr.EventSelector.TimeStampInterval = 180
 
@@ -112,11 +116,11 @@ ServiceMgr.MessageSvc.OutputLevel = 3
 #--------------------------------------------------------------
 IOVDbSvc = Service("IOVDbSvc")
 from IOVDbSvc.CondDB import conddb
-#IOVDbSvc.GlobalTag="HEAD"
-IOVDbSvc.GlobalTag="CONDBR2-BLKPA-2017-10"
+conddb.dbdata="COMP200"
+IOVDbSvc.GlobalTag=globalflags.ConditionsTag()
 IOVDbSvc.OutputLevel = 3
-conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/Chip", "/SCT/DAQ/Config/Chip")
-conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/ROD", "/SCT/DAQ/Config/ROD")
-conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/Geog", "/SCT/DAQ/Config/Geog")
-conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/RODMUR", "/SCT/DAQ/Config/RODMUR")
-conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/MUR", "/SCT/DAQ/Config/MUR")
+conddb.addFolder('',"<db>COOLONL_SCT/COMP200</db> /SCT/DAQ/Configuration/Chip")
+conddb.addFolder("","<db>COOLONL_SCT/COMP200</db> /SCT/DAQ/Configuration/ROD")
+conddb.addFolder("","<db>COOLONL_SCT/COMP200</db> /SCT/DAQ/Configuration/Geog")
+conddb.addFolder("","<db>COOLONL_SCT/COMP200</db> /SCT/DAQ/Configuration/RODMUR")
+conddb.addFolder("","<db>COOLONL_SCT/COMP200</db> /SCT/DAQ/Configuration/MUR")
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testRodVeto.py b/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testRodVeto.py
index edd2581ede6ff5e78b11653e31c91d8b2a2c5147..a401172d07de8443b2e2cbb1287c01ddad3a4e1a 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testRodVeto.py
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testRodVeto.py
@@ -82,8 +82,10 @@ conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/MUR", "/SCT/DAQ/Config/MUR")
 
 from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_RODVetoSvc
 ServiceMgr += SCT_RODVetoSvc()
-SCT_RODVeto=ServiceMgr.SCT_RODVetoSvc
-SCT_RODVeto.BadRODIdentifiers=[0x240100,0x240030] # Need to update the method to specify ROD identifiers
+
+from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_RODVetoTestWriteAlg
+job+= SCT_RODVetoTestWriteAlg()
+job.SCT_RODVetoTestWriteAlg.BadRODIdentifiers = [0x240100, 0x240030]
 
 from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_RODVetoTestAlg
 job+= SCT_RODVetoTestAlg()
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testSummary.py b/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testSummary.py
index 603c947f56cefdba5da295fc84c4ec3f9eb8906f..c93f9d58f7ff138b784afea9e663039e7456ba57 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testSummary.py
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/share/testSummary.py
@@ -83,16 +83,28 @@ from IOVDbSvc.CondDB import conddb
 IOVDbSvc.GlobalTag="CONDBR2-BLKPA-2017-06"
 print "conddb.dbdata", conddb.dbdata
 IOVDbSvc.OutputLevel = 3
-
-#ToolSvc = ServiceMgr.ToolSvc
-
-conddb.addFolder("TDAQ", "/TDAQ/Resources/ATLAS/SCT/Robins")
-conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/Chip", "/SCT/DAQ/Config/Chip")
-conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/Module", "/SCT/DAQ/Config/Module")
-conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/ROD", "/SCT/DAQ/Config/ROD")
-conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/Geog", "/SCT/DAQ/Config/Geog")
-conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/RODMUR", "/SCT/DAQ/Config/RODMUR")
-conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/MUR", "/SCT/DAQ/Config/MUR")
+#--------------------------------------------------------------
+# Load AthCondSeq
+#--------------------------------------------------------------
+from AthenaCommon.AlgSequence import AthSequencer
+condSeq = AthSequencer("AthCondSeq")
+
+conddb.addFolder("TDAQ", "/TDAQ/Resources/ATLAS/SCT/Robins", className="CondAttrListCollection")
+from  SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_TdaqEnabledCondAlg
+condSeq += SCT_TdaqEnabledCondAlg(name="SCT_TdaqEnabledCondAlg")
+
+conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/Chip", "/SCT/DAQ/Config/Chip", className="CondAttrListVec")
+conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/Module", "/SCT/DAQ/Config/Module", className="CondAttrListVec")
+conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/MUR", "/SCT/DAQ/Config/MUR", className="CondAttrListVec") # Also for cabling
+from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_ConfigurationCondAlg
+condSeq += SCT_ConfigurationCondAlg(name = "SCT_ConfigurationCondAlg",
+                                    ReadKeyChannel = "/SCT/DAQ/Config/Chip",
+                                    ReadKeyModule = "/SCT/DAQ/Config/Module",
+                                    ReadKeyMur = "/SCT/DAQ/Config/MUR")
+
+conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/Geog", "/SCT/DAQ/Config/Geog") # Needed for cabling
+conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/RODMUR", "/SCT/DAQ/Config/RODMUR") # Needed for cabling
+conddb.addFolderSplitMC("SCT", "/SCT/DAQ/Config/ROD", "/SCT/DAQ/Config/ROD") # Needed for cabling
 
 from SCT_ConditionsServices.SCT_ConditionsServicesConf import SCT_ModuleVetoSvc
 ServiceMgr +=SCT_ModuleVetoSvc()
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ConditionsParameterSvc.cxx b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ConditionsParameterSvc.cxx
index 7fe6491f3e99e245198ac1850b308a0fded86fe2..cb21d543b47411bc1dc10166c0f9f6088d7fe258 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ConditionsParameterSvc.cxx
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ConditionsParameterSvc.cxx
@@ -73,7 +73,7 @@ namespace {//anonymous namespace introduces file-scoped functions
     std::sscanf(arguments.c_str(), "p0 %50e p1 %50e p2 %50e",p0,p1,p2);
   }
   //folder to retrieve for threshold parameters
-  const std::string chipFolderName("/SCT/DAQ/Config/Chip"); //CoraCool folder in the DB
+  const std::string chipFolderName("/SCT/DAQ/Configuration/Chip"); //CoraCool folder in the DB
 }//namespace
 //c'tor
 SCT_ConditionsParameterSvc::SCT_ConditionsParameterSvc( const std::string& name, ISvcLocator* pSvcLocator ):
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_DCSConditionsTestAlg.cxx b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_DCSConditionsTestAlg.cxx
index 5dcb08d008be2848d4a2b8673ce86e37b2840987..359530f182ca36b9fc4b1320cf75b2a604cdc49f 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_DCSConditionsTestAlg.cxx
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_DCSConditionsTestAlg.cxx
@@ -16,9 +16,6 @@
 // Include Gaudi stuff
 #include "GaudiKernel/StatusCode.h"
 
-// Read Handle
-#include "StoreGate/ReadHandle.h"
-
 // Include STL stuff
 #include <string>
 using namespace std;
@@ -27,7 +24,6 @@ SCT_DCSConditionsTestAlg::SCT_DCSConditionsTestAlg(
                                                    const std::string& name, 
                                                    ISvcLocator* pSvcLocator ) : 
 AthAlgorithm( name, pSvcLocator ),
-m_currentEventKey(std::string("EventInfo")),
 m_DCSConditionsSvc("SCT_DCSConditionsSvc",name)//use SCT_DCSConditionsSvc if you are not running with InDetRecExample
 { //nop
 }
@@ -43,9 +39,6 @@ StatusCode SCT_DCSConditionsTestAlg::initialize(){
   sc = m_DCSConditionsSvc.retrieve();
   if (StatusCode::SUCCESS not_eq sc) return (msg(MSG::ERROR) << "Unable to get the DCS conditions service" << endmsg), sc;
 
-  // Read Handle
-  ATH_CHECK(m_currentEventKey.initialize());
-  
   return sc;
 } // SCT_DCSConditionsTestAlg::execute()
 
@@ -57,16 +50,6 @@ StatusCode SCT_DCSConditionsTestAlg::execute(){
   //
   StatusCode sc(StatusCode::SUCCESS);
   
-  // Get the current event
-  SG::ReadHandle<xAOD::EventInfo> currentEvent(m_currentEventKey);
-  if ( not currentEvent.isValid() ) return (msg(MSG::ERROR) << "Could not get event info" << endmsg), sc;
-  //
-  if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Current Run.Event,Time: "
-  << "[" << currentEvent->runNumber()
-  << "." << currentEvent->eventNumber()
-  << "," << currentEvent->timeStamp()
-  << "]" << endmsg;
-  
   bool DCSfilled(false);
   bool isgoodworks(false);
   float gethvworks=0.0;
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_DCSConditionsTestAlg.h b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_DCSConditionsTestAlg.h
index 29e925d58c73cf4d5390fb6e4978c47749261fb6..23c80d6cebc4dd3ec040480620ce23c5d5c04071 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_DCSConditionsTestAlg.h
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_DCSConditionsTestAlg.h
@@ -18,11 +18,6 @@
 // Include STL stuff
 #include <string>
 
-// Read Handle Key
-#include "StoreGate/ReadHandleKey.h"
-// Event Info
-#include "xAODEventInfo/EventInfo.h"
-
 // Forward declarations
 class ISCT_DCSConditionsSvc;
 class StatusCode;
@@ -43,7 +38,6 @@ public:
     StatusCode finalize();   //!< Gaudi finaliser
     
 private:
-    SG::ReadHandleKey<xAOD::EventInfo> m_currentEventKey;  //!< Current event
     ServiceHandle<ISCT_DCSConditionsSvc> m_DCSConditionsSvc;
    };
 
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_RODVetoTestAlg.cxx b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_RODVetoTestAlg.cxx
index 79262d3f1511ddca7004cce0546f6f425e6c1a3f..d895a8e72a920cb027894cb2d8e3d50188bfebae 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_RODVetoTestAlg.cxx
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_RODVetoTestAlg.cxx
@@ -49,17 +49,15 @@ SCT_RODVetoTestAlg::initialize(){
 
 //Execute
 StatusCode 
-SCT_RODVetoTestAlg::execute(){
+SCT_RODVetoTestAlg::execute() {
   //This method is only used to test the summary service, and only used within this package,
   // so the INFO level messages have no impact on performance of these services when used by clients
   StatusCode sc(StatusCode::SUCCESS);
   msg(MSG::INFO) << "Calling execute" << endmsg;
-  msg(MSG::INFO) <<"Call to module in ROD : Module is "<<endmsg;
-  bool result=m_pRODVetoSvc->isGood(0x240100);//invented, no idea what this is
-  msg(MSG::INFO) << (result?"good":"bad") << endmsg;
-  IdentifierHash anyRandomHash(1000);
-  result=m_pRODVetoSvc->isGood(anyRandomHash);
-  msg(MSG::INFO) << (result?"good":"bad") << endmsg;
+  for (unsigned int hash=0; hash<8176; hash+=2) {
+    bool result=m_pRODVetoSvc->isGood(IdentifierHash(hash));//invented, no idea what this is
+    msg(MSG::INFO) <<"Call to module in ROD : Module (hash=" << hash << ") is " << (result?"good":"bad") << endmsg;
+  }
  
   return sc;
 }
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_RODVetoTestWriteAlg.cxx b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_RODVetoTestWriteAlg.cxx
new file mode 100644
index 0000000000000000000000000000000000000000..1b6ced6a98e86e23b2fa00e5c7d5e3e0cb013fe4
--- /dev/null
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_RODVetoTestWriteAlg.cxx
@@ -0,0 +1,50 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+ * @file SCT_RODVetoTestWriteAlg.cxx
+ *
+ * @brief Implementation file for the SCT_RODVetoTestWriteAlg class 
+ * in package SCT_ConditionsServices
+ *
+ * @author Susumu Oda
+ **/
+
+#include "SCT_RODVetoTestWriteAlg.h"
+
+
+//Gaudi includes
+#include "GaudiKernel/StatusCode.h"
+
+SCT_RODVetoTestWriteAlg::SCT_RODVetoTestWriteAlg(const std::string& name, 
+                                                 ISvcLocator* pSvcLocator ) : 
+  AthAlgorithm(name, pSvcLocator),
+  m_badRODElements("BadRODIdentifiers"),
+  m_badRODElementsInput{0x240100} {
+  declareProperty("WriteKeyBadRODIdentifiers", m_badRODElements);
+  declareProperty("BadRODIdentifiers", m_badRODElementsInput);
+}
+
+SCT_RODVetoTestWriteAlg::~SCT_RODVetoTestWriteAlg() { 
+}
+
+StatusCode SCT_RODVetoTestWriteAlg::initialize() {
+  ATH_CHECK(m_badRODElements.initialize());
+
+  return StatusCode::SUCCESS;
+}
+
+StatusCode SCT_RODVetoTestWriteAlg::execute() {
+  SG::WriteHandle<std::vector<unsigned int> > out(m_badRODElements);
+  ATH_CHECK( out.record( std::make_unique<std::vector<unsigned int> >() ) );
+  for (auto itr=m_badRODElementsInput.begin(); itr!=m_badRODElementsInput.end(); itr++) {
+    out->push_back(*itr);
+  }
+ 
+  return StatusCode::SUCCESS;
+}
+
+StatusCode SCT_RODVetoTestWriteAlg::finalize() {
+  return StatusCode::SUCCESS;
+}
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_RODVetoTestWriteAlg.h b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_RODVetoTestWriteAlg.h
new file mode 100644
index 0000000000000000000000000000000000000000..2b5a0e52dc6f7787f8d0bf5584d0d07b24a93464
--- /dev/null
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_RODVetoTestWriteAlg.h
@@ -0,0 +1,46 @@
+/*
+  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+*/
+
+/**
+* @file SCT_RODVetoTestWriteAlg.h
+*
+* @brief Header file for the SCT_RODVetoTestWriteAlg class 
+*  in package SCT_ConditionsServices
+*
+* @author Daiki Hayakawa
+**/
+
+#ifndef SCT_RODVetoTestWriteAlg_H
+#define SCT_RODVetoTestWriteAlg_H 
+// STL
+#include <string>
+#include <vector>
+
+// Athena
+#include "AthenaBaseComps/AthAlgorithm.h"
+#include "StoreGate/WriteHandle.h"
+
+// Local
+#include "SCT_ConditionsServices/ISCT_ConditionsSvc.h"
+
+//Forward declarations
+class ISvcLocator;
+class StatusCode;
+
+/// Algorithm needs to show calling the SCT_RODVeto to exclude bad components
+class SCT_RODVetoTestWriteAlg : public AthAlgorithm {
+ public:
+  SCT_RODVetoTestWriteAlg(const std::string &name, ISvcLocator *pSvcLocator) ;
+ ~SCT_RODVetoTestWriteAlg();
+
+  StatusCode initialize();
+  StatusCode execute();
+  StatusCode finalize();
+   
+ private:
+  SG::WriteHandle<std::vector<unsigned int>> m_badRODElements;
+  std::vector<unsigned int> m_badRODElementsInput;
+}; //end of class
+
+#endif // SCT_RODVetoTestWriteAlg_H
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibDataTestAlg.cxx b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibDataTestAlg.cxx
index 0cc7f37e56f7d78110583f429d1ff04d534642a2..87905df6f167de191dc1b56bc478b7eab97b0bbe 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibDataTestAlg.cxx
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibDataTestAlg.cxx
@@ -18,9 +18,6 @@
 
 // Include Gaudi stuff
 
-// Include Read Handle
-#include "StoreGate/ReadHandle.h"
-
 // Include STL stuff
 #include <vector>
 #include <string>
@@ -30,7 +27,6 @@ SCT_ReadCalibDataTestAlg::SCT_ReadCalibDataTestAlg(const std::string& name, ISvc
   AthAlgorithm(name, pSvcLocator),
   m_sc{StatusCode::SUCCESS, true},
   m_id_sct{nullptr},
-  m_currentEventKey{std::string{"EventInfo"}},
   m_moduleId{0},
   m_waferId{0},
   m_stripId{0},
@@ -97,8 +93,6 @@ StatusCode SCT_ReadCalibDataTestAlg::initialize()
     return StatusCode::FAILURE;
   }
 
-  ATH_CHECK(m_currentEventKey.initialize());
-
   return StatusCode::SUCCESS;
 } // SCT_ReadCalibDataTestAlg::initialize()
 
@@ -150,18 +144,6 @@ StatusCode SCT_ReadCalibDataTestAlg::execute()
   // Print where you are
   ATH_MSG_DEBUG("in execute()");
   
-  // Get the current event
-  SG::ReadHandle<xAOD::EventInfo> currentEvent{m_currentEventKey};
-  if (not currentEvent.isValid() ) {
-    ATH_MSG_ERROR("Could not get event info");
-    return StatusCode::FAILURE;
-  }
-  ATH_MSG_DEBUG("Current Run.Event,Time: "
-      << "[" << currentEvent->runNumber()
-      << "." << currentEvent->eventNumber()
-      << "," << currentEvent->timeStamp()
-      << "]");
-  
   //Make sure data was filled
   bool CalibDataFilled = m_ReadCalibDataSvc->filled();  
   if (CalibDataFilled) {
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibDataTestAlg.h b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibDataTestAlg.h
index 5c003033a7f09305856814312bc122dab6127cd2..55ccf5de49dabc2d41615ad3d5d80fd5e95ac796 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibDataTestAlg.h
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/SCT_ReadCalibDataTestAlg.h
@@ -19,11 +19,6 @@
 #include "Identifier/Identifier.h"
 #include "GaudiKernel/ServiceHandle.h"
 
-// For Read Handle
-#include "StoreGate/ReadHandleKey.h"
-// Event Info
-#include "xAODEventInfo/EventInfo.h"
-
 // Include STL stuff
 #include <string>
 
@@ -54,7 +49,6 @@ class SCT_ReadCalibDataTestAlg:public AthAlgorithm
   //----------Private Attributes----------//
   StatusCode                          m_sc;            //!< To check return codes
   const SCT_ID*                       m_id_sct;        //!< ID helper for SCT
-  SG::ReadHandleKey<xAOD::EventInfo>  m_currentEventKey;  //!< Current event
   Identifier                          m_moduleId;      //!< Module identifier
   Identifier                          m_waferId;       //!< Wafer identifier
   Identifier                          m_stripId;       //!< Strip identifier
diff --git a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/components/SCT_ConditionsServices_entries.cxx b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/components/SCT_ConditionsServices_entries.cxx
index 512ff70d554213b4f5d886056f85ad4b9d34c4d0..9455302e239bce087b821a6770295d3b33cbe177 100644
--- a/InnerDetector/InDetConditions/SCT_ConditionsServices/src/components/SCT_ConditionsServices_entries.cxx
+++ b/InnerDetector/InDetConditions/SCT_ConditionsServices/src/components/SCT_ConditionsServices_entries.cxx
@@ -67,13 +67,11 @@
 #include "../SCT_ElectricFieldTool.h"
 
 #include "../SCT_RODVetoSvc.h"
+#include "../SCT_RODVetoTestWriteAlg.h"
 #include "../SCT_RODVetoTestAlg.h"
 
 //specific to rod veto testing:
 
-DECLARE_COMPONENT( SCT_RODVetoTestAlg )
-DECLARE_COMPONENT( SCT_RODVetoSvc )
-
 DECLARE_COMPONENT( SCT_ModuleVetoCondAlg )
 DECLARE_COMPONENT( SCT_ModuleVetoTestAlg )
 DECLARE_COMPONENT( SCT_ConditionsSummaryTestAlg )
@@ -102,6 +100,8 @@ DECLARE_COMPONENT( SCT_SensorsCondAlg )
 DECLARE_COMPONENT( SCT_SensorsTestAlg )
 DECLARE_COMPONENT( SCT_TdaqEnabledCondAlg )
 DECLARE_COMPONENT( SCT_TdaqEnabledTestAlg )
+DECLARE_COMPONENT( SCT_RODVetoTestWriteAlg )
+DECLARE_COMPONENT( SCT_RODVetoTestAlg )
 
 DECLARE_COMPONENT( SCT_ConditionsSummarySvc )
 DECLARE_COMPONENT( SCT_CachedSummarySvc )
@@ -122,7 +122,7 @@ DECLARE_COMPONENT( SCT_SensorsSvc )
 DECLARE_COMPONENT( SCT_MajorityConditionsSvc )
 DECLARE_COMPONENT( SCT_ChargeTrappingSvc )
 DECLARE_COMPONENT( SCT_RadDamageSummarySvc )
-
+DECLARE_COMPONENT( SCT_RODVetoSvc )
 
 DECLARE_COMPONENT( SCT_ReadoutTool )
 DECLARE_COMPONENT( SCT_ElectricFieldTool )
diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.h
index f9f21100cfdfef62f30cf4efc066fc872dff3b1c..701e8f609022ffd581afa489a55cb904f86657f8 100644
--- a/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.h
+++ b/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.h
@@ -81,7 +81,6 @@ private:
   int    m_numberOfCharges;  
   bool				m_disableDistortions;
 
-  const InDetDD::SiDetectorElement *m_module;   
   bool   m_doBichsel;                                  // re-do charge deposition following Bichsel model ?
   double m_doBichselBetaGammaCut;                      // replace momentum cut
   bool   m_doDeltaRay;                                 // implement Bichsel Model into delta-ray, which does not have truth particle link. 
diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.cxx
index e2adce1cd15f4da1442e2b107e192ff46e27429a..1c298c0e40f8307a9fd0fdc90be3a4429abbb560 100644
--- a/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.cxx
+++ b/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.cxx
@@ -155,7 +155,7 @@ StatusCode PixelDigitizationTool::processAllSubEvents() {
 StatusCode PixelDigitizationTool::digitizeEvent() {
   ATH_MSG_VERBOSE("PixelDigitizationTool::digitizeEvent()");
 
-  SiChargedDiodeCollection  *chargedDiodes = new SiChargedDiodeCollection;
+  std::unique_ptr<SiChargedDiodeCollection> chargedDiodes =  std::make_unique<SiChargedDiodeCollection>();
   std::vector<std::pair<double,double> > trfHitRecord; trfHitRecord.clear(); 
   std::vector<double> initialConditions; initialConditions.clear();
 
@@ -272,7 +272,6 @@ StatusCode PixelDigitizationTool::digitizeEvent() {
       }
     }
   }
-  delete chargedDiodes;
   ATH_MSG_DEBUG("non-hits processed");
 
   return StatusCode::SUCCESS;
@@ -283,7 +282,7 @@ StatusCode PixelDigitizationTool::digitizeEvent() {
 //=======================================
 // Convert a SiTotalCharge to a InDetSimData, and store it. (this needs working...)
 //-----------------------------------------------------------------------------------------------
-void PixelDigitizationTool::addSDO(SiChargedDiodeCollection* collection) {
+void PixelDigitizationTool::addSDO(std::unique_ptr<SiChargedDiodeCollection>& collection) {
 
   typedef SiTotalCharge::list_t list_t;
 
diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.h
index 7f9acea0df415bfc423d47f66c7f81be5fb3c054..ba15e1d5d9b228ca5ed1779ef8b2a60702b0aaa4 100644
--- a/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.h
+++ b/InnerDetector/InDetDigitization/PixelDigitization/src/PixelDigitizationTool.h
@@ -44,7 +44,7 @@ class PixelDigitizationTool : public PileUpToolBase {
     virtual StatusCode processBunchXing(int bunchXing, SubEventIterator bSubEvents, SubEventIterator eSubEvents) override final;
 
   protected:
-    void addSDO(SiChargedDiodeCollection *collection);
+    void addSDO(std::unique_ptr<SiChargedDiodeCollection>& collection);
 
   private:
 
diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimTool.h
index e78e8b8e82acaa6d424ae9cc5334466c95571900..bc5841effd3b2ce45141fae2cee25133093ac17c 100644
--- a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimTool.h
+++ b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimTool.h
@@ -77,9 +77,6 @@ class SensorSimTool:public AthAlgTool,virtual public IAlgTool {
     ServiceHandle<IAtRndmGenSvc>    m_rndmSvc;
     std::string 		                m_rndmEngineName;
     CLHEP::HepRandomEngine         *m_rndmEngine;	
-
-  private:
-    const InDetDD::SiDetectorElement *m_module;   
 };
 
 
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/python/TRT_DigitizationConfig.py b/InnerDetector/InDetDigitization/TRT_Digitization/python/TRT_DigitizationConfig.py
index 4ae69e455bb4b3379c4b1bbab33ef6e8fc62d9ea..d03a56cd92637f4fe84aa1ae1837e4c98820dd5e 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/python/TRT_DigitizationConfig.py
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/python/TRT_DigitizationConfig.py
@@ -128,9 +128,8 @@ def TRTDigitizationPU(name="TRTDigitizationPU",**kwargs):
 
 def TRT_OverlayDigitizationTool(name="TRT_OverlayDigitizationTool",**kwargs):
      from OverlayCommonAlgs.OverlayFlags import overlayFlags
-     kwargs.setdefault("EvtStore", overlayFlags.evtStore())
-     kwargs.setdefault("OutputObjectName", "TRT_RDOs")
-     kwargs.setdefault("OutputSDOName", "TRT_SDO_Map")
+     kwargs.setdefault("OutputObjectName", overlayFlags.evtStore()+"+TRT_RDOs")
+     kwargs.setdefault("OutputSDOName", overlayFlags.evtStore()+ "+TRT_SDO_Map")
      kwargs.setdefault("HardScatterSplittingMode", 0)
      kwargs.setdefault("Override_getT0FromData", 0)
      kwargs.setdefault("Override_noiseInSimhits", 0)
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/share/postInclude.OverrideTRTparameters.py b/InnerDetector/InDetDigitization/TRT_Digitization/share/postInclude.OverrideTRTparameters.py
index c13a647b22866fdc0a4889dee6542607b80a7fe8..2a2e1096843fcbbd3c044e38e2ce3bd15f4ca795 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/share/postInclude.OverrideTRTparameters.py
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/share/postInclude.OverrideTRTparameters.py
@@ -1,5 +1,4 @@
 #########################################################
-#                                                  v14  #
 #                                                       #
 # TRT_Digitization/postInclude.OverrideTRTparameters.py #
 #                                                       #
@@ -84,22 +83,19 @@ trt.Override_trEfficiencyBarrelKrypton = 0.49
 trt.Override_trEfficiencyEndCapAKrypton = 0.68
 trt.Override_trEfficiencyEndCapBKrypton = 0.68
 
-# T0, Old defaults = 7.0, 0.0
-# T0, New defaults = 1.0, 0.0
-# Note: if you change this from the default then you need to
-#       set ToolSvc.InDetTRT_DriftFunctionTool.MCTuningShift
-trt.Override_overallT0Shift            = 1.0
-trt.Override_overallT0ShiftShortBarrel = 0.0
-
 # Noise, defaults = 0(since July 2017), 0.02
 trt.Override_noiseInUnhitStraws = 0
 trt.Override_averageNoiseLevel  = 0.02
 
-# HL delta shift w.r.t m_overallT0Shift (steps of 0.78125 ns) (HT middle-bit fraction tune)
+# HL shift (steps of 0.78125 ns) (HT middle-bit fraction tune)
 # KyungEon.Choi@cern.ch https://indico.cern.ch/event/389682/contribution/5/material/slides/0.pdf
 trt.Override_htT0shiftBarShort  = -6
 trt.Override_htT0shiftBarLong   = -6
 trt.Override_htT0shiftECAwheels = -6
 trt.Override_htT0shiftECBwheels = -6
 
+# LL shift (steps of 0.78125 ns) (Christophe Roland Argon shaping tuning)
+# Note: if you change this from the default then you need to
+#       set ToolSvc.InDetTRT_DriftFunctionTool.MCTuningShift
+# Add these after the final Ar tune 
 ## EOF
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.cxx
index 653ea6f30ecf82b606c7b5b403ff81cbef1b3fc2..99b335ed1872a6a45b3c5d94fb51d0a4cd5dd6ac 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.cxx
@@ -108,8 +108,6 @@ void TRTDigSettings::defineVariables() {
   defineNewVariable("outerRadiusOfWire",&m_outerRadiusOfWire,"Outer radius of wire","micrometer",CLHEP::micrometer,5.0,40.0); // 0.0155 mm
   defineNewVariable("lengthOfDeadRegion",&m_lengthOfDeadRegion,"Length of dead region at straw ends","mm",CLHEP::mm,1.0,3.0);
   defineNewVariable("signalPropagationSpeed",&m_signalPropagationSpeed,"Speed of signal propagation along wire","c",CLHEP::c_light,0.1,1.0);
-  defineNewVariable("overallT0Shift",&m_overallT0Shift,"Overall shift of all electronics T0's to get correct effects of pileup, noise, etc.","ns",CLHEP::ns,-5000.0,5000.0);
-  defineNewVariable("overallT0ShiftShortBarrel",&m_overallT0ShiftShortBarrel,"Overall shift of electronics T0's in the short barrel straws.","ns",CLHEP::ns,-5000.0,5000.0);
   defineNewVariable("distanceToTimeFactor",&m_distanceToTimeFactor,"Fudge factor changing assumed particle propagation speed in time corr. calculations","",1.0,0.1,10.0);
   defineNewVariable("maxVertexDisplacement",&m_maxVertexDisplacement,"Maximum vertex displacement","cm",CLHEP::cm,0.0,50.0);
   defineNewVariable("timeOffsetCalcVertexX",&m_timeOffsetCalcVertexX,"X coord. of point where particles are assumed to originate from for time-shift","m",CLHEP::m,-150.0,150.0);
@@ -161,10 +159,23 @@ void TRTDigSettings::defineVariables() {
   defineNewBoolVariable("isOverlay",&m_isOverlay,"Flag set for overlay jobs");
 
   //ints:
-  defineNewIntVariable("htT0shiftBarShort", &m_htT0shiftBarShort, "HT T0 delta shift in 0.78125 ns steps, short barrel straws",-32,32);
-  defineNewIntVariable("htT0shiftBarLong",  &m_htT0shiftBarLong,  "HT T0 delta shift in 0.78125 ns steps, long barrel straws", -32,32);
-  defineNewIntVariable("htT0shiftECAwheels",&m_htT0shiftECAwheels,"HT T0 delta shift in 0.78125 ns steps, A type wheels",      -32,32);
-  defineNewIntVariable("htT0shiftECBwheels",&m_htT0shiftECBwheels,"HT T0 delta shift in 0.78125 ns steps, B type wheels",      -32,32);
+  defineNewIntVariable("htT0shiftBarShort", &m_htT0shiftBarShort, "HT T0 shift in 0.78125 ns steps, short barrel straws",-32,32);
+  defineNewIntVariable("htT0shiftBarLong",  &m_htT0shiftBarLong,  "HT T0 shift in 0.78125 ns steps, long barrel straws", -32,32);
+  defineNewIntVariable("htT0shiftECAwheels",&m_htT0shiftECAwheels,"HT T0 shift in 0.78125 ns steps, A type wheels",      -32,32);
+  defineNewIntVariable("htT0shiftECBwheels",&m_htT0shiftECBwheels,"HT T0 shift in 0.78125 ns steps, B type wheels",      -32,32);
+
+  defineNewIntVariable("ltT0shiftBarShortXe", &m_ltT0shiftBarShortXe, "LT T0 shift in 0.78125 ns steps, short barrel straws, Xe",-32,32);
+  defineNewIntVariable("ltT0shiftBarShortKr", &m_ltT0shiftBarShortKr, "LT T0 shift in 0.78125 ns steps, short barrel straws, Kr",-32,32);
+  defineNewIntVariable("ltT0shiftBarShortAr", &m_ltT0shiftBarShortAr, "LT T0 shift in 0.78125 ns steps, short barrel straws, Ar",-32,32);
+  defineNewIntVariable("ltT0shiftBarLongXe",  &m_ltT0shiftBarLongXe,  "LT T0 shift in 0.78125 ns steps, long barrel straws, Xe", -32,32);
+  defineNewIntVariable("ltT0shiftBarLongKr",  &m_ltT0shiftBarLongKr,  "LT T0 shift in 0.78125 ns steps, long barrel straws, Kr", -32,32);
+  defineNewIntVariable("ltT0shiftBarLongAr",  &m_ltT0shiftBarLongAr,  "LT T0 shift in 0.78125 ns steps, long barrel straws, Ar", -32,32);
+  defineNewIntVariable("ltT0shiftECAwheelsXe",&m_ltT0shiftECAwheelsXe,"LT T0 shift in 0.78125 ns steps, A type wheels, Xe",      -32,32);
+  defineNewIntVariable("ltT0shiftECAwheelsKr",&m_ltT0shiftECAwheelsKr,"LT T0 shift in 0.78125 ns steps, A type wheels, Kr",      -32,32);
+  defineNewIntVariable("ltT0shiftECAwheelsAr",&m_ltT0shiftECAwheelsAr,"LT T0 shift in 0.78125 ns steps, A type wheels, Ar",      -32,32);
+  defineNewIntVariable("ltT0shiftECBwheelsXe",&m_ltT0shiftECBwheelsXe,"LT T0 shift in 0.78125 ns steps, B type wheels, Xe",      -32,32);
+  defineNewIntVariable("ltT0shiftECBwheelsKr",&m_ltT0shiftECBwheelsKr,"LT T0 shift in 0.78125 ns steps, B type wheels, Kr",      -32,32);
+  defineNewIntVariable("ltT0shiftECBwheelsAr",&m_ltT0shiftECBwheelsAr,"LT T0 shift in 0.78125 ns steps, B type wheels, Ar",      -32,32);
 
 }
 
@@ -474,9 +485,6 @@ void TRTDigSettings::fillDefaults(const InDetDD::TRT_DetectorManager* detmgr) {
   // Fred: It would seem to me that the timing base for both low and high hits could
   //       be slightly different for the A & C sides and it would be wise to allow
   //       for the possibility in the code [FIXME].
-  // We need to tune the T0shift separately the endcap and the barrel [FIXME].
-  m_overallT0ShiftShortBarrel = 0.0*CLHEP::ns;
-  m_overallT0Shift            = 1.0*CLHEP::ns;
   m_minDiscriminatorWidth     = 1.1*CLHEP::ns;
   m_discriminatorSettlingTime = 1.1*CLHEP::ns;
   m_discriminatorDeadTime     = 6.0*CLHEP::ns;
@@ -484,11 +492,25 @@ void TRTDigSettings::fillDefaults(const InDetDD::TRT_DetectorManager* detmgr) {
 
   // HT middle-bit fraction tune; KyungEon.Choi@cern.ch
   // https://indico.cern.ch/event/389682/contribution/5/material/slides/0.pdf
-  m_htT0shiftBarShort  = -6; // This is a delta shift w.r.t m_overallT0Shift (steps of 0.78125 ns).
+  m_htT0shiftBarShort  = -6; // Timing shift applied just before discrimination (steps of 0.78125 ns).
   m_htT0shiftBarLong   = -6; // It affects only HL threshold timing. The purpose is to
   m_htT0shiftECAwheels = -6; // tune the middle HT bit fraction so that HT probability
   m_htT0shiftECBwheels = -6; // can be based on the middle bit only at high occupancy.
 
+  // LT timimg shift in steps of 0.78125 ns.
+  m_ltT0shiftBarShortXe=0;
+  m_ltT0shiftBarShortKr=0;
+  m_ltT0shiftBarShortAr=0;
+  m_ltT0shiftBarLongXe=0;
+  m_ltT0shiftBarLongKr=0;
+  m_ltT0shiftBarLongAr=0;
+  m_ltT0shiftECAwheelsXe=0;
+  m_ltT0shiftECAwheelsKr=0;
+  m_ltT0shiftECAwheelsAr=0;
+  m_ltT0shiftECBwheelsXe=0;
+  m_ltT0shiftECBwheelsKr=0;
+  m_ltT0shiftECBwheelsAr=0;
+
   // length
   m_strawLengthBarrel  = 1425.5*CLHEP::mm;
   m_innerRadiusEndcap  = 621.18*CLHEP::mm;
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.h
index d41500655555a008109a9007eeb2d00c175167dd..6ac9fc962982426cd24930935e364d505234e281 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.h
@@ -108,12 +108,17 @@ class TRTDigSettings {
   double highThresholdECAwheels(int strawGasType) const;
   double highThresholdECBwheels(int strawGasType) const;
 
-  /** delta T0 for HT */
+  /** T0 shift for HT */
   int htT0shiftBarShort()  const;
   int htT0shiftBarLong()   const;
   int htT0shiftECAwheels() const;
   int htT0shiftECBwheels() const;
 
+  /** T0 for LT */
+  int ltT0shiftBarShort(int strawGasType)  const;
+  int ltT0shiftBarLong(int strawGasType)   const;
+  int ltT0shiftECAwheels(int strawGasType) const;
+  int ltT0shiftECBwheels(int strawGasType) const;
 
   //--- Common straw geometry parameters:
 
@@ -139,10 +144,6 @@ class TRTDigSettings {
 
   //--- Calculating electronics time shifts:
 
-  /** Get overall T0 shift */
-  double overallT0Shift() const;
-  /** Get overall T0 shift for short barrel */
-  double overallT0ShiftShortBarrel() const;
   /** Get "distanceToTimeFactor" (fugde factor) */
   double distanceToTimeFactor() const;
   /** Get max vertex displacement */
@@ -272,8 +273,6 @@ class TRTDigSettings {
   double m_discriminatorSettlingTime; /**< Discriminator settling time */
   double m_discriminatorDeadTime;     /**< Discriminator dead time */
   double m_signalPropagationSpeed;/**< Signal propagation time in signal wire*/
-  double m_overallT0Shift;            /**< Overall T0 shift */
-  double m_overallT0ShiftShortBarrel; /**< Overall T0 shift for short barrel */
   double m_distanceToTimeFactor; /**< Fudge factor: time to distance */
 
   double m_lowThresholdBar;         /**< Low threshold discriminator setting */
@@ -300,11 +299,24 @@ class TRTDigSettings {
   double m_highThresholdECAwheelsKrypton;        /**< High threshold discriminator setting Krypton */
   double m_highThresholdECBwheelsKrypton;        /**< High threshold discriminator setting Krypton */
 
-  int m_htT0shiftBarShort; /** HT T0 delta shift */
+  int m_htT0shiftBarShort; /** HT T0 shift */
   int m_htT0shiftBarLong;
   int m_htT0shiftECAwheels;
   int m_htT0shiftECBwheels;
 
+  int m_ltT0shiftBarShortXe; /** LT T0 shift */
+  int m_ltT0shiftBarShortKr;
+  int m_ltT0shiftBarShortAr;
+  int m_ltT0shiftBarLongXe;
+  int m_ltT0shiftBarLongKr;
+  int m_ltT0shiftBarLongAr;
+  int m_ltT0shiftECAwheelsXe;
+  int m_ltT0shiftECAwheelsKr;
+  int m_ltT0shiftECAwheelsAr;
+  int m_ltT0shiftECBwheelsXe;
+  int m_ltT0shiftECBwheelsKr;
+  int m_ltT0shiftECBwheelsAr;
+
   double m_innerRadiusOfStraw;   /**< Inner radius of straw */
   double m_outerRadiusOfWire;    /**< Radius of drift wire */
   double m_lengthOfDeadRegion;   /**< Length of dead region at straw end */
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.icc b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.icc
index 7e08558dd49841346697ef717970389f66bb4305..56e5632b38edfcfb85d15570558623f0066d9ccc 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.icc
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTDigSettings.icc
@@ -60,12 +60,6 @@ inline double TRTDigSettings::discriminatorSettlingTime() const {
 inline double TRTDigSettings::discriminatorDeadTime() const {
   return m_discriminatorDeadTime;
 }
-inline double TRTDigSettings::overallT0Shift() const {
-  return m_overallT0Shift;
-}
-inline double TRTDigSettings::overallT0ShiftShortBarrel() const {
-  return m_overallT0ShiftShortBarrel;
-}
 inline double TRTDigSettings::distanceToTimeFactor() const {
   return m_distanceToTimeFactor; 
 }
@@ -126,10 +120,10 @@ inline double TRTDigSettings::trEfficiencyEndCapB(int strawGasType) const {
   else if (strawGasType==2) return m_trEfficiencyEndCapBArgon;
   else return m_trEfficiencyEndCapB; // should not happen
 }
-inline int TRTDigSettings::htT0shiftBarShort() const {
+inline int TRTDigSettings::htT0shiftBarShort()  const {
   return m_htT0shiftBarShort;
 }
-inline int TRTDigSettings::htT0shiftBarLong() const {
+inline int TRTDigSettings::htT0shiftBarLong()   const {
   return m_htT0shiftBarLong;
 }
 inline int TRTDigSettings::htT0shiftECAwheels() const {
@@ -138,6 +132,30 @@ inline int TRTDigSettings::htT0shiftECAwheels() const {
 inline int TRTDigSettings::htT0shiftECBwheels() const {
   return m_htT0shiftECBwheels;
 }
+inline int TRTDigSettings::ltT0shiftBarShort(int strawGasType) const {
+  if      (strawGasType==0) return m_ltT0shiftBarShortXe;
+  else if (strawGasType==1) return m_ltT0shiftBarShortKr;
+  else if (strawGasType==2) return m_ltT0shiftBarShortAr;
+  else return 0; // should not happen
+}
+inline int TRTDigSettings::ltT0shiftBarLong(int strawGasType) const {
+  if      (strawGasType==0) return m_ltT0shiftBarLongXe;
+  else if (strawGasType==1) return m_ltT0shiftBarLongKr;
+  else if (strawGasType==2) return m_ltT0shiftBarLongAr;
+  else return 0; // should not happen
+}
+inline int TRTDigSettings::ltT0shiftECAwheels(int strawGasType) const {
+  if      (strawGasType==0) return m_ltT0shiftECAwheelsXe;
+  else if (strawGasType==1) return m_ltT0shiftECAwheelsKr;
+  else if (strawGasType==2) return m_ltT0shiftECAwheelsAr;
+  else return 0; // should not happen
+}
+inline int TRTDigSettings::ltT0shiftECBwheels(int strawGasType) const {
+  if      (strawGasType==0) return m_ltT0shiftECBwheelsXe;
+  else if (strawGasType==1) return m_ltT0shiftECBwheelsKr;
+  else if (strawGasType==2) return m_ltT0shiftECBwheelsAr;
+  else return 0; // should not happen
+}
 inline double TRTDigSettings::innerRadiusOfStraw() const {
   return m_innerRadiusOfStraw;
 }
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.cxx
index ceee2aed57a9569259b1b852bfdeb65ff804f27c..2b36fd013a2b049e973b421eedb3011259c1c3a3 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.cxx
@@ -93,10 +93,10 @@ void TRTElectronicsProcessing::Initialize() {
   m_lowThresholdDiscriminator  = new int[m_totalNumberOfBins];
   m_highThresholdDiscriminator = new int[m_totalNumberOfBins];
 
-  m_maskA  = 0x03FC0000;
-  m_maskB  = 0x0001FE00;
-  m_maskC  = 0x000000FF;
-  m_maskHT = 0x04020100;
+  // m_maskA  = 0x03FC0000;
+  // m_maskB  = 0x0001FE00;
+  // m_maskC  = 0x000000FF;
+  // m_maskHT = 0x04020100;
 
   if (msgLevel(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TRTElectronicsProcessing::Initialize() done" << endmsg;
 }
@@ -298,14 +298,20 @@ void TRTElectronicsProcessing::ProcessDeposits( const std::vector<TRTElectronics
 
   // Discriminator response (in what fine time bins are the thresholds exceeded)
   DiscriminatorResponse(lowthreshold,highthreshold);
-  //std::cout << "AJB after discriminator ";
-  //for (int i=0; i<m_totalNumberOfBins; ++i) std::cout <<  m_lowhThresholdDiscriminator[i] << " "; // or m_highThresholdDiscriminator[i]
+  //std::cout << "AJB after discriminator " << strawGasType << getRegion(hitID) << std::endl;
+  //for (int i=0; i<m_totalNumberOfBins; ++i) std::cout << m_lowThresholdDiscriminator[i]; // or m_highThresholdDiscriminator[i]
+  //std::cout << std::endl;
+
+  // Apply an independent LT T0 shift to m_lowThresholdDiscriminator[]
+  LTt0Shift(hitID,strawGasType);
+  //std::cout << "AJB after discriminator LT T0 shift " << strawGasType << getRegion(hitID) << std::endl;
+  //for (int i=0; i<m_totalNumberOfBins; ++i) std::cout << m_lowThresholdDiscriminator[i];
   //std::cout << std::endl;
 
   // Apply an independent HT T0 shift to m_highThresholdDiscriminator[]
-  HTdeltaShift(hitID);
-  //std::cout << "AJB after discriminator HT delta T0 shift";
-  //for (int i=0; i<m_totalNumberOfBins; ++i) std::cout <<  m_highhThresholdDiscriminator[i] << " ";
+  HTt0Shift(hitID);
+  //std::cout << "AJB after discriminator HT T0 shift " << strawGasType << getRegion(hitID) << std::endl;
+  //for (int i=0; i<m_totalNumberOfBins; ++i) std::cout <<  m_highThresholdDiscriminator[i];
   //std::cout << std::endl;
 
   // Finally turn the fine discriminator response arrays into an output digit;
@@ -519,12 +525,13 @@ unsigned TRTElectronicsProcessing::EncodeDigit() const {
 }
 
 //_____________________________________________________________________________
-double TRTElectronicsProcessing::getHighThreshold ( int hitID, int strawGasType ) {
+unsigned int TRTElectronicsProcessing::getRegion(int hitID) {
 
+  // 1=barrelShort, 2=barrelLong, 3=ECA, 4=ECB
   const int mask(0x0000001F);
   const int word_shift(5);
   int layerID, ringID, wheelID;
-  double highthreshold(0.);
+  unsigned int region(0);
 
   if ( !(hitID & 0x00200000) ) { // barrel
 
@@ -533,7 +540,7 @@ double TRTElectronicsProcessing::getHighThreshold ( int hitID, int strawGasType
     hitID >>= word_shift;
     hitID >>= word_shift;
     ringID = hitID & mask;
-    highthreshold = ( (layerID < 9) && (ringID == 0) ) ? m_settings->highThresholdBarShort(strawGasType) : m_settings->highThresholdBarLong(strawGasType) ;
+    region = ( (layerID < 9) && (ringID == 0) ) ? 1 : 2;
 
   } else { // endcap
 
@@ -541,112 +548,117 @@ double TRTElectronicsProcessing::getHighThreshold ( int hitID, int strawGasType
     hitID >>= word_shift;
     hitID >>= word_shift;
     wheelID = hitID & mask;
-    highthreshold = wheelID < 8 ?  m_settings->highThresholdECAwheels(strawGasType) : m_settings->highThresholdECBwheels(strawGasType);
+    region = wheelID < 8 ?  3 : 4;
 
   }
 
-  return highthreshold;
+  return region;
 
 }
 
 //_____________________________________________________________________________
-int TRTElectronicsProcessing::getHTdeltaT0Shift(int hitID) {
-
-  const int mask(0x0000001F);
-  const int word_shift(5);
-  int layerID, ringID, wheelID;
-  int deltaT0Shift(0);
-
-  if ( !(hitID & 0x00200000) ) { // barrel
-
-    hitID >>= word_shift;
-    layerID = hitID & mask;
-    hitID >>= word_shift;
-    hitID >>= word_shift;
-    ringID = hitID & mask;
-    deltaT0Shift = ( (layerID < 9) && (ringID == 0) ) ? m_settings->htT0shiftBarShort() : m_settings->htT0shiftBarLong() ;
-
-  } else { // endcap
-
-    hitID >>= word_shift;
-    hitID >>= word_shift;
-    hitID >>= word_shift;
-    wheelID = hitID & mask;
-    deltaT0Shift = wheelID < 8 ?  m_settings->htT0shiftECAwheels() : m_settings->htT0shiftECBwheels();
-
+double TRTElectronicsProcessing::getHighThreshold ( int hitID, int strawGasType ) {
+  double highthreshold(0.);
+  switch ( getRegion(hitID) ) {
+    case 1: highthreshold = m_settings->highThresholdBarShort(strawGasType);  break;
+    case 2: highthreshold = m_settings->highThresholdBarLong(strawGasType);   break;
+    case 3: highthreshold = m_settings->highThresholdECAwheels(strawGasType); break;
+    case 4: highthreshold = m_settings->highThresholdECBwheels(strawGasType); break;
+    default:
+      if (msgLevel(MSG::WARNING)) {msg(MSG::WARNING) << "TRTDigitization::TRTElectronicsProcessing - getRegion is zero!" <<  endmsg; }
+      break;
   }
+  return highthreshold;
+}
 
-  return deltaT0Shift;
+//___________________________________________________________________________
+void TRTElectronicsProcessing::HTt0Shift(int hitID) {
+
+  // Apply a (small)timing shift to m_highThresholdDiscriminator[]
+  // t0Shift tuning is provided by the parameters:
+  // htT0shiftBarShort, htT0shiftBarLong, htT0shiftECAwheels and m_htT0shiftECBwheels
+
+  int t0Shift(0); // in 0.78125 ns steps
+  switch ( getRegion(hitID) ) {
+    case 1: t0Shift = m_settings->htT0shiftBarShort();  break;
+    case 2: t0Shift = m_settings->htT0shiftBarLong();   break;
+    case 3: t0Shift = m_settings->htT0shiftECAwheels(); break;
+    case 4: t0Shift = m_settings->htT0shiftECBwheels(); break;
+    default:
+      if (msgLevel(MSG::WARNING)) {msg(MSG::WARNING) << "TRTDigitization::TRTElectronicsProcessing - getRegion is zero!" <<  endmsg; }
+      break;
+  }
 
-}
+  if (!t0Shift) return; // skip this process if there is no shift
 
-//_____________________________________________________________________________
-unsigned int TRTElectronicsProcessing::getRegion(int hitID) {
-// 1=barrelShort, 2=barrelLong, 3=ECA, 4=ECB
-  const int mask(0x0000001F);
-  const int word_shift(5);
-  int layerID, ringID, wheelID;
-  unsigned int region(0);
+  unsigned int vsum=0;
+  for (int i=0; i<m_totalNumberOfBins; ++i) { vsum += m_highThresholdDiscriminator[i]; }
+  if (!vsum) return; // skip this process if there are no HT bits
 
-  if ( !(hitID & 0x00200000) ) { // barrel
+  if (t0Shift<0) { // for negative shifts
 
-    hitID >>= word_shift;
-    layerID = hitID & mask;
-    hitID >>= word_shift;
-    hitID >>= word_shift;
-    ringID = hitID & mask;
-    region = ( (layerID < 9) && (ringID == 0) ) ? 1 : 2;
+      for (int i=0; i<m_totalNumberOfBins; ++i) {
+        if (i-t0Shift>=m_totalNumberOfBins) break;
+        m_highThresholdDiscriminator[i]=m_highThresholdDiscriminator[i-t0Shift];
+      }
+      for (int i=m_totalNumberOfBins+t0Shift; i<m_totalNumberOfBins; ++i) if (i>=0) m_highThresholdDiscriminator[i]=0; // the last t0Shift bins are set to zero
 
-  } else { // endcap
+  } else {  // for positive shifts
 
-    hitID >>= word_shift;
-    hitID >>= word_shift;
-    hitID >>= word_shift;
-    wheelID = hitID & mask;
-    region = wheelID < 8 ?  3 : 4;
+      for (int i=m_totalNumberOfBins-1; i>0; --i) {
+        if (i-t0Shift<0) break;
+        m_highThresholdDiscriminator[i]=m_highThresholdDiscriminator[i-t0Shift];
+      }
+      for (int i=0; i<t0Shift; ++i) if (i<m_totalNumberOfBins) m_highThresholdDiscriminator[i]=0; // the first t0Shift bins are set to zero
 
   }
 
-  return region;
+  return;
 
 }
 
-//___________________________________________________________________________
-void TRTElectronicsProcessing::HTdeltaShift(int hitID) {
-
-  // Apply a (small)timing shift to m_highThresholdDiscriminator[] w.r.t the overall T0.
-  // Tuning is provided by the parameters: htT0shiftBarShort, htT0shiftBarLong,
-  // htT0shiftECAwheels and m_htT0shiftECBwheels which are fetched with getHTdeltaT0Shift(hitID).
+//_____________________________________________________________________________
+void TRTElectronicsProcessing::LTt0Shift( int hitID, int strawGasType ) {
+
+  // Apply a (small)timing shift to m_lowThresholdDiscriminator[]
+  // t0Shift tuning is provided by the parameters:
+  // ltT0shiftBarShort, ltT0shiftBarLong, ltT0shiftECAwheels and m_ltT0shiftECBwheels
+
+  int t0Shift(0); // in 0.78125 ns steps
+  switch ( getRegion(hitID) ) {
+    case 1: t0Shift = m_settings->ltT0shiftBarShort(strawGasType);  break;
+    case 2: t0Shift = m_settings->ltT0shiftBarLong(strawGasType);   break;
+    case 3: t0Shift = m_settings->ltT0shiftECAwheels(strawGasType); break;
+    case 4: t0Shift = m_settings->ltT0shiftECBwheels(strawGasType); break;
+    default:
+      if (msgLevel(MSG::WARNING)) {msg(MSG::WARNING) << "TRTDigitization::TRTElectronicsProcessing - getRegion is zero!" <<  endmsg; }
+      break;
+  }
 
-  int j = getHTdeltaT0Shift(hitID);
-  if (!j) return; // skip this process if there is no shift
+  if (!t0Shift) return; // skip this process if there is no shift
 
   unsigned int vsum=0;
-  for (int i=0; i<m_totalNumberOfBins; ++i) { vsum += m_highThresholdDiscriminator[i]; }
-  if (!vsum) return; // skip this process if there are no HT bits
+  for (int i=0; i<m_totalNumberOfBins; ++i) { vsum += m_lowThresholdDiscriminator[i]; }
+  if (!vsum) return; // skip this process if there are no LT bits
 
-  if (j<0) { // for negative shifts
+  if (t0Shift<0) { // for negative shifts
 
       for (int i=0; i<m_totalNumberOfBins; ++i) {
-        if (i-j>=m_totalNumberOfBins) break;
-        m_highThresholdDiscriminator[i]=m_highThresholdDiscriminator[i-j];
+        if (i-t0Shift>=m_totalNumberOfBins) break;
+        m_lowThresholdDiscriminator[i]=m_lowThresholdDiscriminator[i-t0Shift];
       }
-      for (int i=m_totalNumberOfBins+j; i<m_totalNumberOfBins; ++i) if (i>=0) m_highThresholdDiscriminator[i]=0; // the last j bins are set to zero
+      for (int i=m_totalNumberOfBins+t0Shift; i<m_totalNumberOfBins; ++i) if (i>=0) m_lowThresholdDiscriminator[i]=0; // the last t0Shift bins are set to zero
 
   } else {  // for positive shifts
 
       for (int i=m_totalNumberOfBins-1; i>0; --i) {
-        if (i-j<0) break;
-        m_highThresholdDiscriminator[i]=m_highThresholdDiscriminator[i-j];
+        if (i-t0Shift<0) break;
+        m_lowThresholdDiscriminator[i]=m_lowThresholdDiscriminator[i-t0Shift];
       }
-      for (int i=0; i<j; ++i) if (i<m_totalNumberOfBins) m_highThresholdDiscriminator[i]=0; // the first j bins are set to zero
+      for (int i=0; i<t0Shift; ++i) if (i<m_totalNumberOfBins) m_lowThresholdDiscriminator[i]=0; // the first t0Shift bins are set to zero
 
   }
 
-  //std::cout << "AJB " << getRegion(hitID) << " ";
-  //for (int i=0; i<m_totalNumberOfBins; ++i) std::cout <<  m_highThresholdDiscriminator[i];
-  //std::cout << std::endl;
-
   return;
 
 }
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.h
index 04e2c44a870a3c8a0219c944fb5a76720e98dacd..edea73cc39c200dcbbe866a11d95daac18a11708 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTElectronicsProcessing.h
@@ -72,10 +72,10 @@ public:
 			double highthreshold = -1.0
 		      );
 
-  double getHighThreshold ( int hitID, int strawGasType);
-  int getHTdeltaT0Shift   ( int hitID );
+  double getHighThreshold ( int hitID, int strawGasType );
   unsigned int getRegion  ( int hitID );
-  void HTdeltaShift       ( int hitID );
+  void LTt0Shift          ( int hitID, int strawGasType );
+  void HTt0Shift          ( int hitID );
 
 private:
   //NB copy-constructor and assignment operator declared, but not defined.
@@ -150,10 +150,10 @@ private:
   std::vector<double> m_lowThresholdSignalShape[3];
   std::vector<double> m_highThresholdSignalShape[3];
 
-  unsigned int m_maskA;   /**< mask - ever used? */
-  unsigned int m_maskB;   /**< mask - ever used? */
-  unsigned int m_maskC;   /**< mask - ever used? */
-  unsigned int m_maskHT;  /**< mask - ever used? */
+  // unsigned int m_maskA;   /**< mask - ever used? */
+  // unsigned int m_maskB;   /**< mask - ever used? */
+  // unsigned int m_maskC;   /**< mask - ever used? */
+  // unsigned int m_maskHT;  /**< mask - ever used? */
 
   // Deposit energy in timed bins before shaping.
   double* m_energyDistribution;
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.cxx b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.cxx
index 777b9eb456a67b77e39a5f60443172efe634e6f1..baf8e10606faf2dd0e5f8870a4264ec3e04d4212 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.cxx
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.cxx
@@ -24,7 +24,7 @@ TRTTimeCorrection::TRTTimeCorrection(const std::string& name,
 				     const TRTDigSettings* digset,
 				     const InDetDD::TRT_DetectorManager* detmgr,
 				     const TRT_ID* trt_id)
-  : m_settings(digset), m_detmgr(detmgr), m_trt_id(trt_id), 
+  : m_settings(digset), m_detmgr(detmgr), m_trt_id(trt_id),
     m_subdetectorMask(0x00200000), m_right5Bits(0x0000001F),
     m_shift5Bits(5), m_shift10Bits(10), m_shift15Bits(15), m_notInitVal(-999999.0), m_trtcaldbsvc("TRT_CalDbSvc",name), m_msg("TRTTimeCorrection")
 {
@@ -38,7 +38,6 @@ TRTTimeCorrection::~TRTTimeCorrection() {}
 //__________________________________________________________________________________________________________
 void TRTTimeCorrection::Initialize() {
 
-  
   m_signalPropagationSpeed = m_settings->signalPropagationSpeed() ;
   m_lengthDeadRegion = m_settings->lengthOfDeadRegion();
   m_maxVertexDisplacement = m_settings->maxVertexDisplacement();
@@ -48,10 +47,9 @@ void TRTTimeCorrection::Initialize() {
   if (msgLevel(MSG::VERBOSE)) msg(MSG::VERBOSE) << "TRTTimeCorrection::Initialize()" << endmsg;
 
   if ( (m_getT0FromData) && (m_trtcaldbsvc.retrieve().isFailure()) ) {
-    if (msgLevel(MSG::ERROR)) msg(MSG::ERROR) << "Could not find TRT_CalDbSvc => cannot use t0 of data. Will use overallT0Shift instead "<<endmsg; 
+    if (msgLevel(MSG::ERROR)) msg(MSG::ERROR) << "Could not find TRT_CalDbSvc => cannot use t0 of data." << endmsg;
     m_getT0FromData=false;
   }
-  
 
   const InDetDD::TRT_Numerology *numerology(m_detmgr->getNumerology());
 
@@ -93,27 +91,26 @@ void TRTTimeCorrection::Initialize() {
   //Initialize endcap direct/reflected distances array
   m_directDistsForEndCapWheels.assign(numerology->getNEndcapWheels(),m_notInitVal);
   m_reflectedDistsForEndCapWheels.assign(numerology->getNEndcapWheels(),m_notInitVal);
-  
+
 }
 
 //__________________________________________________________________________________________________________
 double TRTTimeCorrection::TimeShift(const int& strawID) {
-  
+
   //TODO: Use hit id helpers (but resolve efficiency issues first).
-  
+
   double timeshift=0.;
 
-    
   //Layer and phi index are needed for both endcap and barrel:
   const unsigned int iLayer((strawID >> m_shift5Bits) & m_right5Bits);
   const unsigned int iPhi(m_timeShiftPhiSectSymmetry ? 0 : ( (strawID >> m_shift10Bits) & m_right5Bits ));
 
   if (strawID & m_subdetectorMask) {
-    
+
     //===// EndCap //===//
-    
+
     const unsigned int iWheel((strawID >> m_shift15Bits) & m_right5Bits);
-    
+
     //Sanity check:
     if (iPhi>=m_timeShiftForEndCapPlanes.size()||
 	iWheel>=m_timeShiftForEndCapPlanes[iPhi].size()||
@@ -127,22 +124,22 @@ double TRTTimeCorrection::TimeShift(const int& strawID) {
       }
       return 0.0;
     }
-    
+
     timeshift = m_timeShiftForEndCapPlanes[iPhi][iWheel][iLayer];
-    
+
     if (timeshift==m_notInitVal) {
       //We need to initialize
-      timeshift = calculateTimeShift_EndCap(iPhi,iWheel,iLayer,strawID); 
+      timeshift = calculateTimeShift_EndCap(iPhi,iWheel,iLayer,strawID);
       m_timeShiftForEndCapPlanes[iPhi][iWheel][iLayer] = timeshift;
     }
-    
+
   } else {
-    
+
     //===// Barrel //===//
-    
+
     const unsigned int iRing((strawID >> m_shift15Bits) & m_right5Bits);
     const unsigned int iStraw(strawID & m_right5Bits);
-    
+
     //Sanity check:
     if (iPhi>=m_timeShiftForBarrelStraws.size()||
 	iRing>=m_timeShiftForBarrelStraws[iPhi].size()||
@@ -159,17 +156,17 @@ double TRTTimeCorrection::TimeShift(const int& strawID) {
       }
       return 0.0;
     }
-    
+
     timeshift = m_timeShiftForBarrelStraws[iPhi][iRing][iLayer][iStraw];
-    
+
     if (timeshift==m_notInitVal) {
       //We need to initialize
-      timeshift = calculateTimeShift_Barrel(iPhi,iRing,iLayer,iStraw,strawID); 
+      timeshift = calculateTimeShift_Barrel(iPhi,iRing,iLayer,iStraw,strawID);
 	m_timeShiftForBarrelStraws[iPhi][iRing][iLayer][iStraw] = timeshift;
     }
-    
+
   }
-  
+
   return timeshift;
 }
 
@@ -178,8 +175,8 @@ double TRTTimeCorrection::calculateTimeShift_Barrel( const unsigned int& iPhi,
 						     const unsigned int& iRing,
 						     const unsigned int& iLayer,
 						     const unsigned int& iStraw,
-						     const int strawID)  { 
-  
+						     const int strawID)  {
+
   const InDetDD::TRT_BarrelElement * barrel_element(m_detmgr->getBarrelElement(0/*positive*/,
 									       iRing, iPhi, iLayer ));
 
@@ -205,11 +202,7 @@ double TRTTimeCorrection::calculateTimeShift_Barrel( const unsigned int& iPhi,
   strawend1 = barrel_element->strawTransform(iStraw) * strawend1;
   strawend2 = barrel_element->strawTransform(iStraw) * strawend2;
 
-  //We need to figure out if we are in a short barrel straw or not. This
-  //is the easiest (not really that much of a hack if you think about it):
-  bool shortbarrel = barrel_element->strawLength() < 50*CLHEP::cm;
-
-  return calculateTimeShiftFromStrawEnds(strawend1,strawend2,strawID,shortbarrel);
+  return calculateTimeShiftFromStrawEnds(strawend1,strawend2,strawID);
 
 }
 
@@ -244,8 +237,7 @@ double TRTTimeCorrection::calculateTimeShift_EndCap( const unsigned int& iPhi,
 //__________________________________________________________________________________________________________
 double TRTTimeCorrection::calculateTimeShiftFromStrawEnds( const Amg::Vector3D& strawend1_globalcoord,
 							   const Amg::Vector3D& strawend2_globalcoord,
-							   const int strawID,
-							   const bool& shortbarrel)  { 
+							   const int strawID )  {
 
   //The two (hopefully relevant) extreme points of the vertex region:
   Amg::Vector3D vertexExtension1( m_settings->timeOffsetCalcVertexX(),
@@ -271,21 +263,22 @@ double TRTTimeCorrection::calculateTimeShiftFromStrawEnds( const Amg::Vector3D&
 						   <<" the electronics ends. This will give trouble elsewhere!!" << endmsg;
   }
 
-
-  double shift = 0.;
+  double shift = 1.0; // 1 ns (negative) overall shift for the whole TRT detector. Now set in stone.
+                      // Used to be set with overallT0Shift() & overallT0ShiftShortBarrel()
+                      // Note: if you change this then you need to set ToolSvc.InDetTRT_DriftFunctionTool.MCTuningShift
 
   if (m_settings->getT0FromData()) {
-    
     bool identifierOK;
     const Identifier idStraw(getIdentifier(strawID, identifierOK));
-    if (identifierOK)   shift = m_trtcaldbsvc->getT0(idStraw);
-    else { 
-      if (msgLevel(MSG::ERROR)) msg(MSG::ERROR)  << "Attempt to use t0 from data failed: TRTCalDbSvc was not able to supply t0 for straw with identifier: " << idStraw << ". Please set getT0FromData=false in jobOptions and run again" <<   endmsg;  }
-    
-  }  else { shift = m_settings->overallT0Shift() + ( shortbarrel ? m_settings->overallT0ShiftShortBarrel() : 0.0 );  }
-  
-
-  
+    if (identifierOK) {
+      shift = m_trtcaldbsvc->getT0(idStraw);
+    } else {
+      if (msgLevel(MSG::ERROR)) msg(MSG::ERROR)
+         << "Attempt to use t0 from data failed: TRTCalDbSvc was not able to supply t0 for straw with identifier: "
+         << idStraw << ". Please set getT0FromData=false in jobOptions and run again" << endmsg;
+    }
+  }
+
   if (m_settings->electronicsAreAtFarEnd())
     return std::max(mindisttoend1,mindisttoend2) / (m_settings->distanceToTimeFactor() * CLHEP::c_light) - shift;
   else
@@ -298,7 +291,7 @@ void TRTTimeCorrection::PropagationTime(const int& strawID, const double& meanZ,
 					double& propagationTime1, double& propagationTime2) {
 
   double direct_distance, reflect_distance;
-  
+
   if (strawID & m_subdetectorMask) {
 
     //===// EndCap //===//
@@ -394,7 +387,7 @@ void TRTTimeCorrection::calculateSignalDists_EndCap(const unsigned int& iWheel,
 
 //_____________________________________________________________________________
 Identifier TRTTimeCorrection::getIdentifier ( int hitID,
-					      bool & statusok)  
+					      bool & statusok)
 {
   statusok = true;
 
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.h
index edf135f0a2fb82697b420d390f97bbbdd4b290d0..ca6247e6f44e10db78e91bfd4ffb5d77704ed16e 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/TRTTimeCorrection.h
@@ -88,9 +88,8 @@ private:
 
   /** Time shift from straw endpoints in global system */
   double calculateTimeShiftFromStrawEnds( const Amg::Vector3D& strawend1_globalcoord,
-				     const Amg::Vector3D& strawend2_globalcoord,
-				     const int strawID,
-				     const bool& shortbarrel = false) ; //Note: Changed from const due to message service hick ups
+				          const Amg::Vector3D& strawend2_globalcoord,
+				          const int strawID) ;
   /**
    * Calculate the distance along the wire the signal travels before reaching
    * the electronics. Both the direct and reflected signal. The signal starts
@@ -123,7 +122,7 @@ private:
 
   /** Cached distances */
   std::vector<double> m_directDistsForEndCapWheels;
-  /** Cached distances */ 
+  /** Cached distances */
   std::vector<double> m_reflectedDistsForEndCapWheels;
   /** Cached distances */
   std::vector< std::vector<double> > m_directDistsForBarrelLayers;
diff --git a/InnerDetector/InDetDigitization/TRT_Digitization/src/driftCircle.h b/InnerDetector/InDetDigitization/TRT_Digitization/src/driftCircle.h
index cfe4cf0d6f31cc0eac3063dfdea9deeea5efa047..a2e55b13eae0fda7c6bb08f68bbda85c434574bf 100644
--- a/InnerDetector/InDetDigitization/TRT_Digitization/src/driftCircle.h
+++ b/InnerDetector/InDetDigitization/TRT_Digitization/src/driftCircle.h
@@ -6,6 +6,7 @@
 #define TRT_DRIFTCIRCLE_H
 
 // driftCircle.h
+// This local copy is only for development/debugging purposes
 // Adapted from TRT_DriftCircle.h
 // For basic tuning and development tests.
 // 13/10/2012 Andrew.Beddall@cern.ch
diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/CMakeLists.txt b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/CMakeLists.txt
index ea0451f42a1d29529fed5b47eee5e4b14d08cd0b..5cfcedd6d3edebb624d7532b22c6561ff82ef905 100644
--- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/CMakeLists.txt
+++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/CMakeLists.txt
@@ -16,7 +16,6 @@ atlas_depends_on_subdirs(
    Control/AthContainers
    Control/AthenaBaseComps
    Control/AthenaKernel
-   Control/CLIDSvc
    Control/SGTools
    Control/StoreGate
    Database/AthenaPOOL/AthenaPoolCnvSvc
diff --git a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetTrack.h b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetTrack.h
index 55bc47f6f2e9994976d990e789ecb8c600e5957c..94bc488e3d9c72fcaccf5f4e8b594f45c873a618 100644
--- a/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetTrack.h
+++ b/InnerDetector/InDetEventCnv/InDetEventAthenaPool/src/InDetTrack.h
@@ -6,7 +6,7 @@
 #define INDET_TRACK_H
 
 
-#include "CLIDSvc/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 
 
 class InDetTrack
diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/python/InDetDxAODJobProperties.py b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/python/InDetDxAODJobProperties.py
index a50d1f01cdad764175ee9087dba7967c66bfdab3..7b77e29c6908b32bbcf7b24a3f48c953188b4118 100644
--- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/python/InDetDxAODJobProperties.py
+++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/python/InDetDxAODJobProperties.py
@@ -74,14 +74,6 @@ class DumpUnassociatedHits(JobProperty):
     pass
 jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(DumpUnassociatedHits)
 
-class DumpLArCollisionTime(JobProperty):
-    """dump LAr collision time """
-    statusOn = True
-    allowedTypes = ["bool"]
-    StoredValue = True
-    pass
-jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(DumpLArCollisionTime)
-
 class DumpTruthInfo(JobProperty):
     """dump truth in fo """
     statusOn = True
diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/InDetDxAOD.py b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/InDetDxAOD.py
index 45d35002e408299c35098d0002bfe93d0627e125..de693a2ef776462a393a45245a7e0d286191736e 100644
--- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/InDetDxAOD.py
+++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/InDetDxAOD.py
@@ -30,9 +30,6 @@ dumpBytestreamErrors=InDetDxAODFlags.DumpByteStreamErrors() #True
 # Unassociated hits decorations
 dumpUnassociatedHits= InDetDxAODFlags.DumpUnassociatedHits() #True
 
-# Add LArCollisionTime augmentation tool
-dumpLArCollisionTime=InDetDxAODFlags.DumpLArCollisionTime() #True
-
 # Force to do not dump truth info if set to False
 #  (otherwise determined by autoconf below)
 dumpTruthInfo=InDetDxAODFlags.DumpTruthInfo() # True
@@ -484,25 +481,6 @@ if dumpUnassociatedHits:
         print unassociatedHitsDecorator
         print unassociatedHitsDecorator.properties()
 
-# Add LArCollisionTime augmentation tool
-if dumpLArCollisionTime:
-    from LArCellRec.LArCollisionTimeGetter import LArCollisionTimeGetter
-    from RecExConfig.ObjKeyStore           import cfgKeyStore
-    # We can only do this if we have the cell container.
-    if cfgKeyStore.isInInput ('CaloCellContainer', 'AllCalo'):
-        LArCollisionTimeGetter (IDDerivationSequence)
-
-        from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__LArCollisionTimeDecorator
-        lArCollisionTimeDecorator = DerivationFramework__LArCollisionTimeDecorator (name ='lArCollisionTimeDecorator',
-                                                                                    ContainerName = "EventInfo",
-                                                                                    DecorationPrefix = prefixName+"LArCollTime_",
-                                                                                    OutputLevel =INFO)
-        ToolSvc += lArCollisionTimeDecorator
-        augmentationTools+=[lArCollisionTimeDecorator]
-        if (printIdTrkDxAODConf):
-            print lArCollisionTimeDecorator
-            print lArCollisionTimeDecorator.properties()
-
 # Add decoration with truth parameters if running on simulation
 if isIdTrkDxAODSimulation:
     from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParametersForTruthParticles
diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx
index d805d0d6c80e5f9c76b88e4918dca0a531df82d5..f0aabb3cb2761852d5941016cb2dd229d6e40772 100644
--- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx
+++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx
@@ -120,7 +120,13 @@ StatusCode PixelPrepDataToxAOD::execute()
 {
   //Mandatory. Require if the algorithm is scheduled.
   SG::ReadHandle<InDet::PixelClusterContainer> PixelClusterContainer(m_clustercontainer_key);
-
+  
+  if ( !PixelClusterContainer.isValid() )
+  {
+      ATH_MSG_ERROR("Failed to retrieve PixelClusterContainer with key" << PixelClusterContainer.key() );
+      return StatusCode::FAILURE;
+  }
+  
   // Create the xAOD container and its auxiliary store:
   SG::WriteHandle<xAOD::TrackMeasurementValidationContainer> xaod(m_write_xaod);
   ATH_CHECK(xaod.record(std::make_unique<xAOD::TrackMeasurementValidationContainer>(),
@@ -132,7 +138,7 @@ StatusCode PixelPrepDataToxAOD::execute()
   // Loop over the container
   unsigned int counter(0);
   
-  for( const auto& clusterCollection : *PixelClusterContainer){
+  for( const auto& clusterCollection : * PixelClusterContainer ){
 
     //Fill Offset container
     (*offsets)[clusterCollection->identifyHash()] = counter;
@@ -215,7 +221,7 @@ StatusCode PixelPrepDataToxAOD::execute()
       AUXDATA(xprd,float,splitProbability2)  =  prd->splitProbability2(); 
 
       // Need to add something to Add the NN splitting information
-      if(m_writeNNinformation)addNNInformation( xprd,  prd, 7, 7);
+      if(m_writeNNinformation) addNNInformation( xprd,  prd, 7, 7);
       
       // Add information for each contributing hit
       if(m_writeRDOinformation) {
@@ -259,30 +265,44 @@ StatusCode PixelPrepDataToxAOD::execute()
       //  Also get the energy deposited by each true particle per readout element   
       if(m_writeSDOs) {
 	SG::ReadHandle<InDetSimDataCollection> sdoCollection(m_SDOcontainer_key);
-	sdo_tracks = addSDOInformation(xprd, prd, *sdoCollection);
+	if ( sdoCollection.isValid() )
+	{
+	    sdo_tracks = addSDOInformation(xprd, prd, *sdoCollection);
+	}
+	else if ( m_firstEventWarnings )
+	{
+	    ATH_MSG_WARNING("SDO information requested, but SDO collection not available!");
+	}
       }
     
       // Now Get the most detailed truth from the SiHits
       // Note that this could get really slow if there are a lot of hits and clusters
       if (m_need_sihits) {
 	SG::ReadHandle<SiHitCollection> sihitCollection(m_sihitContainer_key);
-	const std::vector<SiHit> matched_hits = findAllHitsCompatibleWithCluster(prd, *sihitCollection, sdo_tracks);
-	  
-	if (m_writeSiHits) {
-	  if (!m_writeSDOs)
-	    ATH_MSG_WARNING("Si hit truth information requested, but SDO collection not available!");
-	  addSiHitInformation(xprd, prd, matched_hits); 
+	if ( sihitCollection.isValid() )
+	{
+	    const std::vector<SiHit> matched_hits = findAllHitsCompatibleWithCluster(prd, *sihitCollection, sdo_tracks);
+	    
+	    if (m_writeSiHits) {
+		if (!m_writeSDOs)
+		    ATH_MSG_WARNING("Si hit truth information requested, but SDO collection not available!");
+		addSiHitInformation(xprd, prd, matched_hits); 
+	    }
+	    
+	    if (m_writeNNinformation) {
+		if (!m_writeSDOs)
+		    ATH_MSG_WARNING("Si hit truth information requested, but SDO collection not available!");
+		addNNTruthInfo(xprd, prd, matched_hits);
+	    }
 	}
-
-	if (m_writeNNinformation) {
-	  if (!m_writeSDOs)
-	    ATH_MSG_WARNING("Si hit truth information requested, but SDO collection not available!");
-	  addNNTruthInfo(xprd, prd, matched_hits);
+	else if ( m_firstEventWarnings )
+	{
+	    ATH_MSG_WARNING("SiHit information requested, but SiHit collection not available!");
 	}
       }
     }
   }
-
+  
   for ( auto clusItr = xaod->begin(); clusItr != xaod->end(); clusItr++ ) {
       AUXDATA(*clusItr,char,broken) = false;
   }
diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx
index e940bd8a95fc7e8a34186a45af19b3e75b743c6a..71a457e966790b123b9653f92e3bbc2438ac3d33 100644
--- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx
+++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/SCT_PrepDataToxAOD.cxx
@@ -96,39 +96,31 @@ StatusCode SCT_PrepDataToxAOD::execute()
 {     
   // the cluster ambiguity map
   if ( m_writeRDOinformation ) {
-    SG::ReadHandle<SCT_RDO_Container> rdoContainer(m_rdoContainer);
-    if(!evtStore()->contains<SCT_RDO_Container>(m_rdoContainer.key())){
-      if (m_firstEventWarnings) {
-	ATH_MSG_WARNING("RDO ASSOC: No SCT RDO container in StoreGate");
+      SG::ReadHandle<SCT_RDO_Container> rdoContainer(m_rdoContainer);
+      if( rdoContainer.isValid() )
+      {	
+	  // get all the RIO_Collections in the container
+	  for(const auto& collection: *rdoContainer ){
+	      
+	      //get all the RDOs in the collection
+	      for (const auto& rdo : *collection) {
+		  
+		  if ( !rdo) {
+		      ATH_MSG_WARNING( "Null SCT RDO. Skipping it");
+		      continue;
+		  }
+		  
+		  Identifier rdoId = rdo->identify();
+		  
+		  m_IDtoRAWDataMap.insert( std::pair< Identifier, const SCT_RDORawData*>( rdoId, rdo ) );      
+	      } // collection
+	  } // Have container;
       }
-    }
-    else {
-      if(not rdoContainer.isValid()) {
-        ATH_MSG_WARNING( "Failed to retrieve SCT RDO container" );
+      else if ( m_firstEventWarnings )
+      {
+	  ATH_MSG_WARNING( "Failed to retrieve SCT RDO container" );
       }
-    }
-  
-    if ( &*rdoContainer != 0){
-
-      // get all the RIO_Collections in the container
-      
-      for(const auto& collection: *rdoContainer ){
-
-        //get all the RDOs in the collection
-        for (const auto& rdo : *collection) {
-
-          if ( !rdo) {
-            ATH_MSG_WARNING( "Null SCT RDO. Skipping it");
-            continue;
-          }
-
-          Identifier rdoId = rdo->identify();
-	  
-          m_IDtoRAWDataMap.insert( std::pair< Identifier, const SCT_RDORawData*>( rdoId, rdo ) );      
-        } // collection
-      } // container
-    } // Have container;
-  }   
+  }
   ATH_MSG_DEBUG("Size of RDO map is "<<m_IDtoRAWDataMap.size());
 
   // Mandatory. This is needed and required if this algorithm is scheduled.
diff --git a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx
index ade5381e903e1e865dc1ce5b69302c7d91bb0b58..80385180e8e81d36c8971282b93269835b9f8d61 100644
--- a/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx
+++ b/InnerDetector/InDetEventCnv/SCT_RawDataByteStreamCnv/src/SCT_RodDecoder.cxx
@@ -904,7 +904,7 @@ int SCT_RodDecoder::makeRDO(int strip, int groupSize, int tbin, uint32_t onlineI
 
 
   SCT_RDO_Collection* col = nullptr;
-  ATH_CHECK(rdoIdc.naughtyRetrieve(idCollHash, col));//Returns null if not present
+  ATH_CHECK(rdoIdc.naughtyRetrieve(idCollHash, col), 0);//Returns null if not present
 
   if(!col){
     ATH_MSG_DEBUG(" Collection ID = " << idCollHash << " does not exist, create it ");
diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecNtupleCreation.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecNtupleCreation.py
index b3135009493bf6e19c4a9ef8e0196ecb8d5dc9db..c836e7d344b312f40ca662ea6a86a85a557493f4 100644
--- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecNtupleCreation.py
+++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecNtupleCreation.py
@@ -369,7 +369,26 @@ if InDetFlags.doStandardPlots():
 #        print InDetStandardPerformanceDBM
         
     InDetTrackPerfMonManager.AthenaMonTools += [ InDetStandardPerformanceAll ]
-    
+        
+  #monitoring truth-/pseudo-tracks in particular
+    if InDetFlags.doPseudoTracking() :
+      InDetStandardPerformancePseudoTracks = InDetStandardPerformance (name               = "InDetStandardPerformancePseudoTracks",
+                                                                       tracksName         = InDetKeys.PseudoTracks(),
+                                                                       tracksTruthName    = InDetKeys.PseudoTracksTruth(),
+                                                                       SummaryTool        = InDetTrackSummaryToolSharedHits,
+                                                                       HoleSearch         = InDetHoleSearchTool,
+                                                                       useTrackSelection  = False,
+                                                                       HistDirectoryName  = "PseudoTracksTracks",
+                                                                       TruthToTrackTool   = TruthToTrackTool,
+                                                                       doUpgrade          = InDetFlags.doSLHC(),
+                                                                       DoTruth            = InDetFlags.doTruth())
+      if InDetFlags.doSplitReco() :
+        InDetStandardPerformancePseudoTracks.TruthParticleContainerName = "TruthEvent_PU"
+      ToolSvc += InDetStandardPerformancePseudoTracks
+      if (InDetFlags.doPrintConfigurables()):
+        print    InDetStandardPerformancePseudoTracks
+      InDetTrackPerfMonManager.AthenaMonTools += [ InDetStandardPerformancePseudoTracks ]
+
     # selected tracks passing good quality cuts
     if not (InDetFlags.doDBMstandalone() or InDetFlags.doDBM()):
       InDetStandardPerformanceGood = InDetStandardPerformance (name                = "InDetStandardPerformanceGood",
@@ -481,6 +500,15 @@ if InDetFlags.doPhysValMon():
     print InDetPhysValMonTool
 #    if InDetFlags.doDBM():
 #      print InDetPhysValMonToolDBM
+#monitoring pile-up particles separately if splitReco is used (fast chain)
+  if InDetFlags.doSplitReco():
+    InDetPhysValMonToolPU = InDetPhysValMonitoringTool (useTrackSelection   = True,
+                                                        TrackSelectionTool   = InDetTrackSelectorTool,
+                                                        TruthParticleContainerName = "SpclMCPU")
+    ToolSvc += InDetPhysValMonToolPU
+    InDetPhysValMonManager.AthenaMonTools += [InDetPhysValMonToolPU]
+    if (InDetFlags.doPrintConfigurables()):
+      print InDetPhysValMonToolPU	
 
   # --- Setup the output histogram file(s)
   if not hasattr(ServiceMgr, 'THistSvc'):
diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx
index 0803da7e85672bd71bc4c214beaffa808e5dbde0..03c5d3dc71f45cc7cfd7198ce1a9a86a9600ce06 100755
--- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx
+++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonGenericTracks.cxx
@@ -1781,7 +1781,7 @@ StatusCode IDAlignMonGenericTracks::fillHistograms()
       StatusCode sc = evtStore()->retrieve(vxContainer, m_VxPrimContainerName);
       if (sc.isFailure()) {
 	ATH_MSG_DEBUG("Could not retrieve primary vertex info: " << m_VxPrimContainerName);
-	return false;
+	return StatusCode::FAILURE;
       }
       if(vxContainer) {
 	ATH_MSG_VERBOSE("Nb of reco primary vertex for coll "
diff --git a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx
index 5e507e3a0223e063a400b8f87d16a436ba90184d..4a1c36dcfd8f9ad062e21c47501b811b40379e90 100644
--- a/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx
+++ b/InnerDetector/InDetMonitoring/InDetDiMuonMonitoring/src/DiMuMon.cxx
@@ -321,7 +321,7 @@ StatusCode DiMuMon::fillHistograms()
     double idTrkPt(0),ptSum(0);
     float iso_pt40(0);
     if( !muon->isolation(iso_pt40, xAOD::Iso::ptcone40) ) {
-      return false;
+      return StatusCode::FAILURE;
     }
     else {
       idTrkPt = idTrk->pt();
diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalHitsMonTool.cxx b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalHitsMonTool.cxx
index 776c3d7474a348f6809cec1aa8c0c9772e0d3384..4f66e43ca9ce36b12808e8bd58872249a606205d 100755
--- a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalHitsMonTool.cxx
+++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalHitsMonTool.cxx
@@ -150,61 +150,61 @@ StatusCode InDetGlobalHitsMonTool::bookHistogramsRecurrent()
   
 
     //--- ID histograms
-    status &= registerHist( monGr_shift,  m_ID_hitmap_x_y = TH2F_LW::create("m_ID_hitmap_x_y","Map of ID hits (BARREL) in x vs y (mm)",400,-1100,1100,400,-1100,1100));
-    status &= registerHist( monGr_shift,  m_ID_hitmap_x_y_eca = TH2F_LW::create("m_ID_hitmap_x_y_eca","Map of ID hits (ECA) in x vs y (mm)",400,-1100,1100,400,-1100,1100));
-    status &= registerHist( monGr_shift,  m_ID_hitmap_x_y_ecc = TH2F_LW::create("m_ID_hitmap_x_y_ecc","Map of ID hits (ECC) in x vs y (mm)",400,-1100,1100,400,-1100,1100));
-    status &= registerHist( monGr_shift,  m_ID_hitmap_z_x = TH2F_LW::create("m_ID_hitmap_z_x","Map of ID hits in z vs x (mm)",1000,-3100,3100,300,-1100,1100));
-    status &= registerHist( monGr_shift,  m_ID_hitmap_z_r = TH2F_LW::create("m_ID_hitmap_z_r","Map of ID hits in z vs r (mm)",3000,-3100,3100,1100,0,1100));
-    status &= registerHist( monGr_shift,  m_ID_holes = TH2I_LW::create("m_ID_holes","Number of ID holes on tracks in the subdetectors",2,0,2,3,0,3));
+    status &= registerHist( monGr_shift,  m_ID_hitmap_x_y = TH2F_LW::create("m_ID_hitmap_x_y","Map of ID hits (BARREL) in x vs y (mm)",400,-1100,1100,400,-1100,1100)).isSuccess();
+    status &= registerHist( monGr_shift,  m_ID_hitmap_x_y_eca = TH2F_LW::create("m_ID_hitmap_x_y_eca","Map of ID hits (ECA) in x vs y (mm)",400,-1100,1100,400,-1100,1100)).isSuccess();
+    status &= registerHist( monGr_shift,  m_ID_hitmap_x_y_ecc = TH2F_LW::create("m_ID_hitmap_x_y_ecc","Map of ID hits (ECC) in x vs y (mm)",400,-1100,1100,400,-1100,1100)).isSuccess();
+    status &= registerHist( monGr_shift,  m_ID_hitmap_z_x = TH2F_LW::create("m_ID_hitmap_z_x","Map of ID hits in z vs x (mm)",1000,-3100,3100,300,-1100,1100)).isSuccess();
+    status &= registerHist( monGr_shift,  m_ID_hitmap_z_r = TH2F_LW::create("m_ID_hitmap_z_r","Map of ID hits in z vs r (mm)",3000,-3100,3100,1100,0,1100)).isSuccess();
+    status &= registerHist( monGr_shift,  m_ID_holes = TH2I_LW::create("m_ID_holes","Number of ID holes on tracks in the subdetectors",2,0,2,3,0,3)).isSuccess();
     
     //--- Pixel histograms
-    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_nSCThits = TH2I_LW::create("m_Trk_nPIXhits_nSCThits","Number of SCT hits vs Pixel hits",13,-0.5,12.5,31,-0.5,30.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nPixhits_SCTTRTPixFid = TH1I_LW::create("m_Trk_nPixhits_SCTTRTPixFid","Number of Pixel hits per track with a least one hit in the other sub-detectors and going through the fiducial layer",11,-0.5,10.5));
-    status &= registerHist( monGr_shift,  m_Trk_nSihits_nTRThits = TH2I_LW::create("m_Trk_nSihits_nTRThits","Number of Silicon hits vs TRT hits",100,0.5,100.5,31,-0.5,30.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nSCThits_nTRThits = TH2I_LW::create("m_Trk_nSCThits_nTRThits","Number of SCT hits vs TRT hits",100,0.5,100.5,31,-0.5,30.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nPIXhits = TH1I_LW::create("m_Trk_nPIXhits","Number of Pixel hits per track",13,-0.5,12.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_EA = TH1I_LW::create("m_Trk_nPIXhits_EA","Number of Pixel hits per track (ECA)",13,-0.5,12.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_TA = TH1I_LW::create("m_Trk_nPIXhits_TA","Number of Pixel hits per track (Transition region A)",13,-0.5,12.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_B = TH1I_LW::create("m_Trk_nPIXhits_B","Number of Pixel hits per track (Barrel)",13,-0.5,12.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_TC = TH1I_LW::create("m_Trk_nPIXhits_TC","Number of Pixel hits per track (Transition region C)",13,-0.5,12.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_EC = TH1I_LW::create("m_Trk_nPIXhits_EC","Number of Pixel hits per track (ECC)",13,-0.5,12.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_eta = TProfile_LW::create("m_Trk_nPIXhits_eta","Number of Pixel hits per track, as a function of eta",25,-2.5,2.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_phi = TProfile_LW::create("m_Trk_nPIXhits_phi","Number of Pixel hits per track, as a function of phi",30,-3.2,3.2)); 
-    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_eta_phi = new TProfile2D("m_Trk_nPIXhits_eta_phi","Number of Pixel hits per track, eta-phi profile",25,-2.5,2.5,30,-3.2,3.2)); 
-    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_fidusial = TH1I_LW::create("m_Trk_nPIXhits_fiducial","Number of Pixel hits per track for tracks with |d0|<5cm and |z0|<1.4m",12,0.5,12.5));
-    status &= registerHist( monGr_exp , m_Trk_nPIXhits_1trk = TH1I_LW::create("m_Trk_nPIXhits_1trk","Number of Pixel hits per track - only 1 track per event",12,0.5,12.5));
+    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_nSCThits = TH2I_LW::create("m_Trk_nPIXhits_nSCThits","Number of SCT hits vs Pixel hits",13,-0.5,12.5,31,-0.5,30.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nPixhits_SCTTRTPixFid = TH1I_LW::create("m_Trk_nPixhits_SCTTRTPixFid","Number of Pixel hits per track with a least one hit in the other sub-detectors and going through the fiducial layer",11,-0.5,10.5)).isSuccess();
+    status &= registerHist( monGr_shift,  m_Trk_nSihits_nTRThits = TH2I_LW::create("m_Trk_nSihits_nTRThits","Number of Silicon hits vs TRT hits",100,0.5,100.5,31,-0.5,30.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nSCThits_nTRThits = TH2I_LW::create("m_Trk_nSCThits_nTRThits","Number of SCT hits vs TRT hits",100,0.5,100.5,31,-0.5,30.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nPIXhits = TH1I_LW::create("m_Trk_nPIXhits","Number of Pixel hits per track",13,-0.5,12.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_EA = TH1I_LW::create("m_Trk_nPIXhits_EA","Number of Pixel hits per track (ECA)",13,-0.5,12.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_TA = TH1I_LW::create("m_Trk_nPIXhits_TA","Number of Pixel hits per track (Transition region A)",13,-0.5,12.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_B = TH1I_LW::create("m_Trk_nPIXhits_B","Number of Pixel hits per track (Barrel)",13,-0.5,12.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_TC = TH1I_LW::create("m_Trk_nPIXhits_TC","Number of Pixel hits per track (Transition region C)",13,-0.5,12.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_EC = TH1I_LW::create("m_Trk_nPIXhits_EC","Number of Pixel hits per track (ECC)",13,-0.5,12.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_eta = TProfile_LW::create("m_Trk_nPIXhits_eta","Number of Pixel hits per track, as a function of eta",25,-2.5,2.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_phi = TProfile_LW::create("m_Trk_nPIXhits_phi","Number of Pixel hits per track, as a function of phi",30,-3.2,3.2)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_eta_phi = new TProfile2D("m_Trk_nPIXhits_eta_phi","Number of Pixel hits per track, eta-phi profile",25,-2.5,2.5,30,-3.2,3.2)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nPIXhits_fidusial = TH1I_LW::create("m_Trk_nPIXhits_fiducial","Number of Pixel hits per track for tracks with |d0|<5cm and |z0|<1.4m",12,0.5,12.5)).isSuccess();
+    status &= registerHist( monGr_exp , m_Trk_nPIXhits_1trk = TH1I_LW::create("m_Trk_nPIXhits_1trk","Number of Pixel hits per track - only 1 track per event",12,0.5,12.5)).isSuccess();
       
     //--- SCT histograms
-    status &= registerHist( monGr_shift,  m_Trk_nSCThits = TH1I_LW::create("m_Trk_nSCThits","Number of SCT hits per track",31,-0.5,30.5));
-    status &= registerHist( monGr_shift,  m_Trk_nSCThits_EA = TH1I_LW::create("m_Trk_nSCThits_EA","Number of SCT hits per track (ECA)",31,-0.5,30.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nSCThits_TA = TH1I_LW::create("m_Trk_nSCThits_TA","Number of SCT hits per track (Transition region A)",31,-0.5,30.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nSCThits_B = TH1I_LW::create("m_Trk_nSCThits_B","Number of SCT hits per track (Barrel)",31,-0.5,30.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nSCThits_TC = TH1I_LW::create("m_Trk_nSCThits_TC","Number of SCT hits per track (Transition region C)",31,-0.5,30.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nSCThits_EC = TH1I_LW::create("m_Trk_nSCThits_EC","Number of SCT hits per track (ECC)",31,-0.5,30.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nSCThits_eta = TProfile_LW::create("m_Trk_nSCThits_eta","Number of SCT hits per track, as a function of eta",25,-2.5,2.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nSCThits_phi = TProfile_LW::create("m_Trk_nSCThits_phi","Number of SCT hits per track, as a function of phi",30,-3.2,3.2)); 
-    status &= registerHist( monGr_shift,  m_Trk_nSCThits_eta_phi = new TProfile2D("m_Trk_nSCThits_eta_phi","Number of SCT hits per track, eta-phi profile",25,-2.5,2.5,30,-3.2,3.2)); 
-    status &= registerHist( monGr_shift,  m_Trk_nSCThits_pt = TH2I_LW::create("m_Trk_nSCThits_pt", "Number of SCT hits per track by vs track P_{T}",50,-0.,10,30,0.5,30.5));
-    status &= registerHist( monGr_shift,  m_Trk_nSCThits_PixTRT = TH1I_LW::create("m_Trk_nSCThits_PixTRT","Number of SCT hits per track, with at least one hit in the other subdetectors",31,-0.5,30.5));
-    status &= registerHist( monGr_exp , m_Trk_nSCThits_1trk = TH1I_LW::create("m_Trk_nSCThits_1trk","Number of SCT hits per track - only 1 track per event",30,0.5,30.5));
-    status &= registerHist( monGr_shift,  m_Trk_nSCThits_withPix = TH1I_LW::create("m_Trk_nSCThits_withPix","number of SCT hits for tracks which have Pixel hit",31,-0.5,30.5));    
+    status &= registerHist( monGr_shift,  m_Trk_nSCThits = TH1I_LW::create("m_Trk_nSCThits","Number of SCT hits per track",31,-0.5,30.5)).isSuccess();
+    status &= registerHist( monGr_shift,  m_Trk_nSCThits_EA = TH1I_LW::create("m_Trk_nSCThits_EA","Number of SCT hits per track (ECA)",31,-0.5,30.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nSCThits_TA = TH1I_LW::create("m_Trk_nSCThits_TA","Number of SCT hits per track (Transition region A)",31,-0.5,30.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nSCThits_B = TH1I_LW::create("m_Trk_nSCThits_B","Number of SCT hits per track (Barrel)",31,-0.5,30.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nSCThits_TC = TH1I_LW::create("m_Trk_nSCThits_TC","Number of SCT hits per track (Transition region C)",31,-0.5,30.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nSCThits_EC = TH1I_LW::create("m_Trk_nSCThits_EC","Number of SCT hits per track (ECC)",31,-0.5,30.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nSCThits_eta = TProfile_LW::create("m_Trk_nSCThits_eta","Number of SCT hits per track, as a function of eta",25,-2.5,2.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nSCThits_phi = TProfile_LW::create("m_Trk_nSCThits_phi","Number of SCT hits per track, as a function of phi",30,-3.2,3.2)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nSCThits_eta_phi = new TProfile2D("m_Trk_nSCThits_eta_phi","Number of SCT hits per track, eta-phi profile",25,-2.5,2.5,30,-3.2,3.2)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nSCThits_pt = TH2I_LW::create("m_Trk_nSCThits_pt", "Number of SCT hits per track by vs track P_{T}",50,-0.,10,30,0.5,30.5)).isSuccess();
+    status &= registerHist( monGr_shift,  m_Trk_nSCThits_PixTRT = TH1I_LW::create("m_Trk_nSCThits_PixTRT","Number of SCT hits per track, with at least one hit in the other subdetectors",31,-0.5,30.5)).isSuccess();
+    status &= registerHist( monGr_exp , m_Trk_nSCThits_1trk = TH1I_LW::create("m_Trk_nSCThits_1trk","Number of SCT hits per track - only 1 track per event",30,0.5,30.5)).isSuccess();
+    status &= registerHist( monGr_shift,  m_Trk_nSCThits_withPix = TH1I_LW::create("m_Trk_nSCThits_withPix","number of SCT hits for tracks which have Pixel hit",31,-0.5,30.5)).isSuccess();    
     //--- TRT histograms
-    status &= registerHist( monGr_shift,  m_Trk_nTRThits = TH1I_LW::create("m_Trk_nTRThits","Number of TRT hits per track",100,0.5,100.5));
-    status &= registerHist( monGr_shift,  m_Trk_nTRThits_EA = TH1I_LW::create("m_Trk_nTRThits_EA","Number of TRT hits per track (ECA)",100,0.5,100.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nTRThits_TA = TH1I_LW::create("m_Trk_nTRThits_TA","Number of TRT hits per track (Transition region A)",100,0.5,100.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nTRThits_B = TH1I_LW::create("m_Trk_nTRThits_B","Number of TRT hits per track (Barrel)",100,0.5,100.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nTRThits_TC = TH1I_LW::create("m_Trk_nTRThits_TC","Number of TRT hits per track (Transition region C)",100,0.5,100.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nTRThits_EC = TH1I_LW::create("m_Trk_nTRThits_EC","Number of TRT hits per track (ECC)",100,0.5,100.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nTRThits_eta = TProfile_LW::create("m_Trk_nTRThits_eta","Number of TRT hits per track, as a function of eta",30,-3.5,3.5)); 
-    status &= registerHist( monGr_shift,  m_Trk_nTRThits_phi = TProfile_LW::create("m_Trk_nTRThits_phi","Number of TRT hits per track, as a function of phi",30,-3.2,3.2)); 
-    status &= registerHist( monGr_shift,  m_Trk_nTRThits_eta_phi = new TProfile2D("m_Trk_nTRThits_eta_phi","Number of TRT hits per track, eta-phi profile",25,-2.5,2.5,30,-3.2,3.2)); 
+    status &= registerHist( monGr_shift,  m_Trk_nTRThits = TH1I_LW::create("m_Trk_nTRThits","Number of TRT hits per track",100,0.5,100.5)).isSuccess();
+    status &= registerHist( monGr_shift,  m_Trk_nTRThits_EA = TH1I_LW::create("m_Trk_nTRThits_EA","Number of TRT hits per track (ECA)",100,0.5,100.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nTRThits_TA = TH1I_LW::create("m_Trk_nTRThits_TA","Number of TRT hits per track (Transition region A)",100,0.5,100.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nTRThits_B = TH1I_LW::create("m_Trk_nTRThits_B","Number of TRT hits per track (Barrel)",100,0.5,100.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nTRThits_TC = TH1I_LW::create("m_Trk_nTRThits_TC","Number of TRT hits per track (Transition region C)",100,0.5,100.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nTRThits_EC = TH1I_LW::create("m_Trk_nTRThits_EC","Number of TRT hits per track (ECC)",100,0.5,100.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nTRThits_eta = TProfile_LW::create("m_Trk_nTRThits_eta","Number of TRT hits per track, as a function of eta",30,-3.5,3.5)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nTRThits_phi = TProfile_LW::create("m_Trk_nTRThits_phi","Number of TRT hits per track, as a function of phi",30,-3.2,3.2)).isSuccess(); 
+    status &= registerHist( monGr_shift,  m_Trk_nTRThits_eta_phi = new TProfile2D("m_Trk_nTRThits_eta_phi","Number of TRT hits per track, eta-phi profile",25,-2.5,2.5,30,-3.2,3.2)).isSuccess(); 
 
-    status &= registerHist( monGr_shift,  m_Trk_nTRThits_PixSCT = TH1I_LW::create("m_Trk_nTRThits_PixSCT","Number of TRT hits per track, with at least one hit in other subdetectors",100,-0.5,100.5));
-    status &= registerHist( monGr_shift,  m_Trk_nTRTHLhits = TH1I_LW::create("m_Trk_nTRTHLhits","Number of high level TRT hits per track",30,0.5,30.5));
-    status &= registerHist( monGr_shift,  m_Trk_nTRTLLhits = TH1I_LW::create("m_Trk_nTRTLLhits","Number of low level TRT hits per track",80,0.5,80.5));
-    status &= registerHist( monGr_shift,  m_Trk_nTRThits_withSi = TH1I_LW::create("m_Trk_nTRThits_withSi","Number of TRT hits for tracks with both Pixel and SCT hits",100,0.5,100.5));
-    status &= registerHist( monGr_exp , m_Trk_nTRTHLhits_1trk = TH1I_LW::create("m_Trk_nHL_1trk","Number of high level TRT hits per track - only 1 track per event",30,0.5,30.5));
-    status &= registerHist( monGr_exp , m_Trk_nTRTLLhits_1trk = TH1I_LW::create("m_Trk_nLL_1trk","Number of low level TRT hits per track - only 1 track per event",80,0.5,80.5));
+    status &= registerHist( monGr_shift,  m_Trk_nTRThits_PixSCT = TH1I_LW::create("m_Trk_nTRThits_PixSCT","Number of TRT hits per track, with at least one hit in other subdetectors",100,-0.5,100.5)).isSuccess();
+    status &= registerHist( monGr_shift,  m_Trk_nTRTHLhits = TH1I_LW::create("m_Trk_nTRTHLhits","Number of high level TRT hits per track",30,0.5,30.5)).isSuccess();
+    status &= registerHist( monGr_shift,  m_Trk_nTRTLLhits = TH1I_LW::create("m_Trk_nTRTLLhits","Number of low level TRT hits per track",80,0.5,80.5)).isSuccess();
+    status &= registerHist( monGr_shift,  m_Trk_nTRThits_withSi = TH1I_LW::create("m_Trk_nTRThits_withSi","Number of TRT hits for tracks with both Pixel and SCT hits",100,0.5,100.5)).isSuccess();
+    status &= registerHist( monGr_exp , m_Trk_nTRTHLhits_1trk = TH1I_LW::create("m_Trk_nHL_1trk","Number of high level TRT hits per track - only 1 track per event",30,0.5,30.5)).isSuccess();
+    status &= registerHist( monGr_exp , m_Trk_nTRTLLhits_1trk = TH1I_LW::create("m_Trk_nLL_1trk","Number of low level TRT hits per track - only 1 track per event",80,0.5,80.5)).isSuccess();
     
     // Fix the labels for the holes histogram
     LWHist::LWHistAxis *xaxis = m_ID_holes->GetXaxis();
diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalNoiseOccupancyMonTool.cxx b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalNoiseOccupancyMonTool.cxx
index 416c94c6af93b2056eaaa3538ae4ba5bdf29b8b2..c113f7ecbaeeeb9c43228e45cd40e2142fdadcf2 100755
--- a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalNoiseOccupancyMonTool.cxx
+++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalNoiseOccupancyMonTool.cxx
@@ -162,13 +162,13 @@ StatusCode InDetGlobalNoiseOccupancyMonTool::bookHistogramsRecurrent()
 	//--- ID histograms---------------------
 	status &= registerHist( monGr_shift,  m_SCT_TRT_NO =
 				       TH2F_LW::create("m_SCT_TRT_NO","TRT noise occupancy vs SCT noise occupancy",
-						       m_sct_nBins,0,m_sctMax, m_trt_nBins,0,m_trtMax));
+						       m_sct_nBins,0,m_sctMax, m_trt_nBins,0,m_trtMax)).isSuccess();
 	status &= registerHist( monGr_shift,  m_SCT_PIX_NO =
 				       TH2F_LW::create("m_SCT_PIX_NO","Pixel noise occupancy vs SCT noise occupancy",
-						       m_sct_nBins, 0, m_sctMax, m_pixel_nBins, 0, m_pixelMax));
+						       m_sct_nBins, 0, m_sctMax, m_pixel_nBins, 0, m_pixelMax)).isSuccess();
 	status &= registerHist( monGr_shift,  m_PIX_TRT_NO = 
 				       TH2F_LW::create("m_PIX_TRT_NO","TRT noise occupancy vs Pixel noise occupancy",
-						       m_pixel_nBins, 0, m_pixelMax, m_trt_nBins, 0, m_trtMax));
+						       m_pixel_nBins, 0, m_pixelMax, m_trt_nBins, 0, m_trtMax)).isSuccess();
 
 	/*
 	 * combined NO histos using correlation coefficient
@@ -178,103 +178,103 @@ StatusCode InDetGlobalNoiseOccupancyMonTool::bookHistogramsRecurrent()
 	status &= registerHist( monGr_shift,  m_TRT_SCTvTRT_PIX_10evt =
 				       TH2F_LW::create("m_TRT_SCTvTRT_PIX_10evt",
 						       "TRT,SCT, PIX combined "
-						       "occupancy",100,-1,1,100,-1,1));
+						       "occupancy",100,-1,1,100,-1,1)).isSuccess();
 	status &= registerHist( monGr_shift,  m_TRT_SCTvSCT_PIX_10evt =
 				       TH2F_LW::create("m_TRT_SCTvSCT_PIX_10evt",
 						       "TRT,SCT, PIX combined "
-						       "occupancy",100,-1,1,100,-1,1));
+						       "occupancy",100,-1,1,100,-1,1)).isSuccess();
 	status &= registerHist( monGr_shift,  m_TRT_PIXvSCT_PIX_10evt =
 				       TH2F_LW::create("m_TRT_PIXvSCT_PIX_10evt",
 						       "TRT,SCT, PIX combined "
-						       "occupancy",100,-1,1,100,-1,1));
+						       "occupancy",100,-1,1,100,-1,1)).isSuccess();
 	  
 	//---Pixel debug histograms
 	status &= registerHist( monGr_shift,  m_PIX_NO_evt = 
 				       TProfile_LW::create("m_PIX_NO_evt","PIX noise "
 						    "occupancy vs bin of 10 events",m_checkRate/10,
-						    0,m_checkRate));
+						    0,m_checkRate)).isSuccess();
 	status &= registerHist( monGr_exp,  m_PIX_NO =
 				     TH1F_LW::create("m_PIX_NO","PIX noise occupancy",
-						     m_pixel_nBins,0,m_pixelMax));
+						     m_pixel_nBins,0,m_pixelMax)).isSuccess();
 	status &= registerHist( monGr_exp,  m_PIX_NO_B =
 				     TH1F_LW::create("m_PIX_NO_B","PIX noise occupancy (B)",
-						     m_pixel_nBins,0,m_pixelMax));
+						     m_pixel_nBins,0,m_pixelMax)).isSuccess();
 	status &= registerHist( monGr_exp,  m_PIX_NO_ECA =
 				     TH1F_LW::create("m_PIX_NO_ECA","PIX noise occupancy (ECA)",
-						     m_pixel_nBins,0,m_pixelMax));
+						     m_pixel_nBins,0,m_pixelMax)).isSuccess();
 	status &= registerHist( monGr_exp,  m_PIX_NO_ECC =
 				     TH1F_LW::create("m_PIX_NO_ECC","PIX noise occupancy (ECC)",
-						     m_pixel_nBins,0,m_pixelMax));
+						     m_pixel_nBins,0,m_pixelMax)).isSuccess();
 	status &= registerHist( monGr_exp,  m_PIX_NO_nseg = 
 				     TH2F_LW::create("m_PIX_NO_nseg","PIX noise occupancy "
 						     "vs number of PIX segments",500,0,500,
-						     150,0,m_pixelMax));
+						     150,0,m_pixelMax)).isSuccess();
 	status &= registerHist( monGr_exp,  m_PIX_NO_ntrk = 
 				     TH2F_LW::create("m_PIX_NO_ntrk","PIX noise occupancy "
 						     "vs number of combinedtracks",500,0,500,
-						     200,0,m_pixelMax));
+						     200,0,m_pixelMax)).isSuccess();
 	//---SCT debug histograms
 	status &= registerHist( monGr_shift,  m_SCT_NO_evt = 
 				       TProfile_LW::create("m_SCT_NO_evt","SCT noise "
 						    "occupancy vs bin of 10 events",m_checkRate/10,
-						    0,m_checkRate));
+						    0,m_checkRate)).isSuccess();
 	status &= registerHist( monGr_exp,  m_SCT_NO =
 				     TH1F_LW::create("m_SCT_NO","SCT noise occupancy",
-						     100,0,m_sctMax));
+						     100,0,m_sctMax)).isSuccess();
 	status &= registerHist( monGr_exp,  m_SCT_NO_B =
 				     TH1F_LW::create("m_SCT_NO_B","SCT noise occupancy (B)",
-						     100,0,m_sctMax));
+						     100,0,m_sctMax)).isSuccess();
 	status &= registerHist( monGr_exp,  m_SCT_NO_ECA =
 				     TH1F_LW::create("m_SCT_NO_ECA","SCT noise occupancy (ECA)",
-						     100,0,m_sctMax));
+						     100,0,m_sctMax)).isSuccess();
 	status &= registerHist( monGr_exp,  m_SCT_NO_ECC =
 				     TH1F_LW::create("m_SCT_NO_ECC","SCT noise occupancy (ECC)",
-						     100,0,m_sctMax));
+						     100,0,m_sctMax)).isSuccess();
 	status &= registerHist( monGr_exp,  m_SCT_NO_nseg = 
 				     TH2F_LW::create("m_SCT_NO_nseg","SCT noise occupancy "
 						     "vs number of SCT segments"
-						     ,50,0,50,150,0,m_sctMax));
+						     ,50,0,50,150,0,m_sctMax)).isSuccess();
 	status &= registerHist( monGr_exp,  m_SCT_NO_ntrk =
 				     TH2F_LW::create("m_SCT_NO_ntrk", "SCT noise occupancy "
 						     "vs number of combined tracks",
-						     100,0,100,200,0,m_sctMax));
+						     100,0,100,200,0,m_sctMax)).isSuccess();
 	  
 	//---TRT debug histograms
 	status &= registerHist( monGr_shift,  m_TRT_NO_evt =
 				       TProfile_LW::create("m_TRT_NO_evt","TRT noise "
 						    "occupancy vs bin of 10 events",
-						    m_checkRate/10,0,m_checkRate));
+						    m_checkRate/10,0,m_checkRate)).isSuccess();
 	status &= registerHist( monGr_exp,  m_TRT_NO =
 				     TH1F_LW::create("m_TRT_NO","TRT noise occupancy",100,
-						     0,m_trtMax));
+						     0,m_trtMax)).isSuccess();
 	status &= registerHist( monGr_exp,  m_TRT_NO_BC_phi=
 				     TProfile_LW::create("m_TRT_NO_BC_phi","TRT noise occupancy in phi sectors (Barrel C)",32,
-						  -0.5,31.5,0,m_trtMax));
+						  -0.5,31.5,0,m_trtMax)).isSuccess();
 	status &= registerHist( monGr_exp,  m_TRT_NO_BA_phi=
 				     TProfile_LW::create("m_TRT_NO_BA_phi","TRT noise occupancy in phi sectors (Barrel A)",32,
-						  -0.5,31.5,0,m_trtMax));
+						  -0.5,31.5,0,m_trtMax)).isSuccess();
 	status &= registerHist( monGr_exp,  m_TRT_NO_ECA_phi=
 				     TProfile_LW::create("m_TRT_NO_ECA_phi","TRT noise occupancy in phi sectors (ECA)",32,
-						  -0.5,31.5,0,m_trtMax));
+						  -0.5,31.5,0,m_trtMax)).isSuccess();
 	status &= registerHist( monGr_exp,  m_TRT_NO_ECC_phi=
 				     TProfile_LW::create("m_TRT_NO_ECC_phi","TRT noise occupancy in phi sectors (ECC)",32,
-						  -0.5,31.5,0,m_trtMax));
+						  -0.5,31.5,0,m_trtMax)).isSuccess();
     
 	status &= registerHist( monGr_exp,  m_TRT_HL_NO_evt =
 				     TProfile_LW::create("m_TRT_HL_NO_evt","TRT HL noise "
 						  "occupancy vs event number",
-						  m_checkRate,0,m_checkRate));
+						  m_checkRate,0,m_checkRate)).isSuccess();
 	status &= registerHist( monGr_exp,  m_TRT_HL_NO =
 				     TH1F_LW::create("m_TRT_HL_NO","TRT HL noise occupancy",
-						     100,0,m_trtMax));
+						     100,0,m_trtMax)).isSuccess();
 	status &= registerHist( monGr_exp,  m_TRT_NO_nseg =
 				     TH2F_LW::create("m_TRT_NO_nseg","TRT noise occupancy "
 						     "vs number of TRT segments",500,0,500,
-						     150,0,m_trtMax));
+						     150,0,m_trtMax)).isSuccess();
 	status &= registerHist( monGr_exp,  m_TRT_NO_ntrk = 
 				     TH2F_LW::create("m_TRT_NO_ntrk","TRT noise occupancy "
 						     "vs number of combined tracks",					 
-						     500,0,500,200,0,m_trtMax));
+						     500,0,500,200,0,m_trtMax)).isSuccess();
 	  
 	// To be moved to conditions data?
 	m_nStraws = 0.;
diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalPixelTool.cxx b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalPixelTool.cxx
index 22baa54628571d937ffc176dfd9a82395a54030b..5aee40acd5e4a8ea47483e4ff770165801318e9d 100755
--- a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalPixelTool.cxx
+++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalPixelTool.cxx
@@ -84,7 +84,7 @@ StatusCode InDetGlobalPixelTool::bookHistograms()
   m_Pixel_track_pull_phi = new TH1F("m_Pixel_track_pull_phi","Pixel pull LocX",500,-5,5);
   status &= regHist(m_Pixel_track_pull_phi, "InDetGlobal/Pixel", run, ATTRIB_MANAGED).isSuccess();
   m_Pixel_track_res_eta = new TH1F("m_Pixel_track_res_eta","Pixel Residual LocY",500,-5,5);
-  status &= regHist(m_Pixel_track_res_eta,"InDetGlobal/Pixel",  run );
+  status &= regHist(m_Pixel_track_res_eta,"InDetGlobal/Pixel",  run ).isSuccess();
   m_Pixel_track_pull_eta = new TH1F("m_Pixel_track_pull_eta","Pixel Pull LocY",500,-5,5);
   status &= regHist(m_Pixel_track_pull_eta,"InDetGlobal/Pixel",  run, ATTRIB_MANAGED).isSuccess();   
   m_Pixel_track_ecA_cluster_occupancy = new TH2F("m_Pixel_track_ecA_cluster_occupancy","Pixel cluster occupancy in ECA",3,0,3,48,0,48);
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonKshort.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonKshort.cxx
index fd4ef056f9a4d9ac77cf0cb97f6676a971a86929..66f4125ec8be16deed179f2d3376adfa56e46eab 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonKshort.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonKshort.cxx
@@ -418,7 +418,7 @@ StatusCode IDPerfMonKshort::fillHistograms()
   if(evtStore()->contains<xAOD::VertexContainer>(m_VxPrimContainerName)){
     if ( evtStore()->retrieve(PrimVxContainer,m_VxPrimContainerName).isFailure()) {
       ATH_MSG_DEBUG("Could not retrieve collection with name "<<m_VxPrimContainerName<<" found in StoreGate");
-      return false;
+      return StatusCode::FAILURE;
     }
     else
       ATH_MSG_DEBUG("Successfully retrieved collection with name "<<m_VxPrimContainerName);
@@ -433,7 +433,7 @@ const xAOD::VertexContainer* SecVxContainer(0);
  if(evtStore()->contains<xAOD::VertexContainer>(m_VxContainerName)){
    if (evtStore()->retrieve(SecVxContainer,m_VxContainerName).isFailure()) {
      ATH_MSG_DEBUG("Could not retrieve collection with name "<<m_VxContainerName<<" found in StoreGate");
-     return false;
+     return StatusCode::FAILURE;
    }
    else
      ATH_MSG_DEBUG("Successfully retrieved collection with name "<<m_VxContainerName);
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx
index d797aa1489a807db3397d2c8da517d964c436232..1530e2405a935a954edae71eeaa4cdb2902239ba 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx
@@ -111,7 +111,7 @@ StatusCode IDPerfMonZmumu::initialize()
   ISvcLocator* pxServiceLocator = serviceLocator();
   if ( pxServiceLocator != NULL ) {
       StatusCode xSC = PerfMonServices::InitialiseServices( pxServiceLocator );
-      if ( xSC == !StatusCode::SUCCESS )
+      if ( !xSC.isSuccess() )
 	{
           ATH_MSG_FATAL("Problem Initializing PerfMonServices");
 	  //return PARENT::initialize();
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMuonRefitter.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMuonRefitter.cxx
index 192a7e557792c603e2a07338e507d3f683435c54..ce672df2f9ea90919a0fa3aa4281ff2c9c8d10e9 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMuonRefitter.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMuonRefitter.cxx
@@ -70,7 +70,7 @@ StatusCode IDPerfMuonRefitter::initialize()
 
   if ( pxServiceLocator != NULL ) {
     StatusCode xSC = PerfMonServices::InitialiseServices( pxServiceLocator );
-    if ( xSC == !StatusCode::SUCCESS )
+    if ( !xSC.isSuccess() )
     {
       ATH_MSG_FATAL("Problem Initializing PerfMonServices");
     }
diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/CMakeLists.txt b/InnerDetector/InDetMonitoring/TRT_Monitoring/CMakeLists.txt
index e7fbabc6b6ee8dd9fb4c7e04f9bfae1a3e3477d7..46ec0a8aaeb58b50b08820db9a21861d8583d819 100644
--- a/InnerDetector/InDetMonitoring/TRT_Monitoring/CMakeLists.txt
+++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/CMakeLists.txt
@@ -1,3 +1,4 @@
+
 ################################################################################
 # Package: TRT_Monitoring
 ################################################################################
@@ -12,12 +13,15 @@ atlas_depends_on_subdirs( PUBLIC
                           InnerDetector/InDetRawEvent/InDetRawData
                           LumiBlock/LumiBlockComps
                           PRIVATE
+                          Control/StoreGate
                           Commission/CommissionEvent
                           Control/DataModel
                           DetectorDescription/AtlasDetDescr
                           DetectorDescription/Identifier
                           Event/EventInfo
                           Event/EventPrimitives
+                          Event/xAOD/xAODEventInfo
+                          Event/xAOD/xAODTrigger
                           InnerDetector/InDetConditions/InDetConditionsSummaryService
                           InnerDetector/InDetConditions/TRT_ConditionsServices
                           InnerDetector/InDetDetDescr/InDetIdentifier
@@ -39,7 +43,7 @@ atlas_add_component( TRT_Monitoring
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} AthenaMonitoringLib GaudiKernel InDetRawData LumiBlockCompsLib CommissionEvent DataModel AtlasDetDescr Identifier EventInfo EventPrimitives TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry InDetRIO_OnTrack LWHists TrkTrack TrkTrackSummary TrkToolInterfaces )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} AthenaMonitoringLib GaudiKernel InDetRawData LumiBlockCompsLib CommissionEvent DataModel AtlasDetDescr Identifier xAODEventInfo xAODTrigger EventInfo EventPrimitives TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry InDetRIO_OnTrack LWHists TrkTrack TrkTrackSummary TrkToolInterfaces )
 
 # Install files from the package:
 atlas_install_headers( TRT_Monitoring )
diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/TRT_Monitoring/TRT_Hits_Monitoring_Tool.h b/InnerDetector/InDetMonitoring/TRT_Monitoring/TRT_Monitoring/TRT_Hits_Monitoring_Tool.h
index dce894717a0b36e8a5493aa71e988468ff3d2342..8fd00d6e3e1ddec96210f607afefaf40d40efdf8 100644
--- a/InnerDetector/InDetMonitoring/TRT_Monitoring/TRT_Monitoring/TRT_Hits_Monitoring_Tool.h
+++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/TRT_Monitoring/TRT_Hits_Monitoring_Tool.h
@@ -1,3 +1,4 @@
+// -*- c++ -*-
 /*
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
@@ -12,44 +13,46 @@
 #include "is/infodictionary.h"
 #include "is/infoT.h"
 
+#include "StoreGate/ReadHandleKey.h"
+
 #include <string>
 
 class TRT_ID;
 
-class TRT_Hits_Monitoring_Tool: public ManagedMonitorToolBase
-{
+class TRT_Hits_Monitoring_Tool: public ManagedMonitorToolBase {
 public:
-    TRT_Hits_Monitoring_Tool(const std::string &type, const std::string &name, const IInterface *parent);
-    virtual ~TRT_Hits_Monitoring_Tool();
-
-    virtual StatusCode initialize();
-    virtual StatusCode bookHistogramsRecurrent();
-    virtual StatusCode fillHistograms();  
-    virtual StatusCode procHistograms();
-  
+	TRT_Hits_Monitoring_Tool(const std::string &type, const std::string &name, const IInterface *parent);
+	virtual ~TRT_Hits_Monitoring_Tool();
+
+	virtual StatusCode initialize();
+	virtual StatusCode bookHistogramsRecurrent();
+	virtual StatusCode fillHistograms();
+	virtual StatusCode procHistograms();
+
 private:
-    const TRT_ID *m_pTRTHelper;
+	SG::ReadHandleKey<TRT_RDO_Container> m_rdoContainerKey{this, "TRTRawDataObjectName", "TRT_RDOs", "Name of TRT Raw Data Object container"};
+
+	const TRT_ID *m_pTRTHelper;
 
-    ISInfoDictionary m_dict;
+	ISInfoDictionary m_dict;
 
-    ISInfoFloat m_occ_longToT;
-    ISInfoFloat m_occBR_longToT;
-    ISInfoFloat m_occEA_longToT;
-    ISInfoFloat m_occEC_longToT;
+	ISInfoFloat m_occ_longToT;
+	ISInfoFloat m_occBR_longToT;
+	ISInfoFloat m_occEA_longToT;
+	ISInfoFloat m_occEC_longToT;
 
-    std::string m_name_longToT;
-    std::string m_nameBR_longToT;
-    std::string m_nameEA_longToT;
-    std::string m_nameEC_longToT;
+	std::string m_name_longToT;
+	std::string m_nameBR_longToT;
+	std::string m_nameEA_longToT;
+	std::string m_nameEC_longToT;
 
-    std::string m_rawDataObjectName;
-    std::string m_partition;    
-    std::string m_server;
-    std::string m_name;      
+	std::string m_partition;
+	std::string m_server;
+	std::string m_name;
 
-    float m_longToTCut;
-    unsigned int m_sleepTime; // milliseconds
-    boost::posix_time::ptime m_lastPublishTime;
+	float m_longToTCut;
+	unsigned int m_sleepTime; // milliseconds
+	boost::posix_time::ptime m_lastPublishTime;
 };
 
 #endif // TRT_HITS_MONITORING_TOOL_H
diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/TRT_Monitoring/TRT_Monitoring_Tool.h b/InnerDetector/InDetMonitoring/TRT_Monitoring/TRT_Monitoring/TRT_Monitoring_Tool.h
index 16e7c33ec3e1cbba864f4d29eddbddfc7b52b6b8..86223b3d22aa6c1d53afc05049639e12bf10754e 100644
--- a/InnerDetector/InDetMonitoring/TRT_Monitoring/TRT_Monitoring/TRT_Monitoring_Tool.h
+++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/TRT_Monitoring/TRT_Monitoring_Tool.h
@@ -1,3 +1,4 @@
+// -*- c++ -*-
 /*
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
@@ -6,12 +7,25 @@
 #define TRT_MONITORING_TOOL_H
 
 #include "AthenaMonitoring/ManagedMonitorToolBase.h"
-#include "InDetRawData/InDetRawDataCLASS_DEF.h"
-#include "InDetRawData/InDetTimeCollection.h"
 #include "GaudiKernel/StatusCode.h"
 
+// Data handles
+#include "StoreGate/ReadHandleKey.h"
+#include "TrkTrack/TrackCollection.h"
+#include "EventInfo/EventInfo.h"
+#include "CommissionEvent/ComTime.h"
+#include "xAODTrigger/TrigDecision.h"
+#include "xAODEventInfo/EventInfo.h"
+#include "InDetRawData/InDetTimeCollection.h"
+#include "InDetRawData/InDetRawDataCLASS_DEF.h"
+
+// Tool interfaces
 #include "LumiBlockComps/ILuminosityTool.h"
+#include "TrkToolInterfaces/ITrackSummaryTool.h"
+#include "TrkToolInterfaces/ITrackHoleSearchTool.h"
+#include "TRT_DriftFunctionTool/ITRT_DriftFunctionTool.h"
 
+// STDLIB
 #include <string>
 #include <vector>
 #include <set>
@@ -23,23 +37,20 @@ class TProfile_LW;
 class TH1D_LW;
 class LWHist1D;
 
-namespace Trk
-{
-  class ITrackHoleSearchTool;
-  class Track;
-  class TrackStateOnSurface;
-  class ITrackSummaryTool;
+namespace Trk {
+	//	class ITrackHoleSearchTool;
+	class Track;
+	class TrackStateOnSurface;
+	//	class ITrackSummaryTool;
 }
 
-namespace InDetDD
-{
-  class TRT_DetectorManager;
+namespace InDetDD {
+	class TRT_DetectorManager;
 }
 
 class AtlasDetectorID;
 class TRT_ID;
 class Identifier;
-class EventInfo;
 class ComTime;
 class IInDetConditionsSvc;
 class ITRT_CalDbSvc;
@@ -49,611 +60,616 @@ class ITRT_DAQ_ConditionsSvc;
 class ITRT_ByteStream_ConditionsSvc;
 class ITRT_ConditionsSvc;
 class ITRT_StrawNeighbourSvc;
-class ITRT_DriftFunctionTool;
-
-class TRT_Monitoring_Tool : public ManagedMonitorToolBase
-{
- public:
-  TRT_Monitoring_Tool(const std::string &type, const std::string &name, const IInterface *parent);
-  virtual ~TRT_Monitoring_Tool();
-  virtual StatusCode initialize();
-  virtual StatusCode bookHistogramsRecurrent();
-  virtual StatusCode fillHistograms();  
-  virtual StatusCode procHistograms();
-
- private:
-  int lastLumiBlock;
-  int evtLumiBlock;
-  int good_bcid;
-  int m_nTotalTracks;
-  int m_nTracksB[2];
-  int m_nTracksEC[2];
-  int m_nTracksEC_B[2];
-  float nBSErrors[195];
-  float nRobErrors[195];
-  std::vector<unsigned int> m_rodMap;
-  bool passEventBurst;
-  bool m_ArgonXenonSplitter;
-  enum GasType{ Xe=0,Ar=1,Kr=2 };
-
-
-  const AtlasDetectorID * m_idHelper;
-
-  StatusCode CheckEventBurst();
-  StatusCode Book_TRT_RDOs(bool isNewLumiBlock, bool isNewRun);
-  StatusCode Retrieve_TRT_RDOs();
-  StatusCode Fill_TRT_RDOs();
-  StatusCode Book_TRT_Tracks(bool isNewLumiBlock, bool isNewRun);
-  StatusCode Book_TRT_Shift_Tracks(bool isNewLumiBlock, bool isNewRun);
-  StatusCode Retrieve_TRT_Tracks();
-  StatusCode Fill_TRT_Tracks();
-  StatusCode Fill_TRT_HT();
-
-  int strawLayerNumber(int strawLayerNumber, int LayerNumber);
- 
-  
-  // Returns the straw number (0-1641) given the layerNumber, strawlayerNumber, and strawNumber, all gotten from Athena IDHelper
-  int strawNumber(int strawNumber, int strawlayerNumber, int LayerNumber);
-  // Returns Barrel Board Number
-  int chipToBoard(int chip);
-  // Returns EndCap Board Number
-  int chipToBoard_EndCap(int chip);
-
-  // Returns Degrees, converted from radians (Athena Standard units)
-  float radToDegrees(float radValue);
-  int strawNumber_reverse (int inp_strawnumber,  int* strawNumber, int* strawlayerNumber, int* LayerNumber);
-  int strawLayerNumber_reverse(int strawLayerNumInp,int* strawLayerNumber, int* LayerNumber);
-
-  TH1F_LW* bookTH1F_LW(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int bins, double lowbin, double highbin, const std::string &xTitle, const std::string &yTitle, StatusCode &scode);
-  TH2F_LW* bookTH2F_LW(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int xbins, double lowxbins, double highxbins, int ybins, double lowybins, double highybins, const std::string &xTitle, const std::string &yTitle, StatusCode &scode);
-  TProfile_LW* bookTProfile_LW(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int bins, double lowbin, double highbin, double ymin, double ymax, const std::string &xTitle, const std::string &yTitle, StatusCode &scode);
-  TProfile*       bookTProfile(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int bins, double lowbin, double highbin, double ymin, double ymax, const std::string &xTitle, const std::string &yTitle, StatusCode &scode);
-  TH1D_LW* bookTH1D_LW(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int bins, double lowbin, double highbin, const std::string &xTitle, const std::string &yTitle, StatusCode &scode);
-
-  template<typename T> StatusCode trtRegHist(T *hist, MonGroup &mongrp, const char *hName)
-    {
-      StatusCode scode = mongrp.regHist(hist);
-      if (scode == StatusCode::FAILURE) {
-	ATH_MSG_FATAL("Failed to register histogram " << hName);
-      }
-      return scode;
-    }
-  
-  StatusCode Check_TRT_Readout_Integrity(const EventInfo* eventInfo);
-
- private:
-  static const int s_numberOfBarrelStacks;
-  static const int s_numberOfEndCapStacks;
-  
-  static const int s_Straw_max[2];
-  static const int s_iStack_max[2];
-  static const int s_iChip_max[2];
-  static const int s_numberOfStacks[2];
-  static const int s_moduleNum[2];
-
-  ServiceHandle<IToolSvc> p_toolSvc;
-  ServiceHandle<ITRT_StrawStatusSummarySvc> m_sumSvc;
-  ServiceHandle<ITRT_DCS_ConditionsSvc> m_DCSSvc;
-  ServiceHandle<ITRT_DAQ_ConditionsSvc> m_DAQSvc;
-  ServiceHandle<ITRT_ByteStream_ConditionsSvc> m_BSSvc;
-  ServiceHandle<ITRT_ConditionsSvc> m_condSvc_BS;
-  //ServiceHandle<ITRT_ConditionsSvc> m_condSvc_DAQ;
-  ServiceHandle<ITRT_StrawNeighbourSvc> m_TRTStrawNeighbourSvc;
-  ServiceHandle<ITRT_CalDbSvc> m_trtcaldbSvc;
-
-  bool m_doDCS;
-
-
-  const TRT_ID* m_pTRTHelper;
-  const InDetDD::TRT_DetectorManager *mgr;
-
-  ToolHandle<Trk::ITrackSummaryTool> m_TrackSummaryTool;
-  ToolHandle<ITRT_DriftFunctionTool> m_drifttool;
-
-  const TRT_RDO_Container* m_rdoContainer;
-  std::string m_rawDataObjectName;
-
-  const DataVector<Trk::Track> *m_trkCollection;
-  std::string m_tracksObjectName;
-
-  const InDetTimeCollection *TRT_BCIDColl;
-
-  const ComTime *theComTime;
-  const EventInfo* eventInfo;
-
-  std::string m_comTimeObjectName;
-  std::string geo_summary_provider;//obsolete
-  std::string mapPath;
-
-  int rbins;
-  float rmin;
-  float rmax;
-  float tbins;
-  float tmin;
-  float tmax;
-  float fitmin;
-  float fitmax;
-
-  TH1F_LW* m_hSummary;
-  TProfile* m_hChipBSErrorsVsLB[2][2];
-  TProfile* m_hRobBSErrorsVsLB[2][2];
-
-  TProfile_LW* m_hAvgHLOcc_side[2][2];
-  TProfile_LW* m_hAvgLLOcc_side[2][2];
-
-  TH1F_LW* m_hNumTrksDetPhi_B;//hNTrksvsPhi
-  TProfile_LW* m_hNumHoTDetPhi_B;//hNumHoTPhi
-  TProfile_LW* m_hAvgTroTDetPhi_B;//hAvgTrEdgeonTrack
-  TProfile_LW* m_hAvgTroTDetPhi_B_Ar;
-  TH1F_LW* m_hNumSwLLWoT_B;//hLLHitsonTrk
-  TProfile_LW* m_hStrawEffDetPhi_B;//hStrawEffDetPhi 
-  TH1F_LW* m_hHitWMap_B;
-  TH1F_LW* m_hHitWonTMap_B;
-  TH1F_LW* m_Pull_Biased_Barrel;
-  TH1F_LW* m_hResidual_B;//hHitToTrkDistance
-  TH1F_LW* m_hResidual_B_20GeV;//hHitToTrkDistance
-  TH1F_LW* m_hTimeResidual_B;//hHitToTrkDistance
-  TH1F_LW* m_hDriftTimeonTrkDist_B;//hDriftTimeonTrk
-  TH1F_LW* m_hTronTDist_B;//hTronT
-  TH2F_LW* m_hrtRelation_B;//hrt
-  TH1F_LW* m_hHLhitOnTrack_B;
-  TH1F_LW* m_hHtoLRatioOnTrack_B;
-  TH1F_LW* m_hHtoLRatioOnTrack_B_Ar;
-  TH1F_LW* m_hHtoLRatioOnTrack_B_Xe;
-  TH1F_LW* m_hWireToTrkPosition_B;//hWiretoTrkPosition
-  TH1F_LW* m_hWireToTrkPosition_B_Ar;
-  TH1F_LW* m_hResVsDetPhi_B;
-  TProfile* m_hNHitsperLB_B;
-  TProfile* m_hNTrksperLB_B;
-  TProfile* m_hNHLHitsperLB_B;
-
-  TH1F_LW* m_hDriftTimeonTrkDist_B_Ar;//hDriftTimeonTrk
-  TH1F_LW* m_hTronTDist_B_Ar;//hTronT
-  TH1F_LW* m_hHitWMap_B_Ar;
-  TH1F_LW* m_hResidual_B_Ar;
-  TH1F_LW* m_hResidual_B_Ar_20GeV;
-  TH1F_LW* m_hTimeResidual_B_Ar;
-  TH2F_LW* m_hrtRelation_B_Ar;//hrt
-
-  TH1F_LW* m_hNumTrksDetPhi_E[2];//hNTrksvsPhi
-  TProfile_LW* m_hNumHoTDetPhi_E[2];//hNumHoTPhi
-  TProfile_LW* m_hAvgTroTDetPhi_E[2];//hAvgTrEdgeonTrack
-  TProfile_LW* m_hAvgTroTDetPhi_E_Ar[2];
-  TH1F_LW* m_hNumSwLLWoT_E[2];//hLLHitsonTrk
-  TProfile_LW* m_hStrawEffDetPhi_E[2];//hStrawEffDetPhi 
-  TH1F_LW* m_hHitWMap_E[2];
-  TH1F_LW* m_hHitWonTMap_E[2];
-  TH1F_LW* m_Pull_Biased_EndCap;
-  TH1F_LW* m_hResidual_E[2];//hHitToTrkDistance
-  TH1F_LW* m_hResidual_E_20GeV[2];//hHitToTrkDistance
-  TH1F_LW* m_hTimeResidual_E[2];//hHitToTrkDistance
-  TH1F_LW* m_hDriftTimeonTrkDist_E[2];//hDriftTimeonTrk
-  TH1F_LW* m_hTronTDist_E[2];//hTronT
-  TH2F_LW* m_hrtRelation_E[2];//hrt
-  TH1F_LW* m_hHLhitOnTrack_E[2];
-  TH1F_LW* m_hHtoLRatioOnTrack_E[2];
-  TH1F_LW* m_hHtoLRatioOnTrack_E_Ar[2]; 
-  TH1F_LW* m_hHtoLRatioOnTrack_E_Xe[2];
-  TH1F_LW* m_hWireToTrkPosition_E[2];//hWiretoTrkPosition
-  TH1F_LW* m_hWireToTrkPosition_E_Ar[2];
-  TH1F_LW* m_hResVsDetPhi_E[2];
-  TProfile* m_hNHitsperLB_E[2];
-  TProfile* m_hNTrksperLB_E[2];
-  TProfile* m_hNHLHitsperLB_E[2];
-
-  TH1F_LW* m_hTronTDist_E_Ar[2];//hTronT
-  TH1F_LW* m_hDriftTimeonTrkDist_E_Ar[2];//hDriftTimeonTrk
-  TH1F_LW* m_hHitWMap_E_Ar[2];
-  TH1F_LW* m_hResidual_E_Ar[2];
-  TH1F_LW* m_hResidual_E_Ar_20GeV[2];
-  TH1F_LW* m_hTimeResidual_E_Ar[2];
-  TH2F_LW* m_hrtRelation_E_Ar[2];//hrt
-
-  TProfile_LW* m_hStrawsEff[2][64];
-
-  TProfile_LW* m_hEvtPhaseDetPhi_B;
-  TProfile_LW* m_hEvtPhaseDetPhi_E[2];
-  TH1F_LW* m_hEvtPhase;
-  TH2F_LW* m_hEvtPhaseVsTrig;// evt phase vs trig item
-  TProfile_LW* m_hChipsEff[2][64];
-
-  TH1F_LW* m_hHitOnTrackVsAllS[2][64];
-  TH1F_LW* m_hHitOnTrackVsAllC[2][64];
-
-  /** Leading Edge in time Window: Straws.  
-   * Any hit where the leading edge (driftTimeBin()) is less than 24. 
-   * In Time window means ((driftTimeBin<24) && !lastBinHigh && !firstBinHigh)
-   * This is an RDO level histogram.
-   */
-  TH1F_LW* m_hHitWMapS[2][64];
-
-  /** TE in Time Window: Straws.
-   * If hit trailing edge is in time window.  
-   * In Time window means ((trailingEdge<23)&& !lastBinHigh && !firstBinHigh)
-   * m_hHitTrWMapS[m_phi_module]->Fill(m_strawNumber, ((m_trailingEdge+1)*3.125));
-   */
-  TProfile_LW* m_hHitTrWMapS[2][64];
-
-  /** Mean TE: Straws.
-   * Average of Trailing Edge bin where the trailing edge (trailingEdge()) is less than 23.  
-   * This an RDO level histogram.
-   */
-  TProfile_LW* m_hHitTrMapS[2][64];
-
-  /** Any LL bit on: Straws
-   * if any low threshold bit was set. 
-   * if leading edge is > 0, or if trailing edge < 23, or if first bin is high, or if last bin is high
-   * This is an RDO level histogram.
-   */
-  TH1F_LW* m_hHitAMapS[2][64];
-
-  /** LL in time window: Straws
-   * Any low level hit in time window by straw.
-   * ((m_driftTimeBin>0 || m_trailingEdge<23)&& !m_firstBinHigh && !m_lastBinHigh)
-   * This is an RDO level histogram.
-   */
-  TH1F_LW* m_hHitAWMapS[2][64];
-
-  /** HL/LL: Straws
-   * The ratio of High Level hits to Low Level hits per straw.
-   * This is an RDO level histogram.
-   */
-  TH1F_LW* m_hHtoLMapS[2][64]; // not filled
-
-  /** Mean ToT (ns): Straws.
-   * Average Time over Threshold (ToT) in nano seconds per straw.
-   * m_hHitToTMapS[m_phi_module]->Fill(m_strawNumber, m_timeOverThreshold);
-   * m_timeOverThreshold = (p_lolum)->timeOverThreshold();
-   * This is an RDO level histogram.
-   */
-  TProfile_LW* m_hHitToTMapS[2][64];
-
-  /** Mean ToT (ns) for straws with ToT > LongToTCut: Straws.
-   * Average Time over Threshold (ToT) in nano seconds per straw for straws with ToT > LongToTCut.
-   * m_hHitToTLongMapS[m_phi_module]->Fill(m_strawNumber, m_timeOverThreshold);
-   * m_timeOverThreshold = (p_lolum)->timeOverThreshold();
-   * This is an RDO level histogram.
-   */
-  TProfile_LW* m_hHitToTLongMapS[2][64];
-
-  /** Mean Trailing Edge (ns) for straws with ToT > LongToTCut: Straws.
-   * Average Trailing Edge (Tr) in nano seconds per straw for straws with ToT > LongToTCut.
-   * m_hHitToTLongTrMapS[m_phi_module]->Fill(m_strawNumber, m_trailingEdge);
-   * m_trailingEdge = (p_lolum)->trailingEgde();
-   * This is an RDO level histogram.
-   */
-  TProfile_LW* m_hHitToTLongTrMapS[2][64];
-
-  /** High Level: Straws
-   * If a hit has any of the high threshold time bins up.
-   * m_hHitHMapS[m_phi_module]->Fill(m_strawNumber);
-   * This is an RDO level histogram
-   */
-  TH1F_LW* m_hHitHMapS[2][64];
-
-  /** HL in time window: Straws
-   * If a hit has any of the high threshold time bins up, and is in the time window. ((m_driftTimeBin<24) && !m_firstBinHight && !m_lastBinHight)
-   * This is an RDO level histogram
-   */
-  TH1F_LW* m_hHitHWMapS[2][64];
-
-  /** LE in time window on track: Straws.
-   * Leading Edge (LE) is within first 23 time bins of read out from a hit associated with a track.
-   * This is track level histogram.
-   */
-  TH1F_LW* m_hHitWonTMapS[2][64];
-
-  /** Mean TE on track: Straws
-   * Average Trailing Edge(TE) from a hit associated with a track.
-   * This is a track level histogram.
-   */
-  TProfile_LW* m_hHitTronTMapS[2][64];
-
-  /** Any LL bit on track: Straws
-   * Any low level bit is set from hit associated with a track.
-   * This is a track level hit
-   */
-  TH1F_LW* m_hHitAonTMapS[2][64];
-
-  /** Any LL bit in time window on track: Straws
-   * Any low level (LL) bit set and is in time window from hits associated with tracks
-   * This is a track level histogram.
-   */
-  TH1F_LW* m_hHitAWonTMapS[2][64];
-
-  /** Any HL hit on track: Straws
-   * Any straw with a High Threshold (HL) hit associated with a track.
-   * This is a track level histogram
-   */
-  TH1F_LW* m_hHitHWonTMapS[2][64];
-  //
- 
-  TH1F_LW* m_hHitHonTMapS[2][64];
-
-  /** HL in time window on track: Straws
-   * Straws with a High Threshold hit associated with a track and the hit is in the time window.
-   * This is a track level histogram.
-   */
-  TH1F_LW* m_hHtoLonTMapS[2][64]; //not filled
-
-  //
-  TH1F_LW* m_hHtoLWonTMapS[2][64]; //not filled
-
-  /** Mean ToT (ns) on Track: Straws
-   * Average Time over Threshold (ToT) from a straw hit associated with a track.
-   * This is a track level histogram.
-   */ 
-  TProfile_LW* m_hHitToTonTMapS[2][64];
-
-  /** Mean TE on track (with Event Phase correction): Straws.
-   * Average trailing edge(TE) on track after correcting for event phase from a hit associated with a track.
-   * This is a track level histogram.
-   */
-  TProfile_LW* m_hHitTronTwEPCMapS[2][64];
-
-  /** Valid Raw Drift Time on Track.
-   * Staws with hits that have valid drift times and are associated with a track.
-   * This is a track level histogram.
-   */
-  TProfile_LW* m_hValidRawDriftTimeonTrk[2][64];
-  TProfile_LW* m_hValidRawDriftTimeonTrkC[2][64];
-  TH1F_LW* m_hHitWMapC[2][64];
-  TProfile_LW* m_hHitTrMapC[2][64];
-  TProfile_LW* m_hHitTrWMapC[2][64];
-  TH1F_LW* m_hHitAMapC[2][64];
-  TH1F_LW* m_hHitAWMapC[2][64];
-  TH1F_LW* m_hHtoLMapC[2][64]; // not filled
-
-  TH2F_LW* m_hHtoBCMapC[2][64];
-  TH2F_LW* m_hHtoBCMapB[2][64];
-  TProfile_LW* m_hHitToTMapC[2][64];
-  TH1F_LW* m_hHitHMapC[2][64];
-  TH1F_LW* m_hHitHWMapC[2][64];
-
-  /** LE in time window on track: Chips.
-   * Leading Edge (LE) from a hit associated with a track is within first 23 time bins.
-   * Plotted as a function of DTMROC.
-   * This is a track level histogram.
-   */
-  TH1F_LW* m_hHitWonTMapC[2][64];
-  TProfile_LW* m_hHitTronTMapC[2][64];
-  TH1F_LW* m_hHitAonTMapC[2][64];
-  TH1F_LW* m_hHitAWonTMapC[2][64];
-  TH1F_LW* m_hHitHonTMapC[2][64];
-  TH1F_LW* m_hHitHWonTMapC[2][64];
-  TH1F_LW* m_hHtoLonTMapC[2][64]; // not filled
-  TH1F_LW* m_hHtoLWonTMapC[2][64]; // 
-  TProfile_LW* m_hHitToTonTMapC[2][64];
-  TProfile_LW* m_hHitTronTwEPCMapC[2][64];
-
-  TProfile_LW* m_hHitToTrkDistanceMapS_E[64]; 
-
-  /** Avg. Occupancy: Modules (Side A&C)
-   * Average Occupancy per Phi Module on Side A(&C).
-   * This is an RDO level Histogram.
-   */
-  TProfile_LW* m_hAvgLLOccMod_side[2][2];
-  TProfile_LW* m_hAvgHLOccMod_side[2][2];
-  TProfile_LW* m_hBCIDvsOcc[2];
-
-  /** Avg. Occupancy: Modules (Side A and C)
-   * Average Occupancy per Phi Module on Side A and C.
-   * This is an RDO level Histogram.
-   */
-  TH1F_LW* m_hChipOcc[2][64];
-  TH1F_LW* m_hStrawOcc[2][64];
-
-  /** Anatoli's "Scatter histograms" **
-   ** Monitor quantities as a function of lumi block. Fill per every stack
-   */
-  TH2F_LW* m_hHitsOnTrack_Scatter[2];
-  TH2F_LW* m_hLLOcc_Scatter[2];
-  TH2F_LW* m_hHightoLowRatioOnTrack_Scatter[2];
-  TH1F_LW* m_hOccAll;
-  //Vector for normalizing probabilities of hHitWmap histograms (Leading Edge in Time Window probability per straw number)
-  std::vector<float>  m_scale_hHitWMap_B;
-  std::vector<float>  m_scale_hHitWMap_B_Ar;
-  /* Helpers for the scatter histograms - 32 stacks (do same for both side for now) */
-  float m_LLOcc[2][64]; // easy to keep occupancy separately for sides A&C, so let's do that
-
-  /**Initialize Aging plots**
-   **HT, All, Barrel, EC, In/A, Out/C, etc...
-   */
-
-  TH1F_LW* m_trackz_All[5][2];//({L1 Long, L2, L3, L1 short Pos, L2 Short Neg},{A,C})
-  TH1F_LW* m_trackz_HT[5][2];
-
-  TH1F_LW* m_trackr_All[4][2]; // ({In_A,In_B,Out_A,Out_B},{A,C})
-  TH1F_LW* m_trackr_HT[4][2];
-  TH1F_LW* m_IntLum;
-  TH1F_LW* m_LBvsLum;
-  TH1F_LW* m_LBvsTime;
-
-  float m_HTfraconTrack_B[32];
-  float m_LonTrack_B[32];
-  int m_nTrack_B[32];
-  int m_nTrackwithHL_B[32];//obsolete
-
-
-
-  float m_HTfraconTrack_E[64];
-  float m_LonTrack_E[64];
-  int m_nTrack_E[64];
-  int m_nTrackwithHL_E[64];//obsolete
-
-  bool m_doRDOsMon;
-  bool m_doGeoMon;
-  bool m_doTracksMon;
-  int m_nEvents;  
-  int nTRTHits[2];
-  int nEvents;
-
-  bool DoAside, DoCside, DoStraws, DoChips, DoShift, DoExpert, DoDiagnostic, DoMaskStraws;
-  bool m_useHoleFinder;//switch for hole finder 
-  
-  int m_LE_timeWindow_MIN;
-  int m_LE_timeWindow_MAX;
-  
-  int m_LL_timeWindow_MIN;
-  int m_LL_timeWindow_MAX;
-  
-  int m_HL_timeWindow_MIN;
-  int m_HL_timeWindow_MAX;
-
-  bool m_NoiseSuppressionLevel_30pc;
-  int m_MIN_N_LL_Hits;
-  int m_MIN_TOT_Hits;
-  bool m_NoiseSuppressionMap;
-
-  float EventPhaseScale;
-
-
-  unsigned char mat_chip_B[64][1642];
-  int m_nStrawHits_B[1642];
-
-  unsigned char mat_chip_E[64][3840];
-  int m_nStrawHits_E[2][3840];
-
-  float DriftTimeonTrkDistScale_B;
-  float HLhitOnTrackScale_B;
-  float HtoLRatioOnTrackScale_B;
-  float HtoLRatioOnTrackScale_B_Ar;
-  float HtoLRatioOnTrackScale_B_Xe;
-  float NumSwLLWoTScale_B;
-  float WireToTrkPositionScale_B;
-  float WireToTrkPositionScale_B_Ar;
-  float TronTDistScale_B;
-  float ResidualScale_B;
-  float ResidualScale_B_20GeV;
-  float TimeResidualScale_B;
-  float DriftTimeonTrkDistScale_B_Ar;
-  float TronTDistScale_B_Ar;
-  float ResidualScale_B_Ar;
-  float ResidualScale_B_Ar_20GeV;
-  float TimeResidualScale_B_Ar;
-  float nTrkvPhiScale_B;//obsolete
-  int nTrksperLB_B;
-  int nHitsperLB_B;
-  int nHLHitsperLB_B;
-
-  float DriftTimeonTrkDistScale_E[2];
-  float HLhitOnTrackScale_E[2];
-  float HtoLRatioOnTrackScale_E[2];
-  float HtoLRatioOnTrackScale_E_Ar[2];
-  float HtoLRatioOnTrackScale_E_Xe[2];
-  float NumSwLLWoTScale_E[2];
-  float WireToTrkPositionScale_E[2];
-  float WireToTrkPositionScale_E_Ar[2];
-  float TronTDistScale_E[2];
-  float ResidualScale_E[2];
-  float ResidualScale_E_20GeV[2];
-  float TimeResidualScale_E[2];
-  float DriftTimeonTrkDistScale_E_Ar[2];
-  float TronTDistScale_E_Ar[2];
-  float ResidualScale_E_Ar[2];
-  float ResidualScale_E_Ar_20GeV[2];
-  float TimeResidualScale_E_Ar[2];
-  float nTrkvPhiScale_E[2];//obsolete
-  int nTrksperLB_E[2];
-  int nHitsperLB_E[2];
-  int nHLHitsperLB_E[2];
-
-  /*
-    ToolHandle<Trk::IPropagator> m_propagatorTool;  
-    Trk::IPropagator *m_propagator; 
-    ToolHandle<Trk::IExtrapolator> m_extrapolatorTool; 
-    Trk::IExtrapolator *m_extrapolator;  
-  */ //obsolete
-  float m_maxDistToStraw;
-  float m_DistToStraw;
-  bool m_trt_only_trks;
-  bool m_zero_field;
-  bool DEBUG;//obsolete
-  bool m_printEventInfo;//obsolete
-  float m_longToTCut;
-  int m_nphi_bins;
-  int m_EventBurstCut;
-  int m_lumiBlocksToResetOcc;
-  bool m_isCosmics;
-  int m_minTRThits;
-  float m_minP;
-  void scale_LWHist(LWHist1D* hist, float scale);
-  void scale_LWHistWithScaleVector(LWHist1D* hist, const std::vector<float>& scale);
-  int m_initScaleVectors();
-  int m_flagforscale;
-  void divide_LWHist(TH1F_LW* result, TH1F_LW* a, TH1F_LW* b);
-
-  ///// Additional stuff for efficiency measurements, online only for now
-  bool DoEfficiency;
-  ToolHandle<Trk::ITrackHoleSearchTool>  m_trt_hole_finder;
-  std::string m_track_collection_hole_finder;
-  float m_max_abs_d0;
-  float m_max_abs_z0;
-  float m_min_pT;
-  float m_max_abs_eta;
-
-  int m_min_si_hits;
-  int m_min_pixel_hits;
-  int m_min_sct_hits;
-  int m_min_trt_hits;
-
-  float m_track_pt;
-  float m_track_eta;
-  float m_track_phi;
-  float m_track_d0;
-  float m_track_z0;
-  int m_min_tracks_straw;
-
-  int m_every_xth_track;
-  std::string m_datatype;
-
-  ToolHandle<ILuminosityTool>   m_lumiTool; 
-
-  StatusCode Book_TRT_Efficiency(bool isNewLumiBlock, bool isNewRun);
-  StatusCode Fill_TRT_Efficiency();
-
-  TProfile_LW* m_hefficiency_eta;
-  TProfile_LW* m_hefficiency_phi;
-  TProfile_LW* m_hefficiency_pt;
-  TProfile_LW* m_hefficiency_z0;
-  TProfile_LW* m_hefficiencyBarrel_locR;
-  TProfile_LW* m_hefficiencyBarrel_locR_Ar;
-  TProfile_LW* m_hefficiencyEndCap_locR[2];
-  TProfile_LW* m_hefficiencyEndCap_locR_Ar[2];
-
-  TProfile_LW* m_hefficiencyMap[2]; // 0-barrel, 1-endcap
-  TProfile_LW* m_hefficiencyS[2][64]; // 0-barrel, 1-endcap
-  TProfile_LW* m_hefficiencyC[2][64]; // 0-barrel, 1-endcap
-  TH1F_LW* m_hefficiency[2][2];
-  TH1F_LW* m_hefficiencyIntegral[2][2];
-
-  const DataVector<Trk::Track> *m_trkCollectionEff;
-
-  int strawNumberEndCap(int strawNumber, int strawLayerNumber, int LayerNumber, int phi_stack, int side);
-  /////////
-  //inline functions
-  ////////
-
-  //it is taking lots of time to compile ?
-
-  //Deciphers status HT to  GasType Enumerator 
-    inline GasType Straw_Gastype(int stat){
-    // getStatusHT returns enum {Undefined, Dead, Good, Xenon, Argon, Krypton}.
-    // Our representation of 'GasType' is 0:Xenon, 1:Argon, 2:Krypton
-    GasType Gas =Xe; // Xenon is default
-    if(m_ArgonXenonSplitter){
-      //      int stat=m_sumSvc->getStatusHT(TRT_Identifier);
-      if       ( stat==2 || stat==3 ) { Gas = Xe; } // Xe
-      else if  ( stat==1 || stat==4 ) { Gas = Ar; } // Ar
-      else if  ( stat==5 )            { Gas = Kr; } // Kr
-      else if  ( stat==6 )            { Gas = Xe; } // emulate Ar (so treat as Xe here)
-      else if  ( stat==7 )            { Gas = Xe; } // emulate Kr (so treat as Xe here)
-      else { ATH_MSG_FATAL ("getStatusHT = " << stat << ", must be 'Good(2)||Xenon(3)' or 'Dead(1)||Argon(4)' or 'Krypton(5)!' or 6 or 7 for emulated types!");
-	throw std::exception();
-      }
-    }
-    return Gas;
-  }
+//class ITRT_DriftFunctionTool;
+
+class TRT_Monitoring_Tool : public ManagedMonitorToolBase {
+public:
+	TRT_Monitoring_Tool(const std::string &type, const std::string &name, const IInterface *parent);
+	virtual ~TRT_Monitoring_Tool();
+	virtual StatusCode initialize();
+	virtual StatusCode bookHistogramsRecurrent();
+	virtual StatusCode fillHistograms();
+	virtual StatusCode procHistograms();
+
+private:
+	int m_lastLumiBlock;
+	int m_evtLumiBlock;
+	int m_good_bcid;
+	int m_nTotalTracks;
+	int m_nTracksB[2];
+	int m_nTracksEC[2];
+	int m_nTracksEC_B[2];
+	float m_nBSErrors[195];
+	float m_nRobErrors[195];
+	std::vector<unsigned int> m_rodMap;
+	bool m_passEventBurst;
+	bool m_ArgonXenonSplitter;
+	enum GasType{ Xe = 0, Ar = 1, Kr = 2 };
+
+	const AtlasDetectorID * m_idHelper;
+
+	StatusCode bookTRTRDOs(bool isNewLumiBlock, bool isNewRun);
+	StatusCode bookTRTTracks(bool isNewLumiBlock, bool isNewRun);
+	StatusCode bookTRTShiftTracks(bool isNewLumiBlock, bool isNewRun);
+	StatusCode bookTRTEfficiency(bool isNewLumiBlock, bool isNewRun);
+	StatusCode checkEventBurst(const TRT_RDO_Container& rdoContainer);
+	StatusCode fillTRTRDOs(const TRT_RDO_Container& rdoContainer,
+	                       const xAOD::EventInfo& eventInfo,
+	                       const InDetTimeCollection* trtBCIDCollection);
+	// ComTime might be missing from file, have to use const pointer
+	StatusCode fillTRTTracks(const TrackCollection& trackCollection,
+	                         const xAOD::TrigDecision* trigDecision,
+	                         const ComTime* comTimeObject);
+	StatusCode fillTRTEfficiency(const TrackCollection& combTrackCollection);
+	StatusCode fillTRTHighThreshold(const TrackCollection& trackCollection,
+	                                const xAOD::EventInfo& eventInfo);
+	StatusCode checkTRTReadoutIntegrity(const xAOD::EventInfo& eventInfo);
+
+	int strawLayerNumber(int strawLayerNumber, int LayerNumber);
+
+
+	// Returns the straw number (0-1641) given the layerNumber, strawlayerNumber, and strawNumber, all gotten from Athena IDHelper
+	int strawNumber(int strawNumber, int strawlayerNumber, int LayerNumber);
+	// Returns Barrel Board Number
+	int chipToBoard(int chip);
+	// Returns EndCap Board Number
+	int chipToBoard_EndCap(int chip);
+
+	// Returns Degrees, converted from radians (Athena Standard units)
+	float radToDegrees(float radValue);
+	int strawNumber_reverse (int inp_strawnumber,  int* strawNumber, int* strawlayerNumber, int* LayerNumber);
+	int strawLayerNumber_reverse(int strawLayerNumInp,int* strawLayerNumber, int* LayerNumber);
+
+	TH1F_LW* bookTH1F_LW(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int bins, double lowbin, double highbin, const std::string &xTitle, const std::string &yTitle, StatusCode &scode);
+	TH2F_LW* bookTH2F_LW(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int xbins, double lowxbins, double highxbins, int ybins, double lowybins, double highybins, const std::string &xTitle, const std::string &yTitle, StatusCode &scode);
+	TProfile_LW* bookTProfile_LW(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int bins, double lowbin, double highbin, double ymin, double ymax, const std::string &xTitle, const std::string &yTitle, StatusCode &scode);
+	TProfile*       bookTProfile(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int bins, double lowbin, double highbin, double ymin, double ymax, const std::string &xTitle, const std::string &yTitle, StatusCode &scode);
+	TH1D_LW* bookTH1D_LW(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int bins, double lowbin, double highbin, const std::string &xTitle, const std::string &yTitle, StatusCode &scode);
+
+	template<typename T>
+	StatusCode trtRegHist(T *hist, MonGroup &mongrp, const char *hName) {
+		StatusCode scode = mongrp.regHist(hist);
+		if (scode == StatusCode::FAILURE) {
+			ATH_MSG_FATAL("Failed to register histogram " << hName);
+		}
+		return scode;
+	}
+
+private:
+	static const int s_numberOfBarrelStacks;
+	static const int s_numberOfEndCapStacks;
+
+	static const int s_Straw_max[2];
+	static const int s_iStack_max[2];
+	static const int s_iChip_max[2];
+	static const int s_numberOfStacks[2];
+	static const int s_moduleNum[2];
+
+	// Services
+	ServiceHandle<IToolSvc> p_toolSvc;
+	ServiceHandle<ITRT_StrawStatusSummarySvc> m_sumSvc;
+	ServiceHandle<ITRT_DCS_ConditionsSvc> m_DCSSvc;
+	ServiceHandle<ITRT_DAQ_ConditionsSvc> m_DAQSvc;
+	ServiceHandle<ITRT_ByteStream_ConditionsSvc> m_BSSvc;
+	ServiceHandle<ITRT_ConditionsSvc> m_condSvc_BS;
+	ServiceHandle<ITRT_StrawNeighbourSvc> m_TRTStrawNeighbourSvc;
+	ServiceHandle<ITRT_CalDbSvc> m_TRTCalDbSvc;
+
+	// Data handles
+	SG::ReadHandleKey<TRT_RDO_Container> m_rdoContainerKey{this, "TRTRawDataObjectName", "TRT_RDOs", "Name of TRT RDOs container"};
+	SG::ReadHandleKey<TrackCollection> m_trackCollectionKey{this, "TRTTracksObjectName", "Tracks", "Name of tracks container"};
+	// NOTE: this property is not used anywhere, is it ok to change its name?
+	SG::ReadHandleKey<TrackCollection> m_combTrackCollectionKey{this, "track_collection_hole_finder", "CombinedInDetTracks", "Name of tracks container used for hole finder"};
+	SG::ReadHandleKey<EventInfo> m_eventInfoKey{this, "EventInfo", "ByteStreamEventInfo", "Name of EventInfo object"};
+	SG::ReadHandleKey<xAOD::EventInfo> m_xAODEventInfoKey{this, "xAODEventInfo", "EventInfo", "Name of EventInfo object"};
+	SG::ReadHandleKey<InDetTimeCollection> m_TRT_BCIDCollectionKey{this, "TRTBCIDCollectionName", "TRT_BCID", "Name of TRT BCID collection"};
+	SG::ReadHandleKey<ComTime> m_comTimeObjectKey{this, "ComTimeObjectName", "TRT_Phase", "Name of ComTime object"};
+	SG::ReadHandleKey<xAOD::TrigDecision> m_trigDecisionKey{this, "TrigDecisionObjectName", "xTrigDecision", "Name of trigger decision object"};
+
+	// Tools
+	ToolHandle<Trk::ITrackSummaryTool> m_TrackSummaryTool{this, "TrkSummaryTool", "Trk::TrackSummaryTool/InDetTrackSummaryTool", "Track summary tool name"};
+	ToolHandle<Trk::ITrackHoleSearchTool>  m_trt_hole_finder{this, "trt_hole_search", "TRTTrackHoleSearchTool", "Track hole search tool name"};
+	ToolHandle<ILuminosityTool> m_lumiTool{this, "LuminosityTool", "LuminosityTool", "Luminosity tool name"};
+	ToolHandle<ITRT_DriftFunctionTool> m_drifttool; // keep this public for now
+
+	const TRT_ID* m_pTRTHelper;
+	const InDetDD::TRT_DetectorManager *m_mgr;
+
+	std::string m_geo_summary_provider;//obsolete
+	std::string m_mapPath;
+
+	int m_rbins;
+	float m_rmin;
+	float m_rmax;
+	float m_tbins;
+	float m_tmin;
+	float m_tmax;
+	float m_fitmin;
+	float m_fitmax;
+
+	TH1F_LW* m_hSummary;
+	TProfile* m_hChipBSErrorsVsLB[2][2];
+	TProfile* m_hRobBSErrorsVsLB[2][2];
+
+	TProfile_LW* m_hAvgHLOcc_side[2][2];
+	TProfile_LW* m_hAvgLLOcc_side[2][2];
+
+	TH1F_LW* m_hNumTrksDetPhi_B;//hNTrksvsPhi
+	TProfile_LW* m_hNumHoTDetPhi_B;//hNumHoTPhi
+	TProfile_LW* m_hAvgTroTDetPhi_B;//hAvgTrEdgeonTrack
+	TProfile_LW* m_hAvgTroTDetPhi_B_Ar;
+	TH1F_LW* m_hNumSwLLWoT_B;//hLLHitsonTrk
+	TProfile_LW* m_hStrawEffDetPhi_B;//hStrawEffDetPhi
+	TH1F_LW* m_hHitWMap_B;
+	TH1F_LW* m_hHitWonTMap_B;
+	TH1F_LW* m_Pull_Biased_Barrel;
+	TH1F_LW* m_hResidual_B;//hHitToTrkDistance
+	TH1F_LW* m_hResidual_B_20GeV;//hHitToTrkDistance
+	TH1F_LW* m_hTimeResidual_B;//hHitToTrkDistance
+	TH1F_LW* m_hDriftTimeonTrkDist_B;//hDriftTimeonTrk
+	TH1F_LW* m_hTronTDist_B;//hTronT
+	TH2F_LW* m_hrtRelation_B;//hrt
+	TH1F_LW* m_hHLhitOnTrack_B;
+	TH1F_LW* m_hHtoLRatioOnTrack_B;
+	TH1F_LW* m_hHtoLRatioOnTrack_B_Ar;
+	TH1F_LW* m_hHtoLRatioOnTrack_B_Xe;
+	TH1F_LW* m_hWireToTrkPosition_B;//hWiretoTrkPosition
+	TH1F_LW* m_hWireToTrkPosition_B_Ar;
+	TH1F_LW* m_hResVsDetPhi_B;
+	TProfile* m_hNHitsperLB_B;
+	TProfile* m_hNTrksperLB_B;
+	TProfile* m_hNHLHitsperLB_B;
+
+	TH1F_LW* m_hDriftTimeonTrkDist_B_Ar;//hDriftTimeonTrk
+	TH1F_LW* m_hTronTDist_B_Ar;//hTronT
+	TH1F_LW* m_hHitWMap_B_Ar;
+	TH1F_LW* m_hResidual_B_Ar;
+	TH1F_LW* m_hResidual_B_Ar_20GeV;
+	TH1F_LW* m_hTimeResidual_B_Ar;
+	TH2F_LW* m_hrtRelation_B_Ar;//hrt
+
+	TH1F_LW* m_hNumTrksDetPhi_E[2];//hNTrksvsPhi
+	TProfile_LW* m_hNumHoTDetPhi_E[2];//hNumHoTPhi
+	TProfile_LW* m_hAvgTroTDetPhi_E[2];//hAvgTrEdgeonTrack
+	TProfile_LW* m_hAvgTroTDetPhi_E_Ar[2];
+	TH1F_LW* m_hNumSwLLWoT_E[2];//hLLHitsonTrk
+	TProfile_LW* m_hStrawEffDetPhi_E[2];//hStrawEffDetPhi
+	TH1F_LW* m_hHitWMap_E[2];
+	TH1F_LW* m_hHitWonTMap_E[2];
+	TH1F_LW* m_Pull_Biased_EndCap;
+	TH1F_LW* m_hResidual_E[2];//hHitToTrkDistance
+	TH1F_LW* m_hResidual_E_20GeV[2];//hHitToTrkDistance
+	TH1F_LW* m_hTimeResidual_E[2];//hHitToTrkDistance
+	TH1F_LW* m_hDriftTimeonTrkDist_E[2];//hDriftTimeonTrk
+	TH1F_LW* m_hTronTDist_E[2];//hTronT
+	TH2F_LW* m_hrtRelation_E[2];//hrt
+	TH1F_LW* m_hHLhitOnTrack_E[2];
+	TH1F_LW* m_hHtoLRatioOnTrack_E[2];
+	TH1F_LW* m_hHtoLRatioOnTrack_E_Ar[2];
+	TH1F_LW* m_hHtoLRatioOnTrack_E_Xe[2];
+	TH1F_LW* m_hWireToTrkPosition_E[2];//hWiretoTrkPosition
+	TH1F_LW* m_hWireToTrkPosition_E_Ar[2];
+	TH1F_LW* m_hResVsDetPhi_E[2];
+	TProfile* m_hNHitsperLB_E[2];
+	TProfile* m_hNTrksperLB_E[2];
+	TProfile* m_hNHLHitsperLB_E[2];
+
+	TH1F_LW* m_hTronTDist_E_Ar[2];//hTronT
+	TH1F_LW* m_hDriftTimeonTrkDist_E_Ar[2];//hDriftTimeonTrk
+	TH1F_LW* m_hHitWMap_E_Ar[2];
+	TH1F_LW* m_hResidual_E_Ar[2];
+	TH1F_LW* m_hResidual_E_Ar_20GeV[2];
+	TH1F_LW* m_hTimeResidual_E_Ar[2];
+	TH2F_LW* m_hrtRelation_E_Ar[2];//hrt
+
+	TProfile_LW* m_hStrawsEff[2][64];
+
+	TProfile_LW* m_hEvtPhaseDetPhi_B;
+	TProfile_LW* m_hEvtPhaseDetPhi_E[2];
+	TH1F_LW* m_hEvtPhase;
+	TH2F_LW* m_hEvtPhaseVsTrig;// evt phase vs trig item
+	TProfile_LW* m_hChipsEff[2][64];
+
+	TH1F_LW* m_hHitOnTrackVsAllS[2][64];
+	TH1F_LW* m_hHitOnTrackVsAllC[2][64];
+
+	/** Leading Edge in time Window: Straws.
+	 * Any hit where the leading edge (driftTimeBin()) is less than 24.
+	 * In Time window means ((driftTimeBin<24) && !lastBinHigh && !firstBinHigh)
+	 * This is an RDO level histogram.
+	 */
+	TH1F_LW* m_hHitWMapS[2][64];
+
+	/** TE in Time Window: Straws.
+	 * If hit trailing edge is in time window.
+	 * In Time window means ((trailingEdge<23)&& !lastBinHigh && !firstBinHigh)
+	 * m_hHitTrWMapS[m_phi_module]->Fill(m_strawNumber, ((m_trailingEdge+1)*3.125));
+	 */
+	TProfile_LW* m_hHitTrWMapS[2][64];
+
+	/** Mean TE: Straws.
+	 * Average of Trailing Edge bin where the trailing edge (trailingEdge()) is less than 23.
+	 * This an RDO level histogram.
+	 */
+	TProfile_LW* m_hHitTrMapS[2][64];
+
+	/** Any LL bit on: Straws
+	 * if any low threshold bit was set.
+	 * if leading edge is > 0, or if trailing edge < 23, or if first bin is high, or if last bin is high
+	 * This is an RDO level histogram.
+	 */
+	TH1F_LW* m_hHitAMapS[2][64];
+
+	/** LL in time window: Straws
+	 * Any low level hit in time window by straw.
+	 * ((m_driftTimeBin>0 || m_trailingEdge<23)&& !m_firstBinHigh && !m_lastBinHigh)
+	 * This is an RDO level histogram.
+	 */
+	TH1F_LW* m_hHitAWMapS[2][64];
+
+	/** HL/LL: Straws
+	 * The ratio of High Level hits to Low Level hits per straw.
+	 * This is an RDO level histogram.
+	 */
+	TH1F_LW* m_hHtoLMapS[2][64]; // not filled
+
+	/** Mean ToT (ns): Straws.
+	 * Average Time over Threshold (ToT) in nano seconds per straw.
+	 * m_hHitToTMapS[m_phi_module]->Fill(m_strawNumber, m_timeOverThreshold);
+	 * m_timeOverThreshold = (p_lolum)->timeOverThreshold();
+	 * This is an RDO level histogram.
+	 */
+	TProfile_LW* m_hHitToTMapS[2][64];
+
+	/** Mean ToT (ns) for straws with ToT > LongToTCut: Straws.
+	 * Average Time over Threshold (ToT) in nano seconds per straw for straws with ToT > LongToTCut.
+	 * m_hHitToTLongMapS[m_phi_module]->Fill(m_strawNumber, m_timeOverThreshold);
+	 * m_timeOverThreshold = (p_lolum)->timeOverThreshold();
+	 * This is an RDO level histogram.
+	 */
+	TProfile_LW* m_hHitToTLongMapS[2][64];
+
+	/** Mean Trailing Edge (ns) for straws with ToT > LongToTCut: Straws.
+	 * Average Trailing Edge (Tr) in nano seconds per straw for straws with ToT > LongToTCut.
+	 * m_hHitToTLongTrMapS[m_phi_module]->Fill(m_strawNumber, m_trailingEdge);
+	 * m_trailingEdge = (p_lolum)->trailingEgde();
+	 * This is an RDO level histogram.
+	 */
+	TProfile_LW* m_hHitToTLongTrMapS[2][64];
+
+	/** High Level: Straws
+	 * If a hit has any of the high threshold time bins up.
+	 * m_hHitHMapS[m_phi_module]->Fill(m_strawNumber);
+	 * This is an RDO level histogram
+	 */
+	TH1F_LW* m_hHitHMapS[2][64];
+
+	/** HL in time window: Straws
+	 * If a hit has any of the high threshold time bins up, and is in the time window. ((m_driftTimeBin<24) && !m_firstBinHight && !m_lastBinHight)
+	 * This is an RDO level histogram
+	 */
+	TH1F_LW* m_hHitHWMapS[2][64];
+
+	/** LE in time window on track: Straws.
+	 * Leading Edge (LE) is within first 23 time bins of read out from a hit associated with a track.
+	 * This is track level histogram.
+	 */
+	TH1F_LW* m_hHitWonTMapS[2][64];
+
+	/** Mean TE on track: Straws
+	 * Average Trailing Edge(TE) from a hit associated with a track.
+	 * This is a track level histogram.
+	 */
+	TProfile_LW* m_hHitTronTMapS[2][64];
+
+	/** Any LL bit on track: Straws
+	 * Any low level bit is set from hit associated with a track.
+	 * This is a track level hit
+	 */
+	TH1F_LW* m_hHitAonTMapS[2][64];
+
+	/** Any LL bit in time window on track: Straws
+	 * Any low level (LL) bit set and is in time window from hits associated with tracks
+	 * This is a track level histogram.
+	 */
+	TH1F_LW* m_hHitAWonTMapS[2][64];
+
+	/** Any HL hit on track: Straws
+	 * Any straw with a High Threshold (HL) hit associated with a track.
+	 * This is a track level histogram
+	 */
+	TH1F_LW* m_hHitHWonTMapS[2][64];
+	//
+
+	TH1F_LW* m_hHitHonTMapS[2][64];
+
+	/** HL in time window on track: Straws
+	 * Straws with a High Threshold hit associated with a track and the hit is in the time window.
+	 * This is a track level histogram.
+	 */
+	TH1F_LW* m_hHtoLonTMapS[2][64]; //not filled
+
+	//
+	TH1F_LW* m_hHtoLWonTMapS[2][64]; //not filled
+
+	/** Mean ToT (ns) on Track: Straws
+	 * Average Time over Threshold (ToT) from a straw hit associated with a track.
+	 * This is a track level histogram.
+	 */
+	TProfile_LW* m_hHitToTonTMapS[2][64];
+
+	/** Mean TE on track (with Event Phase correction): Straws.
+	 * Average trailing edge(TE) on track after correcting for event phase from a hit associated with a track.
+	 * This is a track level histogram.
+	 */
+	TProfile_LW* m_hHitTronTwEPCMapS[2][64];
+
+	/** Valid Raw Drift Time on Track.
+	 * Staws with hits that have valid drift times and are associated with a track.
+	 * This is a track level histogram.
+	 */
+	TProfile_LW* m_hValidRawDriftTimeonTrk[2][64];
+	TProfile_LW* m_hValidRawDriftTimeonTrkC[2][64];
+	TH1F_LW* m_hHitWMapC[2][64];
+	TProfile_LW* m_hHitTrMapC[2][64];
+	TProfile_LW* m_hHitTrWMapC[2][64];
+	TH1F_LW* m_hHitAMapC[2][64];
+	TH1F_LW* m_hHitAWMapC[2][64];
+	TH1F_LW* m_hHtoLMapC[2][64]; // not filled
+
+	TH2F_LW* m_hHtoBCMapC[2][64];
+	TH2F_LW* m_hHtoBCMapB[2][64];
+	TProfile_LW* m_hHitToTMapC[2][64];
+	TH1F_LW* m_hHitHMapC[2][64];
+	TH1F_LW* m_hHitHWMapC[2][64];
+
+	/** LE in time window on track: Chips.
+	 * Leading Edge (LE) from a hit associated with a track is within first 23 time bins.
+	 * Plotted as a function of DTMROC.
+	 * This is a track level histogram.
+	 */
+	TH1F_LW* m_hHitWonTMapC[2][64];
+	TProfile_LW* m_hHitTronTMapC[2][64];
+	TH1F_LW* m_hHitAonTMapC[2][64];
+	TH1F_LW* m_hHitAWonTMapC[2][64];
+	TH1F_LW* m_hHitHonTMapC[2][64];
+	TH1F_LW* m_hHitHWonTMapC[2][64];
+	TH1F_LW* m_hHtoLonTMapC[2][64]; // not filled
+	TH1F_LW* m_hHtoLWonTMapC[2][64]; //
+	TProfile_LW* m_hHitToTonTMapC[2][64];
+	TProfile_LW* m_hHitTronTwEPCMapC[2][64];
+
+	TProfile_LW* m_hHitToTrkDistanceMapS_E[64];
+
+	/** Avg. Occupancy: Modules (Side A&C)
+	 * Average Occupancy per Phi Module on Side A(&C).
+	 * This is an RDO level Histogram.
+	 */
+	TProfile_LW* m_hAvgLLOccMod_side[2][2];
+	TProfile_LW* m_hAvgHLOccMod_side[2][2];
+	TProfile_LW* m_hBCIDvsOcc[2];
+
+	/** Avg. Occupancy: Modules (Side A and C)
+	 * Average Occupancy per Phi Module on Side A and C.
+	 * This is an RDO level Histogram.
+	 */
+	TH1F_LW* m_hChipOcc[2][64];
+	TH1F_LW* m_hStrawOcc[2][64];
+
+	/** Anatoli's "Scatter histograms" **
+	 ** Monitor quantities as a function of lumi block. Fill per every stack
+	 */
+	TH2F_LW* m_hHitsOnTrack_Scatter[2];
+	TH2F_LW* m_hLLOcc_Scatter[2];
+	TH2F_LW* m_hHightoLowRatioOnTrack_Scatter[2];
+	TH1F_LW* m_hOccAll;
+	//Vector for normalizing probabilities of hHitWmap histograms (Leading Edge in Time Window probability per straw number)
+	std::vector<float>  m_scale_hHitWMap_B;
+	std::vector<float>  m_scale_hHitWMap_B_Ar;
+	/* Helpers for the scatter histograms - 32 stacks (do same for both side for now) */
+	float m_LLOcc[2][64]; // easy to keep occupancy separately for sides A&C, so let's do that
+	float m_HLOcc[2][64]; // easy to keep occupancy separately for sides A&C, so let's do that
+
+	/**Initialize Aging plots**
+	 **HT, All, Barrel, EC, In/A, Out/C, etc...
+	 */
+
+	TH1F_LW* m_trackz_All[5][2];//({L1 Long, L2, L3, L1 short Pos, L2 Short Neg},{A,C})
+	TH1F_LW* m_trackz_HT[5][2];
+
+	TH1F_LW* m_trackr_All[4][2]; // ({In_A,In_B,Out_A,Out_B},{A,C})
+	TH1F_LW* m_trackr_HT[4][2];
+	TH1F_LW* m_IntLum;
+	TH1F_LW* m_LBvsLum;
+	TH1F_LW* m_LBvsTime;
+
+	float m_HTfraconTrack_B[32];
+	float m_LonTrack_B[32];
+	int m_nTrack_B[32];
+	int m_nTrackwithHL_B[32];//obsolete
+
+
+
+	float m_HTfraconTrack_E[64];
+	float m_LonTrack_E[64];
+	int m_nTrack_E[64];
+	int m_nTrackwithHL_E[64];//obsolete
+
+	bool m_doRDOsMon;
+	bool m_doGeoMon;
+	bool m_doTracksMon;
+	int m_usedEvents;
+	int nTRTHits[2];
+	int m_totalEvents;
+
+	bool m_doDCS;
+	bool m_doASide;
+	bool m_doCSide;
+	bool m_doStraws;
+	bool m_doChips;
+	bool m_doShift;
+	bool m_doExpert;
+	bool m_doMaskStraws;
+	bool m_doEfficiency;
+	bool m_doDiagnostic;
+	bool m_useHoleFinder;//switch for hole finder
+
+	int m_LE_timeWindow_MIN;
+	int m_LE_timeWindow_MAX;
+
+	int m_LL_timeWindow_MIN;
+	int m_LL_timeWindow_MAX;
+
+	int m_HL_timeWindow_MIN;
+	int m_HL_timeWindow_MAX;
+
+	bool m_NoiseSuppressionLevel_30pc;
+	int m_MIN_N_LL_Hits;
+	int m_MIN_TOT_Hits;
+	bool m_NoiseSuppressionMap;
+
+	float EventPhaseScale;
+
+
+	unsigned char mat_chip_B[64][1642];
+	int m_nStrawHits_B[1642];
+
+	unsigned char mat_chip_E[64][3840];
+	int m_nStrawHits_E[2][3840];
+
+	float DriftTimeonTrkDistScale_B;
+	float HLhitOnTrackScale_B;
+	float HtoLRatioOnTrackScale_B;
+	float HtoLRatioOnTrackScale_B_Ar;
+	float HtoLRatioOnTrackScale_B_Xe;
+	float NumSwLLWoTScale_B;
+	float WireToTrkPositionScale_B;
+	float WireToTrkPositionScale_B_Ar;
+	float TronTDistScale_B;
+	float ResidualScale_B;
+	float ResidualScale_B_20GeV;
+	float TimeResidualScale_B;
+	float DriftTimeonTrkDistScale_B_Ar;
+	float TronTDistScale_B_Ar;
+	float ResidualScale_B_Ar;
+	float ResidualScale_B_Ar_20GeV;
+	float TimeResidualScale_B_Ar;
+	float nTrkvPhiScale_B;//obsolete
+	int nTrksperLB_B;
+	int nHitsperLB_B;
+	int nHLHitsperLB_B;
+
+	float DriftTimeonTrkDistScale_E[2];
+	float HLhitOnTrackScale_E[2];
+	float HtoLRatioOnTrackScale_E[2];
+	float HtoLRatioOnTrackScale_E_Ar[2];
+	float HtoLRatioOnTrackScale_E_Xe[2];
+	float NumSwLLWoTScale_E[2];
+	float WireToTrkPositionScale_E[2];
+	float WireToTrkPositionScale_E_Ar[2];
+	float TronTDistScale_E[2];
+	float ResidualScale_E[2];
+	float ResidualScale_E_20GeV[2];
+	float TimeResidualScale_E[2];
+	float DriftTimeonTrkDistScale_E_Ar[2];
+	float TronTDistScale_E_Ar[2];
+	float ResidualScale_E_Ar[2];
+	float ResidualScale_E_Ar_20GeV[2];
+	float TimeResidualScale_E_Ar[2];
+	float nTrkvPhiScale_E[2];//obsolete
+	int nTrksperLB_E[2];
+	int nHitsperLB_E[2];
+	int nHLHitsperLB_E[2];
+
+	/*
+	  ToolHandle<Trk::IPropagator> m_propagatorTool;
+	  Trk::IPropagator *m_propagator;
+	  ToolHandle<Trk::IExtrapolator> m_extrapolatorTool;
+	  Trk::IExtrapolator *m_extrapolator;
+	*/ //obsolete
+	float m_maxDistToStraw;
+	float m_DistToStraw;
+	bool m_trt_only_trks;
+	bool m_zero_field;
+	bool DEBUG;//obsolete
+	bool m_printEventInfo;//obsolete
+	float m_longToTCut;
+	int m_nphi_bins;
+	int m_EventBurstCut;
+	int m_lumiBlocksToResetOcc;
+	bool m_isCosmics;
+	int m_minTRThits;
+	float m_minP;
+	void scale_LWHist(LWHist1D* hist, float scale);
+	void scale_LWHistWithScaleVector(LWHist1D* hist, const std::vector<float>& scale);
+	int initScaleVectors();
+	int m_flagforscale;
+	void divide_LWHist(TH1F_LW* result, TH1F_LW* a, TH1F_LW* b);
+
+	///// Additional stuff for efficiency measurements, online only for now
+	std::string m_track_collection_hole_finder;
+	float m_max_abs_d0;
+	float m_max_abs_z0;
+	float m_min_pT;
+	float m_max_abs_eta;
+
+	int m_min_si_hits;
+	int m_min_pixel_hits;
+	int m_min_sct_hits;
+	int m_min_trt_hits;
+
+	float m_track_pt;
+	float m_track_eta;
+	float m_track_phi;
+	float m_track_d0;
+	float m_track_z0;
+	int m_min_tracks_straw;
+
+	int m_every_xth_track;
+	std::string m_datatype;
+
+
+
+	TProfile_LW* m_hefficiency_eta;
+	TProfile_LW* m_hefficiency_phi;
+	TProfile_LW* m_hefficiency_pt;
+	TProfile_LW* m_hefficiency_z0;
+	TProfile_LW* m_hefficiencyBarrel_locR;
+	TProfile_LW* m_hefficiencyBarrel_locR_Ar;
+	TProfile_LW* m_hefficiencyEndCap_locR[2];
+	TProfile_LW* m_hefficiencyEndCap_locR_Ar[2];
+
+	TProfile_LW* m_hefficiencyMap[2]; // 0-barrel, 1-endcap
+	TProfile_LW* m_hefficiencyS[2][64]; // 0-barrel, 1-endcap
+	TProfile_LW* m_hefficiencyC[2][64]; // 0-barrel, 1-endcap
+	TH1F_LW* m_hefficiency[2][2];
+	TH1F_LW* m_hefficiencyIntegral[2][2];
+
+	int strawNumberEndCap(int strawNumber, int strawLayerNumber, int LayerNumber, int phi_stack, int side);
+	/////////
+	//inline functions
+	////////
+
+	//it is taking lots of time to compile ?
+
+	//Deciphers status HT to  GasType Enumerator
+	inline GasType Straw_Gastype(int stat) {
+		// getStatusHT returns enum {Undefined, Dead, Good, Xenon, Argon, Krypton}.
+		// Our representation of 'GasType' is 0:Xenon, 1:Argon, 2:Krypton
+		GasType Gas = Xe; // Xenon is default
+		if (m_ArgonXenonSplitter) {
+			//      int stat=m_sumSvc->getStatusHT(TRT_Identifier);
+			if       ( stat==2 || stat==3 ) { Gas = Xe; } // Xe
+			else if  ( stat==1 || stat==4 ) { Gas = Ar; } // Ar
+			else if  ( stat==5 )            { Gas = Kr; } // Kr
+			else if  ( stat==6 )            { Gas = Xe; } // emulate Ar (so treat as Xe here)
+			else if  ( stat==7 )            { Gas = Xe; } // emulate Kr (so treat as Xe here)
+			else { ATH_MSG_FATAL ("getStatusHT = " << stat << ", must be 'Good(2)||Xenon(3)' or 'Dead(1)||Argon(4)' or 'Krypton(5)!' or 6 or 7 for emulated types!");
+				throw std::exception();
+			}
+		}
+		return Gas;
+	}
 
 
 };
diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Hits_Monitoring_Tool.cxx b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Hits_Monitoring_Tool.cxx
index acf3b7bee4d624c50998ffd11e0e0ac3dc48321c..c7e6d8bacc4f5de2202567ddfa094a445b4b472f 100644
--- a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Hits_Monitoring_Tool.cxx
+++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Hits_Monitoring_Tool.cxx
@@ -7,125 +7,115 @@
 #include "TRT_Monitoring/TRT_Hits_Monitoring_Tool.h"
 #include "InDetReadoutGeometry/TRT_DetectorManager.h"
 
+#include "StoreGate/ReadHandle.h"
+
 #include "boost/date_time/posix_time/posix_time_types.hpp"
 
 TRT_Hits_Monitoring_Tool::TRT_Hits_Monitoring_Tool(const std::string &type, const std::string &name, const IInterface *parent):
-    ManagedMonitorToolBase(type, name, parent),
-    m_pTRTHelper(0),
-    m_lastPublishTime(boost::posix_time::min_date_time) // never
+	ManagedMonitorToolBase(type, name, parent),
+	m_pTRTHelper(0),
+	m_lastPublishTime(boost::posix_time::min_date_time) // never
 {
-    declareProperty("TRTRawDataObjectName", m_rawDataObjectName = "TRT_RDOs");
-    declareProperty("Partition",            m_partition         = "initial");
-    declareProperty("Server",               m_server            = "beamconditions");
-    declareProperty("Name",                 m_name              = "hitfractionTRT");
-    declareProperty("LongToTCut",           m_longToTCut        = 9.375);
-    declareProperty("SleepTime",            m_sleepTime         = 500); // milliseconds
+	declareProperty("Partition",            m_partition         = "initial");
+	declareProperty("Server",               m_server            = "beamconditions");
+	declareProperty("Name",                 m_name              = "hitfractionTRT");
+	declareProperty("LongToTCut",           m_longToTCut        = 9.375);
+	declareProperty("SleepTime",            m_sleepTime         = 500); // milliseconds
 }
 
-TRT_Hits_Monitoring_Tool::~TRT_Hits_Monitoring_Tool()
-{
+TRT_Hits_Monitoring_Tool::~TRT_Hits_Monitoring_Tool() {
 }
 
-StatusCode TRT_Hits_Monitoring_Tool::initialize ()
-{
-    StatusCode sc;
+StatusCode TRT_Hits_Monitoring_Tool::initialize () {
+	StatusCode sc;
+
+	ATH_CHECK(ManagedMonitoringToolBase::initialize());
 
-    sc = ManagedMonitorToolBase::initialize();
-    if (!sc.isSuccess()) return sc;
+	ATH_CHECK(AlgTool::initialize());
 
-    sc = AlgTool::initialize();
-    if (!sc.isSuccess()) return sc;
+	ATH_CHECK(detStore()->retrieve(m_pTRTHelper, "TRT_ID"));
 
-    sc = detStore()->retrieve(m_pTRTHelper, "TRT_ID");
-    if (!sc.isSuccess()) return sc;
+	IPCPartition partition(m_partition);
+	m_dict = ISInfoDictionary(partition);
 
-    IPCPartition partition(m_partition);
-    m_dict = ISInfoDictionary(partition);
+	m_name_longToT   = m_server + "." + m_name + "_longToT";
+	m_nameBR_longToT = m_server + "." + m_name + "Barrel_longToT";
+	m_nameEA_longToT = m_server + "." + m_name + "EndCapA_longToT";
+	m_nameEC_longToT = m_server + "." + m_name + "EndCapC_longToT";
 
-    m_name_longToT   = m_server + "." + m_name + "_longToT";
-    m_nameBR_longToT = m_server + "." + m_name + "Barrel_longToT";
-    m_nameEA_longToT = m_server + "." + m_name + "EndCapA_longToT";
-    m_nameEC_longToT = m_server + "." + m_name + "EndCapC_longToT";
+	m_dict.checkin(m_name_longToT,   m_occ_longToT);
+	m_dict.checkin(m_nameBR_longToT, m_occBR_longToT);
+	m_dict.checkin(m_nameEA_longToT, m_occEA_longToT);
+	m_dict.checkin(m_nameEC_longToT, m_occEC_longToT);
 
-    m_dict.checkin(m_name_longToT,   m_occ_longToT);
-    m_dict.checkin(m_nameBR_longToT, m_occBR_longToT);
-    m_dict.checkin(m_nameEA_longToT, m_occEA_longToT);
-    m_dict.checkin(m_nameEC_longToT, m_occEC_longToT);
+	ATH_CHECK(m_rdoContainerKey.initialize());
 
-    return StatusCode::SUCCESS;
+	return StatusCode::SUCCESS;
 }
 
-StatusCode TRT_Hits_Monitoring_Tool::bookHistogramsRecurrent()
-{
-    return StatusCode::SUCCESS;
+StatusCode TRT_Hits_Monitoring_Tool::bookHistogramsRecurrent() {
+	return StatusCode::SUCCESS;
 }
 
-StatusCode TRT_Hits_Monitoring_Tool::fillHistograms()
-{
-    const static boost::posix_time::time_duration sleepTime = boost::posix_time::milliseconds(m_sleepTime);
-    const boost::posix_time::ptime now = boost::posix_time::microsec_clock::universal_time();
-    if (now - m_lastPublishTime < sleepTime) return StatusCode::SUCCESS; // do not publish results too often
-
-    if (!evtStore()->contains<TRT_RDO_Container>(m_rawDataObjectName)) {
-        ATH_MSG_ERROR("StoreGate contains no TRT_RDO_Container named " << m_rawDataObjectName);
-        return StatusCode::FAILURE;
-    }
-    TRT_RDO_Container *rdoContainer = 0;
-    StatusCode sc = evtStore()->retrieve(rdoContainer, m_rawDataObjectName); // get TRT Raw Data Objects (all TRT hits)
-    if (sc.isFailure() || !rdoContainer) {
-        ATH_MSG_ERROR("Could not retrieve TRT_RDO_Container named " << m_rawDataObjectName);
-        return StatusCode::FAILURE;
-    }
-
-    unsigned int nHits_longToT = 0;
-    unsigned int nHitsBR_longToT = 0;
-    unsigned int nHitsEA_longToT = 0;
-    unsigned int nHitsEC_longToT = 0;
-
-    const TRT_RDO_Container::const_iterator containerBeg = rdoContainer->begin();
-    const TRT_RDO_Container::const_iterator containerEnd = rdoContainer->end();
-    for (TRT_RDO_Container::const_iterator collection = containerBeg; collection != containerEnd; ++collection) {
-        const InDetRawDataCollection<TRT_RDORawData> *TRT_Collection(*collection);
-        if (!TRT_Collection) continue; // select only TRT RDOs
-
-        const DataVector<TRT_RDORawData>::const_iterator collectionBeg = TRT_Collection->begin();
-        const DataVector<TRT_RDORawData>::const_iterator collectionEnd = TRT_Collection->end();
-        for (DataVector<TRT_RDORawData>::const_iterator rdo = collectionBeg; rdo != collectionEnd; ++rdo) {
-            const TRT_LoLumRawData *rawData = dynamic_cast<const TRT_LoLumRawData *>(*rdo);
-            if (!rawData) continue; // not the right data type
-            if (rawData->timeOverThreshold() <= m_longToTCut) continue; // omit hits with short ToT
-
-            ++nHits_longToT;
-            switch (m_pTRTHelper->barrel_ec((*rdo)->identify())) { // which detector region?
-                case -1: // ... or ...
-                case +1: ++nHitsBR_longToT; break;
-                case +2: ++nHitsEA_longToT; break;
-                case -2: ++nHitsEC_longToT; break;
-            }
-        }
-    }
-
-    const unsigned int nChannelsBarrel = 105088; // 52544 straws with two channels
-    const unsigned int nChannelsEndcap = 122880; // 122880 straws with one channel
-    const unsigned int nChannelsTotal = nChannelsBarrel + 2 * nChannelsEndcap;
-
-    m_occ_longToT   = (float)nHits_longToT   / nChannelsTotal;
-    m_occBR_longToT = (float)nHitsBR_longToT / nChannelsBarrel;
-    m_occEA_longToT = (float)nHitsEA_longToT / nChannelsEndcap;
-    m_occEC_longToT = (float)nHitsEC_longToT / nChannelsEndcap;
-
-    m_dict.update(m_name_longToT,   m_occ_longToT);
-    m_dict.update(m_nameBR_longToT, m_occBR_longToT);
-    m_dict.update(m_nameEA_longToT, m_occEA_longToT);
-    m_dict.update(m_nameEC_longToT, m_occEC_longToT);
-
-    m_lastPublishTime = now;
-    return StatusCode::SUCCESS;
+StatusCode TRT_Hits_Monitoring_Tool::fillHistograms() {
+	const static boost::posix_time::time_duration sleepTime = boost::posix_time::milliseconds(m_sleepTime);
+	const boost::posix_time::ptime now = boost::posix_time::microsec_clock::universal_time();
+	if (now - m_lastPublishTime < sleepTime) return StatusCode::SUCCESS; // do not publish results too often
+
+	SG::ReadHandle<TRT_RDO_Container> rdoContainer(m_rdoContainerKey);
+	if (!rdoContainer.isValid()) {
+		ATH_MSG_ERROR("Could not find TRT RDO container " << m_rdoContainerKey.key());
+		return StatusCode::FAILURE;
+	}
+
+	unsigned int nHits_longToT = 0;
+	unsigned int nHitsBR_longToT = 0;
+	unsigned int nHitsEA_longToT = 0;
+	unsigned int nHitsEC_longToT = 0;
+
+	const TRT_RDO_Container::const_iterator containerBeg = rdoContainer->begin();
+	const TRT_RDO_Container::const_iterator containerEnd = rdoContainer->end();
+	for (TRT_RDO_Container::const_iterator collection = containerBeg; collection != containerEnd; ++collection) {
+		const InDetRawDataCollection<TRT_RDORawData> *TRT_Collection(*collection);
+		if (!TRT_Collection) continue; // select only TRT RDOs
+
+		const DataVector<TRT_RDORawData>::const_iterator collectionBeg = TRT_Collection->begin();
+		const DataVector<TRT_RDORawData>::const_iterator collectionEnd = TRT_Collection->end();
+		for (DataVector<TRT_RDORawData>::const_iterator rdo = collectionBeg; rdo != collectionEnd; ++rdo) {
+			const TRT_LoLumRawData *rawData = dynamic_cast<const TRT_LoLumRawData *>(*rdo);
+			if (!rawData) continue; // not the right data type
+			if (rawData->timeOverThreshold() <= m_longToTCut) continue; // omit hits with short ToT
+
+			++nHits_longToT;
+			switch (m_pTRTHelper->barrel_ec((*rdo)->identify())) { // which detector region?
+			case -1: // ... or ...
+			case +1: ++nHitsBR_longToT; break;
+			case +2: ++nHitsEA_longToT; break;
+			case -2: ++nHitsEC_longToT; break;
+			}
+		}
+	}
+
+	const unsigned int nChannelsBarrel = 105088; // 52544 straws with two channels
+	const unsigned int nChannelsEndcap = 122880; // 122880 straws with one channel
+	const unsigned int nChannelsTotal = nChannelsBarrel + 2 * nChannelsEndcap;
+
+	m_occ_longToT   = (float)nHits_longToT   / nChannelsTotal;
+	m_occBR_longToT = (float)nHitsBR_longToT / nChannelsBarrel;
+	m_occEA_longToT = (float)nHitsEA_longToT / nChannelsEndcap;
+	m_occEC_longToT = (float)nHitsEC_longToT / nChannelsEndcap;
+
+	m_dict.update(m_name_longToT,   m_occ_longToT);
+	m_dict.update(m_nameBR_longToT, m_occBR_longToT);
+	m_dict.update(m_nameEA_longToT, m_occEA_longToT);
+	m_dict.update(m_nameEC_longToT, m_occEC_longToT);
+
+	m_lastPublishTime = now;
+	return StatusCode::SUCCESS;
 }
 
-StatusCode TRT_Hits_Monitoring_Tool::procHistograms()
-{
-    return StatusCode::SUCCESS;
+StatusCode TRT_Hits_Monitoring_Tool::procHistograms() {
+	return StatusCode::SUCCESS;
 }
 
 #endif // ONLINE
diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx
index 78ae318a477fec46794263b0e6505b3dd0e94c14..78abcbb34c5eec087664fd1e626f4f5537be2404 100644
--- a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx
+++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx
@@ -4,20 +4,16 @@
 
 #include "TRT_Monitoring/TRT_Monitoring_Tool.h"
 
-#include "TRT_TrackHoleSearch/TRTTrackHoleSearchTool.h"
 #include "DataModel/DataVector.h"
 #include "InDetReadoutGeometry/TRT_DetectorManager.h"
 #include "InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h"
-#include "TrkToolInterfaces/ITrackSummaryTool.h"
 #include "TrkTrackSummary/TrackSummary.h"
-#include "CommissionEvent/ComTime.h"
 #include "AtlasDetDescr/AtlasDetectorID.h"
 #include "Identifier/Identifier.h"//may be obsolete, TRT_ID includes this
 #include "InDetIdentifier/TRT_ID.h"
 #include "InDetRawData/InDetRawDataContainer.h"
 #include "TrkTrack/Track.h"
 #include "TrkTrack/TrackCollection.h"
-#include "TRT_DriftFunctionTool/ITRT_DriftFunctionTool.h"
 #include "TRT_ConditionsServices/ITRT_CalDbSvc.h"
 #include "TRT_ConditionsServices/ITRT_ConditionsSvc.h"
 #include "TRT_ConditionsServices/ITRT_StrawStatusSummarySvc.h"
@@ -26,15 +22,13 @@
 #include "TRT_ConditionsServices/ITRT_ByteStream_ConditionsSvc.h"
 #include "TRT_ConditionsServices/ITRT_StrawNeighbourSvc.h"
 #include "InDetConditionsSummaryService/IInDetConditionsSvc.h"
-#include "EventInfo/EventInfo.h"
 #include "EventInfo/TriggerInfo.h"
 #include "EventInfo/EventID.h"
+#include "xAODTrigger/TrigDecision.h"
 
-//#include "TrkParameters/TrackParameters.h"
-//#include "TrkTrack/TrackStateOnSurface.h"
 #include "EventPrimitives/EventPrimitivesHelpers.h"
-//#include "VxVertex/VxContainer.h"
 
+#include "StoreGate/ReadHandle.h"
 
 #include "TProfile.h"
 #include "LWHists/TH1F_LW.h"
@@ -43,10 +37,10 @@
 #include "LWHists/TH1D_LW.h"
 #include "LWHists/LWHist1D.h"
 
-#if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0) 
-#   define CAN_REBIN(hist)  hist->SetCanExtend(TH1::kAllAxes)
+#if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
+#define CAN_REBIN(hist)  hist->SetCanExtend(TH1::kAllAxes)
 #else
-#   define CAN_REBIN(hist)  hist->SetBit(TH1::kCanRebin)
+#define CAN_REBIN(hist)  hist->SetBit(TH1::kCanRebin)
 #endif
 
 
@@ -58,4338 +52,4516 @@ using namespace std;
 //Private Static Const data member initialization
 const int TRT_Monitoring_Tool::s_numberOfBarrelStacks = 32;
 const int TRT_Monitoring_Tool::s_numberOfEndCapStacks = 32;
-const int TRT_Monitoring_Tool::s_Straw_max[2]={1642,3840};
-const int TRT_Monitoring_Tool::s_iStack_max[2]={32,64};
-const int TRT_Monitoring_Tool::s_iChip_max[2]={104,240};
-const int TRT_Monitoring_Tool::s_numberOfStacks[2]={32,32};
-const int TRT_Monitoring_Tool::s_moduleNum[2]={96,64};
+const int TRT_Monitoring_Tool::s_Straw_max[2] = {1642, 3840};
+const int TRT_Monitoring_Tool::s_iStack_max[2] = {32, 64};
+const int TRT_Monitoring_Tool::s_iChip_max[2] = {104, 240};
+const int TRT_Monitoring_Tool::s_numberOfStacks[2] = {32, 32};
+const int TRT_Monitoring_Tool::s_moduleNum[2] = {96, 64};
+
+
+// TODO: Clean up the rest of the package
+// TODO: Fix naming conventions
 
 //------------------------------------------------------------------------------------------------//
 TRT_Monitoring_Tool::TRT_Monitoring_Tool(const std::string &type, const std::string &name, const IInterface *parent) :
-  ManagedMonitorToolBase(type, name, parent),
-  lastLumiBlock(-99),
-  evtLumiBlock(0),
-  good_bcid(0),
-  m_nTotalTracks(0),
-  nBSErrors(),
-  nRobErrors(),
-  passEventBurst(),
-  m_idHelper(0),
-  p_toolSvc("IToolSvc",name),
-  m_sumSvc("TRT_StrawStatusSummarySvc",name),
-  m_DCSSvc("TRT_DCS_ConditionsSvc",name),
-  m_DAQSvc("TRT_DAQ_ConditionsSvc",name),
-  m_BSSvc("TRT_ByteStream_ConditionsSvc",name),
-  m_condSvc_BS("TRT_ByteStream_ConditionsSvc",name),
-  //m_condSvc_DAQ("TRT_DAQ_ConditionsSvc",name),
-  m_TRTStrawNeighbourSvc("TRT_StrawNeighbourSvc",name),
-  m_trtcaldbSvc("TRT_CalDbSvc",name),
-  m_doDCS(false),
-  m_pTRTHelper(0),
-  mgr(0),
-  m_TrackSummaryTool("Trk::TrackSummaryTool/InDetTrackSummaryTool"),
-  m_drifttool("TRT_DriftFunctionTool"),
-  m_rdoContainer(0),
-  m_trkCollection(0),
-  TRT_BCIDColl(0),
-  theComTime(0),
-  eventInfo(0),
-  m_comTimeObjectName("ComTime"),
-  geo_summary_provider("debug"),
-  rbins(40),
-  rmin(0.0),
-  rmax(2.0),
-  tbins(68),
-  tmin(-12.5),
-  tmax(75.0),
-  fitmin(-5.0),
-  fitmax(30.0),
-  m_HTfraconTrack_B(),
-  m_LonTrack_B(),
-  m_nTrack_B(),
-  m_nTrackwithHL_B(),
-  m_HTfraconTrack_E(),
-  m_LonTrack_E(),
-  m_nTrack_E(),
-  m_nTrackwithHL_E(),
-  nTRTHits(),
-  EventPhaseScale(1.0),
-  m_nStrawHits_B(),
-  m_nStrawHits_E(),
-  DriftTimeonTrkDistScale_B(),
-  HLhitOnTrackScale_B(),
-  HtoLRatioOnTrackScale_B(),
-  HtoLRatioOnTrackScale_B_Ar(), 
-  HtoLRatioOnTrackScale_B_Xe(), 
-  NumSwLLWoTScale_B(),
-  WireToTrkPositionScale_B(),
-  WireToTrkPositionScale_B_Ar(),
-  TronTDistScale_B(),
-  ResidualScale_B(),
-  ResidualScale_B_20GeV(),
-  TimeResidualScale_B(),
-  DriftTimeonTrkDistScale_B_Ar(),
-  TronTDistScale_B_Ar(),
-  ResidualScale_B_Ar(),
-  ResidualScale_B_Ar_20GeV(),
-  TimeResidualScale_B_Ar(),
-  nTrkvPhiScale_B(),
-  DriftTimeonTrkDistScale_E(),
-  HLhitOnTrackScale_E(),
-  HtoLRatioOnTrackScale_E(),
-  HtoLRatioOnTrackScale_E_Ar(), 
-  HtoLRatioOnTrackScale_E_Xe(),
-  NumSwLLWoTScale_E(),
-  WireToTrkPositionScale_E(),
-  WireToTrkPositionScale_E_Ar(),
-  TronTDistScale_E(),
-  ResidualScale_E(),
-  ResidualScale_E_20GeV(),
-  TimeResidualScale_E(),
-  DriftTimeonTrkDistScale_E_Ar(),
-  ResidualScale_E_Ar(),
-  ResidualScale_E_Ar_20GeV(),
-  TimeResidualScale_E_Ar(),
-  nTrkvPhiScale_E(),
-  //m_propagator(0),
-  //m_extrapolator(0),
-  DEBUG(false),
-  m_printEventInfo(false),
-  m_longToTCut(9.375),
-  m_EventBurstCut(200),
-  m_lumiBlocksToResetOcc(20),
-  m_isCosmics(false),
-  m_minTRThits(10),
-  m_minP(0),
-  m_trt_hole_finder("TRTTrackHoleSearchTool"),
-  m_track_pt(0),
-  m_track_eta(0),
-  m_track_phi(0),
-  m_track_d0(0),
-  m_track_z0(0),
-  m_min_tracks_straw(10),
-  m_lumiTool("LuminosityTool"),
-  m_trkCollectionEff(0)
-
-  //-----------------------------------------------------------------------------------------------//
+	ManagedMonitorToolBase(type, name, parent),
+	m_lastLumiBlock(-99),
+	m_evtLumiBlock(0),
+	m_good_bcid(0),
+	m_nTotalTracks(0),
+	m_nBSErrors(),
+	m_nRobErrors(),
+	m_passEventBurst(),
+	m_idHelper(0),
+	p_toolSvc("IToolSvc", name),
+	m_sumSvc("TRT_StrawStatusSummarySvc", name),
+	m_DCSSvc("TRT_DCS_ConditionsSvc", name), // NOTE: not used anywhere?
+	m_DAQSvc("TRT_DAQ_ConditionsSvc", name), // NOTE: not used anywhere?
+	m_BSSvc("TRT_ByteStream_ConditionsSvc", name),
+	m_condSvc_BS("TRT_ByteStream_ConditionsSvc", name), // NOTE: not used anywhere?
+	m_TRTStrawNeighbourSvc("TRT_StrawNeighbourSvc", name),
+	m_TRTCalDbSvc("TRT_CalDbSvc", name),
+	m_drifttool("TRT_DriftFunctionTool"),
+	m_pTRTHelper(0),
+	m_mgr(0),
+	m_rbins(40),
+	m_rmin(0.0),
+	m_rmax(2.0),
+	m_tbins(68),
+	m_tmin(-12.5),
+	m_tmax(75.0),
+	m_fitmin(-5.0),
+	m_fitmax(30.0),
+	m_HTfraconTrack_B(),
+	m_LonTrack_B(),
+	m_nTrack_B(),
+	m_nTrackwithHL_B(),
+	m_HTfraconTrack_E(),
+	m_LonTrack_E(),
+	m_nTrack_E(),
+	m_nTrackwithHL_E(),
+	nTRTHits(),
+	m_doDCS(false),
+	EventPhaseScale(1.0),
+	m_nStrawHits_B(),
+	m_nStrawHits_E(),
+	DriftTimeonTrkDistScale_B(),
+	HLhitOnTrackScale_B(),
+	HtoLRatioOnTrackScale_B(),
+	HtoLRatioOnTrackScale_B_Ar(),
+	HtoLRatioOnTrackScale_B_Xe(),
+	NumSwLLWoTScale_B(),
+	WireToTrkPositionScale_B(),
+	WireToTrkPositionScale_B_Ar(),
+	TronTDistScale_B(),
+	ResidualScale_B(),
+	ResidualScale_B_20GeV(),
+	TimeResidualScale_B(),
+	DriftTimeonTrkDistScale_B_Ar(),
+	TronTDistScale_B_Ar(),
+	ResidualScale_B_Ar(),
+	ResidualScale_B_Ar_20GeV(),
+	TimeResidualScale_B_Ar(),
+	nTrkvPhiScale_B(),
+	DriftTimeonTrkDistScale_E(),
+	HLhitOnTrackScale_E(),
+	HtoLRatioOnTrackScale_E(),
+	HtoLRatioOnTrackScale_E_Ar(),
+	HtoLRatioOnTrackScale_E_Xe(),
+	NumSwLLWoTScale_E(),
+	WireToTrkPositionScale_E(),
+	WireToTrkPositionScale_E_Ar(),
+	TronTDistScale_E(),
+	ResidualScale_E(),
+	ResidualScale_E_20GeV(),
+	TimeResidualScale_E(),
+	DriftTimeonTrkDistScale_E_Ar(),
+	ResidualScale_E_Ar(),
+	ResidualScale_E_Ar_20GeV(),
+	TimeResidualScale_E_Ar(),
+	nTrkvPhiScale_E(),
+	//m_propagator(0),
+	//m_extrapolator(0),
+	DEBUG(false),
+	m_longToTCut(9.375),
+	m_EventBurstCut(200),
+	m_lumiBlocksToResetOcc(20),
+	m_isCosmics(false),
+	m_minTRThits(10),
+	m_minP(0),
+	m_track_pt(0),
+	m_track_eta(0),
+	m_track_phi(0),
+	m_track_d0(0),
+	m_track_z0(0),
+	m_min_tracks_straw(10)
+//-----------------------------------------------------------------------------------------------//
+// NOTE: check up on obsolete properties
 {
-  declareProperty("ToolSvc",                  p_toolSvc);
-  declareProperty("InDetTRTStrawStatusSummarySvc",m_sumSvc);
-  declareProperty("InDetTRT_DAQ_ConditionsSvc", m_DAQSvc);
-  declareProperty("InDetTRT_DCS_ConditionsSvc", m_DCSSvc);
-  declareProperty("TRT_ByteStream_ConditionsSvc", m_BSSvc);
-  declareProperty("TRT_StrawNeighbourSvc",   m_TRTStrawNeighbourSvc);
-  declareProperty("DriftFunctionTool",        m_drifttool);
-  declareProperty("DoTRT_DCS",                m_doDCS);
-  declareProperty("DoRDOsMon",                m_doRDOsMon           = true);
-  declareProperty("DoGeoMon",                 m_doGeoMon            = false);//obsolete
-  declareProperty("TRTRawDataObjectName",     m_rawDataObjectName   = "TRT_RDOs");
-  declareProperty("NumberOfEvents",           m_nEvents             = -1);
-  declareProperty("DoTracksMon",              m_doTracksMon         = true);
-  declareProperty("TRTTracksObjectName",      m_tracksObjectName    = "Tracks");
-  declareProperty("doAside",                  DoAside               = true);//obsolete
-  declareProperty("doCside",                  DoCside               = true);//obsolete
-  declareProperty("doStraws",                 DoStraws              = true);
-  declareProperty("doChips",                  DoChips               = false);
-  declareProperty("doExpert",                 DoExpert              = false);
-  declareProperty("doEfficiency",             DoEfficiency          = true);
-  declareProperty("doMaskStraws",             DoMaskStraws          = true);
-  declareProperty("doShift",                  DoShift               = true);
-  declareProperty("doDiagnostic",             DoDiagnostic          = false);//obsolete
-  declareProperty("ComTimeObjectName",        m_comTimeObjectName   = "TRT_Phase");
-  declareProperty("TrkSummaryTool",           m_TrackSummaryTool);
-  declareProperty("Geo_Summary_Provider",     geo_summary_provider);//probably obsolete
-  declareProperty("Map_Path",                 mapPath); // obsolete
-  declareProperty("maxDistToStraw",           m_maxDistToStraw      = 2.0);//obsolete
-  declareProperty("DistanceToStraw",          m_DistToStraw         = 0.4);
-  declareProperty("is_TRT_only_tracks",       m_trt_only_trks       = true);//obsolete
-  declareProperty("is_zero_mag_field",        m_zero_field          = true);//obsolete
-  //
-  //   Tunable parameters for TRT monitoring histograms
-  //
-  declareProperty("LE_TimeWindow_MIN",        m_LE_timeWindow_MIN   = 0);//obsolete
-  declareProperty("LE_TimeWindow_MAX",        m_LE_timeWindow_MAX   = 24);//obsolete
-  declareProperty("LL_TimeWindow_MIN",        m_LL_timeWindow_MIN   = 0);//obsolete
-  declareProperty("LL_TimeWindow_MAX",        m_LL_timeWindow_MAX   = 24);//obsolete
-  declareProperty("HL_TimeWindow_MIN",        m_HL_timeWindow_MIN   = 0);//obsolete
-  declareProperty("HL_TimeWindow_MAX",        m_HL_timeWindow_MAX   = 3);//obsolete
-  declareProperty("MIN_N_LL_Hits",            m_MIN_N_LL_Hits       = 10);//obsolete
-  declareProperty("MIN_TOT_Hits",             m_MIN_TOT_Hits        = 2);//obsolete
-  declareProperty("NoiseSuppressionLevel_30pc", m_NoiseSuppressionLevel_30pc = false);//obsolete
-  declareProperty("NoiseSuppressionMap",      m_NoiseSuppressionMap = false);//obsolete
-  declareProperty("Debug",                    DEBUG);//obsolete
-  declareProperty("PrintEventInfo",           m_printEventInfo);//obsolete
-  declareProperty("ITRT_CalDbSvc",            m_trtcaldbSvc);
-  declareProperty("LongToTCut",               m_longToTCut);
-  declareProperty("NPhiBins",                 m_nphi_bins           = 360);
-  declareProperty("EventBurstCut",            m_EventBurstCut       = 200);
-  declareProperty("LumiBlocksToResetOcc",     m_lumiBlocksToResetOcc = 20);
-  declareProperty("IsCosmics",                m_isCosmics           = false);
-  declareProperty("MinTRTHitCut",             m_minTRThits          = 10);
-  declareProperty("trt_hole_finder",          m_trt_hole_finder);
-  declareProperty("useHoleFinder",            m_useHoleFinder = true);
-  declareProperty("track_collection_hole_finder", m_track_collection_hole_finder = "CombinedInDetTracks");
-  declareProperty("max_abs_d0",               m_max_abs_d0          = 10 * CLHEP::mm);
-  declareProperty("max_abs_z0",               m_max_abs_z0          = 300 * CLHEP::mm);
-  declareProperty("max_abs_eta",              m_max_abs_eta         = 2.5);
-  declareProperty("MinTrackP",                m_minP                = 0.0 * CLHEP::GeV);
-  declareProperty("min_pT",                   m_min_pT              = 0.5 * CLHEP::GeV);
-  declareProperty("min_si_hits",              m_min_si_hits         = 1);
-  declareProperty("min_pixel_hits",           m_min_pixel_hits      = 0);
-  declareProperty("min_sct_hits",             m_min_sct_hits        = 0);
-  declareProperty("min_trt_hits",             m_min_trt_hits        = 10);
-  declareProperty("min_tracks_straw",         m_min_tracks_straw    = 10);
-  declareProperty("every_xth_track",          m_every_xth_track     = 25);
-  declareProperty("whatdatatype",             m_datatype);//obsolete
-  declareProperty("doArgonXenonSeparation",   m_ArgonXenonSplitter  = true); // Argon Histograms won't be created if this is set to false.
-  declareProperty("LuminosityTool", m_lumiTool, "Luminosity Tool"); 
-
-  m_flagforscale=1;//Added for a fix
-  nEvents=0;
-  m_hSummary = 0;
-  m_IntLum = 0;//
-  m_LBvsLum =0;// coverity 25098
-  m_LBvsTime =0;//
-  m_hEvtPhaseDetPhi_B = 0;
-  m_hEvtPhase = 0;
-  m_hEvtPhaseVsTrig = 0;
-  m_hOccAll = 0;
-  m_hefficiency_eta = 0;
-  m_hefficiency_phi = 0;
-  m_hefficiency_pt = 0;
-  m_hefficiency_z0 = 0;
-
-  for (int iside=0; iside<2; iside++) { // A-side(iside=0), C-side(iside=1)
-    m_nTracksB[iside]=0;
-    m_nTracksEC[iside]=0;
-    m_nTracksEC_B[iside]=0;
-  }
-
-  for (int ibe=0; ibe<2; ibe++) {
-    m_hBCIDvsOcc[ibe] = 0;
-    m_hHitsOnTrack_Scatter[ibe] = 0;
-    m_hLLOcc_Scatter[ibe] = 0;
-    m_hHightoLowRatioOnTrack_Scatter[ibe] = 0;
-    m_hefficiencyMap[ibe]=0;
-
-    for (int iside=0; iside<2; iside++) {
-      m_hChipBSErrorsVsLB[ibe][iside] = 0;
-      m_hRobBSErrorsVsLB[ibe][iside] = 0;
-      m_hAvgHLOcc_side[ibe][iside] = 0;
-      m_hAvgLLOcc_side[ibe][iside] = 0;
-      m_hAvgLLOccMod_side[ibe][iside] = 0;
-      m_hAvgHLOccMod_side[ibe][iside] = 0;
-      m_hefficiency[ibe][iside] = 0;
-      m_hefficiencyIntegral[ibe][iside] = 0;
-    }// for (int iside=0; iside<2; iside++)
-
-    for (int i = 0; i < 64; i++) {
-      m_hChipOcc[ibe][i] = 0;
-      m_hStrawOcc[ibe][i] = 0;
-      m_hStrawsEff[ibe][i] = 0;
-      m_hChipsEff[ibe][i] = 0;
-      m_hHitOnTrackVsAllS[ibe][i] = 0;
-      m_hHitOnTrackVsAllC[ibe][i] = 0;
-      m_hHitWMapS[ibe][i] = 0;
-      m_hHitTrWMapS[ibe][i] = 0;
-      m_hHitTrMapS[ibe][i] = 0;
-      m_hHitAMapS[ibe][i] = 0;
-      m_hHitAWMapS[ibe][i] = 0;
-      m_hHtoLMapS[ibe][i] = 0;
-      m_hHitToTMapS[ibe][i] = 0;
-      m_hHitToTLongMapS[ibe][i] = 0;
-      m_hHitToTLongTrMapS[ibe][i] = 0;
-      m_hHitHMapS[ibe][i] = 0;
-      m_hHitHWMapS[ibe][i] = 0;
-      m_hHitWonTMapS[ibe][i] = 0;
-      m_hHitTronTMapS[ibe][i] = 0;
-      m_hHitAonTMapS[ibe][i] = 0;
-      m_hHitAWonTMapS[ibe][i] = 0;
-      m_hHitHonTMapS[ibe][i] = 0;
-      m_hHitHWonTMapS[ibe][i] = 0;
-      m_hHtoLonTMapS[ibe][i] = 0;
-      m_hHtoLWonTMapS[ibe][i] = 0;
-      m_hHitToTonTMapS[ibe][i] = 0;
-      m_hHitTronTwEPCMapS[ibe][i] = 0;
-      m_hValidRawDriftTimeonTrk[ibe][i] = 0;
-      m_hValidRawDriftTimeonTrkC[ibe][i] = 0;
-      m_hHitWMapC[ibe][i] = 0;
-      m_hHitTrMapC[ibe][i] = 0;
-      m_hHitTrWMapC[ibe][i] = 0;
-      m_hHitAMapC[ibe][i] = 0;
-      m_hHitAWMapC[ibe][i] = 0;
-      m_hHtoLMapC[ibe][i] = 0;
-      m_hHtoBCMapC[ibe][i] = 0;
-      m_hHtoBCMapB[ibe][i] = 0;
-      m_hHitToTMapC[ibe][i] = 0;
-      m_hHitHMapC[ibe][i] = 0;
-      m_hHitHWMapC[ibe][i] = 0;
-      m_hHitWonTMapC[ibe][i] = 0;
-      m_hHitTronTMapC[ibe][i] = 0;
-      m_hHitAonTMapC[ibe][i] = 0;
-      m_hHitAWonTMapC[ibe][i] = 0;
-      m_hHitHonTMapC[ibe][i] = 0;
-      m_hHitHWonTMapC[ibe][i] = 0;
-      m_hHtoLonTMapC[ibe][i] = 0;
-      m_hHtoLWonTMapC[ibe][i] = 0;
-      m_hHitToTonTMapC[ibe][i] = 0;
-      m_hHitTronTwEPCMapC[ibe][i] = 0;
-      m_hefficiencyS[ibe][i] = 0;
-      m_hefficiencyC[ibe][i] = 0;
-
-      if (ibe==1) m_hHitToTrkDistanceMapS_E[i]=0;
-
-    } //for (int i = 0; i < 64; i++)
-  } // for (int ibe=0; ibe<2; ibe++)
-
-  nTrksperLB_B=0;
-  nHitsperLB_B=0;
-  nHLHitsperLB_B=0;
-  m_hNumTrksDetPhi_B = 0;
-  m_hNumHoTDetPhi_B = 0;
-  m_hAvgTroTDetPhi_B = 0;
-  m_hAvgTroTDetPhi_B_Ar = 0; 
-  m_hStrawEffDetPhi_B = 0;
-  m_hNumSwLLWoT_B = 0;
-  m_hHitWMap_B = 0;
-  m_hHitWonTMap_B = 0;
-  m_Pull_Biased_Barrel= 0;
-  m_hResidual_B = 0; 
-  m_hResidual_B_20GeV = 0; 
-  m_hTimeResidual_B = 0;
-  m_hDriftTimeonTrkDist_B = 0;
-  m_hTronTDist_B = 0;
-  m_hrtRelation_B = 0;
-  m_hHLhitOnTrack_B = 0;
-  m_hHtoLRatioOnTrack_B = 0;
-  m_hWireToTrkPosition_B = 0;
-  m_hWireToTrkPosition_B_Ar = 0; 
-  m_hHtoLRatioOnTrack_B_Ar = 0;
-  m_hHtoLRatioOnTrack_B_Xe = 0;
-  m_hResVsDetPhi_B = 0;
-  m_hNHitsperLB_B = 0;
-  m_hNTrksperLB_B = 0;
-  m_hNHLHitsperLB_B = 0;
-  m_hefficiencyBarrel_locR = 0;
-  m_hefficiencyBarrel_locR_Ar = 0;
-  m_hHitWMap_B_Ar=0;
-  m_hResidual_B_Ar=0;
-  m_hResidual_B_Ar_20GeV=0;
-  m_hTimeResidual_B_Ar=0;
-  m_hrtRelation_B_Ar = 0;
-  m_hDriftTimeonTrkDist_B_Ar = 0;
-  m_hTronTDist_B_Ar = 0;
-
-
-  m_Pull_Biased_EndCap= 0;
-  for (int iside=0; iside<2; iside++) {
-    nTrksperLB_E[iside]=0;
-    nHitsperLB_E[iside]=0;
-    nHLHitsperLB_E[iside]=0;
-    m_hNumTrksDetPhi_E[iside] = 0;
-    m_hNumHoTDetPhi_E[iside] = 0;
-    m_hAvgTroTDetPhi_E[iside] = 0;
-    m_hAvgTroTDetPhi_E_Ar[iside] = 0;
-    m_hStrawEffDetPhi_E[iside] = 0;
-    m_hNumSwLLWoT_E[iside] = 0;
-    m_hEvtPhaseDetPhi_E[iside] = 0;
-    m_hHitWMap_E[iside] = 0;
-    m_hHitWonTMap_E[iside] = 0;
-    m_hResidual_E[iside] = 0;
-    m_hResidual_E_20GeV[iside] = 0;
-    m_hTimeResidual_E[iside] = 0;
-    m_hDriftTimeonTrkDist_E[iside] = 0;
-    m_hTronTDist_E[iside] = 0;
-    m_hrtRelation_E[iside] = 0;
-    m_hHLhitOnTrack_E[iside] = 0;
-    m_hHtoLRatioOnTrack_E[iside] = 0;
-    m_hHtoLRatioOnTrack_E_Ar[iside] = 0;
-    m_hHtoLRatioOnTrack_E_Xe[iside] = 0; 
-    m_hWireToTrkPosition_E[iside] = 0;
-    m_hWireToTrkPosition_E_Ar[iside] = 0;
-    m_hResVsDetPhi_E[iside] = 0;
-    m_hNHitsperLB_E[iside] = 0;
-    m_hNTrksperLB_E[iside] = 0;
-    m_hNHLHitsperLB_E[iside] = 0;
-    m_hefficiencyEndCap_locR[iside] = 0;
-    m_hefficiencyEndCap_locR_Ar[iside] = 0;
-    m_hHitWMap_E_Ar[iside] = 0;
-    m_hResidual_E_Ar[iside] = 0;
-    m_hResidual_E_Ar_20GeV[iside] = 0;
-    m_hTimeResidual_E_Ar[iside] = 0;
-    m_hrtRelation_E_Ar[iside] = 0;
-    m_hTronTDist_E_Ar[iside] = 0;
-    m_hDriftTimeonTrkDist_E_Ar[iside] = 0;
-  }
+	declareProperty("ToolSvc",                  p_toolSvc);
+	declareProperty("InDetTRTStrawStatusSummarySvc", m_sumSvc);
+	declareProperty("InDetTRT_DAQ_ConditionsSvc", m_DAQSvc);
+	declareProperty("InDetTRT_DCS_ConditionsSvc", m_DCSSvc);
+	declareProperty("TRT_ByteStream_ConditionsSvc", m_BSSvc);
+	declareProperty("TRT_StrawNeighbourSvc",   m_TRTStrawNeighbourSvc);
+	declareProperty("DriftFunctionTool",        m_drifttool);
+	declareProperty("DoTRT_DCS",                m_doDCS);
+	declareProperty("DoRDOsMon",                m_doRDOsMon           = true);
+	declareProperty("DoGeoMon",                 m_doGeoMon            = false);//obsolete
+	declareProperty("NumberOfEvents",           m_usedEvents             = -1);
+	declareProperty("DoTracksMon",              m_doTracksMon         = true);
+	declareProperty("doAside",                  m_doASide               = true);//obsolete
+	declareProperty("doCside",                  m_doCSide               = true);//obsolete
+	declareProperty("doStraws",                 m_doStraws              = true);
+	declareProperty("doChips",                  m_doChips               = false);
+	declareProperty("doExpert",                 m_doExpert              = false);
+	declareProperty("doEfficiency",             m_doEfficiency          = true);
+	declareProperty("doMaskStraws",             m_doMaskStraws          = true);
+	declareProperty("doShift",                  m_doShift               = true);
+	declareProperty("doDiagnostic",             m_doDiagnostic          = false);//obsolete	
+	declareProperty("DistanceToStraw",          m_DistToStraw         = 0.4);
+	declareProperty("Geo_Summary_Provider",     m_geo_summary_provider);//probably obsolete
+	declareProperty("Map_Path",                 m_mapPath); // obsolete
+	declareProperty("maxDistToStraw",           m_maxDistToStraw      = 2.0);//obsolete
+	declareProperty("is_TRT_only_tracks",       m_trt_only_trks       = true);//obsolete
+	declareProperty("is_zero_mag_field",        m_zero_field          = true);//obsolete
+	//
+	//   Tunable parameters for TRT monitoring histograms
+	//
+	declareProperty("LE_TimeWindow_MIN",        m_LE_timeWindow_MIN   = 0);//obsolete
+	declareProperty("LE_TimeWindow_MAX",        m_LE_timeWindow_MAX   = 24);//obsolete
+	declareProperty("LL_TimeWindow_MIN",        m_LL_timeWindow_MIN   = 0);//obsolete
+	declareProperty("LL_TimeWindow_MAX",        m_LL_timeWindow_MAX   = 24);//obsolete
+	declareProperty("HL_TimeWindow_MIN",        m_HL_timeWindow_MIN   = 0);//obsolete
+	declareProperty("HL_TimeWindow_MAX",        m_HL_timeWindow_MAX   = 3);//obsolete
+	declareProperty("MIN_N_LL_Hits",            m_MIN_N_LL_Hits       = 10);//obsolete
+	declareProperty("MIN_TOT_Hits",             m_MIN_TOT_Hits        = 2);//obsolete
+	declareProperty("NoiseSuppressionLevel_30pc", m_NoiseSuppressionLevel_30pc = false);//obsolete
+	declareProperty("NoiseSuppressionMap",      m_NoiseSuppressionMap = false);//obsolete
+	declareProperty("Debug",                    DEBUG);//obsolete
+	declareProperty("PrintEventInfo",           m_printEventInfo);//obsolete
+	declareProperty("ITRT_CalDbSvc",            m_TRTCalDbSvc);
+	declareProperty("LongToTCut",               m_longToTCut);
+	declareProperty("NPhiBins",                 m_nphi_bins           = 360);
+	declareProperty("EventBurstCut",            m_EventBurstCut       = 200);
+	declareProperty("LumiBlocksToResetOcc",     m_lumiBlocksToResetOcc = 20);
+	declareProperty("IsCosmics",                m_isCosmics           = false);
+	declareProperty("MinTRTHitCut",             m_minTRThits          = 10);
+	declareProperty("useHoleFinder",            m_useHoleFinder = true);
+	declareProperty("max_abs_d0",               m_max_abs_d0          = 10 * CLHEP::mm);
+	declareProperty("max_abs_z0",               m_max_abs_z0          = 300 * CLHEP::mm);
+	declareProperty("max_abs_eta",              m_max_abs_eta         = 2.5);
+	declareProperty("MinTrackP",                m_minP                = 0.0 * CLHEP::GeV);
+	declareProperty("min_pT",                   m_min_pT              = 0.5 * CLHEP::GeV);
+	declareProperty("min_si_hits",              m_min_si_hits         = 1);
+	declareProperty("min_pixel_hits",           m_min_pixel_hits      = 0);
+	declareProperty("min_sct_hits",             m_min_sct_hits        = 0);
+	declareProperty("min_trt_hits",             m_min_trt_hits        = 10);
+	declareProperty("min_tracks_straw",         m_min_tracks_straw    = 10);
+	declareProperty("every_xth_track",          m_every_xth_track     = 25);
+	declareProperty("whatdatatype",             m_datatype);//obsolete
+	declareProperty("doArgonXenonSeparation",   m_ArgonXenonSplitter  = true); // Argon Histograms won't be created if this is set to false.
+	m_flagforscale = 1; //Added for a fix
+	m_totalEvents = 0;
+	m_hSummary = 0;
+	m_IntLum = 0;//
+	m_LBvsLum = 0; // coverity 25098
+	m_LBvsTime = 0; //
+	m_hEvtPhaseDetPhi_B = 0;
+	m_hEvtPhase = 0;
+	m_hEvtPhaseVsTrig = 0;
+	m_hOccAll = 0;
+	m_hefficiency_eta = 0;
+	m_hefficiency_phi = 0;
+	m_hefficiency_pt = 0;
+	m_hefficiency_z0 = 0;
+
+	for (int iside = 0; iside < 2; iside++) { // A-side(iside=0), C-side(iside=1)
+		m_nTracksB[iside] = 0;
+		m_nTracksEC[iside] = 0;
+		m_nTracksEC_B[iside] = 0;
+	}
+
+	for (int ibe = 0; ibe < 2; ibe++) {
+		m_hBCIDvsOcc[ibe] = 0;
+		m_hHitsOnTrack_Scatter[ibe] = 0;
+		m_hLLOcc_Scatter[ibe] = 0;
+		m_hHightoLowRatioOnTrack_Scatter[ibe] = 0;
+		m_hefficiencyMap[ibe] = 0;
+
+		for (int iside = 0; iside < 2; iside++) {
+			m_hChipBSErrorsVsLB[ibe][iside] = 0;
+			m_hRobBSErrorsVsLB[ibe][iside] = 0;
+			m_hAvgHLOcc_side[ibe][iside] = 0;
+			m_hAvgLLOcc_side[ibe][iside] = 0;
+			m_hAvgLLOccMod_side[ibe][iside] = 0;
+			m_hAvgHLOccMod_side[ibe][iside] = 0;
+			m_hefficiency[ibe][iside] = 0;
+			m_hefficiencyIntegral[ibe][iside] = 0;
+		}// for (int iside=0; iside<2; iside++)
+
+		for (int i = 0; i < 64; i++) {
+			m_hChipOcc[ibe][i] = 0;
+			m_hStrawOcc[ibe][i] = 0;
+			m_hStrawsEff[ibe][i] = 0;
+			m_hChipsEff[ibe][i] = 0;
+			m_hHitOnTrackVsAllS[ibe][i] = 0;
+			m_hHitOnTrackVsAllC[ibe][i] = 0;
+			m_hHitWMapS[ibe][i] = 0;
+			m_hHitTrWMapS[ibe][i] = 0;
+			m_hHitTrMapS[ibe][i] = 0;
+			m_hHitAMapS[ibe][i] = 0;
+			m_hHitAWMapS[ibe][i] = 0;
+			m_hHtoLMapS[ibe][i] = 0;
+			m_hHitToTMapS[ibe][i] = 0;
+			m_hHitToTLongMapS[ibe][i] = 0;
+			m_hHitToTLongTrMapS[ibe][i] = 0;
+			m_hHitHMapS[ibe][i] = 0;
+			m_hHitHWMapS[ibe][i] = 0;
+			m_hHitWonTMapS[ibe][i] = 0;
+			m_hHitTronTMapS[ibe][i] = 0;
+			m_hHitAonTMapS[ibe][i] = 0;
+			m_hHitAWonTMapS[ibe][i] = 0;
+			m_hHitHonTMapS[ibe][i] = 0;
+			m_hHitHWonTMapS[ibe][i] = 0;
+			m_hHtoLonTMapS[ibe][i] = 0;
+			m_hHtoLWonTMapS[ibe][i] = 0;
+			m_hHitToTonTMapS[ibe][i] = 0;
+			m_hHitTronTwEPCMapS[ibe][i] = 0;
+			m_hValidRawDriftTimeonTrk[ibe][i] = 0;
+			m_hValidRawDriftTimeonTrkC[ibe][i] = 0;
+			m_hHitWMapC[ibe][i] = 0;
+			m_hHitTrMapC[ibe][i] = 0;
+			m_hHitTrWMapC[ibe][i] = 0;
+			m_hHitAMapC[ibe][i] = 0;
+			m_hHitAWMapC[ibe][i] = 0;
+			m_hHtoLMapC[ibe][i] = 0;
+			m_hHtoBCMapC[ibe][i] = 0;
+			m_hHtoBCMapB[ibe][i] = 0;
+			m_hHitToTMapC[ibe][i] = 0;
+			m_hHitHMapC[ibe][i] = 0;
+			m_hHitHWMapC[ibe][i] = 0;
+			m_hHitWonTMapC[ibe][i] = 0;
+			m_hHitTronTMapC[ibe][i] = 0;
+			m_hHitAonTMapC[ibe][i] = 0;
+			m_hHitAWonTMapC[ibe][i] = 0;
+			m_hHitHonTMapC[ibe][i] = 0;
+			m_hHitHWonTMapC[ibe][i] = 0;
+			m_hHtoLonTMapC[ibe][i] = 0;
+			m_hHtoLWonTMapC[ibe][i] = 0;
+			m_hHitToTonTMapC[ibe][i] = 0;
+			m_hHitTronTwEPCMapC[ibe][i] = 0;
+			m_hefficiencyS[ibe][i] = 0;
+			m_hefficiencyC[ibe][i] = 0;
+
+			if (ibe == 1) m_hHitToTrkDistanceMapS_E[i] = 0;
+		} //for (int i = 0; i < 64; i++)
+	} // for (int ibe=0; ibe<2; ibe++)
+
+	nTrksperLB_B = 0;
+	nHitsperLB_B = 0;
+	nHLHitsperLB_B = 0;
+	m_hNumTrksDetPhi_B = 0;
+	m_hNumHoTDetPhi_B = 0;
+	m_hAvgTroTDetPhi_B = 0;
+	m_hAvgTroTDetPhi_B_Ar = 0;
+	m_hStrawEffDetPhi_B = 0;
+	m_hNumSwLLWoT_B = 0;
+	m_hHitWMap_B = 0;
+	m_hHitWonTMap_B = 0;
+	m_Pull_Biased_Barrel = 0;
+	m_hResidual_B = 0;
+	m_hResidual_B_20GeV = 0;
+	m_hTimeResidual_B = 0;
+	m_hDriftTimeonTrkDist_B = 0;
+	m_hTronTDist_B = 0;
+	m_hrtRelation_B = 0;
+	m_hHLhitOnTrack_B = 0;
+	m_hHtoLRatioOnTrack_B = 0;
+	m_hWireToTrkPosition_B = 0;
+	m_hWireToTrkPosition_B_Ar = 0;
+	m_hHtoLRatioOnTrack_B_Ar = 0;
+	m_hHtoLRatioOnTrack_B_Xe = 0;
+	m_hResVsDetPhi_B = 0;
+	m_hNHitsperLB_B = 0;
+	m_hNTrksperLB_B = 0;
+	m_hNHLHitsperLB_B = 0;
+	m_hefficiencyBarrel_locR = 0;
+	m_hefficiencyBarrel_locR_Ar = 0;
+	m_hHitWMap_B_Ar = 0;
+	m_hResidual_B_Ar = 0;
+	m_hResidual_B_Ar_20GeV = 0;
+	m_hTimeResidual_B_Ar = 0;
+	m_hrtRelation_B_Ar = 0;
+	m_hDriftTimeonTrkDist_B_Ar = 0;
+	m_hTronTDist_B_Ar = 0;
+	m_Pull_Biased_EndCap = 0;
+
+	for (int iside = 0; iside < 2; iside++) {
+		nTrksperLB_E[iside] = 0;
+		nHitsperLB_E[iside] = 0;
+		nHLHitsperLB_E[iside] = 0;
+		m_hNumTrksDetPhi_E[iside] = 0;
+		m_hNumHoTDetPhi_E[iside] = 0;
+		m_hAvgTroTDetPhi_E[iside] = 0;
+		m_hAvgTroTDetPhi_E_Ar[iside] = 0;
+		m_hStrawEffDetPhi_E[iside] = 0;
+		m_hNumSwLLWoT_E[iside] = 0;
+		m_hEvtPhaseDetPhi_E[iside] = 0;
+		m_hHitWMap_E[iside] = 0;
+		m_hHitWonTMap_E[iside] = 0;
+		m_hResidual_E[iside] = 0;
+		m_hResidual_E_20GeV[iside] = 0;
+		m_hTimeResidual_E[iside] = 0;
+		m_hDriftTimeonTrkDist_E[iside] = 0;
+		m_hTronTDist_E[iside] = 0;
+		m_hrtRelation_E[iside] = 0;
+		m_hHLhitOnTrack_E[iside] = 0;
+		m_hHtoLRatioOnTrack_E[iside] = 0;
+		m_hHtoLRatioOnTrack_E_Ar[iside] = 0;
+		m_hHtoLRatioOnTrack_E_Xe[iside] = 0;
+		m_hWireToTrkPosition_E[iside] = 0;
+		m_hWireToTrkPosition_E_Ar[iside] = 0;
+		m_hResVsDetPhi_E[iside] = 0;
+		m_hNHitsperLB_E[iside] = 0;
+		m_hNTrksperLB_E[iside] = 0;
+		m_hNHLHitsperLB_E[iside] = 0;
+		m_hefficiencyEndCap_locR[iside] = 0;
+		m_hefficiencyEndCap_locR_Ar[iside] = 0;
+		m_hHitWMap_E_Ar[iside] = 0;
+		m_hResidual_E_Ar[iside] = 0;
+		m_hResidual_E_Ar_20GeV[iside] = 0;
+		m_hTimeResidual_E_Ar[iside] = 0;
+		m_hrtRelation_E_Ar[iside] = 0;
+		m_hTronTDist_E_Ar[iside] = 0;
+		m_hDriftTimeonTrkDist_E_Ar[iside] = 0;
+	}
 }
 
 //-------------------------------------------------------------------------//
-TRT_Monitoring_Tool::~TRT_Monitoring_Tool()
+TRT_Monitoring_Tool::~TRT_Monitoring_Tool() {}
 //-------------------------------------------------------------------------//
-{
-}
 
 //------------------------------------------------------------------------------------//
-StatusCode TRT_Monitoring_Tool::initialize()
+StatusCode TRT_Monitoring_Tool::initialize() {
 //------------------------------------------------------------------------------------//
-{
-  ATH_MSG_VERBOSE("Initializing TRT Monitoring");
-
-  StatusCode sc = ManagedMonitorToolBase::initialize();
-  if (!sc.isSuccess()) return sc;
-
-  sc = AlgTool::initialize();
-  if (!sc.isSuccess())
-    return StatusCode::FAILURE;
-
-  IToolSvc* p_toolSvc;
-  sc = service("ToolSvc",p_toolSvc);
-  if (sc.isFailure()) {
-    ATH_MSG_FATAL("Tool Service not found");
-    return StatusCode::FAILURE;
-  }
-  // Retrieve detector manager.
-  sc = detStore()->retrieve(mgr, "TRT");
-  if (sc.isFailure()) {
-    ATH_MSG_ERROR("Unable to retrieve pointer to TRT DetectorManager");
-    return sc;
-  }
-
-  // Get ID helper for TRT to access various detector components like straw, straw_layer, layer_or_wheel, phi_module, etc...
-  sc = detStore()->retrieve(m_pTRTHelper,"TRT_ID");
-  if (sc.isFailure()) {
-    ATH_MSG_ERROR("Unable to retrieve pointer to TRT Helper");
-    return sc;
-  }
-  if (detStore()->retrieve(m_idHelper, "AtlasID").isFailure()) {
-    ATH_MSG_FATAL("Could not get AtlasDetectorID helper");
-    return StatusCode::FAILURE;
-  }
-
-  if (DoExpert) {
-    // Retrieve the TRT_Straw Status Service.
-    if (m_sumSvc.name().empty()) {
-      ATH_MSG_WARNING("TRT_StrawStatusSvc not given.");
-    } else {
-      sc = m_sumSvc.retrieve();
-      if (sc.isFailure()) {
-        ATH_MSG_FATAL("I couldn't retrieve " << m_sumSvc);
-        return sc;
-      }
-    }
-    if (m_doDCS) {
-      // Retrieve the TRT_DCS Conditions Service.
-      if (m_DCSSvc.name().empty()) {
-        ATH_MSG_WARNING("TRT_DCSConditionsSvc not given.");
-      } else {
-        sc = m_DCSSvc.retrieve();
-        if (sc.isFailure()) {
-          ATH_MSG_FATAL("I couldn't retrieve " << m_DCSSvc);
-          return sc;
-        }
-      }
-    }// if do dcs
-
-    // Retrieve the TRT_Conditions Service.
-    if (m_condSvc_BS.name().empty()) {
-      ATH_MSG_WARNING("TRT_ConditionsSvc not given.");
-    } else {
-      sc = m_condSvc_BS.retrieve();
-      if (sc.isFailure()) {
-        ATH_MSG_FATAL("I couldn't retrieve " << m_condSvc_BS );
-        return sc;
-      }
-    }
-    // Retrieve the TRT TRTTrackHoleSearchTool.
-    if ( m_trt_hole_finder.retrieve().isFailure() ){
-      ATH_MSG_FATAL( "Failed to retrieve the TRTTrackHoleSearchTool." );
-      return StatusCode::FAILURE;
-
-    } else {
-      ATH_MSG_INFO( "retrieved TRTTrackHoleSearchTool " << m_trt_hole_finder );
-    }
-    /**
-       if (m_condSvc_DAQ.name().empty()) {
-       ATH_MSG_WARNING("TRT_ConditionsSvc not given.");
-       } else {
-       sc = m_condSvc_DAQ.retrieve();
-       if (sc.isFailure()) {
-       ATH_MSG_FATAL("I couldn't retrieve " << m_condSvc_DAQ );
-       return sc;
-       }
-       }
-    */
-
-    // Retrieve the TRT_DAQConditions Service.
-    if (m_DAQSvc.name().empty()) {
-      ATH_MSG_WARNING("TRT_DAQConditionsSvc not given.");
-    } else {
-      sc = m_DAQSvc.retrieve();
-      if (sc.isFailure()) {
-        ATH_MSG_FATAL("I couldn't retrieve " << m_DAQSvc);
-        return sc;
-      }
-    }
-
-    // Retrieve the TRT_ByteStreamService.
-    if (m_BSSvc.name().empty()) {
-      ATH_MSG_WARNING("TRT_ByteStreamSvc not given.");
-    } else {
-      sc = m_BSSvc.retrieve();
-      if (sc.isFailure()) {
-        ATH_MSG_FATAL("I couldn't retrieve " << m_BSSvc);
-        return sc;
-      }
-    }
-    // Test out the TRT_ConditionsSummaryTool.
-    //Identifier ident = m_trtid->straw_id(1,1,1,1,1);
-    Identifier ident;
-    if (m_sumSvc.name()!= "") {
-      ATH_MSG_VERBOSE("Trying " <<m_sumSvc << " isGood");
-      ATH_MSG_VERBOSE("TRT_StrawStatusSvc reports status = " << m_sumSvc->getStatus(ident));
-    }
-  }//If do expert
-
-  //Retrieve TRT_StrawNeighbourService.
-  if (m_TRTStrawNeighbourSvc.name().empty()) {
-    ATH_MSG_WARNING("TRT_StrawNeighbourSvc not given.");
-  } else {
-    sc = m_TRTStrawNeighbourSvc.retrieve();
-    if (sc.isFailure()) {
-      ATH_MSG_FATAL("Could not get StrawNeighbourSvc.");
-    }
-  }
-  // Get Track summary tool
-  sc= m_TrackSummaryTool.retrieve();
-  if (sc.isFailure())
-    ATH_MSG_ERROR("Cannot get TrackSummaryTool");
-  else
-    ATH_MSG_DEBUG("Retrieved succesfully the track summary tool" << m_TrackSummaryTool);
-  //Get TRTCalDbTool
-  if (m_trtcaldbSvc.name().empty()) {
-    ATH_MSG_WARNING("TRT_CalDbSvc not given.");
-  } else {
-    if (m_trtcaldbSvc.retrieve().isFailure()) {
-      ATH_MSG_ERROR("Cannot get TRTCalDBSvc.");
-      //return StatusCode::FAILURE;
-    }
-  }
-  // retrieve TRTTrackHoleSearchTool
-  if (DoEfficiency) {
-    if (m_trt_hole_finder.retrieve().isFailure()) {
-      ATH_MSG_FATAL("Failed to retrieve the TRTTrackHoleSearchTool.");
-      return StatusCode::FAILURE;
-    }
-  }
-
-  // Initialize arrays
-  // These arrays store information about each entry to the HitMap histograms
-
-  // if (m_environment==AthenaMonManager::online)
-  if (true) {
-    //loop over straw hash index to create straw number mapping for TRTViewer
-    unsigned int maxHash = m_pTRTHelper->straw_layer_hash_max();
-
-    for (int ibe=0; ibe<2; ibe++) { // ibe=0(barrel), ibe=1(endcap)
-
-      for (unsigned int index = 0; index < maxHash; index++) {
-        IdentifierHash idHash = index;
-        Identifier id = m_pTRTHelper->layer_id(idHash);
-
-        int idBarrelEndcap = m_pTRTHelper->barrel_ec(id);
-        int idLayerWheel   = m_pTRTHelper->layer_or_wheel(id);
-        int idPhiModule    = m_pTRTHelper->phi_module(id);
-        int idStrawLayer   = m_pTRTHelper->straw_layer(id);
-
-        int idSide;  int sectorflag=0;
-        const InDetDD::TRT_BaseElement * element= NULL;
-        if (ibe==0) { // barrel
-          idSide = idBarrelEndcap ? 1 : -1;
-          if ((m_pTRTHelper->is_barrel(id))&&(m_pTRTHelper->barrel_ec(id)==-1)) {
-            sectorflag=1;
-            element = mgr->getBarrelElement(idSide, idLayerWheel, idPhiModule, idStrawLayer);
-          }
-        } else if (ibe==1) { // endcap
-          idSide = idBarrelEndcap ? 1 : 0;
-          if ((!m_pTRTHelper->is_barrel(id))
-	      && ((m_pTRTHelper->barrel_ec(id)==-2) || (m_pTRTHelper->barrel_ec(id)==2))) {
-            sectorflag=1;
-            element = mgr->getEndcapElement(idSide, idLayerWheel, idStrawLayer, idPhiModule);//, idStrawLayer_ec);
-          }
-        }
-
-        if (sectorflag==1) {
-          if (element ==NULL) continue;
-
-          for (unsigned int istraw = 0; istraw < element->nStraws(); istraw++) {
-            //if (istraw>element->nStraws())  continue;//obsolete
-
-            std::vector<Identifier> neighbourIDs;
-            Identifier strawID = m_pTRTHelper->straw_id(id, int(istraw));
-            int i_chip, i_pad;
-
-            m_TRTStrawNeighbourSvc->getChip(strawID,i_chip);
-            m_TRTStrawNeighbourSvc->getPad(id,i_pad);
-
-            if (ibe==0) { //barrel
-              if (idLayerWheel == 1) i_chip += 21;
-              if (idLayerWheel == 2) i_chip += 54;
-
-              int tempStrawNumber = strawNumber(istraw, idStrawLayer, idLayerWheel);
-              if (tempStrawNumber < 0 || tempStrawNumber > (s_Straw_max[ibe]-1)) {
-                ATH_MSG_WARNING("Found tempStrawNumber = " << tempStrawNumber << " out of range.");
-              } else {
-                mat_chip_B[idPhiModule][tempStrawNumber]    = i_chip;
-                mat_chip_B[idPhiModule+32][tempStrawNumber] = i_chip;
-              }
-
-            } else if (ibe==1) { //endcap
-	      //              i_chip -= 104;
-              ++i_chip -= 104;
-
-              int tempStrawNumber = strawNumberEndCap(istraw, idStrawLayer, idLayerWheel, idPhiModule, idSide);
-              if (tempStrawNumber < 0 || tempStrawNumber > (s_Straw_max[ibe]-1)) {
-                ATH_MSG_WARNING("Found tempStrawNumber = " << tempStrawNumber << " out of range.");
-              } else {
-                mat_chip_E[idPhiModule][tempStrawNumber]    = i_chip;
-                mat_chip_E[idPhiModule+32][tempStrawNumber] = i_chip;
-              }
-            }
-
-          }
-        }
-      }//for (unsigned int index = 0; index < maxHash; index++)
-    } //for (int ibe=0; ibe<2; ibe++)
-  }
-  //some initializaton
-  if (DoShift) { // ugly way of doing this, so we probably want to clean it up a bit.
-    // Barrel
-    int ibe=0;
-    for (int iStack = 0; iStack < s_iStack_max[ibe]; iStack++) {
-      m_LLOcc[ibe][iStack] = 0; m_LLOcc[ibe][iStack+32]=0;
-      m_HTfraconTrack_B[iStack] = 0;
-      m_LonTrack_B[iStack] = 0;
-      m_nTrack_B[iStack] = 0;
-    }
-    for (int i=0; i<s_Straw_max[ibe]; i++) {
-      m_nStrawHits_B[i]=0;
-    }
-    // Endcap
-    ibe=1;
-    for (int iStack = 0; iStack < s_iStack_max[ibe]; iStack++) {
-      m_LLOcc[ibe][iStack] = 0;
-      m_HTfraconTrack_E[iStack] = 0;
-      m_LonTrack_E[iStack] = 0;
-      m_nTrack_E[iStack] = 0;
-    }
-    for (int i=0; i<s_Straw_max[ibe]; i++) {
-      m_nStrawHits_E[0][i]=0;  // A-side
-      m_nStrawHits_E[1][i]=0;  // C-side
-    }
-  } // doshift for phi bin init
-
-  if (m_lumiTool.retrieve().isFailure()) {                                     
-    ATH_MSG_ERROR("Unable to retrieve Luminosity Tool");                   
-    return StatusCode::FAILURE;                                      
-  } else {                                                                    
-    ATH_MSG_DEBUG("Successfully retrieved Luminosity Tool");              
-  }
-
-  ATH_MSG_INFO("My TRT_DAQ_ConditionsSvc is " << m_DAQSvc);
-  return sc;
+	ATH_MSG_VERBOSE("Initializing TRT Monitoring");
+
+	ATH_CHECK( ManagedMonitorToolBase::initialize() );
+	ATH_CHECK( AlgTool::initialize() );
+
+	IToolSvc *p_toolSvc; // NOTE: recreation of ToolSvc
+
+	ATH_CHECK( service("ToolSvc", p_toolSvc) );
+	// Retrieve detector manager.
+	ATH_CHECK( detStore()->retrieve(m_mgr, "TRT") );
+	// Get ID helper for TRT to access various detector components like straw, straw_layer, layer_or_wheel, phi_module, etc...
+	ATH_CHECK( detStore()->retrieve(m_pTRTHelper, "TRT_ID") );
+	ATH_CHECK( detStore()->retrieve(m_idHelper, "AtlasID") );
+
+	if (m_doExpert) {
+		// Retrieve the TRT_Straw Status Service.
+		if (m_sumSvc.name().empty()) {
+			ATH_MSG_WARNING("TRT_StrawStatusSvc not given.");
+		} else {
+			ATH_CHECK( m_sumSvc.retrieve() );
+		}
+
+		// NOTE: is this used anywhere?
+		if (m_doDCS) {
+			// Retrieve the TRT_DCS Conditions Service.
+			if (m_DCSSvc.name().empty()) {
+				ATH_MSG_WARNING("TRT_DCSConditionsSvc not given.");
+			} else {
+				ATH_CHECK( m_DCSSvc.retrieve() );
+			}
+		}// if do dcs
+
+		// NOTE: is this used anywhere?
+		// NOTE: This is the same of m_BSSvc
+		// Retrieve the TRT_Conditions Service.
+		if (m_condSvc_BS.name().empty()) {
+			ATH_MSG_WARNING("TRT_ConditionsSvc not given.");
+		} else {
+			ATH_CHECK( m_condSvc_BS.retrieve() );
+		}
+
+		// Retrieve the TRT TRTTrackHoleSearchTool.
+		ATH_CHECK( m_trt_hole_finder.retrieve() );
+
+		// NOTE: is this used anywhere?
+		// Retrieve the TRT_DAQConditions Service.
+		if (m_DAQSvc.name().empty()) {
+			ATH_MSG_WARNING("TRT_DAQConditionsSvc not given.");
+		} else {
+			ATH_CHECK( m_DAQSvc.retrieve() );
+		}
+
+		// Retrieve the TRT_ByteStreamService.
+		if (m_BSSvc.name().empty()) {
+			ATH_MSG_WARNING("TRT_ByteStreamSvc not given.");
+		} else {
+			ATH_CHECK( m_BSSvc.retrieve() );
+		}
+
+		// Test out the TRT_ConditionsSummaryTool.
+		//Identifier ident = m_trtid->straw_id(1,1,1,1,1);
+		Identifier ident;
+
+		if (m_sumSvc.name() != "") {
+			ATH_MSG_VERBOSE("Trying " << m_sumSvc << " isGood");
+			ATH_MSG_VERBOSE("TRT_StrawStatusSvc reports status = " << m_sumSvc->getStatus(ident));
+		}
+	}//If do expert
+
+	//Retrieve TRT_StrawNeighbourService.
+	if (m_TRTStrawNeighbourSvc.name().empty()) {
+		ATH_MSG_WARNING("TRT_StrawNeighbourSvc not given.");
+	} else {
+		if (m_TRTStrawNeighbourSvc.retrieve().isFailure()) {
+			ATH_MSG_FATAL("Could not get StrawNeighbourSvc.");
+		}
+	}
+
+	// Get Track summary tool
+	if (m_TrackSummaryTool.retrieve().isFailure())
+		ATH_MSG_ERROR("Cannot get TrackSummaryTool");
+	else
+		ATH_MSG_DEBUG("Retrieved succesfully the track summary tool" << m_TrackSummaryTool);
+
+	//Get TRTCalDbTool
+	if (m_TRTCalDbSvc.name().empty()) {
+		ATH_MSG_WARNING("TRT_CalDbSvc not given.");
+	} else {
+		if (m_TRTCalDbSvc.retrieve().isFailure()) {
+			ATH_MSG_ERROR("Cannot get TRTCalDBSvc.");
+		}
+	}
+
+	// retrieve TRTTrackHoleSearchTool
+	if (m_doEfficiency) {
+		ATH_CHECK( m_trt_hole_finder.retrieve() );
+	}
+
+	// Initialize arrays
+	// These arrays store information about each entry to the HitMap histograms
+
+	// if (m_environment==AthenaMonManager::online)
+	if (true) {
+		//loop over straw hash index to create straw number mapping for TRTViewer
+		unsigned int maxHash = m_pTRTHelper->straw_layer_hash_max();
+
+		for (int ibe = 0; ibe < 2; ibe++) { // ibe=0(barrel), ibe=1(endcap)
+			for (unsigned int index = 0; index < maxHash; index++) {
+				IdentifierHash idHash = index;
+				Identifier id = m_pTRTHelper->layer_id(idHash);
+				int idBarrelEndcap = m_pTRTHelper->barrel_ec(id);
+				int idLayerWheel   = m_pTRTHelper->layer_or_wheel(id);
+				int idPhiModule    = m_pTRTHelper->phi_module(id);
+				int idStrawLayer   = m_pTRTHelper->straw_layer(id);
+				bool isBarrel = m_pTRTHelper->is_barrel(id);
+				int idSide;
+				int sectorflag = 0;
+				const InDetDD::TRT_BaseElement *element = nullptr;
+
+				if (ibe == 0) { // barrel
+					idSide = idBarrelEndcap ? 1 : -1;
+
+					if (isBarrel && (idBarrelEndcap == -1)) {
+						sectorflag = 1;
+						element = m_mgr->getBarrelElement(idSide, idLayerWheel, idPhiModule, idStrawLayer);
+					}
+				} else if (ibe == 1) { // endcap
+					idSide = idBarrelEndcap ? 1 : 0;
+
+					if (!isBarrel && ((idBarrelEndcap == -2) || (idBarrelEndcap == 2))) {
+						sectorflag = 1;
+						element = m_mgr->getEndcapElement(idSide, idLayerWheel, idStrawLayer, idPhiModule);//, idStrawLayer_ec);
+					}
+				}
+
+				if (sectorflag == 1) {
+					if (!element) continue;
+
+					for (unsigned int istraw = 0; istraw < element->nStraws(); istraw++) {
+						std::vector<Identifier> neighbourIDs;
+						Identifier strawID = m_pTRTHelper->straw_id(id, int(istraw));
+						int i_chip, i_pad;
+						m_TRTStrawNeighbourSvc->getChip(strawID, i_chip);
+						m_TRTStrawNeighbourSvc->getPad(id, i_pad);
+
+						if (ibe == 0) { //barrel
+							if (idLayerWheel == 1) i_chip += 21;
+
+							if (idLayerWheel == 2) i_chip += 54;
+
+							int tempStrawNumber = strawNumber(istraw, idStrawLayer, idLayerWheel);
+
+							if (tempStrawNumber < 0 || tempStrawNumber > (s_Straw_max[ibe] - 1)) {
+								ATH_MSG_WARNING("Found tempStrawNumber = " << tempStrawNumber << " out of range.");
+							} else {
+								mat_chip_B[idPhiModule][tempStrawNumber]    = i_chip;
+								mat_chip_B[idPhiModule + 32][tempStrawNumber] = i_chip;
+							}
+						} else if (ibe == 1) { //endcap
+							//              i_chip -= 104;
+							++i_chip -= 104;
+							int tempStrawNumber = strawNumberEndCap(istraw, idStrawLayer, idLayerWheel, idPhiModule, idSide);
+
+							if (tempStrawNumber < 0 || tempStrawNumber > (s_Straw_max[ibe] - 1)) {
+								ATH_MSG_WARNING("Found tempStrawNumber = " << tempStrawNumber << " out of range.");
+							} else {
+								mat_chip_E[idPhiModule][tempStrawNumber]    = i_chip;
+								mat_chip_E[idPhiModule + 32][tempStrawNumber] = i_chip;
+							}
+						}
+					}
+				}
+			}//for (unsigned int index = 0; index < maxHash; index++)
+		} //for (int ibe=0; ibe<2; ibe++)
+	}
+
+	// some initializaton
+	// TODO: ugly way of doing this, so we probably want to clean it up a bit.
+	if (m_doShift) {
+		// Barrel
+		int ibe = 0;
+
+		for (int iStack = 0; iStack < s_iStack_max[ibe]; iStack++) {
+			m_LLOcc[ibe][iStack] = 0;
+			m_LLOcc[ibe][iStack + 32] = 0;
+			m_HTfraconTrack_B[iStack] = 0;
+			m_LonTrack_B[iStack] = 0;
+			m_nTrack_B[iStack] = 0;
+		}
+
+		for (int i = 0; i < s_Straw_max[ibe]; i++) {
+			m_nStrawHits_B[i] = 0;
+		}
+
+		// Endcap
+		ibe = 1;
+
+		for (int iStack = 0; iStack < s_iStack_max[ibe]; iStack++) {
+			m_LLOcc[ibe][iStack] = 0;
+			m_HTfraconTrack_E[iStack] = 0;
+			m_LonTrack_E[iStack] = 0;
+			m_nTrack_E[iStack] = 0;
+		}
+
+		for (int i = 0; i < s_Straw_max[ibe]; i++) {
+			m_nStrawHits_E[0][i] = 0; // A-side
+			m_nStrawHits_E[1][i] = 0; // C-side
+		}
+	} // doshift for phi bin init
+
+	// Initialization of VarHandleKeys
+	ATH_CHECK( m_rdoContainerKey.initialize() );
+	ATH_CHECK( m_trackCollectionKey.initialize() );
+	ATH_CHECK( m_combTrackCollectionKey.initialize() );
+	ATH_CHECK( m_eventInfoKey.initialize() );
+	ATH_CHECK( m_xAODEventInfoKey.initialize() );
+	ATH_CHECK( m_TRT_BCIDCollectionKey.initialize() );
+	ATH_CHECK( m_comTimeObjectKey.initialize() );
+	ATH_CHECK( m_trigDecisionKey.initialize() );
+
+	ATH_CHECK( m_lumiTool.retrieve() );
+	ATH_MSG_INFO("My TRT_DAQ_ConditionsSvc is " << m_DAQSvc);
+
+	return StatusCode::SUCCESS;
 }
 
 
 //------------------------------------------------------------------------------------//
-StatusCode TRT_Monitoring_Tool::bookHistogramsRecurrent()
+StatusCode TRT_Monitoring_Tool::bookHistogramsRecurrent() {
 //------------------------------------------------------------------------------------//
-{
-  ATH_MSG_VERBOSE("Booking TRT histograms");
-
-  if (newLumiBlockFlag()) ATH_MSG_VERBOSE("newLumiBlock");
-  if (newRunFlag()) ATH_MSG_VERBOSE("newRun");
-
-  StatusCode sc;
-  //If it is a new run check rdo and track containers.
-  if (newRunFlag()) {
-    if (!evtStore()->contains<TRT_RDO_Container>(m_rawDataObjectName)) {
-      ATH_MSG_WARNING("No TRT_RDO_Container by the name of " << m_rawDataObjectName << " in StoreGate. Skipping TRT RDO Monitoring.");
-      m_doRDOsMon = false;
-    }
-    if (!evtStore()->contains<TrackCollection>(m_tracksObjectName)) {
-      ATH_MSG_WARNING("No TrackCollection by the name of " << m_tracksObjectName << " in StoreGate. Skipping TRT Track Monitoring.");
-      m_doTracksMon = false;
-    }
-  }// is new run?
-
-  if (m_lumiTool.retrieve().isFailure()) {                                    
-    ATH_MSG_ERROR("Unable to retrieve Luminosity Tool");                  
-    return StatusCode::FAILURE;                                      
-  } else {                                                                    
-    ATH_MSG_DEBUG("Successfully retrieved Luminosity Tool");               
-  }
-
-  //Book_TRT_RDOs registers all raw data histograms
-  if (m_doRDOsMon) {
-    sc = Book_TRT_RDOs(newLumiBlockFlag(), newRunFlag());
-    if (sc == StatusCode::FAILURE) {
-      ATH_MSG_ERROR("Unable to register RDO histograms");
-      return sc;
-    }//if sc == failure
-  }// if do rdos mon
-
-  //Book_TRT_Tracks registers all tracking histograms
-  if (m_doTracksMon) {
-    sc = Book_TRT_Tracks(newLumiBlockFlag(), newRunFlag());
-    if (DoShift) {
-      sc = Book_TRT_Shift_Tracks(newLumiBlockFlag(), newRunFlag());
-      if (sc == StatusCode::FAILURE) {
-        ATH_MSG_ERROR("Unable to book trt shift tracks histograms");
-      }//if sc== failure
-    }//if DoShift
-  }//if do tracks mon
-
-  if (DoEfficiency) {
-    sc = Book_TRT_Efficiency (newLumiBlockFlag(), newRunFlag());
-    if (sc == StatusCode::FAILURE) {
-      ATH_MSG_ERROR("Unable to book trt efficiency");
-    }//if sc== failure
-  }
-  if (newRunFlag()) {
-    ATH_MSG_DEBUG("Begin of run");
-  }
-
-  if (sc == StatusCode::FAILURE){
-    ATH_MSG_ERROR("No histograms booked");
-  }
-  return StatusCode::SUCCESS;
+	ATH_MSG_VERBOSE("Booking TRT histograms");
+
+	if (newLumiBlockFlag()) ATH_MSG_VERBOSE("newLumiBlock");
+
+	if (newRunFlag()) ATH_MSG_VERBOSE("newRun");
+
+	StatusCode sc = StatusCode::SUCCESS;
+
+	//If it is a new run check rdo and track containers.
+	if (newRunFlag()) {
+		SG::ReadHandle<TRT_RDO_Container> rdoContainer(m_rdoContainerKey);
+		SG::ReadHandle<TrackCollection> trackCollection(m_trackCollectionKey);
+
+		if (!rdoContainer.isValid()) {
+			ATH_MSG_WARNING("No TRT_RDO_Container by the name of " <<
+			                m_rdoContainerKey.key() << " in StoreGate. Skipping TRT RDO Monitoring.");
+			m_doRDOsMon = false;
+		}
+
+		if (!trackCollection.isValid()) {
+			ATH_MSG_WARNING("No TrackCollection by the name of " <<
+			                m_trackCollectionKey.key() << " in StoreGate. Skipping TRT Track Monitoring.");
+			m_doTracksMon = false;
+		}
+	}
+
+	// NOTE: This is already retrieved during initialization
+	// Is this needed here?
+	if (m_lumiTool.retrieve().isFailure()) {
+		ATH_MSG_ERROR("Unable to retrieve Luminosity Tool");
+		return StatusCode::FAILURE;
+	} else {
+		ATH_MSG_DEBUG("Successfully retrieved Luminosity Tool");
+	}
+
+	//Book_TRT_RDOs registers all raw data histograms
+	if (m_doRDOsMon) {
+		ATH_CHECK( bookTRTRDOs(newLumiBlockFlag(), newRunFlag()) );
+	}
+
+	//Book_TRT_Tracks registers all tracking histograms
+	if (m_doTracksMon) {
+		sc = bookTRTTracks(newLumiBlockFlag(), newRunFlag());
+
+		if (m_doShift) {
+			sc = bookTRTShiftTracks(newLumiBlockFlag(), newRunFlag());
+
+			if (sc == StatusCode::FAILURE) {
+				ATH_MSG_ERROR("Unable to book trt shift tracks histograms");
+			}
+		}
+	}
+
+	if (m_doEfficiency) {
+		sc = bookTRTEfficiency (newLumiBlockFlag(), newRunFlag());
+
+		if (sc == StatusCode::FAILURE) {
+			ATH_MSG_ERROR("Unable to book trt efficiency");
+		}
+	}
+
+	if (newRunFlag()) {
+		ATH_MSG_DEBUG("Begin of run");
+	}
+
+	if (sc == StatusCode::FAILURE) {
+		ATH_MSG_ERROR("No histograms booked");
+	}
+
+	return StatusCode::SUCCESS;
 }
 
 //Book TRT Raw Data Object info (all TRT Hits).
 //----------------------------------------------------------------------------------//
-StatusCode TRT_Monitoring_Tool::Book_TRT_RDOs(bool newLumiBlock, bool newRun)
+StatusCode TRT_Monitoring_Tool::bookTRTRDOs(bool newLumiBlock, bool newRun) {
 //----------------------------------------------------------------------------------//
-{
-  ATH_MSG_VERBOSE("Booking TRT RDO Histograms");
-  if (newLumiBlock) ATH_MSG_VERBOSE("newLumiBlock");
-  if (newRun) ATH_MSG_VERBOSE("newRun");
-
-  StatusCode scode = StatusCode::SUCCESS;
-  std::string hName, hTitle;
-
-  const std::string barrel_or_endcap[2] = { "Barrel", "EndCap" };
-  const std::string be_id[2] = { "B", "E" };
-  const std::string side_id[2] = { "A", "C" };
-
-  //Booking of some expert monitoring histograms
-  for (int ibe=0; ibe<2; ibe++) {
-    for (int i=0; i<s_numberOfStacks[ibe]*2; i++) {
-      std::ostringstream oss;
-      if (ibe == 0) { // barrel
-        if      (i <  s_numberOfStacks[ibe]) { oss << "TRT/Barrel/Stack"   << i + 1 << "A"; }
-        else if (i >= s_numberOfStacks[ibe]) { oss << "TRT/Barrel/Stack"   << i + 1 - 32 << "C"; }
-      } else if (ibe == 1) { // endcap
-        if      (i <  s_numberOfStacks[ibe]) { oss << "TRT/EndcapA/Sector" << i + 1; }
-        else if (i >= s_numberOfStacks[ibe]) { oss << "TRT/EndcapC/Sector" << i + 1 - 32; }
-      }
-      const std::string hPath = oss.str();
-
-      // MonGroup rdoStackWeighted(this, hPath, expert, run, "","weightedEff");
-      MonGroup rdoStackWeighted(this, hPath, run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED, "","weightedEff");
-      if (newRun) {
-        if (DoExpert) {
-          if (DoStraws) {
-            m_hHitWMapS[ibe][i]         = bookTH1F_LW(rdoStackWeighted,     "hHitWMapS", "Leading Edge in Time Window: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability per Event", scode);
-            m_hHitTrWMapS[ibe][i]       = bookTProfile_LW(rdoStackWeighted, "hHitTrWMapS", "Mean Trailing Edge in Time Window: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0, 75, "Straw Number in Stack", "Time (ns)", scode);
-            m_hHitTrMapS[ibe][i]        = bookTProfile_LW(rdoStackWeighted, "hHitTrMapS", "Mean Trailing Edge: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0, 75, "Straw Number in Stack", "Time (ns)", scode);
-            m_hHitAWMapS[ibe][i]        = bookTH1F_LW(rdoStackWeighted,     "hHitAWMapS", "LL in Time Window: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-            m_hHitAMapS[ibe][i]         = bookTH1F_LW(rdoStackWeighted,     "hHitAMapS", "Any LL Bit: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-            m_hStrawOcc[ibe][i]         = bookTH1F_LW(rdoStackWeighted,     "hOccupancyS", "Straw Occupancy Distribution: Straws", 201, 0, 1.005, "Occupancy", "Number of Straws", scode);
-            m_hHitToTMapS[ibe][i]       = bookTProfile_LW(rdoStackWeighted, "hHitToTMapS", "Mean ToT: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0, 75, "Straw Number in Stack", "Time (ns)", scode);
-            m_hHitToTLongMapS[ibe][i]   = bookTProfile_LW(rdoStackWeighted, "hHitToTLongMapS", "Mean ToT for Straws with ToT > LongToTCut: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0, 75, "Straw Number in Stack", "Time (ns)", scode);
-            m_hHitToTLongTrMapS[ibe][i] = bookTProfile_LW(rdoStackWeighted, "hHitToTLongTrMapS", "Mean Trailing Edge for Straws with ToT > LongToTCut: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0, 75, "Straw Number in Stack", "Time (ns)", scode);
-            m_hHitHMapS[ibe][i]         = bookTH1F_LW(rdoStackWeighted,     "hHitHMapS", "Any HL Bit: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-            m_hHitHWMapS[ibe][i]        = bookTH1F_LW(rdoStackWeighted,     "hHitHWMapS", "HL in Time Window: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-            m_hHtoLMapS[ibe][i]         = bookTH1F_LW(rdoStackWeighted,     "hHtoLMapS", "HL/LL Ratio: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-          }
-
-          if (DoChips) {
-            m_hHitWMapC[ibe][i]         = bookTH1F_LW(rdoStackWeighted,     "hHitWMapC", "Leading Edge in Time Window: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
-            m_hHitTrMapC[ibe][i]        = bookTProfile_LW(rdoStackWeighted, "hHitTrMapC", "Mean Trailing Edge: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], 0, 75, "Chip Number in Stack", "Time (ns)", scode);
-            m_hHitTrWMapC[ibe][i]       = bookTProfile_LW(rdoStackWeighted, "hHitTrWMapC", "Mean Trailing Edge in Time Window: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], 0, 75, "Chip Number in Stack", "Time (ns)", scode);
-            m_hHitAWMapC[ibe][i]        = bookTH1F_LW(rdoStackWeighted,     "hHitAWMapC", "LL in Time Window: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
-            m_hHitAMapC[ibe][i]         = bookTH1F_LW(rdoStackWeighted,     "hHitAMapC", "Any LL Bit: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
-            m_hChipOcc[ibe][i]          = bookTH1F_LW(rdoStackWeighted,     "hOccupancyC", "Chip Occupancy Distribution", 201, 0, 1.005, "Occupancy", "Number of Chips", scode);
-            m_hHitToTMapC[ibe][i]       = bookTProfile_LW(rdoStackWeighted, "hHitToTMapC", "Mean ToT: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], 0, 75, "Chip Number in Stack", "Time (ns)", scode);
-            m_hHitHMapC[ibe][i]         = bookTH1F_LW(rdoStackWeighted,     "hHitHMapC", "Any HL Bit: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
-            m_hHitHWMapC[ibe][i]        = bookTH1F_LW(rdoStackWeighted,     "hHitHWMapC", "HL in Time Window: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
-            m_hHtoLMapC[ibe][i]         = bookTH1F_LW(rdoStackWeighted,     "hHtoLMapC", "HL/LL Ratio: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
-            m_hHtoBCMapC[ibe][i]        = bookTH2F_LW(rdoStackWeighted,     "hHtoBCMapC", "HL in BC: Chips", 3, 0, 3, s_iChip_max[ibe], 0, s_iChip_max[ibe], "Bunch Crossing ID", "Chip Number in Stack", scode);
-
-            if (ibe == 0) {
-              m_hHtoBCMapB[ibe][i]      = bookTH2F_LW(rdoStackWeighted,     "hHtoBCMapB", "HL in BC: Boards", 3, 0, 3, 9, 0, 9, "Bunch Crossing ID", "Board Number in Stack", scode);
-            } else if (ibe == 1) {
-              m_hHtoBCMapB[ibe][i]      = bookTH2F_LW(rdoStackWeighted,     "hHtoBCMapB", "HL in BC: Boards", 3, 0, 3, 20, -0.5, 19.5, "Bunch Crossing ID", "Board Number in Stack", scode);
-            }
-          }
-        }//end if (DoExpert)
-      }//end if (newRun)
-    }//end loop over stacks
-  } //for (int ibe=0; ibe<2; ibe++) {
-
-  //Registering Collisions Histograms
-  if (DoShift) {
-    //MonGroup rdoShiftSmry (this, "TRT/Shift/Summary", shift, run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
-    MonGroup rdoShiftSmry (this, "TRT/Shift/Summary", run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
-    //MonGroup rdoShiftSmryRebinned (this, "TRT/Shift/Summary", shift, run,"","mergeRebinned");
-    MonGroup rdoShiftSmryRebinned (this, "TRT/Shift/Summary", run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED,"","mergeRebinned");
-
-    if (newRun) {
-      m_hSummary = bookTH1F_LW(rdoShiftSmry, "hSummary", "Run Summary", 8, 0, 8, "", "Entries", scode);
-      m_hSummary->GetXaxis()->SetBinLabel(1,"Events");
-      m_hSummary->GetXaxis()->SetBinLabel(2,"Tracks Total");
-      m_hSummary->GetXaxis()->SetBinLabel(3,"Tracks BA");
-      m_hSummary->GetXaxis()->SetBinLabel(4,"Tracks BC");
-      m_hSummary->GetXaxis()->SetBinLabel(5,"Tracks EA");
-      m_hSummary->GetXaxis()->SetBinLabel(6,"Tracks EC");
-      m_hSummary->GetXaxis()->SetBinLabel(7,"Transition Side A");
-      m_hSummary->GetXaxis()->SetBinLabel(8,"Transition Side C");
-      //lumi summary histograms 
-      m_IntLum =bookTH1F_LW(rdoShiftSmry,"hIntLum", "Luminosity", 1, 0., 1., " ", "Luminosity [#mub^{1}]", scode);
-      m_LBvsLum =bookTH1F_LW(rdoShiftSmry,"hLBvsLum", "Luminosity", 2000, 0., 2000., "Luminosity Bin", "Luminosity [#mub^{1}]", scode);
-      m_LBvsTime =bookTH1F_LW(rdoShiftSmry,"hLBvsTime", "Time", 2000, 0., 2000., " Luminosity Bin", "Time [s]", scode);
-      const unsigned int maxLumiBlock = 200;
-
-      for (int ibe=0; ibe<2; ibe++) { // ibe=0(barrel), ibe=1(endcap)
-        for (int iside=0; iside<2; iside++) { // iside=0(A-side), iside=1(C-side)
-          const std::string regionTag = " (" + be_id[ibe] + side_id[iside] + ")";
-          m_hChipBSErrorsVsLB[ibe][iside] = bookTProfile(rdoShiftSmryRebinned, "hChipBSErrorsVsLB_" + be_id[ibe] + side_id[iside], "Chip Bytestream Errors vs LB" + regionTag, maxLumiBlock + 1, -0.5, maxLumiBlock + 0.5, 0, 150.0, "Luminosity Block", "Fraction of Chips with Errors", scode);
-          CAN_REBIN(m_hChipBSErrorsVsLB[ibe][iside]);
-          m_hRobBSErrorsVsLB[ibe][iside] = bookTProfile(rdoShiftSmryRebinned, "hRobBSErrorsVsLB_" + be_id[ibe] + side_id[iside], "Rob Bytestream Errors vs LB" + regionTag, maxLumiBlock + 1, -0.5, maxLumiBlock + 0.5, 0, 150.0, "Luminosity Block", "Fraction of RODs with Errors", scode);
-          CAN_REBIN(m_hRobBSErrorsVsLB[ibe][iside]);
-        }
-      }
-
-      // Barrel/Endcap Histograms
-      const std::string module_or_wheel[2] = { "Module", "Wheel" };
-      const std::string stack_or_sector[2] = { "Barrel Stack", "Endcap Sector" };
-      const std::string modulenum_assign2[2] = { "Modules Type 1 (1-32), Type 2 (33-64), Type 3 (65-96)", "Wheels A (1-32), B (33-64)" };
-
-      for (int ibe=0; ibe<2; ibe++) {
-        const std::string regionTag = " (" + barrel_or_endcap[ibe] + ")";
-	//        MonGroup rdo(this, "TRT/"+barrel_or_endcap[ibe]+"/Expert", expert, run);
-	//        MonGroup rdoShift (this, "TRT/Shift/"+barrel_or_endcap[ibe], shift, run);
-	//        MonGroup rdoShiftTH1(this, "TRT/Shift/"+barrel_or_endcap[ibe],shift,run,"","weightedEff");
-	MonGroup rdo(this, "TRT/"+barrel_or_endcap[ibe]+"/Expert",  run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
-	MonGroup rdoShift (this, "TRT/Shift/"+barrel_or_endcap[ibe], run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
-	MonGroup rdoShiftTH1(this, "TRT/Shift/"+barrel_or_endcap[ibe], run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED,"","weightedEff");
-
-        if (ibe == 0) {
-          m_hHitWMap_B    = bookTH1F_LW(rdoShiftTH1, "hHitWMap", "Leading Edge in Time Window: Xenon Straws" " (Barrel)", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-
-          if (m_ArgonXenonSplitter) {
-            m_hHitWMap_B_Ar = bookTH1F_LW(rdoShiftTH1, "hHitWMap_Ar", "Leading Edge in Time Window: Argon Straws (Barrel)", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-          }
-
-          m_hOccAll       = bookTH1F_LW(rdoShift, "hOccAll", "Occupancy per Event", 400, 0.0, 1.0, "Occupancy", "Events", scode);
-        } else if (ibe == 1) {
-          m_hHitWMap_E[0] = bookTH1F_LW(rdoShiftTH1, "hHitWMap_A", "Leading Edge in Time Window: Xenon Straws" " (EA)", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-          m_hHitWMap_E[1] = bookTH1F_LW(rdoShiftTH1, "hHitWMap_C", "Leading Edge in Time Window: Xenon Straws" " (EC)", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-
-          if (m_ArgonXenonSplitter) {
-            m_hHitWMap_E_Ar[0] = bookTH1F_LW(rdoShiftTH1, "hHitWMap_Ar_A", "Leading Edge in Time Window: Argon Straws" " (EA)", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-            m_hHitWMap_E_Ar[1] = bookTH1F_LW(rdoShiftTH1, "hHitWMap_Ar_C", "Leading Edge in Time Window: Argon Straws" " (EC)", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-          }
-        }
-
-        m_hBCIDvsOcc[ibe] = bookTProfile_LW(rdo, "hBCIDvsOcc", "Avg. Occupancy vs BCID" + regionTag, 3565, 0, 3564, 0, 1, "Bunch Crossing ID", "Occupancy", scode);
-
-        for (int iside = 0; iside < 2; iside++) {
-          const std::string regionTag = " (" + be_id[ibe] + side_id[iside] + ")"; // hides variable in outer scope
-          const std::string regionMarker = (m_environment == AthenaMonManager::online) ? (be_id[ibe] + side_id[iside]) : (side_id[iside]); // for historical reasons ...
-
-          m_hAvgHLOcc_side[ibe][iside] = bookTProfile_LW(rdoShift, "hAvgHLOcc_" + regionMarker, "Avg. HL Occupancy" + regionTag, 32, 1, 33, 0, 1, stack_or_sector[ibe], "Occupancy", scode);
-          m_hAvgLLOcc_side[ibe][iside] = bookTProfile_LW(rdoShift, "hAvgLLOcc_" + regionMarker, "Avg. LL Occupancy" + regionTag, 32, 1, 33, 0, 1, stack_or_sector[ibe], "Occupancy", scode);
-          m_hAvgLLOccMod_side[ibe][iside] = bookTProfile_LW(rdo, "hAvgLLOccMod_" + regionMarker, "Avg. LL Occupancy: " + module_or_wheel[ibe] + "s" + regionTag, s_moduleNum[ibe], 0, s_moduleNum[ibe], 0, 1, modulenum_assign2[ibe], "Occupancy", scode);
-          m_hAvgHLOccMod_side[ibe][iside] = bookTProfile_LW(rdo, "hAvgHLOccMod_" + regionMarker, "Avg. HL Occupancy: " + module_or_wheel[ibe] + "s" + regionTag, s_moduleNum[ibe], 0, s_moduleNum[ibe], 0, 1, modulenum_assign2[ibe], "Occupancy", scode);
-        }
-      }//for (int ibe=0; ibe<2; ibe++)
-
-    }//if is new run
-  }//if DoShift
-
-  ATH_MSG_VERBOSE("Finished Booking TRT RDO Histograms");
-
-  return scode;//StatusCode::SUCCESS;
-}//Book_TRT_RDOs()
+	ATH_MSG_VERBOSE("Booking TRT RDO Histograms");
+
+	if (newLumiBlock) ATH_MSG_VERBOSE("newLumiBlock");
+
+	if (newRun) ATH_MSG_VERBOSE("newRun");
+
+	StatusCode scode = StatusCode::SUCCESS;
+	std::string hName, hTitle;
+	const std::string barrel_or_endcap[2] = { "Barrel", "EndCap" };
+	const std::string be_id[2] = { "B", "E" };
+	const std::string side_id[2] = { "A", "C" };
+
+	//Booking of some expert monitoring histograms
+	// ibe = 0 (Barrel), ibe = 1 (Endcap)
+	for (int ibe = 0; ibe < 2; ibe++) {
+		for (int i = 0; i < s_numberOfStacks[ibe] * 2; i++) {
+			std::ostringstream oss;
+
+			if (ibe == 0) {
+				if (i <  s_numberOfStacks[ibe]) {
+					oss << "TRT/Barrel/Stack"   << i + 1 << "A";
+				} else if (i >= s_numberOfStacks[ibe]) {
+					oss << "TRT/Barrel/Stack"   << i + 1 - 32 << "C";
+				}
+			} else if (ibe == 1) {
+				if (i <  s_numberOfStacks[ibe]) {
+					oss << "TRT/EndcapA/Sector" << i + 1;
+				} else if (i >= s_numberOfStacks[ibe]) {
+					oss << "TRT/EndcapC/Sector" << i + 1 - 32;
+				}
+			}
+
+			const std::string hPath = oss.str();
+			MonGroup rdoStackWeighted(this, hPath, run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED, "", "weightedEff");
+
+			if (newRun && m_doExpert && m_doStraws) {
+				m_hHitWMapS[ibe][i] = bookTH1F_LW(rdoStackWeighted, "hHitWMapS", "Leading Edge in Time Window: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability per Event", scode);
+				m_hHitTrWMapS[ibe][i] = bookTProfile_LW(rdoStackWeighted, "hHitTrWMapS", "Mean Trailing Edge in Time Window: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0, 75, "Straw Number in Stack", "Time (ns)", scode);
+				m_hHitTrMapS[ibe][i] = bookTProfile_LW(rdoStackWeighted, "hHitTrMapS", "Mean Trailing Edge: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0, 75, "Straw Number in Stack", "Time (ns)", scode);
+				m_hHitAWMapS[ibe][i] = bookTH1F_LW(rdoStackWeighted, "hHitAWMapS", "LL in Time Window: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+				m_hHitAMapS[ibe][i] = bookTH1F_LW(rdoStackWeighted, "hHitAMapS", "Any LL Bit: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+				m_hStrawOcc[ibe][i] = bookTH1F_LW(rdoStackWeighted, "hOccupancyS", "Straw Occupancy Distribution: Straws", 201, 0, 1.005, "Occupancy", "Number of Straws", scode);
+				m_hHitToTMapS[ibe][i] = bookTProfile_LW(rdoStackWeighted, "hHitToTMapS", "Mean ToT: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0, 75, "Straw Number in Stack", "Time (ns)", scode);
+				m_hHitToTLongMapS[ibe][i] = bookTProfile_LW(rdoStackWeighted, "hHitToTLongMapS", "Mean ToT for Straws with ToT > LongToTCut: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0, 75, "Straw Number in Stack", "Time (ns)", scode);
+				m_hHitToTLongTrMapS[ibe][i] = bookTProfile_LW(rdoStackWeighted, "hHitToTLongTrMapS", "Mean Trailing Edge for Straws with ToT > LongToTCut: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0, 75, "Straw Number in Stack", "Time (ns)", scode);
+				m_hHitHMapS[ibe][i] = bookTH1F_LW(rdoStackWeighted, "hHitHMapS", "Any HL Bit: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+				m_hHitHWMapS[ibe][i] = bookTH1F_LW(rdoStackWeighted, "hHitHWMapS", "HL in Time Window: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+				m_hHtoLMapS[ibe][i] = bookTH1F_LW(rdoStackWeighted, "hHtoLMapS", "HL/LL Ratio: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+			}
+
+			if (newRun && m_doExpert && m_doChips) {
+				m_hHitWMapC[ibe][i] = bookTH1F_LW(rdoStackWeighted, "hHitWMapC", "Leading Edge in Time Window: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
+				m_hHitTrMapC[ibe][i] = bookTProfile_LW(rdoStackWeighted, "hHitTrMapC", "Mean Trailing Edge: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], 0, 75, "Chip Number in Stack", "Time (ns)", scode);
+				m_hHitTrWMapC[ibe][i] = bookTProfile_LW(rdoStackWeighted, "hHitTrWMapC", "Mean Trailing Edge in Time Window: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], 0, 75, "Chip Number in Stack", "Time (ns)", scode);
+				m_hHitAWMapC[ibe][i] = bookTH1F_LW(rdoStackWeighted, "hHitAWMapC", "LL in Time Window: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
+				m_hHitAMapC[ibe][i] = bookTH1F_LW(rdoStackWeighted, "hHitAMapC", "Any LL Bit: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
+				m_hChipOcc[ibe][i] = bookTH1F_LW(rdoStackWeighted, "hOccupancyC", "Chip Occupancy Distribution", 201, 0, 1.005, "Occupancy", "Number of Chips", scode);
+				m_hHitToTMapC[ibe][i] = bookTProfile_LW(rdoStackWeighted, "hHitToTMapC", "Mean ToT: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], 0, 75, "Chip Number in Stack", "Time (ns)", scode);
+				m_hHitHMapC[ibe][i] = bookTH1F_LW(rdoStackWeighted, "hHitHMapC", "Any HL Bit: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
+				m_hHitHWMapC[ibe][i] = bookTH1F_LW(rdoStackWeighted, "hHitHWMapC", "HL in Time Window: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
+				m_hHtoLMapC[ibe][i] = bookTH1F_LW(rdoStackWeighted, "hHtoLMapC", "HL/LL Ratio: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
+				m_hHtoBCMapC[ibe][i] = bookTH2F_LW(rdoStackWeighted, "hHtoBCMapC", "HL in BC: Chips", 3, 0, 3, s_iChip_max[ibe], 0, s_iChip_max[ibe], "Bunch Crossing ID", "Chip Number in Stack", scode);
+
+				if (ibe == 0) {
+					m_hHtoBCMapB[ibe][i] = bookTH2F_LW(rdoStackWeighted, "hHtoBCMapB", "HL in BC: Boards", 3, 0, 3, 9, 0, 9, "Bunch Crossing ID", "Board Number in Stack", scode);
+				} else if (ibe == 1) {
+					m_hHtoBCMapB[ibe][i] = bookTH2F_LW(rdoStackWeighted, "hHtoBCMapB", "HL in BC: Boards", 3, 0, 3, 20, -0.5, 19.5, "Bunch Crossing ID", "Board Number in Stack", scode);
+				}
+			}
+		}
+	}
+
+	//Registering Collisions Histograms
+	if (m_doShift) {
+		MonGroup rdoShiftSmry (this, "TRT/Shift/Summary", run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
+		MonGroup rdoShiftSmryRebinned (this, "TRT/Shift/Summary", run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED, "", "mergeRebinned");
+
+		if (newRun) {
+			m_hSummary = bookTH1F_LW(rdoShiftSmry, "hSummary", "Run Summary", 8, 0, 8, "", "Entries", scode);
+			m_hSummary->GetXaxis()->SetBinLabel(1, "Events");
+			m_hSummary->GetXaxis()->SetBinLabel(2, "Tracks Total");
+			m_hSummary->GetXaxis()->SetBinLabel(3, "Tracks BA");
+			m_hSummary->GetXaxis()->SetBinLabel(4, "Tracks BC");
+			m_hSummary->GetXaxis()->SetBinLabel(5, "Tracks EA");
+			m_hSummary->GetXaxis()->SetBinLabel(6, "Tracks EC");
+			m_hSummary->GetXaxis()->SetBinLabel(7, "Transition Side A");
+			m_hSummary->GetXaxis()->SetBinLabel(8, "Transition Side C");
+			//lumi summary histograms
+			m_IntLum = bookTH1F_LW(rdoShiftSmry, "hIntLum", "Luminosity", 1, 0., 1., " ", "Luminosity [#mub^{1}]", scode);
+			m_LBvsLum = bookTH1F_LW(rdoShiftSmry, "hLBvsLum", "Luminosity", 2000, 0., 2000., "Luminosity Bin", "Luminosity [#mub^{1}]", scode);
+			m_LBvsTime = bookTH1F_LW(rdoShiftSmry, "hLBvsTime", "Time", 2000, 0., 2000., " Luminosity Bin", "Time [s]", scode);
+			const unsigned int maxLumiBlock = 200;
+
+			// ibe = 0 (Barrel), ibe = 1 (Endcap)
+			// iside = 0 (A-side), iside = 1 (C-side)
+			for (int ibe = 0; ibe < 2; ibe++) {
+				for (int iside = 0; iside < 2; iside++) {
+					const std::string regionTag = " (" + be_id[ibe] + side_id[iside] + ")";
+					m_hChipBSErrorsVsLB[ibe][iside] = bookTProfile(rdoShiftSmryRebinned, "hChipBSErrorsVsLB_" + be_id[ibe] + side_id[iside], "Chip Bytestream Errors vs LB" + regionTag, maxLumiBlock + 1, -0.5, maxLumiBlock + 0.5, 0, 150.0, "Luminosity Block", "Fraction of Chips with Errors", scode);
+					CAN_REBIN(m_hChipBSErrorsVsLB[ibe][iside]);
+					m_hRobBSErrorsVsLB[ibe][iside] = bookTProfile(rdoShiftSmryRebinned, "hRobBSErrorsVsLB_" + be_id[ibe] + side_id[iside], "Rob Bytestream Errors vs LB" + regionTag, maxLumiBlock + 1, -0.5, maxLumiBlock + 0.5, 0, 150.0, "Luminosity Block", "Fraction of RODs with Errors", scode);
+					CAN_REBIN(m_hRobBSErrorsVsLB[ibe][iside]);
+				}
+			}
+
+			// Barrel/Endcap Histograms
+			const std::string module_or_wheel[2] = { "Module", "Wheel" };
+			const std::string stack_or_sector[2] = { "Barrel Stack", "Endcap Sector" };
+			const std::string modulenum_assign2[2] = { "Modules Type 1 (1-32), Type 2 (33-64), Type 3 (65-96)", "Wheels A (1-32), B (33-64)" };
+
+			for (int ibe = 0; ibe < 2; ibe++) {
+				const std::string regionTag = " (" + barrel_or_endcap[ibe] + ")";
+				MonGroup rdo(this, "TRT/" + barrel_or_endcap[ibe] + "/Expert",  run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
+				MonGroup rdoShift (this, "TRT/Shift/" + barrel_or_endcap[ibe], run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
+				MonGroup rdoShiftTH1(this, "TRT/Shift/" + barrel_or_endcap[ibe], run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED, "", "weightedEff");
+
+				if (ibe == 0) {
+					m_hHitWMap_B = bookTH1F_LW(rdoShiftTH1, "hHitWMap", "Leading Edge in Time Window: Xenon Straws" " (Barrel)", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+
+					if (m_ArgonXenonSplitter) {
+						m_hHitWMap_B_Ar = bookTH1F_LW(rdoShiftTH1, "hHitWMap_Ar", "Leading Edge in Time Window: Argon Straws (Barrel)", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+					}
+
+					m_hOccAll = bookTH1F_LW(rdoShift, "hOccAll", "Occupancy per Event", 400, 0.0, 1.0, "Occupancy", "Events", scode);
+				} else if (ibe == 1) {
+					m_hHitWMap_E[0] = bookTH1F_LW(rdoShiftTH1, "hHitWMap_A", "Leading Edge in Time Window: Xenon Straws" " (EA)", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+					m_hHitWMap_E[1] = bookTH1F_LW(rdoShiftTH1, "hHitWMap_C", "Leading Edge in Time Window: Xenon Straws" " (EC)", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+
+					if (m_ArgonXenonSplitter) {
+						m_hHitWMap_E_Ar[0] = bookTH1F_LW(rdoShiftTH1, "hHitWMap_Ar_A", "Leading Edge in Time Window: Argon Straws" " (EA)", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+						m_hHitWMap_E_Ar[1] = bookTH1F_LW(rdoShiftTH1, "hHitWMap_Ar_C", "Leading Edge in Time Window: Argon Straws" " (EC)", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+					}
+				}
+
+				m_hBCIDvsOcc[ibe] = bookTProfile_LW(rdo, "hBCIDvsOcc", "Avg. Occupancy vs BCID" + regionTag, 3565, 0, 3564, 0, 1, "Bunch Crossing ID", "Occupancy", scode);
+
+				for (int iside = 0; iside < 2; iside++) {
+					const std::string regionTag = " (" + be_id[ibe] + side_id[iside] + ")";
+					const std::string regionMarker = (m_environment == AthenaMonManager::online) ? (be_id[ibe] + side_id[iside]) : (side_id[iside]); // for historical reasons ...
+					m_hAvgHLOcc_side[ibe][iside] = bookTProfile_LW(rdoShift, "hAvgHLOcc_" + regionMarker, "Avg. HL Occupancy" + regionTag, 32, 1, 33, 0, 1, stack_or_sector[ibe], "Occupancy", scode);
+					m_hAvgLLOcc_side[ibe][iside] = bookTProfile_LW(rdoShift, "hAvgLLOcc_" + regionMarker, "Avg. LL Occupancy" + regionTag, 32, 1, 33, 0, 1, stack_or_sector[ibe], "Occupancy", scode);
+					m_hAvgLLOccMod_side[ibe][iside] = bookTProfile_LW(rdo, "hAvgLLOccMod_" + regionMarker, "Avg. LL Occupancy: " + module_or_wheel[ibe] + "s" + regionTag, s_moduleNum[ibe], 0, s_moduleNum[ibe], 0, 1, modulenum_assign2[ibe], "Occupancy", scode);
+					m_hAvgHLOccMod_side[ibe][iside] = bookTProfile_LW(rdo, "hAvgHLOccMod_" + regionMarker, "Avg. HL Occupancy: " + module_or_wheel[ibe] + "s" + regionTag, s_moduleNum[ibe], 0, s_moduleNum[ibe], 0, 1, modulenum_assign2[ibe], "Occupancy", scode);
+				}
+			}
+		}
+	}
+
+	ATH_MSG_VERBOSE("Finished Booking TRT RDO Histograms");
+	return scode;
+}
 
 
 //----------------------------------------------------------------------------------//
-StatusCode TRT_Monitoring_Tool::Book_TRT_Tracks(bool newLumiBlock, bool newRun)
+StatusCode TRT_Monitoring_Tool::bookTRTTracks(bool newLumiBlock, bool newRun) {
 //----------------------------------------------------------------------------------//
-{
-  ATH_MSG_VERBOSE("Booking TRT Track Histograms");
-  if (newLumiBlock) ATH_MSG_VERBOSE("newLumiBlock");
-  if (newRun) ATH_MSG_VERBOSE("newRun");
-
-  StatusCode scode = StatusCode::SUCCESS;
-  std::string hName, hTitle;
-  const std::string barrel_or_endcap[2] = { "Barrel", "EndCap" };
-
-  for (int ibe=0; ibe<2; ibe++) {
-    std::ostringstream oss_distance;
-    oss_distance << std::setprecision(3) << std::fixed << m_DistToStraw;
-    const std::string distance = oss_distance.str();
-    const std::string hPathGen = "TRT/"+barrel_or_endcap[ibe]+"/Expert";
-    const std::string regionTag = " (" + barrel_or_endcap[ibe] + ")";
-
-    for (int i=0; i<s_numberOfStacks[ibe]*2; i++) {
-      std::ostringstream oss;
-      if (ibe == 0) {
-        if      (i <  s_numberOfStacks[ibe]) { oss << "TRT/Barrel/Stack"   << i + 1 << "A"; }
-        else if (i >= s_numberOfStacks[ibe]) { oss << "TRT/Barrel/Stack"   << i + 1 - 32 << "C"; }
-      } else if (ibe == 1) {
-        if      (i <  s_numberOfStacks[ibe]) { oss << "TRT/EndcapA/Sector" << i + 1; }
-        else if (i >= s_numberOfStacks[ibe]) { oss << "TRT/EndcapC/Sector" << i + 1 - 32; }
-      }
-      const std::string hPath = oss.str();
-
-      //MonGroup trackStackWeighted(this, hPath, expert, run, "", "weightedEff");
-      MonGroup trackStackWeighted(this, hPath, run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED,"", "weightedEff");
-      if (DoExpert) {
-        if (newRun) {
-          if (DoStraws) {
-            m_hHitWonTMapS[ibe][i]  = bookTH1F_LW(trackStackWeighted, "hHitWonTMapS", "Leading Edge on Track in Time Window: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-            m_hHitTronTMapS[ibe][i] = bookTProfile_LW(trackStackWeighted, "hHitTronTMapS", "Mean Trailing Edge on Track: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0, 75.0, "Straw Number in Stack", "Time (ns)", scode);
-
-            m_hHitAonTMapS[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitAonTMapS", "Any LL Bit on Track: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-            m_hStrawsEff[ibe][i] = bookTProfile_LW(trackStackWeighted, "hEfficiencyS", "Straw Efficiency with " + distance + " mm Cut", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0.0, 1.0, "Straw Number in Stack", "Efficiency", scode);
-
-            m_hHitAWonTMapS[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitAWonTMapS", "Any LL Bit on Track in Time Window: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-            m_hHitHonTMapS[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitHonTMapS", "HL Hit on Track: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-            m_hHitHWonTMapS[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitHWonTMapS", "HL Hit(In Time Window) on Track: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-            m_hHitAWonTMapS[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitAWonTMapS", "Any LL Bit on Track in Time Window: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-
-            m_hHitToTonTMapS[ibe][i] = bookTProfile_LW(trackStackWeighted, "hHitToTonTMapS", "Mean ToT on Track: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0, 75, "Straw Number in Stack", "Time (ns)", scode);
-            m_hValidRawDriftTimeonTrk[ibe][i] = bookTProfile_LW(trackStackWeighted, "hValidRawDriftTimeonTrkS", "Valid Raw Drift Time on Track: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0, 75, "Straw Number in Stack", "Time (ns)", scode);
-            m_hHtoLonTMapS[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHtoLonTMapS", "HL/LL Ratio on Track: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-            m_hHtoLWonTMapS[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHtoLWonTMapS", "HL/LL (In Time Window) Ratio on Track: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
-            m_hHitTronTwEPCMapS[ibe][i] = bookTProfile_LW(trackStackWeighted, "hHitTronTwEPCMapS", "Mean Trailing Edge on Track (with Event Phase Correction): Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], -50, 75, "Straw Number in Stack", "Time (ns)", scode);
-            m_hHitOnTrackVsAllS[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitonTrackVAllS", "(Hit on Track) / (Any LL Bit): Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Ratio", scode);
-          }//if DoStraws
-
-          if (DoChips) {
-            m_hHitWonTMapC[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitWonTMapC", "Leading Edge on Track in Time Window: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
-            m_hHitTronTMapC[ibe][i] = bookTProfile_LW(trackStackWeighted, "hHitTronTMapC", "Mean Trailing Edge on Track: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], 0, 75, "Chip Number in Stack", "Time (ns)", scode);
-
-            m_hHitAonTMapC[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitAonTMapC", "Any LL Bit on Track: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
-            m_hChipsEff[ibe][i] = bookTProfile_LW(trackStackWeighted, "hEfficiencyC", "Chip Efficiency with " + distance + " mm Cut", s_iChip_max[ibe], 0, s_iChip_max[ibe], 0.0, 1.0, "Chip Number in Stack", "Efficiency", scode);
-
-            m_hHitAWonTMapC[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitAWonTMapC", "Any LL Bit on Track in Time Window: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
-            m_hHitHonTMapC[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitHonTMapC", "HL Hit on Track: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
-            m_hHitHWonTMapC[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitHWonTMapC", "HL Hit(In time Window) on Track: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
-            m_hHitToTonTMapC[ibe][i] = bookTProfile_LW(trackStackWeighted, "hHitToTonTMapC", "Mean ToT on Track: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], 0, 75, "Chip Number in Stack", "Time (ns)", scode);
-            m_hValidRawDriftTimeonTrkC[ibe][i] = bookTProfile_LW(trackStackWeighted, "hValidRawDriftTimeonTrkC", "Valid Raw Drift Time on Track: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], 0, 75, "Chip Number in Stack", "Time (ns)", scode);
-            m_hHtoLonTMapC[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHtoLonTMapC", "HL/LL Ratio on Track: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
-            m_hHtoLWonTMapC[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHtoLWonTMapC", "HL/LL(In Time Window) Ratio on Track: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
-            m_hHitTronTwEPCMapC[ibe][i] = bookTProfile_LW(trackStackWeighted, "hHitTronTwEPCMapC", "Mean Trailing Edge on Track (with Event Phase Correction): Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], -50, 75, "Chip Number in Stack", "Time (ns)", scode);
-            m_hHitOnTrackVsAllC[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitonTrackVAllC", "(Hit on Track) / (Any LL Bit): Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Ratio", scode);
-          }//DoChips
-        }// if (newRun)
-      }//DoExpert
-    }// for (int i=0; i<s_numberOfStacks[ibe]*2; i++)
-  }// for (int ibe=0; ibe<2; ibe++)
-
-  ATH_MSG_VERBOSE("Booked TRT Track Histograms successfully");
-  return scode;
-
-}//Book_TRT_Tracks()
+	ATH_MSG_VERBOSE("Booking TRT Track Histograms");
+
+	if (newLumiBlock) ATH_MSG_VERBOSE("newLumiBlock");
+
+	if (newRun) ATH_MSG_VERBOSE("newRun");
+
+	StatusCode scode = StatusCode::SUCCESS;
+	std::string hName, hTitle;
+	const std::string barrel_or_endcap[2] = { "Barrel", "EndCap" };
+
+	for (int ibe = 0; ibe < 2; ibe++) {
+		std::ostringstream oss_distance;
+		oss_distance << std::setprecision(3) << std::fixed << m_DistToStraw;
+		const std::string distance = oss_distance.str();
+		const std::string hPathGen = "TRT/" + barrel_or_endcap[ibe] + "/Expert";
+		const std::string regionTag = " (" + barrel_or_endcap[ibe] + ")";
+
+		for (int i = 0; i < s_numberOfStacks[ibe] * 2; i++) {
+			std::ostringstream oss;
+
+			if (ibe == 0) {
+				if (i <  s_numberOfStacks[ibe]) {
+					oss << "TRT/Barrel/Stack"   << i + 1 << "A";
+				} else if (i >= s_numberOfStacks[ibe]) {
+					oss << "TRT/Barrel/Stack"   << i + 1 - 32 << "C";
+				}
+			} else if (ibe == 1) {
+				if (i <  s_numberOfStacks[ibe]) {
+					oss << "TRT/EndcapA/Sector" << i + 1;
+				} else if (i >= s_numberOfStacks[ibe]) {
+					oss << "TRT/EndcapC/Sector" << i + 1 - 32;
+				}
+			}
+
+			const std::string hPath = oss.str();
+			MonGroup trackStackWeighted(this, hPath, run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED, "", "weightedEff");
+
+			if (newRun && m_doExpert && m_doStraws) {
+				m_hHitWonTMapS[ibe][i]  = bookTH1F_LW(trackStackWeighted, "hHitWonTMapS", "Leading Edge on Track in Time Window: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+				m_hHitTronTMapS[ibe][i] = bookTProfile_LW(trackStackWeighted, "hHitTronTMapS", "Mean Trailing Edge on Track: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0, 75.0, "Straw Number in Stack", "Time (ns)", scode);
+				m_hHitAonTMapS[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitAonTMapS", "Any LL Bit on Track: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+				m_hStrawsEff[ibe][i] = bookTProfile_LW(trackStackWeighted, "hEfficiencyS", "Straw Efficiency with " + distance + " mm Cut", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0.0, 1.0, "Straw Number in Stack", "Efficiency", scode);
+				m_hHitAWonTMapS[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitAWonTMapS", "Any LL Bit on Track in Time Window: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+				m_hHitHonTMapS[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitHonTMapS", "HL Hit on Track: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+				m_hHitHWonTMapS[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitHWonTMapS", "HL Hit(In Time Window) on Track: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+				m_hHitAWonTMapS[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitAWonTMapS", "Any LL Bit on Track in Time Window: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+				m_hHitToTonTMapS[ibe][i] = bookTProfile_LW(trackStackWeighted, "hHitToTonTMapS", "Mean ToT on Track: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0, 75, "Straw Number in Stack", "Time (ns)", scode);
+				m_hValidRawDriftTimeonTrk[ibe][i] = bookTProfile_LW(trackStackWeighted, "hValidRawDriftTimeonTrkS", "Valid Raw Drift Time on Track: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], 0, 75, "Straw Number in Stack", "Time (ns)", scode);
+				m_hHtoLonTMapS[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHtoLonTMapS", "HL/LL Ratio on Track: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+				m_hHtoLWonTMapS[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHtoLWonTMapS", "HL/LL (In Time Window) Ratio on Track: Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Probability", scode);
+				m_hHitTronTwEPCMapS[ibe][i] = bookTProfile_LW(trackStackWeighted, "hHitTronTwEPCMapS", "Mean Trailing Edge on Track (with Event Phase Correction): Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], -50, 75, "Straw Number in Stack", "Time (ns)", scode);
+				m_hHitOnTrackVsAllS[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitonTrackVAllS", "(Hit on Track) / (Any LL Bit): Straws", s_Straw_max[ibe], 0, s_Straw_max[ibe], "Straw Number in Stack", "Ratio", scode);
+			}
+
+			if (newRun && m_doExpert && m_doChips) {
+				m_hHitWonTMapC[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitWonTMapC", "Leading Edge on Track in Time Window: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
+				m_hHitTronTMapC[ibe][i] = bookTProfile_LW(trackStackWeighted, "hHitTronTMapC", "Mean Trailing Edge on Track: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], 0, 75, "Chip Number in Stack", "Time (ns)", scode);
+				m_hHitAonTMapC[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitAonTMapC", "Any LL Bit on Track: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
+				m_hChipsEff[ibe][i] = bookTProfile_LW(trackStackWeighted, "hEfficiencyC", "Chip Efficiency with " + distance + " mm Cut", s_iChip_max[ibe], 0, s_iChip_max[ibe], 0.0, 1.0, "Chip Number in Stack", "Efficiency", scode);
+				m_hHitAWonTMapC[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitAWonTMapC", "Any LL Bit on Track in Time Window: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
+				m_hHitHonTMapC[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitHonTMapC", "HL Hit on Track: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
+				m_hHitHWonTMapC[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitHWonTMapC", "HL Hit(In time Window) on Track: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
+				m_hHitToTonTMapC[ibe][i] = bookTProfile_LW(trackStackWeighted, "hHitToTonTMapC", "Mean ToT on Track: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], 0, 75, "Chip Number in Stack", "Time (ns)", scode);
+				m_hValidRawDriftTimeonTrkC[ibe][i] = bookTProfile_LW(trackStackWeighted, "hValidRawDriftTimeonTrkC", "Valid Raw Drift Time on Track: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], 0, 75, "Chip Number in Stack", "Time (ns)", scode);
+				m_hHtoLonTMapC[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHtoLonTMapC", "HL/LL Ratio on Track: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
+				m_hHtoLWonTMapC[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHtoLWonTMapC", "HL/LL(In Time Window) Ratio on Track: Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Probability", scode);
+				m_hHitTronTwEPCMapC[ibe][i] = bookTProfile_LW(trackStackWeighted, "hHitTronTwEPCMapC", "Mean Trailing Edge on Track (with Event Phase Correction): Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], -50, 75, "Chip Number in Stack", "Time (ns)", scode);
+				m_hHitOnTrackVsAllC[ibe][i] = bookTH1F_LW(trackStackWeighted, "hHitonTrackVAllC", "(Hit on Track) / (Any LL Bit): Chips", s_iChip_max[ibe], 0, s_iChip_max[ibe], "Chip Number in Stack", "Ratio", scode);
+			}
+		}
+	}
+
+	ATH_MSG_VERBOSE("Booked TRT Track Histograms successfully");
+	return scode;
+}
 
 
 //----------------------------------------------------------------------------------//
-StatusCode TRT_Monitoring_Tool::Book_TRT_Efficiency(bool newLumiBlock, bool newRun)
+StatusCode TRT_Monitoring_Tool::bookTRTEfficiency(bool newLumiBlock, bool newRun) {
 //----------------------------------------------------------------------------------//
-{
-  StatusCode scode = StatusCode::SUCCESS;
-  if (newLumiBlock) {}
-  if (newRun) {
-    std::string hName, hTitle;
-
-    const std::string barrel_or_endcap[2] = { "Barrel", "EndCap" };
-    const std::string be_id[2] = { "B", "E" };
-    const std::string side_id[2] = { "A", "C" };
-
-    //MonGroup trackShiftEff(this, "TRT/Efficiency", expert, run);
-    MonGroup trackShiftEff(this, "TRT/Efficiency", run,ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
-    m_hefficiency_eta = bookTProfile_LW(trackShiftEff, "hEfficiency_eta", "Efficiency vs #eta", 50, -2.8, 2.8, 0, 1, "#eta", "Efficiency", scode);
-    m_hefficiency_phi = bookTProfile_LW(trackShiftEff, "hEfficiency_phi", "Efficiency vs #phi", 50, -3.2, 3.2, 0, 1, "#phi (deg)", "Efficiency", scode);
-    m_hefficiency_pt = bookTProfile_LW(trackShiftEff, "hEfficiency_pt", "Efficiency vs pT", 50, 0, 10, 0, 1, "pT (GeV)", "Efficiency", scode);
-    m_hefficiency_z0 = bookTProfile_LW(trackShiftEff, "hEfficiency_z0", "Efficiency vs z0", 50, -200, 200, 0, 1, "z0", "Efficiency", scode);
-    m_hefficiencyBarrel_locR = bookTProfile_LW(trackShiftEff, "hEfficiencyBarrel_locR", "Efficiency vs Track-to-Wire Distance for Xenon Straws" " (Barrel)", 50, -2.5, 2.5, 0, 1, "Track-to-Wire Distance (mm)", "Efficiency", scode);
-    m_hefficiencyBarrel_locR_Ar = bookTProfile_LW(trackShiftEff, "hEfficiencyBarrel_locR_Ar", "Efficiency vs Track-to-Wire Distance for Argon Straws" " (Barrel)", 50, -2.5, 2.5, 0, 1, "Track-to-Wire Distance (mm)", "Efficiency", scode);
-
-    m_hefficiencyMap[0] = bookTProfile_LW(trackShiftEff, "hEfficiencyBarrelMap", "Straw Efficiency Map" " (Barrel)", s_Straw_max[0], 0, s_Straw_max[0], 0, 1, "Straw Number", "Efficiency", scode);
-    m_hefficiencyMap[1] = bookTProfile_LW(trackShiftEff, "hEfficiencyEndCapMap", "Straw Efficiency Map" " (Endcap)", s_Straw_max[1], 0, s_Straw_max[1], 0, 1, "Straw Number", "Efficiency", scode);
-
-    for (int iside=0; iside<2; iside++) {
-      const std::string regionTag = " (" + be_id[1]   + side_id[iside] + ")";
-      m_hefficiencyEndCap_locR[iside] = bookTProfile_LW(trackShiftEff, "hEfficiencyEndCap"+side_id[iside]+"_locR", "Efficiency vs Track-to-Wire Distance for Xenon Straws" + regionTag, 50, -2.5, 2.5, 0, 1, "Track-to-Wire Distance (mm)", "Efficiency", scode);
-      m_hefficiencyEndCap_locR_Ar[iside] = bookTProfile_LW(trackShiftEff, "hEfficiencyEndCap"+side_id[iside]+"_locR_Ar", "Efficiency vs Track-to-Wire Distance for Argon Straws" + regionTag, 50, -2.5, 2.5, 0, 1, "Track-to-Wire Distance (mm)", "Efficiency", scode);
-    }
-
-    for (int ibe=0; ibe<2; ibe++) {
-      for (int iside=0; iside<2; iside++) {
-        const std::string regionTag = " (" + be_id[ibe] + side_id[iside] + ")";
-        //MonGroup trackShiftEffWeighted(this, "TRT/Efficiency", expert, run, "", "weightedEff");
-        MonGroup trackShiftEffWeighted(this, "TRT/Efficiency", run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED,"", "weightedEff");
-        m_hefficiency[ibe][iside] = bookTH1F_LW(trackShiftEffWeighted, "hEfficiency"+barrel_or_endcap[ibe]+side_id[iside], "Straw Efficiency" + regionTag, 500, -0.01, 1.01, "Efficiency", "Number of Straws", scode);
-        m_hefficiencyIntegral[ibe][iside] = bookTH1F_LW(trackShiftEffWeighted, "hEfficiencyIntegral"+barrel_or_endcap[ibe]+side_id[iside], "Straw Efficiency Integral" + regionTag, 500, -0.01, 1.01, "Efficiency", "Fraction of Straws", scode);
-
-        if (DoExpert) {
-          int imintmp=s_numberOfBarrelStacks*iside;
-          int imaxtmp=s_numberOfBarrelStacks*(iside+1);
-          for (int i=imintmp; i<imaxtmp; i++) {
-            std::ostringstream oss;
-            if      (ibe == 0) oss << "TRT/Barrel/Stack" << (i + 1 - 32 * iside) << side_id[iside];
-            else if (ibe == 1) oss << "TRT/Endcap" << side_id[iside] << "/Sector" << (i + 1 - 32 * iside);
-            const std::string hPath = oss.str();
-
-            //MonGroup trackStack(this, hPath, expert, run);
-            MonGroup trackStack(this, hPath, run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
-            m_hefficiencyS[ibe][i] = bookTProfile_LW(trackStack, "hHitEfficiencyS", "Straw Efficiency Map", s_Straw_max[ibe], 0.5, s_Straw_max[ibe] + 0.5, 0, 1, "Straw Number", "Efficiency", scode);
-            m_hefficiencyC[ibe][i] = bookTProfile_LW(trackStack, "hHitEfficiencyC", "Chip Efficiency Map",  s_iChip_max[ibe], 0.5, s_iChip_max[ibe] + 0.5, 0, 1, "Chip Number", "Efficiency", scode);
-          }
-        } //DoExpert
-      } //for (int iside=0; iside<2; iside++)
-    } //for (int ibe=0; ibe<2; ibe++)
-  }
-  return scode;
-} //book_trt_efficiency
+	StatusCode scode = StatusCode::SUCCESS;
+
+	if (newLumiBlock) {}
+
+	if (newRun) {
+		std::string hName, hTitle;
+		const std::string barrel_or_endcap[2] = { "Barrel", "EndCap" };
+		const std::string be_id[2] = { "B", "E" };
+		const std::string side_id[2] = { "A", "C" };
+		MonGroup trackShiftEff(this, "TRT/Efficiency", run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
+		m_hefficiency_eta = bookTProfile_LW(trackShiftEff, "hEfficiency_eta", "Efficiency vs #eta", 50, -2.8, 2.8, 0, 1, "#eta", "Efficiency", scode);
+		m_hefficiency_phi = bookTProfile_LW(trackShiftEff, "hEfficiency_phi", "Efficiency vs #phi", 50, -3.2, 3.2, 0, 1, "#phi (deg)", "Efficiency", scode);
+		m_hefficiency_pt = bookTProfile_LW(trackShiftEff, "hEfficiency_pt", "Efficiency vs pT", 50, 0, 10, 0, 1, "pT (GeV)", "Efficiency", scode);
+		m_hefficiency_z0 = bookTProfile_LW(trackShiftEff, "hEfficiency_z0", "Efficiency vs z0", 50, -200, 200, 0, 1, "z0", "Efficiency", scode);
+		m_hefficiencyBarrel_locR = bookTProfile_LW(trackShiftEff, "hEfficiencyBarrel_locR", "Efficiency vs Track-to-Wire Distance for Xenon Straws" " (Barrel)", 50, -2.5, 2.5, 0, 1, "Track-to-Wire Distance (mm)", "Efficiency", scode);
+		m_hefficiencyBarrel_locR_Ar = bookTProfile_LW(trackShiftEff, "hEfficiencyBarrel_locR_Ar", "Efficiency vs Track-to-Wire Distance for Argon Straws" " (Barrel)", 50, -2.5, 2.5, 0, 1, "Track-to-Wire Distance (mm)", "Efficiency", scode);
+		m_hefficiencyMap[0] = bookTProfile_LW(trackShiftEff, "hEfficiencyBarrelMap", "Straw Efficiency Map" " (Barrel)", s_Straw_max[0], 0, s_Straw_max[0], 0, 1, "Straw Number", "Efficiency", scode);
+		m_hefficiencyMap[1] = bookTProfile_LW(trackShiftEff, "hEfficiencyEndCapMap", "Straw Efficiency Map" " (Endcap)", s_Straw_max[1], 0, s_Straw_max[1], 0, 1, "Straw Number", "Efficiency", scode);
+
+		for (int iside = 0; iside < 2; iside++) {
+			const std::string regionTag = " (" + be_id[1]   + side_id[iside] + ")";
+			m_hefficiencyEndCap_locR[iside] = bookTProfile_LW(trackShiftEff, "hEfficiencyEndCap" + side_id[iside] + "_locR", "Efficiency vs Track-to-Wire Distance for Xenon Straws" + regionTag, 50, -2.5, 2.5, 0, 1, "Track-to-Wire Distance (mm)", "Efficiency", scode);
+			m_hefficiencyEndCap_locR_Ar[iside] = bookTProfile_LW(trackShiftEff, "hEfficiencyEndCap" + side_id[iside] + "_locR_Ar", "Efficiency vs Track-to-Wire Distance for Argon Straws" + regionTag, 50, -2.5, 2.5, 0, 1, "Track-to-Wire Distance (mm)", "Efficiency", scode);
+		}
+
+		for (int ibe = 0; ibe < 2; ibe++) {
+			for (int iside = 0; iside < 2; iside++) {
+				const std::string regionTag = " (" + be_id[ibe] + side_id[iside] + ")";
+				MonGroup trackShiftEffWeighted(this, "TRT/Efficiency", run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED, "", "weightedEff");
+				m_hefficiency[ibe][iside] = bookTH1F_LW(trackShiftEffWeighted, "hEfficiency" + barrel_or_endcap[ibe] + side_id[iside], "Straw Efficiency" + regionTag, 500, -0.01, 1.01, "Efficiency", "Number of Straws", scode);
+				m_hefficiencyIntegral[ibe][iside] = bookTH1F_LW(trackShiftEffWeighted, "hEfficiencyIntegral" + barrel_or_endcap[ibe] + side_id[iside], "Straw Efficiency Integral" + regionTag, 500, -0.01, 1.01, "Efficiency", "Fraction of Straws", scode);
+
+				if (m_doExpert) {
+					int imintmp = s_numberOfBarrelStacks * iside;
+					int imaxtmp = s_numberOfBarrelStacks * (iside + 1);
+
+					for (int i = imintmp; i < imaxtmp; i++) {
+						std::ostringstream oss;
+
+						if (ibe == 0) {
+							oss << "TRT/Barrel/Stack" << (i + 1 - 32 * iside) << side_id[iside];
+						} else if (ibe == 1) {
+							oss << "TRT/Endcap" << side_id[iside] << "/Sector" << (i + 1 - 32 * iside);
+						}
+
+						const std::string hPath = oss.str();
+						MonGroup trackStack(this, hPath, run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
+						m_hefficiencyS[ibe][i] = bookTProfile_LW(trackStack, "hHitEfficiencyS", "Straw Efficiency Map", s_Straw_max[ibe], 0.5, s_Straw_max[ibe] + 0.5, 0, 1, "Straw Number", "Efficiency", scode);
+						m_hefficiencyC[ibe][i] = bookTProfile_LW(trackStack, "hHitEfficiencyC", "Chip Efficiency Map",  s_iChip_max[ibe], 0.5, s_iChip_max[ibe] + 0.5, 0, 1, "Chip Number", "Efficiency", scode);
+					}
+				}
+			}
+		}
+	}
+
+	return scode;
+}
 
 //----------------------------------------------------------------------------------//
-StatusCode TRT_Monitoring_Tool::Book_TRT_Shift_Tracks(bool newLumiBlock, bool newRun)
+StatusCode TRT_Monitoring_Tool::bookTRTShiftTracks(bool newLumiBlock, bool newRun) {
 //----------------------------------------------------------------------------------//
-{
-  ATH_MSG_VERBOSE("Booking TRT Track Histograms");
-
-  if (newLumiBlock)   ATH_MSG_VERBOSE("newLumiBlock");
-  if (newRun)         ATH_MSG_VERBOSE("newRun");
-
-  std::string hName, hTitle;
-
-  std::ostringstream oss_distance;
-  oss_distance << std::setprecision(3) << std::fixed << m_DistToStraw;
-  const std::string distance = oss_distance.str();
-  StatusCode scode = StatusCode::SUCCESS;
-  //create several histogram directories.
-  //  MonGroup trackBarrelShiftTProf(this, "TRT/Shift/Barrel",shift,run);
-  //  MonGroup trackBarrelDiag(this, "TRT/Barrel/Diagnostics", debug, run);
-  MonGroup trackBarrelShiftTProf(	this, "TRT/Shift/Barrel", 	run,ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
-  MonGroup trackBarrelDiag(		this, "TRT/Barrel/Diagnostics", run,ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
-  const std::string barrel_or_endcap[2] = { "Barrel", "EndCap" };
-  const std::string be_id[2] = { "B", "E" };
-  const std::string side_id[2] = { "A", "C" };
-  const int maxLumiblock = 720;
-
-  //Arrays for Aging
-  //const std::string gas_in[4] ={ "EA_in_A", "EA_in_B","EC_in_A","EC_in_B"};
-  //const std::string gas_out[4] ={ "EA_out_A", "EA_out_B","EC_out_A","EC_out_B"};
-  const std::string gas[4] ={ "in_A","in_B","out_A","out_B"};
-  const std::string Mod[5] ={"1","2","3","shortP","shortN"}; 
-  //const std::string Lum[8] ={"1","2","3","4","5","6","7","8"};
-  //Some unused variables commented out "gas_in,gas_out,Lum"
-  //There was warnings about it on the NICOS Nightly System 
-
-  for (int ibe=0; ibe<2; ibe++) {
-    const std::string regionTag = " (" + barrel_or_endcap[ibe] + ")";
-    //    MonGroup trackShift(this, "TRT/Shift/"+barrel_or_endcap[ibe], shift, run);
-    //    MonGroup trackShiftRebinned(this, "TRT/Shift/"+barrel_or_endcap[ibe], shift, run,"","mergeRebinned");
-    //    MonGroup trackShiftTH1(this, "TRT/Shift/"+barrel_or_endcap[ibe], shift, run,"","weightedEff");
-    MonGroup trackShift(this, "TRT/Shift/"+barrel_or_endcap[ibe],  run,ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
-    MonGroup trackShiftRebinned(this, "TRT/Shift/"+barrel_or_endcap[ibe],  run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED,"","mergeRebinned");
-    MonGroup trackShiftTH1(this, "TRT/Shift/"+barrel_or_endcap[ibe],  run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED,"","weightedEff");
-    MonGroup trackShiftTH1_lowStat(this, "TRT/Shift/"+barrel_or_endcap[ibe],  lowStat, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED,"","weightedEff");
-    MonGroup trackAging(this, "TRT/Aging/"+barrel_or_endcap[ibe], lowStat,ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
-
-    if (newRun && DoShift) {
-      if (ibe==0) {
-        m_hEvtPhase             = bookTH1F_LW(trackShift, "hEvtPhase", "Event Phase Correction Factor", 200, -50, 50, "Event Phase (ns)", "Entries", scode);
-        m_hEvtPhaseVsTrig       = bookTH2F_LW(trackShift, "hEvtPhaseVsTrig", "Event Phase vs L1 Trigger Item", 300, -200, 100, 256, -0.5, 255.5,"Event Phase (ns)","L1 Trigger Item", scode);
-
-        m_hEvtPhaseDetPhi_B     = bookTProfile_LW(trackShift, "hEvtPhaseDetPhi", "Event Phase vs #phi (2D)" + regionTag, m_nphi_bins, 0, 360, -50, 100., "#phi (deg)", "Event Phase from Tracks per Event", scode);
-        m_hrtRelation_B         = bookTH2F_LW(trackShift, "hrtRelation", "R(t) Relation for Xenon Straws" + regionTag, 30, -12.5, 81.25, 50, 0, 2.5, "Measured Leading Edge (ns)", "Track-to-Wire Distance (mm)", scode);
-        m_hNumHoTDetPhi_B       = bookTProfile_LW(trackShift, "hNumHoTDetPhi", "Number of Hits per Track with " + distance + " mm Cut vs #phi" + regionTag, m_nphi_bins, 0., 360, 0, 150, "#phi (deg)", Form("Hits per Track, TRT Hits >= %d", m_minTRThits), scode);
-        m_hTronTDist_B          = bookTH1F_LW(trackShiftTH1, "hTronTDist", "Trailing Edge Distribution on Track for Xenon Straws" + regionTag, 26, -0.5, 80.75, "Trailing Edge (ns)", "Norm. Entries", scode);
-        m_hDriftTimeonTrkDist_B = bookTH1F_LW(trackShiftTH1, "hDriftTimeonTrkDist", "Drift Time Distribution on Track for Xenon Straws" + regionTag, 32, 0, 100., "Drift Time (ns)", "Norm. Entries", scode);
-        m_hNumTrksDetPhi_B      = bookTH1F_LW(trackShift, "hNumTrksDetPhi", "Number of Reconstructed Tracks vs #phi (2D)" + regionTag, 60, 0, 360, "#phi (deg)", "Number of Tracks", scode);
-
-        if (m_ArgonXenonSplitter) {
-          m_hDriftTimeonTrkDist_B_Ar = bookTH1F_LW(trackShiftTH1, "hDriftTimeonTrkDist_Ar", "Drift Time Distribution on Track for Argon Straws" + regionTag, 32, 0, 100., "Drift Time (ns)", "Norm. Entries", scode);
-          m_hTronTDist_B_Ar     = bookTH1F_LW(trackShiftTH1, "hTronTDist_Ar", "Trailing Edge Distribution on Track for Argon Straws" + regionTag, 26, -0.5, 80.75, "Trailing Edge (ns)", "Norm. Entries", scode);
-          m_hrtRelation_B_Ar    = bookTH2F_LW(trackShift, "hrtRelation_Ar", "R(t) Relation for Argon Straws" + regionTag, 30, -12.5, 81.25, 50, 0, 2.5, "Measured Leading Edge (ns)", "Track-to-Wire Distance (mm)", scode);
-	  m_Pull_Biased_Barrel  = bookTH1F_LW(trackShift, "hPull_Biased_Barrel", "Biased Track Pulls for Barrel Hits", 200, -2.5, 2.5, "Pulls", "Entries", scode);
-	  m_hResidual_B_Ar      = bookTH1F_LW(trackShiftTH1_lowStat, "hResidual_Ar", "Residuals for Argon Straws" + regionTag, 200, -2.5, 2.5, "Hit-to-Track Distance (mm)", "Norm. Entries", scode);
-	  m_hResidual_B_Ar_20GeV= bookTH1F_LW(trackShiftTH1, "hResidual_Ar_20GeV", "Residuals for Argon Straws" + regionTag+"(After 20GeV pT cut)", 200, -2.5, 2.5, "Hit-to-Track Distance (mm)", "Norm. Entries", scode);
-	  m_hAvgTroTDetPhi_B_Ar = bookTProfile_LW(trackShift, "hAvgTroTDetPhi_Ar", "Avg. Trailing Edge on Track vs #phi (2D) for Argon" + regionTag, m_nphi_bins, 0, 360, 0, 75., "#phi (deg)", "Trailing Edge (ns)", scode);
-          m_hTimeResidual_B_Ar  = bookTH1F_LW(trackShiftTH1, "hTimeResidual_Ar", "Time Residuals for Argon Straws" + regionTag, 200, -20, 20, "Time Residual (ns)", "Norm. Entries", scode);
-	  m_hWireToTrkPosition_B_Ar = bookTH1F_LW(trackShiftTH1, "hWireToTrkPosition_Ar", "Track-to-Wire Distance for Argon" + regionTag, 100, -5., 5, "Track-to-Wire Distance (mm)", "Norm. Entries", scode); 
-	  m_hHtoLRatioOnTrack_B_Ar = bookTH1F_LW(trackShiftTH1, "hHtoLRatioOnTrack_Ar", "HL/LL Ratio per Reconstructed Track for Argon" + regionTag, 50, 0, 1, "HL/LL Ratio", "Norm. Entries", scode); //for argon
-        }
-	m_hHtoLRatioOnTrack_B_Xe = bookTH1F_LW(trackShiftTH1, "hHtoLRatioOnTrack_Xe", "HL/LL Ratio per Reconstructed Track for Xenon" + regionTag, 50, 0, 1, "HL/LL Ratio", "Norm. Entries", scode); //for xenon 
-	m_hResidual_B           = bookTH1F_LW(trackShiftTH1_lowStat, "hResidual", "Residuals for Xenon Straws" + regionTag, 200, -2.5, 2.5, "Hit-to-Track Distance (mm)", "Norm. Entries", scode);
-	m_hResidual_B_20GeV   = bookTH1F_LW(trackShiftTH1, "hResidual_20GeV", "Residuals for Xenon Straws" + regionTag+"(After 20GeV pT cut)", 200, -2.5, 2.5, "Hit-to-Track Distance (mm)", "Norm. Entries", scode);
-        m_hTimeResidual_B       = bookTH1F_LW(trackShiftTH1, "hTimeResidual", "Time Residuals for Xenon Straws" + regionTag, 200, -20, 20, "Time Residual (ns)", "Norm. Entries", scode);
-	m_hWireToTrkPosition_B  = bookTH1F_LW(trackShiftTH1, "hWireToTrkPosition", "Track-to-Wire Distance for Xenon" + regionTag, 100, -5., 5, "Track-to-Wire Distance (mm)", "Norm. Entries", scode);
-        m_hNumSwLLWoT_B         = bookTH1F_LW(trackShiftTH1, "hNumSwLLWoT", "Number of Straws with Hits on Track in Time Window" + regionTag, 150, 0, 150, "Number of LL Hits per Track", "Norm. Entries", scode);
-	m_hAvgTroTDetPhi_B      = bookTProfile_LW(trackShift, "hAvgTroTDetPhi", "Avg. Trailing Edge on Track vs #phi (2D) for Xenon" + regionTag, m_nphi_bins, 0, 360, 0, 75., "#phi (deg)", "Trailing Edge (ns)", scode);
-
-        m_hNTrksperLB_B         = bookTProfile(trackShiftRebinned, "hNTrksperLB", "Avg. Number of Reconstructed Tracks per Event" + regionTag, maxLumiblock, -0.5, maxLumiblock - 0.5, 0, 150.0, "Luminosity Block", "Number of Tracks", scode);
-        CAN_REBIN(m_hNTrksperLB_B);
-        m_hNHitsperLB_B         = bookTProfile(trackShiftRebinned, "hNHitsperLB", "Avg. Occupancy" + regionTag, maxLumiblock, -0.5, maxLumiblock - 0.5, 0, 150.0, "Luminosity Block", "Occupancy", scode);
-        CAN_REBIN(m_hNHitsperLB_B);
-        m_hNHLHitsperLB_B       = bookTProfile(trackShiftRebinned, "hNHLHitsperLB", "Avg. HL Occupancy" + regionTag, maxLumiblock, -0.5, maxLumiblock - 0.5, 0, 150.0, "Luminosity Block", "Occupancy", scode);
-        CAN_REBIN(m_hNHLHitsperLB_B);
-
-
-        m_hHLhitOnTrack_B       = bookTH1F_LW(trackShiftTH1, "hHLhitOnTrack", "Number of HL Hits per Reconstructed Track" + regionTag, 50, 0, 50, "Number of HL Hits per Track", "Norm. Entries", scode);
-	m_hHtoLRatioOnTrack_B   = bookTH1F_LW(trackShiftTH1, "hHtoLRatioOnTrack", "HL/LL Ratio per Reconstructed Track for All" + regionTag, 50, 0, 1, "HL/LL Ratio", "Norm. Entries", scode);
-        m_hHitWonTMap_B         = bookTH1F_LW(trackShiftTH1, "hHitWonTMap", "Leading Edge in Time Window per Reconstructed Track" + regionTag, s_Straw_max[0], 0, s_Straw_max[0], "Straw Number", "Norm. Entries", scode);
-        m_hStrawEffDetPhi_B     = bookTProfile_LW(trackShift, "hStrawEffDetPhi", "Straw Efficiency on Track with " + distance + " mm Cut vs #phi(2D)" + regionTag, 32, 0, 32, 0, 1.2, "Stack", "Avg. Straw Efficiency", scode);
-
-      } else if (ibe==1) {
-	m_Pull_Biased_EndCap    =  bookTH1F_LW(trackShift, "hPull_Biased_EndCap", "Biased Track Pulls for EndCap Hits", 200, -2.5, 2.5, "Pulls", "Entries", scode);
-        for (int iside=0; iside<2; iside++) {
-          const std::string regionTag    = " (" + be_id[ibe] + side_id[iside] + ")"; // hides variable in outer scope
-          m_hEvtPhaseDetPhi_E[iside]     = bookTProfile_LW(trackShift, "hEvtPhaseDetPhi_"+side_id[iside], "Event Phase vs #phi (2D)" + regionTag, m_nphi_bins, 0, 360, -50, 100, "#phi (deg)", "Event Phase from Tracks per Event", scode);
-          m_hrtRelation_E[iside]         = bookTH2F_LW(trackShift, "hrtRelation_"+side_id[iside], "R(t) Relation for Xenon Straws" + regionTag, 30, -12.5, 81.25, 50, 0, 2.5, "Measured Leading Edge (ns)", "Track-to-Wire Distance (mm)", scode);
-          m_hNumHoTDetPhi_E[iside]       = bookTProfile_LW(trackShift, "hNumHoTDetPhi_"+side_id[iside], "Number of Hits per Track with " + distance + " mm Cut vs #phi" + regionTag, m_nphi_bins,0.,360,0,150, "#phi (deg)", Form("Hits per Track, TRT Hits> = %d", m_minTRThits),scode);
-          m_hTronTDist_E[iside]          = bookTH1F_LW(trackShiftTH1, "hTronTDist_"+side_id[iside], "Trailing Edge Distribution on Track for Xenon Straws" + regionTag, 26, -0.5, 80.75,  "Trailing Edge (ns)", "Norm. Entries", scode);
-          m_hDriftTimeonTrkDist_E[iside] = bookTH1F_LW(trackShiftTH1, "hDriftTimeonTrkDist_"+side_id[iside], "Drift Time Distribution on Track for Xenon Straws" + regionTag, 32, 0, 100, "Drift Time (ns)", "Norm. Entries", scode);
-          m_hNumTrksDetPhi_E[iside]      = bookTH1F_LW(trackShift, "hNumTrksDetPhi_"+side_id[iside], "Number of Reconstructed Tracks vs #phi (2D)" + regionTag, 60, 0, 360, "#phi (deg)", "Number of Tracks", scode);
-	  m_hResidual_E[iside]           = bookTH1F_LW(trackShiftTH1_lowStat, "hResidual_"+side_id[iside], "Residuals for Xenon Straws" + regionTag, 200, -2.5, 2.5, "Hit-to-Track Distance (mm)", "Norm. Entries", scode);
-	  m_hResidual_E_20GeV[iside]     = bookTH1F_LW(trackShiftTH1, "hResidual_"+side_id[iside]+"_20GeV", "Residuals for Xenon Straws" + regionTag+"(After 20GeV pT cut)", 200, -2.5, 2.5, "Hit-to-Track Distance (mm)", "Norm. Entries", scode);
-          m_hTimeResidual_E[iside]       = bookTH1F_LW(trackShiftTH1, "hTimeResidual_"+side_id[iside], "Time Residuals for Xenon Straws" + regionTag, 200, -20, 20, "Time Residual (ns)", "Norm. Entries", scode);
-
-          if (m_ArgonXenonSplitter) {
-            m_hTronTDist_E_Ar[iside]     = bookTH1F_LW(trackShiftTH1, "hTronTDist_Ar_"+side_id[iside], "Trailing Edge Distribution on Track for Argon Straws" + regionTag, 26, -0.5, 80.75,  "Trailing Edge (ns)", "Norm. Entries", scode);
-	    m_hAvgTroTDetPhi_E_Ar[iside] = bookTProfile_LW(trackShift, "hAvgTroTDetPhi_Ar_"+side_id[iside], "Avg. Trailing Edge on Track vs #phi (2D) for Argon" + regionTag, m_nphi_bins, 0, 360, 0, 75., "#phi (deg)", "Trailing Edge (ns)", scode);            m_hrtRelation_E_Ar[iside]    = bookTH2F_LW(trackShift, "hrtRelation_Ar_" + side_id[iside], "R(t) Relation for Argon Straws" + regionTag, 30, -12.5, 81.25, 50, 0, 2.5, "Measured Leading Edge (ns)", "Track-to-Wire Distance (mm)", scode);
-            m_hDriftTimeonTrkDist_E_Ar[iside] = bookTH1F_LW(trackShiftTH1, "hDriftTimeonTrkDist_Ar_"+side_id[iside], "Drift Time Distribution on Track for Argon Straws" + regionTag, 32, 0, 100, "Drift Time (ns)", "Norm. Entries", scode);
-	    m_hResidual_E_Ar[iside]       = bookTH1F_LW(trackShiftTH1_lowStat, "hResidual_Ar_" + side_id[iside], "Residuals for Argon Straws" + regionTag, 200, -2.5, 2.5, "Hit-to-Track Distance (mm)", "Norm. Entries", scode);
-	    m_hResidual_E_Ar_20GeV[iside] = bookTH1F_LW(trackShiftTH1, "hResidual_Ar_" + side_id[iside]+"_20GeV", "Residuals for Argon Straws" + regionTag+"(After 20GeV pT cut)", 200, -2.5, 2.5, "Hit-to-Track Distance (mm)", "Norm. Entries", scode);
-            m_hTimeResidual_E_Ar[iside]  = bookTH1F_LW(trackShiftTH1, "hTimeResidual_Ar_" + side_id[iside], "Time Residuals for Argon Straws" + regionTag, 200, -20, 20, "Time Residual (ns)", "Norm. Entries", scode);
-	    m_hWireToTrkPosition_E_Ar[iside] = bookTH1F_LW(trackShiftTH1, "hWireToTrkPosition_Ar_"+side_id[iside], "Track-to-Wire Distance for Argon" + regionTag, 100, -5., 5, "Track-to-Wire Distance (mm)", "Norm. Entries", scode); 
-	    m_hHtoLRatioOnTrack_E_Ar[iside] = bookTH1F_LW(trackShiftTH1, "hHtoLRatioOnTrack_Ar_"+side_id[iside], "HL/LL Ratio per Reconstructed Track for Argon" + regionTag, 50, 0, 1.0, "HL/LL Ratio", "Norm. Entries", scode); //for argon
-	  }
-	  m_hHtoLRatioOnTrack_E_Xe[iside] = bookTH1F_LW(trackShiftTH1, "hHtoLRatioOnTrack_Xe_"+side_id[iside], "HL/LL Ratio per Reconstructed Track for Xenon" + regionTag, 50, 0, 1.0, "HL/LL Ratio", "Norm. Entries", scode); //for xenon
-	  
-	  m_hWireToTrkPosition_E[iside]  = bookTH1F_LW(trackShiftTH1, "hWireToTrkPosition_"+side_id[iside], "Track-to-Wire Distance for Xenon" + regionTag, 100, -5., 5, "Track-to-Wire Distance (mm)", "Norm. Entries", scode);
-          m_hNumSwLLWoT_E[iside]         = bookTH1F_LW(trackShiftTH1, "hNumSwLLWoT_"+side_id[iside], "Number of Straws with Hits on Track in Time Window" + regionTag, 150, 0, 150, "Number of LL Hits per Track", "Norm. Entries", scode);
-	  m_hAvgTroTDetPhi_E[iside]      = bookTProfile_LW(trackShift, "hAvgTroTDetPhi_"+side_id[iside], "Avg. Trailing Edge on Track vs #phi (2D) for Xenon" + regionTag, m_nphi_bins, 0, 360, 0, 75., "#phi (deg)", "Trailing Edge (ns)", scode);
-
-          m_hNTrksperLB_E[iside]         = bookTProfile(trackShiftRebinned, "hNTrksperLB_"+side_id[iside], "Avg. Number of Reconstructed Tracks per Event" + regionTag, maxLumiblock, -0.5, maxLumiblock - 0.5, 0, 150.0, "Luminosity Block", "Number of Tracks", scode);
-          CAN_REBIN(m_hNTrksperLB_E[iside]);
-          m_hNHitsperLB_E[iside]         = bookTProfile(trackShiftRebinned, "hNHitsperLB_"+side_id[iside], "Avg. Occupancy" + regionTag, maxLumiblock, -0.5, maxLumiblock - 0.5, 0, 150.0, "Luminosity Block", "Occupancy", scode);
-          CAN_REBIN(m_hNHitsperLB_E[iside]);
-          m_hNHLHitsperLB_E[iside]       = bookTProfile(trackShiftRebinned, "hNHLHitsperLB_"+side_id[iside], "Avg. HL Occupancy" + regionTag, maxLumiblock, -0.5, maxLumiblock - 0.5, 0, 150.0, "Luminosity Block", "Occupancy", scode);
-          CAN_REBIN(m_hNHLHitsperLB_E[iside]);
-
-          m_hHLhitOnTrack_E[iside]       = bookTH1F_LW(trackShiftTH1, "hHLhitOnTrack_"+side_id[iside], "Number of HL Hits per Reconstructed Track" + regionTag, 50, 0, 50, "Number of HL Hits per Track", "Norm. Entries", scode);
-	  m_hHtoLRatioOnTrack_E[iside]   = bookTH1F_LW(trackShiftTH1, "hHtoLRatioOnTrack_"+side_id[iside], "HL/LL Ratio per Reconstructed Track for All" + regionTag, 50, 0, 1.0, "HL/LL Ratio", "Norm. Entries", scode);
-          m_hHitWonTMap_E[iside]         = bookTH1F_LW(trackShiftTH1, "hHitWonTMap_"+side_id[iside], "Leading Edge in Time Window per Reconstructed Track" + regionTag, s_Straw_max[1], 0, s_Straw_max[1], "Straw Number", "Norm. Entries", scode);
-          m_hStrawEffDetPhi_E[iside]     = bookTProfile_LW(trackShift, "hStrawEffDetPhi_" + side_id[iside], "Straw Efficiency on Track with " + distance + " mm Cut vs #phi(2D)" + regionTag, 32, 0, 32, 0, 1.2, "Stack", "Avg. Straw Efficiency", scode);
-        } //for (int iside=0; iside<2; iside++)
-      } //else if (ibe==1)
-      m_hHitsOnTrack_Scatter[ibe]      = bookTH2F_LW(trackShift, "m_hHitsOnTrack_Scatter", "Hits per Track in Time Window in Stacks" + regionTag, 1440, -0.5, 1440 - 0.5, 80, 0, 80, "Luminosity Block (mod 1440)", "Number of Hits per Track in Stacks", scode);
-      m_hLLOcc_Scatter[ibe]            = bookTH2F_LW(trackShift, "m_hLLOcc_Scatter", "LL Occupancy in Stacks" + regionTag, 1440, -0.5, 1440 - 0.5, 400, 0.0, 1.0, "Luminosity Block (mod 1440)", "LL Occupancy in Stacks", scode);
-      m_hHightoLowRatioOnTrack_Scatter[ibe] = bookTH2F_LW(trackShift, "m_hHightoLowRatioOnTrack_Scatter", "HL/LL Ratio on Track in Stacks" + regionTag, 1440, -0.5, 1440 - 0.5, 40, 0.0, 0.5, "Luminosity Block (mod 1440)", "HL/LL Ratio in Stacks", scode);
-    }//if (newRun && DoShift)
-
-      //ToDo: Fix this
-      //if (ibe==1) continue; //a dirty fix to double booking
-      //Here begins the booking of offline efficiency histograms.
-      //      MonGroup trackEffBarrel(this, "TRT/Shift/Barrel",shift,run);
-      //      MonGroup trackEffEndCap(this, "TRT/Shift/EndCap",shift,run);
-      /*MonGroup trackEffBarrel(this, "TRT/Shift/Barrel",run,ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
-      MonGroup trackEffEndCap(this, "TRT/Shift/EndCap",run,ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
-      m_hefficiencyBarrel_locR_Off = bookTProfile_LW(trackEffBarrel, "hEfficiencyBarrel_locR_Off", "Efficiency vs Track-to-Wire Distance" " (Barrel)", 50, -2.5, 2.5, 0, 1, "Track-to-Wire Distance (mm)", "Efficiency", scode);
-      m_hefficiencyBarrel_locR_Off_Ar = bookTProfile_LW(trackEffBarrel, "hEfficiencyBarrel_locR_Off_Ar", "Efficiency vs Track-to-Wire Distance Argon Straws" " (Barrel)", 50, -2.5, 2.5, 0, 1, "Track-to-Wire Distance (mm)", "Efficiency", scode);
-
-      for (int iside=0; iside<2; iside++) {
-        const std::string regionTag = " (" + be_id[1]   + side_id[iside] + ")";
-        m_hefficiencyEndCap_locR_Off[iside] = bookTProfile_LW(trackEffEndCap, "hEfficiencyEndCap"+side_id[iside]+"_locR_Off", "Efficiency vs Track-to-Wire Distance" + regionTag, 50, -2.5, 2.5, 0, 1, "Track-to-Wire Distance (mm)", "Efficiency", scode);
-	m_hefficiencyEndCap_locR_Off_Ar[iside] = bookTProfile_LW(trackEffEndCap, "hEfficiencyEndCap"+side_id[iside]+"_locR_Off_Ar", "Efficiency vs Track-to-Wire Distance for Argon Straws" + regionTag, 50, -2.5, 2.5, 0, 1, "Track-to-Wire Distance (mm)", "Efficiency", scode);
-	//End of offline efficiency histograms.
-	}*/
-
-      //Initialize Aging plots
-    if (newLumiBlock && DoShift) {
-      for(int iL = 0; iL<5;iL++){    
-        for(int iSide = 0; iSide<2; iSide++){
-          if (ibe == 0) {
-            if(iL<3){
-              m_trackz_All[iL][iSide] = bookTH1F_LW(trackAging, "trackz_m"+Mod[iL]+"_"+side_id[iSide]+"_All", "Number All Hits side "+side_id[iSide]+" Layer "+Mod[iL], 30, -750., 750., "z [mm]", "Number of Hits", scode);
-              m_trackz_HT[iL][iSide] = bookTH1F_LW(trackAging, "trackz_m"+Mod[iL]+"_"+side_id[iSide]+"_HT", "Number HT Hits side "+side_id[iSide]+" Layer "+Mod[iL], 30, -750., 750., "z [mm]", "Number of HT Hits", scode);
-            }
-            if(iL==3){
-              m_trackz_All[iL][iSide] = bookTH1F_LW(trackAging, "trackz_m1_"+side_id[iSide]+"_All_"+Mod[iL], "Number All Hits side "+side_id[iSide]+" Layer 1 "+Mod[iL], 30, 0., 725., "z [mm]", "Number of Hits", scode);
-              m_trackz_HT[iL][iSide] = bookTH1F_LW(trackAging, "trackz_m1_"+side_id[iSide]+"_HT_"+Mod[iL], "Number HT Hits side "+side_id[iSide]+" Layer 1 "+Mod[iL], 30, 0., 725., "z [mm]", "Number of HT Hits", scode);
-            }
-            if(iL==4){
-              m_trackz_All[iL][iSide] = bookTH1F_LW(trackAging, "trackz_m1_"+side_id[iSide]+"_All_"+Mod[iL], "Number All Hits side "+side_id[iSide]+" Layer 1 "+Mod[iL], 30, -725., 0., "z [mm]", "Number of Hits", scode);
-              m_trackz_HT[iL][iSide] = bookTH1F_LW(trackAging, "trackz_m1_"+side_id[iSide]+"_HT_"+Mod[iL], "Number HT Hits side "+side_id[iSide]+" Layer 1 "+Mod[iL], 30, -725., 0., "z [mm]", "Number of HT Hits", scode);
-            }
-          } else if (ibe ==1) { // prevent double booking of histograms here
-            if(iL<4){
-              m_trackr_All[iL][iSide] = bookTH1F_LW(trackAging, "trackr_E"+side_id[iSide]+"_"+gas[iL]+"_All", "Number All Hits E"+side_id[iSide]+" "+gas[iL], 30, 644., 1004., "r [mm]", "Number of Hits", scode);
-              m_trackr_HT[iL][iSide] = bookTH1F_LW(trackAging, "trackr_E"+side_id[iSide]+"_"+gas[iL]+"_HT", "Number HT Hits E"+side_id[iSide]+" "+gas[iL], 30, 644., 1004., "r [mm]", "Number of HT Hits", scode);
-            }
-          }
-        }//Loop of iSide
-      }//Loop over Modules
-    }//(newLumiBlock && DoShift)
-  }//for (int ibe=0; ibe<2; ibe++)
-
-  return scode;
+	ATH_MSG_VERBOSE("Booking TRT Track Histograms");
+
+	if (newLumiBlock)   ATH_MSG_VERBOSE("newLumiBlock");
+
+	if (newRun)         ATH_MSG_VERBOSE("newRun");
+
+	std::string hName, hTitle;
+	std::ostringstream oss_distance;
+	oss_distance << std::setprecision(3) << std::fixed << m_DistToStraw;
+	const std::string distance = oss_distance.str();
+	StatusCode scode = StatusCode::SUCCESS;
+	//create several histogram directories.
+	MonGroup trackBarrelShiftTProf(this, "TRT/Shift/Barrel", run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
+	MonGroup trackBarrelDiag(this, "TRT/Barrel/Diagnostics", run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
+	const std::string barrel_or_endcap[2] = { "Barrel", "EndCap" };
+	const std::string be_id[2] = { "B", "E" };
+	const std::string side_id[2] = { "A", "C" };
+	const int maxLumiblock = 720;
+	//Arrays for Aging
+	const std::string gas[4] = { "in_A", "in_B", "out_A", "out_B"};
+	const std::string Mod[5] = {"1", "2", "3", "shortP", "shortN"};
+
+	for (int ibe = 0; ibe < 2; ibe++) {
+		const std::string regionTag = " (" + barrel_or_endcap[ibe] + ")";
+		MonGroup trackShift(this, "TRT/Shift/" + barrel_or_endcap[ibe],  run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
+		MonGroup trackShiftRebinned(this, "TRT/Shift/" + barrel_or_endcap[ibe],  run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED, "", "mergeRebinned");
+		MonGroup trackShiftTH1(this, "TRT/Shift/" + barrel_or_endcap[ibe],  run, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED, "", "weightedEff");
+		MonGroup trackShiftTH1_lowStat(this, "TRT/Shift/" + barrel_or_endcap[ibe],  lowStat, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED, "", "weightedEff");
+		MonGroup trackAging(this, "TRT/Aging/" + barrel_or_endcap[ibe], lowStat, ManagedMonitorToolBase::MgmtAttr_t::ATTRIB_UNMANAGED);
+
+		if (newRun && m_doShift) {
+			if (ibe == 0) {
+				m_hEvtPhase = bookTH1F_LW(trackShift, "hEvtPhase", "Event Phase Correction Factor", 200, -50, 50, "Event Phase (ns)", "Entries", scode);
+				m_hEvtPhaseVsTrig = bookTH2F_LW(trackShift, "hEvtPhaseVsTrig", "Event Phase vs L1 Trigger Item", 300, -200, 100, 256, -0.5, 255.5, "Event Phase (ns)", "L1 Trigger Item", scode);
+				m_hEvtPhaseDetPhi_B = bookTProfile_LW(trackShift, "hEvtPhaseDetPhi", "Event Phase vs #phi (2D)" + regionTag, m_nphi_bins, 0, 360, -50, 100., "#phi (deg)", "Event Phase from Tracks per Event", scode);
+				m_hrtRelation_B = bookTH2F_LW(trackShift, "hrtRelation", "R(t) Relation for Xenon Straws" + regionTag, 30, -12.5, 81.25, 50, 0, 2.5, "Measured Leading Edge (ns)", "Track-to-Wire Distance (mm)", scode);
+				m_hNumHoTDetPhi_B = bookTProfile_LW(trackShift, "hNumHoTDetPhi", "Number of Hits per Track with " + distance + " mm Cut vs #phi" + regionTag, m_nphi_bins, 0., 360, 0, 150, "#phi (deg)", Form("Hits per Track, TRT Hits >= %d", m_minTRThits), scode);
+				m_hTronTDist_B = bookTH1F_LW(trackShiftTH1, "hTronTDist", "Trailing Edge Distribution on Track for Xenon Straws" + regionTag, 26, -0.5, 80.75, "Trailing Edge (ns)", "Norm. Entries", scode);
+				m_hDriftTimeonTrkDist_B = bookTH1F_LW(trackShiftTH1, "hDriftTimeonTrkDist", "Drift Time Distribution on Track for Xenon Straws" + regionTag, 32, 0, 100., "Drift Time (ns)", "Norm. Entries", scode);
+				m_hNumTrksDetPhi_B = bookTH1F_LW(trackShift, "hNumTrksDetPhi", "Number of Reconstructed Tracks vs #phi (2D)" + regionTag, 60, 0, 360, "#phi (deg)", "Number of Tracks", scode);
+
+				if (m_ArgonXenonSplitter) {
+					m_hDriftTimeonTrkDist_B_Ar = bookTH1F_LW(trackShiftTH1, "hDriftTimeonTrkDist_Ar", "Drift Time Distribution on Track for Argon Straws" + regionTag, 32, 0, 100., "Drift Time (ns)", "Norm. Entries", scode);
+					m_hTronTDist_B_Ar = bookTH1F_LW(trackShiftTH1, "hTronTDist_Ar", "Trailing Edge Distribution on Track for Argon Straws" + regionTag, 26, -0.5, 80.75, "Trailing Edge (ns)", "Norm. Entries", scode);
+					m_hrtRelation_B_Ar = bookTH2F_LW(trackShift, "hrtRelation_Ar", "R(t) Relation for Argon Straws" + regionTag, 30, -12.5, 81.25, 50, 0, 2.5, "Measured Leading Edge (ns)", "Track-to-Wire Distance (mm)", scode);
+					m_Pull_Biased_Barrel  = bookTH1F_LW(trackShift, "hPull_Biased_Barrel", "Biased Track Pulls for Barrel Hits", 200, -2.5, 2.5, "Pulls", "Entries", scode);
+					m_hResidual_B_Ar = bookTH1F_LW(trackShiftTH1_lowStat, "hResidual_Ar", "Residuals for Argon Straws" + regionTag, 200, -2.5, 2.5, "Hit-to-Track Distance (mm)", "Norm. Entries", scode);
+					m_hResidual_B_Ar_20GeV = bookTH1F_LW(trackShiftTH1, "hResidual_Ar_20GeV", "Residuals for Argon Straws" + regionTag + "(After 20GeV pT cut)", 200, -2.5, 2.5, "Hit-to-Track Distance (mm)", "Norm. Entries", scode);
+					m_hAvgTroTDetPhi_B_Ar = bookTProfile_LW(trackShift, "hAvgTroTDetPhi_Ar", "Avg. Trailing Edge on Track vs #phi (2D) for Argon" + regionTag, m_nphi_bins, 0, 360, 0, 75., "#phi (deg)", "Trailing Edge (ns)", scode);
+					m_hTimeResidual_B_Ar  = bookTH1F_LW(trackShiftTH1, "hTimeResidual_Ar", "Time Residuals for Argon Straws" + regionTag, 200, -20, 20, "Time Residual (ns)", "Norm. Entries", scode);
+					m_hWireToTrkPosition_B_Ar = bookTH1F_LW(trackShiftTH1, "hWireToTrkPosition_Ar", "Track-to-Wire Distance for Argon" + regionTag, 100, -5., 5, "Track-to-Wire Distance (mm)", "Norm. Entries", scode);
+					m_hHtoLRatioOnTrack_B_Ar = bookTH1F_LW(trackShiftTH1, "hHtoLRatioOnTrack_Ar", "HL/LL Ratio per Reconstructed Track for Argon" + regionTag, 50, 0, 1, "HL/LL Ratio", "Norm. Entries", scode); //for argon
+				}
+
+				m_hHtoLRatioOnTrack_B_Xe = bookTH1F_LW(trackShiftTH1, "hHtoLRatioOnTrack_Xe", "HL/LL Ratio per Reconstructed Track for Xenon" + regionTag, 50, 0, 1, "HL/LL Ratio", "Norm. Entries", scode); //for xenon
+				m_hResidual_B = bookTH1F_LW(trackShiftTH1_lowStat, "hResidual", "Residuals for Xenon Straws" + regionTag, 200, -2.5, 2.5, "Hit-to-Track Distance (mm)", "Norm. Entries", scode);
+				m_hResidual_B_20GeV   = bookTH1F_LW(trackShiftTH1, "hResidual_20GeV", "Residuals for Xenon Straws" + regionTag + "(After 20GeV pT cut)", 200, -2.5, 2.5, "Hit-to-Track Distance (mm)", "Norm. Entries", scode);
+				m_hTimeResidual_B = bookTH1F_LW(trackShiftTH1, "hTimeResidual", "Time Residuals for Xenon Straws" + regionTag, 200, -20, 20, "Time Residual (ns)", "Norm. Entries", scode);
+				m_hWireToTrkPosition_B  = bookTH1F_LW(trackShiftTH1, "hWireToTrkPosition", "Track-to-Wire Distance for Xenon" + regionTag, 100, -5., 5, "Track-to-Wire Distance (mm)", "Norm. Entries", scode);
+				m_hNumSwLLWoT_B = bookTH1F_LW(trackShiftTH1, "hNumSwLLWoT", "Number of Straws with Hits on Track in Time Window" + regionTag, 150, 0, 150, "Number of LL Hits per Track", "Norm. Entries", scode);
+				m_hAvgTroTDetPhi_B = bookTProfile_LW(trackShift, "hAvgTroTDetPhi", "Avg. Trailing Edge on Track vs #phi (2D) for Xenon" + regionTag, m_nphi_bins, 0, 360, 0, 75., "#phi (deg)", "Trailing Edge (ns)", scode);
+				m_hNTrksperLB_B = bookTProfile(trackShiftRebinned, "hNTrksperLB", "Avg. Number of Reconstructed Tracks per Event" + regionTag, maxLumiblock, -0.5, maxLumiblock - 0.5, 0, 150.0, "Luminosity Block", "Number of Tracks", scode);
+				CAN_REBIN(m_hNTrksperLB_B);
+				m_hNHitsperLB_B = bookTProfile(trackShiftRebinned, "hNHitsperLB", "Avg. Occupancy" + regionTag, maxLumiblock, -0.5, maxLumiblock - 0.5, 0, 150.0, "Luminosity Block", "Occupancy", scode);
+				CAN_REBIN(m_hNHitsperLB_B);
+				m_hNHLHitsperLB_B = bookTProfile(trackShiftRebinned, "hNHLHitsperLB", "Avg. HL Occupancy" + regionTag, maxLumiblock, -0.5, maxLumiblock - 0.5, 0, 150.0, "Luminosity Block", "Occupancy", scode);
+				CAN_REBIN(m_hNHLHitsperLB_B);
+				m_hHLhitOnTrack_B = bookTH1F_LW(trackShiftTH1, "hHLhitOnTrack", "Number of HL Hits per Reconstructed Track" + regionTag, 50, 0, 50, "Number of HL Hits per Track", "Norm. Entries", scode);
+				m_hHtoLRatioOnTrack_B = bookTH1F_LW(trackShiftTH1, "hHtoLRatioOnTrack", "HL/LL Ratio per Reconstructed Track for All" + regionTag, 50, 0, 1, "HL/LL Ratio", "Norm. Entries", scode);
+				m_hHitWonTMap_B = bookTH1F_LW(trackShiftTH1, "hHitWonTMap", "Leading Edge in Time Window per Reconstructed Track" + regionTag, s_Straw_max[0], 0, s_Straw_max[0], "Straw Number", "Norm. Entries", scode);
+				m_hStrawEffDetPhi_B = bookTProfile_LW(trackShift, "hStrawEffDetPhi", "Straw Efficiency on Track with " + distance + " mm Cut vs #phi(2D)" + regionTag, 32, 0, 32, 0, 1.2, "Stack", "Avg. Straw Efficiency", scode);
+			} else if (ibe == 1) {
+				m_Pull_Biased_EndCap =  bookTH1F_LW(trackShift, "hPull_Biased_EndCap", "Biased Track Pulls for EndCap Hits", 200, -2.5, 2.5, "Pulls", "Entries", scode);
+
+				for (int iside = 0; iside < 2; iside++) {
+					const std::string regionTag = " (" + be_id[ibe] + side_id[iside] + ")";
+					m_hEvtPhaseDetPhi_E[iside] = bookTProfile_LW(trackShift, "hEvtPhaseDetPhi_" + side_id[iside], "Event Phase vs #phi (2D)" + regionTag, m_nphi_bins, 0, 360, -50, 100, "#phi (deg)", "Event Phase from Tracks per Event", scode);
+					m_hrtRelation_E[iside] = bookTH2F_LW(trackShift, "hrtRelation_" + side_id[iside], "R(t) Relation for Xenon Straws" + regionTag, 30, -12.5, 81.25, 50, 0, 2.5, "Measured Leading Edge (ns)", "Track-to-Wire Distance (mm)", scode);
+					m_hNumHoTDetPhi_E[iside] = bookTProfile_LW(trackShift, "hNumHoTDetPhi_" + side_id[iside], "Number of Hits per Track with " + distance + " mm Cut vs #phi" + regionTag, m_nphi_bins, 0., 360, 0, 150, "#phi (deg)", Form("Hits per Track, TRT Hits> = %d", m_minTRThits), scode);
+					m_hTronTDist_E[iside] = bookTH1F_LW(trackShiftTH1, "hTronTDist_" + side_id[iside], "Trailing Edge Distribution on Track for Xenon Straws" + regionTag, 26, -0.5, 80.75,  "Trailing Edge (ns)", "Norm. Entries", scode);
+					m_hDriftTimeonTrkDist_E[iside] = bookTH1F_LW(trackShiftTH1, "hDriftTimeonTrkDist_" + side_id[iside], "Drift Time Distribution on Track for Xenon Straws" + regionTag, 32, 0, 100, "Drift Time (ns)", "Norm. Entries", scode);
+					m_hNumTrksDetPhi_E[iside] = bookTH1F_LW(trackShift, "hNumTrksDetPhi_" + side_id[iside], "Number of Reconstructed Tracks vs #phi (2D)" + regionTag, 60, 0, 360, "#phi (deg)", "Number of Tracks", scode);
+					m_hResidual_E[iside] = bookTH1F_LW(trackShiftTH1_lowStat, "hResidual_" + side_id[iside], "Residuals for Xenon Straws" + regionTag, 200, -2.5, 2.5, "Hit-to-Track Distance (mm)", "Norm. Entries", scode);
+					m_hResidual_E_20GeV[iside] = bookTH1F_LW(trackShiftTH1, "hResidual_" + side_id[iside] + "_20GeV", "Residuals for Xenon Straws" + regionTag + "(After 20GeV pT cut)", 200, -2.5, 2.5, "Hit-to-Track Distance (mm)", "Norm. Entries", scode);
+					m_hTimeResidual_E[iside] = bookTH1F_LW(trackShiftTH1, "hTimeResidual_" + side_id[iside], "Time Residuals for Xenon Straws" + regionTag, 200, -20, 20, "Time Residual (ns)", "Norm. Entries", scode);
+
+					if (m_ArgonXenonSplitter) {
+						m_hTronTDist_E_Ar[iside] = bookTH1F_LW(trackShiftTH1, "hTronTDist_Ar_" + side_id[iside], "Trailing Edge Distribution on Track for Argon Straws" + regionTag, 26, -0.5, 80.75,  "Trailing Edge (ns)", "Norm. Entries", scode);
+						m_hAvgTroTDetPhi_E_Ar[iside] = bookTProfile_LW(trackShift, "hAvgTroTDetPhi_Ar_" + side_id[iside], "Avg. Trailing Edge on Track vs #phi (2D) for Argon" + regionTag, m_nphi_bins, 0, 360, 0, 75., "#phi (deg)", "Trailing Edge (ns)", scode);
+						m_hrtRelation_E_Ar[iside] = bookTH2F_LW(trackShift, "hrtRelation_Ar_" + side_id[iside], "R(t) Relation for Argon Straws" + regionTag, 30, -12.5, 81.25, 50, 0, 2.5, "Measured Leading Edge (ns)", "Track-to-Wire Distance (mm)", scode);
+						m_hDriftTimeonTrkDist_E_Ar[iside] = bookTH1F_LW(trackShiftTH1, "hDriftTimeonTrkDist_Ar_" + side_id[iside], "Drift Time Distribution on Track for Argon Straws" + regionTag, 32, 0, 100, "Drift Time (ns)", "Norm. Entries", scode);
+						m_hResidual_E_Ar[iside] = bookTH1F_LW(trackShiftTH1_lowStat, "hResidual_Ar_" + side_id[iside], "Residuals for Argon Straws" + regionTag, 200, -2.5, 2.5, "Hit-to-Track Distance (mm)", "Norm. Entries", scode);
+						m_hResidual_E_Ar_20GeV[iside] = bookTH1F_LW(trackShiftTH1, "hResidual_Ar_" + side_id[iside] + "_20GeV", "Residuals for Argon Straws" + regionTag + "(After 20GeV pT cut)", 200, -2.5, 2.5, "Hit-to-Track Distance (mm)", "Norm. Entries", scode);
+						m_hTimeResidual_E_Ar[iside] = bookTH1F_LW(trackShiftTH1, "hTimeResidual_Ar_" + side_id[iside], "Time Residuals for Argon Straws" + regionTag, 200, -20, 20, "Time Residual (ns)", "Norm. Entries", scode);
+						m_hWireToTrkPosition_E_Ar[iside] = bookTH1F_LW(trackShiftTH1, "hWireToTrkPosition_Ar_" + side_id[iside], "Track-to-Wire Distance for Argon" + regionTag, 100, -5., 5, "Track-to-Wire Distance (mm)", "Norm. Entries", scode);
+						m_hHtoLRatioOnTrack_E_Ar[iside] = bookTH1F_LW(trackShiftTH1, "hHtoLRatioOnTrack_Ar_" + side_id[iside], "HL/LL Ratio per Reconstructed Track for Argon" + regionTag, 50, 0, 1.0, "HL/LL Ratio", "Norm. Entries", scode);
+					}
+
+					m_hHtoLRatioOnTrack_E_Xe[iside] = bookTH1F_LW(trackShiftTH1, "hHtoLRatioOnTrack_Xe_" + side_id[iside], "HL/LL Ratio per Reconstructed Track for Xenon" + regionTag, 50, 0, 1.0, "HL/LL Ratio", "Norm. Entries", scode);
+					m_hWireToTrkPosition_E[iside] = bookTH1F_LW(trackShiftTH1, "hWireToTrkPosition_" + side_id[iside], "Track-to-Wire Distance for Xenon" + regionTag, 100, -5., 5, "Track-to-Wire Distance (mm)", "Norm. Entries", scode);
+					m_hNumSwLLWoT_E[iside] = bookTH1F_LW(trackShiftTH1, "hNumSwLLWoT_" + side_id[iside], "Number of Straws with Hits on Track in Time Window" + regionTag, 150, 0, 150, "Number of LL Hits per Track", "Norm. Entries", scode);
+					m_hAvgTroTDetPhi_E[iside] = bookTProfile_LW(trackShift, "hAvgTroTDetPhi_" + side_id[iside], "Avg. Trailing Edge on Track vs #phi (2D) for Xenon" + regionTag, m_nphi_bins, 0, 360, 0, 75., "#phi (deg)", "Trailing Edge (ns)", scode);
+					m_hNTrksperLB_E[iside] = bookTProfile(trackShiftRebinned, "hNTrksperLB_" + side_id[iside], "Avg. Number of Reconstructed Tracks per Event" + regionTag, maxLumiblock, -0.5, maxLumiblock - 0.5, 0, 150.0, "Luminosity Block", "Number of Tracks", scode);
+					CAN_REBIN(m_hNTrksperLB_E[iside]);
+					m_hNHitsperLB_E[iside] = bookTProfile(trackShiftRebinned, "hNHitsperLB_" + side_id[iside], "Avg. Occupancy" + regionTag, maxLumiblock, -0.5, maxLumiblock - 0.5, 0, 150.0, "Luminosity Block", "Occupancy", scode);
+					CAN_REBIN(m_hNHitsperLB_E[iside]);
+					m_hNHLHitsperLB_E[iside] = bookTProfile(trackShiftRebinned, "hNHLHitsperLB_" + side_id[iside], "Avg. HL Occupancy" + regionTag, maxLumiblock, -0.5, maxLumiblock - 0.5, 0, 150.0, "Luminosity Block", "Occupancy", scode);
+					CAN_REBIN(m_hNHLHitsperLB_E[iside]);
+					m_hHLhitOnTrack_E[iside] = bookTH1F_LW(trackShiftTH1, "hHLhitOnTrack_" + side_id[iside], "Number of HL Hits per Reconstructed Track" + regionTag, 50, 0, 50, "Number of HL Hits per Track", "Norm. Entries", scode);
+					m_hHtoLRatioOnTrack_E[iside] = bookTH1F_LW(trackShiftTH1, "hHtoLRatioOnTrack_" + side_id[iside], "HL/LL Ratio per Reconstructed Track for All" + regionTag, 50, 0, 1.0, "HL/LL Ratio", "Norm. Entries", scode);
+					m_hHitWonTMap_E[iside] = bookTH1F_LW(trackShiftTH1, "hHitWonTMap_" + side_id[iside], "Leading Edge in Time Window per Reconstructed Track" + regionTag, s_Straw_max[1], 0, s_Straw_max[1], "Straw Number", "Norm. Entries", scode);
+					m_hStrawEffDetPhi_E[iside] = bookTProfile_LW(trackShift, "hStrawEffDetPhi_" + side_id[iside], "Straw Efficiency on Track with " + distance + " mm Cut vs #phi(2D)" + regionTag, 32, 0, 32, 0, 1.2, "Stack", "Avg. Straw Efficiency", scode);
+				}
+			}
+
+			m_hHitsOnTrack_Scatter[ibe] = bookTH2F_LW(trackShift, "m_hHitsOnTrack_Scatter", "Hits per Track in Time Window in Stacks" + regionTag, 1440, -0.5, 1440 - 0.5, 80, 0, 80, "Luminosity Block (mod 1440)", "Number of Hits per Track in Stacks", scode);
+			m_hLLOcc_Scatter[ibe] = bookTH2F_LW(trackShift, "m_hLLOcc_Scatter", "LL Occupancy in Stacks" + regionTag, 1440, -0.5, 1440 - 0.5, 400, 0.0, 1.0, "Luminosity Block (mod 1440)", "LL Occupancy in Stacks", scode);
+			m_hHightoLowRatioOnTrack_Scatter[ibe] = bookTH2F_LW(trackShift, "m_hHightoLowRatioOnTrack_Scatter", "HL/LL Ratio on Track in Stacks" + regionTag, 1440, -0.5, 1440 - 0.5, 40, 0.0, 0.5, "Luminosity Block (mod 1440)", "HL/LL Ratio in Stacks", scode);
+		}
+
+		//Initialize Aging plots
+		if (newLumiBlock && m_doShift) {
+			for (int iL = 0; iL < 5; iL++) {
+				for (int iSide = 0; iSide < 2; iSide++) {
+					if (ibe == 0) {
+						if (iL < 3) {
+							m_trackz_All[iL][iSide] = bookTH1F_LW(trackAging, "trackz_m" + Mod[iL] + "_" + side_id[iSide] + "_All", "Number All Hits side " + side_id[iSide] + " Layer " + Mod[iL], 30, -750., 750., "z [mm]", "Number of Hits", scode);
+							m_trackz_HT[iL][iSide] = bookTH1F_LW(trackAging, "trackz_m" + Mod[iL] + "_" + side_id[iSide] + "_HT", "Number HT Hits side " + side_id[iSide] + " Layer " + Mod[iL], 30, -750., 750., "z [mm]", "Number of HT Hits", scode);
+						}
+
+						if (iL == 3) {
+							m_trackz_All[iL][iSide] = bookTH1F_LW(trackAging, "trackz_m1_" + side_id[iSide] + "_All_" + Mod[iL], "Number All Hits side " + side_id[iSide] + " Layer 1 " + Mod[iL], 30, 0., 725., "z [mm]", "Number of Hits", scode);
+							m_trackz_HT[iL][iSide] = bookTH1F_LW(trackAging, "trackz_m1_" + side_id[iSide] + "_HT_" + Mod[iL], "Number HT Hits side " + side_id[iSide] + " Layer 1 " + Mod[iL], 30, 0., 725., "z [mm]", "Number of HT Hits", scode);
+						}
+
+						if (iL == 4) {
+							m_trackz_All[iL][iSide] = bookTH1F_LW(trackAging, "trackz_m1_" + side_id[iSide] + "_All_" + Mod[iL], "Number All Hits side " + side_id[iSide] + " Layer 1 " + Mod[iL], 30, -725., 0., "z [mm]", "Number of Hits", scode);
+							m_trackz_HT[iL][iSide] = bookTH1F_LW(trackAging, "trackz_m1_" + side_id[iSide] + "_HT_" + Mod[iL], "Number HT Hits side " + side_id[iSide] + " Layer 1 " + Mod[iL], 30, -725., 0., "z [mm]", "Number of HT Hits", scode);
+						}
+					} else if (ibe == 1) {
+						// prevent double booking of histograms here
+						if (iL < 4) {
+							m_trackr_All[iL][iSide] = bookTH1F_LW(trackAging, "trackr_E" + side_id[iSide] + "_" + gas[iL] + "_All", "Number All Hits E" + side_id[iSide] + " " + gas[iL], 30, 644., 1004., "r [mm]", "Number of Hits", scode);
+							m_trackr_HT[iL][iSide] = bookTH1F_LW(trackAging, "trackr_E" + side_id[iSide] + "_" + gas[iL] + "_HT", "Number HT Hits E" + side_id[iSide] + " " + gas[iL], 30, 644., 1004., "r [mm]", "Number of HT Hits", scode);
+						}
+					}
+				}
+			}
+		}
+	}
+
+	return scode;
 }
 
 //----------------------------------------------------------------------------------//
-StatusCode TRT_Monitoring_Tool::fillHistograms()
+StatusCode TRT_Monitoring_Tool::fillHistograms() {
 //----------------------------------------------------------------------------------//
-{
-  ATH_MSG_VERBOSE("Monitoring Histograms being filled");
-  StatusCode sc;
-
-  m_initScaleVectors(); //a fix for  hitW
-
-  const EventInfo* eventInfo0;
-  sc = evtStore()->retrieve(eventInfo0);
-  if (m_doRDOsMon) {
-    sc = Retrieve_TRT_RDOs();
-    if (sc == StatusCode::FAILURE) return sc;
-
-    sc = CheckEventBurst();
-    if (sc == StatusCode::FAILURE) return sc;
-    if (passEventBurst) {
-      nEvents++;//counts N of events.this value used in summary histogram
-      evtLumiBlock++;//counts number of events in the current lumi block.It is initialized to zero at the end of each lumi block
-      sc = Fill_TRT_RDOs();
-      if (sc == StatusCode::FAILURE) return sc;
-    }
-  } else {
-    nEvents++;
-    passEventBurst = true;
-    evtLumiBlock++;
-  }
-
-  if (m_doTracksMon) {
-    sc = Retrieve_TRT_Tracks();
-    if (sc == StatusCode::FAILURE) return sc;
-    if (passEventBurst) sc = Fill_TRT_Tracks();
-    if (sc == StatusCode::FAILURE) return sc;
-  }
-
-  if (DoEfficiency) {
-    sc = Fill_TRT_Efficiency();
-    if (sc == StatusCode::FAILURE) return sc;
-  }
-
-  if (true){
-    if (!m_doTracksMon) {//to run HT histograms independent of m_doTracksMon flag
-      sc = Retrieve_TRT_Tracks();
-      if (sc == StatusCode::FAILURE) return sc;
-    }//if (!m_doTracksMon)
-    if (passEventBurst) sc = Fill_TRT_HT();
-    if (sc == StatusCode::FAILURE) return sc;
-  }
-
-  return StatusCode::SUCCESS;
-}//fillHistograms()
+	ATH_MSG_VERBOSE("Monitoring Histograms being filled");
+
+	// Retrieve containers/objects only once per event
+	// Dereference handles to pass them to methods
+	SG::ReadHandle<TRT_RDO_Container>   rdoContainer(m_rdoContainerKey);
+	SG::ReadHandle<TrackCollection>     trackCollection(m_trackCollectionKey);
+	SG::ReadHandle<TrackCollection>     combTrackCollection(m_combTrackCollectionKey);
+	SG::ReadHandle<xAOD::EventInfo>     xAODEventInfo(m_xAODEventInfoKey);
+	SG::ReadHandle<InDetTimeCollection> trtBCIDCollection(m_TRT_BCIDCollectionKey);
+	SG::ReadHandle<ComTime>             comTimeObject(m_comTimeObjectKey);
+	SG::ReadHandle<xAOD::TrigDecision>  trigDecision(m_trigDecisionKey);
+
+	if (!xAODEventInfo.isValid()) {
+		ATH_MSG_ERROR("Could not find event info object " << m_xAODEventInfoKey.key() <<
+		              " in store");
+		return StatusCode::FAILURE;
+	}
+
+	if (m_doRDOsMon) {
+		if (!rdoContainer.isValid()) {
+			ATH_MSG_ERROR("Could not find TRT Raw Data Object " << m_rdoContainerKey.key() <<
+			              " in store");
+			return StatusCode::FAILURE;
+		}
+
+		ATH_CHECK( checkEventBurst(*rdoContainer) );
+
+		if (m_passEventBurst) {
+			m_totalEvents++;
+			m_evtLumiBlock++;
+			if (!trtBCIDCollection.isValid()) {
+				ATH_MSG_INFO("Could not find BCID collection " << m_TRT_BCIDCollectionKey.key() <<
+				             " in store");
+			}
+
+			ATH_CHECK( fillTRTRDOs(*rdoContainer, *xAODEventInfo, trtBCIDCollection.ptr()) );
+		}
+	} else {
+		m_totalEvents++;
+		m_passEventBurst = true;
+		m_evtLumiBlock++;
+	}
+
+	if (m_doTracksMon) {
+		if (!trackCollection.isValid()) {
+			ATH_MSG_ERROR("Could not find track collection " << m_trackCollectionKey.key() <<
+			              " in store");
+			return StatusCode::FAILURE;
+		}
+		if (!trigDecision.isValid()) {
+			ATH_MSG_INFO("Could not find trigger decision object " << m_trigDecisionKey.key() <<
+			              " in store");
+		}
+		// NOTE: failing to retrieve ComTime from store for some reason
+		if (!comTimeObject.isValid()) {
+			ATH_MSG_INFO("Could not find com time object " << m_comTimeObjectKey.key() <<
+			             " in store");
+		}
+		if (m_passEventBurst) {
+			ATH_CHECK( fillTRTTracks(*trackCollection, trigDecision.ptr(), comTimeObject.ptr()) );
+		}
+	}
+
+	if (m_doEfficiency) {
+		if (!combTrackCollection.isValid()) {
+			ATH_MSG_ERROR("Could not find track collection " << m_combTrackCollectionKey.key() <<
+			              " in store");
+			return StatusCode::FAILURE;
+		}
+
+		ATH_CHECK( fillTRTEfficiency(*combTrackCollection) );
+	}
+
+	if (!m_doTracksMon) {
+		if (!trackCollection.isValid()) {
+			ATH_MSG_ERROR("Could not find track collection " << m_trackCollectionKey.key() <<
+			              " in store");
+			return StatusCode::FAILURE;
+		}
+	}
+
+	if (m_passEventBurst) {
+		ATH_CHECK( fillTRTHighThreshold(*trackCollection, *xAODEventInfo) );
+	}
+
+	return StatusCode::SUCCESS;
+}
 
 // Process all of the Histrograms.  ie divide, multiply..etc and write them to file.
 //----------------------------------------------------------------------------------//
-StatusCode TRT_Monitoring_Tool::procHistograms()
+StatusCode TRT_Monitoring_Tool::procHistograms() {
 //----------------------------------------------------------------------------------//
-{
-  double n_BorE[2][2], total_BorE[2][2];
-  double nfill[2]={3.0, 2.0};  // [0]:barrel, [1]:endcap
-  //proccesing of online histograms
-  if (m_environment != AthenaMonManager::online) {
-    if (DoShift) {
-      if (m_doRDOsMon) {
-        m_hSummary->SetBinContent(1,nEvents);
-        if (m_doTracksMon) {
-          m_hSummary->SetBinContent(2,m_nTotalTracks);
-          m_hSummary->SetBinContent(3,m_nTracksB[0]);
-          m_hSummary->SetBinContent(4,m_nTracksB[1]);
-          m_hSummary->SetBinContent(5,m_nTracksEC[0]);
-          m_hSummary->SetBinContent(6,m_nTracksEC[1]);
-          m_hSummary->SetBinContent(7,m_nTracksEC_B[0]);
-          m_hSummary->SetBinContent(8,m_nTracksEC_B[1]);
-        }//dotracks
-      }//do rdos
-    }//DoShift
-
-    if (nEvents<m_nEvents || m_nEvents<0)
-      m_nEvents = nEvents;
-
-    for (int ibe=0; ibe<2; ibe++) { //ibe=0(barrel), ibe=1(endcap)
-      //Loop over stack histograms and normalize to number of events processed.
-      if (DoChips && DoExpert && endOfRunFlag()) {
-        for (int i=0; i<64; i++) {
-          if (m_doTracksMon && DoExpert) {
-            divide_LWHist(m_hHitOnTrackVsAllC[ibe][i], m_hHitAonTMapC[ibe][i], m_hHitAMapC[ibe][i]);
-          }
-          if (m_doRDOsMon) {
-            float scale = (float)m_nEvents*16;
-            if (scale > 0) {
-              scale = 1./scale;
-              scale_LWHist(m_hHitHWMapC[ibe][i], scale);
-              scale_LWHist(m_hHitWMapC[ibe][i],  scale);
-              scale_LWHist(m_hHitAMapC[ibe][i],  scale);
-              scale_LWHist(m_hHitAWMapC[ibe][i], scale);
-              scale_LWHist(m_hHitHMapC[ibe][i],  scale);
-            }
-          }//doRDOsMon
-
-          for (int j=0; j<s_iChip_max[ibe]; j++) {
-            if (m_doRDOsMon) m_hChipOcc[ibe][i]->Fill(m_hHitAMapC[ibe][i]->GetBinContent(j+1));
-            if (m_doTracksMon) {
-              float scale = m_hChipsEff[ibe][i]->GetBinEntries(j+1);
-              if (scale > 0) {
-                m_hHitAonTMapC[ibe][i]->SetBinContent(j+1, m_hHitAonTMapC[ibe][i]->GetBinContent(j+1)/scale);
-                m_hHitWonTMapC[ibe][i]->SetBinContent(j+1, m_hHitWonTMapC[ibe][i]->GetBinContent(j+1)/scale);
-                m_hHitAWonTMapC[ibe][i]->SetBinContent(j+1, m_hHitAWonTMapC[ibe][i]->GetBinContent(j+1)/scale);
-                m_hHitHonTMapC[ibe][i]->SetBinContent(j+1, m_hHitHonTMapC[ibe][i]->GetBinContent(j+1)/scale);
-                m_hHitHWonTMapC[ibe][i]->SetBinContent(j+1, m_hHitHWonTMapC[ibe][i]->GetBinContent(j+1)/scale);
-              } else {
-                m_hHitAonTMapC[ibe][i]->SetBinContent(j+1, 0);
-                m_hHitWonTMapC[ibe][i]->SetBinContent(j+1, 0);
-                m_hHitAWonTMapC[ibe][i]->SetBinContent(j+1, 0);
-                m_hHitHonTMapC[ibe][i]->SetBinContent(j+1, 0);
-                m_hHitHWonTMapC[ibe][i]->SetBinContent(j+1, 0);
-              }
-            }//doTracksMon
-          }// for (int j=0; j<s_iChip_max[ibe]; j++)
-
-          if (m_doRDOsMon && DoExpert) {
-            divide_LWHist(m_hHtoLMapC[ibe][i],   m_hHitHMapC[ibe][i],   m_hHitAMapC[ibe][i]);
-          }
-          if (m_doTracksMon && DoExpert) {
-            divide_LWHist(m_hHtoLonTMapC[ibe][i],m_hHitHonTMapC[ibe][i], m_hHitAonTMapC[ibe][i]);
-	    divide_LWHist(m_hHtoLWonTMapC[ibe][i],m_hHitHWonTMapC[ibe][i], m_hHitAWonTMapC[ibe][i]);
-	    
-          }
-        }//Loop over A side and C side Stacks: for (int i=0; i<64; i++)
-      }//if DoChips && DoExpert && endOfRun
-      
-      if (DoStraws && endOfRunFlag()) {
-        if (m_doRDOsMon && m_nEvents > 0) {
-          if (ibe==0) {
-	    //fix for leading edge in time window probability vs straw number(Barrel) histograms
-	    //
-	    m_initScaleVectors();
-	    vector<float> scalevector;
-	    vector<float> scalevector_Ar;
-	    for(int k =0;k<s_Straw_max[0];k++){
-	      try {
-		if (m_scale_hHitWMap_B.at(k)==0.)
-		  scalevector.push_back(0.);
-		else
-		  scalevector.push_back(1./(m_nEvents*m_scale_hHitWMap_B.at(k)));
-		//for argon
-		if (m_scale_hHitWMap_B_Ar.at(k)==0.)
-		  scalevector_Ar.push_back(0.);
-		else
-		  scalevector_Ar.push_back(1./(m_nEvents*m_scale_hHitWMap_B_Ar.at(k)));
-	      } catch (out_of_range& e) {
-		ATH_MSG_ERROR("Index " << k << " out of range in scaling for hHitWMap");
-	      }
-	    }//for(int k =0;k<s_Straw_max[0];k++){
-	    //now we have scaling arrays for hHitWMap_B*
-            scale_LWHistWithScaleVector(m_hHitWMap_B, scalevector);
-            if (m_ArgonXenonSplitter) {
-              scale_LWHistWithScaleVector(m_hHitWMap_B_Ar, scalevector_Ar);
-            }
-          } else if (ibe==1) {
-            scale_LWHist(m_hHitWMap_E[0], 1. / (m_nEvents * 32));
-            scale_LWHist(m_hHitWMap_E[1], 1. / (m_nEvents * 32));
-            if (m_ArgonXenonSplitter) {
-              scale_LWHist(m_hHitWMap_E_Ar[0], 1. / (m_nEvents * 32));
-              scale_LWHist(m_hHitWMap_E_Ar[1], 1. / (m_nEvents * 32));
-            }
-          }
-        }// doRDOsMon and m_nevents > 0
-        for (int i=0; i<64; i++) {
-          if (m_doTracksMon && DoExpert) {
-            divide_LWHist(m_hHitOnTrackVsAllS[ibe][i], m_hHitAonTMapS[ibe][i], m_hHitAMapS[ibe][i]);
-          }
-          if (m_doRDOsMon && DoExpert && m_nEvents > 0) {
-            float scale = 1./m_nEvents;
-            scale_LWHist(m_hHitHWMapS[ibe][i], scale);
-            scale_LWHist(m_hHitWMapS[ibe][i], scale);
-            scale_LWHist(m_hHitAMapS[ibe][i], scale);
-            scale_LWHist(m_hHitAWMapS[ibe][i], scale);
-            scale_LWHist(m_hHitHMapS[ibe][i], scale);
-          }// doRDOsMon && doExpert && m_nEvents > 0
-
-          for (int j=0; j<s_Straw_max[ibe]; j++) {
-            if (m_doRDOsMon) {
-              if (DoExpert) {
-                //No normalization done (just fill occupancy distribution)
-                m_hStrawOcc[ibe][i]->Fill(m_hHitAMapS[ibe][i]->GetBinContent(j+1));
-              }//do expert
-            }//doRDOsMon
-            if (m_doTracksMon) {
-              if (i==0) {
-                if (ibe==0) {
-                  if (m_nStrawHits_B[j]>0) m_hHitWonTMap_B->SetBinContent(j+1, m_hHitWonTMap_B->GetBinContent(j+1)/((Float_t)m_nStrawHits_B[j]));
-                } else if (ibe==1) {
-                  if (m_nStrawHits_E[0][j]>0) m_hHitWonTMap_E[0]->SetBinContent(j+1,(float)m_hHitWonTMap_E[0]->GetBinContent(j+1)/(m_nStrawHits_E[0][j]));
-                  if (m_nStrawHits_E[1][j]>0) m_hHitWonTMap_E[1]->SetBinContent(j+1,(float)m_hHitWonTMap_E[1]->GetBinContent(j+1)/(m_nStrawHits_E[1][j]));
-                }
-              }
-              if (DoExpert) {
-                float scale = m_hStrawsEff[ibe][i]->GetBinEntries(j+1);
-                if (scale > 0 && m_hStrawsEff[ibe][i]->GetBinEntries(j+1) > 0) {
-                  scale = 1./scale;
-                  m_hHitAWonTMapS[ibe][i]->SetBinContent(j+1, m_hHitAWonTMapS[ibe][i]->GetBinContent(j+1)*scale);
-                  m_hHitAonTMapS[ibe][i]->SetBinContent(j+1, m_hHitAonTMapS[ibe][i]->GetBinContent(j+1)*scale);
-                  m_hHitHonTMapS[ibe][i]->SetBinContent(j+1, m_hHitHonTMapS[ibe][i]->GetBinContent(j+1)*scale);
-                  m_hHitWonTMapS[ibe][i]->SetBinContent(j+1, m_hHitWonTMapS[ibe][i]->GetBinContent(j+1)*scale);
-                } else {
-                  m_hHitAWonTMapS[ibe][i]->SetBinContent(j+1, 0);
-                  m_hHitAonTMapS[ibe][i]->SetBinContent(j+1, 0);
-                  m_hHitHonTMapS[ibe][i]->SetBinContent(j+1, 0);
-                  m_hHitWonTMapS[ibe][i]->SetBinContent(j+1, 0);
-                }
-              } //DoExpert
-            }//doTracksMon
-          } //for (int j=0; j<s_Straw_max[ibe]; j++)
-
-          if (m_doRDOsMon && DoExpert) divide_LWHist(m_hHtoLMapS[ibe][i],m_hHitHMapS[ibe][i], m_hHitAMapS[ibe][i]);
-          if (m_doTracksMon && DoExpert) {
-	    divide_LWHist(m_hHtoLonTMapS[ibe][i],m_hHitHonTMapS[ibe][i], m_hHitAonTMapS[ibe][i]);
-	    divide_LWHist(m_hHtoLWonTMapS[ibe][i],m_hHitHWonTMapS[ibe][i], m_hHitAWonTMapS[ibe][i]);
-	  }
-        }//Loop over A side and C side Stacks: for (int i=0; i<64; i++)
-      }//if DoStraws && endOfRun
-
-      if (DoShift && endOfRunFlag()) {
-        if (m_doTracksMon) {
-          if (ibe==0) { //barrel
-            EventPhaseScale = m_hEvtPhase->GetEntries()*3.125;
-            if (EventPhaseScale > 0) {
-              scale_LWHist(m_hEvtPhase, 1./EventPhaseScale);
-            }
-            DriftTimeonTrkDistScale_B = m_hDriftTimeonTrkDist_B->GetEntries()*3.125;
-            if (DriftTimeonTrkDistScale_B > 0) {
-              scale_LWHist(m_hDriftTimeonTrkDist_B, 1./DriftTimeonTrkDistScale_B);
-            }
-            HLhitOnTrackScale_B = m_hHLhitOnTrack_B->GetEntries();
-            if (HLhitOnTrackScale_B > 0) {
-              scale_LWHist(m_hHLhitOnTrack_B,1./HLhitOnTrackScale_B);
-            }
-            HtoLRatioOnTrackScale_B = m_hHtoLRatioOnTrack_B->GetEntries()*0.02;
-            if (HtoLRatioOnTrackScale_B > 0) {
-              scale_LWHist(m_hHtoLRatioOnTrack_B, 1./HtoLRatioOnTrackScale_B);
-            }
-            NumSwLLWoTScale_B=m_hNumSwLLWoT_B->GetEntries();
-            if (NumSwLLWoTScale_B > 0) {
-              scale_LWHist(m_hNumSwLLWoT_B, 1./NumSwLLWoTScale_B);
-            }
-            WireToTrkPositionScale_B=m_hWireToTrkPosition_B->GetEntries()*0.1;
-            if (WireToTrkPositionScale_B > 0) {
-              scale_LWHist(m_hWireToTrkPosition_B, 1./WireToTrkPositionScale_B);
-            }
-            TronTDistScale_B=m_hTronTDist_B->GetEntries()*3.125;
-            if (TronTDistScale_B > 0) {
-              scale_LWHist(m_hTronTDist_B ,1./TronTDistScale_B);
-            }
-            ResidualScale_B = m_hResidual_B->GetEntries()*0.025;
-            if (ResidualScale_B > 0) {
-              scale_LWHist(m_hResidual_B, 1./ResidualScale_B);
-            }
-            ResidualScale_B_20GeV = m_hResidual_B_20GeV->GetEntries()*0.025;
-            if (ResidualScale_B_20GeV > 0) {
-              scale_LWHist(m_hResidual_B_20GeV, 1./ResidualScale_B_20GeV);
-            }
-            TimeResidualScale_B = m_hTimeResidual_B->GetEntries()*0.2;
-            if (TimeResidualScale_B > 0) {
-              scale_LWHist(m_hTimeResidual_B, 1./TimeResidualScale_B);
-            }
-            if (m_ArgonXenonSplitter) {
-              DriftTimeonTrkDistScale_B_Ar = m_hDriftTimeonTrkDist_B_Ar->GetEntries()*3.125;
-              if (DriftTimeonTrkDistScale_B_Ar > 0) {
-                scale_LWHist(m_hDriftTimeonTrkDist_B_Ar, 1./DriftTimeonTrkDistScale_B_Ar);
-              }
-	      WireToTrkPositionScale_B_Ar=m_hWireToTrkPosition_B_Ar->GetEntries()*0.1; 
-	      if (WireToTrkPositionScale_B_Ar > 0) {
-		scale_LWHist(m_hWireToTrkPosition_B_Ar, 1./WireToTrkPositionScale_B_Ar);
-	      }
-	      HtoLRatioOnTrackScale_B_Ar = m_hHtoLRatioOnTrack_B_Ar->GetEntries()*0.02; //for argon
-	      if (HtoLRatioOnTrackScale_B_Ar > 0) {
-		scale_LWHist(m_hHtoLRatioOnTrack_B_Ar, 1./HtoLRatioOnTrackScale_B_Ar);
-	      }
-              TronTDistScale_B_Ar=m_hTronTDist_B_Ar->GetEntries()*3.125;
-              if (TronTDistScale_B_Ar > 0) {
-                scale_LWHist(m_hTronTDist_B_Ar ,1./TronTDistScale_B_Ar);
-              }
-              ResidualScale_B_Ar = m_hResidual_B_Ar->GetEntries()*0.025;
-              if (ResidualScale_B_Ar > 0) {
-                scale_LWHist(m_hResidual_B_Ar, 1. / ResidualScale_B_Ar);
-              }
-              ResidualScale_B_Ar_20GeV = m_hResidual_B_Ar_20GeV->GetEntries()*0.025;
-              if (ResidualScale_B_Ar_20GeV > 0) {
-                scale_LWHist(m_hResidual_B_Ar_20GeV, 1. / ResidualScale_B_Ar_20GeV);
-              }
-              TimeResidualScale_B_Ar = m_hTimeResidual_B_Ar->GetEntries()*0.2;
-              if (TimeResidualScale_B_Ar > 0) {
-                scale_LWHist(m_hTimeResidual_B_Ar, 1. / TimeResidualScale_B_Ar);
-              }
-            }
-	    HtoLRatioOnTrackScale_B_Xe = m_hHtoLRatioOnTrack_B_Xe->GetEntries()*0.02; 
-	    if (HtoLRatioOnTrackScale_B_Xe > 0) {
-	      scale_LWHist(m_hHtoLRatioOnTrack_B_Xe, 1./HtoLRatioOnTrackScale_B_Xe);
-	    }
-          } else if (ibe==1) { //endcap
-            for (int iside=0; iside<2; iside++) {
-              DriftTimeonTrkDistScale_E[iside] = m_hDriftTimeonTrkDist_E[iside]->GetEntries()*3.125;
-              if (DriftTimeonTrkDistScale_E[iside] > 0) {
-                scale_LWHist(m_hDriftTimeonTrkDist_E[iside], 1./DriftTimeonTrkDistScale_E[iside]);
-              }
-              HLhitOnTrackScale_E[iside] = m_hHLhitOnTrack_E[iside]->GetEntries();
-              if (HLhitOnTrackScale_E[iside] > 0) {
-                scale_LWHist(m_hHLhitOnTrack_E[iside], 1./HLhitOnTrackScale_E[iside]);
-              }
-              HtoLRatioOnTrackScale_E[iside] = m_hHtoLRatioOnTrack_E[iside]->GetEntries()*0.02;
-              if (HtoLRatioOnTrackScale_E[iside] > 0) {
-                scale_LWHist(m_hHtoLRatioOnTrack_E[iside], 1./HtoLRatioOnTrackScale_E[iside]);
-              }
-              NumSwLLWoTScale_E[iside] = m_hNumSwLLWoT_E[iside]->GetEntries();
-              if (NumSwLLWoTScale_E[iside] > 0) {
-                scale_LWHist(m_hNumSwLLWoT_E[iside], 1./NumSwLLWoTScale_E[iside]);
-              }
-              WireToTrkPositionScale_E[iside] = m_hWireToTrkPosition_E[iside]->GetEntries()*0.1;
-              if (WireToTrkPositionScale_E[iside] > 0) {
-                scale_LWHist(m_hWireToTrkPosition_E[iside], 1./WireToTrkPositionScale_E[iside]);
-              }
-              TronTDistScale_E[iside] = m_hTronTDist_E[iside]->GetEntries()*3.125;
-              if (TronTDistScale_E[iside] > 0) {
-                scale_LWHist(m_hTronTDist_E[iside], 1./TronTDistScale_E[iside]);
-              }
-              ResidualScale_E[iside] = m_hResidual_E[iside]->GetEntries()*0.025;
-              if (ResidualScale_E[iside] > 0) {
-                scale_LWHist(m_hResidual_E[iside], 1./ResidualScale_E[iside]);
-              }
-              ResidualScale_E_20GeV[iside] = m_hResidual_E_20GeV[iside]->GetEntries()*0.025;
-              if (ResidualScale_E_20GeV[iside] > 0) {
-                scale_LWHist(m_hResidual_E_20GeV[iside], 1./ResidualScale_E_20GeV[iside]);
-              }
-              TimeResidualScale_E[iside] = m_hTimeResidual_E[iside]->GetEntries()*0.2;
-              if (TimeResidualScale_E[iside] > 0) {
-                scale_LWHist(m_hTimeResidual_E[iside], 1./TimeResidualScale_E[iside]);
-              }
-	      HtoLRatioOnTrackScale_E_Xe[iside] = m_hHtoLRatioOnTrack_E_Xe[iside]->GetEntries()*0.02; //for xenon
-	      if (HtoLRatioOnTrackScale_E_Xe[iside] > 0) {
-		scale_LWHist(m_hHtoLRatioOnTrack_E_Xe[iside], 1./HtoLRatioOnTrackScale_E_Xe[iside]);
-	      }
-              if (m_ArgonXenonSplitter) {
-                DriftTimeonTrkDistScale_E_Ar[iside] = m_hDriftTimeonTrkDist_E_Ar[iside]->GetEntries()*3.125;
-                if (DriftTimeonTrkDistScale_E_Ar[iside] > 0) {
-                  scale_LWHist(m_hDriftTimeonTrkDist_E_Ar[iside], 1./DriftTimeonTrkDistScale_E_Ar[iside]);
-                }
-		WireToTrkPositionScale_E_Ar[iside] = m_hWireToTrkPosition_E_Ar[iside]->GetEntries()*0.1; 
-		if (WireToTrkPositionScale_E_Ar[iside] > 0) {
-		  scale_LWHist(m_hWireToTrkPosition_E_Ar[iside], 1./WireToTrkPositionScale_E_Ar[iside]);
+	double n_BorE[2][2], total_BorE[2][2];
+	double nfill[2] = {3.0, 2.0};  // [0]:barrel, [1]:endcap
+
+	//proccesing of online histograms
+	if (m_environment != AthenaMonManager::online) {
+		if (m_doShift && m_doRDOsMon) {
+			m_hSummary->SetBinContent(1, m_totalEvents);
+
+			if (m_doTracksMon) {
+				m_hSummary->SetBinContent(2, m_nTotalTracks);
+				m_hSummary->SetBinContent(3, m_nTracksB[0]);
+				m_hSummary->SetBinContent(4, m_nTracksB[1]);
+				m_hSummary->SetBinContent(5, m_nTracksEC[0]);
+				m_hSummary->SetBinContent(6, m_nTracksEC[1]);
+				m_hSummary->SetBinContent(7, m_nTracksEC_B[0]);
+				m_hSummary->SetBinContent(8, m_nTracksEC_B[1]);
+			}
+		}
+
+		if (m_totalEvents < m_usedEvents || m_usedEvents < 0) {
+			m_usedEvents = m_totalEvents;
+		}
+
+		// ibe = 0 (Barrel), ibe = 1 (Endcap)
+		for (int ibe = 0; ibe < 2; ibe++) {
+			//Loop over stack histograms and normalize to number of events processed.
+			if (m_doChips && m_doExpert && endOfRunFlag()) {
+				for (int i = 0; i < 64; i++) {
+					if (m_doTracksMon && m_doExpert) {
+						divide_LWHist(m_hHitOnTrackVsAllC[ibe][i], m_hHitAonTMapC[ibe][i], m_hHitAMapC[ibe][i]);
+					}
+
+					if (m_doRDOsMon) {
+						float scale = (float)m_usedEvents * 16;
+
+						if (scale > 0) {
+							scale = 1. / scale;
+							scale_LWHist(m_hHitHWMapC[ibe][i], scale);
+							scale_LWHist(m_hHitWMapC[ibe][i], scale);
+							scale_LWHist(m_hHitAMapC[ibe][i], scale);
+							scale_LWHist(m_hHitAWMapC[ibe][i], scale);
+							scale_LWHist(m_hHitHMapC[ibe][i], scale);
+						}
+					}
+
+					for (int j = 0; j < s_iChip_max[ibe]; j++) {
+						if (m_doRDOsMon) m_hChipOcc[ibe][i]->Fill(m_hHitAMapC[ibe][i]->GetBinContent(j + 1));
+
+						if (m_doTracksMon) {
+							float scale = m_hChipsEff[ibe][i]->GetBinEntries(j + 1);
+
+							if (scale > 0) {
+								scale = 1. / scale;
+								m_hHitAonTMapC[ibe][i]->SetBinContent(j + 1, m_hHitAonTMapC[ibe][i]->GetBinContent(j + 1) * scale);
+								m_hHitWonTMapC[ibe][i]->SetBinContent(j + 1, m_hHitWonTMapC[ibe][i]->GetBinContent(j + 1) * scale);
+								m_hHitAWonTMapC[ibe][i]->SetBinContent(j + 1, m_hHitAWonTMapC[ibe][i]->GetBinContent(j + 1) * scale);
+								m_hHitHonTMapC[ibe][i]->SetBinContent(j + 1, m_hHitHonTMapC[ibe][i]->GetBinContent(j + 1) * scale);
+								m_hHitHWonTMapC[ibe][i]->SetBinContent(j + 1, m_hHitHWonTMapC[ibe][i]->GetBinContent(j + 1) * scale);
+							} else {
+								m_hHitAonTMapC[ibe][i]->SetBinContent(j + 1, 0);
+								m_hHitWonTMapC[ibe][i]->SetBinContent(j + 1, 0);
+								m_hHitAWonTMapC[ibe][i]->SetBinContent(j + 1, 0);
+								m_hHitHonTMapC[ibe][i]->SetBinContent(j + 1, 0);
+								m_hHitHWonTMapC[ibe][i]->SetBinContent(j + 1, 0);
+							}
+						}
+					}
+
+					if (m_doRDOsMon && m_doExpert) {
+						divide_LWHist(m_hHtoLMapC[ibe][i], m_hHitHMapC[ibe][i], m_hHitAMapC[ibe][i]);
+					}
+
+					if (m_doTracksMon && m_doExpert) {
+						divide_LWHist(m_hHtoLonTMapC[ibe][i], m_hHitHonTMapC[ibe][i], m_hHitAonTMapC[ibe][i]);
+						divide_LWHist(m_hHtoLWonTMapC[ibe][i], m_hHitHWonTMapC[ibe][i], m_hHitAWonTMapC[ibe][i]);
+					}
+				}
+			}
+
+			if (m_doStraws && endOfRunFlag()) {
+				if (m_doRDOsMon && m_usedEvents > 0) {
+					if (ibe == 0) {
+						//fix for leading edge in time window probability vs straw number(Barrel) histograms
+						initScaleVectors();
+						vector<float> scalevector;
+						vector<float> scalevector_Ar;
+
+						for (int k = 0; k < s_Straw_max[0]; k++) {
+							try {
+								if (m_scale_hHitWMap_B.at(k) == 0.) {
+									scalevector.push_back(0.);
+								} else {
+									scalevector.push_back(1. / (m_usedEvents * m_scale_hHitWMap_B.at(k)));
+								}
+
+								if (m_scale_hHitWMap_B_Ar.at(k) == 0.) {
+									scalevector_Ar.push_back(0.);
+								} else {
+									scalevector_Ar.push_back(1. / (m_usedEvents * m_scale_hHitWMap_B_Ar.at(k)));
+								}
+							} catch (out_of_range &e) {
+								ATH_MSG_ERROR("Index " << k << " out of range in scaling for hHitWMap");
+							}
+						}
+
+						scale_LWHistWithScaleVector(m_hHitWMap_B, scalevector);
+
+						if (m_ArgonXenonSplitter) {
+							scale_LWHistWithScaleVector(m_hHitWMap_B_Ar, scalevector_Ar);
+						}
+					} else if (ibe == 1) {
+						float eventScale = 1. / (m_usedEvents * 32);
+						scale_LWHist(m_hHitWMap_E[0], eventScale);
+						scale_LWHist(m_hHitWMap_E[1], eventScale);
+
+						if (m_ArgonXenonSplitter) {
+							scale_LWHist(m_hHitWMap_E_Ar[0], eventScale);
+							scale_LWHist(m_hHitWMap_E_Ar[1], eventScale);
+						}
+					}
+				}
+
+				for (int i = 0; i < 64; i++) {
+					if (m_doTracksMon && m_doExpert) {
+						divide_LWHist(m_hHitOnTrackVsAllS[ibe][i], m_hHitAonTMapS[ibe][i], m_hHitAMapS[ibe][i]);
+					}
+
+					if (m_doRDOsMon && m_doExpert && m_usedEvents > 0) {
+						float scale = 1. / m_usedEvents;
+						scale_LWHist(m_hHitHWMapS[ibe][i], scale);
+						scale_LWHist(m_hHitWMapS[ibe][i], scale);
+						scale_LWHist(m_hHitAMapS[ibe][i], scale);
+						scale_LWHist(m_hHitAWMapS[ibe][i], scale);
+						scale_LWHist(m_hHitHMapS[ibe][i], scale);
+					}
+
+					for (int j = 0; j < s_Straw_max[ibe]; j++) {
+						if (m_doRDOsMon) {
+							if (m_doExpert) {
+								m_hStrawOcc[ibe][i]->Fill(m_hHitAMapS[ibe][i]->GetBinContent(j + 1));
+							}
+						}
+
+						if (m_doTracksMon) {
+							if (i == 0) {
+								if (ibe == 0) {
+									if (m_nStrawHits_B[j] > 0) {
+										m_hHitWonTMap_B->SetBinContent(j + 1, m_hHitWonTMap_B->GetBinContent(j + 1) / ((Float_t)m_nStrawHits_B[j]));
+									}
+								} else if (ibe == 1) {
+									if (m_nStrawHits_E[0][j] > 0) {
+										m_hHitWonTMap_E[0]->SetBinContent(j + 1, (float)m_hHitWonTMap_E[0]->GetBinContent(j + 1) / (m_nStrawHits_E[0][j]));
+									}
+
+									if (m_nStrawHits_E[1][j] > 0) {
+										m_hHitWonTMap_E[1]->SetBinContent(j + 1, (float)m_hHitWonTMap_E[1]->GetBinContent(j + 1) / (m_nStrawHits_E[1][j]));
+									}
+								}
+							}
+
+							if (m_doExpert) {
+								float scale = m_hStrawsEff[ibe][i]->GetBinEntries(j + 1);
+
+								if (scale > 0 && m_hStrawsEff[ibe][i]->GetBinEntries(j + 1) > 0) {
+									scale = 1. / scale;
+									m_hHitAWonTMapS[ibe][i]->SetBinContent(j + 1, m_hHitAWonTMapS[ibe][i]->GetBinContent(j + 1) * scale);
+									m_hHitAonTMapS[ibe][i]->SetBinContent(j + 1, m_hHitAonTMapS[ibe][i]->GetBinContent(j + 1) * scale);
+									m_hHitHonTMapS[ibe][i]->SetBinContent(j + 1, m_hHitHonTMapS[ibe][i]->GetBinContent(j + 1) * scale);
+									m_hHitWonTMapS[ibe][i]->SetBinContent(j + 1, m_hHitWonTMapS[ibe][i]->GetBinContent(j + 1) * scale);
+								} else {
+									m_hHitAWonTMapS[ibe][i]->SetBinContent(j + 1, 0);
+									m_hHitAonTMapS[ibe][i]->SetBinContent(j + 1, 0);
+									m_hHitHonTMapS[ibe][i]->SetBinContent(j + 1, 0);
+									m_hHitWonTMapS[ibe][i]->SetBinContent(j + 1, 0);
+								}
+							}
+						}
+					}
+
+					if (m_doRDOsMon && m_doExpert) divide_LWHist(m_hHtoLMapS[ibe][i], m_hHitHMapS[ibe][i], m_hHitAMapS[ibe][i]);
+
+					if (m_doTracksMon && m_doExpert) {
+						divide_LWHist(m_hHtoLonTMapS[ibe][i], m_hHitHonTMapS[ibe][i], m_hHitAonTMapS[ibe][i]);
+						divide_LWHist(m_hHtoLWonTMapS[ibe][i], m_hHitHWonTMapS[ibe][i], m_hHitAWonTMapS[ibe][i]);
+					}
+				}
+			}
+
+			if (m_doShift && endOfRunFlag()) {
+				if (m_doTracksMon) {
+					if (ibe == 0) {
+						EventPhaseScale = m_hEvtPhase->GetEntries() * 3.125;
+
+						if (EventPhaseScale > 0) {
+							scale_LWHist(m_hEvtPhase, 1. / EventPhaseScale);
+						}
+
+						DriftTimeonTrkDistScale_B = m_hDriftTimeonTrkDist_B->GetEntries() * 3.125;
+
+						if (DriftTimeonTrkDistScale_B > 0) {
+							scale_LWHist(m_hDriftTimeonTrkDist_B, 1. / DriftTimeonTrkDistScale_B);
+						}
+
+						HLhitOnTrackScale_B = m_hHLhitOnTrack_B->GetEntries();
+
+						if (HLhitOnTrackScale_B > 0) {
+							scale_LWHist(m_hHLhitOnTrack_B, 1. / HLhitOnTrackScale_B);
+						}
+
+						HtoLRatioOnTrackScale_B = m_hHtoLRatioOnTrack_B->GetEntries() * 0.02;
+
+						if (HtoLRatioOnTrackScale_B > 0) {
+							scale_LWHist(m_hHtoLRatioOnTrack_B, 1. / HtoLRatioOnTrackScale_B);
+						}
+
+						NumSwLLWoTScale_B = m_hNumSwLLWoT_B->GetEntries();
+
+						if (NumSwLLWoTScale_B > 0) {
+							scale_LWHist(m_hNumSwLLWoT_B, 1. / NumSwLLWoTScale_B);
+						}
+
+						WireToTrkPositionScale_B = m_hWireToTrkPosition_B->GetEntries() * 0.1;
+
+						if (WireToTrkPositionScale_B > 0) {
+							scale_LWHist(m_hWireToTrkPosition_B, 1. / WireToTrkPositionScale_B);
+						}
+
+						TronTDistScale_B = m_hTronTDist_B->GetEntries() * 3.125;
+
+						if (TronTDistScale_B > 0) {
+							scale_LWHist(m_hTronTDist_B, 1. / TronTDistScale_B);
+						}
+
+						ResidualScale_B = m_hResidual_B->GetEntries() * 0.025;
+
+						if (ResidualScale_B > 0) {
+							scale_LWHist(m_hResidual_B, 1. / ResidualScale_B);
+						}
+
+						ResidualScale_B_20GeV = m_hResidual_B_20GeV->GetEntries() * 0.025;
+
+						if (ResidualScale_B_20GeV > 0) {
+							scale_LWHist(m_hResidual_B_20GeV, 1. / ResidualScale_B_20GeV);
+						}
+
+						TimeResidualScale_B = m_hTimeResidual_B->GetEntries() * 0.2;
+
+						if (TimeResidualScale_B > 0) {
+							scale_LWHist(m_hTimeResidual_B, 1. / TimeResidualScale_B);
+						}
+
+						if (m_ArgonXenonSplitter) {
+							DriftTimeonTrkDistScale_B_Ar = m_hDriftTimeonTrkDist_B_Ar->GetEntries() * 3.125;
+
+							if (DriftTimeonTrkDistScale_B_Ar > 0) {
+								scale_LWHist(m_hDriftTimeonTrkDist_B_Ar, 1. / DriftTimeonTrkDistScale_B_Ar);
+							}
+
+							WireToTrkPositionScale_B_Ar = m_hWireToTrkPosition_B_Ar->GetEntries() * 0.1;
+
+							if (WireToTrkPositionScale_B_Ar > 0) {
+								scale_LWHist(m_hWireToTrkPosition_B_Ar, 1. / WireToTrkPositionScale_B_Ar);
+							}
+
+							HtoLRatioOnTrackScale_B_Ar = m_hHtoLRatioOnTrack_B_Ar->GetEntries() * 0.02;
+
+							if (HtoLRatioOnTrackScale_B_Ar > 0) {
+								scale_LWHist(m_hHtoLRatioOnTrack_B_Ar, 1. / HtoLRatioOnTrackScale_B_Ar);
+							}
+
+							TronTDistScale_B_Ar = m_hTronTDist_B_Ar->GetEntries() * 3.125;
+
+							if (TronTDistScale_B_Ar > 0) {
+								scale_LWHist(m_hTronTDist_B_Ar, 1. / TronTDistScale_B_Ar);
+							}
+
+							ResidualScale_B_Ar = m_hResidual_B_Ar->GetEntries() * 0.025;
+
+							if (ResidualScale_B_Ar > 0) {
+								scale_LWHist(m_hResidual_B_Ar, 1. / ResidualScale_B_Ar);
+							}
+
+							ResidualScale_B_Ar_20GeV = m_hResidual_B_Ar_20GeV->GetEntries() * 0.025;
+
+							if (ResidualScale_B_Ar_20GeV > 0) {
+								scale_LWHist(m_hResidual_B_Ar_20GeV, 1. / ResidualScale_B_Ar_20GeV);
+							}
+
+							TimeResidualScale_B_Ar = m_hTimeResidual_B_Ar->GetEntries() * 0.2;
+
+							if (TimeResidualScale_B_Ar > 0) {
+								scale_LWHist(m_hTimeResidual_B_Ar, 1. / TimeResidualScale_B_Ar);
+							}
+						}
+
+						HtoLRatioOnTrackScale_B_Xe = m_hHtoLRatioOnTrack_B_Xe->GetEntries() * 0.02;
+
+						if (HtoLRatioOnTrackScale_B_Xe > 0) {
+							scale_LWHist(m_hHtoLRatioOnTrack_B_Xe, 1. / HtoLRatioOnTrackScale_B_Xe);
+						}
+					} else if (ibe == 1) {
+						for (int iside = 0; iside < 2; iside++) {
+							DriftTimeonTrkDistScale_E[iside] = m_hDriftTimeonTrkDist_E[iside]->GetEntries() * 3.125;
+
+							if (DriftTimeonTrkDistScale_E[iside] > 0) {
+								scale_LWHist(m_hDriftTimeonTrkDist_E[iside], 1. / DriftTimeonTrkDistScale_E[iside]);
+							}
+
+							HLhitOnTrackScale_E[iside] = m_hHLhitOnTrack_E[iside]->GetEntries();
+
+							if (HLhitOnTrackScale_E[iside] > 0) {
+								scale_LWHist(m_hHLhitOnTrack_E[iside], 1. / HLhitOnTrackScale_E[iside]);
+							}
+
+							HtoLRatioOnTrackScale_E[iside] = m_hHtoLRatioOnTrack_E[iside]->GetEntries() * 0.02;
+
+							if (HtoLRatioOnTrackScale_E[iside] > 0) {
+								scale_LWHist(m_hHtoLRatioOnTrack_E[iside], 1. / HtoLRatioOnTrackScale_E[iside]);
+							}
+
+							NumSwLLWoTScale_E[iside] = m_hNumSwLLWoT_E[iside]->GetEntries();
+
+							if (NumSwLLWoTScale_E[iside] > 0) {
+								scale_LWHist(m_hNumSwLLWoT_E[iside], 1. / NumSwLLWoTScale_E[iside]);
+							}
+
+							WireToTrkPositionScale_E[iside] = m_hWireToTrkPosition_E[iside]->GetEntries() * 0.1;
+
+							if (WireToTrkPositionScale_E[iside] > 0) {
+								scale_LWHist(m_hWireToTrkPosition_E[iside], 1. / WireToTrkPositionScale_E[iside]);
+							}
+
+							TronTDistScale_E[iside] = m_hTronTDist_E[iside]->GetEntries() * 3.125;
+
+							if (TronTDistScale_E[iside] > 0) {
+								scale_LWHist(m_hTronTDist_E[iside], 1. / TronTDistScale_E[iside]);
+							}
+
+							ResidualScale_E[iside] = m_hResidual_E[iside]->GetEntries() * 0.025;
+
+							if (ResidualScale_E[iside] > 0) {
+								scale_LWHist(m_hResidual_E[iside], 1. / ResidualScale_E[iside]);
+							}
+
+							ResidualScale_E_20GeV[iside] = m_hResidual_E_20GeV[iside]->GetEntries() * 0.025;
+
+							if (ResidualScale_E_20GeV[iside] > 0) {
+								scale_LWHist(m_hResidual_E_20GeV[iside], 1. / ResidualScale_E_20GeV[iside]);
+							}
+
+							TimeResidualScale_E[iside] = m_hTimeResidual_E[iside]->GetEntries() * 0.2;
+
+							if (TimeResidualScale_E[iside] > 0) {
+								scale_LWHist(m_hTimeResidual_E[iside], 1. / TimeResidualScale_E[iside]);
+							}
+
+							HtoLRatioOnTrackScale_E_Xe[iside] = m_hHtoLRatioOnTrack_E_Xe[iside]->GetEntries() * 0.02;
+
+							if (HtoLRatioOnTrackScale_E_Xe[iside] > 0) {
+								scale_LWHist(m_hHtoLRatioOnTrack_E_Xe[iside], 1. / HtoLRatioOnTrackScale_E_Xe[iside]);
+							}
+
+							if (m_ArgonXenonSplitter) {
+								DriftTimeonTrkDistScale_E_Ar[iside] = m_hDriftTimeonTrkDist_E_Ar[iside]->GetEntries() * 3.125;
+
+								if (DriftTimeonTrkDistScale_E_Ar[iside] > 0) {
+									scale_LWHist(m_hDriftTimeonTrkDist_E_Ar[iside], 1. / DriftTimeonTrkDistScale_E_Ar[iside]);
+								}
+
+								WireToTrkPositionScale_E_Ar[iside] = m_hWireToTrkPosition_E_Ar[iside]->GetEntries() * 0.1;
+
+								if (WireToTrkPositionScale_E_Ar[iside] > 0) {
+									scale_LWHist(m_hWireToTrkPosition_E_Ar[iside], 1. / WireToTrkPositionScale_E_Ar[iside]);
+								}
+
+								HtoLRatioOnTrackScale_E_Ar[iside] = m_hHtoLRatioOnTrack_E_Ar[iside]->GetEntries() * 0.02;
+
+								if (HtoLRatioOnTrackScale_E_Ar[iside] > 0) {
+									scale_LWHist(m_hHtoLRatioOnTrack_E_Ar[iside], 1. / HtoLRatioOnTrackScale_E_Ar[iside]);
+								}
+
+								TronTDistScale_E_Ar[iside] = m_hTronTDist_E_Ar[iside]->GetEntries() * 3.125;
+
+								if (TronTDistScale_E_Ar[iside] > 0) {
+									scale_LWHist(m_hTronTDist_E_Ar[iside], 1. / TronTDistScale_E_Ar[iside]);
+								}
+
+								ResidualScale_E_Ar[iside] = m_hResidual_E_Ar[iside]->GetEntries() * 0.025;
+
+								if (ResidualScale_E_Ar[iside] > 0) {
+									scale_LWHist(m_hResidual_E_Ar[iside], 1. / ResidualScale_E_Ar[iside]);
+								}
+
+								ResidualScale_E_Ar_20GeV[iside] = m_hResidual_E_Ar_20GeV[iside]->GetEntries() * 0.025;
+
+								if (ResidualScale_E_Ar_20GeV[iside] > 0) {
+									scale_LWHist(m_hResidual_E_Ar_20GeV[iside], 1. / ResidualScale_E_Ar_20GeV[iside]);
+								}
+
+								TimeResidualScale_E_Ar[iside] = m_hTimeResidual_E_Ar[iside]->GetEntries() * 0.2;
+
+								if (TimeResidualScale_E_Ar[iside] > 0) {
+									scale_LWHist(m_hTimeResidual_E_Ar[iside], 1. / TimeResidualScale_E_Ar[iside]);
+								}
+							}
+						}
+					}
+				}
+			}
+
+			if (m_doEfficiency && endOfRunFlag()) {
+				for (int iside = 0; iside < 2; iside++) {
+					for (int i = 0; i < 32; i++) {
+						for (int ibin = 0; ibin <= s_Straw_max[ibe]; ibin++) {
+							if (m_doExpert) {
+								if (m_hefficiencyS[ibe][i + (32 * iside)]->GetBinEntries(ibin) > m_min_tracks_straw) {
+									m_hefficiency[ibe][iside]->Fill(m_hefficiencyS[ibe][i + (32 * iside)]->GetBinContent(ibin));
+								}
+							}
+						}
+					}
+
+					n_BorE[ibe][iside] = m_hefficiency[ibe][iside]->GetEntries();
+					total_BorE[ibe][iside] = 0.0;
+
+					for (unsigned int ibin = 0; ibin <= m_hefficiency[ibe][iside]->GetXaxis()->GetNbins(); ibin++) {
+						total_BorE[ibe][iside] += m_hefficiency[ibe][iside]->GetBinContent(ibin);
+						m_hefficiencyIntegral[ibe][iside]->SetBinContent(ibin, n_BorE[ibe][iside] != 0.0 ? total_BorE[ibe][iside] / n_BorE[ibe][iside] : 0);
+					}
+				}
+			}
+		}
+	}
+
+	if (endOfLumiBlockFlag() || endOfRunFlag()) {
+		if (m_doShift) {
+			Int_t lumiblock1440 = m_lastLumiBlock % 1440;
+			float lumiBlockScale = (m_evtLumiBlock > 0) ? (1. / m_evtLumiBlock) : 0;
+			const float barrelConst = 1. / 105088;
+			const float endcapConst = 1. / 122880;
+
+			if (m_doTracksMon && m_evtLumiBlock > 0) {
+				m_hNHitsperLB_B->Fill(m_lastLumiBlock,   (float)nHitsperLB_B * lumiBlockScale * barrelConst);
+				m_hNTrksperLB_B->Fill(m_lastLumiBlock,   (float)nTrksperLB_B * lumiBlockScale);
+				m_hNHLHitsperLB_B->Fill(m_lastLumiBlock, (float)nHLHitsperLB_B * lumiBlockScale * barrelConst);
+
+				for (int iside = 0; iside < 2; iside++) {
+					m_hNHitsperLB_E[iside]->Fill(m_lastLumiBlock, (float)nHitsperLB_E[iside] * lumiBlockScale * endcapConst);
+					m_hNTrksperLB_E[iside]->Fill(m_lastLumiBlock,  (float)nTrksperLB_E[iside] * lumiBlockScale);
+					m_hNHLHitsperLB_E[iside]->Fill(m_lastLumiBlock, (float)nHLHitsperLB_E[iside] * lumiBlockScale * endcapConst);
+				}
+
+				nTrksperLB_B = 0;
+				nHitsperLB_B = 0;
+				nHLHitsperLB_B = 0;
+
+				for (int iside = 0; iside < 2; iside++) {
+					nTrksperLB_E[iside] = 0;
+					nHitsperLB_E[iside] = 0;
+					nHLHitsperLB_E[iside] = 0;
+				}
+
+				// ibe = 0 (Barrel), ibe = 1 (Endcap)
+				for (int ibe = 0; ibe < 2; ibe++) {
+					for (int i = 0; i < s_iStack_max[ibe]; i++) {
+						if (ibe == 0) {
+							if (m_evtLumiBlock > 0) {
+								float occ = (m_LLOcc[ibe][i] * lumiBlockScale) / nfill[ibe];
+								m_hLLOcc_Scatter[ibe]->Fill(lumiblock1440, occ);
+								occ = (m_LLOcc[ibe][i + 32] * lumiBlockScale) / nfill[ibe];
+								m_hLLOcc_Scatter[ibe]->Fill(lumiblock1440, occ);
+							}
+
+							m_LLOcc[ibe][i] = 0;
+							m_LLOcc[ibe][i + 32] = 0;
+
+							if (m_nTrack_B[i]) {
+								float ratio = m_HTfraconTrack_B[i] / m_nTrack_B[i];
+								m_hHightoLowRatioOnTrack_Scatter[ibe]->Fill(lumiblock1440, ratio);
+								m_hHitsOnTrack_Scatter[ibe]->Fill(lumiblock1440, m_LonTrack_B[i] / m_nTrack_B[i]);
+							}
+
+							m_LonTrack_B[i] = 0;
+							m_HTfraconTrack_B[i] = 0;
+							m_nTrack_B[i] = 0;
+						} else if (ibe == 1) {
+							if (m_evtLumiBlock > 0) {
+								float occ = (m_LLOcc[ibe][i] * lumiBlockScale) / nfill[ibe];
+								m_hLLOcc_Scatter[ibe]->Fill(lumiblock1440, occ);
+							}
+
+							m_LLOcc[ibe][i] = 0;
+
+							if (m_nTrack_E[i]) {
+								float ratio = m_HTfraconTrack_E[i] / m_nTrack_E[i];
+								m_hHightoLowRatioOnTrack_Scatter[ibe]->Fill(lumiblock1440, ratio);
+								m_hHitsOnTrack_Scatter[ibe]->Fill(lumiblock1440, m_LonTrack_E[i] / m_nTrack_E[i]);
+							}
+
+							m_LonTrack_E[i] = 0;
+							m_HTfraconTrack_E[i] = 0;
+							m_nTrack_E[i] = 0;
+						}
+					}
+				}
+			}
 		}
-		HtoLRatioOnTrackScale_E_Ar[iside] = m_hHtoLRatioOnTrack_E_Ar[iside]->GetEntries()*0.02; //for argon
-		if (HtoLRatioOnTrackScale_E_Ar[iside] > 0) {
-		  scale_LWHist(m_hHtoLRatioOnTrack_E_Ar[iside], 1./HtoLRatioOnTrackScale_E_Ar[iside]);
+
+		//Resetting Occupuncy histograms for online environment
+		if (m_doShift && m_environment == AthenaMonManager::online &&
+		    (m_lastLumiBlock % m_lumiBlocksToResetOcc) == 0) {
+			for (int ibe = 0; ibe < 2; ibe++) {
+				for (int iside = 0; iside < 2; iside++) {
+					m_hAvgHLOcc_side[ibe][iside]->Reset();
+					m_hAvgLLOcc_side[ibe][iside]->Reset();
+					m_hAvgHLOccMod_side[ibe][iside]->Reset();
+					m_hAvgLLOccMod_side[ibe][iside]->Reset();
+				}
+			}
 		}
-                TronTDistScale_E_Ar[iside] = m_hTronTDist_E_Ar[iside]->GetEntries()*3.125;
-                if (TronTDistScale_E_Ar[iside] > 0) {
-                  scale_LWHist(m_hTronTDist_E_Ar[iside], 1./TronTDistScale_E_Ar[iside]);
-                }
-	      //_20GeV
-                ResidualScale_E_Ar[iside] = m_hResidual_E_Ar[iside]->GetEntries()*0.025;
-                if (ResidualScale_E_Ar[iside] > 0) {
-                  scale_LWHist(m_hResidual_E_Ar[iside], 1. / ResidualScale_E_Ar[iside]);
-                }
-                ResidualScale_E_Ar_20GeV[iside] = m_hResidual_E_Ar_20GeV[iside]->GetEntries()*0.025;
-                if (ResidualScale_E_Ar_20GeV[iside] > 0) {
-                  scale_LWHist(m_hResidual_E_Ar_20GeV[iside], 1. / ResidualScale_E_Ar_20GeV[iside]);
-                }
-                TimeResidualScale_E_Ar[iside] = m_hTimeResidual_E_Ar[iside]->GetEntries()*0.2;
-                if (TimeResidualScale_E_Ar[iside] > 0) {
-                  scale_LWHist(m_hTimeResidual_E_Ar[iside], 1. / TimeResidualScale_E_Ar[iside]);
-                }
-	      }
-            } //for (int iside=0; iside<2; iside++)
-          }// else if (ibe==1)
-
-        }//doTracksMon
-      }//if DoShift  && isendofrun
-
-      if (DoEfficiency && endOfRunFlag()) {
-        for (int iside=0; iside<2; iside++) {
-          for (int i = 0; i < 32; i++) {
-            for (int ibin = 0; ibin <= s_Straw_max[ibe]; ibin++) {
-
-              if (DoExpert) {
-                if (m_hefficiencyS[ibe][i+(32*iside)]->GetBinEntries(ibin) > m_min_tracks_straw) {
-                  m_hefficiency[ibe][iside]->Fill(m_hefficiencyS[ibe][i+(32*iside)]->GetBinContent(ibin));
-                }
-              }
-
-            } //loop  ibin
-          }// loop phi sectors
-          n_BorE[ibe][iside] = m_hefficiency[ibe][iside]->GetEntries();
-
-          total_BorE[ibe][iside] = 0.0;
-          for (unsigned int ibin = 0; ibin <= m_hefficiency[ibe][iside]->GetXaxis()->GetNbins(); ibin++) {
-            total_BorE[ibe][iside] += m_hefficiency[ibe][iside]->GetBinContent(ibin);
-            m_hefficiencyIntegral[ibe][iside]->SetBinContent(ibin, n_BorE[ibe][iside]!=0.0 ? total_BorE[ibe][iside]/n_BorE[ibe][iside] : 0);
-          }// loop over ibin
-        }//for (int iside=0; iside<2; iside++)
-      }// if DoEfficiency && EndOfRun
-
-    } // for (int ibe=0; ibe<2; ibe++)
-  }//if the environment is not online
-
-  if (endOfLumiBlockFlag() || endOfRunFlag()) {
-    if (DoShift) {
-      Int_t lumiblock1440 = lastLumiBlock % 1440;
-
-      if (m_doTracksMon) {
-
-        if (evtLumiBlock > 0) {
-          m_hNHitsperLB_B->Fill(lastLumiBlock,   (float)nHitsperLB_B / (evtLumiBlock * 105088.));
-          m_hNTrksperLB_B->Fill(lastLumiBlock,   (float)nTrksperLB_B /  evtLumiBlock);
-          m_hNHLHitsperLB_B->Fill(lastLumiBlock, (float)nHLHitsperLB_B/ (evtLumiBlock * 105088.));
-          for (int iside=0; iside<2; iside++) {
-            m_hNHitsperLB_E[iside]->Fill(lastLumiBlock,  (float)nHitsperLB_E[iside]   / (evtLumiBlock * 122880.));
-            m_hNTrksperLB_E[iside]->Fill(lastLumiBlock,  (float)nTrksperLB_E[iside]   /  evtLumiBlock);
-            m_hNHLHitsperLB_E[iside]->Fill(lastLumiBlock, (float)nHLHitsperLB_E[iside] / (evtLumiBlock * 122880.));
-          }
-        }
-
-
-        nTrksperLB_B=0;
-        nHitsperLB_B=0;
-        nHLHitsperLB_B=0;
-        for (int iside=0; iside<2; iside++) {
-          nTrksperLB_E[iside]=0;
-          nHitsperLB_E[iside]=0;
-          nHLHitsperLB_E[iside]=0;
-        }
-
-        for (int ibe=0; ibe<2; ibe++) { //ibe=0(barrel), ibe=1(endcap)
-          for (int i = 0; i < s_iStack_max[ibe]; i++) {
-            if (ibe==0) { // barrel
-              if (evtLumiBlock > 0) {
-                float occ = (m_LLOcc[ibe][i]/evtLumiBlock)/nfill[ibe];
-                m_hLLOcc_Scatter[ibe]->Fill(lumiblock1440,occ);
-                occ = (m_LLOcc[ibe][i+32]/evtLumiBlock)/nfill[ibe];
-                m_hLLOcc_Scatter[ibe]->Fill(lumiblock1440,occ);
-              }
-              m_LLOcc[ibe][i]=0; m_LLOcc[ibe][i+32]=0;
-
-              if (m_nTrack_B[i]) {
-                float ratio=m_HTfraconTrack_B[i]/m_nTrack_B[i];
-                m_hHightoLowRatioOnTrack_Scatter[ibe]->Fill(lumiblock1440,ratio);
-                m_hHitsOnTrack_Scatter[ibe]->Fill(lumiblock1440,m_LonTrack_B[i]/m_nTrack_B[i]);
-              }
-              m_LonTrack_B[i] = 0;
-              m_HTfraconTrack_B[i] = 0;
-              m_nTrack_B[i] = 0;
-
-            } else if (ibe==1) { // endcap
-              if (evtLumiBlock > 0) {
-                float occ = (m_LLOcc[ibe][i]/evtLumiBlock)/nfill[ibe];
-                m_hLLOcc_Scatter[ibe]->Fill(lumiblock1440,occ);
-              }
-              m_LLOcc[ibe][i]=0;
-              if (m_nTrack_E[i]) {
-                float ratio=m_HTfraconTrack_E[i]/m_nTrack_E[i];
-                m_hHightoLowRatioOnTrack_Scatter[ibe]->Fill(lumiblock1440,ratio);
-                m_hHitsOnTrack_Scatter[ibe]->Fill(lumiblock1440,m_LonTrack_E[i]/m_nTrack_E[i]);
-              }
-              m_LonTrack_E[i] = 0;
-              m_HTfraconTrack_E[i] = 0;
-              m_nTrack_E[i] = 0;
-            }
-          }// for (int i = 0; i < s_iStack_max[ibe]; i++)
-        } //for (int ibe=0; ibe<2; ibe++)
-      } //if (m_doTracksMon)
-    }//Doshift
-    //Resetting Occupuncy histograms for online environment
-    if (DoShift && m_environment == AthenaMonManager::online && (lastLumiBlock % m_lumiBlocksToResetOcc) == 0) {
-      for (int ibe=0; ibe<2; ibe++) {
-        for (int iside=0; iside<2; iside++) {
-          m_hAvgHLOcc_side[ibe][iside]->Reset();
-          m_hAvgLLOcc_side[ibe][iside]->Reset();
-          m_hAvgHLOccMod_side[ibe][iside]->Reset();
-          m_hAvgLLOccMod_side[ibe][iside]->Reset();
-        }
-      }
-    }
-
-    ATH_MSG_DEBUG("end of event and lumi block");
-    evtLumiBlock = 0;//number of events in lumiblock counter setted to zero since it is end of the run or the lumiblock
-  } //if (endOfLumiBlock || endOfRun)
-
-  if (endOfRunFlag()) {
-    ATH_MSG_DEBUG("end of run");
-  }
-
-  return StatusCode::SUCCESS;
-}//procHistograms
-
-//Get TRT Raw Data Objects (all TRT Hits)
+
+		ATH_MSG_DEBUG("end of event and lumi block");
+		//number of events in lumiblock counter setted to zero since it is end of the run or the lumiblock
+		m_evtLumiBlock = 0;
+	}
+
+	if (endOfRunFlag()) {
+		ATH_MSG_DEBUG("end of run");
+	}
+
+	return StatusCode::SUCCESS;
+}
+
+//Check for EventBurst: Counts highlevelhits and returns m_passEventBurst flag true if the count is less than m_m_passEventBurstCut,returns allways succes
 //----------------------------------------------------------------------------------//
-StatusCode TRT_Monitoring_Tool::Retrieve_TRT_RDOs()
+StatusCode TRT_Monitoring_Tool::checkEventBurst(const TRT_RDO_Container& rdoContainer) {
 //----------------------------------------------------------------------------------//
-{
-  ATH_MSG_VERBOSE("Retrieving RDO Container from StoreGate");
-
-  StatusCode sc = StatusCode::SUCCESS;
-  if (evtStore()->contains<TRT_RDO_Container>(m_rawDataObjectName)) {
-    sc = evtStore()->retrieve(m_rdoContainer, m_rawDataObjectName);
-    if (sc.isFailure() || !m_rdoContainer) {
-      ATH_MSG_FATAL("Could not find the data object");
-      return StatusCode::FAILURE;
-    } else {
-      ATH_MSG_DEBUG("Data Object " << m_rawDataObjectName << " found");
-    }
-  }
-  else {
-    ATH_MSG_WARNING("No TRT_RDO_Container by the name of "<<m_rawDataObjectName <<" in storegate");
-    return StatusCode::FAILURE;
-  }
-  ATH_MSG_VERBOSE("Leaving Retrieve_TRT_RDOs()");
-  return sc;
-}//Retrieve_TRT_RDOs()
-
-
-//Check for EventBurst: Counts highlevelhits and returns passEventBurst flag true if the count is less than m_passEventBurstCut,returns allways succes
-StatusCode TRT_Monitoring_Tool::CheckEventBurst()
-{
-  passEventBurst = true;
-  if (m_EventBurstCut <= 0) return StatusCode::SUCCESS;
-
-  int nHLHits = 0;
-  TRT_RDO_Container::const_iterator RDO_CollectionBegin = m_rdoContainer->begin();
-  TRT_RDO_Container::const_iterator RDO_CollectionEnd   = m_rdoContainer->end();
-  for (;RDO_CollectionBegin!=RDO_CollectionEnd; ++RDO_CollectionBegin) {
-    //Get pointer to TRT_Collection
-    const InDetRawDataCollection<TRT_RDORawData>* TRT_Collection(*RDO_CollectionBegin);
-    // select only TRT RDOs
-    if (!TRT_Collection) continue;
-    else {
-      DataVector<TRT_RDORawData>::const_iterator p_rdo;//pointer to trt rdo data vector
-      // Loop over TRT RDOs
-      for (p_rdo=TRT_Collection->begin(); p_rdo!=TRT_Collection->end(); ++p_rdo) {
-        const TRT_LoLumRawData* p_lolum=dynamic_cast<const TRT_LoLumRawData*>(*p_rdo);
-        if (!p_lolum) continue;
-        if (p_lolum->highLevel()) nHLHits++;
-      } //loop over TRT RDOs
-    } // if TRT_Collection
-  } // loop over RDOs
-  if (nHLHits > m_EventBurstCut) passEventBurst = false;
-  return StatusCode::SUCCESS;
-}//CheckEventBurst
+	m_passEventBurst = true;
+
+	if (m_EventBurstCut <= 0) return StatusCode::SUCCESS;
+
+	int nHLHits = 0;
+	TRT_RDO_Container::const_iterator RDO_CollectionBegin = rdoContainer.begin();
+	TRT_RDO_Container::const_iterator RDO_CollectionEnd   = rdoContainer.end();
+
+	for (; RDO_CollectionBegin != RDO_CollectionEnd; ++RDO_CollectionBegin) {
+		const InDetRawDataCollection<TRT_RDORawData> *TRT_Collection(*RDO_CollectionBegin);
+
+		if (!TRT_Collection) continue;
+		else {
+			DataVector<TRT_RDORawData>::const_iterator p_rdo = TRT_Collection->begin();
+
+			for (; p_rdo != TRT_Collection->end(); ++p_rdo) {
+				const TRT_LoLumRawData *p_lolum = dynamic_cast<const TRT_LoLumRawData *>(*p_rdo);
+
+				if (!p_lolum) continue;
+
+				if (p_lolum->highLevel()) nHLHits++;
+			}
+		}
+	}
+
+	if (nHLHits > m_EventBurstCut) m_passEventBurst = false;
+
+	return StatusCode::SUCCESS;
+}
 
 //Now Fill the TRT RDO Histograms
 //----------------------------------------------------------------------------------//
-StatusCode TRT_Monitoring_Tool::Fill_TRT_RDOs()
+StatusCode TRT_Monitoring_Tool::fillTRTRDOs(const TRT_RDO_Container& rdoContainer,
+                                            const xAOD::EventInfo& eventInfo,
+                                            const InDetTimeCollection* trtBCIDCollection) {
 //----------------------------------------------------------------------------------//
-{
-  ATH_MSG_DEBUG("Filling TRT RDO Histograms");
-
-  TRT_RDO_Container::const_iterator RDO_CollectionBegin = m_rdoContainer->begin();
-  TRT_RDO_Container::const_iterator RDO_CollectionEnd   = m_rdoContainer->end();
-  InDetTimeCollection *TRT_BCIDColl = 0;
-  //retrieve InDetTimeCollection from Store Gate
-  if (evtStore()->contains<InDetTimeCollection>("TRT_BCID")) {
-    if (evtStore()->retrieve(TRT_BCIDColl, "TRT_BCID").isFailure()) {
-      ATH_MSG_INFO("Could not get InDetTimeCollection from Store Gate");
-    } else {
-      ATH_MSG_DEBUG("Got BCID Collection from Store Gate");
-    }
-  }
-
-  //retrieve EventInfo from Store Gate
-  const EventInfo* eventInfo;
-  if (evtStore()->retrieve(eventInfo).isFailure()) {
-    ATH_MSG_ERROR("Could not retrieve the EventInfo from Store Gate");
-    return StatusCode::FAILURE;
-  }
-  //Check readout Integrity of TRT 
-  if (Check_TRT_Readout_Integrity(eventInfo).isFailure()) {
-    ATH_MSG_ERROR("Failure when checking the TRT readout integrity");
-    return StatusCode::FAILURE;
-  }
-
-  int numberOfStacks_b[2];//Total stack number of barrel and endcap
-  numberOfStacks_b[0]= s_numberOfBarrelStacks*3;
-  numberOfStacks_b[1]= s_numberOfEndCapStacks*2;
-
-  Identifier TRT_Identifier;
-  int numberOfStrawsMod[3]; // For barrel(number if straw in module)
-  numberOfStrawsMod[0]=329;
-  numberOfStrawsMod[1]=520;
-  numberOfStrawsMod[2]=793;
-
-  int numberOfStrawsWheel[2]; // For endcap
-  numberOfStrawsWheel[0]=2304;   //6 layers (6*16=96) 96*24=2304 straws in wheel type A
-  numberOfStrawsWheel[1]=1536;   //8 layers (8*8=64) 64*24=1536 straws in wheel type B
-
-  int moduleHits_B[192], moduleHits_E[128];
-  int HLmoduleHits_B[192], HLmoduleHits_E[128];
-  for (int i = 0; i < 192; i++) { moduleHits_B[i]=0; HLmoduleHits_B[i]=0; }
-  for (int i = 0; i < 128; i++) { moduleHits_E[i]=0; HLmoduleHits_E[i]=0; }
-
-  int goodid_status = 0;
-  int prev_bcid = 0;
-
-  if (TRT_BCIDColl) {
-    InDetTimeCollection::const_iterator itrt_bcid = TRT_BCIDColl->begin();
-    while (goodid_status == 0 && itrt_bcid != TRT_BCIDColl->end()) {
-      if (!(*itrt_bcid)) continue;
-      const unsigned int trt_bcid = (*itrt_bcid)->second;
-      if (itrt_bcid > TRT_BCIDColl->begin() && prev_bcid-trt_bcid == 0) {
-        goodid_status = 1;
-      }
-      else if (itrt_bcid > TRT_BCIDColl->begin() && prev_bcid-trt_bcid != 0) {
-        ATH_MSG_WARNING("TRT BCID is not consistent.  TRT RODID is " << std::hex << (*itrt_bcid)->first << " trt bcid from ROD is " << std::hex << trt_bcid);
-      }
-      prev_bcid = trt_bcid;
-      ++itrt_bcid;
-    }
-  }//if trt_bcidcoll is valid
-
-  // Test out the TRT_StrawStatusSummarySvc.
-  if (!m_sumSvc.name().empty() && DoExpert) {
-    ATH_MSG_VERBOSE("Trying " << m_sumSvc << " isGood");
-    ATH_MSG_VERBOSE("TRT_StrawStatusSvc reports status = " << m_sumSvc->getStatus(TRT_Identifier));
-  }
-
-  for (int ibe = 0; ibe < 2; ibe++) { //ibe=0(barrel), ibe=1(endcap)
-    nTRTHits[ibe] = 0;
-
-    //Take out normalization from previous event for online environment
-    //Explanation: While online monitoring running we need to present out histograms repeatedly so we need to pay attention to normalization.
-    //before adding any information from new event to normalized histograms we need to take out the normalization of the previous event by scaling histograms back.
-    //After  we are done with filling those histograms we will normalize them again
-    if (m_environment == AthenaMonManager::online && nEvents >0) {
-      //Loop over stack histograms and normalize to number of events processed.
-
-      if (DoChips && DoExpert) {
-        for (int i = 0; i < 64; i++) {
-          float scale = (nEvents-1) * 16;
-          scale_LWHist(m_hHitHWMapC[ibe][i], scale);
-          scale_LWHist(m_hHitWMapC[ibe][i],  scale);
-          scale_LWHist(m_hHitAMapC[ibe][i],  scale);
-          scale_LWHist(m_hHitAWMapC[ibe][i], scale);
-          scale_LWHist(m_hHitHMapC[ibe][i],  scale);
-        }//Loop over A side and C side Stacks: for (int i=0; i<64; i++)
-      }//if DoChips && DoExpert
-
-      if (DoStraws) {
-	if (ibe == 0) {
-	  //scale array for HitWMap_B*
-	  m_initScaleVectors();
-	  vector<float> scalevector;
-	  vector<float> scalevector_Ar;
-	  for(int k =0;k<s_Straw_max[0];k++){
-	    try {
-	      if (m_scale_hHitWMap_B.at(k)==0.)
-		scalevector.push_back(0.);
-	      else
-		scalevector.push_back((nEvents-1)*m_scale_hHitWMap_B.at(k));
-	      //for argon
-	      if (m_scale_hHitWMap_B_Ar.at(k)==0.)
-		scalevector_Ar.push_back(0.);
-	      else
-		scalevector_Ar.push_back((nEvents-1)*m_scale_hHitWMap_B_Ar.at(k));
-	    } catch (out_of_range& e) {
-	      ATH_MSG_ERROR("Index " << k << " out of range in scaling for hHitWMap");
-	    }
-	  }
-	  scale_LWHistWithScaleVector(m_hHitWMap_B, scalevector);
-          if (m_ArgonXenonSplitter) {
-            scale_LWHistWithScaleVector(m_hHitWMap_B_Ar, scalevector_Ar);
-          }
-        } else if (ibe==1) {
-          scale_LWHist(m_hHitWMap_E[0], (nEvents-1) * 32);
-          scale_LWHist(m_hHitWMap_E[1], (nEvents-1) * 32);
-          if (m_ArgonXenonSplitter) {
-            scale_LWHist(m_hHitWMap_E_Ar[0], (nEvents-1) * 32);
-            scale_LWHist(m_hHitWMap_E_Ar[1], (nEvents-1) * 32);
-          }
-        }
-
-        if (DoExpert) {
-          for (int i = 0; i < 64; i++) {
-	    //            m_hStrawOcc[ibe][i]->Reset();
-            scale_LWHist(m_hHitHWMapS[ibe][i], nEvents-1);
-            scale_LWHist(m_hHitWMapS[ibe][i],  nEvents-1);
-            scale_LWHist(m_hHitAMapS[ibe][i],  nEvents-1);
-            scale_LWHist(m_hHitAWMapS[ibe][i], nEvents-1);
-            scale_LWHist(m_hHitHMapS[ibe][i],  nEvents-1);
-          }//Loop over A side and B side Stacks: for (int i=0; i<64; i++)
-        } // if doExpert
-      }//if DoStraws && DoExpert
-    }//If online environment
-    //finish taking out normalization
-
-  }// for (int ibe=0; ibe<2; ibe++)
-
-
-
-  int nhitsall = 0;
-  for (; RDO_CollectionBegin != RDO_CollectionEnd; ++RDO_CollectionBegin) {
-    //Get pointer to TRT_Collection
-    const InDetRawDataCollection<TRT_RDORawData>* TRT_Collection(*RDO_CollectionBegin);
-
-    // select only TRT RDOs
-    if (!TRT_Collection) continue;
-    DataVector<TRT_RDORawData>::const_iterator p_rdo;//pointer to trt rdo data vector
-    // Loop over TRT RDOs
-    for (p_rdo=TRT_Collection->begin(); p_rdo!=TRT_Collection->end(); ++p_rdo) {
-      int middleHTbit       = (*p_rdo)->getWord() & 0x00020000;
-      //0x00020000 = 0000 0000 0000 0000 0000 0010 0000 0000 0000 0000
-      int hitinvaliditygate = (*p_rdo)->getWord() & 0x000DFE80;
-      //0x000DFE80 = 0000 0000 0000 0000 0000 1101 1111 1110 1000 0000 //
-      bool is_middleHTbit_high   = (middleHTbit !=0);
-      bool is_anybininVgate_high = (hitinvaliditygate !=0);
-      TRT_Identifier = (*p_rdo)->identify();
-      if (DoMaskStraws && m_sumSvc->get_status(TRT_Identifier)) continue;
-      int m_barrel_ec = m_pTRTHelper->barrel_ec(TRT_Identifier);
-      //ToDo: Check TRT_LoLumRawData object
-      const TRT_LoLumRawData* p_lolum=dynamic_cast<const TRT_LoLumRawData*>(*p_rdo);
-      if (!p_lolum) continue;
-      nhitsall++;
-      /*//We don't need this anymore 
-	int barrelendcap_sectorflag[2][2];
-	barrelendcap_sectorflag[0][0]=1;  // barrel-A
-	barrelendcap_sectorflag[0][1]=-1; // barrel-C
-	barrelendcap_sectorflag[1][0]=2;  // endcap-A
-	barrelendcap_sectorflag[1][1]=-2;
-      */
-      int ibe   =abs(m_barrel_ec)-1;
-      int iside =m_barrel_ec>0?0:1; 
-
-      if (ibe!=1&&ibe!=0) continue;//if m_barrel_ec is outof range go to next measurement in rdo_collection
-      //ToDo: add a verbose message about this
-      int moduleNumber_barrel1[2];
-      int moduleNumber_barrel2[2];
-      int moduleNumber_barrel3[2];
-      int moduleNumber_endcapA[2];
-      int moduleNumber_endcapB[2];
-
-      //There used to be a loop over "ibe"
-      //It wasn't wery useful so now we dont use it      
-      // for (int ibe=0; ibe<2; ibe++) {  // ibe=0(barrel) ,ibe=1(endcap)
-
-      //Get TRT Identifier (need to know phi module, module layer, straw layer, and straw # with in the layer, to get proper straw numbering.
-      TRT_Identifier = p_lolum->identify();
-      const bool isArgonStraw = (  Straw_Gastype( m_sumSvc->getStatusHT(TRT_Identifier) ) ==GasType::Ar   );//inline function checks m_ArgonXenonSplitter 
-      // assume always Xe if m_ArgonXenonSplitter is not enabled, otherwise check the straw status (good is Xe, non-good is Ar)
-      //const bool isArgonStraw = m_ArgonXenonSplitter && (m_sumSvc->getStatusHT(TRT_Identifier) != TRTCond::StrawStatus::Good);
-
-      int m_phi_module     = m_pTRTHelper->phi_module(TRT_Identifier);
-      int m_layer_or_wheel = m_pTRTHelper->layer_or_wheel(TRT_Identifier);
-      int m_straw_layer    = m_pTRTHelper->straw_layer(TRT_Identifier);
-      int m_straw          = m_pTRTHelper->straw(TRT_Identifier);
-
-      int m_strawNumber, m_chip=0, m_board=-1;
-      //ToDo: Check if that is really neccessary
-      bool is_barrel = m_pTRTHelper->is_barrel(TRT_Identifier);
-      //check straw number and find the correct m_chip and m_ board values
-
-      /* 'if' statements below were calling functions of m_pTRTHelper 
-       * Since we called  them before if conditions and give their values to variables 
-       * it was doing unnecessary computation
-       * Old ones were looking like the following
-       *
-       * if ((m_pTRTHelper->is_barrel(TRT_Identifier))
-       *      && (m_pTRTHelper->barrel_ec(TRT_Identifier)==-1
-       *          || m_pTRTHelper->barrel_ec(TRT_Identifier)==1)) {
-       */
-
-      if ( is_barrel && ibe==0 ) { // barrel
-	m_strawNumber=strawNumber(m_straw, m_straw_layer, m_layer_or_wheel);
-	if (m_strawNumber >= 0 && m_strawNumber < s_Straw_max[ibe]) {
-	  m_chip = mat_chip_B[m_phi_module][m_strawNumber];
+	ATH_MSG_DEBUG("Filling TRT RDO Histograms");
+	TRT_RDO_Container::const_iterator RDO_CollectionBegin = rdoContainer.begin();
+	TRT_RDO_Container::const_iterator RDO_CollectionEnd   = rdoContainer.end();
+	//Check readout Integrity of TRT
+	ATH_CHECK( checkTRTReadoutIntegrity(eventInfo) );
+	int numberOfStacks_b[2]; //Total stack number of barrel and endcap
+	numberOfStacks_b[0] = s_numberOfBarrelStacks * 3;
+	numberOfStacks_b[1] = s_numberOfEndCapStacks * 2;
+	Identifier TRT_Identifier;
+	int numberOfStrawsMod[3]; // For barrel(number if straw in module)
+	numberOfStrawsMod[0] = 329;
+	numberOfStrawsMod[1] = 520;
+	numberOfStrawsMod[2] = 793;
+	int numberOfStrawsWheel[2]; // For endcap
+	numberOfStrawsWheel[0] = 2304; //6 layers (6*16=96) 96*24=2304 straws in wheel type A
+	numberOfStrawsWheel[1] = 1536; //8 layers (8*8=64) 64*24=1536 straws in wheel type B
+	int moduleHits_B[192];
+	int moduleHits_E[128];
+	int HLmoduleHits_B[192];
+	int HLmoduleHits_E[128];
+
+	for (int i = 0; i < 192; i++) {
+		moduleHits_B[i] = 0;
+		HLmoduleHits_B[i] = 0;
 	}
-	m_board = chipToBoard(m_chip);
 
-      } else if ( !is_barrel && ibe ==1 ) { // endcap
-	m_strawNumber = strawNumberEndCap(m_straw, m_straw_layer, m_layer_or_wheel, m_phi_module, m_barrel_ec);
-	if (m_strawNumber >= 0 && m_strawNumber < s_Straw_max[ibe]) {
-	  m_chip = mat_chip_E[m_phi_module][m_strawNumber];
-	}
-	m_board = chipToBoard_EndCap(m_chip);
-      } else {
-	m_strawNumber=-1;
-      }
-      if (m_strawNumber<0 || m_strawNumber >= s_Straw_max[ibe]){
-	ATH_MSG_WARNING("Found m_strawNumber = " << m_strawNumber << " out of range.");	
-	continue;
-      }
-      //ToDo: rename them (They are clearly not member but have "m_" prefix)
-      const int m_driftTimeBin  = p_lolum->driftTimeBin();
-      const int m_trailingEdge  = p_lolum->trailingEdge();
-      //      const bool m_highlevel    = p_lolum->highLevel();
-      const bool m_highlevel    =is_middleHTbit_high;//Hardcoded Middle Bit
-
-
-
-      const bool m_firstBinHigh = p_lolum->firstBinHigh(); // if the first time bin is up then the hit is out of time window
-      const bool m_lastBinHigh  = p_lolum->lastBinHigh(); // if the last bin is up then the hit is out of time window.
-      const float m_timeOverThreshold = p_lolum->timeOverThreshold();
-
-      moduleNumber_barrel1[0]=m_phi_module;
-      moduleNumber_barrel1[1]=m_phi_module+96;
-
-      moduleNumber_barrel2[0]=m_phi_module+s_numberOfBarrelStacks;
-      moduleNumber_barrel2[1]=m_phi_module+s_numberOfBarrelStacks+96;
-
-      moduleNumber_barrel3[0]=m_phi_module+2*s_numberOfBarrelStacks;
-      moduleNumber_barrel3[1]=m_phi_module+2*s_numberOfBarrelStacks+96;
-
-      moduleNumber_endcapA[0]=m_phi_module;
-      moduleNumber_endcapA[1]=m_phi_module+64;
-
-      moduleNumber_endcapB[0]=m_phi_module+s_numberOfEndCapStacks;
-      moduleNumber_endcapB[1]=m_phi_module+s_numberOfEndCapStacks+64;
-
-      //There used to be an another for loop
-      // for (int iside=0; iside<2; iside++) {  // iside=0(A-side), iside=1(C-side)
-      //Anf a if condition to theck if ibe and iside is in an agreement with m_barrel_ec
-      //    if (m_barrel_ec==barrelendcap_sectorflag[ibe][iside]) {
-      //Now it just deciphers m_barrel_ec as soon as it gets it
-
-      int iphi_module=-999;
-      if (iside==0) { //A-side
-	iphi_module=m_phi_module;
-      } else if (iside==1) { //C-side
-	iphi_module=m_phi_module+32;
-      }
-      if (ibe==0) { // Barrel
-	nTRTHits[ibe]++;
-	if (DoStraws) {
-	  if (isArgonStraw) {
-	    m_hHitWMap_B_Ar->Fill(m_strawNumber); // Fill leading edge in time window histograms for Argon straws.
-	  } else {
-	    m_hHitWMap_B->Fill(m_strawNumber); // Fill leading edge in time window histograms.
-	  }
-	}
-	if (DoShift) {
-	  nHitsperLB_B++;
-	  if (m_highlevel) { nHLHitsperLB_B++; }
+	for (int i = 0; i < 128; i++) {
+		moduleHits_E[i] = 0;
+		HLmoduleHits_E[i] = 0;
 	}
-      } else if (ibe==1) { // Endcap
-	nTRTHits[ibe]++;
-	if (DoStraws) {
-	  if (isArgonStraw) {
-	    m_hHitWMap_E_Ar[iside]->Fill(m_strawNumber); // Fill leading edge in time window histograms for Argon straws.
-	  } else {
-	    m_hHitWMap_E[iside]->Fill(m_strawNumber);// Fill leading edge in time window histograms.
-	  }
-	}//DoStraws
-	if (DoShift) {
-	  nHitsperLB_E[iside]++;
-	  if (m_highlevel) { nHLHitsperLB_E[iside]++; }
-	}
-      }
 
+	int goodid_status = 0;
+	int prev_bcid = 0;
 
-      if (DoExpert) {
-	if ( (m_driftTimeBin>2) && (m_driftTimeBin<17) ) { //Fill Leading Edge Histos.
-	  if (DoStraws) m_hHitWMapS[ibe][iphi_module]->Fill(m_strawNumber); //Leading Edge in time Window: Straws
-	  if (DoChips) m_hHitWMapC[ibe][iphi_module]->Fill(m_chip-1);      //Leading Edge in time Window: Chips
-	}
-	if ((m_trailingEdge<23)&& !m_lastBinHigh && !m_firstBinHigh) { //Fill Trailing Edge Histos
-	  if (DoStraws) m_hHitTrWMapS[ibe][iphi_module]->Fill(m_strawNumber, ((m_trailingEdge+1)*3.125)); //Mean TE in time window: Straws
-	  if (DoChips) m_hHitTrWMapC[ibe][iphi_module]->Fill((m_chip-1), ((m_trailingEdge+1)*3.125));    //Mean TE in time window: Chips
-	}
-	if (DoStraws) m_hHitTrMapS[ibe][iphi_module]->Fill(m_strawNumber, ((m_trailingEdge+1)*3.125)); //Mean TE: Straws
-	if (DoChips) m_hHitTrMapC[ibe][iphi_module]->Fill((m_chip-1), ((m_trailingEdge+1)*3.125));    //Mean TE: Chips
-
-	//Look at high threshold (HL) hit distributions (was there a HL hit? was the HL hit in the time window?)
-	if (m_highlevel) {  // If ANY highLevel bit is up.
-	  if (DoStraws) m_hHitHMapS[ibe][iphi_module]->Fill(m_strawNumber); //High Level: Straws
-	  if (DoChips) m_hHitHMapC[ibe][iphi_module]->Fill(m_chip-1);      //High Level: Chips
-
-	  if (is_middleHTbit_high) {
-	    //m_hHitHWMapS[ibe][iphi_module]->Fill(strawNumber(m_straw,m_straw_layer,m_layer_or_wheel)); //HL in time window: Straws
-	    if (DoStraws) m_hHitHWMapS[ibe][iphi_module]->Fill(m_strawNumber); //HL in time window: Straws
-	    if (DoChips) m_hHitHWMapC[ibe][iphi_module]->Fill(m_chip-1);      //HL in time window: Chip
-	  }
+	if (trtBCIDCollection) {
+		InDetTimeCollection::const_iterator itrt_bcid = trtBCIDCollection->begin();
+
+		while (goodid_status == 0 && itrt_bcid != trtBCIDCollection->end()) {
+			if (!(*itrt_bcid)) continue;
+
+			const unsigned int trt_bcid = (*itrt_bcid)->second;
+
+			if (itrt_bcid > trtBCIDCollection->begin() && prev_bcid - trt_bcid == 0) {
+				goodid_status = 1;
+			} else if (itrt_bcid > trtBCIDCollection->begin() && prev_bcid - trt_bcid != 0) {
+				ATH_MSG_WARNING("TRT BCID is not consistent.  TRT RODID is " <<
+				                std::hex << (*itrt_bcid)->first << " trt bcid from ROD is " <<
+				                std::hex << trt_bcid);
+			}
+
+			prev_bcid = trt_bcid;
+			++itrt_bcid;
+		}
 	}
 
-	if (m_firstBinHigh || m_lastBinHigh || m_driftTimeBin>0 || m_trailingEdge<23) {
-	  if (DoStraws) m_hHitAMapS[ibe][iphi_module]->Fill(m_strawNumber); //Any LL bit on: Straws
-	  if (DoChips) m_hHitAMapC[ibe][iphi_module]->Fill(m_chip-1);      //Any LL bit on: Chips
+	// Test out the TRT_StrawStatusSummarySvc.
+	if (!m_sumSvc.name().empty() && m_doExpert) {
+		ATH_MSG_VERBOSE("Trying " << m_sumSvc << " isGood");
+		ATH_MSG_VERBOSE("TRT_StrawStatusSvc reports status = " << m_sumSvc->getStatus(TRT_Identifier));
 	}
-	if ( is_anybininVgate_high) {
-	  if (DoStraws) m_hHitAWMapS[ibe][iphi_module]->Fill(m_strawNumber); // LL in time window: Straws
-	  if (DoChips) m_hHitAWMapC[ibe][iphi_module]->Fill(m_chip-1);      // LL in time window: Chips
-	}//if ( is_anybininVgate_high) 
-
-	if (DoStraws) {
-	  m_hHitToTMapS[ibe][iphi_module]->Fill(m_strawNumber, m_timeOverThreshold); //Mean ToT (ns): Straws
-	  if (m_timeOverThreshold>m_longToTCut) {
-	    m_hHitToTLongMapS[ibe][iphi_module]->Fill(m_strawNumber, m_timeOverThreshold); //Mean ToT (ns) for Straws with ToT > LongToTCut: Straws
-	    m_hHitToTLongTrMapS[ibe][iphi_module]->Fill(m_strawNumber, (m_trailingEdge+1)*3.125);// Mean Tr (ns) for Straws with ToT > LongToTCut: Straws
-	  }
+
+	// ibe = 0 (Barrel), ibe = 1 (Endcap)
+	for (int ibe = 0; ibe < 2; ibe++) {
+		nTRTHits[ibe] = 0;
+
+		//Take out normalization from previous event for online environment
+		//Explanation: While online monitoring running we need to present out histograms repeatedly so we need to pay attention to normalization.
+		//before adding any information from new event to normalized histograms we need to take out the normalization of the previous event by scaling histograms back.
+		//After  we are done with filling those histograms we will normalize them again
+		if (m_environment == AthenaMonManager::online && m_totalEvents > 0) {
+			//Loop over stack histograms and normalize to number of events processed.
+			if (m_doChips && m_doExpert) {
+				for (int i = 0; i < 64; i++) {
+					float scale = (m_totalEvents - 1) * 16;
+					scale_LWHist(m_hHitHWMapC[ibe][i], scale);
+					scale_LWHist(m_hHitWMapC[ibe][i], scale);
+					scale_LWHist(m_hHitAMapC[ibe][i], scale);
+					scale_LWHist(m_hHitAWMapC[ibe][i], scale);
+					scale_LWHist(m_hHitHMapC[ibe][i], scale);
+				}
+			}
+
+			if (m_doStraws) {
+				if (ibe == 0) {
+					initScaleVectors();
+					vector<float> scalevector;
+					vector<float> scalevector_Ar;
+
+					for (int k = 0; k < s_Straw_max[0]; k++) {
+						try {
+							if (m_scale_hHitWMap_B.at(k) == 0.) {
+								scalevector.push_back(0.);
+							} else {
+								scalevector.push_back((m_totalEvents - 1) * m_scale_hHitWMap_B.at(k));
+							}
+							if (m_scale_hHitWMap_B_Ar.at(k) == 0.) {
+								scalevector_Ar.push_back(0.);
+							} else {
+								scalevector_Ar.push_back((m_totalEvents - 1) * m_scale_hHitWMap_B_Ar.at(k));
+							}
+						} catch (out_of_range &e) {
+							ATH_MSG_ERROR("Index " << k << " out of range in scaling for hHitWMap");
+						}
+					}
+
+					scale_LWHistWithScaleVector(m_hHitWMap_B, scalevector);
+
+					if (m_ArgonXenonSplitter) {
+						scale_LWHistWithScaleVector(m_hHitWMap_B_Ar, scalevector_Ar);
+					}
+				} else if (ibe == 1) {
+					float scale = (m_totalEvents - 1) * 32;
+					scale_LWHist(m_hHitWMap_E[0], scale);
+					scale_LWHist(m_hHitWMap_E[1], scale);
+
+					if (m_ArgonXenonSplitter) {
+						scale_LWHist(m_hHitWMap_E_Ar[0], scale);
+						scale_LWHist(m_hHitWMap_E_Ar[1], scale);
+					}
+				}
+
+				if (m_doExpert) {
+					for (int i = 0; i < 64; i++) {
+						float scale = m_totalEvents - 1;
+						scale_LWHist(m_hHitHWMapS[ibe][i], scale);
+						scale_LWHist(m_hHitWMapS[ibe][i], scale);
+						scale_LWHist(m_hHitAMapS[ibe][i], scale);
+						scale_LWHist(m_hHitAWMapS[ibe][i], scale);
+						scale_LWHist(m_hHitHMapS[ibe][i], scale);
+					}
+				}
+			}
+		}
 	}
-	if (DoChips) m_hHitToTMapC[ibe][iphi_module]->Fill((m_chip-1), m_timeOverThreshold); //Mean ToT (ns): Chips
-	if (DoChips) {
-	  if (p_lolum->highLevel(1)) {
-	    m_hHtoBCMapC[ibe][iphi_module]->Fill(0.,(m_chip-1));
-	    m_hHtoBCMapB[ibe][iphi_module]->Fill(0.,(m_board-1));
-	  }
-	  if (p_lolum->highLevel(2)) {
-	    m_hHtoBCMapC[ibe][iphi_module]->Fill(1.,(m_chip-1));
-	    m_hHtoBCMapB[ibe][iphi_module]->Fill(1.,(m_board-1));
-	  }
-	  if (p_lolum->highLevel(3)) {
-	    m_hHtoBCMapC[ibe][iphi_module]->Fill(2.,(m_chip-1));
-	    m_hHtoBCMapB[ibe][iphi_module]->Fill(2.,(m_board-1));
-	  }
+
+	int nhitsall = 0;
+
+	for (; RDO_CollectionBegin != RDO_CollectionEnd; ++RDO_CollectionBegin) {
+		const InDetRawDataCollection<TRT_RDORawData> *TRT_Collection(*RDO_CollectionBegin);
+
+		if (!TRT_Collection) continue;
+
+		DataVector<TRT_RDORawData>::const_iterator p_rdo = TRT_Collection->begin();
+
+		for (; p_rdo != TRT_Collection->end(); ++p_rdo) {
+			int middleHTbit       = (*p_rdo)->getWord() & 0x00020000;
+			//0x00020000 = 0000 0000 0000 0000 0000 0010 0000 0000 0000 0000
+			int hitinvaliditygate = (*p_rdo)->getWord() & 0x000DFE80;
+			//0x000DFE80 = 0000 0000 0000 0000 0000 1101 1111 1110 1000 0000 //
+			bool is_middleHTbit_high   = (middleHTbit != 0);
+			bool is_anybininVgate_high = (hitinvaliditygate != 0);
+			TRT_Identifier = (*p_rdo)->identify();
+
+			if (m_doMaskStraws && m_sumSvc->get_status(TRT_Identifier)) continue;
+
+			int m_barrel_ec = m_pTRTHelper->barrel_ec(TRT_Identifier);
+			//ToDo: Check TRT_LoLumRawData object
+			const TRT_LoLumRawData *p_lolum = dynamic_cast<const TRT_LoLumRawData *>(*p_rdo);
+
+			if (!p_lolum) continue;
+
+			nhitsall++;
+			int ibe = abs(m_barrel_ec) - 1;
+			int iside = m_barrel_ec > 0 ? 0 : 1;
+
+			//if m_barrel_ec is outof range go to next measurement in rdo_collection
+			if (ibe != 1 && ibe != 0) {
+				ATH_MSG_DEBUG("TRT part retrieved from TRT Identifier is not a barrel or an endcap");
+				continue;
+			}
+
+			int moduleNumber_barrel1[2];
+			int moduleNumber_barrel2[2];
+			int moduleNumber_barrel3[2];
+			int moduleNumber_endcapA[2];
+			int moduleNumber_endcapB[2];
+			// Get TRT Identifier
+			// Need to know phi module, module layer, straw layer, and straw # within the layer
+			// To get proper straw numbering
+			TRT_Identifier = p_lolum->identify();
+			//inline function checks m_ArgonXenonSplitter
+			const bool isArgonStraw = (Straw_Gastype( m_sumSvc->getStatusHT(TRT_Identifier) ) == GasType::Ar);
+			int m_phi_module     = m_pTRTHelper->phi_module(TRT_Identifier);
+			int m_layer_or_wheel = m_pTRTHelper->layer_or_wheel(TRT_Identifier);
+			int m_straw_layer    = m_pTRTHelper->straw_layer(TRT_Identifier);
+			int m_straw          = m_pTRTHelper->straw(TRT_Identifier);
+			int m_strawNumber;
+			int m_chip = 0;
+			int m_board = -1;
+			//ToDo: Check if that is really neccessary
+			bool is_barrel = m_pTRTHelper->is_barrel(TRT_Identifier);
+
+			//check straw number and find the correct m_chip and m_ board values
+			if ( is_barrel && ibe == 0 ) {
+				m_strawNumber = strawNumber(m_straw, m_straw_layer, m_layer_or_wheel);
+
+				if (m_strawNumber >= 0 && m_strawNumber < s_Straw_max[ibe]) {
+					m_chip = mat_chip_B[m_phi_module][m_strawNumber];
+				}
+
+				m_board = chipToBoard(m_chip);
+			} else if ( !is_barrel && ibe == 1 ) {
+				m_strawNumber = strawNumberEndCap(m_straw, m_straw_layer, m_layer_or_wheel, m_phi_module, m_barrel_ec);
+
+				if (m_strawNumber >= 0 && m_strawNumber < s_Straw_max[ibe]) {
+					m_chip = mat_chip_E[m_phi_module][m_strawNumber];
+				}
+
+				m_board = chipToBoard_EndCap(m_chip);
+			} else {
+				m_strawNumber = -1;
+			}
+
+			if (m_strawNumber < 0 || m_strawNumber >= s_Straw_max[ibe]) {
+				ATH_MSG_WARNING("Found m_strawNumber = " << m_strawNumber << " out of range.");
+				continue;
+			}
+
+			//ToDo: rename them (They are clearly not member but have "m_" prefix)
+			const int m_driftTimeBin  = p_lolum->driftTimeBin();
+			const int m_trailingEdge  = p_lolum->trailingEdge();
+			const bool m_highlevel    = is_middleHTbit_high;//Hardcoded Middle Bit
+			const bool m_firstBinHigh = p_lolum->firstBinHigh(); // if the first time bin is up then the hit is out of time window
+			const bool m_lastBinHigh  = p_lolum->lastBinHigh(); // if the last bin is up then the hit is out of time window.
+			const float m_timeOverThreshold = p_lolum->timeOverThreshold();
+			moduleNumber_barrel1[0] = m_phi_module;
+			moduleNumber_barrel1[1] = m_phi_module + 96;
+			moduleNumber_barrel2[0] = m_phi_module + s_numberOfBarrelStacks;
+			moduleNumber_barrel2[1] = m_phi_module + s_numberOfBarrelStacks + 96;
+			moduleNumber_barrel3[0] = m_phi_module + 2 * s_numberOfBarrelStacks;
+			moduleNumber_barrel3[1] = m_phi_module + 2 * s_numberOfBarrelStacks + 96;
+			moduleNumber_endcapA[0] = m_phi_module;
+			moduleNumber_endcapA[1] = m_phi_module + 64;
+			moduleNumber_endcapB[0] = m_phi_module + s_numberOfEndCapStacks;
+			moduleNumber_endcapB[1] = m_phi_module + s_numberOfEndCapStacks + 64;
+			int iphi_module = -999;
+
+			if (iside == 0) {
+				iphi_module = m_phi_module;
+			} else if (iside == 1) {
+				iphi_module = m_phi_module + 32;
+			}
+
+			if (ibe == 0) {
+				nTRTHits[ibe]++;
+
+				if (m_doStraws) {
+					if (isArgonStraw) {
+						m_hHitWMap_B_Ar->Fill(m_strawNumber);
+					} else {
+						m_hHitWMap_B->Fill(m_strawNumber);
+					}
+				}
+
+				if (m_doShift) {
+					nHitsperLB_B++;
+
+					if (m_highlevel) {
+						nHLHitsperLB_B++;
+					}
+				}
+			} else if (ibe == 1) {
+				nTRTHits[ibe]++;
+
+				if (m_doStraws) {
+					if (isArgonStraw) {
+						m_hHitWMap_E_Ar[iside]->Fill(m_strawNumber);
+					} else {
+						m_hHitWMap_E[iside]->Fill(m_strawNumber);
+					}
+				}
+
+				if (m_doShift) {
+					nHitsperLB_E[iside]++;
+
+					if (m_highlevel) {
+						nHLHitsperLB_E[iside]++;
+					}
+				}
+			}
+
+			if (m_doExpert) {
+				if ( (m_driftTimeBin > 2) && (m_driftTimeBin < 17) ) {
+					if (m_doStraws) m_hHitWMapS[ibe][iphi_module]->Fill(m_strawNumber);
+
+					if (m_doChips) m_hHitWMapC[ibe][iphi_module]->Fill(m_chip - 1);
+				}
+
+				float trailingEdgeScaled = (m_trailingEdge + 1) * 3.125;
+
+				if ((m_trailingEdge < 23) && !m_lastBinHigh && !m_firstBinHigh) {
+					if (m_doStraws) m_hHitTrWMapS[ibe][iphi_module]->Fill(m_strawNumber, trailingEdgeScaled);
+
+					if (m_doChips) m_hHitTrWMapC[ibe][iphi_module]->Fill((m_chip - 1), trailingEdgeScaled);
+				}
+
+				if (m_doStraws) m_hHitTrMapS[ibe][iphi_module]->Fill(m_strawNumber, trailingEdgeScaled);
+
+				if (m_doChips) m_hHitTrMapC[ibe][iphi_module]->Fill((m_chip - 1), trailingEdgeScaled);
+
+				if (m_highlevel) {
+					if (m_doStraws) m_hHitHMapS[ibe][iphi_module]->Fill(m_strawNumber);
+
+					if (m_doChips) m_hHitHMapC[ibe][iphi_module]->Fill(m_chip - 1);
+
+					if (is_middleHTbit_high) {
+						if (m_doStraws) m_hHitHWMapS[ibe][iphi_module]->Fill(m_strawNumber);
+
+						if (m_doChips) m_hHitHWMapC[ibe][iphi_module]->Fill(m_chip - 1);
+					}
+				}
+
+				if (m_firstBinHigh || m_lastBinHigh || m_driftTimeBin > 0 || m_trailingEdge < 23) {
+					if (m_doStraws) m_hHitAMapS[ibe][iphi_module]->Fill(m_strawNumber);
+
+					if (m_doChips) m_hHitAMapC[ibe][iphi_module]->Fill(m_chip - 1);
+				}
+
+				if ( is_anybininVgate_high) {
+					if (m_doStraws) m_hHitAWMapS[ibe][iphi_module]->Fill(m_strawNumber);
+
+					if (m_doChips) m_hHitAWMapC[ibe][iphi_module]->Fill(m_chip - 1);
+				}
+
+				if (m_doStraws) {
+					m_hHitToTMapS[ibe][iphi_module]->Fill(m_strawNumber, m_timeOverThreshold);
+
+					if (m_timeOverThreshold > m_longToTCut) {
+						m_hHitToTLongMapS[ibe][iphi_module]->Fill(m_strawNumber, m_timeOverThreshold);
+						m_hHitToTLongTrMapS[ibe][iphi_module]->Fill(m_strawNumber, trailingEdgeScaled);
+					}
+				}
+
+				if (m_doChips) m_hHitToTMapC[ibe][iphi_module]->Fill((m_chip - 1), m_timeOverThreshold);
+
+				if (m_doChips) {
+					if (p_lolum->highLevel(1)) {
+						m_hHtoBCMapC[ibe][iphi_module]->Fill(0., m_chip - 1);
+						m_hHtoBCMapB[ibe][iphi_module]->Fill(0., m_board - 1);
+					}
+
+					if (p_lolum->highLevel(2)) {
+						m_hHtoBCMapC[ibe][iphi_module]->Fill(1., m_chip - 1);
+						m_hHtoBCMapB[ibe][iphi_module]->Fill(1., m_board - 1);
+					}
+
+					if (p_lolum->highLevel(3)) {
+						m_hHtoBCMapC[ibe][iphi_module]->Fill(2., m_chip - 1);
+						m_hHtoBCMapB[ibe][iphi_module]->Fill(2., m_board - 1);
+					}
+				}
+			}
+
+			//Set Module Numbers.
+			int moduleNumber = -1;
+
+			if (ibe == 0) {
+				if (m_layer_or_wheel == 0) {
+					moduleNumber = moduleNumber_barrel1[iside];
+					moduleHits_B[moduleNumber]++;
+				} else if (m_layer_or_wheel == 1) {
+					moduleNumber = moduleNumber_barrel2[iside];
+					moduleHits_B[moduleNumber]++;
+				} else if (m_layer_or_wheel == 2) {
+					moduleNumber = moduleNumber_barrel3[iside];
+					moduleHits_B[moduleNumber]++;
+				}
+
+				if (m_highlevel) {
+					if (m_layer_or_wheel == 0) {
+						moduleNumber = moduleNumber_barrel1[iside];
+						HLmoduleHits_B[moduleNumber]++;
+					} else if (m_layer_or_wheel == 1) {
+						moduleNumber = moduleNumber_barrel2[iside];
+						HLmoduleHits_B[moduleNumber]++;
+					} else if (m_layer_or_wheel == 2) {
+						moduleNumber = moduleNumber_barrel3[iside];
+						HLmoduleHits_B[moduleNumber]++;
+					}
+				}
+			} else if (ibe == 1) {
+				if (m_layer_or_wheel < 6) {
+					moduleNumber = moduleNumber_endcapA[iside];
+					moduleHits_E[moduleNumber]++;
+				} else if (m_layer_or_wheel > 5) {
+					moduleNumber = moduleNumber_endcapB[iside];
+					moduleHits_E[moduleNumber]++;
+				}
+
+				if (m_highlevel) {
+					if (m_layer_or_wheel < 6) {
+						moduleNumber = moduleNumber_endcapA[iside];
+						HLmoduleHits_E[moduleNumber]++;
+					} else if (m_layer_or_wheel > 5) {
+						moduleNumber = moduleNumber_endcapB[iside];
+						HLmoduleHits_E[moduleNumber]++;
+					}
+				}
+			}
+		}
 	}
-      }//if DoExpert
-      //Set Module Numbers.
-      int moduleNumber=-1;
-      if (ibe==0) {// barrel
-	if (m_layer_or_wheel==0) {
-	  moduleNumber=moduleNumber_barrel1[iside];
-	  moduleHits_B[moduleNumber]++;
-	} else if (m_layer_or_wheel==1) {
-	  moduleNumber=moduleNumber_barrel2[iside];
-	  moduleHits_B[moduleNumber]++;
-	} else if (m_layer_or_wheel==2) {
-	  moduleNumber=moduleNumber_barrel3[iside];
-	  moduleHits_B[moduleNumber]++;
+
+	m_hOccAll->Fill(nhitsall / 350848.);
+
+	//ToDo Explain this
+	for (int ibe = 0; ibe < 2; ibe++) {
+		if (m_doShift) {
+			if (ibe == 0) {
+				m_hBCIDvsOcc[ibe]->Fill(m_good_bcid, nTRTHits[ibe] / 105088.0);
+			} else if (ibe == 1) {
+				m_hBCIDvsOcc[ibe]->Fill(m_good_bcid, nTRTHits[ibe] / 245760.0);
+			}
+
+			for (int iside = 0; iside < 2; iside++) {
+				for (int i = 1; i <= numberOfStacks_b[ibe]; i++) {
+					int index_tmp, modulenum_tmp;
+
+					if (iside == 0) {
+						index_tmp = i - 1;
+						modulenum_tmp = i - 1;
+					} else if (iside == 1) {
+						index_tmp = i + 31;
+
+						if (ibe == 0) modulenum_tmp = (i - 1) + 96;
+						else if (ibe == 1) modulenum_tmp = (i - 1) + 64;
+					}
+
+					int nclass = -1;
+
+					if (i <= s_numberOfBarrelStacks) {
+						nclass = 0;
+					} else if (i <= 2 * s_numberOfBarrelStacks && i > s_numberOfBarrelStacks) {
+						nclass = 1;
+					} else if (i > 2 * s_numberOfBarrelStacks) {
+						nclass = 2;
+					}
+
+					int LLocc_index = index_tmp - 32 * nclass;
+
+					if (nclass >= 0) {
+						if (ibe == 0) {
+							float occLL = float(moduleHits_B[modulenum_tmp]) / float(numberOfStrawsMod[nclass]);
+							float occHL = float(HLmoduleHits_B[modulenum_tmp]) / float(numberOfStrawsMod[nclass]);
+							m_LLOcc[ibe][LLocc_index] += occLL;
+							m_hAvgLLOcc_side[ibe][iside]->Fill(i - (32 * nclass), occLL);
+							m_hAvgHLOcc_side[ibe][iside]->Fill(i - (32 * nclass), occHL);
+							m_hAvgLLOccMod_side[ibe][iside]->Fill(i, occLL);
+							m_hAvgHLOccMod_side[ibe][iside]->Fill(i, occHL);
+						} else if (ibe == 1) {
+							float occLL = float(moduleHits_E[modulenum_tmp]) / float(numberOfStrawsWheel[nclass]);
+							float occHL = float(HLmoduleHits_E[modulenum_tmp]) / float(numberOfStrawsWheel[nclass]);
+
+							if (LLocc_index < 64) {
+								m_LLOcc[ibe][LLocc_index] += occLL;
+							} else {
+								ATH_MSG_WARNING("m_LLOcc index out of bounds!"); // To satisfy Coverity defect CID 16514 which we believe is a false report.
+							}
+
+							m_hAvgLLOcc_side[ibe][iside]->Fill(i - (32 * nclass), occLL);
+							m_hAvgHLOcc_side[ibe][iside]->Fill(i - (32 * nclass), occHL);
+							m_hAvgLLOccMod_side[ibe][iside]->Fill(i, occLL);
+							m_hAvgHLOccMod_side[ibe][iside]->Fill(i, occHL);
+						}
+					}
+				}
+			}
+		}
+
+		//Normalization for online environmenmet
+		if (m_environment == AthenaMonManager::online) {
+			//Loop over stack histograms and normalize to number of events processed.
+			if (m_doChips && m_doExpert) {
+				for (int i = 0; i < 64; i++) {
+					for (int j = 0; j < s_iChip_max[ibe]; j++) {
+						m_hChipOcc[ibe][i]->Fill(m_hHitAMapC[ibe][i]->GetBinContent(j + 1));
+					}
+
+					if (m_totalEvents > 0) {
+						const float scale = 1. / (16 * m_totalEvents);
+						scale_LWHist(m_hHitHWMapC[ibe][i], scale);
+						scale_LWHist(m_hHitWMapC[ibe][i], scale);
+						scale_LWHist(m_hHitAMapC[ibe][i], scale);
+						scale_LWHist(m_hHitAWMapC[ibe][i], scale);
+						scale_LWHist(m_hHitHMapC[ibe][i], scale);
+					}
+				}
+			}
+
+			if (m_doStraws && m_doShift && m_totalEvents > 0) {
+				if (ibe == 0) {
+					initScaleVectors();
+					vector<float> scalevector;
+					vector<float> scalevector_Ar;
+
+					for (int k = 0; k < s_Straw_max[0]; k++) {
+						try {
+							if (m_scale_hHitWMap_B.at(k) == 0.) {
+								scalevector.push_back(0.);
+							} else {
+								scalevector.push_back(1. / (m_totalEvents * m_scale_hHitWMap_B.at(k)));
+							}
+
+							if (m_scale_hHitWMap_B_Ar.at(k) == 0.) {
+								scalevector_Ar.push_back(0.);
+							} else {
+								scalevector_Ar.push_back(1. / (m_totalEvents * m_scale_hHitWMap_B_Ar.at(k)));
+							}
+						} catch (out_of_range &e) {
+							ATH_MSG_ERROR("Index " << k << " out of range in scaling for hHitWMap");
+						}
+					}
+
+					scale_LWHistWithScaleVector(m_hHitWMap_B, scalevector);
+
+					if (m_ArgonXenonSplitter) {
+						scale_LWHistWithScaleVector(m_hHitWMap_B_Ar, scalevector_Ar);
+					}
+				} else if (ibe == 1) {
+					float eventScale = 1. / (32 * m_totalEvents);
+					scale_LWHist(m_hHitWMap_E[0], eventScale);
+					scale_LWHist(m_hHitWMap_E[1], eventScale);
+
+					if (m_ArgonXenonSplitter) {
+						scale_LWHist(m_hHitWMap_E_Ar[0], eventScale);
+						scale_LWHist(m_hHitWMap_E_Ar[1], eventScale);
+					}
+				}
+			}
+
+			if (m_doStraws) {
+				for (int i = 0; i < 64; i++) {
+					if (m_doExpert && m_totalEvents > 0) {
+						const float scale = 1. / m_totalEvents;
+						scale_LWHist(m_hHitHWMapS[ibe][i], scale);
+						scale_LWHist(m_hHitWMapS[ibe][i], scale);
+						scale_LWHist(m_hHitAMapS[ibe][i], scale);
+						scale_LWHist(m_hHitAWMapS[ibe][i], scale);
+						scale_LWHist(m_hHitHMapS[ibe][i], scale);
+					}
+
+					for (int j = 0; j < s_iChip_max[ibe]; j++) {
+						if (m_doExpert) {
+							m_hStrawOcc[ibe][i]->Fill(m_hHitAMapS[ibe][i]->GetBinContent(j + 1));
+						}
+					}
+				}
+			}
+		}
 	}
-	if (m_highlevel) {
-	  if (m_layer_or_wheel==0) {
-	    moduleNumber=moduleNumber_barrel1[iside];
-	    HLmoduleHits_B[moduleNumber]++;
-	  } else if (m_layer_or_wheel==1) {
-	    moduleNumber=moduleNumber_barrel2[iside];
-	    HLmoduleHits_B[moduleNumber]++;
-	  } else if (m_layer_or_wheel==2) {
-	    moduleNumber=moduleNumber_barrel3[iside];
-	    HLmoduleHits_B[moduleNumber]++;
-	  }
-	}//if HL hit
-
-      } else if (ibe==1) { //endcap
-	if (m_layer_or_wheel<6) { //WheelA (0-5)
-	  moduleNumber=moduleNumber_endcapA[iside];
-	  moduleHits_E[moduleNumber]++;
-	} else if (m_layer_or_wheel>5) { //WheelB  (6-13)
-	  moduleNumber=moduleNumber_endcapB[iside];
-	  moduleHits_E[moduleNumber]++;
+
+	if (m_environment == AthenaMonManager::online) {
+		if (m_doShift) m_hSummary->SetBinContent(1, m_totalEvents);
 	}
-	if (m_highlevel) {
-	  if (m_layer_or_wheel<6) { //WheelA (0-5)
-	    moduleNumber=moduleNumber_endcapA[iside];
-	    HLmoduleHits_E[moduleNumber]++;
-	  } else if (m_layer_or_wheel>5) { //WheelB  (6-13)
-	    moduleNumber=moduleNumber_endcapB[iside];
-	    HLmoduleHits_E[moduleNumber]++;
-	  }
-	}//if HL hit
-      } // else if (ibe==1)
-    } //Loop over rdo trt collection
-  }//Loop over RDO Collection
-
-  m_hOccAll->Fill(nhitsall/350848.);
-  //ToDo Explain this
-  for (int ibe=0; ibe<2; ibe++) {
-    if (DoShift) {
-      if (ibe==0) {
-        m_hBCIDvsOcc[ibe]->Fill(good_bcid,(nTRTHits[ibe]/105088.0));
-      } else if (ibe==1) {
-        m_hBCIDvsOcc[ibe]->Fill(good_bcid,(nTRTHits[ibe]/245760.0));
-      }
-
-      for (int iside=0; iside<2; iside++) {
-        for (int i=1; i<=numberOfStacks_b[ibe]; i++) {
-          int index_tmp, modulenum_tmp;
-          if (iside==0) {
-            index_tmp=i-1;
-            modulenum_tmp=i-1;
-          } else if (iside==1) {
-            index_tmp=i+31;
-            if (ibe==0) modulenum_tmp=(i-1)+96;
-            else if (ibe==1) modulenum_tmp=(i-1)+64;
-          }
-          int nclass=-1;
-          if (i<=s_numberOfBarrelStacks) {
-            nclass=0;
-          } else if (i<=2*s_numberOfBarrelStacks && i>s_numberOfBarrelStacks) {
-            nclass=1;
-          } else if (i>2*s_numberOfBarrelStacks) {
-            nclass=2;
-          }
-	  int LLocc_index = index_tmp-32*nclass;
-
-          if (nclass>=0) {
-            if (ibe==0) {
-              m_LLOcc[ibe][LLocc_index] += float(moduleHits_B[modulenum_tmp])/float(numberOfStrawsMod[nclass]);
-              m_hAvgLLOcc_side[ibe][iside]->Fill(i-(32*nclass), (float(moduleHits_B[modulenum_tmp])/float(numberOfStrawsMod[nclass])));       //Avg. Occupancy
-              m_hAvgHLOcc_side[ibe][iside]->Fill(i-(32*nclass), (float(HLmoduleHits_B[modulenum_tmp])/float(numberOfStrawsMod[nclass])));     //Avg. Occupancy
-              m_hAvgLLOccMod_side[ibe][iside]->Fill(i, (float(moduleHits_B[modulenum_tmp])/float(numberOfStrawsMod[nclass])));       //Avg. Occupancy
-              m_hAvgHLOccMod_side[ibe][iside]->Fill(i, (float(HLmoduleHits_B[modulenum_tmp])/float(numberOfStrawsMod[nclass])));     //Avg. Occupancy
-            } else if (ibe==1) {
-	      if (LLocc_index<64) { 
-		m_LLOcc[ibe][LLocc_index] += float(moduleHits_E[modulenum_tmp])/float(numberOfStrawsWheel[nclass]);
-	      } else {
-		ATH_MSG_WARNING("m_LLOcc index out of bounds!"); // To satisfy Coverity defect CID 16514 which we believe is a false report.
-	      }
-              m_hAvgLLOcc_side[ibe][iside]->Fill(i-(32*nclass), (float(moduleHits_E[modulenum_tmp])/float(numberOfStrawsWheel[nclass])));       //Avg. Occupancy
-              m_hAvgHLOcc_side[ibe][iside]->Fill(i-(32*nclass), (float(HLmoduleHits_E[modulenum_tmp])/float(numberOfStrawsWheel[nclass])));     //Avg. Occupancy
-              m_hAvgLLOccMod_side[ibe][iside]->Fill(i, (float(moduleHits_E[modulenum_tmp])/float(numberOfStrawsWheel[nclass])));       //Avg. Occupancy
-              m_hAvgHLOccMod_side[ibe][iside]->Fill(i, (float(HLmoduleHits_E[modulenum_tmp])/float(numberOfStrawsWheel[nclass])));     //Avg. Occupancy
-            }
-          } //if (nclass>=0)
-        } //for (int i=1; i<=numberOfStacks_b[ibe]; i++)
-      } //for (int iside=0; iside<2; iside++)
-    } //if DoShift
-
-    //Normalization for online environmenmet
-    if (m_environment == AthenaMonManager::online) {
-      //Loop over stack histograms and normalize to number of events processed.
-      if (DoChips && DoExpert) {
-        for (int i=0; i<64; i++) {
-          for (int j=0; j<s_iChip_max[ibe]; j++) m_hChipOcc[ibe][i]->Fill(m_hHitAMapC[ibe][i]->GetBinContent(j+1));
-          if (nEvents > 0) {
-            const float scale = 1./(16*nEvents);
-            scale_LWHist(m_hHitHWMapC[ibe][i], scale);
-            scale_LWHist(m_hHitWMapC[ibe][i],  scale);
-            scale_LWHist(m_hHitAMapC[ibe][i],  scale);
-            scale_LWHist(m_hHitAWMapC[ibe][i], scale);
-            scale_LWHist(m_hHitHMapC[ibe][i],  scale);
-          }
-        }//Loop over A side and C side Stacks
-      }//if DoChips && DoExpert
-      
-      if (DoStraws) {
-        if (DoShift && nEvents > 0) {
-          if (ibe==0) {
-	    m_initScaleVectors();
-	    vector<float> scalevector;
-	    vector<float> scalevector_Ar;
-	    for(int k =0;k<s_Straw_max[0];k++){
-	      try {
-		if (m_scale_hHitWMap_B.at(k)==0.)
-		  scalevector.push_back(0.);
-		else
-		  scalevector.push_back(1./(nEvents*m_scale_hHitWMap_B.at(k)));
-		//for argon
-		if (m_scale_hHitWMap_B_Ar.at(k)==0.)
-		  scalevector_Ar.push_back(0.);
-		else
-		  scalevector_Ar.push_back(1./(nEvents*m_scale_hHitWMap_B_Ar.at(k)));
-	      } catch (out_of_range& e) {
-		ATH_MSG_ERROR("Index " << k << " out of range in scaling for hHitWMap");
-	      }
-	    }
-            scale_LWHistWithScaleVector(m_hHitWMap_B, scalevector);
-            if (m_ArgonXenonSplitter) {
-              scale_LWHistWithScaleVector(m_hHitWMap_B_Ar, scalevector_Ar);
-	    }
-	  } else if (ibe==1) {
-	    scale_LWHist(m_hHitWMap_E[0], 1./(32*nEvents));
-	    scale_LWHist(m_hHitWMap_E[1], 1./(32*nEvents));
-	    if (m_ArgonXenonSplitter) {
-	      scale_LWHist(m_hHitWMap_E_Ar[0], 1. / (32 * nEvents));
-	      scale_LWHist(m_hHitWMap_E_Ar[1], 1. / (32 * nEvents));
-	    }
-	  }
-	} // DoShift && nEvents > 0
-
-	for (int i=0; i<64; i++) {
-	  if (DoExpert && nEvents > 0) {
-	    const float scale = 1./nEvents;
-	    scale_LWHist(m_hHitHWMapS[ibe][i], scale);
-	    scale_LWHist(m_hHitWMapS[ibe][i],  scale);
-	    scale_LWHist(m_hHitAMapS[ibe][i],  scale);
-	    scale_LWHist(m_hHitAWMapS[ibe][i], scale);
-	    scale_LWHist(m_hHitHMapS[ibe][i],  scale);
-	  } // DoExpert && nEvents > 0
-	  for (int j=0; j<s_iChip_max[ibe]; j++) {
-	    if (DoExpert) m_hStrawOcc[ibe][i]->Fill(m_hHitAMapS[ibe][i]->GetBinContent(j+1));
-	  }
-	} //Loop over A side and B side Stacks: for (int i=0; i<64; i++)
-      } // DoStraws
-    }//If online environment
-
-  }// for (int ibe=0; ibe<2; ibe++)
-
-
-  if (m_environment == AthenaMonManager::online) {
-    if (DoShift) m_hSummary->SetBinContent(1, nEvents);
-  }
-
-  ATH_MSG_VERBOSE("Leaving Fill TRT RDO Histograms");
-  return StatusCode::SUCCESS;
-}//Fill_TRT_RDOs()
-
-
-//Get the TRT Track Collections from store gate
-//----------------------------------------------------------------------------------//
-StatusCode TRT_Monitoring_Tool::Retrieve_TRT_Tracks()
-//----------------------------------------------------------------------------------//
-{
-  ATH_MSG_VERBOSE("Retrieving TRT Tracks Container from StoreGate");
-  if (evtStore()->contains<TrackCollection>(m_tracksObjectName)) {
-    if (evtStore()->retrieve(m_trkCollection, m_tracksObjectName).isFailure()) {
-      ATH_MSG_ERROR("Could not find Tracks Collection");
-      return StatusCode::FAILURE;
-    } else {
-      ATH_MSG_VERBOSE("Tracks retrieved from StoreGate");
-    }
-  } else {
-    ATH_MSG_WARNING("No TrackCollection by the name of "<<m_tracksObjectName<<" in storegate");
-    return StatusCode::FAILURE;
-  }
-
-  if (evtStore()->contains<ComTime>(m_comTimeObjectName)) {
-    if (evtStore()->retrieve(theComTime, m_comTimeObjectName).isFailure()) {
-      ATH_MSG_DEBUG("ComTime object not found with name " << m_comTimeObjectName << ".");
-      theComTime = 0; // protection for later on
-    } else {
-      ATH_MSG_DEBUG("ComTime object found successfully");
-    }
-  } else {
-    ATH_MSG_DEBUG("No ComTime object found in storegate.");
-    theComTime = 0;
-  }
-  return StatusCode::SUCCESS;
-}//Retrieve_TRT_Tracks()
+
+	ATH_MSG_VERBOSE("Leaving Fill TRT RDO Histograms");
+	return StatusCode::SUCCESS;
+}
 
 //Fill the TRT Track level histograms
 //----------------------------------------------------------------------------------//
-StatusCode TRT_Monitoring_Tool::Fill_TRT_Tracks()
+StatusCode TRT_Monitoring_Tool::fillTRTTracks(const TrackCollection& trackCollection,
+                                              const xAOD::TrigDecision* trigDecision,
+                                              const ComTime* comTimeObject) {
 //----------------------------------------------------------------------------------//
-{
-  ATH_MSG_VERBOSE("Filling TRT Tracks Histos");
-
-  //Initialize a bunch of stuff before looping over the track collection. Fill some basic histograms.
-  const float timeCor = theComTime ? theComTime->getTime() : 0;
-
-  DataVector<Trk::Track>::const_iterator p_trk;
-
-  //const Trk::MeasuredPerigee* m_mPer = NULL;
-  const Trk::Perigee* m_mPer = NULL;
-  const DataVector<const Trk::TrackParameters>* AllTrkPar(0);
-  DataVector<const Trk::TrackParameters>::const_iterator p_trkpariter;
-  //No Need for sectorflag anymore
-  /*
-    const int sectorflag[2][2] = {
-    { +1, -1 }, // Barrel A, Barrel C
-    { +2, -2 }  // Endcap A, Endcap C
-    };
-  */
-
-  //Take out normalization of previous event for online environment
-  //Explanation: While online monitoring running we need to present out histograms repeatedly so we need to pay attention to normalization.
-  //before adding any information from new event to normalized histograms we need to take out the normalization of the previous event by scaling histograms back.
-  //After  we are done with filling those histograms we will normalize them again
-  if (m_environment == AthenaMonManager::online) {
-    for (int ibe=0; ibe<2; ibe++) { //ibe=0(barrel), ibe=1(endcap)
-      if (DoChips && DoExpert) {
-        for (int i=0; i<64; i++) {
-          for (int j=0; j<s_iChip_max[ibe]; j++) {
-            if (m_hChipsEff[ibe][i]->GetBinEntries(j+1) > 0) {
-              m_hHitAonTMapC[ibe][i]->SetBinContent(j+1, m_hHitAonTMapC[ibe][i]->GetBinContent(j+1)*m_hChipsEff[ibe][i]->GetBinEntries(j+1));
-              m_hHitWonTMapC[ibe][i]->SetBinContent(j+1, m_hHitWonTMapC[ibe][i]->GetBinContent(j+1)*m_hChipsEff[ibe][i]->GetBinEntries(j+1));
-              m_hHitAWonTMapC[ibe][i]->SetBinContent(j+1, m_hHitAWonTMapC[ibe][i]->GetBinContent(j+1)*m_hChipsEff[ibe][i]->GetBinEntries(j+1));
-              m_hHitHonTMapC[ibe][i]->SetBinContent(j+1, m_hHitHonTMapC[ibe][i]->GetBinContent(j+1)*m_hChipsEff[ibe][i]->GetBinEntries(j+1));
-              m_hHitHWonTMapC[ibe][i]->SetBinContent(j+1, m_hHitHWonTMapC[ibe][i]->GetBinContent(j+1)*m_hChipsEff[ibe][i]->GetBinEntries(j+1));
-            }
-          }//for (int j=0; j<s_iChip_max[ibe]; j++)
-        }//Loop over A side and C side Stacks: for (int i=0; i<64; i++)
-      }//if DoChips && DoExpert
-      if (DoStraws) {
-        for (int i=0; i<64; i++) {
-          for (int j=0; j<s_Straw_max[ibe]; j++) {
-
-            if (ibe==0) { // barrel
-              if (i==0 && m_nStrawHits_B[j]>0) {
-                m_hHitWonTMap_B->SetBinContent(j+1, m_hHitWonTMap_B->GetBinContent(j+1)*(m_nStrawHits_B[j]));
-              }
-            } else if (ibe==1) { // endcap
-              for (int iside=0; iside<2; iside++) {
-                if (i==0 && m_nStrawHits_E[iside][j]>0) {
-                  m_hHitWonTMap_E[iside]->SetBinContent(j+1,m_hHitWonTMap_E[iside]->GetBinContent(j+1)*(m_nStrawHits_E[iside][j]));
-                }
-              }
-            }
-
-            if (DoExpert) {
-              if (m_hStrawsEff[ibe][i]->GetBinEntries(j+1)>0) {
-                m_hHitAWonTMapS[ibe][i]->SetBinContent(j+1, m_hHitAWonTMapS[ibe][i]->GetBinContent(j+1)*m_hStrawsEff[ibe][i]->GetBinEntries(j+1));
-                m_hHitAonTMapS[ibe][i]->SetBinContent(j+1, m_hHitAonTMapS[ibe][i]->GetBinContent(j+1)*m_hStrawsEff[ibe][i]->GetBinEntries(j+1));
-                m_hHitHonTMapS[ibe][i]->SetBinContent(j+1, m_hHitHonTMapS[ibe][i]->GetBinContent(j+1)*m_hStrawsEff[ibe][i]->GetBinEntries(j+1));
-                m_hHitWonTMapS[ibe][i]->SetBinContent(j+1, m_hHitWonTMapS[ibe][i]->GetBinContent(j+1)*m_hStrawsEff[ibe][i]->GetBinEntries(j+1));
-              }
-            }//DoExpert
-          }//for (int j=0; j<s_Straw_max[ibe]; j++)
-        }//Loop over A side and C side Stacks: for (int i=0; i<64; i++)
-      }//DoStraws
-    }//for (int ibe=0; ibe<2; ibe++)
-
-    if (DoShift) {
-      scale_LWHist(m_hEvtPhase,EventPhaseScale);
-      scale_LWHist(m_hDriftTimeonTrkDist_B, DriftTimeonTrkDistScale_B);
-      scale_LWHist(m_hHLhitOnTrack_B, HLhitOnTrackScale_B);
-      scale_LWHist(m_hHtoLRatioOnTrack_B, HtoLRatioOnTrackScale_B);
-      scale_LWHist(m_hNumSwLLWoT_B, NumSwLLWoTScale_B);
-      scale_LWHist(m_hWireToTrkPosition_B, WireToTrkPositionScale_B);
-      scale_LWHist(m_hTronTDist_B, TronTDistScale_B);
-      scale_LWHist(m_hResidual_B, ResidualScale_B);
-      scale_LWHist(m_hResidual_B_20GeV, ResidualScale_B_20GeV);
-      scale_LWHist(m_hTimeResidual_B, TimeResidualScale_B);
-      if (m_ArgonXenonSplitter) {
-        scale_LWHist(m_hDriftTimeonTrkDist_B_Ar, DriftTimeonTrkDistScale_B_Ar);
-	scale_LWHist(m_hWireToTrkPosition_B_Ar, WireToTrkPositionScale_B_Ar);
-        scale_LWHist(m_hTronTDist_B_Ar, TronTDistScale_B_Ar);
-        scale_LWHist(m_hResidual_B_Ar, ResidualScale_B_Ar);
-        scale_LWHist(m_hResidual_B_Ar_20GeV, ResidualScale_B_Ar_20GeV);
-        scale_LWHist(m_hTimeResidual_B_Ar, TimeResidualScale_B_Ar);
-      }
-      for (int iside=0; iside<2; iside++) {
-        scale_LWHist(m_hDriftTimeonTrkDist_E[iside], DriftTimeonTrkDistScale_E[iside]);
-        scale_LWHist(m_hHLhitOnTrack_E[iside], HLhitOnTrackScale_E[iside]);
-        scale_LWHist(m_hHtoLRatioOnTrack_E[iside], HtoLRatioOnTrackScale_E[iside]);
-        scale_LWHist(m_hNumSwLLWoT_E[iside], NumSwLLWoTScale_E[iside]);
-        scale_LWHist(m_hWireToTrkPosition_E[iside], WireToTrkPositionScale_E[iside]);
-        scale_LWHist(m_hTronTDist_E[iside], TronTDistScale_E[iside]);
-        scale_LWHist(m_hResidual_E[iside], ResidualScale_E[iside]);
-	scale_LWHist(m_hResidual_E_20GeV[iside], ResidualScale_E_20GeV[iside]);
-        scale_LWHist(m_hTimeResidual_E[iside], TimeResidualScale_E[iside]);
-        if (m_ArgonXenonSplitter) {
-          scale_LWHist(m_hDriftTimeonTrkDist_E_Ar[iside], DriftTimeonTrkDistScale_E_Ar[iside]);
-	  scale_LWHist(m_hWireToTrkPosition_E_Ar[iside], WireToTrkPositionScale_E_Ar[iside]);
-          scale_LWHist(m_hTronTDist_E_Ar[iside], TronTDistScale_E_Ar[iside]);
-          scale_LWHist(m_hResidual_E_Ar[iside], ResidualScale_E_Ar[iside]);
-          scale_LWHist(m_hResidual_E_Ar_20GeV[iside], ResidualScale_E_Ar_20GeV[iside]);
-          scale_LWHist(m_hTimeResidual_E_Ar[iside], TimeResidualScale_E_Ar[iside]);
-        }
-      }
-    } //DoShift
-  }//if online environment
-
-  int ntrackstack[2][64];
-  for (int ibe=0; ibe<2; ibe++) {
-    std::fill(ntrackstack[ibe], ntrackstack[ibe] + 64, 0);
-  }
-
-  for (p_trk = m_trkCollection->begin(); p_trk != m_trkCollection->end(); ++p_trk) {
-
-    const std::auto_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->createSummary(*(*p_trk)));
-    int m_nTRTHits = summary->get(Trk::numberOfTRTHits);
-    if (m_nTRTHits < m_minTRThits) continue;
-
-    AllTrkPar = (*p_trk)->trackParameters();
-
-    // Search of MeasuredPerigee in TrackParameters
-    // The following algorithm only finds the First perigee measurement.
-    // As there should be one and only one perigee measurement then this assumption should be valid.
-    // But no check is done to see if there is more than one perigee measurement.
-    for (p_trkpariter = AllTrkPar->begin(); p_trkpariter != AllTrkPar->end(); ++p_trkpariter) {
-      //if track parameter does have a measured perigee then the track parameter is a keeper and break out of the loop
-      //if ((m_mPer = dynamic_cast<const Trk::MeasuredPerigee*>(*p_trkpariter))) break;
-      if ((m_mPer = dynamic_cast<const Trk::Perigee*>(*p_trkpariter))) break;
-    }
-
-    //if you went through all of the track parameters and found no perigee mearsurement
-    //then something is wrong with the track and so don't use the track.
-    //i.e. continue to the next track.
-    if (!m_mPer) continue;
-
-    // DEPRECATED!! CLHEP::HepVector VectPerig = m_mPer->parameters();
-    //AmgVector(5)	 VectPerig = m_mPer->parameters();
-    float m_theta   =  m_mPer->parameters()[Trk::theta];
-    float m_p       =  (m_mPer->parameters()[Trk::qOverP] != 0.) ? fabs(1./(m_mPer->parameters()[Trk::qOverP])) : 10e7;
-    float m_pT      =  (m_p * sin(m_theta));
-    m_pT = m_pT/1000.;  // GeV
-
-    if (m_p < m_minP) continue;
-
-    const DataVector<const Trk::TrackStateOnSurface>* trackStates = (**p_trk).trackStateOnSurfaces();
-    if (trackStates == 0) continue;
-
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItBegin0    = trackStates->begin();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItBegin     = trackStates->begin();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItBeginTemp = trackStates->begin();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItEnd       = trackStates->end();
-
-    // int n_pixel_hits = 0;
-    // int n_sct_hits = 0;
-    // int n_trt_hits = 0;
-    // for (DataVector<const Trk::TrackStateOnSurface>::const_iterator it = trackStates->begin(); it != trackStates->end(); ++it) {
-    //   if ((*it)->type(Trk::TrackStateOnSurface::Measurement)) {
-    //     if      (dynamic_cast<const InDet::TRT_DriftCircleOnTrack*> ((*it)->measurementOnTrack())) n_trt_hits++;
-    //     else if (dynamic_cast<const InDet::SCT_ClusterOnTrack*>    ((*it)->measurementOnTrack())) n_sct_hits++;
-    //     else if (dynamic_cast<const InDet::PixelClusterOnTrack*>   ((*it)->measurementOnTrack())) n_pixel_hits++;
-    //   }
-    // }
-    int n_trt_hits = summary->get(Trk::numberOfTRTHits);
-    int n_sct_hits = summary->get(Trk::numberOfSCTHits);
-    int n_pixel_hits = summary->get(Trk::numberOfPixelHits);
-    const int n_si_hits = n_pixel_hits + n_sct_hits;
-
-    bool is_pT_over_20GeV=false;
-    if (m_mPer->pT() > 20 * CLHEP::GeV)
-      {is_pT_over_20GeV=true;}
-    else
-      {is_pT_over_20GeV=false;}
-    const bool cnst_is_pT_over_20GeV=is_pT_over_20GeV;
-
-    ///hardcoded cut for pT 2.0 GeV for collision setup
-    float min_pt_new=m_min_pT;
-    if(m_isCosmics==false){
-      min_pt_new=2.0 * CLHEP::GeV;
-    }///
-
-    const bool passed_track_preselection =
-      (m_mPer->pT() > min_pt_new)&&
-      (m_p > m_minP) &&
-      (n_si_hits >= m_min_si_hits) &&
-      (n_pixel_hits >= m_min_pixel_hits)&&
-      (n_sct_hits >= m_min_sct_hits)&&
-      (n_trt_hits >= m_min_trt_hits);
-
-    if (!passed_track_preselection) continue;
-
-    m_nTotalTracks++;
-
-    int checkB[2]    ={0,0};
-    int checkEC[2]   ={0,0};
-    int checkEC_B[2] ={0,0};
-    /*for (int iside=0; iside<2; iside++) {
-      checkB[iside]=0;
-      checkEC[iside]=0;
-      checkEC_B[iside]=0;
-      }*/
-    int m_nTRTHitsW[2][2]  ,m_nTRTHitsW_Ar[2][2]  ,m_nTRTHitsW_Xe[2][2];
-    int m_nTRTHLHitsW[2][2],m_nTRTHLHitsW_Ar[2][2],m_nTRTHLHitsW_Xe[2][2];
-    int  m_nTRTHits_side[2][2];
-    //int m_nTRTHitsW_permodule[2][3], m_nTRTHLHitsW_permodule[2][3]; //barrel
-    int m_nTRTHitsW_perwheel[2][18] ; // endcap
-    
-    int hitontrack[2]       ={0,0};
-    int hitontrack_E_side[2] ={0,0};
-    //int hitontrack[2];
-    //int hitontrack_E_side[2];
-
-    for (int ibe=0; ibe<2; ibe++) {
-      // hitontrack[ibe]=0;
-      for (int iside=0; iside<2; iside++) {
-        m_nTRTHits_side[ibe][iside]=-1;
-        m_nTRTHitsW[ibe][iside]=0;
-        m_nTRTHitsW_Ar[ibe][iside]=0;
-	m_nTRTHitsW_Xe[ibe][iside]=0;
-	m_nTRTHLHitsW[ibe][iside]=0;
-        m_nTRTHLHitsW_Ar[ibe][iside]=0;
-	m_nTRTHLHitsW_Xe[ibe][iside]=0;
-	//hitontrack_E_side[iside]=0;
-
-	//        std::fill(m_nTRTHitsW_perwheel[iside], m_nTRTHitsW_perwheel[iside] + 18, 0);
-      }
-      std::fill(m_nTRTHitsW_perwheel[ibe], m_nTRTHitsW_perwheel[ibe] + 18, 0);
-    }
-
-    //    for (int ibe=0; ibe<2; ibe++) { // this was  loops avoidable
-    //    It only cost only some changes
-
-    bool isBarrelOnly = true;
-    bool ECAhit = false, ECChit = false, Bhit = false;
-
-    int m_barrel_ec      = 0;
-    int m_layer_or_wheel = 0;
-    int m_phi_module     = 0;
-    int m_straw_layer    = 0;
-    int m_straw          = 0;
-    //following 5 arrays were normal variables  
-    //They are changed into arrays of the same variable  
-    int m_nearest_straw_layer[2] = {100,100}; 
-    int m_nearest_straw[2]       = {0,0};
-    int testLayer[2]             = {100,100};
-    int innerstack[2]            = {-999,-999};
-    float m_phi2D[2]             = {-100,-100};
-
-    //find det, phi of track:
-    // Means loop over all measurements on track to find phi of inner most hit
-    for (TSOSItBeginTemp = TSOSItBegin0; TSOSItBeginTemp != TSOSItEnd; ++TSOSItBeginTemp) {
-
-      if ((*TSOSItBeginTemp) == 0)continue;
-      if (! ((*TSOSItBeginTemp)->type(Trk::TrackStateOnSurface::Measurement)) ) continue;
-      const InDet::TRT_DriftCircleOnTrack *trtCircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>((*TSOSItBeginTemp)->measurementOnTrack());
-      if (!trtCircle) continue;
-      const Trk::TrackParameters *aTrackParam = dynamic_cast<const Trk::TrackParameters*>((*TSOSItBeginTemp)->trackParameters());
-      if (!aTrackParam) continue;
-
-      Identifier DCoTId = trtCircle->identify();
-      m_barrel_ec      = m_pTRTHelper->barrel_ec(DCoTId);
-      int ibe   = abs(m_barrel_ec)-1;// ibe =0 barrel , ibe =1 encap
-      //int iside = m_barrel_ec > 0 ? 0:1;//iside= 0 side_A , iside = 1 side_C
-      m_layer_or_wheel = m_pTRTHelper->layer_or_wheel (DCoTId);
-      //
-      m_straw_layer    = m_pTRTHelper->straw_layer(DCoTId);
-      //straw number in straw layer
-      m_straw          = m_pTRTHelper->straw(DCoTId); 
-
-      //restrict ourselves to the inner most TRT layers To get detector phi.
-      if (m_layer_or_wheel >= testLayer[ibe]) continue;
-      testLayer[ibe] = m_layer_or_wheel; 
-      // if strawlayer of the straw  is less than previous one
-      if (m_straw_layer<m_nearest_straw_layer[ibe]) {
-	m_nearest_straw_layer[ibe] = m_straw_layer;
-	m_nearest_straw[ibe]       = m_straw;
-	// find the phi of the straw in degrees 
-	const InDetDD::TRT_BaseElement* circleElement = NULL;
-	circleElement = trtCircle->detectorElement();
-	m_phi2D[ibe]       = radToDegrees(circleElement->strawCenter(m_nearest_straw[ibe]).phi());
-	circleElement = NULL;
-	//phi module that the straw belongs
-	innerstack[ibe]    = m_pTRTHelper->phi_module(DCoTId);
-      }//if (m_straw_layer<m_nearest_straw_layer[ibe])
-    }//loop over TSOS 
-
-
-    if (m_phi2D[0] == -999) {
-      ATH_MSG_DEBUG("Track did not go through inner layer of Barrel.");
-    } else {
-      ATH_MSG_VERBOSE("Track's closest approach is m_layer_or_wheel: "<<testLayer[0]<<" m_straw_layer: "<<m_nearest_straw_layer[0]<<" (in the Barrel).");
-    }
-    if (m_phi2D[1] == -999) {
-      ATH_MSG_DEBUG("Track did not go through any inner layer of EndCap A or C.");
-    } else {
-      ATH_MSG_VERBOSE("Track's closest approach is m_layer_or_wheel: "<<testLayer[1]<<" m_straw_layer: "<<m_nearest_straw_layer[1]<<" (in the EndCaps).");
-    }
-    bool trackfound[2][64];//trackfound[64] 
-    for (int i =0; i<2 ;i++) std::fill(trackfound[i], trackfound[i] + 64, false);//fix for ATLASRECTS-2019
-    //for (int iside=0; iside<2; iside++) { //another for loop we got rid of
-    for (TSOSItBegin=TSOSItBegin0; TSOSItBegin!=TSOSItEnd; ++TSOSItBegin) {
-      //select a TSOS which is non-empty, measurement type and contains  both drift circle and track parameters informations 
-      if ((*TSOSItBegin) == 0) continue;
-      if( !((*TSOSItBegin)->type(Trk::TrackStateOnSurface::Measurement)) ) continue; 
-      const InDet::TRT_DriftCircleOnTrack *trtCircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>((*TSOSItBegin)->measurementOnTrack());
-      if (!trtCircle) continue;
-      const Trk::TrackParameters *aTrackParam = dynamic_cast<const Trk::TrackParameters*>((*TSOSItBegin)->trackParameters());
-      if (!aTrackParam) continue;
-
-      Identifier DCoTId = trtCircle->identify();
-      m_barrel_ec       = m_pTRTHelper->barrel_ec(DCoTId);
-      m_layer_or_wheel  = m_pTRTHelper->layer_or_wheel(DCoTId);
-      m_phi_module      = m_pTRTHelper->phi_module(DCoTId);
-      m_straw_layer     = m_pTRTHelper->straw_layer(DCoTId);
-      m_straw           = m_pTRTHelper->straw(DCoTId);
-      int ibe   = abs(m_barrel_ec)-1;// ibe =0 barrel , ibe =1 encap
-      int iside = m_barrel_ec > 0 ? 0:1;//iside= 0 side_A , iside = 1 side_C
-      int m_strawNumber[2] ={-1,-1} ;
-      int m_chip[2]={0,0};
-      if (ibe==0) {
-	m_strawNumber[ibe] = strawNumber(m_straw, m_straw_layer, m_layer_or_wheel);
-	if (m_strawNumber[ibe]>=0 && m_strawNumber[ibe]<s_Straw_max[ibe]) {
-	  m_chip[ibe] = mat_chip_B[m_phi_module][m_strawNumber[ibe]];
-	}
+	ATH_MSG_VERBOSE("Filling TRT Tracks Histos");
+	//Initialize a bunch of stuff before looping over the track collection. Fill some basic histograms.
+	const float timeCor =  comTimeObject ? comTimeObject->getTime() : 0;
+	auto p_trk = trackCollection.begin();
+	const Trk::Perigee *m_mPer = nullptr;
+	const DataVector<const Trk::TrackParameters> *AllTrkPar(0);
+	DataVector<const Trk::TrackParameters>::const_iterator p_trkpariter;
+
+	//Take out normalization of previous event for online environment
+	//Explanation: While online monitoring running we need to present out histograms repeatedly so we need to pay attention to normalization.
+	//before adding any information from new event to normalized histograms we need to take out the normalization of the previous event by scaling histograms back.
+	//After  we are done with filling those histograms we will normalize them again
+	if (m_environment == AthenaMonManager::online) {
+		// ibe = 0 (Barrel), ibe = 1 (Endcap)
+		for (int ibe = 0; ibe < 2; ibe++) {
+			if (m_doChips && m_doExpert) {
+				for (int i = 0; i < 64; i++) {
+					for (int j = 0; j < s_iChip_max[ibe]; j++) {
+						if (m_hChipsEff[ibe][i]->GetBinEntries(j + 1) > 0) {
+							m_hHitAonTMapC[ibe][i]->SetBinContent(j + 1, m_hHitAonTMapC[ibe][i]->GetBinContent(j + 1) * m_hChipsEff[ibe][i]->GetBinEntries(j + 1));
+							m_hHitWonTMapC[ibe][i]->SetBinContent(j + 1, m_hHitWonTMapC[ibe][i]->GetBinContent(j + 1) * m_hChipsEff[ibe][i]->GetBinEntries(j + 1));
+							m_hHitAWonTMapC[ibe][i]->SetBinContent(j + 1, m_hHitAWonTMapC[ibe][i]->GetBinContent(j + 1) * m_hChipsEff[ibe][i]->GetBinEntries(j + 1));
+							m_hHitHonTMapC[ibe][i]->SetBinContent(j + 1, m_hHitHonTMapC[ibe][i]->GetBinContent(j + 1) * m_hChipsEff[ibe][i]->GetBinEntries(j + 1));
+							m_hHitHWonTMapC[ibe][i]->SetBinContent(j + 1, m_hHitHWonTMapC[ibe][i]->GetBinContent(j + 1) * m_hChipsEff[ibe][i]->GetBinEntries(j + 1));
+						}
+					}
+				}
+			}
+
+			if (m_doStraws) {
+				for (int i = 0; i < 64; i++) {
+					for (int j = 0; j < s_Straw_max[ibe]; j++) {
+						if (ibe == 0) {
+							if (i == 0 && m_nStrawHits_B[j] > 0) {
+								m_hHitWonTMap_B->SetBinContent(j + 1, m_hHitWonTMap_B->GetBinContent(j + 1) * m_nStrawHits_B[j]);
+							}
+						} else if (ibe == 1) {
+							for (int iside = 0; iside < 2; iside++) {
+								if (i == 0 && m_nStrawHits_E[iside][j] > 0) {
+									m_hHitWonTMap_E[iside]->SetBinContent(j + 1, m_hHitWonTMap_E[iside]->GetBinContent(j + 1) * m_nStrawHits_E[iside][j]);
+								}
+							}
+						}
+
+						if (m_doExpert) {
+							if (m_hStrawsEff[ibe][i]->GetBinEntries(j + 1) > 0) {
+								m_hHitAWonTMapS[ibe][i]->SetBinContent(j + 1, m_hHitAWonTMapS[ibe][i]->GetBinContent(j + 1) * m_hStrawsEff[ibe][i]->GetBinEntries(j + 1));
+								m_hHitAonTMapS[ibe][i]->SetBinContent(j + 1, m_hHitAonTMapS[ibe][i]->GetBinContent(j + 1) * m_hStrawsEff[ibe][i]->GetBinEntries(j + 1));
+								m_hHitHonTMapS[ibe][i]->SetBinContent(j + 1, m_hHitHonTMapS[ibe][i]->GetBinContent(j + 1) * m_hStrawsEff[ibe][i]->GetBinEntries(j + 1));
+								m_hHitWonTMapS[ibe][i]->SetBinContent(j + 1, m_hHitWonTMapS[ibe][i]->GetBinContent(j + 1) * m_hStrawsEff[ibe][i]->GetBinEntries(j + 1));
+							}
+						}
+					}
+				}
+			}
+		}
 
-      } else if (ibe==1) {
-	m_strawNumber[ibe] = strawNumberEndCap(m_straw, m_straw_layer, m_layer_or_wheel, m_phi_module, m_barrel_ec);
-	if (m_strawNumber[ibe]>=0 && m_strawNumber[ibe]<s_Straw_max[ibe]) {
-	  m_chip[ibe] = mat_chip_E[m_phi_module][m_strawNumber[ibe]];
+		if (m_doShift) {
+			scale_LWHist(m_hEvtPhase, EventPhaseScale);
+			scale_LWHist(m_hDriftTimeonTrkDist_B, DriftTimeonTrkDistScale_B);
+			scale_LWHist(m_hHLhitOnTrack_B, HLhitOnTrackScale_B);
+			scale_LWHist(m_hHtoLRatioOnTrack_B, HtoLRatioOnTrackScale_B);
+			scale_LWHist(m_hNumSwLLWoT_B, NumSwLLWoTScale_B);
+			scale_LWHist(m_hWireToTrkPosition_B, WireToTrkPositionScale_B);
+			scale_LWHist(m_hTronTDist_B, TronTDistScale_B);
+			scale_LWHist(m_hResidual_B, ResidualScale_B);
+			scale_LWHist(m_hResidual_B_20GeV, ResidualScale_B_20GeV);
+			scale_LWHist(m_hTimeResidual_B, TimeResidualScale_B);
+
+			if (m_ArgonXenonSplitter) {
+				scale_LWHist(m_hDriftTimeonTrkDist_B_Ar, DriftTimeonTrkDistScale_B_Ar);
+				scale_LWHist(m_hWireToTrkPosition_B_Ar, WireToTrkPositionScale_B_Ar);
+				scale_LWHist(m_hTronTDist_B_Ar, TronTDistScale_B_Ar);
+				scale_LWHist(m_hResidual_B_Ar, ResidualScale_B_Ar);
+				scale_LWHist(m_hResidual_B_Ar_20GeV, ResidualScale_B_Ar_20GeV);
+				scale_LWHist(m_hTimeResidual_B_Ar, TimeResidualScale_B_Ar);
+			}
+
+			for (int iside = 0; iside < 2; iside++) {
+				scale_LWHist(m_hDriftTimeonTrkDist_E[iside], DriftTimeonTrkDistScale_E[iside]);
+				scale_LWHist(m_hHLhitOnTrack_E[iside], HLhitOnTrackScale_E[iside]);
+				scale_LWHist(m_hHtoLRatioOnTrack_E[iside], HtoLRatioOnTrackScale_E[iside]);
+				scale_LWHist(m_hNumSwLLWoT_E[iside], NumSwLLWoTScale_E[iside]);
+				scale_LWHist(m_hWireToTrkPosition_E[iside], WireToTrkPositionScale_E[iside]);
+				scale_LWHist(m_hTronTDist_E[iside], TronTDistScale_E[iside]);
+				scale_LWHist(m_hResidual_E[iside], ResidualScale_E[iside]);
+				scale_LWHist(m_hResidual_E_20GeV[iside], ResidualScale_E_20GeV[iside]);
+				scale_LWHist(m_hTimeResidual_E[iside], TimeResidualScale_E[iside]);
+
+				if (m_ArgonXenonSplitter) {
+					scale_LWHist(m_hDriftTimeonTrkDist_E_Ar[iside], DriftTimeonTrkDistScale_E_Ar[iside]);
+					scale_LWHist(m_hWireToTrkPosition_E_Ar[iside], WireToTrkPositionScale_E_Ar[iside]);
+					scale_LWHist(m_hTronTDist_E_Ar[iside], TronTDistScale_E_Ar[iside]);
+					scale_LWHist(m_hResidual_E_Ar[iside], ResidualScale_E_Ar[iside]);
+					scale_LWHist(m_hResidual_E_Ar_20GeV[iside], ResidualScale_E_Ar_20GeV[iside]);
+					scale_LWHist(m_hTimeResidual_E_Ar[iside], TimeResidualScale_E_Ar[iside]);
+				}
+			}
+		}
 	}
-      } else {
-	m_strawNumber[ibe] = -1;
-      }
-
-      if (m_strawNumber[ibe]<0 || m_strawNumber[ibe] >= s_Straw_max[ibe]) continue;
-      if (checkB[iside]    == 0 && ibe==0) { m_nTracksB[iside]++; checkB[iside] = 1;}
-      if (checkEC[iside]   == 0 && ibe==1) { m_nTracksEC[iside]++; checkEC[iside] = 1;}
-      if (checkEC_B[iside] == 0 && checkB[iside]==1 && ibe==1 ) {
-	m_nTracksEC_B[iside]++;
-	checkEC_B[iside] = 1;
-      }//ToDo: be sure about this approach 
-
-      //if (m_pTRTHelper->barrel_ec(DCoTId) == 2) ECAhit = true;
-      //else if (m_pTRTHelper->barrel_ec(DCoTId) == -2) ECChit = true;
-      //else if (abs(m_pTRTHelper->barrel_ec(DCoTId)) == 1) Bhit = true;
-      //      if (ibe== 1) Bhit = true;
-      if (ibe==0) { Bhit = true;} //  barrel hit
-      else if (m_barrel_ec==  2){isBarrelOnly = false; ECAhit = true;}
-      else if (m_barrel_ec== -2){isBarrelOnly = false; ECChit = true;}
-
-      //if ((m_pTRTHelper->barrel_ec(DCoTId)==sectorflag[ibe][iside])) {
-      Identifier surfaceID;
-      const Trk::MeasurementBase* mesb=(*TSOSItBegin)->measurementOnTrack();
-
-      surfaceID = trtCircle->identify();
-
-      const bool isArgonStraw = (  Straw_Gastype( m_sumSvc->getStatusHT(surfaceID) ) ==GasType::Ar   );//inline function checks m_ArgonXenonSplitter 
-      // assume always Xe if m_ArgonXenonSplitter is not enabled, otherwise check the straw status (good is Xe, non-good is Ar)
-      //const bool isArgonStraw = m_ArgonXenonSplitter && (m_sumSvc->getStatusHT(surfaceID) != TRTCond::StrawStatus::Good);
-
-      float temp_locr = aTrackParam->parameters()[Trk::driftRadius];
-      TRTCond::RtRelation const *rtr = m_trtcaldbSvc->getRtRelation(surfaceID);
-
-      int iphi_module=-9999;
-      if (iside==0) iphi_module=m_phi_module;
-      else if (iside==1) iphi_module=m_phi_module+32;
-
-      trackfound[ibe][iphi_module] = true;
-
-      if ((ibe==0&&temp_locr < m_DistToStraw) || (ibe==1&&((*TSOSItBegin)->type(Trk::TrackStateOnSurface::Measurement)||(*TSOSItBegin)->type(Trk::TrackStateOnSurface::Outlier)||(*TSOSItBegin)->type(Trk::TrackStateOnSurface::Hole))&&temp_locr < m_DistToStraw)) {
-	if (m_idHelper->is_trt(DCoTId)) {
-	  //if (m_pTRTHelper->barrel_ec(DCoTId) == sectorflag[ibe][iside]) {
-	  if (ibe==0) {// barrel
-	    hitontrack[ibe]++;
-	    if (DoShift) m_hStrawEffDetPhi_B->Fill(m_phi_module, 1.0);
-	    if (DoStraws && DoShift) m_nStrawHits_B[m_strawNumber[ibe]]++;
-	  } else if (ibe==1) { //endcap
-	    hitontrack[ibe]++; hitontrack_E_side[iside]++;
-	    if (DoShift) m_hStrawEffDetPhi_E[iside]->Fill(m_phi_module, 1.0);
-	    if (DoStraws && DoShift) m_nStrawHits_E[iside][m_strawNumber[ibe]]++;
-	  }
-	  if (DoStraws && DoExpert) m_hStrawsEff[ibe][iphi_module]->Fill(m_strawNumber[ibe],1.0);
-	  if (DoChips  && DoExpert) m_hChipsEff[ibe][iphi_module]->Fill((m_chip[ibe]-1),1.0);
-	  //}
-	}//if surface is trt
-      } else {
-	if (m_idHelper->is_trt(DCoTId)) { //ToDo:Is this really needed
-	  if (ibe==0) { //barrel
-	    if (DoShift) m_hStrawEffDetPhi_B->Fill(m_phi_module, 0.0);
-	    if (DoStraws && DoShift) m_nStrawHits_B[m_strawNumber[ibe]]++;
-	  } else if (ibe==1) { //endcap
-	    if (DoShift) m_hStrawEffDetPhi_E[iside]->Fill(m_phi_module, 0.0);
-	    if (DoStraws && DoShift) m_nStrawHits_E[iside][m_strawNumber[ibe]]++;
-	  }
-	  if (DoStraws && DoExpert) m_hStrawsEff[ibe][iphi_module]->Fill(m_strawNumber[ibe],0.0);
-	  if (DoChips  && DoExpert) m_hChipsEff[ibe][iphi_module]->Fill((m_chip[ibe]-1),0.0);
-	}//is trt surface
-      }//is not measurement
-      const InDet::TRT_DriftCircle *RawDriftCircle = dynamic_cast<const InDet::TRT_DriftCircle*>(trtCircle->prepRawData());
-      //const Trk::MeasurementBase* mesb = (*TSOSItBegin)->measurementOnTrack();
-      //bool isTubeHit = (mesb->localErrorMatrix().covValue(Trk::locX) > 1.0) ? 1 : 0;
-      bool isTubeHit = (mesb->localCovariance()(Trk::locX,Trk::locX) > 1.0) ? 1 : 0;
-
-      if (RawDriftCircle) {
-	//if (m_barrel_ec == sectorflag[ibe][iside]) {
-	m_nTRTHits_side[ibe][iside]++;
-	//}
-	int middleHTbit       = RawDriftCircle->getWord() & 0x00020000;
-      //0x00020000 = 0000 0000 0000 0000 0000 0010 0000 0000 0000 0000
-	int hitinvaliditygate = RawDriftCircle->getWord() & 0x000DFE80;
-      //0x000DFE80 = 0000 0000 0000 0000 0000 1101 1111 1110 1000 0000 //
-	bool is_middleHTbit_high   = (middleHTbit !=0);
-	bool is_anybininVgate_high = (hitinvaliditygate !=0);
-	float m_timeOverThreshold = RawDriftCircle->timeOverThreshold();
-	double t0 = m_trtcaldbSvc->getT0(DCoTId, TRTCond::ExpandedIdentifier::STRAW);
-	if (DoExpert && DoStraws) m_hHitToTonTMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe], m_timeOverThreshold);//Mean ToT (ns) on Track: Straws
-	if (DoExpert && DoChips) m_hHitToTonTMapC[ibe][iphi_module]->Fill((m_chip[ibe]-1),   m_timeOverThreshold);//Mean ToT (ns) on Track: Chips
-	  if (DoExpert && DoStraws) m_hHitHonTMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe],1.0);// Any HL hit on track: Straws
-	  
-	  if (DoExpert && DoStraws&& is_middleHTbit_high) m_hHitHWonTMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe],1.0);// Middle HL bit on track: Straws
-	  if (DoExpert && DoChips && is_middleHTbit_high ) m_hHitHWonTMapC[ibe][iphi_module]->Fill(m_chip[ibe]-1);// Middle HL bit on track: Chips 
-
-	  //	if (RawDriftCircle->highLevel()) {
-	  if (is_middleHTbit_high) {//hardcoded middle Bit 
-	  TRT_LoLumRawData lolum(surfaceID,RawDriftCircle->getWord());
-	  if (DoExpert && DoStraws) m_hHitHonTMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe],1.0);// Any HL hit on track: Straws
-	  if (DoExpert && DoChips) m_hHitHonTMapC[ibe][iphi_module]->Fill(m_chip[ibe]-1);// Any HL hit on track: Chips
-	  //if ((RawDriftCircle->driftTimeBin()<24) && !(RawDriftCircle->lastBinHigh()) && !(RawDriftCircle->firstBinHigh())) { 
-	  //inside of this if block was commented out before
-	  // if (DoExpert && DoStraws) m_hHitHWonTMapS[iphi_module]->Fill(m_strawNumber, 1.0);// HL in time window on track: Straws
-	  //}
-
-	}//is high level hit
-
-	const bool m_driftTimeValid = RawDriftCircle->driftTimeValid();
-	if (m_driftTimeValid) {
-	  const float m_validRawDriftTime = RawDriftCircle->rawDriftTime();
-	  if (DoExpert && DoStraws) m_hValidRawDriftTimeonTrk[ibe][iphi_module]->Fill(m_strawNumber[ibe], m_validRawDriftTime); //Valid Raw Drift Time on Track: Straws
-	  if (DoExpert && DoChips) m_hValidRawDriftTimeonTrkC[ibe][iphi_module]->Fill((m_chip[ibe]-1), m_validRawDriftTime); //Valid Raw Drift Time on Track: Chips
+
+	int ntrackstack[2][64];
+
+	for (int ibe = 0; ibe < 2; ibe++) {
+		std::fill(ntrackstack[ibe], ntrackstack[ibe] + 64, 0);
 	}
 
-	if (DoShift && DoStraws) {
-	  if (ibe==0) {
-	    if (isArgonStraw)
-	      m_hDriftTimeonTrkDist_B_Ar->Fill(RawDriftCircle->rawDriftTime());
-	    else
-	      m_hDriftTimeonTrkDist_B->Fill(RawDriftCircle->rawDriftTime());
-	  } else if (ibe==1) {
-	    if (isArgonStraw)
-	      m_hDriftTimeonTrkDist_E_Ar[iside]->Fill(RawDriftCircle->rawDriftTime());
-	    else
-	      m_hDriftTimeonTrkDist_E[iside]->Fill(RawDriftCircle->rawDriftTime());
-	  }
+	for (; p_trk != trackCollection.end(); ++p_trk) {
+		const std::auto_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->createSummary(*(*p_trk)));
+		int m_nTRTHits = summary->get(Trk::numberOfTRTHits);
+
+		if (m_nTRTHits < m_minTRThits) continue;
+
+		AllTrkPar = (*p_trk)->trackParameters();
+
+		// Search of MeasuredPerigee in TrackParameters
+		// The following algorithm only finds the First perigee measurement.
+		// As there should be one and only one perigee measurement then this assumption should be valid.
+		// But no check is done to see if there is more than one perigee measurement.
+		for (p_trkpariter = AllTrkPar->begin(); p_trkpariter != AllTrkPar->end(); ++p_trkpariter) {
+			//if track parameter does have a measured perigee then the track parameter is a keeper and break out of the loop
+			if ((m_mPer = dynamic_cast<const Trk::Perigee *>(*p_trkpariter))) break;
+		}
+
+		if (!m_mPer) continue;
+
+		float m_theta   =  m_mPer->parameters()[Trk::theta];
+		float m_p       =  (m_mPer->parameters()[Trk::qOverP] != 0.) ? fabs(1. / (m_mPer->parameters()[Trk::qOverP])) : 10e7;
+		float m_pT      =  (m_p * sin(m_theta));
+		m_pT = m_pT * 1e-3;  // GeV
+
+		if (m_p < m_minP) continue;
+
+		const DataVector<const Trk::TrackStateOnSurface> *trackStates = (**p_trk).trackStateOnSurfaces();
+
+		if (trackStates == 0) continue;
+
+		DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItBegin0    = trackStates->begin();
+		DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItBegin     = trackStates->begin();
+		DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItBeginTemp = trackStates->begin();
+		DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItEnd       = trackStates->end();
+		int n_trt_hits = summary->get(Trk::numberOfTRTHits);
+		int n_sct_hits = summary->get(Trk::numberOfSCTHits);
+		int n_pixel_hits = summary->get(Trk::numberOfPixelHits);
+		const int n_si_hits = n_pixel_hits + n_sct_hits;
+		bool is_pT_over_20GeV = false;
+
+		if (m_mPer->pT() > 20 * CLHEP::GeV) {
+			is_pT_over_20GeV = true;
+		} else {
+			is_pT_over_20GeV = false;
+		}
+
+		const bool cnst_is_pT_over_20GeV = is_pT_over_20GeV;
+		///hardcoded cut for pT 2.0 GeV for collision setup
+		float min_pt_new = m_min_pT;
+
+		if (m_isCosmics == false) {
+			min_pt_new = 2.0 * CLHEP::GeV;
+		}
+
+		const bool passed_track_preselection =
+			(m_mPer->pT() > min_pt_new) &&
+			(m_p > m_minP) &&
+			(n_si_hits >= m_min_si_hits) &&
+			(n_pixel_hits >= m_min_pixel_hits) &&
+			(n_sct_hits >= m_min_sct_hits) &&
+			(n_trt_hits >= m_min_trt_hits);
+
+		if (!passed_track_preselection) continue;
+
+		m_nTotalTracks++;
+		int checkB[2] = {0, 0};
+		int checkEC[2] = {0, 0};
+		int checkEC_B[2] = {0, 0};
+		int m_nTRTHitsW[2][2];
+		int m_nTRTHitsW_Ar[2][2];
+		int m_nTRTHitsW_Xe[2][2];
+		int m_nTRTHLHitsW[2][2];
+		int m_nTRTHLHitsW_Ar[2][2];
+		int m_nTRTHLHitsW_Xe[2][2];
+		int m_nTRTHits_side[2][2];
+		int m_nTRTHitsW_perwheel[2][18];
+		int hitontrack[2] = {0, 0};
+		int hitontrack_E_side[2] = {0, 0};
+
+		for (int ibe = 0; ibe < 2; ibe++) {
+			for (int iside = 0; iside < 2; iside++) {
+				m_nTRTHits_side[ibe][iside] = -1;
+				m_nTRTHitsW[ibe][iside] = 0;
+				m_nTRTHitsW_Ar[ibe][iside] = 0;
+				m_nTRTHitsW_Xe[ibe][iside] = 0;
+				m_nTRTHLHitsW[ibe][iside] = 0;
+				m_nTRTHLHitsW_Ar[ibe][iside] = 0;
+				m_nTRTHLHitsW_Xe[ibe][iside] = 0;
+			}
+
+			std::fill(m_nTRTHitsW_perwheel[ibe], m_nTRTHitsW_perwheel[ibe] + 18, 0);
+		}
+
+		bool isBarrelOnly = true;
+		bool ECAhit = false;
+		bool ECChit = false;
+		bool Bhit = false;
+		int m_barrel_ec = 0;
+		int m_layer_or_wheel = 0;
+		int m_phi_module = 0;
+		int m_straw_layer = 0;
+		int m_straw = 0;
+		int m_nearest_straw_layer[2] = {100, 100};
+		int m_nearest_straw[2] = {0, 0};
+		int testLayer[2] = {100, 100};
+		int innerstack[2] = {-999, -999};
+		float m_phi2D[2] = {-100, -100};
+
+		for (TSOSItBeginTemp = TSOSItBegin0; TSOSItBeginTemp != TSOSItEnd; ++TSOSItBeginTemp) {
+			if ((*TSOSItBeginTemp) == 0) continue;
+
+			if (! ((*TSOSItBeginTemp)->type(Trk::TrackStateOnSurface::Measurement)) ) continue;
+
+			const InDet::TRT_DriftCircleOnTrack *trtCircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack *>((*TSOSItBeginTemp)->measurementOnTrack());
+
+			if (!trtCircle) continue;
+
+			const Trk::TrackParameters *aTrackParam = dynamic_cast<const Trk::TrackParameters *>((*TSOSItBeginTemp)->trackParameters());
+
+			if (!aTrackParam) continue;
+
+			Identifier DCoTId = trtCircle->identify();
+			m_barrel_ec = m_pTRTHelper->barrel_ec(DCoTId);
+			int ibe = abs(m_barrel_ec) - 1;
+			m_layer_or_wheel = m_pTRTHelper->layer_or_wheel (DCoTId);
+			m_straw_layer = m_pTRTHelper->straw_layer(DCoTId);
+			m_straw = m_pTRTHelper->straw(DCoTId);
+
+			//restrict ourselves to the inner most TRT layers To get detector phi.
+			if (m_layer_or_wheel >= testLayer[ibe]) continue;
+
+			testLayer[ibe] = m_layer_or_wheel;
+
+			if (m_straw_layer < m_nearest_straw_layer[ibe]) {
+				m_nearest_straw_layer[ibe] = m_straw_layer;
+				m_nearest_straw[ibe] = m_straw;
+				const InDetDD::TRT_BaseElement *circleElement = nullptr;
+				circleElement = trtCircle->detectorElement();
+				m_phi2D[ibe] = radToDegrees(circleElement->strawCenter(m_nearest_straw[ibe]).phi());
+				circleElement = nullptr;
+				innerstack[ibe] = m_pTRTHelper->phi_module(DCoTId);
+			}
+		}
+
+		if (m_phi2D[0] == -999) {
+			ATH_MSG_DEBUG("Track did not go through inner layer of Barrel.");
+		} else {
+			ATH_MSG_VERBOSE("Track's closest approach is m_layer_or_wheel: " <<
+			                testLayer[0] << " m_straw_layer: " <<
+			                m_nearest_straw_layer[0] << " (in the Barrel).");
+		}
+
+		if (m_phi2D[1] == -999) {
+			ATH_MSG_DEBUG("Track did not go through any inner layer of EndCap A or C.");
+		} else {
+			ATH_MSG_VERBOSE("Track's closest approach is m_layer_or_wheel: " <<
+			                testLayer[1] << " m_straw_layer: " <<
+			                m_nearest_straw_layer[1] << " (in the EndCaps).");
+		}
+
+		bool trackfound[2][64];
+
+		for (int i = 0; i < 2; i++) {
+			std::fill(trackfound[i], trackfound[i] + 64, false);
+		}
+
+		for (TSOSItBegin = TSOSItBegin0; TSOSItBegin != TSOSItEnd; ++TSOSItBegin) {
+			//select a TSOS which is non-empty, measurement type and contains  both drift circle and track parameters informations
+			if ((*TSOSItBegin) == 0) continue;
+
+			if ( !((*TSOSItBegin)->type(Trk::TrackStateOnSurface::Measurement)) ) continue;
+
+			const InDet::TRT_DriftCircleOnTrack *trtCircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack *>((*TSOSItBegin)->measurementOnTrack());
+
+			if (!trtCircle) continue;
+
+			const Trk::TrackParameters *aTrackParam = dynamic_cast<const Trk::TrackParameters *>((*TSOSItBegin)->trackParameters());
+
+			if (!aTrackParam) continue;
+
+			Identifier DCoTId = trtCircle->identify();
+			m_barrel_ec = m_pTRTHelper->barrel_ec(DCoTId);
+			m_layer_or_wheel = m_pTRTHelper->layer_or_wheel(DCoTId);
+			m_phi_module = m_pTRTHelper->phi_module(DCoTId);
+			m_straw_layer = m_pTRTHelper->straw_layer(DCoTId);
+			m_straw = m_pTRTHelper->straw(DCoTId);
+			// ibe = 0 (Barrel), ibe = 1 (Endcap)
+			int ibe = abs(m_barrel_ec) - 1;
+			// iside = 0 (Side A), iside = 1 (Side C)
+			int iside = m_barrel_ec > 0 ? 0 : 1;
+			int m_strawNumber[2] = {-1, -1};
+			int m_chip[2] = {0, 0};
+
+			if (ibe == 0) {
+				m_strawNumber[ibe] = strawNumber(m_straw, m_straw_layer, m_layer_or_wheel);
+
+				if (m_strawNumber[ibe] >= 0 && m_strawNumber[ibe] < s_Straw_max[ibe]) {
+					m_chip[ibe] = mat_chip_B[m_phi_module][m_strawNumber[ibe]];
+				}
+			} else if (ibe == 1) {
+				m_strawNumber[ibe] = strawNumberEndCap(m_straw, m_straw_layer, m_layer_or_wheel, m_phi_module, m_barrel_ec);
+
+				if (m_strawNumber[ibe] >= 0 && m_strawNumber[ibe] < s_Straw_max[ibe]) {
+					m_chip[ibe] = mat_chip_E[m_phi_module][m_strawNumber[ibe]];
+				}
+			} else {
+				m_strawNumber[ibe] = -1;
+			}
+
+			if (m_strawNumber[ibe] < 0 || m_strawNumber[ibe] >= s_Straw_max[ibe]) continue;
+
+			if (checkB[iside] == 0 && ibe == 0) {
+				m_nTracksB[iside]++;
+				checkB[iside] = 1;
+			}
+
+			if (checkEC[iside] == 0 && ibe == 1) {
+				m_nTracksEC[iside]++;
+				checkEC[iside] = 1;
+			}
+
+			if (checkEC_B[iside] == 0 && checkB[iside] == 1 && ibe == 1 ) {
+				m_nTracksEC_B[iside]++;
+				checkEC_B[iside] = 1;
+			}//ToDo: be sure about this approach
+
+			if (ibe == 0) {
+				Bhit = true;
+			} else if (m_barrel_ec == 2) {
+				isBarrelOnly = false;
+				ECAhit = true;
+			} else if (m_barrel_ec == -2) {
+				isBarrelOnly = false;
+				ECChit = true;
+			}
+
+			Identifier surfaceID;
+			const Trk::MeasurementBase *mesb = (*TSOSItBegin)->measurementOnTrack();
+			surfaceID = trtCircle->identify();
+			const bool isArgonStraw = ( Straw_Gastype( m_sumSvc->getStatusHT(surfaceID) ) == GasType::Ar );
+			// assume always Xe if m_ArgonXenonSplitter is not enabled, otherwise check the straw status (good is Xe, non-good is Ar)
+			float temp_locr = aTrackParam->parameters()[Trk::driftRadius];
+			TRTCond::RtRelation const *rtr = m_TRTCalDbSvc->getRtRelation(surfaceID);
+			int iphi_module = -9999;
+
+			if (iside == 0) iphi_module = m_phi_module;
+			else if (iside == 1) iphi_module = m_phi_module + 32;
+
+			trackfound[ibe][iphi_module] = true;
+
+			if (((ibe == 0) && (temp_locr < m_DistToStraw)) ||
+			    ((ibe == 1) && ((*TSOSItBegin)->type(Trk::TrackStateOnSurface::Measurement) ||
+			                    (*TSOSItBegin)->type(Trk::TrackStateOnSurface::Outlier) ||
+			                    (*TSOSItBegin)->type(Trk::TrackStateOnSurface::Hole)) &&
+			     (temp_locr < m_DistToStraw))) {
+				if (m_idHelper->is_trt(DCoTId)) {
+					if (ibe == 0) {
+						hitontrack[ibe]++;
+
+						if (m_doShift) {
+							m_hStrawEffDetPhi_B->Fill(m_phi_module, 1.0);
+						}
+
+						if (m_doStraws && m_doShift) {
+							m_nStrawHits_B[m_strawNumber[ibe]]++;
+						}
+					} else if (ibe == 1) {
+						hitontrack[ibe]++;
+						hitontrack_E_side[iside]++;
+
+						if (m_doShift) {
+							m_hStrawEffDetPhi_E[iside]->Fill(m_phi_module, 1.0);
+						}
+
+						if (m_doStraws && m_doShift) {
+							m_nStrawHits_E[iside][m_strawNumber[ibe]]++;
+						}
+					}
+
+					if (m_doStraws && m_doExpert) {
+						m_hStrawsEff[ibe][iphi_module]->Fill(m_strawNumber[ibe], 1.0);
+					}
+
+					if (m_doChips && m_doExpert) {
+						m_hChipsEff[ibe][iphi_module]->Fill((m_chip[ibe] - 1), 1.0);
+					}
+				}
+			} else {
+				if (m_idHelper->is_trt(DCoTId)) { //ToDo:Is this really needed
+					if (ibe == 0) {
+						if (m_doShift) {
+							m_hStrawEffDetPhi_B->Fill(m_phi_module, 0.0);
+						}
+
+						if (m_doStraws && m_doShift) {
+							m_nStrawHits_B[m_strawNumber[ibe]]++;
+						}
+					} else if (ibe == 1) {
+						if (m_doShift) {
+							m_hStrawEffDetPhi_E[iside]->Fill(m_phi_module, 0.0);
+						}
+
+						if (m_doStraws && m_doShift) {
+							m_nStrawHits_E[iside][m_strawNumber[ibe]]++;
+						}
+					}
+
+					if (m_doStraws && m_doExpert) {
+						m_hStrawsEff[ibe][iphi_module]->Fill(m_strawNumber[ibe], 0.0);
+					}
+
+					if (m_doChips  && m_doExpert) {
+						m_hChipsEff[ibe][iphi_module]->Fill((m_chip[ibe] - 1), 0.0);
+					}
+				}
+			}
+
+			const InDet::TRT_DriftCircle *RawDriftCircle = dynamic_cast<const InDet::TRT_DriftCircle *>(trtCircle->prepRawData());
+			bool isTubeHit = (mesb->localCovariance()(Trk::locX, Trk::locX) > 1.0) ? 1 : 0;
+
+			if (RawDriftCircle) {
+				m_nTRTHits_side[ibe][iside]++;
+				int middleHTbit       = RawDriftCircle->getWord() & 0x00020000;
+				//0x00020000 = 0000 0000 0000 0000 0000 0010 0000 0000 0000 0000
+				int hitinvaliditygate = RawDriftCircle->getWord() & 0x000DFE80;
+				//0x000DFE80 = 0000 0000 0000 0000 0000 1101 1111 1110 1000 0000 //
+				bool is_middleHTbit_high = (middleHTbit != 0);
+				bool is_anybininVgate_high = (hitinvaliditygate != 0);
+				float m_timeOverThreshold = RawDriftCircle->timeOverThreshold();
+				double t0 = m_TRTCalDbSvc->getT0(DCoTId, TRTCond::ExpandedIdentifier::STRAW);
+				//				auto rc = m_TRTCalDbSvc->getT0Container();
+				//				auto valWithContainer = rc->getWithContainer(ITRT_CalDbSvc::trtcondid(DCoTId, TRTCond::ExpandedIdentifier::STRAW);
+
+				if (m_doExpert && m_doStraws) {
+					m_hHitToTonTMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe], m_timeOverThreshold);
+					// NOTE: this looks redundant
+					m_hHitHonTMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe], 1.0);
+
+					if (is_middleHTbit_high) {
+						m_hHitHonTMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe], 1.0);
+						m_hHitHWonTMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe], 1.0);
+					}
+				}
+
+				if (m_doExpert && m_doChips) {
+					m_hHitToTonTMapC[ibe][iphi_module]->Fill((m_chip[ibe] - 1), m_timeOverThreshold);
+
+					if (is_middleHTbit_high) {
+						m_hHitHWonTMapC[ibe][iphi_module]->Fill(m_chip[ibe] - 1);
+						m_hHitHonTMapC[ibe][iphi_module]->Fill(m_chip[ibe] - 1);
+					}
+				}
+
+				const bool m_driftTimeValid = RawDriftCircle->driftTimeValid();
+
+				if (m_driftTimeValid) {
+					const float m_validRawDriftTime = RawDriftCircle->rawDriftTime();
+
+					if (m_doExpert && m_doStraws)
+						m_hValidRawDriftTimeonTrk[ibe][iphi_module]->Fill(m_strawNumber[ibe], m_validRawDriftTime);
+
+					if (m_doExpert && m_doChips)
+						m_hValidRawDriftTimeonTrkC[ibe][iphi_module]->Fill((m_chip[ibe] - 1), m_validRawDriftTime);
+				}
+
+				if (m_doShift && m_doStraws) {
+					if (ibe == 0) {
+						if (isArgonStraw)
+							m_hDriftTimeonTrkDist_B_Ar->Fill(RawDriftCircle->rawDriftTime());
+						else
+							m_hDriftTimeonTrkDist_B->Fill(RawDriftCircle->rawDriftTime());
+					} else if (ibe == 1) {
+						if (isArgonStraw)
+							m_hDriftTimeonTrkDist_E_Ar[iside]->Fill(RawDriftCircle->rawDriftTime());
+						else
+							m_hDriftTimeonTrkDist_E[iside]->Fill(RawDriftCircle->rawDriftTime());
+					}
+				}
+
+				float locR_err = 0.0;
+				const AmgSymMatrix(5)* b_err = aTrackParam->covariance();
+
+				if (b_err) {
+					locR_err = Amg::error(*b_err, Trk::locR);
+				} else {
+					ATH_MSG_ERROR("Track parameters have no covariance attached.");
+				}
+
+				float loc_err = sqrt(Amg::error(trtCircle->localCovariance(), Trk::driftRadius));
+				float locR = aTrackParam->parameters()[Trk::driftRadius];
+				float loc = trtCircle->localParameters()[Trk::driftRadius];
+
+				if (isTubeHit) {
+					bool isOK = false;
+					loc = m_drifttool->driftRadius(RawDriftCircle->rawDriftTime(), DCoTId, t0, isOK);
+
+					if ((loc * locR) < 0) loc = -loc;
+				}
+
+				// Calculate Residuals for hit
+				if (m_doShift && m_doStraws) {
+					const double pull_b =
+						((loc - locR) /
+						 sqrt((loc_err * loc_err * loc_err * loc_err) -
+						      (locR_err * locR_err * locR_err * locR_err)));
+					const double thist0 = m_TRTCalDbSvc->getT0(surfaceID);
+					const double trkdrifttime = rtr->drifttime(fabs(locR));
+					const double timeresidual = RawDriftCircle->rawDriftTime() - thist0 - trkdrifttime;
+
+					if (ibe == 0) {
+						if (!isTubeHit) {
+							m_Pull_Biased_Barrel->Fill(pull_b);
+						}
+
+						if (isArgonStraw) {
+							m_hResidual_B_Ar->Fill(loc - locR);
+
+							if (cnst_is_pT_over_20GeV) {
+								m_hResidual_B_Ar_20GeV->Fill(loc - locR);
+							}
+
+							m_hTimeResidual_B_Ar->Fill(timeresidual);
+						} else {
+							m_hResidual_B->Fill(loc - locR);
+							m_hTimeResidual_B->Fill(timeresidual);
+
+							if (cnst_is_pT_over_20GeV) {
+								m_hResidual_B_20GeV->Fill(loc - locR);
+							}
+						}
+					} else if (ibe == 1) {
+						if (!isTubeHit) {
+							m_Pull_Biased_EndCap->Fill(pull_b);
+						}
+
+						if (isArgonStraw) {
+							m_hResidual_E_Ar[iside]->Fill(loc - locR);
+							m_hTimeResidual_E_Ar[iside]->Fill(timeresidual);
+
+							if (cnst_is_pT_over_20GeV) {
+								m_hResidual_E_Ar_20GeV[iside]->Fill(loc - locR);
+							}
+						} else {
+							m_hResidual_E[iside]->Fill(loc - locR);
+							m_hTimeResidual_E[iside]->Fill(timeresidual);
+
+							if (cnst_is_pT_over_20GeV) {
+								m_hResidual_E_20GeV[iside]->Fill(loc - locR);
+							}
+						}
+					}
+				}
+
+				if (m_doShift) {
+					if (ibe == 0) {
+						if (isArgonStraw) {
+							m_hWireToTrkPosition_B_Ar->Fill(locR);
+						} else {
+							m_hWireToTrkPosition_B->Fill(locR);
+						}
+					} else if (ibe == 1) {
+						if (isArgonStraw) {
+							m_hWireToTrkPosition_E_Ar[iside]->Fill(locR);
+						} else {
+							m_hWireToTrkPosition_E[iside]->Fill(locR);
+						}
+					}
+				}
+
+				const float LE = (RawDriftCircle->driftTimeBin()) * 3.125;
+				const float EP = timeCor;
+
+				if (m_doShift && m_doStraws) {
+					if (ibe == 0) {
+						if (isArgonStraw) {
+							if (m_isCosmics) {
+								m_hrtRelation_B_Ar->Fill(LE - EP - t0, fabs(locR));
+							} else {
+								m_hrtRelation_B_Ar->Fill(LE - t0, fabs(locR));
+							}
+						} else {
+							if (m_isCosmics) {
+								m_hrtRelation_B->Fill(LE - EP - t0, fabs(locR));
+							} else {
+								m_hrtRelation_B->Fill(LE - t0, fabs(locR));
+							}
+						}
+					} else if (ibe == 1) {
+						if (isArgonStraw) {
+							if (m_isCosmics) {
+								m_hrtRelation_E_Ar[iside]->Fill(LE - EP - t0, fabs(locR));
+							} else {
+								m_hrtRelation_E_Ar[iside]->Fill(LE - t0, fabs(locR));
+							}
+						} else {
+							if (m_isCosmics) {
+								m_hrtRelation_E[iside]->Fill(LE - EP - t0, fabs(locR));
+							} else {
+								m_hrtRelation_E[iside]->Fill(LE - t0, fabs(locR));
+							}
+						}
+					}
+				}
+
+				const int m_driftTimeBin = RawDriftCircle->driftTimeBin();
+
+				if ( (m_driftTimeBin < 24) &&
+				     !(RawDriftCircle->lastBinHigh()) &&
+				     !(RawDriftCircle->firstBinHigh()) ) {
+					if (m_doStraws) {
+						if (ibe == 0) {
+							m_hHitWonTMap_B->Fill(m_strawNumber[ibe]);
+						} else if (ibe == 1) {
+							m_hHitWonTMap_E[iside]->Fill(m_strawNumber[ibe]);
+						}
+					}
+				}
+
+				if ((m_driftTimeBin > 2) && (m_driftTimeBin < 17)) {
+					if (m_doExpert && m_doStraws)
+						m_hHitWonTMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe], 1.0);
+
+					if (m_doExpert && m_doChips)
+						m_hHitWonTMapC[ibe][iphi_module]->Fill(m_chip[ibe] - 1, 1.0);
+				}
+
+				const int m_trailingEdge = RawDriftCircle->trailingEdge();
+				float trailingEdgeScaled = (m_trailingEdge + 1) * 3.125;
+
+				if ((m_trailingEdge < 23) &&
+				    !(RawDriftCircle->lastBinHigh()) &&
+				    !(RawDriftCircle->firstBinHigh())) {
+					if (m_doExpert && m_doStraws)
+						m_hHitTronTMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe], trailingEdgeScaled);
+
+					if (m_doExpert && m_doChips)
+						m_hHitTronTMapC[ibe][iphi_module]->Fill(m_chip[ibe] - 1, trailingEdgeScaled);
+
+					if (m_doExpert && m_doStraws)
+						m_hHitTronTwEPCMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe], trailingEdgeScaled - timeCor);// Mean TE on Track (with Event Phase correction): Straws
+
+					if (m_doExpert && m_doChips)
+						m_hHitTronTwEPCMapC[ibe][iphi_module]->Fill((m_chip[ibe] - 1), trailingEdgeScaled - timeCor); // Mean TE on Track (with Event Phase correction): Chips
+
+					if (m_doShift && m_doStraws) {
+						if (RawDriftCircle->driftTimeValid()) {
+							if (ibe == 0) {
+								if (isArgonStraw) {
+									m_hTronTDist_B_Ar->Fill(trailingEdgeScaled);
+									m_hAvgTroTDetPhi_B_Ar->Fill(m_phi2D[ibe], trailingEdgeScaled);
+								} else {
+									m_hTronTDist_B->Fill(trailingEdgeScaled);
+									m_hAvgTroTDetPhi_B->Fill(m_phi2D[ibe], trailingEdgeScaled);
+								}
+							} else if (ibe == 1) {
+								if (isArgonStraw) {
+									m_hTronTDist_E_Ar[iside]->Fill(trailingEdgeScaled);
+									m_hAvgTroTDetPhi_E_Ar[iside]->Fill(m_phi2D[ibe], trailingEdgeScaled);
+								} else {
+									m_hTronTDist_E[iside]->Fill(trailingEdgeScaled);
+									m_hAvgTroTDetPhi_E[iside]->Fill(m_phi2D[ibe], trailingEdgeScaled);
+								}
+							}
+						}
+					}
+				}
+
+				const bool m_firstBinHigh = RawDriftCircle->firstBinHigh();
+				const bool m_lastBinHigh = RawDriftCircle->lastBinHigh();
+
+				if (m_firstBinHigh || m_lastBinHigh || m_driftTimeBin > 0 || m_trailingEdge < 23) {
+					if (m_doExpert && m_doStraws)
+						m_hHitAonTMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe]);
+
+					if (m_doExpert && m_doChips)
+						m_hHitAonTMapC[ibe][iphi_module]->Fill(m_chip[ibe] - 1);
+
+					m_nTRTHitsW[ibe][iside]++;
+
+					if (isArgonStraw) {
+						m_nTRTHitsW_Ar[ibe][iside]++;
+					} else {
+						m_nTRTHitsW_Xe[ibe][iside]++;
+					}
+
+					m_nTRTHitsW_perwheel[iside][m_layer_or_wheel]++;
+
+					if (is_middleHTbit_high) {
+						m_nTRTHLHitsW[ibe][iside]++;
+
+						if (isArgonStraw) {
+							m_nTRTHLHitsW_Ar[ibe][iside]++;
+						} else {
+							m_nTRTHLHitsW_Xe[ibe][iside]++;
+						}
+					}
+				}
+
+				if (is_anybininVgate_high) {
+					if (m_doExpert && m_doStraws)
+						m_hHitAWonTMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe]);
+
+					if (m_doExpert && m_doChips)
+						m_hHitAWonTMapC[ibe][iphi_module]->Fill(m_chip[ibe] - 1);
+				}
+			}
+		}
+
+		//ToDo: work on the part below
+		for (int ibe = 0; ibe < 2; ibe++) {
+			for (int i = 0; i < 64; i++)
+				if (trackfound[ibe][i])
+					ntrackstack[ibe][i]++;
+
+			if (m_doShift) {
+				if (ibe == 0) {
+					if (hitontrack[ibe] >= m_minTRThits)
+						m_hNumHoTDetPhi_B->Fill(m_phi2D[ibe], hitontrack[ibe]);
+				}
+
+				if (ibe == 1) {
+					if (hitontrack_E_side[0] >= m_minTRThits)
+						m_hNumHoTDetPhi_E[0]->Fill(m_phi2D[ibe], hitontrack_E_side[0]);
+
+					if (hitontrack_E_side[1] >= m_minTRThits)
+						m_hNumHoTDetPhi_E[1]->Fill(m_phi2D[ibe], hitontrack_E_side[1]);
+				}
+			}
+
+			if (m_phi2D[ibe] < 0) continue;
+
+			if (m_doShift) {
+				if (ibe == 0) {
+					if (m_nTRTHitsW[ibe][0] + m_nTRTHitsW[ibe][1] > 0)
+						m_hNumTrksDetPhi_B->Fill(m_phi2D[ibe]);
+				} else if (ibe == 1) {
+					if (m_nTRTHitsW[ibe][0] > 0)
+						m_hNumTrksDetPhi_E[0]->Fill(m_phi2D[ibe]);
+
+					if (m_nTRTHitsW[ibe][1] > 0)
+						m_hNumTrksDetPhi_E[1]->Fill(m_phi2D[ibe]);
+				}
+			}
+
+			if (m_doShift) {
+				if (innerstack[ibe] >= 0 && innerstack[ibe] < s_iStack_max[ibe]) {
+					if (ibe == 0) {
+						m_LonTrack_B[innerstack[ibe]] += m_nTRTHitsW[ibe][0] + m_nTRTHitsW[ibe][1];
+
+						if (m_nTRTHitsW[ibe][0] + m_nTRTHitsW[ibe][1] > 0) {
+							m_HTfraconTrack_B[innerstack[ibe]] += (float)(m_nTRTHLHitsW[ibe][0] + m_nTRTHLHitsW[ibe][1]) / (m_nTRTHitsW[ibe][0] + m_nTRTHitsW[ibe][1]);
+							m_nTrack_B[innerstack[ibe]] = m_nTrack_B[innerstack[ibe]] + 1;
+						}
+					} else if (ibe == 1) {
+						m_LonTrack_E[innerstack[ibe]] += m_nTRTHitsW[ibe][0] + m_nTRTHitsW[ibe][1];
+
+						if ((m_nTRTHitsW[ibe][0] + m_nTRTHitsW[ibe][1]) > 0) {
+							m_HTfraconTrack_E[innerstack[ibe]] += (float)(m_nTRTHLHitsW[ibe][0] + m_nTRTHLHitsW[ibe][1]) / (m_nTRTHitsW[ibe][0] + m_nTRTHitsW[ibe][1]);
+							m_nTrack_E[innerstack[ibe]] = m_nTrack_E[innerstack[ibe]] + 1;
+						}
+					}
+				}
+			}
+
+			if (m_doShift) {
+				if (ibe == 0) {
+					if (isBarrelOnly) {
+						if (m_nTRTHitsW[ibe][0] > 0) {
+							if (m_nTRTHitsW[ibe][1] > 0) m_hNumSwLLWoT_B->Fill(m_nTRTHitsW[ibe][0] + m_nTRTHitsW[ibe][1]);
+							else m_hNumSwLLWoT_B->Fill(m_nTRTHitsW[ibe][0]);
+						} else if (m_nTRTHitsW[ibe][1] > 0) {
+							m_hNumSwLLWoT_B->Fill(m_nTRTHitsW[ibe][1]);
+						}
+					}
+
+					if (m_nTRTHLHitsW[ibe][0] > 0) {
+						if (m_nTRTHLHitsW[ibe][1] > 0) {
+							m_hHLhitOnTrack_B->Fill(m_nTRTHLHitsW[ibe][0] + m_nTRTHLHitsW[ibe][1]);
+						} else {
+							m_hHLhitOnTrack_B->Fill(m_nTRTHLHitsW[ibe][0]);
+						}
+					} else if (m_nTRTHLHitsW[ibe][1] > 0) {
+						m_hHLhitOnTrack_B->Fill(m_nTRTHLHitsW[ibe][1]);
+					}
+
+					if (m_nTRTHitsW[ibe][0] + m_nTRTHitsW[ibe][1] > 0) {
+						m_hHtoLRatioOnTrack_B->Fill((float)(m_nTRTHLHitsW[ibe][0] + m_nTRTHLHitsW[ibe][1]) / (m_nTRTHitsW[ibe][0] + m_nTRTHitsW[ibe][1]));
+					}
+
+					if (m_nTRTHitsW_Ar[ibe][0] + m_nTRTHitsW_Ar[ibe][1] > 0) {
+						m_hHtoLRatioOnTrack_B_Ar->Fill((float)(m_nTRTHLHitsW_Ar[ibe][0] + m_nTRTHLHitsW_Ar[ibe][1]) / (m_nTRTHitsW_Ar[ibe][0] + m_nTRTHitsW_Ar[ibe][1]));
+					}
+
+					if (m_nTRTHitsW_Xe[ibe][0] + m_nTRTHitsW_Xe[ibe][1] > 0) {
+						m_hHtoLRatioOnTrack_B_Xe->Fill((float)(m_nTRTHLHitsW_Xe[ibe][0] + m_nTRTHLHitsW_Xe[ibe][1]) / (m_nTRTHitsW_Xe[ibe][0] + m_nTRTHitsW_Xe[ibe][1]));
+					}
+				} else if (ibe == 1) {
+					if (m_nTRTHitsW[ibe][0] > 0) {
+						if (m_nTRTHitsW[ibe][1] > 0) {
+							if (ECAhit && !ECChit && !Bhit) {
+								m_hNumSwLLWoT_E[0]->Fill(m_nTRTHitsW[ibe][0]);
+							}
+
+							if (ECChit && !ECAhit && !Bhit) {
+								m_hNumSwLLWoT_E[1]->Fill(m_nTRTHitsW[ibe][1]);
+							}
+						}
+
+						if (ECAhit && !ECChit && !Bhit) {
+							m_hNumSwLLWoT_E[0]->Fill(m_nTRTHitsW[ibe][0]);
+						}
+					} else if (m_nTRTHitsW[ibe][1] > 0) {
+						if (ECChit && !ECAhit && !Bhit) {
+							m_hNumSwLLWoT_E[1]->Fill(m_nTRTHitsW[ibe][1]);
+						}
+					}
+
+					for (int iside = 0; iside < 2; iside++) {
+						if (m_nTRTHLHitsW[ibe][iside] > 0) {
+							m_hHLhitOnTrack_E[iside]->Fill(m_nTRTHLHitsW[ibe][iside]);
+						}
+
+						if ((m_nTRTHitsW[ibe][iside]) > 0) {
+							m_hHtoLRatioOnTrack_E[iside]->Fill((float)(m_nTRTHLHitsW[ibe][iside]) / m_nTRTHitsW[ibe][iside]);
+
+							if ((m_nTRTHitsW_Ar[ibe][iside]) > 0) {
+								m_hHtoLRatioOnTrack_E_Ar[iside]->Fill((float)(m_nTRTHLHitsW_Ar[ibe][iside]) / m_nTRTHitsW_Ar[ibe][iside]);
+							}
+
+							if ((m_nTRTHitsW_Xe[ibe][iside]) > 0) {
+								m_hHtoLRatioOnTrack_E_Xe[iside]->Fill((float)(m_nTRTHLHitsW_Xe[ibe][iside]) / m_nTRTHitsW_Xe[ibe][iside]);
+							}
+						}
+					}
+				}
+			}
+
+			if (ibe == 0) {
+				if ((m_nTRTHitsW[ibe][0] + m_nTRTHitsW[ibe][1]) > 0) {
+					nTrksperLB_B++;
+				}
+				if (comTimeObject) {
+					if (m_doShift && (m_phi2D[ibe] > 0) && (std::fabs(timeCor) > 1e-8)) {
+						m_hEvtPhaseDetPhi_B->Fill(m_phi2D[ibe], timeCor);
+					}
+				}
+			} else if (ibe == 1) {
+				for (int iside = 0; iside < 2; iside++) {
+					if (m_nTRTHitsW[ibe][iside] > 0) nTrksperLB_E[iside]++;
+					if (comTimeObject) {
+						if (m_nTRTHits_side[ibe][iside] > 5 && (std::fabs(timeCor)
+						                                        > 1e-8)) {
+							if (m_doShift) m_hEvtPhaseDetPhi_E[iside]->Fill(m_phi2D[ibe], timeCor);
+						}
+					}
+				}
+			}
+		}
 	}
 
-	float locR_err = 0.0;
-	const AmgSymMatrix(5)* b_err = aTrackParam->covariance();
-	if(b_err){
-	  locR_err = Amg::error(*b_err,Trk::locR);
+	if (comTimeObject) {
+		if (std::fabs(timeCor) > 1e-8) {
+			if (m_doShift) {
+				m_hEvtPhase->Fill(timeCor);
+			}
+
+			if (m_doShift && trigDecision) {
+				std::vector<int> trigid;
+				trigid.clear(); // Trigger ID
+				// get bits for trigger after veto
+				std::vector<unsigned int> level1TAV = trigDecision->tav();
+
+				for (unsigned int j = 0; j < 8 && j < level1TAV.size(); ++j) {
+					for (unsigned int i = 0; i < 32; ++i) {
+						if ((level1TAV[j] >> i) & 0x1) {
+							trigid.push_back(i + (j % 8) * 32); // Found the ID
+						}
+					}
+				}
+
+				for (unsigned int j = 0; j < trigid.size(); ++j) {
+					m_hEvtPhaseVsTrig->Fill(timeCor, trigid[j]);// Event Phase vs. Trigger Item
+				}
+			}
+		}
 	}
-	else{
-	  ATH_MSG_ERROR("Track parameters have no covariance attached.");
+
+	for (int ibe = 0; ibe < 2; ibe++) {
+		if (m_environment == AthenaMonManager::online && m_totalEvents > 0) {
+			//Loop over stack histograms and normalize to number of events processed.
+			if (m_doChips && m_doExpert) {
+				for (int i = 0; i < 64; i++) {
+					divide_LWHist(m_hHitOnTrackVsAllC[ibe][i], m_hHitAonTMapC[ibe][i], m_hHitAMapC[ibe][i]);
+
+					for (int j = 0; j < s_iChip_max[ibe]; j++) {
+						if (m_hChipsEff[ibe][i]->GetBinEntries(j + 1) > 0) {
+							float effScale = 1. / m_hChipsEff[ibe][i]->GetBinEntries(j + 1);
+							int binContent = m_hHitAonTMapC[ibe][i]->GetBinContent(j + 1);
+							m_hHitAonTMapC[ibe][i]->SetBinContent(j + 1, binContent * effScale);
+							binContent = m_hHitAWonTMapC[ibe][i]->GetBinContent(j + 1);
+							m_hHitAWonTMapC[ibe][i]->SetBinContent(j + 1, binContent * effScale);
+							binContent = m_hHitHonTMapC[ibe][i]->GetBinContent(j + 1);
+							m_hHitHonTMapC[ibe][i]->SetBinContent(j + 1, binContent * effScale);
+							binContent = m_hHitHWonTMapC[ibe][i]->GetBinContent(j + 1);
+							m_hHitHWonTMapC[ibe][i]->SetBinContent(j + 1, binContent * effScale);
+							binContent = m_hHitWonTMapC[ibe][i]->GetBinContent(j + 1);
+							m_hHitWonTMapC[ibe][i]->SetBinContent(j + 1, binContent * effScale);
+						} else {
+							m_hHitAonTMapC[ibe][i]->SetBinContent(j + 1, 0);
+							m_hHitHonTMapC[ibe][i]->SetBinContent(j + 1, 0);
+							m_hHitWonTMapC[ibe][i]->SetBinContent(j + 1, 0);
+							m_hHitAWonTMapC[ibe][i]->SetBinContent(j + 1, 0);
+							m_hHitHWonTMapC[ibe][i]->SetBinContent(j + 1, 0);
+						}
+					}
+
+					divide_LWHist(m_hHtoLMapC[ibe][i], m_hHitHMapC[ibe][i], m_hHitAMapC[ibe][i]);
+					divide_LWHist(m_hHtoLonTMapC[ibe][i], m_hHitHonTMapC[ibe][i], m_hHitAonTMapC[ibe][i]);
+					divide_LWHist(m_hHtoLWonTMapC[ibe][i], m_hHitHWonTMapC[ibe][i], m_hHitAWonTMapC[ibe][i]);
+				}
+			}
+
+			if (m_doStraws) {
+				for (int i = 0; i < 64; i++) {
+					if (m_doExpert) {
+						divide_LWHist(m_hHitOnTrackVsAllS[ibe][i], m_hHitAonTMapS[ibe][i], m_hHitAMapS[ibe][i]);
+					}
+
+					for (int j = 0; j < s_Straw_max[ibe]; j++) {
+						if (i == 0) {
+							if (ibe == 0) {
+								if (m_nStrawHits_B[j] > 0) {
+									m_hHitWonTMap_B->SetBinContent(j + 1, m_hHitWonTMap_B->GetBinContent(j + 1) / m_nStrawHits_B[j]);
+								}
+							} else if (ibe == 1) {
+								if (m_nStrawHits_E[0][j] > 0) {
+									m_hHitWonTMap_E[0]->SetBinContent(j + 1, m_hHitWonTMap_E[0]->GetBinContent(j + 1) / m_nStrawHits_E[0][j]);
+								}
+
+								if (m_nStrawHits_E[1][j] > 0) {
+									m_hHitWonTMap_E[1]->SetBinContent(j + 1, m_hHitWonTMap_E[1]->GetBinContent(j + 1) / m_nStrawHits_E[1][j]);
+								}
+							}
+						}
+
+						if (m_doExpert) {
+							if (m_hStrawsEff[ibe][i]->GetBinEntries(j + 1) > 0) {
+								float effScale = 1. / m_hStrawsEff[ibe][i]->GetBinEntries(j + 1);
+								int binContent = m_hHitAonTMapS[ibe][i]->GetBinContent(j + 1);
+								m_hHitAonTMapS[ibe][i]->SetBinContent(j + 1, binContent * effScale);
+								binContent = m_hHitAWonTMapS[ibe][i]->GetBinContent(j + 1);
+								m_hHitAWonTMapS[ibe][i]->SetBinContent(j + 1, binContent * effScale);
+								binContent = m_hHitHonTMapS[ibe][i]->GetBinContent(j + 1);
+								m_hHitHonTMapS[ibe][i]->SetBinContent(j + 1, binContent * effScale);
+								binContent = m_hHitHWonTMapS[ibe][i]->GetBinContent(j + 1);
+								m_hHitHWonTMapS[ibe][i]->SetBinContent(j + 1, binContent * effScale);
+								binContent = m_hHitWonTMapS[ibe][i]->GetBinContent(j + 1);
+								m_hHitWonTMapS[ibe][i]->SetBinContent(j + 1, binContent * effScale);
+							} else {
+								m_hHitAWonTMapS[ibe][i]->SetBinContent(j + 1, 0);
+								m_hHitAonTMapS[ibe][i]->SetBinContent(j + 1, 0);
+								m_hHitHonTMapS[ibe][i]->SetBinContent(j + 1, 0);
+								m_hHitHWonTMapS[ibe][i]->SetBinContent(j + 1, 0);
+								m_hHitWonTMapS[ibe][i]->SetBinContent(j + 1, 0);
+							}
+						}
+					}
+
+					if (m_doExpert) {
+						divide_LWHist(m_hHtoLMapS[ibe][i], m_hHitHMapS[ibe][i], m_hHitAMapS[ibe][i]);
+						divide_LWHist(m_hHtoLonTMapS[ibe][i], m_hHitHonTMapS[ibe][i], m_hHitAonTMapS[ibe][i]);
+						divide_LWHist(m_hHtoLWonTMapS[ibe][i], m_hHitHWonTMapS[ibe][i], m_hHitAWonTMapS[ibe][i]);
+					}
+				}
+			}
+
+			if (m_doShift) {
+				if (ibe == 0) {
+					m_hSummary->SetBinContent(2, m_nTotalTracks);
+					m_hSummary->SetBinContent(3, m_nTracksB[0]);
+					m_hSummary->SetBinContent(4, m_nTracksB[1]);
+					m_hSummary->SetBinContent(5, m_nTracksEC[0]);
+					m_hSummary->SetBinContent(6, m_nTracksEC[1]);
+					m_hSummary->SetBinContent(7, m_nTracksEC_B[0]);
+					m_hSummary->SetBinContent(8, m_nTracksEC_B[1]);
+					EventPhaseScale = m_hEvtPhase->GetEntries() * 3.125;
+
+					if (EventPhaseScale > 0) {
+						scale_LWHist(m_hEvtPhase, 1. / EventPhaseScale);
+					}
+
+					DriftTimeonTrkDistScale_B = m_hDriftTimeonTrkDist_B->GetEntries() * 3.125;
+
+					if (DriftTimeonTrkDistScale_B > 0) {
+						scale_LWHist(m_hDriftTimeonTrkDist_B, 1. / DriftTimeonTrkDistScale_B);
+					}
+
+					HLhitOnTrackScale_B = m_hHLhitOnTrack_B->GetEntries();
+
+					if (HLhitOnTrackScale_B > 0) {
+						scale_LWHist(m_hHLhitOnTrack_B, 1. / HLhitOnTrackScale_B);
+					}
+
+					HtoLRatioOnTrackScale_B = m_hHtoLRatioOnTrack_B->GetEntries() * 0.02;
+
+					if (HtoLRatioOnTrackScale_B > 0) {
+						scale_LWHist(m_hHtoLRatioOnTrack_B, 1. / HtoLRatioOnTrackScale_B);
+					}
+
+					NumSwLLWoTScale_B = m_hNumSwLLWoT_B->GetEntries();
+
+					if (NumSwLLWoTScale_B > 0) {
+						scale_LWHist(m_hNumSwLLWoT_B, 1. / NumSwLLWoTScale_B);
+					}
+
+					WireToTrkPositionScale_B = m_hWireToTrkPosition_B->GetEntries() * 0.1;
+
+					if (WireToTrkPositionScale_B > 0) {
+						scale_LWHist(m_hWireToTrkPosition_B, 1. / WireToTrkPositionScale_B);
+					}
+
+					TronTDistScale_B = m_hTronTDist_B->GetEntries() * 3.125;
+
+					if (TronTDistScale_B > 0) {
+						scale_LWHist(m_hTronTDist_B, 1. / TronTDistScale_B);
+					}
+
+					ResidualScale_B = m_hResidual_B->GetEntries() * 0.025;
+
+					if (ResidualScale_B > 0) {
+						scale_LWHist(m_hResidual_B, 1. / ResidualScale_B);
+					}
+
+					ResidualScale_B_20GeV = m_hResidual_B_20GeV->GetEntries() * 0.025;
+
+					if (ResidualScale_B_20GeV > 0) {
+						scale_LWHist(m_hResidual_B_20GeV, 1. / ResidualScale_B_20GeV);
+					}
+
+					TimeResidualScale_B = m_hTimeResidual_B->GetEntries() * 0.2;
+
+					if (TimeResidualScale_B > 0) {
+						scale_LWHist(m_hTimeResidual_B, 1. / TimeResidualScale_B);
+					}
+
+					if (m_ArgonXenonSplitter) {
+						DriftTimeonTrkDistScale_B_Ar = m_hDriftTimeonTrkDist_B_Ar->GetEntries() * 3.125;
+
+						if (DriftTimeonTrkDistScale_B_Ar > 0) {
+							scale_LWHist(m_hDriftTimeonTrkDist_B_Ar, 1. / DriftTimeonTrkDistScale_B_Ar);
+						}
+
+						WireToTrkPositionScale_B_Ar = m_hWireToTrkPosition_B_Ar->GetEntries() * 0.1;
+
+						if (WireToTrkPositionScale_B_Ar > 0) {
+							scale_LWHist(m_hWireToTrkPosition_B_Ar, 1. / WireToTrkPositionScale_B_Ar);
+						}
+
+						TronTDistScale_B_Ar = m_hTronTDist_B_Ar->GetEntries() * 3.125;
+
+						if (TronTDistScale_B_Ar > 0) {
+							scale_LWHist(m_hTronTDist_B_Ar, 1. / TronTDistScale_B_Ar);
+						}
+
+						ResidualScale_B_Ar = m_hResidual_B_Ar->GetEntries() * 0.025;
+
+						if (ResidualScale_B_Ar > 0) {
+							scale_LWHist(m_hResidual_B_Ar, 1. / ResidualScale_B_Ar);
+						}
+
+						ResidualScale_B_Ar_20GeV = m_hResidual_B_Ar_20GeV->GetEntries() * 0.025;
+
+						if (ResidualScale_B_Ar_20GeV > 0) {
+							scale_LWHist(m_hResidual_B_Ar_20GeV, 1. / ResidualScale_B_Ar_20GeV);
+						}
+
+						TimeResidualScale_B_Ar = m_hTimeResidual_B_Ar->GetEntries() * 0.2;
+
+						if (TimeResidualScale_B_Ar > 0) {
+							scale_LWHist(m_hTimeResidual_B_Ar, 1. / TimeResidualScale_B_Ar);
+						}
+					}
+				} else if (ibe == 1) {
+					for (int iside = 0; iside < 2; iside++) {
+						DriftTimeonTrkDistScale_E[iside] = m_hDriftTimeonTrkDist_E[iside]->GetEntries() * 3.125;
+
+						if (DriftTimeonTrkDistScale_E[iside] > 0) {
+							scale_LWHist(m_hDriftTimeonTrkDist_E[iside], 1. / DriftTimeonTrkDistScale_E[iside]);
+						}
+
+						HLhitOnTrackScale_E[iside] = m_hHLhitOnTrack_E[iside]->GetEntries();
+
+						if (HLhitOnTrackScale_E[iside] > 0) {
+							scale_LWHist(m_hHLhitOnTrack_E[iside], 1. / HLhitOnTrackScale_E[iside]);
+						}
+
+						HtoLRatioOnTrackScale_E[iside] = m_hHtoLRatioOnTrack_E[iside]->GetEntries() * 0.02;
+
+						if (HtoLRatioOnTrackScale_E[iside] > 0) {
+							scale_LWHist(m_hHtoLRatioOnTrack_E[iside], 1. / HtoLRatioOnTrackScale_E[iside]);
+						}
+
+						NumSwLLWoTScale_E[iside] = m_hNumSwLLWoT_E[iside]->GetEntries();
+
+						if (NumSwLLWoTScale_E[iside] > 0) {
+							scale_LWHist(m_hNumSwLLWoT_E[iside], 1. / NumSwLLWoTScale_E[iside]);
+						}
+
+						WireToTrkPositionScale_E[iside] = m_hWireToTrkPosition_E[iside]->GetEntries() * 0.1;
+
+						if (WireToTrkPositionScale_E[iside] > 0) {
+							scale_LWHist(m_hWireToTrkPosition_E[iside], 1. / WireToTrkPositionScale_E[iside]);
+						}
+
+						TronTDistScale_E[iside] = m_hTronTDist_E[iside]->GetEntries() * 3.125;
+
+						if (TronTDistScale_E[iside] > 0) {
+							scale_LWHist(m_hTronTDist_E[iside], 1. / TronTDistScale_E[iside]);
+						}
+
+						ResidualScale_E[iside] = m_hResidual_E[iside]->GetEntries() * 0.025;
+
+						if (ResidualScale_E[iside] > 0) {
+							scale_LWHist(m_hResidual_E[iside], 1. / ResidualScale_E[iside]);
+						}
+
+						ResidualScale_E_20GeV[iside] = m_hResidual_E_20GeV[iside]->GetEntries() * 0.025;
+
+						if (ResidualScale_E_20GeV[iside] > 0) {
+							scale_LWHist(m_hResidual_E_20GeV[iside], 1. / ResidualScale_E_20GeV[iside]);
+						}
+
+						TimeResidualScale_E[iside] = m_hTimeResidual_E[iside]->GetEntries() * 0.2;
+
+						if (TimeResidualScale_E[iside] > 0) {
+							scale_LWHist(m_hTimeResidual_E[iside], 1. / TimeResidualScale_E[iside]);
+						}
+
+						if (m_ArgonXenonSplitter) {
+							DriftTimeonTrkDistScale_E_Ar[iside] = m_hDriftTimeonTrkDist_E_Ar[iside]->GetEntries() * 3.125;
+
+							if (DriftTimeonTrkDistScale_E_Ar[iside] > 0) {
+								scale_LWHist(m_hDriftTimeonTrkDist_E_Ar[iside], 1. / DriftTimeonTrkDistScale_E_Ar[iside]);
+							}
+
+							WireToTrkPositionScale_E_Ar[iside] = m_hWireToTrkPosition_E_Ar[iside]->GetEntries() * 0.1;
+
+							if (WireToTrkPositionScale_E_Ar[iside] > 0) {
+								scale_LWHist(m_hWireToTrkPosition_E_Ar[iside], 1. / WireToTrkPositionScale_E_Ar[iside]);
+							}
+
+							TronTDistScale_E_Ar[iside] = m_hTronTDist_E_Ar[iside]->GetEntries() * 3.125;
+
+							if (TronTDistScale_E_Ar[iside] > 0) {
+								scale_LWHist(m_hTronTDist_E_Ar[iside], 1. / TronTDistScale_E_Ar[iside]);
+							}
+
+							ResidualScale_E_Ar[iside] = m_hResidual_E_Ar[iside]->GetEntries() * 0.025;
+
+							if (ResidualScale_E_Ar[iside] > 0) {
+								scale_LWHist(m_hResidual_E_Ar[iside], 1. / ResidualScale_E_Ar[iside]);
+							}
+
+							ResidualScale_E_Ar_20GeV[iside] = m_hResidual_E_Ar_20GeV[iside]->GetEntries() * 0.025;
+
+							if (ResidualScale_E_Ar_20GeV[iside] > 0) {
+								scale_LWHist(m_hResidual_E_Ar_20GeV[iside], 1. / ResidualScale_E_Ar_20GeV[iside]);
+							}
+
+							TimeResidualScale_E_Ar[iside] = m_hTimeResidual_E_Ar[iside]->GetEntries() * 0.2;
+
+							if (TimeResidualScale_E_Ar[iside] > 0) {
+								scale_LWHist(m_hTimeResidual_E_Ar[iside], 1. / TimeResidualScale_E_Ar[iside]);
+							}
+						}
+					}
+				}
+			}
+		}
 	}
-	float loc_err  = sqrt(Amg::error(trtCircle->localCovariance(),Trk::driftRadius)) ;
-
-	float locR = aTrackParam->parameters()[Trk::driftRadius];
-	float loc  = trtCircle->localParameters()[Trk::driftRadius];
-	if (isTubeHit) {
-	  bool isOK = false;
-	  loc = m_drifttool->driftRadius(RawDriftCircle->rawDriftTime(), DCoTId, t0, isOK);
-	  if ((loc * locR) < 0) loc = -loc;
+
+	return StatusCode::SUCCESS;
+}
+
+//Fill the TRT Eff histograms
+//----------------------------------------------------------------------------------//
+StatusCode TRT_Monitoring_Tool::fillTRTEfficiency(const TrackCollection& combTrackCollection) {
+//----------------------------------------------------------------------------------//
+	ATH_MSG_VERBOSE("Filling TRT Eff Histos");
+	// reduce unnecessary divisions
+	const float invGeV = 1. / CLHEP::GeV;
+	const float invmm = 1. / CLHEP::mm;
+	int itrack = 0;
+
+	for (auto track = combTrackCollection.begin(); track != combTrackCollection.end(); ++track) {
+		// online: use all tracks, offline: use only every xth track, skip the rest
+		if (m_environment != AthenaMonManager::online && (itrack % m_every_xth_track) != 0) continue;
+
+		++itrack;
+		// get perigee
+		const Trk::Perigee *perigee = (*track)->perigeeParameters();
+
+		if (perigee) {
+			m_track_pt  = perigee->pT();
+			m_track_eta = perigee->eta();
+			m_track_phi = perigee->parameters()[Trk::phi0];
+			m_track_d0  = perigee->parameters()[Trk::d0];
+			m_track_z0  = perigee->parameters()[Trk::z0];
+			ATH_MSG_DEBUG("This track has perigee parameters:\n"
+			              << "                 pT     = " << m_track_pt * invGeV  << " GeV" << "\n"
+			              << "                 eta =    " << m_track_eta << "\n"
+			              << "                 phi0 =   " << m_track_phi << "\n"
+			              << "                 d0 =     " << m_track_d0 * invmm << "\n"
+			              << "                 z0 =     " << m_track_z0 * invmm << "\n"
+			              << "                 theta =  " << perigee->parameters()[Trk::theta] << "\n"
+			              << "                 qOverP = " << perigee->parameters()[Trk::qOverP]);
+		} else {
+			ATH_MSG_DEBUG("This track has null perigeeParameters.");
+			continue;
+		}
+
+		const DataVector<const Trk::TrackStateOnSurface> *track_states = (*track)->trackStateOnSurfaces();
+
+		if (track_states) {
+			ATH_MSG_DEBUG("This track has " << track_states->size() << " track states on surface.");
+		} else {
+			ATH_MSG_DEBUG("This track has null track states on surface.");
+			continue;
+		}
+
+		const std::auto_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->createSummary(*(*track)));
+		int n_trt_hits = summary->get(Trk::numberOfTRTHits);
+		int n_sct_hits = summary->get(Trk::numberOfSCTHits);
+		int n_pixel_hits = summary->get(Trk::numberOfPixelHits);
+		float m_p = 1.0e+08;
+
+		if (perigee) {
+			m_p = (perigee->parameters()[Trk::qOverP] != 0.) ? fabs(1. / (perigee->parameters()[Trk::qOverP])) : 1.0e+08;
+		}
+
+		float min_pt_new = m_min_pT;
+
+		if (m_isCosmics == false) {
+			min_pt_new = 2.0 * CLHEP::GeV;
+		}
+
+		// preselect tracks
+		const bool passed_track_preselection =
+			(fabs(perigee->parameters()[Trk::d0]) < m_max_abs_d0) &&
+			(fabs(perigee->parameters()[Trk::z0]) < m_max_abs_z0) &&
+			(perigee->pT() > min_pt_new) &&
+			(m_p > m_minP) &&
+			(fabs(perigee->eta()) < m_max_abs_eta) &&
+			(n_pixel_hits >= m_min_pixel_hits) &&
+			(n_sct_hits >= m_min_sct_hits) &&
+			(n_trt_hits >= m_min_trt_hits);
+		ATH_MSG_DEBUG("track has ntrt = " << n_trt_hits
+		              << " and nsct = " << n_sct_hits
+		              << " and npix = " << n_pixel_hits);
+
+		if (!passed_track_preselection) {
+			ATH_MSG_DEBUG("This track failed preselection.");
+			continue;
+		}
+
+		ATH_MSG_DEBUG("This track passed preselection.");
+
+		for (auto it = track_states->begin(); it != track_states->end(); it++) {
+			if ( !((*it)->type(Trk::TrackStateOnSurface::Measurement)) ) continue;
+
+			const Trk::TrackParameters *track_parameters = (*it)->trackParameters();
+
+			if (!track_parameters) continue;
+
+			Identifier id = track_parameters->associatedSurface().associatedDetectorElementIdentifier();
+
+			if ( !((m_pTRTHelper->is_trt(id)) )) continue;
+
+			float locR = track_parameters->parameters()[Trk::driftRadius];
+			int m_barrel_ec       = m_pTRTHelper->barrel_ec(id);
+			int m_layer_or_wheel  = m_pTRTHelper->layer_or_wheel(id);
+			int m_phi_module      = m_pTRTHelper->phi_module(id);
+			int m_straw_layer     = m_pTRTHelper->straw_layer(id);
+			int m_straw           = m_pTRTHelper->straw(id);
+			const bool isArgonStraw = (Straw_Gastype( m_sumSvc->getStatusHT(id) ) == GasType::Ar);
+			// assume always Xe if m_ArgonXenonSplitter is not enabled, otherwise check the straw status (good is Xe, non-good is Ar)
+			// ibe = 0 (Barrel), ibe = 1 (Endcap)
+			int ibe   = abs(m_barrel_ec) - 1;
+			// iside = 0 (Side A), iside = 1 (Side C)
+			int iside = m_barrel_ec > 0 ? 0 : 1;
+
+			if (ibe == 0) {
+				if (isArgonStraw) {
+					m_hefficiencyBarrel_locR_Ar->Fill(locR, 1.0);
+				} else {
+					m_hefficiencyBarrel_locR->Fill(locR, 1.0);
+				}
+			} else if (ibe == 1) {
+				if (isArgonStraw) {
+					m_hefficiencyEndCap_locR_Ar[iside]->Fill(locR, 1.0);
+				} else {
+					m_hefficiencyEndCap_locR[iside]->Fill(locR, 1.0);
+				}
+			}
+
+			if (fabs(locR) >= 1.3) continue;
+
+			int m_strawNumber = 0;
+			int m_chip = 0;
+
+			if (ibe == 0) {
+				m_strawNumber = strawNumber(m_straw, m_straw_layer, m_layer_or_wheel);
+
+				if (m_strawNumber >= 0 && m_strawNumber < s_Straw_max[ibe])
+					m_chip = mat_chip_B[m_phi_module][m_strawNumber];
+			} else if (ibe == 1) {
+				m_strawNumber = strawNumberEndCap(m_straw, m_straw_layer, m_layer_or_wheel, m_phi_module, m_barrel_ec);
+
+				if (m_strawNumber >= 0 && m_strawNumber < s_Straw_max[ibe])
+					m_chip = mat_chip_E[m_phi_module][m_strawNumber];
+			}
+
+			m_hefficiencyMap[ibe]->Fill(m_strawNumber, 1.0);
+
+			if (m_doExpert) {
+				if (iside == 0) {
+					m_hefficiencyS[ibe][m_phi_module]->Fill(m_strawNumber, 1.0);
+					m_hefficiencyC[ibe][m_phi_module]->Fill(m_chip, 1.0);
+				} else if (iside == 1) {
+					m_hefficiencyS[ibe][m_phi_module + 32]->Fill(m_strawNumber, 1.0);
+					m_hefficiencyC[ibe][m_phi_module + 32]->Fill(m_chip, 1.0);
+				}
+			}
+
+			m_hefficiency_eta->Fill(m_track_eta, 1.0);
+			m_hefficiency_phi->Fill(m_track_phi, 1.0);
+			m_hefficiency_pt->Fill(m_track_pt * invGeV, 1.0);
+			m_hefficiency_z0->Fill(m_track_z0, 1.0);
+		}
+
+		//use hole finder to find holes on this track !
+
+		if (m_useHoleFinder) {
+			const DataVector<const Trk::TrackStateOnSurface> *holes = m_trt_hole_finder->getHolesOnTrack(**track);
+
+			if (!holes) {
+				ATH_MSG_WARNING("TRTTrackHoleSearchTool returned null results.");
+				continue;
+			} else {
+				for (auto it = holes->begin(); it != holes->end(); ++it) {
+					if ( !((*it)->type(Trk::TrackStateOnSurface::Hole)) ) continue;
+
+					const Trk::TrackParameters *track_parameters = (*it)->trackParameters();
+
+					if (!track_parameters) continue;
+
+					Identifier id = track_parameters->associatedSurface().associatedDetectorElementIdentifier();
+
+					if ( !(m_pTRTHelper->is_trt(id)) ) continue;
+
+					float locR = track_parameters->parameters()[Trk::driftRadius];
+					int m_barrel_ec = m_pTRTHelper->barrel_ec(id);
+					int m_layer_or_wheel = m_pTRTHelper->layer_or_wheel(id);
+					int m_phi_module = m_pTRTHelper->phi_module(id);
+					int m_straw_layer = m_pTRTHelper->straw_layer(id);
+					int m_straw = m_pTRTHelper->straw(id);
+					const bool isArgonStraw = Straw_Gastype( m_sumSvc->getStatusHT(id) ) == GasType::Ar;
+					// assume always Xe if m_ArgonXenonSplitter is not enabled, otherwise check the straw status (good is Xe, non-good is Ar)
+					// ibe = 0 (Barrel), ibe = 1 (Endcap)
+					int ibe = abs(m_barrel_ec) - 1;
+					// iside = 0 (Side A), iside = 1 (Side C)
+					int iside = m_barrel_ec > 0 ? 0 : 1;
+
+					if (ibe == 0) {
+						if (isArgonStraw) {
+							m_hefficiencyBarrel_locR_Ar->Fill(locR, 0.0);
+						} else {
+							m_hefficiencyBarrel_locR->Fill(locR, 0.0);
+						}
+					} else if (ibe == 1) {
+						if (isArgonStraw) {
+							m_hefficiencyEndCap_locR_Ar[iside]->Fill(locR, 0.0);
+						} else {
+							m_hefficiencyEndCap_locR[iside]->Fill(locR, 0.0);
+						}
+					}
+
+					if (fabs(locR) >= 1.3) continue;
+
+					int m_strawNumber = 0;
+					int m_chip = 0;
+
+					if (ibe == 0) {
+						m_strawNumber = strawNumber(m_straw, m_straw_layer, m_layer_or_wheel);
+
+						if (m_strawNumber >= 0 && m_strawNumber < s_Straw_max[ibe]) {
+							m_chip = mat_chip_B[m_phi_module][m_strawNumber];
+						}
+					} else if (ibe == 1) {
+						m_strawNumber = strawNumberEndCap(m_straw, m_straw_layer, m_layer_or_wheel, m_phi_module, m_barrel_ec);
+
+						if (m_strawNumber >= 0 && m_strawNumber < s_Straw_max[ibe]) {
+							m_chip = mat_chip_E[m_phi_module][m_strawNumber];
+						}
+					}
+
+					m_hefficiencyMap[ibe]->Fill(m_strawNumber, 0.0);
+
+					if (m_doExpert) {
+						if (iside == 0) {
+							m_hefficiencyS[ibe][m_phi_module]->Fill(m_strawNumber, 0.0);
+							m_hefficiencyC[ibe][m_phi_module]->Fill(m_chip, 0.0);
+						} else if (iside == 1) {
+							m_hefficiencyS[ibe][m_phi_module + 32]->Fill(m_strawNumber, 0.0);
+							m_hefficiencyC[ibe][m_phi_module + 32]->Fill(m_chip, 0.0);
+						}
+					}
+
+					m_hefficiency_eta->Fill(m_track_eta, 0.0);
+					m_hefficiency_phi->Fill(m_track_phi, 0.0);
+					m_hefficiency_pt->Fill(m_track_pt * invGeV, 0.0);
+					m_hefficiency_z0->Fill(m_track_z0, 0.0);
+				}
+
+				delete holes;
+			}
+		}
 	}
-	// Calculate Residuals for hit
-	if (DoShift && DoStraws) {
-	   
-	  const double pull_b = (loc-locR)/sqrt((loc_err*loc_err*loc_err*loc_err)-(locR_err*locR_err*locR_err*locR_err) );	  
-	  const double thist0 = m_trtcaldbSvc->getT0(surfaceID);
-	  const double trkdrifttime = rtr->drifttime(fabs(locR));
-	  const double timeresidual = RawDriftCircle->rawDriftTime() - thist0 - trkdrifttime;
-	  if (ibe==0) {
-	    if(!isTubeHit){
-	      m_Pull_Biased_Barrel->Fill(pull_b);
-	    }
-	    if (isArgonStraw) {
-	      m_hResidual_B_Ar->Fill(loc-locR); // Fill residuals for Argon Straws
-	      if(cnst_is_pT_over_20GeV){m_hResidual_B_Ar_20GeV->Fill(loc-locR);  }
-	      m_hTimeResidual_B_Ar->Fill(timeresidual); // Fill time residuals for Argon Straws
-	    } else {
-	      m_hResidual_B->Fill(loc-locR); // Fill residuals 
-	      m_hTimeResidual_B->Fill(timeresidual); // Fill time residuals
-	      if(cnst_is_pT_over_20GeV){m_hResidual_B_20GeV->Fill(loc-locR);  }
-	    }
-	  } else if (ibe==1) {
-	    if(!isTubeHit){
-	      m_Pull_Biased_EndCap->Fill(pull_b);
-	      //fill pull biased
-	    }
-	    if (isArgonStraw) {
-	      m_hResidual_E_Ar[iside]->Fill(loc - locR); // Fill residuals
-	      m_hTimeResidual_E_Ar[iside]->Fill(timeresidual); // Fill time residuals for Argon Straws
-	      if(cnst_is_pT_over_20GeV){m_hResidual_E_Ar_20GeV[iside]->Fill(loc-locR);  }
-	    } else {
-	      m_hResidual_E[iside]->Fill(loc - locR); // Fill residuals
-	      m_hTimeResidual_E[iside]->Fill(timeresidual); // Fill time residuals for Argon Straws
-	      if(cnst_is_pT_over_20GeV){m_hResidual_E_20GeV[iside]->Fill(loc-locR);  }
-	    }
-	  }// ibe==1
-	}//DoShift && DoStraws
-	if (DoShift) {
-	  if (ibe==0) {
-	    if (isArgonStraw) { 
-	      m_hWireToTrkPosition_B_Ar->Fill(locR);
-	    } else {
-	      m_hWireToTrkPosition_B->Fill(locR);
-	    }
-	  } else if (ibe==1) {
-	    	    if (isArgonStraw) { 
-	      m_hWireToTrkPosition_E_Ar[iside]->Fill(locR); 
-	    } else {
-	      m_hWireToTrkPosition_E[iside]->Fill(locR);
-	    }
-	  }
+
+	double n_BorE[2][2];
+	double total_BorE[2][2];
+
+	for (int ibe = 0; ibe < 2; ibe++) {
+		for (int iside = 0; iside < 2; iside++) {
+			m_hefficiency[ibe][iside]->Reset();
+			m_hefficiencyIntegral[ibe][iside]->Reset();
+
+			for (int i = 0; i < 32; i++) {
+				for (int ibin = 0; ibin <= s_Straw_max[ibe]; ibin++) {
+					if (m_doExpert) {
+						if (m_hefficiencyS[ibe][i + (32 * iside)]->GetBinEntries(ibin) > m_min_tracks_straw)
+							m_hefficiency[ibe][iside]->Fill(m_hefficiencyS[ibe][i + (32 * iside)]->GetBinContent(ibin));
+					}
+				}
+			}
+
+			n_BorE[ibe][iside] = m_hefficiency[ibe][iside]->GetEntries();
+			total_BorE[ibe][iside] = 0.0;
+
+			for (UInt_t ibin = 0; ibin <= m_hefficiency[ibe][iside]->GetXaxis()->GetNbins(); ibin++) {
+				total_BorE[ibe][iside] += m_hefficiency[ibe][iside]->GetBinContent(ibin);
+				m_hefficiencyIntegral[ibe][iside]->SetBinContent(ibin, n_BorE[ibe][iside] != 0.0 ? total_BorE[ibe][iside] / n_BorE[ibe][iside] : 0.0);
+			}
+		}
 	}
 
-	const float LE = (RawDriftCircle->driftTimeBin())*3.125;
-	const float EP = timeCor;
-	if (DoShift && DoStraws) {
-	  if (ibe==0) {
-	    if (isArgonStraw) {
-	      if (m_isCosmics) m_hrtRelation_B_Ar->Fill(LE - EP - t0, fabs(locR)); // Fill R(t) Relation  for Argon Straws.
-	      else m_hrtRelation_B_Ar->Fill(LE - t0, fabs(locR)); // Fill R(t) Relation  for Argon Straws.
-	    } else {
-	      if (m_isCosmics) m_hrtRelation_B->Fill(LE - EP - t0, fabs(locR)); // Fill R(t) Relation.
-	      else m_hrtRelation_B->Fill(LE - t0, fabs(locR)); // Fill R(t) Relation.
-	    }
-	  } else if (ibe==1) {
-	    if (isArgonStraw) {
-	      if (m_isCosmics) m_hrtRelation_E_Ar[iside]->Fill(LE - EP - t0, fabs(locR)); // Fill R(t) Relation  for Argon Straws.
-	      else m_hrtRelation_E_Ar[iside]->Fill(LE - t0, fabs(locR)); // Fill R(t) Relation  for Argon Straws.
-	    } else {
-	      if (m_isCosmics) m_hrtRelation_E[iside]->Fill(LE - EP - t0, fabs(locR)); // Fill R(t) Relation.
-	      else m_hrtRelation_E[iside]->Fill(LE - t0, fabs(locR)); // Fill R(t) Relation.
-	    }
-	  }//ibe==1
+	return StatusCode::SUCCESS;
+}
+
+
+int maxtimestamp = 0.;
+//----------------------------------------------------------------------------------//
+StatusCode TRT_Monitoring_Tool::fillTRTHighThreshold(const TrackCollection& trackCollection,
+                                                     const xAOD::EventInfo& eventInfo) {
+//----------------------------------------------------------------------------------//
+	ATH_MSG_VERBOSE("");
+	DataVector<Trk::Track>::const_iterator p_trk;
+	const Trk::Perigee *perigee = NULL;
+	const DataVector<const Trk::TrackParameters> *AllTrkPar(0);
+	DataVector<const Trk::TrackParameters>::const_iterator p_trkpariter;
+	int lumiBlockNumber;
+	int timeStamp;
+	lumiBlockNumber = eventInfo.lumiBlock();
+	timeStamp = eventInfo.timeStamp();
+
+	if (timeStamp > maxtimestamp) {
+		maxtimestamp = timeStamp;
 	}
-	const int m_driftTimeBin = RawDriftCircle->driftTimeBin();
-	if ( (m_driftTimeBin<24) && !(RawDriftCircle->lastBinHigh()) && !(RawDriftCircle->firstBinHigh()) ){
-	    if (DoStraws) {
-	      if (ibe==0) m_hHitWonTMap_B->Fill(m_strawNumber[ibe]);
-	      else if (ibe==1) m_hHitWonTMap_E[iside]->Fill(m_strawNumber[ibe]);
-	    }
-	  }
-	  
-	  if((m_driftTimeBin>2) && (m_driftTimeBin<17)){
-	    if (DoExpert && DoStraws) m_hHitWonTMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe],1.0);//LE in time window on track: Straws
-	    if (DoExpert && DoChips) m_hHitWonTMapC[ibe][iphi_module]->Fill(m_chip[ibe]-1,1.0);//LE in time window on track: Chips
-	  }
-	const int m_trailingEdge = RawDriftCircle->trailingEdge();
-	if ((m_trailingEdge<23) && !(RawDriftCircle->lastBinHigh()) && !(RawDriftCircle->firstBinHigh())) {
-	  if (DoExpert && DoStraws) m_hHitTronTMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe], ((m_trailingEdge+1)*3.125));// Mean TE on track: Straws
-	  if (DoExpert && DoChips) m_hHitTronTMapC[ibe][iphi_module]->Fill(m_chip[ibe]-1,((m_trailingEdge+1)*3.125));// Mean TE on track: Chips
-	  if (DoExpert && DoStraws) m_hHitTronTwEPCMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe], (((m_trailingEdge+1)*3.125) - timeCor));// Mean TE on Track (with Event Phase correction): Straws
-	  if (DoExpert && DoChips) m_hHitTronTwEPCMapC[ibe][iphi_module]->Fill((m_chip[ibe]-1), (((m_trailingEdge+1)*3.125) - timeCor));// Mean TE on Track (with Event Phase correction): Chips
-	  if (DoShift && DoStraws) {
-	    if (RawDriftCircle->driftTimeValid()) {
-	      if (ibe==0) {
-		if (isArgonStraw){
-		  m_hTronTDist_B_Ar->Fill(((m_trailingEdge+1)*3.125));
-		  m_hAvgTroTDetPhi_B_Ar->Fill(m_phi2D[ibe], ((m_trailingEdge+1)*3.125)); 
+
+	int runNumber;
+	runNumber = eventInfo.runNumber();
+	// get Online Luminosity
+	double intLum = (m_lumiTool->lbDuration() * m_lumiTool->lbAverageLuminosity());
+	double timeStampAverage = (maxtimestamp - 0.5 * m_lumiTool->lbDuration());
+	m_IntLum->SetBinContent(1, intLum);
+	m_LBvsLum->SetBinContent(lumiBlockNumber, intLum);
+	m_LBvsTime->SetBinContent(lumiBlockNumber, timeStampAverage);
+
+	for (p_trk = trackCollection.begin(); p_trk != trackCollection.end(); ++p_trk) {
+		AllTrkPar = (*p_trk)->trackParameters();
+
+		for (p_trkpariter = AllTrkPar->begin(); p_trkpariter != AllTrkPar->end(); ++p_trkpariter) {
+			if ((perigee = dynamic_cast<const Trk::Perigee *>(*p_trkpariter))) break;
+		}
+
+		//if you went through all of the track parameters and found no perigee mearsurement
+		//then something is wrong with the track and so don't use the track.
+		//i.e. continue to the next track.
+		if (!perigee) continue;
+
+		float track_eta  = perigee->eta();
+		float track_p    = (perigee->parameters()[Trk::qOverP] != 0.) ? fabs(1. / (perigee->parameters()[Trk::qOverP])) : 10e7;
+		const DataVector<const Trk::TrackStateOnSurface> *trackStates = (**p_trk).trackStateOnSurfaces();
+
+		if (trackStates == 0) continue;
+
+		DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItBegin     = trackStates->begin();
+		DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItEnd       = trackStates->end();
+		const std::auto_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->createSummary(*(*p_trk)));
+		int trt_hits = summary->get(Trk::numberOfTRTHits);
+		int sct_hits = summary->get(Trk::numberOfSCTHits);
+		int pixel_hits = summary->get(Trk::numberOfPixelHits);
+		bool passCuts = true;
+
+		if (fabs(track_eta) > 2.5) continue;
+		if (fabs(track_p) < 5000.) continue;
+		if (pixel_hits < 1.) continue;
+		if (sct_hits < 6.) continue;
+		if (trt_hits < 6.) continue;
+
+		if (!passCuts) continue;
+
+		//Now we have hit informations
+		const DataVector<const Trk::TrackStateOnSurface> *track_states = (*p_trk)->trackStateOnSurfaces();
+
+		if (track_states) {
+			ATH_MSG_DEBUG("This track has " << track_states->size() << " track states on surface.");
+		} else {
+			ATH_MSG_DEBUG("This track has null track states on surface.");
+			continue;
+		}
+
+		int barrel_ec_side = 0;
+		int layer_or_wheel = 0;
+		int phi_module     = 0;
+		int straw_layer    = 0;
+
+		for (; TSOSItBegin != TSOSItEnd; ++TSOSItBegin) {
+			if ((*TSOSItBegin) == 0) continue;
+			if ( !((*TSOSItBegin)->type(Trk::TrackStateOnSurface::Measurement)) ) continue;
+
+			const InDet::TRT_DriftCircleOnTrack *trtCircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack *>((*TSOSItBegin)->measurementOnTrack());
+			const Trk::TrackParameters *aTrackParam = dynamic_cast<const Trk::TrackParameters *>((*TSOSItBegin)->trackParameters());
+
+			if (!trtCircle) continue;
+			if (!aTrackParam) continue;
+
+			Identifier DCoTId = trtCircle->identify();
+			barrel_ec_side  = m_pTRTHelper->barrel_ec(DCoTId);
+			layer_or_wheel  = m_pTRTHelper->layer_or_wheel(DCoTId);
+			phi_module      = m_pTRTHelper->phi_module(DCoTId);
+			straw_layer     = m_pTRTHelper->straw_layer(DCoTId);
+			//Ba_Ec:  0 is barrel 1 is Endcap
+			//Side :  0 is side_A 1 is side_C
+			int Ba_Ec = abs(barrel_ec_side) - 1;
+			int Side  = barrel_ec_side > 0 ? 0 : 1;
+			double xPos = trtCircle->globalPosition().x(); // global x coordinate
+			double yPos = trtCircle->globalPosition().y(); // global y coordinate
+			double zPos = trtCircle->globalPosition().z(); // global z coordinate
+			double RPos = sqrt(xPos * xPos + yPos * yPos);
+			Identifier surfaceID;
+			surfaceID = trtCircle->identify();
+			// assume always Xe if m_ArgonXenonSplitter is not enabled, otherwise check the straw status (good is Xe, non-good is Ar)
+			const InDet::TRT_DriftCircle *RawDriftCircle = dynamic_cast<const InDet::TRT_DriftCircle *>(trtCircle->prepRawData());
+
+			if (!RawDriftCircle) { //coverity 25097
+				//This shouldn't happen in normal conditions  because trtCircle is a TRT_DriftCircleOnTrack object
+				ATH_MSG_WARNING("RawDriftCircle object returned null");
+				continue;
+			}
+
+			int middleHTbit       = RawDriftCircle->getWord() & 0x00020000;
+			//0x00020000 = 0000 0000 0000 0000 0000 0010 0000 0000 0000 0000
+			bool is_middleHTbit_high   = (middleHTbit != 0);
+			//bool isHighLevel= RawDriftCircle->highLevel();
+			bool isHighLevel = is_middleHTbit_high; //Hardcoded HT Middle Bit
+			bool shortStraw = false;
+			int InputBar = 0;
+
+			if (fabs(track_eta) < 2. && Ba_Ec == 0.) {
+				if ((layer_or_wheel == 0) && (phi_module < 4 || (phi_module > 7 && phi_module < 12) || (phi_module > 15 && phi_module < 20) || (phi_module > 23 && phi_module < 28))) InputBar = 1;
+				else if ((runNumber >= 296939) && (layer_or_wheel == 0) && (phi_module > 27)) InputBar = 1;
+				else if (layer_or_wheel == 0)
+					InputBar = 0;
+				else if ((layer_or_wheel == 1) && ((phi_module > 1 && phi_module < 6) || (phi_module > 9 && phi_module < 14) || (phi_module > 17 && phi_module < 22) || (phi_module > 25 && phi_module < 30)))
+					InputBar = 1;
+				else if (layer_or_wheel == 1)
+					InputBar = 0;
+				else if (layer_or_wheel == 2 && phi_module % 2 != 0)
+					InputBar = 1;
+				else if (layer_or_wheel == 2)
+					InputBar = 0;
+				else {
+					ATH_MSG_WARNING("Should not pass here");
+					continue;
+				}
+
+				if ((layer_or_wheel == 0) && straw_layer < 9.)
+					shortStraw = true;
+			}
+
+			//Fill Barrel Plots
+			if ((!shortStraw) && (Ba_Ec == 0)) {
+				m_trackz_All[layer_or_wheel][InputBar]->Fill(zPos);
+				if (isHighLevel)
+					m_trackz_HT[layer_or_wheel][InputBar]->Fill(zPos);
+			}
+
+			if (shortStraw) {
+				if (zPos > 0.) {
+					m_trackz_All[3][InputBar]->Fill(zPos);
+					if (isHighLevel)
+						m_trackz_HT[3][InputBar]->Fill(zPos);
+				} else {
+					m_trackz_All[4][InputBar]->Fill(zPos);
+
+					if (isHighLevel)m_trackz_HT[4][InputBar]->Fill(zPos);
+				}
+			}
+
+			//End of Barrel Plots, begin EC plots
+			int WType = -1;
+
+			if ((Ba_Ec == 1) && (layer_or_wheel < 6) &&
+			    ((straw_layer > 3 && straw_layer < 8) ||
+			     (straw_layer > 11))) {
+				WType = 0;
+			}
+			if ((Ba_Ec == 1) && (layer_or_wheel >= 6) &&
+			    (straw_layer > 3)) {
+				WType = 3;
+			}
+			if ((Ba_Ec == 1) && (layer_or_wheel < 6) &&
+			    ((straw_layer > -1 && straw_layer < 4) ||
+			     (straw_layer > 7 && straw_layer < 12))) {
+				WType = 2;
+			}
+			if ((Ba_Ec == 1) && (layer_or_wheel >= 6) &&
+			    ((straw_layer > -1 && straw_layer < 4))) {
+				WType = 1;
+			}
+
+			if (WType < 0 && Ba_Ec == 1) { //Coverity CID 25096
+				ATH_MSG_WARNING("The variable  \"WType\" is less than zero!.");
+				continue;
+			}
+
+			if (Ba_Ec == 1) {
+				m_trackr_All[WType][Side]->Fill(RPos);
+				if (isHighLevel)m_trackr_HT[WType][Side]->Fill(RPos);
+			}
 		}
-		else{
-		  m_hTronTDist_B->Fill(((m_trailingEdge+1)*3.125));
-		  m_hAvgTroTDetPhi_B->Fill(m_phi2D[ibe], ((m_trailingEdge+1)*3.125));
+	}
+
+	return StatusCode::SUCCESS;
+}
+
+
+//-------------------------------------------------------------------------------------------------//
+StatusCode TRT_Monitoring_Tool::checkTRTReadoutIntegrity(const xAOD::EventInfo& eventInfo) {
+//-------------------------------------------------------------------------------------------------//
+	StatusCode sc = StatusCode::SUCCESS;
+
+	const unsigned int m_lumiBlock = eventInfo.lumiBlock();
+	ATH_MSG_VERBOSE("This is lumiblock : " << m_lumiBlock);
+	m_good_bcid = eventInfo.bcid();
+
+	if ((int)m_lumiBlock != m_lastLumiBlock) {
+		m_lastLumiBlock = m_lumiBlock;
+	}
+
+	//Get BSConversion Errors from BSConditionsServices:
+	std::set<std::pair<uint32_t, uint32_t> > *L1IDErrorSet      = m_BSSvc->getIdErrorSet(TRTByteStreamErrors::L1IDError);
+	std::set<std::pair<uint32_t, uint32_t> > *BCIDErrorSet      = m_BSSvc->getIdErrorSet(TRTByteStreamErrors::BCIDError);
+	std::set<uint32_t>                       *MissingErrorSet   = m_BSSvc->getErrorSet(TRTByteStreamErrors::MISSINGError);
+	std::set<uint32_t>                       *SidErrorSet       = m_BSSvc->getErrorSet(TRTByteStreamErrors::SIDError);
+	std::set<std::pair<uint32_t, uint32_t> > *RobStatusErrorSet = m_BSSvc->getRodRobErrorSet(TRTByteStreamErrors::RobStatusError);
+	const unsigned int rod_id_base[2][2] = { { 0x310000, 0x320000 }, { 0x330000, 0x340000 } };
+	const unsigned int nChipsTotal[2][2] = { {     3328,     3328 }, {     7680,     7680 } };
+	const unsigned int nRobsTotal[2][2]  = { {       32,       32 }, {       64,       64 } };
+	float m_nBSErrors[2][2]  = { { 0, 0 }, { 0, 0 } };
+	float m_nRobErrors[2][2] = { { 0, 0 }, { 0, 0 } };
+	const std::set<std::pair<uint32_t, uint32_t> > *errorset1[2] = { BCIDErrorSet, L1IDErrorSet };
+
+	for (int iset = 0; iset < 2; ++iset) {
+		for (auto setIt = errorset1[iset]->begin(); setIt != errorset1[iset]->end(); ++setIt) {
+			for (int ibe = 0; ibe < 2; ++ibe) {
+				for (int iside = 0; iside < 2; ++iside) {
+					if (((setIt->first >> 8) & 0xFF0000) == rod_id_base[ibe][iside]) {
+						m_nBSErrors[ibe][iside] += 1. / nChipsTotal[ibe][iside];
+					}
+				}
+			}
 		}
-	      } else if (ibe==1) {
-		if (isArgonStraw){
-		  m_hTronTDist_E_Ar[iside]->Fill(((m_trailingEdge+1)*3.125));
-		  m_hAvgTroTDetPhi_E_Ar[iside]->Fill(m_phi2D[ibe], ((m_trailingEdge+1)*3.125)); 
+	}
+
+	const std::set<uint32_t> *errorset2[2] = { MissingErrorSet, SidErrorSet };
+
+	for (int iset = 0; iset < 2; ++iset) {
+		for (auto setIt = errorset2[iset]->begin(); setIt != errorset2[iset]->end(); ++setIt) {
+			for (int ibe = 0; ibe < 2; ++ibe) {
+				for (int iside = 0; iside < 2; ++iside) {
+					if (((*setIt >> 8) & 0xFF0000) == rod_id_base[ibe][iside]) {
+						m_nBSErrors[ibe][iside] += 1. / nChipsTotal[ibe][iside];
+					}
+				}
+			}
 		}
-		else{
-		  m_hTronTDist_E[iside]->Fill(((m_trailingEdge+1)*3.125));
-		  m_hAvgTroTDetPhi_E[iside]->Fill(m_phi2D[ibe], ((m_trailingEdge+1)*3.125));
+	}
+
+	for (int ibe = 0; ibe < 2; ++ibe) {
+		for (int iside = 0; iside < 2; ++iside) {
+			m_hChipBSErrorsVsLB[ibe][iside]->Fill(m_lumiBlock, m_nBSErrors[ibe][iside]);
+			m_hChipBSErrorsVsLB[ibe][iside]->SetEntries(m_lumiBlock); // we need this so the LastBinThreshold algorithm can find the last bin
 		}
-	      }
-	    }
-	  }
 	}
 
-	const bool m_firstBinHigh = RawDriftCircle->firstBinHigh();
-	const bool m_lastBinHigh = RawDriftCircle->lastBinHigh();
-	if (m_firstBinHigh || m_lastBinHigh || m_driftTimeBin>0 || m_trailingEdge<23) {
-	  if (DoExpert && DoStraws) m_hHitAonTMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe]);// Any LL bit on track: Straws
-	  if (DoExpert && DoChips) m_hHitAonTMapC[ibe][iphi_module]->Fill(m_chip[ibe]-1);// Any LL bit on track: Chips
-	  m_nTRTHitsW[ibe][iside]++;
-	  if (isArgonStraw){
-	    m_nTRTHitsW_Ar[ibe][iside]++;}
-	  else{
-	    m_nTRTHitsW_Xe[ibe][iside]++;
-	  }
-	  //m_nTRTHitsW_permodule[iside][m_layer_or_wheel]++;
-	  m_nTRTHitsW_perwheel[iside][m_layer_or_wheel]++;
-  //if (RawDriftCircle->highLevel()) {
-	  if (is_middleHTbit_high) {
-	    m_nTRTHLHitsW[ibe][iside]++;
-	    if (isArgonStraw){
-	      m_nTRTHLHitsW_Ar[ibe][iside]++;
-	    }else{
-	      m_nTRTHLHitsW_Xe[ibe][iside]++;
-	    }
- //m_nTRTHLHitsW_permodule[iside][m_layer_or_wheel]++;
-	  }
+	for (auto setIt = RobStatusErrorSet->begin(); setIt != RobStatusErrorSet->end(); ++setIt) {
+		for (int ibe = 0; ibe < 2; ++ibe) {
+			for (int iside = 0; iside < 2; ++iside) {
+				if (setIt->first % rod_id_base[ibe][iside] < 0xffff) {
+					m_nRobErrors[ibe][iside] += 1. / nRobsTotal[ibe][iside];
+				}
+			}
+		}
 	}
 
-	if (is_anybininVgate_high) {
-	  if (DoExpert && DoStraws) m_hHitAWonTMapS[ibe][iphi_module]->Fill(m_strawNumber[ibe]);//Any LL bit in time window on track: Straws
-	  if (DoExpert && DoChips) m_hHitAWonTMapC[ibe][iphi_module]->Fill(m_chip[ibe]-1);//Any LL bit in time window on track: Chips
+	for (int ibe = 0; ibe < 2; ++ibe) {
+		for (int iside = 0; iside < 2; ++iside) {
+			m_hRobBSErrorsVsLB[ibe][iside]->Fill(m_lumiBlock, m_nRobErrors[ibe][iside]);
+			m_hRobBSErrorsVsLB[ibe][iside]->SetEntries(m_lumiBlock); // we need this so the LastBinThreshold algorithm can find the last bin
+		}
 	}
 
-      }// if raw drift circle
-      //}//  if ((m_pTRTHelper->barrel_ec(DCoTId)==sectorflag[ibe][iside]))
-      //} // else if ((*TSOSItBegin)->type(Trk::TrackStateOnSurface::Measurement))
-    } //for (;TSOSItBegin!=TSOSItEnd; ++TSOSItBegin)
-    //ToDo: work on the part below
-    for(int ibe=0 ;ibe <2 ;ibe++){
-
-      for (int i = 0; i < 64; i++) if (trackfound[ibe][i]) ntrackstack[ibe][i]++;
-      if (DoShift) {
-        if (ibe==0) {
-          if (hitontrack[ibe]>=m_minTRThits) m_hNumHoTDetPhi_B->Fill(m_phi2D[ibe], hitontrack[ibe]);
-        }
-        if (ibe==1) {
-          if (hitontrack_E_side[0]>=m_minTRThits) m_hNumHoTDetPhi_E[0]->Fill(m_phi2D[ibe],hitontrack_E_side[0]);
-          if (hitontrack_E_side[1]>=m_minTRThits) m_hNumHoTDetPhi_E[1]->Fill(m_phi2D[ibe],hitontrack_E_side[1]);
-        }
-      }
-      if (m_phi2D[ibe]<0) continue;
-
-      if (DoShift) {
-        if (ibe==0) {
-          if (m_nTRTHitsW[ibe][0]+m_nTRTHitsW[ibe][1]>0) m_hNumTrksDetPhi_B->Fill(m_phi2D[ibe]);
-        } else if (ibe==1) {
-          if (m_nTRTHitsW[ibe][0]>0) m_hNumTrksDetPhi_E[0]->Fill(m_phi2D[ibe]);
-          if (m_nTRTHitsW[ibe][1]>0) m_hNumTrksDetPhi_E[1]->Fill(m_phi2D[ibe]);
-        }
-      }
-
-      if (DoShift) {
-        if (innerstack[ibe] >= 0 && innerstack[ibe] < s_iStack_max[ibe]) {
-          if (ibe==0) {
-            m_LonTrack_B[innerstack[ibe]] += (m_nTRTHitsW[ibe][0]+m_nTRTHitsW[ibe][1]);
-            if ((m_nTRTHitsW[ibe][0]+m_nTRTHitsW[ibe][1]) > 0) {
-              m_HTfraconTrack_B[innerstack[ibe]] += (float)(m_nTRTHLHitsW[ibe][0]+m_nTRTHLHitsW[ibe][1]) / (m_nTRTHitsW[ibe][0]+m_nTRTHitsW[ibe][1]);
-              m_nTrack_B[innerstack[ibe]]         = (m_nTrack_B[innerstack[ibe]])+1;
-            }
-          } else if (ibe==1) {
-            m_LonTrack_E[innerstack[ibe]] += (m_nTRTHitsW[ibe][0]+m_nTRTHitsW[ibe][1]);
-            if ((m_nTRTHitsW[ibe][0]+m_nTRTHitsW[ibe][1]) > 0) {
-              m_HTfraconTrack_E[innerstack[ibe]] += (float)(m_nTRTHLHitsW[ibe][0]+m_nTRTHLHitsW[ibe][1]) / (m_nTRTHitsW[ibe][0]+m_nTRTHitsW[ibe][1]);
-              m_nTrack_E[innerstack[ibe]]         = (m_nTrack_E[innerstack[ibe]])+1;
-            }
-          }
-        }// if (innerstack >= 0 && innerstack < s_iStack_max[ibe])
-      }
-
-      if (DoShift) {
-        if (ibe==0) {
-          if (isBarrelOnly) {
-            if (m_nTRTHitsW[ibe][0]>0) {
-              if (m_nTRTHitsW[ibe][1]>0) m_hNumSwLLWoT_B->Fill(m_nTRTHitsW[ibe][0]+m_nTRTHitsW[ibe][1]);
-              else m_hNumSwLLWoT_B->Fill(m_nTRTHitsW[ibe][0]);
-            } else if (m_nTRTHitsW[ibe][1]>0) {
-              m_hNumSwLLWoT_B->Fill(m_nTRTHitsW[ibe][1]);
-            }
-          }
-          if (m_nTRTHLHitsW[ibe][0] > 0) {
-            if (m_nTRTHLHitsW[ibe][1] > 0) {
-              m_hHLhitOnTrack_B->Fill(m_nTRTHLHitsW[ibe][0] + m_nTRTHLHitsW[ibe][1]);
-            } else {
-              m_hHLhitOnTrack_B->Fill(m_nTRTHLHitsW[ibe][0]);
-            }
-          } else if (m_nTRTHLHitsW[ibe][1] > 0) {
-            m_hHLhitOnTrack_B->Fill(m_nTRTHLHitsW[ibe][1]);
-          }
-
-          if ((m_nTRTHitsW[ibe][0]+m_nTRTHitsW[ibe][1]) > 0) {
-            m_hHtoLRatioOnTrack_B->Fill((float)(m_nTRTHLHitsW[ibe][0]+m_nTRTHLHitsW[ibe][1]) / (m_nTRTHitsW[ibe][0] + m_nTRTHitsW[ibe][1]));
-          }
-	  if ((m_nTRTHitsW_Ar[ibe][0]+m_nTRTHitsW_Ar[ibe][1]) > 0) {
-	    m_hHtoLRatioOnTrack_B_Ar->Fill((float)(m_nTRTHLHitsW_Ar[ibe][0]+m_nTRTHLHitsW_Ar[ibe][1]) / (m_nTRTHitsW_Ar[ibe][0] + m_nTRTHitsW_Ar[ibe][1]));
-	  }
-	  if ((m_nTRTHitsW_Xe[ibe][0]+m_nTRTHitsW_Xe[ibe][1]) > 0) {
-	    m_hHtoLRatioOnTrack_B_Xe->Fill((float)(m_nTRTHLHitsW_Xe[ibe][0]+m_nTRTHLHitsW_Xe[ibe][1]) / (m_nTRTHitsW_Xe[ibe][0] + m_nTRTHitsW_Xe[ibe][1]));
-	  }
-        } else if (ibe==1) {
-          if (m_nTRTHitsW[ibe][0]>0) {
-            if (m_nTRTHitsW[ibe][1]>0) {
-              if (ECAhit && !ECChit && !Bhit) m_hNumSwLLWoT_E[0]->Fill(m_nTRTHitsW[ibe][0]);
-              if (ECChit && !ECAhit && !Bhit) m_hNumSwLLWoT_E[1]->Fill(m_nTRTHitsW[ibe][1]);
-            }//Number of Straws with LL hits on track
-            else if (m_nTRTHitsW[ibe][0]>0) {
-              if (ECAhit && !ECChit && !Bhit) m_hNumSwLLWoT_E[0]->Fill(m_nTRTHitsW[ibe][0]);
-            }//Number of Straws with LL hits on track
-          }
-          else if (m_nTRTHitsW[ibe][1]>0) {
-            if (ECChit && !ECAhit && !Bhit) m_hNumSwLLWoT_E[1]->Fill(m_nTRTHitsW[ibe][1]);
-          }//Number of straws with LL hits on track
-          for (int iside=0; iside<2; iside++) {
-            if (m_nTRTHLHitsW[ibe][iside]>0) {
-              m_hHLhitOnTrack_E[iside]->Fill(m_nTRTHLHitsW[ibe][iside]);
-            }
-            if ((m_nTRTHitsW[ibe][iside]) > 0) {
-              m_hHtoLRatioOnTrack_E[iside]->Fill((float)(m_nTRTHLHitsW[ibe][iside])/((m_nTRTHitsW[ibe][iside])));
-	      if ((m_nTRTHitsW_Ar[ibe][iside]) > 0) {
-		m_hHtoLRatioOnTrack_E_Ar[iside]->Fill((float)(m_nTRTHLHitsW_Ar[ibe][iside])/((m_nTRTHitsW_Ar[ibe][iside])));
-	      }
-	      if ((m_nTRTHitsW_Xe[ibe][iside]) > 0) {
-		m_hHtoLRatioOnTrack_E_Xe[iside]->Fill((float)(m_nTRTHLHitsW_Xe[ibe][iside])/((m_nTRTHitsW_Xe[ibe][iside])));
-	      }
-            }
-          }
-        }
-      }// DoShift
-
-      if (ibe==0) {
-        if ((m_nTRTHitsW[ibe][0]+m_nTRTHitsW[ibe][1]) > 0) nTrksperLB_B++;
-        if (theComTime) {
-          if (DoShift && (m_phi2D[ibe] > 0) && (std::fabs(timeCor) > 1e-8))
-            m_hEvtPhaseDetPhi_B->Fill(m_phi2D[ibe], timeCor);
-        } //the comtime
-      } else if (ibe==1) {
-        for (int iside=0; iside<2; iside++) {
-          if (m_nTRTHitsW[ibe][iside] > 0) nTrksperLB_E[iside]++;
-          if (theComTime) {
-            if (m_nTRTHits_side[ibe][iside]>5 && (std::fabs(timeCor)
-						  > 1e-8)) {
-              if (DoShift) m_hEvtPhaseDetPhi_E[iside]->Fill(m_phi2D[ibe], timeCor);
-            }
-          }
-        }
-      } // else if (ibe==1)
-    }//ibe 
-  }//for (p_trk=m_trkCollection->begin(); p_trk!=m_trkCollection->end(); ++p_trk)
-
-  if (theComTime) {
-    if (std::fabs(timeCor) > 1e-8) {
-      if (DoShift) m_hEvtPhase->Fill(timeCor);// Event Phase Correction factor
-      if (DoShift) {
-        std::vector<int> trigid; trigid.clear(); // Trigger ID
-        const DataHandle<EventInfo> evtInfo;
-
-        StatusCode sc = evtStore()->retrieve(evtInfo);
-        if (sc.isFailure() || !evtInfo) {
-          ATH_MSG_WARNING("No event info container found in TDS");
-        } else {
-          std::vector<unsigned int> level1TriggerInfo_t = evtInfo->trigger_info()->level1TriggerInfo();
-          for (unsigned int j = 16; j < 24 && j < level1TriggerInfo_t.size(); ++j) {
-            for (unsigned int i = 0; i < 32; ++i) {
-              if ((level1TriggerInfo_t[j] >> i) & 0x1) trigid.push_back(i + (j % 8) * 32); // Found the ID
-            } // Loop over bits in the last word
-          } // Loop from 16-24 bits
-
-          for (unsigned int j = 0; j < trigid.size(); ++j) {
-            m_hEvtPhaseVsTrig->Fill(timeCor, trigid[j]);// Event Phase vs. Trigger Item
-          }
-        } // Got the container out of SG
-      } // if DoShift
-    }
-  } //the comtime
-
-
-  for (int ibe=0; ibe<2; ibe++) {
-    if (m_environment == AthenaMonManager::online && nEvents>0) {
-      //Loop over stack histograms and normalize to number of events processed.
-      if (DoChips && DoExpert) {
-        for (int i=0; i<64; i++) {
-          divide_LWHist(m_hHitOnTrackVsAllC[ibe][i], m_hHitAonTMapC[ibe][i], m_hHitAMapC[ibe][i]);
-
-          for (int j=0; j<s_iChip_max[ibe]; j++) {
-            if (m_hChipsEff[ibe][i]->GetBinEntries(j+1) > 0) {
-              m_hHitAonTMapC[ibe][i]->SetBinContent(j+1, m_hHitAonTMapC[ibe][i]->GetBinContent(j+1)/m_hChipsEff[ibe][i]->GetBinEntries(j+1));
-              m_hHitWonTMapC[ibe][i]->SetBinContent(j+1, m_hHitWonTMapC[ibe][i]->GetBinContent(j+1)/m_hChipsEff[ibe][i]->GetBinEntries(j+1));
-              m_hHitAWonTMapC[ibe][i]->SetBinContent(j+1, m_hHitAWonTMapC[ibe][i]->GetBinContent(j+1)/m_hChipsEff[ibe][i]->GetBinEntries(j+1));
-              m_hHitHonTMapC[ibe][i]->SetBinContent(j+1, m_hHitHonTMapC[ibe][i]->GetBinContent(j+1)/m_hChipsEff[ibe][i]->GetBinEntries(j+1));
-              m_hHitHWonTMapC[ibe][i]->SetBinContent(j+1, m_hHitHWonTMapC[ibe][i]->GetBinContent(j+1)/m_hChipsEff[ibe][i]->GetBinEntries(j+1));
-            } else {
-              m_hHitAonTMapC[ibe][i]->SetBinContent(j+1, 0);
-              m_hHitHonTMapC[ibe][i]->SetBinContent(j+1,0);
-              m_hHitWonTMapC[ibe][i]->SetBinContent(j+1, 0);
-              m_hHitAWonTMapC[ibe][i]->SetBinContent(j+1, 0);
-              m_hHitHWonTMapC[ibe][i]->SetBinContent(j+1,0);
-            }
-          }// for (int j=0; j<s_iChip_max[ibe]; j++)
-          divide_LWHist(m_hHtoLMapC[ibe][i],    m_hHitHMapC[ibe][i],   m_hHitAMapC[ibe][i]);
-          divide_LWHist(m_hHtoLonTMapC[ibe][i], m_hHitHonTMapC[ibe][i], m_hHitAonTMapC[ibe][i]);
-          divide_LWHist(m_hHtoLWonTMapC[ibe][i], m_hHitHWonTMapC[ibe][i], m_hHitAWonTMapC[ibe][i]);
-        }//Loop over A side and C side Stacks: for (int i=0; i<64; i++)
-      }//if DoChips && DoExpert
-      if (DoStraws) {
-        for (int i=0; i<64; i++) {
-          if (DoExpert) divide_LWHist(m_hHitOnTrackVsAllS[ibe][i], m_hHitAonTMapS[ibe][i], m_hHitAMapS[ibe][i]);
-          for (int j=0; j<s_Straw_max[ibe]; j++) {
-            if (i==0) {
-              if (ibe==0) {
-                if (m_nStrawHits_B[j]>0) {
-                  m_hHitWonTMap_B->SetBinContent(j+1, m_hHitWonTMap_B->GetBinContent(j+1) / (m_nStrawHits_B[j]));
-                }
-              } else if (ibe==1) {
-                if (m_nStrawHits_E[0][j]>0)
-                  m_hHitWonTMap_E[0]->SetBinContent(j+1,m_hHitWonTMap_E[0]->GetBinContent(j+1)/m_nStrawHits_E[0][j]);
-                if (m_nStrawHits_E[1][j]>0)
-                  m_hHitWonTMap_E[1]->SetBinContent(j+1,m_hHitWonTMap_E[1]->GetBinContent(j+1)/m_nStrawHits_E[1][j]);
-              }
-            }
-
-            if (DoExpert) {
-              if (m_hStrawsEff[ibe][i]->GetBinEntries(j+1)>0) {
-                m_hHitAWonTMapS[ibe][i]->SetBinContent(j+1, m_hHitAWonTMapS[ibe][i]->GetBinContent(j+1)/m_hStrawsEff[ibe][i]->GetBinEntries(j+1));
-                m_hHitAonTMapS[ibe][i]->SetBinContent(j+1, m_hHitAonTMapS[ibe][i]->GetBinContent(j+1)/m_hStrawsEff[ibe][i]->GetBinEntries(j+1));
-                m_hHitHonTMapS[ibe][i]->SetBinContent(j+1, m_hHitHonTMapS[ibe][i]->GetBinContent(j+1)/m_hStrawsEff[ibe][i]->GetBinEntries(j+1));
-                m_hHitHWonTMapS[ibe][i]->SetBinContent(j+1, m_hHitHWonTMapS[ibe][i]->GetBinContent(j+1)/m_hStrawsEff[ibe][i]->GetBinEntries(j+1));
-                m_hHitWonTMapS[ibe][i]->SetBinContent(j+1, m_hHitWonTMapS[ibe][i]->GetBinContent(j+1)/m_hStrawsEff[ibe][i]->GetBinEntries(j+1));
-              } else {
-                m_hHitAWonTMapS[ibe][i]->SetBinContent(j+1, 0);
-                m_hHitAonTMapS[ibe][i]->SetBinContent(j+1, 0);
-                m_hHitHonTMapS[ibe][i]->SetBinContent(j+1, 0);
-		m_hHitHWonTMapS[ibe][i]->SetBinContent(j+1, 0);
-                m_hHitWonTMapS[ibe][i]->SetBinContent(j+1, 0);
-              }
-            }//do expert
-          }//for (int j=0; j<s_Straw_max[ibe]; j++)
-          if (DoExpert) {
-            divide_LWHist(m_hHtoLMapS[ibe][i],   m_hHitHMapS[ibe][i],    m_hHitAMapS[ibe][i]);
-            divide_LWHist(m_hHtoLonTMapS[ibe][i], m_hHitHonTMapS[ibe][i], m_hHitAonTMapS[ibe][i]);
-            divide_LWHist(m_hHtoLWonTMapS[ibe][i], m_hHitHWonTMapS[ibe][i], m_hHitAWonTMapS[ibe][i]);
-          }//Do Expert
-        }//Loop over A side and B side Stacks: for (int i=0; i<64; i++)
-      }//if DoStraws && DoExpert
-      //Loops over degrees (probably will get eliminated).
-
-      if (DoShift) {
-        if (ibe==0) {  //barrel
-          m_hSummary->SetBinContent(2, m_nTotalTracks);
-          m_hSummary->SetBinContent(3, m_nTracksB[0]);
-          m_hSummary->SetBinContent(4, m_nTracksB[1]);
-          m_hSummary->SetBinContent(5, m_nTracksEC[0]);
-          m_hSummary->SetBinContent(6, m_nTracksEC[1]);
-          m_hSummary->SetBinContent(7, m_nTracksEC_B[0]);
-          m_hSummary->SetBinContent(8, m_nTracksEC_B[1]);
-
-          EventPhaseScale = m_hEvtPhase->GetEntries()*3.125;
-          if (EventPhaseScale > 0) {
-            scale_LWHist(m_hEvtPhase, 1./EventPhaseScale);
-          }
-          DriftTimeonTrkDistScale_B = m_hDriftTimeonTrkDist_B->GetEntries()*3.125;
-          if (DriftTimeonTrkDistScale_B > 0) {
-            scale_LWHist(m_hDriftTimeonTrkDist_B, 1./DriftTimeonTrkDistScale_B);
-          }
-          HLhitOnTrackScale_B = m_hHLhitOnTrack_B->GetEntries();
-          if (HLhitOnTrackScale_B > 0) {
-            scale_LWHist(m_hHLhitOnTrack_B,1./HLhitOnTrackScale_B);
-          }
-          HtoLRatioOnTrackScale_B = m_hHtoLRatioOnTrack_B->GetEntries()*0.02;
-          if (HtoLRatioOnTrackScale_B > 0) {
-            scale_LWHist(m_hHtoLRatioOnTrack_B, 1./HtoLRatioOnTrackScale_B);
-          }
-          NumSwLLWoTScale_B=m_hNumSwLLWoT_B->GetEntries();
-          if (NumSwLLWoTScale_B > 0) {
-            scale_LWHist(m_hNumSwLLWoT_B, 1./NumSwLLWoTScale_B);
-          }
-          WireToTrkPositionScale_B=m_hWireToTrkPosition_B->GetEntries()*0.1;
-          if (WireToTrkPositionScale_B > 0) {
-            scale_LWHist(m_hWireToTrkPosition_B,1./WireToTrkPositionScale_B);
-          }
-          TronTDistScale_B=m_hTronTDist_B->GetEntries()*3.125;
-          if (TronTDistScale_B > 0) {
-            scale_LWHist(m_hTronTDist_B,1./TronTDistScale_B);
-          }
-          ResidualScale_B = m_hResidual_B->GetEntries()*0.025;
-          if (ResidualScale_B > 0) {
-            scale_LWHist(m_hResidual_B,1./ResidualScale_B);
-          }
-          ResidualScale_B_20GeV = m_hResidual_B_20GeV->GetEntries()*0.025;
-          if (ResidualScale_B_20GeV > 0) {
-            scale_LWHist(m_hResidual_B_20GeV,1./ResidualScale_B_20GeV);
-          }
-          TimeResidualScale_B = m_hTimeResidual_B->GetEntries()*0.2;
-          if (TimeResidualScale_B > 0) {
-            scale_LWHist(m_hTimeResidual_B,1./TimeResidualScale_B);
-          }
-          if (m_ArgonXenonSplitter) {
-            DriftTimeonTrkDistScale_B_Ar = m_hDriftTimeonTrkDist_B_Ar->GetEntries()*3.125;
-            if (DriftTimeonTrkDistScale_B_Ar > 0) {
-              scale_LWHist(m_hDriftTimeonTrkDist_B_Ar, 1./DriftTimeonTrkDistScale_B_Ar);
-            }
-	    WireToTrkPositionScale_B_Ar=m_hWireToTrkPosition_B_Ar->GetEntries()*0.1; 
-	    if (WireToTrkPositionScale_B_Ar > 0) {
-	      scale_LWHist(m_hWireToTrkPosition_B_Ar,1./WireToTrkPositionScale_B_Ar);
-	    }
-            TronTDistScale_B_Ar=m_hTronTDist_B_Ar->GetEntries()*3.125;
-            if (TronTDistScale_B_Ar > 0) {
-              scale_LWHist(m_hTronTDist_B_Ar,1./TronTDistScale_B_Ar);
-            }
-            ResidualScale_B_Ar = m_hResidual_B_Ar->GetEntries()*0.025;
-            if (ResidualScale_B_Ar > 0) {
-              scale_LWHist(m_hResidual_B_Ar, 1. / ResidualScale_B_Ar);
-            }
-            ResidualScale_B_Ar_20GeV = m_hResidual_B_Ar_20GeV->GetEntries()*0.025;
-            if (ResidualScale_B_Ar_20GeV > 0) {
-              scale_LWHist(m_hResidual_B_Ar_20GeV, 1. / ResidualScale_B_Ar_20GeV);
-            }
-            TimeResidualScale_B_Ar = m_hTimeResidual_B_Ar->GetEntries()*0.2;
-            if (TimeResidualScale_B_Ar > 0) {
-              scale_LWHist(m_hTimeResidual_B_Ar,1./TimeResidualScale_B_Ar);
-            }
-          }
-        } else if (ibe==1) { //endcap
-          for (int iside=0; iside<2; iside++) {
-            DriftTimeonTrkDistScale_E[iside] = m_hDriftTimeonTrkDist_E[iside]->GetEntries()*3.125;
-            if (DriftTimeonTrkDistScale_E[iside] > 0) {
-              scale_LWHist(m_hDriftTimeonTrkDist_E[iside], 1./DriftTimeonTrkDistScale_E[iside]);
-            }
-            HLhitOnTrackScale_E[iside] = m_hHLhitOnTrack_E[iside]->GetEntries();
-            if (HLhitOnTrackScale_E[iside] > 0) {
-              scale_LWHist(m_hHLhitOnTrack_E[iside],1./HLhitOnTrackScale_E[iside]);
-            }
-            HtoLRatioOnTrackScale_E[iside] = m_hHtoLRatioOnTrack_E[iside]->GetEntries()*0.02;
-            if (HtoLRatioOnTrackScale_E[iside] > 0) {
-              scale_LWHist(m_hHtoLRatioOnTrack_E[iside], 1./HtoLRatioOnTrackScale_E[iside]);
-            }
-            NumSwLLWoTScale_E[iside]=m_hNumSwLLWoT_E[iside]->GetEntries();
-            if (NumSwLLWoTScale_E[iside] > 0) {
-              scale_LWHist(m_hNumSwLLWoT_E[iside], 1./NumSwLLWoTScale_E[iside]);
-            }
-            WireToTrkPositionScale_E[iside]=m_hWireToTrkPosition_E[iside]->GetEntries()*0.1;
-            if (WireToTrkPositionScale_E[iside] > 0) {
-              scale_LWHist(m_hWireToTrkPosition_E[iside],1./WireToTrkPositionScale_E[iside]);
-            }
-            TronTDistScale_E[iside]=m_hTronTDist_E[iside]->GetEntries()*3.125;
-            if (TronTDistScale_E[iside] > 0) {
-              scale_LWHist(m_hTronTDist_E[iside],1./TronTDistScale_E[iside]);
-            }
-            ResidualScale_E[iside] = m_hResidual_E[iside]->GetEntries()*0.025;
-            if (ResidualScale_E[iside] > 0) {
-              scale_LWHist(m_hResidual_E[iside],1./ResidualScale_E[iside]);
-            }
-            ResidualScale_E_20GeV[iside] = m_hResidual_E_20GeV[iside]->GetEntries()*0.025;
-            if (ResidualScale_E_20GeV[iside] > 0) {
-              scale_LWHist(m_hResidual_E_20GeV[iside],1./ResidualScale_E_20GeV[iside]);
-            }
-            TimeResidualScale_E[iside] = m_hTimeResidual_E[iside]->GetEntries()*0.2;
-            if (TimeResidualScale_E[iside] > 0) {
-              scale_LWHist(m_hTimeResidual_E[iside],1./TimeResidualScale_E[iside]);
-            }
-            if (m_ArgonXenonSplitter) {
-              DriftTimeonTrkDistScale_E_Ar[iside] = m_hDriftTimeonTrkDist_E_Ar[iside]->GetEntries()*3.125;
-              if (DriftTimeonTrkDistScale_E_Ar[iside] > 0) {
-                scale_LWHist(m_hDriftTimeonTrkDist_E_Ar[iside], 1./DriftTimeonTrkDistScale_E_Ar[iside]);
-              }
-	      WireToTrkPositionScale_E_Ar[iside]=m_hWireToTrkPosition_E_Ar[iside]->GetEntries()*0.1; 
-	      if (WireToTrkPositionScale_E_Ar[iside] > 0) {
-		scale_LWHist(m_hWireToTrkPosition_E_Ar[iside],1./WireToTrkPositionScale_E_Ar[iside]);
-	      }
-              TronTDistScale_E_Ar[iside]=m_hTronTDist_E_Ar[iside]->GetEntries()*3.125;
-              if (TronTDistScale_E_Ar[iside] > 0) {
-                scale_LWHist(m_hTronTDist_E_Ar[iside],1./TronTDistScale_E_Ar[iside]);
-              }
-              ResidualScale_E_Ar[iside] = m_hResidual_E_Ar[iside]->GetEntries()*0.025;
-              if (ResidualScale_E_Ar[iside] > 0) {
-                scale_LWHist(m_hResidual_E_Ar[iside], 1. / ResidualScale_E_Ar[iside]);
-              }
-              ResidualScale_E_Ar_20GeV[iside] = m_hResidual_E_Ar_20GeV[iside]->GetEntries()*0.025;
-              if (ResidualScale_E_Ar_20GeV[iside] > 0) {
-                scale_LWHist(m_hResidual_E_Ar_20GeV[iside], 1. / ResidualScale_E_Ar_20GeV[iside]);
-              }
-
-              TimeResidualScale_E_Ar[iside] = m_hTimeResidual_E_Ar[iside]->GetEntries()*0.2;
-              if (TimeResidualScale_E_Ar[iside] > 0) {
-                scale_LWHist(m_hTimeResidual_E_Ar[iside],1./TimeResidualScale_E_Ar[iside]);
-              }
-            }
-          }
-        }
-      } // DoShift
-    }//if online environment
-  }// for (int ibe=0; ibe<2; ibe++)
-  return StatusCode::SUCCESS;
-}//Fill_TRT_Tracks()
+	return sc;
+}
 
-//Fill the TRT Eff histograms
 //----------------------------------------------------------------------------------//
-StatusCode TRT_Monitoring_Tool::Fill_TRT_Efficiency()
+int TRT_Monitoring_Tool::strawNumber(int strawNumber, int strawlayerNumber, int LayerNumber) {
 //----------------------------------------------------------------------------------//
-{
-  ATH_MSG_VERBOSE("Filling TRT Eff Histos");
-
-  // retrive tracks
-  StatusCode sc;
-  if (evtStore()->contains<TrackCollection>(m_track_collection_hole_finder)) {
-    sc = evtStore()->retrieve(m_trkCollectionEff, m_track_collection_hole_finder);
-    if (sc.isFailure()) {
-      ATH_MSG_ERROR("Could not find Tracks Collection");
-      return StatusCode::FAILURE;
-    } else {
-      ATH_MSG_VERBOSE("Tracks retrieved from StoreGate");
-    }
-  }//if contains trackCollection
-  else {
-    ATH_MSG_ERROR("Could not find Tracks Collection for eff");
-    return StatusCode::FAILURE;
-  }
-  //
-  /*
-  const int sectorflag[2][2] = {
-    { +1, -1 },
-    { +2, -2 }
-  };
-  */
-  int itrack = 0;
-  for (TrackCollection::const_iterator track = m_trkCollectionEff->begin(); track != m_trkCollectionEff->end(); ++track) {
-    // online: use all tracks, offline: use only every xth track, skip the rest
-    if (m_environment != AthenaMonManager::online && (itrack % m_every_xth_track) != 0) continue;
-    ++itrack;
-
-    // get perigee
-    const Trk::Perigee* perigee = (*track)->perigeeParameters();
-    if (perigee) {
-      m_track_pt  = perigee->pT();
-      m_track_eta = perigee->eta();
-      m_track_phi = perigee->parameters()[Trk::phi0];
-      m_track_d0  = perigee->parameters()[Trk::d0];
-      m_track_z0  = perigee->parameters()[Trk::z0];
-
-      ATH_MSG_DEBUG("This track has perigee parameters:\n"
-		    << "                 pT     = " << m_track_pt / CLHEP::GeV << " GeV" << "\n"
-		    << "                 eta =    " << m_track_eta << "\n"
-		    << "                 phi0 =   " << m_track_phi << "\n"
-		    << "                 d0 =     " << m_track_d0 / CLHEP::mm << "\n"
-		    << "                 z0 =     " << m_track_z0 / CLHEP::mm << "\n"
-		    << "                 theta =  " << perigee->parameters()[Trk::theta] << "\n"
-		    << "                 qOverP = " << perigee->parameters()[Trk::qOverP]);
-    } else {
-      ATH_MSG_DEBUG("This track has null perigeeParameters.");
-      continue;
-    }
-
-    const DataVector<const Trk::TrackStateOnSurface>* track_states = (*track)->trackStateOnSurfaces();
-    if (track_states) {
-      ATH_MSG_DEBUG("This track has " << track_states->size() << " track states on surface.");
-    } else {
-      ATH_MSG_DEBUG("This track has null track states on surface.");
-      continue;
-    }
-    // // count hits
-    // int n_pixel_hits = 0;
-    // int n_sct_hits   = 0;
-    // int n_trt_hits   = 0;
-    // for (DataVector<const Trk::TrackStateOnSurface>::const_iterator it = track_states->begin(); it != track_states->end(); ++it) {
-    //   if ((*it)->type(Trk::TrackStateOnSurface::Measurement)) {
-    // 	if      (dynamic_cast<const InDet::TRT_DriftCircleOnTrack*> ((*it)->measurementOnTrack())) n_trt_hits++;
-    // 	else if (dynamic_cast<const InDet::SCT_ClusterOnTrack*>    ((*it)->measurementOnTrack())) n_sct_hits++;
-    // 	else if (dynamic_cast<const InDet::PixelClusterOnTrack*>   ((*it)->measurementOnTrack())) n_pixel_hits++;
-    //   }
-    // }
-    const std::auto_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->createSummary(*(*track)));
-    int n_trt_hits = summary->get(Trk::numberOfTRTHits);
-    int n_sct_hits = summary->get(Trk::numberOfSCTHits);
-    int n_pixel_hits = summary->get(Trk::numberOfPixelHits);
-    
-    float m_p = 1.0e+08;
-    if (perigee) {
-      m_p =  (perigee->parameters()[Trk::qOverP]!=0.) ? fabs(1./(perigee->parameters()[Trk::qOverP])) : 1.0e+08;
-    }
-    ///hardcoded cut for pT 2.0 GeV for collision setup
-    float min_pt_new=m_min_pT;
-    if(m_isCosmics==false){
-      min_pt_new=2.0 * CLHEP::GeV;
-    }///
-    // preselect tracks
-    const bool passed_track_preselection =
-      (fabs(perigee->parameters()[Trk::d0]) < m_max_abs_d0)&&
-      (fabs(perigee->parameters()[Trk::z0]) < m_max_abs_z0)&&
-      (perigee->pT() > min_pt_new)&&
-      (m_p > m_minP) &&
-      (fabs(perigee->eta()) < m_max_abs_eta)&&
-      (n_pixel_hits >= m_min_pixel_hits)&&
-      (n_sct_hits >= m_min_sct_hits)&&
-      (n_trt_hits >= m_min_trt_hits);
-
-    ATH_MSG_DEBUG("track has ntrt = " << n_trt_hits << " and nsct = " << n_sct_hits << " and npix = " << n_pixel_hits);
-    if (!passed_track_preselection) {
-      ATH_MSG_DEBUG("This track failed preselection.");
-      continue;
-    }
-    ATH_MSG_DEBUG("This track passed preselection.");
-    for (DataVector<const Trk::TrackStateOnSurface>::const_iterator it = track_states->begin(); it != track_states->end(); it++) {
-      //if ((*it)->type(Trk::TrackStateOnSurface::Measurement)) {
-      if ( !((*it)->type(Trk::TrackStateOnSurface::Measurement)) ) continue;
-      const Trk::TrackParameters* track_parameters = (*it)->trackParameters();
-      //if (track_parameters) {
-      if (!track_parameters) continue;
-      Identifier id = track_parameters->associatedSurface().associatedDetectorElementIdentifier();
-      //if ((m_pTRTHelper->is_trt(id)) {
-      if ( !((m_pTRTHelper->is_trt(id)) )) continue;
-      float locR = track_parameters->parameters()[Trk::driftRadius];
-      int m_barrel_ec       = m_pTRTHelper->barrel_ec(id);
-      int m_layer_or_wheel  = m_pTRTHelper->layer_or_wheel(id);
-      int m_phi_module      = m_pTRTHelper->phi_module(id);
-      int m_straw_layer     = m_pTRTHelper->straw_layer(id);
-      int m_straw           = m_pTRTHelper->straw(id);
-      const bool isArgonStraw = (  Straw_Gastype( m_sumSvc->getStatusHT(id) ) ==GasType::Ar   );//inline function checks m_ArgonXenonSplitter 
-      // assume always Xe if m_ArgonXenonSplitter is not enabled, otherwise check the straw status (good is Xe, non-good is Ar)
-      //const bool isArgonStraw = m_ArgonXenonSplitter && (m_sumSvc->getStatusHT(id) != TRTCond::StrawStatus::Good);
-
-      int ibe   = abs(m_barrel_ec)-1;// ibe =0 barrel , ibe =1 encap
-      int iside = m_barrel_ec > 0 ? 0:1;//iside= 0 side_A , iside = 1 side_C	   
-      if (ibe==0) {
-        if (isArgonStraw) {
-          m_hefficiencyBarrel_locR_Ar->Fill(locR, 1.0);
-        } else {
-          m_hefficiencyBarrel_locR->Fill(locR, 1.0);
-        }
-      } else if (ibe==1) {
-        if (isArgonStraw) {
-          m_hefficiencyEndCap_locR_Ar[iside]->Fill(locR, 1.0);
-        } else {
-          m_hefficiencyEndCap_locR[iside]->Fill(locR, 1.0);
-        }
-      }
-      //if (fabs(locR) < 1.3) {
-      if (fabs(locR) >= 1.3) continue; 
-      int m_strawNumber = 0, m_chip = 0;
-      if (ibe==0) {
-        m_strawNumber = strawNumber(m_straw, m_straw_layer, m_layer_or_wheel);
-        if (m_strawNumber>=0 && m_strawNumber<s_Straw_max[ibe])
-          m_chip = mat_chip_B[m_phi_module][m_strawNumber];
-        } else if (ibe==1) {
-          m_strawNumber = strawNumberEndCap(m_straw, m_straw_layer, m_layer_or_wheel, m_phi_module, m_barrel_ec);
-          if (m_strawNumber>=0 && m_strawNumber<s_Straw_max[ibe])
-            m_chip = mat_chip_E[m_phi_module][m_strawNumber];
-        }
-
-        m_hefficiencyMap[ibe]->Fill(m_strawNumber, 1.0);
-
-        if (DoExpert) {
-          if (iside == 0 ) {
-            m_hefficiencyS[ibe][m_phi_module]->Fill(m_strawNumber, 1.0);
-            m_hefficiencyC[ibe][m_phi_module]->Fill(m_chip, 1.0);
-          } else if (iside == 1 ) {
-            m_hefficiencyS[ibe][m_phi_module+32]->Fill(m_strawNumber, 1.0);
-            m_hefficiencyC[ibe][m_phi_module+32]->Fill(m_chip, 1.0);
-          }
-        } // Do Expert
-        m_hefficiency_eta->Fill(m_track_eta, 1.0);
-        m_hefficiency_phi->Fill(m_track_phi, 1.0);
-        m_hefficiency_pt->Fill(m_track_pt / CLHEP::GeV, 1.0);
-        m_hefficiency_z0->Fill(m_track_z0, 1.0);
-        //}//locR < 1.3
-        //}// is barrel(or endcap)
-        //}// for (int ibe=0; ibe<2; ibe++)
-        //}// if is trt
-        //}// if track_parameters
-        //}// if measurement
-      }// loop over track states
-
-    //use hole finder to find holes on this track !
-
-    if(m_useHoleFinder){
-      const DataVector<const Trk::TrackStateOnSurface>* holes = m_trt_hole_finder->getHolesOnTrack(**track);
-
-      if (!holes) {
-        ATH_MSG_WARNING("TRTTrackHoleSearchTool returned null results.");
-        continue;
-      } else {
-	for (DataVector<const Trk::TrackStateOnSurface>::const_iterator it = holes->begin(); it != holes->end(); ++it) {
-	  //if ((*it)->type(Trk::TrackStateOnSurface::Hole)) {
-	  if( !((*it)->type(Trk::TrackStateOnSurface::Hole)) ) continue;
-	  const Trk::TrackParameters* track_parameters = (*it)->trackParameters();
-	  //if (track_parameters) {
-	  if (!track_parameters) continue;
-	  Identifier id = track_parameters->associatedSurface().associatedDetectorElementIdentifier();
-	  //if (m_pTRTHelper->is_trt(id)) {
-	  if ( !(m_pTRTHelper->is_trt(id)) ) continue;
-	  float locR = track_parameters->parameters()[Trk::driftRadius];
-	  int m_barrel_ec       = m_pTRTHelper->barrel_ec(id);
-	  int m_layer_or_wheel  = m_pTRTHelper->layer_or_wheel(id);
-	  int m_phi_module      = m_pTRTHelper->phi_module(id);
-	  int m_straw_layer     = m_pTRTHelper->straw_layer(id);
-	  int m_straw           = m_pTRTHelper->straw(id);
-	  const bool isArgonStraw = (  Straw_Gastype( m_sumSvc->getStatusHT(id) ) ==GasType::Ar   );//inline function checks m_ArgonXenonSplitter 
-	  // assume always Xe if m_ArgonXenonSplitter is not enabled, otherwise check the straw status (good is Xe, non-good is Ar)
-	  //const bool isArgonStraw = m_ArgonXenonSplitter && (m_sumSvc->getStatusHT(id) != TRTCond::StrawStatus::Good);
-	  
-	  int ibe   = abs(m_barrel_ec)-1;// ibe =0 barrel , ibe =1 encap
-	  int iside = m_barrel_ec > 0 ? 0:1;//iside= 0 side_A , iside = 1 side_C	   
-
-	  if (ibe==0) {
-	    if (isArgonStraw) {
-	      m_hefficiencyBarrel_locR_Ar->Fill(locR, 0.0);
-	    } else {
-	      m_hefficiencyBarrel_locR->Fill(locR, 0.0);
-	    }
-	  } else if (ibe==1) {
-	    if (isArgonStraw) {
-	      m_hefficiencyEndCap_locR_Ar[iside]->Fill(locR, 0.0);
-	    } else {
-	      m_hefficiencyEndCap_locR[iside]->Fill(locR, 0.0);
-	    }
-	  }
-	  //if (fabs(locR) < 1.3) {
-	  if (fabs(locR) >= 1.3) continue;
-	  int m_strawNumber = 0, m_chip = 0;
-	  if (ibe==0) {
-	    m_strawNumber = strawNumber(m_straw, m_straw_layer, m_layer_or_wheel);
-	    if (m_strawNumber>=0 && m_strawNumber<s_Straw_max[ibe]) m_chip = mat_chip_B[m_phi_module][m_strawNumber];
-	  } else if (ibe==1) {
-	    m_strawNumber = strawNumberEndCap(m_straw, m_straw_layer, m_layer_or_wheel, m_phi_module, m_barrel_ec);
-	    if (m_strawNumber>=0 && m_strawNumber<s_Straw_max[ibe]) m_chip = mat_chip_E[m_phi_module][m_strawNumber];
-	  }
-
-	  m_hefficiencyMap[ibe]->Fill(m_strawNumber, 0.0);
-
-	  if (DoExpert) {
-	    if (iside == 0) {//if side_A
-	      m_hefficiencyS[ibe][m_phi_module]->Fill(m_strawNumber, 0.0);
-	      m_hefficiencyC[ibe][m_phi_module]->Fill(m_chip, 0.0);
-	    } else if(iside == 1) {//else if side_C
-	      m_hefficiencyS[ibe][m_phi_module+32]->Fill(m_strawNumber, 0.0);
-	      m_hefficiencyC[ibe][m_phi_module+32]->Fill(m_chip, 0.0);
-	    }
-	  } // do expert
-	  m_hefficiency_eta->Fill(m_track_eta, 0.0);
-	  m_hefficiency_phi->Fill(m_track_phi, 0.0);
-	  m_hefficiency_pt->Fill(m_track_pt / CLHEP::GeV, 0.0);
-	  m_hefficiency_z0->Fill(m_track_z0, 0.0);
-	  //} // loc R < 1.3
-	  //} // Barrel (or Endcap)
-	  //} // for (int ibe=0; ibe<2; ibe++)
-	  //} // if is trt
-	  //} // if (track_parameters)
-	  //}//if ((*it)->type(Trk::TrackStateOnSurface::Hole)) {
-	} // loop over holes
-	delete holes;
-      } // found holes
-    }//m_useHoleFinder
-  } // end loop over tracks
-
-  double n_BorE[2][2];
-  double total_BorE[2][2];
-  for (int ibe=0; ibe<2; ibe++) {
-    for (int iside=0; iside<2; iside++) {
-
-      m_hefficiency[ibe][iside]->Reset();
-      m_hefficiencyIntegral[ibe][iside]->Reset();
-
-      for (int i = 0; i < 32; i++) {
-        for (int ibin = 0; ibin <= s_Straw_max[ibe]; ibin++) {
-          if (DoExpert) {
-            if (m_hefficiencyS[ibe][i+(32*iside)]->GetBinEntries(ibin) > m_min_tracks_straw)
-              m_hefficiency[ibe][iside]->Fill(m_hefficiencyS[ibe][i+(32*iside)]->GetBinContent(ibin));
-          }
-        } // loop ibin barrel
-      } // loop sectors
-
-      n_BorE[ibe][iside] = m_hefficiency[ibe][iside]->GetEntries();
-      total_BorE[ibe][iside] = 0.0;
-
-      for (UInt_t ibin = 0; ibin <= m_hefficiency[ibe][iside]->GetXaxis()->GetNbins(); ibin++) {
-        total_BorE[ibe][iside] += m_hefficiency[ibe][iside]->GetBinContent(ibin);
-        m_hefficiencyIntegral[ibe][iside]->SetBinContent(ibin, n_BorE[ibe][iside]!= 0.0 ? total_BorE[ibe][iside]/n_BorE[ibe][iside] : 0.0);
-      } // loop over ibin
-    }//for (int iside=0; iside<2; iside++)
-  }//for (int ibe=0; ibe<2; ibe++)
-
-  return sc;
+	int addToStrawNumber = 0;
+	int addToStrawNumberNext = 0;
+	int i = 0;
+	const int numberOfStraws[75] = {
+		0,
+		15,
+		16, 16, 16, 16,
+		17, 17, 17, 17, 17,
+		18, 18, 18, 18, 18,
+		19, 19, 19,
+		18,
+		19,
+		20, 20, 20, 20, 20,
+		21, 21, 21, 21, 21,
+		22, 22, 22, 22, 22,
+		23, 23, 23, 23, 23,
+		24, 24,
+		23, 23,
+		24, 24, 24, 24,
+		25, 25, 25, 25, 25,
+		26, 26, 26, 26, 26,
+		27, 27, 27, 27, 27,
+		28, 28, 28, 28, 28,
+		29, 29, 29, 29,
+		28,
+		0
+	};
+
+	do {
+		i++;
+		addToStrawNumber += numberOfStraws[i - 1];
+		addToStrawNumberNext = addToStrawNumber + numberOfStraws[i];
+	} while (strawLayerNumber(strawlayerNumber, LayerNumber) != i - 1);
+
+	strawNumber = addToStrawNumberNext - strawNumber - 1;
+
+	if (strawNumber < 0 || strawNumber > s_Straw_max[0] - 1) {
+		ATH_MSG_WARNING("strawNumber = " << strawNumber << " out of range. Will set to 0.");
+		strawNumber = 0;
+	}
+
+	return strawNumber;
 }
 
+//----------------------------------------------------------------------------------//
+int TRT_Monitoring_Tool::strawNumber_reverse (int inp_strawnumber,  int *strawNumber, int *strawlayerNumber, int *LayerNumber) {
+//----------------------------------------------------------------------------------//
+	const int numberOfStraws[75] = {
+		0,
+		15,
+		16, 16, 16, 16,
+		17, 17, 17, 17, 17,
+		18, 18, 18, 18, 18,
+		19, 19, 19,
+		18,
+		19,
+		20, 20, 20, 20, 20,
+		21, 21, 21, 21, 21,
+		22, 22, 22, 22, 22,
+		23, 23, 23, 23, 23,
+		24, 24,
+		23, 23,
+		24, 24, 24, 24,
+		25, 25, 25, 25, 25,
+		26, 26, 26, 26, 26,
+		27, 27, 27, 27, 27,
+		28, 28, 28, 28, 28,
+		29, 29, 29, 29,
+		28,
+		0
+	};
+	//ToDo check inp_strawnumber
+	int i = 1;
+
+	for (i = 1; inp_strawnumber >= 0; i++) {
+		inp_strawnumber -= numberOfStraws[i];
+	}
+
+	i -= 2;
+	strawLayerNumber_reverse(i, strawlayerNumber, LayerNumber);
+	*strawNumber = -inp_strawnumber - 1;
+	return 0;
+}
 
-int maxtimestamp = 0.;
 //----------------------------------------------------------------------------------//
-StatusCode TRT_Monitoring_Tool::Fill_TRT_HT()
+int TRT_Monitoring_Tool::strawNumberEndCap(int strawNumber, int strawLayerNumber, int LayerNumber, int phi_stack, int side) {
 //----------------------------------------------------------------------------------//
-{
+	// Before perfoming map, corrections need to be perfomed.
+	//  apply special rotations for endcap mappings
+	// for eca, rotate triplets by 180 for stacks 9-16, and 25-32.
+	static const int TripletOrientation[2][32] = {
+		{
+			1, 1, 1, 1, 1, 1, 1, 1,
+			0, 0, 0, 0, 0, 0, 0, 0,
+			1, 1, 1, 1, 1, 1, 1, 1,
+			0, 0, 0, 0, 0, 0, 0, 0
+		},
+		{
+			1, 1, 1, 1, 1, 1, 1, 1,
+			0, 0, 0, 0, 0, 0, 0, 0,
+			1, 1, 1, 1, 1, 1, 1, 1,
+			0, 0, 0, 0, 0, 0, 0, 0
+		}
+	};
+	int phi1 = -1;
 
-  ATH_MSG_VERBOSE("");
-  
-  //Time corrolation
-  //const float timeCor = theComTime ? theComTime->getTime() : 0;
-  //track iterator
-  DataVector<Trk::Track>::const_iterator p_trk;
-  const Trk::Perigee* perigee = NULL;
-  const DataVector<const Trk::TrackParameters>* AllTrkPar(0);
-  DataVector<const Trk::TrackParameters>::const_iterator p_trkpariter;
-
-  int lumiBlockNumber;
-  //int trt_bcid;
-  int timestamp;
-  const EventInfo* thisEventsInfo;
-  if (evtStore()->retrieve(thisEventsInfo).isFailure()) {
-    ATH_MSG_ERROR("Could not retrieve the EventInfo from Store Gate");
-    return StatusCode::FAILURE;
-  }else{
-    lumiBlockNumber = thisEventsInfo->event_ID()->lumi_block();
-    //trt_bcid = thisEventsInfo->event_ID()->bunch_crossing_id();
-  }
-  timestamp = thisEventsInfo->event_ID()->time_stamp();
-   if(timestamp>maxtimestamp)maxtimestamp = timestamp;
-
-  int run_num; 
-  run_num = thisEventsInfo->event_ID()->run_number(); 
-  
-  // get Online Luminosity 
-  //double lbDur = m_lumiTool->lbDuration();      
-  //double AveLum = m_lumiTool->lbAverageLuminosity();
-  double IntLum = (m_lumiTool->lbDuration()*m_lumiTool->lbAverageLuminosity());
-  double timestamp_ave = (maxtimestamp -0.5*m_lumiTool->lbDuration());
-  m_IntLum->SetBinContent(1,IntLum);
-  m_LBvsLum->SetBinContent(lumiBlockNumber,IntLum);
-  m_LBvsTime->SetBinContent(lumiBlockNumber,timestamp_ave);
-
-  for (p_trk = m_trkCollection->begin(); p_trk != m_trkCollection->end(); ++p_trk) {
-
-
-    AllTrkPar = (*p_trk)->trackParameters();
-    for (p_trkpariter = AllTrkPar->begin(); p_trkpariter != AllTrkPar->end(); ++p_trkpariter) {
-      if ((perigee = dynamic_cast<const Trk::Perigee*>(*p_trkpariter))) break;
-    }
-    //if you went through all of the track parameters and found no perigee mearsurement
-    //then something is wrong with the track and so don't use the track.
-    //i.e. continue to the next track.
-    if (!perigee) continue;
-
-    float track_eta  = perigee->eta();
-    //float track_phi  = perigee->parameters()[Trk::phi0];
-    //float track_d0   = perigee->parameters()[Trk::d0];
-    //float track_z0   = perigee->parameters()[Trk::z0];
-    //float track_theta= perigee->parameters()[Trk::theta];
-    float track_p    = (perigee->parameters()[Trk::qOverP] != 0.) ? fabs(1./(perigee->parameters()[Trk::qOverP])) : 10e7;
-    //float track_pT  = perigee->pT();
-
-    const DataVector<const Trk::TrackStateOnSurface>* trackStates = (**p_trk).trackStateOnSurfaces();
-    if (trackStates == 0) continue;
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItBegin     = trackStates->begin();
-    DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItEnd       = trackStates->end();
-    /*
-    int pixel_hits = 0;
-    int sct_hits = 0;
-    int trt_hits = 0;
-    for (DataVector<const Trk::TrackStateOnSurface>::const_iterator it = trackStates->begin(); it != trackStates->end(); ++it) {
-      if ((*it)->type(Trk::TrackStateOnSurface::Measurement)) {
-        if      (dynamic_cast<const InDet::TRT_DriftCircleOnTrack*> ((*it)->measurementOnTrack()))trt_hits++;
-        else if (dynamic_cast<const InDet::SCT_ClusterOnTrack*>    ((*it)->measurementOnTrack())) sct_hits++;
-        else if (dynamic_cast<const InDet::PixelClusterOnTrack*>   ((*it)->measurementOnTrack())) pixel_hits++;
-      }
-    }
-    *///the code below is equivalent to this commented out part
-    const std::auto_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->createSummary(*(*p_trk)));
-    int trt_hits = summary->get(Trk::numberOfTRTHits);
-    int sct_hits = summary->get(Trk::numberOfSCTHits);
-    int pixel_hits = summary->get(Trk::numberOfPixelHits);
-
-    bool passCuts = true;
-    if(fabs(track_eta)>2.5)passCuts=false;
-    if(fabs(track_p)<5000.)passCuts=false;
-    if(pixel_hits<1.)passCuts = false;
-    if(sct_hits<6.)passCuts = false;
-    if(trt_hits<6.)passCuts = false;
-
-    if(!passCuts)continue;
-
-    //Now we have hit informations
-    const DataVector<const Trk::TrackStateOnSurface>* track_states = (*p_trk)->trackStateOnSurfaces();
-    if (track_states) {
-      ATH_MSG_DEBUG("This track has " << track_states->size() << " track states on surface.");
-    } else {
-      ATH_MSG_DEBUG("This track has null track states on surface.");
-      continue;
-    }
-    int barrel_ec_side   = 0;
-    int layer_or_wheel = 0;
-    int phi_module     = 0;
-    int straw_layer    = 0;
-    //int straw          = 0;
-    // loop over Track state on surface
-    
-    for (; TSOSItBegin!=TSOSItEnd; ++TSOSItBegin) {
-      if ((*TSOSItBegin) == 0) continue;
-      if ( !((*TSOSItBegin)->type(Trk::TrackStateOnSurface::Measurement)) ) continue;
-      const InDet::TRT_DriftCircleOnTrack *trtCircle = dynamic_cast<const InDet::TRT_DriftCircleOnTrack*>((*TSOSItBegin)->measurementOnTrack());
-      const Trk::TrackParameters *aTrackParam = dynamic_cast<const Trk::TrackParameters*>((*TSOSItBegin)->trackParameters());
-      if (!trtCircle) continue;
-      if (!aTrackParam) continue;
-
-      Identifier DCoTId = trtCircle->identify();
-      barrel_ec_side  = m_pTRTHelper->barrel_ec(DCoTId);
-      //BA:1 BC:-1 EA:2 EC:-2
-      layer_or_wheel  = m_pTRTHelper->layer_or_wheel(DCoTId);
-      phi_module      = m_pTRTHelper->phi_module(DCoTId);
-      straw_layer     = m_pTRTHelper->straw_layer(DCoTId);
-      //straw           = m_pTRTHelper->straw(DCoTId);
-      int Ba_Ec = (abs(barrel_ec_side)-1);
-      int Side  = barrel_ec_side>0 ? 0 : 1;
-      //Ba_Ec:  0 is barrel 1 is Endcap
-      //Side :  0 is side_A 1 is side_C
-
-      double xPos = trtCircle->globalPosition().x(); // global x coordinate
-      double yPos = trtCircle->globalPosition().y(); // global y coordinate
-      double zPos = trtCircle->globalPosition().z(); // global z coordinate
-      double RPos = sqrt(xPos*xPos + yPos*yPos);
-
-      Identifier surfaceID;
-      surfaceID = trtCircle->identify();
-      // assume always Xe if m_ArgonXenonSplitter is not enabled, otherwise check the straw status (good is Xe, non-good is Ar)
-      //const bool isArgonStraw = m_ArgonXenonSplitter && (m_sumSvc->getStatusHT(surfaceID) != TRTCond::StrawStatus::Good);//
-      const InDet::TRT_DriftCircle *RawDriftCircle = dynamic_cast<const InDet::TRT_DriftCircle*>(trtCircle->prepRawData());
-      if(!RawDriftCircle){//coverity 25097 
-        //This shouldn't happen in normal conditions  because trtCircle is a TRT_DriftCircleOnTrack object
-        ATH_MSG_WARNING("RawDriftCircle object returned null");
-        continue;
-      }
-      int middleHTbit       = RawDriftCircle->getWord() & 0x00020000;
-      //0x00020000 = 0000 0000 0000 0000 0000 0010 0000 0000 0000 0000
-      bool is_middleHTbit_high   = (middleHTbit !=0);
-
-      //bool isHighLevel= RawDriftCircle->highLevel();
-      bool isHighLevel= is_middleHTbit_high;//Hardcoded HT Middle Bit 
-      bool shortStraw = false;
-      int InputBar = 0;
-
-      if(fabs(track_eta)<2. && Ba_Ec==0.){
-        if((layer_or_wheel==0)&&(phi_module<4||(phi_module>7&&phi_module<12)||(phi_module>15&&phi_module<20)||(phi_module>23&&phi_module<28))) InputBar = 1;//C1=true;
-        else if((run_num >= 296939) && (layer_or_wheel==0) && (phi_module>27)) InputBar = 1;
-        else if(layer_or_wheel==0 /*&&C1==false*/)
-          InputBar = 0;//A1= true;
-        else if((layer_or_wheel==1)&&((phi_module>1&&phi_module<6)||(phi_module>9&&phi_module<14)||(phi_module>17&&phi_module<22)||(phi_module>25&&phi_module<30)))
-          InputBar = 1;//C2 = true;
-        else if(layer_or_wheel==1 /*&&C2==false*/)
-          InputBar = 0;//A2= true;
-        else if(layer_or_wheel==2 && phi_module%2!=0)
-          InputBar = 1;//C3 = true;
-        else if(layer_or_wheel==2 /*&&C3==false*/)
-          InputBar = 0;//A3 = true;
-        else {
-          ATH_MSG_WARNING("Should not pass here");
-          continue;
-        }
-        if((layer_or_wheel==0)&&straw_layer<9.)
-          shortStraw = true;
-      }
-
-      //Fill Barrel Plots
-      if((!shortStraw)&&(Ba_Ec==0.)){
-        m_trackz_All[layer_or_wheel][InputBar]->Fill(zPos);
-        if(isHighLevel)
-          m_trackz_HT[layer_or_wheel][InputBar]->Fill(zPos);
-      }
-
-      if(shortStraw){
-        if(zPos>0.){
-          m_trackz_All[3][InputBar]->Fill(zPos);
-          if(isHighLevel)
-            m_trackz_HT[3][InputBar]->Fill(zPos);
-        }
-        else{
-          m_trackz_All[4][InputBar]->Fill(zPos);
-          if(isHighLevel)m_trackz_HT[4][InputBar]->Fill(zPos);
-        }
-      }
-      //End of Barrel Plots, begin EC plots
-
-      int WType = -1.;
-
-      if((Ba_Ec==1)&&(layer_or_wheel<6)&&((straw_layer>3.&&straw_layer<8.)||(straw_layer>11.)))WType = 0.; //in_A
-      if((Ba_Ec==1)&&(layer_or_wheel>=6)&&(straw_layer>3.))WType = 3.;//out_B Assuming Reversed in Type B
-      if((Ba_Ec==1)&&(layer_or_wheel<6)&&((straw_layer>-1.&&straw_layer<4.)||(straw_layer>7.&&straw_layer<12.)))WType = 2.; //out_A
-      if((Ba_Ec==1)&&(layer_or_wheel>=6)&&((straw_layer>-1.&&straw_layer<4.)))WType=1.; //in_B Assuming Reversed in Type B
-
-      if(WType<0&&Ba_Ec==1){//Coverity CID 25096 
-        ATH_MSG_WARNING("The variable  \"WType\" is less than zero!.");
-        continue;
-      }
-
-      if(Ba_Ec==1){
-        m_trackr_All[WType][Side]->Fill(RPos);
-        if(isHighLevel)m_trackr_HT[WType][Side]->Fill(RPos);
-      }
-      //End of EC plots
-    } //for (;TSOSItBegin!=TSOSItEnd; ++TSOSItBegin)
-  }// for (p_trk = m_trkCollection->begin(); p_trk != m_trkCollection->end(); ++p_trk)
-  return StatusCode::SUCCESS;
-
-}//Fill_TRT_HT()
+	if (side == 2) phi1 = phi_stack, side = 1;
+	else if (side == -2) phi1 = 31 - phi_stack, side = 0;
 
+	if (phi1 > -1) {
+		if (TripletOrientation[side][phi1]) {
+			//Change straw number from 0-23 in straw layer to 0-192
+			if (strawLayerNumber < 8)strawNumber = strawNumber + 24 * strawLayerNumber;
 
-//-------------------------------------------------------------------------------------------------//
-StatusCode TRT_Monitoring_Tool::Check_TRT_Readout_Integrity(const EventInfo* eventInfo)
-//-------------------------------------------------------------------------------------------------//
-{
-  StatusCode sc = StatusCode::SUCCESS;
-  if (eventInfo) {
-    ATH_MSG_VERBOSE("Got the event info");
-
-    EventID* TRTEventID = eventInfo->event_ID();
-    if (TRTEventID) {
-      const unsigned int m_lumiBlock = TRTEventID->lumi_block();
-      ATH_MSG_VERBOSE("This is lumiblock : "<<m_lumiBlock);
-
-      good_bcid = TRTEventID->bunch_crossing_id();
-      if ((int)m_lumiBlock != lastLumiBlock) {
-        lastLumiBlock = m_lumiBlock;
-      }
-
-      //Get BSConversion Errors from BSConditionsServices:
-      std::set<std::pair<uint32_t, uint32_t> > *L1IDErrorSet      = m_BSSvc->getIdErrorSet(TRTByteStreamErrors::L1IDError);
-      std::set<std::pair<uint32_t, uint32_t> > *BCIDErrorSet      = m_BSSvc->getIdErrorSet(TRTByteStreamErrors::BCIDError);
-      std::set<uint32_t>                       *MissingErrorSet   = m_BSSvc->getErrorSet(TRTByteStreamErrors::MISSINGError);
-      std::set<uint32_t>                       *SidErrorSet       = m_BSSvc->getErrorSet(TRTByteStreamErrors::SIDError);
-      std::set<std::pair<uint32_t, uint32_t> > *RobStatusErrorSet = m_BSSvc->getRodRobErrorSet(TRTByteStreamErrors::RobStatusError);
-
-      const unsigned int rod_id_base[2][2] = { { 0x310000, 0x320000 }, { 0x330000, 0x340000 } };
-      const unsigned int nChipsTotal[2][2] = { {     3328,     3328 }, {     7680,     7680 } };
-      const unsigned int nRobsTotal[2][2]  = { {       32,       32 }, {       64,       64 } };
-
-      float nBSErrors[2][2]  = { { 0, 0 }, { 0, 0 } };
-      float nRobErrors[2][2] = { { 0, 0 }, { 0, 0 } };
-
-      const std::set<std::pair<uint32_t, uint32_t> > *errorset1[2] = { BCIDErrorSet, L1IDErrorSet };
-      for (int iset = 0; iset < 2; ++iset) {
-        for (std::set<std::pair<uint32_t, uint32_t> >::iterator setIt = errorset1[iset]->begin(); setIt != errorset1[iset]->end(); ++setIt) {
-          for (int ibe = 0; ibe < 2; ++ibe) {
-            for (int iside = 0; iside < 2; ++iside) {
-              if (((setIt->first >> 8) & 0xFF0000) == rod_id_base[ibe][iside]) {
-                nBSErrors[ibe][iside] += 1. / nChipsTotal[ibe][iside];
-              }
-            }
-          }
-        }
-      }
-
-      const std::set<uint32_t> *errorset2[2] = { MissingErrorSet, SidErrorSet };
-      for (int iset = 0; iset < 2; ++iset) {
-        for (std::set<uint32_t>::iterator setIt = errorset2[iset]->begin(); setIt != errorset2[iset]->end(); ++setIt) {
-          for (int ibe = 0; ibe < 2; ++ibe) {
-            for (int iside = 0; iside < 2; ++iside) {
-              if (((*setIt >> 8) & 0xFF0000) == rod_id_base[ibe][iside]) {
-                nBSErrors[ibe][iside] += 1. / nChipsTotal[ibe][iside];
-              }
-            }
-          }
-        }
-      }
-
-      for (int ibe = 0; ibe < 2; ++ibe) {
-        for (int iside = 0; iside < 2; ++iside) {
-          m_hChipBSErrorsVsLB[ibe][iside]->Fill(m_lumiBlock, nBSErrors[ibe][iside]);
-          m_hChipBSErrorsVsLB[ibe][iside]->SetEntries(m_lumiBlock); // we need this so the LastBinThreshold algorithm can find the last bin
-        }
-      }
-
-      for (std::set<std::pair<uint32_t, uint32_t> >::iterator setIt = RobStatusErrorSet->begin(); setIt != RobStatusErrorSet->end(); ++setIt) {
-        for (int ibe = 0; ibe < 2; ++ibe) {
-          for (int iside = 0; iside < 2; ++iside) {
-            if (setIt->first % rod_id_base[ibe][iside] < 0xffff) {
-              nRobErrors[ibe][iside] += 1. / nRobsTotal[ibe][iside];
-            }
-          }
-        }
-      }
-
-      for (int ibe = 0; ibe < 2; ++ibe) {
-        for (int iside = 0; iside < 2; ++iside) {
-          m_hRobBSErrorsVsLB[ibe][iside]->Fill(m_lumiBlock, nRobErrors[ibe][iside]);
-          m_hRobBSErrorsVsLB[ibe][iside]->SetEntries(m_lumiBlock); // we need this so the LastBinThreshold algorithm can find the last bin
-        }
-      }
-    } // TRTEventID
-  } // eventInfo
-
-  return sc;
-}//Check_TRT_Readout_Integrity
-
-//----------------------------------------------------------------//
-int TRT_Monitoring_Tool::strawNumber(int strawNumber, int strawlayerNumber, int LayerNumber)
-//-----------------------------------------------------------------//
-{
-  int addToStrawNumber=0;
-  int addToStrawNumberNext=0;
-  int i=0;
-  const int numberOfStraws[75] = {
-    0,
-    15,
-    16,16,16,16,
-    17,17,17,17,17,
-    18,18,18,18,18,
-    19,19,19,
-    18,
-    19,
-    20,20,20,20,20,
-    21,21,21,21,21,
-    22,22,22,22,22,
-    23,23,23,23,23,
-    24,24,
-    23,23,
-    24,24,24,24,
-    25,25,25,25,25,
-    26,26,26,26,26,
-    27,27,27,27,27,
-    28,28,28,28,28,
-    29,29,29,29,
-    28,
-    0
-  };
-  do {
-    i++;
-    addToStrawNumber+=numberOfStraws[i-1];
-    addToStrawNumberNext = addToStrawNumber+numberOfStraws[i];
-  } while (strawLayerNumber(strawlayerNumber,LayerNumber)!=i-1);
-
-  /*
-    if (strawLayerNumber(strawlayerNumber,LayerNumber) % 2==-10) {
-    strawNumber += addToStrawNumber;
-    } else {
-    strawNumber = addToStrawNumberNext - strawNumber-1;
-    }*/
-  strawNumber = addToStrawNumberNext - strawNumber-1;
-  if (strawNumber < 0 || strawNumber > s_Straw_max[0]-1) {
-    ATH_MSG_WARNING("strawNumber = " << strawNumber << " out of range. Will set to 0.");
-    strawNumber = 0;
-  }
-  return strawNumber;
-
-}//strawNumber()
- 
- //----------------------------------------------------------------//
-int TRT_Monitoring_Tool::strawNumber_reverse (int inp_strawnumber,  int* strawNumber, int* strawlayerNumber, int* LayerNumber)
-//-----------------------------------------------------------------//
-{
-  const int numberOfStraws[75] = {
-    0,
-    15,
-    16,16,16,16,
-    17,17,17,17,17,
-    18,18,18,18,18,
-    19,19,19,
-    18,
-    19,
-    20,20,20,20,20,
-    21,21,21,21,21,
-    22,22,22,22,22,
-    23,23,23,23,23,
-    24,24,
-    23,23,
-    24,24,24,24,
-    25,25,25,25,25,
-    26,26,26,26,26,
-    27,27,27,27,27,
-    28,28,28,28,28,
-    29,29,29,29,
-    28,
-    0
-  };
-  //ToDo check inp_strawnumber
-  int i=1;      
-  for(i=1;inp_strawnumber>=0;i++){
-    inp_strawnumber-=numberOfStraws[i];
-  }
-  i -=2;
-  strawLayerNumber_reverse(i,strawlayerNumber,LayerNumber);
-  *strawNumber = -inp_strawnumber - 1;
-  
-  return 0;//  success  
-}//strawNumber_reverse()
-
-//----------------------------------------------------------------//
-int TRT_Monitoring_Tool::strawNumberEndCap(int strawNumber, int strawLayerNumber, int LayerNumber, int phi_stack, int side)
-//-----------------------------------------------------------------//
-{
+			if (strawLayerNumber > 7)strawNumber = strawNumber + 24 * (strawLayerNumber - 8);
+
+			strawNumber = (192 - 1) * TripletOrientation[side][phi1] + strawNumber * (1 - 2 * TripletOrientation[side][phi1]); //actual rotation
+
+			//take strawNumber back to 0-23
+			if (strawLayerNumber < 8) strawLayerNumber = int(strawNumber / 24);
+
+			if (strawLayerNumber > 7) strawLayerNumber = int(strawNumber / 24) + 8;
 
-  // Before perfoming map, corrections need to be perfomed.
-  //  apply special rotations for endcap mappings
-
-  // for eca, rotate triplets by 180 for stacks 9-16, and 25-32.
-  static const int TripletOrientation[2][32] = {
-    {1,1,1,1,1,1,1,1,
-     0,0,0,0,0,0,0,0,
-     1,1,1,1,1,1,1,1,
-     0,0,0,0,0,0,0,0},
-    {1,1,1,1,1,1,1,1,
-     0,0,0,0,0,0,0,0,
-     1,1,1,1,1,1,1,1,
-     0,0,0,0,0,0,0,0}
-  };
-  int phi1=-1;
-  if (side==2) phi1=phi_stack, side=1;
-  else if (side==-2) phi1=31-phi_stack, side=0;
-  if (phi1>-1) {
-    //if (side==1 && TripletOrientation[side][phi1]) {
-    if (TripletOrientation[side][phi1]) {
-
-      //Change straw number from 0-23 in straw layer to 0-192
-      if (strawLayerNumber < 8)strawNumber = strawNumber + 24*strawLayerNumber;
-      if (strawLayerNumber > 7)strawNumber = strawNumber + 24*(strawLayerNumber -8);
-      strawNumber = (192-1)*TripletOrientation[side][phi1]+strawNumber*(1-2*TripletOrientation[side][phi1]);//actual rotation
-
-      //take strawNumber back to 0-23
-      if (strawLayerNumber<8) strawLayerNumber = int(strawNumber/24);
-      if (strawLayerNumber>7) strawLayerNumber = int(strawNumber/24) + 8;
-      strawNumber = strawNumber % 24;
-    }
-    //Finish rotation
-    //Flip straw in layer.
-
-    if (side==0) strawNumber = 23 - strawNumber;
-    //Finish Flipping
-  }
-
-  // Done with corrections
-  //Start mapping from athena identifiers to TRTViewer maps
-  int strawNumberNew=0;
-  if (LayerNumber<6 && strawLayerNumber>7) {
-    strawNumberNew=strawNumberNew+(384*LayerNumber);
-    strawNumberNew=strawNumberNew+192+(strawLayerNumber % 8)+(strawNumber * 8);
-  } else if (LayerNumber<6 && strawLayerNumber<8) {
-    strawNumberNew=strawNumberNew+(384*LayerNumber);
-    strawNumberNew=strawNumberNew + (strawLayerNumber % 8) + (strawNumber * 8);
-  } else if (LayerNumber>5 && strawLayerNumber>7) {
-    strawNumberNew = strawNumberNew + 2304 + 192*(LayerNumber - 6);
-    strawNumberNew = strawNumberNew + 192 + (strawLayerNumber % 8) + (8 * strawNumber);
-  } else if (LayerNumber>5 && strawLayerNumber<8) {
-    strawNumberNew = strawNumberNew + 2304 + 192*(LayerNumber-6);
-    strawNumberNew = strawNumberNew + (strawLayerNumber % 8) + (8 * strawNumber);
-  }
-
-  strawNumber=strawNumberNew;
-
-  if (strawNumber < 0 || strawNumber > s_Straw_max[1]-1) {
-    ATH_MSG_WARNING("strawNumber = " << strawNumber << " out of range. Will set to 0.");
-    strawNumber = 0;
-  }
-
-  return strawNumber;
+			strawNumber = strawNumber % 24;
+		}
+
+		//Finish rotation
+		//Flip straw in layer.
+
+		if (side == 0) strawNumber = 23 - strawNumber;
+
+		//Finish Flipping
+	}
+
+	// Done with corrections
+	// Start mapping from athena identifiers to TRTViewer maps
+	int strawNumberNew = 0;
+
+	if (LayerNumber < 6 && strawLayerNumber > 7) {
+		strawNumberNew = strawNumberNew + (384 * LayerNumber);
+		strawNumberNew = strawNumberNew + 192 + (strawLayerNumber % 8) + (strawNumber * 8);
+	} else if (LayerNumber < 6 && strawLayerNumber < 8) {
+		strawNumberNew = strawNumberNew + (384 * LayerNumber);
+		strawNumberNew = strawNumberNew + (strawLayerNumber % 8) + (strawNumber * 8);
+	} else if (LayerNumber > 5 && strawLayerNumber > 7) {
+		strawNumberNew = strawNumberNew + 2304 + 192 * (LayerNumber - 6);
+		strawNumberNew = strawNumberNew + 192 + (strawLayerNumber % 8) + (8 * strawNumber);
+	} else if (LayerNumber > 5 && strawLayerNumber < 8) {
+		strawNumberNew = strawNumberNew + 2304 + 192 * (LayerNumber - 6);
+		strawNumberNew = strawNumberNew + (strawLayerNumber % 8) + (8 * strawNumber);
+	}
+
+	strawNumber = strawNumberNew;
+
+	if (strawNumber < 0 || strawNumber > s_Straw_max[1] - 1) {
+		ATH_MSG_WARNING("strawNumber = " << strawNumber << " out of range. Will set to 0.");
+		strawNumber = 0;
+	}
+
+	return strawNumber;
 }
 
-//----------------------------------------------------------------------//
-int TRT_Monitoring_Tool::strawLayerNumber(int strawLayerNumber, int LayerNumber)
-//----------------------------------------------------------------------//
-{
-  switch (LayerNumber) {
-  case 0:  return strawLayerNumber;
-  case 1:  return strawLayerNumber + 19;
-  case 2:  return strawLayerNumber + 43;
-  default: return strawLayerNumber;
-  }
+//----------------------------------------------------------------------------------//
+int TRT_Monitoring_Tool::strawLayerNumber(int strawLayerNumber, int LayerNumber) {
+//----------------------------------------------------------------------------------//
+	switch (LayerNumber) {
+	case 0:
+		return strawLayerNumber;
+
+	case 1:
+		return strawLayerNumber + 19;
+
+	case 2:
+		return strawLayerNumber + 43;
+
+	default:
+		return strawLayerNumber;
+	}
 }
 
-//----------------------------------------------------------------------//
-int TRT_Monitoring_Tool::strawLayerNumber_reverse(int strawLayerNumInp,int* strawLayerNumber, int* LayerNumber)
-//---------------------------------------------------------------------//
-{
-  //Danger? There are no checks on input
-  //use with care
-  if (strawLayerNumInp<19){
-    *strawLayerNumber = strawLayerNumInp;
-    *LayerNumber = 0;
-  }else if (strawLayerNumInp<43){
-    *strawLayerNumber = strawLayerNumInp - 19;
-    *LayerNumber = 1;
-  }else {
-    *strawLayerNumber = strawLayerNumInp - 43;
-    *LayerNumber = 2;
-  }
-  return 0;//succes
+//----------------------------------------------------------------------------------//
+int TRT_Monitoring_Tool::strawLayerNumber_reverse(int strawLayerNumInp, int *strawLayerNumber, int *LayerNumber) {
+//----------------------------------------------------------------------------------//
+	//Danger? There are no checks on input
+	//use with care
+	if (strawLayerNumInp < 19) {
+		*strawLayerNumber = strawLayerNumInp;
+		*LayerNumber = 0;
+	} else if (strawLayerNumInp < 43) {
+		*strawLayerNumber = strawLayerNumInp - 19;
+		*LayerNumber = 1;
+	} else {
+		*strawLayerNumber = strawLayerNumInp - 43;
+		*LayerNumber = 2;
+	}
+
+	return 0;
 }
 
-//----------------------------------------------------------------
-float TRT_Monitoring_Tool::radToDegrees(float radValue)
-//----------------------------------------------------------------
-{
-  float degreeValue = radValue / M_PI * 180;
-  if (degreeValue < 0) degreeValue += 360;
-  return degreeValue;
+//----------------------------------------------------------------------------------//
+float TRT_Monitoring_Tool::radToDegrees(float radValue) {
+//----------------------------------------------------------------------------------//
+	float degreeValue = radValue / M_PI * 180;
+
+	if (degreeValue < 0) degreeValue += 360;
+
+	return degreeValue;
 }
 
-//----------------------------------------------------------------
-int TRT_Monitoring_Tool::chipToBoard(int chip)
-//----------------------------------------------------------------
-// return logical board index:
-// 0 for Board 1S (has 10 chips)  0 -  9
-// 1 for 1L (11)                 10 - 20
-// 2 for 2S (15)                 21 - 35
-// 3 for 2L, first 9 chips       36 - 44
-// 4 for 2L, second 9 chips      45 - 53
-// 5 for 3S, first 11            54 - 64
-// 6 for 3S, second 12           65 - 76
-// 7 for 3L, first 13            77 - 89
-// 8 for 3L, second 14           90 - 103
+//----------------------------------------------------------------------------------//
+int TRT_Monitoring_Tool::chipToBoard(int chip) {
+//----------------------------------------------------------------------------------//
+	// return logical board index:
+	// 0 for Board 1S (has 10 chips)  0 -  9
+	// 1 for 1L (11)                 10 - 20
+	// 2 for 2S (15)                 21 - 35
+	// 3 for 2L, first 9 chips       36 - 44
+	// 4 for 2L, second 9 chips      45 - 53
+	// 5 for 3S, first 11            54 - 64
+	// 6 for 3S, second 12           65 - 76
+	// 7 for 3L, first 13            77 - 89
+	// 8 for 3L, second 14           90 - 103
+	const int list[] = {10, 11, 15, 9, 9, 11, 12, 13, 14};
+	int count = 0;
+	chip--;
+
+	for (int i = 0; i < 9; i++) {
+		count += list[i];
+
+		if (chip < count) return i + 1;
+		else if (chip == 104) return 9;
+	}
 
-{
-  const int list[] = {10, 11, 15, 9, 9, 11, 12, 13, 14};
-  int count = 0;
-  chip--;
-
-  for (int i = 0; i < 9; i++) {
-    count += list[i];
-    if (chip < count) return i + 1;
-    else if (chip == 104) return 9;
-  }
-  assert(count == 104);
-  assert(false); // should never come this far
-  return -1;
+	assert(count == 104);
+	assert(false); // should never come this far
+	return -1;
 }
 
-//----------------------------------------------------------------
-int TRT_Monitoring_Tool::chipToBoard_EndCap(int chip)
-//----------------------------------------------------------------
-{
-  const int remainder = (chip-1) % 12;
-  const int Board = int(((chip -1) - remainder) / 12);
-  return Board+1;
+//----------------------------------------------------------------------------------//
+int TRT_Monitoring_Tool::chipToBoard_EndCap(int chip) {
+//----------------------------------------------------------------------------------//
+	const int remainder = (chip - 1) % 12;
+	const int Board = int(((chip - 1) - remainder) / 12);
+	return Board + 1;
 }
 
 // Code to normalize a LW histogram. For now does it only of TH1F_LW.
 // Return whether we could do it (ie integral was non-zero)
-void TRT_Monitoring_Tool::scale_LWHist(LWHist1D* hist, float scale)
-{
-  if (!hist) return;
-  const unsigned int entries = hist->GetEntries();
-  unsigned int index;
-  double content, error;
-  hist->resetActiveBinLoop();
-  while (hist->getNextActiveBin(index, content, error)) {
-    hist->SetBinContentAndError(index, scale * content, scale * error);
-  }
-  hist->SetEntries(entries);
+//----------------------------------------------------------------------------------//
+void TRT_Monitoring_Tool::scale_LWHist(LWHist1D *hist, float scale) {
+//----------------------------------------------------------------------------------//
+	if (!hist) return;
+
+	const unsigned int entries = hist->GetEntries();
+	unsigned int index;
+	double content, error;
+	hist->resetActiveBinLoop();
+
+	while (hist->getNextActiveBin(index, content, error)) {
+		hist->SetBinContentAndError(index, scale * content, scale * error);
+	}
+
+	hist->SetEntries(entries);
 }
+
 //function for scaling a histogram with an vector
 // checks that number of bins matches vector length
-void TRT_Monitoring_Tool::scale_LWHistWithScaleVector(LWHist1D* hist, const vector<float>& scale)
-{
-  if (!hist) return;
-  if (hist->GetNbinsX() != scale.size()) return; // Could add an error message here
-  const unsigned int entries = hist->GetEntries();
-  unsigned int index;
-  double content, error;
-  hist->resetActiveBinLoop();
-  while (hist->getNextActiveBin(index, content, error)) {
-    // histogram bins run from 1 to n while array runs from 0 ro n-1
-    try {
-      hist->SetBinContentAndError(index, scale.at(index-1) * content, scale.at(index-1) * error);
-    } catch (out_of_range& e) {
-      ATH_MSG_ERROR("Index " << index << " out of range in scale_LWHistWithScaleVector");
-    }
-  }
-  hist->SetEntries(entries);
+//----------------------------------------------------------------------------------//
+void TRT_Monitoring_Tool::scale_LWHistWithScaleVector(LWHist1D *hist, const vector<float> &scale) {
+//----------------------------------------------------------------------------------//
+	if (!hist) return;
+
+	if (hist->GetNbinsX() != scale.size()) return; // Could add an error message here
+
+	const unsigned int entries = hist->GetEntries();
+	unsigned int index;
+	double content, error;
+	hist->resetActiveBinLoop();
+
+	while (hist->getNextActiveBin(index, content, error)) {
+		// histogram bins run from 1 to n while array runs from 0 ro n-1
+		try {
+			hist->SetBinContentAndError(index, scale.at(index - 1) * content, scale.at(index - 1) * error);
+		} catch (out_of_range &e) {
+			ATH_MSG_ERROR("Index " << index << " out of range in scale_LWHistWithScaleVector");
+		}
+	}
+
+	hist->SetEntries(entries);
 }
+
 // code to divide one histogram by another and save result
 // we could add coefficients to this, but we're not going to
 // we might also want to check that the bin ranges are the same, but for now
 // all we check is that we have the same number of bins!
 // Also, for now we don't care (I don't think) about the errors, so don't bother with them...
+//----------------------------------------------------------------------------------//
+void TRT_Monitoring_Tool::divide_LWHist(TH1F_LW *result, TH1F_LW *a, TH1F_LW *b) {
+//----------------------------------------------------------------------------------//
+	if (!result || !a || !b) return;
 
-void TRT_Monitoring_Tool::divide_LWHist(TH1F_LW* result, TH1F_LW* a, TH1F_LW* b)
-{
-  if (!result || !a || !b) return;
-  if (result->GetXaxis()->GetNbins() != a->GetXaxis()->GetNbins() || b->GetXaxis()->GetNbins() != a->GetXaxis()->GetNbins()) return;
-
-  result->Reset();
-
-  unsigned index;
-  double contentA, errorA;
-  double contentB, errorB;
-  a->resetActiveBinLoop();
-  while (a->getNextActiveBin(index, contentA, errorA)) {
-    b->GetBinContentAndError(index, contentB, errorB);
-    if (contentB == 0)
-      result->SetBinContentAndError(index, 0, 0);
-    else
-      result->SetBinContentAndError(index, contentA / contentB, 0);
-  }
-  result->SetEntries(a->GetEntries());
-}
-
-//-------------------------------------------------------------------------------------
-TH1F_LW *TRT_Monitoring_Tool::bookTH1F_LW(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int nbins, double firstbin, double lastbin, const std::string &xTitle, const std::string &yTitle, StatusCode &scode)
-{
-  TH1F_LW *hist = TH1F_LW::create(hName.c_str(), hTitle.c_str(), nbins, firstbin, lastbin);
-  scode = trtRegHist<TH1F_LW>(hist, mongroup, hName.c_str());
+	if (result->GetXaxis()->GetNbins() != a->GetXaxis()->GetNbins() || b->GetXaxis()->GetNbins() != a->GetXaxis()->GetNbins()) return;
 
-  hist->GetXaxis()->SetLabelSize(0.03);
-  hist->GetYaxis()->SetLabelSize(0.03);
-  hist->SetXTitle(xTitle.c_str());
-  hist->SetYTitle(yTitle.c_str());
+	result->Reset();
+	unsigned index;
+	double contentA, errorA;
+	double contentB, errorB;
+	a->resetActiveBinLoop();
 
-  return hist;
-}
-//Bens addition
-TH1D_LW *TRT_Monitoring_Tool::bookTH1D_LW(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int nbins, double firstbin, double lastbin, const std::string &xTitle, const std::string &yTitle, StatusCode &scode)
-{
-  TH1D_LW *hist = TH1D_LW::create(hName.c_str(), hTitle.c_str(), nbins, firstbin, lastbin);
-  scode = trtRegHist<TH1D_LW>(hist, mongroup, hName.c_str());
+	while (a->getNextActiveBin(index, contentA, errorA)) {
+		b->GetBinContentAndError(index, contentB, errorB);
 
-  hist->GetXaxis()->SetLabelSize(0.03);
-  hist->GetYaxis()->SetLabelSize(0.03);
-  hist->SetXTitle(xTitle.c_str());
-  hist->SetYTitle(yTitle.c_str());
+		if (contentB == 0)
+			result->SetBinContentAndError(index, 0, 0);
+		else
+			result->SetBinContentAndError(index, contentA / contentB, 0);
+	}
 
-  return hist;
+	result->SetEntries(a->GetEntries());
 }
 
+//----------------------------------------------------------------------------------//
+TH1F_LW *TRT_Monitoring_Tool::bookTH1F_LW(MonGroup &mongroup, const std::string &hName, const std::string &hTitle, int nbins, double firstbin, double lastbin, const std::string &xTitle, const std::string &yTitle, StatusCode &scode) {
+//----------------------------------------------------------------------------------//
+	TH1F_LW *hist = TH1F_LW::create(hName.c_str(), hTitle.c_str(), nbins, firstbin, lastbin);
+	scode = trtRegHist<TH1F_LW>(hist, mongroup, hName.c_str());
+	hist->GetXaxis()->SetLabelSize(0.03);
+	hist->GetYaxis()->SetLabelSize(0.03);
+	hist->SetXTitle(xTitle.c_str());
+	hist->SetYTitle(yTitle.c_str());
+	return hist;
+}
 
-/*
-  TH1F *TRT_Monitoring_Tool::bookTH1F(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int nbins, double firstbin, double lastbin, const std::string &xTitle, const std::string &yTitle, StatusCode &scode)
-  {
-  TH1F *hist = new TH1F(hName.c_str(), hTitle.c_str(), nbins, firstbin, lastbin);
-  scode = trtRegHist<TH1F>(hist, mongroup, hName.c_str());
-
-  hist->GetXaxis()->SetLabelSize(0.03);
-  hist->GetYaxis()->SetLabelSize(0.03);
-  hist->GetXaxis()->SetTitle(xTitle.c_str());
-  hist->GetYaxis()->SetTitle(yTitle.c_str());
-
-  return hist;
-  }
-*/
-/*
-  TH2F *TRT_Monitoring_Tool::bookTH2F(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int xnbins, double xfirstbin, double xlastbin, int ynbins, double yfirstbin, double ylastbin, const std::string &xTitle, const std::string &yTitle, StatusCode &scode)
-  {
-  TH2F *hist = new TH2F(hName.c_str(), hTitle.c_str(), xnbins, xfirstbin, xlastbin, ynbins, yfirstbin, ylastbin);
-  scode = trtRegHist<TH2F>(hist, mongroup, hName.c_str());
-
-  hist->GetXaxis()->SetLabelSize(0.03);
-  hist->GetYaxis()->SetLabelSize(0.03);
-  hist->SetXTitle(xTitle.c_str());
-  hist->SetYTitle(yTitle.c_str());
-
-  return hist;
-  }*/
+//Bens addition
+//----------------------------------------------------------------------------------//
+TH1D_LW *TRT_Monitoring_Tool::bookTH1D_LW(MonGroup &mongroup, const std::string &hName, const std::string &hTitle, int nbins, double firstbin, double lastbin, const std::string &xTitle, const std::string &yTitle, StatusCode &scode) {
+//----------------------------------------------------------------------------------//
+	TH1D_LW *hist = TH1D_LW::create(hName.c_str(), hTitle.c_str(), nbins, firstbin, lastbin);
+	scode = trtRegHist<TH1D_LW>(hist, mongroup, hName.c_str());
+	hist->GetXaxis()->SetLabelSize(0.03);
+	hist->GetYaxis()->SetLabelSize(0.03);
+	hist->SetXTitle(xTitle.c_str());
+	hist->SetYTitle(yTitle.c_str());
+	return hist;
+}
 
 //TProfile can be rebinned (unlike TProfile_LW) so we still need it.
-TProfile *TRT_Monitoring_Tool::bookTProfile(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int nbins, double firstbin, double lastbin, double ymin, double ymax, const std::string &xTitle, const std::string &yTitle, StatusCode &scode)
-{
-  TProfile *hist = new TProfile(hName.c_str(), hTitle.c_str(), nbins, firstbin, lastbin, ymin, ymax);
-  scode = trtRegHist<TProfile>(hist, mongroup, hName.c_str());
-
-  hist->SetMarkerSize(0.5);
-  hist->SetMarkerStyle(2);
-  hist->SetMarkerColor(2);
-  hist->GetXaxis()->SetLabelSize(0.03);
-  hist->GetYaxis()->SetLabelSize(0.03);
-  hist->GetXaxis()->SetTitle(xTitle.c_str());
-  hist->GetYaxis()->SetTitle(yTitle.c_str());
-
-  return hist;
+//----------------------------------------------------------------------------------//
+TProfile *TRT_Monitoring_Tool::bookTProfile(MonGroup &mongroup, const std::string &hName, const std::string &hTitle, int nbins, double firstbin, double lastbin, double ymin, double ymax, const std::string &xTitle, const std::string &yTitle, StatusCode &scode) {
+//----------------------------------------------------------------------------------//
+	TProfile *hist = new TProfile(hName.c_str(), hTitle.c_str(), nbins, firstbin, lastbin, ymin, ymax);
+	scode = trtRegHist<TProfile>(hist, mongroup, hName.c_str());
+	hist->SetMarkerSize(0.5);
+	hist->SetMarkerStyle(2);
+	hist->SetMarkerColor(2);
+	hist->GetXaxis()->SetLabelSize(0.03);
+	hist->GetYaxis()->SetLabelSize(0.03);
+	hist->GetXaxis()->SetTitle(xTitle.c_str());
+	hist->GetYaxis()->SetTitle(yTitle.c_str());
+	return hist;
 }
 
-TProfile_LW *TRT_Monitoring_Tool::bookTProfile_LW(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int nbins, double firstbin, double lastbin, double ymin, double ymax, const std::string &xTitle, const std::string &yTitle, StatusCode &scode)
-{
-  TProfile_LW *hist = TProfile_LW::create(hName.c_str(), hTitle.c_str(), nbins, firstbin, lastbin, ymin, ymax);
-  scode = trtRegHist<TProfile_LW>(hist, mongroup, hName.c_str());
-
-  hist->SetMarkerSize(0.5);
-  hist->SetMarkerStyle(2);
-  hist->SetMarkerColor(2);
-  hist->GetXaxis()->SetLabelSize(0.03);
-  hist->GetYaxis()->SetLabelSize(0.03);
-  hist->GetXaxis()->SetTitle(xTitle.c_str());
-  hist->GetYaxis()->SetTitle(yTitle.c_str());
-
-  return hist;
+//----------------------------------------------------------------------------------//
+TProfile_LW *TRT_Monitoring_Tool::bookTProfile_LW(MonGroup &mongroup, const std::string &hName, const std::string &hTitle, int nbins, double firstbin, double lastbin, double ymin, double ymax, const std::string &xTitle, const std::string &yTitle, StatusCode &scode) {
+//----------------------------------------------------------------------------------//
+	TProfile_LW *hist = TProfile_LW::create(hName.c_str(), hTitle.c_str(), nbins, firstbin, lastbin, ymin, ymax);
+	scode = trtRegHist<TProfile_LW>(hist, mongroup, hName.c_str());
+	hist->SetMarkerSize(0.5);
+	hist->SetMarkerStyle(2);
+	hist->SetMarkerColor(2);
+	hist->GetXaxis()->SetLabelSize(0.03);
+	hist->GetYaxis()->SetLabelSize(0.03);
+	hist->GetXaxis()->SetTitle(xTitle.c_str());
+	hist->GetYaxis()->SetTitle(yTitle.c_str());
+	return hist;
 }
 
-TH2F_LW *TRT_Monitoring_Tool::bookTH2F_LW(MonGroup& mongroup, const std::string &hName, const std::string &hTitle, int xnbins, double xfirstbin, double xlastbin, int ynbins, double yfirstbin, double ylastbin, const std::string &xTitle, const std::string &yTitle, StatusCode &scode)
-{
-  TH2F_LW *hist = TH2F_LW::create(hName.c_str(), hTitle.c_str(), xnbins, xfirstbin, xlastbin, ynbins, yfirstbin, ylastbin);
-  scode = trtRegHist<TH2F_LW>(hist, mongroup, hName.c_str());
+//----------------------------------------------------------------------------------//
+TH2F_LW *TRT_Monitoring_Tool::bookTH2F_LW(MonGroup &mongroup, const std::string &hName, const std::string &hTitle, int xnbins, double xfirstbin, double xlastbin, int ynbins, double yfirstbin, double ylastbin, const std::string &xTitle, const std::string &yTitle, StatusCode &scode) {
+//----------------------------------------------------------------------------------//
+	TH2F_LW *hist = TH2F_LW::create(hName.c_str(), hTitle.c_str(), xnbins, xfirstbin, xlastbin, ynbins, yfirstbin, ylastbin);
+	scode = trtRegHist<TH2F_LW>(hist, mongroup, hName.c_str());
+	hist->GetXaxis()->SetLabelSize(0.03);
+	hist->GetYaxis()->SetLabelSize(0.03);
+	hist->SetXTitle(xTitle.c_str());
+	hist->SetYTitle(yTitle.c_str());
+	return hist;
+}
 
-  hist->GetXaxis()->SetLabelSize(0.03);
-  hist->GetYaxis()->SetLabelSize(0.03);
-  hist->SetXTitle(xTitle.c_str());
-  hist->SetYTitle(yTitle.c_str());
 
-  return hist;
-}
+//----------------------------------------------------------------------------------//
+int TRT_Monitoring_Tool::initScaleVectors() {
+//----------------------------------------------------------------------------------//
+	if (m_flagforscale == 0 ) return 0;
+
+	m_scale_hHitWMap_B.clear();
+	m_scale_hHitWMap_B_Ar.clear();
+
+	for (int i = 0; i < s_Straw_max[0]; i++) {
+		float countAr = 0;
+		float countXe = 0;
+		int sN, sLN, lN;
+		strawNumber_reverse(i, &sN, &sLN, &lN);
+
+		for (int side = -1 ; side < 2; side += 2 ) {
+			for (int j = 0; j < 32; j++ ) {
+				Identifier Dummy_Identifier;
+				Dummy_Identifier = m_pTRTHelper->straw_id(side, j, lN, sLN, sN);
+				bool isArgonStraw = (Straw_Gastype( m_sumSvc->getStatusHT(Dummy_Identifier) ) == GasType::Ar); 
+
+				if (isArgonStraw)
+					countAr += 1.0;
+				else
+					countXe += 1.0;
+			}
+		}
 
+		m_scale_hHitWMap_B.push_back(countXe);
+		m_scale_hHitWMap_B_Ar.push_back(countAr);
+	}
 
-int TRT_Monitoring_Tool::m_initScaleVectors(){
-  if(m_flagforscale == 0 ) return 0;
-  m_scale_hHitWMap_B.clear();
-  m_scale_hHitWMap_B_Ar.clear();
-  for (int i=0;i<s_Straw_max[0];i++){
-    float countAr = 0;
-    float countXe = 0;
-    int sN,sLN,lN;
-    strawNumber_reverse(i,&sN,&sLN,&lN);
-    for (int side = -1 ;side <2;side+=2 ){
-      for (int j=0;j<32;j++ ){
-	Identifier Dummy_Identifier;
-	Dummy_Identifier = m_pTRTHelper->straw_id(side,j,lN,sLN,sN);
-	bool isArgonStraw = (  Straw_Gastype( m_sumSvc->getStatusHT(Dummy_Identifier) ) ==GasType::Ar   );//inline function checks m_ArgonXenonSplitter 
-	//bool isArgonStraw = m_ArgonXenonSplitter && (m_sumSvc->getStatusHT(Dummy_Identifier) != TRTCond::StrawStatus::Good);
-	if (isArgonStraw) 
-	  countAr +=1.0;
-	else
-	  countXe +=1.0; 
-      }
-    } 
-    m_scale_hHitWMap_B.push_back(countXe);
-    m_scale_hHitWMap_B_Ar.push_back(countAr);
-  }
-  m_flagforscale=0;
-      
-
-  return 0;
-}// TRT_Monitoring_Tool::m_initScaleVectors()
+	m_flagforscale = 0;
+	return 0;
+}
diff --git a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/CMakeLists.txt b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/CMakeLists.txt
index b796dc546e6a8f5211132b83a83be11e292ac3bf..cacbe06653c42b441a1d489dbcfa26060d0d7f89 100644
--- a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/CMakeLists.txt
+++ b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/CMakeLists.txt
@@ -7,7 +7,7 @@ atlas_subdir( InDetRIO_OnTrack )
 
 # Declare the package's dependencies:
 atlas_depends_on_subdirs( PUBLIC
-                          Control/DataModel
+                          Control/AthLinks
                           DetectorDescription/Identifier
                           GaudiKernel
                           InnerDetector/InDetRecEvent/InDetPrepRawData
@@ -26,12 +26,12 @@ atlas_add_library( InDetRIO_OnTrack
                    src/*.cxx
                    PUBLIC_HEADERS InDetRIO_OnTrack
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                   LINK_LIBRARIES DataModel Identifier GaudiKernel InDetPrepRawData TrkEventPrimitives TrkRIO_OnTrack EventContainers
+                   LINK_LIBRARIES AthLinks Identifier GaudiKernel InDetPrepRawData TrkEventPrimitives TrkRIO_OnTrack EventContainers
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} InDetReadoutGeometry TrkSurfaces )
 
 atlas_add_dictionary( InDetRIO_OnTrackDict
                       InDetRIO_OnTrack/InDetRIO_OnTrackDict.h
                       InDetRIO_OnTrack/selection.xml
                       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} DataModel Identifier GaudiKernel InDetPrepRawData TrkEventPrimitives TrkRIO_OnTrack InDetReadoutGeometry TrkSurfaces InDetRIO_OnTrack EventContainers )
+                      LINK_LIBRARIES ${ROOT_LIBRARIES} AthLinks Identifier GaudiKernel InDetPrepRawData TrkEventPrimitives TrkRIO_OnTrack InDetReadoutGeometry TrkSurfaces InDetRIO_OnTrack EventContainers )
 
diff --git a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/PixelClusterOnTrack.h b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/PixelClusterOnTrack.h
index 2e7a3136f81ad959e577a7bdaf82382ea177fa64..5aea8691936dd8e345ecac8b9a68e66ea665ddf7 100755
--- a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/PixelClusterOnTrack.h
+++ b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/PixelClusterOnTrack.h
@@ -16,7 +16,7 @@
 
 // for ElementLink to IdentifiableContainer PixelClusterContainer
 #include "InDetPrepRawData/PixelClusterContainer.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 
 class FakeTrackBuilder;
 namespace Trk {
diff --git a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/SCT_ClusterOnTrack.h b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/SCT_ClusterOnTrack.h
index 2099889ee3ce4848bec721f77db7af3de6961722..3b592dc8625f1e6c27ad4e5aaeb81c82566d0f60 100755
--- a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/SCT_ClusterOnTrack.h
+++ b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/SCT_ClusterOnTrack.h
@@ -15,7 +15,7 @@
 
 // for ElementLink to IdentifiableContainer SCT_ClusterContainer
 #include "InDetPrepRawData/SCT_ClusterContainer.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 
 namespace Trk {
   class Surface;
diff --git a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h
index 626f691e6631777fb9b9daa58b866b5c09fe7765..99a92eb4b5b1ff0bdfb13e5cfa5ea9510cd04e7f 100755
--- a/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h
+++ b/InnerDetector/InDetRecEvent/InDetRIO_OnTrack/InDetRIO_OnTrack/TRT_DriftCircleOnTrack.h
@@ -21,7 +21,7 @@
 
 // for ElementLink to IdentifiableContainer PixelClusterContainer
 #include "InDetPrepRawData/TRT_DriftCircleContainer.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 
 namespace Trk {
   class Surface;
diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetConversionFinderTools/CMakeLists.txt
index 1c2aaa049a55d05442fbacfc358e77ea4d7b71ff..432ccf3d2231c0c002c1f7f7d9fc1fcbb6c27636 100644
--- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/CMakeLists.txt
+++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/CMakeLists.txt
@@ -17,7 +17,7 @@ atlas_depends_on_subdirs( PUBLIC
                           Tracking/TrkEvent/TrkParticleBase
                           Tracking/TrkEvent/TrkTrack
                           PRIVATE
-                          Control/DataModel
+                          Control/AthLinks
                           InnerDetector/InDetRecEvent/InDetPrepRawData
                           Tracking/TrkDetDescr/TrkSurfaces
                           Tracking/TrkEvent/TrkMeasurementBase
@@ -39,10 +39,10 @@ atlas_add_library( InDetConversionFinderToolsLib
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
                    LINK_LIBRARIES AthenaBaseComps xAODTracking GaudiKernel InDetRecToolInterfaces Particle TrkEventPrimitives TrkParameters TrkParticleBase TrkTrack
-                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} DataModel InDetPrepRawData TrkSurfaces TrkMeasurementBase TrkRIO_OnTrack VxVertex TrkExInterfaces TrkToolInterfaces TrkVertexFitterInterfaces )
+                   PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthLinks InDetPrepRawData TrkSurfaces TrkMeasurementBase TrkRIO_OnTrack VxVertex TrkExInterfaces TrkToolInterfaces TrkVertexFitterInterfaces )
 
 atlas_add_component( InDetConversionFinderTools
                      src/components/*.cxx
                      INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel InDetRecToolInterfaces Particle TrkEventPrimitives TrkParameters TrkParticleBase TrkTrack DataModel InDetPrepRawData TrkSurfaces TrkMeasurementBase TrkRIO_OnTrack VxVertex TrkExInterfaces TrkToolInterfaces TrkVertexFitterInterfaces InDetConversionFinderToolsLib )
+                     LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel InDetRecToolInterfaces Particle TrkEventPrimitives TrkParameters TrkParticleBase TrkTrack AthLinks InDetPrepRawData TrkSurfaces TrkMeasurementBase TrkRIO_OnTrack VxVertex TrkExInterfaces TrkToolInterfaces TrkVertexFitterInterfaces InDetConversionFinderToolsLib )
 
diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/InDetConversionFinderTools.cxx b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/InDetConversionFinderTools.cxx
index cfb1d265e0bc0177f4f8e555c60f5eaf9821c58c..4eb35e619cc4f23d0fc2e45b331379874a4a9d79 100755
--- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/InDetConversionFinderTools.cxx
+++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/InDetConversionFinderTools.cxx
@@ -14,7 +14,7 @@
 
 #include "CLHEP/Vector/ThreeVector.h"
 #include "TrkMeasurementBase/MeasurementBase.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 #include "TrkTrack/LinkToTrack.h"
 #include "TrkParticleBase/LinkToTrackParticleBase.h"
 #include "TrkVertexFitterInterfaces/IVertexFitter.h"
diff --git a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/SingleTrackConversionTool.cxx b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/SingleTrackConversionTool.cxx
index 01d3c77a789f6912d468b75de07db19d419af606..b2d7e42aa12f4e7652b1ea57c7ae136fa4447454 100644
--- a/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/SingleTrackConversionTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetConversionFinderTools/src/SingleTrackConversionTool.cxx
@@ -13,7 +13,7 @@
 #include "InDetConversionFinderTools/SingleTrackConversionTool.h"
 #include "TrkTrack/Track.h"
 #include "TrkParameters/TrackParameters.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 #include "TrkTrack/LinkToTrack.h"
 #include "TrkParticleBase/LinkToTrackParticleBase.h"
 #include "InDetConversionFinderTools/ConversionFinderUtils.h"
diff --git a/InnerDetector/InDetRecTools/TRT_ToT_Tools/src/TRT_ToT_dEdx.cxx b/InnerDetector/InDetRecTools/TRT_ToT_Tools/src/TRT_ToT_dEdx.cxx
index 204929367fb757a190ec471df26ab3d16e654c8c..357aa0ce7c0abbe19282031e261ebe4b6b07f8de 100644
--- a/InnerDetector/InDetRecTools/TRT_ToT_Tools/src/TRT_ToT_dEdx.cxx
+++ b/InnerDetector/InDetRecTools/TRT_ToT_Tools/src/TRT_ToT_dEdx.cxx
@@ -758,12 +758,10 @@ bool TRT_ToT_dEdx::isData() const {
   } else {
    
     SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfoKey);
-    StatusCode sc;
-    if (eventInfo.isValid()){
-      sc =StatusCode::SUCCESS;
-    }else{ 
-      sc = StatusCode::FAILURE;}
-    ATH_CHECK(sc);
+    if (!eventInfo.isValid()){
+      REPORT_MESSAGE(MSG::FATAL) << "Cannot retrieve EventInfo";
+      return false;
+    }
 
     // check if data or MC 
     m_isData = true;
@@ -786,14 +784,11 @@ double TRT_ToT_dEdx::dEdx(const Trk::Track* track, bool divideByL, bool useHThit
 
   // Event information 
   SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfoKey);
-  StatusCode sc;
-  if (eventInfo.isValid()){
-    sc =StatusCode::SUCCESS;
-  }else{
-    sc = StatusCode::FAILURE;}
-  ATH_CHECK(sc);
+  if (!eventInfo.isValid()){
+    REPORT_MESSAGE(MSG::FATAL) << "Cannot retrieve EventInfo";
+    return 0;
+  }
 
-  
   //    Average interactions per crossing for the current BCID
   double mu = -1.;
   mu = eventInfo->averageInteractionsPerCrossing();
diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/FTK_TrackMaker.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/FTK_TrackMaker.cxx
index e2d5c99994e3b73e99d1e47930329825f2661515..bdd9f484cd49a01bddbd6c1551826f23d88e440f 100755
--- a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/FTK_TrackMaker.cxx
+++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/FTK_TrackMaker.cxx
@@ -73,7 +73,7 @@ namespace InDet{
     //retrieve rob data provider service
     if (m_robDataProvider.retrieve().isFailure()){
       ATH_MSG_FATAL( "Failed to retrieve " << m_robDataProvider );
-      return StatusCode::FAILURE;
+      return HLT::ErrorCode(HLT::Action::ABORT_JOB, HLT::Reason::BAD_JOB_SETUP);
     }
     else
       ATH_MSG_INFO( "Retrieved service " << m_robDataProvider << " in FTK_TrackMaker." );
diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/SCT_TrgClusterization.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/SCT_TrgClusterization.cxx
index 036c93f8f2ba4447fe883d517021d6686cc9feed..2acdb6e3c747825f6c24603979f3079e21a33bef 100755
--- a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/SCT_TrgClusterization.cxx
+++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/SCT_TrgClusterization.cxx
@@ -220,7 +220,7 @@ namespace InDet{
     //retrieve rob data provider service
     if (m_robDataProvider.retrieve().isFailure()) {
       ATH_MSG_FATAL( "Failed to retrieve " << m_robDataProvider );
-      return StatusCode::FAILURE;
+      return HLT::ErrorCode(HLT::Action::ABORT_JOB, HLT::Reason::BAD_JOB_SETUP);
     } else
       ATH_MSG_INFO( "Retrieved service " << m_robDataProvider << " in SCT_trgClusterization. " );
 
diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/TRT_TrgRIO_Maker.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/TRT_TrgRIO_Maker.cxx
index db70ea43a48e65424a45968b5f034ef40a3a11b9..449b3c527e4c683e7558ce9a9cb670cac1735466 100755
--- a/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/TRT_TrgRIO_Maker.cxx
+++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigPrepRawDataFormat/src/TRT_TrgRIO_Maker.cxx
@@ -182,7 +182,7 @@ namespace InDet{
     //retrieve rob data provider service
     if (m_robDataProvider.retrieve().isFailure()){
       ATH_MSG_FATAL( "Failed to retrieve " << m_robDataProvider );
-      return StatusCode::FAILURE;
+      return HLT::ErrorCode(HLT::Action::ABORT_JOB, HLT::Reason::BAD_JOB_SETUP);
     }
     else
       ATH_MSG_INFO( "Retrieved service " << m_robDataProvider << " in TRT_TrgRIO_Maker." );
diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigTruthAlgs/CMakeLists.txt b/InnerDetector/InDetTrigRecAlgs/InDetTrigTruthAlgs/CMakeLists.txt
index 4a019304e790b5dc7f51ac2180e75ca25ad03363..8c77cb3565ce014811d66ee2fc17e2667d2fc88f 100644
--- a/InnerDetector/InDetTrigRecAlgs/InDetTrigTruthAlgs/CMakeLists.txt
+++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigTruthAlgs/CMakeLists.txt
@@ -12,7 +12,7 @@ atlas_depends_on_subdirs( PUBLIC
                           Tracking/TrkEvent/TrkTruthData
                           Trigger/TrigSteer/TrigInterfaces
                           PRIVATE
-                          Control/DataModel
+                          Control/AthLinks
                           Control/StoreGate
                           InnerDetector/InDetRecEvent/InDetPrepRawData
                           InnerDetector/InDetTruth/InDetTruthInterfaces
@@ -26,7 +26,7 @@ atlas_depends_on_subdirs( PUBLIC
 atlas_add_component( InDetTrigTruthAlgs
                      src/*.cxx
                      src/components/*.cxx
-                     LINK_LIBRARIES GaudiKernel InDetSimData TrkTruthData TrigInterfacesLib DataModel StoreGateLib SGtests InDetPrepRawData Particle ParticleTruth TrkTrack TrkToolInterfaces TrigParticle )
+                     LINK_LIBRARIES GaudiKernel InDetSimData TrkTruthData TrigInterfacesLib AthLinks StoreGateLib SGtests InDetPrepRawData Particle ParticleTruth TrkTrack TrkToolInterfaces TrigParticle )
 
 # Install files from the package:
 atlas_install_headers( InDetTrigTruthAlgs )
diff --git a/InnerDetector/InDetTrigRecAlgs/InDetTrigTruthAlgs/src/TrigTrackParticleTruthMaker.cxx b/InnerDetector/InDetTrigRecAlgs/InDetTrigTruthAlgs/src/TrigTrackParticleTruthMaker.cxx
index c86207521d970b6f285610de9a1dd056c599136b..879401a4812a7c7a53790257fd39a4790568f847 100755
--- a/InnerDetector/InDetTrigRecAlgs/InDetTrigTruthAlgs/src/TrigTrackParticleTruthMaker.cxx
+++ b/InnerDetector/InDetTrigRecAlgs/InDetTrigTruthAlgs/src/TrigTrackParticleTruthMaker.cxx
@@ -19,7 +19,7 @@
 #include "GaudiKernel/MsgStream.h"
 
 #include <map>
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 
 namespace InDet {
 
diff --git a/InnerDetector/InDetTruth/InDetTruthAlgs/CMakeLists.txt b/InnerDetector/InDetTruth/InDetTruthAlgs/CMakeLists.txt
index 7ceb60cba20bb6adb1433d184f4e92d8f0da51ad..b0e804c2c0a54b89a31c7fafe43ecc5d4899eedb 100644
--- a/InnerDetector/InDetTruth/InDetTruthAlgs/CMakeLists.txt
+++ b/InnerDetector/InDetTruth/InDetTruthAlgs/CMakeLists.txt
@@ -17,14 +17,13 @@ atlas_depends_on_subdirs( PUBLIC
                           Tracking/TrkTools/TrkToolInterfaces
                           Event/EventContainers
                           PRIVATE
-                          Control/DataModel
                           Tracking/TrkEvent/TrkTrack )
 
 # Component(s) in the package:
 atlas_add_component( InDetTruthAlgs
                      src/*.cxx
                      src/components/*.cxx
-                     LINK_LIBRARIES AthenaBaseComps StoreGateLib SGtests GaudiKernel InDetSimData InDetPrepRawData TrkTruthData TrkToolInterfaces DataModel TrkTrack EventContainers )
+                     LINK_LIBRARIES AthenaBaseComps StoreGateLib SGtests GaudiKernel InDetSimData InDetPrepRawData TrkTruthData TrkToolInterfaces TrkTrack EventContainers )
 
 # Install files from the package:
 atlas_install_headers( InDetTruthAlgs )
diff --git a/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx b/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx
index 1483948c79050b6ee43b63b287e0e97cc305a484..d1c09d3fdf765681c7033d48cee7a74ec85cf715 100755
--- a/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx
+++ b/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx
@@ -662,14 +662,36 @@ selectGenSignal  (const McEventCollection* SimTracks,
   return;
 }
 
+namespace {
+    class StreamState
+    {
+    public:
+      StreamState(std::ostream& out)
+           : m_out(out), m_fmt(out.flags())
+       {
+       }
+
+       ~StreamState()
+       {
+	   m_out.flags(m_fmt);
+       }
+
+    private:
+       std::ostream& m_out;
+       std::ios_base::fmtflags m_fmt;
+    };
+}
+
+
 void InDet :: InDetRecStatisticsAlg :: printStatistics() {
   ATH_MSG_INFO(" ********** Beginning InDetRecStatistics Statistics Table ***********");
   ATH_MSG_INFO("For documentation see https://twiki.cern.ch/twiki/bin/view/Atlas/InDetRecStatistics");
-  ATH_MSG_INFO("(or for guarenteed latest version: http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/offline/InnerDetector/InDetValidation/InDetRecStatistics/doc/mainpage.h?&view=markup )");
+  ATH_MSG_INFO("(or for guaranteed latest version: http://atlas-sw.cern.ch/cgi-bin/viewcvs-atlas.cgi/offline/InnerDetector/InDetValidation/InDetRecStatistics/doc/mainpage.h?&view=markup )");
   ATH_MSG_INFO(" ********************************************************************");
   //  if(msgSvc.outputLevel() >= MSG::INFO){
+  StreamState restore_precision (std::cout);
   std::cout << MSG::INFO 
-	    <<  std::setiosflags(std::ios::fixed | std::ios::showpoint) 
+	    << std::setiosflags(std::ios::fixed | std::ios::showpoint)  
 	    << std::setw(7) << std::setprecision(2)
 	    << s_linestr << std::endl
 	    << "Summary" << std::endl 
diff --git a/LArCalorimeter/LArBadChannelTool/src/LArBadChanTool.cxx b/LArCalorimeter/LArBadChannelTool/src/LArBadChanTool.cxx
index e5b782fcbdeb419737c7a79aa9f65cec7909eecb..b1c8549903ddbdad603d47c1aaaca513c02e7e5f 100644
--- a/LArCalorimeter/LArBadChannelTool/src/LArBadChanTool.cxx
+++ b/LArCalorimeter/LArBadChannelTool/src/LArBadChanTool.cxx
@@ -414,7 +414,7 @@ bool LArBadChanTool::readFromDB( const DataHandle<CondAttrListCollection> collec
 bool LArBadChanTool::readBadFebsFromDB() 
 {
 
-  ATH_CHECK( detStore()->retrieve( m_DBBadFebColl, m_DBBadFebFolder) );
+  ATH_CHECK( detStore()->retrieve( m_DBBadFebColl, m_DBBadFebFolder), false );
   ATH_MSG_INFO ( "Retrieved folder " << m_DBBadFebFolder );
 
   if (!m_DBBadFebColl.isValid()){
diff --git a/LArCalorimeter/LArCalibUtils/LArCalibUtils/LArCalibPatchingAlg.icc b/LArCalorimeter/LArCalibUtils/LArCalibUtils/LArCalibPatchingAlg.icc
index f339a95213e75d801b6f59dcec522d2f264aaa5f..efdf43d6d057033f8ec8c1404d9d6f5cd4a198fe 100644
--- a/LArCalorimeter/LArCalibUtils/LArCalibUtils/LArCalibPatchingAlg.icc
+++ b/LArCalorimeter/LArCalibUtils/LArCalibUtils/LArCalibPatchingAlg.icc
@@ -267,7 +267,7 @@ bool LArCalibPatchingAlg<CONDITIONSCONTAINER>::patch(const HWIdentifier chid, co
     } else {
       ATH_MSG_DEBUG ( "Got a phi-average..." );
     }
-    ATH_CHECK( m_contOut->insertCorrection(chid,patch,gain,m_useCorrChannel) );
+    ATH_CHECK( m_contOut->insertCorrection(chid,patch,gain,m_useCorrChannel), false );
     return true;
   }
   else if (m_patchMethod==FEBAverage) {
@@ -278,7 +278,7 @@ bool LArCalibPatchingAlg<CONDITIONSCONTAINER>::patch(const HWIdentifier chid, co
     } else {
       ATH_MSG_DEBUG ( "Got a FEB-average..." );
     }
-    ATH_CHECK( m_contOut->insertCorrection(chid,patch,gain,m_useCorrChannel) );
+    ATH_CHECK( m_contOut->insertCorrection(chid,patch,gain,m_useCorrChannel), false );
     return true;
   }
   else //failed...
diff --git a/LArCalorimeter/LArCalibUtils/src/LArTimePhysPrediction.cxx b/LArCalorimeter/LArCalibUtils/src/LArTimePhysPrediction.cxx
index bbd0b62d31d9bfa06885405f7fecee35eda041c3..cfd65d82b6917d5064263a3b65831fb4b4054883 100755
--- a/LArCalorimeter/LArCalibUtils/src/LArTimePhysPrediction.cxx
+++ b/LArCalorimeter/LArCalibUtils/src/LArTimePhysPrediction.cxx
@@ -168,7 +168,7 @@ StatusCode LArTimePhysPrediction::stop()
     {
       ATH_MSG_ERROR
         ( "CaloDetDescrManager is not initialized, module unusable!" );
-      return false;
+      return StatusCode::FAILURE;
     }
     
   //const CaloCell_ID* m_caloCID = m_caloDDM->getCaloCell_ID();
diff --git a/LArCalorimeter/LArCellRec/src/LArCellBuilderFromLArHitTool.cxx b/LArCalorimeter/LArCellRec/src/LArCellBuilderFromLArHitTool.cxx
index 393931cfb23879dac5c21f5729201a037cb5ce2a..3a614c0327a8c45fddd43ad8be5fbae860b24ac6 100755
--- a/LArCalorimeter/LArCellRec/src/LArCellBuilderFromLArHitTool.cxx
+++ b/LArCalorimeter/LArCellRec/src/LArCellBuilderFromLArHitTool.cxx
@@ -663,11 +663,6 @@ StatusCode LArCellBuilderFromLArHitTool::initializeCellPermamentCollection()
 {
   m_cellPermanentCollection.clear();
    
-
-  std::vector <CaloDetDescrElement*>::const_iterator itrDDE, itrEndDDE;
-  itrDDE=m_calo_dd_man->element_begin (m_caloNum);
-  itrEndDDE=m_calo_dd_man->element_end (m_caloNum);
-
   //resize to correct size and rest to zero
   IdentifierHash caloCellMin, caloCellMax ;
   m_caloCID->calo_cell_hash_range(m_caloNum,caloCellMin,caloCellMax);
@@ -679,11 +674,11 @@ StatusCode LArCellBuilderFromLArHitTool::initializeCellPermamentCollection()
   
   long nHole =0 ;
   long nFilled =0 ;
-  
-  for (; itrDDE!=itrEndDDE;++itrDDE){
-    ++index;
 
-    CaloDetDescrElement* caloDDE = (*itrDDE);
+  for (const CaloDetDescrElement* caloDDE :
+         m_calo_dd_man->element_range (m_caloNum))
+  {
+    ++index;
     
     //check if no hole
     if (caloDDE==0) {
diff --git a/LArCalorimeter/LArCnv/LArByteStream/src/LArCalibDigitContByteStreamCnv.cxx b/LArCalorimeter/LArCnv/LArByteStream/src/LArCalibDigitContByteStreamCnv.cxx
index dd5f7825dbf65cb9fa665ddfa9cca4edb785f5c7..66acbb8abdaebff4c9fa6e919085a2dc0cf5c453 100644
--- a/LArCalorimeter/LArCnv/LArByteStream/src/LArCalibDigitContByteStreamCnv.cxx
+++ b/LArCalorimeter/LArCnv/LArByteStream/src/LArCalibDigitContByteStreamCnv.cxx
@@ -170,11 +170,7 @@ LArCalibDigitContByteStreamCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAd
 
 
   LArCalibDigitContainer* CalibDigitContainer=0;
-  sc=m_storeGate->fromStorable(pObj, CalibDigitContainer ); 
-  if (sc==StatusCode::FAILURE)
-    {(*m_log) << MSG::ERROR << "StoreGateSvc::fromStorable failed!" << endmsg;
-     return sc;
-    }
+  ATH_CHECK( m_storeGate->fromStorable(pObj, CalibDigitContainer) );
   if(!CalibDigitContainer){
      (*m_log) << MSG::ERROR << "Cannot get LArCalibDigitContainer for DataObject. Key=" << pObj->registry()->name() << endmsg ;
      return StatusCode::FAILURE;    
diff --git a/LArCalorimeter/LArCnv/LArByteStream/src/LArDigitContByteStreamCnv.cxx b/LArCalorimeter/LArCnv/LArByteStream/src/LArDigitContByteStreamCnv.cxx
index 40e0815a0df72439a567c643f3ab5c6d5a20ebeb..367b98ea9c5547485b24e5e3353b61fb14c733fe 100644
--- a/LArCalorimeter/LArCnv/LArByteStream/src/LArDigitContByteStreamCnv.cxx
+++ b/LArCalorimeter/LArCnv/LArByteStream/src/LArDigitContByteStreamCnv.cxx
@@ -175,11 +175,7 @@ LArDigitContByteStreamCnv::createRep(DataObject* pObj, IOpaqueAddress*& pAddr)
   }
   
   LArDigitContainer* DigitContainer=0;
-  sc=m_storeGate->fromStorable(pObj, DigitContainer ); 
-  if (sc==StatusCode::FAILURE)
-    {(*m_log) << MSG::ERROR << "StoreGateSvc::fromStorable failed!" << endmsg;
-     return sc;
-    }
+  ATH_CHECK( m_storeGate->fromStorable(pObj, DigitContainer) );
   if(!DigitContainer){
      (*m_log) << MSG::ERROR << "Cannot get LArDigitContainer for DataObject. Key=" << pObj->registry()->name() << endmsg ;
      return StatusCode::FAILURE;    
diff --git a/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataContByteStreamTool.cxx b/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataContByteStreamTool.cxx
index 1bdb66ac67bad78ba14c3b62bfe2d6d72c9e17dd..3bfc7d2221d041f599602fa3772fc2b0bbced82d 100644
--- a/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataContByteStreamTool.cxx
+++ b/LArCalorimeter/LArCnv/LArByteStream/src/LArRawDataContByteStreamTool.cxx
@@ -134,7 +134,7 @@ StatusCode LArRawDataContByteStreamTool::WriteLArDigits(const LArDigitContainer*
  if (!m_initializeForWriting) {
    ATH_MSG_ERROR ( "Tool not setup for writing! Use property " 
                    << name()<<".InitializeForWriting" );
-   return false;
+   return StatusCode::FAILURE;
  }
  ATH_MSG_DEBUG ( "Writing LArDigitContainer to ByteStream" );
  if (!digitCont) {
@@ -214,7 +214,7 @@ StatusCode LArRawDataContByteStreamTool::WriteLArCalibDigits(const LArCalibDigit
  if (!m_initializeForWriting) {
    ATH_MSG_ERROR ( "Tool not setup for writing! Use property " 
                    << name()<<".InitializeForWriting" );
-   return false;
+   return StatusCode::FAILURE;
  }
  ATH_MSG_DEBUG ( "Writing LArCalibDigitContainer to ByteStream" );
  if (!digitCont) {
@@ -277,7 +277,7 @@ StatusCode LArRawDataContByteStreamTool::WriteLArRawChannels(const LArRawChannel
  if (!m_initializeForWriting) {
    ATH_MSG_ERROR ( "Tool not setup for writing! Use property " 
                    << name()<<".InitializeForWriting" );
-   return false;
+   return StatusCode::FAILURE;
  }
  if (!channelCont) {
    ATH_MSG_DEBUG ( "Null pointer passed to WriteLArCalibDigit routine!" );
diff --git a/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorTool/src/AlignmentErrorTool.cxx b/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorTool/src/AlignmentErrorTool.cxx
index 45a9df49698a6d5da89246cf71af9a6be2c63a40..6cdd44805da5b7dd324bc5d657f41d0e6452899d 100644
--- a/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorTool/src/AlignmentErrorTool.cxx
+++ b/MuonSpectrometer/MuonAlignment/MuonAlignError/MuonAlignErrorTool/src/AlignmentErrorTool.cxx
@@ -61,6 +61,7 @@ StatusCode AlignmentErrorTool::initialize() {
   ATH_MSG_INFO("*****************************************");
   ATH_MSG_INFO("AlignmentErrorTool::initialize()");
 
+  ATH_CHECK( m_idTool.retrieve() );
   ATH_CHECK( m_idHelper.retrieve() );
 
   // MAP DEVIATION INITIALIZATION
diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/CMakeLists.txt
index 92dea9673f37443da6102405138ba3037200c426..4a752c7a9e4695e5518ed4e5aad044af80d28a69 100644
--- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/CMakeLists.txt
+++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/CMakeLists.txt
@@ -15,10 +15,9 @@ atlas_depends_on_subdirs( PUBLIC
                           MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment
                           PRIVATE
                           AtlasTest/TestTools
-                          Control/CLIDSvc
+                          Control/AthenaKernel
                           Control/AthAllocators
                           Control/AthContainers
-                          Control/SGTools
                           Control/StoreGate
                           Database/AthenaPOOL/AthenaPoolCnvSvc
                           DetectorDescription/Identifier
@@ -45,7 +44,7 @@ atlas_add_poolcnv_library( MuonEventAthenaPoolPoolCnv
                            FILES MuonSimData/MuonSimDataCollection.h MuonSimData/CscSimDataCollection.h MuonRDO/MdtCsmContainer.h MuonRDO/RpcPadContainer.h MuonRDO/TgcRdoContainer.h MuonRDO/CscRawDataContainer.h MuonRDO/RpcSectorLogicContainer.h MuonRDO/STGC_RawDataContainer.h MuonRDO/MM_RawDataContainer.h MuonDigitContainer/MdtDigitContainer.h MuonDigitContainer/RpcDigitContainer.h MuonDigitContainer/TgcDigitContainer.h MuonDigitContainer/CscDigitContainer.h MuonDigitContainer/MmDigitContainer.h MuonDigitContainer/sTgcDigitContainer.h CscCalibEvent/CscCalibDataContainer.h MuonPrepRawData/CscPrepDataContainer.h MuonPrepRawData/CscStripPrepDataContainer.h MuonPrepRawData/RpcPrepDataContainer.h MuonPrepRawData/TgcPrepDataContainer.h MuonPrepRawData/MdtPrepDataContainer.h MuonPrepRawData/MMPrepDataContainer.h MuonPrepRawData/sTgcPrepDataContainer.h MuonTrigCoinData/TgcCoinDataContainer.h MuonTrigCoinData/RpcCoinDataContainer.h MuonChamberT0s/ChamberT0s.h src/MuonMeasurements.h
                            TYPES_WITH_NAMESPACE Muon::STGC_RawDataContainer Muon::MM_RawDataContainer Muon::CscPrepDataContainer Muon::CscStripPrepRawDataContainer Muon::RpcPrepDataContainer Muon::TgcPrepDataContainer Muon::MdtPrepDataContainer Muon::MMPrepDataContainer Muon::sTgcPrepDataContainer Muon::TgcCoinDataContainer Muon::ChamberT0s TPCnv::MuonMeasurements
                            INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-                           LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaPoolUtilities AtlasSealCLHEP MuonRDO MuonRIO_OnTrack MuonSegment AthAllocators AthContainers SGTools StoreGateLib SGtests AthenaPoolCnvSvcLib Identifier GaudiKernel RPCcablingInterfaceLib CscCalibEvent MuonEventTPCnv MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonChamberT0s MuonPrepRawData MuonTrigCoinData MuonSimData )
+                           LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaPoolUtilities AtlasSealCLHEP MuonRDO MuonRIO_OnTrack MuonSegment AthAllocators AthContainers AthenaKernel StoreGateLib SGtests AthenaPoolCnvSvcLib Identifier GaudiKernel RPCcablingInterfaceLib CscCalibEvent MuonEventTPCnv MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonChamberT0s MuonPrepRawData MuonTrigCoinData MuonSimData )
 
 # We need to build a separate library for unit testing, since we can't link
 # against the PoolCnv library.
@@ -54,13 +53,13 @@ atlas_add_library( MuonEventAthenaPoolTestLib
                    src/CreateTransientTemplates.cxx
                    NO_PUBLIC_HEADERS
                    INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaPoolUtilities AtlasSealCLHEP MuonRDO MuonRIO_OnTrack MuonSegment AthAllocators AthContainers SGTools StoreGateLib SGtests AthenaPoolCnvSvcLib Identifier GaudiKernel RPCcablingInterfaceLib CscCalibEvent MuonEventTPCnv MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonChamberT0s MuonPrepRawData MuonTrigCoinData MuonSimData )
+                   LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaPoolUtilities AtlasSealCLHEP MuonRDO MuonRIO_OnTrack MuonSegment AthAllocators AthContainers AthenaKernel StoreGateLib SGtests AthenaPoolCnvSvcLib Identifier GaudiKernel RPCcablingInterfaceLib CscCalibEvent MuonEventTPCnv MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonChamberT0s MuonPrepRawData MuonTrigCoinData MuonSimData )
 
 atlas_add_dictionary( MuonRDOCnvDict
                       MuonEventAthenaPool/MuonRDOCnvDict.h
                       MuonEventAthenaPool/selection.xml
                       INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaPoolUtilities AtlasSealCLHEP MuonRDO MuonRIO_OnTrack MuonSegment AthAllocators AthContainers SGTools StoreGateLib SGtests AthenaPoolCnvSvcLib Identifier GaudiKernel RPCcablingInterfaceLib CscCalibEvent MuonEventTPCnv MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonChamberT0s MuonPrepRawData MuonTrigCoinData MuonSimData )
+                      LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaPoolUtilities AtlasSealCLHEP MuonRDO MuonRIO_OnTrack MuonSegment AthAllocators AthContainers AthenaKernel StoreGateLib SGtests AthenaPoolCnvSvcLib Identifier GaudiKernel RPCcablingInterfaceLib CscCalibEvent MuonEventTPCnv MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonChamberT0s MuonPrepRawData MuonTrigCoinData MuonSimData )
 
 # Install files from the package:
 atlas_install_headers( MuonEventAthenaPool )
@@ -115,7 +114,7 @@ foreach( name
 
    atlas_add_test( ${name}
       SOURCES test/${name}.cxx
-      LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaPoolUtilities AtlasSealCLHEP MuonRDO MuonRIO_OnTrack MuonSegment AthAllocators AthContainers SGTools StoreGateLib SGtests AthenaPoolCnvSvcLib Identifier GaudiKernel RPCcablingInterfaceLib CscCalibEvent MuonEventTPCnv MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonChamberT0s MuonPrepRawData MuonTrigCoinData MuonSimData MuonEventAthenaPoolTestLib IdDictParser
+      LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthenaPoolUtilities AtlasSealCLHEP MuonRDO MuonRIO_OnTrack MuonSegment AthAllocators AthContainers AthenaKernel StoreGateLib SGtests AthenaPoolCnvSvcLib Identifier GaudiKernel RPCcablingInterfaceLib CscCalibEvent MuonEventTPCnv MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonChamberT0s MuonPrepRawData MuonTrigCoinData MuonSimData MuonEventAthenaPoolTestLib IdDictParser
       PROPERTIES TIMEOUT 300
       ENVIRONMENT "JOBOPTSEARCHPATH=${_jobOPath}" )
 
diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MuonMeasurements.h b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MuonMeasurements.h
index be0b9cc3f8dcbb41bb8fcd27b8385fbe4b7b2f5f..3c06c147fe1f3b29a126d2c0fb7745693c7d0ed5 100644
--- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MuonMeasurements.h
+++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MuonMeasurements.h
@@ -5,7 +5,7 @@
 #ifndef TPCNV_MUONMEASUREMENTS_H
 #define TPCNV_MUONMEASUREMENTS_H 
  
-#include "CLIDSvc/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
  
 namespace TPCnv {
 /** 'Dummy' class to produce convertor for MuonMeasurements_tlp 
diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MuonMeasurementsCnv.cxx b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MuonMeasurementsCnv.cxx
index 21a39e6ad5611c712416c6de7ba3c163e5eb13b4..9d8a98518d51102d2753b8bc2064d9f3705cc066 100644
--- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MuonMeasurementsCnv.cxx
+++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MuonMeasurementsCnv.cxx
@@ -6,7 +6,6 @@
 
 #include "MuonMeasurementsCnv.h"
 
-#include <iostream>
 #include <stdexcept>
 
 MuonMeasurementsCnv::MuonMeasurementsCnv(ISvcLocator* svcloc):
@@ -15,21 +14,11 @@ MuonMeasurementsCnv::MuonMeasurementsCnv(ISvcLocator* svcloc):
 }
 
 
-StatusCode MuonMeasurementsCnv::initialize()
-{
-   if( !MuonMeasurementsCnvBase::initialize().isSuccess() )
-      return StatusCode::FAILURE;
-   return StatusCode::SUCCESS;
-}
-
-
-// this method just reads the persistent object - no TP conversion here
 void 
 MuonMeasurementsCnv::readObjectFromPool( const std::string& token )
 {
   static pool::Guid p1_guid( "C4979DA5-4193-410B-9476-A51708C01CF7" );
   static pool::Guid p2_guid( "87FC613F-390A-4AB0-9BBF-28CE788867D5" );
-  static pool::Guid p3_guid( "5C8C4552-9F05-11E3-8164-6C3BE51AB9F1" );
 
    // set the POOL token which will be used for reading from POOL
    setToken( token );
@@ -37,11 +26,8 @@ MuonMeasurementsCnv::readObjectFromPool( const std::string& token )
    // select the object type based on its GUID 
    if( compareClassGuid( p2_guid ) )     {
       // read MuonMeasurements_PERS object from POOL using given TLP converter
-      poolReadObject< MuonMeasurements_PERS >( m_TPConverter );
-    }else if( compareClassGuid( p2_guid ) )     {
-      // read MuonMeasurements_PERS object from POOL using given TLP converter
-      poolReadObject< MuonMeasurements_PERS >( m_TPConverter_p2 );
-    }else   if( compareClassGuid( p1_guid ) )    {
+      poolReadObject< TPCnv::MuonMeasurements_tlp2 >( m_TPConverter_p2 );
+   }else  if( compareClassGuid( p1_guid ) )    {
       poolReadObject< TPCnv::MuonMeasurements_tlp1 >( m_TPConverter_p1 );   }
    else
       throw std::runtime_error( "Unsupported version of MuonMeasurements_PERS (unknown GUID)" );
diff --git a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MuonMeasurementsCnv.h b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MuonMeasurementsCnv.h
index 3bea2b677c6e09b1d5c5d5474a2506225734111c..395eb9492ebad2045c93b34af78822ee5b5ad568 100644
--- a/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MuonMeasurementsCnv.h
+++ b/MuonSpectrometer/MuonCnv/MuonEventAthenaPool/src/MuonMeasurementsCnv.h
@@ -8,7 +8,6 @@
 
 #include "AthenaPoolCnvSvc/T_AthenaPoolExtendingCnv.h"
 
-#include "MuonEventTPCnv/MuonMeasurementsCnv_tlp3.h"
 #include "MuonEventTPCnv/MuonMeasurementsCnv_tlp2.h"
 #include "MuonEventTPCnv/MuonMeasurementsCnv_tlp1.h"
 
@@ -31,16 +30,13 @@ class MuonMeasurementsCnv : public MuonMeasurementsCnvBase
 protected:
   MuonMeasurementsCnv( ISvcLocator *svcloc );
 
-  virtual StatusCode initialize();
-
-  virtual AthenaPoolTopLevelTPCnvBase*  getTopLevelTPCnv() { return &m_TPConverter; }
+  virtual AthenaPoolTopLevelTPCnvBase*  getTopLevelTPCnv() { return &m_TPConverter_p2; }
 
   virtual void          readObjectFromPool( const std::string& );
 
   virtual AthenaPoolCnvTPExtension*  clone() { return new MuonMeasurementsCnv(0); }
   
 private:  
-  MuonMeasurementsCnv_tlp3            m_TPConverter;
   MuonMeasurementsCnv_tlp2            m_TPConverter_p2;
   MuonMeasurementsCnv_tlp1            m_TPConverter_p1;
 };
diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonEventTPCnvDict.h b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonEventTPCnvDict.h
index c15dfb05ba037541fbe9b0e8189b0aa7fd6c5d93..8dfa6bc6454a811991266a0496b91b49783feaed 100755
--- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonEventTPCnvDict.h
+++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonEventTPCnvDict.h
@@ -11,7 +11,7 @@
 //
 //-----------------------------------------------------------------------------
 
-#include "MuonEventTPCnv/MuonMeasurements_tlp3.h"
+#include "MuonEventTPCnv/MuonMeasurements_tlp2.h"
 
 #include "MuonEventTPCnv/CscStripPrepDataContainer_tlp1.h"
 
@@ -39,45 +39,4 @@
 #include "MuonEventTPCnv/MuonDigitContainer/CscSimDataCollection_p2.h"
 #include "MuonEventTPCnv/MuonRDO/STGC_RawDataContainer_p1.h"
 
-struct MuonEventTPCnvDict 
-{
-    std::vector< Muon::CscPrepData_p2>              m_v1;
-    std::vector< Muon::CscStripPrepData_p1>         m_v2;
-    std::vector< Muon::RpcPrepData_p3>              m_v3;
-    std::vector< Muon::TgcPrepData_p2 >             m_v4;
-    std::vector< Muon::TgcPrepData_p3 >             m_v4a;
-    std::vector< Muon::MdtPrepData_p2 >             m_v5;
-    std::vector< Muon::MuonPRD_Collection_p2 >      m_v6;
-    std::vector< Muon::MdtPrepDataContainer_p2 >    m_v7a;
-    std::vector< Muon::RpcPrepDataContainer_p3 >    m_v7b;
-    std::vector< Muon::CscPrepDataContainer_p2 >    m_v7c;
-    std::vector< Muon::TgcPrepDataContainer_p2 >    m_v7d;
-    std::vector< Muon::TgcPrepDataContainer_p3 >    m_v7e;
-    std::vector< Muon::MuonSegment_p1>              m_v8;    
-    std::vector< Muon::MuonSegmentQuality_p1>       m_v9;
-    std::vector< Muon::CompetingMuonClustersOnTrack_p1> m_v10;
-    std::vector< Muon::MuonCoinDataCollection_p1 >      m_v11;
-    std::vector< Muon::MuonCoinDataContainer_p1 >       m_v12;
-    std::vector< Muon::TgcCoinData_p2>              m_v13a;
-    std::vector< Muon::TgcCoinData_p3>              m_v13b;
-    Muon::MuonPRD_Container_p2<Muon::MdtPrepData_p2>      m_v14;
-    Muon::MuonPRD_Container_p2<Muon::RpcPrepData_p3>      m_v14a;
-    Muon::MuonPRD_Container_p2<Muon::CscPrepData_p2>      m_v14b;
-    Muon::MuonPRD_Container_p2<Muon::TgcPrepData_p2>      m_v14c;
-    Muon::MuonPRD_Container_p2<Muon::TgcPrepData_p3>      m_v14d;
-    std::vector<Muon::MuonPRD_Container_p2<Muon::MdtPrepData_p2> > m_v15;
-    std::vector< Muon::MdtTwinPrepData_p1 >             m_v16;
-    std::vector< Muon::RpcCoinData_p1 >             m_v17;
-    Muon::MuonPRD_Container_p2<Muon::RpcCoinData_p1>             m_v18;
-    std::pair< unsigned int, float> m_v19;
-    Muon::MuonPRD_Container_p2<Muon::sTgcPrepData_p1>      m_v20;
-    Muon::MuonPRD_Container_p2<Muon::MMPrepData_p1>      m_v21;
-    Muon::MuonDigitContainer_p1<Muon::MM_Digit_p1>      m_v22;
-    Muon::MuonDigitContainer_p1<Muon::STGC_Digit_p1>      m_v23;
-    Muon::MuonDigitContainer_p2<Muon::MM_Digit_p2>      m_v24;
-    Muon::STGC_RawDataContainer_p1      m_v25;
-    Muon::STGC_RawDataCollection_p1 m_v26;
-    std::vector< Muon::STGC_RawData_p1 > m_v27;
-};
-
 #endif // MUONEVENTTPCNV_MUONEVENTTPCNVDICT_H
diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonMeasurementsCnv_tlp2.h b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonMeasurementsCnv_tlp2.h
index bfca256b7a0c8d0c7c365e53c64ed2d072331cb7..749da8ae55532fba6075770de8ff24578a00e65a 100644
--- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonMeasurementsCnv_tlp2.h
+++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonMeasurementsCnv_tlp2.h
@@ -12,11 +12,9 @@
 #include "MuonEventTPCnv/MuonRIO_OnTrack/MdtDriftCircleOnTrackCnv_p2.h"
 #include "MuonEventTPCnv/MuonRIO_OnTrack/MM_ClusterOnTrackCnv_p1.h"
 #include "MuonEventTPCnv/MuonRIO_OnTrack/STGC_ClusterOnTrackCnv_p1.h"
-#include "MuonEventTPCnv/MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrackCnv_p1.h"
-
-#include "MuonEventTPCnv/MuonSegment/MuonSegmentCnv_p1.h"
+#include "MuonEventTPCnv/MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrackCnv_p2.h"
+#include "MuonEventTPCnv/MuonSegment/MuonSegmentCnv_p2.h"
 #include "MuonEventTPCnv/MuonSegment/MuonSegmentQualityCnv_p1.h"
-#include <iostream>
 
 class MuonMeasurementsCnv_tlp2
    : public AthenaPoolTopLevelExtTPConverter< TPCnv::MuonMeasurements_tlp2 >
@@ -35,12 +33,13 @@ protected:
     RpcClusterOnTrackCnv_p3         m_rpcClustersOTCnv;
     TgcClusterOnTrackCnv_p2         m_tgcClustersOTCnv;
     MdtDriftCircleOnTrackCnv_p2     m_mdtDriftCirclesOTCnv;
-    MuonSegmentCnv_p1               m_muonSegmentsCnv;
+    MuonSegmentCnv_p2               m_muonSegmentsCnv;
     MuonSegmentQualityCnv_p1        m_muonSegmentQualitiesCnv;
-    CompetingMuonClustersOnTrackCnv_p1  m_muonCompetingROTsCnv;
+    CompetingMuonClustersOnTrackCnv_p2  m_muonCompetingROTsCnv;
     MM_ClusterOnTrackCnv_p1         m_mmClustersOTCnv;
     STGC_ClusterOnTrackCnv_p1       m_stgcClustersOTCnv;
 };
 #endif
 
 
+
diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonMeasurementsCnv_tlp3.h b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonMeasurementsCnv_tlp3.h
deleted file mode 100644
index 45be1e19b36275f38a22aecd502df9bc82658993..0000000000000000000000000000000000000000
--- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonMeasurementsCnv_tlp3.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef MUONMEASUREMENTSCNV_TLP3_H
-#define MUONMEASUREMENTSCNV_TLP3_H
-#include "AthenaPoolCnvSvc/AthenaPoolTopLevelExtTPConverter.h"
-#include "MuonMeasurements_tlp3.h"
-#include "MuonEventTPCnv/MuonRIO_OnTrack/CscClusterOnTrackCnv_p2.h"
-#include "MuonEventTPCnv/MuonRIO_OnTrack/RpcClusterOnTrackCnv_p3.h"
-#include "MuonEventTPCnv/MuonRIO_OnTrack/TgcClusterOnTrackCnv_p2.h"
-#include "MuonEventTPCnv/MuonRIO_OnTrack/MdtDriftCircleOnTrackCnv_p2.h"
-#include "MuonEventTPCnv/MuonRIO_OnTrack/MM_ClusterOnTrackCnv_p1.h"
-#include "MuonEventTPCnv/MuonRIO_OnTrack/STGC_ClusterOnTrackCnv_p1.h"
-#include "MuonEventTPCnv/MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrackCnv_p2.h"
-
-#include "MuonEventTPCnv/MuonSegment/MuonSegmentCnv_p2.h"
-#include "MuonEventTPCnv/MuonSegment/MuonSegmentQualityCnv_p1.h"
-#include <iostream>
-
-/// Perhaps confusingly this convertor is still handling MuonMeasurements_tlp2 ... but since that didn't need to change
-/// it seemed stupid to inflate the dictionary sizes. EJWM
-class MuonMeasurementsCnv_tlp3
-   : public AthenaPoolTopLevelExtTPConverter< TPCnv::MuonMeasurements_tlp3 >
-{
-public:
-
-  MuonMeasurementsCnv_tlp3();
-  virtual ~MuonMeasurementsCnv_tlp3() {}
-
-  virtual unsigned short            getConverterID() { return 2; } // This is the number of the extending convertor (i.e. ID version is 1)
-  
-  virtual void                      setPStorage( TPCnv::MuonMeasurements_tlp3 *storage );
-
-protected:
-    CscClusterOnTrackCnv_p2         m_cscClustersOTCnv;
-    RpcClusterOnTrackCnv_p3         m_rpcClustersOTCnv;
-    TgcClusterOnTrackCnv_p2         m_tgcClustersOTCnv;
-    MdtDriftCircleOnTrackCnv_p2     m_mdtDriftCirclesOTCnv;
-    MuonSegmentCnv_p2               m_muonSegmentsCnv;
-    MuonSegmentQualityCnv_p1        m_muonSegmentQualitiesCnv;
-    CompetingMuonClustersOnTrackCnv_p2  m_muonCompetingROTsCnv;
-    MM_ClusterOnTrackCnv_p1         m_mmClustersOTCnv;
-    STGC_ClusterOnTrackCnv_p1       m_stgcClustersOTCnv;
-};
-#endif
-
-
diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonMeasurements_tlp2.h b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonMeasurements_tlp2.h
index 933c77e16e9ad9c1874313c6f41051134e7e0d41..09b510053a1085c94ce9f64f72dbb6e4b36a5589 100644
--- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonMeasurements_tlp2.h
+++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonMeasurements_tlp2.h
@@ -14,7 +14,7 @@
 #include "MuonEventTPCnv/MuonRIO_OnTrack/MdtDriftCircleOnTrack_p2.h"
 #include "MuonEventTPCnv/MuonRIO_OnTrack/MM_ClusterOnTrack_p1.h"
 #include "MuonEventTPCnv/MuonRIO_OnTrack/STGC_ClusterOnTrack_p1.h"
-#include "MuonEventTPCnv/MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrackCnv_p1.h"
+#include "MuonEventTPCnv/MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack_p1.h"
 #include <vector>
 
 // ------------
@@ -30,7 +30,7 @@ namespace TPCnv
     class MuonMeasurements_tlp2
     {
     public:
-      MuonMeasurements_tlp2() {}
+        MuonMeasurements_tlp2() {}
         std::vector< Muon::CscClusterOnTrack_p2 >           m_cscClustersOT;
         std::vector< Muon::RpcClusterOnTrack_p3 >           m_rpcClustersOT;
         std::vector< Muon::TgcClusterOnTrack_p2 >           m_tgcClustersOT;
diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonMeasurements_tlp3.h b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonMeasurements_tlp3.h
deleted file mode 100644
index 262aab717ea7687c4c6ef53c701cf0779a292a90..0000000000000000000000000000000000000000
--- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/MuonMeasurements_tlp3.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#ifndef TPCNV_MUONMEASUREMENTS_TLP3_H
-#define TPCNV_MUONMEASUREMENTS_TLP3_H
-
-//-----------------------------------------------------------------------------
-// MuonRIO_OnTrack
-//-----------------------------------------------------------------------------
-#include "MuonEventTPCnv/MuonRIO_OnTrack/CscClusterOnTrack_p2.h"
-#include "MuonEventTPCnv/MuonRIO_OnTrack/RpcClusterOnTrack_p3.h"
-#include "MuonEventTPCnv/MuonRIO_OnTrack/TgcClusterOnTrack_p2.h"
-#include "MuonEventTPCnv/MuonRIO_OnTrack/MdtDriftCircleOnTrack_p2.h"
-#include "MuonEventTPCnv/MuonRIO_OnTrack/MM_ClusterOnTrack_p1.h"
-#include "MuonEventTPCnv/MuonRIO_OnTrack/STGC_ClusterOnTrack_p1.h"
-#include "MuonEventTPCnv/MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrackCnv_p2.h"
-#include <vector>
-
-// ------------
-// Muon Segment
-// ------------
-
-#include "MuonEventTPCnv/MuonSegment/MuonSegment_p1.h"
-#include "MuonEventTPCnv/MuonSegment/MuonSegmentQuality_p1.h"
-
-namespace TPCnv
-{
-    /** This object contains the muon "extensions" for e.g. Trk::Track (Trk::RIO_OnTrack) and Trk::Segment. */
-    class MuonMeasurements_tlp3
-    {
-    public:
-        MuonMeasurements_tlp3() {}
-        std::vector< Muon::CscClusterOnTrack_p2 >           m_cscClustersOT;
-        std::vector< Muon::RpcClusterOnTrack_p3 >           m_rpcClustersOT;
-        std::vector< Muon::TgcClusterOnTrack_p2 >           m_tgcClustersOT;
-        std::vector< Muon::MdtDriftCircleOnTrack_p2 >       m_mdtDriftCirclesOT;        
-        std::vector< Muon::CompetingMuonClustersOnTrack_p1> m_muonCompetingROT;
-        std::vector< Muon::MuonSegment_p1>                  m_muonSegments;
-        std::vector< Muon::MuonSegmentQuality_p1>           m_muonSegmentQualities;
-        std::vector< Muon::MM_ClusterOnTrack_p1 >           m_mmClustersOT;
-        std::vector< Muon::STGC_ClusterOnTrack_p1 >         m_stgcClustersOT;
-    };
-}
-
-#endif
diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/OLD_MuonEventTPCnvDict.h b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/OLD_MuonEventTPCnvDict.h
index a9621d4e05131620db943493a96234aa33dce00e..4a50a70c6471b1484919233733faed200d0191b2 100755
--- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/OLD_MuonEventTPCnvDict.h
+++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/OLD_MuonEventTPCnvDict.h
@@ -12,7 +12,6 @@
 //-----------------------------------------------------------------------------
 
 #include "MuonEventTPCnv/MuonMeasurements_tlp1.h"
-#include "MuonEventTPCnv/MuonMeasurements_tlp2.h"
 
 #include "MuonEventTPCnv/CscPrepDataContainer_tlp1.h"
 #include "MuonEventTPCnv/CscStripPrepDataContainer_tlp1.h"
@@ -40,18 +39,4 @@
 #include "MuonEventTPCnv/MuonPrepRawData/MdtTwinPrepData_p1.h"
 #include "MuonEventTPCnv/MuonChamberT0s/ChamberT0s_p1.h"
 
-struct OLD_MuonEventTPCnvDict 
-{
-    std::vector< Muon::CscPrepData_p1>              m_v1;
-    std::vector< Muon::RpcPrepData_p1>              m_v3;
-    std::vector< Muon::TgcPrepData_p1 >             m_v4;
-    std::vector< Muon::MdtPrepData_p1 >             m_v5;
-    std::vector< Muon::MdtPrepData_p2 >             m_v5a;
-    std::vector< Muon::MuonPRD_Collection_p1 >      m_v6;
-    std::vector< Muon::MuonPRD_Container_p1 >       m_v7;
-    std::vector< Muon::TgcCoinData_p1>              m_v13;
-    std::vector<Muon::RpcClusterOnTrack_p2>         m_v14;
-    std::vector<Muon::MuonPRD_Collection_p1>        m_v15;
-};
-
 #endif // MUONEVENTTPCNV_OLD_MUONEVENTTPCNVDICT_H
diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/OLD_selection.xml b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/OLD_selection.xml
index e856eda3de3bd5304a77e4f914463a8b4e6c77ed..18c56ac02bb85f6eefbb6982bdcad0755848d2cf 100755
--- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/OLD_selection.xml
+++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/OLD_selection.xml
@@ -1,7 +1,6 @@
 <lcgdict>
 
     <class name="TPCnv::MuonMeasurements_tlp1" id="C4979DA5-4193-410B-9476-A51708C01CF7" />  
-    <class name="TPCnv::MuonMeasurements_tlp2" id="87FC613F-390A-4AB0-9BBF-28CE788867D5" />  
    
     <class name="Muon::TgcCoinData_p1" />
     <class name="std::vector<Muon::TgcCoinData_p1>" />
diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/selection.xml b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/selection.xml
index c474ab03f5223dfa0d4d2c9e745085b52dc30083..64a966ad1e71cda88f2795dd48bf3fa17a97ace3 100755
--- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/selection.xml
+++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/MuonEventTPCnv/selection.xml
@@ -2,7 +2,7 @@
 
  <!-- MN: NOTE - do not select both typedef and the original class here! -->
 
-  <class name="TPCnv::MuonMeasurements_tlp3" id="5C8C4552-9F05-11E3-8164-6C3BE51AB9F1" />  
+    <class name="TPCnv::MuonMeasurements_tlp2" id="87FC613F-390A-4AB0-9BBF-28CE788867D5" />  
 
     <!-- MuonRIO_OnTrack -->
     <class name="Muon::CscClusterOnTrack_p2" />
diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonMeasurementsCnv_tlp3.cxx b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonMeasurementsCnv_tlp3.cxx
deleted file mode 100644
index 997d97b7947f37ff33b1c500a258fa2f6248ba34..0000000000000000000000000000000000000000
--- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/src/MuonMeasurementsCnv_tlp3.cxx
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-#include "MuonEventTPCnv/MuonMeasurementsCnv_tlp3.h"
-
-MuonMeasurementsCnv_tlp3::MuonMeasurementsCnv_tlp3()
-{  
-   // // Add all converters defined in this top level converter:
-   // // never change the order of adding converters!  
-   addTPConverter( &m_cscClustersOTCnv );   
-   addTPConverter( &m_rpcClustersOTCnv );     
-   addTPConverter( &m_tgcClustersOTCnv );     
-   addTPConverter( &m_mdtDriftCirclesOTCnv );
-   addTPConverter( &m_muonSegmentsCnv );  
-   addTPConverter( &m_muonSegmentQualitiesCnv );
-   addTPConverter( &m_muonCompetingROTsCnv );
-   addTPConverter( &m_mmClustersOTCnv );
-   addTPConverter( &m_stgcClustersOTCnv );
-}
-
-void MuonMeasurementsCnv_tlp3::setPStorage( TPCnv::MuonMeasurements_tlp3 *storage )
-{
-   m_cscClustersOTCnv.       setPStorage( &storage->m_cscClustersOT  );
-   m_rpcClustersOTCnv.       setPStorage( &storage->m_rpcClustersOT );
-   m_tgcClustersOTCnv.       setPStorage( &storage->m_tgcClustersOT );
-   m_mdtDriftCirclesOTCnv.   setPStorage( &storage->m_mdtDriftCirclesOT );
-   m_muonSegmentsCnv.        setPStorage( &storage->m_muonSegments );   
-   m_muonSegmentQualitiesCnv.setPStorage( &storage->m_muonSegmentQualities );  
-   m_muonCompetingROTsCnv.   setPStorage( &storage->m_muonCompetingROT ); 
-   m_mmClustersOTCnv.        setPStorage( &storage->m_mmClustersOT ); 
-   m_stgcClustersOTCnv.      setPStorage( &storage->m_stgcClustersOT ); 
-}   
- 
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDD/src/MuonAGDDTool.cxx b/MuonSpectrometer/MuonDetDescr/MuonAGDD/src/MuonAGDDTool.cxx
index b2906ee8090caf59585478e6e955819275d4f97d..7eaca0729d8512cc6063f4cf214879adc5fff00d 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDD/src/MuonAGDDTool.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDD/src/MuonAGDDTool.cxx
@@ -45,7 +45,7 @@ StatusCode MuonAGDDTool::construct()
 {
 	MuonAGDDToolHelper theHelper;
 		
-	controller->UseGeoModelDetector("Muon");
+	m_controller->UseGeoModelDetector("Muon");
 	
 	if (!m_locked)
 	{
@@ -58,10 +58,10 @@ StatusCode MuonAGDDTool::construct()
 	if (!m_readAGDD)
 	{
 		ATH_MSG_INFO(" trying to parse files ");
-		controller->ParseFiles();
+		m_controller->ParseFiles();
 		
-		controller->BuildAll();
-		controller->Clean();
+		m_controller->BuildAll();
+		m_controller->Clean();
 
 		return StatusCode::SUCCESS;
 	}
@@ -70,12 +70,12 @@ StatusCode MuonAGDDTool::construct()
 	
 	std::string AGDDfile=theHelper.GetAGDD(m_dumpAGDD);
 	
-	controller->ParseString(AGDDfile);
+	m_controller->ParseString(AGDDfile);
 	
 	if (m_printSections)
 	{	
 		ATH_MSG_INFO("\t Printing all sections");
-		controller->PrintSections();
+		m_controller->PrintSections();
 	}
 	
 	
@@ -84,10 +84,10 @@ StatusCode MuonAGDDTool::construct()
 	{
 		ATH_MSG_INFO("\t\t----- "<<m_structuresFromFlags[i]<<" "<<ALIAS(m_structuresFromFlags[i]));
 		if (!m_buildNSW && m_structuresFromFlags[i]=="NewSmallWheel") continue;
-		controller->GetBuilder()->BuildFromVolume(m_structuresFromFlags[i]);
+		m_controller->GetBuilder()->BuildFromVolume(m_structuresFromFlags[i]);
 	}
 
-	controller->Clean();
+	m_controller->Clean();
 
 	return StatusCode::SUCCESS;
 }
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDD/src/NSWAGDDTool.cxx b/MuonSpectrometer/MuonDetDescr/MuonAGDD/src/NSWAGDDTool.cxx
index c4052d37ae8954ec31d89fe6ddcd784d94b828d4..dc3004c707b488f816224b4907b7d105bdcc2764 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDD/src/NSWAGDDTool.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDD/src/NSWAGDDTool.cxx
@@ -52,17 +52,17 @@ StatusCode NSWAGDDTool::construct()
 	ATH_MSG_INFO(" Name = "<<name());
 	
 	ATH_MSG_INFO(" trying to parse files ");
-	controller->ParseFiles();
+	m_controller->ParseFiles();
 	
 	if (m_printSections) 
 	{
 		ATH_MSG_INFO("\t Printing all sections ");
-		controller->PrintSections();
+		m_controller->PrintSections();
 	}
 	
-	controller->UseGeoModelDetector("Muon");
+	m_controller->UseGeoModelDetector("Muon");
 	
-	controller->BuildAll();
+	m_controller->BuildAll();
 	
 	// part needed to build the NSW RO geometry
 	
@@ -71,7 +71,7 @@ StatusCode NSWAGDDTool::construct()
 	bool testRet=theHelper.BuildMScomponents();
 	if (!testRet) ATH_MSG_ERROR("something went wrong building the RO geometry!!! ");
 	
-	controller->Clean();
+	m_controller->Clean();
 	
 	return StatusCode::SUCCESS;
 }
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMicromegas.cxx b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMicromegas.cxx
index 34c8e3d8e2df4f937116a385bbad217e77191839..90c1deab53cfa52d08a9d7eb1cc607ed563b6969 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMicromegas.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDMicromegas.cxx
@@ -29,7 +29,7 @@ using MuonGM::MYSQL;
 AGDDMicromegas::AGDDMicromegas(std::string s): 
 	MMDetectorDescription(s),AGDDVolume(s,true)
 {
-	current=this;
+	s_current=this;
 	Register();
 }
 
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDsTGC.cxx b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDsTGC.cxx
index 38b796f1f43861a9693aeb393f4d8a0b21b0f6f7..3769abf6ebb0b42cc65c9c294ef48c498557e24a 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDsTGC.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDBase/src/AGDDsTGC.cxx
@@ -33,7 +33,7 @@ using MuonGM::MYSQL;
 AGDDsTGC::AGDDsTGC(std::string s):
     sTGCDetectorDescription(s),AGDDVolume(s,true)
 {
-    current=this;
+    s_current=this;
     Register();
 }
 
@@ -51,7 +51,7 @@ void AGDDsTGC::CreateVolume()
 	stgc_comp->dx2=large_x();
 	stgc_comp->dy=y();
 	stgc_comp->subType=subType();
-	stgc_comp->yCutout=_yCutout;
+	stgc_comp->yCutout=yCutout();
 	
 	MuonGM::sTGC *cham=new MuonGM::sTGC(stgc_comp);
 	GeoPhysVol *vvv=(GeoPhysVol*)cham->build(1);
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/MMDetectorDescription.h b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/MMDetectorDescription.h
index ebeeedcbd45f045c5fc40ea7b92472c3738337ad..f44a5aadc5010ed37c198155f9ccaaabce533b0a 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/MMDetectorDescription.h
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/MMDetectorDescription.h
@@ -30,22 +30,22 @@ public:
 	MMDetectorDescription(std::string s);
 	void Register();
 
-	static MMDetectorDescription* GetCurrent() {return current;}
+	static MMDetectorDescription* GetCurrent() {return s_current;}
 	
 	double sWidth() const {return small_x();}
 	double lWidth() const {return large_x();}
 	double Length() const {return y();}
 	double Tck()    const {return z();}
 
-	void xFrame(double y) {_xFrame=y;}
-	double xFrame() const {return _xFrame;}
+	void xFrame(double y) {m_xFrame=y;}
+	double xFrame() const {return m_xFrame;}
 
-	void ysFrame(double y) {_ysFrame=y;}
-	double ysFrame() const {return _ysFrame;}
+	void ysFrame(double y) {m_ysFrame=y;}
+	double ysFrame() const {return m_ysFrame;}
+
+	void ylFrame(double y) {m_ylFrame=y;}
+	double ylFrame() const {return m_ylFrame;}
 
-	void ylFrame(double y) {_ylFrame=y;}
-	double ylFrame() const {return _ylFrame;}
-	
 	MM_Technology* GetTechnology();
 
 	MMReadoutParameters roParameters;
@@ -53,12 +53,12 @@ public:
 	MMReadoutParameters& GetReadoutParameters() {return roParameters;}
 
 protected:
-	double _xFrame;
-	double _ysFrame;
-	double _ylFrame;
+	double m_xFrame;
+	double m_ysFrame;
+	double m_ylFrame;
 
 	void SetDetectorAddress(AGDDDetectorPositioner*);
-	static MMDetectorDescription* current;
+	static MMDetectorDescription* s_current;
 };
 
 #endif
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/MMDetectorHelper.h b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/MMDetectorHelper.h
index ec2a40cff9073cc77c93d456a55dd51dd67e574b..ae9f208fd2084808ac713d6acd8ac1d62f102d2d 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/MMDetectorHelper.h
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/MMDetectorHelper.h
@@ -18,15 +18,15 @@ typedef std::pair<MMDetectorDescription*,AGDDDetectorPositioner*> AGDDPositioned
 class MMDetectorHelper {
 public:
 	MMDetectorHelper();
-	MicromegasIterator MM_begin() {return MicromegasList.begin();}
-	MicromegasIterator MM_end()   {return MicromegasList.end();}
+	MicromegasIterator MM_begin() {return m_MicromegasList.begin();}
+	MicromegasIterator MM_end()   {return m_MicromegasList.end();}
 	
 	MMDetectorDescription* Get_MMDetectorType(std::string type);
 	MMDetectorDescription* Get_MMDetector(char type,int ieta,int iphi,int layer=1,char side='A');
 	AGDDPositionedDetector Get_MMPositionedDetector(char type,int ieta,int iphi,int layer=1,char side='A');
 
 private:
-	MicromegasMap MicromegasList;
+	MicromegasMap m_MicromegasList;
 
 };
 
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/sTGCDetectorDescription.h b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/sTGCDetectorDescription.h
index 61896ed9d38031a05ad3d61bef945d26058b4526..5a7a388e9abe5dc63c1e6ebbeffb35e422cadd5b 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/sTGCDetectorDescription.h
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/sTGCDetectorDescription.h
@@ -50,13 +50,13 @@ public:
     sTGCDetectorDescription(std::string s);
     void Register();
 	
-        virtual void SetXYZ(std::vector<double> v) override
+        virtual void SetXYZ(const std::vector<double>& v) override
 	{
                 small_x(v[0]);
 		large_x(v[1]);
 		y(v[2]);
 		z(v[3]);
-		_yCutout=v[4];
+		m_yCutout=v[4];
 	}
 	
 	double sWidth() const {return small_x();}
@@ -64,35 +64,35 @@ public:
 	double Length() const {return y();}
 	double Tck()    const {return z();}
 
-	void yCutout(double y) {_yCutout=y;}
-	double yCutout() const {return _yCutout;}
+	void yCutout(double y) {m_yCutout=y;}
+	double yCutout() const {return m_yCutout;}
 	
-	void xFrame(double y) {_xFrame=y;}
-	double xFrame() const {return _xFrame;}
+	void xFrame(double y) {m_xFrame=y;}
+	double xFrame() const {return m_xFrame;}
 	
-	void ysFrame(double y) {_ysFrame=y;}
-	double ysFrame() const {return _ysFrame;}
+	void ysFrame(double y) {m_ysFrame=y;}
+	double ysFrame() const {return m_ysFrame;}
 	
-	void ylFrame(double y) {_ylFrame=y;}
-	double ylFrame() const {return _ylFrame;}
+	void ylFrame(double y) {m_ylFrame=y;}
+	double ylFrame() const {return m_ylFrame;}
 
 	sTGCReadoutParameters roParameters;
 	
 	sTGCReadoutParameters& GetReadoutParameters() {return roParameters;}
 
-	static sTGCDetectorDescription* GetCurrent() {return current;}
+	static sTGCDetectorDescription* GetCurrent() {return s_current;}
 	
 	sTGC_Technology* GetTechnology();
 
 protected:
 
-	double _yCutout;
+	double m_yCutout;
 	
-	double _xFrame;
-	double _ysFrame;
-	double _ylFrame;
+	double m_xFrame;
+	double m_ysFrame;
+	double m_ylFrame;
 
-	static sTGCDetectorDescription* current;
+	static sTGCDetectorDescription* s_current;
 	void SetDetectorAddress(AGDDDetectorPositioner*);
 };
 
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/sTGCDetectorHelper.h b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/sTGCDetectorHelper.h
index 494c88a9256b20b86fd64226b6d9c3bb34b041b4..b2952c4953b1c8931c2b3a27797eaff0d753e777 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/sTGCDetectorHelper.h
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/MuonAGDDDescription/sTGCDetectorHelper.h
@@ -18,15 +18,15 @@ typedef std::pair<sTGCDetectorDescription*,AGDDDetectorPositioner*> AGDDPosition
 class sTGCDetectorHelper {
 public:
 	sTGCDetectorHelper();
-	sTGCIterator sTGC_begin() {return sTGCList.begin();}
-	sTGCIterator sTGC_end()   {return sTGCList.end();}
+	sTGCIterator sTGC_begin() {return m_sTGCList.begin();}
+	sTGCIterator sTGC_end()   {return m_sTGCList.end();}
 	
 	sTGCDetectorDescription* Get_sTGCDetector(char type,int ieta,int iphi,int layer=1,char side='A');
 	sTGCDetectorDescription* Get_sTGCDetectorType(std::string type);
 	AGDDPositionedDetector Get_sTGCPositionedDetector(char type,int ieta,int iphi,int layer=1,char side='A');
 	
 private:
-	sTGCMap sTGCList;
+	sTGCMap m_sTGCList;
 
 };
 
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/src/MMDetectorDescription.cxx b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/src/MMDetectorDescription.cxx
index 0d9f81d89db610f7d8d6d03ae88f1db813143a5d..c092a0c3c68763bc2a02f6c1e89089d122696cd5 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/src/MMDetectorDescription.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/src/MMDetectorDescription.cxx
@@ -8,7 +8,7 @@
 
 #include <sstream>
 
-MMDetectorDescription* MMDetectorDescription::current=0;
+MMDetectorDescription* MMDetectorDescription::s_current=0;
 
 
 MMDetectorDescription::MMDetectorDescription(std::string s): 
@@ -26,7 +26,7 @@ void MMDetectorDescription::Register()
 void MMDetectorDescription::SetDetectorAddress(AGDDDetectorPositioner* p)
 {
 		//std::cout<<"This is AGDDMicromegas::SetDetectorAddress "<<GetName()<<" "<<
-		//sType;
+		//m_sType;
 		p->ID.detectorType="Micromegas";
 		p->theDetector=this;
 		std::stringstream stringone;
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/src/MMDetectorHelper.cxx b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/src/MMDetectorHelper.cxx
index 272749573b47d07707b521dfe7add6dac482c4cf..83da1fede83f0f864824b16867b93f7af023a894 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/src/MMDetectorHelper.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/src/MMDetectorHelper.cxx
@@ -19,7 +19,7 @@ MMDetectorHelper::MMDetectorHelper()
 	{
 		MMDetectorDescription* st=dynamic_cast<MMDetectorDescription*>(vl_iter.second);
 		if (st) 
-			MicromegasList[vl_iter.first]=st;
+			m_MicromegasList[vl_iter.first]=st;
 	}
 	
 }
@@ -98,6 +98,6 @@ AGDDPositionedDetector MMDetectorHelper::Get_MMPositionedDetector(char type,int
 
 MMDetectorDescription* MMDetectorHelper::Get_MMDetectorType(std::string type)
 {
-	if (MicromegasList.find(type) != MicromegasList.end()) return MicromegasList[type];
+	if (m_MicromegasList.find(type) != m_MicromegasList.end()) return m_MicromegasList[type];
 	return nullptr;
 }
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/src/sTGCDetectorDescription.cxx b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/src/sTGCDetectorDescription.cxx
index ecca870d850e598e0ed3f935ac92a2fdf6df012a..475da709a41fd56f0ca1bc8f2408eb09b6ba4507 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/src/sTGCDetectorDescription.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/src/sTGCDetectorDescription.cxx
@@ -10,10 +10,10 @@
 
 #include <sstream>
 
-sTGCDetectorDescription* sTGCDetectorDescription::current=0;
+sTGCDetectorDescription* sTGCDetectorDescription::s_current=0;
 
 sTGCDetectorDescription::sTGCDetectorDescription(std::string s):
-    AGDDDetector(s,"sTGC"),_yCutout(0)
+    AGDDDetector(s,"sTGC"),m_yCutout(0)
 {
 }
 
@@ -27,7 +27,7 @@ void sTGCDetectorDescription::Register()
 void sTGCDetectorDescription::SetDetectorAddress(AGDDDetectorPositioner* p)
 {
 		//std::cout<<"This is AGDDsTGC::SetDetectorAddress "<<GetName()<<" "<<
-		// sType;
+		// m_sType;
 		p->ID.detectorType="sTGC";
 		p->theDetector=this;
 		std::stringstream stringone;
diff --git a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/src/sTGCDetectorHelper.cxx b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/src/sTGCDetectorHelper.cxx
index daef2ab1753843f5278fefd753d9b8a1676fc0c7..6be96f08d3f06841a1edb1e0cb8999a7d8d50f42 100644
--- a/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/src/sTGCDetectorHelper.cxx
+++ b/MuonSpectrometer/MuonDetDescr/MuonAGDDDescription/src/sTGCDetectorHelper.cxx
@@ -20,7 +20,7 @@ sTGCDetectorHelper::sTGCDetectorHelper()
 		sTGCDetectorDescription* st=dynamic_cast<sTGCDetectorDescription*>(vl_iter.second);
 		//AGDDMicromegas* st1=dynamic_cast<AGDDMicromegas*>(st);
 		if (st) 
-			sTGCList[vl_iter.first]=st;
+			m_sTGCList[vl_iter.first]=st;
 	}
 	
 }
@@ -99,6 +99,6 @@ AGDDPositionedDetector sTGCDetectorHelper::Get_sTGCPositionedDetector(char type,
 
 sTGCDetectorDescription* sTGCDetectorHelper::Get_sTGCDetectorType(std::string type)
 {
-	if (sTGCList.find(type) != sTGCList.end()) return sTGCList[type];
+	if (m_sTGCList.find(type) != m_sTGCList.end()) return m_sTGCList[type];
 	return nullptr;
 }
diff --git a/MuonSpectrometer/MuonDigitization/CSC_Digitization/CSC_Digitization/CscDigitizationTool.h b/MuonSpectrometer/MuonDigitization/CSC_Digitization/CSC_Digitization/CscDigitizationTool.h
index 658785e31553168296c79bac3e2af364dad08039..45aeda011e1423bf4ca305b4bc4df975823110fe 100644
--- a/MuonSpectrometer/MuonDigitization/CSC_Digitization/CSC_Digitization/CscDigitizationTool.h
+++ b/MuonSpectrometer/MuonDigitization/CSC_Digitization/CSC_Digitization/CscDigitizationTool.h
@@ -99,6 +99,8 @@ public: //possibly these should be private?
   
   ToolHandle<ICscCalibTool> m_pcalib;
 
+  SG::WriteHandleKey<CscSimDataCollection> m_cscSimDataCollectionWriteHandleKey{this,"CSCSimDataCollectionOutputName","CSC_SDO","WriteHandleKey for Output CscSimDataCollection"};
+  
   CscDigitContainer         * m_container;
 
   const MuonGM::MuonDetectorManager * m_geoMgr;
diff --git a/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx
index 9e60f5c086a1306bf344878f9255a4dba4dcb13c..43de437083a45d06aeed92dd2c27563460ca0e63 100644
--- a/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx
+++ b/MuonSpectrometer/MuonDigitization/CSC_Digitization/src/CscDigitizationTool.cxx
@@ -87,6 +87,8 @@ StatusCode CscDigitizationTool::initialize() {
 
   ATH_MSG_INFO ( "Retrieved Active Store Service." );
 
+  ATH_CHECK(m_cscSimDataCollectionWriteHandleKey.initialize());
+  
   // initialize transient detector store and MuonDetDescrManager
   if ( detStore()->retrieve(m_geoMgr).isFailure() ) {
     ATH_MSG_FATAL ( "Could not retrieve MuonDetectorManager!" );
@@ -214,8 +216,6 @@ StatusCode CscDigitizationTool::digitize() {
 
 StatusCode CscDigitizationTool::processAllSubEvents() {
 
-  StatusCode status;
-
   ATH_MSG_DEBUG ( "in processAllSubEvents()" );
 
   // clean up the digit container
@@ -232,14 +232,8 @@ StatusCode CscDigitizationTool::processAllSubEvents() {
   if (m_isPileUp) return StatusCode::SUCCESS;
 
   // create and record the SDO container in StoreGate
-  std::string sdoKey = "CSC_SDO";
-  CscSimDataCollection* sdoContainer = new CscSimDataCollection();
-  status = evtStore()->record(sdoContainer,sdoKey);
-  if (status.isFailure())  {
-    ATH_MSG_ERROR ( "Unable to record CSC SDO collection in StoreGate" );
-    return status;
-  } else
-    ATH_MSG_DEBUG ( "CscSDOCollection recorded in StoreGate." );
+  SG::WriteHandle<CscSimDataCollection> CSCSimDataCollectionWriteHandle(m_cscSimDataCollectionWriteHandleKey);
+  ATH_CHECK(CSCSimDataCollectionWriteHandle.record(std::make_unique<CscSimDataCollection>()));
 
   //merging of the hit collection in getNextEvent method    
 
@@ -247,11 +241,11 @@ StatusCode CscDigitizationTool::processAllSubEvents() {
     StatusCode sc = getNextEvent();
     if (StatusCode::FAILURE == sc) {
       ATH_MSG_INFO ( "There are no CSC hits in this event" );      
-      return status; // there are no hits in this event
+      return sc; // there are no hits in this event
     }
   }
 
-  return CoreDigitization(sdoContainer);
+  return CoreDigitization(CSCSimDataCollectionWriteHandle.ptr());
 
 }
 
@@ -730,16 +724,10 @@ StatusCode CscDigitizationTool::mergeEvent() {
   ATH_MSG_DEBUG ( "in mergeEvent()" );
 
   // create and record the SDO container in StoreGate
-  std::string sdoKey = "CSC_SDO";
-  CscSimDataCollection *sdoCollection = new CscSimDataCollection();
-  if ( (evtStore()->record(sdoCollection,sdoKey)).isFailure() )  {
-    ATH_MSG_ERROR ( "Unable to record CSC SDO collection in StoreGate" );
-    return StatusCode::FAILURE;
-  } else
-    ATH_MSG_DEBUG ( "CscSDOCollection recorded in StoreGate." );
-
+  SG::WriteHandle<CscSimDataCollection> CSCSimDataCollectionWriteHandle(m_cscSimDataCollectionWriteHandleKey);
+  ATH_CHECK(CSCSimDataCollectionWriteHandle.record(std::make_unique<CscSimDataCollection>()));
 
-  if ( CoreDigitization(sdoCollection).isFailure() ) { // 
+  if ( CoreDigitization(CSCSimDataCollectionWriteHandle.ptr()).isFailure() ) { // 
     ATH_MSG_ERROR ("mergeEvent() got failure from CoreDigitization()");
     return StatusCode::FAILURE;
   }
diff --git a/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/MM_FastDigitizer.cxx b/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/MM_FastDigitizer.cxx
index 3bb3c67812c3f484e3796deba5da222d626a0e5a..e95d96252264b7c148bb17662e597066d3ca6585 100644
--- a/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/MM_FastDigitizer.cxx
+++ b/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/MM_FastDigitizer.cxx
@@ -199,8 +199,7 @@ StatusCode MM_FastDigitizer::execute() {
 
   // Create and record the SDO container in StoreGate
   SG::WriteHandle<MuonSimDataCollection> h_sdoContainer(m_sdoName);
-  auto sdoContainer = std::make_unique<MuonSimDataCollection>(*h_sdoContainer);
-  ATH_CHECK( h_sdoContainer.record ( std::move (sdoContainer)) );
+  ATH_CHECK( h_sdoContainer.record ( std::make_unique<MuonSimDataCollection>() ) );
 
   MMPrepDataContainer* prdContainer = new MMPrepDataContainer(m_idHelper->detectorElement_hash_max());
   std::string key = "MM_Measurements";
diff --git a/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/sTgcFastDigitizer.cxx b/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/sTgcFastDigitizer.cxx
index ba935359669aabf20d96c8008f0e88118473ee09..f73ac82b022d81af00aa9582f59e39538810f3bb 100644
--- a/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/sTgcFastDigitizer.cxx
+++ b/MuonSpectrometer/MuonDigitization/MuonFastDigitization/src/sTgcFastDigitizer.cxx
@@ -158,8 +158,7 @@ StatusCode sTgcFastDigitizer::execute() {
 
 // Create and record the SDO container in StoreGate
   SG::WriteHandle<MuonSimDataCollection> h_sdoContainer(m_sdoName);
-  auto sdoContainer = std::make_unique<MuonSimDataCollection>(*h_sdoContainer);
-  ATH_CHECK( h_sdoContainer.record ( std::move (sdoContainer)) );
+  ATH_CHECK( h_sdoContainer.record ( std::make_unique<MuonSimDataCollection>() ) );
 
   sTgcPrepDataContainer* prdContainer = new sTgcPrepDataContainer(m_idHelper->detectorElement_hash_max());
   
diff --git a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx
index c03f7e7ae0d8b5196481b58700a1e3362d9375fe..6d6720e56b7c2c1115d71473874dc147ab1f920f 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonPatternFinders/MuonPatternFinderTools/MuonHoughPatternTools/src/MuonLayerHoughTool.cxx
@@ -53,7 +53,7 @@ namespace Muon {
     declareProperty("ExtrapolationDistance",m_extrapolationDistance = 1500. );
     declareProperty("MuonTruthParticlesKey", m_MuonTruthParticlesKey);
     declareProperty("MuonTruthSegmentsKey", m_MuonTruthSegmentsKey);
-    declareProperty("AddSectors", m_addSectors = true);
+    declareProperty("AddSectors", m_addSectors = false);
   }
 
   MuonLayerHoughTool::~MuonLayerHoughTool()
@@ -75,6 +75,9 @@ namespace Muon {
       ATH_MSG_ERROR("Failed to initialize " << m_truthSummaryTool );
       return StatusCode::FAILURE;
     }
+    else{
+      m_truthSummaryTool.disable();
+    }
     if( detStore()->retrieve( m_detMgr ).isFailure() || !m_detMgr ){
       ATH_MSG_ERROR("Failed to initialize detector manager" );
       return StatusCode::FAILURE;
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/CMakeLists.txt b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/CMakeLists.txt
index e5094f5750176860e1b08562b9b9834b04cd82b3..fbcd1d50c9d843b0948d70b1bded7b8e6c7621ff 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/CMakeLists.txt
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/CMakeLists.txt
@@ -7,7 +7,7 @@ atlas_subdir( MuonRIO_OnTrack )
 
 # Declare the package's dependencies:
 atlas_depends_on_subdirs( PUBLIC
-                          Control/DataModel
+                          Control/AthLinks
                           GaudiKernel
                           MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry
                           MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData
@@ -26,12 +26,12 @@ atlas_add_library( MuonRIO_OnTrack
                    src/*.cxx
                    PUBLIC_HEADERS MuonRIO_OnTrack
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS}
-                   LINK_LIBRARIES DataModel GaudiKernel MuonReadoutGeometry MuonPrepRawData TrkSurfaces TrkEventPrimitives TrkRIO_OnTrack
+                   LINK_LIBRARIES AthLinks GaudiKernel MuonReadoutGeometry MuonPrepRawData TrkSurfaces TrkEventPrimitives TrkRIO_OnTrack
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} GeoPrimitives )
 
 atlas_add_dictionary( MuonRIO_OnTrackDict
                       MuonRIO_OnTrack/MuonRIO_OnTrackDict.h
                       MuonRIO_OnTrack/selection.xml
                       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} DataModel GaudiKernel MuonReadoutGeometry MuonPrepRawData TrkSurfaces TrkEventPrimitives TrkRIO_OnTrack GeoPrimitives MuonRIO_OnTrack )
+                      LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AthLinks GaudiKernel MuonReadoutGeometry MuonPrepRawData TrkSurfaces TrkEventPrimitives TrkRIO_OnTrack GeoPrimitives MuonRIO_OnTrack )
 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/CscClusterOnTrack.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/CscClusterOnTrack.h
index 336e0318f150c4e6072393a26150dc17f9a41c63..363b2832827b5a7d02df90bd6f38a862752a8350 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/CscClusterOnTrack.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/CscClusterOnTrack.h
@@ -25,7 +25,7 @@
 // needed classes
 
 #include "MuonPrepRawData/CscPrepDataContainer.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 
 typedef ElementLink<Muon::CscPrepDataContainer> ElementLinkToIDC_CSC_Container;
 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MMClusterOnTrack.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MMClusterOnTrack.h
index 36f72e25fcb8e177c2cba8ca0770b3418872e77d..54c746015796b0d1b3b53ad39b275ee7346e19f6 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MMClusterOnTrack.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MMClusterOnTrack.h
@@ -10,7 +10,7 @@
 #include "MuonPrepRawData/MMPrepData.h"
 // needed classes
 #include "MuonPrepRawData/MMPrepDataContainer.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 
 typedef ElementLink<Muon::MMPrepDataContainer> ElementLinkToIDC_MM_Container;
 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MdtDriftCircleOnTrack.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MdtDriftCircleOnTrack.h
index feb804ea84253e8b5d135e432298f692ee254b69..3110b97ef2869d6e77a6c5fe629f13fe0300dd1f 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MdtDriftCircleOnTrack.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/MdtDriftCircleOnTrack.h
@@ -28,7 +28,7 @@
 #include <cassert>
 
 #include "MuonPrepRawData/MdtPrepDataContainer.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 #include "MuonRIO_OnTrack/MuonDriftCircleErrorStrategy.h"
 
 typedef ElementLink<Muon::MdtPrepDataContainer> ElementLinkToIDC_MDT_Container;
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/RpcClusterOnTrack.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/RpcClusterOnTrack.h
index 1110aa7d22beef2907ee02f728daf36df950e5ff..5de77cad0ac0532f201bb79a4fba480be247b406 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/RpcClusterOnTrack.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/RpcClusterOnTrack.h
@@ -10,7 +10,7 @@
 #include "MuonPrepRawData/RpcPrepData.h"
 // needed classes
 #include "MuonPrepRawData/RpcPrepDataContainer.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 
 typedef ElementLink<Muon::RpcPrepDataContainer> ElementLinkToIDC_RPC_Container;
 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/TgcClusterOnTrack.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/TgcClusterOnTrack.h
index 0fd961d79db9be48c3bb0bcc6db06d2cb5a0965f..3de91492b9d079dcf4e1c64da1d095713d151ed2 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/TgcClusterOnTrack.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/TgcClusterOnTrack.h
@@ -22,7 +22,7 @@
 #include "MuonPrepRawData/TgcPrepData.h"
 // needed classes
 #include "MuonPrepRawData/TgcPrepDataContainer.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 
 typedef ElementLink<Muon::TgcPrepDataContainer> ElementLinkToIDC_TGC_Container;
 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/sTgcClusterOnTrack.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/sTgcClusterOnTrack.h
index b3576ecbda1e509d84b75621cd83f86a829c6a4a..e556a41e05b23dc950e77ea55a9be9a9dba078b5 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/sTgcClusterOnTrack.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonRIO_OnTrack/MuonRIO_OnTrack/sTgcClusterOnTrack.h
@@ -10,7 +10,7 @@
 #include "MuonPrepRawData/sTgcPrepData.h"
 // needed classes
 #include "MuonPrepRawData/sTgcPrepDataContainer.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 
 typedef ElementLink<Muon::sTgcPrepDataContainer> ElementLinkToIDC_STGC_Container;
 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.cxx
index 143493dd930a3bd63183fe9a774f41886c9a8f2b..2173f05c85511f9d103aca1b06289a6b38abebb8 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.cxx
@@ -33,7 +33,6 @@ namespace Muon {
     declareProperty("Extrapolator",m_extrapolator );
     declareProperty("ParticleCaloExtensionTool",m_caloExtensionTool );    
     declareProperty("MuonIdHelperTool",m_idHelper );    
-    declareProperty("MuonSystemExtensionCollectionName",m_containerName ="MuonSystemExtensionCollection" );    
 
   }
 
@@ -259,28 +258,6 @@ namespace Muon {
      MuonSystemExtension* theExtension = new MuonSystemExtension( std::unique_ptr<const Trk::TrackParameters>(caloExtension->muonEntryLayerIntersection()->clone()), 
                                                    std::move(intersections) );
     
-    // now add the extension to the output collection so we are not causing any leaks
-    MuonSystemExtensionCollection* collection = 0;
-    if( !evtStore()->contains<MuonSystemExtensionCollection>(m_containerName) ){
-      collection = new MuonSystemExtensionCollection();
-      if( evtStore()->record( collection, m_containerName).isFailure() ) {
-        ATH_MSG_WARNING( "Failed to record output collection, will leak the ParticleCaloExtension");
-        delete collection;
-        collection = 0;
-      }
-    }else{
-      if(evtStore()->retrieve(collection,m_containerName).isFailure()) {
-        ATH_MSG_WARNING( "Unable to retrieve " << m_containerName << " will leak the ParticleCaloExtension" );
-        collection = 0;
-      }
-    }
-    if( !collection ){
-      ATH_MSG_WARNING( "No CaloExtension Collection, failing extension to avoid memory leak");
-      delete theExtension;
-      theExtension = 0;
-      return false;
-    }
-    collection->push_back(theExtension);
     muonSystemExtention = theExtension;
     return true;
   }
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.h
index b856f36a3553f7e7a41589c199071516e4cbfa59..1f5556660b46f3a23d8d1a31a42be5d10524e243 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonSystemExtensionTool.h
@@ -68,9 +68,6 @@ namespace Muon {
     /** sector mapping helper */
     MuonSectorMapping m_sectorMapping;
 
-    /** collection cache name */
-    std::string m_containerName;
-
   };
 }
 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/MuonTrackSummaryHelperTool/MuonTrackSummaryHelperTool.h b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/MuonTrackSummaryHelperTool/MuonTrackSummaryHelperTool.h
index 0b16bdb39bb7fda2772d14b1c8e2f5032aa1e026..dd3954b4c074bce290123f5abc6f61d7b7815971 100755
--- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/MuonTrackSummaryHelperTool/MuonTrackSummaryHelperTool.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/MuonTrackSummaryHelperTool/MuonTrackSummaryHelperTool.h
@@ -16,6 +16,9 @@
 
 #include "GaudiKernel/ToolHandle.h"
 #include "AthenaBaseComps/AthAlgTool.h"
+
+#include "StoreGate/ReadHandleKey.h"
+
 #include <vector>
 #include <bitset>
 
@@ -115,7 +118,7 @@ private:
 	double m_roadWidth;
 	
 	/** storegate key of MdtPrepDataContainer */
-	std::string m_mdtKey;
+	SG::ReadHandleKey<Muon::MdtPrepDataContainer> m_mdtKey{this,"MdtPrepDataContainer","MDT_DriftCircles","MDT PRDs"};
 
         //std::string m_holeOnTrackToolName;
         mutable const Trk::TrackingGeometry* m_trackingGeometry;
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.cxx
index fb33ff9cd961f19942b8d9ff6cfdca182a3ef271..b27aad332ffbdf51c86b001d2324ba1e4c41d0ee 100755
--- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.cxx
@@ -44,6 +44,8 @@
 
 #include "TrkToolInterfaces/ITrackHoleSearchTool.h"
 
+#include "StoreGate/ReadHandle.h"
+
 #include <vector>
 #include <cassert>
 #include <iostream>
@@ -70,7 +72,6 @@ Muon::MuonTrackSummaryHelperTool::MuonTrackSummaryHelperTool(
   declareProperty("CalculateCloseHits", m_calculateCloseHits = false );
   declareProperty("RoadWidth",           m_roadWidth = 135.,"width used to calculate hits within the road (mm)"); 
   declareProperty("Extrapolator",    m_extrapolator);
-  declareProperty("MdtPrepDataContainer", m_mdtKey="MDT_DriftCircles");
   declareProperty("HoleOnTrackTool", m_muonTgTool);	
   declareProperty("TrackingGeometryName", m_trackingGeometryName);
 }
@@ -129,6 +130,9 @@ StatusCode Muon::MuonTrackSummaryHelperTool::initialize()
       return StatusCode::FAILURE;
     }
   }
+  else{
+    m_extrapolator.disable();
+  }
 
   if( m_idHelperTool.retrieve().isFailure() ){
     ATH_MSG_ERROR("Could not get " << m_idHelperTool);      
@@ -162,7 +166,11 @@ StatusCode Muon::MuonTrackSummaryHelperTool::initialize()
     }   
   } else {
     msg (MSG::VERBOSE) << "Hole search turned off, so MuonHolesOnTrackTool not loaded" << endmsg;        
+    m_muonTgTool.disable();
   }
+
+  ATH_CHECK(m_mdtKey.initialize());
+
   //      }else{ 
   //        msg << MSG::FATAL << "MuonTGRecTools library doesn't seem to be loaded." << endmsg;
   //      	return StatusCode::FAILURE;
@@ -731,13 +739,18 @@ bool Muon::MuonTrackSummaryHelperTool::isFirstProjection( const Identifier& id )
 
 const Muon::MdtPrepDataCollection* Muon::MuonTrackSummaryHelperTool::findMdtPrdCollection( const Identifier& chId ) const {
 
-  if(!evtStore()->contains<const Muon::MdtPrepDataContainer>(m_mdtKey) ) return 0;
+  SG::ReadHandle<Muon::MdtPrepDataContainer> mdtPrdContainer(m_mdtKey);
 
-  const Muon::MdtPrepDataContainer* mdtPrdContainer = 0;
-  if( evtStore()->retrieve(mdtPrdContainer,m_mdtKey).isFailure()) {
+  if(!mdtPrdContainer.isValid()){
     ATH_MSG_WARNING("Cannot retrieve mdtPrepDataContainer " << m_mdtKey);
     return 0;
   }
+
+  if(!mdtPrdContainer.isPresent()){
+    ATH_MSG_DEBUG("No MDT PRD container available");
+    return 0;
+  }
+
   IdentifierHash hash_id;
   m_idHelperTool->mdtIdHelper().get_module_hash(chId,hash_id );
 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx
index 024ab4fc9b1516d746011827e4b13f8819b1483e..fb26ad2a7a8b61819f3c362efc9c68441c9ec205 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentCombiners/MuonSegmentCombinerTools/MooSegmentCombinationFinder/src/MooSegmentCombinationFinder.cxx
@@ -168,6 +168,11 @@ Muon::MooSegmentCombinationFinder::initialize()
 	return StatusCode::FAILURE;
       }
     }
+    else{
+      m_houghPatternFinder.disable();
+      m_patternSegmentMaker.disable();
+      m_overlapRemovalTool.disable();
+    }
 
     
     if (m_segmentSelector.retrieve().isFailure()){
@@ -188,6 +193,13 @@ Muon::MooSegmentCombinationFinder::initialize()
 	  return StatusCode::FAILURE;
 	}
       }
+      else{
+	m_segmentCombinationCleaner.disable();
+      }
+    }
+    else{
+      m_curvedSegmentCombiner.disable();
+      m_segmentCombinationCleaner.disable();
     }
 
     ATH_CHECK( m_csc2dLocation.initialize() );
diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/src/MuonClusterSegmentFinder.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/src/MuonClusterSegmentFinder.cxx
index 9464206539bbc3816a3b25895008416db7093b43..ef35ef18bde13133db30faaf180244c4007104c4 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/src/MuonClusterSegmentFinder.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonClusterSegmentMakerTools/src/MuonClusterSegmentFinder.cxx
@@ -70,11 +70,6 @@ namespace Muon {
 
   StatusCode MuonClusterSegmentFinder::finalize() {
 
-    if( m_clusterTool.retrieve().isFailure() ){
-      ATH_MSG_FATAL("Could not get " << m_clusterTool);
-      return StatusCode::FAILURE;
-    }
-
     if( m_doNtuple ){
       TDirectory* cdir = gDirectory;
       m_file->cd();
@@ -94,6 +89,7 @@ namespace Muon {
     ATH_CHECK(m_layerHashProvider.retrieve());
     ATH_CHECK(m_muonPRDSelectionTool.retrieve());
     ATH_CHECK(m_segmentMaker.retrieve());
+    ATH_CHECK(m_clusterTool.retrieve());
     ATH_CHECK(m_clusterCreator.retrieve());
     ATH_CHECK(m_trackToSegmentTool.retrieve());
     ATH_CHECK(m_slTrackFitter.retrieve());
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx
index fe8bf0d7fbcf10206bfcfc63832b1f272d1d0504..d97f9b2c8e99e837d46afe6668f678397ff326e9 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx
@@ -59,7 +59,6 @@ namespace Muon {
       m_intersectSvc("MuonStationIntersectSvc",name()),
       m_extrapolator("Trk::Extrapolator/MuonExtrapolator"),
       m_mdtRotCreator("Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator"),
-      m_tubeRotCreator("Muon::MdtDriftCircleOnTrackCreator/MdtTubeHitOnTrackCreator"),
       m_cscRotCreator("Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator"),
       m_clusRotCreator("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator"),
       m_pullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator"),
@@ -79,7 +78,6 @@ namespace Muon {
     declareProperty("MuonStationIntersectSvc", m_intersectSvc);
     declareProperty("Extrapolator",            m_extrapolator);
     declareProperty("MdtRotCreator",           m_mdtRotCreator);
-    declareProperty("TubeRotCreator",          m_tubeRotCreator);
     declareProperty("CscRotCreator",           m_cscRotCreator);
     declareProperty("ClusterRotCreator",          m_clusRotCreator);
     declareProperty("PullCalculator",          m_pullCalculator);
@@ -114,6 +112,7 @@ namespace Muon {
     }
 
     ATH_CHECK( m_clusRotCreator.retrieve() );
+    ATH_CHECK( m_pullCalculator.retrieve() );
     ATH_CHECK( m_idHelperTool.retrieve() );
     ATH_CHECK( m_intersectSvc.retrieve() );
 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.h
index cabbd677b80a868e9c63774a06bf3021f2e1040e..87d8c37f77ff015ee6680a429826e2b10d057a20 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.h
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.h
@@ -169,7 +169,6 @@ namespace Muon {
     ServiceHandle<MuonStationIntersectSvc>           m_intersectSvc;      //<! pointer to hole search service
     ToolHandle<Trk::IExtrapolator>                   m_extrapolator;      //!< extrapolator
     ToolHandle<Muon::IMdtDriftCircleOnTrackCreator>  m_mdtRotCreator;     //!< IMdtDriftCircleOnTrackCreator full calibration
-    ToolHandle<Muon::IMdtDriftCircleOnTrackCreator>  m_tubeRotCreator;    //!< IMdtDriftCircleOnTrackCreator tube hits
     ToolHandle<Muon::IMuonClusterOnTrackCreator>     m_cscRotCreator;     //!< IMuonClusterOnTrackCreator for cscs 
     ToolHandle<Muon::IMuonClusterOnTrackCreator>     m_clusRotCreator;    //!< IMuonClusterOnTrackCreator for trigger hits
 
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.cxx
index 351c55ff3411e69c721d38c1c73fb99a3cf6dac8..3e0fc3a3bc0227fd69f46c7ab8fc3f75ee804920 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSeededSegmentFinder.cxx
@@ -79,6 +79,7 @@ namespace Muon {
     ATH_CHECK( m_propagator.retrieve() );
     ATH_CHECK( m_mdtRotCreator.retrieve() );
     ATH_CHECK( m_idHelper.retrieve() );
+    ATH_CHECK( m_printer.retrieve() );
 
     ATH_CHECK(m_key_mdt.initialize());
     ATH_CHECK(m_key_csc.initialize());
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackToSegmentTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackToSegmentTool.cxx
index 9e25637cb593c92b43a95203fbca2aff6a4c208b..20f14593b420441846891c74337de7d0af36edc4 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackToSegmentTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackToSegmentTool.cxx
@@ -64,6 +64,7 @@ namespace Muon {
     ATH_CHECK( m_idHelperTool.retrieve() );
     ATH_CHECK( m_helperTool.retrieve() );
     ATH_CHECK( m_intersectSvc.retrieve() );
+    ATH_CHECK( m_printer.retrieve() );
     return StatusCode::SUCCESS;
   }
   
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx
index 98c6e88be25e5f60d4cb86677aa8b47b921fc2d4..36fa7b965dd13b7a2f4843d1994fa3bcda08719f 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx
@@ -103,6 +103,7 @@ namespace Muon {
     ATH_CHECK( m_candidateTool.retrieve() );
     ATH_CHECK( m_candidateMatchingTool.retrieve() );
     ATH_CHECK( m_trackBTool.retrieve() );
+    ATH_CHECK( m_ambiTool.retrieve() );
     ATH_CHECK( m_mooBTool.retrieve() );
     ATH_CHECK( m_trackRefineTool.retrieve() );
     ATH_CHECK( decodeStrategyVector( m_stringStrategies ) );
diff --git a/MuonSpectrometer/MuonTruthAlgs/CMakeLists.txt b/MuonSpectrometer/MuonTruthAlgs/CMakeLists.txt
index dcf810918da7138add4f9e0657b7a4be66c6b02d..44e8dc1fd8ed101aa6cb091ba3f5660e83fdcdf9 100644
--- a/MuonSpectrometer/MuonTruthAlgs/CMakeLists.txt
+++ b/MuonSpectrometer/MuonTruthAlgs/CMakeLists.txt
@@ -19,7 +19,8 @@ atlas_depends_on_subdirs( PUBLIC
                           Tracking/TrkTools/TrkToolInterfaces
                           PRIVATE
                           Control/AthenaBaseComps
-                          Control/DataModel
+                          Control/AthLinks
+                          Control/AthContainers
                           DetectorDescription/AtlasDetDescr
                           Event/EventPrimitives
                           Event/xAOD/xAODMuon
@@ -60,7 +61,7 @@ atlas_add_component( MuonTruthAlgs
                      src/*.cxx
                      src/components/*.cxx
                      INCLUDE_DIRS ${HEPMC_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${HEPMC_LIBRARIES} StoreGateLib SGtests Identifier GaudiKernel MuonPrepRawData MuonRecToolInterfaces MuonSimData TrkTrack TrkTruthData TrkToolInterfaces AthenaBaseComps DataModel AtlasDetDescr EventPrimitives xAODMuon xAODTracking xAODTruth GeneratorObjects MuonReadoutGeometry MuonGeoModelLib MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonPattern MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MCTruthClassifierLib Particle ParticleTruth TrkDetElementBase TrkGeometry TrkSurfaces TrkCompetingRIOsOnTrack TrkEventUtils TrkMeasurementBase TrkParameters TrkPrepRawData TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkSegment TrkExInterfaces TrkFitterInterfaces )
+                     LINK_LIBRARIES ${HEPMC_LIBRARIES} StoreGateLib SGtests Identifier GaudiKernel MuonPrepRawData MuonRecToolInterfaces MuonSimData TrkTrack TrkTruthData TrkToolInterfaces AthenaBaseComps AthLinks AthContainers AtlasDetDescr EventPrimitives xAODMuon xAODTracking xAODTruth GeneratorObjects MuonReadoutGeometry MuonGeoModelLib MuonIdHelpersLib MuonCompetingRIOsOnTrack MuonPattern MuonRIO_OnTrack MuonSegment MuonRecHelperToolsLib MCTruthClassifierLib Particle ParticleTruth TrkDetElementBase TrkGeometry TrkSurfaces TrkCompetingRIOsOnTrack TrkEventUtils TrkMeasurementBase TrkParameters TrkPrepRawData TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkSegment TrkExInterfaces TrkFitterInterfaces )
 
 # Install files from the package:
 atlas_install_headers( MuonTruthAlgs )
diff --git a/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.cxx b/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.cxx
index 4a35f86559f82827a506723e88fa17f2a28f31ab..6f66efbf8fa007cdc6af90beab2dc8de51bef60f 100755
--- a/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.cxx
+++ b/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.cxx
@@ -18,7 +18,7 @@
 #include "HepMC/GenVertex.h"
 
 #include "GeneratorObjects/HepMcParticleLink.h"
-#include "DataModel/DataVector.h"
+#include "AthContainers/DataVector.h"
 
 #include "TrkTrack/Track.h"
 #include "TrkRIO_OnTrack/RIO_OnTrack.h"
diff --git a/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.h b/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.h
index c07bb99062bc3b4970b95d1128b7271d76ba74dd..f4715f18a1bd92277a0fc98c7312d6ab7c9cda5a 100755
--- a/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.h
+++ b/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.h
@@ -10,7 +10,7 @@
 #include "AthenaBaseComps/AthAlgTool.h"
 #include "GaudiKernel/ToolHandle.h"
 
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 #include "AtlasDetDescr/AtlasDetectorID.h"
 #include "TrkTruthData/PRD_MultiTruthCollection.h"
 #include "TrkEventUtils/InverseMultiMap.h"
diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.cxx b/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.cxx
index d5cceb16bcf885dbb98282641a09f5a1720ee794..98bce9069103df74c9a788d465a0581cd51a4329 100644
--- a/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.cxx
+++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonDecayTruthTrajectoryBuilder.cxx
@@ -12,7 +12,7 @@
 #include "HepMC/GenVertex.h"
 
 #include "GeneratorObjects/HepMcParticleLink.h"
-#include "DataModel/DataVector.h"
+#include "AthContainers/DataVector.h"
 
 #include <stack>
 
diff --git a/MuonSpectrometer/MuonTruthAlgs/src/TrackParticleTruthMaker.cxx b/MuonSpectrometer/MuonTruthAlgs/src/TrackParticleTruthMaker.cxx
index 54434f88f811c9249be9f3c6c8699fa374afdc14..cc0a5f2aeae3345d3666a2d707148f456ee74619 100644
--- a/MuonSpectrometer/MuonTruthAlgs/src/TrackParticleTruthMaker.cxx
+++ b/MuonSpectrometer/MuonTruthAlgs/src/TrackParticleTruthMaker.cxx
@@ -18,7 +18,7 @@
 #include "HepMC/GenParticle.h"
 
 #include <map>
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 
 namespace Muon {
 
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/src/CscClusterValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/src/CscClusterValAlg.cxx
index e6f59d765bb2417b23a9c933806dfd0ab619be9a..d8c92d2ad34cbb2425f4694e0713ee65cc6abf01 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/src/CscClusterValAlg.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/src/CscClusterValAlg.cxx
@@ -747,7 +747,7 @@ StatusCode CscClusterValAlg::fillHistograms() {
   const DataHandle<CscPrepDataContainer> cscCluster(0);
   const DataHandle<CscStripPrepDataContainer> cscStrip(0);
 
-  sc = evtStore()->contains<Muon::CscPrepDataContainer>(m_cscClusterKey);
+  sc = StatusCode(evtStore()->contains<Muon::CscPrepDataContainer>(m_cscClusterKey));
   if(sc.isFailure() || m_cscClusterKey == "") {
     ATH_MSG_WARNING (  "Cluster container of type Muon::CscPrepDataContainer and key \"" << m_cscClusterKey << "\" NOT found in StoreGate" );
     return sc;
@@ -759,7 +759,7 @@ StatusCode CscClusterValAlg::fillHistograms() {
     }
   }
 
-  sc = evtStore()->contains<Muon::CscStripPrepDataContainer>(m_cscPRDKey);
+  sc = StatusCode(evtStore()->contains<Muon::CscStripPrepDataContainer>(m_cscPRDKey));
   if(sc.isFailure() || m_cscPRDKey == "") {
     ATH_MSG_WARNING (  "PRD container of type Muon::CscStripPrepDataContainer and key \"" << m_cscPRDKey << "\" NOT found in StoreGate" );
     return sc;
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/src/CscPrdValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/src/CscPrdValAlg.cxx
index d03585fba51dfd7bd0d6fd54c01d61d04d081706..9a0a94e4e78da2ba0fc4bca109ccd07780b548cd 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/src/CscPrdValAlg.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/CscRawDataMonitoring/src/CscPrdValAlg.cxx
@@ -482,14 +482,12 @@ StatusCode CscPrdValAlg::bookHistograms() {
 //
 StatusCode CscPrdValAlg::fillHistograms()  {
 
-  StatusCode sc = StatusCode::SUCCESS;
-
   // Part 1: Get the messaging service, print where you are
   ATH_MSG_DEBUG( "CscPrdValAlg: in fillHistograms" );
 
   const DataHandle<CscStripPrepDataContainer> CscPRD(0);
 
-  sc = evtStore()->contains<CscStripPrepDataContainer>(m_cscPrdKey);
+  StatusCode sc(evtStore()->contains<CscStripPrepDataContainer>(m_cscPrdKey));
   if(sc.isFailure() || m_cscPrdKey == "") {
     ATH_MSG_WARNING (  "PRD container of type Muon::CscStripPrepDataContainer and key \"" << m_cscPrdKey << "\" NOT found in StoreGate" );
     return sc;
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonGenericTracksMon.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonGenericTracksMon.h
index 5e55a16872ccad1285304f7c10ad5fbe30acbcb3..7e5b48433fdd212aba9aa2a8e987f20347c3d4e2 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonGenericTracksMon.h
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonGenericTracksMon.h
@@ -40,7 +40,6 @@
 
 #include "MuonIdHelpers/MuonIdHelperTool.h"
 #include "MuonRecHelperTools/MuonEDMHelperTool.h"
-#include "MuonRecToolInterfaces/IMuonHitSummaryTool.h" 
 #include "MuonSelectorTools/IMuonSelectionTool.h"
 #include "MuonResonanceTools/IMuonResonanceSelectionTool.h"
 #include "MuonResonanceTools/IMuonResonancePairingTool.h"
@@ -149,7 +148,6 @@ class MuonGenericTracksMon : public ManagedMonitorToolBase
   //ToolHandle<Trk::IResidualPullCalculator> m_pullCalculator;     //<! tool to calculate residuals and pulls
   //ToolHandle<Muon::MuonEDMHelperTool> m_helperTool;
   //ToolHandle<Muon::MuonIdHelperTool> m_idHelperTool;
-  ToolHandle<Muon::IMuonHitSummaryTool> m_muonHitSummaryTool;
   // MCP muon quality tool
   ToolHandle<CP::IMuonSelectionTool> m_muonSelectionTool;
   // MCP T&P helpers
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonGenericTracksMon.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonGenericTracksMon.cxx
index 4cee95e63ed84108e87d81a22a333fd09cf8e23f..ba253d5192c2703ac4fd665f2e7d59db4722669d 100755
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonGenericTracksMon.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonGenericTracksMon.cxx
@@ -68,7 +68,6 @@ MuonGenericTracksMon::MuonGenericTracksMon( const std::string & type, const std:
   declareProperty("MuonTrackCollection",             m_muonTracksName       = "MuonSpectrometerTrackParticles");
   declareProperty("MuonExtrapolatedTrackCollection", m_muonExtrapTracksName = "ExtrapolatedMuonTrackParticles");
   declareProperty("InDetTrackParticles",             m_innerTracksName      = "InDetTrackParticles");
-  declareProperty("MuonHistSumTool",                 m_muonHitSummaryTool   = std::string("Muon::MuonHitSummaryTool/MuonHitSummaryTool"));
   declareProperty("MuonSelectorTool",                m_muonSelectionTool);
   declareProperty("ZmumuResonanceSelectionTool",     m_ZmumuResonanceSelectionTool);
   declareProperty("JpsimumuResonanceSelectionTool",  m_JpsimumuResonanceSelectionTool);
@@ -684,13 +683,6 @@ StatusCode MuonGenericTracksMon::setupTools()
   // }
   // ATH_MSG_DEBUG( "Retrieved " << m_helperTool );
  
-  // sc = m_muonHitSummaryTool.retrieve();
-  // if (!sc.isSuccess()){
-  //   ATH_MSG_FATAL( "Could not get " << m_muonHitSummaryTool ); 
-  //   return sc;
-  // }
-  // ATH_MSG_DEBUG( "Retrieved " << m_muonHitSummaryTool );
- 
   sc = m_ZmumuResonanceSelectionTool.retrieve();
   if (!sc.isSuccess()){
     ATH_MSG_FATAL( "Could not get " << m_ZmumuResonanceSelectionTool ); 
diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/CopyTruthJetParticles.cxx b/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/CopyTruthJetParticles.cxx
index e83c0296206d466a3c2a40a3244e9360cf5bba37..36420bc5e8ea3b00bbbb6f174fd360498500222e 100644
--- a/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/CopyTruthJetParticles.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/CopyTruthJetParticles.cxx
@@ -239,7 +239,7 @@ int CopyTruthJetParticles::execute() const {
 
   // Retrieve the xAOD truth objects
   const xAOD::TruthEventContainer* xTruthEventContainer = NULL;
-  ASG_CHECK( evtStore()->retrieve( xTruthEventContainer, "TruthEvents"));
+  ASG_CHECK( evtStore()->retrieve( xTruthEventContainer, "TruthEvents"), 1);
 
   // Make a new TruthParticleContainer and link it to StoreGate
   if (evtStore()->contains<xAOD::TruthParticleContainer>(m_outputname))
diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/CopyTruthParticles.cxx b/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/CopyTruthParticles.cxx
index c4c5e11e838bc31d1b48cbefdff77b0365b753a0..711b0309fed2250886698a91b99193e107a781ce 100644
--- a/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/CopyTruthParticles.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/CopyTruthParticles.cxx
@@ -24,7 +24,7 @@ CopyTruthParticles::CopyTruthParticles(const std::string& name)
 int CopyTruthParticles::execute() const {
   // Retrieve the xAOD truth objects
   const xAOD::TruthEventContainer* xTruthEventContainer = NULL;
-  ASG_CHECK( evtStore()->retrieve( xTruthEventContainer, "TruthEvents"));
+  ASG_CHECK( evtStore()->retrieve( xTruthEventContainer, "TruthEvents"), 1);
 
   // Make a new TruthParticleContainer and link it to StoreGate
   if (evtStore()->contains<xAOD::TruthParticleContainer>(m_outputname))
diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/JetConeLabeling.cxx b/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/JetConeLabeling.cxx
index c4b3445ed8924266ef07b077b8849e5b87ab0154..ff772580c8845445b6c3ee4240534433ac626892 100644
--- a/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/JetConeLabeling.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/JetConeLabeling.cxx
@@ -196,7 +196,7 @@ namespace Analysis {
       }
       return StatusCode::SUCCESS;*/
 
-    return StatusCode::SUCCESS;
+    return 0;
   }
 
 } // namespace
diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/ParticleJetDeltaRLabelTool.cxx b/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/ParticleJetDeltaRLabelTool.cxx
index 93810db9baffdcf66854160ec9324ec420fd20d1..4bb3364920caec3f921ed051225485bbcaa6b012 100644
--- a/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/ParticleJetDeltaRLabelTool.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/ParticleJetTools/Root/ParticleJetDeltaRLabelTool.cxx
@@ -111,9 +111,9 @@ int ParticleJetDeltaRLabelTool::modify(JetContainer& jets) const {
     const TruthParticleContainer* taus = NULL;
     const TruthParticleContainer* bs = NULL;
     const TruthParticleContainer* cs = NULL;
-    ASG_CHECK( evtStore()->retrieve( taus, m_taupartcollection));
-    ASG_CHECK( evtStore()->retrieve( bs, m_bottompartcollection));
-    ASG_CHECK( evtStore()->retrieve( cs, m_charmpartcollection));
+    ASG_CHECK( evtStore()->retrieve( taus, m_taupartcollection), 1);
+    ASG_CHECK( evtStore()->retrieve( bs, m_bottompartcollection), 1);
+    ASG_CHECK( evtStore()->retrieve( cs, m_charmpartcollection), 1);
 
     vector<vector<const TruthParticle*> > jetlabelpartsb = match(*bs, jets);
     vector<vector<const TruthParticle*> > jetlabelpartsc = match(*cs, jets);
diff --git a/PhysicsAnalysis/AnalysisCommon/ReweightUtils/Root/PDFWeight.cxx b/PhysicsAnalysis/AnalysisCommon/ReweightUtils/Root/PDFWeight.cxx
index 9d1c9eba63d3367ece3a4495b97447d5a6cc3bdf..1cd98191c94b30be41c9d992f7a018d269aec093 100644
--- a/PhysicsAnalysis/AnalysisCommon/ReweightUtils/Root/PDFWeight.cxx
+++ b/PhysicsAnalysis/AnalysisCommon/ReweightUtils/Root/PDFWeight.cxx
@@ -77,41 +77,32 @@ double PDFWeight::computeWeight(const xAOD::EventInfo* evtInfo) const {
   for (auto truthEvent : *truthEventContainer) {
 
     try {
-      sc = truthEvent->pdfInfoParameter( pdg_id1, xAOD::TruthEvent::PdfParam::PDGID1 );
-      if (sc.isFailure()) {
+      if ( !truthEvent->pdfInfoParameter( pdg_id1, xAOD::TruthEvent::PdfParam::PDGID1 ) ) {
         ATH_MSG_DEBUG("Could not retrieve PDG id1.");
       }
-      sc = truthEvent->pdfInfoParameter( pdg_id2, xAOD::TruthEvent::PdfParam::PDGID2 );
-      if (sc.isFailure()) {
+      if ( !truthEvent->pdfInfoParameter( pdg_id2, xAOD::TruthEvent::PdfParam::PDGID2 ) ) {
         ATH_MSG_DEBUG("Could not retrieve PDG id2.");
       }
-      sc = truthEvent->pdfInfoParameter( pdf_id1, xAOD::TruthEvent::PdfParam::PDFID1 );
-      if (sc.isFailure()) {
+      if ( !truthEvent->pdfInfoParameter( pdf_id1, xAOD::TruthEvent::PdfParam::PDFID1 ) ) {
         ATH_MSG_DEBUG("Could not retrieve PDF id1.");
       }
-      sc = truthEvent->pdfInfoParameter( pdf_id2, xAOD::TruthEvent::PdfParam::PDFID2 );
-      if (sc.isFailure()) {
+      if ( !truthEvent->pdfInfoParameter( pdf_id2, xAOD::TruthEvent::PdfParam::PDFID2 ) ) {
         ATH_MSG_DEBUG("Could not retrieve PDF id2.");
       }
-      sc = truthEvent->pdfInfoParameter( x1, xAOD::TruthEvent::PdfParam::X1 );
-      if (sc.isFailure()) {
+      if ( !truthEvent->pdfInfoParameter( x1, xAOD::TruthEvent::PdfParam::X1 ) ) {
         ATH_MSG_DEBUG("Could not retrieve x_1.");
       }
-      sc = truthEvent->pdfInfoParameter( x2, xAOD::TruthEvent::PdfParam::X2 );
-      if (sc.isFailure()) {
+      if ( !truthEvent->pdfInfoParameter( x2, xAOD::TruthEvent::PdfParam::X2 ) ) {
         ATH_MSG_DEBUG("Could not retrieve x_2.");
       }
-      sc = truthEvent->pdfInfoParameter( q, xAOD::TruthEvent::PdfParam::Q );
-      if (sc.isFailure()) {
+      if ( !truthEvent->pdfInfoParameter( q, xAOD::TruthEvent::PdfParam::Q ) ) {
         ATH_MSG_DEBUG("Could not retrieve Q.");
       }
-      sc = truthEvent->pdfInfoParameter( xf1, xAOD::TruthEvent::PdfParam::XF1 );
-      if (sc.isFailure()) {
+      if ( !truthEvent->pdfInfoParameter( xf1, xAOD::TruthEvent::PdfParam::XF1 ) ) {
         ATH_MSG_DEBUG("Could not retrieve x_f1.");
       }
-      sc = truthEvent->pdfInfoParameter( xf2, xAOD::TruthEvent::PdfParam::XF2 );
-      if (sc.isFailure()) {
-        ATH_MSG_DEBUG("Could not retrieve x_f2.");
+      if ( !truthEvent->pdfInfoParameter( xf2, xAOD::TruthEvent::PdfParam::XF2 ) ) {
+         ATH_MSG_DEBUG("Could not retrieve x_f2.");
       }
     } catch (...) {
       // set this to debug only because this is a frequent problem in ttbar samples
diff --git a/PhysicsAnalysis/AnalysisCommon/ReweightUtils/share/ut_ParticleScaleFactorTool_test.ref b/PhysicsAnalysis/AnalysisCommon/ReweightUtils/share/ut_ParticleScaleFactorTool_test.ref
index dea198d7941d338af76ae102eb8b7438da9d87e9..ca6dbbb78dac4d6608e0092f6c57f168d119d725 100644
--- a/PhysicsAnalysis/AnalysisCommon/ReweightUtils/share/ut_ParticleScaleFactorTool_test.ref
+++ b/PhysicsAnalysis/AnalysisCommon/ReweightUtils/share/ut_ParticleScaleFactorTool_test.ref
@@ -1,7 +1,19 @@
 ToolSvc.tool1       DEBUG Property update for OutputLevel : new value = 1
+ToolSvc.tool1       DEBUG Detected scale factor h
+ToolSvc.tool1       DEBUG   Parameter blah
 ToolSvc.tool2       DEBUG Property update for OutputLevel : new value = 1
+ToolSvc.tool2       DEBUG Detected scale factor h
+ToolSvc.tool2       DEBUG   Parameter pt/GeV
 ToolSvc.tool3       DEBUG Property update for OutputLevel : new value = 1
+ToolSvc.tool3       DEBUG Detected scale factor h
+ToolSvc.tool3       DEBUG   Parameter pt/GeV
+ToolSvc.tool3       DEBUG Detected scale factor h2
+ToolSvc.tool3       DEBUG Combining Electron: f(pt / GeV,eta) = 2*f(pt / GeV)*f(eta)/[f(pt / GeV)+f(eta)]
+ToolSvc.tool3       DEBUG   Parameter eta
 ToolSvc.tool4       DEBUG Property update for OutputLevel : new value = 1
+ToolSvc.tool4       DEBUG Detected systematic mySyst__1up
+ToolSvc.tool4       DEBUG Detected scale factor h
+ToolSvc.tool4       DEBUG   Parameter pt/GeV
 3
 4
 4.44444
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/AODCaloClusterRetriever.h b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/AODCaloClusterRetriever.h
index 85bf9cbb8e9e98b5d88b40c46eda0aff0b9ef8dc..db835041113539795c96473f4f31c9c5d7f91d2a 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/AODCaloClusterRetriever.h
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/AODCaloClusterRetriever.h
@@ -43,11 +43,10 @@ namespace JiveXML{
       const DataMap getData(const CaloClusterContainer*, bool calibFlag);
 
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; };
+      virtual std::string dataTypeName() const { return m_typeName; };
 
     private:
-      ///The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
 
       std::string m_sgKeyFavourite;
       std::vector<std::string> m_otherKeys;
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/AODJetRetriever.h b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/AODJetRetriever.h
index e14d16a91645081e138125a0c6031dae5012b9cd..b9a8b3e279b41e3aa43c49f51c7e0a6f495380c5 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/AODJetRetriever.h
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/AODJetRetriever.h
@@ -43,11 +43,11 @@ namespace JiveXML{
       const DataMap getData(const JetCollection*);
 
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; };
+      virtual std::string dataTypeName() const { return m_typeName; };
 
     private:
       ///The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
 
       std::string m_sgKeyFavourite;
       std::vector<std::string> m_otherKeys;
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/BJetRetriever.h b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/BJetRetriever.h
index 146787fc9f18408f09bd612b3f4385462f18428e..24c2669c434799b2450571725feeceac734d5952 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/BJetRetriever.h
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/BJetRetriever.h
@@ -43,11 +43,11 @@ namespace JiveXML{
       const DataMap getData(const JetCollection*);
 
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; };
+      virtual std::string dataTypeName() const { return m_typeName; };
 
     private:
       ///The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
 
       std::string m_sgKeyFavourite;
       std::vector<std::string> m_otherKeys;
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/CompositeParticleRetriever.h b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/CompositeParticleRetriever.h
index e2d4453597af67ff93a16b0883fe8797594deb2b..aaa1b717e81d2fa6d62ae00b558c154b1a2a7297 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/CompositeParticleRetriever.h
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/CompositeParticleRetriever.h
@@ -41,11 +41,11 @@ namespace JiveXML{
       const DataMap getData(const CompositeParticleContainer*);
     
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; };
+      virtual std::string dataTypeName() const { return m_typeName; };
 
     private:
       ///The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
 
       std::string m_sgKey;
   };
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/ElectronRetriever.h b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/ElectronRetriever.h
index 382ccb7f3924996fc9eb39580448208762fb9e74..5a96818c02ec1c549104e7c6ba01a76149de28f9 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/ElectronRetriever.h
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/ElectronRetriever.h
@@ -44,11 +44,11 @@ namespace JiveXML{
       const DataMap getData(const ElectronContainer*);
     
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; };
+      virtual std::string dataTypeName() const { return m_typeName; };
 
     private:
       ///The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
 
       std::string m_sgKey;
   };
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/MuonRetriever.h b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/MuonRetriever.h
index 4673d0b66fc589aa45246126e7e34c99bed40254..bda9db12b809f1dff390b11448a3ee8a372bdef1 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/MuonRetriever.h
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/MuonRetriever.h
@@ -42,11 +42,11 @@ namespace JiveXML{
       const DataMap getData(const Analysis::MuonContainer*);
     
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; };
+      virtual std::string dataTypeName() const { return m_typeName; };
 
     private:
       ///The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
 
       std::string m_sgKey;
   };
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/PhotonRetriever.h b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/PhotonRetriever.h
index 600703827fff1dab4bd8143370d2ecd24ef71691..3c3603667b1476f160c473b64ef6387a9a43d028 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/PhotonRetriever.h
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/PhotonRetriever.h
@@ -41,11 +41,11 @@ namespace JiveXML{
       const DataMap getData(const PhotonContainer*);
     
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; };
+      virtual std::string dataTypeName() const { return m_typeName; };
 
     private:
       ///The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
 
       std::string m_sgKey;
   };
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/TauJetRetriever.h b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/TauJetRetriever.h
index 3d9e2165d3f8b3daa4da64200b1512a13e0a6481..39d9a19f383f21008fd63541b4cfab28182d1781 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/TauJetRetriever.h
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/TauJetRetriever.h
@@ -44,11 +44,11 @@ namespace JiveXML{
       const DataMap getData(const Analysis::TauJetContainer*);
     
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; };
+      virtual std::string dataTypeName() const { return m_typeName; };
 
     private:
       ///The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
 
       std::string m_sgKey;
       bool m_doWriteHLT;
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/TrackParticleRetriever.h b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/TrackParticleRetriever.h
index 7ca5c2d0927e782aa16c721fe0f021dd35a87e63..216b38fc033b3e29295edae2430e8bf473f0fbb4 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/TrackParticleRetriever.h
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/AnalysisJiveXML/TrackParticleRetriever.h
@@ -43,11 +43,11 @@ namespace JiveXML{
       virtual StatusCode retrieve(ToolHandle<IFormatTool> &FormatTool); 
 
       /// Return the name of the data type
-      virtual std::string dataTypeName() const { return typeName; };
+      virtual std::string dataTypeName() const { return m_typeName; };
 
     private:
       ///The data type that is generated by this retriever
-      const std::string typeName;
+      const std::string m_typeName;
 
       //@name Property members
       //@{
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/AODCaloClusterRetriever.cxx b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/AODCaloClusterRetriever.cxx
index 7e3b87030bc644a4e5df99ace1caefcee610b99f..1e8d0cbeb2b841e94e0fdbc49e1d2cbd1b0ae65b 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/AODCaloClusterRetriever.cxx
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/AODCaloClusterRetriever.cxx
@@ -21,7 +21,7 @@ namespace JiveXML {
    **/
   AODCaloClusterRetriever::AODCaloClusterRetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("Cluster"){
+    m_typeName("Cluster"){
 
     //Only declare the interface
     declareInterface<IDataRetriever>(this);
@@ -133,7 +133,7 @@ namespace JiveXML {
     
     if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "retrieve()" << endmsg;
 
-    DataMap m_DataMap;
+    DataMap DataMap;
 
     DataVect phi; phi.reserve(ccc->size());
     DataVect eta; eta.reserve(ccc->size());
@@ -219,14 +219,14 @@ namespace JiveXML {
 
     }
     // Start with mandatory entries
-    m_DataMap["phi"] = phi;
-    m_DataMap["eta"] = eta;
-    m_DataMap["et"] = et;
-    m_DataMap[tagCells] = cells;
-    m_DataMap["numCells"] = numCells;
-    m_DataMap["id"] = idVec;
-    m_DataMap["emfrac"] = emfracVec; // not in Atlantis yet ! Could be used in legoplot
-    m_DataMap["label"] = labelVec; // not in Atlantis yet ! 
+    DataMap["phi"] = phi;
+    DataMap["eta"] = eta;
+    DataMap["et"] = et;
+    DataMap[tagCells] = cells;
+    DataMap["numCells"] = numCells;
+    DataMap["id"] = idVec;
+    DataMap["emfrac"] = emfracVec; // not in Atlantis yet ! Could be used in legoplot
+    DataMap["label"] = labelVec; // not in Atlantis yet ! 
 
     //Be verbose
     if (msgLvl(MSG::DEBUG)) {
@@ -235,7 +235,7 @@ namespace JiveXML {
     }
 
     //All collections retrieved okay
-    return m_DataMap;
+    return DataMap;
 
   } // retrieve
 
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/AODJetRetriever.cxx b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/AODJetRetriever.cxx
index 2ab4102d290b7b4aebe33bd1e9a41d003c4c1cd1..9860a696176bc54c6ba5001d3ee3b4322967a97a 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/AODJetRetriever.cxx
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/AODJetRetriever.cxx
@@ -19,7 +19,7 @@ namespace JiveXML {
    **/
   AODJetRetriever::AODJetRetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("Jet"){
+    m_typeName("Jet"){
 
     //Only declare the interface
     declareInterface<IDataRetriever>(this);
@@ -115,7 +115,7 @@ namespace JiveXML {
     
     if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "retrieve()" << endmsg;
 
-    DataMap m_DataMap;
+    DataMap DataMap;
 
     DataVect phi; phi.reserve(jets->size());
     DataVect eta; eta.reserve(jets->size());
@@ -240,54 +240,54 @@ namespace JiveXML {
     }
 
     // Start with mandatory entries
-    m_DataMap["phi"] = phi;
-    m_DataMap["eta"] = eta;
-    m_DataMap["et"] = et;
-    m_DataMap["pt"] = pt;
-    m_DataMap["id"] = idVec;
-
-    m_DataMap["bTagName multiple=\"9\""] = bTagName; // assigned by hand !
-    m_DataMap["bTagValue multiple=\"9\""] = bTagValue;
+    DataMap["phi"] = phi;
+    DataMap["eta"] = eta;
+    DataMap["et"] = et;
+    DataMap["pt"] = pt;
+    DataMap["id"] = idVec;
+
+    DataMap["bTagName multiple=\"9\""] = bTagName; // assigned by hand !
+    DataMap["bTagValue multiple=\"9\""] = bTagValue;
 	
     // basic jet quality
-    m_DataMap["quality"] = quality;
-    m_DataMap["isGood"] = isGood;
-    m_DataMap["isBad"] = isBad;
-    m_DataMap["isUgly"] = isUgly;
-    m_DataMap["emfrac"] = emfrac;
+    DataMap["quality"] = quality;
+    DataMap["isGood"] = isGood;
+    DataMap["isBad"] = isBad;
+    DataMap["isUgly"] = isUgly;
+    DataMap["emfrac"] = emfrac;
 
-    m_DataMap["jvf"] = jvf;
+    DataMap["jvf"] = jvf;
 
     if (m_writeJetQuality){ // extended jet quality
-      m_DataMap["qualityLAr"] = qualityLAr;
-      m_DataMap["qualityTile"] = qualityTile;
-      m_DataMap["time"] = time;
-      m_DataMap["timeClusters"] = timeClusters;
-      m_DataMap["n90cells"] = n90cells;
-      m_DataMap["n90const"] = n90const;
-      m_DataMap["hecf"] = hecf;
-      m_DataMap["tileGap3f"] = tileGap3f;
-      m_DataMap["fcorCell"] = fcorCell;
-      m_DataMap["fcorDotx"] = fcorDotx;
-      m_DataMap["fcorJet"] = fcorJet;
-      m_DataMap["fcorJetForCell"] = fcorJetForCell;
-      m_DataMap["nbadcells"] = nbadcells;
-      m_DataMap["fracSamplingMax"] = fracSamplingMax;
-      m_DataMap["sMax"] = sMax;
-      m_DataMap["OutOfTimeEfrac"] = OutOfTimeEfrac;
+      DataMap["qualityLAr"] = qualityLAr;
+      DataMap["qualityTile"] = qualityTile;
+      DataMap["time"] = time;
+      DataMap["timeClusters"] = timeClusters;
+      DataMap["n90cells"] = n90cells;
+      DataMap["n90const"] = n90const;
+      DataMap["hecf"] = hecf;
+      DataMap["tileGap3f"] = tileGap3f;
+      DataMap["fcorCell"] = fcorCell;
+      DataMap["fcorDotx"] = fcorDotx;
+      DataMap["fcorJet"] = fcorJet;
+      DataMap["fcorJetForCell"] = fcorJetForCell;
+      DataMap["nbadcells"] = nbadcells;
+      DataMap["fracSamplingMax"] = fracSamplingMax;
+      DataMap["sMax"] = sMax;
+      DataMap["OutOfTimeEfrac"] = OutOfTimeEfrac;
     } // writeJetQuality
  
     // further details
     // four-vectors
 /* need to be added to AtlantisJava/event.dtd !
-    m_DataMap["charge"] = charge;
-    m_DataMap["flavourTagWeight"] = flavourTagWeight;
+    DataMap["charge"] = charge;
+    DataMap["flavourTagWeight"] = flavourTagWeight;
 */
-    m_DataMap["mass"] = mass;
-    m_DataMap["px"] = px;
-    m_DataMap["py"] = py;
-    m_DataMap["pz"] = pz;
-    m_DataMap["energy"] = energy;
+    DataMap["mass"] = mass;
+    DataMap["px"] = px;
+    DataMap["py"] = py;
+    DataMap["pz"] = pz;
+    DataMap["energy"] = energy;
 
     if (msgLvl(MSG::DEBUG)) {
       msg(MSG::DEBUG) << dataTypeName() << " (AOD, no cells), collection: " << dataTypeName();
@@ -295,7 +295,7 @@ namespace JiveXML {
     }
 
     //All collections retrieved okay
-    return m_DataMap;
+    return DataMap;
 
   } // retrieve
 
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/BJetRetriever.cxx b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/BJetRetriever.cxx
index 5607d84fb3255cdeb06f93f4863ebf949f2b82b0..ea9b56a951c54a47408751b9dfdee01fa3d73de0 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/BJetRetriever.cxx
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/BJetRetriever.cxx
@@ -18,7 +18,7 @@ namespace JiveXML {
    **/
   BJetRetriever::BJetRetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("BJet"){
+    m_typeName("BJet"){
 
     //Only declare the interface
     declareInterface<IDataRetriever>(this);
@@ -117,7 +117,7 @@ namespace JiveXML {
     
     if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "retrieve()" << endmsg;
 
-    DataMap m_DataMap;
+    DataMap DataMap;
 
     DataVect phi; phi.reserve(jets->size());
     DataVect eta; eta.reserve(jets->size());
@@ -181,21 +181,21 @@ namespace JiveXML {
       }
     }
     // Start with mandatory entries
-    m_DataMap["phi"] = phi;
-    m_DataMap["eta"] = eta;
-    m_DataMap["pt"] = pt;
-    m_DataMap["energy"] = energy;
+    DataMap["phi"] = phi;
+    DataMap["eta"] = eta;
+    DataMap["pt"] = pt;
+    DataMap["energy"] = energy;
     // four-vectors
-    m_DataMap["mass"] = mass;
-    m_DataMap["px"] = px;
-    m_DataMap["py"] = py;
-    m_DataMap["pz"] = pz;
+    DataMap["mass"] = mass;
+    DataMap["px"] = px;
+    DataMap["py"] = py;
+    DataMap["pz"] = pz;
 
     // further details
-    m_DataMap["weight"] = weight;
-    m_DataMap["lhSig"] = lhSig;
-    m_DataMap["charge"] = charge;
-    m_DataMap["label"] = label;
+    DataMap["weight"] = weight;
+    DataMap["lhSig"] = lhSig;
+    DataMap["charge"] = charge;
+    DataMap["label"] = label;
 
     //Be verbose
     if (msgLvl(MSG::DEBUG)) {
@@ -205,7 +205,7 @@ namespace JiveXML {
     }
 
     //All collections retrieved okay
-    return m_DataMap;
+    return DataMap;
 
   } // retrieve
   
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/CompositeParticleRetriever.cxx b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/CompositeParticleRetriever.cxx
index 1c43aa973de57277151a9521f076d8cb9156d4f3..4e63d4b8b7e21ad7447a6015eca2f27c9d5c30c5 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/CompositeParticleRetriever.cxx
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/CompositeParticleRetriever.cxx
@@ -23,7 +23,7 @@ namespace JiveXML {
    **/
   CompositeParticleRetriever::CompositeParticleRetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("CompositeParticle"){
+    m_typeName("CompositeParticle"){
 
     //Only declare the interface
     declareInterface<IDataRetriever>(this);
@@ -88,7 +88,7 @@ namespace JiveXML {
     
     if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "retrieve()" << endmsg;
 
-    DataMap m_DataMap;
+    DataMap DataMap;
 
     DataVect phi; phi.reserve(cpcont->size());
     DataVect eta; eta.reserve(cpcont->size());
@@ -119,7 +119,7 @@ namespace JiveXML {
     CompositeParticleContainer::const_iterator compPartItrE = cpcont->end();
 
     std::string typeLabel = "n_a"; // same as in TruthParticleRetriever
-    int m_pdgId = 0;
+    int pdgId2 = 0;
     for (; compPartItr != compPartItrE; ++compPartItr) {
       phi.push_back(DataType((*compPartItr)->phi()));
       eta.push_back(DataType((*compPartItr)->eta()));
@@ -133,50 +133,50 @@ namespace JiveXML {
       charge.push_back( DataType( (*compPartItr)->charge() ));
       dataType.push_back( DataType( (*compPartItr)->dataType() ));
       typeLabel = "n_a";
-      m_pdgId = (*compPartItr)->pdgId();
-      pdgId.push_back( DataType( m_pdgId ));
-      if( abs(m_pdgId) == 11) typeLabel = "EV_Electron";
-      if( abs(m_pdgId) == 12) typeLabel = "EV_NeutrinoElectron";
-      if( abs(m_pdgId) == 13) typeLabel = "EV_Muon";
-      if( abs(m_pdgId) == 14) typeLabel = "EV_NeutrinoMuon";
-      if( abs(m_pdgId) == 15) typeLabel = "EV_Tau";
-      if( abs(m_pdgId) == 16) typeLabel = "EV_NeutrinoTau";
-      if( abs(m_pdgId) == 6) typeLabel = "EV_Top";  
-      if( abs(m_pdgId) == 5) typeLabel = "EV_Bottom";
-      if( abs(m_pdgId) == 22) typeLabel = "EV_Photon";
-      if( abs(m_pdgId) == 23) typeLabel = "EV_Z0";
-      if( m_pdgId == 24) typeLabel = "EV_Wplus";
-      if( m_pdgId == -24) typeLabel = "EV_Wminus";
+      pdgId2 = (*compPartItr)->pdgId();
+      pdgId.push_back( DataType( pdgId2 ));
+      if( abs(pdgId2) == 11) typeLabel = "EV_Electron";
+      if( abs(pdgId2) == 12) typeLabel = "EV_NeutrinoElectron";
+      if( abs(pdgId2) == 13) typeLabel = "EV_Muon";
+      if( abs(pdgId2) == 14) typeLabel = "EV_NeutrinoMuon";
+      if( abs(pdgId2) == 15) typeLabel = "EV_Tau";
+      if( abs(pdgId2) == 16) typeLabel = "EV_NeutrinoTau";
+      if( abs(pdgId2) == 6) typeLabel = "EV_Top";  
+      if( abs(pdgId2) == 5) typeLabel = "EV_Bottom";
+      if( abs(pdgId2) == 22) typeLabel = "EV_Photon";
+      if( abs(pdgId2) == 23) typeLabel = "EV_Z0";
+      if( pdgId2 == 24) typeLabel = "EV_Wplus";
+      if( pdgId2 == -24) typeLabel = "EV_Wminus";
       typeEV.push_back( DataType( typeLabel ));
       label.push_back( DataType( "none" ) );
 
-//    childID.push_back( DataType( "none" ) ); // placholders
+//    childID.push_back( DataType( "none" ) ); // placeholders
 //    motherID.push_back( DataType( "none" ) );
     }
     // four-vectors
-    m_DataMap["phi"] = phi;
-    m_DataMap["eta"] = eta;
-    m_DataMap["et"] = et;
-    m_DataMap["energy"] = energy;
-    m_DataMap["mass"] = mass;
-    m_DataMap["px"] = px;
-    m_DataMap["py"] = py;
-    m_DataMap["pz"] = pz;
-    m_DataMap["pdgId"] = pdgId;
-    m_DataMap["typeEV"] = typeEV;
-    m_DataMap["charge"] = charge;
-    m_DataMap["dataType"] = dataType;
-    m_DataMap["label"] = label;
+    DataMap["phi"] = phi;
+    DataMap["eta"] = eta;
+    DataMap["et"] = et;
+    DataMap["energy"] = energy;
+    DataMap["mass"] = mass;
+    DataMap["px"] = px;
+    DataMap["py"] = py;
+    DataMap["pz"] = pz;
+    DataMap["pdgId"] = pdgId;
+    DataMap["typeEV"] = typeEV;
+    DataMap["charge"] = charge;
+    DataMap["dataType"] = dataType;
+    DataMap["label"] = label;
     
-//    m_DataMap["childID"] = childID;
-//    m_DataMap["motherID"] = motherID;
+//    DataMap["childID"] = childID;
+//    DataMap["motherID"] = motherID;
 
     if (msgLvl(MSG::DEBUG)) {
       msg(MSG::DEBUG) << dataTypeName() << " retrieved with " << phi.size() << " entries"<< endmsg;
     }
 
     //All collections retrieved okay
-    return m_DataMap;
+    return DataMap;
 
   } // retrieve
 
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/ElectronRetriever.cxx b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/ElectronRetriever.cxx
index 6a87ef7cf9c1b5cca03f5985c1de92a5af07a0ca..c4f67e1cdf35a0cba0a1cf95d6b65dbb21be391d 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/ElectronRetriever.cxx
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/ElectronRetriever.cxx
@@ -22,7 +22,7 @@ namespace JiveXML {
    **/
   ElectronRetriever::ElectronRetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("Electron"){
+    m_typeName("Electron"){
 
     //Only declare the interface
     declareInterface<IDataRetriever>(this);
@@ -87,7 +87,7 @@ namespace JiveXML {
     
     if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "in getData()" << endmsg;
 
-    DataMap m_DataMap;
+    DataMap DataMap;
 
     DataVect pt; pt.reserve(elCont->size());
     DataVect phi; phi.reserve(elCont->size());
@@ -121,7 +121,7 @@ namespace JiveXML {
     ElectronContainer::const_iterator elItr  = elCont->begin();
     ElectronContainer::const_iterator elItrE = elCont->end();
 
-    int m_MCdataType = 1;
+    int MCdataType = 1;
 
 // isEM from
 //   https://uimon.cern.ch/twiki/bin/view/Atlas/RemoveOverlap
@@ -191,14 +191,14 @@ namespace JiveXML {
             electronLabel += "_TightNoIsolation"; 
 //            electronIsEMString = "_TightNoIsolation"; // would need AtlantisJava changes
       }     
-      m_MCdataType = (*elItr)->dataType();
-      dataType.push_back( DataType(  m_MCdataType ) );
+      MCdataType = (*elItr)->dataType();
+      dataType.push_back( DataType(  MCdataType ) );
 
 // check: full simulation input file (1) or fast (0) 
 // code from:
 // PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/MiscellaneousExamples.cxx
 
-      if (m_MCdataType != 3){ // full simulation
+      if (MCdataType != 3){ // full simulation
 
           isEM.push_back( DataType((**elItr).isem() ) );
 
@@ -291,41 +291,41 @@ namespace JiveXML {
     } // end ElectronIterator 
 
     // four-vectors
-    m_DataMap["phi"] = phi;
-    m_DataMap["eta"] = eta;
-    m_DataMap["pt"] = pt;
-    m_DataMap["energy"] = energy;
-    m_DataMap["mass"] = mass;
-    m_DataMap["px"] = px;
-    m_DataMap["py"] = py;
-    m_DataMap["pz"] = pz;
+    DataMap["phi"] = phi;
+    DataMap["eta"] = eta;
+    DataMap["pt"] = pt;
+    DataMap["energy"] = energy;
+    DataMap["mass"] = mass;
+    DataMap["px"] = px;
+    DataMap["py"] = py;
+    DataMap["pz"] = pz;
 
     // special Electron parameters
-    m_DataMap["eOverp"] = eOverp;
-    m_DataMap["isEM"] = isEM;
-    m_DataMap["isEMString"] = isEMString;
-    m_DataMap["label"] = label;
-    m_DataMap["hasTrack"] = hasTrack;
-    m_DataMap["author"] = author;
-    m_DataMap["pdgId"] = pdgId;
-    m_DataMap["dataType"] = dataType;
-    m_DataMap["hitsBLayer"] = hitsBLayer;
-    m_DataMap["hitsPixel"] = hitsPixel;
-    m_DataMap["hitsSCT"] = hitsSCT;
-    m_DataMap["hitsTRT"] = hitsTRT;
+    DataMap["eOverp"] = eOverp;
+    DataMap["isEM"] = isEM;
+    DataMap["isEMString"] = isEMString;
+    DataMap["label"] = label;
+    DataMap["hasTrack"] = hasTrack;
+    DataMap["author"] = author;
+    DataMap["pdgId"] = pdgId;
+    DataMap["dataType"] = dataType;
+    DataMap["hitsBLayer"] = hitsBLayer;
+    DataMap["hitsPixel"] = hitsPixel;
+    DataMap["hitsSCT"] = hitsSCT;
+    DataMap["hitsTRT"] = hitsTRT;
 
     // associations
-    m_DataMap["clusterKey"] = clusterKeyVec;
-    m_DataMap["clusterIndex"] = clusterIndexVec;
-    m_DataMap["trackKey"] = trackKeyVec;
-    m_DataMap["trackIndex"] = trackIndexVec;
+    DataMap["clusterKey"] = clusterKeyVec;
+    DataMap["clusterIndex"] = clusterIndexVec;
+    DataMap["trackKey"] = trackKeyVec;
+    DataMap["trackIndex"] = trackIndexVec;
 
     if (msgLvl(MSG::DEBUG)) {
       msg(MSG::DEBUG) << dataTypeName() << " retrieved with " << phi.size() << " entries"<< endmsg;
     }
 
     //All collections retrieved okay
-    return m_DataMap;
+    return DataMap;
 
   } // retrieve
 
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/MuonRetriever.cxx b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/MuonRetriever.cxx
index b221ab2249824fb3ca03534fe0f9676279c87743..1e3ee4401524e52e5e385563812203294c7e0036 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/MuonRetriever.cxx
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/MuonRetriever.cxx
@@ -22,7 +22,7 @@ namespace JiveXML {
    **/
   MuonRetriever::MuonRetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("Muon"){
+    m_typeName("Muon"){
 
     //Only declare the interface
     declareInterface<IDataRetriever>(this);
@@ -91,7 +91,7 @@ namespace JiveXML {
     
     if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "in getData()" << endmsg;
 
-    DataMap m_DataMap;
+    DataMap DataMap;
 
     DataVect phi; phi.reserve(muoncont->size());
     DataVect eta; eta.reserve(muoncont->size());
@@ -117,7 +117,7 @@ namespace JiveXML {
     Analysis::MuonContainer::const_iterator muonItr  = muoncont->begin();
     Analysis::MuonContainer::const_iterator muonItrE = muoncont->end();
 
-    int m_MCdataType = 1;
+    int MCdataType = 1;
     std::string clusterKey = "none"; // Storegate key of container 
     int clusterIndex = -1; // index number inside the container 
     std::string trackKey = "none"; // Storegate key of container 
@@ -141,13 +141,13 @@ namespace JiveXML {
       if (( (*muonItr)->author()) == 2){ muonAuthor = "lowpt"; } 
       author.push_back( DataType( muonAuthor ) );
  
-      m_MCdataType = (*muonItr)->dataType();
-      dataType.push_back( DataType(  m_MCdataType ) );
+      MCdataType = (*muonItr)->dataType();
+      dataType.push_back( DataType(  MCdataType ) );
 
 // check: full simulation input file (1) or fast (0) 
 // code from:
 // PhysicsAnalysis/AnalysisCommon/AnalysisExamples/src/MiscellaneousExamples.cxx
-      if (m_MCdataType != 3){ // full simulation
+      if (MCdataType != 3){ // full simulation
           chi2.push_back( DataType((*muonItr)->matchChi2OverDoF() ) );
           etConeIsol.push_back( DataType(
               ((*muonItr)->parameter(MuonParameters::etcone20))/CLHEP::GeV ) );
@@ -197,33 +197,33 @@ namespace JiveXML {
       }
     }
     // four-vectors
-    m_DataMap["phi"] = phi;
-    m_DataMap["eta"] = eta;
-    m_DataMap["pt"] = pt;
-    m_DataMap["energy"] = energy;
-    m_DataMap["mass"] = mass;
-    m_DataMap["px"] = px;
-    m_DataMap["py"] = py;
-    m_DataMap["pz"] = pz;
+    DataMap["phi"] = phi;
+    DataMap["eta"] = eta;
+    DataMap["pt"] = pt;
+    DataMap["energy"] = energy;
+    DataMap["mass"] = mass;
+    DataMap["px"] = px;
+    DataMap["py"] = py;
+    DataMap["pz"] = pz;
 
     // special muon parameters
-    m_DataMap["chi2"] = chi2;
-    m_DataMap["etConeIsol"] = etConeIsol;
-    m_DataMap["author"] = author;
-    m_DataMap["pdgId"] = pdgId;
-    m_DataMap["dataType"] = dataType;
+    DataMap["chi2"] = chi2;
+    DataMap["etConeIsol"] = etConeIsol;
+    DataMap["author"] = author;
+    DataMap["pdgId"] = pdgId;
+    DataMap["dataType"] = dataType;
     // further details and associations
-    m_DataMap["clusterKey"] = clusterKeyVec;
-    m_DataMap["clusterIndex"] = clusterIndexVec;
-    m_DataMap["trackKey"] = trackKeyVec;
-    m_DataMap["trackIndex"] = trackIndexVec;
+    DataMap["clusterKey"] = clusterKeyVec;
+    DataMap["clusterIndex"] = clusterIndexVec;
+    DataMap["trackKey"] = trackKeyVec;
+    DataMap["trackIndex"] = trackIndexVec;
 
     if (msgLvl(MSG::DEBUG)) {
       msg(MSG::DEBUG) << dataTypeName() << " retrieved with " << phi.size() << " entries"<< endmsg;
     }
 
     //All collections retrieved okay
-    return m_DataMap;
+    return DataMap;
 
   } // retrieve
 
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/PhotonRetriever.cxx b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/PhotonRetriever.cxx
index f2d92458204702a72ac98b0e44580777f562541d..f2920e61476b3c0a61132a0267214b7b96792f71 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/PhotonRetriever.cxx
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/PhotonRetriever.cxx
@@ -19,7 +19,7 @@ namespace JiveXML {
    **/
   PhotonRetriever::PhotonRetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("Photon"){
+    m_typeName("Photon"){
 
     //Only declare the interface
     declareInterface<IDataRetriever>(this);
@@ -84,7 +84,7 @@ namespace JiveXML {
     
     if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "retrieve()" << endmsg;
 
-    DataMap m_DataMap;
+    DataMap DataMap;
 
     DataVect phi; phi.reserve(photcont->size());
     DataVect eta; eta.reserve(photcont->size());
@@ -112,7 +112,7 @@ namespace JiveXML {
     PhotonContainer::const_iterator photonItr  = photcont->begin();
     PhotonContainer::const_iterator photonItrE = photcont->end();
 
-    int m_MCdataType = 1;
+    int MCdataType = 1;
     std::string clusterKey = "none"; // Storegate key of container 
     int clusterIndex = -1; // index number inside the container 
 
@@ -160,10 +160,10 @@ namespace JiveXML {
       py.push_back( DataType((*photonItr)->py()/CLHEP::GeV ) );
       pz.push_back( DataType((*photonItr)->pz()/CLHEP::GeV ) );
 
-      m_MCdataType = (*photonItr)->dataType();
+      MCdataType = (*photonItr)->dataType();
       // if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)  << " Which MC datatype, fast or full ? " << m_dataType() << " (" << m_sgKey << ")" << endmsg;
   
-      if (m_MCdataType != 3){ // full simulation
+      if (MCdataType != 3){ // full simulation
           isEM.push_back( DataType((**photonItr).isem()) );
 // do associations:
           const ElementLink<CaloClusterContainer> clusterLink = (*photonItr)->clusterElementLink();
@@ -178,14 +178,14 @@ namespace JiveXML {
           }
 	  /// get shower variables. Booked in AtlantisJava/event.dtd:
           // emWeight|et37|etCone|etHad1|f1|fracs1|pionWeight
-	  const EMShower* m_EMShower = (*photonItr)->detail<EMShower>("egDetailAOD");
-	  if (m_EMShower) {
+	  const EMShower* emShower = (*photonItr)->detail<EMShower>("egDetailAOD");
+	  if (emShower) {
 	    //if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG)  << "found photon shower, example wtots=" 
-	    //      << m_EMShower->parameter(egammaParameters::wtots1) << endmsg;
-	    f1Vec.push_back(    DataType( m_EMShower->parameter(egammaParameters::f1) )); 
-            etConeVec.push_back(DataType( m_EMShower->parameter(egammaParameters::etcone20)));
-            fracs1Vec.push_back(DataType( m_EMShower->parameter(egammaParameters::fracs1)));
-            et37Vec.push_back(   DataType( m_EMShower->parameter(egammaParameters::e237)));
+	    //      << emShower->parameter(egammaParameters::wtots1) << endmsg;
+	    f1Vec.push_back(    DataType( emShower->parameter(egammaParameters::f1) )); 
+            etConeVec.push_back(DataType( emShower->parameter(egammaParameters::etcone20)));
+            fracs1Vec.push_back(DataType( emShower->parameter(egammaParameters::fracs1)));
+            et37Vec.push_back(   DataType( emShower->parameter(egammaParameters::e237)));
           }else{ //placeholders if no shower available
 	    f1Vec.push_back( DataType( -1.)); 
             etConeVec.push_back(DataType( -1. ));
@@ -208,35 +208,35 @@ namespace JiveXML {
         isEMString.push_back( DataType( photonIsEMString ) );
     }
     // four-vectors
-    m_DataMap["phi"] = phi;
-    m_DataMap["eta"] = eta;
-    m_DataMap["pt"] = pt;
-    m_DataMap["energy"] = energy;
-    m_DataMap["mass"] = mass;
-    m_DataMap["px"] = px;
-    m_DataMap["py"] = py;
-    m_DataMap["pz"] = pz;
+    DataMap["phi"] = phi;
+    DataMap["eta"] = eta;
+    DataMap["pt"] = pt;
+    DataMap["energy"] = energy;
+    DataMap["mass"] = mass;
+    DataMap["px"] = px;
+    DataMap["py"] = py;
+    DataMap["pz"] = pz;
 
     // further details and associations
-    m_DataMap["isEM"] = isEM;
-    m_DataMap["clusterKey"] = clusterKeyVec;
-    m_DataMap["clusterIndex"] = clusterIndexVec;
+    DataMap["isEM"] = isEM;
+    DataMap["clusterKey"] = clusterKeyVec;
+    DataMap["clusterIndex"] = clusterIndexVec;
     // shower details
-    m_DataMap["f1"] = f1Vec;
-    m_DataMap["etCone"] = etConeVec;
-    m_DataMap["fracs1"] = fracs1Vec;
-    m_DataMap["et37"] = et37Vec;
+    DataMap["f1"] = f1Vec;
+    DataMap["etCone"] = etConeVec;
+    DataMap["fracs1"] = fracs1Vec;
+    DataMap["et37"] = et37Vec;
 
-    m_DataMap["author"] = author;
-    m_DataMap["isEMString"] = isEMString;
-    m_DataMap["label"] = label;
+    DataMap["author"] = author;
+    DataMap["isEMString"] = isEMString;
+    DataMap["label"] = label;
 
     if (msgLvl(MSG::DEBUG)) {
       msg(MSG::DEBUG) << dataTypeName() << " retrieved with " << phi.size() << " entries"<< endmsg;
     }
 
     //All collections retrieved okay
-    return m_DataMap;
+    return DataMap;
 
   } // retrieve
 
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/TauJetRetriever.cxx b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/TauJetRetriever.cxx
index 581a15c60f91f4edca55bafab921ee000f19b766..2a4c58cebcde7bbf16166831035912867f95b5ae 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/TauJetRetriever.cxx
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/TauJetRetriever.cxx
@@ -29,7 +29,7 @@ namespace JiveXML {
    **/
   TauJetRetriever::TauJetRetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("TauJet"){
+    m_typeName("TauJet"){
 
     //Only declare the interface
     declareInterface<IDataRetriever>(this);
@@ -107,7 +107,7 @@ namespace JiveXML {
     
     if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "in getData()" << endmsg;
 
-    DataMap m_DataMap;
+    DataMap DataMap;
 
     DataVect phi; phi.reserve(taucont->size());
     DataVect eta; eta.reserve(taucont->size());
@@ -144,16 +144,16 @@ namespace JiveXML {
     Analysis::TauJetContainer::const_iterator taujetItr  = taucont->begin();
     Analysis::TauJetContainer::const_iterator taujetItrE = taucont->end();
 
-  ParticleDataType::DataType m_dataType;
-  bool m_checkDataType=true;
+  ParticleDataType::DataType dataType;
+  bool checkDataType=true;
 
   if ( taujetItr != taujetItrE) {
-    m_dataType = (*taujetItr)->dataType();
-    m_checkDataType = (m_dataType != ParticleDataType::Fast) && 
-                      (m_dataType != ParticleDataType::True);
+    dataType = (*taujetItr)->dataType();
+    checkDataType = (dataType != ParticleDataType::Fast) && 
+                      (dataType != ParticleDataType::True);
   }
 
-  if(m_checkDataType){
+  if(checkDataType){
      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " TauJet Datatype: Full Sim " << endmsg;
   }else{     
      if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " TauJet Datatype: Fast Sim " << endmsg;
@@ -167,7 +167,7 @@ namespace JiveXML {
   std::string trackIndexString = "trackIndex";
 
   if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " Number of TauJets: " << taucont->size() << endmsg;
-  if (m_checkDataType && !m_fastSimSGFlag){ // full sim
+  if (checkDataType && !m_fastSimSGFlag){ // full sim
    for (; taujetItr != taujetItrE; ++taujetItr) { // first, just count trackKey for multiple
       const ElementLinkVector<Rec::TrackParticleContainer> myTrackLinkVector = (*taujetItr)->trackLinkVector();
       countTrackLinks += myTrackLinkVector.size();  
@@ -200,7 +200,7 @@ namespace JiveXML {
     energy.push_back( JiveXML::DataType((*taujetItr)->m()/CLHEP::GeV ) ); 
     mass.push_back( JiveXML::DataType((*taujetItr)->e()/CLHEP::GeV ) ); 
 
-   if (m_checkDataType && !m_fastSimSGFlag) { // full sim
+   if (checkDataType && !m_fastSimSGFlag) { // full sim
 
     std::string taujetAuthor = "none";
     if (( (*taujetItr)->author()) == 0){ taujetAuthor = "default"; } 
@@ -309,41 +309,41 @@ namespace JiveXML {
   } // end tau iterator
 
     // four-vectors
-    m_DataMap["phi"] = phi;
-    m_DataMap["eta"] = eta;
-    m_DataMap["pt"] = pt;
-    m_DataMap["energy"] = energy;
-    m_DataMap["mass"] = mass;
-    m_DataMap["px"] = px;
-    m_DataMap["py"] = py;
-    m_DataMap["pz"] = pz;
+    DataMap["phi"] = phi;
+    DataMap["eta"] = eta;
+    DataMap["pt"] = pt;
+    DataMap["energy"] = energy;
+    DataMap["mass"] = mass;
+    DataMap["px"] = px;
+    DataMap["py"] = py;
+    DataMap["pz"] = pz;
 
     // special tau parameters
-    m_DataMap["isTauString"] = isTauString;
-    m_DataMap["label"] = label;
-    m_DataMap["numTracks"] = numTracks;
-    m_DataMap["charge"] = charge;
-    m_DataMap["author"] = author;
-    m_DataMap["etEMCalib"] = etEMCalib;
-    m_DataMap["etHadCalib"] = etHadCalib;
-    m_DataMap["emRadius"] = emRadius;
-    m_DataMap["isolFrac"] = isolFrac;
-    m_DataMap["stripWidth"] = stripWidth;
-    m_DataMap["logLhRatio"] = logLhRatio;
-//    m_DataMap["isTau"] = isTau;
+    DataMap["isTauString"] = isTauString;
+    DataMap["label"] = label;
+    DataMap["numTracks"] = numTracks;
+    DataMap["charge"] = charge;
+    DataMap["author"] = author;
+    DataMap["etEMCalib"] = etEMCalib;
+    DataMap["etHadCalib"] = etHadCalib;
+    DataMap["emRadius"] = emRadius;
+    DataMap["isolFrac"] = isolFrac;
+    DataMap["stripWidth"] = stripWidth;
+    DataMap["logLhRatio"] = logLhRatio;
+//    DataMap["isTau"] = isTau;
     // associations
-    m_DataMap["clusterKey"] = clusterKeyVec;
-    m_DataMap["clusterIndex"] = clusterIndexVec;
-    m_DataMap[trackKeyString] = trackKeyVec;
-    m_DataMap[trackIndexString] = trackIndexVec;
-    m_DataMap["trackLinkCount"] = trackLinkCountVec;
+    DataMap["clusterKey"] = clusterKeyVec;
+    DataMap["clusterIndex"] = clusterIndexVec;
+    DataMap[trackKeyString] = trackKeyVec;
+    DataMap[trackIndexString] = trackIndexVec;
+    DataMap["trackLinkCount"] = trackLinkCountVec;
 
     if (msgLvl(MSG::DEBUG)) {
       msg(MSG::DEBUG) << dataTypeName() << " retrieved with " << phi.size() << " entries"<< endmsg;
     }
 
     //All collections retrieved okay
-    return m_DataMap;
+    return DataMap;
 
   } // retrieve
 
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/TrackParticleRetriever.cxx b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/TrackParticleRetriever.cxx
index 226711bb24b7cafbbb06fc1e9bf7f8dc989c587c..fc6c4577ee0dc683549bb6ccb38ecd6555c4ad4f 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/TrackParticleRetriever.cxx
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/TrackParticleRetriever.cxx
@@ -24,7 +24,7 @@ namespace JiveXML {
    **/
   TrackParticleRetriever::TrackParticleRetriever(const std::string& type,const std::string& name,const IInterface* parent):
     AthAlgTool(type,name,parent),
-    typeName("Track"){
+    m_typeName("Track"){
 
       //Declare the interface
       declareInterface<IDataRetriever>(this);
@@ -326,36 +326,36 @@ namespace JiveXML {
       } // end loop over tracks in collection
 
       //Now fill everything in a datamap
-      DataMap m_DataMap;
+      DataMap DataMap;
       // Start with mandatory entries
-      m_DataMap["id"] = id;
-      m_DataMap["chi2"] = chi2;
-      m_DataMap["numDoF"] = numDoF;
-      m_DataMap["trackAuthor"] = trackAuthor;
-      m_DataMap["numPolyline"] = numPolyline;
-      // m_DataMap["label"] = labelStr; // need to add into event.dtd first
+      DataMap["id"] = id;
+      DataMap["chi2"] = chi2;
+      DataMap["numDoF"] = numDoF;
+      DataMap["trackAuthor"] = trackAuthor;
+      DataMap["numPolyline"] = numPolyline;
+      // DataMap["label"] = labelStr; // need to add into event.dtd first
      
       // if perigee parameters are not available, leave the corresponding subtags empty.
       // This way atlantis knows that such tracks can only be displayed as polylines.
       if (pt.size() > 0){
-        m_DataMap["pt"] = pt;
-        m_DataMap["d0"] = d0;
-        m_DataMap["z0"] = z0;
-        m_DataMap["phi0"] = phi0;
-        m_DataMap["cotTheta"] = cotTheta;
-        m_DataMap["covMatrix multiple=\"15\""] = covMatrix;
+        DataMap["pt"] = pt;
+        DataMap["d0"] = d0;
+        DataMap["z0"] = z0;
+        DataMap["phi0"] = phi0;
+        DataMap["cotTheta"] = cotTheta;
+        DataMap["covMatrix multiple=\"15\""] = covMatrix;
       }
 
       // vectors with measurement, maximum 3 for TrackParticle (perigee, calo entry, muon entry)
       if ( polylineX.size() > 0){
         std::string numPolyPerTrack = DataType(polylineX.size()/((double)id.size())).toString();
-        m_DataMap["polylineX multiple=\"" + numPolyPerTrack + "\""] = polylineX;
-        m_DataMap["polylineY multiple=\"" + numPolyPerTrack + "\""] = polylineY;
-        m_DataMap["polylineZ multiple=\"" + numPolyPerTrack + "\""] = polylineZ;
+        DataMap["polylineX multiple=\"" + numPolyPerTrack + "\""] = polylineX;
+        DataMap["polylineY multiple=\"" + numPolyPerTrack + "\""] = polylineY;
+        DataMap["polylineZ multiple=\"" + numPolyPerTrack + "\""] = polylineZ;
       }
 
       //forward data to formating tool
-      if ( FormatTool->AddToEvent(dataTypeName(), collectionName, &m_DataMap).isFailure())
+      if ( FormatTool->AddToEvent(dataTypeName(), collectionName, &DataMap).isFailure())
             return StatusCode::RECOVERABLE;
       
       //Be verbose
diff --git a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/TruthParticleRetriever.cxx b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/TruthParticleRetriever.cxx
index 166b5d82a0c466c6c45f6d195ff980e75ddd362c..6c9cfe7e43a550418bda3f2e51d86eaea2382fbb 100755
--- a/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/TruthParticleRetriever.cxx
+++ b/PhysicsAnalysis/AnalysisEventDisplay/AnalysisJiveXML/src/TruthParticleRetriever.cxx
@@ -66,7 +66,7 @@ namespace JiveXML {
     std::string truthLabels;
     std::string statusList="_";
     std::string typeLabel="n_a";
-    int m_pdgId;
+    int pdgId2;
     int motherPdgId;
     int childPdgId;
     int countTruth = 1;
@@ -88,13 +88,13 @@ namespace JiveXML {
 */     
      if ( abs( (*mcpartItr)->pdgId()) > m_truthMaximumPdgId ){ continue; }
 
-     m_pdgId = (*mcpartItr)->pdgId();
+     pdgId2 = (*mcpartItr)->pdgId();
 
      // important particles are protected (can come from gamma etc)
-     if (( abs(m_pdgId) == 24 ) || ( abs(m_pdgId) == 5 ) ||  
-          ( abs(m_pdgId) == 6 ) || ( abs(m_pdgId) == 23 ) ||  
-          ( abs(m_pdgId) == 36 ) || ( abs(m_pdgId) == 37 ) || 
-          ( abs(m_pdgId) == 25 ) ){ 
+     if (( abs(pdgId2) == 24 ) || ( abs(pdgId2) == 5 ) ||  
+          ( abs(pdgId2) == 6 ) || ( abs(pdgId2) == 23 ) ||  
+          ( abs(pdgId2) == 36 ) || ( abs(pdgId2) == 37 ) || 
+          ( abs(pdgId2) == 25 ) ){ 
 	 protectedParticleFlag = true; 
      }
 
@@ -103,11 +103,11 @@ namespace JiveXML {
       bool motherHasPdgId = (*mcpartItr)->mother(iMother)->hasPdgId(); 
        if ( motherHasPdgId ){ 
          motherPdgId = (*mcpartItr)->mother(iMother)->pdgId();       
-         if ( motherPdgId == m_pdgId ){ samePdgIdFlag = true; }
+         if ( motherPdgId == pdgId2 ){ samePdgIdFlag = true; }
          if (( abs(motherPdgId) == 24 ) || ( abs(motherPdgId) == 5 ) ||  
           ( abs(motherPdgId) == 6 ) || ( abs(motherPdgId) == 23 ) ||  
           ( abs(motherPdgId) == 36 ) || ( abs(motherPdgId) == 37 ) || 
-	  ( abs(m_pdgId) == 25 ) ){ 
+	  ( abs(pdgId2) == 25 ) ){ 
 	      initialProcessFlag = true; 
 	 }
        }
@@ -132,26 +132,26 @@ namespace JiveXML {
 // if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " TruthParticle No:" << countTruth << " pt:" 
 //                << (*mcpartItr)->et()/CLHEP::GeV << endmsg;
 	  
-     pdgId.push_back( DataType( m_pdgId ));
+     pdgId.push_back( DataType( pdgId2 ));
 
      typeLabel = "n_a";
-     if( abs(m_pdgId) == 11) typeLabel = "Electron";
-     if( abs(m_pdgId) == 12) typeLabel = "NeutrinoElectron";
-     if( abs(m_pdgId) == 13) typeLabel = "Muon";
-     if( abs(m_pdgId) == 14) typeLabel = "NeutrinoMuon";
-     if( abs(m_pdgId) == 15) typeLabel = "Tau";
-     if( abs(m_pdgId) == 16) typeLabel = "NeutrinoTau";
-     if( m_pdgId == 6) typeLabel = "Top";  
-     if( m_pdgId == -6) typeLabel = "AntiTop";  
-     if( m_pdgId == 5) typeLabel = "Bottom";
-     if( m_pdgId == -5) typeLabel = "AntiBottom";
-     if( m_pdgId == 22) typeLabel = "Photon";
-     if( m_pdgId == 23) typeLabel = "Z0";
-     if( m_pdgId == 24) typeLabel = "Wplus";
-     if( m_pdgId == -24) typeLabel = "Wminus";
-     if( m_pdgId == 36) typeLabel = "A0";
-     if( m_pdgId == 25) typeLabel = "Higgs0";
-     if(( abs(m_pdgId) >= 1) && ( abs(m_pdgId) <= 4)) typeLabel = "LightQuark"; 
+     if( abs(pdgId2) == 11) typeLabel = "Electron";
+     if( abs(pdgId2) == 12) typeLabel = "NeutrinoElectron";
+     if( abs(pdgId2) == 13) typeLabel = "Muon";
+     if( abs(pdgId2) == 14) typeLabel = "NeutrinoMuon";
+     if( abs(pdgId2) == 15) typeLabel = "Tau";
+     if( abs(pdgId2) == 16) typeLabel = "NeutrinoTau";
+     if( pdgId2 == 6) typeLabel = "Top";  
+     if( pdgId2 == -6) typeLabel = "AntiTop";  
+     if( pdgId2 == 5) typeLabel = "Bottom";
+     if( pdgId2 == -5) typeLabel = "AntiBottom";
+     if( pdgId2 == 22) typeLabel = "Photon";
+     if( pdgId2 == 23) typeLabel = "Z0";
+     if( pdgId2 == 224) typeLabel = "Wplus";
+     if( pdgId2 == -24) typeLabel = "Wminus";
+     if( pdgId2 == 36) typeLabel = "A0";
+     if( pdgId2 == 25) typeLabel = "Higgs0";
+     if(( abs(pdgId2) >= 1) && ( abs(pdgId2) <= 4)) typeLabel = "LightQuark"; 
    
      typeEV.push_back( DataType( typeLabel ) );
 
diff --git a/PhysicsAnalysis/AssociationBuilder/AssociationComps/share/Association_jobOption.py b/PhysicsAnalysis/AssociationBuilder/AssociationComps/share/Association_jobOption.py
deleted file mode 100644
index e0d8c5a305b1717ade5a648cdbc9c27f00e8cc8d..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/AssociationBuilder/AssociationComps/share/Association_jobOption.py
+++ /dev/null
@@ -1,85 +0,0 @@
-#===================================================================================
-# Name:        jobOptionFragment.py
-# Author:      Karsten Koeneke (karsten.koeneke@cernSPAMNOT.ch)
-# Date:        March 2010
-# Description: This is a small example job option fragment that shows you how to
-#              use the AnalysisAssociationUtils; example only... use your imagination :-)
-# Usage:       Modify the D2PD_topOptions.py in D2PDMaker/share/ to load this file
-#              and then execute those topOptions. The line you should add there is
-#              something like this:
-#              rec.DPDMakerScripts.append("path/to/your/testarea/PhysicsAnalysis/AnalysisCommon/AnalysisAssociationUtils/share/Association_jobOption.py")
-#
-#===================================================================================
-
-
-## Import the module that allows to use named units, e.g. GeV
-import AthenaCommon.SystemOfUnits as Units
-
-
-## This handels multiple output streams
-from OutputStreamAthenaPool.MultipleStreamManager import MSMgr 
-
-
-# declare "topSequence", the top sequencer which manages all algorithms.
-from AthenaCommon.AlgSequence import AlgSequence
-topSequence = AlgSequence()
-
-## Get the tool service
-from AthenaCommon.AppMgr import ToolSvc
-
-
-# DeltaR matching
-from AnalysisAssociationUtils.AnalysisAssociationUtilsConf import DeltaRAssociationTool
-ToolSvc += DeltaRAssociationTool( "ElectronDeltaRAssociationTool",
-                                  inputAssociateToCollection = "SpclMC",
-                                  deltaRMax                  = 0.1,
-                                  userDataSvc                = "UserDataInExampleMatchStream",
-                                  userDataPrefix             = "el_",
-                                  writeUserData              = True
-                                  )
-
-
-# Get the AssociationAlgorithm and schedule the AssociationTools
-from AnalysisAssociationUtils.AnalysisAssociationUtilsConf import AssociationAlgorithm
-topSequence += AssociationAlgorithm( "ElectronAssociationAlgorithm",
-                                     inputCollection              = "ElectronAODCollection",
-                                     associationTools             = [ ToolSvc.ElectronDeltaRAssociationTool ],
-                                     outputAssociationCollections = [ "ElectronMCTruthClassifierMatch", "ElectronDeltaRTruthMatch" ],
-                                     dumpStoreGate                = True
-                                     )
-
-
-# This stream HAS TO start with "StreamD2AODM_"! If the input was an (D)ESD(M), this should start with "StreamD2ESD(M)_".
-# See this twiki for more information: https://twiki.cern.ch/twiki/bin/view/AtlasProtected/DPDNamingConvention
-streamName = "StreamD2AOD_MyMatchTest"
-fileName   = D2PDFlags.OutputDirectoryName() + "MyMatchTestStream.pool.root"
-ExampleMatchStream = MSMgr.NewPoolStream( streamName, fileName )
-
-
-
-
-#---------------------------------------------------
-# Add the containers to the output stream
-#---------------------------------------------------
-from PrimaryDPDMaker import PrimaryDPD_OutputDefinitions as dpdOutput
-# Take all items from the input, except for the ones listed in the excludeList
-# If the excludeList is empty, all containers from the input file (e.g. AOD)
-# are copied to the output file.
-excludeList = []
-excludeList = list(set(excludeList)) # This removes dublicates from the list
-dpdOutput.addAllItemsFromInputExceptExcludeList( streamName, excludeList )
-
-
-# Add the created match containers to the output file
-ExampleMatchStream.AddItem( ['INav4MomAssocs#ElectronMCTruthClassifierMatch'] )
-ExampleMatchStream.AddItem( ['INav4MomAssocs#ElectronDeltaRTruthMatch'] )
-
-
-
-
-#====================================================================
-# UserDataSvc, only really needed/used when UserData is computed...
-#====================================================================
-from AthenaServices.TheUserDataSvc import TheUserDataSvc
-svcMgr += TheUserDataSvc("UserDataInExampleMatchStream")
-svcMgr.UserDataInExampleMatchStream.OutputStream = ExampleMatchStream.Stream
diff --git a/PhysicsAnalysis/AssociationBuilder/AssociationComps/src/DeltaRAssociationTool.cxx b/PhysicsAnalysis/AssociationBuilder/AssociationComps/src/DeltaRAssociationTool.cxx
index 291b7640455b39d87219d2d6260bfe0dca1d10d8..0247b144cbbae95c9ea4a8f14458729038480865 100644
--- a/PhysicsAnalysis/AssociationBuilder/AssociationComps/src/DeltaRAssociationTool.cxx
+++ b/PhysicsAnalysis/AssociationBuilder/AssociationComps/src/DeltaRAssociationTool.cxx
@@ -100,7 +100,6 @@ StatusCode DeltaRAssociationTool::initialize()
   ATH_MSG_DEBUG ( "==> initialize " << name() << "..." );
   ATH_MSG_DEBUG ( " using inputAssociateToCollection      = " << m_matchToCollKey );
   ATH_MSG_DEBUG ( " using userDataPrefix                  = " << m_userDataPrefix );
-  ATH_MSG_DEBUG ( " using writeUserData                   = " << m_writeUserData );
   ATH_MSG_DEBUG ( " using userDataMatchDeltaRName         = " << m_userDataMatchDeltaRName );
   ATH_MSG_DEBUG ( " using storeOnlyBestMatch              = " << m_storeOnlyBestMatch );
   ATH_MSG_DEBUG ( " using useMatchFromCaloClusterPosition = " << m_useMatchFromCaloClusterPosition );
@@ -111,6 +110,10 @@ StatusCode DeltaRAssociationTool::initialize()
   ATH_MSG_DEBUG ( " using doSpecialMuElFSRMatch           = " << m_doFsr );
 
   // Do some sanity checks on the user configuration
+  if (m_writeUserData) {
+    ATH_MSG_WARNING ("Writing to UserData requested, but UserDataSvc is obsolete.");
+  }
+
   if ( m_matchToCollKey.empty() )
     {
       ATH_MSG_ERROR ( "Empty inputAssociateToCollection! Please configure it properly!"
@@ -377,18 +380,6 @@ StatusCode DeltaRAssociationTool::calculateAssociations( const INavigable4Moment
                 } // End: if ( thisMatchLink.isValid() )
             }
         } // End: Loop over all sorted pairs
-
-
-      
-      
-
-      // Now, save the result to UserData, if wanted
-      if ( m_writeUserData )
-        {
-          ATH_CHECK ( userStore()->record( *object,
-                                           m_userDataMatchDeltaRName,
-                                           *m_resultVecDeltaR ) );
-        } // End: if ( m_writeUserData )
     } // End: if ( object != NULL )
 
   return StatusCode::SUCCESS;
diff --git a/PhysicsAnalysis/D3PDMaker/D3PDMakerCoreComps/src/UserDataFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/D3PDMakerCoreComps/src/UserDataFillerTool.cxx
deleted file mode 100644
index 9fd528afa1f7f720a31acef558fdc20c09442cee..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/D3PDMaker/D3PDMakerCoreComps/src/UserDataFillerTool.cxx
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: UserDataFillerTool.cxx 635137 2014-12-10 18:34:44Z ssnyder $
-/**
- * @file D3PDMakerCoreComps/src/UserDataFillerTool.cxx
- * @author scott snyder <snyder@bnl.gov>
- * @date Nov, 2009
- * @brief Copy data from UserDataSvc to D3PD.
- */
-
-
-#include "UserDataFillerTool.h"
-#include "Navigation/IAthenaBarCode.h"
-#include "AthenaKernel/errorcheck.h"
-#include "TROOT.h"
-#include "boost/foreach.hpp"
-
-
-namespace D3PD {
-
-
-/**
- * @brief Constructor.
- * @param the_name Name of the variable.
- * @param the_docstring Docstring for the variable.
- * @param the_label UserData label of the variable.
- * @param the_type Type of the variable.
- */
-UserDataFillerTool::Var::Var (const std::string& the_name,
-                              const std::string& the_docstring,
-                              const std::string& the_label,
-                              const RootUtils::Type& the_type)
-  : name (the_name),
-    docstring (the_docstring),
-    label (the_label),
-    type (the_type),
-    ptr (0)
-{
-}
-
-
-/**
- * @brief Standard Gaudi tool constructor.
- * @param type The name of the tool type.
- * @param name The tool name.
- * @param parent The tool's Gaudi parent.
- */
-UserDataFillerTool::UserDataFillerTool (const std::string& type,
-                                        const std::string& name,
-                                        const IInterface* parent)
-  : BlockFillerTool<IAthenaBarCode> (type, name, parent),
-    m_userDataSvc ("UserDataSvc", name)
-{
-  declareProperty ("UserDataSvc", m_userDataSvc,
-                   "The UserDataSvc");
-
-  declareProperty ("UDPrefix", m_udprefix,
-                   "Prefix to add to UD labels.");
-
-  declareProperty ("Vars", m_varString,
-                   "Specify variables to fill.\n"
-                   "A sequence of VAR, LABEL, TYPE.\n"
-                   "VAR is the D3PD variable name.  "
-                   "It may contain a comment following a colon.\n"
-                   "LABEL is the UDS label.  If blank, defaults to VAR.\n"
-                   "TYPE is the name of the UD type.");
-}
-
-
-/**
- * @brief Standard Gaudi initialize method.
- */
-StatusCode UserDataFillerTool::initialize()
-{
-  CHECK( m_userDataSvc.retrieve() );
-  return BlockFillerTool<IAthenaBarCode>::initialize();
-}
-
-
-/**
- * @brief Book variables for this block.
- */
-StatusCode UserDataFillerTool::book()
-{
-  CHECK( parseVars() );
-  BOOST_FOREACH (Var& v, m_vars) {
-    std::string docstring = "[UserData: ";
-    docstring += v.label;
-    docstring += "] ";
-    docstring += v.docstring;
-    CHECK( addVariable (v.name, *v.type.getTypeInfo(), v.ptr, docstring) );
-  }
-  return StatusCode::SUCCESS;
-}
-
-
-/**
- * @brief Fill one block --- type-safe version.
- * @param p The input object.
- *
- * This is called once per object.  The caller
- * is responsible for arranging that all the pointers for booked variables
- * are set appropriately upon entry.
- */
-StatusCode UserDataFillerTool::fill (const IAthenaBarCode& p)
-{
-  BOOST_FOREACH (Var& v, m_vars) {
-    void* ptr = 0;
-    if (m_userDataSvc->vgetInMemElementDecoration (p,
-                                                   v.label,
-                                                   *v.type.getTypeInfo(),
-                                                   ptr,
-                                                   true) != 0)
-    {
-      if (m_userDataSvc->vgetElementDecoration (p,
-                                                v.label,
-                                                *v.type.getTypeInfo(),
-                                                ptr))
-      {
-        REPORT_MESSAGE(MSG::ERROR)
-          << "Can't find UserData element variable " << v.label;
-        return StatusCode::RECOVERABLE;
-      }
-    }
-
-    v.type.assign (v.ptr, ptr);
-  }
-
-  return StatusCode::SUCCESS;
-}
-
-
-/**
- * @brief Parse the variables property and fill @c m_vars.
- */
-StatusCode UserDataFillerTool::parseVars()
-{
-  for (size_t i = 0; i+3 <= m_varString.size(); i += 3) {
-    std::string name = m_varString[i];
-
-    std::string docstring;
-    std::string::size_type ipos = name.find (":");
-    if (ipos != std::string::npos) {
-      docstring = name.substr (ipos+1, std::string::npos);
-      name = name.substr (0, ipos);
-    }
-
-    std::string label = m_varString[i+1];
-    if (label.empty())
-      label = name;
-    RootUtils::Type type;
-    try {
-      type = RootUtils::Type (m_varString[i+2]);
-    }
-    catch (std::runtime_error&) {
-      gROOT->GetClass (m_varString[i+2].c_str());
-      try {
-        type = RootUtils::Type (m_varString[i+2]);
-      }
-      catch (std::runtime_error&) {
-        REPORT_MESSAGE(MSG::ERROR) << "Can't find type "
-                                   << m_varString[i+2];
-        return StatusCode::FAILURE;
-      }
-    }
-
-    m_vars.push_back (Var (name, docstring, m_udprefix + label, type));
-  }
-  return StatusCode::SUCCESS;
-}
-
-
-} // namespace D3PD
diff --git a/PhysicsAnalysis/D3PDMaker/D3PDMakerCoreComps/src/UserDataFillerTool.h b/PhysicsAnalysis/D3PDMaker/D3PDMakerCoreComps/src/UserDataFillerTool.h
deleted file mode 100644
index c757ffcf7d94452ad70330bb8dacc83e7bf12969..0000000000000000000000000000000000000000
--- a/PhysicsAnalysis/D3PDMaker/D3PDMakerCoreComps/src/UserDataFillerTool.h
+++ /dev/null
@@ -1,125 +0,0 @@
-// This file's extension implies that it's C, but it's really -*- C++ -*-.
-
-/*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
-*/
-
-// $Id: UserDataFillerTool.h 635137 2014-12-10 18:34:44Z ssnyder $
-/**
- * @file D3PDMakerCoreComps/src/UserDataFillerTool.h
- * @author scott snyder <snyder@bnl.gov>
- * @date Nov, 2009
- * @brief Copy data from UserDataSvc to D3PD.
- */
-
-#ifndef D3PDMAKERCORECOMPS_USERDATAFILLERTOOL_H
-#define D3PDMAKERCORECOMPS_USERDATAFILLERTOOL_H
-
-
-#include "D3PDMakerUtils/BlockFillerTool.h"
-#include "AthenaKernel/IUserDataSvc.h"
-#include "RootUtils/Type.h"
-#include "GaudiKernel/ServiceHandle.h"
-#include <vector>
-#include <string>
-class IAthenaBarCode;
-
-
-namespace D3PD {
-
-
-/**
- * @brief Copy data from UserDataSvc to D3PD.
- */
-class UserDataFillerTool
-  : public BlockFillerTool<IAthenaBarCode>
-{
-public:
-  /**
-   * @brief Standard Gaudi tool constructor.
-   * @param type The name of the tool type.
-   * @param name The tool name.
-   * @param parent The tool's Gaudi parent.
-   */
-  UserDataFillerTool (const std::string& type,
-                      const std::string& name,
-                      const IInterface* parent);
-
-
-  /// Standard Gaudi initialize method.
-  virtual StatusCode initialize();
-
-
-  /// Book variables for this block.
-  virtual StatusCode book();
-
-
-  /**
-   * @brief Fill one block --- type-safe version.
-   * @param p The input object.
-   *
-   * This is called once per object.  The caller
-   * is responsible for arranging that all the pointers for booked variables
-   * are set appropriately upon entry.
-   */
-  virtual StatusCode fill (const IAthenaBarCode& p);
-
-
-private:
-  /// Parse the variables property and fill @c m_vars.
-  StatusCode parseVars();
-
-  /// Property: The UserDataSvc.
-  ServiceHandle<IUserDataSvc> m_userDataSvc;
-
-  /// Property: Prefix to add to UD labels.
-  std::string m_udprefix;
-
-  /// Property: Specify variables to fill.
-  /// A sequence of VAR, LABEL, TYPE
-  /// VAR is the D3PD variable name.
-  /// LABEL is the UDS label.  If blank, defaults to VAR.
-  /// TYPE is the name of the UD type.
-  std::vector<std::string> m_varString;
-
-
-  /// Describe one variable.
-  struct Var
-  {
-    /**
-     * @brief Constructor.
-     * @param the_name Name of the variable.
-     * @param the_docstring Docstring for the variable.
-     * @param the_label UserData label of the variable.
-     * @param the_type Type of the variable.
-     */
-    Var (const std::string& the_name,
-         const std::string& the_docstring,
-         const std::string& the_label,
-         const RootUtils::Type& the_type);
-
-    /// Name of the variable.
-    std::string name;
-
-    /// Docstring for the variable.
-    std::string docstring;
-
-    /// UserData label to read.
-    std::string label;
-
-    /// Type of the variable.
-    RootUtils::Type type;
-
-    /// Pointer passed to @c ID3PD.
-    void* ptr;
-  };
-
-  /// Parsed list of variables.
-  std::vector<Var> m_vars;
-};
-
-
-} // namespace D3PD
-
-
-#endif // not D3PDMAKERCORECOMPS_USERDATAFILLERTOOL_H
diff --git a/PhysicsAnalysis/D3PDMaker/D3PDMakerCoreComps/src/components/D3PDMakerCoreComps_entries.cxx b/PhysicsAnalysis/D3PDMaker/D3PDMakerCoreComps/src/components/D3PDMakerCoreComps_entries.cxx
index e255d4d1ba94db58cb620acab62c1d88f7d04886..473504cc0d06978af9581880897d9531663cb98e 100644
--- a/PhysicsAnalysis/D3PDMaker/D3PDMakerCoreComps/src/components/D3PDMakerCoreComps_entries.cxx
+++ b/PhysicsAnalysis/D3PDMaker/D3PDMakerCoreComps/src/components/D3PDMakerCoreComps_entries.cxx
@@ -13,7 +13,6 @@
 #include "../IndexMultiAssociationFillerTool.h"
 #include "../SGObjGetterTool.h"
 #include "../SGDataVectorGetterTool.h"
-#include "../UserDataFillerTool.h"
 #include "../AuxDataFillerTool.h"
 #include "../SelectedParticlesFilterTool.h"
 #include "../ContainerFlagFillerTool.h"
@@ -36,7 +35,6 @@ DECLARE_COMPONENT( D3PD::ContainedVectorMultiAssociationFillerTool )
 DECLARE_COMPONENT( D3PD::IndexMultiAssociationFillerTool )
 DECLARE_COMPONENT( D3PD::SGObjGetterTool )
 DECLARE_COMPONENT( D3PD::SGDataVectorGetterTool )
-DECLARE_COMPONENT( D3PD::UserDataFillerTool )
 DECLARE_COMPONENT( D3PD::AuxDataFillerTool )
 DECLARE_COMPONENT( D3PD::SelectedParticlesFilterTool )
 DECLARE_COMPONENT( D3PD::ContainerFlagFillerTool )
diff --git a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthParticleFakerTool.cxx b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthParticleFakerTool.cxx
index 32e3788b9c49eba282ea9fb547170d0590b80120..18e0b34d9ba4f263bf144801e829d3021128529a 100644
--- a/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthParticleFakerTool.cxx
+++ b/PhysicsAnalysis/D3PDMaker/TruthD3PDMaker/src/TruthParticleFakerTool.cxx
@@ -71,7 +71,7 @@ StatusCode TruthParticleFakerTool::book()
 StatusCode TruthParticleFakerTool::fill (const HepMC::GenParticle& p)
 {
   if ( abs(p.pdg_id())!=m_filterID ||
-       p.momentum().perp()<m_minPt ) return IBlockFillerTool::EMPTY;
+       p.momentum().perp()<m_minPt ) return StatusCode(IBlockFillerTool::EMPTY);
 
   bool last = abs(p.pdg_id())==15;
   if ( abs(p.pdg_id())==15 && p.status()!=1 && p.end_vertex() ){
@@ -82,14 +82,14 @@ StatusCode TruthParticleFakerTool::fill (const HepMC::GenParticle& p)
       last=false;
       break;
     }
-    if (!last) return IBlockFillerTool::EMPTY;
+    if (!last) return StatusCode(IBlockFillerTool::EMPTY);
   }
 
   if ( !last &&
        p.status()%1000 != 1 &&
        !(p.status()%1000 == 2 && p.status()>1000) &&
        !(p.status()==2 && (!p.end_vertex() || p.end_vertex()->barcode()<-200000) ) ) {
-    return IBlockFillerTool::EMPTY;
+    return StatusCode(IBlockFillerTool::EMPTY);
   }
 
   HepMC::FourVector v = p.momentum();
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/src/SUSYSignalTagger.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/src/SUSYSignalTagger.cxx
index 44f5d803840cf408621cd4fac823b44c439257cb..39b1fe9a0e11d845c0d45cc84e080ba06d23e75f 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/src/SUSYSignalTagger.cxx
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/src/SUSYSignalTagger.cxx
@@ -57,7 +57,7 @@ namespace DerivationFramework {
     const xAOD::TruthParticleContainer* truthPC = 0;
     if (evtStore()->retrieve(truthPC,m_mcName).isFailure()) {
       ATH_MSG_DEBUG("WARNING could not retrieve TruthParticleContainer " <<m_mcName);
-      return -1;
+      return StatusCode::FAILURE;
     }
     
     //Identify SUSY hard proc
diff --git a/PhysicsAnalysis/HiggsPhys/HSG2/HSG2Event/CMakeLists.txt b/PhysicsAnalysis/HiggsPhys/HSG2/HSG2Event/CMakeLists.txt
index 8a4b872435104526c472f606182c90967cb93891..7dadb666fbb3d83b733ec14746944a313edf48fc 100644
--- a/PhysicsAnalysis/HiggsPhys/HSG2/HSG2Event/CMakeLists.txt
+++ b/PhysicsAnalysis/HiggsPhys/HSG2/HSG2Event/CMakeLists.txt
@@ -7,9 +7,8 @@ atlas_subdir( HSG2Event )
 
 # Declare the package's dependencies:
 atlas_depends_on_subdirs( PUBLIC
-                          Control/CLIDSvc
-                          Control/DataModel
-                          Control/SGTools
+                          Control/AthLinks
+                          Control/AthenaKernel
                           PhysicsAnalysis/AnalysisCommon/ParticleEvent
                           Tracking/TrkEvent/VxVertex )
 
@@ -21,12 +20,12 @@ atlas_add_library( HSG2Event
                    src/*.cxx
                    PUBLIC_HEADERS HSG2Event
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                   LINK_LIBRARIES DataModel SGTools ParticleEvent VxVertex
+                   LINK_LIBRARIES AthLinks AthenaKernel ParticleEvent VxVertex
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} )
 
 atlas_add_dictionary( HSG2EventDict
                       HSG2Event/HSG2EventDict.h
                       HSG2Event/selection.xml
                       INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${ROOT_LIBRARIES} DataModel SGTools ParticleEvent VxVertex HSG2Event )
+                      LINK_LIBRARIES ${ROOT_LIBRARIES} AthLinks AthenaKernel ParticleEvent VxVertex HSG2Event )
 
diff --git a/PhysicsAnalysis/HiggsPhys/HSG2/HSG2Event/HSG2Event/Quadruplet.h b/PhysicsAnalysis/HiggsPhys/HSG2/HSG2Event/HSG2Event/Quadruplet.h
index 51c27edc59b9b2322308fd511f8babc07c786da4..39d51c6919eaedef2728dffa079278cf1646ad4b 100644
--- a/PhysicsAnalysis/HiggsPhys/HSG2/HSG2Event/HSG2Event/Quadruplet.h
+++ b/PhysicsAnalysis/HiggsPhys/HSG2/HSG2Event/HSG2Event/Quadruplet.h
@@ -9,7 +9,7 @@
 #define HSG2Event_Quadruplet_H
 
 // EDM include(s):
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 #include "VxVertex/VxContainer.h"
 #include "ParticleEvent/CompositeParticleContainer.h"
 
diff --git a/PhysicsAnalysis/HiggsPhys/HSG2/HSG2Event/HSG2Event/QuadrupletContainer.h b/PhysicsAnalysis/HiggsPhys/HSG2/HSG2Event/HSG2Event/QuadrupletContainer.h
index 7c63eab7a43d06f49aea5844ca256110abb90106..26db4c336f84dc79592af4cbc0c60b3a5cd6dbea 100644
--- a/PhysicsAnalysis/HiggsPhys/HSG2/HSG2Event/HSG2Event/QuadrupletContainer.h
+++ b/PhysicsAnalysis/HiggsPhys/HSG2/HSG2Event/HSG2Event/QuadrupletContainer.h
@@ -9,9 +9,9 @@
 #define HSG2Event_QuadrupletContainer_H
 
 // Gaudi/Athena include(s):
-#include "DataModel/DataVector.h"
-#include "CLIDSvc/CLASS_DEF.h"
-#include "SGTools/BaseInfo.h"
+#include "AthContainers/DataVector.h"
+#include "AthenaKernel/CLASS_DEF.h"
+#include "AthenaKernel/BaseInfo.h"
 
 // Local include(s):
 #include "Quadruplet.h"
diff --git a/PhysicsAnalysis/JetMissingEtID/MissingEtDQA/src/PhysValMET.cxx b/PhysicsAnalysis/JetMissingEtID/MissingEtDQA/src/PhysValMET.cxx
index 661e1b9e2342eed8936896681ca186734e44d4c2..0b5a89c62814d578aa0acf6fef2e9d3241cf6550 100644
--- a/PhysicsAnalysis/JetMissingEtID/MissingEtDQA/src/PhysValMET.cxx
+++ b/PhysicsAnalysis/JetMissingEtID/MissingEtDQA/src/PhysValMET.cxx
@@ -747,9 +747,7 @@ namespace MissingEtDQA {
       }
       ConstDataVector<JetContainer> metJets(SG::VIEW_ELEMENTS);
       for(const auto& jet : *jets) {
-    	if(Accept(jet)) {
-    	  metJets.push_back(jet);
-    	}
+	    metJets.push_back(jet);
       }
       //Overlap Removal
       ConstDataVector<JetContainer> metJetsOR(SG::VIEW_ELEMENTS);
@@ -911,7 +909,7 @@ namespace MissingEtDQA {
       }
 
       // Jets
-      if( m_metmaker->rebuildJetMET("RefJet", "SoftClus", "PVSoftTrk", met_Reb, jets, coreMet, metMap, false).isFailure() ) {
+      if( m_metmaker->rebuildJetMET("RefJet", "SoftClus", "PVSoftTrk", met_Reb, jets, coreMet, metMap, true).isFailure() ) {
     	ATH_MSG_WARNING("Failed to build jet and soft terms.");
       }
       MissingETBase::Types::bitmask_t trksource = MissingETBase::Source::Track;
@@ -1196,13 +1194,15 @@ namespace MissingEtDQA {
     	}
       }
 
-      // For rebuilt MET add only jets with pT>20e3
+      // For rebuilt MET add only jets with pT>20e3 and JVT cut
       TLorentzVector jetReb_tlv;
       double sum_jetReb = 0;
-      for(jetc_itr = metJetsOR.begin(); jetc_itr != metJetsOR.end(); ++jetc_itr ) {
-    	if((*jetc_itr)->pt() > 20e3) {
-    	  jetReb_tlv += (*jetc_itr)->p4();
-    	  sum_jetReb += (*jetc_itr)->pt();
+      double JvtCut = 0.59;
+      if (type == "AntiKt4EMPFlow") JvtCut = 0.2;
+      for(const auto jet : metJetsOR) {
+    	if(Accept(jet, JvtCut)) {
+    	  jetReb_tlv += jet->p4();
+    	  sum_jetReb += jet->pt();
     	}
       }
 
@@ -1418,10 +1418,10 @@ namespace MissingEtDQA {
   bool PhysValMET::Accept(const xAOD::TauJet* tau)
   { return m_tauSelTool->accept( *tau ); }
 
-  bool PhysValMET::Accept(const xAOD::Jet* jet)
+  bool PhysValMET::Accept(const xAOD::Jet* jet, double JvtCut)
   {
-    if( jet->pt()<0e3) return false;
-    return (jet->eta() < 2.4 || jet->pt() > 50e3 || m_jvtTool->updateJvt(*jet) > 0.64);
+    if( jet->pt()<20e3) return false;
+    return (fabs(jet->eta()) > 2.4 || jet->pt() > 60e3 || m_jvtTool->updateJvt(*jet) > JvtCut);
   }
 
   /////////////////////////////////////////////////////////////////// 
diff --git a/PhysicsAnalysis/JetMissingEtID/MissingEtDQA/src/PhysValMET.h b/PhysicsAnalysis/JetMissingEtID/MissingEtDQA/src/PhysValMET.h
index b8524c6158bf55488f81e86e9bfbf02f5a56564a..e257bdb454e10407fde061f207542c2e3b16a7c2 100644
--- a/PhysicsAnalysis/JetMissingEtID/MissingEtDQA/src/PhysValMET.h
+++ b/PhysicsAnalysis/JetMissingEtID/MissingEtDQA/src/PhysValMET.h
@@ -105,7 +105,7 @@ class PhysValMET
   bool Accept(const xAOD::Photon* ph);
   bool Accept(const xAOD::TauJet* tau);
   bool Accept(const xAOD::Muon* muon);
-  bool Accept(const xAOD::Jet* jet);
+  bool Accept(const xAOD::Jet* jet, double JvtCut);
 
   // vector of collections
   std::vector <std::string> types;
diff --git a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/StandAloneJetBTaggerAlg.cxx b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/StandAloneJetBTaggerAlg.cxx
index da9e1e6b0d7d0818d2d5e3c69302f92d52ad6993..06237e1adc98be192298130df117486e06a9e35f 100644
--- a/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/StandAloneJetBTaggerAlg.cxx
+++ b/PhysicsAnalysis/JetTagging/JetTagAlgs/BTagging/src/StandAloneJetBTaggerAlg.cxx
@@ -105,7 +105,7 @@ StatusCode StandAloneJetBTaggerAlg::execute() {
     ATH_MSG_VERBOSE("#BTAG# No Jet container " << m_JetCollectionName << " in store, no re-tagging");
   }
   
-  return 1;
+  return StatusCode::SUCCESS;
 
 }
 
diff --git a/PhysicsAnalysis/JetTagging/JetTagInfo/CMakeLists.txt b/PhysicsAnalysis/JetTagging/JetTagInfo/CMakeLists.txt
index fee0a349c0598a87d0e32177b895b3678f3e7617..03f249a5a424e0d59a97458265ec7046045a3c58 100644
--- a/PhysicsAnalysis/JetTagging/JetTagInfo/CMakeLists.txt
+++ b/PhysicsAnalysis/JetTagging/JetTagInfo/CMakeLists.txt
@@ -7,7 +7,7 @@ atlas_subdir( JetTagInfo )
 
 # Declare the package's dependencies:
 atlas_depends_on_subdirs( PUBLIC
-                          Control/DataModel
+                          Control/AthLinks
                           Event/EventPrimitives
                           Reconstruction/Jet/JetEvent
                           Reconstruction/MuonIdentification/muonEvent
@@ -26,12 +26,12 @@ atlas_add_library( JetTagInfo
                    src/*.cxx
                    PUBLIC_HEADERS JetTagInfo
                    PRIVATE_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-                   LINK_LIBRARIES DataModel EventPrimitives JetEvent muonEvent Particle egammaEvent VxVertex
+                   LINK_LIBRARIES AthLinks EventPrimitives JetEvent muonEvent Particle egammaEvent VxVertex
                    PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} GaudiKernel )
 
 atlas_add_dictionary( JetTagInfoDict
                       JetTagInfo/JetTagInfoDict.h
                       JetTagInfo/selection.xml
                       INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS}
-                      LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} DataModel EventPrimitives JetEvent muonEvent Particle egammaEvent VxVertex GaudiKernel JetTagInfo )
+                      LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AthLinks EventPrimitives JetEvent muonEvent Particle egammaEvent VxVertex GaudiKernel JetTagInfo )
 
diff --git a/PhysicsAnalysis/JetTagging/JetTagInfo/JetTagInfo/IPTrackInfo.h b/PhysicsAnalysis/JetTagging/JetTagInfo/JetTagInfo/IPTrackInfo.h
index 34fe9fe7ee91c473b36979813268919d3a93db5d..72473e43e74cc9dc10d1965c6603e1db5629eb5c 100644
--- a/PhysicsAnalysis/JetTagging/JetTagInfo/JetTagInfo/IPTrackInfo.h
+++ b/PhysicsAnalysis/JetTagging/JetTagInfo/JetTagInfo/IPTrackInfo.h
@@ -5,7 +5,7 @@
 #ifndef JETTAGINFO_IPTRACKINFO
 #define JETTAGINFO_IPTRACKINFO
 
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 #include "JetTagInfo/TrackGrade.h"
 #include "Particle/TrackParticle.h"
 #include "Particle/TrackParticleContainer.h"
diff --git a/PhysicsAnalysis/JetTagging/JetTagInfo/JetTagInfo/SETrackInfo.h b/PhysicsAnalysis/JetTagging/JetTagInfo/JetTagInfo/SETrackInfo.h
index a4622a635855aa2c750f4f848a913ce34fe47dd5..637df5b5d052e05e7f5336ee2a9530b6a3235494 100644
--- a/PhysicsAnalysis/JetTagging/JetTagInfo/JetTagInfo/SETrackInfo.h
+++ b/PhysicsAnalysis/JetTagging/JetTagInfo/JetTagInfo/SETrackInfo.h
@@ -5,7 +5,7 @@
 #ifndef JETTAGINFO_SETRACKINFO
 #define JETTAGINFO_SETRACKINFO
 
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 #include "egammaEvent/egamma.h"
 #include "egammaEvent/Electron.h"
 #include "egammaEvent/ElectronContainer.h"
diff --git a/PhysicsAnalysis/JetTagging/JetTagInfo/JetTagInfo/SMTrackInfo.h b/PhysicsAnalysis/JetTagging/JetTagInfo/JetTagInfo/SMTrackInfo.h
index 91e90e278bf3c3b4571b642914cd5a62e1446a4e..0403fff41b797e3cbdd12a9aa6834bd509b7e2db 100644
--- a/PhysicsAnalysis/JetTagging/JetTagInfo/JetTagInfo/SMTrackInfo.h
+++ b/PhysicsAnalysis/JetTagging/JetTagInfo/JetTagInfo/SMTrackInfo.h
@@ -5,7 +5,7 @@
 #ifndef JETTAGINFO_SMTRACKINFO
 #define JETTAGINFO_SMTRACKINFO
 
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 #include "muonEvent/Muon.h"
 #include "muonEvent/MuonContainer.h"
 #include <iostream>
diff --git a/PhysicsAnalysis/JetTagging/JetTagInfo/JetTagInfo/SVTrackInfo.h b/PhysicsAnalysis/JetTagging/JetTagInfo/JetTagInfo/SVTrackInfo.h
index 567f64b0d32a93d4502c58a44d712b1a927e7a54..2cc289eef93dacd314ca220f695ac28d3b8cd4be 100644
--- a/PhysicsAnalysis/JetTagging/JetTagInfo/JetTagInfo/SVTrackInfo.h
+++ b/PhysicsAnalysis/JetTagging/JetTagInfo/JetTagInfo/SVTrackInfo.h
@@ -5,7 +5,7 @@
 #ifndef JETTAGINFO_SVTRACKINFO
 #define JETTAGINFO_SVTRACKINFO
 
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 #include "Particle/TrackParticle.h"
 #include "Particle/TrackParticleContainer.h"
 #include <iostream>
diff --git a/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx
index 14709492d072bbb575f4b88735595a9a7502a16f..a345ff8f4f459178ac5f1c9897cb01d8b977ef8d 100755
--- a/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx
+++ b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx
@@ -647,7 +647,7 @@ StatusCode JetTagMonitoring::fillHistograms() {
 
   const xAOD::VertexContainer* vxContainer(0);
   // const DataHandle<VxContainer> vxContainer;
-  bool foundPrimaryVtx = evtStore()->retrieve(vxContainer, m_primaryVertexName);
+  StatusCode foundPrimaryVtx = evtStore()->retrieve(vxContainer, m_primaryVertexName);
 
   if (!foundPrimaryVtx) {
     ATH_MSG_WARNING("Unable to retrieve \"" << m_primaryVertexName << "\" from StoreGate");
diff --git a/PhysicsAnalysis/JpsiUpsilonTools/CMakeLists.txt b/PhysicsAnalysis/JpsiUpsilonTools/CMakeLists.txt
index 7436fcf091ee1efc60dcccd3573673b6090c4536..a0c059c93ab8f9a021b570d29deed41f7a97c8fb 100644
--- a/PhysicsAnalysis/JpsiUpsilonTools/CMakeLists.txt
+++ b/PhysicsAnalysis/JpsiUpsilonTools/CMakeLists.txt
@@ -8,7 +8,8 @@ atlas_subdir( JpsiUpsilonTools )
 # Declare the package's dependencies:
 atlas_depends_on_subdirs( PUBLIC
                           Control/AthenaBaseComps
-                          Control/DataModel
+                          Control/AthLinks
+                          Control/AthContainers
                           Event/xAOD/xAODMuon
                           Event/xAOD/xAODTracking
                           GaudiKernel
@@ -37,13 +38,13 @@ atlas_add_library( JpsiUpsilonToolsLib
                    INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS}
                    PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
                    PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
-                   LINK_LIBRARIES ${HEPPDT_LIBRARIES} AthenaBaseComps DataModel xAODMuon xAODTracking GaudiKernel InDetConversionFinderToolsLib TrkVKalVrtFitterLib TrkV0FitterLib TrkVertexAnalysisUtilsLib
+                   LINK_LIBRARIES ${HEPPDT_LIBRARIES} AthenaBaseComps AthLinks AthContainers xAODMuon xAODTracking GaudiKernel InDetConversionFinderToolsLib TrkVKalVrtFitterLib TrkV0FitterLib TrkVertexAnalysisUtilsLib
                    PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} EventPrimitives TrkParametersBase VxVertex TrkToolInterfaces TrkVertexFitterInterfaces xAODBPhys )
 
 atlas_add_component( JpsiUpsilonTools
                      src/components/*.cxx
                      INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
-                     LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps DataModel xAODMuon xAODTracking GaudiKernel InDetConversionFinderToolsLib TrkVKalVrtFitterLib EventPrimitives TrkParametersBase VxVertex TrkToolInterfaces TrkV0FitterLib TrkVertexAnalysisUtilsLib TrkVertexFitterInterfaces JpsiUpsilonToolsLib )
+                     LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthLinks AthContainers xAODMuon xAODTracking GaudiKernel InDetConversionFinderToolsLib TrkVKalVrtFitterLib EventPrimitives TrkParametersBase VxVertex TrkToolInterfaces TrkV0FitterLib TrkVertexAnalysisUtilsLib TrkVertexFitterInterfaces JpsiUpsilonToolsLib )
 
 # Install files from the package:
 atlas_install_joboptions( share/*.py )
diff --git a/PhysicsAnalysis/JpsiUpsilonTools/JpsiUpsilonTools/JpsiEEFinder.h_ignore b/PhysicsAnalysis/JpsiUpsilonTools/JpsiUpsilonTools/JpsiEEFinder.h_ignore
index 1d7cd28243554edf37a661dda5ea1621326a9d44..c532c801e3b6332d0e1b71d8c72558485acbd93a 100644
--- a/PhysicsAnalysis/JpsiUpsilonTools/JpsiUpsilonTools/JpsiEEFinder.h_ignore
+++ b/PhysicsAnalysis/JpsiUpsilonTools/JpsiUpsilonTools/JpsiEEFinder.h_ignore
@@ -12,7 +12,7 @@
 #include "AthenaBaseComps/AthAlgorithm.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "TrkVKalVrtFitter/TrkVKalVrtFitter.h"
-#include "DataModel/DataVector.h"
+#include "AthContainers/DataVector.h"
 #include "InDetConversionFinderTools/InDetConversionFinderTools.h"
 #include "HepPDT/ParticleDataTable.hh"
 #include "CLHEP/Vector/LorentzVector.h"
diff --git a/PhysicsAnalysis/JpsiUpsilonTools/JpsiUpsilonTools/JpsiFinder.h b/PhysicsAnalysis/JpsiUpsilonTools/JpsiUpsilonTools/JpsiFinder.h
index c5f2084c624d9e6f76e34bd50404e614f95e0278..b984c06b5bbc380571248b51c1ed4bc045964156 100644
--- a/PhysicsAnalysis/JpsiUpsilonTools/JpsiUpsilonTools/JpsiFinder.h
+++ b/PhysicsAnalysis/JpsiUpsilonTools/JpsiUpsilonTools/JpsiFinder.h
@@ -15,7 +15,7 @@
 #include "AthenaBaseComps/AthAlgorithm.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "TrkVKalVrtFitter/TrkVKalVrtFitter.h"
-#include "DataModel/DataVector.h"
+#include "AthContainers/DataVector.h"
 #include "InDetConversionFinderTools/InDetConversionFinderTools.h"
 #include "HepPDT/ParticleDataTable.hh"
 
diff --git a/PhysicsAnalysis/JpsiUpsilonTools/JpsiUpsilonTools/JpsiPlus1Track.h b/PhysicsAnalysis/JpsiUpsilonTools/JpsiUpsilonTools/JpsiPlus1Track.h
index dab1d934813978e2f7249d3a4f5a268d6d532416..910b1c05e8096835182bf4286b98f4c03997782b 100644
--- a/PhysicsAnalysis/JpsiUpsilonTools/JpsiUpsilonTools/JpsiPlus1Track.h
+++ b/PhysicsAnalysis/JpsiUpsilonTools/JpsiUpsilonTools/JpsiPlus1Track.h
@@ -15,7 +15,7 @@
 #include "AthenaBaseComps/AthAlgorithm.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "TrkVKalVrtFitter/TrkVKalVrtFitter.h"
-#include "DataModel/DataVector.h"
+#include "AthContainers/DataVector.h"
 #include "HepPDT/ParticleDataTable.hh"
 #include "xAODTracking/TrackParticle.h"
 #include "xAODMuon/MuonContainer.h"
diff --git a/PhysicsAnalysis/JpsiUpsilonTools/JpsiUpsilonTools/JpsiPlus2Tracks.h b/PhysicsAnalysis/JpsiUpsilonTools/JpsiUpsilonTools/JpsiPlus2Tracks.h
index 233bb7b1182dc77535e5d68e86a7d869821f09b9..68ff2cef083325108132349c9567b7ed20d1b448 100644
--- a/PhysicsAnalysis/JpsiUpsilonTools/JpsiUpsilonTools/JpsiPlus2Tracks.h
+++ b/PhysicsAnalysis/JpsiUpsilonTools/JpsiUpsilonTools/JpsiPlus2Tracks.h
@@ -15,7 +15,7 @@
 #include "AthenaBaseComps/AthAlgorithm.h"
 #include "GaudiKernel/ToolHandle.h"
 #include "TrkVKalVrtFitter/TrkVKalVrtFitter.h"
-#include "DataModel/DataVector.h"
+#include "AthContainers/DataVector.h"
 #include "HepPDT/ParticleDataTable.hh"
 #include "xAODTracking/TrackParticle.h"
 #include "xAODMuon/MuonContainer.h"
diff --git a/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiEEAlg.cxx_noCompile b/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiEEAlg.cxx_noCompile
index 63b5271bda74e504cafd3c0c6364ccdfbe3fd874..a47b3c76374cf8e110618ff6ad7fb4a1a68f3472 100644
--- a/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiEEAlg.cxx_noCompile
+++ b/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiEEAlg.cxx_noCompile
@@ -16,9 +16,8 @@
 #include "GaudiKernel/ISvcLocator.h"
 #include "EventInfo/EventInfo.h"
 #include "EventInfo/EventID.h"
-#include "DataModel/DataVector.h"
-#include "DataModel/ElementLink.h"
-#include "DataModel/DataVector.h"
+#include "AthContainers/DataVector.h"
+#include "AthLinks/ElementLink.h"
 
 #include "StoreGate/StoreGateSvc.h"             // Storegate stuff
 #include "StoreGate/DataHandle.h"
diff --git a/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiEEExample.cxx_noCompile b/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiEEExample.cxx_noCompile
index 3a01adafd2452068be2015f9c87e521c50d8a339..109b95106b16bcf122fcb3df4a724ca3c5f82e5d 100644
--- a/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiEEExample.cxx_noCompile
+++ b/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiEEExample.cxx_noCompile
@@ -16,8 +16,8 @@
 #include "GaudiKernel/IPartPropSvc.h"
 #include "EventInfo/EventInfo.h"
 #include "EventInfo/EventID.h"
-#include "DataModel/DataVector.h"
-#include "DataModel/ElementLink.h"
+#include "AthContainers/DataVector.h"
+#include "AthLinks/ElementLink.h"
 
 #include "StoreGate/StoreGateSvc.h"             // Storegate stuff
 #include "StoreGate/DataHandle.h"
diff --git a/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiEEFinder.cxx_noCompile b/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiEEFinder.cxx_noCompile
index 21e2775c81d3157780e65c4582495a23cf7e41e4..d71981c1cf64922858d4126dac023dc7f2343b8a 100644
--- a/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiEEFinder.cxx_noCompile
+++ b/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiEEFinder.cxx_noCompile
@@ -26,7 +26,7 @@
 #include "CaloEvent/CaloCluster.h"
 #include "GaudiKernel/ToolFactory.h"
 #include "GaudiKernel/IPartPropSvc.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 #include "egammaAnalysisUtils/EnergyRescaler.h"
 #include "egammaAnalysisUtils/IsEMPlusPlusHelper.h"
 
diff --git a/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiFinder.cxx b/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiFinder.cxx
index 5257261e0837431b248dcb47f516311b9dbfed24..39b3abff2b43b4a6d3278b46c35936c3ed287a93 100644
--- a/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiFinder.cxx
+++ b/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiFinder.cxx
@@ -31,7 +31,7 @@
 #include "EventPrimitives/EventPrimitives.h"
 #include "GaudiKernel/ToolFactory.h"
 #include "GaudiKernel/IPartPropSvc.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 
 #include "xAODTracking/Vertex.h"
 #include "xAODTracking/VertexContainer.h"
diff --git a/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiJpsiEEExample.cxx_noCompile b/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiJpsiEEExample.cxx_noCompile
index 7972cf8cd7273293da03df3dd6387787d63a449a..4e2b1dc3ddf66c7f8a4506591437e8a45ca94ac8 100644
--- a/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiJpsiEEExample.cxx_noCompile
+++ b/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiJpsiEEExample.cxx_noCompile
@@ -16,8 +16,8 @@
 #include "GaudiKernel/IPartPropSvc.h"
 #include "EventInfo/EventInfo.h"
 #include "EventInfo/EventID.h"
-#include "DataModel/DataVector.h"
-#include "DataModel/ElementLink.h"
+#include "AthContainers/DataVector.h"
+#include "AthLinks/ElementLink.h"
 
 #include "StoreGate/StoreGateSvc.h"             // Storegate stuff
 #include "StoreGate/DataHandle.h"
diff --git a/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiPlus1Track.cxx b/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiPlus1Track.cxx
index a1e1012aee51cf6f7967604d374e5077877b4e88..318a6cd1b1161d34c319ad14c025fda4f9be754c 100644
--- a/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiPlus1Track.cxx
+++ b/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiPlus1Track.cxx
@@ -17,7 +17,7 @@
 #include "TrkToolInterfaces/ITrackSelectorTool.h"
 #include "GaudiKernel/ToolFactory.h"
 #include "GaudiKernel/IPartPropSvc.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 #include "xAODTracking/TrackParticleContainer.h"
 #include "InDetConversionFinderTools/VertexPointEstimator.h"
 #include <memory>
diff --git a/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiPlus2Tracks.cxx b/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiPlus2Tracks.cxx
index 78db6bb253f7555a1837aec7200f0b508c113269..d8d85a220393560cdab8cad4cc224f1895f98fc7 100644
--- a/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiPlus2Tracks.cxx
+++ b/PhysicsAnalysis/JpsiUpsilonTools/src/JpsiPlus2Tracks.cxx
@@ -18,7 +18,7 @@
 #include "TrkToolInterfaces/ITrackSelectorTool.h"
 #include "GaudiKernel/ToolFactory.h"
 #include "GaudiKernel/IPartPropSvc.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 #include "InDetConversionFinderTools/VertexPointEstimator.h"
 #include "EventPrimitives/EventPrimitives.h"
 #include <memory>
diff --git a/PhysicsAnalysis/PATJobTransforms/share/CommonSkeletonJobOptions.py b/PhysicsAnalysis/PATJobTransforms/share/CommonSkeletonJobOptions.py
index 77c8d0c134f5d18335e6bbb5fdbd7f0608ab833d..4cd9fc2bf1e506a371623909689747a62e6e46b8 100644
--- a/PhysicsAnalysis/PATJobTransforms/share/CommonSkeletonJobOptions.py
+++ b/PhysicsAnalysis/PATJobTransforms/share/CommonSkeletonJobOptions.py
@@ -35,7 +35,11 @@ if hasattr(runArgs,"maxEvents"): athenaCommonFlags.EvtMax.set_Value_and_Lock( ru
 else: athenaCommonFlags.EvtMax=-1
 
 #RecExCommon configuration
-if hasattr(runArgs,"geometryVersion"): globalflags.DetDescrVersion.set_Value_and_Lock( runArgs.geometryVersion )
+if hasattr(runArgs,"geometryVersion"):
+    inputGeometryVersion = runArgs.geometryVersion
+    if type(inputGeometryVersion) == str and inputGeometryVersion.endswith("_VALIDATION"):
+        inputGeometryVersion = inputGeometryVersion.replace("_VALIDATION", "")
+    globalflags.DetDescrVersion.set_Value_and_Lock( inputGeometryVersion )
 if hasattr(runArgs,"conditionsTag"): globalflags.ConditionsTag.set_Value_and_Lock( runArgs.conditionsTag )
 if hasattr(runArgs,"beamType"): jobproperties.Beam.beamType.set_Value_and_Lock( runArgs.beamType )
 if hasattr(runArgs,"AMITag"): rec.AMITag=runArgs.AMITag
diff --git a/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValMET_jobOptions.py b/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValMET_jobOptions.py
index 8a502cb6689cacc93fef0372e0fa22f0f9251d1f..126a0e31dfdb3190a6f735dd3a6c98ab7b9c82fb 100644
--- a/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValMET_jobOptions.py
+++ b/PhysicsAnalysis/PhysicsValidation/PhysValMonitoring/share/PhysValMET_jobOptions.py
@@ -14,11 +14,14 @@ jvtTool = CfgMgr.JetVertexTaggerTool('JVTTool')
 ToolSvc += jvtTool
 tool1.JVTTool = jvtTool
 
-mettoolTopo = CfgMgr.met__METMaker('METMaker_AntiKt4Topo')
+mettoolTopo = CfgMgr.met__METMaker('METMaker_AntiKt4Topo',
+                                   JetSelection="Default",
+                                   DoPFlow=False)
 ToolSvc += mettoolTopo
 tool1.METMakerTopo = mettoolTopo
 
 mettoolPFlow = CfgMgr.met__METMaker('METMaker_AntiKt4PFlow',
+                                    JetSelection="PFlow",
                                     DoPFlow=True)
 ToolSvc += mettoolPFlow
 tool1.METMakerPFlow = mettoolPFlow
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/KinkedTrackFlags.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/KinkedTrackFlags.py
index 551fc96ffd8a3fd912ec456ca8654cdd6afa6204..51dfcb2c0b745a918288c6fdca74035b0cb22c66 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/KinkedTrackFlags.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/python/KinkedTrackFlags.py
@@ -164,6 +164,7 @@ class KinkedTrack_singleJetMetFilterFlags(JobProperty):
         'HLT_xe130_mht_L1XE50'        
         ]
     cutsEtMin = [80.0*Units.GeV, 40.0*Units.GeV]
+    cutsEtMinForStublet = [90.0*Units.GeV, 40.0*Units.GeV]
     cutsEtMinForMultiJets = [60.0*Units.GeV, 60.0*Units.GeV]
     jetMetPtMin = 40.0*Units.GeV
     cutMetHt = 0.0
@@ -175,8 +176,10 @@ class KinkedTrack_singleJetMetFilterFlags(JobProperty):
     leptonPtMax = 20.0*Units.GeV
     leptonEtaMax = 2.5
     cutMetMin = 60.0*Units.GeV  # no cut
+    cutMetMinForStublet = 90.0*Units.GeV  # no cut
     cutMetMinForMultiJets = 170.0*Units.GeV
     jetMetDphiMin = 1.0
+    preScaleStublet = 10
     pass
 primRPVLLDESDM.add_JobProperty(KinkedTrack_singleJetMetFilterFlags)
 
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDESDM_KinkedTrack.py b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDESDM_KinkedTrack.py
index 1c8e914f84554db2add23922ce1086df6e1c270a..d3053c4a4900a412dad2defed3d51621b88870a7 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDESDM_KinkedTrack.py
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/share/PhysDESDM_KinkedTrack.py
@@ -81,6 +81,7 @@ topSequence += DerivationFramework__DerivationKernel("RPVLL_KinkedTrackJetFilter
                                                      SkimmingTools = [KinkTrkJetFilterTool])
 RPVLLfilterNames.extend(["RPVLL_KinkedTrackJetFilterKernel"])
 
+# Multi-jets filter
 KinkTrkMultiJetFilterTool = DerivationFramework__KinkTrkSingleJetMetFilterTool(name                 = "KinkTrkMultiJetFilterTool",
                                                                                LeptonVeto           = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.doLeptonVeto,
                                                                                IsolatedTrack        = False,
@@ -114,6 +115,42 @@ topSequence += DerivationFramework__DerivationKernel("RPVLL_KinkedTrackMultiJetF
                                                      SkimmingTools = [KinkTrkTrigMetMultiJetFilterTool])
 RPVLLfilterNames.extend(["RPVLL_KinkedTrackMultiJetFilterKernel"])
 
+# Stublet filter
+KinkTrkStubletFilterTool = DerivationFramework__KinkTrkSingleJetMetFilterTool(name                 = "KinkTrkStubletFilterTool",
+                                                                              LeptonVeto           = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.doLeptonVeto,
+                                                                              IsolatedTrack        = False,
+                                                                              JetContainerKey      = jetContainer,
+                                                                              ElectronContainerKey = electronContainer,
+                                                                              ElectronIDKey        = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.electronIDKey,
+                                                                              MuonContainerKey     = muonContainer,
+                                                                              MuonIDKey            = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.muonIDKey,
+                                                                              MetContainerKey      = METContainer,
+                                                                              MetTerm              = METTerm,
+                                                                              MetCut               = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.cutMetMinForStublet,
+                                                                              JetPtCuts            = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.cutsEtMinForStublet,
+                                                                              JetEtaMax            = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.cutEtaMax,
+                                                                              JetNumCut            = 1,
+                                                                              JetMetDphiMin        = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.jetMetDphiMin,
+                                                                              JetMetPtMin          = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.jetMetPtMin,
+                                                                              MetHtCut             = -1,
+                                                                              LeptonPtCut          = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.leptonPtMax,
+                                                                              LeptonEtaMax         = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.leptonEtaMax)
+
+print KinkTrkStubletFilterTool
+ToolSvc += KinkTrkStubletFilterTool
+
+KinkTrkStubletPrescaleTool = DerivationFramework__PrescaleTool(name = "KinkTrkStubletPrescaleTool",
+                                                           Prescale = primRPVLLDESDM.KinkedTrack_singleJetMetFilterFlags.preScaleStublet)
+ToolSvc += KinkTrkStubletPrescaleTool
+
+KinkTrkStubletFinalFilterTool = DerivationFramework__FilterCombinationAND(name = "KinkTrkStubletFinalFilterTool",
+                                                                 FilterList=[KinkTrkJetTriggerFilterTool, KinkTrkStubletFilterTool, KinkTrkStubletPrescaleTool],
+                                                                 OutputLevel=INFO)
+ToolSvc+= KinkTrkStubletFinalFilterTool 
+
+topSequence += DerivationFramework__DerivationKernel("RPVLL_KinkedTrackStubletFilterKernel",
+                                                     SkimmingTools = [KinkTrkStubletFinalFilterTool])
+RPVLLfilterNames.extend(["RPVLL_KinkedTrackStubletFilterKernel"])
 
 #====================================================================
 # Zee/Zmumu filter
diff --git a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/src/KinkTrkSingleJetMetFilterTool.cxx b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/src/KinkTrkSingleJetMetFilterTool.cxx
index b460263891033823096426136a7840fc8389dc9e..83f0023100c9e4decdd762b0a3cbc8b773f2d780 100644
--- a/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/src/KinkTrkSingleJetMetFilterTool.cxx
+++ b/PhysicsAnalysis/SUSYPhys/LongLivedParticleDPDMaker/src/KinkTrkSingleJetMetFilterTool.cxx
@@ -252,21 +252,6 @@ bool DerivationFramework::KinkTrkSingleJetMetFilterTool::eventPassesFilter() con
 	continue;
       }
       
-      if(passIsolatedTracklet==false)
-	continue;
-      
-      if(TMath::Abs(Tracklet->eta()) < 0.1 || TMath::Abs(Tracklet->eta()) > 1.9)
-	continue;
-      
-      if(TMath::Prob(Tracklet->chiSquared(), Tracklet->numberDoF()) < 0.1)
-	continue;
-      
-      if(Tracklet->auxdata<UChar_t>("numberOfContribPixelLayers")<4)
-	continue;
-      
-      if(Tracklet->auxdata<UChar_t>("numberOfPixelSpoiltHits")>0)
-	continue;      
-      
       if(passIsolatedTracklet)
 	break;
     }// for Tracklet
diff --git a/Projects/AthDataQuality/CMakeLists.txt b/Projects/AthDataQuality/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..61d4cfbd0a81e5ca968983284c917b64d3aa541a
--- /dev/null
+++ b/Projects/AthDataQuality/CMakeLists.txt
@@ -0,0 +1,87 @@
+
+# Set the minimum required CMake version:
+cmake_minimum_required( VERSION 3.2 FATAL_ERROR )
+
+# Read in the project's version from a file called version.txt. But let it be
+# overridden from the command line if necessary.
+file( READ ${CMAKE_SOURCE_DIR}/version.txt _version )
+string( STRIP ${_version} _version )
+set( ATHDATAQUALITY_PROJECT_VERSION ${_version}
+   CACHE STRING "Version of the AthDataQuality project to build" )
+unset( _version )
+
+# Set the version of tdaq-common to use for the build:
+set( TDAQ-COMMON_VERSION "02-02-00" )
+set( TDAQ-COMMON_ROOT
+   "$ENV{TDAQ_RELEASE_BASE}/tdaq-common/tdaq-common-${TDAQ-COMMON_VERSION}" )
+
+# Set the version of dqm-common to use for the build:
+set( DQM-COMMON_VERSION "01-02-00" )
+set( DQM-COMMON_ROOT
+   "$ENV{TDAQ_RELEASE_BASE}/dqm-common/dqm-common-${DQM-COMMON_VERSION}" )
+
+# Pick up the AtlasCMake code:
+find_package( AtlasCMake REQUIRED )
+
+# Build the project against LCG:
+set( LCG_VERSION_POSTFIX ""
+   CACHE STRING "Version postfix for the LCG release to use" )
+set( LCG_VERSION_NUMBER 88
+   CACHE STRING "Version number for the LCG release to use" )
+find_package( LCG ${LCG_VERSION_NUMBER} EXACT REQUIRED )
+
+#find_package( ROOT )
+find_package( Xrootd )
+find_package( GSL )
+
+# Make CMake find the project specific code we have here:
+list( INSERT CMAKE_MODULE_PATH 0 ${CMAKE_SOURCE_DIR}/modules )
+
+# Set up CTest:
+atlas_ctest_setup()
+
+# Set up a work directory project:
+atlas_project( AthDataQuality ${ATHDATAQUALITY_PROJECT_VERSION}
+   PROJECT_ROOT ${CMAKE_SOURCE_DIR}/../../ )
+
+# Generate the environment setup for the externals, to be used during the build:
+lcg_generate_env( SH_FILE ${CMAKE_BINARY_DIR}/${ATLAS_PLATFORM}/env_setup.sh )
+
+# Generate replacement rules for the installed paths:
+set( _replacements )
+if( NOT "$ENV{NICOS_PROJECT_HOME}" STREQUAL "" )
+   get_filename_component( _buildDir $ENV{NICOS_PROJECT_HOME} PATH )
+   list( APPEND _replacements ${_buildDir} "\${Athena_DIR}/../../../.." )
+endif()
+if( NOT "$ENV{NICOS_PROJECT_RELNAME}" STREQUAL "" )
+   list( APPEND _replacements $ENV{NICOS_PROJECT_RELNAME}
+      "\${Athena_VERSION}" )
+endif()
+if( NOT "$ENV{TDAQ_RELEASE_BASE}" STREQUAL "" )
+   list( APPEND _replacements $ENV{TDAQ_RELEASE_BASE}
+      "\${TDAQ_RELEASE_BASE}" )
+endif()
+
+# Now generate and install the installed setup files:
+lcg_generate_env( SH_FILE
+   ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/env_setup_install.sh
+   REPLACE ${_replacements} )
+install( FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/env_setup_install.sh
+   DESTINATION . RENAME env_setup.sh )
+
+# Configure and install the post-configuration file:
+string( REPLACE "$ENV{TDAQ_RELEASE_BASE}" "\$ENV{TDAQ_RELEASE_BASE}"
+   TDAQ-COMMON_ROOT "${TDAQ-COMMON_ROOT}" )
+string( REPLACE "${TDAQ-COMMON_VERSION}" "\${TDAQ-COMMON_VERSION}"
+   TDAQ-COMMON_ROOT "${TDAQ-COMMON_ROOT}" )
+string( REPLACE "$ENV{TDAQ_RELEASE_BASE}" "\$ENV{TDAQ_RELEASE_BASE}"
+   DQM-COMMON_ROOT "${DQM-COMMON_ROOT}" )
+string( REPLACE "${DQM-COMMON_VERSION}" "\${DQM-COMMON_VERSION}"
+   DQM-COMMON_ROOT "${DQM-COMMON_ROOT}" )
+configure_file( ${CMAKE_SOURCE_DIR}/PostConfig.cmake.in
+   ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake @ONLY )
+install( FILES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/PostConfig.cmake
+   DESTINATION ${CMAKE_INSTALL_CMAKEDIR} )
+
+# Set up CPack:
+atlas_cpack_setup()
diff --git a/Projects/AthDataQuality/PostConfig.cmake.in b/Projects/AthDataQuality/PostConfig.cmake.in
new file mode 100644
index 0000000000000000000000000000000000000000..8d8218256cb333bcc7ecd13342b79b6380e2f385
--- /dev/null
+++ b/Projects/AthDataQuality/PostConfig.cmake.in
@@ -0,0 +1,11 @@
+#
+# File taking care of pointing the downstream projects at the right
+# version of the externals.
+#
+
+# Set the versions of the TDAQ projects:
+set( TDAQ-COMMON_VERSION "@TDAQ-COMMON_VERSION@" )
+set( TDAQ-COMMON_ROOT "@TDAQ-COMMON_ROOT@" )
+
+set( DQM-COMMON_VERSION "@DQM-COMMON_VERSION@" )
+set( DQM-COMMON_ROOT "@DQM-COMMON_ROOT@" )
diff --git a/Projects/AthDataQuality/Readme.txt b/Projects/AthDataQuality/Readme.txt
new file mode 100644
index 0000000000000000000000000000000000000000..0f23122a37920a71d4204aba0316136b24fef638
--- /dev/null
+++ b/Projects/AthDataQuality/Readme.txt
@@ -0,0 +1,5 @@
+
+Project build versioning scheme to be updated in AthDataQuality/version.txt
+
+Whenever PROC builds new Athena 21.0.X, the AthDataQuality is also updated by PROC to 21.0.X.1
+Whenever DQ team builds new AthDataQuality 21.0.X.Y, the AthDataQuality is updated to 21.0.X.(Y+1)
diff --git a/Projects/AthDataQuality/build.sh b/Projects/AthDataQuality/build.sh
new file mode 100755
index 0000000000000000000000000000000000000000..cf1c7ed70b74856c7147bcb7c0daceea60a04003
--- /dev/null
+++ b/Projects/AthDataQuality/build.sh
@@ -0,0 +1,128 @@
+#!/bin/bash
+#
+# Script for building the release on top of externals built using one of the
+# scripts in this directory.
+#
+
+# Function printing the usage information for the script
+usage() {
+    echo "Usage: build.sh [-t build type] [-b build dir] [-c] [-m] [-i] [-p] [-a]"
+    echo " -c: Execute CMake step"
+    echo " -m: Execute make step"
+    echo " -i: Execute install step"
+    echo " -p: Execute CPack step"
+    echo " -a: Abort on error"
+    echo "If none of the c, m, i or p options are set then the script will do"
+    echo "*all* steps. Otherwise only the enabled steps are run - it's your"
+    echo "reponsibility to ensure that precusors are in good shape"
+}
+
+# Parse the command line arguments:
+BUILDDIR=""
+BUILDTYPE="RelWithDebInfo"
+EXE_CMAKE=""
+EXE_MAKE=""
+EXE_INSTALL=""
+EXE_CPACK=""
+NIGHTLY=true
+while getopts ":t:b:hcmipa" opt; do
+    case $opt in
+        t)
+            BUILDTYPE=$OPTARG
+            ;;
+        b)
+            BUILDDIR=$OPTARG
+            ;;
+        c)
+            EXE_CMAKE="1"
+            ;;
+        m)
+            EXE_MAKE="1"
+            ;;
+        i)
+            EXE_INSTALL="1"
+            ;;
+        p)
+            EXE_CPACK="1"
+            ;;
+        a)
+            NIGHTLY=false
+            ;;
+        h)
+            usage
+            exit 0
+            ;;
+        :)
+            echo "Argument -$OPTARG requires a parameter!"
+            usage
+            exit 1
+            ;;
+        ?)
+            echo "Unknown argument: -$OPTARG"
+            usage
+            exit 1
+            ;;
+    esac
+done
+
+# If no step was explicitly specified, turn them all on:
+if [ -z "$EXE_CMAKE" -a -z "$EXE_MAKE" -a -z "$EXE_INSTALL" -a -z "$EXE_CPACK" ]; then
+    EXE_CMAKE="1"
+    EXE_MAKE="1"
+    EXE_INSTALL="1"
+    EXE_CPACK="1"
+fi
+
+# Stop on errors from here on out:
+set -e
+
+# Source in our environment
+AthDataQualitySrcDir=$(dirname ${BASH_SOURCE[0]})
+if [ -z "$BUILDDIR" ]; then
+    BUILDDIR=${AthDataQualitySrcDir}/../../../build
+fi
+mkdir -p ${BUILDDIR}
+BUILDDIR=$(cd ${BUILDDIR} && pwd)
+source $AthDataQualitySrcDir/build_env.sh -b $BUILDDIR
+
+# create the actual build directory
+mkdir -p ${BUILDDIR}/build/AthDataQuality
+cd ${BUILDDIR}/build/AthDataQuality
+
+# consider a pipe failed if ANY of the commands fails
+set -o pipefail
+
+# CMake:
+if [ -n "$EXE_CMAKE" ]; then
+    # Remove the CMakeCache.txt file, to force CMake to find externals
+    # from scratch in an incremental build.
+    rm -f CMakeCache.txt
+    # Now run the actual CMake configuration:
+    time cmake -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} \
+        -DCTEST_USE_LAUNCHERS:BOOL=TRUE \
+        ${AthDataQualitySrcDir} 2>&1 | tee cmake_config.log
+fi
+
+# for nightly builds we want to get as far as we can
+if [ "$NIGHTLY" = true ]; then
+    # At this point stop worrying about errors:
+    set +e
+fi
+
+# make:
+if [ -n "$EXE_MAKE" ]; then
+    time make -k 2>&1 | tee cmake_build.log
+fi
+
+# Install the results:
+if [ -n "$EXE_INSTALL" ]; then
+    time make install/fast \
+        DESTDIR=${BUILDDIR}/install/AthDataQuality/${NICOS_PROJECT_VERSION} \
+        2>&1 | tee cmake_install.log
+fi
+
+# Build an RPM for the release:
+if [ -n "$EXE_CPACK" ]; then
+    time cpack 2>&1 | tee cmake_cpack.log
+    cp AthDataQuality*.rpm ${BUILDDIR}/
+fi
diff --git a/Projects/AthDataQuality/build_env.sh b/Projects/AthDataQuality/build_env.sh
new file mode 100644
index 0000000000000000000000000000000000000000..47d6e42371baa676f7af00dd1f9fd8f8e0987f2f
--- /dev/null
+++ b/Projects/AthDataQuality/build_env.sh
@@ -0,0 +1,101 @@
+# This script sets up the build enironment for an AthDataQuality
+# build.
+#
+# This script is kept separate from the build.sh
+# wrapper so it can be sourced separately from it when
+# clients want to manage their own build and just want
+# to setup the build environment
+
+env_usage() {
+    echo "Usage: build_env.sh [-b build dir]"
+}
+
+# This function actually sets up the environment for us
+# (factorise it here in case it needs skipped)
+env_setup() {
+    startdir=$(pwd)
+    # As this script can be sourced we need to support zsh and
+    # possibly other Bourne shells
+    if [ "x${BASH_SOURCE[0]}" = "x" ]; then
+    # This trick should do the right thing under ZSH:
+        thisdir=$(dirname `print -P %x`)
+        if [ $? != 0 ]; then
+            echo "ERROR: This script must be sourced from BASH or ZSH"
+            return 1
+        fi
+    else
+        # The BASH solution is a bit more straight forward:
+        thisdir=$(dirname ${BASH_SOURCE[0]})
+    fi
+    AthDataQualitySrcDir=$(cd ${thisdir};pwd)
+
+    # The directory holding the helper scripts:
+    scriptsdir=${AthDataQualitySrcDir}/../../Build/AtlasBuildScripts
+
+    # Go to the main directory of the repository:
+    cd ${AthDataQualitySrcDir}/../..
+
+    # Check if the user specified any source/build directories:
+    if [ "$BUILDDIR" = "" ]; then
+        BUILDDIR=${AthDataQualitySrcDir}/../../../build
+    fi
+
+    # Set up the environment for the build:
+    export NICOS_PROJECT_VERSION=`cat ${AthDataQualitySrcDir}/version.txt`
+    export NICOS_ATLAS_RELEASE=${NICOS_PROJECT_VERSION}
+    export NICOS_PROJECT_RELNAME=${NICOS_PROJECT_VERSION}
+    export NICOS_PROJECT_HOME=${BUILDDIR}/install/AthDataQuality
+
+    # Set up the environment variables for finding LCG and the TDAQ externals:
+    source ${scriptsdir}/LCG_RELEASE_BASE.sh
+    source ${scriptsdir}/TDAQ_RELEASE_BASE.sh
+
+    # Set up the environment variables necessary to find the CMake code from
+    # atlasexternals:
+    extDir=${BUILDDIR}/src/atlasexternals
+    if [ ! -d ${extDir} ]; then
+        echo "Didn't find atlasexternals under ${extDir}!"
+    fi
+    export AtlasCMake_DIR=${extDir}/Build/AtlasCMake
+    export LCG_DIR=${extDir}/Build/AtlasLCG
+    echo "Picking up AtlasCMake from: ${AtlasCMake_DIR}"
+    echo "Picking up AtlasLCG from  : ${LCG_DIR}"
+
+    # Return to the original directory:
+    cd $startdir
+}
+
+# we need to reset the option index as we are sourcing this script
+# http://stackoverflow.com/questions/23581368/bug-in-parsing-args-with-getopts-in-bash
+OPTIND=1
+
+# Parse the command line arguments:
+BUILDDIR=""
+while getopts "b:h" opt; do
+    case $opt in
+        b)
+            BUILDDIR=$OPTARG
+            ;;
+        h)
+            env_usage
+            ABORT=1
+            ;;
+        :)
+            echo "Argument -$OPTARG requires a parameter!"
+            env_usage
+            ABORT=1
+            ;;
+        ?)
+            echo "Unknown argument: -$OPTARG"
+            env_usage
+            ABORT=1
+            ;;
+    esac
+done
+
+# Put a big wrapper around bad argument case, because
+# a sourced script should not call "exit". This is quite
+# annoying...
+if [ -z "$ABORT" ]; then
+    env_setup
+fi
diff --git a/Projects/AthDataQuality/build_externals.sh b/Projects/AthDataQuality/build_externals.sh
new file mode 100755
index 0000000000000000000000000000000000000000..11afff5cffa7b90b970a4381f219d800cd3821cd
--- /dev/null
+++ b/Projects/AthDataQuality/build_externals.sh
@@ -0,0 +1,117 @@
+#!/bin/bash
+#
+# Script building all the externals necessary for the nightly build.
+#
+
+# Function printing the usage information for the script
+usage() {
+    echo "Usage: build_externals.sh [-t build_type] [-b build_dir] [-f] [-c]"
+    echo " -f: Force rebuild of externals from scratch, otherwise if script"
+    echo "     finds an external build present it will only do an incremental"
+    echo "     build. (unused)"
+    echo " -c: Build the externals for the continuous integration (CI) system,"
+    echo "     skipping the build of the externals RPMs. (unused)"
+    echo "If a build_dir is not given the default is '../build'"
+    echo "relative to the athena checkout"
+}
+
+# Parse the command line arguments:
+BUILDDIR=""
+BUILDTYPE="RelWithDebInfo"
+FORCE=""
+CI=""
+while getopts ":t:b:fch" opt; do
+    case $opt in
+        t)
+            BUILDTYPE=$OPTARG
+            ;;
+        b)
+            BUILDDIR=$OPTARG
+            ;;
+        f)
+            FORCE="1"
+            ;;
+        c)
+            CI="1"
+            ;;
+        h)
+            usage
+            exit 0
+            ;;
+        :)
+            echo "Argument -$OPTARG requires a parameter!"
+            usage
+            exit 1
+            ;;
+        ?)
+            echo "Unknown argument: -$OPTARG"
+            usage
+            exit 1
+            ;;
+    esac
+done
+
+# Version comparison function. Taken from a StackOverflow article.
+verlte() {
+    if [ "$1" = "`echo -e "$1\n$2" | sort -V | head -n1`" ]; then
+        return 1
+    fi
+    return 0
+}
+
+# First off, check that we are using a new enough version of Git. We need
+# at least version 1.8.1.
+git_min_version=1.8.1
+git_version=`git --version | awk '{print $3}'`
+verlte "${git_min_version}" "${git_version}"
+if [ $? = 0 ]; then
+    echo "Detected git version (${git_version}) not new enough."
+    echo "Need at least: ${git_min_version}"
+    exit 1
+fi
+
+# Stop on errors from here on out:
+set -e
+
+# We are in BASH, get the path of this script in a simple way:
+thisdir=$(dirname ${BASH_SOURCE[0]})
+thisdir=$(cd ${thisdir};pwd)
+
+# Go to the main directory of the repository:
+cd ${thisdir}/../..
+
+# Check if the user specified any source/build directories:
+if [ "$BUILDDIR" = "" ]; then
+    BUILDDIR=${thisdir}/../../../build
+fi
+mkdir -p ${BUILDDIR}
+BUILDDIR=$(cd $BUILDDIR; pwd)
+
+# Create some directories:
+mkdir -p ${BUILDDIR}/src
+
+# Set some environment variables that the builds use internally:
+export NICOS_PROJECT_VERSION=`cat ${thisdir}/version.txt`
+export NICOS_ATLAS_RELEASE=${NICOS_PROJECT_VERSION}
+export NICOS_PROJECT_RELNAME=${NICOS_PROJECT_VERSION}
+
+# The directory holding the helper scripts:
+scriptsdir=${thisdir}/../../Build/AtlasBuildScripts
+scriptsdir=$(cd ${scriptsdir}; pwd)
+
+# Set the environment variable for finding LCG releases:
+source ${scriptsdir}/LCG_RELEASE_BASE.sh
+
+# Flag for triggering the build of RPMs for the externals:
+RPMOPTIONS="-r ${BUILDDIR}"
+if [ "$CI" = "1" ]; then
+    RPMOPTIONS=
+fi
+
+# Read in the tag/branch to use for atlasexternals:
+AtlasExternalsVersion=$(awk '/^AtlasExternalsVersion/{print $3}' ${thisdir}/externals.txt)
+
+# Check out AthenaExternals from the right branch/tag:
+${scriptsdir}/checkout_atlasexternals.sh \
+    -t ${AtlasExternalsVersion} \
+    -s ${BUILDDIR}/src/atlasexternals 2>&1 | tee ${BUILDDIR}/src/checkout.atlasexternals.log 
diff --git a/Projects/AthDataQuality/externals.txt b/Projects/AthDataQuality/externals.txt
new file mode 100644
index 0000000000000000000000000000000000000000..84f7191e0ce85ca285879f1d14e62c2e9a7e0fdf
--- /dev/null
+++ b/Projects/AthDataQuality/externals.txt
@@ -0,0 +1,8 @@
+# Version(s) of the various externals to get/build before starting the build of
+# this project, when doing a full stack nightly build.
+#
+# Remember that when specifying the name of a branch, you *must* put
+# an "origin/" prefix before it. For tags however this is explicitly
+# forbidden.
+
+AtlasExternalsVersion = 1.0.25
diff --git a/Projects/AthDataQuality/modules/skeletons/atlas_export_sanitizer.cmake.in b/Projects/AthDataQuality/modules/skeletons/atlas_export_sanitizer.cmake.in
new file mode 100644
index 0000000000000000000000000000000000000000..debc9e4ddb5d02e5ea53f750a37d1b772a734943
--- /dev/null
+++ b/Projects/AthDataQuality/modules/skeletons/atlas_export_sanitizer.cmake.in
@@ -0,0 +1,72 @@
+#
+# This script is used to tweak the exported file created by CMake for
+# describing the installed targets of a release, not to treat it as a
+# fatal error if one of the targets is missing. Which can very much
+# be the case in a nightly, if a package fails building. But it should
+# not stop the downstream projects from building all together.
+#
+
+# Look for specific target files:
+set( _fileName "$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/" )
+set( _fileName "${_fileName}@CMAKE_INSTALL_CMAKEDIR@/" )
+set( _fileName "${_fileName}@CMAKE_PROJECT_NAME@Config-targets-*.cmake" )
+file( GLOB _targetFiles ${_fileName} )
+foreach( _file ${_targetFiles} )
+   # Add a line at the end of each file that clears out the
+   # _IMPORT_CHECK_TARGETS variable. So that no targets would be checked
+   # at the build configuration time.
+   file( APPEND "${_file}"
+      "# Don't check the imported targets:\n"
+      "set(_IMPORT_CHECK_TARGETS)\n" )
+endforeach()
+
+# The name of the main file to sanitize:
+set( _fileName "$ENV{DESTDIR}/${CMAKE_INSTALL_PREFIX}/" )
+set( _fileName "${_fileName}@CMAKE_INSTALL_CMAKEDIR@/" )
+set( _fileName "${_fileName}@CMAKE_PROJECT_NAME@Config-targets.cmake" )
+
+# Read in the generated targets file:
+file( READ ${_fileName} _targetsContent )
+
+# Do all the necessary string replacements. It has to be done in this
+# complicated way, as semicolons in the string are interpreted by string(...)
+# as list delimeters. And are removed if I give the content as a single
+# value.
+set( _outputContent )
+foreach( _element ${_targetsContent} )
+   # Lower the level of fatal messages to warning. To make nightlies with
+   # package failures still useful for code development.
+   string( REPLACE "FATAL_ERROR" "WARNING" _newContent ${_element} )
+   # Make the paths coming from LCG be treated as absolute paths, and not
+   # relative ones.
+   if( ${CMAKE_VERSION} VERSION_LESS 3.4.0 )
+      string( REPLACE "\${_IMPORT_PREFIX}/\${LCG_RELEASE_BASE}"
+         "\${LCG_RELEASE_BASE}" _newContent ${_newContent} )
+   else()
+      string( REPLACE "\${_IMPORT_PREFIX}/\\\${LCG_RELEASE_BASE}"
+         "\\\${LCG_RELEASE_BASE}" _newContent ${_newContent} )
+      string( REPLACE "\\\${LCG_RELEASE_BASE}"
+         "\${LCG_RELEASE_BASE}" _newContent ${_newContent} )
+   endif()
+   # Replace the absolute tdaq paths with ones relying on an environment
+   # variable:
+   if( NOT "$ENV{TDAQ_RELEASE_BASE}" STREQUAL "" )
+      string( REPLACE "$ENV{TDAQ_RELEASE_BASE}" "\$ENV{TDAQ_RELEASE_BASE}"
+         _newContent ${_newContent} )
+   endif()
+   # Append it to the full string:
+   if( _outputContent )
+      set( _outputContent "${_outputContent}\;${_newContent}" )
+   else()
+      set( _outputContent "${_newContent}" )
+   endif()
+endforeach()
+
+# Overwrite the original file with the new content:
+file( WRITE ${_fileName} ${_outputContent} )
+
+# Unset all created variables:
+unset( _targetsContent )
+unset( _newContent )
+unset( _outputContent )
+unset( _fileName )
diff --git a/Projects/AthDataQuality/package_filters.txt b/Projects/AthDataQuality/package_filters.txt
new file mode 100644
index 0000000000000000000000000000000000000000..5e330d7eefcdc198ccc258ff9032a3b6421bb0a9
--- /dev/null
+++ b/Projects/AthDataQuality/package_filters.txt
@@ -0,0 +1,13 @@
+#
+# Packages to build as part of the AthDataQuality project.
+#
++ DataQuality/DQDefects
++ DataQuality/DQUtils
++ DataQuality/dqm_algorithms
++ DataQuality/DataQualityInterfaces
++ DataQuality/DataQualityUtils
++ DataQuality/DataQualityConfigurations
++ DataQuality/DCSCalculator2
++ DataQuality/ZLumiScripts
++ Database/CoraCool
+- .*
diff --git a/Projects/AthDataQuality/version.txt b/Projects/AthDataQuality/version.txt
new file mode 100644
index 0000000000000000000000000000000000000000..d08668a1ba47cfa2fab8ce7da484940c724fe4c7
--- /dev/null
+++ b/Projects/AthDataQuality/version.txt
@@ -0,0 +1 @@
+22.0.0.1
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIEventShapeJetIteration.cxx b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIEventShapeJetIteration.cxx
index 0d87510b412527f98724c2c97b4426ceb910c553..b03baf151e9bf4bb4a0dbc60b3474408dd8fc686 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/Root/HIEventShapeJetIteration.cxx
+++ b/Reconstruction/HeavyIonRec/HIJetRec/Root/HIEventShapeJetIteration.cxx
@@ -58,8 +58,8 @@ int HIEventShapeJetIteration::execute() const
   const xAOD::JetContainer* theCaloJets=0;
   const xAOD::JetContainer* theTrackJets=0;
 
-  if(m_calo_jet_seed_key.compare("")!=0) ATH_CHECK(evtStore()->retrieve(theCaloJets,m_calo_jet_seed_key));
-  if(m_track_jet_seed_key.compare("")!=0) ATH_CHECK(evtStore()->retrieve(theTrackJets,m_track_jet_seed_key));
+  if(m_calo_jet_seed_key.compare("")!=0) ATH_CHECK(evtStore()->retrieve(theCaloJets,m_calo_jet_seed_key), 1);
+  if(m_track_jet_seed_key.compare("")!=0) ATH_CHECK(evtStore()->retrieve(theTrackJets,m_track_jet_seed_key), 1);
 
   if(theTrackJets && m_exclude_constituents) 
   {
@@ -72,8 +72,8 @@ int HIEventShapeJetIteration::execute() const
 
   std::vector<const xAOD::CaloCluster*> assoc_clusters;
   assoc_clusters.reserve(6400);
-  if(theCaloJets) ATH_CHECK(makeClusterList(assoc_clusters,theCaloJets,used_indices,used_eta_bins));
-  if(theTrackJets) ATH_CHECK(makeClusterList(assoc_clusters,theTrackJets,used_indices,used_eta_bins));
+  if(theCaloJets) ATH_CHECK(makeClusterList(assoc_clusters,theCaloJets,used_indices,used_eta_bins), 1);
+  if(theTrackJets) ATH_CHECK(makeClusterList(assoc_clusters,theTrackJets,used_indices,used_eta_bins), 1);
   
   updateShape(output_shape,assoc_clusters,es_index);
   
@@ -83,13 +83,13 @@ int HIEventShapeJetIteration::execute() const
     xAOD::HIEventShapeContainer* modShape=new xAOD::HIEventShapeContainer;
     xAOD::HIEventShapeAuxContainer *modShapeAux = new xAOD::HIEventShapeAuxContainer;
     modShape->setStore( modShapeAux );
-    ATH_CHECK( evtStore()->record(modShape,m_modulation_key) );
-    ATH_CHECK( evtStore()->record(modShapeAux,m_modulation_key+std::string("Aux.")) );
+    ATH_CHECK( evtStore()->record(modShape,m_modulation_key), 1 );
+    ATH_CHECK( evtStore()->record(modShapeAux,m_modulation_key+std::string("Aux.")), 1 );
     
     xAOD::HIEventShape* ms=new xAOD::HIEventShape();
     modShape->push_back(ms);
-    ATH_CHECK( fillModulatorShape(ms,output_shape,used_indices,m_modulation_scheme) );
-    if(m_do_remodulation) ATH_CHECK( remodulate(output_shape,ms,used_indices) );
+    ATH_CHECK( fillModulatorShape(ms,output_shape,used_indices,m_modulation_scheme), 1 );
+    if(m_do_remodulation) ATH_CHECK( remodulate(output_shape,ms,used_indices), 1 );
   }
   return 0;
 }
diff --git a/Reconstruction/HeavyIonRec/HIJetRec/src/HIClusterSubtraction.cxx b/Reconstruction/HeavyIonRec/HIJetRec/src/HIClusterSubtraction.cxx
index d30ead0f6c6a5ee753941dcfc28826c19ddcab51..0f11ed3cbe26ff4703b4cd3716677fec31a5640a 100644
--- a/Reconstruction/HeavyIonRec/HIJetRec/src/HIClusterSubtraction.cxx
+++ b/Reconstruction/HeavyIonRec/HIJetRec/src/HIClusterSubtraction.cxx
@@ -58,7 +58,7 @@ int HIClusterSubtraction::execute() const
     return 1;
   }
   const xAOD::HIEventShape* eshape = nullptr;
-  CHECK(m_modulator_tool->getShape(eshape));
+  CHECK(m_modulator_tool->getShape(eshape), 1);
 
   for(xAOD::CaloClusterContainer::iterator itr=ccl->begin(); itr!=ccl->end(); itr++) 
   {
@@ -76,7 +76,7 @@ int HIClusterSubtraction::execute() const
       toolIt!=m_clusterCorrectionTools.end();toolIt++) 
   {
     ATH_MSG_DEBUG(" Applying correction = " << (*toolIt)->name() );
-    CHECK((*toolIt)->execute(Gaudi::Hive::currentContext(), ccl));
+    CHECK((*toolIt)->execute(Gaudi::Hive::currentContext(), ccl), 1);
   }//End loop over correction tools
   return 0;
 }
diff --git a/Reconstruction/Jet/JetCalibTools/Root/JetCalibrationTool.cxx b/Reconstruction/Jet/JetCalibTools/Root/JetCalibrationTool.cxx
index cabeef489b7699ffbec74db60dd209c84efc1359..59dbe9a061a6818de19545a4de54f9624ebd4593 100644
--- a/Reconstruction/Jet/JetCalibTools/Root/JetCalibrationTool.cxx
+++ b/Reconstruction/Jet/JetCalibTools/Root/JetCalibrationTool.cxx
@@ -325,17 +325,17 @@ int JetCalibrationTool::modify(xAOD::JetContainer& jets) const {
   //Grab necessary event info for pile up correction and store it in a JetEventInfo class object
   ATH_MSG_VERBOSE("Modifying jet collection.");
   JetEventInfo jetEventInfo;
-  ATH_CHECK( initializeEvent(jetEventInfo) );
+  ATH_CHECK( initializeEvent(jetEventInfo), 1 );
   xAOD::JetContainer::iterator jet_itr = jets.begin();
   xAOD::JetContainer::iterator jet_end = jets.end(); 
   for ( ; jet_itr != jet_end; ++jet_itr )
-    ATH_CHECK( calibrateImpl(**jet_itr,jetEventInfo) );
+    ATH_CHECK( calibrateImpl(**jet_itr,jetEventInfo), 1 );
  return 0;
 }
 
 int JetCalibrationTool::modifyJet(xAOD::Jet& jet) const {
   ATH_MSG_VERBOSE("Modifying jet.");
-  ATH_CHECK( applyCalibration(jet) );
+  ATH_CHECK( applyCalibration(jet), 1 );
   return 0;
 }
 
diff --git a/Reconstruction/Jet/JetCalibTools/util/JetCalibTools_Example.cxx b/Reconstruction/Jet/JetCalibTools/util/JetCalibTools_Example.cxx
index a076834f9999c0265815b30054db04dc9c826a6e..575c6105eb78a9d5ae2404d0f2947308062bcd35 100644
--- a/Reconstruction/Jet/JetCalibTools/util/JetCalibTools_Example.cxx
+++ b/Reconstruction/Jet/JetCalibTools/util/JetCalibTools_Example.cxx
@@ -137,10 +137,12 @@ int main(int argc, char* argv[]){
 #ifdef XAOD_STANDALONE
   RETURN_CHECK( APP_NAME, xAOD::Init() );
   xAOD::TEvent event( xAOD::TEvent::kClassAccess );
+  RETURN_CHECK( APP_NAME, event.readFrom( ifile.get() ) );
 #else // Athena "Store" is the same StoreGate used by the TEvent
   POOL::TEvent event( POOL::TEvent::kClassAccess );
+  CHECK_WITH_CONTEXT( event.readFrom( ifile.get() ), APP_NAME, 1 );
 #endif
-  RETURN_CHECK( APP_NAME, event.readFrom( ifile.get() ) );
+ 
 
   //----------------------------------
   // Initialization of JetCalibTools
@@ -149,17 +151,17 @@ int main(int argc, char* argv[]){
 
   // Call the constructor
   JetCalibrationTool jetCalibrationTool(name_JetCalibTools.c_str());
-  RETURN_CHECK(APP_NAME,
-               jetCalibrationTool.setProperty("JetCollection",
-                                              jetColl.c_str()));
-  RETURN_CHECK(APP_NAME,
-               jetCalibrationTool.setProperty("CalibSequence",
-                                              calibSeq.c_str()));
-  RETURN_CHECK(APP_NAME,
-               jetCalibrationTool.setProperty("ConfigFile",
-                                              jetCalibConfig.c_str()));
-  RETURN_CHECK(APP_NAME,
-               jetCalibrationTool.setProperty("IsData",isCollision));
+  CHECK_WITH_CONTEXT( jetCalibrationTool.setProperty("JetCollection",jetColl.c_str()),
+                      APP_NAME, 1 );
+
+  CHECK_WITH_CONTEXT( jetCalibrationTool.setProperty("CalibSequence",calibSeq.c_str()),
+                      APP_NAME, 1 );
+
+  CHECK_WITH_CONTEXT( jetCalibrationTool.setProperty("ConfigFile",jetCalibConfig.c_str()),
+                      APP_NAME, 1 );
+
+  CHECK_WITH_CONTEXT( jetCalibrationTool.setProperty("IsData",isCollision),
+                      APP_NAME, 1 );
 
   // Initialize the tool
   if(!(jetCalibrationTool.initialize().isSuccess())){
@@ -185,15 +187,14 @@ int main(int argc, char* argv[]){
 
     // Retrieve jet container
     const xAOD::JetContainer* jets = 0;
-    RETURN_CHECK( APP_NAME, event.retrieve( jets, jetColl + "Jets" ) );
+    CHECK_WITH_CONTEXT( event.retrieve( jets, jetColl + "Jets" ), APP_NAME, 1 );
 
     // Shallow copy 
     auto jets_shallowCopy = xAOD::shallowCopyContainer( *jets );
 
     // Iterate over the shallow copy
     for( xAOD::Jet* jet : *( jets_shallowCopy.first ) ) {
-       RETURN_CHECK( APP_NAME,
-                     jetCalibrationTool.applyCalibration( *jet ) );
+       CHECK_WITH_CONTEXT( jetCalibrationTool.applyCalibration( *jet ), APP_NAME, 1 );
       // Do something
     }
     delete jets_shallowCopy.first;
diff --git a/Reconstruction/Jet/JetMonitoring/Root/EfficiencyResponseHistos.cxx b/Reconstruction/Jet/JetMonitoring/Root/EfficiencyResponseHistos.cxx
index 7ceeaf81b1f9771032703f5931dd2f0557b157e9..1fbc305e44a78897718c619d01d2493eca66fc93 100644
--- a/Reconstruction/Jet/JetMonitoring/Root/EfficiencyResponseHistos.cxx
+++ b/Reconstruction/Jet/JetMonitoring/Root/EfficiencyResponseHistos.cxx
@@ -56,7 +56,7 @@ int EfficiencyResponseHistos::buildHistos(){
 int EfficiencyResponseHistos::fillHistosFromContainer(const xAOD::JetContainer &cont){
 
   const xAOD::JetContainer* refContainer = 0;
-  CHECK( evtStore()->retrieve( refContainer, m_refContainerName) ); 
+  CHECK( evtStore()->retrieve( refContainer, m_refContainerName), 1 );
   /// use a list to be a bit more efficient.
   std::list<const xAOD::Jet*> listJets(cont.begin(), cont.end());
 
diff --git a/Reconstruction/Jet/JetMonitoring/Root/HIEfficiencyResponseHistos.cxx b/Reconstruction/Jet/JetMonitoring/Root/HIEfficiencyResponseHistos.cxx
index 2617e193e47a42c90378b23cc92102a153a42834..3ae85116b37c7061d6f407337481d57eabd57a84 100644
--- a/Reconstruction/Jet/JetMonitoring/Root/HIEfficiencyResponseHistos.cxx
+++ b/Reconstruction/Jet/JetMonitoring/Root/HIEfficiencyResponseHistos.cxx
@@ -118,7 +118,7 @@ int HIEfficiencyResponseHistos::fillHistosFromContainer(const xAOD::JetContainer
   }
 
   const xAOD::JetContainer* refContainer = 0;
-  CHECK( evtStore()->retrieve( refContainer, m_refContainerName) ); 
+  CHECK( evtStore()->retrieve( refContainer, m_refContainerName), 1 );
   /// use a list to be a bit more efficient.
   std::list<const xAOD::Jet*> listJets(cont.begin(), cont.end());
 
diff --git a/Reconstruction/Jet/JetMonitoring/Root/HIJetUEMonitoring.cxx b/Reconstruction/Jet/JetMonitoring/Root/HIJetUEMonitoring.cxx
index ff57745b717fc95378c16b2401e8573d4192c90d..bebe5f84c3ea7de493a65d89a3b3e9a7450cdde8 100644
--- a/Reconstruction/Jet/JetMonitoring/Root/HIJetUEMonitoring.cxx
+++ b/Reconstruction/Jet/JetMonitoring/Root/HIJetUEMonitoring.cxx
@@ -136,12 +136,12 @@ int HIJetUEMonitoring::buildHistos(){
 int HIJetUEMonitoring::fillHistosFromJet(const xAOD::Jet &j){
 
   const xAOD::EventInfo* evtInfo;
-  CHECK(evtStore()->retrieve( evtInfo ));
+  CHECK(evtStore()->retrieve( evtInfo ), 1);
 
 //LAr event veto: skip events rejected by LAr
   if(evtInfo->errorState(xAOD::EventInfo::LAr)==xAOD::EventInfo::Error){
     ATH_MSG_DEBUG("SKIP for LAR error");
-    return StatusCode::SUCCESS;
+    return 1;
   }
 
   n=2;
diff --git a/Reconstruction/Jet/JetMonitoring/Root/JetContainerHistoFiller.cxx b/Reconstruction/Jet/JetMonitoring/Root/JetContainerHistoFiller.cxx
index bc5de12355c174da47ca8c8434dab26fb33bd2ff..f91740c24a2fa15923d2ab69ef140cf78797bdc4 100644
--- a/Reconstruction/Jet/JetMonitoring/Root/JetContainerHistoFiller.cxx
+++ b/Reconstruction/Jet/JetMonitoring/Root/JetContainerHistoFiller.cxx
@@ -37,12 +37,12 @@ int JetContainerHistoFiller::fillHistos(){
   ATH_MSG_DEBUG ("Filling hists " << name() << "..." << m_jetContainerName);
 
   const xAOD::EventInfo* evtInfo;
-  CHECK(evtStore()->retrieve( evtInfo ));
+  CHECK(evtStore()->retrieve( evtInfo ), 1);
 
   //LAr event veto: skip events rejected by LAr
   if(evtInfo->errorState(xAOD::EventInfo::LAr)==xAOD::EventInfo::Error){
     ATH_MSG_DEBUG("SKIP for LAR error");
-    return StatusCode::SUCCESS;
+    return 1;
   }
   
   const xAOD::JetContainer* jCont = 0;
diff --git a/Reconstruction/MET/METReconstruction/Root/METTauTool.cxx b/Reconstruction/MET/METReconstruction/Root/METTauTool.cxx
index 0d8a2f052981275783439416fa85ccd7f1b63521..52c222abbc8c3bde270ac38ff530d37acc681143 100644
--- a/Reconstruction/MET/METReconstruction/Root/METTauTool.cxx
+++ b/Reconstruction/MET/METReconstruction/Root/METTauTool.cxx
@@ -187,7 +187,7 @@ namespace met {
     /////////////////////////////////////////// TO-BE REMOVED!!!
     const CaloClusterContainer* modClusCont(0);
     if(m_useModClus) {
-      ATH_CHECK( evtStore()->retrieve(modClusCont,m_mod_clus_key) );
+      ATH_CHECK( evtStore()->retrieve(modClusCont,m_mod_clus_key), false );
     }
     double sumE_allclus = 0.;
     std::vector<const IParticle*> constit_vec;
diff --git a/Reconstruction/MissingETPerformance/src/MissingETEventSelector.cxx b/Reconstruction/MissingETPerformance/src/MissingETEventSelector.cxx
index 31131175ddd7df6872859f6193388967bae77e3e..cb537d1ed126959749ad552298e201dd9e2a2f36 100644
--- a/Reconstruction/MissingETPerformance/src/MissingETEventSelector.cxx
+++ b/Reconstruction/MissingETPerformance/src/MissingETEventSelector.cxx
@@ -517,7 +517,7 @@ bool MissingETEventSelector::hasgoodZ_tautau(){
     int* flag = 0;
     if (evtStore()->retrieve(flag, m_passflagZtautau).isFailure() || !flag){ 
         msg() << MSG::DEBUG <<"Failed to retrieve " << m_passflagZtautau <<endmsg;
-        return StatusCode::FAILURE;
+        return false;
     }	
     if (*flag!=0){
         msg() << MSG::WARNING << "Event ok = flag " << *flag << endmsg;
@@ -533,7 +533,7 @@ bool MissingETEventSelector::hasgoodZ_tautau(){
     if(evtStore()->retrieve(tau_cont, m_tau_container).isFailure() || !tau_cont )
     {
         msg() << MSG::DEBUG <<"Failed to retrieve " << m_tau_container <<endmsg;
-        return StatusCode::FAILURE;
+        return false;
     }
     if(tau_cont->size() == 0)
     {
@@ -546,7 +546,7 @@ bool MissingETEventSelector::hasgoodZ_tautau(){
     if(evtStore()->retrieve(lepton_cont, m_lepton_container).isFailure() || !lepton_cont )
     {
          msg() << MSG::DEBUG <<"Failed to retrieve " << m_lepton_container<<endmsg; 
-        return StatusCode::FAILURE;
+        return false;
     }
     if(lepton_cont->size() != 1)
     {
diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx
index 1da2550059ea77e872fa36f7e93bd8baf1a92979..db5c7e659381d80ff394924471e1ab7c109dd476 100755
--- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx
+++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx
@@ -108,6 +108,7 @@ StatusCode TrackDepositInCaloTool::initialize() {
   ATH_MSG_INFO("initialize() successful in " << name());
   return StatusCode::SUCCESS;
 
+  ATH_CHECK(m_extrapolator.retrieve());
   ATH_CHECK(m_caloExtensionTool.retrieve()   );
   ATH_CHECK(m_caloCellAssociationTool.retrieve());
 }
diff --git a/Reconstruction/MuonIdentification/MuidCaloEnergyTools/src/MuidCaloEnergyTool.cxx b/Reconstruction/MuonIdentification/MuidCaloEnergyTools/src/MuidCaloEnergyTool.cxx
index 7c5607e5dd595b7c36e10b5c0a3bf195ef275130..cc4cedfd1b8d48d7b47fdf9563fa6eb479a82f0d 100755
--- a/Reconstruction/MuonIdentification/MuidCaloEnergyTools/src/MuidCaloEnergyTool.cxx
+++ b/Reconstruction/MuonIdentification/MuidCaloEnergyTools/src/MuidCaloEnergyTool.cxx
@@ -139,8 +139,13 @@ StatusCode MuidCaloEnergyTool::initialize()
 	else
 	{
 	    ATH_MSG_WARNING( " Using energy measurement without trackIsolation " );
+	    m_trackIsolationTool.disable();
 	}
     }
+    else{
+      m_trackIsolationTool.disable();
+      m_caloMeasTool.disable();
+    }
 
     return StatusCode::SUCCESS;
 }
diff --git a/Reconstruction/MuonIdentification/MuidCaloScatteringTools/src/MuidCaloMaterialParam.cxx b/Reconstruction/MuonIdentification/MuidCaloScatteringTools/src/MuidCaloMaterialParam.cxx
index 7082a80a947554d33ed3b981586e9251e9ea6330..eb2946d713ea87411b018a74920878cbaac87aea 100755
--- a/Reconstruction/MuonIdentification/MuidCaloScatteringTools/src/MuidCaloMaterialParam.cxx
+++ b/Reconstruction/MuonIdentification/MuidCaloScatteringTools/src/MuidCaloMaterialParam.cxx
@@ -75,6 +75,9 @@ MuidCaloMaterialParam::initialize()
 	    ATH_MSG_INFO( "Retrieved tool " << m_surfaceDisplayTool );
 	}
     }
+    else{
+      m_surfaceDisplayTool.disable();
+    }
 	
     // setup up CaloMaterial
     m_caloInnerLayers.reserve(2*m_numberBins);
diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/CMakeLists.txt b/Reconstruction/MuonIdentification/MuonCombinedAlgs/CMakeLists.txt
index 265b62d2410b1efa44897d2f064703408879c144..7be72fc19f4eeb99b86619531ab342395effb997 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/CMakeLists.txt
+++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/CMakeLists.txt
@@ -14,6 +14,8 @@ atlas_depends_on_subdirs( PRIVATE
 			  Event/xAOD/xAODTruth
                           GaudiKernel
                           MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment
+			  MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecToolInterfaces
+			  MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonLayerEvent
                           Reconstruction/MuonIdentification/MuonCombinedEvent
                           Reconstruction/MuonIdentification/MuonCombinedToolInterfaces
                           Tracking/TrkEvent/TrkSegment
@@ -24,5 +26,5 @@ atlas_depends_on_subdirs( PRIVATE
 atlas_add_component( MuonCombinedAlgs
                      src/*.cxx
                      src/components/*.cxx
-                     LINK_LIBRARIES AthenaBaseComps xAODCaloEvent xAODMuon xAODTruth xAODTracking GaudiKernel MuonSegment MuonCombinedEvent MuonCombinedToolInterfaces TrkSegment TrkTrack TrkToolInterfaces)
+                     LINK_LIBRARIES AthenaBaseComps xAODCaloEvent xAODMuon xAODTruth xAODTracking GaudiKernel MuonSegment MuonRecToolInterfaces MuonLayerEvent MuonCombinedEvent MuonCombinedToolInterfaces TrkSegment TrkTrack TrkToolInterfaces)
 
diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetCandidateAlg.cxx b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetCandidateAlg.cxx
index 591d668a7dd05c26a5dd2f3e45fe46d799d0a02e..58930c70f6effb445ff997828d16b249f8bed4f0 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetCandidateAlg.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetCandidateAlg.cxx
@@ -6,6 +6,8 @@
 #include "MuonCombinedInDetCandidateAlg.h"
 #include "TrkToolInterfaces/ITrackSelectorTool.h"
 //#include "MuonCombinedToolInterfaces/IInDetCandidateTool.h"
+#include "MuonRecToolInterfaces/IMuonSystemExtensionTool.h"
+#include "MuonLayerEvent/MuonSystemExtension.h"
 #include "xAODTruth/TruthParticleContainer.h"
 
 using namespace MuonCombined;
@@ -13,12 +15,14 @@ using namespace MuonCombined;
 MuonCombinedInDetCandidateAlg::MuonCombinedInDetCandidateAlg(const std::string& name, ISvcLocator* pSvcLocator):
   AthAlgorithm(name,pSvcLocator),
   m_doSiliconForwardMuons(false),
-  m_trackSelector("InDet::InDetDetailedTrackSelectorTool/MuonCombinedInDetDetailedTrackSelectorTool")
+  m_trackSelector("InDet::InDetDetailedTrackSelectorTool/MuonCombinedInDetDetailedTrackSelectorTool"),
+  m_muonSystemExtensionTool("Muon::MuonSystemExtensionTool/MuonSystemExtensionTool")
 {  
   declareProperty("TrackSelector", m_trackSelector);
   declareProperty("InDetForwardTrackSelector", m_forwardTrackSelector);
   declareProperty("TrackParticleLocation",m_indetTrackParticleLocation = {"InDetTrackParticles"});
   declareProperty("ForwardParticleLocation",m_indetForwardTrackParticleLocation = "InDetForwardTrackParticles");
+  declareProperty("MuonSystemExtensionTool",m_muonSystemExtensionTool );
   declareProperty("InDetCandidateLocation", m_candidateCollectionName = "InDetCandidates");
   declareProperty("DoSiliconAssocForwardMuons", m_doSiliconForwardMuons = false);
 }
@@ -28,6 +32,7 @@ MuonCombinedInDetCandidateAlg::~MuonCombinedInDetCandidateAlg(){}
 StatusCode MuonCombinedInDetCandidateAlg::initialize()
 {
   ATH_CHECK(m_trackSelector.retrieve());
+  ATH_CHECK(m_muonSystemExtensionTool.retrieve());
   ATH_CHECK(m_indetTrackParticleLocation.initialize());
   ATH_CHECK(m_indetForwardTrackParticleLocation.initialize());
   ATH_CHECK(m_candidateCollectionName.initialize());
@@ -111,6 +116,11 @@ void MuonCombinedInDetCandidateAlg::create( const xAOD::TrackParticleContainer&
     InDetCandidate* candidate = new InDetCandidate(link);
     if (flagCandidateAsSiAssociated)
       candidate->setSiliconAssociated(true);
+    else{ //Si-associated candidates don't need these
+      const Muon::MuonSystemExtension* muonSystemExtension = 0;
+      m_muonSystemExtensionTool->muonSystemExtension( candidate->indetTrackParticle(), muonSystemExtension );
+      candidate->setExtension(muonSystemExtension);
+    }
     ++ntracks;
     outputContainer.push_back(candidate);
   }
diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetCandidateAlg.h b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetCandidateAlg.h
index b73a4c064a7cadb9282adf86d5686a9ef9eb8c54..5764d0c07f5d6dfae573baa3b0a1d42cff4e7195 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetCandidateAlg.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCombinedInDetCandidateAlg.h
@@ -17,6 +17,10 @@ namespace Trk {
   class ITrackSelectorTool;
 }
 
+namespace Muon {
+  class IMuonSystemExtensionTool;
+}
+
 class MuonCombinedInDetCandidateAlg : public AthAlgorithm
 {
  public:
@@ -36,6 +40,7 @@ class MuonCombinedInDetCandidateAlg : public AthAlgorithm
   ToolHandle <Trk::ITrackSelectorTool> m_trackSelector;
   ToolHandle <Trk::ITrackSelectorTool> m_forwardTrackSelector;
   ToolHandle <Trk::ITrackSelectorTool> m_currentTrackSelector;
+  ToolHandle <Muon::IMuonSystemExtensionTool> m_muonSystemExtensionTool;
 
   void create(const xAOD::TrackParticleContainer& indetTrackParticles,
 	      InDetCandidateCollection& outputContainer,
diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCreatorAlg.cxx b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCreatorAlg.cxx
index e4d457da3cf9bc6e9c34811a9b1e2de48910541f..314103127c20f02d1778dfb0260fc9eeb1940a6b 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCreatorAlg.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCreatorAlg.cxx
@@ -22,23 +22,42 @@ MuonCreatorAlg::MuonCreatorAlg(const std::string& name, ISvcLocator* pSvcLocator
   m_muonCreatorTool("MuonCombined::MuonCreatorTool/MuonCreatorTool")
 {  
   declareProperty("MuonCreatorTool",m_muonCreatorTool);
-  declareProperty("MuonContainerLocation",m_muonCollectionName = "Muons" );
-  declareProperty("SlowMuonContainerLocation",m_slowMuonCollectionName = "SlowMuons" );
-  declareProperty("CombinedLocation", m_combinedCollectionName = "CombinedMuon" );
-  declareProperty("ExtrapolatedLocation", m_extrapolatedCollectionName = "ExtrapolatedMuon" );
-  declareProperty("MSOnlyExtrapolatedLocation", m_msOnlyExtrapolatedCollectionName = "MSOnlyExtrapolatedMuon" );
-  declareProperty("SegmentContainerName", m_segContainerName = "MuonSegments" );
   declareProperty("BuildSlowMuon",m_buildSlowMuon=false);
-  declareProperty("ClusterContainerName",m_clusterContainerName="MuonClusterCollection");
+  declareProperty("CreateSAmuons", m_doSA=false);
+
 }
 
 MuonCreatorAlg::~MuonCreatorAlg(){}
 
 StatusCode MuonCreatorAlg::initialize()
 {
+
   ATH_CHECK(m_muonCreatorTool.retrieve());
-  ATH_CHECK(m_indetCandidateCollectionName.initialize());
+  ATH_CHECK(m_muonCollectionName.initialize());
+  ATH_CHECK(m_slowMuonCollectionName.initialize());
+  ATH_CHECK(m_indetCandidateCollectionName.initialize(!m_doSA));
   ATH_CHECK(m_muonCandidateCollectionName.initialize(!m_buildSlowMuon));
+  m_segTrkContainerName = "Trk"+m_segContainerName.key();
+  m_segContainerName = "xaod"+m_segContainerName.key();
+  ATH_CHECK(m_segContainerName.initialize());
+  ATH_CHECK(m_segTrkContainerName.initialize());
+  m_combinedTrkCollectionName = m_combinedCollectionName.key()+"Tracks";
+  m_combinedCollectionName = m_combinedCollectionName.key()+"TrackParticles";
+  ATH_CHECK(m_combinedCollectionName.initialize());
+  ATH_CHECK(m_combinedTrkCollectionName.initialize());
+  m_extrapolatedTrkCollectionName = m_extrapolatedCollectionName.key()+"Tracks";
+  m_extrapolatedCollectionName = m_extrapolatedCollectionName.key()+"TrackParticles";
+  ATH_CHECK(m_extrapolatedCollectionName.initialize());
+  ATH_CHECK(m_extrapolatedTrkCollectionName.initialize());
+  m_msOnlyExtrapolatedTrkCollectionName = m_msOnlyExtrapolatedCollectionName.key()+"Tracks";
+  m_msOnlyExtrapolatedCollectionName = m_msOnlyExtrapolatedCollectionName.key()+"TrackParticles";
+  ATH_CHECK(m_msOnlyExtrapolatedCollectionName.initialize());
+  ATH_CHECK(m_msOnlyExtrapolatedTrkCollectionName.initialize());
+  if(m_clusterContainerName.key()!=""){
+    ATH_CHECK(m_clusterContainerName.initialize());
+    m_clusterContainerLinkName = m_clusterContainerName.key()+"_links";
+    ATH_CHECK(m_clusterContainerLinkName.initialize());
+  }
 
   return StatusCode::SUCCESS; 
 }
@@ -46,123 +65,121 @@ StatusCode MuonCreatorAlg::initialize()
 StatusCode MuonCreatorAlg::execute()
 {
 
-  SG::ReadHandle<InDetCandidateCollection> indetCandidateCollection(m_indetCandidateCollectionName);
-  if(!indetCandidateCollection.isValid()){
-    ATH_MSG_ERROR("Could not read "<< m_indetCandidateCollectionName);
-    return StatusCode::FAILURE;
+  const InDetCandidateCollection *indetCandidateCollection = 0;
+  if(!m_doSA){
+    SG::ReadHandle<InDetCandidateCollection> indetRH(m_indetCandidateCollectionName);
+    if(!indetRH.isValid()){
+      ATH_MSG_ERROR("Could not read "<< m_indetCandidateCollectionName);
+      return StatusCode::FAILURE;
+    }
+    else{
+      indetCandidateCollection = indetRH.cptr();
+    }
   }
 
   // Create the xAOD container and its auxiliary store:
-  xAOD::MuonContainer* xaod = new xAOD::MuonContainer();
-  ATH_CHECK( evtStore()->record( xaod, m_muonCollectionName ) );
-
-  xAOD::MuonAuxContainer* aux = new xAOD::MuonAuxContainer();
-  ATH_CHECK( evtStore()->record( aux, m_muonCollectionName + "Aux." ) );
-  xaod->setStore( aux );
-  ATH_MSG_DEBUG( "Recorded Muons with key: " << m_muonCollectionName );    
-
-  MuonCombined::IMuonCreatorTool::OutputData output(*xaod);
-
-  // combined tracks
-  ATH_CHECK(createAndRecord(output.combinedTrackParticleContainer,output.combinedTrackCollection,m_combinedCollectionName));
-
-  // extrapolated tracks
-  ATH_CHECK(createAndRecord(output.extrapolatedTrackParticleContainer,output.extrapolatedTrackCollection,m_extrapolatedCollectionName));
-
-  //MS-only extrapolated tracks
-  ATH_CHECK(createAndRecord(output.msOnlyExtrapolatedTrackParticleContainer,output.msOnlyExtrapolatedTrackCollection,m_msOnlyExtrapolatedCollectionName));
-
-  // segments
-  ATH_CHECK(createAndRecordSegments(output.xaodSegmentContainer,output.muonSegmentCollection,m_segContainerName));
-
-  // calo clusters
-  if( m_clusterContainerName != "" ) ATH_CHECK(retrieveOrCreateAndRecord(output.clusterContainer));
+  SG::WriteHandle<xAOD::MuonContainer> wh_muons(m_muonCollectionName);
+  ATH_CHECK(wh_muons.record(std::make_unique<xAOD::MuonContainer>(), std::make_unique<xAOD::MuonAuxContainer>()));
+  ATH_MSG_DEBUG( "Recorded Muons with key: " << m_muonCollectionName.key() );    
   
+  MuonCombined::IMuonCreatorTool::OutputData output(*(wh_muons.ptr()));
+
+
+
+  // Create the and record track particles:
+  //combined tracks
+  SG::WriteHandle<xAOD::TrackParticleContainer> wh_combtp(m_combinedCollectionName);
+  SG::WriteHandle<TrackCollection> wh_combtrk(m_combinedTrkCollectionName);
+  ATH_CHECK(wh_combtp.record(std::make_unique<xAOD::TrackParticleContainer>(), std::make_unique<xAOD::TrackParticleAuxContainer>()));
+  ATH_CHECK(wh_combtrk.record(std::make_unique<TrackCollection>()));
+  output.combinedTrackParticleContainer = wh_combtp.ptr();
+  output.combinedTrackCollection = wh_combtrk.ptr();
+
+  //extrapolated tracks
+  SG::WriteHandle<xAOD::TrackParticleContainer> wh_extrtp(m_extrapolatedCollectionName);
+  SG::WriteHandle<TrackCollection> wh_extrtrk(m_extrapolatedTrkCollectionName);
+  ATH_CHECK(wh_extrtp.record(std::make_unique<xAOD::TrackParticleContainer>(), std::make_unique<xAOD::TrackParticleAuxContainer>()));
+  ATH_CHECK(wh_extrtrk.record(std::make_unique<TrackCollection>()));
+  output.extrapolatedTrackParticleContainer = wh_extrtp.ptr();
+  output.extrapolatedTrackCollection = wh_extrtrk.ptr();
+
+  //msonly tracks
+  SG::WriteHandle<xAOD::TrackParticleContainer> wh_msextrtp(m_msOnlyExtrapolatedCollectionName);
+  SG::WriteHandle<TrackCollection> wh_msextrtrk(m_msOnlyExtrapolatedTrkCollectionName);
+  ATH_CHECK(wh_msextrtp.record(std::make_unique<xAOD::TrackParticleContainer>(), std::make_unique<xAOD::TrackParticleAuxContainer>()));
+  ATH_CHECK(wh_msextrtrk.record(std::make_unique<TrackCollection>()));
+  output.msOnlyExtrapolatedTrackParticleContainer = wh_msextrtp.ptr();
+  output.msOnlyExtrapolatedTrackCollection = wh_msextrtrk.ptr();
+
+
+  //segments
+  SG::WriteHandle<xAOD::MuonSegmentContainer> wh_segment(m_segContainerName);
+  ATH_CHECK(wh_segment.record(std::make_unique<xAOD::MuonSegmentContainer>(),std::make_unique<xAOD::MuonSegmentAuxContainer>()));
+  output.xaodSegmentContainer=wh_segment.ptr();
+
+  SG::WriteHandle<Trk::SegmentCollection> wh_segmentTrk(m_segTrkContainerName);
+  ATH_CHECK(wh_segmentTrk.record(std::make_unique<Trk::SegmentCollection>()));
+  output.muonSegmentCollection=wh_segmentTrk.ptr();
+
+  xAOD::SlowMuonContainer *slowMuons=0;
+  xAOD::SlowMuonAuxContainer *slowMuonsAux=0;
   if (m_buildSlowMuon){
-    // Create the xAOD slow muon container and its auxiliary store:
-    output.slowMuonContainer = new xAOD::SlowMuonContainer();
-    ATH_CHECK( evtStore()->record( output.slowMuonContainer, m_slowMuonCollectionName ) );
-    
-    xAOD::SlowMuonAuxContainer* auxSlowMuon = new xAOD::SlowMuonAuxContainer();
-    ATH_CHECK( evtStore()->record( auxSlowMuon, m_slowMuonCollectionName + "Aux." ) );
-    output.slowMuonContainer->setStore( auxSlowMuon );
-    ATH_MSG_DEBUG( "Recorded Slow Muons with key: " << m_slowMuonCollectionName );
-    const MuonCandidateCollection* noMuons=0;
-    m_muonCreatorTool->create(noMuons, indetCandidateCollection.cptr() ,output);
+    slowMuons = new xAOD::SlowMuonContainer(); 
+    slowMuonsAux = new xAOD::SlowMuonAuxContainer();
+    slowMuons->setStore(slowMuonsAux);
+    output.slowMuonContainer = slowMuons;    
   }
-  else{
-    SG::ReadHandle<MuonCandidateCollection> muonCandidateCollection(m_muonCandidateCollectionName);
-    if(!muonCandidateCollection.isValid()){
+
+  const MuonCandidateCollection *muonCandidateCollection =0;
+
+  if(!m_buildSlowMuon){
+    SG::ReadHandle<MuonCandidateCollection> muonCandidateRH(m_muonCandidateCollectionName);
+    if(!muonCandidateRH.isValid()){
       ATH_MSG_ERROR("Could not read "<< m_muonCandidateCollectionName);
       return StatusCode::FAILURE;
     }
+    muonCandidateCollection = muonCandidateRH.cptr();
+  }
 
-    // build muons
-    if(!(muonCandidateCollection.cptr())){
-      ATH_MSG_WARNING("candidate collection missing, skip muon creation");
+  
+  // calo clusters
+  if( m_clusterContainerName.key() != "" ){
+    xAOD::CaloClusterContainer *caloclusters = new xAOD::CaloClusterContainer();
+    xAOD::CaloClusterAuxContainer *caloclustersaux = new xAOD::CaloClusterAuxContainer();
+    caloclusters->setStore(caloclustersaux);
+    output.clusterContainer = caloclusters;
+    CaloClusterCellLinkContainer *clusterlinks = new CaloClusterCellLinkContainer();
+    SG::WriteHandle<xAOD::CaloClusterContainer> wh_clusters(m_clusterContainerName);
+    SG::WriteHandle<CaloClusterCellLinkContainer> wh_clusterslink(m_clusterContainerLinkName);
+    m_muonCreatorTool->create(muonCandidateCollection, indetCandidateCollection,output);
+
+    //record clusters and set the links
+    ATH_CHECK(wh_clusters.record(std::unique_ptr<xAOD::CaloClusterContainer>(caloclusters),std::unique_ptr<xAOD::CaloClusterAuxContainer>(caloclustersaux)));
+    auto sg = wh_clusters.storeHandle().get();
+    for (xAOD::CaloCluster* cl : *caloclusters) {
+      cl->setLink(clusterlinks, sg);
     }
-    else m_muonCreatorTool->create(muonCandidateCollection.cptr(), indetCandidateCollection.cptr() ,output);
-  }
+    ATH_CHECK(wh_clusterslink.record(std::unique_ptr<CaloClusterCellLinkContainer>(clusterlinks)));
 
-  return StatusCode::SUCCESS;
-}
 
-StatusCode MuonCreatorAlg::retrieveOrCreateAndRecord( xAOD::CaloClusterContainer*& xaod ) const {
+  }  
+  else{
 
-  // try retrieving the container
-  if(evtStore()->contains<xAOD::CaloClusterContainer>(m_clusterContainerName)) {
-    if(evtStore()->retrieve(xaod,m_clusterContainerName).isFailure()) {
-      ATH_MSG_FATAL( "Unable to retrieve " << m_clusterContainerName );
-      return StatusCode::FAILURE;
+    // build muons
+    if(!(muonCandidateCollection)){
+      ATH_MSG_WARNING("candidate collection missing, skip muon creation");
     }
-    ATH_MSG_DEBUG( "Retrieved CaloClusterContainer with key: " << m_clusterContainerName );    
-  }else{
-    // if not found in SG, create it
-    xaod = new xAOD::CaloClusterContainer();
-    ATH_CHECK( evtStore()->record( xaod, m_clusterContainerName ) );
-	
-    xAOD::CaloClusterAuxContainer* aux = new xAOD::CaloClusterAuxContainer();
-    ATH_CHECK( evtStore()->record( aux, m_clusterContainerName + "Aux." ) );
-    xaod->setStore( aux );
-    ATH_MSG_DEBUG( "Recorded CaloClusterContainer with key: " << m_clusterContainerName );    
+    else m_muonCreatorTool->create(muonCandidateCollection, indetCandidateCollection ,output);
   }
-  return StatusCode::SUCCESS;
-}
-
 
-StatusCode MuonCreatorAlg::createAndRecord( xAOD::TrackParticleContainer*& xaod, TrackCollection*& tracks, std::string name ) const {
-  std::string tpName = name + "TrackParticles";
-  std::string trackName = name + "Tracks";
+  if (m_buildSlowMuon){
+    SG::WriteHandle<xAOD::SlowMuonContainer> wh_slowmuon(m_slowMuonCollectionName);
+    ATH_CHECK(wh_slowmuon.record(std::unique_ptr<xAOD::SlowMuonContainer>(slowMuons),std::unique_ptr<xAOD::SlowMuonAuxContainer>(slowMuonsAux)));
+  }
 
-  // Create the xAOD container and its auxiliary store:
-  xaod = new xAOD::TrackParticleContainer();
-  ATH_CHECK( evtStore()->record( xaod, tpName ) );
-  xAOD::TrackParticleAuxContainer* aux = new xAOD::TrackParticleAuxContainer();
-  ATH_CHECK( evtStore()->record( aux, tpName + "Aux." ) );
-  xaod->setStore( aux );
-  ATH_MSG_DEBUG( "Recorded TrackParticles with key: " << tpName );
-
-  tracks = new TrackCollection();
-  return evtStore()->record( tracks, trackName );
+  return StatusCode::SUCCESS;
 }
 
-StatusCode MuonCreatorAlg::createAndRecordSegments( xAOD::MuonSegmentContainer*& xaodSegments, Trk::SegmentCollection*& segments, std::string name ) const {
-  
-  std::string xName = "xaod" + name;
-  std::string trkName = "Trk" + name;
-
-  // Create the xAOD container and its auxiliary store:
-  xaodSegments = new xAOD::MuonSegmentContainer();
-  ATH_CHECK( evtStore()->record( xaodSegments, xName ) );
-  xAOD::MuonSegmentAuxContainer* aux = new xAOD::MuonSegmentAuxContainer();
-  ATH_CHECK( evtStore()->record( aux, xName + "Aux." ) );
-
-  xaodSegments->setStore( aux);
-  ATH_MSG_DEBUG( "Recorded MuonSegments with key: " << xName);
-
-  segments = new Trk::SegmentCollection();
-  return evtStore()->record( segments, trkName );  
-}
 
 StatusCode MuonCreatorAlg::finalize()
 {
diff --git a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCreatorAlg.h b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCreatorAlg.h
index c3d7c31f60a936ff1bf67c032cae7367ac8c4008..8dec0617a721453d71d9d828cae92313ba125512 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCreatorAlg.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedAlgs/src/MuonCreatorAlg.h
@@ -35,21 +35,24 @@ class MuonCreatorAlg : public AthAlgorithm
   StatusCode finalize();
 
  private:
-  StatusCode createAndRecord( xAOD::TrackParticleContainer*& xaod, TrackCollection*& tracks, std::string name ) const;
-  StatusCode createAndRecordSegments( xAOD::MuonSegmentContainer*& xaodSegments,Trk::SegmentCollection*& segs, std::string name ) const;
-  StatusCode retrieveOrCreateAndRecord( xAOD::CaloClusterContainer*& xaod ) const;
 
   ToolHandle<MuonCombined::IMuonCreatorTool> m_muonCreatorTool;
-  std::string m_muonCollectionName;
-  std::string m_slowMuonCollectionName;
-  std::string m_combinedCollectionName;
-  std::string m_extrapolatedCollectionName;
-  std::string m_msOnlyExtrapolatedCollectionName;
+  SG::WriteHandleKey<xAOD::MuonContainer> m_muonCollectionName{this,"MuonContainerLocation", "Muons", "Muon Container"};
+  SG::WriteHandleKey<xAOD::SlowMuonContainer> m_slowMuonCollectionName{this, "SlowMuonContainerLocation", "SlowMuons", "Slow Muon Container"};
+  SG::WriteHandleKey<xAOD::TrackParticleContainer> m_combinedCollectionName{this, "CombinedLocation", "CombinedMuon", "Combined muons"};
+  SG::WriteHandleKey<TrackCollection> m_combinedTrkCollectionName;
+  SG::WriteHandleKey<xAOD::TrackParticleContainer> m_extrapolatedCollectionName{this, "ExtrapolatedLocation", "ExtrapolatedMuon", "Extrapolated muons"};
+  SG::WriteHandleKey<TrackCollection> m_extrapolatedTrkCollectionName;
+  SG::WriteHandleKey<xAOD::TrackParticleContainer> m_msOnlyExtrapolatedCollectionName{this, "MSOnlyExtrapolatedLocation", "MSOnlyExtrapolatedMuon", "MS Extrapolated muons"};
+  SG::WriteHandleKey<TrackCollection> m_msOnlyExtrapolatedTrkCollectionName;
   SG::ReadHandleKey<InDetCandidateCollection> m_indetCandidateCollectionName{this,"InDetCandidateLocation","InDetCandidates","ID candidates"};
   SG::ReadHandleKey<MuonCandidateCollection> m_muonCandidateCollectionName{this,"MuonCandidateLocation","MuonCandidates","Muon candidates"};
-  std::string m_segContainerName;
-  std::string m_clusterContainerName;
+  SG::WriteHandleKey<xAOD::MuonSegmentContainer> m_segContainerName{this, "SegmentContainerName", "MuonSegments", "Segments"};
+  SG::WriteHandleKey<Trk::SegmentCollection> m_segTrkContainerName;
+  SG::WriteHandleKey<xAOD::CaloClusterContainer> m_clusterContainerName{this, "ClusterContainerName", "MuonClusterCollection", "Clusters"};
+  SG::WriteHandleKey<CaloClusterCellLinkContainer> m_clusterContainerLinkName;
   bool m_buildSlowMuon;
+  bool m_doSA;
 
 };
 
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.cxx
index e1ce395928142f7f501ecace8a233d3afac35308..26c962172923c8199a230849f94a87801c8ddc98 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.cxx
@@ -148,6 +148,7 @@ namespace MuonCombined {
     ATH_CHECK(m_idHelper.retrieve());
     ATH_CHECK(m_printer.retrieve());
     ATH_CHECK(m_muonPrinter.retrieve());
+    ATH_CHECK(m_caloExtTool.retrieve());
     ATH_CHECK(m_edmHelper.retrieve());
     ATH_CHECK(m_particleCreator.retrieve());
     ATH_CHECK(m_ambiguityProcessor.retrieve());
@@ -460,20 +461,20 @@ namespace MuonCombined {
             ATH_MSG_DEBUG("MuonCreatorTool MuGirlLowBetaTag combined");
     
             // Create the xAOD object:
-            xAOD::SlowMuon* slowMuon = 0;
             if( outputData.slowMuonContainer ) {
-              slowMuon = new xAOD::SlowMuon();
+              xAOD::SlowMuon* slowMuon = new xAOD::SlowMuon();
               outputData.slowMuonContainer->push_back( slowMuon );
-            }
-            addMuGirlLowBeta(*muon,muGirlLowBetaTag,slowMuon, outputData ); // CHECK to see what variables are created here.
+            
+	      addMuGirlLowBeta(*muon,muGirlLowBetaTag,slowMuon, outputData ); // CHECK to see what variables are created here.
 
-            ATH_MSG_DEBUG("slowMuon muonContainer size "<<outputData.muonContainer->size());
-            ElementLink<xAOD::MuonContainer> muonLink(*outputData.muonContainer,outputData.muonContainer->size()-1);
-            if( slowMuon && muonLink.isValid() ) {
+	      ATH_MSG_DEBUG("slowMuon muonContainer size "<<outputData.muonContainer->size());
+	      ElementLink<xAOD::MuonContainer> muonLink(*outputData.muonContainer,outputData.muonContainer->size()-1);
+	      if( slowMuon && muonLink.isValid() ) {
 
-              ATH_MSG_DEBUG("slowMuon muonLink valid");
-              slowMuon->setMuonLink(muonLink);
-            }
+		ATH_MSG_DEBUG("slowMuon muonLink valid");
+		slowMuon->setMuonLink(muonLink);
+	      }
+	    }
           }          
         }
       }else{
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/TrackSegmentAssociationTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/TrackSegmentAssociationTool.cxx
index 77aed0ea641a2fadf3baf1dec130cd2f2262a8f9..d20be4b2a091723b6a15ce4dd93a770531896501 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/TrackSegmentAssociationTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/TrackSegmentAssociationTool.cxx
@@ -7,7 +7,6 @@
 #include "TrkSegment/SegmentCollection.h"
 #include "MuonSegment/MuonSegment.h"
 #include "MuonRecHelperTools/MuonEDMHelperTool.h"
-#include "MuonIdHelpers/MuonIdHelperTool.h" // this tool is not correctly interfaced
 #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h"
 #include "MuonSegmentMakerUtils/MuonSegmentKey.h"
 #include "MuonSegmentMakerUtils/CompareMuonSegmentKeys.h"
@@ -21,15 +20,13 @@ namespace Muon {
                                                                  const IInterface* p):
     AthAlgTool(t,n,p),
     m_helper("Muon::MuonEDMHelperTool/MuonEDMHelperTool"),
-    m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"),
-    m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool")
+    m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool")
   {
   
     declareInterface<TrackSegmentAssociationTool>(this);
     //  declareInterface<ITrackSegmentAssociationTool>(this);
 
     declareProperty("MuonEDMHelperTool",m_helper);
-    declareProperty("MuonIdHelperTool",m_idHelper);
     declareProperty("MuonEDMPrinterTool",m_printer);
     declareProperty("MuonSegmentLocation",m_segmentLocation="MuonSegments");
     declareProperty("StauSegmentLocation",m_stauSegmentLocation="StauSegments");
@@ -43,6 +40,7 @@ namespace Muon {
 
   StatusCode TrackSegmentAssociationTool::initialize() {
     ATH_CHECK(m_helper.retrieve());
+    ATH_CHECK(m_printer.retrieve());
     return StatusCode::SUCCESS;
   }
 
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/TrackSegmentAssociationTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/TrackSegmentAssociationTool.h
index f534004649807414ca1d096ae8468ce27e907960..3527c4025134b64b5879c8ac68a771697d331a94 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/TrackSegmentAssociationTool.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/TrackSegmentAssociationTool.h
@@ -13,7 +13,6 @@
 #include "xAODMuon/MuonSegment.h"
 #include "MuonRecHelperTools/MuonEDMPrinterTool.h"
 #include "MuonRecHelperTools/MuonEDMHelperTool.h"
-#include "MuonIdHelpers/MuonIdHelperTool.h"
 
 
 /** @class TrackSegmentAssociationTool
@@ -52,7 +51,6 @@ namespace Muon{
 
     ToolHandle<Muon::MuonEDMHelperTool>  m_helper;
     ToolHandle<Muon::MuonEDMPrinterTool> m_printer;
-    ToolHandle<Muon::MuonIdHelperTool>   m_idHelper;
 
     std::string m_segmentLocation;
     std::string m_stauSegmentLocation;
diff --git a/Reconstruction/MuonIdentification/MuonCombinedEvent/CMakeLists.txt b/Reconstruction/MuonIdentification/MuonCombinedEvent/CMakeLists.txt
index 671391de1767827f4933c821e7e7bac815bb4bee..9738febeecc07aa4790bf5948b9e3d1a28171b5b 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedEvent/CMakeLists.txt
+++ b/Reconstruction/MuonIdentification/MuonCombinedEvent/CMakeLists.txt
@@ -20,6 +20,7 @@ atlas_depends_on_subdirs( PUBLIC
                           Tracking/TrkEvent/TrkEventPrimitives
                           Tracking/TrkEvent/TrkMaterialOnTrack
                           Tracking/TrkEvent/TrkParameters
+			  MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonLayerEvent
                           PRIVATE
                           GaudiKernel
                           MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment
@@ -33,6 +34,6 @@ atlas_add_library( MuonCombinedEvent
                    src/*.cxx
                    PUBLIC_HEADERS MuonCombinedEvent
                    INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${EIGEN_LIBRARIES} AthLinks DataModel SGTools GeoPrimitives Identifier xAODMuon xAODTracking MuidEvent muonEvent TrkEventPrimitives TrkMaterialOnTrack TrkParameters
+                   LINK_LIBRARIES ${EIGEN_LIBRARIES} AthLinks DataModel SGTools GeoPrimitives Identifier xAODMuon xAODTracking MuidEvent muonEvent TrkEventPrimitives TrkMaterialOnTrack TrkParameters MuonLayerEvent
                    PRIVATE_LINK_LIBRARIES GaudiKernel MuonSegment TrkTrack )
 
diff --git a/Reconstruction/MuonIdentification/MuonCombinedEvent/MuonCombinedEvent/InDetCandidate.h b/Reconstruction/MuonIdentification/MuonCombinedEvent/MuonCombinedEvent/InDetCandidate.h
index 2572bf85cfa317c68b1c850705f9fc71009b6db5..d353ea1e3402c9913c16755350c2cc3867f1f3d4 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedEvent/MuonCombinedEvent/InDetCandidate.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedEvent/MuonCombinedEvent/InDetCandidate.h
@@ -10,6 +10,7 @@
 #include "xAODTracking/TrackParticle.h"
 #include "xAODTracking/TrackParticleContainer.h"
 #include "AthLinks/ElementLink.h"
+#include "MuonLayerEvent/MuonSystemExtension.h"
 
 namespace MuonCombined {
 
@@ -19,13 +20,13 @@ namespace MuonCombined {
     
   public:
     /** constructor taking a xAOD::TrackParicle&
-	Users should ensure that the lifetime of the idTrack object is longer that the InDetCandidate
+	Users should ensure that the lifetime of the idTrack object is longer than the InDetCandidate
 	as it internally caches a pointer to it. 
      */
     InDetCandidate(const xAOD::TrackParticle& idTrack);
 
     /** constructor taking an ElementLink to a xAOD::TrackParicle&
-	Users should ensure that the element link is valid and the lifetime of the idTrack object is longer that the InDetCandidate
+	Users should ensure that the element link is valid and the lifetime of the idTrack object is longer than the InDetCandidate
 	as it internally caches a pointer to it. 
      */
     InDetCandidate( const ElementLink<xAOD::TrackParticleContainer>& idTrackLink );
@@ -51,6 +52,12 @@ namespace MuonCombined {
     /** access of a given type tag */
     const TagBase*                     lastCombinedDataTag( TagBase::Type type ) const;
     
+    //access MuonSystemExtension
+    const Muon::MuonSystemExtension* getExtension() const;
+
+    //set MuonSystemExtension, taking ownership
+    void setExtension(const Muon::MuonSystemExtension* extension);
+
     /** Returns true if this candidate was formed from a special far forward InDet track.*/
     bool isSiliconAssociated() const;
     
@@ -72,6 +79,8 @@ namespace MuonCombined {
     
     /** Was this created using a special far forward indet track*/
     bool m_siAssociated;
+
+    const Muon::MuonSystemExtension* m_extension;
     
   };
 
@@ -106,6 +115,10 @@ namespace MuonCombined {
   inline bool InDetCandidate::isSiliconAssociated() const { return m_siAssociated; }
   
   inline void InDetCandidate::setSiliconAssociated( bool value ) { m_siAssociated=value; }
+
+  inline void InDetCandidate::setExtension(const Muon::MuonSystemExtension* extension) { m_extension=extension;}
+
+  inline const Muon::MuonSystemExtension* InDetCandidate::getExtension() const { return m_extension;}
 }
 
 
diff --git a/Reconstruction/MuonIdentification/MuonCombinedEvent/src/InDetCandidate.cxx b/Reconstruction/MuonIdentification/MuonCombinedEvent/src/InDetCandidate.cxx
index d66341384a5f863fe1eff80a9d743f7334d453c4..d5b8d848f1dbae43d179b0dc103a510fc3939341 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedEvent/src/InDetCandidate.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedEvent/src/InDetCandidate.cxx
@@ -8,12 +8,13 @@
 
 namespace MuonCombined {
   
-  InDetCandidate::InDetCandidate(const xAOD::TrackParticle& idTrack) : m_idTrackParticle(&idTrack), m_siAssociated(false) {}
+  InDetCandidate::InDetCandidate(const xAOD::TrackParticle& idTrack) : m_idTrackParticle(&idTrack), m_siAssociated(false), m_extension(0) {}
 
-  InDetCandidate::InDetCandidate( const ElementLink<xAOD::TrackParticleContainer>& idTrackLink ) : m_idTrackParticleLink(idTrackLink), m_idTrackParticle(0),m_siAssociated(false) {}
+  InDetCandidate::InDetCandidate( const ElementLink<xAOD::TrackParticleContainer>& idTrackLink ) : m_idTrackParticleLink(idTrackLink), m_idTrackParticle(0),m_siAssociated(false), m_extension(0) {}
 
   InDetCandidate::~InDetCandidate() {
     for( auto x : m_tags ) delete x;
+    delete m_extension;
   }
 
   std::string InDetCandidate::toString() const {
diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
index f14582eaf65ee8c9873c64d0ebba3e6c8ce3bccd..26b722c7f3376924462bbdd5c61b157b1268ece6 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/python/MuonCombinedAlgs.py
@@ -71,6 +71,7 @@ def StauCreatorAlg( name="StauCreatorAlg", **kwargs ):
     kwargs.setdefault("MuonCandidateLocation","")
     kwargs.setdefault("SegmentContainerName","StauSegments")
     kwargs.setdefault("BuildSlowMuon",1)
+    kwargs.setdefault("ClusterContainerName", "SlowMuonClusterCollection")
     return MuonCreatorAlg(name,**kwargs)
 
 class MuonCombinedReconstruction(ConfiguredMuonRec):
diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombinedRec_postprocessing.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombinedRec_postprocessing.py
index be64b5fddd3d7f350279c5aff7981389b0acbdc8..5b4f8ca633379bb8084c0f51f635585e6c957853 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombinedRec_postprocessing.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombinedRec_postprocessing.py
@@ -35,15 +35,6 @@ if rec.doTruth() and muonCombinedRecFlags.doxAOD() and rec.doMuonCombined():
     from MuonTruthAlgs.MuonTruthAlgsConf import MuonTruthAssociationAlg
     topSequence += MuonTruthAssociationAlg("MuonTruthAssociationAlg")
 
-if rec.doMuonCombined() and hasattr(topSequence,'InitializeMuonClusters'):
-    # Needed by MuonIsolationTools
-    FinalizeMuonClusters = CfgMgr.Rec__FinalizeMuonClusters (
-        name                 = "FinalizeMuonClusters",
-        MuonClusterContainer = "MuonClusterCollection"
-        )
-    topSequence += FinalizeMuonClusters
-    if muonCombinedRecFlags.printConfigurables():
-        print FinalizeMuonClusters
 
 if muonCombinedRecFlags.doTrackPerformance:
     include("MuonCombinedRecExample/MuonCombinedTrackPerformance_jobOptions.py")
diff --git a/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombinedRec_preprocessing.py b/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombinedRec_preprocessing.py
index 8eb3accdd9d188981b551c076d46074f294a32c3..92f8939e673c13792f22ebc3d376a959f79b5165 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombinedRec_preprocessing.py
+++ b/Reconstruction/MuonIdentification/MuonCombinedRecExample/share/MuonCombinedRec_preprocessing.py
@@ -18,15 +18,6 @@ if rec.doMuonCombined() and muonCombinedRecFlags.doAnyMuons() and DetFlags.Muon_
         print InitializeMuonCaloEnergy
 
 if rec.doMuonCombined() and muonCombinedRecFlags.doMuonClusters() and ( rec.readAOD() or rec.readESD() or DetFlags.haveRIO.Calo_on() ):
-    # Needed by MuonIsolationTools
-    InitializeMuonClusters = CfgMgr.Rec__InitializeMuonClusters (
-        name                 = "InitializeMuonClusters",
-        MuonClusterContainer = "MuonClusterCollection"
-        )
-    topSequence += InitializeMuonClusters
-    if muonCombinedRecFlags.printConfigurables():
-        print InitializeMuonClusters
-    
     # hack until MuonClusterCollection is properly added to ObjKeyStore
     # Needed by CaloCellAODGetter.addClusterToCaloCellAOD()
     if jobproperties.Beam.beamType()!='cosmics' and jobproperties.Beam.beamType()!='singlebeam':
diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx
index 7f198fe257020652b9826339e4a34acfa6e53297..ca2bdb0951c3b1f0cfdf44cd6e22eaee60d343fc 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx
@@ -3,7 +3,6 @@
 */
 
 #include "MuonInsideOutRecoTool.h"
-#include "MuonRecToolInterfaces/IMuonSystemExtensionTool.h"
 #include "MuonIdHelpers/MuonIdHelperTool.h"
 #include "MuonRecHelperTools/MuonEDMPrinterTool.h"
 
@@ -34,7 +33,6 @@ namespace MuonCombined {
     AthAlgTool(type,name,parent),
     m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"),
     m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"),
-    m_muonSystemExtentionTool("Muon::MuonSystemExtensionTool/MuonSystemExtensionTool"),
     m_segmentFinder("Muon::MuonLayerSegmentFinderTool/MuonLayerSegmentFinderTool"),
     m_segmentMatchingTool("Muon::MuonLayerSegmentMatchingTool/MuonLayerSegmentMatchingTool"),
     m_ambiguityResolver("Muon::MuonLayerAmbiguitySolverTool/MuonLayerAmbiguitySolverTool"),
@@ -49,7 +47,6 @@ namespace MuonCombined {
 
     declareProperty("MuonIdHelperTool",m_idHelper );    
     declareProperty("MuonEDMPrinterTool",m_printer );    
-    declareProperty("MuonSystemExtensionTool",m_muonSystemExtentionTool );    
     declareProperty("MuonLayerSegmentFinderTool",m_segmentFinder );    
     declareProperty("MuonLayerSegmentMatchingTool",m_segmentMatchingTool );    
     declareProperty("MuonLayerAmbiguitySolverTool",m_ambiguityResolver );    
@@ -71,7 +68,6 @@ namespace MuonCombined {
 
     ATH_CHECK(m_idHelper.retrieve());    
     ATH_CHECK(m_printer.retrieve());
-    ATH_CHECK(m_muonSystemExtentionTool.retrieve());
     ATH_CHECK(m_segmentFinder.retrieve());
     ATH_CHECK(m_segmentMatchingTool.retrieve());
     ATH_CHECK(m_ambiguityResolver.retrieve());
@@ -114,8 +110,7 @@ namespace MuonCombined {
     
     
     // get intersections which precision layers in the muon system 
-    const Muon::MuonSystemExtension* muonSystemExtension = 0;
-    m_muonSystemExtentionTool->muonSystemExtension( indetTrackParticle, muonSystemExtension );
+    const Muon::MuonSystemExtension* muonSystemExtension = indetCandidate.getExtension();
     if( !muonSystemExtension ) {
       //ATH_MSG_DEBUG("No MuonSystemExtension, aborting ");
       return;
diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.h b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.h
index 9840c4c8be3ddd66d1763e44bf7337501ecdb37b..d7db2744618983321d910d51d8b3379fd24edfde 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.h
@@ -21,7 +21,6 @@ namespace Muon {
   struct MuonLayerPrepRawData;
   class MuonIdHelperTool;
   class MuonEDMPrinterTool;
-  class IMuonSystemExtensionTool;
   class IMuonLayerSegmentFinderTool;
   class IMuonLayerSegmentMatchingTool;
   class IMuonLayerAmbiguitySolverTool;
@@ -91,7 +90,6 @@ namespace MuonCombined {
     /** tool handles */
     ToolHandle<Muon::MuonIdHelperTool>               m_idHelper; 
     ToolHandle<Muon::MuonEDMPrinterTool>             m_printer; 
-    ToolHandle<Muon::IMuonSystemExtensionTool>       m_muonSystemExtentionTool;
     ToolHandle<Muon::IMuonLayerSegmentFinderTool>    m_segmentFinder;
     ToolHandle<Muon::IMuonLayerSegmentMatchingTool>  m_segmentMatchingTool;
     ToolHandle<Muon::IMuonLayerAmbiguitySolverTool>  m_ambiguityResolver;
diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx
index d00e834d8e322484e936bf6ecd8d0230b54e4a04..fd3c8eacd5f993293c707211c1b6e69a2484da37 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.cxx
@@ -3,7 +3,6 @@
 */
 
 #include "MuonStauRecoTool.h"
-#include "MuonRecToolInterfaces/IMuonSystemExtensionTool.h"
 #include "MuonIdHelpers/MuonIdHelperTool.h"
 #include "MuonRecHelperTools/MuonEDMPrinterTool.h"
 #include "MuonRecHelperTools/MuonEDMHelperTool.h"
@@ -61,7 +60,6 @@ namespace MuonCombined {
     m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"),
     m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"),
     m_edmHelper("Muon::MuonEDMHelperTool/MuonEDMHelperTool"),
-    m_muonSystemExtentionTool("Muon::MuonSystemExtensionTool/MuonSystemExtensionTool"),
     m_segmentMaker("Muon::DCMathSegmentMaker/DCMathSegmentMaker"),
     m_segmentMakerT0Fit("Muon::DCMathSegmentMaker/DCMathT0FitSegmentMaker"),
     m_segmentMatchingTool("Muon::MuonLayerSegmentMatchingTool/MuonLayerSegmentMatchingTool"),
@@ -84,7 +82,6 @@ namespace MuonCombined {
     declareProperty("MuonIdHelperTool",m_idHelper );    
     declareProperty("MuonEDMPrinterTool",m_printer );    
     declareProperty("MuonEDMHelperTool",m_edmHelper );    
-    declareProperty("MuonSystemExtensionTool",m_muonSystemExtentionTool );    
     declareProperty("MuonSegmentMaker",m_segmentMaker );    
     declareProperty("MuonSegmentMakerT0Fit",m_segmentMakerT0Fit );    
     declareProperty("MuonLayerSegmentMatchingTool",m_segmentMatchingTool );    
@@ -129,7 +126,6 @@ namespace MuonCombined {
     ATH_CHECK(m_idHelper.retrieve());    
     ATH_CHECK(m_printer.retrieve());
     ATH_CHECK(m_edmHelper.retrieve());
-    ATH_CHECK(m_muonSystemExtentionTool.retrieve());
     ATH_CHECK(m_segmentMaker.retrieve());
     ATH_CHECK(m_segmentMakerT0Fit.retrieve());
     ATH_CHECK(m_segmentMatchingTool.retrieve());
@@ -217,8 +213,7 @@ namespace MuonCombined {
     if( truthMatchingCounter ) truthMatchingCounter->fillTruth();
 
     // get intersections which precision layers in the muon system 
-    const Muon::MuonSystemExtension* muonSystemExtension = 0;
-    m_muonSystemExtentionTool->muonSystemExtension( indetTrackParticle, muonSystemExtension );
+    const Muon::MuonSystemExtension* muonSystemExtension = indetCandidate.getExtension();
 
     // summary for selected ID track
     if( m_doSummary || msgLvl(MSG::DEBUG) ){
diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.h b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.h
index 3151ad9c093cbfd6d7df189bd3df479fe63a6ff6..20be75bbb143a36aa4a6a428750770f0ba7c3c17 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonStauRecoTool.h
@@ -31,7 +31,6 @@ namespace Muon {
 
   class MuonIdHelperTool;
   class MuonEDMPrinterTool;
-  class IMuonSystemExtensionTool;
   class IMuonSegmentMaker;
   class IMuonLayerSegmentMatchingTool;
   class IMuonLayerAmbiguitySolverTool;
@@ -237,7 +236,6 @@ namespace MuonCombined {
     ToolHandle<Muon::MuonIdHelperTool>               m_idHelper; 
     ToolHandle<Muon::MuonEDMPrinterTool>             m_printer; 
     ToolHandle<Muon::MuonEDMHelperTool>              m_edmHelper; 
-    ToolHandle<Muon::IMuonSystemExtensionTool>       m_muonSystemExtentionTool;
     ToolHandle<Muon::IMuonSegmentMaker>              m_segmentMaker;
     ToolHandle<Muon::IMuonSegmentMaker>              m_segmentMakerT0Fit;
     ToolHandle<Muon::IMuonLayerSegmentMatchingTool>  m_segmentMatchingTool;
diff --git a/Reconstruction/RecAthenaPool/CMakeLists.txt b/Reconstruction/RecAthenaPool/CMakeLists.txt
index fd50ced5b68e643c0cff56837636281140985c28..8be8e26d3a459f11022834beef03341ffd4bd295 100644
--- a/Reconstruction/RecAthenaPool/CMakeLists.txt
+++ b/Reconstruction/RecAthenaPool/CMakeLists.txt
@@ -11,8 +11,6 @@ atlas_depends_on_subdirs( PUBLIC
                           Database/AtlasSealCLHEP
                           PRIVATE
                           AtlasTest/TestTools
-                          Control/CLIDSvc
-                          Control/SGTools
                           Control/StoreGate
                           Database/AthenaPOOL/AthenaPoolCnvSvc
                           GaudiKernel
@@ -25,7 +23,7 @@ atlas_add_poolcnv_library( RecAthenaPoolPoolCnv
                            src/*.cxx
                            FILES MissingETEvent/MissingEtCalo.h MissingETEvent/MissingEtTruth.h MissingETEvent/MissingET.h MissingETEvent/MissingETComposition.h muonEvent/MuonSpShowerContainer.h muonEvent/MuonCaloEnergyContainer.h muonEvent/MuonContainer.h src/MuonCaloEnergies.h
                            TYPES_WITH_NAMESPACE Rec::MuonSpShowerContainer Analysis::MuonContainer TPCnv::MuonCaloEnergies
-                           LINK_LIBRARIES AthenaPoolUtilities SGTools StoreGateLib SGtests AthenaPoolCnvSvcLib GaudiKernel MissingETEvent muonEvent RecTPCnv )
+                           LINK_LIBRARIES AthenaPoolUtilities StoreGateLib SGtests AthenaPoolCnvSvcLib GaudiKernel MissingETEvent muonEvent RecTPCnv )
 
 # Install files from the package:
 atlas_install_headers( RecAthenaPool )
diff --git a/Reconstruction/RecAthenaPool/src/MuonCaloEnergies.h b/Reconstruction/RecAthenaPool/src/MuonCaloEnergies.h
index c9ef63623f851ec270a38ed0e0b6015ce5012d6c..0b114527f2140a74e3b3c179e01cad4c1f6a4ff9 100644
--- a/Reconstruction/RecAthenaPool/src/MuonCaloEnergies.h
+++ b/Reconstruction/RecAthenaPool/src/MuonCaloEnergies.h
@@ -7,7 +7,7 @@
 #ifndef RECATHENAPOOL_MUONCALOENERGIES_H
 #define RECATHENAPOOL_MUONCALOENERGIES_H 
  
-#include "CLIDSvc/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
  
 namespace TPCnv {
 /** 'Dummy' class to produce convertor for MuonCaloEnergy_tlp  */
diff --git a/Reconstruction/RecExample/RecExCommon/share/DumpDbFolders.py b/Reconstruction/RecExample/RecExCommon/share/DumpDbFolders.py
new file mode 100644
index 0000000000000000000000000000000000000000..51aa6ff703d3c18377b25aff49597fccb1525946
--- /dev/null
+++ b/Reconstruction/RecExample/RecExCommon/share/DumpDbFolders.py
@@ -0,0 +1,32 @@
+#This file is supposed to run as transform postExec
+#It creates text files containing the all database folders that are set up
+#This should help the creation of custom DB releases
+
+from os import linesep,getpid
+
+allFolders=svcMgr.IOVDbSvc.Folders
+
+substep=""
+try:
+    from RecExConfig.RecFlags import rec
+    substep=rec.OutputFileNameForRecoStep()
+except: 
+    pass
+
+if len(substep)==0:
+    print "Failed to obtain substep, will use PID for file with db folder list" 
+    substep=str(getpid())
+
+
+
+outputFileName="DatabaseFolders_"+substep+".txt"
+
+dbFolderFile=open(outputFileName,"w")
+for fn in allFolders:
+    dbFolderFile.write(fn+linesep)
+
+dbFolderFile.close()
+
+del outputFileName
+del allFolders
+del substep
diff --git a/Reconstruction/RecoTools/IsolationTool/Root/IsolationHelper.cxx b/Reconstruction/RecoTools/IsolationTool/Root/IsolationHelper.cxx
index 9fafb986dfb568753d0f12f0a8c8889269527856..30cff463f2e7b0860afe203213201a99aa209e80 100644
--- a/Reconstruction/RecoTools/IsolationTool/Root/IsolationHelper.cxx
+++ b/Reconstruction/RecoTools/IsolationTool/Root/IsolationHelper.cxx
@@ -120,7 +120,7 @@ namespace CP {
 
 	bool IsolationHelper::updateIsolation(xAOD::MuonContainer*& copy,xAOD::ShallowAuxContainer*& copyaux, std::vector<xAOD::Iso::IsolationType>& types, xAOD::Iso::IsolationCaloCorrectionBitset corrMask, std::string muonkey, bool recordSG) const {
 		const xAOD::MuonContainer* muons(0);
-		ATH_CHECK( evtStore()->retrieve(muons,muonkey) );
+		ATH_CHECK( evtStore()->retrieve(muons,muonkey), false );
 		std::pair<xAOD::MuonContainer*,xAOD::ShallowAuxContainer*> shallowcopy = xAOD::shallowCopyContainer(*muons);
 		copy = shallowcopy.first;
 		copyaux = shallowcopy.second;
@@ -142,8 +142,8 @@ namespace CP {
 			}
 
 			if(recordSG) {
-			ATH_CHECK( evtStore()->record(shallowcopy.first, "IsoFixed_"+muonkey) );
-			ATH_CHECK( evtStore()->record(shallowcopy.second,"IsoFixed_"+muonkey+"Aux.") );
+			ATH_CHECK( evtStore()->record(shallowcopy.first, "IsoFixed_"+muonkey), false );
+			ATH_CHECK( evtStore()->record(shallowcopy.second,"IsoFixed_"+muonkey+"Aux."), false );
 		}
 		return true;
 	}
diff --git a/Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.cxx b/Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.cxx
index 010047a5e74d00cf78ec46431e23e702dcb4e31c..10f4a5281afa1c1aa50ae14cc8bf4ed2c78be2ff 100755
--- a/Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.cxx
+++ b/Reconstruction/egamma/egammaPerformance/src/ZeeTaPMonTool.cxx
@@ -208,8 +208,8 @@ StatusCode ZeeTaPMonTool::fillHistograms()
     // Ask these electrons to be LHLoose
     bool isGood=false;
 
-    sc = (*e_iter)->passSelection(isGood,"LHLoose");
-    if(sc.isFailure() || !isGood ) ATH_MSG_DEBUG("not a good LHLoose electron candidate found in TDS");
+    bool passed = (*e_iter)->passSelection(isGood,"LHLoose");
+    if( passed || !isGood ) ATH_MSG_DEBUG("not a good LHLoose electron candidate found in TDS");
 
     // LHMedium
     // sc = (*e_iter)->passSelection(isGood,"LHMedium");
@@ -267,12 +267,10 @@ StatusCode ZeeTaPMonTool::fillHistograms()
   if (lead_el->charge()*subl_el->charge()>=0) return StatusCode::SUCCESS; 
   
   bool lead_isLHTight = false;
-  sc = lead_el->passSelection(lead_isLHTight,"LHTight");
-  if (sc.isFailure()) return StatusCode::FAILURE;
+  if ( !lead_el->passSelection(lead_isLHTight,"LHTight") ) return StatusCode::FAILURE;
 
   bool subl_isLHTight = false;
-  sc = subl_el->passSelection(subl_isLHTight,"LHTight");
-  if (sc.isFailure()) return StatusCode::FAILURE;
+  if ( !subl_el->passSelection(subl_isLHTight,"LHTight") ) return StatusCode::FAILURE;
 
   bool EventZcandidateUsed = false;
   
@@ -284,8 +282,7 @@ StatusCode ZeeTaPMonTool::fillHistograms()
     // Isolation Energy 
     float topoetcone40;
     bool subl_isIsolated = false;
-    sc = subl_el->isolationValue(topoetcone40,xAOD::Iso::topoetcone40);
-    if (sc.isFailure()) return StatusCode::FAILURE;
+    if ( !subl_el->isolationValue(topoetcone40,xAOD::Iso::topoetcone40) ) return StatusCode::FAILURE;
     if ( topoetcone40 < 4.5*GeV ) subl_isIsolated = true;
     fillElectronProbe(subl_el, subl_isLHTight, subl_isIsolated, mass);
   }
@@ -297,8 +294,7 @@ StatusCode ZeeTaPMonTool::fillHistograms()
     // Isolation Energy 
     float topoetcone40;
     bool lead_isIsolated = false;
-    sc = lead_el->isolationValue(topoetcone40,xAOD::Iso::topoetcone40);
-    if (sc.isFailure()) return StatusCode::FAILURE;
+    if ( !lead_el->isolationValue(topoetcone40,xAOD::Iso::topoetcone40) ) return StatusCode::FAILURE;
     if ( topoetcone40 < 4.5*GeV ) lead_isIsolated = true;
     fillElectronProbe(lead_el, lead_isLHTight, lead_isIsolated, mass);
   }
diff --git a/Reconstruction/egamma/egammaPerformance/src/photonMonTool.cxx b/Reconstruction/egamma/egammaPerformance/src/photonMonTool.cxx
index 7e5e8fede5be52f7aaa487c7ef15774052de33e4..41d8654714d7bf5df2538630dcf0a5be726d77dc 100755
--- a/Reconstruction/egamma/egammaPerformance/src/photonMonTool.cxx
+++ b/Reconstruction/egamma/egammaPerformance/src/photonMonTool.cxx
@@ -520,12 +520,14 @@ StatusCode photonMonTool::fillHistogramsForOnePhoton(xAOD::PhotonContainer::cons
 
   // Isolation Energy 
   float topoetcone40 = 0.0;
-  StatusCode sc = (*g_iter)->isolationValue(topoetcone40,xAOD::Iso::topoetcone40);
-  if (!sc.isFailure()) myHist.m_hTopoEtCone40->Fill(topoetcone40);
+  if ( (*g_iter)->isolationValue(topoetcone40,xAOD::Iso::topoetcone40) ) {
+    myHist.m_hTopoEtCone40->Fill(topoetcone40);
+  }
  
   float ptcone20 = 0.0;
-  sc = (*g_iter)->isolationValue(ptcone20,xAOD::Iso::ptcone20);
-  if (!sc.isFailure()) myHist.m_hPtCone20->Fill(ptcone20);
+  if ( (*g_iter)->isolationValue(ptcone20,xAOD::Iso::ptcone20) ) {
+    myHist.m_hPtCone20->Fill(ptcone20);
+  }
 
   fillTH1FperRegion(myHist.m_hvTopoEtCone40,ir,topoetcone40);
   fillTH1FperRegion(myHist.m_hvPtCone20,ir,ptcone20);
diff --git a/Reconstruction/tauMonitoring/src/tauMonTool.cxx b/Reconstruction/tauMonitoring/src/tauMonTool.cxx
index a598c2b5cedad74b27e54d77fa3d5450903c509e..89f3eb686ee6a810e1094429034ec5ad499be656 100644
--- a/Reconstruction/tauMonitoring/src/tauMonTool.cxx
+++ b/Reconstruction/tauMonitoring/src/tauMonTool.cxx
@@ -78,7 +78,7 @@ StatusCode tauMonTool::bookHistograms()
         // We wish retrieve twice won'nt invite problem.
 	m_Trigged = false ; 
 	if ( m_doTrigger ) {
-                m_Trigged = m_trigDecTool.retrieve();
+        if ( m_trigDecTool.retrieve().isSuccess() ) m_Trigged = true;
 		if ( m_Trigged ) {
 			//--------------------
 			// create trigger folder and trigger summary histogram
diff --git a/Simulation/Digitization/python/DigitizationFlags.py b/Simulation/Digitization/python/DigitizationFlags.py
index cc3d1578ebe73159f626dd5432564e1e6edb0495..8b41968f535cf8f6da3718f68719c02c22be9e1e 100755
--- a/Simulation/Digitization/python/DigitizationFlags.py
+++ b/Simulation/Digitization/python/DigitizationFlags.py
@@ -545,7 +545,10 @@ class RunAndLumiOverrideList(JobProperty):
         pDicts = self.get_Value()
         #clear svc properties?
         for el in pDicts:
-            eventIdModSvc.add_modifier(run_nbr=el['run'], lbk_nbr=el['lb'], time_stamp=el['starttstamp'], nevts=el['evts'])
+            if 'evt_nbr' in el:
+                eventIdModSvc.add_modifier(run_nbr=el['run'], lbk_nbr=el['lb'], time_stamp=el['starttstamp'], nevts=el['evts'], evt_nbr=el['evt_nbr'])
+            else:
+                eventIdModSvc.add_modifier(run_nbr=el['run'], lbk_nbr=el['lb'], time_stamp=el['starttstamp'], nevts=el['evts'])
         return
     def SetPileUpEventLoopMgrProps(self,pileUpEventLoopMgr):
         if not (self._locked):
diff --git a/Simulation/Digitization/python/RunDependentConfig.py b/Simulation/Digitization/python/RunDependentConfig.py
index ac7607b15e1a1272238e3f41e4f2f42dcb561f0a..5d9a7f5454883297c2877c5dbfa541cd33f38474 100644
--- a/Simulation/Digitization/python/RunDependentConfig.py
+++ b/Simulation/Digitization/python/RunDependentConfig.py
@@ -44,7 +44,10 @@ def buildListOfModifiers():
             raise RuntimeError( 'You cannot configure the EvtIdModifierSvc with an unlocked JobProperty.' )
         pDicts = digitizationFlags.RunAndLumiOverrideList.get_Value()
         for el in pDicts:
-            Modifiers += add_modifier(run_nbr=el['run'], lbk_nbr=el['lb'], time_stamp=el['starttstamp'], nevts=el['evts'])
+            if 'evt_nbr' in el:
+                Modifiers += add_modifier(run_nbr=el['run'], lbk_nbr=el['lb'], time_stamp=el['starttstamp'], nevts=el['evts'], evt_nbr=el['evt_nbr'])
+            else:
+                Modifiers += add_modifier(run_nbr=el['run'], lbk_nbr=el['lb'], time_stamp=el['starttstamp'], nevts=el['evts'])
     elif digitizationFlags.dataRunNumber.get_Value():
         if digitizationFlags.dataRunNumber.get_Value() < 0:
             raise SystemExit("Given a negative Run Number - please use a real run number from data.")
diff --git a/Simulation/Digitization/python/RunDependentMCTaskIterator.py b/Simulation/Digitization/python/RunDependentMCTaskIterator.py
index cf14c1743e3536c03fccddb7a9ac1d3624461d96..fdd2909c8956eba355a8f366168ce11678e19d7a 100644
--- a/Simulation/Digitization/python/RunDependentMCTaskIterator.py
+++ b/Simulation/Digitization/python/RunDependentMCTaskIterator.py
@@ -9,7 +9,7 @@
 
 import itertools
 
-def getRunLumiInfoFragment(jobnumber,task,maxEvents):
+def getRunLumiInfoFragment(jobnumber,task,maxEvents,sequentialEventNumbers=False):
     """Calculate the specific configuration of the current job in the digi
     task. Try to make each fragment utilize the same amount of CPU and
     Cache resources.  Exploits the fact that the task when sorted by
@@ -30,7 +30,12 @@ def getRunLumiInfoFragment(jobnumber,task,maxEvents):
         hi_mu_frag=getFragment(jobnumber,sorted(task,key=lambda job: job['mu'],reverse=True),hiMaxEvents)
     if loMaxEvents > 0:
         lo_mu_frag=getFragment(jobnumber,sorted(task,key=lambda job: job['mu']),loMaxEvents)        
-    return sorted(sum([hi_mu_frag,lo_mu_frag],[]),key=lambda job: job['run'])
+    
+    fragment=sorted(sum([hi_mu_frag,lo_mu_frag],[]),key=lambda job: job['run'])
+    if sequentialEventNumbers:
+        return defineSequentialEventNumbers(jobnumber,fragment,maxEvents)
+    else:
+        return fragment
 
 def getFragment(jobnumber,task,maxEvents):
     """ Calculate the specific configuration of the current job in the digi task.
@@ -106,3 +111,23 @@ class taskIterator(object):
             if self.current.get('force_new',False): to_do = 0
         raise StopIteration
 #
+
+def defineSequentialEventNumbers(jobnumber,fragment,maxEvents):
+    """ Calculate sequential event numbers for the defined getFragment.
+    """
+    new_frag = []
+    evt_nbr = jobnumber * maxEvents
+    for t in fragment:
+        for i in range(t['evts']):
+            evt_nbr += 1
+            new_frag.append({
+                'run': t['run'],
+                'lb': t['lb'],
+                'starttstamp': t['starttstamp'],
+                'dt': t['dt'],
+                'evts': 1,
+                'evt_nbr': evt_nbr,
+                'mu': t['mu'],
+                'force_new': t['force_new']
+            })
+    return new_frag
diff --git a/Simulation/G4Atlas/G4AtlasApps/test/test_AtlasG4_cosmics_configuration.py b/Simulation/G4Atlas/G4AtlasApps/test/test_AtlasG4_cosmics_configuration.py
index 726f9a401adeeb5ccafc106ea1cb671484b2fefc..0a236cd2f75e3ed692ff4046f262574e8d62055e 100755
--- a/Simulation/G4Atlas/G4AtlasApps/test/test_AtlasG4_cosmics_configuration.py
+++ b/Simulation/G4Atlas/G4AtlasApps/test/test_AtlasG4_cosmics_configuration.py
@@ -24,7 +24,7 @@ class TestAtlasG4Cosmics(unittest.TestCase):
             '--CosmicFilterVolume', 'Calo',
             '--CosmicFilterVolume2', 'NONE',
             '--CosmicPtSlice', 'NONE',
-            '--outputEVNT_COSMICSTRFile', 'test.TR.pool.root',
+            '--outputEVNT_TRFile', 'test.TR.pool.root',
             '--beamType', 'cosmics',
             # would otherwise fail due to missing HITS file:
             '--outputFileValidation', 'False',
@@ -235,7 +235,7 @@ class TestAtlasG4Cosmics(unittest.TestCase):
 
 
     def test___G4AtlasAlg_ListOfSetProperties(self):
-        expected_list = ['AtRndmGenSvc', 'DetGeoSvc', 'DetStore', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FastSimMasterTool', 'FlagAbortedEvents', 'G4AtlasSvc', 'G4Commands', 'GeoIDSvc', 'InputConverter', 'InputTruthCollection', 'KillAbortedEvents', 'MultiThreading', 'NeededResources', 'OutputTruthCollection', 'PhysicsListTool', 'RandomGenerator', 'RecordFlux', 'ReleaseGeoModel', 'SenDetMasterTool', 'TruthRecordService', 'UserActionSvc', 'UserStore', 'Verbosities']
+        expected_list = ['AtRndmGenSvc', 'DetGeoSvc', 'DetStore', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FastSimMasterTool', 'FlagAbortedEvents', 'G4AtlasSvc', 'G4Commands', 'GeoIDSvc', 'InputConverter', 'InputTruthCollection', 'KillAbortedEvents', 'MultiThreading', 'NeededResources', 'OutputTruthCollection', 'PhysicsListTool', 'RandomGenerator', 'RecordFlux', 'ReleaseGeoModel', 'SenDetMasterTool', 'TruthRecordService', 'UserActionSvc', 'Verbosities']
         g4atlasalg = self._job_config_dict['G4AtlasAlg']
         actual_list = g4atlasalg.keys()
         expected_property_value_sorted = sorted(expected_list)
diff --git a/Simulation/G4Atlas/G4AtlasApps/test/test_AtlasG4_tf_configuration.py b/Simulation/G4Atlas/G4AtlasApps/test/test_AtlasG4_tf_configuration.py
index 3a4cc1d871e76deb0c974fa2ce20b08611bb1076..3b0c1b9740ead974788976e7f6a4c9d315462999 100755
--- a/Simulation/G4Atlas/G4AtlasApps/test/test_AtlasG4_tf_configuration.py
+++ b/Simulation/G4Atlas/G4AtlasApps/test/test_AtlasG4_tf_configuration.py
@@ -152,7 +152,7 @@ class TestAtlasG4(unittest.TestCase):
 
 
     def test___G4AtlasAlg_ListOfSetProperties(self):
-        expected_list = ['AtRndmGenSvc', 'DetGeoSvc', 'DetStore', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FastSimMasterTool', 'FlagAbortedEvents', 'G4AtlasSvc', 'G4Commands', 'GeoIDSvc', 'InputConverter', 'InputTruthCollection', 'KillAbortedEvents', 'MultiThreading', 'NeededResources', 'OutputTruthCollection', 'PhysicsListTool', 'RandomGenerator', 'RecordFlux', 'ReleaseGeoModel', 'SenDetMasterTool', 'TruthRecordService', 'UserActionSvc', 'UserStore', 'Verbosities']
+        expected_list = ['AtRndmGenSvc', 'DetGeoSvc', 'DetStore', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FastSimMasterTool', 'FlagAbortedEvents', 'G4AtlasSvc', 'G4Commands', 'GeoIDSvc', 'InputConverter', 'InputTruthCollection', 'KillAbortedEvents', 'MultiThreading', 'NeededResources', 'OutputTruthCollection', 'PhysicsListTool', 'RandomGenerator', 'RecordFlux', 'ReleaseGeoModel', 'SenDetMasterTool', 'TruthRecordService', 'UserActionSvc', 'Verbosities']
         g4atlasalg = self._job_config_dict['G4AtlasAlg']
         actual_list = g4atlasalg.keys()
         expected_property_value_sorted = sorted(expected_list)
diff --git a/Simulation/G4Atlas/G4AtlasApps/test/test_TestBeam_tf_configuration.py b/Simulation/G4Atlas/G4AtlasApps/test/test_TestBeam_tf_configuration.py
index a13bfdc644d6e73198a3fae5e677753520f3506e..8f81975880001be6a08c47b659387102e884d98f 100755
--- a/Simulation/G4Atlas/G4AtlasApps/test/test_TestBeam_tf_configuration.py
+++ b/Simulation/G4Atlas/G4AtlasApps/test/test_TestBeam_tf_configuration.py
@@ -170,7 +170,7 @@ class TestTestBeam(unittest.TestCase):
 
 
     def test___G4AtlasAlg_ListOfSetProperties(self):
-        expected_list = ['AtRndmGenSvc', 'DetGeoSvc', 'DetStore', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FastSimMasterTool', 'G4AtlasSvc', 'G4Commands', 'GeoIDSvc', 'InputConverter', 'InputTruthCollection', 'MultiThreading', 'NeededResources', 'OutputTruthCollection', 'PhysicsListTool', 'RandomGenerator', 'RecordFlux', 'ReleaseGeoModel', 'SenDetMasterTool', 'TruthRecordService', 'UserActionSvc', 'UserStore', 'Verbosities']
+        expected_list = ['AtRndmGenSvc', 'DetGeoSvc', 'DetStore', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FastSimMasterTool', 'G4AtlasSvc', 'G4Commands', 'GeoIDSvc', 'InputConverter', 'InputTruthCollection', 'MultiThreading', 'NeededResources', 'OutputTruthCollection', 'PhysicsListTool', 'RandomGenerator', 'RecordFlux', 'ReleaseGeoModel', 'SenDetMasterTool', 'TruthRecordService', 'UserActionSvc', 'Verbosities']
         g4atlasalg = self._job_config_dict['G4AtlasAlg']
         actual_list = g4atlasalg.keys()
         expected_property_value_sorted = sorted(expected_list)
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_FastCaloSimParametrization_SimPostInclude.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_FastCaloSimParametrization_SimPostInclude.py
index a59ee537a7a600deaaf28d45472527c2b91fb6cd..4d8cc75bbe0f344ea38b7cece89efa3a3bb43d77 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_FastCaloSimParametrization_SimPostInclude.py
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_FastCaloSimParametrization_SimPostInclude.py
@@ -1,6 +1,3 @@
-from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConf import FastCaloSimParamAlg
-topSeq += FastCaloSimParamAlg()
-ISF_HITSStream.stream1.ItemList += ["ISF_FCS_Parametrization::FCS_StepInfoCollection#MergedEventSteps"]
 from AthenaCommon.CfgGetter import getPublicTool
 stepInfoSDTool = getPublicTool("SensitiveDetectorMasterTool").SensitiveDetectors['FCS_StepInfoSensitiveDetector']
 stepInfoSDTool.shift_lar_subhit=True
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_FastCaloSimParametrization_SimPostInclude_1mm.py b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_FastCaloSimParametrization_SimPostInclude_1mm.py
index b42cd82a47bed2666c9ae87fcf77a95df3a2c4e1..07d0d7bce2c573c758960d70bb08166531f01cfe 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_FastCaloSimParametrization_SimPostInclude_1mm.py
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/share/ISF_FastCaloSimParametrization_SimPostInclude_1mm.py
@@ -1,6 +1,3 @@
-from ISF_FastCaloSimParametrization.ISF_FastCaloSimParametrizationConf import FastCaloSimParamAlg
-topSeq += FastCaloSimParamAlg()
-ISF_HITSStream.stream1.ItemList += ["ISF_FCS_Parametrization::FCS_StepInfoCollection#MergedEventSteps"]
 from AthenaCommon.CfgGetter import getPublicTool
 stepInfoSDTool = getPublicTool("SensitiveDetectorMasterTool").SensitiveDetectors['FCS_StepInfoSensitiveDetector']
 stepInfoSDTool.shift_lar_subhit=True
diff --git a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimSD/src/FCS_StepInfoSDTool.cxx b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimSD/src/FCS_StepInfoSDTool.cxx
index a4e4660568e51214be86dc03cd1bf0185446c2e9..0068ce2db88ba7a9278f0f84cb0b1700916521cf 100644
--- a/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimSD/src/FCS_StepInfoSDTool.cxx
+++ b/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimSD/src/FCS_StepInfoSDTool.cxx
@@ -36,7 +36,7 @@ namespace FCS_Param
   FCS_StepInfoSDTool::FCS_StepInfoSDTool(const std::string& type, const std::string& name,
                              const IInterface* parent)
     : SensitiveDetectorBase(type, name, parent)
-    , m_hitCollName("EventSteps")
+    , m_hitCollName("MergedEventSteps")
     , m_bpsmodcalc("EMBPresamplerCalculator", name)
     , m_embcalc("EMBCalculator", name)
     , m_emepiwcalc("EMECPosInnerWheelCalculator", name)
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrTools/src/LayerMaterialProvider.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrTools/src/LayerMaterialProvider.cxx
index ae08dd35b6d259c3f16b3c6b1821c6bb0c14ff95..6ba568e5eaf3ee21fa395d106af2d0ea5029ba20 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrTools/src/LayerMaterialProvider.cxx
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrTools/src/LayerMaterialProvider.cxx
@@ -58,11 +58,12 @@ StatusCode iFatras::LayerMaterialProvider::process(const Trk::TrackingGeometry&
               int layIndex = lay->layerIndex().value();  
               // only move on if layer index is different from 0
               if (layIndex){
-                  StatusCode sc = process(*lay, 0).isSuccess();
+                  StatusCode sc( process(*lay, 0) );
+		  // @TODO Currently recoverable errors are treated as failure. Is this the intended behaviour ? Elsewhere recoverable errors are treated as recoverable
                   if (sc.isSuccess())
                       ATH_MSG_DEBUG("---[B] Boundary layer with " << layCount << " references : successfully loaded material map for layer " << layIndex );
-                  else if (sc.isRecoverable())
-                      ATH_MSG_WARNING("Failed to call process(const Layer&) on layers - but recoverable.");
+                  // else if (sc.isRecoverable())
+                  //    ATH_MSG_WARNING("Failed to call process(const Layer&) on layers - but recoverable.");
                   else {
                       ATH_MSG_FATAL("Failed to call process(const Layer&) on layer. Aborting.");
                       return StatusCode::FAILURE;            
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/CMakeLists.txt b/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/CMakeLists.txt
index 1b25bafcdd861f5e45a830e043f7d3b8df961b69..4019c1d51f89a6b43346bd5786fb0efd096302f9 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/CMakeLists.txt
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/CMakeLists.txt
@@ -8,8 +8,7 @@ atlas_subdir( ISF_FatrasEvent )
 # Declare the package's dependencies:
 atlas_depends_on_subdirs( PUBLIC
                           Control/AthLinks
-                          Control/DataModel
-                          Control/SGTools
+                          Control/AthenaKernel
                           DetectorDescription/Identifier
                           InnerDetector/InDetRecEvent/InDetPrepRawData
                           Simulation/ISF/ISF_Fatras/ISF_FatrasDetDescrModel
@@ -26,6 +25,6 @@ atlas_add_library( ISF_FatrasEvent
                    src/*.cxx
                    PUBLIC_HEADERS ISF_FatrasEvent
                    INCLUDE_DIRS ${ROOT_INCLUDE_DIRS}
-                   LINK_LIBRARIES ${ROOT_LIBRARIES} AthLinks DataModel SGTools Identifier InDetPrepRawData ISF_FatrasDetDescrModel TrkPrepRawData TrkRIO_OnTrack EventContainers
+                   LINK_LIBRARIES ${ROOT_LIBRARIES} AthLinks AthenaKernel Identifier InDetPrepRawData ISF_FatrasDetDescrModel TrkPrepRawData TrkRIO_OnTrack EventContainers
                    PRIVATE_LINK_LIBRARIES GaudiKernel )
 
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarClusterCollection.h b/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarClusterCollection.h
index 4a16aec05f19b149910687e5ed63cc9b25119ad7..f3837a74c59555e5b571291187c2a04863acc65c 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarClusterCollection.h
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarClusterCollection.h
@@ -14,7 +14,7 @@
 #ifndef ISF_FATRASEVENT_PLANARCLUSTERCOLLECTION_H
 #define ISF_FATRASEVENT_PLANARCLUSTERCOLLECTION_H
 
-#include "SGTools/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 #include "TrkPrepRawData/PrepRawDataCollection.h"
 #include "ISF_FatrasEvent/PlanarCluster.h"
 
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarClusterContainer.h b/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarClusterContainer.h
index 99a87edea24765f30e713a6bae81877cdb5249ea..d5389c37436c12783aad9c9fabbe7b69800a1649 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarClusterContainer.h
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarClusterContainer.h
@@ -14,7 +14,7 @@
 #ifndef ISF_FATRASEVENT_PLANARCLUSTERCONTAINER_H
 #define ISF_FATRASEVENT_PLANARCLUSTERCONTAINER_H
 
-#include "SGTools/CLASS_DEF.h"
+#include "AthenaKernel/CLASS_DEF.h"
 #include "TrkPrepRawData/PrepRawDataContainer.h"
 #include "ISF_FatrasEvent/PlanarClusterCollection.h"
 #include "AthLinks/DeclareIndexingPolicy.h"
diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarClusterOnTrack.h b/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarClusterOnTrack.h
index 987683854428012c3543d053b7011414eb655d42..aa797498fdb972cd05f6576e50c22af660b41169 100644
--- a/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarClusterOnTrack.h
+++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasEvent/ISF_FatrasEvent/PlanarClusterOnTrack.h
@@ -18,7 +18,7 @@
 
 // for ElementLink to IdentifiableContainer PlanarClusterContainer
 #include "ISF_FatrasEvent/PlanarClusterContainer.h"
-#include "DataModel/ElementLink.h"
+#include "AthLinks/ElementLink.h"
 
 namespace Trk  {
   class LocalParameters; }
diff --git a/Simulation/ISF/ISF_Validation/test/ISF_Validation_TestConfiguration.xml b/Simulation/ISF/ISF_Validation/test/ISF_Validation_TestConfiguration.xml
index fd6eb97a944f5e8b825c2b244ced73776c47b7bf..39f10b770e0f42c0f0a76640b61b1673db72fd18 100644
--- a/Simulation/ISF/ISF_Validation/test/ISF_Validation_TestConfiguration.xml
+++ b/Simulation/ISF/ISF_Validation/test/ISF_Validation_TestConfiguration.xml
@@ -484,7 +484,7 @@
       <jobTransform userJobId="G4_cosmics_1sim">
         <doc>Running cosmic simulation transform from track records</doc>
         <jobTransformJobName>G4_cosmics_1sim</jobTransformJobName>
-        <jobTransformCmd>Sim_tf.py --simulator MC12G4 --inputEVNT_COSMICSFile /afs/cern.ch/atlas/offline/ProdData/16.6.X/16.6.7.Y/Cosmics.TR.pool.root --outputHITSFile testCosmics.HITS.pool.root --maxEvents -1 --randomSeed 1234 --DataRunNumber '10' --geometryVersion ATLAS-R2-2015-03-01-00_VALIDATION --conditionsTag OFLCOND-RUN12-SDR-19 --firstEvent 0 --physicsList QGSP_BERT --preInclude SimulationJobOptions/preInclude.Cosmics.py --beamType cosmics</jobTransformCmd>
+        <jobTransformCmd>Sim_tf.py --simulator MC12G4 --inputEVNT_TRFile /afs/cern.ch/atlas/offline/ProdData/16.6.X/16.6.7.Y/Cosmics.TR.pool.root --outputHITSFile testCosmics.HITS.pool.root --maxEvents -1 --randomSeed 1234 --DataRunNumber '10' --geometryVersion ATLAS-R2-2015-03-01-00_VALIDATION --conditionsTag OFLCOND-RUN12-SDR-19 --firstEvent 0 --physicsList QGSP_BERT --preInclude SimulationJobOptions/preInclude.Cosmics.py --beamType cosmics</jobTransformCmd>
         <group>ISF_Validation_sim</group>
         <queue>short</queue>
         <!-- add in some tests later -->
@@ -493,7 +493,7 @@
       <jobTransform userJobId="G4_cosmicsTR_1sim">
         <doc>Running cosmic simulation transform from track records</doc>
         <jobTransformJobName>G4_cosmicsTR_1sim</jobTransformJobName>
-        <jobTransformCmd>Sim_tf.py --simulator MC12G4 --outputEVNT_COSMICSTRFile 'testCosmics.TR.pool.root' --outputHITSFile 'testCosmics.HITS.pool.root' --maxEvents '1500' --randomSeed '1234' --DataRunNumber '10' --physicsList 'QGSP_BERT' --CosmicFilterVolume 'Calo' --CosmicFilterVolume2 'NONE' --preInclude 'SimulationJobOptions/preInclude.Cosmics.py' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --CosmicPtSlice 'NONE' --beamType 'cosmics'</jobTransformCmd>
+        <jobTransformCmd>Sim_tf.py --simulator MC12G4 --outputEVNT_TRFile 'testCosmics.TR.pool.root' --outputHITSFile 'testCosmics.HITS.pool.root' --maxEvents '1500' --randomSeed '1234' --DataRunNumber '10' --physicsList 'QGSP_BERT' --CosmicFilterVolume 'Calo' --CosmicFilterVolume2 'NONE' --preInclude 'SimulationJobOptions/preInclude.Cosmics.py' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --CosmicPtSlice 'NONE' --beamType 'cosmics'</jobTransformCmd>
         <group>ISF_Validation_sim</group>
         <queue>medium</queue>
         <!-- add in some tests later -->
diff --git a/Simulation/ISF/ISF_Validation/test/test_Sim_FullG4_CosmicSim.sh b/Simulation/ISF/ISF_Validation/test/test_Sim_FullG4_CosmicSim.sh
index 3d5684b363fa66973613c8d70fccfd76e3f77681..6555294ebf2f8d4baac7121a9acefb600484cd43 100755
--- a/Simulation/ISF/ISF_Validation/test/test_Sim_FullG4_CosmicSim.sh
+++ b/Simulation/ISF/ISF_Validation/test/test_Sim_FullG4_CosmicSim.sh
@@ -3,7 +3,7 @@
 # art-description: Run cosmics simulation using ISF with the FullG4 simulator, generating events on-the-fly, using 2015 geometry and conditions
 # art-type: grid
 
-Sim_tf.py --conditionsTag 'OFLCOND-RUN12-SDR-19' --physicsList 'QGSP_BERT' --truthStrategy 'MC12' --simulator 'FullG4' --outputEVNT_COSMICSTRFile 'test.TR.pool.root' --outputHITSFile 'test.HITS.pool.root' --maxEvents '1500' --randomSeed '1234' --DataRunNumber '10' --CosmicFilterVolume 'Calo' --CosmicFilterVolume2 'NONE' --preInclude 'SimulationJobOptions/preInclude.Cosmics.py' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --CosmicPtSlice 'NONE' --beamType 'cosmics'
+Sim_tf.py --conditionsTag 'OFLCOND-RUN12-SDR-19' --physicsList 'QGSP_BERT' --truthStrategy 'MC12' --simulator 'FullG4' --outputEVNT_TRFile 'test.TR.pool.root' --outputHITSFile 'test.HITS.pool.root' --maxEvents '1500' --randomSeed '1234' --DataRunNumber '10' --CosmicFilterVolume 'Calo' --CosmicFilterVolume2 'NONE' --preInclude 'SimulationJobOptions/preInclude.Cosmics.py' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --CosmicPtSlice 'NONE' --beamType 'cosmics'
 
 SCRIPT_DIRECTORY=$1
 PACKAGE=$2
diff --git a/Simulation/ISF/ISF_Validation/test/test_Sim_FullG4_CosmicSimTR.sh b/Simulation/ISF/ISF_Validation/test/test_Sim_FullG4_CosmicSimTR.sh
index 94361f1e65c1990e4e5a3a622aa8ce1e52348957..07829434443fc4b8e129c9b40b334486be02b70c 100755
--- a/Simulation/ISF/ISF_Validation/test/test_Sim_FullG4_CosmicSimTR.sh
+++ b/Simulation/ISF/ISF_Validation/test/test_Sim_FullG4_CosmicSimTR.sh
@@ -3,7 +3,7 @@
 # art-description: Run cosmics simulation using ISF with the FullG4 simulator, using TrackRecords as input, using 2015 geometry and conditions
 # art-type: grid
 
-Sim_tf.py --conditionsTag 'OFLCOND-RUN12-SDR-19'  --physicsList 'QGSP_BERT' --truthStrategy 'MC12' --simulator 'FullG4' --inputEVNT_COSMICSFile '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/Cosmics.TR.pool.root' --outputHITSFile 'test.HITS.pool.root' --maxEvents -1 --randomSeed 1234 --DataRunNumber '10' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --firstEvent 0 --preInclude 'SimulationJobOptions/preInclude.Cosmics.py' --beamType 'cosmics'
+Sim_tf.py --conditionsTag 'OFLCOND-RUN12-SDR-19'  --physicsList 'QGSP_BERT' --truthStrategy 'MC12' --simulator 'FullG4' --inputEVNT_TRFile '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/Cosmics.TR.pool.root' --outputHITSFile 'test.HITS.pool.root' --maxEvents -1 --randomSeed 1234 --DataRunNumber '10' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --firstEvent 0 --preInclude 'SimulationJobOptions/preInclude.Cosmics.py' --beamType 'cosmics'
 
 SCRIPT_DIRECTORY=$1
 PACKAGE=$2
diff --git a/Simulation/RunDependentSim/RunDependentSimData/share/configCommon.py b/Simulation/RunDependentSim/RunDependentSimData/share/configCommon.py
index e998cc2fb107b73f6a23569b2be2416e60570be7..5df55d60de6c7c7d5fcb02e6f132f57e47dc2016 100644
--- a/Simulation/RunDependentSim/RunDependentSimData/share/configCommon.py
+++ b/Simulation/RunDependentSim/RunDependentSimData/share/configCommon.py
@@ -33,9 +33,15 @@ digilog.info('There are %d events in this run.' % runMaxEvents)
 jobsPerRun=int(math.ceil(float(runMaxEvents)/corrMaxEvents))
 digilog.info('Assuming there are usually %d events per job. (Based on %d events in this job.)', corrMaxEvents, trfMaxEvents)
 digilog.info('There must be %d jobs per run.' % jobsPerRun)
+
+# Override event numbers with sequential ones if requested
+sequentialEventNumbers = True if 'SequentialEventNumbers' in dir() and SequentialEventNumbers else False
+if sequentialEventNumbers:
+    digilog.info('All event numbers will be sequential.')
+
 #Load needed tools 
 from Digitization.RunDependentMCTaskIterator import getRunLumiInfoFragment
-fragment=getRunLumiInfoFragment(jobnumber=(trfJobNumber-1),task=JobMaker,maxEvents=trfMaxEvents)
+fragment=getRunLumiInfoFragment(jobnumber=(trfJobNumber-1),task=JobMaker,maxEvents=trfMaxEvents,sequentialEventNumbers=sequentialEventNumbers)
 
 from RunDependentSimComps.RunLumiConfigTools import condenseRunLumiInfoFragment
 digilog.info( 'Writing RunDMC trigger configuration fragment to file.  listOfRunsEvents = %s' %
diff --git a/Simulation/RunDependentSim/RunDependentSimData/share/configEvtNbr_sequential.py b/Simulation/RunDependentSim/RunDependentSimData/share/configEvtNbr_sequential.py
new file mode 100644
index 0000000000000000000000000000000000000000..1ba807414868308ddc801b56c6f61b18e7655334
--- /dev/null
+++ b/Simulation/RunDependentSim/RunDependentSimData/share/configEvtNbr_sequential.py
@@ -0,0 +1,4 @@
+####################
+## Enable sequential event numbers override
+####################
+SequentialEventNumbers = True
diff --git a/Simulation/SimuJobTransforms/python/SimTransformUtils.py b/Simulation/SimuJobTransforms/python/SimTransformUtils.py
index d693795bbab9ac93d0521c4afd46a3a731003fea..27553bed7c6c74f035a066304ba4296ad0f85dae 100644
--- a/Simulation/SimuJobTransforms/python/SimTransformUtils.py
+++ b/Simulation/SimuJobTransforms/python/SimTransformUtils.py
@@ -59,10 +59,15 @@ def addRDOValidArguments(parser):
 ## @brief Add ISF transform substep
 #  @param overlayTransform If @c True use the tweaked version of in/outData for an overlay job
 def addSimulationSubstep(executorSet, overlayTransform = False):
+    TRExe = athenaExecutor(name = 'TRtoHITS', skeletonFile = 'SimuJobTransforms/skeleton.EVGENtoHIT_ISF.py',
+                           substep = 'simTRIn', tryDropAndReload = False, perfMonFile = 'ntuple.pmon.gz',
+                           inData=['EVNT_TR'],
+                           outData=['HITS','NULL'] )
+    executorSet.add(TRExe)
     SimExe = athenaExecutor(name = 'EVNTtoHITS', skeletonFile = 'SimuJobTransforms/skeleton.EVGENtoHIT_ISF.py',
                                    substep = 'sim', tryDropAndReload = False, perfMonFile = 'ntuple.pmon.gz',
-                                   inData=['NULL','EVNT','EVNT_CAVERN','EVNT_COSMICS'],
-                                   outData=['EVNT_CAVERNTR','EVNT_COSMICSTR','HITS','NULL'] )
+                                   inData=['NULL','EVNT'],
+                                   outData=['EVNT_TR','HITS','NULL'] )
     if overlayTransform:
         from PyJobTransforms.trfUtils import releaseIsOlderThan
         if releaseIsOlderThan(20,3):
@@ -74,10 +79,14 @@ def addSimulationSubstep(executorSet, overlayTransform = False):
     executorSet.add(SimExe)
 
 def addAtlasG4Substep(executorSet):
+    executorSet.add(athenaExecutor(name = 'AtlasG4TfTRIn', skeletonFile = 'SimuJobTransforms/skeleton.EVGENtoHIT_MC12.py',
+                                   substep = 'simTRIn', tryDropAndReload = False,
+                                   inData=['EVNT_TR'],
+                                   outData=['HITS','NULL'] ))
     executorSet.add(athenaExecutor(name = 'AtlasG4Tf', skeletonFile = 'SimuJobTransforms/skeleton.EVGENtoHIT_MC12.py',
-                                   substep = 'sim', tryDropAndReload = False, 
-                                   inData=['NULL','EVNT','EVNT_CAVERN','EVNT_COSMICS'],
-                                   outData=['EVNT_CAVERNTR','EVNT_COSMICSTR','HITS','NULL'] ))
+                                   substep = 'sim', tryDropAndReload = False,
+                                   inData=['NULL','EVNT'],
+                                   outData=['EVNT_TR','HITS','NULL'] ))
 
 def addConfigurableSimSubstep(executorSet, confName, extraSkeleton, confSubStep, confInData, confOutData, confExtraRunargs, confRuntimeRunargs):
     executorSet.add(athenaExecutor(name = confName, skeletonFile = extraSkeleton + ['SimuJobTransforms/skeleton.EVGENtoHIT_MC12.py'],
@@ -126,10 +135,19 @@ def appendAtlasG4Substep(trf):
     addAtlasG4Substep(executor)
     trf.appendToExecutorSet(executor)
 
+def appendConfigurableSimTRInSubstep(trf, confName = 'AtlasG4TfTRIn',
+                                 extraSkeleton = [], confSubstep = 'simTRIn',
+                                 confInData=['EVNT_TR'],
+                                 confOutData=['HITS','NULL'],
+                                 confExtraRunargs=None, confRuntimeRunargs=None ):
+    executor = set()
+    addConfigurableSimSubstep(executor, confName, extraSkeleton, confSubStep, confInData, confOutData, confExtraRunargs, confRuntimeRunargs )
+    trf.appendToExecutorSet(executor)
+
 def appendConfigurableSimSubstep(trf, confName = 'AtlasG4Tf',
                                  extraSkeleton = [], confSubstep = 'sim',
-                                 confInData=['NULL','EVNT','EVNT_CAVERN','EVNT_COSMICS'],
-                                 confOutData=['EVNT_CAVERNTR','EVNT_COSMICSTR','HITS','NULL'],
+                                 confInData=['NULL','EVNT'],
+                                 confOutData=['EVNT_TR','HITS','NULL'],
                                  confExtraRunargs=None, confRuntimeRunargs=None ):
     executor = set()
     addConfigurableSimSubstep(executor, confName, extraSkeleton, confSubStep, confInData, confOutData, confExtraRunargs, confRuntimeRunargs )
diff --git a/Simulation/SimuJobTransforms/python/simTrfArgs.py b/Simulation/SimuJobTransforms/python/simTrfArgs.py
index 0e6fd040ccd955deb565a57e8f57e8d9a10a3058..f4a8912f3ad3b86ec3bb812674efb1c450c488e6 100644
--- a/Simulation/SimuJobTransforms/python/simTrfArgs.py
+++ b/Simulation/SimuJobTransforms/python/simTrfArgs.py
@@ -132,21 +132,16 @@ def addCosmicsTrfArgs(parser):
                         type=argFactory(argString),
                         help='Cosmic Pt Slice', group='Cosmics')
 
-## Add arguments used by simulation jobs which may write out TrackRecord files
+## Add arguments used by simulation jobs which may read in or write out TrackRecord files
 def addTrackRecordArgs(parser):
     parser.defineArgGroup('TrackRecords', 'TrackRecord related options')
-    parser.add_argument('--inputEVNT_COSMICSFile', nargs='+',
+    parser.add_argument('--inputEVNT_TRFile', nargs='+',
                         type=argFactory(argPOOLFile, io='input'),
-                        help='Input Track Record file - sometimes used in Cosmic ray simulation jobs.', group='TrackRecords')
-    parser.add_argument('--outputEVNT_COSMICSTRFile', nargs='+',
+                        help='Input Track Record file - sometimes used in Cosmic ray or cavern background simulation jobs.', group='TrackRecords')
+    parser.add_argument('--outputEVNT_TRFile', nargs='+',
                         type=argFactory(argPOOLFile, io='output', type='evnt'),
-                        help='Output Track Record file - sometimes used in Cosmic ray simulation jobs.', group='TrackRecords')
-    parser.add_argument('--inputEVNT_CAVERNFile', nargs='+',
-                        type=argFactory(argPOOLFile, io='input'),
-                        help='Input Track Record file - sometimes used in Cavern Background simulation jobs.', group='TrackRecords')
-    parser.add_argument('--outputEVNT_CAVERNTRFile', nargs='+',
-                        type=argFactory(argPOOLFile, io='output', type='evnt'),
-                        help='Output Track Record file - sometimes used in Cavern Background simulation jobs.', group='TrackRecords')
+                        help='Output Track Record file - sometimes used in Cosmic ray or cavern background simulation jobs.', group='TrackRecords')
+
 
 ## Add arguments used only by ISF-based simulation jobs
 def addSim_tfArgs(parser):
diff --git a/Simulation/SimuJobTransforms/scripts/AtlasG4_tf.py b/Simulation/SimuJobTransforms/scripts/AtlasG4_tf.py
index 410df5517915090159bd6bafed38b2af9ba8d65b..a9fd126fb748936062300cacbc2acc16ce814490 100755
--- a/Simulation/SimuJobTransforms/scripts/AtlasG4_tf.py
+++ b/Simulation/SimuJobTransforms/scripts/AtlasG4_tf.py
@@ -26,7 +26,7 @@ from SimuJobTransforms.simTrfArgs import addForwardDetTrfArgs, addCosmicsTrfArgs
 import PyJobTransforms.trfArgClasses as trfArgClasses
 
 # Prodsys hack...
-ListOfDefaultPositionalKeys=['--AFPOn', '--ALFAOn', '--CosmicFilterVolume', '--CosmicFilterVolume2', '--CosmicPtSlice', '--DBRelease', '--DataRunNumber', '--FwdRegionOn', '--LucidOn', '--ZDCOn', '--amiConfig', '--amiMetadataTag', '--asetup', '--athena', '--athenaopts', '--beamType', '--checkEventCount', '--command', '--conditionsTag', '--enableLooperKiller', '--env', '--eventAcceptanceEfficiency', '--execOnly', '--firstEvent', '--geometryVersion', '--ignoreErrors', '--ignoreFiles', '--ignorePatterns', '--imf', '--inputEVNTFile', '--inputEVNT_CAVERNFile', '--inputEVNT_COSMICSFile', '--jobNumber', '--maxEvents', '--outputEVNT_CAVERNTRFile', '--outputEVNT_COSMICSTRFile', '--outputHITSFile', '--physicsList', '--postExec', '--postInclude', '--preExec', '--preInclude', '--randomSeed', '--reportName', '--reportType', '--runNumber', '--showGraph', '--showPath', '--showSteps', '--skipEvents', '--skipFileValidation', '--skipInputFileValidation', '--skipOutputFileValidation', '--tcmalloc', '--useISF']
+ListOfDefaultPositionalKeys=['--AFPOn', '--ALFAOn', '--CosmicFilterVolume', '--CosmicFilterVolume2', '--CosmicPtSlice', '--DBRelease', '--DataRunNumber', '--FwdRegionOn', '--LucidOn', '--ZDCOn', '--amiConfig', '--amiMetadataTag', '--asetup', '--athena', '--athenaopts', '--beamType', '--checkEventCount', '--command', '--conditionsTag', '--enableLooperKiller', '--env', '--eventAcceptanceEfficiency', '--execOnly', '--firstEvent', '--geometryVersion', '--ignoreErrors', '--ignoreFiles', '--ignorePatterns', '--imf', '--inputEVNTFile', '--inputEVNT_TRFile', '--jobNumber', '--maxEvents', '--outputEVNT_TRFile', '--outputHITSFile', '--physicsList', '--postExec', '--postInclude', '--preExec', '--preInclude', '--randomSeed', '--reportName', '--reportType', '--runNumber', '--showGraph', '--showPath', '--showSteps', '--skipEvents', '--skipFileValidation', '--skipInputFileValidation', '--skipOutputFileValidation', '--tcmalloc', '--useISF']
 
 @stdTrfExceptionHandler
 @sigUsrStackTrace
diff --git a/Simulation/SimuJobTransforms/scripts/Sim_tf.py b/Simulation/SimuJobTransforms/scripts/Sim_tf.py
index d0f3e60ecbffddefdc9e878b40861f0e8bcb7d14..02e220fe51074702f950cbd3ce8b0fba300149f0 100755
--- a/Simulation/SimuJobTransforms/scripts/Sim_tf.py
+++ b/Simulation/SimuJobTransforms/scripts/Sim_tf.py
@@ -26,7 +26,7 @@ from SimuJobTransforms.simTrfArgs import addForwardDetTrfArgs, addCosmicsTrfArgs
 import PyJobTransforms.trfArgClasses as trfArgClasses
 
 # Prodsys hack...
-ListOfDefaultPositionalKeys=['--AFPOn', '--ALFAOn', '--CosmicFilterVolume', '--CosmicFilterVolume2', '--CosmicPtSlice', '--DBRelease', '--DataRunNumber', '--FwdRegionOn', '--LucidOn', '--ZDCOn', '--amiConfig', '--amiMetadataTag', '--asetup', '--athena', '--athenaopts', '--beamType', '--checkEventCount', '--command', '--conditionsTag', '--enableLooperKiller', '--env', '--eventAcceptanceEfficiency', '--execOnly', '--firstEvent', '--geometryVersion', '--ignoreErrors', '--ignoreFiles', '--ignorePatterns', '--imf', '--inputEVNTFile', '--inputEVNT_CAVERNFile', '--inputEVNT_COSMICSFile', '--jobNumber', '--maxEvents', '--outputEVNT_CAVERNTRFile', '--outputEVNT_COSMICSTRFile', '--outputHITSFile', '--physicsList', '--postExec', '--postInclude', '--preExec', '--preInclude', '--randomSeed', '--reportName', '--reportType', '--runNumber', '--showGraph', '--showPath', '--showSteps', '--simulator', '--skipEvents', '--skipFileValidation', '--skipInputFileValidation', '--skipOutputFileValidation', '--tcmalloc', '--useISF']
+ListOfDefaultPositionalKeys=['--AFPOn', '--ALFAOn', '--CosmicFilterVolume', '--CosmicFilterVolume2', '--CosmicPtSlice', '--DBRelease', '--DataRunNumber', '--FwdRegionOn', '--LucidOn', '--ZDCOn', '--amiConfig', '--amiMetadataTag', '--asetup', '--athena', '--athenaopts', '--beamType', '--checkEventCount', '--command', '--conditionsTag', '--enableLooperKiller', '--env', '--eventAcceptanceEfficiency', '--execOnly', '--firstEvent', '--geometryVersion', '--ignoreErrors', '--ignoreFiles', '--ignorePatterns', '--imf', '--inputEVNTFile', '--inputEVNT_TRFile', '--jobNumber', '--maxEvents', '--outputEVNT_TRFile', '--outputHITSFile', '--physicsList', '--postExec', '--postInclude', '--preExec', '--preInclude', '--randomSeed', '--reportName', '--reportType', '--runNumber', '--showGraph', '--showPath', '--showSteps', '--simulator', '--skipEvents', '--skipFileValidation', '--skipInputFileValidation', '--skipOutputFileValidation', '--tcmalloc', '--useISF']
 
 @stdTrfExceptionHandler
 @sigUsrStackTrace
diff --git a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py
index 45a4e93142df5d93bea90d432ef083807fe273d8..ff91e4b98cef3417cf6b4c1267e291981aa4b2d3 100644
--- a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py
+++ b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_ISF.py
@@ -46,10 +46,8 @@ if hasattr(runArgs, "inputFile"):
 # We don't expect both inputFile and inputEVNT*File to be specified
 if hasattr(runArgs, "inputEVNTFile"):
     setInputEvgenFileJobProperties( runArgs.inputEVNTFile )
-elif hasattr(runArgs, "inputEVNT_COSMICSFile"):
-    setInputEvgenFileJobProperties( runArgs.inputEVNT_COSMICSFile )
-elif hasattr(runArgs, "inputEVNT_CAVERNFile"):
-    setInputEvgenFileJobProperties( runArgs.inputEVNT_CAVERNFile )
+elif hasattr(runArgs, "inputEVNT_TRFile"):
+    setInputEvgenFileJobProperties( runArgs.inputEVNT_TRFile )
 elif hasattr(runArgs, "inputEVNT_STOPPEDFile"):
     setInputEvgenFileJobProperties( runArgs.inputEVNT_STOPPEDFile )
 elif jobproperties.Beam.beamType.get_Value() == 'cosmics':
@@ -62,7 +60,7 @@ else:
 ## Handle cosmics configs
 if jobproperties.Beam.beamType.get_Value() == 'cosmics':
     simFlags.load_cosmics_flags()
-    if hasattr(runArgs, "inputEVNT_COSMICSFile"):
+    if hasattr(runArgs, "inputEVNT_TRFile"):
         if simFlags.CosmicFilterVolumeName.statusOn and simFlags.CosmicFilterVolumeName.get_Value() != "Muon":
             atlasG4log.warning("Filtering was already done. Using CosmicFilterVolumeName=Muon rather than "
                                "provided value (%s)" % str(runArgs.CosmicFilterVolumeName))
@@ -110,10 +108,11 @@ if hasattr(runArgs, "inputEVNT_STOPPEDFile"):
     include('SimulationJobOptions/preInclude.ReadStoppedParticles.py')
 
 # Avoid command line preInclude for cavern background
-if hasattr(runArgs, "inputEVNT_CAVERNFile"):
-    include('SimulationJobOptions/preInclude.G4ReadCavern.py')
-if hasattr(runArgs, "outputEVNT_CAVERNTRFile"):
-    include('SimulationJobOptions/preInclude.G4WriteCavern.py')
+if jobproperties.Beam.beamType.get_Value() != 'cosmics':
+    if hasattr(runArgs, "inputEVNT_TRFile"):
+        include('SimulationJobOptions/preInclude.G4ReadCavern.py')
+    if hasattr(runArgs, "outputEVNT_TRFile"):
+        include('SimulationJobOptions/preInclude.G4WriteCavern.py')
 
 # Avoid command line preInclude for event service
 if hasattr(runArgs, "eventService") and runArgs.eventService:
@@ -219,11 +218,11 @@ elif hasattr(runArgs,'jobNumber'):
 ## Handle cosmics track record
 from AthenaCommon.BeamFlags import jobproperties
 if jobproperties.Beam.beamType.get_Value() == 'cosmics':
-    if hasattr(runArgs, "inputEVNT_COSMICSFile"):
+    if hasattr(runArgs, "inputEVNT_TRFile"):
         simFlags.ReadTR = athenaCommonFlags.PoolEvgenInput()[0]
     else:
-        if hasattr(runArgs, "outputEVNT_COSMICSTRFile"):
-            simFlags.WriteTR = runArgs.outputEVNT_COSMICSTRFile
+        if hasattr(runArgs, "outputEVNT_TRFile"):
+            simFlags.WriteTR = runArgs.outputEVNT_TRFile
         #include( 'CosmicGenerator/jobOptions_ConfigCosmicProd.py' )
 
 ## Add filters for non-cosmics simulation
diff --git a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py
index b7d55349e538e1f37fa0a1466ed13422927c5b44..0c5bd7961fbace2a48ccde204347a9f6403b508e 100644
--- a/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py
+++ b/Simulation/SimuJobTransforms/share/skeleton.EVGENtoHIT_MC12.py
@@ -44,10 +44,8 @@ if hasattr(runArgs, "inputFile"):
 # We don't expect both inputFile and inputEVNT*File to be specified
 if hasattr(runArgs, "inputEVNTFile"):
     setInputEvgenFileJobProperties( runArgs.inputEVNTFile )
-elif hasattr(runArgs, "inputEVNT_COSMICSFile"):
-    setInputEvgenFileJobProperties( runArgs.inputEVNT_COSMICSFile )
-elif hasattr(runArgs, "inputEVNT_CAVERNFile"):
-    setInputEvgenFileJobProperties( runArgs.inputEVNT_CAVERNFile )
+elif hasattr(runArgs, "inputEVNT_TRFile"):
+    setInputEvgenFileJobProperties( runArgs.inputEVNT_TRFile )
 elif hasattr(runArgs, "inputEVNT_STOPPEDFile"):
     setInputEvgenFileJobProperties( runArgs.inputEVNT_STOPPEDFile )
 elif jobproperties.Beam.beamType.get_Value() == 'cosmics':
@@ -60,7 +58,7 @@ else:
 ## Handle cosmics configs
 if jobproperties.Beam.beamType.get_Value() == 'cosmics':
     simFlags.load_cosmics_flags()
-    if hasattr(runArgs, "inputEVNT_COSMICSFile"):
+    if hasattr(runArgs, "inputEVNT_TRFile"):
         if simFlags.CosmicFilterVolumeName.statusOn and simFlags.CosmicFilterVolumeName.get_Value() != "Muon":
             atlasG4log.warning("Filtering was already done. Using CosmicFilterVolumeName=Muon rather than "
                                "provided value (%s)" % str(runArgs.CosmicFilterVolumeName))
@@ -108,10 +106,11 @@ if hasattr(runArgs, "inputEVNT_STOPPEDFile"):
     include('SimulationJobOptions/preInclude.ReadStoppedParticles.py')
 
 # Avoid command line preInclude for cavern background
-if hasattr(runArgs, "inputEVNT_CAVERNFile"):
-    include('SimulationJobOptions/preInclude.G4ReadCavern.py')
-if hasattr(runArgs, "outputEVNT_CAVERNTRFile"):
-    include('SimulationJobOptions/preInclude.G4WriteCavern.py')
+if jobproperties.Beam.beamType.get_Value() != 'cosmics':
+    if hasattr(runArgs, "inputEVNT_TRFile"):
+        include('SimulationJobOptions/preInclude.G4ReadCavern.py')
+    if hasattr(runArgs, "outputEVNT_TRFile"):
+        include('SimulationJobOptions/preInclude.G4WriteCavern.py')
 
 # Avoid command line preInclude for event service
 if hasattr(runArgs, "eventService") and runArgs.eventService:
@@ -202,11 +201,11 @@ elif hasattr(runArgs,'jobNumber'):
 ## Handle cosmics track record
 from AthenaCommon.BeamFlags import jobproperties
 if jobproperties.Beam.beamType.get_Value() == 'cosmics':
-    if hasattr(runArgs, "inputEVNT_COSMICSFile"):
+    if hasattr(runArgs, "inputEVNT_TRFile"):
         simFlags.ReadTR = athenaCommonFlags.PoolEvgenInput()[0]
     else:
-        if hasattr(runArgs, "outputEVNT_COSMICSTRFile"):
-            simFlags.WriteTR = runArgs.outputEVNT_COSMICSTRFile
+        if hasattr(runArgs, "outputEVNT_TRFile"):
+            simFlags.WriteTR = runArgs.outputEVNT_TRFile
         include( 'CosmicGenerator/jobOptions_ConfigCosmicProd.py' )
 
 
diff --git a/Simulation/SimulationJobOptions/share/subdetectors/preInclude.TruthOnlyConfig.py b/Simulation/SimulationJobOptions/share/subdetectors/preInclude.TruthOnlyConfig.py
new file mode 100644
index 0000000000000000000000000000000000000000..b5ba2c3bd87ddfaa11920c2bcaf7dd52a561e025
--- /dev/null
+++ b/Simulation/SimulationJobOptions/share/subdetectors/preInclude.TruthOnlyConfig.py
@@ -0,0 +1,6 @@
+if not 'DetFlags' in dir():
+    #if you configure one detflag, you're responsible for configuring them all!
+    from AthenaCommon.DetFlags import DetFlags
+    DetFlags.all_setOff()
+DetFlags.Truth_setOn()
+DetFlags.Print()
diff --git a/Simulation/Tests/SimCoreTests/test/SimCoreTests_TestConfiguration.xml b/Simulation/Tests/SimCoreTests/test/SimCoreTests_TestConfiguration.xml
index 5b15bab14ac0273a9afb38b6fdcbcceb3d2f56d6..c772bf277a9f4d68def75f179609bedc2a931561 100644
--- a/Simulation/Tests/SimCoreTests/test/SimCoreTests_TestConfiguration.xml
+++ b/Simulation/Tests/SimCoreTests/test/SimCoreTests_TestConfiguration.xml
@@ -459,7 +459,7 @@
             <jobTransform userJobId="CavernBg_EVNT2TR">
               <doc>Reading min bias events, write cavern background track records</doc>
               <jobTransformJobName>CavernBg_EVNT2TR</jobTransformJobName>
-              <jobTransformCmd>AtlasG4_tf.py --inputEVNTFile '/afs/cern.ch/atlas/offline/ProdData/16.6.X/16.6.7.Y/minbias_Inelastic_low-pythia8-7000.evgen.pool.root' --outputHITSFile 'discard.HITS.pool.root' --outputEVNT_CAVERNTRFile 'test.EVNT.pool.root' --maxEvents '2' --skipEvents '0' --randomSeed '5678' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --DataRunNumber '222525' --physicsList 'QGSP_BERT_HP' --postInclude 'PyJobTransforms/UseFrontier.py'
+              <jobTransformCmd>AtlasG4_tf.py --inputEVNTFile '/afs/cern.ch/atlas/offline/ProdData/16.6.X/16.6.7.Y/minbias_Inelastic_low-pythia8-7000.evgen.pool.root' --outputHITSFile 'discard.HITS.pool.root' --outputEVNT_TRFile 'test.EVNT.pool.root' --maxEvents '2' --skipEvents '0' --randomSeed '5678' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --DataRunNumber '222525' --physicsList 'QGSP_BERT_HP' --postInclude 'PyJobTransforms/UseFrontier.py'
               </jobTransformCmd>
               <group>SimCoreJobTransformTests</group>
               <queue>medium</queue>
@@ -608,7 +608,7 @@
             <jobTransform userJobId="CosmicSimTR">
               <doc>Running cosmic simulation transform from track records</doc>
               <jobTransformJobName>CosmicSimTR</jobTransformJobName>
-              <jobTransformCmd>AtlasG4_tf.py --inputEVNT_COSMICSFile '/afs/cern.ch/atlas/offline/ProdData/16.6.X/16.6.7.Y/Cosmics.TR.pool.root' --outputHITSFile 'test.HITS.pool.root' --maxEvents '-1' --randomSeed '1234' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --physicsList 'FTFP_BERT' --DataRunNumber '222525' --firstEvent '0' --beamType 'cosmics' --postInclude 'PyJobTransforms/UseFrontier.py'
+              <jobTransformCmd>AtlasG4_tf.py --inputEVNT_TRFile '/afs/cern.ch/atlas/offline/ProdData/16.6.X/16.6.7.Y/Cosmics.TR.pool.root' --outputHITSFile 'test.HITS.pool.root' --maxEvents '-1' --randomSeed '1234' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --physicsList 'FTFP_BERT' --DataRunNumber '222525' --firstEvent '0' --beamType 'cosmics' --postInclude 'PyJobTransforms/UseFrontier.py'
               </jobTransformCmd>
               <group>SimCoreJobTransformTests</group>
               <queue>short</queue>
@@ -1566,7 +1566,7 @@
             <jobTransform userJobId="CosmicSim">
               <doc>Running cosmic simulation transform</doc>
               <jobTransformJobName>CosmicSim</jobTransformJobName>
-              <jobTransformCmd>AtlasG4_tf.py --outputHITSFile 'test.HITS.pool.root' --maxEvents '1500' --randomSeed '1234' --DataRunNumber '222525' --CosmicFilterVolume 'Calo' --CosmicFilterVolume2 'NONE' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --physicsList 'FTFP_BERT' --CosmicPtSlice 'NONE' --outputEVNT_COSMICSTRFile 'test.TR.pool.root' --beamType 'cosmics' --postInclude 'PyJobTransforms/UseFrontier.py'
+              <jobTransformCmd>AtlasG4_tf.py --outputHITSFile 'test.HITS.pool.root' --maxEvents '1500' --randomSeed '1234' --DataRunNumber '222525' --CosmicFilterVolume 'Calo' --CosmicFilterVolume2 'NONE' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --physicsList 'FTFP_BERT' --CosmicPtSlice 'NONE' --outputEVNT_TRFile 'test.TR.pool.root' --beamType 'cosmics' --postInclude 'PyJobTransforms/UseFrontier.py'
               </jobTransformCmd>
               <group>SimCoreJobTransformTests</group>
               <queue>short</queue>
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_EVNT2TR.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_EVNT2TR.sh
index 09a22ce1db69dd8e17522f0f35fb78cd8bcb7358..c9cb0e2c64a95b27bfba58beb79f712f64700b3b 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_EVNT2TR.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CavernBg_EVNT2TR.sh
@@ -3,7 +3,7 @@
 # art-description: Run simulation outside ISF, reading min bias events, write cavern background track records, using 2015 geometry and conditions
 # art-type: grid
 
-AtlasG4_tf.py --inputEVNTFile '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/minbias_Inelastic_low-pythia8-7000.evgen.pool.root' --outputHITSFile 'discard.HITS.pool.root' --outputEVNT_CAVERNTRFile 'test.EVNT.pool.root' --maxEvents '2' --skipEvents '0' --randomSeed '5678' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --DataRunNumber '222525' --physicsList 'QGSP_BERT_HP' --postInclude 'PyJobTransforms/UseFrontier.py'
+AtlasG4_tf.py --inputEVNTFile '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SimCoreTests/minbias_Inelastic_low-pythia8-7000.evgen.pool.root' --outputHITSFile 'discard.HITS.pool.root' --outputEVNT_TRFile 'test.EVNT.pool.root' --maxEvents '2' --skipEvents '0' --randomSeed '5678' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --DataRunNumber '222525' --physicsList 'QGSP_BERT_HP' --postInclude 'PyJobTransforms/UseFrontier.py'
 
 SCRIPT_DIRECTORY=$1
 PACKAGE=$2
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSim.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSim.sh
index dc690fb9bac707c6932b3e9eea82b6653f772f21..70d2f7b26d15f238d53672307f67c7fdb28447fd 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSim.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSim.sh
@@ -3,7 +3,7 @@
 # art-description: Run cosmics simulation outside ISF, generating events on-the-fly, using 2015 geometry and conditions
 # art-type: grid
 
-AtlasG4_tf.py --outputHITSFile 'test.HITS.pool.root' --maxEvents '1500' --randomSeed '1234' --DataRunNumber '222525' --CosmicFilterVolume 'Calo' --CosmicFilterVolume2 'NONE' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --physicsList 'FTFP_BERT' --CosmicPtSlice 'NONE' --outputEVNT_COSMICSTRFile 'test.TR.pool.root' --beamType 'cosmics' --postInclude 'PyJobTransforms/UseFrontier.py'
+AtlasG4_tf.py --outputHITSFile 'test.HITS.pool.root' --maxEvents '1500' --randomSeed '1234' --DataRunNumber '222525' --CosmicFilterVolume 'Calo' --CosmicFilterVolume2 'NONE' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --physicsList 'FTFP_BERT' --CosmicPtSlice 'NONE' --outputEVNT_TRFile 'test.TR.pool.root' --beamType 'cosmics' --postInclude 'PyJobTransforms/UseFrontier.py'
 
 SCRIPT_DIRECTORY=$1
 PACKAGE=$2
diff --git a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSimTR.sh b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSimTR.sh
index 9b393ee738c4a9a9cc00a1ca3aefd5d79517007b..e11176404b271460ec08f12cbc05ef423ff926d1 100755
--- a/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSimTR.sh
+++ b/Simulation/Tests/SimCoreTests/test/test_AtlasG4_CosmicSimTR.sh
@@ -3,7 +3,7 @@
 # art-description: Run cosmics simulation outside ISF, using TrackRecords as input, using 2015 geometry and conditions
 # art-type: grid
 
-AtlasG4_tf.py --inputEVNT_COSMICSFile '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/Cosmics.TR.pool.root' --outputHITSFile 'test.HITS.pool.root' --maxEvents '-1' --randomSeed '1234' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --physicsList 'FTFP_BERT' --DataRunNumber '222525' --firstEvent '0' --beamType 'cosmics' --postInclude 'PyJobTransforms/UseFrontier.py'
+AtlasG4_tf.py --inputEVNT_TRFile '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/Cosmics.TR.pool.root' --outputHITSFile 'test.HITS.pool.root' --maxEvents '-1' --randomSeed '1234' --geometryVersion 'ATLAS-R2-2015-03-01-00_VALIDATION' --conditionsTag 'OFLCOND-RUN12-SDR-19' --physicsList 'FTFP_BERT' --DataRunNumber '222525' --firstEvent '0' --beamType 'cosmics' --postInclude 'PyJobTransforms/UseFrontier.py'
 
 SCRIPT_DIRECTORY=$1
 PACKAGE=$2
diff --git a/TestBeam/TBCaloGeometry/src/TBCaloCoordinate.cxx b/TestBeam/TBCaloGeometry/src/TBCaloCoordinate.cxx
index 70d7cd1f76cc0df91fc8fcaad356871a55936f9e..9c4077c246a4890c79b148a46d70afb08c354b1d 100755
--- a/TestBeam/TBCaloGeometry/src/TBCaloCoordinate.cxx
+++ b/TestBeam/TBCaloGeometry/src/TBCaloCoordinate.cxx
@@ -399,7 +399,7 @@ TBCaloCoordinate:: read_MC_position()
 
     // get the manager used for simulation :
 
-    ATH_CHECK( detStore()->retrieve( m_MCmgr ) );
+    ATH_CHECK( detStore()->retrieve( m_MCmgr ), false );
   }
 
   ATH_MSG_DEBUG ( " found TBDetDescrManager " );
diff --git a/TestBeam/TBConditions/TBCaloConditions/src/TBCaloCoolPosTool.cxx b/TestBeam/TBConditions/TBCaloConditions/src/TBCaloCoolPosTool.cxx
index 18825bd3b7b45b1f140470fb424bdf65fdca7a5d..ee5290492f837ccb77b9a6d664b59958f3042632 100755
--- a/TestBeam/TBConditions/TBCaloConditions/src/TBCaloCoolPosTool.cxx
+++ b/TestBeam/TBConditions/TBCaloConditions/src/TBCaloCoolPosTool.cxx
@@ -81,7 +81,7 @@ bool TBCaloCoolPosTool::initHandles()
       ATH_MSG_DEBUG ("in initHandles()" );
 
       const EventInfo* evtInfo = nullptr;
-      ATH_CHECK( evtStore()->retrieve(evtInfo) );
+      ATH_CHECK( evtStore()->retrieve(evtInfo), false );
 
       int run = evtInfo->event_ID()->run_number(); 
 
diff --git a/TestBeam/TBConditions/TBCaloConditions/src/TBCaloPosTool.cxx b/TestBeam/TBConditions/TBCaloConditions/src/TBCaloPosTool.cxx
index 7582f4f7ec669947d3924d1983f71768eccfce10..c351d5eaaeddb5842433b704cc283801570df8f3 100755
--- a/TestBeam/TBConditions/TBCaloConditions/src/TBCaloPosTool.cxx
+++ b/TestBeam/TBConditions/TBCaloConditions/src/TBCaloPosTool.cxx
@@ -82,7 +82,7 @@ bool TBCaloPosTool::initHandles()
       ATH_MSG_DEBUG ("in initHandles()" );
 
       const EventInfo* evtInfo = nullptr;
-      ATH_CHECK( evtStore()->retrieve(evtInfo) );
+      ATH_CHECK( evtStore()->retrieve(evtInfo), false );
 
       int run = evtInfo->event_ID()->run_number(); 
 
diff --git a/TestBeam/TBRec/src/CBNTAA_TBInfo.cxx b/TestBeam/TBRec/src/CBNTAA_TBInfo.cxx
index de25ff15a8b39dc3ef216862501d17384a601e90..918e78476c12c1be3022349559bce0277066797e 100755
--- a/TestBeam/TBRec/src/CBNTAA_TBInfo.cxx
+++ b/TestBeam/TBRec/src/CBNTAA_TBInfo.cxx
@@ -143,7 +143,7 @@ StatusCode CBNTAA_TBInfo::CBNT_execute(){
     if ( sc1.isFailure() )
       {
 	ATH_MSG_ERROR( "Unable to get the StoreGateSvc"  );
-	return false ; 
+	return StatusCode::FAILURE ;
       }
     
     const EventInfo* evtInfo;
@@ -151,7 +151,7 @@ StatusCode CBNTAA_TBInfo::CBNT_execute(){
     if ( sc1.isFailure() )
       {
 	ATH_MSG_INFO( "Unable to get EventInfo, run probably not begun yet "  );
-	return false ; 
+	return StatusCode::FAILURE ;
       }
     
     int run = evtInfo->event_ID()->run_number(); 
diff --git a/TestBeam/TBRec/src/TBAlgoSequencer.cxx b/TestBeam/TBRec/src/TBAlgoSequencer.cxx
index 32a5d0aceff1dbf4ab4d88965f9634f9bb69b9f7..e446f1ea79aea8bd56ce220c69e7e9240022537d 100755
--- a/TestBeam/TBRec/src/TBAlgoSequencer.cxx
+++ b/TestBeam/TBRec/src/TBAlgoSequencer.cxx
@@ -164,7 +164,7 @@ TBAlgoSequencer::execute()
       algoCounter++;
     }
   // this is the trick - catch it before the framework terminates the job!  
-  return SUCCESS;
+  return StatusCode::SUCCESS;
 }
 
 //////////////
diff --git a/TestBeam/TBRec/src/TBTrackToCaloAlg.cxx b/TestBeam/TBRec/src/TBTrackToCaloAlg.cxx
index 3855bded2f5f4282f5b8aca9fc1bb67f828c3c21..b0f1dbafcb5309130f57d301286dc9f8f158aa96 100755
--- a/TestBeam/TBRec/src/TBTrackToCaloAlg.cxx
+++ b/TestBeam/TBRec/src/TBTrackToCaloAlg.cxx
@@ -167,7 +167,7 @@ bool TBTrackToCaloAlg::CreateTrkImpactInCalo()
     {
       if (m_TrackParticleName == "") {
 	ATH_MSG_ERROR ("m_TrackParticleName not set" );
-	return StatusCode::SUCCESS;
+	return true;
       }
 
       sc = evtStore()->retrieve(m_particle, m_TrackParticleName);
@@ -189,7 +189,7 @@ bool TBTrackToCaloAlg::CreateTrkImpactInCalo()
     {
       if (m_TrackName == "") {
 	ATH_MSG_ERROR ("m_TrackName not set" );
-	return StatusCode::SUCCESS;
+	return true;
       }
 
       sc = evtStore()->retrieve(m_tracks, m_TrackName);
@@ -668,7 +668,7 @@ bool TBTrackToCaloAlg::PrintCellsCrossed()
   // get tracks from TDS
   if (m_TrackName == "") {
     ATH_MSG_ERROR ("m_TrackName not set" );
-    return StatusCode::SUCCESS;
+    return true;
   }
   
   StatusCode sc = evtStore()->retrieve(m_tracks, m_TrackName);
diff --git a/TileCalorimeter/TileMonitoring/src/TileJetMonTool.cxx b/TileCalorimeter/TileMonitoring/src/TileJetMonTool.cxx
index 7da8af89448766e01702831332a159c41957f671..962cc1f49c8f4eaf2e098661691cd1ba4a6e66c7 100644
--- a/TileCalorimeter/TileMonitoring/src/TileJetMonTool.cxx
+++ b/TileCalorimeter/TileMonitoring/src/TileJetMonTool.cxx
@@ -731,7 +731,7 @@ bool TileJetMonTool::isGoodEvent() {
 
   ATH_MSG_DEBUG("TileJetMonTool::isGoodEvent()....");
   const EventInfo* eventInfo(NULL);
-  CHECK(evtStore()->retrieve(eventInfo));
+  CHECK(evtStore()->retrieve(eventInfo), false);
   if (eventInfo->errorState(EventInfo::LAr) == EventInfo::Error) return(false);
   if (eventInfo->errorState(EventInfo::Tile) == EventInfo::Error) return(false);
 
diff --git a/TileCalorimeter/TileMonitoring/src/TileMuonFitMonTool.cxx b/TileCalorimeter/TileMonitoring/src/TileMuonFitMonTool.cxx
index f411c483b50027d164c0097e1bccd376f11ff162..7ab7f9e7710cb865cde668357a679bd7d555f0d7 100644
--- a/TileCalorimeter/TileMonitoring/src/TileMuonFitMonTool.cxx
+++ b/TileCalorimeter/TileMonitoring/src/TileMuonFitMonTool.cxx
@@ -393,7 +393,7 @@ int  TileMuonFitMonTool::getTMFpart(const TileCosmicMuon* tmf) {
   int part = -2;
 
   const CaloCellContainer* cellcoll;
-  CHECK( evtStore()->retrieve(cellcoll, m_cellContainerKey) );
+  CHECK( evtStore()->retrieve(cellcoll, m_cellContainerKey), -1 );
 
   CaloCellContainer::const_iterator f_cell = cellcoll->begin();
   CaloCellContainer::const_iterator l_cell = cellcoll->end();
diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMeasurementUpdator.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMeasurementUpdator.h
index 6957884f715b5b7df619d36cf4160496a12853f6..be5341413d3fb2aa519254a611b9ac27cd9affef 100755
--- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMeasurementUpdator.h
+++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMeasurementUpdator.h
@@ -73,11 +73,6 @@ class GsfMeasurementUpdator : public AthAlgTool, virtual public IMultiStateMeasu
   const MultiComponentState* calculateFilterStep( const MultiComponentState&, 
                                                   const MeasurementBase&, 
                                                   std::unique_ptr<FitQualityOnSurface>& fitQoS ) const;
-                                                  
-  bool invalidComponent(const Trk::TrackParameters* trackParameters ) const;
-  
-  Trk::MultiComponentState*  rebuildState(const Trk::MultiComponentState& stateBeforeUpdate) const;
-                                                  
 
  private:
   int                                      m_outputlevel;                      //!< to cache current output level
diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMeasurementUpdator.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMeasurementUpdator.cxx
index 6b58c49827743890c290895b0cef7b628cc46f90..d80b72b412026021b05c23822d67da9c015ee014 100755
--- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMeasurementUpdator.cxx
+++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMeasurementUpdator.cxx
@@ -47,30 +47,31 @@ StatusCode Trk::GsfMeasurementUpdator::initialize()
 
   // Request the Chrono Service
   if ( m_chronoSvc.retrieve().isFailure() ) {
-   ATH_MSG_FATAL("Failed to retrieve service " << m_chronoSvc);
+   msg(MSG::FATAL) << "Failed to retrieve service " << m_chronoSvc << endmsg;
    return StatusCode::FAILURE;
   } else 
-   ATH_MSG_INFO("Retrieved service " << m_chronoSvc);
+   msg(MSG::INFO) << "Retrieved service " << m_chronoSvc << endmsg;
 
   // Retrieve the updator tool
   if ( m_updator.retrieve().isFailure() ){
-    ATH_MSG_FATAL("Could not retrieve measurement updator AlgTool ... Exiting!");
+    msg(MSG::FATAL)
+        << "Could not retrieve measurement updator AlgTool ... Exiting!" << endmsg;
     return StatusCode::FAILURE;
   }
 
   // Retrieve the Posterior Weights Calculator
   if ( m_posteriorWeightsCalculator.retrieve().isFailure() ){
-    ATH_MSG_FATAL("Could not find the Posterior Weights Calculator Service... Exiting!");
+    msg(MSG::FATAL) << "Could not find the Posterior Weights Calculator Service... Exiting!" << endmsg;
     return StatusCode::FAILURE;
   }
 
   // Request an instance of the MultiComponentStateAssembler
   if ( m_stateAssembler.retrieve().isFailure() ){
-    ATH_MSG_ERROR("Could not access the MultiComponentStateAssembler Service");
+    msg(MSG::ERROR) << "Could not access the MultiComponentStateAssembler Service" << endmsg;
     return StatusCode::FAILURE;
   }
 
-  ATH_MSG_INFO("Initialisation of " << name() << " was successful");
+  msg(MSG::INFO) << "Initialisation of " << name() << " was successful" << endmsg;
   return StatusCode::SUCCESS;
 
 }
@@ -78,7 +79,7 @@ StatusCode Trk::GsfMeasurementUpdator::initialize()
 StatusCode Trk::GsfMeasurementUpdator::finalize()
 {
 
-  ATH_MSG_INFO("Finalisation of " << name() << " was successful");
+  msg(MSG::INFO) << "Finalisation of " << name() << " was successful" << endmsg;
   return StatusCode::SUCCESS;
 
 }
@@ -86,7 +87,8 @@ StatusCode Trk::GsfMeasurementUpdator::finalize()
 const Trk::MultiComponentState* Trk::GsfMeasurementUpdator::update (const Trk::MultiComponentState& stateBeforeUpdate, const Trk::MeasurementBase& measurement) const
 {
 
-  ATH_MSG_VERBOSE( "Updating using GsfMeasurementUpdator");
+  if (m_outputlevel < 0) 
+    msg(MSG::VERBOSE) << "Updating using GsfMeasurementUpdator" << endmsg;
 
   const Trk::MultiComponentState* updatedState = 0;
 
@@ -94,20 +96,72 @@ const Trk::MultiComponentState* Trk::GsfMeasurementUpdator::update (const Trk::M
   Updator updator = &Trk::IUpdator::addToState;
 
   // Check all components have associated error matricies
+  double weight = 0.;
+
+  const Trk::TrackParameters* trackParameters = 0;
+  const AmgSymMatrix(5)* measuredCov = 0;
   Trk::MultiComponentState::const_iterator component = stateBeforeUpdate.begin();
 
   bool rebuildStateWithErrors = false;
 
   // Perform initial check of state awaiting update. If all states have associated error matricies then no need to perform the rebuild
   for ( ; component != stateBeforeUpdate.end(); ++component ) {
-    rebuildStateWithErrors = rebuildStateWithErrors || invalidComponent( component->first ) ;
+
+    trackParameters = component->first;
+
+    measuredCov = trackParameters->covariance();
+
+    if ( !measuredCov ){
+      if (m_outputlevel <= 0) 
+        msg(MSG::DEBUG) << "Component in the state awaiting update has no error matrix... rebuilding the entire state" << endmsg;
+      rebuildStateWithErrors = true;
+    }
+
   }
 
   if ( rebuildStateWithErrors ){
 
-    ATH_MSG_VERBOSE( "Rebuilding state with errors");
+    if (m_outputlevel < 0) 
+      msg(MSG::VERBOSE) << "Rebuilding state with errors" << endmsg;
+
+    Trk::MultiComponentState* stateWithInsertedErrors = new Trk::MultiComponentState();
+    const Trk::TrackParameters* trackParametersWithError = 0;
+
+    component = stateBeforeUpdate.begin();
+
+    for ( ; component != stateBeforeUpdate.end(); ++component ){
+
+      trackParameters = component->first;
+      weight = component->second;
 
-    Trk::MultiComponentState* stateWithInsertedErrors = rebuildState( stateBeforeUpdate );
+      measuredCov = trackParameters->covariance();
+
+
+      if ( !measuredCov ){
+
+        if (m_outputlevel <= 0) 
+          msg(MSG::DEBUG) << "No measurement associated with track parameters, creating a big one" << endmsg;
+        AmgSymMatrix(5)* bigNewCovarianceMatrix = new AmgSymMatrix(5);
+        bigNewCovarianceMatrix->setZero();
+        double covarianceScaler = 1.;
+        (*bigNewCovarianceMatrix)(0,0) = 250. * covarianceScaler;
+        (*bigNewCovarianceMatrix)(1,1) = 250. * covarianceScaler;
+        (*bigNewCovarianceMatrix)(2,2) = 0.25;
+        (*bigNewCovarianceMatrix)(3,3) = 0.25;
+        (*bigNewCovarianceMatrix)(4,4) = 0.001 * 0.001;
+      
+        const AmgVector(5)& par = trackParameters->parameters();
+        trackParametersWithError = trackParameters->associatedSurface().createTrackParameters(par[Trk::loc1],par[Trk::loc2],par[Trk::phi],par[Trk::theta],par[Trk::qOverP], bigNewCovarianceMatrix );
+
+        Trk::ComponentParameters componentParametersWithError( trackParametersWithError, weight );
+        stateWithInsertedErrors->push_back( componentParametersWithError );
+
+      }
+
+      else
+        stateWithInsertedErrors->push_back( *component );
+
+    }
 
     // Perform the measurement update with the modified state
     updatedState = calculateFilterStep(*stateWithInsertedErrors, measurement, updator);
@@ -115,7 +169,8 @@ const Trk::MultiComponentState* Trk::GsfMeasurementUpdator::update (const Trk::M
     delete stateWithInsertedErrors;
 
     if ( !updatedState ) {
-      ATH_MSG_DEBUG("Updated state could not be calculated... Returning 0" );
+      if (m_outputlevel <= 0) 
+        msg(MSG::DEBUG) << "Updated state could not be calculated... Returning 0" << endmsg;
       return 0;
     }
 
@@ -127,7 +182,8 @@ const Trk::MultiComponentState* Trk::GsfMeasurementUpdator::update (const Trk::M
   updatedState = calculateFilterStep(stateBeforeUpdate, measurement, updator);
 
   if ( !updatedState ) {
-    ATH_MSG_DEBUG("Updated state could not be calculated... Returning 0" );
+    if (m_outputlevel <= 0) 
+      msg(MSG::DEBUG) << "Updated state could not be calculated... Returning 0" << endmsg;
     return 0;
   }
 
@@ -156,7 +212,7 @@ Trk::GsfMeasurementUpdator::fitQuality (const MultiComponentState& updatedState,
   // Fit quality assumes that a state that has been updated by the measurement updator has been supplied to it
 
   if ( updatedState.empty() ){
-    ATH_MSG_WARNING( "Attempting to calculate chi2 of a hit with respect to an empty multiple-component state" );
+    msg(MSG::WARNING) << "Attempting to calculate chi2 of a hit with respect to an empty multiple-component state" << endmsg;
     return 0;
   }
 
@@ -199,7 +255,8 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( const Trk::MultiComponentState&
              const Updator updator) const
 {
 
-  ATH_MSG_VERBOSE( "Calculate Filter Step");
+  if (m_outputlevel < 0) 
+    msg(MSG::VERBOSE) << "Calculate Filter Step" << endmsg;
 
   // Start the timer
   //Chrono chrono( &(*m_chronoSvc), "GsfMeasurementUpdate" );
@@ -208,12 +265,13 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( const Trk::MultiComponentState&
   bool isAssemblerReset = m_stateAssembler->reset();
 
   if ( !isAssemblerReset ){
-    ATH_MSG_DEBUG("Could not reset the state assembler... returning 0");
+    if (m_outputlevel <= 0) 
+      msg(MSG::ERROR) << "Could not reset the state assembler... returning 0" << endmsg;
     return 0;
   }
 
   if ( stateBeforeUpdate.empty() ){
-    ATH_MSG_WARNING("Cannot update multi-state with no components!");
+    msg(MSG::WARNING) << "Cannot update multi-state with no components!" << endmsg;
     return 0;
   }
 
@@ -223,11 +281,13 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( const Trk::MultiComponentState&
   stateWithNewWeights = m_posteriorWeightsCalculator->weights(stateBeforeUpdate, measurement);
 
   if ( !stateWithNewWeights ) {
-    ATH_MSG_DEBUG( "Cacluation of state posterior weights failed... Exiting!");
+    if (m_outputlevel <= 0) 
+      msg(MSG::DEBUG) << "Cacluation of state posterior weights failed... Exiting!" << endmsg;
     return 0;
   }
   else
-    ATH_MSG_VERBOSE( "Calculation of state posterior weights successful");
+    if (m_outputlevel < 0) 
+      msg(MSG::VERBOSE) << "Calculation of state posterior weights successful" << endmsg;
 
   // Update each component using the specified updator
   Trk::MultiComponentState::const_iterator component = stateWithNewWeights->begin();
@@ -236,7 +296,8 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( const Trk::MultiComponentState&
 
     const Trk::TrackParameters* updatedTrackParameters = 0;
 
-    ATH_MSG_VERBOSE( "Performing update of predicted component state with measurement...");
+    if (m_outputlevel < 0) 
+      msg(MSG::VERBOSE) << "Performing update of predicted component state with measurement..." << endmsg;
 
     Trk::FitQualityOnSurface* fitQuality = 0;
 
@@ -247,13 +308,21 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( const Trk::MultiComponentState&
     //updatedTrackParameters = m_updator->addToState( *(*component).first, measurement.localParameters(), measurement.localCovariance(), fitQuality );
 
     if ( !updatedTrackParameters ) {
-      ATH_MSG_DEBUG( "Update of state with Measurement has failed 1... Exiting!");
+      if (m_outputlevel <= 0) 
+        msg(MSG::DEBUG) << "Update of state with Measurement has failed 1... Exiting!" << endmsg;
       if ( fitQuality )  delete fitQuality;
       continue;
     }
+
+    //std::cout << "  A  \n " << *updatedTrackParameters <<std::endl;
+    //std::cout << "  B   \n" << *updatedTrackParameters2 <<std::endl;
+    //delete updatedTrackParameters2;
+    //delete fitQuality2;
+    
     
     if ( fitQuality && fitQuality->chiSquared() <= 0. ){
-      ATH_MSG_DEBUG( "Fit quality of update failed... Exiting!");
+      if (m_outputlevel <= 0) 
+        msg(MSG::DEBUG) << "Fit quality of update failed... Exiting!" << endmsg;
       delete updatedTrackParameters;      
       delete fitQuality;
       continue;
@@ -262,7 +331,8 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( const Trk::MultiComponentState&
     // Clean up memory
     delete fitQuality;
 
-    ATH_MSG_VERBOSE( "Successful measurement update with Measurement");
+    if (m_outputlevel < 0) 
+      msg(MSG::VERBOSE) << "Successful measurement update with Measurement" << endmsg;
 
     // Updator does not change the weighting
     Trk::ComponentParameters updatedComponentParameters(updatedTrackParameters, component->second);
@@ -271,7 +341,8 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( const Trk::MultiComponentState&
     bool componentAdded = m_stateAssembler->addComponent(updatedComponentParameters);
 
     if ( !componentAdded )
-      ATH_MSG_DEBUG( "Component could not be added to the state in the assembler");
+      if (m_outputlevel <= 0) 
+        msg(MSG::WARNING) << "Component could not be added to the state in the assembler" << endmsg;
 
     delete updatedTrackParameters;
   
@@ -293,7 +364,8 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( const Trk::MultiComponentState&
   delete assembledUpdatedState;
 
   
-  ATH_MSG_VERBOSE( "Successful calculation of filter step"); 
+  if (m_outputlevel < 0) 
+    msg(MSG::VERBOSE) << "Successful calculation of filter step" << endmsg; 
 
   return renormalisedUpdatedState;
 
@@ -305,33 +377,85 @@ Trk::GsfMeasurementUpdator::update (const Trk::MultiComponentState& stateBeforeU
                                     std::unique_ptr<FitQualityOnSurface>&   fitQoS ) const
 {
 
-  ATH_MSG_VERBOSE( "Updating using GsfMeasurementUpdator");
+  if (m_outputlevel < 0) 
+    msg(MSG::VERBOSE) << "Updating using GsfMeasurementUpdator" << endmsg;
 
   const Trk::MultiComponentState* updatedState = 0;
 
   // Check all components have associated error matricies
+  double weight = 0.;
+
+  const Trk::TrackParameters* trackParameters = 0;
+  const AmgSymMatrix(5)* measuredCov = 0;
   Trk::MultiComponentState::const_iterator component = stateBeforeUpdate.begin();
 
   bool rebuildStateWithErrors = false;
 
   // Perform initial check of state awaiting update. If all states have associated error matricies then no need to perform the rebuild
   for ( ; component != stateBeforeUpdate.end(); ++component ) {
-    rebuildStateWithErrors = rebuildStateWithErrors || invalidComponent( component->first ) ;
+
+    trackParameters = component->first;
+
+    measuredCov  = trackParameters->covariance();
+
+    if ( !measuredCov ){
+      if (m_outputlevel <= 0) 
+        msg(MSG::DEBUG) << "Component in the state awaiting update has no error matrix... rebuilding the entire state" << endmsg;
+      rebuildStateWithErrors = true;
+    }
   }
 
   if ( rebuildStateWithErrors ){
 
-    ATH_MSG_VERBOSE( "Rebuilding state with errors");
+    if (m_outputlevel < 0) 
+      msg(MSG::VERBOSE) << "Rebuilding state with errors" << endmsg;
+
+    Trk::MultiComponentState* stateWithInsertedErrors = new Trk::MultiComponentState();
+    const Trk::TrackParameters* trackParametersWithError = 0;
+
+    component = stateBeforeUpdate.begin();
+
+    for ( ; component != stateBeforeUpdate.end(); ++component ){
+
+      trackParameters = component->first;
+      weight = component->second;
+
+      measuredCov = trackParameters->covariance();
+
+
+      if ( !measuredCov ){
+
+        if (m_outputlevel <= 0) 
+          msg(MSG::DEBUG) << "No measurement associated with track parameters, creating a big one" << endmsg;
+        AmgSymMatrix(5)* bigNewCovarianceMatrix = new AmgSymMatrix(5);
+        bigNewCovarianceMatrix->setZero();
+        double covarianceScaler = 1.;
+        (*bigNewCovarianceMatrix)(0,0) = 250. * covarianceScaler;
+        (*bigNewCovarianceMatrix)(1,1) = 250. * covarianceScaler;
+        (*bigNewCovarianceMatrix)(2,2) = 0.25;
+        (*bigNewCovarianceMatrix)(3,3) = 0.25;
+        (*bigNewCovarianceMatrix)(4,4) = 0.001 * 0.001;
+      
+        AmgVector(5) par = trackParameters->parameters();
+        trackParametersWithError = trackParameters->associatedSurface().createTrackParameters(par[Trk::loc1],par[Trk::loc2],par[Trk::phi],par[Trk::theta],par[Trk::qOverP], bigNewCovarianceMatrix );
+        Trk::ComponentParameters componentParametersWithError( trackParametersWithError, weight );
+        stateWithInsertedErrors->push_back( componentParametersWithError );
+
+      }
+
+      else
+        stateWithInsertedErrors->push_back( *component );
+
+    }
 
-    Trk::MultiComponentState* stateWithInsertedErrors = rebuildState( stateBeforeUpdate );
- 
     // Perform the measurement update with the modified state
     updatedState = calculateFilterStep(*stateWithInsertedErrors, measurement, fitQoS);
     
     delete stateWithInsertedErrors;
 
     if ( !updatedState ) {
-      ATH_MSG_DEBUG( "Updated state could not be calculated... Returning 0");
+      if (m_outputlevel <= 0) 
+        msg(MSG::DEBUG) << "Updated state could not be calculated... Returning 0" << endmsg;
       fitQoS.reset();
       return 0;
     }
@@ -344,7 +468,8 @@ Trk::GsfMeasurementUpdator::update (const Trk::MultiComponentState& stateBeforeU
   updatedState = calculateFilterStep(stateBeforeUpdate, measurement, fitQoS);
 
   if ( !updatedState ) {
-    ATH_MSG_DEBUG( "Updated state could not be calculated... Returning 0");
+    if (m_outputlevel <= 0) 
+      msg(MSG::DEBUG) << "Updated state could not be calculated... Returning 0" << endmsg;
     fitQoS.reset();
     return 0;
   }
@@ -360,7 +485,8 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( const Trk::MultiComponentState&
              std::unique_ptr<FitQualityOnSurface>& fitQoS) const
 {
 
-  ATH_MSG_VERBOSE( "Calculate Filter Step");
+  if (m_outputlevel < 0) 
+    msg(MSG::VERBOSE) << "Calculate Filter Step" << endmsg;
 
   // Start the timer
   //Chrono chrono( &(*m_chronoSvc), "GsfMeasurementUpdate" );
@@ -369,12 +495,13 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( const Trk::MultiComponentState&
   bool isAssemblerReset = m_stateAssembler->reset();
 
   if ( !isAssemblerReset ){
-    ATH_MSG_ERROR("Could not reset the state assembler... returning 0");
+    if (m_outputlevel <= 0) 
+      msg(MSG::ERROR) << "Could not reset the state assembler... returning 0" << endmsg;
     return 0;
   }
 
   if ( stateBeforeUpdate.empty() ){
-    ATH_MSG_WARNING( "Cannot update multi-state with no components!");
+    msg(MSG::WARNING) << "Cannot update multi-state with no components!" << endmsg;
     return 0;
   }
 
@@ -384,11 +511,13 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( const Trk::MultiComponentState&
   stateWithNewWeights = m_posteriorWeightsCalculator->weights(stateBeforeUpdate, measurement);
 
   if ( !stateWithNewWeights ) {
-    ATH_MSG_DEBUG( "Cacluation of state posterior weights failed... Exiting!");
+    if (m_outputlevel <= 0) 
+      msg(MSG::DEBUG) << "Cacluation of state posterior weights failed... Exiting!" << endmsg;
     return 0;
   }
   else
-    ATH_MSG_VERBOSE( "Calculation of state posterior weights successful");
+    if (m_outputlevel < 0) 
+      msg(MSG::VERBOSE) << "Calculation of state posterior weights successful" << endmsg;
 
   // Update each component using the specified updator
   Trk::MultiComponentState::const_iterator component = stateWithNewWeights->begin();
@@ -401,11 +530,12 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( const Trk::MultiComponentState&
 
     const Trk::TrackParameters* updatedTrackParameters = 0;
 
-    ATH_MSG_VERBOSE( "Performing update of predicted component state with measurement...");
+    if (m_outputlevel < 0) 
+      msg(MSG::VERBOSE) << "Performing update of predicted component state with measurement..." << endmsg;
 
     if (fabs((*component).first->parameters()[Trk::qOverP])>0.033333) { //GC: protection against low momentum tracks getting lost
-                                                                       // cutoff is 30MeV
-      ATH_MSG_DEBUG( "About to update component with p<30MeV...skipping component! (2)");
+      if (m_outputlevel<=0)                                                            // cutoff is 30MeV
+        msg(MSG::DEBUG) << "About to update component with p<50MeV...skipping component! (2)"<<endmsg;
       continue;
     }
 
@@ -415,28 +545,21 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( const Trk::MultiComponentState&
     updatedTrackParameters = m_updator->addToState( *(*component).first, measurement.localParameters(), measurement.localCovariance(), componentFitQuality );
 
     if ( !updatedTrackParameters ) {
-      ATH_MSG_DEBUG( "Update of state with Measurement has failed 2... Exiting!");
+      if (m_outputlevel <= 0) 
+        msg(MSG::DEBUG) << "Update of state with Measurement has failed 2... Exiting!" << endmsg;
       if ( componentFitQuality ) delete componentFitQuality;
       continue;
     }
-    
-    if( invalidComponent(updatedTrackParameters)  ){
-      ATH_MSG_DEBUG( "Invalid cov matrix after update... Exiting!");
-      ATH_MSG_VERBOSE("Original TP \n" <<  *(*component).first ); 
-      if((*component).first->covariance())
-        ATH_MSG_VERBOSE("Original has a COV\n " << *(*component).first->covariance() );
-      ATH_MSG_VERBOSE("Measurement  \n" <<  measurement ); 
-      ATH_MSG_VERBOSE("Result  \n" <<  *updatedTrackParameters ); 
-      if(updatedTrackParameters->covariance())
-        ATH_MSG_VERBOSE("Result has a COV\n" << *updatedTrackParameters->covariance() );
-      
-      delete updatedTrackParameters;      
-      delete componentFitQuality;
-      continue;    
-    }
+
+    //std::cout << "  A  \n " << *updatedTrackParameters <<std::endl;
+    //std::cout << "  B   \n" << *updatedTrackParameters2 <<std::endl;
+    //delete updatedTrackParameters2;
+    //delete fitQuality2;
+
 
     if ( !componentFitQuality || componentFitQuality->chiSquared() <= 0. ){
-      ATH_MSG_DEBUG( "Fit quality of update failed... Exiting!");
+      if (m_outputlevel <= 0) 
+        msg(MSG::DEBUG) << "Fit quality of update failed... Exiting!" << endmsg;
       delete updatedTrackParameters;      
       delete componentFitQuality;
       continue;
@@ -453,7 +576,8 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( const Trk::MultiComponentState&
     // Clean up memory
     delete componentFitQuality;
 
-    ATH_MSG_VERBOSE( "Successful measurement update with Measurement");
+    if (m_outputlevel < 0) 
+      msg(MSG::VERBOSE) << "Successful measurement update with Measurement" << endmsg;
 
     // Updator does not change the weighting
     Trk::ComponentParameters updatedComponentParameters(updatedTrackParameters, component->second);
@@ -462,7 +586,8 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( const Trk::MultiComponentState&
     bool componentAdded = m_stateAssembler->addComponent(updatedComponentParameters);
 
     if ( !componentAdded )
-      ATH_MSG_DEBUG( "Component could not be added to the state in the assembler");
+      if (m_outputlevel <= 0) 
+        msg(MSG::WARNING) << "Component could not be added to the state in the assembler" << endmsg;
 
     delete updatedTrackParameters;
 
@@ -488,69 +613,10 @@ Trk::GsfMeasurementUpdator::calculateFilterStep( const Trk::MultiComponentState&
   delete assembledUpdatedState;
 
   
-  ATH_MSG_VERBOSE( "Successful calculation of filter step: " << renormalisedUpdatedState->size()); 
+  if (m_outputlevel < 0) 
+    msg(MSG::VERBOSE) << "Successful calculation of filter step: " << renormalisedUpdatedState->size() << endmsg; 
 
   return renormalisedUpdatedState;
 
 }
 
-bool Trk::GsfMeasurementUpdator::invalidComponent(const Trk::TrackParameters* trackParameters ) const
-{
-  auto measuredCov = trackParameters->covariance();
-  bool rebuildCov = false; 
-  if (!measuredCov){
-    rebuildCov = true;
-  } else {
-    for (int i(0); i<5; ++i){
-      if( (*measuredCov)(i,i)  <= 0.)
-        rebuildCov = true;
-    }
-  }
-  
-  return rebuildCov;
-}
-
-Trk::MultiComponentState*  Trk::GsfMeasurementUpdator::rebuildState(const Trk::MultiComponentState& stateBeforeUpdate) const
-{
-  Trk::MultiComponentState*   stateWithInsertedErrors = new Trk::MultiComponentState();
-  const Trk::TrackParameters* trackParametersWithError = 0;
-
-  auto component = stateBeforeUpdate.begin();
-
-  for ( ; component != stateBeforeUpdate.end(); ++component ){
-
-    auto trackParameters = component->first;
-    auto weight = component->second;
-
-    bool rebuildCov = invalidComponent(trackParameters);
-
-    if ( rebuildCov ){
-
-      if (m_outputlevel <= 0) 
-        ATH_MSG_DEBUG( "No measurement associated with track parameters, creating a big one");
-      AmgSymMatrix(5)* bigNewCovarianceMatrix = new AmgSymMatrix(5);
-      bigNewCovarianceMatrix->setZero();
-      double covarianceScaler = 1.;
-      (*bigNewCovarianceMatrix)(0,0) = 250. * covarianceScaler;
-      (*bigNewCovarianceMatrix)(1,1) = 250. * covarianceScaler;
-      (*bigNewCovarianceMatrix)(2,2) = 0.25;
-      (*bigNewCovarianceMatrix)(3,3) = 0.25;
-      (*bigNewCovarianceMatrix)(4,4) = 0.001 * 0.001;
-  
-      AmgVector(5) par = trackParameters->parameters();
-      trackParametersWithError = trackParameters->associatedSurface().createTrackParameters(par[Trk::loc1],par[Trk::loc2],par[Trk::phi],par[Trk::theta],par[Trk::qOverP], bigNewCovarianceMatrix );
-      Trk::ComponentParameters componentParametersWithError( trackParametersWithError, weight );
-      stateWithInsertedErrors->push_back( componentParametersWithError );
-
-    }
-
-    else
-      stateWithInsertedErrors->push_back( *component );
-
-  }
-
-  return stateWithInsertedErrors;
-}
-
-
-
diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfSmoother.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfSmoother.cxx
index e0985d5ecc608afcf10a8760863e2d25c6a87199..2170bdc36bd75e983868dcf2bb0f882b2b5d7284 100755
--- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfSmoother.cxx
+++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfSmoother.cxx
@@ -49,17 +49,17 @@ StatusCode Trk::GsfSmoother::initialize()
   
   // Retrieve an instance of the component merger
   if ( m_merger.retrieve().isFailure() ){
-    ATH_MSG_FATAL("Could not retrieve the component merger tool... Exiting!");
+    msg(MSG::FATAL) << "Could not retrieve the component merger tool... Exiting!" << endmsg;
     return StatusCode::FAILURE;
   }
 
   // Request an instance of the state combiner
   if ( m_combiner.retrieve().isFailure() ){
-    ATH_MSG_FATAL("Could not retrieve an instance of the multi component state combiner... Exiting!");
+    msg(MSG::FATAL) << "Could not retrieve an instance of the multi component state combiner... Exiting!" << endmsg;
     return StatusCode::FAILURE;
   }
   
-  ATH_MSG_INFO("Initialisation of " << name() << " was successful");
+  msg(MSG::INFO) << "Initialisation of " << name() << " was successful" << endmsg;
 
   return StatusCode::SUCCESS;
 
@@ -68,7 +68,7 @@ StatusCode Trk::GsfSmoother::initialize()
 StatusCode Trk::GsfSmoother::finalize()
 {
 
-  ATH_MSG_INFO("Finalisation of " << name() << " was successful");
+  msg(MSG::INFO) << "Finalisation of " << name() << " was successful" << endmsg;
 
   return StatusCode::SUCCESS;
 
@@ -80,7 +80,7 @@ StatusCode Trk::GsfSmoother::configureTools(const ToolHandle<IMultiStateExtrapol
   m_extrapolator = extrapolator;
   m_updator      = measurementUpdator;
 
-  ATH_MSG_INFO("Configuration of " << name() << " was successful");
+  msg(MSG::INFO) << "Configuration of " << name() << " was successful" << endmsg;
 
   return StatusCode::SUCCESS;
 
@@ -91,32 +91,33 @@ Trk::SmoothedTrajectory* Trk::GsfSmoother::fit (const ForwardTrajectory& forward
                                                 const Trk::CaloCluster_OnTrack * ccot ) const
 {
 
-  ATH_MSG_VERBOSE("This is the GSF Smoother!");
+  if (m_outputlevel<0)
+    msg(MSG::VERBOSE) << "This is the GSF Smoother!" << endmsg;
 
   // Check that extrapolator and updator are instansiated
   if (!m_updator) {
-    ATH_MSG_ERROR("The measurement updator is not configured... Exiting!");
+    msg(MSG::ERROR) << "The measurement updator is not configured... Exiting!" << endmsg;
     return 0;
   }
 
   if (!m_extrapolator) {
-    ATH_MSG_ERROR("The extrapolator is not configured... Exiting!");
+    msg(MSG::ERROR) << "The extrapolator is not configured... Exiting!" << endmsg;
     return 0;
   }
 
   // Check that the forward trajectory is filled
   if ( forwardTrajectory.empty() ){
-    ATH_MSG_ERROR("Attempting to smooth an empty forward trajectory... Exiting!");
+    msg(MSG::ERROR) << "Attempting to smooth an empty forward trajectory... Exiting!" << endmsg;
     return 0;
   }
   
   if (m_outputlevel<0){
   
     if ( particleHypothesis == Trk::nonInteracting )
-      ATH_MSG_VERBOSE("Material effects are switched off in the Gsf Smoother");
+      msg(MSG::VERBOSE) << "Material effects are switched off in the Gsf Smoother" << endmsg;
   
     else
-      ATH_MSG_VERBOSE("Material effects are switched on in the Gsf Smoother (type): " << particleHypothesis);
+      msg(MSG::VERBOSE) << "Material effects are switched on in the Gsf Smoother (type): " << particleHypothesis << endmsg;
 
   }
     
@@ -139,7 +140,7 @@ Trk::SmoothedTrajectory* Trk::GsfSmoother::fit (const ForwardTrajectory& forward
   const Trk::MultiComponentStateOnSurface* smootherPredictionMultiStateOnSurface = dynamic_cast<const Trk::MultiComponentStateOnSurface*>(smootherPredictionStateOnSurface);
 
   if (!smootherPredictionMultiStateOnSurface) {
-    ATH_MSG_DEBUG("GSF smoother has a single component state as starting point");
+    msg(MSG::DEBUG) << "GSF smoother has a single component state as starting point" << endmsg;
 
     // Build new multi-component state
     Trk::ComponentParameters smootherPredictionComponent(smootherPredictionStateOnSurface->trackParameters(), 1.);
@@ -159,7 +160,7 @@ Trk::SmoothedTrajectory* Trk::GsfSmoother::fit (const ForwardTrajectory& forward
   const Trk::MeasurementBase* firstSmootherMeasurementOnTrack = smootherPredictionStateOnSurface->measurementOnTrack()->clone();
 
   if ( !firstSmootherMeasurementOnTrack ){
-    ATH_MSG_WARNING("Initial state on surface in smoother does not have an associated MeasurementBase object... returning 0");
+    msg(MSG::WARNING) << "Initial state on surface in smoother does not have an associated MeasurementBase object... returning 0" << endmsg;
     return 0;
   }
 
@@ -172,7 +173,8 @@ Trk::SmoothedTrajectory* Trk::GsfSmoother::fit (const ForwardTrajectory& forward
     if (!smootherPredictionMultiStateOnSurface)
       delete smootherPredictionMultiState;
 
-    ATH_MSG_DEBUG("First GSF smoothing update failed... Exiting!");
+    if (m_outputlevel<=0)
+      msg(MSG::DEBUG) << "First GSF smoothing update failed... Exiting!" << endmsg;
     return 0;
   }
 
@@ -207,7 +209,7 @@ Trk::SmoothedTrajectory* Trk::GsfSmoother::fit (const ForwardTrajectory& forward
   // =============================================================================================================================
 
   if ( !firstSmoothedState->isMeasured() ){
-    ATH_MSG_WARNING("Updated state is not measured. Rejecting smoothed state... returning 0");
+    msg(MSG::WARNING) << "Updated state is not measured. Rejecting smoothed state... returning 0" << endmsg;
     return 0;
   }
 
@@ -218,7 +220,7 @@ Trk::SmoothedTrajectory* Trk::GsfSmoother::fit (const ForwardTrajectory& forward
     std::unique_ptr<const Trk::MultiComponentState> (firstSmoothedState->cloneWithScaledError( 15., 5., 15., 5., 15. ));
 
   if ( !smoothedStateWithScaledError ){
-    ATH_MSG_WARNING("Covariance scaling could not be performed... returning 0");
+    msg(MSG::WARNING) << "Covariance scaling could not be performed... returning 0" << endmsg;
     return 0;
   }
 
@@ -227,7 +229,7 @@ Trk::SmoothedTrajectory* Trk::GsfSmoother::fit (const ForwardTrajectory& forward
     std::unique_ptr<const Trk::MultiComponentState> (m_updator->update(*smoothedStateWithScaledError, *firstSmootherMeasurementOnTrack));
 
   if ( !updatedState ){
-    ATH_MSG_WARNING("Smoother prediction could not be determined... returning 0");
+    msg(MSG::WARNING) << "Smoother prediction could not be determined... returning 0" << endmsg;
     return 0;
   }
 
@@ -251,7 +253,7 @@ Trk::SmoothedTrajectory* Trk::GsfSmoother::fit (const ForwardTrajectory& forward
     const Trk::MeasurementBase* measurement_in = (*trackStateOnSurface)->measurementOnTrack();
 
     if ( !measurement_in ){
-      ATH_MSG_WARNING("MeasurementBase object could not be extracted from a measurement... continuing");
+      msg(MSG::WARNING) << "MeasurementBase object could not be extracted from a measurement... continuing" << endmsg;
       continue;
     }
 
@@ -308,11 +310,11 @@ Trk::SmoothedTrajectory* Trk::GsfSmoother::fit (const ForwardTrajectory& forward
         varQoverP = (*measuredCov)(Trk::qOverP,Trk::qOverP);
       }
 
-      ATH_MSG_DEBUG("Finishing extrapolation parameters:\t" 
+      msg(MSG::DEBUG) << "Finishing extrapolation parameters:\t" 
             << combinedState->parameters()[Trk::phi] << "\t"
             << combinedState->parameters()[Trk::theta] << "\t" 
             << combinedState->parameters()[Trk::qOverP] << "\t"
-            << varQoverP);
+            << varQoverP << endmsg;
     }
     
       // Original measurement was flagged as  an outlier
@@ -334,7 +336,7 @@ Trk::SmoothedTrajectory* Trk::GsfSmoother::fit (const ForwardTrajectory& forward
     updatedState = std::unique_ptr<const Trk::MultiComponentState> (m_updator->update( *extrapolatedState, *measurement, fitQuality ) );
 
     if (!updatedState) {
-      ATH_MSG_WARNING("Could not update the multi-component state... rejecting track!");
+      msg(MSG::WARNING) << "Could not update the multi-component state... rejecting track!" << endmsg;
       return 0;
     }
 
@@ -351,12 +353,12 @@ Trk::SmoothedTrajectory* Trk::GsfSmoother::fit (const ForwardTrajectory& forward
         varQoverP = (*measuredCov)(Trk::qOverP,Trk::qOverP);
       }
 
-      ATH_MSG_DEBUG("Update finished parameters:\t\t" 
+      msg(MSG::DEBUG) << "Update finished parameters:\t\t" 
             << combinedState->parameters()[Trk::phi] << "\t"
             << combinedState->parameters()[Trk::theta] << "\t" 
             << combinedState->parameters()[Trk::qOverP] << "\t"
-            << varQoverP);
-      ATH_MSG_DEBUG("-----------------------------------------------------------------------------");
+            << varQoverP << endmsg;
+      msg(MSG::DEBUG) << "-----------------------------------------------------------------------------" << endmsg;
     }
     
     /* =============================================================
@@ -388,7 +390,7 @@ Trk::SmoothedTrajectory* Trk::GsfSmoother::fit (const ForwardTrajectory& forward
       //   delete forwardsMultiState;
       
       if (!combinedState2) {
-        ATH_MSG_WARNING("Could not combine state from forward fit with smoother state... rejecting track!");
+        msg(MSG::WARNING) << "Could not combine state from forward fit with smoother state... rejecting track!" << endmsg;
         // delete updatedState;
         // delete measurement;
         // delete smoothedTrajectory;
@@ -465,7 +467,7 @@ const Trk::MultiComponentState* Trk::GsfSmoother::combine (const Trk::MultiCompo
     const AmgSymMatrix(5)* forwardMeasuredCov = forwardsComponent->first->covariance();
 
     if ( !forwardMeasuredCov )
-      ATH_MSG_DEBUG("No measurement associated with forwards component... continuing for now");
+      msg(MSG::DEBUG) << "No measurement associated with forwards component... continuing for now" << endmsg;
 
     /* ====================================================
        Loop over all components in the smoother multi-state
@@ -479,13 +481,13 @@ const Trk::MultiComponentState* Trk::GsfSmoother::combine (const Trk::MultiCompo
       const AmgSymMatrix(5)* smootherMeasuredCov = smootherComponent->first->covariance();
 
       if ( !smootherMeasuredCov && !forwardMeasuredCov ){
-        ATH_MSG_WARNING("Cannot combine two components both without associated errors... returning 0");
+        msg(MSG::WARNING) << "Cannot combine two components both without associated errors... returning 0" << endmsg;
         return 0;
       }
 
       if ( !forwardMeasuredCov ){
         if (m_outputlevel<=0) 
-          ATH_MSG_DEBUG("Forwards state without error matrix... using smoother state only");
+          msg(MSG::DEBUG) << "Forwards state without error matrix... using smoother state only" << endmsg;
         Trk::ComponentParameters smootherComponentOnly( smootherComponent->first->clone(), smootherComponent->second );
         combinedMultiState->push_back( smootherComponentOnly );
         continue;
@@ -493,7 +495,7 @@ const Trk::MultiComponentState* Trk::GsfSmoother::combine (const Trk::MultiCompo
 
       if ( !smootherMeasuredCov ){
         if (m_outputlevel<=0) 
-          ATH_MSG_DEBUG("Smoother state withour error matrix... using forwards state only");
+          msg(MSG::DEBUG) << "Smoother state withour error matrix... using forwards state only" << endmsg;
         Trk::ComponentParameters forwardComponentOnly( forwardsComponent->first->clone(), forwardsComponent->second );
         combinedMultiState->push_back( forwardComponentOnly );
         continue;
@@ -504,7 +506,7 @@ const Trk::MultiComponentState* Trk::GsfSmoother::combine (const Trk::MultiCompo
       const AmgSymMatrix(5) K = *forwardMeasuredCov * summedCovariance.inverse();
 
       //if (matrixInversionError) {
-      //  ATH_MSG_WARNING("Matrix inversion failed... Exiting!");
+      //  msg(MSG::WARNING) << "Matrix inversion failed... Exiting!" << endmsg;
       //  return 0;
       //}
 
@@ -525,7 +527,7 @@ const Trk::MultiComponentState* Trk::GsfSmoother::combine (const Trk::MultiCompo
       const AmgSymMatrix(5) invertedSummedCovariance = summedCovariance.inverse();
 
       //if ( matrixInversionError ){
-      //  ATH_MSG_WARNING("Matrix inversion failed... exiting");
+      //  msg(MSG::WARNING) << "Matrix inversion failed... exiting" << endmsg;
       //  return 0;
       //}
 
@@ -557,7 +559,7 @@ const Trk::MultiComponentState* Trk::GsfSmoother::combine (const Trk::MultiCompo
     delete mergedState;
 
   if (m_outputlevel<0) 
-    ATH_MSG_VERBOSE("Size of combined state from smoother: " << renormalisedMergedState->size());
+    msg(MSG::VERBOSE) << "Size of combined state from smoother: " << renormalisedMergedState->size() << endmsg;
 
   return renormalisedMergedState;
 
diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateCombiner.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateCombiner.cxx
index 192f128c3889711e2764de012eaf4995d8aff89a..e90dd96148c117d44da835a9a95b1a7f180b52a5 100755
--- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateCombiner.cxx
+++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateCombiner.cxx
@@ -47,7 +47,7 @@ StatusCode Trk::MultiComponentStateCombiner::initialize()
 
    // Request the mode calculator
   if ( m_modeCalculator.retrieve().isFailure() ){
-    ATH_MSG_FATAL( "Unable to retrieve the mode calculator... Exiting!" );
+    msg(MSG::FATAL) << "Unable to retrieve the mode calculator... Exiting!" << endmsg;
     return StatusCode::FAILURE;
   }
   
@@ -63,7 +63,7 @@ StatusCode Trk::MultiComponentStateCombiner::initialize()
     m_fractionPDFused = 1;   
   }
   
-  if (msgLvl(MSG::VERBOSE)) ATH_MSG_VERBOSE( "Initialisation of " << name() << " was successful" );
+  if (msgLvl(MSG::VERBOSE)) msg() << "Initialisation of " << name() << " was successful" << endmsg;
 
   return StatusCode::SUCCESS;
 
@@ -72,11 +72,11 @@ StatusCode Trk::MultiComponentStateCombiner::initialize()
 StatusCode Trk::MultiComponentStateCombiner::finalize()
 {
 
-  ATH_MSG_INFO("-----------------------------------------------");
-  ATH_MSG_INFO("         GSF MCS Combiner  Statistics          ");
-  ATH_MSG_INFO("-----------------------------------------------");
-  ATH_MSG_INFO("Number of Calls    " << m_NumberOfCalls          );
-  ATH_MSG_INFO("Finalisation of " << name() << " was successful" );
+  msg(MSG::INFO) << "-----------------------------------------------"<< endmsg;
+  msg(MSG::INFO) << "         GSF MCS Combiner  Statistics          "<< endmsg;
+  msg(MSG::INFO) << "-----------------------------------------------"<< endmsg;
+  msg(MSG::INFO) << "Number of Calls    " << m_NumberOfCalls          << endmsg;
+  msg(MSG::INFO) << "Finalisation of " << name() << " was successful" << endmsg;
   
   return StatusCode::SUCCESS;
 
@@ -103,7 +103,7 @@ const Trk::ComponentParameters* Trk::MultiComponentStateCombiner::compute( const
 {
   ++m_NumberOfCalls;
   if ( uncombinedState->empty() ){
-    ATH_MSG_WARNING( "Trying to collapse state with zero components" );
+    msg(MSG::WARNING) << "Trying to collapse state with zero components" << endmsg;
     return 0;
   }
 
@@ -227,7 +227,7 @@ const Trk::ComponentParameters* Trk::MultiComponentStateCombiner::compute( const
       modes = m_modeCalculator->calculateMode( *uncombinedState );
 
       if (  msgLvl(MSG::VERBOSE) && modes[4] )
-        ATH_MSG_VERBOSE( "Calculated mode q/p is: " << modes[4] );
+        msg(MSG::VERBOSE) << "Calculated mode q/p is: " << modes[4] << endmsg;
   
       //  Replace mean with mode if qOverP mode is not 0
       if (modes[4] != 0){
@@ -294,7 +294,7 @@ const Trk::ComponentParameters* Trk::MultiComponentStateCombiner::compute( const
       }
     } else {
 
-      if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG( " Dimension != 5 not updating q/p to mode q/p");
+      if (msgLvl(MSG::DEBUG)) msg() << " Dimension != 5 not updating q/p to mode q/p"<< endmsg;
 
     }
 
diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloCellMaker.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloCellMaker.cxx
index 7ce959e7e690c42a0a75a3a8fba53862b444388a..cfbe138d3bab6af34cdbc810070e6fff3bd0968e 100755
--- a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloCellMaker.cxx
+++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloCellMaker.cxx
@@ -196,7 +196,7 @@ HLT::ErrorCode TrigCaloCellMaker::hltInitialize()
 
  if ((m_data.retrieve()).isFailure()) {
      msg() << MSG::ERROR << "Could not get m_data" << endmsg;
-     return StatusCode::FAILURE;
+     return HLT::TOOL_FAILURE;
  }
  
  return HLT::OK;
diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMaker.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMaker.cxx
index 606b761a5584b506432fb1cda0b3f47503f7a1e0..72775eb2c48c5248d8f2eb1740f0cdec0f2853f0 100755
--- a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMaker.cxx
+++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigCaloClusterMaker.cxx
@@ -409,10 +409,8 @@ HLT::ErrorCode TrigCaloClusterMaker::hltExecute(const HLT::TriggerElement* input
 #endif
   
   // record and lock the Clusters Container with the new EDM helper... 
-  bool status = CaloClusterStoreHelper::finalizeClusters( store(), m_pCaloClusterContainer,
-                                                        clusterCollKey, msg());
-  
-  if ( !status ) {  
+  if ( !CaloClusterStoreHelper::finalizeClusters( store(), m_pCaloClusterContainer,
+                                                  clusterCollKey, msg() ).isSuccess() ) {
     msg() << MSG::ERROR << "recording CaloClusterContainer with key <" << clusterCollKey << "> failed" << endmsg;
     return HLT::TOOL_FAILURE;
   } else {
@@ -422,9 +420,8 @@ HLT::ErrorCode TrigCaloClusterMaker::hltExecute(const HLT::TriggerElement* input
   
   // Build the "uses" relation for the outputTE to the cell container
   std::string aliasKey = "";
-  status = reAttachFeature(outputTE, m_pCaloClusterContainer, aliasKey, persKey );
 
-  if (status != (bool)HLT::OK) {
+  if (reAttachFeature(outputTE, m_pCaloClusterContainer, aliasKey, persKey ) != HLT::OK) {
     msg() << MSG::ERROR
 	  << "Write of RoI Cluster Container into outputTE failed"
 	  << endmsg;
@@ -439,8 +436,7 @@ HLT::ErrorCode TrigCaloClusterMaker::hltExecute(const HLT::TriggerElement* input
     msg() << MSG::WARNING << "cannot get CaloClusterCellLinkContainer (not return FAILURE) " << endmsg;
   }
   else {
-    status = reAttachFeature(outputTE, pCaloCellLinkContainer, aliasKey, persKeyLink ); 
-    if (status != (bool)HLT::OK) {
+    if (reAttachFeature(outputTE, pCaloCellLinkContainer, aliasKey, persKeyLink ) != HLT::OK) {
       msg() << MSG::ERROR
 	    << "Write of RoI CellLink Container into outputTE failed"
 	    << endmsg;
diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigFullCaloClusterMaker.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigFullCaloClusterMaker.cxx
index b95d3ea9c2d76359a2bf352462e75199d775550f..bfc2429a3a7217de5f6b4774a2a98ec1aa736d1d 100755
--- a/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigFullCaloClusterMaker.cxx
+++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/TrigFullCaloClusterMaker.cxx
@@ -547,15 +547,16 @@ HLT::ErrorCode TrigFullCaloClusterMaker::hltExecute( std::vector<std::vector<HLT
     m_AllTECaloClusterContainer->setROIAuthor(m_clustersOutputName + "_" + strm.str());
 #endif
     
-    bool status = CaloClusterStoreHelper::finalizeClusters( store(), m_AllTECaloClusterContainer,
-    						       AllTEclusterCollKey, msg());
+    if ( !CaloClusterStoreHelper::finalizeClusters( store(), m_AllTECaloClusterContainer,
+                                                    AllTEclusterCollKey, msg() ).isSuccess() ) {
+      msg() << MSG::ERROR << "recording CaloClusterContainer with key <" << AllTEclusterCollKey << "> failed" << endmsg;
+      return HLT::TOOL_FAILURE;
+    }
 
     // Build the "uses" relation for the outputTE to the cell container
     std::string aliasKey = "";
-    status = reAttachFeature(AllTEoutputTE, m_AllTECaloClusterContainer, aliasKey, "TrigCaloClusterMaker");
-    
-    if (status != (bool)HLT::OK) {
-      msg() << MSG::ERROR
+    if ( reAttachFeature(AllTEoutputTE, m_AllTECaloClusterContainer, aliasKey, "TrigCaloClusterMaker") != HLT::OK ) {
+       msg() << MSG::ERROR
 	    << "Write of RoI Cluster Container into outputTE failed"
 	    << endmsg;
       return HLT::NAV_ERROR;
diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx
index b9ba44fc7e6122e946799c5c73fbea74d23c48ba..2f979eae628566b0daf5daa888c0ec983c78dec1 100644
--- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx
+++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx
@@ -373,7 +373,7 @@ HLT::ErrorCode TrigFastTrackFinder::hltInitialize() {
   
   if (detStore()->retrieve(m_sctId, "SCT_ID").isFailure()) { 
     ATH_MSG_ERROR("Could not get Pixel ID helper");
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   
diff --git a/Trigger/TrigAlgorithms/TrigGenericAlgs/src/TrigRoiUpdater.cxx b/Trigger/TrigAlgorithms/TrigGenericAlgs/src/TrigRoiUpdater.cxx
index bbbac4d8640e249011809758018901e661ae0ec4..45af898de357824d00766a908688c463bb9f56bf 100644
--- a/Trigger/TrigAlgorithms/TrigGenericAlgs/src/TrigRoiUpdater.cxx
+++ b/Trigger/TrigAlgorithms/TrigGenericAlgs/src/TrigRoiUpdater.cxx
@@ -68,7 +68,7 @@ namespace PESA
     } else {
       msg(MSG::ERROR) << "No connection to incidentSvc used for cleanup" 
                       << endmsg;
-      return StatusCode::FAILURE;
+      return HLT::BAD_JOB_SETUP;
     }
 
     return HLT::OK;
diff --git a/Trigger/TrigAlgorithms/TrigHIRec/src/TrigHIClusterMaker.cxx b/Trigger/TrigAlgorithms/TrigHIRec/src/TrigHIClusterMaker.cxx
index 04fbe93ea10c5168d28af897fe759fb4254a8fa8..cb39723ef1840fd4089e87a4a00e6e8ba8315af5 100644
--- a/Trigger/TrigAlgorithms/TrigHIRec/src/TrigHIClusterMaker.cxx
+++ b/Trigger/TrigAlgorithms/TrigHIRec/src/TrigHIClusterMaker.cxx
@@ -333,10 +333,10 @@ HLT::ErrorCode TrigHIClusterMaker::hltExecute(const HLT::TriggerElement* inputTE
   // Attaching the outputTE
   // ------------------------
 
-  bool status = CaloClusterStoreHelper::finalizeClusters( store(), cl_container,
-                                                        m_output_key, msg());
+  StatusCode status = CaloClusterStoreHelper::finalizeClusters( store(), cl_container,
+                                                                m_output_key, msg());
 
-  if ( !status ) {  
+  if ( status.isFailure() ) {
     msg() << MSG::ERROR << "recording CaloClusterContainer with key <" << m_output_key << "> failed" << endmsg;
     return HLT::ERROR;
   } else {
@@ -346,9 +346,7 @@ HLT::ErrorCode TrigHIClusterMaker::hltExecute(const HLT::TriggerElement* inputTE
 
   // Build the "uses" relation for the outputTE to the cell container
   std::string aliasKey = "HIClusters";
-  status = reAttachFeature(outputTE, cl_container, aliasKey, m_output_key );
-
-  if (status != (bool)HLT::OK) {
+  if ( reAttachFeature(outputTE, cl_container, aliasKey, m_output_key ) != HLT::OK ) {
     msg() << MSG::ERROR << "Write of Cluster Container into outputTE failed" << endmsg;
     return HLT::ERROR;
   } 
@@ -364,8 +362,7 @@ HLT::ErrorCode TrigHIClusterMaker::hltExecute(const HLT::TriggerElement* inputTE
     msg() << MSG::WARNING << "cannot get CaloClusterCellLinkContainer (not return FAILURE) " << endmsg;
   }
   else {
-    status = reAttachFeature(outputTE, pCaloCellLinkContainer, aliasKey, m_output_key+"_Link" );
-    if (status != (bool)HLT::OK) {
+    if ( reAttachFeature(outputTE, pCaloCellLinkContainer, aliasKey, m_output_key+"_Link" ) != HLT::OK ) {
       msg() << MSG::ERROR << "Write of RoI CellLink Container into outputTE failed" << endmsg;
     }
     else msg() << MSG::DEBUG << "Writing succesfully the CellLink Container with aliasKey" << aliasKey << endmsg;
diff --git a/Trigger/TrigAlgorithms/TrigHIRec/src/TrigHIEventShapeJetIteration.cxx b/Trigger/TrigAlgorithms/TrigHIRec/src/TrigHIEventShapeJetIteration.cxx
index d6b9f3747fece999588d638025edbbb8ea2633d1..cd6b92ae2a04dba3a8779f80b1c9046085d98deb 100644
--- a/Trigger/TrigAlgorithms/TrigHIRec/src/TrigHIEventShapeJetIteration.cxx
+++ b/Trigger/TrigAlgorithms/TrigHIRec/src/TrigHIEventShapeJetIteration.cxx
@@ -40,18 +40,18 @@ int TrigHIEventShapeJetIteration::execute() const
   const xAOD::HIEventShapeContainer* input_shape=0;
   ATH_MSG_DEBUG("In " << (name() ).c_str() << ": ");
   ATH_MSG_DEBUG("Retrieving event shape: " << m_input_event_shape_key.c_str() << " ... in TrigHIEventShapeJetIteration");
-  CHECK(evtStore()->retrieve(input_shape,m_input_event_shape_key));
+  CHECK(evtStore()->retrieve(input_shape,m_input_event_shape_key), 1);
 
   const xAOD::JetContainer* theJets=0;
   ATH_MSG_DEBUG("Retrieving seeds: " << m_seed_key.c_str() << " ... in TrigHIEventShapeJetIteration");
-  CHECK(evtStore()->retrieve(theJets,m_seed_key));
+  CHECK(evtStore()->retrieve(theJets,m_seed_key), 1);
 
 
    //shallow copy shares unaltered auxilliary data with the original container.
   ATH_MSG_DEBUG("Recording shallow copy of event shape: " << m_output_event_shape_key.c_str() << " ... in TrigHIEventShapeJetIteration");
   auto shape_copy=xAOD::shallowCopyContainer(*input_shape);
-  CHECK(evtStore()->record(shape_copy.first,m_output_event_shape_key));
-  CHECK(evtStore()->record(shape_copy.second,m_output_event_shape_key + "Aux."));  
+  CHECK(evtStore()->record(shape_copy.first,m_output_event_shape_key), 1);
+  CHECK(evtStore()->record(shape_copy.second,m_output_event_shape_key + "Aux."), 1);
   xAOD::HIEventShapeContainer* output_shape=shape_copy.first;
 
   std::string unaltered_input_event_shape_key = "TrigHIEventShape";
@@ -60,7 +60,7 @@ int TrigHIEventShapeJetIteration::execute() const
   if(es_index==nullptr)
   {
     ATH_MSG(ERROR) << "No HIEventShapeIndex w/ name " << m_input_event_shape_key << endmsg;
-    return StatusCode::FAILURE;
+    return 1;
   }
   if(!m_isInit)
   {
diff --git a/Trigger/TrigAlgorithms/TrigL2MissingET/src/T2CaloMissingET.cxx b/Trigger/TrigAlgorithms/TrigL2MissingET/src/T2CaloMissingET.cxx
index b8c0bafca3f6689c1f711d05bf829ea9b9e5dd39..bc7e2b6c5a92957e5c42b1d053d46105104e5e73 100755
--- a/Trigger/TrigAlgorithms/TrigL2MissingET/src/T2CaloMissingET.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MissingET/src/T2CaloMissingET.cxx
@@ -112,23 +112,23 @@ HLT::ErrorCode T2CaloMissingET::hltInitialize(){
 
   if(toolSvc()->retrieveTool("LArCablingService",m_cablingSvc).isFailure()) {
     *m_log << MSG::FATAL << "Could not get LArCablingService" << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   StoreGateSvc* detStore = 0;
   if (service( "DetectorStore", detStore ).isFailure()) {
     *m_log << MSG::FATAL << "Unable to locate DetectorStore" << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }	
 
   if (detStore->retrieve(m_LArOnlineID, "LArOnlineID").isFailure()) {
     *m_log << MSG::FATAL << "Could not get LArOnlineID helper!" << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   if (detStore->retrieve(m_CaloCell_ID, "CaloCell_ID").isFailure()) {
     *m_log << MSG::FATAL << "Could not get CaloCell_ID helper!" << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   return HLT::OK;
@@ -315,7 +315,7 @@ HLT::ErrorCode T2CaloMissingET::hltExecute(std::vector<std::vector<HLT::TriggerE
         if (ichannel>127) {
           (*m_log) << MSG::ERROR 
 		   << "not connected channel found for this FEB: " << (*feb_it)->getFebId() << endmsg;
-          return StatusCode::RECOVERABLE;
+          return HLT::ERROR;
         }
       } while(!offChId.is_valid());
 
@@ -342,7 +342,7 @@ HLT::ErrorCode T2CaloMissingET::hltExecute(std::vector<std::vector<HLT::TriggerE
 	break;
       default:
 	(*m_log) << MSG::FATAL << "Unknown subdetector!" << endmsg;
-	return StatusCode::FAILURE;
+	return HLT::ERROR;
       }
 
       // check that the sample value is sensible
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcRoadDefiner.h b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcRoadDefiner.h
index b57b76121dab55451e730d4db23423732058c086..b2b642b2907c23845b3830ad56a704d3d09254bf 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcRoadDefiner.h
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/TrigL2MuonSA/TgcRoadDefiner.h
@@ -46,10 +46,10 @@ class TgcRoadDefiner: public AthAlgTool
   virtual StatusCode initialize();
   virtual StatusCode finalize  ();
 
-  bool defineRoad(const LVL1::RecMuonRoI*      p_roi,
-		  const TrigL2MuonSA::TgcHits& tgcHits,
-		  TrigL2MuonSA::MuonRoad&      muonRoad,
-		  TrigL2MuonSA::TgcFitResult&  tgcFitResult);
+  StatusCode defineRoad(const LVL1::RecMuonRoI*      p_roi,
+                        const TrigL2MuonSA::TgcHits& tgcHits,
+                        TrigL2MuonSA::MuonRoad&      muonRoad,
+                        TrigL2MuonSA::TgcFitResult&  tgcFitResult);
 
   void setMdtGeometry(IRegSelSvc* regionSelector, const MdtIdHelper* mdtIdHelper);
   void setPtLUT(const TrigL2MuonSA::PtEndcapLUTSvc* ptEndcapLUTSvc);
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.cxx
index e25af425c5751da5fd67f9e29347e35391cbacf6..d856b24caef76871dd69fc2574617e267b1e1551 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/MdtRegionDefiner.cxx
@@ -695,7 +695,7 @@ StatusCode TrigL2MuonSA::MdtRegionDefiner::computePhi(const LVL1::RecMuonRoI* p_
       }
     }
   }
-  return true;
+  return StatusCode::SUCCESS;
 }
 
 // --------------------------------------------------------------------------------
@@ -766,7 +766,7 @@ StatusCode TrigL2MuonSA::MdtRegionDefiner::computePhi(const LVL1::RecMuonRoI* p_
       }
     }
   }
-  return true;
+  return StatusCode::SUCCESS;
 }  
 
 // --------------------------------------------------------------------------------
diff --git a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.cxx b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.cxx
index efaec3d6553a47f1e17e5dfd39e669672ffeb938..62d697544a06582fa091a92ccf81f8006fe0ac99 100644
--- a/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2MuonSA/src/TgcRoadDefiner.cxx
@@ -108,10 +108,10 @@ void TrigL2MuonSA::TgcRoadDefiner::setPtLUT(const TrigL2MuonSA::PtEndcapLUTSvc*
 // --------------------------------------------------------------------------------
 // --------------------------------------------------------------------------------
 
-bool TrigL2MuonSA::TgcRoadDefiner::defineRoad(const LVL1::RecMuonRoI*      p_roi,
-                                              const TrigL2MuonSA::TgcHits& tgcHits,
-                                              TrigL2MuonSA::MuonRoad&      muonRoad,
-                                              TrigL2MuonSA::TgcFitResult&  tgcFitResult)
+StatusCode TrigL2MuonSA::TgcRoadDefiner::defineRoad(const LVL1::RecMuonRoI*      p_roi,
+                                                    const TrigL2MuonSA::TgcHits& tgcHits,
+                                                    TrigL2MuonSA::MuonRoad&      muonRoad,
+                                                    TrigL2MuonSA::TgcFitResult&  tgcFitResult)
 {
   const int N_STATION = 10;
 
@@ -143,7 +143,7 @@ bool TrigL2MuonSA::TgcRoadDefiner::defineRoad(const LVL1::RecMuonRoI*      p_roi
     // Split digits to Strip/Wire points.
     if( ! prepareTgcPoints(tgcHits) ) {
       ATH_MSG_ERROR("Preparation of Tgc points failed");
-      return false;
+      return StatusCode::FAILURE;
     }
     
 
@@ -433,7 +433,7 @@ bool TrigL2MuonSA::TgcRoadDefiner::defineRoad(const LVL1::RecMuonRoI*      p_roi
   muonRoad.MDT_sector_overlap = sector_overlap;
   
   //
-  return true;
+  return StatusCode::SUCCESS;
 }
 
 // --------------------------------------------------------------------------------
diff --git a/Trigger/TrigAlgorithms/TrigL2TRTSegFinder/src/TrigTRTSegFinder.cxx b/Trigger/TrigAlgorithms/TrigL2TRTSegFinder/src/TrigTRTSegFinder.cxx
index 0ca95bd694d0efdee3451eb35f922d2ba7bb714d..8fa3a984a939251533ced51f7894f2d8ad2ef0a9 100755
--- a/Trigger/TrigAlgorithms/TrigL2TRTSegFinder/src/TrigTRTSegFinder.cxx
+++ b/Trigger/TrigAlgorithms/TrigL2TRTSegFinder/src/TrigTRTSegFinder.cxx
@@ -123,7 +123,7 @@ HLT::ErrorCode TrigTRTSegFinder::hltInitialize()
   
   if (m_magFieldSvc.retrieve().isFailure()) {
         msg(MSG::FATAL) << "Could not retrieve Tool " << m_magFieldSvc << ". Exiting."<<endmsg;
-        return StatusCode::FAILURE;
+        return HLT::BAD_JOB_SETUP;
   }
   // Build MagneticFieldProperties 
   m_magFieldProperties = new Trk::MagneticFieldProperties();
diff --git a/Trigger/TrigAlgorithms/TrigMuSuperEF/src/TrigMuSuperEF.cxx b/Trigger/TrigAlgorithms/TrigMuSuperEF/src/TrigMuSuperEF.cxx
index 8d0e1273993d3091dbc121f517965d040231014d..847ab65ff63c82d849ed86a9b501e0df26c5c816 100644
--- a/Trigger/TrigAlgorithms/TrigMuSuperEF/src/TrigMuSuperEF.cxx
+++ b/Trigger/TrigAlgorithms/TrigMuSuperEF/src/TrigMuSuperEF.cxx
@@ -342,7 +342,7 @@ TrigMuSuperEF::hltInitialize()
       msg() << MSG::INFO << "Retrieved " << m_muonCombinedTool << endmsg;
     }else{
       msg() << MSG::FATAL << "Could not get " << m_muonCombinedTool << endmsg;
-      return StatusCode::FAILURE;
+      return HLT::BAD_JOB_SETUP;
     }
     if (doTiming()) setCombinedTimers(this, m_TMEF_CBTimers);
   }
@@ -353,7 +353,7 @@ TrigMuSuperEF::hltInitialize()
   }
   else{
     msg() << MSG::FATAL << "Could not get " << m_TrackToTrackParticleConvTool << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
   
   // retrieve the tool for making xAOD muons
@@ -362,7 +362,7 @@ TrigMuSuperEF::hltInitialize()
   }
   else {
     msg() << MSG::FATAL << "Could not get " << m_muonCreatorTool << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
   
   if(m_doInsideOut ){
@@ -371,7 +371,7 @@ TrigMuSuperEF::hltInitialize()
     }
     else {
       msg() << MSG::FATAL << "Could not get " << m_stauCreatorTool << endmsg;
-      return StatusCode::FAILURE;
+      return HLT::BAD_JOB_SETUP;
     }
   }
   
diff --git a/Trigger/TrigAlgorithms/TrigT2CaloJet/src/T2AllRoiUnpacking.cxx b/Trigger/TrigAlgorithms/TrigT2CaloJet/src/T2AllRoiUnpacking.cxx
index a0478d3625d2e87d0aa03ecd7030e97a6b6f7acf..6b9f64dc7aec86b9ab6db027459018e7d5e71ae4 100644
--- a/Trigger/TrigAlgorithms/TrigT2CaloJet/src/T2AllRoiUnpacking.cxx
+++ b/Trigger/TrigAlgorithms/TrigT2CaloJet/src/T2AllRoiUnpacking.cxx
@@ -228,10 +228,10 @@ HLT::ErrorCode T2AllRoiUnpacking::processTriggerElement(const HLT::TriggerElemen
     if(logStream.level() <= MSG::DEBUG)
       logStream<<MSG::DEBUG
 	       <<" Failure of addCells. Empty grid, or some missing cells! "<<endmsg;
-    return StatusCode::FAILURE;
+    return HLT::ERROR;
   } // end if(isFailure)
   m_processedRegions.push_back(l2Roi);
-  return StatusCode::SUCCESS;
+  return HLT::OK;
 }
 //----------------------------------------------------------
 bool T2AllRoiUnpacking::initializeTimers(){
diff --git a/Trigger/TrigAlgorithms/TrigT2MinBias/src/T2MbtsFex.cxx b/Trigger/TrigAlgorithms/TrigT2MinBias/src/T2MbtsFex.cxx
index 32acd2cd89bfc26dea58a46c0d3f9352a7d40d72..89eb247a271b89f3d816bf79127cec285323e9ca 100644
--- a/Trigger/TrigAlgorithms/TrigT2MinBias/src/T2MbtsFex.cxx
+++ b/Trigger/TrigAlgorithms/TrigT2MinBias/src/T2MbtsFex.cxx
@@ -135,7 +135,7 @@ HLT::ErrorCode T2MbtsFex::hltExecute(std::vector<std::vector<HLT::TriggerElement
   
   if(m_data->LoadMBTS(m_itBegin,m_itEnd).isFailure()){
     m_error|=m_data->report_error();
-    return StatusCode::FAILURE;
+    return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::BAD_JOB_SETUP);
   }
   
   if(m_itBegin == m_itEnd) {
@@ -281,20 +281,20 @@ HLT::ErrorCode T2MbtsFex::hltInitialize() {
 
   if(m_data.retrieve().isFailure()) {
     ATH_MSG_ERROR("Could not get m_data");
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
   
   // Connect to the Detector Store to retrieve TileTBID.
   if(m_detStore.retrieve().isFailure()) {
     ATH_MSG_ERROR("Couldn't connect to " << m_detStore.typeAndName());
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
  
   // Retrieve TileTBID helper from det store
   // (The MBTS was added to the Test Beam (TB) list.)
   if(m_detStore->retrieve(m_tileTBID).isFailure()) {
     ATH_MSG_ERROR("Unable to retrieve TileTBID helper from DetectorStore");
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   // Create timers
diff --git a/Trigger/TrigAlgorithms/TrigT2MinBias/src/T2ZdcFex.cxx b/Trigger/TrigAlgorithms/TrigT2MinBias/src/T2ZdcFex.cxx
index 30eaae3738bd1bd1b0d2febe25870bee63e823e9..3ff95278ba828c7e6c2f92897b137ed5d6a7a4a1 100644
--- a/Trigger/TrigAlgorithms/TrigT2MinBias/src/T2ZdcFex.cxx
+++ b/Trigger/TrigAlgorithms/TrigT2MinBias/src/T2ZdcFex.cxx
@@ -75,7 +75,8 @@ HLT::ErrorCode T2ZdcFex::hltExecute(std::vector<std::vector<HLT::TriggerElement*
   m_zBegin=m_zEnd;
   
   if( m_data->LoadZdcCollection(m_zBegin,m_zEnd).isFailure() ){
-    return StatusCode::FAILURE;
+    return HLT::ErrorCode(HLT::Action::ABORT_CHAIN, HLT::Reason::BAD_JOB_SETUP);
+    //    return StatusCode::FAILURE;
   }
   
   if(timerSvc()){
@@ -177,20 +178,20 @@ HLT::ErrorCode T2ZdcFex::hltInitialize() {
   
   if(m_data.retrieve().isFailure()) {
     ATH_MSG_ERROR("Could not get m_data");
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   StoreGateSvc* detStore(0);
   if ( service("DetectorStore",detStore).isFailure() ) {
     ATH_MSG_ERROR("Could not get detStore");
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
   
   const ZdcID* zdcID = 0;
   if ( detStore->retrieve( zdcID ).isFailure() )  {
     //if ( detSvc()->retrieve( zdcID ).isFailure() )  {
     ATH_MSG_ERROR("Could not get ZdcIDs");
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
   
   m_zdcID = zdcID;
diff --git a/Trigger/TrigAlgorithms/TrigT2MinBias/src/TrigCountSpacePoints.cxx b/Trigger/TrigAlgorithms/TrigT2MinBias/src/TrigCountSpacePoints.cxx
index eb5f47ff780e1071d8af4bd601d82ab1a3919fef..f2d727158eb65ebf7e459928c150496c70cc8562 100644
--- a/Trigger/TrigAlgorithms/TrigT2MinBias/src/TrigCountSpacePoints.cxx
+++ b/Trigger/TrigAlgorithms/TrigT2MinBias/src/TrigCountSpacePoints.cxx
@@ -180,7 +180,8 @@ HLT::ErrorCode TrigCountSpacePoints::hltInitialize() {
   // get detector store
   if(m_detStore.retrieve().isFailure()) {
     ATH_MSG_FATAL("Failed to connect to " << m_detStore.typeAndName());
-    return StatusCode::FAILURE;
+    return HLT::ErrorCode(HLT::Action::ABORT_JOB, HLT::Reason::BAD_JOB_SETUP);
+    //    return StatusCode::FAILURE;
   } 
   else {
     ATH_MSG_INFO("Successfully initialised DetectorStore !");
@@ -191,7 +192,8 @@ HLT::ErrorCode TrigCountSpacePoints::hltInitialize() {
     StatusCode sc_pixH = m_detStore->retrieve(m_pixHelper, "PixelID");
     if( sc_pixH.isFailure() ){
       ATH_MSG_WARNING("Could not obtain pix helper!");
-      return StatusCode::FAILURE;
+      return HLT::ErrorCode(HLT::Action::ABORT_JOB, HLT::Reason::BAD_JOB_SETUP);
+      //return StatusCode::FAILURE;
     }
   }
 
@@ -200,7 +202,8 @@ HLT::ErrorCode TrigCountSpacePoints::hltInitialize() {
     StatusCode sc_sctH = m_detStore->retrieve(m_sctHelper, "SCT_ID");
     if( sc_sctH.isFailure() ){
       ATH_MSG_WARNING("Could not obtain sct helper!");
-      return StatusCode::FAILURE;
+      return HLT::ErrorCode(HLT::Action::ABORT_JOB, HLT::Reason::BAD_JOB_SETUP);
+      //return StatusCode::FAILURE;
     }
   }
   
diff --git a/Trigger/TrigAlgorithms/TrigT2MinBias/src/TrigCountTrtHits.cxx b/Trigger/TrigAlgorithms/TrigT2MinBias/src/TrigCountTrtHits.cxx
index abc630817b80e00da68a8cb9374ec08f30603a23..3ce241d8e3b6463a97a76d4829b2b5ad24832c9f 100644
--- a/Trigger/TrigAlgorithms/TrigT2MinBias/src/TrigCountTrtHits.cxx
+++ b/Trigger/TrigAlgorithms/TrigT2MinBias/src/TrigCountTrtHits.cxx
@@ -72,13 +72,13 @@ HLT::ErrorCode TrigCountTrtHits::hltInitialize() {
   // Get storegate svc
   if(m_detStore.retrieve().isFailure()) {
     ATH_MSG_FATAL("Failed to connect to " << m_detStore.typeAndName());
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   } else
     ATH_MSG_INFO("Retrieved service " << m_detStore.typeAndName());
 
   if(m_storeGate.retrieve().isFailure()) {
     ATH_MSG_FATAL("Failed to connect to " << m_storeGate.typeAndName());
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   } else
     ATH_MSG_INFO("Retrieved service " << m_storeGate.typeAndName());
 
@@ -86,14 +86,14 @@ HLT::ErrorCode TrigCountTrtHits::hltInitialize() {
   sc = m_detStore->retrieve(m_trtHelper, "TRT_ID");
   if(sc.isFailure()) {
     ATH_MSG_ERROR("Failed to retrieve " << m_trtHelper); // fatal?
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   } else
     ATH_MSG_INFO("Retrieved service " << m_trtHelper);
   
   // Get TrigTRT_DriftCircleProviderTool
   if( m_rawDataTool.retrieve().isFailure() ){
     ATH_MSG_FATAL("Failed to retrieve " << m_rawDataTool);
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   } else
     ATH_MSG_INFO("Retrieved service " << m_rawDataTool);
   
diff --git a/Trigger/TrigAlgorithms/TrigT2Tau/src/T2TauEnergyTool.cxx b/Trigger/TrigAlgorithms/TrigT2Tau/src/T2TauEnergyTool.cxx
index f913a09722ed7e419051a199ede07393820ff81f..462c641b613833084eb1766f0f6439fe70c87ad0 100755
--- a/Trigger/TrigAlgorithms/TrigT2Tau/src/T2TauEnergyTool.cxx
+++ b/Trigger/TrigAlgorithms/TrigT2Tau/src/T2TauEnergyTool.cxx
@@ -46,6 +46,6 @@ StatusCode T2TauEnergyTool::execute(const TrigTauCluster *pTrigTauCluster,
     pTrigTau.setEtCalibCluster(0);
   
   
-  return true;
+  return StatusCode::SUCCESS;
 }
 
diff --git a/Trigger/TrigAlgorithms/TrigT2Tau/src/T2TauEtFlowTool.cxx b/Trigger/TrigAlgorithms/TrigT2Tau/src/T2TauEtFlowTool.cxx
index ad9fb0506949fdabfa6e45be89f59b4d32a14383..15e4afe63b6d56a07fb0098cc624d2fc9100f617 100644
--- a/Trigger/TrigAlgorithms/TrigT2Tau/src/T2TauEtFlowTool.cxx
+++ b/Trigger/TrigAlgorithms/TrigT2Tau/src/T2TauEtFlowTool.cxx
@@ -98,6 +98,6 @@ StatusCode T2TauEtFlowTool::execute(const TrigTauCluster *pTrigTauCluster,
     ATH_MSG_WARNING( " No track neither cluster information is present" );
     
 
-  return true;
+  return StatusCode::SUCCESS;
 }
 
diff --git a/Trigger/TrigAlgorithms/TrigTRTHighTHitCounter/src/TrigTRTHTHCounter.cxx b/Trigger/TrigAlgorithms/TrigTRTHighTHitCounter/src/TrigTRTHTHCounter.cxx
index d9df1606068905daa7b997bb994829f3e82c7f1b..400ddc331e0123dcc72a6e0008a69678c7b4880b 100644
--- a/Trigger/TrigAlgorithms/TrigTRTHighTHitCounter/src/TrigTRTHTHCounter.cxx
+++ b/Trigger/TrigAlgorithms/TrigTRTHighTHitCounter/src/TrigTRTHTHCounter.cxx
@@ -91,20 +91,20 @@ HLT::ErrorCode TrigTRTHTHCounter::hltInitialize() {
   // Get storegate svc
   if(m_detStore.retrieve().isFailure()) {
     ATH_MSG_FATAL ( "Failed to connect to " << m_detStore.typeAndName());
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   } else
     ATH_MSG_INFO ( "Retrieved service " << m_detStore.typeAndName());
   
   if(m_storeGate.retrieve().isFailure()) {
     ATH_MSG_FATAL ( "Failed to connect to " << m_storeGate.typeAndName());
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   } else
     ATH_MSG_INFO ( "Retrieved service " << m_storeGate.typeAndName());
 
   // Get a TRT identifier helper
   if( m_detStore->retrieve(m_trtHelper, "TRT_ID").isFailure()) {
     ATH_MSG_ERROR ( "Failed to retrieve " << m_trtHelper); // fatal?
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   } else
     ATH_MSG_INFO ( "Retrieved service " << m_trtHelper);
 
diff --git a/Trigger/TrigAlgorithms/TrigTileMuId/src/TrigTileLookForMuAlg.cxx b/Trigger/TrigAlgorithms/TrigTileMuId/src/TrigTileLookForMuAlg.cxx
index 4af014e853c7a62f4f8375e692b02950df901e68..636d0fcc742c0292303b9f466d53b6d772b8e153 100755
--- a/Trigger/TrigAlgorithms/TrigTileMuId/src/TrigTileLookForMuAlg.cxx
+++ b/Trigger/TrigAlgorithms/TrigTileMuId/src/TrigTileLookForMuAlg.cxx
@@ -293,7 +293,7 @@ HLT::ErrorCode TrigTileLookForMuAlg::hltExecute(std::vector<std::vector<HLT::Tri
       if ( 0xF0000000 & m_error ) m_algorithmError++;
       if( m_error ) {
         ATH_MSG_DEBUG("Monitoring error found");
-	return StatusCode::SUCCESS;
+        return HLT::ERROR;
       }
 
       // Iterate over all cells
diff --git a/Trigger/TrigAlgorithms/TrigTileMuId/src/TrigTileMuFex.cxx b/Trigger/TrigAlgorithms/TrigTileMuId/src/TrigTileMuFex.cxx
index 4580a3e6cff6a259060212a6eb2c8670ef9404c3..e3cc29cac3d2f6623262ebe31e7ca6d955f9bb49 100644
--- a/Trigger/TrigAlgorithms/TrigTileMuId/src/TrigTileMuFex.cxx
+++ b/Trigger/TrigAlgorithms/TrigTileMuId/src/TrigTileMuFex.cxx
@@ -233,9 +233,9 @@ HLT::ErrorCode TrigTileMuFex::hltExecute(const HLT::TriggerElement* /*inputTE*/,
     //std::string       key = "GEN_EVENT";
     std::string   key = m_key_for_truth;
     
-    StatusCode cont = evtStore()->contains<McEventCollection>(key);
+    bool cont = evtStore()->contains<McEventCollection>(key);
     StatusCode retr = evtStore()->retrieve(mcCollptr,key);
-    if( cont.isSuccess() && retr.isSuccess() ) {
+    if( cont && retr.isSuccess() ) {
       McEventCollection::const_iterator itr;
       for(itr = mcCollptr->begin(); itr!=mcCollptr->end(); ++itr) {
         HepMC::GenEvent::particle_const_iterator Part;
diff --git a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaNavNtuple.cxx b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaNavNtuple.cxx
index b8bdf691fcdf4cce3bd8c3ef34a7de485dddacb7..001ab83e4c404074dd9e53ccde2d52332edbef67 100755
--- a/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaNavNtuple.cxx
+++ b/Trigger/TrigAnalysis/TrigEgammaAnalysisTools/Root/TrigEgammaNavNtuple.cxx
@@ -242,7 +242,7 @@ bool TrigEgammaNavNtuple::executeTrigItemDump(){
     const TrigInfo info = getTrigInfo(trigItem);
     if ( executeNavigation(info).isFailure() ){
       ATH_MSG_DEBUG("executeNavigation failure! continue...");
-      return StatusCode::FAILURE;
+      return false;
     }
 
     TTree *t = tree( "trigger", m_dir+"/Expert/"+trigItem);
diff --git a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/Root/TrigEgammaMatchingTool.cxx b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/Root/TrigEgammaMatchingTool.cxx
index 9c1bcb519b940b837a0eb75cd464ea144f34a364..6c3095a13efb545c27d4c9ba79f9aa9b0329ae31 100644
--- a/Trigger/TrigAnalysis/TrigEgammaMatchingTool/Root/TrigEgammaMatchingTool.cxx
+++ b/Trigger/TrigAnalysis/TrigEgammaMatchingTool/Root/TrigEgammaMatchingTool.cxx
@@ -152,11 +152,15 @@ namespace Trig {
             }
         }
         else if(xAOD::EgammaHelpers::isPhoton(eg)){
+	    std::string key = "egamma_Photons";
+	    if(boost::contains(trigger,"icaloloose") || boost::contains(trigger,"icalovloose") || boost::contains(trigger,"icalotight")) key = "egamma_Iso_Photons";
+	    //key="";
+
             const xAOD::Photon* phOff =static_cast<const xAOD::Photon*> (eg);
 #ifdef XAOD_ANALYSIS
-            const auto vec = fc.containerFeature<xAOD::PhotonContainer>("egamma_Photons");
+            const auto vec = fc.containerFeature<xAOD::PhotonContainer>(key);
 #else
-            const auto vec = fc.get<xAOD::PhotonContainer>("egamma_Photons");
+            const auto vec = fc.get<xAOD::PhotonContainer>(key);
 #endif // XAOD_ANALYSIS
             for(const auto feat : vec){
                 const xAOD::PhotonContainer *cont = feat.cptr();
@@ -184,11 +188,15 @@ namespace Trig {
         ATH_MSG_DEBUG("Match HLT Photon");
         // Get the container of online electrons associated to passed items
         auto fc = (m_trigDecTool->features(trigger,TrigDefs::alsoDeactivateTEs));
+	std::string key = "egamma_Photons";
+	if(boost::contains(trigger,"iloose") || boost::contains(trigger,"ivloose") || boost::contains(trigger,"itight")) key = "egamma_Iso_Photons";
+	key="";
+
 
 #ifdef XAOD_ANALYSIS
-        const auto vec = fc.containerFeature<xAOD::PhotonContainer>("",TrigDefs::alsoDeactivateTEs);
+        const auto vec = fc.containerFeature<xAOD::PhotonContainer>(key,TrigDefs::alsoDeactivateTEs);
 #else
-        const auto vec = fc.get<xAOD::PhotonContainer>("",TrigDefs::alsoDeactivateTEs);
+        const auto vec = fc.get<xAOD::PhotonContainer>(key,TrigDefs::alsoDeactivateTEs);
 #endif // XAOD_ANALYSIS
         ATH_MSG_DEBUG("EF FC Size " << vec.size());
         double deltaR=0.; 
diff --git a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauEmulation/Root/Level1EmulationTool.cxx b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauEmulation/Root/Level1EmulationTool.cxx
index 56ae7a0cb7cc4f29122a9e5eae79f80b539356ad..c97cecbe13fb1027c257542fe04206787edbd5d4 100644
--- a/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauEmulation/Root/Level1EmulationTool.cxx
+++ b/Trigger/TrigAnalysis/TrigTauAnalysis/TrigTauEmulation/Root/Level1EmulationTool.cxx
@@ -398,7 +398,7 @@ namespace TrigTauEmul {
     }
 
     MY_MSG_DEBUG("executing " << chain_name);
-    ATH_CHECK(m_name_parser->execute(chain_name));
+    ATH_CHECK(m_name_parser->execute(chain_name), false);
     for (auto it: m_name_parser->get_items()) {
       MY_MSG_DEBUG(it.first << " " << m_counters[it.first] << " " << it.second);
       if (m_counters[it.first] < it.second) {
diff --git a/Trigger/TrigCost/EnhancedBiasWeighter/Root/EnhancedBiasWeighter.cxx b/Trigger/TrigCost/EnhancedBiasWeighter/Root/EnhancedBiasWeighter.cxx
index c5ebec3bfa894a1eeb37bd86db9452697250a9e0..051b55aec6f0aa8f82e503752a6debea92c06594 100644
--- a/Trigger/TrigCost/EnhancedBiasWeighter/Root/EnhancedBiasWeighter.cxx
+++ b/Trigger/TrigCost/EnhancedBiasWeighter/Root/EnhancedBiasWeighter.cxx
@@ -393,7 +393,7 @@ double EnhancedBiasWeighter::getEBWeight(const xAOD::EventInfo* eventInfo) const
     return 0;
   }
 
-  ATH_CHECK( trackAverages(eventInfo) );
+  ATH_CHECK( trackAverages(eventInfo), 0 );
 
   if (m_calculateWeightingData) {
 
diff --git a/Trigger/TrigEvent/TrigNavigation/share/Holder_test.ref b/Trigger/TrigEvent/TrigNavigation/share/Holder_test.ref
index e42bbfdba7173ae2b2e5fe2af450c2d4702bff55..6b997f27a7ac740c2d0b4d24c1f355f55b6c983d 100644
--- a/Trigger/TrigEvent/TrigNavigation/share/Holder_test.ref
+++ b/Trigger/TrigEvent/TrigNavigation/share/Holder_test.ref
@@ -20,15 +20,13 @@ JobOptionsSvc        INFO # (36,1): RoICache_test.OutputLevel = 3
 JobOptionsSvc        INFO Job options successfully read in from ../share/test.txt
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v29r0)
-                                          running on lxplus091.cern.ch on Fri Oct 27 20:39:57 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
+                                          running on lxplus020.cern.ch on Sat Dec  9 18:36:39 2017
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : StoreGate, TrigNavigation, TrigSerializeCnvSvc
 ApplicationMgr       INFO Application Manager Configured successfully
-ClassIDSvc           INFO  getRegistryEntries: read 1527 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1529 CLIDRegistry entries for module ALL
 TrigSerializeCn...   INFO initialize()
-StoreGateSvc_Impl VERBOSE Initializing StoreGateSvc_Impl - package version StoreGate-00-00-00
-StoreGateSvc_Impl   DEBUG Service base class initialized successfully
 StoreGateSvc_Impl VERBOSE ServiceLocatorHelper::service: found service EventPersistencySvc
 StoreGateSvc_Impl VERBOSE ServiceLocatorHelper::service: found service ClassIDSvc
 EventLoopMgr      WARNING Unable to locate service "EventSelector" 
@@ -39,86 +37,33 @@ ApplicationMgr Ready
 Holder_test          INFO LINE:69 Start of the test: Creation of the holders Container <-> Container
 Holder_test          INFO LINE:44 Start of the test: Registration
 ClassIDSvc           INFO  getRegistryEntries: read 372 CLIDRegistry entries for module ALL
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d29460 with key _TrigNavTest__TestBContainer_creation0Aux. of type TrigNavTest::TestAuxB(CLID 642311)
- in DataObject @0x2d2bef0
- object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d29350 with key _TrigNavTest__TestBContainer_creation0 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2d438d0
- object modifiable when retrieved
 Holder_test          INFO LINE:55 End of the test: Registration
 Holder_test          INFO LINE:74 Test progress fine:  Creation of the holders Object <-> Container
 Holder_test          INFO LINE:44 Start of the test: Registration
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d30fb0 with key _DataVector<TestA>_creation1Aux. of type TestAuxA(CLID 642300)
- in DataObject @0x2d41e70
- object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d48a90 with key _DataVector<TestA>_creation1 of type DataVector<TestA>(CLID 64210)
- in DataObject @0x2d47b60
- object modifiable when retrieved
 Holder_test          INFO LINE:55 End of the test: Registration
 Holder_test          INFO LINE:80 Test progress fine:  Creation of the holders Container <-> Container with details
 Holder_test          INFO LINE:44 Start of the test: Registration
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d318d0 with key _TrigNavTest__TestBContainer_creation2Aux. of type TrigNavTest::TestAuxB(CLID 642311)
- in DataObject @0x2c74610
- object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d3f580 with key _TrigNavTest__TestBContainer_creation2 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2cad030
- object modifiable when retrieved
 Holder_test          INFO LINE:55 End of the test: Registration
 Holder_test          INFO LINE:86 Test progress fine:  Creation of the holders Object <-> Container
 Holder_test          INFO LINE:44 Start of the test: Registration
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d32720 with key _DataVector<TestA>_creation3Aux. of type TestAuxA(CLID 642300)
- in DataObject @0x2d328a0
- object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d40f60 with key _DataVector<TestA>_creation3 of type DataVector<TestA>(CLID 64210)
- in DataObject @0x2d46e30
- object modifiable when retrieved
 Holder_test          INFO LINE:55 End of the test: Registration
 Holder_test          INFO LINE:44 Start of the test: Registration
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d33950 with key _TrigNavTest__TestBContainerView_creation4 of type TrigNavTest::TestBContainerView(CLID 96423)
- in DataObject @0x2d33aa0
- object modifiable when retrieved
 Holder_test          INFO LINE:55 End of the test: Registration
 Holder_test          INFO LINE:96 End of the test: Creation of the holders Container <-> Container
-StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=0
 Holder_test          INFO LINE:101 Start of the test: Simple test of Container <-> Container holder (add)
 Holder_test          INFO LINE:44 Start of the test: Registration
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d42250 with key _TrigNavTest__TestBContainer_TestBAux. of type TrigNavTest::TestAuxB(CLID 642311)
- in DataObject @0x2c74610
- object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d44320 with key _TrigNavTest__TestBContainer_TestB of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2d46cd0
- object modifiable when retrieved
 Holder_test          INFO LINE:55 End of the test: Registration
 Holder_test          INFO LINE:111 Test progress fine:  adding simple vec
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d45cc0 with key HLTAutoKey_TestB_96422_11_to_0 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2d33aa0
- object modifiable when retrieved
 Holder_test          INFO LINE:119 Test progress fine:  Added another ownership
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d476a0 with key dav1 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2d45320
- object modifiable when retrieved
 Holder_test          INFO LINE:127 Test progress fine:  Added another ownership -with the hint
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d48a90 with key dav2 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2d44060
- object modifiable when retrieved
 Holder_test          INFO LINE:131 Test progress fine:  Adding a VIEW container
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d435c0 with key HLTAutoKey_TestB_96422_11_to_1 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2d42680
- object modifiable when retrieved
 Holder_test       WARNING insert::do_it objects can not be inserted because of ownership issues. Destination container has already 5 objects  and ownership policy OWN no action is performed, potential memory leak
 Holder_test       WARNING HolderImp::add  insert failed 
 Holder_test          INFO LINE:159 Test progress fine:  END Simple test of Container <-> Container holder -add-
 Holder_test          INFO LINE:162 Test progress fine:  END Simple test of Object <-> Container holder -add-
 Holder_test          INFO LINE:44 Start of the test: Registration
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d3d9c0 with key _DataVector<TestA>_TestAAux. of type TestAuxA(CLID 642300)
- in DataObject @0x2d3fa40
- object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d41be0 with key _DataVector<TestA>_TestA of type DataVector<TestA>(CLID 64210)
- in DataObject @0x2d47b60
- object modifiable when retrieved
 Holder_test          INFO LINE:55 End of the test: Registration
 Holder_test          INFO LINE:177 End of the test: Simple test of Container <-> Container holder (add)
-StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=0
  deleting TestB: 6
  deleting TestB: 1
  deleting TestB: 2
@@ -127,43 +72,18 @@ StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=0
  deleting TestA: 235
 Holder_test          INFO LINE:101 Start of the test: Simple test of Container <-> Container holder (add)
 Holder_test          INFO LINE:44 Start of the test: Registration
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d42250 with key _TrigNavTest__TestBContainer_TestBAux. of type TrigNavTest::TestAuxB(CLID 642311)
- in DataObject @0x2d42680
- object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d44320 with key _TrigNavTest__TestBContainer_TestB of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2d44060
- object modifiable when retrieved
 Holder_test          INFO LINE:55 End of the test: Registration
 Holder_test          INFO LINE:111 Test progress fine:  adding simple vec
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d45cc0 with key HLTAutoKey_TestB_96422_11_to_0 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2d3fa40
- object modifiable when retrieved
 Holder_test          INFO LINE:119 Test progress fine:  Added another ownership
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d476a0 with key dav1 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2d45320
- object modifiable when retrieved
 Holder_test          INFO LINE:127 Test progress fine:  Added another ownership -with the hint
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d48a90 with key dav2 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2d33aa0
- object modifiable when retrieved
 Holder_test          INFO LINE:131 Test progress fine:  Adding a VIEW container
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d435c0 with key HLTAutoKey_TestB_96422_11_to_1 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2d46cd0
- object modifiable when retrieved
 Holder_test       WARNING insert::do_it objects can not be inserted because of ownership issues. Destination container has already 5 objects  and ownership policy OWN no action is performed, potential memory leak
 Holder_test       WARNING HolderImp::add  insert failed 
 Holder_test          INFO LINE:159 Test progress fine:  END Simple test of Container <-> Container holder -add-
 Holder_test          INFO LINE:162 Test progress fine:  END Simple test of Object <-> Container holder -add-
 Holder_test          INFO LINE:44 Start of the test: Registration
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d3e440 with key _DataVector<TestA>_TestAAux. of type TestAuxA(CLID 642300)
- in DataObject @0x2c74610
- object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d3e330 with key _DataVector<TestA>_TestA of type DataVector<TestA>(CLID 64210)
- in DataObject @0x2d44b80
- object modifiable when retrieved
 Holder_test          INFO LINE:55 End of the test: Registration
 Holder_test          INFO LINE:177 End of the test: Simple test of Container <-> Container holder (add)
-StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=0
  deleting TestB: 6
  deleting TestB: 1
  deleting TestB: 2
@@ -172,55 +92,24 @@ StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=0
  deleting TestA: 235
 Holder_test          INFO LINE:182 Start of the test: Operations
 Holder_test          INFO LINE:44 Start of the test: Registration
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d42250 with key _TrigNavTest__TestBContainer_TestBAux. of type TrigNavTest::TestAuxB(CLID 642311)
- in DataObject @0x2d46cd0
- object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d44320 with key _TrigNavTest__TestBContainer_TestB of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2d33aa0
- object modifiable when retrieved
 Holder_test          INFO LINE:55 End of the test: Registration
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d45cc0 with key HLTAutoKey_TestB_96422_11_to_0 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2c74610
- object modifiable when retrieved
 Holder_test          INFO LINE:201 End of the test: Operations
 Holder_test          INFO LINE:206 Start of the test: serialization
 Holder_test          INFO LINE:44 Start of the test: Registration
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d3f120 with key _TrigNavTest__TestBContainer_bluAux. of type TrigNavTest::TestAuxB(CLID 642311)
- in DataObject @0x2d42680
- object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d48a90 with key _TrigNavTest__TestBContainer_blu of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2d29680
- object modifiable when retrieved
 Holder_test          INFO LINE:55 End of the test: Registration
 Holder_test          INFO LINE:218 Test progress fine:  blob size 5
 Holder_test          INFO LINE:229 End of the test: serialization
 Holder_test          INFO LINE:59 Start of the test: use of unique key without sync to SG
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d3d9c0 with key Aux. of type TrigNavTest::TestAuxB(CLID 642311)
- in DataObject @0x2d3fa40
- object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d33080 with key  of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2d425e0
- object modifiable when retrieved
 Holder_test          INFO LINE:63 Test progress fine:  Got unique Key:HLTAutoKey__96422_0_to_0
 Holder_test          INFO LINE:64 End of the test: use of unique key without sync to SG
 Holder_test          INFO LINE:235 Start of the test: externalCollection
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d34ab0 with key HLT_external of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2d34970
- object modifiable when retrieved
 Holder_test          INFO LINE:248 End of the test: externalCollection
 Holder_test          INFO LINE:255 Start of the test: serialize_xAOD
-StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=0
  deleting TestB: 9
  deleting TestB: 67
  deleting TestB: 8
  deleting TestB: 1
  deleting TestB: 2
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d44320 with key _TrigNavTest__TestBContainer_testb of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2d353f0
- object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d42250 with key _TrigNavTest__TestBContainer_testbAux. of type TrigNavTest::TestAuxB(CLID 642311)
- in DataObject @0x2d48760
- object modifiable when retrieved
 Holder_test          INFO LINE:44 Start of the test: Registration
 Holder_test          INFO LINE:55 End of the test: Registration
 Warning in <TClass::Init>: no dictionary for class CosmicMuonCollection_tlp1 is available
@@ -233,7 +122,6 @@ Warning in <TClass::Init>: no dictionary for class MdtTrackSegmentCollection_p2
 ToolSvc.TrigSer...   INFO Initializing - Package version: TrigSerializeTP-00-00-00
 AthDictLoaderSvc     INFO in initialize...
 AthDictLoaderSvc     INFO acquired Dso-registry
-StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=0
  deleting TestB: 0
  deleting TestB: 1
  deleting TestB: 2
@@ -245,29 +133,14 @@ StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=0
  deleting TestB: 8
  deleting TestB: 9
 Holder_test          INFO LINE:44 Start of the test: Registration
-ClassIDSvc           INFO  getRegistryEntries: read 20102 CLIDRegistry entries for module ALL
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d42250 with key _TrigNavTest__TestBContainer_testbAux. of type TrigNavTest::TestAuxB(CLID 642311)
- in DataObject @0x2d3fa40
- object modifiable when retrieved
-StoreGateSvc_Impl   DEBUG Recorded object @0x2d44320 with key _TrigNavTest__TestBContainer_testb of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x5b11c00
- object modifiable when retrieved
+ClassIDSvc           INFO  getRegistryEntries: read 20106 CLIDRegistry entries for module ALL
 Holder_test          INFO LINE:55 End of the test: Registration
 APR:DbReflex:fo...WARNING  doing GUID scan on ALL types for Class ID=729E3742-94E3-467D-A40C-7836098C3FC9
 Warning in <TClass::Init>: no dictionary for class coral::AttributeList is available
 ClassIDSvc           INFO  getRegistryEntries: read 15 CLIDRegistry entries for module ALL
-StoreGateSvc_Impl   DEBUG overwrite: Recorded object @0x958dea0 with key _TrigNavTest__TestBContainer_testb of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x5b16a80
- object not modifiable when retrieved
-StoreGateSvc_Impl   DEBUG overwrite: Recorded object @0x95884f0 with key _TrigNavTest__TestBContainer_testbAux. of type TrigNavTest::TestAuxB(CLID 642311)
- in DataObject @0x9587e40
- object not modifiable when retrieved
-StoreGateSvc_Impl VERBOSE called associateAux_impl const for key _TrigNavTest__TestBContainer_testb
-StoreGateSvc_Impl   DEBUG Retrieved const handle to object _TrigNavTest__TestBContainer_testb  of type TrigNavTest::TestBContainer(CLID 96422)
 testb aux vars:
 ::detail [float]
 ::dyn [int]
-StoreGateSvc_Impl   DEBUG Clearing store with forceRemove=0
  deleting TestB: 0
  deleting TestB: 1
  deleting TestB: 2
diff --git a/Trigger/TrigEvent/TrigNavigation/share/Ownership_test.ref b/Trigger/TrigEvent/TrigNavigation/share/Ownership_test.ref
index c80497e526ea583b37cfb53346051b00ce75f6cc..f254588f4a98a2bb4874d4eb96328dc7e4139b70 100644
--- a/Trigger/TrigEvent/TrigNavigation/share/Ownership_test.ref
+++ b/Trigger/TrigEvent/TrigNavigation/share/Ownership_test.ref
@@ -1,7 +1,7 @@
 
 
 Initializing Gaudi ApplicationMgr using job opts ../share/test.txt
-JobOptionsSvc        INFO # =======> /home/sss/atlas/dvtest/build/../tests/../share/test.txt
+JobOptionsSvc        INFO # =======> /afs/cern.ch/user/s/ssnyder/atlas-work3/Trigger/TrigEvent/TrigNavigation/share/../share/test.txt
 JobOptionsSvc        INFO # (2,1): ApplicationMgr.DLLs += ["StoreGate", "TrigNavigation", "TrigSerializeCnvSvc"]
 JobOptionsSvc        INFO # (3,1): ApplicationMgr.ExtSvc += ["ClassIDSvc"]
 JobOptionsSvc        INFO # (4,1): ApplicationMgr.ExtSvc += ["TrigSerializeCnvSvc"]
@@ -20,17 +20,15 @@ JobOptionsSvc        INFO # (36,1): RoICache_test.OutputLevel = 3
 JobOptionsSvc        INFO Job options successfully read in from ../share/test.txt
 ApplicationMgr    SUCCESS 
 ====================================================================================================================================
-                                                   Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99)
-                                          running on karma on Wed Feb  8 10:39:37 2017
+                                                   Welcome to ApplicationMgr (GaudiCoreSvc v30r0)
+                                          running on lxplus020.cern.ch on Sat Dec  9 18:30:52 2017
 ====================================================================================================================================
 ApplicationMgr       INFO Successfully loaded modules : StoreGate, TrigNavigation, TrigSerializeCnvSvc
 ApplicationMgr       INFO Application Manager Configured successfully
-ClassIDSvc           INFO  getRegistryEntries: read 5881 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 1529 CLIDRegistry entries for module ALL
 TrigSerializeCn...   INFO initialize()
-StoreGateSvc      VERBOSE Initializing StoreGateSvc - package version StoreGate-00-00-00
-StoreGateSvc        DEBUG Service base class initialized successfully
-StoreGateSvc      VERBOSE ServiceLocatorHelper::service: found service EventPersistencySvc
-StoreGateSvc      VERBOSE ServiceLocatorHelper::service: found service ClassIDSvc
+StoreGateSvc_Impl VERBOSE ServiceLocatorHelper::service: found service EventPersistencySvc
+StoreGateSvc_Impl VERBOSE ServiceLocatorHelper::service: found service ClassIDSvc
 EventLoopMgr      WARNING Unable to locate service "EventSelector" 
 EventLoopMgr      WARNING No events will be processed from external input.
 HistogramPersis...WARNING Histograms saving not required.
@@ -38,7 +36,7 @@ ApplicationMgr       INFO Application Manager Initialized successfully
 ApplicationMgr Ready
 ToolSvc.Navigation  DEBUG Property update for OutputLevel : new value = 1
 ToolSvc.Navigation  DEBUG Navigation::initialize() got TrigSerializeCnvSvc
-ClassIDSvc           INFO  getRegistryEntries: read 408 CLIDRegistry entries for module ALL
+ClassIDSvc           INFO  getRegistryEntries: read 372 CLIDRegistry entries for module ALL
 ToolSvc.Navigation  DEBUG Recognized CLID : TestA and key: EverEmptyButPresent
 ToolSvc.Navigation  DEBUG Recognized CLID : TestA and key: AgainPresentButEmpty
 ToolSvc.Navigation  DEBUG Recognized CLID : TestA and key: 
@@ -52,7 +50,6 @@ ToolSvc.NavigationVERBOSE type: TrigNavTest::TestBContainerView(96423) container
 ToolSvc.NavigationVERBOSE type: TestDContainer(96477) container: TestDContainer(96477)label: "" subTypeIndex: 0 container not allocated yet
 ToolSvc.Navigation  DEBUG  successfully initialized Navigation 
 Ownership_test       INFO LINE:87 Start of the test: testing if the insert operation on an empty container makes it a view container
-StoreGateSvc        DEBUG Clearing store with forceRemove=0
 ToolSvc.Navigation  DEBUG Navigation reset done
 ToolSvc.NavigationVERBOSE NavigationCore::prepare Compile time known types : type: TestA(6421) container: DataVector<TestA>(64210)label: "" subTypeIndex: 0 container not allocated yet
 ToolSvc.NavigationVERBOSE NavigationCore::prepare Compile time known types : type: TestC(7800) container: DataVector<TestC>(78001)label: "" subTypeIndex: 0 container not allocated yet
@@ -63,114 +60,43 @@ ToolSvc.NavigationVERBOSE NavigationCore::prepare Preregistering objects #:6
 ToolSvc.NavigationVERBOSE NavigationCore::prepare preregistering objects of clid: 6421 label: EverEmptyButPresent
 ToolSvc.NavigationVERBOSE NavigationCore::prepare creating handler for type (CLID): 6421 label: EverEmptyButPresent index: 0
 ToolSvc.Navigation  DEBUG createHolder: creating holder for CLID: 6421 label: EverEmptyButPresent and index: 0
-ToolSvc.NavigationVERBOSE Holder created, registering 0x2486d60 type: TestA(6421) container: DataVector<TestA>(64210)label: "EverEmptyButPresent" subTypeIndex: 0 container not allocated yet
+ToolSvc.NavigationVERBOSE Holder created, registering 0x108ab00 type: TestA(6421) container: DataVector<TestA>(64210)label: "EverEmptyButPresent" subTypeIndex: 0 container not allocated yet
 ToolSvc.Navigation  DEBUG registerHolder for OK type: TestA(6421) container: DataVector<TestA>(64210)label: "EverEmptyButPresent" subTypeIndex: 0 container not allocated yet
-StoreGateSvc        DEBUG Recorded object @0x2487100 with key HLT_DataVector<TestA>_EverEmptyButPresentAux. of type TestAuxA(CLID 642300)
- in DataObject @0x2485fa0
- object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x2486ff0 with key HLT_DataVector<TestA>_EverEmptyButPresent of type DataVector<TestA>(CLID 64210)
- in DataObject @0x2487f20
- object modifiable when retrieved
 ToolSvc.NavigationVERBOSE NavigationCore::prepare preregistering objects of clid: 6421 label: AgainPresentButEmpty
 ToolSvc.NavigationVERBOSE NavigationCore::prepare creating handler for type (CLID): 6421 label: AgainPresentButEmpty index: 1
 ToolSvc.Navigation  DEBUG createHolder: creating holder for CLID: 6421 label: AgainPresentButEmpty and index: 1
-ToolSvc.NavigationVERBOSE Holder created, registering 0x2488510 type: TestA(6421) container: DataVector<TestA>(64210)label: "AgainPresentButEmpty" subTypeIndex: 1 container not allocated yet
+ToolSvc.NavigationVERBOSE Holder created, registering 0x1083590 type: TestA(6421) container: DataVector<TestA>(64210)label: "AgainPresentButEmpty" subTypeIndex: 1 container not allocated yet
 ToolSvc.Navigation  DEBUG registerHolder for OK type: TestA(6421) container: DataVector<TestA>(64210)label: "AgainPresentButEmpty" subTypeIndex: 1 container not allocated yet
-StoreGateSvc        DEBUG Recorded object @0x2488bf0 with key HLT_DataVector<TestA>_AgainPresentButEmptyAux. of type TestAuxA(CLID 642300)
- in DataObject @0x2488e50
- object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x2488ae0 with key HLT_DataVector<TestA>_AgainPresentButEmpty of type DataVector<TestA>(CLID 64210)
- in DataObject @0x24898a0
- object modifiable when retrieved
 ToolSvc.NavigationVERBOSE NavigationCore::prepare preregistering objects of clid: 6421 label: 
 ToolSvc.NavigationVERBOSE NavigationCore::prepare creating handler for type (CLID): 6421 label:  index: 2
 ToolSvc.Navigation  DEBUG createHolder: creating holder for CLID: 6421 label:  and index: 2
-ToolSvc.NavigationVERBOSE Holder created, registering 0x2489ef0 type: TestA(6421) container: DataVector<TestA>(64210)label: "" subTypeIndex: 2 container not allocated yet
+ToolSvc.NavigationVERBOSE Holder created, registering 0x1089d60 type: TestA(6421) container: DataVector<TestA>(64210)label: "" subTypeIndex: 2 container not allocated yet
 ToolSvc.Navigation  DEBUG registerHolder for OK type: TestA(6421) container: DataVector<TestA>(64210)label: "" subTypeIndex: 2 container not allocated yet
-StoreGateSvc        DEBUG Recorded object @0x248a320 with key HLT_DataVector<TestA>Aux. of type TestAuxA(CLID 642300)
- in DataObject @0x248a580
- object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x248a210 with key HLT_DataVector<TestA> of type DataVector<TestA>(CLID 64210)
- in DataObject @0x248b120
- object modifiable when retrieved
 ToolSvc.NavigationVERBOSE NavigationCore::prepare preregistering objects of clid: 96422 label: BContainer1
 ToolSvc.NavigationVERBOSE NavigationCore::prepare creating handler for type (CLID): 96422 label: BContainer1 index: 0
 ToolSvc.Navigation  DEBUG createHolder: creating holder for CLID: 96422 label: BContainer1 and index: 0
-ToolSvc.NavigationVERBOSE Holder created, registering 0x248b6a0 type: TrigNavTest::TestBContainer(96422) container: TrigNavTest::TestBContainer(96422)label: "BContainer1" subTypeIndex: 0 container not allocated yet
+ToolSvc.NavigationVERBOSE Holder created, registering 0x10869c0 type: TrigNavTest::TestBContainer(96422) container: TrigNavTest::TestBContainer(96422)label: "BContainer1" subTypeIndex: 0 container not allocated yet
 ToolSvc.Navigation  DEBUG registerHolder for OK type: TrigNavTest::TestBContainer(96422) container: TrigNavTest::TestBContainer(96422)label: "BContainer1" subTypeIndex: 0 container not allocated yet
-StoreGateSvc        DEBUG Recorded object @0x248be00 with key HLT_TrigNavTest__TestBContainer_BContainer1Aux. of type TrigNavTest::TestAuxB(CLID 642311)
- in DataObject @0x248bca0
- object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x248bcf0 with key HLT_TrigNavTest__TestBContainer_BContainer1 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x248d2a0
- object modifiable when retrieved
 ToolSvc.NavigationVERBOSE NavigationCore::prepare preregistering objects of clid: 96422 label: BContainer2
 ToolSvc.NavigationVERBOSE NavigationCore::prepare creating handler for type (CLID): 96422 label: BContainer2 index: 1
 ToolSvc.Navigation  DEBUG createHolder: creating holder for CLID: 96422 label: BContainer2 and index: 1
-ToolSvc.NavigationVERBOSE Holder created, registering 0x248d8c0 type: TrigNavTest::TestBContainer(96422) container: TrigNavTest::TestBContainer(96422)label: "BContainer2" subTypeIndex: 1 container not allocated yet
+ToolSvc.NavigationVERBOSE Holder created, registering 0x1078f60 type: TrigNavTest::TestBContainer(96422) container: TrigNavTest::TestBContainer(96422)label: "BContainer2" subTypeIndex: 1 container not allocated yet
 ToolSvc.Navigation  DEBUG registerHolder for OK type: TrigNavTest::TestBContainer(96422) container: TrigNavTest::TestBContainer(96422)label: "BContainer2" subTypeIndex: 1 container not allocated yet
-StoreGateSvc        DEBUG Recorded object @0x248deb0 with key HLT_TrigNavTest__TestBContainer_BContainer2Aux. of type TrigNavTest::TestAuxB(CLID 642311)
- in DataObject @0x248e840
- object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x248dda0 with key HLT_TrigNavTest__TestBContainer_BContainer2 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x248f240
- object modifiable when retrieved
 ToolSvc.NavigationVERBOSE NavigationCore::prepare preregistering objects of clid: 96477 label: DContainer1
 ToolSvc.NavigationVERBOSE NavigationCore::prepare creating handler for type (CLID): 96477 label: DContainer1 index: 0
 ToolSvc.Navigation  DEBUG createHolder: creating holder for CLID: 96477 label: DContainer1 and index: 0
-ToolSvc.NavigationVERBOSE Holder created, registering 0x248f800 type: TestDContainer(96477) container: TestDContainer(96477)label: "DContainer1" subTypeIndex: 0 container not allocated yet
+ToolSvc.NavigationVERBOSE Holder created, registering 0x107ab80 type: TestDContainer(96477) container: TestDContainer(96477)label: "DContainer1" subTypeIndex: 0 container not allocated yet
 ToolSvc.Navigation  DEBUG registerHolder for OK type: TestDContainer(96477) container: TestDContainer(96477)label: "DContainer1" subTypeIndex: 0 container not allocated yet
-StoreGateSvc        DEBUG Recorded object @0x248fcf0 with key HLT_TestDContainer_DContainer1 of type TestDContainer(CLID 96477)
- in DataObject @0x248fc00
- object modifiable when retrieved
 ToolSvc.Navigation  DEBUG NavigationCore::prepare Navigation structure prepared for next event
 Ownership_test       INFO LINE:98 Test progress fine:  Objects prepared
-StoreGateSvc        DEBUG Retrieved const handle to object HLT_TestDContainer_DContainer1  of type TestDContainer(CLID 96477)
 Ownership_test       INFO LINE:107 Test progress fine:  Event wise container has ownership policy OWN
 ToolSvc.Navigation  DEBUG attachFeature: of clid: 96477(TestDContainer) to TE: 23 label: "DContainer1" memory management: 3
 ToolSvc.NavigationVERBOSE getting Holder for label: DContainer1
 ToolSvc.Navigation  DEBUG Getting holder for type: 96477 label: DContainer1
-ToolSvc.NavigationVERBOSE got Holder: 0x248f800
-StoreGateSvc        DEBUG Recorded object @0x24901e0 with key HLTAutoKey_DContainer1_96477_0_to_0 of type TestDContainer(CLID 96477)
- in DataObject @0x24907a0
- object modifiable when retrieved
-StoreGateSvc        DEBUG Retrieved const handle to object HLT_TestDContainer_DContainer1  of type TestDContainer(CLID 96477)
+ToolSvc.NavigationVERBOSE got Holder: 0x107ab80
 Ownership_test       INFO LINE:123 Test progress fine:  After attachFeture the container is VIEW
 Ownership_test       INFO LINE:128 End of the test: testing if the insert operation on an empty container makes it a view container
 Ownership_test       INFO LINE:59 Start of the test: noMixTest
-StoreGateSvc        DEBUG Clearing store with forceRemove=0
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248b2a0, recorded with key=HLT_DataVector<TestA>, CLID=64210, containing data object @0x248b120  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x2489ac0, recorded with key=HLT_DataVector<TestA>_AgainPresentButEmpty, CLID=64210, containing data object @0x24898a0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x2488140, recorded with key=HLT_DataVector<TestA>_EverEmptyButPresent, CLID=64210, containing data object @0x2487f20  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248d450, recorded with key=HLT_TrigNavTest__TestBContainer_BContainer1, CLID=96422, containing data object @0x248d2a0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248f3f0, recorded with key=HLT_TrigNavTest__TestBContainer_BContainer2, CLID=96422, containing data object @0x248f240  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x24909a0, recorded with key=HLTAutoKey_DContainer1_96477_0_to_0, CLID=96477, containing data object @0x24907a0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248fec0, recorded with key=HLT_TestDContainer_DContainer1, CLID=96477, containing data object @0x248fc00  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248a7d0, recorded with key=HLT_DataVector<TestA>Aux., CLID=642300, containing data object @0x248a580  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x24890a0, recorded with key=HLT_DataVector<TestA>_AgainPresentButEmptyAux., CLID=642300, containing data object @0x2488e50  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x24873b0, recorded with key=HLT_DataVector<TestA>_EverEmptyButPresentAux., CLID=642300, containing data object @0x2485fa0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248cab0, recorded with key=HLT_TrigNavTest__TestBContainer_BContainer1Aux., CLID=642311, containing data object @0x248bca0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248ea90, recorded with key=HLT_TrigNavTest__TestBContainer_BContainer2Aux., CLID=642311, containing data object @0x248e840  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248a7d0, recorded with key=HLT_DataVector<TestA>Aux., CLID=642300, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x24890a0, recorded with key=HLT_DataVector<TestA>_AgainPresentButEmptyAux., CLID=642300, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x24873b0, recorded with key=HLT_DataVector<TestA>_EverEmptyButPresentAux., CLID=642300, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248cab0, recorded with key=HLT_TrigNavTest__TestBContainer_BContainer1Aux., CLID=642311, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248ea90, recorded with key=HLT_TrigNavTest__TestBContainer_BContainer2Aux., CLID=642311, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248a7d0, recorded with key=HLT_DataVector<TestA>Aux., CLID=642300, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x24890a0, recorded with key=HLT_DataVector<TestA>_AgainPresentButEmptyAux., CLID=642300, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x24873b0, recorded with key=HLT_DataVector<TestA>_EverEmptyButPresentAux., CLID=642300, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248cab0, recorded with key=HLT_TrigNavTest__TestBContainer_BContainer1Aux., CLID=642311, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248ea90, recorded with key=HLT_TrigNavTest__TestBContainer_BContainer2Aux., CLID=642311, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248a7d0, recorded with key=HLT_DataVector<TestA>Aux., CLID=642300, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x24890a0, recorded with key=HLT_DataVector<TestA>_AgainPresentButEmptyAux., CLID=642300, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x24873b0, recorded with key=HLT_DataVector<TestA>_EverEmptyButPresentAux., CLID=642300, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248cab0, recorded with key=HLT_TrigNavTest__TestBContainer_BContainer1Aux., CLID=642311, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248ea90, recorded with key=HLT_TrigNavTest__TestBContainer_BContainer2Aux., CLID=642311, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248a7d0, recorded with key=HLT_DataVector<TestA>Aux., CLID=642300, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x24890a0, recorded with key=HLT_DataVector<TestA>_AgainPresentButEmptyAux., CLID=642300, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x24873b0, recorded with key=HLT_DataVector<TestA>_EverEmptyButPresentAux., CLID=642300, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248cab0, recorded with key=HLT_TrigNavTest__TestBContainer_BContainer1Aux., CLID=642311, containing data object @0  ... -> DONE
-StoreGateSvc      VERBOSE DataStore::clearStore() requesting release of DataProxy @0x248ea90, recorded with key=HLT_TrigNavTest__TestBContainer_BContainer2Aux., CLID=642311, containing data object @0  ... -> DONE
 ToolSvc.Navigation  DEBUG Navigation reset done
 ToolSvc.NavigationVERBOSE NavigationCore::prepare Compile time known types : type: TestA(6421) container: DataVector<TestA>(64210)label: "" subTypeIndex: 0 container not allocated yet
 ToolSvc.NavigationVERBOSE NavigationCore::prepare Compile time known types : type: TestC(7800) container: DataVector<TestC>(78001)label: "" subTypeIndex: 0 container not allocated yet
@@ -181,83 +107,44 @@ ToolSvc.NavigationVERBOSE NavigationCore::prepare Preregistering objects #:6
 ToolSvc.NavigationVERBOSE NavigationCore::prepare preregistering objects of clid: 6421 label: EverEmptyButPresent
 ToolSvc.NavigationVERBOSE NavigationCore::prepare creating handler for type (CLID): 6421 label: EverEmptyButPresent index: 0
 ToolSvc.Navigation  DEBUG createHolder: creating holder for CLID: 6421 label: EverEmptyButPresent and index: 0
-ToolSvc.NavigationVERBOSE Holder created, registering 0x248f800 type: TestA(6421) container: DataVector<TestA>(64210)label: "EverEmptyButPresent" subTypeIndex: 0 container not allocated yet
+ToolSvc.NavigationVERBOSE Holder created, registering 0x107ab80 type: TestA(6421) container: DataVector<TestA>(64210)label: "EverEmptyButPresent" subTypeIndex: 0 container not allocated yet
 ToolSvc.Navigation  DEBUG registerHolder for OK type: TestA(6421) container: DataVector<TestA>(64210)label: "EverEmptyButPresent" subTypeIndex: 0 container not allocated yet
-StoreGateSvc        DEBUG Recorded object @0x2488bf0 with key HLT_DataVector<TestA>_EverEmptyButPresentAux. of type TestAuxA(CLID 642300)
- in DataObject @0x2459910
- object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x248fcf0 with key HLT_DataVector<TestA>_EverEmptyButPresent of type DataVector<TestA>(CLID 64210)
- in DataObject @0x2488490
- object modifiable when retrieved
 ToolSvc.NavigationVERBOSE NavigationCore::prepare preregistering objects of clid: 6421 label: AgainPresentButEmpty
 ToolSvc.NavigationVERBOSE NavigationCore::prepare creating handler for type (CLID): 6421 label: AgainPresentButEmpty index: 1
 ToolSvc.Navigation  DEBUG createHolder: creating holder for CLID: 6421 label: AgainPresentButEmpty and index: 1
-ToolSvc.NavigationVERBOSE Holder created, registering 0x248d8c0 type: TestA(6421) container: DataVector<TestA>(64210)label: "AgainPresentButEmpty" subTypeIndex: 1 container not allocated yet
+ToolSvc.NavigationVERBOSE Holder created, registering 0x1078f60 type: TestA(6421) container: DataVector<TestA>(64210)label: "AgainPresentButEmpty" subTypeIndex: 1 container not allocated yet
 ToolSvc.Navigation  DEBUG registerHolder for OK type: TestA(6421) container: DataVector<TestA>(64210)label: "AgainPresentButEmpty" subTypeIndex: 1 container not allocated yet
-StoreGateSvc        DEBUG Recorded object @0x248b6a0 with key HLT_DataVector<TestA>_AgainPresentButEmptyAux. of type TestAuxA(CLID 642300)
- in DataObject @0x245a7a0
- object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x24901e0 with key HLT_DataVector<TestA>_AgainPresentButEmpty of type DataVector<TestA>(CLID 64210)
- in DataObject @0x248b540
- object modifiable when retrieved
 ToolSvc.NavigationVERBOSE NavigationCore::prepare preregistering objects of clid: 6421 label: 
 ToolSvc.NavigationVERBOSE NavigationCore::prepare creating handler for type (CLID): 6421 label:  index: 2
 ToolSvc.Navigation  DEBUG createHolder: creating holder for CLID: 6421 label:  and index: 2
-ToolSvc.NavigationVERBOSE Holder created, registering 0x2489ef0 type: TestA(6421) container: DataVector<TestA>(64210)label: "" subTypeIndex: 2 container not allocated yet
+ToolSvc.NavigationVERBOSE Holder created, registering 0x10869c0 type: TestA(6421) container: DataVector<TestA>(64210)label: "" subTypeIndex: 2 container not allocated yet
 ToolSvc.Navigation  DEBUG registerHolder for OK type: TestA(6421) container: DataVector<TestA>(64210)label: "" subTypeIndex: 2 container not allocated yet
-StoreGateSvc        DEBUG Recorded object @0x2488510 with key HLT_DataVector<TestA>Aux. of type TestAuxA(CLID 642300)
- in DataObject @0x248db50
- object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x2490c30 with key HLT_DataVector<TestA> of type DataVector<TestA>(CLID 64210)
- in DataObject @0x2490510
- object modifiable when retrieved
 ToolSvc.NavigationVERBOSE NavigationCore::prepare preregistering objects of clid: 96422 label: BContainer1
 ToolSvc.NavigationVERBOSE NavigationCore::prepare creating handler for type (CLID): 96422 label: BContainer1 index: 0
 ToolSvc.Navigation  DEBUG createHolder: creating holder for CLID: 96422 label: BContainer1 and index: 0
-ToolSvc.NavigationVERBOSE Holder created, registering 0x248a210 type: TrigNavTest::TestBContainer(96422) container: TrigNavTest::TestBContainer(96422)label: "BContainer1" subTypeIndex: 0 container not allocated yet
+ToolSvc.NavigationVERBOSE Holder created, registering 0x108ab00 type: TrigNavTest::TestBContainer(96422) container: TrigNavTest::TestBContainer(96422)label: "BContainer1" subTypeIndex: 0 container not allocated yet
 ToolSvc.Navigation  DEBUG registerHolder for OK type: TrigNavTest::TestBContainer(96422) container: TrigNavTest::TestBContainer(96422)label: "BContainer1" subTypeIndex: 0 container not allocated yet
-StoreGateSvc        DEBUG Recorded object @0x2486e70 with key HLT_TrigNavTest__TestBContainer_BContainer1Aux. of type TrigNavTest::TestAuxB(CLID 642311)
- in DataObject @0x2487700
- object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x2486d60 with key HLT_TrigNavTest__TestBContainer_BContainer1 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x24892a0
- object modifiable when retrieved
 ToolSvc.NavigationVERBOSE NavigationCore::prepare preregistering objects of clid: 96422 label: BContainer2
 ToolSvc.NavigationVERBOSE NavigationCore::prepare creating handler for type (CLID): 96422 label: BContainer2 index: 1
 ToolSvc.Navigation  DEBUG createHolder: creating holder for CLID: 96422 label: BContainer2 and index: 1
-ToolSvc.NavigationVERBOSE Holder created, registering 0x2486ff0 type: TrigNavTest::TestBContainer(96422) container: TrigNavTest::TestBContainer(96422)label: "BContainer2" subTypeIndex: 1 container not allocated yet
+ToolSvc.NavigationVERBOSE Holder created, registering 0x1084ba0 type: TrigNavTest::TestBContainer(96422) container: TrigNavTest::TestBContainer(96422)label: "BContainer2" subTypeIndex: 1 container not allocated yet
 ToolSvc.Navigation  DEBUG registerHolder for OK type: TrigNavTest::TestBContainer(96422) container: TrigNavTest::TestBContainer(96422)label: "BContainer2" subTypeIndex: 1 container not allocated yet
-StoreGateSvc        DEBUG Recorded object @0x248c3b0 with key HLT_TrigNavTest__TestBContainer_BContainer2Aux. of type TrigNavTest::TestAuxB(CLID 642311)
- in DataObject @0x2490650
- object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x2488ae0 with key HLT_TrigNavTest__TestBContainer_BContainer2 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x248fc00
- object modifiable when retrieved
 ToolSvc.NavigationVERBOSE NavigationCore::prepare preregistering objects of clid: 96477 label: DContainer1
 ToolSvc.NavigationVERBOSE NavigationCore::prepare creating handler for type (CLID): 96477 label: DContainer1 index: 0
 ToolSvc.Navigation  DEBUG createHolder: creating holder for CLID: 96477 label: DContainer1 and index: 0
-ToolSvc.NavigationVERBOSE Holder created, registering 0x248c530 type: TestDContainer(96477) container: TestDContainer(96477)label: "DContainer1" subTypeIndex: 0 container not allocated yet
+ToolSvc.NavigationVERBOSE Holder created, registering 0x1079510 type: TestDContainer(96477) container: TestDContainer(96477)label: "DContainer1" subTypeIndex: 0 container not allocated yet
 ToolSvc.Navigation  DEBUG registerHolder for OK type: TestDContainer(96477) container: TestDContainer(96477)label: "DContainer1" subTypeIndex: 0 container not allocated yet
-StoreGateSvc        DEBUG Recorded object @0x248e4a0 with key HLT_TestDContainer_DContainer1 of type TestDContainer(CLID 96477)
- in DataObject @0x248e5b0
- object modifiable when retrieved
 ToolSvc.Navigation  DEBUG NavigationCore::prepare Navigation structure prepared for next event
 Ownership_test       INFO LINE:67 Test progress fine:  Objects prepared
 ToolSvc.Navigation  DEBUG attachFeature: of clid: 96422(TrigNavTest::TestBContainer) to TE: 23 label: "BContainer1" memory management: 3
 ToolSvc.NavigationVERBOSE getting Holder for label: BContainer1
 ToolSvc.Navigation  DEBUG Getting holder for type: 96422 label: BContainer1
-ToolSvc.NavigationVERBOSE got Holder: 0x248a210
-StoreGateSvc        DEBUG Recorded object @0x248e660 with key HLTAutoKey_BContainer1_96422_0_to_0 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2487f20
- object modifiable when retrieved
+ToolSvc.NavigationVERBOSE got Holder: 0x108ab00
 Ownership_test       INFO LINE:75 Test progress fine:  After attachFeture the container is VIEW
 ToolSvc.Navigation  DEBUG attachFeature: of clid: 96422(TrigNavTest::TestBContainer) to TE: 23 label: "BContainer1" memory management: 3
 ToolSvc.NavigationVERBOSE getting Holder for label: BContainer1
 ToolSvc.Navigation  DEBUG Getting holder for type: 96422 label: BContainer1
-ToolSvc.NavigationVERBOSE got Holder: 0x248a210
-StoreGateSvc        DEBUG Recorded object @0x2490d40 with key HLTAutoKey_BContainer1_96422_0_to_1 of type TrigNavTest::TestBContainer(CLID 96422)
- in DataObject @0x2491210
- object modifiable when retrieved
+ToolSvc.NavigationVERBOSE got Holder: 0x108ab00
 HolderFactory     WARNING insert::do_it objects can not be inserted because of ownership issues. Destination container has already 3 objects  and ownership policy OWN no action is performed, potential memory leak
 HolderFactory     WARNING HolderImp::add  insert failed 
 Ownership_test       INFO LINE:81 Test progress fine:  The attachFeature was unsuccesfull (as expected)
@@ -272,21 +159,12 @@ ToolSvc.Navigation  DEBUG Getting holder for type: 96423 label: BView
 ToolSvc.Navigation  DEBUG createHolder: creating holder for CLID: 96423 label: BView and index: 0
 ToolSvc.Navigation  DEBUG getHolder: predefined holder got
 ToolSvc.Navigation  DEBUG registerHolder for OK type: TrigNavTest::TestBContainerView(96423) container: TrigNavTest::TestBContainerView(96423)label: "BView" subTypeIndex: 0 container not allocated yet
-ToolSvc.NavigationVERBOSE got Holder: 0x2492360
-StoreGateSvc        DEBUG Recorded object @0x24929b0 with key HLT_TrigNavTest__TestBContainerView_BView of type TrigNavTest::TestBContainerView(CLID 96423)
- in DataObject @0x2492750
- object modifiable when retrieved
-StoreGateSvc        DEBUG Recorded object @0x2491bb0 with key HLTAutoKey_BView_96423_0_to_0 of type TrigNavTest::TestBContainerView(CLID 96423)
- in DataObject @0x2492c70
- object modifiable when retrieved
+ToolSvc.NavigationVERBOSE got Holder: 0x107da00
 Ownership_test       INFO LINE:151 Test progress fine:  First View attach worked
 ToolSvc.Navigation  DEBUG attachFeature: of clid: 96423(TrigNavTest::TestBContainerView) to TE: 23 label: "BView" memory management: 3
 ToolSvc.NavigationVERBOSE getting Holder for label: BView
 ToolSvc.Navigation  DEBUG Getting holder for type: 96423 label: BView
-ToolSvc.NavigationVERBOSE got Holder: 0x2492360
-StoreGateSvc        DEBUG Recorded object @0x2491d00 with key HLTAutoKey_BView_96423_0_to_1 of type TrigNavTest::TestBContainerView(CLID 96423)
- in DataObject @0x2493300
- object modifiable when retrieved
+ToolSvc.NavigationVERBOSE got Holder: 0x107da00
 Ownership_test       INFO LINE:157 Test progress fine:  Second View attach worked
 Ownership_test       INFO LINE:160 End of the test: testing if the xAOD view container works
 Ownership_test       INFO LINE:219 Test progress fine:  END all went fine
diff --git a/Trigger/TrigFTK/TrigFTKBankGen/TrigFTKBankGen/FTKPattGenRoot.h b/Trigger/TrigFTK/TrigFTKBankGen/TrigFTKBankGen/FTKPattGenRoot.h
index 6dc821017a4a749f069ee277796161d4c32937b9..81507b1cb588df07fd078b11f2faad2d4f709124 100644
--- a/Trigger/TrigFTK/TrigFTKBankGen/TrigFTKBankGen/FTKPattGenRoot.h
+++ b/Trigger/TrigFTK/TrigFTKBankGen/TrigFTKBankGen/FTKPattGenRoot.h
@@ -136,7 +136,7 @@ protected:
       float rMin,rMax,zMin,zMax;
    } RZminmax_t;
 
-   std::map<int,RZminmax_t > m_moduleBounds;
+   std::map<int,RZminmax_t > m_moduleBoundsPixel,m_moduleBoundsSCT;
 
 private:
    double getRandom();
diff --git a/Trigger/TrigFTK/TrigFTKBankGen/TrigFTKBankGen/PattMergeRootAlgo.h b/Trigger/TrigFTK/TrigFTKBankGen/TrigFTKBankGen/PattMergeRootAlgo.h
index ce65c24d9904ba3527aabe86a5880f2483c92977..d5e7377b343500c6f863f1d91e1e45929ad75a1d 100644
--- a/Trigger/TrigFTK/TrigFTKBankGen/TrigFTKBankGen/PattMergeRootAlgo.h
+++ b/Trigger/TrigFTK/TrigFTKBankGen/TrigFTKBankGen/PattMergeRootAlgo.h
@@ -10,10 +10,15 @@
 #include "GaudiKernel/ITHistSvc.h"
 
 #include "TrigFTKSim/FTKLogging.h"
+
+#include "TrigFTKSim/FTKSetup.h"
+#include "TrigFTKSim/FTKSSMap.h"
+
 #include <vector>
 #include <string>
 /////////////////////////////////////////////////////////////////////////////
 
+class FTKSSMap;
 
 class PattMergeRootAlgo: public AthAlgorithm , public FTKLogger {
  public:
@@ -38,6 +43,12 @@ protected:
    int m_Compression;
    std::string m_WhereToRunMerging;
    std::vector< std::string > m_InputFiles;
+
+   FTKSSMap *m_ssmap;
+   int m_hwmodeid;
+
+   std::string m_ssmap_path,m_pmap_path,m_rmap_path,m_modulelut_path;
+   int m_curreg;
  
 };
 
diff --git a/Trigger/TrigFTK/TrigFTKBankGen/src/FTKPattGenRoot.cxx b/Trigger/TrigFTK/TrigFTKBankGen/src/FTKPattGenRoot.cxx
index 60c0daadf7f377014e0276f87a5ef87bc06ad277..0941b695cf6e32014bb67e9e688cda7cd488095b 100644
--- a/Trigger/TrigFTK/TrigFTKBankGen/src/FTKPattGenRoot.cxx
+++ b/Trigger/TrigFTK/TrigFTKBankGen/src/FTKPattGenRoot.cxx
@@ -362,10 +362,11 @@ uint64_t FTKPattGenRoot::trackInvertion(u_int64_t ntrials, bool smear) {
 	 if ( m_select == FTKPattGenRoot::RndSector ) {
 	    // prepare to iterate on the list of sector IDs
 	    patt = (unsigned int)(found_patterns.size() * getRandom());//m_pEng->flat());
-            if(patt>=found_patterns.size()) patt=found_patterns.size();
+            if(patt>=found_patterns.size()) patt=found_patterns.size()-1;
 	 } else if((m_select==ModuleGeometry)||
                    (m_select==ModuleGeometrySmallestSector)||
                    (m_select==ModuleGeometryBestMatch)) {
+            static int print=30;
             if(FTKSetup::getFTKSetup().getHWModeSS()!=2) {
                Fatal("trackInvertion")
                   <<"Selector="<<m_select<<" only implemented for HDMODEID==2\n";
@@ -382,16 +383,17 @@ uint64_t FTKPattGenRoot::trackInvertion(u_int64_t ntrials, bool smear) {
                int isector=found_patterns[ipatt].GetSectorID();
                // the weight w is the a product of the weights from each plane
                for (int p=0; p<pmap()->getNPlanes(); ++p) {
-                  // skip pixel planes - for sime reason it does not work
-                  if(pmap()->getDim(p,1)!=-1) continue;
                   int id=m_sectorbank[isector].GetHit(p);
-                  // lookup geometry by module ID
-                  map<int,RZminmax_t>::const_iterator irz=
-                     m_moduleBounds.find(id);
-                  if(irz==m_moduleBounds.end()) {
-                     // module not found
-                     found=false;
+                  map<int,RZminmax_t>::const_iterator irz;
+                  if(pmap()->getDim(p,1)!=-1) {
+                     // lookup geometry by module ID
+                     irz=m_moduleBoundsPixel.find(id);
+                     found = (irz!=m_moduleBoundsPixel.end());
                   } else {
+                     irz=m_moduleBoundsSCT.find(id);
+                     found = (irz!=m_moduleBoundsSCT.end());
+                  }
+                  if(found) {
                      RZminmax_t const &rz=(*irz).second;
                      // rMin,rMax and zMin,zMax are the 
                      // module bounds in r,z
@@ -413,9 +415,14 @@ uint64_t FTKPattGenRoot::trackInvertion(u_int64_t ntrials, bool smear) {
                         double z=s*cotTh+z0;
                         if(z<rz.zMin) d=(rz.zMin-z)/dz;
                         if(z>rz.zMax) d=(z-rz.zMax)/dz;
-                        /* cout<<"barr"<<p<<" "<<isector
-                            <<" "<<z<<" "<<rz.zMin<<" "<<rz.zMax
-                            <<" d="<<d<<"\n"; */
+                        if(print) {
+                           cout<<"barr"<<p<<" sector="<<isector
+                               <<" z0="<<z0<<" cotTh="<<cotTh
+                               <<" r="<<r
+                               <<" z="<<z
+                               <<" zMin="<<rz.zMin<<" zMax="<<rz.zMax
+                               <<" d="<<d<<"\n";
+                        }
                      } else {
                         // endcap: module is smaller in z than in r
                         double z=0.5*(rz.zMax+rz.zMin);
@@ -425,9 +432,14 @@ uint64_t FTKPattGenRoot::trackInvertion(u_int64_t ntrials, bool smear) {
                         double r=s*(1.-srho*srho/24.);
                         if(r<rz.rMin) d=(rz.rMin-r)/dr;
                         if(r>rz.rMax) d=(r-rz.rMax)/dr;
-                        /*cout<<"endc"<<p<<" "<<isector
-                            <<" "<<s<<" "<<rz.rMin<<" "<<rz.rMax
-                            <<" d="<<d<<"\n"; */
+                        if(print) {
+                           cout<<"endc"<<p<<" sector="<<isector
+                               <<" z0="<<z0<<" cotTh="<<cotTh
+                               <<" z="<<z
+                               <<" r="<<r<<" s="<<s
+                               <<" rMin="<<rz.rMin<<" rMax="<<rz.rMax
+                               <<" d="<<d<<"\n";
+                        }
                      }
                      if(d>0.0) {
                         w *=TMath::Exp(-d*d*50.); 
@@ -448,8 +460,9 @@ uint64_t FTKPattGenRoot::trackInvertion(u_int64_t ntrials, bool smear) {
             if(nFound!=found_patterns.size()) {
                Fatal("trackInvertion")<<"some modules not found\n";
             }
-            // throw a random number here, even if it is not sued
+            // throw a random number here, even if it is not used
             // -> algorithms can be compared event by event
+
             double rndForSector=getRandom();
             if(exactMatch.size()>0) {
                // have an exact match
@@ -491,7 +504,6 @@ uint64_t FTKPattGenRoot::trackInvertion(u_int64_t ntrials, bool smear) {
                   }
                }
             }
-            static int print=30;
             if(print) {
                cout<<"candidates: [";
                for(unsigned ipatt=0;ipatt<found_patterns.size();ipatt++) {
@@ -1016,24 +1028,33 @@ void  FTKPattGenRoot::SetModuleGeometryCheck(const std::string &fileName,
       TTree *t=0;
       f->GetObject("modulePositions",t);
       if(t) {
-         int id;
+         int id,isPixel;
          float r[2],z[2];
+         t->SetBranchAddress("isPixel",&isPixel);
          t->SetBranchAddress("id",&id);
          t->SetBranchAddress("r",r);
          t->SetBranchAddress("z",z);
          for(int i=0;i<t->GetEntries();i++) {
             t->GetEntry(i);
-            RZminmax_t &module=m_moduleBounds[id];
-            module.rMin=r[0];
-            module.rMax=r[1];
-            module.zMin=z[0];
-            module.zMax=z[1];
+            RZminmax_t *module;
+            if(isPixel) {
+               module=&m_moduleBoundsPixel[id];
+            } else {
+               module=&m_moduleBoundsSCT[id];
+            }
+            module->rMin=r[0];
+            module->rMax=r[1];
+            module->zMin=z[0];
+            module->zMax=z[1];
          }
       }
       delete f;
-      if(m_moduleBounds.size()) {
+      if(m_moduleBoundsPixel.size()+
+         m_moduleBoundsSCT.size()) {
          Info("SetModuleGeometryCheck")
-            <<"found "<<m_moduleBounds.size()<<" modules\n";
+            <<"found "<<m_moduleBoundsPixel.size()
+            <<"/"<<m_moduleBoundsSCT.size()
+            <<" pixel/SCT modules\n";
          if(m_select==ModuleGeometry) {
             Info("SetModuleGeometryCheck")
                <<"select="<<m_select<<" random sector within module bounds, or weighted by distance\n";
diff --git a/Trigger/TrigFTK/TrigFTKBankGen/src/PattMergeRootAlgo.cxx b/Trigger/TrigFTK/TrigFTKBankGen/src/PattMergeRootAlgo.cxx
index fa8c83e435673dfe259155f9ff2bfb0e53888bd7..4ccc77b5d1e223659e7d383491cdc4cf07945206 100644
--- a/Trigger/TrigFTK/TrigFTKBankGen/src/PattMergeRootAlgo.cxx
+++ b/Trigger/TrigFTK/TrigFTKBankGen/src/PattMergeRootAlgo.cxx
@@ -4,7 +4,7 @@
 #include "TrigFTKBankGen/PattMergeRootAlgo.h"
 #include "TString.h"
 #include "TrigFTKSim/FTKMergeRoot.h"
-
+#include "TrigFTKSim/FTKSSMap.h"
 
 // #include "TrigFTKSim/FTKRootFile.h"
 // #include "TrigFTKSim/FTKPatternBySector.h"
@@ -14,7 +14,8 @@ using namespace std;
 /////////////////////////////////////////////////////////////////////////////
 
 PattMergeRootAlgo::PattMergeRootAlgo(const std::string& name, ISvcLocator* pSvcLocator):
-   AthAlgorithm(name, pSvcLocator), m_MinCov(0),m_Compression(-1)
+   AthAlgorithm(name, pSvcLocator), m_MinCov(0),m_Compression(-1),
+   m_ssmap(0),m_hwmodeid(-1),m_curreg(-1)
 {
    SetLogger(this);
    declareProperty("MinCoverage",m_MinCov);
@@ -26,6 +27,12 @@ PattMergeRootAlgo::PattMergeRootAlgo(const std::string& name, ISvcLocator* pSvcL
    declareProperty("InputFiles",m_InputFiles, "Input files.");
    declareProperty("WhereToRunMerging",m_WhereToRunMerging);
    declareProperty("DeleteFilesAfterMerging",m_DeleteAfterMerging);
+   declareProperty("ssmap_path", m_ssmap_path);
+   declareProperty("hwmodeid", m_hwmodeid);
+   declareProperty("pmap_path", m_pmap_path);
+   declareProperty("rmap_path", m_rmap_path);
+   declareProperty("ModuleLUTPath", m_modulelut_path);
+   declareProperty("curreg", m_curreg);
 }
 
 
@@ -91,8 +98,54 @@ StatusCode PattMergeRootAlgo::RunMerging() {
    // set number of sub regions (only supported by 'text-output')
    //ATH_MSG_INFO ("RunMerging(). SetNSubregions: "<<m_NSub);
    merger.SetNSubregions(m_NSub);
+
+   // HWMODEID for checking input files
+   if(m_hwmodeid>=0) {
+      FTKSetup &ftkset = FTKSetup::getFTKSetup();
+      ftkset.setHWModeSS(m_hwmodeid);
+      ATH_MSG_INFO ("HWMODEID="<<m_hwmodeid);
+   }
+   // SSMAP for checking input files
+   FTKPlaneMap *pmap=0;
+   FTKRegionMap *rmap=0;
+   ATH_MSG_INFO ("pmap_path = \""<<m_pmap_path<<"\"");
+   ATH_MSG_INFO ("rmap_path = \""<<m_rmap_path<<"\"");
+   ATH_MSG_INFO ("ssmap_path = \""<<m_ssmap_path<<"\"");
+   if(!m_pmap_path.empty()) {
+      pmap = new FTKPlaneMap(m_pmap_path.c_str());
+   } else {
+      ATH_MSG_INFO ("no plane map specified");
+   }
+   if(pmap) {
+      if(!m_rmap_path.empty() ) {
+         rmap = new FTKRegionMap(pmap, m_rmap_path.c_str());
+      } else {
+         ATH_MSG_INFO ("no tower map specified");
+      }
+   }
+   if(rmap) {
+      if(m_hwmodeid ==2) {
+         if(!m_modulelut_path.empty()) {
+            rmap->loadModuleIDLUT(m_modulelut_path.c_str());
+         } else {
+            ATH_MSG_ERROR ("no module LUT specified but hwmodeid==2");
+         }
+      } else {
+         delete rmap;
+         rmap=0;
+      }
+   }
+   if(rmap) {
+      if(!m_ssmap_path.empty()) {
+         m_ssmap = new FTKSSMap(rmap, m_ssmap_path.c_str(),false);
+      } else {
+         ATH_MSG_INFO ("no SS map specified");
+      }
+   }
+
    // do merging
-   error += merger.DoMerge(m_MinCov,m_Compression);
+   error += merger.DoMerge(m_MinCov,m_Compression,
+                           m_ssmap,m_curreg,m_hwmodeid);
    // write out in addition ascii-file if output file did not ended with '.root'
    if ( m_TextOutFile!="" && !TString(m_TextOutFile).EndsWith(".root") ) 
       merger.DoTextExport(m_TextOutFile);
diff --git a/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKDetectorTool.h b/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKDetectorTool.h
index 8e00b412847579554bb6cd5b02cd0196b75ed537..0eda6c5559803acba4d074b20add245e57abf06d 100644
--- a/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKDetectorTool.h
+++ b/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKDetectorTool.h
@@ -112,6 +112,7 @@ class FTKDetectorTool :  virtual public FTKDetectorToolI,
   std::string m_sram_path_sct;
   std::string m_rmap_path;
   FTKRegionMap *m_rmap;
+  bool m_dumpAllModules;
 public:
   
   
diff --git a/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKMergeRoot.h b/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKMergeRoot.h
index 2255066e99802cb0317f91291e9223c794d473b5..c9200cd46ba524d0956ad641dd7b75b18c072a00 100644
--- a/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKMergeRoot.h
+++ b/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKMergeRoot.h
@@ -19,13 +19,16 @@
 #include <TDirectory.h>
 #include "TrigFTKSim/FTKLogging.h"
 
+class FTKSSMap;
+
 class FTKMergeRoot : FTKLogging {
 public:
    FTKMergeRoot(std::string outfilename);
    ~FTKMergeRoot();
    void DoTextImport();
    void DoTextExport(std::string const &TextOutFilename, int MinCoverage=1);
-   int DoMerge(int MinCoverage=1,int compression=1);
+   int DoMerge(int MinCoverage=1,int compression=1,
+               FTKSSMap *checkMap=0,int checkTower=-1,int checkHWmodeid=-1);
    void AddFile(std::string const &filename);
    void AddFiles(std::vector<std::string> const &filenames);
 
diff --git a/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKPatternBySector.h b/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKPatternBySector.h
index 574af3b277be5c8f232bf5a78d6ae997d0e6254f..b665383e0178087583d823f58bb8b0f8acbc50cc 100644
--- a/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKPatternBySector.h
+++ b/Trigger/TrigFTK/TrigFTKSim/TrigFTKSim/FTKPatternBySector.h
@@ -43,6 +43,7 @@
 #include "FTKPatternOneSector.h"
 
 class TDirectory;
+class FTKSSMap;
 
 class FTKPatternBySectorBase : public FTKLogging {
 public:
@@ -119,6 +120,11 @@ class FTKPatternBySectorReader : public virtual FTKPatternBySectorBase {
    int GetNextCoverage(int coverage) const;
    int GetCoverageFirstSector(int coverage) const;
    int GetCoverageNextSector(int coverage,int sector) const;
+
+   // consistency check of the bank data
+   // this checks whether all SSIDs of a sector/plane 
+   // are from the same module
+   virtual bool CheckConsistency(FTKSSMap *ssMap,int tower,int hwmodeid) const=0;
  protected:
    FTKPatternBySectorReader(char const *name);
    SectorByCoverage_t m_SectorByCoverage;
@@ -187,6 +193,7 @@ class FTKPatternBySectorForestReader : public FTKPatternBySectorReader {
    virtual int GetNextSector(int sector) const;
    virtual void RewindSector(int sector=-1);
    virtual FTKPatternOneSector *Read(int sector,int minCoverage); 
+   virtual bool CheckConsistency(FTKSSMap *ssMap,int tower,int hwmodeid) const;
  protected:
    typedef std::map<int,FTKPatternRootTreeReader *> PatternTreeBySectorRO_t;
    PatternTreeBySectorRO_t m_patterns;
@@ -321,6 +328,7 @@ class FTKPatternBySectorIndexedReader : public FTKPatternBySectorReader,
    virtual int ReadRaw(int firstSector,
                        std::list<FTKPatternOneSector *> &sectorList,
                        uint64_t maxPattern);
+   virtual bool CheckConsistency(FTKSSMap *ssMap,int tower,int hwmodeid) const;
  protected:
    TTree *m_dataTree;
    int InitializeIndex(TTree *indexTree,std::set<int> const *sectorList);
@@ -337,9 +345,8 @@ class FTKPatternBySectorIndexedReader : public FTKPatternBySectorReader,
       // number of patterns in this Block
       uint32_t m_nPattern;
    };
-   // first index: sector
-   // second index: coverage (multiple entries are possible - decoder change)
 
+   // indexed by coverage (multiple entries are possible - decoder change)
    typedef std::multimap<uint32_t,DataBlock_t> CoverageTable_t;
    typedef struct SectorInfo {
       // table ordered by coverage
@@ -348,6 +355,8 @@ class FTKPatternBySectorIndexedReader : public FTKPatternBySectorReader,
       CoverageTable_t::const_reverse_iterator m_coveragePtr;
       uint64_t m_nPattern;
    } SectorInfo_t;
+   
+   // indexed by Sector
    typedef std::map<uint32_t,SectorInfo_t> SectorTable_t;
    SectorTable_t m_sectorTable;
    FTKPatternWithCoverage *m_patternData;
diff --git a/Trigger/TrigFTK/TrigFTKSim/share/FTKDumpCond_12Libl123_jobOptions.py b/Trigger/TrigFTK/TrigFTKSim/share/FTKDumpCond_12Libl123_jobOptions.py
new file mode 100644
index 0000000000000000000000000000000000000000..bdee13623f756113fbb47bb73785256a2f183495
--- /dev/null
+++ b/Trigger/TrigFTK/TrigFTKSim/share/FTKDumpCond_12Libl123_jobOptions.py
@@ -0,0 +1,38 @@
+#-----------------------------------------------------------------------------
+# Athena imports
+#-----------------------------------------------------------------------------
+from AthenaCommon.AlgSequence import AlgSequence
+theJob = AlgSequence()
+
+#--------------------------------------------------------------
+# FTK algorithm inclusions
+#--------------------------------------------------------------
+from AthenaCommon.AppMgr import ToolSvc 
+from TrigFTKSim.TrigFTKSimConf import FTKDetectorTool, FTKDumpCondAlgo
+
+print "Add FTKDetector tool"
+FTKDet = FTKDetectorTool()
+FTKDet.FTK_BadModuleMapPath = "badModulemap_12LiblHW3D_FTK.bmap"
+FTKDet.ATLAS_BadModuleMapPath = "badModulemap_12LinlHW3D_ATLAS.bmap"
+FTKDet.dumpAllModules = True
+
+from PyJobTransforms.trfUtils import findFile
+
+pmap_path = findFile(os.environ['DATAPATH'], 'ftk_configuration/map_files/raw_12LiblHW.pmap')
+FTKDet.pmap_path = pmap_path
+rmap_path = findFile(os.environ['DATAPATH'], 'ftk_configuration/map_files/raw_12Libl64TmodB.tmap')
+FTKDet.rmap_path = rmap_path
+ToolSvc += FTKDet
+
+FTKDumpCond = FTKDumpCondAlgo( "FTKDumpCondAlgo" , OutputLevel=INFO)
+FTKDumpCond.IBLMode = 1
+FTKDumpCond.DumpBadModules = True
+FTKDumpCond.DumpGlobalToLocalMap = True
+FTKDumpCond.DumpModulePositions = True
+theJob += FTKDumpCond  
+
+print theJob
+
+
+
+
diff --git a/Trigger/TrigFTK/TrigFTKSim/share/FTKDumpCond_8LcIbl123_jobOptions.py b/Trigger/TrigFTK/TrigFTKSim/share/FTKDumpCond_8LcIbl123_jobOptions.py
index 100e31caef90dedb1083670b2d0bba16f9491b6f..0260979d6598f8020c2d8737689dd1a36cb54be6 100644
--- a/Trigger/TrigFTK/TrigFTKSim/share/FTKDumpCond_8LcIbl123_jobOptions.py
+++ b/Trigger/TrigFTK/TrigFTKSim/share/FTKDumpCond_8LcIbl123_jobOptions.py
@@ -14,8 +14,14 @@ print "Add FTKDetector tool"
 FTKDet = FTKDetectorTool()
 FTKDet.FTK_BadModuleMapPath = "badModulemap_8Lc_FTK.bmap"
 FTKDet.ATLAS_BadModuleMapPath = "badModulemap_8Lc_ATLAS.bmap"
-FTKDet.pmap_path = "x86_64-slc6-gcc62-opt/share/ftk_configuration/map_files/raw_8LcIbl123.pmap"
-FTKDet.rmap_path = "x86_64-slc6-gcc62-opt/share/ftk_configuration/map_files/raw_12Libl.tmap"
+FTKDet.dumpAllModules = True
+
+from PyJobTransforms.trfUtils import findFile
+
+pmap_path = findFile(os.environ['DATAPATH'], 'ftk_configuration/map_files/raw_8LcIbl3D123.pmap')
+FTKDet.pmap_path = pmap_path
+rmap_path = findFile(os.environ['DATAPATH'], 'ftk_configuration/map_files/raw_12Libl64TmodB.tmap')
+FTKDet.rmap_path = rmap_path
 ToolSvc += FTKDet
 
 FTKDumpCond = FTKDumpCondAlgo( "FTKDumpCondAlgo" , OutputLevel=INFO)
diff --git a/Trigger/TrigFTK/TrigFTKSim/src/FTKDetectorTool.cxx b/Trigger/TrigFTK/TrigFTKSim/src/FTKDetectorTool.cxx
index 5bf579032ae2a49eab75acc63d1fe3fc787c16e0..3d384a9da946e7e76fbad1adc29363ce1e2a2cbc 100644
--- a/Trigger/TrigFTK/TrigFTKSim/src/FTKDetectorTool.cxx
+++ b/Trigger/TrigFTK/TrigFTKSim/src/FTKDetectorTool.cxx
@@ -3,6 +3,7 @@
 */
 
 #include "TrigFTKSim/FTKDetectorTool.h"
+#include "TrigFTKSim/FTKSetup.h"
 
 #include "EventInfo/EventInfo.h"
 #include "EventInfo/EventID.h"
@@ -43,7 +44,8 @@ FTKDetectorTool::FTKDetectorTool(const std::string &algname,const std::string &n
   m_sram_path_pix("sram_lookup_pixel.txt"),
   m_sram_path_sct("sram_lookup_sct.txt"),
   m_rmap_path(""),
-  m_rmap(0x0)
+    m_rmap(0x0),
+    m_dumpAllModules(false)
 {
   declareInterface<FTKDetectorToolI>(this);
 
@@ -60,6 +62,7 @@ FTKDetectorTool::FTKDetectorTool(const std::string &algname,const std::string &n
   declareProperty("SRAMPathPixel",m_sram_path_pix);
   declareProperty("SRAMPathSCT",m_sram_path_sct);
   declareProperty("rmap_path",m_rmap_path);
+  declareProperty("dumpAllModules",m_dumpAllModules);
 }
 
 FTKDetectorTool::~FTKDetectorTool()
@@ -148,7 +151,8 @@ void FTKDetectorTool::makeBadModuleMap(){
     const InDetDD::SiDetectorElement* sielement( *i );
     Identifier id = sielement->identify();
     IdentifierHash idhash = sielement->identifyHash();
-    const bool is_bad = !(m_pixelCondSummarySvc->isGood( idhash ));
+    bool is_bad = !(m_pixelCondSummarySvc->isGood( idhash ));
+    if(m_dumpAllModules) is_bad =true;
     if(is_bad){
       FTKRawHit tmpmodraw;
 
@@ -172,7 +176,8 @@ void FTKDetectorTool::makeBadModuleMap(){
     const InDetDD::SiDetectorElement* sielement( *i );
     Identifier id = sielement->identify();
     IdentifierHash idhash = sielement->identifyHash();
-    const bool is_bad = !(m_sctCondSummarySvc->isGood( idhash ));
+    bool is_bad = !(m_sctCondSummarySvc->isGood( idhash ));
+    if(m_dumpAllModules) is_bad =true;
     if(is_bad){
       FTKRawHit tmpmodraw;
 
@@ -224,7 +229,8 @@ void FTKDetectorTool::dumpDeadModuleSummary()
     const InDetDD::SiDetectorElement* sielement( *i );
     Identifier id = sielement->identify();
     IdentifierHash idhash = sielement->identifyHash();
-    const bool is_bad = !(m_pixelCondSummarySvc->isGood( idhash ));
+    bool is_bad = !(m_pixelCondSummarySvc->isGood( idhash ));
+    if(m_dumpAllModules) is_bad =true;
     if(is_bad){
 
       mapfile_ATLAS_BadModuleMap << "B\t"
@@ -233,7 +239,7 @@ void FTKDetectorTool::dumpDeadModuleSummary()
 				 << m_pixelId->layer_disk(id) << '\t'
 				 << m_pixelId->phi_module(id) << '\t'
 				 << m_pixelId->eta_module(id) << '\t'
-				 << 0 //it means m_pixelId don't have side(id)
+				 << 0 << '\t' //it means m_pixelId don't have side(id)
 				 << idhash << '\t'
 				 << std::endl;
     }
@@ -242,7 +248,8 @@ void FTKDetectorTool::dumpDeadModuleSummary()
     const InDetDD::SiDetectorElement* sielement( *i );
     Identifier id = sielement->identify();
     IdentifierHash idhash = sielement->identifyHash();
-    const bool is_bad = !(m_sctCondSummarySvc->isGood( idhash ));
+    bool is_bad = !(m_sctCondSummarySvc->isGood( idhash ));
+    if(m_dumpAllModules) is_bad =true;
     if(is_bad){
       mapfile_ATLAS_BadModuleMap  << "B\t"
 				 << 0  << '\t'  // 1  pixel 0 sct
@@ -401,7 +408,7 @@ void FTKDetectorTool::dumpGlobalToLocalModuleMap() {
   ofstream fout(m_global2local_path.c_str());
   for (int ireg=0;ireg!=nregions;++ireg) { // loop over the regions
       for (int ip=0;ip!=nplanes;++ip) { // loop over the regions
-          m_log << MSG::INFO << "Region " << ireg << ", layer" << ip << " has " << grouped_modules[ireg][ip].size() << " modules" << endmsg;
+         //m_log << MSG::INFO << "Region " << ireg << ", layer" << ip << " has " << grouped_modules[ireg][ip].size() << " modules" << endmsg;
           unsigned int modnumber(0);
           for (auto curhash: grouped_modules[ireg][ip]) {
               fout << ireg << '\t' << ip << '\t' << curhash << '\t' << modnumber++ << endl;
@@ -480,34 +487,135 @@ void FTKDetectorTool::dumpModulePositions() {
    m_log << MSG::INFO << "dumpModulePositions"<< endmsg; 
    TFile *output=new TFile("FTKmodulePositions.root","recreate");
    TTree *t=new TTree("modulePositions","modulePositions");
-   int idhash;
+   Int_t idhash;
+   Int_t isbad,isBLayer,isPixel,barrel_endcap,layer_disk,phi_module,eta_module;
+   Int_t side,strip,phi_index,eta_index,hitSector,section,swapPhi,swapEta;
    Float_t phi[2],r[2],z[2];
+   Float_t center[3],phiAxis[3],etaAxis[3],width,length,phiPitch,etaPitch;
+   Float_t sinTilt;
    t->Branch("id",&idhash,"id/I");
+   t->Branch("isPixel",&isPixel,"isPixel/I");
+   t->Branch("isBLayer",&isBLayer,"isBLayer/I");
+   t->Branch("barrel_endcap",&barrel_endcap,"barrel_endcap/I");
+   t->Branch("layer_disk",&layer_disk,"layer_disk/I");
+   t->Branch("phi_module",&phi_module,"phi_module/I");
+   t->Branch("eta_module",&eta_module,"eta_module/I");
+   t->Branch("side",&side,"side/I");
+   t->Branch("section",&section,"section/I");
+   t->Branch("phi_index",&phi_index,"phi_index/I");
+   t->Branch("eta_index",&eta_index,"eta_index/I");
+   t->Branch("strip",&strip,"strip/I");
+   t->Branch("width",&width,"width/F");
+   t->Branch("length",&length,"length/F");
+   t->Branch("phiPitch",&phiPitch,"phiPitch/F");
+   t->Branch("etaPitch",&etaPitch,"etaPitch/F");
+   t->Branch("phiAxis",phiAxis,"phiAxis[3]/F");
+   t->Branch("etaAxis",etaAxis,"etaAxis[3]/F");
+   t->Branch("swapPhi",&swapPhi,"swapPhi/I");
+   t->Branch("swapEta",&swapEta,"swapEta/I");
+   t->Branch("sinTilt",&sinTilt,"sinTilt/F");
+   t->Branch("center",center,"center[3]/F");
    t->Branch("phi",phi,"phi[2]/F");
    t->Branch("r",r,"r[2]/F");
    t->Branch("z",z,"z[2]/F");
-   for( InDetDD::SiDetectorElementCollection::const_iterator i=m_PIX_mgr->getDetectorElementBegin(), f=m_PIX_mgr->getDetectorElementEnd() ; i!=f; ++i ) {
-      const InDetDD::SiDetectorElement* sielement( *i );
-      idhash=sielement->identifyHash();
-      r[0]=sielement->rMin();
-      r[1]=sielement->rMax();
-      z[0]=sielement->zMin();
-      z[1]=sielement->zMax();
-      phi[0]=sielement->phiMin();
-      phi[1]=sielement->phiMax();
-      t->Fill();
-   }
-   for( InDetDD::SiDetectorElementCollection::const_iterator i=m_SCT_mgr->getDetectorElementBegin(), f=m_SCT_mgr->getDetectorElementEnd() ; i!=f; ++i ) {
-      const InDetDD::SiDetectorElement* sielement( *i );
-      idhash=sielement->identifyHash();
-      r[0]=sielement->rMin();
-      r[1]=sielement->rMax();
-      z[0]=sielement->zMin();
-      z[1]=sielement->zMax();
-      phi[0]=sielement->phiMin();
-      phi[1]=sielement->phiMax();
-      t->Fill();
+   t->Branch("isbad",&isbad,"isbad/I");
+   t->Branch("hitSector",&hitSector,"hitSector/I");
+   InDetDD::SiDetectorElementCollection::const_iterator iStart[2],iEnd[2];
+   iStart[0]=m_SCT_mgr->getDetectorElementBegin();
+   iEnd[0]=m_SCT_mgr->getDetectorElementEnd();
+   iStart[1]=m_PIX_mgr->getDetectorElementBegin();
+   iEnd[1]=m_PIX_mgr->getDetectorElementEnd();
+   for(isPixel=0;isPixel<2;isPixel++) {
+      //m_log << MSG::INFO <<"dumpModulePositions() isPixel="<<isPixel<<endmsg;
+     for( InDetDD::SiDetectorElementCollection::const_iterator
+              i=iStart[isPixel];i!=iEnd[isPixel];i++) {
+         const InDetDD::SiDetectorElement* sielement( *i );
+         idhash=sielement->identifyHash();
+         Identifier id = sielement->identify();
+         isBLayer=sielement->isBlayer();
+         if(isPixel) {
+            barrel_endcap=m_pixelId->barrel_ec(id);
+            layer_disk=m_pixelId->layer_disk(id);
+            phi_module=m_pixelId->phi_module(id);
+            eta_module=m_pixelId->eta_module(id);
+            side=-1;
+            strip=-1;
+            phi_index=m_pixelId->phi_index(id);
+            eta_index=m_pixelId->eta_index(id);
+            section=m_pmap->getMap(ftk::PIXEL,!(barrel_endcap==0),
+                                   layer_disk).getSection();
+            // see FTKRawHit
+            if ((FTKSetup::getFTKSetup().getIBLMode()==1) &&
+                (layer_disk==0) &&
+                (barrel_endcap==0)) {
+               // IBL module, without 3d sensors
+               hitSector = phi_module*1000+eta_module+8;
+            } else if ((FTKSetup::getFTKSetup().getIBLMode()==2) &&
+                       (layer_disk==0) && (barrel_endcap==0)) {
+               // IBL module with 3d sensors, 20 modules in total
+               hitSector = phi_module*1000+eta_module+10;
+            }  else if(barrel_endcap) {
+               hitSector=
+                  phi_module*1000+
+                  (eta_module+1)*20 + (barrel_endcap == ftk::NEGEC)*10
+                  + section;
+            } else {
+               // is a generic module of the barrel region
+               hitSector = phi_module*1000+eta_module+6;
+            }
+         } else {
+            barrel_endcap=m_sctId->barrel_ec(id);
+            layer_disk=m_sctId->layer_disk(id);
+            phi_module=m_sctId->phi_module(id);
+            eta_module=m_sctId->eta_module(id);
+            side=m_sctId->side(id);
+            strip=m_sctId->strip(id);
+            phi_index=-1;
+            eta_index=-1;
+            section=m_pmap->getMap(ftk::SCT,!(barrel_endcap==0),
+                                   layer_disk).getSection();
+            // see FTKRawHit
+            if(barrel_endcap) {
+               hitSector=
+                  phi_module*1000+
+                  (eta_module+1)*20 + (barrel_endcap == ftk::NEGEC)*10
+                  + section;
+            } else {
+               // is a generic module of the barrel region
+               hitSector = phi_module*1000+eta_module+6;
+            }
+         }
+         if(FTKSetup::getFTKSetup().getITkMode() ) {
+            // see FTKRawHit
+            hitSector = (phi_module*100000) + ((eta_module+60)*100) +
+               ((barrel_endcap+2) *10) + section;
+         }
+         width=sielement->width();
+         length=sielement->length();
+         phiPitch=sielement->phiPitch();
+         etaPitch=sielement->etaPitch();
+         //phiDir=sielement->hitPhiDirection();
+         //etaDir=sielement->hitEtaDirection();
+         swapPhi=sielement->swapPhiReadoutDirection() ? 1 : 0;
+         swapEta=sielement->swapEtaReadoutDirection() ? 1 : 0;
+         sinTilt=sielement->sinTilt();
+         for(int k=0;k<3;k++) {
+            center[k]= sielement->center()[k];
+            phiAxis[k]= sielement->phiAxis()[k];
+            etaAxis[k]= sielement->etaAxis()[k];
+         }
+         r[0]=sielement->rMin();
+         r[1]=sielement->rMax();
+         z[0]=sielement->zMin();
+         z[1]=sielement->zMax();
+         phi[0]=sielement->phiMin();
+         phi[1]=sielement->phiMax();
+         isbad=m_sctCondSummarySvc->isGood( idhash ) ? 0 : 1;
+         t->Fill();
+      }
    }
+   //m_log << MSG::INFO <<"dumpModulePositions() done"<<endmsg;
    t->Write();
+   output->Close();
    delete output;
 }
diff --git a/Trigger/TrigFTK/TrigFTKSim/src/FTKMergeRoot.cxx b/Trigger/TrigFTK/TrigFTKSim/src/FTKMergeRoot.cxx
index c6c144757cd3dc999c75569fbc107e8152bf975d..f6e875444d3ef09c06fc4e6ebbc430002a1d74ce 100644
--- a/Trigger/TrigFTK/TrigFTKSim/src/FTKMergeRoot.cxx
+++ b/Trigger/TrigFTK/TrigFTKSim/src/FTKMergeRoot.cxx
@@ -91,7 +91,8 @@ void FTKMergeRoot::AddFiles(vector<string> const &filenames){
 
 
 //___________________________________________________________________________________________ //
-int FTKMergeRoot::DoMerge(int MinCoverage,int compression){
+int FTKMergeRoot::DoMerge(int MinCoverage,int compression,
+                          FTKSSMap *checkMap,int checkTower,int checkHWmodeid) {
    //! Merge all input files into one root file
    //! Return number of merged files
 
@@ -134,6 +135,13 @@ int FTKMergeRoot::DoMerge(int MinCoverage,int compression){
       delete input;
       return 2;
    }
+   if(checkMap && (checkTower>=0) && (checkHWmodeid>=0)) {
+      Info("DoMerge")<<"Performing input file consistency check\n";
+      input->CheckConsistency(checkMap,checkTower,checkHWmodeid);
+   } else {
+      Warning("DoMerge")<<"No input file consistency check "
+                        <<"\n";
+   }
    if((input->GetContentType()!=FTKPatternBySectorBase::CONTENT_NOTMERGED )
       &&(!MinCoverage)&&(chain.GetLength()==1)) { // nothing to do
       Info("DoMerge")
diff --git a/Trigger/TrigFTK/TrigFTKSim/src/FTKPatternBySector.cxx b/Trigger/TrigFTK/TrigFTKSim/src/FTKPatternBySector.cxx
index 990b588c5c04334daa4ffef4615963b918c69dd0..88c33005c541511aad3347be90a9e09eec94d7c0 100644
--- a/Trigger/TrigFTK/TrigFTKSim/src/FTKPatternBySector.cxx
+++ b/Trigger/TrigFTK/TrigFTKSim/src/FTKPatternBySector.cxx
@@ -14,6 +14,7 @@
 
 #include "TrigFTKSim/FTKPatternBySector.h"
 #include "TrigFTKSim/FTKRootFile.h"
+#include "TrigFTKSim/FTKSSMap.h"
 #include <TList.h>
 #include <TFile.h>
 #include <TChain.h>
@@ -534,6 +535,14 @@ FTKPatternBySectorForestReader::FTKPatternBySectorForestReader(FTKRootFileChain
    InitializeSectorByCoverageTable();
 }
 
+bool FTKPatternBySectorForestReader::CheckConsistency
+(FTKSSMap *ssMap,int tower,int hwmodeid) const {
+   if(ssMap &&(tower>=0) &&(hwmodeid>=0)) {
+      Warning("CheckConsistency")<<"not implemented\n";
+   }
+   return true;
+}
+
 FTKPatternBySectorForestReader::FTKPatternBySectorForestReader
 (TDirectory &dir,set<int> const *sectorlist,
  int *error)
@@ -1096,7 +1105,8 @@ int FTKPatternBySectorIndexedReader::InitializeIndex
    indexTree->SetBranchAddress(s_sectorBranchName,&sector);
    indexTree->SetBranchAddress(s_ncovBranchName,&ncov);
 
-   // first loop over the tree -> ncov,sector,ndecoder%d
+   // loop over the tree to find ncov,sector,ndecoder%d
+   // store result in local variables 
    for(int iIndex=0;iIndex<nIndex;iIndex++) {
       indexTree->GetEntry(iIndex);
       DecoderWithIndex_t &decoderWithIndex=decoderWithIndexTable[iIndex];
@@ -1108,6 +1118,7 @@ int FTKPatternBySectorIndexedReader::InitializeIndex
    }
    uint32_t maxNCov=0;
    uint32_t decoderSize=0;
+   // determine total size of decoder table
    for(int iIndex=0;iIndex<nIndex;iIndex++) {
       DecoderWithIndex_t const &decoderWithIndex=
          decoderWithIndexTable[iIndex];
@@ -1118,8 +1129,9 @@ int FTKPatternBySectorIndexedReader::InitializeIndex
    }
    Info("InitializeIndex")
       <<"decoder size="<<decoderSize<<" maxNCov="<<maxNCov<<" \n";
+   // allocate decoder tables
    m_decoderData.resize(decoderSize);
-   m_decoderDataPtr.resize(nIndex*nPlane);
+   m_decoderDataPtr.resize(nIndex*nPlane+1);
 
    vector<uint32_t> bufferCoverage(maxNCov);
    vector<uint32_t> bufferNPattern(maxNCov);
@@ -1130,8 +1142,9 @@ int FTKPatternBySectorIndexedReader::InitializeIndex
    uint32_t lastSector=0;
    SetContentType(CONTENT_MERGED);
    uint32_t cpatternEntry=0;
-   Info("InitializeIndex")<<"second loop\n";
+   Info("InitializeIndex")<<"read decoder data and data pointers\n";
    decoderSize=0;
+   // loop over all entries in the index ttree 
    for(int iIndex=0;iIndex<nIndex;iIndex++) {
       DecoderWithIndex_t const &decoderWithIndex=
          decoderWithIndexTable[iIndex];
@@ -1141,6 +1154,7 @@ int FTKPatternBySectorIndexedReader::InitializeIndex
                                      m_decoderDataPtr[iIndex*nPlane+plane]);
          decoderSize+= decoderWithIndex.m_decoderSize[plane];
       }
+      m_decoderDataPtr[(iIndex+1)*nPlane]=&m_decoderData[decoderSize];
       indexTree->GetEntry(iIndex);
 
       uint32_t sector=decoderWithIndex.m_sectorID;
@@ -1191,6 +1205,105 @@ int FTKPatternBySectorIndexedReader::InitializeIndex
    return error;
 }
 
+bool FTKPatternBySectorIndexedReader::CheckConsistency
+(FTKSSMap *ssMap,int tower,int hwmodeid) 
+   const {
+   // loop over all sectors
+   int nPlane=GetNLayers();
+   int error=0;
+   std::set<int> badSector;
+   for(SectorTable_t::const_iterator iSector=m_sectorTable.begin();
+       iSector!=m_sectorTable.end();iSector++) {
+      uint32_t sectorID=(*iSector).first;
+      SectorInfo const &sectorInfo((*iSector).second);
+      std::vector<std::set<int> > moduleSet(nPlane);
+      for(CoverageTable_t::const_iterator
+             iCov=sectorInfo.m_coverageTable.begin();
+          iCov!=sectorInfo.m_coverageTable.end();iCov++) {
+         DataBlock_t const &dataBlock((*iCov).second);
+         for(int plane=0;plane<nPlane;plane++) {
+            uint32_t const *decoderData=dataBlock.m_decoderDataPtr[plane];
+            int decoderSize=dataBlock.m_decoderDataPtr[plane+1]-decoderData;
+            bool isPixel=ssMap->getPlaneMap()->isPixel(plane);
+            for(int iSSID=0;iSSID<decoderSize;iSSID++) {
+               int ssid=decoderData[iSSID];
+               int phimod=-1,etacode=-1,section=0,moduleID=-1;
+               int localX=0,localY=0;
+               if(hwmodeid==0) {
+                  if(isPixel) {
+                     ssMap->decodeSSxy
+                        (ssid,plane,section,phimod,localX,etacode,localY);
+                     moduleID=ssMap->getSSxy
+                        (plane,section,phimod,etacode,0,0);
+                  } else {
+                     ssMap->decodeSSx
+                        (ssid,plane,section,phimod,localX,etacode);
+                     moduleID=ssMap->getSSx(plane,section,phimod,etacode,0);
+                  }
+               } else if(hwmodeid==2) {
+                  if (isPixel) {
+                     ssMap->decodeSSTowerXY(ssid,tower,plane,section,
+                                            moduleID,localX,localY);
+                  } else {
+                     ssMap->decodeSSTowerX(ssid,tower,plane,section,
+                                           moduleID,localX);
+                  }
+               }
+               moduleSet[plane].insert(moduleID);
+            }
+         }
+      }
+      bool isBad=false;
+      for(int plane=0;plane<nPlane;plane++) {
+         if(moduleSet[plane].size()>1) {
+            isBad=true;
+            if(error<100) {
+               std::cout<<" sector="<<sectorID<<" plane="<<plane<<" [";
+               for(std::set<int>::const_iterator id=moduleSet[plane].begin();
+                   id!=moduleSet[plane].end();id++) {
+                  std::cout<<" "<< *id;
+               }
+               std::cout<<"]\n";
+            }
+            error++;
+         }
+      }
+      if(isBad) badSector.insert(sectorID);
+   }
+   if(error) {
+      std::cout<<"List of bad sectors:\n";
+      std::map<int,int> sectorList;
+      int sequenceStart=-2;
+      int previous=-2;
+      for(std::set<int>::const_iterator i=badSector.begin();
+          i!=badSector.end();i++) {
+         int sector=(*i);
+         if(sector==previous+1) {
+            previous++;
+         } else {
+            sequenceStart=(*i);
+         }
+         previous=(*i);
+         sectorList[sequenceStart]++;
+      }
+      for(std::map<int,int>::const_iterator i=sectorList.begin();
+          i!=sectorList.end();i++) {
+         std::cout<<" "<<(*i).first;
+         if((*i).second>1) {
+            std::cout<<"-"<<(*i).first+(*i).second-1;
+         }
+      }
+      std::cout<<"\n";
+   }
+   if(error) {
+      Fatal("CheckConsistency")
+         <<"input patterns corrupted: several modules are assigned to a given (sector,plane) pair\n";
+   } else {
+      Info("CheckConsistency")<<"input patterns seem consistent\n";
+   }
+   return error==0;
+}
+
 FTKPatternBySectorIndexedReader::FTKPatternBySectorIndexedReader
 (TDirectory &dir,set<int> const *sectorList,int *error)
    : FTKPatternBySectorReader("FTKPatternBySectorIndexedReader") {
@@ -1238,7 +1351,7 @@ FTKPatternBySectorIndexedReader::FTKPatternBySectorIndexedReader
       if(error) {
          *error=1;
       } else {
-         Error("FTKPatternBySectorIndexedReader")<<"not implemented\n";
+         Error("FTKPatternBySectorIndexedReader")<<"pattern data not found\n";
       }
    }
 }
diff --git a/Trigger/TrigFTK/TrigFTKSim/src/FTK_CompressedAMBank.cxx b/Trigger/TrigFTK/TrigFTKSim/src/FTK_CompressedAMBank.cxx
index d6a4b3bdf70c427782a7a6872489c2dae858b5c5..d75636ba993b87c596ae4c843c5ebd67fc216958 100644
--- a/Trigger/TrigFTK/TrigFTKSim/src/FTK_CompressedAMBank.cxx
+++ b/Trigger/TrigFTK/TrigFTKSim/src/FTK_CompressedAMBank.cxx
@@ -12,15 +12,18 @@
 #include <stdlib.h>
 #include <fstream>
 #include <iomanip>
-#include <TFile.h>
+//#include <TFile.h>
 #include <TTree.h>
 #include <TLeaf.h>
 #include <TString.h>
 #include <TString.h>
 #include <TRegexp.h>
 
+
+#ifdef SEARCH_MEMORY_LEAK
 #include <sys/time.h>
 #include <sys/resource.h>
+
 static void printVmemUsage(char const *text) {
    struct rusage usage;
    getrusage(RUSAGE_SELF,&usage);
@@ -28,6 +31,9 @@ static void printVmemUsage(char const *text) {
             <<" "<<usage.ru_maxrss/1024./1024.<<"G"
       <<"\n";
 }
+#endif
+
+#define CONSISTENCY_CHECK
 
 /*
   class FTK_CompressedAMBank
@@ -503,7 +509,7 @@ int FTK_CompressedAMBank::writePCachedBankFile
       // loop over all patterns in the sector
       sectorID=sector;
       for(int ipattern=firstPattern;ipattern<=lastPattern;ipattern++) {
-         // skip over reserved patterns
+         // skip over reserved patterns (HW compatibility)
          if(isReservedPatternId(ipattern)) continue;
          // write special pattern if required
          while(patternID<ipattern) {
@@ -1071,7 +1077,7 @@ void FTK_CompressedAMBank::insertSSID
 
    // if there is no dcSSID, convert TSP to DC
    int dcSSID=dcSSID0;
-   // if TSP is valid, conver to DC
+   // if TSP is valid, convert to DC
    if(tspSSID!=s_WILDCARDid) {
       // (a) or (c)
       if(tspSSID!=s_INVALIDid) {
@@ -1334,8 +1340,8 @@ int FTK_CompressedAMBank::readPCachedBank(TDirectory *inputDir,int nlamb) {
                Debug("readPCachedBank")
                   <<iPattern<<" sector="<<pattern->getSectorID()<<"\n";
             // NOTE: pos is a reference, so increasing pos (below)
-            //   automatically selects teh proper position for reading
-            //   the next pattren in this sector
+            //   automatically selects the proper position for reading
+            //   the next pattern in this sector
             int &pos=sectorPointer[pattern->getSectorID()].second;
             for(int i=0;i<nLayer;i++) {
                // SSID layer 0..N-1
@@ -1360,6 +1366,14 @@ int FTK_CompressedAMBank::readPCachedBank(TDirectory *inputDir,int nlamb) {
    return error;
 }
 
+//
+// importDCpatterns()
+//   nLayer: number of planes
+//   offsetSSID: number of int per pattern
+//   ssidData: pattern data
+//   sectorPointer: first,last index of a sector in ssidData
+//   nlamb: number of LAMB boards for grouping sectors
+
 void FTK_CompressedAMBank::importDCpatterns
 (int nLayer,int offsetSSID,int32_t *ssidData,
  VECTOR<std::pair<int,int> > const &sectorPointer,int nlamb) {
@@ -1409,19 +1423,22 @@ void FTK_CompressedAMBank::importDCpatterns
       }
    }
    uint32_t ipattSector=0;
+   // set number of layers
    m_bank.m_PatternByLayer.resize(nLayer);
    for(int iLayer=0;iLayer<nLayer;iLayer++) {
+      // resize to the maximum sector ID
       m_bank.m_PatternByLayer[iLayer].
          m_CompressedDeltaBySector.resize(sectorPointer.size());
    }
-   // subregion loop
+   // subregion (LAMB) loop
    if(nlamb<=0) nlamb=1;
    for(int ilamb=0;ilamb<nlamb;ilamb++) {
       //
       // sector loop
       unsigned max_sectorByNlamb=(sectorPointer.size()-1)/nlamb;
       unsigned top_sectorByNlamb=0;
-      while(top_sectorByNlamb+1 <= max_sectorByNlamb) top_sectorByNlamb=(top_sectorByNlamb+1)*2-1;
+      while(top_sectorByNlamb+1 <= max_sectorByNlamb)
+         top_sectorByNlamb=(top_sectorByNlamb+1)*2-1;
       // here: top_sectorByLamb has all bits set to one and is larger or equal the largest sector/nlamb
       unsigned leadingBitMask=(top_sectorByNlamb>>1)+1;
       unsigned sectorByLamb=0;
@@ -1461,7 +1478,7 @@ void FTK_CompressedAMBank::importDCpatterns
 #endif
          // 
          // loop two times over all patterns in this sector
-         //  first look: count patterns
+         //  first loop: count patterns
          //  second loop: allocate memory and store patterns
          uint32_t ipatt;
          //
@@ -1507,6 +1524,7 @@ void FTK_CompressedAMBank::importDCpatterns
             // loop over all patterns in this sector
             for(int iPattern=0;iPattern<nPattern;iPattern++) {
                // reserve special pattern IDs as required by hardware
+               // in the compressed bank, these IDs are simply not used
                if(isReservedPatternId(ipatt)) {
                   /* std::cout<<"Skipping reserved pattern "
                      <<std::setbase(16)<<ipatt<<std::setbase(10)<<"\n"; */
@@ -1646,20 +1664,26 @@ void FTK_CompressedAMBank::importDCpatterns
                   }
                }
                ipatt++;
-            }
+            } // end loop over nPattern
             if(iLoop) {
                // extract auxillary information (coverage and #TSP patterns)
                if(offsetSSID>=nLayer+4) {
                   m_bank.m_numTSP.resize(ipatt);
                   m_bank.m_coverage.resize(ipatt);
-                  for(size_t iPattern=0;iPattern<ipatt-ipattSector;iPattern++) {
+                  ipatt=ipattSector;
+                  for(int iPattern=0;iPattern<nPattern;iPattern++) {
+                     if(isReservedPatternId(ipatt)) {
+                        // skip over reserved IDs
+                        ipatt++;
+                     }
                      int const *patternData=
                         patternDataSector+iPattern*offsetSSID;
                      // Auxillary information for this pattern
-                      m_bank.m_numTSP[ipattSector+iPattern]=
+                      m_bank.m_numTSP[ipatt]=
                          patternData[nLayer+2];
-                      m_bank.m_coverage[ipattSector+iPattern]=
+                      m_bank.m_coverage[ipatt]=
                          patternData[nLayer+3];
+                      ipatt++;
                   }
                }
             }
@@ -1670,8 +1694,8 @@ void FTK_CompressedAMBank::importDCpatterns
             Debug("importDCpatterns")
                <<"sector "<<sector<<" nPatt="<<ipatt<<"\n";
          }
-      }
-   }
+      } // end loop over sectors
+   } // end loop over subregions
 }
 
 void FTK_CompressedAMBank::erase(void) {
@@ -2056,10 +2080,10 @@ void FTK_CompressedAMBank::readBankPostprocessing(char const *where) {
                 dcIndexTable,dcHbBitsLayer,dcBitsLookup1,dcBitsLookup2,m_bank);
             if(extractor.getSSIDindex()<0) {
                Fatal(where)
-                  <<"problem with sector/SSID indexing (multi-m_pattern)\n";
+                  <<"problem with sector/SSID indexing (multi-pattern)\n";
             }
             //
-            // m_pattern data for this (layer,ssid,sector)
+            // pattern data for this (layer,ssid,sector)
             SectorData const &sectordata=(*sector).second;
             patternLoop(extractor,
                         layerData.m_CompressedDeltaBySector
@@ -2110,10 +2134,10 @@ void FTK_CompressedAMBank::readBankPostprocessing(char const *where) {
       <<" number of patterns="<<m_npatterns
       <<" (0x"<<std::setbase(16)<<m_npatterns<<std::setbase(10)<<")\n";
    Info(where)
-      <<"number of TSP-SSIDs per m_pattern="
+      <<"number of TSP-SSIDs per pattern="
       <<(m_npatterns ? (patternTSPcountTotal/(double)m_npatterns) : 0)<<"\n";
    Info(where)
-      <<"number of encoded TSP-patterns per DC-m_pattern="
+      <<"number of encoded TSP-patterns per DC-pattern="
       <<(m_npatterns ? (nTSPpatterns/(double)m_npatterns) : 0)<<"\n";
    Info(where)
       <<"average number of DC-patterns per sector="
@@ -2121,7 +2145,7 @@ void FTK_CompressedAMBank::readBankPostprocessing(char const *where) {
       <<" min="<<minPattern<<" max="<<maxPattern<<"\n";
    for(unsigned i=0;i<patternTSPcount.size();i++) {
       Info(where)
-         <<"plane="<<i<<" number of TSP/m_pattern="
+         <<"plane="<<i<<" number of TSP/pattern="
          << ((m_npatterns > 0 ) ? (patternTSPcount[i]/(double)m_npatterns)
              : - 1) <<"\n";
 
@@ -2137,13 +2161,105 @@ void FTK_CompressedAMBank::readBankPostprocessing(char const *where) {
                         memoryBuffers)/1024/1024
       <<" MB\n";
    Info(where)
-      <<"bytes per m_pattern and layer: SSID="<<memorySSIDlookup/
+      <<"bytes per pattern and layer: SSID="<<memorySSIDlookup/
       (double)(m_npatterns*getNPlanes())
       <<" patternID="<<memoryPatternIDlookup/(double)
       (m_npatterns*getNPlanes())
       <<" total="<<(memorySSIDlookup+memoryPatternIDlookup)/
       (double)(m_npatterns*getNPlanes())<<"\n";
 
+
+   int error=0;
+
+#ifdef CONSISTENCY_CHECK
+   // corruption test of SSIDs
+   // loop over all planes and SSIDS
+   // check whether the SSID correponds to a valid module number
+   int nPrint=100;
+   for(unsigned iPlane=0;iPlane<dcSSIDBySectorLayer.size();iPlane++) {
+      PatternBySectorSSidMap_t const &planeData=
+         m_bank.m_PatternByLayer[iPlane].m_SSidData;
+      for(PatternBySectorSSidMap_t::const_iterator
+             iSSid=planeData.begin();iSSid!=planeData.end();++iSSid) {
+         if(((*iSSid).first!=s_WILDCARDid)&&((*iSSid).first!=s_INVALIDid)) {
+            int moduleId=-1;
+            getDCssidSlow(iPlane,
+                          (*(*iSSid).second.begin()).first,
+                          (*iSSid).first,&moduleId);
+            int hash=-1;
+            if(moduleId>=0) {
+               if (getHWModeSS_tsp()==0) {
+                  hash=moduleId;
+               } else {
+                  hash=getSSMapTSP()->getRegionMap()
+                     ->getGlobalId(getBankID(),iPlane,moduleId);
+               }
+            }
+            if(hash<0) {
+               error++;
+               if(nPrint) {
+                  std::cout<<"invalid SSID="<<(*iSSid).first
+                           <<" (bad module ID) plane="<<iPlane<<"\n";
+                  nPrint--;
+               }
+            }
+         }
+      }
+   }
+   if(error) {
+      Fatal(where)<<"invalid SSIDs ("<<error<<")in pattern bank\n";
+   }
+
+   // corruption test of sector structures
+   // loop over all planes and all SSIDs
+   // construct table of module IDs for each sector
+   // verify that there is only one well-defined module per sector and plane
+   error=0;
+   for(unsigned iPlane=0;iPlane<dcSSIDBySectorLayer.size();iPlane++) {
+      VECTOR<std::set<int> > modulesBySector(maxSector);
+      PatternBySectorSSidMap_t const &planeData=
+         m_bank.m_PatternByLayer[iPlane].m_SSidData;
+      for(PatternBySectorSSidMap_t::const_iterator
+             iSSid=planeData.begin();iSSid!=planeData.end();++iSSid) {
+         for(PatternBySector_t::const_iterator
+                iSector=(*iSSid).second.begin();
+             iSector!=(*iSSid).second.end();++iSector) {
+            int moduleId=-1;
+            if(((*iSSid).first!=s_WILDCARDid)&&(*iSSid).first!=s_INVALIDid) {
+               getDCssidSlow(iPlane,(*iSector).first,(*iSSid).first,&moduleId);
+            }
+            modulesBySector[(*iSector).first].insert(moduleId);
+         }
+      }
+      std::map<int,int> multiplicity;
+      for(size_t sector=0;sector<modulesBySector.size();sector++) {
+         multiplicity[modulesBySector[sector].size()]++;
+      }
+      for(std::map<int,int>::const_iterator imult=multiplicity.begin();
+          imult!=multiplicity.end();imult++) {
+         if((*imult).first>1) {
+            error++;
+            std::cout<<"plane="<<iPlane<<" some sectors ("<<(*imult).second
+                     <<") have "<<(*imult).first<<" modules assigned (error)\n";
+         }
+      }
+      // print all bad sectors
+      for(size_t sector=0;sector<modulesBySector.size();sector++) {
+         if(modulesBySector[sector].size()>1) {
+            std::cout<<"bad plane="<<iPlane<<" sector="<<sector<<" [";
+            for(std::set<int>::const_iterator k=modulesBySector[sector].begin();
+                k!=modulesBySector[sector].end();k++) {
+               std::cout<<" "<<(*k);
+            }
+            std::cout<<"]\n";
+         }
+      }
+   }
+   if(error) {
+      Fatal(where)
+         <<"Multiple modules are assigned to a given plane and sector\n";
+   }
+#endif
    setupSectorWildcards();
 }
 
@@ -2364,8 +2480,8 @@ void FTK_CompressedAMBank::setupSectorWildcards(void) {
       //}
       PatternBySectorSSidMap_t const &planeData=
          m_bank.m_PatternByLayer[iPlane].m_SSidData;
-      for(PatternBySectorSSidMap_t::const_ptr iSSid=planeData.beginPtr();
-          iSSid!=planeData.endPtr();++iSSid) {
+      for(PatternBySectorSSidMap_t::const_iterator iSSid=planeData.begin();
+          iSSid!=planeData.end();++iSSid) {
          int mask=1;
          int moduleId=-1;
          if((*iSSid).first==s_WILDCARDid) {
@@ -2375,7 +2491,8 @@ void FTK_CompressedAMBank::setupSectorWildcards(void) {
             // ignore inside bank
             mask=4;
          } else {
-            PatternBySector_t::const_ptr iSector=(*iSSid).second.beginPtr();
+            PatternBySector_t::const_iterator iSector=
+               (*iSSid).second.begin();
             getDCssidSlow(iPlane,(*iSector).first,(*iSSid).first,&moduleId);
             MAP<int,int>::const_iterator im=
                m_badModules[iPlane].find(moduleId);
@@ -2387,8 +2504,9 @@ void FTK_CompressedAMBank::setupSectorWildcards(void) {
                }
             }
          }
-         for(PatternBySector_t::const_ptr iSector=(*iSSid).second.beginPtr();
-             iSector!=(*iSSid).second.endPtr();++iSector) {
+         for(PatternBySector_t::const_iterator
+                iSector=(*iSSid).second.begin();
+             iSector!=(*iSSid).second.end();++iSector) {
             sectorFlag[(*iSector).first]|=mask;
             /*if((*iSector).first==1273) {
                std::cout<<" SSID="<<(*iSSid).first
@@ -2408,6 +2526,48 @@ void FTK_CompressedAMBank::setupSectorWildcards(void) {
                m_SectorWC[sector] |= 1<<iPlane;
             }
          } else {
+            bool firstPrint=true;
+            for(PatternBySectorSSidMap_t::const_iterator
+                   iSSid=planeData.begin();iSSid!=planeData.end();++iSSid) {
+               int moduleId=-1;
+               bool doPrint=false;
+               for(PatternBySector_t::const_iterator
+                      iSector=(*iSSid).second.begin();
+                   iSector!=(*iSSid).second.end();++iSector) {
+                  if((*iSector).first==sector) doPrint=true;
+               }
+               if(doPrint) {
+                  if(firstPrint) {
+                     for(size_t i=0;i<m_bank.m_PatternByLayer.size();i++) {
+                        std::cout<<"plane="<<i<<" nSSID="
+                                 <<m_bank.m_PatternByLayer[i].m_SSidData.size()
+                                 <<"\n";
+                     }
+                     firstPrint=false;
+                  }
+                  if(((*iSSid).first!=s_WILDCARDid)&&
+                     ((*iSSid).first!=s_INVALIDid)) {
+                     getDCssidSlow(iPlane,(*(*iSSid).second.begin()).first,(*iSSid).first,&moduleId);
+                  }
+                  int hash=-2;
+                  if(moduleId>=0) {
+                     hash=getSSMapTSP()->getRegionMap()
+                        ->getGlobalId(getBankID(),iPlane,moduleId);
+
+                  }
+                  std::cout<<" SSID="<<(*iSSid).first
+                           <<" plane="<<iPlane
+                           <<" module="<<moduleId
+                           <<" hash="<<hash
+                           <<" [";
+                  for(PatternBySector_t::const_iterator
+                         iSector=(*iSSid).second.begin();
+                      iSector!=(*iSSid).second.end();++iSector) {
+                     std::cout<<" "<<(*iSector).first;
+                  }
+                  std::cout<<"]\n";
+               }
+            }
             Error("setupSectorWildcards")
                <<"inconsistent wildcards sector="<<sector
                <<" plane="<<iPlane<<" type="<<type<<"\n";
@@ -2734,10 +2894,10 @@ int FTK_CompressedAMBank::readCCachedBank(TDirectory *inputDir) {
    the branches are:
            ssid : TSP-level SSID
          sector : sector
-   firstPattern : first m_pattern ID for this (ssid,sector) combination
+   firstPattern : first pattern ID for this (ssid,sector) combination
        nPattern : number of patterns for this (ssid,sector) combination
           nData : size of compressed data
-    data[nData] : compressed m_pattern data
+    data[nData] : compressed pattern data
 */
 int FTK_CompressedAMBank::writeCCachedBankFile(char const *filename,int flatFormat) const {
    int error;
@@ -3017,12 +3177,13 @@ void FTK_CompressedAMBank::insertPatterns
    FTKPatternOneSectorOrdered *tspList=
       patterns->OrderPatterns(FTKPatternOrderByCoverage(0));
    unsigned nLayer=getNPlanes();
-   // store a m_pattern in DC space
+   // store a pattern in DC space
    FTKHitPattern dc(nLayer);
    for(FTKPatternOneSectorOrdered::Ptr_t itsp=tspList->Begin();
        itsp!=tspList->End();itsp++) {
-      // original m_pattern in TSP space
+      // original pattern in TSP space
       FTKHitPattern const &tsp(tspList->GetHitPattern(itsp));
+      // this stores the coverage plus 2^32*number of TSP patterns
       uint64_t covCtr=tspList->GetCoverage(itsp) + 0x100000000LL;
       // this variables stores DC/HB bits of all layers
       uint64_t dchb0=0;
@@ -3054,7 +3215,7 @@ void FTK_CompressedAMBank::insertPatterns
       }
       // implement wildcard policy here
       if(badModules) {
-         // if more than two bad modules, skip m_pattern
+         // if more than two bad modules, skip pattern
          if(m_nHit16[badModules]>2) continue; 
          // drop outermost wildcards
          for(int ilayer=nLayer-1;ilayer>=0;ilayer--) {
@@ -3069,7 +3230,7 @@ void FTK_CompressedAMBank::insertPatterns
          dcList.equal_range(dc);
       HitPatternMap_t::iterator iPatt;
       for(iPatt=idc.first;iPatt!=idc.second;iPatt++) {
-         uint64_t dchb1=dchb0; // this m_pattern's DCHB bits
+         uint64_t dchb1=dchb0; // this pattern's DCHB bits
          uint64_t dchb2=(*iPatt).second.first; // present DCHB bits
          uint64_t dchbMerged=0; // new DCHB bits
          int shift=0; // location of DCHB bits
@@ -3120,9 +3281,10 @@ void FTK_CompressedAMBank::insertPatterns
             print--;
             } */
          if(accept) {
-            // store this m_pattern with the existing DC m_pattern
+            // store this pattern with the existing DC pattern
+            // by setting more bits to the ternary state X
             if(0 && badModules) {
-               std::cout<<"Merging m_pattern: ";
+               std::cout<<"Merging pattern: ";
                for(size_t iLayer=0;iLayer<nLayer;iLayer++) {
                   std::cout<<" "<<dc.GetHit(iLayer);
                }
@@ -3137,11 +3299,11 @@ void FTK_CompressedAMBank::insertPatterns
          }
       }
       if(iPatt==idc.second) {
-         // m_pattern has not been stored., try to add new DC m_pattern
+         // pattern has not been stored., try to add new DC pattern
          if((maxpatts>0)&&(nDC>=maxpatts)) break;
-         dcList.insert(std::make_pair(dc,std::make_pair(dchb0,covCtr))); // insert DC m_pattern with DCHB bits
+         dcList.insert(std::make_pair(dc,std::make_pair(dchb0,covCtr))); // insert DC pattern with DCHB bits
          if(0 && badModules) {
-         std::cout<<"Insert m_pattern: ";
+         std::cout<<"Insert pattern: ";
          for(size_t iLayer=0;iLayer<nLayer;iLayer++) {
             std::cout<<" "<<dc.GetHit(iLayer);
          }
@@ -3185,6 +3347,7 @@ int FTK_CompressedAMBank::readSectorOrderedBank(const char *name, int maxpatts,
       std::set<int> subregion;
       FTKPatternBySectorReader *TSPreader=
          FTKPatternBySectorReader::Factory(*TSPfile);
+      TSPreader->CheckConsistency(getSSMapTSP(),getBankID(),getHWModeSS_tsp());
       for(int sector=TSPreader->GetFirstSector();sector>=0;
           sector=TSPreader->GetNextSector(sector)) {
          if((nSub>1)&&(sector%nSub!=getSubID())) continue;
@@ -3398,6 +3561,7 @@ int FTK_CompressedAMBank::readPartitionedSectorOrderedBank
             Fatal("readSectorOrderedBank")
                <<"number of layers (reader) "<<TSPreader->GetNLayers()<<"\n";
          }
+         TSPreader->CheckConsistency(getSSMapTSP(),getBankID(),getHWModeSS_tsp());
          if(!nLayer) {
             setNPlanes(TSPreader->GetNLayers());
             nLayer=TSPreader->GetNLayers();
@@ -3410,13 +3574,19 @@ int FTK_CompressedAMBank::readPartitionedSectorOrderedBank
          // the coverage map holds for each coverage the number of patterns
          // it is used in order to estimate down to which coverage the patterns
          // can be read
+#ifdef SEARCH_MEMORY_LEAK
          printVmemUsage("before GetNPatternsByCoverage");
+#endif
          std::map<int,int> coverageMap;
          TSPreader->GetNPatternsByCoverage(coverageMap);
+#ifdef SEARCH_MEMORY_LEAK
          printVmemUsage("after GetNPatternsByCoverage");
+#endif
          std::map<int,int>::const_reverse_iterator i=coverageMap.rbegin();
          TSPreader->Rewind();
+#ifdef SEARCH_MEMORY_LEAK
          printVmemUsage("after Rewind");
+#endif
          // print bank statistics
          // determine total number of patterns , patterns*coverage, <coverage>
          uint32_t totalPatterns=0;
@@ -3518,17 +3688,22 @@ int FTK_CompressedAMBank::readPartitionedSectorOrderedBank
       VECTOR<std::pair<int,int> > sectorPointer(dcPatterns.size());
       int numPattern=0;
       for(unsigned sector=0;sector<sectorPointer.size();sector++) {
+         // initialize start pointer per sector
+         // and end=start
          sectorPointer[sector]=std::make_pair(pos,pos);
+         // start position of next sector
          pos += dcPatterns[sector].size()*offsetSSID;
          numPattern+=dcPatterns[sector].size();
       }
       int32_t *ssidData=new int32_t[pos];
       for(unsigned sector=0;sector<dcPatterns.size();sector++) {
          HitPatternMap_t const &hitMap=dcPatterns[sector];
+         // pos is a reference, so increasing pos below increases
+         //  the end position in the sectorPointer array
          int &pos=sectorPointer[sector].second;
          for(HitPatternMap_t::const_iterator iPattern=hitMap.begin();
              iPattern!=hitMap.end();iPattern++) {
-            // dchb conttains the encoded DC and HB bits
+            // dchb contains the encoded DC and HB bits
             //   DCHB7 | DCHB6 ... DCHB1 | DCHB0
             uint64_t dchb=(*iPattern).second.first;
             int dcMask=0,hbMask=0;
@@ -3565,7 +3740,7 @@ int FTK_CompressedAMBank::readPartitionedSectorOrderedBank
 /**
    init()
 
-   initialize the m_pattern finding
+   initialize the pattern finding
 */
 void FTK_CompressedAMBank::init() {
    FTK_AMsimulation_base::init();
@@ -3640,7 +3815,7 @@ void FTK_CompressedAMBank::sort_hits
       expectedNHit++;
       int tsp_ssid,coded_ssid;
       if (FTKSetup::getFTKSetup().getSectorsAsPatterns()) {
-         // Using a dummy m_pattern bank representing just the number of sectors, the IDs are the module IDs, for historical reason called sector.
+         // Using a dummy pattern bank representing just the number of sectors, the IDs are the module IDs, for historical reason called sector.
          tsp_ssid = hit->getSector();
          coded_ssid = hit->getSector();
          // filter out bad modules
@@ -3667,12 +3842,12 @@ void FTK_CompressedAMBank::sort_hits
                (coded_ssid==s_WILDCARDid)) continue;
             if (getHWModeSS_dc()==0) {
                // SS calculated assuming a global SS id
-               // large-size m_pattern ID in upper bits , fine resolution subpattern in lower bits
+               // large-size pattern ID in upper bits , fine resolution subpattern in lower bits
                coded_ssid = (getSSMap()->getSSGlobal(*hit)
                              <<m_TSPmap->getNBits(iplane))
                   | m_TSPmap->getHighResSSPart(*hit);
             } else if (getHWModeSS_dc()==2) {
-               // get SSID directly from fine m_pattern map
+               // get SSID directly from fine pattern map
                //   coded_ssid = getSSMapTSP()->getSSTower(*hit,getBankID());
 #ifdef HW2_USE_TSPMAP
                getSSMapTSP()->setSSDCX(iplane,m_TSPmap->getNBits(iplane,0));
@@ -3772,7 +3947,7 @@ void FTK_CompressedAMBank::data_organizer_r
    //
    // loop over all input (layer,ssid)
    // locate the (layer,ssid) in the bank
-   // store pointer to the m_pattern data in the sector-ordered structure
+   // store pointer to the pattern data in the sector-ordered structure
    //    patternDataBySectorLayerSSID[sector][layer][ssid]
    for(int iplane=0;iplane<getNPlanes();iplane++) {
       LayerData const &bankDataThisLayer=m_bank.m_PatternByLayer[iplane];
@@ -3780,11 +3955,11 @@ void FTK_CompressedAMBank::data_organizer_r
       for(std::list<int>::const_iterator iSSID=tspSSIDfired[iplane].begin();
           iSSID!=tspSSIDfired[iplane].end();iSSID++) {
          int tsp_ssid=(*iSSID);
-         // locate the SSID in the m_pattern bank
+         // locate the SSID in the pattern bank
          PatternBySectorSSidMap_t::const_iterator ssidInBank=
             bankDataThisLayer.m_SSidData.find(tsp_ssid);
          if(ssidInBank!=bankDataThisLayer.m_SSidData.end()) {
-            // tsp_ssid is present in the m_pattern bank
+            // tsp_ssid is present in the pattern bank
             //  loop over all its sectors and set mask
             for(PatternBySector_t::const_ptr sector=
                    (*ssidInBank).second.beginPtr();
@@ -3820,7 +3995,7 @@ void FTK_CompressedAMBank::data_organizer_r
 #endif
       if(nhit>=m_nhWCmin) {
          //
-         // reset hit m_pattern for this sector
+         // reset hit pattern for this sector
          int firstPattern=(*isector).second.first;
          int lastPattern=(*isector).second.second;
          if(firstPattern<=lastPattern) {
@@ -3882,15 +4057,15 @@ void FTK_CompressedAMBank::am_in_r
    };
    class MaskUpdaterSlow {
       // slow update:
-      // update hit m_pattern and
+      // update hit pattern and
       // determine road candidates
       // a road candidate is stored if:
-      //   (1) the m_pattern has hits in other layers
-      //   (2) the m_pattern has no hit in the present layer
+      //   (1) the pattern has hits in other layers
+      //   (2) the pattern has no hit in the present layer
       //   (3) the updated mask has exactly the minimum number of hits
       // condition (1) is to skip empty patterns (not needed?)
-      // condition (2) is to ensure a valid m_pattern is stored only once
-      // condition (3) is there to ensure the m_pattern is there and stored only
+      // condition (2) is to ensure a valid pattern is stored only once
+      // condition (3) is there to ensure the pattern is there and stored only
       //   as the threshold is passed
    public:
       inline MaskUpdaterSlow(HitPattern_t *hits,HitPattern_t msk,
@@ -3962,11 +4137,11 @@ void FTK_CompressedAMBank::am_in_r
       for(std::list<int>::const_iterator iSSID=tspSSIDfired[iplane].begin();
           iSSID!=tspSSIDfired[iplane].end();iSSID++) {
          int tsp_ssid=(*iSSID);
-         // locate the SSID in the m_pattern bank
+         // locate the SSID in the pattern bank
          PatternBySectorSSidMap_t::const_iterator ssidInBank=
             bankDataThisLayer.m_SSidData.find(tsp_ssid);
          if(ssidInBank!=bankDataThisLayer.m_SSidData.end()) {
-            // tsp_ssid is present in the m_pattern bank
+            // tsp_ssid is present in the pattern bank
             //  loop over all its sectors and set mask
             for(PatternBySector_t::const_ptr isector=
                    (*ssidInBank).second.beginPtr();
@@ -4086,7 +4261,7 @@ void FTK_CompressedAMBank::am_output() {
             //   DBID is set identical to ID
             road.setPatternDBID(patternID);
             //
-            // unpack DC bits and DC-SSID from m_pattern bank
+            // unpack DC bits and DC-SSID from pattern bank
             int dcMask=0,hbmask=0;
             //
             // loop over all planes
@@ -4171,7 +4346,7 @@ void FTK_CompressedAMBank::am_output() {
  *                 so that both will be kept
  *           1, if one road is the ghost of another
  * Comments: 
- *  original code was using the index in the m_pattern bank
+ *  original code was using the index in the pattern bank
  *  here the SSID information is taken from the FTKRoad objects
 *******************************************/
 int FTK_CompressedAMBank::informationMatch(FTKRoad *r1,FTKRoad *r2) {
@@ -4191,10 +4366,10 @@ int FTK_CompressedAMBank::informationMatch(FTKRoad *r1,FTKRoad *r2) {
      // STS: 2016/01/25 mask out DC bits for comparison 
      int nonDcMask=~((1<<m_TSPmap->getNBits(i))-1);
      if(!pmap->isSCT(i)) { // Pixel plane
-      /* m_pattern[][][] has the strips used by each m_pattern, if there is a
+      /* pattern[][][] has the strips used by each pattern, if there is a
 	 difference the two roads could be different.
 	 The different is meaningful only if the two roads are empty in both
-	 patterns or if the patt2 is empty while patt1 is a complete m_pattern*/
+	 patterns or if the patt2 is empty while patt1 is a complete pattern*/
         if ( ((r1->getSSID(i)&nonDcMask)!=(r2->getSSID(i)&nonDcMask)) &&
              ( r1->hasHitOnLayer(i) && r2->hasHitOnLayer(i) )) {
            /* The hitbit requirement is sufficient because because if patt1
@@ -4286,7 +4461,7 @@ const std::list<FTKRoad>& FTK_CompressedAMBank::getRoads() {
             Error("getRoads")
                <<"Plane="<<ipl<<" no fired SS found, ssid="
                <<(nodc_ssid>>nDCbits)
-               <<" m_pattern="<<(*iroad).getPatternID()<<"\n";
+               <<" pattern="<<(*iroad).getPatternID()<<"\n";
             std::vector<int> const &ssid_with_dcbits=getTSPssidVector
                (ipl,(*iroad).getSectorID(),nodc_ssid>>nDCbits);
             std::cout<<"DC="<<(nodc_ssid>>nDCbits)<<" -> TSP=[";
@@ -4522,7 +4697,7 @@ void FTK_CompressedAMBank::printSector(int sector,int npattern,
          if(((ipattern<i0[0])||(ipattern>i1[0]))&&
             ((ipattern<i0[1])||(ipattern>i1[1]))) {
             if((ipattern<i0[0])||(ipattern>i1[1])) {
-               std::cout<<"Error: requested m_pattern "<<ipattern
+               std::cout<<"Error: requested pattern "<<ipattern
                         <<" is not in sector "<<sector<<"\n";
             } else {
                npart=1;
diff --git a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBtagFex.cxx b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBtagFex.cxx
index 3ab0dc68d5200649309bd2addfe274f1670d98f7..ca2c964e8efe5135ba91e0ccaccb7166eef576f0 100755
--- a/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBtagFex.cxx
+++ b/Trigger/TrigHypothesis/TrigBjetHypo/src/TrigBtagFex.cxx
@@ -310,7 +310,7 @@ HLT::ErrorCode TrigBtagFex::hltExecute(const HLT::TriggerElement* inputTE, HLT::
 
       if ( jetIsAssociated.isFailure() ) {
 	if(msgLvl() <= MSG::DEBUG) msg() << MSG::DEBUG << "#BTAG# Failed to associate tracks to jet" << endmsg;
-	return StatusCode::FAILURE;
+	return HLT::MISSING_FEATURE;
       }
     }
     else {
diff --git a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXFex.cxx b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXFex.cxx
index 74fb53bdc3e4bf3af9897b6fa5d26683dda44ca3..d2120a0d5db58f0739bb04c9e2b7878f77e4804e 100644
--- a/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXFex.cxx
+++ b/Trigger/TrigHypothesis/TrigBphysHypo/src/TrigEFBMuMuXFex.cxx
@@ -555,7 +555,7 @@ HLT::ErrorCode TrigEFBMuMuXFex::hltInitialize()
     // retrieving the vertex fitting tool
     if (m_fitterSvc.retrieve().isFailure()) {
         msg() << MSG::ERROR << "Can't find Trk::TrkVKalVrtFitter" << endmsg;
-        return StatusCode::SUCCESS;
+        return HLT::BAD_JOB_SETUP;
     } else {
         if (msgLvl() <= MSG::DEBUG) {
             msg() << MSG::DEBUG << "Trk::TrkVKalVrtFitter found" << endmsg;
@@ -566,7 +566,7 @@ HLT::ErrorCode TrigEFBMuMuXFex::hltInitialize()
     // retrieving BphysHelperUtilsTool
     if (m_bphysHelperTool.retrieve().isFailure()) {
         msg() << MSG::ERROR << "Can't find TrigBphysHelperUtilsTool" << endmsg;
-        return StatusCode::SUCCESS;
+        return HLT::BAD_JOB_SETUP;
     } else {
             if (msgLvl() <= MSG::DEBUG) msg() << MSG::DEBUG << "TrigBphysHelperUtilsTool found" << endmsg;
     }
diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronHypoTool.py b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronHypoTool.py
index e46683c556ee61e59f02b0313228a8125ced226e..c1ef6e6266d3db31618e6d674fd29bddb6f51fd1 100644
--- a/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronHypoTool.py
+++ b/Trigger/TrigHypothesis/TrigEgammaHypo/python/TrigL2ElectronHypoTool.py
@@ -14,11 +14,10 @@ def TrigL2ElectronHypoToolFromName( name ):
     tool.MonTool = ""
     from TriggerJobOpts.TriggerFlags import TriggerFlags
     if 'Validation' in TriggerFlags.enableMonitoring() or 'Online' in  TriggerFlags.enableMonitoring():
-        from AthenaMonitoring.AthenaMonitoringConf import GenericMonitoringTool
-        from AthenaMonitoring.DefineHistogram import defineHistogram
+        from AthenaMonitoring.GenericMonitoringTool import GenericMonitoringTool, defineHistogram
         monTool = GenericMonitoringTool("MonTool"+name)
         monTool.Histograms = [         
-            defineHistogram('CutCounter', type='TH1I', title="L2Electron Hypo Cut Counter;Cut Counter", xbins=8, xmin=-1.5, xmax=7.5, opt="kCumulative", labels=labelsDescription),
+            defineHistogram('CutCounter', type='TH1I', title="L2Electron Hypo Cut Counter;Cut Counter", xbins=8, xmin=-1.5, xmax=7.5, opt="kCumulative"),
             defineHistogram('CaloTrackdEta', type='TH1F', title="L2Electron Hypo #Delta #eta between cluster and track;#Delta #eta;Nevents", xbins=80, xmin=-0.4, xmax=0.4),
             defineHistogram('CaloTrackdPhi', type='TH1F', title="L2Electron Hypo #Delta #phi between cluster and track;#Delta #phi;Nevents", xbins=80, xmin=-0.4, xmax=0.4),
             defineHistogram('CaloTrackEoverP', type='TH1F', title="L2Electron Hypo E/p;E/p;Nevents", xbins=120, xmin=0, xmax=12),
diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEFCaloCalibFex.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEFCaloCalibFex.cxx
index 5d5a1aaf8da623d72bd74a5aa0d988c64b0593cc..065eebc8689863f617f2b6da8f881686d638c1c9 100755
--- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEFCaloCalibFex.cxx
+++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEFCaloCalibFex.cxx
@@ -305,10 +305,10 @@ HLT::ErrorCode TrigEFCaloCalibFex::hltExecute(const HLT::TriggerElement* inputTE
         }
     }
 
-    bool status = CaloClusterStoreHelper::finalizeClusters( store(), m_pCaloClusterContainer,
-            clusterCollKey, msg());
+    StatusCode status = CaloClusterStoreHelper::finalizeClusters( store(), m_pCaloClusterContainer,
+                                                                  clusterCollKey, msg());
 
-    if ( !status ) { 
+    if ( !status.isSuccess() ) { 
         msg() << MSG::ERROR << "recording CaloClusterContainer with key <" << clusterCollKey << "> failed" << endmsg;
         return HLT::TOOL_FAILURE;
     } else {
diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEFElectronHypo.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEFElectronHypo.cxx
index 953b8da17752ae2be97c3dc8287932316e3376ad..c7b333dd4c08c332cb3602e4d6174653cad1dd67 100755
--- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEFElectronHypo.cxx
+++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEFElectronHypo.cxx
@@ -227,7 +227,7 @@ HLT::ErrorCode TrigEFElectronHypo::hltInitialize()
   //retrieving TrackToVertex:    
   if ( m_trackToVertexTool.retrieve().isFailure() ) {  
       ATH_MSG_ERROR("Failed to retrieve tool " << m_trackToVertexTool);
-      return StatusCode::FAILURE;  
+      return HLT::BAD_JOB_SETUP;  
   } else {  
     ATH_MSG_DEBUG("Retrieved tool " << m_trackToVertexTool);
   }
@@ -284,19 +284,19 @@ HLT::ErrorCode TrigEFElectronHypo::hltInitialize()
   if(m_applyIsolation){
     if ( m_EtConeCut.size() != m_EtConeSizes ) {
       ATH_MSG_ERROR(" m_EtConeCut size is " <<  m_EtConeCut.size() << " but needs " << m_EtConeSizes);
-      return StatusCode::FAILURE;
+      return HLT::BAD_JOB_SETUP;
     }
     if ( m_RelEtConeCut.size() != m_EtConeSizes ) {
       ATH_MSG_ERROR(" m_RelEtConeCut size is " <<  m_RelEtConeCut.size() << " but needs " << m_EtConeSizes);
-      return StatusCode::FAILURE;
+      return HLT::BAD_JOB_SETUP;
     }
     if ( m_PtConeCut.size() != m_PtConeSizes ) {
       ATH_MSG_ERROR(" m_PtConeCut size is " <<  m_PtConeCut.size() << " but needs " << m_PtConeSizes);
-      return StatusCode::FAILURE;
+      return HLT::BAD_JOB_SETUP;
     }
     if ( m_RelPtConeCut.size() != m_PtConeSizes ) {
       ATH_MSG_ERROR(" m_RelPtConeCut size is " <<  m_RelPtConeCut.size() << " but needs " << m_PtConeSizes);
-      return StatusCode::FAILURE;
+      return HLT::BAD_JOB_SETUP;
     }
 
     //Define mapping between vector of Isolation Cone Sizes and variable names 
diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEFPhotonHypo.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEFPhotonHypo.cxx
index 55283233d854b19d5d393debbda235ab156e9c7b..6e1c7972eba298e4bafac4dd41712a722bc741ec 100755
--- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEFPhotonHypo.cxx
+++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEFPhotonHypo.cxx
@@ -196,11 +196,11 @@ HLT::ErrorCode TrigEFPhotonHypo::hltInitialize()
   if(m_applyIsolation){
       if ( m_EtConeCut.size() != m_EtConeSizes ) {
           ATH_MSG_ERROR(" m_EtConeCut size is " <<  m_EtConeCut.size() << " but needs " << m_EtConeSizes);
-          return StatusCode::FAILURE;
+          return HLT::BAD_JOB_SETUP;
       }
       if ( m_RelEtConeCut.size() != m_EtConeSizes ) {
           ATH_MSG_ERROR(" m_RelEtConeCut size is " <<  m_RelEtConeCut.size() << " but needs " << m_EtConeSizes);
-          return StatusCode::FAILURE;
+          return HLT::BAD_JOB_SETUP;
       }
 
       //Define mapping between vector of Isolation Cone Sizes and variable names 
diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypo.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypo.cxx
index c947dbffc62e6f3ef705ffdfa6c37d581c76cb96..e4fc49168749ad3478f8dbbe6f1e118fefd682c1 100755
--- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypo.cxx
+++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypo.cxx
@@ -94,47 +94,47 @@ HLT::ErrorCode TrigL2CaloHypo::hltInitialize()
   unsigned int nEtaBin=m_etabin.size();
   if ( m_eTthr.size() != nEtaBin-1 ) {
     msg() << MSG::ERROR << " etThr size is " <<  m_eTthr.size() << " but needs " << nEtaBin-1 << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
   
   if ( m_eT2thr.size() != nEtaBin-1 ) {
     msg() << MSG::ERROR << " et2Thr size is " <<  m_eT2thr.size() << " but needs " << nEtaBin-1 << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   if ( m_hadeTthr.size() != nEtaBin-1 ) {
     msg() << MSG::ERROR << " hadetThr size is " <<  m_hadeTthr.size() << " but needs " << nEtaBin-1 << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   if ( m_hadeT2thr.size() != nEtaBin-1 ) {
     msg() << MSG::ERROR << " hadet2Thr size is " <<  m_hadeT2thr.size() << " but needs " << nEtaBin-1 << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
   
   if ( m_carcorethr.size() != nEtaBin-1 ) {
     msg() << MSG::ERROR << " carcore size is " <<  m_carcorethr.size() << " but needs " << nEtaBin-1 << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
   
   if ( m_caeratiothr.size() != nEtaBin-1 ) {
     msg() << MSG::ERROR << " caeratio size is " <<  m_caeratiothr.size() << " but needs " << nEtaBin-1 << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   if ( m_WETA2thr.size() != nEtaBin-1 ) {
     msg() << MSG::ERROR << " Weta2 size is " <<  m_WETA2thr.size() << " but needs " << nEtaBin-1 << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
    if ( m_WSTOTthr.size() != nEtaBin-1 ) {
     msg() << MSG::ERROR << " Wstot size is " <<  m_WSTOTthr.size() << " but needs " << nEtaBin-1 << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
    if ( m_F3thr.size() != nEtaBin-1 ) {
     msg() << MSG::ERROR << " Wstot size is " <<  m_WSTOTthr.size() << " but needs " << nEtaBin-1 << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }  
  
   return HLT::OK;
diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolMult.h b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolMult.h
index 2147c701a32139aaa845059c8cad01190fdc5f23..b282b2081d2cadd3282798c3f7b3807dd70c564a 100644
--- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolMult.h
+++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloHypoToolMult.h
@@ -33,8 +33,8 @@ class TrigL2CaloHypoToolMult : public extends<AthAlgTool, ITrigL2CaloHypoTool> {
   virtual StatusCode decide( std::vector<ITrigL2CaloHypoTool::ClusterInfo>& input )  const override;
 
   virtual bool decide( const ITrigL2CaloHypoTool::ClusterInfo& ) const override { 
-    CHECK( StatusCode::FAILURE );  // this method should never be called
-    return StatusCode::FAILURE;
+    REPORT_MESSAGE(MSG::ERROR) << "this method should never be called";
+    return false;
   }
 
  private:
diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloLayersHypo.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloLayersHypo.cxx
index ad083f40f1eff99ae4a79dd7ba0fde46546c54be..b01143a0c35dd9bcc093bf861e98665a7d9f0afb 100755
--- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloLayersHypo.cxx
+++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2CaloLayersHypo.cxx
@@ -68,12 +68,12 @@ HLT::ErrorCode TrigL2CaloLayersHypo::hltInitialize()
 
   if ( m_EnergyFracCut.size() != 4 ) {
     msg() << MSG::ERROR << " EnergyFracCut size is " <<  m_EnergyFracCut.size() << " but needs 4" << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
   
   if ( m_EnergyAbsCut.size() != 4 ) {
     msg() << MSG::ERROR << " EnergyAbsCut size is " <<  m_EnergyAbsCut.size() << " but needs 4" << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
   
   return HLT::OK;
diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypo.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypo.cxx
index 411822ebfbfdb4797e60b830d72c8c0107c80a1b..ad8d0ec7975849be649e877ac4ad896a3a2949b4 100755
--- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypo.cxx
+++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigL2PhotonHypo.cxx
@@ -99,32 +99,32 @@ HLT::ErrorCode TrigL2PhotonHypo::hltInitialize()
   unsigned int nEtaBin=m_etabin.size();
   if ( m_eTthr.size() != nEtaBin-1 ) {
     msg() << MSG::ERROR << " etThr size is " <<  m_eTthr.size() << " but needs " << nEtaBin-1 << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
   
   if ( m_eT2thr.size() != nEtaBin-1 ) {
     msg() << MSG::ERROR << " et2Thr size is " <<  m_eT2thr.size() << " but needs " << nEtaBin-1 << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   if ( m_hadeTthr.size() != nEtaBin-1 ) {
     msg() << MSG::ERROR << " hadetThr size is " <<  m_hadeTthr.size() << " but needs " << nEtaBin-1 << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   if ( m_hadeT2thr.size() != nEtaBin-1 ) {
     msg() << MSG::ERROR << " hadet2Thr size is " <<  m_hadeT2thr.size() << " but needs " << nEtaBin-1 << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
   
   if ( m_carcorethr.size() != nEtaBin-1 ) {
     msg() << MSG::ERROR << " carcore size is " <<  m_carcorethr.size() << " but needs " << nEtaBin-1 << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
   
   if ( m_caeratiothr.size() != nEtaBin-1 ) {
     msg() << MSG::ERROR << " caeratio size is " <<  m_caeratiothr.size() << " but needs " << nEtaBin-1 << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   return HLT::OK;
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_DijetMassDEtaTool.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_DijetMassDEtaTool.cxx
index 2baa6a0ed8e652557574969f373d562c4a5da856..7f8f3f5aad0cc401c2508c8c47ef4b138b069aaf 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_DijetMassDEtaTool.cxx
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_DijetMassDEtaTool.cxx
@@ -91,7 +91,7 @@ StatusCode TrigHLTJetHypo_DijetMassDEtaTool::checkVals() const {
                   << m_asymmetricEtas.size() << " "
                   );
     
-    return false;
+    return StatusCode::FAILURE;
   }
 
   bool multOK = m_EtThresholds.size() > 1;
@@ -121,7 +121,7 @@ StatusCode TrigHLTJetHypo_DijetMassDEtaTool::checkVals() const {
     ATH_MSG_ERROR(name() << " neither mass nor deta limits given");
   }
   
-  return multOK and ystarOK and massOK and atLeastOne;
+  return StatusCode(multOK and ystarOK and massOK and atLeastOne);
 }
 
 
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_EtaEtTool.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_EtaEtTool.cxx
index b169143c8a8c9170296a30e4850a5058f160a35a..c58ba37642ed303d77c5a1c76acf2f140a8f46cd 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_EtaEtTool.cxx
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_EtaEtTool.cxx
@@ -66,9 +66,9 @@ StatusCode TrigHLTJetHypo_EtaEtTool::checkVals() const {
                   << m_asymmetricEtas.size() << " "
                   );
     
-    return false;
+    return StatusCode::FAILURE;
   }
-  return true;
+  return StatusCode::SUCCESS;
 }
 
 std::vector<std::shared_ptr<ICleaner>> 
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_SMCTool.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_SMCTool.cxx
index 5c3fdf9502b618f23febf894a57236627bb50bd1..04beb2e0a94b429f19b837fe6e4027ff926624fd 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_SMCTool.cxx
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_SMCTool.cxx
@@ -92,9 +92,9 @@ StatusCode TrigHLTJetHypo_SMCTool::checkVals() const {
                 << m_JetMassMin.size() << " "
                 << m_JetMassMin.size() << " "
                 );
-        return false;
+        return StatusCode::FAILURE;
     }
-    return true;
+    return StatusCode::SUCCESS;
 }
     
 std::vector<std::shared_ptr<ICleaner>> TrigHLTJetHypo_SMCTool::getCleaners() const {
diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_TLATool.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_TLATool.cxx
index 17eacbc615ff8f50dd22e93507c5e92a0f3e942c..caa94c1ed0380c742d6df0bba538af039e70b36e 100644
--- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_TLATool.cxx
+++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigHLTJetHypo_TLATool.cxx
@@ -75,9 +75,9 @@ StatusCode TrigHLTJetHypo_TLATool::checkVals() const {
                   << "ystar_maxs" <<  m_ystarMaxs.size() << " "
                   << "mass_mins" <<  m_massMins.size() << " "
                   << "mass_maxs" <<  m_massMaxs.size());
-    return false;
+    return StatusCode::FAILURE;
   }
-  return true;
+  return StatusCode::SUCCESS;
 }
 
 std::vector<std::shared_ptr<ICleaner>> TrigHLTJetHypo_TLATool::getCleaners () const {
diff --git a/Trigger/TrigHypothesis/TrigHypoCommonTools/src/L1InfoHypo.cxx b/Trigger/TrigHypothesis/TrigHypoCommonTools/src/L1InfoHypo.cxx
index d4bd8059b28fb0d16e569180283960e638a0771c..f1492f4152b2beddb7d8d3601285f79a4f22ff1a 100755
--- a/Trigger/TrigHypothesis/TrigHypoCommonTools/src/L1InfoHypo.cxx
+++ b/Trigger/TrigHypothesis/TrigHypoCommonTools/src/L1InfoHypo.cxx
@@ -119,7 +119,7 @@ HLT::ErrorCode L1InfoHypo::hltExecute(const HLT::TriggerElement* /*unused*/,bool
     {
       if(output_level <= MSG::FATAL)
 	msg() << MSG::FATAL << "Can't get EventInfo object"  << endmsg;
-      return StatusCode::FAILURE;
+      return HLT::BAD_JOB_SETUP;
     }
   else
     {
diff --git a/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/TrigLLPInnerDetectorHypo.cxx b/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/TrigLLPInnerDetectorHypo.cxx
index 1a3df7a07024bac0a441d991a0e2004060218daf..77c8c0f8b86200e56902b90387714cbc216f8822 100644
--- a/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/TrigLLPInnerDetectorHypo.cxx
+++ b/Trigger/TrigHypothesis/TrigLongLivedParticlesHypo/src/TrigLLPInnerDetectorHypo.cxx
@@ -111,14 +111,14 @@ HLT::ErrorCode TrigLLPInnerDetectorHypo::hltInitialize() {
   StatusCode sc_pixH = detStore()->retrieve(m_pixHelper, "PixelID");
   if( sc_pixH.isFailure() ){
     ATH_MSG_WARNING( "Could not obtain pix helper!"  );
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   } else 
     ATH_MSG_INFO( "Successfully initialised pixel helper"  );
 
   StatusCode sc_sctH = detStore()->retrieve(m_sctHelper, "SCT_ID");
   if( sc_sctH.isFailure() ){
     ATH_MSG_WARNING( "Could not obtain sct helper!"  );
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   } else
     ATH_MSG_INFO( "Successfully initialised SCT helper"  );
   
diff --git a/Trigger/TrigHypothesis/TrigMultiVarHypo/src/TrigL2CaloRingerFex.cxx b/Trigger/TrigHypothesis/TrigMultiVarHypo/src/TrigL2CaloRingerFex.cxx
index 12d5e2e6afa9145812f30f47b931d837d05299ac..d1ec02a3bbd83d1ea26e5be5d3d6c3e65188334a 100755
--- a/Trigger/TrigHypothesis/TrigMultiVarHypo/src/TrigL2CaloRingerFex.cxx
+++ b/Trigger/TrigHypothesis/TrigMultiVarHypo/src/TrigL2CaloRingerFex.cxx
@@ -58,28 +58,28 @@ HLT::ErrorCode TrigL2CaloRingerFex::hltInitialize()
   ///check configuration
   if(m_weights.size() != m_nDiscr){
     msg() << MSG::ERROR << "Weight list dont match with the number of discriminators found" << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   if(m_bias.size() != m_nDiscr){
     msg() << MSG::ERROR << "Bias list dont match with the number of discriminators found" << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   if((m_etaBins.size() != m_nDiscr) || (m_etBins.size() != m_nDiscr)){
     msg() << MSG::ERROR << "Eta/Et list dont match with the number of discriminators found" << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   
   if(m_nRings.size() != m_normRings.size()){
     msg() << MSG::ERROR << "Preproc nRings list dont match with the number of discriminators found" << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   if(m_sectionRings.size() != m_normRings.size()){
     msg() << MSG::ERROR << "Preproc section rings list dont match with the number of discriminators found" << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
   
 
@@ -109,18 +109,18 @@ HLT::ErrorCode TrigL2CaloRingerFex::hltInitialize()
     }
     catch(std::bad_alloc xa){
       msg() << MSG::ERROR << "Weight vector size is not compatible with nodes vector." << endmsg;
-      return StatusCode::FAILURE;
+      return HLT::BAD_JOB_SETUP;
     }
     catch(int e){
       if (e == BAD_WEIGHT_SIZE)
       {
         msg() << MSG::ERROR << "Weight vector size is not compatible with nodes vector." << endmsg;
-        return StatusCode::FAILURE;
+        return HLT::BAD_JOB_SETUP;
       }
       if (e == BAD_BIAS_SIZE)
       {
         msg() << MSG::ERROR << "Bias vector size is not compatible with nodes vector." << endmsg;
-        return StatusCode::FAILURE;
+        return HLT::BAD_JOB_SETUP;
       }
     }///try and catch alloc protection
     
@@ -140,7 +140,7 @@ HLT::ErrorCode TrigL2CaloRingerFex::hltInitialize()
     }
     catch(std::bad_alloc xa){
       msg() << MSG::ERROR << "Bad alloc for TrigRingerPrepoc." << endmsg;
-      return StatusCode::FAILURE;
+      return HLT::BAD_JOB_SETUP;
     }
 
     ///Hold the pointer configuration
diff --git a/Trigger/TrigHypothesis/TrigMultiVarHypo/src/TrigL2CaloRingerHypo.cxx b/Trigger/TrigHypothesis/TrigMultiVarHypo/src/TrigL2CaloRingerHypo.cxx
index 1238c5f64079a541aba4d2ccb0f391995aa7c7c9..124f5cbf634ecbed21d20e160c862f1d70653097 100755
--- a/Trigger/TrigHypothesis/TrigMultiVarHypo/src/TrigL2CaloRingerHypo.cxx
+++ b/Trigger/TrigHypothesis/TrigMultiVarHypo/src/TrigL2CaloRingerHypo.cxx
@@ -39,7 +39,7 @@ HLT::ErrorCode TrigL2CaloRingerHypo::hltInitialize()
 
   if((m_etaBins.size() != m_nThresholds) && (m_etBins.size() != m_nThresholds)){
     msg() << MSG::ERROR << "Eta/Et list dont match with the number of thesholds found" << endmsg;
-    return StatusCode::FAILURE;
+    return HLT::BAD_JOB_SETUP;
   }
 
   ///Initialize all discriminators
@@ -51,7 +51,7 @@ HLT::ErrorCode TrigL2CaloRingerHypo::hltInitialize()
                                               */m_etaBins[i][1], m_etBins[i][0],m_etBins[i][1]));
     }catch(std::bad_alloc xa){
       msg() << MSG::ERROR << "Can not alloc cutDefs on memory." << endmsg;
-      return StatusCode::FAILURE;
+      return HLT::BAD_JOB_SETUP;
     }
   }///Loop over discriminators
   
diff --git a/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigMufastHypoTool.cxx b/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigMufastHypoTool.cxx
index 6df625168f8919532be7d0f9a5399f16480f8df7..6ae6096657e85e344b9c0af2cfc7ca6bbae85ccf 100755
--- a/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigMufastHypoTool.cxx
+++ b/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigMufastHypoTool.cxx
@@ -191,7 +191,7 @@ StatusCode TrigMufastHypoTool::decide(TrigMufastHypoTool::MuonClusterInfo& input
                  << " and threshold cut is " << threshold/CLHEP::GeV << " GeV" 
                  << " so hypothesis is " << (result?"true":"false"));
   
-   return result;
+   return StatusCode(result);
 }
 
 // --------------------------------------------------------------------------------
diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/HLTMuonMonTool.cxx b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/HLTMuonMonTool.cxx
index 0c83ec6435047c8e95c95ee31e29bd7b2694e79b..5874da6c0e55a961c5dbb8581e8a01279540c6a1 100755
--- a/Trigger/TrigMonitoring/TrigMuonMonitoring/src/HLTMuonMonTool.cxx
+++ b/Trigger/TrigMonitoring/TrigMuonMonitoring/src/HLTMuonMonTool.cxx
@@ -600,15 +600,8 @@ StatusCode HLTMuonMonTool::init()
     ATH_MSG_VERBOSE("initMuZTPDQA failed");
   }
 
-  int sc = scMuFast * scMuComb * scMuIso * scTileMu * scMuonEF * scMuGirl * scMuZTP;
-
-  if(sc==1){
-    return StatusCode::SUCCESS;
-  }else if(sc>1){
-    return StatusCode::RECOVERABLE;
-  }
-
-  return StatusCode::FAILURE;
+  StatusCode sc = scMuFast && scMuComb && scMuIso && scTileMu && scMuonEF && scMuGirl && scMuZTP;
+  return sc;
 }
 
 
@@ -716,16 +709,8 @@ StatusCode HLTMuonMonTool::book()
     ATH_MSG_VERBOSE("bookMuZTPDQA failed");
   }
 
-  int sc = scCommon * scChain * scMuFast * scMuComb * scMuIso * scTileMu * scMuonEF * scMuGirl * scMuZTP;
-
-  if(sc==1){
-    return StatusCode::SUCCESS;
-  }else if(sc>1){
-    return StatusCode::RECOVERABLE;
-  }
-
-  return StatusCode::FAILURE;
-
+  StatusCode sc = scCommon && scChain && scMuFast && scMuComb && scMuIso && scTileMu && scMuonEF && scMuGirl && scMuZTP;
+  return sc;
 }
 
 /*---------------------------------------------------------*/
@@ -878,7 +863,7 @@ StatusCode HLTMuonMonTool::fill()
     scMuZTP=StatusCode::RECOVERABLE;
   }
 
-  int sc = scCommon * scRecMuon * scChain * scMuFast * scMuComb * scMuIso * scTileMu * scMuonEF * scMuGirl * scMuZTP;
+  StatusCode sc = scCommon && scRecMuon && scChain && scMuFast && scMuComb && scMuIso && scTileMu && scMuonEF && scMuGirl && scMuZTP;
 
   ATH_MSG_DEBUG( " scCommon " << scCommon  
 		<< " scRecMuon " << scRecMuon 
@@ -892,14 +877,7 @@ StatusCode HLTMuonMonTool::fill()
                 << " scMuZTP " << scMuZTP
                 << " sc " << sc);
 
-  if(sc==1){
-    return StatusCode::SUCCESS;
-  }else if(sc>1){
-    return StatusCode::RECOVERABLE;
-  }
-
-  return StatusCode::FAILURE;
-
+  return sc;
 }
 
 /*---------------------------------------------------------*/
@@ -1016,13 +994,6 @@ StatusCode HLTMuonMonTool::proc()
 
   //
 
-  int sc = scChain * scMuFast * scMuComb * scMuIso * scTileMu * scMuonEF * scMuGirl * scMuZTP;
-
-  if(sc==1){
-    return StatusCode::SUCCESS;
-  }else if(sc>1){
-    return StatusCode::RECOVERABLE;
-  }
-
-  return StatusCode::FAILURE;
+  StatusCode sc = scChain && scMuFast && scMuComb && scMuIso && scTileMu && scMuonEF && scMuGirl && scMuZTP;
+  return sc;
 }
diff --git a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigMemAuditor.cxx b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigMemAuditor.cxx
index 2a576979b49c4388135d2f90d7933d6870171e15..b42003b874a2743db79eb99d893824768dbd5555 100644
--- a/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigMemAuditor.cxx
+++ b/Trigger/TrigMonitoring/TrigSteerMonitor/src/TrigMemAuditor.cxx
@@ -48,7 +48,7 @@ void  TrigMemAuditor::afterExecute(INamedInterface *a, const StatusCode &sc)
    TrigMemInfo.virtdelta   = TrigMemInfo.virtsize - m_VirtSizeMap[a->name()];
    
    // extract status code
-   TrigMemInfo.statuscode  = (unsigned long)sc;
+   TrigMemInfo.statuscode  = sc.getCode();
 
    // inform tools about memory usage
    for(int i = 0; i != nClientCount; i++)
diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/L1TopoAlgorithms/EtaPhiWindow.h b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/L1TopoAlgorithms/EtaPhiWindow.h
index aebe86ed0a0ce038a817023b3ee3bbea2635f8ab..a35d60b7979506da70d864cade368f4dce028d26 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/L1TopoAlgorithms/EtaPhiWindow.h
+++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/L1TopoAlgorithms/EtaPhiWindow.h
@@ -17,7 +17,7 @@ namespace TCS {
 /**
    @brief Select TOBs that fall in a given eta/phi region
 
-   @param NumberLeading number of TOBs being checked. Use '0' to consider full input collection
+   @param MaxTob number of TOBs being checked. Use '0' to consider full input collection
    @param MinET minimun ET above which TOBs are considered
    @param EtaMin min eta, signed integer in units of 0.1
    @param EtaMax max eta
@@ -37,7 +37,7 @@ public:
                                const std::vector<TCS::TOBArray *> &output,
                                Decision &decison);
 private:
-    parType_t      p_NumberLeading = { 0 };
+    parType_t      p_MaxTob = { 0 };
     parType_t      p_MinET = { 0 };
     parType_t      p_EtaMin = { 0 };
     parType_t      p_EtaMax = { 0 };
diff --git a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/EtaPhiWindow.cxx b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/EtaPhiWindow.cxx
index 20ae3bec122bc69b59d5681847827fc221bc3b4b..8203df9ed51b431e4ce0f041fb1d2ba46a6ca3c4 100644
--- a/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/EtaPhiWindow.cxx
+++ b/Trigger/TrigT1/L1Topo/L1TopoAlgorithms/Root/EtaPhiWindow.cxx
@@ -21,7 +21,7 @@ TCS::EtaPhiWindow::EtaPhiWindow(const std::string & name) : DecisionAlg(name)
 {
     defineParameter("InputWidth", 3);
     defineParameter("NumResultBits", 1);
-    defineParameter("NumberLeading", 0);
+    defineParameter("MaxTob", 0);
     defineParameter("MinET",1);
     defineParameter("EtaMin",  0);
     defineParameter("EtaMax",  5);
@@ -38,12 +38,12 @@ TCS::StatusCode
 TCS::EtaPhiWindow::initialize()
 {
     parType_t inputWidth = parameter("InputWidth").value();
-    p_NumberLeading = parameter("NumberLeading").value();
-    if(p_NumberLeading>inputWidth) {
-        TRG_MSG_DEBUG("NumberLeading ("<<p_NumberLeading<<")"
+    p_MaxTob = parameter("MaxTob").value();
+    if(p_MaxTob>inputWidth) {
+        TRG_MSG_DEBUG("MaxTob ("<<p_MaxTob<<")"
                       <<" is larger than InputWidth ("<<inputWidth<<")"
                       <<" : restricting to InputWidth");
-        p_NumberLeading = inputWidth;
+        p_MaxTob = inputWidth;
     }
     p_MinET = parameter("MinET").value();
     p_EtaMin = parameter("EtaMin").value();
@@ -51,7 +51,7 @@ TCS::EtaPhiWindow::initialize()
     p_PhiMin = parameter("PhiMin").value();
     p_PhiMax = parameter("PhiMax").value();
 
-    TRG_MSG_INFO("NumberLeading : "<<p_NumberLeading);
+    TRG_MSG_INFO("MaxTob : "<<p_MaxTob);
     TRG_MSG_INFO("MinET    : "<<p_MinET);
     TRG_MSG_INFO("EtaMin   : "<<p_EtaMin);
     TRG_MSG_INFO("EtaMax   : "<<p_EtaMax);
@@ -70,7 +70,7 @@ TCS::EtaPhiWindow::processBitCorrect(const std::vector<TCS::TOBArray const *> &i
 {
     if(input.size() == 1) {
         TRG_MSG_DEBUG("input size     : "<<input[0]->size());
-        const unsigned int nLeading = p_NumberLeading;
+        const unsigned int nLeading = p_MaxTob;
         bool accept{false};
         for(TOBArray::const_iterator tob1 = input[0]->begin();
             tob1 != input[0]->end();
@@ -104,7 +104,7 @@ TCS::EtaPhiWindow::process(const std::vector<TCS::TOBArray const *> &input,
 {
     if(input.size() == 1) {
         TRG_MSG_DEBUG("input size     : "<<input[0]->size());
-        const unsigned int nLeading = p_NumberLeading;
+        const unsigned int nLeading = p_MaxTob;
         bool accept{false};
         for(TOBArray::const_iterator tob1 = input[0]->begin();
             tob1 != input[0]->end();
diff --git a/Trigger/TrigT1/TrigT1Interfaces/src/TrigT1CaloDefs.cxx b/Trigger/TrigT1/TrigT1Interfaces/src/TrigT1CaloDefs.cxx
index 08e16eb2490c6d5da26671b1158b5899e2653110..a633ff0405b6bbb1fbb85a4de4c9a1b24ee27407 100644
--- a/Trigger/TrigT1/TrigT1Interfaces/src/TrigT1CaloDefs.cxx
+++ b/Trigger/TrigT1/TrigT1Interfaces/src/TrigT1CaloDefs.cxx
@@ -74,9 +74,9 @@ const std::string TrigT1CaloDefs::EmTauCTPLocation="CaloTriggerDataLocation/EmTa
 const std::string TrigT1CaloDefs::JetCTPLocation="CaloTriggerDataLocation/JetCTP";
 const std::string TrigT1CaloDefs::EnergyCTPLocation="CaloTriggerDataLocation/EnergyCTP";
 
-const std::string TrigT1CaloDefs::EmTauSlinkLocation="CaloTriggerDataLocation/EmTauSlink";
-const std::string TrigT1CaloDefs::jepSlinkLocation="CaloTriggerDataLocation/JEPSlink";
-const std::string TrigT1CaloDefs::energySlinkLocation="CaloTriggerDataLocation/JEPEnergySlink";
+const std::string TrigT1CaloDefs::EmTauSlinkLocation="CaloTriggerDataLocation_EmTauSlink";
+const std::string TrigT1CaloDefs::jepSlinkLocation="CaloTriggerDataLocation_JEPSlink";
+const std::string TrigT1CaloDefs::energySlinkLocation="CaloTriggerDataLocation_JEPEnergySlink";
 
 const std::string TrigT1CaloDefs::EmTauTopoTobLocation="EmTauTopoTOBs";
 const std::string TrigT1CaloDefs::JetTopoTobLocation="JetTopoTOBs";
diff --git a/Trigger/TrigT1/TrigT1RoIB/python/TrigT1RoIBConfig.py b/Trigger/TrigT1/TrigT1RoIB/python/TrigT1RoIBConfig.py
index 6065880ccd0f2ddda0782dfdeb62b21bed3556a6..100b8a2132e02f1f91de450de289fb51044808fb 100644
--- a/Trigger/TrigT1/TrigT1RoIB/python/TrigT1RoIBConfig.py
+++ b/Trigger/TrigT1/TrigT1RoIB/python/TrigT1RoIBConfig.py
@@ -9,7 +9,9 @@ class DefaultRoIBuilder(ROIB__RoIBuilder):
     def __init__(self, name = "DefaultRoIBuilder"):
         super( DefaultRoIBuilder, self ).__init__( name )
 
+
     def setDefaults(self, handle):
+
         pass
 
 class RoIBuilder(DefaultRoIBuilder):
@@ -27,7 +29,7 @@ class RoIBuilderInDigi(DefaultRoIBuilder):
 
     def __init__(self, name = "RoIBuilder"):
         super( RoIBuilderInDigi, self ).__init__( name )
-
+        
     def setDefaults(self, handle):
         DefaultRoIBuilder.setDefaults(handle)
 
diff --git a/Trigger/TrigT1/TrigT1RoIB/src/RoIBuilder.cxx b/Trigger/TrigT1/TrigT1RoIB/src/RoIBuilder.cxx
index d42faecb5d3024e3232b4f79b307ae9573d4c6a2..a017e1714a58fe1c23923a3fa2a9d6bad4fc3844 100644
--- a/Trigger/TrigT1/TrigT1RoIB/src/RoIBuilder.cxx
+++ b/Trigger/TrigT1/TrigT1RoIB/src/RoIBuilder.cxx
@@ -10,7 +10,7 @@
 
 // Gaudi/Athena includes:
 #include "AthenaKernel/errorcheck.h"
-#include "EventInfo/EventInfo.h"
+
 #include "EventInfo/EventID.h"
 #include "DataModel/DataVector.h"
 
@@ -18,13 +18,11 @@
 #include "eformat/SourceIdentifier.h"
 
 // TrigT1 includes:
-#include "TrigT1Result/RoIBResult.h"
-#include "TrigT1Interfaces/MuCTPIToRoIBSLink.h"
-#include "TrigT1Interfaces/TrigT1StoreGateKeys.h"
 #include "TrigT1Interfaces/TrigT1CTPDefs.h"
-#include "TrigT1Interfaces/CTPSLink.h"
-#include "TrigT1Interfaces/SlinkWord.h"
-#include "TrigT1Interfaces/TrigT1Interfaces_ClassDEF.h"
+
+
+
+
 
 // Local includes:
 #include "RoIBuilder.h"
@@ -39,25 +37,7 @@ namespace ROIB {
       : AthAlgorithm( name, pSvcLocator ) {
 
       // Property setting general behaviour:
-      declareProperty( "DoCalo", m_doCalo = true, "Use inputs from Calo system" );
-      declareProperty( "DoMuon", m_doMuon = true, "Use inputs from Muon system" );
-
-      // Properties for data object locations in StoreGate
-      declareProperty( "CTPSLinkLocation",
-                       m_ctpSLinkLocation = LVL1CTP::DEFAULT_CTPSLinkLocation,
-                       "StoreGate location of CTP RoI" );
-      declareProperty( "CaloEMTauLocation",
-                       m_caloEMTauLocation = LVL1::TrigT1CaloDefs::EmTauSlinkLocation,
-                       "StoreGate location of EmTau inputs" );
-      declareProperty( "CaloJetEnergyLocation",
-                       m_caloJetEnergyLocation = LVL1::TrigT1CaloDefs::jepSlinkLocation,
-                       "StoreGate location of JetEnergy inputs");
-      declareProperty( "MuCTPISLinkLocation",
-                       m_muctpiSLinkLocation = LVL1MUCTPI::DEFAULT_MuonRoIBLocation,
-                       "StoreGate location of MuCTPI inputs");
-      declareProperty( "RoIBRDOLocation",
-                       m_roibRDOLocation = ROIB::DEFAULT_RoIBRDOLocation,
-                       "StoreGate location of RoIB RDO");
+
    }
 
    //---------------------------------
@@ -69,17 +49,38 @@ namespace ROIB {
       ATH_MSG_INFO( "Initialisation for RoIBuilder algorithm." );
       ATH_MSG_INFO( " Version: " << PACKAGE_VERSION );
       ATH_MSG_INFO( "========================================" );
-
       // Print system info
       if( ! m_doCalo ) {
-         REPORT_MESSAGE( MSG::WARNING )
-            << "Inputs from LVL1 Calo systems switched off";
+	ATH_MSG_WARNING( "Inputs from LVL1 Calo systems switched off" );
       }
       if( ! m_doMuon ) {
-         REPORT_MESSAGE( MSG::WARNING )
-            << "Inputs from LVL1 Muon systems switched off";
+	ATH_MSG_WARNING("Inputs from LVL1 Muon systems switched off" );
       }
 
+      CHECK( m_eventInfoKey.initialize() );
+
+      if ( m_doCalo ) { 
+	CHECK( not m_caloEMTauLocation.empty() );
+	CHECK( not m_caloJetEnergyLocation.empty() );
+      } else {
+	renounceArray( m_caloEMTauLocation );
+	renounceArray( m_caloJetEnergyLocation );
+      }	
+      CHECK( m_caloEMTauLocation.initialize() );
+      CHECK( m_caloJetEnergyLocation.initialize() );
+	
+
+      if ( m_doMuon ) {
+	CHECK( not m_muctpiSLinkLocation.key().empty() );
+      } else {
+	renounce( m_muctpiSLinkLocation );
+
+      }
+      CHECK( m_muctpiSLinkLocation.initialize() );
+
+      CHECK( m_ctpSLinkLocation.initialize() );
+      CHECK( m_roibRDOLocation.initialize() );
+
       return StatusCode::SUCCESS;
    }
 
@@ -87,10 +88,8 @@ namespace ROIB {
    // finalize()
    //---------------------------------
    StatusCode RoIBuilder::finalize() {
-
       ATH_MSG_INFO( "Finalizing " << name()
                     << " - package version " << PACKAGE_VERSION );
-
       return StatusCode::SUCCESS;
    }
 
@@ -107,19 +106,15 @@ namespace ROIB {
       //
       // Get the official event ID:
       //
-      int evtNum = 0;
-      const EventInfo* thisEvent = 0;
-      if( evtStore()->retrieve( thisEvent ).isFailure() ) {
-         REPORT_MESSAGE( MSG::WARNING )
-            << "Unable to get EventInfo from SG!";
-         REPORT_MESSAGE( MSG::WARNING )
-            << "Using event number 0 in output!";
-      } else if( msgLvl( MSG::VERBOSE ) ) {
-         REPORT_MESSAGE( MSG::VERBOSE )
-            << "Retrieved EventInfo object from StoreGate.";
-         REPORT_MESSAGE( MSG::VERBOSE )
-            << "Event number is: " << ( evtNum = thisEvent->event_ID()->event_number() );
-      }
+
+      auto eventInfoHandle = SG::makeHandle( m_eventInfoKey );
+      CHECK( eventInfoHandle.isValid() );
+      const xAOD::EventInfo* thisEvent = eventInfoHandle.cptr();
+      // Note we are loosing precision here as we cast from 64 to 32 bits integer
+      // but this is constraint imposed by: Trigger/TrigT1/TrigT1Result/TrigT1Result/Header.h
+      const int evtNum = static_cast<int>(thisEvent->eventNumber());
+      ATH_MSG_VERBOSE( "Event number is: " << evtNum );
+
 
       /////////////////////////////////////////////////////////////////////////////
       //                                                                         //
@@ -137,46 +132,41 @@ namespace ROIB {
       // create data element
       std::vector< unsigned int > ctp_rdo_data;
 
-      // Try to retrieve CTP result from StoreGate:
       bool ctp_simulation_error = false;
-
-      const LVL1CTP::CTPSLink* ctp_slink = 0;
-      if( evtStore()->retrieve( ctp_slink, m_ctpSLinkLocation ).isFailure() ) {
-         ctp_simulation_error = true;
-         REPORT_MESSAGE( MSG::WARNING )
-            << "No CTP result found in TES at: " << m_ctpSLinkLocation;
+      auto ctpSlinkHandle = SG::makeHandle( m_ctpSLinkLocation );      
+      CHECK( ctpSlinkHandle.isValid() );
+      const LVL1CTP::CTPSLink* ctp_slink = ctpSlinkHandle.cptr();
+
+      // test for consistency
+      if ( ctp_slink->getCTPToRoIBWords().empty() ) {
+	ctp_simulation_error = true;
+	REPORT_MESSAGE( MSG::WARNING )
+	  << "CTP size is zero. No header, trailer, data element";
+
+      } else if( ctp_slink->getDataElements().size() != ctp_slink->getNumWordsPerCTPSLink() ) {
+	ctp_simulation_error = true;
+	REPORT_MESSAGE( MSG::WARNING )
+	  << "Found CTP size inconsistency: " 
+	  << ctp_slink->getDataElements().size() << "/"
+	  //<< LVL1CTP::CTPSLink::wordsPerCTPSLink
+	  << ctp_slink->getNumWordsPerCTPSLink()
+	  << " (found/expected)";
+	
+	// get the data elements
+	if( msgLvl( MSG::DEBUG ) ) {
+	  const std::vector< unsigned int > ctp_rdo_data_inc = ctp_slink->getDataElements();
+	  for( size_t i(0); i < ctp_rdo_data_inc.size(); ++i ) {
+	    ATH_MSG_DEBUG( "broken CTP RoI = " << std::setw( 2 ) << i << ' ' 
+			   << MSG::hex << std::setfill('0') << std::setw( 8 )
+			   << ctp_rdo_data_inc[i] 
+			   << MSG::dec << std::setfill(' ') );
+	  }
+	}
       } else {
-
-         // test for consistency
-         if ( ctp_slink->getCTPToRoIBWords().empty() ) {
-            ctp_simulation_error = true;
-            REPORT_MESSAGE( MSG::WARNING )
-               << "CTP size is zero. No header, trailer, data element";
-         //} else if( ctp_slink->getDataElements().size() != LVL1CTP::CTPSLink::wordsPerCTPSLink ) {
-         } else if( ctp_slink->getDataElements().size() != ctp_slink->getNumWordsPerCTPSLink() ) {
-            ctp_simulation_error = true;
-            REPORT_MESSAGE( MSG::WARNING )
-               << "Found CTP size inconsistency: " 
-               << ctp_slink->getDataElements().size() << "/"
-               //<< LVL1CTP::CTPSLink::wordsPerCTPSLink
-               << ctp_slink->getNumWordsPerCTPSLink()
-               << " (found/expected)";
-
-            // get the data elements
-            if( msgLvl( MSG::DEBUG ) ) {
-               const std::vector< unsigned int > ctp_rdo_data_inc = ctp_slink->getDataElements();
-               for( size_t i(0); i < ctp_rdo_data_inc.size(); ++i ) {
-                  ATH_MSG_DEBUG( "broken CTP RoI = " << std::setw( 2 ) << i << ' ' 
-                                 << MSG::hex << std::setfill('0') << std::setw( 8 )
-                                 << ctp_rdo_data_inc[i] 
-                                 << MSG::dec << std::setfill(' ') );
-               }
-            }
-         } else {
-            ATH_MSG_VERBOSE( "Retrieved CTP result from TES with key: "
-                             << m_ctpSLinkLocation );
-         }
+	ATH_MSG_VERBOSE( "Retrieved CTP result from TES with key: "
+			 << m_ctpSLinkLocation );
       }
+   
 
       if( ctp_simulation_error ) {
 
@@ -200,7 +190,7 @@ namespace ROIB {
             }
          }
 
-         // perpare trailer
+         // prepare trailer
          ctp_rdo_trailer = ctp_slink->getTrailer();
       }
 
@@ -220,14 +210,9 @@ namespace ROIB {
       //                                                                         //
       /////////////////////////////////////////////////////////////////////////////
 
-      std::vector< std::string > emtau_slink_location;
-      emtau_slink_location.push_back( m_caloEMTauLocation + "0" );
-      emtau_slink_location.push_back( m_caloEMTauLocation + "1" );
-      emtau_slink_location.push_back( m_caloEMTauLocation + "2" );
-      emtau_slink_location.push_back( m_caloEMTauLocation + "3" );
-
       std::vector< EMTauResult > emtau_rdo_result_vector;
 
+
       for( unsigned int slink = 0; slink < numEMTauSlinks; ++slink ) {
 
          eformat::helper::SourceIdentifier
@@ -238,44 +223,36 @@ namespace ROIB {
          bool emtau_simulation_error = false;
          const DataVector< LVL1CTP::SlinkWord >* emtau_slink = 0;
 
-         // get slink from storegate
          if( m_doCalo ) {
-            if( evtStore()->retrieve( emtau_slink,
-                                      emtau_slink_location[ slink ] ).isFailure() ) {
-               emtau_simulation_error = true;
-               REPORT_MESSAGE( MSG::WARNING )
-                  << "No EMTau Slink found in TES at: " << emtau_slink_location[ slink ];
-               REPORT_MESSAGE( MSG::WARNING )
-                  << "Creating empty EMTau RDO part!";
-            } else {
-               ATH_MSG_VERBOSE( "Retrieved EMTau Slink from TES with key: "
-                                << emtau_slink_location[ slink ] );
-            }
+	   ATH_MSG_VERBOSE("Reading " <<  m_caloEMTauLocation[slink].key() );
+	   auto handle = SG::makeHandle( m_caloEMTauLocation[slink] );
+	   CHECK( handle.isValid() );
+	   emtau_slink  = handle.cptr();	   
+
+	   unsigned int icnt = 0;
+	   DataVector< LVL1CTP::SlinkWord >::const_iterator itr =
+	     emtau_slink->begin();
+	   DataVector< LVL1CTP::SlinkWord >::const_iterator end =
+	     emtau_slink->end();
+	   for( ; itr != end; ++itr ) {
+	     
+	     ++icnt;
+	     if( ( icnt > ( wordsPerHeader + 1 ) ) &&
+		 ( icnt <= ( emtau_slink->size() - wordsPerTrailer - 1 ) ) ) {
+	       
+	       EMTauRoI emtau_roi( ( *itr )->word() );
+	       emtau_rdo_data.push_back( emtau_roi );
+	       ATH_MSG_DEBUG( "EmTau RoI  = " << MSG::hex << std::setw( 8 )
+			      << emtau_roi.roIWord() );	       
+	     }
+	   }
+         
          } else {
             emtau_simulation_error = true;
+	    ATH_MSG_VERBOSE( "Retrieved EMTau Slink from TES with key: " <<  m_caloEMTauLocation[slink] );
          }
 
-         if( emtau_slink ) {
-
-            unsigned int icnt = 0;
-            DataVector< LVL1CTP::SlinkWord >::const_iterator itr =
-               emtau_slink->begin();
-            DataVector< LVL1CTP::SlinkWord >::const_iterator end =
-               emtau_slink->end();
-            for( ; itr != end; ++itr ) {
-
-               ++icnt;
-               if( ( icnt > ( wordsPerHeader + 1 ) ) &&
-                   ( icnt <= ( emtau_slink->size() - wordsPerTrailer - 1 ) ) ) {
 
-                  EMTauRoI emtau_roi( ( *itr )->word() );
-                  emtau_rdo_data.push_back( emtau_roi );
-                  ATH_MSG_DEBUG( "EmTau RoI  = " << MSG::hex << std::setw( 8 )
-                                 << emtau_roi.roIWord() );
-
-               }
-            }
-         }
 
          Trailer emtau_rdo_trailer( 0, 0 );
          if( ! emtau_simulation_error ) {
@@ -296,10 +273,6 @@ namespace ROIB {
       //                                                                         //
       /////////////////////////////////////////////////////////////////////////////
 
-      std::vector< std::string > jetenergy_slink_location;
-      jetenergy_slink_location.push_back( m_caloJetEnergyLocation + "0" );
-      jetenergy_slink_location.push_back( m_caloJetEnergyLocation + "1" );
-
       std::vector< JetEnergyResult > jetenergy_rdo_result_vector;
 
       for( unsigned int slink = 0; slink < numJetEnergySlinks; ++slink ) {
@@ -312,45 +285,38 @@ namespace ROIB {
          bool jetenergy_simulation_error = false;
          const DataVector< LVL1CTP::SlinkWord >* jetenergy_slink = 0;
 
-         // get slink from storegate
          if( m_doCalo ) {
-            if( evtStore()->retrieve( jetenergy_slink,
-                                      jetenergy_slink_location[ slink ] ).isFailure() ) {
-               jetenergy_simulation_error = true;
-               REPORT_MESSAGE( MSG::WARNING )
-                  << "No JetEnergy Slink found in TES at: "
-                  << jetenergy_slink_location[ slink ];
-               REPORT_MESSAGE( MSG::WARNING )
-                  << "Creating empty JetEnergy RDO part!";
-            } else {
-               ATH_MSG_VERBOSE( "Retrieved JetEnergy Slink from TES with key: "
-                                << jetenergy_slink_location[ slink ] );
-            }
+	   auto handle = SG::makeHandle( m_caloJetEnergyLocation[slink] );
+	   CHECK( handle.isValid() );
+	   jetenergy_slink = handle.cptr();
+	   
+	   ATH_MSG_VERBOSE( "Retrieved JetEnergy Slink from TES with key: "
+			    << m_caloJetEnergyLocation[slink] );
+
+	   unsigned int icnt = 0;
+	   DataVector< LVL1CTP::SlinkWord >::const_iterator itr =
+	     jetenergy_slink->begin();
+	   DataVector< LVL1CTP::SlinkWord >::const_iterator end =
+	     jetenergy_slink->end();
+	   for( ; itr != end; ++itr ) {
+	     
+	     ++icnt;
+	     if( ( icnt > ( wordsPerHeader + 1 ) ) &&
+		 ( icnt <= ( jetenergy_slink->size() - wordsPerTrailer - 1 ) ) ) {
+	       
+	       JetEnergyRoI jetenergy_roi( ( *itr )->word() );
+	       jetenergy_rdo_data.push_back( jetenergy_roi );
+	       ATH_MSG_DEBUG( "Jet/Energy RoI    = " << MSG::hex << std::setw( 8 )
+			      << jetenergy_roi.roIWord() );
+	     }
+	   }
          } else {
             jetenergy_simulation_error = true;
          }
 
-         if( jetenergy_slink ) {
-            unsigned int icnt = 0;
-            DataVector< LVL1CTP::SlinkWord >::const_iterator itr =
-               jetenergy_slink->begin();
-            DataVector< LVL1CTP::SlinkWord >::const_iterator end =
-               jetenergy_slink->end();
-            for( ; itr != end; ++itr ) {
-
-               ++icnt;
-               if( ( icnt > ( wordsPerHeader + 1 ) ) &&
-                   ( icnt <= ( jetenergy_slink->size() - wordsPerTrailer - 1 ) ) ) {
-
-                  JetEnergyRoI jetenergy_roi( ( *itr )->word() );
-                  jetenergy_rdo_data.push_back( jetenergy_roi );
-                  ATH_MSG_DEBUG( "Jet/Energy RoI    = " << MSG::hex << std::setw( 8 )
-                                 << jetenergy_roi.roIWord() );
-               }
-            }
-         }
 
-         // Now wrap up the jetenergy triggers:
+
+         // Now wrap up the jet energy triggers:
          Trailer jetenergy_rdo_trailer( 0, 0 );
          if( !jetenergy_simulation_error ) {
             jetenergy_rdo_trailer.setNumDataWords( jetenergy_rdo_data.size() );
@@ -379,44 +345,36 @@ namespace ROIB {
       bool muctpi_simulation_error = false;
       const L1MUINT::MuCTPIToRoIBSLink* muctpi_slink = 0;
 
-      // get slink from storegate
       if( m_doMuon ) {
-         if( evtStore()->retrieve( muctpi_slink,
-                                   m_muctpiSLinkLocation ).isFailure() ) {
-            muctpi_simulation_error = true;
-            REPORT_MESSAGE( MSG::WARNING )
-               << "No MuCTPI result found in TES at: " << m_muctpiSLinkLocation;
-            REPORT_MESSAGE( MSG::WARNING )
-               << "Creating empty MuCTPI RDO part!";
-         } else {
-            ATH_MSG_VERBOSE( "Retrieved MuCTPI result from TES with key: "
-                             << m_muctpiSLinkLocation );
-         }
+	auto handle = SG::makeHandle( m_muctpiSLinkLocation );
+	CHECK( handle.isValid() );
+	muctpi_slink = handle.cptr();
+	ATH_MSG_VERBOSE( "Retrieved MuCTPI result from TES with key: "
+			 << m_muctpiSLinkLocation );
+
+	unsigned int icnt = 0;
+	std::vector< unsigned int >::const_iterator itr =
+	  muctpi_slink->getMuCTPIToRoIBWords().begin();
+	std::vector< unsigned int >::const_iterator end =
+	  muctpi_slink->getMuCTPIToRoIBWords().end();
+	for( ; itr != end; ++itr ) {
+	  
+	  ++icnt;
+	  if( ( icnt > ( wordsPerHeader + 1 ) ) &&
+	      ( icnt <= ( muctpi_slink->getMuCTPIToRoIBWords().size() -
+			  wordsPerTrailer ) ) ) {
+	    
+	    MuCTPIRoI muctpi_roi( *itr );
+	    muctpi_rdo_data.push_back( muctpi_roi );
+	    ATH_MSG_DEBUG( "MuCTPI RoI = " << MSG::hex << std::setw( 8 )
+			   << muctpi_roi.roIWord() );
+	  }
+	}
       } else {
          muctpi_simulation_error = true;
       }
 
-      if( muctpi_slink ){
 
-         unsigned int icnt = 0;
-         std::vector< unsigned int >::const_iterator itr =
-            muctpi_slink->getMuCTPIToRoIBWords().begin();
-         std::vector< unsigned int >::const_iterator end =
-            muctpi_slink->getMuCTPIToRoIBWords().end();
-         for( ; itr != end; ++itr ) {
-
-            ++icnt;
-            if( ( icnt > ( wordsPerHeader + 1 ) ) &&
-                ( icnt <= ( muctpi_slink->getMuCTPIToRoIBWords().size() -
-                            wordsPerTrailer ) ) ) {
-
-               MuCTPIRoI muctpi_roi( *itr );
-               muctpi_rdo_data.push_back( muctpi_roi );
-               ATH_MSG_DEBUG( "MuCTPI RoI = " << MSG::hex << std::setw( 8 )
-                              << muctpi_roi.roIWord() );
-            }
-         }
-      }
 
       Trailer muctpi_rdo_trailer( 0, 0 );
       if( ! muctpi_simulation_error ) {
@@ -431,9 +389,9 @@ namespace ROIB {
       //
       // Finally create RoIB RDO object:
       //
-      RoIBResult* roib_rdo_result = new RoIBResult( muctpi_rdo_result, ctp_rdo_result,
-                                                    jetenergy_rdo_result_vector,
-                                                    emtau_rdo_result_vector );
+      std::unique_ptr<RoIBResult> roib_rdo_result = std::make_unique< RoIBResult>( muctpi_rdo_result, ctp_rdo_result,
+										   jetenergy_rdo_result_vector,
+										   emtau_rdo_result_vector );
       if( msgLvl( MSG::DEBUG ) ) {
          ATH_MSG_DEBUG( "RoIB Results:" );
          roib_rdo_result->muCTPIResult().dumpData( msg( MSG::DEBUG ) );
@@ -445,15 +403,10 @@ namespace ROIB {
       //
       // Put RoIB RDO object into SG:
       //
-      if(evtStore()->contains<RoIBResult>(m_roibRDOLocation)) {
-         CHECK( evtStore()->overwrite( roib_rdo_result, m_roibRDOLocation ) );
-      } else {
-         CHECK( evtStore()->record( roib_rdo_result, m_roibRDOLocation ) );
-      }
+      auto roibHandle = SG::makeHandle( m_roibRDOLocation );
+      CHECK( roibHandle.record( std::move( roib_rdo_result ) ) );
+      // no owerwrite possible with DataHandles
 
-      //
-      // Return happily:
-      //
       return StatusCode::SUCCESS;
    }
 
diff --git a/Trigger/TrigT1/TrigT1RoIB/src/RoIBuilder.h b/Trigger/TrigT1/TrigT1RoIB/src/RoIBuilder.h
index c8aacd5ff077c96269eccd8af03cde1c66a8b146..d0e5e4eba5682cb3e71be21ecdfd34e3e522135c 100644
--- a/Trigger/TrigT1/TrigT1RoIB/src/RoIBuilder.h
+++ b/Trigger/TrigT1/TrigT1RoIB/src/RoIBuilder.h
@@ -4,14 +4,21 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-// $Id: RoIBuilder.h 500598 2012-05-14 15:39:58Z krasznaa $
 #ifndef TRIGT1ROIB_ROIBUILDER_H
 #define TRIGT1ROIB_ROIBUILDER_H
 
-// STL include(s):
 #include <string>
 
-// Athena/Gaudi include(s):
+
+#include "xAODEventInfo/EventInfo.h"
+#include "TrigT1Interfaces/CTPSLink.h"
+#include "TrigT1Interfaces/TrigT1StoreGateKeys.h"
+#include "TrigT1Interfaces/TrigT1Interfaces_ClassDEF.h"
+#include "TrigT1Interfaces/TrigT1CaloDefs.h"
+#include "TrigT1Interfaces/MuCTPIToRoIBSLink.h"
+#include "TrigT1Interfaces/SlinkWord.h"
+#include "TrigT1Result/RoIBResult.h"
+
 #include "AthenaBaseComps/AthAlgorithm.h"
 
 //! namespace for RoIBuilder related classes
@@ -33,25 +40,41 @@ namespace ROIB {
    class RoIBuilder : public AthAlgorithm {
 
    public:
-      /// Standard Gaudi algorithm constructor
       RoIBuilder( const std::string& name, ISvcLocator* pSvcLocator ) ;
 
-      // standard algorithm methods:
       virtual StatusCode initialize();
       virtual StatusCode execute();
       virtual StatusCode finalize();
 
    private:
-      // Properties:
-      bool m_doCalo; //!< property, see @link RoIBuilder::RoIBuilder @endlink
-      bool m_doMuon; //!< property, see @link RoIBuilder::RoIBuilder @endlink
+     Gaudi::Property<bool> m_doCalo{ this, "DoCalo", true, "Use inputs from Calo system" }; 
+     Gaudi::Property<bool> m_doMuon{ this, "DoMuon", true, "Use inputs from Muon system" }; 
 
       // String members containing locations of objects in SG:
-      std::string m_ctpSLinkLocation;      //!< property, see @link RoIBuilder::RoIBuilder @endlink
-      std::string m_caloEMTauLocation;     //!< property, see @link RoIBuilder::RoIBuilder @endlink
-      std::string m_caloJetEnergyLocation; //!< property, see @link RoIBuilder::RoIBuilder @endlink
-      std::string m_muctpiSLinkLocation;   //!< property, see @link RoIBuilder::RoIBuilder @endlink
-      std::string m_roibRDOLocation;       //!< property, see @link RoIBuilder::RoIBuilder @endlink
+     SG::ReadHandleKey<LVL1CTP::CTPSLink> m_ctpSLinkLocation{ this, "CTPSLinkLocation", 
+	 LVL1CTP::DEFAULT_CTPSLinkLocation, "StoreGate location of CTP RoI"};
+
+     typedef DataVector< LVL1CTP::SlinkWord> SlinkWordDV;
+
+     SG::ReadHandleKey<xAOD::EventInfo> m_eventInfoKey{ this, "EventInfoKey", "EventInfo", "Event info object "};
+
+     SG::ReadHandleKeyArray< SlinkWordDV > m_caloEMTauLocation{ this,   "CaloEMTauLocation", 
+	 { LVL1::TrigT1CaloDefs::EmTauSlinkLocation+"0", 
+	   LVL1::TrigT1CaloDefs::EmTauSlinkLocation+"1", 
+	   LVL1::TrigT1CaloDefs::EmTauSlinkLocation+"2", 
+	   LVL1::TrigT1CaloDefs::EmTauSlinkLocation+"3"  }, 
+	 "StoreGate location of EmTau inputs" };
+
+     SG::ReadHandleKeyArray< SlinkWordDV > m_caloJetEnergyLocation{ this, "CaloJetEnergyLocation", 
+	 { LVL1::TrigT1CaloDefs::jepSlinkLocation+"0", 
+	   LVL1::TrigT1CaloDefs::jepSlinkLocation+"1" },
+	 "StoreGate location of JetEnergy inputs" };
+
+     SG::ReadHandleKey<L1MUINT::MuCTPIToRoIBSLink> m_muctpiSLinkLocation{ this, "MuCTPISLinkLocation",
+									  LVL1MUCTPI::DEFAULT_MuonRoIBLocation,
+									  "StoreGate location of MuCTPI inputs" };
+     
+     SG::WriteHandleKey<RoIBResult> m_roibRDOLocation{ this, "RoIBRDOLocation", ROIB::DEFAULT_RoIBRDOLocation,  "StoreGate location of RoIB RDO" };
 
    }; // class RoIBuilder
 
diff --git a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_topOptions_MonitorSlice.py b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_topOptions_MonitorSlice.py
index 37d372f15f9a997b870c09d9710814ade7708b3a..4a890c7227a6f353befe5314197f721bb88dde4a 100755
--- a/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_topOptions_MonitorSlice.py
+++ b/Trigger/TrigValidation/TrigInDetValidation/share/TrigInDetValidation_RTT_topOptions_MonitorSlice.py
@@ -32,7 +32,7 @@ rID=False
 if 'doIDNewTracking' in dir() and doIDNewTracking==True:
   rID = True
 
-(idtrigChainlist, tidaAnalysischains) = minBiasChains(rMC,rID)
+(idtrigChainlist, tidaAnalysischains) = minBiasChains(rID)
 
 def resetSigs():
   TriggerFlags.Slices_all_setOff()
diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerGetter.py b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerGetter.py
index fe24e60ea2069c3a8d7019decabcc5648e099695..7d21f92130d5ca8a70d5fb9f2a55e891a48cd879 100644
--- a/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerGetter.py
+++ b/Trigger/TriggerCommon/TriggerJobOpts/python/Lvl1TriggerGetter.py
@@ -181,8 +181,8 @@ class Lvl1SimulationGetter (Configured):
             topSequence += CTPSimulationInReco("CTPSimulation")
             
             log.info("adding ROIB simulation to the topSequence")
-            from TrigT1RoIB.TrigT1RoIBConf import ROIB__RoIBuilder
-            topSequence += ROIB__RoIBuilder("RoIBuilder")
+            from TrigT1RoIB.TrigT1RoIBConfig import RoIBuilder
+            topSequence += RoIBuilder("RoIBuilder")
 
             # monitoring
             LVL1MonitoringTools()