diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentLocationFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentLocationFillerTool.cxx index 45737639ff7387eeb80595a995e9ab0d39de80f8..2620c80af5e7d03aa53f65ffdda0a8d745b4c360 100644 --- a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentLocationFillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentLocationFillerTool.cxx @@ -1,28 +1,19 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -////////////////////////////////////////////////////// -// -// Author : Srivas Prasad (srivas.prasad@cern.ch) -// Date : February 2010 -// -////////////////////////////////////////////////////// #include "MuonSegmentLocationFillerTool.h" #include "TrkSegment/Segment.h" #include "MuonSegment/MuonSegment.h" #include "AthenaKernel/errorcheck.h" #include "TrkEventPrimitives/LocalDirection.h" - namespace D3PD { - MuonSegmentLocationFillerTool::MuonSegmentLocationFillerTool (const std::string& type, const std::string& name, const IInterface* parent) : BlockFillerTool<Trk::Segment> (type, name, parent), - m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_idToFixedIdTool("MuonCalib::IdToFixedIdTool"), m_slPropagator("Trk::StraightLinePropagator/MuonStraightLinePropagator"), m_pullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator") @@ -35,7 +26,7 @@ StatusCode MuonSegmentLocationFillerTool::initialize() { CHECK( BlockFillerTool<Trk::Segment>::initialize() ); CHECK( m_edmHelperSvc.retrieve() ); - CHECK( m_idHelperTool.retrieve() ); + CHECK( m_idHelperSvc.retrieve() ); CHECK( m_idToFixedIdTool.retrieve() ); CHECK( m_slPropagator.retrieve() ); CHECK( m_pullCalculator.retrieve() ); @@ -116,7 +107,7 @@ StatusCode MuonSegmentLocationFillerTool::fill (const Trk::Segment& ts) { *m_thetaYZ_IP = (float) localIPDir.angleYZ(); Identifier chid = m_edmHelperSvc->chamberId(mSeg); - if( !(m_idHelperTool->isMuon(chid)) ) { // bad chid + if( !(m_idHelperSvc->isMuon(chid)) ) { // bad chid *m_stationName = -1; *m_sector = -1; *m_stationEta = -1; @@ -126,10 +117,10 @@ StatusCode MuonSegmentLocationFillerTool::fill (const Trk::Segment& ts) { *m_stationName = fid.stationName(); // chamber location information // should not happen...chamberId is supposed to return id only for MDT or CSC hits. - if(!fid.is_tgc() ) *m_sector = m_idHelperTool->sector(chid); + if(!fid.is_tgc() ) *m_sector = m_idHelperSvc->sector(chid); else *m_sector = 0; - *m_stationEta = m_idHelperTool->stationEta(chid); - *m_isEndcap = m_idHelperTool->isEndcap(chid); + *m_stationEta = m_idHelperSvc->stationEta(chid); + *m_isEndcap = m_idHelperSvc->isEndcap(chid); } const Trk::AtaPlane* pars = m_edmHelperSvc->createTrackParameters( mSeg ); @@ -148,20 +139,20 @@ StatusCode MuonSegmentLocationFillerTool::fill (const Trk::Segment& ts) { m_id->push_back(m_idToFixedIdTool->idToFixedId(id).getIdInt()); int type = 6; if( id.is_valid() ){ - if( m_idHelperTool->isMdt(id) ) type = 0; - else if( m_idHelperTool->isRpc(id) ) type = 1; - else if( m_idHelperTool->isTgc(id) ) type = 2; - else if( m_idHelperTool->isCsc(id) ) type = 3; - else if( m_idHelperTool->isMM(id) ) type = 4; - else if( m_idHelperTool->issTgc(id) ) type = 5; + if( m_idHelperSvc->isMdt(id) ) type = 0; + else if( m_idHelperSvc->isRpc(id) ) type = 1; + else if( m_idHelperSvc->isTgc(id) ) type = 2; + else if( m_idHelperSvc->isCsc(id) ) type = 3; + else if( m_idHelperSvc->isMM(id) ) type = 4; + else if( m_idHelperSvc->issTgc(id) ) type = 5; - if( m_idHelperTool->issTgc(id) ){ - int chtype = m_idHelperTool->stgcIdHelper().channelType(id); + if( m_idHelperSvc->issTgc(id) ){ + int chtype = m_idHelperSvc->stgcIdHelper().channelType(id); type += 1000*chtype; if( chtype == 0 ) ++npadHits; else if( chtype == 1 ) ++netaTrigHits; else ++nphiHits; - }else if( !m_idHelperTool->measuresPhi(id) ) { + }else if( !m_idHelperSvc->measuresPhi(id) ) { if( type == 1 || type ==3 ) ++netaTrigHits; else ++netaHits; type += 1000; @@ -191,16 +182,16 @@ StatusCode MuonSegmentLocationFillerTool::fill (const Trk::Segment& ts) { res = resPull->residual().front(); pullub = resPull->pull().front(); delete resPull; - }else ATH_MSG_WARNING("Failed to calculate biased residual for " << m_idHelperTool->toString(id) ); + }else ATH_MSG_WARNING("Failed to calculate biased residual for " << m_idHelperSvc->toString(id) ); resPull = m_pullCalculator->residualPull( &meas, exPars, Trk::ResidualPull::Unbiased ); if( resPull ) { pullb = resPull->pull().front(); delete resPull; - }else ATH_MSG_WARNING("Failed to calculate biased residual for " << m_idHelperTool->toString(id) ); + }else ATH_MSG_WARNING("Failed to calculate biased residual for " << m_idHelperSvc->toString(id) ); delete exPars; }else{ - ATH_MSG_WARNING("Failed to obtain track parameters for " << m_idHelperTool->toString(id) ); + ATH_MSG_WARNING("Failed to obtain track parameters for " << m_idHelperSvc->toString(id) ); } m_residual->push_back(res); m_biasedPull->push_back(pullb); diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentLocationFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentLocationFillerTool.h index ffef66de28b2c087c54902be86b7d3e9447d31b7..a3542fc5bb8116d26169c64f78decb8172ab6d62 100644 --- a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentLocationFillerTool.h +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentLocationFillerTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -16,8 +16,9 @@ #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" + #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonCalibITools/IIdToFixedIdTool.h" #include "TrkExInterfaces/IPropagator.h" #include "TrkGeometry/MagneticFieldProperties.h" @@ -27,10 +28,8 @@ namespace Trk { class Segment; } - namespace D3PD { - class MuonSegmentLocationFillerTool : public BlockFillerTool<Trk::Segment> { @@ -90,7 +89,7 @@ private: ServiceHandle<Muon::IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; - ToolHandle<Muon::MuonIdHelperTool> m_idHelperTool; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle<MuonCalib::IIdToFixedIdTool> m_idToFixedIdTool; ToolHandle<Trk::IPropagator> m_slPropagator; ToolHandle<Trk::IResidualPullCalculator> m_pullCalculator; diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.cxx index 0cb6ef9ca20a0ab2a8200f891752da5554f6caf9..4a332c5fd7db23b787d4084b26ec831530f80492 100644 --- a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.cxx @@ -1,13 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -////////////////////////////////////////////////////// -// -// Author : Srivas Prasad (srivas.prasad@cern.ch) -// Date : February 2010 -// -////////////////////////////////////////////////////// #include "MuonSegmentT0FillerTool.h" #include "TrkSegment/Segment.h" #include "MuonSegment/MuonSegment.h" @@ -20,10 +14,7 @@ namespace D3PD { MuonSegmentT0FillerTool::MuonSegmentT0FillerTool (const std::string& type, const std::string& name, const IInterface* parent) - : BlockFillerTool<Trk::Segment> (type, name, parent) - // m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), - // m_idToFixedIdTool("MuonCalib::IdToFixedIdTool") -{ + : BlockFillerTool<Trk::Segment> (type, name, parent) { declareProperty("doMuonBoyCSCTiming", m_doMuonBoyCSCTiming=false); book().ignore(); // Avoid coverity warnings. @@ -33,9 +24,6 @@ StatusCode MuonSegmentT0FillerTool::initialize() { CHECK( BlockFillerTool<Trk::Segment>::initialize() ); CHECK( m_edmHelperSvc.retrieve() ); - // CHECK( m_idHelperTool.retrieve() ); - // CHECK( m_idToFixedIdTool.retrieve() ); - return StatusCode::SUCCESS; } @@ -43,7 +31,6 @@ StatusCode MuonSegmentT0FillerTool::book() { CHECK( addVariable ("t0", m_t0) ); CHECK( addVariable ("t0err", m_t0err) ); - return StatusCode::SUCCESS; } diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.h index c555146033831d62cc3c4d5d2176374e176b3f38..d46c1fdbdce75e4fe54d7382cb856b6af4b21c56 100644 --- a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.h +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -15,10 +15,8 @@ #include "D3PDMakerUtils/BlockFillerTool.h" #include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/ToolHandle.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -//#include "MuonRecHelperTools/MuonIdHelperTool.h" -//#include "MuonCalibITools/IIdToFixedIdTool.h" + #include <string> namespace Trk { @@ -54,13 +52,9 @@ private: void MuonboyT0CSCSegment(const Muon::MuonSegment* pMuonSegment, float& t0, float& t0Error); std::string m_muonSegmentT0ContainerKey; - // tools ServiceHandle<Muon::IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; - // ToolHandle<Muon::MuonIdHelperTool> m_idHelperTool; - // ToolHandle<MuonCalib::IIdToFixedIdTool> m_idToFixedIdTool; - }; } // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.cxx index 5d6e54d2a232a4188cb5e3e05ebcb8a5af7d7c88..b0a2983d906015e009ac8e11723d71640bc4fefb 100644 --- a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.cxx @@ -1,6 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ + /** * @file MuonD3PDMaker/src/MuonTruthHitsFillerTool.cxx * @author scott snyder <snyder@bnl.gov>, from code by Niels van Eldik. @@ -8,17 +9,13 @@ * @brief Fill truth hit information for muons. */ - #include "MuonTruthHitsFillerTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" + #include "TrkTruthData/PRD_MultiTruthCollection.h" #include "AthenaKernel/errorcheck.h" #include "AtlasHepMC/GenParticle.h" - namespace D3PD { - - /** * @brief Standard Gaudi tool constructor. * @param type The name of the tool type. @@ -28,8 +25,7 @@ namespace D3PD { MuonTruthHitsFillerTool::MuonTruthHitsFillerTool (const std::string& type, const std::string& name, const IInterface* parent) - : Base (type, name, parent), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool") + : Base (type, name, parent) { declareProperty("PRD_TruthNames", m_PRD_TruthNames); m_PRD_TruthNames.push_back("CSC_TruthMap"); @@ -48,7 +44,7 @@ MuonTruthHitsFillerTool::MuonTruthHitsFillerTool (const std::string& type, */ StatusCode MuonTruthHitsFillerTool::initialize() { - CHECK( m_idHelper.retrieve() ); + CHECK( m_idHelperSvc.retrieve() ); return StatusCode::SUCCESS; } @@ -137,29 +133,29 @@ StatusCode MuonTruthHitsFillerTool::fillHitCounts (int barcode) if( mc.second->barcode() != barcode ) continue; found = true; const Identifier& id = mc.first; - ATH_MSG_VERBOSE("found matching hit " << m_idHelper->toString(id) ); - bool measPhi = m_idHelper->measuresPhi(id); + ATH_MSG_VERBOSE("found matching hit " << m_idHelperSvc->toString(id) ); + bool measPhi = m_idHelperSvc->measuresPhi(id); - if( m_idHelper->issTgc(id) ) { - int index = m_idHelper->phiIndex(id); + if( m_idHelperSvc->issTgc(id) ) { + int index = m_idHelperSvc->phiIndex(id); if( measPhi ) ++*(m_nphiHitsPerChamberLayer[index]); else ++*(m_ntrigEtaHitsPerChamberLayer[index]); } - else if( m_idHelper->isMM(id) ) { - int index = m_idHelper->isSmallChamber(id) ? MSI::ChIndexMax : MSI::ChIndexMax + 1; + else if( m_idHelperSvc->isMM(id) ) { + int index = m_idHelperSvc->isSmallChamber(id) ? MSI::ChIndexMax : MSI::ChIndexMax + 1; ++*(m_nprecHitsPerChamberLayer[index]); } - else if( m_idHelper->isTrigger(id) ) { - MSI::PhiIndex index = m_idHelper->phiIndex(id); + else if( m_idHelperSvc->isTrigger(id) ) { + MSI::PhiIndex index = m_idHelperSvc->phiIndex(id); if( measPhi ) ++*(m_nphiHitsPerChamberLayer[index]); else ++*(m_ntrigEtaHitsPerChamberLayer[index]); } else { if( measPhi ) { - Muon::MuonStationIndex::PhiIndex index = m_idHelper->phiIndex(id); + Muon::MuonStationIndex::PhiIndex index = m_idHelperSvc->phiIndex(id); ++*(m_nphiHitsPerChamberLayer[index]); }else{ - Muon::MuonStationIndex::ChIndex chIndex = m_idHelper->chamberIndex(id); + Muon::MuonStationIndex::ChIndex chIndex = m_idHelperSvc->chamberIndex(id); ++*(m_nprecHitsPerChamberLayer[chIndex]); } } diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.h b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.h index 9b39900b0878762a886fd453f3808e61af8fb2e5..b8b699c1293be85af243889580e3789667e6d4a5 100644 --- a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.h +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonTruthHitsFillerTool.h @@ -1,10 +1,7 @@ -// This file's extension implies that it's C, but it's really -*- C++ -*-. - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// $Id$ /** * @file MuonD3PDMaker/src/MuonTruthHitsFillerTool.h * @author scott snyder <snyder@bnl.gov>, from code by Niels van Eldik. @@ -12,27 +9,22 @@ * @brief Fill truth hit information for muons. */ - #ifndef MUOND3PDMAKER_MUONTRUTHHITSFILLERTOOL_H #define MUOND3PDMAKER_MUONTRUTHHITSFILLERTOOL_H +#include "D3PDMakerUtils/BlockFillerTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "D3PDMakerUtils/BlockFillerToolMulti.h" #include "TrackRecord/TrackRecord.h" #include "McParticleEvent/TruthParticle.h" #include "xAODTruth/TruthParticle.h" -#include "GaudiKernel/ToolHandle.h" -#include <vector> - - -namespace Muon { - class MuonIdHelperTool; -} +#include <vector> namespace D3PD { - /** * @brief Fill truth hit information for muons. */ @@ -90,8 +82,7 @@ private: std::vector<int*> m_nphiHitsPerChamberLayer; std::vector<int*> m_ntrigEtaHitsPerChamberLayer; - // other private - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; std::vector<std::string> m_PRD_TruthNames; }; diff --git a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagAmbiguitySolverTool.cxx b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagAmbiguitySolverTool.cxx index 9ac42b274a20a61479e58ef3b4162028ca7a19f3..1e74fd85c56f2e66cc30f35b6b007d450191b999 100644 --- a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagAmbiguitySolverTool.cxx +++ b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagAmbiguitySolverTool.cxx @@ -4,32 +4,15 @@ #include "MuTagAmbiguitySolverTool.h" -#include "StoreGate/StoreGateSvc.h" -#include "GaudiKernel/MsgStream.h" - #include "GaudiKernel/SmartDataPtr.h" #include "GaudiKernel/IDataProviderSvc.h" - -#include "Identifier/Identifier.h" -#include "MuonIdHelpers/MdtIdHelper.h" -#include "MuonIdHelpers/CscIdHelper.h" -#include "MuonIdHelpers/RpcIdHelper.h" -#include "MuonIdHelpers/TgcIdHelper.h" -#include "MuonReadoutGeometry/MuonDetectorManager.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" - #include "MuonSegment/MuonSegment.h" -//#include "TrkParameters/MeasuredPerigee.h" #include "MuonSegment/MuonSegmentQuality.h" #include "TrkEventPrimitives/LocalDirection.h" #include "MuonSegmentMakerUtils/MuonSegmentKey.h" #include "MuonSegmentMakerUtils/CompareMuonSegmentKeys.h" #include "MuonSegmentMakerToolInterfaces/IMuonSegmentMatchingTool.h" #include "TrkTrack/Track.h" - #include "MuonCombinedEvent/MuonSegmentInfo.h" MuTagAmbiguitySolverTool::MuTagAmbiguitySolverTool(const std::string& t, @@ -37,13 +20,7 @@ MuTagAmbiguitySolverTool::MuTagAmbiguitySolverTool(const std::string& t, const IInterface* p ): AthAlgTool(t,n,p), p_muonPrinter("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), - p_muonIdHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), - p_segmentMatchingTool("Muon::MuonSegmentMatchingTool/MuonSegmentMatchingTool"), - p_StoreGateSvc(0), - m_mdtIdHelper(0), - m_cscIdHelper(0), - m_rpcIdHelper(0), - m_tgcIdHelper(0) + p_segmentMatchingTool("Muon::MuonSegmentMatchingTool/MuonSegmentMatchingTool") { declareInterface<IMuTagAmbiguitySolverTool>(this); declareProperty("MuonSegmentMatchingTool" , p_segmentMatchingTool ) ; @@ -53,57 +30,26 @@ MuTagAmbiguitySolverTool::MuTagAmbiguitySolverTool(const std::string& t, declareProperty("RejectMatchPhi", m_rejectMatchPhi = true ); } -MuTagAmbiguitySolverTool::~MuTagAmbiguitySolverTool(){ -} - StatusCode MuTagAmbiguitySolverTool::initialize() { - ATH_CHECK( AthAlgTool::initialize() ); - - //Set pointer on StoreGateSvc - ATH_CHECK( service("StoreGateSvc", p_StoreGateSvc) ); ATH_MSG_INFO( "================================" ); ATH_MSG_INFO( "=Proprieties are " ); ATH_MSG_INFO( "================================" ); - // retrieve MuonDetectorManager - const MuonGM::MuonDetectorManager* detMgr; - ATH_CHECK( detStore()->retrieve(detMgr) ); - - // initialize MuonIdHelpers - if (detMgr) { - m_mdtIdHelper = detMgr->mdtIdHelper(); - m_cscIdHelper = detMgr->cscIdHelper(); - m_rpcIdHelper = detMgr->rpcIdHelper(); - m_tgcIdHelper = detMgr->tgcIdHelper(); - } else { - m_mdtIdHelper = 0; - m_cscIdHelper = 0; - m_rpcIdHelper = 0; - m_tgcIdHelper = 0; - } - ATH_CHECK( m_edmHelperSvc.retrieve() ); ATH_CHECK( p_muonPrinter.retrieve() ); - ATH_CHECK( p_muonIdHelper.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_CHECK( p_segmentMatchingTool.retrieve() ); return StatusCode::SUCCESS; } -StatusCode MuTagAmbiguitySolverTool::finalize(){ - return AthAlgTool::finalize(); -} - - - std::vector< MuonCombined::MuonSegmentInfo > MuTagAmbiguitySolverTool::solveAmbiguities( std::vector< MuonCombined::MuonSegmentInfo > mtos ) const { - // std::vector< MuonCombined::MuonSegmentInfo > outputMTOs; +std::vector< MuonCombined::MuonSegmentInfo > MuTagAmbiguitySolverTool::solveAmbiguities( std::vector< MuonCombined::MuonSegmentInfo > mtos ) const { ATH_MSG_DEBUG( "mtos size before any cuts " << mtos.size() ); // Store the number of segments associated to one track (pointer) - for( unsigned int ns1 = 0; ns1 < mtos.size(); ns1++){ ATH_MSG_DEBUG( " index " << ns1 << " nsegments " << mtos[ns1].nsegments << " track pointer " << mtos[ns1].track << " stationLayer " << mtos[ns1].stationLayer << " selected " << mtos[ns1].selected ); int nsegments = 1; @@ -294,21 +240,21 @@ int MuTagAmbiguitySolverTool::ambiguousSegment( const Muon::MuonSegment& seg1, c // check whether the segments are in the same station layer Identifier ch1 = m_edmHelperSvc->chamberId(seg1); Identifier ch2 = m_edmHelperSvc->chamberId(seg2); - Muon::MuonStationIndex::StIndex st1 = p_muonIdHelper->stationIndex(ch1); - Muon::MuonStationIndex::StIndex st2 = p_muonIdHelper->stationIndex(ch2); + Muon::MuonStationIndex::StIndex st1 = m_idHelperSvc->stationIndex(ch1); + Muon::MuonStationIndex::StIndex st2 = m_idHelperSvc->stationIndex(ch2); if( st1 != st2 ) return 0; // check whether the segments are in the same chamber layer (small/large) - Muon::MuonStationIndex::ChIndex chI1 = p_muonIdHelper->chamberIndex(ch1); - Muon::MuonStationIndex::ChIndex chI2 = p_muonIdHelper->chamberIndex(ch2); + Muon::MuonStationIndex::ChIndex chI1 = m_idHelperSvc->chamberIndex(ch1); + Muon::MuonStationIndex::ChIndex chI2 = m_idHelperSvc->chamberIndex(ch2); if( chI1 != chI2 ){ // only match if segments both MDT or both CSC - if( p_muonIdHelper->isMdt(ch1) == p_muonIdHelper->isMdt(ch2) ) { + if( m_idHelperSvc->isMdt(ch1) == m_idHelperSvc->isMdt(ch2) ) { // make sure segments are in same sector or neighbouring one - int sector1 = p_muonIdHelper->sector(ch1); - int sector2 = p_muonIdHelper->sector(ch2); + int sector1 = m_idHelperSvc->sector(ch1); + int sector2 = m_idHelperSvc->sector(ch2); bool sectorOk = false; if( sector1 == sector2 ) sectorOk = true; if( abs(sector1-sector2) == 1 ) sectorOk = true; @@ -368,8 +314,8 @@ std::vector< MuonCombined::MuonSegmentInfo > MuTagAmbiguitySolverTool::selectBe } Identifier ch1 = m_edmHelperSvc->chamberId(*museg1); - Muon::MuonStationIndex::StIndex st1 = p_muonIdHelper->stationIndex(ch1); - int eta1 = p_muonIdHelper->stationEta(ch1); + Muon::MuonStationIndex::StIndex st1 = m_idHelperSvc->stationIndex(ch1); + int eta1 = m_idHelperSvc->stationEta(ch1); for( unsigned int mts2=mts1+1; mts2 < mtss.size() ; ++mts2 ){ @@ -380,10 +326,10 @@ std::vector< MuonCombined::MuonSegmentInfo > MuTagAmbiguitySolverTool::selectBe } Identifier ch2 = m_edmHelperSvc->chamberId(*museg2); - Muon::MuonStationIndex::StIndex st2 = p_muonIdHelper->stationIndex(ch2); + Muon::MuonStationIndex::StIndex st2 = m_idHelperSvc->stationIndex(ch2); if( st1 != st2 ) continue; - int eta2 = p_muonIdHelper->stationEta(ch2); + int eta2 = m_idHelperSvc->stationEta(ch2); if( eta1 != eta2 ) continue; if(ambiguousSegment(*museg1,*museg2)) { diff --git a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagAmbiguitySolverTool.h b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagAmbiguitySolverTool.h index da72eca3ed030ad20990b9f9f390e4c01a5726ac..fdb20cde2a1a77817c0682bb5337aa8babe76c92 100644 --- a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagAmbiguitySolverTool.h +++ b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagAmbiguitySolverTool.h @@ -1,25 +1,23 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MuTagAmbiguitySolverTool_H #define MuTagAmbiguitySolverTool_H +#include "MuonSegmentTaggerToolInterfaces/IMuTagAmbiguitySolverTool.h" #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include <string> + #include "TrkSegment/SegmentCollection.h" #include "MuonSegmentMakerToolInterfaces/IMuonSegmentMatchingTool.h" -#include "MuonSegmentTaggerToolInterfaces/IMuTagAmbiguitySolverTool.h" -#include "MuonCombinedEvent/MuonSegmentInfo.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" +#include "MuonCombinedEvent/MuonSegmentInfo.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" -class StoreGateSvc; -class MdtIdHelper; -class CscIdHelper; -class RpcIdHelper; -class TgcIdHelper; +#include <string> /** @class MuTagAmbiguitySolverTool @@ -30,18 +28,14 @@ class TgcIdHelper; namespace Muon { class MuonSegment; - class MuonEDMPrinterTool; - class MuonIdHelperTool; - class IMuonSegmentMatchingTool; } class MuTagAmbiguitySolverTool : virtual public IMuTagAmbiguitySolverTool, public AthAlgTool{ public: MuTagAmbiguitySolverTool(const std::string& t ,const std::string& n ,const IInterface* p); - virtual ~MuTagAmbiguitySolverTool (); + virtual ~MuTagAmbiguitySolverTool()=default; - virtual StatusCode initialize (); - virtual StatusCode finalize (); + virtual StatusCode initialize(); std::vector< MuonCombined::MuonSegmentInfo > solveAmbiguities( std::vector< MuonCombined::MuonSegmentInfo > mtos ) const ; @@ -56,14 +50,8 @@ class MuTagAmbiguitySolverTool : virtual public IMuTagAmbiguitySolverTool, publi "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; //!< Pointer on IMuonEDMHelperSvc ToolHandle< Muon::MuonEDMPrinterTool > p_muonPrinter ; //!< Pointer on MuonEDMPrinterTool - ToolHandle< Muon::MuonIdHelperTool > p_muonIdHelper ; //!< Pointer on MuonIdHelperTool + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle< Muon::IMuonSegmentMatchingTool> p_segmentMatchingTool ; //!< Pointer on MuonSegmentMatchingTool - StoreGateSvc* p_StoreGateSvc ; //!< Pointer On StoreGateSvc - - const MdtIdHelper* m_mdtIdHelper; - const CscIdHelper* m_cscIdHelper; - const RpcIdHelper* m_rpcIdHelper; - const TgcIdHelper* m_tgcIdHelper; bool m_hitOverlapMatching; //!< check hit overlap of segments in ambi solving bool m_slOverlapMatching; //!< for segments in a SL overlap in the same station layer, check whether from same particle diff --git a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.cxx b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.cxx index 13c163c6e9cc3b12da959f47e199eebd5e6f87ec..581e990d4cd4c7c0624ffcac797507510c413b84 100644 --- a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.cxx +++ b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.cxx @@ -1,49 +1,30 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include <cmath> - #include "MuTagMatchingTool.h" -#include "StoreGate/StoreGateSvc.h" -#include "GaudiKernel/MsgStream.h" - #include "GaudiKernel/SmartDataPtr.h" #include "GaudiKernel/IDataProviderSvc.h" - -#include "Identifier/Identifier.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" #include "TrkGeometry/MagneticFieldProperties.h" #include "TrkSurfaces/Surface.h" - -#include "MuonSegmentMakerToolInterfaces/IMuonSegmentSelectionTool.h" -#include "MuonSegmentMakerToolInterfaces/IMuonSegmentHitSummaryTool.h" -//#include "MuonSegmentMakerToolInterfaces/IMuTagMatchingTool.h" -#include "TrkToolInterfaces/IResidualPullCalculator.h" - #include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h" -//#include "TrkParameters/Perigee.h" #include "TrkParameters/TrackParameters.h" #include "TrkTrack/Track.h" - #include "TrkExInterfaces/IExtrapolator.h" #include "TrkExInterfaces/IPropagator.h" - #include "TrkEventPrimitives/LocalDirection.h" #include "TrkEventPrimitives/JacobianPhiThetaLocalAngles.h" #include "TrkEventPrimitives/PropDirection.h" #include "EventPrimitives/EventPrimitivesHelpers.h" - #include "TrkEventPrimitives/ResidualPull.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" - #include "MuonSegment/MuonSegment.h" #include "MuonSegment/MuonSegmentQuality.h" #include "MuonCombinedEvent/MuonSegmentInfo.h" +#include <cmath> + namespace { // local helper functions #if 0 @@ -62,7 +43,6 @@ namespace { } #endif - } @@ -76,7 +56,6 @@ MuTagMatchingTool::MuTagMatchingTool(const std::string& t, , m_hitSummaryTool("Muon::MuonSegmentHitSummaryTool/MuonSegmentHitSummaryTool") , m_selectionTool("Muon::MuonSegmentSelectionTool/MuonSegmentSelectionTool") , m_pullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator") - , p_StoreGateSvc(0) { declareInterface<IMuTagMatchingTool>(this); declareProperty( "IExtrapolator" , p_IExtrapolator ) ; @@ -112,17 +91,8 @@ MuTagMatchingTool::MuTagMatchingTool(const std::string& t, declareProperty( "MuonChamberT0s", m_t0Location = "MooreMuonChamberT0s" ); } -MuTagMatchingTool::~MuTagMatchingTool(){ -} - StatusCode MuTagMatchingTool::initialize() -{ - - ATH_CHECK( AthAlgTool::initialize() ); - -//Set pointer on StoreGateSvc - ATH_CHECK( service("StoreGateSvc", p_StoreGateSvc) ); - +{ ATH_MSG_DEBUG( "================================" ); ATH_MSG_DEBUG( "=Proprieties are " ); ATH_MSG_DEBUG( "GlobalThetaCut" << std::setw(10) << m_GLOBAL_THETA_CUT); @@ -149,13 +119,11 @@ StatusCode MuTagMatchingTool::initialize() ATH_MSG_DEBUG( "Retrieved tool " << p_IExtrapolator ); ATH_CHECK( p_propagator.retrieve() ); - -//Retrieve IdHelpers // MuonDetectorManager from the conditions store ATH_CHECK(m_DetectorManagerKey.initialize()); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_CHECK( m_edmHelperSvc.retrieve() ); ATH_CHECK( m_printer.retrieve() ); ATH_CHECK( m_pullCalculator.retrieve() ); @@ -163,10 +131,6 @@ StatusCode MuTagMatchingTool::initialize() return StatusCode::SUCCESS; } -StatusCode MuTagMatchingTool::finalize(){ - return AthAlgTool::finalize(); -} - bool MuTagMatchingTool::match( const Trk::TrackParameters* atSurface, const Muon::MuonSegment* segment, std::string surfaceName ) const { @@ -201,11 +165,11 @@ std::string MuTagMatchingTool::segmentStationString( const Muon::MuonSegment* se continue; } Identifier segID = segment->rioOnTrack(i)->identify(); - if( m_muonIdHelperTool->mdtIdHelper().is_mdt(segID) ){ - station = m_muonIdHelperTool->mdtIdHelper().stationNameString( m_muonIdHelperTool->mdtIdHelper().stationName( segID ) ); + if( m_idHelperSvc->isMdt(segID) ){ + station = m_idHelperSvc->mdtIdHelper().stationNameString( m_idHelperSvc->mdtIdHelper().stationName( segID ) ); break; - } else if( m_muonIdHelperTool->isCsc(segID) ){ - station = m_muonIdHelperTool->cscIdHelper().stationNameString( m_muonIdHelperTool->cscIdHelper().stationName( segID ) ); + } else if( m_idHelperSvc->isCsc(segID) ){ + station = m_idHelperSvc->cscIdHelper().stationNameString( m_idHelperSvc->cscIdHelper().stationName( segID ) ); break ; } } @@ -701,8 +665,8 @@ void MuTagMatchingTool::nrTriggerHits( const Muon::MuonSegment* seg, int& nRPC, if( !rot ) { continue; } - if( m_muonIdHelperTool->rpcIdHelper().is_rpc( rot->identify() ) ) ++nRPC; - if( m_muonIdHelperTool->tgcIdHelper().is_tgc( rot->identify() ) ) ++nTGC; + if( m_idHelperSvc->isRpc( rot->identify() ) ) ++nRPC; + if( m_idHelperSvc->isTgc( rot->identify() ) ) ++nTGC; } } @@ -785,10 +749,6 @@ MuonCombined::MuonSegmentInfo MuTagMatchingTool::muTagSegmentInfo( const Trk::Tr // Local angles Trk::LocalDirection segLocDir = segment->localDirection() ; - // const Trk::PlaneSurface psf( exTrack->associatedSurface() ); - //Amg::Vector3D<double> exGlobDir( exTrack->momentum() ); - //Amg::Vector3D exGlobDir(exTrack->momentum() ); - //const Trk::LocalDirection* exTrkLocDir = psf->(globalToLocalDirection( exGlobDir ) ; Trk::LocalDirection exTrkLocDir ; exTrack->associatedSurface().globalToLocalDirection(exTrack->momentum(),exTrkLocDir); info.dangleYZ = exTrkLocDir.angleYZ() - segLocDir.angleYZ(); //deltaYZ @@ -802,7 +762,6 @@ MuonCombined::MuonSegmentInfo MuTagMatchingTool::muTagSegmentInfo( const Trk::Tr info.exErrorXZ = exTrkErrXZ; info.exErrorYZ = exTrkErrYZ; info.exCovYZY = covLocYYZ; -// if(exTrack) ATH_MSG_DEBUG( " covValue(Trk::theta,Trk::locY) " << measPars->localErrorMatrix().covValue(Trk::theta,Trk::locY) << " covLocYYZ " << covLocYYZ ); calculateLocalAngleErrors ( segment, segErrXZ, segErrYZ ); info.segErrorXZ = segErrXZ; info.segErrorYZ = segErrYZ; @@ -823,7 +782,7 @@ MuonCombined::MuonSegmentInfo MuTagMatchingTool::muTagSegmentInfo( const Trk::Tr Identifier chId = m_edmHelperSvc->chamberId(*segment); - Muon::MuonStationIndex::StIndex stIndex = m_muonIdHelperTool->stationIndex(chId); + Muon::MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(chId); // // residuals and pulls in X coordinate (along tube) // @@ -854,12 +813,12 @@ MuonCombined::MuonSegmentInfo MuTagMatchingTool::muTagSegmentInfo( const Trk::Tr Identifier id = mdt->identify(); // get layer index - int lay = m_muonIdHelperTool->mdtIdHelper().tubeLayer(id); - int tube = m_muonIdHelperTool->mdtIdHelper().tube(id); + int lay = m_idHelperSvc->mdtIdHelper().tubeLayer(id); + int tube = m_idHelperSvc->mdtIdHelper().tube(id); const MuonGM::MdtReadoutElement* detEl = mdt->prepRawData() ? mdt->prepRawData()->detectorElement() : MuonDetMgr->getMdtReadoutElement(id); if( !detEl ){ - ATH_MSG_WARNING(" could not get MdtReadoutElement for tube " << m_muonIdHelperTool->toString(id)); + ATH_MSG_WARNING(" could not get MdtReadoutElement for tube " << m_idHelperSvc->toString(id)); continue; } double tubeLen = detEl->getActiveTubeLength(lay,tube); @@ -867,10 +826,10 @@ MuonCombined::MuonSegmentInfo MuTagMatchingTool::muTagSegmentInfo( const Trk::Tr // use SL within station to speed up extrapolation const Trk::TrackParameters* exP = p_propagator->propagate(*exTrack, mdt->associatedSurface(), Trk::anyDirection, false, Trk::NoField); if( !exP ){ - ATH_MSG_WARNING("Failed to extrapolate to " << m_muonIdHelperTool->toString(id)); + ATH_MSG_WARNING("Failed to extrapolate to " << m_idHelperSvc->toString(id)); continue; } - ATH_MSG_DEBUG(m_muonIdHelperTool->toString(id) << " exPos " << exP->parameters()[Trk::locR] << " y " << exP->parameters()[Trk::locZ] + ATH_MSG_DEBUG(m_idHelperSvc->toString(id) << " exPos " << exP->parameters()[Trk::locR] << " y " << exP->parameters()[Trk::locZ] << " tubeL " << tubeLen); double exResidual = fabs(exP->parameters()[Trk::locZ]) - 0.5*tubeLen; if( maxResXMdt < exResidual ) maxResXMdt = exResidual; @@ -880,11 +839,11 @@ MuonCombined::MuonSegmentInfo MuTagMatchingTool::muTagSegmentInfo( const Trk::Tr // get id and check that it is a muon hit id Identifier id = m_edmHelperSvc->getIdentifier(**mit); - if( !id.is_valid() || !m_muonIdHelperTool->isMuon(id) ) continue; - if( !m_muonIdHelperTool->measuresPhi(id) ) continue; + if( !id.is_valid() || !m_idHelperSvc->isMuon(id) ) continue; + if( !m_idHelperSvc->measuresPhi(id) ) continue; const Trk::TrackParameters* exP = p_propagator->propagate(*exTrack, (*mit)->associatedSurface(), Trk::anyDirection, false, Trk::NoField); if( !exP ){ - ATH_MSG_WARNING("Failed to extrapolate to " << m_muonIdHelperTool->toString(id)); + ATH_MSG_WARNING("Failed to extrapolate to " << m_idHelperSvc->toString(id)); continue; } const Trk::ResidualPull* resPull = m_pullCalculator->residualPull( *mit, exP, Trk::ResidualPull::Unbiased ); @@ -907,7 +866,7 @@ MuonCombined::MuonSegmentInfo MuTagMatchingTool::muTagSegmentInfo( const Trk::Tr if( fabs(residual) < fabs(minResPhi) ) minResPhi = residual; if( fabs(pull) > fabs(minPullPhi) ) minPullPhi = pull; } - ATH_MSG_DEBUG(m_muonIdHelperTool->toString(id) << " residual " << residual << " pull " << pull); + ATH_MSG_DEBUG(m_idHelperSvc->toString(id) << " residual " << residual << " pull " << pull); delete resPull; delete exP; } @@ -915,8 +874,6 @@ MuonCombined::MuonSegmentInfo MuTagMatchingTool::muTagSegmentInfo( const Trk::Tr ATH_MSG_DEBUG("Residual phi min " << minResPhi << " max " << maxResPhi << " pull min " << minPullPhi << " max " << maxPullPhi << " dist from tube end " << maxResXMdt ); -// if( minResPhi < 1e8 ) delta_phi = minResPhi; // resX = minResPhi; - // // Store the local X variables // @@ -943,17 +900,7 @@ MuonCombined::MuonSegmentInfo MuTagMatchingTool::muTagSegmentInfo( const Trk::Tr } double dydyz = scale*info.exCovYZY; double correction = dydyz/(info.exErrorYZ*info.exErrorYZ); -/* -// -// Flip sign in endcap for eta > 0 (not understood why) -// - if(stIndex == Muon::MuonStationIndex::EI || stIndex == Muon::MuonStationIndex::EM || stIndex == Muon::MuonStationIndex::EO || stIndex == Muon::MuonStationIndex::EE) { - if(cos(segment->globalDirection().theta())>0) { - correction = -correction; - ATH_MSG_DEBUG(" Flip correlation term for segment direction theta " << segment->globalDirection().theta() << " position theta " << segment->globalPosition().theta()); - } - } -*/ + // // residual after taking into account the correlation with the angle YZ // @@ -981,8 +928,6 @@ MuonCombined::MuonSegmentInfo MuTagMatchingTool::muTagSegmentInfo( const Trk::Tr if (info.chi2Y<0) ATH_MSG_DEBUG( " NEGATIVE chi2Y " << chi2Y << " dydyz " << dydyz << " determinant " << det ); bool hasPhi = false; -// if( stIndex == Muon::MuonStationIndex::EI || stIndex == Muon::MuonStationIndex::EM || -// stIndex == Muon::MuonStationIndex::BM || stIndex == Muon::MuonStationIndex::BO ) hasPhi = true; if(hitCounts.nexpectedTrigHitLayers> 1) hasPhi = true; @@ -999,7 +944,7 @@ MuonCombined::MuonSegmentInfo MuTagMatchingTool::muTagSegmentInfo( const Trk::Tr if( stIndex == Muon::MuonStationIndex::BM ) info.stationLayer = 2; if( stIndex == Muon::MuonStationIndex::BO ) info.stationLayer = 3; if( stIndex == Muon::MuonStationIndex::BE ) info.stationLayer = 4; - if( stIndex == Muon::MuonStationIndex::EI ) info.stationLayer = m_muonIdHelperTool->isMdt(chId) ? 11 : 21; + if( stIndex == Muon::MuonStationIndex::EI ) info.stationLayer = m_idHelperSvc->isMdt(chId) ? 11 : 21; if( stIndex == Muon::MuonStationIndex::EM ) info.stationLayer = 12; if( stIndex == Muon::MuonStationIndex::EO ) info.stationLayer = 13; if( stIndex == Muon::MuonStationIndex::EE ) info.stationLayer = 14; @@ -1038,11 +983,9 @@ MuonCombined::MuonSegmentInfo MuTagMatchingTool::muTagSegmentInfo( const Trk::Tr int selected = 0; scale = 1.; -// if(info.stationLayer==12) scale = 5./3.; if(fabs(info.pullY)<m_MATCH_THETA&&fabs(info.pullYZ)<m_MATCH_THETAANGLE&&fabs(info.pullCY)<scale*m_combinedPullCut&&info.pullChamber<m_chamberPullCut){ bool pass = true; -// if(info.hasPhi && (fabs(info.minimumPullPhi) > m_combinedPullCut && fabs(info.minimumPullPhi) < 100000. ) ) pass = false; if(pass) selected = 1; } @@ -1054,7 +997,6 @@ MuonCombined::MuonSegmentInfo MuTagMatchingTool::muTagSegmentInfo( const Trk::Tr } void MuTagMatchingTool::calculateLocalAngleErrors( const Muon::MuonSegment* segment, double& angleXZerror, double& angleYZerror ) const { - //const Trk::CovarianceMatrix& segGlobCov = segment->covariance(); const Amg::MatrixX& segGlobCov = segment->localCovariance(); angleXZerror = 999.; angleYZerror = 999.; @@ -1074,38 +1016,24 @@ MuonCombined::MuonSegmentInfo MuTagMatchingTool::muTagSegmentInfo( const Trk::Tr // Parameters are described as Trk::LocX, Trk::locY, Trk::phi, Trk::theta // So the errormatrix of the track 'localErrorMatrix' still holds global angle representation!!!! //retrieve Jabcobian to transform the global errors err_phi,err_theta to local errors err_alphaXZ, err_alphaYZ - // const CLHEP::HepRotation& glob2loc = exTrack->associatedSurface()->transform().getRotation().inverse(); const Amg::RotationMatrix3D& glob2loc = exTrack->associatedSurface().transform().rotation().inverse(); - //const CLHEP::HepVector& exTrkParms = exTrack->parameters(); const AmgVector(5)& exTrkParms = exTrack->parameters(); Trk::JacobianPhiThetaLocalAngles jacobianExTrk( exTrkParms[Trk::phi], exTrkParms[Trk::theta], glob2loc ); // start with global angles error matrix - //const Trk::CovarianceMatrix& exTrkGlobCov = exTrack->covariance(); - //const AmgSymMatrix(5)* exTrkGlobCov = exTrack->covariance(); - - //CLHEP::HepSymMatrix anglesCovGlob(2,0); Amg::MatrixX anglesCovGlob(2,2); - //anglesCovGlob(0,0) = exTrkGlobCov(Trk::phi,Trk::phi) ; anglesCovGlob(0,0) = (*exTrack->covariance())(Trk::phi,Trk::phi); - // anglesCovGlob(1,0) = exTrkGlobCov(Trk::theta,Trk::phi) ; anglesCovGlob(1,0) = (*exTrack->covariance())(Trk::theta,Trk::phi); - //anglesCovGlob(0,1) = exTrkGlobCov(Trk::phi,Trk::theta) ; anglesCovGlob(0,1) = (*exTrack->covariance())(Trk::phi,Trk::theta); - //anglesCovGlob(1,1) = exTrkGlobCov(Trk::theta,Trk::theta) ; anglesCovGlob(1,1) = (*exTrack->covariance())(Trk::theta,Trk::theta); // NEW METHOD - //const CLHEP::HepSymMatrix& anglesCovLoc = anglesCovGlob.similarity(jacobianExTrk); - //const AmgSymMatrix(5)& anglesCovLoc = anglesCovGlob.similarity(jacobianExTrk); const AmgSymMatrix(2)& anglesCovLoc = anglesCovGlob.similarity(jacobianExTrk); if (anglesCovLoc(0,0) >= 0) angleXZerror = std::sqrt( anglesCovLoc(0,0) ); if (anglesCovLoc(1,1) >= 0) angleYZerror = std::sqrt( anglesCovLoc(1,1) ); - //covLocYYZ = exTrkGlobCov[Trk::locY][Trk::phi]*jacobianExTrk[0][1] + exTrkGlobCov[Trk::locY][Trk::theta]*jacobianExTrk[1][1]; covLocYYZ = (*exTrack->covariance())(Trk::locY,Trk::phi)*jacobianExTrk(0,1) + (*exTrack->covariance())(Trk::locY,Trk::theta)*jacobianExTrk(1,1); - //ATH_MSG_DEBUG(" covLocYYZ " << covLocYYZ << " covlocytheta " << exTrkGlobCov[Trk::locY][Trk::theta] << " J01 " << jacobianExTrk[0][1] << " J11 " << jacobianExTrk[0][1] ); ATH_MSG_DEBUG(" covLocYYZ " << covLocYYZ << " covlocytheta " << (*exTrack->covariance())(Trk::locY,Trk::theta) << " J01 " << jacobianExTrk(0,1) << " J11 " << jacobianExTrk(0,1)); // some printout ATH_MSG_DEBUG( std::setw(20) << "Angles Jacobian used for TRACK angle errors below: " << jacobianExTrk ); @@ -1154,7 +1082,7 @@ bool MuTagMatchingTool::isCscSegment( const Muon::MuonSegment* seg ) const { if( !rot ) { continue; } - if( m_muonIdHelperTool->isCsc( rot->identify() ) ) isCsc=true; + if( m_idHelperSvc->isCsc( rot->identify() ) ) isCsc=true; } return isCsc; @@ -1175,7 +1103,7 @@ unsigned int MuTagMatchingTool::cscHits( const Muon::MuonSegment* seg ) const { if( !rot ) { continue; } - if( m_muonIdHelperTool->isCsc( rot->identify() ) ) ++nrHits; + if( m_idHelperSvc->isCsc( rot->identify() ) ) ++nrHits; } return nrHits ; diff --git a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.h b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.h index 14e07561d49ff4020de9843c02654f6b7e0abae0..451efa23230506e1242333001230411d95847dba 100644 --- a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.h +++ b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.h @@ -1,14 +1,15 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MuTagMatchingTool_H #define MuTagMatchingTool_H +#include "MuonSegmentTaggerToolInterfaces/IMuTagMatchingTool.h" #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" -#include <string> +#include "GaudiKernel/ToolHandle.h" + #include "TrkParameters/TrackParameters.h" #include "TrkGeometry/TrackingGeometry.h" #include "MuonSegment/MuonSegment.h" @@ -16,15 +17,15 @@ #include "TrkExInterfaces/IPropagator.h" #include "MuonSegmentMakerToolInterfaces/IMuonSegmentSelectionTool.h" #include "MuonSegmentMakerToolInterfaces/IMuonSegmentHitSummaryTool.h" -#include "MuonSegmentTaggerToolInterfaces/IMuTagMatchingTool.h" -//#include "TrkParameters/Perigee.h" #include "TrkParameters/TrackParameters.h" #include "MuonCombinedEvent/MuonSegmentInfo.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "TrkToolInterfaces/IResidualPullCalculator.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" -class StoreGateSvc; +#include <string> /** @class MuTagMatchingTool @@ -33,25 +34,17 @@ class StoreGateSvc; */ -namespace Muon { - class MuonEDMPrinterTool; -} - namespace Trk{ class Surface; class Track; - class IResidualPullCalculator; - // class PropDirection; } - class MuTagMatchingTool : virtual public IMuTagMatchingTool, public AthAlgTool{ public: MuTagMatchingTool(const std::string& t ,const std::string& n ,const IInterface* p); - virtual ~MuTagMatchingTool (); + virtual ~MuTagMatchingTool()=default; - virtual StatusCode initialize (); - virtual StatusCode finalize (); + virtual StatusCode initialize(); std::string segmentStationString( const Muon::MuonSegment* segment ) const ; @@ -134,8 +127,7 @@ class MuTagMatchingTool : virtual public IMuTagMatchingTool, public AthAlgTool{ ToolHandle<Trk::IExtrapolator> p_IExtrapolator ;//!< Pointer on IExtrapolator ToolHandle<Trk::IPropagator> p_propagator ;//!< Pointer on propagator for SL propagation - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ServiceHandle<Muon::IMuonEDMHelperSvc> m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsMS/src/SimHitCreatorMS.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsMS/src/SimHitCreatorMS.cxx index 10f6b5b98f0f7a23a21fa21a4fdf01dd35f77440..b7ef92c01c310d0b959005377984fcb898b8e66c 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsMS/src/SimHitCreatorMS.cxx +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsMS/src/SimHitCreatorMS.cxx @@ -20,13 +20,11 @@ #include "MuonReadoutGeometry/MMReadoutElement.h" #include "MuonReadoutGeometry/sTgcReadoutElement.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" #include "MuonSimEvent/MdtHitIdHelper.h" #include "MuonSimEvent/RpcHitIdHelper.h" #include "MuonSimEvent/CscHitIdHelper.h" #include "MuonSimEvent/TgcHitIdHelper.h" #include "MuonSimEvent/sTgcHitIdHelper.h" -#include "MuonIdHelpers/MdtIdHelper.h" #include "MuonSimEvent/MicromegasHitIdHelper.h" #include "MuonSimEvent/MM_SimIdToOfflineId.h" #include "MuonSimEvent/sTgcSimIdToOfflineId.h" diff --git a/Tracking/TrkTools/TrkAssociationTools/TrkAssociationTools/PRD_AssociationTool.h b/Tracking/TrkTools/TrkAssociationTools/TrkAssociationTools/PRD_AssociationTool.h index e09bd90fc39c84a22e3e074c25f3eec174ef2823..14e311785e3f62a2b99b33676f0b5f86e1b20beb 100755 --- a/Tracking/TrkTools/TrkAssociationTools/TrkAssociationTools/PRD_AssociationTool.h +++ b/Tracking/TrkTools/TrkAssociationTools/TrkAssociationTools/PRD_AssociationTool.h @@ -1,27 +1,20 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - #ifndef TRK_PRD_ASSOCIATIONTOOL_H #define TRK_PRD_ASSOCIATIONTOOL_H -#include "AthenaBaseComps/AthAlgTool.h" #include "TrkToolInterfaces/IPRD_AssociationTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "StoreGate/ReadHandleKey.h" #include "TrkEventUtils/PRDtoTrackMap.h" #include <set> #include <map> -class AtlasDetectorID; -class Identifier; - -namespace Muon{ - class MuonIdHelperTool; -} - namespace Trk { class Track; @@ -33,9 +26,8 @@ namespace Trk { public: PRD_AssociationTool(const std::string&,const std::string&,const IInterface*); - virtual ~PRD_AssociationTool () override; + virtual ~PRD_AssociationTool()=default; virtual StatusCode initialize() override; - virtual StatusCode finalize () override; /** add the PRDs from this track to the store @param track all PRDs from 'track' will be added to PRD_AssociationTool's internal store.*/ @@ -117,11 +109,9 @@ namespace Trk { private: // Holds the associations. Maps m_maps; - SG::ReadHandleKey<Trk::PRDtoTrackMap> m_prdToTrackMap - {this,"PRDtoTrackMap",""}; + SG::ReadHandleKey<Trk::PRDtoTrackMap> m_prdToTrackMap {this,"PRDtoTrackMap",""}; - PublicToolHandle<Muon::MuonIdHelperTool> m_idHelperTool - {this,"MuonIdHelperTool","Muon::MuonIdHelperTool/MuonIdHelperTool"}; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; bool m_setupCorrect; }; diff --git a/Tracking/TrkTools/TrkAssociationTools/TrkAssociationTools/PRDtoTrackMapTool.h b/Tracking/TrkTools/TrkAssociationTools/TrkAssociationTools/PRDtoTrackMapTool.h index d4ba913b857508650b14db2a6350f4d6cb471a91..023ddf67708b42afae01f89ad88d852e99158e25 100644 --- a/Tracking/TrkTools/TrkAssociationTools/TrkAssociationTools/PRDtoTrackMapTool.h +++ b/Tracking/TrkTools/TrkAssociationTools/TrkAssociationTools/PRDtoTrackMapTool.h @@ -1,23 +1,20 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRK_PRDtoTrackMapTool_H #define TRK_PRDtoTrackMapTool_H -#include "AthenaBaseComps/AthAlgTool.h" #include "TrkToolInterfaces/IPRDtoTrackMapTool.h" +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" + +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "TrkEventUtils/PRDtoTrackMap.h" + #include <set> #include <map> -class AtlasDetectorID; -class Identifier; - -namespace Muon{ - class MuonIdHelperTool; -} - namespace Trk { class Track; @@ -29,9 +26,8 @@ namespace Trk { public: PRDtoTrackMapTool(const std::string&,const std::string&,const IInterface*); - virtual ~PRDtoTrackMapTool() override; + virtual ~PRDtoTrackMapTool()=default; virtual StatusCode initialize() override; - virtual StatusCode finalize () override; virtual std::unique_ptr<Trk::PRDtoTrackMap> createPRDtoTrackMap() const override; @@ -64,7 +60,7 @@ namespace Trk { }; private: - ToolHandle<Muon::MuonIdHelperTool> m_idHelperTool; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; protected: void ensureType(Trk::PRDtoTrackMap &virt_prd_to_track_map) const ; diff --git a/Tracking/TrkTools/TrkAssociationTools/src/PRD_AssociationTool.cxx b/Tracking/TrkTools/TrkAssociationTools/src/PRD_AssociationTool.cxx index e06cb7b01da719cb27c191bff83eaaf18eb41f8b..34bd7956d0617e5bee56ae5234bbdd8e5478e130 100755 --- a/Tracking/TrkTools/TrkAssociationTools/src/PRD_AssociationTool.cxx +++ b/Tracking/TrkTools/TrkAssociationTools/src/PRD_AssociationTool.cxx @@ -8,13 +8,6 @@ #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h" -#include "Identifier/Identifier.h" -#include "AtlasDetDescr/AtlasDetectorID.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" - -#include "StoreGate/ReadHandle.h" - #include <cassert> #include <vector> #include <stdexcept> @@ -29,16 +22,12 @@ Trk::PRD_AssociationTool::PRD_AssociationTool(const std::string& t, declareProperty( "SetupCorrect", m_setupCorrect=false); } -Trk::PRD_AssociationTool::~PRD_AssociationTool() -{ -} - StatusCode Trk::PRD_AssociationTool::initialize() { StatusCode sc = AlgTool::initialize(); if (sc.isFailure()) return sc; ATH_CHECK( m_prdToTrackMap.initialize( !m_prdToTrackMap.key().empty() ) ); - ATH_CHECK( m_idHelperTool.retrieve( DisableTool{m_idHelperTool.name().empty()} )); + ATH_CHECK( m_idHelperSvc.retrieve()); if (!m_setupCorrect) { ATH_MSG_INFO("initialize: Tool " << name() << " not configured for PRD usage."); } @@ -46,12 +35,6 @@ StatusCode Trk::PRD_AssociationTool::initialize() return StatusCode::SUCCESS; } -StatusCode Trk::PRD_AssociationTool::finalize() -{ - StatusCode sc = AlgTool::finalize(); - return sc; -} - StatusCode Trk::PRD_AssociationTool::addPRDs( const Trk::Track& track ) { if (!m_prdToTrackMap.key().empty()) throw std::runtime_error("Cannot modify(addPRDs) the PRDtoTrackMap that was read from storegate!"); @@ -208,9 +191,9 @@ Trk::PRD_AssociationTool::getPrdsOnTrack(const Maps& maps, { const RIO_OnTrack* rot = dynamic_cast<const RIO_OnTrack*>(meas); if (rot){ - if(m_idHelperTool->isMuon(rot->identify())){ + if(m_idHelperSvc->isMuon(rot->identify())){ //only use precision hits for muon track overlap - if(!m_idHelperTool->isMdt(rot->identify()) && !(m_idHelperTool->isCsc(rot->identify()) && !m_idHelperTool->measuresPhi(rot->identify()))) continue; + if(!m_idHelperSvc->isMdt(rot->identify()) && !(m_idHelperSvc->isCsc(rot->identify()) && !m_idHelperSvc->measuresPhi(rot->identify()))) continue; } vec.push_back(rot->prepRawData()); } @@ -220,9 +203,9 @@ Trk::PRD_AssociationTool::getPrdsOnTrack(const Maps& maps, const unsigned int numROTs = competingROT->numberOfContainedROTs(); for( unsigned int i=0;i<numROTs;++i ){ const Trk::RIO_OnTrack* rot = &competingROT->rioOnTrack(i); - if( !rot || !rot->prepRawData() || !m_idHelperTool->isMuon(rot->identify()) ) continue; + if( !rot || !rot->prepRawData() || !m_idHelperSvc->isMuon(rot->identify()) ) continue; //only use precision hits for muon track overlap - if(!m_idHelperTool->isMdt(rot->identify()) && !(m_idHelperTool->isCsc(rot->identify()) && !m_idHelperTool->measuresPhi(rot->identify()))) continue; + if(!m_idHelperSvc->isMdt(rot->identify()) && !(m_idHelperSvc->isCsc(rot->identify()) && !m_idHelperSvc->measuresPhi(rot->identify()))) continue; vec.push_back(rot->prepRawData()); } } diff --git a/Tracking/TrkTools/TrkAssociationTools/src/PRDtoTrackMapTool.cxx b/Tracking/TrkTools/TrkAssociationTools/src/PRDtoTrackMapTool.cxx index ce7a3723521b87fbe22720c68774907bd5e47a25..8c249793f4d8b09803e89ed4e6534a7ec23b5dc4 100644 --- a/Tracking/TrkTools/TrkAssociationTools/src/PRDtoTrackMapTool.cxx +++ b/Tracking/TrkTools/TrkAssociationTools/src/PRDtoTrackMapTool.cxx @@ -3,13 +3,11 @@ */ #include "TrkAssociationTools/PRDtoTrackMapTool.h" + #include "TrkTrack/Track.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h" - -#include "MuonIdHelpers/MuonIdHelperTool.h" - #include <cassert> #include <vector> #include "ext/functional" @@ -17,22 +15,12 @@ Trk::PRDtoTrackMapTool::PRDtoTrackMapTool(const std::string& t, const std::string& n, const IInterface* p) - : base_class(t,n,p), - m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool") -{ -} - -Trk::PRDtoTrackMapTool::~PRDtoTrackMapTool() + : base_class(t,n,p) { } -StatusCode Trk::PRDtoTrackMapTool::initialize() -{ - return StatusCode::SUCCESS; -} - -StatusCode Trk::PRDtoTrackMapTool::finalize() -{ +StatusCode Trk::PRDtoTrackMapTool::initialize() { + ATH_CHECK(m_idHelperSvc.retrieve()); return StatusCode::SUCCESS; } @@ -90,8 +78,6 @@ Trk::PRDtoTrackMapTool::TrackSet ensureType(virt_prd_to_track_map); PRDtoTrackMap &prd_to_track_map = static_cast<PRDtoTrackMap&>(virt_prd_to_track_map); - //using namespace __gnu_cxx; - TrackSet connectedTracks; std::vector< const Trk::PrepRawData* > prds = getPrdsOnTrack(prd_to_track_map, track); @@ -153,11 +139,11 @@ Trk::PRDtoTrackMapTool::getPrdsOnTrack(Trk::PRDtoTrackMap &virt_prd_to_track_map { const RIO_OnTrack* rot = dynamic_cast<const RIO_OnTrack*>(meas); if (rot){ - if(m_idHelperTool->isMuon(rot->identify())){ + if(m_idHelperSvc->isMuon(rot->identify())){ //only use precision hits for muon track overlap - if( !m_idHelperTool->isMdt(rot->identify()) - && !(m_idHelperTool->isCsc(rot->identify()) - && !m_idHelperTool->measuresPhi(rot->identify()))) continue; + if( !m_idHelperSvc->isMdt(rot->identify()) + && !(m_idHelperSvc->isCsc(rot->identify()) + && !m_idHelperSvc->measuresPhi(rot->identify()))) continue; } vec.push_back(rot->prepRawData()); } @@ -167,11 +153,11 @@ Trk::PRDtoTrackMapTool::getPrdsOnTrack(Trk::PRDtoTrackMap &virt_prd_to_track_map const unsigned int numROTs = competingROT->numberOfContainedROTs(); for( unsigned int i=0;i<numROTs;++i ){ const Trk::RIO_OnTrack* rot = &competingROT->rioOnTrack(i); - if( !rot || !rot->prepRawData() || !m_idHelperTool->isMuon(rot->identify()) ) continue; + if( !rot || !rot->prepRawData() || !m_idHelperSvc->isMuon(rot->identify()) ) continue; //only use precision hits for muon track overlap - if( !m_idHelperTool->isMdt(rot->identify()) - && !( m_idHelperTool->isCsc(rot->identify()) - && !m_idHelperTool->measuresPhi(rot->identify())) ) continue; + if( !m_idHelperSvc->isMdt(rot->identify()) + && !( m_idHelperSvc->isCsc(rot->identify()) + && !m_idHelperSvc->measuresPhi(rot->identify())) ) continue; vec.push_back(rot->prepRawData()); } } diff --git a/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigMuonEFExtrapolatorNSWHypo.h b/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigMuonEFExtrapolatorNSWHypo.h index 1d1f57b6145e30efe92b07c08a66519e64881269..a0c5ffdaaff2c3f05a285016f69b8132f9a7c89e 100644 --- a/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigMuonEFExtrapolatorNSWHypo.h +++ b/Trigger/TrigHypothesis/TrigMuonHypo/TrigMuonHypo/TrigMuonEFExtrapolatorNSWHypo.h @@ -1,24 +1,25 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIG_TRIGMUONEFEXTRAPOLATORNSWHYPO_H #define TRIG_TRIGMUONEFEXTRAPOLATORNSWHYPO_H -#include <string> #include "TrigInterfaces/HypoAlgo.h" #include "GaudiKernel/ServiceHandle.h" + +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -class StoreGateSvc; +#include <string> + class TriggerElement; class TrigMuonEFExtrapolatorNSWHypo: public HLT::HypoAlgo { public: TrigMuonEFExtrapolatorNSWHypo(const std::string & name, ISvcLocator* pSvcLocator); - ~TrigMuonEFExtrapolatorNSWHypo(); + ~TrigMuonEFExtrapolatorNSWHypo()=default; HLT::ErrorCode hltInitialize(); HLT::ErrorCode hltExecute(const HLT::TriggerElement* outputTE, bool& pass); @@ -34,8 +35,7 @@ class TrigMuonEFExtrapolatorNSWHypo: public HLT::HypoAlgo "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; - // ToolHandle for IdHelperTool - ToolHandle<Muon::MuonIdHelperTool> m_idhelperTool; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; // Services StoreGateSvc* m_storeGate; diff --git a/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigMuonEFExtrapolatorNSWHypo.cxx b/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigMuonEFExtrapolatorNSWHypo.cxx index 7ed710dc3fa7c7209e582be01e76c0b445a6c888..cc2a818aa137be93f88c010cfc9789b902988503 100644 --- a/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigMuonEFExtrapolatorNSWHypo.cxx +++ b/Trigger/TrigHypothesis/TrigMuonHypo/src/TrigMuonEFExtrapolatorNSWHypo.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrigMuonHypo/TrigMuonEFExtrapolatorNSWHypo.h" @@ -11,14 +11,11 @@ #include "MuonSegment/MuonSegment.h" #include "TrigT1Interfaces/RecMuonRoI.h" -class ISvcLocator; - // -------------------------------------------------------------------------------- // -------------------------------------------------------------------------------- TrigMuonEFExtrapolatorNSWHypo::TrigMuonEFExtrapolatorNSWHypo(const std::string & name, ISvcLocator* pSvcLocator) : - HLT::HypoAlgo(name, pSvcLocator), - m_idhelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool") + HLT::HypoAlgo(name, pSvcLocator) { declareProperty("AcceptAll", m_acceptAll=true); @@ -31,10 +28,7 @@ TrigMuonEFExtrapolatorNSWHypo::TrigMuonEFExtrapolatorNSWHypo(const std::string & declareMonitoredStdContainer("dLEta", m_fex_dLeta); declareMonitoredStdContainer("dLPhi", m_fex_dLphi); - m_storeGate=0; -} - -TrigMuonEFExtrapolatorNSWHypo::~TrigMuonEFExtrapolatorNSWHypo(){ + m_storeGate=nullptr; } // -------------------------------------------------------------------------------- @@ -54,11 +48,11 @@ HLT::ErrorCode TrigMuonEFExtrapolatorNSWHypo::hltInitialize() return HLT::ERROR; } - sc = m_idhelperTool.retrieve(); + sc = m_idHelperSvc.retrieve(); if ( sc.isSuccess() ) { - msg() << MSG::INFO << "Retrieved " << m_idhelperTool << endmsg; + msg() << MSG::INFO << "Retrieved " << m_idHelperSvc << endmsg; } else { - msg() << MSG::ERROR << "Could not get " << m_idhelperTool << endmsg; + msg() << MSG::ERROR << "Could not get " << m_idHelperSvc << endmsg; return HLT::ERROR; } @@ -192,7 +186,7 @@ HLT::ErrorCode TrigMuonEFExtrapolatorNSWHypo::hltExecute(const HLT::TriggerEleme // get chamber identifier, chamber index and station index Identifier chid = m_edmHelperSvc->chamberId( *segment ); - Muon::MuonStationIndex::ChIndex chIndex = m_idhelperTool->chamberIndex(chid); + Muon::MuonStationIndex::ChIndex chIndex = m_idHelperSvc->chamberIndex(chid); if (debug) msg() << MSG::DEBUG << " chamber index=" << chIndex << endmsg; // only in EI and CSC diff --git a/Trigger/TrigT1/TrigT1TGCRecRoiSvc/TrigT1TGCRecRoiSvc/TGCRecRoiSvc.h b/Trigger/TrigT1/TrigT1TGCRecRoiSvc/TrigT1TGCRecRoiSvc/TGCRecRoiSvc.h index ea917d067249add0098f060745baa118de06e3e2..9202e6265181106e2da57e482ae9ac260b738066 100755 --- a/Trigger/TrigT1/TrigT1TGCRecRoiSvc/TrigT1TGCRecRoiSvc/TGCRecRoiSvc.h +++ b/Trigger/TrigT1/TrigT1TGCRecRoiSvc/TrigT1TGCRecRoiSvc/TGCRecRoiSvc.h @@ -1,16 +1,17 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGT1_TGCRECROISVC_H #define TRIGT1_TGCRECROISVC_H #include "TrigT1Interfaces/RecMuonRoiSvc.h" +#include "GaudiKernel/ServiceHandle.h" + +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "TGCcablingInterface/TGCIdBase.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -class Identifier; class ITGCcablingSvc; namespace MuonGM @@ -42,10 +43,9 @@ public: // standard constructor TGCRecRoiSvc (const std::string& name, ISvcLocator* svc); - virtual ~TGCRecRoiSvc (void) {} + virtual ~TGCRecRoiSvc()=default; - StatusCode initialize (void); - StatusCode finalize (void); + StatusCode initialize(); void reconstruct (const unsigned int & roIWord) const; //!< calculate eta and phi of RoI center @link LVL1TGC::TGCRecRoiSvc::reconstruct @endlink @@ -123,10 +123,9 @@ private: BooleanProperty m_patchForP5; BooleanProperty m_patchForRoIWord; - mutable const ITGCcablingSvc * m_cabling; - ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - const MuonGM::MuonDetectorManager * m_muonMgr; + mutable const ITGCcablingSvc* m_cabling; + ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; + const MuonGM::MuonDetectorManager* m_muonMgr; mutable bool m_isAtlas; }; diff --git a/Trigger/TrigT1/TrigT1TGCRecRoiSvc/src/TGCRecRoiSvc.cxx b/Trigger/TrigT1/TrigT1TGCRecRoiSvc/src/TGCRecRoiSvc.cxx index 420c86d2891e3d58832c878c3ef543b34c73db8d..00ca4042f1040ff1d63da683f01144fa4c943ef8 100755 --- a/Trigger/TrigT1/TrigT1TGCRecRoiSvc/src/TGCRecRoiSvc.cxx +++ b/Trigger/TrigT1/TrigT1TGCRecRoiSvc/src/TGCRecRoiSvc.cxx @@ -23,12 +23,11 @@ inline void SWAP(double &a, double &b) TGCRecRoiSvc::TGCRecRoiSvc (const std::string& name, ISvcLocator* svc) : LVL1::RecMuonRoiSvc( name, svc ), m_phi(0), - m_eta(0), - m_cabling(0), - m_muonMgr(0), + m_eta(0), + m_cabling(0), + m_muonMgr(0), m_isAtlas(true) -{ - +{ declareProperty("PatchForM5", m_patchForM5 = false); declareProperty("PatchForP4", m_patchForP4 = false); declareProperty("PatchForP5", m_patchForP5 = false); @@ -39,14 +38,11 @@ StatusCode TGCRecRoiSvc::initialize (void) { ATH_MSG_DEBUG( "initialize" ); - ATH_CHECK( AthService::initialize() ); - ATH_CHECK( setProperties() ); - ServiceHandle<StoreGateSvc> detStore ("DetectorStore", name() ); ATH_CHECK( detStore.retrieve() ); ATH_CHECK( detStore->retrieve(m_muonMgr) ); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); // try to initialize the TGCcabling StatusCode sc = getCabling(); @@ -67,14 +63,6 @@ StatusCode TGCRecRoiSvc::initialize (void) return StatusCode::SUCCESS; } - -StatusCode TGCRecRoiSvc::finalize() -{ - ATH_MSG_INFO( "finalize" ); - return StatusCode::SUCCESS; -} - - void TGCRecRoiSvc::reconstruct (const unsigned int & roIWord) const { m_eta = 0; @@ -481,14 +469,14 @@ void TGCRecRoiSvc::getWireInfo(Amg::Vector3D & w_pos, w_asdout->getChannel()); if (status==false) return; const MuonGM::TgcReadoutElement* tgcwire - = m_muonMgr->getTgcReadoutElement(m_muonIdHelperTool->tgcIdHelper().parentID(wireId)); + = m_muonMgr->getTgcReadoutElement(m_idHelperSvc->tgcIdHelper().parentID(wireId)); w_pos = tgcwire -> channelPos(wireId); // If edge correction is needed, // the half length in the r direction is added (subtracted) for the upper (lower) edge. if(edge==UpperREdge || edge==LowerREdge) { - int gasGap = m_muonIdHelperTool->tgcIdHelper().gasGap(wireId); - int channel = m_muonIdHelperTool->tgcIdHelper().channel(wireId); + int gasGap = m_idHelperSvc->tgcIdHelper().gasGap(wireId); + int channel = m_idHelperSvc->tgcIdHelper().channel(wireId); double halfLength = tgcwire->gangLength(gasGap, channel)/2.; double r = w_pos.perp(); double phi = w_pos.phi(); @@ -521,14 +509,14 @@ void TGCRecRoiSvc::getStripInfo(Amg::Vector3D & s_pos, s_asdout->getChannel()); if (status==false) return; const MuonGM::TgcReadoutElement* tgcstrip - = m_muonMgr->getTgcReadoutElement(m_muonIdHelperTool->tgcIdHelper().parentID(stripId)); + = m_muonMgr->getTgcReadoutElement(m_idHelperSvc->tgcIdHelper().parentID(stripId)); s_pos = tgcstrip -> channelPos(stripId); // If edge correction is needed, // the half width in the phi direction is added (subtracted) for the upper (lower) edge. if(edge==UpperPhiEdge || edge==LowerPhiEdge) { - int gasGap = m_muonIdHelperTool->tgcIdHelper().gasGap(stripId); - int channel = m_muonIdHelperTool->tgcIdHelper().channel(stripId); + int gasGap = m_idHelperSvc->tgcIdHelper().gasGap(stripId); + int channel = m_idHelperSvc->tgcIdHelper().channel(stripId); double shortWidth = tgcstrip->stripShortWidth(gasGap, channel); double longWidth = tgcstrip->stripLongWidth(gasGap, channel); double halfWidth = (shortWidth + longWidth)/4.;