diff --git a/Calorimeter/CaloTrackUtils/src/CaloClusterVertexFractionMaker.cxx b/Calorimeter/CaloTrackUtils/src/CaloClusterVertexFractionMaker.cxx
index 8b395348f418fc16bde2ac601e37b7c1fac7f59a..4154ccf630aa3092fffde61765e1040e1c01abaf 100755
--- a/Calorimeter/CaloTrackUtils/src/CaloClusterVertexFractionMaker.cxx
+++ b/Calorimeter/CaloTrackUtils/src/CaloClusterVertexFractionMaker.cxx
@@ -139,7 +139,7 @@ CaloClusterVertexFractionMaker::execute(const EventContext& ctx,
                 *m_discSurface_atCaloEntrance_positiveZ,
                 Trk::alongMomentum,
                 true,
-                Trk::pion));
+                Trk::pion).release());
           } else if (theTrackParticle->eta() <
                      -1.35) // track most likely in endcap C, extrapolate track
                             // to a disc at ID exist in negative z direction
@@ -151,7 +151,7 @@ CaloClusterVertexFractionMaker::execute(const EventContext& ctx,
                 *m_discSurface_atCaloEntrance_negativeZ,
                 Trk::alongMomentum,
                 true,
-                Trk::pion));
+                Trk::pion).release());
           } else // track is in barrel, extrapolate to cylinder at ID exit
           {
             trackParameters_atCaloEntrance =
@@ -161,7 +161,7 @@ CaloClusterVertexFractionMaker::execute(const EventContext& ctx,
                                             *m_cylinderSurface_atCaloEntrance,
                                             Trk::alongMomentum,
                                             true,
-                                            Trk::pion));
+                                            Trk::pion).release());
           }
           if (trackParameters_atCaloEntrance != nullptr) {
             m_trkParticleEta_atCaloEntrance->push_back(trackParameters_atCaloEntrance->position().eta());
diff --git a/DataQuality/DataQualityTools/src/DQTMuonIDTrackTool.cxx b/DataQuality/DataQualityTools/src/DQTMuonIDTrackTool.cxx
index 6d957f3f4db756b4d5aa8b13ba3f5e45d517798b..52cca2fa7f4f7009719d28b4b68567465a5704bb 100644
--- a/DataQuality/DataQualityTools/src/DQTMuonIDTrackTool.cxx
+++ b/DataQuality/DataQualityTools/src/DQTMuonIDTrackTool.cxx
@@ -463,7 +463,7 @@ StatusCode DQTMuonIDTrackTool::fillHistograms()
                                       (idPerigee->associatedSurface()),
                                       Trk::anyDirection,
                                       true,
-                                      Trk::pion);
+                                      Trk::pion).release();
         ATH_MSG_WARNING("measPerigee? " << measPerigee);
         if (!measPerigee) {
           ATH_MSG_WARNING("Extrapolation failed 1!!");
@@ -496,14 +496,14 @@ StatusCode DQTMuonIDTrackTool::fillHistograms()
                const Trk::Perigee *measPerigee2 = &((*muontracksItr2)->perigeeParameters());
 
                if (measPerigee2) {
-                 measPerigee2 = dynamic_cast<const Trk::Perigee*>(
-                   m_extrapolator->extrapolate(
-                     ctx,
-                     *measPerigee2,
-                     (idPerigee2->associatedSurface()),
-                     Trk::anyDirection,
-                     false,
-                     Trk::muon));
+                 std::unique_ptr<const Trk::TrackParameters> tmp = m_extrapolator->extrapolate(
+                   ctx, *measPerigee2, (idPerigee2->associatedSurface()), Trk::anyDirection, false, Trk::muon);
+                  
+                 //release ownership if of the right type
+                 if (tmp && tmp->associatedSurface().type() == Trk::SurfaceType::Perigee) {
+                   measPerigee2 = static_cast<const Trk::Perigee*>(tmp.release());
+                 }
+
                  if (!measPerigee2) {
                    ATH_MSG_WARNING("Extrapolation failed 2!!");
                  }
diff --git a/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignFillTrack.cxx b/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignFillTrack.cxx
index 851a1414ff7f027c71a2d5230e75f17987ca1a63..9f918794835d640d48d2316c72561ce914e408c4 100644
--- a/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignFillTrack.cxx
+++ b/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignFillTrack.cxx
@@ -454,7 +454,7 @@ StatusCode InDetAlignFillTrack::FillTrack() {
                                                                                 perigeeSurface,
                                                                                 Trk::anyDirection,
                                                                                 false,
-                                                                                Trk::nonInteracting);
+                                                                                Trk::nonInteracting).release();
                     if (!generatedTrackPerigee) continue;
                   } else {
                     ATH_MSG_DEBUG("Distance between perigee and generated vertex is less than tolerance ("
diff --git a/InnerDetector/InDetAlignment/InDetAlignNtupleTools/src/DetailedIDNtupleTool.cxx b/InnerDetector/InDetAlignment/InDetAlignNtupleTools/src/DetailedIDNtupleTool.cxx
index b9c500b078f463eedb908b5b0d75eb86f1817a16..d95cd45abf7090552a0a464d0745dc6d811c477f 100644
--- a/InnerDetector/InDetAlignment/InDetAlignNtupleTools/src/DetailedIDNtupleTool.cxx
+++ b/InnerDetector/InDetAlignment/InDetAlignNtupleTools/src/DetailedIDNtupleTool.cxx
@@ -298,7 +298,7 @@ namespace InDet {
 
       const Trk::PerigeeSurface persf(refPoint);
       const Trk::Perigee* originalPerigeeAtRef =
-        dynamic_cast<const Trk::Perigee*>(m_extrapolator->extrapolate(ctx, *originalTrack, persf));
+        dynamic_cast<const Trk::Perigee*>(m_extrapolator->extrapolate(ctx, *originalTrack, persf).release());
       if (!originalPerigeeAtRef) {
         const Trk::Perigee* originalTrackPerigee = originalTrack->perigeeParameters();
         if (originalTrackPerigee && ((originalTrackPerigee->associatedSurface())) == persf) {
@@ -317,7 +317,7 @@ namespace InDet {
       }
 
       const Trk::Perigee* PerigeeAtRef =
-        dynamic_cast<const Trk::Perigee*>(m_extrapolator->extrapolate(ctx, *alignTrack, persf));
+        dynamic_cast<const Trk::Perigee*>(m_extrapolator->extrapolate(ctx, *alignTrack, persf).release());
       if (!PerigeeAtRef) {
         const Trk::Perigee* alignTrackPerigee = alignTrack->perigeeParameters();
         if (alignTrackPerigee && ((alignTrackPerigee->associatedSurface())) == persf) {
diff --git a/InnerDetector/InDetCosmics/TRT_SegmentsToTrack/src/TRT_SegmentsToTrack.cxx b/InnerDetector/InDetCosmics/TRT_SegmentsToTrack/src/TRT_SegmentsToTrack.cxx
index ca92d23d45caa58c831d183c8e47855cae9acd09..2dc0ad00b9ad16d041d41506045dac2d9933c0c1 100755
--- a/InnerDetector/InDetCosmics/TRT_SegmentsToTrack/src/TRT_SegmentsToTrack.cxx
+++ b/InnerDetector/InDetCosmics/TRT_SegmentsToTrack/src/TRT_SegmentsToTrack.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 
 //======================================================
@@ -226,7 +226,11 @@ StatusCode InDet::TRT_SegmentsToTrack::execute()
         int nmeas=(*iseg)->numberOfMeasurementBases();
         Amg::Vector3D surfpos(.5*((*iseg)->measurement(nmeas/2)->globalPosition()+(*iseg)->measurement(nmeas/2+1)->globalPosition()));
         Trk::PerigeeSurface persurf(surfpos);
-        inputMatchPerigee = dynamic_cast<const Trk::Perigee*>(m_extrapolator->extrapolateDirectly(ctx,*inputMatchLine,persurf));
+        std::unique_ptr<const Trk::TrackParameters> tmp =
+          m_extrapolator->extrapolateDirectly(ctx, *inputMatchLine, persurf);
+        if (tmp && tmp->associatedSurface().type() == Trk::SurfaceType::Perigee) {
+          inputMatchPerigee = static_cast<const Trk::Perigee*>(tmp.release());
+        }
       }
       ATH_MSG_DEBUG("Created inputMatchLine");
       
@@ -255,7 +259,7 @@ StatusCode InDet::TRT_SegmentsToTrack::execute()
         }
         std::unique_ptr<const Trk::TrackParameters> myper;
         if (measpar){
-          myper.reset(m_extrapolator->extrapolate(ctx,*measpar,Trk::PerigeeSurface(),Trk::anyDirection,false, m_materialEffects ? Trk::muon : Trk::nonInteracting));
+          myper = m_extrapolator->extrapolate(ctx,*measpar,Trk::PerigeeSurface(),Trk::anyDirection,false, m_materialEffects ? Trk::muon : Trk::nonInteracting);
         }
         if (!myper){
           fittedTrack.reset();
diff --git a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx
index aedda941553381e4f6690066fbc249917d970151..70ac712a1d8d8bd75b297e5a6c8dab4a1f0e708e 100755
--- a/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx
+++ b/InnerDetector/InDetMonitoring/InDetPerformanceMonitoring/src/IDPerfMonZmumu.cxx
@@ -1876,7 +1876,7 @@ StatusCode IDPerfMonZmumu::FillTruthParameters(const xAOD::TrackParticle* trackP
   Trk::PerigeeSurface persf( beamSpotHandle->beamPos() );
 
   const Trk::TrackParameters* tP = m_extrapolator->extrapolate(ctx,
-                                                               cParameters,persf, Trk::anyDirection, false);
+                                                               cParameters,persf, Trk::anyDirection, false).release();
 
 
   double px = 0;
diff --git a/InnerDetector/InDetRecAlgs/InDetV0Finder/src/InDetV0FinderTool.cxx b/InnerDetector/InDetRecAlgs/InDetV0Finder/src/InDetV0FinderTool.cxx
index eef07ac4add748dbed242185d547c91a9ea4597a..e5f1de3c07b0243fed6436c8b7b072390001c490 100755
--- a/InnerDetector/InDetRecAlgs/InDetV0Finder/src/InDetV0FinderTool.cxx
+++ b/InnerDetector/InDetRecAlgs/InDetV0Finder/src/InDetV0FinderTool.cxx
@@ -722,11 +722,11 @@ bool InDetV0FinderTool::doFit(const xAOD::TrackParticle* track1, const xAOD::Tra
     std::vector<std::unique_ptr<const Trk::TrackParameters> >  cleanup;
     const Trk::TrackParameters* extrapolatedPerigee1(nullptr);
     const Trk::TrackParameters* extrapolatedPerigee2(nullptr);
-    extrapolatedPerigee1 = m_extrapolator->extrapolate(ctx,track1->perigeeParameters(), perigeeSurface);
+    extrapolatedPerigee1 = m_extrapolator->extrapolate(ctx,track1->perigeeParameters(), perigeeSurface).release();
     if (extrapolatedPerigee1 == nullptr) extrapolatedPerigee1 = &track1->perigeeParameters();
     else cleanup.push_back(std::unique_ptr<const Trk::TrackParameters>(extrapolatedPerigee1));
 
-    extrapolatedPerigee2 = m_extrapolator->extrapolate(ctx,track2->perigeeParameters(), perigeeSurface);
+    extrapolatedPerigee2 = m_extrapolator->extrapolate(ctx,track2->perigeeParameters(), perigeeSurface).release();
     if (extrapolatedPerigee2 == nullptr) extrapolatedPerigee2 = &track2->perigeeParameters();
     else cleanup.push_back(std::unique_ptr<const Trk::TrackParameters>(extrapolatedPerigee2));
 
diff --git a/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/src/TRT_SeededTrackFinder.cxx b/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/src/TRT_SeededTrackFinder.cxx
index 49f5ec1c3272cc1b36042f2e60e261d1a14b7ad8..e8fc77cd2e466db05b58bf957b6cb55488e73e0d 100644
--- a/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/src/TRT_SeededTrackFinder.cxx
+++ b/InnerDetector/InDetRecAlgs/TRT_SeededTrackFinder/src/TRT_SeededTrackFinder.cxx
@@ -308,13 +308,15 @@ InDet::TRT_SeededTrackFinder::execute_r (const EventContext& ctx) const{
               Trk::PerigeeSurface perigeeSurface(beamSpotPosition);
 
               // uses perigee on track or extrapolates, no material in any case, we cut on impacts
-              const Trk::TrackParameters* parm = m_extrapolator->extrapolateDirectly(ctx, 
-                                                                                     *input, 
-                                                                                     perigeeSurface);
-              const Trk::Perigee* extrapolatedPerigee = dynamic_cast<const Trk::Perigee*> (parm );
+              std::unique_ptr<const Trk::TrackParameters> parm =
+                m_extrapolator->extrapolateDirectly(
+                  ctx, *input, perigeeSurface);
+              std::unique_ptr<const Trk::Perigee> extrapolatedPerigee = nullptr;
+              if (parm && parm->associatedSurface().type() == Trk::SurfaceType::Perigee) {
+                extrapolatedPerigee.reset(static_cast<const Trk::Perigee*>(parm.release()));
+              }
               if (!extrapolatedPerigee) {
                 ATH_MSG_WARNING("Extrapolation of perigee failed, this should never happen" );
-                delete parm;
                 // statistics
                 ev_stat.m_counter[Stat_t::kNExtCut]++;
                 continue;
@@ -323,19 +325,16 @@ InDet::TRT_SeededTrackFinder::execute_r (const EventContext& ctx) const{
               ATH_MSG_VERBOSE ("extrapolated perigee: "<<*extrapolatedPerigee);
               if (std::abs(extrapolatedPerigee->parameters()[Trk::d0]) > m_maxRPhiImp) {
                 ATH_MSG_DEBUG ("Track Rphi impact > "<<m_maxRPhiImp<<", reject it");
-                delete extrapolatedPerigee;
                 // statistics
                 ev_stat.m_counter[Stat_t::kNExtCut]++;
                 continue;
               }
               if (std::abs(extrapolatedPerigee->parameters()[Trk::z0]) > m_maxZImp) {
                 ATH_MSG_DEBUG ("Track Z impact > "<<m_maxZImp<<", reject it");
-                delete extrapolatedPerigee;
                 // statistics
                 ev_stat.m_counter[Stat_t::kNExtCut]++;
                 continue;
               }
-              delete extrapolatedPerigee;
             }
 
             // do re run a Track extension into TRT ?
diff --git a/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingPixelClustersOnTrackTool.cxx b/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingPixelClustersOnTrackTool.cxx
index 9eb0b8ecaf17fc3d4249b1057bec500d393af19f..de53d2f454eadd2802636518cf3541c0e66bb90e 100755
--- a/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingPixelClustersOnTrackTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingPixelClustersOnTrackTool.cxx
@@ -173,7 +173,7 @@ const InDet::CompetingPixelClustersOnTrack* InDet::CompetingPixelClustersOnTrack
                                                                         (trkParWithoutError ? *trkParWithoutError : trkPar), *detElementSurface,
                                                                         Trk::anyDirection, // propagate in any direction
                                                                         false, //do noBoundaryCheck!
-                                                                        Trk::nonInteracting); // without material interaction
+                                                                        Trk::nonInteracting).release(); // without material interaction
                 if (!newTrackParameters){
                     ATH_MSG_ERROR("TrackParameters could not be propagated to PrepRawData surface");
                     delete ROTvector;
@@ -326,7 +326,7 @@ void InDet::CompetingPixelClustersOnTrackTool::updateCompetingROT(
                                                                 (trkParWithoutError ? *trkParWithoutError : trkPar), compROT->associatedSurface(),
                                                                 Trk::anyDirection, // propagate in any direction
                                                                 false, //do noBoundaryCheck!
-                                                                Trk::nonInteracting); // without material interaction
+                                                                Trk::nonInteracting).release(); // without material interaction
         delete trkParWithoutError;
         trkParWithoutError = nullptr;
         if (!newTrackParameters){
diff --git a/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingSCT_ClustersOnTrackTool.cxx b/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingSCT_ClustersOnTrackTool.cxx
index c98da54ded1eb831176253064f4a4a842d5c7a1d..ac37b579fabc32c5f25c421caea731b726f67d50 100755
--- a/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingSCT_ClustersOnTrackTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingSCT_ClustersOnTrackTool.cxx
@@ -166,17 +166,21 @@ const InDet::CompetingSCT_ClustersOnTrack* InDet::CompetingSCT_ClustersOnTrackTo
                 std::unique_ptr<const Trk::TrackParameters> trkParWithoutError{trkPar.clone()};
                 // extrapolate to RIO surface
                 ATH_MSG_VERBOSE("Try to propagate TrackParameters to compROT surface");
-                newTrackParameters.reset(m_extrapolator->extrapolateDirectly(ctx,
-                                                                             (trkParWithoutError ? *trkParWithoutError : trkPar),
-                                                                             *detElementSurface,
-                                                                             Trk::anyDirection, // propagate in any direction
-                                                                             false, //do noBoundaryCheck!
-                                                                             Trk::nonInteracting)); // without material interaction
-                if (!newTrackParameters){
-                    ATH_MSG_ERROR("TrackParameters could not be propagated to PrepRawData surface");
-                    return nullptr;
+                newTrackParameters = m_extrapolator->extrapolateDirectly(
+                  ctx,
+                  (trkParWithoutError ? *trkParWithoutError : trkPar),
+                  *detElementSurface,
+                  Trk::anyDirection,    // propagate in any direction
+                  false,                // do noBoundaryCheck!
+                  Trk::nonInteracting); // without material interaction
+                if (!newTrackParameters) {
+                  ATH_MSG_ERROR("TrackParameters could not be propagated to "
+                                "PrepRawData surface");
+                  return nullptr;
                 } // end if (extrapolation failed)
-                // const Trk::AtaStraightLine* trkParAtRIOsurface1 = new Trk::AtaStraightLine(trkPar.position(), trkPar.momentum(), trkPar.charge(), *RIOsurfacePointer);
+                // const Trk::AtaStraightLine* trkParAtRIOsurface1 = new
+                // Trk::AtaStraightLine(trkPar.position(), trkPar.momentum(),
+                // trkPar.charge(), *RIOsurfacePointer);
                 trkParAtRIOsurface = newTrackParameters.get();
                 ATH_MSG_VERBOSE("propagated TrackParameters on RIO surface: GP ("
                                         << trkParAtRIOsurface->position().x() << ", "
@@ -312,12 +316,13 @@ void InDet::CompetingSCT_ClustersOnTrackTool::updateCompetingROT(
         // clone TrkParameters without error to force the extrapolator to do propagation without error matrix
         std::unique_ptr<const Trk::TrackParameters> trkParWithoutError{trkPar.clone()};
         ATH_MSG_VERBOSE("Try to propagate TrackParameters to compROT surface");
-        newTrackParameters.reset(m_extrapolator->extrapolateDirectly(ctx,
-                                                                     (trkParWithoutError ? *trkParWithoutError : trkPar),
-                                                                     compROT->associatedSurface(),
-                                                                     Trk::anyDirection, // propagate in any direction
-                                                                     false, //do noBoundaryCheck!
-                                                                     Trk::nonInteracting)); // without material interaction
+        newTrackParameters = m_extrapolator->extrapolateDirectly(
+          ctx,
+          (trkParWithoutError ? *trkParWithoutError : trkPar),
+          compROT->associatedSurface(),
+          Trk::anyDirection,    // propagate in any direction
+          false,                // do noBoundaryCheck!
+          Trk::nonInteracting); // without material interaction
         if (!newTrackParameters){
             ATH_MSG_ERROR("TrackParameters could not be propagated to compROT surface:");
             ATH_MSG_ERROR("    CompetingSCT_ClustersOnTrack could not be updated!");
diff --git a/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingTRT_DriftCirclesOnTrackTool.cxx b/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingTRT_DriftCirclesOnTrackTool.cxx
index a2492f31532fe14af0bcddfe7b7f5c683fca6381..ab213d4ee2e90254f42085175937fb493b4c72ac 100755
--- a/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingTRT_DriftCirclesOnTrackTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetCompetingRIOsOnTrackTool/src/CompetingTRT_DriftCirclesOnTrackTool.cxx
@@ -186,7 +186,7 @@ const InDet::CompetingTRT_DriftCirclesOnTrack* InDet::CompetingTRT_DriftCirclesO
                                                                              (trkParWithoutError ? *trkParWithoutError : trkPar), *RIOsurfacePointer,
                                                                              Trk::anyDirection, // propagate in any direction
                                                                              false, //do noBoundaryCheck!
-                                                                             Trk::noHypothesis); // without material interaction
+                                                                             Trk::noHypothesis).release(); // without material interaction
                     if (!newTrackParameters){
                         ATH_MSG_ERROR("TrackParameters could not be propagated to PrepRawData surface");
                         delete ROTvector;
@@ -548,7 +548,7 @@ void InDet::CompetingTRT_DriftCirclesOnTrackTool::updateCompetingROT(
                                                                     Trk::anyDirection, // propagate in any direction
                                                                     //Trk::alongMomentum, // propagate in any direction
                                                                     false, //do noBoundaryCheck!
-                                                                    Trk::noHypothesis); // without material interaction
+                                                                    Trk::noHypothesis).release(); // without material interaction
             if (!newTrackParameters){
                 ATH_MSG_ERROR("TrackParameters could not be propagated to RIO_OnTrack surface");
                 delete assgnProbVector;
diff --git a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/DivisiveMultiSeedFinder.cxx b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/DivisiveMultiSeedFinder.cxx
index 0ff637176a3bca10cc5b4038c8b4a6c658175881..de3790f9cc20d5f0ac341776367ff7b924881100 100644
--- a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/DivisiveMultiSeedFinder.cxx
+++ b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/DivisiveMultiSeedFinder.cxx
@@ -130,9 +130,11 @@ namespace InDet
    
    Trk::PerigeeSurface perigeeSurface(beamposition->position());
 
-   const Trk::TrackParameters * exPerigee = m_extrapolator->extrapolate(ctx, *preselectedTracks[indexOfSorted[0]],
-									perigeeSurface,Trk::anyDirection,true, Trk::pion);
-         
+   const Trk::TrackParameters* exPerigee =
+     m_extrapolator
+       ->extrapolate(ctx, *preselectedTracks[indexOfSorted[0]], perigeeSurface, Trk::anyDirection, true, Trk::pion)
+       .release();
+
    double lastTrackZ0  = -999.;
    if(exPerigee) { lastTrackZ0 = exPerigee->parameters()[Trk::z0]; delete exPerigee; }
    else
@@ -144,19 +146,19 @@ namespace InDet
 
 //looping over container
    for(unsigned int i=0;i<indexOfSorted.size();++i)
-   { 
-     const  Trk::TrackParameters * lexPerigee = m_extrapolator->extrapolate(ctx,*preselectedTracks[indexOfSorted[i]],
-									    perigeeSurface,Trk::anyDirection,true, Trk::pion); 
-					   
-    double currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
-    delete lexPerigee;
-  
-   
-    if(fabs(currentTrackZ0 - lastTrackZ0)<m_sepDistance)
-    {
-  
-//the distance is below separation, adding to the same cluster  
-     tmp_cluster.push_back(preselectedTracks[indexOfSorted[i]]);
+   {
+     const Trk::TrackParameters* lexPerigee =
+       m_extrapolator
+         ->extrapolate(ctx, *preselectedTracks[indexOfSorted[i]], perigeeSurface, Trk::anyDirection, true, Trk::pion)
+         .release();
+
+     double currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
+     delete lexPerigee;
+
+     if (std::fabs(currentTrackZ0 - lastTrackZ0) < m_sepDistance) {
+
+       // the distance is below separation, adding to the same cluster
+       tmp_cluster.push_back(preselectedTracks[indexOfSorted[i]]);
     }else{
     
 //the distance is above separation, starting new cluster    
@@ -298,9 +300,14 @@ namespace InDet
    std::vector<const Trk::TrackParticleBase *> tmp_cluster(0); 
    
    Trk::PerigeeSurface perigeeSurface(beamposition->position());
-   const Trk::TrackParameters * exPerigee = m_extrapolator->extrapolate(ctx,preselectedTracks[indexOfSorted[0]]->definingParameters(),
-									perigeeSurface,Trk::anyDirection,true, Trk::pion);
-         
+   const Trk::TrackParameters* exPerigee = m_extrapolator
+                                             ->extrapolate(ctx,
+                                                           preselectedTracks[indexOfSorted[0]]->definingParameters(),
+                                                           perigeeSurface,
+                                                           Trk::anyDirection,
+                                                           true,
+                                                           Trk::pion).release();
+
    double lastTrackZ0  = -999.;
    if(exPerigee) { lastTrackZ0 = exPerigee->parameters()[Trk::z0]; delete exPerigee; }
    else
@@ -312,20 +319,24 @@ namespace InDet
     
 //looping over container
    for(unsigned int i=0;i<indexOfSorted.size();++i)
-   { 
-     const  Trk::TrackParameters * lexPerigee = m_extrapolator->extrapolate(ctx, preselectedTracks[indexOfSorted[i]]->definingParameters(),
-									    perigeeSurface,Trk::anyDirection,true, Trk::pion); 
-					   
-    double currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
-    delete lexPerigee;
-   
-    if(fabs(currentTrackZ0 - lastTrackZ0)<m_sepDistance)
-    {
-  
-//the distance is below separation, adding to the same cluster  
-     tmp_cluster.push_back(preselectedTracks[indexOfSorted[i]]);
-     
-  //   std::cout<<"Adding to a cluster "<<std::endl;
+   {
+     const Trk::TrackParameters* lexPerigee =
+       m_extrapolator->extrapolate(ctx,
+                                   preselectedTracks[indexOfSorted[i]]->definingParameters(),
+                                   perigeeSurface,
+                                   Trk::anyDirection,
+                                   true,
+                                   Trk::pion).release();
+
+     double currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
+     delete lexPerigee;
+
+     if (std::fabs(currentTrackZ0 - lastTrackZ0) < m_sepDistance) {
+
+       // the distance is below separation, adding to the same cluster
+       tmp_cluster.push_back(preselectedTracks[indexOfSorted[i]]);
+
+       //   std::cout<<"Adding to a cluster "<<std::endl;
     }else{
     
 //     std::cout<<"Breaking a cluster "<<std::endl;
@@ -486,9 +497,11 @@ namespace InDet
    std::vector<const xAOD::TrackParticle *> tmp_cluster(0); 
    
    Trk::PerigeeSurface perigeeSurface(beamposition->position());
-   const Trk::TrackParameters * exPerigee = m_extrapolator->extrapolate(ctx,*preselectedTracks[indexOfSorted[0]],
-   perigeeSurface,Trk::anyDirection,true, Trk::pion);
-   
+   const Trk::TrackParameters* exPerigee =
+     m_extrapolator
+       ->extrapolate(ctx, *preselectedTracks[indexOfSorted[0]], perigeeSurface, Trk::anyDirection, true, Trk::pion)
+       .release();
+
    double lastTrackZ0  = -999.;
    if(exPerigee) { 
      lastTrackZ0 = exPerigee->parameters()[Trk::z0];delete exPerigee;
@@ -503,21 +516,19 @@ namespace InDet
    
    //looping over container
    for(unsigned int i=0;i<indexOfSorted.size();++i)
-     { 
-       const Trk::TrackParameters * lexPerigee = m_extrapolator->extrapolate(ctx,*preselectedTracks[indexOfSorted[i]],
-									     perigeeSurface,Trk::anyDirection,true, Trk::pion);
-   
-       
-       double currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
-       delete lexPerigee;
-	
-       if(fabs(currentTrackZ0 - lastTrackZ0)<m_sepDistance)
-	 {
-	   
-	   //the distance is below separation, adding to the same cluster  
-	   tmp_cluster.push_back(preselectedTracks[indexOfSorted[i]]);
-	   
-	   //   std::cout<<"Adding to a cluster "<<std::endl;
+     {
+     const Trk::TrackParameters* lexPerigee = m_extrapolator->extrapolate(
+       ctx, *preselectedTracks[indexOfSorted[i]], perigeeSurface, Trk::anyDirection, true, Trk::pion).release();
+
+     double currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
+     delete lexPerigee;
+
+     if (std::fabs(currentTrackZ0 - lastTrackZ0) < m_sepDistance) {
+
+       // the distance is below separation, adding to the same cluster
+       tmp_cluster.push_back(preselectedTracks[indexOfSorted[i]]);
+
+       //   std::cout<<"Adding to a cluster "<<std::endl;
 	 }else{
 	 
 	 //     std::cout<<"Breaking a cluster "<<std::endl;
diff --git a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/HistogrammingMultiSeedFinder.cxx b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/HistogrammingMultiSeedFinder.cxx
index c22006559219c760072412dbba498cc35da7a1ee..95a1f8af7b4f5deb02f5f0575b584037b99edec0 100644
--- a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/HistogrammingMultiSeedFinder.cxx
+++ b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/HistogrammingMultiSeedFinder.cxx
@@ -125,20 +125,24 @@ namespace InDet
   
    for(;p_tr != p_tre; ++p_tr)
    {
-    const  Trk::TrackParameters * lexPerigee = m_extrapolator->extrapolate(ctx, **p_tr,perigeeSurface,Trk::anyDirection,true, Trk::pion); 
- 
-    double currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
-    delete lexPerigee;
-//    double currentTrackZ0 = (*p_tr)->perigeeParameters()->parameters()[Trk::z0];
-    unsigned int bin_number = int(floor((currentTrackZ0 + m_histoRange)/bin_size)) +1;
- 
-//now checking whether this bin entry already exists and adding track, if not, creating one.    
-    std::map<unsigned int, std::vector<const Trk::Track *> >::iterator map_pos = histo.find(bin_number);
-    if( map_pos != histo.end())
-    {
-    
-//this bin already exists, adding entry    
-      map_pos->second.push_back(*p_tr);
+     const Trk::TrackParameters* lexPerigee =
+       m_extrapolator->extrapolate(ctx, **p_tr, perigeeSurface, Trk::anyDirection, true, Trk::pion).release();
+
+     double currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
+     delete lexPerigee;
+     //    double currentTrackZ0 =
+     //    (*p_tr)->perigeeParameters()->parameters()[Trk::z0];
+     unsigned int bin_number =
+       int(floor((currentTrackZ0 + m_histoRange) / bin_size)) + 1;
+
+     // now checking whether this bin entry already exists and adding track, if
+     // not, creating one.
+     std::map<unsigned int, std::vector<const Trk::Track*>>::iterator map_pos =
+       histo.find(bin_number);
+     if (map_pos != histo.end()) {
+
+       // this bin already exists, adding entry
+       map_pos->second.push_back(*p_tr);
     }else{
     
 //this bin is not their yet, adding bin  
@@ -297,21 +301,26 @@ namespace InDet
    for(;p_tr != p_tre; ++p_tr)
    {
 
-     const  Trk::TrackParameters * lexPerigee = m_extrapolator->extrapolate(ctx, (*p_tr)->definingParameters(),
-									    perigeeSurface,Trk::anyDirection,true, Trk::pion); 
-    double currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
-    delete lexPerigee;
-
-//    double currentTrackZ0 = (*p_tr)->perigee()->parameters()[Trk::z0];
-    unsigned int bin_number = int(floor((currentTrackZ0 +m_histoRange)/bin_size)) +1;
- 
-//now checking whether this bin entry already exists and adding track, if not, creating one.    
-    std::map<unsigned int, std::vector<const Trk::TrackParticleBase *> >::iterator map_pos = histo.find(bin_number);
-    if( map_pos != histo.end())
-    {
-    
-//this bin already exists, adding entry    
-      map_pos->second.push_back(*p_tr);
+     const Trk::TrackParameters* lexPerigee =
+       m_extrapolator
+         ->extrapolate(ctx, (*p_tr)->definingParameters(), perigeeSurface, Trk::anyDirection, true, Trk::pion)
+         .release();
+     double currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
+     delete lexPerigee;
+
+     //    double currentTrackZ0 = (*p_tr)->perigee()->parameters()[Trk::z0];
+     unsigned int bin_number =
+       int(floor((currentTrackZ0 + m_histoRange) / bin_size)) + 1;
+
+     // now checking whether this bin entry already exists and adding track, if
+     // not, creating one.
+     std::map<unsigned int,
+              std::vector<const Trk::TrackParticleBase*>>::iterator map_pos =
+       histo.find(bin_number);
+     if (map_pos != histo.end()) {
+
+       // this bin already exists, adding entry
+       map_pos->second.push_back(*p_tr);
     }else{
     
 //this bin is not their yet, adding bin  
@@ -473,22 +482,27 @@ namespace InDet
 	std::vector<const xAOD::TrackParticle*>::const_iterator p_tre = preselectedTracks.end();
 	for(;p_tr != p_tre; ++p_tr)
 	  {
-	    
-	    const  Trk::TrackParameters * lexPerigee = m_extrapolator->extrapolate(ctx, **p_tr,
-										   perigeeSurface,Trk::anyDirection,true, Trk::pion); 
-	    double currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
-	    delete lexPerigee;
-	    
-	    //    double currentTrackZ0 = (*p_tr)->perigee()->parameters()[Trk::z0];
-	    unsigned int bin_number = int(floor((currentTrackZ0 +m_histoRange)/bin_size)) +1;
-	    
-	    //now checking whether this bin entry already exists and adding track, if not, creating one.    
-	    std::map<unsigned int, std::vector<const xAOD::TrackParticle *> >::iterator map_pos = histo.find(bin_number);
-	    if( map_pos != histo.end())
-	      {
-		
-		//this bin already exists, adding entry    
-		map_pos->second.push_back(*p_tr);
+
+          const Trk::TrackParameters* lexPerigee =
+            m_extrapolator->extrapolate(ctx, **p_tr, perigeeSurface, Trk::anyDirection, true, Trk::pion)
+              .release();
+          double currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
+          delete lexPerigee;
+
+          //    double currentTrackZ0 =
+          //    (*p_tr)->perigee()->parameters()[Trk::z0];
+          unsigned int bin_number =
+            int(floor((currentTrackZ0 + m_histoRange) / bin_size)) + 1;
+
+          // now checking whether this bin entry already exists and adding
+          // track, if not, creating one.
+          std::map<unsigned int,
+                   std::vector<const xAOD::TrackParticle*>>::iterator map_pos =
+            histo.find(bin_number);
+          if (map_pos != histo.end()) {
+
+            // this bin already exists, adding entry
+            map_pos->second.push_back(*p_tr);
 	      }else{
 	      
 	      //this bin is not their yet, adding bin  
@@ -602,77 +616,4 @@ namespace InDet
     delete myVertex;
   return result;
   }
-  /*
-  std::pair<std::vector<const Trk::TrackParameters *>, 
-	    std::vector<const xAOD::TrackParticle *> > HistogrammingMultiSeedFinder::m_clusterAndOutliers(std::vector<const xAOD::TrackParticle *> cluster, xAOD::Vertex * reference) const
-	    {
-	      
-	      std::vector<const Trk::TrackParameters*> clusterSeed(0);
-	      std::vector<const xAOD::TrackParticle*> outliers(0);
-	      
-	      double z_center = 0;
-	      
-	      std::vector<const xAOD::TrackParticle*>::const_iterator inb = cluster.begin();
-	      std::vector<const xAOD::TrackParticle*>::const_iterator ine = cluster.end();
-	      
-	      unsigned int cluster_size = 0;
-	      
-	      msg(MSG::DEBUG)<<"Receiving a cluster of size: "<< cluster.size()<<endmsg;
-	      
-	      Trk::PerigeeSurface perigeeSurface(reference->position());
-	      
-	      //first getting the cluster center  
-	      for(std::vector<const xAOD::TrackParticle*>::const_iterator i = inb; i != ine; ++i)
-		{
-		  const Trk::TrackParameters * perigee(0);
-	  
-		  perigee = m_extrapolator->extrapolate(**i,perigeeSurface,Trk::anyDirection,true, Trk::pion);
-		  
-		  if(perigee)
-		    { 
-		      z_center += perigee->parameters()[Trk::z0];
-		      msg(MSG::DEBUG)<<"Adding parameters: "<<perigee->parameters()[Trk::z0] <<endmsg;
-		      ++cluster_size;
-		    }else{
-		    msg(MSG::WARNING)<<" The TrackParticleBase provided does not contain perigee parameters"<<endmsg;
-		  }//end of perigee security check
-		}//end of loop definig the center of a cluster
-	      msg(MSG::DEBUG)<<"Z center is: "<<z_center<<" for  tracks: "<<cluster_size<<endmsg;
-	      
-	      z_center = z_center/cluster_size;
-	      
-	      msg(MSG::DEBUG)<<"Looping over the cluster" <<endmsg;
-	      
-	      for(std::vector<const xAOD::TrackParticle*>::const_iterator i = inb; i != ine; ++i)
-		{
-		  const Trk::TrackParameters * measPerigee(0);
-		  measPerigee = m_extrapolator->extrapolate(**i,perigeeSurface,Trk::anyDirection,true, Trk::pion);
-		  
-		  if(0!=measPerigee)
-		    {
-		      double z0 = measPerigee->parameters()[Trk::z0];
-		      const AmgSymMatrix(5) * cov = measPerigee->covariance();    
-		      double sigma_z0 = Amg::error(*cov,Trk::z0);
-		      
-		      msg(MSG::DEBUG)<<"Perigee Z0 and corresponding sigma "<<z0<<" "<<sigma_z0<<endmsg;
-		      msg(MSG::DEBUG)<<"Center of the cluster "<<z_center<<endmsg;
-		      msg(MSG::DEBUG)<<"Offset "<<3.0<<endmsg;
-		      msg(MSG::DEBUG)<<"discriminant "<<fabs(z_center-z0)<<" "<< sigma_z0*3.0 <<endmsg;
-		      
-		      //if the track is closer than several standard deviations, keep it    
-		      if(fabs(z_center-z0)< sigma_z0*3.0) clusterSeed.push_back(&((*i)->perigeeParameters())); 
-		      
-		      //declare it an outlier otherwise
-		      else outliers.push_back(*i);
-		    }else{
-		    outliers.push_back(*i);
-		    msg(MSG::WARNING)  << "This track has no meas perigee. Regarded as outlyer" << endmsg;
-		  }//end of measured perigee check
-		}//end of separation loop
-	      
-	      std::pair<std::vector<const Trk::TrackParameters *>, 
-		std::vector<const xAOD::TrackParticle *> > result(clusterSeed, outliers);
-	      return result;
-	    }
-  */
 }//end of namespace definitions
diff --git a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/SlidingWindowMultiSeedFinder.cxx b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/SlidingWindowMultiSeedFinder.cxx
index 50e476bfe28596ba115fdbd122943b3a7f37d739..b1759c0e5ec071a112d77d7c70399350f3a44bc8 100644
--- a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/SlidingWindowMultiSeedFinder.cxx
+++ b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/SlidingWindowMultiSeedFinder.cxx
@@ -124,9 +124,13 @@ namespace InDet
    Trk::PerigeeSurface perigeeSurface(beamVertex->position());
 
    const Trk::TrackParameters * exPerigee = nullptr;
-   if (!indexOfSorted.empty()) exPerigee = 
-				 m_extrapolator->extrapolate(ctx, *preselectedTracks[indexOfSorted[0]],perigeeSurface,Trk::anyDirection,true, Trk::pion);
-         
+   if (!indexOfSorted.empty()){
+     exPerigee =
+       m_extrapolator
+         ->extrapolate(ctx, *preselectedTracks[indexOfSorted[0]], perigeeSurface, Trk::anyDirection, true, Trk::pion)
+         .release();
+   }
+
    float lastTrackZ0  = -999.;
    if(exPerigee) { lastTrackZ0 = exPerigee->parameters()[Trk::z0]; delete exPerigee; }
    else
@@ -145,7 +149,7 @@ namespace InDet
    for(unsigned int i=0;i<indexOfSorted.size();++i)
    {
     const  Trk::TrackParameters * lexPerigee = m_extrapolator->extrapolate(ctx, *preselectedTracks[indexOfSorted[i]],
-									   perigeeSurface,Trk::anyDirection,true, Trk::pion); 
+									   perigeeSurface,Trk::anyDirection,true, Trk::pion).release(); 
     float currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
     delete lexPerigee;
     
@@ -236,9 +240,14 @@ namespace InDet
    const Trk::TrackParameters * exPerigee(nullptr);
    Trk::PerigeeSurface perigeeSurface(beamVertex->position());
 
-   exPerigee = m_extrapolator->extrapolate(ctx,preselectedTracks[indexOfSorted[0]]->definingParameters(),
-					   perigeeSurface,Trk::anyDirection,true, Trk::pion);
-  
+   exPerigee = m_extrapolator
+                 ->extrapolate(ctx,
+                               preselectedTracks[indexOfSorted[0]]->definingParameters(),
+                               perigeeSurface,
+                               Trk::anyDirection,
+                               true,
+                               Trk::pion).release();
+
    float lastTrackZ0  = -999.;
    if(exPerigee) { lastTrackZ0 = exPerigee->parameters()[Trk::z0]; delete exPerigee; }
    else
@@ -259,25 +268,34 @@ namespace InDet
    
    for(unsigned int i=0;i<indexOfSorted.size();++i)
    {
-   
-     const  Trk::TrackParameters * lexPerigee = m_extrapolator->extrapolate(ctx,preselectedTracks[indexOfSorted[i]]->definingParameters(),
-									    perigeeSurface,Trk::anyDirection,true, Trk::pion); 
-    float currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
-    delete lexPerigee;
-    
-    if(!i)prevTrackZ0 = currentTrackZ0;    
-    
-    if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Z0 of current  track"<< currentTrackZ0<<endmsg;   
-    if((fabs(currentTrackZ0 - lastTrackZ0)>m_clusterLength && fabs(currentTrackZ0 - prevTrackZ0)>addingDistance )|| 
-                                                              fabs(currentTrackZ0 - prevTrackZ0)>m_breakingDistance)
-    {
-  
-//this track is outside the current cluster or the distance is too big. breaking the cluster here
-     if(int(tmp_cluster.size())>m_ignoreLevel) result.push_back(tmp_cluster);
-     tmp_cluster.clear();
-     tmp_cluster.push_back(preselectedTracks[indexOfSorted[i]]);
-     lastTrackZ0 = currentTrackZ0;
-     if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Finishing a cluster, starting the new one"<<endmsg;
+
+     const Trk::TrackParameters* lexPerigee = m_extrapolator
+                                                ->extrapolate(ctx,
+                                                              preselectedTracks[indexOfSorted[i]]->definingParameters(),
+                                                              perigeeSurface,
+                                                              Trk::anyDirection,
+                                                              true,
+                                                              Trk::pion).release();
+     float currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
+     delete lexPerigee;
+
+     if (!i)
+       prevTrackZ0 = currentTrackZ0;
+
+     if (msgLvl(MSG::DEBUG))
+       msg(MSG::DEBUG) << "Z0 of current  track" << currentTrackZ0 << endmsg;
+     if ((fabs(currentTrackZ0 - lastTrackZ0) > m_clusterLength &&
+          fabs(currentTrackZ0 - prevTrackZ0) > addingDistance) ||
+         fabs(currentTrackZ0 - prevTrackZ0) > m_breakingDistance) {
+
+       // this track is outside the current cluster or the distance is too big. breaking the cluster here
+       if (int(tmp_cluster.size()) > m_ignoreLevel)
+         result.push_back(tmp_cluster);
+       tmp_cluster.clear();
+       tmp_cluster.push_back(preselectedTracks[indexOfSorted[i]]);
+       lastTrackZ0 = currentTrackZ0;
+       if (msgLvl(MSG::DEBUG))
+         msg(MSG::DEBUG) << "Finishing a cluster, starting the new one" << endmsg;
     
     }else{
  
@@ -368,7 +386,7 @@ std::vector< std::vector<const Trk::TrackParameters *> > SlidingWindowMultiSeedF
 	Trk::PerigeeSurface perigeeSurface(beamposition->position());
 	
 	exPerigee = m_extrapolator->extrapolate(ctx, *preselectedTracks[indexOfSorted[0]],
-						perigeeSurface,Trk::anyDirection,true, Trk::pion);
+						perigeeSurface,Trk::anyDirection,true, Trk::pion).release();
 	
 	float lastTrackZ0  = -999.;
 	if(exPerigee) { lastTrackZ0 = exPerigee->parameters()[Trk::z0]; delete exPerigee; }
@@ -391,25 +409,31 @@ std::vector< std::vector<const Trk::TrackParameters *> > SlidingWindowMultiSeedF
 	
 	for(unsigned int i=0;i<indexOfSorted.size();++i)
 	  {
-	    
-	    const  Trk::TrackParameters * lexPerigee = m_extrapolator->extrapolate(ctx, *preselectedTracks[indexOfSorted[i]],
-										   perigeeSurface,Trk::anyDirection,true, Trk::pion); 
-	    float currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
-	    delete lexPerigee;
-	    
-	    if(!i)prevTrackZ0 = currentTrackZ0;    
-	    
-	    if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Z0 of current  track"<< currentTrackZ0<<endmsg;   
-	    if((fabs(currentTrackZ0 - lastTrackZ0)>m_clusterLength && fabs(currentTrackZ0 - prevTrackZ0)>addingDistance )|| 
-	       fabs(currentTrackZ0 - prevTrackZ0)>m_breakingDistance)
-	      {
-		
-		//this track is outside the current cluster or the distance is too big. breaking the cluster here
-		if(int(tmp_cluster.size())>m_ignoreLevel) result.push_back(tmp_cluster);
-		tmp_cluster.clear();
-		tmp_cluster.push_back(&(preselectedTracks[indexOfSorted[i]]->perigeeParameters()));
-		lastTrackZ0 = currentTrackZ0;
-		if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Finishing a cluster, starting the new one"<<endmsg;
+
+          const Trk::TrackParameters* lexPerigee =
+            m_extrapolator
+              ->extrapolate(
+                ctx, *preselectedTracks[indexOfSorted[i]], perigeeSurface, Trk::anyDirection, true, Trk::pion).release();
+          float currentTrackZ0 = lexPerigee->parameters()[Trk::z0];
+          delete lexPerigee;
+
+          if (!i)
+            prevTrackZ0 = currentTrackZ0;
+
+          if (msgLvl(MSG::DEBUG))
+            msg(MSG::DEBUG) << "Z0 of current  track" << currentTrackZ0 << endmsg;
+          if ((fabs(currentTrackZ0 - lastTrackZ0) > m_clusterLength &&
+               fabs(currentTrackZ0 - prevTrackZ0) > addingDistance) ||
+              fabs(currentTrackZ0 - prevTrackZ0) > m_breakingDistance) {
+
+            // this track is outside the current cluster or the distance is too big. breaking the cluster here
+            if (int(tmp_cluster.size()) > m_ignoreLevel)
+              result.push_back(tmp_cluster);
+            tmp_cluster.clear();
+            tmp_cluster.push_back(&(preselectedTracks[indexOfSorted[i]]->perigeeParameters()));
+            lastTrackZ0 = currentTrackZ0;
+            if (msgLvl(MSG::DEBUG))
+              msg(MSG::DEBUG) << "Finishing a cluster, starting the new one" << endmsg;
 		
 	      }else{
 	      
@@ -438,55 +462,5 @@ std::vector< std::vector<const Trk::TrackParameters *> > SlidingWindowMultiSeedF
     return result; 	
     
   }
-  /*  
- std::vector<int> SlidingWindowMultiSeedFinder::m_z0sort(std::vector<const xAOD::TrackParticle*>& tracks,xAOD::Vertex * reference) const
- {
-   
-    // std::vector<int> no_perigee(0);
-    std::map<double, int> mapOfZ0; 
-    std::vector<const xAOD::TrackParticle*>::const_iterator tb = tracks.begin();
-    std::vector<const xAOD::TrackParticle*>::const_iterator te = tracks.end();
-    unsigned int j=0;
-    
-    for(;tb != te ;++tb)
-      {
-	const Trk::TrackParameters * perigee = 0;
-	
-	
-	//here we want to make an extrapolation    
-	Trk::PerigeeSurface perigeeSurface(reference->position());
-	perigee = m_extrapolator->extrapolate(**tb,
-					      perigeeSurface,
-					      Trk::anyDirection,true, Trk::pion);  
-	
-	if(perigee)
-	  {
-	    double trkZ0 = perigee->parameters()[Trk::z0];
-	    mapOfZ0.insert(std::map<double, int>::value_type(trkZ0,j)); 
-	    delete perigee;
-	    perigee =0;
-	    
-	  }else{
-	  msg(MSG::WARNING)  << "This track particle has no perigee state. Not egligible for sorting. Will NOT be written to the sorted vector" << endmsg;
-	  //    no_perigee.push_back(j);
-	}//end of perigee existance check
-	++j;
-      }//end of loop over all track particle base's
-    
-    //creating an output vector, filling it and returning
-    std::vector<int> result(0);
-    
-    //sorted part  
-    std::map<double, int>::const_iterator mb = mapOfZ0.begin();
-    std::map<double, int>::const_iterator me = mapOfZ0.end(); 
-    for(;mb!=me;++mb) result.push_back((*mb).second);
-    
-    //part failed sorting
-    //  std::vector<int>::const_iterator ib = no_perigee.begin();
-    //  std::vector<int>::const_iterator ie = no_perigee.end();
-    //  for(;ib!=ie;++ib) result.push_back(*ib);  
-    return result;
-  }
-  */    
-    
+  
 }//end of namespace definitions
diff --git a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinderUtils/src/InDetTrackClusterCleaningTool.cxx b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinderUtils/src/InDetTrackClusterCleaningTool.cxx
index d99857de06ea294ba9810737b93584c00f942aa6..c65b0c1d31623d227fe2fa32c99e20394b090fd2 100644
--- a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinderUtils/src/InDetTrackClusterCleaningTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinderUtils/src/InDetTrackClusterCleaningTool.cxx
@@ -61,7 +61,7 @@ namespace InDet
    else perigee = m_extrapolator->extrapolate(ctx,
                                               **i,perigeeSurface,
                                               Trk::anyDirection,true, 
-                                              Trk::pion); 
+                                              Trk::pion).release(); 
    
    if(perigee)
    { 
@@ -87,7 +87,7 @@ namespace InDet
      
      //here we want to make an extrapolation
      measPerigee = m_extrapolator->extrapolate(
-       ctx, **i, perigeeSurface, Trk::anyDirection, true, Trk::pion);
+       ctx, **i, perigeeSurface, Trk::anyDirection, true, Trk::pion).release();
    }
 
    if(measPerigee)
@@ -137,9 +137,14 @@ namespace InDet
   {
    const Trk::TrackParameters * perigee(nullptr);
    if(!reference) perigee = &((*i)->definingParameters());
-   else perigee = m_extrapolator->extrapolate(ctx,
-                                              (*i)->definingParameters(),perigeeSurface,Trk::anyDirection,true, Trk::pion);
-   
+   else
+     perigee = m_extrapolator->extrapolate(ctx,
+                                           (*i)->definingParameters(),
+                                           perigeeSurface,
+                                           Trk::anyDirection,
+                                           true,
+                                           Trk::pion).release();
+
    if(perigee)
    { 
     z_center += perigee->parameters()[Trk::z0];
@@ -161,9 +166,14 @@ namespace InDet
   {
    const Trk::TrackParameters * measPerigee(nullptr);
    if(!reference) measPerigee = &((*i)->definingParameters());
-   else  measPerigee = m_extrapolator->extrapolate(ctx,
-                                                   (*i)->definingParameters(),perigeeSurface,Trk::anyDirection,true, Trk::pion);
-  
+   else
+     measPerigee = m_extrapolator->extrapolate(ctx,
+                                               (*i)->definingParameters(),
+                                               perigeeSurface,
+                                               Trk::anyDirection,
+                                               true,
+                                               Trk::pion).release();
+
    if(nullptr!=measPerigee)
    {
     double z0 = measPerigee->parameters()[Trk::z0];
@@ -211,10 +221,10 @@ namespace InDet
 	     //first getting the cluster center  
 	     for(std::vector<const xAOD::TrackParticle*>::const_iterator i = inb; i != ine; ++i)
 	       {
-		 const Trk::TrackParameters * perigee(nullptr);
+           const Trk::TrackParameters * perigee(nullptr);
 		 
 		 perigee = m_extrapolator->extrapolate(ctx,
-                                           **i,perigeeSurface,Trk::anyDirection,true, Trk::pion);
+                                           **i,perigeeSurface,Trk::anyDirection,true, Trk::pion).release();
 		 
 		 if(perigee)
 		   { 
@@ -237,7 +247,11 @@ namespace InDet
 	       {
 		 const Trk::TrackParameters * measPerigee(nullptr);
 		 measPerigee = m_extrapolator->extrapolate(ctx,
-                                               **i,perigeeSurface,Trk::anyDirection,true, Trk::pion);
+                                               **i,
+                                               perigeeSurface,
+                                               Trk::anyDirection,
+                                               true, 
+                                               Trk::pion).release();
 		 
 		 if(nullptr!=measPerigee)
 		   {
diff --git a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinderUtils/src/InDetTrackZ0SortingTool.cxx b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinderUtils/src/InDetTrackZ0SortingTool.cxx
index 069326ef8d924a15892c6c141d8efee187de278b..80002d5878af2d608f324e82239a9a321beae7e7 100644
--- a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinderUtils/src/InDetTrackZ0SortingTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinderUtils/src/InDetTrackZ0SortingTool.cxx
@@ -63,7 +63,7 @@ namespace InDet
              ctx,
              **tb,perigeeSurface,
 					   Trk::anyDirection,true, 
-					   Trk::pion);
+					   Trk::pion).release();
    }//end of extrapolation block
    
    if(perigee)
@@ -113,7 +113,7 @@ namespace InDet
        ctx,
        (*tb)->definingParameters(),
        perigeeSurface,
-       Trk::anyDirection,true, Trk::pion);  
+       Trk::anyDirection,true, Trk::pion).release();  
    }//end of extrapolation block
    
    if(perigee)
@@ -167,7 +167,7 @@ namespace InDet
     ctx,
     **tb,
     perigeeSurface,
-    Trk::anyDirection,true, Trk::pion);  
+    Trk::anyDirection,true, Trk::pion).release();  
 	
 	if(perigee)
 	  {
diff --git a/InnerDetector/InDetRecTools/InDetSecVxFinderTool/src/InDetJetFitterUtils.cxx b/InnerDetector/InDetRecTools/InDetSecVxFinderTool/src/InDetJetFitterUtils.cxx
index 104fe04d2ebdbcbdfc1dfe3586c94fdf12352c25..20554ba8ab18dcff9023dbb23a2e05ffe743d12b 100644
--- a/InnerDetector/InDetRecTools/InDetSecVxFinderTool/src/InDetJetFitterUtils.cxx
+++ b/InnerDetector/InDetRecTools/InDetSecVxFinderTool/src/InDetJetFitterUtils.cxx
@@ -481,7 +481,7 @@ namespace InDet
     Trk::PerigeeSurface mySurface(vertexToExtrapolateTo.position());
     const Trk::TrackParameters* newMeasPerigee= m_extrapolator->extrapolateDirectly(ctx,
                                                                                     trackPerigee,
-                                                                                    mySurface);
+                                                                                    mySurface).release();
     if (newMeasPerigee==nullptr)
     {
       msg(MSG::WARNING) <<  " Extrapolation failed. Wrong d0 and z0 returned " << endmsg;
diff --git a/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx b/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx
index 681073470c605cb89e2d6a07c88420c46e9ae8de..38c3c7f2fb92c97c6fae1374534f496d4eabe689 100644
--- a/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx
@@ -315,10 +315,10 @@ InDet::InDetTestBLayerTool::getTrackStateOnPixelLayerInfo(
 {
   assert(layer >= 0 && layer <= 1);
 
-  const Trk::TrackParameters* startParameters = nullptr;
+  std::unique_ptr<const Trk::TrackParameters> startParameters = nullptr;
 
   if (track->perigeeParameters()) {
-    startParameters = track->perigeeParameters()->clone();
+    startParameters = track->perigeeParameters()->uniqueClone();
   } else if (track->trackParameters()->front()) {
     startParameters =
       m_extrapolator->extrapolate(
@@ -336,8 +336,7 @@ InDet::InDetTestBLayerTool::getTrackStateOnPixelLayerInfo(
   }
 
   bool succeed =
-    getTrackStateOnPixelLayerInfo(startParameters, infoList, layer);
-  delete startParameters;
+    getTrackStateOnPixelLayerInfo(startParameters.get(), infoList, layer);
   return succeed;
 }
 
diff --git a/InnerDetector/InDetRecTools/InDetTestPixelLayer/src/InDetTestPixelLayerTool.cxx b/InnerDetector/InDetRecTools/InDetTestPixelLayer/src/InDetTestPixelLayerTool.cxx
index 058303428d4c99050680eb0ad5f18adae20404cf..21a217e3cf9964f6782368f2192914a26695e705 100644
--- a/InnerDetector/InDetRecTools/InDetTestPixelLayer/src/InDetTestPixelLayerTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetTestPixelLayer/src/InDetTestPixelLayerTool.cxx
@@ -462,10 +462,10 @@ InDet::InDetTestPixelLayerTool::getTrackStateOnPixelLayerInfo(
   std::vector<TrackStateOnPixelLayerInfo>& infoList) const
 {
 
-  const Trk::TrackParameters* startParameters = nullptr;
+  std::unique_ptr<const Trk::TrackParameters> startParameters = nullptr;
 
   if (track->perigeeParameters()) {
-    startParameters = track->perigeeParameters()->clone();
+    startParameters = track->perigeeParameters()->uniqueClone();
   } else if (track->trackParameters()->front()) {
     startParameters =
       m_extrapolator->extrapolate(
@@ -482,8 +482,7 @@ InDet::InDetTestPixelLayerTool::getTrackStateOnPixelLayerInfo(
     return false;
   }
 
-  bool succeed = getTrackStateOnPixelLayerInfo(startParameters, infoList);
-  delete startParameters;
+  bool succeed = getTrackStateOnPixelLayerInfo(startParameters.get(), infoList);
   return succeed;
 }
 
diff --git a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx
index 7db114b5d95ed7eb1f51f9cc170cfae337709137..acb9d86ba25771e1e7d652567fee4b9a3fcb45da 100644
--- a/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetTrackHoleSearch/src/InDetTrackHoleSearchTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -279,12 +279,8 @@ bool InDet::InDetTrackHoleSearchTool::getMapOfHits(const EventContext& ctx,
 
     if (firstsipar) {
       //std::cout << "firstsipar: " << *firstsipar << " pos: " << firstsipar->position() << std::endl;
-      startParameters.reset(m_extrapolator->extrapolate(ctx,
-                                                        *firstsipar,
-                                                        *sctCylinder,
-                                                        Trk::oppositeMomentum,
-                                                        true,
-                                                        partHyp));
+      startParameters = m_extrapolator->extrapolate(
+        ctx, *firstsipar, *sctCylinder, Trk::oppositeMomentum, true, partHyp);
     }
 
     // if track can't be extrapolated to this cylinder (EC track!), extrapolate to disc outside TRT/SCT EC
@@ -310,12 +306,8 @@ bool InDet::InDetTrackHoleSearchTool::getMapOfHits(const EventContext& ctx,
 
       if (trtDisc) {
         // extrapolate track to disk
-        startParameters.reset(m_extrapolator->extrapolate(ctx,
-                                                          *firstsipar,
-                                                          *trtDisc,
-                                                          Trk::oppositeMomentum,
-                                                          true,
-                                                          partHyp));
+        startParameters = m_extrapolator->extrapolate(
+          ctx, *firstsipar, *trtDisc, Trk::oppositeMomentum, true, partHyp);
       }
     }
   } else {  // no cosmics
@@ -325,11 +317,13 @@ bool InDet::InDetTrackHoleSearchTool::getMapOfHits(const EventContext& ctx,
     } else if (track.trackParameters()->front()) {
       ATH_MSG_DEBUG("No perigee, extrapolate to 0,0,0");
       // go back to perigee
-      startParameters.reset( m_extrapolator->extrapolate(ctx,
-                                                         *(track.trackParameters()->front()),
-                                                         Trk::PerigeeSurface(),
-                                                         Trk::anyDirection,
-                                                         false, partHyp));
+      startParameters =
+        m_extrapolator->extrapolate(ctx,
+                                    *(track.trackParameters()->front()),
+                                    Trk::PerigeeSurface(),
+                                    Trk::anyDirection,
+                                    false,
+                                    partHyp);
     }
   }
 
diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/Root/InDetTrackSelectionTool.cxx b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/Root/InDetTrackSelectionTool.cxx
index cce575013a37ef15d98f45dd73e34855f57fe824..78a38c1570673f4227c90b77638851be0e79a54b 100644
--- a/InnerDetector/InDetRecTools/InDetTrackSelectionTool/Root/InDetTrackSelectionTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetTrackSelectionTool/Root/InDetTrackSelectionTool.cxx
@@ -976,11 +976,13 @@ InDet::InDetTrackSelectionTool::accept( const Trk::Track& track,
   std::unique_ptr<const Trk::TrackParameters> paramsAtVertex;
   if (vertex) {
     Trk::PerigeeSurface perigeeSurface(vertex->position());
-    paramsAtVertex.reset(m_extrapolator->extrapolate(
-                 Gaudi::Hive::currentContext(),
-                 *perigee,perigeeSurface,
-						     Trk::anyDirection,true,
-						     track.info().particleHypothesis()) );
+    paramsAtVertex =
+      m_extrapolator->extrapolate(Gaudi::Hive::currentContext(),
+                                  *perigee,
+                                  perigeeSurface,
+                                  Trk::anyDirection,
+                                  true,
+                                  track.info().particleHypothesis());
     perigee = paramsAtVertex.get();
   }
 
diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetConversionTrackSelectorTool.cxx b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetConversionTrackSelectorTool.cxx
index 3ba0be9cc300996aa49b3a2eb212b639b6e6876d..83c1716e3281c9182768060d2331703f50121261 100644
--- a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetConversionTrackSelectorTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetConversionTrackSelectorTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "InDetTrackSelectorTool/InDetConversionTrackSelectorTool.h"
@@ -137,7 +137,7 @@ namespace InDet
                                  perigeeSurface,
                                  Trk::anyDirection,
                                  true,
-                                 track.info().particleHypothesis());
+                                 track.info().particleHypothesis()).release();
    perigee = extrapolatedParameters
                ? dynamic_cast<const Trk::Perigee*>(extrapolatedParameters)
                : nullptr;
@@ -257,7 +257,7 @@ namespace InDet
    }
    const Trk::TrackParameters* extrapolatedParameters =
      m_extrapolator->extrapolate(
-       ctx, *firstmeaspar, perigeeSurface, Trk::anyDirection, true, Trk::pion);
+       ctx, *firstmeaspar, perigeeSurface, Trk::anyDirection, true, Trk::pion).release();
    perigee = extrapolatedParameters
                ? dynamic_cast<const Trk::Perigee*>(extrapolatedParameters)
                : nullptr;
@@ -367,7 +367,7 @@ namespace InDet
     Trk::PerigeeSurface perigeeSurface(getPosOrBeamSpot(ctx, vertex));
     const Trk::TrackParameters* extrapolatedParameters =
       m_extrapolator->extrapolate(
-        ctx, perigee, perigeeSurface, Trk::anyDirection, false, Trk::pion);
+        ctx, perigee, perigeeSurface, Trk::anyDirection, false, Trk::pion).release();
     if (extrapolatedParameters == nullptr) {
       ATH_MSG_WARNING("Extrapolation to the vertex failed: " << perigeeSurface
                                                              << "\n"
diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetDetailedTrackSelectorTool.cxx b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetDetailedTrackSelectorTool.cxx
index 26e06dc3d3634e3254e67a6da364e3679cbae643..ac1de93f19ebefa8d46e816a5fda4a9a8275b9f1 100644
--- a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetDetailedTrackSelectorTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetDetailedTrackSelectorTool.cxx
@@ -229,7 +229,7 @@ namespace InDet
                                                                                     perigeeSurface,
                                                                                     Trk::anyDirection,
                                                                                     true,
-                                                                                    track.info().particleHypothesis() ); 
+                                                                                    track.info().particleHypothesis() ).release(); 
     const Trk::Perigee* extrapolatedPerigee = extrapolatedParameters ? dynamic_cast<const Trk::Perigee*>(extrapolatedParameters) : nullptr; 
     if (!extrapolatedPerigee || !extrapolatedPerigee->covariance() ) {
       ATH_MSG_WARNING( "Track Selector failed to extrapolate track to the vertex: " << myVertex->position() );
@@ -411,7 +411,7 @@ namespace InDet
                                   *firstmeaspar,
                                   perigeeSurface,
                                   Trk::anyDirection,
-                                  true,Trk::pion ) : nullptr;
+                                  true,Trk::pion ).release() : nullptr;
     extrapolatedPerigee = extrapolatedParameters ? dynamic_cast<const Trk::Perigee*>(extrapolatedParameters) : nullptr; 
     if (extrapolatedPerigee==nullptr || !extrapolatedPerigee->covariance()) {
       ATH_MSG_WARNING( "Track Selector failed to extrapolate track to the vertex: " << myVertex->position() );
@@ -653,7 +653,7 @@ namespace InDet
     const Trk::TrackParameters* extrapolatedParameters= m_extrapolator->extrapolate(
       Gaudi::Hive::currentContext(),
       perigee,perigeeSurface,
-      Trk::anyDirection,true,Trk::pion);
+      Trk::anyDirection,true,Trk::pion).release();
     const Trk::Perigee* extrapolatedPerigee = extrapolatedParameters ? dynamic_cast<const Trk::Perigee*>(extrapolatedParameters) : nullptr; 
     if (extrapolatedPerigee==nullptr) {
       ATH_MSG_WARNING( "Extrapolation to the vertex failed: " << perigeeSurface << std::endl << perigee );
diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetIsoTrackSelectorTool.cxx b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetIsoTrackSelectorTool.cxx
index acf6cd891edfab991d3cef7479253b2341a24aa0..efc43d8c643efab8bd04a007ba0aae9637f8a1ba 100644
--- a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetIsoTrackSelectorTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetIsoTrackSelectorTool.cxx
@@ -115,7 +115,7 @@ bool InDet::InDetIsoTrackSelectorTool::decision(const Trk::AtaStraightLine& atl,
     trackPars,
     alSurface,
     Trk::anyDirection,
-    false);
+    false).release();
   // no parameterisation : bail out
   if (!trackAtBL) return false;
   // d0,z0 wrt BL for reference and track
diff --git a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetTrackSelectorTool.cxx b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetTrackSelectorTool.cxx
index ade7bb9e67e132fd06907802a565c33e415a7de5..7feac31a850451d2be6087a53799871a01060bc3 100644
--- a/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetTrackSelectorTool.cxx
+++ b/InnerDetector/InDetRecTools/InDetTrackSelectorTool/src/InDetTrackSelectorTool.cxx
@@ -145,10 +145,17 @@ bool InDetTrackSelectorTool::decision(const Trk::TrackParameters * track, const
     perigee = dynamic_cast<const Trk::Perigee *>(track);
   else {
     Trk::PerigeeSurface perigeeSurface(vertex->position());
-    perigee = dynamic_cast<const Trk::Perigee *>(m_extrapolator->extrapolate(Gaudi::Hive::currentContext(),
-                                                                             *track,
-                                                                             perigeeSurface,
-                                                                             Trk::anyDirection,true,hyp));
+    std::unique_ptr<const Trk::TrackParameters> tmp =
+      m_extrapolator->extrapolate(Gaudi::Hive::currentContext(),
+                                  *track,
+                                  perigeeSurface,
+                                  Trk::anyDirection,
+                                  true,
+                                  hyp);
+    //release only of right type
+    if (tmp && tmp->associatedSurface().type() == Trk::SurfaceType::Perigee) {
+      perigee = static_cast<const Trk::Perigee*>(tmp.release());
+    }
   }
 
   if(nullptr == perigee || !perigee->covariance() ) {
diff --git a/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/src/TRT_SegmentToTrackTool.cxx b/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/src/TRT_SegmentToTrackTool.cxx
index e4236b8325e64ff93da38f2d0d88ede3b478dcd5..f8ec513b5a4ac89709718190f2c908196ea99483 100644
--- a/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/src/TRT_SegmentToTrackTool.cxx
+++ b/InnerDetector/InDetRecTools/TRT_SegmentToTrackTool/src/TRT_SegmentToTrackTool.cxx
@@ -199,8 +199,13 @@ namespace InDet {
       Amg::Vector3D perigeePosition(0., 0., 0.);
       Trk::PerigeeSurface perigeeSurface(perigeePosition);
       // --- turn parameters into perigee...
-      auto perParm = std::unique_ptr<const Trk::Perigee>(dynamic_cast<const Trk::Perigee*>(
-       m_extrapolator->extrapolate(ctx, *segPar, perigeeSurface)));
+      std::unique_ptr<const Trk::TrackParameters> tmp =
+        m_extrapolator->extrapolate(ctx, *segPar, perigeeSurface);
+      std::unique_ptr<const Trk::Perigee> perParm = nullptr;
+      //pass ownership if of the right type
+      if (tmp && tmp->associatedSurface().type() == Trk::SurfaceType::Perigee) {
+        perParm.reset(static_cast<const Trk::Perigee*>(tmp.release()));
+      }
       if (perParm) {
         ATH_MSG_VERBOSE("Perigee version of Parameters : " << (*segPar));
       } else {
@@ -362,8 +367,12 @@ namespace InDet {
         Amg::Vector3D perigeePosition(0., 0., 0.);
         Trk::PerigeeSurface perigeeSurface(perigeePosition);
         // -- get perigee
-        const Trk::Perigee* tempper = dynamic_cast<const Trk::Perigee*>(
-          m_extrapolator->extrapolateDirectly(ctx, *segPar, perigeeSurface));
+        std::unique_ptr<const Trk::TrackParameters> tmp =
+          m_extrapolator->extrapolate(ctx, *segPar, perigeeSurface);
+        std::unique_ptr<const Trk::Perigee> tempper = nullptr;
+        if (tmp && tmp->associatedSurface().type() == Trk::SurfaceType::Perigee) {
+           tempper.reset(static_cast<const Trk::Perigee*>(tmp.release()));
+        }
         if (!tempper) {
           ATH_MSG_DEBUG("Could not produce perigee");
           delete segPar;
@@ -375,10 +384,6 @@ namespace InDet {
         myd0 = tempper->parameters()[Trk::d0];
         myphi = tempper->parameters()[Trk::phi0];
 
-        // delete extrapolation
-        delete tempper;
-        tempper = nullptr;
-
       } else {
         //
         // --- endcap or transition track
@@ -551,7 +556,7 @@ namespace InDet {
                                      *surfforpar);
         Trk::PerigeeSurface persurf;
         const Trk::TrackParameters* extrappar =
-          m_extrapolator->extrapolateDirectly(ctx, ataline, persurf);
+          m_extrapolator->extrapolateDirectly(ctx, ataline, persurf).release();
 
         // now get parameters
         if (extrappar) {
@@ -681,11 +686,14 @@ namespace InDet {
               std::move(fcovmat)).release();
 
           // now take parameters at first measurement and exptrapolate to perigee
-	  const Trk::TrackParameters *newperpar   = m_extrapolator->extrapolate(ctx,
-                                                                          *updatedPars,
-                                                                          perTrack->associatedSurface(),
-										Trk::anyDirection,false,Trk::nonInteracting);
-	  delete updatedPars; updatedPars = nullptr;
+          const Trk::TrackParameters* newperpar =
+            m_extrapolator->extrapolate(ctx,
+                                        *updatedPars,
+                                        perTrack->associatedSurface(),
+                                        Trk::anyDirection,
+                                        false,
+                                        Trk::nonInteracting).release();
+          delete updatedPars; updatedPars = nullptr;
 
 	  if (!newperpar || !newperpar->covariance()) {
 	    ATH_MSG_WARNING ("Can not hack perigee parameters, extrapolation failed");
diff --git a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx
index 52d301e9ad12ace4a582b80b1aaa7e6100d1e070..927f487ace6b565372ac17cad38b8609d6bec206 100755
--- a/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx
+++ b/InnerDetector/InDetRecTools/TRT_TrackExtensionTool_xk/src/TRT_TrackExtensionToolCosmics.cxx
@@ -498,7 +498,7 @@ InDet::TRT_TrackExtensionToolCosmics::findBoundarySurface(const Trk::TrackParame
                                                                        *m_propagator,
                                                                        par,
                                                                        *event_data.m_trtcylinder,
-                                                                       dir,true,Trk::muon);
+                                                                       dir,true,Trk::muon).release();
   if(test){
     delete test;
     return event_data.m_trtcylinder;
@@ -507,7 +507,7 @@ InDet::TRT_TrackExtensionToolCosmics::findBoundarySurface(const Trk::TrackParame
   test=m_extrapolator->extrapolateDirectly(ctx,
                                            *m_propagator,
                                            par,
-                                           *event_data.m_trtdiscA,dir,true,Trk::muon);
+                                           *event_data.m_trtdiscA,dir,true,Trk::muon).release();
   if(test){
     delete test;
     return event_data.m_trtdiscA;
@@ -516,7 +516,7 @@ InDet::TRT_TrackExtensionToolCosmics::findBoundarySurface(const Trk::TrackParame
   test=m_extrapolator->extrapolateDirectly(ctx,*
                                            m_propagator,
                                            par,
-                                           *event_data.m_trtdiscC,dir,true,Trk::muon);
+                                           *event_data.m_trtdiscC,dir,true,Trk::muon).release();
   if(test){
     delete test;
     return event_data.m_trtdiscC;
diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AthTruthSelectionTool.cxx b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AthTruthSelectionTool.cxx
index 4a071cfe10190182634c2f68759626dd6eefa719..1868ede0dd279326139951004e582129ccef6b3c 100644
--- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AthTruthSelectionTool.cxx
+++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/src/AthTruthSelectionTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 
 /**
@@ -168,7 +168,7 @@ AthTruthSelectionTool::initialize() {
           const Trk::TrackParameters *exParameters = m_extrapolator->extrapolate(Gaudi::Hive::currentContext(),
                                                                                  cParameters, 
                                                                                  *m_cylinder, 
-                                                                                 Trk::anyDirection, false, Trk::pion);
+                                                                                 Trk::anyDirection, false, Trk::pion).release();
           if (!exParameters) {
             ATH_MSG_VERBOSE("Failed extrapolation. Rejecting track.");
             return false;
@@ -209,7 +209,7 @@ AthTruthSelectionTool::initialize() {
           const Trk::CurvilinearParameters cParameters(position, momentum, p.charge());
           const Trk::TrackParameters *exParameters = m_extrapolator->extrapolate(Gaudi::Hive::currentContext(),
                                                                                  cParameters, 
-                                                                                 *m_disc1, Trk::anyDirection, true, Trk::pion);
+                                                                                 *m_disc1, Trk::anyDirection, true, Trk::pion).release();
           if (exParameters) {
             //since boundary check is true, should be enough to say we've hit the disk..
             ATH_MSG_VERBOSE("Successfully extrapolated track to disk at +" << m_zDisc << ": " << *exParameters);
@@ -222,7 +222,7 @@ AthTruthSelectionTool::initialize() {
             //else...
             ATH_MSG_VERBOSE("Strange, extrapolation succeeded but extrapolated position not within disc radius! Test next disc");
           }
-          exParameters = m_extrapolator->extrapolate(Gaudi::Hive::currentContext(),cParameters, *m_disc2, Trk::anyDirection, true, Trk::pion);
+          exParameters = m_extrapolator->extrapolate(Gaudi::Hive::currentContext(),cParameters, *m_disc2, Trk::anyDirection, true, Trk::pion).release();
           if (exParameters) {
             //since boundary check is true, should be enough to say we've hit the disk..
             ATH_MSG_VERBOSE("Successfully extrapolated track to disk at -" << m_zDisc << ": " << *exParameters);
@@ -286,97 +286,3 @@ AthTruthSelectionTool::testAllCuts(const xAOD::IParticle * particle, std::vector
   return m_cutList.testAllCuts(*pTruth,counter);
 }
 
-
-/*
-bool AthTruthSelectionTool::acceptExtrapolatedTPToSurface(const xAOD::TruthParticle& p) const
-{
-  if (m_radiusCylinder > 0) {
-    ATH_MSG_VERBOSE("Checking particle for intersection with m_cylinder of radius " << m_radiusCylinder);
-    //create surface we extrapolate to and cache it
-    if (m_cylinder == 0) {
-      Amg::Transform3D *trnsf = new Amg::Transform3D();
-      trnsf->setIdentity();
-      m_cylinder = new Trk::CylinderSurface( trnsf, m_radiusCylinder, 20000.);
-    }
-    const xAOD::TruthVertex* ptruthVertex = p.prodVtx();
-    if (ptruthVertex == 0) {
-      //cannot derive production vertex, reject track
-      ATH_MSG_VERBOSE("Rejecting particle without production vertex.");
-      return false;
-    }
-    const auto xPos = ptruthVertex->x();
-    const auto yPos = ptruthVertex->y();
-    const auto z_truth = ptruthVertex->z();
-    const Amg::Vector3D position(xPos, yPos, z_truth);
-    const Amg::Vector3D momentum(p.px(), p.py(), p.pz());
-    const Trk::CurvilinearParameters cParameters(position, momentum, p.charge());
-    const Trk::TrackParameters *exParameters = m_extrapolator->extrapolate(cParameters, *m_cylinder, Trk::anyDirection, false, Trk::pion);
-    if (!exParameters) {
-      ATH_MSG_VERBOSE("Failed extrapolation. Rejecting track.");
-      return false;
-    }
-    ATH_MSG_VERBOSE("Extrapolated parameters to m_cylinder: " << exParameters);
-    const float ex_abs_z = fabs(exParameters->parameters()[Trk::z0]);
-    if ( (ex_abs_z > m_minZCylinder) and (ex_abs_z < m_maxZCylinder) ) {
-      ATH_MSG_VERBOSE("Particle accepted.");
-      return true;
-    }
-    //else..
-    ATH_MSG_VERBOSE("Particle rejected");
-    return false;
-  } else if (m_zDisc > 0) {
-    ATH_MSG_VERBOSE("Checking particle for intersection with m_cylinder of radius " << m_radiusCylinder);
-    //create surface we extrapolate to and cache it
-    if (m_disc1 == 0) { //m_disc2 == 0 implied
-      Amg::Transform3D *trnsf_shiftZ = new Amg::Transform3D();
-      (*trnsf_shiftZ) = Amg::Translation3D(0.,0.,m_zDisc);
-      m_disc1 = new Trk::DiscSurface( trnsf_shiftZ, m_minRadiusDisc, m_maxRadiusDisc);
-      (*trnsf_shiftZ) = Amg::Translation3D(0.,0.,-m_zDisc);
-      m_disc2 = new Trk::DiscSurface( trnsf_shiftZ, m_minRadiusDisc, m_maxRadiusDisc);
-    }
-    const xAOD::TruthVertex* ptruthVertex = p.prodVtx();
-    if (ptruthVertex == 0) {
-      //cannot derive production vertex, reject track
-      ATH_MSG_VERBOSE("Rejecting particle without production vertex.");
-      return false;
-    }
-    const auto xPos = ptruthVertex->x();
-    const auto yPos = ptruthVertex->y();
-    const auto z_truth = ptruthVertex->z();
-    const Amg::Vector3D position(xPos, yPos, z_truth);
-    const Amg::Vector3D momentum(p.px(), p.py(), p.pz());
-    const Trk::CurvilinearParameters cParameters(position, momentum, p.charge());
-    const Trk::TrackParameters *exParameters = m_extrapolator->extrapolate(cParameters, *m_disc1, Trk::anyDirection, true, Trk::pion);
-    if (exParameters) {
-      //since boundary check is true, should be enough to say we've hit the disk..
-      ATH_MSG_VERBOSE("Successfully extrapolated track to disk at +" << m_zDisc);
-      float ex_radius = fabs(exParameters->parameters()[Trk::d0]);
-      ATH_MSG_VERBOSE("|loc1| (|d0|) parameter at surface: " << ex_radius);
-      if ((ex_radius > m_minRadiusDisc) and (ex_radius < m_maxRadiusDisc)) {
-        ATH_MSG_VERBOSE("Confirmed within the disk. Accepting particle");
-        return true;
-      }
-      //else...
-      ATH_MSG_VERBOSE("Strange, extrapolation succeeded but extrapolated position not within disc radius! Test next disc");
-    }
-    exParameters = m_extrapolator->extrapolate(cParameters, *m_disc2, Trk::anyDirection, true, Trk::pion);
-    if (exParameters) {
-      //since boundary check is true, should be enough to say we've hit the disk..
-      ATH_MSG_VERBOSE("Successfully extrapolated track to disk at -" << m_zDisc);
-      float ex_radius = fabs(exParameters->parameters()[Trk::d0]);
-      ATH_MSG_VERBOSE("|loc1| (|d0|) parameter at surface: " << ex_radius);
-      if ((ex_radius > m_minRadiusDisc) and (ex_radius < m_maxRadiusDisc)) {
-        ATH_MSG_VERBOSE("Confirmed within the disk. Accepting particle");
-        return true;
-      }
-      //else...
-      ATH_MSG_VERBOSE("Strange, extrapolation succeeded but extrapolated position not within disc radius! Rejecting");
-    }
-    //else..
-    ATH_MSG_VERBOSE("Particle rejected");
-    return false;
-  }
-  //if not cut enabled, returns OK
-  return true;
-}
-*/
diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.cxx
index b2cc9997399f090deb875eb80c1740dd139ddca5..863d5f84345ff81846979a1fa7965cd0d5dbf807 100755
--- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTrackSummaryHelperTool/src/MuonTrackSummaryHelperTool.cxx
@@ -489,7 +489,7 @@ void Muon::MuonTrackSummaryHelperTool::calculateRoadHits(Trk::MuonTrackSummary::
             exPars = extrapolator->extrapolateDirectly(ctx, 
                                                        pars, 
                                                        surf, 
-                                                       Trk::anyDirection, false, Trk::muon);
+                                                       Trk::anyDirection, false, Trk::muon).release();
             if (!exPars) {
                 if (isStraightLine) {
                     ATH_MSG_DEBUG(" Straight line propagation to prd " << m_idHelperSvc->toString(id) << " failed");
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx
index 2cb10b41079365bb58894cb4d2a03a2c2ddf0e88..fe8a788ed4aa98328cb08960d0a122889e0813cd 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonChamberHoleRecoveryTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "MuonChamberHoleRecoveryTool.h"
@@ -720,7 +720,7 @@ namespace Muon {
                 ATH_MSG_VERBOSE(" Same surface, cloning parameters ");
                 exPars = pars.uniqueClone();
             } else {
-                exPars.reset(m_extrapolator->extrapolateDirectly(ctx, pars, surf, Trk::anyDirection, false, Trk::muon));
+                exPars = m_extrapolator->extrapolateDirectly(ctx, pars, surf, Trk::anyDirection, false, Trk::muon);
                 if (!exPars) {
                     ATH_MSG_WARNING(" Propagation cluster PRD failed!! ");
                     continue;
@@ -804,7 +804,7 @@ namespace Muon {
                 ATH_MSG_DEBUG(" Same surface, cloning parameters ");
                 exPars = pars.uniqueClone();
             } else {
-                exPars.reset(m_extrapolator->extrapolateDirectly(ctx, pars, surf, Trk::anyDirection, false, Trk::muon));
+                exPars = m_extrapolator->extrapolateDirectly(ctx, pars, surf, Trk::anyDirection, false, Trk::muon);
                 if (!exPars) {
                     ATH_MSG_DEBUG(" Propagation cluster hole failed!! ");
                     continue;
@@ -890,7 +890,7 @@ namespace Muon {
                 if (pars.associatedSurface() == surf) {
                     exPars = pars.uniqueClone();
                 } else {
-                    exPars.reset(m_extrapolator->extrapolateDirectly(ctx, pars, surf, Trk::anyDirection, false, Trk::muon));
+                    exPars = m_extrapolator->extrapolateDirectly(ctx, pars, surf, Trk::anyDirection, false, Trk::muon);
                     if (!exPars) {
                         ATH_MSG_WARNING(" Propagation to MDT prd failed!! ");
                         continue;
@@ -926,7 +926,7 @@ namespace Muon {
 
                 // check whether MDT ROT has sagged wire surface, if so redo propagation
                 if (slSurf != &mdtPrd->detectorElement()->surface(id)) {
-                    exPars.reset(m_extrapolator->extrapolateDirectly(ctx, pars, *slSurf, Trk::anyDirection, false, Trk::muon));
+                    exPars = m_extrapolator->extrapolateDirectly(ctx, pars, *slSurf, Trk::anyDirection, false, Trk::muon);
                     if (!exPars) {
                         ATH_MSG_WARNING(" Propagation to sagged surface failed!! ");
                         continue;
@@ -1009,7 +1009,7 @@ namespace Muon {
                 if (pars.associatedSurface() == surf) {
                     exPars = pars.uniqueClone();
                 } else {
-                    exPars.reset(m_extrapolator->extrapolateDirectly(ctx, pars, surf, Trk::anyDirection, false, Trk::muon));
+                    exPars = m_extrapolator->extrapolateDirectly(ctx, pars, surf, Trk::anyDirection, false, Trk::muon);
                     if (!exPars) {
                         ATH_MSG_WARNING(" Propagation to MDT hole failed!! ");
                         continue;
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx
index c3b2fd5e5afa2c2a5a0501d1d131a9337b746e0c..2ddac67ee5f720ffd3f9d091c8302f1b3951bb6c 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonSegmentRegionRecoveryTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "MuonSegmentRegionRecoveryTool.h"
@@ -981,11 +981,11 @@ namespace Muon {
         std::unique_ptr<const Trk::TrackParameters> closest{MuonGetClosestParameters::closestParameters(track, detEl.surface(), true)};
         if (closest) {
             ATH_MSG_VERBOSE("Extrapolating from closest point:\n" << m_printer->print(*closest));
-            exPars.reset(m_extrapolator->extrapolateDirectly(ctx, *closest, detEl.surface(), Trk::anyDirection, false, Trk::muon));
+            exPars = m_extrapolator->extrapolateDirectly(ctx, *closest, detEl.surface(), Trk::anyDirection, false, Trk::muon);
 
         } else {
             ATH_MSG_VERBOSE("Extrapolating from track (no closest point found):\n" << m_printer->print(track));
-            exPars.reset(m_extrapolator->extrapolate(ctx, track, detEl.surface(), Trk::anyDirection, false, Trk::muon));
+            exPars = m_extrapolator->extrapolate(ctx, track, detEl.surface(), Trk::anyDirection, false, Trk::muon);
         }
         if (!exPars) {
             ATH_MSG_DEBUG("Extrapolation did not succeed");
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.cxx
index ffbd510ea6f16dbb8de9a1ffa07ed5299b26780a..21b05255147230650cd74adeaa5a1ea370b28177 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackCleaner.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 #include "MuonTrackCleaner.h"
 
@@ -1143,7 +1143,7 @@ namespace Muon {
                 info.cleanedCompROT = std::move(updatedCompRot);
                 if (info.cleanedCompROT->associatedSurface() != meas->associatedSurface()) {
                     const Trk::TrackParameters* exPars = m_extrapolator->extrapolate(ctx, *pars, info.cleanedCompROT->associatedSurface(),
-                                                                                     Trk::anyDirection, false, Trk::muon);
+                                                                                     Trk::anyDirection, false, Trk::muon).release();
                     if (!exPars) {
                         ATH_MSG_WARNING("Update of comp rot parameters failed, keeping old ones");
                         info.cleanedCompROT.reset();
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.cxx
index af503b9a1fe6035603b47be3bdcc9bf912ce6698..b3a0039ec6d63e7947ff3eff394fbcea324f20dc 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonTrackExtrapolationTool.cxx
@@ -62,17 +62,17 @@ namespace Muon {
         if (m_cosmics) {
             // for cosmics try both directions
             const Trk::TrackParameters *entryPars =
-                m_muonExtrapolator->extrapolateToVolume(ctx, pars, *msEntrance, Trk::oppositeMomentum, particleHypo);
+                m_muonExtrapolator->extrapolateToVolume(ctx, pars, *msEntrance, Trk::oppositeMomentum, particleHypo).release();
             if (!entryPars) {
                 ATH_MSG_VERBOSE(" failed to extrapolate opposite momentum");
                 // retry in other direction
-                entryPars = m_muonExtrapolator->extrapolateToVolume(ctx, pars, *msEntrance, Trk::alongMomentum, particleHypo);
+                entryPars = m_muonExtrapolator->extrapolateToVolume(ctx, pars, *msEntrance, Trk::alongMomentum, particleHypo).release();
                 if (!entryPars) ATH_MSG_VERBOSE(" failed to extrapolate along momentum for the second trial");
             }
             return entryPars;
         }
 
-        return m_muonExtrapolator->extrapolateToVolume(ctx, pars, *msEntrance, dir, particleHypo);
+        return m_muonExtrapolator->extrapolateToVolume(ctx, pars, *msEntrance, dir, particleHypo).release();
     }
 
     const Trk::TrackParameters *MuonTrackExtrapolationTool::extrapolateToIP(const Trk::TrackParameters &pars,
@@ -93,13 +93,13 @@ namespace Muon {
                                                                                         : ""));
 
         // for cosmics try both directions
-        const Trk::TrackParameters *entryPars = m_atlasExtrapolator->extrapolate(ctx, pars, persurf, propDir, false, particleHypo);
+        const Trk::TrackParameters *entryPars = m_atlasExtrapolator->extrapolate(ctx, pars, persurf, propDir, false, particleHypo).release();
         if (!entryPars) ATH_MSG_VERBOSE(" failed to extrapolate to IP");
 
         if (m_cosmics && !entryPars) {
             // flip propagation direction and retry in other direction
             propDir = propDir == Trk::alongMomentum ? Trk::oppositeMomentum : Trk::alongMomentum;
-            entryPars = m_atlasExtrapolator->extrapolate(ctx, pars, persurf, propDir, false, particleHypo);
+            entryPars = m_atlasExtrapolator->extrapolate(ctx, pars, persurf, propDir, false, particleHypo).release();
             if (!entryPars) ATH_MSG_VERBOSE(" failed to extrapolate to IP in opposite direction");
         }
 
@@ -637,7 +637,7 @@ namespace Muon {
     const Trk::Perigee *MuonTrackExtrapolationTool::createPerigee(const Trk::TrackParameters &pars) const {
         if (m_muonExtrapolator2.empty()) { return nullptr; }
         Trk::PerigeeSurface persurf(pars.position());
-        const Trk::TrackParameters *exPars = m_muonExtrapolator2->extrapolateDirectly(Gaudi::Hive::currentContext(),pars, persurf);
+        const Trk::TrackParameters *exPars = m_muonExtrapolator2->extrapolateDirectly(Gaudi::Hive::currentContext(),pars, persurf).release();
         const Trk::Perigee *pp = dynamic_cast<const Trk::Perigee *>(exPars);
         if (!pp) {
             ATH_MSG_WARNING(" Extrapolation to Perigee surface did not return a perigee!! ");
diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx
index 6bb8e9c3698ad9d641896631133f49bbbe7c1aeb..97ad53b5390fa6e4066188b65b75d131c0e25ae8 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx
@@ -855,13 +855,13 @@ namespace Muon {
                     // Check sector-
 
                     if (straightLineMatch && !entry1.hasMomentum()) {
-                        exPars.reset(m_atlasExtrapolator->extrapolateDirectly(ctx, *tmpPars, entry2.segment->associatedSurface(),
-                                                                              Trk::anyDirection, false, Trk::muon));
+                        exPars = m_atlasExtrapolator->extrapolateDirectly(ctx, *tmpPars, entry2.segment->associatedSurface(),
+                                                                          Trk::anyDirection, false, Trk::muon);
                     } else {
                         ATH_MSG_VERBOSE(" Extrapolating to other segment " << m_printer->print(*tmpPars) << std::endl
                                                                            << Amg::toString(*tmpPars->covariance(), 10));
-                        exPars.reset(m_atlasExtrapolator->extrapolate(ctx, *tmpPars, entry2.segment->associatedSurface(), Trk::anyDirection,
-                                                                      false, Trk::muon));
+                        exPars = m_atlasExtrapolator->extrapolate(ctx, *tmpPars, entry2.segment->associatedSurface(), Trk::anyDirection,
+                                                                  false, Trk::muon);
                     }
                 }
                 if (!exPars) {
@@ -888,11 +888,11 @@ namespace Muon {
                 // no closest measured parameters, take closest parameters
 
                 if (straightLineMatch && !entry1.hasMomentum()) {
-                    exPars.reset(m_atlasExtrapolator->extrapolateDirectly(ctx, *closestPars, entry2.segment->associatedSurface(),
-                                                                          Trk::anyDirection, false, Trk::muon));
+                    exPars = m_atlasExtrapolator->extrapolateDirectly(ctx, *closestPars, entry2.segment->associatedSurface(),
+                                                                      Trk::anyDirection, false, Trk::muon);
                 } else {
-                    exPars.reset(m_atlasExtrapolator->extrapolate(ctx, *closestPars, entry2.segment->associatedSurface(), Trk::anyDirection,
-                                                                  false, Trk::muon));
+                    exPars = m_atlasExtrapolator->extrapolate(ctx, *closestPars, entry2.segment->associatedSurface(), Trk::anyDirection,
+                                                              false, Trk::muon);
                 }
                 if (!exPars) {
                     ATH_MSG_DEBUG("track-segment match: Failed to extrapolate track parameters without errors\n"
diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcTrackAnaAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcTrackAnaAlg.cxx
index 13873a689747a5c4f53dad1d7d8f8e4e5e70ca69..72f191bcc140154abbb4dfc36ac59d3e8651aaef 100644
--- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcTrackAnaAlg.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RpcTrackAnaAlg.cxx
@@ -559,7 +559,7 @@ StatusCode RpcTrackAnaAlg::computeTrackIntersectionWithGasGap(ExResult &
                                                 gapSurface,
                                                 result.direction,
                                                 false,
-                                                Trk::muon);
+                                                Trk::muon).release();
   }
   else if (track_particle->track()) {
     detParameters = m_extrapolator->extrapolate(ctx,
@@ -567,7 +567,7 @@ StatusCode RpcTrackAnaAlg::computeTrackIntersectionWithGasGap(ExResult &
                                                 gapSurface,
                                                 result.direction,
                                                 true,
-                                                Trk::muon);
+                                                Trk::muon).release();
   }
   else {
     return StatusCode::FAILURE;
diff --git a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx
index 10a7afe8c3467a539831cf5281fa08f1a953aee4..ebeecbc98ea59b8de865bac80da8f9133fdf42f3 100644
--- a/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx
+++ b/MuonSpectrometer/MuonValidation/MuonPRDTest/src/MDTPRDValAlg.cxx
@@ -879,7 +879,7 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap
       const Trk::SaggedLineSurface& sagSurf = detEl->surface(id);
 	
       const Trk::TrackParameters* expar = m_extrapolator->extrapolateDirectly(ctx,muonPerigee,sagSurf,
-								  Trk::alongMomentum,false);
+								  Trk::alongMomentum,false).release();
       if( !expar ){
 	ATH_MSG_DEBUG(" extrapolation failed ");
 	continue;
@@ -901,7 +901,7 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap
 //
 //  Perform a full extrapolation including material and Eloss
 //
-      const Trk::TrackParameters* exparEloss = m_extrapolator->extrapolate(ctx,muonPerigee,sagSurf,Trk::alongMomentum,false);
+      const Trk::TrackParameters* exparEloss = m_extrapolator->extrapolate(ctx,muonPerigee,sagSurf,Trk::alongMomentum,false).release();
       if( !exparEloss ){
 	ATH_MSG_DEBUG(" extrapolation failed ");
 	delete expar;
@@ -923,7 +923,7 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap
 	continue;
       }
       const Trk::TrackParameters* exparSag = m_extrapolator->extrapolateDirectly(ctx, muonPerigee,*saggedSurface,
-								     Trk::alongMomentum,false);
+								     Trk::alongMomentum,false).release();
       if( !exparSag ){
 	ATH_MSG_DEBUG(" extrapolation failed ");
 	delete saggedSurface;
@@ -958,7 +958,7 @@ void MDTPRDValAlg::analyseHits( MuonMdtHitMap& muonMdtHitMap, TruthMap& truthMap
       }
      
       const Trk::TrackParameters* exparSagRot = m_extrapolator->extrapolateDirectly(ctx,muonPerigee,rot->associatedSurface(),
-									Trk::alongMomentum,false);
+									Trk::alongMomentum,false).release();
       if( !exparSagRot ){
 	ATH_MSG_DEBUG(" extrapolation failed ");
         delete rot;
diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/MuonExtrapolationTool.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/MuonExtrapolationTool.cxx
index af9026ae10f4202621705e4abb2711aeddc32e87..30ad6d2f001e19523e8fcce147df1c144dd2e66d 100644
--- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/MuonExtrapolationTool.cxx
+++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkBPhys/src/MuonExtrapolationTool.cxx
@@ -134,7 +134,7 @@ const Trk::TrackParameters* MuonExtrapolationTool::extrapolateToTriggerPivotPlan
   bool boundaryCheck = true;
   const Trk::Surface* surface = cylinder;
   const Trk::TrackParameters* p = m_extrapolator->extrapolate(
-    ctx, perigee, *surface, Trk::alongMomentum, boundaryCheck, Trk::muon);
+    ctx, perigee, *surface, Trk::alongMomentum, boundaryCheck, Trk::muon).release();
   delete cylinder;
   // if the extrapolation worked out (so we are in the barrel) we are done and can return the 
   // track parameters at this surface. 
@@ -166,7 +166,7 @@ const Trk::TrackParameters* MuonExtrapolationTool::extrapolateToTriggerPivotPlan
   boundaryCheck = false;
   surface = disc;
   p = m_extrapolator->extrapolate(
-    ctx, perigee, *surface, Trk::alongMomentum, boundaryCheck, Trk::muon);
+    ctx, perigee, *surface, Trk::alongMomentum, boundaryCheck, Trk::muon).release();
   delete disc;
   return p;
 }
diff --git a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx
index 5fc2bcbfbf8f0de2c392d50c077d9cda0bf50b49..03df2717d7043273b60afa4bbb4905bbcc29c924 100755
--- a/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx
+++ b/Reconstruction/MuonIdentification/CaloTrkMuIdTools/src/TrackDepositInCaloTool.cxx
@@ -371,7 +371,7 @@ std::unique_ptr<const Trk::TrackParameters> TrackDepositInCaloTool::extrapolateT
         return nullptr;
     }
     // --- Try to extrapolate to entrance ---
-    paramEntrance.reset(m_extrapolator->extrapolate(ctx, *par, *surfEntrance, Trk::alongMomentum, !checkBoundary, muonHypo));
+    paramEntrance = m_extrapolator->extrapolate(ctx, *par, *surfEntrance, Trk::alongMomentum, !checkBoundary, muonHypo);
     if (!paramEntrance) {
         ATH_MSG_DEBUG("Extrapolation to entrance failed without boundary check.");
         return nullptr;
@@ -414,7 +414,7 @@ std::unique_ptr<const Trk::TrackParameters> TrackDepositInCaloTool::extrapolateT
         return nullptr;
     }
     // --- Try to extrapolate to exit of layer ---
-    paramExit.reset(m_extrapolator->extrapolate(ctx, *par, *surfExit, Trk::alongMomentum, checkBoundary, muonHypo));
+    paramExit = m_extrapolator->extrapolate(ctx, *par, *surfExit, Trk::alongMomentum, checkBoundary, muonHypo);
     if (paramExit) {
         ATH_MSG_VERBOSE("Extrapolated to exit. ");
         return paramExit;
@@ -422,7 +422,7 @@ std::unique_ptr<const Trk::TrackParameters> TrackDepositInCaloTool::extrapolateT
     // --- Try to extrapolate to side ---
     std::unique_ptr<Trk::Surface> surfOutside{createSurface(descr, Outside)};
     if (!surfOutside) { return nullptr; }
-    paramExit.reset(m_extrapolator->extrapolate(ctx, *par, *surfOutside, Trk::alongMomentum, checkBoundary, muonHypo));
+    paramExit = m_extrapolator->extrapolate(ctx, *par, *surfOutside, Trk::alongMomentum, checkBoundary, muonHypo);
     if (paramExit) {
         ATH_MSG_VERBOSE("Succesfully extrapolated to outer side of calo for sample " << descr->getSampling());
     } else {
@@ -454,12 +454,12 @@ std::unique_ptr<const Trk::TrackParameters> TrackDepositInCaloTool::extrapolateT
         double zTrans = par->eta() > 0 ? halfLengthOfCylinder : -halfLengthOfCylinder;
         Trk::DiscSurface disc(Amg::Transform3D(Amg::Translation3D(Amg::Vector3D(0., 0., zTrans))), 0, solenoidRadius);
 
-        parAtSolenoid.reset(m_extrapolator->extrapolate(ctx, *par, disc, direction, checkBoundary, muonHypo));
+        parAtSolenoid = m_extrapolator->extrapolate(ctx, *par, disc, direction, checkBoundary, muonHypo);
 
         if (!parAtSolenoid) {
             ATH_MSG_VERBOSE("extrapolateToSolenoid(): Extrapolation to cap of solenoid failed. Trying opposite side.");
             Trk::DiscSurface discOpp(Amg::Transform3D(Amg::Translation3D(Amg::Vector3D(0., 0., -zTrans))), 0, solenoidRadius);
-            parAtSolenoid.reset(m_extrapolator->extrapolate(ctx, *par, discOpp, direction, checkBoundary, muonHypo));
+            parAtSolenoid = m_extrapolator->extrapolate(ctx, *par, discOpp, direction, checkBoundary, muonHypo);
         }
 
         if (parAtSolenoid) { ATH_MSG_VERBOSE("extrapolateToSolenoid(): Extrapolation succeeded for disc-type surface."); }
@@ -571,7 +571,7 @@ std::vector<DepositInCalo> TrackDepositInCaloTool::deposits(const Trk::TrackPara
                 std::unique_ptr<Trk::Surface> surfExit{createSurface(descr, Exit)};
                 std::unique_ptr<const Trk::TrackParameters> paramExit;
                 if (surfExit) {
-                    paramExit.reset(m_extrapolator->extrapolate(ctx, *paramMiddle, *surfExit, Trk::alongMomentum, checkBoundary, muonHypo));
+                    paramExit = m_extrapolator->extrapolate(ctx, *paramMiddle, *surfExit, Trk::alongMomentum, checkBoundary, muonHypo);
                     if (paramExit) {
                         ATH_MSG_VERBOSE("Extrapolated to exit. ");
                         energyExit = calcEnergy(paramExit.get(), muonHypo);
@@ -580,8 +580,8 @@ std::vector<DepositInCalo> TrackDepositInCaloTool::deposits(const Trk::TrackPara
                         // Try to extrapolate to outside
                         std::unique_ptr<Trk::Surface> surfOutside{createSurface(descr, Outside)};
                         if (surfOutside) {
-                            paramExit.reset(
-                                m_extrapolator->extrapolate(ctx, *paramMiddle, *surfOutside, Trk::alongMomentum, checkBoundary, muonHypo));
+                            paramExit = 
+                                m_extrapolator->extrapolate(ctx, *paramMiddle, *surfOutside, Trk::alongMomentum, checkBoundary, muonHypo);
                             if (paramExit) {
                                 ATH_MSG_VERBOSE("Succesfully extrapolated to outer side of calo for sample " << sample);
                                 energyExit = calcEnergy(paramExit.get(), muonHypo);
diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx
index f4e8b7349a645badc326e480b77f25241d101322..5badd623ef9dfd6bd8cf756743f3d38f1f93f26a 100644
--- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx
+++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 
 //////////////////////////////////////////////////////////////////////////////
@@ -147,7 +147,7 @@ namespace Rec {
                 ATH_MSG_DEBUG("Using existing pars");
                 exPars = lastPars;
             } else {
-                exPars = m_extrapolator->extrapolate(ctx, *lastPars, meas->associatedSurface(), Trk::alongMomentum, false, Trk::muon);
+                exPars = m_extrapolator->extrapolate(ctx, *lastPars, meas->associatedSurface(), Trk::alongMomentum, false, Trk::muon).release();
             }
 
             if (!exPars) {
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/ExtrapolateMuonToIPTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/ExtrapolateMuonToIPTool.cxx
index f0c2f311f6afa1d8f831cd0370f1396513a56d62..d34ad690bc6dfa1291e2ce025b388463e37260b8 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/ExtrapolateMuonToIPTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/ExtrapolateMuonToIPTool.cxx
@@ -107,7 +107,7 @@ ExtrapolateMuonToIPTool::extrapolate(const Trk::Track& track,
     if (!ipPars) {
         // if extrapolation failed go in other direction
         propDir = (propDir == Trk::alongMomentum) ? Trk::oppositeMomentum : Trk::alongMomentum;
-        ipPars.reset(m_extrapolator->extrapolate(ctx,*closestPars, perigeeSurface, propDir, false, particleType));
+        ipPars = m_extrapolator->extrapolate(ctx,*closestPars, perigeeSurface, propDir, false, particleType);
 
         if (propDir == Trk::alongMomentum) {
             ATH_MSG_DEBUG(" retrying opposite momentum extrapolating "
@@ -227,7 +227,7 @@ std::unique_ptr<const Trk::Perigee> ExtrapolateMuonToIPTool::createPerigee(const
     std::unique_ptr<const Trk::Perigee> perigee;
     if (m_muonExtrapolator.empty()) { return perigee; }
     Trk::PerigeeSurface persurf(pars.position());
-    const Trk::TrackParameters* exPars = m_muonExtrapolator->extrapolateDirectly(ctx, pars, persurf);
+    const Trk::TrackParameters* exPars = m_muonExtrapolator->extrapolateDirectly(ctx, pars, persurf).release();
     const Trk::Perigee* pp = dynamic_cast<const Trk::Perigee*>(exPars);
     if (!pp) {
         ATH_MSG_WARNING(" Extrapolation to Perigee surface did not return a perigee!! ");
diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.cxx
index 214ac69c82a3e9b5a9c3d622c2f4db8315d92354..2f081e4686be8bfa74b96b47ac905cc03a831425 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCombinedStacoTagTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 
 //////////////////////////////////////////////////////////////////////////////
@@ -66,7 +66,7 @@ namespace MuonCombined {
             // check that the to perigee surfaces are the same
             if (idPer->associatedSurface() != msPer->associatedSurface()) {
                 // extrapolate to id surface
-                exPars.reset(m_extrapolator->extrapolate(ctx, *muonCandidate.extrapolatedTrack(), idPer->associatedSurface()));
+                exPars = m_extrapolator->extrapolate(ctx, *muonCandidate.extrapolatedTrack(), idPer->associatedSurface());
                 if (!exPars) {
                     ATH_MSG_DEBUG("The ID and MS candidates are not expressed at the same surface: id r "
                                     << idTP->indetTrackParticle().perigeeParameters().associatedSurface().center().perp() << " z "
diff --git a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx
index 5f5fc8f7b0a38bee1417a511a701e17de15fdc75..007563eeec6f4a706d193e596f870e50aec91a46 100644
--- a/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx
+++ b/Reconstruction/RecoTools/TrackToCalo/src/ParticleCaloExtensionTool.cxx
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+   Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
  */
 
 #include "ParticleCaloExtensionTool.h"
@@ -466,11 +466,16 @@ ParticleCaloExtensionTool::surfaceCaloExtension(
   // Go into steps from layer to layer
   size_t numSteps = caloSurfaces.size();
   for (size_t i = 0; i < numSteps; ++i) {
-    const auto* nextImpact = m_extrapolator->extrapolate(
-      ctx, *lastImpact, *(caloSurfaces[i]), alongMomentum, false, particleType);
+    std::unique_ptr<const Trk::TrackParameters> nextImpact =
+      m_extrapolator->extrapolate(ctx,
+                                  *lastImpact,
+                                  *(caloSurfaces[i]),
+                                  alongMomentum,
+                                  false,
+                                  particleType);
     if (nextImpact) {
-      caloParameters.emplace_back(clusterLayers[i], nextImpact);
-      lastImpact = nextImpact;
+      caloParameters.emplace_back(clusterLayers[i], std::move(nextImpact));
+      lastImpact = caloParameters.back().second.get();
     }
   }
   return caloParameters;
diff --git a/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertex.cxx b/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertex.cxx
index b9465ad7b5932f3c460ebe93fb9e4c1c8bfa454b..d458bdd2b79190c7718cd10ef6287f35815bb44c 100755
--- a/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertex.cxx
+++ b/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertex.cxx
@@ -102,7 +102,7 @@ const Trk::Perigee* Reco::TrackToVertex::perigeeAtVertex(const xAOD::TrackPartic
     return (trackparPerigee.clone());
   } else {
     const Trk::TrackParameters* extrapResult =
-      m_extrapolator->extrapolateDirectly(Gaudi::Hive::currentContext(),trackparPerigee, persf);
+      m_extrapolator->extrapolateDirectly(Gaudi::Hive::currentContext(),trackparPerigee, persf).release();
     if (extrapResult && extrapResult->surfaceType() == Trk::SurfaceType::Perigee) {
       vertexPerigee = static_cast<const Trk::Perigee*>(extrapResult);
     }
@@ -127,7 +127,7 @@ const Trk::Perigee* Reco::TrackToVertex::perigeeAtVertex(const Rec::TrackParticl
        return(trackparPerigee->clone());
      } else {
        const Trk::TrackParameters* extrapResult =
-         m_extrapolator->extrapolateDirectly(Gaudi::Hive::currentContext(),*trackparPerigee, persf);
+         m_extrapolator->extrapolateDirectly(Gaudi::Hive::currentContext(),*trackparPerigee, persf).release();
        if (extrapResult &&
            extrapResult->surfaceType() == Trk::SurfaceType::Perigee) {
          vertexPerigee = static_cast<const Trk::Perigee*>(extrapResult);
@@ -151,7 +151,7 @@ const Trk::Perigee* Reco::TrackToVertex::perigeeAtVertex(const Trk::Track& track
   Trk::PerigeeSurface persf(gp);
   const Trk::Perigee* vertexPerigee = nullptr;
   const Trk::TrackParameters* extrapResult =
-    m_extrapolator->extrapolate(Gaudi::Hive::currentContext(),track, persf);
+    m_extrapolator->extrapolate(Gaudi::Hive::currentContext(),track, persf).release();
   if (extrapResult && extrapResult->surfaceType() == Trk::SurfaceType::Perigee) {
     vertexPerigee = static_cast<const Trk::Perigee*>(extrapResult);
   }
@@ -212,7 +212,7 @@ Reco::TrackToVertex::perigeeAtBeamline(
 
   const Trk::Perigee* vertexPerigee = nullptr;
   const Trk::TrackParameters* extrapResult =
-    m_extrapolator->extrapolate(ctx,track, persf);
+    m_extrapolator->extrapolate(ctx,track, persf).release();
   if (extrapResult && extrapResult->surfaceType() == Trk::SurfaceType::Perigee) {
     vertexPerigee = static_cast<const Trk::Perigee*>(extrapResult);
   }
@@ -227,7 +227,7 @@ Reco::TrackToVertex::perigeeAtBeamline(
         if (!trk_params) {
           continue;
         }
-        extrapResult = m_extrapolator->extrapolate(ctx,*trk_params, persf);
+        extrapResult = m_extrapolator->extrapolate(ctx,*trk_params, persf).release();
         if (extrapResult &&
             extrapResult->surfaceType() == Trk::SurfaceType::Perigee) {
           vertexPerigee = static_cast<const Trk::Perigee*>(extrapResult);
@@ -283,7 +283,7 @@ const Trk::TrackParameters* Reco::TrackToVertex::trackAtBeamline(const xAOD::Tra
        ATH_MSG_DEBUG("Perigee of TrackParticle is already expressed to given vertex, a copy is returned.");
        return(trackparPerigee.clone());
   } else
-      vertexPerigee = m_extrapolator->extrapolateDirectly(Gaudi::Hive::currentContext(),trackparPerigee, persf);
+      vertexPerigee = m_extrapolator->extrapolateDirectly(Gaudi::Hive::currentContext(),trackparPerigee, persf).release();
   if (!vertexPerigee){
      ATH_MSG_DEBUG("Extrapolation to Beam Line failed, a NULL pointer is returned.");
   }
@@ -294,13 +294,13 @@ const Trk::TrackParameters* Reco::TrackToVertex::trackAtBeamline(const xAOD::Tra
 const Trk::TrackParameters* Reco::TrackToVertex::trackAtBeamline(const Trk::Track& trk,
                                 const Trk::StraightLineSurface* beamline) const
 {
-  return m_extrapolator->extrapolate(Gaudi::Hive::currentContext(), trk, *beamline);
+  return m_extrapolator->extrapolate(Gaudi::Hive::currentContext(), trk, *beamline).release();
 }
 
 const Trk::TrackParameters* Reco::TrackToVertex::trackAtBeamline(const Trk::TrackParameters& tpars,
                                 const Trk::StraightLineSurface* beamline) const
 {
-  return m_extrapolator->extrapolate(Gaudi::Hive::currentContext(), tpars, *beamline);
+  return m_extrapolator->extrapolate(Gaudi::Hive::currentContext(), tpars, *beamline).release();
 }
 
 
diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/Utilities.cxx b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/Utilities.cxx
index fc90c2b2e913f8d0da657e0f99df2fc56b056387..75c3d5259e66ac92f0490ddddbadd0715e4b5035 100755
--- a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/Utilities.cxx
+++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/Utilities.cxx
@@ -331,9 +331,9 @@ namespace Rec{
      const Trk::TrackParameters * extrapParP=0; //along momentum
      const Trk::TrackParameters * extrapParN=0; //backward
      if(nextLayerP){ extrapParP = m_extrapolator->extrapolate(ctx, pseudoVrtPart,
-                     nextLayerP->surfaceRepresentation(), Trk::anyDirection, false, Trk::nonInteractingMuon) ;}
+                     nextLayerP->surfaceRepresentation(), Trk::anyDirection, false, Trk::nonInteractingMuon).release();}
      if(nextLayerN){ extrapParN = m_extrapolator->extrapolate(ctx, pseudoVrtPart,
-                     nextLayerN->surfaceRepresentation(), Trk::anyDirection, false, Trk::nonInteractingMuon) ;}
+                     nextLayerN->surfaceRepresentation(), Trk::anyDirection, false, Trk::nonInteractingMuon).release();}
 
      float distanceP=1.e9, distanceN=1.e9;
      if(extrapParP)distanceP=PntPntDist(extrapParP->position(), Vrt.fitVertex);
diff --git a/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.cxx b/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.cxx
index d85495c742b2c5c639c0416406b0f2578965f0d5..d8d32f821ad5c5fb55b1be6625ccfc9b9c27fd42 100644
--- a/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.cxx
+++ b/Reconstruction/egamma/egammaTrackTools/src/EMExtrapolationTools.cxx
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+   Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
  */
 
 #include "EMExtrapolationTools.h"
@@ -454,17 +454,14 @@ EMExtrapolationTools::getMomentumAtVertex(const EventContext& ctx,
     if (!tp) {
       ATH_MSG_WARNING("NULL pointer to TrackParticle in vertex");
     } else {
-      const Trk::PerigeeSurface* surface =
-        new Trk::PerigeeSurface(vertex.position());
-      const Trk::TrackParameters* params =
-        m_extrapolator->extrapolate(ctx, *tp, *surface, Trk::alongMomentum);
-      delete surface;
+      Trk::PerigeeSurface surface(vertex.position());
+      std::unique_ptr<const Trk::TrackParameters> params =
+        m_extrapolator->extrapolate(ctx, *tp, surface, Trk::alongMomentum);
       if (!params) {
         ATH_MSG_DEBUG("Extrapolation to vertex (perigee) failed");
       } else {
         momentum += params->momentum();
       }
-      delete params;
     }
   }
   return momentum;
diff --git a/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx b/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx
index c4c6143c18239b5323e8f45f3ed13a09417511b4..6a3e2819a17891cf0349d11497232c1452ab76ec 100644
--- a/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx
+++ b/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx
@@ -294,16 +294,16 @@ egammaTrkRefitterTool::provideVotFromBeamspot(const EventContext& ctx,
   Trk::LocalParameters beamSpotParameters(Par0);
 
   // calculate perigee parameters wrt. beam-spot
-  const Trk::Perigee* perigee = nullptr;
-  const Trk::TrackParameters* tmp =
+  std::unique_ptr<const Trk::Perigee> perigee = nullptr;
+  std::unique_ptr<const Trk::TrackParameters> tmp =
     m_extrapolator->extrapolate(ctx, *track, surface);
-  if (tmp->associatedSurface().type() == Trk::SurfaceType::Perigee) {
-    perigee = static_cast<const Trk::Perigee*>(tmp);
+  if (tmp && tmp->associatedSurface().type() == Trk::SurfaceType::Perigee) {
+    perigee.reset(static_cast<const Trk::Perigee*>(tmp.release()));
   }
   if (!perigee) { // if failure
     const Trk::Perigee* trackPerigee = track->perigeeParameters();
     if (trackPerigee && ((trackPerigee->associatedSurface())) == surface)
-      perigee = trackPerigee->clone();
+      perigee = trackPerigee->uniqueClone();
   }
 
   Eigen::Matrix<double, 1, 2> Jacobian;
@@ -317,7 +317,6 @@ egammaTrkRefitterTool::provideVotFromBeamspot(const EventContext& ctx,
   Amg::MatrixX errorMatrix(Jacobian * (beamSpotCov * Jacobian.transpose()));
   vot = new Trk::VertexOnTrack(beamSpotParameters, errorMatrix, surface);
 
-  delete perigee;
   return vot;
 }
 
diff --git a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/src/ISPtoPerigeeTool.cxx b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/src/ISPtoPerigeeTool.cxx
index d37825d8f22092912b94c8433fede5e6a742a222..a97ab84e351989affd91a451ae96d8285b3fd727 100644
--- a/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/src/ISPtoPerigeeTool.cxx
+++ b/Simulation/ISF/ISF_ParametricSim/ISF_ParSimTools/src/ISPtoPerigeeTool.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -60,7 +60,7 @@ const Trk::TrackParameters* iParSim::ISPtoPerigeeTool::extractTrkParameters(cons
     const Trk::TrackParameters* tP = m_extrapolator->extrapolate(ctx,
                                                                  cParameters, 
                                                                  persf, 
-                                                                 Trk::anyDirection, false);
+                                                                 Trk::anyDirection, false).release();
     return tP;
 
 }
diff --git a/Simulation/ISF/ISF_Tracking/ISF_TrackingTools/src/TrkExtrapolator.cxx b/Simulation/ISF/ISF_Tracking/ISF_TrackingTools/src/TrkExtrapolator.cxx
index 2831be8ea694f75cd613c3d4295c3abff1525524..27287c724059e4bf0bb96d5a59a6068932145200 100644
--- a/Simulation/ISF/ISF_Tracking/ISF_TrackingTools/src/TrkExtrapolator.cxx
+++ b/Simulation/ISF/ISF_Tracking/ISF_TrackingTools/src/TrkExtrapolator.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -108,7 +108,7 @@ ISF::ISFParticle* ISF::TrkExtrapolator::extrapolate( const ISF::ISFParticle &par
                                                                                      par,
                                                                                      *m_trackingVolume,
                                                                                      Trk::alongMomentum,
-                                                                                     particleHypo);
+                                                                                     particleHypo).release();
   
   // create a new ISF particle representing the given particle at the extrapolated position
   ISFParticle *extrapolatedParticle = new ISFParticle( extrapolatedPars->position(),
diff --git a/TestBeam/TBRec/src/TBExtrapolTrackToCaloTool.cxx b/TestBeam/TBRec/src/TBExtrapolTrackToCaloTool.cxx
index 8532092aa385360ce2e24eb78deee0001202e275..1a39213eb37f5fc958b39385210859d7a5f599a5 100644
--- a/TestBeam/TBRec/src/TBExtrapolTrackToCaloTool.cxx
+++ b/TestBeam/TBRec/src/TBExtrapolTrackToCaloTool.cxx
@@ -446,7 +446,7 @@ TBExtrapolTrackToCaloTool::extrapolate(const Trk::TrackParameters* parm,
     Gaudi::Hive::currentContext(),
     *parm, *surf,
     Trk::alongMomentum,
-    true, Trk::nonInteracting);
+    true, Trk::nonInteracting).release();
   
   if (param)
     ATH_MSG_DEBUG ("Propagation successful ");
@@ -481,7 +481,7 @@ TBExtrapolTrackToCaloTool::extrapolate(const Trk::Track* trk,
     Gaudi::Hive::currentContext(),
     *trk, *surf,
     Trk::alongMomentum,
-    true, Trk::nonInteracting);
+    true, Trk::nonInteracting).release();
   
   // the other way to do it:
   //
@@ -543,7 +543,7 @@ Amg::Vector3D TBExtrapolTrackToCaloTool::getMomentumAtVertex(const xAOD::Vertex&
         ATH_MSG_WARNING("NULL pointer to TrackParticle in vertex");
         continue;
       }
-      const Trk::TrackParameters* params = m_extrapolator->extrapolate(ctx, *tp, *surface, Trk::alongMomentum);
+      const Trk::TrackParameters* params = m_extrapolator->extrapolate(ctx, *tp, *surface, Trk::alongMomentum).release();
       if (!params)
         ATH_MSG_DEBUG("Extrapolation to vertex (perigee) failed");
       else
diff --git a/Tracking/TrkAlignment/TrkAlignGenTools/src/BeamspotVertexPreProcessor.cxx b/Tracking/TrkAlignment/TrkAlignGenTools/src/BeamspotVertexPreProcessor.cxx
index c7435b6e230621ac8fd5ec31648dfdeedb781199..e519695657dff8d2dda01cb9965b738b13939f19 100644
--- a/Tracking/TrkAlignment/TrkAlignGenTools/src/BeamspotVertexPreProcessor.cxx
+++ b/Tracking/TrkAlignment/TrkAlignGenTools/src/BeamspotVertexPreProcessor.cxx
@@ -437,9 +437,13 @@ const VertexOnTrack* BeamspotVertexPreProcessor::provideVotFromVertex(const Trac
       ///vertex as perigeeSurface
       Amg::Vector3D  globPos(updatedVtx->position()); //look
       const PerigeeSurface* surface = new PerigeeSurface(globPos);
-
-
-      const Perigee *  perigee = dynamic_cast<const Perigee*>(m_extrapolator->extrapolate(ctx,*track, *surface));
+      const Perigee* perigee = nullptr;
+      std::unique_ptr<const Trk::TrackParameters> tmp =
+        m_extrapolator->extrapolate(ctx, *track, *surface);
+      //pass ownership only if of correct type
+      if (tmp && tmp->associatedSurface().type() == Trk::SurfaceType::Perigee) {
+         perigee = static_cast<const Perigee*> (tmp.release()); 
+      }
       if (!perigee) {
         const Perigee * trackPerigee = track->perigeeParameters();
         if ( trackPerigee && trackPerigee->associatedSurface() == *surface )
@@ -558,7 +562,14 @@ const VertexOnTrack* BeamspotVertexPreProcessor::provideVotFromBeamspot(const Tr
     beamSpotParameters = LocalParameters(Par0);
 
     // calculate perigee parameters wrt. beam-spot
-    const Perigee * perigee = dynamic_cast<const Perigee*>(m_extrapolator->extrapolate(ctx, *track, *surface));
+    const Perigee* perigee = nullptr;
+    std::unique_ptr<const Trk::TrackParameters> tmp =
+      m_extrapolator->extrapolate(ctx, *track, *surface);
+    // pass ownership only if of correct type
+    if (tmp && tmp->associatedSurface().type() == Trk::SurfaceType::Perigee) {
+      perigee = static_cast<const Perigee*>(tmp.release());
+    }
+
     if (!perigee) {
       const Perigee * trackPerigee = track->perigeeParameters();
       if ( trackPerigee && trackPerigee->associatedSurface() == *surface )
@@ -651,7 +662,7 @@ BeamspotVertexPreProcessor::doConstraintRefit(
       // get track parameters at the vertex:
       const PerigeeSurface&         surface=vot->associatedSurface();
       ATH_MSG_DEBUG(" Track reference surface will be:  " << surface);
-      const TrackParameters* parsATvertex=m_extrapolator->extrapolate(ctx, *track, surface);
+      const TrackParameters* parsATvertex=m_extrapolator->extrapolate(ctx, *track, surface).release();
 
       ATH_MSG_DEBUG(" Track will be refitted at this surface  ");
       newTrack = (fitter->fit(ctx, measurementCollection, 
diff --git a/Tracking/TrkDetDescr/TrkDetDescrTPCnv/src/TrkGeometry/CompressedLayerMaterialCnv_p1.cxx b/Tracking/TrkDetDescr/TrkDetDescrTPCnv/src/TrkGeometry/CompressedLayerMaterialCnv_p1.cxx
index 7217951a942b40afcaeeb728b59e3f89e12ffa31..789703dbbb5d754f8fcf19e6e32db64d76a35d22 100644
--- a/Tracking/TrkDetDescr/TrkDetDescrTPCnv/src/TrkGeometry/CompressedLayerMaterialCnv_p1.cxx
+++ b/Tracking/TrkDetDescr/TrkDetDescrTPCnv/src/TrkGeometry/CompressedLayerMaterialCnv_p1.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 
 //////////////////////////////////////////////////////////////////
@@ -32,7 +32,7 @@ void CompressedLayerMaterialCnv_p1::persToTrans( const Trk::CompressedLayerMater
                                     std::move(mvec),
                                     persObj->materialBins,
                                     persObj->splitFactor);
-  *transObj = std::move (mat);
+  *transObj = mat;
 }
 
 void CompressedLayerMaterialCnv_p1::transToPers( const Trk::CompressedLayerMaterial    *transObj,
diff --git a/Tracking/TrkEvent/TrkMaterialOnTrack/TrkMaterialOnTrack/EnergyLoss.h b/Tracking/TrkEvent/TrkMaterialOnTrack/TrkMaterialOnTrack/EnergyLoss.h
index b11a1e35448a549ccace7e2f6fc5613d9256f2d0..66797f25bc0e0fbb0194d520efb89ead2c8bc3cd 100755
--- a/Tracking/TrkEvent/TrkMaterialOnTrack/TrkMaterialOnTrack/EnergyLoss.h
+++ b/Tracking/TrkEvent/TrkMaterialOnTrack/TrkMaterialOnTrack/EnergyLoss.h
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 
 ///////////////////////////////////////////////////////////////////
@@ -97,7 +97,7 @@ public:
               bool mpv = false);
 
   // update
-  void update(EnergyLoss&, bool mpv = false);
+  void update(const EnergyLoss&, bool mpv = false);
 
   // set
   void set(double eLoss,
@@ -201,7 +201,7 @@ EnergyLoss::update(double ioni, double sigi, double rad, double sigr, bool mpv)
 }
 
 inline void
-EnergyLoss::update(EnergyLoss& eloss, bool mpv)
+EnergyLoss::update(const EnergyLoss& eloss, bool mpv)
 {
   m_mean_ioni += eloss.meanIoni();
   m_mean_rad += eloss.meanRad();
diff --git a/Tracking/TrkExtrapolation/TrkExAlgs/src/CETmaterial.cxx b/Tracking/TrkExtrapolation/TrkExAlgs/src/CETmaterial.cxx
index 4cac14ee85a6726b0e7e4eaf9b4691d8c5726934..161fa8228ae0df910f0a4c5e2d25fbb6ae7c682a 100755
--- a/Tracking/TrkExtrapolation/TrkExAlgs/src/CETmaterial.cxx
+++ b/Tracking/TrkExtrapolation/TrkExAlgs/src/CETmaterial.cxx
@@ -201,14 +201,20 @@ StatusCode Trk::CETmaterial::execute()
         m_msentry = m_trackingGeometry->trackingVolume("Calo::Containers::Calorimeter");
       }
       if (m_msentry) {
-        const Trk::TrackParameters* msEntry = m_extrapolator->extrapolateToVolume(ctx,
-                                                                                  *currPar,*m_msentry,Trk::alongMomentum,
-                                                                                  (Trk::ParticleHypothesis)m_particleType);
+        const Trk::TrackParameters* msEntry =
+          m_extrapolator->extrapolateToVolume(
+            ctx,
+            *currPar,
+            *m_msentry,
+            Trk::alongMomentum,
+            (Trk::ParticleHypothesis)m_particleType).release();
         if (msEntry) {
-           printMat(theta,phi,
-                  currPar->momentum().mag()-msEntry->momentum().mag(),
-                  Amg::error(msEntry->covariance()->inverse().eval(),Trk::theta),
-                  Amg::error(msEntry->covariance()->inverse().eval(),Trk::phi));
+          printMat(
+            theta,
+            phi,
+            currPar->momentum().mag() - msEntry->momentum().mag(),
+            Amg::error(msEntry->covariance()->inverse().eval(), Trk::theta),
+            Amg::error(msEntry->covariance()->inverse().eval(), Trk::phi));
 
           const std::vector<const Trk::TrackStateOnSurface*>* mmsentry = m_extrapolator->extrapolateM(ctx,
                                                                                                       *currPar,
diff --git a/Tracking/TrkExtrapolation/TrkExAlgs/src/CombinedExtrapolatorTest.cxx b/Tracking/TrkExtrapolation/TrkExAlgs/src/CombinedExtrapolatorTest.cxx
index 281fb846f95fb19a3666aa0302f0bad4e631e2ca..5f828bb126b7b3958c97f5f93f6fe4e2d06a022b 100755
--- a/Tracking/TrkExtrapolation/TrkExAlgs/src/CombinedExtrapolatorTest.cxx
+++ b/Tracking/TrkExtrapolation/TrkExAlgs/src/CombinedExtrapolatorTest.cxx
@@ -127,7 +127,7 @@ StatusCode Trk::CombinedExtrapolatorTest::execute()
     *seed,
     *m_outerBoundary, 
     Trk::alongMomentum,
-    (Trk::ParticleHypothesis)m_particleType);
+    (Trk::ParticleHypothesis)m_particleType).release();
 
   if (!destParameters || !m_extrapolator->trackingGeometry()->atVolumeBoundary(destParameters->position(),m_outerBoundary,0.001) ) {
     msg(MSG::ERROR) << " extrapolation to outer boundary failed for input parameters: " << initialPerigee.parameters() << endmsg;
@@ -143,7 +143,7 @@ StatusCode Trk::CombinedExtrapolatorTest::execute()
       pSf, 
       Trk::oppositeMomentum,
       false,
-      (Trk::ParticleHypothesis)m_particleType);
+      (Trk::ParticleHypothesis)m_particleType).release();
     if ( peri) {
       msg(MSG::INFO) << " extrapolation to perigee:input: " << initialPerigee.parameters() << endmsg;
       msg(MSG::INFO) << " extrapolation to perigee:output: " << peri->parameters() << endmsg;
diff --git a/Tracking/TrkExtrapolation/TrkExAlgs/src/EnergyLossExtrapolationValidation.cxx b/Tracking/TrkExtrapolation/TrkExAlgs/src/EnergyLossExtrapolationValidation.cxx
index 2eb021e5e2ab8aa94ce55c048ecc82dd361a477f..ce5778b5458d68986b8078f1272623ddc99e54e4 100644
--- a/Tracking/TrkExtrapolation/TrkExAlgs/src/EnergyLossExtrapolationValidation.cxx
+++ b/Tracking/TrkExtrapolation/TrkExAlgs/src/EnergyLossExtrapolationValidation.cxx
@@ -350,7 +350,7 @@ StatusCode Trk::EnergyLossExtrapolationValidation::execute()
           *(m_theCylinders->at(0)),
           Trk::alongMomentum,
           true,
-          (Trk::ParticleHypothesis)m_particleType);
+          (Trk::ParticleHypothesis)m_particleType).release();
 
     } else { // material collection validation
 
@@ -405,7 +405,7 @@ StatusCode Trk::EnergyLossExtrapolationValidation::execute()
               *(m_theCylinders->at(lay)),
               Trk::alongMomentum,
               true,
-              (Trk::ParticleHypothesis)m_particleType);
+              (Trk::ParticleHypothesis)m_particleType).release();
 
         } else { // material collection validation
 
@@ -443,12 +443,14 @@ StatusCode Trk::EnergyLossExtrapolationValidation::execute()
 
             if (!m_materialCollectionValidation) {
 
-                newParameters = m_extrapolator->extrapolate(ctx,
-                                                            m_onion ? *lastParameters : startParameters,
-                                                            (m_parameterEta[0] < 0) ? *(m_theDiscs1->at(lay)) : *(m_theDiscs2->at(lay)),
-                                                            Trk::alongMomentum,
-                                                            true,
-                                                            (Trk::ParticleHypothesis)m_particleType);
+              newParameters = m_extrapolator->extrapolate(
+                ctx,
+                m_onion ? *lastParameters : startParameters,
+                (m_parameterEta[0] < 0) ? *(m_theDiscs1->at(lay))
+                                        : *(m_theDiscs2->at(lay)),
+                Trk::alongMomentum,
+                true,
+                (Trk::ParticleHypothesis)m_particleType).release();
 
             } else { // material collection validation
 
diff --git a/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolationValidation.cxx b/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolationValidation.cxx
index efd7e85d3c93eb69ce15d1d36942c2b3eb3d2b3a..3681d3c279c46c98112dd1288adc0c551cf7e095 100755
--- a/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolationValidation.cxx
+++ b/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolationValidation.cxx
@@ -329,7 +329,7 @@ StatusCode Trk::ExtrapolationValidation::execute()
                                                                                           startParameters,
                                                                                           estimationCylinder,
                                                                                           Trk::alongMomentum,
-                                                                                          false);
+                                                                                          false).release();
    if (!estimationParameters) {
         ATH_MSG_VERBOSE( "Estimation of intersection did not work - skip event !" );
         return StatusCode::SUCCESS;
@@ -398,7 +398,7 @@ StatusCode Trk::ExtrapolationValidation::execute()
                                                     destinationSurface, 
                                                     Trk::alongMomentum,
                                                     false,
-                                                    (Trk::ParticleHypothesis)m_particleType,Trk::addNoise);
+                                                    (Trk::ParticleHypothesis)m_particleType,Trk::addNoise).release();
    else if(!m_direct){ // material collection validation
        // get the vector of TrackStateOnSurfaces back
       const std::vector<const Trk::TrackStateOnSurface*>* 
@@ -428,7 +428,7 @@ StatusCode Trk::ExtrapolationValidation::execute()
                                                           destinationSurface, 
                                                           Trk::alongMomentum,
                                                           false,
-                                                          (Trk::ParticleHypothesis)m_particleType);
+                                                          (Trk::ParticleHypothesis)m_particleType).release();
      
    }
    // ----------------------- check if forward call was successful and continue then
@@ -475,7 +475,7 @@ StatusCode Trk::ExtrapolationValidation::execute()
                                                          startSurface, 
                                                          Trk::oppositeMomentum,
                                                          false,
-                                                         (Trk::ParticleHypothesis)m_particleType,Trk::removeNoise);
+                                                         (Trk::ParticleHypothesis)m_particleType,Trk::removeNoise).release();
        else if(!m_direct){ // material collection validation
             // get the vector of TrackStateOnSurfaces back
             const std::vector<const Trk::TrackStateOnSurface*>* 
@@ -505,7 +505,7 @@ StatusCode Trk::ExtrapolationValidation::execute()
                                                         startSurface, 
                                                         Trk::oppositeMomentum,
                                                         false,
-                                                        (Trk::ParticleHypothesis)m_particleType);
+                                                        (Trk::ParticleHypothesis)m_particleType).release();
 
        }
       // ----------------------- check if backward call was successful and continue then
diff --git a/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolatorComparisonTest.cxx b/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolatorComparisonTest.cxx
index b663fba88fb30577510c2805d721c57b62153639..76d759c7c5e6c6c091952c4832ad4bde1bdb280b 100644
--- a/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolatorComparisonTest.cxx
+++ b/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolatorComparisonTest.cxx
@@ -230,7 +230,7 @@ StatusCode Trk::ExtrapolatorComparisonTest::execute(const EventContext& ctx) con
           *destinationSurface,
           Trk::alongMomentum,
           true,
-          (Trk::ParticleHypothesis)m_particleType);
+          (Trk::ParticleHypothesis)m_particleType).release();
       auto end_fwd = xclock::now();
       float ms_fwd = std::chrono::duration_cast<std::chrono::milliseconds>(end_fwd-start_fwd).count();
       
@@ -249,7 +249,7 @@ StatusCode Trk::ExtrapolatorComparisonTest::execute(const EventContext& ctx) con
             atlPerigee->associatedSurface(),
             Trk::oppositeMomentum,
             true,
-            (Trk::ParticleHypothesis)m_particleType);
+            (Trk::ParticleHypothesis)m_particleType).release();
         auto end_bkw = xclock::now();
         float ms_bkw = std::chrono::duration_cast<std::chrono::milliseconds>(end_bkw-start_bkw).count();
         
diff --git a/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolatorTest.cxx b/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolatorTest.cxx
index f74ffe548077974111cff7b8e95b40f590190458..395e9b19029748b41d65c3cc3768395cceaeb517 100755
--- a/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolatorTest.cxx
+++ b/Tracking/TrkExtrapolation/TrkExAlgs/src/ExtrapolatorTest.cxx
@@ -210,7 +210,7 @@ void Trk::ExtrapolatorTest::runTest( const Trk::Perigee& initialPerigee ) {
                *destinationSurface,
                propagationDirection,
                false,
-               (Trk::ParticleHypothesis)m_particleType)
+               (Trk::ParticleHypothesis)m_particleType).release()
            :
 
            m_propagator
diff --git a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IExtrapolator.h b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IExtrapolator.h
index 900274af0b74e1842c85c268f09070431813b53b..68a6624047556880049a7c4456425f947d22f19c 100755
--- a/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IExtrapolator.h
+++ b/Tracking/TrkExtrapolation/TrkExInterfaces/TrkExInterfaces/IExtrapolator.h
@@ -29,6 +29,7 @@
 #include "xAODTracking/NeutralParticle.h"
 #include "xAODTracking/TrackParticle.h"
 // STL
+#include <memory>
 #include <utility>
 
 namespace Trk {
@@ -72,7 +73,7 @@ public:
   /** [xAOD interface ] */
 
   /** xAOD 0) neutral xAOD particle */
-  virtual const NeutralParameters* extrapolate(
+  virtual std::unique_ptr<const NeutralParameters> extrapolate(
     const xAOD::NeutralParticle& xnParticle,
     const Surface& sf,
     PropDirection dir = anyDirection,
@@ -82,11 +83,11 @@ public:
    * ------------------------------------------------------------- */
 
   /** N 0) <b>Neutral parameters method </b>
-      - returns a ParametersBase object as well, nullptr if the extrapolation did not
-     succeed. 
+      - returns a ParametersBase object as well, nullptr if the extrapolation
+     did not succeed.
     */
 
-  virtual const NeutralParameters* extrapolate(
+  virtual std::unique_ptr<const NeutralParameters> extrapolate(
     const NeutralParameters& parameters,
     const Surface& sf,
     PropDirection dir = anyDirection,
@@ -96,7 +97,7 @@ public:
    * ------------------------------------------ */
 
   /** xAOD 0) xAOD track particle */
-  virtual const TrackParameters* extrapolate(
+  virtual std::unique_ptr<const TrackParameters> extrapolate(
     const EventContext& ctx,
     const xAOD::TrackParticle& particleBase,
     const Surface& sf,
@@ -109,7 +110,7 @@ public:
    -  returns the TrackParameters at the Destination Surface (if extrapolation
    succeeds), nullptr if extrapolation to destination surface does not succeed
  */
-  virtual const TrackParameters* extrapolate(
+  virtual std::unique_ptr<const TrackParameters> extrapolate(
     const EventContext& ctx,
     const TrackParameters& parm,
     const Surface& sf,
@@ -137,7 +138,7 @@ public:
   Surface
   - returns the TrackParameters at the Destination Surface (if extrapolation
   succeeds), nullptr if extrapolation to destination surface does not suceed */
-  virtual const TrackParameters* extrapolate(
+  virtual std::unique_ptr<const TrackParameters> extrapolate(
     const EventContext& ctx,
     const Track& trk,
     const Surface& sf,
@@ -151,7 +152,7 @@ public:
    - direct extrapolation to the destination surface, no material effects
    or intermediate steps are taken into account
   */
-  virtual TrackParameters* extrapolateDirectly(
+  virtual std::unique_ptr<TrackParameters> extrapolateDirectly(
     const EventContext& ctx,
     const TrackParameters& parm,
     const Surface& sf,
@@ -163,7 +164,7 @@ public:
    Same as 4 but with propagator arguement (needed by a single client
    TRT_TrackExtensionToolCosmics
   */
-  virtual TrackParameters* extrapolateDirectly(
+  virtual std::unique_ptr<TrackParameters> extrapolateDirectly(
     const EventContext& ctx,
     const IPropagator& prop,
     const TrackParameters& parm,
@@ -211,7 +212,7 @@ public:
     - extrapolation to the next active layer, based on the extrapolation to the
     next layer and layer identification
     * */
-  virtual const TrackParameters* extrapolateToVolume(
+  virtual std::unique_ptr<const TrackParameters> extrapolateToVolume(
     const EventContext& ctx,
     const TrackParameters& parm,
     const Trk::TrackingVolume& vol,
@@ -246,7 +247,7 @@ public:
     ParticleHypothesis particle = pion,
     Trk::ExtrapolationCache* cache = nullptr) const = 0;
 
-  virtual const Trk::TrackParameters* extrapolateWithPathLimit(
+  virtual std::unique_ptr<const Trk::TrackParameters> extrapolateWithPathLimit(
     const EventContext& ctx,
     const Trk::TrackParameters& parm,
     double& pathLim,
@@ -283,7 +284,6 @@ public:
   /** Access the subPropagator to the given volume*/
   virtual const IPropagator* subPropagator(
     const TrackingVolume& tvol) const = 0;
-
 };
 } // end of namespace
 
diff --git a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.h b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.h
index cbead221603c2e6a4fdcc40e0d0757fbc1b822d6..4a58bf3135eaa782887a493d1d6e9aa3569a23d2 100755
--- a/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.h
+++ b/Tracking/TrkExtrapolation/TrkExTools/TrkExTools/Extrapolator.h
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+   Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
  */
 
 ///////////////////////////////////////////////////////////////////
@@ -176,14 +176,14 @@ public:
   /** [xAOD] interface ------------------------------------------------------------------ */
 
   /** xAOD 0) neutral xAOD particle */
-  virtual const NeutralParameters* extrapolate(
+  virtual std::unique_ptr<const NeutralParameters> extrapolate(
     const xAOD::NeutralParticle& xnParticle,
     const Surface& sf,
     PropDirection dir = anyDirection,
     const BoundaryCheck& bcheck = true) const override final;
 
   /** xAOD 0) neutral xAOD particle */
-  virtual const TrackParameters* extrapolate(
+  virtual std::unique_ptr<const TrackParameters> extrapolate(
     const EventContext& ctx,
     const xAOD::TrackParticle& particleBase,
     const Surface& sf,
@@ -198,14 +198,14 @@ public:
     - returns a ParametersBase object as well, 0 if the extrapolation did not succeed
     */
 
-  virtual const NeutralParameters* extrapolate(
+  virtual std::unique_ptr<const NeutralParameters> extrapolate(
     const NeutralParameters& parameters,
     const Surface& sf,
     PropDirection dir = anyDirection,
     const BoundaryCheck& bcheck = true) const override final;
 
   /**  1) <b>Configured AlgTool extrapolation method</b>):*/
-  virtual const TrackParameters* extrapolate(
+  virtual std::unique_ptr<const TrackParameters> extrapolate(
     const EventContext& ctx,
     const TrackParameters& parm,
     const Surface& sf,
@@ -225,7 +225,7 @@ public:
     ParticleHypothesis particle = pion) const override final;
 
   /** 3) <b>Configured AlgTool extrapolation method</b>):*/
-  virtual const TrackParameters* extrapolate(
+  virtual std::unique_ptr<const TrackParameters> extrapolate(
     const EventContext& ctx,
     const Track& trk,
     const Surface& sf,
@@ -236,7 +236,7 @@ public:
     Trk::ExtrapolationCache* cache = nullptr) const override final;
 
   /** 4) <b>Configured AlgTool extrapolation method</b>):*/
-  virtual TrackParameters* extrapolateDirectly(
+  virtual std::unique_ptr<TrackParameters> extrapolateDirectly(
     const EventContext& ctx,
     const TrackParameters& parm,
     const Surface& sf,
@@ -245,7 +245,7 @@ public:
     ParticleHypothesis particle = pion) const override final;
 
   /** 4.1) <b>Configured AlgTool extrapolation method</b>):*/
-  virtual TrackParameters* extrapolateDirectly(
+  virtual std::unique_ptr<TrackParameters> extrapolateDirectly(
     const EventContext& ctx,
     const IPropagator& prop,
     const TrackParameters& parm,
@@ -283,7 +283,7 @@ public:
     MaterialUpdateMode matupmode = addNoise) const override final;
 
   /** 8) <b>Configured AlgTool extrapolation method</b> ):*/
-  virtual const TrackParameters* extrapolateToVolume(
+  virtual std::unique_ptr<const TrackParameters> extrapolateToVolume(
     const EventContext& ctx,
     const TrackParameters& parm,
     const Trk::TrackingVolume& vol,
@@ -291,7 +291,8 @@ public:
     ParticleHypothesis particle = pion) const override final;
 
   /** 9) <b>Configured AlgTool extrapolation method</b>:
-    - Extrapolate to a destination surface, while collecting all the material layers in between.
+    - Extrapolate to a destination surface, while collecting all the material
+    layers in between.
     */
   virtual std::vector<const TrackStateOnSurface*>* extrapolateM(
     const EventContext& ctx,
@@ -317,7 +318,7 @@ public:
     ParticleHypothesis particle = pion,
     Trk::ExtrapolationCache* cache = nullptr) const override final;
 
-  virtual const Trk::TrackParameters* extrapolateWithPathLimit(
+  virtual std::unique_ptr<const Trk::TrackParameters> extrapolateWithPathLimit(
     const EventContext& ctx,
     const Trk::TrackParameters& parm,
     double& pathLim,
@@ -334,13 +335,13 @@ public:
     with TrackParameters. Material collection in option. Destination
     (subdetector boundary) : geoID (+ entry, -exit) ( default MS exit )
     */
-  virtual const std::vector<std::pair<const Trk::TrackParameters*, int>>* extrapolate(
-    const EventContext& ctx,
-    const Trk::TrackParameters& parm,
-    Trk::PropDirection dir,
-    Trk::ParticleHypothesis particle,
-    std::vector<const Trk::TrackStateOnSurface*>*& material,
-    int destination = 3) const override final;
+  virtual const std::vector<std::pair<const Trk::TrackParameters*, int>>*
+  extrapolate(const EventContext& ctx,
+              const Trk::TrackParameters& parm,
+              Trk::PropDirection dir,
+              Trk::ParticleHypothesis particle,
+              std::vector<const Trk::TrackStateOnSurface*>*& material,
+              int destination = 3) const override final;
 
   /** Return the TrackingGeometry used by the Extrapolator (forward information from Navigator)*/
   virtual const TrackingGeometry* trackingGeometry() const override final;
diff --git a/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx b/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx
index 4c6b10d75aab77eeae0cacc9a2c47b7d4f8b0b54..8fe496f09ecf46737cfd10e1e224d5be68805a93 100755
--- a/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx
+++ b/Tracking/TrkExtrapolation/TrkExTools/src/Extrapolator.cxx
@@ -47,10 +47,10 @@
 #include "TrkVolumes/BoundarySurface.h"
 #include "TrkVolumes/BoundarySurfaceFace.h"
 #include "TrkVolumes/Volume.h"
-// 
+//
 #include "EventPrimitives/EventPrimitives.h"
 #include "GeoPrimitives/GeoPrimitives.h"
-// 
+//
 #include <memory>
 #include <utility>
 #include <cstdint>
@@ -492,7 +492,7 @@ Trk::Extrapolator::finalize()
   return StatusCode::SUCCESS;
 }
 
-const Trk::NeutralParameters*
+std::unique_ptr<const Trk::NeutralParameters>
 Trk::Extrapolator::extrapolate(const xAOD::NeutralParticle& xnParticle,
                                const Surface& sf,
                                PropDirection dir,
@@ -503,7 +503,7 @@ Trk::Extrapolator::extrapolate(const xAOD::NeutralParticle& xnParticle,
   return extrapolate(nPerigee, sf, dir, bcheck);
 }
 
-const Trk::TrackParameters*
+std::unique_ptr<const Trk::TrackParameters>
 Trk::Extrapolator::extrapolate(const EventContext& ctx,
                                const xAOD::TrackParticle& xtParticle,
                                const Surface& sf,
@@ -519,7 +519,7 @@ Trk::Extrapolator::extrapolate(const EventContext& ctx,
   return extrapolate(ctx, tPerigee, sf, dir, bcheck, particle, matupmode);
 }
 
-const Trk::NeutralParameters*
+std::unique_ptr<const Trk::NeutralParameters>
 Trk::Extrapolator::extrapolate(const NeutralParameters& parameters,
                                const Surface& sf,
                                PropDirection dir,
@@ -529,7 +529,7 @@ Trk::Extrapolator::extrapolate(const NeutralParameters& parameters,
     const IPropagator* currentPropagator =
       !m_subPropagators.empty() ? m_subPropagators[Trk::Global] : nullptr;
     if (currentPropagator) {
-      return currentPropagator->propagate(parameters, sf, dir, bcheck).release();
+      return currentPropagator->propagate(parameters, sf, dir, bcheck);
     }
   }
   ATH_MSG_ERROR("  [!] No default Propagator is configured ! Please check jobOptions.");
@@ -2161,9 +2161,9 @@ Trk::Extrapolator::extrapolateToVolumeImpl(const EventContext& ctx,
   return returnParms;
 }
 
-// Configured AlgTool extrapolation methods
+// Interface Extrapolation methods
 // ----------------------------------------------------------------/
-const Trk::TrackParameters*
+std::unique_ptr<const Trk::TrackParameters>
 Trk::Extrapolator::extrapolate(const EventContext& ctx,
                                const TrackParameters& parm,
                                const Surface& sf,
@@ -2184,8 +2184,7 @@ Trk::Extrapolator::extrapolate(const EventContext& ctx,
                          bcheck,
                          particle,
                          matupmode,
-                         extrapolationCache)
-    .release();
+                         extrapolationCache).to_unique();
 }
 
 Trk::TrackParametersUVector
@@ -2209,7 +2208,7 @@ Trk::Extrapolator::extrapolateStepwise(const EventContext& ctx,
   return {};
 }
 
-const Trk::TrackParameters*
+std::unique_ptr<const Trk::TrackParameters>
 Trk::Extrapolator::extrapolate(const EventContext& ctx,
                                const Trk::Track& trk,
                                const Trk::Surface& sf,
@@ -2272,7 +2271,7 @@ Trk::Extrapolator::extrapolateBlindly(const EventContext& ctx,
   return {};
 }
 
-Trk::TrackParameters*
+std::unique_ptr<Trk::TrackParameters>
 Trk::Extrapolator::extrapolateDirectly(const EventContext& ctx,
                                        const Trk::TrackParameters& parm,
                                        const Trk::Surface& sf,
@@ -2287,14 +2286,15 @@ Trk::Extrapolator::extrapolateDirectly(const EventContext& ctx,
     const IPropagator* currentPropagator =
       !m_subPropagators.empty() ? m_subPropagators[Trk::Global] : nullptr;
     if (currentPropagator) {
-      return (extrapolateDirectlyImpl(ctx, (*currentPropagator), parm, sf, dir, bcheck, particle).release());
+      return extrapolateDirectlyImpl(
+        ctx, (*currentPropagator), parm, sf, dir, bcheck, particle);
     }
   }
   ATH_MSG_ERROR("  [!] No default Propagator is configured ! Please check jobOptions.");
   return nullptr;
 }
 
-Trk::TrackParameters*
+std::unique_ptr<Trk::TrackParameters>
 Trk::Extrapolator::extrapolateDirectly(const EventContext& ctx,
                                        const IPropagator& prop,
                                        const Trk::TrackParameters& parm,
@@ -2304,7 +2304,7 @@ Trk::Extrapolator::extrapolateDirectly(const EventContext& ctx,
                                        Trk::ParticleHypothesis particle) const
 {
 
-  return extrapolateDirectlyImpl(ctx, prop, parm, sf, dir, bcheck, particle).release();
+  return extrapolateDirectlyImpl(ctx, prop, parm, sf, dir, bcheck, particle);
 }
 
 std::pair<const Trk::TrackParameters*, const Trk::Layer*>
@@ -2362,7 +2362,7 @@ Trk::Extrapolator::extrapolateToNextActiveLayerM(
   return {nullptr, nullptr};
 }
 
-const Trk::TrackParameters*
+std::unique_ptr<const Trk::TrackParameters>
 Trk::Extrapolator::extrapolateToVolume(const EventContext& ctx,
                                        const Trk::TrackParameters& parm,
                                        const Trk::TrackingVolume& vol,
@@ -2375,7 +2375,7 @@ Trk::Extrapolator::extrapolateToVolume(const EventContext& ctx,
     const IPropagator* currentPropagator =
       !m_subPropagators.empty() ? m_subPropagators[vol.geometrySignature()] : nullptr;
     if (currentPropagator) {
-      return (extrapolateToVolumeImpl(ctx, *currentPropagator, parm, vol, dir, particle).release());
+      return (extrapolateToVolumeImpl(ctx, *currentPropagator, parm, vol, dir, particle));
     }
   }
   ATH_MSG_ERROR("  [!] No default Propagator is configured ! Please check jobOptions.");
@@ -3689,7 +3689,7 @@ Trk::Extrapolator::insideVolumeStaticLayers(const EventContext& ctx,
       const IPropagator* navPropagator = &(*m_propagators[navprop]);
 
       // we veto the navigaiton parameters for calo-volumes with calo dynamic
-      bool vetoNavParameters = false; // 
+      bool vetoNavParameters = false; //
       // the next Parameters are usually better, because they're closer to the
       // boundary
       //  --- in the initial volume (assLayerReference!=0), the parm are good if
@@ -4793,7 +4793,7 @@ Trk::Extrapolator::extrapolate(const EventContext& ctx,
   return !cache.m_identifiedParameters->empty() ? cache.m_identifiedParameters.release() : nullptr;
 }
 
-const Trk::TrackParameters*
+std::unique_ptr<const Trk::TrackParameters>
 Trk::Extrapolator::extrapolateWithPathLimit(const EventContext& ctx,
                                             const Trk::TrackParameters& parm,
                                             double& pathLim,
@@ -4865,7 +4865,7 @@ Trk::Extrapolator::extrapolateWithPathLimit(const EventContext& ctx,
   // save actual path on output
   pathLim = cache.m_path;
 
-  return returnParms.release();
+  return returnParms.to_unique();
 }
 
 Trk::ManagedTrackParmPtr
@@ -5402,7 +5402,7 @@ Trk::Extrapolator::extrapolateToVolumeWithPathLimit(const EventContext& ctx,
       ATH_MSG_DEBUG(" [M] Energy loss: STEP , EnergyLossUpdator:"
                     << nextPar->momentum().mag() - currPar->momentum().mag() << ","
                     << eloss->deltaE());
-     
+
       auto mefot = std::make_unique<const Trk::MaterialEffectsOnTrack>(
         dInX0, newsa, eloss, *((nextPar->associatedSurface()).baseSurface()));
 
diff --git a/Tracking/TrkFitter/TrkDistributedKalmanFilter/src/DistributedKalmanFilter.cxx b/Tracking/TrkFitter/TrkDistributedKalmanFilter/src/DistributedKalmanFilter.cxx
index 9ea4dfed6d7559b114dced49badcc66ec67491d6..843c9727a0b8e2a2ce7bd78197bab3cd345bcd4a 100644
--- a/Tracking/TrkFitter/TrkDistributedKalmanFilter/src/DistributedKalmanFilter.cxx
+++ b/Tracking/TrkFitter/TrkDistributedKalmanFilter/src/DistributedKalmanFilter.cxx
@@ -1,5 +1,5 @@
 /*
-   Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+   Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
  */
 
 //////////////////////////////////////////////////////////////////
@@ -904,7 +904,7 @@ Trk::DistributedKalmanFilter::fit(
                                           perSurf,
                                           Trk::anyDirection,
                                           false,
-                                          Trk::nonInteracting);
+                                          Trk::nonInteracting).release();
 
     pP = dynamic_cast<const Perigee*>(pTP);
     if (pP == nullptr) {
diff --git a/Tracking/TrkFitter/TrkDynamicNoiseAdjustor/src/InDetDynamicNoiseAdjustment.cxx b/Tracking/TrkFitter/TrkDynamicNoiseAdjustor/src/InDetDynamicNoiseAdjustment.cxx
index 17d9c4acf239ef811c532bebacb6042520d85247..610f92cf7e64aacc175e2a2a9f2f0fb89c12590f 100755
--- a/Tracking/TrkFitter/TrkDynamicNoiseAdjustor/src/InDetDynamicNoiseAdjustment.cxx
+++ b/Tracking/TrkFitter/TrkDynamicNoiseAdjustor/src/InDetDynamicNoiseAdjustment.cxx
@@ -302,13 +302,13 @@ Trk::InDetDynamicNoiseAdjustment::DNA_Adjust(
         CREATE_PARAMETERS(*updatedPar, updatedParameters1, updatedCovariance1).release();
       updatedPar.reset(clonePars1);
       // --- Extrapolate changed updatedPar and calculate chi2 for step one
-      auto testPredPars = std::unique_ptr<const Trk::TrackParameters>(
+      std::unique_ptr<const Trk::TrackParameters> testPredPars =
         m_extrapolator->extrapolate(state.eventContext,
                                     *updatedPar,
                                     surf,
                                     direction,
                                     false,
-                                    matEff.particleType()));
+                                    matEff.particleType());
       if (testPredPars == nullptr) {
         ATH_MSG_WARNING("Test extrapolation for DNA step 1 failed");
         return nullptr;
@@ -340,12 +340,12 @@ Trk::InDetDynamicNoiseAdjustment::DNA_Adjust(
       updatedPar.reset(clonePars2);
 
       // --- Extrapolate changed updatedPar and calculate chi2 for step two
-      testPredPars.reset(m_extrapolator->extrapolate(state.eventContext,
-                                                     *updatedPar,
-                                                     surf,
-                                                     direction,
-                                                     false,
-                                                     matEff.particleType()));
+      testPredPars = m_extrapolator->extrapolate(state.eventContext,
+                                                 *updatedPar,
+                                                 surf,
+                                                 direction,
+                                                 false,
+                                                 matEff.particleType());
       if (testPredPars == nullptr) {
         ATH_MSG_WARNING("Test extrapolation for DNA step 2 failed");
         return nullptr;
diff --git a/Tracking/TrkFitter/TrkFitterUtils/src/TrackFitInputPreparator.cxx b/Tracking/TrkFitter/TrkFitterUtils/src/TrackFitInputPreparator.cxx
index 66171cb7121b85a8d5245ed4b1151325e39603ce..8de34f2a3e58c3521d33e74c1ec14559ddc34006 100755
--- a/Tracking/TrkFitter/TrkFitterUtils/src/TrackFitInputPreparator.cxx
+++ b/Tracking/TrkFitter/TrkFitterUtils/src/TrackFitInputPreparator.cxx
@@ -556,8 +556,7 @@ void Trk::TrackFitInputPreparator::insertStateIntoTrajectory(Trajectory& traject
               Trk::alongMomentum,
               false,
               partHypo
-
-              );
+              ).release();
             if (!trkPar) {
                 std::cout << "TrackFitInputPreparator: WARNING, extrapolation problem." << std::endl;
             }
diff --git a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx
index fbc71a022012337a3a3668fe1e65c1af1d893dc1..a4e3c1d45bf0a01b1424f8550aa9a74eaf17469b 100644
--- a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx
+++ b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx
@@ -640,16 +640,10 @@ namespace Trk {
     }
 
     if ((tp_closestmuon != nullptr) && (cache.m_msEntrance != nullptr)) {
-      tmppar.reset(
-        m_extrapolator->extrapolateToVolume(ctx,
-          *tp_closestmuon,
-          *cache.m_msEntrance,
-          propdir,
-          nonInteracting
-        )
-      );
+      tmppar = m_extrapolator->extrapolateToVolume(
+        ctx, *tp_closestmuon, *cache.m_msEntrance, propdir, nonInteracting);
     }
-    
+
     std::unique_ptr<const std::vector<const TrackStateOnSurface *>> matvec;
     
     if (tmppar != nullptr) {
@@ -836,14 +830,9 @@ namespace Trk {
           newpar[0], newpar[1], newpar[2], newpar[3], newqoverpid, std::nullopt
         );
       }
-      
-      lastidpar.reset(m_extrapolator->extrapolateToVolume(
-        ctx,
-        *firstidpar,
-        *cache.m_caloEntrance,
-        alongMomentum, 
-        Trk::muon
-      ));
+
+      lastidpar = m_extrapolator->extrapolateToVolume(
+        ctx, *firstidpar, *cache.m_caloEntrance, alongMomentum, Trk::muon);
     }
 
     if (lastidpar == nullptr) {
@@ -1092,14 +1081,12 @@ namespace Trk {
         );
         idscatpar = firstscatpar.get();
 
-        startPar.reset(m_extrapolator->extrapolateToVolume(
-          ctx,
-          *idscatpar,
-          *cache.m_caloEntrance,
-          oppositeMomentum,
-          Trk::nonInteracting
-        ));
-        
+        startPar = m_extrapolator->extrapolateToVolume(ctx,
+                                                       *idscatpar,
+                                                       *cache.m_caloEntrance,
+                                                       oppositeMomentum,
+                                                       Trk::nonInteracting);
+
         if (startPar != nullptr) {
           Amg::Vector3D trackdir = startPar->momentum().unit();
           Amg::Vector3D curvZcrossT = -(trackdir.cross(Amg::Vector3D(0, 0, 1)));
@@ -1122,7 +1109,7 @@ namespace Trk {
             curvlinsurf,
             Trk::oppositeMomentum,
             Trk::nonInteracting != 0u
-          );
+          ).release();
           
           if (curvlinpar != nullptr) {
             startPar.reset(curvlinpar);
@@ -1306,14 +1293,9 @@ namespace Trk {
 
     std::unique_ptr<const TrackParameters> lastidpar = nullptr;
     if ((firstidpar != nullptr) && (cache.m_caloEntrance != nullptr))
-      lastidpar.reset(m_extrapolator->extrapolateToVolume(
-        ctx,
-        *firstidpar,
-        *cache.m_caloEntrance,
-        alongMomentum, 
-        Trk::muon
-      ));
-      
+      lastidpar = m_extrapolator->extrapolateToVolume(
+        ctx, *firstidpar, *cache.m_caloEntrance, alongMomentum, Trk::muon);
+
     if (lastidpar == nullptr) {
       lastidpar.reset(pParametersVector->back()->clone());
     }
@@ -3781,7 +3763,7 @@ namespace Trk {
                 alongMomentum, 
                 false, 
                 matEffects
-              );
+              ).release();
 
               if (tp == nullptr) {
                 return;
@@ -3930,14 +3912,12 @@ namespace Trk {
           if (cache.m_caloEntrance == nullptr) {
             ATH_MSG_ERROR("calo entrance not available");
           } else {
-            tmppar.reset(m_extrapolator->extrapolateToVolume(
-              ctx,
-              *startmatpar1,
-              *cache.m_caloEntrance,
-              oppositeMomentum,
-              Trk::nonInteracting
-            ));
-            
+            tmppar = m_extrapolator->extrapolateToVolume(ctx,
+                                                         *startmatpar1,
+                                                         *cache.m_caloEntrance,
+                                                         oppositeMomentum,
+                                                         Trk::nonInteracting);
+
             if (tmppar != nullptr) {
               destsurf = &tmppar->associatedSurface();
             }
@@ -4000,15 +3980,13 @@ namespace Trk {
           if (cache.m_caloEntrance == nullptr) {
             ATH_MSG_ERROR("calo entrance not available");
           } else {
-            tmppar.reset(m_extrapolator->extrapolateToVolume(
-              ctx,
-              *startmatpar2,
-              *cache.m_caloEntrance,
-              Trk::alongMomentum,
-              Trk::nonInteracting
-            ));
+            tmppar = m_extrapolator->extrapolateToVolume(ctx,
+                                                         *startmatpar2,
+                                                         *cache.m_caloEntrance,
+                                                         Trk::alongMomentum,
+                                                         Trk::nonInteracting);
           }
-          
+
           if (tmppar != nullptr) {
             const CylinderSurface *cylcalosurf = nullptr;
             
@@ -4244,13 +4222,11 @@ namespace Trk {
         if (cache.m_msEntrance == nullptr) {
           ATH_MSG_ERROR("MS entrance not available");
         } else if (cache.m_msEntrance->inside(lastcalopar->position())) {
-          muonpar1.reset(m_extrapolator->extrapolateToVolume(
-            ctx,
-            *lastcalopar,
-            *cache.m_msEntrance,
-            Trk::alongMomentum,
-            Trk::nonInteracting
-          ));
+          muonpar1 = m_extrapolator->extrapolateToVolume(ctx,
+                                                         *lastcalopar,
+                                                         *cache.m_msEntrance,
+                                                         Trk::alongMomentum,
+                                                         Trk::nonInteracting);
 
           if (muonpar1 != nullptr) {
             Amg::Vector3D trackdir = muonpar1->momentum().unit();
@@ -4409,14 +4385,12 @@ namespace Trk {
         if (cache.m_msEntrance == nullptr) {
           ATH_MSG_ERROR("MS entrance not available");
         } else if (cache.m_msEntrance->inside(firstcalopar->position())) {
-          muonpar1.reset(m_extrapolator->extrapolateToVolume(
-            ctx,
-            *firstcalopar,
-            *cache.m_msEntrance,
-            Trk::oppositeMomentum,
-            Trk::nonInteracting
-          ));
-          
+          muonpar1 = m_extrapolator->extrapolateToVolume(ctx,
+                                                         *firstcalopar,
+                                                         *cache.m_msEntrance,
+                                                         Trk::oppositeMomentum,
+                                                         Trk::nonInteracting);
+
           if (muonpar1 != nullptr) {
             Amg::Vector3D trackdir = muonpar1->momentum().unit();
             Amg::Vector3D curvZcrossT = -(trackdir.cross(Amg::Vector3D(0, 0, 1)));
@@ -6962,16 +6936,12 @@ namespace Trk {
         return nullptr;
       }
     } else if (cache.m_acceleration && (firstmeasstate->trackParameters() != nullptr)) {
-      per.reset(
-        m_extrapolator->extrapolate(
-          ctx,
-          *firstmeasstate->trackParameters(),
-          PerigeeSurface(Amg::Vector3D(0, 0, 0)),
-          oppositeMomentum,
-          false,
-          matEffects
-        )
-      );
+      per = m_extrapolator->extrapolate(ctx,
+                                        *firstmeasstate->trackParameters(),
+                                        PerigeeSurface(Amg::Vector3D(0, 0, 0)),
+                                        oppositeMomentum,
+                                        false,
+                                        matEffects);
     } else {
       per.reset(oldtrajectory.referenceParameters()->clone());
     }
diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardKalmanFitter.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardKalmanFitter.cxx
index 7b7164281bdb9dc752575c249f19e03e66d79c47..b11c69103f471252283728a70b8493e0c250c9e7 100755
--- a/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardKalmanFitter.cxx
+++ b/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardKalmanFitter.cxx
@@ -384,12 +384,12 @@ Trk::ForwardKalmanFitter::predict
     } else {
       ATH_MSG_VERBOSE ("-Fp get filter onto 1st surface by direct extrapolation.");
       if (!m_useExEngine)
-        predPar.reset(m_extrapolator->extrapolateDirectly(ctx,
+        predPar= m_extrapolator->extrapolateDirectly(ctx,
                                                           *updatedPar,
                                                           destinationSurface,
                                                           Trk::anyDirection,
                                                           false,
-                                                          Trk::nonInteracting));
+                                                          Trk::nonInteracting);
 
       else {
         ATH_MSG_INFO ("Forward Kalman Fitter --> starting extrapolation engine");
@@ -433,9 +433,13 @@ Trk::ForwardKalmanFitter::predict
     ////////////////////////////////////////////////////////////////////////////
     // --- 2nd case covers filter loop: extrapolate to next surface with full matEffects
     if (!m_useExEngine)
-      predPar.reset(m_extrapolator->extrapolate(ctx,*updatedPar,destinationSurface,
-					    Trk::alongMomentum,false,
-					    controlledMatEffects.particleType()));
+      predPar =
+        m_extrapolator->extrapolate(ctx,
+                                    *updatedPar,
+                                    destinationSurface,
+                                    Trk::alongMomentum,
+                                    false,
+                                    controlledMatEffects.particleType());
     else {
       ATH_MSG_DEBUG ("Forward Kalman Fitter --> starting extrapolation engine");
       Trk::ExtrapolationCell <Trk::TrackParameters> ecc(*updatedPar, Trk::alongMomentum);
@@ -777,7 +781,7 @@ Trk::FitterStatusCode Trk::ForwardKalmanFitter::enterSeedIntoTrajectory
         inputPar,
         startSurface,
         Trk::anyDirection,
-        false, Trk::nonInteracting);
+        false, Trk::nonInteracting).release();
     else {
       ATH_MSG_DEBUG ("Forward Kalman Fitter --> starting extrapolation engine");
       Trk::ExtrapolationCell <Trk::TrackParameters> ecc(inputPar, Trk::anyDirection);
diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardRefTrackKalmanFitter.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardRefTrackKalmanFitter.cxx
index eaedf7ef6c4b05f1961468fd5ab03739e02936da..2ffb3ba4b4a121d6245cfe9beac9622413478a60 100755
--- a/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardRefTrackKalmanFitter.cxx
+++ b/Tracking/TrkFitter/TrkKalmanFitter/src/ForwardRefTrackKalmanFitter.cxx
@@ -415,7 +415,7 @@ Trk::FitterStatusCode Trk::ForwardRefTrackKalmanFitter::enterSeedIntoTrajectory
       inputPar,
       startSurface,
       Trk::anyDirection,
-      false, Trk::nonInteracting);
+      false, Trk::nonInteracting).release();
     if (inputParAtStartSurface == nullptr) {
       ATH_MSG_WARNING ("-Fe can not transport input param to first measurement => extrap problem or bad input");
       ATH_MSG_INFO ("-Fe parameters R="<< inputPar.position().perp() << ", z="<<
diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanFitter.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanFitter.cxx
index a68d016fb580827177b7d65f0f149433658d5bf3..822be54d09804f1eae4694c24afd84cf8a942efc 100755
--- a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanFitter.cxx
+++ b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanFitter.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
 */
 
 //////////////////////////////////////////////////////////////////
@@ -1554,7 +1554,7 @@ Trk::KalmanFitter::callValidation(const EventContext& ctx,
                                                Trk::anyDirection
                                                : Trk::oppositeMomentum,
                                              false,
-                                             matEffects);
+                                             matEffects).release();
         per = dynamic_cast<const Trk::Perigee*>(perPar);
     } else {
         ATH_MSG_WARNING("Perigee-making for validation failed: no useful parameters on track!" );
diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierRecovery_InDet.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierRecovery_InDet.cxx
index d281a6627c4c4df81de2be4d3bd20e8fadc843c8..9dcf1db8210f266ec2464e62cad848f8bb4b5d09 100755
--- a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierRecovery_InDet.cxx
+++ b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierRecovery_InDet.cxx
@@ -174,13 +174,17 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T,
 
           Trk::Trajectory::iterator restartState = Trk::ProtoTrajectoryUtility::nextFittableState(T,it);
           const Trk::TrackParameters* smoothedParAtOutlier =
-	    (restartState != T.end() ?
-	     m_extrapolator->extrapolate(ctx,
-                                   *restartState->smoothedTrackParameters(),
-                                   it->measurement()->associatedSurface(), Trk::oppositeMomentum,
-                                   false, Trk::nonInteracting) :
-	     nullptr );
-          if (!smoothedParAtOutlier) continue;
+            (restartState != T.end()
+               ? m_extrapolator->extrapolate(
+                   ctx,
+                   *restartState->smoothedTrackParameters(),
+                   it->measurement()->associatedSurface(),
+                   Trk::oppositeMomentum,
+                   false,
+                   Trk::nonInteracting).release()
+               : nullptr);
+          if (!smoothedParAtOutlier)
+            continue;
 
           if ( (it->measurement()->localCovariance()(Trk::locX,Trk::locX) < 0.02*0.02)
                || (it->measurement()->localCovariance()(Trk::locY,Trk::locY) < 0.2*0.2) ) {
@@ -241,7 +245,7 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T,
                                     *filterInputPar,
                                     lastSctState->measurement()->associatedSurface(),
                                     Trk::alongMomentum,
-                                    false, Trk::nonInteracting);
+                                    false, Trk::nonInteracting).release();
       if (sctExitTemp == nullptr) {
         ATH_MSG_DEBUG ("-O- can not reproduce trajectory in SCT recovery!");
         for( Trk::Trajectory::iterator it = T.begin(); it!=T.end(); ++it)
@@ -289,13 +293,15 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T,
       for( ; rit!=T.rend(); ++rit) {
         if ( rit->measurementType() == SCT) {
           const Trk::TrackParameters* predPar =
-	    (sctFitResult!=nullptr ?
-	     m_extrapolator->extrapolate(ctx,
-                                   *sctFitResult,
-                                   rit->measurement()->associatedSurface(),
-                                   Trk::oppositeMomentum,
-                                   false, Trk::muon) :
-	     nullptr);
+            (sctFitResult != nullptr
+               ? m_extrapolator->extrapolate(
+                   ctx,
+                   *sctFitResult,
+                   rit->measurement()->associatedSurface(),
+                   Trk::oppositeMomentum,
+                   false,
+                   Trk::muon).release()
+               : nullptr);
           delete sctFitResult;
           if (!predPar) {
 	    ATH_MSG_DEBUG ("-O- internal mini-filter failed in SCT recovery!");
@@ -321,13 +327,16 @@ bool Trk::KalmanOutlierRecovery_InDet::flagNewOutliers(Trk::Trajectory& T,
       rit = firstSctState_r + 1; // now on last Pixel state!
       for( ; rit!=T.rend(); ++rit) {
         const Trk::TrackParameters* filteredPar =
-	  ( updatedPar != nullptr ?
-	    m_extrapolator->extrapolate(ctx,
-                                  *updatedPar,
-                                  rit->measurement()->associatedSurface(),
-                                  Trk::oppositeMomentum,
-                                  false, Trk::muon) :
-      nullptr );
+          (updatedPar != nullptr
+             ? m_extrapolator
+                 ->extrapolate(ctx,
+                               *updatedPar,
+                               rit->measurement()->associatedSurface(),
+                               Trk::oppositeMomentum,
+                               false,
+                               Trk::muon)
+                 .release()
+             : nullptr);
         delete updatedPar;
         const Trk::FitQualityOnSurface* testQuality = (filteredPar==nullptr)? nullptr :
           m_updator->predictedStateFitQuality(*filteredPar,
diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanPiecewiseAnnealingFilter.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanPiecewiseAnnealingFilter.cxx
index 83dff3fe68fdd8dc96cd06158166259908c518ef..464cf445c0c98fb919fc6618d27080a80e439782 100644
--- a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanPiecewiseAnnealingFilter.cxx
+++ b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanPiecewiseAnnealingFilter.cxx
@@ -400,12 +400,12 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece
     } else {
       if (!input_it->referenceParameters()) {
         // filter using extrapolator
-        predPar.reset((m_extrapolator->extrapolate(
-              ctx,
-              *updatedPar,
-					      *input_it->surface(),
-					      Trk::alongMomentum,
-					      false, particleType)));
+        predPar = (m_extrapolator->extrapolate(ctx,
+                                               *updatedPar,
+                                               *input_it->surface(),
+                                               Trk::alongMomentum,
+                                               false,
+                                               particleType));
       } else {
         // filter using differences
         const TransportJacobian& jac = *m_trajPiece.back().jacobian();
@@ -771,13 +771,13 @@ Trk::KalmanPiecewiseAnnealingFilter::filterTrajectoryPiece
   } else { // ## case 2: DAF on a subset of trajectory
 
     if (m_forwardFitter->needsReferenceTrajectory()) ATH_MSG_ERROR("Code missing!");
-    start_predPar.reset(m_extrapolator->extrapolate(
+    start_predPar = m_extrapolator->extrapolate(
       ctx,
       *lastStateOnPiece->smoothedTrackParameters(),
       resumeKfState->measurement()->associatedSurface(),
       Trk::alongMomentum,
       false,
-      particleType));
+      particleType);
     if (!start_predPar) {
       ATH_MSG_INFO ("final extrapolation to finish off piecewise filter failed!" <<
 		    " input or internal sorting problem?" );
diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanSmoother.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanSmoother.cxx
index 737b430ce80db326193bc046dc58aaff5af2db62..deff5779fe355fb6a5ce3dce991f4190eb86a5da 100755
--- a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanSmoother.cxx
+++ b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanSmoother.cxx
@@ -305,13 +305,15 @@ Trk::FitterStatusCode Trk::KalmanSmoother::fit(Trk::Trajectory&              tra
 
       // now propagate updated TrkParameters to surface of ROT
       if (!m_useExEngine)
-        predPar.reset(  m_extrapolator->extrapolate(ctx,
-                                                    *updatedPar, sf,
-                                                    Trk::oppositeMomentum, // reverse filtering
-                                                    false,                 // no boundary check
-                                                    kalMec.particleType()) );
+        predPar = m_extrapolator->extrapolate(
+          ctx,
+          *updatedPar,
+          sf,
+          Trk::oppositeMomentum, // reverse filtering
+          false,                 // no boundary check
+          kalMec.particleType());
       else {
-	ATH_MSG_DEBUG ("Smoother Kalman Fitter --> starting extrapolation engine");
+        ATH_MSG_DEBUG ("Smoother Kalman Fitter --> starting extrapolation engine");
 	Trk::ExtrapolationCell <Trk::TrackParameters> ecc(*updatedPar, Trk::oppositeMomentum);
 	ecc.setParticleHypothesis(kalMec.particleType());
 	Trk::ExtrapolationCode eCode =  m_extrapolationEngine->extrapolate(ecc, &sf, false);
diff --git a/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx b/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx
index ad0afdcf280539e7e0521074500093ce9c36788c..340b280c1146438e0866c3d644b8d5a9700c1c89 100755
--- a/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx
+++ b/Tracking/TrkFitter/TrkiPatFitter/src/MaterialAllocator.cxx
@@ -2082,11 +2082,12 @@ namespace Trk
                                                                              *innerMeasurement,
                                                                              false));
       if (!innerParameters) innerParameters.reset(startParameters.clone());
-      entranceParameters.reset( m_extrapolator->extrapolateToVolume(ctx,
-                                                                    *innerParameters,
-                                                                    *spectrometerEntrance,
-                                                                    anyDirection,
-                                                                    Trk::nonInteracting));
+      entranceParameters =
+        m_extrapolator->extrapolateToVolume(ctx,
+                                            *innerParameters,
+                                            *spectrometerEntrance,
+                                            anyDirection,
+                                            Trk::nonInteracting);
       if (entranceParameters) {
         startDirection = entranceParameters->momentum().unit();
         startPosition = entranceParameters->position();
@@ -2126,13 +2127,14 @@ namespace Trk
    if (endParameters.get() == outerParameters.get()) throw std::logic_error("Extrapolator returned input parameters.");
 
    if (!endParameters) {
-     endParameters.reset(m_extrapolator->extrapolate(ctx,
-                                                     *outerParameters,
-                                                     endSurface,
-                                                     anyDirection,
-                                                     false,
-                                                     Trk::nonInteracting));
-     if (endParameters.get() == outerParameters.get()) throw std::logic_error("Extrapolator returned input parameters.");
+     endParameters = m_extrapolator->extrapolate(ctx,
+                                                 *outerParameters,
+                                                 endSurface,
+                                                 anyDirection,
+                                                 false,
+                                                 Trk::nonInteracting);
+     if (endParameters.get() == outerParameters.get())
+       throw std::logic_error("Extrapolator returned input parameters.");
 
      if (!endParameters) {
         // failed extrapolation
diff --git a/Tracking/TrkG4Components/TrkG4UserActions/src/GeantFollowerHelper.cxx b/Tracking/TrkG4Components/TrkG4UserActions/src/GeantFollowerHelper.cxx
index 8905bffde4f89fd47178efe4157462e5ea454f4f..faccfd07992d6a437f8d301fbc185ab13786c96b 100644
--- a/Tracking/TrkG4Components/TrkG4UserActions/src/GeantFollowerHelper.cxx
+++ b/Tracking/TrkG4Components/TrkG4UserActions/src/GeantFollowerHelper.cxx
@@ -48,7 +48,7 @@ Trk::GeantFollowerHelper::~GeantFollowerHelper()
 StatusCode Trk::GeantFollowerHelper::initialize()
 {
   m_treeData = std::make_unique<TreeData>();
-  
+
   if (m_extrapolator.retrieve().isFailure()){
     ATH_MSG_ERROR("Could not retrieve Extrapolator " << m_extrapolator << " . Abort.");
     return StatusCode::FAILURE;
@@ -172,11 +172,11 @@ void Trk::GeantFollowerHelper::trackParticle(const G4ThreeVector& pos,
     m_extrapolator->extrapolateDirectly(ctx,
                                         *m_parameterCache,
                                         destinationSurface,
-                                        Trk::alongMomentum,false) :
+                                        Trk::alongMomentum,false).release() :
     m_extrapolator->extrapolate(ctx,
                                 *m_parameterCache,
                                 destinationSurface,
-                                Trk::alongMomentum,false);
+                                Trk::alongMomentum,false).release();
   // fill the geant information and the trk information
   m_treeData->m_g4_p[m_treeData->m_g4_steps]       =  mom.mag();
   m_treeData->m_g4_eta[m_treeData->m_g4_steps]     =  mom.eta();
diff --git a/Tracking/TrkG4Components/TrkG4UserActions/src/GeantFollowerMSHelper.cxx b/Tracking/TrkG4Components/TrkG4UserActions/src/GeantFollowerMSHelper.cxx
index c68a5ac52b242eec49ddc20a4da3d307b01a5fe3..5bbe7ed44bcfec93bf734c9386b7473f325b78a3 100644
--- a/Tracking/TrkG4Components/TrkG4UserActions/src/GeantFollowerMSHelper.cxx
+++ b/Tracking/TrkG4Components/TrkG4UserActions/src/GeantFollowerMSHelper.cxx
@@ -276,9 +276,9 @@ void Trk::GeantFollowerMSHelper::trackParticle(const G4ThreeVector& pos, const G
 
     bool useMuonEntry = true;
 // Stop in ID temp
-//    if(useMuonEntry&&!m_crossedMuonEntry&&(fabs(npos.z())>2744||npos.perp()>1106)) {
+//    if(useMuonEntry&&!m_crossedMuonEntry&&(std::fabs(npos.z())>2744||npos.perp()>1106)) {
 // Muon Entry
-    if(useMuonEntry&&!m_crossedMuonEntry&&(fabs(npos.z())>zMuonEntry||npos.perp()>4254)) {
+    if(useMuonEntry&&!m_crossedMuonEntry&&(std::fabs(npos.z())>zMuonEntry||npos.perp()>4254)) {
         m_treeData->m_m_x        = npos.x();
         m_treeData->m_m_y        = npos.y();
         m_treeData->m_m_z        = npos.z();
@@ -329,8 +329,8 @@ void Trk::GeantFollowerMSHelper::trackParticle(const G4ThreeVector& pos, const G
     if(m_speedup) {
       bool crossedExitLayer = false;
 // ID envelop
-//      if(fabs(npos.z())>zMuonEntry||npos.perp()>4255) crossedExitLayer = true;
-      if(fabs(npos.z())>21800||npos.perp()>12500) crossedExitLayer = true;
+//      if(std::fabs(npos.z())>zMuonEntry||npos.perp()>4255) crossedExitLayer = true;
+      if(std::fabs(npos.z())>21800||npos.perp()>12500) crossedExitLayer = true;
       if(m_crossedMuonEntry&&m_treeData->m_g4_steps>=2&&!crossedExitLayer) return;
       if(m_treeData->m_g4_steps>2) return;
       if(m_treeData->m_g4_steps>4) return;
@@ -346,28 +346,55 @@ void Trk::GeantFollowerMSHelper::trackParticle(const G4ThreeVector& pos, const G
     // destination surface
     const Trk::PlaneSurface& destinationSurface = g4Parameters->associatedSurface();
     // extrapolate to the destination surface
-    const Trk::TrackParameters* trkParameters = m_extrapolateDirectly&&m_crossedMuonEntry ?
-        m_extrapolator->extrapolateDirectly(ctx,*m_parameterCache,destinationSurface,Trk::alongMomentum,false,Trk::muon) :
-        m_extrapolator->extrapolate(ctx,*m_parameterCache,destinationSurface,Trk::alongMomentum,false,Trk::muon);
-    if(m_treeData->m_g4_stepsMS==0) {
-        ATH_MSG_DEBUG( " Extrapolate m_parameterCacheCov with covMatrix ");
-        extrapolationCache->reset();
-        trkParameters = m_extrapolateDirectly&&m_crossedMuonEntry ?
-        m_extrapolator->extrapolateDirectly(ctx,*m_parameterCacheCov,destinationSurface,Trk::alongMomentum,false,Trk::muon) :
-        m_extrapolator->extrapolate(ctx,*m_parameterCacheCov,destinationSurface,Trk::alongMomentum,false,Trk::muon,Trk::addNoise,extrapolationCache);
-
-        ATH_MSG_DEBUG(
-          " G4 extrapolate to Muon Entry system "
-          << " X0 " << extrapolationCache->x0tot() << " Eloss deltaE "
-          << extrapolationCache->eloss()->deltaE() << " Eloss sigma "
-          << extrapolationCache->eloss()->sigmaDeltaE() << " meanIoni "
-          << extrapolationCache->eloss()->meanIoni() << " sigmaIoni "
-          << extrapolationCache->eloss()->sigmaIoni() << " meanRad "
-          << extrapolationCache->eloss()->meanRad() << " sigmaRad "
-          << extrapolationCache->eloss()->sigmaRad() << " depth "
-          << extrapolationCache->eloss()->length());
-
-        ATH_MSG_DEBUG( " Extrapolation OK ");
+    const Trk::TrackParameters* trkParameters =
+      m_extrapolateDirectly && m_crossedMuonEntry
+        ? m_extrapolator
+            ->extrapolateDirectly(ctx,
+                                  *m_parameterCache,
+                                  destinationSurface,
+                                  Trk::alongMomentum,
+                                  false,
+                                  Trk::muon)
+            .release()
+        : m_extrapolator
+            ->extrapolate(ctx,
+                          *m_parameterCache,
+                          destinationSurface,
+                          Trk::alongMomentum,
+                          false,
+                          Trk::muon)
+            .release();
+    if (m_treeData->m_g4_stepsMS == 0) {
+      ATH_MSG_DEBUG(" Extrapolate m_parameterCacheCov with covMatrix ");
+      extrapolationCache->reset();
+      trkParameters =
+        m_extrapolateDirectly && m_crossedMuonEntry
+          ? m_extrapolator->extrapolateDirectly(ctx,
+                                                *m_parameterCacheCov,
+                                                destinationSurface,
+                                                Trk::alongMomentum,
+                                                false,
+                                                Trk::muon).release()
+          : m_extrapolator->extrapolate(ctx,
+                                        *m_parameterCacheCov,
+                                        destinationSurface,
+                                        Trk::alongMomentum,
+                                        false,
+                                        Trk::muon,
+                                        Trk::addNoise,
+                                        extrapolationCache).release();
+
+      ATH_MSG_DEBUG(" G4 extrapolate to Muon Entry system "
+                    << " X0 " << extrapolationCache->x0tot() << " Eloss deltaE "
+                    << extrapolationCache->eloss()->deltaE() << " Eloss sigma "
+                    << extrapolationCache->eloss()->sigmaDeltaE()
+                    << " meanIoni " << extrapolationCache->eloss()->meanIoni()
+                    << " sigmaIoni " << extrapolationCache->eloss()->sigmaIoni()
+                    << " meanRad " << extrapolationCache->eloss()->meanRad()
+                    << " sigmaRad " << extrapolationCache->eloss()->sigmaRad()
+                    << " depth " << extrapolationCache->eloss()->length());
+
+      ATH_MSG_DEBUG(" Extrapolation OK ");
     }
 
     //sroe: coverity 31530
@@ -383,85 +410,144 @@ void Trk::GeantFollowerMSHelper::trackParticle(const G4ThreeVector& pos, const G
 // Max radius 13400 maxZ 26050
 //
 // ID exit and MS entry
-//    if(!m_exitLayer&&(fabs(npos.z())>zMuonEntry||npos.perp()>4255)&&trkParameters) {
-    if(!m_exitLayer&&(fabs(npos.z())>21800||npos.perp()>12500)&&trkParameters) {
+//    if(!m_exitLayer&&(std::fabs(npos.z())>zMuonEntry||npos.perp()>4255)&&trkParameters) {
+    if(!m_exitLayer&&(std::fabs(npos.z())>21800||npos.perp()>12500)&&trkParameters) {
       ATH_MSG_DEBUG (" exit layer found ");
       m_treeData->m_trk_status[m_treeData->m_g4_steps] =  1000;
 // Get extrapolatio with errors
       extrapolationCache->reset();
-      trkParameters = m_extrapolateDirectly&&m_crossedMuonEntry ?
-      m_extrapolator->extrapolateDirectly(ctx,*m_parameterCacheMSCov,destinationSurface,Trk::alongMomentum,false,Trk::muon) :
-      m_extrapolator->extrapolate(ctx,*m_parameterCacheMSCov,destinationSurface,Trk::alongMomentum,false,Trk::muon,Trk::addNoise,extrapolationCache);
-// Forward from ME to Exit
-      const Trk::TrackParameters* trkParameters_FW = m_extrapolateDirectly ?
-        m_extrapolator->extrapolateDirectly(ctx,*m_parameterCacheMS,destinationSurface,Trk::alongMomentum,false,Trk::muon) :
-        m_extrapolator->extrapolate(ctx,*m_parameterCacheMS,destinationSurface,Trk::alongMomentum,false,Trk::muon);
-// Backwards from Exit to ME
+      trkParameters = m_extrapolateDirectly && m_crossedMuonEntry
+                        ? m_extrapolator
+                            ->extrapolateDirectly(ctx,
+                                                  *m_parameterCacheMSCov,
+                                                  destinationSurface,
+                                                  Trk::alongMomentum,
+                                                  false,
+                                                  Trk::muon)
+                            .release()
+                        : m_extrapolator
+                            ->extrapolate(ctx,
+                                          *m_parameterCacheMSCov,
+                                          destinationSurface,
+                                          Trk::alongMomentum,
+                                          false,
+                                          Trk::muon,
+                                          Trk::addNoise,
+                                          extrapolationCache)
+                            .release();
+      // Forward from ME to Exit
+      const Trk::TrackParameters* trkParameters_FW =
+        m_extrapolateDirectly ? m_extrapolator
+                                  ->extrapolateDirectly(ctx,
+                                                        *m_parameterCacheMS,
+                                                        destinationSurface,
+                                                        Trk::alongMomentum,
+                                                        false,
+                                                        Trk::muon)
+                                  .release()
+                              : m_extrapolator
+                                  ->extrapolate(ctx,
+                                                *m_parameterCacheMS,
+                                                destinationSurface,
+                                                Trk::alongMomentum,
+                                                false,
+                                                Trk::muon)
+                                  .release();
+      // Backwards from Exit to ME
       if(trkParameters_FW) {
        ATH_MSG_DEBUG (" forward extrapolation succeeded ");
        bool doBackWard = false;
        if(doBackWard) {
-        const Trk::TrackParameters* trkParameters_BACK = m_extrapolateDirectly ?
-          m_extrapolator->extrapolateDirectly(ctx,*trkParameters_FW,*m_destinationSurface,Trk::oppositeMomentum,false,Trk::muon) :
-          m_extrapolator->extrapolate(ctx,*trkParameters_FW,*m_destinationSurface,Trk::oppositeMomentum,false,Trk::muon);
-//        if(m_usePropagator) {
-//          std::cout << " Use Propagator " << std::endl;
-//          trkParameters_BACK = m_propagator->propagate(*trkParameters,*m_destinationSurface,Trk::oppositeMomentum,false,*m_magFieldProperties);
-//          if(trkParameters_BACK) std::cout << " Use Propagator theta " << trkParameters_BACK->momentum().theta() << " init theta " <<  m_t_theta << std::endl;
-//        }
-        if(trkParameters_BACK) {
-          ATH_MSG_DEBUG (" back extrapolation succeeded ");
-          m_exitLayer = true;
-          m_treeData->m_b_p      =  trkParameters_BACK->momentum().mag();
-          m_treeData->m_b_eta    =  trkParameters_BACK->momentum().eta();
-          m_treeData->m_b_theta  =  trkParameters_BACK->momentum().theta();
-          m_treeData->m_b_phi    =  trkParameters_BACK->momentum().phi();
-          m_treeData->m_b_x      =  trkParameters_BACK->position().x();
-          m_treeData->m_b_y      =  trkParameters_BACK->position().y();
-          m_treeData->m_b_z      =  trkParameters_BACK->position().z();
-          if(fabs(m_treeData->m_m_p-m_treeData->m_b_p)>10.) ATH_MSG_DEBUG (" Back extrapolation to Muon Entry finds different momentum  difference MeV " << m_treeData->m_m_p-m_treeData->m_b_p);
-          delete trkParameters_BACK;
-          extrapolationCache->reset();
-          const std::vector<const Trk::TrackStateOnSurface*> *matvec_BACK = m_extrapolator->extrapolateM(ctx,
-                                                                                                         *trkParameters_FW,
-                                                                                                         *m_destinationSurface,
-                                                                                                         Trk::oppositeMomentum,
-                                                                                                         false,Trk::muon,extrapolationCache);
-          double Eloss = 0.;
-          double x0 = 0.;
-
-          int mmat = 0;
-          if (matvec_BACK && !matvec_BACK->empty()&& matvec_BACK->size()>0){
-            std::vector<const Trk::TrackStateOnSurface*>::const_iterator it = matvec_BACK->begin();
-            std::vector<const Trk::TrackStateOnSurface*>::const_iterator it_end = matvec_BACK->end();
-            for ( ; it != it_end; ++it ) {
-              const Trk::MaterialEffectsBase* matEf = (*it)->materialEffectsOnTrack();
-              if( matEf ) {
-                mmat++;
-                if(m_treeData->m_trk_status[m_treeData->m_g4_steps] == 1000) ATH_MSG_DEBUG (" mmat " << mmat << " matEf->thicknessInX0() " << matEf->thicknessInX0() );
-                x0 += matEf->thicknessInX0();
-                const Trk::MaterialEffectsOnTrack* matEfs = dynamic_cast<const Trk::MaterialEffectsOnTrack*>(matEf);
-                double eloss0 = 0.;
-                double meanIoni = 0.;
-                double sigmaIoni = 0.;
-                double meanRad = 0.;
-                double sigmaRad = 0.;
-                double sigmaTheta = 0.;
-                double sigmaPhi = 0.;
-                if(matEfs) {
-                  const Trk::EnergyLoss* eLoss = (matEfs)->energyLoss();
-                  if(eLoss) {
-                    Eloss += eLoss->deltaE();
-                    eloss0 = eLoss->deltaE();
-                    meanIoni = eLoss->meanIoni();
-                    sigmaIoni = eLoss->sigmaIoni();
-                    meanRad = eLoss->meanRad();
-                    sigmaRad = eLoss->sigmaRad();
-                    if(m_treeData->m_trk_status[m_treeData->m_g4_steps] == 1000) ATH_MSG_DEBUG ( " mmat " << mmat << " eLoss->deltaE() "  << eLoss->deltaE() << "  eLoss->length() " << eLoss->length() );
-                  }
-                }
-                const Trk::ScatteringAngles* scatAng = (matEfs)->scatteringAngles();
-                if(scatAng) {
+         const Trk::TrackParameters* trkParameters_BACK =
+           m_extrapolateDirectly
+             ? m_extrapolator
+                 ->extrapolateDirectly(ctx,
+                                       *trkParameters_FW,
+                                       *m_destinationSurface,
+                                       Trk::oppositeMomentum,
+                                       false,
+                                       Trk::muon)
+                 .release()
+             : m_extrapolator
+                 ->extrapolate(ctx,
+                               *trkParameters_FW,
+                               *m_destinationSurface,
+                               Trk::oppositeMomentum,
+                               false,
+                               Trk::muon)
+                 .release();
+         if (trkParameters_BACK) {
+           ATH_MSG_DEBUG(" back extrapolation succeeded ");
+           m_exitLayer = true;
+           m_treeData->m_b_p = trkParameters_BACK->momentum().mag();
+           m_treeData->m_b_eta = trkParameters_BACK->momentum().eta();
+           m_treeData->m_b_theta = trkParameters_BACK->momentum().theta();
+           m_treeData->m_b_phi = trkParameters_BACK->momentum().phi();
+           m_treeData->m_b_x = trkParameters_BACK->position().x();
+           m_treeData->m_b_y = trkParameters_BACK->position().y();
+           m_treeData->m_b_z = trkParameters_BACK->position().z();
+           if (std::fabs(m_treeData->m_m_p - m_treeData->m_b_p) > 10.)
+             ATH_MSG_DEBUG(" Back extrapolation to Muon Entry finds different "
+                           "momentum  difference MeV "
+                           << m_treeData->m_m_p - m_treeData->m_b_p);
+           delete trkParameters_BACK;
+           extrapolationCache->reset();
+           const std::vector<const Trk::TrackStateOnSurface*>* matvec_BACK =
+             m_extrapolator->extrapolateM(ctx,
+                                          *trkParameters_FW,
+                                          *m_destinationSurface,
+                                          Trk::oppositeMomentum,
+                                          false,
+                                          Trk::muon,
+                                          extrapolationCache);
+           double Eloss = 0.;
+           double x0 = 0.;
+
+           int mmat = 0;
+           if (matvec_BACK && !matvec_BACK->empty() &&
+               matvec_BACK->size() > 0) {
+             std::vector<const Trk::TrackStateOnSurface*>::const_iterator it =
+               matvec_BACK->begin();
+             std::vector<const Trk::TrackStateOnSurface*>::const_iterator
+               it_end = matvec_BACK->end();
+             for (; it != it_end; ++it) {
+               const Trk::MaterialEffectsBase* matEf =
+                 (*it)->materialEffectsOnTrack();
+               if (matEf) {
+                 mmat++;
+                 if (m_treeData->m_trk_status[m_treeData->m_g4_steps] == 1000)
+                   ATH_MSG_DEBUG(" mmat " << mmat << " matEf->thicknessInX0() "
+                                          << matEf->thicknessInX0());
+                 x0 += matEf->thicknessInX0();
+                 const Trk::MaterialEffectsOnTrack* matEfs =
+                   dynamic_cast<const Trk::MaterialEffectsOnTrack*>(matEf);
+                 double eloss0 = 0.;
+                 double meanIoni = 0.;
+                 double sigmaIoni = 0.;
+                 double meanRad = 0.;
+                 double sigmaRad = 0.;
+                 double sigmaTheta = 0.;
+                 double sigmaPhi = 0.;
+                 if (matEfs) {
+                   const Trk::EnergyLoss* eLoss = (matEfs)->energyLoss();
+                   if (eLoss) {
+                     Eloss += eLoss->deltaE();
+                     eloss0 = eLoss->deltaE();
+                     meanIoni = eLoss->meanIoni();
+                     sigmaIoni = eLoss->sigmaIoni();
+                     meanRad = eLoss->meanRad();
+                     sigmaRad = eLoss->sigmaRad();
+                     if (m_treeData->m_trk_status[m_treeData->m_g4_steps] ==
+                         1000)
+                       ATH_MSG_DEBUG(" mmat " << mmat << " eLoss->deltaE() "
+                                              << eLoss->deltaE()
+                                              << "  eLoss->length() "
+                                              << eLoss->length());
+                   }
+                 }
+                 const Trk::ScatteringAngles* scatAng =
+                   (matEfs)->scatteringAngles();
+                 if (scatAng) {
                    sigmaTheta = scatAng->sigmaDeltaTheta();
                    sigmaPhi = scatAng->sigmaDeltaPhi();
                 }
@@ -497,12 +583,24 @@ void Trk::GeantFollowerMSHelper::trackParticle(const G4ThreeVector& pos, const G
 
     extrapolationCache->reset();
     const std::vector<const Trk::TrackStateOnSurface*> *matvec = m_extrapolator->extrapolateM(ctx,*m_parameterCache,destinationSurface,Trk::alongMomentum,false,Trk::muon,extrapolationCache);
-    if(m_treeData->m_g4_stepsMS==0) matvec = m_extrapolator->extrapolateM(ctx,*m_parameterCacheCov,destinationSurface,Trk::alongMomentum,false,Trk::muon,extrapolationCache);
-
-    if(m_treeData->m_g4_stepsMS==0) ATH_MSG_DEBUG(" G4 extrapolateM to Muon Entry " << " X0 " << extrapolationCache->x0tot() << " Eloss deltaE " <<   extrapolationCache->eloss()->deltaE()  << " Eloss sigma " << extrapolationCache->eloss()->sigmaDeltaE() << " meanIoni " << extrapolationCache->eloss()->meanIoni()  << " sigmaIoni " << extrapolationCache->eloss()->sigmaIoni() << " meanRad " <<  extrapolationCache->eloss()->meanRad() << " sigmaRad " << extrapolationCache->eloss()->sigmaRad());
-//    if(m_treeData->m_trk_status[m_treeData->m_g4_steps] == 1000) matvec = m_extrapolator->extrapolateM(*m_parameterCache,destinationSurface,Trk::alongMomentum,false,Trk::muon);
-
-//      modifyTSOSvector(const std::vector<const Trk::TrackStateOnSurface*> matvec, double scaleX0, double scaleEloss, bool reposition, bool aggregate, bool updateEloss, double caloEnergy, double caloEnergyError, double pCaloEntry, double momentumError, double & Eloss_tot);
+    if (m_treeData->m_g4_stepsMS == 0)
+      matvec = m_extrapolator->extrapolateM(ctx,
+                                            *m_parameterCacheCov,
+                                            destinationSurface,
+                                            Trk::alongMomentum,
+                                            false,
+                                            Trk::muon,
+                                            extrapolationCache);
+
+    if (m_treeData->m_g4_stepsMS == 0)
+      ATH_MSG_DEBUG(" G4 extrapolateM to Muon Entry "
+                    << " X0 " << extrapolationCache->x0tot() << " Eloss deltaE "
+                    << extrapolationCache->eloss()->deltaE() << " Eloss sigma "
+                    << extrapolationCache->eloss()->sigmaDeltaE()
+                    << " meanIoni " << extrapolationCache->eloss()->meanIoni()
+                    << " sigmaIoni " << extrapolationCache->eloss()->sigmaIoni()
+                    << " meanRad " << extrapolationCache->eloss()->meanRad()
+                    << " sigmaRad " << extrapolationCache->eloss()->sigmaRad());
     double Elosst = 0.;
     const std::vector<const Trk::TrackStateOnSurface*>  matvecNewRepAggrUp = modifyTSOSvector(*matvec, 1.0, 1.0, true, true, true, 0., 0., 10000., 0., Elosst);
 
@@ -549,7 +647,7 @@ void Trk::GeantFollowerMSHelper::trackParticle(const G4ThreeVector& pos, const G
       ATH_MSG_DEBUG ( " calorimeter scales X0 " << X0Scale << " ElossScale " << ElossScale);
       const std::vector<const Trk::TrackStateOnSurface*>  matvecNew1 = modifyTSOSvector(*matvec, X0Scale , 1., true, true, true, 0., 0., m_treeData->m_m_p, 0., Eloss1);
       const std::vector<const Trk::TrackStateOnSurface*>  matvecNew0 = modifyTSOSvector(*matvec, X0Scale , ElossScale, true, true, true, 0., 0., m_treeData->m_t_p, 0., Eloss0);
-      if(fabs(Eloss1)>0) ATH_MSG_DEBUG ( " **** Cross Check calorimeter with Eloss Scale1 " <<  Eloss1 << " Eloss0 " << Eloss0 << " ratio " << Eloss0/Eloss1 );
+      if(std::fabs(Eloss1)>0) ATH_MSG_DEBUG ( " **** Cross Check calorimeter with Eloss Scale1 " <<  Eloss1 << " Eloss0 " << Eloss0 << " ratio " << Eloss0/Eloss1 );
 
       ATH_MSG_DEBUG ( " calorimeter modify with 5 percent ");
       const std::vector<const Trk::TrackStateOnSurface*>  matvecNew5 = modifyTSOSvector(*matvec, X0Scale , ElossScale, true, true, true, 0., 0., m_treeData->m_t_p, 0.05*m_treeData->m_m_p, Eloss5);
@@ -894,7 +992,7 @@ const std::vector<const Trk::TrackStateOnSurface*> Trk::GeantFollowerMSHelper::m
                          depth);
         const Trk::Surface& surf = *(meot->associatedSurface().clone());
         auto meotLast = std::make_unique<Trk::MaterialEffectsOnTrack>(
-            X0_tot, std::move(scatNew), energyLossNew, surf, meotPattern);
+            X0_tot, scatNew, energyLossNew, surf, meotPattern);
         auto pars = m->trackParameters()->uniqueClone();
 
         // make new TSOS
@@ -936,7 +1034,7 @@ const std::vector<const Trk::TrackStateOnSurface*> Trk::GeantFollowerMSHelper::m
           const Trk::Surface& surf = *(meot->associatedSurface().clone());
           const Trk::MaterialEffectsOnTrack* meotLast =
             new Trk::MaterialEffectsOnTrack(
-              X0_tot, std::move(scatNew), energyLossNew, surf, meotPattern);
+              X0_tot, scatNew, energyLossNew, surf, meotPattern);
           const Trk::TrackParameters* pars = m->trackParameters()->clone();
           //        make new TSOS
           const Trk::TrackStateOnSurface* newTSOS = new Trk::TrackStateOnSurface( nullptr, pars, nullptr, meotLast, typePattern );
@@ -996,15 +1094,15 @@ const std::vector<const Trk::TrackStateOnSurface*> Trk::GeantFollowerMSHelper::m
 //        make MaterialEffectsOnTracks
           auto meotFirst =
             std::make_unique<const Trk::MaterialEffectsOnTrack>(
-              X0_tot / 2., std::move(scatFirst), energyLoss0, *surfFirst, meotPattern);
+              X0_tot / 2., scatFirst, energyLoss0, *surfFirst, meotPattern);
           auto meotLast =
             std::make_unique<const Trk::MaterialEffectsOnTrack>(
-              X0_tot / 2., std::move(scatNew), energyLossNew, *surfLast, meotPattern);
+              X0_tot / 2., scatNew, energyLossNew, *surfLast, meotPattern);
 
           //        calculate TrackParameters at first surface
           double qOverP0 = m->trackParameters()->charge() /
                            (m->trackParameters()->momentum().mag() -
-                            fabs(energyLoss->deltaE()));
+                            std::fabs(energyLoss->deltaE()));
           if (mprevious)
             qOverP0 = mprevious->trackParameters()->charge() /
                       mprevious->trackParameters()->momentum().mag();
@@ -1059,7 +1157,7 @@ const std::vector<const Trk::TrackStateOnSurface*> Trk::GeantFollowerMSHelper::m
 //
           Amg::Vector3D pos = wpos/w_tot;
           bool threePlanes = false;
-          if(X0_tot>50&&fabs(pos.z())<6700&&pos.perp()<4200) threePlanes = true;
+          if(X0_tot>50&&std::fabs(pos.z())<6700&&pos.perp()<4200) threePlanes = true;
 //
           const Trk::EnergyLoss* energyLoss0 = new EnergyLoss(0.,0.,0.,0.);
           auto scatFirst = ScatteringAngles(deltaPhi,deltaTheta,sqrt(sigmaDeltaPhi2_tot/2.),sqrt(sigmaDeltaTheta2_tot/2.));
@@ -1133,7 +1231,7 @@ const std::vector<const Trk::TrackStateOnSurface*> Trk::GeantFollowerMSHelper::m
           Trk::PlaneSurface* surfLast =
             new Trk::PlaneSurface(surfaceTransformLast);
           //        calculate TrackParameters at first surface
-          double qOverP0 = mfirst->trackParameters()->charge()/(mfirst->trackParameters()->momentum().mag()+fabs(deltaEFirst));
+          double qOverP0 = mfirst->trackParameters()->charge()/(mfirst->trackParameters()->momentum().mag()+std::fabs(deltaEFirst));
 //        calculate TrackParameters at last surface
           double qOverPNew = mlast->trackParameters()->charge()/mlast->trackParameters()->momentum().mag();
           std::unique_ptr<Trk::TrackParameters> parsFirst =
@@ -1151,13 +1249,13 @@ const std::vector<const Trk::TrackStateOnSurface*> Trk::GeantFollowerMSHelper::m
             //          Eloss = 0 and scattering2 = total2 / 2. depth = 0
             auto meotFirst =
               std::make_unique<const Trk::MaterialEffectsOnTrack>(
-                X0_tot / 2., std::move(scatFirst), energyLoss0, *surfFirst, meotPattern);
+                X0_tot / 2., scatFirst, energyLoss0, *surfFirst, meotPattern);
             //          prepare for second MaterialEffectsOnTrack with X0 = X0/2
             //          Eloss = Eloss total and scattering2 = total2 / 2. depth
             //          = 0
             auto meotLast =
               std::make_unique<const Trk::MaterialEffectsOnTrack>(
-                X0_tot / 2., std::move(scatNew), energyLossNew, *surfLast, meotPattern);
+                X0_tot / 2., scatNew, energyLossNew, *surfLast, meotPattern);
             //
             //
             const Trk::TrackStateOnSurface* newTSOSFirst =
@@ -1190,12 +1288,12 @@ const std::vector<const Trk::TrackStateOnSurface*> Trk::GeantFollowerMSHelper::m
             //        Eloss = ElossNew and scattering2 = 0. depth = 0
             auto meot =
               std::make_unique<const Trk::MaterialEffectsOnTrack>(
-                0., std::move(scatZero), energyLossNew, *surf, meotPattern);
+                0., scatZero, energyLossNew, *surf, meotPattern);
             //        prepare for last MaterialEffectsOnTrack with X0 =  X0/2
             //        Eloss = 0 total and scattering2 = total2 / 2. depth = 0
             auto meotLast =
               std::make_unique<const Trk::MaterialEffectsOnTrack>(
-                X0_tot / 2., std::move(scatNew), energyLoss0, *surfLast, meotPattern);
+                X0_tot / 2., scatNew, energyLoss0, *surfLast, meotPattern);
             const Trk::TrackStateOnSurface* newTSOSFirst =
               new Trk::TrackStateOnSurface(
                 nullptr, std::move(parsFirst), nullptr, std::move(meotFirst), typePattern);
diff --git a/Tracking/TrkTools/TrkTruthToTrack/src/TruthToTrack.cxx b/Tracking/TrkTools/TrkTruthToTrack/src/TruthToTrack.cxx
index 7449fc5ec5247ce2e35ef9d245363ffe0a9ebe4d..0d4c26c0068c40afcc5962fda00d17cbb56794fe 100755
--- a/Tracking/TrkTools/TrkTruthToTrack/src/TruthToTrack.cxx
+++ b/Tracking/TrkTools/TrkTruthToTrack/src/TruthToTrack.cxx
@@ -41,13 +41,13 @@ StatusCode Trk::TruthToTrack::initialize() {
   if (sc.isFailure()) {
     ATH_MSG_ERROR("Could not initialize Particle Properties Service");
     return StatusCode::FAILURE;
-  }      
+  }
   m_particleDataTable = partPropSvc->PDT();
 
   if ( m_extrapolator.retrieve().isFailure() ) {
     ATH_MSG_FATAL("Failed to retrieve tool " << m_extrapolator);
     return StatusCode::FAILURE;
-  } 
+  }
     ATH_MSG_INFO("Retrieved tool " << m_extrapolator);
   return StatusCode::SUCCESS;
 }
@@ -62,11 +62,11 @@ const Trk::TrackParameters* Trk::TruthToTrack::makeProdVertexParameters(HepMC::C
     HepMC::FourVector tv = part->production_vertex()->position();
     Amg::Vector3D hv(tv.x(),tv.y(),tv.z());
     const Amg::Vector3D& globalPos = hv;
-    
+
     const HepMC::FourVector& fv = part->momentum();
     Amg::Vector3D hv2(fv.px(),fv.py(),fv.pz());
     const Amg::Vector3D& globalMom = hv2;
-      
+
     int id = part->pdg_id();
     // the table seems to lack antiparticles, thus the use of abs()
     const HepPDT::ParticleData* pd = m_particleDataTable->particle(std::abs(id));
@@ -75,7 +75,7 @@ const Trk::TrackParameters* Trk::TruthToTrack::makeProdVertexParameters(HepMC::C
       // pd could point to an antiparticle. recover the sign:
       double charge = (id>0) ? pd->charge() : -pd->charge();
       Amg::Translation3D tmpTransl(hv);
-      Amg::Transform3D tmpTransf = tmpTransl * Amg::RotationMatrix3D::Identity(); 
+      Amg::Transform3D tmpTransf = tmpTransl * Amg::RotationMatrix3D::Identity();
       const Trk::PlaneSurface surface(tmpTransf);
       result = new Trk::AtaPlane(globalPos, globalMom, charge, surface);
     }
@@ -95,10 +95,10 @@ const Trk::TrackParameters* Trk::TruthToTrack::makeProdVertexParameters(const xA
   if(part && part->hasProdVtx() && m_particleDataTable) {
     Amg::Vector3D hv(part->prodVtx()->x(),part->prodVtx()->y(),part->prodVtx()->z());
     const Amg::Vector3D& globalPos = hv;
-    
+
     Amg::Vector3D hv2(part->p4().Px(),part->p4().Py(),part->p4().Pz());
     const Amg::Vector3D& globalMom = hv2;
-      
+
     int id = part->pdgId();
     // the table seems to lack antiparticles, thus the use of abs()
     const HepPDT::ParticleData* pd = m_particleDataTable->particle(std::abs(id));
@@ -107,7 +107,7 @@ const Trk::TrackParameters* Trk::TruthToTrack::makeProdVertexParameters(const xA
       // pd could point to an antiparticle. recover the sign:
       double charge = (id>0) ? pd->charge() : -pd->charge();
       Amg::Translation3D tmpTransl(hv);
-      Amg::Transform3D tmpTransf = tmpTransl * Amg::RotationMatrix3D::Identity(); 
+      Amg::Transform3D tmpTransf = tmpTransl * Amg::RotationMatrix3D::Identity();
       const Trk::PlaneSurface surface(tmpTransf);
       result = new Trk::AtaPlane(globalPos, globalMom, charge, surface);
     }
@@ -129,16 +129,16 @@ const Trk::TrackParameters* Trk::TruthToTrack::makePerigeeParameters(HepMC::Cons
 
     std::unique_ptr<const Trk::TrackParameters> productionVertexTrackParams( makeProdVertexParameters(part) );
     if(productionVertexTrackParams) {
-      
+
       // Extrapolate the TrackParameters object to the perigee. Direct extrapolation,
       // no material effects.
-      generatedTrackPerigee = m_extrapolator->extrapolateDirectly( 
+      generatedTrackPerigee = m_extrapolator->extrapolateDirectly(
         Gaudi::Hive::currentContext(),
         *productionVertexTrackParams,
         Trk::PerigeeSurface(),
         Trk::anyDirection,
         false,
-        Trk::nonInteracting );
+        Trk::nonInteracting ).release();
     }
   }
 
@@ -155,16 +155,16 @@ const Trk::TrackParameters* Trk::TruthToTrack::makePerigeeParameters(const xAOD:
 
     std::unique_ptr<const Trk::TrackParameters> productionVertexTrackParams( makeProdVertexParameters(part) );
     if(productionVertexTrackParams) {
-      
+
       // Extrapolate the TrackParameters object to the perigee. Direct extrapolation,
       // no material effects.
-      generatedTrackPerigee = m_extrapolator->extrapolateDirectly( 
+      generatedTrackPerigee = m_extrapolator->extrapolateDirectly(
         Gaudi::Hive::currentContext(),
         *productionVertexTrackParams,
         Trk::PerigeeSurface(),
         Trk::anyDirection,
         false,
-        Trk::nonInteracting );
+        Trk::nonInteracting ).release();
     }
   }
 
diff --git a/Tracking/TrkTools/TrkTruthToTrack/src/TruthTrackRecordToTrack.cxx b/Tracking/TrkTools/TrkTruthToTrack/src/TruthTrackRecordToTrack.cxx
index 71b20cd4780cb90cf60257f3ee05c9f05ec2ece6..3dcdfc12df66b82b781ed96633348ddc497382c1 100755
--- a/Tracking/TrkTools/TrkTruthToTrack/src/TruthTrackRecordToTrack.cxx
+++ b/Tracking/TrkTools/TrkTruthToTrack/src/TruthTrackRecordToTrack.cxx
@@ -24,7 +24,7 @@
 Trk::TruthTrackRecordToTrack::TruthTrackRecordToTrack(const std::string& type, const std::string& name,
                                             const IInterface* parent)
   : AthAlgTool(type,name,parent),
-    m_particleDataTable(nullptr), 
+    m_particleDataTable(nullptr),
     m_extrapolator("Trk::Extrapolator/AtlasExtrapolator")
 {
   declareInterface<ITruthToTrack>(this);
@@ -42,15 +42,15 @@ StatusCode Trk::TruthTrackRecordToTrack::initialize() {
   if (sc.isFailure()) {
     ATH_MSG_ERROR ("Could not initialize Particle Properties Service");
     return StatusCode::FAILURE;
-  }      
+  }
   m_particleDataTable = partPropSvc->PDT();
 
   if ( m_extrapolator.retrieve().isFailure() ) {
     ATH_MSG_FATAL ("Failed to retrieve tool " << m_extrapolator );
     return StatusCode::FAILURE;
-  } 
+  }
     ATH_MSG_INFO("Retrieved tool " << m_extrapolator);
-  
+
 
   ATH_CHECK( m_reccollkey.initialize() );
 
@@ -72,7 +72,7 @@ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makeProdVertexParamete
 
 
   SG::ReadHandle<TrackRecordCollection> recordCollection(m_reccollkey);
-      
+
   if (recordCollection.isValid()) {
     ATH_MSG_ERROR ("Could not get track record!");
     return nullptr;
@@ -82,7 +82,7 @@ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makeProdVertexParamete
   if (recordCollection->empty()) ATH_MSG_WARNING ("action required but record size is 0");
 
   for (TrackRecordCollection::const_iterator record = recordCollection->begin();  record != recordCollection->end();++record){
-          
+
     if ( (*record).GetBarCode() == HepMC::barcode(part) ) {
 
       id = (*record).GetPDGCode();
@@ -103,7 +103,7 @@ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makeProdVertexParamete
 
       ATH_MSG_DEBUG("found barcode " << HepMC::barcode(part) << " with pdg ID " <<
                     id << ", momentum " << hv2 << " production " << globalPos);
-      
+
 
     } // if barcodes match
   }   // loop over G4 records
@@ -114,7 +114,7 @@ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makeProdVertexParamete
     Amg::Translation3D prodSurfaceCentre( prodVertexVector.x(),
 					  prodVertexVector.y(),
 					  prodVertexVector.z() );
-      
+
     Amg::Transform3D tmpTransf =  prodSurfaceCentre *  Amg::RotationMatrix3D::Identity();
 
     Trk::PlaneSurface planeSurface(tmpTransf, 5., 5. );
@@ -142,7 +142,7 @@ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makeProdVertexParamete
   const HepPDT::ParticleData* pd = nullptr;
 
    SG::ReadHandle<TrackRecordCollection> recordCollection(m_reccollkey);
-      
+
   if (recordCollection.isValid()) {
     ATH_MSG_ERROR ("Could not get track record!");
     return nullptr;
@@ -153,7 +153,7 @@ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makeProdVertexParamete
   if (recordCollection->empty()) ATH_MSG_WARNING ("action required but record size is 0");
 
   for (TrackRecordCollection::const_iterator record = recordCollection->begin();  record != recordCollection->end();++record){
-          
+
     if ( (*record).GetBarCode() == part->barcode() ) {
 
       id = (*record).GetPDGCode();
@@ -174,7 +174,7 @@ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makeProdVertexParamete
 
       ATH_MSG_DEBUG("found barcode " << part->barcode() << " with pdg ID " <<
                     id << ", momentum " << hv2 << " production " << globalPos);
-      
+
 
     } // if barcodes match
   }   // loop over G4 records
@@ -185,7 +185,7 @@ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makeProdVertexParamete
     Amg::Translation3D prodSurfaceCentre( prodVertexVector.x(),
 					  prodVertexVector.y(),
 					  prodVertexVector.z() );
-      
+
     Amg::Transform3D tmpTransf =  prodSurfaceCentre *  Amg::RotationMatrix3D::Identity();
 
     Trk::PlaneSurface planeSurface(tmpTransf, 5., 5. );
@@ -204,12 +204,12 @@ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makePerigeeParameters(
   const Trk::TrackParameters* generatedTrackPerigee = nullptr;
 
   if(part && part->production_vertex() && m_particleDataTable && m_extrapolator) {
-    
+
     MsgStream log(msgSvc(), name());
-    
+
     std::unique_ptr<const Trk::TrackParameters> productionVertexTrackParams( makeProdVertexParameters(part) );
     if(productionVertexTrackParams) {
-      
+
       // Extrapolate the TrackParameters object to the perigee. Direct extrapolation,
       // no material effects.
       generatedTrackPerigee =
@@ -218,7 +218,7 @@ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makePerigeeParameters(
                                             Trk::PerigeeSurface(),
                                             Trk::anyDirection,
                                             false,
-                                            Trk::nonInteracting);
+                                            Trk::nonInteracting).release();
     }
   }
 
@@ -230,12 +230,12 @@ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makePerigeeParameters(
   const Trk::TrackParameters* generatedTrackPerigee = nullptr;
 
   if(part && part->hasProdVtx() && m_particleDataTable && m_extrapolator) {
-    
+
     MsgStream log(msgSvc(), name());
-    
+
     std::unique_ptr<const Trk::TrackParameters> productionVertexTrackParams( makeProdVertexParameters(part) );
     if(productionVertexTrackParams) {
-      
+
       // Extrapolate the TrackParameters object to the perigee. Direct extrapolation,
       // no material effects.
       generatedTrackPerigee =
@@ -244,7 +244,7 @@ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makePerigeeParameters(
                                             Trk::PerigeeSurface(),
                                             Trk::anyDirection,
                                             false,
-                                            Trk::nonInteracting);
+                                            Trk::nonInteracting).release();
     }
   }
 
diff --git a/Tracking/TrkValidation/TrkValTools/src/PerigeeParametersNtupleTool.cxx b/Tracking/TrkValidation/TrkValTools/src/PerigeeParametersNtupleTool.cxx
index 93922a5756ba29f3ed704291feb281c92a9ea1f0..abe72dca048b070741577df6d8fa8d50ee3d8f66 100644
--- a/Tracking/TrkValidation/TrkValTools/src/PerigeeParametersNtupleTool.cxx
+++ b/Tracking/TrkValidation/TrkValTools/src/PerigeeParametersNtupleTool.cxx
@@ -181,8 +181,11 @@ StatusCode Trk::PerigeeParametersNtupleTool::fillTrackData (
         !m_extrapolator.empty() ) {
       ATH_MSG_VERBOSE ("try extrapolate SiSPSeeded track to perigee");
       const Trk::PerigeeSurface perSurf;
-      perpars = dynamic_cast<const Trk::Perigee *>
-        (m_extrapolator->extrapolate(ctx, track, perSurf, Trk::anyDirection, false, Trk::nonInteracting));
+      std::unique_ptr<const Trk::TrackParameters> tmp = m_extrapolator->extrapolate(
+        ctx, track, perSurf, Trk::anyDirection, false, Trk::nonInteracting);
+      if (tmp && tmp->associatedSurface().type() == Trk::SurfaceType::Perigee) {
+        perpars = static_cast<const Trk::Perigee *> (tmp.release());
+      }
       if (perpars != nullptr && fillTrackPerigee(perpars).isFailure()) {
         msg(MSG::WARNING) << "Newly made perigee parameters could not be "
                           << "written to ntuple" << endmsg;
@@ -242,7 +245,7 @@ StatusCode Trk::PerigeeParametersNtupleTool::fillProtoTrajectoryData
     if (nearestParam!=nullptr) {
       const Trk::PerigeeSurface   perSurf;
       const Trk::Perigee* perpars = dynamic_cast<const Trk::Perigee *>
-        (m_extrapolator->extrapolate(ctx,*nearestParam, perSurf, Trk::anyDirection, false, Trk::pion));
+        (m_extrapolator->extrapolate(ctx,*nearestParam, perSurf, Trk::anyDirection, false, Trk::pion).release());
       if (perpars != nullptr && fillTrackPerigee(perpars).isFailure()) {
         ATH_MSG_WARNING ("Newly made perigee parameters could not be written to ntuple");
       }
diff --git a/Tracking/TrkVertexFitter/TrkV0Fitter/src/TrkV0VertexFitter.cxx b/Tracking/TrkVertexFitter/TrkV0Fitter/src/TrkV0VertexFitter.cxx
index 9e1c0bfa6162bcf8248755e1b717b0e97e241b22..d6056c50bbb34db37325b5e21808076efd3cfd28 100755
--- a/Tracking/TrkVertexFitter/TrkV0Fitter/src/TrkV0VertexFitter.cxx
+++ b/Tracking/TrkVertexFitter/TrkV0Fitter/src/TrkV0VertexFitter.cxx
@@ -18,9 +18,9 @@
 #include "TrkParticleBase/TrackParticleBase.h"
 #include "TrkParameters/TrackParameters.h"
 #include "TrkLinks/LinkToXAODTrackParticle.h"
-//#include "TrkVxEdmCnv/IVxCandidateXAODVertex.h" 
+//#include "TrkVxEdmCnv/IVxCandidateXAODVertex.h"
 #include "xAODTracking/Vertex.h"
-#include "xAODTracking/TrackParticle.h" 
+#include "xAODTracking/TrackParticle.h"
 
 #include "StoreGate/ReadCondHandle.h"
 #include <sstream>
@@ -69,9 +69,9 @@ namespace Trk
     if ( m_extrapolator.retrieve().isFailure() ) {
       ATH_MSG_FATAL("Failed to retrieve tool " << m_extrapolator);
       return StatusCode::FAILURE;
-    } 
+    }
       ATH_MSG_INFO( "Retrieved tool " << m_extrapolator );
-    
+
 
     ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() );
 
@@ -147,7 +147,7 @@ namespace Trk
                                                             Trk::alongMomentum,
                                                             true,
                                                             Trk::pion,
-                                                            mode);
+                                                            mode).release();
           if (extrapolatedPerigee != nullptr) {
             msg(MSG::DEBUG) << "extrapolated to first measurement" << endmsg;
             measuredPerigees.push_back (extrapolatedPerigee);
@@ -159,7 +159,7 @@ namespace Trk
                                                   estimationCylinder,
                                                   Trk::alongMomentum,
                                                   true,
-                                                  Trk::pion);
+                                                  Trk::pion).release();
             if (extrapolatedPerigee != nullptr) {
               msg(MSG::DEBUG) << "extrapolated (direct) to first measurement" << endmsg;
               measuredPerigees.push_back (extrapolatedPerigee);
@@ -176,7 +176,7 @@ namespace Trk
     }
 
     xAOD::Vertex * fittedVxCandidate = fit(measuredPerigees, masses, constraintMass, pointingVertex, firstStartingPoint);
-    
+
     // assign the used tracks to the V0Candidate
     if (fittedVxCandidate) {
       for (const xAOD::TrackParticle* p : vectorTrk)
@@ -191,7 +191,7 @@ namespace Trk
 
     return fittedVxCandidate;
   }
-  
+
 
 
   /** Interface for Trk::TrackParameters with Amg::Vector3D starting point */
@@ -236,7 +236,7 @@ namespace Trk
       ATH_MSG_DEBUG("No tracks to fit in this event.");
       return nullptr;
     }
- 
+
     // Initialisation of variables
     bool pointingConstraint = false;
     bool massConstraint = false;
@@ -366,14 +366,24 @@ namespace Trk
         const double extrapolationDirection = gMomentum.dot( gDirection );
         MaterialUpdateMode mode = Trk::removeNoise;
         if(extrapolationDirection > 0) mode = Trk::addNoise;
-        const Trk::Perigee* extrapolatedPerigee(nullptr);
-        extrapolatedPerigee = dynamic_cast<const Trk::Perigee*>(m_extrapolator->extrapolate(
-            ctx, *chargeParameters, perigeeSurface, Trk::anyDirection, true, Trk::pion, mode));
-        if (extrapolatedPerigee==nullptr)
-        {
+        std::unique_ptr<const Trk::Perigee> extrapolatedPerigee(nullptr);
+        std::unique_ptr<const Trk::TrackParameters> tmp =
+          m_extrapolator->extrapolate(ctx,
+                                      *chargeParameters,
+                                      perigeeSurface,
+                                      Trk::anyDirection,
+                                      true,
+                                      Trk::pion,
+                                      mode);
+        //if of right type we want to pass ownership
+        if (tmp && tmp->associatedSurface().type() == Trk::SurfaceType::Perigee) {
+            extrapolatedPerigee.reset(static_cast<const Trk::Perigee*>(tmp.release()));
+        } 
+
+        if (extrapolatedPerigee == nullptr) {
           ATH_MSG_DEBUG("Perigee was not extrapolated! Taking original one!");
           const Trk::Perigee* tmpPerigee = dynamic_cast<const Trk::Perigee*>(chargeParameters);
-          if (tmpPerigee!=nullptr) extrapolatedPerigee = new Trk::Perigee(*tmpPerigee);
+          if (tmpPerigee!=nullptr) extrapolatedPerigee = std::make_unique<Trk::Perigee>(*tmpPerigee);
           else return nullptr;
         }
 
@@ -387,7 +397,6 @@ namespace Trk
         locV0FitterTrack.Wi_mat = extrapolatedPerigee->covariance()->inverse().eval();
         locV0FitterTrack.originalPerigee = *iter;
         v0FitterTracks.push_back(locV0FitterTrack);
-        delete extrapolatedPerigee;
       } else {
         ATH_MSG_DEBUG("Track parameters are not charged tracks ... fit aborted");
         return nullptr;
@@ -435,7 +444,7 @@ namespace Trk
       A_vec = DeltaA_vec;
 
       // check theta and phi ranges
-      for (unsigned int i=0; i<nTrk; ++i) 
+      for (unsigned int i=0; i<nTrk; ++i)
       {
         if ( fabs ( Y_vec(2+5*i) ) > 100. || fabs ( Y_vec(3+5*i) ) > 100. ) { return nullptr; }
         while ( fabs ( Y_vec(2+5*i) ) > M_PI ) Y_vec(2+5*i) += ( Y_vec(2+5*i) > 0 ) ? -2*M_PI : 2*M_PI;
@@ -460,7 +469,7 @@ namespace Trk
         d0Cor.setZero();  d0Fac.setZero(); xcphiplusysphi.setZero(); xsphiminusycphi.setZero();
       AmgVector(2) conv_sign;
         conv_sign[0] = -1; conv_sign[1] = 1;
-      for (unsigned int i=0; i<nTrk; ++i) 
+      for (unsigned int i=0; i<nTrk; ++i)
       {
         charge[i] = (Y_vec(4+5*i) < 0.) ? -1. : 1.;
         rho[i] = sin(Y_vec(3+5*i))/(B_z*Y_vec(4+5*i));
@@ -527,7 +536,7 @@ namespace Trk
       //
       FPxz  = Px*(frameOriginItr[2] - z_point) - Pz*(frameOriginItr[0]- x_point);
 
-      for (unsigned int i=0; i<nTrk; ++i) 
+      for (unsigned int i=0; i<nTrk; ++i)
       {
       //
       // Fxy = vertex constraint in xy plane (one for each track)
@@ -626,7 +635,7 @@ namespace Trk
       }
 
       sumConstr = 0.;
-      for (unsigned int i=0; i<dim; ++i) 
+      for (unsigned int i=0; i<dim; ++i)
       {
         sumConstr += F_fac_vec[i]*fabs(F_vec[i]);
       }
@@ -634,7 +643,7 @@ namespace Trk
       if (sumConstr < 0.001) { onConstr = true; }
       ATH_MSG_DEBUG("sumConstr " << sumConstr);
 
-      for (unsigned int i=0; i<nTrk; ++i) 
+      for (unsigned int i=0; i<nTrk; ++i)
       {
         Bjac_mat(i,0+5*i)        = dFxydd0(i);
         Bjac_mat(i,1+5*i)        = dFxydz0(i);
@@ -734,8 +743,8 @@ namespace Trk
       C32_mat =   Atemp_mat * C22_mat;
       C31_mat =   Btemp_mat + Atemp_mat * C21_mat;
       Amg::MatrixX mat_prod_1 = Wmeas_mat * Bjac_mat.transpose();
-      Amg::MatrixX mat_prod_2 = Wmeas_mat * Bjac_mat.transpose() * Wb_mat * Ajac_mat; 
-      C11_mat =   Wmeas_mat - Wb_mat.similarity( mat_prod_1 ) + C22_mat.similarity( mat_prod_2 );	
+      Amg::MatrixX mat_prod_2 = Wmeas_mat * Bjac_mat.transpose() * Wb_mat * Ajac_mat;
+      C11_mat =   Wmeas_mat - Wb_mat.similarity( mat_prod_1 ) + C22_mat.similarity( mat_prod_2 );
 
       C_cor_vec = Ajac_mat*DeltaA_vec + Bjac_mat*DeltaY_vec;
       C_vec = C_cor_vec + F_vec;
@@ -743,7 +752,7 @@ namespace Trk
       DeltaY_vec = C31_mat.transpose()*C_vec;
       DeltaA_vec = C32_mat.transpose()*C_vec;
 
-      for (unsigned int i=0; i<n_dim; ++i) 
+      for (unsigned int i=0; i<n_dim; ++i)
       {
         ChiItr_vec(0,i) = DeltaY_vec(i);
       }
@@ -802,14 +811,25 @@ namespace Trk
             const double extrapolationDirection = gMomentum .dot( gDirection );
             MaterialUpdateMode mode = Trk::removeNoise;
             if(extrapolationDirection > 0) mode = Trk::addNoise;
-            const Trk::Perigee* extrapolatedPerigee(nullptr);
-            extrapolatedPerigee = dynamic_cast<const Trk::Perigee*>(m_extrapolator->extrapolate(
-                ctx, *chargeParameters, perigeeSurfaceItr, Trk::anyDirection, true, Trk::pion, mode));
-            if (extrapolatedPerigee==nullptr)
-            {
+            std::unique_ptr<const Trk::Perigee> extrapolatedPerigee(nullptr);
+            std::unique_ptr<const Trk::TrackParameters> tmp =
+              m_extrapolator->extrapolate(ctx,
+                                          *chargeParameters,
+                                          perigeeSurfaceItr,
+                                          Trk::anyDirection,
+                                          true,
+                                          Trk::pion,
+                                          mode);
+            // if of right type we want to pass ownership
+            if (tmp && tmp->associatedSurface().type() == Trk::SurfaceType::Perigee) {
+              extrapolatedPerigee.reset(
+                static_cast<const Trk::Perigee*>(tmp.release()));
+            }
+
+            if (extrapolatedPerigee == nullptr) {
               ATH_MSG_DEBUG("Perigee was not extrapolated! Taking original one!");
               const Trk::Perigee* tmpPerigee = dynamic_cast<const Trk::Perigee*>(chargeParameters);
-              if (tmpPerigee!=nullptr) extrapolatedPerigee = new Trk::Perigee(*tmpPerigee);
+              if (tmpPerigee!=nullptr) extrapolatedPerigee = std::make_unique<Trk::Perigee>(*tmpPerigee);
               else return nullptr;
             }
 
@@ -823,7 +843,6 @@ namespace Trk
             locV0FitterTrack.Wi_mat = extrapolatedPerigee->covariance()->inverse().eval();
             locV0FitterTrack.originalPerigee = *iter;
             v0FitterTracks.push_back(locV0FitterTrack);
-            delete extrapolatedPerigee;
           } else {
             ATH_MSG_DEBUG("Track parameters are not charged tracks ... fit aborted");
             return nullptr;
@@ -854,7 +873,7 @@ namespace Trk
     Y_vec = Y0_vec + DeltaY_vec;
 
     // check theta and phi ranges
-    for (unsigned int i=0; i<nTrk; ++i) 
+    for (unsigned int i=0; i<nTrk; ++i)
     {
       if ( fabs ( Y_vec(2+5*i) ) > 100. || fabs ( Y_vec(3+5*i) ) > 100. ) { return nullptr; }
       while ( fabs ( Y_vec(2+5*i) ) > M_PI ) Y_vec(2+5*i) += ( Y_vec(2+5*i) > 0 ) ? -2*M_PI : 2*M_PI;
@@ -872,7 +891,7 @@ namespace Trk
       }
     }
 
-    for (unsigned int i=0; i<n_dim; ++i) 
+    for (unsigned int i=0; i<n_dim; ++i)
     {
       Chi_vec(0,i) = DeltaY_vec(i);
     }
@@ -900,7 +919,7 @@ namespace Trk
       iRP++;
     }
 
-    // Store the vertex 
+    // Store the vertex
     xAOD::Vertex* vx = new xAOD::Vertex;
     vx->makePrivateStore();
     vx->setPosition (frameOrigin);
@@ -908,7 +927,7 @@ namespace Trk
     vx->setFitQuality(chi2,static_cast<float>(ndf));
     vx->setVertexType(xAOD::VxType::V0Vtx);
 
-    // Store the tracks at vertex 
+    // Store the tracks at vertex
     std::vector<VxTrackAtVertex> & tracksAtVertex = vx->vxTrackAtVertex(); tracksAtVertex.clear();
     Amg::Vector3D Vertex(frameOrigin[0],frameOrigin[1],frameOrigin[2]);
     const Trk::PerigeeSurface Surface(Vertex);
@@ -925,7 +944,7 @@ namespace Trk
           CovMtxP.fillSymmetric(i,j,val);
         }
       }
-      refittedPerigee = new Trk::Perigee (Y_vec(0+5*iterf),Y_vec(1+5*iterf),Y_vec(2+5*iterf),Y_vec(3+5*iterf),Y_vec(4+5*iterf), 
+      refittedPerigee = new Trk::Perigee (Y_vec(0+5*iterf),Y_vec(1+5*iterf),Y_vec(2+5*iterf),Y_vec(3+5*iterf),Y_vec(4+5*iterf),
                                           Surface, std::move(CovMtxP));
       tracksAtVertex.emplace_back((*BTIterf).chi2, refittedPerigee, (*BTIterf).originalPerigee);
       iterf++;
diff --git a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalExtPropagator.cxx b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalExtPropagator.cxx
index f0a1bb934883b74c7190736edfbdd23592cea39c..f44e5e9092ca29054c6cc820f6b94da11383c4d3 100755
--- a/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalExtPropagator.cxx
+++ b/Tracking/TrkVertexFitter/TrkVKalVrtFitter/src/VKalExtPropagator.cxx
@@ -230,10 +230,10 @@ namespace Trk {
         prtType = undefined;
         if (pmom.dot(step) > 0.) {
           endPer = m_extrapolator->extrapolateDirectly(ctx,
-            *inpPer, surfEnd, alongMomentum, true, pion);
+            *inpPer, surfEnd, alongMomentum, true, pion).release();
         } else {
           endPer = m_extrapolator->extrapolateDirectly(ctx,
-            *inpPer, surfEnd, oppositeMomentum, true, pion);
+            *inpPer, surfEnd, oppositeMomentum, true, pion).release();
         }
         return endPer;
       }
@@ -257,7 +257,7 @@ namespace Trk {
           dir = oppositeMomentum;
         }
         endPer = m_extrapolator->extrapolate(
-          ctx, *pntOnTrk, surfEnd, dir, true, prtType, addNoise);
+          ctx, *pntOnTrk, surfEnd, dir, true, prtType, addNoise).release();
         return endPer;
       }
       // 
@@ -271,7 +271,7 @@ namespace Trk {
           mmode = removeNoise;
         }
         endPer = m_extrapolator->extrapolate(
-          ctx, *pntOnTrk, surfEnd, dir, true, prtType, mmode);
+          ctx, *pntOnTrk, surfEnd, dir, true, prtType, mmode).release();
         return endPer;
       }
       //
@@ -285,7 +285,7 @@ namespace Trk {
         if ((*endPoint).perp() > Border && iniPoint.perp() > Border) {
           if (dirPositive) {
             endPer = m_extrapolator->extrapolate(
-              ctx, *pntOnTrk, surfEnd, alongMomentum, true, prtType, addNoise);
+              ctx, *pntOnTrk, surfEnd, alongMomentum, true, prtType, addNoise).release();
           } else {
             endPer = m_extrapolator->extrapolate(ctx,
                                                  *pntOnTrk,
@@ -293,7 +293,7 @@ namespace Trk {
                                                  oppositeMomentum,
                                                  true,
                                                  prtType,
-                                                 removeNoise);
+                                                 removeNoise).release();
           }
           return endPer;
         }
@@ -305,7 +305,7 @@ namespace Trk {
                                                  alongMomentum,
                                                  true,
                                                  prtType,
-                                                 removeNoise);
+                                                 removeNoise).release();
           } else {
             endPer = m_extrapolator->extrapolate(ctx,
                                                  *pntOnTrk,
@@ -313,7 +313,7 @@ namespace Trk {
                                                  oppositeMomentum,
                                                  true,
                                                  prtType,
-                                                 addNoise);
+                                                 addNoise).release();
           }
           return endPer;
         }
@@ -327,15 +327,15 @@ namespace Trk {
                                                alongMomentum,
                                                true,
                                                prtType,
-                                               removeNoise);
+                                               removeNoise).release();
           if (tmpPer == nullptr) {
             return nullptr;
           }
           endPer = m_extrapolator->extrapolate(
-            ctx, *tmpPer, surfEnd, alongMomentum, true, prtType, addNoise);
+            ctx, *tmpPer, surfEnd, alongMomentum, true, prtType, addNoise).release();
         } else {
           endPer = m_extrapolator->extrapolate(
-            ctx, *pntOnTrk, surfEnd, oppositeMomentum, true, prtType, addNoise);
+            ctx, *pntOnTrk, surfEnd, oppositeMomentum, true, prtType, addNoise).release();
           return endPer;
         }
         delete tmpPer;
@@ -395,8 +395,9 @@ namespace Trk {
 //
       if( Strategy == 0) {  
         PropDirection dir=alongMomentum; if(pmom.dot(step)<0) dir=oppositeMomentum;
-        endPer = m_extrapolator->extrapolate(ctx, *pntOnTrk, lineTarget, dir, true, prtType, addNoise);
-        if(!endPer)endPer = m_extrapolator->extrapolateDirectly(ctx,*pntOnTrk, lineTarget, dir, true, prtType);
+        endPer = m_extrapolator->extrapolate(ctx, *pntOnTrk, lineTarget, dir, true, prtType, addNoise).release();
+        if (!endPer)
+          endPer = m_extrapolator->extrapolateDirectly(ctx, *pntOnTrk, lineTarget, dir, true, prtType).release();
         return endPer;
       }
 // 
@@ -405,7 +406,7 @@ namespace Trk {
       if( Strategy == 1 || Strategy == 2) {  
          PropDirection dir=alongMomentum;  MaterialUpdateMode mmode=addNoise;
 	 if(pmom.dot(step)<0){ dir=oppositeMomentum; mmode=removeNoise;}
-         endPer = m_extrapolator->extrapolate(ctx, *pntOnTrk, lineTarget, dir, true, prtType, mmode);
+         endPer = m_extrapolator->extrapolate(ctx, *pntOnTrk, lineTarget, dir, true, prtType, mmode).release();
          return endPer; 
       }
       return endPer; 
@@ -420,7 +421,7 @@ namespace Trk {
       const Trk::NeutralParameters* endPer=nullptr;
 //End surface
       PerigeeSurface surfEnd( *endPoint );
-      endPer = m_extrapolator->extrapolate( *inpPer, surfEnd, anyDirection, true);
+      endPer = m_extrapolator->extrapolate( *inpPer, surfEnd, anyDirection, true).release();
       return endPer;
   }
 
@@ -447,20 +448,20 @@ namespace Trk {
                                       *mPer, 
                                       surfacePntOnTrk, 
                                       alongMomentum, 
-                                      true, prtType, removeNoise);
+                                      true, prtType, removeNoise).release();
 //std::cout<<" Radius="<<xprt->radiusOfFirstHit()<<" extrap="<<hitOnTrk<<'\n';
     if(hitOnTrk==nullptr)hitOnTrk=m_extrapolator->extrapolateDirectly(ctx, 
                                                                       *mPer, 
                                                                       surfacePntOnTrk, 
                                                                       alongMomentum, 
-                                                                      true, prtType);
+                                                                      true, prtType).release();
     if(hitOnTrk==nullptr)return nullptr;
 
     //convert result to Perigee 
     PerigeeSurface surfacePerigee( hitOnTrk->position() );
     const TrackParameters *hitOnTrkPerig = m_extrapolator->extrapolate(ctx,
                                                                        *hitOnTrk, 
-                                                                       surfacePerigee);
+                                                                       surfacePerigee).release();
     delete hitOnTrk;  // Delete temporary results
     if(hitOnTrkPerig==nullptr)return nullptr;
 //std::cout<<" perig="<<(*hitOnTrkPerig)<<'\n';
diff --git a/Tracking/TrkVertexFitter/TrkVertexAnalysisUtils/src/V0Tools.cxx b/Tracking/TrkVertexFitter/TrkVertexAnalysisUtils/src/V0Tools.cxx
index fdca0164c837eb9493890bb5fb038d1348c78a9f..2d70d416bfe27cc0eadd1a2e9dcb917368bc971d 100644
--- a/Tracking/TrkVertexFitter/TrkVertexAnalysisUtils/src/V0Tools.cxx
+++ b/Tracking/TrkVertexFitter/TrkVertexAnalysisUtils/src/V0Tools.cxx
@@ -7,7 +7,7 @@
 
     authors : Evelina Bouhova-Thacker (Lancater University)
     email   : e.bouhova@cern.ch
- 
+
 *********************************************************************/
 
 #include "TrkVertexAnalysisUtils/V0Tools.h"
@@ -23,16 +23,16 @@
 namespace Trk
 {
 
-  V0Tools::V0Tools(const std::string& t, const std::string& n, const IInterface*  p) : 
+  V0Tools::V0Tools(const std::string& t, const std::string& n, const IInterface*  p) :
    AthAlgTool(t,n,p),
-   m_extrapolator("Trk::Extrapolator") 
+   m_extrapolator("Trk::Extrapolator")
   {
     declareProperty("Extrapolator", m_extrapolator);
     declareInterface<V0Tools>(this);
   }
- 
+
   V0Tools::~V0Tools() {}
- 
+
   StatusCode V0Tools::initialize()
   {
 
@@ -45,10 +45,10 @@ namespace Trk
   }
 
     ATH_MSG_DEBUG( "Initialize successful" );
-    return StatusCode::SUCCESS; 
+    return StatusCode::SUCCESS;
   }
 
-  const xAOD::Vertex * V0Tools::v0Link(const xAOD::Vertex * vxCandidate) 
+  const xAOD::Vertex * V0Tools::v0Link(const xAOD::Vertex * vxCandidate)
   {
     const xAOD::Vertex* v0(nullptr);
     const static SG::AuxElement::Accessor< ElementLink< xAOD::VertexContainer > > acc( "V0Link" );
@@ -58,7 +58,7 @@ namespace Trk
     return v0;
   }
 
-  const xAOD::Vertex * V0Tools::kshortLink(const xAOD::Vertex * vxCandidate) 
+  const xAOD::Vertex * V0Tools::kshortLink(const xAOD::Vertex * vxCandidate)
   {
     const xAOD::Vertex* v0(nullptr);
     const static SG::AuxElement::Accessor< ElementLink< xAOD::VertexContainer > > acc( "KshortLink" );
@@ -68,7 +68,7 @@ namespace Trk
     return v0;
   }
 
-  const xAOD::Vertex * V0Tools::lambdaLink(const xAOD::Vertex * vxCandidate) 
+  const xAOD::Vertex * V0Tools::lambdaLink(const xAOD::Vertex * vxCandidate)
   {
     const xAOD::Vertex* v0(nullptr);
     const static SG::AuxElement::Accessor< ElementLink< xAOD::VertexContainer > > acc( "LambdaLink" );
@@ -78,7 +78,7 @@ namespace Trk
     return v0;
   }
 
-  const xAOD::Vertex * V0Tools::lambdabarLink(const xAOD::Vertex * vxCandidate) 
+  const xAOD::Vertex * V0Tools::lambdabarLink(const xAOD::Vertex * vxCandidate)
   {
     const xAOD::Vertex* v0(nullptr);
     const static SG::AuxElement::Accessor< ElementLink< xAOD::VertexContainer > > acc( "LambdabarLink" );
@@ -124,7 +124,7 @@ namespace Trk
 
     return invariantMassError(vxCandidate,masses);
   }
- 
+
   double V0Tools::invariantMassError(const xAOD::Vertex * vxCandidate, const std::vector<double> &masses) const
   {
     unsigned int NTrk = vxCandidate->vxTrackAtVertex().size();
@@ -150,7 +150,7 @@ namespace Trk
     delete fullCov;
     return error;
   }
- 
+
   double V0Tools::massErrorV0Fitter(const xAOD::Vertex * vxCandidate, double posTrackMass, double negTrackMass) const
   {
     std::vector<double> masses = {posTrackMass, negTrackMass};
@@ -168,7 +168,7 @@ namespace Trk
     Amg::MatrixX* fullCov = convertCovMatrix(vxCandidate);
     if (fullCov == nullptr) return -999999.;
     unsigned int ndim = fullCov->rows();
-    double E=0., Px=0., Py=0., Pz=0.; 
+    double E=0., Px=0., Py=0., Pz=0.;
     std::vector<double>phi(NTrk), theta(NTrk), qOverP(NTrk), charge(NTrk), e(NTrk);
     std::vector<double>dm2dphi(NTrk), dm2dtheta(NTrk), dm2dqOverP(NTrk);
     for( unsigned int it=0; it<NTrk; it++) {
@@ -217,7 +217,7 @@ namespace Trk
     double massErr = massVar/(2.*mass);
     return massErr;
   }
- 
+
   double V0Tools::massErrorVKalVrt(const xAOD::Vertex * vxCandidate, double posTrackMass, double negTrackMass) const
   {
     std::vector<double> masses = {posTrackMass, negTrackMass};
@@ -237,7 +237,7 @@ namespace Trk
     Amg::MatrixX tmpDeriv(3,3); tmpDeriv.setZero();
     Amg::MatrixX* fullCov = convertCovMatrix(vxCandidate);
     if (fullCov == nullptr) return -999999.;
- 
+
     for( unsigned int it=0; it<NTrk; it++){
       if (masses[it] >= 0.) {
         const Trk::TrackParameters* bPer = vxCandidate->vxTrackAtVertex()[it].perigeeAtVertex();
@@ -267,18 +267,18 @@ namespace Trk
         particleDeriv[it] = tmpDeriv;
       }
     }
-  
+
     std::vector<double> Deriv(3*NTrk+3, 0.);
     for(unsigned int it=0; it<NTrk; it++){
       if (masses[it] >= 0.) {
         double dMdPx = ( totalMom.E() * particleMom[it].Px()/particleMom[it].E() - totalMom.Px() ) / totalMom.M();
         double dMdPy = ( totalMom.E() * particleMom[it].Py()/particleMom[it].E() - totalMom.Py() ) / totalMom.M();
         double dMdPz = ( totalMom.E() * particleMom[it].Pz()/particleMom[it].E() - totalMom.Pz() ) / totalMom.M();
-  
+
         double dMdPhi   = dMdPx*particleDeriv[it](0,0) + dMdPy*particleDeriv[it](1,0) + dMdPz*particleDeriv[it](2,0);
         double dMdTheta = dMdPx*particleDeriv[it](0,1) + dMdPy*particleDeriv[it](1,1) + dMdPz*particleDeriv[it](2,1);
         double dMdInvP  = dMdPx*particleDeriv[it](0,2) + dMdPy*particleDeriv[it](1,2) + dMdPz*particleDeriv[it](2,2);
-  
+
         Deriv[3*it + 3 + 0] = dMdPhi;    Deriv[3*it + 3 + 1] = dMdTheta; Deriv[3*it + 3 + 2] = dMdInvP;
       }
     }
@@ -300,7 +300,7 @@ namespace Trk
 
     return massErrorVxCandidate(vxCandidate,masses);
   }
- 
+
   double V0Tools::massErrorVxCandidate(const xAOD::Vertex * vxCandidate, const std::vector<double> &masses) const
   {
     unsigned int NTrk = vxCandidate->vxTrackAtVertex().size();
@@ -308,7 +308,7 @@ namespace Trk
       ATH_MSG_DEBUG("The provided number of masses does not match the number of tracks in the vertex");
       return -999999.;
     }
-    double E=0., Px=0., Py=0., Pz=0.; 
+    double E=0., Px=0., Py=0., Pz=0.;
     std::vector<double>phi(NTrk), theta(NTrk), qOverP(NTrk), charge(NTrk), e(NTrk);
     std::vector<double>dm2dphi(NTrk), dm2dtheta(NTrk), dm2dqOverP(NTrk);
     Amg::MatrixX V0_cor(5*NTrk,5*NTrk); V0_cor.setZero();
@@ -375,7 +375,7 @@ namespace Trk
 
     return invariantMassProbability(vxCandidate,V0Mass,masses);
   }
- 
+
   double V0Tools::invariantMassProbability(const xAOD::Vertex * vxCandidate, double V0Mass, const std::vector<double> &masses) const
   {
     double mass = invariantMass(vxCandidate, masses);
@@ -397,7 +397,7 @@ namespace Trk
       return -1.;
     }
   }
- 
+
   double V0Tools::massProbability(double V0Mass, double mass, double massErr) const
   {
     if(massErr > 0.)
@@ -418,7 +418,7 @@ namespace Trk
     }
   }
 
-  Amg::Vector3D V0Tools::trackMomentum(const xAOD::Vertex * vxCandidate, unsigned int trkIndex) 
+  Amg::Vector3D V0Tools::trackMomentum(const xAOD::Vertex * vxCandidate, unsigned int trkIndex)
   {
     double px = 0., py = 0., pz = 0.;
     const Trk::TrackParameters* aPerigee = vxCandidate->vxTrackAtVertex()[trkIndex].perigeeAtVertex();
@@ -429,7 +429,7 @@ namespace Trk
     return mom;
   }
 
-  Amg::Vector3D V0Tools::positiveTrackMomentum(const xAOD::Vertex * vxCandidate) 
+  Amg::Vector3D V0Tools::positiveTrackMomentum(const xAOD::Vertex * vxCandidate)
   {
     Amg::Vector3D mom;
     unsigned int NTrk = vxCandidate->vxTrackAtVertex().size();
@@ -441,7 +441,7 @@ namespace Trk
     return mom;
   }
 
-  Amg::Vector3D V0Tools::negativeTrackMomentum(const xAOD::Vertex * vxCandidate) 
+  Amg::Vector3D V0Tools::negativeTrackMomentum(const xAOD::Vertex * vxCandidate)
   {
     Amg::Vector3D mom;
     unsigned int NTrk = vxCandidate->vxTrackAtVertex().size();
@@ -453,7 +453,7 @@ namespace Trk
     return mom;
   }
 
-  Amg::Vector3D V0Tools::V0Momentum(const xAOD::Vertex * vxCandidate) 
+  Amg::Vector3D V0Tools::V0Momentum(const xAOD::Vertex * vxCandidate)
   {
     double px = 0., py = 0., pz = 0.;
     unsigned int NTrk = vxCandidate->vxTrackAtVertex().size();
@@ -467,7 +467,7 @@ namespace Trk
     return mom;
   }
 
-  xAOD::TrackParticle::FourMom_t V0Tools::track4Momentum(const xAOD::Vertex * vxCandidate, unsigned int trkIndex, double mass) 
+  xAOD::TrackParticle::FourMom_t V0Tools::track4Momentum(const xAOD::Vertex * vxCandidate, unsigned int trkIndex, double mass)
   {
     Amg::Vector3D mom = trackMomentum(vxCandidate, trkIndex);
     xAOD::TrackParticle::FourMom_t lorentz(0,0,0,0);
@@ -507,12 +507,12 @@ namespace Trk
     return lorentz;
   }
 
-  float V0Tools::ndof(const xAOD::Vertex * vxCandidate) 
+  float V0Tools::ndof(const xAOD::Vertex * vxCandidate)
   {
     return vxCandidate->numberDoF();
   }
 
-  float V0Tools::chisq(const xAOD::Vertex * vxCandidate) 
+  float V0Tools::chisq(const xAOD::Vertex * vxCandidate)
   {
     return vxCandidate->chiSquared();
   }
@@ -537,28 +537,28 @@ namespace Trk
 
   }
 
-  Amg::Vector3D V0Tools::vtx(const xAOD::Vertex * vxCandidate) 
+  Amg::Vector3D V0Tools::vtx(const xAOD::Vertex * vxCandidate)
   {
     Amg::Vector3D vertex(vxCandidate->position().x(),vxCandidate->position().y(),vxCandidate->position().z());
     return vertex;
   }
 
-  double V0Tools::rxy(const xAOD::Vertex * vxCandidate) 
+  double V0Tools::rxy(const xAOD::Vertex * vxCandidate)
   {
     return vxCandidate->position().perp();
   }
 
-  double V0Tools::rxy(const xAOD::Vertex * vxCandidate, const xAOD::Vertex* vertex) 
+  double V0Tools::rxy(const xAOD::Vertex * vxCandidate, const xAOD::Vertex* vertex)
   {
     return (vxCandidate->position() - vertex->position()).perp();
   }
 
-  double V0Tools::rxy(const xAOD::Vertex * vxCandidate, const Amg::Vector3D& vertex) 
+  double V0Tools::rxy(const xAOD::Vertex * vxCandidate, const Amg::Vector3D& vertex)
   {
     return (vxCandidate->position() - vertex).perp();
   }
 
-  double V0Tools::rxy_var(double dx, double dy, const Amg::MatrixX& cov) 
+  double V0Tools::rxy_var(double dx, double dy, const Amg::MatrixX& cov)
   {
     double rxysq = dx*dx + dy*dy;
     double rxy = (rxysq>0.) ? sqrt(rxysq) : 0.;
@@ -584,7 +584,7 @@ namespace Trk
 
   double V0Tools::rxyError(const xAOD::Vertex * vxCandidate, const xAOD::Vertex* vertex) const
   {
-    const Amg::MatrixX cov = vxCandidate->covariancePosition() + vertex->covariancePosition(); 
+    const Amg::MatrixX cov = vxCandidate->covariancePosition() + vertex->covariancePosition();
     auto vert = vxCandidate->position() - vertex->position();
     double dx = vert.x();
     double dy = vert.y();
@@ -612,7 +612,7 @@ namespace Trk
   double V0Tools::pTError(const xAOD::Vertex * vxCandidate) const
   {
     unsigned int NTrk = vxCandidate->vxTrackAtVertex().size();
-    double Px=0., Py=0.; 
+    double Px=0., Py=0.;
     std::vector<double>dpxdqOverP(NTrk), dpxdtheta(NTrk), dpxdphi(NTrk);
     std::vector<double>dpydqOverP(NTrk), dpydtheta(NTrk), dpydphi(NTrk);
     std::vector<double>dPTdqOverP(NTrk), dPTdtheta(NTrk), dPTdphi(NTrk);
@@ -707,7 +707,7 @@ namespace Trk
     D_vec(1) = vert.y();
     D_vec(2) = vert.z();
     Amg::MatrixX sepVarsqMat = D_vec.transpose() * cov * D_vec;
-    double sepVarsq = sepVarsqMat(0,0); 
+    double sepVarsq = sepVarsqMat(0,0);
     if (sepVarsq <= 0.) ATH_MSG_DEBUG("separation: negative sqrt sepVarsq " << sepVarsq);
     double sepVar = (sepVarsq>0.) ? sqrt(sepVarsq) : 0.;
     return sepVar;
@@ -1010,7 +1010,7 @@ namespace Trk
     double dx = vert.x();
     double dy = vert.y();
     unsigned int NTrk = vxCandidate->vxTrackAtVertex().size();
-    double Px=0., Py=0.; 
+    double Px=0., Py=0.;
     std::vector<double>dpxdqOverP(NTrk), dpxdtheta(NTrk), dpxdphi(NTrk);
     std::vector<double>dpydqOverP(NTrk), dpydtheta(NTrk), dpydphi(NTrk);
     std::vector<double>dLxydqOverP(NTrk), dLxydtheta(NTrk), dLxydphi(NTrk);
@@ -1127,7 +1127,7 @@ namespace Trk
     double dy = vert.y();
     double dz = vert.z();
     unsigned int NTrk = vxCandidate->vxTrackAtVertex().size();
-    double Px=0., Py=0., Pz=0.; 
+    double Px=0., Py=0., Pz=0.;
     std::vector<double>dpxdqOverP(NTrk), dpxdtheta(NTrk), dpxdphi(NTrk);
     std::vector<double>dpydqOverP(NTrk), dpydtheta(NTrk), dpydphi(NTrk);
     std::vector<double>dpzdqOverP(NTrk), dpzdtheta(NTrk);
@@ -1310,7 +1310,7 @@ namespace Trk
     double dx = vert.x();
     double dy = vert.y();
     double M = invariantMass(vxCandidate, masses);
-    double E=0., Px=0., Py=0., Pz=0.; 
+    double E=0., Px=0., Py=0., Pz=0.;
     std::vector<double>dpxdqOverP(NTrk), dpxdtheta(NTrk), dpxdphi(NTrk);
     std::vector<double>dpydqOverP(NTrk), dpydtheta(NTrk), dpydphi(NTrk);
     std::vector<double>dpzdqOverP(NTrk), dpzdtheta(NTrk), dedqOverP(NTrk);
@@ -1454,7 +1454,7 @@ namespace Trk
     double dx = vecsub.x();
     double dy = vecsub.y();
     unsigned int NTrk = vxCandidate->vxTrackAtVertex().size();
-    double Px=0., Py=0.; 
+    double Px=0., Py=0.;
     std::vector<double>dpxdqOverP(NTrk), dpxdtheta(NTrk), dpxdphi(NTrk);
     std::vector<double>dpydqOverP(NTrk), dpydtheta(NTrk), dpydphi(NTrk);
     std::vector<double>dPTdtheta(NTrk), dPTdphi(NTrk);
@@ -1596,7 +1596,7 @@ namespace Trk
     double dy = vert.y();
     double dz = vert.z();
     double M = invariantMass(vxCandidate, masses);
-    double E=0., Px=0., Py=0., Pz=0.; 
+    double E=0., Px=0., Py=0., Pz=0.;
     std::vector<double>dpxdqOverP(NTrk), dpxdtheta(NTrk), dpxdphi(NTrk);
     std::vector<double>dpydqOverP(NTrk), dpydtheta(NTrk), dpydphi(NTrk);
     std::vector<double>dpzdqOverP(NTrk), dpzdtheta(NTrk), dedqOverP(NTrk);
@@ -1721,7 +1721,7 @@ namespace Trk
     double dy = vecsub.y();
     double dz = vecsub.z();
     unsigned int NTrk = vxCandidate->vxTrackAtVertex().size();
-    double Px=0., Py=0., Pz=0.; 
+    double Px=0., Py=0., Pz=0.;
     std::vector<double>dpxdqOverP(NTrk), dpxdtheta(NTrk), dpxdphi(NTrk);
     std::vector<double>dpydqOverP(NTrk), dpydtheta(NTrk), dpydphi(NTrk);
     std::vector<double>dpzdqOverP(NTrk), dpzdtheta(NTrk);
@@ -1853,7 +1853,7 @@ namespace Trk
     return cosThetaStar(posMom, negMom);
   }
 
-  double V0Tools::cosThetaStar(const CLHEP::HepLorentzVector & posTrack, const CLHEP::HepLorentzVector & negTrack) 
+  double V0Tools::cosThetaStar(const CLHEP::HepLorentzVector & posTrack, const CLHEP::HepLorentzVector & negTrack)
   {
     CLHEP::HepLorentzVector v0(posTrack + negTrack);
     double Mv0   = v0.m();
@@ -1877,7 +1877,7 @@ namespace Trk
     return phiStar(v_pos+v_neg,v_pos);
   }
 
-  double V0Tools::phiStar(const CLHEP::HepLorentzVector & v0, const CLHEP::HepLorentzVector & track) 
+  double V0Tools::phiStar(const CLHEP::HepLorentzVector & v0, const CLHEP::HepLorentzVector & track)
   {
     double phiStar = -999999.;
     CLHEP::Hep3Vector V0 = v0.getV();
@@ -1929,7 +1929,7 @@ namespace Trk
     return (mom.x()*vtx1.x()+mom.y()*vtx1.y())/(pT*vtx1.perp());
   }
 
-  float V0Tools::charge(const xAOD::Vertex * vxCandidate) 
+  float V0Tools::charge(const xAOD::Vertex * vxCandidate)
   {
     float ch = 0.;
     unsigned int NTrk = vxCandidate->vxTrackAtVertex().size();
@@ -1943,12 +1943,12 @@ namespace Trk
     return ch;
   }
 
-  const xAOD::TrackParticle* V0Tools::origTrack(const xAOD::Vertex * vxCandidate, int trkIndex) 
+  const xAOD::TrackParticle* V0Tools::origTrack(const xAOD::Vertex * vxCandidate, int trkIndex)
   {
     return vxCandidate->trackParticle(trkIndex);
   }
 
-  const xAOD::TrackParticle* V0Tools::positiveOrigTrack(const xAOD::Vertex * vxCandidate) 
+  const xAOD::TrackParticle* V0Tools::positiveOrigTrack(const xAOD::Vertex * vxCandidate)
   {
     const xAOD::TrackParticle* origTrk(nullptr);
     unsigned int NTrk = vxCandidate->vxTrackAtVertex().size();
@@ -1959,7 +1959,7 @@ namespace Trk
     return origTrk;
   }
 
-  const xAOD::TrackParticle* V0Tools::negativeOrigTrack(const xAOD::Vertex * vxCandidate) 
+  const xAOD::TrackParticle* V0Tools::negativeOrigTrack(const xAOD::Vertex * vxCandidate)
   {
     const xAOD::TrackParticle* origTrk(nullptr);
     unsigned int NTrk = vxCandidate->vxTrackAtVertex().size();
@@ -1984,7 +1984,7 @@ namespace Trk
   }
   */
 
-  /* JRC - NOT POSSIBLE WITH NEW EDM 
+  /* JRC - NOT POSSIBLE WITH NEW EDM
   Rec::TrackParticle* V0Tools::createParticle(const Trk::V0Hypothesis* v0Hypothesis) const
   {
     const std::vector<Trk::VxTrackAtVertex*> * myTrackVectorPtr=v0Hypothesis->vxTrackAtVertex();
@@ -1997,7 +1997,7 @@ namespace Trk
     Rec::TrackParticle* nTrkPrt;
     unsigned int NTrk = v0Hypothesis->vxTrackAtVertex()->size();
 
-    double Px=0., Py=0., Pz=0., D0=0., Z0=0., T0=0.; 
+    double Px=0., Py=0., Pz=0., D0=0., Z0=0., T0=0.;
     CLHEP::HepVector phi(NTrk,0), theta(NTrk,0), qOverP(NTrk,0);
     CLHEP::HepVector dPxdphi(NTrk,0), dPxdtheta(NTrk,0), dPxdqOverP(NTrk,0);
     CLHEP::HepVector dPydphi(NTrk,0), dPydtheta(NTrk,0), dPydqOverP(NTrk,0);
@@ -2156,7 +2156,7 @@ namespace Trk
 
     gp = v0Hypothesis->recVertex().position();
     PerigeeSurface surface;
-    
+
     perigee = surface.createNeutralParameters( D0, Z0, Phi, Theta, invP, &SumCov );
     tmpPar.push_back(perigee);
 
@@ -2209,7 +2209,7 @@ namespace Trk
                                      tmpPar, perigee, fitQuality);
     return nTrkPrt;
   }
-  */  
+  */
 
   double V0Tools::invariantMassBeforeFitIP(const xAOD::Vertex * vxCandidate, double posTrackMass, double negTrackMass) const
   {
@@ -2260,18 +2260,17 @@ namespace Trk
       if (masses[it] >= 0.) {
         const xAOD::TrackParticle* TP = origTrack(vxCandidate,it);
         if (TP == nullptr) return -999999.;
-        const Trk::TrackParameters* extrPer = m_extrapolator->extrapolate(
-          Gaudi::Hive::currentContext(),
-          *TP, 
-          perigeeSurface);
-        if (extrPer == nullptr) return -999999.;
+        std::unique_ptr<const Trk::TrackParameters> extrPer =
+          m_extrapolator->extrapolate(
+            Gaudi::Hive::currentContext(), *TP, perigeeSurface);
+        if (extrPer == nullptr)
+          return -999999.;
         px += extrPer->momentum().x();
         py += extrPer->momentum().y();
         pz += extrPer->momentum().z();
         double pesq = extrPer->momentum().mag2() + masses[it]*masses[it];
         double pe = (pesq>0.) ? sqrt(pesq) : 0.;
         e += pe;
-        delete extrPer;
       }
     }
     double msq = e*e - px*px - py*py - pz*pz;
@@ -2297,18 +2296,17 @@ namespace Trk
       if (masses[it] >= 0.) {
         const xAOD::TrackParticle* TP = origTrack(vxCandidate,it);
         if (TP == nullptr) return -999999.;
-        const Trk::TrackParameters* extrPer = m_extrapolator->extrapolate(
-          Gaudi::Hive::currentContext(),
-          *TP, 
-          perigeeSurface);
-        if (extrPer == nullptr) return -999999.;
+        std::unique_ptr<const Trk::TrackParameters> extrPer =
+          m_extrapolator->extrapolate(
+            Gaudi::Hive::currentContext(), *TP, perigeeSurface);
+        if (extrPer == nullptr)
+          return -999999.;
         px += extrPer->momentum().x();
         py += extrPer->momentum().y();
         pz += extrPer->momentum().z();
         double pesq = extrPer->momentum().mag2() + masses[it]*masses[it];
         double pe = (pesq>0.) ? sqrt(pesq) : 0.;
         e += pe;
-        delete extrPer;
       }
     }
     double msq = e*e - px*px - py*py - pz*pz;
@@ -2330,7 +2328,7 @@ namespace Trk
       return -999999.;
     }
     double mass = invariantMassBeforeFitIP(vxCandidate, masses);
-    double E=0., Px=0., Py=0., Pz=0.; 
+    double E=0., Px=0., Py=0., Pz=0.;
     std::vector<double>phi(NTrk), theta(NTrk), qOverP(NTrk), charge(NTrk), e(NTrk);
     std::vector<double>dm2dphi(NTrk), dm2dtheta(NTrk), dm2dqOverP(NTrk);
     Amg::MatrixX V0_cor(5*NTrk,5*NTrk); V0_cor.setZero();
@@ -2404,7 +2402,7 @@ namespace Trk
     Amg::Vector3D vertex = vxCandidate->position();
     return invariantMassErrorBeforeFit(vxCandidate,masses,vertex);
   }
- 
+
   double V0Tools::invariantMassErrorBeforeFit(const xAOD::Vertex * vxCandidate, double posTrackMass, double negTrackMass, const Amg::Vector3D& vertex) const
   {
     std::vector<double> masses = {posTrackMass, negTrackMass};
@@ -2420,7 +2418,7 @@ namespace Trk
       return -999999.;
     }
     Trk::PerigeeSurface perigeeSurface(vertex);
-    double E=0., Px=0., Py=0., Pz=0.; 
+    double E=0., Px=0., Py=0., Pz=0.;
     std::vector<double>phi(NTrk), theta(NTrk), qOverP(NTrk), charge(NTrk), e(NTrk);
     std::vector<double>dm2dphi(NTrk), dm2dtheta(NTrk), dm2dqOverP(NTrk);
     Amg::MatrixX V0_cor(5*NTrk,5*NTrk); V0_cor.setZero();
@@ -2428,11 +2426,11 @@ namespace Trk
       if (masses[it] >= 0.) {
         const xAOD::TrackParticle* TP = origTrack(vxCandidate,it);
         if (TP == nullptr) return -999999.;
-        const Trk::TrackParameters* extrPer = m_extrapolator->extrapolate(
-          Gaudi::Hive::currentContext(),
-          *TP, 
-          perigeeSurface);
-        if (extrPer == nullptr) return -999999.;
+        std::unique_ptr<const Trk::TrackParameters> extrPer =
+          m_extrapolator->extrapolate(
+            Gaudi::Hive::currentContext(), *TP, perigeeSurface);
+        if (extrPer == nullptr)
+          return -999999.;
         const AmgSymMatrix(5)* cov_tmp = extrPer->covariance();
         V0_cor(5*it+2,5*it+2) = (*cov_tmp)(2,2);
         V0_cor(5*it+2,5*it+3) = (*cov_tmp)(2,3);
@@ -2454,7 +2452,6 @@ namespace Trk
         Px += extrPer->momentum().x();
         Py += extrPer->momentum().y();
         Pz += extrPer->momentum().z();
-        delete extrPer;
       }
     }
     double msq = E*E - Px*Px - Py*Py - Pz*Pz;
@@ -2507,7 +2504,7 @@ namespace Trk
     double dx = vert.x();
     double dy = vert.y();
     double M = invariantMass(vxCandidate, masses);
-    double E=0., Px=0., Py=0., Pz=0.; 
+    double E=0., Px=0., Py=0., Pz=0.;
     std::vector<double>dpxdqOverP(NTrk), dpxdtheta(NTrk), dpxdphi(NTrk);
     std::vector<double>dpydqOverP(NTrk), dpydtheta(NTrk), dpydphi(NTrk);
     std::vector<double>dpzdqOverP(NTrk), dpzdtheta(NTrk), dedqOverP(NTrk);
@@ -2640,7 +2637,7 @@ namespace Trk
       }
       return V0_cov;
   }
-  
+
   Amg::MatrixX V0Tools::tauMassCovariance(const xAOD::Vertex * vxCandidate, const xAOD::Vertex* vertex, const std::vector<double> &masses) const
   {
     // Tau = CONST*M*(Px*dx+Py*dy)/(PT*PT)
@@ -2657,7 +2654,7 @@ namespace Trk
     double dx = vert.x();
     double dy = vert.y();
     double M = invariantMass(vxCandidate, masses);
-    double E=0., Px=0., Py=0., Pz=0.; 
+    double E=0., Px=0., Py=0., Pz=0.;
     std::vector<double>dpxdqOverP(NTrk), dpxdtheta(NTrk), dpxdphi(NTrk);
     std::vector<double>dpydqOverP(NTrk), dpydtheta(NTrk), dpydphi(NTrk);
     std::vector<double>dpzdqOverP(NTrk), dpzdtheta(NTrk), dedqOverP(NTrk);
@@ -2771,7 +2768,7 @@ namespace Trk
     return V0_err;
   }
 
-  Amg::MatrixX * V0Tools::convertCovMatrix(const xAOD::Vertex * vxCandidate) 
+  Amg::MatrixX * V0Tools::convertCovMatrix(const xAOD::Vertex * vxCandidate)
   {
     unsigned int NTrk = vxCandidate->nTrackParticles();
     const std::vector<float> &matrix = vxCandidate->covariance();
diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/FullLinearizedTrackFactory.cxx b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/FullLinearizedTrackFactory.cxx
index d378cdede87c9cc387ece6a5e1a5b7ef0618eeb1..faad1834d5c98abb418c9000593e1f01c685c263 100755
--- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/FullLinearizedTrackFactory.cxx
+++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/FullLinearizedTrackFactory.cxx
@@ -22,18 +22,18 @@
 namespace Trk
 {
 
-  FullLinearizedTrackFactory::FullLinearizedTrackFactory(const std::string& t, const std::string& n, const IInterface*  p) : 
+  FullLinearizedTrackFactory::FullLinearizedTrackFactory(const std::string& t, const std::string& n, const IInterface*  p) :
     AthAlgTool(t,n,p),m_extrapolator("Trk::Extrapolator", this)
-  {  
-    declareProperty("Extrapolator",     m_extrapolator);  
-    declareInterface<IVertexLinearizedTrackFactory>(this);    
+  {
+    declareProperty("Extrapolator",     m_extrapolator);
+    declareInterface<IVertexLinearizedTrackFactory>(this);
   }
 
   FullLinearizedTrackFactory::~FullLinearizedTrackFactory() = default;
 
-  StatusCode FullLinearizedTrackFactory::initialize() 
-  { 
-    
+  StatusCode FullLinearizedTrackFactory::initialize()
+  {
+
     ATH_CHECK( m_extrapolator.retrieve() );
     ATH_CHECK( m_fieldCacheCondObjInputKey.initialize() );
 
@@ -46,18 +46,18 @@ namespace Trk
       theTrack.setLinTrack(linearizedTrack(theTrack.initialPerigee(),linPoint));
     else
       theTrack.setLinTrack(linearizedTrack(theTrack.initialNeutralPerigee(),linPoint));
-  } 
+  }
 
   LinearizedTrack * FullLinearizedTrackFactory::linearizedTrack(const TrackParameters *  trackPars,
                                                                  const Amg::Vector3D& linPoint) const {
     if (!trackPars) return nullptr;
-    //perigee surface        
+    //perigee surface
     Amg::Vector3D lp =linPoint;
     const PerigeeSurface perigeeSurface(lp);
-    
+
 //Remove matherial changes. Trying to understand where the perigee currently is and
 //whether we need to add or remove material during extrapolation.
-//Obvious case is the extrapolation form the perigee point: add in the direction 
+//Obvious case is the extrapolation form the perigee point: add in the direction
 //opposite to momentum; remove along the momentum.
 
     const Amg::Vector3D gMomentum  = trackPars->momentum();
@@ -67,11 +67,11 @@ namespace Trk
                               Trk::addNoise                : // parameters upstream of vertex
                               Trk::removeNoise             ; // parameters downstream of vertex -> go back
 
-    const TrackParameters* parsAtVertex = 
+    const TrackParameters* parsAtVertex =
       m_extrapolator->extrapolate(
         Gaudi::Hive::currentContext(),
-        *trackPars, 
-        perigeeSurface, Trk::anyDirection, true, Trk::pion, mode);
+        *trackPars,
+        perigeeSurface, Trk::anyDirection, true, Trk::pion, mode).release();
 
     if (dynamic_cast<const Trk::Perigee*>(parsAtVertex)==nullptr ||
         parsAtVertex->covariance()==nullptr ) {
@@ -88,32 +88,32 @@ namespace Trk
 
     if (parsAtVertex && parsAtVertex->covariance() && parsAtVertex->covariance()->determinant()<=0)
     {
-      ATH_MSG_DEBUG ("The track covariance matrix det after extrapolation is: " << parsAtVertex->covariance()->determinant() << 
+      ATH_MSG_DEBUG ("The track covariance matrix det after extrapolation is: " << parsAtVertex->covariance()->determinant() <<
                        " --> Using non extrapolated track parameters");
       delete parsAtVertex;
       parsAtVertex=trackPars->clone();
     }
 
     // positions
-    AmgVector(5) param = parsAtVertex->parameters();  
+    AmgVector(5) param = parsAtVertex->parameters();
     Amg::Vector3D expPoint = parsAtVertex->position();
-          
-    //phi_v and functions  
+
+    //phi_v and functions
     double phi_v = param(Trk::phi);
     double sin_phi_v = sin(phi_v);
     double cos_phi_v = cos(phi_v);
-    
-    //theta and functions  
+
+    //theta and functions
     double th = param(Trk::theta);
     double sin_th = sin(th);
     double tan_th = tan(th);
 
-    //q over p  
+    //q over p
     double q_ov_p = param(Trk::qOverP);
     int sgn_h = (q_ov_p<0.)? -1:1;
     Amg::Vector3D expMomentum(phi_v, th, q_ov_p);
 
-    // magnetic field  
+    // magnetic field
 
     SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{m_fieldCacheCondObjInputKey, Gaudi::Hive::currentContext()};
     const AtlasFieldCacheCondObj* fieldCondObj{*readHandle};
@@ -133,86 +133,86 @@ namespace Trk
     double rho;
     if(mField[2] == 0. || fabs(q_ov_p) <= 1e-15) rho = 1e+15 ;
     else rho =  sin_th / (q_ov_p * B_z);
-    
-    //  std:: cout<<"calculated rho "<< rho<<std::endl;  
+
+    //  std:: cout<<"calculated rho "<< rho<<std::endl;
     double X = expPoint(0) - lp.x() + rho*sin_phi_v;
     double Y = expPoint(1) - lp.y() - rho*cos_phi_v;
     double SS = (X * X + Y * Y);
     double S = sqrt(SS);
-    
+
     //calculated parameters at expansion point
     //q_over_p and theta stay constant along trajectory
     AmgVector(5) parAtExpansionPoint; parAtExpansionPoint.setZero();
     parAtExpansionPoint[0] = rho - sgn_h * S;
-    
-//calculation of phi at expansion point    
+
+//calculation of phi at expansion point
     double phiAtEp;
     int sgnY = (Y<0)? -1:1;
-    int sgnX = (X<0)? -1:1;  
+    int sgnX = (X<0)? -1:1;
     double pi = TMath::Pi();//acos(-1.);
-    
+
     if(fabs(X)>fabs(Y)) phiAtEp = sgn_h*sgnX* acos(-sgn_h * Y / S);
     else
     {
-     phiAtEp = asin(sgn_h * X / S);    
+     phiAtEp = asin(sgn_h * X / S);
      if( (sgn_h * sgnY)> 0) phiAtEp =  sgn_h * sgnX * pi - phiAtEp;
     }
-    
-    parAtExpansionPoint[2] = phiAtEp;   
-    parAtExpansionPoint[1] = expPoint(2) - lp.z() + rho*(phi_v - parAtExpansionPoint[2])/tan_th;    
+
+    parAtExpansionPoint[2] = phiAtEp;
+    parAtExpansionPoint[1] = expPoint(2) - lp.z() + rho*(phi_v - parAtExpansionPoint[2])/tan_th;
     parAtExpansionPoint[3] = th;
-    parAtExpansionPoint[4] = q_ov_p;  
+    parAtExpansionPoint[4] = q_ov_p;
 //   std::cout<<"Calculated parameters at expansion point: "<<parAtExpansionPoint<<std::endl;
 //   std::cout<<"Difference: "<<predStateParameters-parAtExpansionPoint<<std::endl;
-    
+
     //jacobian elements
     AmgMatrix(5,3) positionJacobian; positionJacobian.setZero();
 
-    //first row    
+    //first row
     positionJacobian(0,0) = -sgn_h * X / S;
     positionJacobian(0,1) = -sgn_h * Y / S;
 
-    //second row    
-    positionJacobian(1,0) =  rho * Y / (tan_th * SS); 
+    //second row
+    positionJacobian(1,0) =  rho * Y / (tan_th * SS);
     positionJacobian(1,1) = -rho * X / (tan_th * SS);
     positionJacobian(1,2) = 1.;
-    
+
     //third row
     positionJacobian(2,0) = -Y / SS;
-    positionJacobian(2,1) =  X / SS;   
+    positionJacobian(2,1) =  X / SS;
 //    std::cout<<"My position Jacobian: "<<positionJacobian<<std::endl;
-    
-    //momentum jacobian and related stuff    
+
+    //momentum jacobian and related stuff
     AmgMatrix(5,3) momentumJacobian; momentumJacobian.setZero();
     double R = X*cos_phi_v + Y * sin_phi_v;
     double Q = X*sin_phi_v - Y * cos_phi_v;
     double d_phi = parAtExpansionPoint[2] - phi_v;
-  
-    //first row   
+
+    //first row
     momentumJacobian(0,0) = -sgn_h * rho * R / S ;
-    
+
     double qOvS_red = 1 - sgn_h * Q / S;
     momentumJacobian(0,1) = qOvS_red  * rho / tan_th;
-    momentumJacobian(0,2) = - qOvS_red * rho / q_ov_p; 
-    
+    momentumJacobian(0,2) = - qOvS_red * rho / q_ov_p;
+
     //second row
     momentumJacobian(1,0) = (1 - rho*Q/SS )*rho/tan_th;
     momentumJacobian(1,1) = (d_phi + rho * R / (SS * tan_th * tan_th) ) * rho;
     momentumJacobian(1,2) = (d_phi - rho * R /SS ) * rho / (q_ov_p*tan_th);
-   
+
     //third row
-    momentumJacobian(2,0) =  rho * Q / SS; 
+    momentumJacobian(2,0) =  rho * Q / SS;
     momentumJacobian(2,1) = -rho * R / (SS*tan_th);
     momentumJacobian(2,2) =  rho * R / (q_ov_p*SS);
-    
+
     //last two rows:
     momentumJacobian(3,1) = 1.;
     momentumJacobian(4,2) = 1.;
 //    std::cout<<"My momentum Jacobian "<<momentumJacobian<<std::endl;
-    
+
     AmgVector(5) constantTerm = parAtExpansionPoint - positionJacobian*expPoint - momentumJacobian*expMomentum;
 //    std::cout<<"My constant term: "<<constantTerm<<std::endl;
-      
+
     LinearizedTrack* toreturn=new LinearizedTrack(parsAtVertex->parameters(),
                                                   *parsAtVertex->covariance(),
 						  lp,
@@ -230,11 +230,11 @@ namespace Trk
 
   LinearizedTrack * FullLinearizedTrackFactory::linearizedTrack(const NeutralParameters *  neutralPars,
                                                                 const Amg::Vector3D& linPoint) const
-  { 
+  {
     if (!neutralPars) return nullptr;
     Amg::Vector3D lp =linPoint;
     PerigeeSurface perigeeSurface(lp);
- 
+
     //no material effects for neutral particles
     /*
     const Amg::Vector3D gMomentum  = neutralPars->momentum();
@@ -245,8 +245,8 @@ namespace Trk
                                Trk::removeNoise             ; // parameters downstream of vertex -> go back
     */
     const NeutralParameters* parsAtVertex =
-      m_extrapolator->extrapolate(*neutralPars, 
-                                  perigeeSurface, Trk::anyDirection, true);
+      m_extrapolator->extrapolate(*neutralPars,
+                                  perigeeSurface, Trk::anyDirection, true).release();
 
     if (dynamic_cast<const Trk::NeutralPerigee*>(parsAtVertex)==nullptr ||
         parsAtVertex->covariance()==nullptr ) {
@@ -276,43 +276,43 @@ namespace Trk
     Amg::Vector3D expMomentum(phi_v, th, q_ov_p);
     double X = expPoint(0) - lp.x();
     double Y = expPoint(1) - lp.y();
-   
+
     AmgVector(5) parAtExpansionPoint; parAtExpansionPoint.setZero();
     parAtExpansionPoint[0] = Y*cos_phi_v-X*sin_phi_v;
-   
+
    //very easy for a neutral track!
    //phi doesn't change...
 
     double phiAtEp=phi_v;
-    parAtExpansionPoint[2] = phiAtEp;   
+    parAtExpansionPoint[2] = phiAtEp;
     parAtExpansionPoint[1] = expPoint[2] - lp.z() - 1./tan_th*(X*cos_phi_v+Y*sin_phi_v);
     parAtExpansionPoint[3] = th;
-    parAtExpansionPoint[4] = q_ov_p;  
-   
+    parAtExpansionPoint[4] = q_ov_p;
+
     //jacobian elements
     AmgMatrix(5,3) positionJacobian; positionJacobian.setZero();
 
-    //first row    
+    //first row
     positionJacobian(0,0) = -sin_phi_v;
     positionJacobian(0,1) = +cos_phi_v;
-   
-    //second raw    
+
+    //second raw
     positionJacobian(1,0) = -cos_phi_v/tan_th;
     positionJacobian(1,1) = -sin_phi_v/tan_th;
     positionJacobian(1,2) = 1.;
-   
+
 //    std::cout<<"My position Jacobian: "<<positionJacobian<<std::endl;
-    
-    //momentum jacobian and related stuff    
+
+    //momentum jacobian and related stuff
     AmgMatrix(5,3) momentumJacobian; momentumJacobian.setZero();
     momentumJacobian(2,0) = 1.;
     momentumJacobian(3,1) = 1.;
     momentumJacobian(4,2) = 1.;
 //    std::cout<<"My momentum Jacobian "<<momentumJacobian<<std::endl;
-    
+
     AmgVector(5) constantTerm = parAtExpansionPoint - positionJacobian*expPoint - momentumJacobian*expMomentum;
 //    std::cout<<"My constant term: "<<constantTerm<<std::endl;
-      
+
     LinearizedTrack* toreturn=new LinearizedTrack(parsAtVertex->parameters(),
                                                   *parsAtVertex->covariance(),
 						  lp,
@@ -326,7 +326,7 @@ namespace Trk
     delete parsAtVertex;
     //return new linearized track
     return toreturn;
-  } 
-  
-  
+  }
+
+
 }//end of namespace definitions
diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/ImpactPoint3dEstimator.cxx b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/ImpactPoint3dEstimator.cxx
index f6d77684b4c66c71e268a937788210d836e69a0d..ba3d8a3476dab16be980f34934f9a5c3b9efdcb9 100755
--- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/ImpactPoint3dEstimator.cxx
+++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/ImpactPoint3dEstimator.cxx
@@ -24,21 +24,21 @@
 namespace Trk
 {
 
-  ImpactPoint3dEstimator::ImpactPoint3dEstimator(const std::string& t, const std::string& n, const IInterface*  p) : 
+  ImpactPoint3dEstimator::ImpactPoint3dEstimator(const std::string& t, const std::string& n, const IInterface*  p) :
     base_class(t,n,p),
     m_extrapolator(""),
     m_maxiterations(20),
     m_precision(1e-10)//DeltaPhi
-  {   
+  {
     declareProperty("Extrapolator",m_extrapolator);
     declareProperty("MaxIterations",m_maxiterations);
     declareProperty("Precision",m_precision);
   }
-  
+
   ImpactPoint3dEstimator::~ImpactPoint3dEstimator() = default;
-  
-  StatusCode ImpactPoint3dEstimator::initialize() 
-  { 
+
+  StatusCode ImpactPoint3dEstimator::initialize()
+  {
     if (!m_extrapolator.empty())  {
       ATH_CHECK( m_extrapolator.retrieve() );
     } else {
@@ -49,8 +49,8 @@ namespace Trk
     ATH_MSG_DEBUG( "Initialize successful"  );
     return StatusCode::SUCCESS;
   }
-  
-  StatusCode ImpactPoint3dEstimator::finalize() 
+
+  StatusCode ImpactPoint3dEstimator::finalize()
   {
     ATH_MSG_DEBUG( "Finalize successful"  );
     return StatusCode::SUCCESS;
@@ -129,26 +129,23 @@ namespace Trk
       ATH_MSG_DEBUG("Magnetic field in the Z direction is 0 --  propagate like a straight line");
       return Estimate3dIPNoCurvature(trackPerigee, theVertex, distance);
     }
-
-
+    
     const Trk::Perigee* thePerigee=dynamic_cast<const Trk::Perigee*>(trackPerigee);
     if (thePerigee==nullptr)
     {
-      ATH_MSG_DEBUG( " ImpactPoint3dEstimator didn't get a Perigee* as ParametersBase*: cast not possible. Need to EXTRAPOLATE...");
-      
-      /* run-1 code had not been adapted for Neutral parameters:
-      const TrackParameters* ch_params = dynamic_cast<const TrackParameters*>(trackPerigee);
-      if (ch_params == 0) {
-        msg(MSG::ERROR) << " Cannot cast to charged track parameters. Neutrals are not supported... " << endmsg;
-        return 0;
-      }*/
-
+      ATH_MSG_DEBUG(
+        " ImpactPoint3dEstimator didn't get a Perigee* as ParametersBase*: "
+        "cast not possible. Need to EXTRAPOLATE...");
       Trk::PerigeeSurface perigeeSurface(*theVertex);
-      thePerigee=dynamic_cast<const Trk::Perigee*>(m_extrapolator->extrapolateDirectly(
-          Gaudi::Hive::currentContext(),
-          *trackPerigee,
-          perigeeSurface));
-      if (thePerigee == nullptr) return nullptr;
+      std::unique_ptr<const Trk::TrackParameters> tmp =
+        m_extrapolator->extrapolateDirectly(
+          Gaudi::Hive::currentContext(), *trackPerigee, perigeeSurface);
+      if (tmp && tmp->associatedSurface().type() == Trk::SurfaceType::Perigee) {
+        thePerigee = static_cast<const Trk::Perigee*>(tmp.release());
+      }
+      if (thePerigee == nullptr){
+        return nullptr;
+      }
     }
 
     ATH_MSG_VERBOSE( " Now running ImpactPoint3dEstimator::Estimate3dIP" );
@@ -205,13 +202,13 @@ namespace Trk
 
       derivative=(x0-xc)*(-Rt*sinphiactual)+(y0-yc)*Rt*cosphiactual+(z0-zc-Rt*phiactual*cottheta)*(-Rt*cottheta);
       secderivative=Rt*(-(x0-xc)*cosphiactual-(y0-yc)*sinphiactual+Rt*cottheta*cottheta);
-#ifdef IMPACTPOINT3DESTIMATOR_DEBUG            
+#ifdef IMPACTPOINT3DESTIMATOR_DEBUG
       ATH_MSG_VERBOSE( "derivative is: " << derivative << " sec derivative is: " << secderivative  );
 #endif
 
       deltaphi=-derivative/secderivative;
 
-#ifdef IMPACTPOINT3DESTIMATOR_DEBUG            
+#ifdef IMPACTPOINT3DESTIMATOR_DEBUG
       std::cout << std::setprecision(25) << "deltaphi: " << deltaphi << std::endl;
 #endif
 
@@ -219,7 +216,7 @@ namespace Trk
       cosphiactual=-std::sin(phiactual);
       sinphiactual=std::cos(phiactual);
 
-#ifdef IMPACTPOINT3DESTIMATOR_DEBUG            
+#ifdef IMPACTPOINT3DESTIMATOR_DEBUG
       ATH_MSG_VERBOSE( "derivative is: " << derivative << " sec derivative is: " << secderivative  );
       std::cout << std::setprecision(25) << std::sqrt(std::pow(x0-xc+Rt*cosphiactual,2)+
                                                       std::pow(y0-yc+Rt*sinphiactual,2)+
@@ -235,7 +232,7 @@ namespace Trk
 
       ncycle+=1;
       if (ncycle>m_maxiterations||std::abs(deltaphi)<m_precision) {
-#ifdef IMPACTPOINT3DESTIMATOR_DEBUG            
+#ifdef IMPACTPOINT3DESTIMATOR_DEBUG
         ATH_MSG_VERBOSE( "found minimum at: " << phiactual  );
 #endif
         isok=true;
@@ -282,13 +279,13 @@ namespace Trk
 
     Amg::Transform3D thePlane(DeltaRcorrected, YDir, MomentumDir, *theVertex);
 
-#ifdef IMPACTPOINT3DESTIMATOR_DEBUG            
+#ifdef IMPACTPOINT3DESTIMATOR_DEBUG
     std::cout << "the translation is, directly from Transform3d: " << thePlane.getTranslation() << endmsg;
 #endif
     return std::make_unique<PlaneSurface>(thePlane);
   }//end of estimate 3dIP method
 
-  bool 
+  bool
   ImpactPoint3dEstimator::addIP3dAtaPlane(VxTrackAtVertex & vtxTrack,const Amg::Vector3D & vertex) const
   {
     if (vtxTrack.initialPerigee()) {
@@ -308,9 +305,9 @@ namespace Trk
     }
     return false;
   }
-  
 
-  const Trk::AtaPlane * 
+
+  const Trk::AtaPlane *
   ImpactPoint3dEstimator::IP3dAtaPlane(VxTrackAtVertex & vtxTrack,const Amg::Vector3D & vertex) const
   {
     if (!vtxTrack.initialPerigee() && vtxTrack.initialNeutralPerigee())
@@ -326,7 +323,7 @@ namespace Trk
       ATH_MSG_WARNING( " ImpactPoint3dEstimator failed to find minimum distance between track and vertex seed: " << err.p  );
       return nullptr;
     }
-    if(!theSurfaceAtIP){ 
+    if(!theSurfaceAtIP){
       ATH_MSG_WARNING( " ImpactPoint3dEstimator failed to find minimum distance and returned 0 " );
       return nullptr;
     }
@@ -334,20 +331,19 @@ namespace Trk
     ATH_MSG_VERBOSE( "Original perigee was: " << *(vtxTrack.initialPerigee())  );
     ATH_MSG_VERBOSE( "The resulting surface is: " << *theSurfaceAtIP  );
 #endif
-   const auto *pTrackPar = m_extrapolator->extrapolate(
+   const auto* pTrackPar = m_extrapolator->extrapolate(
      Gaudi::Hive::currentContext(),
      *(vtxTrack.initialPerigee()),
-     *theSurfaceAtIP);
+     *theSurfaceAtIP).release();
    if (const Trk::AtaPlane* res = dynamic_cast<const Trk::AtaPlane *>(pTrackPar); res){
      return res;
    }
-   delete pTrackPar;
    ATH_MSG_WARNING("TrackParameters ptr returned from extrapolate could not be cast to Trk::AtaPlane* in IP3dAtaPlane(..)");
    return nullptr;
   }
-  
 
-  const Trk::NeutralAtaPlane * 
+
+  const Trk::NeutralAtaPlane *
   ImpactPoint3dEstimator::IP3dNeutralAtaPlane(const NeutralParameters * initNeutPerigee,const Amg::Vector3D & vertex) const
   {
     std::unique_ptr<PlaneSurface> theSurfaceAtIP;
@@ -369,10 +365,13 @@ namespace Trk
     ATH_MSG_VERBOSE( "The resulting surface is: " << *theSurfaceAtIP  );
 #endif
 
-    const Trk::NeutralAtaPlane* res = dynamic_cast<const Trk::NeutralAtaPlane *>
-      (m_extrapolator->extrapolate(*initNeutPerigee,*theSurfaceAtIP));
+    const Trk::NeutralAtaPlane* res = nullptr;
+    std::unique_ptr<const Trk::NeutralParameters> tmp =  m_extrapolator->extrapolate(*initNeutPerigee,*theSurfaceAtIP);
+    if(dynamic_cast<const Trk::NeutralAtaPlane*> (tmp.get())){
+      res = static_cast<const Trk::NeutralAtaPlane*> (tmp.release());
+    }
    return res;
   }
-  
+
 
 }
diff --git a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/TrackToVertexIPEstimator.cxx b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/TrackToVertexIPEstimator.cxx
index f4c99c75c549230d7353aabc732a95dd5f53d862..b1f1cec2fb64d140cb30d7c9f4d7f556994b996e 100644
--- a/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/TrackToVertexIPEstimator.cxx
+++ b/Tracking/TrkVertexFitter/TrkVertexFitterUtils/src/TrackToVertexIPEstimator.cxx
@@ -17,9 +17,9 @@ namespace Trk
 {
 
  TrackToVertexIPEstimator::TrackToVertexIPEstimator(const std::string& t, const std::string& n, const IInterface*  p):
-  AthAlgTool(t,n,p) 
+  AthAlgTool(t,n,p)
  {
-  declareInterface<ITrackToVertexIPEstimator>(this);    
+  declareInterface<ITrackToVertexIPEstimator>(this);
  }
 
  TrackToVertexIPEstimator::~TrackToVertexIPEstimator()= default;
@@ -28,77 +28,77 @@ namespace Trk
  {
 
 //uploading the corresponding tools
-//extrapolator    
-  if ( m_extrapolator.retrieve().isFailure() ) 
+//extrapolator
+  if ( m_extrapolator.retrieve().isFailure() )
   {
    ATH_MSG_FATAL( "Failed to retrieve tool " << m_extrapolator );
    return StatusCode::FAILURE;
-  } 
+  }
   ATH_MSG_INFO( "Retrieved tool " << m_extrapolator );
-  
 
-//updator 
-  if ( m_Updator.retrieve().isFailure() ) 
+
+//updator
+  if ( m_Updator.retrieve().isFailure() )
   {
     ATH_MSG_FATAL( "Failed to retrieve tool " << m_Updator );
     return StatusCode::FAILURE;
-  } 
+  }
   ATH_MSG_INFO( "Retrieved tool " << m_Updator );
-  
-  
+
+
 //linearized track factory
-  if ( m_linFactory.retrieve().isFailure() ) 
+  if ( m_linFactory.retrieve().isFailure() )
   {
     ATH_MSG_FATAL("Failed to retrieve tool " << m_linFactory );
     return StatusCode::FAILURE;
-  } 
+  }
   ATH_MSG_INFO( "Retrieved tool " << m_linFactory );
-  
-  
-   return StatusCode::SUCCESS;  
+
+
+   return StatusCode::SUCCESS;
  }//end of initialize method
-    
+
 
  const  ImpactParametersAndSigma * TrackToVertexIPEstimator::estimate(const xAOD::TrackParticle * track, const xAOD::Vertex * vtx, bool doRemoval) const
  {
   if(track && vtx)
   {
-   return estimate(&(track->perigeeParameters()),&(track->perigeeParameters()),vtx,doRemoval); 
+   return estimate(&(track->perigeeParameters()),&(track->perigeeParameters()),vtx,doRemoval);
   }
   ATH_MSG_INFO( "Empty TrackParticle or Vertex pointer passed. Returning zero " );
   return nullptr;
   //end of track particle validity check
  }//end of method using track particles
- 
+
  const  ImpactParametersAndSigma * TrackToVertexIPEstimator::estimate(const xAOD::TrackParticle * track, const xAOD::TrackParticle * newtrack, const xAOD::Vertex * vtx, bool doRemoval) const
  {
   if(track && vtx)
   {
-    return estimate(&(track->perigeeParameters()),&(newtrack->perigeeParameters()),vtx,doRemoval); 
+    return estimate(&(track->perigeeParameters()),&(newtrack->perigeeParameters()),vtx,doRemoval);
   }
    ATH_MSG_INFO( "Empty TrackParticle or Vertex pointer passed. Returning zero " );
    return nullptr;
   //end of track particle validity check
  }//end of method using track particles
- 
+
 
 
 
  const  ImpactParametersAndSigma * TrackToVertexIPEstimator::estimate(const TrackParameters * track, const xAOD::Vertex * vtx, bool doRemoval) const
  {
    if(track && vtx){
-     return estimate(track,track,vtx,doRemoval); 
+     return estimate(track,track,vtx,doRemoval);
    }
    ATH_MSG_INFO( "Empty TrackParticle or Vertex pointer passed. Returning zero " );
    return nullptr;
    //end of track particle validity check
- 
- }//end of parameterBase estimate method     
-   
+
+ }//end of parameterBase estimate method
+
  const  ImpactParametersAndSigma * TrackToVertexIPEstimator::estimate(const TrackParameters * track, const TrackParameters * newtrack, const xAOD::Vertex * vtx, bool doRemoval) const
  {
- 
-   if (vtx==nullptr) 
+
+   if (vtx==nullptr)
    {
      ATH_MSG_WARNING("Vertex is zero pointer. Will not estimate IP of track.");
      return nullptr;
@@ -121,27 +121,28 @@ namespace Trk
      delete newVertex;
      newVertex=nullptr;
    }
-   
+
    return IPandSigma;
 
- }//end of parameterBase estimate method   
+ }//end of parameterBase estimate method
+
 
-   
  const  ImpactParametersAndSigma * TrackToVertexIPEstimator::calculate(const TrackParameters * track, const xAOD::Vertex& vtx) const
- { 
-  //estimating the d0 and its significance by propagating the trajectory state towards 
+ {
+  //estimating the d0 and its significance by propagating the trajectory state towards
   //the vertex position. By this time the vertex should NOT contain this trajectory anymore
-  
-  //estrapolating to the  perigee of the reconstructed vertex  
+
+  //estrapolating to the  perigee of the reconstructed vertex
   const Amg::Vector3D & lp = vtx.position();
   PerigeeSurface perigeeSurface(lp);
-  const  Trk::Perigee * extrapolatedParameters =dynamic_cast<const Trk::Perigee *>(m_extrapolator->extrapolate(
-      Gaudi::Hive::currentContext(),
-      *track,
-      perigeeSurface));
+  const Trk::Perigee* extrapolatedParameters =
+    dynamic_cast<const Trk::Perigee*>(
+      m_extrapolator
+        ->extrapolate(Gaudi::Hive::currentContext(), *track, perigeeSurface)
+        .release());
   if (extrapolatedParameters && extrapolatedParameters->covariance()) {
-  
-    //actual calculation of d0 and sigma.  
+
+    //actual calculation of d0 and sigma.
     const AmgVector(5) & par = extrapolatedParameters->parameters();
     const double d0  = par[Trk::d0];
     const double z0  = par[Trk::z0];
@@ -149,16 +150,16 @@ namespace Trk
     const double theta = par[Trk::theta];
 
     AmgSymMatrix(2) vrtXYCov = vtx.covariancePosition().block<2,2>(0,0);
-   
+
     //   std::cout<<"Vertex covariance: "<<vtx.errorPosition().covariance()<<std::endl;
     //   std::cout<<"Vertex covariance sub: "<<vrtXYCov<<std::endl;
-   
+
     const AmgSymMatrix(5) & perigeeCov = *(extrapolatedParameters->covariance());
     //   std::cout<<"Perigee covariance: "<<perigeeCov<<std::endl;
-   
-    //d0phi->cartesian Jacobian  
+
+    //d0phi->cartesian Jacobian
     Amg::Vector2D d0JacXY(-sin(phi), cos(phi));
-   
+
     //  std::cout<<"To cartesian jacobian "<<d0PhiCart<<std::endl;
     //  std::cout<<" - d0*cos(phi)"<< - d0*cos(phi)<<std::endl;
 
@@ -198,30 +199,30 @@ namespace Trk
    }
    else
    {
-     msg(MSG::WARNING) << " The contribution to z0_err: " << vrtZZCov << " from PV is negative: critical error in PV error matrix! Removing contribution from PV ... "  << endmsg;     
+     msg(MSG::WARNING) << " The contribution to z0_err: " << vrtZZCov << " from PV is negative: critical error in PV error matrix! Removing contribution from PV ... "  << endmsg;
      newIPandSigma->IPz0SinTheta=z0*sin(theta);
      double temp = (IPz0JacZ0Theta.transpose()*(covPerigeeZ0Theta*IPz0JacZ0Theta));
      newIPandSigma->sigmaz0SinTheta=sqrt(temp);
      newIPandSigma->PVsigmaz0SinTheta=0;
-     
+
      newIPandSigma->IPz0 = z0;
      newIPandSigma->sigmaz0 = std::sqrt( perigeeCov(Trk::z0,Trk::z0) );
      newIPandSigma->PVsigmaz0 = 0;
    }
 
    //   std::cout<<"Calculated sigma: "<<sqrt(sigmaM)<<std::endl;
-  
+
    //checking the other way of calculating the errors
    // Calculation using the projection
    //   double  s_d0_test = extrapolatedParameters->localErrorMatrix().covValue(Trk::d0)+
    //   sin(phi) * sin(phi) * vtx.errorPosition().covValue(Trk::x) +
-   //   cos(phi) * cos(phi) * vtx.errorPosition().covValue(Trk::y) - 
+   //   cos(phi) * cos(phi) * vtx.errorPosition().covValue(Trk::y) -
    //   2.* sin(phi) * cos(phi) * vtx.errorPosition().covValue(Trk::x, Trk::y);
-   //   std::cout<<"new sigma: "<<sqrt(s_d0_test)<<std::endl; 
-   
+   //   std::cout<<"new sigma: "<<sqrt(s_d0_test)<<std::endl;
+
    delete extrapolatedParameters;
    return newIPandSigma;
-  } 
+  }
     ATH_MSG_DEBUG ("Cannot extrapolate the trajectory state. Returning null. ");
     return nullptr;
   //end of successfull extrapolation check
@@ -246,25 +247,23 @@ namespace Trk
   {
     const Amg::Vector3D & lp = primaryVertex.position();
     PerigeeSurface perigeeSurface(lp);
-    
-    const  Trk::TrackParameters * extrapolatedParameters = m_extrapolator->extrapolate(
-      Gaudi::Hive::currentContext(),
-      track,
-      perigeeSurface);
-    
+
+    std::unique_ptr<const Trk::TrackParameters> extrapolatedParameters =
+      m_extrapolator->extrapolate(
+        Gaudi::Hive::currentContext(), track, perigeeSurface);
+
     if (!extrapolatedParameters) return 0.;
 
     const Amg::Vector3D & primaryPos=primaryVertex.position();
     const Amg::Vector3D & trackPos=extrapolatedParameters->position();
     const Amg::Vector3D & trackMom=extrapolatedParameters->momentum();
-    
+
     double sign=(jetMomentum.cross(trackMom)).dot(trackMom.cross(primaryPos-trackPos));
-    delete extrapolatedParameters;
-    
+
     return sign>=0.?1.:-1;
   }
 
-  
+
 
   double TrackToVertexIPEstimator::get2DLifetimeSignOfTrack(const TrackParameters & track,
                                                             const CLHEP::Hep3Vector & jetMomentum,
@@ -280,19 +279,17 @@ namespace Trk
   {
     const Amg::Vector3D & lp = primaryVertex.position();
     PerigeeSurface perigeeSurface(lp);
-    
-    const  Trk::TrackParameters * extrapolatedParameters =  m_extrapolator->extrapolate(
-      Gaudi::Hive::currentContext(),
-      track,
-      perigeeSurface);
-    
+
+    std::unique_ptr<const Trk::TrackParameters> extrapolatedParameters =
+      m_extrapolator->extrapolate(
+        Gaudi::Hive::currentContext(), track, perigeeSurface);
+
     if (!extrapolatedParameters) return 0.;
 
     double trackD0  = extrapolatedParameters->parameters()[Trk::d0];
     double trackPhi = extrapolatedParameters->parameters()[Trk::phi];
     double vs = sinf( atan2(jetMomentum.y(),jetMomentum.x()) - trackPhi )*trackD0;
-   
-    delete extrapolatedParameters;
+
     return (vs>=0. ? 1. : -1.);
   }
 
@@ -314,11 +311,11 @@ namespace Trk
 
     const Amg::Vector3D & lp = primaryVertex.position();
     PerigeeSurface perigeeSurface(lp);
-    
-    const  Trk::TrackParameters * extrapolatedParameters = m_extrapolator->extrapolate(Gaudi::Hive::currentContext(),
-                                                                                       track,
-                                                                                       perigeeSurface);
-    
+
+    std::unique_ptr<const Trk::TrackParameters> extrapolatedParameters =
+      m_extrapolator->extrapolate(
+        Gaudi::Hive::currentContext(), track, perigeeSurface);
+
     if (!extrapolatedParameters) return 0.;
 
     double trackTheta  = extrapolatedParameters->parameters()[Trk::theta];
@@ -326,7 +323,6 @@ namespace Trk
     double trackEta = -logf(tanf(trackTheta/2.));
     double jetEta = jetMomentum.eta();
     double zs = (jetEta - trackEta)*trackZ0;
-    delete extrapolatedParameters;
     return (zs>=0. ? 1. : -1.);
   }
 
@@ -334,21 +330,21 @@ namespace Trk
 /*
   StatusCode TrackToVertexIPEstimator::queryInterface(const InterfaceID& riid, void** ppvIf)
   {
-  
-  
+
+
     if(interfaceID() == riid){
       *ppvIf = dynamic_cast< TrackToVertexIPEstimator* > (this);
-    } 
+    }
     else if(ITrackToVertexIPEstimator::interfaceID() == riid){
       *ppvIf = dynamic_cast<ITrackToVertexIPEstimator*> (this);
-    } 
+    }
     else{
       return AthAlgTool::queryInterface(riid, ppvIf);
     }
-    
+
     addRef();
     return StatusCode::SUCCESS;
-     
+
   }
 */
 
@@ -362,10 +358,10 @@ const xAOD::Vertex * TrackToVertexIPEstimator::getUnbiasedVertex(const xAOD::Tra
   }
    msg(MSG::INFO) << "Empty xAOD::TrackParticle pointer passed. Returning zero " << endmsg;
    return nullptr;
-  //end of track particle validity check   
+  //end of track particle validity check
  }
 
-const xAOD::Vertex * TrackToVertexIPEstimator::getUnbiasedVertex(const TrackParameters * track, const xAOD::Vertex * vtx ) const 
+const xAOD::Vertex * TrackToVertexIPEstimator::getUnbiasedVertex(const TrackParameters * track, const xAOD::Vertex * vtx ) const
  {
    if (!track) {
      msg(MSG::INFO) << "Empty Trk::TrackParameter pointer passed. Returning zero " << endmsg;
@@ -381,7 +377,7 @@ const xAOD::Vertex * TrackToVertexIPEstimator::getUnbiasedVertex(const TrackPara
       ATH_MSG_DEBUG("This vertex has no associated tracks. Normal if beam spot is used. Vertex already unbiased");
       return new xAOD::Vertex(*vtx);
     }
-   
+
    //create new vertex for output
    xAOD::Vertex *outputVertex = new xAOD::Vertex(*vtx);
    outputVertex->clearTracks(); //remove all tracks -> will add them back one by one
@@ -421,7 +417,7 @@ const xAOD::Vertex * TrackToVertexIPEstimator::getUnbiasedVertex(const TrackPara
        }
        //now update vertex position removing the linearized track, and do not add the track back to the output vertex
        const IVertexUpdator::positionUpdateOutcome & reducedVertex = m_Updator->positionUpdate(*vtx, linTrack, trackWeight,IVertexUpdator::removeTrack);
-       
+
        //calculate updated chi2
        double chi2 = vtx->chiSquared();
        double trk_chi = m_Updator->trackParametersChi2( reducedVertex, linTrack );
@@ -446,7 +442,7 @@ const xAOD::Vertex * TrackToVertexIPEstimator::getUnbiasedVertex(const TrackPara
 	 outputVertex->vxTrackAtVertex().push_back(vtx->vxTrackAtVertex()[itrk]);//will clone everything inside -> output vertex owns all the memory
        }
      }
-   }  
+   }
    return outputVertex;
 
  }
diff --git a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx
index 01281881b8e1c303ae4c92dc06e8e2a4a66ba51b..94237ba79d66eeb7161b30d1f6aa6d6e6ff4e406 100644
--- a/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx
+++ b/Trigger/TrigAlgorithms/TrigFastTrackFinder/src/TrigFastTrackFinder.cxx
@@ -2926,13 +2926,13 @@ const Trk::Perigee* TrigFastTrackFinder::extrapolateDisTrackToBS(Trk::Track* t,
 
    Amg::Vector3D gp(vtx_x, vtx_y, vtx_z);
    Trk::PerigeeSurface persf(gp);
-   const Trk::Perigee* vertexPerigee   = 0;
+   const Trk::Perigee* vertexPerigee = nullptr;
    const Trk::Perigee* trackparPerigee = t->perigeeParameters();
-   vertexPerigee = dynamic_cast<const Trk::Perigee*>(m_extrapolator->extrapolateDirectly(
-       Gaudi::Hive::currentContext(),
-       (*trackparPerigee),
-       persf));
-
+   std::unique_ptr<const Trk::TrackParameters> tmp =
+     m_extrapolator->extrapolateDirectly(Gaudi::Hive::currentContext(), (*trackparPerigee), persf);
+   if (tmp && tmp->associatedSurface().type() == Trk::SurfaceType::Perigee) {
+     vertexPerigee = static_cast<const Trk::Perigee*>(tmp.release());
+   }
    return vertexPerigee;
 }
 
diff --git a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/MuonMatchingTool.cxx b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/MuonMatchingTool.cxx
index a4020eebf4381f15470296676e18e74b4bfa8b18..9e8f2eb2e366acbb9077137e60ae5d0225052b21 100644
--- a/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/MuonMatchingTool.cxx
+++ b/Trigger/TrigMonitoring/TrigMuonMonitoringMT/src/MuonMatchingTool.cxx
@@ -394,7 +394,7 @@ const Trk::TrackParameters* MuonMatchingTool :: extTrackToTGC( const xAOD::Track
                                                                   *disc,
                                                                   Trk::anyDirection,
                                                                   boundaryCheck,
-                                                                  Trk::muon);
+                                                                  Trk::muon).release();
 
   ATH_MSG_DEBUG("param=" << param 
 		<< " eta=" << ((param) ? param->position().eta() : 0) 
@@ -415,7 +415,7 @@ const Trk::TrackParameters* MuonMatchingTool :: extTrackToRPC( const xAOD::Track
                                                                   *barrel,
                                                                   Trk::anyDirection,
                                                                   boundaryCheck,
-                                                                  Trk::muon);
+                                                                  Trk::muon).release();
   return param;
 }
 
diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackPropagationHelper.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackPropagationHelper.cxx
index d37cac78d6d3cd3ac02ae69343649154f667e22c..41c2a4938f53a03d273f552f204ccec124078b9a 100644
--- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackPropagationHelper.cxx
+++ b/graphics/VP1/VP1Systems/VP1TrackSystems/src/TrackPropagationHelper.cxx
@@ -315,7 +315,7 @@ bool TrackPropagationHelper::makePointsCharged( std::vector<Amg::Vector3D >& poi
         const Trk::TrackParameters*  trackPar = extrapolator->extrapolate(ctx,
                                                                           *trackParam,
                                                                           **bSurfsIt,
-                                                                          Trk::alongMomentum,true,hypo); // change this to extrapolate current param to surface.
+                                                                          Trk::alongMomentum,true,hypo).release(); // change this to extrapolate current param to surface.
 
         if (trackPar){
           messageVerbose("Extrapolation succeeded");
@@ -359,7 +359,7 @@ const Trk::TrackParameters * TrackPropagationHelper::Imp::extrapolateToNewPar( T
     newpars = extrapolator->extrapolate(Gaudi::Hive::currentContext(),
                                         *prevpars,
                                         surf,
-                                        Trk::alongMomentum,false,hypo); // change this to extrapolate current param to surface.
+                                        Trk::alongMomentum,false,hypo).release(); // change this to extrapolate current param to surface.
   } catch (const std::runtime_error& e) {
     theclass->message("Failure trying to use extrapolator for track (Exception thrown: " + QString(e.what())+")");
     return nullptr;