diff --git a/InnerDetector/InDetRecTools/InDetIncSecVxFinderTool/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetIncSecVxFinderTool/CMakeLists.txt index 7fdad69e34a6fb8da1262c765c2edaf7bd6ff15c..cee93252b62f5d3b625d9acc37ae210d650824ba 100644 --- a/InnerDetector/InDetRecTools/InDetIncSecVxFinderTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetIncSecVxFinderTool/CMakeLists.txt @@ -12,4 +12,4 @@ atlas_add_component( InDetIncSecVxFinderTool src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthContainers CxxUtils xAODTracking GaudiKernel InDetRecToolInterfaces GeoPrimitives TrkTrack TrkParticleBase TrkParameters TrkEventPrimitives VxVertex TrkLinks TrkTrack TrkTrackLink TrkTrackSummary TrkSurfaces TrkVertexFitterInterfaces EventPrimitives InDetTrackSelectionToolLib TrkVertexSeedFinderUtilsLib InDetBeamSpotServiceLib ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthContainers CxxUtils xAODTracking GaudiKernel InDetRecToolInterfaces GeoPrimitives TrkTrack TrkParticleBase TrkParameters TrkEventPrimitives VxVertex TrkLinks TrkTrack TrkTrackLink TrkTrackSummary TrkSurfaces TrkVertexFitterInterfaces EventPrimitives InDetTrackSelectionToolLib TrkVertexSeedFinderUtilsLib BeamSpotConditionsData ) diff --git a/InnerDetector/InDetRecTools/InDetIncSecVxFinderTool/InDetIncSecVxFinderTool/InDetIterativeSecVtxFinderTool.h b/InnerDetector/InDetRecTools/InDetIncSecVxFinderTool/InDetIncSecVxFinderTool/InDetIterativeSecVtxFinderTool.h index 991b520f9a01e93a9ff67d79f8e85ca6a5499865..e833099bb26a04fc6be3ce48a6eb4c1b03f7af4e 100755 --- a/InnerDetector/InDetRecTools/InDetIncSecVxFinderTool/InDetIncSecVxFinderTool/InDetIterativeSecVtxFinderTool.h +++ b/InnerDetector/InDetRecTools/InDetIncSecVxFinderTool/InDetIncSecVxFinderTool/InDetIterativeSecVtxFinderTool.h @@ -31,11 +31,12 @@ #include "TrkParameters/TrackParameters.h" // we may save out some private stuff #include "TTree.h" -class IBeamCondSvc; #include "xAODTracking/VertexFwd.h" #include "xAODTracking/TrackParticleFwd.h" #include "xAODTracking/VertexContainerFwd.h" #include "xAODTracking/TrackParticleContainerFwd.h" +#include "BeamSpotConditionsData/BeamSpotData.h" + namespace Trk { @@ -152,7 +153,7 @@ public: ToolHandle< Trk::IImpactPoint3dEstimator > m_ImpactPoint3dEstimator; ToolHandle< Trk::IVertexLinearizedTrackFactory > m_LinearizedTrackFactory; - ServiceHandle<IBeamCondSvc> m_iBeamCondSvc; //!< pointer to the beam condition service + SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; bool m_useBeamConstraint; double m_significanceCutSeeding; diff --git a/InnerDetector/InDetRecTools/InDetIncSecVxFinderTool/src/InDetIterativeSecVtxFinderTool.cxx b/InnerDetector/InDetRecTools/InDetIncSecVxFinderTool/src/InDetIterativeSecVtxFinderTool.cxx index 1c277493b25cdcd88d0d0076830b054760220d9f..2bc6d01ebab62f794c8ab8dbbc415c78011472d7 100644 --- a/InnerDetector/InDetRecTools/InDetIncSecVxFinderTool/src/InDetIterativeSecVtxFinderTool.cxx +++ b/InnerDetector/InDetRecTools/InDetIncSecVxFinderTool/src/InDetIterativeSecVtxFinderTool.cxx @@ -33,7 +33,6 @@ //#include <TMath.h> #include "TrkVertexFitterInterfaces/IImpactPoint3dEstimator.h" -#include "InDetBeamSpotService/IBeamCondSvc.h" #include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h" #include "TrkVertexFitterInterfaces/IVertexSeedFinder.h" @@ -77,7 +76,6 @@ InDetIterativeSecVtxFinderTool::InDetIterativeSecVtxFinderTool(const std::string m_SeedFinder("Trk::IndexedCrossDistancesSeedFinder", this ), m_ImpactPoint3dEstimator("Trk::ImpactPoint3dEstimator", this ), m_LinearizedTrackFactory("Trk::FullLinearizedTrackFactory", this ), - m_iBeamCondSvc("BeamCondSvc",n), m_useBeamConstraint(false), m_significanceCutSeeding(10), m_maximumChi2cutForSeeding(6.*6.), @@ -106,7 +104,6 @@ InDetIterativeSecVtxFinderTool::InDetIterativeSecVtxFinderTool(const std::string declareProperty("VertexFitterTool", m_iVertexFitter); declareProperty("BaseTrackSelector",m_trkFilter); declareProperty("SecVtxTrackSelector",m_SVtrkFilter); - declareProperty("BeamPositionSvc", m_iBeamCondSvc); declareProperty("SeedFinder" , m_SeedFinder); declareProperty("ImpactPoint3dEstimator",m_ImpactPoint3dEstimator); declareProperty("LinearizedTrackFactory",m_LinearizedTrackFactory); @@ -142,8 +139,9 @@ std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> InDetIterativeSecVt xAOD::Vertex beamposition; beamposition.makePrivateStore(); - beamposition.setPosition(m_iBeamCondSvc->beamVtx().position()); - beamposition.setCovariancePosition(m_iBeamCondSvc->beamVtx().covariancePosition()); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + beamposition.setPosition(beamSpotHandle->beamVtx().position()); + beamposition.setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition()); typedef DataVector<xAOD::TrackParticle>::const_iterator TrackParticleDataVecIter; @@ -205,8 +203,9 @@ std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> xAOD::Vertex beamposition; beamposition.makePrivateStore(); - beamposition.setPosition(m_iBeamCondSvc->beamVtx().position()); - beamposition.setCovariancePosition(m_iBeamCondSvc->beamVtx().covariancePosition()); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + beamposition.setPosition(beamSpotHandle->beamVtx().position()); + beamposition.setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition()); bool selectionPassed; m_trkdefiPars.clear() ; @@ -355,10 +354,11 @@ std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> InDetIterativeSecVt xAOD::Vertex theconstraint; if (m_useBeamConstraint) { theconstraint = xAOD::Vertex(); // Default constructor creates a private store - 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() ); seedVertex = m_SeedFinder->findSeed( m_privtx.x(), m_privtx.y(), perigeeList, &theconstraint ); @@ -1743,12 +1743,7 @@ StatusCode InDetIterativeSecVtxFinderTool::initialize() return StatusCode::FAILURE; } - sc = m_iBeamCondSvc.retrieve(); - if (sc.isFailure()) - { - ATH_MSG_ERROR( "Could not find BeamCondSvc." ); - return sc; - } + ATH_CHECK(m_beamSpotKey.initialize()); if(m_trkFilter.retrieve().isFailure()) { ATH_MSG_ERROR(" Unable to retrieve "<<m_trkFilter ); @@ -1837,8 +1832,8 @@ std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> InDetIterativeSecVt beamposition.setPosition(m_iBeamCondSvc->beamVtx().position()); beamposition.setCovariancePosition(m_iBeamCondSvc->beamVtx().covariancePosition()); */ - - Trk::RecVertex beamposition(m_iBeamCondSvc->beamVtx()); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + Trk::RecVertex beamposition(beamSpotHandle->beamVtx()); std::vector<Trk::ITrackLink*> selectedTracks; @@ -1884,8 +1879,8 @@ std::pair<xAOD::VertexContainer*, xAOD::VertexAuxContainer*> InDetIterativeSecVt std::vector<Trk::ITrackLink*> selectedTracks; // TODO: change trkFilter to allow for this replacement - - Trk::RecVertex beamposition(m_iBeamCondSvc->beamVtx()); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + Trk::RecVertex beamposition(beamSpotHandle->beamVtx()); typedef DataVector<Trk::TrackParticleBase>::const_iterator TrackParticleDataVecIter; diff --git a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/CMakeLists.txt index cd32326b83e7fc6d912c0fef880dd5135c290055..7a878caeccc8f56438f4ccf9cecbd36a12fa8ca0 100644 --- a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/CMakeLists.txt @@ -7,4 +7,4 @@ atlas_subdir( InDetMultipleVertexSeedFinder ) atlas_add_component( InDetMultipleVertexSeedFinder src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps GaudiKernel InDetRecToolInterfaces EventPrimitives xAODTracking InDetMultipleVertexSeedFinderUtilsLib TrkParticleBase TrkTrack VxVertex TrkExInterfaces TrkToolInterfaces TrkVertexFitterInterfaces InDetBeamSpotServiceLib ) + LINK_LIBRARIES AthenaBaseComps GaudiKernel InDetRecToolInterfaces EventPrimitives xAODTracking InDetMultipleVertexSeedFinderUtilsLib TrkParticleBase TrkTrack VxVertex TrkExInterfaces TrkToolInterfaces TrkVertexFitterInterfaces BeamSpotConditionsData ) diff --git a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/DivisiveMultiSeedFinder.h b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/DivisiveMultiSeedFinder.h index b262ba99b6bd46beba3da14ed4f68eda1e25515d..121937d9cd04a11deac6a33e04193d27e057c8df 100644 --- a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/DivisiveMultiSeedFinder.h +++ b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/DivisiveMultiSeedFinder.h @@ -8,8 +8,7 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" #include "InDetRecToolInterfaces/IMultiPVSeedFinder.h" - -class IBeamCondSvc; +#include "BeamSpotConditionsData/BeamSpotData.h" namespace Trk { @@ -71,7 +70,8 @@ namespace InDet ToolHandle<InDetTrackClusterCleaningTool> m_cleaningTool; //beam spot finder - ServiceHandle< IBeamCondSvc > m_beamService; + SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; + ToolHandle<Trk::IExtrapolator> m_extrapolator; //<! Extrapolator tool //vertex seed finder diff --git a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/HistogrammingMultiSeedFinder.h b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/HistogrammingMultiSeedFinder.h index 702d3d481c1c89482490bc9ea4b9f96aa7398577..f0be795e9174c2ebfbca13fa7f0990a01650e45a 100644 --- a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/HistogrammingMultiSeedFinder.h +++ b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/HistogrammingMultiSeedFinder.h @@ -8,6 +8,7 @@ #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" #include "InDetRecToolInterfaces/IMultiPVSeedFinder.h" +#include "BeamSpotConditionsData/BeamSpotData.h" /** * A multi seed finder for primary vertexing. Uses a @@ -23,7 +24,6 @@ * Mai 2007 */ -class IBeamCondSvc; namespace Trk { @@ -83,7 +83,7 @@ namespace InDet ToolHandle<Trk::IVertexSeedFinder> m_vtxSeedFinder; //beam spot finder - ServiceHandle< IBeamCondSvc > m_beamService; + SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; ToolHandle<Trk::IExtrapolator> m_extrapolator; //<! Extrapolator tool }; }//end of namespace definitions diff --git a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/SlidingWindowMultiSeedFinder.h b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/SlidingWindowMultiSeedFinder.h index 4f6bef4829916b1bbbac5ea32c02210e490c68ff..62002d408ceef31c3be42fc78ff6da7a65cf8edf 100644 --- a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/SlidingWindowMultiSeedFinder.h +++ b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/InDetMultipleVertexSeedFinder/SlidingWindowMultiSeedFinder.h @@ -9,8 +9,8 @@ #include "GaudiKernel/ToolHandle.h" //#include "TrkParameters/TrackParameters.h" #include "InDetRecToolInterfaces/IMultiPVSeedFinder.h" +#include "BeamSpotConditionsData/BeamSpotData.h" -class IBeamCondSvc; namespace Trk { @@ -63,7 +63,7 @@ namespace InDet ToolHandle<Trk::IVertexSeedFinder> m_vtxSeedFinder; //beam spot finder - ServiceHandle< IBeamCondSvc > m_beamService; + SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; ToolHandle<Trk::IExtrapolator> m_extrapolator; //<! Extrapolator tool };//end of class definitions diff --git a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/DivisiveMultiSeedFinder.cxx b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/DivisiveMultiSeedFinder.cxx index dbec9d17a39232f6136f555bf042caf3ad5f58bc..8d45a91dbda4ab36bb620899c8e192f37dcc3fd7 100644 --- a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/DivisiveMultiSeedFinder.cxx +++ b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/DivisiveMultiSeedFinder.cxx @@ -9,7 +9,6 @@ #include "InDetMultipleVertexSeedFinderUtils/InDetTrackZ0SortingTool.h" #include "InDetMultipleVertexSeedFinderUtils/InDetTrackClusterCleaningTool.h" #include "TrkParticleBase/TrackParticleBase.h" -#include "InDetBeamSpotService/IBeamCondSvc.h" #include "InDetRecToolInterfaces/IMultiPVSeedFinder.h" #include "TrkExInterfaces/IExtrapolator.h" #include "TrkVertexFitterInterfaces/IVertexSeedFinder.h" @@ -46,11 +45,7 @@ namespace InDet return StatusCode::FAILURE; }else msg(MSG::INFO)<<"Track sorting tool retrieved"<<endmsg; - if(m_beamService.retrieve().isFailure()) - { - msg(MSG::ERROR)<<"Unable to retrieve "<<m_beamService<<endmsg; - return StatusCode::FAILURE; - }else msg(MSG::INFO)<<"BeamSpot service retrieved"<<endmsg; + ATH_CHECK(m_beamSpotKey.initialize()); if ( m_extrapolator.retrieve().isFailure() ) { @@ -67,7 +62,6 @@ namespace InDet m_sepDistance(0.5), m_nRemaining(1), m_ignoreBeamSpot(false), - m_beamService("BeamCondSvc",n), m_extrapolator("Trk::Extrapolator"), m_vtxSeedFinder("Trk::CrossDistancesSeedFinder") { @@ -88,8 +82,7 @@ namespace InDet //vertex finder tool (needed when no beam spot is available) declareProperty("VertexSeedFinder",m_vtxSeedFinder); -//beam spot service - declareProperty("BeamSpotSvc", m_beamService); + //extrapolator declareProperty("Extrapolator",m_extrapolator); @@ -106,8 +99,8 @@ namespace InDet std::vector<const Trk::Track*>::const_iterator tr = tracks.begin(); std::vector<const Trk::Track*>::const_iterator tre = tracks.end(); -//selecting with respect to the beam spot - Trk::RecVertex beamrecposition(m_beamService->beamVtx()); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + Trk::RecVertex beamrecposition(beamSpotHandle->beamVtx()); for(;tr!=tre;++tr) if(m_trkFilter->decision(**tr,&beamrecposition)) preselectedTracks.push_back(*tr); if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Beam spot position is: "<< beamrecposition.position()<<endmsg; Trk::Vertex* beamposition=&beamrecposition; @@ -264,8 +257,8 @@ namespace InDet std::vector<const Trk::TrackParticleBase*>::const_iterator tre = tracks.end(); //selecting with respect to the beam spot - - Trk::RecVertex beamrecposition(m_beamService->beamVtx()); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + Trk::RecVertex beamrecposition(beamSpotHandle->beamVtx()); for(;tr!=tre;++tr) if(m_trkFilter->decision(**tr, &beamrecposition)) preselectedTracks.push_back(*tr); if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Beam spot position is: "<< beamrecposition.position()<<endmsg; Trk::Vertex* beamposition=&beamrecposition; @@ -443,8 +436,9 @@ namespace InDet xAOD::Vertex * beamposition = new xAOD::Vertex(); - beamposition->setPosition(m_beamService->beamVtx().position()); - beamposition->setCovariancePosition(m_beamService->beamVtx().covariancePosition()); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + beamposition->setPosition(beamSpotHandle->beamVtx().position()); + beamposition->setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition()); // for(;tr!=tre;++tr) if(m_trkFilter->decision(**tr, &beamrecposition)) preselectedTracks.push_back(*tr); // if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Beam spot position is: "<< beamrecposition.position()<<endmsg; //Trk::Vertex* beamposition=&beamrecposition; diff --git a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/HistogrammingMultiSeedFinder.cxx b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/HistogrammingMultiSeedFinder.cxx index fc7c3bd7441b62cae33a76829bce221efefc0ffd..f2c3aaa9f200fbe472f9cc111bcc4830b791920d 100644 --- a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/HistogrammingMultiSeedFinder.cxx +++ b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/HistogrammingMultiSeedFinder.cxx @@ -7,7 +7,6 @@ //#include "TrkParameters/TrackParameters.h" #include "TrkToolInterfaces/ITrackSelectorTool.h" #include "InDetMultipleVertexSeedFinderUtils/InDetTrackClusterCleaningTool.h" -#include "InDetBeamSpotService/IBeamCondSvc.h" #include "TrkParticleBase/TrackParticleBase.h" #include "TrkExInterfaces/IExtrapolator.h" #include "TrkVertexFitterInterfaces/IVertexSeedFinder.h" @@ -31,12 +30,7 @@ namespace InDet return StatusCode::FAILURE; }else msg(MSG::INFO)<<"Cluster cleaning tool retrieved"<<endmsg; - if(m_beamService.retrieve().isFailure()) - { - msg(MSG::ERROR)<<"Unable to retrieve "<<m_beamService<<endmsg; - return StatusCode::FAILURE; - }else msg(MSG::INFO)<<"BeamSpot service retrieved"<<endmsg; - + ATH_CHECK(m_beamSpotKey.initialize()); if(m_vtxSeedFinder.retrieve().isFailure()) { msg(MSG::ERROR) << "Unable to retrieve " << m_vtxSeedFinder <<endmsg; @@ -61,7 +55,6 @@ namespace InDet m_histoRange(200.), m_ignoreBeamSpot(false), m_vtxSeedFinder("Trk::CrossDistancesSeedFinder"), - m_beamService("BeamCondSvc",n), m_extrapolator("Trk::Extrapolator") { declareInterface<IMultiPVSeedFinder>(this); @@ -78,9 +71,6 @@ namespace InDet //cleaning tool declareProperty("CleaningTool", m_cleaningTool); -//beam spot service - declareProperty("BeamSpotSvc", m_beamService); - //vertex finder tool (needed when no beam spot is available) declareProperty("VertexSeedFinder",m_vtxSeedFinder); @@ -100,7 +90,9 @@ namespace InDet std::vector<const Trk::Track*>::const_iterator tre = tracks.end(); //beamposition - Trk::RecVertex beamrecposition(m_beamService->beamVtx()); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + + Trk::RecVertex beamrecposition(beamSpotHandle->beamVtx()); if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Beam spot position is: "<< beamrecposition.position()<<endmsg; for(;tr!=tre;++tr) if(m_trkFilter->decision(**tr,&beamrecposition)) preselectedTracks.push_back(*tr); Trk::Vertex* beamposition=&beamrecposition; @@ -260,7 +252,8 @@ namespace InDet std::vector<const Trk::TrackParticleBase*>::const_iterator tre = tracks.end(); //beamposition - Trk::RecVertex beamrecposition(m_beamService->beamVtx()); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + Trk::RecVertex beamrecposition(beamSpotHandle->beamVtx()); for(;tr!=tre;++tr) if(m_trkFilter->decision(**tr, &beamrecposition)) preselectedTracks.push_back(*tr); if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Beam spot position is: "<< beamrecposition.position()<<endmsg; Trk::Vertex* beamposition=&beamrecposition; @@ -424,8 +417,10 @@ namespace InDet xAOD::Vertex * beamposition = new xAOD::Vertex(); - beamposition->setPosition(m_beamService->beamVtx().position()); - beamposition->setCovariancePosition(m_beamService->beamVtx().covariancePosition()); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + + beamposition->setPosition(beamSpotHandle->beamVtx().position()); + beamposition->setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition()); // for(;tr!=tre;++tr) if(m_trkFilter->decision(**tr, &beamrecposition)) preselectedTracks.push_back(*tr); // if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Beam spot position is: "<< beamrecposition.position()<<endmsg; //Trk::Vertex* beamposition=&beamrecposition; diff --git a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/SlidingWindowMultiSeedFinder.cxx b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/SlidingWindowMultiSeedFinder.cxx index 20e5ecc6f9045d80abdeedfb2f31c96117e0a43d..d11cdddaeb113c35552566df62e934fcff8f0517 100644 --- a/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/SlidingWindowMultiSeedFinder.cxx +++ b/InnerDetector/InDetRecTools/InDetMultipleVertexSeedFinder/src/SlidingWindowMultiSeedFinder.cxx @@ -9,7 +9,6 @@ #include "TrkToolInterfaces/ITrackSelectorTool.h" #include "InDetMultipleVertexSeedFinderUtils/InDetTrackZ0SortingTool.h" -#include "InDetBeamSpotService/IBeamCondSvc.h" #include "TrkParticleBase/TrackParticleBase.h" #include "TrkExInterfaces/IExtrapolator.h" #include "TrkVertexFitterInterfaces/IVertexSeedFinder.h" @@ -32,12 +31,7 @@ namespace InDet return StatusCode::FAILURE; }else msg(MSG::INFO)<<"Track sorting tool retrieved"<<endmsg; - if(m_beamService.retrieve().isFailure()) - { - msg(MSG::ERROR)<<"Unable to retieve "<<m_beamService<<endmsg; - return StatusCode::FAILURE; - }else msg(MSG::INFO)<< "BeamSpot service retrieved"<<endmsg; - + ATH_CHECK(m_beamSpotKey.initialize()); if(m_vtxSeedFinder.retrieve().isFailure()) { @@ -65,7 +59,6 @@ namespace InDet m_ignoreLevel(0), m_ignoreBeamSpot(false), m_vtxSeedFinder("Trk::CrossDistancesSeedFinder"), - m_beamService("BeamCondSvc" ,n), m_extrapolator("Trk::Extrapolator") { declareInterface<IMultiPVSeedFinder>(this); @@ -85,9 +78,6 @@ namespace InDet //vertex finder tool (needed when no beam spot is available) declareProperty("VertexSeedFinder",m_vtxSeedFinder); -//beam spot finding tool - declareProperty("BeamSpotSvc", m_beamService); - //extrapolator declareProperty("Extrapolator", m_extrapolator); @@ -102,8 +92,8 @@ namespace InDet std::vector<const Trk::Track*>::const_iterator tr = tracks.begin(); std::vector<const Trk::Track*>::const_iterator tre = tracks.end(); - - Trk::RecVertex beamRecVertex(m_beamService->beamVtx()); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + Trk::RecVertex beamRecVertex(beamSpotHandle->beamVtx()); for(;tr!=tre;++tr) if(m_trkFilter->decision(**tr,&beamRecVertex)) preselectedTracks.push_back(*tr); if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Beam spot position is: "<< beamRecVertex.position()<<endmsg; @@ -205,8 +195,8 @@ namespace InDet std::vector<const Trk::TrackParticleBase*>::const_iterator tre = tracks.end(); //using the beam position for pre-selection - - Trk::RecVertex beamRecVertex(m_beamService->beamVtx()); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + Trk::RecVertex beamRecVertex(beamSpotHandle->beamVtx()); for(;tr!=tre;++tr) if(m_trkFilter->decision(**tr,&beamRecVertex)) preselectedTracks.push_back(*tr); if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Beam spot position is: "<< beamRecVertex.position()<<endmsg; Trk::Vertex* beamVertex=&beamRecVertex; @@ -326,8 +316,9 @@ std::vector< std::vector<const Trk::TrackParameters *> > SlidingWindowMultiSeedF xAOD::Vertex * beamposition = new xAOD::Vertex(); - beamposition->setPosition(m_beamService->beamVtx().position()); - beamposition->setCovariancePosition(m_beamService->beamVtx().covariancePosition()); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + beamposition->setPosition(beamSpotHandle->beamVtx().position()); + beamposition->setCovariancePosition(beamSpotHandle->beamVtx().covariancePosition()); // for(;tr!=tre;++tr) if(m_trkFilter->decision(**tr, &beamrecposition)) preselectedTracks.push_back(*tr); // if(msgLvl(MSG::DEBUG))msg(MSG::DEBUG)<<"Beam spot position is: "<< beamrecposition.position()<<endmsg; //Trk::Vertex* beamposition=&beamrecposition; diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/CMakeLists.txt b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/CMakeLists.txt index 9e9b771c11ce38d95d778556e8883de81b65ddf6..0513d9e1da330439917884eb0d06614d890062b6 100644 --- a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/CMakeLists.txt +++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/CMakeLists.txt @@ -11,7 +11,7 @@ find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread TMVA ) atlas_add_component( NewVrtSecInclusiveTool src/*.cxx src/components/*.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AnalysisUtilsLib AthenaBaseComps GaudiKernel GeoPrimitives InDetBeamSpotServiceLib MVAUtils PathResolver TrkExInterfaces TrkGeometry TrkNeutralParameters TrkTrackSummary TrkVKalVrtFitterLib VxSecVertex xAODTracking xAODTruth ) + LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} AnalysisUtilsLib AthenaBaseComps GaudiKernel GeoPrimitives BeamSpotConditionsData MVAUtils PathResolver TrkExInterfaces TrkGeometry TrkNeutralParameters TrkTrackSummary TrkVKalVrtFitterLib VxSecVertex xAODTracking xAODTruth ) # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool.h b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool.h index 4b9c1dca06e19eb721b5bf0cd220ee250699220b..b0eb0ddce9a93d7873e1742abb72ed34aab55d36 100755 --- a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool.h +++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool/NewVrtSecInclusiveTool.h @@ -35,7 +35,7 @@ // #include "xAODTruth/TruthEventContainer.h" #include "TrkExInterfaces/IExtrapolator.h" -// +#include "BeamSpotConditionsData/BeamSpotData.h" #include "VxSecVertex/VxSecVertexInfo.h" #include "NewVrtSecInclusiveTool/IVrtInclusive.h" @@ -44,7 +44,6 @@ class TH2D; class TH1F; class TProfile; class TTree; -class IBeamCondSvc; namespace Trk{ class TrkVKalVrtFitter; @@ -165,8 +164,8 @@ namespace Rec { std::unique_ptr<MVAUtils::BDT> m_SV2T_BDT; - ServiceHandle< IBeamCondSvc > m_beamService; - //ToolHandle<Trk::IVertexFitter> m_fitterSvc; + SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; + ToolHandle<Trk::IExtrapolator> m_extrapolator{this,"ExtrapolatorName","Trk::Extrapolator/Extrapolator"}; ToolHandle<Trk::TrkVKalVrtFitter> m_fitSvc; //Trk::TrkVKalVrtFitter* m_fitSvc{}; diff --git a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/NewVrtSecInclusiveTool.cxx b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/NewVrtSecInclusiveTool.cxx index 1edd8d47d6a38ca7f13850fa22c82f250dba756d..d5a24b552e8b3d7be27ae9548eaa8514c81590b2 100644 --- a/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/NewVrtSecInclusiveTool.cxx +++ b/Reconstruction/VKalVrt/NewVrtSecInclusiveTool/src/NewVrtSecInclusiveTool.cxx @@ -10,7 +10,6 @@ #include "NewVrtSecInclusiveTool/NewVrtSecInclusiveTool.h" #include "VxSecVertex/VxSecVertexInfo.h" #include "TrkVKalVrtFitter/TrkVKalVrtFitter.h" -#include "InDetBeamSpotService/IBeamCondSvc.h" #include "PathResolver/PathResolver.h" #include "GaudiKernel/ITHistSvc.h" @@ -64,7 +63,6 @@ NewVrtSecInclusiveTool::NewVrtSecInclusiveTool(const std::string& type, m_multiWithOneTrkVrt(true), m_calibFileName("Fake2TrVertexReject.MVA.v01.root"), m_SV2T_BDT(nullptr), - m_beamService("BeamCondSvc",name), m_fitSvc("Trk::TrkVKalVrtFitter/VertexFitterTool",this) { // @@ -117,7 +115,6 @@ NewVrtSecInclusiveTool::NewVrtSecInclusiveTool(const std::string& type, declareProperty("calibFileName", m_calibFileName, " MVA calibration file for 2-track fake vertices removal" ); - declareProperty("BeamSpotSvc", m_beamService, "Name of the BeamSpot service"); declareProperty("VertexFitterTool", m_fitSvc, "Name of the Vertex Fitter tool"); // m_massPi = Trk::ParticleMasses().mass[Trk::pion]; @@ -139,10 +136,8 @@ NewVrtSecInclusiveTool::NewVrtSecInclusiveTool(const std::string& type, StatusCode NewVrtSecInclusiveTool::initialize(){ ATH_MSG_DEBUG( "Initialising NewVrtSecInclusiveTool- Package version: " << PACKAGE_VERSION ); m_compatibilityGraph = new boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS>(); - - ATH_CHECK( m_beamService.retrieve() ); ATH_CHECK( m_extrapolator.retrieve() ); - + ATH_CHECK(m_beamSpotKey.initialize()); ATH_CHECK( m_fitSvc.retrieve() ); ATH_MSG_DEBUG("NewVrtSecInclusiveTool TrkVKalVrtFitter found"); @@ -324,11 +319,12 @@ NewVrtSecInclusiveTool::NewVrtSecInclusiveTool(const std::string& type, workVectorArrxAOD * tmpVectxAOD=new workVectorArrxAOD(); tmpVectxAOD->inpTrk.resize(inpTrk.size()); std::copy(inpTrk.begin(),inpTrk.end(), tmpVectxAOD->inpTrk.begin()); - tmpVectxAOD->beamX=m_beamService->beamPos().x(); - tmpVectxAOD->beamY=m_beamService->beamPos().y(); - tmpVectxAOD->beamZ=m_beamService->beamPos().z(); - tmpVectxAOD->tanBeamTiltX=tan(m_beamService->beamTilt(0)); - tmpVectxAOD->tanBeamTiltY=tan(m_beamService->beamTilt(1)); + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + tmpVectxAOD->beamX=beamSpotHandle->beamPos().x(); + tmpVectxAOD->beamY=beamSpotHandle->beamPos().y(); + tmpVectxAOD->beamZ=beamSpotHandle->beamPos().z(); + tmpVectxAOD->tanBeamTiltX=tan(beamSpotHandle->beamTilt(0)); + tmpVectxAOD->tanBeamTiltY=tan(beamSpotHandle->beamTilt(1)); listVrtSec = getVrtSecMulti(tmpVectxAOD,primVrt); diff --git a/Reconstruction/VKalVrt/TrkToLeptonPVTool/CMakeLists.txt b/Reconstruction/VKalVrt/TrkToLeptonPVTool/CMakeLists.txt index d0607d657fdf16cb7f601e739d6835e06fa47ba0..91a6764f18d5a75dfed9a90e9a048cd01f6dc4ae 100644 --- a/Reconstruction/VKalVrt/TrkToLeptonPVTool/CMakeLists.txt +++ b/Reconstruction/VKalVrt/TrkToLeptonPVTool/CMakeLists.txt @@ -15,7 +15,7 @@ atlas_add_library ( TrkToLeptonPVToolLib PUBLIC_HEADERS TrkToLeptonPVTool INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps xAODTracking xAODEventInfo GaudiKernel - TrkVKalVrtFitterLib TrkVertexFitterInterfaces InDetBeamSpotServiceLib) + TrkVKalVrtFitterLib TrkVertexFitterInterfaces BeamSpotConditionsData) atlas_add_component ( TrkToLeptonPVTool src/components/*.cxx diff --git a/Reconstruction/VKalVrt/TrkToLeptonPVTool/TrkToLeptonPVTool/TrkToLeptonPVTool.h b/Reconstruction/VKalVrt/TrkToLeptonPVTool/TrkToLeptonPVTool/TrkToLeptonPVTool.h index 08808cccb980cf205be0ec5bdef104e6b33ce0e2..bcd2054c4f7d284917282cb5d5435e09c81be4f8 100644 --- a/Reconstruction/VKalVrt/TrkToLeptonPVTool/TrkToLeptonPVTool/TrkToLeptonPVTool.h +++ b/Reconstruction/VKalVrt/TrkToLeptonPVTool/TrkToLeptonPVTool/TrkToLeptonPVTool.h @@ -23,7 +23,7 @@ #include "GaudiKernel/ServiceHandle.h" #include "TrkToLeptonPVTool/ITrkToLeptonPV.h" #include "TrkVertexFitterInterfaces/IVertexFitter.h" -#include "InDetBeamSpotService/IBeamCondSvc.h" +#include "BeamSpotConditionsData/BeamSpotData.h" // @@ -47,7 +47,7 @@ private: - ServiceHandle< IBeamCondSvc > m_beamService{this,"BeamCondSvc","BeamCondSvc"}; + SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; ToolHandle< Trk::IVertexFitter > m_fitterSvc{this,"VertexFitter","Trk::TrkVKalVrtFitter/VertexFitterTool","Vertex Fitter tool instance"}; }; diff --git a/Reconstruction/VKalVrt/TrkToLeptonPVTool/src/TrkToLeptonPVTool.cxx b/Reconstruction/VKalVrt/TrkToLeptonPVTool/src/TrkToLeptonPVTool.cxx index a9d03c94b68a49c4d6ae54b5a4f70ea054e71159..2580b0b366b980e5a32d7c6472564dae87e73729 100644 --- a/Reconstruction/VKalVrt/TrkToLeptonPVTool/src/TrkToLeptonPVTool.cxx +++ b/Reconstruction/VKalVrt/TrkToLeptonPVTool/src/TrkToLeptonPVTool.cxx @@ -37,10 +37,7 @@ TrkToLeptonPVTool::TrkToLeptonPVTool(const std::string& type, ATH_MSG_DEBUG("TrkToLeptonPVTool TrkVKalVrtFitter found"); } //----- - if(m_beamService.retrieve().isFailure()) { - ATH_MSG_DEBUG("Can't retrieve BeamService"); - return StatusCode::FAILURE; - } + ATH_CHECK(m_beamSpotKey.initialize()); //----- return StatusCode::SUCCESS; } @@ -116,15 +113,17 @@ TrkToLeptonPVTool::TrkToLeptonPVTool(const std::string& type, BEAM.setCovariancePosition(beamcov); beamtiltX= eventINFO->beamTiltXZ(); beamtiltY= eventINFO->beamTiltYZ(); - } - if(m_beamService && fullxAOD ){ + } + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + + if(beamSpotHandle.isValid() && fullxAOD ){ ATH_MSG_DEBUG("Beam service is present"); - BEAM.setPosition(m_beamService->beamVtx().position()); - beamcov = m_beamService->beamVtx().covariancePosition(); + BEAM.setPosition(beamSpotHandle->beamVtx().position()); + beamcov = beamSpotHandle->beamVtx().covariancePosition(); beamcov(2,2) *= 1.e6; //Remove any constraint in Z direction BEAM.setCovariancePosition(beamcov); - beamtiltX= m_beamService->beamTilt(0); - beamtiltY= m_beamService->beamTilt(1); + beamtiltX= beamSpotHandle->beamTilt(0); + beamtiltY= beamSpotHandle->beamTilt(1); } if(fullxAOD){ ATH_MSG_DEBUG("xAOD data"); } else { ATH_MSG_DEBUG("DxAOD data");}