Skip to content
Snippets Groups Projects
Commit 6ddb88df authored by Walter Lampl's avatar Walter Lampl
Browse files

Merge branch 'ATLASRECTS-6139' into 'master'

MuTagMatchingTool - Add explicit geometry dependence & resolve FPE

See merge request atlas/athena!42128
parents ebc3af9f b56a1e91
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ atlas_subdir( MuonSegmentTaggerTools )
atlas_add_library( MuonSegmentTaggerToolsLib
src/*.cxx
NO_PUBLIC_HEADERS
LINK_LIBRARIES GaudiKernel StoreGateLib SGtests MuonIdHelpersLib MuonRecHelperToolsLib
LINK_LIBRARIES GaudiKernel StoreGateLib SGtests MuonIdHelpersLib MuonRecHelperToolsLib TrkDetDescrInterfaces
PRIVATE_LINK_LIBRARIES AthenaBaseComps Identifier EventPrimitives MuonReadoutGeometry MuonRIO_OnTrack MuonSegment MuonSegmentMakerUtils MuonCombinedEvent TrkGeometry TrkSurfaces TrkCompetingRIOsOnTrack TrkEventPrimitives TrkParameters TrkSegment TrkTrack TrkExInterfaces TrkToolInterfaces MuonSegmentTaggerToolInterfaces )
atlas_add_component( MuonSegmentTaggerTools
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#include "MuTagMatchingTool.h"
......@@ -25,26 +25,6 @@
#include "TrkSurfaces/Surface.h"
#include "TrkTrack/Track.h"
namespace {
// local helper functions
#if 0
/** Limit deltaPhi between -pi < dPhi <= +pi */
inline double limit_deltaPhi(double deltaPhi) {
while (deltaPhi > +M_PI) deltaPhi -= 2.*M_PI;
while (deltaPhi <= -M_PI) deltaPhi += 2.*M_PI;
return deltaPhi;
}
/** Limit deltaTheta between -pi/2 < dPhi <= +pi/2 */
inline double limit_deltaTheta(double deltaTheta) {
while (deltaTheta > +M_PI/2.) deltaTheta -= M_PI;
while (deltaTheta <= -M_PI/2.) deltaTheta += M_PI;
return deltaTheta;
}
#endif
} // namespace
MuTagMatchingTool::MuTagMatchingTool(const std::string& t, const std::string& n, const IInterface* p)
: AthAlgTool(t, n, p)
......@@ -129,6 +109,13 @@ MuTagMatchingTool::initialize()
ATH_CHECK(m_printer.retrieve());
ATH_CHECK(m_pullCalculator.retrieve());
if (!m_trackingGeometryReadKey.empty()) {
ATH_CHECK(m_trackingGeometryReadKey.initialize());
} else {
ATH_CHECK(m_trackingGeometrySvc.retrieve());
}
return StatusCode::SUCCESS;
}
......@@ -230,31 +217,16 @@ MuTagMatchingTool::surfaceMatch(const Trk::TrackParameters* atSurface, const Muo
const Trk::TrackParameters*
MuTagMatchingTool::ExtrapolateTrktoMSEntrance(const Trk::Track* pTrack, Trk::PropDirection direction) const
{
if (pTrack == 0) return 0;
StatusCode sc;
const Trk::TrackingGeometry* trackingGeometry = 0;
sc = detStore()->retrieve(trackingGeometry, "AtlasTrackingGeometry");
if (sc.isFailure()) {
ATH_MSG_FATAL("Could not find tracking geometry. Exiting.");
return 0;
}
if (!pTrack) return nullptr;
const Trk::TrackParameters* exTrk = nullptr;
const Trk::TrackingVolume* MSEntranceVolume = trackingGeometry->trackingVolume("MuonSpectrometerEntrance");
// if( m_extrapolatePerigee ){
exTrk =
p_IExtrapolator->extrapolateToVolume(*(pTrack->perigeeParameters()), *MSEntranceVolume, direction, Trk::muon);
// } else { // using perigee parameters arbitrarily; to be changed if new extrapolateToVolume is available
// exTrk = p_IExtrapolator->extrapolateToVolume( *( pTrack->trackParameters() ),
// *MSEntranceVolume,
// direction,
// Trk::muon ) ;
// }
const Trk::TrackingVolume* MSEntranceVolume = getVolume("MuonSpectrometerEntrance");
if (!MSEntranceVolume){
return nullptr;
}
exTrk = p_IExtrapolator->extrapolateToVolume(*(pTrack->perigeeParameters()), *MSEntranceVolume, direction, Trk::muon);
if (!exTrk)
ATH_MSG_DEBUG("Track could not be extrapolated to MS entrance...");
else
......@@ -385,11 +357,9 @@ MuTagMatchingTool::phiMatch(const Trk::TrackParameters* atSurface, const Muon::M
} else
ATH_MSG_DEBUG(" track not extrapolated to a disc ");
}
if (std::abs(cosphi) > 1.) return false;
double errPhi = std::hypot(PHI_CUT, sigma_phi);
// if the difference between exTrk and Segment phi position falls within the errPhi, accept as rough match
// if( std::acos(cosphi) < errPhi ) return true;
if (std::acos(std::abs(cosphi)) < errPhi)
return true; // BRes: TEMPORARY - segment direction not sure, so I'm making this match symmetric wrt Pi/2
// else ATH_MSG_DEBUG( std::setw(30) << "roughPhi failed: d_phi = " << std::setw(10) << std::acos(cosphi)
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
*/
#ifndef MuTagMatchingTool_H
......@@ -24,6 +24,8 @@
#include "TrkGeometry/TrackingGeometry.h"
#include "TrkParameters/TrackParameters.h"
#include "TrkToolInterfaces/IResidualPullCalculator.h"
#include "TrkDetDescrInterfaces/ITrackingGeometrySvc.h"
#include "TrkGeometry/TrackingGeometry.h"
/**
@class MuTagMatchingTool
......@@ -163,7 +165,11 @@ class MuTagMatchingTool : virtual public IMuTagMatchingTool, public AthAlgTool {
"MuonDetectorManager",
"Key of input MuonDetectorManager condition data",
};
ServiceHandle<Trk::ITrackingGeometrySvc> m_trackingGeometrySvc { this, "TrackingGeometrySvc", "TrackingGeometrySvc/AtlasTrackingGeometrySvc" };
SG::ReadCondHandleKey<Trk::TrackingGeometry> m_trackingGeometryReadKey { this, "TrackingGeometryReadKey", "", "Key of input TrackingGeometry" };
bool m_assumeLocalErrors;
bool m_extrapolatePerigee;
......@@ -190,6 +196,21 @@ class MuTagMatchingTool : virtual public IMuTagMatchingTool, public AthAlgTool {
double m_chamberPullCut;
double m_combinedPullCut;
inline const Trk::TrackingVolume* getVolume(const std::string &vol_name) const {
/// Good old way of retrieving the volume via the geometry service
if (m_trackingGeometryReadKey.empty()) {
return m_trackingGeometrySvc->trackingGeometry()->trackingVolume(vol_name);
}
SG::ReadCondHandle < Trk::TrackingGeometry > handle(m_trackingGeometryReadKey, Gaudi::Hive::currentContext());
if (!handle.isValid()) {
ATH_MSG_WARNING("Could not retrieve a valid tracking geometry");
return nullptr;
}
return handle.cptr()->trackingVolume(vol_name);
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment