From 4029c3e067d6cfe8a756eef18cde07dc56be1d64 Mon Sep 17 00:00:00 2001 From: Savanna Marie Shaw <savanna.marie.shaw@cern.ch> Date: Tue, 21 Mar 2017 14:25:14 +0100 Subject: [PATCH] Muon data handle migration. Migrate DCMathSegmentMaker and MuonPatternSegmentMaker to use data handles. Fix copy and paste of property name in TrigMuonEF. Former-commit-id: 7c3c6710292dd4a1684bada7ed6358710d5ed2a0 --- .../src/DCMathSegmentMaker.cxx | 55 +++++++++++++++++-- .../src/DCMathSegmentMaker.h | 7 +++ .../src/MuonPatternCalibration.cxx | 4 +- .../src/MuonPatternSegmentMaker.cxx | 4 +- .../src/TrigMuonEFStandaloneTrackTool.cxx | 17 ++---- 5 files changed, 68 insertions(+), 19 deletions(-) diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx index 6d8cc9e9fac4..9a5dc1a5eaff 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx @@ -99,7 +99,10 @@ namespace Muon { m_phimax(0.), m_refit(false), m_isEndcap(false), - m_nmultipleHitWarnings(0) + m_nmultipleHitWarnings(0), + m_rpcKey("RPC_Measurements"), + m_tgcKey("TGC_Measurements"), + m_mdtKey("MDT_DriftCircles") { declareInterface<IMuonSegmentMaker>(this); declareInterface<IMuonSegmentTriggerHitAssociator>(this); @@ -140,6 +143,11 @@ namespace Muon { declareProperty("UpdatePhiUsingPhiHits",m_updatePhiUsingPhiHits = false ); declareProperty("AssumePointingPhi",m_assumePointingPhi = false ); declareProperty("Redo2DFit", m_redo2DFit = true ); + + declareProperty("RpcPrepDataContainer", m_rpcKey); + declareProperty("TgcPrepDataContainer", m_tgcKey); + declareProperty("MdtPrepDataContainer", m_mdtKey); + } DCMathSegmentMaker::~DCMathSegmentMaker() @@ -225,6 +233,21 @@ namespace Muon { ATH_MSG_INFO(" Using " << m_dcslFitProvider); } + //initialise for data handles + + if(!m_rpcKey.initialize()){ + ATH_MSG_ERROR("Couldn't initalize RPC ReadHandleKey"); + return StatusCode::FAILURE; + } + if(!m_tgcKey.initialize()){ + ATH_MSG_ERROR("Couldn't initalize TGC ReadHandleKey"); + return StatusCode::FAILURE; + } + if(!m_mdtKey.initialize()){ + ATH_MSG_ERROR("Couldn't initalize MDT ReadHandleKey"); + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; } @@ -374,10 +397,18 @@ namespace Muon { if( m_isEndcap ){ const Muon::TgcPrepDataContainer* prdContainer = 0; - if( evtStore()->retrieve(prdContainer,"TGC_Measurements").isFailure() || !prdContainer ) { + SG::ReadHandle<Muon::TgcPrepDataContainer> TgcCont(m_tgcKey); + if( !TgcCont.isValid() ) { ATH_MSG_WARNING("Cannot retrieve TgcPrepDataContainer "); return; } + else { + prdContainer = TgcCont.cptr(); + } + if(!prdContainer){ + ATH_MSG_WARNING("No TGC prd container retrieved"); + return; + } // loop over chambers and get collections std::set<IdentifierHash>::const_iterator chit = chIdHs.begin(); @@ -407,10 +438,18 @@ namespace Muon { }else{ const Muon::RpcPrepDataContainer* prdContainer = 0; - if( evtStore()->retrieve(prdContainer,"RPC_Measurements").isFailure() || !prdContainer ) { + SG::ReadHandle<Muon::RpcPrepDataContainer> RpcCont(m_rpcKey); + if(!RpcCont.isValid()){ ATH_MSG_WARNING("Cannot retrieve RpcPrepDataContainer "); return; } + else{ + prdContainer = RpcCont.cptr(); + } + if(!prdContainer){ + ATH_MSG_WARNING("No RPC prd container retrieved"); + return; + } // loop over chambers and get collections std::set<IdentifierHash>::const_iterator chit = chIdHs.begin(); @@ -2381,10 +2420,18 @@ namespace Muon { IdentifierHash colHash; if( m_idHelperTool->mdtIdHelper().get_module_hash(m_idHelperTool->chamberId(id),colHash) == 0 ){ const MdtPrepDataContainer* prdContainer = 0; - if( evtStore()->retrieve(prdContainer,"MDT_DriftCircles").isFailure() || !prdContainer ) { + SG::ReadHandle<Muon::MdtPrepDataContainer> MdtCont(m_mdtKey); + if(!MdtCont.isValid()){ ATH_MSG_WARNING("Cannot retrieve MdtPrepDataContainer "); return 0; } + else{ + prdContainer = MdtCont.cptr(); + } + if(!prdContainer){ + ATH_MSG_WARNING("No MDT prd collection retrieved"); + return 0; + } MdtPrepDataContainer::const_iterator colIt = prdContainer->indexFind(colHash); if( colIt == prdContainer->end() || !*colIt ) return 0; const MdtPrepDataCollection& col = **colIt; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.h index 5d474894648e..85dde5835aba 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.h @@ -26,6 +26,8 @@ #include "EventPrimitives/EventPrimitives.h" #include "GeoPrimitives/GeoPrimitives.h" +#include "MuonPrepRawData/RpcPrepDataContainer.h" + #include <vector> #include <set> #include <string> @@ -429,6 +431,11 @@ class MdtDriftCircleOnTrack; mutable Amg::Transform3D m_amdbToGlobal; //<! station to global transform mutable std::vector<const Trk::MeasurementBase*> m_measurementsToBeDeleted; mutable unsigned int m_nmultipleHitWarnings; + + SG::ReadHandleKey <Muon::RpcPrepDataContainer> m_rpcKey; + SG::ReadHandleKey <Muon::TgcPrepDataContainer> m_tgcKey; + SG::ReadHandleKey <Muon::MdtPrepDataContainer> m_mdtKey; + }; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternCalibration.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternCalibration.cxx index 0780e1e839d8..25f728ef2ccf 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternCalibration.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternCalibration.cxx @@ -670,14 +670,14 @@ namespace Muon { if( !RpcCont.isValid() ) { ATH_MSG_DEBUG(" Failed to retrieve RpcPrepDataContainer, will not recover rpc trigger hits "); } - else m_rpcPrdContainer=RpcCont.get(); + else m_rpcPrdContainer=RpcCont.cptr(); m_tgcPrdContainer=0; SG::ReadHandle<Muon::TgcPrepDataContainer> TgcCont(m_keyTgc); if(!TgcCont.isValid() ) { ATH_MSG_DEBUG(" Failed to retrieve TgcPrepDataContainer, will not recover tgc trigger hits "); } - else m_tgcPrdContainer=TgcCont.get(); + else m_tgcPrdContainer=TgcCont.cptr(); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternSegmentMaker.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternSegmentMaker.cxx index 64041d6c5380..d6eee453f20e 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternSegmentMaker.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonPatternSegmentMaker/src/MuonPatternSegmentMaker.cxx @@ -745,14 +745,14 @@ namespace Muon { if( !RpcCont.isValid() ) { ATH_MSG_DEBUG(" Failed to retrieve RpcPrepDataContainer, will not recover rpc trigger hits "); } - else m_rpcPrdContainer=RpcCont.get(); + else m_rpcPrdContainer=RpcCont.cptr(); m_tgcPrdContainer=0; SG::ReadHandle<Muon::TgcPrepDataContainer> TgcCont(m_keyTgc); if(!TgcCont.isValid() ) { ATH_MSG_DEBUG(" Failed to retrieve TgcPrepDataContainer, will not recover tgc trigger hits "); } - else m_tgcPrdContainer=TgcCont.get(); + else m_tgcPrdContainer=TgcCont.cptr(); } } diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx index 1f02274d2aec..4bc502857a28 100644 --- a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx +++ b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx @@ -190,7 +190,7 @@ TrigMuonEFStandaloneTrackTool::TrigMuonEFStandaloneTrackTool(const std::string& declareProperty("maxMdtHits",m_maxMdtHits); declareProperty("RpcPrepDataContainer", m_rpcKey); declareProperty("TgcPrepDataContainer", m_tgcKey); - declareProperty("TgcPrepDataContainer", m_tgcKeyNextBC); + declareProperty("TgcPrepDataContainerNextBC", m_tgcKeyNextBC); declareProperty("MdtPrepDataContainer", m_mdtKey); declareProperty("CscPrepDataContainer", m_cscKey); @@ -455,11 +455,6 @@ StatusCode TrigMuonEFStandaloneTrackTool::initialize() ATH_MSG_ERROR("Couldn't initalize CSC ReadHandleKey"); return StatusCode::FAILURE; } - // ATH_CHECK(m_rpcKey); - // ATH_CHECK(m_tgcKey); - // ATH_CHECK(m_tgcKeynextBC); - // ATH_CHECK(m_cscKey); - // ATH_CHECK(m_mdtKey); return StatusCode::SUCCESS; } @@ -1066,7 +1061,7 @@ if (m_useMdtData>0) { return HLT::NAV_ERROR; } else{ - rpcPrds=RpcCont.get(); + rpcPrds=RpcCont.cptr(); msg()<< MSG::DEBUG << " RPC PRD Container retrieved" << endmsg; } // Get RPC collections @@ -1127,7 +1122,7 @@ if (m_useMdtData>0) { return HLT::NAV_ERROR; } else{ - mdtPrds=MdtCont.get(); + mdtPrds=MdtCont.cptr(); msg()<< MSG::DEBUG << " MDT PRD Container retrieved" << endmsg; } @@ -1228,7 +1223,7 @@ if (m_useMdtData>0) { return HLT::NAV_ERROR; } else{ - tgcPrds=TgcCont.get(); + tgcPrds=TgcCont.cptr(); msg()<< MSG::DEBUG << " MDT PRD Container retrieved" << endmsg; } @@ -1313,7 +1308,7 @@ if (m_useMdtData>0) { return HLT::NAV_ERROR; } else{ - tgcPrds=TgcCont.get(); + tgcPrds=TgcCont.cptr(); msg()<< MSG::DEBUG << " MDT PRD Container retrieved" << endmsg; } @@ -1366,7 +1361,7 @@ if (m_useMdtData>0) { return HLT::NAV_ERROR; } else{ - cscPrds=CscCont.get(); + cscPrds=CscCont.cptr(); msg()<< MSG::DEBUG << " CSC PRD Container retrieved" << endmsg; } -- GitLab