diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx index f70cd4bd8bbdd3155a2e869e833b66be5db89292..5b48ab2a9d7d93e513656fba3fe839e31eb6dc06 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.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 "MooCandidateMatchingTool.h" @@ -63,16 +63,12 @@ namespace Muon { clear(); } - MooCandidateMatchingTool::MooTrackSegmentMatchResult::~MooTrackSegmentMatchResult() { - } - void MooCandidateMatchingTool::MooTrackSegmentMatchResult::clear() { TrackSegmentMatchResult::clear(); MCTBTrack = 0; MCTBSegment = 0; } - MooCandidateMatchingTool::MooCandidateMatchingTool(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p) { @@ -108,7 +104,7 @@ namespace Muon { ATH_CHECK( m_slExtrapolator.retrieve() ); ATH_CHECK( m_atlasExtrapolator.retrieve() ); - ATH_CHECK( m_idHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_CHECK( m_edmHelperSvc.retrieve() ); ATH_CHECK( m_printer.retrieve() ); ATH_CHECK( m_magFieldSvc.retrieve() ); @@ -219,7 +215,7 @@ namespace Muon { return false; } - if( m_idHelperTool->issTgc(*entry1.chamberIds().begin()) || m_idHelperTool->isMM(*entry1.chamberIds().begin()) ){ + if( m_idHelperSvc->issTgc(*entry1.chamberIds().begin()) || m_idHelperSvc->isMM(*entry1.chamberIds().begin()) ){ return true; } } @@ -440,8 +436,8 @@ namespace Muon { } else { msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed"; } - msg(MSG::DEBUG) << " segment match between segment-on-track " << MuonStationIndex::chName(m_idHelperTool->chamberIndex(info.trackChamberId)) - << " and segment " << MuonStationIndex::chName(m_idHelperTool->chamberIndex(info.segmentChamberId)) << endmsg; + msg(MSG::DEBUG) << " segment match between segment-on-track " << MuonStationIndex::chName(m_idHelperSvc->chamberIndex(info.trackChamberId)) + << " and segment " << MuonStationIndex::chName(m_idHelperSvc->chamberIndex(info.segmentChamberId)) << endmsg; } info.reason = TrackSegmentMatchResult::SegmentMatch; info.trackChamberId = closestSegment->chid; @@ -520,7 +516,7 @@ namespace Muon { double posXCut2 = cuts.posXCut * cuts.posXCut + scaledPosXErr2; if ( info.localPosXDiff * info.localPosXDiff > posXCut2 ) { if (msgLvl(MSG::DEBUG)) { - msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName(m_idHelperTool->chamberIndex(info.segmentChamberId)) << " X position cut: " + msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName(m_idHelperSvc->chamberIndex(info.segmentChamberId)) << " X position cut: " << info.localPosXDiff << " > " << std::sqrt(posXCut2) << endmsg; } info.setCutFailed( TrackSegmentMatchResult::PosXCut ); @@ -536,7 +532,7 @@ namespace Muon { double posYCut2 = cuts.posYCut * cuts.posYCut + scaledPosYErr2; if ( info.localPosYDiff * info.localPosYDiff > posYCut2 ) { if (msgLvl(MSG::DEBUG)) { - msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName((m_idHelperTool->chamberIndex(info.segmentChamberId))) << " Y position cut: " + msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName((m_idHelperSvc->chamberIndex(info.segmentChamberId))) << " Y position cut: " << info.localPosYDiff << " > " << std::sqrt(posYCut2) << endmsg; } info.setCutFailed( TrackSegmentMatchResult::PosYCut ); @@ -550,7 +546,7 @@ namespace Muon { if ( info.localPosXDiff * info.localPosXDiff > scaledPosXErr2 ) { if (msgLvl(MSG::DEBUG)) { double pull = info.localPosXDiff / std::sqrt(info.posXTotalErr2); - msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName((m_idHelperTool->chamberIndex(info.segmentChamberId))) << " X position pull cut: |" + msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName((m_idHelperSvc->chamberIndex(info.segmentChamberId))) << " X position pull cut: |" << pull << "| > " << cuts.posXPullCut << endmsg; } info.setCutFailed( TrackSegmentMatchResult::PosXPullCut ); @@ -564,7 +560,7 @@ namespace Muon { if ( info.localPosYDiff * info.localPosYDiff > scaledPosYErr2 ) { if (msgLvl(MSG::DEBUG)) { double pull = info.localPosYDiff / std::sqrt(info.posYTotalErr2); - msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName((m_idHelperTool->chamberIndex(info.segmentChamberId))) << " Y position pull cut: |" + msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName((m_idHelperSvc->chamberIndex(info.segmentChamberId))) << " Y position pull cut: |" << pull << "| > " << cuts.posYPullCut << endmsg; } info.setCutFailed( TrackSegmentMatchResult::PosYPullCut ); @@ -583,7 +579,7 @@ namespace Muon { double angleXCut2 = cuts.angleXCut * cuts.angleXCut + scaledAngleXErr2; if ( info.localAngleXDiff * info.localAngleXDiff > angleXCut2 ) { if (msgLvl(MSG::DEBUG)) { - msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName(m_idHelperTool->chamberIndex(info.segmentChamberId)) << " X angle cut: " + msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName(m_idHelperSvc->chamberIndex(info.segmentChamberId)) << " X angle cut: " << info.localAngleXDiff << " > " << std::sqrt(angleXCut2) << endmsg; } info.setCutFailed( TrackSegmentMatchResult::AngXCut ); @@ -599,7 +595,7 @@ namespace Muon { double angleYCut2 = cuts.angleYCut * cuts.angleYCut + scaledAngleYErr2; if ( info.localAngleYDiff * info.localAngleYDiff > angleYCut2 ) { if (msgLvl(MSG::DEBUG)) { - msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName((m_idHelperTool->chamberIndex(info.segmentChamberId))) << " Y angle cut: " + msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName((m_idHelperSvc->chamberIndex(info.segmentChamberId))) << " Y angle cut: " << info.localAngleYDiff << " > " << std::sqrt(angleYCut2) << endmsg; } info.setCutFailed( TrackSegmentMatchResult::AngYCut ); @@ -613,7 +609,7 @@ namespace Muon { if ( info.localAngleXDiff * info.localAngleXDiff > scaledAngleXErr2 ) { if (msgLvl(MSG::DEBUG)) { double pull = info.localAngleXDiff / std::sqrt(info.angleXTotalErr2); - msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName((m_idHelperTool->chamberIndex(info.segmentChamberId))) << " X angle pull cut: |" + msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName((m_idHelperSvc->chamberIndex(info.segmentChamberId))) << " X angle pull cut: |" << pull << "| > " << cuts.angleXPullCut << endmsg; } info.setCutFailed( TrackSegmentMatchResult::AngXPullCut ); @@ -627,7 +623,7 @@ namespace Muon { if ( info.localAngleYDiff * info.localAngleYDiff > scaledAngleYErr2 ) { if (msgLvl(MSG::DEBUG)) { double pull = info.localAngleYDiff / std::sqrt(info.angleYTotalErr2); - msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName((m_idHelperTool->chamberIndex(info.segmentChamberId))) << " Y angle pull cut: |" + msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName((m_idHelperSvc->chamberIndex(info.segmentChamberId))) << " Y angle pull cut: |" << pull << "| > " << cuts.angleYPullCut << endmsg; } info.setCutFailed( TrackSegmentMatchResult::AngYPullCut ); @@ -643,7 +639,7 @@ namespace Muon { // cut on matching chi-squared if ( info.matchChiSquared > cuts.matchChiSquaredCut ) { if (msgLvl(MSG::DEBUG)) { - msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName((m_idHelperTool->chamberIndex(info.segmentChamberId))) << " match chi-squared cut: " + msg(MSG::DEBUG) << MSG::DEBUG << " -> Failed " << MuonStationIndex::chName((m_idHelperSvc->chamberIndex(info.segmentChamberId))) << " match chi-squared cut: " << info.matchChiSquared << " > " << cuts.matchChiSquaredCut << endmsg; } info.setCutFailed( TrackSegmentMatchResult::MatchChiSquaredCut ); @@ -715,7 +711,7 @@ namespace Muon { return; } - int sector2 = m_idHelperTool->sector(info.segmentChamberId); + int sector2 = m_idHelperSvc->sector(info.segmentChamberId); bool hasStereoAngle = false; // find closest track parameters @@ -748,8 +744,8 @@ namespace Muon { if (meas) { id = m_edmHelperSvc->getIdentifier(*meas); if ( id.is_valid() ) { - if ( !m_idHelperTool->isMuon(id) ) continue; - if ( m_idHelperTool->isMdt(id) && m_idHelperTool->sector(id) != sector2 ) hasStereoAngle=true; + if ( !m_idHelperSvc->isMuon(id) ) continue; + if ( m_idHelperSvc->isMdt(id) && m_idHelperSvc->sector(id) != sector2 ) hasStereoAngle=true; } } @@ -772,7 +768,7 @@ namespace Muon { } // store closest MDT or CSC ID (for printout and performance analysis) if ( std::abs(dist) < std::abs(closestIdDist) ) { - if ( meas && id.is_valid() && m_idHelperTool->isMuon(id) && (m_idHelperTool->isMdt(id) || m_idHelperTool->isCsc(id)) ) { + if ( meas && id.is_valid() && m_idHelperSvc->isMuon(id) && (m_idHelperSvc->isMdt(id) || m_idHelperSvc->isCsc(id)) ) { closestId = id; closestIdDist = dist; } @@ -801,12 +797,12 @@ namespace Muon { // set the identification of the first entry (the track - taking the closest point) if ( closestPars && closestId.is_valid() ) { - info.trackChamberId = m_idHelperTool->chamberId( closestId ); + info.trackChamberId = m_idHelperSvc->chamberId( closestId ); } if ( msgLvl(MSG::VERBOSE) ) { - msg(MSG::DEBUG) << MSG::VERBOSE << "match Closest chamber: " << m_idHelperTool->toStringChamber(info.trackChamberId) - << " Segment: " << m_idHelperTool->toStringChamber(info.segmentChamberId); + msg(MSG::DEBUG) << MSG::VERBOSE << "match Closest chamber: " << m_idHelperSvc->toStringChamber(info.trackChamberId) + << " Segment: " << m_idHelperSvc->toStringChamber(info.segmentChamberId); const Trk::TrackParameters* tmpPars = 0; if (closestMeasPars) tmpPars = closestMeasPars->covariance() ? closestMeasPars : 0; if (tmpPars) { @@ -831,14 +827,14 @@ namespace Muon { //if extrapolating within EM-EO, can use straight-line extrapolator even without momentum if ( !straightLineMatch && !entry1.hasMomentum() && info.trackChamberId.is_valid() ) { - MuonStationIndex::StIndex trackStationIndex = m_idHelperTool->stationIndex(info.trackChamberId); + MuonStationIndex::StIndex trackStationIndex = m_idHelperSvc->stationIndex(info.trackChamberId); MuonStationIndex::StIndex segmentStationIndex = entry2.stIndex; if ( ((trackStationIndex == MuonStationIndex::EM && segmentStationIndex == MuonStationIndex::EO) || (trackStationIndex == MuonStationIndex::EO && segmentStationIndex == MuonStationIndex::EM) ) && closestPars->position().z() * entry2.entryPars().position().z() > 0.0 ) { straightLineMatch = true; - ATH_MSG_DEBUG("track in " << m_idHelperTool->toStringStation(info.trackChamberId) - << " and segment in " << m_idHelperTool->toStringStation(info.segmentChamberId) + ATH_MSG_DEBUG("track in " << m_idHelperSvc->toStringStation(info.trackChamberId) + << " and segment in " << m_idHelperSvc->toStringStation(info.segmentChamberId) << " => doing straight line extrapolation match"); } } @@ -859,13 +855,13 @@ namespace Muon { if (tmpPars) { //Check sector+ - if (!m_idHelperTool->isMuon(info.trackChamberId)) + if (!m_idHelperSvc->isMuon(info.trackChamberId)) { info.reason = TrackSegmentMatchResult::SegmentMatching; return; } - int trackSector = m_idHelperTool->sector(info.trackChamberId); - int segmentSector = m_idHelperTool->sector(info.segmentChamberId); + int trackSector = m_idHelperSvc->sector(info.trackChamberId); + int segmentSector = m_idHelperSvc->sector(info.segmentChamberId); int sectorDiff = std::abs( trackSector - segmentSector ); if ( sectorDiff > 1 && sectorDiff != 15 ) { if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "track sector =" << trackSector << " segment sector =" << segmentSector << " => not in neighbouring sectors " << endmsg; @@ -887,8 +883,8 @@ namespace Muon { if ( !exPars ) { ATH_MSG_DEBUG("track-segment match: Failed to extrapolate measured track parameters\n" << m_printer->print(*closestPars) - << "\nfrom " << m_idHelperTool->toStringChamber( info.trackChamberId ) - << " to segment surface " << m_idHelperTool->toStringChamber( info.segmentChamberId ) + << "\nfrom " << m_idHelperSvc->toStringChamber( info.trackChamberId ) + << " to segment surface " << m_idHelperSvc->toStringChamber( info.segmentChamberId ) << " using " << extrapolator->name() ); info.matchOK = false; info.reason = TrackSegmentMatchResult::ExtrapolFailed; @@ -899,8 +895,8 @@ namespace Muon { if ( !exMeasPars ) { const Trk::IExtrapolator* extrapolator = straightLineMatch ? &(*m_slExtrapolator) : &(*m_atlasExtrapolator); ATH_MSG_DEBUG( "track-segment match: Did not get measured track parameters from extrapolation\n" - << "\nfrom " << m_idHelperTool->toStringChamber( info.trackChamberId ) - << " to segment surface " << m_idHelperTool->toStringChamber( info.segmentChamberId ) + << "\nfrom " << m_idHelperSvc->toStringChamber( info.trackChamberId ) + << " to segment surface " << m_idHelperSvc->toStringChamber( info.segmentChamberId ) << " using " << extrapolator->name() ); delete exPars; info.reason = TrackSegmentMatchResult::ExtrapolNoErrors; @@ -921,8 +917,8 @@ namespace Muon { if( !exPars ) { ATH_MSG_DEBUG("track-segment match: Failed to extrapolate track parameters without errors\n" << m_printer->print(*closestPars) - << "\nfrom " << m_idHelperTool->toStringChamber( info.trackChamberId ) - << " to segment surface " << m_idHelperTool->toStringChamber( info.segmentChamberId ) + << "\nfrom " << m_idHelperSvc->toStringChamber( info.trackChamberId ) + << " to segment surface " << m_idHelperSvc->toStringChamber( info.segmentChamberId ) << " using " << extrapolator->name()); info.matchOK = false; info.reason = TrackSegmentMatchResult::ExtrapolFailed; @@ -1382,8 +1378,8 @@ namespace Muon { Identifier chid1 = seg1.chid; Identifier chid2 = seg2.chid; if ( msgLvl(MSG::VERBOSE) ) { - msg(MSG::VERBOSE) << "check if chambers are neighbours: " << m_idHelperTool->toStringChamber( chid1 ) - << " and " << m_idHelperTool->toStringChamber( chid2 ) << ": "; + msg(MSG::VERBOSE) << "check if chambers are neighbours: " << m_idHelperSvc->toStringChamber( chid1 ) + << " and " << m_idHelperSvc->toStringChamber( chid2 ) << ": "; } // if in same chamber, then OK if ( chid1 == chid2 ) { @@ -1397,10 +1393,10 @@ namespace Muon { } // check in phi - int secDiff = std::abs( m_idHelperTool->sector(chid1) - m_idHelperTool->sector(chid2) ); + int secDiff = std::abs( m_idHelperSvc->sector(chid1) - m_idHelperSvc->sector(chid2) ); if ( secDiff > 1 && secDiff != 15 ) { - if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "sec1=" << m_idHelperTool->sector(chid1) - << "sec2=" << m_idHelperTool->sector(chid2) << " => not in neighbouring phi " << endmsg; + if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "sec1=" << m_idHelperSvc->sector(chid1) + << "sec2=" << m_idHelperSvc->sector(chid2) << " => not in neighbouring phi " << endmsg; return false; } @@ -1408,18 +1404,18 @@ namespace Muon { if ( seg1.isEndcap && seg2.isEndcap ) { // both in endcap // endcap: can compare eta indices - if ( std::abs( m_idHelperTool->stationEta(chid1) - m_idHelperTool->stationEta(chid2) ) > 1 ) { + if ( std::abs( m_idHelperSvc->stationEta(chid1) - m_idHelperSvc->stationEta(chid2) ) > 1 ) { if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "not in neighbouring eta" << endmsg; return false; } } else if ( !seg1.isEndcap && !seg2.isEndcap ) { // both in barrel - const std::string& stationName1 = m_idHelperTool->mdtIdHelper().stationNameString( m_idHelperTool->mdtIdHelper().stationName( chid1 ) ); - const std::string& stationName2 = m_idHelperTool->mdtIdHelper().stationNameString( m_idHelperTool->mdtIdHelper().stationName( chid2 ) ); + const std::string& stationName1 = m_idHelperSvc->mdtIdHelper().stationNameString( m_idHelperSvc->mdtIdHelper().stationName( chid1 ) ); + const std::string& stationName2 = m_idHelperSvc->mdtIdHelper().stationNameString( m_idHelperSvc->mdtIdHelper().stationName( chid2 ) ); std::string exceptions("MRFG"); if ( exceptions.find(stationName1[2]) == std::string::npos && exceptions.find(stationName2[2]) == std::string::npos ) { // the normal case - if ( std::abs( m_idHelperTool->stationEta(chid1) - m_idHelperTool->stationEta(chid2) ) > 1 ) { + if ( std::abs( m_idHelperSvc->stationEta(chid1) - m_idHelperSvc->stationEta(chid2) ) > 1 ) { if( msgLvl(MSG::VERBOSE) ) msg(MSG::VERBOSE) << "not in neighbouring eta " << endmsg; return false; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h index 987b48047f6df7c0b8b546203b4224d3c94e5aeb..b232d2bca007a8650007326223f104b64682bd18 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooCandidateMatchingTool.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 */ #ifndef MOOCANDIDATEMATCHINGTOOL_H @@ -12,17 +12,12 @@ #include "TrkTrack/TrackStateOnSurface.h" #include "TrkParameters/TrackParameters.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -//#include "MuonIdHelpers/MuonStationIndex.h" -//#include "GeoPrimitives/GeoPrimitives.h" #include "CxxUtils/checker_macros.h" #include "EventPrimitives/EventPrimitives.h" #include "GeoPrimitives/GeoPrimitives.h" -#include "Identifier/Identifier.h" #include "MagFieldInterfaces/IMagFieldSvc.h" -#include "MuonIdHelpers/MuonStationIndex.h" #include "MuonRecToolInterfaces/IMuonTrackSegmentMatchingTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" #include "MuonRecHelperTools/MuonEDMPrinterTool.h" #include "MuonTrackMakerUtils/SortMeasurementsByPosition.h" @@ -33,17 +28,12 @@ #include "MuonTrackSegmentMatchResult.h" - #include #include #include #include -class MsgStream; - namespace Trk { - class IPropagator; - class IExtrapolator; class Track; class MeasurementBase; } @@ -68,7 +58,7 @@ namespace Muon { MooTrackSegmentMatchResult(); - virtual ~MooTrackSegmentMatchResult(); + virtual ~MooTrackSegmentMatchResult()=default; virtual void clear(); @@ -181,8 +171,7 @@ namespace Muon { double m_matchChiSquaredCut; double m_matchChiSquaredCutTight; - ToolHandle m_idHelperTool - {this, "IdHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool"}; // m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ServiceHandle m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.cxx index 78df11435184a5845ce974dc46ac17f8803ea511..95ac738ac82892f6d2184981ecd08ee94f33b8cc 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.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 "MooTrackFitter.h" @@ -28,7 +28,6 @@ #include "TrkPseudoMeasurementOnTrack/PseudoMeasurementOnTrack.h" #include "TrkEventPrimitives/LocalDirection.h" -#include "MuonIdHelpers/MuonStationIndex.h" #include "MuonSegment/MuonSegment.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" @@ -71,7 +70,7 @@ namespace Muon { ATH_CHECK( m_trackFitter.retrieve() ); ATH_CHECK( m_trackFitterPrefit.retrieve() ); ATH_CHECK( m_momentumEstimator.retrieve() ); - ATH_CHECK( m_idHelperTool.retrieve() ); + ATH_CHECK( m_idHelperSvc.retrieve() ); ATH_CHECK( m_edmHelperSvc.retrieve() ); ATH_CHECK( m_hitHandler.retrieve() ); ATH_CHECK( m_printer.retrieve() ); @@ -498,7 +497,7 @@ namespace Muon { if( hit.info().status != MuPatHit::OnTrack || !id.is_valid() ) continue; - MuonStationIndex::ChIndex chIndex = m_idHelperTool->chamberIndex(id); + MuonStationIndex::ChIndex chIndex = m_idHelperSvc->chamberIndex(id); MuonStationIndex::StIndex stIndex = MuonStationIndex::toStationIndex( chIndex ); fitterData.stations.insert(stIndex); @@ -507,10 +506,10 @@ namespace Muon { firstStation = stIndex; } - bool measuresPhi = m_idHelperTool->measuresPhi(id); + bool measuresPhi = m_idHelperSvc->measuresPhi(id); - if( !m_idHelperTool->isTgc(id) && !measuresPhi ){ - bool isSmall = m_idHelperTool->isSmallChamber(id); + if( !m_idHelperSvc->isTgc(id) && !measuresPhi ){ + bool isSmall = m_idHelperSvc->isSmallChamber(id); SLStationMap::iterator pos = fitterData.smallLargeChambersPerStation.find(stIndex); if( pos == fitterData.smallLargeChambersPerStation.end() ){ @@ -524,7 +523,7 @@ namespace Muon { } - bool isEndcap = m_idHelperTool->isEndcap(id); + bool isEndcap = m_idHelperSvc->isEndcap(id); if( isEndcap && !fitterData.hasEndcap ) fitterData.hasEndcap = true; if( !isEndcap && !fitterData.hasBarrel ) fitterData.hasBarrel = true; @@ -542,14 +541,14 @@ namespace Muon { double rDrift = meas->localParameters()[Trk::locR]; double rError = Amg::error(meas->localCovariance(),Trk::locR); - if( usePreciseHits && m_idHelperTool->isMdt(id) && fabs(rDrift) < 0.01 && rError > 4. ) { + if( usePreciseHits && m_idHelperSvc->isMdt(id) && fabs(rDrift) < 0.01 && rError > 4. ) { ATH_MSG_WARNING(" MDT hit error broad but expected precise error " ); } } fitterData.measurements.push_back(meas); - if( !measuresPhi && m_idHelperTool->isTrigger(id) ) continue; + if( !measuresPhi && m_idHelperSvc->isTrigger(id) ) continue; if( lit == hitList.begin() ){ currentChIndex = chIndex; @@ -668,7 +667,7 @@ namespace Muon { // only perform SL overlap fit for MDT segments Identifier chId = m_edmHelperSvc->chamberId(*segInfo1->segment); - if( !m_idHelperTool->isMdt(chId) ) return false; + if( !m_idHelperSvc->isMdt(chId) ) return false; ATH_MSG_VERBOSE(" Special treatment for tracks with one station, a SL overlap and no phi hits " ); @@ -758,7 +757,7 @@ namespace Muon { delete overlapPos;overlapPos=0; return false; } - MuonStationIndex::StIndex firstSt = m_idHelperTool->stationIndex(firstId); + MuonStationIndex::StIndex firstSt = m_idHelperSvc->stationIndex(firstId); if( overlapStation == firstSt ){ ATH_MSG_VERBOSE(" Adding fake in same station as overlap " ); @@ -911,8 +910,8 @@ namespace Muon { return 0; } // check whether phi measurement, exit if true - if( m_idHelperTool->measuresPhi(id) ) { - ATH_MSG_WARNING(" Measurement is a phi measurement! " << m_idHelperTool->toString(id) ); + if( m_idHelperSvc->measuresPhi(id) ) { + ATH_MSG_WARNING(" Measurement is a phi measurement! " << m_idHelperSvc->toString(id) ); return 0; } double length = 1e9; // initialize to large value @@ -931,11 +930,11 @@ namespace Muon { // get channel length and detector element const Trk::TrkDetElementBase* detEl = 0; if( !rot ){ - ATH_MSG_WARNING(" Measurement not a ROT "<< m_idHelperTool->toString(id) ); + ATH_MSG_WARNING(" Measurement not a ROT "<< m_idHelperSvc->toString(id) ); return 0; } - if( m_idHelperTool->mdtIdHelper().is_mdt(id) ){ + if( m_idHelperSvc->isMdt(id) ){ isMdt = true; const MuonGM::MdtReadoutElement* mdtDetEl = dynamic_cast(rot->detectorElement()); if( !mdtDetEl ) { @@ -943,10 +942,10 @@ namespace Muon { return 0; } detEl = mdtDetEl; - int layer = m_idHelperTool->mdtIdHelper().tubeLayer(id); - int tube = m_idHelperTool->mdtIdHelper().tube(id); + int layer = m_idHelperSvc->mdtIdHelper().tubeLayer(id); + int tube = m_idHelperSvc->mdtIdHelper().tube(id); length = mdtDetEl->getActiveTubeLength(layer,tube); - }else if( m_idHelperTool->isCsc(id) ){ + }else if( m_idHelperSvc->isCsc(id) ){ const MuonGM::CscReadoutElement* cscDetEl = dynamic_cast(rot->detectorElement()); if( !cscDetEl ) { ATH_MSG_WARNING(" CSC without CscReadoutElement! " ); @@ -954,7 +953,7 @@ namespace Muon { } detEl = cscDetEl; length = cscDetEl->stripLength(id); - }else if( m_idHelperTool->isRpc(id) ){ + }else if( m_idHelperSvc->isRpc(id) ){ const MuonGM::RpcReadoutElement* rpcDetEl = dynamic_cast(rot->detectorElement()); if( !rpcDetEl ) { ATH_MSG_WARNING(" RPC without RpcReadoutElement! " ); @@ -962,15 +961,15 @@ namespace Muon { } detEl = rpcDetEl; length = rpcDetEl->StripLength(false); // eta-strip - }else if( m_idHelperTool->isTgc(id) ){ + }else if( m_idHelperSvc->isTgc(id) ){ const MuonGM::TgcReadoutElement* tgcDetEl = dynamic_cast(rot->detectorElement()); if( !tgcDetEl ) { ATH_MSG_WARNING(" TGC without TgcReadoutElement! " ); return 0; } detEl = tgcDetEl; - length = tgcDetEl->WireLength(m_idHelperTool->tgcIdHelper().gasGap(id),m_idHelperTool->tgcIdHelper().channel(id)); - }else if( m_idHelperTool->issTgc(id) ){ + length = tgcDetEl->WireLength(m_idHelperSvc->tgcIdHelper().gasGap(id),m_idHelperSvc->tgcIdHelper().channel(id)); + }else if( m_idHelperSvc->issTgc(id) ){ const MuonGM::sTgcReadoutElement* stgcDetEl = dynamic_cast(rot->detectorElement()); if( !stgcDetEl || !stgcDetEl->getDesign(id) ) { ATH_MSG_WARNING(" STGC without sTgcReadoutElement! " ); @@ -978,8 +977,8 @@ namespace Muon { } detEl = stgcDetEl; const MuonGM::MuonChannelDesign* design = stgcDetEl->getDesign(id); - length = design->channelLength( m_idHelperTool->stgcIdHelper().channel(id) ); - }else if( m_idHelperTool->isMM(id) ){ + length = design->channelLength( m_idHelperSvc->stgcIdHelper().channel(id) ); + }else if( m_idHelperSvc->isMM(id) ){ const MuonGM::MMReadoutElement* mmDetEl = dynamic_cast(rot->detectorElement()); if( !mmDetEl || !mmDetEl->getDesign(id) ) { ATH_MSG_WARNING(" STGC without sTgcReadoutElement! " ); @@ -987,12 +986,12 @@ namespace Muon { } detEl = mmDetEl; const MuonGM::MuonChannelDesign* design = mmDetEl->getDesign(id); - length = design->channelLength( m_idHelperTool->mmIdHelper().channel(id) ); + length = design->channelLength( m_idHelperSvc->mmIdHelper().channel(id) ); } // we need the detEl and channel length if( !detEl ) { - ATH_MSG_WARNING(" no detector element found for measurement: "<< m_idHelperTool->toString(id) ); + ATH_MSG_WARNING(" no detector element found for measurement: "<< m_idHelperSvc->toString(id) ); return 0; } @@ -1123,7 +1122,7 @@ namespace Muon { const Amg::Vector3D* fakePos = meas.associatedSurface().localToGlobal(locpos); if( fakePos ){ - msg(MSG::DEBUG) << MSG::DEBUG << " createFakePhiForMeasurement for: " << m_idHelperTool->toStringChamber( id ) + msg(MSG::DEBUG) << MSG::DEBUG << " createFakePhiForMeasurement for: " << m_idHelperSvc->toStringChamber( id ) << " locY " << ly << " errpr " << errPos << " phi " << fakePos->phi() << endmsg; @@ -1223,10 +1222,10 @@ namespace Muon { // get station data const Identifier& chId = chit->chamberId(); - MuonStationIndex::StIndex stIndex = m_idHelperTool->stationIndex(chId); + MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(chId); StationPhiData& stData = stationDataMap[stIndex]; if( chit->isMdt() ){ - if( m_idHelperTool->isSmallChamber(chId) ) ++stData.nSmallChambers; + if( m_idHelperSvc->isSmallChamber(chId) ) ++stData.nSmallChambers; else ++stData.nLargeChambers; }else{ if( chit->phiProjection().nhits ) ++stData.nphiHits; @@ -1295,49 +1294,49 @@ namespace Muon { double x = rot->localParameters()[Trk::locX]; double halfLength = 0.; - if( m_idHelperTool->isMdt(id) ){ + if( m_idHelperSvc->isMdt(id) ){ const MuonGM::MdtReadoutElement* mdtDetEl = dynamic_cast(rot->detectorElement()); if( mdtDetEl ) { - int layer = m_idHelperTool->mdtIdHelper().tubeLayer(id); - int tube = m_idHelperTool->mdtIdHelper().tube(id); + int layer = m_idHelperSvc->mdtIdHelper().tubeLayer(id); + int tube = m_idHelperSvc->mdtIdHelper().tube(id); halfLength = 0.5*mdtDetEl->getActiveTubeLength(layer,tube); } - }else if( m_idHelperTool->isCsc(id) ) { + }else if( m_idHelperSvc->isCsc(id) ) { const MuonGM::CscReadoutElement* cscDetEl = dynamic_cast(rot->detectorElement()); if( cscDetEl ) { halfLength = 0.5*cscDetEl->stripLength(id); } - }else if( m_idHelperTool->isRpc(id) ) { + }else if( m_idHelperSvc->isRpc(id) ) { const MuonGM::RpcReadoutElement* rpcDetEl = dynamic_cast(rot->detectorElement()); if( rpcDetEl ) { halfLength = 0.5*rpcDetEl->StripLength(false); // eta-strip } - }else if( m_idHelperTool->isTgc(id) ){ + }else if( m_idHelperSvc->isTgc(id) ){ const MuonGM::TgcReadoutElement* tgcDetEl = dynamic_cast(rot->detectorElement()); if( tgcDetEl ) { - halfLength = 0.5*tgcDetEl->WireLength(m_idHelperTool->tgcIdHelper().gasGap(id),m_idHelperTool->tgcIdHelper().channel(id)); + halfLength = 0.5*tgcDetEl->WireLength(m_idHelperSvc->tgcIdHelper().gasGap(id),m_idHelperSvc->tgcIdHelper().channel(id)); } - }else if( m_idHelperTool->issTgc(id) ){ + }else if( m_idHelperSvc->issTgc(id) ){ const MuonGM::sTgcReadoutElement* stgcDetEl = dynamic_cast(rot->detectorElement()); if( stgcDetEl ){ const MuonGM::MuonChannelDesign* design = stgcDetEl->getDesign(id); if( design ){ - halfLength = 0.5*design->channelLength( m_idHelperTool->stgcIdHelper().channel(id) ); + halfLength = 0.5*design->channelLength( m_idHelperSvc->stgcIdHelper().channel(id) ); } } - }else if( m_idHelperTool->isMM(id) ){ + }else if( m_idHelperSvc->isMM(id) ){ const MuonGM::MMReadoutElement* mmDetEl = dynamic_cast(rot->detectorElement()); if( mmDetEl ) { const MuonGM::MuonChannelDesign* design = mmDetEl->getDesign(id); if( design ){ - halfLength = 0.5*design->channelLength( m_idHelperTool->mmIdHelper().channel(id) ); + halfLength = 0.5*design->channelLength( m_idHelperSvc->mmIdHelper().channel(id) ); } } } Amg::Vector2D lpLeft(x,-halfLength); const Amg::Vector3D* gposLeft = surf.localToGlobal(lpLeft); if( !gposLeft ){ - ATH_MSG_WARNING(" Failed calculation left phi for "<< m_idHelperTool->toString(id) ); + ATH_MSG_WARNING(" Failed calculation left phi for "<< m_idHelperSvc->toString(id) ); continue; } double phiLeft = gposLeft->phi(); @@ -1346,7 +1345,7 @@ namespace Muon { Amg::Vector2D lpRight(x,halfLength); const Amg::Vector3D* gposRight = surf.localToGlobal(lpRight); if( !gposRight ){ - ATH_MSG_WARNING(" Failed calculation right phi for "<< m_idHelperTool->toString(id) ); + ATH_MSG_WARNING(" Failed calculation right phi for "<< m_idHelperSvc->toString(id) ); continue; } double phiRight = gposRight->phi(); @@ -1530,7 +1529,7 @@ namespace Muon { // only perform SL overlap fit for MDT segments Identifier chId = m_edmHelperSvc->chamberId(*segInfo1->segment); - if( m_idHelperTool->isMdt(chId) ) { + if( m_idHelperSvc->isMdt(chId) ) { IMuonSegmentInOverlapResolvingTool::SegmentMatchResult result = m_overlapResolver->matchResult(*segInfo1->segment,*segInfo2->segment); @@ -1967,7 +1966,7 @@ namespace Muon { for( ;hit!=hit_end;++hit ){ const Trk::RIO_OnTrack* rot = dynamic_cast(*hit); if( rot ){ - if( m_idHelperTool->issTgc( rot->identify() ) ){ + if( m_idHelperSvc->issTgc( rot->identify() ) ){ rotsNSW.push_back(rot->clone()); continue; } @@ -1983,7 +1982,7 @@ namespace Muon { for( ;mit!=mit_end; ++mit ) { rots.push_back( *mit ); ids.insert( (*mit)->identify() ); - MuonStationIndex::StIndex stIndex = m_idHelperTool->stationIndex( (*mit)->identify() ); + MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex( (*mit)->identify() ); stations.insert(stIndex); } }else{ @@ -2017,7 +2016,7 @@ namespace Muon { if( ids.count( (*pit)->identify() ) ) continue; // do not add CSCs as they really should be on a segment - if( m_idHelperTool->isCsc( (*pit)->identify() ) || m_idHelperTool->issTgc( (*pit)->identify() ) ) continue; + if( m_idHelperSvc->isCsc( (*pit)->identify() ) || m_idHelperSvc->issTgc( (*pit)->identify() ) ) continue; roadPhiHits.push_back( *pit ); } @@ -2230,13 +2229,13 @@ namespace Muon { double dr = Amg::error(mdt->localCovariance(),Trk::locR); // create identifier - TrkDriftCircleMath::MdtId mdtid( m_idHelperTool->mdtIdHelper().isBarrel(id),m_idHelperTool->mdtIdHelper().multilayer(id)-1, - m_idHelperTool->mdtIdHelper().tubeLayer(id)-1, m_idHelperTool->mdtIdHelper().tube(id)-1 ); + TrkDriftCircleMath::MdtId mdtid( m_idHelperSvc->mdtIdHelper().isBarrel(id),m_idHelperSvc->mdtIdHelper().multilayer(id)-1, + m_idHelperSvc->mdtIdHelper().tubeLayer(id)-1, m_idHelperSvc->mdtIdHelper().tube(id)-1 ); // create new DriftCircle TrkDriftCircleMath::DriftCircle dc( lpos, r, dr, TrkDriftCircleMath::DriftCircle::InTime, mdtid, index, mdt ); TrkDriftCircleMath::DCOnTrack dcOnTrack(dc,1.,1.); - ATH_MSG_VERBOSE(" new MDT hit " << m_idHelperTool->toString( id ) ); + ATH_MSG_VERBOSE(" new MDT hit " << m_idHelperSvc->toString( id ) ); dcs.push_back( dcOnTrack ); indexIdMap.push_back( std::make_pair(id,false) ); @@ -2291,7 +2290,7 @@ namespace Muon { std::vector< std::pair >::iterator iit_end = indexIdMap.end(); for( ;iit!=iit_end;++iit ){ if(iit->second){ - ATH_MSG_DEBUG(" removing hit " << m_idHelperTool->toString( iit->first ) ); + ATH_MSG_DEBUG(" removing hit " << m_idHelperSvc->toString( iit->first ) ); removedIdentifiers.insert( iit->first ); } } @@ -2312,7 +2311,7 @@ namespace Muon { std::set::iterator iit_end = removedIdentifiers.end(); for( ;iit!=iit_end;++iit ){ if( msgLvl(MSG::VERBOSE) ) { - msg(MSG::VERBOSE) << m_idHelperTool->toString( *iit ) << endmsg; + msg(MSG::VERBOSE) << m_idHelperSvc->toString( *iit ) << endmsg; } m_hitHandler->remove(*iit,fitterData.hitList); } @@ -2423,7 +2422,7 @@ namespace Muon { // get identifier, if it has no identifier or is not a muon hit continue Identifier id = m_edmHelperSvc->getIdentifier(*meas); - if( !id.is_valid() || !m_idHelperTool->mdtIdHelper().is_muon(id) ) { + if( !id.is_valid() || !m_idHelperSvc->isMuon(id) ) { ATH_MSG_VERBOSE(" adding state with measurement without valid identifier " << m_printer->print(*pars) ); currentTrack->tsos.push_back(*tit); continue; @@ -2432,7 +2431,7 @@ namespace Muon { if( nperigees == 1 ) ATH_MSG_WARNING(" found muon measurement inbetween the two perigees, this should not happen " ); // add station index for MDT and CSC hits - if( !m_idHelperTool->isTrigger(id) ) currentTrack->stations.insert(m_idHelperTool->stationIndex(id)); + if( !m_idHelperSvc->isTrigger(id) ) currentTrack->stations.insert(m_idHelperSvc->stationIndex(id)); ATH_MSG_VERBOSE(" adding " << m_printer->print(*meas) ); @@ -2532,12 +2531,12 @@ namespace Muon { if( !meas ) continue; Identifier id = m_edmHelperSvc->getIdentifier(*meas); - if( !id.is_valid() || !m_idHelperTool->mdtIdHelper().is_muon(id) ) continue; + if( !id.is_valid() || !m_idHelperSvc->isMuon(id) ) continue; - if( m_idHelperTool->isMdt(id) ){ + if( m_idHelperSvc->isMdt(id) ){ if( !firstMeas ) firstMeas = *tit; lastMeas = *tit; - }else if( m_idHelperTool->measuresPhi(id) ) { + }else if( m_idHelperSvc->measuresPhi(id) ) { phiMeas = *tit; } } diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.h index fdcb71e4e1ecc37048b247bb94614c3a00aa2703..fe144ab5f4376538508a5308467cf4841effc164 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MooTrackFitter.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 */ #ifndef MUON_MOOTRACKFITTER_H @@ -10,9 +10,7 @@ #include "AthenaBaseComps/AthAlgTool.h" // Misc -#include "Identifier/Identifier.h" #include "TrkGeometry/MagneticFieldProperties.h" -#include "MuonIdHelpers/MuonStationIndex.h" // Tracking EDM #include "TrkParameters/TrackParameters.h" @@ -29,12 +27,11 @@ #include "MuonSegmentMakerToolInterfaces/IMuonSegmentInOverlapResolvingTool.h" #include "MuonRecHelperTools/MuonEDMPrinterTool.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "TrkExInterfaces/IPropagator.h" #include "TrkToolInterfaces/ITrackSummaryHelperTool.h" #include "TrkDriftCircleMath/SegmentFinder.h" #include "TrkDriftCircleMath/DCSLFitter.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" // Local #include "MuPatCandidateBase.h" @@ -43,40 +40,19 @@ #include -class MsgStream; - -class RpcIdHelper; -class MdtIdHelper; -class CscIdHelper; -class TgcIdHelper; -class Identifier; - namespace MuonGM { class MuonDetectorManager; } namespace Trk { - class RIO_OnTrack; class PrepRawData; - class IPropagator; class Track; class MeasurementBase; - // class PseudoMeasurementOnTrack; class Layer; - // class ITrackSummaryHelperTool; } namespace Muon { class MuonSegment; -// class MuonEDMPrinterTool; -// class MuonIdHelperTool; -// class IMuonTrackCleaner; -// class MuPatHitTool; -// class IMuonSegmentMomentumEstimator; -// class IMuonTrackToSegmentTool; -// class IMdtDriftCircleOnTrackCreator; -// class IMuonSegmentInOverlapResolvingTool; -// class IMuonHitSelector; class MuPatCandidateBase; class MuPatTrack; } @@ -317,7 +293,7 @@ namespace Muon { Trk::ParticleHypothesis m_ParticleHypothesis ; //!< nomen est omen Trk::TrackInfo::TrackPatternRecoInfo m_patRecInfo {Trk::TrackInfo::Moore}; Trk::MagneticFieldProperties m_magFieldProperties {Trk::FullField}; //!< magnetic field properties - ToolHandle m_idHelperTool {this, "IdHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool"}; //!< id helper tool + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ServiceHandle m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; //!< multi purpose helper tool diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx index 032aa1fb674e41de46f8af7c9ffa588b56222716..9a38c8227621ee47a488018675d8c2eb46bb518c 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.cxx @@ -1,13 +1,11 @@ /* - 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 "MuonTrackSteering.h" #include "MuonTrackSteeringStrategy.h" -#include "MuonIdHelpers/MuonStationIndex.h" - #include "MuonSegment/MuonSegment.h" #include "MuonSegment/MuonSegmentCombination.h" diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.h index f1e5f6a67d4cd053442595aa23284d757e2b9e10..4efee9f75e2fc8615283792541a6f7755532ec51 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackSteeringTools/src/MuonTrackSteering.h @@ -42,13 +42,10 @@ #include #include -class MsgStream; - namespace Muon { class MuPatSegment; class MuonTrackSteeringStrategy; class MuPatTrack; - class MuonSegmentCombination; } namespace Muon { diff --git a/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.cxx b/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.cxx index 5548ddc4b4a9fd80941e5c236f814cd1a0ade356..6f4a188ef1fd86fa9284b83a208472a607235583 100755 --- a/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.cxx +++ b/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "DetailedMuonPatternTruthBuilder.h" @@ -49,7 +49,6 @@ #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "TrkPseudoMeasurementOnTrack/PseudoMeasurementOnTrack.h" -#include "Identifier/Identifier.h" #include "TrackRecord/TrackRecordCollection.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" @@ -81,8 +80,6 @@ #include #include -using namespace std; - const MuonSimDataCollection* retrieveTruthCollection( std::string colName ); const MuonSimData::Deposit* getDeposit( const MuonSimDataCollection& simCol, const HepMC::GenParticle& genPart, const Identifier& id ); @@ -149,44 +146,21 @@ namespace Trk { //================================================================ DetailedMuonPatternTruthBuilder::DetailedMuonPatternTruthBuilder(const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool(type,name,parent) - , m_idHelper(0) - , m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool") - , m_truthTrajBuilder("Trk::ElasticTruthTrajectoryBuilder") + , m_truthTrackBuilder("Trk::ElasticTruthTrajectoryBuilder") , m_mdtCreator("Muon::MdtDriftCircleOnTrackCreator/MdtDriftCircleOnTrackCreator") , m_muonClusterCreator("Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator") { declareInterface(this); - declareProperty("TruthTrajectoryTool", m_truthTrajBuilder); -// declareProperty("MdtRotCreator", m_mdtCreator); -// declareProperty("MuonClusterCreator", m_muonClusterCreator); + declareProperty("TruthTrajectoryTool", m_truthTrackBuilder); } //================================================================ StatusCode DetailedMuonPatternTruthBuilder::initialize() { - if ( m_truthTrajBuilder.retrieve().isFailure() ) { - ATH_MSG_FATAL("Failed to retrieve TruthTrajectory building tool " << m_truthTrajBuilder); - return StatusCode::FAILURE; - } else { - ATH_MSG_INFO("Retrieved TruthTrajectory building tool " << m_truthTrajBuilder); - } - if (m_idHelperTool.retrieve().isFailure()) { - msg(MSG::FATAL) << "Could not get " << m_idHelperTool.type() << endmsg; - return StatusCode::FAILURE; - } - if(!detStore()->retrieve(m_idHelper, "AtlasID").isSuccess()) { - ATH_MSG_FATAL("Unable to initialize ID helper."); - return StatusCode::FAILURE; - } - - if (m_mdtCreator.retrieve().isFailure()) { - msg(MSG::FATAL) << "Could not get " << m_mdtCreator.type() << endmsg; - return StatusCode::FAILURE; - } - if (m_muonClusterCreator.retrieve().isFailure()) { - msg(MSG::FATAL) << "Could not get " << m_muonClusterCreator.type() << endmsg; - return StatusCode::FAILURE; - } + ATH_CHECK(m_truthTrackBuilder.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_CHECK(m_mdtCreator.retrieve()); + ATH_CHECK(m_muonClusterCreator.retrieve()); return StatusCode::SUCCESS; } @@ -213,9 +187,7 @@ buildDetailedMuonPatternTruth(DetailedMuonPatternTruthCollection *output, if(*i) { if (!(*i)->empty()) { SubDetHitStatistics::SubDetType subdet = findSubDetType((*i)->begin()->first) ; - - //std::cout<<"Got SubDetType = "<begin()->first < *output, if(*i) { if (!(*i)->empty()) { SubDetHitStatistics::SubDetType subdet = findSubDetType((*i)->begin()->first) ; - - //std::cout<<"Got SubDetType = "<begin()->first < *output, SubDetHitStatistics::SubDetType DetailedMuonPatternTruthBuilder::findSubDetType(Identifier id) { - if (m_idHelper->is_pixel(id)) - return SubDetHitStatistics::Pixel; - if (m_idHelper->is_sct(id)) - return SubDetHitStatistics::SCT; - if (m_idHelper->is_trt(id)) - return SubDetHitStatistics::TRT; - if (m_idHelper->is_mdt(id)) - return SubDetHitStatistics::MDT; - if (m_idHelper->is_rpc(id)) - return SubDetHitStatistics::RPC; - if (m_idHelper->is_tgc(id)) - return SubDetHitStatistics::TGC; - if (m_idHelper->is_csc(id)) - return SubDetHitStatistics::CSC; - if (m_idHelper->is_mm(id)) - return SubDetHitStatistics::MM; - if (m_idHelper->is_stgc(id)) - return SubDetHitStatistics::STGC; - + if (!m_idHelperSvc->isMuon(id)) { + if (m_idHelperSvc->mdtIdHelper().is_pixel(id)) return SubDetHitStatistics::Pixel; + else if (m_idHelperSvc->mdtIdHelper().is_sct(id)) return SubDetHitStatistics::SCT; + else if (m_idHelperSvc->mdtIdHelper().is_trt(id)) return SubDetHitStatistics::TRT; + } else { + if (m_idHelperSvc->isMdt(id)) return SubDetHitStatistics::MDT; + else if (m_idHelperSvc->isRpc(id)) return SubDetHitStatistics::RPC; + else if (m_idHelperSvc->isTgc(id)) return SubDetHitStatistics::TGC; + else if (m_idHelperSvc->isCsc(id)) return SubDetHitStatistics::CSC; + else if (m_idHelperSvc->isMM(id)) return SubDetHitStatistics::MM; + else if (m_idHelperSvc->issTgc(id)) return SubDetHitStatistics::STGC; + } ATH_MSG_WARNING("findSubDetType(): UNKNOWN subdet for id="<getMother(current)) ); + } while( (current = m_truthTrackBuilder->getMother(current)) ); // Add the grown sprout to the list sprouts.insert(std::make_pair(link, current_sprout)); @@ -529,7 +492,7 @@ void DetailedMuonPatternTruthBuilder::addTrack(DetailedMuonPatternTruthCollectio // Thus no need to update stats track and stats common. const HepMC::GenParticle* current = *s->second.begin(); - while( (current = m_truthTrajBuilder->getDaughter(current)) ) { + while( (current = m_truthTrackBuilder->getDaughter(current)) ) { s->second.push_front(current); } @@ -542,7 +505,7 @@ void DetailedMuonPatternTruthBuilder::addTrack(DetailedMuonPatternTruthCollectio } // Count PRDs on the TruthTrajectory - set tempSet; + std::set tempSet; SubDetHitStatistics truthStat = countPRDsOnTruth(traj, inverseTruth, tempSet); ATH_MSG_VERBOSE("addTrack(): sprout length = "< chIndices) + std::set chIndices) { // Different particles from the same TruthTrajectory can contribute to the same cluster. // We should be careful to avoid double-counting in such cases. @@ -570,7 +533,7 @@ SubDetHitStatistics DetailedMuonPatternTruthBuilder::countPRDsOnTruth(const Trut typedef PRD_InverseTruth::const_iterator iter; std::pair range = inverseTruth.equal_range(*p); for(iter i = range.first; i != range.second; ++i) { - if(chIndices.find(m_idHelperTool->chamberIndex(i->second)) != chIndices.end()) { + if(chIndices.find(m_idHelperSvc->chamberIndex(i->second)) != chIndices.end()) { SubDetHitStatistics::SubDetType subdet = findSubDetType(i->second); if(subdet==SubDetHitStatistics::NUM_SUBDETECTORS) continue; prds.subDetHits[subdet].insert(i->second); @@ -586,13 +549,12 @@ SubDetHitStatistics DetailedMuonPatternTruthBuilder::countPRDsOnTruth(const Trut Amg::Vector3D DetailedMuonPatternTruthBuilder::getPRDTruthPosition(const Muon::MuonSegment &segment, std::list genPartList, int truthPos, - set chIndices) + std::set chIndices) { double minPos = 2e8, maxPos = 0; Amg::Vector3D first3D(0,0,0), last3D(0,0,0); if(genPartList.size() == 0) { - std::cout << "No GenParticles associated to this PRD_TruthTrajectory. Exiting segment creation." << std::endl; ATH_MSG_WARNING("No GenParticles associated to this PRD_TruthTrajectory. Exiting segment creation."); return Amg::Vector3D(0, 0, 0); } @@ -630,10 +592,10 @@ Amg::Vector3D DetailedMuonPatternTruthBuilder::getPRDTruthPosition(const Muon::M Identifier id = prd->identify(); - Muon::MuonStationIndex::StIndex stIndex = m_idHelperTool->stationIndex(id); - bool isEndcap = m_idHelperTool->isEndcap(id); + Muon::MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(id); + bool isEndcap = m_idHelperSvc->isEndcap(id); - if(chIndices.find(m_idHelperTool->chamberIndex(id)) == chIndices.end()) { + if(chIndices.find(m_idHelperSvc->chamberIndex(id)) == chIndices.end()) { ATH_MSG_DEBUG("Muon station doesn't match segment. Continuing"); continue; } @@ -656,10 +618,10 @@ Amg::Vector3D DetailedMuonPatternTruthBuilder::getPRDTruthPosition(const Muon::M detLayer.stIndex = stIndex; //const Trk::MeasurementBase* meas = 0; - if( m_idHelperTool->isMdt(id) ){ + if( m_idHelperSvc->isMdt(id) ){ const Muon::MdtPrepData* mprd = dynamic_cast(prd); if( !mprd ) { - ATH_MSG_WARNING(" MDT PRD not of type MdtPrepData " << m_idHelperTool->toString(id) ); + ATH_MSG_WARNING(" MDT PRD not of type MdtPrepData " << m_idHelperSvc->toString(id) ); continue; } @@ -668,14 +630,14 @@ Amg::Vector3D DetailedMuonPatternTruthBuilder::getPRDTruthPosition(const Muon::M deposit = getDeposit(*mdtSimDataMap, **it ,id); } if( !deposit ){ - ATH_MSG_WARNING(" Deposit for GenParticle not found " << m_idHelperTool->toString(id) ); + ATH_MSG_WARNING(" Deposit for GenParticle not found " << m_idHelperSvc->toString(id) ); continue; } Amg::Vector2D lp(deposit->second.firstEntry(),deposit->second.secondEntry()); const Amg::Vector3D* gpos = prd->detectorElement()->surface(id).localToGlobal(lp); if( !gpos ) { - ATH_MSG_WARNING(" LocalToGlobal failed " << m_idHelperTool->toString(id) ); + ATH_MSG_WARNING(" LocalToGlobal failed " << m_idHelperSvc->toString(id) ); continue; } @@ -709,18 +671,18 @@ Amg::Vector3D DetailedMuonPatternTruthBuilder::getPRDTruthPosition(const Muon::M const Muon::MdtDriftCircleOnTrack* mdt = m_mdtCreator->createRIO_OnTrack(*mprd,*gpos); delete gpos; if( !mdt ) { - ATH_MSG_WARNING(" ROT creation failed " << m_idHelperTool->toString(id) ); + ATH_MSG_WARNING(" ROT creation failed " << m_idHelperSvc->toString(id) ); continue; } Trk::DriftCircleSide side = deposit->second.firstEntry() < 0 ? Trk::LEFT : Trk::RIGHT; m_mdtCreator->updateSign(*const_cast(mdt),side); double pull = (mdt->driftRadius()-deposit->second.firstEntry())/mdt->localCovariance()(Trk::locR) ; - ATH_MSG_VERBOSE(" new MDT " << m_idHelperTool->toString(id) << " radius " << mdt->driftRadius() + ATH_MSG_VERBOSE(" new MDT " << m_idHelperSvc->toString(id) << " radius " << mdt->driftRadius() << " true radius " << deposit->second.firstEntry() << " pull " << pull ); if( fabs(pull)>3. ) ATH_MSG_VERBOSE(" hit with large pull "); detLayer.meas.push_back(mdt); - if( m_idHelperTool->isSmallChamber(id) ) ++detLayer.nmdtS; + if( m_idHelperSvc->isSmallChamber(id) ) ++detLayer.nmdtS; else ++detLayer.nmdtL; //meas = mdt; }else if( mm ){ @@ -730,14 +692,14 @@ Amg::Vector3D DetailedMuonPatternTruthBuilder::getPRDTruthPosition(const Muon::M deposit = getDeposit(*mmSimDataMap, **it ,id); } if( !deposit ){ - ATH_MSG_WARNING(" Deposit for GenParticle not found " << m_idHelperTool->toString(id) ); + ATH_MSG_WARNING(" Deposit for GenParticle not found " << m_idHelperSvc->toString(id) ); continue; } Amg::Vector2D lp(deposit->second.firstEntry(),deposit->second.secondEntry()); const Amg::Vector3D* gpos = prd->detectorElement()->surface(id).localToGlobal(lp); if( !gpos ) { - ATH_MSG_WARNING(" LocalToGlobal failed " << m_idHelperTool->toString(id) ); + ATH_MSG_WARNING(" LocalToGlobal failed " << m_idHelperSvc->toString(id) ); continue; } @@ -772,12 +734,12 @@ Amg::Vector3D DetailedMuonPatternTruthBuilder::getPRDTruthPosition(const Muon::M const Muon::MuonClusterOnTrack* rot = m_muonClusterCreator->createRIO_OnTrack(*mm,*gpos); if( !rot ) { delete gpos; - ATH_MSG_WARNING(" ROT creation failed " << m_idHelperTool->toString(id) ); + ATH_MSG_WARNING(" ROT creation failed " << m_idHelperSvc->toString(id) ); continue; } double residual = rot->localParameters().get(Trk::locX)-lp.x(); double pull = residual / rot->localCovariance()(Trk::locX); - ATH_MSG_DEBUG( "Adding r " << gpos->perp() << " z " << gpos->z() << " " << m_idHelperTool->toString(id) << " " << residual << " pull " << pull ); + ATH_MSG_DEBUG( "Adding r " << gpos->perp() << " z " << gpos->z() << " " << m_idHelperSvc->toString(id) << " " << residual << " pull " << pull ); detLayer.meas.push_back(rot); //meas = rot; ++detLayer.nnsw; @@ -786,7 +748,7 @@ Amg::Vector3D DetailedMuonPatternTruthBuilder::getPRDTruthPosition(const Muon::M }else if( stgc ) { // skip pads in outer most two chambers as here the wires are more precise - if( m_idHelperTool->stgcIdHelper().channelType(id) == 0 && abs(m_idHelperTool->stationEta(id)) > 2 ) continue; + if( m_idHelperSvc->stgcIdHelper().channelType(id) == 0 && abs(m_idHelperSvc->stationEta(id)) > 2 ) continue; // there is already a check for this at the beginning of the method // if( !stgcSimDataMap ) continue; @@ -796,7 +758,7 @@ Amg::Vector3D DetailedMuonPatternTruthBuilder::getPRDTruthPosition(const Muon::M deposit = getDeposit(*stgcSimDataMap, **it ,id); } if( !deposit ){ - ATH_MSG_WARNING(" Deposit for GenParticle not found " << m_idHelperTool->toString(id) ); + ATH_MSG_WARNING(" Deposit for GenParticle not found " << m_idHelperSvc->toString(id) ); continue; } @@ -804,7 +766,7 @@ Amg::Vector3D DetailedMuonPatternTruthBuilder::getPRDTruthPosition(const Muon::M Amg::Vector2D lp(deposit->second.firstEntry(),deposit->second.secondEntry()); const Amg::Vector3D* gpos = prd->detectorElement()->surface(id).localToGlobal(lp); if( !gpos ) { - ATH_MSG_WARNING(" LocalToGlobal failed " << m_idHelperTool->toString(id) ); + ATH_MSG_WARNING(" LocalToGlobal failed " << m_idHelperSvc->toString(id) ); continue; } @@ -839,12 +801,12 @@ Amg::Vector3D DetailedMuonPatternTruthBuilder::getPRDTruthPosition(const Muon::M const Muon::MuonClusterOnTrack* rot = m_muonClusterCreator->createRIO_OnTrack(*stgc,*gpos); if( !rot ) { delete gpos; - ATH_MSG_WARNING(" ROT creation failed " << m_idHelperTool->toString(id) ); + ATH_MSG_WARNING(" ROT creation failed " << m_idHelperSvc->toString(id) ); continue; } double residual = rot->localParameters().get(Trk::locX) - lp.x(); double pull = residual / rot->localCovariance()(Trk::locX); - ATH_MSG_DEBUG( "Adding r " << gpos->perp() << " z " << gpos->z() << " " << m_idHelperTool->toString(id) << " " << residual << " pull " << pull ); + ATH_MSG_DEBUG( "Adding r " << gpos->perp() << " z " << gpos->z() << " " << m_idHelperSvc->toString(id) << " " << residual << " pull " << pull ); detLayer.meas.push_back(rot); //meas = rot; ++detLayer.nnsw; @@ -999,7 +961,7 @@ void DetailedMuonPatternTruthBuilder::addDetailedTrackTruth(std::vectorgetMother(current)) ); + } while( (current = m_truthTrackBuilder->getMother(current)) ); // Add the grown sprout to the list sprouts.insert(std::make_pair(link, current_sprout)); @@ -1022,7 +984,7 @@ void DetailedMuonPatternTruthBuilder::addDetailedTrackTruth(std::vectorsecond.begin(); - while( (current = m_truthTrajBuilder->getDaughter(current)) ) { + while( (current = m_truthTrackBuilder->getDaughter(current)) ) { s->second.push_front(current); } @@ -1035,7 +997,7 @@ void DetailedMuonPatternTruthBuilder::addDetailedTrackTruth(std::vector tempSet; + std::set tempSet; SubDetHitStatistics truthStat = countPRDsOnTruth(traj, inverseTruth, tempSet); ATH_MSG_VERBOSE("addTrack(): sprout length = "< pairStat; // stats for (track,GenParticle) for the current track - set chIndices; + std::set chIndices; // Loop over containedROTs in segment const std::vector& cROTv = segment.containedROTs(); @@ -1138,7 +1100,7 @@ void DetailedMuonPatternTruthBuilder::addDetailedTrackTruthFromSegment(std::vect const Trk::PrepRawData* prd = cROTv.at(i_cROTv)->prepRawData(); Identifier id = prd->identify(); - chIndices.insert(m_idHelperTool->chamberIndex(id)); + chIndices.insert(m_idHelperSvc->chamberIndex(id)); SubDetHitStatistics::SubDetType subdet = findSubDetType(id); @@ -1248,7 +1210,7 @@ void DetailedMuonPatternTruthBuilder::addDetailedTrackTruthFromSegment(std::vect } } - } while( (current = m_truthTrajBuilder->getMother(current)) ); + } while( (current = m_truthTrackBuilder->getMother(current)) ); // Add the grown sprout to the list sprouts.insert(std::make_pair(link, current_sprout)); @@ -1271,7 +1233,7 @@ void DetailedMuonPatternTruthBuilder::addDetailedTrackTruthFromSegment(std::vect // Thus no need to update stats track and stats common. const HepMC::GenParticle* current = *s->second.begin(); - while( (current = m_truthTrajBuilder->getDaughter(current)) ) { + while( (current = m_truthTrackBuilder->getDaughter(current)) ) { s->second.push_front(current); } @@ -1301,7 +1263,7 @@ void DetailedMuonPatternTruthBuilder::addDetailedTrackTruthFromSegment(std::vect { MuonSimDataCollection::const_iterator it = simCol.find(id); if( it == simCol.end() ) { - ATH_MSG_WARNING(" Truth PRD not found in simdata collection: " << m_idHelperTool->toString(id) ); + ATH_MSG_WARNING(" Truth PRD not found in simdata collection: " << m_idHelperSvc->toString(id) ); return 0; } diff --git a/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.h b/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.h index f4715f18a1bd92277a0fc98c7312d6ab7c9cda5a..e9fd93c872cfbabd398498d4b4854a1c463a56c6 100755 --- a/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.h +++ b/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.h @@ -1,14 +1,14 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// Dear emacs, this is -*-c++-*- - #ifndef DETAILEDMUONPATTERNTRUTHBUILDER_H #define DETAILEDMUONPATTERNTRUTHBUILDER_H +// Gaudi #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/ServiceHandle.h" #include "AthLinks/ElementLink.h" #include "AtlasDetDescr/AtlasDetectorID.h" @@ -36,14 +36,9 @@ #include "TrkMeasurementBase/MeasurementBase.h" #include "TrkPrepRawData/PrepRawData.h" -#include "MuonIdHelpers/MuonStationIndex.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" // Include any other potentially useful packages -// Gaudi -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/ServiceHandle.h" // Trk includes #include "MuonSimData/MuonSimDataCollection.h" #include "MuonSimData/CscSimDataCollection.h" @@ -80,10 +75,9 @@ namespace Trk { private: typedef InverseMultiMap PRD_InverseTruth; - const AtlasDetectorID *m_idHelper; - ToolHandle m_idHelperTool; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - ToolHandle m_truthTrajBuilder; + ToolHandle m_truthTrackBuilder; ToolHandle m_mdtCreator; ToolHandle m_muonClusterCreator; ToolHandle p_IMuonClusterOnTrackCreatorCSCCluster ; diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthAssociationAlg.cxx b/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthAssociationAlg.cxx index 1ec8152698ef71c037f92da5789a0872dfffffb2..4a9a130cdca3d8895c051c5927362140420fe85b 100644 --- a/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthAssociationAlg.cxx +++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthAssociationAlg.cxx @@ -1,12 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MuonTruthAssociationAlg.cxx -// Implementation file for class MuonTruthAssociationAlg -/////////////////////////////////////////////////////////////////// - #include "MuonTruthAssociationAlg.h" #include "TrkTrack/Track.h" #include "TrkTrack/TrackStateOnSurface.h" @@ -17,14 +12,13 @@ // Constructor with parameters: MuonTruthAssociationAlg::MuonTruthAssociationAlg(const std::string &name, ISvcLocator *pSvcLocator) : - AthAlgorithm(name,pSvcLocator), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool") + AthAlgorithm(name,pSvcLocator) {} // Initialize method: StatusCode MuonTruthAssociationAlg::initialize() { - ATH_CHECK(m_idHelper.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); m_muonTruthParticleContainerName=m_muonTruthParticleContainerName.key()+".recoMuonLink"; ATH_CHECK(m_muonTruthParticleContainerName.initialize()); m_muonTruthParticleLink=m_muonName+".truthParticleLink"; @@ -151,10 +145,10 @@ StatusCode MuonTruthAssociationAlg::execute() if( !crot->containedROTs().empty() && crot->containedROTs().front() ) id=crot->containedROTs().front()->identify(); } } - if(!m_idHelper->isMuon(id)) continue; - bool measPhi = m_idHelper->measuresPhi(id); - bool isTgc = m_idHelper->isTgc(id); - Muon::MuonStationIndex::ChIndex chIndex = !isTgc ? m_idHelper->chamberIndex(id) : Muon::MuonStationIndex::ChUnknown; + if(!m_idHelperSvc->isMuon(id)) continue; + bool measPhi = m_idHelperSvc->measuresPhi(id); + bool isTgc = m_idHelperSvc->isTgc(id); + Muon::MuonStationIndex::ChIndex chIndex = !isTgc ? m_idHelperSvc->chamberIndex(id) : Muon::MuonStationIndex::ChUnknown; bool found=false; for(unsigned int i=0;iphiIndex(id); + Muon::MuonStationIndex::PhiIndex index = m_idHelperSvc->phiIndex(id); if(nphiHitsPerChamberLayer[index]==999) nphiHitsPerChamberLayer[index]=1; else ++nphiHitsPerChamberLayer[index]; } @@ -183,7 +177,7 @@ StatusCode MuonTruthAssociationAlg::execute() if(found) continue; for(unsigned int i=0;iphiIndex(id); + int index = m_idHelperSvc->phiIndex(id); if( measPhi ){ if(nphiHitsPerChamberLayer[index]==999) nphiHitsPerChamberLayer[index]=1; else ++nphiHitsPerChamberLayer[index]; @@ -199,7 +193,7 @@ StatusCode MuonTruthAssociationAlg::execute() if(found) continue; for(unsigned int i=0;iphiIndex(id); + int index = m_idHelperSvc->phiIndex(id); if( measPhi ){ if(nphiHitsPerChamberLayer[index]==999) nphiHitsPerChamberLayer[index]=1; else ++nphiHitsPerChamberLayer[index]; @@ -220,13 +214,13 @@ StatusCode MuonTruthAssociationAlg::execute() bool found=false; for(unsigned int j=0;jchamberIndex(id)==(Muon::MuonStationIndex::ChIndex)i){ nprecHitsPerChamberLayer[i]=0; found=true; break;} + if(m_idHelperSvc->chamberIndex(id)==(Muon::MuonStationIndex::ChIndex)i){ nprecHitsPerChamberLayer[i]=0; found=true; break;} } if(found) continue; for(unsigned int j=0;jmeasuresPhi(id)){ - if(m_idHelper->chamberIndex(id)==(Muon::MuonStationIndex::ChIndex)i){ nprecHitsPerChamberLayer[i]=0; break;} + if(!m_idHelperSvc->measuresPhi(id)){ + if(m_idHelperSvc->chamberIndex(id)==(Muon::MuonStationIndex::ChIndex)i){ nprecHitsPerChamberLayer[i]=0; break;} } } } @@ -236,22 +230,22 @@ StatusCode MuonTruthAssociationAlg::execute() bool found=false; for(unsigned int j=0;jmeasuresPhi(id)){ - if(m_idHelper->phiIndex(id)==(Muon::MuonStationIndex::PhiIndex)i){nphiHitsPerChamberLayer[i]=0; found=true; break;} + if(m_idHelperSvc->measuresPhi(id)){ + if(m_idHelperSvc->phiIndex(id)==(Muon::MuonStationIndex::PhiIndex)i){nphiHitsPerChamberLayer[i]=0; found=true; break;} } } if(found) continue; for(unsigned int j=0;jmeasuresPhi(id)){ - if(m_idHelper->phiIndex(id)==(Muon::MuonStationIndex::PhiIndex)i){nphiHitsPerChamberLayer[i]=0; found=true; break;} + if(m_idHelperSvc->measuresPhi(id)){ + if(m_idHelperSvc->phiIndex(id)==(Muon::MuonStationIndex::PhiIndex)i){nphiHitsPerChamberLayer[i]=0; found=true; break;} } } if(found) continue; for(unsigned int j=0;jmeasuresPhi(id)){ - if(m_idHelper->phiIndex(id)==(Muon::MuonStationIndex::PhiIndex)i){nphiHitsPerChamberLayer[i]=0; break;} + if(m_idHelperSvc->measuresPhi(id)){ + if(m_idHelperSvc->phiIndex(id)==(Muon::MuonStationIndex::PhiIndex)i){nphiHitsPerChamberLayer[i]=0; break;} } } } @@ -261,15 +255,15 @@ StatusCode MuonTruthAssociationAlg::execute() bool found=false; for(unsigned int j=0;jmeasuresPhi(id)){ - if(m_idHelper->phiIndex(id)==(Muon::MuonStationIndex::PhiIndex)i){nphiHitsPerChamberLayer[i]=0; found=true; break;} + if(!m_idHelperSvc->measuresPhi(id)){ + if(m_idHelperSvc->phiIndex(id)==(Muon::MuonStationIndex::PhiIndex)i){nphiHitsPerChamberLayer[i]=0; found=true; break;} } } if(found) continue; for(unsigned int j=0;jmeasuresPhi(id)){ - if(m_idHelper->phiIndex(id)==(Muon::MuonStationIndex::PhiIndex)i){nphiHitsPerChamberLayer[i]=0; break;} + if(!m_idHelperSvc->measuresPhi(id)){ + if(m_idHelperSvc->phiIndex(id)==(Muon::MuonStationIndex::PhiIndex)i){nphiHitsPerChamberLayer[i]=0; break;} } } } @@ -334,10 +328,3 @@ StatusCode MuonTruthAssociationAlg::execute() } return StatusCode::SUCCESS; } - -// Finalize method: -StatusCode MuonTruthAssociationAlg::finalize() -{ - return StatusCode::SUCCESS; -} - diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthAssociationAlg.h b/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthAssociationAlg.h index 7f2b63a1e74ffbc63cfafc192aed4e4be7090cec..01015886acf89b51ae89a754924dece9c6a2f50c 100644 --- a/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthAssociationAlg.h +++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthAssociationAlg.h @@ -1,21 +1,16 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MuonTruthAssociationAlg.h -// Header file for class MuonTruthAssociationAlg -/////////////////////////////////////////////////////////////////// - #ifndef TRUTHPARTICLEALGS_MUONTRUTHASSOCIATIONALG_H #define TRUTHPARTICLEALGS_MUONTRUTHASSOCIATIONALG_H #include "AthenaBaseComps/AthAlgorithm.h" #include "xAODMuon/MuonContainer.h" #include "xAODTruth/TruthParticleContainer.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonIdHelpers/MuonStationIndex.h" #include "StoreGate/WriteDecorHandleKey.h" +#include "GaudiKernel/ServiceHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" class MuonTruthAssociationAlg : public AthAlgorithm { @@ -26,7 +21,6 @@ public: // Basic algorithm methods: virtual StatusCode initialize(); virtual StatusCode execute(); - virtual StatusCode finalize(); private: Gaudi::Property >m_muonTruthParticleContainerName{this,"MuonTruthParticleContainerName","MuonTruthParticles","container name for muon truth particles; the full handle name, including the reco muon link auxdata, is set in initialize()"}; @@ -40,7 +34,7 @@ private: Gaudi::Propertym_associateWithInDetTP{this,"AssociateWithInDetTP",false,"force use of ID track particles for association"}; Gaudi::Propertym_barcodeOffset{this,"BarcodeOffset",1000000 ,"barcode offset for truth particles"}; - ToolHandle m_idHelper; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; diff --git a/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx b/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx index bbeea6660071edc905f0a82ba2e96115b4bf42cc..6a82696130c8b662236ea83db980d719a401c52f 100644 --- a/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx +++ b/MuonSpectrometer/MuonTruthAlgs/src/MuonTruthDecorationAlg.cxx @@ -1,12 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// MuonTruthDecorationAlg.cxx -// Implementation file for class MuonTruthDecorationAlg -/////////////////////////////////////////////////////////////////// - #include "MuonTruthDecorationAlg.h" #include "xAODMuon/MuonSegment.h" #include "xAODMuon/MuonSegmentAuxContainer.h" @@ -29,7 +24,6 @@ namespace Muon { // Constructor with parameters: MuonTruthDecorationAlg::MuonTruthDecorationAlg(const std::string &name, ISvcLocator *pSvcLocator) : AthAlgorithm(name,pSvcLocator), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), m_truthClassifier("MCTruthClassifier/MCTruthClassifier"), m_extrapolator("Trk::Extrapolator/AtlasExtrapolator"), @@ -42,17 +36,14 @@ namespace Muon { declareProperty("MuonTruthSegmentName" , m_muonTruthSegmentContainerName = "MuonTruthSegments" ); declareProperty("TrackRecordCollectionNames" , m_trackRecordCollectionNames={"CaloEntryLayer","MuonEntryLayer","MuonExitLayer"}); - //declareProperty("PRD_TruthMaps",m_PRD_TruthNames={"CSC_TruthMap","RPC_TruthMap","TGC_TruthMap","MDT_TruthMap","MM_TruthMap","STGC_TruthMap"}); //remove NSW by default for now, can always be changed in the configuration declareProperty("PRD_TruthMaps",m_PRD_TruthNames={"CSC_TruthMap","RPC_TruthMap","TGC_TruthMap","MDT_TruthMap"}); declareProperty("CSCSDOs", m_CSC_SDO_TruthNames="CSC_SDO"); - //declareProperty("SDOs", m_SDO_TruthNames={"RPC_SDO","TGC_SDO","MDT_SDO","MM_SDO","STGC_SDO"}); //remove NSW by default for now, can always be changed in the configuration declareProperty("SDOs", m_SDO_TruthNames={"RPC_SDO","TGC_SDO","MDT_SDO"}); declareProperty("MCTruthClassifier", m_truthClassifier); - declareProperty("MuonIdHelperTool", m_idHelper); declareProperty("MuonEDMPrinterTool", m_printer); declareProperty("Extrapolator", m_extrapolator); declareProperty("CreateTruthSegments", m_createTruthSegment = true ); @@ -69,15 +60,11 @@ namespace Muon { ATH_CHECK(m_PRD_TruthNames.initialize()); ATH_CHECK(m_SDO_TruthNames.initialize()); if (!m_CSC_SDO_TruthNames.empty()) ATH_CHECK(m_CSC_SDO_TruthNames.initialize()); - ATH_CHECK(m_idHelper.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_printer.retrieve()); ATH_CHECK(m_truthClassifier.retrieve()); ATH_CHECK(m_extrapolator.retrieve()); - if (detStore()->retrieve( m_muonMgr ).isFailure()) { - ATH_MSG_ERROR(" Cannot retrieve MuonGeoModel "); - return StatusCode::FAILURE; - } - + ATH_CHECK(detStore()->retrieve(m_muonMgr)); return StatusCode::SUCCESS; } @@ -183,9 +170,9 @@ namespace Muon { } if(!col->empty()){ Identifier id = col->begin()->first; - int index = m_idHelper->technologyIndex(id); + int index = m_idHelperSvc->technologyIndex(id); if( index >= (int)sdoCollections.size() ){ - ATH_MSG_WARNING("SDO collection index out of range " << index << " " << m_idHelper->toStringChamber(id) ); + ATH_MSG_WARNING("SDO collection index out of range " << index << " " << m_idHelperSvc->toStringChamber(id) ); } else{ sdoCollections[index] = col; @@ -212,26 +199,26 @@ namespace Muon { ATH_MSG_DEBUG(" new chamber layer " << Muon::MuonStationIndex::chName(lay.first) << " hits " << ids.size() ); // loop over hits for( const auto& id : lay.second ){ - ATH_MSG_VERBOSE(" hit " << m_idHelper->toString(id) ); - bool measPhi = m_idHelper->measuresPhi(id); - bool isCsc = m_idHelper->isCsc(id); - bool isMM = m_idHelper->isMM(id); - bool isTrig = m_idHelper->isTrigger(id); - bool isEndcap = m_idHelper->isEndcap(id); + ATH_MSG_VERBOSE(" hit " << m_idHelperSvc->toString(id) ); + bool measPhi = m_idHelperSvc->measuresPhi(id); + bool isCsc = m_idHelperSvc->isCsc(id); + bool isMM = m_idHelperSvc->isMM(id); + bool isTrig = m_idHelperSvc->isTrigger(id); + bool isEndcap = m_idHelperSvc->isEndcap(id); if( measPhi ) { - phiLayers.insert( m_idHelper->gasGap(id) ); + phiLayers.insert( m_idHelperSvc->gasGap(id) ); } else { if( !isTrig ) { if( !chId.is_valid() ) chId = id; // use first precision hit in list if( isCsc || isMM ) { - precLayers.insert( m_idHelper->gasGap(id) ); + precLayers.insert( m_idHelperSvc->gasGap(id) ); } else { - int iid = 10*m_idHelper->mdtIdHelper().multilayer(id) + m_idHelper->mdtIdHelper().tubeLayer(id); + int iid = 10*m_idHelperSvc->mdtIdHelper().multilayer(id) + m_idHelperSvc->mdtIdHelper().tubeLayer(id); precLayers.insert( iid ); //ATH_MSG_VERBOSE("iid " << iid << " precLayers size " << precLayers.size() ); } }else{ - etaLayers.insert( m_idHelper->gasGap(id) ); + etaLayers.insert( m_idHelperSvc->gasGap(id) ); } } // use SDO to look-up truth position of the hit @@ -239,7 +226,7 @@ namespace Muon { Amg::Vector3D gpos(0.,0.,0.); bool ok = false; if( !isCsc ){ - int index = m_idHelper->technologyIndex(id); + int index = m_idHelperSvc->technologyIndex(id); if( index < (int)sdoCollections.size() && sdoCollections[index]->size() != 0 ) { auto pos = sdoCollections[index]->find(id); if( pos != sdoCollections[index]->end() ) { @@ -272,7 +259,7 @@ namespace Muon { const MuonGM::CscReadoutElement * descriptor = m_muonMgr->getCscReadoutElement(id); ATH_MSG_DEBUG("found csc sdo with "<second.getdeposits().size()<<" deposits"); Amg::Vector3D locpos(0,pos->second.getdeposits()[0].second.ypos(),pos->second.getdeposits()[0].second.zpos()); - gpos=descriptor->localToGlobalCoords(locpos,m_idHelper->cscIdHelper().elementID(id)); + gpos=descriptor->localToGlobalCoords(locpos,m_idHelperSvc->cscIdHelper().elementID(id)); ATH_MSG_DEBUG("got CSC global position "<setNHits(nprecLayers,nphiLayers,ntrigEtaLayers); segment->auxdata< ElementLink< xAOD::TruthParticleContainer > >("truthParticleLink") = truthLink; if( chId.is_valid() ) { - int eta = m_idHelper->stationEta(chId); - int sector = m_idHelper->sector(chId); - MuonStationIndex::TechnologyIndex technology = m_idHelper->technologyIndex(chId); - MuonStationIndex::ChIndex chIndex = m_idHelper->chamberIndex(chId); + int eta = m_idHelperSvc->stationEta(chId); + int sector = m_idHelperSvc->sector(chId); + MuonStationIndex::TechnologyIndex technology = m_idHelperSvc->technologyIndex(chId); + MuonStationIndex::ChIndex chIndex = m_idHelperSvc->chamberIndex(chId); segment->setIdentifier(sector,chIndex,eta,technology); } if( firstPos && secondPos ){ @@ -486,14 +473,14 @@ namespace Muon { if( (trajectory.second->barcode())%m_barcodeOffset != barcode ) continue; const Identifier& id = trajectory.first; - bool measPhi = m_idHelper->measuresPhi(id); - bool isTgc = m_idHelper->isTgc(id); - Muon::MuonStationIndex::ChIndex chIndex = !isTgc ? m_idHelper->chamberIndex(id) : Muon::MuonStationIndex::ChUnknown; + bool measPhi = m_idHelperSvc->measuresPhi(id); + bool isTgc = m_idHelperSvc->isTgc(id); + Muon::MuonStationIndex::ChIndex chIndex = !isTgc ? m_idHelperSvc->chamberIndex(id) : Muon::MuonStationIndex::ChUnknown; // add identifier to map if( ids ) { if( isTgc ){ // TGCS should be added to both EIL and EIS - Muon::MuonStationIndex::PhiIndex index = m_idHelper->phiIndex(id); + Muon::MuonStationIndex::PhiIndex index = m_idHelperSvc->phiIndex(id); if( index == Muon::MuonStationIndex::T4 ){ (*ids)[Muon::MuonStationIndex::EIS].push_back(id); (*ids)[Muon::MuonStationIndex::EIL].push_back(id); @@ -505,21 +492,21 @@ namespace Muon { (*ids)[chIndex].push_back(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 ) ++nphiHitsPerChamberLayer[index]; else ++ntrigEtaHitsPerChamberLayer[index]; } - else if( m_idHelper->isMM(id) ) { + else if( m_idHelperSvc->isMM(id) ) { ++nprecHitsPerChamberLayer[chIndex]; } - else if( m_idHelper->isTrigger(id) ) { - int index = m_idHelper->phiIndex(id); + else if( m_idHelperSvc->isTrigger(id) ) { + int index = m_idHelperSvc->phiIndex(id); if( measPhi ) ++nphiHitsPerChamberLayer[index]; else ++ntrigEtaHitsPerChamberLayer[index]; }else { if( measPhi ) { - Muon::MuonStationIndex::PhiIndex index = m_idHelper->phiIndex(id); + Muon::MuonStationIndex::PhiIndex index = m_idHelperSvc->phiIndex(id); ++nphiHitsPerChamberLayer[index]; }else{ ++nprecHitsPerChamberLayer[chIndex]; @@ -658,14 +645,14 @@ namespace Muon { if(lay.first==Muon::MuonStationIndex::EIS || lay.first==Muon::MuonStationIndex::EIL) nEI++; if(lay.first==Muon::MuonStationIndex::EMS || lay.first==Muon::MuonStationIndex::EML) nEM++; for( const auto& id : lay.second ){ - if(m_idHelper->isMdt(id)) mdtTruthHits.push_back(id.get_compact()); - else if(m_idHelper->isCsc(id)) cscTruthHits.push_back(id.get_compact()); - else if(m_idHelper->isTgc(id)){ + if(m_idHelperSvc->isMdt(id)) mdtTruthHits.push_back(id.get_compact()); + else if(m_idHelperSvc->isCsc(id)) cscTruthHits.push_back(id.get_compact()); + else if(m_idHelperSvc->isTgc(id)){ if((lay.first==Muon::MuonStationIndex::EIS || lay.first==Muon::MuonStationIndex::EIL) && nEI>1) continue; //otherwise we double-count if((lay.first==Muon::MuonStationIndex::EMS || lay.first==Muon::MuonStationIndex::EML) && nEM>1) continue; //otherwise we double-count tgcTruthHits.push_back(id.get_compact()); } - else if(m_idHelper->isRpc(id)) rpcTruthHits.push_back(id.get_compact()); + else if(m_idHelperSvc->isRpc(id)) rpcTruthHits.push_back(id.get_compact()); } } truthParticle.auxdata >("truthMdtHits")=mdtTruthHits; @@ -675,11 +662,4 @@ namespace Muon { ATH_MSG_VERBOSE("Added "< #include #include -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonIdHelpers/MuonStationIndex.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonRecToolInterfaces/IMuonTrackTruthTool.h" #include "MuonRecHelperTools/MuonEDMPrinterTool.h" #include "TrkExInterfaces/IExtrapolator.h" -#include "Identifier/Identifier.h" #include "TrackRecord/TrackRecordCollection.h" #include "xAODTruth/TruthParticle.h" @@ -56,7 +50,6 @@ public: // Basic algorithm methods: virtual StatusCode initialize(); virtual StatusCode execute(); - virtual StatusCode finalize(); private: void addTrackRecords( xAOD::TruthParticle& truthParticle, const xAOD::TruthVertex* vertex ) const; @@ -72,11 +65,11 @@ private: SG::ReadHandleKeyArray m_PRD_TruthNames; SG::ReadHandleKeyArray m_SDO_TruthNames; SG::ReadHandleKey m_CSC_SDO_TruthNames; - ToolHandle m_idHelper; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle m_printer; ToolHandle m_truthClassifier; ToolHandle m_extrapolator; - const MuonGM::MuonDetectorManager * m_muonMgr; + const MuonGM::MuonDetectorManager* m_muonMgr; bool m_createTruthSegment; int m_barcodeOffset; }; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RPCStandaloneTracksMon.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RPCStandaloneTracksMon.h index 45aee84798dfa2675e6fa587fa4180bba95fea8f..919bba34f4ee8a898d27e5d12c20146df055d885 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RPCStandaloneTracksMon.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/RpcRawDataMonitoring/RPCStandaloneTracksMon.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 */ //////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -17,12 +17,10 @@ #include "GaudiKernel/Algorithm.h" #include "GaudiKernel/StatusCode.h" #include "StoreGate/StoreGateSvc.h" -#include "GaudiKernel/MsgStream.h" #include "GaudiKernel/NTuple.h" #include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" - #include "AthenaMonitoring/AthenaMonManager.h" #include "AthenaMonitoring/ManagedMonitorToolBase.h" #include "MuonDQAUtils/MuonDQAHistMap.h" @@ -30,7 +28,7 @@ #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/RpcReadoutElement.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" @@ -152,9 +150,7 @@ class RPCStandaloneTracksMon: public ManagedMonitorToolBase { "MuonDetectorManager", "Key of input MuonDetectorManager condition data"}; - ToolHandle m_muonIdHelperTool{this, "idHelper", - "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; - + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; //Declare Properties SG::ReadHandleKey m_key_rpc{this,"RpcPrepDataContainer","RPC_Measurements","RPC PRDs"}; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RPCStandaloneTracksMon.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RPCStandaloneTracksMon.cxx index 05d3b07848179e715c5bbd253e3e025faa91e288..aaa6e5c74fccd4ccb743f0dd7c9d1a1b4df1840d 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RPCStandaloneTracksMon.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/RpcRawDataMonitoring/src/RPCStandaloneTracksMon.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 */ ///////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -11,9 +11,7 @@ // Subject: RPC-->Offline Muon Data Quality // ///////////////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "GaudiKernel/MsgStream.h" - + #include "MuonReadoutGeometry/RpcReadoutSet.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/MuonReadoutElement.h" @@ -34,17 +32,13 @@ #include "MuonDQAUtils/MuonCosmicSetup.h" #include "MuonDQAUtils/MuonDQAHistMap.h" - -#include "MuonIdHelpers/MuonStationIndex.h" - #include "TrkMultiComponentStateOnSurface/MultiComponentStateOnSurface.h" #include "TrkMultiComponentStateOnSurface/MultiComponentState.h" #include "TrkEventPrimitives/ResidualPull.h" #include "TrkMeasurementBase/MeasurementBase.h" #include "TrkTrack/TrackStateOnSurface.h" #include "TrkTrack/TrackCollection.h" - - + #include "RpcRawDataMonitoring/RPCStandaloneTracksMon.h" #include "RpcRawDataMonitoring/RpcGlobalUtilities.h" @@ -53,8 +47,6 @@ #include #include -using namespace std; - static const int timeminrange = -200; static const int timemaxrange = 200; static const int timeNbin = 128; @@ -178,7 +170,7 @@ StatusCode RPCStandaloneTracksMon::initialize(){ // MuonDetectorManager from the conditions store ATH_CHECK(m_DetectorManagerKey.initialize()); - ATH_CHECK( m_muonIdHelperTool.retrieve() ); + ATH_CHECK(m_idHelperSvc.retrieve() ); m_hardware_name_list.push_back("XXX"); @@ -535,14 +527,14 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() int irpc_clus_size = ((*rpcCollection)->rdoList()).size(); double irpc_clus_time = (*rpcCollection)->time() ; - int irpc_clus_station = m_muonIdHelperTool->rpcIdHelper().stationName(prd_id) ; - int irpc_clus_eta = m_muonIdHelperTool->rpcIdHelper().stationEta(prd_id) ; - int irpc_clus_phi = m_muonIdHelperTool->rpcIdHelper().stationPhi(prd_id) ; - int irpc_clus_doublr = m_muonIdHelperTool->rpcIdHelper().doubletR(prd_id) ; - int irpc_clus_doublz = m_muonIdHelperTool->rpcIdHelper().doubletZ(prd_id) ; - int irpc_clus_doublphi = m_muonIdHelperTool->rpcIdHelper().doubletPhi(prd_id) ; - int irpc_clus_gasgap = m_muonIdHelperTool->rpcIdHelper().gasGap(prd_id) ; - int irpc_clus_measphi = m_muonIdHelperTool->rpcIdHelper().measuresPhi(prd_id) ; + int irpc_clus_station = m_idHelperSvc->rpcIdHelper().stationName(prd_id) ; + int irpc_clus_eta = m_idHelperSvc->rpcIdHelper().stationEta(prd_id) ; + int irpc_clus_phi = m_idHelperSvc->rpcIdHelper().stationPhi(prd_id) ; + int irpc_clus_doublr = m_idHelperSvc->rpcIdHelper().doubletR(prd_id) ; + int irpc_clus_doublz = m_idHelperSvc->rpcIdHelper().doubletZ(prd_id) ; + int irpc_clus_doublphi = m_idHelperSvc->rpcIdHelper().doubletPhi(prd_id) ; + int irpc_clus_gasgap = m_idHelperSvc->rpcIdHelper().gasGap(prd_id) ; + int irpc_clus_measphi = m_idHelperSvc->rpcIdHelper().measuresPhi(prd_id) ; // get the average strip and cluster position @@ -552,7 +544,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() Identifier id = ((*rpcCollection)->rdoList())[i] ; const MuonGM::RpcReadoutElement* descriptor = MuonDetMgr->getRpcReadoutElement(id); stripPosC += descriptor->stripPos(id); - int strip = int(m_muonIdHelperTool->rpcIdHelper().strip(id)) ; + int strip = int(m_idHelperSvc->rpcIdHelper().strip(id)) ; av_strip += float(strip) ; } if( irpc_clus_size != 0 ){ @@ -565,7 +557,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() //get information from geomodel to book and fill rpc histos with the right max strip number - std::vector rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prd_id, 0) ; + std::vector rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(),prd_id, 0) ; int ShiftEtaStripsTot = rpcstripshift[8] ; int EtaStripSign = rpcstripshift[10]; @@ -578,7 +570,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() m_SummaryHist_Idx = (Settore-1)*m_SummaryHist_Size/16; //get name for titles and labels - std::vector rpclayersectorsidename = RpcGM::RpcLayerSectorSideName(m_muonIdHelperTool->rpcIdHelper(),prd_id, 0) ; + std::vector rpclayersectorsidename = RpcGM::RpcLayerSectorSideName(m_idHelperSvc->rpcIdHelper(),prd_id, 0) ; std::string layer_name = rpclayersectorsidename[0] ; std::string layertodraw1_name = rpclayersectorsidename[1] ; @@ -687,14 +679,14 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() Identifier prd_idII = (*rpcCollectionII)->identify(); int irpc_clus_sizeII = ((*rpcCollectionII)->rdoList()).size(); - int irpc_clus_stationII = m_muonIdHelperTool->rpcIdHelper().stationName(prd_idII) ; - int irpc_clus_etaII = m_muonIdHelperTool->rpcIdHelper().stationEta(prd_idII) ; - int irpc_clus_phiII = m_muonIdHelperTool->rpcIdHelper().stationPhi(prd_idII) ; - int irpc_clus_doublrII = m_muonIdHelperTool->rpcIdHelper().doubletR(prd_idII) ; - int irpc_clus_doublzII = m_muonIdHelperTool->rpcIdHelper().doubletZ(prd_idII) ; - int irpc_clus_doublphiII = m_muonIdHelperTool->rpcIdHelper().doubletPhi(prd_idII) ; - int irpc_clus_gasgapII = m_muonIdHelperTool->rpcIdHelper().gasGap(prd_idII) ; - int irpc_clus_measphiII = m_muonIdHelperTool->rpcIdHelper().measuresPhi(prd_idII) ; + int irpc_clus_stationII = m_idHelperSvc->rpcIdHelper().stationName(prd_idII) ; + int irpc_clus_etaII = m_idHelperSvc->rpcIdHelper().stationEta(prd_idII) ; + int irpc_clus_phiII = m_idHelperSvc->rpcIdHelper().stationPhi(prd_idII) ; + int irpc_clus_doublrII = m_idHelperSvc->rpcIdHelper().doubletR(prd_idII) ; + int irpc_clus_doublzII = m_idHelperSvc->rpcIdHelper().doubletZ(prd_idII) ; + int irpc_clus_doublphiII = m_idHelperSvc->rpcIdHelper().doubletPhi(prd_idII) ; + int irpc_clus_gasgapII = m_idHelperSvc->rpcIdHelper().gasGap(prd_idII) ; + int irpc_clus_measphiII = m_idHelperSvc->rpcIdHelper().measuresPhi(prd_idII) ; if(irpc_clus_measphi == irpc_clus_measphiII )continue; if(irpc_clus_station != irpc_clus_stationII )continue; @@ -712,8 +704,8 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() float avstripeta = 0 ; float avstripphi = av_strip ; - ShiftEtaStripsTot = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prd_idII, 0)[8] ; // angelo 07 oct 2009 - EtaStripSign = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prd_idII, 0)[10] ; // angelo 07 oct 2009 + ShiftEtaStripsTot = RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(),prd_idII, 0)[8] ; // angelo 07 oct 2009 + EtaStripSign = RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(),prd_idII, 0)[10] ; // angelo 07 oct 2009 // get the average strip and cluster position @@ -724,7 +716,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() Identifier id = ((*rpcCollectionII)->rdoList())[i] ; const MuonGM::RpcReadoutElement* descriptor = MuonDetMgr->getRpcReadoutElement(id); stripPosCII += descriptor->stripPos(id); - avstripeta += float(m_muonIdHelperTool->rpcIdHelper().strip(id)) ; + avstripeta += float(m_idHelperSvc->rpcIdHelper().strip(id)) ; } if( irpc_clus_sizeII != 0 ){ avstripeta= avstripeta/ irpc_clus_sizeII ; @@ -817,15 +809,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() Amg::Vector3D Vector3D (irpc_clus_posx , irpc_clus_posy , irpc_clus_poszII); Rpc_Point.push_back (Vector3D ) ; Rpc_Matched_mu.push_back(foundmatch3DwithMuon ) ; - - - /* - std::cout << "Next 3D RPC cluster" << std::endl; - std::cout << N_Rpc_Clusters3D << " " << irpc_clus_phi << " " << irpc_clus_station << " " << irpc_clus_eta << std::endl; - std::cout << irpc_clus_doublr << " " << irpc_clus_doublphi << " " << irpc_clus_doublz << " " << irpc_clus_gasgap << std::endl; - std::cout << irpc_clus_posx << " " << irpc_clus_posy << " " << irpc_clus_poszII << " Ltype "<Fill( metrack->pt() / 1000.); - //std::cout <<" Track " << metrack->eta() << " " <phi() << std::endl; bool foundmatchlowpt_thr0 = false; bool foundmatchlowpt_thr1 = false; @@ -1020,30 +1003,29 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() for ( Muon::RpcCoinDataCollection::const_iterator it_collection = (*it_container)->begin(); it_collection != (*it_container)->end(); ++it_collection ) { // each collection is a trigger signal if( (*it_collection)->isLowPtCoin() == 0 && (*it_collection)->isHighPtCoin() == 0 ) continue ; prdcoll_id = (*it_collection)->identify(); - if(m_muonIdHelperTool->rpcIdHelper().measuresPhi(prdcoll_id))continue; + if(m_idHelperSvc->rpcIdHelper().measuresPhi(prdcoll_id))continue; int cointhr = (*it_collection)->threshold(); descriptor_Atl = MuonDetMgr->getRpcReadoutElement( prdcoll_id ); eta_atlas = descriptor_Atl->stripPos(prdcoll_id ).eta(); phi_atlas = descriptor_Atl->stripPos(prdcoll_id ).phi(); - //std::cout << " Trigger Hits " << eta_atlas << " "<< phi_atlas <rpcIdHelper().measuresPhi(prdcoll_id))continue; + if(m_idHelperSvc->rpcIdHelper().measuresPhi(prdcoll_id))continue; if( std::sqrt( std::fabs(eta_atlas-metrack->eta())*std::fabs(eta_atlas-metrack->eta()) + std::fabs(phi_atlas-metrack->phi())*std::fabs(phi_atlas-metrack->phi()) ) < m_MuonDeltaRMatching) { //Second coin phi view for( it_container_phi = rpc_coin_container->begin(); it_container_phi != rpc_coin_container->end(); ++it_container_phi ) { for ( Muon::RpcCoinDataCollection::const_iterator it_collection_phi = (*it_container_phi)->begin(); it_collection_phi != (*it_container_phi)->end(); ++it_collection_phi ) { // each collection is a trigger signal if( (*it_collection_phi)->isLowPtCoin() == 0 && (*it_collection_phi)->isHighPtCoin() == 0 ) continue ; ; prdcoll_id_phi = (*it_collection_phi)->identify(); - if(m_muonIdHelperTool->rpcIdHelper().measuresPhi(prdcoll_id_phi)==0)continue; + if(m_idHelperSvc->rpcIdHelper().measuresPhi(prdcoll_id_phi)==0)continue; int cointhrphi = (*it_collection)->threshold(); - if(m_muonIdHelperTool->rpcIdHelper().stationPhi (prdcoll_id) != m_muonIdHelperTool->rpcIdHelper().stationPhi (prdcoll_id_phi)) continue ; - if(m_muonIdHelperTool->rpcIdHelper().stationName(prdcoll_id) != m_muonIdHelperTool->rpcIdHelper().stationName(prdcoll_id_phi)) continue ; - if(m_muonIdHelperTool->rpcIdHelper().stationEta (prdcoll_id) != m_muonIdHelperTool->rpcIdHelper().stationEta (prdcoll_id_phi)) continue ; - if(m_muonIdHelperTool->rpcIdHelper().doubletR (prdcoll_id) != m_muonIdHelperTool->rpcIdHelper().doubletR (prdcoll_id_phi)) continue ; - if(m_muonIdHelperTool->rpcIdHelper().doubletZ (prdcoll_id) != m_muonIdHelperTool->rpcIdHelper().doubletZ (prdcoll_id_phi)) continue ; - if(m_muonIdHelperTool->rpcIdHelper().doubletPhi (prdcoll_id) != m_muonIdHelperTool->rpcIdHelper().doubletPhi (prdcoll_id_phi)) continue ; - if(m_muonIdHelperTool->rpcIdHelper().gasGap (prdcoll_id) != m_muonIdHelperTool->rpcIdHelper().gasGap (prdcoll_id_phi)) continue ; + if(m_idHelperSvc->rpcIdHelper().stationPhi (prdcoll_id) != m_idHelperSvc->rpcIdHelper().stationPhi (prdcoll_id_phi)) continue ; + if(m_idHelperSvc->rpcIdHelper().stationName(prdcoll_id) != m_idHelperSvc->rpcIdHelper().stationName(prdcoll_id_phi)) continue ; + if(m_idHelperSvc->rpcIdHelper().stationEta (prdcoll_id) != m_idHelperSvc->rpcIdHelper().stationEta (prdcoll_id_phi)) continue ; + if(m_idHelperSvc->rpcIdHelper().doubletR (prdcoll_id) != m_idHelperSvc->rpcIdHelper().doubletR (prdcoll_id_phi)) continue ; + if(m_idHelperSvc->rpcIdHelper().doubletZ (prdcoll_id) != m_idHelperSvc->rpcIdHelper().doubletZ (prdcoll_id_phi)) continue ; + if(m_idHelperSvc->rpcIdHelper().doubletPhi (prdcoll_id) != m_idHelperSvc->rpcIdHelper().doubletPhi (prdcoll_id_phi)) continue ; + if(m_idHelperSvc->rpcIdHelper().gasGap (prdcoll_id) != m_idHelperSvc->rpcIdHelper().gasGap (prdcoll_id_phi)) continue ; if( std::fabs((*it_collection)->time() - (*it_collection_phi)->time()) > 50. ) continue ; if( (*it_collection)->isLowPtCoin() != (*it_collection_phi)->isLowPtCoin() || (*it_collection)->isHighPtCoin() != (*it_collection_phi)->isHighPtCoin()) continue ; @@ -1097,7 +1079,6 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() int sign = 1 ; if(metrack->eta()<0)sign=-1; - //std::cout <eta()-etaminpad.at(i_etaphiPAD))*sign> -m_MuonDeltaRMatching ){ if( (-metrack->eta()+etamaxpad.at(i_etaphiPAD))*sign> -m_MuonDeltaRMatching ){ if( metrack->phi()-phiminpad.at(i_etaphiPAD) > -m_MuonDeltaRMatching ){ @@ -1135,8 +1116,6 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() //muctpi for (auto i_muctpi_rdo_roi_list=muctpi_rdo_roi_list.begin();i_muctpi_rdo_roi_list!=muctpi_rdo_roi_list.end();i_muctpi_rdo_roi_list++) { // each collection is a trigger signal - //std::cout << i_muctpi_rdo_roi_list->thrNumber << " Muctpi " << i_muctpi_rdo_roi_list->eta << " "<< i_muctpi_rdo_roi_list->phi <eta()-i_muctpi_rdo_roi_list->eta ; double dphi = metrack->phi()-i_muctpi_rdo_roi_list->phi ; @@ -1208,15 +1187,9 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() Amg::Vector3D ImpactVector(0,0,0) ; Amg::Vector3D bImpactIP(0,0,0) ; - //std::cout << "multi tracks begin " << std::endl ; ///multi tracks begin //Pattern recognition: link 3D cluster with at least three different layer m_type two of each Pivot and LowPt int N_Rpc_Tracks = 0 ; - /* - for (int i_3D=0;i_3D!=N_Rpc_Clusters3D;i_3D++) { - std::cout << i_3D <<" " < 3 ){ thirdlayerHPt = 1 ; - //std::cout << "third layer found with HPt" < Fill ( PointperTrack ) ; } @@ -1326,7 +1280,6 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() //rosy decrease to 1000 instead of 10000 since RPC_track is a fixed to 1000 size array if( N_Rpc_Tracks<1000 ) N_Rpc_Tracks ++ ; - //std::cout << "Add track " <Rpc_Phi_3D.at(i_3D))minphi=Rpc_Phi_3D.at(i_3D); @@ -1405,7 +1351,6 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() zyEta = (zyav*PointperTrack-zav*yav)/deltay; } else{ - //std::cout << "deltay = 0 Not accepted with cosmics!!!" << std::endl ; x0Phi = 0 ; xyPhi = 0 ; z0Eta = 0 ; @@ -1535,18 +1480,14 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() m_f_rpczxSurfaceView->Fill(zsurface,xsurface); } - //NPhiStrip = 0 ; - //NEtaStrip = 0 ; float phipitch = 0 ; float etapitch = 0 ; - //std::cout << "minphi maxphi mineta maxeta " << minphi << " " << maxphi << " " << mineta << " " << maxeta <6)continue;if(ieta<-6)continue;//remove bml7 for(int iphi = minphi; iphi != maxphi+1; iphi++ ){ for(int ir = 1; ir != 2+1; ir++ ){ for(int iz = 1; iz != 3+1; iz++ ){ @@ -1594,10 +1535,10 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() if(phipitch <10||etapitch <10) continue ; if(phipitch >50||etapitch >50) continue ; - Identifier ideta1 = m_muonIdHelperTool->rpcIdHelper().channelID(idr, iz, idp, ig, 0, 1) ; - Identifier idetaN = m_muonIdHelperTool->rpcIdHelper().channelID(idr, iz, idp, ig, 0, etastripN) ; - Identifier idphi1 = m_muonIdHelperTool->rpcIdHelper().channelID(idr, iz, idp, ig, 1, 1) ; - Identifier idphiN = m_muonIdHelperTool->rpcIdHelper().channelID(idr, iz, idp, ig, 1, phistripN) ; + Identifier ideta1 = m_idHelperSvc->rpcIdHelper().channelID(idr, iz, idp, ig, 0, 1) ; + Identifier idetaN = m_idHelperSvc->rpcIdHelper().channelID(idr, iz, idp, ig, 0, etastripN) ; + Identifier idphi1 = m_idHelperSvc->rpcIdHelper().channelID(idr, iz, idp, ig, 1, 1) ; + Identifier idphiN = m_idHelperSvc->rpcIdHelper().channelID(idr, iz, idp, ig, 1, phistripN) ; if( !(rpc->containsId(ideta1)&&rpc->containsId(idetaN)&&rpc->containsId(idphi1)&&rpc->containsId(idphiN) )){ @@ -1634,42 +1575,22 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() Amg::Vector3D Inters3DLphi1 (0.,0.,0.); Poseta1 = rpc->stripPos(ideta1) ; -// if( Poseta1 == 0 ) return StatusCode::SUCCESS; Poseta1L = ((rpc->transform(ideta1)).inverse())*Poseta1 ; -// if( Poseta1L == NULL ) return StatusCode::SUCCESS; PosetaN = rpc->stripPos(idetaN) ; -// if( PosetaN == NULL ) return StatusCode::SUCCESS; PosetaNL = ((rpc->transform(ideta1)).inverse())*PosetaN ; -// if( PosetaNL == NULL ) return StatusCode::SUCCESS; Inters3DLeta1 = ((rpc->transform(ideta1)).inverse())*Inters3DG ; -// if( Inters3DLeta1 == NULL ) return StatusCode::SUCCESS; Posphi1 = rpc->stripPos(idphi1) ; -// if( Posphi1 == NULL ) return StatusCode::SUCCESS; Posphi1L = ((rpc->transform(idphi1)).inverse())*Posphi1 ; -// if( Posphi1L == NULL ) return StatusCode::SUCCESS; PosphiN = rpc->stripPos(idphiN) ; -// if( PosphiN == NULL ) return StatusCode::SUCCESS; PosphiNL = ((rpc->transform(idphi1)).inverse())*PosphiN ; -// if( PosphiNL == NULL ) return StatusCode::SUCCESS; Inters3DLphi1 = ((rpc->transform(idphi1)).inverse())*Inters3DG ; -// if( Inters3DLphi1 == NULL ) return StatusCode::SUCCESS; - - - + float hitstripphi = (( Inters3DLphi1.x()-Posphi1L.x() + phipitch ))/phipitch; if( Posphi1L.x() > PosphiNL.x() )hitstripphi=-hitstripphi; - //hitstripphi++; float hitstripeta = (( Inters3DLeta1.x()-Poseta1L.x() + etapitch ))/etapitch; - //if(ieta<0)hitstripeta=-hitstripeta; - //hitstripeta++; if( Poseta1L.x() > PosetaNL.x() )hitstripeta=-hitstripeta; - - /* - std::cout << "Look for Crossing "<< iname << " iname " << ieta << " ieta " << iphi - << " iphi " << ir << " ir " << iz << " iz " << idp << " idp " << - ig << " ig " << hitstripphi << " hitstripphi " << hitstripeta << " hitstripeta " < float(nstripfiducial)) ) continue ; @@ -1678,7 +1599,6 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() if( !(hitstripeta < float(rpc->NetaStrips()-nstripfiducial)) ) continue ; - //std::cout << "Intersection at "<< Inters3DG.x() << " " << Inters3DG.y() << " " << Inters3DG.z() << std::endl; int foundonehiteta = 0 ; int foundonehitphi = 0 ; @@ -1702,12 +1622,12 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() irpcstrip = int(hitstripphi+1); if(irpcstrip<1||rpc->NphiStrips()rpcIdHelper().channelID(idr, iz, idp, ig, imeasphi, irpcstrip) ; + Identifier prdcoll_id = m_idHelperSvc->rpcIdHelper().channelID(idr, iz, idp, ig, imeasphi, irpcstrip) ; if( prdcoll_id == 0 )continue; //get information from geomodel to book and fill rpc histos with the right max strip number - std::vector rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0) ; + std::vector rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(),prdcoll_id, 0) ; int ShiftPhiStrips = rpcstripshift[1] ; int ShiftStrips = rpcstripshift[4] ; @@ -1722,7 +1642,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() m_SummaryHist_Idx = (Settore-1)*m_SummaryHist_Size/16; //get name for titles and labels - std::vector rpclayersectorsidename = RpcGM::RpcLayerSectorSideName(m_muonIdHelperTool->rpcIdHelper(),prdcoll_id, 0) ; + std::vector rpclayersectorsidename = RpcGM::RpcLayerSectorSideName(m_idHelperSvc->rpcIdHelper(),prdcoll_id, 0) ; std::string layer_name = rpclayersectorsidename[0] ; std::string layertodraw1_name = rpclayersectorsidename[1] ; @@ -1838,14 +1758,14 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() ATH_MSG_DEBUG ( "Adding a new cluster " ); int irpc_clus_size = ((*rpcCollection)->rdoList()).size(); - int irpc_clus_station = m_muonIdHelperTool->rpcIdHelper().stationName(prd_id) ; - int irpc_clus_eta = m_muonIdHelperTool->rpcIdHelper().stationEta(prd_id) ; - int irpc_clus_phi = m_muonIdHelperTool->rpcIdHelper().stationPhi(prd_id) ; - int irpc_clus_doublr = m_muonIdHelperTool->rpcIdHelper().doubletR(prd_id) ; - int irpc_clus_doublz = m_muonIdHelperTool->rpcIdHelper().doubletZ(prd_id) ; - int irpc_clus_doublphi = m_muonIdHelperTool->rpcIdHelper().doubletPhi(prd_id) ; - int irpc_clus_gasgap = m_muonIdHelperTool->rpcIdHelper().gasGap(prd_id) ; - int irpc_clus_measphi = m_muonIdHelperTool->rpcIdHelper().measuresPhi(prd_id) ; + int irpc_clus_station = m_idHelperSvc->rpcIdHelper().stationName(prd_id) ; + int irpc_clus_eta = m_idHelperSvc->rpcIdHelper().stationEta(prd_id) ; + int irpc_clus_phi = m_idHelperSvc->rpcIdHelper().stationPhi(prd_id) ; + int irpc_clus_doublr = m_idHelperSvc->rpcIdHelper().doubletR(prd_id) ; + int irpc_clus_doublz = m_idHelperSvc->rpcIdHelper().doubletZ(prd_id) ; + int irpc_clus_doublphi = m_idHelperSvc->rpcIdHelper().doubletPhi(prd_id) ; + int irpc_clus_gasgap = m_idHelperSvc->rpcIdHelper().gasGap(prd_id) ; + int irpc_clus_measphi = m_idHelperSvc->rpcIdHelper().measuresPhi(prd_id) ; if(irpc_clus_station != iname )continue; if(irpc_clus_eta != ieta )continue; @@ -1871,7 +1791,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() Identifier id = ((*rpcCollection)->rdoList())[i] ; const MuonGM::RpcReadoutElement* descriptor = MuonDetMgr->getRpcReadoutElement(id); stripPosC += descriptor->stripPos(id) ; - int strip = int(m_muonIdHelperTool->rpcIdHelper().strip(id)) ; + int strip = int(m_idHelperSvc->rpcIdHelper().strip(id)) ; av_strip += float(strip) ; } if( irpc_clus_size != 0 ){ @@ -1884,37 +1804,14 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() Amg::Vector3D Inters3DLCL (0,0,0) ; Vect3DCosL = ((rpc->transform(ideta1)).inverse())*Vect3DCosL ; -// if(Vect3DCosL== NULL ) return StatusCode::SUCCESS ; stripPosCL = ((rpc->transform(ideta1)).inverse())*stripPosC ; -// if(stripPosCL== NULL ) return StatusCode::SUCCESS ; Inters3DLCL = ((rpc->transform(ideta1)).inverse())*Inters3DG ; -// if(Inters3DLCL== NULL ) return StatusCode::SUCCESS ; if(imeasphi==1){ Vect3DCosL = ((rpc->transform(idphi1)).inverse())*Vect3DCosL ; -// if(Vect3DCosL== NULL ) return StatusCode::SUCCESS ; stripPosCL = ((rpc->transform(idphi1)).inverse())*stripPosC ; -// if(stripPosCL== NULL ) return StatusCode::SUCCESS ; Inters3DLCL = ((rpc->transform(idphi1)).inverse())*Inters3DG ; -// if(Inters3DLCL== NULL ) return StatusCode::SUCCESS ; } - - // std::cout <rpcIdHelper().strip(((*rpcCollection)->rdoList())[0])) << - " strip e measphi " << irpc_clus_measphi<Fill( residuals );} @@ -2149,7 +2046,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() m_rpcSectorLayerResponse->Fill(stripetaatlas, stripphisector ); float a1 = m_rpcSectorLayerResponse->GetBinContent(stripetaatlas, stripphisector ); float a2 = m_rpcSectorLayerTrackProj->GetBinContent(stripetaatlas, stripphisector ); - if(a2Fill(stripetaatlas, stripphisector ); float a1 = m_rpcSectorLayerResponseOR->GetBinContent(stripetaatlas, stripphisector ); float a2 = m_rpcSectorLayerTrackProj->GetBinContent(stripetaatlas, stripphisector ); - if(a2Fill(stripetaatlas, stripphisector ); - //float a1 = m_rpcSectorLayerResponse->GetBinContent(stripetaatlas, stripphisector ); - //float a2 = m_rpcSectorLayerTrackProj->GetBinContent(stripetaatlas, stripphisector ); - //if(a2Fill(stripetaatlas, stripphisector ); - //float a1 = m_rpcSectorLayerResponseOR->GetBinContent(stripetaatlas, stripphisector ); - //float a2 = m_rpcSectorLayerTrackProj->GetBinContent(stripetaatlas, stripphisector ); - //if(a2rdoList()).size(); - int irpc_clus_station = m_muonIdHelperTool->rpcIdHelper().stationName(prd_id) ; - int irpc_clus_eta = m_muonIdHelperTool->rpcIdHelper().stationEta(prd_id) ; - int irpc_clus_phi = m_muonIdHelperTool->rpcIdHelper().stationPhi(prd_id) ; - int irpc_clus_doublr = m_muonIdHelperTool->rpcIdHelper().doubletR(prd_id) ; - int irpc_clus_doublz = m_muonIdHelperTool->rpcIdHelper().doubletZ(prd_id) ; - int irpc_clus_doublphi = m_muonIdHelperTool->rpcIdHelper().doubletPhi(prd_id) ; - int irpc_clus_gasgap = m_muonIdHelperTool->rpcIdHelper().gasGap(prd_id) ; - int irpc_clus_measphi = m_muonIdHelperTool->rpcIdHelper().measuresPhi(prd_id) ; + int irpc_clus_station = m_idHelperSvc->rpcIdHelper().stationName(prd_id) ; + int irpc_clus_eta = m_idHelperSvc->rpcIdHelper().stationEta(prd_id) ; + int irpc_clus_phi = m_idHelperSvc->rpcIdHelper().stationPhi(prd_id) ; + int irpc_clus_doublr = m_idHelperSvc->rpcIdHelper().doubletR(prd_id) ; + int irpc_clus_doublz = m_idHelperSvc->rpcIdHelper().doubletZ(prd_id) ; + int irpc_clus_doublphi = m_idHelperSvc->rpcIdHelper().doubletPhi(prd_id) ; + int irpc_clus_gasgap = m_idHelperSvc->rpcIdHelper().gasGap(prd_id) ; + int irpc_clus_measphi = m_idHelperSvc->rpcIdHelper().measuresPhi(prd_id) ; // get the cluster position const MuonGM::RpcReadoutElement* descriptor = MuonDetMgr->getRpcReadoutElement(prd_id); @@ -2263,7 +2154,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() const Amg::Vector3D stripPosC = descriptor->stripPos(prd_id); //get information from geomodel to book and fill rpc histos with the right max strip number - std::vector rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),prd_id, 0) ; + std::vector rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(),prd_id, 0) ; int PanelIndex = rpcstripshift[13] ; int Settore = rpcstripshift[14]; @@ -2272,7 +2163,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() m_SummaryHist_Idx = (Settore-1)*m_SummaryHist_Size/16; //get name for titles and labels - std::vector rpclayersectorsidename = RpcGM::RpcLayerSectorSideName(m_muonIdHelperTool->rpcIdHelper(),prd_id, 0) ; + std::vector rpclayersectorsidename = RpcGM::RpcLayerSectorSideName(m_idHelperSvc->rpcIdHelper(),prd_id, 0) ; std::string layer_name = rpclayersectorsidename[ 0] ; std::string layertodraw1_name = rpclayersectorsidename[ 1] ; @@ -2289,7 +2180,7 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() std::string ssector_dphi_layer = rpclayersectorsidename[12] ; - irpc_clus_measphi = m_muonIdHelperTool->rpcIdHelper().measuresPhi(prd_id) ; + irpc_clus_measphi = m_idHelperSvc->rpcIdHelper().measuresPhi(prd_id) ; const MuonGM::RpcReadoutElement* rpc = MuonDetMgr->getRpcRElement_fromIdFields(irpc_clus_station, irpc_clus_eta, irpc_clus_phi, @@ -2355,14 +2246,14 @@ StatusCode RPCStandaloneTracksMon::fillHistograms() ATH_MSG_DEBUG ( "Adding a new cluster " ); - int irpc_clus_stationII = m_muonIdHelperTool->rpcIdHelper().stationName(prd_idII) ; - int irpc_clus_etaII = m_muonIdHelperTool->rpcIdHelper().stationEta(prd_idII) ; - int irpc_clus_phiII = m_muonIdHelperTool->rpcIdHelper().stationPhi(prd_idII) ; - int irpc_clus_doublrII = m_muonIdHelperTool->rpcIdHelper().doubletR(prd_idII) ; - int irpc_clus_doublzII = m_muonIdHelperTool->rpcIdHelper().doubletZ(prd_idII) ; - int irpc_clus_doublphiII = m_muonIdHelperTool->rpcIdHelper().doubletPhi(prd_idII) ; - int irpc_clus_gasgapII = m_muonIdHelperTool->rpcIdHelper().gasGap(prd_idII) ; - int irpc_clus_measphiII = m_muonIdHelperTool->rpcIdHelper().measuresPhi(prd_idII) ; + int irpc_clus_stationII = m_idHelperSvc->rpcIdHelper().stationName(prd_idII) ; + int irpc_clus_etaII = m_idHelperSvc->rpcIdHelper().stationEta(prd_idII) ; + int irpc_clus_phiII = m_idHelperSvc->rpcIdHelper().stationPhi(prd_idII) ; + int irpc_clus_doublrII = m_idHelperSvc->rpcIdHelper().doubletR(prd_idII) ; + int irpc_clus_doublzII = m_idHelperSvc->rpcIdHelper().doubletZ(prd_idII) ; + int irpc_clus_doublphiII = m_idHelperSvc->rpcIdHelper().doubletPhi(prd_idII) ; + int irpc_clus_gasgapII = m_idHelperSvc->rpcIdHelper().gasGap(prd_idII) ; + int irpc_clus_measphiII = m_idHelperSvc->rpcIdHelper().measuresPhi(prd_idII) ; if( irpc_clus_stationII != irpc_clus_station ) continue ; @@ -3412,9 +3303,7 @@ StatusCode RPCStandaloneTracksMon::bookHistogramsRecurrent( ) int panelBin = 0 ; int indexplane = 0 ; - // Identifier gapId ; Identifier panelId ; - //std::cout<<" before the loop: sector: "<< i_sec <10&&iname<53)continue; @@ -3428,12 +3317,9 @@ StatusCode RPCStandaloneTracksMon::bookHistogramsRecurrent( ) for (int igap=0; igap!=2; igap++) { // need to pay attention to BME case - not yet considered here .... const MuonGM::RpcReadoutElement* rpc = MuonDetMgr->getRpcRElement_fromIdFields(iname, (ieta-8), int(i_sec/2)+1, ir+1, idbz+1, idbphi); - //std::cout <<" iname "<rpcIdHelper().panelID(iname, ieta-8, int(i_sec/2)+1, ir+1, idbz+1, idbphi+1, igap+1, imeasphi) ; + panelId = m_idHelperSvc->rpcIdHelper().panelID(iname, ieta-8, int(i_sec/2)+1, ir+1, idbz+1, idbphi+1, igap+1, imeasphi) ; indexplane = ir ; @@ -3468,7 +3354,6 @@ StatusCode RPCStandaloneTracksMon::bookHistogramsRecurrent( ) if ( (ieta-8) <0 ) panelBin = - panelBin; SummaryPanelID->Fill(panelBin, panelId.get_identifier32().get_compact() ); - //std::cout <<" panelBin "<< panelBin << " " <GetEntries()<< std::endl; } } @@ -3478,7 +3363,6 @@ StatusCode RPCStandaloneTracksMon::bookHistogramsRecurrent( ) } } } - //std::cout<<" after the loop"<GetEntries(); - //std::cout << " TOTPanelsSummary " << TOTPanelsSummary << std::endl; } m_SummaryHist_Size = m_SummaryHist.size() ; @@ -4596,7 +4479,7 @@ void RPCStandaloneTracksMon::bookRPCLayerRadiographyHistograms( int isec, std::s int NetaStripsTotSideC = 0; if(rpc != NULL ){ Identifier idr = rpc->identify(); - std::vector rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(),idr, 0) ; + std::vector rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(),idr, 0) ; NphiStrips = rpcstripshift[0] ; NetaStripsTotSideA = rpcstripshift[6] ; NetaStripsTotSideC = rpcstripshift[7] ; @@ -4798,10 +4681,10 @@ void RPCStandaloneTracksMon::bookRPCCoolHistograms_NotNorm( std::vectoridentify(); - std::vector rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), idr, 0) ; + std::vector rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(), idr, 0) ; NTotStripsSideA = rpcstripshift[6]+rpcstripshift[17]; Identifier idr_c = rpc_c->identify(); - std::vector rpcstripshift_c = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), idr_c, 0) ; + std::vector rpcstripshift_c = RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(), idr_c, 0) ; NTotStripsSideC = rpcstripshift_c[7]+rpcstripshift_c[18]; } @@ -4912,10 +4795,10 @@ void RPCStandaloneTracksMon::bookRPCCoolHistograms( std::vector::co if(rpc != NULL ){ Identifier idr = rpc->identify(); - std::vector rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), idr, 0) ; + std::vector rpcstripshift = RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(), idr, 0) ; NTotStripsSideA = rpcstripshift[6]+rpcstripshift[17]; Identifier idr_c = rpc_c->identify(); - std::vector rpcstripshift_c = RpcGM::RpcStripShift(MuonDetMgr,m_muonIdHelperTool->rpcIdHelper(), idr_c, 0) ; + std::vector rpcstripshift_c = RpcGM::RpcStripShift(MuonDetMgr,m_idHelperSvc->rpcIdHelper(), idr_c, 0) ; NTotStripsSideC = rpcstripshift_c[7]+rpcstripshift_c[18]; } @@ -5241,7 +5124,7 @@ StatusCode RPCStandaloneTracksMon::procHistograms( ) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * std::ofstream myfile; if(m_rpcfile){ - myfile.open ("rpccosmic.txt",ios::out); + myfile.open ("rpccosmic.txt",std::ios::out); myfile << "-------- Counts per Chamber Statistics--------\n";} //only if m_rpcfile==true diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonGenericTracksMon.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonGenericTracksMon.h index 230a4dabb086031ed7d4ee06a7e2fc8eb85767db..3611eade8ad6ec3cf699f32ab7e348e401bf33f2 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonGenericTracksMon.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/MuonGenericTracksMon.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 */ #ifndef MUONTRKPHYSMONITORING_MUONGENERICTRACKSMON_H @@ -24,7 +24,6 @@ #include "MuonHistUtils/MuonEnumDefs.h" #include "TrigConfL1Data/TriggerItem.h" -//#include "TrigDecisionInterface/ITrigDecisionTool.h" #include "TrkTrack/Track.h" #include "TrkTrack/TrackCollection.h" @@ -38,7 +37,6 @@ #include "EventPrimitives/EventPrimitivesHelpers.h" #include "FourMomUtils/P4Helpers.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" #include "MuonSelectorTools/IMuonSelectionTool.h" #include "MuonResonanceTools/IMuonResonanceSelectionTool.h" @@ -66,13 +64,12 @@ class MuonGenericTracksMon : public ManagedMonitorToolBase public: MuonGenericTracksMon( const std::string & type, const std::string & name, const IInterface* parent ); - virtual ~MuonGenericTracksMon(){;} + virtual ~MuonGenericTracksMon()=default; - StatusCode initialize(); + virtual StatusCode initialize(); virtual StatusCode bookHistograms(); virtual StatusCode fillHistograms(); virtual StatusCode procHistograms(); - StatusCode finalize(); //second argument is the souce type void plot_lumi( std::vector > resonances_Z, @@ -106,19 +103,11 @@ class MuonGenericTracksMon : public ManagedMonitorToolBase std::vector m_oRecoMuonMETrackPlots; std::vector m_oRecoMuonIDTrackPlots; std::vector m_oRecoMuonPlots; - //std::vector m_oRecoMuonForwPlots; - //std::vector m_oRecoMuonCaloPlots; std::vector m_oRecoPhysPlots; std::vector m_oRecoVertexPlots; - - protected: - - // - private: - StoreGateSvc* m_storeGate; std::string m_muonsName; std::string m_muonSegmentsName; std::string m_muonTracksName; @@ -144,10 +133,6 @@ class MuonGenericTracksMon : public ManagedMonitorToolBase // ATLAS Detector Description // Handle for the trig decision tool ToolHandle m_trigDecTool; - // ToolHandle idHelper - //ToolHandle m_pullCalculator; // m_edmHelperSvc; - //ToolHandle m_idHelperTool; // MCP muon quality tool ToolHandle m_muonSelectionTool; // MCP T&P helpers diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonSegmentPlots.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonSegmentPlots.h index bb504298bbeaf5a6cce7ff13e4342a5f51ebbaef..ee6bdc504927388256310458d3fc0dfa9a4cb9ed 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonSegmentPlots.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonSegmentPlots.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONTRACKMONITORING_RECOMUONSEGMENTPLOTS_H @@ -14,8 +14,6 @@ #include "xAODMuon/MuonSegment.h" #include "xAODMuon/MuonSegmentContainer.h" #include "xAODTracking/TrackParticleContainer.h" -//#include "AthenaMonitoring/ManagedMonitorToolBase.h" - namespace Muon { class IMuonSegmentTrackBuilder; diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonTrackPlots.h b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonTrackPlots.h index fbec73ab8be86575ac34c18e4919f5347ec65f12..6aae71f53c97f1bb6d6e0ec807dfd9fa8ae53ac6 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonTrackPlots.h +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/MuonTrackMonitoring/RecoMuonTrackPlots.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 */ #ifndef MUONTRACKMONITORING_RECOMUONTRACKPLOTS_H @@ -9,7 +9,6 @@ #include "xAODMuon/MuonContainer.h" #include "xAODTracking/TrackParticle.h" #include "TrkEventPrimitives/ResidualPull.h" -#include "MuonIdHelpers/MuonStationIndex.h" #include "TrkValHistUtils/PlotBase.h" #include "TrkValHistUtils/ParamPlots.h" @@ -21,42 +20,24 @@ #include "TrkTrack/TrackStateOnSurface.h" #include "TrkTrack/TrackCollection.h" #include "TrkParameters/TrackParameters.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "TrkToolInterfaces/IResidualPullCalculator.h" class RecoMuonTrackPlots:public PlotBase { public: RecoMuonTrackPlots(PlotBase* pParent, std::string sDir); - + // Reco only information Trk::ParamPlots m_oAllPlots; Trk::ImpactPlots m_oImpactPlots; Trk::RecoInfoPlots m_oTrkRecoInfoPlots; - //Trk::MSHitPlots m_oMSHitPlots; - // Muon::MuonHitResidualPlots m_oResidualPlots_Global; - // Muon::MuonHitResidualPlots m_oResidualPlots_MDT; - // Muon::MuonHitResidualPlots m_oResidualPlots_RPC_eta; - // Muon::MuonHitResidualPlots m_oResidualPlots_RPC_phi; - // Muon::MuonHitResidualPlots m_oResidualPlots_TGC_wire; - // Muon::MuonHitResidualPlots m_oResidualPlots_TGC_strip; - // Muon::MuonHitResidualPlots m_oResidualPlots_CSC_eta; - // Muon::MuonHitResidualPlots m_oResidualPlots_CSC_phi; - TH1* m_pt_broad; TH2* m_eta_phi_broad; - //ToolHandle m_pullCalculator; - //ToolHandle m_idHelperTool; - //ServiceHandle m_edmHelperSvc; - //fill methods void fill(const xAOD::Muon& mu, int component); void fill(const xAOD::TrackParticle& muTP); void fill(const xAOD::TrackParticle& muTP, int LB_number, float LB_instant); - //void fill(const Trk::ResidualPull& resPull, int stationPhi, Muon::MuonStationIndex::TechnologyIndex techid, bool measuresPhi); private: void initializePlots(); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonGenericTracksMon.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonGenericTracksMon.cxx index 1eaa96f3a031df379220c654e10fd4d7b46cfded..8a7b336bf96863554d1da0f09fdd63e0087f32e9 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonGenericTracksMon.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/MuonGenericTracksMon.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 */ // ================================================================================ @@ -14,7 +14,6 @@ // ============================================================================== #include "MuonTrackMonitoring/MuonGenericTracksMon.h" -#include "MuonIdHelpers/MuonStationIndex.h" #include "xAODEventInfo/EventInfo.h" #include "TrkMultiComponentStateOnSurface/MultiComponentStateOnSurface.h" #include "TrkMultiComponentStateOnSurface/MultiComponentState.h" @@ -43,11 +42,8 @@ MuonGenericTracksMon::MuonGenericTracksMon( const std::string & type, const std: m_oRecoMuonMETrackPlots(0), m_oRecoMuonIDTrackPlots(0), m_oRecoMuonPlots(0), - //m_oRecoMuonForwPlots(0), - //m_oRecoMuonCaloPlots(0), m_oRecoPhysPlots(0), m_oRecoVertexPlots(0), - m_storeGate(0), m_useTrigger(true), m_muonSelectionTool("CP::MuonSelectionTool/MuonSelectionTool"), m_ZmumuResonanceSelectionTool("MuonResonanceSelectionTool/ZmumuResonanceSelectionTool"), @@ -57,8 +53,6 @@ MuonGenericTracksMon::MuonGenericTracksMon( const std::string & type, const std: m_isMC(false) { - //m_pullCalculator = ToolHandle("Trk::ResidualPullCalculator/ResidualPullCalculator"); - declareProperty("UseTriggerVector", m_useTrigger); declareProperty("MuonTriggerChainName", m_MuonTriggerChainName); declareProperty("Muon_Trigger_Items", m_muon_triggers); @@ -74,17 +68,12 @@ MuonGenericTracksMon::MuonGenericTracksMon( const std::string & type, const std: declareProperty("MSVertexCollection", m_msVertexCollection = "MSDisplacedVertex"); } -//======================================================================================// -StatusCode MuonGenericTracksMon::initialize() -//======================================================================================// -{ - StatusCode sc = ManagedMonitorToolBase::initialize(); - if(!sc.isSuccess()) return sc; - sc = setupTools(); - return sc; +StatusCode MuonGenericTracksMon::initialize() { + ATH_CHECK(ManagedMonitorToolBase::initialize()); + ATH_CHECK(setupTools()); + return StatusCode::SUCCESS; } - //======================================================================================// StatusCode MuonGenericTracksMon::bookHistograms() //======================================================================================// @@ -251,7 +240,6 @@ StatusCode MuonGenericTracksMon::bookInMongroup(TH1* hist, MonGroup& mongroup) { ATH_MSG_DEBUG ("Initializing " << hist << " " << hist->GetName() << "..."); return (mongroup.regHist(hist)); - //return bookInMongroup( HistData(hist,hist->GetName()), mongroup); } StatusCode MuonGenericTracksMon::bookInMongroup(HistData& hist, MonGroup& mongroup, std::string source) @@ -349,11 +337,8 @@ StatusCode MuonGenericTracksMon::fillHistograms() { ATH_MSG_DEBUG("In fillHistograms()"); - const xAOD::EventInfo* eventInfo; - if (evtStore()->retrieve(eventInfo).isFailure()){ - ATH_MSG_ERROR ("Cannot access to event info"); - return StatusCode::SUCCESS; - } + const xAOD::EventInfo* eventInfo=nullptr; + ATH_CHECK(evtStore()->retrieve(eventInfo)); if(!(m_environment == AthenaMonManager::tier0 || m_environment == AthenaMonManager::tier0ESD || @@ -384,12 +369,15 @@ StatusCode MuonGenericTracksMon::fillHistograms() } // retrieve containers - const xAOD::MuonSegmentContainer* MuonSegments = evtStore()->retrieve< const xAOD::MuonSegmentContainer >(m_muonSegmentsName); - const xAOD::TrackParticleContainer* tracksMS = evtStore()->retrieve< const xAOD::TrackParticleContainer >(m_muonTracksName); - const xAOD::MuonContainer* Muons = evtStore()->retrieve< const xAOD::MuonContainer >(m_muonsName); - const xAOD::VertexContainer* MSVertices = evtStore()->retrieve< const xAOD::VertexContainer >(m_msVertexCollection); - //const xAOD::TrackParticleContainer* METracks = evtStore()->retrieve< const xAOD::TrackParticleContainer >( m_muonExtrapTracksName ); - //const xAOD::TrackParticleContainer* IDTracks = evtStore()->retrieve< const xAOD::TrackParticleContainer >( m_innerTracksName ); + const xAOD::MuonSegmentContainer* MuonSegments=nullptr; + ATH_CHECK(evtStore()->retrieve(MuonSegments, m_muonSegmentsName)); + const xAOD::TrackParticleContainer* tracksMS=nullptr; + ATH_CHECK(evtStore()->retrieve(tracksMS, m_muonTracksName)); + const xAOD::MuonContainer* Muons=nullptr; + ATH_CHECK(evtStore()->retrieve(Muons, m_muonsName)); + const xAOD::VertexContainer* MSVertices=nullptr; + ATH_CHECK(evtStore()->retrieve(MSVertices, m_msVertexCollection)); + // check validity if (!MuonSegments){ ATH_MSG_WARNING ("Couldn't retrieve MuonSegments container: " << m_muonSegmentsName); @@ -407,15 +395,6 @@ StatusCode MuonGenericTracksMon::fillHistograms() ATH_MSG_WARNING ("Couldn't retrieve MS vertex container: " << m_msVertexCollection); return StatusCode::SUCCESS; } - // if (!METracks) { - // ATH_MSG_WARNING ("Couldn't retrieve muon track container: " << m_muonExtrapTracksName); - // return StatusCode::RECOVERABLE; - // } - // if (!IDTracks) { - // ATH_MSG_WARNING ("Couldn't retrieve muon track container: " << m_innerTracksName); - // return StatusCode::RECOVERABLE; - // } - // ATH_MSG_WARNING ("MS container size: " << tracksMS->size() << " ME container size: " << METracks->size()); // fill the histograms if (m_MuonTriggerChainName != ""){ @@ -623,7 +602,6 @@ StatusCode MuonGenericTracksMon::procHistograms() if(endOfRunFlag()) { //finish the post processing - //for (auto plots : m_oRecoPhysPlots) plots->finalizeRecoPlots(); //remove all the pointers for (auto plots : m_oRecoLumiPlots) delete plots; @@ -632,8 +610,6 @@ StatusCode MuonGenericTracksMon::procHistograms() for (auto plots : m_oRecoMuonMETrackPlots) delete plots; for (auto plots : m_oRecoMuonIDTrackPlots) delete plots; for (auto plots : m_oRecoMuonPlots) delete plots; - //for (auto plots : m_oRecoMuonForwPlots) delete plots; - //for (auto plots : m_oRecoMuonCaloPlots) delete plots; for (auto plots : m_oRecoPhysPlots) delete plots; for (auto plots : m_oRecoVertexPlots) delete plots; @@ -642,82 +618,24 @@ StatusCode MuonGenericTracksMon::procHistograms() return StatusCode::SUCCESS; } - -//======================================================================================// -StatusCode MuonGenericTracksMon::finalize() -//======================================================================================// -{ - - StatusCode sc = ManagedMonitorToolBase::finalize(); - if(!sc.isSuccess()) return sc; - - return StatusCode::SUCCESS; -} - - //======================================================================================// StatusCode MuonGenericTracksMon::setupTools() //======================================================================================// { - StatusCode sc = StatusCode::SUCCESS; - sc = service("StoreGateSvc", m_storeGate); - - if (sc.isFailure()){ - ATH_MSG_FATAL( "Unable to retrieve the StoreGate service... Exiting!" ); - return sc; - } - ATH_MSG_DEBUG( "Defined detector service" ); - - - // sc = m_pullCalculator.retrieve(); - // if (sc.isFailure()) { - // ATH_MSG_ERROR( "Can't retrieve " << m_pullCalculator ); - // return sc; - // } - // ATH_MSG_DEBUG( " Found the " << m_pullCalculator ); - - // sc = m_edmHelperSvc.retrieve(); - // if (!sc.isSuccess()){ - // ATH_MSG_FATAL( "Could not get " << m_edmHelperSvc ); - // return sc; - // } - // ATH_MSG_DEBUG( "Retrieved " << m_edmHelperSvc ); - - sc = m_ZmumuResonanceSelectionTool.retrieve(); - if (!sc.isSuccess()){ - ATH_MSG_FATAL( "Could not get " << m_ZmumuResonanceSelectionTool ); - return sc; - } + ATH_CHECK(m_ZmumuResonanceSelectionTool.retrieve()); ATH_MSG_DEBUG( "Retrieved " << m_ZmumuResonanceSelectionTool ); - sc = m_ZmumuResonancePairingTool.retrieve(); - if (!sc.isSuccess()){ - ATH_MSG_FATAL( "Could not get " << m_ZmumuResonancePairingTool ); - return sc; - } + ATH_CHECK(m_ZmumuResonancePairingTool.retrieve()); ATH_MSG_DEBUG( "Retrieved " << m_ZmumuResonancePairingTool ); - sc = m_JpsimumuResonanceSelectionTool.retrieve(); - if (!sc.isSuccess()){ - ATH_MSG_FATAL( "Could not get " << m_JpsimumuResonanceSelectionTool ); - return sc; - } + ATH_CHECK(m_JpsimumuResonanceSelectionTool.retrieve()); ATH_MSG_DEBUG( "Retrieved " << m_JpsimumuResonanceSelectionTool ); - sc = m_JpsimumuResonancePairingTool.retrieve(); - if (!sc.isSuccess()){ - ATH_MSG_FATAL( "Could not get " << m_JpsimumuResonancePairingTool ); - return sc; - } + ATH_CHECK(m_JpsimumuResonancePairingTool.retrieve()); ATH_MSG_DEBUG( "Retrieved " << m_JpsimumuResonancePairingTool ); - sc = m_muonSelectionTool.retrieve(); - if (!sc.isSuccess()){ - ATH_MSG_FATAL( "Could not get " << m_muonSelectionTool ); - return sc; - } + ATH_CHECK(m_muonSelectionTool.retrieve()); ATH_MSG_DEBUG( "Retrieved " << m_muonSelectionTool ); - return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonSegmentPlots.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonSegmentPlots.cxx index bf315a81248d6f786d9b383404e086c3c5b0e5b8..61a837b7ffcbf99f6dd68c38cc5acf3a6b466325 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonSegmentPlots.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonSegmentPlots.cxx @@ -1,10 +1,8 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonTrackMonitoring/RecoMuonSegmentPlots.h" -#include "MuonIdHelpers/MuonStationIndex.h" - RecoMuonSegmentPlots::RecoMuonSegmentPlots(PlotBase* pParent, std::string sDir, bool detail):PlotBase(pParent, sDir) , m_oMuonSegmentPlots(NULL) diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonTrackPlots.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonTrackPlots.cxx index 2e8854c4984c4ba25024be4d366d2a7067a9c3ef..eff83b9efd7771aee0babdfefae9cf27fb418c97 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonTrackPlots.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonTrackMonitoring/src/RecoMuonTrackPlots.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 "MuonTrackMonitoring/RecoMuonTrackPlots.h" @@ -8,18 +8,8 @@ RecoMuonTrackPlots::RecoMuonTrackPlots(PlotBase* pParent, std::string sDir):Plot m_oAllPlots(this, "/", "Reco Muon"), m_oImpactPlots(this, "/"), m_oTrkRecoInfoPlots(this, "/"), -// m_oMSHitPlots(this,"/"), -// m_oResidualPlots_Global(this, "/Global/", ""), -// m_oResidualPlots_MDT(this, "/MDT/", ""), -// m_oResidualPlots_RPC_eta(this, "/RPC/", "eta"), -// m_oResidualPlots_RPC_phi(this, "/RPC/", "phi"), -// m_oResidualPlots_TGC_wire(this, "/TGC/", "wire"), -// m_oResidualPlots_TGC_strip(this, "/TGC/", "strip"), -// m_oResidualPlots_CSC_eta(this, "/CSC/", "eta"), -// m_oResidualPlots_CSC_phi(this, "/CSC/", "phi"), m_pt_broad(NULL), m_eta_phi_broad(NULL) -//m_pullCalculator("Trk::ResidualPullCalculator/ResidualPullCalculator") {} void RecoMuonTrackPlots::initializePlots(){ @@ -38,7 +28,6 @@ void RecoMuonTrackPlots::fill(const xAOD::Muon& mu, int component){ if (component == 0 ) { ElementLink Mu_MStrack = mu.muonSpectrometerTrackParticleLink(); if(Mu_MStrack.isValid()){ - //std::cout<<"Plot base test MS track"< Mu_metrack = mu.trackParticleLink(xAOD::Muon::TrackParticleType::ExtrapolatedMuonSpectrometerTrackParticle); - //ElementLink Mu_metrack = mu.extrapolatedMuonSpectrometerTrackParticleLink(); if(Mu_metrack.isValid()){ - //std::cout<<"Plot base test ME track"< 100) {//ony for high pt muons m_pt_broad->Fill(muTP.pt()/1000.0); m_eta_phi_broad->Fill(muTP.eta(), muTP.phi()); } - // const Trk::Track* track = muTP.track(); //@@@ NUMEROUS FPE WARNINGS!!! - // if (!track) return; - - // const DataVector< const Trk::TrackStateOnSurface>* trackSoS=track->trackStateOnSurfaces(); - // if (!trackSoS) return; - - // for (const auto stateOnSurface: *trackSoS) { - - // if (!stateOnSurface) continue; - - // if (stateOnSurface->type(Trk::TrackStateOnSurface::Outlier)) continue; - - // const Trk::MeasurementBase* meas = stateOnSurface->measurementOnTrack(); - // if (!meas) continue; - - // Identifier id = m_edmHelperSvc->getIdentifier(*meas); - // if (!id.is_valid()) continue; - - // const Trk::TrackParameters* trackParameters = stateOnSurface->trackParameters(); - // if (!trackParameters) continue; - - // const Trk::ResidualPull* resPull = m_pullCalculator->residualPull(meas, trackParameters, Trk::ResidualPull::Unbiased); - // if (!resPull) continue; - - // const Muon::MuonStationIndex::TechnologyIndex techid = m_idHelperTool->technologyIndex(id); - // const int stationPhi = m_idHelperTool->sector(id); //1-16, odd=large, even=small - // const bool measuresPhi = m_idHelperTool->measuresPhi(id); - - // m_oResidualPlots_Global.fill(*resPull,stationPhi); - - // if (techid==Muon::MuonStationIndex::MDT) { - // m_oResidualPlots_MDT.fill(*resPull,stationPhi); - // } - // else if (techid==Muon::MuonStationIndex::RPC){ - // if (measuresPhi) - // m_oResidualPlots_RPC_phi.fill(*resPull,stationPhi); - // else - // m_oResidualPlots_RPC_eta.fill(*resPull,stationPhi); - // } - // else if (techid==Muon::MuonStationIndex::TGC){ - // if (measuresPhi) - // m_oResidualPlots_TGC_strip.fill(*resPull,stationPhi); - // else - // m_oResidualPlots_TGC_wire.fill(*resPull,stationPhi); - // } - // else if (techid==Muon::MuonStationIndex::CSCI){ //it's CSCI, not CSC!!! - // if (measuresPhi) - // m_oResidualPlots_CSC_phi.fill(*resPull,stationPhi); - // else - // m_oResidualPlots_CSC_eta.fill(*resPull,stationPhi); - // } - // delete resPull; - // } } diff --git a/MuonSpectrometer/MuonValidation/MuonHistogramming/MuonHistUtils/Root/MuonSegmentTruthRelatedPlots.cxx b/MuonSpectrometer/MuonValidation/MuonHistogramming/MuonHistUtils/Root/MuonSegmentTruthRelatedPlots.cxx index 64faef17337489ae47ab56211e725321c2bb2524..423e808d4c73fdd039f5580cdcc56cb02c3f6bb2 100644 --- a/MuonSpectrometer/MuonValidation/MuonHistogramming/MuonHistUtils/Root/MuonSegmentTruthRelatedPlots.cxx +++ b/MuonSpectrometer/MuonValidation/MuonHistogramming/MuonHistUtils/Root/MuonSegmentTruthRelatedPlots.cxx @@ -1,10 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonHistUtils/MuonSegmentTruthRelatedPlots.h" #include "xAODTracking/TrackingPrimitives.h" -#include "MuonIdHelpers/MuonStationIndex.h" #include "GeoPrimitives/GeoPrimitives.h" namespace Muon{ diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackPerformanceAlg.h b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackPerformanceAlg.h index 423518ac754f66c99343bf9026dcd3a361c30064..51f23844aa43b4181bd6e1bd2e6881aacdc01b4d 100644 --- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackPerformanceAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/MuonTrackPerformance/MuonTrackPerformanceAlg.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 */ #ifndef MUONTRACKPERFORMANCEALG_H @@ -19,8 +19,6 @@ #include "TrkParameters/TrackParameters.h" #include "TrkTruthData/TruthTrajectory.h" -#include "MuonIdHelpers/MuonStationIndex.h" - #include "MuonSimData/MuonSimDataCollection.h" #include "MuonSimData/CscSimDataCollection.h" #include "TrackRecord/TrackRecordCollection.h" @@ -28,6 +26,9 @@ #include "StoreGate/ReadHandleKey.h" #include "GeneratorObjects/McEventCollection.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "TrkToolInterfaces/ITrackSummaryHelperTool.h" #include #include @@ -35,7 +36,6 @@ #include #include -class MsgStream; class TFile; class TruthTrajectory; @@ -46,12 +46,9 @@ namespace HepMC{ namespace Trk { class Track; class TrackSummary; - class ITrackSummaryHelperTool; } namespace Muon { - class MuonIdHelperTool; - class MuonEDMPrinterTool; class MuonSegmentCombination; class MuonSegment; } @@ -299,7 +296,7 @@ private: bool m_writeToFile; bool m_doStau; - ToolHandle m_idHelperTool; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle m_printer; ServiceHandle m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonSegmentPerformanceAlg.cxx b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonSegmentPerformanceAlg.cxx index 56dbff20a481a57c7db6a6de12dfb4ef5cd97c2c..5c646574c2968e56974b41e9daa75c49f51841fc 100644 --- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonSegmentPerformanceAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonSegmentPerformanceAlg.cxx @@ -1,22 +1,19 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/*************************************************************************** -MuonSegmentPerformanceAlg -***************************************************************************/ - #include "MuonSegmentPerformanceAlg.h" #include "xAODMuon/MuonSegmentContainer.h" #include "xAODMuon/MuonSegment.h" +#include "MuonIdHelpers/MuonStationIndex.h" + MuonSegmentPerformanceAlg::MuonSegmentPerformanceAlg(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_writeToFile (false), m_segmentKey("MuonSegments"), m_truthSegmentKey( "MuonTruthSegments"), - m_nevents(0), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool") + m_nevents(0) { declareProperty("SegmentLocation", m_segmentKey); declareProperty("TruthSegmentLocation", m_truthSegmentKey); @@ -27,7 +24,6 @@ MuonSegmentPerformanceAlg::MuonSegmentPerformanceAlg(const std::string& name, IS StatusCode MuonSegmentPerformanceAlg::initialize() { - ATH_CHECK(m_idHelper.retrieve()); // initialize cuts, please make sure the number of bins and the sizes of the cuts + string are always the same unsigned int nbins = 3; @@ -67,11 +63,6 @@ StatusCode MuonSegmentPerformanceAlg::execute() ATH_MSG_WARNING("bad index " << chIndex ); continue; } - //if( seg->pt() < 5000. || fabs(seg->eta()) > 2.5 ) continue; - //const int& theType = seg->auxdata("truthType"); - //const int& theOrigin = seg->auxdata("truthOrigin"); - //if( theType != 6 && theType != 7 ) continue; - //if( theOrigin == 0 || theOrigin > 17 ) continue; unsigned int index = 0; if( seg->nPrecisionHits() < 3 ) continue; while( seg->nPrecisionHits() > m_nhitCuts[index] && index < m_nhitCuts.size()-1 ) ++index; @@ -82,7 +73,6 @@ StatusCode MuonSegmentPerformanceAlg::execute() if(Muon::MuonStationIndex::chName(static_cast(chIndex))=="CSS") ATH_MSG_WARNING(" CSS with more than 4 layers "); if(Muon::MuonStationIndex::chName(static_cast(chIndex))=="CSL") ATH_MSG_WARNING(" CSL with more than 4 layers "); } - // if( seg->isAvailable< ElementLink< xAOD::MuonSegmentContainer > >("recoSegment") ){ const ElementLink< xAOD::MuonSegmentContainer >& recoLink = seg->auxdata< ElementLink< xAOD::MuonSegmentContainer > >("recoSegmentLink"); if( recoLink.isValid() ) { ++m_nfound[index][chIndex]; @@ -93,16 +83,11 @@ StatusCode MuonSegmentPerformanceAlg::execute() << " nprec " << seg->nPrecisionHits() << " nphi " << seg->nPhiLayers() << " nTrigEta " << seg->nTrigEtaLayers() ); missedSegment = true; } - //} } if(missedSegment) ATH_MSG_DEBUG(" Dump Fake segments " ); for( const auto& seg : *segments ){ if( matchedSegments.count(seg) ) continue; - // if( seg->isAvailable< ElementLink< xAOD::MuonSegmentContainer > >("truthSegment") ){ - // const ElementLink< xAOD::MuonSegmentContainer >& truthLink = seg->auxdata< ElementLink< xAOD::MuonSegmentContainer > >("truthSegmentLink"); - // if( truthLink.isValid() ) continue; - // } int chIndex = seg->chamberIndex(); if( chIndex < 0 || chIndex >= Muon::MuonStationIndex::ChIndexMax ){ ATH_MSG_WARNING("bad index " << chIndex ); diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonSegmentPerformanceAlg.h b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonSegmentPerformanceAlg.h index ad7ef4df26382e43e9824703e76695c33137dfd1..4be9ca01a7994acd6424afebad47410417d8f690 100644 --- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonSegmentPerformanceAlg.h +++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonSegmentPerformanceAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONSEGMENTPERFORMANCEALG_H @@ -11,8 +11,6 @@ #include #include #include "xAODMuon/MuonSegmentContainer.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonIdHelpers/MuonStationIndex.h" class MuonSegmentPerformanceAlg : public AthAlgorithm { public: @@ -51,8 +49,6 @@ class MuonSegmentPerformanceAlg : public AthAlgorithm { std::vector< std::vector > m_nfound; std::vector< std::vector > m_nfake; - ToolHandle m_idHelper; - }; #endif // MUONPERFORMANCEALG diff --git a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackPerformanceAlg.cxx b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackPerformanceAlg.cxx index 53867c3c62a68d9c9b113e15b916bb61d05cce1f..104c98cd8a92b7e7190e44cbfc6f5d874f27a0e8 100644 --- a/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackPerformanceAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonRecValidation/MuonTrackPerformance/src/MuonTrackPerformanceAlg.cxx @@ -1,19 +1,14 @@ /* - 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 "MuonTrackPerformance/MuonTrackPerformanceAlg.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" - #include "MuonSegment/MuonSegmentCombination.h" #include "MuonSegment/MuonSegment.h" #include "HepMC/GenParticle.h" #include "HepMC/GenVertex.h" -#include "TrkToolInterfaces/ITrackSummaryHelperTool.h" #include #include #include @@ -25,7 +20,6 @@ MuonTrackPerformanceAlg::MuonTrackPerformanceAlg(const std::string& name, ISvcLocator* pSvcLocator): AthAlgorithm(name,pSvcLocator), m_eventInfo(0), - m_idHelperTool("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), m_truthTool("Muon::MuonTrackTruthTool/MuonTrackTruthTool"), m_summaryHelperTool("Muon::MuonTrackSummaryHelperTool/MuonTrackSummaryHelperTool"), @@ -98,7 +92,7 @@ StatusCode MuonTrackPerformanceAlg::initialize() m_debug = m_log->level() <= MSG::DEBUG; m_verbose = m_log->level() <= MSG::VERBOSE; - ATH_CHECK(m_idHelperTool.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_printer.retrieve()); ATH_CHECK(m_edmHelperSvc.retrieve()); @@ -124,9 +118,9 @@ StatusCode MuonTrackPerformanceAlg::initialize() ATH_CHECK(m_eventInfoKey.initialize()); ATH_CHECK(m_mcEventColl.initialize(m_doTruth)); - if(!(m_idHelperTool->hasSTgc() && m_idHelperTool->hasMM())) m_muonSimData={"MDT_SDO", "RPC_SDO", "TGC_SDO"}; + if(!(m_idHelperSvc->hasSTgc() && m_idHelperSvc->hasMM())) m_muonSimData={"MDT_SDO", "RPC_SDO", "TGC_SDO"}; if(m_doTruth) ATH_CHECK(m_muonSimData.initialize()); - ATH_CHECK(m_cscSimData.initialize(m_doTruth && m_idHelperTool->hasCSC())); + ATH_CHECK(m_cscSimData.initialize(m_doTruth && m_idHelperSvc->hasCSC())); ATH_CHECK(m_trackRecord.initialize(m_doTruth)); return StatusCode::SUCCESS; @@ -161,17 +155,17 @@ bool MuonTrackPerformanceAlg::handleSegmentTruth( const std::vector 0 ){ if( m_debug ) *m_log << MSG::DEBUG << "Missing mdt chamber " << endmsg; } - if(m_idHelperTool->hasCSC()){ + if(m_idHelperSvc->hasCSC()){ if( trackTruth.cscs.missedChambers.size() > 0 ){ if( m_debug ) *m_log << MSG::DEBUG << "Missing csc chamber " << endmsg; } } - if(m_idHelperTool->hasSTgc()){ + if(m_idHelperSvc->hasSTgc()){ if( trackTruth.stgcs.missedChambers.size() > 0 ){ if( m_debug ) *m_log << MSG::DEBUG << "Missing stgc chamber " << endmsg; } } - if(m_idHelperTool->hasMM()){ + if(m_idHelperSvc->hasMM()){ if( trackTruth.mms.missedChambers.size() > 0 ){ if( m_debug ) *m_log << MSG::DEBUG << "Missing mm chamber " << endmsg; } @@ -311,8 +305,8 @@ bool MuonTrackPerformanceAlg::goodTruthTrack( const Muon::IMuonTrackTruthTool::T if( !selectPdg(trackRecord->GetPDGCode()) ) return false; if( m_isCombined && fabs(trackRecord->GetMomentum().eta()) > 2.5 ) return false; int hits = entry.mdtHits.size(); - if(m_idHelperTool->hasCSC()) hits += entry.cscHits.size(); - if(m_idHelperTool->hasMM()) hits += entry.mmHits.size(); + if(m_idHelperSvc->hasCSC()) hits += entry.cscHits.size(); + if(m_idHelperSvc->hasMM()) hits += entry.mmHits.size(); return (hits > 4); } @@ -335,7 +329,7 @@ bool MuonTrackPerformanceAlg::handleTrackTruth( const TrackCollection& trackColl muonSimData.push_back(simDataMap.cptr()); } const CscSimDataCollection* cscSimData=NULL; - if(m_idHelperTool->hasCSC()){ + if(m_idHelperSvc->hasCSC()){ SG::ReadHandle cscSimDataMap(m_cscSimData); if(!cscSimDataMap.isValid()){ ATH_MSG_WARNING(cscSimDataMap.key()<<" not valid"); @@ -731,44 +725,44 @@ std::string MuonTrackPerformanceAlg::print( const Muon::IMuonTrackTruthTool::Tru MuonSimDataCollection::const_iterator mit_end = trackTruth.mdtHits.end(); for( ;mit!=mit_end;++mit ) allIds.insert(mit->first); - if(m_idHelperTool->hasCSC()){ + if(m_idHelperSvc->hasCSC()){ CscSimDataCollection::const_iterator cit = trackTruth.cscHits.begin(); CscSimDataCollection::const_iterator cit_end = trackTruth.cscHits.end(); - for( ;cit!=cit_end;++cit ) allIds.insert(m_idHelperTool->layerId(cit->first)); + for( ;cit!=cit_end;++cit ) allIds.insert(m_idHelperSvc->layerId(cit->first)); } - if(m_idHelperTool->hasSTgc()){ + if(m_idHelperSvc->hasSTgc()){ mit = trackTruth.stgcHits.begin(); mit_end = trackTruth.stgcHits.end(); - for( ;mit!=mit_end;++mit ) allIds.insert(m_idHelperTool->layerId(mit->first)); + for( ;mit!=mit_end;++mit ) allIds.insert(m_idHelperSvc->layerId(mit->first)); } - if(m_idHelperTool->hasMM()){ + if(m_idHelperSvc->hasMM()){ mit = trackTruth.mmHits.begin(); mit_end = trackTruth.mmHits.end(); - for( ;mit!=mit_end;++mit ) allIds.insert(m_idHelperTool->layerId(mit->first)); + for( ;mit!=mit_end;++mit ) allIds.insert(m_idHelperSvc->layerId(mit->first)); } mit = trackTruth.rpcHits.begin(); mit_end = trackTruth.rpcHits.end(); - for( ;mit!=mit_end;++mit ) allIds.insert(m_idHelperTool->layerId(mit->first)); + for( ;mit!=mit_end;++mit ) allIds.insert(m_idHelperSvc->layerId(mit->first)); mit = trackTruth.tgcHits.begin(); mit_end = trackTruth.tgcHits.end(); - for( ;mit!=mit_end;++mit ) allIds.insert(m_idHelperTool->layerId(mit->first)); + for( ;mit!=mit_end;++mit ) allIds.insert(m_idHelperSvc->layerId(mit->first)); std::set::iterator it = allIds.begin(); std::set::iterator it_end = allIds.end(); for( ;it!=it_end;++it ){ Identifier id = *it; - Identifier chId = m_idHelperTool->chamberId(id); - bool measuresPhi = m_idHelperTool->measuresPhi(id); + Identifier chId = m_idHelperSvc->chamberId(id); + bool measuresPhi = m_idHelperSvc->measuresPhi(id); if( measuresPhi ) { ++nhitsCompIds[chId].first; }else{ ++nhitsCompIds[chId].second; } - if( m_idHelperTool->isTrigger(chId) ) { + if( m_idHelperSvc->isTrigger(chId) ) { if( measuresPhi ){ ++triggerIds[chId].first; ++nphi; @@ -812,13 +806,13 @@ std::string MuonTrackPerformanceAlg::print( const Muon::IMuonTrackTruthTool::Tru std::map >::iterator iit_end = precisionIds.end(); for( ;iit!=iit_end;++iit ){ sout.setf(std::ios::left); - sout << " " << std::setw(32) << m_idHelperTool->toStringChamber(iit->first) + sout << " " << std::setw(32) << m_idHelperSvc->toStringChamber(iit->first) << " hits: eta " << std::setw(3) << iit->second.second << " phi " << std::setw(3) << iit->second.first << std::endl; } iit = triggerIds.begin(); iit_end = triggerIds.end(); for( ;iit!=iit_end;++iit ){ - sout << " " << std::setw(32) << m_idHelperTool->toStringChamber(iit->first) + sout << " " << std::setw(32) << m_idHelperSvc->toStringChamber(iit->first) << " hits: eta " << std::setw(3) << nhitsCompIds[iit->first].second << " phi " << std::setw(3) << nhitsCompIds[iit->first].first << " stations: Eta " << iit->second.second << " Phi " << iit->second.first << std::endl; @@ -1078,14 +1072,14 @@ std::string MuonTrackPerformanceAlg::printTrackCounters( bool doSecondaries ) co std::pair MuonTrackPerformanceAlg::countHitsInChamber( const Identifier& chId, const std::set& hitIds ) const { // loop over hits in set, calculate their chID and compare it with the input chamber - int nhitsPhi = m_idHelperTool->isMdt(chId) ? -1 : 0; + int nhitsPhi = m_idHelperSvc->isMdt(chId) ? -1 : 0; int nhitsEta = 0; std::set::const_iterator it = hitIds.begin(); std::set::const_iterator it_end = hitIds.end(); for( ;it!=it_end;++it ){ - Identifier ch = m_idHelperTool->chamberId(*it); + Identifier ch = m_idHelperSvc->chamberId(*it); if( ch == chId ) { - if( m_idHelperTool->measuresPhi(*it) ) ++nhitsPhi; + if( m_idHelperSvc->measuresPhi(*it) ) ++nhitsPhi; else ++nhitsEta; } } @@ -1112,7 +1106,7 @@ bool MuonTrackPerformanceAlg::insertChamber( const Identifier& chId, const std:: std::set::const_iterator it = hits.begin(); std::set::const_iterator it_end = hits.end(); for( ;it!=it_end;++it ){ - Identifier ch = m_idHelperTool->chamberId(*it); + Identifier ch = m_idHelperSvc->chamberId(*it); if( ch == chId ) { chamberData.hits.insert(*it); ++nhits; @@ -1143,7 +1137,7 @@ bool MuonTrackPerformanceAlg::insertStationLayers( const std::set& c std::set::const_iterator chit = chIds.begin(); std::set::const_iterator chit_end = chIds.end(); for( ;chit!=chit_end;++chit ){ - Muon::MuonStationIndex::StIndex stIndex = m_idHelperTool->stationIndex(*chit); + Muon::MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(*chit); if( !exclusionList.count(stIndex) ) layers.insert(stIndex); } @@ -1157,9 +1151,9 @@ bool MuonTrackPerformanceAlg::insertStationLayers( const std::vector::const_iterator chit = chambers.begin(); std::vector::const_iterator chit_end = chambers.end(); for( ;chit!=chit_end;++chit ) { - bool isTrigger = m_idHelperTool->isTrigger(chit->chId); + bool isTrigger = m_idHelperSvc->isTrigger(chit->chId); if( (usePrecision && isTrigger) || (!usePrecision && !isTrigger) ) continue; - chIds.insert(m_idHelperTool->chamberId(chit->chId)); + chIds.insert(m_idHelperSvc->chamberId(chit->chId)); } return insertStationLayers(chIds,exclusionList,layers); } @@ -1171,25 +1165,25 @@ MuonTrackPerformanceAlg::TrackData* MuonTrackPerformanceAlg::evaluateTrackTruthO // handle missing chambers insertTechnology( truthTrack.mdts.missedChambers, truthTrack.mdts.missedHits, m_minMdtHits, 0, trackData->missingChambers ); - if(m_idHelperTool->hasCSC()) insertTechnology( truthTrack.cscs.missedChambers, truthTrack.cscs.missedHits, m_minCscEtaHits, m_minCscPhiHits, trackData->missingChambers ); - if(m_idHelperTool->hasSTgc()) insertTechnology( truthTrack.stgcs.missedChambers, truthTrack.stgcs.missedHits, m_minsTgcEtaHits, m_minsTgcPhiHits, trackData->missingChambers ); - if(m_idHelperTool->hasMM()) insertTechnology( truthTrack.mms.missedChambers, truthTrack.mms.missedHits, m_minMMEtaHits, 0, trackData->missingChambers ); + if(m_idHelperSvc->hasCSC()) insertTechnology( truthTrack.cscs.missedChambers, truthTrack.cscs.missedHits, m_minCscEtaHits, m_minCscPhiHits, trackData->missingChambers ); + if(m_idHelperSvc->hasSTgc()) insertTechnology( truthTrack.stgcs.missedChambers, truthTrack.stgcs.missedHits, m_minsTgcEtaHits, m_minsTgcPhiHits, trackData->missingChambers ); + if(m_idHelperSvc->hasMM()) insertTechnology( truthTrack.mms.missedChambers, truthTrack.mms.missedHits, m_minMMEtaHits, 0, trackData->missingChambers ); insertTechnology( truthTrack.rpcs.missedChambers, truthTrack.rpcs.missedHits, m_minRpcEtaHits, m_minRpcPhiHits, trackData->missingChambers ); insertTechnology( truthTrack.tgcs.missedChambers, truthTrack.tgcs.missedHits, m_minTgcEtaHits, m_minTgcPhiHits, trackData->missingChambers ); // handle wrong chambers insertTechnology( truthTrack.mdts.wrongChambers, truthTrack.mdts.wrongHits, m_minMdtHits, 0, trackData->wrongChambers ); - if(m_idHelperTool->hasCSC()) insertTechnology( truthTrack.cscs.wrongChambers, truthTrack.cscs.wrongHits, m_minCscEtaHits, m_minCscPhiHits, trackData->wrongChambers ); - if(m_idHelperTool->hasSTgc()) insertTechnology( truthTrack.stgcs.wrongChambers, truthTrack.stgcs.wrongHits, m_minsTgcEtaHits, m_minsTgcPhiHits, trackData->wrongChambers ); - if(m_idHelperTool->hasMM()) insertTechnology( truthTrack.mms.wrongChambers, truthTrack.mms.wrongHits, m_minMMEtaHits, 0, trackData->wrongChambers ); + if(m_idHelperSvc->hasCSC()) insertTechnology( truthTrack.cscs.wrongChambers, truthTrack.cscs.wrongHits, m_minCscEtaHits, m_minCscPhiHits, trackData->wrongChambers ); + if(m_idHelperSvc->hasSTgc()) insertTechnology( truthTrack.stgcs.wrongChambers, truthTrack.stgcs.wrongHits, m_minsTgcEtaHits, m_minsTgcPhiHits, trackData->wrongChambers ); + if(m_idHelperSvc->hasMM()) insertTechnology( truthTrack.mms.wrongChambers, truthTrack.mms.wrongHits, m_minMMEtaHits, 0, trackData->wrongChambers ); insertTechnology( truthTrack.rpcs.wrongChambers, truthTrack.rpcs.wrongHits, m_minRpcEtaHits, m_minRpcPhiHits, trackData->wrongChambers ); insertTechnology( truthTrack.tgcs.wrongChambers, truthTrack.tgcs.wrongHits, m_minTgcEtaHits, m_minTgcPhiHits, trackData->wrongChambers ); // handle layer information for precision chambers std::set dummyList; insertStationLayers( truthTrack.mdts.matchedChambers, dummyList, trackData->layers ); - if(m_idHelperTool->hasCSC()) insertStationLayers( truthTrack.cscs.matchedChambers, dummyList, trackData->layers ); - if(m_idHelperTool->hasMM()) insertStationLayers( truthTrack.mms.matchedChambers, dummyList, trackData->layers ); + if(m_idHelperSvc->hasCSC()) insertStationLayers( truthTrack.cscs.matchedChambers, dummyList, trackData->layers ); + if(m_idHelperSvc->hasMM()) insertStationLayers( truthTrack.mms.matchedChambers, dummyList, trackData->layers ); insertStationLayers( trackData->missingChambers, trackData->layers, trackData->missingLayers, true ); insertStationLayers( trackData->wrongChambers, trackData->layers, trackData->wrongLayers,true ); @@ -1197,7 +1191,7 @@ MuonTrackPerformanceAlg::TrackData* MuonTrackPerformanceAlg::evaluateTrackTruthO // handle layer information for precision chambers insertStationLayers( truthTrack.rpcs.matchedChambers, dummyList, trackData->layersTrigger ); insertStationLayers( truthTrack.tgcs.matchedChambers, dummyList, trackData->layersTrigger ); - if(m_idHelperTool->hasSTgc()) insertStationLayers( truthTrack.stgcs.matchedChambers, dummyList, trackData->layersTrigger ); + if(m_idHelperSvc->hasSTgc()) insertStationLayers( truthTrack.stgcs.matchedChambers, dummyList, trackData->layersTrigger ); insertStationLayers( trackData->missingChambers, trackData->layersTrigger, trackData->missingLayersTrigger, false ); insertStationLayers( trackData->wrongChambers, trackData->layersTrigger, trackData->wrongLayersTrigger, false ); @@ -1258,12 +1252,12 @@ std::string MuonTrackPerformanceAlg::print( const MuonTrackPerformanceAlg::Track std::vector::const_iterator chIt = trackData.missingChambers.begin(); std::vector::const_iterator chIt_end = trackData.missingChambers.end(); for( ;chIt!=chIt_end;++chIt ){ - sout << " " << m_idHelperTool->toStringChamber(chIt->chId) << " hits " << chIt->hits.size() << std::endl; + sout << " " << m_idHelperSvc->toStringChamber(chIt->chId) << " hits " << chIt->hits.size() << std::endl; if( m_doTrackDebug >= 6 ){ std::set::const_iterator hit = chIt->hits.begin(); std::set::const_iterator hit_end = chIt->hits.end(); for( ;hit!=hit_end;++hit ){ - sout << " " << m_idHelperTool->toString(*hit) << std::endl; + sout << " " << m_idHelperSvc->toString(*hit) << std::endl; } } } @@ -1274,12 +1268,12 @@ std::string MuonTrackPerformanceAlg::print( const MuonTrackPerformanceAlg::Track std::vector::const_iterator chIt = trackData.wrongChambers.begin(); std::vector::const_iterator chIt_end = trackData.wrongChambers.end(); for( ;chIt!=chIt_end;++chIt ){ - sout << " " << m_idHelperTool->toStringChamber(chIt->chId) << " hits " << chIt->hits.size() << std::endl; + sout << " " << m_idHelperSvc->toStringChamber(chIt->chId) << " hits " << chIt->hits.size() << std::endl; if( m_doTrackDebug >= 6 ){ std::set::const_iterator hit = chIt->hits.begin(); std::set::const_iterator hit_end = chIt->hits.end(); for( ;hit!=hit_end;++hit ){ - sout << " " << m_idHelperTool->toString(*hit) << std::endl; + sout << " " << m_idHelperSvc->toString(*hit) << std::endl; } } } @@ -1348,31 +1342,31 @@ MuonTrackPerformanceAlg::TrackData* MuonTrackPerformanceAlg::createTrackData( co MuonSimDataCollection::const_iterator mit = trackTruth.mdtHits.begin(); MuonSimDataCollection::const_iterator mit_end = trackTruth.mdtHits.end(); for( ;mit!=mit_end;++mit ) { - Identifier chId = m_idHelperTool->chamberId(mit->first); + Identifier chId = m_idHelperSvc->chamberId(mit->first); chambers[chId].insert(mit->first); } - if(m_idHelperTool->hasCSC()){ + if(m_idHelperSvc->hasCSC()){ CscSimDataCollection::const_iterator cit = trackTruth.cscHits.begin(); CscSimDataCollection::const_iterator cit_end = trackTruth.cscHits.end(); for( ;cit!=cit_end;++cit ) { - Identifier chId = m_idHelperTool->chamberId(cit->first); - chambers[chId].insert(m_idHelperTool->layerId(cit->first)); + Identifier chId = m_idHelperSvc->chamberId(cit->first); + chambers[chId].insert(m_idHelperSvc->layerId(cit->first)); } } - if(m_idHelperTool->hasSTgc()){ + if(m_idHelperSvc->hasSTgc()){ mit = trackTruth.stgcHits.begin(); mit_end = trackTruth.stgcHits.end(); for( ;mit!=mit_end;++mit ) { - Identifier chId = m_idHelperTool->chamberId(mit->first); + Identifier chId = m_idHelperSvc->chamberId(mit->first); chambers[chId].insert(mit->first); } } - if(m_idHelperTool->hasMM()){ + if(m_idHelperSvc->hasMM()){ mit = trackTruth.mmHits.begin(); mit_end = trackTruth.mmHits.end(); for( ;mit!=mit_end;++mit ) { - Identifier chId = m_idHelperTool->chamberId(mit->first); + Identifier chId = m_idHelperSvc->chamberId(mit->first); chambers[chId].insert(mit->first); } } @@ -1380,14 +1374,14 @@ MuonTrackPerformanceAlg::TrackData* MuonTrackPerformanceAlg::createTrackData( co mit = trackTruth.rpcHits.begin(); mit_end = trackTruth.rpcHits.end(); for( ;mit!=mit_end;++mit ) { - Identifier chId = m_idHelperTool->chamberId(mit->first); + Identifier chId = m_idHelperSvc->chamberId(mit->first); chambers[chId].insert(mit->first); } mit = trackTruth.tgcHits.begin(); mit_end = trackTruth.tgcHits.end(); for( ;mit!=mit_end;++mit ) { - Identifier chId = m_idHelperTool->chamberId(mit->first); + Identifier chId = m_idHelperSvc->chamberId(mit->first); chambers[chId].insert(mit->first); } @@ -1399,22 +1393,22 @@ MuonTrackPerformanceAlg::TrackData* MuonTrackPerformanceAlg::createTrackData( co ChamberData chamberData; unsigned int minEtaHits = 0; unsigned int minPhiHits = 0; - if( m_idHelperTool->isMdt(chIt->first) ) { + if( m_idHelperSvc->isMdt(chIt->first) ) { minEtaHits = m_minMdtHits; minPhiHits = m_minMdtHits; - }else if( m_idHelperTool->isRpc(chIt->first) ){ + }else if( m_idHelperSvc->isRpc(chIt->first) ){ minEtaHits = m_minRpcEtaHits; minPhiHits = m_minRpcPhiHits; - }else if( m_idHelperTool->isTgc(chIt->first) ) { + }else if( m_idHelperSvc->isTgc(chIt->first) ) { minEtaHits = m_minTgcEtaHits; minPhiHits = m_minTgcPhiHits; - }else if( m_idHelperTool->issTgc(chIt->first) ) { + }else if( m_idHelperSvc->issTgc(chIt->first) ) { minEtaHits = m_minsTgcEtaHits; minPhiHits = m_minsTgcPhiHits; - }else if( m_idHelperTool->isMM(chIt->first) ) { + }else if( m_idHelperSvc->isMM(chIt->first) ) { minEtaHits = m_minMMEtaHits; minPhiHits = m_minMMEtaHits; - }else if( m_idHelperTool->isCsc(chIt->first) ) { + }else if( m_idHelperSvc->isCsc(chIt->first) ) { minEtaHits = m_minCscEtaHits; minPhiHits = m_minCscPhiHits; }else{ @@ -1423,8 +1417,8 @@ MuonTrackPerformanceAlg::TrackData* MuonTrackPerformanceAlg::createTrackData( co } if( insertChamber( chIt->first, chIt->second,minEtaHits,minPhiHits,chamberData ) ){ trackData->missingChambers.push_back(chamberData); - Muon::MuonStationIndex::StIndex stIndex = m_idHelperTool->stationIndex(chIt->first); - if( m_idHelperTool->isTrigger(chIt->first) ) trackData->missingLayersTrigger.insert(stIndex); + Muon::MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(chIt->first); + if( m_idHelperSvc->isTrigger(chIt->first) ) trackData->missingLayersTrigger.insert(stIndex); else trackData->missingLayers.insert(stIndex); } } diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h index f99a9f94a0ded6710c4907803178945d154563d3..cc28efdd34693f8a54558363f454d6f4daa68a86 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.h +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/CombinedMuonTrackBuilder.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 */ ////////////////////////////////////////////////////////////////////////////// @@ -13,71 +13,56 @@ ////////////////////////////////////////////////////////////////////////////// #ifndef MUIDTRACKBUILDER_COMBINEDMUONTRACKBUILDER_H -# define MUIDTRACKBUILDER_COMBINEDMUONTRACKBUILDER_H - -//<<<<<< INCLUDES >>>>>> +#define MUIDTRACKBUILDER_COMBINEDMUONTRACKBUILDER_H #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuidInterfaces/ICombinedMuonTrackBuilder.h" #include "TrkParameters/TrackParameters.h" #include "TrkTrack/TrackInfo.h" #include "TrkDetDescrInterfaces/ITrackingVolumesSvc.h" #include "TrkDetDescrInterfaces/ITrackingGeometrySvc.h" #include "TrkGeometry/MagneticFieldProperties.h" -#include "AtlasDetDescr/AtlasDetectorID.h" -#include +#include "TrkExInterfaces/IExtrapolator.h" +#include "TrkExInterfaces/IIntersector.h" +#include "TrkExInterfaces/IPropagator.h" +#include "TrkiPatFitterUtils/IMaterialAllocator.h" +#include "TrkToolInterfaces/ITrackSummaryTool.h" +#include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" +#include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" +#include "MuonRecToolInterfaces/IMuonErrorOptimisationTool.h" +#include "MuonRecToolInterfaces/IMuonHoleRecoveryTool.h" +#include "MuonRecToolInterfaces/IMuonTrackCleaner.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "TrkToolInterfaces/ITrkMaterialProviderTool.h" +#include "MuidInterfaces/IMuidCaloEnergy.h" +#include "MuidInterfaces/IMuidCaloTrackStateOnSurface.h" +#include "MuidInterfaces/IMuonTrackQuery.h" +#include "MagFieldInterfaces/IMagFieldSvc.h" -//<<<<<< CLASS DECLARATIONS >>>>>> - -namespace MagField { - class IMagFieldSvc; -} +#include class CaloEnergy; class MessageHelper; -namespace Muon -{ - class IMdtDriftCircleOnTrackCreator; - class IMuonClusterOnTrackCreator; - class IMuonErrorOptimisationTool; - class IMuonHoleRecoveryTool; - class IMuonTrackCleaner; - class MuonIdHelperTool; - class MuonEDMPrinterTool; -} -namespace Trk -{ - class IExtrapolator; - class IIntersector; - class IMaterialAllocator; - class IPropagator; - class ITrackSummaryTool; + +namespace Trk { class PerigeeSurface; class PseudoMeasurementOnTrack; class RecVertex; - class Surface; class TrackStateOnSurface; class TrackingVolume; class Volume; - class ITrkMaterialProviderTool; } -namespace Rec -{ - class IMuidCaloEnergy; - class IMuidCaloTrackStateOnSurface; - class IMuonTrackQuery; - - class CombinedMuonTrackBuilder: public AthAlgTool, - virtual public ICombinedMuonTrackBuilder - { +namespace Rec { + class CombinedMuonTrackBuilder: public AthAlgTool, virtual public ICombinedMuonTrackBuilder { public: CombinedMuonTrackBuilder (const std::string& type, const std::string& name, const IInterface* parent); - ~CombinedMuonTrackBuilder (void); // destructor + ~CombinedMuonTrackBuilder()=default; StatusCode initialize(); StatusCode finalize(); @@ -234,7 +219,7 @@ namespace Rec ToolHandle m_extrapolator; ToolHandle m_fitter; // curved track fitter ToolHandle m_fitterSL; // straight line fitter - ToolHandle m_idHelperTool; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle m_intersector; Trk::MagneticFieldProperties m_magFieldProperties; ServiceHandle m_magFieldSvc; @@ -273,8 +258,8 @@ namespace Rec double m_vertex3DSigmaRPhi; double m_vertex3DSigmaZ; double m_zECToroid; - double m_IDMS_xySigma; - double m_IDMS_rzSigma; + double m_IDMS_xySigma; + double m_IDMS_rzSigma; // dummy (unused - kept for backwards compatibility) bool m_indetSlimming; bool m_inputSlimming; @@ -313,10 +298,9 @@ namespace Rec bool m_iterateCombinedTrackFit; bool m_refineELossCombinedTrackFit; bool m_refineELossStandAloneTrackFit; - bool m_addElossID; - bool m_addIDMSerrors; - bool m_useRefitTrackError; - const AtlasDetectorID* m_DetID; + bool m_addElossID; + bool m_addIDMSerrors; + bool m_useRefitTrackError; }; } // end of namespace diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.h b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.h index f6f6b4098e9c3b1b0010451d0138b58acdd9164e..1d3d75133c8edb757045ae7f009ec02413cffbbd 100644 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.h +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/MuidTrackBuilder/MuidMuonRecovery.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,8 +15,6 @@ #ifndef MUIDCOMBINEDTOOLS_MUIDMUONRECOVERY_H #define MUIDCOMBINEDTOOLS_MUIDMUONRECOVERY_H -//<<<<<< INCLUDES >>>>>> - #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" @@ -24,12 +22,10 @@ #include "MuidInterfaces/IMuidMuonRecovery.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" #include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "TrkExInterfaces/IExtrapolator.h" #include "TrkToolInterfaces/IResidualPullCalculator.h" -//<<<<<< CLASS DECLARATIONS >>>>>> - - namespace Rec { @@ -41,7 +37,7 @@ public: MuidMuonRecovery (const std::string& type, const std::string& name, const IInterface* parent); - ~MuidMuonRecovery(void); // destructor + ~MuidMuonRecovery()=default; StatusCode initialize(); StatusCode finalize(); @@ -57,8 +53,7 @@ public: ServiceHandle m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; // m_muonIdHelperSvc{this, "idHelper", - "Muon::MuonIdHelperSvc/MuonIdHelperSvc", "Handle to the service providing the IMuonIdHelperSvc interface"}; // m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle m_printer {this, "Printer", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool", "Tool to print EDM objects"}; // m_residualCalculator {this, "TrackBuilder", "Trk::ResidualPullCalculator/ResidualPullCalculator", "Residual calculator tool"}; ToolHandle m_trackBuilder {this, "TrackBuilder", "Rec::CombinedMuonTrackBuilder/CombinedMuonTrackBuilder", "Track builder tool"}; diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx index 15db529fd48c23df29a0835bc4e605e83d08c411..869461627e6baf21031540d765bb9c784aa62f21 100755 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/CombinedMuonTrackBuilder.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 */ ////////////////////////////////////////////////////////////////////////////// @@ -12,32 +12,16 @@ // (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// -//<<<<<< INCLUDES >>>>>> - #include #include -#include "MuidInterfaces/IMuidCaloEnergy.h" -#include "MuidInterfaces/IMuidCaloTrackStateOnSurface.h" -#include "MuidInterfaces/IMuonTrackQuery.h" #include "MuidTrackBuilder/CombinedMuonTrackBuilder.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonRecToolInterfaces/IMdtDriftCircleOnTrackCreator.h" -#include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" -#include "MuonRecToolInterfaces/IMuonErrorOptimisationTool.h" -#include "MuonRecToolInterfaces/IMuonHoleRecoveryTool.h" -#include "MuonRecToolInterfaces/IMuonTrackCleaner.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" #include "TrkDetDescrInterfaces/ITrackingGeometrySvc.h" #include "TrkDetDescrInterfaces/ITrackingVolumesSvc.h" #include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h" -#include "TrkExInterfaces/IExtrapolator.h" -#include "TrkExInterfaces/IIntersector.h" -#include "TrkExInterfaces/IPropagator.h" #include "TrkExUtils/TrackSurfaceIntersection.h" #include "TrkGeometry/TrackingGeometry.h" #include "TrkGeometry/TrackingVolume.h" -#include "MagFieldInterfaces/IMagFieldSvc.h" #include "TrkMaterialOnTrack/EnergyLoss.h" #include "TrkMaterialOnTrack/MaterialEffectsOnTrack.h" #include "TrkMaterialOnTrack/ScatteringAngles.h" @@ -50,15 +34,11 @@ #include "TrkSurfaces/RotatedTrapezoidBounds.h" #include "TrkSurfaces/Surface.h" #include "TrkSurfaces/TrapezoidBounds.h" -#include "TrkToolInterfaces/ITrackSummaryTool.h" #include "TrkTrack/Track.h" -#include "TrkiPatFitterUtils/IMaterialAllocator.h" #include "TrkiPatFitterUtils/MessageHelper.h" #include "VxVertex/RecVertex.h" #include "muonEvent/CaloEnergy.h" -#include "TrkToolInterfaces/ITrkMaterialProviderTool.h" #include "TrkEventUtils/IdentifierExtractor.h" -#include "MuonIdHelpers/MuonStationIndex.h" #include "TrkTrackSummary/MuonTrackSummary.h" #include "TrkTrackSummary/TrackSummary.h" #include "AthenaKernel/Units.h" @@ -69,8 +49,6 @@ namespace Units = Athena::Units; namespace Rec { - -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> CombinedMuonTrackBuilder::CombinedMuonTrackBuilder (const std::string&type, const std::string&name, @@ -83,7 +61,6 @@ CombinedMuonTrackBuilder::CombinedMuonTrackBuilder (const std::string&type, m_extrapolator ("Trk::Extrapolator/AtlasExtrapolator", this), m_fitter ("Trk::iPatFitter/iPatFitter", this), m_fitterSL ("Trk::iPatFitter/iPatSLFitter", this), - m_idHelperTool ("Muon::MuonIdHelperTool", this), m_intersector ("Trk::RungeKuttaIntersector/RungeKuttaIntersector", this), m_magFieldProperties (Trk::FullField), m_magFieldSvc ("AtlasFieldSvc",name), @@ -148,8 +125,7 @@ CombinedMuonTrackBuilder::CombinedMuonTrackBuilder (const std::string&type, m_refineELossStandAloneTrackFit (true), m_addElossID (true), m_addIDMSerrors (true), - m_useRefitTrackError (true), - m_DetID (0) + m_useRefitTrackError (true) { m_messageHelper = new MessageHelper(*this); declareInterface(this); @@ -212,30 +188,22 @@ CombinedMuonTrackBuilder::CombinedMuonTrackBuilder (const std::string&type, } -CombinedMuonTrackBuilder::~CombinedMuonTrackBuilder (void) -{} - -//<<<<<< PUBLIC MEMBER FUNCTION DEFINITIONS >>>>>> - StatusCode -CombinedMuonTrackBuilder::initialize() -{ - - if( !AthAlgTool::initialize() ) return StatusCode::FAILURE; - - ATH_MSG_DEBUG( "Initializing CombinedMuonTrackBuilder" - << " - package version " << PACKAGE_VERSION ); - msg(MSG::DEBUG) << " with options: "; - if (m_allowCleanerVeto) msg(MSG::DEBUG) << " AllowCleanerVeto"; - if (m_cleanCombined) msg(MSG::DEBUG) << " CleanCombined"; - if (m_cleanStandalone) msg(MSG::DEBUG) << " CleanStandalone"; - if (m_perigeeAtSpectrometerEntrance)msg(MSG::DEBUG) << " PerigeeAtSpectrometerEntrance"; - if (m_reallocateMaterial) msg(MSG::DEBUG) << " ReallocateMaterial"; - if (! m_cscRotCreator.empty()) msg(MSG::DEBUG) << " RedoCscRots"; - if (! m_mdtRotCreator.empty()) msg(MSG::DEBUG) << " RedoMdtRots"; - if (! m_muonErrorOptimizer.empty()) msg(MSG::DEBUG) << " ErrorOptimisation"; - if (! m_muonHoleRecovery.empty()) msg(MSG::DEBUG) << " HoleRecovery"; - msg(MSG::DEBUG) << endmsg; +CombinedMuonTrackBuilder::initialize() { + + ATH_CHECK(AthAlgTool::initialize()); + + ATH_MSG_DEBUG("Initializing CombinedMuonTrackBuilder" << " - package version " << PACKAGE_VERSION); + ATH_MSG_DEBUG(" with options: "); + if (m_allowCleanerVeto) ATH_MSG_DEBUG(" AllowCleanerVeto"); + if (m_cleanCombined) ATH_MSG_DEBUG(" CleanCombined"); + if (m_cleanStandalone) ATH_MSG_DEBUG(" CleanStandalone"); + if (m_perigeeAtSpectrometerEntrance) ATH_MSG_DEBUG(" PerigeeAtSpectrometerEntrance"); + if (m_reallocateMaterial) ATH_MSG_DEBUG(" ReallocateMaterial"); + if (!m_cscRotCreator.empty()) ATH_MSG_DEBUG(" RedoCscRots"); + if (!m_mdtRotCreator.empty()) ATH_MSG_DEBUG(" RedoMdtRots"); + if (!m_muonErrorOptimizer.empty()) ATH_MSG_DEBUG(" ErrorOptimisation"); + if (!m_muonHoleRecovery.empty()) ATH_MSG_DEBUG(" HoleRecovery"); // fill WARNING messages m_messageHelper->setMaxNumberOfMessagesPrinted(m_maxWarnings); @@ -343,225 +311,71 @@ CombinedMuonTrackBuilder::initialize() ATH_CHECK(m_printer.retrieve()); - // get the Tools - if (m_caloEnergyParam.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_caloEnergyParam ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_caloEnergyParam ); - } - if (m_caloTSOS.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_caloTSOS ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_caloTSOS ); - } - if (m_cleaner.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_cleaner ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_cleaner ); - } - if (! m_cscRotCreator.empty()) - { - m_redoRots = true; - if (m_cscRotCreator.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_cscRotCreator ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_cscRotCreator ); - } - } - if (m_extrapolator.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_extrapolator ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_extrapolator ); - } - if (m_fitter.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_fitter ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_fitter ); - } - if (m_fitterSL.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_fitterSL ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_fitterSL ); - } - if (m_idHelperTool.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_idHelperTool ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_idHelperTool ); - } - if (m_intersector.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_intersector ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_intersector ); - } - if (m_magFieldSvc.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve service " << m_magFieldSvc ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved service " << m_magFieldSvc ); - } - if (! m_materialAllocator.empty()) - { - if (m_materialAllocator.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_materialAllocator ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_materialAllocator ); - } - } - if (! m_mdtRotCreator.empty()) - { - m_redoRots = true; - if (m_mdtRotCreator.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_mdtRotCreator ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_mdtRotCreator ); - } - } - if (! m_muonErrorOptimizer.empty()) - { - if (m_muonErrorOptimizer.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_muonErrorOptimizer ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_muonErrorOptimizer ); - } - } - if (! m_muonHoleRecovery.empty()) - { - if (m_muonHoleRecovery.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_muonHoleRecovery ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_muonHoleRecovery ); - } - } - if (m_propagator.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_propagator ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_propagator ); - } - if (m_propagatorSL.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_propagatorSL ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_propagatorSL ); - } - if (m_trackQuery.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_trackQuery ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_trackQuery ); - } - if (m_trackSummary.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_trackSummary ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_trackSummary ); - } - if (m_materialUpdator.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_materialUpdator ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved tool " << m_materialUpdator ); - } - + ATH_CHECK(m_caloEnergyParam.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_caloEnergyParam ); + ATH_CHECK(m_caloTSOS.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_caloTSOS ); + ATH_CHECK(m_cleaner.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_cleaner ); + if (!m_cscRotCreator.empty()) { + m_redoRots = true; + ATH_CHECK(m_cscRotCreator.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_cscRotCreator ); + } + ATH_CHECK(m_extrapolator.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_extrapolator ); + ATH_CHECK(m_fitter.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_fitter ); + ATH_CHECK(m_fitterSL.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_fitterSL ); + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_idHelperSvc ); + ATH_CHECK(m_intersector.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_intersector ); + ATH_CHECK(m_magFieldSvc.retrieve()); + ATH_MSG_DEBUG( "Retrieved service " << m_magFieldSvc ); + if (!m_materialAllocator.empty()) { + ATH_CHECK(m_materialAllocator.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_materialAllocator ); + } + if (!m_mdtRotCreator.empty()) { + m_redoRots = true; + ATH_CHECK(m_mdtRotCreator.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_mdtRotCreator ); + } + if (!m_muonErrorOptimizer.empty()) { + ATH_CHECK(m_muonErrorOptimizer.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_muonErrorOptimizer ); + } + if (!m_muonHoleRecovery.empty()) { + ATH_CHECK(m_muonHoleRecovery.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_muonHoleRecovery ); + } + ATH_CHECK(m_propagator.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_propagator ); + ATH_CHECK(m_propagatorSL.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_propagatorSL ); + ATH_CHECK(m_trackQuery.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_trackQuery ); + ATH_CHECK(m_trackSummary.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_trackSummary ); + ATH_CHECK(m_materialUpdator.retrieve()); + ATH_MSG_DEBUG( "Retrieved tool " << m_materialUpdator ); - // retrieve services - if (m_trackingGeometrySvc.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve Svc " << m_trackingGeometrySvc ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved Svc " << m_trackingGeometrySvc ); - } - + ATH_CHECK(m_trackingGeometrySvc.retrieve()); + ATH_MSG_DEBUG( "Retrieved Svc " << m_trackingGeometrySvc ); + // need to know which TrackingVolume we are in: indet/calo/spectrometer - if (m_trackingVolumesSvc.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve Svc " << m_trackingVolumesSvc ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_DEBUG( "Retrieved Svc " << m_trackingVolumesSvc ); + ATH_CHECK(m_trackingVolumesSvc.retrieve()); + ATH_MSG_DEBUG( "Retrieved Svc " << m_trackingVolumesSvc ); + m_calorimeterVolume = new Trk::Volume( m_trackingVolumesSvc->volume(Trk::ITrackingVolumesSvc::MuonSpectrometerEntryLayer)); m_indetVolume = new Trk::Volume( m_trackingVolumesSvc->volume(Trk::ITrackingVolumesSvc::CalorimeterEntryLayer)); - } - + // sigma of phi sector for pseudo-measurement constraint - m_sigmaPhiSector = tan(0.125*M_PI/sqrt(12.)); + m_sigmaPhiSector = std::tan(0.125*M_PI/std::sqrt(12.)); // create beamAxis and vertexRegion for constrained (projective) track fits Amg::Vector3D origin(0.,0.,0.); @@ -580,17 +394,10 @@ CombinedMuonTrackBuilder::initialize() (vertexRegionCovariance)(2,2) = m_vertex3DSigmaZ*m_vertex3DSigmaZ; m_vertex = new Trk::RecVertex(origin,vertexRegionCovariance); - if (msgLvl(MSG::DEBUG)) - { - msg(MSG::DEBUG) << " vertex region: "; +#ifndef NDEBUG + ATH_MSG_DEBUG(" vertex region: "); m_vertex->dump(msg(MSG::DEBUG)); - msg(MSG::DEBUG) << endmsg; - } - if (detStore()->retrieve(m_DetID, "AtlasID").isFailure()) { - ATH_MSG_ERROR ("Could not get AtlasDetectorID helper" ); - return StatusCode::FAILURE; - } - +#endif return StatusCode::SUCCESS; } @@ -1662,13 +1469,13 @@ CombinedMuonTrackBuilder::standaloneFit (const Trk::Track& inputSpectrometerTrac ((**t).measurementOnTrack()); if (! rot) continue; Identifier id = rot->identify(); - if (! m_idHelperTool->isMuon(id)) continue; + if (! m_idHelperSvc->isMuon(id)) continue; const Trk::RIO_OnTrack* updatedRot = 0; - if (! m_cscRotCreator.empty() && m_idHelperTool->isCsc(id)) + if (! m_cscRotCreator.empty() && m_idHelperSvc->isCsc(id)) { updatedRot = m_cscRotCreator->correct(*rot->prepRawData(),*(**t).trackParameters()); } - else if (! m_mdtRotCreator.empty() && m_idHelperTool->isMdt(id)) + else if (! m_mdtRotCreator.empty() && m_idHelperSvc->isMdt(id)) { updatedRot = m_mdtRotCreator->correct(*rot->prepRawData(),*(**t).trackParameters()); } @@ -3076,14 +2883,14 @@ bool CombinedMuonTrackBuilder::optimizeErrors(Trk::Track* track) const int nLarge = 0; for( ;chit!=chit_end;++chit ){ const Identifier& id = chit->chamberId(); - bool isMdt = m_idHelperTool->isMdt(id); + bool isMdt = m_idHelperSvc->isMdt(id); if(!isMdt) continue; - Muon::MuonStationIndex::StIndex stIndex = m_idHelperTool->stationIndex(id); + Muon::MuonStationIndex::StIndex stIndex = m_idHelperSvc->stationIndex(id); if( stIndex == Muon::MuonStationIndex::BE ) { optimize = 1; } - if( stIndex == Muon::MuonStationIndex::BI && m_idHelperTool->chamberIndex(id) == Muon::MuonStationIndex::BIS && abs(m_idHelperTool->stationEta(id)) > 6 ){ + if( stIndex == Muon::MuonStationIndex::BI && m_idHelperSvc->chamberIndex(id) == Muon::MuonStationIndex::BIS && abs(m_idHelperSvc->stationEta(id)) > 6 ){ optimize = 2; } if( stIndex == Muon::MuonStationIndex::BI || stIndex == Muon::MuonStationIndex::BM || stIndex == Muon::MuonStationIndex::BO || stIndex == Muon::MuonStationIndex::BE) { @@ -3092,7 +2899,7 @@ bool CombinedMuonTrackBuilder::optimizeErrors(Trk::Track* track) const if( stIndex == Muon::MuonStationIndex::EI || stIndex == Muon::MuonStationIndex::EM || stIndex == Muon::MuonStationIndex::EO || stIndex == Muon::MuonStationIndex::EE) { nEndcap++; } - if( m_idHelperTool->isSmallChamber(id)) { + if( m_idHelperSvc->isSmallChamber(id)) { nSmall++; } else { nLarge++; @@ -3277,7 +3084,7 @@ CombinedMuonTrackBuilder::appendSelectedTSOS( && std::find(measurementSurfaces.begin(), measurementSurfaces.end(), surface) != measurementSurfaces.end() - && !m_idHelperTool->isMM(surface->associatedDetectorElementIdentifier())) + && !m_idHelperSvc->isMM(surface->associatedDetectorElementIdentifier())) { std::string type = ""; if (dynamic_cast((**s).measurementOnTrack())) @@ -4115,7 +3922,7 @@ CombinedMuonTrackBuilder::createSpectrometerTSOS(const Trk::Track& spectrometerT && std::find(measurementSurfaces.begin(), measurementSurfaces.end(), surface) != measurementSurfaces.end() - && !m_idHelperTool->isMM(surface->associatedDetectorElementIdentifier())) + && !m_idHelperSvc->isMM(surface->associatedDetectorElementIdentifier())) { std::string type = ""; if (dynamic_cast((**s).measurementOnTrack())) @@ -5011,7 +4818,7 @@ CombinedMuonTrackBuilder::vertexOnTrack(const Trk::TrackParameters& parameters, Identifier id = Trk::IdentifierExtractor::extract(mot); if(id.is_valid()) { // skip after first Muon hit - if(m_DetID->is_muon(id)) break; + if(m_idHelperSvc->isMuon(id)) break; } } if(pstart==0&&m->trackParameters()) { diff --git a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx index c07c1d63b4a5a360713557207c227a1f09166e52..8eb7fdbe9cc912e55e0dd2ffc47353dc6b2ecd4b 100644 --- a/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.cxx +++ b/Reconstruction/MuonIdentification/MuidTrackBuilder/src/MuidMuonRecovery.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 */ ////////////////////////////////////////////////////////////////////////////// @@ -12,8 +12,6 @@ // (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// -//<<<<<< INCLUDES >>>>>> - #include #include #include @@ -23,8 +21,6 @@ #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" #include "MuonRIO_OnTrack/CscClusterOnTrack.h" #include "MuonReadoutGeometry/MuonReadoutElement.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonIdHelpers/MuonStationIndex.h" #include "TrkEventPrimitives/LocalDirection.h" #include "TrkEventPrimitives/ResidualPull.h" #include "TrkParameters/TrackParameters.h" @@ -37,8 +33,6 @@ namespace Rec { -//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> - MuidMuonRecovery::MuidMuonRecovery (const std::string& type, const std::string& name, const IInterface* parent) @@ -55,9 +49,6 @@ MuidMuonRecovery::MuidMuonRecovery (const std::string& type, declareProperty("PullCut", m_pullCut = 5); } -MuidMuonRecovery::~MuidMuonRecovery() -{} - //<<<<<< PUBLIC MEMBER FUNCTION DEFINITIONS >>>>>> StatusCode @@ -66,62 +57,19 @@ MuidMuonRecovery::initialize() ATH_MSG_INFO( "Initializing MuidMuonRecovery - package version " << PACKAGE_VERSION ); // get the Tools - if (m_extrapolator.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_extrapolator ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_INFO( "Retrieved tool " << m_extrapolator ); - } - if (m_edmHelperSvc.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_edmHelperSvc ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_INFO( "Retrieved tool " << m_edmHelperSvc ); - } - if (m_muonIdHelperSvc.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_muonIdHelperSvc ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_INFO( "Retrieved tool " << m_muonIdHelperSvc ); - } - if (m_printer.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_printer ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_INFO( "Retrieved tool " << m_printer ); - } - if (m_residualCalculator.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_residualCalculator ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_INFO( "Retrieved tool " << m_residualCalculator ); - } - if (! m_trackBuilder.empty()) - { - if (m_trackBuilder.retrieve().isFailure()) - { - ATH_MSG_FATAL( "Failed to retrieve tool " << m_trackBuilder ); - return StatusCode::FAILURE; - } - else - { - ATH_MSG_INFO( "Retrieved tool " << m_trackBuilder ); - } + ATH_CHECK(m_extrapolator.retrieve()); + ATH_MSG_INFO( "Retrieved tool " << m_extrapolator ); + ATH_CHECK(m_edmHelperSvc.retrieve()); + ATH_MSG_INFO( "Retrieved tool " << m_edmHelperSvc ); + ATH_CHECK(m_idHelperSvc.retrieve()); + ATH_MSG_INFO( "Retrieved tool " << m_idHelperSvc ); + ATH_CHECK(m_printer.retrieve()); + ATH_MSG_INFO( "Retrieved tool " << m_printer ); + ATH_CHECK(m_residualCalculator.retrieve()); + ATH_MSG_INFO( "Retrieved tool " << m_residualCalculator ); + if (! m_trackBuilder.empty()) { + ATH_CHECK(m_trackBuilder.retrieve()); + ATH_MSG_INFO( "Retrieved tool " << m_trackBuilder ); } return StatusCode::SUCCESS; @@ -191,21 +139,21 @@ MuidMuonRecovery::recoverableMatch (const Trk::Track& indetTrack, Identifier id = m_edmHelperSvc->getIdentifier(*meas); if ( !id.is_valid() ) continue; - Muon::MuonStationIndex::StIndex index = m_muonIdHelperSvc->stationIndex(id); - bool measuresPhi = m_muonIdHelperSvc->measuresPhi(id); + Muon::MuonStationIndex::StIndex index = m_idHelperSvc->stationIndex(id); + bool measuresPhi = m_idHelperSvc->measuresPhi(id); ++nmeas; if ( measuresPhi ) { if ( phiIndices.count(index) ) continue; - ATH_MSG_DEBUG("Adding phi station " << m_muonIdHelperSvc->toString(id)); + ATH_MSG_DEBUG("Adding phi station " << m_idHelperSvc->toString(id)); phiIndices.insert(index); } - else if (m_muonIdHelperSvc->isMdt(id) || (m_muonIdHelperSvc->isCsc(id) ) ) + else if (m_idHelperSvc->isMdt(id) || (m_idHelperSvc->isCsc(id) ) ) { if ( etaIndices.count(index) ) continue; - ATH_MSG_DEBUG("Adding eta station " << m_muonIdHelperSvc->toString(id)); + ATH_MSG_DEBUG("Adding eta station " << m_idHelperSvc->toString(id)); etaIndices.insert(index); } else @@ -229,13 +177,13 @@ MuidMuonRecovery::recoverableMatch (const Trk::Track& indetTrack, } if ( ! exPars ) { - ATH_MSG_DEBUG("Failed to extrapolate to station" << m_muonIdHelperSvc->toStringChamber(id) ); + ATH_MSG_DEBUG("Failed to extrapolate to station" << m_idHelperSvc->toStringChamber(id) ); continue; } const Trk::ResidualPull* res = m_residualCalculator->residualPull( meas, exPars, Trk::ResidualPull::Unbiased ); - ATH_MSG_DEBUG(" " << m_muonIdHelperSvc->toStringChamber(id) << " residual " << m_printer->print(*res)); + ATH_MSG_DEBUG(" " << m_idHelperSvc->toStringChamber(id) << " residual " << m_printer->print(*res)); if ( fabs(res->pull().front()) > m_pullCut ) { if ( measuresPhi ) @@ -252,10 +200,10 @@ MuidMuonRecovery::recoverableMatch (const Trk::Track& indetTrack, if (msgLvl(MSG::DEBUG)) { - if ( !m_muonIdHelperSvc->measuresPhi(id) ) + if ( !m_idHelperSvc->measuresPhi(id) ) { const MuonGM::MuonReadoutElement* detEl = 0; - if ( m_muonIdHelperSvc->isMdt(id) ) + if ( m_idHelperSvc->isMdt(id) ) { const Muon::MdtDriftCircleOnTrack* mdt = dynamic_cast(meas); @@ -264,7 +212,7 @@ if (msgLvl(MSG::DEBUG)) detEl = mdt->detectorElement(); } } - else if ( m_muonIdHelperSvc->isCsc(id) ) + else if ( m_idHelperSvc->isCsc(id) ) { const Muon::CscClusterOnTrack* csc = dynamic_cast(meas); @@ -360,8 +308,8 @@ if (msgLvl(MSG::DEBUG)) Identifier id = m_edmHelperSvc->getIdentifier(*meas); if ( !id.is_valid() ) continue; - Muon::MuonStationIndex::StIndex index = m_muonIdHelperSvc->stationIndex(id); - bool measuresPhi = m_muonIdHelperSvc->measuresPhi(id); + Muon::MuonStationIndex::StIndex index = m_idHelperSvc->stationIndex(id); + bool measuresPhi = m_idHelperSvc->measuresPhi(id); if ( cleanEta && !measuresPhi && badEtaIndices.count(index) ) continue; if ( cleanPhi && measuresPhi && badPhiIndices.count(index) ) continue; spectrometerMeasurements.push_back(meas); diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/CMakeLists.txt b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/CMakeLists.txt index 74444c44803fcf0fe09a5c72566e552dde252b9c..20804d5431a84718c4e1248dad8ac158f2ce50ba 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/CMakeLists.txt +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/CMakeLists.txt @@ -8,6 +8,7 @@ atlas_subdir( MuonCombinedBaseTools ) # Declare the package's dependencies: atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/BeamSpotConditionsData + Reconstruction/MuonIdentification/MuonCombinedToolInterfaces PRIVATE Calorimeter/CaloEvent Calorimeter/CaloInterface @@ -36,7 +37,6 @@ atlas_depends_on_subdirs( PUBLIC Reconstruction/MuonIdentification/ICaloTrkMuIdTools Reconstruction/MuonIdentification/MuidInterfaces Reconstruction/MuonIdentification/MuonCombinedEvent - Reconstruction/MuonIdentification/MuonCombinedToolInterfaces Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerToolInterfaces Reconstruction/MuonIdentification/muonEvent Reconstruction/MuonIdentification/MuidEvent diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.cxx index db2707a06dac10330f5cd7059fdfb79c3354a98d..3172bfe9dd1fb160fa75ae8ebb3f00bedc166357 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.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 */ ///////////////////////////////////////////////////////////////////////////// @@ -12,14 +12,6 @@ // (c) ATLAS Combined Muon software ////////////////////////////////////////////////////////////////////////////// -//<<<<<< INCLUDES >>>>>> -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" - -#include "MuonCombinedToolInterfaces/IMuonCombinedTagTool.h" -#include "MuonCombinedToolInterfaces/IMuonPrintingTool.h" -#include "TrkToolInterfaces/ITrackParticleCreatorTool.h" -#include "TrkToolInterfaces/ITrackAmbiguityProcessorTool.h" #include "MuonCombinedEvent/InDetCandidate.h" #include "MuonCombinedEvent/MuonCandidate.h" #include "MuonCreatorTool.h" @@ -38,7 +30,6 @@ #include "TrkTrack/AlignmentEffectsOnTrack.h" #include "TrkParameters/TrackParameters.h" #include "TrkGeometry/MagneticFieldProperties.h" -#include "TrkExInterfaces/IPropagator.h" #include "TrkMaterialOnTrack/MaterialEffectsOnTrack.h" #include "TrkMaterialOnTrack/EnergyLoss.h" #include "TrkMaterialOnTrack/ScatteringAngles.h" @@ -48,39 +39,25 @@ #include "xAODMuon/MuonSegment.h" #include "xAODMuonCnv/IMuonSegmentConverterTool.h" -#include "MuonCombinedToolInterfaces/IMuonMeanMDTdADCFiller.h" - #include "muonEvent/CaloEnergy.h" #include "FourMomUtils/P4Helpers.h" #include "xAODCaloEvent/CaloCluster.h" #include "TrackToCalo/CaloCellCollector.h" -#include "TrkToolInterfaces/ITrkMaterialProviderTool.h" - #include "MuonReadoutGeometry/RpcReadoutElement.h" #include "MuonRIO_OnTrack/RpcClusterOnTrack.h" #include "MuonCompetingRIOsOnTrack/CompetingMuonClustersOnTrack.h" -#include "MuidInterfaces/IMuonTrackQuery.h" #include "MuidEvent/FieldIntegral.h" -#include "TrackSegmentAssociationTool.h" -#include "MuonIdHelpers/MuonStationIndex.h" - #include "StoreGate/ReadCondHandle.h" -//#include "xAODTruth/TruthEventContainer.h" - - namespace MuonCombined { - //<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>> - MuonCreatorTool::MuonCreatorTool (const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool(type, name, parent), m_makeMSPreExtrapLink(false), m_haveAddedCaloInformation(false), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), m_muonPrinter("Rec::MuonPrintingTool/MuonPrintingTool"), m_caloExtTool("Trk::ParticleCaloExtensionTool/ParticleCaloExtensionTool", this), @@ -100,7 +77,6 @@ namespace MuonCombined { { declareInterface(this); declareProperty("MakeTrackAtMSLink",m_makeMSPreExtrapLink=false); - declareProperty("MuonIdHelperTool",m_idHelper ); declareProperty("Printer",m_printer ); declareProperty("ParticleCaloExtensionTool", m_caloExtTool); declareProperty("MuonPrinter",m_muonPrinter ); @@ -127,21 +103,15 @@ namespace MuonCombined { declareProperty("AssociateSegmentsToLowBetaMuons",m_segLowBeta = false); declareProperty("UseCaloCells",m_useCaloCells = true); declareProperty("MakeSAMuons", m_doSA=false); - //declareProperty("FillMuonTruthLinks", m_fillMuonTruthLinks = true ); declareProperty("TrackQuery", m_trackQuery); } - MuonCreatorTool::~MuonCreatorTool() - {} - - //<<<<<< PUBLIC MEMBER FUNCTION DEFINITIONS >>>>>> - StatusCode MuonCreatorTool::initialize() { if( m_buildStauContainer ) ATH_MSG_DEBUG(" building Stau container "); - ATH_CHECK(m_idHelper.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_printer.retrieve()); ATH_CHECK(m_muonPrinter.retrieve()); ATH_CHECK(m_caloExtTool.retrieve()); @@ -181,10 +151,6 @@ namespace MuonCombined { return StatusCode::SUCCESS; } - StatusCode MuonCreatorTool::finalize() { - return StatusCode::SUCCESS; - } - void MuonCreatorTool::create( const MuonCandidateCollection* muonCandidates, const InDetCandidateCollection* inDetCandidates, std::vector tagMaps, OutputData& outputData ) const { @@ -1461,7 +1427,7 @@ namespace MuonCombined { // only consider RPC hits Identifier mid = m_edmHelperSvc->getIdentifier(*meas); - if( !m_idHelper->isMuon(mid) || !m_idHelper->isRpc(mid) ) continue; + if( !m_idHelperSvc->isMuon(mid) || !m_idHelperSvc->isRpc(mid) ) continue; // lambda to add a hit auto addHit = [&]( const Trk::MeasurementBase& meas) { @@ -1747,8 +1713,8 @@ namespace MuonCombined { nAEOT++; std::set chIdSet; for(auto id : aeot->vectorOfAffectedTSOS()) { - if( !id.is_valid() || !m_idHelper->isMuon(id) ) continue; - chIdSet.insert( m_idHelper->chamberIndex(id) ); + if( !id.is_valid() || !m_idHelperSvc->isMuon(id) ) continue; + chIdSet.insert( m_idHelperSvc->chamberIndex(id) ); } std::vector chIdVec; std::copy(chIdSet.begin(), chIdSet.end(), std::back_inserter(chIdVec)); diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.h b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.h index 09d84fc0dae4a2dc892d173364151c275909004b..fee05160323344efb5d0c14cb5e5632a491cadd6 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonCreatorTool.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 */ #ifndef MUONCOMBINEDBASETOOLS_MUONCREATORTOOL_H @@ -9,7 +9,7 @@ #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" #include "MuonCombinedToolInterfaces/IMuonCreatorTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonCombinedEvent/MuonCandidateCollection.h" #include "MuonCombinedEvent/InDetCandidateCollection.h" @@ -22,7 +22,6 @@ #include "xAODTracking/TrackParticleContainer.h" #include "MuonCombinedToolInterfaces/IMuonMomentumBalanceSignificance.h" #include "MuonCombinedToolInterfaces/IMuonScatteringAngleSignificance.h" -#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" #include "MuonSelectorTools/IMuonSelectionTool.h" #include "RecoToolInterfaces/IParticleCaloExtensionTool.h" #include "TrkParametersIdentificationHelpers/TrackParametersIdHelper.h" @@ -31,6 +30,17 @@ #include "xAODMuonCnv/IMuonSegmentConverterTool.h" #include "xAODMuon/MuonSegmentAuxContainer.h" #include "xAODCaloEvent/CaloClusterContainer.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "MuonRecHelperTools/IMuonEDMHelperSvc.h" +#include "MuonCombinedToolInterfaces/IMuonPrintingTool.h" +#include "MuonCombinedToolInterfaces/IMuonMeanMDTdADCFiller.h" +#include "MuidInterfaces/IMuonTrackQuery.h" +#include "TrkToolInterfaces/ITrkMaterialProviderTool.h" +#include "TrkExInterfaces/IPropagator.h" +#include "TrkToolInterfaces/ITrackParticleCreatorTool.h" +#include "TrkToolInterfaces/ITrackAmbiguityProcessorTool.h" + +#include "TrackSegmentAssociationTool.h" #include "TrkSegment/Segment.h" #include "MuonSegment/MuonSegment.h" @@ -42,23 +52,9 @@ #include "StoreGate/ReadCondHandleKey.h" namespace Muon { - class MuonEDMPrinterTool; class MuonSegment; - class TrackSegmentAssociationTool; -} -namespace Trk { - class ITrackParticleCreatorTool; - class ITrackAmbiguityProcessorTool; - class IPropagator; - class ITrkMaterialProviderTool; -} -namespace Rec { - class IMuonPrintingTool; - class IMuonMeanMDTdADCFiller; - class IMuonTrackQuery; } namespace MuonCombined { - class IMuonCombinedTagTool; class StacoTag; class CombinedFitTag; class MuGirlTag; @@ -73,10 +69,9 @@ namespace MuonCombined { public: MuonCreatorTool(const std::string& type, const std::string& name, const IInterface* parent); - ~MuonCreatorTool(void); // destructor + ~MuonCreatorTool()=default; StatusCode initialize(); - StatusCode finalize(); /** IMuonCreatorTool interface: build muons from ID and MS candidates */ void create( const MuonCandidateCollection* muonCandidates, const InDetCandidateCollection* inDetCandidates, std::vector tagMaps, @@ -198,7 +193,7 @@ namespace MuonCombined { //bool m_fillMuonTruthLinks; // helpers, managers, tools - ToolHandle m_idHelper; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle m_printer; ServiceHandle m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.cxx index 2bb6b278f512a3d9bf7fe8827a8e719ce328647e..20b1cbfa2e5da6f4709670b8e333b86eed020b97 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.cxx @@ -1,19 +1,14 @@ /* - 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 "MuonCandidateTrackBuilderTool.h" -#include "MuonRecToolInterfaces/IMuonSegmentTrackBuilder.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "MuidInterfaces/ICombinedMuonTrackBuilder.h" - #include "MuonLayerEvent/MuonCandidate.h" #include "TrkEventPrimitives/FitQuality.h" #include "MuonSegment/MuonSegment.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" #include "TrkCompetingRIOsOnTrack/CompetingRIOsOnTrack.h" -#include "Identifier/Identifier.h" namespace Muon { @@ -21,7 +16,6 @@ namespace Muon { AthAlgTool(type,name,parent), m_muonTrackBuilder("Muon::MooTrackBuilder/MooMuonTrackBuilder"), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_reOrderMeasurements(true), m_trackFitter("Rec::CombinedMuonTrackBuilder/CombinedMuonTrackBuilder") { @@ -33,17 +27,11 @@ namespace Muon { declareProperty("MuonTrackBuilder", m_trackFitter ); } - MuonCandidateTrackBuilderTool::~MuonCandidateTrackBuilderTool() { } - - StatusCode MuonCandidateTrackBuilderTool::finalize() { - return StatusCode::SUCCESS; - } - StatusCode MuonCandidateTrackBuilderTool::initialize() { ATH_CHECK(m_muonTrackBuilder.retrieve()); ATH_CHECK(m_printer.retrieve()); - ATH_CHECK(m_idHelper.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_edmHelperSvc.retrieve()); ATH_CHECK(m_trackFitter.retrieve()); @@ -97,16 +85,16 @@ namespace Muon { // check if valid ID if( !id.is_valid() ) continue; // check if muon - if (!m_idHelper->isMuon(id)) continue; + if (!m_idHelperSvc->isMuon(id)) continue; - if(m_idHelper->isEndcap(id)) { + if(m_idHelperSvc->isEndcap(id)) { isEndcap = true; } else { isBarrel = true; } - if(m_idHelper->isTrigger(id)) continue; + if(m_idHelperSvc->isTrigger(id)) continue; - if(m_idHelper->isSmallChamber(id)) { + if(m_idHelperSvc->isSmallChamber(id)) { isSmall = true; } else { isLarge = true; @@ -116,7 +104,7 @@ namespace Muon { if(m_reOrderMeasurements) { // reorder measurements using SortMeas (defined in header file) - std::stable_sort(containedMeasurements.begin(),containedMeasurements.end(),SortMeas(&*m_edmHelperSvc,&*m_idHelper,isEndcap)); + std::stable_sort(containedMeasurements.begin(),containedMeasurements.end(),SortMeas(&*m_edmHelperSvc,&*m_idHelperSvc,isEndcap)); } // insert in measurements list measurements.insert( measurements.end(), @@ -133,7 +121,7 @@ namespace Muon { if(m_reOrderMeasurements&&reorderAllMeasurements) { // reorder measurements using SortMeas (defined in header file) ATH_MSG_VERBOSE(" reorder all measurements before " << m_printer->print(measurements)) ; - std::stable_sort(measurements.begin(),measurements.end(),SortMeas(&*m_edmHelperSvc,&*m_idHelper,isEndcap)); + std::stable_sort(measurements.begin(),measurements.end(),SortMeas(&*m_edmHelperSvc,&*m_idHelperSvc,isEndcap)); } ATH_MSG_VERBOSE( m_printer->print(measurements)) ; diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.h b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.h index 8ecc829c323c7ccc898d9a71a82dab7def967d30..8f340efaefc459f2e7bcb6f69091e6554103719a 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.h @@ -1,29 +1,27 @@ /* - 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 MUON_MUONCANDIDATETRACKBUILDER_H #define MUON_MUONCANDIDATETRACKBUILDER_H +#include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" + #include "MuonCombinedToolInterfaces/IMuonCandidateTrackBuilderTool.h" #include "TrkMeasurementBase/MeasurementBase.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonIdHelpers/MuonStationIndex.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "MuonRecToolInterfaces/IMuonSegmentTrackBuilder.h" +#include "MuidInterfaces/ICombinedMuonTrackBuilder.h" #include -#include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" - -namespace Rec { - class ICombinedMuonTrackBuilder; -} namespace Muon { - class IMuonSegmentTrackBuilder; - class MuonEDMPrinterTool; struct MuonCandidate; class SortMeas{ @@ -35,32 +33,32 @@ namespace Muon { else { Identifier id1=m_edmHelperSvc->getIdentifier(*mst1); Identifier id2=m_edmHelperSvc->getIdentifier(*mst2); - if(m_idHelper->isMdt(id1) && m_idHelper->isMdt(id2)) return mst1->globalPosition().perp() < mst2->globalPosition().perp(); - else if(m_idHelper->isRpc(id1) && m_idHelper->isMdt(id2)){ - if(m_idHelper->rpcIdHelper().doubletR(id1)==1){ - if(m_idHelper->stationIndex(id2)==MuonStationIndex::StIndex::BM || m_idHelper->isSmallChamber(id2)) return true; + if(m_idHelperSvc->isMdt(id1) && m_idHelperSvc->isMdt(id2)) return mst1->globalPosition().perp() < mst2->globalPosition().perp(); + else if(m_idHelperSvc->isRpc(id1) && m_idHelperSvc->isMdt(id2)){ + if(m_idHelperSvc->rpcIdHelper().doubletR(id1)==1){ + if(m_idHelperSvc->stationIndex(id2)==MuonStationIndex::StIndex::BM || m_idHelperSvc->isSmallChamber(id2)) return true; else return false; } else return false; - }else if(m_idHelper->isRpc(id2) && m_idHelper->isMdt(id1)){ - if(m_idHelper->rpcIdHelper().doubletR(id2)==1){ - if(m_idHelper->stationIndex(id1)==MuonStationIndex::StIndex::BM || m_idHelper->isSmallChamber(id1)) return false; + }else if(m_idHelperSvc->isRpc(id2) && m_idHelperSvc->isMdt(id1)){ + if(m_idHelperSvc->rpcIdHelper().doubletR(id2)==1){ + if(m_idHelperSvc->stationIndex(id1)==MuonStationIndex::StIndex::BM || m_idHelperSvc->isSmallChamber(id1)) return false; else return true; } else return true; } else{ - if(m_idHelper->rpcIdHelper().doubletR(id1)!=m_idHelper->rpcIdHelper().doubletR(id2)){ - return m_idHelper->rpcIdHelper().doubletR(id1)rpcIdHelper().doubletR(id2); + if(m_idHelperSvc->rpcIdHelper().doubletR(id1)!=m_idHelperSvc->rpcIdHelper().doubletR(id2)){ + return m_idHelperSvc->rpcIdHelper().doubletR(id1)rpcIdHelper().doubletR(id2); } else return mst1->globalPosition().perp() < mst2->globalPosition().perp(); } } } - SortMeas(const IMuonEDMHelperSvc* h, const MuonIdHelperTool* idh, bool end ) : m_edmHelperSvc(h),m_idHelper(idh),isEndcap(end) {} + SortMeas(const IMuonEDMHelperSvc* h, const IMuonIdHelperSvc* idh, bool end ) : m_edmHelperSvc(h),m_idHelperSvc(idh),isEndcap(end) {} const IMuonEDMHelperSvc* m_edmHelperSvc; - const MuonIdHelperTool* m_idHelper; + const IMuonIdHelperSvc* m_idHelperSvc; bool isEndcap; }; @@ -69,9 +67,8 @@ namespace Muon { /** Default AlgTool functions */ MuonCandidateTrackBuilderTool(const std::string& type, const std::string& name, const IInterface* parent); - virtual ~MuonCandidateTrackBuilderTool(); + virtual ~MuonCandidateTrackBuilderTool() {}; StatusCode initialize(); - StatusCode finalize(); /**IMuonCandidateTrackBuilderTool interface: buildCombinedTrack */ Trk::Track* buildCombinedTrack( const Trk::Track& idTrack, const MuonCandidate& candidate ) const; @@ -80,7 +77,7 @@ namespace Muon { ToolHandle m_muonTrackBuilder; ToolHandle m_printer; - ToolHandle m_idHelper; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ServiceHandle m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx index ab39347cc4f106c182e4b26fd3bd4b56a51852fc..ecac5cd0eb2988e156abb21ff276b499ed253ad3 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.cxx @@ -1,18 +1,8 @@ /* - 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 "MuonInsideOutRecoTool.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" - -#include "MuonSegmentMakerToolInterfaces/IMuonLayerSegmentFinderTool.h" -#include "MuonCombinedToolInterfaces/IMuonLayerSegmentMatchingTool.h" -#include "MuonCombinedToolInterfaces/IMuonLayerAmbiguitySolverTool.h" -#include "MuonCombinedToolInterfaces/IMuonCandidateTrackBuilderTool.h" -#include "MuonRecToolInterfaces/IMuonRecoValidationTool.h" -#include "TrkToolInterfaces/ITrackAmbiguityProcessorTool.h" -#include "MuidInterfaces/ICombinedMuonTrackBuilder.h" #include "MuonLayerEvent/MuonSystemExtension.h" #include "MuonLayerEvent/MuonCandidate.h" @@ -20,9 +10,6 @@ #include "MuonLayerEvent/MuonLayerPrepRawData.h" #include "MuonIdHelpers/MuonStationIndexHelpers.h" -#include "Identifier/Identifier.h" -#include "Identifier/IdentifierHash.h" - #include "MuonCombinedEvent/MuGirlTag.h" #include "xAODTracking/Vertex.h" @@ -32,7 +19,6 @@ namespace MuonCombined { MuonInsideOutRecoTool::MuonInsideOutRecoTool(const std::string& type, const std::string& name, const IInterface* parent): AthAlgTool(type,name,parent), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"), m_segmentFinder("Muon::MuonLayerSegmentFinderTool/MuonLayerSegmentFinderTool"), m_segmentMatchingTool("Muon::MuonLayerSegmentMatchingTool/MuonLayerSegmentMatchingTool"), @@ -47,7 +33,6 @@ namespace MuonCombined { declareInterface(this); declareInterface(this); - declareProperty("MuonIdHelperTool",m_idHelper ); declareProperty("MuonEDMPrinterTool",m_printer ); declareProperty("MuonLayerSegmentFinderTool",m_segmentFinder ); declareProperty("MuonLayerSegmentMatchingTool",m_segmentMatchingTool ); @@ -61,15 +46,9 @@ namespace MuonCombined { declareProperty("TrackSummeryTool", m_trackSummaryTool ); } - MuonInsideOutRecoTool::~MuonInsideOutRecoTool() { } - - StatusCode MuonInsideOutRecoTool::finalize() { - return StatusCode::SUCCESS; - } - StatusCode MuonInsideOutRecoTool::initialize() { - ATH_CHECK(m_idHelper.retrieve()); + ATH_CHECK(m_idHelperSvc.retrieve()); ATH_CHECK(m_printer.retrieve()); ATH_CHECK(m_segmentFinder.retrieve()); ATH_CHECK(m_segmentMatchingTool.retrieve()); @@ -386,7 +365,7 @@ namespace MuonCombined { if( colIt == input->end() ) { continue; } - ATH_MSG_VERBOSE(" adding " << m_idHelper->toStringChamber((*colIt)->identify()) << " size " << (*colIt)->size()); + ATH_MSG_VERBOSE(" adding " << m_idHelperSvc->toStringChamber((*colIt)->identify()) << " size " << (*colIt)->size()); // else add output.push_back(*colIt); } diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.h b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.h index 24bfc5c839d25a6829dc1de85d989f6d0c2b4e52..27c00a45bf2444bcbfaf16f4fccae7bdd27ce606 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.h +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonInsideOutRecoTool.h @@ -1,43 +1,41 @@ /* - 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 MUON_MUONINSIDEOUTRECOTOOL_H #define MUON_MUONINSIDEOUTRECOTOOL_H -#include "MuonCombinedToolInterfaces/IMuonCombinedInDetExtensionTool.h" #include "MuonLayerEvent/MuonLayerRecoData.h" #include "MuonPrepRawDataProviderTools/MuonLayerHashProviderTool.h" -#include "MuonIdHelpers/MuonStationIndex.h" #include "xAODTracking/VertexContainer.h" -#include "TrkToolInterfaces/ITrackSummaryHelperTool.h" + + #include #include "AthenaBaseComps/AthAlgTool.h" +#include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" +#include "MuonSegmentMakerToolInterfaces/IMuonLayerSegmentFinderTool.h" +#include "MuonCombinedToolInterfaces/IMuonLayerSegmentMatchingTool.h" +#include "MuonCombinedToolInterfaces/IMuonLayerAmbiguitySolverTool.h" +#include "MuonCombinedToolInterfaces/IMuonCandidateTrackBuilderTool.h" +#include "MuonRecToolInterfaces/IMuonRecoValidationTool.h" +#include "MuidInterfaces/ICombinedMuonTrackBuilder.h" +#include "TrkToolInterfaces/ITrackSummaryHelperTool.h" +#include "TrkToolInterfaces/ITrackAmbiguityProcessorTool.h" +#include "MuonCombinedToolInterfaces/IMuonCombinedInDetExtensionTool.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" namespace Muon { struct MuonCandidate; struct MuonLayerPrepRawData; - class MuonIdHelperTool; - class MuonEDMPrinterTool; - class IMuonLayerSegmentFinderTool; - class IMuonLayerSegmentMatchingTool; - class IMuonLayerAmbiguitySolverTool; - class IMuonCandidateTrackBuilderTool; - class IMuonRecoValidationTool; - class ITrackAmbiguityProcessorTool; -} - -namespace Rec { - class ICombinedMuonTrackBuilder; } namespace Trk { class Track; - class ITrackAmbiguityProcessorTool; } static const InterfaceID IID_MuonInsideOutRecoTool("MuonCombined::MuonInsideOutRecoTool",1,0); @@ -49,9 +47,8 @@ namespace MuonCombined { /** Default AlgTool functions */ MuonInsideOutRecoTool(const std::string& type, const std::string& name, const IInterface* parent); - virtual ~MuonInsideOutRecoTool(); + virtual ~MuonInsideOutRecoTool()=default; virtual StatusCode initialize() override; - virtual StatusCode finalize() override; /** @brief access to tool interface */ static const InterfaceID& interfaceID() { return IID_MuonInsideOutRecoTool; } @@ -86,8 +83,7 @@ namespace MuonCombined { bool getLayerDataTech( int sector, Muon::MuonStationIndex::TechnologyIndex technology, Muon::MuonStationIndex::DetectorRegionIndex regionIndex, Muon::MuonStationIndex::LayerIndex layerIndex, const Muon::MuonPrepDataContainer< COL >* input, std::vector& output ); - /** tool handles */ - ToolHandle m_idHelper; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; ToolHandle m_printer; ToolHandle m_segmentFinder; ToolHandle m_segmentMatchingTool; diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.cxx index 2ed3681b5882cf6c16d80c901fd262d0a970b273..09f30fbab1d9dbc7a69a5c386a9ea544e988d3e1 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonLayerAmbiguitySolverTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "MuonLayerAmbiguitySolverTool.h" @@ -9,7 +9,6 @@ #include "MuonRecToolInterfaces/IMuonSegmentTrackBuilder.h" #include "MuonRecHelperTools/MuonEDMPrinterTool.h" -#include "MuonIdHelpers/MuonStationIndexHelpers.h" #include "MuonLayerEvent/MuonCandidate.h" #include "TrkEventPrimitives/FitQuality.h" #include "MuonSegment/MuonSegment.h" diff --git a/Reconstruction/MuonIdentification/MuonSpShowerBuilderAlgs/MuonSpShowerBuilderAlgs/MuonSpShowerBuilder.h b/Reconstruction/MuonIdentification/MuonSpShowerBuilderAlgs/MuonSpShowerBuilderAlgs/MuonSpShowerBuilder.h index df8c531acf8c76875f9e0962e69f52b17db40581..df26eda96c6602a380986d3edef34ad82e6c8de9 100644 --- a/Reconstruction/MuonIdentification/MuonSpShowerBuilderAlgs/MuonSpShowerBuilderAlgs/MuonSpShowerBuilder.h +++ b/Reconstruction/MuonIdentification/MuonSpShowerBuilderAlgs/MuonSpShowerBuilderAlgs/MuonSpShowerBuilder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONSPSHOWERBUILDER_H @@ -27,11 +27,9 @@ RPC and TGC hits might also be used. *****************************************************************************/ #include "AthenaBaseComps/AthAlgorithm.h" +#include "GaudiKernel/ServiceHandle.h" -namespace MuonGM { -class MuonDetectorManager; -} -class MuonIdHelper; +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include #include @@ -40,10 +38,9 @@ class MuonSpShowerBuilder : public AthAlgorithm { public: MuonSpShowerBuilder(const std::string& name, ISvcLocator* pSvcLocator); - ~MuonSpShowerBuilder(); + ~MuonSpShowerBuilder()=default; StatusCode initialize(); - StatusCode finalize(); StatusCode execute(); private: @@ -65,8 +62,7 @@ class MuonSpShowerBuilder : public AthAlgorithm { std::string m_MuonSpShowerKey; - const MuonGM::MuonDetectorManager* m_MuonMgr; - const MuonIdHelper* m_muonHelper; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; diff --git a/Reconstruction/MuonIdentification/MuonSpShowerBuilderAlgs/src/MuonSpShowerBuilder.cxx b/Reconstruction/MuonIdentification/MuonSpShowerBuilderAlgs/src/MuonSpShowerBuilder.cxx index 17f15b4ca8df25a639e75b0115ba75a43762c055..728597d29b2f82d25037c62a3f1c53089675ac66 100644 --- a/Reconstruction/MuonIdentification/MuonSpShowerBuilderAlgs/src/MuonSpShowerBuilder.cxx +++ b/Reconstruction/MuonIdentification/MuonSpShowerBuilderAlgs/src/MuonSpShowerBuilder.cxx @@ -1,22 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -/***************************************************************************** -Name : MuonSpShowerBuilder.cxx -Package : offline/PhysicsAnalysis/EventViewBuilder/EventViewBuilderAlgs -Author : Frank Paige, Stephane Willocq -Created : August 2006 - -DESCRIPTION: - -See MuonSpShowerBuilder.h. - - -*****************************************************************************/ - -// Include files - #include "MuonSpShowerBuilderAlgs/MuonSpShowerBuilder.h" #include "muonEvent/MuonSpShower.h" #include "muonEvent/MuonSpShowerContainer.h" @@ -28,8 +13,6 @@ See MuonSpShowerBuilder.h. #include "MuonPrepRawData/MdtPrepData.h" #include "MuonPrepRawData/MuonPrepDataContainer.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" -#include "MuonIdHelpers/MuonIdHelper.h" -#include "MuonIdHelpers/MuonStationIndex.h" #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "xAODMuon/MuonSegmentContainer.h" @@ -37,10 +20,6 @@ See MuonSpShowerBuilder.h. #include -///////////////////////////////////////////////////////////////// -// Constructor -///////////////////////////////////////////////////////////////// - MuonSpShowerBuilder::MuonSpShowerBuilder(const std::string& name, ISvcLocator* pSvcLocator) : AthAlgorithm(name, pSvcLocator), m_JetCollectionKey("Cone7H1TowerJets"), // input jets @@ -55,9 +34,7 @@ MuonSpShowerBuilder::MuonSpShowerBuilder(const std::string& name, m_triggerHitCut(0), // minimum hits m_mdtHitCut(0), // minimum hits m_muonSegmentCut(0), // minimum segments - m_MuonSpShowerKey("MuonSpShowers"), // Storegate key - m_MuonMgr(0), - m_muonHelper(0) + m_MuonSpShowerKey("MuonSpShowers") // Storegate key { declareProperty("JetCollectionKey", m_JetCollectionKey); declareProperty("jetPtCut", m_jetPtCut); @@ -74,43 +51,14 @@ MuonSpShowerBuilder::MuonSpShowerBuilder(const std::string& name, } -///////////////////////////////////////////////////////////////// -// Destructor -///////////////////////////////////////////////////////////////// - -MuonSpShowerBuilder::~MuonSpShowerBuilder() {} - -///////////////////////////////////////////////////////////////// -// Initialize -///////////////////////////////////////////////////////////////// - StatusCode MuonSpShowerBuilder::initialize() { - ATH_MSG_INFO("Initializing MuonSpShowerBuilder"); - StatusCode sc = detStore()->retrieve( m_MuonMgr ); - if ( sc.isFailure() ) { - ATH_MSG_ERROR(" Cannot retrieve MuonDetDescrMgr "); - } else { - m_muonHelper = m_MuonMgr->mdtIdHelper(); - } + ATH_CHECK(m_idHelperSvc.retrieve()); return StatusCode::SUCCESS; - } -///////////////////////////////////////////////////////////////// -// Finalize -///////////////////////////////////////////////////////////////// - -StatusCode MuonSpShowerBuilder::finalize() { - return StatusCode::SUCCESS; -} - -///////////////////////////////////////////////////////////////// -// Execute -///////////////////////////////////////////////////////////////// - StatusCode MuonSpShowerBuilder::execute() { ATH_MSG_DEBUG("Executing MuonSpShowerBuilder"); @@ -238,7 +186,7 @@ StatusCode MuonSpShowerBuilder::execute() { if( fabs(etah-etaj)>m_etaCut || dphihj>m_phiCut ) continue; // 0 = inner, 1 = EE, 2 = middle, 3 = outer // We combine 1 and 2 - int layer = m_muonHelper->stationRegion( (*mdtItr)->identify() ); + int layer = m_idHelperSvc->mdtIdHelper().stationRegion( (*mdtItr)->identify() ); if( layer > 1 ) --layer; ++nHit[layer]; } diff --git a/Reconstruction/RecBackground/RecBackgroundAlgs/CMakeLists.txt b/Reconstruction/RecBackground/RecBackgroundAlgs/CMakeLists.txt index 8d5a73b5c8af81fc8b41f1b967051f71252285d3..3a78e1a15ce6eeaf5195b58a5df116b05b057ab8 100644 --- a/Reconstruction/RecBackground/RecBackgroundAlgs/CMakeLists.txt +++ b/Reconstruction/RecBackground/RecBackgroundAlgs/CMakeLists.txt @@ -13,7 +13,6 @@ atlas_depends_on_subdirs( PUBLIC Event/xAOD/xAODEventInfo Event/xAOD/xAODJet GaudiKernel - MuonSpectrometer/MuonCalib/MuonCalibITools MuonSpectrometer/MuonIdHelpers MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonRecHelperTools @@ -40,7 +39,7 @@ atlas_add_component( RecBackgroundAlgs src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AthLinks AthenaBaseComps xAODCaloEvent xAODEventInfo xAODJet GaudiKernel MuonCalibITools MuonIdHelpersLib MuonSegment MuonRecHelperToolsLib RecBackgroundEvent TrkSegment CaloGeoHelpers AthenaKernel StoreGateLib SGtests GeoPrimitives LUCID_RawEvent LArRecEvent MuonPrepRawData TagEvent TileEvent ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} AthLinks AthenaBaseComps xAODCaloEvent xAODEventInfo xAODJet GaudiKernel MuonIdHelpersLib MuonSegment MuonRecHelperToolsLib RecBackgroundEvent TrkSegment CaloGeoHelpers AthenaKernel StoreGateLib SGtests GeoPrimitives LUCID_RawEvent LArRecEvent MuonPrepRawData TagEvent TileEvent ) # Install files from the package: atlas_install_headers( RecBackgroundAlgs ) diff --git a/Reconstruction/RecBackground/RecBackgroundAlgs/RecBackgroundAlgs/BeamBackgroundFiller.h b/Reconstruction/RecBackground/RecBackgroundAlgs/RecBackgroundAlgs/BeamBackgroundFiller.h index d9d140298c74d32ff670988ef31d28f376bdf03b..a1ab60154fd0731ffaac183c8b5fb11c74f39f66 100644 --- a/Reconstruction/RecBackground/RecBackgroundAlgs/RecBackgroundAlgs/BeamBackgroundFiller.h +++ b/Reconstruction/RecBackground/RecBackgroundAlgs/RecBackgroundAlgs/BeamBackgroundFiller.h @@ -1,8 +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 */ -// $Id: BeamBackgroundFiller.h 693115 2015-09-04 07:22:39Z salekd $ #ifndef RECBACKGROUNDALGS_BEAMBACKGROUNDFILLER #define RECBACKGROUNDALGS_BEAMBACKGROUNDFILLER @@ -12,9 +11,7 @@ #include "MuonSegment/MuonSegment.h" #include "MuonRecHelperTools/IMuonEDMHelperSvc.h" -#include "MuonIdHelpers/MuonIdHelperTool.h" -#include "MuonIdHelpers/MuonStationIndex.h" -#include "MuonCalibITools/IIdToFixedIdTool.h" +#include "MuonIdHelpers/IMuonIdHelperSvc.h" #include "TrkSegment/Segment.h" #include "TrkSegment/SegmentCollection.h" #include "xAODCaloEvent/CaloClusterContainer.h" @@ -40,11 +37,10 @@ class BeamBackgroundFiller : public AthAlgorithm { public: BeamBackgroundFiller(const std::string& name, ISvcLocator* pSvcLocator); - ~BeamBackgroundFiller(); + ~BeamBackgroundFiller()=default; StatusCode initialize(); StatusCode execute(); - StatusCode finalize(); private: // Function matching calorimeter clusters with muon segments @@ -130,13 +126,10 @@ private: ElementLinkVector m_indexJet; // link to the jet std::vector m_resultJet; // summary of the results for each jet - - // tools ServiceHandle m_edmHelperSvc {this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc", "Handle to the service providing the IMuonEDMHelperSvc interface" }; - ToolHandle m_idHelperTool; - ToolHandle m_idToFixedIdTool; + ServiceHandle m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; }; #endif diff --git a/Reconstruction/RecBackground/RecBackgroundAlgs/src/BeamBackgroundFiller.cxx b/Reconstruction/RecBackground/RecBackgroundAlgs/src/BeamBackgroundFiller.cxx index 872fc7ff659a6265c468014633bb746831da3207..cf251d16dda37ec8aa7aee53f4b2d3da393dd04f 100644 --- a/Reconstruction/RecBackground/RecBackgroundAlgs/src/BeamBackgroundFiller.cxx +++ b/Reconstruction/RecBackground/RecBackgroundAlgs/src/BeamBackgroundFiller.cxx @@ -1,8 +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 */ -// $Id: BeamBackgroundFiller.cxx 765686 2016-08-01 01:06:35Z ssnyder $ #include "RecBackgroundAlgs/BeamBackgroundFiller.h" #include "AthenaKernel/errorcheck.h" #include "GeoPrimitives/GeoPrimitives.h" @@ -11,6 +10,12 @@ #include "xAODJet/JetConstituentVector.h" #include "CaloGeoHelpers/CaloSampling.h" +#include + +namespace { + static constexpr float const& myConst = 1e-3/3e8/1e-9; +} + //------------------------------------------------------------------------------ BeamBackgroundFiller::BeamBackgroundFiller(const std::string& name, ISvcLocator* pSvcLocator) : @@ -30,9 +35,7 @@ BeamBackgroundFiller::BeamBackgroundFiller(const std::string& name, m_numTwoSided(0), m_numClusterShape(0), m_numJet(0), - m_direction(0), - m_idHelperTool("Muon::MuonIdHelperTool"), - m_idToFixedIdTool("MuonCalib::IdToFixedIdTool") + m_direction(0) { declareProperty("doMuonBoyCSCTiming", m_doMuonBoyCSCTiming = true); @@ -62,20 +65,12 @@ BeamBackgroundFiller::BeamBackgroundFiller(const std::string& name, } - -//------------------------------------------------------------------------------ -BeamBackgroundFiller::~BeamBackgroundFiller() -{ -} - - //------------------------------------------------------------------------------ StatusCode BeamBackgroundFiller::initialize() { CHECK( m_edmHelperSvc.retrieve() ); - CHECK( m_idHelperTool.retrieve() ); - CHECK( m_idToFixedIdTool.retrieve() ); + CHECK( m_idHelperSvc.retrieve() ); - if (m_idHelperTool->hasCSC()) ATH_CHECK(m_cscSegmentContainerReadHandleKey.initialize()); + if (m_idHelperSvc->hasCSC()) ATH_CHECK(m_cscSegmentContainerReadHandleKey.initialize()); ATH_CHECK(m_mdtSegmentContainerReadHandleKey.initialize()); ATH_CHECK(m_caloClusterContainerReadHandleKey.initialize()); ATH_CHECK(m_jetContainerReadHandleKey.initialize()); @@ -127,7 +122,7 @@ void BeamBackgroundFiller::FillMatchMatrix() m_matchMatrix.clear(); m_resultClus.clear(); - if (m_idHelperTool->hasCSC()) { + if (m_idHelperSvc->hasCSC()) { // select only the CSC segments with the global direction parallel to the beam pipe SG::ReadHandle cscSegmentReadHandle(m_cscSegmentContainerReadHandleKey); @@ -146,17 +141,17 @@ void BeamBackgroundFiller::FillMatchMatrix() Identifier id = m_edmHelperSvc->chamberId(*seg); if ( !id.is_valid() ) continue; - if ( !m_idHelperTool->isMuon(id) ) continue; + if ( !m_idHelperSvc->isMuon(id) ) continue; - if ( !m_idHelperTool->isCsc(id) ) continue; + if ( !m_idHelperSvc->isCsc(id) ) continue; const Amg::Vector3D& globalPos = seg->globalPosition(); const Amg::Vector3D& globalDir = seg->globalDirection(); double thetaPos = globalPos.theta(); double thetaDir = globalDir.theta(); - double d2r = TMath::Pi()/180.; - if( TMath::Cos(2.*(thetaPos-thetaDir)) > TMath::Cos(2.*m_cutThetaCsc*d2r) ) continue; + double d2r = M_PI/180.; + if( std::cos(2.*(thetaPos-thetaDir)) > std::cos(2.*m_cutThetaCsc*d2r) ) continue; ElementLink segLink; segLink.toIndexedElement(*cscSegmentReadHandle, cscSegmentCounter-1); @@ -183,9 +178,9 @@ void BeamBackgroundFiller::FillMatchMatrix() Identifier id = m_edmHelperSvc->chamberId(*seg); if ( !id.is_valid() ) continue; - if ( !m_idHelperTool->isMuon(id) ) continue; + if ( !m_idHelperSvc->isMuon(id) ) continue; - Muon::MuonStationIndex::ChIndex chIndex = m_idHelperTool->chamberIndex(id); + Muon::MuonStationIndex::ChIndex chIndex = m_idHelperSvc->chamberIndex(id); if(!( chIndex == Muon::MuonStationIndex::EIL || chIndex == Muon::MuonStationIndex::EIS )) continue; @@ -195,7 +190,7 @@ void BeamBackgroundFiller::FillMatchMatrix() double thetaDir = globalDir.theta(); double d2r = M_PI/180.; - if( TMath::Cos(2.*(thetaPos-thetaDir)) > TMath::Cos(2.*m_cutThetaMdtI*d2r) ) continue; + if( std::cos(2.*(thetaPos-thetaDir)) > std::cos(2.*m_cutThetaMdtI*d2r) ) continue; ElementLink segLink; segLink.toIndexedElement(*mdtSegmentReadHandle, mdtSegmentCounter-1); @@ -273,7 +268,7 @@ void BeamBackgroundFiller::FillMatchMatrix() if (!seg) std::abort(); Identifier id = m_edmHelperSvc->chamberId(*seg); - bool isCsc = m_idHelperTool->isCsc(id); + bool isCsc = m_idHelperSvc->isCsc(id); const Amg::Vector3D& globalPos = seg->globalPosition(); double phiSeg = globalPos.phi(); @@ -281,12 +276,12 @@ void BeamBackgroundFiller::FillMatchMatrix() // match in phi double d2r = M_PI/180.; - if( TMath::Cos(phiClus-phiSeg) < TMath::Cos(m_cutPhiCsc*d2r) && isCsc ) continue; - if( TMath::Cos(phiClus-phiSeg) < TMath::Cos(m_cutPhiMdtI*d2r) && !isCsc ) continue; + if( std::cos(phiClus-phiSeg) < std::cos(m_cutPhiCsc*d2r) && isCsc ) continue; + if( std::cos(phiClus-phiSeg) < std::cos(m_cutPhiMdtI*d2r) && !isCsc ) continue; // match in radius - if( TMath::Abs(rClus-rSeg) > m_cutRadiusCsc && isCsc ) continue; - if( TMath::Abs(rClus-rSeg) > m_cutRadiusMdtI && !isCsc ) continue; + if( std::fabs(rClus-rSeg) > m_cutRadiusCsc && isCsc ) continue; + if( std::fabs(rClus-rSeg) > m_cutRadiusMdtI && !isCsc ) continue; matchedSegmentsPerCluster[j] = 1; matched = true; @@ -340,18 +335,11 @@ void BeamBackgroundFiller::SegmentMethod() // muon segment: in-time (1), early (2), ambiguous (0) int timeStatus = 0; - double inTime = -(-TMath::Abs(zSeg) + globalPos.mag())*(1e-3/3e8/1e-9); - double early = -( TMath::Abs(zSeg) + globalPos.mag())*(1e-3/3e8/1e-9); - if( TMath::Abs(tSeg - inTime) < m_cutMuonTime ) timeStatus = 1; - if( TMath::Abs(tSeg - early ) < m_cutMuonTime ) timeStatus = 2; -/* - // also take the CSC segments that fall outside of the time readout window on the early side - // CscTimeStatus::CscTimeEarly could be used here - Identifier id = m_edmHelperSvc->chamberId(*seg); - MuonCalib::MuonFixedId fid = m_idToFixedIdTool->idToFixedId( id ) ; - int stationName = fid.stationName(); - if( tSeg < early && (stationName==33 || stationName==34) ) timeStatus = 2; -*/ + double inTime = -(-std::fabs(zSeg) + globalPos.mag())*myConst; + double early = -( std::fabs(zSeg) + globalPos.mag())*myConst; + if( std::fabs(tSeg - inTime) < m_cutMuonTime ) timeStatus = 1; + if( std::fabs(tSeg - early ) < m_cutMuonTime ) timeStatus = 2; + if( timeStatus == 2 ) { m_numSegmentEarly++; m_resultSeg[segIndex] = m_resultSeg[segIndex] | BeamBackgroundData::SegmentEarly; @@ -384,23 +372,16 @@ void BeamBackgroundFiller::SegmentMethod() // muon segment: in-time (1), early (2), ambiguous (0) int timeStatusC = 0; - double inTime = -(-TMath::Abs(zSegC) + globalPos.mag())*(1e-3/3e8/1e-9); - double early = -( TMath::Abs(zSegC) + globalPos.mag())*(1e-3/3e8/1e-9); - if( TMath::Abs(tSegC - inTime) < m_cutMuonTime ) timeStatusC = 1; - if( TMath::Abs(tSegC - early ) < m_cutMuonTime ) timeStatusC = 2; -/* - // also take the CSC segments that fall outside of the time readout window on the early side - // CscTimeStatus::CscTimeEarly could be used here - Identifier id = m_edmHelperSvc->chamberId(*seg); - MuonCalib::MuonFixedId fid = m_idToFixedIdTool->idToFixedId( id ) ; - int stationName = fid.stationName(); - if( tSegC < early && (stationName==33 || stationName==34) ) timeStatus = 2; -*/ + double inTime = -(-std::fabs(zSegC) + globalPos.mag())*myConst; + double early = -( std::fabs(zSegC) + globalPos.mag())*myConst; + if( std::fabs(tSegC - inTime) < m_cutMuonTime ) timeStatusC = 1; + if( std::fabs(tSegC - early ) < m_cutMuonTime ) timeStatusC = 2; + double phiSegC = globalPos.phi(); // match in phi double d2r = M_PI/180.; - if( TMath::Cos(phiSegA-phiSegC) < TMath::Cos(m_cutPhiSeg*d2r) ) continue; + if( std::cos(phiSegA-phiSegC) < std::cos(m_cutPhiSeg*d2r) ) continue; m_numSegmentACNoTime++; @@ -411,7 +392,7 @@ void BeamBackgroundFiller::SegmentMethod() if( timeStatusA == 0 || timeStatusC == 0 ) continue; // check the time difference - if( TMath::Abs(tSegA - tSegC) > m_cutTimeDiffAC ) { + if( std::fabs(tSegA - tSegC) > m_cutTimeDiffAC ) { m_numSegmentAC++; m_resultSeg[segIndexA] = m_resultSeg[segIndexA] | BeamBackgroundData::SegmentAC; m_resultSeg[segIndexC] = m_resultSeg[segIndexC] | BeamBackgroundData::SegmentAC; @@ -455,8 +436,8 @@ void BeamBackgroundFiller::OneSidedMethod() double tClus = clus->time(); // calculate expected cluster time - double expectedClusterTimeAC = -( zClus + TMath::Sqrt(rClus*rClus + zClus*zClus))*(1e-3/3e8/1e-9); - double expectedClusterTimeCA = -(-zClus + TMath::Sqrt(rClus*rClus + zClus*zClus))*(1e-3/3e8/1e-9); + double expectedClusterTimeAC = -( zClus + std::sqrt(rClus*rClus + zClus*zClus))*myConst; + double expectedClusterTimeCA = -(-zClus + std::sqrt(rClus*rClus + zClus*zClus))*myConst; for(unsigned int segIndex=0; segIndexchamberId(*seg); - MuonCalib::MuonFixedId fid = m_idToFixedIdTool->idToFixedId( id ) ; - int stationName = fid.stationName(); - if( tSeg < early && (stationName==33 || stationName==34) ) timeStatus = 2; -*/ + double inTime = -(-std::fabs(zSeg) + globalPos.mag())*myConst; + double early = -( std::fabs(zSeg) + globalPos.mag())*myConst; + if( std::fabs(tSeg - inTime) < m_cutMuonTime ) timeStatus = 1; + if( std::fabs(tSeg - early ) < m_cutMuonTime ) timeStatus = 2; + // reconstruct beam background direction: A->C (1), C->A (-1) int direction = 0; if( (zSeg>0 && timeStatus==2) || (zSeg<0 && timeStatus==1) ) direction = 1; @@ -491,39 +465,39 @@ void BeamBackgroundFiller::OneSidedMethod() // check the cluster time without the beam background direction information - if( TMath::Abs(tClus - expectedClusterTimeAC) < m_cutClusTime || - TMath::Abs(tClus - expectedClusterTimeCA) < m_cutClusTime ) { + if( std::fabs(tClus - expectedClusterTimeAC) < m_cutClusTime || + std::fabs(tClus - expectedClusterTimeCA) < m_cutClusTime ) { m_matchMatrix[clusIndex][segIndex] = m_matchMatrix[clusIndex][segIndex] | BeamBackgroundData::NoTimeLoose; } - if( (TMath::Abs(tClus - expectedClusterTimeAC) < m_cutClusTime && -tClus > m_cutClusTime) || - (TMath::Abs(tClus - expectedClusterTimeCA) < m_cutClusTime && -tClus > m_cutClusTime) ) { + if( (std::fabs(tClus - expectedClusterTimeAC) < m_cutClusTime && -tClus > m_cutClusTime) || + (std::fabs(tClus - expectedClusterTimeCA) < m_cutClusTime && -tClus > m_cutClusTime) ) { m_matchMatrix[clusIndex][segIndex] = m_matchMatrix[clusIndex][segIndex] | BeamBackgroundData::NoTimeMedium; } - if( (TMath::Abs(tClus - expectedClusterTimeAC) < m_cutClusTime && -tClus > 2.*m_cutClusTime) || - (TMath::Abs(tClus - expectedClusterTimeCA) < m_cutClusTime && -tClus > 2.*m_cutClusTime) ) { + if( (std::fabs(tClus - expectedClusterTimeAC) < m_cutClusTime && -tClus > 2.*m_cutClusTime) || + (std::fabs(tClus - expectedClusterTimeCA) < m_cutClusTime && -tClus > 2.*m_cutClusTime) ) { m_matchMatrix[clusIndex][segIndex] = m_matchMatrix[clusIndex][segIndex] | BeamBackgroundData::NoTimeTight; } // check the cluster time with the beam background direction information if( direction == 1 ) { - if( TMath::Abs(tClus - expectedClusterTimeAC) < m_cutClusTime ) { + if( std::fabs(tClus - expectedClusterTimeAC) < m_cutClusTime ) { m_matchMatrix[clusIndex][segIndex] = m_matchMatrix[clusIndex][segIndex] | BeamBackgroundData::OneSidedLoose; } - if( TMath::Abs(tClus - expectedClusterTimeAC) < m_cutClusTime && -tClus > m_cutClusTime ) { + if( std::fabs(tClus - expectedClusterTimeAC) < m_cutClusTime && -tClus > m_cutClusTime ) { m_matchMatrix[clusIndex][segIndex] = m_matchMatrix[clusIndex][segIndex] | BeamBackgroundData::OneSidedMedium; } - if( TMath::Abs(tClus - expectedClusterTimeAC) < m_cutClusTime && -tClus > 2.*m_cutClusTime ) { + if( std::fabs(tClus - expectedClusterTimeAC) < m_cutClusTime && -tClus > 2.*m_cutClusTime ) { m_matchMatrix[clusIndex][segIndex] = m_matchMatrix[clusIndex][segIndex] | BeamBackgroundData::OneSidedTight; } } else if( direction == -1 ) { - if( TMath::Abs(tClus - expectedClusterTimeCA) < m_cutClusTime ) { + if( std::fabs(tClus - expectedClusterTimeCA) < m_cutClusTime ) { m_matchMatrix[clusIndex][segIndex] = m_matchMatrix[clusIndex][segIndex] | BeamBackgroundData::OneSidedLoose; } - if( TMath::Abs(tClus - expectedClusterTimeCA) < m_cutClusTime && -tClus > m_cutClusTime ) { + if( std::fabs(tClus - expectedClusterTimeCA) < m_cutClusTime && -tClus > m_cutClusTime ) { m_matchMatrix[clusIndex][segIndex] = m_matchMatrix[clusIndex][segIndex] | BeamBackgroundData::OneSidedMedium; } - if( TMath::Abs(tClus - expectedClusterTimeCA) < m_cutClusTime && -tClus > 2.*m_cutClusTime ) { + if( std::fabs(tClus - expectedClusterTimeCA) < m_cutClusTime && -tClus > 2.*m_cutClusTime ) { m_matchMatrix[clusIndex][segIndex] = m_matchMatrix[clusIndex][segIndex] | BeamBackgroundData::OneSidedTight; } } @@ -575,18 +549,11 @@ void BeamBackgroundFiller::TwoSidedMethod() // muon segment: in-time (1), early (2), ambiguous (0) int timeStatusA = 0; - double inTime = -(-TMath::Abs(zSegA) + globalPos.mag())*(1e-3/3e8/1e-9); - double early = -( TMath::Abs(zSegA) + globalPos.mag())*(1e-3/3e8/1e-9); - if( TMath::Abs(tSegA - inTime) < m_cutMuonTime ) timeStatusA = 1; - if( TMath::Abs(tSegA - early ) < m_cutMuonTime ) timeStatusA = 2; -/* - // also take the CSC segments that fall outside of the time readout window on the early side - // CscTimeStatus::CscTimeEarly could be used here - Identifier id = m_edmHelperSvc->chamberId(*seg); - MuonCalib::MuonFixedId fid = m_idToFixedIdTool->idToFixedId( id ) ; - int stationName = fid.stationName(); - if( tSegA < early && (stationName==33 || stationName==34) ) timeStatusA = 2; -*/ + double inTime = -(-std::fabs(zSegA) + globalPos.mag())*myConst; + double early = -( std::fabs(zSegA) + globalPos.mag())*myConst; + if( std::fabs(tSegA - inTime) < m_cutMuonTime ) timeStatusA = 1; + if( std::fabs(tSegA - early ) < m_cutMuonTime ) timeStatusA = 2; + // take only the segments on side A (z > 0) if( zSegA < 0. ) continue; @@ -605,18 +572,11 @@ void BeamBackgroundFiller::TwoSidedMethod() // muon segment: in-time (1), early (2), ambiguous (0) int timeStatusC = 0; - double inTime = -(-TMath::Abs(zSegC) + globalPos.mag())*(1e-3/3e8/1e-9); - double early = -( TMath::Abs(zSegC) + globalPos.mag())*(1e-3/3e8/1e-9); - if( TMath::Abs(tSegC - inTime) < m_cutMuonTime ) timeStatusC = 1; - if( TMath::Abs(tSegC - early ) < m_cutMuonTime ) timeStatusC = 2; -/* - // also take the CSC segments that fall outside of the time readout window on the early side - // CscTimeStatus::CscTimeEarly could be used here - Identifier id = m_edmHelperSvc->chamberId(*seg); - MuonCalib::MuonFixedId fid = m_idToFixedIdTool->idToFixedId( id ) ; - int stationName = fid.stationName(); - if( tSegC < early && (stationName==33 || stationName==34) ) timeStatusC = 2; -*/ + double inTime = -(-std::fabs(zSegC) + globalPos.mag())*myConst; + double early = -( std::fabs(zSegC) + globalPos.mag())*myConst; + if( std::fabs(tSegC - inTime) < m_cutMuonTime ) timeStatusC = 1; + if( std::fabs(tSegC - early ) < m_cutMuonTime ) timeStatusC = 2; + // take only the segments on side C (z < 0) if( zSegC > 0. ) continue; @@ -630,7 +590,7 @@ void BeamBackgroundFiller::TwoSidedMethod() if( timeStatusA == 0 || timeStatusC == 0 ) continue; // check the time difference - if( TMath::Abs(tSegA - tSegC) > m_cutTimeDiffAC ) { + if( std::fabs(tSegA - tSegC) > m_cutTimeDiffAC ) { m_matchMatrix[clusIndex][segIndexA] = m_matchMatrix[clusIndex][segIndexA] | BeamBackgroundData::TwoSided; m_matchMatrix[clusIndex][segIndexC] = m_matchMatrix[clusIndex][segIndexC] | BeamBackgroundData::TwoSided; m_resultSeg[segIndexA] = m_resultSeg[segIndexA] | m_matchMatrix[clusIndex][segIndexA]; @@ -857,8 +817,3 @@ void BeamBackgroundFiller::FillBeamBackgroundData(SG::WriteHandle