diff --git a/Calo/CaloMoniDst/src/CaloAlignmentNtp.cpp b/Calo/CaloMoniDst/src/CaloAlignmentNtp.cpp
index 6273790581eb4b1b6ad344eaba30a8571f6c7e6a..dc84e31c785c6f76928abe53ccaa656a42ff8355 100644
--- a/Calo/CaloMoniDst/src/CaloAlignmentNtp.cpp
+++ b/Calo/CaloMoniDst/src/CaloAlignmentNtp.cpp
@@ -294,7 +294,7 @@ void CaloAlignmentNtp::operator()(const Vertices& verts, const ODIN& odin,
       double bStCY=0;
 
       if( hasBrem ){
-        const LHCb::State* bState = track->stateAt(LHCb::State::BegRich1);
+        auto bState = track->stateAt(LHCb::State::Location::BegRich1);
         if( bState == nullptr ){
           bState = &track->firstState();
           debug() << track->states();
diff --git a/Calo/CaloMoniDst/src/CaloPIDsChecker.cpp b/Calo/CaloMoniDst/src/CaloPIDsChecker.cpp
index 9729674ed038ac43f33c02b3fef16aaddfe3f2cd..1724cdbcdd29c4d090cd164015cb4c758b8e528d 100644
--- a/Calo/CaloMoniDst/src/CaloPIDsChecker.cpp
+++ b/Calo/CaloMoniDst/src/CaloPIDsChecker.cpp
@@ -102,7 +102,7 @@ private:
   Gaudi::Property<std::string> m_typName
     {this, "TrackType", "ALL"};
 
-  LHCb::Track::Types m_typ = LHCb::Track::TypeUnknown;
+  LHCb::Track::Types m_typ = LHCb::Track::Types::TypeUnknown;
   bool m_checkType = true;
 };
 
diff --git a/Calo/CaloPIDs/src/BremChi22ID.cpp b/Calo/CaloPIDs/src/BremChi22ID.cpp
index 92983cba82f145c8852143bef10b815551aa6565..7db620c599cd00918b5829be9cd71ca3c36027d0 100644
--- a/Calo/CaloPIDs/src/BremChi22ID.cpp
+++ b/Calo/CaloPIDs/src/BremChi22ID.cpp
@@ -20,8 +20,8 @@ public:
     _setProperty("CutOff", "10000");
     // track types:
     _setProperty("AcceptedType", Gaudi::Utils::toString<int>(
-                                     LHCb::Track::Velo, LHCb::Track::Long,
-                                     LHCb::Track::Upstream));
+                                     LHCb::Track::Types::Velo, LHCb::Track::Types::Long,
+                                     LHCb::Track::Types::Upstream));
   }
 };
 
diff --git a/Calo/CaloPIDs/src/CaloBremMatch.cpp b/Calo/CaloPIDs/src/CaloBremMatch.cpp
index 5b57166258598f4336f690c43dff9167d6c5fa59..51db9a0b4c86202a13c7f80d6f2138548c812972 100644
--- a/Calo/CaloPIDs/src/CaloBremMatch.cpp
+++ b/Calo/CaloPIDs/src/CaloBremMatch.cpp
@@ -121,15 +121,15 @@ StatusCode CaloBremMatch::match(const LHCb::CaloPosition* caloObj,
   // get the correct state
   const LHCb::State* state = nullptr;
   {  // get the correct state at TT
-    state = CaloTrackTool::state(*trObj, LHCb::State::AtTT);
+    state = CaloTrackTool::state(*trObj, LHCb::State::Location::AtTT);
     if (state == nullptr) {
-      state = CaloTrackTool::state(*trObj, LHCb::State::EndRich1);
+      state = CaloTrackTool::state(*trObj, LHCb::State::Location::EndRich1);
     }
     if (state == nullptr) {
-      state = CaloTrackTool::state(*trObj, LHCb::State::BegRich1);
+      state = CaloTrackTool::state(*trObj, LHCb::State::Location::BegRich1);
     }
     if (state == nullptr) {
-      state = CaloTrackTool::state(*trObj, LHCb::State::EndVelo);
+      state = CaloTrackTool::state(*trObj, LHCb::State::Location::EndVelo);
     }
     // no appropriate state is found
     if (state == nullptr) {
diff --git a/Calo/CaloPIDs/src/CaloElectronMatch.cpp b/Calo/CaloPIDs/src/CaloElectronMatch.cpp
index 07b4c091c437932ee7e733b6c223f6ac67816a63..f62c4c99b2f38de0c79fc9d0ca2c0a2ced5eedf4 100644
--- a/Calo/CaloPIDs/src/CaloElectronMatch.cpp
+++ b/Calo/CaloPIDs/src/CaloElectronMatch.cpp
@@ -120,16 +120,16 @@ StatusCode CaloElectronMatch::match(const LHCb::CaloPosition* caloObj,
   // get the correct state
   const LHCb::State* st = nullptr;
   {
-    st = CaloTrackTool::state(*trObj, LHCb::State::ECalShowerMax);
+    st = CaloTrackTool::state(*trObj, LHCb::State::Location::ECalShowerMax);
     if (st == nullptr) {
       StatusCode sc = propagate(*trObj, m_showerMax, _state());
       if (sc.isFailure()) {
         m_tBad = trObj;
         return Warning("match(): failure from propagate (1) ", sc);
       }
-      _state().setLocation(LHCb::State::ECalShowerMax);
+      _state().setLocation(LHCb::State::Location::ECalShowerMax);
       const_cast<LHCb::Track*>(trObj)->addToStates(_state());
-      st = CaloTrackTool::state(*trObj, LHCb::State::ECalShowerMax);
+      st = CaloTrackTool::state(*trObj, LHCb::State::Location::ECalShowerMax);
     }
     // check the validity of the state
     if (tolerance() < ::fabs(m_plane.Distance(st->position())))
diff --git a/Calo/CaloPIDs/src/CaloEnergyForTrack.cpp b/Calo/CaloPIDs/src/CaloEnergyForTrack.cpp
index e87e5118079f373fdf010d69bf1f8f3013e49c3c..2847956416cf1650aaec73f8d0ec5e308fb240ca 100644
--- a/Calo/CaloPIDs/src/CaloEnergyForTrack.cpp
+++ b/Calo/CaloPIDs/src/CaloEnergyForTrack.cpp
@@ -41,24 +41,24 @@ StatusCode CaloEnergyForTrack::initialize() {
   switch (caloID) {
     case 0:
       // SPD
-      m_location = LHCb::State::Spd;
+      m_location = LHCb::State::Location::Spd;
       m_planes = {calo()->plane(CaloPlane::Middle)};
       break;  // BREAK
     case 1:
       // PRS
-      m_location = LHCb::State::Prs;
+      m_location = LHCb::State::Location::Prs;
       m_planes = {calo()->plane(CaloPlane::Middle)};
       break;
     case 2:
       // ECAL
-      m_location = LHCb::State::ECalShowerMax;
+      m_location = LHCb::State::Location::ECalShowerMax;
       m_planes = {
           calo()->plane(CaloPlane::Front), calo()->plane(CaloPlane::ShowerMax),
           calo()->plane(CaloPlane::Middle), calo()->plane(CaloPlane::Back)};
       break;
     case 3:
       // HCAL
-      m_location = LHCb::State::MidHCal;
+      m_location = LHCb::State::Location::MidHCal;
       m_planes = {calo()->plane(CaloPlane::Front),
                   calo()->plane(CaloPlane::Middle),
                   calo()->plane(CaloPlane::Back)};
diff --git a/Calo/CaloPIDs/src/CaloEnergyForTrack.h b/Calo/CaloPIDs/src/CaloEnergyForTrack.h
index 0db5cf0a9ad1ccfee4a0a0f1a62d6bd8259e1928..ffdfced68a2f9ba0d84eed2b182b8eb5b8a6ea1e 100644
--- a/Calo/CaloPIDs/src/CaloEnergyForTrack.h
+++ b/Calo/CaloPIDs/src/CaloEnergyForTrack.h
@@ -130,7 +130,7 @@ class CaloEnergyForTrack : public virtual ICaloTrackIdEval,
   Gaudi::Property<double> m_bad
     {this, "BadValue", 1e+10, "The bad value to be returned"};
 
-  LHCb::State::Location       m_location = LHCb::State::Spd;
+  LHCb::State::Location       m_location = LHCb::State::Location::Spd;
   Planes                      m_planes;
   Gaudi::Property<unsigned short> m_morePlanes   {this, "MorePlanes", 0};
   Gaudi::Property<unsigned short> m_addNeighbors {this, "AddNeighbours", 0};
diff --git a/Calo/CaloPIDs/src/CaloPhotonMatch.cpp b/Calo/CaloPIDs/src/CaloPhotonMatch.cpp
index 44e828d90fa9bad9f989773259ae5b80c26fd5da..e845a5e1d8b6286bf0897c8f42ed86dedcc53462 100644
--- a/Calo/CaloPIDs/src/CaloPhotonMatch.cpp
+++ b/Calo/CaloPIDs/src/CaloPhotonMatch.cpp
@@ -20,10 +20,10 @@ class CaloPhotonMatch final : public virtual ICaloTrackMatch,
     StatusCode sc = CaloTrackMatch::initialize();
     if (sc.isFailure()) { return sc; }
     if (calo()->index() == CaloCellCode::EcalCalo) {
-      m_showerMaxLocation = LHCb::State::ECalShowerMax;
+      m_showerMaxLocation = LHCb::State::Location::ECalShowerMax;
       m_showerMax = calo()->plane(CaloPlane::ShowerMax);
     } else if (calo()->index() == CaloCellCode::HcalCalo) {
-      m_showerMaxLocation = LHCb::State::MidHCal;
+      m_showerMaxLocation = LHCb::State::Location::MidHCal;
       m_showerMax = calo()->plane(CaloPlane::Middle);
     } else {
       return Error("initialize: calorimeter niether Ecal nor Hcal");
diff --git a/Calo/CaloPIDs/src/InBremAcceptance.cpp b/Calo/CaloPIDs/src/InBremAcceptance.cpp
index e6f3e4c05ecaf81fae0e3ada8257bbce770826cc..3ce1714b346431da7895b37d22f83c7a8247da0c 100644
--- a/Calo/CaloPIDs/src/InBremAcceptance.cpp
+++ b/Calo/CaloPIDs/src/InBremAcceptance.cpp
@@ -51,8 +51,8 @@ bool InBremAcceptance::inAcceptance(const LHCb::Track* track) const {
   //
   // find the appropriate state
   const LHCb::State* state = nullptr;
-  for (const auto& loc : {LHCb::State::AtTT, LHCb::State::EndRich1,
-                          LHCb::State::BegRich1, LHCb::State::EndVelo}) {
+  for (const auto& loc : {LHCb::State::Location::AtTT, LHCb::State::Location::EndRich1,
+                          LHCb::State::Location::BegRich1, LHCb::State::Location::EndVelo}) {
     state = CaloTrackTool::state(*track, loc);
     if (state) break;
   }
diff --git a/Calo/CaloPIDs/src/InCaloAcceptance.cpp b/Calo/CaloPIDs/src/InCaloAcceptance.cpp
index 65e2b01528a150e3c27af8a0ce94b48ad84be792..d40d030d50b6b207d43a97941f6f89759225b1a7 100644
--- a/Calo/CaloPIDs/src/InCaloAcceptance.cpp
+++ b/Calo/CaloPIDs/src/InCaloAcceptance.cpp
@@ -51,22 +51,22 @@ StatusCode InCaloAcceptance::initialize() {
   switch (check_calorimeter_id) {
     case 0:
       // SPD
-      m_loc = LHCb::State::Spd;
+      m_loc = LHCb::State::Location::Spd;
       m_plane = calo()->plane(CaloPlane::Middle);
       break;  // BREAK
     case 1:
       // PRS
-      m_loc = LHCb::State::Prs;
+      m_loc = LHCb::State::Location::Prs;
       m_plane = calo()->plane(CaloPlane::Middle);
       break;  // BREAK
     case 2:
       // ECAL
-      m_loc = LHCb::State::ECalShowerMax;
+      m_loc = LHCb::State::Location::ECalShowerMax;
       m_plane = calo()->plane(CaloPlane::ShowerMax);
       break;  // BREAK
     case 3:
       // HCAL
-      m_loc = LHCb::State::MidHCal;
+      m_loc = LHCb::State::Location::MidHCal;
       m_plane = calo()->plane(CaloPlane::Middle);
       break;  // BREAK
     default:
diff --git a/Calo/CaloTools/src/CaloCosmicsTrackAlg.cpp b/Calo/CaloTools/src/CaloCosmicsTrackAlg.cpp
index d0b0175a4e1e4e020b28c85fd9ede63799ced938..04f4fb126301f982bd5befae18a2cf1d6c477d96 100644
--- a/Calo/CaloTools/src/CaloCosmicsTrackAlg.cpp
+++ b/Calo/CaloTools/src/CaloCosmicsTrackAlg.cpp
@@ -1,4 +1,4 @@
-// Include files 
+// Include files
 
 // from LHCb
 #include "GaudiKernel/Vector3DTypes.h"
@@ -61,8 +61,8 @@ StatusCode CaloCosmicsTrackAlg::execute() {
     fill( histo1D(HistoID("Rec/Forward/1"))  ,  0. , 1.); // bin0 = counter
     fill( histo1D(HistoID("Rec/Backward/1"))  ,  0. , 1.); // bin0 = counter
   }
-  
-  
+
+
   // create and store container
   LHCb::Tracks* forwards = new LHCb::Tracks();
   LHCb::Tracks* backwards = new LHCb::Tracks();
@@ -72,27 +72,27 @@ StatusCode CaloCosmicsTrackAlg::execute() {
   // process tracking
   StatusCode esc = m_caloTrack->processing();
   if(!m_caloTrack->tracked()){
-    if( UNLIKELY( msgLevel(MSG::DEBUG) ) ) 
+    if( UNLIKELY( msgLevel(MSG::DEBUG) ) )
       debug() << "No track reconstructed" << endmsg;
     return StatusCode::SUCCESS;
   }
-  
-      
+
+
   //store tracks
   LHCb::Track* track = new LHCb::Track();
   track->copy( m_caloTrack->track() );
   ( m_caloTrack->forward() ) ?  forwards->insert( track ) : backwards->insert( track );
 
-  
+
   // Checks
   if( UNLIKELY( msgLevel(MSG::DEBUG) ) ) {
     debug() << " Track ---- " << endmsg;
-    debug() << " backward  : "<< track->checkFlag(LHCb::Track::Backward) << endmsg;
-    debug() << " Timed : " << track->checkFlag(LHCb::Track::Selected) << " / " << m_caloTrack->timed() << endmsg;
+    debug() << " backward  : "<< track->checkFlag(LHCb::Track::Flags::Backward) << endmsg;
+    debug() << " Timed : " << track->checkFlag(LHCb::Track::Flags::Selected) << " / " << m_caloTrack->timed() << endmsg;
     debug() << " firstState : "<< track->firstState() << endmsg;
     // commented out by VB. 8.8.2k+9
     // debug() << " Time : " << track->likelihood()<< endmsg;
-    debug() << " Chi2 : " << track->info(LHCb::Track::FitMatchChi2, 999.)<< endmsg; 
+    debug() << " Chi2 : " << track->info(LHCb::Track::AdditionalInfo::FitMatchChi2, 999.)<< endmsg;
     double z = 8000;
     m_caloTrack->propagate( z );
     debug() << "Propagated track ---" << endmsg;
@@ -100,13 +100,13 @@ StatusCode CaloCosmicsTrackAlg::execute() {
     debug() << "Position Error : " << sqrt(m_caloTrack->referencePointCovariance()) << endmsg;
     debug() << "Time : " << m_caloTrack->time() << endmsg;
   }
-  
 
-    
+
+
   // Monitoring
   std::stringstream dir("");
   dir << ( m_caloTrack->forward()  ?  "Forward/" : "Backward/" );
-  if(m_monitor && m_caloTrack->tracked()){    
+  if(m_monitor && m_caloTrack->tracked()){
     fill( histo1D(HistoID("Rec/"+dir.str()+"1"))  ,  1. , 1.); // bin1 = reconstructed
     fill( histo1D(HistoID("Rec/1"))  ,  1. , 1.); // bin1 = reconstructed
     fill( histo1D(HistoID("Asymmetry/1")), m_caloTrack->ecal()->asymmetry(), 1.);
@@ -121,7 +121,7 @@ StatusCode CaloCosmicsTrackAlg::execute() {
       phi   += acos(-1.);
       if( phi > acos(-1.)) phi -= 2*acos(-1.); // phi in [-pi,pi]
       theta = acos(-1.) - theta; // theta in [0,pi]
-    }    
+    }
     fill( histo2D(HistoID("Rec/3")), phi, theta, 1.);
   }
   if(m_monitor && m_caloTrack->timed()){
@@ -134,10 +134,10 @@ StatusCode CaloCosmicsTrackAlg::execute() {
     fill( histo1D(HistoID("Rec/1"))  ,  3. , 1.); // bin2 = ecal+hcal timing
     fill( histo2D(HistoID("Rec/2"))  , m_caloTrack->ecal()->slot()+12.5, m_caloTrack->hcal()->slot()+12.5, 1. );
   }
-  
+
 
 
   if( m_caloTrack->tracked())setFilterPassed(true);
- 
+
   return StatusCode::SUCCESS;
 }
diff --git a/Calo/CaloTools/src/CaloCosmicsTrackTool.cpp b/Calo/CaloTools/src/CaloCosmicsTrackTool.cpp
index 04bd7fd042b8f5eab5e7b61fb791ee77260d39b4..47d89ab1f3d41f725fffc188a19e3f05727c3252 100644
--- a/Calo/CaloTools/src/CaloCosmicsTrackTool.cpp
+++ b/Calo/CaloTools/src/CaloCosmicsTrackTool.cpp
@@ -1,10 +1,10 @@
-// Include files 
+// Include files
 
 // From std
 #include <math.h>
 
 // from Gaudi
-#include "GaudiKernel/PhysicalConstants.h" 
+#include "GaudiKernel/PhysicalConstants.h"
 
 // from LHCb
 #include "GaudiKernel/Vector3DTypes.h"
@@ -45,7 +45,7 @@ CaloCosmicsTrackTool::CaloCosmicsTrackTool( const std::string& type,
 //=============================================================================
 StatusCode CaloCosmicsTrackTool::initialize() {
   StatusCode sc = base_class::initialize(); // must be executed first
-  if ( sc.isFailure() ) return sc;  
+  if ( sc.isFailure() ) return sc;
 
   if ( msgLevel(MSG::DEBUG) ) debug() << "==> Initialize" << endmsg;
 
@@ -65,7 +65,7 @@ StatusCode CaloCosmicsTrackTool::processing() {
 
   if ( msgLevel(MSG::DEBUG) ) debug() << "==> Execute" << endmsg;
 
-  
+
   m_odin->getTime();
   m_run = -1;
   m_evt = -1;
@@ -76,7 +76,7 @@ StatusCode CaloCosmicsTrackTool::processing() {
     m_evt = (long) odin->eventNumber()  ;
     m_bx  = odin->bunchId() ;
   }
-  
+
   // init
   m_track.reset();
   m_tracked=false;
@@ -98,24 +98,24 @@ StatusCode CaloCosmicsTrackTool::processing() {
   StatusCode esc = ecal()->processing();
   StatusCode hsc = hcal()->processing();
   if(esc.isFailure() )
-    if( UNLIKELY( msgLevel(MSG::DEBUG) ) ) 
+    if( UNLIKELY( msgLevel(MSG::DEBUG) ) )
       debug() << "EcalCosmic processing failed"<<endmsg;
   if(hsc.isFailure() )
-    if( UNLIKELY( msgLevel(MSG::DEBUG) ) ) 
+    if( UNLIKELY( msgLevel(MSG::DEBUG) ) )
       debug() << "HcalCosmic processing failed"<<endmsg;
-  
+
 
   if( !ecal()->tracked() || !hcal()->tracked() ){
-    if( UNLIKELY( msgLevel(MSG::DEBUG) ) ) 
+    if( UNLIKELY( msgLevel(MSG::DEBUG) ) )
       debug() << "Cannot reconstruct Cosmics (Ecal/Hcal):("
               <<ecal()->tracked()<<"/"<<hcal()->tracked()<<")"<<endmsg;
     return StatusCode::SUCCESS;
   }
-  
+
 
   // 1) ecal-hcal matching
   if( matching().isFailure() )return StatusCode::SUCCESS;
-  
+
   // 2) reconstruct 3D trajectory
   if( fit3D().isFailure() )return StatusCode::SUCCESS;
 
@@ -132,7 +132,7 @@ StatusCode CaloCosmicsTrackTool::processing() {
       m_stime = ecal()->timeVariance();
     }else{
       m_timed = false;
-    }    
+    }
   }
   else if(m_timer == "Hcal" ){
     if(hcal()->timed()){
@@ -140,7 +140,7 @@ StatusCode CaloCosmicsTrackTool::processing() {
       m_stime = hcal()->timeVariance();
     }else{
       m_timed = false;
-    }    
+    }
   }
   else if(m_timer == "EcalElseHcal" ){
     if(ecal()->timed() ){
@@ -156,17 +156,17 @@ StatusCode CaloCosmicsTrackTool::processing() {
   }
   // Update track info
   if( timed() ){
-    m_track.setFlag( LHCb::Track::Selected , true );
+    m_track.setFlag( LHCb::Track::Flags::Selected , true );
     // not stored anymore in Track class SHM
     //m_track.addInfo( LHCb::Track::CaloTimeInfo, m_time );
-  }  
+  }
 
 
   // 5) Ntupling
   if(m_tuple){
     if( tupling(500).isFailure())return StatusCode::FAILURE;
   }
- 
+
   return StatusCode::SUCCESS;
 }
 
@@ -174,11 +174,11 @@ StatusCode CaloCosmicsTrackTool::processing() {
 //=============================================================================
 StatusCode CaloCosmicsTrackTool::matching(){
 
-  // match Ecal and Hcal 
+  // match Ecal and Hcal
   // return phi and Chi2
 
   m_chi2 = 9999;
-  
+
 
   Gaudi::XYZVector vec = ecal()->referencePoint()-hcal()->referencePoint();
   m_dir = (vec.Y() > 0) ? +1 : -1;
@@ -187,13 +187,13 @@ StatusCode CaloCosmicsTrackTool::matching(){
   double dY  = vec.Y();
   double s2X = ecal()->referencePointVariance().X()+ hcal()->referencePointVariance().X();
   double s2Y = ecal()->referencePointVariance().Y()+ hcal()->referencePointVariance().Y();
-  m_phi  = (dX != 0) ?    atan( dY/dX ) :  acos( 0. );  
+  m_phi  = (dX != 0) ?    atan( dY/dX ) :  acos( 0. );
   double d2 = (dX*dX+dY*dY);
   m_sPhi = (d2 !=0) ? dY*dY/d2/d2*s2X + dX*dX/d2/d2*s2Y :  acos(-1.)*acos(-1.);
 
-  if( UNLIKELY( msgLevel(MSG::DEBUG) ) ) 
+  if( UNLIKELY( msgLevel(MSG::DEBUG) ) )
     debug() << " Phi = " << m_phi << " +- " << m_sPhi << endmsg;
-  // Chi2 = (phi-phi_eca<l)^2/sig^2 + (phi-phi_hcal)^2/sig^2 
+  // Chi2 = (phi-phi_eca<l)^2/sig^2 + (phi-phi_hcal)^2/sig^2
   double ePhi = ecal()->phi();
   double hPhi = hcal()->phi();
   double s2ePhi = ecal()->phiVariance();
@@ -212,7 +212,7 @@ StatusCode CaloCosmicsTrackTool::matching(){
 
 
 
-  if( UNLIKELY( msgLevel(MSG::DEBUG) ) ) 
+  if( UNLIKELY( msgLevel(MSG::DEBUG) ) )
     debug() << " Chi2 = " << m_chi2 << endmsg;
 
   if(m_chi2 > m_chi2max)return StatusCode::FAILURE;
@@ -228,7 +228,7 @@ StatusCode CaloCosmicsTrackTool::matching(){
 StatusCode CaloCosmicsTrackTool::fit3D(){
 
   Gaudi::Plane3D backEcal  = ecal()->det()->plane(CaloPlane::Back);
-  Gaudi::Plane3D frontHcal = hcal()->det()->plane(CaloPlane::Front);  
+  Gaudi::Plane3D frontHcal = hcal()->det()->plane(CaloPlane::Front);
   Gaudi::Plane3D frontEcal = ecal()->det()->plane(CaloPlane::Front);
   //  Gaudi::Plane3D middleEcal  = ecal()->det()->plane(CaloPlane::Middle);
   //  Gaudi::Plane3D middleHcal  = hcal()->det()->plane(CaloPlane::Middle);
@@ -246,12 +246,12 @@ StatusCode CaloCosmicsTrackTool::fit3D(){
   if( dist2D(eBound.second,hBound.second) < dist2D(eP,hP)){eP=eBound.second;hP=hBound.second;eM=eBound.first;hM=hBound.first;}
   if( dist2D(eBound.second,hBound.first)  < dist2D(eP,hP)){eP=eBound.second;hP=hBound.first;eM=eBound.first;hM=hBound.second;}
   //
-  double ePZ=( -backEcal.Normal().X()*eP.X()-backEcal.Normal().Y()*eP.Y() - backEcal.HesseDistance() )/backEcal.Normal().Z();  
-  double hPZ=(-frontHcal.Normal().X()*hP.X()-frontHcal.Normal().Y()*hP.Y()-frontHcal.HesseDistance() )/frontHcal.Normal().Z();  
+  double ePZ=( -backEcal.Normal().X()*eP.X()-backEcal.Normal().Y()*eP.Y() - backEcal.HesseDistance() )/backEcal.Normal().Z();
+  double hPZ=(-frontHcal.Normal().X()*hP.X()-frontHcal.Normal().Y()*hP.Y()-frontHcal.HesseDistance() )/frontHcal.Normal().Z();
   eP.SetZ(ePZ);
   hP.SetZ(hPZ);
-  double eMZ=(-frontEcal.Normal().X()*eM.X()-frontEcal.Normal().Y()*eM.Y()-frontEcal.HesseDistance() )/frontEcal.Normal().Z();  
-  double hMZ=(-backHcal.Normal().X()*hM.X()-backHcal.Normal().Y()*hM.Y()-backHcal.HesseDistance() )/backHcal.Normal().Z();  
+  double eMZ=(-frontEcal.Normal().X()*eM.X()-frontEcal.Normal().Y()*eM.Y()-frontEcal.HesseDistance() )/frontEcal.Normal().Z();
+  double hMZ=(-backHcal.Normal().X()*hM.X()-backHcal.Normal().Y()*hM.Y()-backHcal.HesseDistance() )/backHcal.Normal().Z();
   eM.SetZ(eMZ);
   hM.SetZ(hMZ);
   const LHCb::CaloCellID ePId =  ecal()->det()->Cell( eP );
@@ -260,7 +260,7 @@ StatusCode CaloCosmicsTrackTool::fit3D(){
   const LHCb::CaloCellID hMId =  hcal()->det()->Cell( hM );
   if( UNLIKELY( msgLevel(MSG::DEBUG) ) ) {
     debug() << "Closest Points " << eP << "/" << hP <<endmsg;
-    debug() << "--> " << ePId << "/" << hPId <<endmsg;  
+    debug() << "--> " << ePId << "/" << hPId <<endmsg;
     debug() << "Farest Points " << eM << "/" << hM <<endmsg;
     debug() << "--> " << eMId << "/" << hMId <<endmsg;
   }
@@ -270,7 +270,7 @@ StatusCode CaloCosmicsTrackTool::fit3D(){
   double hPSig = hcal()->det()->cellSize(hPId)*m_fac;
   double eMSig = ecal()->det()->cellSize(eMId)*m_fac;
   double hMSig = hcal()->det()->cellSize(hMId)*m_fac;
-  ePSig *= ePSig/12.;  
+  ePSig *= ePSig/12.;
   hPSig *= hPSig/12.;
   eMSig *= eMSig/12.;
   hMSig *= hMSig/12.;
@@ -280,7 +280,7 @@ StatusCode CaloCosmicsTrackTool::fit3D(){
     points.push_back(std::make_pair(eP , Gaudi::XYZPoint(ePSig,ePSig,0.)));
     points.push_back(std::make_pair(hP , Gaudi::XYZPoint(hPSig,hPSig,0.)));
   }
-  
+
   // middle plane (should depend on the trajectory.vs.acceptance)
   points.push_back( std::make_pair( ecal()->referencePoint(),ecal()->referencePointVariance()));
   points.push_back( std::make_pair( hcal()->referencePoint(),hcal()->referencePointVariance()));
@@ -292,35 +292,35 @@ StatusCode CaloCosmicsTrackTool::fit3D(){
   }
 
   /*
-  // @TODO TAKE THE TRAJECTORY.vs.ACCEPTANCE INTO ACCOUNT 
+  // @TODO TAKE THE TRAJECTORY.vs.ACCEPTANCE INTO ACCOUNT
   Gaudi::Math::XYZLine   line(eP, hP-eP); // 3D line
   // if the 3D line is in the whole Ecal acceptance add Ecal middle and front plane points
-  Gaudi::XYZPoint  point; 
-  double mu; 
-  Gaudi::Math::intersection<Gaudi::Math::XYZLine,Gaudi::Plane3D>(line,frontEcal,point,mu); 
-  if( ecal()()->det()->geometry()->isInside(point) ){ 
-    debug() << " cosmics cross the whole Ecal" << endmsg; 
-    const LHCb::CaloCellID id =  ecal()->det()->Cell( point ); 
+  Gaudi::XYZPoint  point;
+  double mu;
+  Gaudi::Math::intersection<Gaudi::Math::XYZLine,Gaudi::Plane3D>(line,frontEcal,point,mu);
+  if( ecal()()->det()->geometry()->isInside(point) ){
+    debug() << " cosmics cross the whole Ecal" << endmsg;
+    const LHCb::CaloCellID id =  ecal()->det()->Cell( point );
     points.push_back( std::make_pair(eM, Gaudi::XYZPoint(eMsig,eMsig,0.)));
-  } 
-  Gaudi::Math::intersection<Gaudi::Math::XYZLine,Gaudi::Plane3D>(line,backHcal,point,mu); 
-  if( hcal()()->det()->geometry()->isInside(point) ){ 
-    debug() << " cosmics cross the whole Hcal" << endmsg; 
-    const LHCb::CaloCellID id =  hcal()->det()->Cell( point ); 
+  }
+  Gaudi::Math::intersection<Gaudi::Math::XYZLine,Gaudi::Plane3D>(line,backHcal,point,mu);
+  if( hcal()()->det()->geometry()->isInside(point) ){
+    debug() << " cosmics cross the whole Hcal" << endmsg;
+    const LHCb::CaloCellID id =  hcal()->det()->Cell( point );
     points.push_back( std::make_pair(hM, Gaudi::XYZPoint(hMsig,hMsig,0.)));
-  } 
+  }
   */
-  
-  //  
-  double Ax = 0; 
-  double Bx = 0; 
-  double Cx = 0; 
-  double Dx = 0; 
-  double Ex = 0; 
-  double Ay = 0; 
-  double By = 0; 
-  double Cy = 0; 
-  double Dy = 0; 
+
+  //
+  double Ax = 0;
+  double Bx = 0;
+  double Cx = 0;
+  double Dx = 0;
+  double Ex = 0;
+  double Ay = 0;
+  double By = 0;
+  double Cy = 0;
+  double Dy = 0;
   double Ey = 0;
 
   Gaudi::XYZVector d = ecal()->referencePoint()-hcal()->referencePoint();
@@ -346,15 +346,15 @@ StatusCode CaloCosmicsTrackTool::fit3D(){
     debug() << "(A->E)x " << Ax << " " << Bx << " " << Cx << " " << Dx << " " << Ex << endmsg;
     debug() << "(A->E)y " << Ay << " " << By << " " << Cy << " " << Dy << " " << Ey << endmsg;
   }
-  
+
   m_tx = -(Dx*Cx-Bx*Ex)/(Ax*Dx-Bx*Bx);
   m_ty = -(Dy*Cy-By*Ey)/(Ay*Dy-By*By);
-  if( UNLIKELY( msgLevel(MSG::DEBUG) ) ) 
+  if( UNLIKELY( msgLevel(MSG::DEBUG) ) )
     debug() << "tx = " << m_tx << "  ty = " << m_ty << endmsg;
   double x0   =  (Bx*Cx-Ax*Ex)/(Ax*Dx-Bx*Bx);
   double y0   =  (By*Cy-Ay*Ey)/(Ay*Dy-By*By);
 
-  // Theta 
+  // Theta
   double tth = sqrt( m_tx*m_tx + m_ty*m_ty);
   m_theta = atan( tth );
   // Approximate error
@@ -363,13 +363,13 @@ StatusCode CaloCosmicsTrackTool::fit3D(){
   m_sty = m_ty*m_ty * (sD.Y()/d.Y()/d.Y() + sD.Z()/d.Z()/d.Z() );
   double sTth  = (m_tx/tth)*(m_tx/tth) * m_stx + (m_ty/tth)*(m_ty/tth) * m_sty;
   m_sTheta     = sTth / (1+tth*tth)/(1+tth*tth);
-  
+
   // Phi
   double tphi = m_ty/m_tx;
   m_phi = atan(tphi);
   if(m_phi<0.)m_phi += acos(-1.);
   if(m_dir == 1)m_phi -= acos(-1.);
-  
+
   // Ecal reference
   double ex = x0 + m_tx *ecal()->referencePoint().Z();
   double ey = y0 + m_ty *ecal()->referencePoint().Z();
@@ -388,20 +388,20 @@ StatusCode CaloCosmicsTrackTool::fit3D(){
   m_refPointCov[1](1,1)= hcal()->referencePointVariance().Y();  // APPROXIMATIVE ERROR
 
   if( UNLIKELY( msgLevel(MSG::DEBUG) ) ) {
-    debug() << " Ecal Reference Point : (" 
+    debug() << " Ecal Reference Point : ("
             << ecal()->referencePoint().X() << ","
             << ecal()->referencePoint().Y() << ","
             << ecal()->referencePoint().Z() << ") "
-            << "  -> Fit3D : (" 
+            << "  -> Fit3D : ("
             << ex << ","
             << ey  << ","
             << ecal()->referencePoint().Z() << ") " << endmsg;
     debug() << " Theta = " << m_theta << endmsg;
   }
-  
+
   m_slopes = Gaudi::XYZVector( m_tx, m_ty , m_dir );
   m_slopesCov(0,0) = m_stx;
-  m_slopesCov(1,1) = m_sty;  
+  m_slopesCov(1,1) = m_sty;
 
   return StatusCode::SUCCESS;
 }
@@ -427,7 +427,7 @@ StatusCode CaloCosmicsTrackTool::buildTrack(){
   eTrM(1,1) = m_refPointCov[0](1,1);
   eTrM(2,2) = m_stx;
   eTrM(3,3) = m_sty;
-  LHCb::State eState = LHCb::State( eTrV , eTrM , ecal()->referencePoint().Z() , LHCb::State::MidECal);
+  LHCb::State eState = LHCb::State( eTrV , eTrM , ecal()->referencePoint().Z() , LHCb::State::Location::MidECal);
 
 
   Gaudi::TrackVector hTrV ;
@@ -442,10 +442,10 @@ StatusCode CaloCosmicsTrackTool::buildTrack(){
   hTrM(2,2) = m_stx;
   hTrM(3,3) = m_sty;
 
-  LHCb::State hState = LHCb::State( hTrV , hTrM , hcal()->referencePoint().Z() , LHCb::State::MidHCal);
+  LHCb::State hState = LHCb::State( hTrV , hTrM , hcal()->referencePoint().Z() , LHCb::State::Location::MidHCal);
 
   // Track
-  m_track.setType(LHCb::Track::Calo);
+  m_track.setType(LHCb::Track::Types::Calo);
   // Default reference position is Ecal
   m_ref = 0; // reference is Ecal by default
   // Set first state according to 'timer'
@@ -476,19 +476,19 @@ StatusCode CaloCosmicsTrackTool::buildTrack(){
 
   // not stored anymore in Track class
   //m_track.addInfo( LHCb::Track::CaloMatchChi2, m_chi2);
-  if( !forward())m_track.setFlag( LHCb::Track::Backward, true );
+  if( !forward())m_track.setFlag( LHCb::Track::Flags::Backward, true );
 
 
   // Global reference
   m_refPt = m_refPoint[m_ref];
-  m_refPtCov = m_refPointCov[m_ref];  
+  m_refPtCov = m_refPointCov[m_ref];
 
   return StatusCode::SUCCESS;
 }
 
 
 //=============================================================================
-StatusCode CaloCosmicsTrackTool::tupling(unsigned int unit){  
+StatusCode CaloCosmicsTrackTool::tupling(unsigned int unit){
 
 
   if( ecal()->tupling(unit+1).isFailure())return StatusCode::FAILURE;
@@ -508,7 +508,7 @@ StatusCode CaloCosmicsTrackTool::tupling(unsigned int unit){
   sc = ntp->column("hSlot"  , hcal()->slot() );
   sc = ntp->column("eDep"  , ecal()->deposit() );
   sc = ntp->column("hDep"  , hcal()->deposit() );
-  sc = ntp->column("direction"   , m_dir); 
+  sc = ntp->column("direction"   , m_dir);
   sc = ntp->column("L"      , vec.R() );
   sc = ntp->column("chi2"   , m_chi2 );
   sc = ntp->column("phi"    , m_phi );
@@ -531,13 +531,13 @@ StatusCode CaloCosmicsTrackTool::tupling(unsigned int unit){
   sc = ntp->column("dY"  , vec.Y());
   sc = ntp->column("dZ"  , vec.Z());
 
-  sc=ntp->write(); 
+  sc=ntp->write();
 
 
   if(sc.isFailure())Warning(name() + " Ntupling failed").ignore();
-  return sc; 
-} 
-  
+  return sc;
+}
+
 
 
 StatusCode CaloCosmicsTrackTool::propagate(double z){
diff --git a/Muon/MuonTrackAlign/src/AlignMuonRec.cpp b/Muon/MuonTrackAlign/src/AlignMuonRec.cpp
index 408ecffa5ac119ff2fa2b0953ef209fb14d39a0f..2440c72bbd80fc062464083ca3a1e767425054ea 100755
--- a/Muon/MuonTrackAlign/src/AlignMuonRec.cpp
+++ b/Muon/MuonTrackAlign/src/AlignMuonRec.cpp
@@ -334,7 +334,7 @@ StatusCode AlignMuonRec::execute() {
 	    temp.setErrQOverP2(sigmaQOverP*sigmaQOverP);
 	  }
 
-	  temp.setLocation(LHCb::State::EndVelo);
+	  temp.setLocation(LHCb::State::Location::EndVelo);
 	  trgTr->addToStates( temp );
 	  trgTr->addToLhcbIDs((*iV).tile());
 
diff --git a/Muon/MuonTrackAlign/src/MuonRead.cpp b/Muon/MuonTrackAlign/src/MuonRead.cpp
index 8751fb976d8ea8df604bb8e9ea669d643b8365ee..7731bddf299956900890861045de6a9b8daf33a4 100755
--- a/Muon/MuonTrackAlign/src/MuonRead.cpp
+++ b/Muon/MuonTrackAlign/src/MuonRead.cpp
@@ -79,7 +79,7 @@ StatusCode MuonRead::execute() {
     for( const LHCb::Node* node: (*it)->nodes() ) {
       debug()<<" node information "<< node->z();
 
-      if ( node->z() > 11900 && node->type()!=LHCb::Node::Outlier  ) {
+      if ( node->z() > 11900 && node->type()!=LHCb::Node::Type::Outlier  ) {
         debug() << " ----  in the Muon detector "<< endmsg;
         const LHCb::State& state =node->state();
 
diff --git a/Muon/MuonTrackRec/src/component/MuonNNetRec.cpp b/Muon/MuonTrackRec/src/component/MuonNNetRec.cpp
index 5b5525b489dfde80f9194131d75bcfa886039f51..4ce8b7cd1b8f768fa6e472b17ab81816c031801d 100644
--- a/Muon/MuonTrackRec/src/component/MuonNNetRec.cpp
+++ b/Muon/MuonTrackRec/src/component/MuonNNetRec.cpp
@@ -628,7 +628,7 @@ StatusCode MuonNNetRec::copyToLHCbTracks()
         Gaudi::XYZPoint trackPos(t.bx() + t.sx()*z, t.by() + t.sy()*z, z);
         LHCb::State state( LHCb::StateVector( trackPos,
                                               Gaudi::XYZVector( t.sx(), t.sy(), 1.0 ), 1./10000.));
-        state.setLocation( LHCb::State::Muon );
+        state.setLocation( LHCb::State::Location::Muon );
         track->addToStates( state );
         for ( const auto& hits : t.getHits() ) {
           for (const auto& tileID : hits->getLogPadTiles()) {
diff --git a/Muon/MuonTrackRec/src/component/MuonTrackMomRec.cpp b/Muon/MuonTrackRec/src/component/MuonTrackMomRec.cpp
index 83e78cf0e70202633a310ab4eaaf05532d09cc5f..0f59c83f26d8e9b733004dffd66a1944eae2c466 100644
--- a/Muon/MuonTrackRec/src/component/MuonTrackMomRec.cpp
+++ b/Muon/MuonTrackRec/src/component/MuonTrackMomRec.cpp
@@ -163,7 +163,7 @@ std::unique_ptr<LHCb::Track> MuonTrackMomRec::recMomentum(MuonTrack& track) cons
   seedCov(4,4) = sigmaQOverP2;
   state.setCovariance(seedCov);
 
-  state.setLocation( LHCb::State::Muon );
+  state.setLocation( LHCb::State::Location::Muon );
 
   debug() << "Muon state = " << state << endmsg;
 
diff --git a/Pr/PrFitParams/src/PrFitMatchParams.cpp b/Pr/PrFitParams/src/PrFitMatchParams.cpp
index a8c81ed940acf07ad7a8067df9020712d36a963f..79dd7c310d6a18f6ade649211d5be08db1281f56 100644
--- a/Pr/PrFitParams/src/PrFitMatchParams.cpp
+++ b/Pr/PrFitParams/src/PrFitMatchParams.cpp
@@ -1,5 +1,4 @@
-// $Id: KsFitParams.cpp,v 1.5 2009/08/19 14:24:18 ocallot Exp $
-// Include files 
+// Include files
 
 // from Gaudi
 #include "GaudiKernel/SystemOfUnits.h"
@@ -44,15 +43,15 @@ StatusCode PrFitMatchParams::initialize() {
   if( m_zMagParams.empty() ) info() << "no starting values for magnet parameters provided. Will not calculate anything" << endmsg;
   if( m_momParams.empty() ) info() << "no starting values for momentum  parameters provided. Will not calculate anything" << endmsg;
   if( m_bendYParams.empty() ) info() << "no starting values for y bending  parameters provided. Will not calculate anything" << endmsg;
-  
+
 
   m_fitTool = tool<IPrFitTool>( "PrFitTool" );
-  
+
   m_zMagPar.init( "zMagnet"  , m_zMagParams );
   m_momPar.init ( "momentum" , m_momParams );
   m_bendParamY.init( "bendParamY", m_bendYParams);
-  
-  
+
+
   return StatusCode::SUCCESS;
 }
 //=============================================================================
@@ -67,7 +66,7 @@ StatusCode PrFitMatchParams::execute() {
 
   // -- As this algorithm is the only one running, even the usual counter is not included.
   if( m_nEvent % 100 == 0 ) info() << "Event " << m_nEvent << endmsg;
-  
+
   debug() << "Processing event: " << m_nEvent << endmsg;
 
 
@@ -77,7 +76,7 @@ StatusCode PrFitMatchParams::execute() {
     return StatusCode::SUCCESS;
   }
 
-  
+
   LHCb::MCParticles* partCtnr = get<LHCb::MCParticles>( LHCb::MCParticleLocation::Default );
 
   // Get the FT and UT hits
@@ -90,14 +89,14 @@ StatusCode PrFitMatchParams::execute() {
   LHCb::MCParticles::const_iterator pItr;
   const LHCb::MCParticle* part;
   SmartRefVector<LHCb::MCVertex> vDecay;
-  
+
   // A container for used hits
   std::vector<Gaudi::XYZPoint> trHits;
   std::vector<Gaudi::XYZPoint> UTHits;
   std::vector<Gaudi::XYZPoint> vHits;
 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
-  
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
+
 
   for ( pItr = partCtnr->begin(); partCtnr->end() != pItr; pItr++ ) {
     part = *pItr;
@@ -130,57 +129,57 @@ StatusCode PrFitMatchParams::execute() {
 
 
     debug() << "--- Found particle key " << part->key() << endmsg;
-    
+
     UTHits.clear();
     trHits.clear();
     vHits.clear();
-    
+
     // Get the Velo hits
     for ( auto vHitIt = veloHits->begin() ; veloHits->end() != vHitIt ; vHitIt++ ) {
       if ( (*vHitIt)->mcParticle() ==  part ) {
         vHits.push_back( (*vHitIt)->midPoint() );
       }
     }
-    
+
     // Get the FT hits
     for ( auto iHitFt = ftHits->begin() ; ftHits->end() != iHitFt ; iHitFt++ ) {
       if ( (*iHitFt)->mcParticle() ==  part ) {
         trHits.push_back( (*iHitFt)->midPoint() );
       }
     }
-    
+
     // Get the UT hits
     for ( auto iHitut = utHits->begin();  utHits->end() != iHitut ; iHitut++ ) {
       if ( (*iHitut)->mcParticle() ==  part ) {
         UTHits.push_back( (*iHitut)->midPoint() );
       }
     }
-    
+
     if ( 12 > trHits.size() || 6 > vHits.size() )  continue;
     if( m_requireUTHits){
       if( 3 > UTHits.size() ) continue;
     }
-    
+
 
     debug() << " particle momentum = " << part->momentum().R() / Gaudi::Units::GeV << " GeV"
             << endmsg;
-    
+
     //== Fill ntuple
     double pz = part->momentum().Z();
     double plXT = part->momentum().X() / pz;
     double plYT = part->momentum().Y() / pz;
-    
+
     Tuple tTrack = nTuple( m_tupleName );
-    
+
     tTrack->column("pz",pz);
     tTrack->column("plXT", plXT);
     tTrack->column("plYT", plYT);
-    
-    
+
+
     m_nTrack++;
-    
+
     //== Fit the UT area
-    // -- This is not needed at the moment for the matching, but it was kept it 
+    // -- This is not needed at the moment for the matching, but it was kept it
     // -- as it might be used at some point in the future
     debug() << "  UT: ";
     const auto utFitXLine = m_fitTool->fitLine(UTHits, IPrFitTool::XY::X, m_zUT1);
@@ -202,7 +201,7 @@ StatusCode PrFitMatchParams::execute() {
           cxt2 = std::get<2>(*utFitXParab);
 
     debug() << format( " x %7.1f tx %7.4f   y %7.1f ty %7.4f ",
-                       axt, bxt, ayt, byt ) 
+                       axt, bxt, ayt, byt )
             << endmsg;;
     tTrack->column( "axt" , axt );
     tTrack->column( "bxt", bxt );
@@ -211,8 +210,8 @@ StatusCode PrFitMatchParams::execute() {
     tTrack->column( "axt2", axt2 );
     tTrack->column( "bxt2", bxt2 );
     tTrack->column( "cxt2", cxt2 );
-    
-    
+
+
     std::vector<Gaudi::XYZPoint>::const_iterator itP;
     if ( msgLevel( MSG::DEBUG ) ) {
       for ( itP = UTHits.begin(); UTHits.end() > itP; itP++ ) {
@@ -225,7 +224,7 @@ StatusCode PrFitMatchParams::execute() {
                            ) << endmsg;
       }
     }
-    
+
     // -- Fit the T-stations
     // -- x(z) = ax + bx*z + cx*z*z + dx*z*z*z
     // -- y(z) = ay + by*z
@@ -250,11 +249,11 @@ StatusCode PrFitMatchParams::execute() {
     tTrack->column( "dx", dx );
     tTrack->column( "ay", ay );
     tTrack->column( "by", by );
-    
+
     if ( msgLevel( MSG::DEBUG ) ) {
-      debug() << format( "  tr: x%7.1f %7.4f %7.3f %7.3f  y%7.1f %7.4f", 
+      debug() << format( "  tr: x%7.1f %7.4f %7.3f %7.3f  y%7.1f %7.4f",
                          ax, bx, 1.e6*cx, 1.e9*dx, ay, by ) << endmsg;
-      
+
       for ( itP = trHits.begin(); trHits.end() > itP; itP++ ) {
         const double dz = (*itP).z()-m_zRef;
         debug() << format( "    : %7.1f %7.1f %7.1f  dx %7.3f  dy %7.3f",
@@ -264,7 +263,7 @@ StatusCode PrFitMatchParams::execute() {
                            ) << endmsg;
       }
     }
-    
+
     // -- Fit the velo area
     // -- x(z) = axv + bxv*z
     // -- y(z) = ayv + byv*z
@@ -285,11 +284,11 @@ StatusCode PrFitMatchParams::execute() {
     tTrack->column( "bxv", bxv );
     tTrack->column( "ayv", ayv );
     tTrack->column( "byv", byv );
-    
+
     if ( msgLevel( MSG::DEBUG ) ) {
-      debug() << format( "  velo: x%7.1f %7.4f y%7.1f %7.4f", 
+      debug() << format( "  velo: x%7.1f %7.4f y%7.1f %7.4f",
                          axv, bxv, ayv, byv ) << endmsg;
-      
+
       for ( itP = vHits.begin(); vHits.end() > itP; itP++ ) {
         const double dz = (*itP).z()-m_zRef;
         debug() << format( "    : %7.1f %7.1f %7.1f  dx %7.3f  dy %7.3f",
@@ -299,14 +298,14 @@ StatusCode PrFitMatchParams::execute() {
                            ) << endmsg;
       }
     }
-    
+
     // -- This is for finding the zMagnet position when using straight lines from the Velo and the T-stations
     // -- Only really makes sense in x, as for y the different y resolutions of Velo and T-stations matter a lot
     double zMagnet = (axv-bxv*m_zVelo - (ax-bx*m_zRef) ) / (bx-bxv);
     double zMagnety = (ayt-byt*m_zUT1 - (ay-by*m_zRef) ) / (by-byt);
     double dSlope =  fabs(bx - bxv);
     double dSlopeY = fabs(by - byv);
-   
+
     m_zMagPar.setFun( 0, 1. );
     m_zMagPar.setFun( 1, fabs(dSlope) );
     m_zMagPar.setFun( 2, dSlope*dSlope );
@@ -314,7 +313,7 @@ StatusCode PrFitMatchParams::execute() {
     m_zMagPar.setFun( 4, bxv*bxv );
 
     double zEst = m_zMagPar.sum();
-    
+
     m_zMagPar.addEvent( zMagnet-zEst );
 
     tTrack->column( "zEst", zEst );
@@ -323,40 +322,40 @@ StatusCode PrFitMatchParams::execute() {
 
     // -- This is the parameter that defines the bending in y
     double bendParamY = (ay - ayv) + ( m_zMatchY - m_zRef )*by - (m_zMatchY - m_zVelo)*byv;
-    
+
     m_bendParamY.setFun( 0, dSlope*dSlope*byv );
     m_bendParamY.setFun( 1, dSlopeY*dSlopeY*byv );
-    
+
     double bendParamYEst = m_bendParamY.sum();
     m_bendParamY.addEvent( bendParamY - bendParamYEst );
     // ------------------------------------------------------
-    
+
     tTrack->column("dSlope",dSlope);
     tTrack->column("dSlope2",dSlope*dSlope);
-  
+
     // -- Need to write something to calculate the momentum Params
     const double charge = part->particleID().threeCharge()/3;
     const double qOverP = charge/momentum;
-    
-    // -- The magnet scale factor is hardcoded, as then one does not need to run the 
-    // -- field service 
+
+    // -- The magnet scale factor is hardcoded, as then one does not need to run the
+    // -- field service
     const double proj = sqrt( ( 1. + bxv*bxv + byv*byv ) / ( 1. + bxv*bxv ) );
     const double coef = (bxv - bx)/(proj*m_magnetScaleFactor*Gaudi::Units::GeV*qOverP);
-    
+
     m_momPar.setFun(0, 1.);
     m_momPar.setFun(1, bx*bx );
     m_momPar.setFun(2, bx*bx*bx*bx );
     m_momPar.setFun(3, bx*bxv );
     m_momPar.setFun(4, byv*byv );
     m_momPar.setFun(5, byv*byv*byv*byv );
-    
+
     double coefEst = m_momPar.sum();
     m_momPar.addEvent( coef - coefEst );
 
     tTrack->write();
 
   }
-  
+
   return StatusCode::SUCCESS;
 }
 
@@ -365,7 +364,7 @@ StatusCode PrFitMatchParams::execute() {
 //  Determine resolution
 //=============================================================================
 void PrFitMatchParams::resolution(){
-  
+
   LinkedFrom<LHCb::Track, LHCb::MCParticle> myVeloLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Velo);
   LinkedFrom<LHCb::Track, LHCb::MCParticle> mySeedLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Seed);
 
@@ -380,20 +379,20 @@ void PrFitMatchParams::resolution(){
   std::vector<Gaudi::XYZPoint> VPHits;
 
    LHCb::MCParticles* mcParts = getIfExists<LHCb::MCParticles>( LHCb::MCParticleLocation::Default );
-   if ( msgLevel( MSG::ERROR ) && !mcParts ) error() << "Could not find MCParticles at: " 
-						     <<  LHCb::MCParticleLocation::Default 
+   if ( msgLevel( MSG::ERROR ) && !mcParts ) error() << "Could not find MCParticles at: "
+						     <<  LHCb::MCParticleLocation::Default
 						     << endmsg;
 
-   MCTrackInfo trackInfo( evtSvc(), msgSvc() );
-   
+   MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
+
    for(const LHCb::MCParticle* mcPart:  *mcParts){
-     
-     
+
+
      if( mcPart == nullptr ) continue;
      if( std::abs(mcPart->particleID().pid()) == 11 ) continue;
-     
+
      if(  !trackInfo.hasVeloAndT( mcPart)  ) continue;
-     
+
      LHCb::Track* vtrack = myVeloLink.first( mcPart );
      LHCb::Track* ttrack = mySeedLink.first( mcPart );
 
@@ -407,7 +406,7 @@ void PrFitMatchParams::resolution(){
        debug()<< "Too far from beampipe" << endmsg;
        continue;  // particles from close the beam line
      }
-     
+
      bool hasInteractionVertex = false;
      SmartRefVector<LHCb::MCVertex> endV = mcPart->endVertices();
      for ( SmartRefVector<LHCb::MCVertex>::const_iterator itV = endV.begin() ;
@@ -418,25 +417,25 @@ void PrFitMatchParams::resolution(){
       debug()<< "Interaction vertex found. skipping" << endmsg;
       continue;
     }
-    
-        
+
+
     FTHits.clear();
     VPHits.clear();
-    
+
     // Get the Velo hits
     for ( auto vHitIt = vpHits->begin() ; vpHits->end() != vHitIt ; vHitIt++ ) {
       if ( (*vHitIt)->mcParticle() ==  mcPart ) {
         VPHits.push_back( (*vHitIt)->midPoint() );
       }
     }
-    
+
     // Get the FT hits
     for ( auto iHitFt = ftHits->begin() ; ftHits->end() != iHitFt ; iHitFt++ ) {
       if ( (*iHitFt)->mcParticle() ==  mcPart ) {
         FTHits.push_back( (*iHitFt)->midPoint() );
       }
     }
-    
+
     if ( 12 > FTHits.size() || 6 > VPHits.size() )  continue;
 
     debug()<<"got my hits  " <<  FTHits.size()+VPHits.size()  << endmsg;
@@ -472,42 +471,42 @@ void PrFitMatchParams::resolution(){
     const auto zMagnet = (axv-bxv*m_zVelo - (ax-bx*m_zRef) ) / (bx-bxv);
     const auto xMagnet = axv + ( zMagnet - m_zVelo ) * bxv;
     const auto yMagnet = ayv + ( zMagnet - m_zVelo ) * byv;
-        
+
     LHCb::State* tstate = &ttrack->closestState( 10000. );
     LHCb::State* vstate = &vtrack->closestState( m_zVelo );
     //now other things
     const auto dSlopeExp       = std::abs( vstate->tx() - tstate->tx() );
-    const auto dSlope2Exp      = dSlopeExp*dSlopeExp;    
+    const auto dSlope2Exp      = dSlopeExp*dSlopeExp;
     const auto dSlopeYExp      = std::abs( vstate->ty() - tstate->ty() );
-    const auto dSlopeY2Exp     = dSlopeYExp*dSlopeYExp;    
+    const auto dSlopeY2Exp     = dSlopeYExp*dSlopeYExp;
 
-    const auto zMagnetExp =m_zMagParams [0] + 
-      m_zMagParams[1] * dSlopeExp +  
+    const auto zMagnetExp =m_zMagParams [0] +
+      m_zMagParams[1] * dSlopeExp +
       m_zMagParams[2] * dSlope2Exp +
       m_zMagParams[3] * std::abs(tstate->x()) +
       m_zMagParams[4] * vstate->tx()*vstate->tx() ;
-    
+
 
     debug()<< m_zMagParams [0] <<"  "<<
-      m_zMagParams[1]  <<"  " <<  
+      m_zMagParams[1]  <<"  " <<
       m_zMagParams[2]  <<"  " <<
       m_zMagParams[3]  <<"  " <<
       m_zMagParams[4]  << endmsg;
-    
-    
+
+
     const float xVExp = vstate->x() + (zMagnetExp     - vstate->z()) * vstate->tx();
     // -- This is the function that calculates the 'bending' in y-direction
     // -- The parametrisation can be derived with the MatchFitParams package
     const float yVExp = vstate->y() + (m_zMatchY - vstate->z()) * vstate->ty() +
       vstate->ty() * ( m_bendYParams[0]*dSlope2Exp + m_bendYParams[1]*dSlopeY2Exp );
-    
+
 
     const float xSExp = tstate->x() + (zMagnetExp     - tstate->z()) * tstate->tx();
     const float ySExp = tstate->y() + (m_zMatchY - tstate->z()) * tstate->ty();
-    
+
     const float distXExp = xSExp - xVExp;
     const float distYExp = ySExp - yVExp;
-    
+
     const float dslXExp  = vstate->tx() - tstate->tx();
     const float dslYExp  = vstate->ty() - tstate->ty();
     const float teta2 = vstate->ty()*vstate->ty() + tstate->tx()*tstate->tx();
@@ -527,7 +526,7 @@ void PrFitMatchParams::resolution(){
 
     resoTuple->column( "distXExp", distXExp );
     resoTuple->column( "distYExp", distYExp );
-    
+
     resoTuple->column( "xVExp", xVExp );
     resoTuple->column( "xSExp", xSExp );
 
@@ -536,17 +535,17 @@ void PrFitMatchParams::resolution(){
     resoTuple->column( "pExp", pExp );
     resoTuple->column( "pTrue", p );
 
-    
+
     resoTuple->column( "byvExp", vstate->ty() );
     resoTuple->column( "byv", byv );
 
     resoTuple->column( "bxvExp", vstate->tx() );
     resoTuple->column( "bxv", bxv );
-    
-    
+
+
     resoTuple->column( "byExp", tstate->ty() );
     resoTuple->column( "by", by );
-    
+
     resoTuple->column( "bxExp", tstate->tx());
     resoTuple->column( "bx", bx );
 
@@ -555,7 +554,7 @@ void PrFitMatchParams::resolution(){
     resoTuple->column( "teta2", teta2 );
 
     resoTuple->write();
-      
+
    }
 
 }
@@ -608,13 +607,13 @@ float PrFitMatchParams::momentum(const LHCb::State* vState, const LHCb::State* t
     +m_momParams[4]* vars[4];
 
   debug()<< m_momParams [0] <<"  "<<
-    m_momParams[1]  <<"  " <<  
+    m_momParams[1]  <<"  " <<
     m_momParams[2]  <<"  " <<
     m_momParams[3]  <<"  " <<
     m_momParams[4]  << endmsg;
 
   debug()<< vars[0] <<"  "<<
-    vars[1]  <<"  " <<  
+    vars[1]  <<"  " <<
     vars[2]  <<"  " <<
     vars[3]  <<"  " <<
     vars[4]  << endmsg;
@@ -623,7 +622,7 @@ float PrFitMatchParams::momentum(const LHCb::State* vState, const LHCb::State* t
   float scaleFactor = m_magFieldSvc->signedRelativeCurrent();
 
   float P = ( coef * Gaudi::Units::GeV * proj *scaleFactor )/(txV-txT);
-  
+
   return P;
 
 }
diff --git a/Pr/PrFitParams/src/PrFitSeedParams.cpp b/Pr/PrFitParams/src/PrFitSeedParams.cpp
index 9aa2bef6a59be0a01901435ae8aa1f514bcac6f8..0d8228f0d29c7c81514d1ff8fd282f19100a34de 100755
--- a/Pr/PrFitParams/src/PrFitSeedParams.cpp
+++ b/Pr/PrFitParams/src/PrFitSeedParams.cpp
@@ -1,4 +1,4 @@
-// Include files 
+// Include files
 
 // from Gaudi
 #include "Event/MCTrackInfo.h"
@@ -18,7 +18,7 @@
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : PrFitSeedParams
-// 
+//
 // 2006-12-08  : Olivier Callot
 // 2013-01-23  : Yasmine Amhis
 // Adapt to work with Fiber Tracker and UT
@@ -39,7 +39,7 @@ PrFitSeedParams::PrFitSeedParams( const std::string& name,
   declareProperty( "TupleName",          m_tupleName  = "Track" );
   declareProperty( "ZRef",               m_zRef       = StateParameters::ZMidT );
   declareProperty( "ZSeed",              m_zSeed      = StateParameters::ZEndT );
-  //THIS NEEDS TO BE UPDATED FOR THE UT 
+  //THIS NEEDS TO BE UPDATED FOR THE UT
   declareProperty( "ZTT",                m_zTT        = 2485.0 * Gaudi::Units::mm );
 
   // these are the "tunables" for PatSeeding
@@ -57,14 +57,14 @@ PrFitSeedParams::PrFitSeedParams( const std::string& name,
   declareProperty( "dRatioParams",      m_dRatio = tmp4 );
   std::vector<double> tmp5 = boost::assign::list_of(1.25e-14);
   declareProperty( "yCorrectionParams", m_yCorrection = tmp5 );
- 
+
   m_nEvent = 0;
   m_nTrack = 0;
 }
 //=============================================================================
 // Destructor
 //=============================================================================
-PrFitSeedParams::~PrFitSeedParams() {} 
+PrFitSeedParams::~PrFitSeedParams() {}
 
 //=============================================================================
 // Initialization
@@ -94,34 +94,34 @@ StatusCode PrFitSeedParams::execute() {
 
 
   debug() << "==> Execute" << endmsg;
- 
+
   m_nEvent += 1;
 
   LHCb::MCParticles* partCtnr = get<LHCb::MCParticles>( LHCb::MCParticleLocation::Default );
 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
-  
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
+
 
   // Get the FT hits
   LHCb::MCHits* ftHits = get<LHCb::MCHits>( LHCb::MCHitLocation::FT);
 
 
-  
 
 
-  
+
+
   // Get the UT  hits
   LHCb::MCHits* UTHits = get<LHCb::MCHits>( LHCb::MCHitLocation::UT );
 
-  
+
   LHCb::MCParticles::const_iterator pItr;
   const LHCb::MCParticle* part;
   const LHCb::MCParticle* mother;
   const LHCb::MCVertex* vOrigin;
   SmartRefVector<LHCb::MCVertex> vDecay;
-  
-  for ( pItr = partCtnr->begin(); partCtnr->end() != pItr; pItr++ ) 
-    {//here loop over the MC particle container 
+
+  for ( pItr = partCtnr->begin(); partCtnr->end() != pItr; pItr++ )
+    {//here loop over the MC particle container
     part = *pItr;
     if ( 0 == trackInfo.fullInfo( part ) ) continue;
     if ( !trackInfo.hasT( part ) ) continue;
@@ -153,22 +153,22 @@ StatusCode PrFitSeedParams::execute() {
     // A container for used hits
     std::vector<Gaudi::XYZPoint> trHits;
     std::vector<Gaudi::XYZPoint> utHits;
-    
-    
+
+
 
     // Get the FT hits
-    
-    for ( LHCb::MCHits::const_iterator fiberHit = ftHits->begin() ; 
+
+    for ( LHCb::MCHits::const_iterator fiberHit = ftHits->begin() ;
 	  ftHits->end() != fiberHit ; fiberHit++ ) {
       if ( (*fiberHit)->mcParticle() ==  part ) {
 	trHits.push_back( (*fiberHit)->midPoint() );
       }
     }
-    
+
 
 
       // Get the UT hits
-    for ( LHCb::MCHits::const_iterator iHitut = UTHits->begin() ; 
+    for ( LHCb::MCHits::const_iterator iHitut = UTHits->begin() ;
 	  UTHits->end() != iHitut ; iHitut++ ) {
       if ( (*iHitut)->mcParticle() ==  part ) {
 	utHits.push_back( (*iHitut)->midPoint() );
@@ -219,7 +219,7 @@ StatusCode PrFitSeedParams::execute() {
       debug() << format( "p %7.3f, N%4d, ax%8.2f bx%8.2f cx%8.2f dp%10.4f",
                          momentum/1000., trHits.size(),
                          ax, 1.e3*bx, 1.e6*cx, dp ) << endmsg;
-    }    
+    }
 
     // work out intercept point of line joining T1 and T3 with z = 0
     const double dzT1 = StateParameters::ZBegT - m_zRef;
@@ -240,7 +240,7 @@ StatusCode PrFitSeedParams::execute() {
       m_initialArrowPar.addEvent( dSag );
     }
 
-    
+
     double axt, bxt, cxt, ayt, byt, zMagnet, zEst;
     if ( 2 < utHits.size() ) {
       //m_fitTool->fitLine( ttHits, 0, m_zTT, axt, bxt );
@@ -253,13 +253,13 @@ StatusCode PrFitSeedParams::execute() {
       }
       std::tie(axt, bxt, cxt) = *xResult;
       std::tie(ayt, byt) = *yResult;
-      
+
       const double dz = m_zSeed - m_zRef;
       const double x0 = ax + dz * ( bx + dz * ( cx + dz * dx ) );
       const double tx = bx + dz * (2*cx + dz * 3*dx );
 
       zMagnet = (axt-bxt*m_zTT - (x0-tx*m_zSeed) ) / (tx-bxt);
-      
+
       m_zMagPar.setFun( 0, 1. );
       m_zMagPar.setFun( 1, by*by );
       m_zMagPar.setFun( 2, bx*bx );
@@ -276,7 +276,7 @@ StatusCode PrFitSeedParams::execute() {
       byt = 0.;
     }
 
-    
+
 
     m_dRatioPar.setFun(0, 1.0);
     m_dRatioPar.setFun(1, fabs(cx));
@@ -293,7 +293,7 @@ StatusCode PrFitSeedParams::execute() {
     m_yCorrectionPar.setFun(0, 1.0);
     if (400. < fabs(y0))
       m_yCorrectionPar.addEvent(fabs((by * by * cx * cx) / y0) - m_yCorrectionPar.sum());
-      
+
     tTrack->column( "ax", ax );
     tTrack->column( "bx", bx );
     tTrack->column( "cx", cx );
@@ -316,13 +316,13 @@ StatusCode PrFitSeedParams::execute() {
     tTrack->column( "zEst", zEst );
 
     tTrack->write();
-    
-    
-    }// end of the big loop 
 
 
- 
- 
+    }// end of the big loop
+
+
+
+
   return StatusCode::SUCCESS;
 }
 
@@ -338,7 +338,7 @@ StatusCode PrFitSeedParams::finalize() {
   msg << "============================================" << endmsg;
 
 
-  
+
   m_initialArrowPar.updateParameters( msg );
   m_momentumScalePar.updateParameters(  msg );
   m_zMagPar.updateParameters(  msg );
@@ -352,16 +352,16 @@ StatusCode PrFitSeedParams::finalize() {
   m_dRatioPar.printPythonParams( name() );
   m_yCorrectionPar.printPythonParams( name() );
   std::cout << std::endl;
-  
+
   std::string toolName = "ToolSvc.PatSeedingTool";
-  
+
   m_initialArrowPar.printPythonParams( toolName );
   m_momentumScalePar.printPythonParams( toolName );
   m_zMagPar.printPythonParams( toolName );
   m_dRatioPar.printPythonParams( toolName );
   m_yCorrectionPar.printPythonParams( toolName );
   std::cout << std::endl;
-  
+
   return GaudiTupleAlg::finalize();  // must be called after all other actions
 }
 
diff --git a/Pr/PrMCTools/src/PrCheatedSciFiTracking.cpp b/Pr/PrMCTools/src/PrCheatedSciFiTracking.cpp
index 52d339a487f4a8a78e5f91dcf1d2d5c48039f075..ab26eb6146c33e73224f552fe702874e4e0b4217 100644
--- a/Pr/PrMCTools/src/PrCheatedSciFiTracking.cpp
+++ b/Pr/PrMCTools/src/PrCheatedSciFiTracking.cpp
@@ -1,18 +1,61 @@
-// Include files 
+// Include files
 
-// local
+// from Gaudi
+#include "GaudiAlg/Transformer.h"
+
+#include "PrKernel/PrFTHitHandler.h"
 #include "Event/Track.h"
 #include "Event/StateParameters.h"
-#include "PrCheatedSciFiTracking.h"
 #include "Event/FTCluster.h"
-#include "Linker/LinkedTo.h"
 #include "Event/MCTrackInfo.h"
+#include "Linker/LinkedTo.h"
 //-----------------------------------------------------------------------------
 // Implementation file for class : PrCheatedSciFiTracking
 //
 // 2015-03-23 : Michel De Cian
 //-----------------------------------------------------------------------------
 
+
+/** @class PrCheatedSciFiTracking PrCheatedSciFiTracking.h
+ *
+ *  Cheated track reconstruction in the SciFi.
+ *  It creates tracks by getting all Clusters associated to a reconstructible MCParticle.
+ *  Cuts can be set on the minimum number of total hits, hits in x layers and hits in stereo layers.
+ *  Top and bottom modules are not mixed in the x layers.
+ *
+ * - HitManagerName: Name of the hit manager
+ * - DecodeData: Decode the data
+ * - OutputName: Name of the output location
+ * - NumZones: Number of zones (normally 2 x number of layers if no y-segmentation)
+ * - MinXHits: Minimum number of required hits in x layers to make a track.
+ * - MinStereoHits: Minimum number of required hits in stereo layers to make a track.
+ * - MinTotHits: Minimum number of total hits to make a track.
+ *
+ *
+ *  @author Michel De Cian
+ *  @date   2015-03-23
+ */
+class PrCheatedSciFiTracking : public Gaudi::Functional::Transformer<LHCb::Tracks(const PrFTHitHandler<PrHit>&,
+                                                                                  const LHCb::MCParticles&,
+                                                                                  const LHCb::MCProperty&)> {
+public:
+  /// Standard constructor
+  PrCheatedSciFiTracking( const std::string& name, ISvcLocator* pSvcLocator );
+
+  /// make cheated tracks by getting the clusters matched to an MCParticle
+  LHCb::Tracks operator()(const PrFTHitHandler<PrHit>&,
+                          const LHCb::MCParticles&,
+                          const LHCb::MCProperty&) const override;
+
+private:
+
+  Gaudi::Property<int> m_numZones = { this, "NumZones",   24 };
+  Gaudi::Property<int> m_minXHits = { this, "MinXHits",    5 };
+  Gaudi::Property<int> m_minStereoHits = { this, "MinStereoHits", 5 };
+  Gaudi::Property<int> m_minTotHits = { this, "MinTotHits", 10 };
+
+};
+
 // Declaration of the Algorithm Factory
 DECLARE_COMPONENT( PrCheatedSciFiTracking )
 
@@ -22,119 +65,86 @@ DECLARE_COMPONENT( PrCheatedSciFiTracking )
 PrCheatedSciFiTracking::PrCheatedSciFiTracking( const std::string& name,
                                         ISvcLocator* pSvcLocator)
 : Transformer(name, pSvcLocator,
-              KeyValue{"FTHitsLocation", PrFTInfo::FTHitsLocation},
+              { KeyValue{"FTHitsLocation", PrFTInfo::FTHitsLocation},
+                KeyValue{"MCParticleLocation", LHCb::MCParticleLocation::Default},
+                KeyValue{"MCPropertyLocation", LHCb::MCPropertyLocation::TrackInfo} },
               KeyValue{"OutputName", LHCb::TrackLocation::Seed})
 {
-  declareProperty( "NumZones",            m_numZones             = 24 );
-  declareProperty( "MinXHits",            m_minXHits             = 5  );
-  declareProperty( "MinStereoHits",       m_minStereoHits        = 5  );
-  declareProperty( "MinTotHits",          m_minTotHits           = 10 );
-}
-
-//=============================================================================
-// Initialization
-//=============================================================================
-StatusCode PrCheatedSciFiTracking::initialize() {
-  StatusCode sc = Transformer::initialize(); // must be executed first
-  
-  if ( sc.isFailure() ) return sc;  // error printed already by GaudiAlgorithm
-  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Initialize" << endmsg;  
-  return StatusCode::SUCCESS;
 }
 
 //=============================================================================
-// Main execution
+// make cheated tracks by getting the clusters matched to an MCParticle
 //=============================================================================
-LHCb::Tracks PrCheatedSciFiTracking::operator()(const PrFTHitHandler<PrHit>& hitHandler) const {
+LHCb::Tracks PrCheatedSciFiTracking::operator()(const PrFTHitHandler<PrHit>& FTHitHandler,
+                                                const LHCb::MCParticles& mcParts,
+                                                const LHCb::MCProperty& mcProps) const
+{
   LHCb::Tracks result;
-  makeLHCbTracks(result, hitHandler);
-  return result;
-}
 
-//=============================================================================
-//  Finalize
-//=============================================================================
-StatusCode PrCheatedSciFiTracking::finalize() {
-  if ( msgLevel(MSG::DEBUG) ) debug() << "==> Finalize" << endmsg;
-  return Transformer::finalize();  // must be called after all other actions
-}
-//=========================================================================
-//  Make the cheated tracks
-//=========================================================================
-void PrCheatedSciFiTracking::makeLHCbTracks(LHCb::Tracks& result,
-                                            const PrFTHitHandler<PrHit>& FTHitHandler) const {
-  
+  // TODO: avoid direct use of evtSvc(), once there is a way to do so for LinkedTo & MCTrackInfo...
   LinkedTo<LHCb::MCParticle, LHCb::FTCluster> myClusterLink ( evtSvc(), msgSvc(), LHCb::FTClusterLocation::Default );
-  LHCb::MCParticles* mcParts = getIfExists<LHCb::MCParticles> ( LHCb::MCParticleLocation::Default );
-  
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
-  
-  for( LHCb::MCParticles::const_iterator iPart = mcParts->begin(); iPart != mcParts->end(); ++iPart){
-    
-    const LHCb::MCParticle* mcPart = *iPart;
+
+  MCTrackInfo trackInfo( mcProps );
+
+  for( const LHCb::MCParticle* mcPart : mcParts ) {
 
     //const bool isLong = trackInfo.hasVeloAndT( mcPart );
     //const bool isDown = trackInfo.hasT( mcPart ) && trackInfo.hasTT( mcPart );
     const bool isSeed = trackInfo.hasT( mcPart );
     //if( !isLong && !isDown ) continue;
     if( !isSeed ) continue;
-    LHCb::Track* tmp = new LHCb::Track;
+    auto tmp = std::make_unique< LHCb::Track > ();
     tmp->setType( LHCb::Track::Types::Ttrack );
     tmp->setHistory( LHCb::Track::History::PrSeeding );
     tmp->setPatRecStatus( LHCb::Track::PatRecStatus::PatRecIDs );
 
-    std::vector<int> firedXLayers(m_numZones,0);
-    std::vector<int> firedStereoLayers(m_numZones,0);
+    std::vector<int> firedXLayers(m_numZones.value(),0);
+    std::vector<int> firedStereoLayers(m_numZones.value(),0);
     int totHits = 0;
-    
+
     // -- loop over all zones
-    for(int iZone = 0; iZone < m_numZones; ++iZone){
+    for(int iZone = 0; iZone < m_numZones.value(); ++iZone){
       // -- loop over all hits in a zone
       for(auto iHit = FTHitHandler.getIterator_Begin(iZone); FTHitHandler.getIterator_End(iZone) != iHit;++iHit){
         auto hit = &*iHit;
-        LHCb::MCParticle* mcPart1 = myClusterLink.first( hit->id().ftID() ); 
         bool found = false;
-        while( mcPart1 != nullptr){
-          if( mcPart1 == mcPart){
-            found = true;
-          }
-          mcPart1 = myClusterLink.next();
+        for(const LHCb::MCParticle* mcPart1 = myClusterLink.first( hit->id().ftID() ) ;
+            mcPart1 && !found;
+            mcPart1 = myClusterLink.next() ){
+          found = ( mcPart1 == mcPart);
         }
         if( hit->isX() && found ){
-          if( firedXLayers[iZone] == 0){
-            firedXLayers[iZone]++;
-          }
+          if( firedXLayers[iZone] == 0) firedXLayers[iZone]++;
         }
         if( !(hit->isX()) && found ){
-          if( firedStereoLayers[iZone] == 0){
-            firedStereoLayers[iZone]++;
-          }
+          if( firedStereoLayers[iZone] == 0) firedStereoLayers[iZone]++;
         }
         if( found ){
           totHits++;
           tmp->addToLhcbIDs( hit->id() );
-        } 
+        }
       }
     }
     int sumLowerX = 0;
     int sumUpperX = 0;
     int sumStereo = 0;
-    for(int i = 0; i < m_numZones; i = i+2){
+    for(int i = 0; i < m_numZones.value(); i += 2){
       sumLowerX += firedXLayers[i];
     }
-    for(int i = 1; i < m_numZones; i = i+2){
+    for(int i = 1; i < m_numZones.value(); i += 2){
       sumUpperX += firedXLayers[i];
     }
-    for(int i = 0; i < m_numZones; i++){
+    for(int i = 0; i < m_numZones.value(); i++){
       sumStereo += firedStereoLayers[i];
     }
-    debug() << "sumLowerX: " << sumLowerX 
-            << " sumUpperX " << sumUpperX 
-            << " sumStereo " << sumStereo 
+    debug() << "sumLowerX: " << sumLowerX
+            << " sumUpperX " << sumUpperX
+            << " sumStereo " << sumStereo
             << " totHits "   << totHits << endmsg;
-    
-    if( (sumLowerX < m_minXHits && sumUpperX < m_minXHits) || sumStereo < m_minStereoHits || totHits < m_minTotHits){
-      delete tmp;
+
+    if( (sumLowerX < m_minXHits.value() && sumUpperX < m_minXHits.value()) ||
+        sumStereo < m_minStereoHits.value() ||
+        totHits < m_minTotHits.value()) {
       continue;
     }
     // -- these are obviously useless numbers, but it should just make the checkers happy
@@ -145,8 +155,9 @@ void PrCheatedSciFiTracking::makeLHCbTracks(LHCb::Tracks& result,
     tState.setState( 100, 50, z, 0.1, 0.1, qOverP );
     //tState.setCovariance( m_geoTool->covariance( qOverP ) );
     tmp->addToStates( tState );
-    result.insert( tmp );
+    result.insert( tmp.release() );
   }
+  return result;
 }
 
 
diff --git a/Pr/PrMCTools/src/PrCheatedSciFiTracking.h b/Pr/PrMCTools/src/PrCheatedSciFiTracking.h
deleted file mode 100644
index 9d440fbf6300056040168e78aa30b72d55c3a33f..0000000000000000000000000000000000000000
--- a/Pr/PrMCTools/src/PrCheatedSciFiTracking.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef PRCHEATEDSCIFITRACKING_H
-#define PRCHEATEDSCIFITRACKING_H 1
-
-// Include files
-// from Gaudi
-
-#include "GaudiAlg/Transformer.h"
-#include "PrKernel/PrFTHitHandler.h"
-#include "GaudiKernel/AnyDataHandle.h"
-
-/** @class PrCheatedSciFiTracking PrCheatedSciFiTracking.h
- *
- *  Cheated track reconstruction in the SciFi.
- *  It creates tracks by getting all Clusters associated to a reconstructible MCParticle.
- *  Cuts can be set on the minimum number of total hits, hits in x layers and hits in stereo layers.
- *  Top and bottom modules are not mixed in the x layers.
- *
- * - HitManagerName: Name of the hit manager
- * - DecodeData: Decode the data
- * - OutputName: Name of the output location
- * - NumZones: Number of zones (normally 2 x number of layers if no y-segmentation)
- * - MinXHits: Minimum number of required hits in x layers to make a track.
- * - MinStereoHits: Minimum number of required hits in stereo layers to make a track.
- * - MinTotHits: Minimum number of total hits to make a track.
- *
- *
- *  @author Michel De Cian
- *  @date   2015-03-23
- */
-class PrCheatedSciFiTracking : public Gaudi::Functional::Transformer<LHCb::Tracks(const PrFTHitHandler<PrHit>&)> {
-public:
-  /// Standard constructor
-  PrCheatedSciFiTracking( const std::string& name, ISvcLocator* pSvcLocator );
-
-  LHCb::Tracks operator()(const PrFTHitHandler<PrHit>& hitHandler) const override;
-  StatusCode initialize() final override;    ///< Algorithm initialization
-  StatusCode finalize() final override;      ///< Algorithm finalization
-
-private:
-
-  /// make cheated tracks by getting the clusters matched to an MCParticle
-  void makeLHCbTracks(LHCb::Tracks& result, const PrFTHitHandler<PrHit>& FTHitHandler) const;
-
-
-  int             m_numZones;
-  int             m_minXHits;
-  int             m_minStereoHits;
-  int             m_minTotHits;
-
-};
-#endif // PRCHEATEDSCIFITRACKING_H
diff --git a/Pr/PrMCTools/src/PrCheatedVP.cpp b/Pr/PrMCTools/src/PrCheatedVP.cpp
index a16a344ed8ef25a9d0f50a5e7090ff32eeb8fc72..7aac20131275c8735b8424844115bc83968ffffa 100644
--- a/Pr/PrMCTools/src/PrCheatedVP.cpp
+++ b/Pr/PrMCTools/src/PrCheatedVP.cpp
@@ -22,12 +22,12 @@ namespace
   LHCb::Tracks getTracks(const GaudiAlgorithm& alg, const MCTrackInfo& trackInfo, const IPrFitTool& fitTool, const LHCb::MCParticles& particles, const std::function<void(LHCb::Track&, std::vector<Gaudi::XYZPoint>&, const LHCb::MCParticle*, LinkedFrom<LHCb::VPCluster, MCParticle>&)> getPoints)
   {
     LHCb::Tracks tracks;
-  
+
     // Get the association table between MC particles and clusters.
     LinkedFrom<LHCb::VPCluster, MCParticle> link(alg.evtSvc(), alg.msgSvc(), LHCb::VPClusterLocation::Default);
-   
+
     constexpr double zVelo = 0.;
-  
+
     for (const LHCb::MCParticle *const particle : particles) {
       // Skip particles without track info.
       if (0 == trackInfo.fullInfo(particle)) continue;
@@ -35,12 +35,12 @@ namespace
       if (!trackInfo.hasVelo(particle)) continue;
       // Skip electrons.
       if (abs(particle->particleID().pid()) == 11) continue;
-  
+
       LHCb::Track *const track = new LHCb::Track;
       std::vector<Gaudi::XYZPoint> points;
       getPoints(*track, points, particle, link);
-   
-      // Make a straight-line fit of the track. 
+
+      // Make a straight-line fit of the track.
       const auto xResult = fitTool.fitLine(points, IPrFitTool::XY::X, zVelo);
       const auto yResult = fitTool.fitLine(points, IPrFitTool::XY::Y, zVelo);
       if (!xResult || !yResult)
@@ -53,22 +53,22 @@ namespace
             x1 = std::get<1>(*xResult),
             y0 = std::get<0>(*yResult),
             y1 = std::get<1>(*yResult);
-  
+
       LHCb::State state;
       state.setLocation(LHCb::State::ClosestToBeam);
-      state.setState(x0, y0, zVelo, 
+      state.setState(x0, y0, zVelo,
                      x1, y1, 0.);
       track->addToStates(state);
       if (0 > particle->momentum().z()) {
         track->setFlag(LHCb::Track::Flags::Backward, true);
         // Cut out backwards tracks.
         // delete track;
-        // continue; 
+        // continue;
       }
       track->setType(LHCb::Track::Types::Velo);
       tracks.insert(track);
     }
-  
+
     return tracks;
   }
 }
@@ -112,7 +112,7 @@ StatusCode PrCheatedVPBase<useMCHits>::initialize()
 //=============================================================================
 LHCb::Tracks PrCheatedVP::operator() (const LHCb::MCParticles& particles) const
 {
-  return getTracks(*this, MCTrackInfo(evtSvc(), msgSvc()), *m_ft, particles, [](LHCb::Track& track, std::vector<Gaudi::XYZPoint>& points, const LHCb::MCParticle *const particle, LinkedFrom<LHCb::VPCluster, MCParticle>& link) {
+  return getTracks(*this, make_MCTrackInfo(evtSvc(), msgSvc()), *m_ft, particles, [](LHCb::Track& track, std::vector<Gaudi::XYZPoint>& points, const LHCb::MCParticle *const particle, LinkedFrom<LHCb::VPCluster, MCParticle>& link) {
     for (const LHCb::VPCluster* cluster = link.first(particle); cluster != nullptr; cluster = link.next())
     {
       track.addToLhcbIDs(LHCb::LHCbID(cluster->channelID()));
@@ -123,7 +123,7 @@ LHCb::Tracks PrCheatedVP::operator() (const LHCb::MCParticles& particles) const
 
 LHCb::Tracks PrCheatedVPMCHits::operator() (const LHCb::MCParticles& particles, const LHCb::MCHits& hits) const
 {
-  return getTracks(*this, MCTrackInfo(evtSvc(), msgSvc()), *m_ft, particles, [&hits](LHCb::Track& track, std::vector<Gaudi::XYZPoint>& points, const LHCb::MCParticle *const particle, LinkedFrom<LHCb::VPCluster, MCParticle>& link) {
+  return getTracks(*this, make_MCTrackInfo(evtSvc(), msgSvc()), *m_ft, particles, [&hits](LHCb::Track& track, std::vector<Gaudi::XYZPoint>& points, const LHCb::MCParticle *const particle, LinkedFrom<LHCb::VPCluster, MCParticle>& link) {
     for (const auto id : link.keyRange(particle)) {
       track.addToLhcbIDs(LHCb::LHCbID(LHCb::VPChannelID(id)));
     }
diff --git a/Pr/PrMCTools/src/PrChecker.cpp b/Pr/PrMCTools/src/PrChecker.cpp
index 91909c072ed1d5b0227305f8a5823decea382a11..b84d22b4ac403d202f6ff4b195c0cdbfff13eefa 100644
--- a/Pr/PrMCTools/src/PrChecker.cpp
+++ b/Pr/PrMCTools/src/PrChecker.cpp
@@ -62,7 +62,7 @@ PrChecker::PrChecker( const std::string& name, ISvcLocator* pSvcLocator)
   declareProperty( "DownTracks",        m_downTracks      = LHCb::TrackLocation::Downstream );
   declareProperty( "UpTracks",          m_upTracks        = LHCb::TrackLocation::VeloTT     );
   declareProperty( "BestTracks",        m_bestTracks      = LHCb::TrackLocation::Default    );
- 
+
   declareProperty( "WriteVeloHistos",    m_writeVeloHistos      = -1 );
   declareProperty( "WriteForwardHistos", m_writeForwardHistos   = -1 );
   declareProperty( "WriteMatchHistos",   m_writeMatchHistos     = -1 );
@@ -73,7 +73,7 @@ PrChecker::PrChecker( const std::string& name, ISvcLocator* pSvcLocator)
   declareProperty( "WriteBestLongHistos",m_writeBestLongHistos  = -1 );
   declareProperty( "WriteBestDownstreamHistos",    m_writeBestDownstreamHistos      = -1 );
   declareProperty( "WriteUTHistos",      m_writeUTHistos        = -1 );
- 
+
   declareProperty( "Eta25Cut",           m_eta25cut             = false    );
   declareProperty( "TriggerNumbers",     m_triggerNumbers       = false    );
   declareProperty( "UseElectrons",       m_useElectrons         = false    );
@@ -81,10 +81,6 @@ PrChecker::PrChecker( const std::string& name, ISvcLocator* pSvcLocator)
   declareProperty( "Upgrade",            m_upgrade              = true     );
 
 }
-//=============================================================================
-// Destructor
-//=============================================================================
-PrChecker::~PrChecker() {}
 
 //=============================================================================
 // Initialization
@@ -102,13 +98,13 @@ StatusCode PrChecker::initialize()
 
   IHistoTool* htool = tool<IHistoTool>( "HistoTool","PrCheckerHistos",this ) ;
   GaudiHistoTool* ghtool = dynamic_cast<GaudiHistoTool*>(htool) ;
-  
+
   // -- catch the possible failure of the dynamic cast
   if( ghtool == NULL){
     error() << "Dynamic cast of Gaudi Histogramming Tool failed!" << endmsg;
     return StatusCode::FAILURE;
   }
-  
+
   ghtool->setHistoDir(histoDir+name()) ;
   m_histoTool = htool;
 
@@ -280,7 +276,7 @@ StatusCode PrChecker::initialize()
 
   // -- UT Counters (excluded for the moment)
   /*
-  m_utForward = tool<IPrCounter>( "PrUTCounter", "UTForward", this );  
+  m_utForward = tool<IPrCounter>( "PrUTCounter", "UTForward", this );
   m_utForward->setContainer( m_forwardTracks );
   //m_utForward->setFolderPlotName( m_forwardTracks );
   m_utForward->setWriteHistos(m_writeUTHistos);
@@ -324,7 +320,7 @@ StatusCode PrChecker::initialize()
   m_allCounters.push_back( m_utMatch   );
   m_allCounters.push_back( m_utbestLong);
   */
-  
+
   for ( std::vector<IPrCounter*>::iterator itC = m_allCounters.begin();
         m_allCounters.end() != itC; ++itC ) {
     (*itC)->setUseEta25Cut(m_eta25cut);
@@ -333,7 +329,7 @@ StatusCode PrChecker::initialize()
 
 
   if( !m_upgrade ) m_idLoc = "Pat/LHCbID";
-  
+
 
   return StatusCode::SUCCESS;
 }
@@ -350,16 +346,16 @@ StatusCode PrChecker::execute() {
     error() << "Could not find MCParticles at " << LHCb::MCParticleLocation::Default << endmsg;
     return StatusCode::SUCCESS;
   }
-  
 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
 
   LHCb::MCVertices* mcVert = getIfExists<LHCb::MCVertices>(LHCb::MCVertexLocation::Default );
   if(  mcVert == nullptr ){
     error() << "Could not find MCVertices at " << LHCb::MCParticleLocation::Default << endmsg;
     return StatusCode::SUCCESS;
   }
-  
+
   unsigned int nPrim = 0;
   for ( LHCb::MCVertices::iterator itV = mcVert->begin(); mcVert->end() != itV; ++itV ) {
     if ( (*itV)->isPrimary() ) {
@@ -370,16 +366,16 @@ StatusCode PrChecker::execute() {
           if ( trackInfo.hasVelo( *itP ) ) nbVisible++;
         }
       }
-      if ( nbVisible > 4 )  
+      if ( nbVisible > 4 )
       ++nPrim;
     }
   }
- 
+
   for ( std::vector<IPrCounter*>::iterator itC = m_allCounters.begin();
         m_allCounters.end() != itC; ++itC ) {
     (*itC)->initEvent(m_histoTool,nPrim);
   }
-  
+
   //== Build a table (vector of vectors) of ids per MCParticle, indexed by MCParticle key.
   AllLinks<LHCb::MCParticle> allIds( evtSvc(), msgSvc(), m_idLoc );
   std::vector< std::vector<int> > linkedIds;
@@ -393,7 +389,7 @@ StatusCode PrChecker::execute() {
     linkedIds[part->key()].push_back( allIds.key() );
     part = allIds.next();
   }
-  
+
   LHCb::MCParticles::const_iterator itP;
   for ( itP = mcParts->begin(); mcParts->end() != itP; ++itP ) {
 
@@ -402,24 +398,24 @@ StatusCode PrChecker::execute() {
 
     if( msgLevel(MSG::VERBOSE) ) verbose() << "checking MCPart " << part->key() << endmsg;
 
-    
+
 
     //Add Eta Cut!
-    
+
     // -- Take electrons into account?
     bool isElectron = abs( part->particleID().pid() ) == 11;
     if(m_useElectrons){
       isElectron = false;
     }
-    
-      
+
+
 
     bool isLong  = trackInfo.hasVeloAndT( part );
     //isLong = isLong && !isElectron; // and not electron
 
     bool isDown  = trackInfo.hasT( part ) &&  trackInfo.hasTT( part );
     //isDown = isDown && !isElectron; // and not electron
-    
+
     bool over5       = 5000. < fabs( part->p() );
     bool trigger     = 3000. < fabs( part->p() ) &&  500. < fabs( part->pt() );
     bool isInVelo    = trackInfo.hasVelo( part );
@@ -428,7 +424,7 @@ StatusCode PrChecker::execute() {
     bool strangeDown = false;
     bool fromB       = false;
     bool fromD       = false;
-    //bool zunder100   = part->originVertex()->position().Z() < 100.; 
+    //bool zunder100   = part->originVertex()->position().Z() < 100.;
     bool eta25       = !m_eta25cut || (part->momentum().Eta() > 2 && part->momentum().Eta() < 5);
 
 
@@ -458,33 +454,33 @@ StatusCode PrChecker::execute() {
         }
       }
       while( 0 != mother ) {
-        if ( mother->particleID().hasBottom() && 
+        if ( mother->particleID().hasBottom() &&
              ( mother->particleID().isMeson() ||  mother->particleID().isBaryon() ) ) fromB = true;
-        
+
         if ( mother->particleID().hasCharm() &&
              ( mother->particleID().isMeson() ||  mother->particleID().isBaryon() ) ) fromD = true;
 
         mother = mother->originVertex()->mother();
       }
     }
-    
+
 
 
     // all ids associated to the mcparticle
-    std::vector<LHCb::LHCbID> ids;    
-    if ( linkedIds.size() > (unsigned int) part->key() ) {      
+    std::vector<LHCb::LHCbID> ids;
+    if ( linkedIds.size() > (unsigned int) part->key() ) {
       for ( std::vector<int>::const_iterator itIm = linkedIds[part->key()].begin();
             linkedIds[part->key()].end() != itIm; ++itIm ) {
         LHCb::LHCbID temp;
         temp.setDetectorType( (*itIm) >> 28 );
-        // create LHCbId from int. Clumsy !                                                                                                               
+        // create LHCbId from int. Clumsy !
         temp.setID( (*itIm) );
         ids.push_back( temp );
       }
     }
-    if( msgLevel(MSG::VERBOSE) ) verbose() << "MCPart " << part->key() 
+    if( msgLevel(MSG::VERBOSE) ) verbose() << "MCPart " << part->key()
                                            << " has " << ids.size() << " LHCbIDs " <<endmsg;
-    //////////////////////////////////////    
+    //////////////////////////////////////
 
     std::vector<bool> flags;
     //flags.push_back( true );
@@ -500,7 +496,7 @@ StatusCode PrChecker::execute() {
       flags.push_back( eta25 && isLong && isInUT && fromB && trigger && !isElectron);
     }
     m_velo->countAndPlot(m_histoTool,part,flags,ids,nPrim);
-    
+
     flags.clear();
     flags.push_back( eta25 && isLong && !isElectron );
     flags.push_back( eta25 && isLong && over5 && !isElectron  );
@@ -516,7 +512,7 @@ StatusCode PrChecker::execute() {
     m_match->countAndPlot(m_histoTool,part,flags,ids,nPrim);
     m_best->countAndPlot(m_histoTool,part,flags,ids,nPrim);
     m_bestLong->countAndPlot(m_histoTool,part,flags,ids,nPrim);
-    
+
     flags.clear();
     flags.push_back( eta25 && isInVelo && !isElectron);
     flags.push_back( eta25 && isInVelo && isInUT && !isElectron );
@@ -533,7 +529,7 @@ StatusCode PrChecker::execute() {
       flags.push_back( eta25 && isLong && isInUT && fromB && trigger && !isElectron);
     }
     m_upTrack->countAndPlot(m_histoTool,part,flags,ids,nPrim);
-     
+
     flags.clear();
     flags.push_back( eta25 && trackInfo.hasT( part ) && !isElectron);
     flags.push_back( eta25 && isLong && !isElectron);
@@ -549,7 +545,7 @@ StatusCode PrChecker::execute() {
     flags.push_back( eta25 && strangeDown && !isInVelo && (fromB || fromD) && !isElectron);
     flags.push_back( eta25 && strangeDown && !isInVelo && over5 && (fromB || fromD) && !isElectron);
     m_tTrack->countAndPlot(m_histoTool,part,flags,ids,nPrim);
-    
+
     flags.clear();
     flags.push_back( eta25 && isDown && !isElectron);
     flags.push_back( eta25 && isDown && over5 && !isElectron);
@@ -567,33 +563,33 @@ StatusCode PrChecker::execute() {
     flags.push_back( eta25 && strangeDown && !isInVelo && over5 && (fromB || fromD) && !isElectron);
     m_downTrack->countAndPlot(m_histoTool,part,flags,ids,nPrim);
     m_bestDownstream->countAndPlot(m_histoTool,part,flags,ids,nPrim);
-    
+
 
     // -- UT Hits counters (excluded for the moment)
     /*
-    flags.clear();    
-    flags.push_back( eta25 && isLong  );    
+    flags.clear();
+    flags.push_back( eta25 && isLong  );
     flags.push_back( eta25 && isLong && over5   );
     flags.push_back( eta25 && isLong && over5 && isInUT  );
     if(m_triggerNumbers){
       flags.push_back( eta25 && isLong && trigger  );
     }
-    
+
     flags.push_back( eta25 && isLong && fromB );
     flags.push_back( eta25 && isLong && fromB && over5 );
     flags.push_back( eta25 && isLong && fromB && over5 && isInUT);
-    
+
     if(m_triggerNumbers){
       flags.push_back( eta25 && isLong && fromB && trigger  );
     }
-    
+
     m_utForward->countAndPlot( m_histoTool, part, flags, ids, nPrim );
     m_utMatch->countAndPlot( m_histoTool, part, flags, ids, nPrim );
     m_utbestLong->countAndPlot( m_histoTool, part, flags, ids, nPrim );
     */
   }
 
-   
+
   return StatusCode::SUCCESS;
 }
 
@@ -611,7 +607,7 @@ StatusCode PrChecker::finalize() {
   }
 
   //for ( std::vector<IPrUTCounter*>::iterator itCt = m_allUTCounters.begin();
-  //      m_allUTCounters.end() != itCt; ++itCt ) {    
+  //      m_allUTCounters.end() != itCt; ++itCt ) {
   //  (*itCt)->printStatistics();
   //}
 
diff --git a/Pr/PrMCTools/src/PrChecker.h b/Pr/PrMCTools/src/PrChecker.h
index 4695efdc8cb0753f0e8cdff3d236f49b0eaa724b..c5b79ca77edb34b0137e81f7918529854343061b 100644
--- a/Pr/PrMCTools/src/PrChecker.h
+++ b/Pr/PrMCTools/src/PrChecker.h
@@ -39,12 +39,12 @@ class IHistoTool ;
  *  - cloneRate: nClones / (nRecod & rectible tracks + nClones)
  *  - purity: Fraction of hits on the track belonging to the matched MCParticle
  *  - hitEff: Fraction of hits on the track of all hits belonging to the matched MCParticle
- * 
+ *
  *  Parameters:
  *   - Eta25Cut: Only consider particles with 2 < eta < 5? (default: false)
  *   - TriggerNumbers: Give numbers for p > 3GeV, pT > 500 MeV? (default: false)
  *   - UseElectrons: Take electrons into account in numbers? (default: false)
- * 
+ *
  *  @author Olivier Callot, Thomas Nikodem
  *  @date   2014-02-13
  */
@@ -77,8 +77,6 @@ public:
   /// Standard constructor
   PrChecker( const std::string& name, ISvcLocator* pSvcLocator );
 
-  virtual ~PrChecker( ); ///< Destructor
-
   StatusCode initialize() override;    ///< Algorithm initialization
   StatusCode execute() override;    ///< Algorithm execution
   StatusCode finalize() override;    ///< Algorithm finalization
@@ -94,7 +92,7 @@ private:
   std::string m_downTracks;
   std::string m_upTracks;
   std::string m_bestTracks;
-  
+
   std::string m_idLoc;
 
   IPrCounter* m_velo;
@@ -112,22 +110,22 @@ private:
   //IPrCounter* m_utbestLong;
   //IPrCounter* m_utDownst;
 
-  int  m_writeVeloHistos;      
-  int  m_writeForwardHistos;   
-  int  m_writeMatchHistos;     
-  int  m_writeDownHistos;      
-  int  m_writeUpHistos;        
-  int  m_writeTTrackHistos;    
+  int  m_writeVeloHistos;
+  int  m_writeForwardHistos;
+  int  m_writeMatchHistos;
+  int  m_writeDownHistos;
+  int  m_writeUpHistos;
+  int  m_writeTTrackHistos;
   int  m_writeBestHistos;
   int  m_writeBestLongHistos;
   int  m_writeBestDownstreamHistos;
   int  m_writeUTHistos;
 
-  bool m_eta25cut;             
+  bool m_eta25cut;
   bool m_triggerNumbers;
   bool m_useElectrons;
   bool m_upgrade;
-  
+
   double m_ghostProbCut;
 
   //== Vector of the counters
diff --git a/Pr/PrMCTools/src/PrChecker2.cpp b/Pr/PrMCTools/src/PrChecker2.cpp
index d96437dcceb2107bfbafb02047ade92e6b2a0aa5..cda39569ca858bf8780c4644600639ab87cd86c2 100644
--- a/Pr/PrMCTools/src/PrChecker2.cpp
+++ b/Pr/PrMCTools/src/PrChecker2.cpp
@@ -127,10 +127,6 @@ PrChecker2::PrChecker2( const std::string& name,
   declareProperty( "TexOutputFolder",           m_texfolder                 = "");
 
 }
-//=============================================================================
-// Destructor
-//=============================================================================
-PrChecker2::~PrChecker2() {}
 
 //=============================================================================
 // Initialization
@@ -461,7 +457,7 @@ StatusCode PrChecker2::execute() {
   }
 
 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
 
   LHCb::MCVertices* mcVert = getIfExists<LHCb::MCVertices>(LHCb::MCVertexLocation::Default );
   if(  mcVert == nullptr ){
diff --git a/Pr/PrMCTools/src/PrChecker2.h b/Pr/PrMCTools/src/PrChecker2.h
index 597593da2b9dfa8c92d8573b2fb09236ceb05158..a8ba09080495296c9a330147ea1817d0aa64bf7c 100644
--- a/Pr/PrMCTools/src/PrChecker2.h
+++ b/Pr/PrMCTools/src/PrChecker2.h
@@ -1,5 +1,3 @@
-// $Id: $
-
 #ifndef PRCHECKER2_H
 #define PRCHECKER2_H 1
 
@@ -36,8 +34,8 @@ class IHistoTool ;
  *   - Upgrade: Gets hitLocation from link to MCParticle from "Pr/LHCbID" instead of "Pat/LHCbID" (default: true)
  *   - WriteTexOutput: Writes the statistics table to a TeX file (default: false)
  *     which is dumped to the location specified in TexOutputFolder
- * 
- * 
+ *
+ *
  * additional track location container can be added for PrCounter2 and PrTTCounter via:
  *
  * @code
@@ -48,7 +46,7 @@ class IHistoTool ;
  *   myFactory.Modules = [ "LoKiMC.decorators" ]
  *   PrChecker2("PrChecker2").addTool( myFactory )
  *
- *   PrChecker2("PrChecker2").NewTracks= "Rec/Track/Velo" 
+ *   PrChecker2("PrChecker2").NewTracks= "Rec/Track/Velo"
  *   PrChecker2("PrChecker2").WriteNewHistos = 2
  *   PrChecker2("PrChecker2").SelectIdNewContainer = 1
  *   PrChecker2("PrChecker2").MyNewCuts= {"fromBorD" : "BOrDMother", "B daughters": "fromB", "D daughters": "fromD" }
@@ -62,12 +60,12 @@ class IHistoTool ;
  *   PrChecker2("PrChecker2").Velo.addTool(PrCounter2, name="Selector")
  *   PrChecker2("PrChecker2").Velo.Selector = "TrackSelector"
  *   PrChecker2("PrChecker2").Velo.addTool(TrackSelector("TrackSelector"))
- *   PrChecker2("PrChecker2").Velo.TrackSelector.MaxChi2Cut = 5.0 
+ *   PrChecker2("PrChecker2").Velo.TrackSelector.MaxChi2Cut = 5.0
  *  @endcode
  *
- *  Uses IHistoTool: for each container histograms are plotted if the following code segment is used. 
- *  Default values are -1 (no histograms), can also be set to 2 for additional histograms (expectedHits, docaz, PVz, EtaP, EtaPhi, efficiency maps @z=9000mm XYZ9000 and @z=2485mm XYZ2485) 
- * 
+ *  Uses IHistoTool: for each container histograms are plotted if the following code segment is used.
+ *  Default values are -1 (no histograms), can also be set to 2 for additional histograms (expectedHits, docaz, PVz, EtaP, EtaPhi, efficiency maps @z=9000mm XYZ9000 and @z=2485mm XYZ2485)
+ *
  *  @code
  *  PrChecker2("PrChecker2").Write(container)Histos = 1
  *  @endcode
@@ -78,16 +76,16 @@ class IHistoTool ;
  *  PrChecker2("PrChecker2").MyForwardCuts = {"long" : "isLong", "B daughter": "fromB" }
  *  @endcode
  *
- *  As a default selection cuts of old PrChecker are used. The following cuts are predefined: 
- *  - is(Not)Long, is(Not)Velo, is(Not)Down, is(Not)Up, is(Not)TT, is(Not)Seed, 
- *  - fromB, fromD, BOrDMother, fromKsFromB, strange 
+ *  As a default selection cuts of old PrChecker are used. The following cuts are predefined:
+ *  - is(Not)Long, is(Not)Velo, is(Not)Down, is(Not)Up, is(Not)TT, is(Not)Seed,
+ *  - fromB, fromD, BOrDMother, fromKsFromB, strange
  *  - is(Not)Electron, eta25, over5, trigger
- *  
+ *
  *  and LoKi syntax (LoKi::MCParticles) can be used for kinematical cuts, e.g. (MCPT> 2300), here the '()' are essential.
- * 
- * 
- *  NB: If you care about the implementation: The cut-strings are converted into two types of functors: 
- *  - LoKi-type functors (hence all LoKi::MCParticles cuts work) 
+ *
+ *
+ *  NB: If you care about the implementation: The cut-strings are converted into two types of functors:
+ *  - LoKi-type functors (hence all LoKi::MCParticles cuts work)
  *  - and custom-defined ones, mostly for type of reconstructibility and daughter-criteria (like 'isNotLong')
  *  where in the end all functors are evaluated on each MCParticle for each track container to define the reconstructibility.
  *  If a MCParticle is actually reconstructed is checked in the PrCounter2.
@@ -123,26 +121,24 @@ public:
 
 class PrChecker2 : public GaudiHistoAlg {
 public:
-  
+
   /// Standard constructor
   PrChecker2( const std::string& name, ISvcLocator* pSvcLocator );
-  
-  virtual ~PrChecker2( ); ///< Destructor
-  
+
   StatusCode initialize() override;    ///< Algorithm initialization
   StatusCode execute() override;    ///< Algorithm execution
   StatusCode finalize() override;    ///< Algorithm finalization
-  
+
 protected:
-  
-  
+
+
 private:
 
   // typedefs to make everything a bit more readable
   typedef std::vector<std::string>            strings;
   typedef std::map<std::string, std::string>  stringmap;
   typedef std::pair<std::string, std::string> stringpair;
-  
+
 
   std::string m_veloTracks;
   std::string m_forwardTracks;
@@ -153,7 +149,7 @@ private:
   std::string m_bestTracks;
   std::string m_newTracks;///< additional configurable track container for PrCounter2
   std::string m_ttnewTracks;///< additional configurable track container for PrTTCounter
-  
+
   IPrCounter* m_velo;
   IPrCounter* m_forward;
   IPrCounter* m_match;
@@ -164,48 +160,48 @@ private:
   IPrCounter* m_bestLong;
   IPrCounter* m_bestDownstream;
   IPrCounter* m_new;
-  
+
   IPrTTCounter* m_ttForward;
   IPrTTCounter* m_ttMatch;
   IPrTTCounter* m_ttDownst;
   IPrTTCounter* m_ttnew;
-  
+
   //IPrCounter* m_utForward;
   //IPrCounter* m_utMatch;
   //IPrCounter* m_utbestLong;
   //IPrCounter* m_utDownst;
-  
-  int  m_writeVeloHistos;      
-  int  m_writeForwardHistos;   
-  int  m_writeMatchHistos;     
-  int  m_writeDownHistos;      
-  int  m_writeUpHistos;        
-  int  m_writeTTrackHistos;    
+
+  int  m_writeVeloHistos;
+  int  m_writeForwardHistos;
+  int  m_writeMatchHistos;
+  int  m_writeDownHistos;
+  int  m_writeUpHistos;
+  int  m_writeTTrackHistos;
   int  m_writeBestHistos;
   int  m_writeBestLongHistos;
   int  m_writeBestDownstreamHistos;
-  int  m_writeNewHistos; 
+  int  m_writeNewHistos;
   int  m_writeUTHistos;
   int  m_writeTTForwardHistos;
   int  m_writeTTMatchHistos;
   int  m_writeTTDownstHistos;
   int  m_writeTTNewHistos;
-  
+
   int m_selectIdNew;
   int m_selectIdNewTT;
-  
-  bool m_eta25cut;             
+
+  bool m_eta25cut;
   double m_ghostProbCut;
   bool m_triggerNumbers;
   bool m_vetoElectrons;
   bool m_trackextrapolation;
-  
+
   bool m_upgrade;
 
   bool m_writetexfile;
   std::string m_texfilename;
   std::string m_texfolder;
-  
+
   enum recAs {
     isLong = 1,
     isNotLong = 2,
@@ -227,19 +223,19 @@ private:
     isNotElectron = 19,
     BOrDMother = 20,
   };
-  
+
   std::map< std::string, recAs> m_lookuptable = {{"isLong",isLong},
                                                  {"isNotLong",isNotLong},
-                                                 {"isDown",isDown}, 
+                                                 {"isDown",isDown},
                                                  {"isNotDown",isNotDown},
-                                                 {"isUp",isUp}, 
+                                                 {"isUp",isUp},
                                                  {"isNotUp",isNotUp},
                                                  {"isVelo",isVelo},
-                                                 {"isNotVelo",isNotVelo}, 
+                                                 {"isNotVelo",isNotVelo},
                                                  {"isTT",isTT},
                                                  {"isNoTT",isNotTT},
-                                                 {"isSeed",isSeed}, 
-                                                 {"isNotSeed",isNotSeed}, 
+                                                 {"isSeed",isSeed},
+                                                 {"isNotSeed",isNotSeed},
                                                  {"strange",strange},
                                                  {"fromB",fromB},
                                                  {"fromD",fromD},
@@ -253,31 +249,33 @@ private:
   /** @class isTrack PrChecker2.h
   *  Predefined selection cuts: it converts strings to normal cuts, used by addOtherCuts
   */
-  class isTrack {   
-        
+  class isTrack {
+
   public:
-    isTrack(const int kind) { 
+    isTrack(const int kind) {
       m_kind = kind;
     };
     /// Functor that checks if the MCParticle fulfills certain criteria, e.g. reco'ble as long track, B daughter, ...
     bool operator()(LHCb::MCParticle* mcp, MCTrackInfo* mcInfo) const {
       bool motherB       = false;
       bool motherD       = false;
-      if(m_kind == isLong) return mcInfo->hasVeloAndT( mcp );
-      if(m_kind == isNotLong) return !mcInfo->hasVeloAndT( mcp );
-      if(m_kind == isDown) return mcInfo->hasT( mcp ) &&  mcInfo->hasTT( mcp );
-      if(m_kind == isNotDown) return !(mcInfo->hasT( mcp ) &&  mcInfo->hasTT( mcp ));
-      if(m_kind == isUp) return mcInfo->hasVelo( mcp ) &&  mcInfo->hasTT( mcp );
-      if(m_kind == isNotUp) return !(mcInfo->hasVelo( mcp ) &&  mcInfo->hasTT( mcp ));
-      if(m_kind == isVelo) return mcInfo->hasVelo( mcp );
-      if(m_kind == isNotVelo) return !mcInfo->hasVelo( mcp );
-      if(m_kind == isSeed) return mcInfo->hasT( mcp );
-      if(m_kind == isNotSeed) return !mcInfo->hasT( mcp );
-      if(m_kind == isTT) return mcInfo->hasTT( mcp );
-      if(m_kind == isNotTT) return !mcInfo->hasTT( mcp );
-      if(m_kind == isElectron) return abs( mcp->particleID().pid() ) == 11;
-      if(m_kind == isNotElectron) return abs( mcp->particleID().pid() ) != 11;
-      
+      switch(m_kind) {
+          case  isLong         : return mcInfo->hasVeloAndT( mcp );
+          case  isNotLong      : return !mcInfo->hasVeloAndT( mcp );
+          case  isDown         : return mcInfo->hasT( mcp ) &&  mcInfo->hasTT( mcp );
+          case  isNotDown      : return !(mcInfo->hasT( mcp ) &&  mcInfo->hasTT( mcp ));
+          case  isUp           : return mcInfo->hasVelo( mcp ) &&  mcInfo->hasTT( mcp );
+          case  isNotUp        : return !(mcInfo->hasVelo( mcp ) &&  mcInfo->hasTT( mcp ));
+          case  isVelo         : return mcInfo->hasVelo( mcp );
+          case  isNotVelo      : return !mcInfo->hasVelo( mcp );
+          case  isSeed         : return mcInfo->hasT( mcp );
+          case  isNotSeed      : return !mcInfo->hasT( mcp );
+          case  isTT           : return mcInfo->hasTT( mcp );
+          case  isNotTT        : return !mcInfo->hasTT( mcp );
+          case  isElectron     : return abs( mcp->particleID().pid() ) == 11;
+          case  isNotElectron  : return abs( mcp->particleID().pid() ) != 11;
+      }
+
       if ( 0 != mcp->originVertex() ) {
         const LHCb::MCParticle* mother =  mcp->originVertex()->mother();
         if ( 0 != mother ) {
@@ -297,14 +295,14 @@ private:
                    3334 == pid      // Omega-
                    ) {
                 if(m_kind == strange) return true;
-                
+
               }
               // -- It's a Kshort from a b Hadron
               if ( 0 != mother->originVertex()->mother() ) {
                 if  ( 310 == pid &&
                       2 == mcp->originVertex()->products().size()  &&
                       mother->originVertex()->mother()->particleID().hasBottom() &&
-                      ( mother->originVertex()->mother()->particleID().isMeson() ||  
+                      ( mother->originVertex()->mother()->particleID().isMeson() ||
                         mother->originVertex()->mother()->particleID().isBaryon() )) {
                   if(m_kind == fromKsFromB) return true;
                 }
@@ -314,23 +312,23 @@ private:
         }
         // -- It's a daughter of a B or D hadron
         while( 0 != mother ) {
-          if ( mother->particleID().hasBottom() && 
+          if ( mother->particleID().hasBottom() &&
                ( mother->particleID().isMeson() ||  mother->particleID().isBaryon() ) )   motherB = true;
-          
+
           if ( mother->particleID().hasCharm() &&
                ( mother->particleID().isMeson() ||  mother->particleID().isBaryon() ) )  motherD = true;
-          
+
           mother = mother->originVertex()->mother();
-          
+
         }
         if( m_kind == fromD && motherD == true)  return m_kind == fromD;
         if( m_kind == fromB && motherB == true)  return m_kind == fromB;
-        
+
         if(m_kind == BOrDMother && (motherD || motherB)  )  return m_kind == BOrDMother;
       }
       return false;
     }
-    
+
   private:
     int m_kind;
   };
@@ -340,27 +338,27 @@ private:
    *  Class that adds selection cuts defined in isTrack to cuts
    */
   class addOtherCuts{
-    
+
   public:
     void addCut(isTrack cat){ m_cuts.push_back(cat); }
-    
+
     /// Functor that evaluates all 'isTrack' cuts
     bool operator()(LHCb::MCParticle* mcp, MCTrackInfo* mcInfo){
-      
+
       bool decision = true;
-      
+
       for(unsigned int i = 0; i < m_cuts.size(); ++i){
         decision = decision && m_cuts[i](mcp, mcInfo);
       }
-      
+
       return decision;
     }
-    
+
   private:
     std::vector<isTrack> m_cuts;
-    
+
   };
-  
+
   //maps for each track container with {cut name,selection cut}
   stringmap m_map_forward;
   stringmap m_map_velo;
@@ -371,21 +369,21 @@ private:
   stringmap m_map_ttdown;
   stringmap m_map_new;
   stringmap m_map_ttnew;
-  
+
   //default cuts for each container, if not other ones are specified in run python file, those are taken
   /** @brief Map filled  with default cuts for each container, first string is name of the cut, second one is cut (predefined from class isTrack or kinematical Loki Cuts)
    */
   stringmap DefaultCutMap( std::string name ){
-    
+
     stringmap map_velo      = { {"01_velo" ,"isVelo "},//use numbers for right order of cuts
                                 {"02_long","isLong "},
-                                {"03_long>5GeV" ,"isLong & over5  " }, 
+                                {"03_long>5GeV" ,"isLong & over5  " },
                                 {"04_long_strange" , "isLong & strange " },
                                 {"05_long_strange>5GeV","isLong & strange & over5 " },
                                 {"06_long_fromB" ,"isLong & fromB " },
                                 {"07_long_fromB>5GeV" , "isLong & fromB & over5 " } };
-    stringmap map_forward   = { {"01_long","isLong "}, 
-                                {"02_long>5GeV","isLong & over5 " }, 
+    stringmap map_forward   = { {"01_long","isLong "},
+                                {"02_long>5GeV","isLong & over5 " },
                                 {"03_long_strange","isLong & strange " },
                                 {"04_long_strange>5GeV","isLong & strange & over5 " },
                                 {"05_long_fromB","isLong & fromB " },
@@ -426,14 +424,14 @@ private:
                                 {"12_UT+T_SfromDB>5GeV" , " strange & isDown & over5 & ( fromB | fromD ) "},
                                 {"13_noVelo+UT+T_SfromDB" , " strange & isDown & isNotVelo & ( fromB | fromD )"},
                                 {"14_noVelo+UT+T_SfromDB>5GeV" , " strange & isDown & isNotVelo & over5 & ( fromB | fromD ) "} };
-    
+
     stringmap map_new       = { };
     stringmap map_ttforward = { { "01_long" ,"isLong "},
                                 {"02_long>5GeV" ,"isLong & over5  "} };
     stringmap map_ttdown    = { {"01_has seed" ,"isSeed "},
                                 {"02_has seed +noVelo, T+TT" ,"isSeed & isNotVelo & isDown "},
                                 {"03_down+strange" , " strange & isDown"},
-                                {"04_down+strange+>5GeV" , " strange & isDown & over5 "}, 
+                                {"04_down+strange+>5GeV" , " strange & isDown & over5 "},
                                 {"05_pi<-Ks<-B" , "fromKsFromB "},
                                 {"06_pi<-Ks<-B+> 5 GeV" , "fromKsFromB & over5 "} };
     stringmap map_ttnew     = { };
@@ -448,11 +446,11 @@ private:
     if( name == "TTForward"    ) return map_ttforward;
     if( name == "TTDownstream" ) return map_ttdown;
     if( name == "TTNew"        ) return map_ttnew;
-   
+
     return empty_map;
 
   }
-   
+
   /** @brief makes vector of second elements of DefaultCutMap --> needed as input for m_Cuts */
   strings getMyCut( stringmap myCutMap ){
     strings dummy;
@@ -462,27 +460,27 @@ private:
     return dummy;
   }
 
-  
+
 
 
   //== Vector of the counters
   std::vector<IPrCounter*>   m_allCounters;///<Vector of PrCounter
   std::vector<IPrTTCounter*> m_allTTCounters;///<Vector of PrTTCounter
-  
+
   const IHistoTool*       m_histoTool;
   LoKi::IMCHybridFactory* m_factory;///<needed to convert normal cuts into Loki cuts
 
   // maps for cuts
   std::map< std::string, strings >                            m_Cuts;///<map of track container name and corresponding cuts
-  
+
   std::map < std::string, std::vector < LoKi::Types::MCCut> > m_LoKiCuts;///<converted map of Loki cuts, first component is name of track container
-  std::map < std::string, std::vector <addOtherCuts> >        m_otherCuts;///<map of other cuts as predefined in isTrack, first component is name of track container 
-  
-  std::vector<LoKi::Types::MCCut> m_veloMCCuts; 
-  std::vector<addOtherCuts>       m_veloMCCuts2; 
+  std::map < std::string, std::vector <addOtherCuts> >        m_otherCuts;///<map of other cuts as predefined in isTrack, first component is name of track container
+
+  std::vector<LoKi::Types::MCCut> m_veloMCCuts;
+  std::vector<addOtherCuts>       m_veloMCCuts2;
   std::vector<LoKi::Types::MCCut> m_forwardMCCuts;
-  std::vector<addOtherCuts>       m_forwardMCCuts2; 
-  std::vector<LoKi::Types::MCCut> m_upstreamMCCuts; 
+  std::vector<addOtherCuts>       m_forwardMCCuts2;
+  std::vector<LoKi::Types::MCCut> m_upstreamMCCuts;
   std::vector<addOtherCuts>       m_upstreamMCCuts2;
   std::vector<LoKi::Types::MCCut> m_ttrackMCCuts;
   std::vector<addOtherCuts>       m_ttrackMCCuts2;
diff --git a/Pr/PrMCTools/src/PrClustersResidual.cpp b/Pr/PrMCTools/src/PrClustersResidual.cpp
index 4dd64323ffcfddfa233e8dd351e417c3d4014cf9..bf1a2b06be181424b0ed2cb5a3d30248f279f7ae 100644
--- a/Pr/PrMCTools/src/PrClustersResidual.cpp
+++ b/Pr/PrMCTools/src/PrClustersResidual.cpp
@@ -34,10 +34,6 @@ PrClustersResidual::PrClustersResidual( const std::string& name,
   declareProperty("FTHitsLocation", m_HitsInTES);
   declareProperty("FTLiteClusterLocation", m_HitsInTES);
 }
-//=============================================================================
-// Destructor
-//=============================================================================
-PrClustersResidual::~PrClustersResidual() {}
 
 //=============================================================================
 // Initialization
@@ -113,7 +109,7 @@ void PrClustersResidual::Occupancy(const PrFTHitHandler<PrHit>& FTHitHandler){
   char layerName[100];
   char Title[100];
   std::vector<int> nHits(12,0);
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
   LHCb::MCVertices* mcVert = getIfExists<LHCb::MCVertices>(LHCb::MCVertexLocation::Default );
   if(  mcVert == nullptr ){
     error() << "Could not find MCVertices at " << LHCb::MCParticleLocation::Default << endmsg;
@@ -310,7 +306,7 @@ void PrClustersResidual::TrackStudy(const PrFTHitHandler<PrHit>& FTHitHandler){
   //Get the McParticles
   LHCb::MCParticles* mcParts = getIfExists<LHCb::MCParticles> ( LHCb::MCParticleLocation::Default );
   //Get track informations
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
   //If you Run the cheated Seeding or the normal seeding or the forward , you don't have to decode it again:
 
   debug()<<"Initialize"<<endmsg;
@@ -966,7 +962,7 @@ void  PrClustersResidual::ClusterResidual(const PrFTHitHandler<PrHit>& FTHitHand
   if(msgLevel(MSG::DEBUG)) debug()<<" Get Cluster to MCHit Linker "<<endmsg;
 
   LinkedTo<LHCb::MCHit> myFTCluster2MCHitLink ( evtSvc(),msgSvc(), LHCb::FTLiteClusterLocation::Default + "2MCHits");
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
   if(msgLevel(MSG::DEBUG)) debug()<<" Add MCHitAndTrackStudy "<<endmsg;
   Tuples::Tuple tuple = GaudiTupleAlg::nTuple("ClusterMCHitAndTrackStudy","Events");
   for (unsigned int zone = 0; zone < m_zone; ++zone)
diff --git a/Pr/PrMCTools/src/PrClustersResidual.h b/Pr/PrMCTools/src/PrClustersResidual.h
index 9b98cc47eb5233d7f7bca21635b961015fe30f87..4010106b423b99352f56557f12c5c05a80b96ba0 100644
--- a/Pr/PrMCTools/src/PrClustersResidual.h
+++ b/Pr/PrMCTools/src/PrClustersResidual.h
@@ -65,14 +65,10 @@ public:
   /// Standard constructor
   PrClustersResidual( const std::string& name, ISvcLocator* pSvcLocator );
 
-  virtual ~PrClustersResidual( ); ///< Destructor
-
   StatusCode initialize() override;    ///< Algorithm initialization
   StatusCode execute() override;    ///< Algorithm execution
   StatusCode finalize() override;    ///< Algorithm finalization
 
-protected:
-
 private:
 
   void HitEfficiency();
diff --git a/Pr/PrMCTools/src/PrDebugMatchToolNN.cpp b/Pr/PrMCTools/src/PrDebugMatchToolNN.cpp
index 4689cb077563c3cc1976357ee5b0b9705fe1ff10..c4aa74256c6fdb9e410e6062b86e0c24b3abf9fb 100644
--- a/Pr/PrMCTools/src/PrDebugMatchToolNN.cpp
+++ b/Pr/PrMCTools/src/PrDebugMatchToolNN.cpp
@@ -11,7 +11,6 @@
 #include "Event/MCTrackInfo.h"
 #include "Event/MCParticle.h"
 #include "Event/Track.h"
-#include "Event/MCTrackInfo.h"
 
 #include "Linker/LinkedTo.h"
 
@@ -27,44 +26,44 @@ DECLARE_COMPONENT( PrDebugMatchToolNN )
 //=============================================================================
 void PrDebugMatchToolNN::fillTuple(const LHCb::Track& velo, const LHCb::Track& seed, const  std::vector<float>& vars ) const
 {
-  
+
   int found=  matchMCPart(velo, seed);
   Tuple tuple = nTuple("tuple","tuple");
-  
+
   tuple->column("quality", found ).ignore();
-  
+
   unsigned int i=0;
   for(auto var: vars ){
     tuple->column("var"+std::to_string(i), var).ignore();
     i++;
   }
-  
+
   tuple->write().ignore();
 }
 
 //=============================================================================
-int PrDebugMatchToolNN::matchMCPart(const LHCb::Track& velo, const LHCb::Track& seed) const 
+int PrDebugMatchToolNN::matchMCPart(const LHCb::Track& velo, const LHCb::Track& seed) const
 {
-  
+
   LinkedTo<LHCb::MCParticle, LHCb::Track> myLinkVelo ( evtSvc(), msgSvc(),LHCb::TrackLocation::Velo);
   LinkedTo<LHCb::MCParticle, LHCb::Track> myLinkSeed ( evtSvc(), msgSvc(),LHCb::TrackLocation::Seed);
 
-  LHCb::MCParticle* mcPartV = myLinkVelo.first(  velo.key()  ); 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  LHCb::MCParticle* mcPartV = myLinkVelo.first(  velo.key()  );
+  const MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
 
 
   int found=0;
   while(mcPartV != NULL){
-    if(  !trackInfo.hasVeloAndT( mcPartV)){      
+    if(  !trackInfo.hasVeloAndT( mcPartV)){
       mcPartV=myLinkVelo.next();
-      continue; 
+      continue;
     }
-    
-    LHCb::MCParticle* mcPartS = myLinkSeed.first(  seed.key()  ); 
+
+    LHCb::MCParticle* mcPartS = myLinkSeed.first(  seed.key()  );
     while(mcPartS != NULL){
       if(mcPartV == mcPartS){
-	
-	if(11 == abs( mcPartV->particleID().pid())){      
+
+	if(11 == abs( mcPartV->particleID().pid())){
 	  found = -1;
 	  break;
 	}
diff --git a/Pr/PrMCTools/src/PrDebugTrackingLosses.cpp b/Pr/PrMCTools/src/PrDebugTrackingLosses.cpp
index 31d94e2605192c0d903768a25f5bec8b476d28f5..bbc2e7ea68f1cc7cccc0d2446981fcfd53f31d10 100644
--- a/Pr/PrMCTools/src/PrDebugTrackingLosses.cpp
+++ b/Pr/PrMCTools/src/PrDebugTrackingLosses.cpp
@@ -83,7 +83,7 @@ StatusCode PrDebugTrackingLosses::execute() {
 
   LinkedFrom<LHCb::Track,LHCb::MCParticle> veloLinker   ( evtSvc(), msgSvc(), m_veloName  );
 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  const MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
 
   LHCb::MCParticles::const_iterator itP = partCont->begin();
   for (; itP != partCont->end(); ++itP){
diff --git a/Pr/PrMCTools/src/PrDebugUTTruthTool.cpp b/Pr/PrMCTools/src/PrDebugUTTruthTool.cpp
index 75079ac54335e00f880b50ead1bef60d420f23c5..b2d9a0645943974f7179bf9b751b999c896dd3a5 100644
--- a/Pr/PrMCTools/src/PrDebugUTTruthTool.cpp
+++ b/Pr/PrMCTools/src/PrDebugUTTruthTool.cpp
@@ -297,7 +297,7 @@ void PrDebugUTTruthTool::forceMCHits(UT::Mut::Hits& hits, LHCb::Track* track){
 //=========================================================================
 void PrDebugUTTruthTool::tuneFisher( const LHCb::Track* seedTrack){
 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  const MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
   LinkedTo<LHCb::MCParticle, LHCb::Track> mySeedLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Seed);
 
   bool goodTrack = true;
@@ -357,7 +357,7 @@ void PrDebugUTTruthTool::tuneFisher( const LHCb::Track* seedTrack){
 //=========================================================================
 void PrDebugUTTruthTool::tuneDeltaP( const LHCb::Track* seedTrack, const double deltaP, const double momentum){
 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  const MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
   LinkedTo<LHCb::MCParticle, LHCb::Track> mySeedLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Seed);
 
   bool goodTrack = true;
@@ -395,7 +395,7 @@ void PrDebugUTTruthTool::tuneDeltaP( const LHCb::Track* seedTrack, const double
 //=========================================================================
 void PrDebugUTTruthTool::tuneFinalMVA( const LHCb::Track* seedTrack, bool goodTrack, std::vector<double> vals){
 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  const MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
   LinkedTo<LHCb::MCParticle, LHCb::Track> mySeedLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Seed);
 
   bool goodSeedTrack = true;
@@ -451,7 +451,7 @@ void PrDebugUTTruthTool::tuneFinalMVA( const LHCb::Track* seedTrack, bool goodTr
 //=========================================================================
 void PrDebugUTTruthTool::getMagnetError( const LHCb::Track* seedTrack){
 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  const MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
   LinkedTo<LHCb::MCParticle, LHCb::Track> mySeedLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Seed);
 
   bool goodSeedTrack = true;
diff --git a/Pr/PrMCTools/src/PrLHCbID2MCParticle.cpp b/Pr/PrMCTools/src/PrLHCbID2MCParticle.cpp
index 4635850404e33854663d938876b5a04bcc65ef04..4d77c941aa48f251a0c3c7a2cfe17b05722f917b 100644
--- a/Pr/PrMCTools/src/PrLHCbID2MCParticle.cpp
+++ b/Pr/PrMCTools/src/PrLHCbID2MCParticle.cpp
@@ -5,7 +5,7 @@
 // includes from DigiEvent
 #include "Event/VeloCluster.h"
 #include "Event/VeloLiteCluster.h"
-#include "Event/VPCluster.h"
+#include "Event/VPLightCluster.h"
 #include "Event/STCluster.h"
 #include "Event/OTTime.h"
 #include "Event/FTLiteCluster.h"
@@ -86,11 +86,11 @@ StatusCode PrLHCbID2MCParticle::execute() {
 
   //== VP
 
-  const auto* vp_clusters = getIfExists<LHCb::VPClusters>(LHCb::VPClusterLocation::Default);
+  const auto* vp_clusters = getIfExists<LHCb::VPLightClusters>(LHCb::VPClusterLocation::Light);
   if ( vp_clusters ) {
-    LinkedTo<LHCb::MCParticle> vpLink(evtSvc(), msgSvc(), LHCb::VPClusterLocation::Default);
+    LinkedTo<LHCb::MCParticle> vpLink(evtSvc(), msgSvc(), LHCb::VPClusterLocation::Light);
     for (const auto& clus : *vp_clusters) {
-      linkAll(vpLink, lhcbLink, clus->channelID(), {clus->channelID().channelID()});
+      linkAll(vpLink, lhcbLink, clus.second.channelID(), {clus.second.channelID().channelID()});
     }
   }
 
diff --git a/Pr/PrMCTools/src/PrPlotFTHits.cpp b/Pr/PrMCTools/src/PrPlotFTHits.cpp
index 4100f8c51201c62adcfdd0fc12788fc2dfba3c4a..1b28b6ed449e54667124fded9e32e5fd51d1d7f4 100644
--- a/Pr/PrMCTools/src/PrPlotFTHits.cpp
+++ b/Pr/PrMCTools/src/PrPlotFTHits.cpp
@@ -113,7 +113,7 @@ void PrPlotFTHits::plotOccupancy(const PrFTHitHandler<PrHit>& FTHitHandler){
   char layerName[100];
   char Title[100];
   std::vector<int> nHits(12,0);
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  const MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
 
   LHCb::MCVertices* mcVert = getIfExists<LHCb::MCVertices>(LHCb::MCVertexLocation::Default );
   if(  mcVert == nullptr ){
@@ -249,7 +249,6 @@ void PrPlotFTHits::plotState(){
   if( !forwardTracks ) info() << "No tracks found in: " << LHCb::TrackLocation::Forward << endmsg;
   if( !seedTracks ) info() << "No tracks found in: " << LHCb::TrackLocation::Seed << endmsg;
   char  stateZ[100];
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
   if( seedTracks)
   {
 
@@ -319,7 +318,7 @@ void PrPlotFTHits::plotHitEfficiency(const PrFTHitHandler<PrHit>& FTHitHandler){
   LinkedTo<LHCb::MCParticle, LHCb::Track> myForwardLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Forward);
   LinkedTo<LHCb::MCParticle, LHCb::Track> mySeedLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Seed);
   LinkedTo<LHCb::MCParticle> myClusterLink ( evtSvc(), msgSvc(), LHCb::FTLiteClusterLocation::Default );
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  const MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
 
   // -----------------------------------------------------------------------------------
   // Plot hit efficiency as function of x and y
@@ -608,7 +607,7 @@ void PrPlotFTHits::plotTrackingEfficiency(){
    LHCb::MCParticles* mcParts = getIfExists<LHCb::MCParticles>( LHCb::MCParticleLocation::Default );
    if ( msgLevel( MSG::ERROR ) && !mcParts ) error() << "Could not find MCParticles at: " <<  LHCb::MCParticleLocation::Default << endmsg;
 
-   MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+   const MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
 
    for(const LHCb::MCParticle* mcPart:  *mcParts){
 
@@ -708,7 +707,7 @@ void PrPlotFTHits::plotMCHits ( const PrFTHitHandler<PrHit>& FTHitHandler) {
   LinkedTo<LHCb::MCHit> myMCHitLink ( evtSvc(), msgSvc(), LHCb::FTLiteClusterLocation::Default + "2MCHits");
   LinkedTo<LHCb::MCParticle> myClusterLink ( evtSvc(), msgSvc(), LHCb::FTLiteClusterLocation::Default );
 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
 
   for(unsigned int i = 0; i < m_zone; i++){
 
diff --git a/Pr/PrMCTools/src/PrTrackConverter.cpp b/Pr/PrMCTools/src/PrTrackConverter.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..06663226f2fb3aafb5bf988daad7b58d1e798b3e
--- /dev/null
+++ b/Pr/PrMCTools/src/PrTrackConverter.cpp
@@ -0,0 +1,126 @@
+// Include files
+
+
+// from Gaudi
+#include <boost/algorithm/string/replace.hpp>
+
+#include "GaudiKernel/IDataManagerSvc.h"
+#include "GaudiKernel/SmartIF.h"
+
+// from Event
+#include "Event/Track.h"
+#include "Linker/LinkerWithKey.h"
+
+#include "Event/MCParticle.h"
+#include "Event/MCVertex.h"
+
+// local
+#include "PrTrackConverter.h"
+
+DECLARE_COMPONENT( PrTrackConverter )
+
+//=============================================================================
+// Standard constructor, initializes variables
+//=============================================================================
+  PrTrackConverter::PrTrackConverter( const std::string& name,
+                                          ISvcLocator* pSvcLocator ) :
+    GaudiAlgorithm( name, pSvcLocator )
+{
+  declareProperty( "RootOfContainers",  m_rootOfContainers = "/Event/Rec/Track" );
+  declareProperty( "RootOfOutContainers",  m_rootOfOutContainers = "/Event/Rec/Track/Copy" );
+  ///Event/Rec/Track/Copy....
+  declareProperty( "SingleContainer",   m_singleContainer  = "" );
+  declareProperty( "TrackContainerIDs", m_containerIDs = { LHCb::Track::classID() + 0x60000, LHCb::Track::Selection::classID() });
+
+
+}
+
+//=============================================================================
+// Destructor
+//=============================================================================
+PrTrackConverter::~PrTrackConverter() {}
+
+//=============================================================================
+// Initialisation. Check parameters
+//=============================================================================
+StatusCode PrTrackConverter::initialize() {
+
+  // Mandatory initialization of GaudiAlgorithm
+  StatusCode sc = GaudiAlgorithm::initialize();
+  if( sc.isFailure() ) { return sc; }
+
+  if ( "" != m_singleContainer ) {
+    info() << "Processing only the container " << m_singleContainer << endmsg;
+  } else {
+    info() << "Processing all tracks containers in " << m_rootOfContainers << endmsg;
+  }
+
+  return StatusCode::SUCCESS;
+}
+
+//=============================================================================
+// Main execution
+//=============================================================================
+StatusCode PrTrackConverter::execute() {
+
+  std::vector<std::string> trackContainers;
+  if ( "" != m_singleContainer ) {
+    trackContainers.push_back( m_singleContainer );
+  } else {
+    //== Scan the root directory and make a list of containers to process.
+    DataObject* root =  getIfExists<DataObject*>( m_rootOfContainers );
+    if ( NULL == root ) {
+      info()<<"Root-of-Containers directory " <<   m_rootOfContainers << "' does not exist. Skipping." <<endmsg;
+      return StatusCode::SUCCESS;
+    }
+    
+    SmartIF<IDataManagerSvc> mgr( eventSvc() );
+    typedef std::vector<IRegistry*> Leaves;
+    Leaves leaves;
+    StatusCode sc = mgr->objectLeaves( root, leaves );
+    if ( sc ) {
+      for ( Leaves::const_iterator iL = leaves.begin(); leaves.end() != iL; ++iL ) {
+        const std::string& id = (*iL)->identifier();
+        DataObject* tmp(NULL);
+        sc = eventSvc()->findObject( id, tmp );
+        if ( sc && NULL != tmp ) {
+          //for( unsigned int clID : m_containerIDs){
+	  //info()<<"tmp->clID() = "<<tmp->clID() << "  clID match "<<clID<<endmsg;
+	  //if ( tmp->clID() == clID ) {
+	  trackContainers.push_back( id );
+	  //}
+	  //}
+        }
+      }
+    }else{
+      info()<<"mgr->objectLeaves doesnt work"<<endmsg;
+    }
+  }
+  info()<<"trackContainers.size() = "<<trackContainers.size()<<endmsg;
+  for ( std::vector<std::string>::iterator itS = trackContainers.begin();
+        trackContainers.end() != itS; ++itS ) {
+    info() << "processing container: " << *itS << endmsg ;
+    // Retrieve the Tracks
+    std::vector<LHCb::Track>* tracks = getIfExists<std::vector<LHCb::Track> > ( *itS );
+    if ( tracks->size() ==0 ) {
+      info()<<"Container "<<*itS<< "  empty"<<endmsg;
+      continue;
+    }
+    
+    // Loop over the Tracks
+    LHCb::Tracks* tracks_copy = new LHCb::Tracks();
+    std::string track_cont_out = *itS;
+    info()<<"in track container = "<<(*itS)<<endmsg;
+    boost::replace_all( track_cont_out, m_rootOfContainers, m_rootOfOutContainers );
+    info()<<"Will re-create a keyed container afterward at TS location : "<<track_cont_out<<endmsg;
+    put( tracks_copy , track_cont_out );
+    info()<<"Not working the put! "<<track_cont_out<<endmsg;
+
+    for( auto& original_track  : *tracks ){
+      LHCb::Track* tr = new LHCb::Track;
+      tr->copy( original_track);
+      tracks_copy->insert( tr );
+    } // End loop over Tracks
+  }
+  return StatusCode::SUCCESS;
+}
diff --git a/Pr/PrMCTools/src/PrTrackConverter.h b/Pr/PrMCTools/src/PrTrackConverter.h
new file mode 100644
index 0000000000000000000000000000000000000000..418ec3a310d5046cb3c53a20b3cc359b43477db6
--- /dev/null
+++ b/Pr/PrMCTools/src/PrTrackConverter.h
@@ -0,0 +1,37 @@
+#ifndef PRTRACKASSOCIATOR_H 
+#define PRTRACKASSOCIATOR_H 1
+
+// Include files
+
+// from Gaudi
+#include "GaudiAlg/GaudiAlgorithm.h"
+
+/** @class TrackConverter
+ *
+ *  This algorithm is a dummy std::vector<LHCb::Track> to keyed container converter, to allow the truth matching to work for the upgrade
+ *
+ *  @author Renato Quagliani
+ *  @date   25-01-2018
+ */
+
+class PrTrackConverter : public GaudiAlgorithm {
+public:
+
+  // Standard constructor
+  PrTrackConverter( const std::string& name, ISvcLocator* pSvcLocator );
+
+  // Destructor
+  virtual ~PrTrackConverter();
+
+  StatusCode initialize() override;  ///< Algorithm initialization
+  StatusCode execute() override;     ///< Algorithm execution
+
+
+  // jobOptions
+  std::string m_rootOfContainers;   ///< root in TES of all the track containers to process
+  std::string m_rootOfOutContainers ;
+  std::string m_singleContainer;
+  std::vector<unsigned int> m_containerIDs;  
+  
+};
+#endif // PRTRACKASSOCIATOR_H
diff --git a/Pr/PrPixel/src/PrPixelHitManager.cpp b/Pr/PrPixel/src/PrPixelHitManager.cpp
index 0af46d346728d25c689b5ba6519daad5e06d31b7..40cda6cc32fb83491c840740d973b50eb77b10fe 100644
--- a/Pr/PrPixel/src/PrPixelHitManager.cpp
+++ b/Pr/PrPixel/src/PrPixelHitManager.cpp
@@ -273,8 +273,7 @@ StatusCode PrPixelHitManager::rebuildGeometry() {
 //=========================================================================
 bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
                                               std::vector<PrPixelModuleHits>& modulehits, LHCb::VPLightClusters& clusters,
-                                              bool storecluster ) const
-{
+                                              bool storecluster ) const{
   auto& tBanks = rawEvent.banks(LHCb::RawBank::VP);
   if ( UNLIKELY( tBanks.empty() ) ) return true;
   const unsigned int version = (*tBanks.begin())->version();
@@ -282,7 +281,7 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
     warning() << "Unsupported raw bank version (" << version << ")" << endmsg;
     return false;
   }
-
+  
   // WARNING:
   // This is a rather long function. Please refrain from breaking this
   // up into smaller functions as this will severely impact the
@@ -292,17 +291,18 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
   std::array<unsigned char, VP::NPixelsPerSensor> buffer{};
   std::vector<uint32_t> pixel_idx;
   std::vector<uint32_t> stack;
+  
   // reserve a minimal stack
   stack.reserve(64);
   // reserve a pixel idx for cluster big as the max amount of sensors 
-  // pixel_idx.reserve( VP::NPixelsPerSensor );
+  pixel_idx.reserve( VP::NPixelsPerSensor );
+  
   for( auto& mhits : modulehits) {
     mhits.getXVec().reserve(200);
     mhits.getYVec().reserve(200);
     mhits.getZVec().reserve(200);
     mhits.getIDVec().reserve(200);
   }
-  
   std::vector<float> xFractions; xFractions.reserve(200);
   std::vector<float> yFractions; yFractions.reserve(200);
   // ChannelIDs for offline mode
@@ -325,7 +325,7 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
     auto& hitsZVec  = modulehits[module].getZVec();
     auto& hitsIDVec = modulehits[module].getIDVec();
     const float *ltg = m_ltg + 16 * sensor;
-
+    
     // reset and then fill the super pixel buffer for a sensor
     // memset(m_sp_buffer,0,256*256*3*sizeof(unsigned char));
     // the memset is too slow here. the occupancy is so low that
@@ -337,7 +337,7 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
     pixel_idx.clear();
     const uint32_t *bank = (*iterBank)->data();
     const uint32_t nsp = *bank++;
-
+    
     for (unsigned int i = 0; i < nsp; ++i) {
       const uint32_t sp_word = *bank++;
       uint8_t sp = sp_word & 0xFFU;
@@ -363,9 +363,9 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
           const uint32_t col = (idx >> 2) & 1;
           const uint32_t cx = sp_col * 2 + col;
           const uint32_t cy = sp_row * 4 + row;
-
+	  
           LHCb::VPChannelID cid(sensor, chip, cx % CHIP_COLUMNS, cy);
-
+	  
           const float fx = m_sp_fx[sp * 2];
           const float fy = m_sp_fy[sp * 2];
           const float local_x = m_local_x[cx] + fx * m_x_pitch[cx];
@@ -376,7 +376,7 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
           hitsYVec.emplace_back(ltg[3] * local_x + ltg[4] * local_y + ltg[10]);
           //gz
           hitsZVec.emplace_back(ltg[6] * local_x + ltg[7] * local_y + ltg[11]);
-
+	  
           hitsIDVec.emplace_back(cid);
 	  if( storecluster){
 	    xFractions.push_back(fx);
@@ -398,14 +398,14 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
           const float fy = m_sp_fy[sp * 2 + 1];
           const float local_x = m_local_x[cx] + fx * m_x_pitch[cx];
           const float local_y = (cy + 0.5 + fy) * m_pixel_size;
-
+	  
           //gx
           hitsXVec.emplace_back(ltg[0] * local_x + ltg[1] * local_y + ltg[9]);
           //gy
           hitsYVec.emplace_back(ltg[3] * local_x + ltg[4] * local_y + ltg[10]);
           //gz
           hitsZVec.emplace_back(ltg[6] * local_x + ltg[7] * local_y + ltg[11]);
-
+	  
           hitsIDVec.emplace_back(cid);
 	  if( storecluster){
 	    xFractions.push_back(fx);
@@ -435,15 +435,15 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
     // clusters that span several super pixels.
     const unsigned int nidx = pixel_idx.size();
     for (unsigned int irc = 0; irc < nidx; ++irc) {
-
+      
       const uint32_t idx = pixel_idx[irc];
       const uint8_t pixel = buffer[idx];
       
       if (0 == pixel) continue;  // pixel is used in another cluster
-
+      
       // 8-way row scan optimized seeded flood fill from here.
       stack.clear();
-
+      
       // mark seed as used
       buffer[idx] = 0;
 
@@ -451,7 +451,7 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
       unsigned int x = 0;
       unsigned int y = 0;
       unsigned int n = 0;
-
+      
       // push seed on stack
       stack.push_back(idx);
 
@@ -461,8 +461,8 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
       //   to the cluster and push set pixels above and below
       //   on the stack (and delete both from the pixel buffer).
       while (!stack.empty()) {
-
-
+	
+	
         // pop pixel from stack and add it to cluster
         const uint32_t idx = stack.back();
         stack.pop_back();
@@ -471,7 +471,7 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
         x += col;
         y += row;
         ++n;
-
+	
         if (!m_trigger) {
           const uint32_t chip = col / CHIP_COLUMNS;
           LHCb::VPChannelID cid(sensor, chip, col % CHIP_COLUMNS, row);
@@ -493,7 +493,7 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
           buffer[d_idx] = 0;
           stack.push_back(d_idx);
         }
-
+	
         // scan row to the right
         for (unsigned int c = col + 1; c < VP::NSensorColumns; ++c) {
           const uint32_t nidx = (c << 8) | row;
@@ -570,7 +570,7 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
         // store target (3D point for tracking)
         const uint32_t chip = cx / CHIP_COLUMNS;
         LHCb::VPChannelID cid(sensor, chip, cx % CHIP_COLUMNS, cy);
-
+	
         const float local_x = m_local_x[cx] + fx * m_x_pitch[cx];
         const float local_y = (cy + 0.5 + fy) * m_pixel_size;
         //gx
@@ -579,7 +579,7 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
         hitsYVec.emplace_back(ltg[3] * local_x + ltg[4] * local_y + ltg[10]);
         //gz
         hitsZVec.emplace_back(ltg[6] * local_x + ltg[7] * local_y + ltg[11]);
-
+	
         hitsIDVec.emplace_back(cid);
       } else if (!m_trigger) {
         // Offline mode, store all 3D points
@@ -587,7 +587,7 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
         const unsigned int cy = y / n;
         const float fx = x / static_cast<float>(n) - cx;
         const float fy = y / static_cast<float>(n) - cy;
-
+	
         // store target (cluster and 3D point for tracking)
         const uint32_t chip = cx / CHIP_COLUMNS;
         LHCb::VPChannelID cid(sensor, chip, cx % CHIP_COLUMNS, cy);
@@ -602,13 +602,14 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
       }
     }  // loop over all potential seed pixels
     if(storecluster){
-      if(m_trigger){
-        storeTriggerClusters( modulehits[module], xFractions, yFractions, clusters );
-      }else{
-        storeOfflineClusters( modulehits[module], xFractions, yFractions, channelIDs, clusters );
+      if( m_trigger){ 
+	storeTriggerClusters( modulehits[module], xFractions, yFractions, clusters );
+      }else{ 
+	storeOfflineClusters( modulehits[module], xFractions, yFractions, channelIDs, clusters);
       }
     }
-  }    // loop over all banks
+  }    // loop over all banks  
+  
   return true;
 }
 
@@ -618,9 +619,8 @@ bool PrPixelHitManager::buildHitsFromRawBank( const LHCb::RawEvent& rawEvent,
 void PrPixelHitManager::storeOfflineClusters( PrPixelModuleHits& mhits, std::vector<float>& xFractions,
                                               std::vector<float>& yFractions,
                                               std::vector<std::vector<LHCb::VPChannelID>> channelIDs,
-                                              LHCb::VPLightClusters& clusters ) const
-{
-  info()<<"SHOULD NOT CALL THIS IF TRIGGERMODE ON"<<endmsg;
+                                              LHCb::VPLightClusters& clusters ) const{
+  //  info()<<"SHOULD NOT CALL THIS IF TRIGGERMODE ON"<<endmsg;
   auto& hitsXVec = mhits.getXVec();
   auto& hitsYVec = mhits.getYVec();
   auto& hitsZVec = mhits.getZVec();
@@ -628,7 +628,7 @@ void PrPixelHitManager::storeOfflineClusters( PrPixelModuleHits& mhits, std::vec
 
   const unsigned offset = hitsXVec.size() - xFractions.size();
   unsigned channel;
-  for ( size_t i = 0; i < xFractions.size(); ++i ) {
+  for ( size_t i = 0; i < xFractions.size(); ++i ){
     //const LHCb::VPChannelID cid {hitsIDVec[offset+i].vpID()};
     channel = hitsIDVec[offset+i].vpID().channelID();
     // It is possible that two clusters have the same centroid
@@ -650,13 +650,10 @@ void PrPixelHitManager::storeOfflineClusters( PrPixelModuleHits& mhits, std::vec
 void PrPixelHitManager::storeTriggerClusters( PrPixelModuleHits& mhits, std::vector<float>& xFractions,
                                               std::vector<float>& yFractions, LHCb::VPLightClusters& clusters ) const
 {
-  // std::cout<<"storing trigger clusters"<<std::endl;
-  // In trigger configuration, only  clusters for 3D points are created
   // that were handed to the pixel tracking. The list of contributing channel
   // IDs for each cluster is not available in this scenario. We will make one
   // entry in the list which is the centroid pixel channel ID. It is possible
   // that this refers to a pixel that has not fired. Hence reliable MC matching
-  // is not possible in trigger configuration.
   auto& hitsXVec = mhits.getXVec();
   auto& hitsYVec = mhits.getYVec();
   auto& hitsZVec = mhits.getZVec();
@@ -677,13 +674,21 @@ void PrPixelHitManager::storeTriggerClusters( PrPixelModuleHits& mhits, std::vec
       //warning() << "Duplicate VP channel ID in clustering (trigger): " << cid << endmsg;
       //continue;
     //}
-
     clusters.emplace( std::piecewise_construct, std::make_tuple(channel),
-                      std::forward_as_tuple( xFractions[i], yFractions[i], hitsXVec[offset + i], hitsYVec[offset + i],
-                                             hitsZVec[offset + i], channel ) );
+                      std::forward_as_tuple( xFractions[i], yFractions[i], hitsXVec[offset + i], hitsYVec[offset + i], hitsZVec[offset + i], channel ) );
   }
 }
 
+namespace {
+  template <std::size_t N>
+  struct GetN {
+    template <typename T>
+    auto operator()(T&& t) const ->
+      decltype(std::get<N>(std::forward<T>(t))) {
+      return std::get<N>(std::forward<T>(t));
+    }
+  };
+}
 //=========================================================================
 StatusCode PrPixelHitManager::process(const LHCb::RawEvent& rawEvent,
                                       std::vector<PrPixelModuleHits>& modulehits,
@@ -691,7 +696,7 @@ StatusCode PrPixelHitManager::process(const LHCb::RawEvent& rawEvent,
                                       bool storecluster) const {
 
   // Storage for extra hits that don't go into clusters for the tracking
-  if (!buildHitsFromRawBank(rawEvent, modulehits, clusters, storecluster)) {
+  if(!buildHitsFromRawBank(rawEvent, modulehits, clusters, storecluster)) {
     return Error("Cannot retrieve/decode raw bank.", StatusCode::SUCCESS);
   }
 
@@ -702,25 +707,32 @@ StatusCode PrPixelHitManager::process(const LHCb::RawEvent& rawEvent,
     //printf("%3.10g < %3.10g %i\n", std::get<0>( h1 ), std::get<0>( h2 ), (std::get<0>( h1 ) < std::get<0>( h2 )));
     //return std::get<0>( h1 ) < std::get<0>( h2 );
   //};
+  
   for( auto & mhits : modulehits){
     auto& hitsXVec = mhits.getXVec();
     auto& hitsYVec = mhits.getYVec();
     auto& hitsZVec = mhits.getZVec();
     auto& hitsIDVec = mhits.getIDVec();
-    
-    //for (size_t i =0 ; i<hitsXVec.size(); ++i) info() << format("x %3.10g y%3.10g ", hitsXVec[i] ,hitsYVec[i]) << endmsg;
-    
-    auto perm = sort_permutation( hitsXVec, []( const float& a, const float& b ) {
-	//printf( "%3.10g < %3.10g %i\n", a, b, ( a <b ) );
-	return a < b;
-      } );
+
+    /*auto perm = sort_permutation( hitsXVec, []( const float& a, const float& b ) {
+    //printf( "%3.10g < %3.10g %i\n", a, b, ( a <b ) );
+    return a < b;
+    } );
     apply_permutation_in_place(hitsXVec, perm);
     apply_permutation_in_place(hitsYVec, perm);
     apply_permutation_in_place(hitsZVec, perm);
-    apply_permutation_in_place(hitsIDVec, perm);
-    //auto zipped = view::zip(hitsXVec, hitsYVec, hitsZVec, hitsIDVec);
-    //ranges::sort(zipped, comp);
+    apply_permutation_in_place(hitsIDVec, perm);*/
+
+    // The range v3 sort leads to different results than the std::sort or std::stable_sort,
+    // as the sorting of items with identical key (X value here) may be different in the 3 cases.
+    // This ultimately will lead to slightly different tracks after reconstruction
+    auto zipped = view::zip(hitsXVec, hitsYVec, hitsZVec, hitsIDVec);
+    ranges::sort(zipped,  []( const float& a, const float& b ) {
+        return a < b;
+      }, GetN<0>{} );
     mhits.createIsUsedVec();
   }
+  
+  
   return StatusCode::SUCCESS;
 }
diff --git a/Pr/PrPixel/src/PrPixelHitManager.h b/Pr/PrPixel/src/PrPixelHitManager.h
index 5d79c024f091990f9d8550f683d57ddee6c9f7b3..4e003c6228b205c856f2276a4d4d2012ee110757 100644
--- a/Pr/PrPixel/src/PrPixelHitManager.h
+++ b/Pr/PrPixel/src/PrPixelHitManager.h
@@ -82,7 +82,7 @@ class PrPixelHitManager : public GaudiTool {
   StatusCode process(const LHCb::RawEvent& rawEvent,
                      std::vector<PrPixelModuleHits>& modulehits,
                      LHCb::VPLightClusters& clusters,
-                     bool storecluster) const;
+		     bool storecluster) const;
 
  private:
   /// Cache Super Pixel patterns for isolated Super Pixel clustering.
@@ -93,15 +93,16 @@ class PrPixelHitManager : public GaudiTool {
 
   /// Extract the hits form rawbanks
   bool buildHitsFromRawBank( const LHCb::RawEvent& rawEvent, std::vector<PrPixelModuleHits>& modulehits,
-                             LHCb::VPLightClusters& clusters, bool storecluster ) const;
+                             LHCb::VPLightClusters& clusters, bool storecluster ) const ;
 
   /// Store trigger clusters.
   void storeTriggerClusters( PrPixelModuleHits& mhits, std::vector<float>& xFractions,
-                             std::vector<float>& yFractions, LHCb::VPLightClusters& clusters ) const;
-
-  /// Store offline clusters.
-  void storeOfflineClusters( PrPixelModuleHits& mhits, std::vector<float>& xFractions, std::vector<float>& yFractions,
-                             std::vector<std::vector<LHCb::VPChannelID>> channelIDs, LHCb::VPLightClusters& clusters ) const;
+			     std::vector<float>& yFractions, LHCb::VPLightClusters& clusters ) const;
+  void storeOfflineClusters( PrPixelModuleHits& mhits, std::vector<float>& xFractions,
+			     std::vector<float>& yFractions,
+			     std::vector<std::vector<LHCb::VPChannelID>> channelIDs,
+			     LHCb::VPLightClusters& clusters ) const;
+    
 
 private:
 
diff --git a/Pr/PrPixel/src/PrPixelModuleHits.h b/Pr/PrPixel/src/PrPixelModuleHits.h
index d1a8cbf2ec5eea39ecef4fd85d1e6ff45f1cd178..436132919a976d630d7daf7e86f76a38846e24fa 100644
--- a/Pr/PrPixel/src/PrPixelModuleHits.h
+++ b/Pr/PrPixel/src/PrPixelModuleHits.h
@@ -23,8 +23,6 @@ namespace Pr
       //using aligned_vector = std::vector<T, AlignedAllocator<T, 64>>;
       using aligned_vector = std::vector<T>;
 
-
-
       //https://stackoverflow.com/questions/17074324/how-can-i-sort-two-vectors-in-the-same-way-with-criteria-that-uses-only-one-of/17074810#17074810
       template <typename T, typename Compare>
       std::vector<std::size_t> sort_permutation(
@@ -83,13 +81,15 @@ public:
   inline float getY(size_t idx) const noexcept { return m_hitsY[idx]; }
   inline float getZ(size_t idx) const noexcept { return m_hitsZ[idx]; }
   inline LHCb::LHCbID getID(size_t idx) const noexcept { return m_hitsID[idx]; }
+
   aligned_vector<float>& getXVec() { return m_hitsX; }
   aligned_vector<float>& getYVec() { return m_hitsY; }
   aligned_vector<float>& getZVec() { return m_hitsZ; }
   aligned_vector<LHCb::LHCbID>& getIDVec() { return m_hitsID; }
   boost::dynamic_bitset<>& getIsUsedVec() { return m_IsUsedVec; }
 
-  // Assume binary resolution of hit position. This is the weight.
+  // Assume binary resolution of hit position. 
+  // This is the weight. Same weights for x and y, can this be simplified ?
   static constexpr float wxerr() noexcept { return 62.98366573f ;}//std::sqrt( 12.0 ) / ( 0.055 ); }
   static constexpr float wyerr() noexcept { return 62.98366573f; }
   static constexpr float wx() noexcept { return wxerr() * wxerr(); }
diff --git a/Pr/PrPixel/src/PrPixelTracking.cpp b/Pr/PrPixel/src/PrPixelTracking.cpp
index 1d5b8a213dd3093ad07613754f5b0934429fa20b..95dfca8402c2df187af0d2068715f73c8c7cdcd1 100644
--- a/Pr/PrPixel/src/PrPixelTracking.cpp
+++ b/Pr/PrPixel/src/PrPixelTracking.cpp
@@ -123,7 +123,8 @@ std::tuple<std::vector<LHCb::Track>, LHCb::VPLightClusters> PrPixelTracking::ope
 // on both sides of the detector as soon as one hit is missed.
 //=============================================================================
 template< Conf configuration>
-void PrPixelTracking::extendTrack( std::vector<PrPixelModuleHits>& modulehits, std::array<size_t,71>& hitbuffer ) const{
+void PrPixelTracking::extendTrack( std::vector<PrPixelModuleHits>& modulehits, std::array<size_t,71>& hitbuffer ) const
+{
   
   //endmodule is the last module to process, 
   
@@ -165,9 +166,7 @@ void PrPixelTracking::extendTrack( std::vector<PrPixelModuleHits>& modulehits, s
       // Reset missed hit counter.
       nbMissed = 0;
       //// Update the pair of hits to be used for extrapolating.
-    } else {
-      
-      size_t h3; 
+    } else {      
       // No hits found.
       if ( step == 2 ){
         //info() << "miss but calling againg with: " << next + 1 << endmsg;
@@ -226,10 +225,12 @@ void PrPixelTracking::extendTrack( std::vector<PrPixelModuleHits>& modulehits, s
   }
   hitbuffer[0] = foundHits;
 }
+
+
 //=========================================================================
 //  Search starting with a pair of consecutive modules.
 //=========================================================================
-  void PrPixelTracking::searchByPair( std::vector<PrPixelModuleHits>& modulehits,
+void PrPixelTracking::searchByPair( std::vector<PrPixelModuleHits>& modulehits,
                                     std::vector<LHCb::Track>& outputTracks ) const
 {
   
@@ -335,6 +336,7 @@ void PrPixelTracking::doPairSearch( std::vector<PrPixelModuleHits>& modulehits,
     // Pick-up the "paired" module one station backwards
     const int sens1 = sens0 + step ;
     const float z1 = m_hitManager->module(sens1)->z();
+    
     //If you do forward  velo track search [Conf::Forward], don't even consider of building pairs with second module at less than z<m_ForwardTracks_minZ [mm]
     if( configuration == Conf::Forward){
       if( z1 < m_ForwardTracks_minZ ){
@@ -355,7 +357,6 @@ void PrPixelTracking::doPairSearch( std::vector<PrPixelModuleHits>& modulehits,
     const float z0 = m_hitManager->module(sens0)->z();
     const float dz = z0 - z1;
     const float invdz = 1./dz;
-
     // Calculate the search window from the slope limits.
     const float dxMax = m_maxXSlope * fabs(dz);
     const float dyMax = m_maxYSlope * fabs(dz);
@@ -418,6 +419,7 @@ void PrPixelTracking::doPairSearch( std::vector<PrPixelModuleHits>& modulehits,
 	  //info() << "=== Store 3 - track " << endmsg;
 	  continue;
 	}
+
 	unsigned unUsed = 0;
 	//Count number of used hits
 	for ( size_t idx = 1; idx < 1 + hitbuffer[0]; idx += 2 )
@@ -505,22 +507,16 @@ void PrPixelTracking::makeLHCbTracks( PrPixelTrack& track, const std::array<size
   newTrack.setType(LHCb::Track::Velo);
   newTrack.setHistory(LHCb::Track::PatFastVelo);
   newTrack.setPatRecStatus(LHCb::Track::PatRecIDs);
-
-  {
-    std::vector<LHCb::LHCbID> ids;
-    ids.reserve(hitbuffer[0]/2);
-    // Loop over the hits and add their LHCbIDs to the LHCb track.
-    for ( size_t idx = 1; idx < 1 + hitbuffer[0]; idx += 2 ){
-      //info() << "ID check: " << IDVec[idx].lhcbID() << endmsg;
-      ids.push_back(modulehits[hitbuffer[idx]].getID(hitbuffer[idx+1]));
-    }
-    // let's check that we are properly sorted and that the track was empty so far
-    std::sort(ids.begin(), ids.end());
-    assert(std::is_sorted(ids.begin(), ids.end()));
-    assert(newTrack.nLHCbIDs() == 0);
-    newTrack.setSortedLhcbIDs(std::move(ids));
+  std::vector<LHCb::LHCbID> ids;
+  ids.reserve(hitbuffer[0]/2);
+  // Loop over the hits and add their LHCbIDs to the LHCb track.
+  for ( size_t idx = 1; idx < 1 + hitbuffer[0]; idx += 2 ){
+    //info() << "ID check: " << IDVec[idx].lhcbID() << endmsg;
+    ids.push_back(modulehits[hitbuffer[idx]].getID(hitbuffer[idx+1]));
   }
-
+  std::sort(ids.begin(), ids.end());
+  newTrack.addSortedToLhcbIDs(std::move(ids));
+  
   // Decide if this is a forward or backward track.
   // Calculate z where the track passes closest to the beam.
   const float zBeam = track.zBeam();
@@ -577,6 +573,14 @@ void PrPixelTracking::makeLHCbTracks( PrPixelTrack& track, const std::array<size
     }
   }
 
+  // Add state at end of velo
+  if (!backward) {
+    state.setLocation(LHCb::State::EndVelo);
+    state.linearTransportTo(StateParameters::ZEndVelo);
+    newTrack.addToStates(state);
+  }
+
+
   // Add state at end of velo
   if (!backward) {
     state.setLocation(LHCb::State::EndVelo);
@@ -585,7 +589,7 @@ void PrPixelTracking::makeLHCbTracks( PrPixelTrack& track, const std::array<size
   }
 
   // Set the chi2/dof
-  newTrack.setNDoF(2 * (track.hitsX().size() - 2));
+  newTrack.setNDoF(hitbuffer[0] - 4);
   newTrack.setChi2PerDoF(track.chi2());
 }
 
diff --git a/Pr/PrVeloUT/src/PrTableForFunction.h b/Pr/PrVeloUT/src/PrTableForFunction.h
index 54410ec11fd31e6eb6e803b29084687171fe58c0..6cbc2a2699af8b357bf6bfb60a582683d19b0e5a 100755
--- a/Pr/PrVeloUT/src/PrTableForFunction.h
+++ b/Pr/PrVeloUT/src/PrTableForFunction.h
@@ -69,6 +69,13 @@ static const InterfaceID IID_PrTableForFunction ( "PrTableForFunction", 1, 0 );
     float getInterpolatedValueFromTable(std::vector<float>& var);
 
     void clear() ;
+
+    inline std::vector<float> returnTable(){
+      return m_table;
+    }
+    
+
+
   protected:
 
   private:
diff --git a/Pr/PrVeloUT/src/PrUTMagnetTool.cpp b/Pr/PrVeloUT/src/PrUTMagnetTool.cpp
index 5d4609f918387aea168e23fceeacbfcee5bf5a6e..4a86cf2c88ed3205a0b47cf34d75c161aadd922d 100755
--- a/Pr/PrVeloUT/src/PrUTMagnetTool.cpp
+++ b/Pr/PrVeloUT/src/PrUTMagnetTool.cpp
@@ -488,3 +488,16 @@ void PrUTMagnetTool::f_bdl( float slopeY, float zOrigin,
 
  }
 
+//=========================================================================
+//  return the DxTable
+//=========================================================================
+std::vector<float> PrUTMagnetTool::returnDxLayTable(){
+  return m_lutDxLay->returnTable();
+}
+
+//=========================================================================
+//  return the Bdl Table
+//=========================================================================
+std::vector<float> PrUTMagnetTool::returnBdlTable(){
+  return m_lutBdl->returnTable();
+}
diff --git a/Pr/PrVeloUT/src/PrUTMagnetTool.h b/Pr/PrVeloUT/src/PrUTMagnetTool.h
index 5493f391c05d7948ea4fe435d32dac9e294d3b45..8842c7a197b00ab5f2201a6eb8ced7200f2e03c2 100755
--- a/Pr/PrVeloUT/src/PrUTMagnetTool.h
+++ b/Pr/PrVeloUT/src/PrUTMagnetTool.h
@@ -56,7 +56,11 @@ public:
   void prepareBdlTables();
   void prepareDeflectionTables();
   StatusCode updateField() ;
+
+  std::vector<float> returnDxLayTable();
+  std::vector<float> returnBdlTable();
   
+
 protected:
   void f_bdl(float slopeY, float zOrigin , float zStart, float zStop);
   
diff --git a/Rec/ChargedProtoANNPID/src/ChargedProtoANNPIDAlg.h b/Rec/ChargedProtoANNPID/src/ChargedProtoANNPIDAlg.h
index 9e5500cd4c2f49c71894feb57dbed648950b5740..651a74cdb818d355e0b529681cf2196951196ab8 100644
--- a/Rec/ChargedProtoANNPID/src/ChargedProtoANNPIDAlg.h
+++ b/Rec/ChargedProtoANNPID/src/ChargedProtoANNPIDAlg.h
@@ -76,10 +76,10 @@ namespace ANNGlobalPID
     std::unique_ptr<NetConfig> m_netConfig;
 
     /// The extra info to fill on the ProtoParticle
-    LHCb::ProtoParticle::additionalInfo m_protoInfo = LHCb::ProtoParticle::NoPID;
+    LHCb::ProtoParticle::additionalInfo m_protoInfo = LHCb::ProtoParticle::additionalInfo::NoPID;
 
     /// The track type for this instance
-    LHCb::Track::Types m_tkType = LHCb::Track::TypeUnknown;
+    LHCb::Track::Types m_tkType = LHCb::Track::Types::TypeUnknown;
 
   };
 
diff --git a/Rec/ChargedProtoANNPID/src/ChargedProtoANNPIDCommonBase.h b/Rec/ChargedProtoANNPID/src/ChargedProtoANNPIDCommonBase.h
index f3e4d757f1f9e96fe70349e6e146899710c30f5d..02ca558fa4637bb779405f9b9624bc0df620cd03 100644
--- a/Rec/ChargedProtoANNPID/src/ChargedProtoANNPIDCommonBase.h
+++ b/Rec/ChargedProtoANNPID/src/ChargedProtoANNPIDCommonBase.h
@@ -172,7 +172,7 @@ namespace ANNGlobalPID
                      const double def = -999 )
         : m_info(info), m_def(def) { }
     private:
-      const LHCb::Track::AdditionalInfo m_info = LHCb::Track::AdditionalInfoUnknown;
+      const LHCb::Track::AdditionalInfo m_info = LHCb::Track::AdditionalInfo::AdditionalInfoUnknown;
       const double m_def{-999};
     public:
       virtual double value( const LHCb::ProtoParticle * proto ) const override
@@ -233,7 +233,7 @@ namespace ANNGlobalPID
     public:
       virtual double value( const LHCb::ProtoParticle * proto ) const override
       {
-        const auto var = proto->track()->info(LHCb::Track::CloneDist,-999);
+        const auto var = proto->track()->info(LHCb::Track::AdditionalInfo::CloneDist,-999);
         return ( var >= 0 ? var : -999 );
       }
     };
@@ -384,7 +384,7 @@ namespace ANNGlobalPID
     public:
       virtual double value( const LHCb::ProtoParticle * proto ) const override
       {
-        return proto->info(LHCb::ProtoParticle::MuonNShared,-1.0) + 1.0;
+        return proto->info(LHCb::ProtoParticle::additionalInfo::MuonNShared,-1.0) + 1.0;
       }
     };
 
@@ -458,7 +458,7 @@ namespace ANNGlobalPID
     public:
       virtual double value( const LHCb::ProtoParticle * proto ) const override
       {
-        auto var = proto->info(LHCb::ProtoParticle::CaloEcalChi2,-999);
+        auto var = proto->info(LHCb::ProtoParticle::additionalInfo::CaloEcalChi2,-999);
         if      ( var < -100    ) { var = -999; }
         else if ( var > 9999.99 ) { var = -999; }
         return var;
@@ -471,7 +471,7 @@ namespace ANNGlobalPID
     public:
       virtual double value( const LHCb::ProtoParticle * proto ) const override
       {
-        auto var = proto->info(LHCb::ProtoParticle::CaloBremChi2,-999);
+        auto var = proto->info(LHCb::ProtoParticle::additionalInfo::CaloBremChi2,-999);
         if      ( var < -100    ) { var = -999; }
         else if ( var > 9999.99 ) { var = -999; }
         return var;
@@ -484,7 +484,7 @@ namespace ANNGlobalPID
     public:
       virtual double value( const LHCb::ProtoParticle * proto ) const override
       {
-        auto var = proto->info(LHCb::ProtoParticle::CaloClusChi2,-999);
+        auto var = proto->info(LHCb::ProtoParticle::additionalInfo::CaloClusChi2,-999);
         if      ( var < -100   ) { var = -999; }
         else if ( var > 999.99 ) { var = -999; }
         return var;
@@ -724,7 +724,7 @@ namespace ANNGlobalPID
 
     /** @class yPIDImpANN ChargedProtoANNPIDCommonBase.h
      *
-     *  Helper class for all yPID solutions. Only C++ available.  
+     *  Helper class for all yPID solutions. Only C++ available.
      *  Implementation follows
      *  @author Chris Jones
      *  @date   2013-03-09
diff --git a/Rec/GlobalReco/src/ChargedProtoParticleTupleAlg.cpp b/Rec/GlobalReco/src/ChargedProtoParticleTupleAlg.cpp
index 8d4774822493eb2cb027d1ed927e25231a1cd65d..6eac0620e4b91fa42aac9e3ce7b86bfaa972742c 100755
--- a/Rec/GlobalReco/src/ChargedProtoParticleTupleAlg.cpp
+++ b/Rec/GlobalReco/src/ChargedProtoParticleTupleAlg.cpp
@@ -48,7 +48,7 @@ StatusCode ChargedProtoParticleTupleAlg::initialize()
   if ( sc.isFailure() ) return sc;
 
   // get tools
-  m_truth = tool<Rich::MC::IMCTruthTool>( "Rich::MC::MCTruthTool", 
+  m_truth = tool<Rich::MC::IMCTruthTool>( "Rich::MC::MCTruthTool",
                                           "MCTruth", this );
 
   return sc;
@@ -61,8 +61,8 @@ StatusCode ChargedProtoParticleTupleAlg::execute()
 {
   // Load the charged ProtoParticles
   const auto * protos = getIfExists<LHCb::ProtoParticles>( m_protoPath );
-  if ( !protos ) 
-    return Warning( "No ProtoParticles at '" + m_protoPath + "'", 
+  if ( !protos )
+    return Warning( "No ProtoParticles at '" + m_protoPath + "'",
                     StatusCode::SUCCESS );
 
   // Loop over the protos
@@ -90,18 +90,18 @@ StatusCode ChargedProtoParticleTupleAlg::execute()
     sc = sc && tuple->column( "TrackHistory",    track->history() );
     sc = sc && tuple->column( "TrackGhostProb",  track->ghostProbability() );
     sc = sc && tuple->column( "TrackLikelihood", track->likelihood() );
-    sc = sc && tuple->column( "TrackCloneDist",  track->info(LHCb::Track::CloneDist,9e10) );
+    sc = sc && tuple->column( "TrackCloneDist",  track->info(LHCb::Track::AdditionalInfo::CloneDist,9e10) );
 
     // rich
     static LHCb::RichPID tmpRPID;
-    tmpRPID.setPidResultCode( static_cast<int>(proto->info(LHCb::ProtoParticle::RichPIDStatus,0)) );
-    sc = sc && tuple->column( "RichDLLe",      proto->info ( LHCb::ProtoParticle::RichDLLe,  0 ) );
-    sc = sc && tuple->column( "RichDLLmu",     proto->info ( LHCb::ProtoParticle::RichDLLmu, 0 ) );
-    sc = sc && tuple->column( "RichDLLpi",     proto->info ( LHCb::ProtoParticle::RichDLLpi, 0 ) );
-    sc = sc && tuple->column( "RichDLLk",      proto->info ( LHCb::ProtoParticle::RichDLLk,  0 ) );
-    sc = sc && tuple->column( "RichDLLp",      proto->info ( LHCb::ProtoParticle::RichDLLp,  0 ) );
-    sc = sc && tuple->column( "RichDLLd",      proto->info ( LHCb::ProtoParticle::RichDLLd,  0 ) );
-    sc = sc && tuple->column( "RichDLLbt",     proto->info ( LHCb::ProtoParticle::RichDLLbt, 0 ) );
+    tmpRPID.setPidResultCode( static_cast<int>(proto->info(LHCb::ProtoParticle::additionalInfo::RichPIDStatus,0)) );
+    sc = sc && tuple->column( "RichDLLe",      proto->info ( LHCb::ProtoParticle::additionalInfo::RichDLLe,  0 ) );
+    sc = sc && tuple->column( "RichDLLmu",     proto->info ( LHCb::ProtoParticle::additionalInfo::RichDLLmu, 0 ) );
+    sc = sc && tuple->column( "RichDLLpi",     proto->info ( LHCb::ProtoParticle::additionalInfo::RichDLLpi, 0 ) );
+    sc = sc && tuple->column( "RichDLLk",      proto->info ( LHCb::ProtoParticle::additionalInfo::RichDLLk,  0 ) );
+    sc = sc && tuple->column( "RichDLLp",      proto->info ( LHCb::ProtoParticle::additionalInfo::RichDLLp,  0 ) );
+    sc = sc && tuple->column( "RichDLLd",      proto->info ( LHCb::ProtoParticle::additionalInfo::RichDLLd,  0 ) );
+    sc = sc && tuple->column( "RichDLLbt",     proto->info ( LHCb::ProtoParticle::additionalInfo::RichDLLbt, 0 ) );
     sc = sc && tuple->column( "RichUsedAero",     tmpRPID.usedAerogel()  );
     sc = sc && tuple->column( "RichUsedR1Gas",    tmpRPID.usedRich1Gas() );
     sc = sc && tuple->column( "RichUsedR2Gas",    tmpRPID.usedRich2Gas() );
@@ -115,59 +115,59 @@ StatusCode ChargedProtoParticleTupleAlg::execute()
 
     // muon
     static LHCb::MuonPID tmpMPID;
-    tmpMPID.setStatus( static_cast<int>(proto->info(LHCb::ProtoParticle::MuonPIDStatus,0)) );
-    sc = sc && tuple->column( "MuonBkgLL",    proto->info ( LHCb::ProtoParticle::MuonBkgLL, 0 ) );
-    sc = sc && tuple->column( "MuonMuLL",     proto->info ( LHCb::ProtoParticle::MuonMuLL,  0 ) );
-    sc = sc && tuple->column( "MuonNShared",  proto->info ( LHCb::ProtoParticle::MuonNShared, 0 ) );
+    tmpMPID.setStatus( static_cast<int>(proto->info(LHCb::ProtoParticle::additionalInfo::MuonPIDStatus,0)) );
+    sc = sc && tuple->column( "MuonBkgLL",    proto->info ( LHCb::ProtoParticle::additionalInfo::MuonBkgLL, 0 ) );
+    sc = sc && tuple->column( "MuonMuLL",     proto->info ( LHCb::ProtoParticle::additionalInfo::MuonMuLL,  0 ) );
+    sc = sc && tuple->column( "MuonNShared",  proto->info ( LHCb::ProtoParticle::additionalInfo::MuonNShared, 0 ) );
     sc = sc && tuple->column( "MuonIsLooseMuon", tmpMPID.IsMuonLoose() );
     sc = sc && tuple->column( "MuonIsMuon",      tmpMPID.IsMuon() );
-    sc = sc && tuple->column( "MuonInAcc",  proto->info ( LHCb::ProtoParticle::InAccMuon, false ) );
+    sc = sc && tuple->column( "MuonInAcc",  proto->info ( LHCb::ProtoParticle::additionalInfo::InAccMuon, false ) );
 
     // calo
-    sc = sc && tuple->column( "InAccSpd",   proto->info ( LHCb::ProtoParticle::InAccSpd,  false ) );
-    sc = sc && tuple->column( "InAccPrs",   proto->info ( LHCb::ProtoParticle::InAccPrs,  false ) );
-    sc = sc && tuple->column( "InAccEcal",  proto->info ( LHCb::ProtoParticle::InAccEcal, false ) );
-    sc = sc && tuple->column( "InAccHcal",  proto->info ( LHCb::ProtoParticle::InAccHcal, false ) );
-    sc = sc && tuple->column( "InAccBrem",  proto->info ( LHCb::ProtoParticle::InAccBrem, false ) );
-    sc = sc && tuple->column( "CaloTrMatch",       proto->info ( LHCb::ProtoParticle::CaloTrMatch, 0 ) );
-    sc = sc && tuple->column( "CaloElectronMatch", proto->info ( LHCb::ProtoParticle::CaloElectronMatch, 0 ) );
-    sc = sc && tuple->column( "CaloBremMatch",     proto->info ( LHCb::ProtoParticle::CaloBremMatch, 0 ) );
-    sc = sc && tuple->column( "CaloChargedSpd",    proto->info ( LHCb::ProtoParticle::CaloChargedSpd, 0 ) );
-    sc = sc && tuple->column( "CaloChargedPrs",    proto->info ( LHCb::ProtoParticle::CaloChargedPrs, 0 ) );
-    sc = sc && tuple->column( "CaloChargedEcal",   proto->info ( LHCb::ProtoParticle::CaloChargedEcal, 0 ) );
-    sc = sc && tuple->column( "CaloSpdE",   proto->info ( LHCb::ProtoParticle::CaloSpdE,   0 ) );
-    sc = sc && tuple->column( "CaloPrsE",   proto->info ( LHCb::ProtoParticle::CaloPrsE,   0 ) );
-    sc = sc && tuple->column( "CaloEcalChi2", proto->info ( LHCb::ProtoParticle::CaloEcalChi2, 0 ) );
-    sc = sc && tuple->column( "CaloClusChi2", proto->info ( LHCb::ProtoParticle::CaloClusChi2, 0 ) );
-    sc = sc && tuple->column( "CaloBremChi2", proto->info ( LHCb::ProtoParticle::CaloBremChi2, 0 ) );
-    sc = sc && tuple->column( "CaloPrsE",   proto->info ( LHCb::ProtoParticle::CaloPrsE,   0 ) );
-    sc = sc && tuple->column( "CaloEcalE",  proto->info ( LHCb::ProtoParticle::CaloEcalE,  0 ) );
-    sc = sc && tuple->column( "CaloHcalE",  proto->info ( LHCb::ProtoParticle::CaloHcalE,  0 ) );
-    sc = sc && tuple->column( "CaloTrajectoryL", proto->info ( LHCb::ProtoParticle::CaloTrajectoryL, 0 ) );
-    sc = sc && tuple->column( "EcalPIDe",   proto->info ( LHCb::ProtoParticle::EcalPIDe,  0 ) );
-    sc = sc && tuple->column( "HcalPIDe",   proto->info ( LHCb::ProtoParticle::HcalPIDe,  0 ) );
-    sc = sc && tuple->column( "PrsPIDe",    proto->info ( LHCb::ProtoParticle::PrsPIDe,   0 ) );
-    sc = sc && tuple->column( "BremPIDe",   proto->info ( LHCb::ProtoParticle::BremPIDe,  0 ) );
-    sc = sc && tuple->column( "EcalPIDmu",  proto->info ( LHCb::ProtoParticle::EcalPIDmu, 0 ) );
-    sc = sc && tuple->column( "HcalPIDmu",  proto->info ( LHCb::ProtoParticle::HcalPIDmu, 0 ) );
+    sc = sc && tuple->column( "InAccSpd",   proto->info ( LHCb::ProtoParticle::additionalInfo::InAccSpd,  false ) );
+    sc = sc && tuple->column( "InAccPrs",   proto->info ( LHCb::ProtoParticle::additionalInfo::InAccPrs,  false ) );
+    sc = sc && tuple->column( "InAccEcal",  proto->info ( LHCb::ProtoParticle::additionalInfo::InAccEcal, false ) );
+    sc = sc && tuple->column( "InAccHcal",  proto->info ( LHCb::ProtoParticle::additionalInfo::InAccHcal, false ) );
+    sc = sc && tuple->column( "InAccBrem",  proto->info ( LHCb::ProtoParticle::additionalInfo::InAccBrem, false ) );
+    sc = sc && tuple->column( "CaloTrMatch",       proto->info ( LHCb::ProtoParticle::additionalInfo::CaloTrMatch, 0 ) );
+    sc = sc && tuple->column( "CaloElectronMatch", proto->info ( LHCb::ProtoParticle::additionalInfo::CaloElectronMatch, 0 ) );
+    sc = sc && tuple->column( "CaloBremMatch",     proto->info ( LHCb::ProtoParticle::additionalInfo::CaloBremMatch, 0 ) );
+    sc = sc && tuple->column( "CaloChargedSpd",    proto->info ( LHCb::ProtoParticle::additionalInfo::CaloChargedSpd, 0 ) );
+    sc = sc && tuple->column( "CaloChargedPrs",    proto->info ( LHCb::ProtoParticle::additionalInfo::CaloChargedPrs, 0 ) );
+    sc = sc && tuple->column( "CaloChargedEcal",   proto->info ( LHCb::ProtoParticle::additionalInfo::CaloChargedEcal, 0 ) );
+    sc = sc && tuple->column( "CaloSpdE",   proto->info ( LHCb::ProtoParticle::additionalInfo::CaloSpdE,   0 ) );
+    sc = sc && tuple->column( "CaloPrsE",   proto->info ( LHCb::ProtoParticle::additionalInfo::CaloPrsE,   0 ) );
+    sc = sc && tuple->column( "CaloEcalChi2", proto->info ( LHCb::ProtoParticle::additionalInfo::CaloEcalChi2, 0 ) );
+    sc = sc && tuple->column( "CaloClusChi2", proto->info ( LHCb::ProtoParticle::additionalInfo::CaloClusChi2, 0 ) );
+    sc = sc && tuple->column( "CaloBremChi2", proto->info ( LHCb::ProtoParticle::additionalInfo::CaloBremChi2, 0 ) );
+    sc = sc && tuple->column( "CaloPrsE",   proto->info ( LHCb::ProtoParticle::additionalInfo::CaloPrsE,   0 ) );
+    sc = sc && tuple->column( "CaloEcalE",  proto->info ( LHCb::ProtoParticle::additionalInfo::CaloEcalE,  0 ) );
+    sc = sc && tuple->column( "CaloHcalE",  proto->info ( LHCb::ProtoParticle::additionalInfo::CaloHcalE,  0 ) );
+    sc = sc && tuple->column( "CaloTrajectoryL", proto->info ( LHCb::ProtoParticle::additionalInfo::CaloTrajectoryL, 0 ) );
+    sc = sc && tuple->column( "EcalPIDe",   proto->info ( LHCb::ProtoParticle::additionalInfo::EcalPIDe,  0 ) );
+    sc = sc && tuple->column( "HcalPIDe",   proto->info ( LHCb::ProtoParticle::additionalInfo::HcalPIDe,  0 ) );
+    sc = sc && tuple->column( "PrsPIDe",    proto->info ( LHCb::ProtoParticle::additionalInfo::PrsPIDe,   0 ) );
+    sc = sc && tuple->column( "BremPIDe",   proto->info ( LHCb::ProtoParticle::additionalInfo::BremPIDe,  0 ) );
+    sc = sc && tuple->column( "EcalPIDmu",  proto->info ( LHCb::ProtoParticle::additionalInfo::EcalPIDmu, 0 ) );
+    sc = sc && tuple->column( "HcalPIDmu",  proto->info ( LHCb::ProtoParticle::additionalInfo::HcalPIDmu, 0 ) );
 
     // combined DLLs
-    sc = sc && tuple->column( "CombDLLe",   proto->info ( LHCb::ProtoParticle::CombDLLe,  0 ) );
-    sc = sc && tuple->column( "CombDLLmu",  proto->info ( LHCb::ProtoParticle::CombDLLmu, 0 ) );
-    sc = sc && tuple->column( "CombDLLpi",  proto->info ( LHCb::ProtoParticle::CombDLLpi, 0 ) );
-    sc = sc && tuple->column( "CombDLLk",   proto->info ( LHCb::ProtoParticle::CombDLLk,  0 ) );
-    sc = sc && tuple->column( "CombDLLp",   proto->info ( LHCb::ProtoParticle::CombDLLp,  0 ) );
+    sc = sc && tuple->column( "CombDLLe",   proto->info ( LHCb::ProtoParticle::additionalInfo::CombDLLe,  0 ) );
+    sc = sc && tuple->column( "CombDLLmu",  proto->info ( LHCb::ProtoParticle::additionalInfo::CombDLLmu, 0 ) );
+    sc = sc && tuple->column( "CombDLLpi",  proto->info ( LHCb::ProtoParticle::additionalInfo::CombDLLpi, 0 ) );
+    sc = sc && tuple->column( "CombDLLk",   proto->info ( LHCb::ProtoParticle::additionalInfo::CombDLLk,  0 ) );
+    sc = sc && tuple->column( "CombDLLp",   proto->info ( LHCb::ProtoParticle::additionalInfo::CombDLLp,  0 ) );
 
     // ANN PID Probabilities
-    sc = sc && tuple->column( "ProbNNe",     proto->info ( LHCb::ProtoParticle::ProbNNe,  -1 ) );
-    sc = sc && tuple->column( "ProbNNmu",    proto->info ( LHCb::ProtoParticle::ProbNNmu, -1 ) );
-    sc = sc && tuple->column( "ProbNNpi",    proto->info ( LHCb::ProtoParticle::ProbNNpi, -1 ) );
-    sc = sc && tuple->column( "ProbNNk",     proto->info ( LHCb::ProtoParticle::ProbNNk,  -1 ) );
-    sc = sc && tuple->column( "ProbNNp",     proto->info ( LHCb::ProtoParticle::ProbNNp,  -1 ) );
-    sc = sc && tuple->column( "ProbNNghost", proto->info ( LHCb::ProtoParticle::ProbNNghost, -1 ) );
+    sc = sc && tuple->column( "ProbNNe",     proto->info ( LHCb::ProtoParticle::additionalInfo::ProbNNe,  -1 ) );
+    sc = sc && tuple->column( "ProbNNmu",    proto->info ( LHCb::ProtoParticle::additionalInfo::ProbNNmu, -1 ) );
+    sc = sc && tuple->column( "ProbNNpi",    proto->info ( LHCb::ProtoParticle::additionalInfo::ProbNNpi, -1 ) );
+    sc = sc && tuple->column( "ProbNNk",     proto->info ( LHCb::ProtoParticle::additionalInfo::ProbNNk,  -1 ) );
+    sc = sc && tuple->column( "ProbNNp",     proto->info ( LHCb::ProtoParticle::additionalInfo::ProbNNp,  -1 ) );
+    sc = sc && tuple->column( "ProbNNghost", proto->info ( LHCb::ProtoParticle::additionalInfo::ProbNNghost, -1 ) );
 
     // VeloCharge
-    sc = sc && tuple->column( "VeloCharge", proto->info ( LHCb::ProtoParticle::VeloCharge, 0 ) );
+    sc = sc && tuple->column( "VeloCharge", proto->info ( LHCb::ProtoParticle::additionalInfo::VeloCharge, 0 ) );
 
     // MCParticle information
     const auto * mcPart = m_truth->mcParticle( track );
diff --git a/Rec/LoKiTrack/LoKi/Track.h b/Rec/LoKiTrack/LoKi/Track.h
index f34a16742dd37eb26745652f86e2c8910f882c66..7fca59792af6b42c975ecef656811f906f2d9911 100644
--- a/Rec/LoKiTrack/LoKi/Track.h
+++ b/Rec/LoKiTrack/LoKi/Track.h
@@ -627,7 +627,7 @@ namespace LoKi
       // ======================================================================
       /// constructor with the state indicator
       StateZ
-      ( const LHCb::State::Location location = LHCb::State::FirstMeasurement ) ;
+      ( const LHCb::State::Location location = LHCb::State::Location::FirstMeasurement ) ;
       /// constructor with the state indicator & bad value
       StateZ ( const LHCb::State::Location location ,
                const double       bad      ) ;
diff --git a/Rec/LoKiTrack/LoKi/TrackCuts.h b/Rec/LoKiTrack/LoKi/TrackCuts.h
index be2c6a51c8d297ba76cd6f937b2be316aebf34a7..432f6f2fd12df583c3b59a223fd4a31edcba4f5e 100644
--- a/Rec/LoKiTrack/LoKi/TrackCuts.h
+++ b/Rec/LoKiTrack/LoKi/TrackCuts.h
@@ -241,7 +241,7 @@ namespace LoKi
      *  @code
      *
      *  const LHCb::Track& t = ... ;
-     *  TrCut hasAtTT = TeHASSTATE ( LHCb::State::AtTT ) ;
+     *  TrCut hasAtTT = TeHASSTATE ( LHCb::State::Location::AtTT ) ;
      *
      *  const bool good = hasAtTT ( p ) ;
      *
@@ -1093,7 +1093,7 @@ namespace LoKi
      *  simple evaluator for Z-position of the certain state
      *  @code
      *
-     *  const TrSTATEZ fun = TrSTATEZ ( LHCb::State::FirstMeasurement ) ;
+     *  const TrSTATEZ fun = TrSTATEZ ( LHCb::State::Location::FirstMeasurement ) ;
      *  const LHCb::Track&t = ... ;
      *
      *  const double value =  fun ( t ) ;
@@ -1124,7 +1124,7 @@ namespace LoKi
      *  @author Vanya Belyaev Ivan.Belyaev@nikhef.nl
      *  @date 2010-06-02
      */
-    const LoKi::Track::StateZ TrFIRSTHITZ { LHCb::State::FirstMeasurement } ;
+    const LoKi::Track::StateZ TrFIRSTHITZ { LHCb::State::Location::FirstMeasurement } ;
     // ========================================================================
     /** @typedef TrCOV2
      *  Get the element of track covariance matrix
@@ -1135,7 +1135,7 @@ namespace LoKi
      *    const TrCOV2 covXX_1 = TrCOV2( 0 , 0  ) ;
      *
      *    // use the specific state:
-     *    const TrCOV2 covXX_2 = TrCOV2(  LHCb::State::AtTT  , 0 , 0  ) ;
+     *    const TrCOV2 covXX_2 = TrCOV2(  LHCb::State::Location::AtTT  , 0 , 0  ) ;
      *
      *    // use the state,closest to some z :
      *    const double z = ... ;
diff --git a/Rec/LoKiTrack/src/Track.cpp b/Rec/LoKiTrack/src/Track.cpp
index 8a125687f8316f37aa1f1300965fee75e3fb6e0e..fdb87e18f7ce9fc7f51f0b4733ee3132d7a71c24 100644
--- a/Rec/LoKiTrack/src/Track.cpp
+++ b/Rec/LoKiTrack/src/Track.cpp
@@ -385,7 +385,7 @@ std::ostream& LoKi::Track::StateZ::fillStream ( std::ostream& s ) const
 {
   switch ( m_state )
   {
-  case LHCb::State::FirstMeasurement :
+  case LHCb::State::Location::FirstMeasurement :
     return s << " TrFIRSTHITZ " ;
   default :
     break ;
@@ -525,7 +525,7 @@ LoKi::Track::Cov2::Cov2
   , LoKi::BasicFunctors<const LHCb::Track*>::Function()
   , m_case ( _First                        )
   , m_z    ( -1 * Gaudi::Units::km         )
-  , m_loc  ( LHCb::State::FirstMeasurement )
+  , m_loc  ( LHCb::State::Location::FirstMeasurement )
   , m_i    ( i )
   , m_j    ( j )
 {
@@ -559,7 +559,7 @@ LoKi::Track::Cov2::Cov2
   , LoKi::BasicFunctors<const LHCb::Track*>::Function()
   , m_case ( _Z   )
   , m_z    (  z   )
-  , m_loc  ( LHCb::State::FirstMeasurement )
+  , m_loc  ( LHCb::State::Location::FirstMeasurement )
   , m_i    ( i )
   , m_j    ( j )
 {
diff --git a/Rec/RecAlgs/src/RecSummaryAlg.cpp b/Rec/RecAlgs/src/RecSummaryAlg.cpp
index 56b958a470c04f69d2f7df5e07bd728f1f20c373..63d32e0d8613da42ea08198e7f73131717100f5a 100644
--- a/Rec/RecAlgs/src/RecSummaryAlg.cpp
+++ b/Rec/RecAlgs/src/RecSummaryAlg.cpp
@@ -175,7 +175,7 @@ StatusCode RecSummaryAlg::execute()
     //Upgrade detectors
     else if ( "VP" == det )
     {
-      addSizeSummary<LHCb::VPClusters>( summary, LHCb::RecSummary::nVeloClusters, m_vpLoc );
+      addSizeSummary<LHCb::VPLightClusters>( summary, LHCb::RecSummary::nVeloClusters, m_vpLoc );
     }
     else if ( "UT" == det )
     {
diff --git a/Rec/RecAlgs/src/RecSummaryAlg.h b/Rec/RecAlgs/src/RecSummaryAlg.h
index 52bc06648d3fe1e4253c9bf1f9936a237bbdbd9f..946224bc00af77a5cb25781290a0259b4d645f21 100644
--- a/Rec/RecAlgs/src/RecSummaryAlg.h
+++ b/Rec/RecAlgs/src/RecSummaryAlg.h
@@ -18,7 +18,7 @@
 #include "Event/STLiteCluster.h"
 #include "Event/VeloCluster.h"
 #include "Event/VeloLiteCluster.h"
-#include "Event/VPCluster.h"
+#include "Event/VPLightCluster.h"
 #include "Event/FTLiteCluster.h"
 #include "Event/CaloDigit.h"
 #include "Event/MuonCoord.h"
@@ -153,7 +153,7 @@ class RecSummaryAlg final : public GaudiAlgorithm
   Gaudi::Property<std::string> m_veloLoc { this,  "VeloClustersLocation", LHCb::VeloClusterLocation::Default };
 
   /// TES location of VP clusters
-  Gaudi::Property<std::string> m_vpLoc { this,  "VPClustersLocation", LHCb::VPClusterLocation::Default };
+  Gaudi::Property<std::string> m_vpLoc { this,  "VPClustersLocation", LHCb::VPClusterLocation::Light };
 
   /// TES location of IT clusters
   Gaudi::Property<std::string> m_itLoc { this,  "ITClustersLocation", LHCb::STClusterLocation::ITClusters };
diff --git a/Rich/RichFutureGlobalPID/src/RichGlobalPIDWriteRichPIDs.cpp b/Rich/RichFutureGlobalPID/src/RichGlobalPIDWriteRichPIDs.cpp
index e6777d7a882cc047985d24185f7c88fd42e15f6a..0bcafcf90dcee9e21df8f000016ce747a30d9394 100644
--- a/Rich/RichFutureGlobalPID/src/RichGlobalPIDWriteRichPIDs.cpp
+++ b/Rich/RichFutureGlobalPID/src/RichGlobalPIDWriteRichPIDs.cpp
@@ -104,9 +104,9 @@ WriteRichPIDs::operator()( const InTracks& tracks,
     // -------------------------------------------------------------------------------
     // Final checks
     // -------------------------------------------------------------------------------
-    if ( !pid->isAboveThreshold(activeParticles().front()) )
+    if ( !pid->isAboveThreshold(lightestActiveHypo()) )
     {
-      warning() << "Lowest active mass hypothesis '" << activeParticles().front() 
+      warning() << "Lowest active mass hypothesis '" << lightestActiveHypo() 
                 << "' is below threshold ..." << endmsg;
       warning() << *pid << endmsg;
     }
diff --git a/Rich/RichFutureRecAlgorithms/src/RichSIMDRecoSummary.cpp b/Rich/RichFutureRecAlgorithms/src/RichSIMDRecoSummary.cpp
index 0256f29f1e242178a64f70f1e57360c5f1956810..44063c01d48e043e04baab092a1bd52d8a8e1ddf 100644
--- a/Rich/RichFutureRecAlgorithms/src/RichSIMDRecoSummary.cpp
+++ b/Rich/RichFutureRecAlgorithms/src/RichSIMDRecoSummary.cpp
@@ -73,8 +73,8 @@ SIMDRecoSummary::operator()( const LHCb::RichTrackSegment::Vector& segments,
       if ( !tkrel.segmentIndices.empty() )
       {
         
-        // Loop over mass hypos
-        for ( const auto hypo : activeParticles() )
+        // Loop over (real) mass hypos
+        for ( const auto hypo : activeParticlesNoBT() )
         {
           
           // threshold flag for this hypo, checking all segments
@@ -142,8 +142,8 @@ SIMDRecoSummary::operator()( const LHCb::RichTrackSegment::Vector& segments,
               // Get the pixel signals for this photon
               const auto & sigs = expPhotSigs[iPhot];
               // Check photon has a decent signal prob
-              if ( std::any_of( activeParticles().begin(),
-                                activeParticles().end(),
+              if ( std::any_of( activeParticlesNoBT().begin(),
+                                activeParticlesNoBT().end(),
                                 [&sigs]( const auto id )
                                 { return any_of( sigs[id] > SIMDFP::Zero() ); } ) )
               {
diff --git a/Rich/RichFutureRecBase/RichFutureRecBase/RichRecBase.h b/Rich/RichFutureRecBase/RichFutureRecBase/RichRecBase.h
index e732e705cca2f813bb82f0ab0eaf0fdce97717ae..41eda77a9fd63c2a3806575d52ca9a15e2dd130f 100644
--- a/Rich/RichFutureRecBase/RichFutureRecBase/RichRecBase.h
+++ b/Rich/RichFutureRecBase/RichFutureRecBase/RichRecBase.h
@@ -65,10 +65,14 @@ namespace Rich
         inline const IParticleProperties * richPartProps() const noexcept 
         { return m_richPartProp.get(); }
 
-        /// Access the list of active Particle ID types to consider
+        /// Access the list of all active Particle ID types to consider (including below threshold)
         inline const Rich::Particles& activeParticles() const noexcept 
         { return m_pidTypes; }
 
+        /// Access the list of active Particle ID types to consider (excluding below threshold)
+        inline const Rich::Particles& activeParticlesNoBT() const noexcept 
+        { return m_pidTypesNoBT; }
+
         /// The lightest active mass hypothesis
         inline Rich::ParticleIDType lightestActiveHypo() const noexcept
         { return m_pidTypes.front(); }
@@ -79,7 +83,10 @@ namespace Rich
 
       private:
 
-        /// Particle ID types to consider
+        /// Real particle ID types to consider (excluding below threshold)
+        Rich::Particles m_pidTypesNoBT;
+
+        /// All particle ID types to consider (including below threshold)
         Rich::Particles m_pidTypes;
 
         /// Pointer to derived class
diff --git a/Rich/RichFutureRecBase/src/RichRecBase.icpp b/Rich/RichFutureRecBase/src/RichRecBase.icpp
index 3d346e989e970018aa0ffcb5591cf9d5462c6774..ffa5d0ee64900eb948165aae8ba089ea726e56c3 100755
--- a/Rich/RichFutureRecBase/src/RichRecBase.icpp
+++ b/Rich/RichFutureRecBase/src/RichRecBase.icpp
@@ -32,11 +32,17 @@ Rich::Future::Rec::CommonBase<PBASE>::CommonBase( PBASE * base )
 template <class PBASE>
 StatusCode Rich::Future::Rec::CommonBase<PBASE>::initialiseRichReco()
 {
-  StatusCode sc = StatusCode::SUCCESS;
   // load tools
-  sc = sc && m_richPartProp.retrieve();
+  auto sc = m_richPartProp.retrieve();
+  if ( !sc ) return sc;
   // Get the list of PID types to consider
   m_pidTypes = m_richPartProp->particleTypes();
+  // cache active hypos excluding 'below threshold'
+  m_pidTypesNoBT = m_pidTypes;
+  const auto btIt = std::find( m_pidTypesNoBT.begin(), 
+                               m_pidTypesNoBT.end(), 
+                               Rich::BelowThreshold );
+  if ( btIt != m_pidTypesNoBT.end() ) { m_pidTypesNoBT.erase(btIt); }
   // return
   return sc;
 }
diff --git a/Rich/RichFutureRecMonitors/src/RichTrackSelEff.cpp b/Rich/RichFutureRecMonitors/src/RichTrackSelEff.cpp
index 5eca5f74be145299761b05927250b6131289bf58..75f61b3ea62dceaca6e303d785805202e294a90d 100644
--- a/Rich/RichFutureRecMonitors/src/RichTrackSelEff.cpp
+++ b/Rich/RichFutureRecMonitors/src/RichTrackSelEff.cpp
@@ -90,7 +90,7 @@ void TrackSelEff::operator()( const LHCb::Track::Selection& tracks,
   // fill event plots
   richHisto1D( HID("nTracks")     ) -> fill( tracks.size() );
   richHisto1D( HID("nRichTracks") ) -> fill( nSelTracks    );
-  
+
 }
 
 //-----------------------------------------------------------------------------
@@ -100,8 +100,8 @@ void TrackSelEff::fillTrackPlots( const LHCb::Track * track,
                                   const std::string & tkClass ) const
 {
   // cache clone dist
-  const double cloneDist = track->info(LHCb::Track::CloneDist,5.5e3);
-  
+  const double cloneDist = track->info(LHCb::Track::AdditionalInfo::CloneDist,5.5e3);
+
   // Efficiencies plots
   const double richEff = ( sel ? 100.0 : 0.0 );
   richProfile1D( tkClass+"effVP"          ) -> fill ( track->p(),  richEff );
diff --git a/Rich/RichFutureRecPhotonAlgorithms/src/RichBasePhotonReco.h b/Rich/RichFutureRecPhotonAlgorithms/src/RichBasePhotonReco.h
index 9b9c62fec877dcf50f4dcbec57e8aca7a6e3029e..01ecef1fa5e56e6432e8a912ea710e8b43756e7a 100644
--- a/Rich/RichFutureRecPhotonAlgorithms/src/RichBasePhotonReco.h
+++ b/Rich/RichFutureRecPhotonAlgorithms/src/RichBasePhotonReco.h
@@ -181,52 +181,48 @@ namespace Rich
           return m_minCKtheta[rad];
         }
         
-        /// Check the final Cherenkov angles (Scalar)
+        /// Check the final Cherenkov theta angle (Scalar)
         template < typename HYPODATA, typename FTYPE,
                    typename std::enable_if<std::is_arithmetic<FTYPE>::value>::type * = nullptr >
-        inline decltype(auto) checkAngles( const Rich::RadiatorType rad,
-                                           const HYPODATA& tkCkAngles,
-                                           const HYPODATA& tkCkRes,
-                                           const FTYPE ckTheta,
-                                           const FTYPE ckPhi ) const noexcept
+        inline decltype(auto) checkAngle( const Rich::RadiatorType rad,
+                                          const HYPODATA& tkCkAngles,
+                                          const HYPODATA& tkCkRes,
+                                          const FTYPE ckTheta ) const noexcept
         {
           return (
             // First the basic checks
             ckTheta < absMaxCKTheta(rad) &&
             ckTheta > absMinCKTheta(rad) &&
-            ckPhi   > 0                  &&
-            // Now check each hypo
-            std::any_of( activeParticles().begin(),
-                         activeParticles().end(),
+            // Now check each real hypo
+            std::any_of( activeParticlesNoBT().begin(),
+                         activeParticlesNoBT().end(),
                          [sigma=m_nSigma[rad],&ckTheta,
-                          &tkCkAngles,&tkCkRes]( const auto & id )
-                         { return fabs(ckTheta-tkCkAngles[id]) < sigma*tkCkRes[id]; } )
+                          &tkCkAngles,&tkCkRes]( const auto id )
+                         { return fabs(ckTheta-tkCkAngles[id]) < (sigma*tkCkRes[id]); } )
             );
         }
 
-        /// Check the final Cherenkov angles (SIMD)
+        /// Check the final Cherenkov theta angle (SIMD)
         template < typename HYPODATA, typename FTYPE,
                    typename std::enable_if<!std::is_arithmetic<FTYPE>::value>::type * = nullptr >
-        inline void checkAngles( const Rich::RadiatorType rad,
-                                 const HYPODATA& tkCkAngles,
-                                 const HYPODATA& tkCkRes,
-                                 const FTYPE ckTheta,
-                                 const FTYPE ckPhi,
-                                 SIMDFP::mask_type & OK ) const noexcept
+        inline void checkAngle( const Rich::RadiatorType rad,
+                                const HYPODATA& tkCkAngles,
+                                const HYPODATA& tkCkRes,
+                                const FTYPE& ckTheta,
+                                SIMDFP::mask_type & OK ) const noexcept
         {
           // First the basic checks
           OK &= ( ckTheta < m_maxCKthetaSIMD[rad] &&
-                  ckTheta > m_minCKthetaSIMD[rad] &&
-                  ckPhi   > FTYPE::Zero() );
+                  ckTheta > m_minCKthetaSIMD[rad] );
           // Now check each hypo
           if ( any_of(OK) )
           {
             auto hypoMask = !OK;
-            for ( const auto hypo : activeParticles() )
+            for ( const auto hypo : activeParticlesNoBT() )
             {
               const FTYPE angs( tkCkAngles[hypo] ); // maybe should cache this
               const FTYPE reso( tkCkRes[hypo]    ); // maybe should cache this
-              hypoMask |= ( abs( ckTheta - angs ) < m_nSigmaSIMD[rad] * reso );
+              hypoMask |= ( abs( ckTheta - angs ) < ( m_nSigmaSIMD[rad] * reso ) );
               if ( all_of( hypoMask ) ) break;
             }
             // Update the mask
diff --git a/Rich/RichFutureRecPhotonAlgorithms/src/RichSIMDCKEstiFromRadiusPhotonReco.cpp b/Rich/RichFutureRecPhotonAlgorithms/src/RichSIMDCKEstiFromRadiusPhotonReco.cpp
index 9a0ede3fdf3b723ea4cb9a1c42e3dd9924a21791..7828ca4cdd958b6863ead3351bffc58a05d07eca 100644
--- a/Rich/RichFutureRecPhotonAlgorithms/src/RichSIMDCKEstiFromRadiusPhotonReco.cpp
+++ b/Rich/RichFutureRecPhotonAlgorithms/src/RichSIMDCKEstiFromRadiusPhotonReco.cpp
@@ -153,7 +153,7 @@ SIMDCKEstiFromRadiusPhotonReco::operator()( const LHCb::RichTrackSegment::Vector
           // Is any hit close to any mass hypo in local coordinate space ?
           // only need confirmation for those already selected so start with !pixmask
           auto hypoMask = !pixmask; 
-          for ( const auto hypo : activeParticles() )
+          for ( const auto hypo : activeParticlesNoBT() )
           {
             const SIMDPixel::SIMDFP angs( tkCkAngles[hypo] ); // maybe should cache this
             const SIMDPixel::SIMDFP reso( tkCkRes[hypo]    ); // maybe should cache this
@@ -205,7 +205,7 @@ SIMDCKEstiFromRadiusPhotonReco::operator()( const LHCb::RichTrackSegment::Vector
           float sep_diff2 = std::numeric_limits<float>::max();
           float sep_calib{0}, last_sep_calib{0};
           bool pointOutsideLargestRing{false};
-          for ( const auto pid : activeParticles() )
+          for ( const auto pid : activeParticlesNoBT() )
           {
             
             // Load the ring and select the point for this PID type
@@ -340,9 +340,9 @@ SIMDCKEstiFromRadiusPhotonReco::operator()( const LHCb::RichTrackSegment::Vector
             thetaCerenkov += m_ckThetaCorrSIMD[rad];
 
             // --------------------------------------------------------------------------------------
-            // Final checks on the Cherenkov angles
+            // Final checks on the Cherenkov theta angles
             // --------------------------------------------------------------------------------------
-            checkAngles( rad, tkCkAngles, tkCkRes, thetaCerenkov, phiCerenkov, pixmask );
+            checkAngle( rad, tkCkAngles, tkCkRes, thetaCerenkov, pixmask );
             if ( any_of(pixmask) )
             {
 
diff --git a/Rich/RichFutureRecPhotonAlgorithms/src/RichSIMDPhotonPredictedPixelSignal.cpp b/Rich/RichFutureRecPhotonAlgorithms/src/RichSIMDPhotonPredictedPixelSignal.cpp
index 703e12056896a4e29e10524c878c2fd5a9e95d49..90e56b75615ca9a7a9b59ade031db7736584e507 100644
--- a/Rich/RichFutureRecPhotonAlgorithms/src/RichSIMDPhotonPredictedPixelSignal.cpp
+++ b/Rich/RichFutureRecPhotonAlgorithms/src/RichSIMDPhotonPredictedPixelSignal.cpp
@@ -69,11 +69,6 @@ StatusCode SIMDPhotonPredictedPixelSignal::initialize()
   m_minArgSIMD = SIMDFP( m_minArg );
   m_expMinArg  = std::exp( m_minArgSIMD );
 
-  // cache active hypos excluding 'below threshold'
-  m_hypos = activeParticles();
-  const auto btIt = std::find( m_hypos.begin(), m_hypos.end(), Rich::BelowThreshold );
-  if ( btIt != m_hypos.end() ) { m_hypos.erase( btIt ); }
-
   // return
   return sc;
 }
@@ -93,6 +88,9 @@ SIMDPhotonPredictedPixelSignal::operator()( const SIMDPixelSummaries& pixels,
   OutData signals;
   signals.reserve( photons.size() );
 
+  // Min CK theta angle for signal
+  const SIMDFP minCKTheta(1e-10);
+
   // Form the zipped track data range
   const auto tkRange = Ranges::ConstZip(ckAngles,ckRes,photYields,segments);
 
@@ -111,7 +109,6 @@ SIMDPhotonPredictedPixelSignal::operator()( const SIMDPixelSummaries& pixels,
     const auto det = phot.rich();
 
     // Reconstructed Cherenkov theta angle
-    const SIMDFP minCKTheta(1e-10);
     auto thetaReco = phot.CherenkovTheta();
     thetaReco( thetaReco < minCKTheta ) = minCKTheta;
 
@@ -132,9 +129,9 @@ SIMDPhotonPredictedPixelSignal::operator()( const SIMDPixelSummaries& pixels,
     const auto rad = segment.radiator();
 
     // Loop over the mass hypos and compute and fill each value
-    for ( const auto id : m_hypos )
+    for ( const auto id : activeParticlesNoBT() )
     {
-      // get the expect CK theta angle for this hypo
+      // get the expected CK theta angle for this hypo
       const auto tkA = tkCkAngles[id];
 
       // mass types are strictly ordered by increasing mass, so once we 
@@ -148,8 +145,7 @@ SIMDPhotonPredictedPixelSignal::operator()( const SIMDPixelSummaries& pixels,
       const auto thetaDiffOvRes = ( thetaReco - SIMDFP(tkA) ) * thetaExpResInv;
       
       // compute the signal probability for this hypo
-      // See note LHCB/98-040 page 11 equation 18
-      
+
       // First the argument to exp() function
       auto arg = SIMDFP(-0.5f) * thetaDiffOvRes * thetaDiffOvRes;
       
@@ -162,7 +158,7 @@ SIMDPhotonPredictedPixelSignal::operator()( const SIMDPixelSummaries& pixels,
         
         // Set any arg values below the minimum to the min
         arg(!mask) = m_minArgSIMD;
-        
+
         // compute exp(arg)
         const auto expArg = myexp(arg);
         
@@ -174,7 +170,7 @@ SIMDPhotonPredictedPixelSignal::operator()( const SIMDPixelSummaries& pixels,
         
         // Compute the signal
         sig = AInd * expArg * tkY * thetaExpResInv;
-        
+    
         // Check min prob value
         mask &= sig > m_minPhotonProbSIMD[rad];
         sig.setZeroInverted(mask);
diff --git a/Rich/RichFutureRecPhotonAlgorithms/src/RichSIMDPhotonPredictedPixelSignal.h b/Rich/RichFutureRecPhotonAlgorithms/src/RichSIMDPhotonPredictedPixelSignal.h
index 5f4f18ac1ce332f7b55ec9fc8abe9abc01c11c93..c5f68029792cec47b5f026c24497675a57b816b7 100644
--- a/Rich/RichFutureRecPhotonAlgorithms/src/RichSIMDPhotonPredictedPixelSignal.h
+++ b/Rich/RichFutureRecPhotonAlgorithms/src/RichSIMDPhotonPredictedPixelSignal.h
@@ -48,6 +48,8 @@ namespace Rich
        *
        *  Computes the expected pixel signals for photon candidates.
        *
+       *  See note LHCB/98-040 page 11 equation 18
+       *
        *  @author Chris Jones
        *  @date   2016-10-19
        */
@@ -104,9 +106,6 @@ namespace Rich
         
       private:
 
-        /// Cache of particle types excluding 'below threshold'
-        Rich::Particles m_hypos;
-
         /// Cache SIMD minimum argument value for the probability value
         SIMDFP m_minArgSIMD = SIMDFP::Zero();
 
diff --git a/Rich/RichFutureRecPhotonAlgorithms/src/RichSIMDQuarticPhotonReco.cpp b/Rich/RichFutureRecPhotonAlgorithms/src/RichSIMDQuarticPhotonReco.cpp
index b3214e78025233e0e640f190c14e03dd5fb15c7f..ad0a7946329b9385594ee5c29795eab11db6df29 100644
--- a/Rich/RichFutureRecPhotonAlgorithms/src/RichSIMDQuarticPhotonReco.cpp
+++ b/Rich/RichFutureRecPhotonAlgorithms/src/RichSIMDQuarticPhotonReco.cpp
@@ -173,7 +173,7 @@ SIMDQuarticPhotonReco::operator()( const LHCb::RichTrackSegment::Vector& segment
           // Is any hit close to any mass hypo in local coordinate space ?
           // only need confirmation for those already selected so start with !pixmask
           auto hypoMask = !pixmask; 
-          for ( const auto hypo : activeParticles() )
+          for ( const auto hypo : activeParticlesNoBT() )
           {
             const SIMDPixel::SIMDFP angs( tkCkAngles[hypo] ); // maybe should cache this
             const SIMDPixel::SIMDFP reso( tkCkRes[hypo]    ); // maybe should cache this
@@ -185,7 +185,7 @@ SIMDQuarticPhotonReco::operator()( const LHCb::RichTrackSegment::Vector& segment
 
         // Did any hit pass the pre-sel
         //_ri_verbo << "  -> PreSel=" << pixmask << endmsg;
-        if ( none_of(pixmask) ) { continue; }
+        if ( UNLIKELY( none_of(pixmask) ) ) { continue; }
 
         // make a photon object to work on
         photons.emplace_back( rich, pix.smartID() );
@@ -196,9 +196,6 @@ SIMDQuarticPhotonReco::operator()( const LHCb::RichTrackSegment::Vector& segment
         // Emission point to use for photon reconstruction
         SIMD::Point<FP> emissionPoint { segment.bestPoint() };
 
-        // Photon direction at emission point
-        SIMD::Vector<FP> photonDirection;
-
         // Final reflection points on sec and spherical mirrors
         SIMD::Point<FP> sphReflPoint, secReflPoint;
 
@@ -419,7 +416,7 @@ SIMDQuarticPhotonReco::operator()( const LHCb::RichTrackSegment::Vector& segment
                                     ( normV.Z() * ( pix.gloPos().Z() - secReflPoint.Z() ) ) );
             virtDetPoint = pix.gloPos() - ( normV * ( SIMDFP(2.0) * distance / normV.Mag2() ) );
 
-            // solve the quartic using the new data ( was 3,4 - try 2,3 )
+            // solve the quartic using the new data
             m_quarticSolver.solve<SIMDFP,2,3>( emissionPoint,
                                                sphMirrors.getCoCs(),
                                                virtDetPoint,
@@ -516,10 +513,9 @@ SIMDQuarticPhotonReco::operator()( const LHCb::RichTrackSegment::Vector& segment
 
         // --------------------------------------------------------------------------------------
         // Calculate the cherenkov angles using the photon and track vectors
-        // Note use double here, and truncate later to float, to avoid precision issues with
-        // VDT and -O3 optimisation level. 
         // --------------------------------------------------------------------------------------
-        photonDirection = (sphReflPoint-emissionPoint).Unit();
+        // direction at emission. No need to be normalised.
+        const auto photonDirection = ( sphReflPoint - emissionPoint ); 
         SIMDFP thetaCerenkov(SIMDFP::Zero()), phiCerenkov(SIMDFP::Zero());
         segment.angleToDirection( photonDirection, thetaCerenkov, phiCerenkov );
         //_ri_verbo << std::setprecision(9) << " -> Phot Dir " << photonDirection << endmsg;
@@ -542,9 +538,9 @@ SIMDQuarticPhotonReco::operator()( const LHCb::RichTrackSegment::Vector& segment
         //---------------------------------------------------------------------------------------
 
         // --------------------------------------------------------------------------------------
-        // Final checks on the Cherenkov angles
+        // Final checks on the Cherenkov angle
         // --------------------------------------------------------------------------------------
-        checkAngles( rad, tkCkAngles, tkCkRes, thetaCerenkov, phiCerenkov, pixmask );
+        checkAngle( rad, tkCkAngles, tkCkRes, thetaCerenkov, pixmask );
         //_ri_verbo << "  -> checkAngles " << pixmask << endmsg;
         if ( UNLIKELY( none_of(pixmask) ) )
         {
@@ -556,11 +552,11 @@ SIMDQuarticPhotonReco::operator()( const LHCb::RichTrackSegment::Vector& segment
         // --------------------------------------------------------------------------------------
         // Set (remaining) photon parameters
         // --------------------------------------------------------------------------------------
-        gPhoton.setCherenkovTheta         ( thetaCerenkov  );
-        gPhoton.setCherenkovPhi           ( phiCerenkov    );
-        gPhoton.setActiveSegmentFraction  ( fraction       );
-        gPhoton.setUnambiguousPhoton      ( unambigPhoton  );
-        gPhoton.setValidityMask           ( pixmask        );
+        gPhoton.setCherenkovTheta        ( thetaCerenkov );
+        gPhoton.setCherenkovPhi          ( phiCerenkov   );
+        gPhoton.setActiveSegmentFraction ( fraction      );
+        gPhoton.setUnambiguousPhoton     ( unambigPhoton );
+        gPhoton.setValidityMask          ( pixmask       );
         // --------------------------------------------------------------------------------------
      
         // --------------------------------------------------------------------------------------
@@ -604,7 +600,6 @@ void SIMDQuarticPhotonReco::findMirrorData( const Rich::DetectorType rich,
                                             SIMDFP::mask_type & OK ) const
 {
   // solve quartic equation with nominal values and find spherical mirror reflection point
-  // ( was 3,3 - try 2,2 )
   m_quarticSolver.solve<SIMDFP,2,2>( emissionPoint,
                                      m_rich[rich]->nominalCentreOfCurvatureSIMD(side),
                                      virtDetPoint,
@@ -640,7 +635,6 @@ SIMDQuarticPhotonReco::getBestGasEmissionPoint( const Rich::RadiatorType radiato
                                                 SIMD::Point<FP> & emissionPoint,
                                                 SIMDFP & fraction ) const
 {
-
   // Default point for emission point is the middle
   SIMDFP alongTkFrac( 0.5 );
 
diff --git a/Rich/RichFutureRecSys/examples/Brunel.py b/Rich/RichFutureRecSys/examples/Brunel.py
index 6a48c760c4659fbd7c74bf6e17d4ae26f01a35ef..f1d5034612640c55cf2a4a19f88bdeb6b34a5520 100644
--- a/Rich/RichFutureRecSys/examples/Brunel.py
+++ b/Rich/RichFutureRecSys/examples/Brunel.py
@@ -15,9 +15,11 @@ L0Conf().EnsureKnownTCK = False
 
 #############################################################################
 
-from Configurables import RecMoniConf
-RecMoniConf().MoniSequence = richs
-Brunel().MCCheckSequence = richs+["PROTO"]
+#Brunel.RichSequences = ["RICH"]
+
+#from Configurables import RecMoniConf
+#RecMoniConf().MoniSequence = richs
+#Brunel().MCCheckSequence = richs+["PROTO"]
 
 #RecMoniConf().MoniSequence = []
 #Brunel().MCCheckSequence = []
@@ -25,7 +27,7 @@ Brunel().MCCheckSequence = richs+["PROTO"]
 #############################################################################
 
 # Timestamps in messages
-LHCbApp().TimeStamp = True
+#LHCbApp().TimeStamp = True
 
 Brunel().VetoHltErrorEvents = False
 
@@ -33,10 +35,10 @@ Brunel().OutputType = 'None'
 #Brunel().OutputType = 'DST'
 #importOptions("$APPCONFIGOPTS/Persistency/Compression-ZLIB-1.py")
 
-Brunel().EvtMax     = 10000
-Brunel().PrintFreq  = 100
+Brunel().EvtMax     = 100
+Brunel().PrintFreq  = 10
 
-#Brunel().Histograms = "Expert"
+Brunel().Histograms = "Expert"
 #Brunel().Histograms = "None"
 
 #ApplicationMgr().ExtSvc += [ "AuditorSvc" ]
@@ -52,7 +54,7 @@ Brunel().PrintFreq  = 100
 
 Brunel().OnlineMode = True
 
-Brunel().FilterTrackStates = False
+#Brunel().FilterTrackStates = False
 
 msgSvc = getConfigurable("MessageSvc")
 #msgSvc.setVerbose += [ "DeRichGasRadiator" ]
diff --git a/Rich/RichFutureRecSys/examples/RichFuture.py b/Rich/RichFutureRecSys/examples/RichFuture.py
index cff8c294019644f1303d1b89018926b031bf9c73..dd7b5f5ea8e29f504a79b7211e43dfe4c08048ce 100644
--- a/Rich/RichFutureRecSys/examples/RichFuture.py
+++ b/Rich/RichFutureRecSys/examples/RichFuture.py
@@ -6,12 +6,12 @@
 from Gaudi.Configuration import *
 from GaudiConfig.ControlFlow import seq
 from Configurables import CondDB, LHCbApp, GaudiSequencer
+import os
 
 # Fetch required data from file
 from Configurables import Gaudi__Hive__FetchDataFromFile as FetchDataFromFile
 fetcher = FetchDataFromFile('FetchDSTData')
-fetcher.DataKeys = ['Trigger/RawEvent','Rich/RawEvent',
-                    'pRec/Track/Best','pMC/Particles']
+fetcher.DataKeys = ['Trigger/RawEvent','Rich/RawEvent','pRec/Track/Best']
 
 # First various raw event decodings
 
@@ -111,13 +111,14 @@ all = GaudiSequencer( "All", Members = [ fetcher, odinDecode, richDecode,
                                          tkUnpack, tkFilt, RichRec ] )
 
 # Uncomment to enable monitoring
-#all.Members += [ RichMoni ]
-#all.Members += [ mcPUnpack, mcRiSumUnP, RichCheck ]
+all.Members += [ RichMoni ]
+fetcher.DataKeys += ['pMC/Particles']
+all.Members += [ mcPUnpack, mcRiSumUnP, RichCheck ]
 
 all.MeasureTime = True
 
 ApplicationMgr( TopAlg = [all],
-                EvtMax = 50000,      # events to be processed (default is 10)
+                EvtMax = 10000,      # events to be processed (default is 10)
                 #EvtSel = 'NONE', # do not use any event input
                 ExtSvc = ['ToolSvc', 'AuditorSvc' ],
                 AuditAlgorithms = True )
@@ -143,7 +144,10 @@ SequencerTimerTool("ToolSvc.SequencerTimerTool").NameSize = 40
 ApplicationMgr().HistogramPersistency = "ROOT"
 from Configurables import RootHistCnv__PersSvc
 RootHistCnv__PersSvc('RootHistCnv').ForceAlphaIds = True
-HistogramPersistencySvc().OutputFile = "RichFuture.root"
+myBuild = os.environ['User_release_area'].split('/')[-1]
+myConf  = os.environ['CMTCONFIG']
+fname   = myBuild + "-" + myConf + ".root"
+HistogramPersistencySvc().OutputFile = fname
 
 # Auditors
 AuditorSvc().Auditors += [ "FPEAuditor" ]
diff --git a/Rich/RichFutureRecTrackAlgorithms/src/RichBaseTrSegMaker.cpp b/Rich/RichFutureRecTrackAlgorithms/src/RichBaseTrSegMaker.cpp
index 65b1025f2b73c4393c208e6ce77a3a2affa4ab10..9ec3d5578758b082f31f0dc6ff376d2debb61402 100755
--- a/Rich/RichFutureRecTrackAlgorithms/src/RichBaseTrSegMaker.cpp
+++ b/Rich/RichFutureRecTrackAlgorithms/src/RichBaseTrSegMaker.cpp
@@ -38,11 +38,9 @@ StatusCode BaseTrSegMaker::initialize()
   const StatusCode sc = AlgBase::initialize();
   if ( sc.isFailure() ) return sc;
 
-  if ( !usedRads(Rich::Aerogel) )
+  if (  usedRads(Rich::Aerogel) )
   {
-    _ri_debug << "Track segments for Aerogel are disabled" << endmsg;
-    //Warning("Track segments for Aerogel are disabled",StatusCode::SUCCESS).ignore();
-    //made into debug as it is still too verbose as a warning
+    return Error( "Aerogel not supported in the 'RichFuture' framework" );
   }
   if ( !usedRads(Rich::Rich1Gas) )
   {
@@ -54,7 +52,7 @@ StatusCode BaseTrSegMaker::initialize()
   }
 
   _ri_debug << "Beam pipe intersection test (Aero/R1Gas/R2Gas) = " << m_checkBeamP << endmsg;
-  for ( const auto rad : { Rich::Aerogel, Rich::Rich1Gas, Rich::Rich2Gas } )
+  for ( const auto rad : { Rich::Rich1Gas, Rich::Rich2Gas } )
   {
     if ( m_checkBeamP[rad] ) 
     {
diff --git a/Rich/RichFutureRecTrackAlgorithms/src/RichDetailedTrSegMakerFromTracks.cpp b/Rich/RichFutureRecTrackAlgorithms/src/RichDetailedTrSegMakerFromTracks.cpp
index 3b7591f7b9e01a0eb8ad8e2554f7e6f7e0ffa163..e85363de585801c5403e64492404bc10e59d0f71 100644
--- a/Rich/RichFutureRecTrackAlgorithms/src/RichDetailedTrSegMakerFromTracks.cpp
+++ b/Rich/RichFutureRecTrackAlgorithms/src/RichDetailedTrSegMakerFromTracks.cpp
@@ -34,8 +34,8 @@ DetailedTrSegMakerFromTracks::DetailedTrSegMakerFromTracks( const std::string& n
   declareProperty( "TrackStateProvider", m_trStateP );
 
   // Radiators to skip by track type, when using the track provider tool
-  m_radsToSkip[LHCb::Track::Ttrack]   = { Rich::Rich1Gas };
-  m_radsToSkip[LHCb::Track::Upstream] = { Rich::Rich2Gas };
+  m_radsToSkip[LHCb::Track::Types::Ttrack]   = { Rich::Rich1Gas };
+  m_radsToSkip[LHCb::Track::Types::Upstream] = { Rich::Rich2Gas };
 
   // Debug messages
   //setProperty( "OutputLevel", MSG::VERBOSE );
@@ -50,9 +50,6 @@ StatusCode DetailedTrSegMakerFromTracks::initialize()
   auto sc = MultiTransformer::initialize();
   if ( !sc ) return sc;
 
-  // check to see if Aerogel has been wrongly enabled...
-  if ( usedRads(Rich::Aerogel) ) { return Error( "Aerogel is not supported" ); }
-
   // Preload Geometry ?
   if ( m_preload )
   {
@@ -77,12 +74,10 @@ StatusCode DetailedTrSegMakerFromTracks::initialize()
   m_rich[Rich::Rich2] = getDet<DeRich>( DeRichLocations::Rich2 );
 
   // Radiators
-  m_radiators.push_back( usedRads(Rich::Aerogel)  ?
-                         getDet<DeRichRadiator>(DeRichLocations::Aerogel)  : nullptr );
-  m_radiators.push_back( usedRads(Rich::Rich1Gas) ?
-                         getDet<DeRichRadiator>(DeRichLocations::Rich1Gas) : nullptr );
-  m_radiators.push_back( usedRads(Rich::Rich2Gas) ?
-                         getDet<DeRichRadiator>(DeRichLocations::Rich2Gas) : nullptr );
+  if ( usedRads(Rich::Rich1Gas) ) 
+  { m_radiators.push_back( getDet<DeRichRadiator>(DeRichLocations::Rich1Gas) ); }
+  if ( usedRads(Rich::Rich2Gas) )
+  { m_radiators.push_back( getDet<DeRichRadiator>(DeRichLocations::Rich2Gas) ); }
 
   for ( const auto rad : Rich::radiators() )
   {
@@ -185,9 +180,6 @@ constructSegments( const LHCb::Track * track,
   for ( const auto* radiator : m_radiators )
   {
 
-    // is this radiator active ?
-    if ( !radiator ) continue; // Means not in use
-
     // which radiator
     const auto rad = radiator->radiatorID();
     _ri_verbo << " Considering radiator " << rad << endmsg;
diff --git a/Rich/RichFutureRecTrackAlgorithms/src/RichDetectablePhotonYields.cpp b/Rich/RichFutureRecTrackAlgorithms/src/RichDetectablePhotonYields.cpp
index 19065e5902b83b8ed9fa6d852aaae923cba56353..0acde9cde741c7a4eab9b622bf2b68c84c9fa5ef 100644
--- a/Rich/RichFutureRecTrackAlgorithms/src/RichDetectablePhotonYields.cpp
+++ b/Rich/RichFutureRecTrackAlgorithms/src/RichDetectablePhotonYields.cpp
@@ -1,8 +1,4 @@
 
-// Array properties
-//#include "GaudiKernel/ParsersFactory.h"
-//#include "GaudiKernel/StdArrayAsProperty.h"
-
 // local
 #include "RichDetectablePhotonYields.h"
 
@@ -85,7 +81,7 @@ DetectablePhotonYields::operator()( const LHCb::RichTrackSegment::Vector& segmen
   PDCount pdCount; 
   MirrorCount primMirrCount, secMirrCount;
   // reserve a reasonable starting size.
-  // A single track will only interactive with a few PDs or mirrors.
+  // A single track will only interact with a few PDs or mirrors.
   pdCount.reserve(3);
   primMirrCount.reserve(3);
   secMirrCount.reserve(3);
@@ -109,15 +105,15 @@ DetectablePhotonYields::operator()( const LHCb::RichTrackSegment::Vector& segmen
     // which RICH
     const auto rich = segment.rich();
 
-    // Loop over PID types
-    for ( const auto id : activeParticles() )
+    // Loop over real PID types
+    for ( const auto id : activeParticlesNoBT() )
     {
       // the signal
       ScType signal = 0;
 
       // Skip rings with no hits
       //_ri_debug << "  -> " << id << " #Rings=" << rings[id].size() << endmsg;
-      if ( !rings[id].empty() && Rich::BelowThreshold != id )
+      if ( !rings[id].empty() )
       {
 
         // Collect the signal info for this ring
@@ -160,7 +156,7 @@ DetectablePhotonYields::operator()( const LHCb::RichTrackSegment::Vector& segmen
             else { Warning("Problem with mirror or PD pointers!").ignore(); }
           }
         }
-        
+
         // Any hits in acceptance ?
         if ( totalInPD > 0 )
         {
@@ -171,8 +167,8 @@ DetectablePhotonYields::operator()( const LHCb::RichTrackSegment::Vector& segmen
           for ( unsigned int iEnBin = 0; iEnBin < emitSpectra.energyBins(); ++iEnBin )
           {
 
-            // bin energy
-            const auto energy = emitSpectra.binEnergy(iEnBin);
+            // bin energy ( in eV )
+            const auto energy = emitSpectra.binEnergy(iEnBin) * Gaudi::Units::eV;
 
             // Get weighted average PD Q.E.
             ScType pdQEEff(0);
@@ -181,14 +177,14 @@ DetectablePhotonYields::operator()( const LHCb::RichTrackSegment::Vector& segmen
               for ( const auto& PD : pdCount )
               {
                 // add up Q.E. eff
-                pdQEEff += (ScType)(PD.second) * (*((PD.first)->pdQuantumEff()))[energy*Gaudi::Units::eV]/100 ;
+                pdQEEff += (ScType)(PD.second) * (ScType)(*((PD.first)->pdQuantumEff()))[energy];
               }
-              // normalise the result
-              pdQEEff /= (ScType)(totalInPD);
+              // normalise the result (and scale from % to fraction)
+              pdQEEff /= (ScType)( 100 * totalInPD );
             }
             else
             {
-              pdQEEff = 1;
+              pdQEEff = 1.0;
               Warning( "No PDs found -> Assuming Av. PD Q.E. of 1", StatusCode::SUCCESS ).ignore();
             }
             //_ri_debug << std::setprecision(9) << "   -> pdQEEff : En=" << energy << " Eff=" << pdQEEff << endmsg;
@@ -201,14 +197,14 @@ DetectablePhotonYields::operator()( const LHCb::RichTrackSegment::Vector& segmen
               {
                 // add up mirror refl.
                 primMirrRefl +=
-                  (ScType)(PM.second) * (*(PM.first->reflectivity()))[energy*Gaudi::Units::eV];
+                  (ScType)(PM.second) * (ScType)(*(PM.first->reflectivity()))[energy];
               }
               // normalise the result
               primMirrRefl /= (ScType)(totalInPD);
             }
             else
             {
-              primMirrRefl = 1;
+              primMirrRefl = 1.0;
               Warning( "No primary mirrors found -> Assuming Av. reflectivity of 1", 
                        StatusCode::SUCCESS ).ignore();
             }
@@ -222,14 +218,14 @@ DetectablePhotonYields::operator()( const LHCb::RichTrackSegment::Vector& segmen
               {
                 // add up mirror refl.
                 secMirrRefl +=
-                  (ScType)(SM.second) * (*(SM.first->reflectivity()))[energy*Gaudi::Units::eV];
+                  (ScType)(SM.second) * (ScType)(*(SM.first->reflectivity()))[energy];
               }
               // normalise the result
               secMirrRefl /= (ScType)(totalInPD);
             }
             else
             {
-              secMirrRefl = 1;
+              secMirrRefl = 1.0;
               Warning( "No secondary mirrors found -> Assuming Av. reflectivity of 1", 
                        StatusCode::SUCCESS ).ignore();
             }
@@ -242,9 +238,9 @@ DetectablePhotonYields::operator()( const LHCb::RichTrackSegment::Vector& segmen
             auto sig = ( (emitSpectra.energyDist(id))[iEnBin] * totEff );
             
             // The Quartz window efficiency
-            sig *= ( energy <= 0 ? 0 :
+            sig *= ( energy <= 0 ? 0.0 :
                      Rich::Maths::fast_exp( -m_qWinZSize[rich] /
-                                            (*(m_riches[rich]->gasWinAbsLength()))[energy*Gaudi::Units::eV] ) );
+                                            (ScType)(*(m_riches[rich]->gasWinAbsLength()))[energy] ) );
 
             //_ri_debug << std::setprecision(9) << "    -> Final Eff = " << totEff << " | DetSignal = " << sig << endmsg;
 
diff --git a/Rich/RichFutureRecTrackAlgorithms/src/RichEmittedPhotonYields.cpp b/Rich/RichFutureRecTrackAlgorithms/src/RichEmittedPhotonYields.cpp
index 4471c2ed9cee652292db8961b91fddd92a85f26b..27d7ae71f05fdba9614d2b07bcd22cbed0006850 100644
--- a/Rich/RichFutureRecTrackAlgorithms/src/RichEmittedPhotonYields.cpp
+++ b/Rich/RichFutureRecTrackAlgorithms/src/RichEmittedPhotonYields.cpp
@@ -81,75 +81,41 @@ EmittedPhotonYields::operator()( const LHCb::RichTrackSegment::Vector& segments
     // energy bin size
     const auto enBinSize = spectra.binSize();
     
-    // Loop over PID types
-    for ( const auto id : activeParticles() )
+    // Loop over (real) PID types. Below threshold excluded.
+    for ( const auto id : activeParticlesNoBT() )
     {
       // the signal value
       PhotonYields::Type signal = 0;
 
-      // Skip below threshold
-      if ( Rich::BelowThreshold != id )
+      // Compute some segment ID dependent parameters
+      const auto Esq         = momentum2 + m_particleMassSq[id];
+      const auto invBetaSqA  = 37.0 * ( momentum2>0 ? Esq/momentum2 : 0 );
+      const auto invGammaSqE = ( Esq>0 ? m_particleMassSq[id]/Esq : 0 ) * enBinSize;
+      
+      //_ri_verbo << std::setprecision(9) 
+      //          << id << " Esq " << Esq << " invBetaSqA " << invBetaSqA
+      //          << " invGammaSqE " << invGammaSqE << endmsg;
+      
+      // loop over the energy bins
+      for ( unsigned int iEnBin = 0; iEnBin < spectra.energyBins(); ++iEnBin )
       {
-
-        // Compute some segment ID dependent parameters
-        const auto Esq         = momentum2 + m_particleMassSq[id];
-        const auto invBetaSqA  = 37.0 * ( momentum2>0 ? Esq/momentum2 : 0 );
-        const auto invGammaSqE = ( Esq>0 ? m_particleMassSq[id]/Esq : 0 ) * enBinSize;
-
+        
+        // Compute number of photons
+        auto nPhot = invBetaSqA * ( (m_paraWDiff[rad])[iEnBin] - invGammaSqE );
+        
+        // bin signal
+        const auto binSignal = length * ( nPhot > 0 ? nPhot : 0.0 );
         //_ri_verbo << std::setprecision(9) 
-        //          << id << " Esq " << Esq << " invBetaSqA " << invBetaSqA
-        //          << " invGammaSqE " << invGammaSqE << endmsg;
-          
-        // loop over the energy bins
-        for ( unsigned int iEnBin = 0; iEnBin < spectra.energyBins(); ++iEnBin )
-        {
-
-          // Compute number of photons
-          auto nPhot = invBetaSqA * ( (m_paraWDiff[rad])[iEnBin] - invGammaSqE );
-
-          // correct for wavelength independant transmission coeff. in aerogel
-          if ( UNLIKELY( Rich::Aerogel == rad ) )
-          {
-            // get the radiator intersections
-            const auto & radInts = segment.radIntersections();
-            
-            // normalise over each intersection
-            PhotonYields::Type totPlength(0), waveIndepTrans(0);
-            if ( !radInts.empty() )
-            {
-              // average energy for this range
-              const auto avEn = spectra.binEnergy(iEnBin) * Gaudi::Units::eV;
-              
-              // average over all intersections
-              for ( const auto& R : radInts )
-              {
-                const auto pLen = R.pathLength();
-                const auto absL = R.radiator()->absorption()->value(avEn);
-                totPlength       += pLen;
-                waveIndepTrans   += pLen * Rich::Maths::fast_exp( -pLen / absL );
-              }
-              if ( totPlength>0 ) { waveIndepTrans /= totPlength; }
-              
-              // scale the expected photon yield
-              nPhot *= waveIndepTrans;
-            }
-          }
-
-          // bin signal
-          const auto binSignal = length * ( nPhot > 0 ? nPhot : 0.0 );
-          //_ri_verbo << std::setprecision(9) 
-          //          << " bin " << iEnBin << " nPhot " << nPhot 
-          //          << " binSignal " << binSignal << endmsg;
-
-          // save in the spectra object
-          (spectra.energyDist(id))[iEnBin] = binSignal;
-          
-          // Add to the total signal
-          signal += binSignal;
-	  
-        } // energy bins
+        //          << " bin " << iEnBin << " nPhot " << nPhot 
+        //          << " binSignal " << binSignal << endmsg;
+        
+        // save in the spectra object
+        (spectra.energyDist(id))[iEnBin] = binSignal;
         
-      } // above threshold type
+        // Add to the total signal
+        signal += binSignal;
+	
+      } // energy bins
 
       // save the yield for this hypo
       //_ri_verbo << std::setprecision(9) << "final signal " << signal << endmsg;
diff --git a/Rich/RichFutureRecTrackAlgorithms/src/RichGeomEffCKMassRings.cpp b/Rich/RichFutureRecTrackAlgorithms/src/RichGeomEffCKMassRings.cpp
index 2282d4ffc53b56a16d0e01c182d8e3c144cfbcc3..cb7f2f093447b13b90c96fe296d8ffb0f54d7c4b 100644
--- a/Rich/RichFutureRecTrackAlgorithms/src/RichGeomEffCKMassRings.cpp
+++ b/Rich/RichFutureRecTrackAlgorithms/src/RichGeomEffCKMassRings.cpp
@@ -59,8 +59,8 @@ GeomEffCKMassRings::operator()( const LHCb::RichTrackSegment::Vector& segments,
     // Which rich
     const auto rich = segment.rich();
 
-    // Loop over PID types
-    for ( const auto id : activeParticles() )
+    // Loop over (real) PID types (Below Threshold excluded).
+    for ( const auto id : activeParticlesNoBT() )
     {
       //The efficiency
       ScType eff = 0;
diff --git a/Rich/RichFutureRecTrackAlgorithms/src/RichRayTraceCherenkovCones.cpp b/Rich/RichFutureRecTrackAlgorithms/src/RichRayTraceCherenkovCones.cpp
index ee12a248d449efd035daabd065a2a76ed863dcac..affe10d1f76566e1c61a8e2bd8a43cb052d43d2e 100644
--- a/Rich/RichFutureRecTrackAlgorithms/src/RichRayTraceCherenkovCones.cpp
+++ b/Rich/RichFutureRecTrackAlgorithms/src/RichRayTraceCherenkovCones.cpp
@@ -70,11 +70,7 @@ StatusCode RayTraceCherenkovCones::initialize()
                                   LHCb::RichTraceMode::SphericalPDs :
                                   LHCb::RichTraceMode::FlatPDs ) );
   if ( m_checkBeamPipe ) { tmpMode.setBeamPipeIntersects(true); }
-  m_traceModeRad[Rich::Aerogel]  = tmpMode;
-  m_traceModeRad[Rich::Aerogel].setAeroRefraction(true);
-  m_traceModeRad[Rich::Rich1Gas] = tmpMode;
-  m_traceModeRad[Rich::Rich2Gas] = tmpMode;
-  _ri_debug << "Aerogel  Track " << m_traceModeRad[Rich::Aerogel]  << endmsg;
+  m_traceModeRad.fill( tmpMode );
   _ri_debug << "Rich1Gas Track " << m_traceModeRad[Rich::Rich1Gas] << endmsg;
   _ri_debug << "Rich2Gas Track " << m_traceModeRad[Rich::Rich2Gas] << endmsg;
 
@@ -121,7 +117,7 @@ RayTraceCherenkovCones::operator()( const LHCb::RichTrackSegment::Vector& segmen
     //_ri_vero << "segment " << emissionPoint << endmsg;
      
      // Loop over PID types
-    for ( const auto id : activeParticles() )
+    for ( const auto id : activeParticlesNoBT() )
     {
       // Above threshold ?
       if ( ckTheta[id] > 0 )
diff --git a/Rich/RichFutureRecTrackAlgorithms/src/RichRayTraceTrackGlobalPoints.cpp b/Rich/RichFutureRecTrackAlgorithms/src/RichRayTraceTrackGlobalPoints.cpp
index 678d86dd1deaa28c456d18a84344daed59003311..1dbc4bdc4d66a9d4f232eb62eb224a363f5e17a8 100644
--- a/Rich/RichFutureRecTrackAlgorithms/src/RichRayTraceTrackGlobalPoints.cpp
+++ b/Rich/RichFutureRecTrackAlgorithms/src/RichRayTraceTrackGlobalPoints.cpp
@@ -33,8 +33,6 @@ StatusCode RayTraceTrackGlobalPoints::initialize()
   sc = sc && m_rayTrace.retrieve();
 
   // track ray tracing
-  m_traceMode[Rich::Aerogel].setAeroRefraction(true);
-  _ri_debug << "Aerogel  Track " << m_traceMode[Rich::Aerogel]  << endmsg;
   _ri_debug << "Rich1Gas Track " << m_traceMode[Rich::Rich1Gas] << endmsg;
   _ri_debug << "Rich2Gas Track " << m_traceMode[Rich::Rich2Gas] << endmsg;
   for ( const auto rad : Rich::radiators() )
diff --git a/Rich/RichFutureRecTrackAlgorithms/src/RichSignalPhotonYields.cpp b/Rich/RichFutureRecTrackAlgorithms/src/RichSignalPhotonYields.cpp
index 6d3de463f57f04697dc3f07ea23e53f9d3bdb0d5..8c165709eb7a25518e8848abe4d8278262a34751 100644
--- a/Rich/RichFutureRecTrackAlgorithms/src/RichSignalPhotonYields.cpp
+++ b/Rich/RichFutureRecTrackAlgorithms/src/RichSignalPhotonYields.cpp
@@ -51,16 +51,13 @@ SignalPhotonYields::operator()( const PhotonYields::Vector& detYields,
     auto & yields = yieldV.back();
 
     // Loop over PID types
-    for ( const auto id : activeParticles() )
+    for ( const auto id : activeParticlesNoBT() )
     {
-      if ( id != Rich::BelowThreshold ) 
-      {
-        //_ri_verbo << std::setprecision(9) 
-        //          << id << " detYield " << detYield[id] << " geomEff " << geomEff[id] << endmsg;
-        // Scale the detectable yields by the geom eff
-        yields.setData( id, detYield[id] * geomEff[id] );
-        for ( auto & i : sigSpectra.energyDist(id) ) { i *= geomEff[id]; }
-      }
+      //_ri_verbo << std::setprecision(9) 
+      //          << id << " detYield " << detYield[id] << " geomEff " << geomEff[id] << endmsg;
+      // Scale the detectable yields by the geom eff
+      yields.setData( id, detYield[id] * geomEff[id] );
+      for ( auto & i : sigSpectra.energyDist(id) ) { i *= geomEff[id]; }
     }
     
   }
diff --git a/Rich/RichFutureRecTrackAlgorithms/src/RichTrackCherenkovAngles.cpp b/Rich/RichFutureRecTrackAlgorithms/src/RichTrackCherenkovAngles.cpp
index 6768db665f9101533316d9c0992abb11bc1e52b3..d0a43be9c554158651a05063e2a158e888822eda 100644
--- a/Rich/RichFutureRecTrackAlgorithms/src/RichTrackCherenkovAngles.cpp
+++ b/Rich/RichFutureRecTrackAlgorithms/src/RichTrackCherenkovAngles.cpp
@@ -46,8 +46,8 @@ TrackCherenkovAnglesBase::run( const LHCb::RichTrackSegment::Vector& segments,
 
     //_ri_verbo << "Tk" << endmsg;
 
-    // Loop over PID types
-    for ( const auto id : activeParticles() )
+    // Loop over (real) PID types (Below Threshold excluded).
+    for ( const auto id : activeParticlesNoBT() )
     {
 
       // the angle
diff --git a/Rich/RichFutureRecTrackAlgorithms/src/RichTrackFilter.cpp b/Rich/RichFutureRecTrackAlgorithms/src/RichTrackFilter.cpp
index 7aaf4e17132a5fb44d3a713417e57a87edc17c37..d5df64bb205827bd14dd134cc11f0d3f686167c9 100644
--- a/Rich/RichFutureRecTrackAlgorithms/src/RichTrackFilter.cpp
+++ b/Rich/RichFutureRecTrackAlgorithms/src/RichTrackFilter.cpp
@@ -33,9 +33,9 @@ OutData TrackFilter::operator()( const LHCb::Tracks& tracks ) const
   for ( const auto * tk : tracks )
   {
     _ri_verbo << " -> type " << tk->type() << endmsg;
-    if      ( tk->type() == LHCb::Track::Long       ) { longTks.insert( tk ); }
-    else if ( tk->type() == LHCb::Track::Downstream ) { downTks.insert( tk ); }
-    else if ( tk->type() == LHCb::Track::Upstream   ) { upTks  .insert( tk ); }
+    if      ( tk->type() == LHCb::Track::Types::Long       ) { longTks.insert( tk ); }
+    else if ( tk->type() == LHCb::Track::Types::Downstream ) { downTks.insert( tk ); }
+    else if ( tk->type() == LHCb::Track::Types::Upstream   ) { upTks  .insert( tk ); }
   }
 
   _ri_debug << "Selected " << longTks.size() << " Long, " << downTks.size()
diff --git a/Rich/RichRecUtils/RichRecUtils/QuarticSolverNewton.h b/Rich/RichRecUtils/RichRecUtils/QuarticSolverNewton.h
index f8ffdc275626d4dff78b7e6e652c05f13d350385..6b2d424f9461c803807f4f35b6e6f26624c5d997 100755
--- a/Rich/RichRecUtils/RichRecUtils/QuarticSolverNewton.h
+++ b/Rich/RichRecUtils/RichRecUtils/QuarticSolverNewton.h
@@ -325,46 +325,38 @@ namespace Rich
       inline void  
       evalPolyHorner( const TYPE (&a)[ORDER+1], TYPE (&res)[DIFFGRADE+1], const TYPE & x ) const
       {
-
-        for ( std::size_t i = 0; i <= DIFFGRADE; ++i )
+        for ( std::size_t i = 0; i <= DIFFGRADE; ++i ) 
         {
-          res[i] = a[0];
+          res[i] = a[0]; 
         }
-
         for ( std::size_t j = 1; j <= ORDER; ++j )
         {
-          //res[0] = res[0] * x + a[j];
-          res[0] *= x;
-          res[0] += a[j];
-          //const std::size_t l = ( ORDER-j > DIFFGRADE ? DIFFGRADE : ORDER-j );
+          res[0] = ( res[0] * x ) + a[j];
           const auto l = std::min( ORDER-j, DIFFGRADE );
           for ( std::size_t i = 1; i <= l ; ++i )
           {
-            res[i] *= x;
-            res[i] += res[i-1];
-            //res[i] = res[i] * x + res[i-1];
+            res[i] = ( res[i] * x ) + res[i-1];
           }
         }
-
-        //TODO: Check assembly to see if this is optimized away if DIFFGRADE is <= 2
         TYPE l = 1.0;
         for ( std::size_t i = 2; i <= DIFFGRADE; ++i )
         {
           l      *= i;
           res[i] *= l;
-          //res[i] = res[i] * l;
         }
-
       }
 
-      /** Newton-Rhapson method for calculating the root of the rich polynomial. It uses the bisection method in the beginning
-       *  to get close enough to the root to allow the second stage newton method to converge faster. After 4 iterations of newton
-       *  precision is as good as single precision floating point will get you. We have introduced a few tuning parameters like the
-       *  newton gain factor and a slightly skewed bisection division, which in this particular case help to speed things up.
-       *  TODO: Once we are happy with the number of newton and bisection iterations, this function should be templated to the 
-       *  number of these iterations to allow loop unrolling and elimination of unnecessary branching
-       *  TODO: These tuning parameters have been found by low effort experimentation on random input data. A more detailed
-       *  study should be done with real data to find the best values
+      /** Newton-Rhapson method for calculating the root of the rich polynomial. It uses the bisection 
+       *  method in the beginning to get close enough to the root to allow the second stage newton method 
+       *  to converge faster. After 4 iterations of newton precision is as good as single precision 
+       *  floating point will get you. We have introduced a few tuning parameters like the newton gain 
+       *  factor and a slightly skewed bisection division, which in this particular case help to speed 
+       *  things up.
+       *  TODO: Once we are happy with the number of newton and bisection iterations, this function should 
+       *  be templated to the number of these iterations to allow loop unrolling and elimination of 
+       *  unnecessary branching.
+       *  TODO: These tuning parameters have been found by low effort experimentation on random input data. 
+       *  A more detailed study should be done with real data to find the best values.
        */
       template < class TYPE, std::size_t BISECTITS = 3, std::size_t NEWTONITS = 4,
                  typename std::enable_if<std::is_arithmetic<TYPE>::value>::type * = nullptr >
@@ -394,8 +386,7 @@ namespace Rich
         TYPE res[2] = { TYPE(0), TYPE(0) };
         for ( std::size_t i = 0; i < NEWTONITS; ++i )
         {
-          evalPolyHorner<TYPE, 4, 1>( a, res, m );
-          //epsilon = f4(a0,a1,a2,a3,a4,x) / df4(a0,a1,a2,a3,x);
+          evalPolyHorner<TYPE,4,1>( a, res, m );
           m -= gain * ( res[0] / res[1] );
         }
 
@@ -433,8 +424,7 @@ namespace Rich
         TYPE res[2] = { TYPE::Zero(), TYPE::Zero() };
         for ( std::size_t i = 0; i < NEWTONITS; ++i )
         {
-          evalPolyHorner<TYPE, 4, 1>( a, res, m );
-          //epsilon = f4(a0,a1,a2,a3,a4,x) / df4(a0,a1,a2,a3,x);
+          evalPolyHorner<TYPE,4,1>( a, res, m );
           m -= gain * ( res[0] / res[1] );
         }
 
diff --git a/Rich/RichRecUtils/RichRecUtils/RichRecPhotonKey.h b/Rich/RichRecUtils/RichRecUtils/RichRecPhotonKey.h
deleted file mode 100755
index 3b15b2224f3444e3af743b248af57334b1c3ac78..0000000000000000000000000000000000000000
--- a/Rich/RichRecUtils/RichRecUtils/RichRecPhotonKey.h
+++ /dev/null
@@ -1,167 +0,0 @@
-
-//-----------------------------------------------------------------------------
-/** @file RichRecPhotonKey.h
- *
- * Header file for utility class : RichRecPhotonKey
- *
- * @author Chris Jones   Christopher.Rob.Jones@cern.ch
- * @date   2003-06-20
- */
-//-----------------------------------------------------------------------------
-
-#ifndef RichRecBase_RichRecPhotonKey_H
-#define RichRecBase_RichRecPhotonKey_H 1
-
-// Gaudi
-#include "GaudiKernel/StreamBuffer.h"
-
-// boost
-#include "boost/cstdint.hpp"
-
-namespace Rich
-{
-  namespace Rec
-  {
-
-    /** @class PhotonKey RichRecPhotonKey.h RichRecBase/RichRecPhotonKey.h
-     *
-     *  Custom Key for RichRecPhotons. Encodes the parent RichRecSegment and
-     *  RichRecPixel key values into a unique key for each RichRecPhoton.
-     *
-     *  @author Chris Jones   Christopher.Rob.Jones@cern.ch
-     *  @date 15/02/2002
-     */
-
-    class PhotonKey final
-    {
-
-    public:
-
-      /// Type for packed fields
-      using PackedType = boost::uint16_t;
-
-      /// Type for overall word
-      using KeyType    = boost::uint32_t;
-
-    private:
-
-      /// Packed pixel and segment keys into a photon key
-      union Data
-      {
-        struct
-        {
-          PackedType pixelKey   : 16; ///< The pixel key
-          PackedType segmentKey : 16; ///< The segment key
-        } packed; ///< Representation as a packed struct
-        KeyType raw{0}; ///< Raw data (initialized to 0)
-      } m_data;
-
-    public:
-
-      /// Default Constructor
-      PhotonKey() = default;
-
-    public:
-
-      /** Constructor from a full int
-       *  @param key The raw data key to use as the bit-packed data
-       */
-      PhotonKey( const KeyType key ) noexcept { m_data.raw = key; }
-
-      /** Constructor from segment and pixel numbers
-       *
-       *  @param pixelKey    The key for the associated RichRecPixel
-       *  @param segmentKey  The key for the associated RichRecSegment
-       */
-      PhotonKey ( const PackedType& pixelKey,
-                  const PackedType& segmentKey )
-      {
-        m_data.packed.pixelKey   = pixelKey;
-        m_data.packed.segmentKey = segmentKey;
-      }
-
-    public:
-
-      /// Retrieve the full key
-      inline KeyType key() const noexcept
-      {
-        return m_data.raw;
-      }
-
-      /// KeyType operator
-      inline operator KeyType() const noexcept
-      {
-        return key();
-      }
-
-      /// Update the full key
-      inline void setKey( const KeyType & key ) noexcept
-      {
-        m_data.raw = key;
-      }
-
-    public:
-
-      /// Retrieve associated RichRecSegment key
-      inline PackedType segmentNumber() const noexcept
-      {
-        return m_data.packed.segmentKey;
-      }
-
-      /// Retrieve associated RichRecPixel key
-      inline PackedType pixelNumber() const noexcept
-      {
-        return m_data.packed.pixelKey;
-      }
-
-    public:
-
-      /// Operator ==
-      inline bool operator== ( const PhotonKey & k ) const noexcept
-      {
-        return k.key() == this->key();
-      }
-
-      /// Operator !=
-      inline bool operator!= ( const PhotonKey & k ) const noexcept
-      {
-        return k.key() != this->key();
-      }
-
-      /// Operator <
-      inline bool operator<  ( const PhotonKey & k ) const noexcept
-      {
-        return k.key() < this->key();
-      }
-
-      /// Operator >
-      inline bool operator>  ( const PhotonKey & k ) const noexcept
-      {
-        return k.key() > this->key();
-      }
-
-    public:
-
-      /// Fill the ASCII output stream
-      inline std::ostream& fillStream(std::ostream& s) const
-      {
-        return s << "{"
-                 << " pixel = "   << pixelNumber()
-                 << " segment = " << segmentNumber()
-                 << " photon = "  << key()
-                 << " } ";
-      }
-
-      /// Implement textual ostream << method for Rich::Rec::TrackID
-      friend inline std::ostream& operator << ( std::ostream& s,
-                                                const PhotonKey& key )
-      {
-        return key.fillStream(s);
-      }
-
-    };
-
-  }
-}
-
-#endif   // RichRecBase_RichRecPhotonKey_H
diff --git a/Rich/RichRecUtils/RichRecUtils/RichRecPixelParentType.h b/Rich/RichRecUtils/RichRecUtils/RichRecPixelParentType.h
deleted file mode 100755
index 7c043b1805dba9b56995587a5015eb892201e0ca..0000000000000000000000000000000000000000
--- a/Rich/RichRecUtils/RichRecUtils/RichRecPixelParentType.h
+++ /dev/null
@@ -1,73 +0,0 @@
-
-//-----------------------------------------------------------------------------
-/** @file RichRecPixelParentType.h
- *
- * Header file for RichRecPixel enumerations
- *
- * @author Chris Jones   Christopher.Rob.Jones@cern.ch
- * @date   2002-07-12
- */
-//-----------------------------------------------------------------------------
-
-#ifndef RICHRECBASE_RICHRECPIXELPARENTTYPE_H
-#define RICHRECBASE_RICHRECPIXELPARENTTYPE_H 1
-
-// Include files
-#include <string>
-#include <iostream>
-
-// from Gaudi
-#include "GaudiKernel/StreamBuffer.h"
-#include "GaudiKernel/MsgStream.h"
-
-namespace Rich
-{
-  namespace Rec
-  {
-
-    /** @namespace Rich::Rec::PixelParent
-     *
-     *  Namespace for information on the pixel parent type
-     *
-     *  @author Chris Jones  Christopher.Rob.Jones@cern.ch
-     *  @date   08/07/2004
-     */
-    namespace PixelParent
-    {
-
-      /** @enum Type
-       *
-       *  Enumeration for the various different pixel parent types
-       *
-       *  @author Chris Jones   Christopher.Rob.Jones@cern.ch
-       *  @date   2002-07-12
-       */
-      enum Type
-        {
-          Unknown = -1, ///< Parent type is unknown
-          Digit,        ///< Pixel derives from a reconstructed RichDigit
-          MCHit,        ///< Pixel derives from Monte Carlo MCRichHit information
-          RawBuffer,    ///< Pixel was derived directly from the RawBuffer
-          NoParent      ///< Pixel has no associated parent (e.g. artificially added background)
-        };
-
-    }
-
-    /// Text conversion for Rich::Rec::PixelParent::Type enumeration
-    std::string text( const Rich::Rec::PixelParent::Type parent ) ;
-
-  }
-
-  /// Backwards compatibility
-  inline std::string text( const Rich::Rec::PixelParent::Type parent ) { return Rich::Rec::text(parent); }
-
-}
-
-/// Implement textual ostream << method for Rich::RecTrack::Type enumeration
-inline std::ostream& operator << ( std::ostream& s,
-                                   const Rich::Rec::PixelParent::Type& pixel )
-{
-  return s << Rich::Rec::text( pixel );
-}
-
-#endif // RICHRECBASE_RICHRECPIXELPARENTTYPE_H
diff --git a/Rich/RichRecUtils/RichRecUtils/RichRecProcCode.h b/Rich/RichRecUtils/RichRecUtils/RichRecProcCode.h
deleted file mode 100755
index 0e7d49f2bd4630efaf3ad444fdb10298eb55a931..0000000000000000000000000000000000000000
--- a/Rich/RichRecUtils/RichRecUtils/RichRecProcCode.h
+++ /dev/null
@@ -1,39 +0,0 @@
-
-//-----------------------------------------------------------------------------
-/** @file RichRecProcCode.h
- *
- * Header file for enumeration Rich::Rec::ProcStat
- *
- * @author Chris Jones   Christopher.Rob.Jones@cern.ch
- * @date   2003-05-10
- */
-//-----------------------------------------------------------------------------
-
-#ifndef RICHRECBASE_RICHRECPROCCODE_H
-#define RICHRECBASE_RICHRECPROCCODE_H 1
-
-namespace Rich 
-{
-  namespace Rec 
-  {
-
-    /** @enum Rich::Rec::ProcStat
-     *
-     *  Enumeration for RICH reconstruction processing status codes
-     */
-    enum ProcStat
-      {
-        ProcStatAbort          = -1, ///< Processing was aborted prior to the RICH
-        NoRichPixels           = -2, ///< No RICH pixels were found
-        ReachedPixelLimit      = -3, ///< The maximum number of pixels was exceeded
-        NoRichTracks           = -4, ///< No tracks were found with RICH information
-        ReachedTrTrackLimit    = -5, ///< The maximum number of raw tracks was exceeded
-        ReachedRichTrackLimit  = -6, ///< The maximum number of tracks with RICH information was exceeded
-        ReachedRichPhotonLimit = -7  ///< The maximum number of RICH photon candidates was exceeded
-      };
-
-  }
-
-}
-
-#endif // RICHRECBASE_RICHRECPROCCODE_H
diff --git a/Rich/RichRecUtils/RichRecUtils/RichTrackID.h b/Rich/RichRecUtils/RichRecUtils/RichTrackID.h
deleted file mode 100755
index 2c1dbcec05483d4a3e4403059cd3b022ec2e6279..0000000000000000000000000000000000000000
--- a/Rich/RichRecUtils/RichRecUtils/RichTrackID.h
+++ /dev/null
@@ -1,341 +0,0 @@
-
-//-----------------------------------------------------------------------------
-/** @file RichTrackID.h
- *
- * Header file for utility class : RichTrackID
- *
- * @author Chris Jones   Christopher.Rob.Jones@cern.ch
- * @date   08/07/2004
- */
-//-----------------------------------------------------------------------------
-
-#ifndef RICHRECBASE_RICHTRACKID_H
-#define RICHRECBASE_RICHTRACKID_H 1
-
-// STL
-#include <string>
-#include <iostream>
-#include <array>
-
-// Event
-#include "Event/Track.h"
-namespace LHCb
-{
-  class MCParticle;
-  class MCRichTrack;
-}
-
-namespace Rich
-{
-  namespace Rec
-  {
-
-    /** @namespace Rich::Rec::Track
-     *
-     *  Namespace for track based qualities.
-     *
-     *  @author Chris Jones  Christopher.Rob.Jones@cern.ch
-     *  @date   08/07/2004
-     */
-    namespace Track
-    {
-
-      /// Number of Track types
-      static const unsigned int NTrTypes = 10;
-
-      /** @enum Rich::Rec::Track::Type
-       *
-       *  Enumeration for the various different track algorithm types
-       *  that are available.
-       *
-       *  @author Chris Jones  Christopher.Rob.Jones@cern.ch
-       clc     *  @date   08/07/2004
-      */
-      enum Type
-        {
-          Unknown     = -2, ///< Track algorithm type is not known
-          Unusable    = -1, ///< Track type is known, but is not usable by the RICH
-          Forward     =  0, ///< Track algorithm type is Forward
-          Match       =  1, ///< Track algorithm type is Match
-          Follow      =  2, ///< Track algorithm type is Follow
-          Seed        =  3, ///< Track algorithm type is Seed
-          VeloTT      =  4, ///< Track algorithm type is VeloTT
-          KsTrack     =  5, ///< Track algorithm type is KsTrack
-          Velo        =  6, ///< Track algorithm type is Velo
-          Trigger     =  7, ///< Track algorithm type Trigger track
-          MuonID      =  8, ///< Track produced by the Muon ID reconstruction
-          MCRichTrack =  9  ///< MCRichTrack track
-        };
-
-      /** Access the enumerated type for given Track
-       *
-       * @param track Pointer to a Track object
-       *
-       * @return enumerated type information
-       */
-      Rich::Rec::Track::Type type( const LHCb::Track * track );
-
-      /** Access the enumerated type for given MCRichTrack
-       *
-       * @param track Pointer to an MCRichTrack object
-       *
-       * @return enumerated type information
-       */
-      Rich::Rec::Track::Type type( const LHCb::MCRichTrack * track );
-
-      /** Converts a string name into the associated type enumeration
-       *
-       *  @param name Track type as a string
-       *
-       *  @return Track enumeration type
-       */
-      Rich::Rec::Track::Type type( const std::string & name );
-
-      /** Evaluate if a given track is potentially usable for the RICH reconstruction
-       *
-       *  @param type Track type enumeration
-       *
-       *  @return Boolean indicating the track usability
-       *  @retval true  Track is of a type that is usable by the RICH reconstruction
-       *  @retval false track type contains no RICH information
-       */
-      inline bool isUsable( const Rich::Rec::Track::Type type ) noexcept
-      {
-        return ( type != Rich::Rec::Track::Unusable );
-      }
-
-      /** Evaluate if track is potentially usable for the RICH reconstruction
-       *
-       *  @param track Pointer to a Track object
-       *
-       *  @return Boolean indicating the track usability
-       *  @retval true  Track is of a type that is usable by the RICH reconstruction
-       *  @retval false track type contains no RICH information
-       */
-      inline bool isUsable( const LHCb::Track * track )
-      {
-        return ( track ? Rich::Rec::Track::isUsable(Rich::Rec::Track::type(track)) : false );
-      }
-      
-      /// Type for fixed size arrays with track type information
-      template < typename TYPE >
-      using TrackTypeArray = std::array< TYPE, NTrTypes >;
-      
-    }
-
-    /** @namespace Rich::Rec::TrackParent
-     *
-     *  Namespace for information on the track parent type
-     *
-     *  @author Chris Jones  Christopher.Rob.Jones@cern.ch
-     *  @date   08/07/2004
-     */
-    namespace TrackParent
-    {
-
-      /** @enum Rich::Rec::TrackParent::Type
-       *
-       *  Enumeration for the various different pixel parent types
-       *
-       *  @author Chris Jones   Christopher.Rob.Jones@cern.ch
-       *  @date   2002-07-12
-       */
-      enum Type
-        {
-          Unknown = -1,   ///< Parent type is unknown
-          Track,          ///< Track derives from a reconstructed Track object
-          MCParticle,     ///< Track derives from Monte Carlo MCParticle information
-          MCRichTrack     ///< Track derives from Monte Carlo MCRichTrack information
-        };
-
-    }
-
-    /** @class TrackID RichRecUtils/RichTrackID.h
-     *
-     *  Utility class used as an indentification object for tracking objects used in
-     *  the RICH reconstruction software; such as Track and MCParticle.
-     *
-     *  @author Chris Jones   Christopher.Rob.Jones@cern.ch
-     *  @date   2003-09-23
-     */
-    class TrackID final
-    {
-
-    public:
-
-      /// Standard constructor
-      TrackID() { }
-
-    public:
-
-      /** Constructor from a Track
-       *
-       *  @param track Pointer to a Track
-       */
-      explicit TrackID( const LHCb::Track * track )
-        : m_tkType     ( Rich::Rec::Track::type(track)            ),
-          m_parentType ( Rich::Rec::TrackParent::Track            ),
-          m_unique     ( !track->checkFlag(LHCb::Track::Clone)    ) { }
-
-      /** Constructor from an MCParticle
-       */
-      explicit TrackID( const LHCb::MCParticle * )
-        : m_parentType ( Rich::Rec::TrackParent::MCParticle ) { }
-
-      /** Constructor from an MCRichTrack
-       */
-      explicit TrackID( const LHCb::MCRichTrack * )
-        : m_tkType     ( Rich::Rec::Track::MCRichTrack         ),
-          m_parentType ( Rich::Rec::TrackParent::MCRichTrack   ) { }
-
-      /** The track type
-       *
-       *  @return The track type enumeration
-       */
-      Rich::Rec::Track::Type trackType() const noexcept { return m_tkType; }
-
-      /** Set the track type
-       *
-       * @param type The track type enumeration
-       */
-      void setTrackType( const Rich::Rec::Track::Type type ) noexcept { m_tkType = type; }
-
-      /** The track parent type
-       *
-       *  @return The track parent type enumeration
-       */
-      Rich::Rec::TrackParent::Type parentType() const noexcept { return m_parentType; }
-
-      /** Set the parent type
-       *
-       *  @param type The track parent type enumeration
-       */
-      void setParentType( const Rich::Rec::TrackParent::Type type ) noexcept { m_parentType = type; }
-
-      /** Is this track unique
-       *
-       *  @return boolean indicatin if the track is flagged as unique or not
-       *  @retval true  Track is unique
-       *  @retval false Track is not unique, so possibly a clone
-       */
-      bool unique() const noexcept { return m_unique; }
-
-      /** Set if this track is unique
-       *
-       *  @param unique Boolean indicating the track uniqueness
-       */
-      void setUnique( const bool unique ) noexcept { m_unique = unique; }
-
-      /** Initialise from a Track
-       *
-       *  @param track Pointer to a Track from which to initialise
-       */
-      inline void initialiseFor( const LHCb::Track * track )
-      {
-        setParentType ( Rich::Rec::TrackParent::Track            );
-        setTrackType  ( Rich::Rec::Track::type(track)            );
-        setUnique     ( !track->checkFlag(LHCb::Track::Clone)    );
-      }
-
-      /** Initialise from a MCParticle
-       */
-      inline void initialiseFor( const LHCb::MCParticle * )
-      {
-        setParentType ( Rich::Rec::TrackParent::MCParticle );
-        setTrackType  ( Rich::Rec::Track::Unknown          );
-        setUnique     ( true                               );
-      }
-
-      /** Initialise from a MCRichTrack
-       */
-      inline void initialiseFor( const LHCb::MCRichTrack * )
-      {
-        setParentType ( Rich::Rec::TrackParent::MCRichTrack );
-        setTrackType  ( Rich::Rec::Track::MCRichTrack       );
-        setUnique     ( true                                );
-      }
-
-      /** Operator < For sorting
-       *
-       *  @param id ID object for comparision
-       */
-      inline bool operator < ( const TrackID & id ) const
-      {
-        return ( ( trackType()  < id.trackType()  ) &&
-                 ( parentType() < id.parentType() ) &&
-                 ( unique()   && !id.unique()     )   );
-      }
-
-    public:
-
-      /// Implement textual ostream << method for Rich::Rec::TrackID
-      friend inline std::ostream& operator << ( std::ostream& s,
-                                                const TrackID& id )
-      {
-        s << "{ " << std::endl
-          << " track type:\t" << id.trackType() << std::endl
-          << " parent type:\t" << id.parentType() << std::endl
-          << " unique:\t" << id.unique() <<  std::endl
-          << " } " << std::endl;
-        return s;
-      }
-
-    private: // data
-
-      /// The track type
-      Rich::Rec::Track::Type m_tkType { Rich::Rec::Track::Unknown };
-
-      /// The parent type
-      Rich::Rec::TrackParent::Type m_parentType { Rich::Rec::TrackParent::Unknown };
-
-      /// Is this track unique ?
-      bool m_unique { true };
-
-    };
-
-    /** Text conversion for Rich::Rec::Track::ParentType enumeration
-     *
-     *  @param parent Track parent type enumeration
-     *
-     *  @return Parent type as a string
-     */
-    std::string text( const Rich::Rec::TrackParent::Type parent ) ;
-
-    /** Text conversion for Rich::Rec::Track::Type enumeration
-     *
-     *  @param track Track type enumeration
-     *
-     *  @return Track type as a string
-     */
-    std::string text( const Rich::Rec::Track::Type track );
-
-    namespace Track
-    {
-      /// Implement textual ostream << method for Rich::Rec::Track::Type enumeration
-      inline std::ostream& operator << ( std::ostream& s,
-                                         const Rich::Rec::Track::Type& type )
-      {
-        return s << Rich::Rec::text( type );
-      }
-    }
-
-    namespace TrackParent
-    {
-      /// Implement textual ostream << method for Rich::Rec::TrackParent::Type enumeration
-      inline std::ostream& operator << ( std::ostream& s,
-                                         const Rich::Rec::TrackParent::Type& track )
-      {
-        return s << Rich::Rec::text( track );
-      }
-    }
-
-  }
-
-  /// Backwards compatibility
-  inline std::string text( const Rich::Rec::TrackParent::Type parent ) { return Rich::Rec::text(parent); }
-  /// Backwards compatibility
-  inline std::string text( const Rich::Rec::Track::Type track        ) { return Rich::Rec::text(track); }
-
-}
-
-#endif // RICHRECBASE_RICHTRACKID_H
diff --git a/Rich/RichRecUtils/dict/RichRecUtilsDict.h b/Rich/RichRecUtils/dict/RichRecUtilsDict.h
index 66f203add5700771ebdd997456032f59dffdb85f..1ca422277bebe24fd52feeaf8c39c6997f6eaca3 100755
--- a/Rich/RichRecUtils/dict/RichRecUtilsDict.h
+++ b/Rich/RichRecUtils/dict/RichRecUtilsDict.h
@@ -1,10 +1,7 @@
 #ifndef DICT_RICHRECUTILSDICT_H 
 #define DICT_RICHRECUTILSDICT_H 1
 
-#include "RichUtils/RichObjPtn.h"
 #include "RichRecUtils/RichRadCorrLocalPositions.h"
-#include "RichRecUtils/RichRecPhotonKey.h"
-#include "RichRecUtils/RichTrackID.h"
 #include "RichRecUtils/RichCKResolutionFitter.h"
 
 // instantiate some templated classes, to get them into the dictionary
@@ -12,8 +9,7 @@ namespace
 {
   struct _Instantiations 
   {
-    Rich::ObjPtn<Rich::Rec::RadCorrLocalPositions> obj_1;
-    Rich::Rec::CKResolutionFitter                  obj_2;
+    Rich::Rec::CKResolutionFitter  obj_1;
   };
 }
 
diff --git a/Rich/RichRecUtils/dict/RichRecUtilsDict.xml b/Rich/RichRecUtils/dict/RichRecUtilsDict.xml
index 9c49f5d2c244239986cec288929119ac896afee1..c21eda9e2fd56647f390c76b0c0b4fc556a71892 100755
--- a/Rich/RichRecUtils/dict/RichRecUtilsDict.xml
+++ b/Rich/RichRecUtils/dict/RichRecUtilsDict.xml
@@ -1,11 +1,6 @@
 <lcgdict>
 
   <class name = "Rich::Rec::RadCorrLocalPositions" />
-  <class name = "Rich::ObjPtn&lt;Rich::Rec::RadCorrLocalPositions&gt;" />
-
-  <class name = "Rich::Rec::TrackID" />
-
-  <class name = "Rich::Rec::PhotonKey" />
 
   <class name = "Rich::Rec::CKResolutionFitter" />
   <class name = "Rich::Rec::CKResolutionFitter::FitParams" />
diff --git a/Rich/RichRecUtils/src/RichRecPixelParentType.cpp b/Rich/RichRecUtils/src/RichRecPixelParentType.cpp
deleted file mode 100755
index 8a6ea49c0534de4e4f2f3ac9db5d3f63d4c75c71..0000000000000000000000000000000000000000
--- a/Rich/RichRecUtils/src/RichRecPixelParentType.cpp
+++ /dev/null
@@ -1,26 +0,0 @@
-
-//-----------------------------------------------------------------------------
-/** @file RichRecPixelParentType.cpp
- *
- *  Implementation ile for RichRecPixel enumerations
- *
- *  @author Chris Jones    Christopher.Rob.Jones@cern.ch
- *  @date   2003-05-10
- */
-//-----------------------------------------------------------------------------
-
-// local
-#include "RichRecUtils/RichRecPixelParentType.h"
-
-// Text conversion for Rich::RecPixel::ParentType enumeration
-std::string Rich::Rec::text( const Rich::Rec::PixelParent::Type parent )
-{
-  switch( parent )
-  {
-  case Rich::Rec::PixelParent::RawBuffer:   return "RawBuffer";
-  case Rich::Rec::PixelParent::Digit:       return "RichDigit";
-  case Rich::Rec::PixelParent::MCHit:       return "MCRichHit";
-  case Rich::Rec::PixelParent::NoParent:    return "No Parent";
-  default:                                  return "SHOULD NEVER SEE THIS";
-  }
-}
diff --git a/Rich/RichRecUtils/src/RichTrackID.cpp b/Rich/RichRecUtils/src/RichTrackID.cpp
deleted file mode 100755
index 150ea44b761c923a0ec7c82375733549e659123c..0000000000000000000000000000000000000000
--- a/Rich/RichRecUtils/src/RichTrackID.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-
-//-----------------------------------------------------------------------------
-/** @file RichTrackID.cpp
- *
- *  Implementation file for class : RichTrackID
- *
- *  @author Chris Jones    Christopher.Rob.Jones@cern.ch
- *  @date   2003-09-23
- */
-//-----------------------------------------------------------------------------
-
-// local
-#include "RichRecUtils/RichTrackID.h"
-
-// STD
-#include <sstream>
-
-// from Gaudi
-#include "GaudiKernel/MsgStream.h"
-#include "GaudiKernel/GaudiException.h"
-
-// Text conversion for Rich::RecTrack::ParentType enumeration
-std::string Rich::Rec::text( const Rich::Rec::TrackParent::Type parent )
-{
-  switch( parent )
-  {
-  case Rich::Rec::TrackParent::Type::Track:          return "Track";
-  case Rich::Rec::TrackParent::Type::MCParticle:     return "MCParticle";
-  case Rich::Rec::TrackParent::Type::MCRichTrack:    return "MCRichTrack";
-  default:                                     return "SHOULD NEVER SEE THIS";
-  }
-}
-
-// Text conversion for Rich::RecTrack::ParentType enumeration
-std::string Rich::Rec::text( const Rich::Rec::Track::Type track )
-{
-  switch( track )
-  {
-  case Rich::Rec::Track::Type::Trigger:      return "Trigger"; // Place first for speed
-  case Rich::Rec::Track::Type::Forward:      return "Forward";
-  case Rich::Rec::Track::Type::Match:        return "Match";
-  case Rich::Rec::Track::Type::KsTrack:      return "KsTrack";
-  case Rich::Rec::Track::Type::VeloTT:       return "VeloTT";
-  case Rich::Rec::Track::Type::Seed:         return "Seed";
-  case Rich::Rec::Track::Type::Follow:       return "Follow";
-  case Rich::Rec::Track::Type::Velo:         return "Velo";
-  case Rich::Rec::Track::Type::MuonID:       return "MuonID";
-  case Rich::Rec::Track::Type::Unknown:      return "Unknown";
-  case Rich::Rec::Track::Type::Unusable:     return "Unusable";
-  case Rich::Rec::Track::Type::MCRichTrack:  return "MCRichTrack";
-  default:                             return "SHOULD NEVER SEE THIS";
-  }
-}
-
-Rich::Rec::Track::Type Rich::Rec::Track::type( const std::string & name )
-{
-  if      ( "Trigger"     == name ) { return Rich::Rec::Track::Type::Trigger;     }
-  else if ( "Forward"     == name ) { return Rich::Rec::Track::Type::Forward;     }
-  else if ( "Match"       == name ) { return Rich::Rec::Track::Type::Match;       }
-  else if ( "KsTrack"     == name ) { return Rich::Rec::Track::Type::KsTrack;     }
-  else if ( "VeloTT"      == name ) { return Rich::Rec::Track::Type::VeloTT;      }
-  else if ( "Seed"        == name ) { return Rich::Rec::Track::Type::Seed;        }
-  else if ( "Follow"      == name ) { return Rich::Rec::Track::Type::Follow;      }
-  else if ( "Velo"        == name ) { return Rich::Rec::Track::Type::Velo;        }
-  else if ( "MuonID"      == name ) { return Rich::Rec::Track::Type::MuonID;      }
-  else if ( "Unknown"     == name ) { return Rich::Rec::Track::Type::Unknown;     }
-  else if ( "Unusable"    == name ) { return Rich::Rec::Track::Type::Unusable;    }
-  else if ( "MCRichTrack" == name ) { return Rich::Rec::Track::Type::MCRichTrack; }
-  else
-  { // Should not get here ...
-    throw GaudiException( "Unknown track string name '"+name+"'",
-                          "*Rich::Rec::Track::type*", StatusCode::FAILURE );
-    return Rich::Rec::Track::Type::Unknown;
-  }
-}
-
-// Returns the enumerated type for a given Track
-Rich::Rec::Track::Type Rich::Rec::Track::type( const LHCb::Track * track )
-{
-  if ( track )
-  {
-    // track algorithm type
-    const LHCb::Track::History hist = (LHCb::Track::History)track->history();
-    // check all known track types (order according to abundance)
-    // Forward types
-    if      ( LHCb::Track::History::PatForward    == hist ||
-              LHCb::Track::PrForward     == hist )  { return Rich::Rec::Track::Type::Forward;  }
-    // match track types
-    else if ( LHCb::Track::History::TrackMatching == hist ||
-              LHCb::Track::History::PatMatch      == hist ||
-              LHCb::Track::PrMatch       == hist )  { return Rich::Rec::Track::Type::Match;    }
-    // seed types
-    else if ( LHCb::Track::History::TsaTrack      == hist ||
-              LHCb::Track::History::PatSeeding    == hist ||
-              LHCb::Track::PrSeeding     == hist )  { return Rich::Rec::Track::Type::Seed;     }
-    // veloTT types
-    else if ( LHCb::Track::History::PatVeloTT     == hist ||
-              LHCb::Track::PrVeloUT      == hist )  { return Rich::Rec::Track::Type::VeloTT;   }
-    // Ks Tracks
-    else if ( LHCb::Track::History::PatKShort     == hist ||
-              LHCb::Track::History::PatDownstream == hist ||
-              LHCb::Track::PrDownstream  == hist )  { return Rich::Rec::Track::Type::KsTrack;  }
-    // Velo only tracks (from any source)
-    else if ( LHCb::Track::Types::Velo  == track->type() ||
-              LHCb::Track::VeloR == track->type() ) { return Rich::Rec::Track::Type::Velo;     }
-    // Muon ID
-    else if ( LHCb::Track::MuonID        == hist )  { return Rich::Rec::Track::Type::MuonID;   }
-    // MC or ideal tracking
-    else if ( LHCb::Track::TrackIdealPR  == hist )  { return Rich::Rec::Track::Type::MCRichTrack; }
-    // Imported HLT tracks
-    else if ( LHCb::Track::History::HLTImportedTrack == hist )
-    {
-      switch( track->type() )
-      {
-      case LHCb::Track::Types::Downstream:
-        return Rich::Rec::Track::Type::KsTrack;
-      case LHCb::Track::Types::VeloR:
-      case LHCb::Track::Types::Velo:
-        return Rich::Rec::Track::Type::Velo;
-      case LHCb::Track::Types::Upstream:
-        return Rich::Rec::Track::Type::VeloTT;
-      case LHCb::Track::Types::Ttrack:
-        return Rich::Rec::Track::Type::Seed;
-      case LHCb::Track::Types::Long:
-      default:
-        return Rich::Rec::Track::Type::Forward;
-      }
-    }
-    else
-    { // Should not get here ...
-      std::ostringstream mess;
-      mess << "Unknown Track type : Track::History = " << track->history();
-      throw GaudiException( mess.str(), "*Rich::Rec::Track::type*", StatusCode::FAILURE );
-    }
-  }
-
-  // Should not get here either ...
-  throw GaudiException( "Null Track pointer", "*Rich::Rec::Track::type*", StatusCode::FAILURE );
-}
-
-Rich::Rec::Track::Type Rich::Rec::Track::type( const LHCb::MCRichTrack * track )
-{
-  if ( UNLIKELY(!track) )
-  {
-    throw GaudiException( "Null Track pointer", "*Rich::Rec::Track::type*", StatusCode::FAILURE );
-  }
-  return Rich::Rec::Track::Type::MCRichTrack;
-}
diff --git a/Tf/TrackSys/python/TrackSys/Configuration.py b/Tf/TrackSys/python/TrackSys/Configuration.py
index bfecb7977a6fc954b73366b838d6ac0c09c5c331..2b7ca2ad392c96a933516a32550572d2b29dd89a 100755
--- a/Tf/TrackSys/python/TrackSys/Configuration.py
+++ b/Tf/TrackSys/python/TrackSys/Configuration.py
@@ -81,6 +81,16 @@ class TrackSys(LHCbConfigurableUser):
                              "Match"            : {"Location":"Rec/Track/Match",                   "BestUsed":False},
                              "Downstream"       : {"Location":"Rec/Track/Downstream",              "BestUsed":False}}
 
+    DefaultKeyedTrackLocations = {"Velo"             : {"Location":"Rec/Track/Copy/Velo",                    "BestUsed":False},
+                                  "VeloFitted"       : {"Location":"Rec/Track/Copy/Velo",                    "BestUsed":False},
+                                  "Upstream"         : {"Location":"Rec/Track/Copy/Upstream",                "BestUsed":False},
+                                  "ForwardFast"      : {"Location":"Rec/Track/Copy/ForwardFast",             "BestUsed":False},
+                                  "ForwardFastFitted": {"Location":"Rec/Track/Copy/ForwardFastFitted",       "BestUsed":False},
+                                  "ForwardBest"      : {"Location":"Rec/Track/Copy/ForwardBest",             "BestUsed":False},
+                                  "Seeding"          : {"Location":"Rec/Track/Copy/Seed",                    "BestUsed":False},
+                                  "Match"            : {"Location":"Rec/Track/Copy/Match",                   "BestUsed":False},
+                                  "Downstream"       : {"Location":"Rec/Track/Copy/Downstream",              "BestUsed":False}}
+    
 
     ## Available Pat Reco algorithms
     AvailablePatRecoAlgos = [ "Velo", "FastVelo", "VeloTT", "Forward", "ForwardHLT1","ForwardHLT2","TsaSeed", "PatSeed", "Match", "PatMatch", "PatLongLivedTracking" ]
@@ -253,7 +263,7 @@ class TrackSys(LHCbConfigurableUser):
         if self.getProp( "WithMC" ):
             if useUpgrade :
                 from TrackSys import PrUpgradeChecking
-                PrUpgradeChecking.PrUpgradeChecking(defTracks = self.DefaultTrackLocations)
+                PrUpgradeChecking.PrUpgradeChecking(defTracks = self.DefaultKeyedTrackLocations)
 
             else :
                 from TrackSys import PatChecking
diff --git a/Tf/TrackSys/python/TrackSys/PrUpgradeChecking.py b/Tf/TrackSys/python/TrackSys/PrUpgradeChecking.py
index 211c93ede44d618b0575cb6de289e3c57d7065bf..047b97ecd85d3ce5127ebb1d8c9569d5e7381fe2 100755
--- a/Tf/TrackSys/python/TrackSys/PrUpgradeChecking.py
+++ b/Tf/TrackSys/python/TrackSys/PrUpgradeChecking.py
@@ -2,61 +2,78 @@ from Gaudi.Configuration import GaudiSequencer
 from TrackSys.Configuration import *
 from GaudiKernel.SystemOfUnits import mm
 
-def PrUpgradeChecking(defTracks = {}):
-   ### match hits and tracks
-   log.warning("Run upgrade checkers.")
-   from Configurables import UnpackMCParticle, UnpackMCVertex, PrLHCbID2MCParticle
-   # Check if VP is part of the list of detectors.
-   from Configurables import LHCbApp, VPClusterLinker
-   withVP = False
-   if hasattr(LHCbApp(), "Detectors"):
-      if LHCbApp().isPropertySet("Detectors"):
-         if 'VP' in LHCbApp().upgradeDetectors(): withVP = True
-   trackTypes = TrackSys().getProp("TrackTypes")
-   if "Truth" in trackTypes :
-      truthSeq = GaudiSequencer("RecoTruthSeq")
-      truthSeq.Members = [UnpackMCParticle(), UnpackMCVertex()]
-      if withVP: truthSeq.Members += [VPClusterLinker()]
-      truthSeq.Members += [PrLHCbID2MCParticle()]
-   else:
-      if withVP:
-        GaudiSequencer("MCLinksTrSeq").Members = [VPClusterLinker(), PrLHCbID2MCParticle()]
-      else:
-        GaudiSequencer("MCLinksTrSeq").Members = [PrLHCbID2MCParticle()]
-   
-   from Configurables import PrTrackAssociator
-   GaudiSequencer("MCLinksTrSeq").Members += [ PrTrackAssociator() ]
 
-   #PrChecker2
-   from Configurables import PrChecker2
-   from Configurables import LoKi__Hybrid__MCTool
-   MCHybridFactory = LoKi__Hybrid__MCTool("MCHybridFactory")
-   MCHybridFactory.Modules = [ "LoKiMC.decorators" ]
-   #FAST
-   GaudiSequencer("CheckPatSeq").Members+=[PrChecker2("PrChecker2Fast",VeloTracks = "", MatchTracks ="", SeedTracks="",DownTracks="",UpTracks="", TriggerNumbers = True,BestTracks="")]
-   PrChecker2("PrChecker2Fast").addTool( MCHybridFactory )
-   PrChecker2("PrChecker2Fast").Upgrade = True 
-   PrChecker2("PrChecker2Fast").ForwardTracks = defTracks["ForwardFast"]["Location"]
-   PrChecker2("PrChecker2Fast").Eta25Cut = True
-   PrChecker2("PrChecker2Fast").GhostProbCut = 0.9
-   #PrChecker2("PrChecker2Fast").WriteTexOutput = True
-   #PrChecker2("PrChecker2Fast").TexOutputFolder = "texfilesFast/"
-   #PrChecker2("PrChecker2Fast").TexOutputName = "PrChecker2Fast"
-   #BEST
-   GaudiSequencer("CheckPatSeq").Members+=[PrChecker2("PrChecker2")]                                          
-   PrChecker2("PrChecker2").addTool( MCHybridFactory )
-   PrChecker2("PrChecker2").Upgrade = True 
-   PrChecker2("PrChecker2").ForwardTracks = ForwardTracks=defTracks["ForwardBest"]["Location"]
-   PrChecker2("PrChecker2").UpTracks = UpTracks=defTracks["Upstream"]["Location"]
-   PrChecker2("PrChecker2").Eta25Cut = True
-   PrChecker2("PrChecker2").GhostProbCut = 0.9
-   #PrChecker2("PrChecker2").WriteTexOutput = True
-   #PrChecker2("PrChecker2").TexOutputFolder = "texfiles/"
-   #PrChecker2("PrChecker2").TexOutputName = "PrChecker2"
-   
-   #Track resolution checker fast stage
-   from Configurables import TrackResChecker
-   GaudiSequencer("CheckPatSeq").Members  += [ TrackResChecker("TrackResCheckerFast")];
-   TrackResChecker("TrackResCheckerFast").HistoPrint = False
-   TrackResChecker("TrackResCheckerFast").TracksInContainer = defTracks["ForwardFastFitted"]["Location"]
+def PrUpgradeChecking(defTracks={}):
+    # match hits and tracks
+    log.warning("Run upgrade checkers.")
 
+    from Configurables import (UnpackMCParticle, UnpackMCVertex,
+                               PrLHCbID2MCParticle)
+    # Check if VP is part of the list of detectors.
+    from Configurables import LHCbApp, VPCluster2MCParticleLinker
+    withVP = False
+    if hasattr(LHCbApp(), "Detectors"):
+        if LHCbApp().isPropertySet("Detectors"):
+            if 'VP' in LHCbApp().upgradeDetectors():
+                withVP = True
+    trackTypes = TrackSys().getProp("TrackTypes")
+    from Configurables import PrTrackConverter
+
+    if "Truth" in trackTypes:
+        truthSeq = GaudiSequencer("RecoTruthSeq")
+        truthSeq.Members = [UnpackMCParticle(), UnpackMCVertex()]
+        if withVP:
+            truthSeq.Members += [VPCluster2MCParticleLinker()]
+        truthSeq.Members += [PrLHCbID2MCParticle()]
+    else:
+        if withVP:
+            GaudiSequencer("MCLinksTrSeq").Members = [
+                VPCluster2MCParticleLinker(), PrLHCbID2MCParticle()]
+        else:
+            GaudiSequencer("MCLinksTrSeq").Members = [PrLHCbID2MCParticle()]
+
+    from Configurables import PrTrackAssociator
+    GaudiSequencer("MCLinksTrSeq").Members += [PrTrackAssociator()]
+
+    # PrChecker2
+    from Configurables import PrChecker2
+    from Configurables import LoKi__Hybrid__MCTool
+    MCHybridFactory = LoKi__Hybrid__MCTool("MCHybridFactory")
+    MCHybridFactory.Modules = ["LoKiMC.decorators"]
+    # FAST
+    checker2 = PrChecker2("PrChecker2Fast", VeloTracks="", MatchTracks="",
+                          SeedTracks="", DownTracks="", UpTracks="",
+                          TriggerNumbers=True, BestTracks="")
+    GaudiSequencer("CheckPatSeq").Members += [checker2]
+    PrChecker2("PrChecker2Fast").addTool(MCHybridFactory)
+    PrChecker2("PrChecker2Fast").Upgrade = True
+    PrChecker2("PrChecker2Fast").VeloTracks = defTracks["Velo"]["Location"]
+    #PrChecker2("PrChecker2Fast").NewTracks  = defTracks["VeloFitted"]["Location"]
+    #PrChecker2("PrChecker2Fast").ForwardTracks = defTracks["ForwardFast"]["Location"]
+    PrChecker2("PrChecker2Fast").Eta25Cut = True
+    PrChecker2("PrChecker2Fast").GhostProbCut = 0.9
+    # PrChecker2("PrChecker2Fast").WriteTexOutput = True
+    # PrChecker2("PrChecker2Fast").TexOutputFolder = "texfilesFast/"
+    # PrChecker2("PrChecker2Fast").TexOutputName = "PrChecker2Fast"
+    # BEST
+    GaudiSequencer("CheckPatSeq").Members += [PrChecker2("PrChecker2")]
+    PrChecker2("PrChecker2").addTool(MCHybridFactory)
+    PrChecker2("PrChecker2").Upgrade = True
+    forwardTracks = defTracks["ForwardBest"]["Location"]
+    PrChecker2("PrChecker2").ForwardTracks = forwardTracks
+    PrChecker2("PrChecker2").UpTracks = defTracks["Upstream"]["Location"]
+    PrChecker2("PrChecker2").Eta25Cut = True
+    PrChecker2("PrChecker2").GhostProbCut = 0.9
+    # PrChecker2("PrChecker2").WriteTexOutput = True
+    # PrChecker2("PrChecker2").TexOutputFolder = "texfiles/"
+    # PrChecker2("PrChecker2").TexOutputName = "PrChecker2"
+
+    #Track resolution checker fast stage
+    from Configurables import TrackResChecker
+    GaudiSequencer("CheckPatSeq").Members  += [ TrackResChecker("TrackResCheckerFast")];
+    TrackResChecker("TrackResCheckerFast").HistoPrint = False
+    TrackResChecker("TrackResCheckerFast").TracksInContainer = defTracks["ForwardFastFitted"]["Location"]
+    
+    log.warning("Pre-appending a track copy in TES from vector<Track> to KeyedContainer to allow truth matching, this is an hack, not a final solution")
+    from Configurables import PrTrackConverter
+    GaudiSequencer("MCLinksTrSeq").Members.insert(0,  PrTrackConverter() )
diff --git a/Tr/ParameterizedKalman/src/CompareTracks.cpp b/Tr/ParameterizedKalman/src/CompareTracks.cpp
index ebb275a3f59776e60cce1dc773ec0f82109d2a4b..1f5447cd78c678d95bb50a7039cae61c0b40dd53 100644
--- a/Tr/ParameterizedKalman/src/CompareTracks.cpp
+++ b/Tr/ParameterizedKalman/src/CompareTracks.cpp
@@ -1,4 +1,4 @@
-// Include files 
+// Include files
 
 // from Gaudi
 #include "Event/State.h"
@@ -47,23 +47,23 @@ void CompareTracks::operator()(const LHCb::Tracks& tracks1, const LHCb::Tracks&
                                const LHCb::ODIN& odin, const LHCb::LinksByKey& links) const {
 
   if ( msgLevel(MSG::DEBUG) ) debug() << "==> Execute" << endmsg;
- 
+
   if(tracks1.empty() || tracks2.empty()){
    return;
   }
- 
+
   //Create output tuple
-  //Create a new file for every event in order to be threadsafe 
+  //Create a new file for every event in order to be threadsafe
   TFile outputFile((m_FileName.toString()+"_"+std::to_string(odin.runNumber())+
                     "_"+std::to_string(odin.eventNumber())+".root").c_str(),"RECREATE");
 
   //create the varaibles to be filled
   tupleVars vars;
-  
+
   //create the tree
   TTree tree("compare","compare");
   addBranches(tree, &vars);
-    
+
   //Loop over tracks1
   for(auto const &track1 : tracks1){
     //Search for the respective track in tracks2
@@ -72,7 +72,7 @@ void CompareTracks::operator()(const LHCb::Tracks& tracks1, const LHCb::Tracks&
     if(i==std::end(tracks2)){
       warning() << "No matching track in second container found" << endmsg;
       return;
-    } 
+    }
 
     //compare the tracks and fill the tuple
 
@@ -87,7 +87,7 @@ void CompareTracks::operator()(const LHCb::Tracks& tracks1, const LHCb::Tracks&
     FillNtuple(*track1, *(*(i)), links, &vars, zBeam, 0, true);
 
     //2. ...
-    
+
     //3. ...
 
     tree.Fill();
@@ -95,7 +95,7 @@ void CompareTracks::operator()(const LHCb::Tracks& tracks1, const LHCb::Tracks&
 
   outputFile.Write();
   outputFile.Close();
-  
+
   return;
 }
 
@@ -103,7 +103,7 @@ void CompareTracks::operator()(const LHCb::Tracks& tracks1, const LHCb::Tracks&
 //  Add branches to the tuple that will be filled with the comparison information
 //==================================================================================================
 void CompareTracks::addBranches(TTree &tree, tupleVars *treeVars) const {
-  
+
   //Set the branches
   tree.Branch("sF_sigmaxx_T"     , &(treeVars->m_sF_P[2][0 ])      , "sF_sigmaxx_T/D");
   tree.Branch("sF_sigmayy_T"     , &(treeVars->m_sF_P[2][2 ])      , "sF_sigmayy_T/D");
@@ -126,7 +126,7 @@ void CompareTracks::addBranches(TTree &tree, tupleVars *treeVars) const {
   tree.Branch("sF_tx_T"          , &(treeVars->m_sF_x[2][2])       , "sF_tx_T/D");
   tree.Branch("sF_ty_T"          , &(treeVars->m_sF_x[2][3])       , "sF_ty_T/D");
   tree.Branch("sF_qop_T"         , &(treeVars->m_sF_x[2][4])       , "sF_qop_T/D");
-  
+
   tree.Branch("sF_z_T"           , &(treeVars->m_sF_z[2])          , "sF_z_T/D");
 
   tree.Branch("sF_true_x_T"      , &(treeVars->m_sF_true_x[2][0])  , "sF_true_x_T/D");
@@ -134,7 +134,7 @@ void CompareTracks::addBranches(TTree &tree, tupleVars *treeVars) const {
   tree.Branch("sF_true_tx_T"     , &(treeVars->m_sF_true_x[2][2])  , "sF_true_tx_T/D");
   tree.Branch("sF_true_ty_T"     , &(treeVars->m_sF_true_x[2][3])  , "sF_true_ty_T/D");
   tree.Branch("sF_true_qop_T"    , &(treeVars->m_sF_true_x[2][4])  , "sF_true_qop_T/D");
-  
+
   tree.Branch("sF_sigmaxx_V"     , &(treeVars->m_sF_P[0][0 ])      , "sF_sigmaxx_V/D");
   tree.Branch("sF_sigmayy_V"     , &(treeVars->m_sF_P[0][2 ])      , "sF_sigmayy_V/D");
   tree.Branch("sF_sigmatxtx_V"   , &(treeVars->m_sF_P[0][5 ])      , "sF_sigmatxtx_V/D");
@@ -156,7 +156,7 @@ void CompareTracks::addBranches(TTree &tree, tupleVars *treeVars) const {
   tree.Branch("sF_tx_V"          , &(treeVars->m_sF_x[0][2])       , "sF_tx_V/D");
   tree.Branch("sF_ty_V"          , &(treeVars->m_sF_x[0][3])       , "sF_ty_V/D");
   tree.Branch("sF_qop_V"         , &(treeVars->m_sF_x[0][4])       , "sF_qop_V/D");
- 
+
   tree.Branch("sF_z_V"           , &(treeVars->m_sF_z[0])          , "sF_z_V/D");
 
   tree.Branch("sF_true_x_V"      , &(treeVars->m_sF_true_x[0][0])  , "sF_true_x_V/D");
@@ -164,7 +164,7 @@ void CompareTracks::addBranches(TTree &tree, tupleVars *treeVars) const {
   tree.Branch("sF_true_tx_V"     , &(treeVars->m_sF_true_x[0][2])  , "sF_true_tx_V/D");
   tree.Branch("sF_true_ty_V"     , &(treeVars->m_sF_true_x[0][3])  , "sF_true_ty_V/D");
   tree.Branch("sF_true_qop_V"    , &(treeVars->m_sF_true_x[0][4])  , "sF_true_qop_V/D");
-  
+
   tree.Branch("sF_sigmaxx"       , &(treeVars->m_sF_P[1][0 ])      , "sF_sigmaxx/D");
   tree.Branch("sF_sigmayy"       , &(treeVars->m_sF_P[1][2 ])      , "sF_sigmayy/D");
   tree.Branch("sF_sigmatxtx"     , &(treeVars->m_sF_P[1][5 ])      , "sF_sigmatxtx/D");
@@ -186,7 +186,7 @@ void CompareTracks::addBranches(TTree &tree, tupleVars *treeVars) const {
   tree.Branch("sF_tx"            , &(treeVars->m_sF_x[1][2])       , "sF_tx/D");
   tree.Branch("sF_ty"            , &(treeVars->m_sF_x[1][3])       , "sF_ty/D");
   tree.Branch("sF_qop"           , &(treeVars->m_sF_x[1][4])       , "sF_qop/D");
-  
+
   tree.Branch("sF_z"             , &(treeVars->m_sF_z[1])          , "sF_z/D");
   tree.Branch("sF_chi2"          , &(treeVars->m_sF_chi2)          ,"sF_chi2/D");
   tree.Branch("sF_ndof"          , &(treeVars->m_sF_ndof)          ,"sF_ndof/D");
@@ -196,7 +196,7 @@ void CompareTracks::addBranches(TTree &tree, tupleVars *treeVars) const {
   tree.Branch("sF_true_tx"       , &(treeVars->m_sF_true_x[1][2])  , "sF_true_tx/D");
   tree.Branch("sF_true_ty"       , &(treeVars->m_sF_true_x[1][3])  , "sF_true_ty/D");
   tree.Branch("sF_true_qop"      , &(treeVars->m_sF_true_x[1][4])  , "sF_true_qop/D");
-  
+
   tree.Branch("dF_sigmaxx_T"     , &(treeVars->m_dF_P[2][0 ])      , "dF_sigmaxx_T/D");
   tree.Branch("dF_sigmayy_T"     , &(treeVars->m_dF_P[2][2 ])      , "dF_sigmayy_T/D");
   tree.Branch("dF_sigmatxtx_T"   , &(treeVars->m_dF_P[2][5 ])      , "dF_sigmatxtx_T/D");
@@ -218,7 +218,7 @@ void CompareTracks::addBranches(TTree &tree, tupleVars *treeVars) const {
   tree.Branch("dF_tx_T"          , &(treeVars->m_dF_x[2][2])       , "dF_tx_T/D");
   tree.Branch("dF_ty_T"          , &(treeVars->m_dF_x[2][3])       , "dF_ty_T/D");
   tree.Branch("dF_qop_T"         , &(treeVars->m_dF_x[2][4])       , "dF_qop_T/D");
-  
+
   tree.Branch("dF_z_T"           , &(treeVars->m_dF_z[2])          , "dF_z_T/D");
 
   tree.Branch("dF_true_x_T"      , &(treeVars->m_dF_true_x[2][0])  , "dF_true_x_T/D");
@@ -226,7 +226,7 @@ void CompareTracks::addBranches(TTree &tree, tupleVars *treeVars) const {
   tree.Branch("dF_true_tx_T"     , &(treeVars->m_dF_true_x[2][2])  , "dF_true_tx_T/D");
   tree.Branch("dF_true_ty_T"     , &(treeVars->m_dF_true_x[2][3])  , "dF_true_ty_T/D");
   tree.Branch("dF_true_qop_T"    , &(treeVars->m_dF_true_x[2][4])  , "dF_true_qop_T/D");
-  
+
   tree.Branch("dF_sigmaxx_V"     , &(treeVars->m_dF_P[0][0 ])      , "dF_sigmaxx_V/D");
   tree.Branch("dF_sigmayy_V"     , &(treeVars->m_dF_P[0][2 ])      , "dF_sigmayy_V/D");
   tree.Branch("dF_sigmatxtx_V"   , &(treeVars->m_dF_P[0][5 ])      , "dF_sigmatxtx_V/D");
@@ -248,7 +248,7 @@ void CompareTracks::addBranches(TTree &tree, tupleVars *treeVars) const {
   tree.Branch("dF_tx_V"          , &(treeVars->m_dF_x[0][2])       , "dF_tx_V/D");
   tree.Branch("dF_ty_V"          , &(treeVars->m_dF_x[0][3])       , "dF_ty_V/D");
   tree.Branch("dF_qop_V"         , &(treeVars->m_dF_x[0][4])       , "dF_qop_V/D");
- 
+
   tree.Branch("dF_z_V"           , &(treeVars->m_dF_z[0])          , "dF_z_V/D");
 
   tree.Branch("dF_true_x_V"      , &(treeVars->m_dF_true_x[0][0])  , "dF_true_x_V/D");
@@ -256,7 +256,7 @@ void CompareTracks::addBranches(TTree &tree, tupleVars *treeVars) const {
   tree.Branch("dF_true_tx_V"     , &(treeVars->m_dF_true_x[0][2])  , "dF_true_tx_V/D");
   tree.Branch("dF_true_ty_V"     , &(treeVars->m_dF_true_x[0][3])  , "dF_true_ty_V/D");
   tree.Branch("dF_true_qop_V"    , &(treeVars->m_dF_true_x[0][4])  , "dF_true_qop_V/D");
-  
+
   tree.Branch("dF_sigmaxx"       , &(treeVars->m_dF_P[1][0 ])      , "dF_sigmaxx/D");
   tree.Branch("dF_sigmayy"       , &(treeVars->m_dF_P[1][2 ])      , "dF_sigmayy/D");
   tree.Branch("dF_sigmatxtx"     , &(treeVars->m_dF_P[1][5 ])      , "dF_sigmatxtx/D");
@@ -278,7 +278,7 @@ void CompareTracks::addBranches(TTree &tree, tupleVars *treeVars) const {
   tree.Branch("dF_tx"            , &(treeVars->m_dF_x[1][2])       , "dF_tx/D");
   tree.Branch("dF_ty"            , &(treeVars->m_dF_x[1][3])       , "dF_ty/D");
   tree.Branch("dF_qop"           , &(treeVars->m_dF_x[1][4])       , "dF_qop/D");
-  
+
   tree.Branch("dF_z"             , &(treeVars->m_dF_z[1])          , "dF_z/D");
   tree.Branch("dF_chi2"          , &(treeVars->m_dF_chi2)          ,"dF_chi2/D");
   tree.Branch("dF_ndof"          , &(treeVars->m_dF_ndof)          ,"dF_ndof/D");
@@ -288,9 +288,9 @@ void CompareTracks::addBranches(TTree &tree, tupleVars *treeVars) const {
   tree.Branch("dF_true_tx"       , &(treeVars->m_dF_true_x[1][2])  , "dF_true_tx/D");
   tree.Branch("dF_true_ty"       , &(treeVars->m_dF_true_x[1][3])  , "dF_true_ty/D");
   tree.Branch("dF_true_qop"      , &(treeVars->m_dF_true_x[1][4])  , "dF_true_qop/D");
-  
+
   tree.Branch("true_qop_vertex"  , &(treeVars->m_true_qop_vertex)  , "true_qop_vertex/D");
-  
+
   tree.Branch("MCstatus"         , &(treeVars->m_MC_status)        , "MCstatus/I");
 }
 
@@ -312,10 +312,10 @@ void CompareTracks::FillNtuple(const LHCb::Track &track1, const LHCb::Track &tra
 
   //covariance matrices
   Gaudi::TrackSymMatrix covMat1;
-  covMat1 = state1->covariance();  
-  
+  covMat1 = state1->covariance();
+
   Gaudi::TrackSymMatrix covMat2;
-  covMat2 = state2->covariance();  
+  covMat2 = state2->covariance();
 
   if(!sc1.isSuccess() || !sc2.isSuccess()) return;
 
@@ -332,8 +332,8 @@ void CompareTracks::FillNtuple(const LHCb::Track &track1, const LHCb::Track &tra
   vars->m_sF_x[nPos][2] = state1->tx();
   vars->m_sF_x[nPos][3] = state1->ty();
   vars->m_sF_x[nPos][4] = state1->qOverP();
-  
-  vars->m_sF_true_x[nPos][0] = trueX; 
+
+  vars->m_sF_true_x[nPos][0] = trueX;
   vars->m_sF_true_x[nPos][1] = trueY;
   vars->m_sF_true_x[nPos][2] = trueTX;
   vars->m_sF_true_x[nPos][3] = trueTY;
@@ -344,8 +344,8 @@ void CompareTracks::FillNtuple(const LHCb::Track &track1, const LHCb::Track &tra
   vars->m_dF_x[nPos][2] = state2->tx();
   vars->m_dF_x[nPos][3] = state2->ty();
   vars->m_dF_x[nPos][4] = state2->qOverP();
-  
-  vars->m_dF_true_x[nPos][0] = trueX; 
+
+  vars->m_dF_true_x[nPos][0] = trueX;
   vars->m_dF_true_x[nPos][1] = trueY;
   vars->m_dF_true_x[nPos][2] = trueTX;
   vars->m_dF_true_x[nPos][3] = trueTY;
@@ -356,23 +356,23 @@ void CompareTracks::FillNtuple(const LHCb::Track &track1, const LHCb::Track &tra
   vars->m_sF_z[nPos] = z;
 
   vars->m_dF_z[nPos] = z;
-  
+
   int k =0;
   for(int i=0;i<5;i++){
     for(int j=0;j<=i;j++){
-      vars->m_sF_P[nPos][k] = covMat1(i,j); 
-      vars->m_dF_P[nPos][k] = covMat2(i,j); 
+      vars->m_sF_P[nPos][k] = covMat1(i,j);
+      vars->m_dF_P[nPos][k] = covMat2(i,j);
       k++;
     }
   }
 
-  //Set other track varaibles 
-  vars->m_sF_ndof = track1.nDoF(); 
-  vars->m_sF_chi2 = track1.chi2(); 
-  
-  vars->m_dF_ndof = track2.nDoF(); 
-  vars->m_dF_chi2 = track2.chi2(); 
- 
+  //Set other track varaibles
+  vars->m_sF_ndof = track1.nDoF();
+  vars->m_sF_chi2 = track1.chi2();
+
+  vars->m_dF_ndof = track2.nDoF();
+  vars->m_dF_chi2 = track2.chi2();
+
 }
 
 //==================================================================================================
@@ -388,16 +388,16 @@ int CompareTracks::MatchesMC(const LHCb::Track &track, const LHCb::LinksByKey& l
   }
   auto mcpart = trackLinks.begin()->to();
   if(!mcpart)return 0;
- 
-  //check quality of matching 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+
+  //check quality of matching
+  const MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
   if ( 0 == trackInfo.fullInfo( mcpart ) ) return 2;
   bool isLong  = trackInfo.hasVeloAndT( mcpart );
   isLong = isLong && ( abs( mcpart->particleID().pid() ) != 11 ); // and not electron
   if(!isLong) return 2;
   bool eta25       = (mcpart->momentum().Eta() > 1.8 && mcpart->momentum().Eta() < 5.3);
   if(!eta25) return 2;
-  
+
   if(std::fabs(track.pseudoRapidity() -  mcpart->momentum().Eta()) >0.05) return 2;
   return 1;
 }
diff --git a/Tr/ParameterizedKalman/src/ParameterizedKalmanFit_Checker_include.icpp b/Tr/ParameterizedKalman/src/ParameterizedKalmanFit_Checker_include.icpp
index 9e4f67f0604c6ba523e678bedb56084c028aa85a..34075126445aa8fdb391dee9b7a6fc525e79e660 100644
--- a/Tr/ParameterizedKalman/src/ParameterizedKalmanFit_Checker_include.icpp
+++ b/Tr/ParameterizedKalman/src/ParameterizedKalmanFit_Checker_include.icpp
@@ -41,7 +41,7 @@ int ParameterizedKalmanFit_Checker::MatchesMC(const trackInfo &tI) const {
   if(!mcpart)return 0;
 
   //check quality of matching
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  const MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
   if ( 0 == trackInfo.fullInfo( mcpart ) ) return 2;
   bool isLong  = trackInfo.hasVeloAndT( mcpart );
   isLong = isLong && ( abs( mcpart->particleID().pid() ) != 11 ); // and not electron
@@ -92,7 +92,6 @@ void ParameterizedKalmanFit_Checker::fillInfoForExtrapolation(double z_prev, dou
   //Create the true state at the previous z position
   double tr_x[5];
   TrueState(z_prev,tr_x[0],tr_x[1],tr_x[2],tr_x[3],tr_x[4],tI,false);//qop at position
-  tr_x[4]=-tr_x[4];
   Gaudi::TrackVector stateVec(tr_x,5);
   double C[15]={0};
   Gaudi::TrackSymMatrix covMat(C,15);
@@ -737,7 +736,7 @@ void ParameterizedKalmanFit_Checker::PredictStateTFT_Ch(int forward, Gaudi::Vect
   tV->m_x_prev      = tV->m_x;
   tV->m_true_x_prev = tV->m_true_x;
   tV->m_z_prev      = tV->m_z;
-  fillInfoForExtrapolation(tV->m_z_prev, tV->m_z, tI, tV);
+  fillInfoForExtrapolation(tV->m_z_prev, lastz, tI, tV);
 
   std::copy_n(x.Array(), 5, std::begin(tV->m_x));
   std::copy_n(C.Array(), 15, std::begin(tV->m_P));
diff --git a/Tr/PatChecker/src/CheatedPrimaryVertices.cpp b/Tr/PatChecker/src/CheatedPrimaryVertices.cpp
index 9ace3a3fee774cdf7179992be04a89af77077566..fd495881be215ee11d7c8b84f6fae3b61d471265 100755
--- a/Tr/PatChecker/src/CheatedPrimaryVertices.cpp
+++ b/Tr/PatChecker/src/CheatedPrimaryVertices.cpp
@@ -57,7 +57,6 @@ StatusCode CheatedPrimaryVertices::execute() {
 
   if(msgLevel(MSG::DEBUG)) debug() << "Execute" << endmsg;
 
-  MCTrackInfo trInfo( evtSvc(), msgSvc() );
   LinkedTo<LHCb::MCParticle> trackMClink( evtSvc(), msgSvc(),
                                           LHCb::TrackLocation::Default);
   m_inputTracks = get<LHCb::Tracks>(m_inputTracksName);
diff --git a/Tr/PatChecker/src/PatChecker.cpp b/Tr/PatChecker/src/PatChecker.cpp
index a4ec2d4c2e6c2490c2a8949540fcbcf826735b91..ca78b7fc286ed9a0ecc69329242da4cc27576a88 100755
--- a/Tr/PatChecker/src/PatChecker.cpp
+++ b/Tr/PatChecker/src/PatChecker.cpp
@@ -223,7 +223,7 @@ StatusCode PatChecker::execute() {
   LHCb::MCParticles* mcParts =
     get<LHCb::MCParticles>( LHCb::MCParticleLocation::Default );
 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
 
   //== Build a table (vector of vectors) of ids per MCParticle, indexed by MCParticle key.
   AllLinks<LHCb::MCParticle,ContainedObject> allIds( evtSvc(), msgSvc(), "Pat/LHCbID" );
diff --git a/Tr/PatChecker/src/PatKShortChecker.cpp b/Tr/PatChecker/src/PatKShortChecker.cpp
index 52224f5de9d03fe1db6aad51a7016c9796acd286..c61c1e2e65a8516ab502268093a2f8f31a684817 100755
--- a/Tr/PatChecker/src/PatKShortChecker.cpp
+++ b/Tr/PatChecker/src/PatKShortChecker.cpp
@@ -79,7 +79,7 @@ StatusCode PatKShortChecker::execute() {
   TrAsct::DirectType* seedTable =  m_seedToMCP->direct();
   TrAsct::DirectType* downTable =  m_downToMCP->direct();
 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
 
   LHCb::MCParticles::const_iterator itP;
   LHCb::Tracks::const_iterator itT;
diff --git a/Tr/PatChecker/src/PrimaryVertexChecker.cpp b/Tr/PatChecker/src/PrimaryVertexChecker.cpp
index 5c88c527c0e3be4fb5544dc4479414d8165d5b83..99699e56d01dfa1c5794f582650e99af31c18004 100644
--- a/Tr/PatChecker/src/PrimaryVertexChecker.cpp
+++ b/Tr/PatChecker/src/PrimaryVertexChecker.cpp
@@ -785,7 +785,7 @@ int  PrimaryVertexChecker::count_velo_tracks(LHCb::RecVertex* RecVtx){
 
 void PrimaryVertexChecker::count_reconstructible_mc_particles(std::vector<MCPVInfo>& mcpvvec) {
 
-  MCTrackInfo trInfo(eventSvc(), msgSvc());
+  const MCTrackInfo trInfo = make_MCTrackInfo(eventSvc(), msgSvc());
   std::vector<MCPVInfo>::iterator itinfomc;
   for(itinfomc = mcpvvec.begin(); mcpvvec.end() != itinfomc; itinfomc++) {
     LHCb::MCVertex* avtx = itinfomc->pMCPV;
diff --git a/Tr/PatFitParams/src/MatchFitParams.cpp b/Tr/PatFitParams/src/MatchFitParams.cpp
index 6067e461d3f796488d914acc3eeb85c12824ccef..0010defe39539b10f782cd6afccc04abbdd099e2 100644
--- a/Tr/PatFitParams/src/MatchFitParams.cpp
+++ b/Tr/PatFitParams/src/MatchFitParams.cpp
@@ -1,5 +1,4 @@
-// $Id: KsFitParams.cpp,v 1.5 2009/08/19 14:24:18 ocallot Exp $
-// Include files 
+// Include files
 
 // from Gaudi
 #include "GaudiKernel/SystemOfUnits.h"
@@ -40,7 +39,7 @@ MatchFitParams::MatchFitParams( const std::string& name,
   declareProperty( "zMatchY"        ,   m_zMatchY           =  8420*Gaudi::Units::mm    );
   declareProperty( "RequireTTHits"  ,   m_requireTTHits     = false    );
   declareProperty( "MagnetScaleFactor", m_magnetScaleFactor = -1 );
-  
+
   m_nEvent = 0;
   m_nTrack = 0;
 }
@@ -62,17 +61,17 @@ StatusCode MatchFitParams::initialize() {
   if( m_zMagParams.empty() ) info() << "no starting values for magnet parameters provided. Will not calculate anything" << endmsg;
   if( m_momParams.empty() ) info() << "no starting values for momentum  parameters provided. Will not calculate anything" << endmsg;
   if( m_bendYParams.empty() ) info() << "no starting values for y bending  parameters provided. Will not calculate anything" << endmsg;
-  
-  
+
+
   m_zMagPar.init( "zMagnet"  , m_zMagParams );
   m_momPar.init ( "momentum" , m_momParams );
   m_bendParamY.init( "bendParamY", m_bendYParams);
-  
+
   info() << "Magnet scale factor is: " << m_magnetScaleFactor << endmsg;
-  
-  
+
+
   m_fitTool = tool<FitTool>( "FitTool" );
-  
+
   return StatusCode::SUCCESS;
 }
 //=============================================================================
@@ -85,7 +84,7 @@ StatusCode MatchFitParams::execute() {
   m_nEvent++;
 
   debug() << "Processing event: " << m_nEvent << endmsg;
-  
+
 
 
   LHCb::MCParticles* partCtnr = get<LHCb::MCParticles>( LHCb::MCParticleLocation::Default );
@@ -103,14 +102,14 @@ StatusCode MatchFitParams::execute() {
   LHCb::MCParticles::const_iterator pItr;
   const LHCb::MCParticle* part;
   SmartRefVector<LHCb::MCVertex> vDecay;
-  
+
   // A container for used hits
   std::vector<Gaudi::XYZPoint> trHits;
   std::vector<Gaudi::XYZPoint> TTHits;
   std::vector<Gaudi::XYZPoint> vHits;
 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
-  
+  const MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
+
 
   for ( pItr = partCtnr->begin(); partCtnr->end() != pItr; pItr++ ) {
     part = *pItr;
@@ -152,16 +151,16 @@ StatusCode MatchFitParams::execute() {
       }
     }
     if ( hasInteractionVertex ) continue;
-    
-   
-    
+
+
+
 
     debug() << "--- Found particle key " << part->key() << endmsg;
-    
+
     TTHits.clear();
     trHits.clear();
     vHits.clear();
-    
+
     // Get the Velo hits
     for ( LHCb::MCHits::const_iterator vHitIt = veloHits->begin() ;
           veloHits->end() != vHitIt ; vHitIt++ ) {
@@ -169,25 +168,25 @@ StatusCode MatchFitParams::execute() {
         vHits.push_back( (*vHitIt)->midPoint() );
       }
     }
-    
+
     // Get the IT hits
-    for ( LHCb::MCHits::const_iterator iHitIt = itHits->begin() ; 
+    for ( LHCb::MCHits::const_iterator iHitIt = itHits->begin() ;
           itHits->end() != iHitIt ; iHitIt++ ) {
       if ( (*iHitIt)->mcParticle() ==  part ) {
         trHits.push_back( (*iHitIt)->midPoint() );
       }
     }
-    
+
     // Get the TT hits
-    for ( LHCb::MCHits::const_iterator iHittt = ttHits->begin() ; 
+    for ( LHCb::MCHits::const_iterator iHittt = ttHits->begin() ;
           ttHits->end() != iHittt ; iHittt++ ) {
       if ( (*iHittt)->mcParticle() ==  part ) {
         TTHits.push_back( (*iHittt)->midPoint() );
       }
     }
-    
+
     // Get the OT hits
-    for ( LHCb::MCHits::const_iterator oHitIt = otHits->begin() ; 
+    for ( LHCb::MCHits::const_iterator oHitIt = otHits->begin() ;
           otHits->end() != oHitIt ; oHitIt++ ) {
       if ( (*oHitIt)->mcParticle() ==  part ) {
         trHits.push_back( (*oHitIt)->midPoint() );
@@ -197,38 +196,38 @@ StatusCode MatchFitParams::execute() {
     if( m_requireTTHits){
       if( 3 > TTHits.size() ) continue;
     }
-    
+
 
     debug() << " particle momentum = " << part->momentum().R() / Gaudi::Units::GeV << " GeV"
             << endmsg;
-    
+
     //== Fill ntuple
     double pz = part->momentum().Z();
     double plXT = part->momentum().X() / pz;
     double plYT = part->momentum().Y() / pz;
-    
+
     Tuple tTrack = nTuple( m_tupleName, m_tupleName );
-    
+
     tTrack->column("pz",pz);
     tTrack->column("plXT", plXT);
     tTrack->column("plYT", plYT);
-    
-    
+
+
     m_nTrack++;
-    
+
     //== Fit the TT area
-    // -- This is not needed at the moment for the matching, but it was kept it 
+    // -- This is not needed at the moment for the matching, but it was kept it
     // -- as it might be used at some point in the future
     double axt, bxt, ayt, byt, dz;
     double axt2,bxt2,cxt2;
-    
+
     debug() << "  TT: ";
     m_fitTool->fitLine( TTHits, 0, m_zTT1, axt, bxt );
     m_fitTool->fitLine( TTHits, 1, m_zTT1, ayt, byt );
     m_fitTool->fitParabola( TTHits, 0, m_zTT1, axt2, bxt2, cxt2 );
     //m_fitTool->fitLine( TTHits, 1, m_zTT1, ayt, byt, cyt );
     debug() << format( " x %7.1f tx %7.4f   y %7.1f ty %7.4f ",
-                       axt, bxt, ayt, byt ) 
+                       axt, bxt, ayt, byt )
             << endmsg;;
     tTrack->column( "axt" , axt );
     tTrack->column( "bxt", bxt );
@@ -237,8 +236,8 @@ StatusCode MatchFitParams::execute() {
     tTrack->column( "axt2", axt2 );
     tTrack->column( "bxt2", bxt2 );
     tTrack->column( "cxt2", cxt2 );
-    
-    
+
+
     std::vector<Gaudi::XYZPoint>::const_iterator itP;
     if ( msgLevel( MSG::DEBUG ) ) {
       for ( itP = TTHits.begin(); TTHits.end() > itP; itP++ ) {
@@ -254,7 +253,7 @@ StatusCode MatchFitParams::execute() {
                            ) << endmsg;
       }
     }
-    
+
     // -- Fit the T-stations
     // -- x(z) = ax + bx*z + cx*z*z + dx*z*z*z
     // -- y(z) = ay + by*z
@@ -267,11 +266,11 @@ StatusCode MatchFitParams::execute() {
     tTrack->column( "dx", dx );
     tTrack->column( "ay", ay );
     tTrack->column( "by", by );
-    
+
     if ( msgLevel( MSG::DEBUG ) ) {
-      debug() << format( "  tr: x%7.1f %7.4f %7.3f %7.3f  y%7.1f %7.4f", 
+      debug() << format( "  tr: x%7.1f %7.4f %7.3f %7.3f  y%7.1f %7.4f",
                          ax, bx, 1.e6*cx, 1.e9*dx, ay, by ) << endmsg;
-      
+
       for ( itP = trHits.begin(); trHits.end() > itP; itP++ ) {
         dz = (*itP).z()-m_zRef;
         debug() << format( "    : %7.1f %7.1f %7.1f  dx %7.3f  dy %7.3f",
@@ -281,7 +280,7 @@ StatusCode MatchFitParams::execute() {
                            ) << endmsg;
       }
     }
-    
+
     // -- Fit the velo area
     // -- x(z) = axv + bxv*z
     // -- y(z) = ayv + byv*z
@@ -292,11 +291,11 @@ StatusCode MatchFitParams::execute() {
     tTrack->column( "bxv", bxv );
     tTrack->column( "ayv", ayv );
     tTrack->column( "byv", byv );
-    
+
     if ( msgLevel( MSG::DEBUG ) ) {
-      debug() << format( "  velo: x%7.1f %7.4f y%7.1f %7.4f", 
+      debug() << format( "  velo: x%7.1f %7.4f y%7.1f %7.4f",
                          axv, bxv, ayv, byv ) << endmsg;
-      
+
       for ( itP = vHits.begin(); vHits.end() > itP; itP++ ) {
         dz = (*itP).z()-m_zRef;
         debug() << format( "    : %7.1f %7.1f %7.1f  dx %7.3f  dy %7.3f",
@@ -306,14 +305,14 @@ StatusCode MatchFitParams::execute() {
                            ) << endmsg;
       }
     }
-    
+
     // -- This is for finding the zMagnet position when using straight lines from the Velo and the T-stations
     // -- Only really makes sense in x, as for y the different y resolutions of Velo and T-stations matter a lot
     double zMagnet = (axv-bxv*m_zVelo - (ax-bx*m_zRef) ) / (bx-bxv);
     double zMagnety = (ayt-byt*m_zTT1 - (ay-by*m_zRef) ) / (by-byt);
     double dSlope =  fabs(bx - bxv);
     double dSlopeY = fabs(by - byv);
-   
+
     m_zMagPar.setFun( 0, 1. );
     m_zMagPar.setFun( 1, dSlope*dSlope );
     //m_zMagPar.setFun( 2, ax*ax );
@@ -323,7 +322,7 @@ StatusCode MatchFitParams::execute() {
     m_zMagPar.setFun( 4, fabs(ax) );
 
     double zEst = m_zMagPar.sum();
-    
+
     m_zMagPar.addEvent( zMagnet-zEst );
 
     tTrack->column( "zEst", zEst );
@@ -332,41 +331,41 @@ StatusCode MatchFitParams::execute() {
 
     // -- This is the parameter that defines the bending in y
     double bendParamY = (ay - ayv) + ( m_zMatchY - m_zRef )*by - (m_zMatchY - m_zVelo)*byv;
-    
+
     m_bendParamY.setFun( 0, dSlope*dSlope*byv );
     m_bendParamY.setFun( 1, dSlopeY*dSlopeY*byv );
-    
+
     double bendParamYEst = m_bendParamY.sum();
     m_bendParamY.addEvent( bendParamY - bendParamYEst );
     // ------------------------------------------------------
-    
+
     tTrack->column("dSlope",dSlope);
     tTrack->column("dSlope2",dSlope*dSlope);
-  
+
     // -- Need to write something to calculate the momentum Params
     const double charge = part->particleID().threeCharge()/3;
     const double qOverP = charge/momentum;
-    
-    // -- The magnet scale factor is hardcoded, as then one does not need to run the 
-    // -- field service 
+
+    // -- The magnet scale factor is hardcoded, as then one does not need to run the
+    // -- field service
     const double proj = sqrt( ( 1. + bxv*bxv + byv*byv ) / ( 1. + bxv*bxv ) );
     const double coef = (bxv - bx)/(proj*m_magnetScaleFactor*Gaudi::Units::GeV*qOverP);
-    
+
     m_momPar.setFun(0, 1.);
     m_momPar.setFun(1, bx*bx );
     m_momPar.setFun(2, bx*bx*bx*bx );
     m_momPar.setFun(3, bx*bxv );
     m_momPar.setFun(4, byv*byv );
     m_momPar.setFun(5, byv*byv*byv*byv );
-    
+
     double coefEst = m_momPar.sum();
     m_momPar.addEvent( coef - coefEst );
-    
+
     tTrack->write();
-    
+
 
   }
-  
+
   return StatusCode::SUCCESS;
 }
 //=============================================================================
diff --git a/Tr/PatFitParams/src/PatLongLivedParams.cpp b/Tr/PatFitParams/src/PatLongLivedParams.cpp
index 60abbe5c096cb67a3da7db42febefffb6ace9d01..db606530869e006998b1a2b2adc7b2939aabda4c 100644
--- a/Tr/PatFitParams/src/PatLongLivedParams.cpp
+++ b/Tr/PatFitParams/src/PatLongLivedParams.cpp
@@ -1,4 +1,4 @@
-// Include files 
+// Include files
 
 // from Gaudi
 #include "GaudiKernel/SystemOfUnits.h"
@@ -61,15 +61,15 @@ StatusCode PatLongLivedParams::initialize() {
   if ( sc.isFailure() ) return sc;  // error printed already by GaudiAlgorithm
 
   debug() << "==> Initialize" << endmsg;
-  
+
   m_zMagPar.init( "zMagnet"  , m_zMagParams );
   m_momPar.init ( "momentum" , m_momParams );
   m_curvature.init ( "curvature" , m_curvatureParams );
   m_yPar.init ( "yPar" , m_yParams );
   m_yPar2.init ( "yPar2" , m_yParams2 );
-  
+
   m_fitTool = tool<FitTool>( "FitTool" );
-  
+
   return StatusCode::SUCCESS;
 }
 
@@ -83,14 +83,14 @@ StatusCode PatLongLivedParams::execute() {
 
   // -- As this algorithm is the only one running, even the usual counter is not included.
   if( m_nEvent % 100 == 0 ) info() << "Event " << m_nEvent << endmsg;
-  
+
 
   if( m_resolution ){
     resolution();
     return StatusCode::SUCCESS;
   }
-  
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
 
   LHCb::MCParticles* partCtnr = get<LHCb::MCParticles>( LHCb::MCParticleLocation::Default );
 
@@ -104,24 +104,24 @@ StatusCode PatLongLivedParams::execute() {
   LHCb::MCParticles::const_iterator pItr;
   const LHCb::MCParticle* part;
   SmartRefVector<LHCb::MCVertex> vDecay;
-  
+
   const LHCb::MCParticle* kShort  = 0;
   const LHCb::MCVertex*   kDecay  = 0;
-  
+
   // A container for used hits
   std::vector<Gaudi::XYZPoint> trHits;
   std::vector<Gaudi::XYZPoint> TTHits;
-  
+
   for ( pItr = partCtnr->begin(); partCtnr->end() != pItr; pItr++ ) {
     part = *pItr;
 
     if(  !trackInfo.hasT( part ) || !trackInfo.hasTT( part ) ) continue;
     // -- optimise for downstream tracks.
     if( trackInfo.hasVelo( part ) ) continue;
-    
-    
+
+
     // Find the Pi from the kShort
-    if ( 211 == std::abs(part->particleID().pid())  ) { 
+    if ( 211 == std::abs(part->particleID().pid())  ) {
       kDecay = part->originVertex();
       if ( 0 == kDecay ) continue;
       kShort = kDecay->mother();
@@ -138,14 +138,14 @@ StatusCode PatLongLivedParams::execute() {
         if ( (*itV)->position().z() < 9500. ) hasInteractionVertex = true;
       }
       if ( hasInteractionVertex ) continue;
-    
+
       debug() << "--- Found pi key " << part->key() << endmsg;
-    
+
       TTHits.clear();
       trHits.clear();
-   
+
       // Get the IT hits
-      for ( LHCb::MCHits::const_iterator iHitIt = itHits->begin() ; 
+      for ( LHCb::MCHits::const_iterator iHitIt = itHits->begin() ;
             itHits->end() != iHitIt ; iHitIt++ ) {
         if ( (*iHitIt)->mcParticle() ==  part ) {
           trHits.push_back( (*iHitIt)->midPoint() );
@@ -153,7 +153,7 @@ StatusCode PatLongLivedParams::execute() {
       }
 
       // Get the TT hits
-      for ( LHCb::MCHits::const_iterator iHittt = ttHits->begin() ; 
+      for ( LHCb::MCHits::const_iterator iHittt = ttHits->begin() ;
             ttHits->end() != iHittt ; iHittt++ ) {
         if ( (*iHittt)->mcParticle() ==  part ) {
           TTHits.push_back( (*iHittt)->midPoint() );
@@ -161,7 +161,7 @@ StatusCode PatLongLivedParams::execute() {
       }
 
       // Get the OT hits
-      for ( LHCb::MCHits::const_iterator oHitIt = otHits->begin() ; 
+      for ( LHCb::MCHits::const_iterator oHitIt = otHits->begin() ;
             otHits->end() != oHitIt ; oHitIt++ ) {
         if ( (*oHitIt)->mcParticle() ==  part ) {
           trHits.push_back( (*oHitIt)->midPoint() );
@@ -169,16 +169,16 @@ StatusCode PatLongLivedParams::execute() {
       }
       if ( 3  > TTHits.size() || 12 > trHits.size() )  continue;
 
-      debug() << "=== Found a good K0S Decay : " 
-              << kShort->key() << " decay at " 
-              << format( "%7.1f %7.1f %7.1f", 
+      debug() << "=== Found a good K0S Decay : "
+              << kShort->key() << " decay at "
+              << format( "%7.1f %7.1f %7.1f",
                          kDecay->position().x(),
                          kDecay->position().y(),
                          kDecay->position().z() )
               << endmsg;
       debug() << " pion momentum = " << part->momentum().R() / Gaudi::Units::GeV << " GeV"
               << endmsg;
-      
+
       //== Fill ntuple
       double pz = kShort->momentum().Z();
       double kSlXT = kShort->momentum().X() / pz;
@@ -200,17 +200,17 @@ StatusCode PatLongLivedParams::execute() {
       tTrack->column( "moment",  part->momentum().R() );
       tTrack->column( "slopeX",  part->momentum().X() / pz );
       tTrack->column( "slopeY",  part->momentum().Y() / pz );
-    
+
       //== Fit the TT area
       double axt, bxt, ayt, byt, dz;
       double axt2,bxt2,cxt2;
-      
+
       debug() << "  TT: ";
       m_fitTool->fitLine( TTHits, 0, m_zTT1, axt, bxt );
       m_fitTool->fitLine( TTHits, 1, m_zTT1, ayt, byt );
       m_fitTool->fitParabola( TTHits, 0, m_zTT1, axt2, bxt2, cxt2 );
       debug() << format( " x %7.1f tx %7.4f   y %7.1f ty %7.4f ",
-                         axt, bxt, ayt, byt ) 
+                         axt, bxt, ayt, byt )
               << endmsg;
       tTrack->column( "axt" , axt );
       tTrack->column( "bxt", bxt );
@@ -231,7 +231,7 @@ StatusCode PatLongLivedParams::execute() {
                              ) << endmsg;
         }
       }
-      
+
       double ax, bx, cx, dx, ay, by;
       m_fitTool->fitCubic( trHits, 0, m_zRef, ax, bx, cx, dx );
       m_fitTool->fitLine(  trHits, 1, m_zRef, ay, by );
@@ -241,15 +241,15 @@ StatusCode PatLongLivedParams::execute() {
       tTrack->column( "dx", dx );
       tTrack->column( "ay", ay );
       tTrack->column( "by", by );
-      
-      
-      
-      
+
+
+
+
 
       if ( msgLevel( MSG::DEBUG ) ) {
-        debug() << format( "  tr: x%7.1f %7.4f %7.3f %7.3f  y%7.1f %7.4f", 
+        debug() << format( "  tr: x%7.1f %7.4f %7.3f %7.3f  y%7.1f %7.4f",
                            ax, bx, 1.e6*cx, 1.e9*dx, ay, by ) << endmsg;
-        
+
         for ( itP = trHits.begin(); trHits.end() > itP; itP++ ) {
           dz = (*itP).z()-m_zRef;
           debug() << format( "    : %7.1f %7.1f %7.1f  dx %7.3f  dy %7.3f",
@@ -259,14 +259,14 @@ StatusCode PatLongLivedParams::execute() {
                              ) << endmsg;
         }
       }
-      
+
       double zMagnet = (axt-bxt*m_zTT1 - (ax-bx*m_zRef) ) / (bx-bxt);
       tTrack->column( "zMagnet", zMagnet );
       double zMagnety = (ayt-byt*m_zTT1 - (ay-by*m_zRef) ) / (by-byt);
       tTrack->column( "zMagnety", zMagnety );
 
       const double yMagnet = ayt + (zMagnet-m_zTT1)*byt;
-      
+
       double dSlope =  fabs(bx - bxt);
       //double dSlope2 =  (bx - bxt);
       tTrack->column("dSlope",dSlope);
@@ -281,41 +281,41 @@ StatusCode PatLongLivedParams::execute() {
       double dSlope2 =  (bx - bxt);
       for ( itP = TTHits.begin(); TTHits.end() > itP; itP++ ) {
         Tuple tTrack2 = nTuple( "Track2", "Track2" );
-          
+
         dz = (*itP).z()-m_zTT1;
         double dx2 = (*itP).x()-(axt+bxt*dz);
         tTrack2->column( "dx2", dx2 );
         tTrack2->column( "dz2", dz );
         tTrack2->column( "dSlope2", dSlope2);
         tTrack2->column( "moment2", part->momentum().R() );
-        
+
         tTrack2->write();
       }
-      
+
       //m_curvature.setFun(0,0.0);
       m_curvature.setFun(0,dSlope2);
-      
+
       double cEst = m_curvature.sum();
       m_curvature.addEvent(cxt2-cEst);
       tTrack->column("curvature",cxt2);
       tTrack->column("dSlope2",dSlope2);
-      
+
       double zEst = m_zMagPar.sum();
       tTrack->column( "zEst", zEst );
       m_zMagPar.addEvent( zMagnet-zEst );
 
       dSlope = std::abs(dSlope);
-      
+
       double dp = dSlope * part->momentum().R() - m_momPar.sum();
       // -- this is a little obscure, the numbers ( '5' and '2000' ) are determined below.
       // -- the numbers used here might be a bit outdated
       double bytPred = by + 5. * by * fabs(by) * (bx-bxt) * (bx-bxt);
       double aytPred = ay + (zMagnet-m_zRef)*by + (m_zTT1-zMagnet)*bytPred;
       aytPred -= 2000*by*(bx-bxt)*(bx-bxt);
-      
+
       tTrack->column( "bytPred", bytPred );
       tTrack->column( "aytPred", aytPred );
-      
+
       tTrack->column( "xMagnet", axt + ( zMagnet - m_zTT1 ) * bxt );
       tTrack->column( "yMagnet", ayt + ( zMagnet - m_zTT1 ) * byt );
 
@@ -323,16 +323,16 @@ StatusCode PatLongLivedParams::execute() {
       // -- the precise parametrisations are a bit 'black magic'
       m_yPar.setFun(0, by*std::abs(by)*dSlope*dSlope );
       m_yPar.addEvent( byt - by - m_yPar.sum() );
-      
-      // -- This is how by is determined for OT tracks 
+
+      // -- This is how by is determined for OT tracks
       // -- see LHCb-PUB-2017-001
       //const double byExp = ay / ( m_zRef + ( m_yParams[0] * fabs(by) * zMagnet + m_yParams[2] )* dSlope2  );
-      
+
       const double yMagnetExp = ay + (zMagnet - m_zRef) * by;
-      
+
       m_yPar2.setFun(0, by*dSlope*dSlope );
       m_yPar2.addEvent( yMagnet - yMagnetExp - m_yPar2.sum() );
-      
+
       // -- and the momentum parametrisations
       m_momPar.setFun( 0, 1. );
       m_momPar.setFun( 1, bx * bx );
@@ -340,14 +340,14 @@ StatusCode PatLongLivedParams::execute() {
       //m_momPar.setFun( 3, bx*bx*bx*bx );
       m_momPar.addEvent( dp );
       tTrack->column( "PredMom", m_momPar.sum() / dSlope );
-      
+
       double xMag = ax + ( zEst - m_zRef ) * bx;
       tTrack->column( "xPred", xMag * m_zTT1 / zEst );
       tTrack->write();
-   
+
       double slopeX = xMag / zMagnet;
       tTrack->column( "slopeX", slopeX );
-   
+
       debug() << format( "  zMag%7.1f xMag%7.1f yMag%7.1f back%7.1f",
                          zMagnet,
                          axt + ( zMagnet - m_zTT1 ) * bxt,
@@ -362,9 +362,9 @@ StatusCode PatLongLivedParams::execute() {
 //  Determine resolution
 //=============================================================================
 void PatLongLivedParams::resolution(){
-  
+
   LinkedTo<LHCb::MCParticle, LHCb::Track> mySeedLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Seed);
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
 
   // Get the IT and TT hits
   LHCb::MCHits* itHits = get<LHCb::MCHits>( LHCb::MCHitLocation::IT );
@@ -374,8 +374,8 @@ void PatLongLivedParams::resolution(){
   LHCb::MCHits* otHits = get<LHCb::MCHits>( LHCb::MCHitLocation::OT );
 
   LHCb::Tracks* inTracks   = getIfExists<LHCb::Tracks>( m_inputLocationSeed );
-  
-  if( inTracks == nullptr ){ 
+
+  if( inTracks == nullptr ){
     error() << "Could not find tracks in " << m_inputLocationSeed << endmsg;
     return;
   }
@@ -385,30 +385,30 @@ void PatLongLivedParams::resolution(){
   std::vector<Gaudi::XYZPoint> TTHits;
 
   for( LHCb::Track* track : *inTracks){
-    
+
     const LHCb::MCParticle* mcSeedPart = mySeedLink.first( track->key() );
     if( mcSeedPart == nullptr ) continue;
     if( std::abs(mcSeedPart->particleID().pid()) == 11 ) continue;
-   
+
     if(  !trackInfo.hasT( mcSeedPart) || !trackInfo.hasTT( mcSeedPart ) ) continue;
     // -- optimise for downstream tracks
     if( trackInfo.hasVelo( mcSeedPart ) ) continue;
-    
+
     const LHCb::MCVertex* kDecay = mcSeedPart->originVertex();
     if ( nullptr == kDecay ) continue;
     const LHCb::MCParticle* kShort = kDecay->mother();
     if ( nullptr == kShort ) continue;
-    
+
     // -- Ks and Lambda
     if ( 310 != std::abs(kShort->particleID().pid()) && 3122 != std::abs(kShort->particleID().pid()) ) continue;
-    
+
     const LHCb::MCVertex* origin = kShort->originVertex();
     if ( nullptr == origin ) continue;
     if ( 100. < origin->position().R() ){
       debug()<< "Too far from beampipe" << endmsg;
       continue;  // particles from close the beam line
     }
-    
+
     bool hasInteractionVertex = false;
     SmartRefVector<LHCb::MCVertex> endV = mcSeedPart->endVertices();
     for ( SmartRefVector<LHCb::MCVertex>::const_iterator itV = endV.begin() ;
@@ -419,39 +419,39 @@ void PatLongLivedParams::resolution(){
       debug()<< "Interaction vertex found. skipping" << endmsg;
       continue;
     }
-    
+
     TTHits.clear();
     trHits.clear();
-    
+
     // Get the IT hits
-    for ( LHCb::MCHits::const_iterator iHitIt = itHits->begin() ; 
+    for ( LHCb::MCHits::const_iterator iHitIt = itHits->begin() ;
           itHits->end() != iHitIt ; iHitIt++ ) {
       if ( (*iHitIt)->mcParticle() ==  mcSeedPart ) {
         trHits.push_back( (*iHitIt)->midPoint() );
       }
     }
-    
+
     // Get the TT hits
-    for ( LHCb::MCHits::const_iterator iHittt = ttHits->begin() ; 
+    for ( LHCb::MCHits::const_iterator iHittt = ttHits->begin() ;
           ttHits->end() != iHittt ; iHittt++ ) {
       if ( (*iHittt)->mcParticle() ==  mcSeedPart ) {
         TTHits.push_back( (*iHittt)->midPoint() );
       }
     }
-    
+
     // Get the OT hits
-    for ( LHCb::MCHits::const_iterator oHitIt = otHits->begin() ; 
+    for ( LHCb::MCHits::const_iterator oHitIt = otHits->begin() ;
           otHits->end() != oHitIt ; oHitIt++ ) {
       if ( (*oHitIt)->mcParticle() ==  mcSeedPart ) {
         trHits.push_back( (*oHitIt)->midPoint() );
       }
     }
     if ( 4  > TTHits.size() || 11 > trHits.size() )  continue;
-    
+
     //== Fit the TT area
     double axt, bxt, ayt, byt;
     //double axt2,bxt2,cxt2;
-    
+
     debug() << "  TT: ";
     m_fitTool->fitLine( TTHits, 0, m_zTT1, axt, bxt );
     m_fitTool->fitLine( TTHits, 1, m_zTT1, ayt, byt );
@@ -464,34 +464,34 @@ void PatLongLivedParams::resolution(){
     const double zMagnet = (axt-bxt*m_zTT1 - (ax-bx*m_zRef) ) / (bx-bxt);
     const double xMagnet = axt + ( zMagnet - m_zTT1 ) * bxt;
     const double yMagnet = ayt + ( zMagnet - m_zTT1 ) * byt;
-        
+
     LHCb::State* state = &track->closestState( 10000. );
 
-    const double zMagnetExp =m_zMagParams [0] + 
-      m_zMagParams[1] * state->ty() * state->ty() +  
+    const double zMagnetExp =m_zMagParams [0] +
+      m_zMagParams[1] * state->ty() * state->ty() +
       m_zMagParams[2] * state->tx() * state->tx() +
       m_zMagParams[3] * 1/state->p() +
       m_zMagParams[4] * std::abs( state->x() ) +
       m_zMagParams[5] * std::abs( state->y() ) +
       m_zMagParams[6] * std::abs( state->ty() );
 
-    
+
     const double dzExp        = zMagnetExp - state->z();
     const double xMagnetExp   = state->x() + dzExp * state->tx();
     const double bxtExp       = xMagnetExp / zMagnetExp;
     const double dSlope       = std::abs( bxtExp - state->tx() );
     const double dSlope2      = dSlope*dSlope;
-   
+
     // -- Number of IT hits
-    const unsigned int nbIT = std::count_if( track->lhcbIDs().begin(), track->lhcbIDs().end(), 
+    const unsigned int nbIT = std::count_if( track->lhcbIDs().begin(), track->lhcbIDs().end(),
                                              [](const LHCb::LHCbID id){ return id.isIT();});
 
 
     // -- this is how it is done in PatDownTrack for OT tracks.
     // -- see LHCb-PUB-2017-001
-    double byExp = state->y() / ( state->z() + 
+    double byExp = state->y() / ( state->z() +
                                   ( m_yParams[0] * std::abs(state->ty()) * zMagnet + m_yParams2[0] )* dSlope2  );
-    
+
     if( nbIT > 4 ) byExp      = state->ty();
     const double bytExp       = byExp*(1.0+m_yParams[0]*dSlope2*std::abs(byExp));
     const double yMagnetExp   = state->y() + dzExp * byExp - m_yParams2[0] * byExp * dSlope2;
@@ -523,11 +523,11 @@ void PatLongLivedParams::resolution(){
     resoTuple->column( "byt", byt );
     resoTuple->column( "bytExp", bytExp );
     resoTuple->column( "ayt", ayt );
-        
+
     resoTuple->write();
-    
+
   }
-  
+
 
 }
 //=============================================================================
@@ -545,14 +545,14 @@ StatusCode PatLongLivedParams::finalize() {
   m_curvature.updateParameters(  msg );
   m_yPar.updateParameters(  msg );
   m_yPar2.updateParameters(  msg );
-  
+
   std::cout << std::endl;
   m_zMagPar.printPythonParams( name() );
   m_momPar.printPythonParams(  name() );
   m_curvature.printPythonParams(  name() );
   m_yPar.printPythonParams(  name() );
   m_yPar2.printPythonParams(  name() );
-  
+
   std::cout << std::endl;
 
   m_zMagPar.printParams( "PatLongLivedTracking" );
diff --git a/Tr/PatFitParams/src/SeedFitParams.cpp b/Tr/PatFitParams/src/SeedFitParams.cpp
index 17814e3fc06974e786452643214943e9f8fb1ab0..caa312d106956978c0e3e0be54df8dad666b9519 100755
--- a/Tr/PatFitParams/src/SeedFitParams.cpp
+++ b/Tr/PatFitParams/src/SeedFitParams.cpp
@@ -1,4 +1,4 @@
-// Include files 
+// Include files
 
 // from Gaudi
 #include "Event/MCTrackInfo.h"
@@ -66,14 +66,14 @@ SeedFitParams::SeedFitParams( const std::string& name,
     std::vector<double> tmp = list_of(1.25e-14);
     declareProperty( "yCorrectionParams", m_yCorrection = tmp);
   }
- 
+
   m_nEvent = 0;
   m_nTrack = 0;
 }
 //=============================================================================
 // Destructor
 //=============================================================================
-SeedFitParams::~SeedFitParams() {} 
+SeedFitParams::~SeedFitParams() {}
 
 //=============================================================================
 // Initialization
@@ -106,7 +106,7 @@ StatusCode SeedFitParams::execute() {
 
   const auto* partCtnr = get<LHCb::MCParticles>( LHCb::MCParticleLocation::Default );
 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
 
   // Get the MC hits, and create our own "linkers"
   std::unordered_map<const LHCb::MCParticle*, std::vector<const LHCb::MCHit*> > tlinker;
@@ -181,7 +181,7 @@ StatusCode SeedFitParams::execute() {
       ttHits.reserve(ttlinker[part].size());
       for (const auto* hit: ttlinker[part]) ttHits.push_back(hit->midPoint());
     }
-    
+
     ++m_nTrack;
     if ( msgLevel( MSG::DEBUG ) ) {
       debug() << format( "Track MC %4d z0 %7.2f p%8.2f Velo%2d TT%2d T%2d",
@@ -202,7 +202,7 @@ StatusCode SeedFitParams::execute() {
     tTrack->column( "slopeY",  part->momentum().Y() / pz );
 
     double ax, bx, cx, dx, ay, by;
-    
+
     m_fitTool->fitCubic( trHits, 0, m_zRef, ax, bx, cx, dx );
     m_fitTool->fitLine ( trHits, 1, m_zRef, ay, by );
 
@@ -217,7 +217,7 @@ StatusCode SeedFitParams::execute() {
       debug() << format( "p %7.3f, N%4d, ax%8.2f bx%8.2f cx%8.2f dp%10.4f",
                          momentum/1000., trHits.size(),
                          ax, 1.e3*bx, 1.e6*cx, dp ) << endmsg;
-    }    
+    }
 
     // work out intercept point of line joining T1 and T3 with z = 0
     const double dzT1 = StateParameters::ZBegT - m_zRef;
@@ -244,13 +244,13 @@ StatusCode SeedFitParams::execute() {
       //m_fitTool->fitLine( ttHits, 0, m_zTT, axt, bxt );
       m_fitTool->fitParabola( ttHits, 0, m_zTT, axt, bxt, cxt );
       m_fitTool->fitLine( ttHits, 1, m_zTT, ayt, byt );
-      
+
       double dz = m_zSeed - m_zRef;
       double x0 = ax + dz * ( bx + dz * ( cx + dz * dx ) );
       double tx = bx + dz * (2*cx + dz * 3*dx );
 
       zMagnet = (axt-bxt*m_zTT - (x0-tx*m_zSeed) ) / (tx-bxt);
-      
+
       m_zMagPar.setFun( 0, 1. );
       m_zMagPar.setFun( 1, by*by );
       m_zMagPar.setFun( 2, bx*bx );
@@ -282,7 +282,7 @@ StatusCode SeedFitParams::execute() {
     m_yCorrectionPar.setFun(0, 1.0);
     if (400. < fabs(y0))
       m_yCorrectionPar.addEvent(fabs((by * by * cx * cx) / y0) - m_yCorrectionPar.sum());
-      
+
     tTrack->column( "ax", ax );
     tTrack->column( "bx", bx );
     tTrack->column( "cx", cx );
@@ -333,9 +333,9 @@ StatusCode SeedFitParams::finalize() {
   m_dRatioPar.printPythonParams( name() );
   m_yCorrectionPar.printPythonParams( name() );
   std::cout << std::endl;
-  
+
   std::string toolName = "ToolSvc.PatSeedingTool";
-  
+
   m_initialArrowPar.printPythonParams( toolName );
   m_momentumScalePar.printPythonParams( toolName );
   m_zMagPar.printPythonParams( toolName );
diff --git a/Tr/TrackFitter/src/TrackEventFitter.cpp b/Tr/TrackFitter/src/TrackEventFitter.cpp
index 7efdd69b44a9ee661f6a5a992075a5c6c3c21b9a..edd01a96a9dd8ea0a1951195e4e00fe25bc6b122 100644
--- a/Tr/TrackFitter/src/TrackEventFitter.cpp
+++ b/Tr/TrackFitter/src/TrackEventFitter.cpp
@@ -95,9 +95,9 @@ LHCb::Tracks TrackEventFitter::operator()(const std::vector<LHCb::Track>& tracks
     }
     
     if( track.nStates()==0 ||
-        track.checkFlag( LHCb::Track::Invalid ) ||
-        (m_skipFailedFitAtInput.value() && track.fitStatus() == LHCb::Track::FitFailed ) ) {
-      track.setFlag( LHCb::Track::Invalid, true );
+        track.checkFlag( LHCb::Track::Flags::Invalid ) ||
+        (m_skipFailedFitAtInput.value() && track.fitStatus() == LHCb::Track::FitStatus::FitFailed)) {
+      track.setFlag( LHCb::Track::Flags::Invalid, true );
       // don't put failures on the output container. this is how they want it in HLT.
       ++nBadInput ;
     } else {
@@ -123,7 +123,7 @@ LHCb::Tracks TrackEventFitter::operator()(const std::vector<LHCb::Track>& tracks
             debug() << "Fitted successfully track # " << track.key() << endmsg;
           }
           // Update counters
-          if( track.checkFlag( LHCb::Track::Backward ) ) prefix += "Backward" ;
+        if( track.checkFlag( LHCb::Track::Flags::Backward ) ) prefix += "Backward" ;
           prefix += '.' ;
           if( track.nDoF()>0) {
             double chisqprob = track.probChi2() ;
@@ -140,7 +140,7 @@ LHCb::Tracks TrackEventFitter::operator()(const std::vector<LHCb::Track>& tracks
           counter(prefix + "RejectedChisqCut") += 1 ;
         }
     } else {
-      track.setFlag( LHCb::Track::Invalid, true );
+      track.setFlag( LHCb::Track::Flags::Invalid, true );
       ++nFitFail;
       if ( msgLevel( MSG::DEBUG ) )
         debug() << "Unable to fit the track # " << track.key() << endmsg;
diff --git a/Tr/TrackFitter/src/TrackKalmanFilter.cpp b/Tr/TrackFitter/src/TrackKalmanFilter.cpp
index 69770019505e984750f8f77fc58803dcffa5bc75..00cc578f67904bfd2e1b6db5ef67995119d28e8d 100644
--- a/Tr/TrackFitter/src/TrackKalmanFilter.cpp
+++ b/Tr/TrackFitter/src/TrackKalmanFilter.cpp
@@ -1,4 +1,4 @@
-// Include files 
+// Include files
 // -------------
 // from TrackEvent
 #include "Event/KalmanFitResult.h"
@@ -46,12 +46,12 @@ TrackKalmanFilter::~TrackKalmanFilter() {
 //=========================================================================
 // Initialize
 //=========================================================================
-StatusCode TrackKalmanFilter::initialize() 
+StatusCode TrackKalmanFilter::initialize()
 {
   StatusCode sc = GaudiTool::initialize(); // must be executed first
   if ( sc.isFailure() ) return sc;
   m_debugLevel   = msgLevel( MSG::DEBUG );
-  
+
   return StatusCode::SUCCESS;
 }
 
@@ -61,16 +61,16 @@ StatusCode TrackKalmanFilter::initialize()
 StatusCode TrackKalmanFilter::fit( LHCb::Track& track ) const
 {
   // if( m_debugLevel ) debug() << "TrackKalmanFilter::fit" << endmsg ;
-  
-  StatusCode sc(StatusCode::SUCCESS, true); 
+
+  StatusCode sc(StatusCode::SUCCESS, true);
 
   // The seed covariance comes from the KalmanFitResult
   LHCb::KalmanFitResult* kalfit = dynamic_cast<LHCb::KalmanFitResult*>(track.fitResult()) ;
   if( !kalfit) return Warning("No kalfit on track",StatusCode::FAILURE,0) ;
-  
+
   LHCb::KalmanFitResult::FitNodeRange nodes = kalfit->fitNodes() ;
   if( nodes.empty() ) return Warning( "Fit failure: track has no nodes", StatusCode::FAILURE,0 );
-  
+
   // This is set up with the aim to trigger the cache such that there
   // will be no nested calls. That makes it easier to profile the
   // fit. Eventually, we could do without all of this, since
@@ -87,11 +87,11 @@ StatusCode TrackKalmanFilter::fit( LHCb::Track& track ) const
       (*inode)->filteredState(LHCb::FitNode::Backward) ;
     }
   }
-  // force the smoothing. 
+  // force the smoothing.
   if (m_forceSmooth){
     for( LHCb::KalmanFitResult::FitNodeRange::iterator inode = nodes.begin() ;
-	 inode != nodes.end(); ++inode) 
-      (*inode)->state() ; 
+	 inode != nodes.end(); ++inode)
+      (*inode)->state() ;
   }
 
   if (kalfit->inError()){
@@ -101,14 +101,14 @@ StatusCode TrackKalmanFilter::fit( LHCb::Track& track ) const
   // This is the only thing we need KalmanFilter still for: set the
   // total chisquare of the track. This could also be done from
   // TrackMasterFitter.
-  
+
   // Count the number of active track parameters. For now, just look at the momentum.
   size_t npar = m_DoF ;
   if( npar == 5u ) {
     const LHCb::State* laststate(0) ;
     for( LHCb::KalmanFitResult::FitNodeRange::iterator inode = nodes.begin() ;
 	    inode != nodes.end(); ++inode) {
-      if( (*inode)->type()==LHCb::Node::HitOnTrack ) 
+      if( (*inode)->type()==LHCb::Node::Type::HitOnTrack )
 	   laststate = &((*inode)->filteredState(LHCb::FitNode::Forward)) ;
     }
     if(laststate) {
@@ -117,7 +117,7 @@ StatusCode TrackKalmanFilter::fit( LHCb::Track& track ) const
       dynamic_cast<LHCb::KalmanFitResult*>(track.fitResult())->setNTrackParameters( npar ) ;
     }
   }
-  
+
   LHCb::ChiSquare chisq = nodes.back()->totalChi2(LHCb::FitNode::Forward) ;
   int ndof = chisq.nDoF() - (npar - kalfit->nTrackParameters() ) ;
   if( m_forceBiDirectionalFit ) {
diff --git a/Tr/TrackFitter/src/TrackKalmanFilter.h b/Tr/TrackFitter/src/TrackKalmanFilter.h
index eed81915d94d183d4da438ebc2d4fd8587ff3044..9ffbf4b18b95c887ba6186eff456085a2d5c65da 100644
--- a/Tr/TrackFitter/src/TrackKalmanFilter.h
+++ b/Tr/TrackFitter/src/TrackKalmanFilter.h
@@ -43,7 +43,7 @@ public:
   StatusCode fit( LHCb::Track& track ) const override;
 
   void printErrMeasures (LHCb::Track& track) const;
-  
+
   void printStates (LHCb::Track& track) const;
 
 private:
diff --git a/Tr/TrackFitter/src/TrackMasterFitter.cpp b/Tr/TrackFitter/src/TrackMasterFitter.cpp
index a515ce2ba65b90ea1189fc68e362b7a6051545ce..84c523c2f367f50277f6fcfad153e6051f9d1da3 100644
--- a/Tr/TrackFitter/src/TrackMasterFitter.cpp
+++ b/Tr/TrackFitter/src/TrackMasterFitter.cpp
@@ -43,7 +43,7 @@ bool isPrefit(const LHCb::TrackFitResult& fr)
   return std::any_of(fr.nodes().begin(), fr.nodes().end(),
                       [](const LHCb::Node *node) {
     if (!node->hasMeasurement()  ||
-         node->measurement().type()!= LHCb::Measurement::OT) {
+         node->measurement().type()!= LHCb::Measurement::Type::OT) {
       return false;
     }
     const auto* otmeas = dynamic_cast<const LHCb::OTMeasurement*>(&(node->measurement())) ;
@@ -73,7 +73,7 @@ void fillExtraInfo(Track& track)
   if (track.hasT()) {
     track.addInfo(Track::AdditionalInfo::FitTChi2, kalfit->chi2Downstream().chi2());
     track.addInfo(Track::AdditionalInfo::FitTNDoF, kalfit->chi2Downstream().nDoF());
-    unsigned int nOTMeas = kalfit->nMeasurements(LHCb::Measurement::OT);
+    unsigned int nOTMeas = kalfit->nMeasurements(LHCb::Measurement::Type::OT);
     if (nOTMeas > 0)
       track.addInfo(Track::AdditionalInfo::FitFracUsedOTTimes, kalfit->nActiveOTTimes() / double(nOTMeas));
   }
@@ -434,18 +434,18 @@ StatusCode TrackMasterFitter::determineStates(Track& track) const
   // This state is not filtered for a forward only fit.
   if (m_addDefaultRefNodes.value()) {
     State firststate = firstMeasurementNode->state();
-    firststate.setLocation(reversed ? State::LastMeasurement : State::FirstMeasurement);
+    firststate.setLocation(reversed ? State::Location::LastMeasurement : State::Location::FirstMeasurement);
     track.addToStates(firststate);
   }
   // This state is always filtered
   State laststate = lastMeasurementNode->state();
-  laststate.setLocation(reversed ? State::FirstMeasurement : State::LastMeasurement);
+  laststate.setLocation(reversed ? State::Location::FirstMeasurement : State::Location::LastMeasurement);
   track.addToStates(laststate);
 
   // Add the states at the reference positions
   // ------------------------------------------
   for (const auto& node : nodes)
-    if (node->type() == LHCb::Node::Reference)
+    if (node->type() == LHCb::Node::Type::Reference)
       track.addToStates(node->state());
 
   if (m_debugLevel) {
@@ -468,23 +468,23 @@ namespace {
   inline int hittypemap(LHCb::Measurement::Type type) {
     HitType rc = Unknown;
     switch(type) {
-    case LHCb::Measurement::Unknown:   rc = Unknown; break;
-    case LHCb::Measurement::VeloR:   rc = VeloR; break;
-    case LHCb::Measurement::VeloPhi: rc = VeloPhi; break;
-    case LHCb::Measurement::VeloLiteR:   rc = VeloR; break;
-    case LHCb::Measurement::VeloLitePhi: rc = VeloPhi; break;
-    case LHCb::Measurement::TT: rc = TT; break;
-    case LHCb::Measurement::IT: rc = T; break;
-    case LHCb::Measurement::OT: rc = T; break;
-    case LHCb::Measurement::Muon: rc = Muon; break;
-    case LHCb::Measurement::TTLite: rc = TT; break;
-    case LHCb::Measurement::ITLite: rc = T; break;
-    case LHCb::Measurement::VP: rc = VeloR; break;
-    case LHCb::Measurement::Calo: rc = Unknown; break;
-    case LHCb::Measurement::Origin : rc = Unknown; break;
-    case LHCb::Measurement::FT : rc = T; break;
-    case LHCb::Measurement::UT : rc = TT; break;
-    case LHCb::Measurement::UTLite : rc = TT; break;
+    case LHCb::Measurement::Type::Unknown:   rc = Unknown; break;
+    case LHCb::Measurement::Type::VeloR:   rc = VeloR; break;
+    case LHCb::Measurement::Type::VeloPhi: rc = VeloPhi; break;
+    case LHCb::Measurement::Type::VeloLiteR:   rc = VeloR; break;
+    case LHCb::Measurement::Type::VeloLitePhi: rc = VeloPhi; break;
+    case LHCb::Measurement::Type::TT: rc = TT; break;
+    case LHCb::Measurement::Type::IT: rc = T; break;
+    case LHCb::Measurement::Type::OT: rc = T; break;
+    case LHCb::Measurement::Type::Muon: rc = Muon; break;
+    case LHCb::Measurement::Type::TTLite: rc = TT; break;
+    case LHCb::Measurement::Type::ITLite: rc = T; break;
+    case LHCb::Measurement::Type::VP: rc = VeloR; break;
+    case LHCb::Measurement::Type::Calo: rc = Unknown; break;
+    case LHCb::Measurement::Type::Origin : rc = Unknown; break;
+    case LHCb::Measurement::Type::FT : rc = T; break;
+    case LHCb::Measurement::Type::UT : rc = TT; break;
+    case LHCb::Measurement::Type::UTLite : rc = TT; break;
     }
     return rc;
   }
@@ -505,7 +505,7 @@ LHCb::Node* TrackMasterFitter::outlierRemoved(Track& track) const
   auto fr = dynamic_cast<const LHCb::KalmanFitResult*>(track.fitResult());
   auto nodes = fr->fitNodes();
   for (const auto& node : nodes) {
-    if (node->type() == LHCb::Node::HitOnTrack){
+    if (node->type() == LHCb::Node::Type::HitOnTrack){
       ++numHits[hittypemap(node->measurement().type())];
     }
   }
@@ -534,24 +534,24 @@ LHCb::Node* TrackMasterFitter::outlierRemoved(Track& track) const
   int numtried(0),numcalled(0);
   for (const auto&  node : nodes) {
     if (node->hasMeasurement() &&
-         node->type() == LHCb::Node::HitOnTrack) {
+         node->type() == LHCb::Node::Type::HitOnTrack) {
       int hittype = hittypemap(node->measurement().type());
       if (numHits[hittype] > minNumHits[hittype]) {
         ++numtried;
         auto chi2MatchAndHit = totalchi2;
-        for (int dir=0; dir<2; ++dir) {
+        for ( FitNode::Direction dir : { FitNode::Direction::Forward, FitNode::Direction::Backward } ) {
           const auto* tmpnode =  node->prevNode(dir);
           if (tmpnode) chi2MatchAndHit -= tmpnode->totalChi2(dir).chi2();
         }
 
         if (m_debugLevel){
-          const auto* prevnode = node->prevNode(0);
-          const auto* nextnode = node->prevNode(1);
+          const auto* prevnode = node->prevNode(FitNode::Direction::Forward);
+          const auto* nextnode = node->prevNode(FitNode::Direction::Backward);
 
           debug() << "node LHCbID " << node->measurement().lhcbID().channelID()
             << " chi2Contribution " << chi2MatchAndHit << " (" << totalchi2 << " - "
-            << (prevnode ? prevnode->totalChi2(0).chi2() : 0) << " - "
-            << (nextnode ? nextnode->totalChi2(1).chi2() : 0) << ")" << endmsg;
+            << (prevnode ? prevnode->totalChi2(FitNode::Direction::Forward).chi2() : 0) << " - "
+            << (nextnode ? nextnode->totalChi2(FitNode::Direction::Backward).chi2() : 0) << ")" << endmsg;
         }
 
         if (chi2MatchAndHit > m_chi2Outliers) {
@@ -727,22 +727,22 @@ StatusCode TrackMasterFitter::makeNodes(Track& track,
   // Add reference nodes depending on track type
   if (m_addDefaultRefNodes.value()) {
     if (track.hasVelo() && !track.checkFlag(Track::Flags::Backward))
-      nodes.push_back(new FitNode( StateParameters::ZEndVelo, State::EndVelo)) ;
+      nodes.push_back(new FitNode( StateParameters::ZEndVelo, State::Location::EndVelo)) ;
     if (track.hasTT()) {
-      nodes.push_back(new FitNode( StateParameters::ZBegRich1, State::BegRich1)) ;
-      nodes.push_back(new FitNode( StateParameters::ZEndRich1, State::EndRich1)) ;
+      nodes.push_back(new FitNode( StateParameters::ZBegRich1, State::Location::BegRich1)) ;
+      nodes.push_back(new FitNode( StateParameters::ZEndRich1, State::Location::EndRich1)) ;
     }
     if (track.hasT()) {
-      nodes.push_back(new FitNode(StateParameters::ZBegT, State::AtT));
-      nodes.push_back(new FitNode(StateParameters::ZBegRich2, State::BegRich2));
-      nodes.push_back(new FitNode(StateParameters::ZEndRich2, State::EndRich2));
+      nodes.push_back(new FitNode(StateParameters::ZBegT, State::Location::AtT));
+      nodes.push_back(new FitNode(StateParameters::ZBegRich2, State::Location::BegRich2));
+      nodes.push_back(new FitNode(StateParameters::ZEndRich2, State::Location::EndRich2));
     }
   }
 
   // At a node for the position at the beamline
   if (m_stateAtBeamLine.value() && (track.hasTT() || track.hasVelo())) {
     const LHCb::State& refstate = (track.checkFlag(Track::Flags::Backward) ? track.states().back() : track.states().front());
-    nodes.push_back(new FitNode(closestToBeamLine(refstate), State::ClosestToBeam )); 
+    nodes.push_back(new FitNode(closestToBeamLine(refstate), State::Location::ClosestToBeam ));
   }
 
   // Sort the nodes in z
@@ -962,12 +962,12 @@ StatusCode TrackMasterFitter::initializeRefStates(LHCb::Track& track,
 
   // first fix the momentum of states on the track. need to make sure this works for Velo-TT as well.
   if (track.states().empty()) {
-    sc = Error("Track has no state! Can not fit.", StatusCode::FAILURE);
-  } else {
+    return Error("Track has no state! Can not fit.", StatusCode::FAILURE);
+  }
     // first need to make sure all states already on track have
     // reasonable momentum. still needs to check that this works for
     // velo-TT
-    const LHCb::State* stateAtT = track.stateAt(LHCb::State::AtT);
+  const LHCb::State* stateAtT = track.stateAt(LHCb::State::Location::AtT);
     const LHCb::State& refstate = stateAtT ? *stateAtT :
       (track.checkFlag(Track::Flags::Backward) ? track.states().front() : track.states().back());
     track.setQOverPInAllStates(refstate.qOverP());
@@ -1043,6 +1043,6 @@ StatusCode TrackMasterFitter::initializeRefStates(LHCb::Track& track,
     if (sc.isSuccess()) {
       track.addToStates(newstates);
     }
-  }
+
   return sc;
 }
diff --git a/Tr/TrackFitter/src/TrackMasterFitter.h b/Tr/TrackFitter/src/TrackMasterFitter.h
index 4b2e8ed794907d140edf8dcf900f2a0c570d9079..6e1a64afab8175ada7d8b58fe83f742f350b8492 100644
--- a/Tr/TrackFitter/src/TrackMasterFitter.h
+++ b/Tr/TrackFitter/src/TrackMasterFitter.h
@@ -103,7 +103,7 @@ private:
   StatusCode updateTransport( LHCb::Track& track ) const ;
 
   const ITrackExtrapolator* extrapolator( LHCb::Track::Types tracktype ) const {
-    if(tracktype == LHCb::Track::Velo ||  tracktype == LHCb::Track::VeloR  ) return &(*m_veloExtrapolator) ;
+    if(tracktype == LHCb::Track::Velo ||  tracktype == LHCb::Track::Types::VeloR  ) return &(*m_veloExtrapolator) ;
     return &(*m_extrapolator);
   }
 
diff --git a/Tr/TrackFitter/src/TrackVectorFitter.cpp b/Tr/TrackFitter/src/TrackVectorFitter.cpp
index 5715c2cb1c7880467f5a2773ffd691d71192f5d3..0fef44cdfd49a47fe46b8d0820882587747bcd15 100644
--- a/Tr/TrackFitter/src/TrackVectorFitter.cpp
+++ b/Tr/TrackFitter/src/TrackVectorFitter.cpp
@@ -43,7 +43,7 @@ TrackVectorFitter::TrackVectorFitter (
 /**
  * @brief Initializes all tools and debug level.
  */
-StatusCode TrackVectorFitter::initialize () {  
+StatusCode TrackVectorFitter::initialize () {
   // Add the ability to disable the RungeKuttaExtrapolator
   std::string prefix ("TrackParabolicExtrapolator");
   m_rungeKuttaExtrapolatorEnabled = m_extrapolator.typeAndName().compare(0, prefix.size(), prefix);
@@ -144,7 +144,7 @@ StatusCode TrackVectorFitter::operator() (
   //   CALLGRIND_TOGGLE_COLLECT;
   //   __itt_resume();
   // }
-  
+
   Tr::TrackVectorFitter::fitter.reset(msgLevel(MSG::DEBUG), msgLevel(MSG::VERBOSE));
 
   // Generate the Tr::TrackVectorFit::Tracks
@@ -553,7 +553,7 @@ StatusCode TrackVectorFitter::initializeRefStates (LHCb::Track& track, const LHC
     // first need to make sure all states already on track have
     // reasonable momentum. still needs to check that this works for
     // velo-TT
-    const LHCb::State* stateAtT = track.stateAt(LHCb::State::AtT);
+    const LHCb::State* stateAtT = track.stateAt(LHCb::State::Location::AtT);
     const LHCb::State& refstate = stateAtT ? *stateAtT :
       (track.checkFlag(LHCb::Track::Flags::Backward) ? track.states().front() : track.states().back());
     track.setQOverPInAllStates( refstate.qOverP() );
@@ -818,7 +818,7 @@ void TrackVectorFitter::updateTransport (
           const auto& z = n.node().z();
           const auto distance = std::abs(z - refZ);
 
-          is_parallel_velo &= (type == LHCb::Track::Velo || type == LHCb::Track::VeloR);
+          is_parallel_velo &= (type == LHCb::Track::Velo || type == LHCb::Track::Types::VeloR);
           is_parallel_short &= !m_rungeKuttaExtrapolatorEnabled || (distance < 100.0*Gaudi::Units::mm);
         }
       }
@@ -845,7 +845,7 @@ void TrackVectorFitter::updateTransport (
         currentNodeParameters.m_transportVector.m_basePointer,
         previousBackwardTransportPointer
       );
-      
+
       if (msgLevel(MSG::VERBOSE)) {
         verbose() << "Calculated nodes:" << endmsg;
         for (unsigned i=0; i<Tr::TrackVectorFit::vector_width(); ++i) {
@@ -859,7 +859,7 @@ void TrackVectorFitter::updateTransport (
           verbose() << *(pool[i].node) << endmsg;
         }
       }
-      
+
       // Create views
       Tr::TrackVectorFit::Mem::View::NodeParameters currentNodeParameters (currentNodeParametersPointer);
       Tr::TrackVectorFit::Mem::View::NodeParameters previousNodeParameters (previousNodeParametersPointer);
@@ -875,7 +875,7 @@ void TrackVectorFitter::updateTransport (
         currentNodeParameters.m_transportVector.m_basePointer,
         previousBackwardTransportPointer
       );
-      
+
       if (msgLevel(MSG::VERBOSE)) {
         verbose() << "Calculated nodes:" << endmsg;
         for (unsigned i=0; i<Tr::TrackVectorFit::vector_width(); ++i) {
@@ -976,7 +976,7 @@ bool TrackVectorFitter::removeWorstOutlier (Tr::TrackVectorFit::Track& t) const
 
   std::array<size_t, 5> numHits = {0,0,0,0,0};
   for (auto& n : t.nodes()) {
-    if (n.node().type() == LHCb::Node::HitOnTrack) {
+    if (n.node().type() == LHCb::Node::Type::HitOnTrack) {
       assert(hitType(n.node().measurement().type()) < 5);
       ++numHits[hitType(n.node().measurement().type())];
     }
@@ -994,7 +994,7 @@ bool TrackVectorFitter::removeWorstOutlier (Tr::TrackVectorFit::Track& t) const
 
   for (auto it=t.nodes().begin(); it!=t.nodes().end(); ++it) {
     Tr::TrackVectorFit::Node& n = *it;
-    if (n.node().hasMeasurement() && n.node().type() == LHCb::Node::HitOnTrack) {
+    if (n.node().hasMeasurement() && n.node().type() == LHCb::Node::Type::HitOnTrack) {
       const unsigned type = hitType(n.node().measurement().type());
       assert(type < numHits.size());
       if (numHits[type] > m_minNumHits[type]) {
@@ -1084,7 +1084,7 @@ bool TrackVectorFitter::removeWorstOutlierSimplified (Tr::TrackVectorFit::Track&
 
   std::array<size_t, 5> numHits = {0,0,0,0,0};
   for (auto& n : t.nodes()) {
-    if (n.node().type() == LHCb::Node::HitOnTrack) {
+    if (n.node().type() == LHCb::Node::Type::HitOnTrack) {
       assert(hitType(n.node().measurement().type()) < 5);
       ++numHits[hitType(n.node().measurement().type())];
     }
@@ -1093,7 +1093,7 @@ bool TrackVectorFitter::removeWorstOutlierSimplified (Tr::TrackVectorFit::Track&
   // Perhaps the chi2 logic can be simplified
   std::vector<std::reference_wrapper<Tr::TrackVectorFit::Node>> badNodes;
   for (auto& n : t.nodes()) {
-    if (n.node().hasMeasurement() && n.node().type() == LHCb::Node::HitOnTrack) {
+    if (n.node().hasMeasurement() && n.node().type() == LHCb::Node::Type::HitOnTrack) {
       const unsigned type = hitType(n.node().measurement().type());
       assert(type < numHits.size());
       if (numHits[type] > m_minNumHits[type]) {
@@ -1146,18 +1146,18 @@ void TrackVectorFitter::determineStates (Tr::TrackVectorFit::Track& t) const {
   // This state is not filtered for a forward only fit.
   if (m_addDefaultRefNodes) {
     LHCb::State firststate = firstMeasurementNode->state();
-    firststate.setLocation(reversed ? LHCb::State::LastMeasurement : LHCb::State::FirstMeasurement);
+    firststate.setLocation(reversed ? LHCb::State::LastMeasurement : LHCb::State::Location::FirstMeasurement);
     track.addToStates(firststate);
   }
 
   // This state is always filtered
   LHCb::State laststate = lastMeasurementNode->state();
-  laststate.setLocation(reversed ? LHCb::State::FirstMeasurement : LHCb::State::LastMeasurement);
+  laststate.setLocation(reversed ? LHCb::State::Location::FirstMeasurement : LHCb::State::LastMeasurement);
   track.addToStates(laststate);
 
   // Add the states at the reference positions
   for (const auto& node : nodes) {
-    if (node->type() == LHCb::Node::Reference) {
+    if (node->type() == LHCb::Node::Type::Reference) {
       track.addToStates(node->state());
     }
   }
@@ -1198,7 +1198,7 @@ void TrackVectorFitter::fillExtraInfo (Tr::TrackVectorFit::Track& t) const {
   if (track.hasT()) {
     track.addInfo(LHCb::Track::AdditionalInfo::FitTChi2, track.fitResult()->chi2Downstream().chi2());
     track.addInfo(LHCb::Track::AdditionalInfo::FitTNDoF, track.fitResult()->chi2Downstream().nDoF());
-    const unsigned& nOTMeas = track.fitResult()->nMeasurements(LHCb::Measurement::OT);
+    const unsigned& nOTMeas = track.fitResult()->nMeasurements(LHCb::Measurement::Type::OT);
     if (nOTMeas > 0) {
       track.addInfo(LHCb::Track::AdditionalInfo::FitFracUsedOTTimes, nActiveOTTimes(t) / ((float) nOTMeas));
     }
diff --git a/Tr/TrackFitter/src/TrackVectorFitter.h b/Tr/TrackFitter/src/TrackVectorFitter.h
index 1a8cd34fb3ed90a709ff53632add555ad5cc7bcb..a72cd746a1529b9f0123c31e0e4b60c4787333e6 100644
--- a/Tr/TrackFitter/src/TrackVectorFitter.h
+++ b/Tr/TrackFitter/src/TrackVectorFitter.h
@@ -178,33 +178,33 @@ struct TrackVectorFitter : public extends<GaudiTool, ITrackFitter> {
     enum HitType {VeloR=0, VeloPhi=1, TT=2, T=3, Muon=4, Unknown=5};
 
     switch (type) {
-      case LHCb::Measurement::VeloR:
-      case LHCb::Measurement::VeloLiteR:
-      case LHCb::Measurement::VP:
+      case LHCb::Measurement::Type::VeloR:
+      case LHCb::Measurement::Type::VeloLiteR:
+      case LHCb::Measurement::Type::VP:
         return VeloR;
 
-      case LHCb::Measurement::VeloLitePhi:
-      case LHCb::Measurement::VeloPhi:
+      case LHCb::Measurement::Type::VeloLitePhi:
+      case LHCb::Measurement::Type::VeloPhi:
         return VeloPhi;
 
-      case LHCb::Measurement::TT:
-      case LHCb::Measurement::TTLite:
-      case LHCb::Measurement::UT:
-      case LHCb::Measurement::UTLite:
+      case LHCb::Measurement::Type::TT:
+      case LHCb::Measurement::Type::TTLite:
+      case LHCb::Measurement::Type::UT:
+      case LHCb::Measurement::Type::UTLite:
         return TT;
 
-      case LHCb::Measurement::IT:
-      case LHCb::Measurement::OT:
-      case LHCb::Measurement::ITLite:
-      case LHCb::Measurement::FT:
+      case LHCb::Measurement::Type::IT:
+      case LHCb::Measurement::Type::OT:
+      case LHCb::Measurement::Type::ITLite:
+      case LHCb::Measurement::Type::FT:
         return T;
 
-      case LHCb::Measurement::Muon:
+      case LHCb::Measurement::Type::Muon:
         return Muon;
 
-      case LHCb::Measurement::Unknown:
-      case LHCb::Measurement::Calo:
-      case LHCb::Measurement::Origin:
+      case LHCb::Measurement::Type::Unknown:
+      case LHCb::Measurement::Type::Calo:
+      case LHCb::Measurement::Type::Origin:
       default:
         return Unknown;
     }
@@ -216,7 +216,7 @@ struct TrackVectorFitter : public extends<GaudiTool, ITrackFitter> {
   ) const {
     unsigned rc (0);
     for (const auto& n : t.nodes()) {
-      if (n.node().type() == LHCb::Node::HitOnTrack && n.node().measurement().type() == type) {
+      if (n.node().type() == LHCb::Node::Type::HitOnTrack && n.node().measurement().type() == type) {
         ++rc;
       }
     }
@@ -228,7 +228,7 @@ struct TrackVectorFitter : public extends<GaudiTool, ITrackFitter> {
   ) const {
     unsigned rc (0);
     for (const auto& n : t.nodes()) {
-      if (n.node().type() == LHCb::Node::HitOnTrack && n.node().measurement().type() == LHCb::Measurement::OT) {
+      if (n.node().type() == LHCb::Node::HitOnTrack && n.node().measurement().type() == LHCb::Measurement::Type::OT) {
         const LHCb::OTMeasurement* otmeas = static_cast<const LHCb::OTMeasurement*>(&(n.node().measurement()));
         if (otmeas->driftTimeStrategy() == LHCb::OTMeasurement::FitDistance ||
             otmeas->driftTimeStrategy() == LHCb::OTMeasurement::FitTime) {
@@ -240,7 +240,7 @@ struct TrackVectorFitter : public extends<GaudiTool, ITrackFitter> {
   }
 
   inline const ITrackExtrapolator* extrapolator (LHCb::Track::Types tracktype) const {
-    if (tracktype == LHCb::Track::Velo || tracktype == LHCb::Track::VeloR) {
+    if (tracktype == LHCb::Track::Velo || tracktype == LHCb::Track::Types::VeloR) {
       return &(*m_veloExtrapolator);
     }
     return &(*m_extrapolator);
diff --git a/Tr/TrackInterfaces/CMakeLists.txt b/Tr/TrackInterfaces/CMakeLists.txt
index d044a6bfda1817f4c67488d4897655f45e45f664..cb737da8abec4e0e0629d0458acc76c58e2b31ee 100644
--- a/Tr/TrackInterfaces/CMakeLists.txt
+++ b/Tr/TrackInterfaces/CMakeLists.txt
@@ -13,6 +13,7 @@ gaudi_depends_on_subdirs(Det/DetDesc
 find_package(Boost)
 find_package(ROOT)
 include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS})
+find_path(RANGES_V3_INCLUDE_DIR NAMES range/v3/utility/any.hpp)
 
 gaudi_add_dictionary(TrackInterfaces
                      dict/TrackInterfacesDict.h
diff --git a/Tr/TrackMCTools/src/DebugTrackingLosses.cpp b/Tr/TrackMCTools/src/DebugTrackingLosses.cpp
index a75972a37f8b9d86a8361b3c03ebb7c33b224c05..99468d4cc27e7dab5e0462071506d8372d1693d1 100644
--- a/Tr/TrackMCTools/src/DebugTrackingLosses.cpp
+++ b/Tr/TrackMCTools/src/DebugTrackingLosses.cpp
@@ -86,7 +86,7 @@ StatusCode DebugTrackingLosses::execute() {
   if ( m_vP ) veloTrack = LHCb::TrackLocation::VP;
   LinkedFrom<LHCb::Track,LHCb::MCParticle> veloLinker   ( evtSvc(), msgSvc(), veloTrack    );
 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
 
   LHCb::MCParticles::const_iterator itP = partCont->begin();
   for (; itP != partCont->end(); ++itP){
diff --git a/Tr/TrackMCTools/src/PatDebugTTTruthTool.cpp b/Tr/TrackMCTools/src/PatDebugTTTruthTool.cpp
index d2703ecc31494399de35b00a2aff475e6c061693..dc70651b58e44b19082785a38d0deace8de19f77 100755
--- a/Tr/TrackMCTools/src/PatDebugTTTruthTool.cpp
+++ b/Tr/TrackMCTools/src/PatDebugTTTruthTool.cpp
@@ -188,18 +188,18 @@ double PatDebugTTTruthTool::fracGoodHits( const LHCb::Track* track, const PatTTH
 //=============================================================================
 //  Is this seed track not a ghost and downstream reconstructible
 //=============================================================================
-bool PatDebugTTTruthTool::isDownRecoble( const LHCb::Track* track, const Tf::TTStationHitManager<PatTTHit>::HitRange& hits, 
+bool PatDebugTTTruthTool::isDownRecoble( const LHCb::Track* track, const Tf::TTStationHitManager<PatTTHit>::HitRange& hits,
                                          const unsigned int minHits ){
-  
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
 
   LinkedTo<LHCb::MCParticle, LHCb::Track> mySeedLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Seed);
-  
+
   const LHCb::MCParticle* mcSeedPart = mySeedLink.first( track->key() );
 
   if( mcSeedPart == nullptr ) return false;
   if( std::abs( mcSeedPart->particleID().pid() ) == 11 ) return false;
-  
+
   unsigned int nTrue = 0;
   for( PatTTHit* hit : hits ){
     if( isTrueHit( track, hit ))nTrue++;
@@ -208,8 +208,8 @@ bool PatDebugTTTruthTool::isDownRecoble( const LHCb::Track* track, const Tf::TTS
   if( trackInfo.hasT( mcSeedPart) && trackInfo.hasTT( mcSeedPart ) && nTrue >= minHits ) return true;
 
   return false;
-  
-  
+
+
 }
 //=============================================================================
 //  Is this a 'good' track (according to the TrackAssociator) definition?
@@ -256,7 +256,7 @@ std::map<std::string, bool> PatDebugTTTruthTool::getMCTrackInfo(const LHCb::Trac
     std::map<std::string,bool> parameterMap;
     LinkedTo<LHCb::MCParticle, LHCb::Track> mySeedLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Seed);
     LinkedTo<LHCb::MCParticle, LHCb::STCluster> myClusterLink ( evtSvc(), msgSvc(), LHCb::STClusterLocation::TTClusters );
-    MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+    MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
     const LHCb::MCParticle* mcSeedPart = mySeedLink.first( seed->key() );
 
     if(mcSeedPart)
@@ -278,16 +278,15 @@ std::map<std::string, bool> PatDebugTTTruthTool::getMCTrackInfo(const LHCb::Trac
 
 bool PatDebugTTTruthTool::hasMCParticle(const LHCb::Track* seed) const
 {
-    MCTrackInfo trackInfo( evtSvc(), msgSvc() );
     LinkedTo<LHCb::MCParticle, LHCb::Track> mySeedLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Seed);
     const LHCb::MCParticle* mcSeedPart = mySeedLink.first( seed->key() );
-    return  mcSeedPart != nullptr; 
+    return  mcSeedPart != nullptr;
 
   }
-  
+
 bool PatDebugTTTruthTool::isDownstreamReconstructible(const LHCb::Track* seed) const
   {
-    MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+    MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
     LinkedTo<LHCb::MCParticle, LHCb::Track> mySeedLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Seed);
     const LHCb::MCParticle* mcSeedPart = mySeedLink.first( seed->key() );
     return mcSeedPart && trackInfo.hasT( mcSeedPart ) && trackInfo.hasTT( mcSeedPart );
@@ -295,7 +294,6 @@ bool PatDebugTTTruthTool::isDownstreamReconstructible(const LHCb::Track* seed) c
 
 bool PatDebugTTTruthTool::hasMCParticleNotElectron(const LHCb::Track* seed) const
 {
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
   LinkedTo<LHCb::MCParticle, LHCb::Track> mySeedLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Seed);
   const LHCb::MCParticle* mcSeedPart = mySeedLink.first( seed->key() );
   return  mcSeedPart && std::abs(mcSeedPart->particleID().pid()) != 11;
@@ -303,11 +301,11 @@ bool PatDebugTTTruthTool::hasMCParticleNotElectron(const LHCb::Track* seed) cons
 
 bool PatDebugTTTruthTool::isDownstreamReconstructibleNotElectron(const LHCb::Track* seed) const
 {
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
   LinkedTo<LHCb::MCParticle, LHCb::Track> mySeedLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Seed);
   const LHCb::MCParticle* mcSeedPart = mySeedLink.first( seed->key() );
- return mcSeedPart && trackInfo.hasT( mcSeedPart ) && 
-    trackInfo.hasTT( mcSeedPart )&& 
+ return mcSeedPart && trackInfo.hasT( mcSeedPart ) &&
+    trackInfo.hasTT( mcSeedPart )&&
     std::abs(mcSeedPart->particleID().pid()) != 11 ;
 
 }
@@ -315,12 +313,12 @@ bool PatDebugTTTruthTool::isDownstreamReconstructibleNotElectron(const LHCb::Tra
 
 bool PatDebugTTTruthTool::isTrueSeed(const LHCb::Track* seed) const
 {
-    MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+    MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
     LinkedTo<LHCb::MCParticle, LHCb::Track> mySeedLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Seed);
-    
+
     const LHCb::MCParticle* mcSeedPart = mySeedLink.first( seed->key() );
-    return mcSeedPart && trackInfo.hasT( mcSeedPart ) && 
-      trackInfo.hasTT( mcSeedPart ) && 
+    return mcSeedPart && trackInfo.hasT( mcSeedPart ) &&
+      trackInfo.hasTT( mcSeedPart ) &&
       !trackInfo.hasVelo( mcSeedPart) &&
       std::abs(mcSeedPart->particleID().pid()) != 11 ;
 
@@ -362,11 +360,11 @@ void PatDebugTTTruthTool::seedTuple(const LHCb::Track* trackSeed, double seedCla
     tuple->column("seed_p", trackSeed->p());
     tuple->column("seed_pt", trackSeed->pt());
     tuple->column("seed_nLHCbIDs", trackSeed->nLHCbIDs());
-    const unsigned int nbIT = std::count_if( trackSeed->lhcbIDs().begin(), trackSeed->lhcbIDs().end(), 
+    const unsigned int nbIT = std::count_if( trackSeed->lhcbIDs().begin(), trackSeed->lhcbIDs().end(),
                                            [](const LHCb::LHCbID id){ return id.isIT();});
     tuple->column("seed_nbIT", nbIT);
     // number of layers
-   std::bitset<12> layers; 
+   std::bitset<12> layers;
    auto st2layer =  [](LHCb::STChannelID id) { return 4*(id.station()-1)+id.layer()-1; };
    for( auto id :  trackSeed->lhcbIDs() ){
       layers.set( id.isOT() ? id.otID().sequentialUniqueLayer() : st2layer(id.stID())) ;
@@ -388,15 +386,15 @@ void PatDebugTTTruthTool::seedTuple(const LHCb::Track* trackSeed, double seedCla
 //=========================================================================
 void PatDebugTTTruthTool::finalTuple( const bool goodTrack, const LHCb::Track* track, const std::vector<double>& vals ){
 
-  MCTrackInfo trackInfo( evtSvc(), msgSvc() );
+  MCTrackInfo trackInfo = make_MCTrackInfo( evtSvc(), msgSvc() );
   LinkedTo<LHCb::MCParticle, LHCb::Track> mySeedLink ( evtSvc(), msgSvc(),LHCb::TrackLocation::Seed);
   const LHCb::MCParticle* mcSeedPart = mySeedLink.first( track->key() );
   // -- Don't train on long tracks, but don't classify as ghosts either
   if( mcSeedPart && goodTrack && trackInfo.hasT( mcSeedPart) && trackInfo.hasTT( mcSeedPart ) && trackInfo.hasVelo( mcSeedPart) ) return;
-  
+
   if(mcSeedPart){
     if( std::abs(mcSeedPart->particleID().pid()) == 11 ) return;
-  
+
     bool goodDau = false;
     if ( 0 != mcSeedPart->originVertex() ) {
       const LHCb::MCParticle* mother =  mcSeedPart->originVertex()->mother();
@@ -420,14 +418,14 @@ void PatDebugTTTruthTool::finalTuple( const bool goodTrack, const LHCb::Track* t
     }
     if( !goodDau ) return;
   }
-  
+
   bool gT = goodTrack && (mcSeedPart != nullptr);
 
   /*
-    std::vector<double> vals ={ 
-    vdt::fast_log(track.chi2()),   
+    std::vector<double> vals ={
+    vdt::fast_log(track.chi2()),
     vdt::fast_log(track.p()),
-    vdt::fast_log(track.pt()),                     
+    vdt::fast_log(track.pt()),
     std::abs(deltaP),
     vdt::fast_log(std::abs(track.dxMagnet())),
     vdt::fast_log(std::abs(distance)),
@@ -449,7 +447,7 @@ void PatDebugTTTruthTool::finalTuple( const bool goodTrack, const LHCb::Track* t
   tuple->column("firedLayers", vals[8] );
   tuple->column("goodTrack", gT );
   tuple->write();
-  
+
 }
 
 
diff --git a/Tr/TrackMonitors/src/VPTrackMonitor.cpp b/Tr/TrackMonitors/src/VPTrackMonitor.cpp
index ceb7f35b73103671231c8ba7acd3c556f21e2270..0bae7fd3efe2a35275b120615c2c5732bc4e7b4d 100644
--- a/Tr/TrackMonitors/src/VPTrackMonitor.cpp
+++ b/Tr/TrackMonitors/src/VPTrackMonitor.cpp
@@ -1,7 +1,7 @@
 // LHCb
 #include "Event/Track.h"
 #include "Event/Node.h"
-#include "Event/VPCluster.h"
+#include "Event/VPLightCluster.h"
 
 // Local
 #include "VPTrackMonitor.h"
@@ -23,9 +23,9 @@ VPTrackMonitor::VPTrackMonitor(const std::string& name,
   declareProperty("TrackContainer",
                   m_trackLocation = LHCb::TrackLocation::Default);
   declareProperty("ClusterContainer",
-                  m_clusterLocation = LHCb::VPClusterLocation::Default);
+                  m_clusterLocation = LHCb::VPClusterLocation::Light);
   declareProperty("LinkedHitsLocation",
-                   m_linkedHitsLocation = LHCb::VPClusterLocation::Default + "2MCHits");
+                   m_linkedHitsLocation = LHCb::VPClusterLocation::Light + "2MCHits");
 }
 
 //=============================================================================
@@ -60,13 +60,13 @@ StatusCode VPTrackMonitor::execute() {
   }
   const Gaudi::XYZPoint origin(0., 0., 0.);
 
-  const LHCb::VPClusters* clusters = getIfExists<LHCb::VPClusters>(m_clusterLocation);
+  const LHCb::VPLightClusters* clusters = getIfExists<LHCb::VPLightClusters>(m_clusterLocation);
   if (!clusters) {
     return Error("No clusters at " + m_clusterLocation);
   }
 
 
-  auto links = LinkedTo<LHCb::MCHit, LHCb::VPCluster>(evtSvc(), msgSvc(),
+  auto links = LinkedTo<LHCb::MCHit, LHCb::VPLightCluster>(evtSvc(), msgSvc(),
   m_linkedHitsLocation);
 
   size_t tracknumber=0;
@@ -112,11 +112,11 @@ StatusCode VPTrackMonitor::execute() {
       const LHCb::LHCbID id = (node->measurement()).lhcbID();
 
       const LHCb::VPChannelID vpx_id = id.vpID();
-      const LHCb::VPCluster* node_cluster = nullptr;
+      const LHCb::VPLightCluster* node_cluster = nullptr;
 
-      for(const LHCb::VPCluster* cluster : *clusters){
-        if(cluster->channelID()==vpx_id){
-          node_cluster=cluster;
+      for(auto& cluster : *clusters){
+        if(cluster.second.channelID()==vpx_id){
+          node_cluster=&cluster.second;
           break;
         }
       }
diff --git a/Tr/TrackTools/src/UpgradeGhostId.cpp b/Tr/TrackTools/src/UpgradeGhostId.cpp
index 7b481e93e3ebf62b338b80526b6661815ea14fc1..416536cc2d38dd93503868ae1fc7a4630114f874 100644
--- a/Tr/TrackTools/src/UpgradeGhostId.cpp
+++ b/Tr/TrackTools/src/UpgradeGhostId.cpp
@@ -5,7 +5,7 @@
 #include "Event/STCluster.h"
 #include "Event/Track.h"
 #include "Event/TrackFitResult.h"
-#include "Event/VPCluster.h"
+#include "Event/VPLightCluster.h"
 #include "Event/GhostTrackInfo.h"
 #include "TMVA/TMVAUp_1_MLP_1.class.C"
 #include "TMVA/TMVAUp_3_MLP_3.class.C"
@@ -57,15 +57,7 @@ StatusCode UpgradeGhostId::initialize()
      std::max(LHCb::Track::Types::Ttrack,LHCb::Track::Types::Downstream))))
     return Warning("ARRAY SIZE SET WRONG (largestTrackTypes is smaller than enum LHCb::Track::Types",StatusCode::FAILURE);
 
-  // expect hit patterns
-  //if (true) {
-    m_vpExpectation = tool<IVPExpectation>("VPExpectation");
-    //m_veloExpectation = NULL;
-//  } else {
-//    m_vpExpectation = NULL;
-//    m_otdecoder = tool<IOTRawBankDecoder>("OTRawBankDecoder");
-//    m_veloExpectation = tool<IVeloExpectation>("VeloExpectation");
-//  }
+  m_vpExpectation = tool<IVPExpectation>("VPExpectation");
   for (auto entry : m_expectorNames) {
     m_Expectations.push_back(tool<IHitExpectation>(entry));
   }
@@ -88,39 +80,12 @@ StatusCode UpgradeGhostId::initialize()
 }
 
 StatusCode UpgradeGhostId::countHits() {
-  const LHCb::VPClusters* vpCont = NULL;
+  const LHCb::VPLightClusters* vpCont = NULL;
   const LHCb::STClusters* utCont = NULL;
-  vpCont = getIfExists<LHCb::VPClusters>(LHCb::VPClusterLocation::Default);
+  vpCont = getIfExists<LHCb::VPLightClusters>(LHCb::VPClusterLocation::Light);
   utCont = getIfExists<LHCb::STClusters>(LHCb::STClusterLocation::UTClusters);
   if (vpCont) m_veloHits = vpCont->size();
   if (utCont) m_utHits = utCont->size();
-  //const bool run2 = false;
-  //const LHCb::VeloLiteCluster::VeloLiteClusters* veloCont = NULL;
-  //const LHCb::STClusters* ttCont = NULL;
-  //const LHCb::STClusters* itCont = NULL;
-  //typedef FastClusterContainer<LHCb::FTRawCluster,int> FTRawClusters;
-  //FTRawClusters* ftCont = NULL;
-  //if (!run2) {
-  //  ftCont = getIfExists<FTRawClusters>( LHCb::FTRawClusterLocation::Default );
-  //  if (!ftCont) {
-  //    //FTRawClusters* tmp =
-  //    getIfExists<FTRawClusters>("Raw/FT/RawClusters");//needed to create clusters in LHCb::FTRawClusterLocation::Default
-  //    ftCont = getIfExists<FTRawClusters>( LHCb::FTRawClusterLocation::Default );
-  //  }
-  //} else {
-  //  veloCont = getIfExists<LHCb::VeloLiteCluster::VeloLiteClusters>(LHCb::VeloLiteClusterLocation::Default);
-  //  ttCont = getIfExists<LHCb::STClusters>(LHCb::STClusterLocation::TTClusters);
-  //  itCont = getIfExists<LHCb::STClusters>(LHCb::STClusterLocation::ITClusters);
-  //}
-  //if (veloCont) m_veloHits = veloCont->size();
-  //if (ttCont) m_ttHits = ttCont->size();;
-  //if (ftCont) m_ftHits = ftCont->size();;
-  //if (itCont) m_itHits = itCont->size();;
-  //if (run2) m_otHits = m_otdecoder->totalNumberOfHits();
-
-  //  if (!((vpCont && utCont && ftCont) // this is upgrade, all have to be there
-  //      || (veloCont && ttCont && itCont && ot) // otherwise we're in runI/II
-  //     )) return Warning("detector missing",StatusCode::FAILURE,10);
   if (!((vpCont)&&(utCont))) {
     return StatusCode::FAILURE;
   }
@@ -132,10 +97,6 @@ namespace {
   inline std::vector<double> subdetectorhits(const LHCb::Track& aTrack) {
 
     std::vector<double> returnvalue = std::vector<double>(largestChannelIDype,0.);
-    // optimised out:
-    //returnvalue[LHCb::LHCbID::TT] = 0.;
-    //returnvalue[LHCb::LHCbID::IT] = 0.;
-    //returnvalue[LHCb::LHCbID::OT] = 0.;
     returnvalue[LHCb::LHCbID::UT] = 0.;
     returnvalue[LHCb::LHCbID::FT] = 0.;
     returnvalue[LHCb::LHCbID::VP] = 0.;
@@ -151,15 +112,6 @@ namespace {
 //=============================================================================
 StatusCode UpgradeGhostId::execute(LHCb::Track& aTrack) const
 {
-  /// code for debuging:
-  ///if (true) {
-  ///  int veloHits;
-  ///  const LHCb::VPClusters* vpCont = NULL;
-  ///  vpCont = getIfExists<LHCb::VPClusters>(LHCb::VPClusterLocation::Default);
-  ///  if (vpCont) veloHits = vpCont->size();
-  ///  if (veloHits != m_veloHits) return Error("This is very bad!!!",StatusCode::FAILURE,10);
-  ///}
-
   std::vector<double> obsarray = subdetectorhits(aTrack);
   const LHCb::TrackFitResult* fit = aTrack.fitResult();
 
diff --git a/Tr/TrackUtils/src/TrackBestTrackCreator.h b/Tr/TrackUtils/src/TrackBestTrackCreator.h
index 1462363132298e28e1ad449917b76e3605bb1b75..f76d9f43d621e531338f20c548b51a897f4383c6 100644
--- a/Tr/TrackUtils/src/TrackBestTrackCreator.h
+++ b/Tr/TrackUtils/src/TrackBestTrackCreator.h
@@ -110,7 +110,7 @@ public:
 private:
   ToolHandle<ITrackStateInit> m_stateinittool{"TrackStateInitTool", this};
   ToolHandle<ITrackFitter> m_fitter{"TrackMasterFitter", this};
-  ToolHandle<IGhostProbability> m_ghostTool{"Run2GhostId", this};
+  ToolHandle<IGhostProbability> m_ghostTool{"UpgradeGhostId", this};
 
   Gaudi::Property<double> m_maxOverlapFracVelo{this, "MaxOverlapFracVelo", 0.5};
   Gaudi::Property<double> m_maxOverlapFracT{this, "MaxOverlapFracT", 0.5};
diff --git a/run b/run
new file mode 120000
index 0000000000000000000000000000000000000000..9f52d876c4354089e377bdb3b51be2d49eca130e
--- /dev/null
+++ b/run
@@ -0,0 +1 @@
+build.x86_64+avx2+fma-centos7-gcc7-opt/run
\ No newline at end of file
diff --git a/toolchain.cmake b/toolchain.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..b642413cba9aa2de3c821d817e8323fbef7a5967
--- /dev/null
+++ b/toolchain.cmake
@@ -0,0 +1 @@
+include($ENV{LBUTILSROOT}/data/toolchain.cmake)