diff --git a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/CMakeLists.txt b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/CMakeLists.txt index 35df023212b0ecc2d9aba315e8c8b04188c89074..3c5aba13481ce913e2a1578548d703c35dde1bcb 100644 --- a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/CMakeLists.txt +++ b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/CMakeLists.txt @@ -13,7 +13,7 @@ atlas_depends_on_subdirs( PUBLIC Control/AthenaBaseComps Event/EventInfo Event/xAOD/xAODEventInfo - InnerDetector/InDetConditions/InDetBeamSpotService + InnerDetector/InDetConditions/BeamSpotConditionsData Tracking/TrkEvent/TrkEventPrimitives Tracking/TrkEvent/VxVertex Trigger/TrigAnalysis/TrigAnalysisInterfaces diff --git a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotReader.cxx b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotReader.cxx index 72f14ee54b8072e77400e5174c8572829f5686ff..a7cee61fc80e18f282a8d26c518e300796cd89b7 100644 --- a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotReader.cxx +++ b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotReader.cxx @@ -7,27 +7,19 @@ #include "VxVertex/VxCandidate.h" //#include "TrkEventPrimitives/VertexType.h" -#include "InDetBeamSpotService/IBeamCondSvc.h" -#include "GaudiKernel/ToolHandle.h" - #include "EventInfo/EventID.h" InDet::InDetBeamSpotReader::InDetBeamSpotReader(const std::string& name, ISvcLocator* pSvcLocator): - AthAlgorithm(name, pSvcLocator), - m_toolSvc("ToolSvc",name), - m_beamSpotSvc("BeamCondSvc",name) + AthReentrantAlgorithm(name, pSvcLocator) { - declareProperty("ToolSvc", m_toolSvc); - declareProperty("BeamCondSvc", m_beamSpotSvc); } StatusCode InDet::InDetBeamSpotReader::initialize() { ATH_MSG_DEBUG( "in initialize()" ); - ATH_CHECK( m_toolSvc.retrieve() ); - ATH_CHECK( m_beamSpotSvc.retrieve() ); + ATH_CHECK( m_beamSpotKey.initialize() ); ATH_CHECK( m_eventInfo.initialize() ); ATH_CHECK( m_vxContainer.initialize() ); @@ -35,26 +27,27 @@ StatusCode InDet::InDetBeamSpotReader::initialize() { return StatusCode::SUCCESS; } -StatusCode InDet::InDetBeamSpotReader::execute(){ +StatusCode InDet::InDetBeamSpotReader::execute_r(const EventContext& ctx) const { ATH_MSG_DEBUG( "in execute()"); //get the set of - SG::ReadHandle<EventInfo> eventInfo(m_eventInfo); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey, ctx }; + SG::ReadHandle<EventInfo> eventInfo(m_eventInfo, ctx); EventID* eventID = eventInfo->event_ID(); ATH_MSG_INFO( "In event " << (*eventID) ); ATH_MSG_INFO("BeamSpot Position: \n " - << m_beamSpotSvc->beamPos() ); + << beamSpotHandle->beamPos() ); ATH_MSG_INFO("BeamSpot Sigma\n\t" - << m_beamSpotSvc->beamSigma(0) << "\n\t" - << m_beamSpotSvc->beamSigma(1) << "\n\t" - << m_beamSpotSvc->beamSigma(2) << "\n\t"); + << beamSpotHandle->beamSigma(0) << "\n\t" + << beamSpotHandle->beamSigma(1) << "\n\t" + << beamSpotHandle->beamSigma(2) << "\n\t"); ATH_MSG_INFO("BeamSpot Tilt\n\t" - << m_beamSpotSvc->beamTilt(0) << "\n\t" - << m_beamSpotSvc->beamTilt(1) << "\n\t"); + << beamSpotHandle->beamTilt(0) << "\n\t" + << beamSpotHandle->beamTilt(1) << "\n\t"); ATH_MSG_INFO("Beamspot position at PV z-position"); //get list of PVs - SG::ReadHandle<VxContainer> importedVxContainer(m_vxContainer); + SG::ReadHandle<VxContainer> importedVxContainer(m_vxContainer, ctx); VxContainer::const_iterator vtxItr; for(vtxItr=importedVxContainer->begin(); vtxItr!=importedVxContainer->end(); ++vtxItr) { @@ -63,12 +56,12 @@ StatusCode InDet::InDetBeamSpotReader::execute(){ << (*vtxItr)->recVertex().position() ); double z = (*vtxItr)->recVertex().position().z(); if (msgLvl(MSG::INFO)) ATH_MSG_INFO("\n\t" - << m_beamSpotSvc->beamPos()(0) - + (z - m_beamSpotSvc->beamPos()(2)) - *m_beamSpotSvc->beamTilt(0) << "\n\t" - << m_beamSpotSvc->beamPos()(1) - + (z - m_beamSpotSvc->beamPos()(2)) - *m_beamSpotSvc->beamTilt(1) ); + << beamSpotHandle->beamPos()(0) + + (z - beamSpotHandle->beamPos()(2)) + *beamSpotHandle->beamTilt(0) << "\n\t" + << beamSpotHandle->beamPos()(1) + + (z - beamSpotHandle->beamPos()(2)) + *beamSpotHandle->beamTilt(1) ); } return StatusCode::SUCCESS; diff --git a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotReader.h b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotReader.h index be8402d25b4e4edb28cd67c9abd0f86fe991b3b4..3be3e5f167a2051514311fca8c3499e139e79326 100644 --- a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotReader.h +++ b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotReader.h @@ -10,36 +10,29 @@ ////////////////////////////// -#include <string> -#include <vector> -#include <map> - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ServiceHandle.h" +#include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "StoreGate/ReadHandleKey.h" #include "VxVertex/VxContainer.h" #include "EventInfo/EventInfo.h" - -class IBeamCondSvc; +#include "BeamSpotConditionsData/BeamSpotData.h" namespace InDet { /** An example class of how to read beamspot position. Currently there must be a valid beamspot entry for the IOV of data that is being read. Otherwise an error will occur. */ - class InDetBeamSpotReader : public AthAlgorithm { + class InDetBeamSpotReader : public AthReentrantAlgorithm { public: //Standard constructor and methods InDetBeamSpotReader (const std::string& name, ISvcLocator* pSvcLocator); - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); + StatusCode initialize() override; + StatusCode execute_r(const EventContext& ctx) const override; + StatusCode finalize() override; private: - ServiceHandle<IToolSvc> m_toolSvc; - ServiceHandle<IBeamCondSvc> m_beamSpotSvc; + SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; SG::ReadHandleKey<EventInfo> m_eventInfo {this, "EvtInfo", "EventInfo", "EventInfo name"}; diff --git a/InnerDetector/InDetConditions/InDetBeamSpotService/share/BeamCondSvc.py b/InnerDetector/InDetConditions/InDetBeamSpotService/share/BeamCondSvc.py index 2ea28978f3f69e25d494a7ce912e613d6e5818b2..1e6da0db0527bf55d721e7061202917c2bdaf5ac 100644 --- a/InnerDetector/InDetConditions/InDetBeamSpotService/share/BeamCondSvc.py +++ b/InnerDetector/InDetConditions/InDetBeamSpotService/share/BeamCondSvc.py @@ -22,3 +22,11 @@ if not DetFlags.simulate.any_on() : from BeamSpotConditions.BeamSpotConditionsConf import BeamSpotCondAlg condSeq += BeamSpotCondAlg( "BeamSpotCondAlg" ) +#Code to help transition to MT system, remove once this package is removed +if not DetFlags.simulate.any_on() : + from AthenaCommon.AlgSequence import AthSequencer + condSeq = AthSequencer("AthCondSeq") + if not hasattr(condSeq, "BeamSpotCondAlg"): + from BeamSpotConditions.BeamSpotConditionsConf import BeamSpotCondAlg + condSeq += BeamSpotCondAlg( "BeamSpotCondAlg" ) + diff --git a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/CMakeLists.txt b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/CMakeLists.txt index c2873cde193f988ff52928ec129bfcc0fc9d3367..8b7c9697af27bc8182f6630c3df82d7bfe7d933f 100644 --- a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/CMakeLists.txt +++ b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/CMakeLists.txt @@ -10,7 +10,7 @@ atlas_depends_on_subdirs( PUBLIC Control/AthenaBaseComps Control/StoreGate GaudiKernel - InnerDetector/InDetConditions/InDetBeamSpotService + InnerDetector/InDetConditions/BeamSpotConditionsData InnerDetector/InDetRecTools/InDetRecToolInterfaces Tracking/TrkDetDescr/TrkGeometry Tracking/TrkDetDescr/TrkSurfaces diff --git a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/SiSPSeededTrackFinder/SiSPSeededTrackFinder.h b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/SiSPSeededTrackFinder/SiSPSeededTrackFinder.h index bd21c07690d136e181069bfd87931fa3ebbf4091..773d487b91f958cbb477a98d1d99a4f68c9f8d04 100755 --- a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/SiSPSeededTrackFinder/SiSPSeededTrackFinder.h +++ b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/SiSPSeededTrackFinder/SiSPSeededTrackFinder.h @@ -17,7 +17,7 @@ // For new strategy reconstruction #include "TrkTrack/TrackCollection.h" -#include "InDetBeamSpotService/IBeamCondSvc.h" +#include "BeamSpotConditionsData/BeamSpotData.h" #include "TrkExInterfaces/IPatternParametersPropagator.h" #include "TrkGeometry/MagneticFieldProperties.h" #include "TrkSurfaces/PerigeeSurface.h" @@ -114,9 +114,9 @@ namespace InDet { double* m_zhistogram; double* m_phistogram; - std::string m_beamconditions ; + std::string m_fieldmode ; - IBeamCondSvc* m_beam ; + SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; ToolHandle<Trk::IPatternParametersPropagator> m_proptool ; Trk::MagneticFieldProperties m_fieldprop; diff --git a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/src/SiSPSeededTrackFinder.cxx b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/src/SiSPSeededTrackFinder.cxx index 1714c2d748ff3af04d54f31cbd3a112004fa1cd8..7be724daad9a5453093643591c1ee18f18d2760c 100755 --- a/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/src/SiSPSeededTrackFinder.cxx +++ b/InnerDetector/InDetRecAlgs/SiSPSeededTrackFinder/src/SiSPSeededTrackFinder.cxx @@ -35,8 +35,6 @@ InDet::SiSPSeededTrackFinder::SiSPSeededTrackFinder m_fieldmode("MapSolenoid") , m_proptool ("Trk::RungeKuttaPropagator/InDetPropagator" ) { - m_beamconditions = "BeamCondSvc" ; - m_beam = 0 ; m_histsize = 1400 ; m_nvertex = 4 ; m_zcut = 350. ; @@ -69,7 +67,6 @@ InDet::SiSPSeededTrackFinder::SiSPSeededTrackFinder declareProperty("useZBoundFinding" ,m_useZBoundaryFinding ); declareProperty("maxVertices" ,m_nvertex ); declareProperty("PropagatorTool" ,m_proptool ); - declareProperty("BeamConditionsService",m_beamconditions ); declareProperty("HistSize" ,m_histsize ); declareProperty("Zcut" ,m_zcut ); declareProperty("MagneticFieldMode" ,m_fieldmode ); @@ -93,16 +90,12 @@ StatusCode InDet::SiSPSeededTrackFinder::initialize() // ATH_CHECK(m_trackmaker.retrieve()); - if(m_useNewStrategy && m_beamconditions=="") {m_useNewStrategy = false; m_useZBoundaryFinding = false;} + if(m_useNewStrategy && m_beamSpotKey.key().empty()) {m_useNewStrategy = false; m_useZBoundaryFinding = false;} if(m_useNewStrategy || m_useZBoundaryFinding || m_ITKGeometry) { - // Get beam condition service - // - if(m_beamconditions!="") {service(m_beamconditions,m_beam);} - - if(m_beam) { - + if(!m_beamSpotKey.key().empty()) { + ATH_CHECK(m_beamSpotKey.initialize()); // Get RungeKutta propagator tool // ATH_CHECK( m_proptool.retrieve() ); @@ -252,9 +245,8 @@ StatusCode InDet::SiSPSeededTrackFinder::newStrategy() // Get beam information and preparation for z -histogramming // - Amg::Vector3D cb = m_beam->beamPos(); - Amg::Vector3D gBeam(cb.x(),cb.y(),cb.z()); - Trk::PerigeeSurface per(gBeam); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + Trk::PerigeeSurface per(beamSpotHandle->beamPos()); // Initiate histograms // diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/CMakeLists.txt b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/CMakeLists.txt index a73bd7b704b48e6e85d211e17e65e26cda628098..d5baf3893fecf0d158ff3d17b34fffc62052bffb 100644 --- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/CMakeLists.txt +++ b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/CMakeLists.txt @@ -21,7 +21,6 @@ atlas_depends_on_subdirs( PUBLIC PRIVATE DetectorDescription/AtlasDetDescr Event/xAOD/xAODEventInfo - InnerDetector/InDetConditions/InDetBeamSpotService InnerDetector/InDetDetDescr/InDetIdentifier ) # External dependencies: diff --git a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiTrackerSpacePointFinder.cxx b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiTrackerSpacePointFinder.cxx index 2fae073b50e0df8acfa109f1725dd5052c78d66b..0230f094c480aa21039e853ac7b84b08cb49d6ad 100755 --- a/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiTrackerSpacePointFinder.cxx +++ b/InnerDetector/InDetRecAlgs/SiSpacePointFormation/src/SiTrackerSpacePointFinder.cxx @@ -29,7 +29,6 @@ ATLAS Collaboration // general Atlas classes #include "AtlasDetDescr/AtlasDetectorID.h" #include "xAODEventInfo/EventInfo.h" -#include "InDetBeamSpotService/IBeamCondSvc.h" #include "StoreGate/ReadCondHandle.h" namespace InDet { diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt b/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt index ed2d5da5a59c702232b5ea58db438dec9d411a3e..a539e16a30fe29d0e29e66e1ba4e289588a51805 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt @@ -15,7 +15,7 @@ atlas_depends_on_subdirs( Event/EventPrimitives GaudiKernel InnerDetector/InDetRawEvent/InDetSimData - InnerDetector/InDetConditions/InDetBeamSpotService + InnerDetector/InDetConditions/BeamSpotConditionsData InnerDetector/InDetConditions/InDetConditionsSummaryService InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnPixelClusterSplitProbTool.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnPixelClusterSplitProbTool.h index 2cea5289265533e7e74f91a06f1dc51db09a7ae4..9ed738e6fa30e730ed584c8089d59e3d1cc05ade 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnPixelClusterSplitProbTool.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnPixelClusterSplitProbTool.h @@ -23,10 +23,9 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "InDetRecToolInterfaces/IPixelClusterSplitProbTool.h" //Beam Spot Condition -#include "InDetBeamSpotService/IBeamCondSvc.h" +#include "BeamSpotConditionsData/BeamSpotData.h" #include "TrkParameters/TrackParameters.h" -class IBeamCondSvc; namespace InDet { @@ -52,7 +51,7 @@ namespace InDet { InDet::PixelClusterSplitProb compileSplitProbability(std::vector<double>& vectorOfProbs ) const; ToolHandle<NnClusterizationFactory> m_NnClusterizationFactory; - ServiceHandle<IBeamCondSvc> m_iBeamCondSvc; + SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; std::vector<double> m_priorMultiplicityContent; diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnPixelClusterSplitter.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnPixelClusterSplitter.h index 7bf41eb38da3dd4f068387d62e7df99b965a3cec..e06df5780396e01b6647696e8b72846efdffd1e7 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnPixelClusterSplitter.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/NnPixelClusterSplitter.h @@ -16,8 +16,7 @@ #include "InDetRecToolInterfaces/IPixelClusterSplitter.h" #include "InDetPrepRawData/PixelClusterParts.h" #include "InDetPrepRawData/PixelClusterSplitProb.h" - -class IBeamCondSvc; +#include "BeamSpotConditionsData/BeamSpotData.h" namespace InDet { @@ -52,7 +51,7 @@ namespace InDet private: ToolHandle<NnClusterizationFactory> m_NnClusterizationFactory; - ServiceHandle<IBeamCondSvc> m_iBeamCondSvc; + SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; double m_thresholdSplittingIntoTwoClusters; double m_thresholdSplittingIntoThreeClusters; diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TruthPixelClusterSplitProbTool.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TruthPixelClusterSplitProbTool.h index e9c626218f6fe8d8f5318fa74483bdaebe590e02..ae5131f72f1c5d82c0142b866e5d85269b825df6 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TruthPixelClusterSplitProbTool.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TruthPixelClusterSplitProbTool.h @@ -24,7 +24,6 @@ #include "InDetRecToolInterfaces/IPixelClusterSplitProbTool.h" #include "TrkParameters/TrackParameters.h" -class IBeamCondSvc; namespace InDet { diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TruthPixelClusterSplitter.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TruthPixelClusterSplitter.h index 876163571280a3c441080c9cf9e56cbffdcb5762..42670eb0d2b832cf2418747cb2276a57ae18595e 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TruthPixelClusterSplitter.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/TruthPixelClusterSplitter.h @@ -17,8 +17,6 @@ #include "InDetPrepRawData/PixelClusterParts.h" #include "InDetPrepRawData/PixelClusterSplitProb.h" -class IBeamCondSvc; - namespace InDet { @@ -52,13 +50,10 @@ namespace InDet private: ToolHandle<TruthClusterizationFactory> m_truthClusterizationFactory; - ServiceHandle<IBeamCondSvc> m_iBeamCondSvc; double m_thresholdSplittingIntoTwoClusters; double m_thresholdSplittingIntoThreeClusters; bool m_splitOnlyOnBLayer; - - bool m_useBeamSpotInfo; }; } diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnPixelClusterSplitProbTool.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnPixelClusterSplitProbTool.cxx index ae145d6412162580a9c8fc2adf58042535911966..14372786e36737e741dea61c6d098498f1e173b3 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnPixelClusterSplitProbTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnPixelClusterSplitProbTool.cxx @@ -18,7 +18,6 @@ #include "InDetIdentifier/PixelID.h" #include "InDetPrepRawData/PixelClusterSplitProb.h" #include "VxVertex/RecVertex.h" -#include "InDetBeamSpotService/IBeamCondSvc.h" @@ -29,7 +28,6 @@ namespace InDet NnPixelClusterSplitProbTool::NnPixelClusterSplitProbTool(const std::string& t, const std::string& n, const IInterface* p) :AthAlgTool(t,n,p), m_NnClusterizationFactory("InDet::NnClusterizationFactory/NnClusterizationFactory", this), - m_iBeamCondSvc("BeamCondSvc",n), m_useBeamSpotInfo(true) { @@ -41,7 +39,6 @@ namespace InDet declareInterface<IPixelClusterSplitProbTool>(this); declareProperty("NnClusterizationFactory",m_NnClusterizationFactory); - declareProperty("BeamCondSv",m_iBeamCondSvc); declareProperty("PriorMultiplicityContent",m_priorMultiplicityContent); declareProperty("useBeamSpotInfo",m_useBeamSpotInfo); @@ -59,11 +56,7 @@ namespace InDet return StatusCode::FAILURE; } - if (m_iBeamCondSvc.retrieve().isFailure()) - { - ATH_MSG_ERROR( "Could not find BeamCondSvc." ); - return StatusCode::FAILURE; - } + ATH_CHECK(m_beamSpotKey.initialize()); ATH_MSG_INFO(" Cluster split prob tool initialized successfully "<< m_NnClusterizationFactory ); return StatusCode::SUCCESS; @@ -72,13 +65,12 @@ namespace InDet InDet::PixelClusterSplitProb NnPixelClusterSplitProbTool::splitProbability(const InDet::PixelCluster& origCluster ) const { - - Trk::RecVertex beamposition(m_iBeamCondSvc->beamVtx()); - Amg::Vector3D beamSpotPosition(beamposition.position()[0], - beamposition.position()[1], - beamposition.position()[2]); - if (!m_useBeamSpotInfo) beamSpotPosition=Amg::Vector3D(0,0,0); + Amg::Vector3D beamSpotPosition(0,0,0); + if(m_useBeamSpotInfo){ + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + beamSpotPosition = beamSpotHandle->beamPos(); + } std::vector<double> vectorOfProbs=m_NnClusterizationFactory->estimateNumberOfParticles(origCluster,beamSpotPosition); @@ -106,12 +98,11 @@ namespace InDet InDet::PixelClusterSplitProb NnPixelClusterSplitProbTool::splitProbability(const InDet::PixelCluster& origCluster, const Trk::TrackParameters& trackParameters ) const { - Trk::RecVertex beamposition(m_iBeamCondSvc->beamVtx()); - Amg::Vector3D beamSpotPosition(beamposition.position()[0], - beamposition.position()[1], - beamposition.position()[2]); - - if (!m_useBeamSpotInfo) beamSpotPosition=Amg::Vector3D(0,0,0); + Amg::Vector3D beamSpotPosition(0,0,0); + if(m_useBeamSpotInfo){ + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + beamSpotPosition = beamSpotHandle->beamPos(); + } std::vector<double> vectorOfProbs=m_NnClusterizationFactory->estimateNumberOfParticles(origCluster, trackParameters.associatedSurface(), trackParameters); diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnPixelClusterSplitter.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnPixelClusterSplitter.cxx index 6564f5e93a4c512528e5d144c49e77466f67325a..7e06797b79d807b2f27b2deeab8db628a6fb324b 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnPixelClusterSplitter.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnPixelClusterSplitter.cxx @@ -20,7 +20,6 @@ #include "SiClusterizationTool/NnPixelClusterSplitter.h" #include "VxVertex/RecVertex.h" #include "InDetPrepRawData/PixelCluster.h" -#include "InDetBeamSpotService/IBeamCondSvc.h" #include "SiClusterizationTool/NnClusterizationFactory.h" #include "InDetIdentifier/PixelID.h" #include "InDetReadoutGeometry/SiDetectorElement.h" @@ -35,13 +34,11 @@ InDet::NnPixelClusterSplitter::NnPixelClusterSplitter(const std::string &type, const IInterface *parent) : AthAlgTool(type,name,parent), m_NnClusterizationFactory("InDet::NnClusterizationFactory/NnClusterizationFactory", this), - m_iBeamCondSvc("BeamCondSvc",name), m_useBeamSpotInfo(true) { declareInterface<IPixelClusterSplitter>(this); declareProperty("NnClusterizationFactory",m_NnClusterizationFactory); - declareProperty("BeamCondSv",m_iBeamCondSvc); declareProperty("ThresholdSplittingIntoTwoClusters",m_thresholdSplittingIntoTwoClusters=0.95); declareProperty("ThresholdSplittingIntoThreeClusters",m_thresholdSplittingIntoThreeClusters=0.90); declareProperty("SplitOnlyOnBLayer",m_splitOnlyOnBLayer=true); @@ -60,11 +57,7 @@ StatusCode InDet::NnPixelClusterSplitter::initialize() { return StatusCode::FAILURE; } - if (m_iBeamCondSvc.retrieve().isFailure()) - { - ATH_MSG_ERROR( "Could not find BeamCondSvc." ); - return StatusCode::FAILURE; - } + ATH_CHECK(m_beamSpotKey.initialize()); ATH_MSG_INFO(" Cluster splitter initialized successfully "<< m_NnClusterizationFactory ); return StatusCode::SUCCESS; @@ -80,7 +73,6 @@ std::vector<InDet::PixelClusterParts> InDet::NnPixelClusterSplitter::splitCluste //add treatment for b-layer only HERE - Trk::RecVertex beamposition(m_iBeamCondSvc->beamVtx()); const std::vector<Identifier>& rdos = origCluster.rdoList(); const std::vector<int>& totList = origCluster.totList(); @@ -102,12 +94,11 @@ std::vector<InDet::PixelClusterParts> InDet::NnPixelClusterSplitter::splitCluste std::vector<Amg::MatrixX> errorMatrix; - Amg::Vector3D beamSpotPosition=Amg::Vector3D( - beamposition.position()[0], - beamposition.position()[1], - beamposition.position()[2]); - - if (!m_useBeamSpotInfo) beamSpotPosition=Amg::Vector3D(0,0,0); + Amg::Vector3D beamSpotPosition(0,0,0); + if(m_useBeamSpotInfo){ + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + beamSpotPosition = beamSpotHandle->beamPos(); + } std::vector<Amg::Vector2D> localPosition=m_NnClusterizationFactory->estimatePositions(origCluster, beamSpotPosition, @@ -169,8 +160,6 @@ std::vector<InDet::PixelClusterParts> InDet::NnPixelClusterSplitter::splitCluste //add treatment for b-layer only HERE - Trk::RecVertex beamposition(m_iBeamCondSvc->beamVtx()); - const std::vector<Identifier>& rdos = origCluster.rdoList(); const std::vector<int>& totList = origCluster.totList(); @@ -214,12 +203,11 @@ std::vector<InDet::PixelClusterParts> InDet::NnPixelClusterSplitter::splitCluste std::vector<Amg::Vector2D> allLocalPositions; std::vector<Amg::MatrixX> allErrorMatrix; - Amg::Vector3D beamSpotPosition=Amg::Vector3D( - beamposition.position()[0], - beamposition.position()[1], - beamposition.position()[2]); - - if (!m_useBeamSpotInfo) beamSpotPosition=Amg::Vector3D(0,0,0); + Amg::Vector3D beamSpotPosition(0,0,0); + if(m_useBeamSpotInfo){ + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + beamSpotPosition = beamSpotHandle->beamPos(); + } std::vector<InDet::PixelClusterParts> allMultiPClusters; diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/TruthPixelClusterSplitProbTool.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/TruthPixelClusterSplitProbTool.cxx index 436c9a57b238f98fc391b937d02394b4fe6d419e..5bcc598f34bd088f5f42bd83c69a8722801aaa54 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/TruthPixelClusterSplitProbTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/TruthPixelClusterSplitProbTool.cxx @@ -18,8 +18,6 @@ #include "InDetIdentifier/PixelID.h" #include "InDetPrepRawData/PixelClusterSplitProb.h" #include "VxVertex/RecVertex.h" -#include "InDetBeamSpotService/IBeamCondSvc.h" - namespace InDet diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/TruthPixelClusterSplitter.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/TruthPixelClusterSplitter.cxx index eb26b555108ca611ff9eb4e8bed5eacc7dda190c..c3bf0eb89464e242513bb8bac190883183300047 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/TruthPixelClusterSplitter.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/TruthPixelClusterSplitter.cxx @@ -14,7 +14,6 @@ #include "SiClusterizationTool/TruthPixelClusterSplitter.h" #include "VxVertex/RecVertex.h" #include "InDetPrepRawData/PixelCluster.h" -#include "InDetBeamSpotService/IBeamCondSvc.h" #include "SiClusterizationTool/TruthClusterizationFactory.h" #include "InDetIdentifier/PixelID.h" #include "InDetReadoutGeometry/SiDetectorElement.h" @@ -25,18 +24,14 @@ InDet::TruthPixelClusterSplitter::TruthPixelClusterSplitter(const std::string &t const std::string &name, const IInterface *parent) : AthAlgTool(type,name,parent), - m_truthClusterizationFactory("InDet::NnClusterizationFactory/TruthClusterizationFactory", this), - m_iBeamCondSvc("BeamCondSvc",name), - m_useBeamSpotInfo(true) + m_truthClusterizationFactory("InDet::NnClusterizationFactory/TruthClusterizationFactory", this) { declareInterface<IPixelClusterSplitter>(this); declareProperty("NnClusterizationFactory",m_truthClusterizationFactory); - declareProperty("BeamCondSv",m_iBeamCondSvc); declareProperty("ThresholdSplittingIntoTwoClusters",m_thresholdSplittingIntoTwoClusters=0.95); declareProperty("ThresholdSplittingIntoThreeClusters",m_thresholdSplittingIntoThreeClusters=0.90); declareProperty("SplitOnlyOnBLayer",m_splitOnlyOnBLayer=true); - declareProperty("useBeamSpotInfo",m_useBeamSpotInfo); } @@ -51,12 +46,6 @@ StatusCode InDet::TruthPixelClusterSplitter::initialize() { return StatusCode::FAILURE; } - if (m_iBeamCondSvc.retrieve().isFailure()) - { - ATH_MSG_ERROR( "Could not find BeamCondSvc." ); - return StatusCode::FAILURE; - } - ATH_MSG_INFO(" Cluster splitter initialized successfully "<< m_truthClusterizationFactory ); return StatusCode::SUCCESS; } @@ -71,8 +60,6 @@ std::vector<InDet::PixelClusterParts> InDet::TruthPixelClusterSplitter::splitClu //add treatment for b-layer only HERE - Trk::RecVertex beamposition(m_iBeamCondSvc->beamVtx()); - const std::vector<Identifier>& rdos = origCluster.rdoList(); const std::vector<int>& totList = origCluster.totList(); @@ -93,13 +80,6 @@ std::vector<InDet::PixelClusterParts> InDet::TruthPixelClusterSplitter::splitClu std::vector<Amg::MatrixX> errorMatrix; - Amg::Vector3D beamSpotPosition=Amg::Vector3D( - beamposition.position()[0], - beamposition.position()[1], - beamposition.position()[2]); - - if (!m_useBeamSpotInfo) beamSpotPosition=Amg::Vector3D(0,0,0); - std::vector<Amg::Vector2D> localPosition=m_truthClusterizationFactory->estimatePositions(origCluster); @@ -157,8 +137,6 @@ std::vector<InDet::PixelClusterParts> InDet::TruthPixelClusterSplitter::splitClu //add treatment for b-layer only HERE - Trk::RecVertex beamposition(m_iBeamCondSvc->beamVtx()); - const std::vector<Identifier>& rdos = origCluster.rdoList(); const std::vector<int>& totList = origCluster.totList(); @@ -201,13 +179,6 @@ std::vector<InDet::PixelClusterParts> InDet::TruthPixelClusterSplitter::splitClu std::vector<Amg::Vector2D> allLocalPositions; std::vector<Amg::MatrixX> allErrorMatrix; - - Amg::Vector3D beamSpotPosition=Amg::Vector3D( - beamposition.position()[0], - beamposition.position()[1], - beamposition.position()[2]); - - if (!m_useBeamSpotInfo) beamSpotPosition=Amg::Vector3D(0,0,0); std::vector<InDet::PixelClusterParts> allMultiPClusters; diff --git a/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/CMakeLists.txt b/InnerDetector/InDetRecTools/SiSpacePointsSeedTool_xk/CMakeLists.txt index 2a4554869647bbf6535b6f40f6aad0d0119aeebe..2dc0408e48ccd49002827c902dc6e4097e58b643 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 3da0ff0baeaca1a52ee4e521118bf2dad942b9e4..e7f14a2a95135ee0eef96afee30b465538f47353 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 544e2d29618f8998aa328866b368bb1113d20220..c4e7172f663c16a17051a174406994120873d819 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 e5b53045b474218cfa40e41f3fcba1d1096ad607..edbbf652958d009fbfeaf50fd4e1834ab3990138 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 387b1a65b77443c2a497ffe676f5a142c3a28712..f5ded00128acc43bdf81247c3ed9926614462fce 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 78e0afef89dc3043cc8747e3866dabbd4af152a3..2d180da3c9b86cfc14421966dbfb94c57f7fdcb9 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 053450e75831957d82f9c485cb0c62c25f54d083..3c8fab6d6f8c3427ba4fd3214df13b45e9491fe3 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 4d2b0cd2865b0b51480f819ba6f715d9a11721c1..f33574b7b9e33948e8f673f7ed2962800b7944e5 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 6798dd6873e6c5c0927fa705fc4cf918db80c808..0d0a737a4c00f540172ebddc2f88290cb6ddffe4 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 92937e6fe9b0208b4f040955ae88fb41910e378a..af7d7b0cfeca9fa58d5cf75030f0a52985aae096 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 390085ee4f30dc16fd5072645e9743f43813250b..f7f008d2084f193f78037cdabace1aec840aab5e 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 7bb8d21bb47051dc9e65f3566b55e373a6b23ac5..5f8bf943ce003a6c4afcaabeebdd87d3301764d1 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 55f07888911ec7dc25b8976ed4988eac4837ba19..ac16f482e420aa6a3f6112f6b52822121422a8af 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)); diff --git a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/CMakeLists.txt b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/CMakeLists.txt index 8bb9a623671d15dad69d5c08c5a575a33f0d98e8..0bdaa5352c9bebe381d38e00940bf9616e093856 100644 --- a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/CMakeLists.txt +++ b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/CMakeLists.txt @@ -11,11 +11,11 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel InnerDetector/InDetRecEvent/InDetPrepRawData Trigger/TrigSteer/TrigInterfaces + InnerDetector/InDetConditions/BeamSpotConditionsData PRIVATE Control/AthenaBaseComps DetectorDescription/IRegionSelector Event/EventPrimitives - InnerDetector/InDetConditions/InDetBeamSpotService InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry InnerDetector/InDetRecAlgs/SiSpacePointFormation diff --git a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.cxx b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.cxx index ddf232f2e78fc6f36f06313d3426ab72f9929edc..d04c93dc64a087f30f39e024f54a75a95dec1103 100755 --- a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.cxx +++ b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.cxx @@ -19,7 +19,6 @@ #include "InDetIdentifier/SCT_ID.h" #include "EventPrimitives/EventPrimitives.h" -#include "InDetBeamSpotService/IBeamCondSvc.h" namespace InDet { @@ -45,7 +44,6 @@ SCT_TrigSpacePointTool::SCT_TrigSpacePointTool(const std::string &type, m_xVertex(0.), m_yVertex(0.), m_zVertex(0.), - m_iBeamCondSvc("BeamCondSvc",name), m_spacepointoverlapCollection(0) { declareInterface<InDet::ITrigSCT_SpacePointTool>( this ); @@ -67,7 +65,6 @@ SCT_TrigSpacePointTool::SCT_TrigSpacePointTool(const std::string &type, declareProperty("VertexX", m_xVertex); declareProperty("VertexY", m_yVertex); declareProperty("VertexZ", m_zVertex); - declareProperty("BeamConditionService",m_iBeamCondSvc); } //--------------------------------------------------------------------------- @@ -86,8 +83,8 @@ StatusCode SCT_TrigSpacePointTool::initialize() { m_SiSpacePointMakerTool, this) ); if (!m_overrideBS){ - ATH_CHECK( m_iBeamCondSvc.retrieve() ); - ATH_MSG_INFO( "Retrieved beam spot service " << m_iBeamCondSvc ); + ATH_CHECK( m_beamSpotKey.initialize() ); + ATH_MSG_INFO( "Retrieved beam spot Cond Key " << m_beamSpotKey ); } return StatusCode::SUCCESS; @@ -249,9 +246,10 @@ checkForSCT_Points(const SCT_ClusterCollection* clusters1, const SCT_ClusterCollection * clusters2 = *it; Amg::Vector3D beampos; - if (!m_overrideBS && m_iBeamCondSvc) - beampos = m_iBeamCondSvc->beamPos(); - else { + if (!m_overrideBS){ + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle(m_beamSpotKey); + beampos = beamSpotHandle->beamPos(); + } else { Amg::Vector3D ovtx(m_xVertex,m_yVertex,m_zVertex); beampos = ovtx; } @@ -285,9 +283,10 @@ void SCT_TrigSpacePointTool:: Amg::Vector3D beampos; - if (m_iBeamCondSvc && !m_overrideBS) - beampos = m_iBeamCondSvc->beamPos(); - else { + if (!m_overrideBS){ + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle(m_beamSpotKey); + beampos = beamSpotHandle->beamPos(); + }else { Amg::Vector3D ovtx(m_xVertex,m_yVertex,m_zVertex); beampos = ovtx; } diff --git a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.h b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.h index 99ff1c4411cbd0b629679fc02cc32e9173a8ad90..bde3431ce6f90b2f4714414a5807fbc88123f129 100755 --- a/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.h +++ b/InnerDetector/InDetTrigRecAlgs/SiTrigSpacePointFormation/src/SCT_TrigSpacePointTool.h @@ -36,7 +36,7 @@ #include "InDetPrepRawData/SiClusterContainer.h" #include "InDetPrepRawData/SCT_ClusterCollection.h" - +#include "BeamSpotConditionsData/BeamSpotData.h" #include <string> class SCT_ID; @@ -46,7 +46,6 @@ class SpacePointContainer; class SvcLocator; class StoreGateSvc; class SCT_NeighboursTable; -class IBeamCondSvc; namespace InDet { class SiElementPropertiesTable;} namespace InDetDD { class SiDetectorElementCollection; } @@ -130,8 +129,7 @@ namespace InDet { float m_yVertex; float m_zVertex; - ServiceHandle<IBeamCondSvc> m_iBeamCondSvc; - std::string m_beamCondSvcName; + SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; SpacePointOverlapCollection* m_spacepointoverlapCollection; diff --git a/Reconstruction/RecoTools/TrackToVertex/CMakeLists.txt b/Reconstruction/RecoTools/TrackToVertex/CMakeLists.txt index 8dea0f4278dd6220f8447e26d03f9da9e73b47d8..ac0cb682b70560ca1ca5fbdcb6152be62d8c925c 100644 --- a/Reconstruction/RecoTools/TrackToVertex/CMakeLists.txt +++ b/Reconstruction/RecoTools/TrackToVertex/CMakeLists.txt @@ -16,7 +16,6 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/BeamSpotConditionsData PRIVATE Control/StoreGate - InnerDetector/InDetConditions/InDetBeamSpotService Reconstruction/Particle Tracking/TrkDetDescr/TrkDetDescrUtils Tracking/TrkDetDescr/TrkSurfaces diff --git a/Reconstruction/RecoTools/TrackToVertex/TrackToVertex/TrackToVertexAssociator.h b/Reconstruction/RecoTools/TrackToVertex/TrackToVertex/TrackToVertexAssociator.h index 4628b886892298b8c23702959f9ff0deb0483c9f..96489c741eb10e76e184e8ac5340c4cff717f335 100644 --- a/Reconstruction/RecoTools/TrackToVertex/TrackToVertex/TrackToVertexAssociator.h +++ b/Reconstruction/RecoTools/TrackToVertex/TrackToVertex/TrackToVertexAssociator.h @@ -30,12 +30,11 @@ #include "TrkNeutralParameters/NeutralParameters.h" #include "GeoPrimitives/GeoPrimitives.h" #include "EventPrimitives/EventPrimitives.h" - +#include "BeamSpotConditionsData/BeamSpotData.h" // Forward declaration class StoreGateSvc; class IIncidentSvc; -class IBeamCondSvc; class VxContainer; namespace Trk { @@ -98,7 +97,7 @@ namespace Reco { // Services ServiceHandle<StoreGateSvc> m_storeGate; //!< Event store - ServiceHandle<IBeamCondSvc> m_beamCondSvc; //!< BeamCondSvc to get the beam parameters + SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; //!< BeamCondSvc to get the beam parameters ServiceHandle<IIncidentSvc> m_incidentSvc; //!< IncidentSvc to catch begin of event and end of envent // Tools diff --git a/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertexAssociator.cxx b/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertexAssociator.cxx index 206c734a09579dc47036d34578a675234980d4f0..dc89c07a609e81a607a0293adbc0b36acf7552c9 100644 --- a/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertexAssociator.cxx +++ b/Reconstruction/RecoTools/TrackToVertex/src/TrackToVertexAssociator.cxx @@ -10,8 +10,6 @@ // TrackToVertex includes #include "TrackToVertex/TrackToVertexAssociator.h" -// Inner Detector includes -#include "InDetBeamSpotService/IBeamCondSvc.h" // Tracking includes #include "TrkTrack/Track.h" #include "TrkParticleBase/TrackParticleBase.h" @@ -33,7 +31,6 @@ Reco::TrackToVertexAssociator::TrackToVertexAssociator( const std::string& type, const IInterface* parent ) : ::AthAlgTool ( type, name, parent ), m_storeGate( "StoreGateSvc", name ), - m_beamCondSvc("BeamCondSvc", name), m_incidentSvc("IncidentSvc", name), m_extrapolator("Trk::Extrapolator/AtlasExtrapolator"), m_primaryVertexContainer("VxPrimaryVertices"), @@ -46,7 +43,6 @@ Reco::TrackToVertexAssociator::TrackToVertexAssociator( const std::string& type, // Property declaration // Services declareProperty( "EventStore", m_storeGate ); - declareProperty( "BeamConditionsService", m_beamCondSvc ); declareProperty( "IncidentService", m_incidentSvc ); // Tools declareProperty( "Extrapolator", m_extrapolator ); @@ -69,10 +65,7 @@ StatusCode Reco::TrackToVertexAssociator::initialize() ATH_MSG_WARNING("Can not retrieve " << m_storeGate << ". Exiting."); return StatusCode::FAILURE; } - if (m_beamCondSvc.retrieve().isFailure()){ - ATH_MSG_WARNING("Can not retrieve " << m_beamCondSvc << ". Exiting."); - return StatusCode::FAILURE; - } + ATH_CHECK(m_beamSpotKey.initialize()); if (m_incidentSvc.retrieve().isFailure()){ ATH_MSG_WARNING("Can not retrieve " << m_incidentSvc << ". Exiting."); return StatusCode::FAILURE; @@ -146,10 +139,10 @@ StatusCode Reco::TrackToVertexAssociator::updateCache() const delete m_beamLine; m_beamLine = 0; // get the transform - - Amg::Transform3D* beamTransform = new Amg::Transform3D(Amg::AngleAxis3D(m_beamCondSvc->beamTilt(0),Amg::Vector3D(0.,1.,0.))); - (*beamTransform) *= Amg::AngleAxis3D(m_beamCondSvc->beamTilt(1),Amg::Vector3D(1.,0.,0.)); - beamTransform->pretranslate(m_beamCondSvc->beamPos()); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + Amg::Transform3D* beamTransform = new Amg::Transform3D(Amg::AngleAxis3D(beamSpotHandle->beamTilt(0),Amg::Vector3D(0.,1.,0.))); + (*beamTransform) *= Amg::AngleAxis3D(beamSpotHandle->beamTilt(1),Amg::Vector3D(1.,0.,0.)); + beamTransform->pretranslate(beamSpotHandle->beamPos()); m_beamLine = new Trk::StraightLineSurface(beamTransform); diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/CMakeLists.txt b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/CMakeLists.txt index 58292db2b3e853b1582e3896d36250d2aef8992a..82ff8b2cf8249ecce3363739dda36813428f79bc 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/CMakeLists.txt +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/CMakeLists.txt @@ -16,11 +16,10 @@ atlas_depends_on_subdirs( Tracking/TrkEvent/TrkParameters Tracking/TrkEvent/TrkParticleBase Tracking/TrkEvent/VxVertex - InnerDetector/InDetConditions/BeamSpotConditionsData PRIVATE Event/EventPrimitives Event/xAOD/xAODTruth - InnerDetector/InDetConditions/InDetBeamSpotService + InnerDetector/InDetConditions/BeamSpotConditionsData InnerDetector/InDetRecTools/InDetTrackSelectionTool MagneticField/MagFieldInterfaces Tracking/TrkEvent/TrkEventPrimitives diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/ImagingSeedTuningAlg.cxx b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/ImagingSeedTuningAlg.cxx index 2e2eb74dba88bc20e00c777d35b802ce960f1d01..0ca01b875292cc9f094b271df0d5bda851ff209b 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/ImagingSeedTuningAlg.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/ImagingSeedTuningAlg.cxx @@ -25,8 +25,6 @@ #include "TrkVertexSeedFinderUtils/IVertexImageMaker.h" #include "TrkVertexSeedFinderUtils/IVertexClusterFinder.h" -#include "InDetBeamSpotService/IBeamCondSvc.h" - #include "TrkLinks/LinkToXAODTrackParticle.h" #include <limits> @@ -49,7 +47,6 @@ ImagingSeedTuningAlg::ImagingSeedTuningAlg( const std::string& name, m_trackFilter("InDet::InDetTrackSelectionTool"), m_seedFinder("Trk::ImagingSeedFinder"), m_impactPoint3dEstimator("Trk::ImpactPoint3dEstimator"), - m_iBeamCondSvc("BeamCondSvc", name), m_iTHistSvc("THistSvc", name), m_h_nTruthVertices(NULL), m_h_zTruthVertices(NULL), m_t_seeds(NULL), m_b_nTruth(0), m_b_nConditions(0), m_iCondition(0) @@ -161,6 +158,8 @@ StatusCode ImagingSeedTuningAlg::initialize() m_refineZValues.size()* m_gaussianWindowValues.size(); + ATH_CHECK(m_beamSpotKey.initialize()); + return StatusCode::SUCCESS; } @@ -230,9 +229,10 @@ StatusCode ImagingSeedTuningAlg::execute() theConstraint.makePrivateStore(); if (m_useBeamConstraint) { - theConstraint.setPosition(m_iBeamCondSvc->beamVtx().position()); - theConstraint.setCovariancePosition(m_iBeamCondSvc->beamVtx().covariancePosition()); - theConstraint.setFitQuality(m_iBeamCondSvc->beamVtx().fitQuality().chiSquared(), m_iBeamCondSvc->beamVtx().fitQuality().doubleNumberDoF()); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + theConstraint.setPosition(beamSpotHandle->beamVtx().position()); + theConstraint.setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition()); + theConstraint.setFitQuality(beamSpotHandle->beamVtx().fitQuality().chiSquared(), beamSpotHandle->beamVtx().fitQuality().doubleNumberDoF()); } bool done = true; @@ -469,12 +469,17 @@ void ImagingSeedTuningAlg::selectTracks(const xAOD::TrackParticleContainer* trac std::vector<Trk::ITrackLink*>& trackVector) { bool selectionPassed{false}; + const InDet::BeamSpotData* beamdata = nullptr; + if(m_useBeamConstraint){ + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + beamdata = beamSpotHandle.retrieve(); + } for (auto itr = trackParticles->begin(); itr != trackParticles->end(); ++itr) { if (m_useBeamConstraint) { xAOD::Vertex beamposition; beamposition.makePrivateStore(); - beamposition.setPosition(m_iBeamCondSvc->beamVtx().position()); - beamposition.setCovariancePosition(m_iBeamCondSvc->beamVtx().covariancePosition()); + beamposition.setPosition(beamdata->beamVtx().position()); + beamposition.setCovariancePosition(beamdata->beamVtx().covariancePosition()); selectionPassed=static_cast<bool> (m_trackFilter->accept(**itr,&beamposition)); } else diff --git a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/ImagingSeedTuningAlg.h b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/ImagingSeedTuningAlg.h index db0b6a291f89e058a4513c0cbe0a27005c4a9bea..34af7a7b7c93c16948f9daa699ab18d5afd23c18 100644 --- a/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/ImagingSeedTuningAlg.h +++ b/Tracking/TrkVertexFitter/TrkVertexSeedFinderUtils/src/ImagingSeedTuningAlg.h @@ -36,7 +36,7 @@ #include "TH1F.h" #include "TTree.h" -class IBeamCondSvc; +#include "BeamSpotConditionsData/BeamSpotData.h" namespace InDet { @@ -144,7 +144,7 @@ class ImagingSeedTuningAlg SmartIF<IProperty> m_imageMakerProperty; SmartIF<IProperty> m_clusterFinderProperty; - ServiceHandle< IBeamCondSvc > m_iBeamCondSvc; + SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; ServiceHandle< ITHistSvc > m_iTHistSvc; std::vector<float>::const_iterator m_i_angularCutoffParameter;