From d94583e0ce207eb40fc7279fd671ee4efa6aaaba Mon Sep 17 00:00:00 2001
From: abarton <Adam.Edward.Barton@cern.ch>
Date: Mon, 10 Dec 2018 09:53:04 +0000
Subject: [PATCH] migrate SiSpacePointsSeedTool_xk away from using BeamCondSvc

---
 .../SiSpacePointsSeedTool_xk/CMakeLists.txt   |  2 +-
 .../SiSpacePointsSeedMaker_ATLxk.h            |  6 ++----
 .../SiSpacePointsSeedMaker_BeamGas.h          |  6 ++----
 .../SiSpacePointsSeedMaker_HeavyIon.h         |  7 +++----
 .../SiSpacePointsSeedMaker_ITK.h              |  7 +++----
 .../SiSpacePointsSeedMaker_LowMomentum.h      |  6 ++----
 .../SiSpacePointsSeedMaker_Trigger.h          |  6 ++----
 .../src/SiSpacePointsSeedMaker_ATLxk.cxx      | 20 +++++++-----------
 .../src/SiSpacePointsSeedMaker_BeamGas.cxx    | 20 +++++++-----------
 .../src/SiSpacePointsSeedMaker_HeavyIon.cxx   | 20 +++++++-----------
 .../src/SiSpacePointsSeedMaker_ITK.cxx        | 21 +++++++------------
 .../SiSpacePointsSeedMaker_LowMomentum.cxx    | 20 +++++++-----------
 .../src/SiSpacePointsSeedMaker_Trigger.cxx    | 20 +++++++-----------
 13 files changed, 57 insertions(+), 104 deletions(-)

diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/CMakeLists.txt b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/CMakeLists.txt
index 2a455486964..2dc0408e48c 100644
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/CMakeLists.txt
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/CMakeLists.txt
@@ -9,7 +9,7 @@ atlas_subdir( SiSpacePointsSeedTool_xk )
 atlas_depends_on_subdirs( PUBLIC
                           Control/AthenaBaseComps
                           GaudiKernel
-                          InnerDetector/InDetConditions/InDetBeamSpotService
+                          InnerDetector/InDetConditions/BeamSpotConditionsData
                           InnerDetector/InDetDetDescr/InDetReadoutGeometry
                           InnerDetector/InDetRecEvent/InDetPrepRawData
                           InnerDetector/InDetRecEvent/SiSpacePointsSeed
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ATLxk.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ATLxk.h
index 3da0ff0baea..e7f14a2a951 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ATLxk.h
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ATLxk.h
@@ -24,7 +24,7 @@
 #include "InDetRecToolInterfaces/ISiSpacePointsSeedMaker.h"
 #include "TrkSpacePoint/SpacePointContainer.h" 
 #include "TrkSpacePoint/SpacePointOverlapCollection.h"
-
+#include "BeamSpotConditionsData/BeamSpotData.h"
 #include "SiSpacePointsSeedTool_xk/SiSpacePointForSeed.h"
 #include "SiSpacePointsSeedTool_xk/SiSpacePointsProSeed.h" 
 #include <iosfwd>
@@ -34,7 +34,6 @@
 #include <vector>
 
 class MsgStream   ;
-class IBeamCondSvc;
 
 namespace Trk {
   class IPRD_AssociationTool;
@@ -123,7 +122,7 @@ namespace InDet {
       ServiceHandle<MagField::IMagFieldSvc>  m_fieldServiceHandle ;
       MagField::IMagFieldSvc*                m_fieldService{}       ;
         
-      IBeamCondSvc*               p_beam {}                         ;
+      SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
       bool                        m_pixel{}                         ;
       bool                        m_sct{}                           ;
       bool                        m_endlist{}                       ;
@@ -247,7 +246,6 @@ namespace InDet {
       // Space points container
       ///////////////////////////////////////////////////////////////////
  
-      std::string                        m_beamconditions         ;
       SG::ReadHandle<SpacePointContainer>         m_spacepointsSCT         ;
       SG::ReadHandle<SpacePointContainer>         m_spacepointsPixel       ;
       SG::ReadHandle<SpacePointOverlapCollection> m_spacepointsOverlap     ;
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_BeamGas.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_BeamGas.h
index 544e2d29618..c4e7172f663 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_BeamGas.h
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_BeamGas.h
@@ -24,7 +24,7 @@
 #include "InDetRecToolInterfaces/ISiSpacePointsSeedMaker.h"
 #include "TrkSpacePoint/SpacePointContainer.h" 
 #include "TrkSpacePoint/SpacePointOverlapCollection.h"
-
+#include "BeamSpotConditionsData/BeamSpotData.h"
 #include "SiSpacePointsSeedTool_xk/SiSpacePointForSeed.h"
 #include <list>
 #include <map>
@@ -32,7 +32,6 @@
 #include <iosfwd>
 
 class MsgStream   ;
-class IBeamCondSvc;
 
 namespace Trk {
 
@@ -123,7 +122,7 @@ namespace InDet {
       MagField::IMagFieldSvc*                m_fieldService{}       ;
 
       ToolHandle<Trk::IPRD_AssociationTool>  m_assoTool           ;
-      IBeamCondSvc* p_beam {}                                       ;
+      SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
 
       bool                        m_pixel {}                        ;
       bool                        m_sct  {}                         ;
@@ -218,7 +217,6 @@ namespace InDet {
       ///////////////////////////////////////////////////////////////////
       
 
-      std::string                        m_beamconditions         ;
       SG::ReadHandle<SpacePointContainer>         m_spacepointsSCT         ;
       SG::ReadHandle<SpacePointContainer>         m_spacepointsPixel       ;
       SG::ReadHandle<SpacePointOverlapCollection> m_spacepointsOverlap     ;
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_HeavyIon.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_HeavyIon.h
index e5b53045b47..edbbf652958 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_HeavyIon.h
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_HeavyIon.h
@@ -24,7 +24,7 @@
 #include "InDetRecToolInterfaces/ISiSpacePointsSeedMaker.h"
 #include "TrkSpacePoint/SpacePointContainer.h" 
 #include "TrkSpacePoint/SpacePointOverlapCollection.h"
-
+#include "BeamSpotConditionsData/BeamSpotData.h"
 #include "SiSpacePointsSeedTool_xk/SiSpacePointForSeed.h"
 #include <list>
 #include <vector>
@@ -32,7 +32,7 @@
 #include <iosfwd>
 
 class MsgStream   ;
-class IBeamCondSvc;
+
 
 namespace InDet {
 
@@ -120,7 +120,7 @@ namespace InDet {
       ServiceHandle<MagField::IMagFieldSvc>  m_fieldServiceHandle ;
       MagField::IMagFieldSvc*                m_fieldService {}      ;
 
-      IBeamCondSvc* p_beam{}                                        ;
+      SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
       bool                        m_pixel  {}                       ;
       bool                        m_sct    {}                       ;
       bool                        m_endlist {}                      ;
@@ -222,7 +222,6 @@ namespace InDet {
       // Space points container
       ///////////////////////////////////////////////////////////////////
 
-      std::string                        m_beamconditions         ;
       SG::ReadHandle<SpacePointContainer>         m_spacepointsSCT         ;
       SG::ReadHandle<SpacePointContainer>         m_spacepointsPixel       ;
       SG::ReadHandle<SpacePointOverlapCollection> m_spacepointsOverlap     ;
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ITK.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ITK.h
index 387b1a65b77..f5ded00128a 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ITK.h
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ITK.h
@@ -24,7 +24,7 @@
 #include "InDetRecToolInterfaces/ISiSpacePointsSeedMaker.h"
 #include "TrkSpacePoint/SpacePointContainer.h" 
 #include "TrkSpacePoint/SpacePointOverlapCollection.h"
-
+#include "BeamSpotConditionsData/BeamSpotData.h"
 #include "SiSpacePointsSeedTool_xk/SiSpacePointForSeedITK.h"
 #include "SiSpacePointsSeedTool_xk/SiSpacePointsProSeedITK.h" 
 #include <list>
@@ -34,7 +34,7 @@
 #include <iosfwd>
 
 class MsgStream   ;
-class IBeamCondSvc;
+
 
 namespace Trk {
   class IPRD_AssociationTool;
@@ -118,7 +118,7 @@ namespace InDet {
       ServiceHandle<MagField::IMagFieldSvc>  m_fieldServiceHandle ;
       MagField::IMagFieldSvc*                m_fieldService{}       ;
         
-      IBeamCondSvc* p_beam {}                                       ;
+      SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
       bool                        m_pixel {}                        ;
       bool                        m_sct  {}                         ;
       bool                        m_endlist {}                      ;
@@ -247,7 +247,6 @@ namespace InDet {
       // Space points container
       ///////////////////////////////////////////////////////////////////
 
-      std::string                        m_beamconditions         ;
       SG::ReadHandle<SpacePointContainer>         m_spacepointsSCT         ;
       SG::ReadHandle<SpacePointContainer>         m_spacepointsPixel       ;
       SG::ReadHandle<SpacePointOverlapCollection> m_spacepointsOverlap     ;
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_LowMomentum.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_LowMomentum.h
index 78e0afef89d..2d180da3c9b 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_LowMomentum.h
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_LowMomentum.h
@@ -24,14 +24,13 @@
 #include "InDetRecToolInterfaces/ISiSpacePointsSeedMaker.h"
 #include "TrkSpacePoint/SpacePointContainer.h" 
 #include "TrkSpacePoint/SpacePointOverlapCollection.h"
-
+#include "BeamSpotConditionsData/BeamSpotData.h"
 #include "SiSpacePointsSeedTool_xk/SiSpacePointForSeed.h"
 #include <list>
 #include <map>
 #include <vector>
 
 class MsgStream   ;
-class IBeamCondSvc;
 
 namespace Trk {
   class IPRD_AssociationTool; 
@@ -123,7 +122,7 @@ namespace InDet {
       ServiceHandle<MagField::IMagFieldSvc>  m_fieldServiceHandle ;
       MagField::IMagFieldSvc*                m_fieldService {}      ;
 
-      IBeamCondSvc* p_beam  {}                                      ;
+      SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
       bool                        m_pixel  {}                       ;
       bool                        m_sct    {}                       ;
       bool                        m_endlist  {}                     ;
@@ -218,7 +217,6 @@ namespace InDet {
       ///////////////////////////////////////////////////////////////////
       
 
-      std::string                        m_beamconditions         ;
       SG::ReadHandle<SpacePointContainer>         m_spacepointsSCT         ;
       SG::ReadHandle<SpacePointContainer>         m_spacepointsPixel       ;
       SG::ReadHandle<SpacePointOverlapCollection> m_spacepointsOverlap     ;
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Trigger.h b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Trigger.h
index 053450e7583..3c8fab6d6f8 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Trigger.h
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Trigger.h
@@ -24,13 +24,12 @@
 #include "InDetRecToolInterfaces/ISiSpacePointsSeedMaker.h"
 #include "TrkSpacePoint/SpacePointContainer.h" 
 #include "TrkSpacePoint/SpacePointOverlapCollection.h"
-
+#include "BeamSpotConditionsData/BeamSpotData.h"
 #include "SiSpacePointsSeedTool_xk/SiSpacePointForSeed.h"
 #include <list>
 #include <vector>
 #include <map>
 class MsgStream   ;
-class IBeamCondSvc;
 
 namespace InDet {
 
@@ -116,7 +115,7 @@ namespace InDet {
       ServiceHandle<MagField::IMagFieldSvc>  m_fieldServiceHandle ;
       MagField::IMagFieldSvc*                m_fieldService  {}     ;
 
-      IBeamCondSvc* p_beam {}                                       ;
+      SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };
       bool                        m_pixel  {}                       ;
       bool                        m_sct    {}                       ;
       bool                        m_endlist  {}                     ;
@@ -223,7 +222,6 @@ namespace InDet {
       // Space points container
       ///////////////////////////////////////////////////////////////////
 
-      std::string                        m_beamconditions         ;
       SG::ReadHandle<SpacePointContainer>         m_spacepointsSCT         ;
       SG::ReadHandle<SpacePointContainer>         m_spacepointsPixel       ;
       SG::ReadHandle<SpacePointOverlapCollection> m_spacepointsOverlap     ;
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx
index 4d2b0cd2865..f33574b7b9e 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ATLxk.cxx
@@ -18,7 +18,6 @@
 
 #include "TrkToolInterfaces/IPRD_AssociationTool.h"
 #include "SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ATLxk.h"
-#include "InDetBeamSpotService/IBeamCondSvc.h"
 
 
 ///////////////////////////////////////////////////////////////////
@@ -94,7 +93,6 @@ InDet::SiSpacePointsSeedMaker_ATLxk::SiSpacePointsSeedMaker_ATLxk
 //  m_spacepointsSCTname     = "SCT_SpacePoints"   ;
 //  m_spacepointsPixelname   = "PixelSpacePoints"  ;
 //  m_spacepointsOverlapname = "OverlapSpacePoints"; 
-  m_beamconditions         = "BeamCondSvc"       ;
 //  m_spacepointsSCT         = 0                   ;
 //  m_spacepointsPixel       = 0                   ;
 //  m_spacepointsOverlap     = 0                   ;
@@ -140,7 +138,6 @@ InDet::SiSpacePointsSeedMaker_ATLxk::SiSpacePointsSeedMaker_ATLxk
   declareProperty("SpacePointsSCTName"    ,m_spacepointsSCT    );
   declareProperty("SpacePointsPixelName"  ,m_spacepointsPixel  );
   declareProperty("SpacePointsOverlapName",m_spacepointsOverlap);
-  declareProperty("BeamConditionsService" ,m_beamconditions        ); 
   declareProperty("useOverlapSpCollection", m_useOverlap           );
   declareProperty("UseAssociationTool"    ,m_useassoTool           ); 
   declareProperty("MagFieldSvc"           , m_fieldServiceHandle   );
@@ -189,10 +186,7 @@ StatusCode InDet::SiSpacePointsSeedMaker_ATLxk::initialize()
 
   // Get beam geometry
   //
-  p_beam = 0;
-  if(!m_beamconditions.empty()) {
-    sc = service(m_beamconditions,p_beam);
-  }
+  ATH_CHECK(m_beamSpotKey.initialize());
 
   // Get magnetic field service
   //
@@ -705,7 +699,7 @@ MsgStream& InDet::SiSpacePointsSeedMaker_ATLxk::dumpConditions( MsgStream& out )
   std::string s3; for(int i=0; i<n; ++i) s3.append(" "); s3.append("|");
   n     = 42-m_spacepointsOverlap.name().size();
   std::string s4; for(int i=0; i<n; ++i) s4.append(" "); s4.append("|");
-  n     = 42-m_beamconditions.size();
+  n     = 42-m_beamSpotKey.key().size();
   std::string s5; for(int i=0; i<n; ++i) s5.append(" "); s5.append("|");
 
 
@@ -717,7 +711,7 @@ MsgStream& InDet::SiSpacePointsSeedMaker_ATLxk::dumpConditions( MsgStream& out )
      <<std::endl;
   out<<"| Overlap  space points   | "<<m_spacepointsOverlap.name()<<s4
      <<std::endl;
-  out<<"| BeamConditionsService   | "<<m_beamconditions<<s5
+  out<<"| BeamConditionsService   | "<<m_beamSpotKey.key()<<s5
      <<std::endl;
   out<<"| usePixel                | "
      <<std::setw(12)<<m_pixel 
@@ -1149,11 +1143,11 @@ void InDet::SiSpacePointsSeedMaker_ATLxk::buildFrameWork()
 
 void InDet::SiSpacePointsSeedMaker_ATLxk::buildBeamFrameWork() 
 { 
-  if(!p_beam) return;
+  SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
 
-  Amg::Vector3D cb =     p_beam->beamPos();
-  double     tx = tan(p_beam->beamTilt(0));
-  double     ty = tan(p_beam->beamTilt(1));
+  const Amg::Vector3D &cb =     beamSpotHandle->beamPos();
+  double     tx = tan(beamSpotHandle->beamTilt(0));
+  double     ty = tan(beamSpotHandle->beamTilt(1));
 
   double ph   = atan2(ty,tx);
   double th   = acos(1./sqrt(1.+tx*tx+ty*ty));
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_BeamGas.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_BeamGas.cxx
index 6798dd6873e..0d0a737a4c0 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_BeamGas.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_BeamGas.cxx
@@ -17,7 +17,6 @@
 
 #include "TrkToolInterfaces/IPRD_AssociationTool.h"
 #include "SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_BeamGas.h"
-#include "InDetBeamSpotService/IBeamCondSvc.h"
 
 
 ///////////////////////////////////////////////////////////////////
@@ -82,7 +81,6 @@ InDet::SiSpacePointsSeedMaker_BeamGas::SiSpacePointsSeedMaker_BeamGas
   m_zbeam[0]  = 0.      ; m_zbeam[1]= 0.; m_zbeam[2]=0.; m_zbeam[3]=1.;
   
 
-  m_beamconditions         = "BeamCondSvc"       ;
 //  m_spacepointsSCT         = 0                   ;
 //  m_spacepointsPixel       = 0                   ;
 //  m_spacepointsOverlap     = 0                   ;
@@ -116,7 +114,6 @@ InDet::SiSpacePointsSeedMaker_BeamGas::SiSpacePointsSeedMaker_BeamGas
   declareProperty("SpacePointsSCTName"    ,m_spacepointsSCT    );
   declareProperty("SpacePointsPixelName"  ,m_spacepointsPixel  );
   declareProperty("SpacePointsOverlapName",m_spacepointsOverlap);
-  declareProperty("BeamConditionsService" ,m_beamconditions        ); 
   declareProperty("useOverlapSpCollection", m_useOverlap           );
   declareProperty("UseAssociationTool"    ,m_useassoTool           ); 
   declareProperty("MagFieldSvc"           , m_fieldServiceHandle   );
@@ -164,10 +161,7 @@ StatusCode InDet::SiSpacePointsSeedMaker_BeamGas::initialize()
 
   // Get beam geometry
   //
-  p_beam = 0;
-  if(m_beamconditions!="") {
-    sc = service(m_beamconditions,p_beam);
-  }
+  ATH_CHECK(m_beamSpotKey.initialize());
 
   // Get magnetic field service
   //
@@ -542,7 +536,7 @@ MsgStream& InDet::SiSpacePointsSeedMaker_BeamGas::dumpConditions( MsgStream& out
   std::string s3; for(int i=0; i<n; ++i) s3.append(" "); s3.append("|");
   n     = 42-m_spacepointsOverlap.name().size();
   std::string s4; for(int i=0; i<n; ++i) s4.append(" "); s4.append("|");
-  n     = 42-m_beamconditions.size();
+  n     = 42-m_beamSpotKey.key().size();
   std::string s5; for(int i=0; i<n; ++i) s5.append(" "); s5.append("|");
 
 
@@ -554,7 +548,7 @@ MsgStream& InDet::SiSpacePointsSeedMaker_BeamGas::dumpConditions( MsgStream& out
      <<std::endl;
   out<<"| Overlap  space points   | "<<m_spacepointsOverlap.name() <<s4
      <<std::endl;
-  out<<"| BeamConditionsService   | "<<m_beamconditions<<s5
+  out<<"| BeamConditionsService   | "<<m_beamSpotKey.key()<<s5
      <<std::endl;
   out<<"| usePixel                | "
      <<std::setw(12)<<m_pixel 
@@ -874,11 +868,11 @@ void InDet::SiSpacePointsSeedMaker_BeamGas::buildFrameWork()
 
 void InDet::SiSpacePointsSeedMaker_BeamGas::buildBeamFrameWork() 
 { 
-  if(!p_beam) return;
+  SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
 
-  Amg::Vector3D cb =     p_beam->beamPos();
-  double     tx = tan(p_beam->beamTilt(0));
-  double     ty = tan(p_beam->beamTilt(1));
+  const Amg::Vector3D &cb =     beamSpotHandle->beamPos();
+  double     tx = tan(beamSpotHandle->beamTilt(0));
+  double     ty = tan(beamSpotHandle->beamTilt(1));
 
   double ph   = atan2(ty,tx);
   double th   = acos(1./sqrt(1.+tx*tx+ty*ty));
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_HeavyIon.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_HeavyIon.cxx
index 92937e6fe9b..af7d7b0cfec 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_HeavyIon.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_HeavyIon.cxx
@@ -16,7 +16,6 @@
 #include <iomanip>
 
 #include "SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_HeavyIon.h"
-#include "InDetBeamSpotService/IBeamCondSvc.h"
 
 ///////////////////////////////////////////////////////////////////
 // Constructor
@@ -82,7 +81,6 @@ InDet::SiSpacePointsSeedMaker_HeavyIon::SiSpacePointsSeedMaker_HeavyIon
   m_zbeam[0]  = 0.      ; m_zbeam[1]= 0.; m_zbeam[2]=0.; m_zbeam[3]=1.;
   
 
-  m_beamconditions         = "BeamCondSvc"       ;
 //  m_spacepointsSCT         = 0                   ;
 //  m_spacepointsPixel       = 0                   ;
 //  m_spacepointsOverlap     = 0                   ;
@@ -121,7 +119,6 @@ InDet::SiSpacePointsSeedMaker_HeavyIon::SiSpacePointsSeedMaker_HeavyIon
   declareProperty("SpacePointsSCTName"    ,m_spacepointsSCT    );
   declareProperty("SpacePointsPixelName"  ,m_spacepointsPixel  );
   declareProperty("SpacePointsOverlapName",m_spacepointsOverlap);
-  declareProperty("BeamConditionsService" ,m_beamconditions        ); 
   declareProperty("useOverlapSpCollection", m_useOverlap           );
   declareProperty("MagFieldSvc"           , m_fieldServiceHandle   );
 }
@@ -168,10 +165,7 @@ StatusCode InDet::SiSpacePointsSeedMaker_HeavyIon::initialize()
 
   // Get beam geometry
   //
-  p_beam = 0;
-  if(m_beamconditions!="") {
-    sc = service(m_beamconditions,p_beam);
-  }
+  ATH_CHECK(m_beamSpotKey.initialize());
 
   // Get magnetic field service
   //
@@ -518,7 +512,7 @@ MsgStream& InDet::SiSpacePointsSeedMaker_HeavyIon::dumpConditions( MsgStream& ou
   std::string s3; for(int i=0; i<n; ++i) s3.append(" "); s3.append("|");
   n     = 42-m_spacepointsOverlap.name().size();
   std::string s4; for(int i=0; i<n; ++i) s4.append(" "); s4.append("|");
-  n     = 42-m_beamconditions.size();
+  n     = 42-m_beamSpotKey.key().size();
   std::string s5; for(int i=0; i<n; ++i) s5.append(" "); s5.append("|");
 
 
@@ -530,7 +524,7 @@ MsgStream& InDet::SiSpacePointsSeedMaker_HeavyIon::dumpConditions( MsgStream& ou
      <<std::endl;
   out<<"| Overlap  space points   | "<<m_spacepointsOverlap.name()<<s4
      <<std::endl;
-  out<<"| BeamConditionsService   | "<<m_beamconditions<<s5
+  out<<"| BeamConditionsService   | "<<m_beamSpotKey.key()<<s5
      <<std::endl;
   out<<"| usePixel                | "
      <<std::setw(12)<<m_pixel 
@@ -942,11 +936,11 @@ void InDet::SiSpacePointsSeedMaker_HeavyIon::buildFrameWork()
 
 void InDet::SiSpacePointsSeedMaker_HeavyIon::buildBeamFrameWork() 
 { 
-  if(!p_beam) return;
+  SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
 
-  Amg::Vector3D cb =     p_beam->beamPos();
-  double     tx = tan(p_beam->beamTilt(0));
-  double     ty = tan(p_beam->beamTilt(1));
+  const Amg::Vector3D &cb =     beamSpotHandle->beamPos();
+  double     tx = tan(beamSpotHandle->beamTilt(0));
+  double     ty = tan(beamSpotHandle->beamTilt(1));
 
   double ph   = atan2(ty,tx);
   double th   = acos(1./sqrt(1.+tx*tx+ty*ty));
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ITK.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ITK.cxx
index 390085ee4f3..f7f008d2084 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ITK.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_ITK.cxx
@@ -18,7 +18,6 @@
 
 #include "TrkToolInterfaces/IPRD_AssociationTool.h"
 #include "SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_ITK.h"
-#include "InDetBeamSpotService/IBeamCondSvc.h"
 
 ///////////////////////////////////////////////////////////////////
 // Constructor
@@ -96,8 +95,6 @@ InDet::SiSpacePointsSeedMaker_ITK::SiSpacePointsSeedMaker_ITK
   m_zbeam[0]  = 0.      ; m_zbeam[1]= 0.; m_zbeam[2]=0.; m_zbeam[3]=1.;
   
 
-  m_beamconditions         = "BeamCondSvc"       ;
-
 
   declareInterface<ISiSpacePointsSeedMaker>(this);
 
@@ -142,7 +139,6 @@ InDet::SiSpacePointsSeedMaker_ITK::SiSpacePointsSeedMaker_ITK
   declareProperty("SpacePointsSCTName"    ,m_spacepointsSCT        );
   declareProperty("SpacePointsPixelName"  ,m_spacepointsPixel      );
   declareProperty("SpacePointsOverlapName",m_spacepointsOverlap    );
-  declareProperty("BeamConditionsService" ,m_beamconditions        ); 
   declareProperty("useOverlapSpCollection",m_useOverlap            );
   declareProperty("UseAssociationTool"    ,m_useassoTool           ); 
   declareProperty("MagFieldSvc"           ,m_fieldServiceHandle    );
@@ -193,10 +189,7 @@ StatusCode InDet::SiSpacePointsSeedMaker_ITK::initialize()
 
   // Get beam geometry
   //
-  p_beam = 0;
-  if(m_beamconditions!="") {
-    sc = service(m_beamconditions,p_beam);
-  }
+  ATH_CHECK(m_beamSpotKey.initialize());
 
   // Get magnetic field service
   //
@@ -665,7 +658,7 @@ MsgStream& InDet::SiSpacePointsSeedMaker_ITK::dumpConditions( MsgStream& out ) c
   std::string s3; for(int i=0; i<n; ++i) s3.append(" "); s3.append("|");
   n     = 42-m_spacepointsOverlap.name().size();
   std::string s4; for(int i=0; i<n; ++i) s4.append(" "); s4.append("|");
-  n     = 42-m_beamconditions.size();
+  n     = 42-m_beamSpotKey.key().size();
   std::string s5; for(int i=0; i<n; ++i) s5.append(" "); s5.append("|");
 
 
@@ -677,7 +670,7 @@ MsgStream& InDet::SiSpacePointsSeedMaker_ITK::dumpConditions( MsgStream& out ) c
      <<std::endl;
   out<<"| Overlap  space points   | "<<m_spacepointsOverlap.name()<<s4
      <<std::endl;
-  out<<"| BeamConditionsService   | "<<m_beamconditions<<s5
+  out<<"| BeamConditionsService   | "<<m_beamSpotKey.key()<<s5
      <<std::endl;
   out<<"| usePixel                | "
      <<std::setw(12)<<m_pixel 
@@ -1111,11 +1104,11 @@ void InDet::SiSpacePointsSeedMaker_ITK::buildFrameWork()
 
 void InDet::SiSpacePointsSeedMaker_ITK::buildBeamFrameWork() 
 { 
-  if(!p_beam) return;
+  SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
 
-  Amg::Vector3D cb =     p_beam->beamPos();
-  double     tx = tan(p_beam->beamTilt(0));
-  double     ty = tan(p_beam->beamTilt(1));
+  const Amg::Vector3D &cb =     beamSpotHandle->beamPos();
+  double     tx = tan(beamSpotHandle->beamTilt(0));
+  double     ty = tan(beamSpotHandle->beamTilt(1));
 
   double ph   = atan2(ty,tx);
   double th   = acos(1./sqrt(1.+tx*tx+ty*ty));
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_LowMomentum.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_LowMomentum.cxx
index 7bb8d21bb47..5f8bf943ce0 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_LowMomentum.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_LowMomentum.cxx
@@ -17,7 +17,6 @@
 
 #include "TrkToolInterfaces/IPRD_AssociationTool.h"
 #include "SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_LowMomentum.h"
-#include "InDetBeamSpotService/IBeamCondSvc.h"
 
 
 ///////////////////////////////////////////////////////////////////
@@ -85,7 +84,6 @@ InDet::SiSpacePointsSeedMaker_LowMomentum::SiSpacePointsSeedMaker_LowMomentum
 //  m_spacepointsSCTname     = "SCT_SpacePoints"   ;
 //  m_spacepointsPixelname   = "PixelSpacePoints"  ;
 //  m_spacepointsOverlapname = "OverlapSpacePoints"; 
-  m_beamconditions         = "BeamCondSvc"       ;
 //  m_spacepointsSCT         = 0                   ;
 //  m_spacepointsPixel       = 0                   ;
 //  m_spacepointsOverlap     = 0                   ;
@@ -120,7 +118,6 @@ InDet::SiSpacePointsSeedMaker_LowMomentum::SiSpacePointsSeedMaker_LowMomentum
   declareProperty("SpacePointsSCTName"    ,m_spacepointsSCT    );
   declareProperty("SpacePointsPixelName"  ,m_spacepointsPixel  );
   declareProperty("SpacePointsOverlapName",m_spacepointsOverlap);
-  declareProperty("BeamConditionsService" ,m_beamconditions        ); 
   declareProperty("useOverlapSpCollection", m_useOverlap           );
   declareProperty("UseAssociationTool"    ,m_useassoTool           ); 
   declareProperty("MagFieldSvc"           , m_fieldServiceHandle   );
@@ -168,10 +165,7 @@ StatusCode InDet::SiSpacePointsSeedMaker_LowMomentum::initialize()
 
   // Get beam geometry
   //
-  p_beam = 0;
-  if(m_beamconditions!="") {
-    sc = service(m_beamconditions,p_beam);
-  }
+  ATH_CHECK(m_beamSpotKey.initialize());
 
   // Get magnetic field service
   //
@@ -514,7 +508,7 @@ MsgStream& InDet::SiSpacePointsSeedMaker_LowMomentum::dumpConditions( MsgStream&
   std::string s3; for(int i=0; i<n; ++i) s3.append(" "); s3.append("|");
   n     = 42-m_spacepointsOverlap.name().size();
   std::string s4; for(int i=0; i<n; ++i) s4.append(" "); s4.append("|");
-  n     = 42-m_beamconditions.size();
+  n     = 42-m_beamSpotKey.key().size();
   std::string s5; for(int i=0; i<n; ++i) s5.append(" "); s5.append("|");
 
   out<<"|---------------------------------------------------------------------|"
@@ -525,7 +519,7 @@ MsgStream& InDet::SiSpacePointsSeedMaker_LowMomentum::dumpConditions( MsgStream&
      <<std::endl;
   out<<"| Overlap  space points   | "<<m_spacepointsOverlap.name()<<s4
      <<std::endl;
-  out<<"| BeamConditionsService   | "<<m_beamconditions<<s5
+  out<<"| BeamConditionsService   | "<<m_beamSpotKey.key()<<s5
      <<std::endl;
   out<<"| usePixel                | "
      <<std::setw(12)<<m_pixel 
@@ -891,11 +885,11 @@ void InDet::SiSpacePointsSeedMaker_LowMomentum::buildFrameWork()
 
 void InDet::SiSpacePointsSeedMaker_LowMomentum::buildBeamFrameWork() 
 { 
-  if(!p_beam) return;
+  SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
 
-  Amg::Vector3D cb =     p_beam->beamPos();
-  double     tx = tan(p_beam->beamTilt(0));
-  double     ty = tan(p_beam->beamTilt(1));
+  const Amg::Vector3D &cb =     beamSpotHandle->beamPos();
+  double     tx = tan(beamSpotHandle->beamTilt(0));
+  double     ty = tan(beamSpotHandle->beamTilt(1));
 
   double ph   = atan2(ty,tx);
   double th   = acos(1./sqrt(1.+tx*tx+ty*ty));
diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx
index 55f07888911..ac16f482e42 100755
--- a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx
+++ b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/src/SiSpacePointsSeedMaker_Trigger.cxx
@@ -14,7 +14,6 @@
 
 #include <ostream>
 #include <iomanip>
-#include "InDetBeamSpotService/IBeamCondSvc.h"
 
 #include "SiSpacePointsSeedTool_xk/SiSpacePointsSeedMaker_Trigger.h"
 
@@ -84,7 +83,6 @@ InDet::SiSpacePointsSeedMaker_Trigger::SiSpacePointsSeedMaker_Trigger
 //  m_spacepointsSCTname     = "SCT_SpacePoints"   ;
 //  m_spacepointsPixelname   = "PixelSpacePoints"  ;
 //  m_spacepointsOverlapname = "OverlapSpacePoints"; 
-  m_beamconditions         = "BeamCondSvc"       ;
 //  m_spacepointsSCT         = 0                   ;
 //  m_spacepointsPixel       = 0                   ;
 //  m_spacepointsOverlap     = 0                   ;
@@ -123,7 +121,6 @@ InDet::SiSpacePointsSeedMaker_Trigger::SiSpacePointsSeedMaker_Trigger
   declareProperty("SpacePointsSCTName"    ,m_spacepointsSCT        );
   declareProperty("SpacePointsPixelName"  ,m_spacepointsPixel      );
   declareProperty("SpacePointsOverlapName",m_spacepointsOverlap    );
-  declareProperty("BeamConditionsService" ,m_beamconditions        ); 
   declareProperty("useOverlapSpCollection", m_useOverlap           );
   declareProperty("MagFieldSvc"           , m_fieldServiceHandle   );
 }
@@ -170,10 +167,7 @@ StatusCode InDet::SiSpacePointsSeedMaker_Trigger::initialize()
 
   // Get beam geometry
   //
-  p_beam = 0;
-  if(m_beamconditions!="") {
-    sc = service(m_beamconditions,p_beam);
-  }
+  ATH_CHECK(m_beamSpotKey.initialize());
 
   // Get magnetic field service
   //
@@ -565,7 +559,7 @@ MsgStream& InDet::SiSpacePointsSeedMaker_Trigger::dumpConditions( MsgStream& out
   std::string s3; for(int i=0; i<n; ++i) s3.append(" "); s3.append("|");
   n     = 42-m_spacepointsOverlap.name().size();
   std::string s4; for(int i=0; i<n; ++i) s4.append(" "); s4.append("|");
-  n     = 42-m_beamconditions.size();
+  n     = 42-m_beamSpotKey.key().size();
   std::string s5; for(int i=0; i<n; ++i) s5.append(" "); s5.append("|");
 
 
@@ -577,7 +571,7 @@ MsgStream& InDet::SiSpacePointsSeedMaker_Trigger::dumpConditions( MsgStream& out
      <<std::endl;
   out<<"| Overlap  space points   | "<<m_spacepointsOverlap.name() <<s4
      <<std::endl;
-  out<<"| BeamConditionsService   | "<<m_beamconditions<<s5
+  out<<"| BeamConditionsService   | "<<m_beamSpotKey.key()<<s5
      <<std::endl;
   out<<"| usePixel                | "
      <<std::setw(12)<<m_pixel 
@@ -995,11 +989,11 @@ void InDet::SiSpacePointsSeedMaker_Trigger::buildFrameWork()
 
 void InDet::SiSpacePointsSeedMaker_Trigger::buildBeamFrameWork() 
 { 
-  if(!p_beam) return;
+  SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
 
-  Amg::Vector3D cb =     p_beam->beamPos();
-  double     tx = tan(p_beam->beamTilt(0));
-  double     ty = tan(p_beam->beamTilt(1));
+  const Amg::Vector3D &cb =     beamSpotHandle->beamPos();
+  double     tx = tan(beamSpotHandle->beamTilt(0));
+  double     ty = tan(beamSpotHandle->beamTilt(1));
 
   double ph   = atan2(ty,tx);
   double th   = acos(1./sqrt(1.+tx*tx+ty*ty));
-- 
GitLab